feat(profile): update gx headers

This commit is contained in:
phaneron 2025-05-08 00:05:46 -04:00
parent 37b206a6e3
commit ad24eab0a4
16 changed files with 251 additions and 84 deletions

View file

@ -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

View file

@ -1,9 +1,12 @@
#include "external/d3d9/adapteridentifier.h"
#include "external/d3d9/caps.h" #include "external/d3d9/caps.h"
#include "external/d3d9/colorvalue.h" #include "external/d3d9/colorvalue.h"
#include "external/d3d9/cubemapfaces.h" #include "external/d3d9/cubemapfaces.h"
#include "external/d3d9/cubetexture.h" #include "external/d3d9/cubetexture.h"
#include "external/d3d9/decltype.h"
#include "external/d3d9/declusage.h" #include "external/d3d9/declusage.h"
#include "external/d3d9/device.h" #include "external/d3d9/device.h"
#include "external/d3d9/devicecreationparameters.h"
#include "external/d3d9/devtype.h" #include "external/d3d9/devtype.h"
#include "external/d3d9/direct3d.h" #include "external/d3d9/direct3d.h"
#include "external/d3d9/displaymode.h" #include "external/d3d9/displaymode.h"
@ -28,3 +31,4 @@
#include "external/d3d9/vertexdeclaration.h" #include "external/d3d9/vertexdeclaration.h"
#include "external/d3d9/vertexelement.h" #include "external/d3d9/vertexelement.h"
#include "external/d3d9/vertexshader.h" #include "external/d3d9/vertexshader.h"
#include "external/d3d9/viewport.h"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,8 @@
#ifndef WIN_HANDLE_H
#define WIN_HANDLE_H
typedef void* HANDLE;
typedef void* HWND;
typedef void* HINSTANCE;
#endif

View file

@ -0,0 +1,10 @@
#ifndef WIN_LARGEINTEGER_H
#define WIN_LARGEINTEGER_H
DECLARE_STRUCT(LARGE_INTEGER);
struct LARGE_INTEGER {
int64_t QuadPart;
};
#endif

View file

@ -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

View file

@ -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

View file

