From 1741623482f1c17448a37771eb6e875d4c4a6c51 Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Sat, 31 Jan 2015 04:35:43 -0800 Subject: [PATCH 01/18] Fixed some mistakes in GetInstructionInfo Not only were certain instructions missing, but also some were in the wrong place or had the wrong attributes. Also VSUB needed to be added to IsNextInstructionMmx. --- Source/RSP/Recompiler Analysis.c | 35 +++++++++++++++++--------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/Source/RSP/Recompiler Analysis.c b/Source/RSP/Recompiler Analysis.c index 407c83fb6..04b3dcc39 100644 --- a/Source/RSP/Recompiler Analysis.c +++ b/Source/RSP/Recompiler Analysis.c @@ -102,6 +102,7 @@ BOOL IsNextInstructionMmx(DWORD PC) { return TRUE; case RSP_VECTOR_VADD: + case RSP_VECTOR_VSUB: /* Requires no accumulator write! & No flags! */ if (WriteToAccum(Low16BitAccum, CompilePC) == TRUE) { return FALSE; @@ -1421,16 +1422,25 @@ void GetInstructionInfo(DWORD PC, OPCODE * RspOp, OPCODE_INFO * info) { break; case RSP_VECTOR_VMULF: + case RSP_VECTOR_VMULU: case RSP_VECTOR_VMUDL: case RSP_VECTOR_VMUDM: case RSP_VECTOR_VMUDN: case RSP_VECTOR_VMUDH: + case RSP_VECTOR_VABS: + case RSP_VECTOR_VAND: + case RSP_VECTOR_VOR: + case RSP_VECTOR_VXOR: + case RSP_VECTOR_VNAND: + case RSP_VECTOR_VNOR: + case RSP_VECTOR_VNXOR: info->DestReg = RspOp->sa; info->SourceReg0 = RspOp->rd; info->SourceReg1 = RspOp->rt; info->flags = VEC_Instruction | VEC_ResetAccum | Accum_Operation; break; case RSP_VECTOR_VMACF: + case RSP_VECTOR_VMACU: case RSP_VECTOR_VMADL: case RSP_VECTOR_VMADM: case RSP_VECTOR_VMADN: @@ -1440,23 +1450,13 @@ void GetInstructionInfo(DWORD PC, OPCODE * RspOp, OPCODE_INFO * info) { info->SourceReg1 = RspOp->rt; info->flags = VEC_Instruction | VEC_Accumulate | Accum_Operation; break; - case RSP_VECTOR_VABS: case RSP_VECTOR_VADD: case RSP_VECTOR_VADDC: case RSP_VECTOR_VSUB: case RSP_VECTOR_VSUBC: - case RSP_VECTOR_VAND: - case RSP_VECTOR_VOR: - case RSP_VECTOR_VXOR: - case RSP_VECTOR_VNXOR: case RSP_VECTOR_VCR: case RSP_VECTOR_VCH: case RSP_VECTOR_VCL: - case RSP_VECTOR_VRCP: - case RSP_VECTOR_VRCPL: - case RSP_VECTOR_VRCPH: - case RSP_VECTOR_VRSQL: - case RSP_VECTOR_VRSQH: case RSP_VECTOR_VLT: case RSP_VECTOR_VEQ: case RSP_VECTOR_VGE: @@ -1468,19 +1468,22 @@ void GetInstructionInfo(DWORD PC, OPCODE * RspOp, OPCODE_INFO * info) { break; case RSP_VECTOR_VMOV: - info->flags = InvalidOpcode; - /* info->DestReg = RspOp->sa; + case RSP_VECTOR_VRCP: + case RSP_VECTOR_VRCPL: + case RSP_VECTOR_VRCPH: + case RSP_VECTOR_VRSQL: + case RSP_VECTOR_VRSQH: + info->DestReg = RspOp->sa; info->SourceReg0 = RspOp->rt; info->SourceReg1 = -1; - info->flags = VEC_Instruction; /* Assume reset? */ + info->flags = VEC_Instruction | VEC_ResetAccum | Accum_Operation; /* Assume reset? */ break; case RSP_VECTOR_VMRG: - info->flags = InvalidOpcode; - /* info->DestReg = RspOp->sa; + info->DestReg = RspOp->sa; info->SourceReg0 = RspOp->rt; info->SourceReg1 = RspOp->rd; - info->flags = VEC_Instruction; /* Assum reset? */ + info->flags = VEC_Instruction | VEC_ResetAccum | Accum_Operation | Flag_Instruction; /* Assum reset? */ break; case RSP_VECTOR_VSAW: From d8918f3b1b38c73818a88b67dc1e8d9a3ebd0242 Mon Sep 17 00:00:00 2001 From: Emmet Young Date: Sat, 31 Jan 2015 23:51:24 +1100 Subject: [PATCH 02/18] [!] Add plugin base files to vcxproj --- Source/Project64/Project64.vcxproj | 2 ++ Source/Project64/Project64.vcxproj.filters | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Source/Project64/Project64.vcxproj b/Source/Project64/Project64.vcxproj index 169c633bc..f347bc240 100644 --- a/Source/Project64/Project64.vcxproj +++ b/Source/Project64/Project64.vcxproj @@ -56,6 +56,7 @@ + Create @@ -197,6 +198,7 @@ + diff --git a/Source/Project64/Project64.vcxproj.filters b/Source/Project64/Project64.vcxproj.filters index 8e076f143..a9ca22038 100644 --- a/Source/Project64/Project64.vcxproj.filters +++ b/Source/Project64/Project64.vcxproj.filters @@ -417,6 +417,9 @@ Source Files\3rd Party Source\ZLib Source + + Source Files\Plugin Source + @@ -839,5 +842,8 @@ Header Files\3rd Party Headers\Zlib Headers + + Header Files\Plugin Headers + \ No newline at end of file From 64e9135d198ecb4f8c2fce7185bfab9106d04fc0 Mon Sep 17 00:00:00 2001 From: Emmet Young Date: Sat, 31 Jan 2015 23:52:35 +1100 Subject: [PATCH 03/18] [!]Fix peculiar issue where save states would not save instantly when using "Save as", and in some cases not save at all. Fix this by making an event call instead. --- Source/Project64/User Interface/Main Menu Class.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Project64/User Interface/Main Menu Class.cpp b/Source/Project64/User Interface/Main Menu Class.cpp index a765a50fc..8d4f5dd68 100644 --- a/Source/Project64/User Interface/Main Menu Class.cpp +++ b/Source/Project64/User Interface/Main Menu Class.cpp @@ -167,12 +167,12 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI _makepath( SaveFile, drive, dir, fname, NULL ); } } - g_Settings->SaveString(GameRunning_InstantSaveFile,SaveFile); + g_Settings->SaveString(GameRunning_InstantSaveFile, SaveFile); char SaveDir[MAX_PATH]; _makepath( SaveDir, drive, dir, NULL, NULL ); g_Settings->SaveString(Directory_LastSave,SaveDir); - g_System->SaveState(); + g_BaseSystem->ExternalEvent(SysEvent_SaveMachineState); } g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame); } From 0f1010379f2af13a033b6e1589beaa31426a1996 Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Sat, 31 Jan 2015 17:23:43 -0800 Subject: [PATCH 04/18] Implement a quick fix for Instruction Reordering Instruction Reordering broke Mia Hamm and possibly other games too. The easiest way to fix the problem was to simply disable reordering for specific cases that were never accounted for. --- Source/RSP/Recompiler Analysis.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/RSP/Recompiler Analysis.c b/Source/RSP/Recompiler Analysis.c index 04b3dcc39..9f9736b53 100644 --- a/Source/RSP/Recompiler Analysis.c +++ b/Source/RSP/Recompiler Analysis.c @@ -1399,7 +1399,11 @@ void GetInstructionInfo(DWORD PC, OPCODE * RspOp, OPCODE_INFO * info) { info->DestReg = RspOp->rt; info->SourceReg0 = (DWORD)-1; info->SourceReg1 = (DWORD)-1; - info->flags = COPO_MF_Instruction | GPR_Instruction | Load_Operation; + if (RspOp->rd == 0x4 || RspOp->rd == 0x7){ + info->flags = InvalidOpcode; + } else{ + info->flags = COPO_MF_Instruction | GPR_Instruction | Load_Operation; + } break; case RSP_COP0_MT: From ce939718d86168dae1f12a6f02c58400ff5fce4f Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 10:47:29 -0500 Subject: [PATCH 05/18] (Glide64) mudlord forgot to remove the now unused GL proc name strings. --- Source/Glide64/Combine.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Source/Glide64/Combine.cpp b/Source/Glide64/Combine.cpp index c3d30e993..f999887b8 100644 --- a/Source/Glide64/Combine.cpp +++ b/Source/Glide64/Combine.cpp @@ -15981,15 +15981,10 @@ void InitCombine () if (const char * extstr = strstr(extensions, "COMBINE")) { if (!strncmp(extstr, "COMBINE", 7)) { LOG ("extensions "); - char strColorCombineExt[] = "grColorCombineExt"; cmb.grColorCombineExt = (GRCOLORCOMBINEEXT) grColorCombineExt; - char strAlphaCombineExt[] = "grAlphaCombineExt"; cmb.grAlphaCombineExt = (GRCOLORCOMBINEEXT)grAlphaCombineExt; - char strTexColorCombineExt[] = "grTexColorCombineExt"; cmb.grTexColorCombineExt = (GRTEXCOLORCOMBINEEXT)grTexColorCombineExt ; - char strTexAlphaCombineExt[] = "grTexAlphaCombineExt"; cmb.grTexAlphaCombineExt = (GRTEXCOLORCOMBINEEXT) grTexAlphaCombineExt ; - char strConstantColorValueExt[] = "grConstantColorValueExt"; cmb.grConstantColorValueExt = (GRCONSTANTCOLORVALUEEXT) grConstantColorValueExt; if (cmb.grColorCombineExt && cmb.grAlphaCombineExt && cmb.grTexColorCombineExt && cmb.grTexAlphaCombineExt) From a6effdee025ae1c58efd13af471353e843139b99 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 11:09:05 -0500 Subject: [PATCH 06/18] (Glide64) Debug invalid switch cases to fix initialization warnings. --- Source/Glide64/Combine.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Source/Glide64/Combine.cpp b/Source/Glide64/Combine.cpp index f999887b8..f0fc6854a 100644 --- a/Source/Glide64/Combine.cpp +++ b/Source/Glide64/Combine.cpp @@ -16007,12 +16007,15 @@ void InitCombine () void ColorCombinerToExtension () { wxUint32 ext_local, ext_local_a, ext_other, ext_other_a; + switch (cmb.c_loc) { case GR_COMBINE_LOCAL_ITERATED: ext_local = GR_CMBX_ITRGB; ext_local_a = GR_CMBX_ITALPHA; break; + default: + FRDP("Invalid combiner locality %u.\n", cmb.c_loc); case GR_COMBINE_LOCAL_CONSTANT: ext_local = GR_CMBX_CONSTANT_COLOR; ext_local_a = GR_CMBX_CONSTANT_ALPHA; @@ -16028,6 +16031,8 @@ void ColorCombinerToExtension () ext_other = GR_CMBX_TEXTURE_RGB; ext_other_a = GR_CMBX_TEXTURE_ALPHA; break; + default: + FRDP("Invalid combiner flag %u.\n", cmb.c_oth); case GR_COMBINE_OTHER_CONSTANT: ext_other = GR_CMBX_CONSTANT_COLOR; ext_other_a = GR_CMBX_CONSTANT_ALPHA; @@ -16373,6 +16378,8 @@ void TexColorCombinerToExtension (GrChipID_t tmu) tc_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA; tc_ext_c_invert = 1; break; + default: + FRDP("Invalid combiner TMU factor %u.\n", tmu_fac); case GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR: tc_ext_c = GR_CMBX_DETAIL_FACTOR; tc_ext_c_invert = 1; @@ -16467,6 +16474,8 @@ void TexColorCombinerToExtension (GrChipID_t tmu) tc_ext_d = GR_CMBX_B; tc_ext_d_invert = 0; break; + default: + FRDP("Invalid combiner TMU function %u.\n", tmu_func); case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB; tc_ext_a_mode = GR_FUNC_MODE_ZERO; @@ -16550,6 +16559,8 @@ void TexAlphaCombinerToExtension (GrChipID_t tmu) ta_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA; ta_ext_c_invert = 1; break; + default: + FRDP("Invalid combiner alpha factor %u.\n", tmu_a_fac); case GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR: ta_ext_c = GR_CMBX_DETAIL_FACTOR; ta_ext_c_invert = 1; @@ -16613,6 +16624,8 @@ void TexAlphaCombinerToExtension (GrChipID_t tmu) ta_ext_d = GR_CMBX_B; ta_ext_d_invert = 0; break; + default: + FRDP("Invalid combiner alpha coverage function %u.\n", tmu_a_func); case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL: case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA; From b6d7e6fdaeb3d486533f5909a622b28dad97ce8c Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 11:22:02 -0500 Subject: [PATCH 07/18] (Glide64) now debugging possibly uninitialized combiner mode --- Source/Glide64/Combine.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/Glide64/Combine.cpp b/Source/Glide64/Combine.cpp index f0fc6854a..14e90b616 100644 --- a/Source/Glide64/Combine.cpp +++ b/Source/Glide64/Combine.cpp @@ -15607,12 +15607,15 @@ void Combine () left = cc_lookup[actual_combine>>24]; right = cc_lookup[(actual_combine>>24)+1]; - while (1) - { + do { last = current; current = left + ((right-left) >> 1); if (current == last) + { + FRDP("Warning! Could not initialize current_combiner to valid index.\n"); + current_combine = ~0u; /* Debug uncertain case, and fix warning (cxd4). */ break; // can't be found! + } current_combine = color_cmb_list[current].key; if (current_combine < actual_combine) @@ -15621,7 +15624,7 @@ void Combine () right = current; else break; // found it! - } + } while (1); // Check if we didn't find it if (actual_combine != current_combine) From aa165488caf2ff5a9d578dd6a6f2e2d09b1e5481 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 11:50:29 -0500 Subject: [PATCH 08/18] (Glitch64) OpenGL state machine stores GPU format as GLint, not GLenum. Although the unsigned type `GLenum` seem like the logical choice of type for this function argument, OpenGL internal format macros are enumarations of the signed `GLint` type when storing to the GL state machine for commands sent to the GPU, rather than unsigned enumerations. This also fixes a signedness warning in one of the conversions. --- Source/Glitch64/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Glitch64/main.cpp b/Source/Glitch64/main.cpp index 50fdb6202..e622c0680 100644 --- a/Source/Glitch64/main.cpp +++ b/Source/Glitch64/main.cpp @@ -213,7 +213,7 @@ int screen_width, screen_height; static inline void opt_glCopyTexImage2D( GLenum target, GLint level, - GLenum internalFormat, + GLint internalFormat, GLint x, GLint y, GLsizei width, From 8445dbb9e66938f113b7b9bd2e1d8f7264e658a2 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 11:54:16 -0500 Subject: [PATCH 09/18] (Glitch64) Remove unused param name; list the used params more clearly. --- Source/Glitch64/main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/Glitch64/main.cpp b/Source/Glitch64/main.cpp index e622c0680..865802a04 100644 --- a/Source/Glitch64/main.cpp +++ b/Source/Glitch64/main.cpp @@ -604,13 +604,15 @@ grSstWinOpenExt( GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, - GrPixelFormat_t pixelformat, + GrPixelFormat_t /*pixelformat*/, int nColBuffers, int nAuxBuffers) { - LOG("grSstWinOpenExt(%d, %d, %d, %d, %d, %d %d)\r\n", hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers); - return grSstWinOpen(hWnd, screen_resolution, refresh_rate, color_format, - origin_location, nColBuffers, nAuxBuffers); + LOG( + "grSstWinOpenExt(%d, %d, %d, %d, %d, %d %d)\r\n", + hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers); + return grSstWinOpen( + hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers); } #ifdef WIN32 From 72de0b2f34dc0d3c4e9e19a7370b4dcf1b204cf8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 12:00:18 -0500 Subject: [PATCH 10/18] (Glitch64) most likely intended a signed comparison (fixes 2 warnings) --- Source/Glitch64/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Glitch64/main.cpp b/Source/Glitch64/main.cpp index 865802a04..b9455f53b 100644 --- a/Source/Glitch64/main.cpp +++ b/Source/Glitch64/main.cpp @@ -500,8 +500,8 @@ grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy ) maxy = th - maxy; miny = th - miny; FxU32 tmp = maxy; maxy = miny; miny = tmp; - if (maxx > width) maxx = width; - if (maxy > height) maxy = height; + if ((FxI32)maxx > width) maxx = width; + if ((FxI32)maxy > height) maxy = height; if (int(minx) < 0) minx = 0; if (int(miny) < 0) miny = 0; if (maxx < minx) maxx = minx; From 6a956d16852ff63f7fa347ae7f133f10c429a707 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 12:10:19 -0500 Subject: [PATCH 11/18] (Glitch64) fixed remaining signed/unsigned comparison warnings --- Source/Glitch64/main.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/Glitch64/main.cpp b/Source/Glitch64/main.cpp index b9455f53b..27055002a 100644 --- a/Source/Glitch64/main.cpp +++ b/Source/Glitch64/main.cpp @@ -352,7 +352,10 @@ static fb fbs[100]; static int nb_fb = 0; static unsigned int curBufferAddr = 0; -struct TMU_USAGE { int min, max; } tmu_usage[2] = { {0xfffffff, 0}, {0xfffffff, 0} }; +struct TMU_USAGE { unsigned long min, max; } tmu_usage[2] = { + { 0x0FFFFFFFul, 0x00000000ul }, + { 0x0FFFFFFFul, 0x00000000ul }, +}; struct texbuf_t { FxU32 start, end; @@ -1175,8 +1178,8 @@ grSstWinClose( GrContext_t context ) LOG("grSstWinClose(%d)\r\n", context); for (i=0; i<2; i++) { - tmu_usage[i].min = 0xfffffff; - tmu_usage[i].max = 0; + tmu_usage[i].min = 0x0FFFFFFFul; + tmu_usage[i].max = 0x00000000ul; invtex[i] = 0; } @@ -1330,10 +1333,10 @@ FX_ENTRY void FX_CALL grTextureBufferExt( GrChipID_t tmu, int rtmu = startAddress < grTexMinAddress(GR_TMU1)? 0 : 1; int size = pBufferWidth*pBufferHeight*2; //grTexFormatSize(fmt); - if (tmu_usage[rtmu].min > pBufferAddress) - tmu_usage[rtmu].min = pBufferAddress; - if (tmu_usage[rtmu].max < pBufferAddress+size) - tmu_usage[rtmu].max = pBufferAddress+size; + if (tmu_usage[rtmu].min > pBufferAddress + 0) + tmu_usage[rtmu].min = pBufferAddress + 0; + if (tmu_usage[rtmu].max < pBufferAddress + size) + tmu_usage[rtmu].max = pBufferAddress + size; // printf("tmu %d usage now %gMb - %gMb\n", // rtmu, tmu_usage[rtmu].min/1024.0f, tmu_usage[rtmu].max/1024.0f); From edef61831e8b5d30bc8f573f1f8a5a11773bc436 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 12:23:11 -0500 Subject: [PATCH 12/18] (Glide64) fixed RDP command buffer halfword implicit sign warnings --- Source/Glide64/rdp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index e04998012..2c3c20a5f 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -1639,13 +1639,13 @@ static void rdp_setprimdepth() static void rdp_setothermode() { #define F3DEX2_SETOTHERMODE(cmd,sft,len,data) { \ - rdp.cmd0 = (cmd<<24) | ((32-(sft)-(len))<<8) | (((len)-1)); \ - rdp.cmd1 = data; \ + rdp.cmd0 = (wxUint32)(((cmd)<<24) | ((32-(sft)-(len))<<8) | (((len)-1))); \ + rdp.cmd1 = (wxUint32)(data); \ gfx_instruction[settings.ucode][cmd] (); \ } #define SETOTHERMODE(cmd,sft,len,data) { \ - rdp.cmd0 = (cmd<<24) | ((sft)<<8) | (len); \ - rdp.cmd1 = data; \ + rdp.cmd0 = (wxUint32)(((cmd)<<24) | ((sft)<<8) | (len)); \ + rdp.cmd1 = (wxUint32)(data); \ gfx_instruction[settings.ucode][cmd] (); \ } From b372464eb0ac3edce4abc09df9527b690b488bb0 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 12:35:55 -0500 Subject: [PATCH 13/18] (Glide64) fixed remaining ucode variable/ptr initialization warnings --- Source/Glide64/ucode09.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/Glide64/ucode09.h b/Source/Glide64/ucode09.h index 49253f4d3..c254364e3 100644 --- a/Source/Glide64/ucode09.h +++ b/Source/Glide64/ucode09.h @@ -99,6 +99,8 @@ static void uc9_draw_object (wxUint8 * addr, wxUint32 type) { wxUint32 textured, vnum, vsize; switch (type) { + default: /* added to fix uninitialized variable warnings + debugging */ + FRDP("Unknown geometric primitive type %u.\n", type); case 0: //null textured = vnum = vsize = 0; break; @@ -264,6 +266,10 @@ static void uc9_fmlight () case 8: m = (M44*)rdp.combined; break; + default: + m = NULL; /* allowing segfaults to debug in case of PJGlide64 bugs */ + FRDP("Invalid FM light matrix ID %u.\n", mid); + break; } rdp.light[rdp.num_lights].r = (float)(((wxUint8*)gfx.DMEM)[(a+0)^3]) / 255.0f; @@ -400,6 +406,10 @@ static void uc9_mtxcat () s = (M44*)rdp.combined; LRDP("Comb * "); break; + default: + FRDP("Invalid mutex S-coordinate: %u\n", S); + t = NULL; /* intentional segfault to alert for bugs in PJGlide64 (cxd4) */ + break; } switch (T) { case 4: @@ -414,6 +424,10 @@ static void uc9_mtxcat () LRDP("Comb -> "); t = (M44*)rdp.combined; break; + default: + FRDP("Invalid mutex T-coordinate: %u\n", T); + t = NULL; /* intentional segfault to alert for bugs in PJGlide64 (cxd4) */ + break; } DECLAREALIGN16VAR(m[4][4]); MulMatrices(*s, *t, m); From fd6032854993d2b0e837bc34c54499c4efab1f22 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 12:42:34 -0500 Subject: [PATCH 14/18] (Glide64) fixed remaining unused function parameter name warnings --- Source/Glide64/rdp.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 2c3c20a5f..2226a916c 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -3002,10 +3002,16 @@ input: FrameBufferModifyEntry *plist size = size of the plist, max = 1024 output: none *******************************************************************/ +#ifdef RDP_LOGGING EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, wxUint32 size) +#else +EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, wxUint32) +#endif { LOG ("FBWList ()\n"); +#ifdef RDP_LOGGING FRDP("FBWList. size: %d\n", size); +#endif } @@ -3018,7 +3024,7 @@ val val size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32 output: none *******************************************************************/ -EXPORT void CALL FBWrite(wxUint32 addr, wxUint32 size) +EXPORT void CALL FBWrite(wxUint32 addr, wxUint32 /*size*/) { LOG ("FBWrite ()\n"); if (cpu_fb_ignore) From 7e20dd8d0cceb5b0d6d9293df86319a7ff55f7c5 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 12:47:09 -0500 Subject: [PATCH 15/18] (Glide64) fixed tmu initialization warning by staticizing TMU elements --- Source/Glide64/TexCache.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Glide64/TexCache.cpp b/Source/Glide64/TexCache.cpp index ee2403703..d401a2b06 100644 --- a/Source/Glide64/TexCache.cpp +++ b/Source/Glide64/TexCache.cpp @@ -861,11 +861,13 @@ void TexCache () if (fullscreen) { + int tmu_v[2]; + + tmu_v[0] = tmu_0; + tmu_v[1] = tmu_1; for (int i=0; i<2; i++) { - int tmu; - if (i==0) tmu=tmu_0; - else if (i==1) tmu=tmu_1; + const int tmu = tmu_v[i]; if (tmu >= voodoo.num_tmu) continue; From 9a1aef0fd650fc0e203f948f26cca63f773b4cbc Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 12:53:32 -0500 Subject: [PATCH 16/18] sorry, don't work well with hunger --- Source/Glide64/rdp.cpp | 4 ++-- Source/Glide64/ucode09.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 2226a916c..59d348eb4 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -3003,9 +3003,9 @@ size = size of the plist, max = 1024 output: none *******************************************************************/ #ifdef RDP_LOGGING -EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, wxUint32 size) +EXPORT void CALL FBWList(FrameBufferModifyEntry* /*plist*/, wxUint32 size) #else -EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, wxUint32) +EXPORT void CALL FBWList(FrameBufferModifyEntry* /*plist*/, wxUint32) #endif { LOG ("FBWList ()\n"); diff --git a/Source/Glide64/ucode09.h b/Source/Glide64/ucode09.h index c254364e3..2f41d6a00 100644 --- a/Source/Glide64/ucode09.h +++ b/Source/Glide64/ucode09.h @@ -408,7 +408,7 @@ static void uc9_mtxcat () break; default: FRDP("Invalid mutex S-coordinate: %u\n", S); - t = NULL; /* intentional segfault to alert for bugs in PJGlide64 (cxd4) */ + s = NULL; /* intentional segfault to alert for bugs in PJGlide64 (cxd4) */ break; } switch (T) { From 3d66a3540db14da7aa536efecf1c5da65a70ec8c Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 12:54:28 -0500 Subject: [PATCH 17/18] (Glide64) None of the TexLoad.h::LoadNone parameters were ever used. --- Source/Glide64/TexLoad.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Glide64/TexLoad.h b/Source/Glide64/TexLoad.h index f54e63c71..7220dec27 100644 --- a/Source/Glide64/TexLoad.h +++ b/Source/Glide64/TexLoad.h @@ -42,7 +42,14 @@ #include "TexLoad16b.h" #include "TexLoad32b.h" -wxUint32 LoadNone (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int /*real_width*/, int tile) +wxUint32 LoadNone( + wxUIntPtr /*dst*/, + wxUIntPtr /*src*/, + int /*wid_64*/, + int /*height*/, + int /*line*/, + int /*real_width*/, + int /*tile*/) { memset (texture, 0, 4096*4); return (1 << 16) | GR_TEXFMT_ARGB_1555; From 59eadfe83a74ff8da1c8ef81b290ab008bbfbe7b Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Feb 2015 13:10:27 -0500 Subject: [PATCH 18/18] (Glide64) guess doing 2*(wxUint16) produces a signed type in C++ rules? This fixes an implicit signed/unsigned conversion warning. --- Source/Glide64/TexBuffer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Glide64/TexBuffer.cpp b/Source/Glide64/TexBuffer.cpp index 1d48c5184..ef4582fdc 100644 --- a/Source/Glide64/TexBuffer.cpp +++ b/Source/Glide64/TexBuffer.cpp @@ -705,7 +705,12 @@ int FindTextureBuffer(wxUint32 addr, wxUint16 width) if (rdp.tbuff_tex->crc == 0) { rdp.tbuff_tex->crc = CalcCRC(rdp.tbuff_tex); - bCorrect = width == 1 || rdp.tbuff_tex->width == width || (rdp.tbuff_tex->width > 320 && rdp.tbuff_tex->width == width*2); + bCorrect = + (width == 1) + || (rdp.tbuff_tex->width == width) + || ( (rdp.tbuff_tex->width > 320) + && (rdp.tbuff_tex->width == (wxUint32)width*2) + ); } else bCorrect = rdp.tbuff_tex->crc == CalcCRC(rdp.tbuff_tex);