From 5cd03c71d53e14557a560aff07fc132519ffc0fc Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Wed, 4 Oct 2023 12:25:24 +0200 Subject: [PATCH] docs: update declarations --- docs/progress.svg | 20 ++++++++++---------- docs/progress.txt | 38 +++++++++++++++++++++++++++----------- src/global/funcs.h | 10 +++++----- src/global/vars.h | 16 ++++++++++++++++ 4 files changed, 58 insertions(+), 26 deletions(-) diff --git a/docs/progress.svg b/docs/progress.svg index 1896eb72..209628c0 100644 --- a/docs/progress.svg +++ b/docs/progress.svg @@ -916,10 +916,10 @@ HRESULT __stdcall EnumDisplayModesCallback(LPDDSDESC lpDDSurfaceDesc, LPVOID lpContext); bool __cdecl WinVidInit(void); bool __cdecl WinVidGetDisplayAdapters(void); -void __thiscall FlaggedStringDelete(STRING_FLAGGED *item); -bool __cdecl EnumerateDisplayAdapters(DISPLAY_ADAPTER_LIST *displayAdapterList); +void __thiscall FlaggedStringDelete(struct STRING_FLAGGED *item); +bool __cdecl EnumerateDisplayAdapters(struct DISPLAY_ADAPTER_LIST *displayAdapterList); BOOL __stdcall EnumDisplayAdaptersCallback(GUID *lpGUID, LPTSTR lpDriverDescription, LPTSTR lpDriverName, LPVOID lpContext); -void __thiscall FlaggedStringsCreate(DISPLAY_ADAPTER *adapter); +void __thiscall FlaggedStringsCreate(struct DISPLAY_ADAPTER *adapter); bool __cdecl WinVidRegisterGameWindowClass(void); LRESULT __stdcall WinVidGameWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); void __cdecl WinVidResizeGameWindow(HWND hWnd, int32_t edge, LPRECT rect); @@ -949,7 +949,7 @@ bool __cdecl WinInputInit(void); bool __cdecl DInputEnumDevices(JOYSTICK_LIST *joystickList); BOOL __stdcall DInputEnumDevicesCallback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef); -void __thiscall FlaggedStringCreate(STRING_FLAGGED *item, DWORD dwSize); +void __thiscall FlaggedStringCreate(struct STRING_FLAGGED *item, DWORD dwSize); JOYSTICK_NODE *__cdecl GetJoystick(GUID *lpGuid); void __cdecl DInputKeyboardCreate(void); void __cdecl DInputKeyboardRelease(void); @@ -1203,7 +1203,7 @@ void __cdecl S_CDStop(void); BOOL __cdecl StartSyncedAudio(int32_t trackID); DWORD __cdecl S_CDGetLoc(void); -void __cdecl Music_SetVolume(uint32_t volume); +void __cdecl Music_SetVolume(int32_t volume); void __cdecl CopyBitmapPalette(RGB888 *srcPal, BYTE *srcBitmap, int32_t bitmapSize, RGB888 *destPal); BYTE __cdecl FindNearestPaletteEntry(RGB888 *palette, int32_t red, int32_t green, int32_t blue, bool ignoreSysPalette); void __cdecl SyncSurfacePalettes(void *srcData, int32_t width, int32_t height, int32_t srcPitch, RGB888 *srcPalette, void *dstData, int32_t dstPitch, RGB888 *dstPalette, bool preserveSysPalette); @@ -1853,7 +1853,7 @@ void __cdecl EffectNewRoom(int16_t fx_num, int16_t room_num); void __cdecl SE_AdvancedDlgUpdate(HWND hwndDlg); int32_t __cdecl GetFrames(struct ITEM_INFO *item, int16_t *frmptr[], int32_t *rate); -void __cdecl Music_SetVolume(uint32_t volume); +void __cdecl Music_SetVolume(int32_t volume); int16_t *__cdecl Output_InsertObjectGT4_ZBuffered(int16_t *obj_ptr, int32_t num, enum SORT_TYPE sort_type); void __cdecl extra_as_sharkkill(struct ITEM_INFO *item, struct COLL_INFO *coll); bool __cdecl GetRegistryGuidValue(LPCTSTR lpValueName, GUID *value, GUID *defaultValue); @@ -2216,7 +2216,7 @@ void __cdecl BridgeTilt1Ceiling(struct ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int32_t *height); void __cdecl ReadSG(void *pointer, int32_t size); void __cdecl WinVidSetGameWindowSize(int32_t width, int32_t height); -void __thiscall FlaggedStringsCreate(DISPLAY_ADAPTER *adapter); +void __thiscall FlaggedStringsCreate(struct DISPLAY_ADAPTER *adapter); void __cdecl S_FadeInInventory(BOOL isFade); void __cdecl S_DrawScreenLine(int32_t x, int32_t y, int32_t z, int32_t xLen, int32_t yLen, BYTE colorIdx, D3DCOLOR *gour, uint16_t flags); void __cdecl HWR_GetPageHandles(void); @@ -2347,7 +2347,7 @@ void __cdecl AssaultStop(struct ITEM_INFO *item); int32_t __cdecl GF_DoFrontEndSequence(void); bool __cdecl D3DCreate(void); -void __thiscall FlaggedStringCreate(STRING_FLAGGED *item, DWORD dwSize); +void __thiscall FlaggedStringCreate(struct STRING_FLAGGED *item, DWORD dwSize); BOOL __cdecl S_SoundSampleIsPlaying(int32_t channel); bool __cdecl InitTextures(void); void __cdecl lara_col_slide(struct ITEM_INFO *item, struct COLL_INFO *coll); @@ -2380,7 +2380,7 @@ void __cdecl ControlLaraExtra(int16_t item_num); void __cdecl BridgeFlatCeiling(struct ITEM_INFO *item, int32_t x, int32_t y, int32_t z, int32_t *height); int32_t __fastcall Math_Sin(int16_t angle); -bool __cdecl EnumerateDisplayAdapters(DISPLAY_ADAPTER_LIST *displayAdapterList); +bool __cdecl EnumerateDisplayAdapters(struct DISPLAY_ADAPTER_LIST *displayAdapterList); void __cdecl DInputRelease(void); bool __cdecl DSoundEnumerate(SOUND_ADAPTER_LIST *adapterList); int32_t __fastcall Math_SinImpl(int16_t angle); @@ -2424,7 +2424,7 @@ void __cdecl lara_col_stepleft(struct ITEM_INFO *item, struct COLL_INFO *coll); void __cdecl lara_col_roll(struct ITEM_INFO *item, struct COLL_INFO *coll); void __cdecl lara_col_swim(struct ITEM_INFO *item, struct COLL_INFO *coll); -void __thiscall FlaggedStringDelete(STRING_FLAGGED *item); +void __thiscall FlaggedStringDelete(struct STRING_FLAGGED *item); void __cdecl WinVidFinish(void); bool __cdecl S_IntroFMV(LPCTSTR fileName1, LPCTSTR fileName2); LONG __cdecl DeleteRegistryValue(LPCTSTR lpValueName); diff --git a/docs/progress.txt b/docs/progress.txt index d89a08f0..5357a4cc 100644 --- a/docs/progress.txt +++ b/docs/progress.txt @@ -83,8 +83,8 @@ typedef struct DISPLAY_ADAPTER_NODE { } DISPLAY_ADAPTER_NODE; typedef struct DISPLAY_ADAPTER_LIST { - struct DisplayAdapterNode_t *head; - struct DisplayAdapterNode_t *tail; + struct DISPLAY_ADAPTER_NODE *head; + struct DISPLAY_ADAPTER_NODE *tail; DWORD dwCount; } DISPLAY_ADAPTER_LIST; @@ -96,14 +96,14 @@ typedef struct SOUND_ADAPTER { } SOUND_ADAPTER; typedef struct SOUND_ADAPTER_NODE { - struct SoundAdapterNode_t *next; - struct SoundAdapterNode_t *previous; + struct SOUND_ADAPTER_NODE *next; + struct SOUND_ADAPTER_NODE *previous; SOUND_ADAPTER body; } SOUND_ADAPTER_NODE; typedef struct SOUND_ADAPTER_LIST { - struct SoundAdapterNode_t *head; - struct SoundAdapterNode_t *tail; + struct SOUND_ADAPTER_NODE *head; + struct SOUND_ADAPTER_NODE *tail; DWORD dwCount; } SOUND_ADAPTER_LIST; @@ -1800,10 +1800,10 @@ typedef struct CINE_FRAME { 00445A50 000003B1 -R HRESULT __stdcall EnumDisplayModesCallback(LPDDSDESC lpDDSurfaceDesc, LPVOID lpContext); 00445E10 00000040 -R bool __cdecl WinVidInit(void); 00445E50 000000AF -R bool __cdecl WinVidGetDisplayAdapters(void); -00445F00 00000013 -R void __thiscall FlaggedStringDelete(STRING_FLAGGED *item); -00445F20 0000001A -R bool __cdecl EnumerateDisplayAdapters(DISPLAY_ADAPTER_LIST *displayAdapterList); +00445F00 00000013 -R void __thiscall FlaggedStringDelete(struct STRING_FLAGGED *item); +00445F20 0000001A -R bool __cdecl EnumerateDisplayAdapters(struct DISPLAY_ADAPTER_LIST *displayAdapterList); 00445F40 000001BE -R BOOL __stdcall EnumDisplayAdaptersCallback(GUID *lpGUID, LPTSTR lpDriverDescription, LPTSTR lpDriverName, LPVOID lpContext); -00446100 00000035 -R void __thiscall FlaggedStringsCreate(DISPLAY_ADAPTER *adapter); +00446100 00000035 -R void __thiscall FlaggedStringsCreate(struct DISPLAY_ADAPTER *adapter); 00446140 0000006A -R bool __cdecl WinVidRegisterGameWindowClass(void); 004461B0 0000049F -R LRESULT __stdcall WinVidGameWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); 004467C0 000001C0 -R void __cdecl WinVidResizeGameWindow(HWND hWnd, int32_t edge, LPRECT rect); @@ -1833,7 +1833,7 @@ typedef struct CINE_FRAME { 004473B0 0000007F -R bool __cdecl WinInputInit(void); 00447430 00000024 -R bool __cdecl DInputEnumDevices(JOYSTICK_LIST *joystickList); 00447460 000000E8 -R BOOL __stdcall DInputEnumDevicesCallback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef); -00447550 0000001F -R void __thiscall FlaggedStringCreate(STRING_FLAGGED *item, DWORD dwSize); +00447550 0000001F -R void __thiscall FlaggedStringCreate(struct STRING_FLAGGED *item, DWORD dwSize); 00447570 0000004E -R JOYSTICK_NODE *__cdecl GetJoystick(GUID *lpGuid); 004475C0 000000C9 -R void __cdecl DInputKeyboardCreate(void); 00447690 00000029 -R void __cdecl DInputKeyboardRelease(void); @@ -2087,7 +2087,7 @@ typedef struct CINE_FRAME { 00455570 00000039 -R void __cdecl S_CDStop(void); 004555B0 00000084 -R BOOL __cdecl StartSyncedAudio(int32_t trackID); 00455640 00000061 -R DWORD __cdecl S_CDGetLoc(void); -004556B0 00000092 * void __cdecl Music_SetVolume(uint32_t volume); +004556B0 00000092 * void __cdecl Music_SetVolume(int32_t volume); 004557A0 00000137 -R void __cdecl CopyBitmapPalette(RGB888 *srcPal, BYTE *srcBitmap, int32_t bitmapSize, RGB888 *destPal); 004558E0 000000C8 -R BYTE __cdecl FindNearestPaletteEntry(RGB888 *palette, int32_t red, int32_t green, int32_t blue, bool ignoreSysPalette); 004559B0 000000AE -R void __cdecl SyncSurfacePalettes(void *srcData, int32_t width, int32_t height, int32_t srcPitch, RGB888 *srcPalette, void *dstData, int32_t dstPitch, RGB888 *dstPalette, bool preserveSysPalette); @@ -2168,6 +2168,7 @@ typedef struct CINE_FRAME { # + decompiled # Offset Flags Declaration +004640BC - int16_t g_CD_TrackID; 00465A60 - int16_t g_OptionMusicVolume; 00467DD0 + const int32_t g_AtanBaseTable[8]; 00467DF0 + const int16_t g_AtanAngleTable[0x800]; @@ -2199,7 +2200,22 @@ typedef struct CINE_FRAME { 004D6B60 - float g_FltWinRight; 004D6BF8 - int32_t g_PhdWinRight; 004D778C - int32_t g_IsChunkyCamera; +004D7F10 - HWND g_GameWindowHandle; +004D8570 - DWORD g_SampleFreqs[256]; +004D8970 - struct SOUND_ADAPTER_LIST g_SoundAdapterList; +004D8980 - LPDIRECTSOUNDBUFFER g_SampleBuffers[256]; +004D8D80 - uint8_t g_IsSoundEnabled; +004D8D84 - LPDIRECTSOUND g_DSound; +004D8D88 - int32_t g_ChannelSamples[32]; +004D8E08 - LPDIRECTSOUNDBUFFER g_ChannelBuffers[32]; +004D8E8C - struct SOUND_ADAPTER g_CurrentSoundAdapter; +004D8EAC - struct SOUND_ADAPTER_NODE *g_PrimarySoundAdapter; +0051BCC0 - struct APP_SETTINGS g_SavedAppSettings; 0051BD20 - char g_ErrorMessage[128]; +0051BDA8 - int32_t g_MasterVolume; +0051BDAC - MCIDEVICEID g_MciDeviceID; +0051BDB0 - int32_t g_CD_LoopTrack; +0051E6C4 - int32_t g_SoundIsActive; 005206E0 - struct LARA_INFO g_Lara; 005207BC - struct ITEM_INFO *g_LaraItem; 0052618C - struct ROOM_INFO *g_Rooms; diff --git a/src/global/funcs.h b/src/global/funcs.h index 2f40ca2a..c8023a3d 100644 --- a/src/global/funcs.h +++ b/src/global/funcs.h @@ -814,10 +814,10 @@ #define EnumDisplayModesCallback ((HRESULT __stdcall (*)(LPDDSDESC lpDDSurfaceDesc, LPVOID lpContext))0x00445A50) #define WinVidInit ((bool __cdecl (*)(void))0x00445E10) #define WinVidGetDisplayAdapters ((bool __cdecl (*)(void))0x00445E50) -#define FlaggedStringDelete ((void __thiscall (*)(STRING_FLAGGED *item))0x00445F00) -#define EnumerateDisplayAdapters ((bool __cdecl (*)(DISPLAY_ADAPTER_LIST *displayAdapterList))0x00445F20) +#define FlaggedStringDelete ((void __thiscall (*)(struct STRING_FLAGGED *item))0x00445F00) +#define EnumerateDisplayAdapters ((bool __cdecl (*)(struct DISPLAY_ADAPTER_LIST *displayAdapterList))0x00445F20) #define EnumDisplayAdaptersCallback ((BOOL __stdcall (*)(GUID *lpGUID, LPTSTR lpDriverDescription, LPTSTR lpDriverName, LPVOID lpContext))0x00445F40) -#define FlaggedStringsCreate ((void __thiscall (*)(DISPLAY_ADAPTER *adapter))0x00446100) +#define FlaggedStringsCreate ((void __thiscall (*)(struct DISPLAY_ADAPTER *adapter))0x00446100) #define WinVidRegisterGameWindowClass ((bool __cdecl (*)(void))0x00446140) #define WinVidGameWindowProc ((LRESULT __stdcall (*)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam))0x004461B0) #define WinVidResizeGameWindow ((void __cdecl (*)(HWND hWnd, int32_t edge, LPRECT rect))0x004467C0) @@ -840,7 +840,7 @@ #define WinInputInit ((bool __cdecl (*)(void))0x004473B0) #define DInputEnumDevices ((bool __cdecl (*)(JOYSTICK_LIST *joystickList))0x00447430) #define DInputEnumDevicesCallback ((BOOL __stdcall (*)(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef))0x00447460) -#define FlaggedStringCreate ((void __thiscall (*)(STRING_FLAGGED *item, DWORD dwSize))0x00447550) +#define FlaggedStringCreate ((void __thiscall (*)(struct STRING_FLAGGED *item, DWORD dwSize))0x00447550) #define GetJoystick ((JOYSTICK_NODE *__cdecl (*)(GUID *lpGuid))0x00447570) #define DInputKeyboardCreate ((void __cdecl (*)(void))0x004475C0) #define DInputKeyboardRelease ((void __cdecl (*)(void))0x00447690) @@ -1079,7 +1079,7 @@ #define S_CDStop ((void __cdecl (*)(void))0x00455570) #define StartSyncedAudio ((BOOL __cdecl (*)(int32_t trackID))0x004555B0) #define S_CDGetLoc ((DWORD __cdecl (*)(void))0x00455640) -#define Music_SetVolume ((void __cdecl (*)(uint32_t volume))0x004556B0) +#define Music_SetVolume ((void __cdecl (*)(int32_t volume))0x004556B0) #define CopyBitmapPalette ((void __cdecl (*)(RGB888 *srcPal, BYTE *srcBitmap, int32_t bitmapSize, RGB888 *destPal))0x004557A0) #define FindNearestPaletteEntry ((BYTE __cdecl (*)(RGB888 *palette, int32_t red, int32_t green, int32_t blue, bool ignoreSysPalette))0x004558E0) #define SyncSurfacePalettes ((void __cdecl (*)(void *srcData, int32_t width, int32_t height, int32_t srcPitch, RGB888 *srcPalette, void *dstData, int32_t dstPitch, RGB888 *dstPalette, bool preserveSysPalette))0x004559B0) diff --git a/src/global/vars.h b/src/global/vars.h index e1543047..1ce4b37b 100644 --- a/src/global/vars.h +++ b/src/global/vars.h @@ -6,6 +6,7 @@ #include "inject_util.h" // clang-format off +#define g_CD_TrackID VAR_U_(0x004640BC, int16_t) #define g_OptionMusicVolume VAR_U_(0x00465A60, int16_t) #define g_ViewportAspectRatio VAR_I_(0x0046C304, float, 0.0f) #define g_PhdWinTop VAR_U_(0x0046E310, int32_t) @@ -34,7 +35,22 @@ #define g_FltWinRight VAR_U_(0x004D6B60, float) #define g_PhdWinRight VAR_U_(0x004D6BF8, int32_t) #define g_IsChunkyCamera VAR_U_(0x004D778C, int32_t) +#define g_GameWindowHandle VAR_U_(0x004D7F10, HWND) +#define g_SampleFreqs ARRAY_(0x004D8570, DWORD, [256]) +#define g_SoundAdapterList VAR_U_(0x004D8970, struct SOUND_ADAPTER_LIST) +#define g_SampleBuffers ARRAY_(0x004D8980, LPDIRECTSOUNDBUFFER, [256]) +#define g_IsSoundEnabled VAR_U_(0x004D8D80, uint8_t) +#define g_DSound VAR_U_(0x004D8D84, LPDIRECTSOUND) +#define g_ChannelSamples ARRAY_(0x004D8D88, int32_t, [32]) +#define g_ChannelBuffers ARRAY_(0x004D8E08, LPDIRECTSOUNDBUFFER, [32]) +#define g_CurrentSoundAdapter VAR_U_(0x004D8E8C, struct SOUND_ADAPTER) +#define g_PrimarySoundAdapter VAR_U_(0x004D8EAC, struct SOUND_ADAPTER_NODE *) +#define g_SavedAppSettings VAR_U_(0x0051BCC0, struct APP_SETTINGS) #define g_ErrorMessage ARRAY_(0x0051BD20, char, [128]) +#define g_MasterVolume VAR_U_(0x0051BDA8, int32_t) +#define g_MciDeviceID VAR_U_(0x0051BDAC, MCIDEVICEID) +#define g_CD_LoopTrack VAR_U_(0x0051BDB0, int32_t) +#define g_SoundIsActive VAR_U_(0x0051E6C4, int32_t) #define g_Lara VAR_U_(0x005206E0, struct LARA_INFO) #define g_LaraItem VAR_U_(0x005207BC, struct ITEM_INFO *) #define g_Rooms VAR_U_(0x0052618C, struct ROOM_INFO *)