From d7a19c265f3e533d1890abfd53ce5691176b20be Mon Sep 17 00:00:00 2001 From: zilmar Date: Tue, 13 Oct 2015 08:12:16 +1100 Subject: [PATCH] [Glide64] fixed compiler warnings https://github.com/mupen64plus/mupen64plus-video-glide64mk2/commit/794226a2743a929ff64f488cf8068fc8bebf61b4 --- Project64.vs2008.sln | 1 + Source/3rd Party/sdl/sdl2.vcproj | 1 + Source/3rd Party/sdl/src/SDL.c | 4 +- Source/3rd Party/sdl/src/stdlib/SDL_stdlib.c | 6 +- Source/Glide64/Combine.cpp | 58 ++++++++++++++----- Source/Glide64/Glide64.vcproj | 2 +- Source/Glide64/TexCache.cpp | 5 +- Source/Glide64/ucode09.h | 12 ++-- Source/GlideHQ/GlideHQ.vcproj | 2 +- Source/GlideHQ/TextureFilters.cpp | 59 ++++++++------------ 10 files changed, 87 insertions(+), 63 deletions(-) diff --git a/Project64.vs2008.sln b/Project64.vs2008.sln index 391f72b0d..544859f62 100644 --- a/Project64.vs2008.sln +++ b/Project64.vs2008.sln @@ -39,6 +39,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Glide64", "Source\Glide64\G {25A25249-C284-4C5A-8DC2-26FC3EB13703} = {25A25249-C284-4C5A-8DC2-26FC3EB13703} {B4A4B994-9111-42B1-93C2-6F1CA8BC4421} = {B4A4B994-9111-42B1-93C2-6F1CA8BC4421} {2DADDAA5-0F57-46ED-A974-747908DDC7F3} = {2DADDAA5-0F57-46ED-A974-747908DDC7F3} + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} {8B9961B1-88D9-4EA3-A752-507A00DD9F3D} = {8B9961B1-88D9-4EA3-A752-507A00DD9F3D} {427F1DCD-3BED-4010-9322-077A4C06D871} = {427F1DCD-3BED-4010-9322-077A4C06D871} {93CFEDF3-9A75-4484-B169-D9D8074F5AC2} = {93CFEDF3-9A75-4484-B169-D9D8074F5AC2} diff --git a/Source/3rd Party/sdl/sdl2.vcproj b/Source/3rd Party/sdl/sdl2.vcproj index 6b15443a1..dad6c2dad 100644 --- a/Source/3rd Party/sdl/sdl2.vcproj +++ b/Source/3rd Party/sdl/sdl2.vcproj @@ -53,6 +53,7 @@ /> = 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : #ifndef __FLTUSED__ #define __FLTUSED__ -__declspec(selectany) int _fltused = 1; +//__declspec(selectany) int _fltused = 1; #endif /* The optimizer on Visual Studio 2010/2012 generates memcpy() calls */ @@ -334,11 +334,11 @@ localexit: /* *INDENT-ON* */ } -void +/*void _ftol2_sse() { _ftol(); -} +}*/ /* 64-bit math operators for 32-bit systems */ void diff --git a/Source/Glide64/Combine.cpp b/Source/Glide64/Combine.cpp index aa7cc111d..b588da98b 100644 --- a/Source/Glide64/Combine.cpp +++ b/Source/Glide64/Combine.cpp @@ -15599,7 +15599,7 @@ void Combine () wxUint32 actual_combine, current_combine, color_combine, alpha_combine; int left, right; - actual_combine = cmb_mode_c; + actual_combine = current_combine = cmb_mode_c; color_combine = actual_combine; if ((rdp.cycle2 & 0xFFFF) == 0x1FFF) actual_combine = (rdp.cycle1 << 16) | (rdp.cycle1 & 0xFFFF); @@ -16021,12 +16021,14 @@ void ColorCombinerToExtension () ext_local = GR_CMBX_ITRGB; ext_local_a = GR_CMBX_ITALPHA; break; - default: - FRDP_E("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; break; + default: + FRDP_E("Invalid combiner locality %u.\n", cmb.c_loc); + ext_local = GR_CMBX_ZERO; + ext_local_a = GR_CMBX_ZERO; }; switch (cmb.c_oth) { @@ -16038,12 +16040,14 @@ void ColorCombinerToExtension () ext_other = GR_CMBX_TEXTURE_RGB; ext_other_a = GR_CMBX_TEXTURE_ALPHA; break; - default: - FRDP_E("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; break; + default: + FRDP_E("Invalid combiner flag %u.\n", cmb.c_oth); + ext_other = GR_CMBX_ZERO; + ext_other_a = GR_CMBX_ZERO; }; switch (cmb.c_fac) { @@ -16091,6 +16095,9 @@ void ColorCombinerToExtension () cmb.c_ext_c = GR_CMBX_TEXTURE_ALPHA; cmb.c_ext_c_invert = 1; break; + default: + cmb.c_ext_c = GR_CMBX_ZERO; + cmb.c_ext_c_invert = 0; } switch (cmb.c_fnc) @@ -16182,6 +16189,7 @@ void ColorCombinerToExtension () cmb.c_ext_d_invert = 0; break; case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA: + default: cmb.c_ext_a = GR_CMBX_ZERO; cmb.c_ext_a_mode = GR_FUNC_MODE_ZERO; cmb.c_ext_b = ext_local; @@ -16385,12 +16393,15 @@ void TexColorCombinerToExtension (GrChipID_t tmu) tc_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA; tc_ext_c_invert = 1; break; - default: - FRDP_E("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; break; + default: + FRDP_E("Invalid combiner TMU factor %u.\n", tmu_fac); + tc_ext_c = GR_CMBX_ZERO; + tc_ext_c_invert = 0; + break; } switch (tmu_func) @@ -16481,8 +16492,6 @@ void TexColorCombinerToExtension (GrChipID_t tmu) tc_ext_d = GR_CMBX_B; tc_ext_d_invert = 0; break; - default: - FRDP_E("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; @@ -16491,6 +16500,17 @@ void TexColorCombinerToExtension (GrChipID_t tmu) tc_ext_d = GR_CMBX_LOCAL_TEXTURE_ALPHA; tc_ext_d_invert = 0; break; + default: + FRDP_E("Invalid combiner TMU function %u.\n", tmu_func); + tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB; + tc_ext_a_mode = GR_FUNC_MODE_ZERO; + tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB; + tc_ext_b_mode = GR_FUNC_MODE_ZERO; + tc_ext_c = GR_CMBX_ZERO; + tc_ext_c_invert = 0; + tc_ext_d = GR_CMBX_ZERO; + tc_ext_d_invert = 0; + break; } if (tmu == GR_TMU0) @@ -16566,12 +16586,15 @@ void TexAlphaCombinerToExtension (GrChipID_t tmu) ta_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA; ta_ext_c_invert = 1; break; - default: - FRDP_E("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; break; + default: + FRDP_E("Invalid combiner alpha factor %u.\n", tmu_a_fac); + ta_ext_c = GR_CMBX_ZERO; + ta_ext_c_invert = 0; + break; } switch (tmu_a_func) @@ -16631,8 +16654,6 @@ void TexAlphaCombinerToExtension (GrChipID_t tmu) ta_ext_d = GR_CMBX_B; ta_ext_d_invert = 0; break; - default: - FRDP_E("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; @@ -16642,6 +16663,17 @@ void TexAlphaCombinerToExtension (GrChipID_t tmu) ta_ext_d = GR_CMBX_B; ta_ext_d_invert = 0; break; + default: + FRDP_E("Invalid combiner alpha coverage function %u.\n", tmu_a_func); + ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA; + ta_ext_a_mode = GR_FUNC_MODE_ZERO; + ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA; + ta_ext_b_mode = GR_FUNC_MODE_ZERO; + ta_ext_c = GR_CMBX_ZERO; + ta_ext_c_invert = 0; + ta_ext_d = GR_CMBX_ZERO; + ta_ext_d_invert = 0; + break; } if (tmu == GR_TMU0) diff --git a/Source/Glide64/Glide64.vcproj b/Source/Glide64/Glide64.vcproj index 63995751e..d488e962a 100644 --- a/Source/Glide64/Glide64.vcproj +++ b/Source/Glide64/Glide64.vcproj @@ -37,7 +37,7 @@ /> diff --git a/Source/Glide64/TexCache.cpp b/Source/Glide64/TexCache.cpp index 6a85fcb19..b8bc9ca72 100644 --- a/Source/Glide64/TexCache.cpp +++ b/Source/Glide64/TexCache.cpp @@ -37,6 +37,7 @@ // //**************************************************************** +#include #include "Gfx_1.3.h" #include "TexCache.h" #include "Combine.h" @@ -518,10 +519,10 @@ void TexCache () if (ghq_dmptex_toggle_key) { DisplayLoadProgress(L"Texture dump - ON\n"); ClearCache(); - wxThread::Sleep(1000); + SDL_Delay(1000); } else { DisplayLoadProgress(L"Texture dump - OFF\n"); - wxThread::Sleep(1000); + SDL_Delay(1000); } } } diff --git a/Source/Glide64/ucode09.h b/Source/Glide64/ucode09.h index 882d1226b..05f5c0594 100644 --- a/Source/Glide64/ucode09.h +++ b/Source/Glide64/ucode09.h @@ -99,8 +99,6 @@ static void uc9_draw_object (wxUint8 * addr, wxUint32 type) { wxUint32 textured, vnum, vsize; switch (type) { - default: /* added to fix uninitialized variable warnings + debugging */ - FRDP_E("Unknown geometric primitive type %u.\n", type); case 0: //null textured = vnum = vsize = 0; break; @@ -124,6 +122,10 @@ static void uc9_draw_object (wxUint8 * addr, wxUint32 type) vnum = 4; vsize = 16; break; + default: + FRDP_E("Unknown geometric primitive type %u.\n", type); + textured = vnum = vsize = 0; + break; } VERTEX vtx[4]; for (wxUint32 i = 0; i < vnum; i++) @@ -255,7 +257,7 @@ static void uc9_fmlight () wxUint32 a = -1024 + (rdp.cmd1&0xFFF); FRDP ("uc9:fmlight matrix: %d, num: %d, dmem: %04lx\n", mid, rdp.num_lights, a); - M44 *m; + M44 *m = NULL; switch (mid) { case 4: m = (M44*)rdp.model; @@ -388,8 +390,8 @@ static void uc9_mtxtrnsp () static void uc9_mtxcat () { LRDP("uc9:mtxcat "); - M44 *s; - M44 *t; + M44 *s = NULL; + M44 *t = NULL; wxUint32 S = rdp.cmd0&0xF; wxUint32 T = (rdp.cmd1>>16)&0xF; wxUint32 D = rdp.cmd1&0xF; diff --git a/Source/GlideHQ/GlideHQ.vcproj b/Source/GlideHQ/GlideHQ.vcproj index 1984cb6be..e48c3eb2f 100644 --- a/Source/GlideHQ/GlideHQ.vcproj +++ b/Source/GlideHQ/GlideHQ.vcproj @@ -37,7 +37,7 @@ /> diff --git a/Source/GlideHQ/TextureFilters.cpp b/Source/GlideHQ/TextureFilters.cpp index e0e2d9b43..b46dcb566 100644 --- a/Source/GlideHQ/TextureFilters.cpp +++ b/Source/GlideHQ/TextureFilters.cpp @@ -74,70 +74,57 @@ void Texture2x_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch r1 = (pSrc[xSrc]>>16)&0xFF; a1 = (pSrc[xSrc]>>24)&0xFF; - if( xSrc>0)&0xFF; - g2 = (pSrc[xSrc+1]>>8)&0xFF; - r2 = (pSrc[xSrc+1]>>16)&0xFF; - a2 = (pSrc[xSrc+1]>>24)&0xFF; - } - - if( ySrc>0)&0xFF; - g3 = (pSrc2[xSrc]>>8)&0xFF; - r3 = (pSrc2[xSrc]>>16)&0xFF; - a3 = (pSrc2[xSrc]>>24)&0xFF; - if( xSrc>0)&0xFF; - g4 = (pSrc2[xSrc+1]>>8)&0xFF; - r4 = (pSrc2[xSrc+1]>>16)&0xFF; - a4 = (pSrc2[xSrc+1]>>24)&0xFF; - } - } - - // Pixel 1 pDst1[xSrc*2] = pSrc[xSrc]; // Pixel 2 if( xSrc>0)&0xFF; + g2 = (pSrc[xSrc+1]>>8)&0xFF; + r2 = (pSrc[xSrc+1]>>16)&0xFF; + a2 = (pSrc[xSrc+1]>>24)&0xFF; pDst1[xSrc*2+1] = DWORD_MAKE((r1+r2)/2, (g1+g2)/2, (b1+b2)/2, (a1+a2)/2); } else pDst1[xSrc*2+1] = pSrc[xSrc]; - // Pixel 3 if( ySrc>0)&0xFF; + g3 = (pSrc2[xSrc]>>8)&0xFF; + r3 = (pSrc2[xSrc]>>16)&0xFF; + a3 = (pSrc2[xSrc]>>24)&0xFF; pDst2[xSrc*2] = DWORD_MAKE((r1+r3)/2, (g1+g3)/2, (b1+b3)/2, (a1+a3)/2); - } - else - pDst2[xSrc*2] = pSrc[xSrc]; - - // Pixel 4 - if( xSrc>0)&0xFF; + g4 = (pSrc2[xSrc+1]>>8)&0xFF; + r4 = (pSrc2[xSrc+1]>>16)&0xFF; + a4 = (pSrc2[xSrc+1]>>24)&0xFF; + // Pixel 4 pDst2[xSrc*2+1] = DWORD_MAKE((r1+r2+r3+r4)/4, (g1+g2+g3+g4)/4, (b1+b2+b3+b4)/4, (a1+a2+a3+a4)/4); } else { - pDst2[xSrc*2+1] = DWORD_MAKE((r1+r2)/2, (g1+g2)/2, (b1+b2)/2, (a1+a2)/2); + // Pixel 4 + pDst2[xSrc*2+1] = DWORD_MAKE((r1+r3)/2, (g1+g3)/2, (b1+b3)/2, (a1+a3)/2); } } else { - if( ySrc