Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Aishou 2014-03-01 19:59:36 +01:00
commit e0d3f1cae6
17 changed files with 163 additions and 18 deletions

View File

@ -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)
{

View File

@ -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();
}

View File

@ -72,6 +72,7 @@ class DbgConsole
: public FrameBase
, public ThreadBase
{
wxFile* m_output;
wxTextCtrl* m_console;
wxTextAttr* m_color_white;
wxTextAttr* m_color_red;

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -223,8 +223,9 @@ 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<sys_page_attr_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);
//vm
extern int sys_vm_memory_map(u32 vsize, u32 psize, u32 cid, u64 flag, u64 policy, u32 addr);

View File

@ -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);

View File

@ -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;
}

View File

@ -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);
@ -363,6 +363,8 @@ 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");
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");
@ -401,6 +403,8 @@ 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_hle_exitonstop->SetValue(Ini.HLEExitOnStop.GetValue());
chbox_audio_dump->Enable(Emu.IsStopped());
chbox_hle_logging->Enable(Emu.IsStopped());
@ -441,6 +445,8 @@ 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());
s_round_hle->Add(chbox_hle_exitonstop, wxSizerFlags().Border(wxALL, 5).Expand());
wxBoxSizer* s_b_panel(new wxBoxSizer(wxHORIZONTAL));
@ -478,6 +484,8 @@ 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.HLEExitOnStop.SetValue(chbox_hle_exitonstop->GetValue());
Ini.Save();
}

View File

@ -107,6 +107,8 @@ public:
IniEntry<u8> AudioOutMode;
IniEntry<bool> AudioDumpToFile;
IniEntry<bool> HLELogging;
IniEntry<bool> HLESaveTTY;
IniEntry<bool> HLEExitOnStop;
IniEntry<int> PadHandlerLeft;
IniEntry<int> PadHandlerDown;
@ -172,6 +174,8 @@ public:
path = DefPath + "\\" + "HLE";
HLELogging.Init("HLELogging", path);
HLESaveTTY.Init("HLESaveTTY", path);
HLEExitOnStop.Init("HLEExitOnStop", path);
}
void Load()
@ -191,6 +195,8 @@ public:
AudioOutMode.Load(0);
AudioDumpToFile.Load(0);
HLELogging.Load(false);
HLESaveTTY.Load(false);
HLEExitOnStop.Load(false);
PadHandlerLeft.Load(static_cast<int>('A'));
PadHandlerDown.Load(static_cast<int>('S'));
@ -227,6 +233,8 @@ public:
AudioOutMode.Save();
AudioDumpToFile.Save();
HLELogging.Save();
HLESaveTTY.Save();
HLEExitOnStop.Save();
PadHandlerLeft.Save();
PadHandlerDown.Save();

View File

@ -27,9 +27,28 @@ 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)
{
// Force this value to be true
Ini.HLEExitOnStop.SetValue(true);
Emu.SetPath(argv[1]);
Emu.Load();
Emu.Run();
}
}
void Rpcs3App::Exit()
{
Emu.Stop();

View File

@ -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);

View File

@ -298,6 +298,7 @@
<ClCompile Include="Emu\SysCalls\Modules\cellSysutilAp.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellVdec.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellVpost.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\sceNp.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\sceNpTrophy.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\sysPrxForUser.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\sys_fs.cpp" />

View File

@ -418,6 +418,9 @@
<ClCompile Include="Loader\PKG.cpp">
<Filter>Loader</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\sceNp.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="rpcs3.rc" />