diff --git a/Source/3rdParty/7zip/7zip.vcxproj b/Source/3rdParty/7zip/7zip.vcxproj index f67081340..40476ef86 100644 --- a/Source/3rdParty/7zip/7zip.vcxproj +++ b/Source/3rdParty/7zip/7zip.vcxproj @@ -34,7 +34,8 @@ - 4127;%(DisableSpecificWarnings) + Level3 + 4127;4456;%(DisableSpecificWarnings) diff --git a/Source/3rdParty/discord-rpc/connection_win.cpp b/Source/3rdParty/discord-rpc/connection_win.cpp index 2dd2750c0..6651aabb9 100644 --- a/Source/3rdParty/discord-rpc/connection_win.cpp +++ b/Source/3rdParty/discord-rpc/connection_win.cpp @@ -1,6 +1,8 @@ #include "connection.h" +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif #define NOMCX #define NOSERVICE #define NOIME diff --git a/Source/3rdParty/discord-rpc/discord_register_win.cpp b/Source/3rdParty/discord-rpc/discord_register_win.cpp index e441318dd..8b275f9c2 100644 --- a/Source/3rdParty/discord-rpc/discord_register_win.cpp +++ b/Source/3rdParty/discord-rpc/discord_register_win.cpp @@ -1,7 +1,9 @@ #include "discord_rpc.h" #include "discord_register.h" +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif #define NOMCX #define NOSERVICE #define NOIME diff --git a/Source/3rdParty/duktape/duktape.vcproj b/Source/3rdParty/duktape/duktape.vcproj deleted file mode 100644 index 93f513c41..000000000 --- a/Source/3rdParty/duktape/duktape.vcproj +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/3rdParty/duktape/duktape.vcxproj b/Source/3rdParty/duktape/duktape.vcxproj index e6c74a914..bb1896dd3 100644 --- a/Source/3rdParty/duktape/duktape.vcxproj +++ b/Source/3rdParty/duktape/duktape.vcxproj @@ -34,7 +34,7 @@ - Level4 + Level3 diff --git a/Source/3rdParty/zlib/zlib.vcxproj b/Source/3rdParty/zlib/zlib.vcxproj index 49e5c11b0..32b4b7ea9 100644 --- a/Source/3rdParty/zlib/zlib.vcxproj +++ b/Source/3rdParty/zlib/zlib.vcxproj @@ -34,9 +34,8 @@ - Level4 - 4100;4127;4131;4189;4244;4701;4703;4996 - + Level3 + 4005;4006;4100;4127;4131;4189;4244;4701;4703;4996 Z_BUFSIZE=46516;$(PreprocessorDefinitions) @@ -59,8 +58,6 @@ - - diff --git a/Source/3rdParty/zlib/zlib.vcxproj.filters b/Source/3rdParty/zlib/zlib.vcxproj.filters index f611451e9..21e32cc8b 100644 --- a/Source/3rdParty/zlib/zlib.vcxproj.filters +++ b/Source/3rdParty/zlib/zlib.vcxproj.filters @@ -78,12 +78,6 @@ Minizip - - Minizip - - - Minizip - diff --git a/Source/Android/PluginRSP/PluginRSP.vcxproj b/Source/Android/PluginRSP/PluginRSP.vcxproj index 81f9dc27c..1165dba24 100644 --- a/Source/Android/PluginRSP/PluginRSP.vcxproj +++ b/Source/Android/PluginRSP/PluginRSP.vcxproj @@ -33,6 +33,8 @@ NotUsing + Level3 + 4800;%(DisableSpecificWarnings) diff --git a/Source/Common/md5.cpp b/Source/Common/md5.cpp index 9154ccfc8..f94488a54 100644 --- a/Source/Common/md5.cpp +++ b/Source/Common/md5.cpp @@ -107,15 +107,15 @@ void MD5::update(const uint1 *input, uint4 input_length) void MD5::update(FILE *file) { - unsigned char buffer[1024]; + unsigned char update_buffer[1024]; int len; do { - len = (int)fread(buffer, 1, 1024, file); + len = (int)fread(update_buffer, 1, 1024, file); if (len) { - update(buffer, len); + update(update_buffer, len); } } while (len); diff --git a/Source/Project64-core/N64System/Enhancement/Enhancements.cpp b/Source/Project64-core/N64System/Enhancement/Enhancements.cpp index c2f4beeee..2dffd1a76 100644 --- a/Source/Project64-core/N64System/Enhancement/Enhancements.cpp +++ b/Source/Project64-core/N64System/Enhancement/Enhancements.cpp @@ -53,7 +53,7 @@ void CEnhancements::ApplyActive(CMipsMemoryVM & MMU, bool UpdateChanges) } } -void CEnhancements::ApplyGSButton(CMipsMemoryVM & MMU, bool UpdateChanges) +void CEnhancements::ApplyGSButton(CMipsMemoryVM & MMU, bool /*UpdateChanges*/) { for (size_t i = 0, n = m_ActiveCodes.size(); i < n; i++) { diff --git a/Source/Project64-core/N64System/Interpreter/InterpreterOps.cpp b/Source/Project64-core/N64System/Interpreter/InterpreterOps.cpp index 69d5ea5d3..655e464a1 100644 --- a/Source/Project64-core/N64System/Interpreter/InterpreterOps.cpp +++ b/Source/Project64-core/N64System/Interpreter/InterpreterOps.cpp @@ -2232,7 +2232,7 @@ void R4300iOp::REGIMM_TGEIU() int64_t imm64; imm64 = imm32; - if (_GPR[m_Opcode.rs].DW >= (uint64_t)imm64) + if (_GPR[m_Opcode.rs].UDW >= (uint64_t)imm64) { g_Reg->DoTrapException(m_NextInstruction == JUMP); } @@ -2252,7 +2252,7 @@ void R4300iOp::REGIMM_TLTIU() int64_t imm64; imm64 = imm32; - if (_GPR[m_Opcode.rs].DW < (uint64_t)imm64) + if (_GPR[m_Opcode.rs].UDW < (uint64_t)imm64) { g_Reg->DoTrapException(m_NextInstruction == JUMP); } diff --git a/Source/Project64-core/N64System/Mips/Disk.cpp b/Source/Project64-core/N64System/Mips/Disk.cpp index bcbe613ab..d62eb1021 100644 --- a/Source/Project64-core/N64System/Mips/Disk.cpp +++ b/Source/Project64-core/N64System/Mips/Disk.cpp @@ -343,13 +343,13 @@ void DiskBMUpdate() } } -bool DiskBMReadWrite(bool write) +bool DiskBMReadWrite(bool /*write*/) { //Returns true if error uint16_t head = ((g_Reg->ASIC_CUR_TK >> 16) / 0x1000) & 1; uint16_t track = (g_Reg->ASIC_CUR_TK >> 16) & 0xFFF; - uint16_t block = dd_start_block; - uint16_t sector = dd_current; + uint16_t block = (uint16_t)dd_start_block; + uint16_t sector = (uint16_t)dd_current; uint16_t sectorsize = (((g_Reg->ASIC_HOST_SECBYTE & 0x00FF0000) >> 16) + 1); uint32_t addr = g_Disk->GetDiskAddressBlock(head, track, block, sector, sectorsize); diff --git a/Source/Project64-core/N64System/Mips/GBCart.cpp b/Source/Project64-core/N64System/Mips/GBCart.cpp index 1dc729930..e0bac8269 100644 --- a/Source/Project64-core/N64System/Mips/GBCart.cpp +++ b/Source/Project64-core/N64System/Mips/GBCart.cpp @@ -308,7 +308,7 @@ static void read_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, uint8_t { for (int i = 0; i < 32; i++) { - data[i] = gb_cart->rtc_latch_data[gb_cart->ram_bank - 0x08]; + data[i] = (uint8_t)(gb_cart->rtc_latch_data[gb_cart->ram_bank - 0x08]); } } else @@ -316,7 +316,7 @@ static void read_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, uint8_t memoryUpdateMBC3Clock(gb_cart); for (int i = 0; i < 32; i++) { - data[i] = gb_cart->rtc_data[gb_cart->ram_bank - 0x08]; + data[i] = (uint8_t)(gb_cart->rtc_data[gb_cart->ram_bank - 0x08]); } } } @@ -390,17 +390,17 @@ static void write_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, const } } -static void read_gb_cart_mbc4(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) +static void read_gb_cart_mbc4(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, uint8_t * /*data*/) { g_Notify->BreakPoint(__FILE__, __LINE__); } -static void write_gb_cart_mbc4(struct gb_cart* gb_cart, uint16_t address, const uint8_t* data) +static void write_gb_cart_mbc4(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, const uint8_t * /*data*/) { g_Notify->BreakPoint(__FILE__, __LINE__); } -static void read_gb_cart_mbc5(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) +static void read_gb_cart_mbc5(struct gb_cart * gb_cart, uint16_t address, uint8_t * data) { size_t offset; @@ -468,17 +468,17 @@ static void write_gb_cart_mbc5(struct gb_cart* gb_cart, uint16_t address, const } } -static void read_gb_cart_mmm01(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) +static void read_gb_cart_mmm01(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, uint8_t * /*data*/) { g_Notify->BreakPoint(__FILE__, __LINE__); } -static void write_gb_cart_mmm01(struct gb_cart* gb_cart, uint16_t address, const uint8_t* data) +static void write_gb_cart_mmm01(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, const uint8_t * /*data*/) { g_Notify->BreakPoint(__FILE__, __LINE__); } -static void read_gb_cart_pocket_cam(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) +static void read_gb_cart_pocket_cam(struct gb_cart * gb_cart, uint16_t address, uint8_t * data) { size_t offset; @@ -569,32 +569,32 @@ static void write_gb_cart_pocket_cam(struct gb_cart* gb_cart, uint16_t address, } } -static void read_gb_cart_bandai_tama5(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) +static void read_gb_cart_bandai_tama5(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, uint8_t * /*data*/) { g_Notify->BreakPoint(__FILE__, __LINE__); } -static void write_gb_cart_bandai_tama5(struct gb_cart* gb_cart, uint16_t address, const uint8_t* data) +static void write_gb_cart_bandai_tama5(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, const uint8_t * /*data*/) { g_Notify->BreakPoint(__FILE__, __LINE__); } -static void read_gb_cart_huc1(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) +static void read_gb_cart_huc1(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, uint8_t * /*data*/) { g_Notify->BreakPoint(__FILE__, __LINE__); } -static void write_gb_cart_huc1(struct gb_cart* gb_cart, uint16_t address, const uint8_t* data) +static void write_gb_cart_huc1(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, const uint8_t * /*data*/) { g_Notify->BreakPoint(__FILE__, __LINE__); } -static void read_gb_cart_huc3(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) +static void read_gb_cart_huc3(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, uint8_t * /*data*/) { g_Notify->BreakPoint(__FILE__, __LINE__); } -static void write_gb_cart_huc3(struct gb_cart* gb_cart, uint16_t address, const uint8_t* data) +static void write_gb_cart_huc3(struct gb_cart * /*gb_cart*/, uint16_t /*address*/, const uint8_t * /*data*/) { g_Notify->BreakPoint(__FILE__, __LINE__); } diff --git a/Source/Project64-core/N64System/Mips/PifRam.cpp b/Source/Project64-core/N64System/Mips/PifRam.cpp index b5b1642eb..9ea460a6b 100644 --- a/Source/Project64-core/N64System/Mips/PifRam.cpp +++ b/Source/Project64-core/N64System/Mips/PifRam.cpp @@ -516,7 +516,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command) { case PLUGIN_RUMBLE_PAK: Rumblepak::ReadFrom(address, data); break; case PLUGIN_MEMPAK: g_Mempak->ReadFrom(Control, address, data); break; - case PLUGIN_TANSFER_PAK: Transferpak::ReadFrom(address, data); break; + case PLUGIN_TANSFER_PAK: Transferpak::ReadFrom((uint16_t)address, data); break; case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break; default: memset(&Command[5], 0, 0x20); @@ -548,7 +548,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command) g_Notify->DisplayError("What am I meant to do with this Controller Command"); } } - if (Controllers[Control].Present == true) + if (Controllers[Control].Present != 0) { uint32_t address = (Command[3] << 8) | (Command[4] & 0xE0); uint8_t* data = &Command[5]; @@ -557,7 +557,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command) { case PLUGIN_MEMPAK: g_Mempak->WriteTo(Control, address, data); break; case PLUGIN_RUMBLE_PAK: Rumblepak::WriteTo(Control, address, data); break; - case PLUGIN_TANSFER_PAK: Transferpak::WriteTo(address, data); break; + case PLUGIN_TANSFER_PAK: Transferpak::WriteTo((uint16_t)address, data); break; case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break; } diff --git a/Source/Project64-core/N64System/Mips/Sram.cpp b/Source/Project64-core/N64System/Mips/Sram.cpp index 61d155a0b..8905dee3a 100644 --- a/Source/Project64-core/N64System/Mips/Sram.cpp +++ b/Source/Project64-core/N64System/Mips/Sram.cpp @@ -46,10 +46,8 @@ bool CSram::LoadSram() return true; } -void CSram::DmaFromSram(uint8_t * dest, int32_t StartOffset, int32_t len) +void CSram::DmaFromSram(uint8_t * dest, int32_t StartOffset, uint32_t len) { - uint32_t i; - if (!m_File.IsOpen()) { if (!LoadSram()) @@ -68,7 +66,7 @@ void CSram::DmaFromSram(uint8_t * dest, int32_t StartOffset, int32_t len) } else { - for (i = 0; i < len; i++) + for (uint32_t i = 0; i < len; i++) { m_File.Seek((StartOffset + i) ^ 3, CFile::begin); m_File.Read((uint8_t*)(((uint32_t)dest + i) ^ 3), 1); @@ -76,10 +74,8 @@ void CSram::DmaFromSram(uint8_t * dest, int32_t StartOffset, int32_t len) } } -void CSram::DmaToSram(uint8_t * Source, int32_t StartOffset, int32_t len) +void CSram::DmaToSram(uint8_t * Source, int32_t StartOffset, uint32_t len) { - uint32_t i; - if (m_ReadOnly) { return; @@ -103,7 +99,7 @@ void CSram::DmaToSram(uint8_t * Source, int32_t StartOffset, int32_t len) } else { - for (i = 0; i < len; i++) + for (uint32_t i = 0; i < len; i++) { m_File.Seek((StartOffset + i) ^ 3, CFile::begin); m_File.Write((uint8_t*)(((uint32_t)Source + i) ^ 3), 1); diff --git a/Source/Project64-core/N64System/Mips/Sram.h b/Source/Project64-core/N64System/Mips/Sram.h index 86758c2a2..50a742437 100644 --- a/Source/Project64-core/N64System/Mips/Sram.h +++ b/Source/Project64-core/N64System/Mips/Sram.h @@ -16,8 +16,8 @@ public: CSram(bool ReadOnly); ~CSram(); - void DmaFromSram(uint8_t * dest, int32_t StartOffset, int32_t len); - void DmaToSram(uint8_t * Source, int32_t StartOffset, int32_t len); + void DmaFromSram(uint8_t * dest, int32_t StartOffset, uint32_t len); + void DmaToSram(uint8_t * Source, int32_t StartOffset, uint32_t len); private: CSram(void); // Disable default constructor diff --git a/Source/Project64-core/N64System/N64Class.cpp b/Source/Project64-core/N64System/N64Class.cpp index 23a80d079..a0e3a6a3b 100644 --- a/Source/Project64-core/N64System/N64Class.cpp +++ b/Source/Project64-core/N64System/N64Class.cpp @@ -914,7 +914,6 @@ void CN64System::Reset(bool bInitReg, bool ClearMenory) bool CN64System::SetActiveSystem(bool bActive) { - bool bReset = false; bool bRes = true; if (bActive && g_System == this) diff --git a/Source/Project64-core/N64System/N64DiskClass.cpp b/Source/Project64-core/N64System/N64DiskClass.cpp index d27844a25..5f973dd52 100644 --- a/Source/Project64-core/N64System/N64DiskClass.cpp +++ b/Source/Project64-core/N64System/N64DiskClass.cpp @@ -645,14 +645,18 @@ uint32_t CN64Disk::GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t b if (offset < (BLOCKSIZE(0) * SYSTEM_LBAS) && sector == 0) { - uint16_t block = offset / (BLOCKSIZE(0)); - uint16_t block_sys = m_DiskSysAddress / (BLOCKSIZE(0)); - uint16_t block_id = m_DiskIDAddress / (BLOCKSIZE(0)); + uint16_t AddressBlock = (uint16_t)(offset / (BLOCKSIZE(0))); + uint16_t block_sys = (uint16_t)(m_DiskSysAddress / (BLOCKSIZE(0))); + uint16_t block_id = (uint16_t)(m_DiskIDAddress / (BLOCKSIZE(0))); - if (block < 12 && block != block_sys) + if (AddressBlock < 12 && AddressBlock != block_sys) + { offset = 0xFFFFFFFF; - else if (block > 12 && block < 16 && block != block_id) + } + else if (AddressBlock > 12 && AddressBlock < 16 && AddressBlock != block_id) + { offset = 0xFFFFFFFF; + } } } else if (m_DiskFormat == DiskFormatSDK) @@ -662,14 +666,18 @@ uint32_t CN64Disk::GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t b if (offset < (BLOCKSIZE(0) * SYSTEM_LBAS) && sector == 0) { - uint16_t block = offset / (BLOCKSIZE(0)); - uint16_t block_sys = m_DiskSysAddress / (BLOCKSIZE(0)); - uint16_t block_id = m_DiskIDAddress / (BLOCKSIZE(0)); + uint16_t AddressBlock = (uint16_t)(offset / (BLOCKSIZE(0))); + uint16_t block_sys = (uint16_t)(m_DiskSysAddress / (BLOCKSIZE(0))); + uint16_t block_id = (uint16_t)(m_DiskIDAddress / (BLOCKSIZE(0))); - if (block < 12 && block != block_sys) + if (AddressBlock < 12 && AddressBlock != block_sys) + { offset = 0xFFFFFFFF; - else if (block > 12 && block < 16 && block != block_id) + } + else if (AddressBlock > 12 && AddressBlock < 16 && AddressBlock != block_id) + { offset = 0xFFFFFFFF; + } } } else @@ -771,7 +779,7 @@ bool CN64Disk::IsSysSectorGood(uint32_t block, uint32_t sectorsize) //Checks if all sectors are identical (meant only to be used for System Area for MAME and SDK formats) for (int j = 1; j < SECTORS_PER_BLOCK; j++) { - for (int k = 0; k < sectorsize; k++) + for (uint32_t k = 0; k < sectorsize; k++) { if (m_DiskImage[(block * 0x4D08) + (j * sectorsize) + k] != m_DiskImage[(block * 0x4D08) + k]) { @@ -889,6 +897,7 @@ uint32_t CN64Disk::LBAToVZone(uint32_t lba) return vzone; } } + return 0; }; uint32_t CN64Disk::LBAToByte(uint32_t lba, uint32_t nlbas) @@ -896,7 +905,7 @@ uint32_t CN64Disk::LBAToByte(uint32_t lba, uint32_t nlbas) bool init_flag = true; uint32_t totalbytes = 0; uint32_t blocksize = 0; - uint32_t vzone, pzone = 0; + uint32_t vzone = 0, pzone = 0; if (nlbas != 0) { for (; nlbas != 0; nlbas--) @@ -935,7 +944,7 @@ uint16_t CN64Disk::LBAToPhys(uint32_t lba) block = 0; //Get Virtual & Physical Disk Zones - uint16_t vzone = LBAToVZone(lba); + uint16_t vzone = (uint16_t)LBAToVZone(lba); uint16_t pzone = VZoneToPZone(vzone, m_DiskType); //Get Disk Head @@ -952,7 +961,7 @@ uint16_t CN64Disk::LBAToPhys(uint32_t lba) vzone_lba = VZONE_LBA_TBL[m_DiskType][vzone - 1]; //Calculate Physical Track - uint16_t track = (lba - vzone_lba) >> 1; + uint16_t track = (uint16_t)((lba - vzone_lba) >> 1); //Get the start track from current zone uint16_t track_zone_start = SCYL_ZONE_TBL[0][pzone]; diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.cpp index 7a53da19c..d4509a00a 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.cpp @@ -319,12 +319,12 @@ void CX86RegInfo::Load_FPR_ToTop(int32_t Reg, int32_t RegToLoad, FPU_STATE Forma else { x86FpuValues RegPos = x86_ST_Unknown; - for (uint32_t i = 0; i < 8; i++) + for (uint32_t z = 0; z < 8; z++) { - if (m_x86fpu_MappedTo[i] == Reg) + if (m_x86fpu_MappedTo[z] == Reg) { RegPos = (x86FpuValues)i; - i = 8; + z = 8; } } diff --git a/Source/Project64-video/Gfx_1.3.h b/Source/Project64-video/Gfx_1.3.h index 2de81039f..95929a551 100644 --- a/Source/Project64-video/Gfx_1.3.h +++ b/Source/Project64-video/Gfx_1.3.h @@ -18,9 +18,9 @@ #include #include // offsetof #include -#include "rdp.h" #include "Config.h" #include "Settings.h" +#include "rdp.h" #if defined __VISUALC__ #define GLIDE64_TRY __try diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index 589496fb5..7604d78e5 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -11,6 +11,11 @@ * version 2 of the License, or (at your option) any later version. * * * ****************************************************************************/ +#ifdef _WIN32 +#include +#include +#endif + #include #include #include @@ -35,12 +40,6 @@ #include "DepthBufferRender.h" #include "trace.h" #include "ScreenResolution.h" - -#ifdef _WIN32 -#include -#include -#endif - #include #ifdef ANDROID diff --git a/Source/Project64-video/Project64-video.vcxproj b/Source/Project64-video/Project64-video.vcxproj index c8db003de..1b933c04e 100644 --- a/Source/Project64-video/Project64-video.vcxproj +++ b/Source/Project64-video/Project64-video.vcxproj @@ -44,6 +44,7 @@ NO_ASM;%(PreprocessorDefinitions) RDP_LOGGING;RDP_ERROR_LOG;%(PreprocessorDefinitions) + 4611 "$(SolutionDir)Source\Script\UpdateVersion.cmd" "$(Configuration)" "$(Platform)" "$(SolutionDir)Source\Project64-video\Version.h.in" "$(SolutionDir)Source\Project64-video\Version.h" diff --git a/Source/Project64-video/Renderer/OGLglitchmain.cpp b/Source/Project64-video/Renderer/OGLglitchmain.cpp index e87d256aa..c592cc9b2 100644 --- a/Source/Project64-video/Renderer/OGLglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLglitchmain.cpp @@ -1561,8 +1561,8 @@ bool gfxLfbReadRegion(gfxBuffer_t src_buffer, uint32_t src_x, uint32_t src_y, ui { unsigned char *buf; unsigned int i, j; - unsigned short *frameBuffer = (unsigned short*)dst_data; - unsigned short *depthBuffer = (unsigned short*)dst_data; + unsigned short *TargetFrameBuffer = (unsigned short*)dst_data; + unsigned short *TargetDepthBuffer = (unsigned short*)dst_data; WriteTrace(TraceGlitch, TraceDebug, "src_buffer: %d src_x: %d src_y: %d src_width: %d src_height: %d dst_stride: %d", src_buffer, src_x, src_y, src_width, src_height, dst_stride); switch (src_buffer) @@ -1590,7 +1590,7 @@ bool gfxLfbReadRegion(gfxBuffer_t src_buffer, uint32_t src_x, uint32_t src_y, ui { for (i = 0; i < src_width; i++) { - frameBuffer[j*(dst_stride / 2) + i] = + TargetFrameBuffer[j*(dst_stride / 2) + i] = ((buf[(src_height - j - 1)*src_width * 4 + i * 4 + 0] >> 3) << 11) | ((buf[(src_height - j - 1)*src_width * 4 + i * 4 + 1] >> 2) << 5) | (buf[(src_height - j - 1)*src_width * 4 + i * 4 + 2] >> 3); @@ -1608,7 +1608,7 @@ bool gfxLfbReadRegion(gfxBuffer_t src_buffer, uint32_t src_x, uint32_t src_y, ui { for (i = 0; i < src_width; i++) { - depthBuffer[j*(dst_stride / 2) + i] = + TargetDepthBuffer[j*(dst_stride / 2) + i] = ((unsigned short*)buf)[(src_height - j - 1)*src_width * 4 + i * 4]; } } diff --git a/Source/Project64-video/Settings.cpp b/Source/Project64-video/Settings.cpp index 703d75be3..456dde4ad 100644 --- a/Source/Project64-video/Settings.cpp +++ b/Source/Project64-video/Settings.cpp @@ -11,10 +11,10 @@ #include #include #include -#include "Gfx_1.3.h" #include "ScreenResolution.h" #include "SettingsID.h" #include "trace.h" +#include "Gfx_1.3.h" CSettings::CSettings() : m_Set_basic_mode(0), @@ -749,7 +749,7 @@ void CSettings::ReadGameSettings(const char * name) m_alt_tex_size = GetSetting(Set_alt_tex_size) != 0; m_use_sts1_only = GetSetting(Set_use_sts1_only) != 0; m_force_calc_sphere = GetSetting(Set_force_calc_sphere) != 0; - m_correct_viewport = GetSetting(Set_correct_viewport); + m_correct_viewport = GetSetting(Set_correct_viewport) != 0; m_increase_texrect_edge = GetSetting(Set_increase_texrect_edge) != 0; m_decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge) != 0; m_texture_correction = GetSetting(Set_texture_correction) != 0; @@ -762,9 +762,9 @@ void CSettings::ReadGameSettings(const char * name) m_clip_zmin = GetSetting(Set_clip_zmin) != 0; m_clip_zmax = GetSetting(Set_clip_zmax) != 0; m_fast_crc = GetSetting(Set_fast_crc) != 0; - m_adjust_aspect = GetSetting(Set_adjust_aspect); - m_zmode_compare_less = GetSetting(Set_zmode_compare_less); - m_old_style_adither = GetSetting(Set_old_style_adither); + m_adjust_aspect = GetSetting(Set_adjust_aspect) != 0; + m_zmode_compare_less = GetSetting(Set_zmode_compare_less) != 0; + m_old_style_adither = GetSetting(Set_old_style_adither) != 0; m_n64_z_scale = GetSetting(Set_n64_z_scale) != 0; m_RdramSize = GetSystemSetting(m_Set_RDRamSize); @@ -772,7 +772,7 @@ void CSettings::ReadGameSettings(const char * name) if (m_ScreenRes >= GetScreenResolutionCount()) { m_ScreenRes = GetDefaultScreenRes(); } //frame buffer - short fb_Settings[] = + VideoSettings fb_Settings[] = { g_romopen ? Set_optimize_texrect : Set_optimize_texrect_default, Set_ignore_aux_copy, @@ -945,12 +945,7 @@ void CSettings::LogLevelChanged(void) g_ModuleLogLevel[TraceRDPCommands] = GetSetting(Set_Logging_RDPCommands); } -#ifdef _WIN32 -#include -#endif void UseUnregisteredSetting(int /*SettingID*/) { -#ifdef _WIN32 - DebugBreak(); -#endif + g_Notify->BreakPoint(__FILE__, __LINE__); } \ No newline at end of file diff --git a/Source/Project64-video/SettingsID.h b/Source/Project64-video/SettingsID.h index aeaa9d16d..45cc2a13d 100644 --- a/Source/Project64-video/SettingsID.h +++ b/Source/Project64-video/SettingsID.h @@ -10,7 +10,7 @@ ****************************************************************************/ #pragma once -enum +enum VideoSettings : uint16_t { // General Settings Set_vsync, Set_Rotate, Set_texenh_options, Set_wrpVRAM, diff --git a/Source/Project64-video/TextureEnhancer/TextureFilters.cpp b/Source/Project64-video/TextureEnhancer/TextureFilters.cpp index c560ef281..b045070ff 100644 --- a/Source/Project64-video/TextureEnhancer/TextureFilters.cpp +++ b/Source/Project64-video/TextureEnhancer/TextureFilters.cpp @@ -35,10 +35,10 @@ void Texture2x_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch uint32 g1; uint32 r1; uint32 a1; - uint32 b2; - uint32 g2; - uint32 r2; - uint32 a2; + uint32 b2 = 0; + uint32 g2 = 0; + uint32 r2 = 0; + uint32 a2 = 0; uint32 b3; uint32 g3; uint32 r3; diff --git a/Source/Project64-video/TextureEnhancer/TxQuantize.cpp b/Source/Project64-video/TextureEnhancer/TxQuantize.cpp index 1f3e75a92..c5328bb5f 100644 --- a/Source/Project64-video/TextureEnhancer/TxQuantize.cpp +++ b/Source/Project64-video/TextureEnhancer/TxQuantize.cpp @@ -1188,7 +1188,7 @@ TxQuantize::ARGB8888_RGB565_ErrD(uint32* src, uint32* dst, int width, int height /* Floyd-Steinberg error-diffusion halftoning */ int i, x, y; - int qr, qg, qb; /* quantized incoming values */ + int qr = 0, qg = 0, qb = 0; /* quantized incoming values */ int ir, ig, ib; /* incoming values */ int t; int *errR = new int[width]; @@ -1397,7 +1397,7 @@ TxQuantize::ARGB8888_ARGB4444_ErrD(uint32* src, uint32* dst, int width, int heig bool ditherAlpha = 0; int i, x, y; - int qr, qg, qb, qa; /* quantized incoming values */ + int qr = 0, qg = 0, qb = 0, qa = 0; /* quantized incoming values */ int ir, ig, ib, ia; /* incoming values */ int t; int *errR = new int[width]; diff --git a/Source/Project64-video/TextureEnhancer/tc-1.1+/dxtn.c b/Source/Project64-video/TextureEnhancer/tc-1.1+/dxtn.c index 8f0e2da8c..cfd5510d9 100644 --- a/Source/Project64-video/TextureEnhancer/tc-1.1+/dxtn.c +++ b/Source/Project64-video/TextureEnhancer/tc-1.1+/dxtn.c @@ -17,6 +17,7 @@ #include #include +#include #include "types.h" #include "internal.h" @@ -868,7 +869,7 @@ dxt5_rgba_decode_1(const void *texture, int stride, rgba[ACOMP] = alpha1; } else if (alpha0 > alpha1) { - rgba[ACOMP] = ((8 - acode) * alpha0 + (acode - 1) * alpha1) / 7; + rgba[ACOMP] = (uint8_t)(((8 - acode) * alpha0 + (acode - 1) * alpha1) / 7); } else if (acode == 6) { rgba[ACOMP] = 0; @@ -877,6 +878,6 @@ dxt5_rgba_decode_1(const void *texture, int stride, rgba[ACOMP] = 255; } else { - rgba[ACOMP] = ((6 - acode) * alpha0 + (acode - 1) * alpha1) / 5; + rgba[ACOMP] = (uint8_t)(((6 - acode) * alpha0 + (acode - 1) * alpha1) / 5); } } diff --git a/Source/Project64-video/rdp.cpp b/Source/Project64-video/rdp.cpp index 3d849cc95..1b1344ac5 100644 --- a/Source/Project64-video/rdp.cpp +++ b/Source/Project64-video/rdp.cpp @@ -1320,13 +1320,13 @@ void rdp_texrect() #define SIGN16(x) (((x) & 0x8000) ? ((x) | ~0xffff) : ((x) & 0xffff)) //calculate texture coordinates - for (int i = 0; i < 2; i++) + for (int z = 0; z < 2; z++) { - if (rdp.cur_cache[i] && (rdp.tex & (i + 1))) + if (rdp.cur_cache[z] && (rdp.tex & (z + 1))) { float sx = 1, sy = 1; int x_i = off_x_i, y_i = off_y_i; - TILE & tile = rdp.tiles(rdp.cur_tile + i); + TILE & tile = rdp.tiles(rdp.cur_tile + z); //shifting if (tile.shift_s) { @@ -1359,7 +1359,7 @@ void rdp_texrect() } } - if (rdp.aTBuffTex[i]) //hwfbe texture + if (rdp.aTBuffTex[z]) //hwfbe texture { float t0_off_x; float t0_off_y; @@ -1373,42 +1373,42 @@ void rdp_texrect() t0_off_x = off_x_i / 32.0f; t0_off_y = off_y_i / 32.0f; } - t0_off_x += rdp.aTBuffTex[i]->u_shift;// + tile.ul_s; //commented for Paper Mario motion blur - t0_off_y += rdp.aTBuffTex[i]->v_shift;// + tile.ul_t; - texUV[i].ul_u = t0_off_x * sx; - texUV[i].ul_v = t0_off_y * sy; + t0_off_x += rdp.aTBuffTex[z]->u_shift;// + tile.ul_s; //commented for Paper Mario motion blur + t0_off_y += rdp.aTBuffTex[z]->v_shift;// + tile.ul_t; + texUV[z].ul_u = t0_off_x * sx; + texUV[z].ul_v = t0_off_y * sy; - texUV[i].lr_u = texUV[i].ul_u + off_size_x * sx; - texUV[i].lr_v = texUV[i].ul_v + off_size_y * sy; + texUV[z].lr_u = texUV[z].ul_u + off_size_x * sx; + texUV[z].lr_v = texUV[z].ul_v + off_size_y * sy; - texUV[i].ul_u *= rdp.aTBuffTex[i]->u_scale; - texUV[i].ul_v *= rdp.aTBuffTex[i]->v_scale; - texUV[i].lr_u *= rdp.aTBuffTex[i]->u_scale; - texUV[i].lr_v *= rdp.aTBuffTex[i]->v_scale; + texUV[z].ul_u *= rdp.aTBuffTex[z]->u_scale; + texUV[z].ul_v *= rdp.aTBuffTex[z]->v_scale; + texUV[z].lr_u *= rdp.aTBuffTex[z]->u_scale; + texUV[z].lr_v *= rdp.aTBuffTex[z]->v_scale; WriteTrace(TraceRDP, TraceDebug, "tbuff_tex[%d] ul_u: %f, ul_v: %f, lr_u: %f, lr_v: %f", - i, texUV[i].ul_u, texUV[i].ul_v, texUV[i].lr_u, texUV[i].lr_v); + z, texUV[z].ul_u, texUV[z].ul_v, texUV[z].lr_u, texUV[z].lr_v); } else //common case { //kill 10.5 format overflow by SIGN16 macro - texUV[i].ul_u = SIGN16(x_i) / 32.0f; - texUV[i].ul_v = SIGN16(y_i) / 32.0f; + texUV[z].ul_u = SIGN16(x_i) / 32.0f; + texUV[z].ul_v = SIGN16(y_i) / 32.0f; - texUV[i].ul_u -= tile.f_ul_s; - texUV[i].ul_v -= tile.f_ul_t; + texUV[z].ul_u -= tile.f_ul_s; + texUV[z].ul_v -= tile.f_ul_t; - texUV[i].lr_u = texUV[i].ul_u + off_size_x * sx; - texUV[i].lr_v = texUV[i].ul_v + off_size_y * sy; + texUV[z].lr_u = texUV[z].ul_u + off_size_x * sx; + texUV[z].lr_v = texUV[z].ul_v + off_size_y * sy; - texUV[i].ul_u = rdp.cur_cache[i]->c_off + rdp.cur_cache[i]->c_scl_x * texUV[i].ul_u; - texUV[i].lr_u = rdp.cur_cache[i]->c_off + rdp.cur_cache[i]->c_scl_x * texUV[i].lr_u; - texUV[i].ul_v = rdp.cur_cache[i]->c_off + rdp.cur_cache[i]->c_scl_y * texUV[i].ul_v; - texUV[i].lr_v = rdp.cur_cache[i]->c_off + rdp.cur_cache[i]->c_scl_y * texUV[i].lr_v; + texUV[z].ul_u = rdp.cur_cache[z]->c_off + rdp.cur_cache[z]->c_scl_x * texUV[z].ul_u; + texUV[z].lr_u = rdp.cur_cache[z]->c_off + rdp.cur_cache[z]->c_scl_x * texUV[z].lr_u; + texUV[z].ul_v = rdp.cur_cache[z]->c_off + rdp.cur_cache[z]->c_scl_y * texUV[z].ul_v; + texUV[z].lr_v = rdp.cur_cache[z]->c_off + rdp.cur_cache[z]->c_scl_y * texUV[z].lr_v; } } else { - texUV[i].ul_u = texUV[i].ul_v = texUV[i].lr_u = texUV[i].lr_v = 0; + texUV[z].ul_u = texUV[z].ul_v = texUV[z].lr_u = texUV[z].lr_v = 0; } } rdp.cur_tile = prev_tile; @@ -1816,20 +1816,20 @@ void rdp_settilesize() if (tile_set) { // coords in 10.2 format - rdp.tiles(tile).ul_s = ul_s; - rdp.tiles(tile).ul_t = ul_t; - rdp.tiles(tile).lr_s = lr_s; - rdp.tiles(tile).lr_t = lr_t; + rdp.tiles(tile).ul_s = (uint16_t)ul_s; + rdp.tiles(tile).ul_t = (uint16_t)ul_t; + rdp.tiles(tile).lr_s = (uint16_t)lr_s; + rdp.tiles(tile).lr_t = (uint16_t)lr_t; tile_set = 0; } } else { // coords in 10.2 format - rdp.tiles(tile).ul_s = ul_s; - rdp.tiles(tile).ul_t = ul_t; - rdp.tiles(tile).lr_s = lr_s; - rdp.tiles(tile).lr_t = lr_t; + rdp.tiles(tile).ul_s = (uint16_t)ul_s; + rdp.tiles(tile).ul_t = (uint16_t)ul_t; + rdp.tiles(tile).lr_s = (uint16_t)lr_s; + rdp.tiles(tile).lr_t = (uint16_t)lr_t; } // handle wrapping @@ -1914,7 +1914,7 @@ static inline void loadBlock(uint32_t *src, uint32_t *dst, uint32_t off, int dxt do { v10 = __ROL__(v10, 8); - *(uint8_t *)v5 = v10; + *(uint8_t *)v5 = (uint8_t)v10; v5 = (uint32_t *)((char *)v5 + 1); --v9; } while (v9); @@ -1942,7 +1942,7 @@ static inline void loadBlock(uint32_t *src, uint32_t *dst, uint32_t off, int dxt do { v14 = __ROL__(v14, 8); - *(uint8_t *)v5 = v14; + *(uint8_t *)v5 = (uint8_t)v14; v5 = (uint32_t *)((char *)v5 + 1); --v13; } while (v13); @@ -2074,7 +2074,7 @@ void rdp_loadblock() loadBlock((uint32_t *)gfx.RDRAM, (uint32_t *)dst, off, _dxt, cnt); rdp.timg.addr += cnt << 3; - rdp.tiles(tile).lr_t = ul_t + ((dxt*cnt) >> 11); + rdp.tiles(tile).lr_t = (uint16_t)(ul_t + ((dxt*cnt) >> 11)); rdp.update |= UPDATE_TEXTURE; @@ -2905,7 +2905,6 @@ void rdp_setcolorimage() { if (g_settings->fb_hwfbe_enabled() && !rdp.copy_ci_index && (rdp.copy_zi_index || g_settings->hacks(CSettings::hack_BAR))) { - gfxLOD_t LOD = g_scr_res_x > 1024 ? GFX_LOD_LOG2_1024 : GFX_LOD_LOG2_2048; gfxAuxBufferExt(GFX_BUFFER_TEXTUREAUXBUFFER_EXT); WriteTrace(TraceRDP, TraceDebug, "rdp_setcolorimage - set texture depth buffer to TMU0"); } @@ -3235,7 +3234,7 @@ EXPORT void CALL FBRead(uint32_t addr) uint32_t h = rdp.frame_buffers[0].height; rdp.frame_buffers[0].height = rdp.maincimg[1].height; CopyFrameBuffer(GFX_BUFFER_FRONTBUFFER); - rdp.frame_buffers[0].height = h; + rdp.frame_buffers[0].height = (uint16_t)h; } else { @@ -3517,9 +3516,9 @@ void DetectFrameBufferUsage() { int ind = (rdp.ci_count > 0) ? rdp.ci_count - 1 : 0; uint32_t height = rdp.frame_buffers[ind].height; - rdp.frame_buffers[ind].height = ci_height; + rdp.frame_buffers[ind].height = (uint16_t)ci_height; CopyFrameBuffer(); - rdp.frame_buffers[ind].height = height; + rdp.frame_buffers[ind].height = (uint16_t)height; } if (rdp.swap_ci_index < 0) { @@ -3550,7 +3549,7 @@ void DetectFrameBufferUsage() uint32_t h = rdp.frame_buffers[0].height; rdp.frame_buffers[0].height = rdp.maincimg[0].height; CopyFrameBuffer(); - rdp.frame_buffers[0].height = h; + rdp.frame_buffers[0].height = (uint16_t)h; } else //conker { @@ -3734,10 +3733,10 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer, (flip/* && xleft > xright*/)) { if (shade) { - vtx->r = CSCALE(r + drdx*dx); - vtx->g = CSCALE(g + dgdx*dx); - vtx->b = CSCALE(b + dbdx*dx); - vtx->a = CSCALE(a + dadx*dx); + vtx->r = (uint8_t)CSCALE(r + drdx*dx); + vtx->g = (uint8_t)CSCALE(g + dgdx*dx); + vtx->b = (uint8_t)CSCALE(b + dbdx*dx); + vtx->a = (uint8_t)CSCALE(a + dadx*dx); } if (texture) { vtx->ou = SSCALE(s + dsdx*dx, w + dwdx*dx); @@ -3753,10 +3752,10 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer, (flip && xleft > xright)) { if (shade) { - vtx->r = CSCALE(r); - vtx->g = CSCALE(g); - vtx->b = CSCALE(b); - vtx->a = CSCALE(a); + vtx->r = (uint8_t)CSCALE(r); + vtx->g = (uint8_t)CSCALE(g); + vtx->b = (uint8_t)CSCALE(b); + vtx->a = (uint8_t)CSCALE(a); } if (texture) { vtx->ou = SSCALE(s, w); @@ -3787,10 +3786,10 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer, (flip/* && xleft >= xright*/)) { if (shade) { - vtx->r = CSCALE(r + drdx*dx); - vtx->g = CSCALE(g + dgdx*dx); - vtx->b = CSCALE(b + dbdx*dx); - vtx->a = CSCALE(a + dadx*dx); + vtx->r = (uint8_t)CSCALE(r + drdx*dx); + vtx->g = (uint8_t)CSCALE(g + dgdx*dx); + vtx->b = (uint8_t)CSCALE(b + dbdx*dx); + vtx->a = (uint8_t)CSCALE(a + dadx*dx); } if (texture) { vtx->ou = SSCALE(s + dsdx*dx, w + dwdx*dx); @@ -3806,10 +3805,10 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer, (flip && xleft >= xright)) { if (shade) { - vtx->r = CSCALE(r); - vtx->g = CSCALE(g); - vtx->b = CSCALE(b); - vtx->a = CSCALE(a); + vtx->r = (uint8_t)CSCALE(r); + vtx->g = (uint8_t)CSCALE(g); + vtx->b = (uint8_t)CSCALE(b); + vtx->a = (uint8_t)CSCALE(a); } if (texture) { vtx->ou = SSCALE(s, w); @@ -3850,10 +3849,10 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer, (flip/* && xleft >= xright*/)) { if (shade) { - vtx->r = CSCALE(r + drdx*dx); - vtx->g = CSCALE(g + dgdx*dx); - vtx->b = CSCALE(b + dbdx*dx); - vtx->a = CSCALE(a + dadx*dx); + vtx->r = (uint8_t)CSCALE(r + drdx*dx); + vtx->g = (uint8_t)CSCALE(g + dgdx*dx); + vtx->b = (uint8_t)CSCALE(b + dbdx*dx); + vtx->a = (uint8_t)CSCALE(a + dadx*dx); } if (texture) { vtx->ou = SSCALE(s + dsdx*dx, w + dwdx*dx); @@ -3869,10 +3868,10 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer, (flip && xleft >= xright)) { if (shade) { - vtx->r = CSCALE(r); - vtx->g = CSCALE(g); - vtx->b = CSCALE(b); - vtx->a = CSCALE(a); + vtx->r = (uint8_t)CSCALE(r); + vtx->g = (uint8_t)CSCALE(g); + vtx->b = (uint8_t)CSCALE(b); + vtx->a = (uint8_t)CSCALE(a); } if (texture) { vtx->ou = SSCALE(s, w); diff --git a/Source/Project64-video/ucode06.cpp b/Source/Project64-video/ucode06.cpp index 368c84dae..a2cc5cf20 100644 --- a/Source/Project64-video/ucode06.cpp +++ b/Source/Project64-video/ucode06.cpp @@ -433,10 +433,10 @@ void DrawImage(DRAWIMAGE & d) // ** Load the texture, constant portions have been set above // SetTileSize () - rdp.tiles(0).ul_s = tb_u; - rdp.tiles(0).ul_t = tb_v; - rdp.tiles(0).lr_s = tb_u + x_size - 1; - rdp.tiles(0).lr_t = tb_v + y_size - 1; + rdp.tiles(0).ul_s = (uint16_t)tb_u; + rdp.tiles(0).ul_t = (uint16_t)tb_v; + rdp.tiles(0).lr_s = (uint16_t)(tb_u + x_size - 1); + rdp.tiles(0).lr_t = (uint16_t)(tb_v + y_size - 1); // LoadTile () rdp.cmd0 = ((int)rdp.tiles(0).ul_s << 14) | ((int)rdp.tiles(0).ul_t << 2); @@ -1354,7 +1354,7 @@ void uc6_sprite2d() WriteTrace(TraceRDP, TraceDebug, "uc6:uc6_sprite2d #%d, #%d", rdp.tri_n, rdp.tri_n + 1); uint32_t addr = segoffset(rdp.cmd1) >> 1; - DRAWIMAGE d; + DRAWIMAGE d = { 0 }; d.imagePtr = segoffset(((uint32_t*)gfx.RDRAM)[(addr + 0) >> 1]); // 0,1 uint16_t stride = (((uint16_t *)gfx.RDRAM)[(addr + 4) ^ 1]); // 4 @@ -1420,9 +1420,9 @@ void uc6_sprite2d() if (g_settings->hacks(CSettings::hack_WCWnitro)) { int scaleY = (int)d.scaleY; - d.imageH /= scaleY; - d.imageY /= scaleY; - stride *= scaleY; + d.imageH /= (uint16_t)scaleY; + d.imageY /= (uint16_t)scaleY; + stride *= (uint16_t)scaleY; d.scaleY = 1.0f; } WriteTrace(TraceRDP, TraceDebug, "imagePtr: %08lx", d.imagePtr); diff --git a/Source/Project64-video/ucodeFB.cpp b/Source/Project64-video/ucodeFB.cpp index dafcfe6d3..b2a38a284 100644 --- a/Source/Project64-video/ucodeFB.cpp +++ b/Source/Project64-video/ucodeFB.cpp @@ -101,7 +101,7 @@ static void fb_setscissor() if (rdp.scissor_o.lr_x - rdp.scissor_o.ul_x > (uint32_t)(cur_fb.width >> 1)) { if (cur_fb.height == 0 || (cur_fb.width >= rdp.scissor_o.lr_x - 1 && cur_fb.width <= rdp.scissor_o.lr_x + 1)) - cur_fb.height = rdp.scissor_o.lr_y; + cur_fb.height = (uint16_t)rdp.scissor_o.lr_y; } WriteTrace(TraceRDP, TraceDebug, "fb_setscissor. lr_x = %d, lr_y = %d, fb_width = %d, fb_height = %d", rdp.scissor_o.lr_x, rdp.scissor_o.lr_y, cur_fb.width, cur_fb.height); } @@ -121,7 +121,7 @@ static void fb_uc2_movemem() short trans_y = ((short*)gfx.RDRAM)[(a + 5) ^ 1] >> 2; uint32_t height = scale_y + trans_y; if (height < rdp.scissor_o.lr_y) - cur_fb.height = height; + cur_fb.height = (uint16_t)height; } } } @@ -140,7 +140,7 @@ static void fb_rect() if (rdp.frame_buffers[rdp.ci_count - 1].height < lr_y) { WriteTrace(TraceRDP, TraceDebug, "fb_rect. ul_x: %d, lr_x: %d, fb_height: %d -> %d", ul_x, lr_x, rdp.frame_buffers[rdp.ci_count - 1].height, lr_y); - rdp.frame_buffers[rdp.ci_count - 1].height = lr_y; + rdp.frame_buffers[rdp.ci_count - 1].height = (uint16_t)lr_y; } } } @@ -169,7 +169,7 @@ static void fb_settextureimage() rdp.main_ci_last_tex_addr = addr; if (cur_fb.height == 0) { - cur_fb.height = rdp.scissor_o.lr_y; + cur_fb.height = (uint16_t)rdp.scissor_o.lr_y; rdp.main_ci_end = cur_fb.addr + ((cur_fb.width * cur_fb.height) << cur_fb.size >> 1); } } @@ -327,7 +327,7 @@ static void fb_setcolorimage() else if (cur_fb.width == 16) cur_fb.height = 16; else if (rdp.ci_count > 0) - cur_fb.height = rdp.scissor_o.lr_y; + cur_fb.height = (uint16_t)rdp.scissor_o.lr_y; else cur_fb.height = 0; cur_fb.format = (rdp.cmd0 >> 21) & 0x7; diff --git a/Source/Project64/UserInterface/About.cpp b/Source/Project64/UserInterface/About.cpp index b382a5db3..4f8c2433a 100644 --- a/Source/Project64/UserInterface/About.cpp +++ b/Source/Project64/UserInterface/About.cpp @@ -6,7 +6,7 @@ CAboutDlg::CAboutDlg(CProjectSupport & Support) : { } -LRESULT CAboutDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled) +LRESULT CAboutDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/) { m_Logo.SubclassWindow(GetDlgItem(IDC_BMP_LOGO)); m_Logo.SetBitmap(MAKEINTRESOURCE(IDB_ABOUT_LOGO)); @@ -59,7 +59,7 @@ void CAboutDlg::SetWindowDetais(int nIDDlgItem, int nAboveIDDlgItem, const wchar CWindow AboveWnd = GetDlgItem(nAboveIDDlgItem); AboveWnd.GetWindowRect(&rcWin); ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); - LONG Top = rcWin.bottom + (8 * DPIScale); + LONG Top = rcWin.bottom + (LONG)(8 * DPIScale); Wnd.GetWindowRect(&rcWin); ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); @@ -89,7 +89,7 @@ LRESULT CAboutDlg::OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lPar return TRUE; } -LRESULT CAboutDlg::OnOkCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled) +LRESULT CAboutDlg::OnOkCmd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { EndDialog(0); return TRUE; diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp index 60fc8dcf9..995c4311f 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp @@ -152,9 +152,9 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA return TRUE; } -void CDebugCommandsView::GameCpuRunningChanged(CDebugCommandsView* _this) +void CDebugCommandsView::GameCpuRunningChanged(CDebugCommandsView * DebugCommandsView) { - _this->RecompilerCheck(); + DebugCommandsView->RecompilerCheck(); } void CDebugCommandsView::RecompilerCheck(void) diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp index 677ca4d9f..94f1717c4 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp @@ -16,7 +16,6 @@ CDebugScripts::CDebugScripts(CDebuggerUI* debugger) : CDebugDialog(debugger), CToolTipDialog(), - m_SelectedScriptName(NULL), m_hQuitScriptDirWatchEvent(NULL), m_hScriptDirWatchThread(NULL) { @@ -24,10 +23,6 @@ CDebugScripts::CDebugScripts(CDebuggerUI* debugger) : CDebugScripts::~CDebugScripts(void) { - if (m_SelectedScriptName != NULL) - { - free(m_SelectedScriptName); - } } LRESULT CDebugScripts::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) @@ -235,10 +230,10 @@ LRESULT CDebugScripts::OnScriptListDblClicked(NMHDR* pNMHDR) void CDebugScripts::RefreshStatus() { - INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); + INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str()); stdstr statusText; - CPath(stdstr_f("Scripts\\%s", m_SelectedScriptName)).GetFullyQualified(statusText); + CPath(stdstr_f("Scripts\\%s", m_SelectedScriptName.c_str())).GetFullyQualified(statusText); if (state == STATE_RUNNING) { @@ -267,7 +262,7 @@ LRESULT CDebugScripts::OnScriptListRClicked(NMHDR* pNMHDR) return 0; } - INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); + INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str()); HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_SCRIPT_POPUP)); HMENU hPopupMenu = GetSubMenu(hMenu, 0); @@ -338,15 +333,9 @@ LRESULT CDebugScripts::OnScriptListItemChanged(NMHDR* pNMHDR) wchar_t ScriptName[MAX_PATH]; m_ScriptList.GetItemText(lpStateChange->iItem, 1, ScriptName, MAX_PATH); + m_SelectedScriptName = stdstr().FromUTF16(ScriptName).c_str(); - if (m_SelectedScriptName != NULL) - { - free(m_SelectedScriptName); - } - - m_SelectedScriptName = strdup(stdstr().FromUTF16(ScriptName).c_str()); - - INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); + INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str()); ::EnableWindow(GetDlgItem(IDC_STOP_BTN), state == STATE_RUNNING || state == STATE_STARTED); ::EnableWindow(GetDlgItem(IDC_RUN_BTN), state == STATE_STOPPED || state == STATE_INVALID); @@ -437,27 +426,27 @@ LRESULT CDebugScripts::OnRefreshList(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* void CDebugScripts::EvaluateInSelectedInstance(const char* code) { - INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); + INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str()); if (state == STATE_RUNNING || state == STATE_STARTED) { - CScriptInstance* instance = m_Debugger->ScriptSystem()->GetInstance(m_SelectedScriptName); + CScriptInstance* instance = m_Debugger->ScriptSystem()->GetInstance(m_SelectedScriptName.c_str()); instance->Eval(code); } } void CDebugScripts::RunSelected() { - if (m_SelectedScriptName == NULL) + if (m_SelectedScriptName.empty()) { return; } - INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); + INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str()); if (state == STATE_INVALID || state == STATE_STOPPED) { - m_Debugger->ScriptSystem()->RunScript(m_SelectedScriptName); + m_Debugger->ScriptSystem()->RunScript(m_SelectedScriptName.c_str()); } else { @@ -467,12 +456,12 @@ void CDebugScripts::RunSelected() void CDebugScripts::StopSelected() { - m_Debugger->ScriptSystem()->StopScript(m_SelectedScriptName); + m_Debugger->ScriptSystem()->StopScript(m_SelectedScriptName.c_str()); } void CDebugScripts::ToggleSelected() { - INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); + INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName.c_str()); if (state == STATE_INVALID || state == STATE_STOPPED) { diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.h b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.h index 29b9d262a..eb2a86705 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.h @@ -13,6 +13,7 @@ #include "DebuggerUI.h" #include "ScriptSystem.h" #include +#include class CScriptList : public CListViewCtrl { @@ -94,7 +95,7 @@ private: CEditConsole m_ConsoleEdit; CScriptList m_ScriptList; CStatusBarCtrl m_StatusBar; - char* m_SelectedScriptName; + std::string m_SelectedScriptName; HANDLE m_hQuitScriptDirWatchEvent; HANDLE m_hScriptDirWatchThread; diff --git a/Source/Project64/UserInterface/Debugger/Debugger-StackView.cpp b/Source/Project64/UserInterface/Debugger/Debugger-StackView.cpp index c8c0d02bd..0c32b3b35 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-StackView.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-StackView.cpp @@ -94,7 +94,7 @@ void CDebugStackView::Refresh() for (int i = 0; i < 0x10; i++) { wchar_t t[4]; - swprintf(t, L"%02X", i * 0x10); + swprintf(t, sizeof(t) / sizeof(t[0]), L"%02X", i * 0x10); m_StackList.AddItem(i, 0, t); for (int j = 0; j < 4; j++) diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Symbols.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Symbols.cpp index f669e261e..fd0d54ec3 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Symbols.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Symbols.cpp @@ -203,10 +203,10 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR) switch (symbol.m_Type) { case SYM_U8: - m_Debugger->DebugStore_VAddr(symbol.m_Address, atoi(EnteredString.c_str())); + m_Debugger->DebugStore_VAddr(symbol.m_Address, (uint8_t)atoi(EnteredString.c_str())); break; case SYM_U16: - m_Debugger->DebugStore_VAddr(symbol.m_Address, atoi(EnteredString.c_str())); + m_Debugger->DebugStore_VAddr(symbol.m_Address, (uint16_t)atoi(EnteredString.c_str())); break; case SYM_U32: m_Debugger->DebugStore_VAddr(symbol.m_Address, atoi(EnteredString.c_str())); @@ -215,10 +215,10 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR) m_Debugger->DebugStore_VAddr(symbol.m_Address, atoll(EnteredString.c_str())); break; case SYM_S8: - m_Debugger->DebugStore_VAddr(symbol.m_Address, atoi(EnteredString.c_str())); + m_Debugger->DebugStore_VAddr(symbol.m_Address, (int8_t)atoi(EnteredString.c_str())); break; case SYM_S16: - m_Debugger->DebugStore_VAddr(symbol.m_Address, atoi(EnteredString.c_str())); + m_Debugger->DebugStore_VAddr(symbol.m_Address, (int16_t)atoi(EnteredString.c_str())); break; case SYM_S32: m_Debugger->DebugStore_VAddr(symbol.m_Address, atoi(EnteredString.c_str())); @@ -227,7 +227,7 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR) m_Debugger->DebugStore_VAddr(symbol.m_Address, atoll(EnteredString.c_str())); break; case SYM_FLOAT: - m_Debugger->DebugStore_VAddr(symbol.m_Address, atof(EnteredString.c_str())); + m_Debugger->DebugStore_VAddr(symbol.m_Address, (float)atof(EnteredString.c_str())); break; case SYM_DOUBLE: m_Debugger->DebugStore_VAddr(symbol.m_Address, atof(EnteredString.c_str())); @@ -236,46 +236,46 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR) x = EnteredString.c_str(); y = strchr(x, ','); memcpy(szValue, x, y - x); - m_Debugger->DebugStore_VAddr(symbol.m_Address, atof(szValue)); + m_Debugger->DebugStore_VAddr(symbol.m_Address, (float)atof(szValue)); x = x + (y - x) + 1; memcpy(szValue, x, strlen(x)); - m_Debugger->DebugStore_VAddr(symbol.m_Address + sizeof(float), atof(szValue)); + m_Debugger->DebugStore_VAddr(symbol.m_Address + sizeof(float), (float)atof(szValue)); break; case SYM_VECTOR3: x = EnteredString.c_str(); y = strchr(x, ','); memcpy(szValue, x, y - x); - m_Debugger->DebugStore_VAddr(symbol.m_Address, atof(szValue)); + m_Debugger->DebugStore_VAddr(symbol.m_Address, (float)atof(szValue)); x = x + (y - x) + 1; y = strchr(x, ','); memcpy(szValue, x, y - x); - m_Debugger->DebugStore_VAddr(symbol.m_Address + sizeof(float), atof(szValue)); + m_Debugger->DebugStore_VAddr(symbol.m_Address + sizeof(float), (float)atof(szValue)); x = x + (y - x) + 1; memcpy(szValue, x, strlen(x)); - m_Debugger->DebugStore_VAddr(symbol.m_Address + (sizeof(float) * 2), atof(szValue)); + m_Debugger->DebugStore_VAddr(symbol.m_Address + (sizeof(float) * 2), (float)atof(szValue)); break; case SYM_VECTOR4: x = EnteredString.c_str(); y = strchr(x, ','); memcpy(szValue, x, y - x); - m_Debugger->DebugStore_VAddr(symbol.m_Address, atof(szValue)); + m_Debugger->DebugStore_VAddr(symbol.m_Address, (float)atof(szValue)); x = x + (y - x) + 1; y = strchr(x, ','); memcpy(szValue, x, y - x); - m_Debugger->DebugStore_VAddr(symbol.m_Address + sizeof(float), atof(szValue)); + m_Debugger->DebugStore_VAddr(symbol.m_Address + sizeof(float), (float)atof(szValue)); x = x + (y - x) + 1; y = strchr(x, ','); memcpy(szValue, x, y - x); - m_Debugger->DebugStore_VAddr(symbol.m_Address + (sizeof(float) * 2), atof(szValue)); + m_Debugger->DebugStore_VAddr(symbol.m_Address + (sizeof(float) * 2), (float)atof(szValue)); x = x + (y - x) + 1; memcpy(szValue, x, strlen(x)); - m_Debugger->DebugStore_VAddr(symbol.m_Address + (sizeof(float) * 3), atof(szValue)); + m_Debugger->DebugStore_VAddr(symbol.m_Address + (sizeof(float) * 3), (float)atof(szValue)); break; } } diff --git a/Source/Project64/UserInterface/Debugger/ScriptSystem.cpp b/Source/Project64/UserInterface/Debugger/ScriptSystem.cpp index fe75986a3..e7297e136 100644 --- a/Source/Project64/UserInterface/Debugger/ScriptSystem.cpp +++ b/Source/Project64/UserInterface/Debugger/ScriptSystem.cpp @@ -68,7 +68,7 @@ const char* CScriptSystem::APIScript() return m_APIScript; } -void CScriptSystem::RunScript(char* path) +void CScriptSystem::RunScript(const char * path) { CGuard guard(m_CS); CScriptInstance* scriptInstance = new CScriptInstance(m_Debugger); @@ -79,7 +79,7 @@ void CScriptSystem::RunScript(char* path) scriptInstance->Start(pathSaved); } -void CScriptSystem::StopScript(char* path) +void CScriptSystem::StopScript(const char* path) { CScriptInstance* scriptInstance = GetInstance(path); diff --git a/Source/Project64/UserInterface/Debugger/ScriptSystem.h b/Source/Project64/UserInterface/Debugger/ScriptSystem.h index f28eb18d0..95467e166 100644 --- a/Source/Project64/UserInterface/Debugger/ScriptSystem.h +++ b/Source/Project64/UserInterface/Debugger/ScriptSystem.h @@ -24,10 +24,10 @@ public: CScriptSystem(CDebuggerUI* debugger); ~CScriptSystem(); // Run a script in its own context/thread - void RunScript(char* path); + void RunScript(const char * path); // Kill a script context/thread by its path - void StopScript(char* path); + void StopScript(const char * path); const char* APIScript(); diff --git a/Source/Project64/UserInterface/ProjectSupport.cpp b/Source/Project64/UserInterface/ProjectSupport.cpp index dcc007421..039c29b4a 100644 --- a/Source/Project64/UserInterface/ProjectSupport.cpp +++ b/Source/Project64/UserInterface/ProjectSupport.cpp @@ -14,7 +14,7 @@ CProjectSupport::CProjectSupport() : bool CProjectSupport::RequestCode(const char * Email) { - if (Email == nullptr || strlen(Email) == 0 || stricmp(Email, "thank you from project64") == 0) + if (Email == nullptr || strlen(Email) == 0 || _stricmp(Email, "thank you from project64") == 0) { return false; } diff --git a/Source/RSP/Recompiler CPU.h b/Source/RSP/Recompiler CPU.h index 191f07eec..f256f0b1f 100644 --- a/Source/RSP/Recompiler CPU.h +++ b/Source/RSP/Recompiler CPU.h @@ -27,7 +27,7 @@ #include "OpCode.h" #include "Types.h" -extern DWORD CompilePC, NextInstruction, JumpTableSize; +extern uint32_t CompilePC, NextInstruction, JumpTableSize; extern Boolean ChangedPC; #define CompilerWarning if (ShowErrors) DisplayError