mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-16 03:38:38 +12:00
initial start to eliminate static func init, not compilable atm
move module initialization into a module manager, still has some issues like stopping not working and debug crashing add #idef 0 to modules that aren't in the windows project don't double initialize and don't de-initialize for now, since many modules don't expect it and it leads to many errors remove duplicate module lists for empty modules and implemented ones, make Module non-copyable but movable add secondary project, no real use for it now add some memleak config to the emucore and add asmjit path to rpcs3 small rebase error fixed to get it to compile again add filters for emucore re-add the module manager and static file WIP commit, linker errors abound some more abstraction layer stuff fix the remaining linker errors, re-enable platform specific mouse, pad and keyboard handlers rebasing fix memset undefined and re() usage of se_t before declaration Add wxGUI define by default for cmake builds fix copy constructors of Datetime header fix copy constructors of other wx interface classes remove static declarations of global variables make wxGLCanvas constructor non-ambiguous even with wx2.8. compat mode, fix wrong std::exception constructor calls remove duplicate definition for FromUTF8 and ToUTF8 temp changes
This commit is contained in:
parent
c4e3ec825e
commit
c37905e465
156 changed files with 6567 additions and 4611 deletions
|
@ -5,10 +5,9 @@
|
|||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Static.h"
|
||||
|
||||
extern std::vector<SFunc*> g_static_funcs_list;
|
||||
|
||||
void StaticAnalyse(void* ptr, u32 size, u32 base)
|
||||
void StaticFuncManager::StaticAnalyse(void* ptr, u32 size, u32 base)
|
||||
{
|
||||
u32* data = (u32*)ptr; size /= 4;
|
||||
|
||||
|
@ -18,13 +17,13 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
// TODO: optimize search
|
||||
for (u32 i = 0; i < size; i++)
|
||||
{
|
||||
for (u32 j = 0; j < g_static_funcs_list.size(); j++)
|
||||
for (u32 j = 0; j < m_static_funcs_list.size(); j++)
|
||||
{
|
||||
if ((data[i] & g_static_funcs_list[j]->ops[0].mask) == g_static_funcs_list[j]->ops[0].crc)
|
||||
if ((data[i] & m_static_funcs_list[j]->ops[0].mask) == m_static_funcs_list[j]->ops[0].crc)
|
||||
{
|
||||
bool found = true;
|
||||
u32 can_skip = 0;
|
||||
for (u32 k = i, x = 0; x + 1 <= g_static_funcs_list[j]->ops.size(); k++, x++)
|
||||
for (u32 k = i, x = 0; x + 1 <= m_static_funcs_list[j]->ops.size(); k++, x++)
|
||||
{
|
||||
if (k >= size)
|
||||
{
|
||||
|
@ -39,8 +38,8 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
continue;
|
||||
}
|
||||
|
||||
const u32 mask = g_static_funcs_list[j]->ops[x].mask;
|
||||
const u32 crc = g_static_funcs_list[j]->ops[x].crc;
|
||||
const u32 mask = m_static_funcs_list[j]->ops[x].mask;
|
||||
const u32 crc = m_static_funcs_list[j]->ops[x].crc;
|
||||
|
||||
if (!mask)
|
||||
{
|
||||
|
@ -86,8 +85,8 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
}
|
||||
if (found)
|
||||
{
|
||||
ConLog.Write("Function '%s' hooked (addr=0x%x)", g_static_funcs_list[j]->name, i * 4 + base);
|
||||
g_static_funcs_list[j]->found++;
|
||||
ConLog.Write("Function '%s' hooked (addr=0x%x)", m_static_funcs_list[j]->name, i * 4 + base);
|
||||
m_static_funcs_list[j]->found++;
|
||||
data[i+0] = re32(0x39600000 | j); // li r11, j
|
||||
data[i+1] = se32(0x44000003); // sc 3
|
||||
data[i+2] = se32(0x4e800020); // blr
|
||||
|
@ -98,11 +97,11 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
}
|
||||
|
||||
// check function groups
|
||||
for (u32 i = 0; i < g_static_funcs_list.size(); i++)
|
||||
for (u32 i = 0; i < m_static_funcs_list.size(); i++)
|
||||
{
|
||||
if (g_static_funcs_list[i]->found) // start from some group
|
||||
if (m_static_funcs_list[i]->found) // start from some group
|
||||
{
|
||||
const u64 group = g_static_funcs_list[i]->group;
|
||||
const u64 group = m_static_funcs_list[i]->group;
|
||||
|
||||
enum GroupSearchResult : u32
|
||||
{
|
||||
|
@ -113,24 +112,24 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
u32 res = GSR_SUCCESS;
|
||||
|
||||
// analyse
|
||||
for (u32 j = 0; j < g_static_funcs_list.size(); j++) if (g_static_funcs_list[j]->group == group)
|
||||
for (u32 j = 0; j < m_static_funcs_list.size(); j++) if (m_static_funcs_list[j]->group == group)
|
||||
{
|
||||
u32 count = g_static_funcs_list[j]->found;
|
||||
u32 count = m_static_funcs_list[j]->found;
|
||||
|
||||
if (count == 0) // not found
|
||||
{
|
||||
// check if this function has been found with different pattern
|
||||
for (u32 k = 0; k < g_static_funcs_list.size(); k++) if (g_static_funcs_list[k]->group == group)
|
||||
for (u32 k = 0; k < m_static_funcs_list.size(); k++) if (m_static_funcs_list[k]->group == group)
|
||||
{
|
||||
if (k != j && g_static_funcs_list[k]->ptr == g_static_funcs_list[j]->ptr)
|
||||
if (k != j && m_static_funcs_list[k]->ptr == m_static_funcs_list[j]->ptr)
|
||||
{
|
||||
count += g_static_funcs_list[k]->found;
|
||||
count += m_static_funcs_list[k]->found;
|
||||
}
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
res |= GSR_MISSING;
|
||||
ConLog.Error("Function '%s' not found", g_static_funcs_list[j]->name);
|
||||
ConLog.Error("Function '%s' not found", m_static_funcs_list[j]->name);
|
||||
}
|
||||
else if (count > 1)
|
||||
{
|
||||
|
@ -140,14 +139,14 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
else if (count == 1) // found
|
||||
{
|
||||
// ensure that this function has NOT been found with different pattern
|
||||
for (u32 k = 0; k < g_static_funcs_list.size(); k++) if (g_static_funcs_list[k]->group == group)
|
||||
for (u32 k = 0; k < m_static_funcs_list.size(); k++) if (m_static_funcs_list[k]->group == group)
|
||||
{
|
||||
if (k != j && g_static_funcs_list[k]->ptr == g_static_funcs_list[j]->ptr)
|
||||
if (k != j && m_static_funcs_list[k]->ptr == m_static_funcs_list[j]->ptr)
|
||||
{
|
||||
if (g_static_funcs_list[k]->found)
|
||||
if (m_static_funcs_list[k]->found)
|
||||
{
|
||||
res |= GSR_EXCESS;
|
||||
ConLog.Error("Function '%s' hooked twice", g_static_funcs_list[j]->name);
|
||||
ConLog.Error("Function '%s' hooked twice", m_static_funcs_list[j]->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -155,14 +154,14 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
else
|
||||
{
|
||||
res |= GSR_EXCESS;
|
||||
ConLog.Error("Function '%s' hooked twice", g_static_funcs_list[j]->name);
|
||||
ConLog.Error("Function '%s' hooked twice", m_static_funcs_list[j]->name);
|
||||
}
|
||||
}
|
||||
|
||||
// clear data
|
||||
for (u32 j = 0; j < g_static_funcs_list.size(); j++)
|
||||
for (u32 j = 0; j < m_static_funcs_list.size(); j++)
|
||||
{
|
||||
if (g_static_funcs_list[j]->group == group) g_static_funcs_list[j]->found = 0;
|
||||
if (m_static_funcs_list[j]->group == group) m_static_funcs_list[j]->found = 0;
|
||||
}
|
||||
|
||||
char name[9] = "????????";
|
||||
|
@ -183,11 +182,11 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
}
|
||||
}
|
||||
|
||||
void StaticExecute(u32 code)
|
||||
void StaticFuncManager::StaticExecute(u32 code)
|
||||
{
|
||||
if (code < g_static_funcs_list.size())
|
||||
if (code < m_static_funcs_list.size())
|
||||
{
|
||||
(*g_static_funcs_list[code]->func)();
|
||||
(*m_static_funcs_list[code]->func)();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -195,7 +194,26 @@ void StaticExecute(u32 code)
|
|||
}
|
||||
}
|
||||
|
||||
void StaticFinalize()
|
||||
void StaticFuncManager::StaticFinalize()
|
||||
{
|
||||
g_static_funcs_list.clear();
|
||||
m_static_funcs_list.clear();
|
||||
}
|
||||
|
||||
void StaticFuncManager::push_back(SFunc *ele)
|
||||
{
|
||||
m_static_funcs_list.push_back(ele);
|
||||
}
|
||||
|
||||
SFunc *StaticFuncManager::operator[](size_t i)
|
||||
{
|
||||
return m_static_funcs_list[i];
|
||||
}
|
||||
|
||||
StaticFuncManager::~StaticFuncManager()
|
||||
{
|
||||
for (SFunc *s : m_static_funcs_list)
|
||||
{
|
||||
delete s;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue