pcsx2-gui: Clang format

- pcsx2/SourceLog.cpp
- pcsx2/gui/AppInit.cpp
- pcsx2/gui/ConsoleLogger.cpp
- pcsx2/gui/MainFrame.cpp
This commit is contained in:
RedDevilus 2020-10-26 20:41:53 +01:00 committed by lightningterror
parent 9a50e7ea99
commit 6366284385
3 changed files with 335 additions and 460 deletions

View File

@ -63,7 +63,8 @@ void __Log( const char* fmt, ... )
void SysTraceLog::DoWrite(const char* msg) const
{
if( emuLog == NULL ) return;
if (emuLog == NULL)
return;
fputs(msg, emuLog);
fputs("\n", emuLog);
@ -93,44 +94,23 @@ static const TraceLogDescriptor
TLD_ELF = {
L"ELF", L"E&LF",
pxDt("Dumps detailed information for PS2 executables (ELFs).")
},
pxDt("Dumps detailed information for PS2 executables (ELFs).")},
TLD_eeRecPerf = {
L"EErecPerf", L"EErec &Performance",
pxDt("Logs manual protection, split blocks, and other things that might impact performance.")
},
TLD_eeRecPerf = {L"EErecPerf", L"EErec &Performance", pxDt("Logs manual protection, split blocks, and other things that might impact performance.")},
TLD_eeConsole = {
L"EEout", L"EE C&onsole",
pxDt("Shows the game developer's logging text (EE processor).")
},
TLD_eeConsole = {L"EEout", L"EE C&onsole", pxDt("Shows the game developer's logging text (EE processor).")},
TLD_iopConsole = {
L"IOPout", L"&IOP Console",
pxDt("Shows the game developer's logging text (IOP processor).")
},
TLD_iopConsole = {L"IOPout", L"&IOP Console", pxDt("Shows the game developer's logging text (IOP processor).")},
TLD_deci2 = {
L"DECI2", L"DECI&2 Console",
pxDt("Shows DECI2 debugging logs (EE processor).")
},
TLD_deci2 = {L"DECI2", L"DECI&2 Console", pxDt("Shows DECI2 debugging logs (EE processor).")},
TLD_sysoutConsole = {
L"SYSout", L"System Out",
pxDt("Shows strings printed to the system output stream.")
}
TLD_sysoutConsole = {L"SYSout", L"System Out", pxDt("Shows strings printed to the system output stream.")}
#ifndef DISABLE_RECORDING
,TLD_recordingConsole = {
L"Input Recording", L"Input Recording Console",
pxDt("Shows recording related logs and information.")
},
,
TLD_recordingConsole = {L"Input Recording", L"Input Recording Console", pxDt("Shows recording related logs and information.")},
TLD_controlInfo = {
L"Controller Info", L"Controller Info",
pxDt("Shows detailed controller input values for port 1, every frame.")
}
TLD_controlInfo = {L"Controller Info", L"Controller Info", pxDt("Shows detailed controller input values for port 1, every frame.")}
#endif
; // End init of TraceLogDescriptors
@ -155,8 +135,7 @@ static const SysTraceLogDescriptor
TLD_SIF = {
L"SIF", L"SIF (EE <-> IOP)",
L"",
"SIF"
};
"SIF"};
// ----------------------------
// EmotionEngine (EE/R5900)
@ -166,116 +145,43 @@ static const SysTraceLogDescriptor
TLD_EE_Bios = {
L"Bios", L"Bios",
pxDt("SYSCALL and DECI2 activity."),
"EE"
},
"EE"},
TLD_EE_Memory = {
L"Memory", L"Memory",
pxDt("Direct memory accesses to unknown or unmapped EE memory space."),
"eMem"
},
TLD_EE_Memory = {L"Memory", L"Memory", pxDt("Direct memory accesses to unknown or unmapped EE memory space."), "eMem"},
TLD_EE_R5900 = {
L"R5900", L"R5900 Core",
pxDt("Disasm of executing core instructions (excluding COPs and CACHE)."),
"eDis"
},
TLD_EE_R5900 = {L"R5900", L"R5900 Core", pxDt("Disasm of executing core instructions (excluding COPs and CACHE)."), "eDis"},
TLD_EE_COP0 = {
L"COP0", L"COP0",
pxDt("Disasm of COP0 instructions (MMU, cpu and dma status, etc)."),
"eDis"
},
TLD_EE_COP0 = {L"COP0", L"COP0", pxDt("Disasm of COP0 instructions (MMU, cpu and dma status, etc)."), "eDis"},
TLD_EE_COP1 = {
L"FPU", L"COP1/FPU",
pxDt("Disasm of the EE's floating point unit (FPU) only."),
"eDis"
},
TLD_EE_COP1 = {L"FPU", L"COP1/FPU", pxDt("Disasm of the EE's floating point unit (FPU) only."), "eDis"},
TLD_EE_COP2 = {
L"VUmacro", L"COP2/VUmacro",
pxDt("Disasm of the EE's VU0macro co-processor instructions."),
"eDis"
},
TLD_EE_COP2 = {L"VUmacro", L"COP2/VUmacro", pxDt("Disasm of the EE's VU0macro co-processor instructions."), "eDis"},
TLD_EE_Cache = {
L"Cache", L"Cache",
pxDt("Execution of EE cache instructions."),
"eDis"
},
TLD_EE_Cache = {L"Cache", L"Cache", pxDt("Execution of EE cache instructions."), "eDis"},
TLD_EE_KnownHw = {
L"HwRegs", L"Hardware Regs",
pxDt("All known hardware register accesses (very slow!); not including sub filter options below."),
"eReg"
},
TLD_EE_KnownHw = {L"HwRegs", L"Hardware Regs", pxDt("All known hardware register accesses (very slow!); not including sub filter options below."), "eReg"},
TLD_EE_UnknownHw = {
L"UnknownRegs", L"Unknown Regs",
pxDt("Logs only unknown, unmapped, or unimplemented register accesses."),
"eReg"
},
TLD_EE_UnknownHw = {L"UnknownRegs", L"Unknown Regs", pxDt("Logs only unknown, unmapped, or unimplemented register accesses."), "eReg"},
TLD_EE_DMAhw = {
L"DmaRegs", L"DMA Regs",
pxDt("Logs only DMA-related registers."),
"eReg"
},
TLD_EE_DMAhw = {L"DmaRegs", L"DMA Regs", pxDt("Logs only DMA-related registers."), "eReg"},
TLD_EE_IPU = {
L"IPU", L"IPU",
pxDt("IPU activity: hardware registers, decoding operations, DMA status, etc."),
"IPU"
},
TLD_EE_IPU = {L"IPU", L"IPU", pxDt("IPU activity: hardware registers, decoding operations, DMA status, etc."), "IPU"},
TLD_EE_GIFtag = {
L"GIFtags", L"GIFtags",
pxDt("All GIFtag parse activity; path index, tag type, etc."),
"GIF"
},
TLD_EE_GIFtag = {L"GIFtags", L"GIFtags", pxDt("All GIFtag parse activity; path index, tag type, etc."), "GIF"},
TLD_EE_VIFcode = {
L"VIFcodes", L"VIFcodes",
pxDt("All VIFcode processing; command, tag style, interrupts."),
"VIF"
},
TLD_EE_VIFcode = {L"VIFcodes", L"VIFcodes", pxDt("All VIFcode processing; command, tag style, interrupts."), "VIF"},
TLD_EE_MSKPATH3 = {
L"MSKPATH3", L"MSKPATH3",
pxDt("All processing involved in Path3 Masking."),
"MSKPATH3"
},
TLD_EE_MSKPATH3 = {L"MSKPATH3", L"MSKPATH3", pxDt("All processing involved in Path3 Masking."), "MSKPATH3"},
TLD_EE_SPR = {
L"MFIFO", L"Scratchpad MFIFO",
pxDt("Scratchpad's MFIFO activity."),
"SPR"
},
TLD_EE_SPR = {L"MFIFO", L"Scratchpad MFIFO", pxDt("Scratchpad's MFIFO activity."), "SPR"},
TLD_EE_DMAC = {
L"DmaCtrl", L"DMA Controller",
pxDt("Actual data transfer logs, bus right arbitration, stalls, etc."),
"eDmaC"
},
TLD_EE_DMAC = {L"DmaCtrl", L"DMA Controller", pxDt("Actual data transfer logs, bus right arbitration, stalls, etc."), "eDmaC"},
TLD_EE_Counters = {
L"Counters", L"Counters",
pxDt("Tracks all EE counters events and some counter register activity."),
"eCnt"
},
TLD_EE_Counters = {L"Counters", L"Counters", pxDt("Tracks all EE counters events and some counter register activity."), "eCnt"},
TLD_EE_VIF = {
L"VIF", L"VIF",
pxDt("Dumps various VIF and VIFcode processing data."),
"VIF"
},
TLD_EE_VIF = {L"VIF", L"VIF", pxDt("Dumps various VIF and VIFcode processing data."), "VIF"},
TLD_EE_GIF = {
L"GIF", L"GIF",
pxDt("Dumps various GIF and GIFtag parsing data."),
"GIF"
};
TLD_EE_GIF = {L"GIF", L"GIF", pxDt("Dumps various GIF and GIFtag parsing data."), "GIF"};
// ----------------------------------
// IOP - Input / Output Processor
@ -285,80 +191,31 @@ static const SysTraceLogDescriptor
TLD_IOP_Bios = {
L"Bios", L"Bios",
pxDt("SYSCALL and IRX activity."),
"IOP"
},
"IOP"},
TLD_IOP_Memory = {
L"Memory", L"Memory",
pxDt("Direct memory accesses to unknown or unmapped IOP memory space."),
"iMem"
},
TLD_IOP_Memory = {L"Memory", L"Memory", pxDt("Direct memory accesses to unknown or unmapped IOP memory space."), "iMem"},
TLD_IOP_R3000A = {
L"R3000A", L"R3000A Core",
pxDt("Disasm of executing core instructions (excluding COPs and CACHE)."),
"iDis"
},
TLD_IOP_R3000A = {L"R3000A", L"R3000A Core", pxDt("Disasm of executing core instructions (excluding COPs and CACHE)."), "iDis"},
TLD_IOP_COP2 = {
L"COP2/GPU", L"COP2",
pxDt("Disasm of the IOP's GPU co-processor instructions."),
"iDis"
},
TLD_IOP_COP2 = {L"COP2/GPU", L"COP2", pxDt("Disasm of the IOP's GPU co-processor instructions."), "iDis"},
TLD_IOP_KnownHw = {
L"HwRegs", L"Hardware Regs",
pxDt("All known hardware register accesses, not including the sub-filters below."),
"iReg"
},
TLD_IOP_KnownHw = {L"HwRegs", L"Hardware Regs", pxDt("All known hardware register accesses, not including the sub-filters below."), "iReg"},
TLD_IOP_UnknownHw = {
L"UnknownRegs", L"Unknown Regs",
pxDt("Logs only unknown, unmapped, or unimplemented register accesses."),
"iReg"
},
TLD_IOP_UnknownHw = {L"UnknownRegs", L"Unknown Regs", pxDt("Logs only unknown, unmapped, or unimplemented register accesses."), "iReg"},
TLD_IOP_DMAhw = {
L"DmaRegs", L"DMA Regs",
pxDt("Logs only DMA-related registers."),
"iReg"
},
TLD_IOP_DMAhw = {L"DmaRegs", L"DMA Regs", pxDt("Logs only DMA-related registers."), "iReg"},
TLD_IOP_Memcards = {
L"Memorycards", L"Memorycards",
pxDt("Memorycard reads, writes, erases, terminators, and other processing."),
"Mcd"
},
TLD_IOP_Memcards = {L"Memorycards", L"Memorycards", pxDt("Memorycard reads, writes, erases, terminators, and other processing."), "Mcd"},
TLD_IOP_PAD = {
L"Pad", L"Pad",
pxDt("Gamepad activity on the SIO."),
"Pad"
},
TLD_IOP_PAD = {L"Pad", L"Pad", pxDt("Gamepad activity on the SIO."), "Pad"},
TLD_IOP_DMAC = {
L"DmaCrl", L"DMA Controller",
pxDt("Actual DMA event processing and data transfer logs."),
"iDmaC"
},
TLD_IOP_DMAC = {L"DmaCrl", L"DMA Controller", pxDt("Actual DMA event processing and data transfer logs."), "iDmaC"},
TLD_IOP_Counters = {
L"Counters", L"Counters",
pxDt("Tracks all IOP counters events and some counter register activity."),
"iCnt"
},
TLD_IOP_Counters = {L"Counters", L"Counters", pxDt("Tracks all IOP counters events and some counter register activity."), "iCnt"},
TLD_IOP_CDVD = {
L"CDVD", L"CDVD",
pxDt("Detailed logging of CDVD hardware."),
"CDVD"
},
TLD_IOP_CDVD = {L"CDVD", L"CDVD", pxDt("Detailed logging of CDVD hardware."), "CDVD"},
TLD_IOP_MDEC = {
L"MDEC", L"MDEC",
pxDt("Detailed logging of the Motion (FMV) Decoder hardware unit."),
"MDEC"
};
TLD_IOP_MDEC = {L"MDEC", L"MDEC", pxDt("Detailed logging of the Motion (FMV) Decoder hardware unit."), "MDEC"};
SysTraceLogPack::SysTraceLogPack()
: SIF(&TLD_SIF)

