From 8095c34e4976a3b98371671d16764646a17210a9 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Tue, 12 Aug 2014 20:44:28 +0300 Subject: [PATCH 01/10] Don't set game's size info when it's a null pointer --- rpcs3/Emu/SysCalls/Modules/cellGame.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp index 13077e8b4b..ecf4884059 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp @@ -23,12 +23,15 @@ int cellGameBootCheck(mem32_t type, mem32_t attributes, mem_ptr_tWarning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)", type.GetAddr(), attributes.GetAddr(), size.GetAddr(), dirName.GetAddr()); - // TODO: Use the free space of the computer's HDD where RPCS3 is being run. - size->hddFreeSizeKB = 40000000; // 40 GB + if (size) + { + // TODO: Use the free space of the computer's HDD where RPCS3 is being run. + size->hddFreeSizeKB = 40000000; // 40 GB - // TODO: Calculate data size for HG and DG games, if necessary. - size->sizeKB = CELL_GAME_SIZEKB_NOTCALC; - size->sysSizeKB = 0; + // TODO: Calculate data size for HG and DG games, if necessary. + size->sizeKB = CELL_GAME_SIZEKB_NOTCALC; + size->sysSizeKB = 0; + } vfsFile f("/app_home/PARAM.SFO"); if (!f.IsOpened()) From 7dc48425c10326383a7bd5ee39feb4203a827a27 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Tue, 12 Aug 2014 23:27:13 +0300 Subject: [PATCH 02/10] Improve content errors and fix access violation --- rpcs3/Emu/SysCalls/Modules/cellGame.cpp | 38 +++++++++++++++++-------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp index 13077e8b4b..5ebef120af 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp @@ -418,23 +418,37 @@ int cellGameGetLocalWebContentPath() int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr) { cellGame->Warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName_addr=0x%x)", type, errNeedSizeKB, dirName_addr); - - char* dirName = (char*)Memory.VirtualToRealAddr(dirName_addr); std::string errorName; - switch(type) + std::string errorMsg; + char* dirName; + + if (type == CELL_GAME_ERRDIALOG_NOSPACE || CELL_GAME_ERRDIALOG_NOSPACE_EXIT) { - case CELL_GAME_ERRDIALOG_BROKEN_GAMEDATA: errorName = "Game data is corrupted (can be continued)."; break; - case CELL_GAME_ERRDIALOG_BROKEN_HDDGAME: errorName = "HDD boot game is corrupted (can be continued)."; break; - case CELL_GAME_ERRDIALOG_NOSPACE: errorName = "Not enough available space (can be continued)."; break; - case CELL_GAME_ERRDIALOG_BROKEN_EXIT_GAMEDATA: errorName = "Game data is corrupted (terminate application)."; break; - case CELL_GAME_ERRDIALOG_BROKEN_EXIT_HDDGAME: errorName = "HDD boot game is corrupted (terminate application)."; break; - case CELL_GAME_ERRDIALOG_NOSPACE_EXIT: errorName = "Not enough available space (terminate application)."; break; - default: return CELL_GAME_ERROR_PARAM; + char* dirName = (char*)Memory.VirtualToRealAddr(dirName_addr); + } + + switch (type) + { + case CELL_GAME_ERRDIALOG_BROKEN_GAMEDATA: errorName = "Game data is corrupted (can be continued)."; break; + case CELL_GAME_ERRDIALOG_BROKEN_HDDGAME: errorName = "HDD boot game is corrupted (can be continued)."; break; + case CELL_GAME_ERRDIALOG_NOSPACE: errorName = "Not enough available space (can be continued)."; break; + case CELL_GAME_ERRDIALOG_BROKEN_EXIT_GAMEDATA: errorName = "Game data is corrupted (terminate application)."; break; + case CELL_GAME_ERRDIALOG_BROKEN_EXIT_HDDGAME: errorName = "HDD boot game is corrupted (terminate application)."; break; + case CELL_GAME_ERRDIALOG_NOSPACE_EXIT: errorName = "Not enough available space (terminate application)."; break; + default: return CELL_GAME_ERROR_PARAM; + } + + if (type == CELL_GAME_ERRDIALOG_NOSPACE || CELL_GAME_ERRDIALOG_NOSPACE_EXIT) + { + errorMsg = fmt::Format("ERROR: %s\nSpace needed: %d KB\nDirectory name: %s", errorName.c_str(), errNeedSizeKB, dirName); + } + else + { + errorMsg = fmt::Format("ERROR: %s", errorName.c_str()); } - std::string errorMsg = fmt::Format("%s\nSpace needed: %d KB\nDirectory name: %s", - errorName.c_str(), errNeedSizeKB, dirName); rMessageBox(errorMsg, "Error", rICON_ERROR | rOK); + return CELL_OK; } From 980dfc8f4be25d83c83c15552f990ae855ffe0eb Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Wed, 13 Aug 2014 09:39:45 +0300 Subject: [PATCH 03/10] Re-fixed content error dialogs --- rpcs3/Emu/SysCalls/Modules/cellGame.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp index bc57e18af1..ddc766a2bf 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp @@ -425,7 +425,7 @@ int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr) std::string errorMsg; char* dirName; - if (type == CELL_GAME_ERRDIALOG_NOSPACE || CELL_GAME_ERRDIALOG_NOSPACE_EXIT) + if (type == CELL_GAME_ERRDIALOG_NOSPACE || type == CELL_GAME_ERRDIALOG_NOSPACE_EXIT) { char* dirName = (char*)Memory.VirtualToRealAddr(dirName_addr); } @@ -441,7 +441,7 @@ int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr) default: return CELL_GAME_ERROR_PARAM; } - if (type == CELL_GAME_ERRDIALOG_NOSPACE || CELL_GAME_ERRDIALOG_NOSPACE_EXIT) + if (type == CELL_GAME_ERRDIALOG_NOSPACE || type == CELL_GAME_ERRDIALOG_NOSPACE_EXIT) { errorMsg = fmt::Format("ERROR: %s\nSpace needed: %d KB\nDirectory name: %s", errorName.c_str(), errNeedSizeKB, dirName); } From 1570bee4b81fc616e2a4e28b208463ecde1b7486 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 13 Aug 2014 00:43:11 -0700 Subject: [PATCH 04/10] Add build directory to .gitignore Many people prefer to build out-of-source, especially in the ./build directory. This prevents it from being tracked by git. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 033f921069..d9060700ad 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,8 @@ *.dump *.wav +/build + /libs /ipch /rpcs3/Debug From 3095d01144c0cc092bec7ccaf7f13671dfe28010 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Wed, 13 Aug 2014 10:46:17 +0300 Subject: [PATCH 05/10] Create RWLock with default attributes, when attributes is a null pointer --- rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp | 42 +++++++++++++++++---------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp b/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp index 98d8dd60b2..6e6d631618 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp @@ -10,26 +10,38 @@ s32 sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t attr { sys_rwlock.Warning("sys_rwlock_create(rw_lock_id_addr=0x%x, attr_addr=0x%x)", rw_lock_id.GetAddr(), attr.GetAddr()); - switch (attr->attr_protocol.ToBE()) + if (attr) { - case se(attr->attr_protocol, SYS_SYNC_PRIORITY): sys_rwlock.Todo("SYS_SYNC_PRIORITY"); break; - case se(attr->attr_protocol, SYS_SYNC_RETRY): sys_rwlock.Error("SYS_SYNC_RETRY"); return CELL_EINVAL; - case se(attr->attr_protocol, SYS_SYNC_PRIORITY_INHERIT): sys_rwlock.Todo("SYS_SYNC_PRIORITY_INHERIT"); break; - case se(attr->attr_protocol, SYS_SYNC_FIFO): break; - default: return CELL_EINVAL; - } + switch (attr->attr_protocol.ToBE()) + { + case se(attr->attr_protocol, SYS_SYNC_PRIORITY): sys_rwlock.Todo("SYS_SYNC_PRIORITY"); break; + case se(attr->attr_protocol, SYS_SYNC_RETRY): sys_rwlock.Error("SYS_SYNC_RETRY"); return CELL_EINVAL; + case se(attr->attr_protocol, SYS_SYNC_PRIORITY_INHERIT): sys_rwlock.Todo("SYS_SYNC_PRIORITY_INHERIT"); break; + case se(attr->attr_protocol, SYS_SYNC_FIFO): break; + default: return CELL_EINVAL; + } - if (attr->attr_pshared.ToBE() != se32(0x200)) + if (attr->attr_pshared.ToBE() != se32(0x200)) + { + sys_rwlock.Error("Invalid attr_pshared(0x%x)", (u32)attr->attr_pshared); + return CELL_EINVAL; + } + + rw_lock_id = sys_rwlock.GetNewId(new RWLock((u32)attr->attr_protocol, attr->name_u64)); + + sys_rwlock.Warning("*** rwlock created [%s] (protocol=0x%x): id = %d", + std::string(attr->name, 8).c_str(), (u32)attr->attr_protocol, rw_lock_id.GetValue()); + } + else { - sys_rwlock.Error("Invalid attr_pshared(0x%x)", (u32)attr->attr_pshared); - return CELL_EINVAL; + sys_rwlock.Todo("SYS_SYNC_PRIORITY"); + + rw_lock_id = sys_rwlock.GetNewId(new RWLock((u32)SYS_SYNC_PRIORITY, (u64)"default")); + + sys_rwlock.Warning("*** rwlock created [%s] (protocol=0x%x): id = %d", + std::string("default", 8).c_str(), (u32)SYS_SYNC_PRIORITY, rw_lock_id.GetValue()); } - rw_lock_id = sys_rwlock.GetNewId(new RWLock((u32)attr->attr_protocol, attr->name_u64)); - - sys_rwlock.Warning("*** rwlock created [%s] (protocol=0x%x): id = %d", - std::string(attr->name, 8).c_str(), (u32) attr->attr_protocol, rw_lock_id.GetValue()); - return CELL_OK; } From 1a92526ba006efcf319d05d4a3867dacf96a1dde Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Wed, 13 Aug 2014 10:57:55 +0300 Subject: [PATCH 06/10] Don't set game's size info in Patch and Data check --- rpcs3/Emu/SysCalls/Modules/cellGame.cpp | 26 +++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp index bc57e18af1..494963cd94 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp @@ -93,12 +93,15 @@ int cellGamePatchCheck(mem_ptr_t size, u32 reserved_addr) return CELL_GAME_ERROR_PARAM; } - // TODO: Use the free space of the computer's HDD where RPCS3 is being run. - size->hddFreeSizeKB = 40000000; // 40 GB + if (size) + { + // TODO: Use the free space of the computer's HDD where RPCS3 is being run. + size->hddFreeSizeKB = 40000000; // 40 GB - // TODO: Calculate data size for patch data, if necessary. - size->sizeKB = CELL_GAME_SIZEKB_NOTCALC; - size->sysSizeKB = 0; + // TODO: Calculate data size for patch data, if necessary. + size->sizeKB = CELL_GAME_SIZEKB_NOTCALC; + size->sysSizeKB = 0; + } vfsFile f("/app_home/PARAM.SFO"); if (!f.IsOpened()) @@ -138,12 +141,15 @@ int cellGameDataCheck(u32 type, const mem_list_ptr_t dirName, mem_ptr_thddFreeSizeKB = 40000000; //40 GB + if (size) + { + // TODO: Use the free space of the computer's HDD where RPCS3 is being run. + size->hddFreeSizeKB = 40000000; //40 GB - // TODO: Calculate data size for game data, if necessary. - size->sizeKB = CELL_GAME_SIZEKB_NOTCALC; - size->sysSizeKB = 0; + // TODO: Calculate data size for game data, if necessary. + size->sizeKB = CELL_GAME_SIZEKB_NOTCALC; + size->sysSizeKB = 0; + } if (type == CELL_GAME_GAMETYPE_DISC) { From 03747e3106699ddb323827cf138ac3cdd4334803 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Wed, 13 Aug 2014 13:53:21 +0300 Subject: [PATCH 07/10] Fix redeclaration --- rpcs3/Emu/SysCalls/Modules/cellGame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp index 7b1ae3b0d5..86611c8edb 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp @@ -433,7 +433,7 @@ int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr) if (type == CELL_GAME_ERRDIALOG_NOSPACE || type == CELL_GAME_ERRDIALOG_NOSPACE_EXIT) { - char* dirName = (char*)Memory.VirtualToRealAddr(dirName_addr); + dirName = (char*)Memory.VirtualToRealAddr(dirName_addr); } switch (type) From 8f4d8f82ed205d10aa14a90fa9518605f0e6177e Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Wed, 13 Aug 2014 15:25:13 +0300 Subject: [PATCH 08/10] License isn't always needed, fixes access violation --- rpcs3/Emu/SysCalls/Modules/sceNp.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp index f686e4f293..7ae3e88654 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp @@ -36,12 +36,16 @@ int sceNpDrmIsAvailable(u32 k_licensee_addr, u32 drm_path_addr) return CELL_ENOENT; } - std::string k_licensee_str; + std::string k_licensee_str = "0"; u8 k_licensee[0x10]; - for(int i = 0; i < 0x10; i++) + + if (k_licensee_addr) { - k_licensee[i] = Memory.Read8(k_licensee_addr + i); - k_licensee_str += fmt::Format("%02x", k_licensee[i]); + for (int i = 0; i < 0x10; i++) + { + k_licensee[i] = Memory.Read8(k_licensee_addr + i); + k_licensee_str += fmt::Format("%02x", k_licensee[i]); + } } sceNp->Warning("sceNpDrmIsAvailable: Found DRM license file at %s", drm_path.c_str()); From ea00c3a07f0b66b19a56a49e970db168cdfa89d8 Mon Sep 17 00:00:00 2001 From: luxsie <877033040@qq.com> Date: Wed, 13 Aug 2014 20:54:27 +0800 Subject: [PATCH 09/10] Auto-Pause At Function Call and System Call. Would have a configuration window (with create the list, and enable/disable, being something similar to VFSManger and etc). Move the code to Debug::AutoPause in AutoPause.cpp and AutoPause.h It triggers currently in GameViewer, and would finally change to somewhere else. Well and now it is all enabled (Function call + System call) by default. --- Utilities/AutoPause.cpp | 130 +++++++++++++++++++++++++++ Utilities/AutoPause.h | 29 ++++++ rpcs3/Emu/SysCalls/ModuleManager.cpp | 47 ---------- rpcs3/Emu/SysCalls/ModuleManager.h | 2 - rpcs3/Emu/SysCalls/SysCalls.cpp | 4 + rpcs3/Gui/GameViewer.cpp | 4 + rpcs3/emucore.vcxproj | 2 + rpcs3/emucore.vcxproj.filters | 6 ++ 8 files changed, 175 insertions(+), 49 deletions(-) create mode 100644 Utilities/AutoPause.cpp create mode 100644 Utilities/AutoPause.h diff --git a/Utilities/AutoPause.cpp b/Utilities/AutoPause.cpp new file mode 100644 index 0000000000..ad7e3ddd80 --- /dev/null +++ b/Utilities/AutoPause.cpp @@ -0,0 +1,130 @@ +#include "stdafx.h" +#include "AutoPause.h" + +using namespace Debug; + +//Even different from those tutorials on webpages, i use the method similiar from Log.h +//TODO:: Question: Does such a Singleton struct get fully deallocated after its pointer? +AutoPause* gAutoPause = nullptr; + +AutoPause& AutoPause::getInstance(void) +{ + if (!gAutoPause) + { + gAutoPause = new AutoPause(); + } + return *gAutoPause; +} + +//Still use binary format. Default Setting should be "disable all auto-pause". +AutoPause::AutoPause(void) +{ + m_pause_function.reserve(16); + m_pause_syscall.reserve(16); + initialized = false; + //Reload(false, false); + Reload(true, true); //Temporarily use auto enable +} + +//Notice: I would not allow to write the binary to file in this command. +AutoPause::~AutoPause(void) +{ + initialized = false; + m_pause_function.clear(); + m_pause_syscall.clear(); + m_pause_function_enable = false; + m_pause_syscall_enable = false; +} + +//Load Auto-Pause Configuration from file "pause.bin" +//This would be able to create in a GUI window. +void AutoPause::Reload(void) +{ + if (rExists("pause.bin")) + { + m_pause_function.clear(); + m_pause_function.reserve(16); + m_pause_syscall.clear(); + m_pause_syscall.reserve(16); + + rFile list; + list.Open("pause.bin", rFile::read); + //System calls ID and Function calls ID are all u32 iirc. + u32 num; + size_t fmax = list.Length(); + size_t fcur = 0; + list.Seek(0); + while (fcur <= fmax - sizeof(u32)) + { + list.Read(&num, sizeof(u32)); + fcur += sizeof(u32); + if (num == 0xFFFFFFFF) break; + + if (num < 1024) + { + //Less than 1024 - be regarded as a system call. + //emplace_back may not cause reductant move/copy operation. + m_pause_syscall.emplace_back(num); + LOG_WARNING(HLE, "Auto-Pause: Find System Call ID %x", num); + } + else + { + m_pause_function.emplace_back(num); + LOG_WARNING(HLE, "Auto-Pause: Find Function Call ID %x", num); + } + } + list.Close(); + } + else + { + LOG_WARNING(HLE, "No Pause ID specified in pause.bin, Auto-Pause would not act."); + } + + initialized = true; +} + +void AutoPause::Reload(bool enable_pause_syscall, bool enable_pause_function) +{ + Reload(); + m_pause_syscall_enable = enable_pause_syscall; + m_pause_function_enable = enable_pause_function; +} + +void AutoPause::TryPause(u32 code) { + if (code < 1024) + { + //Would first check Enable setting. Then the list length. + if ((!m_pause_syscall_enable) + || (m_pause_syscall.size() <= 0)) + { + return; + } + + for (u32 i = 0; i < m_pause_syscall.size(); ++i) + { + if (code == m_pause_syscall[i]) + { + Emu.Pause(); + LOG_ERROR(HLE, "Auto-Pause Triggered: System call %x", code); //Used Error + } + } + } + else + { + //Well similiar.. Seperate the list caused by possible setting difference. + if ((!m_pause_function_enable) + || (m_pause_function.size() <= 0)) + { + return; + } + + for (u32 i = 0; i < m_pause_function.size(); ++i) + { + if (code == m_pause_function[i]) + { + Emu.Pause(); + LOG_ERROR(HLE, "Auto-Pause Triggered: Function call %x", code); //Used Error + } + } + } +} \ No newline at end of file diff --git a/Utilities/AutoPause.h b/Utilities/AutoPause.h new file mode 100644 index 0000000000..b62ed47eb9 --- /dev/null +++ b/Utilities/AutoPause.h @@ -0,0 +1,29 @@ +#pragma once +#include "Utilities/Log.h" +#include "Utilities/rFile.h" +#include "Emu/System.h" + +//Regarded as a Debugger Enchantment +namespace Debug { + //To store the pause function/call id, and let those pause there. + //Would be with a GUI to configure those. + struct AutoPause + { + std::vector m_pause_syscall; + std::vector m_pause_function; + bool initialized; + bool m_pause_syscall_enable; + bool m_pause_function_enable; + + AutoPause(); + ~AutoPause(); + public: + static AutoPause& getInstance(void); + + void Reload(bool enable_pause_syscall, bool enable_pause_function); + + void Reload(void); + + void TryPause(u32 code); + }; +} \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/ModuleManager.cpp b/rpcs3/Emu/SysCalls/ModuleManager.cpp index 57f8085848..5e1d472032 100644 --- a/rpcs3/Emu/SysCalls/ModuleManager.cpp +++ b/rpcs3/Emu/SysCalls/ModuleManager.cpp @@ -263,7 +263,6 @@ void ModuleManager::init() m_mod_init.emplace_back(0x000e, sys_fs_init); initialized = true; } - LoadFuncPauses(); //Load the list of pause functions } ModuleManager::ModuleManager() : @@ -294,17 +293,6 @@ bool ModuleManager::IsLoadedFunc(u32 id) bool ModuleManager::CallFunc(u32 num) { - //Pause at specified function calls - for (u32 i = 0; i < m_funcs_pause_funcs.size(); ++i) - { - //Add Call Pause Here. This call is from BLJS10157 - if (num == m_funcs_pause_funcs[i]) - { - Emu.Pause(); //So it is now pause, yep. - LOG_ERROR(HLE, "AUTO PAUSE AT %x", num); //Used Error - } - } - func_caller* func = nullptr; { std::lock_guard lock(m_funcs_lock); @@ -375,9 +363,6 @@ void ModuleManager::UnloadModules() std::lock_guard lock(m_funcs_lock); m_modules_funcs_list.clear(); - - //unload pause list - m_funcs_pause_funcs.clear(); } Module* ModuleManager::GetModuleByName(const std::string& name) @@ -477,36 +462,4 @@ void ModuleManager::AddFunc(ModuleFunc *func) { m_modules_funcs_list.push_back(func); } -} - -//read pause.bin to get some function id that should auto-pause at call. -//you can make this file with Hex Editors, such as MadEdit.. -//you can find the function ids in \rpcs3\rpcs3\Emu\SysCalls\FuncList.cpp -//or just by searching the function name with grep within repo. -//Example if i want it to pause at 0x1051d134, i create the file with 34D15110(Hex, start from 00). -void ModuleManager::LoadFuncPauses(void) -{ - if (rExists("pause.bin")) - { - m_funcs_pause_funcs.reserve(16); - rFile list; - list.Open("pause.bin", rFile::read); - u32 num; - size_t fmax = list.Length(); - size_t fcur = 0; - list.Seek(0); - while (fcur <= fmax - sizeof(u32)) - { - list.Read(&num, sizeof(u32)); - fcur += sizeof(u32); - if (num == 0xFFFFFFFF) break; - m_funcs_pause_funcs.push_back(num); - LOG_WARNING(HLE, "Read Pause Function ID: %x", num); - } - list.Close(); - } - else - { - LOG_WARNING(HLE, "No Pause Function ID specified in pause.bin"); - } } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/ModuleManager.h b/rpcs3/Emu/SysCalls/ModuleManager.h index 8b10ec24c7..4ff1c96f40 100644 --- a/rpcs3/Emu/SysCalls/ModuleManager.h +++ b/rpcs3/Emu/SysCalls/ModuleManager.h @@ -10,7 +10,6 @@ class ModuleManager std::vector m_modules_funcs_list; std::vector m_mod_init; bool initialized; - std::vector m_funcs_pause_funcs; public: ModuleManager(); ~ModuleManager(); @@ -25,5 +24,4 @@ public: u32 GetFuncNumById(u32 id); Module* GetModuleByName(const std::string& name); Module* GetModuleById(u16 id); - void LoadFuncPauses(void); }; \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/SysCalls.cpp b/rpcs3/Emu/SysCalls/SysCalls.cpp index d908755f74..da13269249 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.cpp +++ b/rpcs3/Emu/SysCalls/SysCalls.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "Utilities/Log.h" +#include "Utilities/AutoPause.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -919,6 +920,9 @@ void default_syscall() void SysCalls::DoSyscall(u32 code) { + //Auto-Pause using simple singleton. + Debug::AutoPause::getInstance().TryPause(code); + if(code < 1024) { (*sc_table[code])(); diff --git a/rpcs3/Gui/GameViewer.cpp b/rpcs3/Gui/GameViewer.cpp index f709031bb8..77d1b017c5 100644 --- a/rpcs3/Gui/GameViewer.cpp +++ b/rpcs3/Gui/GameViewer.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "Utilities/AutoPause.h" #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" @@ -204,6 +205,9 @@ void GameViewer::DClick(wxListEvent& event) const std::string& path = m_path + m_game_data[i].root; Emu.Stop(); + + Debug::AutoPause::getInstance().Reload(); + Emu.GetVFS().Init(path); std::string local_path; if (Emu.GetVFS().GetDevice(path, local_path) && !Emu.BootGame(local_path)) { diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 37ce298aca..81ff0fdffb 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -27,6 +27,7 @@ + @@ -211,6 +212,7 @@ + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index b5828b0a70..034c7a7020 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -590,6 +590,9 @@ Emu\SysCalls\lv2 + + Utilities + @@ -1123,5 +1126,8 @@ Emu\SysCalls\lv2 + + Utilities + \ No newline at end of file From 134ee1eff0039161a74bc7127ffea75c95939b78 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Wed, 13 Aug 2014 17:00:37 +0300 Subject: [PATCH 10/10] Somewhat implemented cellGcmSetFlipImmediate Also a small change (optimization?) in cellGcmSetPrepareFlip() --- rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp index e36b976f48..a8310a7bc1 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp @@ -440,7 +440,7 @@ s32 cellGcmSetPrepareFlip(mem_ptr_t ctxt, u32 id) { cellGcmSys->Log("cellGcmSetPrepareFlip(ctx=0x%x, id=0x%x)", ctxt.GetAddr(), id); - if(id >= 8) + if(id > 7) { cellGcmSys->Error("cellGcmSetPrepareFlip : CELL_GCM_ERROR_FAILURE"); return CELL_GCM_ERROR_FAILURE; @@ -700,9 +700,18 @@ int cellGcmInitSystemMode(u64 mode) return CELL_OK; } -int cellGcmSetFlipImmediate() +int cellGcmSetFlipImmediate(u8 id) { - UNIMPLEMENTED_FUNC(cellGcmSys); + cellGcmSys->Todo("cellGcmSetFlipImmediate(fid=0x%x)", id); + + if (id > 7) + { + cellGcmSys->Error("cellGcmSetFlipImmediate : CELL_GCM_ERROR_FAILURE"); + return CELL_GCM_ERROR_FAILURE; + } + + cellGcmSetFlipMode(id); + return CELL_OK; }