Turn loops into range-based form
and some things suggested by cppcheck and compiler warnings.
This commit is contained in:
parent
2ff794d299
commit
404624bf0b
|
@ -206,23 +206,23 @@ void ARMXEmitter::ORI2R(ARMReg rd, ARMReg rs, u32 val, ARMReg scratch)
|
|||
|
||||
void ARMXEmitter::FlushLitPool()
|
||||
{
|
||||
for(std::vector<LiteralPool>::iterator it = currentLitPool.begin(); it != currentLitPool.end(); ++it) {
|
||||
for(LiteralPool& pool : currentLitPool) {
|
||||
// Search for duplicates
|
||||
for(std::vector<LiteralPool>::iterator old_it = currentLitPool.begin(); old_it != it; ++old_it) {
|
||||
if ((*old_it).val == (*it).val)
|
||||
(*it).loc = (*old_it).loc;
|
||||
for(LiteralPool& old_pool : currentLitPool) {
|
||||
if (old_pool.val == pool.val)
|
||||
pool.loc = old_pool.loc;
|
||||
}
|
||||
|
||||
// Write the constant to Literal Pool
|
||||
if (!(*it).loc)
|
||||
if (!pool.loc)
|
||||
{
|
||||
(*it).loc = (s32)code;
|
||||
Write32((*it).val);
|
||||
pool.loc = (s32)code;
|
||||
Write32(pool.val);
|
||||
}
|
||||
s32 offset = (*it).loc - (s32)(*it).ldr_address - 8;
|
||||
s32 offset = pool.loc - (s32)pool.ldr_address - 8;
|
||||
|
||||
// Backpatch the LDR
|
||||
*(u32*)(*it).ldr_address |= (offset >= 0) << 23 | abs(offset);
|
||||
*(u32*)pool.ldr_address |= (offset >= 0) << 23 | abs(offset);
|
||||
}
|
||||
// TODO: Save a copy of previous pools in case they are still in range.
|
||||
currentLitPool.clear();
|
||||
|
|
|
@ -8,11 +8,10 @@
|
|||
#include "../Core/PowerPC/JitCommon/JitBase.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
bool BreakPoints::IsAddressBreakPoint(u32 _iAddress)
|
||||
{
|
||||
for (auto& bp : m_BreakPoints)
|
||||
for (const TBreakPoint& bp : m_BreakPoints)
|
||||
if (bp.iAddress == _iAddress)
|
||||
return true;
|
||||
return false;
|
||||
|
@ -20,7 +19,7 @@ bool BreakPoints::IsAddressBreakPoint(u32 _iAddress)
|
|||
|
||||
bool BreakPoints::IsTempBreakPoint(u32 _iAddress)
|
||||
{
|
||||
for (auto& bp : m_BreakPoints)
|
||||
for (const TBreakPoint& bp : m_BreakPoints)
|
||||
if (bp.iAddress == _iAddress && bp.bTemporary)
|
||||
return true;
|
||||
return false;
|
||||
|
@ -29,7 +28,7 @@ bool BreakPoints::IsTempBreakPoint(u32 _iAddress)
|
|||
BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const
|
||||
{
|
||||
TBreakPointsStr bps;
|
||||
for (const auto& bp : m_BreakPoints)
|
||||
for (const TBreakPoint& bp : m_BreakPoints)
|
||||
{
|
||||
if (!bp.bTemporary)
|
||||
{
|
||||
|
@ -44,7 +43,7 @@ BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const
|
|||
|
||||
void BreakPoints::AddFromStrings(const TBreakPointsStr& bpstrs)
|
||||
{
|
||||
for (const auto& bpstr : bpstrs)
|
||||
for (const std::string& bpstr : bpstrs)
|
||||
{
|
||||
TBreakPoint bp;
|
||||
std::stringstream ss;
|
||||
|
@ -84,7 +83,7 @@ void BreakPoints::Add(u32 em_address, bool temp)
|
|||
|
||||
void BreakPoints::Remove(u32 em_address)
|
||||
{
|
||||
for (TBreakPoints::iterator i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i)
|
||||
for (auto i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i)
|
||||
{
|
||||
if (i->iAddress == em_address)
|
||||
{
|
||||
|
@ -100,12 +99,10 @@ void BreakPoints::Clear()
|
|||
{
|
||||
if (jit)
|
||||
{
|
||||
std::for_each(m_BreakPoints.begin(), m_BreakPoints.end(),
|
||||
[](const TBreakPoint& bp)
|
||||
{
|
||||
jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4);
|
||||
}
|
||||
);
|
||||
for (const TBreakPoint& bp : m_BreakPoints)
|
||||
{
|
||||
jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4);
|
||||
}
|
||||
}
|
||||
|
||||
m_BreakPoints.clear();
|
||||
|
@ -114,7 +111,7 @@ void BreakPoints::Clear()
|
|||
MemChecks::TMemChecksStr MemChecks::GetStrings() const
|
||||
{
|
||||
TMemChecksStr mcs;
|
||||
for (const auto& bp : m_MemChecks)
|
||||
for (const TMemCheck& bp : m_MemChecks)
|
||||
{
|
||||
std::stringstream mc;
|
||||
mc << std::hex << bp.StartAddress;
|
||||
|
@ -129,7 +126,7 @@ MemChecks::TMemChecksStr MemChecks::GetStrings() const
|
|||
|
||||
void MemChecks::AddFromStrings(const TMemChecksStr& mcstrs)
|
||||
{
|
||||
for (const auto& mcstr : mcstrs)
|
||||
for (const std::string& mcstr : mcstrs)
|
||||
{
|
||||
TMemCheck mc;
|
||||
std::stringstream ss;
|
||||
|
@ -156,7 +153,7 @@ void MemChecks::Add(const TMemCheck& _rMemoryCheck)
|
|||
|
||||
void MemChecks::Remove(u32 _Address)
|
||||
{
|
||||
for (TMemChecks::iterator i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i)
|
||||
for (auto i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i)
|
||||
{
|
||||
if (i->StartAddress == _Address)
|
||||
{
|
||||
|
@ -168,7 +165,7 @@ void MemChecks::Remove(u32 _Address)
|
|||
|
||||
TMemCheck *MemChecks::GetMemCheck(u32 address)
|
||||
{
|
||||
for (auto& bp : m_MemChecks)
|
||||
for (TMemCheck& bp : m_MemChecks)
|
||||
{
|
||||
if (bp.bRange)
|
||||
{
|
||||
|
|
|
@ -192,7 +192,7 @@ std::vector<std::string> cdio_get_devices ()
|
|||
for (unsigned int j = checklist[i].num_min; j <= checklist[i].num_max; ++j)
|
||||
{
|
||||
std::string drive = StringFromFormat(checklist[i].format, j);
|
||||
if ( (is_cdrom(drive.c_str(), NULL)) > 0 )
|
||||
if ( (is_cdrom(drive, NULL)) > 0 )
|
||||
{
|
||||
drives.push_back(std::move(drive));
|
||||
}
|
||||
|
|
|
@ -117,9 +117,9 @@ public:
|
|||
case MODE_WRITE:
|
||||
case MODE_MEASURE:
|
||||
case MODE_VERIFY:
|
||||
for (auto itr = x.begin(); itr != x.end(); ++itr)
|
||||
for (V& val : x)
|
||||
{
|
||||
Do(*itr);
|
||||
Do(val);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -87,10 +87,9 @@ void IniFile::Section::Set(const std::string& key, const std::vector<std::string
|
|||
{
|
||||
std::string temp;
|
||||
// Join the strings with ,
|
||||
std::vector<std::string>::const_iterator it;
|
||||
for (it = newValues.begin(); it != newValues.end(); ++it)
|
||||
for (const std::string& value : newValues)
|
||||
{
|
||||
temp = (*it) + ",";
|
||||
temp = value + ",";
|
||||
}
|
||||
// remove last ,
|
||||
temp.resize(temp.length() - 1);
|
||||
|
@ -210,7 +209,7 @@ bool IniFile::Section::Delete(const std::string& key)
|
|||
|
||||
const IniFile::Section* IniFile::GetSection(const std::string& sectionName) const
|
||||
{
|
||||
for (const auto& sect : sections)
|
||||
for (const Section& sect : sections)
|
||||
if (!strcasecmp(sect.name.c_str(), sectionName.c_str()))
|
||||
return (&(sect));
|
||||
return 0;
|
||||
|
@ -218,7 +217,7 @@ const IniFile::Section* IniFile::GetSection(const std::string& sectionName) cons
|
|||
|
||||
IniFile::Section* IniFile::GetSection(const std::string& sectionName)
|
||||
{
|
||||
for (auto& sect : sections)
|
||||
for (Section& sect : sections)
|
||||
if (!strcasecmp(sect.name.c_str(), sectionName.c_str()))
|
||||
return (&(sect));
|
||||
return 0;
|
||||
|
@ -240,7 +239,7 @@ bool IniFile::DeleteSection(const std::string& sectionName)
|
|||
Section* s = GetSection(sectionName);
|
||||
if (!s)
|
||||
return false;
|
||||
for (std::vector<Section>::iterator iter = sections.begin(); iter != sections.end(); ++iter)
|
||||
for (auto iter = sections.begin(); iter != sections.end(); ++iter)
|
||||
{
|
||||
if (&(*iter) == s)
|
||||
{
|
||||
|
@ -399,21 +398,21 @@ bool IniFile::Save(const std::string& filename)
|
|||
return false;
|
||||
}
|
||||
|
||||
for (auto& section : sections)
|
||||
for (const Section& section : sections)
|
||||
{
|
||||
if (section.keys_order.size() != 0 || section.lines.size() != 0)
|
||||
out << "[" << section.name << "]" << std::endl;
|
||||
|
||||
if (section.keys_order.size() == 0)
|
||||
{
|
||||
for (auto s : section.lines)
|
||||
for (const std::string& s : section.lines)
|
||||
out << s << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto kvit = section.keys_order.begin(); kvit != section.keys_order.end(); ++kvit)
|
||||
for (const std::string& kvit : section.keys_order)
|
||||
{
|
||||
auto pair = section.values.find(*kvit);
|
||||
auto pair = section.values.find(kvit);
|
||||
out << pair->first << " = " << pair->second << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ LogManager::LogManager()
|
|||
m_consoleLog = new ConsoleListener();
|
||||
m_debuggerLog = new DebuggerLogListener();
|
||||
|
||||
for (auto& container : m_Log)
|
||||
for (LogContainer* container : m_Log)
|
||||
{
|
||||
container->SetEnable(true);
|
||||
container->AddListener(m_fileLog);
|
||||
|
@ -102,7 +102,7 @@ LogManager::~LogManager()
|
|||
m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_debuggerLog);
|
||||
}
|
||||
|
||||
for (auto& container : m_Log)
|
||||
for (LogContainer* container : m_Log)
|
||||
delete container;
|
||||
|
||||
delete m_fileLog;
|
||||
|
@ -168,10 +168,9 @@ void LogContainer::Trigger(LogTypes::LOG_LEVELS level, const char *msg)
|
|||
{
|
||||
std::lock_guard<std::mutex> lk(m_listeners_lock);
|
||||
|
||||
std::set<LogListener*>::const_iterator i;
|
||||
for (i = m_listeners.begin(); i != m_listeners.end(); ++i)
|
||||
for (LogListener* listener : m_listeners)
|
||||
{
|
||||
(*i)->Log(level, msg);
|
||||
listener->Log(level, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -95,11 +95,6 @@ public:
|
|||
const XFuncMap &Symbols() const {return functions;}
|
||||
XFuncMap &AccessSymbols() {return functions;}
|
||||
|
||||
// deprecated
|
||||
XFuncMap::iterator GetIterator() { return functions.begin(); }
|
||||
XFuncMap::const_iterator GetConstIterator() { return functions.begin(); }
|
||||
XFuncMap::iterator End() { return functions.end(); }
|
||||
|
||||
void Clear(const char *prefix = "");
|
||||
void List();
|
||||
void Index();
|
||||
|
|
|
@ -25,8 +25,7 @@ SysConf::~SysConf()
|
|||
|
||||
void SysConf::Clear()
|
||||
{
|
||||
for (std::vector<SSysConfEntry>::const_iterator i = m_Entries.begin();
|
||||
i < m_Entries.end() - 1; i++)
|
||||
for (auto i = m_Entries.begin(); i < m_Entries.end() - 1; ++i)
|
||||
delete [] i->data;
|
||||
m_Entries.clear();
|
||||
}
|
||||
|
@ -85,8 +84,7 @@ bool SysConf::LoadFromFileInternal(FILE *fh)
|
|||
}
|
||||
|
||||
// Last offset is an invalid entry. We ignore it throughout this class
|
||||
for (std::vector<SSysConfEntry>::iterator i = m_Entries.begin();
|
||||
i < m_Entries.end() - 1; i++)
|
||||
for (auto i = m_Entries.begin(); i < m_Entries.end() - 1; ++i)
|
||||
{
|
||||
SSysConfEntry& curEntry = *i;
|
||||
f.Seek(curEntry.offset, SEEK_SET);
|
||||
|
@ -300,7 +298,7 @@ void SysConf::GenerateSysConf()
|
|||
items[26].data[0] = 0x01;
|
||||
|
||||
|
||||
for (auto& item : items)
|
||||
for (const SSysConfEntry& item : items)
|
||||
m_Entries.push_back(item);
|
||||
|
||||
File::CreateFullPath(m_FilenameDefault);
|
||||
|
@ -362,8 +360,7 @@ bool SysConf::SaveToFile(const char *filename)
|
|||
{
|
||||
File::IOFile f(filename, "r+b");
|
||||
|
||||
for (std::vector<SSysConfEntry>::iterator i = m_Entries.begin();
|
||||
i < m_Entries.end() - 1; i++)
|
||||
for (auto i = m_Entries.begin(); i < m_Entries.end() - 1; ++i)
|
||||
{
|
||||
// Seek to after the name of this entry
|
||||
f.Seek(i->offset + i->nameLength + 1, SEEK_SET);
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
}
|
||||
|
||||
std::vector<SSysConfEntry>::iterator index = m_Entries.begin();
|
||||
for (; index < m_Entries.end() - 1; index++)
|
||||
for (; index < m_Entries.end() - 1; ++index)
|
||||
{
|
||||
if (strcmp(index->name, sectionName) == 0)
|
||||
break;
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
}
|
||||
|
||||
std::vector<SSysConfEntry>::iterator index = m_Entries.begin();
|
||||
for (; index < m_Entries.end() - 1; index++)
|
||||
for (; index < m_Entries.end() - 1; ++index)
|
||||
{
|
||||
if (strcmp(index->name, sectionName) == 0)
|
||||
break;
|
||||
|
@ -122,7 +122,7 @@ public:
|
|||
return false;
|
||||
|
||||
std::vector<SSysConfEntry>::iterator index = m_Entries.begin();
|
||||
for (; index < m_Entries.end() - 1; index++)
|
||||
for (; index < m_Entries.end() - 1; ++index)
|
||||
{
|
||||
if (strcmp(index->name, sectionName) == 0)
|
||||
break;
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
return false;
|
||||
|
||||
std::vector<SSysConfEntry>::iterator index = m_Entries.begin();
|
||||
for (; index < m_Entries.end() - 1; index++)
|
||||
for (; index < m_Entries.end() - 1; ++index)
|
||||
{
|
||||
if (strcmp(index->name, sectionName) == 0)
|
||||
break;
|
||||
|
|
|
@ -673,9 +673,9 @@ void UpdateTitle()
|
|||
if (ElapseTime == 0)
|
||||
ElapseTime = 1;
|
||||
|
||||
float FPS = Common::AtomicLoad(DrawnFrame) * 1000.0 / ElapseTime;
|
||||
float VPS = DrawnVideo * 1000.0 / ElapseTime;
|
||||
float Speed = DrawnVideo * (100 * 1000.0) / (VideoInterface::TargetRefreshRate * ElapseTime);
|
||||
float FPS = (float) (Common::AtomicLoad(DrawnFrame) * 1000.0 / ElapseTime);
|
||||
float VPS = (float) (DrawnVideo * 1000.0 / ElapseTime);
|
||||
float Speed = (float) (DrawnVideo * (100 * 1000.0) / (VideoInterface::TargetRefreshRate * ElapseTime));
|
||||
|
||||
// Settings are shown the same for both extended and summary info
|
||||
std::string SSettings = StringFromFormat("%s %s | %s | %s", cpu_core_base->GetName(), _CoreParameter.bCPUThread ? "DC" : "SC",
|
||||
|
|
|
@ -55,18 +55,17 @@ DSPDisassembler::~DSPDisassembler()
|
|||
return;
|
||||
|
||||
int count = 0;
|
||||
for (std::map<u16, int>::const_iterator iter = unk_opcodes.begin();
|
||||
iter != unk_opcodes.end(); ++iter)
|
||||
for (const auto& entry : unk_opcodes)
|
||||
{
|
||||
if (iter->second > 0)
|
||||
if (entry.second > 0)
|
||||
{
|
||||
count++;
|
||||
fprintf(uo.GetHandle(), "OP%04x\t%d", iter->first, iter->second);
|
||||
fprintf(uo.GetHandle(), "OP%04x\t%d", entry.first, entry.second);
|
||||
for (int j = 15; j >= 0; j--) // print op bits
|
||||
{
|
||||
if ((j & 0x3) == 3)
|
||||
fprintf(uo.GetHandle(), "\tb");
|
||||
fprintf(uo.GetHandle(), "%d", (iter->first >> j) & 0x1);
|
||||
fprintf(uo.GetHandle(), "%d", (entry.first >> j) & 0x1);
|
||||
}
|
||||
fprintf(uo.GetHandle(), "\n");
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
u32 GetNextMail()
|
||||
{
|
||||
if (m_Mails.size())
|
||||
if (!m_Mails.empty())
|
||||
{
|
||||
return m_Mails.front();
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ bool GeckoSockServer::GetAvailableSock(sf::SocketTCP &sock_to_fill)
|
|||
|
||||
std::lock_guard<std::mutex> lk(connection_lock);
|
||||
|
||||
if (waiting_socks.size())
|
||||
if (!waiting_socks.empty())
|
||||
{
|
||||
sock_to_fill = waiting_socks.front();
|
||||
if (clientThread.joinable())
|
||||
|
|
|
@ -56,7 +56,7 @@ bool GetAvailableSock(sf::SocketTCP& sock_to_fill)
|
|||
|
||||
std::lock_guard<std::mutex> lk(cs_gba);
|
||||
|
||||
if (waiting_socks.size())
|
||||
if (!waiting_socks.empty())
|
||||
{
|
||||
sock_to_fill = waiting_socks.front();
|
||||
waiting_socks.pop();
|
||||
|
|
|
@ -1257,7 +1257,7 @@ void Wiimote::DoState(PointerWrap& p)
|
|||
if (p.mode == PointerWrap::MODE_READ)
|
||||
{
|
||||
//clear
|
||||
while (m_read_requests.size())
|
||||
while (!m_read_requests.empty())
|
||||
m_read_requests.pop();
|
||||
|
||||
p.Do(size);
|
||||
|
|
|
@ -252,7 +252,7 @@ void Wiimote::Reset()
|
|||
memset(m_shake_step, 0, sizeof(m_shake_step));
|
||||
|
||||
// clear read request queue
|
||||
while (m_read_requests.size())
|
||||
while (!m_read_requests.empty())
|
||||
{
|
||||
delete[] m_read_requests.front().data;
|
||||
m_read_requests.pop();
|
||||
|
@ -351,7 +351,7 @@ bool Wiimote::Step()
|
|||
}
|
||||
|
||||
// check if there is a read data request
|
||||
if (m_read_requests.size())
|
||||
if (!m_read_requests.empty())
|
||||
{
|
||||
ReadRequest& rr = m_read_requests.front();
|
||||
// send up to 16 bytes to the wii
|
||||
|
|
|
@ -606,9 +606,9 @@ void Update()
|
|||
void UpdateDevices()
|
||||
{
|
||||
// Check if a hardware device must be updated
|
||||
for (TDeviceMap::const_iterator itr = g_DeviceMap.begin(); itr != g_DeviceMap.end(); ++itr)
|
||||
for (const auto& entry : g_DeviceMap)
|
||||
{
|
||||
if (itr->second->IsOpened() && itr->second->Update())
|
||||
if (entry.second->IsOpened() && entry.second->Update())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -59,8 +59,7 @@ bool CWII_IPC_HLE_Device_fs::Close(u32 _CommandAddress, bool _bForce)
|
|||
static u64 ComputeTotalFileSize(const File::FSTEntry& parentEntry)
|
||||
{
|
||||
u64 sizeOfFiles = 0;
|
||||
const std::vector<File::FSTEntry>& children = parentEntry.children;
|
||||
for (const auto& entry : children)
|
||||
for (const File::FSTEntry& entry : parentEntry.children)
|
||||
{
|
||||
if (entry.isDirectory)
|
||||
sizeOfFiles += ComputeTotalFileSize(entry);
|
||||
|
@ -146,10 +145,10 @@ bool CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
|||
|
||||
// Decode entities of invalid file system characters so that
|
||||
// games (such as HP:HBP) will be able to find what they expect.
|
||||
for (Common::replace_v::const_iterator it = replacements.begin(); it != replacements.end(); ++it)
|
||||
for (const Common::replace_t& r : replacements)
|
||||
{
|
||||
for (size_t j = 0; (j = FileName.find(it->second, j)) != FileName.npos; ++j)
|
||||
FileName.replace(j, it->second.length(), 1, it->first);
|
||||
for (size_t j = 0; (j = FileName.find(r.second, j)) != FileName.npos; ++j)
|
||||
FileName.replace(j, r.second.length(), 1, r.first);
|
||||
}
|
||||
|
||||
strcpy(pFilename, FileName.c_str());
|
||||
|
|
|
@ -94,9 +94,9 @@ CWII_IPC_HLE_Device_hid::~CWII_IPC_HLE_Device_hid()
|
|||
deinit_libusb = true;
|
||||
}
|
||||
|
||||
for ( std::map<u32,libusb_device_handle*>::const_iterator iter = open_devices.begin(); iter != open_devices.end(); ++iter )
|
||||
for (const auto& device : open_devices)
|
||||
{
|
||||
libusb_close(iter->second);
|
||||
libusb_close(device.second);
|
||||
}
|
||||
open_devices.clear();
|
||||
|
||||
|
|
|
@ -582,9 +582,9 @@ void WiiSockMan::Update()
|
|||
FD_ZERO(&read_fds);
|
||||
FD_ZERO(&write_fds);
|
||||
FD_ZERO(&except_fds);
|
||||
for (auto it = WiiSockets.begin(); it != WiiSockets.end(); ++it)
|
||||
for (auto& entry : WiiSockets)
|
||||
{
|
||||
WiiSocket& sock = it->second;
|
||||
WiiSocket& sock = entry.second;
|
||||
if (sock.valid())
|
||||
{
|
||||
FD_SET(sock.fd, &read_fds);
|
||||
|
|
|
@ -196,14 +196,11 @@ unsigned int NetPlayServer::OnConnect(sf::SocketTCP& socket)
|
|||
socket.Send(spac);
|
||||
|
||||
// sync values with new client
|
||||
std::map<sf::SocketTCP, Client>::const_iterator
|
||||
i,
|
||||
e = m_players.end();
|
||||
for (i = m_players.begin(); i!=e; ++i)
|
||||
for (const auto& p : m_players)
|
||||
{
|
||||
spac.Clear();
|
||||
spac << (MessageId)NP_MSG_PLAYER_JOIN;
|
||||
spac << i->second.pid << i->second.name << i->second.revision;
|
||||
spac << p.second.pid << p.second.name << p.second.revision;
|
||||
socket.Send(spac);
|
||||
}
|
||||
|
||||
|
@ -613,7 +610,7 @@ void NetPlayServer::unmapPortThread()
|
|||
// discovers the IGD
|
||||
bool NetPlayServer::initUPnP()
|
||||
{
|
||||
UPNPDev *devlist, *dev;
|
||||
UPNPDev *devlist;
|
||||
std::vector<UPNPDev *> igds;
|
||||
int descXMLsize = 0, upnperror = 0;
|
||||
char *descXML;
|
||||
|
@ -642,18 +639,14 @@ bool NetPlayServer::initUPnP()
|
|||
}
|
||||
|
||||
// Look for the IGD
|
||||
dev = devlist;
|
||||
while (dev)
|
||||
for (UPNPDev* dev = devlist; dev; dev = dev->pNext)
|
||||
{
|
||||
if (strstr(dev->st, "InternetGatewayDevice"))
|
||||
igds.push_back(dev);
|
||||
dev = dev->pNext;
|
||||
}
|
||||
|
||||
std::vector<UPNPDev *>::iterator i;
|
||||
for (i = igds.begin(); i != igds.end(); i++)
|
||||
for (const UPNPDev* dev : igds)
|
||||
{
|
||||
dev = *i;
|
||||
descXML = (char *) miniwget(dev->descURL, &descXMLsize, 0);
|
||||
if (descXML)
|
||||
{
|
||||
|
|
|
@ -53,8 +53,8 @@ void LoadPatchSection(const char *section, std::vector<Patch> &patches,
|
|||
std::string enabledSectionName = std::string(section) + "_Enabled";
|
||||
std::vector<std::string> enabledLines;
|
||||
std::set<std::string> enabledNames;
|
||||
localIni.GetLines(enabledSectionName, enabledLines);
|
||||
for (auto& line : enabledLines)
|
||||
localIni.GetLines(enabledSectionName.c_str(), enabledLines);
|
||||
for (const std::string& line : enabledLines)
|
||||
{
|
||||
if (line.size() != 0 && line[0] == '$')
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ void LoadPatchSection(const char *section, std::vector<Patch> &patches,
|
|||
Patch currentPatch;
|
||||
inis[i]->GetLines(section, lines);
|
||||
|
||||
for (auto line : lines)
|
||||
for (std::string& line : lines)
|
||||
{
|
||||
if (line.size() == 0)
|
||||
continue;
|
||||
|
@ -124,10 +124,9 @@ static void LoadDiscList(const char *section, std::vector<std::string> &_discLis
|
|||
if (!ini.GetLines(section, lines))
|
||||
return;
|
||||
|
||||
for (std::vector<std::string>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter)
|
||||
for (const std::string& line : lines)
|
||||
{
|
||||
std::string line = *iter;
|
||||
if (line.size())
|
||||
if (!line.empty())
|
||||
_discList.push_back(line);
|
||||
}
|
||||
}
|
||||
|
@ -136,9 +135,8 @@ static void LoadSpeedhacks(const char *section, std::map<u32, int> &hacks, IniFi
|
|||
{
|
||||
std::vector<std::string> keys;
|
||||
ini.GetKeys(section, keys);
|
||||
for (std::vector<std::string>::const_iterator iter = keys.begin(); iter != keys.end(); ++iter)
|
||||
for (const std::string& key : keys)
|
||||
{
|
||||
std::string key = *iter;
|
||||
std::string value;
|
||||
ini.Get(section, key, &value, "BOGUS");
|
||||
if (value != "BOGUS")
|
||||
|
@ -184,15 +182,15 @@ void LoadPatches()
|
|||
|
||||
void ApplyPatches(const std::vector<Patch> &patches)
|
||||
{
|
||||
for (const auto& patch : patches)
|
||||
for (const Patch& patch : patches)
|
||||
{
|
||||
if (patch.active)
|
||||
{
|
||||
for (std::vector<PatchEntry>::const_iterator iter2 = patch.entries.begin(); iter2 != patch.entries.end(); ++iter2)
|
||||
for (const PatchEntry& entry : patch.entries)
|
||||
{
|
||||
u32 addr = iter2->address;
|
||||
u32 value = iter2->value;
|
||||
switch (iter2->type)
|
||||
u32 addr = entry.address;
|
||||
u32 value = entry.value;
|
||||
switch (entry.type)
|
||||
{
|
||||
case PATCH_8BIT:
|
||||
Memory::Write_U8((u8)value, addr);
|
||||
|
|
|
@ -70,7 +70,7 @@ inline void UpdateFPSCR()
|
|||
inline double ForceSingle(double _x)
|
||||
{
|
||||
// convert to float...
|
||||
float x = _x;
|
||||
float x = (float) _x;
|
||||
if (!cpu_info.bFlushToZero && FPSCR.NI)
|
||||
{
|
||||
x = FlushToZero(x);
|
||||
|
|
|
@ -1789,7 +1789,7 @@ void Jit64::rlwimix(UGeckoInstruction inst)
|
|||
}
|
||||
else if (inst.SH)
|
||||
{
|
||||
if (mask == -(1U << inst.SH))
|
||||
if (mask == 0U - (1U << inst.SH))
|
||||
{
|
||||
MOV(32, R(EAX), gpr.R(s));
|
||||
SHL(32, R(EAX), Imm8(inst.SH));
|
||||
|
|
|
@ -374,7 +374,7 @@ using namespace Gen;
|
|||
JitBlock &b = blocks[it2->second];
|
||||
*GetICachePtr(b.originalAddress) = JIT_ICACHE_INVALID_WORD;
|
||||
DestroyBlock(it2->second, true);
|
||||
it2++;
|
||||
++it2;
|
||||
}
|
||||
if (it1 != it2)
|
||||
{
|
||||
|
|
|
@ -196,7 +196,7 @@ void AnalyzeFunction2(Symbol *func)
|
|||
u32 flags = func->flags;
|
||||
|
||||
bool nonleafcall = false;
|
||||
for (auto c : func->calls)
|
||||
for (const SCall& c : func->calls)
|
||||
{
|
||||
Symbol *called_func = g_symbolDB.GetSymbolFromAddr(c.function);
|
||||
if (called_func && (called_func->flags & FFLAG_LEAF) == 0)
|
||||
|
@ -603,10 +603,10 @@ void FindFunctionsAfterBLR(PPCSymbolDB *func_db)
|
|||
{
|
||||
vector<u32> funcAddrs;
|
||||
|
||||
for (PPCSymbolDB::XFuncMap::iterator iter = func_db->GetIterator(); iter != func_db->End(); ++iter)
|
||||
funcAddrs.push_back(iter->second.address + iter->second.size);
|
||||
for (const auto& func : func_db->Symbols())
|
||||
funcAddrs.push_back(func.second.address + func.second.size);
|
||||
|
||||
for (auto location : funcAddrs)
|
||||
for (u32& location : funcAddrs)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
|
@ -637,15 +637,15 @@ void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB *func_db)
|
|||
int numLeafs = 0, numNice = 0, numUnNice = 0;
|
||||
int numTimer = 0, numRFI = 0, numStraightLeaf = 0;
|
||||
int leafSize = 0, niceSize = 0, unniceSize = 0;
|
||||
for (PPCSymbolDB::XFuncMap::iterator iter = func_db->GetIterator(); iter != func_db->End(); ++iter)
|
||||
for (auto& func : func_db->AccessSymbols())
|
||||
{
|
||||
if (iter->second.address == 4)
|
||||
if (func.second.address == 4)
|
||||
{
|
||||
WARN_LOG(OSHLE, "Weird function");
|
||||
continue;
|
||||
}
|
||||
AnalyzeFunction2(&(iter->second));
|
||||
Symbol &f = iter->second;
|
||||
AnalyzeFunction2(&(func.second));
|
||||
Symbol &f = func.second;
|
||||
if (f.name.substr(0, 3) == "zzz")
|
||||
{
|
||||
if (f.flags & FFLAG_LEAF)
|
||||
|
|
|
@ -119,12 +119,12 @@ void PPCSymbolDB::FillInCallers()
|
|||
p.second.callers.clear();
|
||||
}
|
||||
|
||||
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); ++iter)
|
||||
for (auto& entry : functions)
|
||||
{
|
||||
Symbol &f = iter->second;
|
||||
for (auto& call : f.calls)
|
||||
Symbol &f = entry.second;
|
||||
for (const SCall& call : f.calls)
|
||||
{
|
||||
SCall NewCall(iter->first, call.callAddress);
|
||||
SCall NewCall(entry.first, call.callAddress);
|
||||
u32 FunctionAddress = call.function;
|
||||
|
||||
XFuncMap::iterator FuncIterator = functions.find(FunctionAddress);
|
||||
|
@ -149,12 +149,12 @@ void PPCSymbolDB::PrintCalls(u32 funcAddr) const
|
|||
{
|
||||
const Symbol &f = iter->second;
|
||||
INFO_LOG(OSHLE, "The function %s at %08x calls:", f.name.c_str(), f.address);
|
||||
for (std::vector<SCall>::const_iterator fiter = f.calls.begin(); fiter!=f.calls.end(); ++fiter)
|
||||
for (const SCall& call : f.calls)
|
||||
{
|
||||
XFuncMap::const_iterator n = functions.find(fiter->function);
|
||||
XFuncMap::const_iterator n = functions.find(call.function);
|
||||
if (n != functions.end())
|
||||
{
|
||||
INFO_LOG(CONSOLE,"* %08x : %s", fiter->callAddress, n->second.name.c_str());
|
||||
INFO_LOG(CONSOLE,"* %08x : %s", call.callAddress, n->second.name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,12 +171,12 @@ void PPCSymbolDB::PrintCallers(u32 funcAddr) const
|
|||
{
|
||||
const Symbol &f = iter->second;
|
||||
INFO_LOG(CONSOLE,"The function %s at %08x is called by:",f.name.c_str(),f.address);
|
||||
for (std::vector<SCall>::const_iterator fiter = f.callers.begin(); fiter != f.callers.end(); ++fiter)
|
||||
for (const SCall& caller : f.callers)
|
||||
{
|
||||
XFuncMap::const_iterator n = functions.find(fiter->function);
|
||||
XFuncMap::const_iterator n = functions.find(caller.function);
|
||||
if (n != functions.end())
|
||||
{
|
||||
INFO_LOG(CONSOLE,"* %08x : %s", fiter->callAddress, n->second.name.c_str());
|
||||
INFO_LOG(CONSOLE,"* %08x : %s", caller.callAddress, n->second.name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,13 +56,13 @@ bool SignatureDB::Save(const char *filename)
|
|||
}
|
||||
u32 fcount = (u32)database.size();
|
||||
f.WriteArray(&fcount, 1);
|
||||
for (FuncDB::const_iterator iter = database.begin(); iter != database.end(); ++iter)
|
||||
for (const auto& entry : database)
|
||||
{
|
||||
FuncDesc temp;
|
||||
memset(&temp, 0, sizeof(temp));
|
||||
temp.checkSum = iter->first;
|
||||
temp.size = iter->second.size;
|
||||
strncpy(temp.name, iter->second.name.c_str(), 127);
|
||||
temp.checkSum = entry.first;
|
||||
temp.size = entry.second.size;
|
||||
strncpy(temp.name, entry.second.name.c_str(), 127);
|
||||
f.WriteArray(&temp, 1);
|
||||
}
|
||||
|
||||
|
@ -87,9 +87,9 @@ u32 SignatureDB::Add(u32 startAddr, u32 size, const char *name)
|
|||
|
||||
void SignatureDB::List()
|
||||
{
|
||||
for (FuncDB::iterator iter = database.begin(); iter != database.end(); ++iter)
|
||||
for (const auto& entry : database)
|
||||
{
|
||||
INFO_LOG(OSHLE, "%s : %i bytes, hash = %08x", iter->second.name.c_str(), iter->second.size, iter->first);
|
||||
INFO_LOG(OSHLE, "%s : %i bytes, hash = %08x", entry.second.name.c_str(), entry.second.size, entry.first);
|
||||
}
|
||||
INFO_LOG(OSHLE, "%lu functions known in current database.",
|
||||
(unsigned long)database.size());
|
||||
|
@ -102,22 +102,23 @@ void SignatureDB::Clear()
|
|||
|
||||
void SignatureDB::Apply(PPCSymbolDB *symbol_db)
|
||||
{
|
||||
for (FuncDB::const_iterator iter = database.begin(); iter != database.end(); ++iter)
|
||||
for (const auto& entry : database)
|
||||
{
|
||||
u32 hash = iter->first;
|
||||
u32 hash = entry.first;
|
||||
Symbol *function = symbol_db->GetSymbolFromHash(hash);
|
||||
if (function)
|
||||
{
|
||||
// Found the function. Let's rename it according to the symbol file.
|
||||
if (iter->second.size == (unsigned int)function->size)
|
||||
if (entry.second.size == (unsigned int)function->size)
|
||||
{
|
||||
function->name = iter->second.name;
|
||||
INFO_LOG(OSHLE, "Found %s at %08x (size: %08x)!", iter->second.name.c_str(), function->address, function->size);
|
||||
function->name = entry.second.name;
|
||||
INFO_LOG(OSHLE, "Found %s at %08x (size: %08x)!", entry.second.name.c_str(), function->address, function->size);
|
||||
}
|
||||
else
|
||||
{
|
||||
function->name = iter->second.name;
|
||||
ERROR_LOG(OSHLE, "Wrong size! Found %s at %08x (size: %08x instead of %08x)!", iter->second.name.c_str(), function->address, function->size, iter->second.size);
|
||||
function->name = entry.second.name;
|
||||
ERROR_LOG(OSHLE, "Wrong size! Found %s at %08x (size: %08x instead of %08x)!",
|
||||
entry.second.name.c_str(), function->address, function->size, entry.second.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -127,14 +128,14 @@ void SignatureDB::Apply(PPCSymbolDB *symbol_db)
|
|||
void SignatureDB::Initialize(PPCSymbolDB *symbol_db, const char *prefix)
|
||||
{
|
||||
std::string prefix_str(prefix);
|
||||
for (PPCSymbolDB::XFuncMap::const_iterator iter = symbol_db->GetConstIterator(); iter != symbol_db->End(); ++iter)
|
||||
for (const auto& symbol : symbol_db->Symbols())
|
||||
{
|
||||
if ((iter->second.name.substr(0, prefix_str.size()) == prefix_str) || prefix_str.empty())
|
||||
if ((symbol.second.name.substr(0, prefix_str.size()) == prefix_str) || prefix_str.empty())
|
||||
{
|
||||
DBFunc temp_dbfunc;
|
||||
temp_dbfunc.name = iter->second.name;
|
||||
temp_dbfunc.size = iter->second.size;
|
||||
database[iter->second.hash] = temp_dbfunc;
|
||||
temp_dbfunc.name = symbol.second.name;
|
||||
temp_dbfunc.size = symbol.second.size;
|
||||
database[symbol.second.hash] = temp_dbfunc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,9 +21,8 @@
|
|||
namespace DiscIO
|
||||
{
|
||||
|
||||
CompressedBlobReader::CompressedBlobReader(const char *filename)
|
||||
CompressedBlobReader::CompressedBlobReader(const char *filename) : file_name(filename)
|
||||
{
|
||||
file_name = filename;
|
||||
m_file.Open(filename, "rb");
|
||||
file_size = File::GetSize(filename);
|
||||
m_file.ReadArray(&header, 1);
|
||||
|
|
|
@ -267,7 +267,7 @@ bool ParsePartitionData(SPartition& _rPartition)
|
|||
IVolume *OldVolume = m_Disc;
|
||||
|
||||
// Ready some stuff
|
||||
m_Disc = CreateVolumeFromFilename(m_Filename.c_str(), _rPartition.GroupNumber, _rPartition.Number);
|
||||
m_Disc = CreateVolumeFromFilename(m_Filename, _rPartition.GroupNumber, _rPartition.Number);
|
||||
IFileSystem *FileSystem = CreateFileSystem(m_Disc);
|
||||
|
||||
if (!FileSystem)
|
||||
|
|
|
@ -106,7 +106,7 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
|
|||
WriteToBuffer(FST_ADDRESS, m_fstSize, m_FSTData, _Offset, _Length, _pBuffer);
|
||||
}
|
||||
|
||||
if(m_virtualDisk.size() == 0)
|
||||
if(m_virtualDisk.empty())
|
||||
return true;
|
||||
|
||||
// Determine which file the offset refers to
|
||||
|
|
|
@ -127,8 +127,8 @@ namespace ButtonManager
|
|||
bool pressed = false;
|
||||
pressed = m_buttons[std::make_pair(padID, button)]->Pressed();
|
||||
|
||||
for (auto it = m_controllers.begin(); it != m_controllers.end(); ++it)
|
||||
pressed |= it->second->ButtonValue(padID, button);
|
||||
for (const auto& ctrl : m_controllers)
|
||||
pressed |= ctrl.second->ButtonValue(padID, button);
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
@ -172,10 +172,10 @@ namespace ButtonManager
|
|||
}
|
||||
void Shutdown()
|
||||
{
|
||||
for(auto it = m_buttons.begin(); it != m_buttons.end(); ++it)
|
||||
delete it->second;
|
||||
for (auto it = m_controllers.begin(); it != m_controllers.end(); ++it)
|
||||
delete it->second;
|
||||
for (const auto& button : m_buttons)
|
||||
delete button.second;
|
||||
for (const auto& controller : m_controllers)
|
||||
delete controller.second;
|
||||
m_controllers.clear();
|
||||
m_buttons.clear();
|
||||
}
|
||||
|
|
|
@ -108,8 +108,8 @@ namespace ButtonManager
|
|||
: _dev(dev) {}
|
||||
~InputDevice()
|
||||
{
|
||||
for (auto it = _binds.begin(); it != _binds.end(); ++it)
|
||||
delete it->second;
|
||||
for (const auto& bind : _binds)
|
||||
delete bind.second;
|
||||
}
|
||||
void AddBind(sBind *bind) { _binds[bind->_buttontype] = bind; _inputbinds[bind->_bind] = bind; }
|
||||
void PressEvent(int button, int action);
|
||||
|
|
|
@ -184,7 +184,7 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
|
|||
CreateGUIControls();
|
||||
|
||||
// Update selected ISO paths
|
||||
for(auto& folder : SConfig::GetInstance().m_ISOFolder)
|
||||
for(const std::string& folder : SConfig::GetInstance().m_ISOFolder)
|
||||
{
|
||||
ISOPaths->Append(StrToWxStr(folder));
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ void CConfigMain::InitializeGUILists()
|
|||
arrayStringFor_Framelimit.Add(wxString::Format(wxT("%i"), i));
|
||||
|
||||
// Emulator Engine
|
||||
for (auto& CPUCores_a : CPUCores)
|
||||
for (const CPUCore& CPUCores_a : CPUCores)
|
||||
arrayStringFor_CPUEngine.Add(wxGetTranslation(CPUCores_a.name));
|
||||
|
||||
// DSP Engine
|
||||
|
@ -979,12 +979,9 @@ void CConfigMain::AudioSettingsChanged(wxCommandEvent& event)
|
|||
|
||||
void CConfigMain::AddAudioBackends()
|
||||
{
|
||||
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
|
||||
// I'm sure Billiard will change this into an auto sometimes soon :P
|
||||
for (std::vector<std::string>::const_iterator iter = backends.begin();
|
||||
iter != backends.end(); ++iter)
|
||||
for (const std::string& backend : AudioCommon::GetSoundBackends())
|
||||
{
|
||||
BackendSelection->Append(wxGetTranslation(StrToWxStr(*iter)));
|
||||
BackendSelection->Append(wxGetTranslation(StrToWxStr(backend)));
|
||||
int num = BackendSelection->
|
||||
FindString(StrToWxStr(SConfig::GetInstance().sBackend));
|
||||
BackendSelection->SetSelection(num);
|
||||
|
|
|
@ -354,10 +354,10 @@ void CCodeWindow::NotifyMapLoaded()
|
|||
//symbols->Show(false); // hide it for faster filling
|
||||
symbols->Freeze(); // HyperIris: wx style fast filling
|
||||
symbols->Clear();
|
||||
for (PPCSymbolDB::XFuncMap::iterator iter = g_symbolDB.GetIterator(); iter != g_symbolDB.End(); ++iter)
|
||||
for (const auto& symbol : g_symbolDB.Symbols())
|
||||
{
|
||||
int idx = symbols->Append(StrToWxStr(iter->second.name));
|
||||
symbols->SetClientData(idx, (void*)&iter->second);
|
||||
int idx = symbols->Append(StrToWxStr(symbol.second.name));
|
||||
symbols->SetClientData(idx, (void*)&symbol.second);
|
||||
}
|
||||
symbols->Thaw();
|
||||
//symbols->Show(true);
|
||||
|
|
|
@ -205,11 +205,10 @@ void DSPDebuggerLLE::UpdateSymbolMap()
|
|||
|
||||
m_SymbolList->Freeze(); // HyperIris: wx style fast filling
|
||||
m_SymbolList->Clear();
|
||||
for (SymbolDB::XFuncMap::iterator iter = DSPSymbols::g_dsp_symbol_db.GetIterator();
|
||||
iter != DSPSymbols::g_dsp_symbol_db.End(); ++iter)
|
||||
for (const auto& symbol : DSPSymbols::g_dsp_symbol_db.Symbols())
|
||||
{
|
||||
int idx = m_SymbolList->Append(StrToWxStr(iter->second.name));
|
||||
m_SymbolList->SetClientData(idx, (void*)&iter->second);
|
||||
int idx = m_SymbolList->Append(StrToWxStr(symbol.second.name));
|
||||
m_SymbolList->SetClientData(idx, (void*)&symbol.second);
|
||||
}
|
||||
m_SymbolList->Thaw();
|
||||
}
|
||||
|
|
|
@ -337,7 +337,7 @@ void CMemoryWindow::onSearch(wxCommandEvent& event)
|
|||
tmpstr = new char[newsize + 1];
|
||||
memset(tmpstr, 0, newsize + 1);
|
||||
}
|
||||
sprintf(tmpstr, "%s%s", tmpstr, WxStrToStr(rawData).c_str());
|
||||
strcat(tmpstr, WxStrToStr(rawData).c_str());
|
||||
tmp2 = &Dest.front();
|
||||
count = 0;
|
||||
for(i = 0; i < strlen(tmpstr); i++)
|
||||
|
|
|
@ -515,7 +515,7 @@ void FifoPlayerDlg::OnFindNextClick(wxCommandEvent& event)
|
|||
return;
|
||||
}
|
||||
|
||||
for (std::vector<SearchResult>::iterator it = search_results.begin(); it != search_results.end(); ++it)
|
||||
for (auto it = search_results.begin(); it != search_results.end(); ++it)
|
||||
{
|
||||
if (it->cmd_idx > cur_cmd_index)
|
||||
{
|
||||
|
@ -534,7 +534,7 @@ void FifoPlayerDlg::OnFindPreviousClick(wxCommandEvent& event)
|
|||
return;
|
||||
}
|
||||
|
||||
for (std::vector<SearchResult>::reverse_iterator it = search_results.rbegin(); it != search_results.rend(); ++it)
|
||||
for (auto it = search_results.rbegin(); it != search_results.rend(); ++it)
|
||||
{
|
||||
if (it->cmd_idx < cur_cmd_index)
|
||||
{
|
||||
|
|
|
@ -1010,19 +1010,19 @@ void CISOProperties::LoadGameConfig()
|
|||
// First set values from default gameini, then apply values from local gameini
|
||||
int iTemp;
|
||||
GameIniDefault.Get("Video", "ProjectionHack", &iTemp);
|
||||
PHackEnable->SetValue(iTemp);
|
||||
PHackEnable->SetValue(!!iTemp);
|
||||
if (GameIniLocal.Get("Video", "ProjectionHack", &iTemp))
|
||||
PHackEnable->SetValue(iTemp);
|
||||
PHackEnable->SetValue(!!iTemp);
|
||||
|
||||
GameIniDefault.Get("Video", "PH_SZNear", &PHack_Data.PHackSZNear);
|
||||
if (GameIniLocal.GetIfExists("Video", "PH_SZNear", &iTemp))
|
||||
PHack_Data.PHackSZNear = iTemp;
|
||||
PHack_Data.PHackSZNear = !!iTemp;
|
||||
GameIniDefault.Get("Video", "PH_SZFar", &PHack_Data.PHackSZFar);
|
||||
if (GameIniLocal.GetIfExists("Video", "PH_SZFar", &iTemp))
|
||||
PHack_Data.PHackSZFar = iTemp;
|
||||
PHack_Data.PHackSZFar = !!iTemp;
|
||||
GameIniDefault.Get("Video", "PH_ExtraParam", &PHack_Data.PHackExP);
|
||||
if (GameIniLocal.GetIfExists("Video", "PH_ExtraParam", &iTemp))
|
||||
PHack_Data.PHackExP = iTemp;
|
||||
PHack_Data.PHackExP = !!iTemp;
|
||||
|
||||
std::string sTemp;
|
||||
GameIniDefault.Get("Video", "PH_ZNear", &PHack_Data.PHZNear);
|
||||
|
@ -1242,9 +1242,9 @@ void CISOProperties::PatchList_Save()
|
|||
if (DefaultPatches.find(p.name) == DefaultPatches.end())
|
||||
{
|
||||
lines.push_back("$" + p.name);
|
||||
for (auto iter2 = p.entries.begin(); iter2 != p.entries.end(); ++iter2)
|
||||
for (const PatchEngine::PatchEntry& entry : p.entries)
|
||||
{
|
||||
std::string temp = StringFromFormat("0x%08X:%s:0x%08X", iter2->address, PatchEngine::PatchTypeStrings[iter2->type], iter2->value);
|
||||
std::string temp = StringFromFormat("0x%08X:%s:0x%08X", entry.address, PatchEngine::PatchTypeStrings[entry.type], entry.value);
|
||||
lines.push_back(temp);
|
||||
}
|
||||
}
|
||||
|
@ -1308,9 +1308,8 @@ void CISOProperties::ActionReplayList_Load()
|
|||
ActionReplay::LoadCodes(arCodes, GameIniDefault, GameIniLocal);
|
||||
|
||||
u32 index = 0;
|
||||
for (std::vector<ActionReplay::ARCode>::const_iterator it = arCodes.begin(); it != arCodes.end(); ++it)
|
||||
for (const ActionReplay::ARCode& arCode : arCodes)
|
||||
{
|
||||
ActionReplay::ARCode arCode = *it;
|
||||
Cheats->Append(StrToWxStr(arCode.name));
|
||||
Cheats->Check(index, arCode.active);
|
||||
if (!arCode.user_defined)
|
||||
|
@ -1324,7 +1323,7 @@ void CISOProperties::ActionReplayList_Save()
|
|||
std::vector<std::string> lines;
|
||||
std::vector<std::string> enabledLines;
|
||||
u32 index = 0;
|
||||
for (auto code : arCodes)
|
||||
for (const ActionReplay::ARCode& code : arCodes)
|
||||
{
|
||||
if (Cheats->IsChecked(index))
|
||||
enabledLines.push_back("$" + code.name);
|
||||
|
@ -1333,7 +1332,7 @@ void CISOProperties::ActionReplayList_Save()
|
|||
if (DefaultCheats.find(code.name) == DefaultCheats.end())
|
||||
{
|
||||
lines.push_back("$" + code.name);
|
||||
for (auto& op : code.ops)
|
||||
for (const ActionReplay::AREntry& op : code.ops)
|
||||
{
|
||||
lines.push_back(WxStrToStr(wxString::Format(wxT("%08X %08X"), op.cmd_addr, op.value)));
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ void CLogWindow::OnLogTimer(wxTimerEvent& WXUNUSED(event))
|
|||
|
||||
UpdateLog();
|
||||
// Scroll to the last line
|
||||
if (msgQueue.size() > 0)
|
||||
if (!msgQueue.empty())
|
||||
{
|
||||
m_Log->ScrollLines(1);
|
||||
m_Log->ShowPosition( m_Log->GetLastPosition() );
|
||||
|
|
|
@ -47,7 +47,7 @@ void CWiiSaveCrypted::ExportAllSaves()
|
|||
std::string folder = StringFromFormat("%s/%08x/", titleFolder.c_str(), pathMask | i);
|
||||
File::ScanDirectoryTree(folder, FST_Temp);
|
||||
|
||||
for (auto& entry : FST_Temp.children)
|
||||
for (const File::FSTEntry& entry : FST_Temp.children)
|
||||
{
|
||||
if (entry.isDirectory)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ void CWiiSaveCrypted::ExportAllSaves()
|
|||
}
|
||||
}
|
||||
SuccessAlertT("Found %x save files", (unsigned int) titles.size());
|
||||
for (auto& title : titles)
|
||||
for (const u64& title : titles)
|
||||
{
|
||||
CWiiSaveCrypted* exportSave = new CWiiSaveCrypted("", title);
|
||||
delete exportSave;
|
||||
|
@ -377,21 +377,21 @@ void CWiiSaveCrypted::ExportWiiSaveFiles()
|
|||
__name = FilesList[i].substr(WiiTitlePath.length()+1);
|
||||
|
||||
|
||||
for (Common::replace_v::const_iterator iter = replacements.begin(); iter != replacements.end(); ++iter)
|
||||
for (const Common::replace_t& repl : replacements)
|
||||
{
|
||||
for (size_t j = 0; (j = __name.find(iter->second, j)) != __name.npos; ++j)
|
||||
for (size_t j = 0; (j = __name.find(repl.second, j)) != __name.npos; ++j)
|
||||
{
|
||||
__name.replace(j, iter->second.length(), 1, iter->first);
|
||||
__name.replace(j, repl.second.length(), 1, repl.first);
|
||||
}
|
||||
}
|
||||
|
||||
if (__name.length() > 0x44)
|
||||
{
|
||||
PanicAlertT("%s is too long for the filename, max chars is 45", __name.c_str());
|
||||
PanicAlertT("\"%s\" is too long for the filename, max length is 0x44 + \\0", __name.c_str());
|
||||
b_valid = false;
|
||||
return;
|
||||
}
|
||||
strncpy((char *)tmpFileHDR.name, __name.c_str(), __name.length());
|
||||
strncpy((char *)tmpFileHDR.name, __name.c_str(), sizeof(tmpFileHDR.name));
|
||||
|
||||
{
|
||||
File::IOFile fpData_bin(encryptedSavePath, "ab");
|
||||
|
@ -583,7 +583,7 @@ void CWiiSaveCrypted::ScanForFiles(std::string savDir, std::vector<std::string>&
|
|||
|
||||
File::FSTEntry FST_Temp;
|
||||
File::ScanDirectoryTree(Directories[i], FST_Temp);
|
||||
for (auto& elem : FST_Temp.children)
|
||||
for (const File::FSTEntry& elem : FST_Temp.children)
|
||||
{
|
||||
if (strncmp(elem.virtualName.c_str(), "banner.bin", 10) != 0)
|
||||
{
|
||||
|
|
|
@ -102,7 +102,7 @@ public:
|
|||
while (it != expr.end())
|
||||
{
|
||||
char c = *it;
|
||||
it++;
|
||||
++it;
|
||||
if (c == '`')
|
||||
return false;
|
||||
if (c > 0 && c == otherDelim)
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
if (!isalpha(c))
|
||||
break;
|
||||
name += c;
|
||||
it++;
|
||||
++it;
|
||||
}
|
||||
|
||||
ControlQualifier qualifier;
|
||||
|
|
|
@ -41,8 +41,8 @@ public:
|
|||
offset = 0;
|
||||
context->Map(buf, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
|
||||
|
||||
for(std::list<bool*>::iterator it = observers.begin(); it != observers.end(); ++it)
|
||||
**it = true;
|
||||
for(bool* observer : observers)
|
||||
*observer = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -149,9 +149,9 @@ void LineGeometryShader::Shutdown()
|
|||
{
|
||||
m_ready = false;
|
||||
|
||||
for (ComboMap::iterator it = m_shaders.begin(); it != m_shaders.end(); ++it)
|
||||
for (auto& it : m_shaders)
|
||||
{
|
||||
SAFE_RELEASE(it->second);
|
||||
SAFE_RELEASE(it.second);
|
||||
}
|
||||
m_shaders.clear();
|
||||
|
||||
|
|
|
@ -1012,10 +1012,9 @@ void PSTextureEncoder::Shutdown()
|
|||
SAFE_RELEASE(m_classLinkage);
|
||||
SAFE_RELEASE(m_dynamicShader);
|
||||
|
||||
for (ComboMap::iterator it = m_staticShaders.begin();
|
||||
it != m_staticShaders.end(); ++it)
|
||||
for (auto& it : m_staticShaders)
|
||||
{
|
||||
SAFE_RELEASE(it->second);
|
||||
SAFE_RELEASE(it.second);
|
||||
}
|
||||
m_staticShaders.clear();
|
||||
|
||||
|
|
|
@ -410,8 +410,8 @@ void PixelShaderCache::Init()
|
|||
// ONLY to be used during shutdown.
|
||||
void PixelShaderCache::Clear()
|
||||
{
|
||||
for (PSCache::iterator iter = PixelShaders.begin(); iter != PixelShaders.end(); iter++)
|
||||
iter->second.Destroy();
|
||||
for (auto& iter : PixelShaders)
|
||||
iter.second.Destroy();
|
||||
PixelShaders.clear();
|
||||
pixel_uid_checker.Invalidate();
|
||||
|
||||
|
|
|
@ -143,9 +143,9 @@ void PointGeometryShader::Shutdown()
|
|||
{
|
||||
m_ready = false;
|
||||
|
||||
for (ComboMap::iterator it = m_shaders.begin(); it != m_shaders.end(); ++it)
|
||||
for (auto& it : m_shaders)
|
||||
{
|
||||
SAFE_RELEASE(it->second);
|
||||
SAFE_RELEASE(it.second);
|
||||
}
|
||||
m_shaders.clear();
|
||||
|
||||
|
|
|
@ -157,8 +157,8 @@ void VertexShaderCache::Init()
|
|||
|
||||
void VertexShaderCache::Clear()
|
||||
{
|
||||
for (VSCache::iterator iter = vshaders.begin(); iter != vshaders.end(); ++iter)
|
||||
iter->second.Destroy();
|
||||
for (auto& iter : vshaders)
|
||||
iter.second.Destroy();
|
||||
vshaders.clear();
|
||||
vertex_uid_checker.Invalidate();
|
||||
|
||||
|
|
|
@ -710,15 +710,14 @@ void Renderer::DrawDebugInfo()
|
|||
int a = 0;
|
||||
GLfloat color[3] = {0.0f, 1.0f, 1.0f};
|
||||
|
||||
for (std::vector<EFBRectangle>::const_iterator it = stats.efb_regions.begin();
|
||||
it != stats.efb_regions.end(); ++it)
|
||||
for (const EFBRectangle& rect : stats.efb_regions)
|
||||
{
|
||||
GLfloat halfWidth = EFB_WIDTH / 2.0f;
|
||||
GLfloat halfHeight = EFB_HEIGHT / 2.0f;
|
||||
GLfloat x = (GLfloat) -1.0f + ((GLfloat)it->left / halfWidth);
|
||||
GLfloat y = (GLfloat) 1.0f - ((GLfloat)it->top / halfHeight);
|
||||
GLfloat x2 = (GLfloat) -1.0f + ((GLfloat)it->right / halfWidth);
|
||||
GLfloat y2 = (GLfloat) 1.0f - ((GLfloat)it->bottom / halfHeight);
|
||||
GLfloat x = (GLfloat) -1.0f + ((GLfloat)rect.left / halfWidth);
|
||||
GLfloat y = (GLfloat) 1.0f - ((GLfloat)rect.top / halfHeight);
|
||||
GLfloat x2 = (GLfloat) -1.0f + ((GLfloat)rect.right / halfWidth);
|
||||
GLfloat y2 = (GLfloat) 1.0f - ((GLfloat)rect.bottom / halfHeight);
|
||||
|
||||
Vertices[a++] = x;
|
||||
Vertices[a++] = y;
|
||||
|
@ -1782,7 +1781,7 @@ void Renderer::FlipImageData(u8 *data, int w, int h, int pixel_width)
|
|||
{
|
||||
for(int x = 0; x < w; ++x)
|
||||
{
|
||||
for (auto delta = 0; delta < pixel_width; ++delta)
|
||||
for (int delta = 0; delta < pixel_width; ++delta)
|
||||
std::swap(data[(y * w + x) * pixel_width + delta], data[((h - 1 - y) * w + x) * pixel_width + delta]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ void TextureCache::MakeRangeDynamic(u32 start_address, u32 size)
|
|||
tcend = textures.upper_bound(start_address + size);
|
||||
|
||||
if (iter != textures.begin())
|
||||
iter--;
|
||||
--iter;
|
||||
|
||||
for (; iter != tcend; ++iter)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ static VertexLoaderMap g_VertexLoaderMap;
|
|||
void Init()
|
||||
{
|
||||
MarkAllDirty();
|
||||
for (auto& vertexLoader : g_VertexLoaders)
|
||||
for (VertexLoader*& vertexLoader : g_VertexLoaders)
|
||||
vertexLoader = NULL;
|
||||
RecomputeCachedArraybases();
|
||||
}
|
||||
|
@ -75,19 +75,19 @@ void AppendListToString(std::string *dest)
|
|||
std::vector<entry> entries;
|
||||
|
||||
size_t total_size = 0;
|
||||
for (VertexLoaderMap::const_iterator iter = g_VertexLoaderMap.begin(); iter != g_VertexLoaderMap.end(); ++iter)
|
||||
for (const auto& map_entry : g_VertexLoaderMap)
|
||||
{
|
||||
entry e;
|
||||
iter->second->AppendToString(&e.text);
|
||||
e.num_verts = iter->second->GetNumLoadedVerts();
|
||||
map_entry.second->AppendToString(&e.text);
|
||||
e.num_verts = map_entry.second->GetNumLoadedVerts();
|
||||
entries.push_back(e);
|
||||
total_size += e.text.size() + 1;
|
||||
}
|
||||
sort(entries.begin(), entries.end());
|
||||
dest->reserve(dest->size() + total_size);
|
||||
for (std::vector<entry>::const_iterator iter = entries.begin(); iter != entries.end(); ++iter)
|
||||
for (const entry& entry : entries)
|
||||
{
|
||||
dest->append(iter->text);
|
||||
dest->append(entry.text);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ void VideoBackend::PopulateList()
|
|||
#endif
|
||||
g_available_video_backends.push_back(backends[3] = new SW::VideoSoftware);
|
||||
|
||||
for (auto& backend : backends)
|
||||
for (VideoBackend* backend : backends)
|
||||
{
|
||||
if (backend)
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ void VideoBackend::ActivateBackend(const std::string& name)
|
|||
if (name.length() == 0) // If NULL, set it to the default backend (expected behavior)
|
||||
g_video_backend = s_default_backend;
|
||||
|
||||
for (std::vector<VideoBackend*>::const_iterator it = g_available_video_backends.begin(); it != g_available_video_backends.end(); ++it)
|
||||
if (name == (*it)->GetName())
|
||||
g_video_backend = *it;
|
||||
for (VideoBackend* backend : g_available_video_backends)
|
||||
if (name == backend->GetName())
|
||||
g_video_backend = backend;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue