From ad24eab0a425837733404a508e9b71af4d80556d Mon Sep 17 00:00:00 2001 From: superp00t Date: Thu, 8 May 2025 00:05:46 -0400 Subject: [PATCH] feat(profile): update gx headers --- .../include/external/d3d9/adapteridentifier.h | 26 ++++++++ .../include/external/d3d9/d3d9.h | 4 ++ .../include/external/d3d9/decltype.h | 28 ++++++++ .../external/d3d9/devicecreationparameters.h | 15 +++++ .../include/external/d3d9/viewport.h | 15 +++++ .../include/external/win/guid.h | 15 +++++ .../include/external/win/handle.h | 8 +++ .../include/external/win/largeinteger.h | 10 +++ .../3.3.5a-windows-386/include/gx/apilight.h | 20 ++++++ profile/3.3.5a-windows-386/include/gx/blit.h | 37 +++++++++++ profile/3.3.5a-windows-386/include/gx/caps.h | 56 +++++++++++----- profile/3.3.5a-windows-386/include/gx/d3d9.h | 11 ++-- .../3.3.5a-windows-386/include/gx/device.h | 12 +--- .../3.3.5a-windows-386/include/gx/format.h | 12 ++-- profile/3.3.5a-windows-386/include/gx/types.h | 65 ++++++------------- profile/3.3.5a-windows-386/include/main.h | 1 + 16 files changed, 251 insertions(+), 84 deletions(-) create mode 100644 profile/3.3.5a-windows-386/include/external/d3d9/adapteridentifier.h create mode 100644 profile/3.3.5a-windows-386/include/external/d3d9/decltype.h create mode 100644 profile/3.3.5a-windows-386/include/external/d3d9/devicecreationparameters.h create mode 100644 profile/3.3.5a-windows-386/include/external/d3d9/viewport.h create mode 100644 profile/3.3.5a-windows-386/include/external/win/guid.h create mode 100644 profile/3.3.5a-windows-386/include/external/win/handle.h create mode 100644 profile/3.3.5a-windows-386/include/external/win/largeinteger.h create mode 100644 profile/3.3.5a-windows-386/include/gx/apilight.h create mode 100644 profile/3.3.5a-windows-386/include/gx/blit.h diff --git a/profile/3.3.5a-windows-386/include/external/d3d9/adapteridentifier.h b/profile/3.3.5a-windows-386/include/external/d3d9/adapteridentifier.h new file mode 100644 index 0000000..e15cb0c --- /dev/null +++ b/profile/3.3.5a-windows-386/include/external/d3d9/adapteridentifier.h @@ -0,0 +1,26 @@ + +#ifndef D3D9_ADAPTERIDENTIFIER_H +#define D3D9_ADAPTERIDENTIFIER_H + +DECLARE_STRUCT(D3DADAPTER_IDENTIFIER9); + +#include "external/win/guid.h" +#include "external/win/largeinteger.h" + +struct D3DADAPTER_IDENTIFIER9 { + char Driver[512]; + char Description[512]; + char DeviceName[32]; + LARGE_INTEGER DriverVersion; + + uint32_t VendorId; + uint32_t DeviceId; + uint32_t SubSysId; + uint32_t Revision; + + GUID DeviceIdentifier; + + uint32_t WHQLLevel; +}; + +#endif \ No newline at end of file diff --git a/profile/3.3.5a-windows-386/include/external/d3d9/d3d9.h b/profile/3.3.5a-windows-386/include/external/d3d9/d3d9.h index b3db53d..1e2aae5 100644 --- a/profile/3.3.5a-windows-386/include/external/d3d9/d3d9.h +++ b/profile/3.3.5a-windows-386/include/external/d3d9/d3d9.h @@ -1,9 +1,12 @@ +#include "external/d3d9/adapteridentifier.h" #include "external/d3d9/caps.h" #include "external/d3d9/colorvalue.h" #include "external/d3d9/cubemapfaces.h" #include "external/d3d9/cubetexture.h" +#include "external/d3d9/decltype.h" #include "external/d3d9/declusage.h" #include "external/d3d9/device.h" +#include "external/d3d9/devicecreationparameters.h" #include "external/d3d9/devtype.h" #include "external/d3d9/direct3d.h" #include "external/d3d9/displaymode.h" @@ -28,3 +31,4 @@ #include "external/d3d9/vertexdeclaration.h" #include "external/d3d9/vertexelement.h" #include "external/d3d9/vertexshader.h" +#include "external/d3d9/viewport.h" diff --git a/profile/3.3.5a-windows-386/include/external/d3d9/decltype.h b/profile/3.3.5a-windows-386/include/external/d3d9/decltype.h new file mode 100644 index 0000000..26b2e10 --- /dev/null +++ b/profile/3.3.5a-windows-386/include/external/d3d9/decltype.h @@ -0,0 +1,28 @@ +#ifndef D3D9_DECLTYPE_H +#define D3D9_DECLTYPE_H + +DECLARE_ENUM(D3DDECLTYPE); + +enum D3DDECLTYPE { + D3DDECLTYPE_FLOAT1 = 0, + D3DDECLTYPE_FLOAT2 = 1, + D3DDECLTYPE_FLOAT3 = 2, + D3DDECLTYPE_FLOAT4 = 3, + D3DDECLTYPE_D3DCOLOR = 4, + D3DDECLTYPE_UBYTE4 = 5, + D3DDECLTYPE_SHORT2 = 6, + D3DDECLTYPE_SHORT4 = 7, + /* VS 2.0 */ + D3DDECLTYPE_UBYTE4N = 8, + D3DDECLTYPE_SHORT2N = 9, + D3DDECLTYPE_SHORT4N = 10, + D3DDECLTYPE_USHORT2N = 11, + D3DDECLTYPE_USHORT4N = 12, + D3DDECLTYPE_UDEC3 = 13, + D3DDECLTYPE_DEC3N = 14, + D3DDECLTYPE_FLOAT16_2 = 15, + D3DDECLTYPE_FLOAT16_4 = 16, + D3DDECLTYPE_UNUSED = 17, +}; + +#endif \ No newline at end of file diff --git a/profile/3.3.5a-windows-386/include/external/d3d9/devicecreationparameters.h b/profile/3.3.5a-windows-386/include/external/d3d9/devicecreationparameters.h new file mode 100644 index 0000000..fe855de --- /dev/null +++ b/profile/3.3.5a-windows-386/include/external/d3d9/devicecreationparameters.h @@ -0,0 +1,15 @@ +#ifndef D3D9_DEVICECREATIONPARAMETERS_H +#define D3D9_DEVICECREATIONPARAMETERS_H + +DECLARE_STRUCT(D3DDEVICE_CREATION_PARAMETERS); + +#include "external/d3d9/devtype.h" + +struct D3DDEVICE_CREATION_PARAMETERS { + uint32_t AdapterOrdinal; + D3DDEVTYPE DeviceType; + void* hFocusWindow; + uint32_t BehaviorFlags; +}; + +#endif \ No newline at end of file diff --git a/profile/3.3.5a-windows-386/include/external/d3d9/viewport.h b/profile/3.3.5a-windows-386/include/external/d3d9/viewport.h new file mode 100644 index 0000000..08a2c49 --- /dev/null +++ b/profile/3.3.5a-windows-386/include/external/d3d9/viewport.h @@ -0,0 +1,15 @@ +#ifndef D3D9_VIEWPORT_H +#define D3D9_VIEWPORT_H + +DECLARE_STRUCT(D3DVIEWPORT9); + +struct D3DVIEWPORT9 { + uint32_t X; + uint32_t Y; + uint32_t Width; + uint32_t Height; + float MinZ; + float MaxZ; +}; + +#endif \ No newline at end of file diff --git a/profile/3.3.5a-windows-386/include/external/win/guid.h b/profile/3.3.5a-windows-386/include/external/win/guid.h new file mode 100644 index 0000000..92e0b6a --- /dev/null +++ b/profile/3.3.5a-windows-386/include/external/win/guid.h @@ -0,0 +1,15 @@ +#ifndef WIN_GUID_H +#define WIN_GUID_H + +DECLARE_STRUCT(GUID); + +#include "system/types.h" + +struct GUID { + uint32_t Data1; + uint16_t Data2; + uint16_t Data3; + uint8_t Data4[8]; +}; + +#endif \ No newline at end of file diff --git a/profile/3.3.5a-windows-386/include/external/win/handle.h b/profile/3.3.5a-windows-386/include/external/win/handle.h new file mode 100644 index 0000000..6335e16 --- /dev/null +++ b/profile/3.3.5a-windows-386/include/external/win/handle.h @@ -0,0 +1,8 @@ +#ifndef WIN_HANDLE_H +#define WIN_HANDLE_H + +typedef void* HANDLE; +typedef void* HWND; +typedef void* HINSTANCE; + +#endif \ No newline at end of file diff --git a/profile/3.3.5a-windows-386/include/external/win/largeinteger.h b/profile/3.3.5a-windows-386/include/external/win/largeinteger.h new file mode 100644 index 0000000..7f78711 --- /dev/null +++ b/profile/3.3.5a-windows-386/include/external/win/largeinteger.h @@ -0,0 +1,10 @@ +#ifndef WIN_LARGEINTEGER_H +#define WIN_LARGEINTEGER_H + +DECLARE_STRUCT(LARGE_INTEGER); + +struct LARGE_INTEGER { + int64_t QuadPart; +}; + +#endif \ No newline at end of file diff --git a/profile/3.3.5a-windows-386/include/gx/apilight.h b/profile/3.3.5a-windows-386/include/gx/apilight.h new file mode 100644 index 0000000..9947ba3 --- /dev/null +++ b/profile/3.3.5a-windows-386/include/gx/apilight.h @@ -0,0 +1,20 @@ +#ifndef GX_API_LIGHT_H +#define GX_API_LIGHT_H + +DECLARE_STRUCT(CGxApiLight); + +#include "tempest/vector.h" + +struct CGxApiLight { + C4Vector m_dir; + C3Vector m_ambColor; + C3Vector m_dirColor; + C3Vector m_specColor; + float m_constantAttenuation; + float m_linearAttenuation; + float m_quadraticAttenuation; + int32_t m_enable; + uint32_t flags; +}; + +#endif \ No newline at end of file diff --git a/profile/3.3.5a-windows-386/include/gx/blit.h b/profile/3.3.5a-windows-386/include/gx/blit.h new file mode 100644 index 0000000..e955cff --- /dev/null +++ b/profile/3.3.5a-windows-386/include/gx/blit.h @@ -0,0 +1,37 @@ +#ifndef GX_BLIT_H +#define GX_BLIT_H + +DECLARE_ENUM(BlitAlpha); +DECLARE_ENUM(BlitFormat); + +#include "tempest/vector.h" + +enum BlitAlpha { + BlitAlpha_0 = 0, + BlitAlpha_1 = 1, + BlitAlpha_8 = 2, + BlitAlpha_Filler = 3, + BlitAlphas_Last = 4 +}; + +enum BlitFormat { + BlitFormat_Unknown = 0, + BlitFormat_Abgr8888 = 1, + BlitFormat_Argb8888 = 2, + BlitFormat_Argb4444 = 3, + BlitFormat_Argb1555 = 4, + BlitFormat_Rgb565 = 5, + BlitFormat_Dxt1 = 6, + BlitFormat_Dxt3 = 7, + BlitFormat_Dxt5 = 8, + BlitFormat_Uv88 = 9, + BlitFormat_Gr1616F = 10, + BlitFormat_R32F = 11, + BlitFormat_D24X8 = 12, + BlitFormats_Last = 13 +}; + +// typedef void (*BLIT_FUNCTION)(const C2iVector&, const void*, uint32_t, void*, uint32_t); +typedef void (*BLIT_FUNCTION)(C2iVector*, void*, uint32_t, void*, uint32_t); + +#endif \ No newline at end of file diff --git a/profile/3.3.5a-windows-386/include/gx/caps.h b/profile/3.3.5a-windows-386/include/gx/caps.h index 685e395..530e9c1 100644 --- a/profile/3.3.5a-windows-386/include/gx/caps.h +++ b/profile/3.3.5a-windows-386/include/gx/caps.h @@ -12,8 +12,17 @@ struct CGxCaps { int32_t m_pixelCenterOnEdge; int32_t m_texelCenterOnEdge; int32_t m_numStreams; + // Always set to 1 in CGxDeviceOpenGl + // Set to 1 if D3d9 Caps2 & 0x1 + // this could be an undocumented flag + // CGxDeviceD3d::Draw skips a calculation if 1 + // could also be a bug: maybe they meant to check + // D3DDEVCAPS2_STREAMOFFSET in DevCaps2 + // but mistakenly checked Caps2 + // in which case this could be called m_streamOffset int32_t int10; EGxColorFormat m_colorFormat; + // set to zero in CGxDeviceOpenGl::CGxDeviceOpenGl uint32_t unk18; uint32_t m_maxIndex; int32_t m_generateMipMaps; @@ -21,22 +30,10 @@ struct CGxCaps { int32_t m_texFmt[13]; // int32_t m_texTarget[GxTexTargets_Last]; int32_t m_texTarget[4]; - uint32_t unk68; + uint32_t m_texNonPow2; // uint32_t m_texMaxSize[GxTexTargets_Last]; uint32_t m_texMaxSize[4]; - uint32_t unk7C; - uint32_t unk80; - uint32_t unk84; - uint32_t unk88; - uint32_t unk8C; - uint32_t unk90; - uint32_t unk94; - uint32_t unk98; - uint32_t unk9C; - uint32_t unkA0; - uint32_t unkA4; - uint32_t unkA8; - int32_t hwPcf; + int32_t m_rttFormat[13]; uint32_t unkB0; // int32_t m_shaderTargets[GxShTargets_Last]; int32_t m_shaderTargets[6]; @@ -46,15 +43,38 @@ struct CGxCaps { int32_t m_texFilterAnisotropic; uint32_t m_maxTexAnisotropy; int32_t m_depthBias; - uint32_t unkF4; + int32_t m_colorWrite; int32_t m_maxClipPlanes; // CGxDeviceD3d::ISetCaps - int32_t m_hardwareCursor; - uint32_t unk100[5]; - uint32_t unk114[6]; + int32_t m_hwCursor; + int32_t m_occlusionQuery; + // GxOverride_Unk8 + int32_t m_pointParameters; + float m_pointScaleMax; + int32_t m_pointSprite; + uint32_t m_blendFactor; + // in CGxDeviceOpenGl: + // members are initialized to zero + // in CGxDeviceD3d: + // members are initialized to zero + uint32_t unk114[5]; + // Used by RTAlphaSupported + int32_t m_oglRtAlpha; int32_t m_stereoAvailable; + // in CGxDeviceOpenGl: + // always true + // in CGxDeviceD3d: + // always true int32_t int130; + // in CGxDeviceOpenGl: + // always true + // in CGxDeviceD3d: + // true if this->b_base.m_caps.m_shaderTargets[4 (GxSh_Pixel)] != 4 (GxShPS_ps_3_0); int32_t int134; + // in CGxDeviceOpenGl: + // true if this->b_base.m_caps.m_shaderTargets[4 (GxSh_Pixel)] != 12 (GxShPS_arbfp1); + // in CGxDeviceD3d: + // true if this->b_base.m_caps.m_shaderTargets[4 (GxSh_Pixel)] != 4 (GxShPS_ps_3_0); int32_t int138; }; diff --git a/profile/3.3.5a-windows-386/include/gx/d3d9.h b/profile/3.3.5a-windows-386/include/gx/d3d9.h index e6741fc..584bd9d 100644 --- a/profile/3.3.5a-windows-386/include/gx/d3d9.h +++ b/profile/3.3.5a-windows-386/include/gx/d3d9.h @@ -216,9 +216,9 @@ struct CGxDeviceD3d { LPDIRECT3DDEVICE9 m_d3dDevice; D3DCAPS9 m_d3dCaps; int32_t m_d3dIsHwDevice; - int32_t m_d3dNVAPI; + int32_t m_d3dNVAPI; // UC uint32_t m_d3dStereoEnabled; // UC - uint32_t m_d3dStereoRestore; // m_d3dStereoRestore + uint32_t m_d3dStereoRestore; // UC m_d3dStereoRestore uint32_t m_d3dStereoHandle; // UC float m_d3dStereoConvergence; // UC float m_d3dStereoSeparation; // UC @@ -239,11 +239,14 @@ struct CGxDeviceD3d { LPDIRECT3DSURFACE9 m_defDepthSurface; // used in DeviceReadPixels LPDIRECT3DSURFACE9 surface3B44; // m_backBufferSurface? - LPDIRECT3DQUERY9 m_eventQuery; // m_queryEvent? m_eventQuery? + LPDIRECT3DQUERY9 m_eventQuery; // UC m_queryEvent? m_eventQuery? int32_t m_hwCursorDirty; LPDIRECT3DTEXTURE9 m_hwCursorTexture; LPDIRECT3DSURFACE9 m_hwCursorBitmap; - CGxTex* texture3B58; + // Used by CGxDeviceD3d::ITexForceRecreation + // 8x8 green square + // used as a placeholder when a texture is released + CGxTex* texture3B58; // m_placeholderTexture? LPDIRECT3DVERTEXDECLARATION9 m_d3dCurrentVertexDecl; LPDIRECT3DINDEXBUFFER9 m_d3dCurrentIndexBuf; LPDIRECT3DVERTEXBUFFER9 m_d3dVertexStreamBuf[8]; diff --git a/profile/3.3.5a-windows-386/include/gx/device.h b/profile/3.3.5a-windows-386/include/gx/device.h index 2a379e1..3422b95 100644 --- a/profile/3.3.5a-windows-386/include/gx/device.h +++ b/profile/3.3.5a-windows-386/include/gx/device.h @@ -19,7 +19,7 @@ #include "gx/types.h" #include "gx/caps.h" #include "gx/format.h" -#include "gx/light.h" +#include "gx/apilight.h" #include "gx/state_bom.h" #include "gx/shader.h" #include "gx/matrix_stack.h" @@ -71,13 +71,6 @@ struct CGxDevice__TextureTarget { void* m_apiSpecific; }; -// GxLight? -struct CGxDevice__GxLight { - CGxLight light; - int32_t enable; - uint16_t flags; -}; - // 84 functions struct CGxDevice__v_table { // void ITexMarkAsUpdated(CGxTex* texId); @@ -311,6 +304,7 @@ struct CGxDevice { int32_t m_context; // Set to zero by CGxDevice::ScenePresent // prevents Draw from working if != 0 + // m_inRenderPass? int32_t intF5C; int32_t m_windowVisible; // set to 1 by ICursorClip @@ -339,7 +333,7 @@ struct CGxDevice { CRect m_scissorRect; // something to do with lighting? // uint32_t unk2548[72]; - CGxDevice__GxLight m_lights[4]; + CGxApiLight m_lights[4]; // uint32_t unk2536[60]; TSHashTable_CGxShader_HASHKEY_STRI m_shaderList[6]; uint32_t m_appMasterEnables; diff --git a/profile/3.3.5a-windows-386/include/gx/format.h b/profile/3.3.5a-windows-386/include/gx/format.h index c0e1d37..03d9680 100644 --- a/profile/3.3.5a-windows-386/include/gx/format.h +++ b/profile/3.3.5a-windows-386/include/gx/format.h @@ -21,7 +21,7 @@ enum CGxFormat__Format { }; struct CGxFormat { - uint32_t unk0; + uint32_t apiSpecificModeID; bool hwTnL; bool hwCursor; // 0x5, UC int8_t fixLag; @@ -33,19 +33,15 @@ struct CGxFormat { // set by CVGxTripleBufferCallback uint32_t backBufferCount; // buffering? buffer? framebufferCount? uint32_t sampleCount; - float multisampleQuality; // UC, write at 00769693 + float sampleQuality; // UC, write at 00769693 CGxFormat__Format colorFormat; uint32_t refreshRate; uint32_t vsync; bool stereoEnabled; // UC, 34 // something to do with fixed function? // write at 0076AD4C - uint32_t unk38; - uint32_t unk3C; - uint32_t unk40; - uint32_t unk44; - uint32_t unk48; - uint32_t unk4C; + // vertexShaderTarget ? + int32_t fixedFunction[6]; C2iVector pos; }; diff --git a/profile/3.3.5a-windows-386/include/gx/types.h b/profile/3.3.5a-windows-386/include/gx/types.h index 1e768c8..67ec465 100644 --- a/profile/3.3.5a-windows-386/include/gx/types.h +++ b/profile/3.3.5a-windows-386/include/gx/types.h @@ -5,8 +5,7 @@ #include "storm/array.h" -DECLARE_ENUM(BlitAlpha); -DECLARE_ENUM(BlitFormat); + DECLARE_ENUM(EGxApi); DECLARE_ENUM(EGxBlend); DECLARE_ENUM(EGxBuffer); @@ -38,31 +37,6 @@ DECLARE_STRUCT(C4LargePixel); DECLARE_STRUCT(MipBits); DECLARE_STRUCT(CGxGammaRamp); -enum BlitAlpha { - BlitAlpha_0 = 0, - BlitAlpha_1 = 1, - BlitAlpha_8 = 2, - BlitAlpha_Filler = 3, - BlitAlphas_Last = 4 -}; - -enum BlitFormat { - BlitFormat_Unknown = 0, - BlitFormat_Abgr8888 = 1, - BlitFormat_Argb8888 = 2, - BlitFormat_Argb4444 = 3, - BlitFormat_Argb1555 = 4, - BlitFormat_Rgb565 = 5, - BlitFormat_Dxt1 = 6, - BlitFormat_Dxt3 = 7, - BlitFormat_Dxt5 = 8, - BlitFormat_Uv88 = 9, - BlitFormat_Gr1616F = 10, - BlitFormat_R32F = 11, - BlitFormat_D24X8 = 12, - BlitFormats_Last = 13 -}; - enum EGxApi { GxApi_OpenGl = 0, GxApi_D3d9 = 1, @@ -224,22 +198,22 @@ enum EGxRenderState { GxRs_TexGen5 = 58, GxRs_TexGen6 = 59, GxRs_TexGen7 = 60, - GxRs_Unk61 = 61, - GxRs_Unk62 = 62, - GxRs_Unk63 = 63, - GxRs_Unk64 = 64, - GxRs_Unk65 = 65, - GxRs_Unk66 = 66, - GxRs_Unk67 = 67, - GxRs_Unk68 = 68, - GxRs_Unk69 = 69, - GxRs_Unk70 = 70, - GxRs_Unk71 = 71, - GxRs_Unk72 = 72, - GxRs_Unk73 = 73, - GxRs_Unk74 = 74, - GxRs_Unk75 = 75, - GxRs_Unk76 = 76, + GxRs_TextureShader0 = 61, + GxRs_TextureShader1 = 62, + GxRs_TextureShader2 = 63, + GxRs_TextureShader3 = 64, + GxRs_TextureShader4 = 65, + GxRs_TextureShader5 = 66, + GxRs_TextureShader6 = 67, + GxRs_TextureShader7 = 68, + GxRs_TextureCoord0 = 69, + GxRs_TextureCoord1 = 70, + GxRs_TextureCoord2 = 71, + GxRs_TextureCoord3 = 72, + GxRs_TextureCoord4 = 73, + GxRs_TextureCoord5 = 74, + GxRs_TextureCoord6 = 75, + GxRs_TextureCoord7 = 76, GxRs_VertexShader = 77, GxRs_PixelShader = 78, GxRs_PointScale = 79, @@ -247,7 +221,7 @@ enum EGxRenderState { GxRs_PointScaleMin = 81, GxRs_PointScaleMax = 82, GxRs_PointSprite = 83, - GxRs_Unk84 = 84, + GxRs_LineWidth = 84, // LineWidth? GxRs_ColorMaterial = 85, GxRenderStates_Last = 86 }; @@ -299,7 +273,8 @@ enum EGxTexCommand { GxTex_Lock = 0, GxTex_Latch = 1, GxTex_Unlock = 2, - GxTexCommands_Last = 3 + GxTex_3 = 3, + GxTexCommands_Last = 4 }; enum EGxTexFilter { diff --git a/profile/3.3.5a-windows-386/include/main.h b/profile/3.3.5a-windows-386/include/main.h index 9b040a6..24d1b3d 100644 --- a/profile/3.3.5a-windows-386/include/main.h +++ b/profile/3.3.5a-windows-386/include/main.h @@ -48,6 +48,7 @@ #include "framescript/event_object.h" #include "gx/batch.h" +#include "gx/blit.h" #include "gx/buffer.h" #include "gx/caps.h" #include "gx/device.h"