General: Apply the const specifier where applicable

This commit is contained in:
Lioncash 2015-04-15 00:38:21 -04:00
parent 7506c386cf
commit b0613bb1c8
39 changed files with 75 additions and 75 deletions

View File

@ -12,19 +12,19 @@
#include "Core/PowerPC/JitCommon/JitBase.h"
#include "Core/PowerPC/JitCommon/JitCache.h"
bool BreakPoints::IsAddressBreakPoint(u32 _iAddress)
bool BreakPoints::IsAddressBreakPoint(u32 address) const
{
for (const TBreakPoint& bp : m_BreakPoints)
if (bp.iAddress == _iAddress)
if (bp.iAddress == address)
return true;
return false;
}
bool BreakPoints::IsTempBreakPoint(u32 _iAddress)
bool BreakPoints::IsTempBreakPoint(u32 address) const
{
for (const TBreakPoint& bp : m_BreakPoints)
if (bp.iAddress == _iAddress && bp.bTemporary)
if (bp.iAddress == address && bp.bTemporary)
return true;
return false;

View File

@ -64,8 +64,8 @@ public:
void AddFromStrings(const TBreakPointsStr& bps);
// is address breakpoint
bool IsAddressBreakPoint(u32 _iAddress);
bool IsTempBreakPoint(u32 _iAddress);
bool IsAddressBreakPoint(u32 address) const;
bool IsTempBreakPoint(u32 address) const;
// Add BreakPoint
void Add(u32 em_address, bool temp = false);

View File

@ -949,7 +949,7 @@ bool IOFile::Seek(s64 off, int origin)
return m_good;
}
u64 IOFile::Tell()
u64 IOFile::Tell() const
{
if (IsOpen())
return ftello(m_file);

View File

@ -203,10 +203,10 @@ public:
return WriteArray(reinterpret_cast<const char*>(data), length);
}
bool IsOpen() { return nullptr != m_file; }
bool IsOpen() const { return nullptr != m_file; }
// m_good is set to false when a read, write or other function fails
bool IsGood() { return m_good; }
bool IsGood() const { return m_good; }
operator void*() { return m_good ? m_file : nullptr; }
std::FILE* ReleaseHandle();
@ -216,7 +216,7 @@ public:
void SetHandle(std::FILE* file);
bool Seek(s64 off, int origin);
u64 Tell();
u64 Tell() const;
u64 GetSize();
bool Resize(u64 size);
bool Flush();

View File

@ -32,7 +32,7 @@ public:
void Log(LogTypes::LOG_LEVELS, const char *msg) override;
bool IsValid() { return !m_logfile.fail(); }
bool IsValid() const { return m_logfile.good(); }
bool IsEnabled() const { return m_enable; }
void SetEnable(bool enable) { m_enable = enable; }

View File

@ -15,8 +15,8 @@ public:
CDolLoader(u8* _pBuffer, u32 _Size);
~CDolLoader();
bool IsWii() { return m_isWii; }
u32 GetEntryPoint() { return m_dolheader.entryPoint; }
bool IsWii() const { return m_isWii; }
u32 GetEntryPoint() const { return m_dolheader.entryPoint; }
// Load into emulated memory
void Load();

View File

@ -69,7 +69,7 @@ public:
int GetSectionSize(SectionID section) const { return sections[section].sh_size; }
SectionID GetSectionByName(const char* name, int firstSection = 0) const; //-1 for not found
bool DidRelocate()
bool DidRelocate() const
{
return bRelocate;
}

View File

@ -67,7 +67,7 @@ public:
void AddFrame(const FifoFrameInfo &frameInfo);
const FifoFrameInfo &GetFrame(u32 frame) const { return m_Frames[frame]; }
u32 GetFrameCount() { return static_cast<u32>(m_Frames.size()); }
u32 GetFrameCount() const { return static_cast<u32>(m_Frames.size()); }
bool Save(const std::string& filename);

View File

