Sunshine master
Self-hosted game stream host for Moonlight.
nvapi_opensource_wrapper.cpp File Reference

Definitions for the NVAPI wrapper. More...

#include <map>
#include "driver_settings.h"
#include "nvprefs_common.h"
#include <nvapi_interface.h>
Include dependency graph for nvapi_opensource_wrapper.cpp:

Macros

#define NVAPI_INTERFACE   NvAPI_Status __cdecl
 Macro for NVAPI INTERFACE.
 

Functions

NvAPI_Status __cdecl NvAPI_DRS_CreateApplication (NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NVDRS_APPLICATION *pApplication)
 Forward NvAPI_DRS_CreateApplication to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_DRS_CreateProfile (NvDRSSessionHandle hSession, NVDRS_PROFILE *pProfileInfo, NvDRSProfileHandle *phProfile)
 Forward NvAPI_DRS_CreateProfile to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_DRS_CreateSession (NvDRSSessionHandle *phSession)
 Forward NvAPI_DRS_CreateSession to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_DRS_DeleteProfileSetting (NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NvU32 settingId)
 Forward NvAPI_DRS_DeleteProfileSetting to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_DRS_DestroySession (NvDRSSessionHandle hSession)
 Forward NvAPI_DRS_DestroySession to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_DRS_FindProfileByName (NvDRSSessionHandle hSession, NvAPI_UnicodeString profileName, NvDRSProfileHandle *phProfile)
 Forward NvAPI_DRS_FindProfileByName to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_DRS_GetApplicationInfo (NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NvAPI_UnicodeString appName, NVDRS_APPLICATION *pApplication)
 Forward NvAPI_DRS_GetApplicationInfo to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_DRS_GetBaseProfile (NvDRSSessionHandle hSession, NvDRSProfileHandle *phProfile)
 Forward NvAPI_DRS_GetBaseProfile to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_DRS_GetSetting (NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NvU32 settingId, NVDRS_SETTING *pSetting)
 Forward NvAPI_DRS_GetSetting to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_DRS_LoadSettings (NvDRSSessionHandle hSession)
 Forward NvAPI_DRS_LoadSettings to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_DRS_SaveSettings (NvDRSSessionHandle hSession)
 Forward NvAPI_DRS_SaveSettings to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_DRS_SetSetting (NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NVDRS_SETTING *pSetting)
 Forward NvAPI_DRS_SetSetting to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_GetErrorMessage (NvAPI_Status nr, NvAPI_ShortString szDesc)
 Forward NvAPI_GetErrorMessage to the loaded NVAPI DLL.
 
NvAPI_Status __cdecl NvAPI_Initialize ()
 Load NVAPI and resolve the subset of interfaces used by Sunshine.
 
void *__cdecl nvapi_QueryInterface (NvU32 id)
 NVAPI export used to resolve function pointers by interface ID.
 
NvAPI_Status __cdecl NvAPI_Unload ()
 Unload NVAPI and clear all resolved interface pointers.
 

Detailed Description

Definitions for the NVAPI wrapper.

Function Documentation

◆ NvAPI_DRS_CreateApplication()

NvAPI_Status __cdecl NvAPI_DRS_CreateApplication ( NvDRSSessionHandle hSession,
NvDRSProfileHandle hProfile,
NVDRS_APPLICATION * pApplication )

Forward NvAPI_DRS_CreateApplication to the loaded NVAPI DLL.

Parameters
hSessionDRS session that owns the profile.
hProfileProfile receiving the application entry.
pApplicationApplication entry to create.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_DRS_CreateProfile()

NvAPI_Status __cdecl NvAPI_DRS_CreateProfile ( NvDRSSessionHandle hSession,
NVDRS_PROFILE * pProfileInfo,
NvDRSProfileHandle * phProfile )

Forward NvAPI_DRS_CreateProfile to the loaded NVAPI DLL.

Parameters
hSessionDRS session that owns the profile.
pProfileInfoProfile definition to create.
phProfileOutput handle for the created profile.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_DRS_CreateSession()

NvAPI_Status __cdecl NvAPI_DRS_CreateSession ( NvDRSSessionHandle * phSession)

Forward NvAPI_DRS_CreateSession to the loaded NVAPI DLL.

Parameters
phSessionOutput handle for the created DRS session.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_DRS_DeleteProfileSetting()

NvAPI_Status __cdecl NvAPI_DRS_DeleteProfileSetting ( NvDRSSessionHandle hSession,
NvDRSProfileHandle hProfile,
NvU32 settingId )

