mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
More stable framelimiter - III
This commit is contained in:
parent
4d459e0ad4
commit
3b98e5abaf
1 changed files with 33 additions and 0 deletions
|
@ -234,6 +234,21 @@ char* GetMyDocumentsPath()
|
||||||
return cUserFilesPath;
|
return cUserFilesPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LARGE_INTEGER FrameTime;
|
||||||
|
DWORD GetTimeSinceLastFrame()
|
||||||
|
{
|
||||||
|
LARGE_INTEGER curTime;
|
||||||
|
QueryPerformanceCounter(&curTime);
|
||||||
|
return curTime.QuadPart - FrameTime.QuadPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void (*RsEventHandler)(int, void*);
|
||||||
|
void NewFrameRender(int nEvent, void* pParam)
|
||||||
|
{
|
||||||
|
QueryPerformanceCounter(&FrameTime);
|
||||||
|
RsEventHandler(nEvent, pParam);
|
||||||
|
}
|
||||||
|
|
||||||
static char aNoDesktopMode[64];
|
static char aNoDesktopMode[64];
|
||||||
|
|
||||||
void Patch_III_10(const RECT& desktop)
|
void Patch_III_10(const RECT& desktop)
|
||||||
|
@ -350,6 +365,12 @@ void Patch_III_10(const RECT& desktop)
|
||||||
// BOOOOORING fixed
|
// BOOOOORING fixed
|
||||||
Patch<BYTE>(0x4925D7, 10);
|
Patch<BYTE>(0x4925D7, 10);
|
||||||
|
|
||||||
|
// (Hopefully) more precise frame limiter
|
||||||
|
int pAddress = 0x582EFD;
|
||||||
|
RsEventHandler = (void(*)(int,void*))(*(int*)(pAddress+1) + pAddress + 5);
|
||||||
|
InjectHook(pAddress, NewFrameRender);
|
||||||
|
InjectHook(0x582EA4, GetTimeSinceLastFrame);
|
||||||
|
|
||||||
// Default to desktop res
|
// Default to desktop res
|
||||||
Patch<DWORD>(0x581E5E, desktop.right);
|
Patch<DWORD>(0x581E5E, desktop.right);
|
||||||
Patch<DWORD>(0x581E68, desktop.bottom);
|
Patch<DWORD>(0x581E68, desktop.bottom);
|
||||||
|
@ -475,6 +496,12 @@ void Patch_III_11(const RECT& desktop)
|
||||||
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x581FB4;
|
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x581FB4;
|
||||||
Patch(0x581FB4, &pCustomWndProc);
|
Patch(0x581FB4, &pCustomWndProc);
|
||||||
|
|
||||||
|
// (Hopefully) more precise frame limiter
|
||||||
|
int pAddress = 0x58323D;
|
||||||
|
RsEventHandler = (void(*)(int,void*))(*(int*)(pAddress+1) + pAddress + 5);
|
||||||
|
InjectHook(pAddress, NewFrameRender);
|
||||||
|
InjectHook(0x5831E4, GetTimeSinceLastFrame);
|
||||||
|
|
||||||
// Default to desktop res
|
// Default to desktop res
|
||||||
Patch<DWORD>(0x58219E, desktop.right);
|
Patch<DWORD>(0x58219E, desktop.right);
|
||||||
Patch<DWORD>(0x5821A8, desktop.bottom);
|
Patch<DWORD>(0x5821A8, desktop.bottom);
|
||||||
|
@ -596,6 +623,12 @@ void Patch_III_Steam(const RECT& desktop)
|
||||||
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x581EA4;
|
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x581EA4;
|
||||||
Patch(0x581EA4, &pCustomWndProc);
|
Patch(0x581EA4, &pCustomWndProc);
|
||||||
|
|
||||||
|
// (Hopefully) more precise frame limiter
|
||||||
|
int pAddress = 0x58312D;
|
||||||
|
RsEventHandler = (void(*)(int,void*))(*(int*)(pAddress+1) + pAddress + 5);
|
||||||
|
InjectHook(pAddress, NewFrameRender);
|
||||||
|
InjectHook(0x5830D4, GetTimeSinceLastFrame);
|
||||||
|
|
||||||
// Default to desktop res
|
// Default to desktop res
|
||||||
Patch<DWORD>(0x58208E, desktop.right);
|
Patch<DWORD>(0x58208E, desktop.right);
|
||||||
Patch<DWORD>(0x582098, desktop.bottom);
|
Patch<DWORD>(0x582098, desktop.bottom);
|
||||||
|
|
Loading…
Reference in a new issue