@ -36,7 +36,7 @@ public:
void SetVideoMemory(u32 *bpMem, u32 *cpMem, u32 *xfMem, u32 *xfRegs, u32 xfRegsSize);
// Checked once per frame prior to callng EndFrame()
bool IsRecording() { return m_IsRecording; }
bool IsRecording() const { return m_IsRecording; }
static FifoRecorder &GetInstance();

View File

@ -19,7 +19,7 @@ static const u32 INSTALLER_BASE_ADDRESS = 0x80001800;
static const u32 INSTALLER_END_ADDRESS = 0x80003000;
// return true if a code exists
bool GeckoCode::Exist(u32 address, u32 data)
bool GeckoCode::Exist(u32 address, u32 data) const
{
for (const GeckoCode::Code& code : codes)
{

View File

@ -38,7 +38,7 @@ namespace Gecko
bool user_defined;
bool Compare(GeckoCode compare) const;
bool Exist(u32 address, u32 data);
bool Exist(u32 address, u32 data) const;
};
void SetActiveCodes(const std::vector<GeckoCode>& gcodes);

View File

@ -49,7 +49,7 @@ void CMailHandler::Clear()
m_Mails.pop();
}
bool CMailHandler::IsEmpty()
bool CMailHandler::IsEmpty() const
{
return m_Mails.empty();
}

View File

@ -19,12 +19,12 @@ public:
void Clear();
void Halt(bool _Halt);
void DoState(PointerWrap &p);
bool IsEmpty();
bool IsEmpty() const;
u16 ReadDSPMailboxHigh();
u16 ReadDSPMailboxLow();
u32 GetNextMail()
u32 GetNextMail() const
{
if (!m_Mails.empty())
{

View File

@ -85,7 +85,7 @@ public:
u32 ImmRead (u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmRead", m_strName.c_str()); return 0;}
void DMAWrite(u32 addr, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMAWrite: %08x bytes, from %08x to device", m_strName.c_str(), size, addr);}
void DMARead (u32 addr, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMARead: %08x bytes, from device to %08x", m_strName.c_str(), size, addr);}
bool IsPresent() override { return true; }
bool IsPresent() const override { return true; }
};

View File

@ -39,9 +39,9 @@ public:
virtual void DMAWrite(u32 _uAddr, u32 _uSize);
virtual void DMARead (u32 _uAddr, u32 _uSize);
virtual bool UseDelayedTransferCompletion() {return false;}
virtual bool UseDelayedTransferCompletion() const { return false; }
virtual bool IsPresent() {return false;}
virtual bool IsPresent() const { return false; }
virtual void SetCS(int) {}
virtual void DoState(PointerWrap&) {}
virtual void PauseAndLock(bool doLock, bool unpauseOnUnlock=true) {}

View File

@ -20,7 +20,7 @@ void CEXIAD16::SetCS(int cs)
m_uPosition = 0;
}
bool CEXIAD16::IsPresent()
bool CEXIAD16::IsPresent() const
{
return true;
}

View File

@ -11,7 +11,7 @@ class CEXIAD16 : public IEXIDevice
public:
CEXIAD16();
virtual void SetCS(int _iCS) override;
virtual bool IsPresent() override;
virtual bool IsPresent() const override;
virtual void DoState(PointerWrap &p) override;
private:

View File

@ -15,7 +15,7 @@ class CEXIAgp
public:
CEXIAgp(const int index);
virtual ~CEXIAgp() override;
bool IsPresent() override { return true; }
bool IsPresent() const override { return true; }
void ImmWrite(u32 _uData, u32 _uSize) override;
u32 ImmRead(u32 _uSize) override;
void DoState(PointerWrap &p) override;

View File

@ -21,7 +21,7 @@ void CEXIAMBaseboard::SetCS(int cs)
m_position = 0;
}
bool CEXIAMBaseboard::IsPresent()
bool CEXIAMBaseboard::IsPresent() const
{
return true;
}

View File

@ -12,7 +12,7 @@ public:
CEXIAMBaseboard();
virtual void SetCS(int _iCS) override;
virtual bool IsPresent() override;
virtual bool IsPresent() const override;
virtual bool IsInterruptSet() override;
virtual void DoState(PointerWrap &p) override;

View File

@ -68,7 +68,7 @@ void CEXIETHERNET::SetCS(int cs)
}
}
bool CEXIETHERNET::IsPresent()
bool CEXIETHERNET::IsPresent() const
{
return true;
}

