From cd10dca71fd4df4594fb141f2d3b95693b5d0e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandro=20S=C3=A1nchez=20Bach?= Date: Thu, 27 Feb 2014 04:21:08 +0100 Subject: [PATCH 1/3] RPCS3 arguments, TTY to file & sceNpTrophy stuff --- rpcs3/Emu/DbgConsole.cpp | 14 ++++++++++++++ rpcs3/Emu/DbgConsole.h | 1 + rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp | 15 +++++++++++++-- rpcs3/Gui/MainFrame.cpp | 4 ++++ rpcs3/Ini.h | 4 ++++ rpcs3/rpcs3.cpp | 16 ++++++++++++++++ rpcs3/rpcs3.h | 3 ++- 7 files changed, 54 insertions(+), 3 deletions(-) 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); From 7f7ad1b66126a4e057324b6c360a4591d9f30c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandro=20S=C3=A1nchez=20Bach?= Date: Fri, 28 Feb 2014 04:48:20 +0100 Subject: [PATCH 2/3] Few functions added * sceNpManagerGetStatus * sys_mmapper_free_memory * Minor changes in sys_mmapper_allocate_memory * Changed the layout of the sys_vm functions in SysCalls.cpp --- rpcs3/Emu/SysCalls/Modules/sceNp.cpp | 16 +++++++-- rpcs3/Emu/SysCalls/Modules/sceNp.h | 36 +++++++++++++++++++- rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp | 1 + rpcs3/Emu/SysCalls/SysCalls.cpp | 17 +++++++-- rpcs3/Emu/SysCalls/SysCalls.h | 1 + rpcs3/Emu/SysCalls/lv2/SC_Memory.cpp | 19 ++++++++--- 6 files changed, 80 insertions(+), 10 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp index 5b6a955daf..3732beb5f1 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp @@ -1,4 +1,3 @@ -#if 0 #include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" @@ -8,7 +7,20 @@ void sceNp_init(); Module sceNp(0x0016, sceNp_init); +int sceNpManagerGetStatus(mem32_t status) +{ + sceNp.Log("sceNpManagerGetStatus(status_addr=0x%x)", status.GetAddr()); + + // TODO: Check if sceNpInit() was called, if not return SCE_NP_ERROR_NOT_INITIALIZED + if (!status.IsGood()) + return SCE_NP_ERROR_INVALID_ARGUMENT; + + // TODO: Support different statuses + status = SCE_NP_MANAGER_STATUS_OFFLINE; + return CELL_OK; +} + void sceNp_init() { + sceNp.AddFunc(0xa7bff757, sceNpManagerGetStatus); } -#endif diff --git a/rpcs3/Emu/SysCalls/Modules/sceNp.h b/rpcs3/Emu/SysCalls/Modules/sceNp.h index b140316963..da5fd62d34 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNp.h +++ b/rpcs3/Emu/SysCalls/Modules/sceNp.h @@ -1,8 +1,42 @@ #pragma once -// Return Codes +// Error Codes enum { + // NP Manager Utility + SCE_NP_ERROR_NOT_INITIALIZED = 0x8002aa01, + SCE_NP_ERROR_ALREADY_INITIALIZED = 0x8002aa02, + SCE_NP_ERROR_INVALID_ARGUMENT = 0x8002aa03, + SCE_NP_ERROR_OUT_OF_MEMORY = 0x8002aa04, + SCE_NP_ERROR_ID_NO_SPACE = 0x8002aa05, + SCE_NP_ERROR_ID_NOT_FOUND = 0x8002aa06, + SCE_NP_ERROR_SESSION_RUNNING = 0x8002aa07, + SCE_NP_ERROR_LOGINID_ALREADY_EXISTS = 0x8002aa08, + SCE_NP_ERROR_INVALID_TICKET_SIZE = 0x8002aa09, + SCE_NP_ERROR_INVALID_STATE = 0x8002aa0a, + SCE_NP_ERROR_ABORTED = 0x8002aa0b, + SCE_NP_ERROR_OFFLINE = 0x8002aa0c, + SCE_NP_ERROR_VARIANT_ACCOUNT_ID = 0x8002aa0d, + SCE_NP_ERROR_GET_CLOCK = 0x8002aa0e, + SCE_NP_ERROR_INSUFFICIENT_BUFFER = 0x8002aa0f, + SCE_NP_ERROR_EXPIRED_TICKET = 0x8002aa10, + SCE_NP_ERROR_TICKET_PARAM_NOT_FOUND = 0x8002aa11, + SCE_NP_ERROR_UNSUPPORTED_TICKET_VERSION = 0x8002aa12, + SCE_NP_ERROR_TICKET_STATUS_CODE_INVALID = 0x8002aa13, + SCE_NP_ERROR_INVALID_TICKET_VERSION = 0x8002aa14, + SCE_NP_ERROR_ALREADY_USED = 0x8002aa15, + SCE_NP_ERROR_DIFFERENT_USER = 0x8002aa16, + SCE_NP_ERROR_ALREADY_DONE = 0x8002aa17, +}; + +// NP Manager Utility: Status +enum +{ + SCE_NP_MANAGER_STATUS_OFFLINE = -1, + SCE_NP_MANAGER_STATUS_GETTING_TICKET = 0, + SCE_NP_MANAGER_STATUS_GETTING_PROFILE = 1, + SCE_NP_MANAGER_STATUS_LOGGING_IN = 2, + SCE_NP_MANAGER_STATUS_ONLINE = 3, }; enum diff --git a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp index 9a3c233faa..7560c1f37f 100644 --- a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp @@ -168,6 +168,7 @@ void sysPrxForUser_init() sysPrxForUser.AddFunc(0xb257540b, sys_mmapper_allocate_memory); sysPrxForUser.AddFunc(0xdc578057, sys_mmapper_map_memory); + sysPrxForUser.AddFunc(0x409ad939, sys_mmapper_free_memory); sysPrxForUser.AddFunc(0x1ed454ce, sys_spu_elf_get_information); sysPrxForUser.AddFunc(0xdb6b3250, sys_spu_elf_get_segments); diff --git a/rpcs3/Emu/SysCalls/SysCalls.cpp b/rpcs3/Emu/SysCalls/SysCalls.cpp index 4014f859d2..aad96f9329 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.cpp +++ b/rpcs3/Emu/SysCalls/SysCalls.cpp @@ -133,9 +133,20 @@ static func_caller* sc_table[1024] = null_func, null_func, null_func, null_func, null_func, //289 null_func, null_func, null_func, null_func, null_func, //294 null_func, null_func, null_func, null_func, null_func, //299 - bind_func(sys_vm_memory_map), bind_func(sys_vm_unmap), bind_func(sys_vm_append_memory), bind_func(sys_vm_return_memory), bind_func(sys_vm_lock), //304 - bind_func(sys_vm_unlock), bind_func(sys_vm_touch), bind_func(sys_vm_flush), bind_func(sys_vm_invalidate), bind_func(sys_vm_store), //309 - bind_func(sys_vm_sync), bind_func(sys_vm_test), bind_func(sys_vm_get_statistics), null_func, null_func, //314 + bind_func(sys_vm_memory_map), //300 (0x12C) + bind_func(sys_vm_unmap), //301 (0x12D) + bind_func(sys_vm_append_memory), //302 (0x12E) + bind_func(sys_vm_return_memory), //303 (0x12F) + bind_func(sys_vm_lock), //304 (0x130) + bind_func(sys_vm_unlock), //305 (0x131) + bind_func(sys_vm_touch), //306 (0x132) + bind_func(sys_vm_flush), //307 (0x133) + bind_func(sys_vm_invalidate), //308 (0x134) + bind_func(sys_vm_store), //309 (0x135) + bind_func(sys_vm_sync), //310 (0x136) + bind_func(sys_vm_test), //311 (0x137) + bind_func(sys_vm_get_statistics), //312 (0x138) + null_func, null_func, //314 null_func, null_func, null_func, null_func, null_func, //319 null_func, null_func, null_func, null_func, bind_func(sys_memory_container_create), //324 bind_func(sys_memory_container_destroy), null_func, null_func, null_func, null_func, //329 diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index 37149bde17..0bfc4c09a4 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -225,6 +225,7 @@ extern int sys_memory_get_page_attribute(u32 addr, mem_ptr_t a) extern int sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_addr); extern int sys_mmapper_allocate_memory(u32 size, u64 flags, u32 mem_id_addr); extern int sys_mmapper_map_memory(u32 start_addr, u32 mem_id, u64 flags); +extern int sys_mmapper_free_memory(u32 mem_id); //vm extern int sys_vm_memory_map(u32 vsize, u32 psize, u32 cid, u64 flag, u64 policy, u32 addr); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Memory.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Memory.cpp index 32f623c6e9..04e2c958d3 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Memory.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Memory.cpp @@ -109,11 +109,11 @@ int sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_a return CELL_OK; } -int sys_mmapper_allocate_memory(u32 size, u64 flags, u32 mem_id_addr) +int sys_mmapper_allocate_memory(u32 size, u64 flags, mem32_t mem_id) { - sc_mem.Warning("sys_mmapper_allocate_memory(size=0x%x, flags=0x%llx, mem_id_addr=0x%x)", size, flags, mem_id_addr); + sc_mem.Warning("sys_mmapper_allocate_memory(size=0x%x, flags=0x%llx, mem_id_addr=0x%x)", size, flags, mem_id.GetAddr()); - if(!Memory.IsGoodAddr(mem_id_addr)) return CELL_EFAULT; + if(!mem_id.IsGood()) return CELL_EFAULT; u32 addr; switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K)) @@ -135,7 +135,7 @@ int sys_mmapper_allocate_memory(u32 size, u64 flags, u32 mem_id_addr) if(!addr) return CELL_ENOMEM; - Memory.Write32(mem_id_addr, sc_mem.GetNewId(new mmapper_info(addr, size, flags))); + mem_id = sc_mem.GetNewId(new mmapper_info(addr, size, flags)); return CELL_OK; } @@ -155,6 +155,17 @@ int sys_mmapper_map_memory(u32 start_addr, u32 mem_id, u64 flags) return CELL_OK; } +int sys_mmapper_free_memory(u32 mem_id) +{ + sc_mem.Warning("sys_mmapper_free_memory(mem_id=0x%x)", mem_id); + + mmapper_info* info; + if(!sc_mem.CheckId(mem_id, info)) return CELL_ESRCH; + + Memory.Free(info->addr); + return CELL_OK; +} + int sys_memory_get_user_memory_size(u32 mem_info_addr) { sc_mem.Warning("sys_memory_get_user_memory_size(mem_info_addr=0x%x)", mem_info_addr); From 6c28753dae993b4cb5d0d7767297489205c24a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandro=20S=C3=A1nchez=20Bach?= Date: Sat, 1 Mar 2014 19:11:58 +0100 Subject: [PATCH 3/3] Minor fixes: SPU, sys_mmapper, and cmd-line args. * Some SPU instructions updated: - Updated wrong instructions: SHLH, FRDS - Added UNIMPLEMENTED warning to: HBR, HBRA, HBRR * Updated sys_mmapper_allocate_memory declaration in SysCalls.h * Added sceNp.cpp to project * Added checkbox in the Settings menu for exiting RPCS3 when sys_process_exit (SC_Process.cpp) is called. Unfortunately, due to some problems, this checkbox doesn't have a real effect yet. --- rpcs3/Emu/Cell/SPUInterpreter.h | 9 ++++++--- rpcs3/Emu/SysCalls/SysCalls.h | 2 +- rpcs3/Emu/SysCalls/lv2/SC_Process.cpp | 6 ++++++ rpcs3/Gui/MainFrame.cpp | 6 +++++- rpcs3/Ini.h | 4 ++++ rpcs3/rpcs3.cpp | 3 +++ rpcs3/rpcs3.vcxproj | 1 + rpcs3/rpcs3.vcxproj.filters | 3 +++ 8 files changed, 29 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/Cell/SPUInterpreter.h b/rpcs3/Emu/Cell/SPUInterpreter.h index d90e8e0bed..57196d10d7 100644 --- a/rpcs3/Emu/Cell/SPUInterpreter.h +++ b/rpcs3/Emu/Cell/SPUInterpreter.h @@ -244,7 +244,7 @@ private: void SHLH(u32 rt, u32 ra, u32 rb) { for (int h = 0; h < 8; h++) - CPU.GPR[rt]._u16[h] = (CPU.GPR[rb]._u16[h] & 0x1f) > 15 ? 0 : CPU.GPR[ra]._u16[h] << (CPU.GPR[rb]._u16[h] & 0x3f); + CPU.GPR[rt]._u16[h] = (CPU.GPR[rb]._u16[h] & 0x1f) > 15 ? 0 : CPU.GPR[ra]._u16[h] << (CPU.GPR[rb]._u16[h] & 0x1f); } void ROTI(u32 rt, u32 ra, s32 i7) { @@ -413,6 +413,7 @@ private: } void HBR(u32 p, u32 ro, u32 ra) { + UNIMPLEMENTED(); } void GB(u32 rt, u32 ra) { @@ -558,7 +559,7 @@ private: CPU.GPR[rt]._u32[0] = (temp._u32[0] >> t) | (temp._u32[1] << (32 - t)); CPU.GPR[rt]._u32[1] = (temp._u32[1] >> t) | (temp._u32[2] << (32 - t)); CPU.GPR[rt]._u32[2] = (temp._u32[2] >> t) | (temp._u32[3] << (32 - t)); - CPU.GPR[rt]._u32[3] = (CPU.GPR[ra]._u32[3] >> t); + CPU.GPR[rt]._u32[3] = (temp._u32[3] >> t); } void SHLQBI(u32 rt, u32 ra, u32 rb) { @@ -934,7 +935,7 @@ private: CPU.GPR[rt]._f[1] = (float)CPU.GPR[ra]._d[0]; CPU.GPR[rt]._u32[0] = 0x00000000; CPU.GPR[rt]._f[3] = (float)CPU.GPR[ra]._d[1]; - CPU.GPR[rt]._u32[1] = 0x00000000; + CPU.GPR[rt]._u32[2] = 0x00000000; } void FSCRWR(u32 rt, u32 ra) { @@ -1430,9 +1431,11 @@ private: //0 - 6 void HBRA(s32 ro, s32 i16) { //i16 is shifted left by 2 while decoding + UNIMPLEMENTED(); } void HBRR(s32 ro, s32 i16) { + UNIMPLEMENTED(); } void ILA(u32 rt, u32 i18) { diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index 0bfc4c09a4..d4f052fcde 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -223,7 +223,7 @@ extern int sys_memory_free(u32 start_addr); extern int sys_memory_get_user_memory_size(u32 mem_info_addr); extern int sys_memory_get_page_attribute(u32 addr, mem_ptr_t a); extern int sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_addr); -extern int sys_mmapper_allocate_memory(u32 size, u64 flags, u32 mem_id_addr); +extern int sys_mmapper_allocate_memory(u32 size, u64 flags, mem32_t mem_id); extern int sys_mmapper_map_memory(u32 start_addr, u32 mem_id, u64 flags); extern int sys_mmapper_free_memory(u32 mem_id); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp index 031686f098..f64907ce88 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp @@ -42,6 +42,12 @@ int sys_process_exit(int errorcode) sc_p.Warning("sys_process_exit(%d)", errorcode); Emu.Pause(); // Emu.Stop() does crash ConLog.Success("Process finished"); + + if (Ini.HLEExitOnStop.GetValue()) + { + Ini.HLEExitOnStop.SetValue(false); + // TODO: Find a way of calling Emu.Stop() and/or exiting RPCS3 (that is, TheApp->Exit()) without crashes + } return CELL_OK; } diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 33dd5ccb8a..e37799a3c5 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -345,7 +345,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) wxStaticBoxSizer* s_round_audio( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Audio") ) ); wxStaticBoxSizer* s_round_audio_out( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Audio Out") ) ); - wxStaticBoxSizer* s_round_hle( new wxStaticBoxSizer( wxVERTICAL, &diag, _("HLE") ) ); + wxStaticBoxSizer* s_round_hle( new wxStaticBoxSizer( wxVERTICAL, &diag, _("HLE / Misc.") ) ); wxComboBox* cbox_cpu_decoder = new wxComboBox(&diag, wxID_ANY); wxComboBox* cbox_gs_render = new wxComboBox(&diag, wxID_ANY); @@ -364,6 +364,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) 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"); + wxCheckBox* chbox_hle_exitonstop = new wxCheckBox(&diag, wxID_ANY, "Exit RPCS3 when process finishes"); //cbox_cpu_decoder->Append("DisAsm"); cbox_cpu_decoder->Append("Interpreter & DisAsm"); @@ -403,6 +404,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) chbox_audio_dump->SetValue(Ini.AudioDumpToFile.GetValue()); chbox_hle_logging->SetValue(Ini.HLELogging.GetValue()); chbox_hle_savetty->SetValue(Ini.HLESaveTTY.GetValue()); + chbox_hle_exitonstop->SetValue(Ini.HLEExitOnStop.GetValue()); chbox_audio_dump->Enable(Emu.IsStopped()); chbox_hle_logging->Enable(Emu.IsStopped()); @@ -444,6 +446,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) s_round_hle->Add(chbox_hle_logging, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_hle->Add(chbox_hle_savetty, wxSizerFlags().Border(wxALL, 5).Expand()); + s_round_hle->Add(chbox_hle_exitonstop, wxSizerFlags().Border(wxALL, 5).Expand()); wxBoxSizer* s_b_panel(new wxBoxSizer(wxHORIZONTAL)); @@ -482,6 +485,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) Ini.AudioDumpToFile.SetValue(chbox_audio_dump->GetValue()); Ini.HLELogging.SetValue(chbox_hle_logging->GetValue()); Ini.HLESaveTTY.SetValue(chbox_hle_savetty->GetValue()); + Ini.HLEExitOnStop.SetValue(chbox_hle_exitonstop->GetValue()); Ini.Save(); } diff --git a/rpcs3/Ini.h b/rpcs3/Ini.h index cb9dad8111..940e9e876a 100644 --- a/rpcs3/Ini.h +++ b/rpcs3/Ini.h @@ -108,6 +108,7 @@ public: IniEntry AudioDumpToFile; IniEntry HLELogging; IniEntry HLESaveTTY; + IniEntry HLEExitOnStop; IniEntry PadHandlerLeft; IniEntry PadHandlerDown; @@ -174,6 +175,7 @@ public: path = DefPath + "\\" + "HLE"; HLELogging.Init("HLELogging", path); HLESaveTTY.Init("HLESaveTTY", path); + HLEExitOnStop.Init("HLEExitOnStop", path); } void Load() @@ -194,6 +196,7 @@ public: AudioDumpToFile.Load(0); HLELogging.Load(false); HLESaveTTY.Load(false); + HLEExitOnStop.Load(false); PadHandlerLeft.Load(static_cast('A')); PadHandlerDown.Load(static_cast('S')); @@ -231,6 +234,7 @@ public: AudioDumpToFile.Save(); HLELogging.Save(); HLESaveTTY.Save(); + HLEExitOnStop.Save(); PadHandlerLeft.Save(); PadHandlerDown.Save(); diff --git a/rpcs3/rpcs3.cpp b/rpcs3/rpcs3.cpp index 8a3dd7b007..5d0c941318 100644 --- a/rpcs3/rpcs3.cpp +++ b/rpcs3/rpcs3.cpp @@ -40,6 +40,9 @@ void Rpcs3App::OnArguments() if (Rpcs3App::argc > 1) { + // Force this value to be true + Ini.HLEExitOnStop.SetValue(true); + Emu.SetPath(argv[1]); Emu.Load(); Emu.Run(); diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 7946c3f2db..e26b99909b 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -298,6 +298,7 @@ + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 93b68d3de7..94f355e832 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -418,6 +418,9 @@ Loader + + Emu\SysCalls\Modules +