1
0
mirror of synced 2024-11-13 14:40:45 +01:00

- Sega Rally 3: Added freeplay and language settings

This commit is contained in:
Harm 2020-12-26 16:50:34 +01:00
parent f6ffb9cdc1
commit 0fe76287fd

View File

@ -10,7 +10,7 @@ int __stdcall Sr3FfbFunc(DWORD device, DWORD data)
return 0;
}
BOOL(__stdcall* GetPrivateProfileIntAOri)(LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName);
DWORD(__stdcall* GetPrivateProfileIntAOri)(LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName);
DWORD WINAPI GetPrivateProfileIntAHook(LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName)
{
@ -22,10 +22,31 @@ DWORD WINAPI GetPrivateProfileIntAHook(LPCSTR lpAppName, LPCSTR lpKeyName, INT n
return FetchDwordInformation("General", "ResolutionWidth", 1280);
else if (_stricmp(lpKeyName, "VerticalResolution") == 0)
return FetchDwordInformation("General", "ResolutionHeight", 720);
else if (_stricmp(lpKeyName, "Freeplay") == 0)
return (DWORD)ToBool(config["General"]["FreePlay"]);
else
return GetPrivateProfileIntAOri(lpAppName, lpKeyName, nDefault, lpFileName);
}
DWORD(__stdcall* GetPrivateProfileStringAOri)(LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName);
DWORD WINAPI GetPrivateProfileStringAHook(LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName)
{
#ifdef _DEBUG
info(true, "GetPrivateProfileStringAHook %s", lpKeyName);
#endif
if (_stricmp(lpKeyName, "LANGUAGE") == 0)
{
strcpy(lpReturnedString, config["General"]["Language"].c_str());
return nSize;
}
else
{
return GetPrivateProfileStringAOri(lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize, lpFileName);
}
}
HWND(__stdcall* CreateWindowExAOrg)(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
static HWND WINAPI CreateWindowExAHook(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)
@ -101,6 +122,7 @@ static InitFunction sr3Func([]()
}
MH_CreateHookApi(L"kernel32.dll", "GetPrivateProfileIntA", &GetPrivateProfileIntAHook, (void**)&GetPrivateProfileIntAOri);
MH_CreateHookApi(L"kernel32.dll", "GetPrivateProfileStringA", &GetPrivateProfileStringAHook, (void**)&GetPrivateProfileStringAOri);
MH_EnableHook(MH_ALL_HOOKS);
}, GameID::SR3);