mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-09 01:29:23 +00:00
Merge pull request #738 from Syphurith/patch-1
Auto-Pause at specified function call.
This commit is contained in:
commit
7645f9a3dd
2 changed files with 49 additions and 1 deletions
|
@ -263,6 +263,7 @@ void ModuleManager::init()
|
||||||
m_mod_init.emplace_back(0x000e, sys_fs_init);
|
m_mod_init.emplace_back(0x000e, sys_fs_init);
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
LoadFuncPauses(); //Load the list of pause functions
|
||||||
}
|
}
|
||||||
|
|
||||||
ModuleManager::ModuleManager() :
|
ModuleManager::ModuleManager() :
|
||||||
|
@ -293,6 +294,17 @@ bool ModuleManager::IsLoadedFunc(u32 id)
|
||||||
|
|
||||||
bool ModuleManager::CallFunc(u32 num)
|
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;
|
func_caller* func = nullptr;
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(m_funcs_lock);
|
std::lock_guard<std::mutex> lock(m_funcs_lock);
|
||||||
|
@ -306,6 +318,7 @@ bool ModuleManager::CallFunc(u32 num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (func)
|
if (func)
|
||||||
{
|
{
|
||||||
(*func)();
|
(*func)();
|
||||||
|
@ -362,6 +375,9 @@ void ModuleManager::UnloadModules()
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(m_funcs_lock);
|
std::lock_guard<std::mutex> lock(m_funcs_lock);
|
||||||
m_modules_funcs_list.clear();
|
m_modules_funcs_list.clear();
|
||||||
|
|
||||||
|
//unload pause list
|
||||||
|
m_funcs_pause_funcs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Module* ModuleManager::GetModuleByName(const std::string& name)
|
Module* ModuleManager::GetModuleByName(const std::string& name)
|
||||||
|
@ -463,3 +479,34 @@ void ModuleManager::AddFunc(ModuleFunc *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");
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ class ModuleManager
|
||||||
std::vector<ModuleFunc *> m_modules_funcs_list;
|
std::vector<ModuleFunc *> m_modules_funcs_list;
|
||||||
std::vector<Module> m_mod_init;
|
std::vector<Module> m_mod_init;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
|
std::vector<u32> m_funcs_pause_funcs;
|
||||||
public:
|
public:
|
||||||
ModuleManager();
|
ModuleManager();
|
||||||
~ModuleManager();
|
~ModuleManager();
|
||||||
|
@ -24,5 +25,5 @@ public:
|
||||||
u32 GetFuncNumById(u32 id);
|
u32 GetFuncNumById(u32 id);
|
||||||
Module* GetModuleByName(const std::string& name);
|
Module* GetModuleByName(const std::string& name);
|
||||||
Module* GetModuleById(u16 id);
|
Module* GetModuleById(u16 id);
|
||||||
|
void LoadFuncPauses(void);
|
||||||
};
|
};
|
Loading…
Add table
Add a link
Reference in a new issue