View File

@ -193,7 +193,7 @@ public:
CEXIETHERNET();
virtual ~CEXIETHERNET();
void SetCS(int cs) override;
bool IsPresent() override;
bool IsPresent() const override;
bool IsInterruptSet() override;
void ImmWrite(u32 data, u32 size) override;
u32 ImmRead(u32 size) override;

View File

@ -49,7 +49,7 @@ class CEXIGecko
{
public:
CEXIGecko() {}
bool IsPresent() override { return true; }
bool IsPresent() const override { return true; }
void ImmReadWrite(u32 &_uData, u32 _uSize) override;
private:

View File

@ -160,7 +160,7 @@ void CEXIIPL::SetCS(int _iCS)
}
}
bool CEXIIPL::IsPresent()
bool CEXIIPL::IsPresent() const
{
return true;
}

View File

@ -16,7 +16,7 @@ public:
virtual ~CEXIIPL();
virtual void SetCS(int _iCS) override;
bool IsPresent() override;
bool IsPresent() const override;
void DoState(PointerWrap &p) override;
static u32 GetGCTime();

View File

@ -246,12 +246,12 @@ CEXIMemoryCard::~CEXIMemoryCard()
CoreTiming::RemoveEvent(et_transfer_complete);
}
bool CEXIMemoryCard::UseDelayedTransferCompletion()
bool CEXIMemoryCard::UseDelayedTransferCompletion() const
{
return true;
}
bool CEXIMemoryCard::IsPresent()
bool CEXIMemoryCard::IsPresent() const
{
return true;
}

View File

@ -14,8 +14,8 @@ public:
virtual ~CEXIMemoryCard();
void SetCS(int cs) override;
bool IsInterruptSet() override;
bool UseDelayedTransferCompletion() override;
bool IsPresent() override;
bool UseDelayedTransferCompletion() const override;
bool IsPresent() const override;
void DoState(PointerWrap &p) override;
IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex = -1) override;
void DMARead(u32 _uAddr, u32 _uSize) override;

View File

@ -162,7 +162,7 @@ CEXIMic::~CEXIMic()
StreamTerminate();
}
bool CEXIMic::IsPresent()
bool CEXIMic::IsPresent() const
{
return true;
}

View File

@ -17,7 +17,7 @@ public:
virtual ~CEXIMic();
void SetCS(int cs) override;
bool IsInterruptSet() override;
bool IsPresent() override;
bool IsPresent() const override;
private:
static u8 const exi_id[];

View File

