mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2025-01-31 06:57:28 +05:00
VC mouse fix & final touches for III/VC 1.1
This commit is contained in:
parent
c0cff240e3
commit
01a7cca723
3 changed files with 115 additions and 13 deletions
|
@ -219,7 +219,9 @@ void __declspec(naked) SubtitlesShadowFix()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_III_10()
|
static char aNoDesktopMode[64];
|
||||||
|
|
||||||
|
void Patch_III_10(const RECT& desktop)
|
||||||
{
|
{
|
||||||
using namespace MemoryVP;
|
using namespace MemoryVP;
|
||||||
|
|
||||||
|
@ -332,9 +334,22 @@ void Patch_III_10()
|
||||||
|
|
||||||
// BOOOOORING fixed
|
// BOOOOORING fixed
|
||||||
Patch<BYTE>(0x4925D7, 10);
|
Patch<BYTE>(0x4925D7, 10);
|
||||||
|
|
||||||
|
// Default to desktop res
|
||||||
|
Patch<DWORD>(0x581E5E, desktop.right);
|
||||||
|
Patch<DWORD>(0x581E68, desktop.bottom);
|
||||||
|
Patch<BYTE>(0x581E72, 32);
|
||||||
|
Patch<const char*>(0x581EA8, aNoDesktopMode);
|
||||||
|
|
||||||
|
// No 12mb vram check
|
||||||
|
Patch<BYTE>(0x581411, 0xEB);
|
||||||
|
|
||||||
|
// No DirectPlay dependency
|
||||||
|
Patch<BYTE>(0x5812D6, 0xB8);
|
||||||
|
Patch<DWORD>(0x5812D7, 0x900);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_III_11()
|
void Patch_III_11(const RECT& desktop)
|
||||||
{
|
{
|
||||||
using namespace MemoryVP;
|
using namespace MemoryVP;
|
||||||
|
|
||||||
|
@ -441,9 +456,22 @@ void Patch_III_11()
|
||||||
// New wndproc
|
// New wndproc
|
||||||
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x581FB4;
|
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x581FB4;
|
||||||
Patch(0x581FB4, &pCustomWndProc);
|
Patch(0x581FB4, &pCustomWndProc);
|
||||||
|
|
||||||
|
// Default to desktop res
|
||||||
|
Patch<DWORD>(0x58219E, desktop.right);
|
||||||
|
Patch<DWORD>(0x5821A8, desktop.bottom);
|
||||||
|
Patch<BYTE>(0x5821B2, 32);
|
||||||
|
Patch<const char*>(0x5821E8, aNoDesktopMode);
|
||||||
|
|
||||||
|
// No 12mb vram check
|
||||||
|
Patch<BYTE>(0x581753, 0xEB);
|
||||||
|
|
||||||
|
// No DirectPlay dependency
|
||||||
|
Patch<BYTE>(0x581620, 0xB8);
|
||||||
|
Patch<DWORD>(0x581621, 0x900);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_III_Steam()
|
void Patch_III_Steam(const RECT& desktop)
|
||||||
{
|
{
|
||||||
using namespace MemoryVP;
|
using namespace MemoryVP;
|
||||||
|
|
||||||
|
@ -546,6 +574,19 @@ void Patch_III_Steam()
|
||||||
// New wndproc
|
// New wndproc
|
||||||
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x581EA4;
|
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x581EA4;
|
||||||
Patch(0x581EA4, &pCustomWndProc);
|
Patch(0x581EA4, &pCustomWndProc);
|
||||||
|
|
||||||
|
// Default to desktop res
|
||||||
|
Patch<DWORD>(0x58208E, desktop.right);
|
||||||
|
Patch<DWORD>(0x582098, desktop.bottom);
|
||||||
|
Patch<BYTE>(0x5820A2, 32);
|
||||||
|
Patch<const char*>(0x5820D8, aNoDesktopMode);
|
||||||
|
|
||||||
|
// No 12mb vram check
|
||||||
|
Patch<BYTE>(0x581653, 0xEB);
|
||||||
|
|
||||||
|
// No DirectPlay dependency
|
||||||
|
Patch<BYTE>(0x581520, 0xB8);
|
||||||
|
Patch<DWORD>(0x581521, 0x900);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
@ -555,15 +596,19 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
|
||||||
if ( fdwReason == DLL_PROCESS_ATTACH )
|
if ( fdwReason == DLL_PROCESS_ATTACH )
|
||||||
{
|
{
|
||||||
if (*(DWORD*)0x5C1E70 == 0x53E58955) Patch_III_10();
|
RECT desktop;
|
||||||
else if (*(DWORD*)0x5C2130 == 0x53E58955) Patch_III_11();
|
GetWindowRect(GetDesktopWindow(), &desktop);
|
||||||
else if (*(DWORD*)0x5C6FD0 == 0x53E58955) Patch_III_Steam();
|
sprintf(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
|
||||||
|
|
||||||
|
if (*(DWORD*)0x5C1E70 == 0x53E58955) Patch_III_10(desktop);
|
||||||
|
else if (*(DWORD*)0x5C2130 == 0x53E58955) Patch_III_11(desktop);
|
||||||
|
else if (*(DWORD*)0x5C6FD0 == 0x53E58955) Patch_III_Steam(desktop);
|
||||||
else return FALSE;
|
else return FALSE;
|
||||||
|
|
||||||
CTimer::Initialise();
|
CTimer::Initialise();
|
||||||
|
|
||||||
HMODULE hDummyHandle;
|
HMODULE hDummyHandle;
|
||||||
GetModuleHandleEx(0, "SilentPatchIII.asi", &hDummyHandle);
|
GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCSTR)&DllMain, &hDummyHandle);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
|
@ -14,6 +14,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
#include "MemoryMgr.h"
|
#include "MemoryMgr.h"
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,9 @@ void __declspec(naked) SubtitlesShadowFix()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char aNoDesktopMode[64];
|
||||||
|
|
||||||
void Patch_VC_10()
|
void Patch_VC_10(const RECT& desktop)
|
||||||
{
|
{
|
||||||
using namespace MemoryVP;
|
using namespace MemoryVP;
|
||||||
|
|
||||||
|
@ -163,9 +164,25 @@ void Patch_VC_10()
|
||||||
|
|
||||||
InjectHook(0x5FA1FD, AlteredPrintString<0x5FA1F6,0x5FA1D5>);
|
InjectHook(0x5FA1FD, AlteredPrintString<0x5FA1F6,0x5FA1D5>);
|
||||||
InjectHook(0x54474D, AlteredPrintStringMinus<0x544727,0x544727>);
|
InjectHook(0x54474D, AlteredPrintStringMinus<0x544727,0x544727>);
|
||||||
|
|
||||||
|
// Mouse fucking fix!
|
||||||
|
Patch<DWORD>(0x601740, 0xC3C030);
|
||||||
|
|
||||||
|
// Default to desktop res
|
||||||
|
Patch<DWORD>(0x600E7E, desktop.right);
|
||||||
|
Patch<DWORD>(0x600E88, desktop.bottom);
|
||||||
|
Patch<BYTE>(0x600E92, 32);
|
||||||
|
Patch<const char*>(0x600EC8, aNoDesktopMode);
|
||||||
|
|
||||||
|
// No 12mb vram check
|
||||||
|
Patch<BYTE>(0x601E26, 0xEB);
|
||||||
|
|
||||||
|
// No DirectPlay dependency
|
||||||
|
Patch<BYTE>(0x601CA0, 0xB8);
|
||||||
|
Patch<DWORD>(0x601CA1, 0x900);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_VC_11()
|
void Patch_VC_11(const RECT& desktop)
|
||||||
{
|
{
|
||||||
using namespace MemoryVP;
|
using namespace MemoryVP;
|
||||||
|
|
||||||
|
@ -221,9 +238,25 @@ void Patch_VC_11()
|
||||||
|
|
||||||
InjectHook(0x5FA21D, AlteredPrintString<0x5FA216,0x5FA1F5>);
|
InjectHook(0x5FA21D, AlteredPrintString<0x5FA216,0x5FA1F5>);
|
||||||
InjectHook(0x54476D, AlteredPrintStringMinus<0x544747,0x544747>);
|
InjectHook(0x54476D, AlteredPrintStringMinus<0x544747,0x544747>);
|
||||||
|
|
||||||
|
// Mouse fucking fix!
|
||||||
|
Patch<DWORD>(0x601770, 0xC3C030);
|
||||||
|
|
||||||
|
// Default to desktop res
|
||||||
|
Patch<DWORD>(0x600E9E, desktop.right);
|
||||||
|
Patch<DWORD>(0x600EA8, desktop.bottom);
|
||||||
|
Patch<BYTE>(0x600EB2, 32);
|
||||||
|
Patch<const char*>(0x600EE8, aNoDesktopMode);
|
||||||
|
|
||||||
|
// No 12mb vram check
|
||||||
|
Patch<BYTE>(0x601E56, 0xEB);
|
||||||
|
|
||||||
|
// No DirectPlay dependency
|
||||||
|
Patch<BYTE>(0x601CD0, 0xB8);
|
||||||
|
Patch<DWORD>(0x601CD1, 0x900);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_VC_Steam()
|
void Patch_VC_Steam(const RECT& desktop)
|
||||||
{
|
{
|
||||||
using namespace MemoryVP;
|
using namespace MemoryVP;
|
||||||
|
|
||||||
|
@ -279,6 +312,22 @@ void Patch_VC_Steam()
|
||||||
|
|
||||||
InjectHook(0x5F9E5D, AlteredPrintString<0x5F9E56,0x5F9E35>);
|
InjectHook(0x5F9E5D, AlteredPrintString<0x5F9E56,0x5F9E35>);
|
||||||
InjectHook(0x54463D, AlteredPrintStringMinus<0x544617,0x544617>);
|
InjectHook(0x54463D, AlteredPrintStringMinus<0x544617,0x544617>);
|
||||||
|
|
||||||
|
// Mouse fucking fix!
|
||||||
|
Patch<DWORD>(0x6013B0, 0xC3C030);
|
||||||
|
|
||||||
|
// Default to desktop res
|
||||||
|
Patch<DWORD>(0x600ADE, desktop.right);
|
||||||
|
Patch<DWORD>(0x600AE8, desktop.bottom);
|
||||||
|
Patch<BYTE>(0x600AF2, 32);
|
||||||
|
Patch<const char*>(0x600B28, aNoDesktopMode);
|
||||||
|
|
||||||
|
// No 12mb vram check
|
||||||
|
Patch<BYTE>(0x601A96, 0xEB);
|
||||||
|
|
||||||
|
// No DirectPlay dependency
|
||||||
|
Patch<BYTE>(0x601910, 0xB8);
|
||||||
|
Patch<DWORD>(0x601911, 0x900);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
@ -288,12 +337,19 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
|
||||||
if ( fdwReason == DLL_PROCESS_ATTACH )
|
if ( fdwReason == DLL_PROCESS_ATTACH )
|
||||||
{
|
{
|
||||||
if(*(DWORD*)0x667BF0 == 0x53E58955) Patch_VC_10();
|
RECT desktop;
|
||||||
else if(*(DWORD*)0x667C40 == 0x53E58955) Patch_VC_11();
|
GetWindowRect(GetDesktopWindow(), &desktop);
|
||||||
else if (*(DWORD*)0x666BA0 == 0x53E58955) Patch_VC_Steam();
|
sprintf(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
|
||||||
|
|
||||||
|
if(*(DWORD*)0x667BF0 == 0x53E58955) Patch_VC_10(desktop);
|
||||||
|
else if(*(DWORD*)0x667C40 == 0x53E58955) Patch_VC_11(desktop);
|
||||||
|
else if (*(DWORD*)0x666BA0 == 0x53E58955) Patch_VC_Steam(desktop);
|
||||||
else return FALSE;
|
else return FALSE;
|
||||||
|
|
||||||
CTimer::Initialise();
|
CTimer::Initialise();
|
||||||
|
|
||||||
|
HMODULE hDummyHandle;
|
||||||
|
GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCSTR)&DllMain, &hDummyHandle);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
Loading…
Reference in a new issue