summaryrefslogtreecommitdiff
path: root/src/code/ucode_disas.c
diff options
context:
space:
mode:
authorRoman971 <32455037+Roman971@users.noreply.github.com>2021-11-26 23:37:33 +0100
committerGitHub <noreply@github.com>2021-11-26 17:37:33 -0500
commit6efb59069962abeeaa2ebf1d959cd344ed2aacb9 (patch)
tree3738ef704bbf4025ef923aa66a8bb29d2883af81 /src/code/ucode_disas.c
parentc36decaf50c2deaf5010edbf73de8e0e3d725d48 (diff)
Various minor cleanups (#1029)
* Fix some disp usage in EffectSsGMagma2 * Fix some incorrect SAC flags * Remove some instances where bool was used * Fix a few line numbers to be decimal * Remove MatrixInternal and use Mtx instead * Fix gs flag names to be plural for consistency * Fix some hex numbers to be uppercase * Fix instances of 0X for hex numbers
Diffstat (limited to 'src/code/ucode_disas.c')
-rw-r--r--src/code/ucode_disas.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c
index 4af0898b0..9d5278f30 100644
--- a/src/code/ucode_disas.c
+++ b/src/code/ucode_disas.c
@@ -510,7 +510,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
} break;
case G_LOAD_UCODE: {
- if (curGfx->dma.len == 0x7ff) {
+ if (curGfx->dma.len == 0x7FF) {
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,
@@ -695,7 +695,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
case G_RDPSETOTHERMODE: {
DISAS_LOG("gsDPSetOtherMode(0x%08x, 0x%08x),", curGfx->words.w0 & 0xFFFFFF, curGfx->words.w1);
- this->modeH = curGfx->words.w0 & 0xfff;
+ this->modeH = curGfx->words.w0 & 0xFFF;
this->modeL = curGfx->words.w1;
if (this->pipeSyncRequired) {
@@ -734,8 +734,8 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
} break;
case G_SETCIMG: {
- u32 fmt = ((curGfx->words.w0 & 0xE00000) >> 0x15) & 0xff;
- u32 siz = ((curGfx->words.w0 & 0x180000) >> 0x13) & 0xff;
+ u32 fmt = ((curGfx->words.w0 & 0xE00000) >> 0x15) & 0xFF;
+ u32 siz = ((curGfx->words.w0 & 0x180000) >> 0x13) & 0xFF;
DISAS_LOG("gsDPSetColorImage(G_IM_FMT_%s, G_IM_SIZ_%s, %d, 0x%08x(0x%08x) ),",
(fmt == G_IM_FMT_RGBA)
@@ -744,7 +744,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
: (fmt == G_IM_FMT_CI) ? "CI" : (fmt == G_IM_FMT_IA) ? "IA" : "I",
(siz == G_IM_SIZ_4b) ? "4b"
: (siz == G_IM_SIZ_8b) ? "8b" : (siz == G_IM_SIZ_16b) ? "16b" : "32b",
- (curGfx->dma.len & 0xfff) + 1, curGfx->setimg.dram, addr);
+ (curGfx->dma.len & 0xFFF) + 1, curGfx->setimg.dram, addr);
if (this->pipeSyncRequired) {
DISAS_LOG("### PipeSyncが必要です。\n");
@@ -762,8 +762,8 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
} break;
case G_SETTIMG: {
- u32 fmt = ((curGfx->words.w0 & 0xE00000) >> 0x15) & 0xff;
- u32 siz = ((curGfx->words.w0 & 0x180000) >> 0x13) & 0xff;
+ u32 fmt = ((curGfx->words.w0 & 0xE00000) >> 0x15) & 0xFF;
+ u32 siz = ((curGfx->words.w0 & 0x180000) >> 0x13) & 0xFF;
DISAS_LOG("gsDPSetTextureImage(G_IM_FMT_%s, G_IM_SIZ_%s, %d, 0x%08x(0x%08x)),",
(fmt == G_IM_FMT_RGBA)
@@ -772,7 +772,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
: (fmt == G_IM_FMT_CI) ? "CI" : (fmt == G_IM_FMT_IA) ? "IA" : "I",
(siz == G_IM_SIZ_4b) ? "4b"
: (siz == G_IM_SIZ_8b) ? "8b" : (siz == G_IM_SIZ_16b) ? "16b" : "32b",
- (curGfx->dma.len & 0xfff) + 1, curGfx->setimg.dram, addr);
+ (curGfx->dma.len & 0xFFF) + 1, curGfx->setimg.dram, addr);
} break;
case G_SETENVCOLOR: {
@@ -933,39 +933,37 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
DISAS_LOG("),", gmtx.addr); /*! @bug gmtx.addr shouldn't be here*/
if (this->enableLog >= 2) {
- MtxConv_L2F(&mtx, ((MatrixInternal*)addr));
+ MtxConv_L2F(&mtx, (Mtx*)addr);
DISAS_LOG("\n");
+
/*! @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"
+ "/ %04x.%04x %04x.%04x %04x.%04x %.04x.%04x \\/ %12.6f %12.6f %12.6f %12.6f \\\n"
"| %04x.%04x %04x.%04x %04x.%04x %.04x.%04x || %12.6f %12.6f %12.6f %12.6f |\n"
"| %04x.%04x %04x.%04x %04x.%04x %.04x.%04x || %12.6f %12.6f %12.6f %12.6f |\n"
- "\\ %04x.%04x %04x.%04x %04x.%04x %.04x.%04x /\\ %12.6f %12.6f %12.6f %12.6f "
- "/\n",
- ((MatrixInternal*)addr)->intPart[0][0], ((MatrixInternal*)addr)->fracPart[0][0],
- ((MatrixInternal*)addr)->intPart[1][0], ((MatrixInternal*)addr)->fracPart[1][0],
- ((MatrixInternal*)addr)->intPart[2][0], ((MatrixInternal*)addr)->fracPart[2][0],
- ((MatrixInternal*)addr)->intPart[3][0], ((MatrixInternal*)addr)->fracPart[3][0],
+ "\\ %04x.%04x %04x.%04x %04x.%04x %.04x.%04x /\\ %12.6f %12.6f %12.6f %12.6f /\n",
+ ((Mtx*)addr)->intPart[0][0], ((Mtx*)addr)->fracPart[0][0],
+ ((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],
-
- ((MatrixInternal*)addr)->intPart[0][1], ((MatrixInternal*)addr)->fracPart[0][1],
- ((MatrixInternal*)addr)->intPart[1][1], ((MatrixInternal*)addr)->fracPart[1][1],
- ((MatrixInternal*)addr)->intPart[2][1], ((MatrixInternal*)addr)->fracPart[2][1],
- ((MatrixInternal*)addr)->intPart[3][1], ((MatrixInternal*)addr)->fracPart[3][1],
+ ((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],
-
- ((MatrixInternal*)addr)->intPart[0][2], ((MatrixInternal*)addr)->fracPart[0][2],
- ((MatrixInternal*)addr)->intPart[1][2], ((MatrixInternal*)addr)->fracPart[1][2],
- ((MatrixInternal*)addr)->intPart[2][2], ((MatrixInternal*)addr)->fracPart[2][2],
- ((MatrixInternal*)addr)->intPart[3][2], ((MatrixInternal*)addr)->fracPart[3][2],
+ ((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],
-
- ((MatrixInternal*)addr)->intPart[0][3], ((MatrixInternal*)addr)->fracPart[0][3],
- ((MatrixInternal*)addr)->intPart[1][3], ((MatrixInternal*)addr)->fracPart[1][3],
- ((MatrixInternal*)addr)->intPart[2][3], ((MatrixInternal*)addr)->fracPart[2][3],
- ((MatrixInternal*)addr)->intPart[3][3], ((MatrixInternal*)addr)->fracPart[3][3],
+ ((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]);
+ // clang-format on
}
} break;
@@ -974,7 +972,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
u32 vbidx;
numv >>= 12;
- numv &= 0xff;
+ numv &= 0xFF;
vbidx = (curGfx->vtx.vbidx >> 1) - numv;
DISAS_LOG("gsSPVertex(0x%08x(0x%08x), %d, %d),", curGfx->words.w1, addr, numv, vbidx);