mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Run code through clang-modernize -loop-convert to create range-based for loops, and manually fix some stuff up.
This commit is contained in:
@@ -144,10 +144,10 @@ ALDeviceList::ALDeviceList()
|
||||
*/
|
||||
ALDeviceList::~ALDeviceList()
|
||||
{
|
||||
for (u32 i = 0; i < vDeviceInfo.size(); i++) {
|
||||
if (vDeviceInfo[i].pvstrExtensions) {
|
||||
vDeviceInfo[i].pvstrExtensions->clear();
|
||||
delete vDeviceInfo[i].pvstrExtensions;
|
||||
for (auto& di : vDeviceInfo) {
|
||||
if (di.pvstrExtensions) {
|
||||
di.pvstrExtensions->clear();
|
||||
delete di.pvstrExtensions;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,8 +206,8 @@ bool ALDeviceList::IsExtensionSupported(s32 index, char *szExtName)
|
||||
bool bReturn = false;
|
||||
|
||||
if (index < GetNumDevices()) {
|
||||
for (u32 i = 0; i < vDeviceInfo[index].pvstrExtensions->size(); i++) {
|
||||
if (!strcasecmp(vDeviceInfo[index].pvstrExtensions->at(i).c_str(), szExtName)) {
|
||||
for (auto& ext : *vDeviceInfo[index].pvstrExtensions) {
|
||||
if (!strcasecmp(ext.c_str(), szExtName)) {
|
||||
bReturn = true;
|
||||
break;
|
||||
}
|
||||
@@ -260,16 +260,16 @@ void ALDeviceList::FilterDevicesExtension(char *szExtName)
|
||||
{
|
||||
bool bFound;
|
||||
|
||||
for (u32 i = 0; i < vDeviceInfo.size(); i++) {
|
||||
for (auto& di : vDeviceInfo) {
|
||||
bFound = false;
|
||||
for (u32 j = 0; j < vDeviceInfo[i].pvstrExtensions->size(); j++) {
|
||||
if (!strcasecmp(vDeviceInfo[i].pvstrExtensions->at(j).c_str(), szExtName)) {
|
||||
for (auto& ext : *di.pvstrExtensions) {
|
||||
if (!strcasecmp(ext.c_str(), szExtName)) {
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bFound)
|
||||
vDeviceInfo[i].bSelected = false;
|
||||
di.bSelected = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,9 +339,9 @@ u32 ALDeviceList::GetMaxNumSources()
|
||||
alDeleteSources(iSourceCount, uiSources);
|
||||
if (alGetError() != AL_NO_ERROR)
|
||||
{
|
||||
for (u32 i = 0; i < 256; i++)
|
||||
for (auto& uiSource : uiSources)
|
||||
{
|
||||
alDeleteSources(1, &uiSources[i]);
|
||||
alDeleteSources(1, &uiSource);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
|
||||
bool BreakPoints::IsAddressBreakPoint(u32 _iAddress)
|
||||
{
|
||||
for (TBreakPoints::iterator i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i)
|
||||
if (i->iAddress == _iAddress)
|
||||
for (auto& bp : m_BreakPoints)
|
||||
if (bp.iAddress == _iAddress)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BreakPoints::IsTempBreakPoint(u32 _iAddress)
|
||||
{
|
||||
for (TBreakPoints::iterator i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i)
|
||||
if (i->iAddress == _iAddress && i->bTemporary)
|
||||
for (auto& bp : m_BreakPoints)
|
||||
if (bp.iAddress == _iAddress && bp.bTemporary)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -29,29 +29,28 @@ bool BreakPoints::IsTempBreakPoint(u32 _iAddress)
|
||||
BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const
|
||||
{
|
||||
TBreakPointsStr bps;
|
||||
for (TBreakPoints::const_iterator i = m_BreakPoints.begin();
|
||||
i != m_BreakPoints.end(); ++i)
|
||||
for (const auto& bp : m_BreakPoints)
|
||||
{
|
||||
if (!i->bTemporary)
|
||||
if (!bp.bTemporary)
|
||||
{
|
||||
std::stringstream bp;
|
||||
bp << std::hex << i->iAddress << " " << (i->bOn ? "n" : "");
|
||||
bps.push_back(bp.str());
|
||||
std::stringstream ss;
|
||||
ss << std::hex << bp.iAddress << " " << (bp.bOn ? "n" : "");
|
||||
bps.push_back(ss.str());
|
||||
}
|
||||
}
|
||||
|
||||
return bps;
|
||||
}
|
||||
|
||||
void BreakPoints::AddFromStrings(const TBreakPointsStr& bps)
|
||||
void BreakPoints::AddFromStrings(const TBreakPointsStr& bpstrs)
|
||||
{
|
||||
for (TBreakPointsStr::const_iterator i = bps.begin(); i != bps.end(); ++i)
|
||||
for (const auto& bpstr : bpstrs)
|
||||
{
|
||||
TBreakPoint bp;
|
||||
std::stringstream bpstr;
|
||||
bpstr << std::hex << *i;
|
||||
bpstr >> bp.iAddress;
|
||||
bp.bOn = i->find("n") != i->npos;
|
||||
std::stringstream ss;
|
||||
ss << std::hex << bpstr;
|
||||
ss >> bp.iAddress;
|
||||
bp.bOn = bpstr.find("n") != bpstr.npos;
|
||||
bp.bTemporary = false;
|
||||
Add(bp);
|
||||
}
|
||||
@@ -115,35 +114,34 @@ void BreakPoints::Clear()
|
||||
MemChecks::TMemChecksStr MemChecks::GetStrings() const
|
||||
{
|
||||
TMemChecksStr mcs;
|
||||
for (TMemChecks::const_iterator i = m_MemChecks.begin();
|
||||
i != m_MemChecks.end(); ++i)
|
||||
for (const auto& bp : m_MemChecks)
|
||||
{
|
||||
std::stringstream mc;
|
||||
mc << std::hex << i->StartAddress;
|
||||
mc << " " << (i->bRange ? i->EndAddress : i->StartAddress) << " " <<
|
||||
(i->bRange ? "n" : "") << (i->OnRead ? "r" : "") <<
|
||||
(i->OnWrite ? "w" : "") << (i->Log ? "l" : "") << (i->Break ? "p" : "");
|
||||
mc << std::hex << bp.StartAddress;
|
||||
mc << " " << (bp.bRange ? bp.EndAddress : bp.StartAddress) << " " <<
|
||||
(bp.bRange ? "n" : "") << (bp.OnRead ? "r" : "") <<
|
||||
(bp.OnWrite ? "w" : "") << (bp.Log ? "l" : "") << (bp.Break ? "p" : "");
|
||||
mcs.push_back(mc.str());
|
||||
}
|
||||
|
||||
return mcs;
|
||||
}
|
||||
|
||||
void MemChecks::AddFromStrings(const TMemChecksStr& mcs)
|
||||
void MemChecks::AddFromStrings(const TMemChecksStr& mcstrs)
|
||||
{
|
||||
for (TMemChecksStr::const_iterator i = mcs.begin(); i != mcs.end(); ++i)
|
||||
for (const auto& mcstr : mcstrs)
|
||||
{
|
||||
TMemCheck mc;
|
||||
std::stringstream mcstr;
|
||||
mcstr << std::hex << *i;
|
||||
mcstr >> mc.StartAddress;
|
||||
mc.bRange = i->find("n") != i->npos;
|
||||
mc.OnRead = i->find("r") != i->npos;
|
||||
mc.OnWrite = i->find("w") != i->npos;
|
||||
mc.Log = i->find("l") != i->npos;
|
||||
mc.Break = i->find("p") != i->npos;
|
||||
std::stringstream ss;
|
||||
ss << std::hex << mcstr;
|
||||
ss >> mc.StartAddress;
|
||||
mc.bRange = mcstr.find("n") != mcstr.npos;
|
||||
mc.OnRead = mcstr.find("r") != mcstr.npos;
|
||||
mc.OnWrite = mcstr.find("w") != mcstr.npos;
|
||||
mc.Log = mcstr.find("l") != mcstr.npos;
|
||||
mc.Break = mcstr.find("p") != mcstr.npos;
|
||||
if (mc.bRange)
|
||||
mcstr >> mc.EndAddress;
|
||||
ss >> mc.EndAddress;
|
||||
else
|
||||
mc.EndAddress = mc.StartAddress;
|
||||
Add(mc);
|
||||
@@ -170,15 +168,15 @@ void MemChecks::Remove(u32 _Address)
|
||||
|
||||
TMemCheck *MemChecks::GetMemCheck(u32 address)
|
||||
{
|
||||
for (TMemChecks::iterator i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i)
|
||||
for (auto& bp : m_MemChecks)
|
||||
{
|
||||
if (i->bRange)
|
||||
if (bp.bRange)
|
||||
{
|
||||
if (address >= i->StartAddress && address <= i->EndAddress)
|
||||
return &(*i);
|
||||
if (address >= bp.StartAddress && address <= bp.EndAddress)
|
||||
return &(bp);
|
||||
}
|
||||
else if (i->StartAddress == address)
|
||||
return &(*i);
|
||||
else if (bp.StartAddress == address)
|
||||
return &(bp);
|
||||
}
|
||||
|
||||
// none found
|
||||
|
||||
@@ -211,24 +211,21 @@ std::vector<std::string> cdio_get_devices ()
|
||||
// Returns true if device is a cdrom/dvd drive
|
||||
bool cdio_is_cdrom(std::string device)
|
||||
{
|
||||
#ifdef __linux__
|
||||
#ifndef _WIN32
|
||||
// Resolve symbolic links. This allows symbolic links to valid
|
||||
// drives to be passed from the command line with the -e flag.
|
||||
char resolved_path[MAX_PATH];
|
||||
char *devname = realpath(device.c_str(), resolved_path);
|
||||
if (!devname)
|
||||
return false;
|
||||
device = devname;
|
||||
#endif
|
||||
|
||||
std::vector<std::string> devices = cdio_get_devices();
|
||||
bool res = false;
|
||||
for (unsigned int i = 0; i < devices.size(); i++)
|
||||
for (auto& odevice : devices)
|
||||
{
|
||||
#ifdef __linux__
|
||||
if (strncmp(devices[i].c_str(), devname, MAX_PATH) == 0)
|
||||
#else
|
||||
if (strncmp(devices[i].c_str(), device.c_str(), MAX_PATH) == 0)
|
||||
#endif
|
||||
if (strncmp(odevice.c_str(), device.c_str(), MAX_PATH) == 0)
|
||||
{
|
||||
res = true;
|
||||
break;
|
||||
|
||||
@@ -90,10 +90,10 @@ public:
|
||||
case MODE_WRITE:
|
||||
case MODE_MEASURE:
|
||||
case MODE_VERIFY:
|
||||
for (auto itr = x.begin(); itr != x.end(); ++itr)
|
||||
for (auto& elem : x)
|
||||
{
|
||||
Do(itr->first);
|
||||
Do(itr->second);
|
||||
Do(elem.first);
|
||||
Do(elem.second);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -134,8 +134,8 @@ public:
|
||||
Do(size);
|
||||
x.resize(size);
|
||||
|
||||
for (auto itr = x.begin(); itr != x.end(); ++itr)
|
||||
Do(*itr);
|
||||
for (auto& elem : x)
|
||||
Do(elem);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
CFileSearch::CFileSearch(const CFileSearch::XStringVector& _rSearchStrings, const CFileSearch::XStringVector& _rDirectories)
|
||||
{
|
||||
// Reverse the loop order for speed?
|
||||
for (size_t j = 0; j < _rSearchStrings.size(); j++)
|
||||
for (auto& _rSearchString : _rSearchStrings)
|
||||
{
|
||||
for (size_t i = 0; i < _rDirectories.size(); i++)
|
||||
for (auto& _rDirectory : _rDirectories)
|
||||
{
|
||||
FindFiles(_rSearchStrings[j], _rDirectories[i]);
|
||||
FindFiles(_rSearchString, _rDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,18 +125,16 @@ bool IniFile::Section::Get(const char* key, std::vector<std::string>& out)
|
||||
size_t subEnd;
|
||||
|
||||
// split by ,
|
||||
while (subStart != std::string::npos) {
|
||||
|
||||
while (subStart != std::string::npos)
|
||||
{
|
||||
// Find next ,
|
||||
subEnd = temp.find_first_of(",", subStart);
|
||||
if (subStart != subEnd)
|
||||
// take from first char until next ,
|
||||
out.push_back(StripSpaces(temp.substr(subStart, subEnd - subStart)));
|
||||
|
||||
// Find the next non , char
|
||||
subStart = temp.find_first_not_of(",", subEnd);
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -210,17 +208,17 @@ bool IniFile::Section::Delete(const char *key)
|
||||
|
||||
const IniFile::Section* IniFile::GetSection(const char* sectionName) const
|
||||
{
|
||||
for (std::vector<Section>::const_iterator iter = sections.begin(); iter != sections.end(); ++iter)
|
||||
if (!strcasecmp(iter->name.c_str(), sectionName))
|
||||
return (&(*iter));
|
||||
for (const auto& sect : sections)
|
||||
if (!strcasecmp(sect.name.c_str(), sectionName))
|
||||
return (&(sect));
|
||||
return 0;
|
||||
}
|
||||
|
||||
IniFile::Section* IniFile::GetSection(const char* sectionName)
|
||||
{
|
||||
for (std::vector<Section>::iterator iter = sections.begin(); iter != sections.end(); ++iter)
|
||||
if (!strcasecmp(iter->name.c_str(), sectionName))
|
||||
return (&(*iter));
|
||||
for (auto& sect : sections)
|
||||
if (!strcasecmp(sect.name.c_str(), sectionName))
|
||||
return (&(sect));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -291,9 +289,9 @@ bool IniFile::GetLines(const char* sectionName, std::vector<std::string>& lines,
|
||||
return false;
|
||||
|
||||
lines.clear();
|
||||
for (std::vector<std::string>::const_iterator iter = section->lines.begin(); iter != section->lines.end(); ++iter)
|
||||
for (std::string line : section->lines)
|
||||
{
|
||||
std::string line = StripSpaces(*iter);
|
||||
line = StripSpaces(line);
|
||||
|
||||
if (remove_comments)
|
||||
{
|
||||
@@ -399,20 +397,15 @@ bool IniFile::Save(const char* filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto iter = sections.begin(); iter != sections.end(); ++iter)
|
||||
for (auto& section : sections)
|
||||
{
|
||||
const Section& section = *iter;
|
||||
|
||||
if (section.keys_order.size() != 0 || section.lines.size() != 0)
|
||||
out << "[" << section.name << "]" << std::endl;
|
||||
|
||||
if (section.keys_order.size() == 0)
|
||||
{
|
||||
for (auto liter = section.lines.begin(); liter != section.lines.end(); ++liter)
|
||||
{
|
||||
std::string s = *liter;
|
||||
for (auto s : section.lines)
|
||||
out << s << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -81,14 +81,14 @@ LogManager::LogManager()
|
||||
m_consoleLog = new ConsoleListener();
|
||||
m_debuggerLog = new DebuggerLogListener();
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
for (auto& container : m_Log)
|
||||
{
|
||||
m_Log[i]->SetEnable(true);
|
||||
m_Log[i]->AddListener(m_fileLog);
|
||||
m_Log[i]->AddListener(m_consoleLog);
|
||||
container->SetEnable(true);
|
||||
container->AddListener(m_fileLog);
|
||||
container->AddListener(m_consoleLog);
|
||||
#ifdef _MSC_VER
|
||||
if (IsDebuggerPresent())
|
||||
m_Log[i]->AddListener(m_debuggerLog);
|
||||
container->AddListener(m_debuggerLog);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -102,8 +102,8 @@ LogManager::~LogManager()
|
||||
m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_debuggerLog);
|
||||
}
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
delete m_Log[i];
|
||||
for (auto& container : m_Log)
|
||||
delete container;
|
||||
|
||||
delete m_fileLog;
|
||||
delete m_consoleLog;
|
||||
|
||||
@@ -36,7 +36,7 @@ int AshmemCreateFileMapping(const char *name, size_t size)
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
// We don't really care if we can't set the name, it is optional
|
||||
// We don't really care if we can't set the name, it is optional
|
||||
ret = ioctl(fd, ASHMEM_SET_NAME, name);
|
||||
|
||||
ret = ioctl(fd, ASHMEM_SET_SIZE, size);
|
||||
@@ -263,7 +263,6 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
|
||||
base_attempts = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
#else
|
||||
// Linux32 is fine with the x64 method, although limited to 32-bit with no automirrors.
|
||||
@@ -289,9 +288,8 @@ void MemoryMap_Shutdown(const MemoryView *views, int num_views, u32 flags, MemAr
|
||||
{
|
||||
const MemoryView* view = &views[i];
|
||||
u8** outptrs[2] = {view->out_ptr_low, view->out_ptr};
|
||||
for (int j = 0; j < 2; j++)
|
||||
for (auto outptr : outptrs)
|
||||
{
|
||||
u8** outptr = outptrs[j];
|
||||
if (outptr && *outptr && !freeset.count(*outptr))
|
||||
{
|
||||
arena->ReleaseView(*outptr, view->size);
|
||||
|
||||
@@ -28,18 +28,18 @@ void SymbolDB::Clear(const char *prefix)
|
||||
void SymbolDB::Index()
|
||||
{
|
||||
int i = 0;
|
||||
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); ++iter)
|
||||
for (auto& func : functions)
|
||||
{
|
||||
iter->second.index = i++;
|
||||
func.second.index = i++;
|
||||
}
|
||||
}
|
||||
|
||||
Symbol *SymbolDB::GetSymbolFromName(const char *name)
|
||||
{
|
||||
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); ++iter)
|
||||
for (auto& func : functions)
|
||||
{
|
||||
if (!strcmp(iter->second.name.c_str(), name))
|
||||
return &iter->second;
|
||||
if (!strcmp(func.second.name.c_str(), name))
|
||||
return &func.second;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -298,8 +298,8 @@ void SysConf::GenerateSysConf()
|
||||
items[26].data[0] = 0x01;
|
||||
|
||||
|
||||
for (int i = 0; i < 27; i++)
|
||||
m_Entries.push_back(items[i]);
|
||||
for (auto& item : items)
|
||||
m_Entries.push_back(item);
|
||||
|
||||
File::CreateFullPath(m_FilenameDefault);
|
||||
File::IOFile g(m_FilenameDefault, "wb");
|
||||
|
||||
@@ -123,9 +123,8 @@ void LoadCodes(IniFile &globalIni, IniFile &localIni, bool forceLoad)
|
||||
std::vector<std::string> enabledLines;
|
||||
std::set<std::string> enabledNames;
|
||||
localIni.GetLines("ActionReplay_Enabled", enabledLines);
|
||||
for (auto iter = enabledLines.begin(); iter != enabledLines.end(); ++iter)
|
||||
for (auto& line : enabledLines)
|
||||
{
|
||||
const std::string& line = *iter;
|
||||
if (line.size() != 0 && line[0] == '$')
|
||||
{
|
||||
std::string name = line.substr(1, line.size() - 1);
|
||||
@@ -139,7 +138,7 @@ void LoadCodes(IniFile &globalIni, IniFile &localIni, bool forceLoad)
|
||||
std::vector<std::string> lines;
|
||||
std::vector<std::string> encryptedLines;
|
||||
ARCode currentCode;
|
||||
|
||||
|
||||
inis[i]->GetLines("ActionReplay", lines);
|
||||
|
||||
std::vector<std::string>::const_iterator
|
||||
@@ -148,7 +147,7 @@ void LoadCodes(IniFile &globalIni, IniFile &localIni, bool forceLoad)
|
||||
for (; it != lines_end; ++it)
|
||||
{
|
||||
const std::string line = *it;
|
||||
|
||||
|
||||
if (line.empty())
|
||||
continue;
|
||||
|
||||
@@ -258,11 +257,11 @@ void RunAllActive()
|
||||
{
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats)
|
||||
{
|
||||
for (std::vector<ARCode>::iterator i = activeCodes.begin(); i != activeCodes.end(); ++i)
|
||||
for (auto& activeCode : activeCodes)
|
||||
{
|
||||
if (i->active)
|
||||
if (activeCode.active)
|
||||
{
|
||||
i->active = RunCode(*i);
|
||||
activeCode.active = RunCode(activeCode);
|
||||
LogInfo("\n");
|
||||
}
|
||||
}
|
||||
@@ -320,7 +319,7 @@ bool RunCode(const ARCode &arcode)
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
LogInfo("--- Running Code: %08x %08x ---", addr.address, data);
|
||||
//LogInfo("Command: %08x", cmd);
|
||||
|
||||
@@ -420,7 +419,7 @@ bool RunCode(const ARCode &arcode)
|
||||
if (false == NormalCode(addr, data))
|
||||
return false;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
LogInfo("This Normal Code is a Conditional Code");
|
||||
if (false == ConditionalCode(addr, data, &skip_count))
|
||||
@@ -467,10 +466,10 @@ void UpdateActiveList()
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats = false;
|
||||
b_RanOnce = false;
|
||||
activeCodes.clear();
|
||||
for (size_t i = 0; i < arCodes.size(); i++)
|
||||
for (auto& arCode : arCodes)
|
||||
{
|
||||
if (arCodes[i].active)
|
||||
activeCodes.push_back(arCodes[i]);
|
||||
if (arCode.active)
|
||||
activeCodes.push_back(arCode);
|
||||
}
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats = old_value;
|
||||
}
|
||||
@@ -688,7 +687,7 @@ bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr addr, const u32 data
|
||||
const s16 addr_incr = (s16)(data & 0xFFFF);
|
||||
const s8 val_incr = (s8)(data >> 24);
|
||||
const u8 write_num = (data & 0xFF0000) >> 16;
|
||||
|
||||
|
||||
u32 val = addr;
|
||||
u32 curr_addr = new_addr;
|
||||
|
||||
|
||||
@@ -30,16 +30,16 @@ CDolLoader::CDolLoader(const char* _szFilename)
|
||||
|
||||
CDolLoader::~CDolLoader()
|
||||
{
|
||||
for (int i = 0; i < DOL_NUM_TEXT; i++)
|
||||
for (auto& sect : text_section)
|
||||
{
|
||||
delete [] text_section[i];
|
||||
text_section[i] = NULL;
|
||||
delete [] sect;
|
||||
sect = NULL;
|
||||
}
|
||||
|
||||
for (int i = 0; i < DOL_NUM_DATA; i++)
|
||||
for (auto& sect : data_section)
|
||||
{
|
||||
delete [] data_section[i];
|
||||
data_section[i] = NULL;
|
||||
delete [] sect;
|
||||
sect = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ void CDolLoader::Initialize(u8* _pBuffer, u32 _Size)
|
||||
for (size_t i = 0; i < (sizeof(SDolHeader)/sizeof(u32)); i++)
|
||||
p[i] = Common::swap32(p[i]);
|
||||
|
||||
for (int i = 0; i < DOL_NUM_TEXT; i++)
|
||||
text_section[i] = NULL;
|
||||
for (int i = 0; i < DOL_NUM_DATA; i++)
|
||||
data_section[i] = NULL;
|
||||
for (auto& sect : text_section)
|
||||
sect = NULL;
|
||||
for (auto& sect : data_section)
|
||||
sect = NULL;
|
||||
|
||||
u32 HID4_pattern = 0x7c13fba6;
|
||||
u32 HID4_mask = 0xfc1fffff;
|
||||
|
||||
@@ -84,15 +84,15 @@ int RegisterEvent(const char *name, TimedCallback callback)
|
||||
|
||||
// check for existing type with same name.
|
||||
// we want event type names to remain unique so that we can use them for serialization.
|
||||
for (unsigned int i = 0; i < event_types.size(); ++i)
|
||||
for (auto& event_type : event_types)
|
||||
{
|
||||
if (!strcmp(name, event_types[i].name))
|
||||
if (!strcmp(name, event_type.name))
|
||||
{
|
||||
WARN_LOG(POWERPC, "Discarded old event type \"%s\" because a new type with the same name was registered.", name);
|
||||
// we don't know if someone might be holding on to the type index,
|
||||
// so we gut the old event type instead of actually removing it.
|
||||
event_types[i].name = "_discarded_event";
|
||||
event_types[i].callback = &EmptyTimedCallback;
|
||||
event_type.name = "_discarded_event";
|
||||
event_type.callback = &EmptyTimedCallback;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,7 @@ public:
|
||||
|
||||
void Clear()
|
||||
{
|
||||
for (int i = 0; i < 65536; i++)
|
||||
b[i] = 0;
|
||||
memset(b, 0, sizeof(b));
|
||||
}
|
||||
|
||||
void DeleteByAddress(u32 addr)
|
||||
|
||||
@@ -489,10 +489,10 @@ const char* pdname(u16 val)
|
||||
{
|
||||
static char tmpstr[12]; // nasty
|
||||
|
||||
for (int i = 0; i < (int)(sizeof(pdlabels) / sizeof(pdlabel_t)); i++)
|
||||
for (auto& pdlabel : pdlabels)
|
||||
{
|
||||
if (pdlabels[i].addr == val)
|
||||
return pdlabels[i].name;
|
||||
if (pdlabel.addr == val)
|
||||
return pdlabel.name;
|
||||
}
|
||||
|
||||
sprintf(tmpstr, "0x%04x", val);
|
||||
@@ -521,23 +521,22 @@ void InitInstructionTable()
|
||||
{
|
||||
// ext op table
|
||||
for (int i = 0; i < EXT_OPTABLE_SIZE; i++)
|
||||
{
|
||||
extOpTable[i] = &cw;
|
||||
|
||||
for (int i = 0; i < EXT_OPTABLE_SIZE; i++)
|
||||
{
|
||||
for (int j = 0; j < opcodes_ext_size; j++)
|
||||
for (auto& ext : opcodes_ext)
|
||||
{
|
||||
u16 mask = opcodes_ext[j].opcode_mask;
|
||||
if ((mask & i) == opcodes_ext[j].opcode)
|
||||
u16 mask = ext.opcode_mask;
|
||||
if ((mask & i) == ext.opcode)
|
||||
{
|
||||
if (extOpTable[i] == &cw)
|
||||
extOpTable[i] = &opcodes_ext[j];
|
||||
extOpTable[i] = &ext;
|
||||
else
|
||||
{
|
||||
//if the entry already in the table
|
||||
//is a strict subset, allow it
|
||||
if ((extOpTable[i]->opcode_mask | opcodes_ext[j].opcode_mask) != extOpTable[i]->opcode_mask)
|
||||
ERROR_LOG(DSPLLE, "opcode ext table place %d already in use by %s when inserting %s", i, extOpTable[i]->name, opcodes_ext[j].name);
|
||||
if ((extOpTable[i]->opcode_mask | ext.opcode_mask) != extOpTable[i]->opcode_mask)
|
||||
ERROR_LOG(DSPLLE, "opcode ext table place %d already in use by %s when inserting %s", i, extOpTable[i]->name, ext.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -546,18 +545,18 @@ void InitInstructionTable()
|
||||
// op table
|
||||
for (int i = 0; i < OPTABLE_SIZE; i++)
|
||||
opTable[i] = &cw;
|
||||
|
||||
|
||||
for (int i = 0; i < OPTABLE_SIZE; i++)
|
||||
{
|
||||
for (int j = 0; j < opcodes_size; j++)
|
||||
for (auto& opcode : opcodes)
|
||||
{
|
||||
u16 mask = opcodes[j].opcode_mask;
|
||||
if ((mask & i) == opcodes[j].opcode)
|
||||
u16 mask = opcode.opcode_mask;
|
||||
if ((mask & i) == opcode.opcode)
|
||||
{
|
||||
if (opTable[i] == &cw)
|
||||
opTable[i] = &opcodes[j];
|
||||
opTable[i] = &opcode;
|
||||
else
|
||||
ERROR_LOG(DSPLLE, "opcode table place %d already in use for %s", i, opcodes[j].name);
|
||||
ERROR_LOG(DSPLLE, "opcode table place %d already in use for %s", i, opcode.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,10 +75,10 @@ static void *reg_ptr(int reg)
|
||||
DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
|
||||
: emitter(_emitter), temporary(false), merged(false)
|
||||
{
|
||||
for(unsigned int i = 0; i < NUMXREGS; i++)
|
||||
for(auto& xreg : xregs)
|
||||
{
|
||||
xregs[i].guest_reg = DSP_REG_STATIC;
|
||||
xregs[i].pushed = false;
|
||||
xreg.guest_reg = DSP_REG_STATIC;
|
||||
xreg.pushed = false;
|
||||
}
|
||||
|
||||
xregs[RAX].guest_reg = DSP_REG_STATIC;// reserved for MUL/DIV
|
||||
@@ -449,9 +449,9 @@ void DSPJitRegCache::pushRegs()
|
||||
}
|
||||
|
||||
int push_count = 0;
|
||||
for(unsigned int i = 0; i < NUMXREGS; i++)
|
||||
for(auto& xreg : xregs)
|
||||
{
|
||||
if (xregs[i].guest_reg == DSP_REG_USED)
|
||||
if (xreg.guest_reg == DSP_REG_USED)
|
||||
push_count++;
|
||||
}
|
||||
|
||||
@@ -503,9 +503,9 @@ void DSPJitRegCache::popRegs() {
|
||||
emitter.MOV(32, M(&ebp_store), R(EBP));
|
||||
#endif
|
||||
int push_count = 0;
|
||||
for(unsigned int i = 0; i < NUMXREGS; i++)
|
||||
for(auto& xreg : xregs)
|
||||
{
|
||||
if (xregs[i].pushed)
|
||||
if (xreg.pushed)
|
||||
push_count++;
|
||||
}
|
||||
|
||||
@@ -1037,11 +1037,11 @@ void DSPJitRegCache::spillXReg(X64Reg reg)
|
||||
|
||||
X64Reg DSPJitRegCache::findFreeXReg()
|
||||
{
|
||||
for(unsigned int i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
|
||||
for(auto& x : alloc_order)
|
||||
{
|
||||
if (xregs[alloc_order[i]].guest_reg == DSP_REG_NONE)
|
||||
if (xregs[x].guest_reg == DSP_REG_NONE)
|
||||
{
|
||||
return alloc_order[i];
|
||||
return x;
|
||||
}
|
||||
}
|
||||
return INVALID_REG;
|
||||
|
||||
@@ -49,20 +49,20 @@ void LabelMap::DeleteLabel(const std::string &label)
|
||||
}
|
||||
}
|
||||
|
||||
bool LabelMap::GetLabelValue(const std::string &label, u16 *value, LabelType type) const
|
||||
bool LabelMap::GetLabelValue(const std::string &name, u16 *value, LabelType type) const
|
||||
{
|
||||
for (u32 i = 0; i < labels.size(); i++)
|
||||
for (auto& label : labels)
|
||||
{
|
||||
if (!label.compare(labels[i].name))
|
||||
if (!name.compare(label.name))
|
||||
{
|
||||
if (type & labels[i].type)
|
||||
if (type & label.type)
|
||||
{
|
||||
*value = labels[i].addr;
|
||||
*value = label.addr;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("WARNING: Wrong label type requested. %s\n", label.c_str());
|
||||
printf("WARNING: Wrong label type requested. %s\n", name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,8 +128,8 @@ u32 CalculateVertexSize(int vatIndex, const CPMemory &cpMem)
|
||||
int sizes[21];
|
||||
CalculateVertexElementSizes(sizes, vatIndex, cpMem);
|
||||
|
||||
for (int i = 0; i < 21; ++i)
|
||||
vertexSize += sizes[i];
|
||||
for (auto& size : sizes)
|
||||
vertexSize += size;
|
||||
|
||||
return vertexSize;
|
||||
}
|
||||
|
||||
@@ -17,12 +17,10 @@ FifoDataFile::FifoDataFile() :
|
||||
|
||||
FifoDataFile::~FifoDataFile()
|
||||
{
|
||||
for (unsigned int frameIdx = 0; frameIdx < m_Frames.size(); ++frameIdx)
|
||||
for (auto& frame : m_Frames)
|
||||
{
|
||||
FifoFrameInfo &frame = m_Frames[frameIdx];
|
||||
|
||||
for (unsigned int i = 0; i < frame.memoryUpdates.size(); ++i)
|
||||
delete []frame.memoryUpdates[i].data;
|
||||
for (auto& update : frame.memoryUpdates)
|
||||
delete []update.data;
|
||||
|
||||
delete []frame.fifoData;
|
||||
}
|
||||
@@ -54,7 +52,7 @@ bool FifoDataFile::Save(const char *filename)
|
||||
|
||||
// Add space for frame list
|
||||
u64 frameListOffset = file.Tell();
|
||||
for (unsigned int i = 0; i < m_Frames.size(); ++i)
|
||||
for (size_t i = 0; i < m_Frames.size(); i++)
|
||||
PadFile(sizeof(FileFrameInfo), file);
|
||||
|
||||
u64 bpMemOffset = file.Tell();
|
||||
@@ -221,7 +219,7 @@ u64 FifoDataFile::WriteMemoryUpdates(const std::vector<MemoryUpdate> &memUpdates
|
||||
{
|
||||
// Add space for memory update list
|
||||
u64 updateListOffset = file.Tell();
|
||||
for (unsigned int i = 0; i < memUpdates.size(); ++i)
|
||||
for (size_t i = 0; i < memUpdates.size(); i++)
|
||||
PadFile(sizeof(FileMemoryUpdate), file);
|
||||
|
||||
for (unsigned int i = 0; i < memUpdates.size(); ++i)
|
||||
|
||||
@@ -115,10 +115,8 @@ void FifoPlaybackAnalyzer::AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrame
|
||||
u32 end = memUpdate.address + memUpdate.size;
|
||||
|
||||
// Remove portions of memUpdate that overlap with memory ranges that have been written by the GP
|
||||
for (unsigned int i = 0; i < m_WrittenMemory.size(); ++i)
|
||||
for (const auto& range : m_WrittenMemory)
|
||||
{
|
||||
const MemoryRange &range = m_WrittenMemory[i];
|
||||
|
||||
if (range.begin < end &&
|
||||
range.end > begin)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user