lint: Clang Format files

This commit is contained in:
Tyler Wilding 2020-11-19 19:07:29 -05:00 committed by refractionpcsx2
parent 5ef141187a
commit 279dfd741a
2 changed files with 79 additions and 72 deletions

View File

@ -61,15 +61,13 @@ static const PatchTextTable dataType[] =
{3, L"word", NULL},
{4, L"double", NULL},
{5, L"extended", NULL},
{ 0, wxEmptyString, NULL }
};
{0, wxEmptyString, NULL}};
static const PatchTextTable cpuCore[] =
{
{1, L"EE", NULL},
{2, L"IOP", NULL},
{ 0, wxEmptyString, NULL }
};
{0, wxEmptyString, NULL}};
// IniFile Functions.
@ -100,7 +98,8 @@ static int PatchTableExecute( const ParsedAssignmentString& set, const PatchText
{
if (!set.lvalue.Cmp(Table[i].text))
{
if (Table[i].func) Table[i].func(set.lvalue, set.rvalue);
if (Table[i].func)
Table[i].func(set.lvalue, set.rvalue);
break;
}
i++;
@ -116,7 +115,8 @@ static void inifile_command(const wxString& cmd)
// Is this really what we want to be doing here? Seems like just leaving it empty/blank
// would make more sense... --air
if (set.rvalue.IsEmpty()) set.rvalue = set.lvalue;
if (set.rvalue.IsEmpty())
set.rvalue = set.lvalue;
/*int code = */ PatchTableExecute(set, commands_patch);
}
@ -143,7 +143,6 @@ int LoadPatchesFromGamesDB(const wxString& crc, const GameDatabaseSchema::GameEn
{
inifile_command(line);
}
}
}
@ -154,7 +153,8 @@ void inifile_processString(const wxString& inStr)
{
wxString str(inStr);
inifile_trim(str);
if (!str.IsEmpty()) inifile_command(str);
if (!str.IsEmpty())
inifile_command(str);
}
// This routine receives a file from inifile_read, trims it,
@ -176,7 +176,8 @@ static int _LoadPatchFiles(const wxDirName& folderName, wxString& fileSpec, cons
{
numberFoundPatchFiles = 0;
if (!folderName.Exists()) {
if (!folderName.Exists())
{
Console.WriteLn(Color_Red, L"The %s folder ('%s') is inaccessible. Skipping...", WX_STR(friendlyName), WX_STR(folderName.ToString()));
return 0;
}
@ -186,8 +187,10 @@ static int _LoadPatchFiles(const wxDirName& folderName, wxString& fileSpec, cons
wxString buffer;
wxTextFile f;
bool found = dir.GetFirst(&buffer, L"*", wxDIR_FILES);
while (found) {
if (buffer.Upper().Matches(fileSpec.Upper())) {
while (found)
{
if (buffer.Upper().Matches(fileSpec.Upper()))
{
PatchesCon->WriteLn(Color_Green, L"Found %s file: '%s'", WX_STR(friendlyName), WX_STR(buffer));
int before = Patch.size();
f.Open(Path::Combine(dir.GetName(), buffer));
@ -208,7 +211,8 @@ static int _LoadPatchFiles(const wxDirName& folderName, wxString& fileSpec, cons
// Returns number of patches loaded
// Note: does not reset previously loaded patches (use ForgetLoadedPatches() for that)
// Note: only load patches from the root folder of the zip
int LoadPatchesFromZip(wxString gameCRC, const wxString& patchesArchiveFilename) {
int LoadPatchesFromZip(wxString gameCRC, const wxString& patchesArchiveFilename)
{
gameCRC.MakeUpper();
int before = Patch.size();
@ -220,11 +224,13 @@ int LoadPatchesFromZip(wxString gameCRC, const wxString& patchesArchiveFilename)
{
wxString name = entry->GetName();
name.MakeUpper();
if (name.Find(gameCRC) == 0 && name.Find(L".PNACH")+6u == name.Length()) {
if (name.Find(gameCRC) == 0 && name.Find(L".PNACH") + 6u == name.Length())
{
PatchesCon->WriteLn(Color_Green, L"Loading patch '%s' from archive '%s'",
WX_STR(entry->GetName()), WX_STR(patchesArchiveFilename));
wxTextInputStream pnach(zip);
while (!zip.Eof()) {
while (!zip.Eof())
{
inifile_processString(pnach.ReadLine());
}
}
@ -247,7 +253,8 @@ int LoadPatchesFromDir(wxString name, const wxDirName& folderName, const wxStrin
// This comment _might_ be buggy. This function (LoadPatchesFromDir) loads from an explicit folder.
// This folder can be cheats or cheats_ws at either the default location or a custom one.
// This check only tests the default cheats folder, so the message it produces is possibly misleading.
if (folderName.ToString().IsSameAs(PathDefs::GetCheats().ToString()) && numberFoundPatchFiles == 0) {
if (folderName.ToString().IsSameAs(PathDefs::GetCheats().ToString()) && numberFoundPatchFiles == 0)
{
wxString pathName = Path::Combine(folderName, name.MakeUpper() + L".pnach");
PatchesCon->WriteLn(Color_Gray, L"Not found %s file: %s", WX_STR(friendlyName), WX_STR(pathName));
}
@ -301,7 +308,8 @@ namespace PatchFunc
const wxString& WriteValue() const { return m_pieces[4]; }
};
void patchHelper(const wxString& cmd, const wxString& param) {
void patchHelper(const wxString& cmd, const wxString& param)
{
// Error Handling Note: I just throw simple wxStrings here, and then catch them below and
// format them into more detailed cmd+data+error printouts. If we want to add user-friendly
// (translated) messages for display in a popup window then we'll have to upgrade the
@ -335,7 +343,6 @@ namespace PatchFunc
iPatch.enabled = 1; // omg success!!
Patch.push_back(iPatch);
}
catch (wxString& exmsg)
{
@ -344,7 +351,7 @@ namespace PatchFunc
}
}
void patch(const wxString& cmd, const wxString& param) { patchHelper(cmd, param); }
}
} // namespace PatchFunc
// This is for applying patches directly to memory
void ApplyLoadedPatches(patch_place_type place)