@ -12,8 +12,17 @@ struct CGxCaps {
int32_t m_pixelCenterOnEdge; int32_t m_pixelCenterOnEdge;
int32_t m_texelCenterOnEdge; int32_t m_texelCenterOnEdge;
int32_t m_numStreams; 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; int32_t int10;
EGxColorFormat m_colorFormat; EGxColorFormat m_colorFormat;
// set to zero in CGxDeviceOpenGl::CGxDeviceOpenGl
uint32_t unk18; uint32_t unk18;
uint32_t m_maxIndex; uint32_t m_maxIndex;
int32_t m_generateMipMaps; int32_t m_generateMipMaps;
@ -21,22 +30,10 @@ struct CGxCaps {
int32_t m_texFmt[13]; int32_t m_texFmt[13];
// int32_t m_texTarget[GxTexTargets_Last]; // int32_t m_texTarget[GxTexTargets_Last];
int32_t m_texTarget[4]; int32_t m_texTarget[4];
uint32_t unk68; uint32_t m_texNonPow2;
// uint32_t m_texMaxSize[GxTexTargets_Last]; // uint32_t m_texMaxSize[GxTexTargets_Last];
uint32_t m_texMaxSize[4]; uint32_t m_texMaxSize[4];
uint32_t unk7C; int32_t m_rttFormat[13];
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;
uint32_t unkB0; uint32_t unkB0;
// int32_t m_shaderTargets[GxShTargets_Last]; // int32_t m_shaderTargets[GxShTargets_Last];
int32_t m_shaderTargets[6]; int32_t m_shaderTargets[6];
@ -46,15 +43,38 @@ struct CGxCaps {
int32_t m_texFilterAnisotropic; int32_t m_texFilterAnisotropic;
uint32_t m_maxTexAnisotropy; uint32_t m_maxTexAnisotropy;
int32_t m_depthBias; int32_t m_depthBias;
uint32_t unkF4; int32_t m_colorWrite;
int32_t m_maxClipPlanes; int32_t m_maxClipPlanes;
// CGxDeviceD3d::ISetCaps // CGxDeviceD3d::ISetCaps
int32_t m_hardwareCursor; int32_t m_hwCursor;
uint32_t unk100[5]; int32_t m_occlusionQuery;
uint32_t unk114[6]; // 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; int32_t m_stereoAvailable;
// in CGxDeviceOpenGl:
// always true
// in CGxDeviceD3d:
// always true
int32_t int130; 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; 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; int32_t int138;
}; };

View file

@ -216,9 +216,9 @@ struct CGxDeviceD3d {
LPDIRECT3DDEVICE9 m_d3dDevice; LPDIRECT3DDEVICE9 m_d3dDevice;
D3DCAPS9 m_d3dCaps; D3DCAPS9 m_d3dCaps;
int32_t m_d3dIsHwDevice; int32_t m_d3dIsHwDevice;
int32_t m_d3dNVAPI; int32_t m_d3dNVAPI; // UC
uint32_t m_d3dStereoEnabled; // UC uint32_t m_d3dStereoEnabled; // UC
uint32_t m_d3dStereoRestore; // m_d3dStereoRestore uint32_t m_d3dStereoRestore; // UC m_d3dStereoRestore
uint32_t m_d3dStereoHandle; // UC uint32_t m_d3dStereoHandle; // UC
float m_d3dStereoConvergence; // UC float m_d3dStereoConvergence; // UC
float m_d3dStereoSeparation; // UC float m_d3dStereoSeparation; // UC
@ -239,11 +239,14 @@ struct CGxDeviceD3d {
LPDIRECT3DSURFACE9 m_defDepthSurface; LPDIRECT3DSURFACE9 m_defDepthSurface;
// used in DeviceReadPixels // used in DeviceReadPixels
LPDIRECT3DSURFACE9 surface3B44; // m_backBufferSurface? LPDIRECT3DSURFACE9 surface3B44; // m_backBufferSurface?
LPDIRECT3DQUERY9 m_eventQuery; // m_queryEvent? m_eventQuery? LPDIRECT3DQUERY9 m_eventQuery; // UC m_queryEvent? m_eventQuery?
int32_t m_hwCursorDirty; int32_t m_hwCursorDirty;
LPDIRECT3DTEXTURE9 m_hwCursorTexture; LPDIRECT3DTEXTURE9 m_hwCursorTexture;
LPDIRECT3DSURFACE9 m_hwCursorBitmap; 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; LPDIRECT3DVERTEXDECLARATION9 m_d3dCurrentVertexDecl;
LPDIRECT3DINDEXBUFFER9 m_d3dCurrentIndexBuf; LPDIRECT3DINDEXBUFFER9 m_d3dCurrentIndexBuf;
LPDIRECT3DVERTEXBUFFER9 m_d3dVertexStreamBuf[8]; LPDIRECT3DVERTEXBUFFER9 m_d3dVertexStreamBuf[8];

View file

@ -19,7 +19,7 @@
#include "gx/types.h" #include "gx/types.h"
#include "gx/caps.h" #include "gx/caps.h"
#include "gx/format.h" #include "gx/format.h"
#include "gx/light.h" #include "gx/apilight.h"
#include "gx/state_bom.h" #include "gx/state_bom.h"
#include "gx/shader.h" #include "gx/shader.h"
#include "gx/matrix_stack.h" #include "gx/matrix_stack.h"
@ -71,13 +71,6 @@ struct CGxDevice__TextureTarget {
void* m_apiSpecific; void* m_apiSpecific;
}; };
// GxLight?
struct CGxDevice__GxLight {
CGxLight light;
int32_t enable;
uint16_t flags;
};
// 84 functions // 84 functions
struct CGxDevice__v_table { struct CGxDevice__v_table {
// void ITexMarkAsUpdated(CGxTex* texId); // void ITexMarkAsUpdated(CGxTex* texId);
@ -311,6 +304,7 @@ struct CGxDevice {
int32_t m_context; int32_t m_context;
// Set to zero by CGxDevice::ScenePresent // Set to zero by CGxDevice::ScenePresent
// prevents Draw from working if != 0 // prevents Draw from working if != 0
// m_inRenderPass?
int32_t intF5C; int32_t intF5C;
int32_t m_windowVisible; int32_t m_windowVisible;
// set to 1 by ICursorClip // set to 1 by ICursorClip
@ -339,7 +333,7 @@ struct CGxDevice {
CRect m_scissorRect; CRect m_scissorRect;
// something to do with lighting? // something to do with lighting?
// uint32_t unk2548[72]; // uint32_t unk2548[72];
CGxDevice__GxLight m_lights[4]; CGxApiLight m_lights[4];
// uint32_t unk2536[60]; // uint32_t unk2536[60];
TSHashTable_CGxShader_HASHKEY_STRI m_shaderList[6]; TSHashTable_CGxShader_HASHKEY_STRI m_shaderList[6];
uint32_t m_appMasterEnables; uint32_t m_appMasterEnables;

View file

@ -21,7 +21,7 @@ enum CGxFormat__Format {
}; };
struct CGxFormat { struct CGxFormat {
uint32_t unk0; uint32_t apiSpecificModeID;
bool hwTnL; bool hwTnL;
bool hwCursor; // 0x5, UC bool hwCursor; // 0x5, UC
int8_t fixLag; int8_t fixLag;
@ -33,19 +33,15 @@ struct CGxFormat {
// set by CVGxTripleBufferCallback // set by CVGxTripleBufferCallback
uint32_t backBufferCount; // buffering? buffer? framebufferCount? uint32_t backBufferCount; // buffering? buffer? framebufferCount?
uint32_t sampleCount; uint32_t sampleCount;
float multisampleQuality; // UC, write at 00769693 float sampleQuality; // UC, write at 00769693
CGxFormat__Format colorFormat; CGxFormat__Format colorFormat;
uint32_t refreshRate; uint32_t refreshRate;
uint32_t vsync; uint32_t vsync;
bool stereoEnabled; // UC, 34 bool stereoEnabled; // UC, 34
// something to do with fixed function? // something to do with fixed function?
// write at 0076AD4C // write at 0076AD4C
uint32_t unk38; // vertexShaderTarget ?
uint32_t unk3C; int32_t fixedFunction[6];
uint32_t unk40;
uint32_t unk44;
uint32_t unk48;
uint32_t unk4C;
C2iVector pos; C2iVector pos;
}; };

View file

@ -5,8 +5,7 @@
#include "storm/array.h" #include "storm/array.h"
DECLARE_ENUM(BlitAlpha);
DECLARE_ENUM(BlitFormat);
DECLARE_ENUM(EGxApi); DECLARE_ENUM(EGxApi);
DECLARE_ENUM(EGxBlend); DECLARE_ENUM(EGxBlend);
DECLARE_ENUM(EGxBuffer); DECLARE_ENUM(EGxBuffer);
@ -38,31 +37,6 @@ DECLARE_STRUCT(C4LargePixel);
DECLARE_STRUCT(MipBits); DECLARE_STRUCT(MipBits);
DECLARE_STRUCT(CGxGammaRamp); 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 { enum EGxApi {
GxApi_OpenGl = 0, GxApi_OpenGl = 0,
GxApi_D3d9 = 1, GxApi_D3d9 = 1,
@ -224,22 +198,22 @@ enum EGxRenderState {
GxRs_TexGen5 = 58, GxRs_TexGen5 = 58,
GxRs_TexGen6 = 59, GxRs_TexGen6 = 59,
GxRs_TexGen7 = 60, GxRs_TexGen7 = 60,
GxRs_Unk61 = 61, GxRs_TextureShader0 = 61,
GxRs_Unk62 = 62, GxRs_TextureShader1 = 62,
GxRs_Unk63 = 63, GxRs_TextureShader2 = 63,
GxRs_Unk64 = 64, GxRs_TextureShader3 = 64,
GxRs_Unk65 = 65, GxRs_TextureShader4 = 65,
GxRs_Unk66 = 66, GxRs_TextureShader5 = 66,
GxRs_Unk67 = 67, GxRs_TextureShader6 = 67,
GxRs_Unk68 = 68, GxRs_TextureShader7 = 68,
GxRs_Unk69 = 69, GxRs_TextureCoord0 = 69,
GxRs_Unk70 = 70, GxRs_TextureCoord1 = 70,
GxRs_Unk71 = 71, GxRs_TextureCoord2 = 71,
GxRs_Unk72 = 72, GxRs_TextureCoord3 = 72,
GxRs_Unk73 = 73, GxRs_TextureCoord4 = 73,
GxRs_Unk74 = 74, GxRs_TextureCoord5 = 74,
GxRs_Unk75 = 75, GxRs_TextureCoord6 = 75,
GxRs_Unk76 = 76, GxRs_TextureCoord7 = 76,
GxRs_VertexShader = 77, GxRs_VertexShader = 77,
GxRs_PixelShader = 78, GxRs_PixelShader = 78,
GxRs_PointScale = 79, GxRs_PointScale = 79,
@ -247,7 +221,7 @@ enum EGxRenderState {
GxRs_PointScaleMin = 81, GxRs_PointScaleMin = 81,
GxRs_PointScaleMax = 82, GxRs_PointScaleMax = 82,
GxRs_PointSprite = 83, GxRs_PointSprite = 83,
GxRs_Unk84 = 84, GxRs_LineWidth = 84, // LineWidth?
GxRs_ColorMaterial = 85, GxRs_ColorMaterial = 85,
GxRenderStates_Last = 86 GxRenderStates_Last = 86
}; };
@ -299,7 +273,8 @@ enum EGxTexCommand {
GxTex_Lock = 0, GxTex_Lock = 0,
GxTex_Latch = 1, GxTex_Latch = 1,
GxTex_Unlock = 2, GxTex_Unlock = 2,
GxTexCommands_Last = 3 GxTex_3 = 3,
GxTexCommands_Last = 4
}; };
enum EGxTexFilter { enum EGxTexFilter {

View file

@ -48,6 +48,7 @@
#include "framescript/event_object.h" #include "framescript/event_object.h"
#include "gx/batch.h" #include "gx/batch.h"
#include "gx/blit.h"
#include "gx/buffer.h" #include "gx/buffer.h"
#include "gx/caps.h" #include "gx/caps.h"
#include "gx/device.h" #include "gx/device.h"