Forward NvAPI_DRS_DeleteProfileSetting to the loaded NVAPI DLL.

Parameters
hSessionDRS session that owns the profile.
hProfileProfile containing the setting.
settingIdSetting ID.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_DRS_DestroySession()

NvAPI_Status __cdecl NvAPI_DRS_DestroySession ( NvDRSSessionHandle hSession)

Forward NvAPI_DRS_DestroySession to the loaded NVAPI DLL.

Parameters
hSessionDRS session handle to destroy.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_DRS_FindProfileByName()

NvAPI_Status __cdecl NvAPI_DRS_FindProfileByName ( NvDRSSessionHandle hSession,
NvAPI_UnicodeString profileName,
NvDRSProfileHandle * phProfile )

Forward NvAPI_DRS_FindProfileByName to the loaded NVAPI DLL.

Parameters
hSessionDRS session to search.
profileNameProfile name.
phProfileOutput handle for the matched profile.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_DRS_GetApplicationInfo()

NvAPI_Status __cdecl NvAPI_DRS_GetApplicationInfo ( NvDRSSessionHandle hSession,
NvDRSProfileHandle hProfile,
NvAPI_UnicodeString appName,
NVDRS_APPLICATION * pApplication )

Forward NvAPI_DRS_GetApplicationInfo to the loaded NVAPI DLL.

Parameters
hSessionDRS session that owns the profile.
hProfileProfile containing the application entry.
appNameApp name.
pApplicationOutput application information.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_DRS_GetBaseProfile()

NvAPI_Status __cdecl NvAPI_DRS_GetBaseProfile ( NvDRSSessionHandle hSession,
NvDRSProfileHandle * phProfile )

Forward NvAPI_DRS_GetBaseProfile to the loaded NVAPI DLL.

Parameters
hSessionDRS session to query.
phProfileOutput handle for the base profile.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_DRS_GetSetting()

NvAPI_Status __cdecl NvAPI_DRS_GetSetting ( NvDRSSessionHandle hSession,
NvDRSProfileHandle hProfile,
NvU32 settingId,
NVDRS_SETTING * pSetting )

Forward NvAPI_DRS_GetSetting to the loaded NVAPI DLL.

Parameters
hSessionDRS session that owns the profile.
hProfileProfile containing the setting.
settingIdSetting ID.
pSettingOutput setting value.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_DRS_LoadSettings()

NvAPI_Status __cdecl NvAPI_DRS_LoadSettings ( NvDRSSessionHandle hSession)

Forward NvAPI_DRS_LoadSettings to the loaded NVAPI DLL.

Parameters
hSessionDRS session whose settings are loaded.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_DRS_SaveSettings()

NvAPI_Status __cdecl NvAPI_DRS_SaveSettings ( NvDRSSessionHandle hSession)

Forward NvAPI_DRS_SaveSettings to the loaded NVAPI DLL.

Parameters
hSessionDRS session whose settings are saved.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_DRS_SetSetting()

NvAPI_Status __cdecl NvAPI_DRS_SetSetting ( NvDRSSessionHandle hSession,
NvDRSProfileHandle hProfile,
NVDRS_SETTING * pSetting )

Forward NvAPI_DRS_SetSetting to the loaded NVAPI DLL.

Parameters
hSessionDRS session that owns the profile.
hProfileProfile receiving the setting.
pSettingSetting value to apply.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_GetErrorMessage()

NvAPI_Status __cdecl NvAPI_GetErrorMessage ( NvAPI_Status nr,
NvAPI_ShortString szDesc )

Forward NvAPI_GetErrorMessage to the loaded NVAPI DLL.

Parameters
nrController index assigned by the client.
szDescOutput buffer receiving the human-readable error string.
Returns
NVAPI status returned by the loaded function.

◆ NvAPI_Initialize()

NvAPI_Status __cdecl NvAPI_Initialize ( )

Load NVAPI and resolve the subset of interfaces used by Sunshine.

Returns
NVAPI_OK on success, or NVAPI_LIBRARY_NOT_FOUND when the DLL cannot be loaded.

◆ nvapi_QueryInterface()

void *__cdecl nvapi_QueryInterface ( NvU32 id)
extern

NVAPI export used to resolve function pointers by interface ID.

Parameters
idNVAPI interface ID from the generated interface table.
Returns
Function pointer for the requested NVAPI interface, or nullptr.

◆ NvAPI_Unload()

NvAPI_Status __cdecl NvAPI_Unload ( )

Unload NVAPI and clear all resolved interface pointers.

Returns
NVAPI_OK after cleanup.