mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-26 14:46:16 +00:00
gbi.h
and ucode_disas.c
cleanups (#1267)
* Merge GfxMod and Gfx, various ucode_disas improvements, gdSPDefMtx, gbi.h formatting improvements * Suggested changes * Further suggested changes * Fix matrix Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Formatting changes Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Clarify Gnoop callback * the thing Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Switch spaces, uintptr Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
parent
fd24ad6e67
commit
0b38f6e678
6 changed files with 3370 additions and 2896 deletions
|
@ -1679,7 +1679,7 @@ void DebugArena_Cleanup(void);
|
|||
u8 DebugArena_IsInitialized(void);
|
||||
void UCodeDisas_Init(UCodeDisas*);
|
||||
void UCodeDisas_Destroy(UCodeDisas*);
|
||||
// void UCodeDisas_Disassemble(UCodeDisas*, Gfx*);
|
||||
void UCodeDisas_Disassemble(UCodeDisas*, Gfx*);
|
||||
void UCodeDisas_RegisterUCode(UCodeDisas*, s32, UCodeInfo*);
|
||||
void UCodeDisas_SetCurUCode(UCodeDisas*, void*);
|
||||
Acmd* AudioSynth_Update(Acmd* cmdStart, s32* cmdCnt, s16* aiStart, s32 aiBufLen);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -23,20 +23,12 @@ typedef float f32;
|
|||
typedef double f64;
|
||||
|
||||
|
||||
typedef long int Mtx_t[4][4];
|
||||
typedef union {
|
||||
Mtx_t m;
|
||||
struct {
|
||||
u16 intPart[4][4];
|
||||
u16 fracPart[4][4];
|
||||
};
|
||||
long long int force_structure_alignment;
|
||||
} Mtx;
|
||||
|
||||
typedef float MtxF_t[4][4];
|
||||
typedef union {
|
||||
MtxF_t mf;
|
||||
struct {
|
||||
// Note: The order displayed here is the transpose of the order in which matrices are typically written.
|
||||
// For example, [xw, yw, zw] is the translation part of the matrix, not [wx, wy, wz].
|
||||
float xx, yx, zx, wx,
|
||||
xy, yy, zy, wy,
|
||||
xz, yz, zz, wz,
|
||||
|
|
|
@ -1628,7 +1628,7 @@ typedef struct {
|
|||
} UCodeInfo; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 segments[NUM_SEGMENTS];
|
||||
/* 0x00 */ uintptr_t segments[NUM_SEGMENTS];
|
||||
/* 0x40 */ Gfx* dlStack[18];
|
||||
/* 0x88 */ s32 dlDepth;
|
||||
/* 0x8C */ u32 dlCnt;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include "global.h"
|
||||
|
||||
// clang-format off
|
||||
Mtx gMtxClear = {
|
||||
65536, 0, 1, 0,
|
||||
0, 65536, 0, 1,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
};
|
||||
Mtx gMtxClear = gdSPDefMtx(
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f
|
||||
);
|
||||
|
||||
MtxF gMtxFClear = {
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "global.h"
|
||||
|
||||
typedef void (*UcodeDisasCallback)(UCodeDisas*, u32);
|
||||
|
||||
#define F3DZEX_CONST(name) \
|
||||
{ name, #name }
|
||||
#define F3DZEX_FLAG(set, unset) \
|
||||
|
@ -17,8 +19,8 @@
|
|||
if (this->enableLog) \
|
||||
osSyncPrintf
|
||||
|
||||
void* UCodeDisas_TranslateAddr(UCodeDisas* this, u32 addr) {
|
||||
u32 physical = this->segments[SEGMENT_NUMBER(addr)] + SEGMENT_OFFSET(addr);
|
||||
void* UCodeDisas_TranslateAddr(UCodeDisas* this, uintptr_t addr) {
|
||||
uintptr_t physical = this->segments[SEGMENT_NUMBER(addr)] + SEGMENT_OFFSET(addr);
|
||||
|
||||
return PHYSICAL_TO_VIRTUAL(physical);
|
||||
}
|
||||
|
@ -38,61 +40,82 @@ F3dzexFlag sUCodeDisasMtxFlags[] = {
|
|||
F3DZEX_FLAG(G_MTX_PUSH, G_MTX_NOPUSH),
|
||||
};
|
||||
|
||||
const char* UCodeDisas_ParseCombineColor(u32 value, u32 idx) {
|
||||
typedef enum { COMBINER_A = 1, COMBINER_B, COMBINER_C, COMBINER_D } CombinerArg;
|
||||
|
||||
const char* UCodeDisas_GetCombineColorName(u32 value, u32 arg) {
|
||||
const char* ret = "?";
|
||||
|
||||
switch (value) {
|
||||
case G_CCMUX_COMBINED:
|
||||
ret = "COMBINED";
|
||||
break;
|
||||
|
||||
case G_CCMUX_TEXEL0:
|
||||
ret = "TEXEL0";
|
||||
break;
|
||||
|
||||
case G_CCMUX_TEXEL1:
|
||||
ret = "TEXEL1";
|
||||
break;
|
||||
|
||||
case G_CCMUX_PRIMITIVE:
|
||||
ret = "PRIMITIVE";
|
||||
break;
|
||||
|
||||
case G_CCMUX_SHADE:
|
||||
ret = "SHADE";
|
||||
break;
|
||||
|
||||
case G_CCMUX_ENVIRONMENT:
|
||||
ret = "ENVIRONMENT";
|
||||
break;
|
||||
case 6:
|
||||
ret = (idx == 2) ? "CENTER" : (idx == 3) ? "SCALE" : "1";
|
||||
|
||||
case 6: // G_CCMUX_CENTER, G_CCMUX_SCALE, G_CCMUX_1
|
||||
ret = (arg == COMBINER_B) ? "CENTER" : (arg == COMBINER_C) ? "SCALE" : "1";
|
||||
break;
|
||||
case 7:
|
||||
ret = (idx == 1) ? "NOISE" : (idx == 2) ? "K4" : (idx == 3) ? "COMBINED_ALPHA" : "0";
|
||||
|
||||
case 7: // G_CCMUX_NOISE, G_CCMUX_K4, G_CCMUX_COMBINED_ALPHA, G_CCMUX_0
|
||||
ret = (arg == COMBINER_A) ? "NOISE"
|
||||
: (arg == COMBINER_B) ? "K4"
|
||||
: (arg == COMBINER_C) ? "COMBINED_ALPHA"
|
||||
: "0";
|
||||
break;
|
||||
|
||||
default:
|
||||
if (idx == 3) {
|
||||
if (arg == COMBINER_C) {
|
||||
switch (value) {
|
||||
case G_CCMUX_TEXEL0_ALPHA:
|
||||
ret = "TEXEL0_ALPHA";
|
||||
break;
|
||||
|
||||
case G_CCMUX_TEXEL1_ALPHA:
|
||||
ret = "TEXEL1_ALPHA";
|
||||
break;
|
||||
|
||||
case G_CCMUX_PRIMITIVE_ALPHA:
|
||||
ret = "PRIMITIVE_ALPHA";
|
||||
break;
|
||||
|
||||
case G_CCMUX_SHADE_ALPHA:
|
||||
ret = "SHADE_ALPHA";
|
||||
break;
|
||||
|
||||
case G_CCMUX_ENV_ALPHA:
|
||||
ret = "ENV_ALPHA";
|
||||
break;
|
||||
|
||||
case G_CCMUX_LOD_FRACTION:
|
||||
ret = "LOD_FRACTION";
|
||||
break;
|
||||
|
||||
case G_CCMUX_PRIM_LOD_FRAC:
|
||||
ret = "PRIM_LOD_FRAC";
|
||||
break;
|
||||
|
||||
case G_CCMUX_K5:
|
||||
ret = "K5";
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = "0";
|
||||
break;
|
||||
|
@ -104,30 +127,38 @@ const char* UCodeDisas_ParseCombineColor(u32 value, u32 idx) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
const char* UCodeDisas_ParseCombineAlpha(u32 value, u32 idx) {
|
||||
const char* UCodeDisas_GetCombineAlphaName(u32 value, u32 arg) {
|
||||
const char* ret = "?";
|
||||
|
||||
switch (value) {
|
||||
case 0:
|
||||
ret = (idx == 3) ? "LOD_FRACTION" : "COMBINED";
|
||||
case 0: // G_ACMUX_LOD_FRACTION, G_ACMUX_COMBINED
|
||||
ret = (arg == COMBINER_C) ? "LOD_FRACTION" : "COMBINED";
|
||||
break;
|
||||
|
||||
case G_ACMUX_TEXEL0:
|
||||
ret = "TEXEL0";
|
||||
break;
|
||||
|
||||
case G_ACMUX_TEXEL1:
|
||||
ret = "TEXEL1";
|
||||
break;
|
||||
|
||||
case G_ACMUX_PRIMITIVE:
|
||||
ret = "PRIMITIVE";
|
||||
break;
|
||||
|
||||
case G_ACMUX_SHADE:
|
||||
ret = "SHADE";
|
||||
break;
|
||||
|
||||
case G_ACMUX_ENVIRONMENT:
|
||||
ret = "ENVIRONMENT";
|
||||
break;
|
||||
case 6:
|
||||
ret = (idx == 3) ? "PRIM_LOD_FRAC" : "1";
|
||||
|
||||
case 6: // G_ACMUX_PRIM_LOD_FRAC, G_ACMUX_1
|
||||
ret = (arg == COMBINER_C) ? "PRIM_LOD_FRAC" : "1";
|
||||
break;
|
||||
|
||||
case G_ACMUX_0:
|
||||
ret = "0";
|
||||
break;
|
||||
|
@ -162,7 +193,7 @@ void UCodeDisas_SetCurUCodeImpl(UCodeDisas* this, void* ptr) {
|
|||
}
|
||||
}
|
||||
|
||||
void UCodeDisas_ParseGeometryMode(UCodeDisas* this, u32 mode) {
|
||||
void UCodeDisas_PrintGeometryMode(UCodeDisas* this, u32 mode) {
|
||||
u32 first = true;
|
||||
s32 i;
|
||||
|
||||
|
@ -181,7 +212,7 @@ void UCodeDisas_ParseGeometryMode(UCodeDisas* this, u32 mode) {
|
|||
}
|
||||
}
|
||||
|
||||
void UCodeDisas_ParseRenderMode(UCodeDisas* this, u32 mode) {
|
||||
void UCodeDisas_PrintRenderMode(UCodeDisas* this, u32 mode) {
|
||||
static F3dzexRenderMode sUCodeDisasRenderModeFlags[] = {
|
||||
F3DZEX_RENDERMODE(AA_EN, 0x8),
|
||||
F3DZEX_RENDERMODE(Z_CMP, 0x10),
|
||||
|
@ -200,7 +231,7 @@ void UCodeDisas_ParseRenderMode(UCodeDisas* this, u32 mode) {
|
|||
F3DZEX_RENDERMODE(ALPHA_CVG_SEL, 0x2000),
|
||||
F3DZEX_RENDERMODE(FORCE_BL, 0x4000),
|
||||
};
|
||||
static const char* D_8012DDDC[4][4] = {
|
||||
static const char* sBlenderInputNames[4][4] = {
|
||||
{ "G_BL_CLR_IN", "G_BL_CLR_MEM", "G_BL_CLR_BL", "G_BL_CLR_FOG" },
|
||||
{ "G_BL_A_IN", "G_BL_A_FOG", "G_BL_A_SHADE", "G_BL_0" },
|
||||
{ "G_BL_CLR_IN", "G_BL_CLR_MEM", "G_BL_CLR_BL", "G_BL_CLR_FOG" },
|
||||
|
@ -224,18 +255,19 @@ void UCodeDisas_ParseRenderMode(UCodeDisas* this, u32 mode) {
|
|||
|
||||
// clang-format off
|
||||
if (this->enableLog == 0) {} else { osSyncPrintf("\nGBL_c1(%s, %s, %s, %s)|",
|
||||
D_8012DDDC[0][a >> 12 & 3], D_8012DDDC[1][a >> 8 & 3], D_8012DDDC[2][a >> 4 & 3], D_8012DDDC[3][a >> 0 & 3]);
|
||||
sBlenderInputNames[0][a >> 12 & 3], sBlenderInputNames[1][a >> 8 & 3], sBlenderInputNames[2][a >> 4 & 3], sBlenderInputNames[3][a >> 0 & 3]);
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
if (this->enableLog) {
|
||||
osSyncPrintf("\nGBL_c2(%s, %s, %s, %s)", D_8012DDDC[0][b >> 12 & 3], D_8012DDDC[1][b >> 8 & 3],
|
||||
D_8012DDDC[2][b >> 4 & 3], D_8012DDDC[3][b >> 0 & 3]);
|
||||
osSyncPrintf("\nGBL_c2(%s, %s, %s, %s)", sBlenderInputNames[0][b >> 12 & 3], sBlenderInputNames[1][b >> 8 & 3],
|
||||
sBlenderInputNames[2][b >> 4 & 3], sBlenderInputNames[3][b >> 0 & 3]);
|
||||
}
|
||||
}
|
||||
|
||||
void UCodeDisas_PrintVertices(UCodeDisas* this, Vtx* vtx, s32 count, s32 start) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (this->geometryMode & G_LIGHTING) {
|
||||
DISAS_LOG("\n{{%6d, %6d, %6d, %d, %6d, %6d, %3d, %3d, %3d, %3d}}, /* vc%d */", vtx->n.ob[0], vtx->n.ob[1],
|
||||
|
@ -252,225 +284,32 @@ void UCodeDisas_PrintVertices(UCodeDisas* this, Vtx* vtx, s32 count, s32 start)
|
|||
}
|
||||
}
|
||||
|
||||
// Todo: clean this up
|
||||
|
||||
typedef struct {
|
||||
s8 cmd;
|
||||
u8 v0;
|
||||
u8 v1;
|
||||
u8 wd;
|
||||
void UCodeDisas_Disassemble(UCodeDisas* this, Gfx* ptr) {
|
||||
u32 pad;
|
||||
} Gline3DFix;
|
||||
|
||||
typedef struct {
|
||||
int cmd : 8;
|
||||
u32 pad : 4;
|
||||
u32 numv : 8;
|
||||
s32 pad2 : 4;
|
||||
u8 vbidx;
|
||||
} Gvtx;
|
||||
|
||||
typedef struct {
|
||||
u8 pad : 8;
|
||||
u8 v0 : 8;
|
||||
u8 v1 : 8;
|
||||
u8 v2 : 8;
|
||||
} Gtrimod;
|
||||
|
||||
typedef struct {
|
||||
int cmd : 8;
|
||||
int pad : 24;
|
||||
Gtrimod tri;
|
||||
} Gtri1;
|
||||
|
||||
typedef struct {
|
||||
Gtrimod tri1;
|
||||
Gtrimod tri2;
|
||||
} Gtri2;
|
||||
|
||||
typedef struct {
|
||||
u8 pad : 8;
|
||||
u8 v0 : 8;
|
||||
u8 v1 : 8;
|
||||
u8 v2 : 8;
|
||||
u8 pad1 : 8;
|
||||
u8 pad2 : 8;
|
||||
u8 pad3 : 8;
|
||||
u8 v3 : 8;
|
||||
} Gquadmod;
|
||||
|
||||
typedef struct {
|
||||
u16 pad;
|
||||
u16 vstart;
|
||||
u16 pad2;
|
||||
u16 vend;
|
||||
} Gcull;
|
||||
|
||||
typedef struct {
|
||||
u16 pad;
|
||||
u16 vstart;
|
||||
u16 pad2;
|
||||
u16 vend;
|
||||
} Gbranchz;
|
||||
|
||||
typedef struct {
|
||||
int cmd : 8;
|
||||
u8 pad;
|
||||
u8 prim_min_level;
|
||||
u8 prim_level;
|
||||
u8 r;
|
||||
u8 g;
|
||||
u8 b;
|
||||
u8 a;
|
||||
} GsetcolorMod;
|
||||
|
||||
typedef struct {
|
||||
u8 cmd;
|
||||
char pad[3];
|
||||
u16 z;
|
||||
u16 d;
|
||||
} Gsetprimdepth;
|
||||
|
||||
typedef struct {
|
||||
u8 cmd;
|
||||
u8 type;
|
||||
u16 len;
|
||||
union {
|
||||
u32 u32;
|
||||
f32 f32;
|
||||
} value;
|
||||
} Gnoop;
|
||||
|
||||
typedef struct {
|
||||
u8 cmd;
|
||||
u8 pad[2];
|
||||
u8 params;
|
||||
u32 addr;
|
||||
} Gmatrix;
|
||||
|
||||
typedef struct {
|
||||
u8 cmd;
|
||||
u32 a : 4;
|
||||
u32 c : 5;
|
||||
u32 z : 3;
|
||||
u32 x : 3;
|
||||
u32 e : 4;
|
||||
u32 g : 5;
|
||||
u32 b : 4;
|
||||
u32 f : 4;
|
||||
u32 v : 3;
|
||||
u32 t : 3;
|
||||
u32 d : 3;
|
||||
u32 y : 3;
|
||||
u32 w : 3;
|
||||
u32 h : 3;
|
||||
u32 u : 3;
|
||||
u32 s : 3;
|
||||
} GsetcombineMod;
|
||||
|
||||
typedef struct {
|
||||
u32 cmd : 8;
|
||||
u32 pad0 : 8;
|
||||
u32 sft : 8;
|
||||
u32 len : 8;
|
||||
u32 data : 32;
|
||||
} GsetothermodeMod;
|
||||
|
||||
typedef struct {
|
||||
s32 cmd : 8;
|
||||
u32 offset : 16;
|
||||
u32 index : 8;
|
||||
u32 data;
|
||||
} Gmovewd;
|
||||
|
||||
typedef struct {
|
||||
s32 cmd : 8;
|
||||
u32 size : 8;
|
||||
u32 offset : 8;
|
||||
u32 index : 8;
|
||||
u32 data;
|
||||
} Gmovemem;
|
||||
|
||||
typedef struct {
|
||||
u8 cmd : 8;
|
||||
u8 lodscale : 8;
|
||||
u8 pad : 2;
|
||||
u8 level : 3;
|
||||
u8 tile : 3;
|
||||
|
||||
unsigned char on;
|
||||
unsigned short s;
|
||||
unsigned short t;
|
||||
} Gtexturemod;
|
||||
|
||||
typedef struct {
|
||||
int cmd : 8;
|
||||
int pad1 : 24;
|
||||
u32 param : 26;
|
||||
unsigned char pad3 : 6;
|
||||
} Gpopmtxmod;
|
||||
|
||||
typedef union {
|
||||
Gwords words;
|
||||
Gnoop noop;
|
||||
Gmatrix matrix;
|
||||
Gdma dma;
|
||||
Gtri1 tri1;
|
||||
Gtri2 tri2;
|
||||
Gquadmod quad;
|
||||
Gcull cull;
|
||||
Gline3D line;
|
||||
Gline3DFix linefix;
|
||||
Gmovewd movewd;
|
||||
Gmovemem movemem;
|
||||
Gpopmtx popmtx;
|
||||
Gpopmtxmod popmtxmod;
|
||||
Gsegment segment;
|
||||
GsetothermodeH setothermodeH;
|
||||
GsetothermodeL setothermodeL;
|
||||
GsetothermodeMod setothermode;
|
||||
Gtexture texture;
|
||||
Gtexturemod texmod;
|
||||
Gperspnorm perspnorm;
|
||||
Gsetimg setimg;
|
||||
GsetcombineMod setcombine;
|
||||
GsetcolorMod setcolor; // mod
|
||||
Gfillrect fillrect; /* use for setscissor also */
|
||||
Gsettile settile;
|
||||
Gloadtile loadtile; /* use for loadblock also, th is dxt */
|
||||
Gsettilesize settilesize;
|
||||
Gloadtlut loadtlut;
|
||||
Gsetprimdepth setprimdepth;
|
||||
Gvtx vtx;
|
||||
long long int force_structure_alignment;
|
||||
} GfxMod;
|
||||
|
||||
void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
||||
u32 pad;
|
||||
u32 addr;
|
||||
uintptr_t addr;
|
||||
u32 rdpHalf;
|
||||
u16 linkDlLow;
|
||||
u8 sid;
|
||||
u8 cmd;
|
||||
s32 i0;
|
||||
s32 i;
|
||||
u32 exit;
|
||||
GfxMod curGfx[1];
|
||||
Gfx curGfx[1];
|
||||
|
||||
exit = false;
|
||||
|
||||
while (!exit) {
|
||||
this->dlCnt++;
|
||||
|
||||
ptr = UCodeDisas_TranslateAddr(this, (u32)ptr);
|
||||
ptr = UCodeDisas_TranslateAddr(this, (uintptr_t)ptr);
|
||||
DISAS_LOG("%08x:", ptr);
|
||||
|
||||
*curGfx = *ptr;
|
||||
cmd = curGfx->dma.cmd;
|
||||
addr = (u32)UCodeDisas_TranslateAddr(this, curGfx->dma.addr);
|
||||
cmd = curGfx->noop.cmd;
|
||||
addr = (uintptr_t)UCodeDisas_TranslateAddr(this, (uintptr_t)curGfx->noop.value.addr);
|
||||
|
||||
DISAS_LOG("%08x-%08x:", curGfx->words.w0, curGfx->words.w1);
|
||||
|
||||
for (i0 = 0; i0 < this->dlDepth; i0++) {
|
||||
for (i = 0; i < this->dlDepth; i++) {
|
||||
DISAS_LOG(" ");
|
||||
}
|
||||
|
||||
|
@ -483,15 +322,15 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
Gdma dma = ptr->dma;
|
||||
|
||||
switch (dma.par) {
|
||||
case 0: {
|
||||
case G_DL_PUSH: {
|
||||
DISAS_LOG("gsSPDisplayList(0x%08x),", dma.addr);
|
||||
this->dlStack[this->dlDepth++] = (Gfx*)(ptr + 1);
|
||||
ptr = (GfxMod*)addr - 1;
|
||||
ptr = (Gfx*)addr - 1;
|
||||
} break;
|
||||
|
||||
case 1: {
|
||||
case G_DL_NOPUSH: {
|
||||
DISAS_LOG("gsSPBranchList(0x%08x),", dma.addr);
|
||||
ptr = (GfxMod*)addr - 1;
|
||||
ptr = (Gfx*)addr - 1;
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
|
@ -513,7 +352,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
} break;
|
||||
|
||||
case G_LOAD_UCODE: {
|
||||
if (curGfx->dma.len == 0x7FF) {
|
||||
if (curGfx->dma.len == SP_UCODE_DATA_SIZE - 1) {
|
||||
DISAS_LOG("gsSPLoadUcode(0x%08x, 0x%08x),", curGfx->dma.addr, rdpHalf);
|
||||
} else {
|
||||
DISAS_LOG("gsSPLoadUcodeEx(0x%08x, 0x%08x, 0x%05x),", curGfx->dma.addr, rdpHalf,
|
||||
|
@ -528,7 +367,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
if (this->dlDepth <= 0) {
|
||||
exit = true;
|
||||
} else {
|
||||
ptr = (GfxMod*)this->dlStack[--this->dlDepth] - 1;
|
||||
ptr = this->dlStack[--this->dlDepth] - 1;
|
||||
}
|
||||
} break;
|
||||
|
||||
|
@ -579,20 +418,28 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
} break;
|
||||
|
||||
case G_SETCOMBINE: {
|
||||
GsetcombineMod setcombine = ptr->setcombine;
|
||||
Gsetcombine setcombine = ptr->setcombine;
|
||||
|
||||
DISAS_LOG("gsDPSetCombineLERP(%s,%s,%s,%s, %s,%s,%s,%s, %s,%s,%s,%s, %s,%s,%s,%s),",
|
||||
UCodeDisas_ParseCombineColor(setcombine.a, 1), UCodeDisas_ParseCombineColor(setcombine.b, 2),
|
||||
UCodeDisas_ParseCombineColor(setcombine.c, 3), UCodeDisas_ParseCombineColor(setcombine.d, 4),
|
||||
UCodeDisas_GetCombineColorName(setcombine.a0, COMBINER_A),
|
||||
UCodeDisas_GetCombineColorName(setcombine.b0, COMBINER_B),
|
||||
UCodeDisas_GetCombineColorName(setcombine.c0, COMBINER_C),
|
||||
UCodeDisas_GetCombineColorName(setcombine.d0, COMBINER_D),
|
||||
|
||||
UCodeDisas_ParseCombineAlpha(setcombine.z, 1), UCodeDisas_ParseCombineAlpha(setcombine.y, 2),
|
||||
UCodeDisas_ParseCombineAlpha(setcombine.x, 3), UCodeDisas_ParseCombineAlpha(setcombine.w, 4),
|
||||
UCodeDisas_GetCombineAlphaName(setcombine.Aa0, COMBINER_A),
|
||||
UCodeDisas_GetCombineAlphaName(setcombine.Ab0, COMBINER_B),
|
||||
UCodeDisas_GetCombineAlphaName(setcombine.Ac0, COMBINER_C),
|
||||
UCodeDisas_GetCombineAlphaName(setcombine.Ad0, COMBINER_D),
|
||||
|
||||
UCodeDisas_ParseCombineColor(setcombine.e, 1), UCodeDisas_ParseCombineColor(setcombine.f, 2),
|
||||
UCodeDisas_ParseCombineColor(setcombine.g, 3), UCodeDisas_ParseCombineColor(setcombine.h, 4),
|
||||
UCodeDisas_GetCombineColorName(setcombine.a1, COMBINER_A),
|
||||
UCodeDisas_GetCombineColorName(setcombine.b1, COMBINER_B),
|
||||
UCodeDisas_GetCombineColorName(setcombine.c1, COMBINER_C),
|
||||
UCodeDisas_GetCombineColorName(setcombine.d1, COMBINER_D),
|
||||
|
||||
UCodeDisas_ParseCombineAlpha(setcombine.v, 1), UCodeDisas_ParseCombineAlpha(setcombine.u, 2),
|
||||
UCodeDisas_ParseCombineAlpha(setcombine.t, 3), UCodeDisas_ParseCombineAlpha(setcombine.s, 4));
|
||||
UCodeDisas_GetCombineAlphaName(setcombine.Aa1, COMBINER_A),
|
||||
UCodeDisas_GetCombineAlphaName(setcombine.Ab1, COMBINER_B),
|
||||
UCodeDisas_GetCombineAlphaName(setcombine.Ac1, COMBINER_C),
|
||||
UCodeDisas_GetCombineAlphaName(setcombine.Ad1, COMBINER_D));
|
||||
|
||||
if (this->pipeSyncRequired) {
|
||||
DISAS_LOG("### PipeSyncが必要です。\n");
|
||||
|
@ -624,34 +471,33 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
-1),
|
||||
};
|
||||
|
||||
u32 len = curGfx->setothermode.len + 1;
|
||||
u32 sft = (-curGfx->setothermode.sft - len) + 32;
|
||||
u32 s2 = curGfx->setothermode.data * 1;
|
||||
u32 i1;
|
||||
u32 i2;
|
||||
u32 len = curGfx->setothermodeH.len + 1;
|
||||
u32 sft = (-curGfx->setothermodeH.sft - len) + 32;
|
||||
u32 s2 = curGfx->setothermodeH.data * 1;
|
||||
u32 j;
|
||||
u32 k;
|
||||
|
||||
for (i1 = 0; i1 < ARRAY_COUNTU(sUCodeDisasModeHMacros); i1++) {
|
||||
if (sft == sUCodeDisasModeHMacros[i1].shift) {
|
||||
for (i2 = 0; i2 < 4; i2++) {
|
||||
if (s2 == sUCodeDisasModeHMacros[i1].values[i2].value) {
|
||||
DISAS_LOG("gsDP%s(%s),", sUCodeDisasModeHMacros[i1].name,
|
||||
sUCodeDisasModeHMacros[i1].values[i2].name);
|
||||
goto block_1;
|
||||
for (j = 0; j < ARRAY_COUNTU(sUCodeDisasModeHMacros); j++) {
|
||||
if (sft == sUCodeDisasModeHMacros[j].shift) {
|
||||
for (k = 0; k < ARRAY_COUNTU(sUCodeDisasModeHMacros[j].values); k++) {
|
||||
if (s2 == sUCodeDisasModeHMacros[j].values[k].value) {
|
||||
DISAS_LOG("gsDP%s(%s),", sUCodeDisasModeHMacros[j].name,
|
||||
sUCodeDisasModeHMacros[j].values[k].name);
|
||||
goto found_othermode_hi_macro;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DISAS_LOG("gsSPSetOtherModeH(%d, %d, 0x%08x),", sft, len, s2);
|
||||
|
||||
block_1:
|
||||
this->modeH &= (((1 - (1 << len)) << sft) - 1);
|
||||
found_othermode_hi_macro:
|
||||
this->modeH &= ((1 - (1 << len)) << sft) - 1;
|
||||
this->modeH |= s2;
|
||||
|
||||
if (this->pipeSyncRequired) {
|
||||
DISAS_LOG("### PipeSyncが必要です。\n");
|
||||
this->syncErr++;
|
||||
}
|
||||
|
||||
} break;
|
||||
|
||||
case G_SETOTHERMODE_L: {
|
||||
|
@ -661,24 +507,24 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
F3DZEX_SETRENDERMACRO("gsDPSetDepthSource", G_MDSFT_ZSRCSEL, 1, G_ZS_PIXEL, G_ZS_PRIM, -1, -1),
|
||||
};
|
||||
|
||||
u32 len = curGfx->setothermode.len + 1;
|
||||
u32 sft = (-curGfx->setothermode.sft - len) + 32;
|
||||
u32 s2 = curGfx->setothermode.data * 1;
|
||||
u32 i1;
|
||||
u32 i2;
|
||||
u32 len = curGfx->setothermodeL.len + 1;
|
||||
u32 sft = (-curGfx->setothermodeL.sft - len) + 32;
|
||||
u32 s2 = curGfx->setothermodeL.data * 1;
|
||||
u32 j;
|
||||
u32 k;
|
||||
|
||||
if (sft == G_MDSFT_RENDERMODE) {
|
||||
DISAS_LOG("\ngsDPSetRenderBlender(");
|
||||
UCodeDisas_ParseRenderMode(this, s2);
|
||||
UCodeDisas_PrintRenderMode(this, s2);
|
||||
DISAS_LOG("\n),");
|
||||
} else {
|
||||
for (i1 = 0; i1 * 1 < ARRAY_COUNTU(sUCodeDisasModeLMacros); i1++) {
|
||||
if (sft == sUCodeDisasModeLMacros[i1].shift) {
|
||||
for (i2 = 0; i2 < 4; i2++) {
|
||||
if (s2 == sUCodeDisasModeLMacros[i1].values[i2].value) {
|
||||
DISAS_LOG("gsDP%s(%s),", sUCodeDisasModeLMacros[i1].name,
|
||||
sUCodeDisasModeLMacros[i1].values[i2].name);
|
||||
goto block_2;
|
||||
for (j = 0; j * 1 < ARRAY_COUNTU(sUCodeDisasModeLMacros); j++) {
|
||||
if (sft == sUCodeDisasModeLMacros[j].shift) {
|
||||
for (k = 0; k < ARRAY_COUNTU(sUCodeDisasModeLMacros[j].values); k++) {
|
||||
if (s2 == sUCodeDisasModeLMacros[j].values[k].value) {
|
||||
DISAS_LOG("gsDP%s(%s),", sUCodeDisasModeLMacros[j].name,
|
||||
sUCodeDisasModeLMacros[j].values[k].name);
|
||||
goto found_othermode_lo_macro;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -686,7 +532,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
DISAS_LOG("gsSPSetOtherModeL(%d, %d, 0x%08x),", sft, len, s2);
|
||||
}
|
||||
|
||||
block_2:
|
||||
found_othermode_lo_macro:
|
||||
this->modeL &= (((1 - (1 << len)) << sft) - 1);
|
||||
this->modeL |= s2;
|
||||
|
||||
|
@ -758,7 +604,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
} break;
|
||||
|
||||
case G_SETZIMG: {
|
||||
DISAS_LOG("gsDPSetDepthImage(0x%08x(0x%08x)),", curGfx->words.w1, addr);
|
||||
DISAS_LOG("gsDPSetDepthImage(0x%08x(0x%08x)),", curGfx->setimg.dram, addr);
|
||||
|
||||
if (this->pipeSyncRequired) {
|
||||
DISAS_LOG("### PipeSyncが必要です。\n");
|
||||
|
@ -814,7 +660,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
} break;
|
||||
|
||||
case G_SETFILLCOLOR: {
|
||||
DISAS_LOG("gsDPSetFillColor(0x%08x),", curGfx->words.w1);
|
||||
DISAS_LOG("gsDPSetFillColor(0x%08x),", curGfx->setcolor.color);
|
||||
|
||||
if (this->pipeSyncRequired) {
|
||||
DISAS_LOG("### PipeSyncが必要です。\n");
|
||||
|
@ -823,7 +669,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
} break;
|
||||
|
||||
case G_SETPRIMDEPTH: {
|
||||
DISAS_LOG("gsDPSetPrimDepth(%d, %d),", curGfx->setprimdepth.z, curGfx->setprimdepth.d);
|
||||
DISAS_LOG("gsDPSetPrimDepth(%d, %d),", curGfx->setprimdepth.z, curGfx->setprimdepth.dz);
|
||||
|
||||
if (this->pipeSyncRequired) {
|
||||
DISAS_LOG("### PipeSyncが必要です。\n");
|
||||
|
@ -872,19 +718,19 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
} break;
|
||||
|
||||
case 1: {
|
||||
DISAS_LOG("count_gsDPNoOpHere([%s:%d]),", curGfx->noop.value.u32, curGfx->noop.len);
|
||||
DISAS_LOG("count_gsDPNoOpHere([%s:%d]),", curGfx->noop.value.str, curGfx->noop.len);
|
||||
} break;
|
||||
|
||||
case 7: {
|
||||
DISAS_LOG("count_gsDPNoOpOpenDisp([%s:%d]),", curGfx->noop.value.u32, curGfx->noop.len);
|
||||
DISAS_LOG("count_gsDPNoOpOpenDisp([%s:%d]),", curGfx->noop.value.str, curGfx->noop.len);
|
||||
} break;
|
||||
|
||||
case 8: {
|
||||
DISAS_LOG("count_gsDPNoOpCloseDisp([%s:%d]),", curGfx->noop.value.u32, curGfx->noop.len);
|
||||
DISAS_LOG("count_gsDPNoOpCloseDisp([%s:%d]),", curGfx->noop.value.str, curGfx->noop.len);
|
||||
} break;
|
||||
|
||||
case 2: {
|
||||
DISAS_LOG("count_gsDPNoOpString(%c%s%c, %d),", '"', curGfx->noop.value.u32, '"',
|
||||
DISAS_LOG("count_gsDPNoOpString(%c%s%c, %d),", '"', curGfx->noop.value.str, '"',
|
||||
curGfx->noop.len);
|
||||
} break;
|
||||
|
||||
|
@ -906,9 +752,9 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
} break;
|
||||
|
||||
case 6: {
|
||||
/*! @bug arguments are not printed */
|
||||
//! @bug arguments are not printed
|
||||
DISAS_LOG("count_gsDPNoOpCallBack(%08x,%d),");
|
||||
((void (*)(UCodeDisas*, u32))curGfx->noop.value.u32)(this, curGfx->noop.len);
|
||||
((UcodeDisasCallback)curGfx->noop.value.callback)(this, curGfx->noop.len);
|
||||
} break;
|
||||
|
||||
default: {
|
||||
|
@ -924,27 +770,27 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
case UCODE_UNK: {
|
||||
switch (cmd) {
|
||||
case G_MTX: {
|
||||
Gmatrix gmtx = ptr->matrix;
|
||||
Gdma2 gmtx = ptr->dma2;
|
||||
u32 params;
|
||||
MtxF mtx;
|
||||
s32 i1 = 0;
|
||||
MtxF mtxF;
|
||||
s32 j = 0;
|
||||
|
||||
DISAS_LOG("gsSPMatrix(0x%08x(%08x), 0", gmtx.addr, addr);
|
||||
|
||||
params = (gmtx.params ^ G_MTX_PUSH);
|
||||
params = gmtx.par ^ G_MTX_PUSH;
|
||||
|
||||
for (; i1 != ARRAY_COUNT(sUCodeDisasMtxFlags); i1++) {
|
||||
DISAS_LOG("|%s", (sUCodeDisasMtxFlags[i1].value & params)
|
||||
? sUCodeDisasMtxFlags[i1].setName
|
||||
: sUCodeDisasMtxFlags[i1].unsetName);
|
||||
for (; j != ARRAY_COUNT(sUCodeDisasMtxFlags); j++) {
|
||||
DISAS_LOG("|%s", (sUCodeDisasMtxFlags[j].value & params)
|
||||
? sUCodeDisasMtxFlags[j].setName
|
||||
: sUCodeDisasMtxFlags[j].unsetName);
|
||||
}
|
||||
DISAS_LOG("),", gmtx.addr); /*! @bug gmtx.addr shouldn't be here*/
|
||||
DISAS_LOG("),", gmtx.addr); //! @bug gmtx.addr shouldn't be here
|
||||
|
||||
if (this->enableLog >= 2) {
|
||||
MtxConv_L2F(&mtx, (Mtx*)addr);
|
||||
MtxConv_L2F(&mtxF, (Mtx*)addr);
|
||||
DISAS_LOG("\n");
|
||||
|
||||
/*! @bug %.04x.%04x is a typo, should be %04x.%04x */
|
||||
//! @bug %.04x.%04x is a typo, should be %04x.%04x
|
||||
// clang-format off
|
||||
DISAS_LOG(
|
||||
"/ %04x.%04x %04x.%04x %04x.%04x %.04x.%04x \\/ %12.6f %12.6f %12.6f %12.6f \\\n"
|
||||
|
@ -955,22 +801,22 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
((Mtx*)addr)->intPart[1][0], ((Mtx*)addr)->fracPart[1][0],
|
||||
((Mtx*)addr)->intPart[2][0], ((Mtx*)addr)->fracPart[2][0],
|
||||
((Mtx*)addr)->intPart[3][0], ((Mtx*)addr)->fracPart[3][0],
|
||||
mtx.mf[0][0], mtx.mf[1][0], mtx.mf[2][0], mtx.mf[3][0],
|
||||
mtxF.mf[0][0], mtxF.mf[1][0], mtxF.mf[2][0], mtxF.mf[3][0],
|
||||
((Mtx*)addr)->intPart[0][1], ((Mtx*)addr)->fracPart[0][1],
|
||||
((Mtx*)addr)->intPart[1][1], ((Mtx*)addr)->fracPart[1][1],
|
||||
((Mtx*)addr)->intPart[2][1], ((Mtx*)addr)->fracPart[2][1],
|
||||
((Mtx*)addr)->intPart[3][1], ((Mtx*)addr)->fracPart[3][1],
|
||||
mtx.mf[0][1], mtx.mf[1][1], mtx.mf[2][1], mtx.mf[3][1],
|
||||
mtxF.mf[0][1], mtxF.mf[1][1], mtxF.mf[2][1], mtxF.mf[3][1],
|
||||
((Mtx*)addr)->intPart[0][2], ((Mtx*)addr)->fracPart[0][2],
|
||||
((Mtx*)addr)->intPart[1][2], ((Mtx*)addr)->fracPart[1][2],
|
||||
((Mtx*)addr)->intPart[2][2], ((Mtx*)addr)->fracPart[2][2],
|
||||
((Mtx*)addr)->intPart[3][2], ((Mtx*)addr)->fracPart[3][2],
|
||||
mtx.mf[0][2], mtx.mf[1][2], mtx.mf[2][2], mtx.mf[3][2],
|
||||
mtxF.mf[0][2], mtxF.mf[1][2], mtxF.mf[2][2], mtxF.mf[3][2],
|
||||
((Mtx*)addr)->intPart[0][3], ((Mtx*)addr)->fracPart[0][3],
|
||||
((Mtx*)addr)->intPart[1][3], ((Mtx*)addr)->fracPart[1][3],
|
||||
((Mtx*)addr)->intPart[2][3], ((Mtx*)addr)->fracPart[2][3],
|
||||
((Mtx*)addr)->intPart[3][3], ((Mtx*)addr)->fracPart[3][3],
|
||||
mtx.mf[0][3], mtx.mf[1][3], mtx.mf[2][3], mtx.mf[3][3]);
|
||||
mtxF.mf[0][3], mtxF.mf[1][3], mtxF.mf[2][3], mtxF.mf[3][3]);
|
||||
// clang-format on
|
||||
}
|
||||
} break;
|
||||
|
@ -981,9 +827,9 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
|
||||
numv >>= 12;
|
||||
numv &= 0xFF;
|
||||
vbidx = (curGfx->vtx.vbidx >> 1) - numv;
|
||||
vbidx = (curGfx->vtx.par >> 1) - numv;
|
||||
|
||||
DISAS_LOG("gsSPVertex(0x%08x(0x%08x), %d, %d),", curGfx->words.w1, addr, numv, vbidx);
|
||||
DISAS_LOG("gsSPVertex(0x%08x(0x%08x), %d, %d),", curGfx->vtx.addr, addr, numv, vbidx);
|
||||
|
||||
this->vtxCnt += numv;
|
||||
this->spvtxCnt++;
|
||||
|
@ -1006,21 +852,21 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
} break;
|
||||
|
||||
case G_TRI1: {
|
||||
Gtri1 gtri = ptr->tri1;
|
||||
Gtrimod tri = gtri.tri;
|
||||
Gtri gtri = ptr->tri;
|
||||
Tri tri = gtri.tri;
|
||||
|
||||
DISAS_LOG("gsSP1Triangle(%d, %d, %d),", tri.v0 / 2, tri.v1 / 2, tri.v2 / 2);
|
||||
DISAS_LOG("gsSP1Triangle(%d, %d, %d),", tri.v[0] / 2, tri.v[1] / 2, tri.v[2] / 2);
|
||||
|
||||
this->tri1Cnt++;
|
||||
this->pipeSyncRequired = true;
|
||||
} break;
|
||||
|
||||
case G_LINE3D: {
|
||||
if (curGfx->linefix.wd == 0) {
|
||||
DISAS_LOG("gsSPLine3D(%d, %d),", curGfx->linefix.v0, curGfx->linefix.v1);
|
||||
if (curGfx->line.wd == 0) {
|
||||
DISAS_LOG("gsSPLine3D(%d, %d),", curGfx->line.v0, curGfx->line.v1);
|
||||
} else {
|
||||
DISAS_LOG("gsSPLineW3D(%d, %d, %d),", curGfx->linefix.v0, curGfx->linefix.v1,
|
||||
curGfx->linefix.wd);
|
||||
DISAS_LOG("gsSPLineW3D(%d, %d, %d),", curGfx->line.v0, curGfx->line.v1,
|
||||
curGfx->line.wd);
|
||||
}
|
||||
|
||||
this->lineCnt++;
|
||||
|
@ -1032,13 +878,13 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
u32 v0, v1, v2;
|
||||
u32 v3, v4, v5;
|
||||
|
||||
v0 = tri2.tri1.v0 / 2;
|
||||
v1 = tri2.tri1.v1 / 2;
|
||||
v2 = tri2.tri1.v2 / 2;
|
||||
v0 = tri2.tri1.v[0] / 2;
|
||||
v1 = tri2.tri1.v[1] / 2;
|
||||
v2 = tri2.tri1.v[2] / 2;
|
||||
|
||||
v3 = tri2.tri2.v0 / 2;
|
||||
v4 = tri2.tri2.v1 / 2;
|
||||
v5 = tri2.tri2.v2 / 2;
|
||||
v3 = tri2.tri2.v[0] / 2;
|
||||
v4 = tri2.tri2.v[1] / 2;
|
||||
v5 = tri2.tri2.v[2] / 2;
|
||||
|
||||
DISAS_LOG("gsSP2Triangles(%d, %d, %d, 0, %d, %d, %d, 0),", v0, v1, v2, v3, v4, v5);
|
||||
|
||||
|
@ -1047,13 +893,13 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
} break;
|
||||
|
||||
case G_QUAD: {
|
||||
Gquadmod quad = ptr->quad;
|
||||
Gquad quad = ptr->quad;
|
||||
u32 v0, v1, v2, v3;
|
||||
|
||||
v0 = quad.v0 / 2;
|
||||
v1 = quad.v1 / 2;
|
||||
v2 = quad.v2 / 2;
|
||||
v3 = quad.v3 / 2;
|
||||
v0 = quad.tri1.v[0] / 2;
|
||||
v1 = quad.tri1.v[1] / 2;
|
||||
v2 = quad.tri1.v[2] / 2;
|
||||
v3 = quad.tri2.v[2] / 2;
|
||||
|
||||
DISAS_LOG("gsSP1Quadrangle(%d, %d, %d, %d, 0),", v0, v1, v2, v3);
|
||||
|
||||
|
@ -1062,19 +908,19 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
} break;
|
||||
|
||||
case G_CULLDL: {
|
||||
DISAS_LOG("gsSPCullDisplayList(%d, %d),", (curGfx->cull.vstart) / 2,
|
||||
(curGfx->cull.vend) / 2);
|
||||
DISAS_LOG("gsSPCullDisplayList(%d, %d),", (curGfx->cull.vstart_x2) / 2,
|
||||
(curGfx->cull.vend_x2) / 2);
|
||||
} break;
|
||||
|
||||
case G_BRANCH_Z: {
|
||||
addr = (u32)UCodeDisas_TranslateAddr(this, rdpHalf);
|
||||
addr = (uintptr_t)UCodeDisas_TranslateAddr(this, rdpHalf);
|
||||
DISAS_LOG("gsSPBranchLessZraw(0x%08x(0x%08x), %d, 0x%08x),", rdpHalf, addr,
|
||||
(curGfx->words.w0 & 0xFFF) / 2, curGfx->words.w1);
|
||||
ptr = (GfxMod*)addr - 1;
|
||||
ptr = (Gfx*)addr - 1;
|
||||
} break;
|
||||
|
||||
case G_TEXTURE: {
|
||||
Gtexturemod texture = ptr->texmod;
|
||||
Gtexture texture = ptr->texture;
|
||||
|
||||
if (texture.lodscale == 0) {
|
||||
DISAS_LOG("gsSPTexture(%d, %d, %d, %d, %s),", texture.s, texture.t, texture.level,
|
||||
|
@ -1087,12 +933,12 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
} break;
|
||||
|
||||
case G_POPMTX: {
|
||||
Gpopmtxmod popmtx = ptr->popmtxmod;
|
||||
Gpopmtx popmtx = ptr->popmtx;
|
||||
|
||||
if (popmtx.param == 1) {
|
||||
if (popmtx.param / 64 == 1) {
|
||||
DISAS_LOG("gsSPPopMatrix(G_MTX_MODELVIEW),");
|
||||
} else {
|
||||
DISAS_LOG("gsSPPopMatrixN(G_MTX_MODELVIEW, %d),", popmtx.param);
|
||||
DISAS_LOG("gsSPPopMatrixN(G_MTX_MODELVIEW, %d),", popmtx.param / 64);
|
||||
}
|
||||
} break;
|
||||
|
||||
|
@ -1102,21 +948,21 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
|
||||
if (clearbits == 0) {
|
||||
DISAS_LOG("gsSPLoadGeometryMode(");
|
||||
UCodeDisas_ParseGeometryMode(this, setbits);
|
||||
UCodeDisas_PrintGeometryMode(this, setbits);
|
||||
DISAS_LOG("),");
|
||||
} else if (setbits == 0) {
|
||||
DISAS_LOG("gsSPClearGeometryMode(");
|
||||
UCodeDisas_ParseGeometryMode(this, ~clearbits);
|
||||
UCodeDisas_PrintGeometryMode(this, ~clearbits);
|
||||
DISAS_LOG("),");
|
||||
} else if (clearbits == 0xFFFFFF) {
|
||||
DISAS_LOG("gsSPSetGeometryMode(");
|
||||
UCodeDisas_ParseGeometryMode(this, setbits);
|
||||
UCodeDisas_PrintGeometryMode(this, setbits);
|
||||
DISAS_LOG("),");
|
||||
} else {
|
||||
DISAS_LOG("gsSPGeometryMode(");
|
||||
UCodeDisas_ParseGeometryMode(this, ~clearbits);
|
||||
UCodeDisas_PrintGeometryMode(this, ~clearbits);
|
||||
DISAS_LOG(", ");
|
||||
UCodeDisas_ParseGeometryMode(this, setbits);
|
||||
UCodeDisas_PrintGeometryMode(this, setbits);
|
||||
DISAS_LOG("),");
|
||||
}
|
||||
|
||||
|
@ -1185,7 +1031,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
|
||||
case G_MV_MATRIX: {
|
||||
DISAS_LOG("gsSPForceMatrix(0x%08x),", movemem.data);
|
||||
ptr += 1;
|
||||
ptr += 2 - 1;
|
||||
} break;
|
||||
|
||||
case G_MV_LIGHT: {
|
||||
|
@ -1200,7 +1046,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
|
||||
default: {
|
||||
DISAS_LOG("gsSPLight(0x%08x,%d),", movemem.data,
|
||||
(movemem.offset * 8 - 24) / 24);
|
||||
(movemem.offset * 8 - 0x18) / 0x18);
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
|
@ -1299,8 +1145,9 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
|||
|
||||
case G_SELECT_DL: {
|
||||
Gdma dma = ptr->dma;
|
||||
u32 dlAddr = (u32)UCodeDisas_TranslateAddr(this, (dma.len << 16) | (linkDlLow));
|
||||
u32 dmaAddr = dma.addr;
|
||||
uintptr_t dlAddr =
|
||||
(uintptr_t)UCodeDisas_TranslateAddr(this, (dma.len << 16) | (linkDlLow));
|
||||
uintptr_t dmaAddr = dma.addr;
|
||||
|
||||
if (dma.par == 0) {
|
||||
DISAS_LOG("gsSPSelectDL(0x%08x, %d, 0x%08x, 0x%08x),", dlAddr, sid, rdpHalf,
|
||||
|
|
Loading…
Reference in a new issue