port S_SaveSettings

This commit is contained in:
Marcin Kurczewski 2024-09-06 17:10:40 +02:00
parent 7d04969413
commit ba5979cc32
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
6 changed files with 23 additions and 10 deletions

View File

@ -69,10 +69,10 @@
</g>
<g transform="translate(0 116)">
<text x="0" y="7.50">Tomb2.exe progress according to the physical function order:</text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">61.41% (748)</tspan> · <tspan class="known">36.12% (440)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">61.49% (749)</tspan> · <tspan class="known">36.04% (439)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="458.75" height="6" x="0" y="0" class="decompiled"/>
<rect width="269.85" height="6" x="458.75" y="0" class="known"/>
<rect width="459.36" height="6" x="0" y="0" class="decompiled"/>
<rect width="269.24" height="6" x="459.36" y="0" class="known"/>
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1202,7 +1202,7 @@
<rect width="12" height="12" x="345" y="330" class="decompiled"><title>BOOL __cdecl Shell_Main(void);</title></rect>
<rect width="12" height="12" x="360" y="330" class="decompiled"><title>int16_t __cdecl TitleSequence(void);</title></rect>
<rect width="12" height="12" x="375" y="330" class="known"><title>void __cdecl CheckCheatMode(void);</title></rect>
<rect width="12" height="12" x="390" y="330" class="known"><title>void __cdecl S_SaveSettings(void);</title></rect>
<rect width="12" height="12" x="390" y="330" class="decompiled"><title>void __cdecl S_SaveSettings(void);</title></rect>
<rect width="12" height="12" x="405" y="330" class="decompiled"><title>void __cdecl S_LoadSettings(void);</title></rect>
<rect width="12" height="12" x="420" y="330" class="decompiled"><title>int32_t __cdecl S_Audio_Sample_OutPlay(int32_t sample_id, uint16_t volume, int32_t pitch, int32_t pan);</title></rect>
<rect width="12" height="12" x="435" y="330" class="decompiled"><title>int32_t __cdecl S_Audio_Sample_CalculateSampleVolume(int32_t volume);</title></rect>
@ -1298,10 +1298,10 @@
</g>
<g transform="translate(0 546)">
<text x="0" y="7.50">Tomb2.exe progress according to the function sizes:</text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">65.03%</tspan> · <tspan class="known">34.64%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">65.07%</tspan> · <tspan class="known">34.60%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="485.79" height="6" x="0" y="0" class="decompiled"/>
<rect width="258.77" height="6" x="485.79" y="0" class="known"/>
<rect width="486.06" height="6" x="0" y="0" class="decompiled"/>
<rect width="258.49" height="6" x="486.06" y="0" class="known"/>
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1941,7 +1941,7 @@
<rect width="7.43" height="7.03" x="578.55" y="308.34" class="known"><title>void __cdecl BellControl(int16_t item_num);</title></rect>
<rect width="7.43" height="7.03" x="578.55" y="318.37" class="decompiled"><title>void __cdecl Option_Controls_FlashConflicts(void);</title></rect>
<rect width="7.43" height="7.03" x="578.55" y="328.40" class="known"><title>void __cdecl S_SyncPictureBufferPalette(void);</title></rect>
<rect width="7.43" height="6.95" x="578.55" y="338.43" class="known"><title>void __cdecl S_SaveSettings(void);</title></rect>
<rect width="7.43" height="6.95" x="578.55" y="338.43" class="decompiled"><title>void __cdecl S_SaveSettings(void);</title></rect>
<rect width="7.43" height="6.87" x="578.55" y="348.38" class="decompiled"><title>BOUNDS_16 *__cdecl Item_GetBoundsAccurate(const ITEM_INFO *item);</title></rect>
<rect width="7.43" height="6.87" x="578.55" y="358.26" class="decompiled"><title>int32_t __cdecl Item_GlobalReplace(GAME_OBJECT_ID src_object_id, GAME_OBJECT_ID dst_object_id);</title></rect>
<rect width="7.43" height="6.87" x="578.55" y="368.13" class="decompiled"><title>void __cdecl Lara_State_StepRight(ITEM_INFO *item, COLL_INFO *coll);</title></rect>

Before

Width:  |  Height:  |  Size: 364 KiB

After

Width:  |  Height:  |  Size: 364 KiB

View File

@ -4072,7 +4072,7 @@ typedef enum {
0x00454980 0x02D0 + BOOL __cdecl Shell_Main(void);
0x00454C50 0x0110 +R int16_t __cdecl TitleSequence(void);
0x00454D60 0x032D -R void __cdecl CheckCheatMode(void);
0x004550C0 0x007D *R void __cdecl S_SaveSettings(void);
0x004550C0 0x007D +R void __cdecl S_SaveSettings(void);
0x00455140 0x00DB +R void __cdecl S_LoadSettings(void);
0x00455220 0x0046 + int32_t __cdecl S_Audio_Sample_OutPlay(int32_t sample_id, uint16_t volume, int32_t pitch, int32_t pan);
0x00455270 0x002A + int32_t __cdecl S_Audio_Sample_CalculateSampleVolume(int32_t volume);

View File

@ -3025,3 +3025,15 @@ void __cdecl S_LoadSettings(void)
Music_SetVolume(0);
}
}
void __cdecl S_SaveSettings(void)
{
OpenGameRegistryKey("Game");
SetRegistryDwordValue("MusicVolume", g_OptionMusicVolume);
SetRegistryDwordValue("SoundFxVolume", g_OptionSoundVolume);
SetRegistryDwordValue("DetailLevel", g_DetailLevel);
SetRegistryFloatValue("Sizer", g_GameSizerCopy);
SetRegistryBinaryValue(
"Layout", (uint8_t *)&g_Layout[1], sizeof(uint16_t) * 14);
CloseGameRegistryKey();
}

View File

@ -132,3 +132,4 @@ int32_t __cdecl Misc_Move3DPosTo3DPos(
PHD_ANGLE ang_add);
int32_t __cdecl LevelCompleteSequence(void);
void __cdecl S_LoadSettings(void);
void __cdecl S_SaveSettings(void);

View File

@ -384,7 +384,6 @@
#define SE_AdvancedDlgInit ((void __cdecl (*)(HWND hwndDlg))0x00454950)
#define SE_FindSetupDialog ((HWND __cdecl (*)(void))0x00454960)
#define CheckCheatMode ((void __cdecl (*)(void))0x00454D60)
#define S_SaveSettings ((void __cdecl (*)(void))0x004550C0)
#define CopyBitmapPalette ((void __cdecl (*)(RGB_888 *src_pal, BYTE *src_bitmap, int32_t bitmap_size, RGB_888 *dest_pal))0x004557A0)
#define FindNearestPaletteEntry ((BYTE __cdecl (*)(RGB_888 *palette, int32_t red, int32_t green, int32_t blue, bool ignore_sys_palette))0x004558E0)
#define SyncSurfacePalettes ((void __cdecl (*)(void *src_data, int32_t width, int32_t height, int32_t src_pitch, RGB_888 *src_palette, void *dst_data, int32_t dst_pitch, RGB_888 *dst_palette, bool preserve_sys_palette))0x004559B0)

View File

@ -209,6 +209,7 @@ static void Inject_Decomp_General(const bool enable)
INJECT(enable, 0x00446F80, WinVidFinish);
INJECT(enable, 0x00414220, Misc_Move3DPosTo3DPos);
INJECT(enable, 0x00455140, S_LoadSettings);
INJECT(enable, 0x004550C0, S_SaveSettings);
}
static void Inject_Decomp_Stats(const bool enable)