diff --git a/Core/Debugger/DisassemblySearch.cpp b/Core/Debugger/DisassemblySearch.cpp index e0112de65..d26856035 100644 --- a/Core/Debugger/DisassemblySearch.cpp +++ b/Core/Debugger/DisassemblySearch.cpp @@ -169,7 +169,7 @@ bool DisassemblySearch::TextContains(string& needle, const char* hay, int size, } pos++; - if(pos == needle.size()) { + if(pos == (int)needle.size()) { if(options.MatchWholeWord && j < size - 1 && !IsWordSeparator(hay[j + 1])) { j -= pos - 1; pos = 0; diff --git a/Core/SMS/Carts/SmsCodemasterCart.h b/Core/SMS/Carts/SmsCodemasterCart.h index e0e31ee10..ee1ab62b5 100644 --- a/Core/SMS/Carts/SmsCodemasterCart.h +++ b/Core/SMS/Carts/SmsCodemasterCart.h @@ -40,7 +40,7 @@ class SmsCodemasterCart : public SmsCart } } - void Serialize(Serializer& s) + void Serialize(Serializer& s) override { SVArray(_prgBanks, 3); } diff --git a/Core/SMS/Carts/SmsKoreanCart.h b/Core/SMS/Carts/SmsKoreanCart.h index 079c0e47b..7909a4362 100644 --- a/Core/SMS/Carts/SmsKoreanCart.h +++ b/Core/SMS/Carts/SmsKoreanCart.h @@ -33,7 +33,7 @@ class SmsKoreanCart : public SmsCart } } - void Serialize(Serializer& s) + void Serialize(Serializer& s) override { SV(_prgBank); } diff --git a/Core/SMS/Carts/SmsMsxCart.h b/Core/SMS/Carts/SmsMsxCart.h index b2628b0cc..1274b4fdf 100644 --- a/Core/SMS/Carts/SmsMsxCart.h +++ b/Core/SMS/Carts/SmsMsxCart.h @@ -40,7 +40,7 @@ class SmsMsxCart : public SmsCart } } - void Serialize(Serializer& s) + void Serialize(Serializer& s) override { SVArray(_prgBanks, 4); } diff --git a/Core/SMS/Carts/SmsNemesisCart.h b/Core/SMS/Carts/SmsNemesisCart.h index 9a6b14898..d0ee69da8 100644 --- a/Core/SMS/Carts/SmsNemesisCart.h +++ b/Core/SMS/Carts/SmsNemesisCart.h @@ -45,7 +45,7 @@ class SmsNemesisCart : public SmsCart } } - void Serialize(Serializer& s) + void Serialize(Serializer& s) override { SVArray(_prgBanks, 4); } diff --git a/Core/SMS/Carts/SmsSegaCart.h b/Core/SMS/Carts/SmsSegaCart.h index 4311bb05b..01e314558 100644 --- a/Core/SMS/Carts/SmsSegaCart.h +++ b/Core/SMS/Carts/SmsSegaCart.h @@ -64,7 +64,7 @@ class SmsSegaCart : public SmsCart } } - void Serialize(Serializer& s) + void Serialize(Serializer& s) override { SVArray(_prgBanks, 3); SVArray(_ramEnabled, 2); diff --git a/Core/SMS/Debugger/SmsDisUtils.cpp b/Core/SMS/Debugger/SmsDisUtils.cpp index 431d7d2f8..f4aa08411 100644 --- a/Core/SMS/Debugger/SmsDisUtils.cpp +++ b/Core/SMS/Debugger/SmsDisUtils.cpp @@ -176,7 +176,7 @@ void SmsDisUtils::GetDisassembly(DisassemblyInfo& info, string& out, uint32_t me } case 'v': - switch(opInfo.HlRegType) { + switch(opInfo.HlType) { default: str.Write(""); break; case HlRegType::IX: str.WriteAll("(IX+$", HexUtilities::ToHex(opInfo.IndexOffset), "), "); break; case HlRegType::IY: str.WriteAll("(IY+$", HexUtilities::ToHex(opInfo.IndexOffset), "), "); break; @@ -184,7 +184,7 @@ void SmsDisUtils::GetDisassembly(DisassemblyInfo& info, string& out, uint32_t me break; case 'w': - switch(opInfo.HlRegType) { + switch(opInfo.HlType) { default: str.Write("HL"); break; case HlRegType::IX: str.Write("IX"); break; case HlRegType::IY: str.Write("IY"); break; @@ -192,12 +192,12 @@ void SmsDisUtils::GetDisassembly(DisassemblyInfo& info, string& out, uint32_t me break; case 'x': - if(opInfo.IndexOffset < 0 && opInfo.HlRegType != HlRegType::HL) { + if(opInfo.IndexOffset < 0 && opInfo.HlType != HlRegType::HL) { opInfo.ByteCode++; opInfo.IndexOffset = opInfo.ByteCode[0]; } - switch(opInfo.HlRegType) { + switch(opInfo.HlType) { default: str.Write("(HL)"); break; case HlRegType::IX: str.WriteAll("(IX+$", HexUtilities::ToHex(opInfo.IndexOffset), ")"); break; case HlRegType::IY: str.WriteAll("(IY+$", HexUtilities::ToHex(opInfo.IndexOffset), ")"); break; @@ -205,7 +205,7 @@ void SmsDisUtils::GetDisassembly(DisassemblyInfo& info, string& out, uint32_t me break; case 'y': - switch(opInfo.HlRegType) { + switch(opInfo.HlType) { default: str.Write('H'); break; case HlRegType::IX: str.Write("IXH"); break; case HlRegType::IY: str.Write("IYH"); break; @@ -213,7 +213,7 @@ void SmsDisUtils::GetDisassembly(DisassemblyInfo& info, string& out, uint32_t me break; case 'z': - switch(opInfo.HlRegType) { + switch(opInfo.HlType) { default: str.Write('L'); break; case HlRegType::IX: str.Write("IXL"); break; case HlRegType::IY: str.Write("IYL"); break; @@ -241,7 +241,7 @@ SmsOpInfo SmsDisUtils::GetSmsOpInfo(DisassemblyInfo& info) break; case 0xCB: - if(result.HlRegType != HlRegType::HL) { + if(result.HlType != HlRegType::HL) { result.ByteCode++; result.IndexOffset = result.ByteCode[0]; } @@ -251,19 +251,19 @@ SmsOpInfo SmsDisUtils::GetSmsOpInfo(DisassemblyInfo& info) break; case 0xDD: - result.HlRegType = HlRegType::IX; + result.HlType = HlRegType::IX; result.ByteCode++; break; case 0xFD: - result.HlRegType = HlRegType::IY; + result.HlType = HlRegType::IY; result.ByteCode++; break; case 0xED: result.ByteCode++; result.IsEdPrefix = true; - result.HlRegType = HlRegType::HL; + result.HlType = HlRegType::HL; result.Op = _edTemplate[result.ByteCode[0]]; break; } @@ -316,7 +316,7 @@ EffectiveAddressInfo SmsDisUtils::GetEffectiveAddress(DisassemblyInfo& info, Sms result.ShowAddress = ( (strstr(smsOp.Op, "(") != nullptr && strstr(smsOp.Op, "(a)") == nullptr && strstr(smsOp.Op, "(p)") == nullptr) || strstr(smsOp.Op, "x") != nullptr || - (smsOp.HlRegType != HlRegType::HL && strstr(smsOp.Op, "v") != nullptr) || + (smsOp.HlType != HlRegType::HL && strstr(smsOp.Op, "v") != nullptr) || (smsOp.IsEdPrefix && smsOp.ByteCode[0] >= 0xA0 && smsOp.ByteCode[0] <= 0xAF) ); return result; diff --git a/Core/SMS/Debugger/SmsDisUtils.h b/Core/SMS/Debugger/SmsDisUtils.h index 2b87baf2c..4d304ca93 100644 --- a/Core/SMS/Debugger/SmsDisUtils.h +++ b/Core/SMS/Debugger/SmsDisUtils.h @@ -17,7 +17,7 @@ enum class HlRegType struct SmsOpInfo { - HlRegType HlRegType = HlRegType::HL; + HlRegType HlType = HlRegType::HL; const char* Op = nullptr; int16_t IndexOffset = -1; uint8_t* ByteCode = nullptr; diff --git a/Core/SMS/SmsBiosMapper.h b/Core/SMS/SmsBiosMapper.h index ebdf59871..53a5dfab1 100644 --- a/Core/SMS/SmsBiosMapper.h +++ b/Core/SMS/SmsBiosMapper.h @@ -4,7 +4,7 @@ class SmsMemoryManager; -class SmsBiosMapper : public ISerializable +class SmsBiosMapper final : public ISerializable { private: SmsMemoryManager* _memoryManager = nullptr; @@ -16,5 +16,5 @@ class SmsBiosMapper : public ISerializable void WriteRegister(uint16_t addr, uint8_t value); void RefreshMappings(); - void Serialize(Serializer& s); + void Serialize(Serializer& s) override; }; \ No newline at end of file diff --git a/Core/SMS/SmsCpu.cpp b/Core/SMS/SmsCpu.cpp index 2389a9c95..09e3833a3 100644 --- a/Core/SMS/SmsCpu.cpp +++ b/Core/SMS/SmsCpu.cpp @@ -919,19 +919,19 @@ void SmsCpu::WritePort(uint8_t port, uint8_t value) template void SmsCpu::SetStandardFlags(uint8_t value) { - if constexpr(mask & SmsCpuFlags::Sign) { + if constexpr((mask & SmsCpuFlags::Sign) != 0) { SetFlagState(SmsCpuFlags::Sign, value & 0x80); } - if constexpr(mask & SmsCpuFlags::Zero) { + if constexpr((mask & SmsCpuFlags::Zero) != 0) { SetFlagState(SmsCpuFlags::Zero, value == 0); } - if constexpr(mask & SmsCpuFlags::F5) { + if constexpr((mask & SmsCpuFlags::F5) != 0) { SetFlagState(SmsCpuFlags::F5, value & SmsCpuFlags::F5); } - if constexpr(mask & SmsCpuFlags::F3) { + if constexpr((mask & SmsCpuFlags::F3) != 0) { SetFlagState(SmsCpuFlags::F3, value & SmsCpuFlags::F3); } - if constexpr(mask & SmsCpuFlags::Parity) { + if constexpr((mask & SmsCpuFlags::Parity) != 0) { SetFlagState(SmsCpuFlags::Parity, _parity.CheckParity(value)); } } diff --git a/Core/SMS/SmsCpu.h b/Core/SMS/SmsCpu.h index df84f3fb8..723fa57f8 100644 --- a/Core/SMS/SmsCpu.h +++ b/Core/SMS/SmsCpu.h @@ -16,7 +16,7 @@ class SmsConsole; class SmsMemoryManager; class SmsCpuParityTable; -class SmsCpu : public ISerializable +class SmsCpu final : public ISerializable { private: static SmsCpuParityTable _parity; diff --git a/Core/SMS/SmsFmAudio.h b/Core/SMS/SmsFmAudio.h index 6139cbf1e..050f1cf62 100644 --- a/Core/SMS/SmsFmAudio.h +++ b/Core/SMS/SmsFmAudio.h @@ -6,7 +6,7 @@ class Emulator; class SmsConsole; typedef struct __OPLL OPLL; -class SmsFmAudio : public ISerializable, public IAudioProvider +class SmsFmAudio final : public ISerializable, public IAudioProvider { private: Emulator* _emu = nullptr; diff --git a/Core/SMS/SmsMemoryManager.cpp b/Core/SMS/SmsMemoryManager.cpp index 24ee75786..3b6919000 100644 --- a/Core/SMS/SmsMemoryManager.cpp +++ b/Core/SMS/SmsMemoryManager.cpp @@ -210,10 +210,6 @@ void SmsMemoryManager::Map(uint16_t start, uint16_t end, MemoryType type, uint32 _reads[i >> 8] = src; _writes[i >> 8] = readonly ? nullptr : src; - _state.MemoryType[i >> 8] = type; - _state.MemoryOffset[i >> 8] = offset; - _state.MemoryAccessType[i >> 8] = readonly ? SmsRegisterAccess::Read : SmsRegisterAccess::ReadWrite; - if(src) { src += 0x100; offset = (offset + 0x100); @@ -233,10 +229,6 @@ void SmsMemoryManager::Unmap(uint16_t start, uint16_t end) for(int i = start; i < end; i += 0x100) { _reads[i >> 8] = nullptr; _writes[i >> 8] = nullptr; - - _state.MemoryType[i >> 8] = MemoryType::None; - _state.MemoryOffset[i >> 8] = 0; - _state.MemoryAccessType[i >> 8] = SmsRegisterAccess::None; } } diff --git a/Core/SMS/SmsMemoryManager.h b/Core/SMS/SmsMemoryManager.h index 0b3767b00..03e4a2fdc 100644 --- a/Core/SMS/SmsMemoryManager.h +++ b/Core/SMS/SmsMemoryManager.h @@ -18,7 +18,7 @@ class SmsPsg; class SmsFmAudio; class SmsBiosMapper; -class SmsMemoryManager : public ISerializable +class SmsMemoryManager final : public ISerializable { private: static constexpr uint32_t WorkRamSize = 0x2000; @@ -120,5 +120,5 @@ class SmsMemoryManager : public ISerializable uint8_t ReadGameGearPort(uint8_t port); void WriteGameGearPort(uint8_t port, uint8_t value); - void Serialize(Serializer& s); + void Serialize(Serializer& s) override; }; diff --git a/Core/SMS/SmsPsg.h b/Core/SMS/SmsPsg.h index 66663bae8..348557de4 100644 --- a/Core/SMS/SmsPsg.h +++ b/Core/SMS/SmsPsg.h @@ -7,7 +7,7 @@ #include "Utilities/ISerializable.h" #include "Utilities/Audio/blip_buf.h" -class SmsPsg : public ISerializable +class SmsPsg final : public ISerializable { private: static constexpr int SampleRate = 96000; diff --git a/Core/SMS/SmsTypes.h b/Core/SMS/SmsTypes.h index 4617c8af4..64d015401 100644 --- a/Core/SMS/SmsTypes.h +++ b/Core/SMS/SmsTypes.h @@ -175,10 +175,6 @@ struct SmsMemoryManagerState bool IsReadRegister[0x100]; bool IsWriteRegister[0x100]; - MemoryType MemoryType[0x100]; - uint32_t MemoryOffset[0x100]; - SmsRegisterAccess MemoryAccessType[0x100]; - uint8_t OpenBus; bool ExpEnabled; diff --git a/Core/SMS/SmsVdp.h b/Core/SMS/SmsVdp.h index 062f5b87a..b68baa1f6 100644 --- a/Core/SMS/SmsVdp.h +++ b/Core/SMS/SmsVdp.h @@ -11,7 +11,7 @@ class SmsCpu; class SmsControlManager; class SmsMemoryManager; -class SmsVdp : public ISerializable +class SmsVdp final : public ISerializable { public: static constexpr int SmsVdpLeftBorder = 13; diff --git a/UI/Interop/DebugState.cs b/UI/Interop/DebugState.cs index fce8b9006..da05333e4 100644 --- a/UI/Interop/DebugState.cs +++ b/UI/Interop/DebugState.cs @@ -1937,15 +1937,6 @@ public struct SmsMemoryManagerState [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x100)] public byte[] IsWriteRegister; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x100)] - public MemoryType[] MemoryType; - - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x100)] - public UInt32[] MemoryOffset; - - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x100)] - public SmsRegisterAccess[] MemoryAccessType; - public byte OpenBus; [MarshalAs(UnmanagedType.I1)] public bool ExpEnabled; diff --git a/Utilities/Serializer.h b/Utilities/Serializer.h index c60208439..092932fe7 100644 --- a/Utilities/Serializer.h +++ b/Utilities/Serializer.h @@ -106,7 +106,7 @@ class Serializer uint8_t* ptr = (uint8_t*)&value; constexpr bool isBigEndian = false; constexpr int mask = isBigEndian ? sizeof(T) - 1 : 0; - for(int i = 0; i < sizeof(T); i++) { + for(int i = 0; i < (int)sizeof(T); i++) { _data.push_back(ptr[i ^ mask]); } } @@ -117,7 +117,7 @@ class Serializer uint8_t* ptr = (uint8_t*)&value; constexpr bool isBigEndian = false; constexpr int mask = isBigEndian ? sizeof(T) - 1 : 0; - for(int i = 0; i < sizeof(T); i++) { + for(int i = 0; i < (int)sizeof(T); i++) { ptr[i ^ mask] = src[i]; } }