From 93f6b01e0bd3bbcf2dc23f3715980c7ae30d0e5e Mon Sep 17 00:00:00 2001 From: Ian Curtis Date: Tue, 22 Mar 2016 12:30:23 +0000 Subject: [PATCH] Update project to vs 2013. Clean compile warnings --- Src/Graphics/Legacy3D/Legacy3D.cpp | 12 ++++++------ Src/Graphics/Legacy3D/Models.cpp | 2 +- Src/Graphics/New3D/OglStateCache.cpp | 2 -- Src/Graphics/New3D/OglStateCache.h | 2 -- Src/Graphics/New3D/PolyHeader.cpp | 24 ++++++++++++------------ Src/Graphics/Render2D.cpp | 14 +++++++------- Src/INIFile.cpp | 2 +- Src/Inputs/InputSystem.cpp | 2 +- Src/Model3/Model3.cpp | 1 - Src/OSD/SDL/Main.cpp | 5 ----- VS2008/Supermodel.sln | 21 +++++++++------------ 11 files changed, 37 insertions(+), 50 deletions(-) delete mode 100644 Src/Graphics/New3D/OglStateCache.cpp delete mode 100644 Src/Graphics/New3D/OglStateCache.h diff --git a/Src/Graphics/Legacy3D/Legacy3D.cpp b/Src/Graphics/Legacy3D/Legacy3D.cpp index 67cae92..4f819ad 100644 --- a/Src/Graphics/Legacy3D/Legacy3D.cpp +++ b/Src/Graphics/Legacy3D/Legacy3D.cpp @@ -405,7 +405,7 @@ void CLegacy3D::UploadTextures(unsigned x, unsigned y, unsigned width, unsigned textureBuffer[i++] = 0.0f; textureBuffer[i++] = 1.0f; } -#endif +#endif // Update all texture sheets for (size_t texSheet = 0; texSheet < numTexSheets; texSheet++) @@ -581,7 +581,7 @@ static bool IsDynamicModel(const UINT32 *data) unsigned numVerts = (data[0]&0x40 ? 4 : 3); // Deduct number of reused verts numVerts -= sharedVerts[data[0]&0xf]; - done = data[1]&4; + done = data[1] & 4 > 0; // Skip header and vertices to next polygon data += 7 + numVerts * 4; } @@ -633,7 +633,7 @@ bool CLegacy3D::DrawModel(UINT32 modelAddr) Cache = &PolyCache; ModelRef = CacheModel(Cache, lutIdx, texOffset, model); if (NULL == ModelRef) - { + { // Model could not be cached. Render what we have so far and try again. DrawDisplayList(&VROMCache, POLY_STATE_NORMAL); DrawDisplayList(&PolyCache, POLY_STATE_NORMAL); @@ -974,8 +974,8 @@ void CLegacy3D::RenderViewport(UINT32 addr, int pri) void CLegacy3D::RenderFrame(void) { - // Begin frame - ClearErrors(); // must be cleared each frame + // Begin frame + ClearErrors(); // must be cleared each frame //printf("BEGIN FRAME\n"); // Z buffering (Z buffer is cleared by display list viewport nodes) @@ -1328,7 +1328,7 @@ CLegacy3D::CLegacy3D(void) CLegacy3D::~CLegacy3D(void) { DestroyShaderProgram(shaderProgram,vertexShader,fragmentShader); - if (glBindBuffer != NULL) // we may have failed earlier due to lack of OpenGL 2.0 functions + if (glBindBuffer != NULL) // we may have failed earlier due to lack of OpenGL 2.0 functions glBindBuffer(GL_ARRAY_BUFFER, 0); // disable VBOs by binding to 0 glDeleteTextures(numTexMaps, texMapIDs); diff --git a/Src/Graphics/Legacy3D/Models.cpp b/Src/Graphics/Legacy3D/Models.cpp index 3301853..3db0381 100644 --- a/Src/Graphics/Legacy3D/Models.cpp +++ b/Src/Graphics/Legacy3D/Models.cpp @@ -753,7 +753,7 @@ struct VBORef *CLegacy3D::CacheModel(ModelCache *Cache, int lutIdx, UINT16 texOf bool validPoly = (P.header[0] & 0x300) != 0x300; // Obtain basic polygon parameters - done = P.header[1]&4; // last polygon? + done = P.header[1] & 4 > 0; // last polygon? P.numVerts = (P.header[0]&0x40)?4:3; // Texture data diff --git a/Src/Graphics/New3D/OglStateCache.cpp b/Src/Graphics/New3D/OglStateCache.cpp deleted file mode 100644 index 66f218b..0000000 --- a/Src/Graphics/New3D/OglStateCache.cpp +++ /dev/null @@ -1,2 +0,0 @@ -namespace New3D { -} // New3D diff --git a/Src/Graphics/New3D/OglStateCache.h b/Src/Graphics/New3D/OglStateCache.h deleted file mode 100644 index 66f218b..0000000 --- a/Src/Graphics/New3D/OglStateCache.h +++ /dev/null @@ -1,2 +0,0 @@ -namespace New3D { -} // New3D diff --git a/Src/Graphics/New3D/PolyHeader.cpp b/Src/Graphics/New3D/PolyHeader.cpp index 96fdea2..777158f 100644 --- a/Src/Graphics/New3D/PolyHeader.cpp +++ b/Src/Graphics/New3D/PolyHeader.cpp @@ -299,18 +299,18 @@ UINT64 PolyHeader::Hash(int textureXOffset, int textureYOffset) { UINT64 hash = 0; - hash |= (header[2] & 3); // bits 0-1 uv mirror bits - hash |= ((header[3] >> 0) & 7) << 2; // bits 2-4 tex height - hash |= ((header[3] >> 3) & 7) << 5; // bits 5-7 tex width - hash |= X(textureXOffset) << 8; // bits 8-17 x offset - hash |= Y(textureYOffset) << 18; // bits 18-27 y offset - hash |= TexFormat() << 28; // bits 28-30 tex format - hash |= (UINT64)TexEnabled() << 31; // bits 31 textures enabled - hash |= (UINT64)LightEnabled() << 32; // bits 32 light enabled - hash |= (UINT64)DoubleSided() << 33; // bits 33 double sided - hash |= (UINT64)AlphaTest() << 34; // bits 34 contour processing - hash |= (UINT64)PolyAlpha() << 35; // bits 35 poly alpha processing - hash |= (UINT64)TextureAlpha() << 36; // bits 35 poly alpha processing + hash |= (header[2] & 3); // bits 0-1 uv mirror bits + hash |= (UINT64)((header[3] >> 0) & 7) << 2; // bits 2-4 tex height + hash |= (UINT64)((header[3] >> 3) & 7) << 5; // bits 5-7 tex width + hash |= (UINT64)X(textureXOffset) << 8; // bits 8-17 x offset + hash |= (UINT64)Y(textureYOffset) << 18; // bits 18-27 y offset + hash |= (UINT64)TexFormat() << 28; // bits 28-30 tex format + hash |= (UINT64)TexEnabled() << 31; // bits 31 textures enabled + hash |= (UINT64)LightEnabled() << 32; // bits 32 light enabled + hash |= (UINT64)DoubleSided() << 33; // bits 33 double sided + hash |= (UINT64)AlphaTest() << 34; // bits 34 contour processing + hash |= (UINT64)PolyAlpha() << 35; // bits 35 poly alpha processing + hash |= (UINT64)TextureAlpha() << 36; // bits 35 poly alpha processing //to do add the rest of the states diff --git a/Src/Graphics/Render2D.cpp b/Src/Graphics/Render2D.cpp index 720e72c..2a6226f 100644 --- a/Src/Graphics/Render2D.cpp +++ b/Src/Graphics/Render2D.cpp @@ -22,8 +22,8 @@ /* * Render2D.cpp * - * Implementation of the CRender2D class: OpenGL tile generator graphics. - * + * Implementation of the CRender2D class: OpenGL tile generator graphics. + * * To-Do List * ---------- * - Is there a better way to handle the overscan regions in wide screen mode? @@ -372,7 +372,7 @@ void CRender2D::DrawTileLine8BitNoClip(UINT32 *buf, UINT16 tile, int tileLine, c void CRender2D::DrawLine(UINT32 *dest, int layerNum, int y, const UINT16 *nameTableBase, const UINT32 *pal) { // Determine the layer color depth (4 or 8-bit pixels) - bool is4Bit = regs[0x20/4] & (1<<(12+layerNum)); + bool is4Bit = (regs[0x20 / 4] & (1 << (12 + layerNum))) > 0; // Compute offsets due to vertical scrolling int vScroll = (regs[0x60/4+layerNum]>>16)&0x1FF; @@ -551,7 +551,7 @@ bool CRender2D::DrawTilemaps(UINT32 *destBottom, UINT32 *destTop) // Load horizontal full-screen scroll values and scroll mode hFullScroll[i] = regs[0x60/4+i]&0x3FF; - lineScrollMode[i] = regs[0x60/4+i]&0x8000; + lineScrollMode[i] = (regs[0x60 / 4 + i] & 0x8000)>0; } /* @@ -721,7 +721,7 @@ void CRender2D::EndFrame(void) /****************************************************************************** Emulation Callbacks ******************************************************************************/ - + // Deprecated void CRender2D::WriteVRAM(unsigned addr, UINT32 data) { @@ -763,7 +763,7 @@ bool CRender2D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned // Load shaders if (OKAY != LoadShaderProgram(&shaderProgram,&vertexShader,&fragmentShader,NULL,NULL,vertexShaderSource,fragmentShaderSource)) - return FAIL; + return FAIL; // Get locations of the uniforms glUseProgram(shaderProgram); // bind program @@ -828,7 +828,7 @@ CRender2D::CRender2D(void) } CRender2D::~CRender2D(void) -{ +{ DestroyShaderProgram(shaderProgram,vertexShader,fragmentShader); glDeleteTextures(2, texID); diff --git a/Src/INIFile.cpp b/Src/INIFile.cpp index ee20884..b69a5fe 100644 --- a/Src/INIFile.cpp +++ b/Src/INIFile.cpp @@ -326,7 +326,7 @@ bool CINIFile::Get(string SectionName, string SettingName, bool& value) if (Get(SectionName, SettingName, intVal) == FAIL) return FAIL; - value = (bool)intVal; + value = intVal > 0; return OKAY; } diff --git a/Src/Inputs/InputSystem.cpp b/Src/Inputs/InputSystem.cpp index fa80a2d..f888094 100644 --- a/Src/Inputs/InputSystem.cpp +++ b/Src/Inputs/InputSystem.cpp @@ -1896,7 +1896,7 @@ bool CInputSystem::DetectJoystickAxis(unsigned joyNum, unsigned &axisNum, const } if (maxRange > 3000) - printf("Detected\n", joyDetails->axisName[axisNum]); + printf("Detected %i\n", (int)joyDetails->axisName[axisNum]); else { cancelled = true; diff --git a/Src/Model3/Model3.cpp b/Src/Model3/Model3.cpp index 00b9240..3aed4b4 100644 --- a/Src/Model3/Model3.cpp +++ b/Src/Model3/Model3.cpp @@ -2981,7 +2981,6 @@ static void Reverse32(UINT8 *buf, unsigned size) static void ReadCROMDirectly(UINT8 *crom, char *fileName[4], unsigned combinedSize) { FILE *fp[4] = { NULL, NULL, NULL, NULL }; - long size[4]; // Open all files for (int i = 0; i < 4; i++) diff --git a/Src/OSD/SDL/Main.cpp b/Src/OSD/SDL/Main.cpp index 7d54cce..01ec313 100644 --- a/Src/OSD/SDL/Main.cpp +++ b/Src/OSD/SDL/Main.cpp @@ -249,11 +249,6 @@ static bool CreateGLScreen(const char *caption, unsigned *xOffsetPtr, unsigned * static bool ResizeGLScreen(unsigned *xOffsetPtr, unsigned *yOffsetPtr, unsigned *xResPtr, unsigned *yResPtr, unsigned *totalXResPtr, unsigned *totalYResPtr, bool keepAspectRatio, bool fullScreen) { - const SDL_VideoInfo *VideoInfo; - GLenum err; - float model3Ratio, ratio; - float xRes, yRes; - // Set video mode if (SDL_SetVideoMode(*xResPtr,*yResPtr,0,SDL_OPENGL|(fullScreen?SDL_FULLSCREEN|SDL_HWSURFACE:0)) == NULL) { diff --git a/VS2008/Supermodel.sln b/VS2008/Supermodel.sln index 88659a4..800ef25 100755 --- a/VS2008/Supermodel.sln +++ b/VS2008/Supermodel.sln @@ -1,20 +1,17 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Supermodel", "Supermodel.vcproj", "{B114BBD9-8AEA-4DAE-B367-A66A804CB3DD}" - ProjectSection(ProjectDependencies) = postProject - {1248CF7C-B122-461C-9624-196AEFAE5046} = {1248CF7C-B122-461C-9624-196AEFAE5046} - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} - EndProjectSection +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Supermodel", "Supermodel.vcxproj", "{B114BBD9-8AEA-4DAE-B367-A66A804CB3DD}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "SDLmain\SDLmain.vcproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "SDL\SDL.vcproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZLib", "ZLib\ZLib.vcproj", "{248D61E0-2E9B-4C73-8839-A31FBCB7D109}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZLib", "ZLib\ZLib.vcxproj", "{248D61E0-2E9B-4C73-8839-A31FBCB7D109}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Musashi68K", "Musashi68K\Musashi68K.vcproj", "{1248CF7C-B122-461C-9624-196AEFAE5046}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Musashi68K", "Musashi68K\Musashi68K.vcxproj", "{1248CF7C-B122-461C-9624-196AEFAE5046}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution