Fixed +/- not updating brightness slider when used on the Pref screen

(ref. fallout2-ce/fallout2-ce#298)
This commit is contained in:
NovaRain
2026-03-15 07:56:57 +08:00
parent ae0fb248c9
commit 506f63fb08
2 changed files with 42 additions and 1 deletions
+2
View File
@@ -33,6 +33,7 @@
#define FO_VAR_carCurrentArea 0x672E68
#define FO_VAR_carGasAmount 0x672E6C
#define FO_VAR_card_old_fid1 0x5709EC
#define FO_VAR_changed 0x6639A8 // used in the Preferences screen
#define FO_VAR_character_points 0x518538
#define FO_VAR_cmap 0x51DF34
#define FO_VAR_colorTable 0x6A38D0
@@ -254,6 +255,7 @@
#define FO_VAR_pip_win 0x6644C4
#define FO_VAR_pipboy_message_file 0x664348
#define FO_VAR_pipmesg 0x664338
#define FO_VAR_prfwin 0x663904
#define FO_VAR_preload_list_index 0x519640
#define FO_VAR_procTableStrs 0x51C758 // table of procId (from define.h) => procName map
#define FO_VAR_proto_main_msg_file 0x6647FC
+40 -1
View File
@@ -678,7 +678,7 @@ static void __fastcall wmDetectHotspotHover(long wmMouseX, long wmMouseY) {
static __declspec(naked) void wmWorldMap_hack() {
__asm {
cmp ds:[FO_VAR_In_WorldMap], 1; // player is moving
cmp dword ptr ds:[FO_VAR_In_WorldMap], 1; // player is moving
jne checkHover;
mov eax, dword ptr ds:[FO_VAR_wmWorldOffsetY]; // overwritten code
retn;
@@ -978,6 +978,39 @@ skip:
}
}
static __declspec(naked) void IncDecGamma_hack0() {
__asm {
call GetLoopFlags;
test eax, OPTIONS;
jnz inPref;
mov ebx, 0x3FF00000; // overwritten engine code
retn;
inPref:
pop ebx;
add ebx, 39; // offset to next section (0x492916, 0x4929FA)
jmp ebx;
}
}
static __declspec(naked) void IncDecGamma_hack1() {
__asm {
call GetLoopFlags;
test eax, OPTIONS;
jnz inPref;
mov eax, ds:[0x6638D4]; // overwritten engine code
retn;
inPref:
mov eax, 17; // Brightness slider
call fo::funcoffs::UpdateThing_;
mov eax, ds:[FO_VAR_prfwin];
call fo::funcoffs::win_draw_; // redraw the Preferences screen
mov dword ptr ds:[FO_VAR_changed], 1;
pop edx;
add edx, 52; // offset to next section (0x4929BE, 0x492A9E)
jmp edx;
}
}
static __declspec(naked) void display_body_hook() {
__asm {
mov ebx, [esp + 0x60 - 0x28 + 8];
@@ -1103,6 +1136,12 @@ void Interface::init() {
const DWORD gdCustomSelBtnsAddr[] = {0x44A100, 0x44A151};
MakeCalls(gdCustomSelect_hack_buttons, gdCustomSelBtnsAddr);
MakeCall(0x44A47D, gdCustomSelect_hack_keyretn);
// Fix the +/- keys not updating the brightness slider when used on the Preferences screen
const DWORD gammaValueGetAddr[] = {0x4928EA, 0x4929CE};
MakeCalls(IncDecGamma_hack0, gammaValueGetAddr);
const DWORD gammaValueSetAddr[] = {0x492985, 0x492A65};
MakeCalls(IncDecGamma_hack1, gammaValueSetAddr);
}
void Interface::exit() {