View File

@ -67,9 +67,11 @@ void Pcsx2App::DetectCpuAndUserMode()
void Pcsx2App::OpenMainFrame()
{
if( AppRpc_TryInvokeAsync( &Pcsx2App::OpenMainFrame ) ) return;
if (AppRpc_TryInvokeAsync(&Pcsx2App::OpenMainFrame))
return;
if( GetMainFramePtr() != NULL ) return;
if (GetMainFramePtr() != NULL)
return;
MainEmuFrame* mainFrame = new MainEmuFrame(NULL, pxGetAppName());
m_id_MainFrame = mainFrame->GetId();
@ -102,7 +104,8 @@ void Pcsx2App::OpenMainFrame()
void Pcsx2App::OpenProgramLog()
{
if( AppRpc_TryInvokeAsync( &Pcsx2App::OpenProgramLog ) ) return;
if (AppRpc_TryInvokeAsync(&Pcsx2App::OpenProgramLog))
return;
if (/*ConsoleLogFrame* frame =*/GetProgramLog())
{
@ -117,7 +120,8 @@ void Pcsx2App::OpenProgramLog()
m_id_ProgramLogBox = m_ptr_ProgramLog->GetId();
EnableAllLogging();
if( m_current_focus ) m_current_focus->SetFocus();
if (m_current_focus)
m_current_focus->SetFocus();
// This is test code for printing out all supported languages and their canonical names in wiki-fied
// format. I might use it again soon, so I'm leaving it in for now... --air
@ -135,7 +139,8 @@ void Pcsx2App::OpenProgramLog()
void Pcsx2App::AllocateCoreStuffs()
{
if( AppRpc_TryInvokeAsync( &Pcsx2App::AllocateCoreStuffs ) ) return;
if (AppRpc_TryInvokeAsync(&Pcsx2App::AllocateCoreStuffs))
return;
SysLogMachineCaps();
AppApplySettings();
@ -159,12 +164,10 @@ void Pcsx2App::AllocateCoreStuffs()
wxTextCtrl* scrollableTextArea = new wxTextCtrl(
&exconf, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_READONLY | wxTE_MULTILINE | wxTE_WORDWRAP
);
wxTE_READONLY | wxTE_MULTILINE | wxTE_WORDWRAP);
exconf += 12;
exconf += exconf.Heading( pxE( L"Warning: Some of the configured PS2 recompilers failed to initialize and have been disabled:" )
);
exconf += exconf.Heading(pxE(L"Warning: Some of the configured PS2 recompilers failed to initialize and have been disabled:"));
exconf += 6;
exconf += scrollableTextArea | pxExpand.Border(wxALL, 16);
@ -210,13 +213,13 @@ void Pcsx2App::AllocateCoreStuffs()
void Pcsx2App::OnInitCmdLine(wxCmdLineParser& parser)
{
parser.SetLogo(AddAppName(" >> %s -- A PlayStation 2 Emulator for the PC <<") + L"\n\n" +
_("All options are for the current session only and will not be saved.\n")
);
_("All options are for the current session only and will not be saved.\n"));
wxString fixlist(L" ");
for (GamefixId i = GamefixId_FIRST; i < pxEnumEnd; ++i)
{
if( i != GamefixId_FIRST ) fixlist += L",";
if (i != GamefixId_FIRST)
fixlist += L",";
fixlist += EnumToString(i);
}
@ -248,8 +251,7 @@ void Pcsx2App::OnInitCmdLine( wxCmdLineParser& parser )
ForPlugins([&](const PluginInfo* pi) {
parser.AddOption(wxEmptyString, pi->GetShortname().Lower(),
pxsFmt( _("specify the file to use as the %s plugin"), WX_STR(pi->GetShortname()) )
);
pxsFmt(_("specify the file to use as the %s plugin"), WX_STR(pi->GetShortname())));
});
parser.SetSwitchChars(L"-");
@ -288,8 +290,10 @@ bool Pcsx2App::ParseOverrides( wxCmdLineParser& parser )
Overrides.Gamefixes.Set(dest, true);
}
if (parser.Found(L"fullscreen")) Overrides.GsWindowMode = GsWinMode_Fullscreen;
if (parser.Found(L"windowed")) Overrides.GsWindowMode = GsWinMode_Windowed;
if (parser.Found(L"fullscreen"))
Overrides.GsWindowMode = GsWinMode_Fullscreen;
if (parser.Found(L"windowed"))
Overrides.GsWindowMode = GsWinMode_Windowed;
ForPlugins([&](const PluginInfo* pi) {
if (parser.Found(pi->GetShortname().Lower(), &dest))
@ -302,18 +306,19 @@ bool Pcsx2App::ParseOverrides( wxCmdLineParser& parser )
okcan += okcan.Heading(wxsFormat(
_("%s Plugin Override Error! The following file does not exist or is not a valid %s plugin:\n\n"),
pi->GetShortname().c_str(), pi->GetShortname().c_str()
) );
pi->GetShortname().c_str(), pi->GetShortname().c_str()));
okcan += okcan.GetCharHeight();
okcan += okcan.Text(dest);
okcan += okcan.GetCharHeight();
okcan += okcan.Heading(AddAppName(_("Press OK to use the default configured plugin, or Cancel to close %s.")));
if( wxID_CANCEL == pxIssueConfirmation( okcan, MsgButtons().OKCancel() ) ) parsed = false;
if (wxID_CANCEL == pxIssueConfirmation(okcan, MsgButtons().OKCancel()))
parsed = false;
}
if (parsed) Overrides.Filenames.Plugins[pi->id] = dest;
if (parsed)
Overrides.Filenames.Plugins[pi->id] = dest;
}
});
@ -334,7 +339,8 @@ bool Pcsx2App::OnCmdLineParsed( wxCmdLineParser& parser )
m_UseGUI = !parser.Found(L"nogui");
m_NoGuiExitPrompt = parser.Found(L"noguiprompt"); // by default no prompt for exit with nogui.
if( !ParseOverrides(parser) ) return false;
if (!ParseOverrides(parser))
return false;
// --- Parse Startup/Autoboot options ---
@ -351,10 +357,13 @@ bool Pcsx2App::OnCmdLineParsed( wxCmdLineParser& parser )
else
{
wxString elf_file;
if (parser.Found(L"elf", &elf_file) && !elf_file.IsEmpty()) {
if (parser.Found(L"elf", &elf_file) && !elf_file.IsEmpty())
{
Startup.SysAutoRunElf = true;
Startup.ElfFile = elf_file;
} else if (parser.Found(L"irx", &elf_file) && !elf_file.IsEmpty()) {
}
else if (parser.Found(L"irx", &elf_file) && !elf_file.IsEmpty())
{
Startup.SysAutoRunIrx = true;
Startup.ElfFile = elf_file;
}
@ -385,8 +394,7 @@ typedef void (wxEvtHandler::*pxStuckThreadEventHandler)(pxMessageBoxEvent&);
// --------------------------------------------------------------------------------------
// GameDatabaseLoaderThread
// --------------------------------------------------------------------------------------
class GameDatabaseLoaderThread : public pxThread
, EventListener_AppStatus
class GameDatabaseLoaderThread : public pxThread, EventListener_AppStatus
{
typedef pxThread _parent;
@ -398,7 +406,8 @@ public:
virtual ~GameDatabaseLoaderThread()
{
try {
try
{
_parent::Cancel();
}
DESTRUCTOR_CATCHALL
@ -445,7 +454,8 @@ bool Pcsx2App::OnInit()
}
Console.WriteLn("Command line parsing...");
if( !_parent::OnInit() ) return false;
if (!_parent::OnInit())
return false;
Console.WriteLn("Command line parsed!");
i18n_SetLanguagePath();
@ -485,10 +495,12 @@ bool Pcsx2App::OnInit()
// Start GUI and/or Direct Emulation
// -------------------------------------
pxSizerFlags::SetBestPadding();
if( Startup.ForceConsole ) g_Conf->ProgLogBox.Visible = true;
if (Startup.ForceConsole)
g_Conf->ProgLogBox.Visible = true;
OpenProgramLog();
AllocateCoreStuffs();
if( m_UseGUI ) OpenMainFrame();
if (m_UseGUI)
OpenMainFrame();
(new GameDatabaseLoaderThread())->Start();
@ -584,7 +596,8 @@ void Pcsx2App::OnScheduledTermination( wxTimerEvent& evt )
// the glorious user, whomever (s)he-it might be.
void Pcsx2App::PrepForExit()
{
if( m_ScheduledTermination ) return;
if (m_ScheduledTermination)
return;
m_ScheduledTermination = true;
DispatchEvent(AppStatus_Exiting);
@ -605,7 +618,8 @@ void Pcsx2App::CleanupRestartable()
SysExecutorThread.ShutdownQueue();
IdleEventDispatcher(L"Cleanup");
if( g_Conf ) AppSaveSettings();
if (g_Conf)
AppSaveSettings();
}
// This cleanup handler can be called from OnExit (it doesn't need a running message pump),
@ -621,7 +635,10 @@ void Pcsx2App::CleanupOnExit()
CleanupRestartable();
CleanupResources();
}
catch( Exception::CancelEvent& ) { throw; }
catch (Exception::CancelEvent&)
{
throw;
}
catch (Exception::RuntimeError& ex)
{
// Handle runtime errors gracefully during shutdown. Mostly these are things
@ -748,7 +765,8 @@ Pcsx2App::Pcsx2App()
Pcsx2App::~Pcsx2App()
{
pxDoAssert = pxAssertImpl_LogIt;
try {
try
{
vu1Thread.Cancel();
}
DESTRUCTOR_CATCHALL