Skip to content

Commit

Permalink
Linux: Fixed compilation errors/warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
SourMesen committed Dec 15, 2023
1 parent 5308983 commit 469734d
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 54 deletions.
2 changes: 1 addition & 1 deletion Core/Debugger/DisassemblySearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Core/SMS/Carts/SmsCodemasterCart.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SmsCodemasterCart : public SmsCart
}
}

void Serialize(Serializer& s)
void Serialize(Serializer& s) override
{
SVArray(_prgBanks, 3);
}
Expand Down
2 changes: 1 addition & 1 deletion Core/SMS/Carts/SmsKoreanCart.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SmsKoreanCart : public SmsCart
}
}

void Serialize(Serializer& s)
void Serialize(Serializer& s) override
{
SV(_prgBank);
}
Expand Down
2 changes: 1 addition & 1 deletion Core/SMS/Carts/SmsMsxCart.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SmsMsxCart : public SmsCart
}
}

void Serialize(Serializer& s)
void Serialize(Serializer& s) override
{
SVArray(_prgBanks, 4);
}
Expand Down
2 changes: 1 addition & 1 deletion Core/SMS/Carts/SmsNemesisCart.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SmsNemesisCart : public SmsCart
}
}

void Serialize(Serializer& s)
void Serialize(Serializer& s) override
{
SVArray(_prgBanks, 4);
}
Expand Down
2 changes: 1 addition & 1 deletion Core/SMS/Carts/SmsSegaCart.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class SmsSegaCart : public SmsCart
}
}

void Serialize(Serializer& s)
void Serialize(Serializer& s) override
{
SVArray(_prgBanks, 3);
SVArray(_ramEnabled, 2);
Expand Down
22 changes: 11 additions & 11 deletions Core/SMS/Debugger/SmsDisUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,44 +176,44 @@ 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;
}
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;
}
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;
}
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;
}
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;
Expand Down Expand Up @@ -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];
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Core/SMS/Debugger/SmsDisUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Core/SMS/SmsBiosMapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class SmsMemoryManager;

class SmsBiosMapper : public ISerializable
class SmsBiosMapper final : public ISerializable
{
private:
SmsMemoryManager* _memoryManager = nullptr;
Expand All @@ -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;
};
10 changes: 5 additions & 5 deletions Core/SMS/SmsCpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,19 +919,19 @@ void SmsCpu::WritePort(uint8_t port, uint8_t value)
template<uint8_t mask>
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));
}
}
Expand Down
2 changes: 1 addition & 1 deletion Core/SMS/SmsCpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SmsConsole;
class SmsMemoryManager;
class SmsCpuParityTable;

class SmsCpu : public ISerializable
class SmsCpu final : public ISerializable
{
private:
static SmsCpuParityTable _parity;
Expand Down
2 changes: 1 addition & 1 deletion Core/SMS/SmsFmAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions Core/SMS/SmsMemoryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
}

Expand Down
4 changes: 2 additions & 2 deletions Core/SMS/SmsMemoryManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
};
2 changes: 1 addition & 1 deletion Core/SMS/SmsPsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions Core/SMS/SmsTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Core/SMS/SmsVdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 0 additions & 9 deletions UI/Interop/DebugState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Utilities/Serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
Expand All @@ -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];
}
}
Expand Down

0 comments on commit 469734d

Please sign in to comment.