diff --git a/docs/progress.svg b/docs/progress.svg index 6749d80ac..6460b0642 100644 --- a/docs/progress.svg +++ b/docs/progress.svg @@ -10,7 +10,7 @@ phd_RotYXZpack phd_TranslateRel phd_TranslateAbs -visible_zclip +HWR_VisibleZClip phd_PutPolygons S_InsertRoom calc_object_vertices @@ -98,7 +98,7 @@ HWR_PrintShadow HWR_RenderLightningSegment HWR_DrawLightningSegment -sub_40D0F7 +HWR_InitPolyList HWR_CacheTexture HWR_OutputPolyList DoNothing @@ -520,7 +520,7 @@ S_ShowControls DisplayRequester S_InitialisePolyList -S_DumpScreen +S_DumpScreen S_ClearScreen S_InitialiseScreen S_OutputPolyList @@ -1078,7 +1078,7 @@ phd_TranslateRel GetChange LaraColTurnR -visible_zclip +HWR_VisibleZClip sub_40A01D S_CopyBufferToScreen Inv_GetItemOption @@ -1226,7 +1226,7 @@ S_SoundPlaySample FxFlicker LaraAsUWDeath -sub_40D0F7 +HWR_InitPolyList CreatureHead LaraAsHang HWR_ClearSurface @@ -1237,7 +1237,7 @@ ControlCinematicPlayer FMVInit OnKeyPress -S_DumpScreen +S_DumpScreen S_SoundSetPanAndVolume FxChainBlock S_CDStop @@ -1431,10 +1431,10 @@ SampleLoader KeyGet S_CDVolume -Functions decompiled (count): 90.63% -Functions decompiled (bytesize): 87.09% +Functions decompiled (count): 90.77% +Functions decompiled (bytesize): 87.11% Functions not decompiled, but with known names (count): 6.71% Functions not decompiled, but with known names (bytesize): 6.13% -Functions not decompiled, with unknown names (count): 2.66% -Functions not decompiled, with unknown names (bytesize): 6.79% +Functions not decompiled, with unknown names (count): 2.52% +Functions not decompiled, with unknown names (bytesize): 6.76% diff --git a/docs/progress.txt b/docs/progress.txt index a59073534..61dd95076 100644 --- a/docs/progress.txt +++ b/docs/progress.txt @@ -19,7 +19,7 @@ phd_RotYXZ 0x00401500 0x000001E8 + phd_RotYXZpack 0x004016F0 0x000001F3 + phd_TranslateRel 0x004018F0 0x000000AB + phd_TranslateAbs 0x004019A0 0x0000007A + -visible_zclip 0x00401A20 0x000000A9 + +HWR_VisibleZClip 0x00401A20 0x000000A9 + phd_PutPolygons 0x00401AD0 0x000000F3 * S_InsertRoom 0x00401BD0 0x0000006E * calc_object_vertices 0x00401C40 0x000001B6 - @@ -89,7 +89,7 @@ sub_408409 0x00408409 0x000000D5 x HWR_DownloadTextures 0x004084DE 0x0000030C * HWR_SetPalette 0x004087EA 0x0000020A * HWR_SwitchResolution 0x004089F4 0x0000007C * -HWR_DumpScreen 0x00408A70 0x00000057 - +HWR_DumpScreen 0x00408A70 0x00000057 * HWR_ClearSurfaceDepth 0x00408AC7 0x00000065 - HWR_BlitSurface 0x00408B2C 0x00000059 + HWR_CopyPicture 0x00408B85 0x000000B5 * @@ -116,7 +116,7 @@ HWR_DrawTranslucentQuad 0x0040C8E7 0x000001F4 + HWR_PrintShadow 0x0040CADB 0x00000182 - HWR_RenderLightningSegment 0x0040CC5D 0x000003F9 + HWR_DrawLightningSegment 0x0040D056 0x000000A1 + -sub_40D0F7 0x0040D0F7 0x00000049 - +HWR_InitPolyList 0x0040D0F7 0x00000049 - HWR_CacheTexture 0x0040D140 0x000001A0 - HWR_OutputPolyList 0x0040D2E0 0x00000185 - DoNothing 0x0040D465 0x00000005 - @@ -741,7 +741,7 @@ DisplayRequester 0x0042F6F0 0x0000056B + # shell/output.cpp S_InitialisePolyList 0x0042FC60 0x00000005 + -S_DumpScreen 0x0042FC70 0x00000044 * +S_DumpScreen 0x0042FC70 0x00000044 + S_ClearScreen 0x0042FCC0 0x00000013 * S_InitialiseScreen 0x0042FCE0 0x00000027 + S_OutputPolyList 0x0042FD10 0x00000018 * diff --git a/src/specific/hwr.h b/src/specific/hwr.h index e52bd41a1..f072a8ae6 100644 --- a/src/specific/hwr.h +++ b/src/specific/hwr.h @@ -21,6 +21,7 @@ #define HWR_CopyPicture ((void (*)())0x00408B85) #define HWR_DownloadPicture ((void (*)())0x00408C3A) #define HWR_SwitchResolution ((void (*)())0x004089F4) +#define HWR_DumpScreen ((void (*)())0x00408A70) // clang-format on void HWR_Error(HRESULT result); diff --git a/src/specific/output.c b/src/specific/output.c index e05785e72..433fac4e4 100644 --- a/src/specific/output.c +++ b/src/specific/output.c @@ -9,6 +9,7 @@ #include "specific/file.h" #include "specific/frontend.h" #include "specific/hwr.h" +#include "specific/smain.h" #include "util.h" #include @@ -237,6 +238,23 @@ void S_InitialisePolyList() phd_InitPolyList(); } +int32_t S_DumpScreen() +{ + HWR_DumpScreen(); + int32_t ticks = WinSpinMessageLoop(); + int32_t ret = ticks; + if (ticks < TICKS_PER_FRAME) { + ret = TICKS_PER_FRAME; + int32_t it = TICKS_PER_FRAME - ret; + while (it) { + while (!WinSpinMessageLoop()) + ; + it--; + } + } + return ret; +} + void S_InitialiseScreen() { if (CurrentLevel != GF.title_level_num) { @@ -459,6 +477,7 @@ void T1MInjectSpecificOutput() { INJECT(0x00402710, S_Draw2DLine); INJECT(0x0042FC60, S_InitialisePolyList); + INJECT(0x0042FC70, S_DumpScreen); INJECT(0x0042FCE0, S_InitialiseScreen); INJECT(0x00430100, S_CalculateLight); INJECT(0x00430290, S_CalculateStaticLight); diff --git a/src/specific/output.h b/src/specific/output.h index 606e4d5f2..64439b2f4 100644 --- a/src/specific/output.h +++ b/src/specific/output.h @@ -4,13 +4,13 @@ #include // clang-format off -#define S_DumpScreen ((int32_t (*)())0x0042FC70) #define S_ClearScreen ((void (*)())0x0042FCC0) #define S_OutputPolyList ((void (*)())0x0042FD10) #define S_GetObjectBounds ((int32_t (*)(int16_t* bptr))0x0042FD30) // clang-format on void S_InitialisePolyList(); +int32_t S_DumpScreen(); void S_InitialiseScreen(); void S_CalculateLight(int32_t x, int32_t y, int32_t z, int16_t room_num); void S_CalculateStaticLight(int16_t adder);