port S_LoadSettings

This commit is contained in:
Marcin Kurczewski 2024-09-06 17:09:03 +02:00
parent a7604d3f86
commit 7d04969413
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
6 changed files with 48 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.33% (747)</tspan> · <tspan class="known">36.21% (441)</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.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>
<g transform="translate(0 20)">
<rect width="458.14" height="6" x="0" y="0" class="decompiled"/>
<rect width="270.47" height="6" x="458.14" y="0" class="known"/>
<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="18.40" height="6" x="728.60" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1203,7 +1203,7 @@
<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="405" y="330" class="known"><title>void __cdecl S_LoadSettings(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>
<rect width="12" height="12" x="450" y="330" class="decompiled"><title>int32_t __cdecl S_Audio_Sample_CalculateSamplePan(int16_t pan);</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">64.97%</tspan> · <tspan class="known">34.71%</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.03%</tspan> · <tspan class="known">34.64%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="485.31" height="6" x="0" y="0" class="decompiled"/>
<rect width="259.25" height="6" x="485.31" y="0" class="known"/>
<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="2.44" height="6" x="744.56" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1718,7 +1718,7 @@
<rect width="10.23" height="10.74" x="683.92" y="122.81" class="known"><title>void __cdecl EarthQuake(int16_t item_num);</title></rect>
<rect width="10.23" height="10.74" x="697.15" y="122.81" class="known"><title>void __cdecl ModifyStartInfo(int32_t level_num);</title></rect>
<rect width="10.23" height="10.74" x="710.38" y="122.81" class="known"><title>void __cdecl SpringBoardControl(int16_t item_num);</title></rect>
<rect width="10.23" height="10.74" x="723.60" y="122.81" class="known"><title>void __cdecl S_LoadSettings(void);</title></rect>
<rect width="10.23" height="10.74" x="723.60" y="122.81" class="decompiled"><title>void __cdecl S_LoadSettings(void);</title></rect>
<rect width="10.17" height="10.74" x="736.83" y="122.81" class="decompiled"><title>int32_t __cdecl LOS_ClipTarget(const GAME_VECTOR *start, GAME_VECTOR *target, const SECTOR_INFO *sector);</title></rect>
<rect width="10.18" height="10.73" x="508.46" y="136.56" class="decompiled"><title>void __cdecl Room_TriggerMusicTrackImpl(int16_t value, int16_t flags, int16_t type);</title></rect>
<rect width="10.18" height="10.67" x="508.46" y="150.29" class="known"><title>void __cdecl CreateBartoliLight(int16_t item_num);</title></rect>

Before

Width:  |  Height:  |  Size: 364 KiB

After

Width:  |  Height:  |  Size: 364 KiB

View File

@ -4073,7 +4073,7 @@ typedef enum {
0x00454C50 0x0110 +R int16_t __cdecl TitleSequence(void);
0x00454D60 0x032D -R void __cdecl CheckCheatMode(void);
0x004550C0 0x007D *R void __cdecl S_SaveSettings(void);
0x00455140 0x00DB *R void __cdecl S_LoadSettings(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);
0x004552A0 0x0026 + int32_t __cdecl S_Audio_Sample_CalculateSamplePan(int16_t pan);

View File

@ -2988,3 +2988,40 @@ int32_t __cdecl LevelCompleteSequence(void)
{
return GFD_EXIT_TO_TITLE;
}
void __cdecl S_LoadSettings(void)
{
OpenGameRegistryKey("Game");
{
DWORD tmp;
GetRegistryDwordValue("MusicVolume", &tmp, 165);
g_OptionMusicVolume = tmp;
}
{
DWORD tmp;
GetRegistryDwordValue("SoundFXVolume", &tmp, 10);
g_OptionSoundVolume = tmp;
}
{
DWORD tmp;
GetRegistryDwordValue("DetailLevel", &tmp, 1);
g_DetailLevel = tmp;
}
GetRegistryFloatValue("Sizer", &g_GameSizerCopy, 1.0);
GetRegistryBinaryValue(
"Layout", (uint8_t *)&g_Layout[1], sizeof(uint16_t) * 14, 0);
CloseGameRegistryKey();
Sound_SetMasterVolume(6 * g_OptionSoundVolume + 4);
if (g_OptionMusicVolume) {
Music_SetVolume(25 * g_OptionMusicVolume + 5);
} else {
Music_SetVolume(0);
}
}

View File

@ -131,3 +131,4 @@ int32_t __cdecl Misc_Move3DPosTo3DPos(
PHD_3DPOS *src_pos, const PHD_3DPOS *dst_pos, int32_t velocity,
PHD_ANGLE ang_add);
int32_t __cdecl LevelCompleteSequence(void);
void __cdecl S_LoadSettings(void);

View File

@ -385,7 +385,6 @@
#define SE_FindSetupDialog ((HWND __cdecl (*)(void))0x00454960)
#define CheckCheatMode ((void __cdecl (*)(void))0x00454D60)
#define S_SaveSettings ((void __cdecl (*)(void))0x004550C0)
#define S_LoadSettings ((void __cdecl (*)(void))0x00455140)
#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

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