diff --git a/rpcs3/Emu/Audio/cellAudio.h b/rpcs3/Emu/Audio/cellAudio.h index b448dcfe16..b6cabcea59 100644 --- a/rpcs3/Emu/Audio/cellAudio.h +++ b/rpcs3/Emu/Audio/cellAudio.h @@ -84,6 +84,7 @@ struct AudioPortConfig u64 counter; // copy of global counter u32 addr; u32 read_index_addr; + u32 size; }; struct AudioConfig //custom structure diff --git a/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp b/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp index 984aa82eee..3a94706acc 100644 --- a/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp +++ b/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp @@ -491,10 +491,10 @@ void GLFragmentDecompilerThread::Task() case RSX_FP_OPCODE_DDY: SetDst("dFdy($0)"); break; case RSX_FP_OPCODE_NRM: SetDst("normalize($0)"); break; case RSX_FP_OPCODE_TEX: SetDst("texture($t, $0.xy)"); break; - case RSX_FP_OPCODE_TXP: LOG_ERROR(RSX, "Unimplemented TEX_SRB instruction: TXP"); break; + case RSX_FP_OPCODE_TXP: LOG_ERROR(RSX, "TEX_SRB texture projection used. Please report this to a RPCS3 developer!"); SetDst("textureProj($t, $0.xy, $1)"); break; //TODO: Test this case RSX_FP_OPCODE_TXD: LOG_ERROR(RSX, "Unimplemented TEX_SRB instruction: TXD"); break; - case RSX_FP_OPCODE_TXB: LOG_ERROR(RSX, "Unimplemented TEX_SRB instruction: TXB"); break; - case RSX_FP_OPCODE_TXL: LOG_ERROR(RSX, "Unimplemented TEX_SRB instruction: TXL"); break; + case RSX_FP_OPCODE_TXB: SetDst("texture($t, $0.xy, $1.x)"); break; + case RSX_FP_OPCODE_TXL: SetDst("textureLod($t, $0.xy, $1.x)"); break; case RSX_FP_OPCODE_UP2: LOG_ERROR(RSX, "Unimplemented TEX_SRB instruction: UP2"); break; case RSX_FP_OPCODE_UP4: LOG_ERROR(RSX, "Unimplemented TEX_SRB instruction: UP4"); break; case RSX_FP_OPCODE_UP16: LOG_ERROR(RSX, "Unimplemented TEX_SRB instruction: UP16"); break; diff --git a/rpcs3/Emu/RSX/RSXFragmentProgram.h b/rpcs3/Emu/RSX/RSXFragmentProgram.h index 970d4a5727..70b17b8768 100644 --- a/rpcs3/Emu/RSX/RSXFragmentProgram.h +++ b/rpcs3/Emu/RSX/RSXFragmentProgram.h @@ -49,7 +49,7 @@ enum RSX_FP_OPCODE_PKG = 0x2C, // Pack with sRGB transformation RSX_FP_OPCODE_UPG = 0x2D, // Unpack gamma RSX_FP_OPCODE_DP2A = 0x2E, // 2-component dot product with scalar addition - RSX_FP_OPCODE_TXL = 0x2F, // Texture sample with LOD + RSX_FP_OPCODE_TXL = 0x2F, // Texture sample with explicit LOD RSX_FP_OPCODE_TXB = 0x31, // Texture sample with bias RSX_FP_OPCODE_TEXBEM = 0x33, RSX_FP_OPCODE_TXPBEM = 0x34, diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index ef64c0d754..e8f67da265 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -419,13 +419,13 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const break; // Vertex Texture - case_4(NV4097_SET_VERTEX_TEXTURE_FORMAT, 0x20) : - case_4(NV4097_SET_VERTEX_TEXTURE_OFFSET, 0x20) : - case_4(NV4097_SET_VERTEX_TEXTURE_FILTER, 0x20) : - case_4(NV4097_SET_VERTEX_TEXTURE_ADDRESS, 0x20) : - case_4(NV4097_SET_VERTEX_TEXTURE_IMAGE_RECT, 0x20) : - case_4(NV4097_SET_VERTEX_TEXTURE_BORDER_COLOR, 0x20) : - case_4(NV4097_SET_VERTEX_TEXTURE_CONTROL0, 0x20) : + case_4(NV4097_SET_VERTEX_TEXTURE_FORMAT, 0x20): + case_4(NV4097_SET_VERTEX_TEXTURE_OFFSET, 0x20): + case_4(NV4097_SET_VERTEX_TEXTURE_FILTER, 0x20): + case_4(NV4097_SET_VERTEX_TEXTURE_ADDRESS, 0x20): + case_4(NV4097_SET_VERTEX_TEXTURE_IMAGE_RECT, 0x20): + case_4(NV4097_SET_VERTEX_TEXTURE_BORDER_COLOR, 0x20): + case_4(NV4097_SET_VERTEX_TEXTURE_CONTROL0, 0x20): { // Done using methodRegisters in RSXTexture.cpp } @@ -1586,7 +1586,9 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const case NV4097_SET_CONTEXT_DMA_COLOR_D: { if (ARGS(0)) + { LOG_WARNING(RSX, "NV4097_SET_CONTEXT_DMA_COLOR_D: 0x%x", ARGS(0)); + } } break; @@ -2356,10 +2358,6 @@ void RSXThread::Task() //LOG_WARNING(RSX, "non increment cmd! 0x%x", cmd); inc = 0; } - else - { - //LOG_WARNING(RSX, "increment cmd! 0x%x", cmd); - } if(cmd == 0) //nop { diff --git a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp index 3448ef7701..69b95612cd 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp @@ -528,6 +528,7 @@ int cellAudioPortOpen(vm::ptr audioParam, vm::ptr portN port.attr = audioParam->attr; port.addr = m_config.m_buffer + (128 * 1024 * i); port.read_index_addr = m_config.m_indexes + (sizeof(u64) * i); + port.size = port.channel * port.block * 256 * sizeof(float); if (port.attr & CELL_AUDIO_PORTATTR_INITLEVEL) { port.level = audioParam->level; @@ -579,7 +580,7 @@ int cellAudioGetPortConfig(u32 portNum, vm::ptr portConfig) portConfig->nChannel = port.channel; portConfig->nBlock = port.block; - portConfig->portSize = port.channel * port.block * 256 * sizeof(float); + portConfig->portSize = port.size; portConfig->portAddr = port.addr; // 0x20020000 portConfig->readIndexAddr = port.read_index_addr; // 0x20010010 on ps3 @@ -865,8 +866,11 @@ int cellAudioRemoveNotifyEventQueueEx(u64 key, u32 iFlags) int cellAudioAddData(u32 portNum, vm::ptr src, u32 samples, float volume) { - cellAudio->Todo("cellAudioAddData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.addr(), samples, volume); + cellAudio->Warning("cellAudioAddData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.addr(), samples, volume); + if (src.addr() % 16) + return CELL_AUDIO_ERROR_PARAM; + AudioPortConfig& port = m_config.m_ports[portNum]; if (portNum >= m_config.AUDIO_PORT_COUNT) @@ -886,21 +890,23 @@ int cellAudioAddData(u32 portNum, vm::ptr src, u32 samples, float volume) std::lock_guard lock(audioMutex); - //u32 addr = port.addr; - //for (u32 i = 0; i < samples; i++) - //{ - // vm::write32(addr, src[i]); - // addr += port.channel * port.block * sizeof(float); - //} + u32 addr = port.addr; + u32 src_addr = src.addr(); - m_config.m_buffer = src.addr(); // TODO: write data from src in selected port + for (u32 i = 0; i < samples; i++) + { + // vm::write32(addr, (u32)((float)vm::read32(src_addr) * volume)); // TODO: use volume? + vm::write32(addr, vm::read32(src_addr)); + src_addr += (port.size / samples); + addr += (port.size / samples); + } return CELL_OK; } -int cellAudioAdd2chData(u32 portNum, vm::ptr> src, u32 samples, float volume) +int cellAudioAdd2chData(u32 portNum, vm::ptr src, u32 samples, float volume) { - cellAudio->Todo("cellAudioAdd2chData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.addr(), samples, volume); + cellAudio->Warning("cellAudioAdd2chData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.addr(), samples, volume); AudioPortConfig& port = m_config.m_ports[portNum]; @@ -921,14 +927,23 @@ int cellAudioAdd2chData(u32 portNum, vm::ptr> src, u32 samples, floa std::lock_guard lock(audioMutex); - m_config.m_buffer = src.addr(); // TODO + u32 addr = port.addr; + u32 src_addr = src.addr(); + + for (u32 i = 0; i < samples; i++) + { + // vm::write32(addr, (u32)((float)vm::read32(src_addr) * volume)); // TODO: use volume? + vm::write32(addr, vm::read32(src_addr)); + src_addr += (2 * port.block * 256 * sizeof(float) / samples); + addr += (2 * port.block * 256 * sizeof(float) / samples); + } return CELL_OK; } -int cellAudioAdd6chData(u32 portNum, vm::ptr> src, float volume) +int cellAudioAdd6chData(u32 portNum, vm::ptr src, float volume) { - cellAudio->Todo("cellAudioAdd6chData(portNum=0x%x, src_addr=0x%x, volume=%f)", portNum, src.addr(), volume); + cellAudio->Warning("cellAudioAdd6chData(portNum=0x%x, src_addr=0x%x, volume=%f)", portNum, src.addr(), volume); AudioPortConfig& port = m_config.m_ports[portNum]; @@ -949,7 +964,16 @@ int cellAudioAdd6chData(u32 portNum, vm::ptr> src, float volume) std::lock_guard lock(audioMutex); - m_config.m_buffer = src.addr(); // TODO + u32 addr = port.addr; + u32 src_addr = src.addr(); + + for (u32 i = 0; i < 256; i++) + { + // vm::write32(addr, (u32)((float)vm::read32(src_addr) * volume)); // TODO: use volume? + vm::write32(addr, vm::read32(src_addr)); + src_addr += (6 * port.block * sizeof(float)); + addr += (6 * port.block * sizeof(float)); + } return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp index 9e79e0015c..58d0df01d0 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp @@ -82,15 +82,13 @@ void addSaveDataEntry(std::vector& saveEntries, const std::string cellSysutil->Error("Running _stat in cellSaveData. Please report this to a RPCS3 developer!"); - std::string pathy; - - Emu.GetVFS().GetDevice("dev_hdd0", pathy); - + std::string real_path; struct stat buf; - int result = stat((pathy.substr(0, pathy.length() - 9) + f.GetPath()).c_str(), &buf); - if (result != 0) - cellSysutil->Error("_stat failed! (%s)", (pathy.substr(0, pathy.length() - 9) + f.GetPath()).c_str()); + Emu.GetVFS().GetDevice(f.GetPath(), real_path); + + if (stat(real_path.c_str(), &buf) != 0) + cellSysutil->Error("stat failed! (%s)", real_path.c_str()); else { atime = buf.st_atime; diff --git a/rpcs3/Emu/SysCalls/lv2/cellFs.cpp b/rpcs3/Emu/SysCalls/lv2/cellFs.cpp index b44c8473dc..60e09c82fc 100644 --- a/rpcs3/Emu/SysCalls/lv2/cellFs.cpp +++ b/rpcs3/Emu/SysCalls/lv2/cellFs.cpp @@ -242,7 +242,7 @@ s32 cellFsStat(vm::ptr path, vm::ptr sb) if (int result = stat(real_path.c_str(), &buf)) { - sys_fs->Error("_stat failed! (%s)", real_path.c_str()); + sys_fs->Error("stat('%s') failed -> 0x%x", real_path.c_str(), result); } else { diff --git a/rpcs3/Emu/SysCalls/lv2/sys_process.cpp b/rpcs3/Emu/SysCalls/lv2/sys_process.cpp index 24a1753dae..ccbe619bee 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_process.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_process.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "Emu/FS/VFS.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" @@ -103,17 +104,11 @@ void sys_game_process_exitspawn(vm::ptr path, u32 argv_addr, u32 env Emu.Stop(); }); - int device = -1; + std::string real_path; - if (_path.substr(1, 8) == "dev_hdd0") - device = 0; - else if (_path.substr(1, 8) == "dev_hdd1") - device = 1; - else if (_path.substr(1, 8) == "dev_bdvd") - device = 2; + Emu.GetVFS().GetDevice(_path.c_str(), real_path); - if (device != 0) - Emu.BootGame(_path.c_str(), true, device); + Emu.BootGame(real_path, true); return; } @@ -185,16 +180,11 @@ void sys_game_process_exitspawn2(vm::ptr path, u32 argv_addr, u32 en Emu.Stop(); }); - int device = -1; + std::string real_path; - if (_path.substr(1, 8) == "dev_hdd0") - device = 0; - else if (_path.substr(1, 8) == "dev_hdd1") - device = 1; - else if (_path.substr(1, 8) == "dev_bdvd") - device = 2; + Emu.GetVFS().GetDevice(_path.c_str(), real_path); - Emu.BootGame(_path.c_str(), true, device); + Emu.BootGame(real_path, true); return; } diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index cbc70bdc3c..eb71c23467 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -146,7 +146,7 @@ void Emulator::CheckStatus() //} } -bool Emulator::BootGame(const std::string& path, bool direct, int device) +bool Emulator::BootGame(const std::string& path, bool direct) { static const char* elf_path[6] = { @@ -159,34 +159,21 @@ bool Emulator::BootGame(const std::string& path, bool direct, int device) }; auto curpath = path; - if (!direct) + if (direct) { - for (int i = 0; i < sizeof(elf_path) / sizeof(*elf_path); i++) + if (rFile::Access(curpath, rFile::read)) { - curpath = path + elf_path[i]; + SetPath(curpath); + Load(); - if (rFile::Access(curpath, rFile::read)) - { - SetPath(curpath); - Load(); - - return true; - } + return true; } } - else + + for (int i = 0; i < sizeof(elf_path) / sizeof(*elf_path); i++) { - std::string pathy; - - if (device == 0) - Emu.GetVFS().GetDevice("dev_hdd0", pathy); - else if (device == 1) - Emu.GetVFS().GetDevice("dev_hdd1", pathy); - else if (device == 2) - Emu.GetVFS().GetDevice("dev_bdvd", pathy); - - curpath = pathy.substr(0, pathy.length() - 9) + path; - + curpath = path + elf_path[i]; + if (rFile::Access(curpath, rFile::read)) { SetPath(curpath); diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index 99a0225e6a..a4901089b3 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -206,7 +206,7 @@ public: u32 GetCPUThreadStop() const { return m_cpu_thr_stop; } void CheckStatus(); - bool BootGame(const std::string& path, bool direct = false, int device = 0); + bool BootGame(const std::string& path, bool direct = false); void Load(); void Run(); diff --git a/rpcs3/Gui/LLEModulesManager.cpp b/rpcs3/Gui/LLEModulesManager.cpp index f6ccd60b0b..5505e3877e 100644 --- a/rpcs3/Gui/LLEModulesManager.cpp +++ b/rpcs3/Gui/LLEModulesManager.cpp @@ -13,14 +13,26 @@ LLEModulesManagerFrame::LLEModulesManagerFrame(wxWindow* parent) : FrameBase(par wxBoxSizer *s_p_panel = new wxBoxSizer(wxVERTICAL); wxPanel *p_main = new wxPanel(this); m_check_list = new wxCheckListBox(p_main, wxID_ANY); + + // select / unselect + wxStaticBoxSizer* s_selection = new wxStaticBoxSizer(wxHORIZONTAL, p_main); + wxButton* b_select = new wxButton(p_main, wxID_ANY, "Select All", wxDefaultPosition, wxSize(80, -1)); + wxButton* b_unselect = new wxButton(p_main, wxID_ANY, "Unselect All", wxDefaultPosition, wxSize(80, -1)); + s_selection->Add(b_select); + s_selection->Add(b_unselect); + + s_p_panel->Add(s_selection); s_p_panel->Add(m_check_list, 1, wxEXPAND | wxALL, 5); p_main->SetSizerAndFit(s_p_panel); + s_panel->Add(p_main, 1, wxEXPAND | wxALL, 5); SetSizerAndFit(s_panel); - Refresh(); + + b_select->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) { OnSelectAll(event, true); event.Skip(); }); + b_unselect->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) { OnSelectAll(event, false); event.Skip(); }); Bind(wxEVT_CHECKLISTBOX, [this](wxCommandEvent& event) { UpdateSelection(event.GetInt()); event.Skip(); }); - Bind(wxEVT_SIZE, [p_main, this](wxSizeEvent& event) { p_main->SetSize(GetClientSize()); m_check_list->SetSize(p_main->GetClientSize() - wxSize(10, 10)); event.Skip(); }); + Bind(wxEVT_SIZE, [p_main, this](wxSizeEvent& event) { p_main->SetSize(GetClientSize()); m_check_list->SetSize(p_main->GetClientSize() - wxSize(10, 50)); event.Skip(); }); } void LLEModulesManagerFrame::Refresh() @@ -91,4 +103,13 @@ void LLEModulesManagerFrame::UpdateSelection(int index) IniEntry load_lib; load_lib.Init(m_funcs[index], "LLE"); load_lib.SaveValue(m_check_list->IsChecked(index)); +} + +void LLEModulesManagerFrame::OnSelectAll(wxCommandEvent& WXUNUSED(event), bool is_checked) +{ + for (uint i = 0; i < m_check_list->GetCount(); i++) + { + m_check_list->Check(i, is_checked); + UpdateSelection(i); + } } \ No newline at end of file diff --git a/rpcs3/Gui/LLEModulesManager.h b/rpcs3/Gui/LLEModulesManager.h index f73fa02910..c4025b5675 100644 --- a/rpcs3/Gui/LLEModulesManager.h +++ b/rpcs3/Gui/LLEModulesManager.h @@ -11,4 +11,5 @@ public: LLEModulesManagerFrame(wxWindow *parent); void Refresh(); void UpdateSelection(int index); + void OnSelectAll(wxCommandEvent& WXUNUSED(event), bool is_checked); }; \ No newline at end of file diff --git a/rpcs3/Loader/ELF64.cpp b/rpcs3/Loader/ELF64.cpp index 874f455cde..0357e5bcfa 100644 --- a/rpcs3/Loader/ELF64.cpp +++ b/rpcs3/Loader/ELF64.cpp @@ -133,7 +133,6 @@ namespace loader if (import_count) { LOG_ERROR(LOADER, "**** Lib '%s'has %d imports!", module_info.name, import_count); - break; } sys_prx_library_info_t lib;