mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-28 06:43:01 +05:00
FILE_FLAG_NO_BUFFERING fix moved to fixes-shared-with-ddraw
This commit is contained in:
parent
bf8f58970d
commit
b60c4dbfcf
5 changed files with 24 additions and 17 deletions
|
@ -47,14 +47,14 @@ char* GetMyDocumentsPath()
|
||||||
|
|
||||||
void InjectHooks()
|
void InjectHooks()
|
||||||
{
|
{
|
||||||
using namespace Memory::VP;
|
|
||||||
|
|
||||||
static char aNoDesktopMode[64];
|
static char aNoDesktopMode[64];
|
||||||
|
|
||||||
RECT desktop;
|
RECT desktop;
|
||||||
GetWindowRect(GetDesktopWindow(), &desktop);
|
GetWindowRect(GetDesktopWindow(), &desktop);
|
||||||
sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
|
sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
|
||||||
|
|
||||||
|
std::unique_ptr<ScopedUnprotect::Unprotect> Protect = ScopedUnprotect::UnprotectSectionOrFullModule( GetModuleHandle( nullptr ), ".text" );
|
||||||
|
|
||||||
if (*(DWORD*)0x5C1E75 == 0xB85548EC)
|
if (*(DWORD*)0x5C1E75 == 0xB85548EC)
|
||||||
{
|
{
|
||||||
// III 1.0
|
// III 1.0
|
||||||
|
@ -92,6 +92,8 @@ void InjectHooks()
|
||||||
ppUserFilesDir = (char**)0x601ECA;
|
ppUserFilesDir = (char**)0x601ECA;
|
||||||
Common::Patches::DDraw_VC_Steam( desktop, aNoDesktopMode );
|
Common::Patches::DDraw_VC_Steam( desktop, aNoDesktopMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Common::Patches::DDraw_Common();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool rwcsegUnprotected = false;
|
static bool rwcsegUnprotected = false;
|
||||||
|
|
|
@ -104,7 +104,6 @@ namespace Common {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================= VC =================
|
// ================= VC =================
|
||||||
|
|
||||||
void DDraw_VC_10( const RECT& desktop, const char* desktopText )
|
void DDraw_VC_10( const RECT& desktop, const char* desktopText )
|
||||||
{
|
{
|
||||||
using namespace Memory;
|
using namespace Memory;
|
||||||
|
@ -171,5 +170,21 @@ namespace Common {
|
||||||
Patch<BYTE>(0x601910, 0xB8);
|
Patch<BYTE>(0x601910, 0xB8);
|
||||||
Patch<DWORD>(0x601911, 0x900);
|
Patch<DWORD>(0x601911, 0x900);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ================= COMMON =================
|
||||||
|
void DDraw_Common()
|
||||||
|
{
|
||||||
|
using namespace Memory;
|
||||||
|
using namespace hook;
|
||||||
|
|
||||||
|
// Remove FILE_FLAG_NO_BUFFERING from CdStreams
|
||||||
|
{
|
||||||
|
auto mem = pattern( "81 7C 24 04 00 08 00 00" ).count_hint(1);
|
||||||
|
if ( mem.size() == 1 )
|
||||||
|
{
|
||||||
|
Patch<uint8_t>( mem.get_first( 0x12 ), 0xEB );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,5 +21,7 @@ namespace Common
|
||||||
void DDraw_VC_10( const RECT& desktop, const char* desktopText );
|
void DDraw_VC_10( const RECT& desktop, const char* desktopText );
|
||||||
void DDraw_VC_11( const RECT& desktop, const char* desktopText );
|
void DDraw_VC_11( const RECT& desktop, const char* desktopText );
|
||||||
void DDraw_VC_Steam( const RECT& desktop, const char* desktopText );
|
void DDraw_VC_Steam( const RECT& desktop, const char* desktopText );
|
||||||
|
|
||||||
|
void DDraw_Common();
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -752,12 +752,6 @@ void Patch_III_Common()
|
||||||
InjectHook( hookPoint.get<void>( 0x21 + 5 ), jmpPoint, PATCH_JUMP );
|
InjectHook( hookPoint.get<void>( 0x21 + 5 ), jmpPoint, PATCH_JUMP );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove FILE_FLAG_NO_BUFFERING from CdStreams
|
|
||||||
{
|
|
||||||
auto addr = get_pattern( "81 7C 24 04 00 08 00 00", 0x12 );
|
|
||||||
Patch<uint8_t>( addr, 0xEB );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alt+F4
|
// Alt+F4
|
||||||
{
|
{
|
||||||
auto addr = pattern( "59 59 31 C0 83 C4 48 5D 5F 5E 5B C2 10 00" ).count(2);
|
auto addr = pattern( "59 59 31 C0 83 C4 48 5D 5F 5E 5B C2 10 00" ).count(2);
|
||||||
|
@ -841,9 +835,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
if (*(DWORD*)0x5C1E75 == 0xB85548EC) Patch_III_10(desktop);
|
if (*(DWORD*)0x5C1E75 == 0xB85548EC) Patch_III_10(desktop);
|
||||||
else if (*(DWORD*)0x5C2135 == 0xB85548EC) Patch_III_11(desktop);
|
else if (*(DWORD*)0x5C2135 == 0xB85548EC) Patch_III_11(desktop);
|
||||||
else if (*(DWORD*)0x5C6FD5 == 0xB85548EC) Patch_III_Steam(desktop);
|
else if (*(DWORD*)0x5C6FD5 == 0xB85548EC) Patch_III_Steam(desktop);
|
||||||
else return TRUE;
|
|
||||||
|
|
||||||
Patch_III_Common();
|
Patch_III_Common();
|
||||||
|
Common::Patches::DDraw_Common();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Patches::FixRwcseg_Patterns();
|
Common::Patches::FixRwcseg_Patterns();
|
||||||
|
|
|
@ -559,12 +559,6 @@ void Patch_VC_Common()
|
||||||
InjectHook( hookPoint.get<void>( 0x21 + 5 ), jmpPoint, PATCH_JUMP );
|
InjectHook( hookPoint.get<void>( 0x21 + 5 ), jmpPoint, PATCH_JUMP );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove FILE_FLAG_NO_BUFFERING from CdStreams
|
|
||||||
{
|
|
||||||
auto addr = get_pattern( "81 7C 24 04 00 08 00 00", 0x12 );
|
|
||||||
Patch<uint8_t>( addr, 0xEB );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alt+F4
|
// Alt+F4
|
||||||
{
|
{
|
||||||
auto addr = pattern( "59 59 31 C0 83 C4 70 5D 5F 5E 5B C2 10 00" ).count(2);
|
auto addr = pattern( "59 59 31 C0 83 C4 70 5D 5F 5E 5B C2 10 00" ).count(2);
|
||||||
|
@ -656,9 +650,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
|
||||||
// Y axis sensitivity only
|
// Y axis sensitivity only
|
||||||
else if (*(DWORD*)0x601048 == 0x5E5F5D60) Patch_VC_JP();
|
else if (*(DWORD*)0x601048 == 0x5E5F5D60) Patch_VC_JP();
|
||||||
else return TRUE;
|
|
||||||
|
|
||||||
Patch_VC_Common();
|
Patch_VC_Common();
|
||||||
|
Common::Patches::DDraw_Common();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Patches::FixRwcseg_Patterns();
|
Common::Patches::FixRwcseg_Patterns();
|
||||||
|
|
Loading…
Reference in a new issue