@ -75,7 +75,7 @@ public:
virtual void ClearBlock(u32 address) = 0;
virtual void ClearAll() = 0;
virtual void DoState(PointerWrap &p) = 0;
u32 GetCardId() { return nintendo_card_id; }
u32 GetCardId() const { return nintendo_card_id; }
bool IsAddressInBounds(u32 address) const
{
return address <= (memory_card_size - 1);
@ -302,11 +302,11 @@ class GCIFile
{
public:
bool LoadSaveBlocks();
bool HasCopyProtection()
bool HasCopyProtection() const
{
if ((strcmp((char *)m_gci_header.Filename, "PSO_SYSTEM") == 0) ||
(strcmp((char *)m_gci_header.Filename, "PSO3_SYSTEM") == 0) ||
(strcmp((char *)m_gci_header.Filename, "f_zero.dat") == 0))
if ((strcmp((char*)m_gci_header.Filename, "PSO_SYSTEM") == 0) ||
(strcmp((char*)m_gci_header.Filename, "PSO3_SYSTEM") == 0) ||
(strcmp((char*)m_gci_header.Filename, "f_zero.dat") == 0))
return true;
return false;
}

View File

@ -208,7 +208,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress)
}
u8 CWII_IPC_HLE_Device_net_kd_request::GetAreaCode(const std::string& area)
u8 CWII_IPC_HLE_Device_net_kd_request::GetAreaCode(const std::string& area) const
{
static std::map<const std::string, u8> regions = {
{ "JPN", 0 }, { "USA", 1 }, { "EUR", 2 },
@ -225,7 +225,7 @@ u8 CWII_IPC_HLE_Device_net_kd_request::GetAreaCode(const std::string& area)
return 7; // Unknown
}
u8 CWII_IPC_HLE_Device_net_kd_request::GetHardwareModel(const std::string& model)
u8 CWII_IPC_HLE_Device_net_kd_request::GetHardwareModel(const std::string& model) const
{
static std::map<const std::string, u8> models = {
{ "RVL", MODEL_RVL },

View File

@ -275,14 +275,14 @@ public:
return 0;
}
u32 Magic() {return Common::swap32(config.magic);}
void SetMagic(u32 magic) {config.magic = Common::swap32(magic);}
u32 Magic() const { return Common::swap32(config.magic); }
void SetMagic(u32 magic) { config.magic = Common::swap32(magic); }
u32 Unk() {return Common::swap32(config._unk_04);}
void SetUnk(u32 _unk_04) {config._unk_04 = Common::swap32(_unk_04);}
u32 Unk() const { return Common::swap32(config._unk_04); }
void SetUnk(u32 _unk_04) { config._unk_04 = Common::swap32(_unk_04); }
u32 IdGen() {return Common::swap32(config.id_generation);}
void SetIdGen(u32 id_generation) {config.id_generation = Common::swap32(id_generation);}
u32 IdGen() const { return Common::swap32(config.id_generation); }
void SetIdGen(u32 id_generation) { config.id_generation = Common::swap32(id_generation); }
void IncrementIdGen()
{
@ -292,19 +292,19 @@ public:
SetIdGen(id_ctr);
}
u32 Checksum() {return Common::swap32(config.checksum);}
void SetChecksum(u32 checksum) {config.checksum = Common::swap32(checksum);}
u32 Checksum() const { return Common::swap32(config.checksum); }
void SetChecksum(u32 checksum) { config.checksum = Common::swap32(checksum); }
u32 CreationStage() {return Common::swap32(config.creation_stage);}
void SetCreationStage(u32 creation_stage) {config.creation_stage = Common::swap32(creation_stage);}
u32 CreationStage() const { return Common::swap32(config.creation_stage); }
void SetCreationStage(u32 creation_stage) { config.creation_stage = Common::swap32(creation_stage); }
u32 EnableBooting() {return Common::swap32(config.enable_booting);}
void SetEnableBooting(u32 enable_booting) {config.enable_booting = Common::swap32(enable_booting);}
u32 EnableBooting() const { return Common::swap32(config.enable_booting); }
void SetEnableBooting(u32 enable_booting) { config.enable_booting = Common::swap32(enable_booting); }
u64 Id() {return Common::swap64(config.nwc24_id);}
void SetId(u64 nwc24_id) {config.nwc24_id = Common::swap64(nwc24_id);}
u64 Id() const { return Common::swap64(config.nwc24_id); }
void SetId(u64 nwc24_id) { config.nwc24_id = Common::swap64(nwc24_id); }
const char* Email() {return config.email;}
const char* Email() const { return config.email; }
void SetEmail(const char* email)
{
strncpy(config.email, email, nwc24_config_t::MAX_EMAIL_LENGTH);
@ -431,8 +431,8 @@ private:
MODEL_ELSE = 7
};
u8 GetAreaCode(const std::string& area);
u8 GetHardwareModel(const std::string& model);
u8 GetAreaCode(const std::string& area) const;
u8 GetHardwareModel(const std::string& model) const;
s32 NWC24MakeUserID(u64* nwc24_id, u32 hollywood_id, u16 id_ctr, u8 hardware_model, u8 area_code);

View File

@ -40,7 +40,7 @@ CWII_IPC_HLE_Device_net_ssl::~CWII_IPC_HLE_Device_net_ssl()
}
}
int CWII_IPC_HLE_Device_net_ssl::getSSLFreeID()
int CWII_IPC_HLE_Device_net_ssl::GetSSLFreeID() const
{
for (int i = 0; i < NET_SSL_MAXINSTANCES; i++)
{
@ -134,7 +134,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
int verifyOption = Memory::Read_U32(BufferOut);
std::string hostname = Memory::GetString(BufferOut2, BufferOutSize2);
int freeSSL = this->getSSLFreeID();
int freeSSL = GetSSLFreeID();
if (freeSSL)
{
int sslID = freeSSL - 1;

View File

@ -81,7 +81,7 @@ public:
virtual IPCCommandResult IOCtl(u32 _CommandAddress) override;
virtual IPCCommandResult IOCtlV(u32 _CommandAddress) override;
int getSSLFreeID();
int GetSSLFreeID() const;
static WII_SSL _SSL[NET_SSL_MAXINSTANCES];
};

View File

@ -21,9 +21,9 @@ class CBigEndianBuffer
public:
CBigEndianBuffer(u8* pBuffer) : m_pBuffer(pBuffer) {}
u8 Read8(u32 offset) { return m_pBuffer[offset]; }
u16 Read16(u32 offset) { return Common::swap16(*(u16*)&m_pBuffer[offset]); }
u32 Read32(u32 offset) { return Common::swap32(*(u32*)&m_pBuffer[offset]); }
u8 Read8(u32 offset) const { return m_pBuffer[offset]; }
u16 Read16(u32 offset) const { return Common::swap16(*(u16*)&m_pBuffer[offset]); }
u32 Read32(u32 offset) const { return Common::swap32(*(u32*)&m_pBuffer[offset]); }
void Write8(u32 offset, u8 data) { m_pBuffer[offset] = data; }
void Write16(u32 offset, u16 data) { *(u16*)&m_pBuffer[offset] = Common::swap16(data); }

View File

@ -189,7 +189,7 @@ private:
void DoSock(u32 _CommandAddress, NET_IOCTL type);
void DoSock(u32 _CommandAddress, SSL_IOCTL type);
void Update(bool read, bool write, bool except);
bool IsValid() { return fd >= 0; }
bool IsValid() const { return fd >= 0; }
public:
WiiSocket() : fd(-1), nonBlock(false) {}
~WiiSocket();
@ -216,7 +216,7 @@ public:
s32 NewSocket(s32 af, s32 type, s32 protocol);
void AddSocket(s32 fd);
s32 DeleteSocket(s32 s);
s32 GetLastNetError() { return errno_last; }
s32 GetLastNetError() const { return errno_last; }
void SetLastNetError(s32 error) { errno_last = error; }
void Clean()

View File

@ -44,7 +44,7 @@ unsigned int D3DBlob::Release()
return ref;
}
unsigned int D3DBlob::Size()
unsigned int D3DBlob::Size() const
{
return size;
}

View File

@ -24,7 +24,7 @@ public:
void AddRef();
unsigned int Release();
unsigned int Size();
unsigned int Size() const;
u8* Data();
private:

View File

@ -95,7 +95,7 @@ public:
bool OverlapsMemoryRange(u32 range_address, u32 range_size) const;
bool IsEfbCopy() { return is_efb_copy; }
bool IsEfbCopy() const { return is_efb_copy; }
};
virtual ~TextureCache(); // needs virtual for DX11 dtor