SIMPHYNITY Game Plugin
Example game plugin DLL for SIMPHYNITY
|
Go to the source code of this file.
Classes | |
struct | GAME_SETTINGS |
struct | REMOTE_CONFIG |
struct | TELEMETRY_DATA |
Macros | |
#define | DLL_EXPORT |
#define | DECLDIR __declspec(dllexport) |
Enumerations | |
enum | DISPLAY_SPEED_UNITS { DISPLAY_SPEED_UNITS_KPH = 0, DISPLAY_SPEED_UNITS_MPH, DISPLAY_SPEED_UNITS_KNOTS, DISPLAY_SPEED_UNITS_MS } |
enum | GFX_RENDER_FUNCTION { RENDER_FUNCTION_GDI_SWAPBUFFERS = 0, RENDER_FUNCTION_OGL_WGLSWAPBUFFERS, RENDER_FUNCTION_OGL_FINISH, RENDER_FUNCTION_OGL_FLUSH, RENDER_FUNCTION_D3D_PRESENT = 0, RENDER_FUNCTION_D3D_ENDSCENE, RENDER_FUNCTION_D3DSC_PRESENT, RENDER_FUNCTION_DXGI_PRESENT = 0 } |
enum | KEYBOARD_HOOK_METHOD { KEYBOARD_HOOK_METHOD_WNDPROC = 0, KEYBOARD_HOOK_METHOD_SETWINDOWSHOOKEX, KEYBOARD_HOOK_METHOD_GETASYNCKEYSTATE } |
Functions | |
BOOL APIENTRY | DllMain (HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) |
DECLDIR void | GetDefaultSettings (const GAME_SETTINGS *settings) |
DECLDIR int | GetNumExeNames () |
DECLDIR void | GetExeName (int index, const TCHAR *exeName) |
DECLDIR int | GetNumParentDirs () |
DECLDIR void | GetParentDir (int index, const TCHAR *dir) |
DECLDIR void | GetSimphyintyRemoteSettings (const REMOTE_CONFIG *settings) |
DECLDIR void | OnGameDetected () |
DECLDIR void | OnGameLost () |
DECLDIR void | GetTelemetryData (const TELEMETRY_DATA *telem) |
Contains declarations for use by the SIMPHYNITY plugin DLL. NB The compiled .dll file must be placed in the gameplugins subdirectory in SIMPHYNITY's installation directory, and named after the game it pertains to, as this will be assumed to be the game 'title' in SIMPHYNITY.
enum DISPLAY_SPEED_UNITS |
Display speed units (for use by GAME_SETTINGS.displaySpeedUnits).
Members:-
DISPLAY_SPEED_UNITS_KPH
Show display speed as kilometers per hour (KPH).
DISPLAY_SPEED_UNITS_MPH
Show display speed as miles per hour (MPH).
DISPLAY_SPEED_UNITS_KNOTS
Show display speed as knots (Kts).
DISPLAY_SPEED_UNITS_MS
Show display speed as raw meters per second (m/s). Dial will not have units type displayed.
enum GFX_RENDER_FUNCTION |
Rendering function identifiers (for use by REMOTE_CONFIG.gfxRenderFunction)
Members:-
RENDER_FUNCTION_GDI_SWAPBUFFERS
SwapBuffers (Gdi32.dll) - default for most openGL games.
RENDER_FUNCTION_OGL_WGLSWAPBUFFERS
wglSwapBuffers (OpenGL32.dll)
RENDER_FUNCTION_OGL_FINISH
glFinish (OpenGL32.dll)
RENDER_FUNCTION_OGL_FLUSH
glFlush (OpenGL32.dll)
RENDER_FUNCTION_D3D_PRESENT
IDirect3DDevice8/9::Present - default for most DX8/DX9 games.
RENDER_FUNCTION_D3D_ENDSCENE
IDirect3DDevice8/9::EndScene
RENDER_FUNCTION_D3DSC_PRESENT
IDirect3DSwapChain9::Present
RENDER_FUNCTION_DXGI_PRESENT
IDXGISwapChain::Present - default for most DX10/DX11 games.
enum KEYBOARD_HOOK_METHOD |
Keyboard hooking methods (for use by REMOTE_CONFIG.kbHookingMethod).
Members:-
KEYBOARD_HOOK_METHOD_WNDPROC
Override the process parent window's WndProc method to intercept WM_KEYDOWN messages (default best method for most games).
KEYBOARD_HOOK_METHOD_SETWINDOWSHOOKEX
Hook the keyboard via SetWindowsHookEx (WH_KEYBOARD).
KEYBOARD_HOOK_METHOD_GETASYNCKEYSTATE
Most brute-force approach - poll pressed state of keys we're interested in via GetAsyncKeyState method.
BOOL APIENTRY DllMain | ( | HMODULE | hModule, |
DWORD | ul_reason_for_call, | ||
LPVOID | lpReserved | ||
) |
Entry point for the DLL. Perform any initialization / destruction required for this plugin here. (See Win32 documentation for more information).
DECLDIR void GetDefaultSettings | ( | const GAME_SETTINGS * | settings | ) |
Configures the default settings for this game (as configurable by the game settings panel in the Simphynity UI). It is mandatory this structure is correctly configured - for more information see the GAME_SETTINGS structure documentation.
settings | The game settings structure. |
DECLDIR void GetExeName | ( | int | index, |
const TCHAR * | exeName | ||
) |
Called by Simphynity to get executable name N for the game (specified by the supplied index). See also GetNumExeNames(...).
index | The index of the executable name requested |
exeName | The buffer to copy the (null-terminated) executable name string into. NB: THIS MUST NOT EXCEED 32 CHARACTERS. |
DECLDIR int GetNumExeNames | ( | ) |
Called by Simphynity to query the number of possible executable names that exist for this game. E.g. some titles might have separate dx9 and/or dx11 executables with different names. It is the executable name (combined with the parent dirs, see below) that Simphynity uses to determine if the game is running.
DECLDIR int GetNumParentDirs | ( | ) |
Called by Simphynity to query the number of possible parent sub-directories that exist for this game's executable (.exe) file. E.g. some titles may be installed via different methods (e.g. digital download or DVD), and installed to different paths depending on the method. This gives the possible most deeply-nested install subpaths (not fully qualified paths) for the executable file.
The purpose of this information is to allow Simphynity to better determine that it has detected the game we're actually interested in, and not another process with the same executable name. When Simphynity is idle, it periodically checks all running processes and gets their full installation paths. If the executable name (excluding its path) is matched with one of those returned from 'GetExeName(...)' above, it then proceeds to check the immediate parent directory (or path) of the executable to further determine this is definately the .exe we're interested in. A parent directory can be specified in as many depth levels (starting from the exe name and working upwards through the directory hierarchy) as desired, each depth level being separated via a '/' (or '\', NB '\' will not function as intended)
E.g. 'rFactor.exe' may have the parent directory "bin", or if we want Simphynity to be more scrutinous, "rFactor/bin".
If we don't wish to specify parent dirs (and detect purely by executable name alone), simply return '0' from GetNumParentDirs().
DECLDIR void GetParentDir | ( | int | index, |
const TCHAR * | dir | ||
) |
Called by Simphynity to get possible parent directory N for the game (specified by the supplied index). See GetNumParentDirs() for more information.
index | The index of the parent directory requested |
exeName | The buffer to copy the (null-terminated) parent directory string into. NB: THIS MUST NOT EXCEED 128 CHARACTERS. |
DECLDIR void GetSimphyintyRemoteSettings | ( | const REMOTE_CONFIG * | settings | ) |
Supplied with a REMOTE_CONFIG parameter (containing pre-configured default values) to allow Simphynity Remote to be enabled/disabled and/or configured according to our requirements. See the REMOTE_CONFIG structure documentation for more information regarding its members.
settings | The Simphynity Remote settings for this game. |
DECLDIR void GetTelemetryData | ( | const TELEMETRY_DATA * | telem | ) |
Called by Simphynity to request the most recent telemetry data available from the game. This is the data used to update any in-game output dials, device output previews and the devices themselves. See the TELEMETRY_DATA structure documentation for more information regarding what needs to be provided here.
telem | The structure to update with the latest telemetry data. |
DECLDIR void OnGameDetected | ( | ) |
Called by Simphynity when our game process has been detected. Perform any actions required upon game detection here.
DECLDIR void OnGameLost | ( | ) |
Called by Simphynity when our game process has been lost (i.e. the game has been terminated). Perform any actions required upon game undetection here.