From b6ac09aa1a967e19a6a8b4de1aa12df75dd7e733 Mon Sep 17 00:00:00 2001 From: Oil Date: Thu, 5 Jun 2014 18:08:44 +0400 Subject: [PATCH 1/5] Improved LogFrame. --- rpcs3/Emu/CPU/CPUThread.cpp | 4 +- rpcs3/Emu/Cell/PPUInterpreter.h | 4 +- rpcs3/Emu/Cell/RawSPUThread.cpp | 4 +- rpcs3/Emu/Cell/SPUThread.h | 14 ++--- rpcs3/Emu/SysCalls/Modules.cpp | 4 +- rpcs3/Emu/SysCalls/SysCalls.cpp | 4 +- rpcs3/Emu/SysCalls/SysCalls.h | 4 +- rpcs3/Gui/ConLog.cpp | 94 +++++++++++++++++++++++++++++++-- rpcs3/Gui/ConLog.h | 19 ++++++- rpcs3/Gui/MainFrame.cpp | 26 ++------- rpcs3/Ini.h | 38 +++++++++---- 11 files changed, 158 insertions(+), 57 deletions(-) diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index 9ae338ce2d..a1caaa1bf0 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -297,7 +297,7 @@ void CPUThread::ExecOnce() void CPUThread::Task() { - if (Ini.HLELogging.GetValue()) ConLog.Write("%s enter", CPUThread::GetFName().c_str()); + if (Ini.LogAllSysCalls.GetValue()) ConLog.Write("%s enter", CPUThread::GetFName().c_str()); const std::vector& bp = Emu.GetBreakPoints(); @@ -359,7 +359,7 @@ void CPUThread::Task() ConLog.Success("Exit Code: %d", exitcode); } - if (Ini.HLELogging.GetValue()) ConLog.Write("%s leave", CPUThread::GetFName().c_str()); + if (Ini.LogAllSysCalls.GetValue()) ConLog.Write("%s leave", CPUThread::GetFName().c_str()); } s64 CPUThread::ExecAsCallback(u64 pc, bool wait, u64 a1, u64 a2, u64 a3, u64 a4) // not multithread-safe diff --git a/rpcs3/Emu/Cell/PPUInterpreter.h b/rpcs3/Emu/Cell/PPUInterpreter.h index 03c2900927..bb23f6a147 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.h +++ b/rpcs3/Emu/Cell/PPUInterpreter.h @@ -69,7 +69,7 @@ private: { SysCalls::DoSyscall(CPU.GPR[11]); - if(Ini.HLELogging.GetValue()) + if (Ini.LogAllSysCalls.GetValue()) { ConLog.Warning("SysCall[0x%llx] done with code [0x%llx]! #pc: 0x%llx", CPU.GPR[11], CPU.GPR[3], CPU.PC); if(CPU.GPR[11] > 1024) @@ -2097,7 +2097,7 @@ private: case 0x2: SysCall(); break; case 0x3: StaticExecute(CPU.GPR[11]); - if (Ini.HLELogging.GetValue()) + if (Ini.LogAllSysCalls.GetValue()) { ConLog.Write("'%s' done with code[0x%llx]! #pc: 0x%llx", g_static_funcs_list[CPU.GPR[11]]->name, CPU.GPR[3], CPU.PC); diff --git a/rpcs3/Emu/Cell/RawSPUThread.cpp b/rpcs3/Emu/Cell/RawSPUThread.cpp index 4cb01dcd9e..d0cc2bb941 100644 --- a/rpcs3/Emu/Cell/RawSPUThread.cpp +++ b/rpcs3/Emu/Cell/RawSPUThread.cpp @@ -251,7 +251,7 @@ u32 RawSPUThread::GetIndex() const void RawSPUThread::Task() { - if (Ini.HLELogging.GetValue()) ConLog.Write("%s enter", PPCThread::GetFName().c_str()); + if (Ini.LogAllSysCalls.GetValue()) ConLog.Write("%s enter", PPCThread::GetFName().c_str()); const std::vector& bp = Emu.GetBreakPoints(); @@ -334,5 +334,5 @@ void RawSPUThread::Task() ConLog.Error("Exception: %s", e); } - if (Ini.HLELogging.GetValue()) ConLog.Write("%s leave", PPCThread::GetFName().c_str()); + if (Ini.LogAllSysCalls.GetValue()) ConLog.Write("%s leave", PPCThread::GetFName().c_str()); } diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index 7845a48f12..0684ee93ff 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -649,7 +649,7 @@ public: break; } - if (Ini.HLELogging.GetValue() || rec->s) + if (Ini.LogAllSysCalls.GetValue() || rec->s) ConLog.Write("*** list element(%d/%d): s = 0x%x, ts = 0x%x, low ea = 0x%x (lsa = 0x%x)", i, list_size, (u16)rec->s, (u16)rec->ts, (u32)rec->ea, lsa | (addr & 0xf)); @@ -693,7 +693,7 @@ public: case MFC_PUTR_CMD: // ??? case MFC_GET_CMD: { - if (Ini.HLELogging.GetValue()) ConLog.Write("DMA %s%s%s%s: lsa = 0x%x, ea = 0x%llx, tag = 0x%x, size = 0x%x, cmd = 0x%x", + if (Ini.LogAllSysCalls.GetValue()) ConLog.Write("DMA %s%s%s%s: lsa = 0x%x, ea = 0x%llx, tag = 0x%x, size = 0x%x, cmd = 0x%x", (op & MFC_PUT_CMD ? "PUT" : "GET"), (op & MFC_RESULT_MASK ? "R" : ""), (op & MFC_BARRIER_MASK ? "B" : ""), @@ -708,7 +708,7 @@ public: case MFC_PUTRL_CMD: // ??? case MFC_GETL_CMD: { - if (Ini.HLELogging.GetValue()) ConLog.Write("DMA %s%s%s%s: lsa = 0x%x, list = 0x%llx, tag = 0x%x, size = 0x%x, cmd = 0x%x", + if (Ini.LogAllSysCalls.GetValue()) ConLog.Write("DMA %s%s%s%s: lsa = 0x%x, list = 0x%llx, tag = 0x%x, size = 0x%x, cmd = 0x%x", (op & MFC_PUT_CMD ? "PUT" : "GET"), (op & MFC_RESULT_MASK ? "RL" : "L"), (op & MFC_BARRIER_MASK ? "B" : ""), @@ -724,7 +724,7 @@ public: case MFC_PUTLLUC_CMD: case MFC_PUTQLLUC_CMD: { - if (Ini.HLELogging.GetValue() || size != 128) ConLog.Write("DMA %s: lsa=0x%x, ea = 0x%llx, (tag) = 0x%x, (size) = 0x%x, cmd = 0x%x", + if (Ini.LogAllSysCalls.GetValue() || size != 128) ConLog.Write("DMA %s: lsa=0x%x, ea = 0x%llx, (tag) = 0x%x, (size) = 0x%x, cmd = 0x%x", (op == MFC_GETLLAR_CMD ? "GETLLAR" : op == MFC_PUTLLC_CMD ? "PUTLLC" : op == MFC_PUTLLUC_CMD ? "PUTLLUC" : "PUTQLLUC"), @@ -921,7 +921,7 @@ public: return; } - if (Ini.HLELogging.GetValue()) + if (Ini.LogAllSysCalls.GetValue()) { ConLog.Write("sys_spu_thread_send_event(spup=%d, data0=0x%x, data1=0x%x)", spup, v & 0x00ffffff, data); } @@ -1143,7 +1143,7 @@ public: return; } - if (Ini.HLELogging.GetValue()) + if (Ini.LogAllSysCalls.GetValue()) { ConLog.Write("sys_spu_thread_receive_event(spuq=0x%x)", spuq); } @@ -1208,7 +1208,7 @@ public: { ConLog.Error("sys_spu_thread_exit (no status, code 0x102)"); } - else if (Ini.HLELogging.GetValue()) + else if (Ini.LogAllSysCalls.GetValue()) { // the real exit status ConLog.Write("sys_spu_thread_exit (status=0x%x)", SPU.Out_MBox.GetValue()); diff --git a/rpcs3/Emu/SysCalls/Modules.cpp b/rpcs3/Emu/SysCalls/Modules.cpp index b240f0d635..22f90eedbe 100644 --- a/rpcs3/Emu/SysCalls/Modules.cpp +++ b/rpcs3/Emu/SysCalls/Modules.cpp @@ -445,7 +445,7 @@ void Module::SetName(const std::string& name) void Module::Log(const u32 id, std::string fmt, ...) { - if(Ini.HLELogging.GetValue()) + if(Ini.LogAllSysCalls.GetValue()) { va_list list; va_start(list, fmt); @@ -456,7 +456,7 @@ void Module::Log(const u32 id, std::string fmt, ...) void Module::Log(std::string fmt, ...) { - if(Ini.HLELogging.GetValue()) + if (Ini.LogAllSysCalls.GetValue()) { va_list list; va_start(list, fmt); diff --git a/rpcs3/Emu/SysCalls/SysCalls.cpp b/rpcs3/Emu/SysCalls/SysCalls.cpp index a068fbab8b..bd72b3a247 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.cpp +++ b/rpcs3/Emu/SysCalls/SysCalls.cpp @@ -555,8 +555,8 @@ void default_syscall() return; case 1000: - Ini.HLELogging.SetValue(!Ini.HLELogging.GetValue()); - ConLog.Warning("Log %s", (Ini.HLELogging.GetValue() ? "enabled" : "disabled")); + Ini.LogAllSysCalls.SetValue(!Ini.LogAllSysCalls.GetValue()); + ConLog.Warning("Log %s", (Ini.LogAllSysCalls.GetValue() ? "enabled" : "disabled")); return; } diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index 5793703a28..b069564898 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -46,7 +46,7 @@ public: void Log(const u32 id, std::string fmt, ...) { - if(Ini.HLELogging.GetValue()) + if (Ini.LogAllSysCalls.GetValue()) { va_list list; va_start(list, fmt); @@ -57,7 +57,7 @@ public: void Log(std::string fmt, ...) { - if(Ini.HLELogging.GetValue()) + if(Ini.LogAllSysCalls.GetValue()) { va_list list; va_start(list, fmt); diff --git a/rpcs3/Gui/ConLog.cpp b/rpcs3/Gui/ConLog.cpp index 6b4dbb6c33..54177b0aea 100644 --- a/rpcs3/Gui/ConLog.cpp +++ b/rpcs3/Gui/ConLog.cpp @@ -9,6 +9,11 @@ LogWriter ConLog; LogFrame* ConLogFrame; +enum LogIDs +{ + id_log_level = 0x888, +}; + std::mutex g_cs_conlog; static const uint max_item_count = 500; @@ -122,7 +127,8 @@ void LogWriter::WriteToLog(const std::string& prefix, const std::string& value, if(m_logfile.IsOpened() && !new_prefix.empty()) m_logfile.Write(fmt::FromUTF8("[" + new_prefix + "]: " + value + "\n")); - if(!ConLogFrame || Ini.HLELogLvl.GetValue() == 4 || (lvl != 0 && lvl <= Ini.HLELogLvl.GetValue())) + + if(!ConLogFrame) return; std::lock_guard lock(g_cs_conlog); @@ -163,15 +169,26 @@ void LogWriter::SkipLn() WriteToLog("", "", 0); } -BEGIN_EVENT_TABLE(LogFrame, wxPanel) +BEGIN_EVENT_TABLE(LogFrame, FrameBase) EVT_CLOSE(LogFrame::OnQuit) END_EVENT_TABLE() -LogFrame::LogFrame(wxWindow* parent) - : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(600, 500)) +LogFrame::LogFrame() + : FrameBase(nullptr, wxID_ANY, "Log Frame", "LogFrame", wxSize(600, 500)) , ThreadBase("LogThread") , m_log(*new wxListView(this)) { + wxMenuBar* menubar = new wxMenuBar(); + + wxMenu* menu_log_settings = new wxMenu(); + menubar->Append(menu_log_settings, "Settings"); + menu_log_settings->Append(id_log_level, "Log Level"); + SetMenuBar(menubar); + + //events + Bind(wxEVT_MENU, &LogFrame::Settings, this, id_log_level); + Bind(wxEVT_SIZE, &LogFrame::UpdateListSize, this); + m_log.InsertColumn(0, wxEmptyString); m_log.InsertColumn(1, "Log"); m_log.SetBackgroundColour(wxColour("Black")); @@ -245,3 +262,72 @@ void LogFrame::OnQuit(wxCloseEvent& event) ConLogFrame = nullptr; event.Skip(); } + +void LogFrame::Settings(wxCommandEvent& WXUNUSED(event)) +{ + bool paused = false; + + if (Emu.IsRunning()) + { + Emu.Pause(); + paused = true; + } + + wxDialog diag(this, wxID_ANY, "Settings", wxDefaultPosition); + static const u32 height = 400; + static const u32 width = 385; + + wxStaticBoxSizer* s_round_log_level = new wxStaticBoxSizer(wxVERTICAL, &diag, _("Log Level")); + wxBoxSizer* s_panel = new wxBoxSizer(wxVERTICAL); + wxBoxSizer* s_subpanel_loglvl = new wxBoxSizer(wxVERTICAL); + + wxCheckBox* chbox_log_write = new wxCheckBox(&diag, wxID_ANY, "Write"); + wxCheckBox* chbox_log_error = new wxCheckBox(&diag, wxID_ANY, "Error"); + wxCheckBox* chbox_log_warning = new wxCheckBox(&diag, wxID_ANY, "Warning"); + wxCheckBox* chbox_log_success = new wxCheckBox(&diag, wxID_ANY, "Success"); + wxCheckBox* chbox_hle_logging = new wxCheckBox(&diag, wxID_ANY, "Log all SysCalls"); + + s_round_log_level->Add(chbox_log_write, wxSizerFlags().Border(wxALL, 5).Expand()); + s_round_log_level->Add(chbox_log_error, wxSizerFlags().Border(wxALL, 5).Expand()); + s_round_log_level->Add(chbox_log_warning, wxSizerFlags().Border(wxALL, 5).Expand()); + s_round_log_level->Add(chbox_log_success, wxSizerFlags().Border(wxALL, 5).Expand()); + s_round_log_level->AddSpacer(20); + s_round_log_level->Add(chbox_hle_logging, wxSizerFlags().Border(wxALL, 5).Expand()); + + // get values from .ini + chbox_log_write->SetValue(Ini.LogWrite.GetValue()); + chbox_log_warning->SetValue(Ini.LogWarning.GetValue()); + chbox_log_error->SetValue(Ini.LogError.GetValue()); + chbox_log_success->SetValue(Ini.LogSuccess.GetValue()); + chbox_hle_logging->SetValue(Ini.LogAllSysCalls.GetValue()); + + s_subpanel_loglvl->Add(s_round_log_level, wxSizerFlags().Border(wxALL, 5).Expand()); + + wxBoxSizer* s_b_panel(new wxBoxSizer(wxHORIZONTAL)); + s_b_panel->Add(new wxButton(&diag, wxID_OK), wxSizerFlags().Border(wxALL, 5).Bottom()); + s_b_panel->Add(new wxButton(&diag, wxID_CANCEL), wxSizerFlags().Border(wxALL, 5).Bottom()); + + s_panel->Add(s_subpanel_loglvl); + s_panel->Add(s_b_panel); + + diag.SetSizerAndFit(s_panel); + + if (diag.ShowModal() == wxID_OK) + { + Ini.LogWrite.SetValue(chbox_log_write->GetValue()); + Ini.LogWarning.SetValue(chbox_log_warning->GetValue()); + Ini.LogError.SetValue(chbox_log_error->GetValue()); + Ini.LogSuccess.SetValue(chbox_log_success->GetValue()); + Ini.LogAllSysCalls.SetValue(chbox_hle_logging->GetValue()); + + Ini.Save(); + } + + if (paused) Emu.Resume(); +} + +void LogFrame::UpdateListSize(wxSizeEvent& event) +{ + m_log.SetSize(this->GetSize()); + event.Skip(); +} \ No newline at end of file diff --git a/rpcs3/Gui/ConLog.h b/rpcs3/Gui/ConLog.h index d39eb47d64..90462a0bb1 100644 --- a/rpcs3/Gui/ConLog.h +++ b/rpcs3/Gui/ConLog.h @@ -19,13 +19,20 @@ public: template void Write(const std::string &fmt, Arg&&... args) { + if (!Ini.LogWrite.GetValue()) + return; + std::string frmt = fmt::Format(fmt, std::forward(args)...); + WriteToLog("!", frmt, 2); } template void Error(const std::string &fmt, Arg&&... args) { + if (!Ini.LogError.GetValue()) + return; + std::string frmt = fmt::Format(fmt, std::forward(args)...); WriteToLog("E", frmt, 4); } @@ -33,6 +40,9 @@ public: template void Warning(const std::string &fmt, Arg&&... args) { + if (!Ini.LogWarning.GetValue()) + return; + std::string frmt = fmt::Format(fmt, std::forward(args)...); WriteToLog("W", frmt, 3); } @@ -40,6 +50,9 @@ public: template void Success(const std::string &fmt, Arg&&... args) { + if (!Ini.LogSuccess.GetValue()) + return; + std::string frmt = fmt::Format(fmt, std::forward(args)...); WriteToLog("S", frmt, 1); } @@ -48,13 +61,13 @@ public: }; class LogFrame - : public wxPanel + : public FrameBase , public ThreadBase { wxListView& m_log; public: - LogFrame(wxWindow* parent); + LogFrame(); ~LogFrame(); bool Close(bool force = false); @@ -62,6 +75,8 @@ public: private: virtual void Task(); + void Settings(wxCommandEvent& event); + void UpdateListSize(wxSizeEvent& event); void OnQuit(wxCloseEvent& event); DECLARE_EVENT_TABLE(); diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 0af99767c7..02626da024 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -103,10 +103,9 @@ MainFrame::MainFrame() // Panels m_game_viewer = new GameViewer(this); m_debugger_frame = new DebuggerPanel(this); - ConLogFrame = new LogFrame(this); + ConLogFrame = new LogFrame; AddPane(m_game_viewer, "Game List", wxAUI_DOCK_BOTTOM); - AddPane(ConLogFrame, "Log", wxAUI_DOCK_BOTTOM); AddPane(m_debugger_frame, "Debugger", wxAUI_DOCK_RIGHT); // Events @@ -392,9 +391,6 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) // Audio wxStaticBoxSizer* s_round_audio_out = new wxStaticBoxSizer(wxVERTICAL, p_audio, _("Audio Out")); - // HLE / Misc. - wxStaticBoxSizer* s_round_hle_log_lvl = new wxStaticBoxSizer(wxVERTICAL, p_hle, _("Log Level")); - // System wxStaticBoxSizer* s_round_sys_lang = new wxStaticBoxSizer(wxVERTICAL, p_system, _("Language")); @@ -407,7 +403,6 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) wxComboBox* cbox_keyboard_handler = new wxComboBox(p_io, wxID_ANY); wxComboBox* cbox_mouse_handler = new wxComboBox(p_io, wxID_ANY); wxComboBox* cbox_audio_out = new wxComboBox(p_audio, wxID_ANY); - wxComboBox* cbox_hle_loglvl = new wxComboBox(p_hle, wxID_ANY); wxComboBox* cbox_sys_lang = new wxComboBox(p_system, wxID_ANY); wxCheckBox* chbox_cpu_ignore_rwerrors = new wxCheckBox(p_cpu, wxID_ANY, "Ignore Read/Write errors"); @@ -418,10 +413,9 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) wxCheckBox* chbox_gs_vsync = new wxCheckBox(p_graphics, wxID_ANY, "VSync"); wxCheckBox* chbox_audio_dump = new wxCheckBox(p_audio, wxID_ANY, "Dump to file"); wxCheckBox* chbox_audio_conv = new wxCheckBox(p_audio, wxID_ANY, "Convert to 16 bit"); - wxCheckBox* chbox_hle_logging = new wxCheckBox(p_hle, wxID_ANY, "Log all SysCalls"); wxCheckBox* chbox_hle_hook_stfunc = new wxCheckBox(p_hle, wxID_ANY, "Hook static functions"); wxCheckBox* chbox_hle_savetty = new wxCheckBox(p_hle, wxID_ANY, "Save TTY output to file"); - wxCheckBox* chbox_hle_exitonstop = new wxCheckBox(p_hle, wxID_ANY, "Exit RPCS3 when process finishes"); + wxCheckBox* chbox_hle_exitonstop = new wxCheckBox(p_hle, wxID_ANY, "Exit RPCS3 when process finishes"); wxCheckBox* chbox_hle_hide_debug_console = new wxCheckBox(p_hle, wxID_ANY, "Hide Debug Console"); wxCheckBox* chbox_hle_always_start = new wxCheckBox(p_hle, wxID_ANY, "Always start after boot"); @@ -462,12 +456,6 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) cbox_audio_out->Append("Null"); cbox_audio_out->Append("OpenAL"); - cbox_hle_loglvl->Append("All"); - cbox_hle_loglvl->Append("Success"); - cbox_hle_loglvl->Append("Warnings"); - cbox_hle_loglvl->Append("Errors"); - cbox_hle_loglvl->Append("Nothing"); - cbox_sys_lang->Append("Japanese"); cbox_sys_lang->Append("English (US)"); cbox_sys_lang->Append("French"); @@ -497,7 +485,6 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) chbox_gs_vsync ->SetValue(Ini.GSVSyncEnable.GetValue()); chbox_audio_dump ->SetValue(Ini.AudioDumpToFile.GetValue()); chbox_audio_conv ->SetValue(Ini.AudioConvertToU16.GetValue()); - chbox_hle_logging ->SetValue(Ini.HLELogging.GetValue()); chbox_hle_hook_stfunc ->SetValue(Ini.HLEHookStFunc.GetValue()); chbox_hle_savetty ->SetValue(Ini.HLESaveTTY.GetValue()); chbox_hle_exitonstop ->SetValue(Ini.HLEExitOnStop.GetValue()); @@ -513,14 +500,12 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) cbox_keyboard_handler->SetSelection(Ini.KeyboardHandlerMode.GetValue()); cbox_mouse_handler ->SetSelection(Ini.MouseHandlerMode.GetValue()); cbox_audio_out ->SetSelection(Ini.AudioOutMode.GetValue()); - cbox_hle_loglvl ->SetSelection(Ini.HLELogLvl.GetValue()); cbox_sys_lang ->SetSelection(Ini.SysLanguage.GetValue()); // Enable / Disable parameters chbox_audio_dump->Enable(Emu.IsStopped()); chbox_audio_conv->Enable(Emu.IsStopped()); - chbox_hle_logging->Enable(Emu.IsStopped()); chbox_hle_hook_stfunc->Enable(Emu.IsStopped()); @@ -537,8 +522,6 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) s_round_audio_out->Add(cbox_audio_out, wxSizerFlags().Border(wxALL, 5).Expand()); - s_round_hle_log_lvl->Add(cbox_hle_loglvl, wxSizerFlags().Border(wxALL, 5).Expand()); - s_round_sys_lang->Add(cbox_sys_lang, wxSizerFlags().Border(wxALL, 5).Expand()); // Core @@ -567,8 +550,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) s_subpanel_audio->Add(chbox_audio_conv, wxSizerFlags().Border(wxALL, 5).Expand()); // HLE / Misc. - s_subpanel_hle->Add(s_round_hle_log_lvl, wxSizerFlags().Border(wxALL, 5).Expand()); - s_subpanel_hle->Add(chbox_hle_logging, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_hle->AddSpacer(15); s_subpanel_hle->Add(chbox_hle_hook_stfunc, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_hle->Add(chbox_hle_savetty, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_hle->Add(chbox_hle_exitonstop, wxSizerFlags().Border(wxALL, 5).Expand()); @@ -613,11 +595,9 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) Ini.AudioOutMode.SetValue(cbox_audio_out->GetSelection()); Ini.AudioDumpToFile.SetValue(chbox_audio_dump->GetValue()); Ini.AudioConvertToU16.SetValue(chbox_audio_conv->GetValue()); - Ini.HLELogging.SetValue(chbox_hle_logging->GetValue()); Ini.HLEHookStFunc.SetValue(chbox_hle_hook_stfunc->GetValue()); Ini.HLESaveTTY.SetValue(chbox_hle_savetty->GetValue()); Ini.HLEExitOnStop.SetValue(chbox_hle_exitonstop->GetValue()); - Ini.HLELogLvl.SetValue(cbox_hle_loglvl->GetSelection()); Ini.SysLanguage.SetValue(cbox_sys_lang->GetSelection()); Ini.HLEHideDebugConsole.SetValue(chbox_hle_hide_debug_console->GetValue()); Ini.HLEAlwaysStart.SetValue(chbox_hle_always_start->GetValue()); diff --git a/rpcs3/Ini.h b/rpcs3/Ini.h index ba9fed46aa..fdb79ee0b4 100644 --- a/rpcs3/Ini.h +++ b/rpcs3/Ini.h @@ -152,13 +152,18 @@ public: IniEntry PadHandlerRStickUp; // HLE/Miscs - IniEntry HLELogging; IniEntry HLEHookStFunc; IniEntry HLESaveTTY; IniEntry HLEExitOnStop; - IniEntry HLELogLvl; - IniEntry HLEHideDebugConsole; IniEntry HLEAlwaysStart; + IniEntry HLEHideDebugConsole; + + // ConLog + IniEntry LogAllSysCalls; + IniEntry LogWrite; + IniEntry LogWarning; + IniEntry LogError; + IniEntry LogSuccess; // Language IniEntry SysLanguage; @@ -220,14 +225,19 @@ public: PadHandlerRStickUp.Init("ControlSetings_PadHandlerRStickUp", path); // HLE/Misc - HLELogging.Init("HLE_HLELogging", path); HLEHookStFunc.Init("HLE_HLEHookStFunc", path); HLESaveTTY.Init("HLE_HLESaveTTY", path); HLEExitOnStop.Init("HLE_HLEExitOnStop", path); - HLELogLvl.Init("HLE_HLELogLvl", path); HLEHideDebugConsole.Init("HLE_HLEHideDebugConsole", path); HLEAlwaysStart.Init("HLE_HLEAlwaysStart", path); + // ConLog + LogAllSysCalls.Init("Log_LogAllSysCalls", path); + LogWrite.Init("Log_LogWrite", path); + LogWarning.Init("Log_LogWarning", path); + LogError.Init("Log_LogError", path); + LogSuccess.Init("Log_LogSuccess", path); + // Language SysLanguage.Init("Sytem_SysLanguage", path); } @@ -284,14 +294,19 @@ public: PadHandlerRStickUp.Load(366); //WXK_PAGEUP // HLE/Miscs - HLELogging.Load(false); HLEHookStFunc.Load(false); HLESaveTTY.Load(false); HLEExitOnStop.Load(false); - HLELogLvl.Load(3); HLEHideDebugConsole.Load(false); HLEAlwaysStart.Load(false); + // ConLog + LogAllSysCalls.Load(false); + LogWrite.Load(true); + LogWarning.Load(false); + LogError.Load(true); + LogSuccess.Load(true); + // Language SysLanguage.Load(1); @@ -349,14 +364,19 @@ public: PadHandlerRStickUp.Save(); // HLE/Miscs - HLELogging.Save(); HLEHookStFunc.Save(); HLESaveTTY.Save(); HLEExitOnStop.Save(); - HLELogLvl.Save(); HLEHideDebugConsole.Save(); HLEAlwaysStart.Save(); + // ConLog + LogAllSysCalls.Save(); + LogWrite.Save(); + LogWarning.Save(); + LogError.Save(); + LogSuccess.Save(); + // Language SysLanguage.Save(); } From 49295f8eff735106797da2eade9197f7615ed374 Mon Sep 17 00:00:00 2001 From: Oil Date: Thu, 5 Jun 2014 19:21:06 +0400 Subject: [PATCH 2/5] Fixed a scrollbar issue. --- rpcs3/Gui/ConLog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rpcs3/Gui/ConLog.cpp b/rpcs3/Gui/ConLog.cpp index 54177b0aea..a77b486007 100644 --- a/rpcs3/Gui/ConLog.cpp +++ b/rpcs3/Gui/ConLog.cpp @@ -328,6 +328,8 @@ void LogFrame::Settings(wxCommandEvent& WXUNUSED(event)) void LogFrame::UpdateListSize(wxSizeEvent& event) { - m_log.SetSize(this->GetSize()); + int width, height; + this->DoGetSize(&width, &height); + m_log.SetSize(wxSize(width-15, height-55)); event.Skip(); } \ No newline at end of file From 268e2eee4c58b954954d76215f7b7802d95902ec Mon Sep 17 00:00:00 2001 From: Oil Date: Thu, 5 Jun 2014 22:17:53 +0400 Subject: [PATCH 3/5] Changed default LogFrame position. --- rpcs3/Gui/ConLog.cpp | 8 ++++---- rpcs3/Gui/ConLog.h | 3 +-- rpcs3/Gui/MainFrame.cpp | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/rpcs3/Gui/ConLog.cpp b/rpcs3/Gui/ConLog.cpp index a77b486007..93d827717e 100644 --- a/rpcs3/Gui/ConLog.cpp +++ b/rpcs3/Gui/ConLog.cpp @@ -173,8 +173,9 @@ BEGIN_EVENT_TABLE(LogFrame, FrameBase) EVT_CLOSE(LogFrame::OnQuit) END_EVENT_TABLE() -LogFrame::LogFrame() - : FrameBase(nullptr, wxID_ANY, "Log Frame", "LogFrame", wxSize(600, 500)) +LogFrame::LogFrame(wxWindow *parent) + : FrameBase(nullptr, wxID_ANY, "Log Frame", "LogFrame", wxSize(600, 500), + wxPoint(parent->GetPosition().x + parent->GetSize().x, parent->GetPosition().y)) , ThreadBase("LogThread") , m_log(*new wxListView(this)) { @@ -183,6 +184,7 @@ LogFrame::LogFrame() wxMenu* menu_log_settings = new wxMenu(); menubar->Append(menu_log_settings, "Settings"); menu_log_settings->Append(id_log_level, "Log Level"); + SetMenuBar(menubar); //events @@ -274,8 +276,6 @@ void LogFrame::Settings(wxCommandEvent& WXUNUSED(event)) } wxDialog diag(this, wxID_ANY, "Settings", wxDefaultPosition); - static const u32 height = 400; - static const u32 width = 385; wxStaticBoxSizer* s_round_log_level = new wxStaticBoxSizer(wxVERTICAL, &diag, _("Log Level")); wxBoxSizer* s_panel = new wxBoxSizer(wxVERTICAL); diff --git a/rpcs3/Gui/ConLog.h b/rpcs3/Gui/ConLog.h index 90462a0bb1..678e76b5a4 100644 --- a/rpcs3/Gui/ConLog.h +++ b/rpcs3/Gui/ConLog.h @@ -23,7 +23,6 @@ public: return; std::string frmt = fmt::Format(fmt, std::forward(args)...); - WriteToLog("!", frmt, 2); } @@ -67,7 +66,7 @@ class LogFrame wxListView& m_log; public: - LogFrame(); + LogFrame(wxWindow *parent); ~LogFrame(); bool Close(bool force = false); diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 02626da024..efbde44432 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -103,7 +103,7 @@ MainFrame::MainFrame() // Panels m_game_viewer = new GameViewer(this); m_debugger_frame = new DebuggerPanel(this); - ConLogFrame = new LogFrame; + ConLogFrame = new LogFrame(this); AddPane(m_game_viewer, "Game List", wxAUI_DOCK_BOTTOM); AddPane(m_debugger_frame, "Debugger", wxAUI_DOCK_RIGHT); From 402199d70f13fbbb5fc76c619f6753bdfce1b261 Mon Sep 17 00:00:00 2001 From: O1L Date: Sun, 7 Sep 2014 17:47:53 +0400 Subject: [PATCH 4/5] Add PPU / SPU / RawSPU threads in KernelExplorer, and some coding style changes. --- rpcs3/Emu/CPU/CPUThread.h | 18 +++ rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp | 5 +- rpcs3/Gui/KernelExplorer.cpp | 126 +++++++++++++++++---- 3 files changed, 128 insertions(+), 21 deletions(-) diff --git a/rpcs3/Emu/CPU/CPUThread.h b/rpcs3/Emu/CPU/CPUThread.h index c9d716d553..92cf1b936a 100644 --- a/rpcs3/Emu/CPU/CPUThread.h +++ b/rpcs3/Emu/CPU/CPUThread.h @@ -93,6 +93,24 @@ public: return "Unknown"; } + std::string ThreadStatusToString() + { + switch (ThreadStatus()) + { + case CPUThread_Ready: return "Ready"; + case CPUThread_Running: return "Running"; + case CPUThread_Paused: return "Paused"; + case CPUThread_Stopped: return "Stopped"; + case CPUThread_Sleeping: return "Sleeping"; + case CPUThread_Break: return "Break"; + case CPUThread_Step: return "Step"; + + default: return "Unknown status"; + } + } + + + std::string GetTypeString() const { return CPUThreadTypeToString(m_type); } virtual std::string GetThreadName() const diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp index e4a7f96cff..b246d231e0 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp @@ -709,9 +709,12 @@ int cellHddGameCheck(u32 version, vm::ptr dirName, u32 errDialog, vm // TODO ? funcStat(result, get, set); - if (result->result != CELL_HDDGAME_CBRESULT_OK && + + /* + if (result->result != CELL_HDDGAME_CBRESULT_OK && // error on compiling in MVS. Needs to use LE byte order? result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL) return CELL_HDDGAME_ERROR_CBRESULT; + */ // TODO ? diff --git a/rpcs3/Gui/KernelExplorer.cpp b/rpcs3/Gui/KernelExplorer.cpp index 3e51442db1..fd2d80d40b 100644 --- a/rpcs3/Gui/KernelExplorer.cpp +++ b/rpcs3/Gui/KernelExplorer.cpp @@ -6,6 +6,9 @@ #include "Emu/IdManager.h" #include "KernelExplorer.h" +#include "Emu/CPU/CPUThreadManager.h" +#include "Emu/CPU/CPUThread.h" + KernelExplorer::KernelExplorer(wxWindow* parent) : wxFrame(parent, wxID_ANY, "Kernel Explorer", wxDefaultPosition, wxSize(700, 450)) { @@ -46,17 +49,17 @@ void KernelExplorer::Update() m_tree->DeleteAllItems(); const auto& root = m_tree->AddRoot("Process, ID = 0x00000001, Total Memory Usage = 0x???????? (???.? MB)"); - // TODO: PPU Threads - // TODO: SPU/RawSPU Threads // TODO: FileSystem // Semaphores count = Emu.GetIdManager().GetTypeCount(TYPE_SEMAPHORE); - if (count) { + if (count) + { sprintf(name, "Semaphores (%d)", count); const auto& node = m_tree->AppendItem(root, name); const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_SEMAPHORE); - for (const auto& id : objects) { + for (const auto& id : objects) + { sprintf(name, "Semaphore: ID = 0x%08x", id); m_tree->AppendItem(node, name); } @@ -64,11 +67,13 @@ void KernelExplorer::Update() // Mutexes count = Emu.GetIdManager().GetTypeCount(TYPE_MUTEX); - if (count) { + if (count) + { sprintf(name, "Mutexes (%d)", count); const auto& node = m_tree->AppendItem(root, name); const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_MUTEX); - for (const auto& id : objects) { + for (const auto& id : objects) + { sprintf(name, "Mutex: ID = 0x%08x", id); m_tree->AppendItem(node, name); } @@ -76,11 +81,13 @@ void KernelExplorer::Update() // Light Weight Mutexes count = Emu.GetIdManager().GetTypeCount(TYPE_LWMUTEX); - if (count) { + if (count) + { sprintf(name, "Light Weight Mutexes (%d)", count); const auto& node = m_tree->AppendItem(root, name); const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWMUTEX); - for (const auto& id : objects) { + for (const auto& id : objects) + { sprintf(name, "LW Mutex: ID = 0x%08x", id); m_tree->AppendItem(node, name); } @@ -88,11 +95,13 @@ void KernelExplorer::Update() // Condition Variables count = Emu.GetIdManager().GetTypeCount(TYPE_COND); - if (count) { + if (count) + { sprintf(name, "Condition Variables (%d)", count); const auto& node = m_tree->AppendItem(root, name); const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_COND); - for (const auto& id : objects) { + for (const auto& id : objects) + { sprintf(name, "Condition Variable: ID = 0x%08x", id); m_tree->AppendItem(node, name); } @@ -100,11 +109,13 @@ void KernelExplorer::Update() // Light Weight Condition Variables count = Emu.GetIdManager().GetTypeCount(TYPE_LWCOND); - if (count) { + if (count) + { sprintf(name, "Light Weight Condition Variables (%d)", count); const auto& node = m_tree->AppendItem(root, name); const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_LWCOND); - for (const auto& id : objects) { + for (const auto& id : objects) + { sprintf(name, "LW Condition Variable: ID = 0x%08x", id); m_tree->AppendItem(node, name); } @@ -112,11 +123,13 @@ void KernelExplorer::Update() // Event Queues count = Emu.GetIdManager().GetTypeCount(TYPE_EVENT_QUEUE); - if (count) { + if (count) + { sprintf(name, "Event Queues (%d)", count); const auto& node = m_tree->AppendItem(root, name); const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_EVENT_QUEUE); - for (const auto& id : objects) { + for (const auto& id : objects) + { sprintf(name, "Event Queue: ID = 0x%08x", id); m_tree->AppendItem(node, name); } @@ -124,13 +137,15 @@ void KernelExplorer::Update() // Modules count = Emu.GetIdManager().GetTypeCount(TYPE_PRX); - if (count) { + if (count) + { sprintf(name, "Modules (%d)", count); const auto& node = m_tree->AppendItem(root, name); const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_PRX); sprintf(name, "Segment List (%d)", 2 * objects.size()); // TODO: Assuming 2 segments per PRX file is not good m_tree->AppendItem(node, name); - for (const auto& id : objects) { + for (const auto& id : objects) + { sprintf(name, "PRX: ID = 0x%08x", id); m_tree->AppendItem(node, name); } @@ -138,27 +153,98 @@ void KernelExplorer::Update() // Memory Containers count = Emu.GetIdManager().GetTypeCount(TYPE_MEM); - if (count) { + if (count) + { sprintf(name, "Memory Containers (%d)", count); const auto& node = m_tree->AppendItem(root, name); const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_MEM); - for (const auto& id : objects) { + for (const auto& id : objects) + { sprintf(name, "Memory Container: ID = 0x%08x", id); m_tree->AppendItem(node, name); } } // Event Flags count = Emu.GetIdManager().GetTypeCount(TYPE_EVENT_FLAG); - if (count) { + if (count) + { sprintf(name, "Event Flags (%d)", count); const auto& node = m_tree->AppendItem(root, name); const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_EVENT_FLAG); - for (const auto& id : objects) { + for (const auto& id : objects) + { sprintf(name, "Event Flag: ID = 0x%08x", id); m_tree->AppendItem(node, name); } } + // PPU / SPU / RawSPU threads + { + // TODO: add mutexes owners + + const auto& objects = Emu.GetCPU().GetThreads(); + u32 ppu_threads_count = 0; + u32 spu_threads_count = 0; + u32 raw_spu_threads_count = 0; + for (const auto& thread : objects) + { + if (thread->GetType() == CPU_THREAD_PPU) + ppu_threads_count++; + + if (thread->GetType() == CPU_THREAD_SPU) + spu_threads_count++; + + if (thread->GetType() == CPU_THREAD_RAW_SPU) + raw_spu_threads_count++; + } + + if (ppu_threads_count) + { + sprintf(name, "PPU Threads (%d)", ppu_threads_count); + const auto& node = m_tree->AppendItem(root, name); + + for (const auto& thread : objects) + { + if (thread->GetType() == CPU_THREAD_PPU) + { + sprintf(name, "Thread: ID = 0x%08x ''%s'', - %s", thread->GetId(), thread->GetName().c_str(), thread->ThreadStatusToString().c_str()); + m_tree->AppendItem(node, name); + } + } + } + + if (spu_threads_count) + { + sprintf(name, "SPU Threads (%d)", spu_threads_count); + const auto& node = m_tree->AppendItem(root, name); + + for (const auto& thread : objects) + { + if (thread->GetType() == CPU_THREAD_SPU) + { + sprintf(name, "Thread: ID = 0x%08x ''%s'', - %s", thread->GetId(), thread->GetName().c_str(), thread->ThreadStatusToString().c_str()); + m_tree->AppendItem(node, name); + } + } + } + + if (raw_spu_threads_count) + { + sprintf(name, "RawSPU Threads (%d)", raw_spu_threads_count); + const auto& node = m_tree->AppendItem(root, name); + + for (const auto& thread : objects) + { + if (thread->GetType() == CPU_THREAD_RAW_SPU) + { + sprintf(name, "Thread: ID = 0x%08x ''%s'', - %s", thread->GetId(), thread->GetName().c_str(), thread->ThreadStatusToString().c_str()); + m_tree->AppendItem(node, name); + } + } + } + + } + m_tree->Expand(root); } From 54106f6f9ba30fa7185f28ec9d17491702c71c6c Mon Sep 17 00:00:00 2001 From: O1L Date: Sun, 7 Sep 2014 18:05:29 +0400 Subject: [PATCH 5/5] Removed unnecessary newlines. --- rpcs3/Emu/CPU/CPUThread.h | 2 -- rpcs3/Gui/KernelExplorer.cpp | 1 - 2 files changed, 3 deletions(-) diff --git a/rpcs3/Emu/CPU/CPUThread.h b/rpcs3/Emu/CPU/CPUThread.h index 92cf1b936a..0610219e8e 100644 --- a/rpcs3/Emu/CPU/CPUThread.h +++ b/rpcs3/Emu/CPU/CPUThread.h @@ -109,8 +109,6 @@ public: } } - - std::string GetTypeString() const { return CPUThreadTypeToString(m_type); } virtual std::string GetThreadName() const diff --git a/rpcs3/Gui/KernelExplorer.cpp b/rpcs3/Gui/KernelExplorer.cpp index fd2d80d40b..8db3a4a7b8 100644 --- a/rpcs3/Gui/KernelExplorer.cpp +++ b/rpcs3/Gui/KernelExplorer.cpp @@ -5,7 +5,6 @@ #include "Emu/IdManager.h" #include "KernelExplorer.h" - #include "Emu/CPU/CPUThreadManager.h" #include "Emu/CPU/CPUThread.h"