diff --git a/rpcs3/Emu/DbgConsole.cpp b/rpcs3/Emu/DbgConsole.cpp index 560ce4b353..d731b8009d 100644 --- a/rpcs3/Emu/DbgConsole.cpp +++ b/rpcs3/Emu/DbgConsole.cpp @@ -8,6 +8,7 @@ END_EVENT_TABLE() DbgConsole::DbgConsole() : FrameBase(nullptr, wxID_ANY, "DbgConsole", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxDEFAULT_FRAME_STYLE, true) , ThreadBase("DbgConsole thread") + , m_output(nullptr) { m_console = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(500, 500), wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2); @@ -16,6 +17,9 @@ DbgConsole::DbgConsole() m_color_white = new wxTextAttr(wxColour(255, 255, 255)); m_color_red = new wxTextAttr(wxColour(255, 0, 0)); + + if (Ini.HLESaveTTY.GetValue()) + m_output = new wxFile("tty.log", wxFile::write); } DbgConsole::~DbgConsole() @@ -52,6 +56,9 @@ void DbgConsole::Task() m_console->SetInsertionPointEnd(); m_console->WriteText(packet.m_text); + if (m_output && Ini.HLESaveTTY.GetValue()) + m_output->Write(packet.m_text); + if(!DbgConsole::IsShown()) Show(); } } @@ -60,5 +67,12 @@ void DbgConsole::OnQuit(wxCloseEvent& event) { ThreadBase::Stop(false); Hide(); + + if (m_output) + { + m_output->Close(); + m_output = nullptr; + } + //event.Skip(); } \ No newline at end of file diff --git a/rpcs3/Emu/DbgConsole.h b/rpcs3/Emu/DbgConsole.h index b36e7929fb..31f3d69038 100644 --- a/rpcs3/Emu/DbgConsole.h +++ b/rpcs3/Emu/DbgConsole.h @@ -72,6 +72,7 @@ class DbgConsole : public FrameBase , public ThreadBase { + wxFile* m_output; wxTextCtrl* m_console; wxTextAttr* m_color_white; wxTextAttr* m_color_red; diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp index a5ada78529..d889553017 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp @@ -188,9 +188,20 @@ int sceNpTrophySetSoundLevel() return CELL_OK; } -int sceNpTrophyGetRequiredDiskSpace() +int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, mem64_t reqspace, u64 options) { - UNIMPLEMENTED_FUNC(sceNpTrophy); + sceNpTrophy.Warning("sceNpTrophyGetRequiredDiskSpace(context=%d, handle=%d, reqspace_addr=0x%x, options=0x%llx)", + context, handle, reqspace.GetAddr(), options); + + if (!s_npTrophyInstance.m_bInitialized) + return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; + if (!reqspace.IsGood()) + return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT; + // TODO: There are other possible errors + + sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context]; + reqspace = ctxt.trp_stream->GetSize(); // TODO: This is not accurate. It's just an approximation of the real value + return CELL_OK; } diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 7a82da8cd6..33dd5ccb8a 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -363,6 +363,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) wxCheckBox* chbox_gs_vsync = new wxCheckBox(&diag, wxID_ANY, "VSync"); wxCheckBox* chbox_audio_dump = new wxCheckBox(&diag, wxID_ANY, "Dump to file"); wxCheckBox* chbox_hle_logging = new wxCheckBox(&diag, wxID_ANY, "Log all SysCalls"); + wxCheckBox* chbox_hle_savetty = new wxCheckBox(&diag, wxID_ANY, "Save TTY output to file"); //cbox_cpu_decoder->Append("DisAsm"); cbox_cpu_decoder->Append("Interpreter & DisAsm"); @@ -401,6 +402,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) chbox_gs_vsync->SetValue(Ini.GSVSyncEnable.GetValue()); chbox_audio_dump->SetValue(Ini.AudioDumpToFile.GetValue()); chbox_hle_logging->SetValue(Ini.HLELogging.GetValue()); + chbox_hle_savetty->SetValue(Ini.HLESaveTTY.GetValue()); chbox_audio_dump->Enable(Emu.IsStopped()); chbox_hle_logging->Enable(Emu.IsStopped()); @@ -441,6 +443,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) s_round_audio->Add(s_round_audio_out, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_hle->Add(chbox_hle_logging, wxSizerFlags().Border(wxALL, 5).Expand()); + s_round_hle->Add(chbox_hle_savetty, wxSizerFlags().Border(wxALL, 5).Expand()); wxBoxSizer* s_b_panel(new wxBoxSizer(wxHORIZONTAL)); @@ -478,6 +481,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) Ini.AudioOutMode.SetValue(cbox_audio_out->GetSelection()); Ini.AudioDumpToFile.SetValue(chbox_audio_dump->GetValue()); Ini.HLELogging.SetValue(chbox_hle_logging->GetValue()); + Ini.HLESaveTTY.SetValue(chbox_hle_savetty->GetValue()); Ini.Save(); } diff --git a/rpcs3/Ini.h b/rpcs3/Ini.h index db7ec83fb2..cb9dad8111 100644 --- a/rpcs3/Ini.h +++ b/rpcs3/Ini.h @@ -107,6 +107,7 @@ public: IniEntry AudioOutMode; IniEntry AudioDumpToFile; IniEntry HLELogging; + IniEntry HLESaveTTY; IniEntry PadHandlerLeft; IniEntry PadHandlerDown; @@ -172,6 +173,7 @@ public: path = DefPath + "\\" + "HLE"; HLELogging.Init("HLELogging", path); + HLESaveTTY.Init("HLESaveTTY", path); } void Load() @@ -191,6 +193,7 @@ public: AudioOutMode.Load(0); AudioDumpToFile.Load(0); HLELogging.Load(false); + HLESaveTTY.Load(false); PadHandlerLeft.Load(static_cast('A')); PadHandlerDown.Load(static_cast('S')); @@ -227,6 +230,7 @@ public: AudioOutMode.Save(); AudioDumpToFile.Save(); HLELogging.Save(); + HLESaveTTY.Save(); PadHandlerLeft.Save(); PadHandlerDown.Save(); diff --git a/rpcs3/rpcs3.cpp b/rpcs3/rpcs3.cpp index 3ecc343150..8a3dd7b007 100644 --- a/rpcs3/rpcs3.cpp +++ b/rpcs3/rpcs3.cpp @@ -27,9 +27,25 @@ bool Rpcs3App::OnInit() m_MainFrame->Show(); m_MainFrame->DoSettings(true); + OnArguments(); + return true; } +void Rpcs3App::OnArguments() +{ + // Usage: + // rpcs3-*.exe Initializes RPCS3 + // rpcs3-*.exe [(S)ELF] Initializes RPCS3, then loads and runs the specified (S)ELF file. + + if (Rpcs3App::argc > 1) + { + Emu.SetPath(argv[1]); + Emu.Load(); + Emu.Run(); + } +} + void Rpcs3App::Exit() { Emu.Stop(); diff --git a/rpcs3/rpcs3.h b/rpcs3/rpcs3.h index 876c931e0b..3a247b5bec 100644 --- a/rpcs3/rpcs3.h +++ b/rpcs3/rpcs3.h @@ -54,7 +54,8 @@ class Rpcs3App : public wxApp public: MainFrame* m_MainFrame; - virtual bool OnInit(); + virtual bool OnInit(); // RPCS3's entry point + virtual void OnArguments(); // Handle arguments: Rpcs3App::argc, Rpcs3App::argv virtual void Exit(); void SendDbgCommand(DbgCommand id, CPUThread* thr=nullptr);