diff --git a/src/graphic/Fast3D/gfx_pc.cpp b/src/graphic/Fast3D/gfx_pc.cpp index 568e1e78b..21f32c350 100644 --- a/src/graphic/Fast3D/gfx_pc.cpp +++ b/src/graphic/Fast3D/gfx_pc.cpp @@ -38,7 +38,6 @@ #include "Context.h" #include "libultraship/bridge.h" - #include uintptr_t gfxFramebuffer; @@ -3584,119 +3583,133 @@ bool gfx_spnoop_command_handler_f3dex2(F3DGfx** cmd0) { return false; } -const static std::unordered_map rdpHandlers = { - { RDP_G_TEXRECT, gfx_tex_rect_and_flip_handler_rdp }, // G_TEXRECT (-28) - { RDP_G_TEXRECTFLIP, gfx_tex_rect_and_flip_handler_rdp }, // G_TEXRECTFLIP (-27) - { RDP_G_RDPLOADSYNC, gfx_stubbed_command_handler }, // G_RDPLOADSYNC (-26) - { RDP_G_RDPPIPESYNC, gfx_stubbed_command_handler }, // G_RDPPIPESYNC (-25) - { RDP_G_RDPTILESYNC, gfx_stubbed_command_handler }, // G_RDPPIPESYNC (-24) - { RDP_G_RDPFULLSYNC, gfx_stubbed_command_handler }, // G_RDPFULLSYNC (-23) - { RDP_G_SETSCISSOR, gfx_set_scissor_handler_rdp }, // G_SETSCISSOR (-19) - { RDP_G_SETPRIMDEPTH, gfx_set_prim_depth_handler_rdp }, // G_SETPRIMDEPTH (-18) - { RDP_G_RDPSETOTHERMODE, gfx_rdp_set_other_mode_rdp }, // G_RDPSETOTHERMODE (-17) - { RDP_G_LOADTLUT, gfx_load_tlut_handler_rdp }, // G_LOADTLUT (-16) - { RDP_G_SETTILESIZE, gfx_set_tile_size_handler_rdp }, // G_SETTILESIZE (-14) - { RDP_G_LOADBLOCK, gfx_load_block_handler_rdp }, // G_LOADBLOCK (-13) - { RDP_G_LOADTILE, gfx_load_tile_handler_rdp }, // G_LOADTILE (-12) - { RDP_G_SETTILE, gfx_set_tile_handler_rdp }, // G_SETTILE (-11) - { RDP_G_FILLRECT, gfx_fill_rect_handler_rdp }, // G_FILLRECT (-10) - { RDP_G_SETFILLCOLOR, gfx_set_fill_color_handler_rdp }, // G_SETFILLCOLOR (-9) - { RDP_G_SETFOGCOLOR, gfx_set_fog_color_handler_rdp }, // G_SETFOGCOLOR (-8) - { RDP_G_SETBLENDCOLOR, gfx_set_blend_color_handler_rdp }, // G_SETBLENDCOLOR (-7) - { RDP_G_SETPRIMCOLOR, gfx_set_prim_color_handler_rdp }, // G_SETPRIMCOLOR (-6) - { RDP_G_SETENVCOLOR, gfx_set_env_color_handler_rdp }, // G_SETENVCOLOR (-5) - { RDP_G_SETCOMBINE, gfx_set_combine_handler_rdp }, // G_SETCOMBINE (-4) - { RDP_G_SETTIMG, gfx_set_timg_handler_rdp }, // G_SETTIMG (-3) - { RDP_G_SETZIMG, gfx_set_z_img_handler_rdp }, // G_SETZIMG (-2) - { RDP_G_SETCIMG, gfx_set_c_img_handler_rdp }, // G_SETCIMG (-1) +const static std::unordered_map> rdpHandlers = { + { RDP_G_TEXRECT, { "G_TEXRECT", gfx_tex_rect_and_flip_handler_rdp } }, // G_TEXRECT (-28) + { RDP_G_TEXRECTFLIP, { "G_TEXRECTFLIP", gfx_tex_rect_and_flip_handler_rdp } }, // G_TEXRECTFLIP (-27) + { RDP_G_RDPLOADSYNC, { "G_RDPLOADSYNC", gfx_stubbed_command_handler } }, // G_RDPLOADSYNC (-26) + { RDP_G_RDPPIPESYNC, { "G_RDPPIPESYNC", gfx_stubbed_command_handler } }, // G_RDPPIPESYNC (-25) + { RDP_G_RDPTILESYNC, { "G_RDPTILESYNC", gfx_stubbed_command_handler } }, // G_RDPPIPESYNC (-24) + { RDP_G_RDPFULLSYNC, { "G_RDPFULLSYNC", gfx_stubbed_command_handler } }, // G_RDPFULLSYNC (-23) + { RDP_G_SETSCISSOR, { "G_SETSCISSOR", gfx_set_scissor_handler_rdp } }, // G_SETSCISSOR (-19) + { RDP_G_SETPRIMDEPTH, { "G_SETPRIMDEPTH", gfx_set_prim_depth_handler_rdp } }, // G_SETPRIMDEPTH (-18) + { RDP_G_RDPSETOTHERMODE, { "G_RDPSETOTHERMODE", gfx_rdp_set_other_mode_rdp } }, // G_RDPSETOTHERMODE (-17) + { RDP_G_LOADTLUT, { "G_LOADTLUT", gfx_load_tlut_handler_rdp } }, // G_LOADTLUT (-16) + { RDP_G_SETTILESIZE, { "G_SETTILESIZE", gfx_set_tile_size_handler_rdp } }, // G_SETTILESIZE (-14) + { RDP_G_LOADBLOCK, { "G_LOADBLOCK", gfx_load_block_handler_rdp } }, // G_LOADBLOCK (-13) + { RDP_G_LOADTILE, { "G_LOADTILE", gfx_load_tile_handler_rdp } }, // G_LOADTILE (-12) + { RDP_G_SETTILE, { "G_SETTILE", gfx_set_tile_handler_rdp } }, // G_SETTILE (-11) + { RDP_G_FILLRECT, { "G_FILLRECT", gfx_fill_rect_handler_rdp } }, // G_FILLRECT (-10) + { RDP_G_SETFILLCOLOR, { "G_SETFILLCOLOR", gfx_set_fill_color_handler_rdp } }, // G_SETFILLCOLOR (-9) + { RDP_G_SETFOGCOLOR, { "G_SETFOGCOLOR", gfx_set_fog_color_handler_rdp } }, // G_SETFOGCOLOR (-8) + { RDP_G_SETBLENDCOLOR, { "G_SETBLENDCOLOR", gfx_set_blend_color_handler_rdp } }, // G_SETBLENDCOLOR (-7) + { RDP_G_SETPRIMCOLOR, { "G_SETPRIMCOLOR", gfx_set_prim_color_handler_rdp } }, // G_SETPRIMCOLOR (-6) + { RDP_G_SETENVCOLOR, { "G_SETENVCOLOR", gfx_set_env_color_handler_rdp } }, // G_SETENVCOLOR (-5) + { RDP_G_SETCOMBINE, { "G_SETCOMBINE", gfx_set_combine_handler_rdp } }, // G_SETCOMBINE (-4) + { RDP_G_SETTIMG, { "G_SETTIMG", gfx_set_timg_handler_rdp } }, // G_SETTIMG (-3) + { RDP_G_SETZIMG, { "G_SETZIMG", gfx_set_z_img_handler_rdp } }, // G_SETZIMG (-2) + { RDP_G_SETCIMG, { "G_SETCIMG", gfx_set_c_img_handler_rdp } }, // G_SETCIMG (-1) }; -const static std::unordered_map otrHandlers = { - { OTR_G_SETTIMG_OTR_HASH, gfx_set_timg_otr_hash_handler_custom }, // G_SETTIMG_OTR_HASH (0x20) - { OTR_G_SETFB, gfx_set_fb_handler_custom }, // G_SETFB (0x21) - { OTR_G_RESETFB, gfx_reset_fb_handler_custom }, // G_RESETFB (0x22) - { OTR_G_SETTIMG_FB, gfx_set_timg_fb_handler_custom }, // G_SETTIMG_FB (0x23) - { OTR_G_VTX_OTR_FILEPATH, gfx_vtx_otr_filepath_handler_custom }, // G_VTX_OTR_FILEPATH (0x24) - { OTR_G_SETTIMG_OTR_FILEPATH, gfx_set_timg_otr_filepath_handler_custom }, // G_SETTIMG_OTR_FILEPATH (0x25) - { OTR_G_TRI1_OTR, gfx_tri1_otr_handler_f3dex2 }, // G_TRI1_OTR (0x26) - { OTR_G_DL_OTR_FILEPATH, gfx_dl_otr_filepath_handler_custom }, // G_DL_OTR_FILEPATH (0x27) - { OTR_G_PUSHCD, gfx_pushcd_handler_custom }, // G_PUSHCD (0x28) - { OTR_G_DL_OTR_HASH, gfx_dl_otr_hash_handler_custom }, // G_DL_OTR_HASH (0x31) - { OTR_G_VTX_OTR_HASH, gfx_vtx_hash_handler_custom }, // G_VTX_OTR_HASH (0x32) - { OTR_G_MARKER, gfx_marker_handler_otr }, // G_MARKER (0X33) - { OTR_G_INVALTEXCACHE, gfx_invalidate_tex_cache_handler_f3dex2 }, // G_INVALTEXCACHE (0X34) - { OTR_G_BRANCH_Z_OTR, gfx_branch_z_otr_handler_f3dex2 }, // G_BRANCH_Z_OTR (0x35) +const static std::unordered_map> otrHandlers = { + { OTR_G_SETTIMG_OTR_HASH, + { "G_SETTIMG_OTR_HASH", gfx_set_timg_otr_hash_handler_custom } }, // G_SETTIMG_OTR_HASH (0x20) + { OTR_G_SETFB, { "G_SETFB", gfx_set_fb_handler_custom } }, // G_SETFB (0x21) + { OTR_G_RESETFB, { "G_RESETFB", gfx_reset_fb_handler_custom } }, // G_RESETFB (0x22) + { OTR_G_SETTIMG_FB, { "G_SETTIMG_FB", gfx_set_timg_fb_handler_custom } }, // G_SETTIMG_FB (0x23) + { OTR_G_VTX_OTR_FILEPATH, + { "G_VTX_OTR_FILEPATH", gfx_vtx_otr_filepath_handler_custom } }, // G_VTX_OTR_FILEPATH (0x24) + { OTR_G_SETTIMG_OTR_FILEPATH, + { "G_SETTIMG_OTR_FILEPATH", gfx_set_timg_otr_filepath_handler_custom } }, // G_SETTIMG_OTR_FILEPATH (0x25) + { OTR_G_TRI1_OTR, { "G_TRI1_OTR", gfx_tri1_otr_handler_f3dex2 } }, // G_TRI1_OTR (0x26) + { OTR_G_DL_OTR_FILEPATH, { "G_DL_OTR_FILEPATH", gfx_dl_otr_filepath_handler_custom } }, // G_DL_OTR_FILEPATH (0x27) + { OTR_G_PUSHCD, { "G_PUSHCD", gfx_pushcd_handler_custom } }, // G_PUSHCD (0x28) + { OTR_G_DL_OTR_HASH, { "G_DL_OTR_HASH", gfx_dl_otr_hash_handler_custom } }, // G_DL_OTR_HASH (0x31) + { OTR_G_VTX_OTR_HASH, { "G_VTX_OTR_HASH", gfx_vtx_hash_handler_custom } }, // G_VTX_OTR_HASH (0x32) + { OTR_G_MARKER, { "G_MARKER", gfx_marker_handler_otr } }, // G_MARKER (0X33) + { OTR_G_INVALTEXCACHE, { "G_INVALTEXCACHE", gfx_invalidate_tex_cache_handler_f3dex2 } }, // G_INVALTEXCACHE (0X34) + { OTR_G_BRANCH_Z_OTR, { "G_BRANCH_Z_OTR", gfx_branch_z_otr_handler_f3dex2 } }, // G_BRANCH_Z_OTR (0x35) #ifdef F3DEX_GBI_2 - { OTR_G_MTX_OTR, gfx_mtx_otr_handler_custom_f3dex2 }, // G_MTX_OTR (0x36) + { OTR_G_MTX_OTR, { "G_MTX_OTR", gfx_mtx_otr_handler_custom_f3dex2 } }, // G_MTX_OTR (0x36) #else - { OTR_G_MTX_OTR2, gfx_mtx_otr_handler_custom_f3d }, //G_MTX_OTR2 (0x29) Is this the right code? + { OTR_G_MTX_OTR2, { "G_MTX_OTR2", gfx_mtx_otr_handler_custom_f3d } }, // G_MTX_OTR2 (0x29) Is this the right code? #endif - { OTR_G_TEXRECT_WIDE, gfx_tex_rect_wide_handler_custom }, // G_TEXRECT_WIDE (0x37) - { OTR_G_FILLWIDERECT, gfx_fill_wide_rect_handler_custom }, // G_FILLWIDERECT (0x38) - { OTR_G_SETGRAYSCALE, gfx_set_grayscale_handler_custom }, // G_SETGRAYSCALE (0x39) - { OTR_G_EXTRAGEOMETRYMODE, gfx_extra_geometry_mode_handler_custom }, // G_EXTRAGEOMETRYMODE (0x3a) - { OTR_G_COPYFB, gfx_copy_fb_handler_custom }, // G_COPYFB (0x3b) - { OTR_G_IMAGERECT, gfx_image_rect_handler_custom }, // G_IMAGERECT (0x3c) - { OTR_G_DL_INDEX, gfx_dl_index_handler }, // G_DL_INDEX (0x3d) - { OTR_G_READFB, gfx_read_fb_handler_custom }, // G_READFB (0x3e) - { OTR_G_SETINTENSITY, gfx_set_intensity_handler_custom }, // G_SETINTENSITY (0x40) + { OTR_G_TEXRECT_WIDE, { "G_TEXRECT_WIDE", gfx_tex_rect_wide_handler_custom } }, // G_TEXRECT_WIDE (0x37) + { OTR_G_FILLWIDERECT, { "G_FILLWIDERECT", gfx_fill_wide_rect_handler_custom } }, // G_FILLWIDERECT (0x38) + { OTR_G_SETGRAYSCALE, { "G_SETGRAYSCALE", gfx_set_grayscale_handler_custom } }, // G_SETGRAYSCALE (0x39) + { OTR_G_EXTRAGEOMETRYMODE, + { "G_EXTRAGEOMETRYMODE", gfx_extra_geometry_mode_handler_custom } }, // G_EXTRAGEOMETRYMODE (0x3a) + { OTR_G_COPYFB, { "G_COPYFB", gfx_copy_fb_handler_custom } }, // G_COPYFB (0x3b) + { OTR_G_IMAGERECT, { "G_IMAGERECT", gfx_image_rect_handler_custom } }, // G_IMAGERECT (0x3c) + { OTR_G_DL_INDEX, { "G_DL_INDEX", gfx_dl_index_handler } }, // G_DL_INDEX (0x3d) + { OTR_G_READFB, { "G_READFB", gfx_read_fb_handler_custom } }, // G_READFB (0x3e) + { OTR_G_SETINTENSITY, { "G_SETINTENSITY", gfx_set_intensity_handler_custom } }, // G_SETINTENSITY (0x40) }; -const static std::unordered_map f3dex2Handlers = { - { F3DEX2_G_NOOP, gfx_noop_handler_f3dex2 }, - { F3DEX2_G_CULLDL, gfx_cull_dl_handler_f3dex2 }, - { F3DEX2_G_MTX, gfx_mtx_handler_f3dex2 }, - { F3DEX2_G_POPMTX, gfx_pop_mtx_handler_f3dex2 }, +const static std::unordered_map> f3dex2Handlers = { + { F3DEX2_G_NOOP, { "G_NOOP", gfx_noop_handler_f3dex2 } }, + { F3DEX2_G_CULLDL, { "G_CULLDL", gfx_cull_dl_handler_f3dex2 } }, + { F3DEX2_G_MTX, { "G_MTX", gfx_mtx_handler_f3dex2 } }, + { F3DEX2_G_POPMTX, { "G_POPMTX", gfx_pop_mtx_handler_f3dex2 } }, #ifdef F3DEX_GBI_2 - { F3DEX2_G_MOVEMEM, gfx_movemem_handler_f3dex2 }, - { F3DEX2_G_MOVEWORD, gfx_moveword_handler_f3dex2 }, + { F3DEX2_G_MOVEMEM, { "G_MOVEMEM", gfx_movemem_handler_f3dex2 } }, + { F3DEX2_G_MOVEWORD, { "G_MOVEWORD", gfx_moveword_handler_f3dex2 } }, #else - { G_MOVEMEM, gfx_movemem_handler_f3d }, - { G_MOVEWORD, gfx_moveword_handler_f3d }, + { G_MOVEMEM, { "G_MOVEMEM", gfx_movemem_handler_f3d } }, + { G_MOVEWORD, { "G_MOVEWORD", gfx_moveword_handler_f3d } }, #endif - { F3DEX2_G_TEXTURE, gfx_texture_handler_f3dex2 }, - { F3DEX2_G_VTX, gfx_vtx_handler_f3dex2 }, - { F3DEX2_G_MODIFYVTX, gfx_modify_vtx_handler_f3dex2 }, - { F3DEX2_G_DL, gfx_dl_handler_common }, - { F3DEX2_G_ENDDL, gfx_end_dl_handler_common }, + { F3DEX2_G_TEXTURE, { "G_TEXTURE", gfx_texture_handler_f3dex2 } }, + { F3DEX2_G_VTX, { "G_VTX", gfx_vtx_handler_f3dex2 } }, + { F3DEX2_G_MODIFYVTX, { "G_MODIFYVTX", gfx_modify_vtx_handler_f3dex2 } }, + { F3DEX2_G_DL, { "G_DL", gfx_dl_handler_common } }, + { F3DEX2_G_ENDDL, { "G_ENDDL", gfx_end_dl_handler_common } }, #ifdef F3DEX_GBI_2 - { F3DEX2_G_GEOMETRYMODE, gfx_geometry_mode_handler_f3dex2 }, + { F3DEX2_G_GEOMETRYMODE, { "G_GEOMETRYMODE", gfx_geometry_mode_handler_f3dex2 } }, #else - { G_SETGEOMETRYMODE, gfx_set_geometry_mode_handler_f3d }, - { G_CLEARGEOMETRYMODE, gfx_clear_geometry_mode_handler_f3d }, + { G_SETGEOMETRYMODE, { "G_SETGEOMETRYMODE", gfx_set_geometry_mode_handler_f3d } }, + { G_CLEARGEOMETRYMODE, { "G_CLEARGEOMETRYMODE", gfx_clear_geometry_mode_handler_f3d } }, #endif - { F3DEX2_G_TRI1, gfx_tri1_handler_f3dex2 }, - { F3DEX2_G_TRI2, gfx_tri2_handler_f3dex }, - { F3DEX2_G_QUAD, gfx_quad_handler_f3dex2 }, - { F3DEX2_G_SETOTHERMODE_L, gfx_othermode_l_handler_f3dex2 }, - { F3DEX2_G_SETOTHERMODE_H, gfx_othermode_h_handler_f3dex2 }, + { F3DEX2_G_TRI1, { "G_TRI1", gfx_tri1_handler_f3dex2 } }, + { F3DEX2_G_TRI2, { "G_TRI2", gfx_tri2_handler_f3dex } }, + { F3DEX2_G_QUAD, { "G_QUAD", gfx_quad_handler_f3dex2 } }, + { F3DEX2_G_SETOTHERMODE_L, { "G_SETOTHERMODE_L", gfx_othermode_l_handler_f3dex2 } }, + { F3DEX2_G_SETOTHERMODE_H, { "G_SETOTHERMODE_H", gfx_othermode_h_handler_f3dex2 } }, // Commands to implement - { F3DEX2_G_SPNOOP, gfx_spnoop_command_handler_f3dex2 }, - { F3DEX2_G_RDPHALF_1, gfx_stubbed_command_handler }, }; // LUSTODO figure out how to deal with non f3dex2. It seems that the opcode numbers are different. // Are the actual implementations different? -const static std::unordered_map s2dexHandlers = { - { S2DEX_G_BG_COPY, gfx_bg_copy_handler_s2dex }, - { S2DEX_G_BG_1CYC, gfx_bg_1cyc_handler_s2dex }, - { S2DEX_G_OBJ_RENDERMODE, gfx_stubbed_command_handler }, - { S2DEX_G_OBJ_RECTANGLE_R, gfx_stubbed_command_handler }, - { S2DEX_G_OBJ_RECTANGLE, gfx_obj_rectangle_handler_s2dex }, - { F3DEX2_G_DL, gfx_dl_handler_common }, - //{ G_SETOTHERMODE_L, gfx_othermode_l_handler_f3dex2 }, - //{ G_SETOTHERMODE_H, gfx_othermode_h_handler_f3dex2 }, - { F3DEX2_G_ENDDL, gfx_end_dl_handler_common }, - { F3DEX2_G_RDPHALF_1, gfx_stubbed_command_handler }, - { F3DEX2_G_RDPHALF_2, gfx_stubbed_command_handler }, +const static std::unordered_map> s2dexHandlers = { + { S2DEX_G_BG_COPY, { "G_BG_COPY", gfx_bg_copy_handler_s2dex } }, + { S2DEX_G_BG_1CYC, { "G_BG_1CYC", gfx_bg_1cyc_handler_s2dex } }, + { S2DEX_G_OBJ_RENDERMODE, { "G_OBJ_RENDERMODE", gfx_stubbed_command_handler } }, + { S2DEX_G_OBJ_RECTANGLE_R, { "G_OBJ_RECTANGLE_R", gfx_stubbed_command_handler } }, + { S2DEX_G_OBJ_RECTANGLE, { "G_OBJ_RECTANGLE", gfx_obj_rectangle_handler_s2dex } }, + { F3DEX2_G_DL, { "G_DL", gfx_dl_handler_common } }, + { F3DEX2_G_ENDDL, { "G_ENDDL", gfx_end_dl_handler_common } }, }; -const static std::array*, UcodeHandlers::ucode_max> +const static std::array>*, + UcodeHandlers::ucode_max> ucode_handlers = { &f3dex2Handlers, &s2dexHandlers, }; +const char* GfxGetOpcodeName(int8_t opcode) { + if (otrHandlers.contains(opcode)) { + return otrHandlers.at(opcode).first; + } else if (rdpHandlers.contains(opcode)) { + return rdpHandlers.at(opcode).first; + } else if (ucode_handler_index < ucode_handlers.size()) { + if (ucode_handlers[ucode_handler_index]->contains(opcode)) { + return ucode_handlers[ucode_handler_index]->at(opcode).first; + } else { + SPDLOG_CRITICAL("Unhandled OP code: {}, for loaded ucode: {}", opcode, (uint32_t)ucode_handler_index); + return nullptr; + } + } +} + // TODO, implement a system where we can get the current opcode handler by writing to the GWords. If the powers that be // are OK with that... static void gfx_set_ucode_handler(UcodeHandlers ucode) { @@ -3718,16 +3731,16 @@ static void gfx_step() { } if (otrHandlers.contains(opcode)) { - if (otrHandlers.at(opcode)(&cmd)) { + if (otrHandlers.at(opcode).second(&cmd)) { return; } } else if (rdpHandlers.contains(opcode)) { - if (rdpHandlers.at(opcode)(&cmd)) { + if (rdpHandlers.at(opcode).second(&cmd)) { return; } } else if (ucode_handler_index < ucode_handlers.size()) { if (ucode_handlers[ucode_handler_index]->contains(opcode)) { - if (ucode_handlers[ucode_handler_index]->at(opcode)(&cmd)) { + if (ucode_handlers[ucode_handler_index]->at(opcode).second(&cmd)) { return; } } else { diff --git a/src/graphic/Fast3D/gfx_pc.h b/src/graphic/Fast3D/gfx_pc.h index 912b9f35f..2ee9e10d8 100644 --- a/src/graphic/Fast3D/gfx_pc.h +++ b/src/graphic/Fast3D/gfx_pc.h @@ -233,5 +233,6 @@ void gfx_push_current_dir(char* path); int32_t gfx_check_image_signature(const char* imgData); void gfx_register_blended_texture(const char* name, uint8_t* mask, uint8_t* replacement = nullptr); void gfx_unregister_blended_texture(const char* name); +const char* GfxGetOpcodeName(int8_t opcode); #endif diff --git a/src/graphic/Fast3D/lus_gbi.h b/src/graphic/Fast3D/lus_gbi.h index 72de01b70..727e4a0fa 100644 --- a/src/graphic/Fast3D/lus_gbi.h +++ b/src/graphic/Fast3D/lus_gbi.h @@ -50,7 +50,7 @@ constexpr int8_t F3DEX2_G_QUAD = 0x07; #define G_SPNOOP 0 /* handle 0 gracefully */ #define G_MTX 1 #define G_RESERVED0 2 /* not implemeted */ -constexpr int8_t G_MOVEMEM 3 /* move a block of memory (up to 4 words) to dmem */ +constexpr int8_t G_MOVEMEM 3 /* move a block of memory (up to 4 words) to dmem */ #define G_VTX 4 #define G_RESERVED1 5 /* not implemeted */ #define G_DL 6 @@ -63,7 +63,7 @@ constexpr int8_t G_MOVEMEM 3 /* move a block of memory (up to 4 words) to dmem #define G_TRI1 (G_IMMFIRST - 0) #define G_CULLDL (G_IMMFIRST - 1) #define G_POPMTX (G_IMMFIRST - 2) -constexpr int8_t G_MOVEWORD = (G_IMMFIRST - 3); + constexpr int8_t G_MOVEWORD = (G_IMMFIRST - 3); #define G_TEXTURE (G_IMMFIRST - 4) #define G_SETOTHERMODE_H (G_IMMFIRST - 5) #define G_SETOTHERMODE_L (G_IMMFIRST - 6) @@ -97,7 +97,7 @@ constexpr int8_t G_CLEARGEOMETRYMODE - (G_IMMFIRST - 9); constexpr int8_t RDP_G_SETCIMG = 0xff; /* -1 */ constexpr int8_t RDP_G_SETZIMG = 0xfe; /* -2 */ constexpr int8_t RDP_G_SETTIMG = 0xfd; /* -3 */ -constexpr int8_t RDP_G_SETCOMBINE= 0xfc; /* -4 */ +constexpr int8_t RDP_G_SETCOMBINE = 0xfc; /* -4 */ constexpr int8_t RDP_G_SETENVCOLOR = 0xfb; /* -5 */ constexpr int8_t RDP_G_SETPRIMCOLOR = 0xfa; /* -6 */ constexpr int8_t RDP_G_SETBLENDCOLOR = 0xf9; /* -7 */ @@ -242,7 +242,7 @@ constexpr int8_t OTR_G_SETINTENSITY = 0x40; */ #define G_MAXFBZ 0x3fff /* 3b exp, 11b mantissa */ -#define GPACK_RGBA5551(r, g, b, a) ((((r) << 8) & 0xf800) | (((g) << 3) & 0x7c0) | (((b) >> 2) & 0x3e) | ((a) & 0x1)) +#define GPACK_RGBA5551(r, g, b, a) ((((r) << 8) & 0xf800) | (((g) << 3) & 0x7c0) | (((b) >> 2) & 0x3e) | ((a)&0x1)) #define GPACK_ZDZ(z, dz) ((z) << 2 | (dz)) /* @@ -387,7 +387,6 @@ constexpr int8_t OTR_G_SETINTENSITY = 0x40; #define G_TX_NOMASK 0 #define G_TX_NOLOD 0 - /* * G_SETCOMBINE: color combine modes */ @@ -1332,7 +1331,7 @@ static_assert(sizeof(F3DGwords) == 2 * sizeof(void*), "Display list size is bad" * This union is the fundamental type of the display list. * It is, by law, exactly 64 bits in size. */ -typedef union F3DGfx{ +typedef union F3DGfx { F3DGwords words; long long int force_structure_alignment; } F3DGfx; @@ -1381,20 +1380,20 @@ constexpr int8_t S2DEX_G_OBJ_RENDERMODE = 0x0b; typedef struct { unsigned short imageX; /* x-coordinate of upper-left position of texture (u10.5) */ unsigned short imageW; /* width of the texture (u10.2) */ - short frameX; /* upper-left position of transferred frame (s10.2) */ + short frameX; /* upper-left position of transferred frame (s10.2) */ unsigned short frameW; /* width of transferred frame (u10.2) */ unsigned short imageY; /* y-coordinate of upper-left position of texture (u10.5) */ unsigned short imageH; /* height of the texture (u10.2) */ - short frameY; /* upper-left position of transferred frame (s10.2) */ + short frameY; /* upper-left position of transferred frame (s10.2) */ unsigned short frameH; /* height of transferred frame (u10.2) */ unsigned long long int* imagePtr; /* texture source address on DRAM */ - unsigned short imageLoad; /* which to use, LoadBlock or LoadTile */ - unsigned char imageFmt; /* format of texel - G_IM_FMT_* */ - unsigned char imageSiz; /* size of texel - G_IM_SIZ_* */ - unsigned short imagePal; /* pallet number */ - unsigned short imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */ + unsigned short imageLoad; /* which to use, LoadBlock or LoadTile */ + unsigned char imageFmt; /* format of texel - G_IM_FMT_* */ + unsigned char imageSiz; /* size of texel - G_IM_SIZ_* */ + unsigned short imagePal; /* pallet number */ + unsigned short imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */ /* The following is set in the initialization routine guS2DInitBg(). There is no need for the user to set it. */ unsigned short tmemW; /* TMEM width and Word size of frame 1 line. @@ -1414,30 +1413,30 @@ typedef struct { At LoadTile, GS_PIX2TMEM(imageW/4,imageSiz)*2 */ unsigned short tmemSize; /* skip value of imagePtr for 1-loading = tmemSizeW*tmemH */ -} F3DuObjBg_t; /* 40 bytes */ +} F3DuObjBg_t; /* 40 bytes */ /* Scalable background plane */ typedef struct { unsigned short imageX; /* x-coordinate of upper-left position of texture (u10.5) */ unsigned short imageW; /* width of texture (u10.2) */ - short frameX; /* upper-left position of transferred frame (s10.2) */ + short frameX; /* upper-left position of transferred frame (s10.2) */ unsigned short frameW; /* width of transferred frame (u10.2) */ unsigned short imageY; /* y-coordinate of upper-left position of texture (u10.5) */ unsigned short imageH; /* height of texture (u10.2) */ - short frameY; /* upper-left position of transferred frame (s10.2) */ + short frameY; /* upper-left position of transferred frame (s10.2) */ unsigned short frameH; /* height of transferred frame (u10.2) */ unsigned long long int* imagePtr; /* texture source address on DRAM */ - unsigned short imageLoad; /* Which to use, LoadBlock or LoadTile? */ - unsigned char imageFmt; /* format of texel - G_IM_FMT_* */ - unsigned char imageSiz; /* size of texel - G_IM_SIZ_* */ - unsigned short imagePal; /* pallet number */ - unsigned short imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */ + unsigned short imageLoad; /* Which to use, LoadBlock or LoadTile? */ + unsigned char imageFmt; /* format of texel - G_IM_FMT_* */ + unsigned char imageSiz; /* size of texel - G_IM_SIZ_* */ + unsigned short imagePal; /* pallet number */ + unsigned short imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */ - unsigned short scaleW; /* scale value of X-direction (u5.10) */ - unsigned short scaleH; /* scale value of Y-direction (u5.10) */ - int imageYorig; /* start point of drawing on image (s20.5) */ + unsigned short scaleW; /* scale value of X-direction (u5.10) */ + unsigned short scaleH; /* scale value of Y-direction (u5.10) */ + int imageYorig; /* start point of drawing on image (s20.5) */ unsigned char padding[4]; @@ -1456,11 +1455,11 @@ typedef union { #define G_OBJ_FLAG_FLIPT 1 << 4 /* nversion to T-direction */ typedef struct { - short objX; /* s10.2 OBJ x-coordinate of upper-left end */ + short objX; /* s10.2 OBJ x-coordinate of upper-left end */ unsigned short scaleW; /* u5.10 Scaling of u5.10 width direction */ unsigned short imageW; /* u10.5 width of u10.5 texture (length of S-direction) */ unsigned short paddingX; /* Unused - Always 0 */ - short objY; /* s10.2 OBJ y-coordinate of s10.2 OBJ upper-left end */ + short objY; /* s10.2 OBJ y-coordinate of s10.2 OBJ upper-left end */ unsigned short scaleH; /* u5.10 Scaling of u5.10 height direction */ unsigned short imageH; /* u10.5 height of u10.5 texture (length of T-direction) */ unsigned short paddingY; /* Unused - Always 0 */ @@ -1470,7 +1469,7 @@ typedef struct { unsigned char imageSiz; /* size of texel - G_IM_SIZ_* */ unsigned char imagePal; /* pallet number (0-7) */ unsigned char imageFlags; /* The display flag - G_OBJ_FLAG_FLIP* */ -} F3DuObjSprite_t; /* 24 bytes */ +} F3DuObjSprite_t; /* 24 bytes */ typedef union { F3DuObjSprite_t s; @@ -1481,11 +1480,11 @@ typedef union { * 2D Matrix *---------------------------------------------------------------------------*/ typedef struct { - int A, B, C, D; /* s15.16 */ - short X, Y; /* s10.2 */ + int A, B, C, D; /* s15.16 */ + short X, Y; /* s10.2 */ unsigned short BaseScaleX; /* u5.10 */ unsigned short BaseScaleY; /* u5.10 */ -} F3DuObjMtx_t; /* 24 bytes */ +} F3DuObjMtx_t; /* 24 bytes */ typedef union { F3DuObjMtx_t m; @@ -1493,10 +1492,10 @@ typedef union { } F3DuObjMtx; typedef struct { - short X, Y; /* s10.2 */ + short X, Y; /* s10.2 */ unsigned short BaseScaleX; /* u5.10 */ unsigned short BaseScaleY; /* u5.10 */ -} F3DuObjSubMtx_t; /* 8 bytes */ +} F3DuObjSubMtx_t; /* 8 bytes */ typedef union { F3DuObjSubMtx_t m; @@ -1514,43 +1513,43 @@ typedef union { #define GS_TB_TLINE(pix, siz) (GS_CALC_DXT(GS_PIX2TMEM((pix), (siz)))) typedef struct { - unsigned int type; /* G_OBJLT_TXTRBLOCK divided into types */ - unsigned long long int* image; /* texture source address on DRAM */ - unsigned short tmem; /* loaded TMEM word address (8byteWORD) */ - unsigned short tsize; /* Texture size, Specified by macro GS_TB_TSIZE() */ - unsigned short tline; /* width of Texture 1-line, Specified by macro GS_TB_TLINE() */ - unsigned short sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */ - unsigned int flag; /* STATE flag */ - unsigned int mask; /* STATE mask */ -} F3DuObjTxtrBlock_t; /* 24 bytes */ + unsigned int type; /* G_OBJLT_TXTRBLOCK divided into types */ + unsigned long long int* image; /* texture source address on DRAM */ + unsigned short tmem; /* loaded TMEM word address (8byteWORD) */ + unsigned short tsize; /* Texture size, Specified by macro GS_TB_TSIZE() */ + unsigned short tline; /* width of Texture 1-line, Specified by macro GS_TB_TLINE() */ + unsigned short sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */ + unsigned int flag; /* STATE flag */ + unsigned int mask; /* STATE mask */ +} F3DuObjTxtrBlock_t; /* 24 bytes */ #define GS_TT_TWIDTH(pix, siz) ((GS_PIX2TMEM((pix), (siz)) << 2) - 1) #define GS_TT_THEIGHT(pix, siz) (((pix) << 2) - 1) typedef struct { - unsigned int type; /* G_OBJLT_TXTRTILE divided into types */ - unsigned long long int* image; /* texture source address on DRAM */ - unsigned short tmem; /* loaded TMEM word address (8byteWORD)*/ - unsigned short twidth; /* width of Texture (Specified by macro GS_TT_TWIDTH()) */ - unsigned short theight; /* height of Texture (Specified by macro GS_TT_THEIGHT()) */ - unsigned short sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */ - unsigned int flag; /* STATE flag */ - unsigned int mask; /* STATE mask */ -} F3DuObjTxtrTile_t; /* 24 bytes */ + unsigned int type; /* G_OBJLT_TXTRTILE divided into types */ + unsigned long long int* image; /* texture source address on DRAM */ + unsigned short tmem; /* loaded TMEM word address (8byteWORD)*/ + unsigned short twidth; /* width of Texture (Specified by macro GS_TT_TWIDTH()) */ + unsigned short theight; /* height of Texture (Specified by macro GS_TT_THEIGHT()) */ + unsigned short sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */ + unsigned int flag; /* STATE flag */ + unsigned int mask; /* STATE mask */ +} F3DuObjTxtrTile_t; /* 24 bytes */ #define GS_PAL_HEAD(head) ((head) + 256) #define GS_PAL_NUM(num) ((num)-1) typedef struct { - unsigned int type; /* G_OBJLT_TLUT divided into types */ - unsigned long long int* image; /* texture source address on DRAM */ - unsigned short phead; /* pallet number of load header (Between 256 and 511) */ - unsigned short pnum; /* loading pallet number -1 */ - unsigned short zero; /* Assign 0 all the time */ - unsigned short sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12)*/ - unsigned int flag; /* STATE flag */ - unsigned int mask; /* STATE mask */ -} F3DuObjTxtrTLUT_t; /* 24 bytes */ + unsigned int type; /* G_OBJLT_TLUT divided into types */ + unsigned long long int* image; /* texture source address on DRAM */ + unsigned short phead; /* pallet number of load header (Between 256 and 511) */ + unsigned short pnum; /* loading pallet number -1 */ + unsigned short zero; /* Assign 0 all the time */ + unsigned short sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12)*/ + unsigned int flag; /* STATE flag */ + unsigned int mask; /* STATE mask */ +} F3DuObjTxtrTLUT_t; /* 24 bytes */ typedef union { F3DuObjTxtrBlock_t block; @@ -1567,5 +1566,4 @@ typedef struct { F3DuObjSprite sprite; } F3DuObjTxSprite; /* 48 bytes */ - #endif diff --git a/src/resource/factory/DisplayListFactory.cpp b/src/resource/factory/DisplayListFactory.cpp index fc65792d0..342ae99a1 100644 --- a/src/resource/factory/DisplayListFactory.cpp +++ b/src/resource/factory/DisplayListFactory.cpp @@ -13,7 +13,6 @@ typedef union { long long int forc_structure_alignment; } Mtx; - #define G_IM_FMT_RGBA 0 #define G_IM_FMT_YUV 1 #define G_IM_FMT_CI 2 @@ -72,14 +71,14 @@ typedef union { #define G_TX_DXT_FRAC 11 - #define ARRAY_COUNT(arr) (int)(sizeof(arr) / sizeof(arr[0])) -#define NUML(n) ((n) * 24) +#define NUML(n) ((n)*24) #define _SHIFTL(v, s, w) ((unsigned int)(((unsigned int)(v) & ((0x01 << (w)) - 1)) << (s))) #define _SHIFTR(v, s, w) ((unsigned int)(((unsigned int)(v) >> (s)) & ((0x01 << (w)) - 1))) #define G_TX_LDBLK_MAX_TXL 4095 -#define gsDPNoParam(cmd) { _SHIFTL(cmd, 24, 8), 0 } +#define gsDPNoParam(cmd) \ + { _SHIFTL(cmd, 24, 8), 0 } #define gsDPFullSync() gsDPNoParam(G_RDPFULLSYNC) #define gsDPTileSync() gsDPNoParam(G_RDPTILESYNC) #define gsDPPipeSync() gsDPNoParam(G_RDPPIPESYNC) @@ -122,7 +121,8 @@ typedef union { #define gsMoveWd(index, offset, data) gsDma1p(G_MOVEWORD, data, offset, index) -#define gsDPSetColor(c, d) { _SHIFTL(c, 24, 8), (unsigned int)(d) } +#define gsDPSetColor(c, d) \ + { _SHIFTL(c, 24, 8), (unsigned int)(d) } #define DPRGBColor(pkt, cmd, r, g, b, a) \ gDPSetColor(pkt, cmd, (_SHIFTL(r, 24, 8) | _SHIFTL(g, 16, 8) | _SHIFTL(b, 8, 8) | _SHIFTL(a, 0, 8))) @@ -140,14 +140,15 @@ typedef union { #define gsDPSetFillColor(d) gsDPSetColor(G_SETFILLCOLOR, (d)) #define gDPSetPrimDepth(pkt, z, dz) gDPSetColor(pkt, G_SETPRIMDEPTH, _SHIFTL(z, 16, 16) | _SHIFTL(dz, 0, 16)) #define gsDPSetPrimDepth(z, dz) gsDPSetColor(G_SETPRIMDEPTH, _SHIFTL(z, 16, 16) | _SHIFTL(dz, 0, 16)) -#define gsSPGrayscale(state) { (_SHIFTL(G_SETGRAYSCALE, 24, 8)), (state) } +#define gsSPGrayscale(state) \ + { (_SHIFTL(G_SETGRAYSCALE, 24, 8)), (state) } #define gDPSetBlendMask(pkt, mask) gDPNoOp(pkt) #define gsDPSetBlendMask(mask) gsDPNoOp() #define gSPSetOtherMode(pkt, cmd, sft, len, data) \ _DW({ \ - F3DGfx* _g = (F3DGfx*)(pkt); \ + F3DGfx* _g = (F3DGfx*)(pkt); \ _g->words.w0 = (_SHIFTL(cmd, 24, 8) | _SHIFTL(32 - (sft) - (len), 8, 8) | _SHIFTL((len)-1, 0, 8)); \ _g->words.w1 = (unsigned int)(data); \ }) @@ -180,7 +181,7 @@ typedef union { #define gsSPFogFactor(fm, fo) gsMoveWd(G_MW_FOG, G_MWO_FOG, (_SHIFTL(fm, 16, 16) | _SHIFTL(fo, 0, 16))) #define gsSPNumLights(n) gsMoveWd(G_MW_NUMLIGHT, G_MWO_NUMLIGHT, NUML(n)) -#define gsSPSegment(segment, base) gsMoveWd(G_MW_SEGMENT, (segment) * 4, base) +#define gsSPSegment(segment, base) gsMoveWd(G_MW_SEGMENT, (segment)*4, base) #define gsSPMatrix(m, p) gsDma2p(G_MTX, (m), sizeof(Mtx), (p) ^ G_MTX_PUSH, 0) @@ -254,25 +255,24 @@ typedef union { _SHIFTL(shiftt, 10, 4) | _SHIFTL(cms, 8, 2) | _SHIFTL(masks, 4, 4) | _SHIFTL(shifts, 0, 4)) \ } -#define gsDPLoadTextureBlock(timg, fmt, siz, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt) \ - \ - gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ - gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, \ - CALC_DXT(width, siz##_BYTES)), \ - gsDPPipeSync(), \ - gsDPSetTile(fmt, siz, ((((width) * siz##_LINE_BYTES) + 7) >> 3), 0, G_TX_RENDERTILE, pal, cmt, maskt, shiftt, \ - cms, masks, shifts), \ - gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ +#define gsDPLoadTextureBlock(timg, fmt, siz, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt) \ + \ + gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ + gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSync(), \ + gsDPLoadBlock(G_TX_LOADTILE, 0, 0, (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, \ + CALC_DXT(width, siz##_BYTES)), \ + gsDPPipeSync(), \ + gsDPSetTile(fmt, siz, ((((width)*siz##_LINE_BYTES) + 7) >> 3), 0, G_TX_RENDERTILE, pal, cmt, maskt, shiftt, \ + cms, masks, shifts), \ + gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ ((height)-1) << G_TEXTURE_IMAGE_FRAC) #define gsSPEndDisplayList() \ { _SHIFTL(G_ENDDL, 24, 8), 0 } #define gsSPCullDisplayList(vstart, vend) \ - { _SHIFTL(G_CULLDL, 24, 8) | _SHIFTL((vstart) * 2, 0, 16), _SHIFTL((vend) * 2, 0, 16) } - + { _SHIFTL(G_CULLDL, 24, 8) | _SHIFTL((vstart)*2, 0, 16), _SHIFTL((vend)*2, 0, 16) } #define gsSPClipRatio(r) \ gsMoveWd(G_MW_CLIP, G_MWO_CLIP_RNX, FR_NEG_##r), gsMoveWd(G_MW_CLIP, G_MWO_CLIP_RNY, FR_NEG_##r), \ @@ -314,7 +314,6 @@ typedef union { #define gsSPLightColor(n, col) gsMoveWd(G_MW_LIGHTCOL, G_MWO_a##n, col), gsMoveWd(G_MW_LIGHTCOL, G_MWO_b##n, col) - #endif namespace LUS { std::unordered_map renderModes = { { "G_RM_ZB_OPA_SURF", G_RM_ZB_OPA_SURF }, @@ -1181,19 +1180,19 @@ std::shared_ptr ResourceFactoryXMLDisplayListV0::ReadResource(std::sh if (siz == 0) { F3DGfx g3[7] = { gsDPLoadTextureBlock(0, fmt, G_IM_SIZ_4b, width, height, 0, cms, cmt, maskS, maskT, - shiftS, shiftT) }; + shiftS, shiftT) }; memcpy(g2, g3, 7 * sizeof(F3DGfx)); } else if (siz == 1) { F3DGfx g3[7] = { gsDPLoadTextureBlock(0, fmt, G_IM_SIZ_8b, width, height, 0, cms, cmt, maskS, maskT, - shiftS, shiftT) }; + shiftS, shiftT) }; memcpy(g2, g3, 7 * sizeof(F3DGfx)); } else if (siz == 2) { F3DGfx g3[7] = { gsDPLoadTextureBlock(0, fmt, G_IM_SIZ_16b, width, height, 0, cms, cmt, maskS, maskT, - shiftS, shiftT) }; + shiftS, shiftT) }; memcpy(g2, g3, 7 * sizeof(F3DGfx)); } else if (siz == 3) { F3DGfx g3[7] = { gsDPLoadTextureBlock(0, fmt, G_IM_SIZ_32b, width, height, 0, cms, cmt, maskS, maskT, - shiftS, shiftT) }; + shiftS, shiftT) }; memcpy(g2, g3, 7 * sizeof(F3DGfx)); } diff --git a/src/resource/type/DisplayList.cpp b/src/resource/type/DisplayList.cpp index 66060ba50..59eaa90e3 100644 --- a/src/resource/type/DisplayList.cpp +++ b/src/resource/type/DisplayList.cpp @@ -1,6 +1,5 @@ #include "resource/type/DisplayList.h" - namespace LUS { DisplayList::DisplayList() : Resource(std::shared_ptr()) { } diff --git a/src/window/gui/GfxDebuggerWindow.cpp b/src/window/gui/GfxDebuggerWindow.cpp index cd99d413c..a44e3b8aa 100644 --- a/src/window/gui/GfxDebuggerWindow.cpp +++ b/src/window/gui/GfxDebuggerWindow.cpp @@ -24,88 +24,9 @@ void GfxDebuggerWindow::InitElement() { void GfxDebuggerWindow::UpdateElement() { } +// LUSTODO handle switching ucodes static const char* GetOpName(int8_t op) { - switch (op) { - #if 0 -#define CASE(x) \ - case x: \ - return #x - - CASE(G_RDPHALF_1); - CASE(G_RDPHALF_2); - CASE(G_RDPPIPESYNC); - CASE(G_RDPFULLSYNC); - CASE(G_RDPLOADSYNC); - CASE(G_LOAD_UCODE); - CASE(G_MARKER); - CASE(G_INVALTEXCACHE); - CASE(G_NOOP); - CASE(G_MTX); - CASE(G_MTX_OTR); - CASE(G_POPMTX); - CASE(G_MOVEMEM); - CASE(G_MOVEWORD); - CASE(G_TEXTURE); - CASE(G_VTX); - CASE(G_VTX_OTR_HASH); - CASE(G_VTX_OTR_FILEPATH); - CASE(G_DL_OTR_FILEPATH); - CASE(G_MODIFYVTX); - CASE(G_DL); - CASE(G_DL_OTR_HASH); - CASE(G_PUSHCD); - CASE(G_BRANCH_Z_OTR); - CASE(G_ENDDL); - CASE(G_GEOMETRYMODE); - // CASE(G_SETGEOMETRYMODE); - // CASE(G_CLEARGEOMETRYMODE); - CASE(G_TRI1_OTR); - CASE(G_TRI1); - CASE(G_QUAD); - CASE(G_TRI2); - CASE(G_SETOTHERMODE_L); - CASE(G_SETOTHERMODE_H); - CASE(G_SETTIMG); - CASE(G_SETTIMG_OTR_HASH); - CASE(G_SETTIMG_OTR_FILEPATH); - CASE(G_SETFB); - CASE(G_RESETFB); - CASE(G_SETTIMG_FB); - CASE(G_SETGRAYSCALE); - CASE(G_LOADBLOCK); - CASE(G_LOADTILE); - CASE(G_SETTILE); - CASE(G_SETTILESIZE); - CASE(G_LOADTLUT); - CASE(G_SETENVCOLOR); - CASE(G_SETPRIMCOLOR); - CASE(G_SETFOGCOLOR); - CASE(G_SETFILLCOLOR); - CASE(G_SETINTENSITY); - CASE(G_SETCOMBINE); - CASE(G_TEXRECT); - CASE(G_TEXRECTFLIP); - CASE(G_TEXRECT_WIDE); - CASE(G_FILLRECT); - CASE(G_FILLWIDERECT); - CASE(G_SETSCISSOR); - CASE(G_SETZIMG); - CASE(G_SETCIMG); - CASE(G_RDPSETOTHERMODE); - // CASE(G_BG_COPY); - CASE(G_EXTRAGEOMETRYMODE); - CASE(G_SETBLENDCOLOR); - CASE(G_RDPTILESYNC); - CASE(G_SPNOOP); - CASE(G_CULLDL); - CASE(G_IMAGERECT); - CASE(G_COPYFB); - #endif - default: - return nullptr; - // return "UNKNOWN"; -#undef CASE - } + return GfxGetOpcodeName(op); } static inline void* seg_addr(uintptr_t w1) {