feat(profile): map callback functions

This commit is contained in:
phaneron 2024-09-30 17:18:50 -04:00
parent df7df2ff25
commit ac20b7a227

View file

@ -26,6 +26,15 @@ typedef struct ShaderConstants ShaderConstants;
typedef struct CGxDevice CGxDevice; typedef struct CGxDevice CGxDevice;
typedef struct CGxDevice__vtable CGxDevice__vtable; typedef struct CGxDevice__vtable CGxDevice__vtable;
typedef void (*DEVICERESTOREDCALLBACK)();
STORM_TS_GROWABLE_ARRAY(DEVICERESTOREDCALLBACK);
typedef void (*TEXTURERECREATIONCALLBACK)();
STORM_TS_GROWABLE_ARRAY(TEXTURERECREATIONCALLBACK);
typedef void (*DISPLAYCHANGECALLBACK)();
STORM_TS_GROWABLE_ARRAY(DISPLAYCHANGECALLBACK);
struct CGxAppRenderState { struct CGxAppRenderState {
CGxStateBom m_value; CGxStateBom m_value;
uint32_t m_stackDepth; uint32_t m_stackDepth;
@ -51,6 +60,7 @@ struct CGxDevice__vtable {
// void ITexMarkAsUpdated(CGxTex*, uint32_t); // void ITexMarkAsUpdated(CGxTex*, uint32_t);
void* v_fn_0_ITexMarkAsUpdated; void* v_fn_0_ITexMarkAsUpdated;
// void IRsSendToHw(EGxRenderState); // void IRsSendToHw(EGxRenderState);
// no base implementation
void* v_fn_1_IRsSendToHw; void* v_fn_1_IRsSendToHw;
// void ICursorCreate(const CGxFormat&); // void ICursorCreate(const CGxFormat&);
void* v_fn_2_ICursorCreate; void* v_fn_2_ICursorCreate;
@ -58,12 +68,16 @@ struct CGxDevice__vtable {
void* v_fn_3_ICursorDestroy; void* v_fn_3_ICursorDestroy;
// void ICursorDraw(); // void ICursorDraw();
void* v_fn_4_ICursorDraw; void* v_fn_4_ICursorDraw;
// don't know if this ever gets called (IStateSync something?) // This gets called when window is resized. It runs a list of callbacks in an array.
void* v_fn_5; // two functions that are in this array (ONLY once in-game, not in login screen):
// don't know if this ever gets called (IStateSync something?) // * 007E7FE0
void* v_fn_6; // * 00512920
// don't know if this ever gets called (IStateSync something?) // void NotifyOnDeviceRestored();
void* v_fn_7; void* v_fn_5_NotifyOnDeviceRestored;
// void NotifyOnTextureRecreation();
void* v_fn_6_NotifyOnTextureRecreation;
// void NotifyOnDisplayChange();
void* v_fn_7_NotifyOnDisplayChange;
// don't know if this ever gets called (something deleted?) // don't know if this ever gets called (something deleted?)
void* v_fn_8; void* v_fn_8;
void* v_fn_9; void* v_fn_9;
@ -79,6 +93,7 @@ struct CGxDevice__vtable {
// void DeviceSetGamma(CGxGammaRamp const&); // void DeviceSetGamma(CGxGammaRamp const&);
void* v_fn_15_DeviceSetGamma; void* v_fn_15_DeviceSetGamma;
void* v_fn_16; void* v_fn_16;
// no base implementation
void* v_fn_17; void* v_fn_17;
void* v_fn_18; void* v_fn_18;
void* v_fn_19; void* v_fn_19;
@ -93,12 +108,18 @@ struct CGxDevice__vtable {
void* v_fn_27; void* v_fn_27;
// void DeviceOverride(EGxOverride, uint32_t); // void DeviceOverride(EGxOverride, uint32_t);
void* v_fn_28_DeviceOverride; void* v_fn_28_DeviceOverride;
void* v_fn_29; // void AddDeviceRestoredCallback(DEVICERESTOREDCALLBACK);
void* v_fn_30; void* v_fn_29_AddDeviceRestoredCallback;
void* v_fn_31; // void RemoveDeviceRestoredCallback(DEVICERESTOREDCALLBACK);
void* v_fn_32; void* v_fn_30_RemoveDeviceRestoredCallback;
void* v_fn_33; // void AddTextureRecreationCallback(TEXTURERECREATIONCALLBACK);
void* v_fn_34; void* v_fn_31_AddTextureRecreationCallback;
// void RemoveTextureRecreationCallback(TEXTURERECREATIONCALLBACK);
void* v_fn_32_RemoveTextureRecreationCallback;
// void AddDisplayChangeCallback(DISPLAYCHANGECALLBACK);
void* v_fn_33_AddDisplayChangeCallback;
// void AddDisplayChangeCallback(DISPLAYCHANGECALLBACK);
void* v_fn_34_RemoveDisplayChangeCallback;
// void CapsWindowSize(CRect&); // void CapsWindowSize(CRect&);
void* v_fn_35_CapsWindowSize; void* v_fn_35_CapsWindowSize;
// void CapsWindowSize(CRect&); // void CapsWindowSize(CRect&);
@ -183,7 +204,11 @@ struct CGxDevice {
uint32_t m_unk34[76]; uint32_t m_unk34[76];
CRect m_defWindowRect; // 0x164 (size: 0x10) CRect m_defWindowRect; // 0x164 (size: 0x10)
CRect m_curWindowRect; // 0x174 (size: 0x10) CRect m_curWindowRect; // 0x174 (size: 0x10)
uint32_t m_unk184[12]; // uint32_t m_unk184[12] {
TSGrowableArray_DEVICERESTOREDCALLBACK m_deviceRestoredCallbacks;
TSGrowableArray_TEXTURERECREATIONCALLBACK m_textureRecreationCallbacks;
TSGrowableArray_DISPLAYCHANGECALLBACK m_displayChangeCallbacks;
// };
EGxApi m_api; // 0x1b4 EGxApi m_api; // 0x1b4
uint32_t m_cpuFeatures; uint32_t m_cpuFeatures;
CGxFormat m_format; CGxFormat m_format;
@ -246,7 +271,7 @@ struct CGxDevice {
int32_t m_hardwareCursor; // 0x2954 (size 0x4) int32_t m_hardwareCursor; // 0x2954 (size 0x4)
uint32_t m_cursorHotspotX; uint32_t m_cursorHotspotX;
uint32_t m_cursorHotspotY; uint32_t m_cursorHotspotY;
CImVector m_cursor[1024]; // 0x2960 (size 0x4) uint32_t m_cursor[1024]; // 0x2960 (size 0x4)
CGxTex* m_cursorTexture; // 0x3960 (size 0x4) CGxTex* m_cursorTexture; // 0x3960 (size 0x4)
float m_cursorDepth; // 0x3964 (size 0x4) float m_cursorDepth; // 0x3964 (size 0x4)
// 0x3968 == 14692 (the complete size of CGxDevice) // 0x3968 == 14692 (the complete size of CGxDevice)