From 1bde52623b01a6d870f694fcb2bba618843fb9a3 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Fri, 26 Dec 2014 17:56:55 +0200 Subject: [PATCH 1/5] Fragment Program improvements * Implement TXP (Needs testing) * Implement TXB * Implement TXL --- rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp | 6 +++--- rpcs3/Emu/RSX/RSXFragmentProgram.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp b/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp index 984aa82eee..7027b6775d 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)"); 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, From 0cd3cd3e051588ef164bb4f91fb2e434b8841114 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Fri, 26 Dec 2014 18:16:57 +0200 Subject: [PATCH 2/5] cellFsStat fix and other fixes --- rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp | 12 ++++---- rpcs3/Emu/SysCalls/lv2/lv2Fs.cpp | 29 +++--------------- rpcs3/Emu/SysCalls/lv2/sys_process.cpp | 24 +++++---------- rpcs3/Emu/System.cpp | 33 +++++++-------------- rpcs3/Emu/System.h | 2 +- 5 files changed, 27 insertions(+), 73 deletions(-) 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/lv2Fs.cpp b/rpcs3/Emu/SysCalls/lv2/lv2Fs.cpp index 071497cfe3..38606e9b5c 100644 --- a/rpcs3/Emu/SysCalls/lv2/lv2Fs.cpp +++ b/rpcs3/Emu/SysCalls/lv2/lv2Fs.cpp @@ -251,34 +251,13 @@ s32 cellFsStat(vm::ptr path, vm::ptr sb) u64 ctime = 0; u64 size = 0; - int device = -1; - - 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; - - 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); - + std::string real_path; struct stat buf; - int result = 1; - if (device == 2) - result = stat((pathy + _path.substr(9, _path.length())).c_str(), &buf); - else - result = stat((pathy.substr(0, pathy.length() - 9) + _path).c_str(), &buf); + Emu.GetVFS().GetDevice(_path, real_path); - if (result != 0) - sys_fs->Error("_stat failed! (%s)", (pathy.substr(0, pathy.length() - 9) + _path).c_str()); + if (stat(real_path.c_str(), &buf) != 0) + sys_fs->Error("stat failed! (%s)", real_path.c_str()); else { mode = buf.st_mode; diff --git a/rpcs3/Emu/SysCalls/lv2/sys_process.cpp b/rpcs3/Emu/SysCalls/lv2/sys_process.cpp index c8781b56c4..b3169ea1d7 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 f1dd6d79e1..5efec19085 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -145,7 +145,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] = { @@ -158,34 +158,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 b9a9d4b638..21c44ce3a4 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -207,7 +207,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(); From b9a8c6414dc6b904c50179af7721e7dc37e859ad Mon Sep 17 00:00:00 2001 From: raven02 Date: Sat, 27 Dec 2014 04:15:00 +0800 Subject: [PATCH 3/5] RSX: fall back the case switch --- rpcs3/Emu/RSX/RSXThread.cpp | 128 ++++++++++++++++++++++++------------ 1 file changed, 87 insertions(+), 41 deletions(-) diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 261fdb099a..aef1ced34c 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -189,21 +189,66 @@ u32 RSXThread::OutOfArgsCount(const uint x, const u32 cmd, const u32 count, cons return 0; } -#define case_2(offset, step) \ - case offset: \ - case offset + step: -#define case_4(offset, step) \ - case_2(offset, step) \ - case_2(offset + 2*step, step) -#define case_8(offset, step) \ - case_4(offset, step) \ - case_4(offset + 4*step, step) -#define case_16(offset, step) \ - case_8(offset, step) \ - case_8(offset + 8*step, step) -#define case_32(offset, step) \ - case_16(offset, step) \ - case_16(offset + 16*step, step) +#define case_4(a, m) \ + case a + m: \ + case a + m * 2: \ + case a + m * 3: \ + index = (cmd - a) / m; \ + case a \ + +#define case_16(a, m) \ + case a + m: \ + case a + m * 2: \ + case a + m * 3: \ + case a + m * 4: \ + case a + m * 5: \ + case a + m * 6: \ + case a + m * 7: \ + case a + m * 8: \ + case a + m * 9: \ + case a + m * 10: \ + case a + m * 11: \ + case a + m * 12: \ + case a + m * 13: \ + case a + m * 14: \ + case a + m * 15: \ + index = (cmd - a) / m; \ + case a \ + +#define case_32(a, m) \ + case a + m: \ + case a + m * 2: \ + case a + m * 3: \ + case a + m * 4: \ + case a + m * 5: \ + case a + m * 6: \ + case a + m * 7: \ + case a + m * 8: \ + case a + m * 9: \ + case a + m * 10: \ + case a + m * 11: \ + case a + m * 12: \ + case a + m * 13: \ + case a + m * 14: \ + case a + m * 15: \ + case a + m * 16: \ + case a + m * 17: \ + case a + m * 18: \ + case a + m * 19: \ + case a + m * 20: \ + case a + m * 21: \ + case a + m * 22: \ + case a + m * 23: \ + case a + m * 24: \ + case a + m * 25: \ + case a + m * 26: \ + case a + m * 27: \ + case a + m * 28: \ + case a + m * 29: \ + case a + m * 30: \ + case a + m * 31: \ + index = (cmd - a) / m; \ + case a \ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const u32 count) { @@ -352,26 +397,26 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const break; // Texture - case_16(NV4097_SET_TEXTURE_FORMAT, 0x20) - case_16(NV4097_SET_TEXTURE_OFFSET, 0x20) - case_16(NV4097_SET_TEXTURE_FILTER, 0x20) - case_16(NV4097_SET_TEXTURE_ADDRESS, 0x20) - case_16(NV4097_SET_TEXTURE_IMAGE_RECT, 32) - case_16(NV4097_SET_TEXTURE_BORDER_COLOR, 0x20) - case_16(NV4097_SET_TEXTURE_CONTROL0, 0x20) - case_16(NV4097_SET_TEXTURE_CONTROL1, 0x20) + case_16(NV4097_SET_TEXTURE_FORMAT, 0x20) : + case_16(NV4097_SET_TEXTURE_OFFSET, 0x20) : + case_16(NV4097_SET_TEXTURE_FILTER, 0x20) : + case_16(NV4097_SET_TEXTURE_ADDRESS, 0x20) : + case_16(NV4097_SET_TEXTURE_IMAGE_RECT, 32) : + case_16(NV4097_SET_TEXTURE_BORDER_COLOR, 0x20) : + case_16(NV4097_SET_TEXTURE_CONTROL0, 0x20) : + case_16(NV4097_SET_TEXTURE_CONTROL1, 0x20) : { // Done using methodRegisters in RSXTexture.cpp } break; - case_16(NV4097_SET_TEX_COORD_CONTROL, 4) + case_16(NV4097_SET_TEX_COORD_CONTROL, 4) : { LOG_WARNING(RSX, "NV4097_SET_TEX_COORD_CONTROL"); } break; - case_16(NV4097_SET_TEXTURE_CONTROL3, 4) + case_16(NV4097_SET_TEXTURE_CONTROL3, 4) : { RSXTexture& tex = m_textures[index]; const u32 a0 = ARGS(0); @@ -382,19 +427,19 @@ 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 } break; - case_4(NV4097_SET_VERTEX_TEXTURE_CONTROL3, 0x20) + case_4(NV4097_SET_VERTEX_TEXTURE_CONTROL3, 0x20) : { RSXVertexTexture& tex = m_vertex_textures[index]; const u32 a0 = ARGS(0); @@ -405,7 +450,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const break; // Vertex data - case_16(NV4097_SET_VERTEX_DATA4UB_M, 4) + case_16(NV4097_SET_VERTEX_DATA4UB_M, 4) : { const u32 a0 = ARGS(0); u8 v0 = a0; @@ -424,7 +469,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const } break; - case_16(NV4097_SET_VERTEX_DATA2F_M, 8) + case_16(NV4097_SET_VERTEX_DATA2F_M, 8) : { const u32 a0 = ARGS(0); const u32 a1 = ARGS(1); @@ -444,7 +489,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const } break; - case_16(NV4097_SET_VERTEX_DATA4F_M, 16) + case_16(NV4097_SET_VERTEX_DATA4F_M, 16) : { const u32 a0 = ARGS(0); const u32 a1 = ARGS(1); @@ -470,7 +515,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const } break; - case_16(NV4097_SET_VERTEX_DATA_ARRAY_OFFSET, 4) + case_16(NV4097_SET_VERTEX_DATA_ARRAY_OFFSET, 4) : { const u32 addr = GetAddress(ARGS(0) & 0x7fffffff, ARGS(0) >> 31); CMD_LOG("num=%d, addr=0x%x", index, addr); @@ -481,7 +526,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const } break; - case_16(NV4097_SET_VERTEX_DATA_ARRAY_FORMAT, 4) + case_16(NV4097_SET_VERTEX_DATA_ARRAY_FORMAT, 4): { const u32 a0 = ARGS(0); u16 frequency = a0 >> 16; @@ -1076,7 +1121,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const { if (ARGS(1)) { - LOG_WARNING(RSX, "NV4097_SET_TRANSFORM_PROGRAM_LOAD: start = %d", ARGS(0)); + LOG_WARNING(RSX, "NV4097_SET_TRANSFORM_PROGRAM_LOAD: start = %d", ARGS(1)); } } } @@ -1091,7 +1136,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const } break; - case_32(NV4097_SET_TRANSFORM_PROGRAM, 4) + case_32(NV4097_SET_TRANSFORM_PROGRAM, 4): { //LOG_WARNING(RSX, "NV4097_SET_TRANSFORM_PROGRAM[%d](%d)", index, count); @@ -1572,7 +1617,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; @@ -2366,7 +2413,6 @@ void RSXThread::Task() else { //LOG_WARNING(RSX, "RSX: increment cmd! 0x%x", cmd); - inc++; } if (cmd == 0) //nop From 240c20936094f40974f4f17ede3007d48801aa1b Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Sat, 27 Dec 2014 11:00:44 +0200 Subject: [PATCH 4/5] Fix TXB instruction --- rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp b/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp index 7027b6775d..3a94706acc 100644 --- a/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp +++ b/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp @@ -493,7 +493,7 @@ void GLFragmentDecompilerThread::Task() case RSX_FP_OPCODE_TEX: SetDst("texture($t, $0.xy)"); 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: SetDst("texture($t, $0.xy, $1)"); 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; From 2a6f4e19cca965e97af38998c7956606da894b00 Mon Sep 17 00:00:00 2001 From: Oil Date: Sat, 27 Dec 2014 21:25:51 +0400 Subject: [PATCH 5/5] Some changes in LLEModulesManager and cellAudio --- rpcs3/Emu/Audio/cellAudio.h | 1 + rpcs3/Emu/SysCalls/Modules/cellAudio.cpp | 54 +++++++++++++++++------- rpcs3/Gui/LLEModulesManager.cpp | 25 ++++++++++- rpcs3/Gui/LLEModulesManager.h | 1 + rpcs3/Loader/ELF64.cpp | 1 - 5 files changed, 64 insertions(+), 18 deletions(-) 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/SysCalls/Modules/cellAudio.cpp b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp index 8186beef87..94279d7c43 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp @@ -529,6 +529,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; @@ -580,7 +581,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 @@ -867,8 +868,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) @@ -888,21 +892,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]; @@ -923,14 +929,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]; @@ -951,7 +966,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/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;