Skip to content

Commit

Permalink
Fixed the game disappearing from the taskbar after using Alt+Tab
Browse files Browse the repository at this point in the history
Code change to the input patch.
Updated version number.
  • Loading branch information
NovaRain committed Feb 16, 2024
1 parent af2fdb5 commit 1cb1284
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
25 changes: 25 additions & 0 deletions sfall/Modules/BugFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,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;
Expand Down Expand Up @@ -3410,6 +3428,13 @@ void BugFixes::init() {
combat_ai_reset();
};

// Fix for the game disappearing from the taskbar after using Alt+Tab
MakeCall(0x4CAF14, GNW95_init_window_hack, 2);
if (HRP::Setting::VersionIsValid) { // for HRP 4.1.8 in DD7/DX9 mode
MakeCall(HRP::Setting::GetAddress(0x10026504), GNW95_init_window_hack_HRP, 2); // windowed
MakeCall(HRP::Setting::GetAddress(0x10026605), GNW95_init_window_hack, 2); // fullscreen
}

// Fix vanilla negate operator for float values
MakeCall(0x46AB68, NegateFixHack);

Expand Down
2 changes: 1 addition & 1 deletion sfall/Modules/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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;
//}
}
Expand Down
4 changes: 2 additions & 2 deletions sfall/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
#define VERSION_MAJOR 4
#define VERSION_MINOR 4
#define VERSION_BUILD 2
#define VERSION_REV 0
#define VERSION_REV 1

#define VERSION_STRING "4.4.2"
#define VERSION_STRING "4.4.2.1"

0 comments on commit 1cb1284

Please sign in to comment.