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,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_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;
};

View file

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

View file

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

View file

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

View file

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