mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2025-01-01 08:43:01 +05:00
More stable framelimiter - VC
This commit is contained in:
parent
f3218c9ee3
commit
4d459e0ad4
1 changed files with 33 additions and 0 deletions
|
@ -121,6 +121,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_VC_10(const RECT& desktop)
|
void Patch_VC_10(const RECT& desktop)
|
||||||
|
@ -183,6 +198,12 @@ void Patch_VC_10(const RECT& desktop)
|
||||||
// Mouse fucking fix!
|
// Mouse fucking fix!
|
||||||
Patch<DWORD>(0x601740, 0xC3C030);
|
Patch<DWORD>(0x601740, 0xC3C030);
|
||||||
|
|
||||||
|
// (Hopefully) more precise frame limiter
|
||||||
|
int pAddress = 0x6004A2;
|
||||||
|
RsEventHandler = (void(*)(int,void*))(*(int*)(pAddress+1) + pAddress + 5);
|
||||||
|
InjectHook(pAddress, NewFrameRender);
|
||||||
|
InjectHook(0x600449, GetTimeSinceLastFrame);
|
||||||
|
|
||||||
// Default to desktop res
|
// Default to desktop res
|
||||||
Patch<DWORD>(0x600E7E, desktop.right);
|
Patch<DWORD>(0x600E7E, desktop.right);
|
||||||
Patch<DWORD>(0x600E88, desktop.bottom);
|
Patch<DWORD>(0x600E88, desktop.bottom);
|
||||||
|
@ -263,6 +284,12 @@ void Patch_VC_11(const RECT& desktop)
|
||||||
// Mouse fucking fix!
|
// Mouse fucking fix!
|
||||||
Patch<DWORD>(0x601770, 0xC3C030);
|
Patch<DWORD>(0x601770, 0xC3C030);
|
||||||
|
|
||||||
|
// (Hopefully) more precise frame limiter
|
||||||
|
int pAddress = 0x6004C2;
|
||||||
|
RsEventHandler = (void(*)(int,void*))(*(int*)(pAddress+1) + pAddress + 5);
|
||||||
|
InjectHook(pAddress, NewFrameRender);
|
||||||
|
InjectHook(0x600469, GetTimeSinceLastFrame);
|
||||||
|
|
||||||
// Default to desktop res
|
// Default to desktop res
|
||||||
Patch<DWORD>(0x600E9E, desktop.right);
|
Patch<DWORD>(0x600E9E, desktop.right);
|
||||||
Patch<DWORD>(0x600EA8, desktop.bottom);
|
Patch<DWORD>(0x600EA8, desktop.bottom);
|
||||||
|
@ -343,6 +370,12 @@ void Patch_VC_Steam(const RECT& desktop)
|
||||||
// Mouse fucking fix!
|
// Mouse fucking fix!
|
||||||
Patch<DWORD>(0x6013B0, 0xC3C030);
|
Patch<DWORD>(0x6013B0, 0xC3C030);
|
||||||
|
|
||||||
|
// (Hopefully) more precise frame limiter
|
||||||
|
int pAddress = 0x600102;
|
||||||
|
RsEventHandler = (void(*)(int,void*))(*(int*)(pAddress+1) + pAddress + 5);
|
||||||
|
InjectHook(pAddress, NewFrameRender);
|
||||||
|
InjectHook(0x6000A9, GetTimeSinceLastFrame);
|
||||||
|
|
||||||
// Default to desktop res
|
// Default to desktop res
|
||||||
Patch<DWORD>(0x600ADE, desktop.right);
|
Patch<DWORD>(0x600ADE, desktop.right);
|
||||||
Patch<DWORD>(0x600AE8, desktop.bottom);
|
Patch<DWORD>(0x600AE8, desktop.bottom);
|
||||||
|
|
Loading…
Reference in a new issue