Fixed the game disappearing from the taskbar after using Alt+Tab

Code change to the input patch.
Updated version number.
This commit is contained in:
NovaRain
2024-02-16 09:30:16 +08:00
parent 4ef8986bda
commit 273c44e788
3 changed files with 28 additions and 3 deletions
+25
View File
@@ -117,6 +117,24 @@ static void combat_ai_reset() {
std::memcpy(caps, &aiCapsBackup[0], num_caps * sizeof(fo::AIcap));
}
static void __declspec(naked) GNW95_init_window_hack() {
__asm {
pop eax;
push 0x50FA0C; // "GNW95 Class"
push (WS_EX_TOPMOST | WS_EX_APPWINDOW); // was WS_EX_TOPMOST
jmp eax;
}
}
static void __declspec(naked) GNW95_init_window_hack_HRP() {
__asm {
pop eax;
push 0x50FA0C; // "GNW95 Class"
push WS_EX_APPWINDOW; // was 0
jmp eax;
}
}
// fix for vanilla negate operator not working on floats
static void __declspec(naked) NegateFixHack() {
static const DWORD NegateFixHack_Back = 0x46AB77;
@@ -3399,6 +3417,13 @@ void BugFixes::init() {
if (IniReader::GetIntDefaultConfig("Debugging", "BugFixes", 1) == 0) return;
#endif
// Fix for the game disappearing from the taskbar after using Alt+Tab
MakeCall(0x4CAF14, GNW95_init_window_hack, 2);
if (hrpVersionValid) { // for HRP 4.1.8 in DD7/DX9 mode
MakeCall(HRPAddress(0x10026504), GNW95_init_window_hack_HRP, 2); // windowed
MakeCall(HRPAddress(0x10026605), GNW95_init_window_hack, 2); // fullscreen
}
// Fix vanilla negate operator for float values
MakeCall(0x46AB68, NegateFixHack);
+1 -1
View File
@@ -28,7 +28,7 @@ namespace sfall
void Input::init() {
//if (IniReader::GetConfigInt("Input", "Enable", 0)) {
dlogr("Applying input patch.", DL_INIT);
SafeWriteStr(0x50FB70, "ddraw.dll");
SafeWrite32(0x4DE902, 0x50FB50); // "DDRAW.DLL"
::sfall::availableGlobalScriptTypes |= 1;
//}
}
+2 -2
View File
@@ -25,6 +25,6 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 8
#define VERSION_BUILD 42
#define VERSION_REV 0
#define VERSION_REV 1
#define VERSION_STRING "3.8.42"
#define VERSION_STRING "3.8.42.1"