Loader improved, ModuleManager refactored

This commit is contained in:
Nekotekina 2015-02-18 19:22:06 +03:00
parent 1f2eafc4f2
commit af986d8f4c
72 changed files with 3684 additions and 3839 deletions

View file

@ -1182,11 +1182,15 @@ void ThreadBase::Start()
} }
catch (const char* e) catch (const char* e)
{ {
LOG_ERROR(GENERAL, "%s: %s", GetThreadName().c_str(), e); LOG_ERROR(GENERAL, "Exception: %s", e);
DumpInformation();
Emu.Pause();
} }
catch (const std::string& e) catch (const std::string& e)
{ {
LOG_ERROR(GENERAL, "%s: %s", GetThreadName().c_str(), e.c_str()); LOG_ERROR(GENERAL, "Exception: %s", e);
DumpInformation();
Emu.Pause();
} }
m_alive = false; m_alive = false;
@ -1325,11 +1329,13 @@ void thread_t::start(std::function<void()> func)
} }
catch (const char* e) catch (const char* e)
{ {
LOG_ERROR(GENERAL, "%s: %s", name.c_str(), e); LOG_ERROR(GENERAL, "Exception: %s", e);
Emu.Pause();
} }
catch (const std::string& e) catch (const std::string& e)
{ {
LOG_ERROR(GENERAL, "%s: %s", name.c_str(), e.c_str()); LOG_ERROR(GENERAL, "Exception: %s", e.c_str());
Emu.Pause();
} }
if (Emu.IsStopped()) if (Emu.IsStopped())

View file

@ -24,8 +24,9 @@ public:
virtual void SetThreadName(const std::string& name); virtual void SetThreadName(const std::string& name);
void WaitForAnySignal(u64 time = 1); void WaitForAnySignal(u64 time = 1);
void Notify(); void Notify();
virtual void DumpInformation() {}
}; };
NamedThreadBase* GetCurrentNamedThread(); NamedThreadBase* GetCurrentNamedThread();

View file

@ -7,6 +7,19 @@ std::vector<psv_log_base*> g_psv_modules;
void add_psv_func(psv_func& data) void add_psv_func(psv_func& data)
{ {
for (auto& f : g_psv_func_list)
{
if (f.nid == data.nid && &f - g_psv_func_list.data() >= 2 /* special functions count */)
{
if (data.func)
{
f.func = data.func;
}
return;
}
}
g_psv_func_list.push_back(data); g_psv_func_list.push_back(data);
} }
@ -27,29 +40,47 @@ u32 get_psv_func_index(const psv_func* func)
{ {
auto res = func - g_psv_func_list.data(); auto res = func - g_psv_func_list.data();
assert((size_t)res < g_psv_func_list.size()); if ((size_t)res >= g_psv_func_list.size())
{
throw __FUNCTION__;
}
return (u32)res; return (u32)res;
} }
const psv_func* get_psv_func_by_index(u32 index) const psv_func* get_psv_func_by_index(u32 index)
{ {
assert(index < g_psv_func_list.size()); if (index >= g_psv_func_list.size())
{
return nullptr;
}
return &g_psv_func_list[index]; return &g_psv_func_list[index];
} }
void execute_psv_func_by_index(ARMv7Context& context, u32 index) void execute_psv_func_by_index(ARMv7Context& context, u32 index)
{ {
auto func = get_psv_func_by_index(index); if (auto func = get_psv_func_by_index(index))
{
auto old_last_syscall = context.thread.m_last_syscall; auto old_last_syscall = context.thread.m_last_syscall;
context.thread.m_last_syscall = func->nid; context.thread.m_last_syscall = func->nid;
if (func->func)
{
(*func->func)(context); (*func->func)(context);
}
else
{
throw "Unimplemented function";
}
context.thread.m_last_syscall = old_last_syscall; context.thread.m_last_syscall = old_last_syscall;
} }
else
{
throw "Invalid function index";
}
}
extern psv_log_base sceAppMgr; extern psv_log_base sceAppMgr;
extern psv_log_base sceAppUtil; extern psv_log_base sceAppUtil;

View file

@ -472,7 +472,7 @@ namespace psv_func_detail
// Basic information about the HLE function // Basic information about the HLE function
struct psv_func struct psv_func
{ {
u32 nid; // Unique function ID only for old PSV executables (should be generated individually for each elf loaded) u32 nid; // Unique function ID (should be generated individually for each elf loaded)
const char* name; // Function name for information const char* name; // Function name for information
std::shared_ptr<psv_func_caller> func; // Function caller instance std::shared_ptr<psv_func_caller> func; // Function caller instance
psv_log_base* module; // Module for information psv_log_base* module; // Module for information

View file

@ -37,6 +37,76 @@ CPUThread::~CPUThread()
safe_delete(m_dec); safe_delete(m_dec);
} }
void CPUThread::DumpInformation()
{
auto get_syscall_name = [this](u64 syscall) -> std::string
{
switch (GetType())
{
case CPU_THREAD_ARMv7:
{
if ((u32)syscall == syscall)
{
if (syscall)
{
if (auto func = get_psv_func_by_nid((u32)syscall))
{
return func->name;
}
}
else
{
return{};
}
}
return "unknown function";
}
case CPU_THREAD_PPU:
{
if ((u32)syscall == syscall)
{
if (syscall)
{
if (syscall < 1024)
{
// TODO:
//return SysCalls::GetSyscallName((u32)syscall);
return "unknown syscall";
}
else
{
return SysCalls::GetHLEFuncName((u32)syscall);
}
}
else
{
return{};
}
}
return "unknown function";
}
case CPU_THREAD_SPU:
case CPU_THREAD_RAW_SPU:
default:
{
if (!syscall)
{
return{};
}
return "unknown function";
}
}
};
LOG_ERROR(GENERAL, "Information: is_alive=%d, m_last_syscall=0x%llx (%s)", IsAlive(), m_last_syscall, get_syscall_name(m_last_syscall));
LOG_WARNING(GENERAL, RegsToString());
}
bool CPUThread::IsRunning() const { return m_status == Running; } bool CPUThread::IsRunning() const { return m_status == Running; }
bool CPUThread::IsPaused() const { return m_status == Paused; } bool CPUThread::IsPaused() const { return m_status == Paused; }
bool CPUThread::IsStopped() const { return m_status == Stopped; } bool CPUThread::IsStopped() const { return m_status == Stopped; }
@ -246,70 +316,6 @@ void CPUThread::ExecOnce()
void CPUThread::Task() void CPUThread::Task()
{ {
auto get_syscall_name = [this](u64 syscall) -> std::string
{
switch (GetType())
{
case CPU_THREAD_ARMv7:
{
if ((u32)syscall == syscall)
{
if (syscall)
{
if (auto func = get_psv_func_by_nid((u32)syscall))
{
return func->name;
}
}
else
{
return{};
}
}
return "unknown function";
}
case CPU_THREAD_PPU:
{
if ((u32)syscall == syscall)
{
if (syscall)
{
if (syscall < 1024)
{
// TODO:
//return SysCalls::GetSyscallName((u32)syscall);
return "unknown syscall";
}
else
{
return SysCalls::GetHLEFuncName((u32)syscall);
}
}
else
{
return{};
}
}
return "unknown function";
}
case CPU_THREAD_SPU:
case CPU_THREAD_RAW_SPU:
default:
{
if (!syscall)
{
return{};
}
return "unknown function";
}
}
};
if (Ini.HLELogging.GetValue()) LOG_NOTICE(GENERAL, "%s enter", CPUThread::GetFName().c_str()); if (Ini.HLELogging.GetValue()) LOG_NOTICE(GENERAL, "%s enter", CPUThread::GetFName().c_str());
const std::vector<u64>& bp = Emu.GetBreakPoints(); const std::vector<u64>& bp = Emu.GetBreakPoints();
@ -325,8 +331,6 @@ void CPUThread::Task()
std::vector<u32> trace; std::vector<u32> trace;
try
{
while (true) while (true)
{ {
int status = ThreadStatus(); int status = ThreadStatus();
@ -343,7 +347,8 @@ void CPUThread::Task()
} }
Step(); Step();
//if (m_trace_enabled) trace.push_back(PC); //if (m_trace_enabled)
//trace.push_back(PC);
NextPc(m_dec->DecodeMemory(PC + m_offset)); NextPc(m_dec->DecodeMemory(PC + m_offset));
if (status == CPUThread_Step) if (status == CPUThread_Step)
@ -361,19 +366,6 @@ void CPUThread::Task()
} }
} }
} }
}
catch (const std::string& e)
{
LOG_ERROR(GENERAL, "Exception: %s (is_alive=%d, m_last_syscall=0x%llx (%s))", e, IsAlive(), m_last_syscall, get_syscall_name(m_last_syscall));
LOG_NOTICE(GENERAL, RegsToString());
Emu.Pause();
}
catch (const char* e)
{
LOG_ERROR(GENERAL, "Exception: %s (is_alive=%d, m_last_syscall=0x%llx (%s))", e, IsAlive(), m_last_syscall, get_syscall_name(m_last_syscall));
LOG_NOTICE(GENERAL, RegsToString());
Emu.Pause();
}
if (trace.size()) if (trace.size())
{ {
@ -383,7 +375,7 @@ void CPUThread::Task()
for (auto& v : trace) //LOG_NOTICE(GENERAL, "PC = 0x%x", v); for (auto& v : trace) //LOG_NOTICE(GENERAL, "PC = 0x%x", v);
{ {
if (v - prev != 4) if (v - prev != 4 && v - prev != 2)
{ {
LOG_NOTICE(GENERAL, "Trace: 0x%08x .. 0x%08x", start, prev); LOG_NOTICE(GENERAL, "Trace: 0x%08x .. 0x%08x", start, prev);
start = v; start = v;
@ -394,6 +386,5 @@ void CPUThread::Task()
LOG_NOTICE(GENERAL, "Trace end: 0x%08x .. 0x%08x", start, prev); LOG_NOTICE(GENERAL, "Trace end: 0x%08x .. 0x%08x", start, prev);
} }
if (Ini.HLELogging.GetValue()) LOG_NOTICE(GENERAL, "%s leave", CPUThread::GetFName().c_str()); if (Ini.HLELogging.GetValue()) LOG_NOTICE(GENERAL, "%s leave", CPUThread::GetFName().c_str());
} }

View file

@ -44,6 +44,8 @@ protected:
bool m_trace_call_stack; bool m_trace_call_stack;
virtual void DumpInformation() override;
public: public:
virtual void InitRegs() = 0; virtual void InitRegs() = 0;

View file

@ -170,4 +170,3 @@ public:
return encode(data, value); return encode(data, value);
} }
}; };

View file

@ -1030,6 +1030,10 @@ private:
Write(fmt::Format("bc [%x:%x:%x:%x:%x], cr%d[%x], 0x%x, %d, %d", bo0, bo1, bo2, bo3, bo4, bi/4, bi%4, bd, aa, lk)); Write(fmt::Format("bc [%x:%x:%x:%x:%x], cr%d[%x], 0x%x, %d, %d", bo0, bo1, bo2, bo3, bo4, bi/4, bi%4, bd, aa, lk));
} }
void HACK(u32 index)
{
Write(fmt::Format("hack %d", index));
}
void SC(u32 lev) void SC(u32 lev)
{ {
switch (lev) switch (lev)

View file

@ -177,6 +177,8 @@ namespace PPU_instr
//This immediate field is used to specify a 16-bit unsigned integer //This immediate field is used to specify a 16-bit unsigned integer
static CodeField<16, 31> uimm16; static CodeField<16, 31> uimm16;
static CodeField<6, 31> uimm26;
/* /*
Record bit. Record bit.
0 Does not update the condition register (CR). 0 Does not update the condition register (CR).
@ -241,6 +243,7 @@ namespace PPU_instr
bind_instr(main_list, ADDI, RD, RA, simm16); bind_instr(main_list, ADDI, RD, RA, simm16);
bind_instr(main_list, ADDIS, RD, RA, simm16); bind_instr(main_list, ADDIS, RD, RA, simm16);
bind_instr(main_list, BC, BO, BI, BD, AA, LK); bind_instr(main_list, BC, BO, BI, BD, AA, LK);
bind_instr(main_list, HACK, uimm26);
bind_instr(main_list, SC, LEV); bind_instr(main_list, SC, LEV);
bind_instr(main_list, B, LI, AA, LK); bind_instr(main_list, B, LI, AA, LK);
bind_instr(main_list, RLWIMI, RA, RS, SH, MB, ME, RC); bind_instr(main_list, RLWIMI, RA, RS, SH, MB, ME, RC);

View file

@ -2253,6 +2253,10 @@ private:
if(lk) CPU.LR = nextLR; if(lk) CPU.LR = nextLR;
} }
} }
void HACK(u32 index)
{
execute_ps3_func_by_index(CPU, index);
}
void SC(u32 lev) void SC(u32 lev)
{ {
switch (lev) switch (lev)

View file

@ -1995,6 +1995,10 @@ void Compiler::BC(u32 bo, u32 bi, s32 bd, u32 aa, u32 lk) {
CreateBranch(CheckBranchCondition(bo, bi), target_i32, lk ? true : false); CreateBranch(CheckBranchCondition(bo, bi), target_i32, lk ? true : false);
} }
void Compiler::HACK(u32 index) {
Call<void>("execute_ps3_func_by_index", &execute_ps3_func_by_index, m_state.args[CompileTaskState::Args::State], m_ir_builder->getInt32(index));
}
void Compiler::SC(u32 lev) { void Compiler::SC(u32 lev) {
switch (lev) { switch (lev) {
case 0: case 0:

View file

@ -469,6 +469,7 @@ namespace ppu_recompiler_llvm {
void ADDI(u32 rd, u32 ra, s32 simm16) override; void ADDI(u32 rd, u32 ra, s32 simm16) override;
void ADDIS(u32 rd, u32 ra, s32 simm16) override; void ADDIS(u32 rd, u32 ra, s32 simm16) override;
void BC(u32 bo, u32 bi, s32 bd, u32 aa, u32 lk) override; void BC(u32 bo, u32 bi, s32 bd, u32 aa, u32 lk) override;
void HACK(u32 id) override;
void SC(u32 sc_code) override; void SC(u32 sc_code) override;
void B(s32 ll, u32 aa, u32 lk) override; void B(s32 ll, u32 aa, u32 lk) override;
void MCRF(u32 crfd, u32 crfs) override; void MCRF(u32 crfd, u32 crfs) override;

View file

@ -4,6 +4,7 @@ namespace PPU_opcodes
{ {
enum PPU_MainOpcodes enum PPU_MainOpcodes
{ {
HACK = 0x01, //HLE Call
TDI = 0x02, //Trap Doubleword Immediate TDI = 0x02, //Trap Doubleword Immediate
TWI = 0x03, //Trap Word Immediate TWI = 0x03, //Trap Word Immediate
G_04 = 0x04, G_04 = 0x04,
@ -648,6 +649,7 @@ public:
virtual void ADDI(u32 rd, u32 ra, s32 simm16) = 0; virtual void ADDI(u32 rd, u32 ra, s32 simm16) = 0;
virtual void ADDIS(u32 rd, u32 ra, s32 simm16) = 0; virtual void ADDIS(u32 rd, u32 ra, s32 simm16) = 0;
virtual void BC(u32 bo, u32 bi, s32 bd, u32 aa, u32 lk) = 0; virtual void BC(u32 bo, u32 bi, s32 bd, u32 aa, u32 lk) = 0;
virtual void HACK(u32 index) = 0;
virtual void SC(u32 lev) = 0; virtual void SC(u32 lev) = 0;
virtual void B(s32 ll, u32 aa, u32 lk) = 0; virtual void B(s32 ll, u32 aa, u32 lk) = 0;
virtual void MCRF(u32 crfd, u32 crfs) = 0; virtual void MCRF(u32 crfd, u32 crfs) = 0;

View file

@ -1,328 +1,217 @@
#include "stdafx.h" #include "stdafx.h"
#include "ModuleManager.h" #include "ModuleManager.h"
extern void cellAdec_init(Module* pxThis); extern Module sys_fs;
extern void cellAtrac_init(Module* pxThis); extern Module cellAdec;
extern void cellAudio_init(Module* pxThis); extern Module cellAtrac;
extern void cellAvconfExt_init(Module* pxThis); extern Module cellAudio;
extern void cellCamera_init(Module* pxThis); extern Module cellAvconfExt;
extern void cellCamera_unload(); extern Module cellCamera;
extern void cellDmux_init(Module *pxThis); extern Module cellDmux;
extern void cellFiber_init(Module *pxThis); extern Module cellFiber;
extern void cellFont_init(Module *pxThis); extern Module cellFont;
extern void cellFont_load(); extern Module cellFontFT;
extern void cellFont_unload(); extern Module cellGame;
extern void cellFontFT_init(Module *pxThis); extern Module cellGcmSys;
extern void cellFontFT_load(); extern Module cellGem;
extern void cellFontFT_unload(); extern Module cellGifDec;
extern void cellGame_init(Module *pxThis); extern Module cellJpgDec;
extern void cellGcmSys_init(Module *pxThis); extern Module sys_io;
extern void cellGcmSys_load(); extern Module cellL10n;
extern void cellGcmSys_unload(); extern Module cellMic;
extern void cellGem_init(Module *pxThis); extern Module sys_io;
extern void cellGem_unload(); extern Module cellSysutil;
extern void cellJpgDec_init(Module *pxThis); extern Module cellNetCtl;
extern void cellGifDec_init(Module *pxThis); extern Module cellOvis;
extern void cellL10n_init(Module *pxThis); extern Module sys_io;
extern void cellMic_init(Module *pxThis); extern Module cellPamf;
extern void cellMic_unload(); extern Module cellPngDec;
extern void cellNetCtl_init(Module *pxThis); extern Module cellResc;
extern void cellNetCtl_unload(); extern Module cellRtc;
extern void cellOvis_init(Module *pxThis); extern Module cellSail;
extern void cellPamf_init(Module *pxThis); extern Module cellSysutil;
extern void cellPngDec_init(Module *pxThis); extern Module cellSpurs;
extern void cellResc_init(Module *pxThis); extern Module cellSpursJq;
extern void cellResc_load(); extern Module cellSubdisplay;
extern void cellResc_unload(); extern Module cellSync;
extern void cellRtc_init(Module *pxThis); extern Module cellSync2;
extern void cellSail_init(Module *pxThis); extern Module cellSysmodule;
extern void cellSpurs_init(Module *pxThis); extern Module cellSysutil;
extern void cellSpursJq_init(Module *pxThis); extern Module cellSysutilAp;
extern void cellSubdisplay_init(Module *pxThis); extern Module cellUserInfo;
extern void cellSync_init(Module *pxThis); extern Module cellVdec;
extern void cellSync2_init(Module *pxThis); extern Module cellVpost;
extern void cellSysutil_init(Module *pxThis); extern Module libmixer;
extern void cellSysutil_load(); extern Module sceNp;
extern void cellSysutilAp_init(Module *pxThis); extern Module sceNpClans;
extern void cellSysmodule_init(Module *pxThis); extern Module sceNpCommerce2;
extern void cellUserInfo_init(Module *pxThis); extern Module sceNpSns;
extern void cellVdec_init(Module *pxThis); extern Module sceNpTrophy;
extern void cellVpost_init(Module *pxThis); extern Module sceNpTus;
extern void libmixer_init(Module *pxThis); extern Module sys_io;
extern void sceNp_init(Module *pxThis); extern Module sys_net;
extern void sceNp_unload(); extern Module sysPrxForUser;
extern void sceNpClans_init(Module *pxThis);
extern void sceNpClans_unload();
extern void sceNpCommerce2_init(Module *pxThis);
extern void sceNpCommerce2_unload();
extern void sceNpSns_init(Module *pxThis);
extern void sceNpSns_unload();
extern void sceNpTrophy_init(Module *pxThis);
extern void sceNpTrophy_unload();
extern void sceNpTus_init(Module *pxThis);
extern void sceNpTus_unload();
extern void sysPrxForUser_init(Module *pxThis);
extern void sysPrxForUser_load();
extern void sys_fs_init(Module *pxThis);
extern void sys_fs_load();
extern void sys_io_init(Module *pxThis);
extern void sys_net_init(Module *pxThis);
struct ModuleInfo struct ModuleInfo
{ {
u16 id; //0xffff is used by module with only name s32 id; //-1 is used by module with only name
const char* name; const char* name;
void(*init)(Module *pxThis); Module* module;
void(*load)();
void(*unload)();
} }
static const g_modules_list[] = static const g_module_list[] =
{ {
{ 0x0000, "sys_net", sys_net_init, nullptr, nullptr }, { 0x0000, "sys_net", &sys_net },
{ 0x0001, "sys_http", nullptr, nullptr, nullptr }, { 0x0001, "sys_http", nullptr },
{ 0x0002, "cellHttpUtil", nullptr, nullptr, nullptr }, { 0x0002, "cellHttpUtil", nullptr },
{ 0x0003, "cellSsl", nullptr, nullptr, nullptr }, { 0x0003, "cellSsl", nullptr },
{ 0x0004, "cellHttps", nullptr, nullptr, nullptr }, { 0x0004, "cellHttps", nullptr },
{ 0x0005, "libvdec", cellVdec_init, nullptr, nullptr }, { 0x0005, "libvdec", &cellVdec },
{ 0x0006, "cellAdec", cellAdec_init, nullptr, nullptr }, { 0x0006, "cellAdec", &cellAdec },
{ 0x0007, "cellDmux", cellDmux_init, nullptr, nullptr }, { 0x0007, "cellDmux", &cellDmux },
{ 0x0008, "cellVpost", cellVpost_init, nullptr, nullptr }, { 0x0008, "cellVpost", &cellVpost },
{ 0x0009, "cellRtc", cellRtc_init, nullptr, nullptr }, { 0x0009, "cellRtc", &cellRtc },
{ 0x000a, "cellSpurs", cellSpurs_init, nullptr, nullptr }, { 0x000a, "cellSpurs", &cellSpurs },
{ 0x000b, "cellOvis", cellOvis_init, nullptr, nullptr }, { 0x000b, "cellOvis", &cellOvis },
{ 0x000c, "cellSheap", nullptr, nullptr, nullptr }, { 0x000c, "cellSheap", nullptr },
{ 0x000d, "sys_sync", nullptr, nullptr, nullptr }, { 0x000d, "sys_sync", &cellSync },
{ 0x000e, "sys_fs", sys_fs_init, sys_fs_load, nullptr }, { 0x000e, "sys_fs", &sys_fs },
{ 0x000f, "cellJpgDec", cellJpgDec_init, nullptr, nullptr }, { 0x000f, "cellJpgDec", &cellJpgDec },
{ 0x0010, "cellGcmSys", cellGcmSys_init, cellGcmSys_load, cellGcmSys_unload }, { 0x0010, "cellGcmSys", &cellGcmSys },
{ 0x0011, "cellAudio", cellAudio_init, nullptr, nullptr }, { 0x0011, "cellAudio", &cellAudio },
{ 0x0012, "cellPamf", cellPamf_init, nullptr, nullptr }, { 0x0012, "cellPamf", &cellPamf },
{ 0x0013, "cellAtrac", cellAtrac_init, nullptr, nullptr }, { 0x0013, "cellAtrac", &cellAtrac },
{ 0x0014, "cellNetCtl", cellNetCtl_init, nullptr, cellNetCtl_unload }, { 0x0014, "cellNetCtl", &cellNetCtl },
{ 0x0015, "cellSysutil", cellSysutil_init, cellSysutil_load, nullptr }, { 0x0015, "cellSysutil", &cellSysutil },
{ 0x0016, "sceNp", sceNp_init, nullptr, sceNp_unload }, { 0x0016, "sceNp", &sceNp },
{ 0x0017, "sys_io", sys_io_init, nullptr, nullptr }, { 0x0017, "sys_io", &sys_io },
{ 0x0018, "cellPngDec", cellPngDec_init, nullptr, nullptr }, { 0x0018, "cellPngDec", &cellPngDec },
{ 0x0019, "cellFont", cellFont_init, cellFont_load, cellFont_unload }, { 0x0019, "cellFont", &cellFont },
{ 0x001a, "cellFontFT", cellFontFT_init, cellFontFT_load, cellFontFT_unload }, { 0x001a, "cellFontFT", &cellFontFT },
{ 0x001b, "cellFreetype", nullptr, nullptr, nullptr }, { 0x001b, "cellFreetype", nullptr },
{ 0x001c, "cellUsbd", nullptr, nullptr, nullptr }, { 0x001c, "cellUsbd", nullptr },
{ 0x001d, "cellSail", cellSail_init, nullptr, nullptr }, { 0x001d, "cellSail", &cellSail },
{ 0x001e, "cellL10n", cellL10n_init, nullptr, nullptr }, { 0x001e, "cellL10n", &cellL10n },
{ 0x001f, "cellResc", cellResc_init, cellResc_load, cellResc_unload }, { 0x001f, "cellResc", &cellResc },
{ 0x0020, "cellDaisy", nullptr, nullptr, nullptr }, { 0x0020, "cellDaisy", nullptr },
{ 0x0021, "cellKey2char", nullptr, nullptr, nullptr }, { 0x0021, "cellKey2char", nullptr },
{ 0x0022, "cellMic", cellMic_init, nullptr, cellMic_unload }, { 0x0022, "cellMic", &cellMic },
{ 0x0023, "cellCamera", cellCamera_init, nullptr, cellCamera_unload }, { 0x0023, "cellCamera", &cellCamera },
{ 0x0024, "cellVdecMpeg2", nullptr, nullptr, nullptr }, { 0x0024, "cellVdecMpeg2", nullptr },
{ 0x0025, "cellVdecAvc", nullptr, nullptr, nullptr }, { 0x0025, "cellVdecAvc", nullptr },
{ 0x0026, "cellAdecLpcm", nullptr, nullptr, nullptr }, { 0x0026, "cellAdecLpcm", nullptr },
{ 0x0027, "cellAdecAc3", nullptr, nullptr, nullptr }, { 0x0027, "cellAdecAc3", nullptr },
{ 0x0028, "cellAdecAtx", nullptr, nullptr, nullptr }, { 0x0028, "cellAdecAtx", nullptr },
{ 0x0029, "cellAdecAt3", nullptr, nullptr, nullptr }, { 0x0029, "cellAdecAt3", nullptr },
{ 0x002a, "cellDmuxPamf", nullptr, nullptr, nullptr }, { 0x002a, "cellDmuxPamf", nullptr },
{ 0x002e, "cellLv2dbg", nullptr, nullptr, nullptr }, { 0x002e, "cellLv2dbg", nullptr },
{ 0x0030, "cellUsbpspcm", nullptr, nullptr, nullptr }, { 0x0030, "cellUsbpspcm", nullptr },
{ 0x0031, "cellAvconfExt", cellAvconfExt_init, nullptr, nullptr }, { 0x0031, "cellAvconfExt", &cellAvconfExt },
{ 0x0032, "cellUserInfo", cellUserInfo_init, nullptr, nullptr }, { 0x0032, "cellUserInfo", &cellUserInfo },
{ 0x0033, "cellSysutilSavedata", nullptr, nullptr, nullptr }, { 0x0033, "cellSysutilSavedata", nullptr },
{ 0x0034, "cellSubdisplay", cellSubdisplay_init, nullptr, nullptr }, { 0x0034, "cellSubdisplay", &cellSubdisplay },
{ 0x0035, "cellSysutilRec", nullptr, nullptr, nullptr }, { 0x0035, "cellSysutilRec", nullptr },
{ 0x0036, "cellVideoExport", nullptr, nullptr, nullptr }, { 0x0036, "cellVideoExport", nullptr },
{ 0x0037, "cellGameExec", nullptr, nullptr, nullptr }, { 0x0037, "cellGameExec", nullptr },
{ 0x0038, "sceNp2", nullptr, nullptr, nullptr }, { 0x0038, "sceNp2", nullptr },
{ 0x0039, "cellSysutilAp", cellSysutilAp_init, nullptr, nullptr }, { 0x0039, "cellSysutilAp", &cellSysutilAp },
{ 0x003a, "cellSysutilNpClans", sceNpClans_init, nullptr, sceNpClans_unload }, { 0x003a, "cellSysutilNpClans", nullptr },
{ 0x003b, "cellSysutilOskExt", nullptr, nullptr, nullptr }, { 0x003b, "cellSysutilOskExt", nullptr },
{ 0x003c, "cellVdecDivx", nullptr, nullptr, nullptr }, { 0x003c, "cellVdecDivx", nullptr },
{ 0x003d, "cellJpgEnc", nullptr, nullptr, nullptr }, { 0x003d, "cellJpgEnc", nullptr },
{ 0x003e, "cellGame", cellGame_init, nullptr, nullptr }, { 0x003e, "cellGame", &cellGame },
{ 0x003f, "cellBgdl", nullptr, nullptr, nullptr }, { 0x003f, "cellBgdl", nullptr },
{ 0x0040, "cellFreetypeTT", nullptr, nullptr, nullptr }, { 0x0040, "cellFreetypeTT", nullptr },
{ 0x0041, "cellSysutilVideoUpload", nullptr, nullptr, nullptr }, { 0x0041, "cellSysutilVideoUpload", nullptr },
{ 0x0042, "cellSysutilSysconfExt", nullptr, nullptr, nullptr }, { 0x0042, "cellSysutilSysconfExt", nullptr },
{ 0x0043, "cellFiber", cellFiber_init, nullptr, nullptr }, { 0x0043, "cellFiber", &cellFiber },
{ 0x0044, "cellNpCommerce2", sceNpCommerce2_init, nullptr, sceNpCommerce2_unload }, { 0x0044, "sceNpCommerce2", &sceNpCommerce2 },
{ 0x0045, "cellNpTus", sceNpTus_init, nullptr, sceNpTus_unload }, { 0x0045, "sceNpTus", &sceNpTus },
{ 0x0046, "cellVoice", nullptr, nullptr, nullptr }, { 0x0046, "cellVoice", nullptr },
{ 0x0047, "cellAdecCelp8", nullptr, nullptr, nullptr }, { 0x0047, "cellAdecCelp8", nullptr },
{ 0x0048, "cellCelp8Enc", nullptr, nullptr, nullptr }, { 0x0048, "cellCelp8Enc", nullptr },
{ 0x0049, "cellLicenseArea", nullptr, nullptr, nullptr }, { 0x0049, "cellLicenseArea", nullptr },
{ 0x004a, "cellMusic2", nullptr, nullptr, nullptr }, { 0x004a, "cellMusic2", nullptr },
{ 0x004e, "cellScreenshot", nullptr, nullptr, nullptr }, { 0x004e, "cellScreenshot", nullptr },
{ 0x004f, "cellMusicDecode", nullptr, nullptr, nullptr }, { 0x004f, "cellMusicDecode", nullptr },
{ 0x0050, "cellSpursJq", cellSpursJq_init, nullptr, nullptr }, { 0x0050, "cellSpursJq", &cellSpursJq },
{ 0x0052, "cellPngEnc", nullptr, nullptr, nullptr }, { 0x0052, "cellPngEnc", nullptr },
{ 0x0053, "cellMusicDecode2", nullptr, nullptr, nullptr }, { 0x0053, "cellMusicDecode2", nullptr },
{ 0x0055, "cellSync2", cellSync2_init, nullptr, nullptr }, { 0x0055, "cellSync2", &cellSync2 },
{ 0x0056, "cellNpUtil", nullptr, nullptr, nullptr }, { 0x0056, "sceNpUtil", nullptr },
{ 0x0057, "cellRudp", nullptr, nullptr, nullptr }, { 0x0057, "cellRudp", nullptr },
{ 0x0059, "cellNpSns", sceNpSns_init, nullptr, sceNpSns_unload }, { 0x0059, "sceNpSns", &sceNpSns },
{ 0x005a, "cellGem", cellGem_init, nullptr, cellGem_unload }, { 0x005a, "cellGem", &cellGem },
{ 0xf00a, "cellCelpEnc", nullptr, nullptr, nullptr }, { 0xf00a, "cellCelpEnc", nullptr },
{ 0xf010, "cellGifDec", cellGifDec_init, nullptr, nullptr }, { 0xf010, "cellGifDec", &cellGifDec },
{ 0xf019, "cellAdecCelp", nullptr, nullptr, nullptr }, { 0xf019, "cellAdecCelp", nullptr },
{ 0xf01b, "cellAdecM2bc", nullptr, nullptr, nullptr }, { 0xf01b, "cellAdecM2bc", nullptr },
{ 0xf01d, "cellAdecM4aac", nullptr, nullptr, nullptr }, { 0xf01d, "cellAdecM4aac", nullptr },
{ 0xf01e, "cellAdecMp3", nullptr, nullptr, nullptr }, { 0xf01e, "cellAdecMp3", nullptr },
{ 0xf023, "cellImejp", nullptr, nullptr, nullptr }, { 0xf023, "cellImejp", nullptr },
{ 0xf028, "cellMusic", nullptr, nullptr, nullptr }, { 0xf028, "cellMusic", nullptr },
{ 0xf029, "cellPhotoExport", nullptr, nullptr, nullptr }, { 0xf029, "cellPhotoExport", nullptr },
{ 0xf02a, "cellPrint", nullptr, nullptr, nullptr }, { 0xf02a, "cellPrint", nullptr },
{ 0xf02b, "cellPhotoImport", nullptr, nullptr, nullptr }, { 0xf02b, "cellPhotoImport", nullptr },
{ 0xf02c, "cellMusicExport", nullptr, nullptr, nullptr }, { 0xf02c, "cellMusicExport", nullptr },
{ 0xf02e, "cellPhotoDecode", nullptr, nullptr, nullptr }, { 0xf02e, "cellPhotoDecode", nullptr },
{ 0xf02f, "cellSearch", nullptr, nullptr, nullptr }, { 0xf02f, "cellSearch", nullptr },
{ 0xf030, "cellAvchat2", nullptr, nullptr, nullptr }, { 0xf030, "cellAvchat2", nullptr },
{ 0xf034, "cellSailRec", nullptr, nullptr, nullptr }, { 0xf034, "cellSailRec", nullptr },
{ 0xf035, "sceNpTrophy", sceNpTrophy_init, nullptr, sceNpTrophy_unload }, { 0xf035, "sceNpTrophy", &sceNpTrophy },
{ 0xf053, "cellAdecAt3multi", nullptr, nullptr, nullptr }, { 0xf053, "cellAdecAt3multi", nullptr },
{ 0xf054, "cellLibatrac3multi", nullptr, nullptr, nullptr }, { 0xf054, "cellLibatrac3multi", nullptr },
{ 0xffff, "cellSync", cellSync_init, nullptr, nullptr },
{ 0xffff, "cellSysmodule", cellSysmodule_init, nullptr, nullptr }, { -1, "cellSync", &cellSync },
{ 0xffff, "libmixer", libmixer_init, nullptr, nullptr }, { -1, "cellSysmodule", &cellSysmodule },
{ 0xffff, "sysPrxForUser", sysPrxForUser_init, sysPrxForUser_load, nullptr } { -1, "libmixer", &libmixer },
{ -1, "sysPrxForUser", &sysPrxForUser },
}; };
void ModuleManager::init() void ModuleManager::Init()
{ {
//TODO Refactor every Module part to remove the global pointer defined in each module's file
//and the need to call init functions after its constructor
//To define a new module, add it in g_modules_list
//m.init the function which defines module's own functions and assignes module's pointer to its global pointer
if (!initialized) if (!initialized)
{ {
u32 global_module_nb = sizeof(g_modules_list) / sizeof(g_modules_list[0]); for (auto& m : g_module_list)
m_mod_init.reserve(global_module_nb);
for (auto& m : g_modules_list)
{ {
m_mod_init.emplace_back(m.id, m.name, m.load, m.unload); if (m.module)
if (m.init) {
m.init(&m_mod_init.back()); m.module->Init();
}
} }
initialized = true; initialized = true;
} }
} }
ModuleManager::ModuleManager() : ModuleManager::ModuleManager()
m_max_module_id(0), : initialized(false)
m_module_2_count(0),
initialized(false)
{ {
memset(m_modules, 0, 3 * 0xFF * sizeof(Module*));
} }
ModuleManager::~ModuleManager() ModuleManager::~ModuleManager()
{ {
UnloadModules();
} }
bool ModuleManager::IsLoadedFunc(u32 id) const void ModuleManager::Close()
{ {
for (u32 i = 0; i<m_modules_funcs_list.size(); ++i) for (auto& m : g_module_list)
{ {
if (m_modules_funcs_list[i]->id == id) if (m.module && m.module->on_stop)
{ {
return true; m.module->on_stop();
} }
} }
return false;
}
bool ModuleManager::CallFunc(PPUThread& CPU, u32 num)
{
func_caller* func = nullptr;
{
std::lock_guard<std::mutex> lock(m_funcs_lock);
for (u32 i = 0; i<m_modules_funcs_list.size(); ++i)
{
if (m_modules_funcs_list[i]->id == num)
{
func = m_modules_funcs_list[i]->func;
break;
}
}
}
if (func)
{
(*func)(CPU);
return true;
}
return false;
}
bool ModuleManager::UnloadFunc(u32 id)
{
std::lock_guard<std::mutex> lock(m_funcs_lock);
for (u32 i = 0; i<m_modules_funcs_list.size(); ++i)
{
if (m_modules_funcs_list[i]->id == id)
{
m_modules_funcs_list.erase(m_modules_funcs_list.begin() + i);
return true;
}
}
return false;
}
u32 ModuleManager::GetFuncNumById(u32 id)
{
return id;
}
//to load the default modules after calling this call Init() again
void ModuleManager::UnloadModules()
{
for (u32 i = 0; i<3; ++i)
{
for (u32 j = 0; j<m_max_module_id; ++j)
{
if (m_modules[i][j])
{
m_modules[i][j]->UnLoad();
}
}
}
//reset state of the module manager
//this could be done by calling the destructor and then a placement-new
//to avoid repeating the initial values here but the defaults aren't
//complicated enough to complicate this by using the placement-new
m_mod_init.clear(); //destroy Module(s), their respective global pointer become invalid
m_max_module_id = 0;
m_module_2_count = 0;
initialized = false; initialized = false;
memset(m_modules, 0, 3 * 0xFF * sizeof(Module*));
std::lock_guard<std::mutex> lock(m_funcs_lock);
m_modules_funcs_list.clear();
} }
Module* ModuleManager::GetModuleByName(const std::string& name) Module* ModuleManager::GetModuleByName(const char* name)
{ {
for (u32 i = 0; i<m_max_module_id && i<0xff; ++i) for (auto& m : g_module_list)
{ {
if (m_modules[0][i] && m_modules[0][i]->GetName() == name) if (!strcmp(name, m.name))
{ {
return m_modules[0][i]; return m.module;
}
if (m_modules[1][i] && m_modules[1][i]->GetName() == name)
{
return m_modules[1][i];
}
if (m_modules[2][i] && m_modules[2][i]->GetName() == name)
{
return m_modules[2][i];
} }
} }
@ -331,72 +220,26 @@ Module* ModuleManager::GetModuleByName(const std::string& name)
Module* ModuleManager::GetModuleById(u16 id) Module* ModuleManager::GetModuleById(u16 id)
{ {
for (u32 i = 0; i<m_max_module_id && i<0xff; ++i) for (auto& m : g_module_list)
{ {
if (m_modules[0][i] && m_modules[0][i]->GetID() == id) if (m.id == id)
{ {
return m_modules[0][i]; return m.module;
}
if (m_modules[1][i] && m_modules[1][i]->GetID() == id)
{
return m_modules[1][i];
} }
} }
return nullptr; return nullptr;
} }
void ModuleManager::SetModule(u16 id, Module* module) bool ModuleManager::CheckModuleId(u16 id)
{ {
if (id != 0xffff) //id != -1 for (auto& m : g_module_list)
{ {
u8 index2 = (u8)id; if (m.id == id)
if (u16(index2 + 1) > m_max_module_id)
{ {
m_max_module_id = u16(index2 + 1); return true;
}
u8 index;
switch (id >> 8)
{
case 0x00: index = 0; break;//id = 0x0000 to 0x00fe go to m_modules[0]
case 0xf0: index = 1; break;//id = 0xf000 to 0xf0fe go to m_modules[1]
default: assert(0); return;
}
//fill m_modules[index] by truncating id to 8 bits
if (m_modules[index][index2]) //if module id collision
{
//Not sure if this is a good idea to hide collision
module->SetName(m_modules[index][index2]->GetName());
m_modules[index][index2] = module;
//don't need to delete since m_mod_init has the ownership
}
else
{
m_modules[index][index2] = module;
}
}
else //id = 0xffff go to m_modules[2]
{
//fill m_modules[2] from 0 to 0xff
m_modules[2][m_module_2_count] = module;
++m_module_2_count;
if (m_module_2_count > m_max_module_id)
{
m_max_module_id = m_module_2_count;
}
} }
} }
return false;
void ModuleManager::AddFunc(ModuleFunc *func)
{
std::lock_guard<std::mutex> guard(m_funcs_lock);
if (!IsLoadedFunc(func->id))
{
m_modules_funcs_list.push_back(func);
}
} }

View file

@ -3,26 +3,15 @@
class ModuleManager class ModuleManager
{ {
Module* m_modules[3][0xff];//keep pointer to modules split in 3 categories according to their id
uint m_max_module_id; //max index in m_modules[2][], m_modules[1][] and m_modules[0][]
uint m_module_2_count; //max index in m_modules[2][]
std::mutex m_funcs_lock;
std::vector<ModuleFunc *> m_modules_funcs_list;
std::vector<Module> m_mod_init; //owner of Module
bool initialized; bool initialized;
public: public:
ModuleManager(); ModuleManager();
~ModuleManager(); ~ModuleManager();
void init(); void Init();
void AddFunc(ModuleFunc *func); void Close();
void SetModule(u16 id, Module* module);//insert into m_modules Module* GetModuleByName(const char* name);
bool IsLoadedFunc(u32 id) const;
bool CallFunc(PPUThread& CPU, u32 num);
bool UnloadFunc(u32 id);
void UnloadModules();
u32 GetFuncNumById(u32 id);
Module* GetModuleByName(const std::string& name);
Module* GetModuleById(u16 id); Module* GetModuleById(u16 id);
bool CheckModuleId(u16 id);
}; };

View file

@ -7,7 +7,99 @@
#include "ModuleManager.h" #include "ModuleManager.h"
#include "Emu/Cell/PPUInstrTable.h" #include "Emu/Cell/PPUInstrTable.h"
u32 getFunctionId(const char* name) std::vector<ModuleFunc> g_ps3_func_list;
u32 add_ps3_func(ModuleFunc& func)
{
for (auto& f : g_ps3_func_list)
{
if (f.id == func.id)
{
// partial update
if (func.func)
{
f.func = func.func;
}
if (func.lle_func)
{
f.lle_func = func.lle_func;
}
return (u32)(&f - g_ps3_func_list.data());
}
}
g_ps3_func_list.push_back(func);
return (u32)g_ps3_func_list.size() - 1;
}
ModuleFunc* get_ps3_func_by_nid(u32 nid, u32* out_index)
{
for (auto& f : g_ps3_func_list)
{
if (f.id == nid)
{
if (out_index)
{
*out_index = (u32)(&f - g_ps3_func_list.data());
}
return &f;
}
}
return nullptr;
}
ModuleFunc* get_ps3_func_by_index(u32 index)
{
if (index >= g_ps3_func_list.size())
{
return nullptr;
}
return &g_ps3_func_list[index];
}
void execute_ps3_func_by_index(PPUThread& CPU, u32 index)
{
if (auto func = get_ps3_func_by_index(index))
{
// save RTOC
vm::write64(vm::cast(CPU.GPR[1] + 0x28), CPU.GPR[2]);
auto old_last_syscall = CPU.m_last_syscall;
CPU.m_last_syscall = func->id;
if (func->lle_func)
{
func->lle_func(CPU);
}
else if (func->func)
{
(*func->func)(CPU);
}
else
{
throw "Unimplemented function";
}
CPU.m_last_syscall = old_last_syscall;
}
else
{
throw "Invalid function index";
}
}
void clear_ps3_functions()
{
g_ps3_func_list.clear();
}
u32 get_function_id(const char* name)
{ {
const char* suffix = "\x67\x59\x65\x99\x04\x25\x04\x90\x56\x64\x27\x49\x94\x89\x74\x1A"; // Symbol name suffix const char* suffix = "\x67\x59\x65\x99\x04\x25\x04\x90\x56\x64\x27\x49\x94\x89\x74\x1A"; // Symbol name suffix
u8 output[20]; u8 output[20];
@ -23,111 +115,52 @@ u32 getFunctionId(const char* name)
return (u32&)output[0]; return (u32&)output[0];
} }
Module::Module(u16 id, const char* name, void(*load)(), void(*unload)()) Module::Module(const char* name, void(*init)())
: m_is_loaded(false) : m_is_loaded(false)
, m_name(name) , m_name(name)
, m_id(id) , m_init(init)
, m_load_func(load)
, m_unload_func(unload)
{ {
Emu.GetModuleManager().SetModule(m_id, this);
}
Module::Module(Module &&other)
: m_is_loaded(false)
, m_id(0)
, m_load_func(nullptr)
, m_unload_func(nullptr)
{
std::swap(this->m_name,other.m_name);
std::swap(this->m_id, other.m_id);
std::swap(this->m_is_loaded, other.m_is_loaded);
std::swap(this->m_load_func, other.m_load_func);
std::swap(this->m_unload_func, other.m_unload_func);
std::swap(this->m_funcs_list, other.m_funcs_list);
}
Module &Module::operator =(Module &&other)
{
std::swap(this->m_name, other.m_name);
std::swap(this->m_id, other.m_id);
std::swap(this->m_is_loaded, other.m_is_loaded);
std::swap(this->m_load_func, other.m_load_func);
std::swap(this->m_unload_func, other.m_unload_func);
std::swap(this->m_funcs_list, other.m_funcs_list);
return *this;
} }
Module::~Module() Module::~Module()
{ {
UnLoad();
for (auto &i : m_funcs_list)
{
delete i.second;
} }
m_funcs_list.clear(); void Module::Init()
{
m_init();
} }
void Module::Load() void Module::Load()
{ {
if (IsLoaded()) if (IsLoaded())
return;
if(m_load_func) m_load_func();
for (auto &i : m_funcs_list)
{ {
Emu.GetModuleManager().AddFunc(i.second); return;
}
if (on_load)
{
on_load();
} }
SetLoaded(true); SetLoaded(true);
} }
void Module::UnLoad() void Module::Unload()
{ {
if (!IsLoaded()) if (!IsLoaded())
return;
if(m_unload_func) m_unload_func();
for (auto &i : m_funcs_list)
{ {
i.second->lle_func.set(0); return;
} }
// TODO: Re-enable this when needed if (on_unload)
// This was disabled because some functions would get unloaded and {
// some games tried to use them, thus only printing a TODO message on_unload();
//for(u32 i=0; i<m_funcs_list.size(); ++i) }
//{
// Emu.GetModuleManager().UnloadFunc(m_funcs_list[i]->id);
//}
SetLoaded(false); SetLoaded(false);
} }
bool Module::Load(u32 id)
{
if(Emu.GetModuleManager().IsLoadedFunc(id))
return false;
auto res = m_funcs_list.find(id);
if (res == m_funcs_list.end())
return false;
Emu.GetModuleManager().AddFunc(res->second);
return true;
}
bool Module::UnLoad(u32 id)
{
return Emu.GetModuleManager().UnloadFunc(id);
}
void Module::SetLoaded(bool loaded) void Module::SetLoaded(bool loaded)
{ {
m_is_loaded = loaded; m_is_loaded = loaded;
@ -138,11 +171,6 @@ bool Module::IsLoaded() const
return m_is_loaded; return m_is_loaded;
} }
u16 Module::GetID() const
{
return m_id;
}
const std::string& Module::GetName() const const std::string& Module::GetName() const
{ {
return m_name; return m_name;
@ -178,22 +206,32 @@ void Module::PushNewFuncSub(SFunc* func)
Emu.GetSFuncManager().push_back(func); Emu.GetSFuncManager().push_back(func);
} }
void fix_import(Module* module, u32 func, u32 addr) void fix_import(Module* module, u32 nid, u32 addr)
{ {
using namespace PPU_instr; using namespace PPU_instr;
vm::ptr<u32> ptr = vm::ptr<u32>::make(addr); vm::ptr<u32> ptr = vm::ptr<u32>::make(addr);
*ptr++ = ADDIS(11, 0, func >> 16); u32 index;
*ptr++ = ORI(11, 11, func & 0xffff);
*ptr++ = NOP();
++ptr;
*ptr++ = SC(0);
*ptr++ = BLR();
*ptr++ = NOP();
*ptr++ = NOP();
module->Load(func); if (auto func = get_ps3_func_by_nid(nid, &index))
{
*ptr++ = HACK(index);
*ptr++ = BLR();
}
else
{
module->Error("Unimplemented function 0x%x (0x%x)", nid, addr);
}
//*ptr++ = ADDIS(11, 0, func >> 16);
//*ptr++ = ORI(11, 11, func & 0xffff);
//*ptr++ = NOP();
//++ptr;
//*ptr++ = SC(0);
//*ptr++ = BLR();
//*ptr++ = NOP();
//*ptr++ = NOP();
} }
void fix_relocs(Module* module, u32 lib, u32 start, u32 end, u32 seg2) void fix_relocs(Module* module, u32 lib, u32 start, u32 end, u32 seg2)

View file

@ -4,24 +4,22 @@
#include "ErrorCodes.h" #include "ErrorCodes.h"
#include "LogBase.h" #include "LogBase.h"
//TODO class Module;
struct ModuleFunc struct ModuleFunc
{ {
u32 id; u32 id;
func_caller* func; Module* module;
std::shared_ptr<func_caller> func;
vm::ptr<void()> lle_func; vm::ptr<void()> lle_func;
ModuleFunc(u32 id, func_caller* func, vm::ptr<void()> lle_func = vm::ptr<void()>::make(0)) ModuleFunc(u32 id, Module* module, func_caller* func, vm::ptr<void()> lle_func = vm::ptr<void()>::make(0))
: id(id) : id(id)
, module(module)
, func(func) , func(func)
, lle_func(lle_func) , lle_func(lle_func)
{ {
} }
~ModuleFunc()
{
delete func;
}
}; };
struct SFuncOp struct SFuncOp
@ -50,46 +48,36 @@ class StaticFuncManager;
class Module : public LogBase class Module : public LogBase
{ {
std::string m_name; std::string m_name;
u16 m_id;
bool m_is_loaded; bool m_is_loaded;
void (*m_load_func)(); void(*m_init)();
void (*m_unload_func)();
IdManager& GetIdManager() const; IdManager& GetIdManager() const;
void PushNewFuncSub(SFunc* func); void PushNewFuncSub(SFunc* func);
public: Module() = delete;
std::unordered_map<u32, ModuleFunc*> m_funcs_list;
Module(u16 id, const char* name, void(*load)() = nullptr, void(*unload)() = nullptr); public:
Module(const char* name, void(*init)());
Module(Module &other) = delete; Module(Module &other) = delete;
Module(Module &&other); Module(Module &&other) = delete;
Module &operator =(Module &other) = delete; Module &operator =(Module &other) = delete;
Module &operator =(Module &&other); Module &operator =(Module &&other) = delete;
ModuleFunc* GetFunc(u32 id)
{
auto res = m_funcs_list.find(id);
if (res == m_funcs_list.end())
return nullptr;
return res->second;
}
~Module(); ~Module();
std::function<void()> on_load;
std::function<void()> on_unload;
std::function<void()> on_stop;
void Init();
void Load(); void Load();
void UnLoad(); void Unload();
bool Load(u32 id);
bool UnLoad(u32 id);
void SetLoaded(bool loaded = true); void SetLoaded(bool loaded = true);
bool IsLoaded() const; bool IsLoaded() const;
u16 GetID() const;
virtual const std::string& GetName() const override; virtual const std::string& GetName() const override;
void SetName(const std::string& name); void SetName(const std::string& name);
@ -129,28 +117,22 @@ public:
bool RemoveId(u32 id); bool RemoveId(u32 id);
void RegisterLLEFunc(u32 id, vm::ptr<void()> func)
{
if (auto f = GetFunc(id))
{
f->lle_func = func;
return;
}
m_funcs_list[id] = new ModuleFunc(id, nullptr, func);
}
template<typename T> __forceinline void AddFunc(u32 id, T func); template<typename T> __forceinline void AddFunc(u32 id, T func);
template<typename T> __forceinline void AddFunc(const char* name, T func); template<typename T> __forceinline void AddFunc(const char* name, T func);
template<typename T> __forceinline void AddFuncSub(const char group[8], const u64 ops[], const char* name, T func); template<typename T> __forceinline void AddFuncSub(const char group[8], const u64 ops[], const char* name, T func);
}; };
u32 getFunctionId(const char* name); u32 add_ps3_func(ModuleFunc& func);
ModuleFunc* get_ps3_func_by_nid(u32 nid, u32* out_index = nullptr);
ModuleFunc* get_ps3_func_by_index(u32 index);
void execute_ps3_func_by_index(PPUThread& CPU, u32 id);
void clear_ps3_functions();
u32 get_function_id(const char* name);
template<typename T> template<typename T>
__forceinline void Module::AddFunc(u32 id, T func) __forceinline void Module::AddFunc(u32 id, T func)
{ {
m_funcs_list[id] = new ModuleFunc(id, bind_func(func)); add_ps3_func(ModuleFunc(id, this, bind_func(func)));
} }
template<typename T> template<typename T>
@ -185,7 +167,7 @@ __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], cons
PushNewFuncSub(sf); PushNewFuncSub(sf);
} }
void fix_import(Module* module, u32 func, u32 addr); void fix_import(Module* module, u32 nid, u32 addr);
#define FIX_IMPORT(module, func, addr) fix_import(module, getFunctionId(#func), addr) #define FIX_IMPORT(module, func, addr) fix_import(module, getFunctionId(#func), addr)
@ -193,8 +175,8 @@ void fix_relocs(Module* module, u32 lib, u32 start, u32 end, u32 seg2);
#define REG_SUB(module, group, name, ...) \ #define REG_SUB(module, group, name, ...) \
static const u64 name ## _table[] = {__VA_ARGS__ , 0}; \ static const u64 name ## _table[] = {__VA_ARGS__ , 0}; \
module->AddFuncSub(group, name ## _table, #name, name) module.AddFuncSub(group, name ## _table, #name, name)
#define REG_FUNC(module, name) module->AddFunc(getFunctionId(#name), name) #define REG_FUNC(module, name) module.AddFunc(get_function_id(#name), name)
#define UNIMPLEMENTED_FUNC(module) module->Todo("%s", __FUNCTION__) #define UNIMPLEMENTED_FUNC(module) module.Fatal("%s", __FUNCTION__)

View file

@ -17,9 +17,9 @@ extern "C"
#include "cellPamf.h" #include "cellPamf.h"
#include "cellAdec.h" #include "cellAdec.h"
Module *cellAdec = nullptr; extern Module cellAdec;
#define ADEC_ERROR(...) { cellAdec->Error(__VA_ARGS__); Emu.Pause(); return; } // only for decoder thread #define ADEC_ERROR(...) { cellAdec.Error(__VA_ARGS__); Emu.Pause(); return; } // only for decoder thread
AudioDecoder::AudioDecoder(AudioCodecType type, u32 addr, u32 size, vm::ptr<CellAdecCbMsg> func, u32 arg) AudioDecoder::AudioDecoder(AudioCodecType type, u32 addr, u32 size, vm::ptr<CellAdecCbMsg> func, u32 arg)
: type(type) : type(type)
@ -135,7 +135,7 @@ next:
OMAHeader oma(1 /* atrac3p id */, adec.sample_rate, adec.ch_cfg, adec.frame_size); OMAHeader oma(1 /* atrac3p id */, adec.sample_rate, adec.ch_cfg, adec.frame_size);
if (buf_size < sizeof(oma)) if (buf_size < sizeof(oma))
{ {
cellAdec->Error("adecRead(): OMAHeader writing failed"); cellAdec.Error("adecRead(): OMAHeader writing failed");
Emu.Pause(); Emu.Pause();
return 0; return 0;
} }
@ -153,7 +153,7 @@ next:
AdecTask task; AdecTask task;
if (!adec.job.peek(task, 0, &adec.is_closed)) if (!adec.job.peek(task, 0, &adec.is_closed))
{ {
if (Emu.IsStopped()) cellAdec->Warning("adecRawRead() aborted"); if (Emu.IsStopped()) cellAdec.Warning("adecRawRead() aborted");
return 0; return 0;
} }
@ -187,7 +187,7 @@ next:
default: default:
{ {
cellAdec->Error("adecRawRead(): unknown task (%d)", task.type); cellAdec.Error("adecRawRead(): unknown task (%d)", task.type);
Emu.Pause(); Emu.Pause();
return -1; return -1;
} }
@ -219,7 +219,7 @@ u32 adecOpen(AudioDecoder* adec_ptr)
std::shared_ptr<AudioDecoder> sptr(adec_ptr); std::shared_ptr<AudioDecoder> sptr(adec_ptr);
AudioDecoder& adec = *adec_ptr; AudioDecoder& adec = *adec_ptr;
u32 adec_id = cellAdec->GetNewId(sptr); u32 adec_id = cellAdec.GetNewId(sptr);
adec.id = adec_id; adec.id = adec_id;
@ -254,7 +254,7 @@ u32 adecOpen(AudioDecoder* adec_ptr)
case adecStartSeq: case adecStartSeq:
{ {
// TODO: reset data // TODO: reset data
cellAdec->Warning("adecStartSeq:"); cellAdec.Warning("adecStartSeq:");
adec.reader.addr = 0; adec.reader.addr = 0;
adec.reader.size = 0; adec.reader.size = 0;
@ -276,7 +276,7 @@ u32 adecOpen(AudioDecoder* adec_ptr)
case adecEndSeq: case adecEndSeq:
{ {
// TODO: finalize // TODO: finalize
cellAdec->Warning("adecEndSeq:"); cellAdec.Warning("adecEndSeq:");
adec.cbFunc(*adec.adecCb, adec.id, CELL_ADEC_MSG_TYPE_SEQDONE, CELL_OK, adec.cbArg); adec.cbFunc(*adec.adecCb, adec.id, CELL_ADEC_MSG_TYPE_SEQDONE, CELL_OK, adec.cbArg);
adec.just_finished = true; adec.just_finished = true;
@ -372,7 +372,7 @@ u32 adecOpen(AudioDecoder* adec_ptr)
{ {
if (Emu.IsStopped() || adec.is_closed) if (Emu.IsStopped() || adec.is_closed)
{ {
if (Emu.IsStopped()) cellAdec->Warning("adecDecodeAu: aborted"); if (Emu.IsStopped()) cellAdec.Warning("adecDecodeAu: aborted");
break; break;
} }
@ -416,7 +416,7 @@ u32 adecOpen(AudioDecoder* adec_ptr)
{ {
if (decode < 0) if (decode < 0)
{ {
cellAdec->Error("adecDecodeAu: AU decoding error(0x%x)", decode); cellAdec.Error("adecDecodeAu: AU decoding error(0x%x)", decode);
} }
if (!got_frame && adec.reader.size == 0) break; if (!got_frame && adec.reader.size == 0) break;
} }
@ -484,11 +484,11 @@ bool adecCheckType(AudioCodecType type)
{ {
switch (type) switch (type)
{ {
case CELL_ADEC_TYPE_ATRACX: cellAdec->Notice("adecCheckType(): ATRAC3plus"); break; case CELL_ADEC_TYPE_ATRACX: cellAdec.Notice("adecCheckType(): ATRAC3plus"); break;
case CELL_ADEC_TYPE_ATRACX_2CH: cellAdec->Notice("adecCheckType(): ATRAC3plus 2ch"); break; case CELL_ADEC_TYPE_ATRACX_2CH: cellAdec.Notice("adecCheckType(): ATRAC3plus 2ch"); break;
case CELL_ADEC_TYPE_ATRACX_6CH: cellAdec->Notice("adecCheckType(): ATRAC3plus 6ch"); break; case CELL_ADEC_TYPE_ATRACX_6CH: cellAdec.Notice("adecCheckType(): ATRAC3plus 6ch"); break;
case CELL_ADEC_TYPE_ATRACX_8CH: cellAdec->Notice("adecCheckType(): ATRAC3plus 8ch"); break; case CELL_ADEC_TYPE_ATRACX_8CH: cellAdec.Notice("adecCheckType(): ATRAC3plus 8ch"); break;
case CELL_ADEC_TYPE_MP3: cellAdec->Notice("adecCheckType(): MP3"); break; case CELL_ADEC_TYPE_MP3: cellAdec.Notice("adecCheckType(): MP3"); break;
case CELL_ADEC_TYPE_LPCM_PAMF: case CELL_ADEC_TYPE_LPCM_PAMF:
case CELL_ADEC_TYPE_AC3: case CELL_ADEC_TYPE_AC3:
@ -498,7 +498,7 @@ bool adecCheckType(AudioCodecType type)
case CELL_ADEC_TYPE_M4AAC: case CELL_ADEC_TYPE_M4AAC:
case CELL_ADEC_TYPE_CELP8: case CELL_ADEC_TYPE_CELP8:
{ {
cellAdec->Todo("Unimplemented audio codec type (%d)", type); cellAdec.Todo("Unimplemented audio codec type (%d)", type);
Emu.Pause(); Emu.Pause();
break; break;
} }
@ -510,7 +510,7 @@ bool adecCheckType(AudioCodecType type)
int cellAdecQueryAttr(vm::ptr<CellAdecType> type, vm::ptr<CellAdecAttr> attr) int cellAdecQueryAttr(vm::ptr<CellAdecType> type, vm::ptr<CellAdecAttr> attr)
{ {
cellAdec->Warning("cellAdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.addr(), attr.addr()); cellAdec.Warning("cellAdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.addr(), attr.addr());
if (!adecCheckType(type->audioCodecType)) return CELL_ADEC_ERROR_ARG; if (!adecCheckType(type->audioCodecType)) return CELL_ADEC_ERROR_ARG;
@ -524,7 +524,7 @@ int cellAdecQueryAttr(vm::ptr<CellAdecType> type, vm::ptr<CellAdecAttr> attr)
int cellAdecOpen(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResource> res, vm::ptr<CellAdecCb> cb, vm::ptr<u32> handle) int cellAdecOpen(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResource> res, vm::ptr<CellAdecCb> cb, vm::ptr<u32> handle)
{ {
cellAdec->Warning("cellAdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", cellAdec.Warning("cellAdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
type.addr(), res.addr(), cb.addr(), handle.addr()); type.addr(), res.addr(), cb.addr(), handle.addr());
if (!adecCheckType(type->audioCodecType)) return CELL_ADEC_ERROR_ARG; if (!adecCheckType(type->audioCodecType)) return CELL_ADEC_ERROR_ARG;
@ -536,7 +536,7 @@ int cellAdecOpen(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResource> res, vm::
int cellAdecOpenEx(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResourceEx> res, vm::ptr<CellAdecCb> cb, vm::ptr<u32> handle) int cellAdecOpenEx(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResourceEx> res, vm::ptr<CellAdecCb> cb, vm::ptr<u32> handle)
{ {
cellAdec->Warning("cellAdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", cellAdec.Warning("cellAdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
type.addr(), res.addr(), cb.addr(), handle.addr()); type.addr(), res.addr(), cb.addr(), handle.addr());
if (!adecCheckType(type->audioCodecType)) return CELL_ADEC_ERROR_ARG; if (!adecCheckType(type->audioCodecType)) return CELL_ADEC_ERROR_ARG;
@ -548,7 +548,7 @@ int cellAdecOpenEx(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResourceEx> res,
int cellAdecClose(u32 handle) int cellAdecClose(u32 handle)
{ {
cellAdec->Warning("cellAdecClose(handle=%d)", handle); cellAdec.Warning("cellAdecClose(handle=%d)", handle);
std::shared_ptr<AudioDecoder> adec; std::shared_ptr<AudioDecoder> adec;
if (!Emu.GetIdManager().GetIDData(handle, adec)) if (!Emu.GetIdManager().GetIDData(handle, adec))
@ -563,7 +563,7 @@ int cellAdecClose(u32 handle)
{ {
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
cellAdec->Warning("cellAdecClose(%d) aborted", handle); cellAdec.Warning("cellAdecClose(%d) aborted", handle);
break; break;
} }
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
@ -576,7 +576,7 @@ int cellAdecClose(u32 handle)
int cellAdecStartSeq(u32 handle, u32 param_addr) int cellAdecStartSeq(u32 handle, u32 param_addr)
{ {
cellAdec->Warning("cellAdecStartSeq(handle=%d, param_addr=0x%x)", handle, param_addr); cellAdec.Warning("cellAdecStartSeq(handle=%d, param_addr=0x%x)", handle, param_addr);
std::shared_ptr<AudioDecoder> adec; std::shared_ptr<AudioDecoder> adec;
if (!Emu.GetIdManager().GetIDData(handle, adec)) if (!Emu.GetIdManager().GetIDData(handle, adec))
@ -603,7 +603,7 @@ int cellAdecStartSeq(u32 handle, u32 param_addr)
task.at3p.output = param->bw_pcm; task.at3p.output = param->bw_pcm;
task.at3p.downmix = param->downmix_flag; task.at3p.downmix = param->downmix_flag;
task.at3p.ats_header = param->au_includes_ats_hdr_flg; task.at3p.ats_header = param->au_includes_ats_hdr_flg;
cellAdec->Todo("*** CellAdecParamAtracX: sr=%d, ch_cfg=%d(%d), frame_size=0x%x, extra=0x%x, output=%d, downmix=%d, ats_header=%d", cellAdec.Todo("*** CellAdecParamAtracX: sr=%d, ch_cfg=%d(%d), frame_size=0x%x, extra=0x%x, output=%d, downmix=%d, ats_header=%d",
task.at3p.sample_rate, task.at3p.channel_config, task.at3p.channels, task.at3p.frame_size, (u32&)task.at3p.extra_config, task.at3p.output, task.at3p.downmix, task.at3p.ats_header); task.at3p.sample_rate, task.at3p.channel_config, task.at3p.channels, task.at3p.frame_size, (u32&)task.at3p.extra_config, task.at3p.output, task.at3p.downmix, task.at3p.ats_header);
break; break;
} }
@ -611,12 +611,12 @@ int cellAdecStartSeq(u32 handle, u32 param_addr)
{ {
auto param = vm::ptr<const CellAdecParamMP3>::make(param_addr); auto param = vm::ptr<const CellAdecParamMP3>::make(param_addr);
cellAdec->Todo("*** CellAdecParamMP3: bw_pcm=%d", param->bw_pcm); cellAdec.Todo("*** CellAdecParamMP3: bw_pcm=%d", param->bw_pcm);
break; break;
} }
default: default:
{ {
cellAdec->Todo("cellAdecStartSeq(): Unimplemented audio codec type(%d)", adec->type); cellAdec.Todo("cellAdecStartSeq(): Unimplemented audio codec type(%d)", adec->type);
Emu.Pause(); Emu.Pause();
return CELL_OK; return CELL_OK;
} }
@ -628,7 +628,7 @@ int cellAdecStartSeq(u32 handle, u32 param_addr)
int cellAdecEndSeq(u32 handle) int cellAdecEndSeq(u32 handle)
{ {
cellAdec->Warning("cellAdecEndSeq(handle=%d)", handle); cellAdec.Warning("cellAdecEndSeq(handle=%d)", handle);
std::shared_ptr<AudioDecoder> adec; std::shared_ptr<AudioDecoder> adec;
if (!Emu.GetIdManager().GetIDData(handle, adec)) if (!Emu.GetIdManager().GetIDData(handle, adec))
@ -642,7 +642,7 @@ int cellAdecEndSeq(u32 handle)
int cellAdecDecodeAu(u32 handle, vm::ptr<CellAdecAuInfo> auInfo) int cellAdecDecodeAu(u32 handle, vm::ptr<CellAdecAuInfo> auInfo)
{ {
cellAdec->Log("cellAdecDecodeAu(handle=%d, auInfo_addr=0x%x)", handle, auInfo.addr()); cellAdec.Log("cellAdecDecodeAu(handle=%d, auInfo_addr=0x%x)", handle, auInfo.addr());
std::shared_ptr<AudioDecoder> adec; std::shared_ptr<AudioDecoder> adec;
if (!Emu.GetIdManager().GetIDData(handle, adec)) if (!Emu.GetIdManager().GetIDData(handle, adec))
@ -657,14 +657,14 @@ int cellAdecDecodeAu(u32 handle, vm::ptr<CellAdecAuInfo> auInfo)
task.au.pts = ((u64)auInfo->pts.upper << 32) | (u64)auInfo->pts.lower; task.au.pts = ((u64)auInfo->pts.upper << 32) | (u64)auInfo->pts.lower;
task.au.userdata = auInfo->userData; task.au.userdata = auInfo->userData;
//cellAdec->Notice("cellAdecDecodeAu(): addr=0x%x, size=0x%x, pts=0x%llx", task.au.addr, task.au.size, task.au.pts); //cellAdec.Notice("cellAdecDecodeAu(): addr=0x%x, size=0x%x, pts=0x%llx", task.au.addr, task.au.size, task.au.pts);
adec->job.push(task, &adec->is_closed); adec->job.push(task, &adec->is_closed);
return CELL_OK; return CELL_OK;
} }
int cellAdecGetPcm(u32 handle, vm::ptr<float> outBuffer) int cellAdecGetPcm(u32 handle, vm::ptr<float> outBuffer)
{ {
cellAdec->Log("cellAdecGetPcm(handle=%d, outBuffer_addr=0x%x)", handle, outBuffer.addr()); cellAdec.Log("cellAdecGetPcm(handle=%d, outBuffer_addr=0x%x)", handle, outBuffer.addr());
std::shared_ptr<AudioDecoder> adec; std::shared_ptr<AudioDecoder> adec;
if (!Emu.GetIdManager().GetIDData(handle, adec)) if (!Emu.GetIdManager().GetIDData(handle, adec))
@ -770,7 +770,7 @@ int cellAdecGetPcm(u32 handle, vm::ptr<float> outBuffer)
} }
else else
{ {
cellAdec->Fatal("cellAdecGetPcm(): unsupported frame format (channels=%d, format=%d)", frame->channels, frame->format); cellAdec.Fatal("cellAdecGetPcm(): unsupported frame format (channels=%d, format=%d)", frame->channels, frame->format);
} }
} }
@ -779,7 +779,7 @@ int cellAdecGetPcm(u32 handle, vm::ptr<float> outBuffer)
int cellAdecGetPcmItem(u32 handle, vm::ptr<u32> pcmItem_ptr) int cellAdecGetPcmItem(u32 handle, vm::ptr<u32> pcmItem_ptr)
{ {
cellAdec->Log("cellAdecGetPcmItem(handle=%d, pcmItem_ptr_addr=0x%x)", handle, pcmItem_ptr.addr()); cellAdec.Log("cellAdecGetPcmItem(handle=%d, pcmItem_ptr_addr=0x%x)", handle, pcmItem_ptr.addr());
std::shared_ptr<AudioDecoder> adec; std::shared_ptr<AudioDecoder> adec;
if (!Emu.GetIdManager().GetIDData(handle, adec)) if (!Emu.GetIdManager().GetIDData(handle, adec))
@ -839,7 +839,7 @@ int cellAdecGetPcmItem(u32 handle, vm::ptr<u32> pcmItem_ptr)
} }
else else
{ {
cellAdec->Error("cellAdecGetPcmItem(): unsupported channel count (%d)", frame->channels); cellAdec.Error("cellAdecGetPcmItem(): unsupported channel count (%d)", frame->channels);
Emu.Pause(); Emu.Pause();
} }
} }
@ -855,10 +855,8 @@ int cellAdecGetPcmItem(u32 handle, vm::ptr<u32> pcmItem_ptr)
return CELL_OK; return CELL_OK;
} }
void cellAdec_init(Module * pxThis) Module cellAdec("cellAdec", []()
{ {
cellAdec = pxThis;
REG_FUNC(cellAdec, cellAdecQueryAttr); REG_FUNC(cellAdec, cellAdecQueryAttr);
REG_FUNC(cellAdec, cellAdecOpen); REG_FUNC(cellAdec, cellAdecOpen);
REG_FUNC(cellAdec, cellAdecOpenEx); REG_FUNC(cellAdec, cellAdecOpenEx);
@ -868,4 +866,4 @@ void cellAdec_init(Module * pxThis)
REG_FUNC(cellAdec, cellAdecDecodeAu); REG_FUNC(cellAdec, cellAdecDecodeAu);
REG_FUNC(cellAdec, cellAdecGetPcm); REG_FUNC(cellAdec, cellAdecGetPcm);
REG_FUNC(cellAdec, cellAdecGetPcmItem); REG_FUNC(cellAdec, cellAdecGetPcmItem);
} });

View file

@ -3,7 +3,7 @@
#include "Emu/System.h" #include "Emu/System.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
Module *cellAtrac = nullptr; extern Module cellAtrac;
#include "cellAtrac.h" #include "cellAtrac.h"
@ -15,7 +15,7 @@ u32 libatrac3plus_rtoc;
s64 cellAtracSetDataAndGetMemSize(vm::ptr<CellAtracHandle> pHandle, u32 pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, vm::ptr<u32> puiWorkMemByte) s64 cellAtracSetDataAndGetMemSize(vm::ptr<CellAtracHandle> pHandle, u32 pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, vm::ptr<u32> puiWorkMemByte)
{ {
cellAtrac->Warning("cellAtracSetDataAndGetMemSize(pHandle=0x%x, pucBufferAddr=0x%x, uiReadByte=0x%x, uiBufferByte=0x%x, puiWorkMemByte_addr=0x%x)", cellAtrac.Warning("cellAtracSetDataAndGetMemSize(pHandle=0x%x, pucBufferAddr=0x%x, uiReadByte=0x%x, uiBufferByte=0x%x, puiWorkMemByte_addr=0x%x)",
pHandle.addr(), pucBufferAddr, uiReadByte, uiBufferByte, puiWorkMemByte.addr()); pHandle.addr(), pucBufferAddr, uiReadByte, uiBufferByte, puiWorkMemByte.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x11F4, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x11F4, libatrac3plus_rtoc);
@ -27,7 +27,7 @@ s64 cellAtracSetDataAndGetMemSize(vm::ptr<CellAtracHandle> pHandle, u32 pucBuffe
s64 cellAtracCreateDecoder(vm::ptr<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, u32 uiSpuThreadPriority) s64 cellAtracCreateDecoder(vm::ptr<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, u32 uiSpuThreadPriority)
{ {
cellAtrac->Warning("cellAtracCreateDecoder(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, uiSpuThreadPriority=%d)", cellAtrac.Warning("cellAtracCreateDecoder(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, uiSpuThreadPriority=%d)",
pHandle.addr(), pucWorkMem_addr, uiPpuThreadPriority, uiSpuThreadPriority); pHandle.addr(), pucWorkMem_addr, uiPpuThreadPriority, uiSpuThreadPriority);
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0FF0, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0FF0, libatrac3plus_rtoc);
@ -39,7 +39,7 @@ s64 cellAtracCreateDecoder(vm::ptr<CellAtracHandle> pHandle, u32 pucWorkMem_addr
s64 cellAtracCreateDecoderExt(vm::ptr<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, vm::ptr<CellAtracExtRes> pExtRes) s64 cellAtracCreateDecoderExt(vm::ptr<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, vm::ptr<CellAtracExtRes> pExtRes)
{ {
cellAtrac->Warning("cellAtracCreateDecoderExt(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, pExtRes_addr=0x%x)", cellAtrac.Warning("cellAtracCreateDecoderExt(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, pExtRes_addr=0x%x)",
pHandle.addr(), pucWorkMem_addr, uiPpuThreadPriority, pExtRes.addr()); pHandle.addr(), pucWorkMem_addr, uiPpuThreadPriority, pExtRes.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0DB0, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0DB0, libatrac3plus_rtoc);
@ -51,7 +51,7 @@ s64 cellAtracCreateDecoderExt(vm::ptr<CellAtracHandle> pHandle, u32 pucWorkMem_a
s64 cellAtracDeleteDecoder(vm::ptr<CellAtracHandle> pHandle) s64 cellAtracDeleteDecoder(vm::ptr<CellAtracHandle> pHandle)
{ {
cellAtrac->Warning("cellAtracDeleteDecoder(pHandle=0x%x)", pHandle.addr()); cellAtrac.Warning("cellAtracDeleteDecoder(pHandle=0x%x)", pHandle.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0D08, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0D08, libatrac3plus_rtoc);
#endif #endif
@ -61,7 +61,7 @@ s64 cellAtracDeleteDecoder(vm::ptr<CellAtracHandle> pHandle)
s64 cellAtracDecode(vm::ptr<CellAtracHandle> pHandle, u32 pfOutAddr, vm::ptr<u32> puiSamples, vm::ptr<u32> puiFinishflag, vm::ptr<u32> piRemainFrame) s64 cellAtracDecode(vm::ptr<CellAtracHandle> pHandle, u32 pfOutAddr, vm::ptr<u32> puiSamples, vm::ptr<u32> puiFinishflag, vm::ptr<u32> piRemainFrame)
{ {
cellAtrac->Warning("cellAtracDecode(pHandle=0x%x, pfOutAddr=0x%x, puiSamples_addr=0x%x, puiFinishFlag_addr=0x%x, piRemainFrame_addr=0x%x)", cellAtrac.Warning("cellAtracDecode(pHandle=0x%x, pfOutAddr=0x%x, puiSamples_addr=0x%x, puiFinishFlag_addr=0x%x, piRemainFrame_addr=0x%x)",
pHandle.addr(), pfOutAddr, puiSamples.addr(), puiFinishflag.addr(), piRemainFrame.addr()); pHandle.addr(), pfOutAddr, puiSamples.addr(), puiFinishflag.addr(), piRemainFrame.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x09A8, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x09A8, libatrac3plus_rtoc);
@ -75,7 +75,7 @@ s64 cellAtracDecode(vm::ptr<CellAtracHandle> pHandle, u32 pfOutAddr, vm::ptr<u32
s64 cellAtracGetStreamDataInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> ppucWritePointer, vm::ptr<u32> puiWritableByte, vm::ptr<u32> puiReadPosition) s64 cellAtracGetStreamDataInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> ppucWritePointer, vm::ptr<u32> puiWritableByte, vm::ptr<u32> puiReadPosition)
{ {
cellAtrac->Warning("cellAtracGetStreamDataInfo(pHandle=0x%x, ppucWritePointer_addr=0x%x, puiWritableByte_addr=0x%x, puiReadPosition_addr=0x%x)", cellAtrac.Warning("cellAtracGetStreamDataInfo(pHandle=0x%x, ppucWritePointer_addr=0x%x, puiWritableByte_addr=0x%x, puiReadPosition_addr=0x%x)",
pHandle.addr(), ppucWritePointer.addr(), puiWritableByte.addr(), puiReadPosition.addr()); pHandle.addr(), ppucWritePointer.addr(), puiWritableByte.addr(), puiReadPosition.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0BE8, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0BE8, libatrac3plus_rtoc);
@ -89,7 +89,7 @@ s64 cellAtracGetStreamDataInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> pp
s64 cellAtracAddStreamData(vm::ptr<CellAtracHandle> pHandle, u32 uiAddByte) s64 cellAtracAddStreamData(vm::ptr<CellAtracHandle> pHandle, u32 uiAddByte)
{ {
cellAtrac->Warning("cellAtracAddStreamData(pHandle=0x%x, uiAddByte=0x%x)", pHandle.addr(), uiAddByte); cellAtrac.Warning("cellAtracAddStreamData(pHandle=0x%x, uiAddByte=0x%x)", pHandle.addr(), uiAddByte);
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0AFC, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0AFC, libatrac3plus_rtoc);
#endif #endif
@ -99,7 +99,7 @@ s64 cellAtracAddStreamData(vm::ptr<CellAtracHandle> pHandle, u32 uiAddByte)
s64 cellAtracGetRemainFrame(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piRemainFrame) s64 cellAtracGetRemainFrame(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piRemainFrame)
{ {
cellAtrac->Warning("cellAtracGetRemainFrame(pHandle=0x%x, piRemainFrame_addr=0x%x)", pHandle.addr(), piRemainFrame.addr()); cellAtrac.Warning("cellAtracGetRemainFrame(pHandle=0x%x, piRemainFrame_addr=0x%x)", pHandle.addr(), piRemainFrame.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x092C, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x092C, libatrac3plus_rtoc);
#endif #endif
@ -110,7 +110,7 @@ s64 cellAtracGetRemainFrame(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piRem
s64 cellAtracGetVacantSize(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiVacantSize) s64 cellAtracGetVacantSize(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiVacantSize)
{ {
cellAtrac->Warning("cellAtracGetVacantSize(pHandle=0x%x, puiVacantSize_addr=0x%x)", pHandle.addr(), puiVacantSize.addr()); cellAtrac.Warning("cellAtracGetVacantSize(pHandle=0x%x, puiVacantSize_addr=0x%x)", pHandle.addr(), puiVacantSize.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x08B0, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x08B0, libatrac3plus_rtoc);
#endif #endif
@ -121,7 +121,7 @@ s64 cellAtracGetVacantSize(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiVac
s64 cellAtracIsSecondBufferNeeded(vm::ptr<CellAtracHandle> pHandle) s64 cellAtracIsSecondBufferNeeded(vm::ptr<CellAtracHandle> pHandle)
{ {
cellAtrac->Warning("cellAtracIsSecondBufferNeeded(pHandle=0x%x)", pHandle.addr()); cellAtrac.Warning("cellAtracIsSecondBufferNeeded(pHandle=0x%x)", pHandle.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0010, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0010, libatrac3plus_rtoc);
#endif #endif
@ -131,7 +131,7 @@ s64 cellAtracIsSecondBufferNeeded(vm::ptr<CellAtracHandle> pHandle)
s64 cellAtracGetSecondBufferInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiReadPosition, vm::ptr<u32> puiDataByte) s64 cellAtracGetSecondBufferInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiReadPosition, vm::ptr<u32> puiDataByte)
{ {
cellAtrac->Warning("cellAtracGetSecondBufferInfo(pHandle=0x%x, puiReadPosition_addr=0x%x, puiDataByte_addr=0x%x)", cellAtrac.Warning("cellAtracGetSecondBufferInfo(pHandle=0x%x, puiReadPosition_addr=0x%x, puiDataByte_addr=0x%x)",
pHandle.addr(), puiReadPosition.addr(), puiDataByte.addr()); pHandle.addr(), puiReadPosition.addr(), puiDataByte.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x07E8, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x07E8, libatrac3plus_rtoc);
@ -144,7 +144,7 @@ s64 cellAtracGetSecondBufferInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32>
s64 cellAtracSetSecondBuffer(vm::ptr<CellAtracHandle> pHandle, u32 pucSecondBufferAddr, u32 uiSecondBufferByte) s64 cellAtracSetSecondBuffer(vm::ptr<CellAtracHandle> pHandle, u32 pucSecondBufferAddr, u32 uiSecondBufferByte)
{ {
cellAtrac->Warning("cellAtracSetSecondBuffer(pHandle=0x%x, pucSecondBufferAddr=0x%x, uiSecondBufferByte=0x%x)", cellAtrac.Warning("cellAtracSetSecondBuffer(pHandle=0x%x, pucSecondBufferAddr=0x%x, uiSecondBufferByte=0x%x)",
pHandle.addr(), pucSecondBufferAddr, uiSecondBufferByte); pHandle.addr(), pucSecondBufferAddr, uiSecondBufferByte);
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0704, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0704, libatrac3plus_rtoc);
@ -155,7 +155,7 @@ s64 cellAtracSetSecondBuffer(vm::ptr<CellAtracHandle> pHandle, u32 pucSecondBuff
s64 cellAtracGetChannel(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiChannel) s64 cellAtracGetChannel(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiChannel)
{ {
cellAtrac->Warning("cellAtracGetChannel(pHandle=0x%x, puiChannel_addr=0x%x)", pHandle.addr(), puiChannel.addr()); cellAtrac.Warning("cellAtracGetChannel(pHandle=0x%x, puiChannel_addr=0x%x)", pHandle.addr(), puiChannel.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0060, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0060, libatrac3plus_rtoc);
#endif #endif
@ -166,7 +166,7 @@ s64 cellAtracGetChannel(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiChanne
s64 cellAtracGetMaxSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiMaxSample) s64 cellAtracGetMaxSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiMaxSample)
{ {
cellAtrac->Warning("cellAtracGetMaxSample(pHandle=0x%x, puiMaxSample_addr=0x%x)", pHandle.addr(), puiMaxSample.addr()); cellAtrac.Warning("cellAtracGetMaxSample(pHandle=0x%x, puiMaxSample_addr=0x%x)", pHandle.addr(), puiMaxSample.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x00AC, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x00AC, libatrac3plus_rtoc);
#endif #endif
@ -177,7 +177,7 @@ s64 cellAtracGetMaxSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiMaxS
s64 cellAtracGetNextSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiNextSample) s64 cellAtracGetNextSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiNextSample)
{ {
cellAtrac->Warning("cellAtracGetNextSample(pHandle=0x%x, puiNextSample_addr=0x%x)", pHandle.addr(), puiNextSample.addr()); cellAtrac.Warning("cellAtracGetNextSample(pHandle=0x%x, puiNextSample_addr=0x%x)", pHandle.addr(), puiNextSample.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0688, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0688, libatrac3plus_rtoc);
#endif #endif
@ -188,7 +188,7 @@ s64 cellAtracGetNextSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiNex
s64 cellAtracGetSoundInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piEndSample, vm::ptr<u32> piLoopStartSample, vm::ptr<u32> piLoopEndSample) s64 cellAtracGetSoundInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piEndSample, vm::ptr<u32> piLoopStartSample, vm::ptr<u32> piLoopEndSample)
{ {
cellAtrac->Warning("cellAtracGetSoundInfo(pHandle=0x%x, piEndSample_addr=0x%x, piLoopStartSample_addr=0x%x, piLoopEndSample_addr=0x%x)", cellAtrac.Warning("cellAtracGetSoundInfo(pHandle=0x%x, piEndSample_addr=0x%x, piLoopStartSample_addr=0x%x, piLoopEndSample_addr=0x%x)",
pHandle.addr(), piEndSample.addr(), piLoopStartSample.addr(), piLoopEndSample.addr()); pHandle.addr(), piEndSample.addr(), piLoopStartSample.addr(), piLoopEndSample.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0104, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0104, libatrac3plus_rtoc);
@ -202,7 +202,7 @@ s64 cellAtracGetSoundInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piEndSa
s64 cellAtracGetNextDecodePosition(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiSamplePosition) s64 cellAtracGetNextDecodePosition(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiSamplePosition)
{ {
cellAtrac->Warning("cellAtracGetNextDecodePosition(pHandle=0x%x, puiSamplePosition_addr=0x%x)", cellAtrac.Warning("cellAtracGetNextDecodePosition(pHandle=0x%x, puiSamplePosition_addr=0x%x)",
pHandle.addr(), puiSamplePosition.addr()); pHandle.addr(), puiSamplePosition.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0190, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0190, libatrac3plus_rtoc);
@ -214,7 +214,7 @@ s64 cellAtracGetNextDecodePosition(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32
s64 cellAtracGetBitrate(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiBitrate) s64 cellAtracGetBitrate(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiBitrate)
{ {
cellAtrac->Warning("cellAtracGetBitrate(pHandle=0x%x, puiBitrate_addr=0x%x)", cellAtrac.Warning("cellAtracGetBitrate(pHandle=0x%x, puiBitrate_addr=0x%x)",
pHandle.addr(), puiBitrate.addr()); pHandle.addr(), puiBitrate.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0374, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x0374, libatrac3plus_rtoc);
@ -226,7 +226,7 @@ s64 cellAtracGetBitrate(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiBitrat
s64 cellAtracGetLoopInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piLoopNum, vm::ptr<u32> puiLoopStatus) s64 cellAtracGetLoopInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piLoopNum, vm::ptr<u32> puiLoopStatus)
{ {
cellAtrac->Warning("cellAtracGetLoopInfo(pHandle=0x%x, piLoopNum_addr=0x%x, puiLoopStatus_addr=0x%x)", cellAtrac.Warning("cellAtracGetLoopInfo(pHandle=0x%x, piLoopNum_addr=0x%x, puiLoopStatus_addr=0x%x)",
pHandle.addr(), piLoopNum.addr(), puiLoopStatus.addr()); pHandle.addr(), piLoopNum.addr(), puiLoopStatus.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x025C, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x025C, libatrac3plus_rtoc);
@ -239,7 +239,7 @@ s64 cellAtracGetLoopInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piLoopNu
s64 cellAtracSetLoopNum(vm::ptr<CellAtracHandle> pHandle, int iLoopNum) s64 cellAtracSetLoopNum(vm::ptr<CellAtracHandle> pHandle, int iLoopNum)
{ {
cellAtrac->Warning("cellAtracSetLoopNum(pHandle=0x%x, iLoopNum=0x%x)", pHandle.addr(), iLoopNum); cellAtrac.Warning("cellAtracSetLoopNum(pHandle=0x%x, iLoopNum=0x%x)", pHandle.addr(), iLoopNum);
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x1538, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x1538, libatrac3plus_rtoc);
#endif #endif
@ -249,7 +249,7 @@ s64 cellAtracSetLoopNum(vm::ptr<CellAtracHandle> pHandle, int iLoopNum)
s64 cellAtracGetBufferInfoForResetting(vm::ptr<CellAtracHandle> pHandle, u32 uiSample, vm::ptr<CellAtracBufferInfo> pBufferInfo) s64 cellAtracGetBufferInfoForResetting(vm::ptr<CellAtracHandle> pHandle, u32 uiSample, vm::ptr<CellAtracBufferInfo> pBufferInfo)
{ {
cellAtrac->Warning("cellAtracGetBufferInfoForResetting(pHandle=0x%x, uiSample=0x%x, pBufferInfo_addr=0x%x)", cellAtrac.Warning("cellAtracGetBufferInfoForResetting(pHandle=0x%x, uiSample=0x%x, pBufferInfo_addr=0x%x)",
pHandle.addr(), uiSample, pBufferInfo.addr()); pHandle.addr(), uiSample, pBufferInfo.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x05BC, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x05BC, libatrac3plus_rtoc);
@ -264,7 +264,7 @@ s64 cellAtracGetBufferInfoForResetting(vm::ptr<CellAtracHandle> pHandle, u32 uiS
s64 cellAtracResetPlayPosition(vm::ptr<CellAtracHandle> pHandle, u32 uiSample, u32 uiWriteByte) s64 cellAtracResetPlayPosition(vm::ptr<CellAtracHandle> pHandle, u32 uiSample, u32 uiWriteByte)
{ {
cellAtrac->Warning("cellAtracResetPlayPosition(pHandle=0x%x, uiSample=0x%x, uiWriteByte=0x%x)", cellAtrac.Warning("cellAtracResetPlayPosition(pHandle=0x%x, uiSample=0x%x, uiWriteByte=0x%x)",
pHandle.addr(), uiSample, uiWriteByte); pHandle.addr(), uiSample, uiWriteByte);
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x04E4, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x04E4, libatrac3plus_rtoc);
@ -275,7 +275,7 @@ s64 cellAtracResetPlayPosition(vm::ptr<CellAtracHandle> pHandle, u32 uiSample, u
s64 cellAtracGetInternalErrorInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piResult) s64 cellAtracGetInternalErrorInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piResult)
{ {
cellAtrac->Warning("cellAtracGetInternalErrorInfo(pHandle=0x%x, piResult_addr=0x%x)", cellAtrac.Warning("cellAtracGetInternalErrorInfo(pHandle=0x%x, piResult_addr=0x%x)",
pHandle.addr(), piResult.addr()); pHandle.addr(), piResult.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x02E4, libatrac3plus_rtoc); return GetCurrentPPUThread().FastCall2(libatrac3plus + 0x02E4, libatrac3plus_rtoc);
@ -285,40 +285,38 @@ s64 cellAtracGetInternalErrorInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32>
return CELL_OK; return CELL_OK;
} }
void cellAtrac_init(Module *pxThis) Module cellAtrac("cellAtrac", []()
{ {
cellAtrac = pxThis; cellAtrac.AddFunc(0x66afc68e, cellAtracSetDataAndGetMemSize);
cellAtrac->AddFunc(0x66afc68e, cellAtracSetDataAndGetMemSize); cellAtrac.AddFunc(0xfa293e88, cellAtracCreateDecoder);
cellAtrac.AddFunc(0x2642d4cc, cellAtracCreateDecoderExt);
cellAtrac.AddFunc(0x761cb9be, cellAtracDeleteDecoder);
cellAtrac->AddFunc(0xfa293e88, cellAtracCreateDecoder); cellAtrac.AddFunc(0x8eb0e65f, cellAtracDecode);
cellAtrac->AddFunc(0x2642d4cc, cellAtracCreateDecoderExt);
cellAtrac->AddFunc(0x761cb9be, cellAtracDeleteDecoder);
cellAtrac->AddFunc(0x8eb0e65f, cellAtracDecode); cellAtrac.AddFunc(0x2bfff084, cellAtracGetStreamDataInfo);
cellAtrac.AddFunc(0x46cfc013, cellAtracAddStreamData);
cellAtrac.AddFunc(0xdfab73aa, cellAtracGetRemainFrame);
cellAtrac.AddFunc(0xc9a95fcb, cellAtracGetVacantSize);
cellAtrac.AddFunc(0x99efe171, cellAtracIsSecondBufferNeeded);
cellAtrac.AddFunc(0xbe07f05e, cellAtracGetSecondBufferInfo);
cellAtrac.AddFunc(0x06ddb53e, cellAtracSetSecondBuffer);
cellAtrac->AddFunc(0x2bfff084, cellAtracGetStreamDataInfo); cellAtrac.AddFunc(0x0f9667b6, cellAtracGetChannel);
cellAtrac->AddFunc(0x46cfc013, cellAtracAddStreamData); cellAtrac.AddFunc(0x5f62d546, cellAtracGetMaxSample);
cellAtrac->AddFunc(0xdfab73aa, cellAtracGetRemainFrame); cellAtrac.AddFunc(0x4797d1ff, cellAtracGetNextSample);
cellAtrac->AddFunc(0xc9a95fcb, cellAtracGetVacantSize); cellAtrac.AddFunc(0xcf01d5d4, cellAtracGetSoundInfo);
cellAtrac->AddFunc(0x99efe171, cellAtracIsSecondBufferNeeded); cellAtrac.AddFunc(0x7b22e672, cellAtracGetNextDecodePosition);
cellAtrac->AddFunc(0xbe07f05e, cellAtracGetSecondBufferInfo); cellAtrac.AddFunc(0x006016da, cellAtracGetBitrate);
cellAtrac->AddFunc(0x06ddb53e, cellAtracSetSecondBuffer);
cellAtrac->AddFunc(0x0f9667b6, cellAtracGetChannel); cellAtrac.AddFunc(0xab6b6dbf, cellAtracGetLoopInfo);
cellAtrac->AddFunc(0x5f62d546, cellAtracGetMaxSample); cellAtrac.AddFunc(0x78ba5c41, cellAtracSetLoopNum);
cellAtrac->AddFunc(0x4797d1ff, cellAtracGetNextSample);
cellAtrac->AddFunc(0xcf01d5d4, cellAtracGetSoundInfo);
cellAtrac->AddFunc(0x7b22e672, cellAtracGetNextDecodePosition);
cellAtrac->AddFunc(0x006016da, cellAtracGetBitrate);
cellAtrac->AddFunc(0xab6b6dbf, cellAtracGetLoopInfo); cellAtrac.AddFunc(0x99fb73d1, cellAtracGetBufferInfoForResetting);
cellAtrac->AddFunc(0x78ba5c41, cellAtracSetLoopNum); cellAtrac.AddFunc(0x7772eb2b, cellAtracResetPlayPosition);
cellAtrac->AddFunc(0x99fb73d1, cellAtracGetBufferInfoForResetting); cellAtrac.AddFunc(0xb5c11938, cellAtracGetInternalErrorInfo);
cellAtrac->AddFunc(0x7772eb2b, cellAtracResetPlayPosition);
cellAtrac->AddFunc(0xb5c11938, cellAtracGetInternalErrorInfo);
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
CallAfter([]() CallAfter([]()
@ -342,4 +340,4 @@ void cellAtrac_init(Module *pxThis)
fix_relocs(cellAtrac, libatrac3plus, 0x3EF0, 0x5048, 0x3CE0); fix_relocs(cellAtrac, libatrac3plus, 0x3EF0, 0x5048, 0x3CE0);
}); });
#endif #endif
} });

View file

@ -15,13 +15,13 @@
#include "cellAudio.h" #include "cellAudio.h"
Module *cellAudio = nullptr; extern Module cellAudio;
AudioConfig g_audio; AudioConfig g_audio;
s32 cellAudioInit() s32 cellAudioInit()
{ {
cellAudio->Warning("cellAudioInit()"); cellAudio.Warning("cellAudioInit()");
if (!g_audio.state.compare_and_swap_test(AUDIO_STATE_NOT_INITIALIZED, AUDIO_STATE_INITIALIZED)) if (!g_audio.state.compare_and_swap_test(AUDIO_STATE_NOT_INITIALIZED, AUDIO_STATE_INITIALIZED))
{ {
@ -177,7 +177,7 @@ s32 cellAudioInit()
const u64 missed_time = stamp0 - g_audio.start_time - expected_time; const u64 missed_time = stamp0 - g_audio.start_time - expected_time;
if (missed_time > AUDIO_SAMPLES * MHZ / 48000) if (missed_time > AUDIO_SAMPLES * MHZ / 48000)
{ {
cellAudio->Notice("%f ms adjusted", (float)missed_time / 1000); cellAudio.Notice("%f ms adjusted", (float)missed_time / 1000);
g_audio.start_time += missed_time; g_audio.start_time += missed_time;
} }
@ -434,7 +434,7 @@ s32 cellAudioInit()
s32 cellAudioQuit() s32 cellAudioQuit()
{ {
cellAudio->Warning("cellAudioQuit()"); cellAudio.Warning("cellAudioQuit()");
if (!g_audio.state.compare_and_swap_test(AUDIO_STATE_INITIALIZED, AUDIO_STATE_FINALIZED)) if (!g_audio.state.compare_and_swap_test(AUDIO_STATE_INITIALIZED, AUDIO_STATE_FINALIZED))
{ {
@ -448,7 +448,7 @@ s32 cellAudioQuit()
s32 cellAudioPortOpen(vm::ptr<CellAudioPortParam> audioParam, vm::ptr<u32> portNum) s32 cellAudioPortOpen(vm::ptr<CellAudioPortParam> audioParam, vm::ptr<u32> portNum)
{ {
cellAudio->Warning("cellAudioPortOpen(audioParam=0x%x, portNum=0x%x)", audioParam, portNum); cellAudio.Warning("cellAudioPortOpen(audioParam=0x%x, portNum=0x%x)", audioParam, portNum);
if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED) if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED)
{ {
@ -484,35 +484,35 @@ s32 cellAudioPortOpen(vm::ptr<CellAudioPortParam> audioParam, vm::ptr<u32> portN
// list unsupported flags // list unsupported flags
if (attr & CELL_AUDIO_PORTATTR_BGM) if (attr & CELL_AUDIO_PORTATTR_BGM)
{ {
cellAudio->Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_BGM"); cellAudio.Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_BGM");
} }
if (attr & CELL_AUDIO_PORTATTR_OUT_SECONDARY) if (attr & CELL_AUDIO_PORTATTR_OUT_SECONDARY)
{ {
cellAudio->Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_OUT_SECONDARY"); cellAudio.Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_OUT_SECONDARY");
} }
if (attr & CELL_AUDIO_PORTATTR_OUT_PERSONAL_0) if (attr & CELL_AUDIO_PORTATTR_OUT_PERSONAL_0)
{ {
cellAudio->Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_OUT_PERSONAL_0"); cellAudio.Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_OUT_PERSONAL_0");
} }
if (attr & CELL_AUDIO_PORTATTR_OUT_PERSONAL_1) if (attr & CELL_AUDIO_PORTATTR_OUT_PERSONAL_1)
{ {
cellAudio->Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_OUT_PERSONAL_1"); cellAudio.Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_OUT_PERSONAL_1");
} }
if (attr & CELL_AUDIO_PORTATTR_OUT_PERSONAL_2) if (attr & CELL_AUDIO_PORTATTR_OUT_PERSONAL_2)
{ {
cellAudio->Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_OUT_PERSONAL_2"); cellAudio.Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_OUT_PERSONAL_2");
} }
if (attr & CELL_AUDIO_PORTATTR_OUT_PERSONAL_3) if (attr & CELL_AUDIO_PORTATTR_OUT_PERSONAL_3)
{ {
cellAudio->Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_OUT_PERSONAL_3"); cellAudio.Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_OUT_PERSONAL_3");
} }
if (attr & CELL_AUDIO_PORTATTR_OUT_NO_ROUTE) if (attr & CELL_AUDIO_PORTATTR_OUT_NO_ROUTE)
{ {
cellAudio->Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_OUT_NO_ROUTE"); cellAudio.Todo("cellAudioPortOpen(): CELL_AUDIO_PORTATTR_OUT_NO_ROUTE");
} }
if (attr & 0xFFFFFFFFF0EFEFEEULL) if (attr & 0xFFFFFFFFF0EFEFEEULL)
{ {
cellAudio->Todo("cellAudioPortOpen(): unknown attributes set (0x%llx)", attr); cellAudio.Todo("cellAudioPortOpen(): unknown attributes set (0x%llx)", attr);
} }
// open audio port // open audio port
@ -546,14 +546,14 @@ s32 cellAudioPortOpen(vm::ptr<CellAudioPortParam> audioParam, vm::ptr<u32> portN
port.level_inc = 0.0f; port.level_inc = 0.0f;
*portNum = port_index; *portNum = port_index;
cellAudio->Warning("*** audio port opened(nChannel=%d, nBlock=%d, attr=0x%llx, level=%f): port = %d", channel, block, attr, port.level, port_index); cellAudio.Warning("*** audio port opened(nChannel=%d, nBlock=%d, attr=0x%llx, level=%f): port = %d", channel, block, attr, port.level, port_index);
return CELL_OK; return CELL_OK;
} }
s32 cellAudioGetPortConfig(u32 portNum, vm::ptr<CellAudioPortConfig> portConfig) s32 cellAudioGetPortConfig(u32 portNum, vm::ptr<CellAudioPortConfig> portConfig)
{ {
cellAudio->Warning("cellAudioGetPortConfig(portNum=0x%x, portConfig=0x%x)", portNum, portConfig); cellAudio.Warning("cellAudioGetPortConfig(portNum=0x%x, portConfig=0x%x)", portNum, portConfig);
if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED) if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED)
{ {
@ -586,7 +586,7 @@ s32 cellAudioGetPortConfig(u32 portNum, vm::ptr<CellAudioPortConfig> portConfig)
s32 cellAudioPortStart(u32 portNum) s32 cellAudioPortStart(u32 portNum)
{ {
cellAudio->Warning("cellAudioPortStart(portNum=0x%x)", portNum); cellAudio.Warning("cellAudioPortStart(portNum=0x%x)", portNum);
if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED) if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED)
{ {
@ -609,7 +609,7 @@ s32 cellAudioPortStart(u32 portNum)
s32 cellAudioPortClose(u32 portNum) s32 cellAudioPortClose(u32 portNum)
{ {
cellAudio->Warning("cellAudioPortClose(portNum=0x%x)", portNum); cellAudio.Warning("cellAudioPortClose(portNum=0x%x)", portNum);
if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED) if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED)
{ {
@ -632,7 +632,7 @@ s32 cellAudioPortClose(u32 portNum)
s32 cellAudioPortStop(u32 portNum) s32 cellAudioPortStop(u32 portNum)
{ {
cellAudio->Warning("cellAudioPortStop(portNum=0x%x)", portNum); cellAudio.Warning("cellAudioPortStop(portNum=0x%x)", portNum);
if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED) if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED)
{ {
@ -655,7 +655,7 @@ s32 cellAudioPortStop(u32 portNum)
s32 cellAudioGetPortTimestamp(u32 portNum, u64 tag, vm::ptr<u64> stamp) s32 cellAudioGetPortTimestamp(u32 portNum, u64 tag, vm::ptr<u64> stamp)
{ {
cellAudio->Log("cellAudioGetPortTimestamp(portNum=0x%x, tag=0x%llx, stamp=0x%x)", portNum, tag, stamp); cellAudio.Log("cellAudioGetPortTimestamp(portNum=0x%x, tag=0x%llx, stamp=0x%x)", portNum, tag, stamp);
if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED) if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED)
{ {
@ -685,7 +685,7 @@ s32 cellAudioGetPortTimestamp(u32 portNum, u64 tag, vm::ptr<u64> stamp)
s32 cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, vm::ptr<u64> tag) s32 cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, vm::ptr<u64> tag)
{ {
cellAudio->Log("cellAudioGetPortBlockTag(portNum=0x%x, blockNo=0x%llx, tag=0x%x)", portNum, blockNo, tag); cellAudio.Log("cellAudioGetPortBlockTag(portNum=0x%x, blockNo=0x%llx, tag=0x%x)", portNum, blockNo, tag);
if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED) if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED)
{ {
@ -728,7 +728,7 @@ s32 cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, vm::ptr<u64> tag)
s32 cellAudioSetPortLevel(u32 portNum, float level) s32 cellAudioSetPortLevel(u32 portNum, float level)
{ {
cellAudio->Log("cellAudioSetPortLevel(portNum=0x%x, level=%f)", portNum, level); cellAudio.Log("cellAudioSetPortLevel(portNum=0x%x, level=%f)", portNum, level);
if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED) if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED)
{ {
@ -756,7 +756,7 @@ s32 cellAudioSetPortLevel(u32 portNum, float level)
} }
else else
{ {
cellAudio->Todo("cellAudioSetPortLevel(portNum=0x%x): negative level value (%f)", portNum, level); cellAudio.Todo("cellAudioSetPortLevel(portNum=0x%x): negative level value (%f)", portNum, level);
} }
return CELL_OK; return CELL_OK;
@ -765,7 +765,7 @@ s32 cellAudioSetPortLevel(u32 portNum, float level)
// Utility Functions // Utility Functions
int cellAudioCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> key) int cellAudioCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> key)
{ {
cellAudio->Warning("cellAudioCreateNotifyEventQueue(id_addr=0x%x, key_addr=0x%x)", id.addr(), key.addr()); cellAudio.Warning("cellAudioCreateNotifyEventQueue(id_addr=0x%x, key_addr=0x%x)", id.addr(), key.addr());
std::lock_guard<std::mutex> lock(g_audio.mutex); std::lock_guard<std::mutex> lock(g_audio.mutex);
@ -784,7 +784,7 @@ int cellAudioCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> key)
return CELL_AUDIO_ERROR_EVENT_QUEUE; return CELL_AUDIO_ERROR_EVENT_QUEUE;
} }
*id = cellAudio->GetNewId(eq); *id = cellAudio.GetNewId(eq);
*key = event_key; *key = event_key;
return CELL_OK; return CELL_OK;
@ -792,13 +792,13 @@ int cellAudioCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> key)
int cellAudioCreateNotifyEventQueueEx(vm::ptr<u32> id, vm::ptr<u64> key, u32 iFlags) int cellAudioCreateNotifyEventQueueEx(vm::ptr<u32> id, vm::ptr<u64> key, u32 iFlags)
{ {
cellAudio->Todo("cellAudioCreateNotifyEventQueueEx(id_addr=0x%x, key_addr=0x%x, iFlags=0x%x)", id.addr(), key.addr(), iFlags); cellAudio.Todo("cellAudioCreateNotifyEventQueueEx(id_addr=0x%x, key_addr=0x%x, iFlags=0x%x)", id.addr(), key.addr(), iFlags);
return CELL_OK; return CELL_OK;
} }
int cellAudioSetNotifyEventQueue(u64 key) int cellAudioSetNotifyEventQueue(u64 key)
{ {
cellAudio->Warning("cellAudioSetNotifyEventQueue(key=0x%llx)", key); cellAudio.Warning("cellAudioSetNotifyEventQueue(key=0x%llx)", key);
std::lock_guard<std::mutex> lock(g_audio.mutex); std::lock_guard<std::mutex> lock(g_audio.mutex);
@ -824,13 +824,13 @@ int cellAudioSetNotifyEventQueue(u64 key)
int cellAudioSetNotifyEventQueueEx(u64 key, u32 iFlags) int cellAudioSetNotifyEventQueueEx(u64 key, u32 iFlags)
{ {
cellAudio->Todo("cellAudioSetNotifyEventQueueEx(key=0x%llx, iFlags=0x%x)", key, iFlags); cellAudio.Todo("cellAudioSetNotifyEventQueueEx(key=0x%llx, iFlags=0x%x)", key, iFlags);
return CELL_OK; return CELL_OK;
} }
int cellAudioRemoveNotifyEventQueue(u64 key) int cellAudioRemoveNotifyEventQueue(u64 key)
{ {
cellAudio->Warning("cellAudioRemoveNotifyEventQueue(key=0x%llx)", key); cellAudio.Warning("cellAudioRemoveNotifyEventQueue(key=0x%llx)", key);
std::lock_guard<std::mutex> lock(g_audio.mutex); std::lock_guard<std::mutex> lock(g_audio.mutex);
@ -864,13 +864,13 @@ int cellAudioRemoveNotifyEventQueue(u64 key)
int cellAudioRemoveNotifyEventQueueEx(u64 key, u32 iFlags) int cellAudioRemoveNotifyEventQueueEx(u64 key, u32 iFlags)
{ {
cellAudio->Todo("cellAudioRemoveNotifyEventQueueEx(key=0x%llx, iFlags=0x%x)", key, iFlags); cellAudio.Todo("cellAudioRemoveNotifyEventQueueEx(key=0x%llx, iFlags=0x%x)", key, iFlags);
return CELL_OK; return CELL_OK;
} }
s32 cellAudioAddData(u32 portNum, vm::ptr<float> src, u32 samples, float volume) s32 cellAudioAddData(u32 portNum, vm::ptr<float> src, u32 samples, float volume)
{ {
cellAudio->Log("cellAudioAddData(portNum=%d, src=0x%x, samples=%d, volume=%f)", portNum, src, samples, volume); cellAudio.Log("cellAudioAddData(portNum=%d, src=0x%x, samples=%d, volume=%f)", portNum, src, samples, volume);
if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED) if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED)
{ {
@ -885,7 +885,7 @@ s32 cellAudioAddData(u32 portNum, vm::ptr<float> src, u32 samples, float volume)
if (samples != 256) if (samples != 256)
{ {
// despite the docs, seems that only fixed value is supported // despite the docs, seems that only fixed value is supported
cellAudio->Error("cellAudioAddData(): invalid samples value (0x%x)", samples); cellAudio.Error("cellAudioAddData(): invalid samples value (0x%x)", samples);
return CELL_AUDIO_ERROR_PARAM; return CELL_AUDIO_ERROR_PARAM;
} }
@ -903,7 +903,7 @@ s32 cellAudioAddData(u32 portNum, vm::ptr<float> src, u32 samples, float volume)
s32 cellAudioAdd2chData(u32 portNum, vm::ptr<float> src, u32 samples, float volume) s32 cellAudioAdd2chData(u32 portNum, vm::ptr<float> src, u32 samples, float volume)
{ {
cellAudio->Log("cellAudioAdd2chData(portNum=%d, src=0x%x, samples=%d, volume=%f)", portNum, src, samples, volume); cellAudio.Log("cellAudioAdd2chData(portNum=%d, src=0x%x, samples=%d, volume=%f)", portNum, src, samples, volume);
if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED) if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED)
{ {
@ -918,7 +918,7 @@ s32 cellAudioAdd2chData(u32 portNum, vm::ptr<float> src, u32 samples, float volu
if (samples != 256) if (samples != 256)
{ {
// despite the docs, seems that only fixed value is supported // despite the docs, seems that only fixed value is supported
cellAudio->Error("cellAudioAdd2chData(): invalid samples value (0x%x)", samples); cellAudio.Error("cellAudioAdd2chData(): invalid samples value (0x%x)", samples);
return CELL_AUDIO_ERROR_PARAM; return CELL_AUDIO_ERROR_PARAM;
} }
@ -928,7 +928,7 @@ s32 cellAudioAdd2chData(u32 portNum, vm::ptr<float> src, u32 samples, float volu
if (port.channel == 2) if (port.channel == 2)
{ {
cellAudio->Error("cellAudioAdd2chData(portNum=%d): port.channel = 2", portNum); cellAudio.Error("cellAudioAdd2chData(portNum=%d): port.channel = 2", portNum);
} }
else if (port.channel == 6) else if (port.channel == 6)
{ {
@ -958,7 +958,7 @@ s32 cellAudioAdd2chData(u32 portNum, vm::ptr<float> src, u32 samples, float volu
} }
else else
{ {
cellAudio->Error("cellAudioAdd2chData(portNum=%d): invalid port.channel value (%d)", portNum, port.channel); cellAudio.Error("cellAudioAdd2chData(portNum=%d): invalid port.channel value (%d)", portNum, port.channel);
} }
return CELL_OK; return CELL_OK;
@ -966,7 +966,7 @@ s32 cellAudioAdd2chData(u32 portNum, vm::ptr<float> src, u32 samples, float volu
s32 cellAudioAdd6chData(u32 portNum, vm::ptr<float> src, float volume) s32 cellAudioAdd6chData(u32 portNum, vm::ptr<float> src, float volume)
{ {
cellAudio->Log("cellAudioAdd6chData(portNum=%d, src=0x%x, volume=%f)", portNum, src, volume); cellAudio.Log("cellAudioAdd6chData(portNum=%d, src=0x%x, volume=%f)", portNum, src, volume);
if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED) if (g_audio.state.read_relaxed() != AUDIO_STATE_INITIALIZED)
{ {
@ -984,7 +984,7 @@ s32 cellAudioAdd6chData(u32 portNum, vm::ptr<float> src, float volume)
if (port.channel == 2 || port.channel == 6) if (port.channel == 2 || port.channel == 6)
{ {
cellAudio->Error("cellAudioAdd2chData(portNum=%d): port.channel = %d", portNum, port.channel); cellAudio.Error("cellAudioAdd2chData(portNum=%d): port.channel = %d", portNum, port.channel);
} }
else if (port.channel == 8) else if (port.channel == 8)
{ {
@ -1002,7 +1002,7 @@ s32 cellAudioAdd6chData(u32 portNum, vm::ptr<float> src, float volume)
} }
else else
{ {
cellAudio->Error("cellAudioAdd6chData(portNum=%d): invalid port.channel value (%d)", portNum, port.channel); cellAudio.Error("cellAudioAdd6chData(portNum=%d): invalid port.channel value (%d)", portNum, port.channel);
} }
return CELL_OK; return CELL_OK;
@ -1010,32 +1010,30 @@ s32 cellAudioAdd6chData(u32 portNum, vm::ptr<float> src, float volume)
int cellAudioMiscSetAccessoryVolume(u32 devNum, float volume) int cellAudioMiscSetAccessoryVolume(u32 devNum, float volume)
{ {
cellAudio->Todo("cellAudioMiscSetAccessoryVolume(devNum=0x%x, volume=%f)", devNum, volume); cellAudio.Todo("cellAudioMiscSetAccessoryVolume(devNum=0x%x, volume=%f)", devNum, volume);
return CELL_OK; return CELL_OK;
} }
int cellAudioSendAck(u64 data3) int cellAudioSendAck(u64 data3)
{ {
cellAudio->Todo("cellAudioSendAck(data3=0x%llx)", data3); cellAudio.Todo("cellAudioSendAck(data3=0x%llx)", data3);
return CELL_OK; return CELL_OK;
} }
int cellAudioSetPersonalDevice(int iPersonalStream, int iDevice) int cellAudioSetPersonalDevice(int iPersonalStream, int iDevice)
{ {
cellAudio->Todo("cellAudioSetPersonalDevice(iPersonalStream=0x%x, iDevice=0x%x)", iPersonalStream, iDevice); cellAudio.Todo("cellAudioSetPersonalDevice(iPersonalStream=0x%x, iDevice=0x%x)", iPersonalStream, iDevice);
return CELL_OK; return CELL_OK;
} }
int cellAudioUnsetPersonalDevice(int iPersonalStream) int cellAudioUnsetPersonalDevice(int iPersonalStream)
{ {
cellAudio->Todo("cellAudioUnsetPersonalDevice(iPersonalStream=0x%x)", iPersonalStream); cellAudio.Todo("cellAudioUnsetPersonalDevice(iPersonalStream=0x%x)", iPersonalStream);
return CELL_OK; return CELL_OK;
} }
void cellAudio_init(Module *pxThis) Module cellAudio("cellAudio", []()
{ {
cellAudio = pxThis;
g_audio.state.write_relaxed(AUDIO_STATE_NOT_INITIALIZED); g_audio.state.write_relaxed(AUDIO_STATE_NOT_INITIALIZED);
g_audio.buffer = 0; g_audio.buffer = 0;
g_audio.indexes = 0; g_audio.indexes = 0;
@ -1063,9 +1061,4 @@ void cellAudio_init(Module *pxThis)
REG_FUNC(cellAudio, cellAudioSendAck); REG_FUNC(cellAudio, cellAudioSendAck);
REG_FUNC(cellAudio, cellAudioSetPersonalDevice); REG_FUNC(cellAudio, cellAudioSetPersonalDevice);
REG_FUNC(cellAudio, cellAudioUnsetPersonalDevice); REG_FUNC(cellAudio, cellAudioUnsetPersonalDevice);
} });
void cellAudio_load()
{
// CELL_SYSMODULE AUDIO module is rarely loaded manually, so cellAudio_load() won't be called in every case
}

View file

@ -4,7 +4,7 @@
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
#include "Emu/RSX/sysutil_video.h" #include "Emu/RSX/sysutil_video.h"
Module *cellAvconfExt = nullptr; extern Module cellAvconfExt;
int cellVideoOutConvertCursorColor() int cellVideoOutConvertCursorColor()
{ {
@ -14,7 +14,7 @@ int cellVideoOutConvertCursorColor()
int cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<float> screenSize) int cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<float> screenSize)
{ {
cellAvconfExt->Warning("cellVideoOutGetScreenSize(videoOut=%d, screenSize_addr=0x%x)", videoOut, screenSize.addr()); cellAvconfExt.Warning("cellVideoOutGetScreenSize(videoOut=%d, screenSize_addr=0x%x)", videoOut, screenSize.addr());
if (videoOut != CELL_VIDEO_OUT_PRIMARY) if (videoOut != CELL_VIDEO_OUT_PRIMARY)
{ {
@ -53,12 +53,10 @@ int cellVideoOutSetGamma()
return CELL_OK; return CELL_OK;
} }
void cellAvconfExt_init(Module *pxThis) Module cellAvconfExt("cellAvconfExt", []()
{ {
cellAvconfExt = pxThis;
REG_FUNC(cellAvconfExt, cellVideoOutConvertCursorColor); REG_FUNC(cellAvconfExt, cellVideoOutConvertCursorColor);
REG_FUNC(cellAvconfExt, cellVideoOutGetScreenSize); REG_FUNC(cellAvconfExt, cellVideoOutGetScreenSize);
REG_FUNC(cellAvconfExt, cellVideoOutGetGamma); REG_FUNC(cellAvconfExt, cellVideoOutGetGamma);
REG_FUNC(cellAvconfExt, cellVideoOutSetGamma); REG_FUNC(cellAvconfExt, cellVideoOutSetGamma);
} });

View file

@ -5,7 +5,7 @@
#include "cellCamera.h" #include "cellCamera.h"
Module *cellCamera = nullptr; extern Module cellCamera;
const char* attributes[] = {"GAIN", "REDBLUEGAIN", "SATURATION", "EXPOSURE", "BRIGHTNESS", "AEC", "AGC", "AWB", "ABC", "LED", "AUDIOGAIN", "QS", "NONZEROCOEFFS", "YUVFLAG", const char* attributes[] = {"GAIN", "REDBLUEGAIN", "SATURATION", "EXPOSURE", "BRIGHTNESS", "AEC", "AGC", "AWB", "ABC", "LED", "AUDIOGAIN", "QS", "NONZEROCOEFFS", "YUVFLAG",
"JPEGFLAG", "BACKLIGHTCOMP", "MIRRORFLAG", "MEASUREDQS", "422FLAG", "USBLOAD", "GAMMA", "GREENGAIN", "AGCLIMIT", "DENOISE", "FRAMERATEADJUST", "JPEGFLAG", "BACKLIGHTCOMP", "MIRRORFLAG", "MEASUREDQS", "422FLAG", "USBLOAD", "GAMMA", "GREENGAIN", "AGCLIMIT", "DENOISE", "FRAMERATEADJUST",
"PIXELOUTLIERFILTER", "AGCLOW", "AGCHIGH", "DEVICELOCATION", "FORMATCAP", "FORMATINDEX", "NUMFRAME", "FRAMEINDEX", "FRAMESIZE", "INTERVALTYPE", "PIXELOUTLIERFILTER", "AGCLOW", "AGCHIGH", "DEVICELOCATION", "FORMATCAP", "FORMATINDEX", "NUMFRAME", "FRAMEINDEX", "FRAMESIZE", "INTERVALTYPE",
@ -27,7 +27,7 @@ cellCameraInternal cellCameraInstance;
int cellCameraInit() int cellCameraInit()
{ {
cellCamera->Warning("cellCameraInit()"); cellCamera.Warning("cellCameraInit()");
if (cellCameraInstance.m_bInitialized) if (cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_ALREADY_INIT; return CELL_CAMERA_ERROR_ALREADY_INIT;
@ -84,7 +84,7 @@ int cellCameraInit()
int cellCameraEnd() int cellCameraEnd()
{ {
cellCamera->Warning("cellCameraEnd()"); cellCamera.Warning("cellCameraEnd()");
if (!cellCameraInstance.m_bInitialized) if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT; return CELL_CAMERA_ERROR_NOT_INIT;
@ -132,7 +132,7 @@ int cellCameraGetDeviceGUID()
int cellCameraGetType(s32 dev_num, vm::ptr<CellCameraType> type) int cellCameraGetType(s32 dev_num, vm::ptr<CellCameraType> type)
{ {
cellCamera->Warning("cellCameraGetType(dev_num=%d, type_addr=0x%x)", dev_num, type.addr()); cellCamera.Warning("cellCameraGetType(dev_num=%d, type_addr=0x%x)", dev_num, type.addr());
if (!cellCameraInstance.m_bInitialized) if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT; return CELL_CAMERA_ERROR_NOT_INIT;
@ -174,7 +174,7 @@ int cellCameraIsStarted()
int cellCameraGetAttribute(s32 dev_num, CellCameraAttribute attrib, vm::ptr<u32> arg1, vm::ptr<u32> arg2) int cellCameraGetAttribute(s32 dev_num, CellCameraAttribute attrib, vm::ptr<u32> arg1, vm::ptr<u32> arg2)
{ {
cellCamera->Warning("cellCameraGetAttribute(dev_num=%d, attrib=%s(%d), arg1=0x%x, arg2=0x%x)", dev_num, attributes[attrib], arg1.addr(), arg2.addr()); cellCamera.Warning("cellCameraGetAttribute(dev_num=%d, attrib=%s(%d), arg1=0x%x, arg2=0x%x)", dev_num, attributes[attrib], arg1.addr(), arg2.addr());
if (!cellCameraInstance.m_bInitialized) if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT; return CELL_CAMERA_ERROR_NOT_INIT;
@ -288,7 +288,7 @@ int cellCameraGetAttribute(s32 dev_num, CellCameraAttribute attrib, vm::ptr<u32>
int cellCameraSetAttribute(s32 dev_num, CellCameraAttribute attrib, u32 arg1, u32 arg2) int cellCameraSetAttribute(s32 dev_num, CellCameraAttribute attrib, u32 arg1, u32 arg2)
{ {
cellCamera->Warning("cellCameraSetAttribute(dev_num=%d, attrib=%s(%d), arg1=%d, arg2=%d)", dev_num, attributes[attrib], attrib, arg1, arg2); cellCamera.Warning("cellCameraSetAttribute(dev_num=%d, attrib=%s(%d), arg1=%d, arg2=%d)", dev_num, attributes[attrib], attrib, arg1, arg2);
if (!cellCameraInstance.m_bInitialized) if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT; return CELL_CAMERA_ERROR_NOT_INIT;
@ -355,7 +355,7 @@ int cellCameraSetAttribute(s32 dev_num, CellCameraAttribute attrib, u32 arg1, u3
else if (attrib == 28) else if (attrib == 28)
cellCameraInstance.m_camera.attributes.DEVICELOCATION = arg1; cellCameraInstance.m_camera.attributes.DEVICELOCATION = arg1;
else if (attrib == 29) else if (attrib == 29)
cellCamera->Error("Tried to write to read-only (?) value: FORMATCAP"); cellCamera.Error("Tried to write to read-only (?) value: FORMATCAP");
else if (attrib == 30) else if (attrib == 30)
cellCameraInstance.m_camera.attributes.FORMATINDEX = arg1; cellCameraInstance.m_camera.attributes.FORMATINDEX = arg1;
else if (attrib == 31) else if (attrib == 31)
@ -387,7 +387,7 @@ int cellCameraSetAttribute(s32 dev_num, CellCameraAttribute attrib, u32 arg1, u3
else if (attrib == 44) else if (attrib == 44)
return CELL_CAMERA_ERROR_PARAM; return CELL_CAMERA_ERROR_PARAM;
else if (attrib == 45) else if (attrib == 45)
cellCamera->Error("Tried to write to read-only (?) value: READMODE"); cellCamera.Error("Tried to write to read-only (?) value: READMODE");
else if (attrib == 46) else if (attrib == 46)
cellCameraInstance.m_camera.attributes.GAMEPID = arg1; cellCameraInstance.m_camera.attributes.GAMEPID = arg1;
else if (attrib == 47) else if (attrib == 47)
@ -395,7 +395,7 @@ int cellCameraSetAttribute(s32 dev_num, CellCameraAttribute attrib, u32 arg1, u3
else if (attrib == 48) else if (attrib == 48)
cellCameraInstance.m_camera.attributes.READFINISH = arg1; cellCameraInstance.m_camera.attributes.READFINISH = arg1;
else if (attrib == 49) else if (attrib == 49)
cellCamera->Error("Tried to write to read-only (?) value: ATTRIBUTE_UNKNOWN"); cellCamera.Error("Tried to write to read-only (?) value: ATTRIBUTE_UNKNOWN");
return CELL_OK; return CELL_OK;
} }
@ -555,42 +555,40 @@ void cellCamera_unload()
cellCameraInstance.m_bInitialized = false; cellCameraInstance.m_bInitialized = false;
} }
void cellCamera_init(Module* pxThis) Module cellCamera("cellCamera", []()
{ {
cellCamera = pxThis; cellCamera.AddFunc(0xbf47c5dd, cellCameraInit);
cellCamera.AddFunc(0x5ad46570, cellCameraEnd);
cellCamera.AddFunc(0x85e1b8da, cellCameraOpen);
cellCamera.AddFunc(0x5d25f866, cellCameraOpenEx);
cellCamera.AddFunc(0x379c5dd6, cellCameraClose);
cellCamera->AddFunc(0xbf47c5dd, cellCameraInit); cellCamera.AddFunc(0x602e2052, cellCameraGetDeviceGUID);
cellCamera->AddFunc(0x5ad46570, cellCameraEnd); cellCamera.AddFunc(0x58bc5870, cellCameraGetType);
cellCamera->AddFunc(0x85e1b8da, cellCameraOpen); cellCamera.AddFunc(0x8ca53dde, cellCameraIsAvailable);
cellCamera->AddFunc(0x5d25f866, cellCameraOpenEx); cellCamera.AddFunc(0x7e063bbc, cellCameraIsAttached);
cellCamera->AddFunc(0x379c5dd6, cellCameraClose); cellCamera.AddFunc(0xfa160f24, cellCameraIsOpen);
cellCamera.AddFunc(0x5eebf24e, cellCameraIsStarted);
cellCamera.AddFunc(0x532b8aaa, cellCameraGetAttribute);
cellCamera.AddFunc(0x8cd56eee, cellCameraSetAttribute);
cellCamera.AddFunc(0x7dac520c, cellCameraGetBufferSize);
cellCamera.AddFunc(0x10697d7f, cellCameraGetBufferInfo);
cellCamera.AddFunc(0x0e63c444, cellCameraGetBufferInfoEx);
cellCamera->AddFunc(0x602e2052, cellCameraGetDeviceGUID); cellCamera.AddFunc(0x61dfbe83, cellCameraPrepExtensionUnit);
cellCamera->AddFunc(0x58bc5870, cellCameraGetType); cellCamera.AddFunc(0xeb6f95fb, cellCameraCtrlExtensionUnit);
cellCamera->AddFunc(0x8ca53dde, cellCameraIsAvailable); cellCamera.AddFunc(0xb602e328, cellCameraGetExtensionUnit);
cellCamera->AddFunc(0x7e063bbc, cellCameraIsAttached); cellCamera.AddFunc(0x2dea3e9b, cellCameraSetExtensionUnit);
cellCamera->AddFunc(0xfa160f24, cellCameraIsOpen);
cellCamera->AddFunc(0x5eebf24e, cellCameraIsStarted);
cellCamera->AddFunc(0x532b8aaa, cellCameraGetAttribute);
cellCamera->AddFunc(0x8cd56eee, cellCameraSetAttribute);
cellCamera->AddFunc(0x7dac520c, cellCameraGetBufferSize);
cellCamera->AddFunc(0x10697d7f, cellCameraGetBufferInfo);
cellCamera->AddFunc(0x0e63c444, cellCameraGetBufferInfoEx);
cellCamera->AddFunc(0x61dfbe83, cellCameraPrepExtensionUnit); cellCamera.AddFunc(0x81f83db9, cellCameraReset);
cellCamera->AddFunc(0xeb6f95fb, cellCameraCtrlExtensionUnit); cellCamera.AddFunc(0x456dc4aa, cellCameraStart);
cellCamera->AddFunc(0xb602e328, cellCameraGetExtensionUnit); cellCamera.AddFunc(0x3845d39b, cellCameraRead);
cellCamera->AddFunc(0x2dea3e9b, cellCameraSetExtensionUnit); cellCamera.AddFunc(0x21fc151f, cellCameraReadEx);
cellCamera.AddFunc(0xe28b206b, cellCameraReadComplete);
cellCamera.AddFunc(0x02f5ced0, cellCameraStop);
cellCamera->AddFunc(0x81f83db9, cellCameraReset); cellCamera.AddFunc(0xb0647e5a, cellCameraSetNotifyEventQueue);
cellCamera->AddFunc(0x456dc4aa, cellCameraStart); cellCamera.AddFunc(0x9b98d258, cellCameraRemoveNotifyEventQueue);
cellCamera->AddFunc(0x3845d39b, cellCameraRead); cellCamera.AddFunc(0xa7fd2f5b, cellCameraSetNotifyEventQueue2);
cellCamera->AddFunc(0x21fc151f, cellCameraReadEx); cellCamera.AddFunc(0x44673f07, cellCameraRemoveNotifyEventQueue2);
cellCamera->AddFunc(0xe28b206b, cellCameraReadComplete); });
cellCamera->AddFunc(0x02f5ced0, cellCameraStop);
cellCamera->AddFunc(0xb0647e5a, cellCameraSetNotifyEventQueue);
cellCamera->AddFunc(0x9b98d258, cellCameraRemoveNotifyEventQueue);
cellCamera->AddFunc(0xa7fd2f5b, cellCameraSetNotifyEventQueue2);
cellCamera->AddFunc(0x44673f07, cellCameraRemoveNotifyEventQueue2);
}

View file

@ -8,9 +8,9 @@
#include "cellPamf.h" #include "cellPamf.h"
#include "cellDmux.h" #include "cellDmux.h"
Module *cellDmux = nullptr; extern Module cellDmux;
#define DMUX_ERROR(...) { cellDmux->Error(__VA_ARGS__); Emu.Pause(); return; } // only for demuxer thread #define DMUX_ERROR(...) { cellDmux.Error(__VA_ARGS__); Emu.Pause(); return; } // only for demuxer thread
PesHeader::PesHeader(DemuxerStream& stream) PesHeader::PesHeader(DemuxerStream& stream)
: pts(CODEC_TS_INVALID) : pts(CODEC_TS_INVALID)
@ -62,7 +62,7 @@ PesHeader::PesHeader(DemuxerStream& stream)
if ((v & 0xf0) != 0x10) if ((v & 0xf0) != 0x10)
{ {
cellDmux->Error("PesHeader(): dts not found (v=0x%x, size=%d, pos=%d)", v, size, pos - 1); cellDmux.Error("PesHeader(): dts not found (v=0x%x, size=%d, pos=%d)", v, size, pos - 1);
stream.skip(size - pos); stream.skip(size - pos);
return; return;
} }
@ -71,7 +71,7 @@ PesHeader::PesHeader(DemuxerStream& stream)
} }
else else
{ {
cellDmux->Warning("PesHeader(): unknown code (v=0x%x, size=%d, pos=%d)", v, size, pos - 1); cellDmux.Warning("PesHeader(): unknown code (v=0x%x, size=%d, pos=%d)", v, size, pos - 1);
stream.skip(size - pos); stream.skip(size - pos);
pos = size; pos = size;
break; break;
@ -210,13 +210,13 @@ bool ElementaryStream::release()
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(m_mutex);
if (released >= put_count) if (released >= put_count)
{ {
cellDmux->Error("es::release() error: buffer is empty"); cellDmux.Error("es::release() error: buffer is empty");
Emu.Pause(); Emu.Pause();
return false; return false;
} }
if (released >= got_count) if (released >= got_count)
{ {
cellDmux->Error("es::release() error: buffer has not been seen yet"); cellDmux.Error("es::release() error: buffer has not been seen yet");
Emu.Pause(); Emu.Pause();
return false; return false;
} }
@ -224,7 +224,7 @@ bool ElementaryStream::release()
u32 addr = 0; u32 addr = 0;
if (!entries.pop(addr, &dmux->is_closed) || !addr) if (!entries.pop(addr, &dmux->is_closed) || !addr)
{ {
cellDmux->Error("es::release() error: entries.Pop() failed"); cellDmux.Error("es::release() error: entries.Pop() failed");
Emu.Pause(); Emu.Pause();
return false; return false;
} }
@ -238,7 +238,7 @@ bool ElementaryStream::peek(u32& out_data, bool no_ex, u32& out_spec, bool updat
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(m_mutex);
if (got_count < released) if (got_count < released)
{ {
cellDmux->Error("es::peek() error: got_count(%d) < released(%d) (put_count=%d)", got_count, released, put_count); cellDmux.Error("es::peek() error: got_count(%d) < released(%d) (put_count=%d)", got_count, released, put_count);
Emu.Pause(); Emu.Pause();
return false; return false;
} }
@ -250,7 +250,7 @@ bool ElementaryStream::peek(u32& out_data, bool no_ex, u32& out_spec, bool updat
u32 addr = 0; u32 addr = 0;
if (!entries.peek(addr, got_count - released, &dmux->is_closed) || !addr) if (!entries.peek(addr, got_count - released, &dmux->is_closed) || !addr)
{ {
cellDmux->Error("es::peek() error: entries.Peek() failed"); cellDmux.Error("es::peek() error: entries.Peek() failed");
Emu.Pause(); Emu.Pause();
return false; return false;
} }
@ -292,7 +292,7 @@ void dmuxQueryEsAttr(u32 info_addr /* may be 0 */, vm::ptr<const CellCodecEsFilt
else else
attr->memSize = 0x7000; // 0x73d9 from ps3 attr->memSize = 0x7000; // 0x73d9 from ps3
cellDmux->Warning("*** filter(0x%x, 0x%x, 0x%x, 0x%x)", (u32)esFilterId->filterIdMajor, (u32)esFilterId->filterIdMinor, cellDmux.Warning("*** filter(0x%x, 0x%x, 0x%x, 0x%x)", (u32)esFilterId->filterIdMajor, (u32)esFilterId->filterIdMinor,
(u32)esFilterId->supplementalInfo1, (u32)esFilterId->supplementalInfo2); (u32)esFilterId->supplementalInfo1, (u32)esFilterId->supplementalInfo2);
} }
@ -301,7 +301,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr)
std::shared_ptr<Demuxer> sptr(dmux_ptr); std::shared_ptr<Demuxer> sptr(dmux_ptr);
Demuxer& dmux = *dmux_ptr; Demuxer& dmux = *dmux_ptr;
u32 dmux_id = cellDmux->GetNewId(sptr); u32 dmux_id = cellDmux.GetNewId(sptr);
dmux.id = dmux_id; dmux.id = dmux_id;
@ -403,7 +403,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr)
stream.skip(4); stream.skip(4);
stream.get(len); stream.get(len);
cellDmux->Notice("PRIVATE_STREAM_2 (%d)", len); cellDmux.Notice("PRIVATE_STREAM_2 (%d)", len);
if (!stream.check(len)) if (!stream.check(len))
{ {
@ -494,7 +494,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr)
es.push_au(frame_size + 8, es.last_dts, es.last_pts, stream.userdata, false /* TODO: set correct value */, 0); es.push_au(frame_size + 8, es.last_dts, es.last_pts, stream.userdata, false /* TODO: set correct value */, 0);
//cellDmux->Notice("ATX AU pushed (ats=0x%llx, frame_size=%d)", *(be_t<u64>*)data, frame_size); //cellDmux.Notice("ATX AU pushed (ats=0x%llx, frame_size=%d)", *(be_t<u64>*)data, frame_size);
auto esMsg = vm::ptr<CellDmuxEsMsg>::make(dmux.memAddr + (cb_add ^= 16)); auto esMsg = vm::ptr<CellDmuxEsMsg>::make(dmux.memAddr + (cb_add ^= 16));
esMsg->msgType = CELL_DMUX_ES_MSG_TYPE_AU_FOUND; esMsg->msgType = CELL_DMUX_ES_MSG_TYPE_AU_FOUND;
@ -504,7 +504,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr)
} }
else else
{ {
cellDmux->Notice("PRIVATE_STREAM_1 (len=%d, fid_minor=0x%x)", len, fid_minor); cellDmux.Notice("PRIVATE_STREAM_1 (len=%d, fid_minor=0x%x)", len, fid_minor);
stream.skip(len); stream.skip(len);
} }
break; break;
@ -581,7 +581,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr)
} }
else else
{ {
cellDmux->Notice("Video stream (code=0x%x, len=%d)", code, len); cellDmux.Notice("Video stream (code=0x%x, len=%d)", code, len);
stream.skip(len); stream.skip(len);
} }
break; break;
@ -614,7 +614,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr)
{ {
if (task.stream.discontinuity) if (task.stream.discontinuity)
{ {
cellDmux->Warning("dmuxSetStream (beginning)"); cellDmux.Warning("dmuxSetStream (beginning)");
for (u32 i = 0; i < sizeof(esALL) / sizeof(esALL[0]); i++) for (u32 i = 0; i < sizeof(esALL) / sizeof(esALL[0]); i++)
{ {
if (esALL[i]) if (esALL[i])
@ -729,7 +729,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr)
if (es.raw_data.size()) if (es.raw_data.size())
{ {
cellDmux->Error("dmuxFlushEs: 0x%x bytes lost (es_id=%d)", (u32)es.raw_data.size(), es.id); cellDmux.Error("dmuxFlushEs: 0x%x bytes lost (es_id=%d)", (u32)es.raw_data.size(), es.id);
} }
// callback // callback
@ -766,7 +766,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr)
int cellDmuxQueryAttr(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<CellDmuxAttr> demuxerAttr) int cellDmuxQueryAttr(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<CellDmuxAttr> demuxerAttr)
{ {
cellDmux->Warning("cellDmuxQueryAttr(demuxerType_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType.addr(), demuxerAttr.addr()); cellDmux.Warning("cellDmuxQueryAttr(demuxerType_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType.addr(), demuxerAttr.addr());
if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
{ {
@ -779,7 +779,7 @@ int cellDmuxQueryAttr(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<CellDmuxA
int cellDmuxQueryAttr2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<CellDmuxAttr> demuxerAttr) int cellDmuxQueryAttr2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<CellDmuxAttr> demuxerAttr)
{ {
cellDmux->Warning("cellDmuxQueryAttr2(demuxerType2_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType2.addr(), demuxerAttr.addr()); cellDmux.Warning("cellDmuxQueryAttr2(demuxerType2_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType2.addr(), demuxerAttr.addr());
if (demuxerType2->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (demuxerType2->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
{ {
@ -793,7 +793,7 @@ int cellDmuxQueryAttr2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<CellDm
int cellDmuxOpen(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmuxResource> demuxerResource, int cellDmuxOpen(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmuxResource> demuxerResource,
vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<u32> demuxerHandle) vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<u32> demuxerHandle)
{ {
cellDmux->Warning("cellDmuxOpen(demuxerType_addr=0x%x, demuxerResource_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", cellDmux.Warning("cellDmuxOpen(demuxerType_addr=0x%x, demuxerResource_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)",
demuxerType.addr(), demuxerResource.addr(), demuxerCb.addr(), demuxerHandle.addr()); demuxerType.addr(), demuxerResource.addr(), demuxerCb.addr(), demuxerHandle.addr());
if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
@ -811,7 +811,7 @@ int cellDmuxOpen(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmux
int cellDmuxOpenEx(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmuxResourceEx> demuxerResourceEx, int cellDmuxOpenEx(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmuxResourceEx> demuxerResourceEx,
vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<u32> demuxerHandle) vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<u32> demuxerHandle)
{ {
cellDmux->Warning("cellDmuxOpenEx(demuxerType_addr=0x%x, demuxerResourceEx_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", cellDmux.Warning("cellDmuxOpenEx(demuxerType_addr=0x%x, demuxerResourceEx_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)",
demuxerType.addr(), demuxerResourceEx.addr(), demuxerCb.addr(), demuxerHandle.addr()); demuxerType.addr(), demuxerResourceEx.addr(), demuxerCb.addr(), demuxerHandle.addr());
if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
@ -829,7 +829,7 @@ int cellDmuxOpenEx(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDm
int cellDmuxOpen2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<const CellDmuxResource2> demuxerResource2, int cellDmuxOpen2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<const CellDmuxResource2> demuxerResource2,
vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<u32> demuxerHandle) vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<u32> demuxerHandle)
{ {
cellDmux->Warning("cellDmuxOpen2(demuxerType2_addr=0x%x, demuxerResource2_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", cellDmux.Warning("cellDmuxOpen2(demuxerType2_addr=0x%x, demuxerResource2_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)",
demuxerType2.addr(), demuxerResource2.addr(), demuxerCb.addr(), demuxerHandle.addr()); demuxerType2.addr(), demuxerResource2.addr(), demuxerCb.addr(), demuxerHandle.addr());
if (demuxerType2->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (demuxerType2->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
@ -846,7 +846,7 @@ int cellDmuxOpen2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<const CellD
int cellDmuxClose(u32 demuxerHandle) int cellDmuxClose(u32 demuxerHandle)
{ {
cellDmux->Warning("cellDmuxClose(demuxerHandle=%d)", demuxerHandle); cellDmux.Warning("cellDmuxClose(demuxerHandle=%d)", demuxerHandle);
std::shared_ptr<Demuxer> dmux; std::shared_ptr<Demuxer> dmux;
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux)) if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
@ -861,7 +861,7 @@ int cellDmuxClose(u32 demuxerHandle)
{ {
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
cellDmux->Warning("cellDmuxClose(%d) aborted", demuxerHandle); cellDmux.Warning("cellDmuxClose(%d) aborted", demuxerHandle);
return CELL_OK; return CELL_OK;
} }
@ -875,7 +875,7 @@ int cellDmuxClose(u32 demuxerHandle)
int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize, bool discontinuity, u64 userData) int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize, bool discontinuity, u64 userData)
{ {
cellDmux->Log("cellDmuxSetStream(demuxerHandle=%d, streamAddress=0x%x, streamSize=%d, discontinuity=%d, userData=0x%llx", cellDmux.Log("cellDmuxSetStream(demuxerHandle=%d, streamAddress=0x%x, streamSize=%d, discontinuity=%d, userData=0x%llx",
demuxerHandle, streamAddress, streamSize, discontinuity, userData); demuxerHandle, streamAddress, streamSize, discontinuity, userData);
std::shared_ptr<Demuxer> dmux; std::shared_ptr<Demuxer> dmux;
@ -903,7 +903,7 @@ int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize
int cellDmuxResetStream(u32 demuxerHandle) int cellDmuxResetStream(u32 demuxerHandle)
{ {
cellDmux->Warning("cellDmuxResetStream(demuxerHandle=%d)", demuxerHandle); cellDmux.Warning("cellDmuxResetStream(demuxerHandle=%d)", demuxerHandle);
std::shared_ptr<Demuxer> dmux; std::shared_ptr<Demuxer> dmux;
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux)) if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
@ -917,7 +917,7 @@ int cellDmuxResetStream(u32 demuxerHandle)
int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle) int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
{ {
cellDmux->Warning("cellDmuxResetStreamAndWaitDone(demuxerHandle=%d)", demuxerHandle); cellDmux.Warning("cellDmuxResetStreamAndWaitDone(demuxerHandle=%d)", demuxerHandle);
std::shared_ptr<Demuxer> dmux; std::shared_ptr<Demuxer> dmux;
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux)) if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
@ -930,7 +930,7 @@ int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
{ {
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
cellDmux->Warning("cellDmuxResetStreamAndWaitDone(%d) aborted", demuxerHandle); cellDmux.Warning("cellDmuxResetStreamAndWaitDone(%d) aborted", demuxerHandle);
return CELL_OK; return CELL_OK;
} }
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
@ -941,7 +941,7 @@ int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
int cellDmuxQueryEsAttr(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellCodecEsFilterId> esFilterId, int cellDmuxQueryEsAttr(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellCodecEsFilterId> esFilterId,
const u32 esSpecificInfo_addr, vm::ptr<CellDmuxEsAttr> esAttr) const u32 esSpecificInfo_addr, vm::ptr<CellDmuxEsAttr> esAttr)
{ {
cellDmux->Warning("cellDmuxQueryEsAttr(demuxerType_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)", cellDmux.Warning("cellDmuxQueryEsAttr(demuxerType_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)",
demuxerType.addr(), esFilterId.addr(), esSpecificInfo_addr, esAttr.addr()); demuxerType.addr(), esFilterId.addr(), esSpecificInfo_addr, esAttr.addr());
if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
@ -957,7 +957,7 @@ int cellDmuxQueryEsAttr(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const C
int cellDmuxQueryEsAttr2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<const CellCodecEsFilterId> esFilterId, int cellDmuxQueryEsAttr2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<const CellCodecEsFilterId> esFilterId,
const u32 esSpecificInfo_addr, vm::ptr<CellDmuxEsAttr> esAttr) const u32 esSpecificInfo_addr, vm::ptr<CellDmuxEsAttr> esAttr)
{ {
cellDmux->Warning("cellDmuxQueryEsAttr2(demuxerType2_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)", cellDmux.Warning("cellDmuxQueryEsAttr2(demuxerType2_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)",
demuxerType2.addr(), esFilterId.addr(), esSpecificInfo_addr, esAttr.addr()); demuxerType2.addr(), esFilterId.addr(), esSpecificInfo_addr, esAttr.addr());
if (demuxerType2->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (demuxerType2->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
@ -974,7 +974,7 @@ int cellDmuxEnableEs(u32 demuxerHandle, vm::ptr<const CellCodecEsFilterId> esFil
vm::ptr<const CellDmuxEsResource> esResourceInfo, vm::ptr<const CellDmuxEsCb> esCb, vm::ptr<const CellDmuxEsResource> esResourceInfo, vm::ptr<const CellDmuxEsCb> esCb,
const u32 esSpecificInfo_addr, vm::ptr<u32> esHandle) const u32 esSpecificInfo_addr, vm::ptr<u32> esHandle)
{ {
cellDmux->Warning("cellDmuxEnableEs(demuxerHandle=%d, esFilterId_addr=0x%x, esResourceInfo_addr=0x%x, esCb_addr=0x%x, " cellDmux.Warning("cellDmuxEnableEs(demuxerHandle=%d, esFilterId_addr=0x%x, esResourceInfo_addr=0x%x, esCb_addr=0x%x, "
"esSpecificInfo_addr=0x%x, esHandle_addr=0x%x)", demuxerHandle, esFilterId.addr(), esResourceInfo.addr(), "esSpecificInfo_addr=0x%x, esHandle_addr=0x%x)", demuxerHandle, esFilterId.addr(), esResourceInfo.addr(),
esCb.addr(), esSpecificInfo_addr, esHandle.addr()); esCb.addr(), esSpecificInfo_addr, esHandle.addr());
@ -990,11 +990,11 @@ int cellDmuxEnableEs(u32 demuxerHandle, vm::ptr<const CellCodecEsFilterId> esFil
esFilterId->filterIdMajor, esFilterId->filterIdMinor, esFilterId->supplementalInfo1, esFilterId->supplementalInfo2, esFilterId->filterIdMajor, esFilterId->filterIdMinor, esFilterId->supplementalInfo1, esFilterId->supplementalInfo2,
esCb->cbEsMsgFunc.to_le(), esCb->cbArg, esSpecificInfo_addr)); esCb->cbEsMsgFunc.to_le(), esCb->cbArg, esSpecificInfo_addr));
u32 id = cellDmux->GetNewId(es); u32 id = cellDmux.GetNewId(es);
es->id = id; es->id = id;
*esHandle = id; *esHandle = id;
cellDmux->Warning("*** New ES(dmux=%d, addr=0x%x, size=0x%x, filter(0x%x, 0x%x, 0x%x, 0x%x), cb=0x%x(arg=0x%x), spec=0x%x): id = %d", cellDmux.Warning("*** New ES(dmux=%d, addr=0x%x, size=0x%x, filter(0x%x, 0x%x, 0x%x, 0x%x), cb=0x%x(arg=0x%x), spec=0x%x): id = %d",
demuxerHandle, es->memAddr, es->memSize, es->fidMajor, es->fidMinor, es->sup1, es->sup2, es->cbFunc, es->cbArg, es->spec, id); demuxerHandle, es->memAddr, es->memSize, es->fidMajor, es->fidMinor, es->sup1, es->sup2, es->cbFunc, es->cbArg, es->spec, id);
DemuxerTask task(dmuxEnableEs); DemuxerTask task(dmuxEnableEs);
@ -1007,7 +1007,7 @@ int cellDmuxEnableEs(u32 demuxerHandle, vm::ptr<const CellCodecEsFilterId> esFil
int cellDmuxDisableEs(u32 esHandle) int cellDmuxDisableEs(u32 esHandle)
{ {
cellDmux->Warning("cellDmuxDisableEs(esHandle=0x%x)", esHandle); cellDmux.Warning("cellDmuxDisableEs(esHandle=0x%x)", esHandle);
std::shared_ptr<ElementaryStream> es; std::shared_ptr<ElementaryStream> es;
if (!Emu.GetIdManager().GetIDData(esHandle, es)) if (!Emu.GetIdManager().GetIDData(esHandle, es))
@ -1025,7 +1025,7 @@ int cellDmuxDisableEs(u32 esHandle)
int cellDmuxResetEs(u32 esHandle) int cellDmuxResetEs(u32 esHandle)
{ {
cellDmux->Log("cellDmuxResetEs(esHandle=0x%x)", esHandle); cellDmux.Log("cellDmuxResetEs(esHandle=0x%x)", esHandle);
std::shared_ptr<ElementaryStream> es; std::shared_ptr<ElementaryStream> es;
if (!Emu.GetIdManager().GetIDData(esHandle, es)) if (!Emu.GetIdManager().GetIDData(esHandle, es))
@ -1043,7 +1043,7 @@ int cellDmuxResetEs(u32 esHandle)
int cellDmuxGetAu(u32 esHandle, vm::ptr<u32> auInfo_ptr, vm::ptr<u32> auSpecificInfo_ptr) int cellDmuxGetAu(u32 esHandle, vm::ptr<u32> auInfo_ptr, vm::ptr<u32> auSpecificInfo_ptr)
{ {
cellDmux->Log("cellDmuxGetAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", cellDmux.Log("cellDmuxGetAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)",
esHandle, auInfo_ptr.addr(), auSpecificInfo_ptr.addr()); esHandle, auInfo_ptr.addr(), auSpecificInfo_ptr.addr());
std::shared_ptr<ElementaryStream> es; std::shared_ptr<ElementaryStream> es;
@ -1066,7 +1066,7 @@ int cellDmuxGetAu(u32 esHandle, vm::ptr<u32> auInfo_ptr, vm::ptr<u32> auSpecific
int cellDmuxPeekAu(u32 esHandle, vm::ptr<u32> auInfo_ptr, vm::ptr<u32> auSpecificInfo_ptr) int cellDmuxPeekAu(u32 esHandle, vm::ptr<u32> auInfo_ptr, vm::ptr<u32> auSpecificInfo_ptr)
{ {
cellDmux->Log("cellDmuxPeekAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", cellDmux.Log("cellDmuxPeekAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)",
esHandle, auInfo_ptr.addr(), auSpecificInfo_ptr.addr()); esHandle, auInfo_ptr.addr(), auSpecificInfo_ptr.addr());
std::shared_ptr<ElementaryStream> es; std::shared_ptr<ElementaryStream> es;
@ -1089,7 +1089,7 @@ int cellDmuxPeekAu(u32 esHandle, vm::ptr<u32> auInfo_ptr, vm::ptr<u32> auSpecifi
int cellDmuxGetAuEx(u32 esHandle, vm::ptr<u32> auInfoEx_ptr, vm::ptr<u32> auSpecificInfo_ptr) int cellDmuxGetAuEx(u32 esHandle, vm::ptr<u32> auInfoEx_ptr, vm::ptr<u32> auSpecificInfo_ptr)
{ {
cellDmux->Log("cellDmuxGetAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", cellDmux.Log("cellDmuxGetAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)",
esHandle, auInfoEx_ptr.addr(), auSpecificInfo_ptr.addr()); esHandle, auInfoEx_ptr.addr(), auSpecificInfo_ptr.addr());
std::shared_ptr<ElementaryStream> es; std::shared_ptr<ElementaryStream> es;
@ -1112,7 +1112,7 @@ int cellDmuxGetAuEx(u32 esHandle, vm::ptr<u32> auInfoEx_ptr, vm::ptr<u32> auSpec
int cellDmuxPeekAuEx(u32 esHandle, vm::ptr<u32> auInfoEx_ptr, vm::ptr<u32> auSpecificInfo_ptr) int cellDmuxPeekAuEx(u32 esHandle, vm::ptr<u32> auInfoEx_ptr, vm::ptr<u32> auSpecificInfo_ptr)
{ {
cellDmux->Log("cellDmuxPeekAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", cellDmux.Log("cellDmuxPeekAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)",
esHandle, auInfoEx_ptr.addr(), auSpecificInfo_ptr.addr()); esHandle, auInfoEx_ptr.addr(), auSpecificInfo_ptr.addr());
std::shared_ptr<ElementaryStream> es; std::shared_ptr<ElementaryStream> es;
@ -1135,7 +1135,7 @@ int cellDmuxPeekAuEx(u32 esHandle, vm::ptr<u32> auInfoEx_ptr, vm::ptr<u32> auSpe
int cellDmuxReleaseAu(u32 esHandle) int cellDmuxReleaseAu(u32 esHandle)
{ {
cellDmux->Log("cellDmuxReleaseAu(esHandle=0x%x)", esHandle); cellDmux.Log("cellDmuxReleaseAu(esHandle=0x%x)", esHandle);
std::shared_ptr<ElementaryStream> es; std::shared_ptr<ElementaryStream> es;
if (!Emu.GetIdManager().GetIDData(esHandle, es)) if (!Emu.GetIdManager().GetIDData(esHandle, es))
@ -1152,7 +1152,7 @@ int cellDmuxReleaseAu(u32 esHandle)
int cellDmuxFlushEs(u32 esHandle) int cellDmuxFlushEs(u32 esHandle)
{ {
cellDmux->Warning("cellDmuxFlushEs(esHandle=0x%x)", esHandle); cellDmux.Warning("cellDmuxFlushEs(esHandle=0x%x)", esHandle);
std::shared_ptr<ElementaryStream> es; std::shared_ptr<ElementaryStream> es;
if (!Emu.GetIdManager().GetIDData(esHandle, es)) if (!Emu.GetIdManager().GetIDData(esHandle, es))
@ -1168,28 +1168,26 @@ int cellDmuxFlushEs(u32 esHandle)
return CELL_OK; return CELL_OK;
} }
void cellDmux_init(Module *pxThis) Module cellDmux("cellDmux", []()
{ {
cellDmux = pxThis; cellDmux.AddFunc(0xa2d4189b, cellDmuxQueryAttr);
cellDmux.AddFunc(0x3f76e3cd, cellDmuxQueryAttr2);
cellDmux->AddFunc(0xa2d4189b, cellDmuxQueryAttr); cellDmux.AddFunc(0x68492de9, cellDmuxOpen);
cellDmux->AddFunc(0x3f76e3cd, cellDmuxQueryAttr2); cellDmux.AddFunc(0xf6c23560, cellDmuxOpenEx);
cellDmux->AddFunc(0x68492de9, cellDmuxOpen); cellDmux.AddFunc(0x11bc3a6c, cellDmuxOpen2);
cellDmux->AddFunc(0xf6c23560, cellDmuxOpenEx); cellDmux.AddFunc(0x8c692521, cellDmuxClose);
cellDmux->AddFunc(0x11bc3a6c, cellDmuxOpen2); cellDmux.AddFunc(0x04e7499f, cellDmuxSetStream);
cellDmux->AddFunc(0x8c692521, cellDmuxClose); cellDmux.AddFunc(0x5d345de9, cellDmuxResetStream);
cellDmux->AddFunc(0x04e7499f, cellDmuxSetStream); cellDmux.AddFunc(0xccff1284, cellDmuxResetStreamAndWaitDone);
cellDmux->AddFunc(0x5d345de9, cellDmuxResetStream); cellDmux.AddFunc(0x02170d1a, cellDmuxQueryEsAttr);
cellDmux->AddFunc(0xccff1284, cellDmuxResetStreamAndWaitDone); cellDmux.AddFunc(0x52911bcf, cellDmuxQueryEsAttr2);
cellDmux->AddFunc(0x02170d1a, cellDmuxQueryEsAttr); cellDmux.AddFunc(0x7b56dc3f, cellDmuxEnableEs);
cellDmux->AddFunc(0x52911bcf, cellDmuxQueryEsAttr2); cellDmux.AddFunc(0x05371c8d, cellDmuxDisableEs);
cellDmux->AddFunc(0x7b56dc3f, cellDmuxEnableEs); cellDmux.AddFunc(0x21d424f0, cellDmuxResetEs);
cellDmux->AddFunc(0x05371c8d, cellDmuxDisableEs); cellDmux.AddFunc(0x42c716b5, cellDmuxGetAu);
cellDmux->AddFunc(0x21d424f0, cellDmuxResetEs); cellDmux.AddFunc(0x2750c5e0, cellDmuxPeekAu);
cellDmux->AddFunc(0x42c716b5, cellDmuxGetAu); cellDmux.AddFunc(0x2c9a5857, cellDmuxGetAuEx);
cellDmux->AddFunc(0x2750c5e0, cellDmuxPeekAu); cellDmux.AddFunc(0x002e8da2, cellDmuxPeekAuEx);
cellDmux->AddFunc(0x2c9a5857, cellDmuxGetAuEx); cellDmux.AddFunc(0x24ea6474, cellDmuxReleaseAu);
cellDmux->AddFunc(0x002e8da2, cellDmuxPeekAuEx); cellDmux.AddFunc(0xebb3b2bd, cellDmuxFlushEs);
cellDmux->AddFunc(0x24ea6474, cellDmuxReleaseAu); });
cellDmux->AddFunc(0xebb3b2bd, cellDmuxFlushEs);
}

View file

@ -5,7 +5,7 @@
#include "cellFiber.h" #include "cellFiber.h"
Module* cellFiber = nullptr; extern Module cellFiber;
int _cellFiberPpuInitialize() int _cellFiberPpuInitialize()
{ {
@ -81,7 +81,7 @@ int cellFiberPpuJoinFiber()
vm::ptr<void> cellFiberPpuSelf() vm::ptr<void> cellFiberPpuSelf()
{ {
cellFiber->Log("cellFiberPpuSelf() -> nullptr"); // TODO cellFiber.Log("cellFiberPpuSelf() -> nullptr"); // TODO
// returns fiber structure (zero for simple PPU thread) // returns fiber structure (zero for simple PPU thread)
return vm::ptr<void>::make(0); return vm::ptr<void>::make(0);
@ -291,61 +291,59 @@ int cellFiberPpuUtilWorkerControlInitializeWithAttribute()
return CELL_OK; return CELL_OK;
} }
void cellFiber_init(Module *pxThis) Module cellFiber("cellFiber", []()
{ {
cellFiber = pxThis; cellFiber.AddFunc(0x55870804, _cellFiberPpuInitialize);
cellFiber->AddFunc(0x55870804, _cellFiberPpuInitialize); cellFiber.AddFunc(0x9e25c72d, _cellFiberPpuSchedulerAttributeInitialize);
cellFiber.AddFunc(0xee3b604d, cellFiberPpuInitializeScheduler);
cellFiber.AddFunc(0x8b6baa01, cellFiberPpuFinalizeScheduler);
cellFiber.AddFunc(0x12b1acf0, cellFiberPpuRunFibers);
cellFiber.AddFunc(0xf6c6900c, cellFiberPpuCheckFlags);
cellFiber.AddFunc(0xe492a675, cellFiberPpuHasRunnableFiber);
cellFiber->AddFunc(0x9e25c72d, _cellFiberPpuSchedulerAttributeInitialize); cellFiber.AddFunc(0xc11f8056, _cellFiberPpuAttributeInitialize);
cellFiber->AddFunc(0xee3b604d, cellFiberPpuInitializeScheduler); cellFiber.AddFunc(0x7c2f4034, cellFiberPpuCreateFiber);
cellFiber->AddFunc(0x8b6baa01, cellFiberPpuFinalizeScheduler); cellFiber.AddFunc(0xfa8d5f95, cellFiberPpuExit);
cellFiber->AddFunc(0x12b1acf0, cellFiberPpuRunFibers); cellFiber.AddFunc(0x0c44f441, cellFiberPpuYield);
cellFiber->AddFunc(0xf6c6900c, cellFiberPpuCheckFlags); cellFiber.AddFunc(0xa6004249, cellFiberPpuJoinFiber);
cellFiber->AddFunc(0xe492a675, cellFiberPpuHasRunnableFiber); cellFiber.AddFunc(0x5d9a7034, cellFiberPpuSelf);
cellFiber.AddFunc(0x8afb8356, cellFiberPpuSendSignal);
cellFiber.AddFunc(0x6c164b3b, cellFiberPpuWaitSignal);
cellFiber.AddFunc(0xa4599cf3, cellFiberPpuWaitFlag);
cellFiber.AddFunc(0xb0594b2d, cellFiberPpuGetScheduler);
cellFiber.AddFunc(0xfbf5fe40, cellFiberPpuSetPriority);
cellFiber.AddFunc(0xf3e81219, cellFiberPpuCheckStackLimit);
cellFiber->AddFunc(0xc11f8056, _cellFiberPpuAttributeInitialize); cellFiber.AddFunc(0x31252ec3, _cellFiberPpuContextAttributeInitialize);
cellFiber->AddFunc(0x7c2f4034, cellFiberPpuCreateFiber); cellFiber.AddFunc(0x72086315, cellFiberPpuContextInitialize);
cellFiber->AddFunc(0xfa8d5f95, cellFiberPpuExit); cellFiber.AddFunc(0xb3a48079, cellFiberPpuContextFinalize);
cellFiber->AddFunc(0x0c44f441, cellFiberPpuYield); cellFiber.AddFunc(0xaba1c563, cellFiberPpuContextRun);
cellFiber->AddFunc(0xa6004249, cellFiberPpuJoinFiber); cellFiber.AddFunc(0xd0066b17, cellFiberPpuContextSwitch);
cellFiber->AddFunc(0x5d9a7034, cellFiberPpuSelf); cellFiber.AddFunc(0x34a81091, cellFiberPpuContextSelf);
cellFiber->AddFunc(0x8afb8356, cellFiberPpuSendSignal); cellFiber.AddFunc(0x01036193, cellFiberPpuContextReturnToThread);
cellFiber->AddFunc(0x6c164b3b, cellFiberPpuWaitSignal); cellFiber.AddFunc(0xb90c871b, cellFiberPpuContextCheckStackLimit);
cellFiber->AddFunc(0xa4599cf3, cellFiberPpuWaitFlag);
cellFiber->AddFunc(0xb0594b2d, cellFiberPpuGetScheduler);
cellFiber->AddFunc(0xfbf5fe40, cellFiberPpuSetPriority);
cellFiber->AddFunc(0xf3e81219, cellFiberPpuCheckStackLimit);
cellFiber->AddFunc(0x31252ec3, _cellFiberPpuContextAttributeInitialize); cellFiber.AddFunc(0x081c98be, cellFiberPpuContextRunScheduler);
cellFiber->AddFunc(0x72086315, cellFiberPpuContextInitialize); cellFiber.AddFunc(0x0a25b6c8, cellFiberPpuContextEnterScheduler);
cellFiber->AddFunc(0xb3a48079, cellFiberPpuContextFinalize);
cellFiber->AddFunc(0xaba1c563, cellFiberPpuContextRun);
cellFiber->AddFunc(0xd0066b17, cellFiberPpuContextSwitch);
cellFiber->AddFunc(0x34a81091, cellFiberPpuContextSelf);
cellFiber->AddFunc(0x01036193, cellFiberPpuContextReturnToThread);
cellFiber->AddFunc(0xb90c871b, cellFiberPpuContextCheckStackLimit);
cellFiber->AddFunc(0x081c98be, cellFiberPpuContextRunScheduler); cellFiber.AddFunc(0xbf9cd933, cellFiberPpuSchedulerTraceInitialize);
cellFiber->AddFunc(0x0a25b6c8, cellFiberPpuContextEnterScheduler); cellFiber.AddFunc(0x3860a12a, cellFiberPpuSchedulerTraceFinalize);
cellFiber.AddFunc(0xadedbebf, cellFiberPpuSchedulerTraceStart);
cellFiber.AddFunc(0xe665f9a9, cellFiberPpuSchedulerTraceStop);
cellFiber->AddFunc(0xbf9cd933, cellFiberPpuSchedulerTraceInitialize); cellFiber.AddFunc(0x68ba4568, _cellFiberPpuUtilWorkerControlAttributeInitialize);
cellFiber->AddFunc(0x3860a12a, cellFiberPpuSchedulerTraceFinalize); cellFiber.AddFunc(0x1e7a247a, cellFiberPpuUtilWorkerControlRunFibers);
cellFiber->AddFunc(0xadedbebf, cellFiberPpuSchedulerTraceStart); cellFiber.AddFunc(0x3204b146, cellFiberPpuUtilWorkerControlInitialize);
cellFiber->AddFunc(0xe665f9a9, cellFiberPpuSchedulerTraceStop); cellFiber.AddFunc(0x392c5aa5, cellFiberPpuUtilWorkerControlSetPollingMode);
cellFiber.AddFunc(0x3b417f82, cellFiberPpuUtilWorkerControlJoinFiber);
cellFiber->AddFunc(0x68ba4568, _cellFiberPpuUtilWorkerControlAttributeInitialize); cellFiber.AddFunc(0x4fc86b2c, cellFiberPpuUtilWorkerControlDisconnectEventQueue);
cellFiber->AddFunc(0x1e7a247a, cellFiberPpuUtilWorkerControlRunFibers); cellFiber.AddFunc(0x5d3992dd, cellFiberPpuUtilWorkerControlSendSignal);
cellFiber->AddFunc(0x3204b146, cellFiberPpuUtilWorkerControlInitialize); cellFiber.AddFunc(0x62a20f0d, cellFiberPpuUtilWorkerControlConnectEventQueueToSpurs);
cellFiber->AddFunc(0x392c5aa5, cellFiberPpuUtilWorkerControlSetPollingMode); cellFiber.AddFunc(0xa27c95ca, cellFiberPpuUtilWorkerControlFinalize);
cellFiber->AddFunc(0x3b417f82, cellFiberPpuUtilWorkerControlJoinFiber); cellFiber.AddFunc(0xbabf714b, cellFiberPpuUtilWorkerControlWakeup);
cellFiber->AddFunc(0x4fc86b2c, cellFiberPpuUtilWorkerControlDisconnectEventQueue); cellFiber.AddFunc(0xbfca88d3, cellFiberPpuUtilWorkerControlCreateFiber);
cellFiber->AddFunc(0x5d3992dd, cellFiberPpuUtilWorkerControlSendSignal); cellFiber.AddFunc(0xc04e2438, cellFiberPpuUtilWorkerControlShutdown);
cellFiber->AddFunc(0x62a20f0d, cellFiberPpuUtilWorkerControlConnectEventQueueToSpurs); cellFiber.AddFunc(0xea6dc1ad, cellFiberPpuUtilWorkerControlCheckFlags);
cellFiber->AddFunc(0xa27c95ca, cellFiberPpuUtilWorkerControlFinalize); cellFiber.AddFunc(0xf2ccad4f, cellFiberPpuUtilWorkerControlInitializeWithAttribute);
cellFiber->AddFunc(0xbabf714b, cellFiberPpuUtilWorkerControlWakeup); });
cellFiber->AddFunc(0xbfca88d3, cellFiberPpuUtilWorkerControlCreateFiber);
cellFiber->AddFunc(0xc04e2438, cellFiberPpuUtilWorkerControlShutdown);
cellFiber->AddFunc(0xea6dc1ad, cellFiberPpuUtilWorkerControlCheckFlags);
cellFiber->AddFunc(0xf2ccad4f, cellFiberPpuUtilWorkerControlInitializeWithAttribute);
}

View file

@ -6,21 +6,21 @@
#include "Emu/FS/vfsFile.h" #include "Emu/FS/vfsFile.h"
#include "cellFont.h" #include "cellFont.h"
Module *cellFont = nullptr; extern Module cellFont;
CCellFontInternal* s_fontInternalInstance = nullptr; CCellFontInternal* s_fontInternalInstance = nullptr;
// Functions // Functions
int cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr<CellFontConfig> config) int cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr<CellFontConfig> config)
{ {
cellFont->Warning("cellFontInitializeWithRevision(revisionFlags=0x%llx, config=0x%x)", revisionFlags, config.addr()); cellFont.Warning("cellFontInitializeWithRevision(revisionFlags=0x%llx, config=0x%x)", revisionFlags, config.addr());
if (s_fontInternalInstance->m_bInitialized) if (s_fontInternalInstance->m_bInitialized)
return CELL_FONT_ERROR_ALREADY_INITIALIZED; return CELL_FONT_ERROR_ALREADY_INITIALIZED;
if (config->FileCache.size < 24) if (config->FileCache.size < 24)
return CELL_FONT_ERROR_INVALID_PARAMETER; return CELL_FONT_ERROR_INVALID_PARAMETER;
if (config->flags != 0) if (config->flags != 0)
cellFont->Warning("cellFontInitializeWithRevision: Unknown flags (0x%x)", config->flags); cellFont.Warning("cellFontInitializeWithRevision: Unknown flags (0x%x)", config->flags);
s_fontInternalInstance->m_buffer_addr = config->FileCache.buffer_addr; s_fontInternalInstance->m_buffer_addr = config->FileCache.buffer_addr;
s_fontInternalInstance->m_buffer_size = config->FileCache.size; s_fontInternalInstance->m_buffer_size = config->FileCache.size;
@ -38,7 +38,7 @@ int cellFontGetRevisionFlags(vm::ptr<be_t<u64>> revisionFlags)
int cellFontInit(PPUThread& CPU, vm::ptr<CellFontConfig> config) int cellFontInit(PPUThread& CPU, vm::ptr<CellFontConfig> config)
{ {
cellFont->Log("cellFontInit(config=0x%x)", config.addr()); cellFont.Log("cellFontInit(config=0x%x)", config.addr());
vm::stackvar<be_t<u64>> revisionFlags(CPU); vm::stackvar<be_t<u64>> revisionFlags(CPU);
revisionFlags.value() = 0; revisionFlags.value() = 0;
@ -48,7 +48,7 @@ int cellFontInit(PPUThread& CPU, vm::ptr<CellFontConfig> config)
int cellFontEnd() int cellFontEnd()
{ {
cellFont->Log("cellFontEnd()"); cellFont.Log("cellFontEnd()");
if (!s_fontInternalInstance->m_bInitialized) if (!s_fontInternalInstance->m_bInitialized)
return CELL_FONT_ERROR_UNINITIALIZED; return CELL_FONT_ERROR_UNINITIALIZED;
@ -59,14 +59,14 @@ int cellFontEnd()
s32 cellFontSetFontsetOpenMode(u32 openMode) s32 cellFontSetFontsetOpenMode(u32 openMode)
{ {
cellFont->Log("cellFontSetFontsetOpenMode(openMode=0x%x)", openMode); cellFont.Log("cellFontSetFontsetOpenMode(openMode=0x%x)", openMode);
UNIMPLEMENTED_FUNC(cellFont); UNIMPLEMENTED_FUNC(cellFont);
return CELL_FONT_OK; return CELL_FONT_OK;
} }
int cellFontOpenFontMemory(vm::ptr<CellFontLibrary> library, u32 fontAddr, u32 fontSize, u32 subNum, u32 uniqueId, vm::ptr<CellFont> font) int cellFontOpenFontMemory(vm::ptr<CellFontLibrary> library, u32 fontAddr, u32 fontSize, u32 subNum, u32 uniqueId, vm::ptr<CellFont> font)
{ {
cellFont->Warning("cellFontOpenFontMemory(library_addr=0x%x, fontAddr=0x%x, fontSize=%d, subNum=%d, uniqueId=%d, font_addr=0x%x)", cellFont.Warning("cellFontOpenFontMemory(library_addr=0x%x, fontAddr=0x%x, fontSize=%d, subNum=%d, uniqueId=%d, font_addr=0x%x)",
library.addr(), fontAddr, fontSize, subNum, uniqueId, font.addr()); library.addr(), fontAddr, fontSize, subNum, uniqueId, font.addr());
if (!s_fontInternalInstance->m_bInitialized) if (!s_fontInternalInstance->m_bInitialized)
@ -86,7 +86,7 @@ int cellFontOpenFontMemory(vm::ptr<CellFontLibrary> library, u32 fontAddr, u32 f
int cellFontOpenFontFile(vm::ptr<CellFontLibrary> library, vm::ptr<const char> fontPath, u32 subNum, s32 uniqueId, vm::ptr<CellFont> font) int cellFontOpenFontFile(vm::ptr<CellFontLibrary> library, vm::ptr<const char> fontPath, u32 subNum, s32 uniqueId, vm::ptr<CellFont> font)
{ {
std::string fp(fontPath.get_ptr()); std::string fp(fontPath.get_ptr());
cellFont->Warning("cellFontOpenFontFile(library_addr=0x%x, fontPath=\"%s\", subNum=%d, uniqueId=%d, font_addr=0x%x)", cellFont.Warning("cellFontOpenFontFile(library_addr=0x%x, fontPath=\"%s\", subNum=%d, uniqueId=%d, font_addr=0x%x)",
library.addr(), fp.c_str(), subNum, uniqueId, font.addr()); library.addr(), fp.c_str(), subNum, uniqueId, font.addr());
vfsFile f(fp); vfsFile f(fp);
@ -103,13 +103,13 @@ int cellFontOpenFontFile(vm::ptr<CellFontLibrary> library, vm::ptr<const char> f
int cellFontOpenFontset(PPUThread& CPU, vm::ptr<CellFontLibrary> library, vm::ptr<CellFontType> fontType, vm::ptr<CellFont> font) int cellFontOpenFontset(PPUThread& CPU, vm::ptr<CellFontLibrary> library, vm::ptr<CellFontType> fontType, vm::ptr<CellFont> font)
{ {
cellFont->Log("cellFontOpenFontset(library_addr=0x%x, fontType_addr=0x%x, font_addr=0x%x)", cellFont.Log("cellFontOpenFontset(library_addr=0x%x, fontType_addr=0x%x, font_addr=0x%x)",
library.addr(), fontType.addr(), font.addr()); library.addr(), fontType.addr(), font.addr());
if (!s_fontInternalInstance->m_bInitialized) if (!s_fontInternalInstance->m_bInitialized)
return CELL_FONT_ERROR_UNINITIALIZED; return CELL_FONT_ERROR_UNINITIALIZED;
if (fontType->map != CELL_FONT_MAP_UNICODE) if (fontType->map != CELL_FONT_MAP_UNICODE)
cellFont->Warning("cellFontOpenFontset: Only Unicode is supported"); cellFont.Warning("cellFontOpenFontset: Only Unicode is supported");
std::string file; std::string file;
switch((u32)fontType->type) switch((u32)fontType->type)
@ -168,12 +168,12 @@ int cellFontOpenFontset(PPUThread& CPU, vm::ptr<CellFontLibrary> library, vm::pt
case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET:
case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_VAGR2_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_VAGR2_SET:
case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_VAGR2_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_VAGR2_SET:
cellFont->Warning("cellFontOpenFontset: fontType->type = %d not supported yet. RD-R-LATIN.TTF will be used instead.", fontType->type); cellFont.Warning("cellFontOpenFontset: fontType->type = %d not supported yet. RD-R-LATIN.TTF will be used instead.", fontType->type);
file = "/dev_flash/data/font/SCE-PS3-RD-R-LATIN.TTF"; file = "/dev_flash/data/font/SCE-PS3-RD-R-LATIN.TTF";
break; break;
default: default:
cellFont->Warning("cellFontOpenFontset: fontType->type = %d not supported.", fontType->type); cellFont.Warning("cellFontOpenFontset: fontType->type = %d not supported.", fontType->type);
return CELL_FONT_ERROR_NO_SUPPORT_FONTSET; return CELL_FONT_ERROR_NO_SUPPORT_FONTSET;
} }
@ -186,7 +186,7 @@ int cellFontOpenFontset(PPUThread& CPU, vm::ptr<CellFontLibrary> library, vm::pt
int cellFontOpenFontInstance(vm::ptr<CellFont> openedFont, vm::ptr<CellFont> font) int cellFontOpenFontInstance(vm::ptr<CellFont> openedFont, vm::ptr<CellFont> font)
{ {
cellFont->Warning("cellFontOpenFontInstance(openedFont=0x%x, font=0x%x)", openedFont.addr(), font.addr()); cellFont.Warning("cellFontOpenFontInstance(openedFont=0x%x, font=0x%x)", openedFont.addr(), font.addr());
font->renderer_addr = openedFont->renderer_addr; font->renderer_addr = openedFont->renderer_addr;
font->scale_x = openedFont->scale_x; font->scale_x = openedFont->scale_x;
@ -200,14 +200,14 @@ int cellFontOpenFontInstance(vm::ptr<CellFont> openedFont, vm::ptr<CellFont> fon
s32 cellFontSetFontOpenMode(u32 openMode) s32 cellFontSetFontOpenMode(u32 openMode)
{ {
cellFont->Log("cellFontSetFontOpenMode(openMode=0x%x)", openMode); cellFont.Log("cellFontSetFontOpenMode(openMode=0x%x)", openMode);
UNIMPLEMENTED_FUNC(cellFont); UNIMPLEMENTED_FUNC(cellFont);
return CELL_FONT_OK; return CELL_FONT_OK;
} }
int cellFontCreateRenderer(vm::ptr<CellFontLibrary> library, vm::ptr<CellFontRendererConfig> config, vm::ptr<CellFontRenderer> Renderer) int cellFontCreateRenderer(vm::ptr<CellFontLibrary> library, vm::ptr<CellFontRendererConfig> config, vm::ptr<CellFontRenderer> Renderer)
{ {
cellFont->Warning("cellFontCreateRenderer(library_addr=0x%x, config_addr=0x%x, Renderer_addr=0x%x)", cellFont.Warning("cellFontCreateRenderer(library_addr=0x%x, config_addr=0x%x, Renderer_addr=0x%x)",
library.addr(), config.addr(), Renderer.addr()); library.addr(), config.addr(), Renderer.addr());
if (!s_fontInternalInstance->m_bInitialized) if (!s_fontInternalInstance->m_bInitialized)
@ -220,7 +220,7 @@ int cellFontCreateRenderer(vm::ptr<CellFontLibrary> library, vm::ptr<CellFontRen
void cellFontRenderSurfaceInit(vm::ptr<CellFontRenderSurface> surface, u32 buffer_addr, s32 bufferWidthByte, s32 pixelSizeByte, s32 w, s32 h) void cellFontRenderSurfaceInit(vm::ptr<CellFontRenderSurface> surface, u32 buffer_addr, s32 bufferWidthByte, s32 pixelSizeByte, s32 w, s32 h)
{ {
cellFont->Warning("cellFontRenderSurfaceInit(surface_addr=0x%x, buffer_addr=0x%x, bufferWidthByte=%d, pixelSizeByte=%d, w=%d, h=%d)", cellFont.Warning("cellFontRenderSurfaceInit(surface_addr=0x%x, buffer_addr=0x%x, bufferWidthByte=%d, pixelSizeByte=%d, w=%d, h=%d)",
surface.addr(), buffer_addr, bufferWidthByte, pixelSizeByte, w, h); surface.addr(), buffer_addr, bufferWidthByte, pixelSizeByte, w, h);
surface->buffer_addr = buffer_addr; surface->buffer_addr = buffer_addr;
@ -235,7 +235,7 @@ void cellFontRenderSurfaceInit(vm::ptr<CellFontRenderSurface> surface, u32 buffe
void cellFontRenderSurfaceSetScissor(vm::ptr<CellFontRenderSurface> surface, s32 x0, s32 y0, s32 w, s32 h) void cellFontRenderSurfaceSetScissor(vm::ptr<CellFontRenderSurface> surface, s32 x0, s32 y0, s32 w, s32 h)
{ {
cellFont->Warning("cellFontRenderSurfaceSetScissor(surface_addr=0x%x, x0=%d, y0=%d, w=%d, h=%d)", cellFont.Warning("cellFontRenderSurfaceSetScissor(surface_addr=0x%x, x0=%d, y0=%d, w=%d, h=%d)",
surface.addr(), x0, y0, w, h); surface.addr(), x0, y0, w, h);
surface->Scissor.x0 = x0; surface->Scissor.x0 = x0;
@ -246,7 +246,7 @@ void cellFontRenderSurfaceSetScissor(vm::ptr<CellFontRenderSurface> surface, s32
int cellFontSetScalePixel(vm::ptr<CellFont> font, float w, float h) int cellFontSetScalePixel(vm::ptr<CellFont> font, float w, float h)
{ {
cellFont->Log("cellFontSetScalePixel(font_addr=0x%x, w=%f, h=%f)", font.addr(), w, h); cellFont.Log("cellFontSetScalePixel(font_addr=0x%x, w=%f, h=%f)", font.addr(), w, h);
font->scale_x = w; font->scale_x = w;
font->scale_y = h; font->scale_y = h;
@ -255,7 +255,7 @@ int cellFontSetScalePixel(vm::ptr<CellFont> font, float w, float h)
int cellFontGetHorizontalLayout(vm::ptr<CellFont> font, vm::ptr<CellFontHorizontalLayout> layout) int cellFontGetHorizontalLayout(vm::ptr<CellFont> font, vm::ptr<CellFontHorizontalLayout> layout)
{ {
cellFont->Log("cellFontGetHorizontalLayout(font_addr=0x%x, layout_addr=0x%x)", cellFont.Log("cellFontGetHorizontalLayout(font_addr=0x%x, layout_addr=0x%x)",
font.addr(), layout.addr()); font.addr(), layout.addr());
int ascent, descent, lineGap; int ascent, descent, lineGap;
@ -270,7 +270,7 @@ int cellFontGetHorizontalLayout(vm::ptr<CellFont> font, vm::ptr<CellFontHorizont
int cellFontBindRenderer(vm::ptr<CellFont> font, vm::ptr<CellFontRenderer> renderer) int cellFontBindRenderer(vm::ptr<CellFont> font, vm::ptr<CellFontRenderer> renderer)
{ {
cellFont->Warning("cellFontBindRenderer(font_addr=0x%x, renderer_addr=0x%x)", cellFont.Warning("cellFontBindRenderer(font_addr=0x%x, renderer_addr=0x%x)",
font.addr(), renderer.addr()); font.addr(), renderer.addr());
if (font->renderer_addr) if (font->renderer_addr)
@ -282,7 +282,7 @@ int cellFontBindRenderer(vm::ptr<CellFont> font, vm::ptr<CellFontRenderer> rende
int cellFontUnbindRenderer(vm::ptr<CellFont> font) int cellFontUnbindRenderer(vm::ptr<CellFont> font)
{ {
cellFont->Warning("cellFontBindRenderer(font_addr=0x%x)", font.addr()); cellFont.Warning("cellFontBindRenderer(font_addr=0x%x)", font.addr());
if (!font->renderer_addr) if (!font->renderer_addr)
return CELL_FONT_ERROR_RENDERER_UNBIND; return CELL_FONT_ERROR_RENDERER_UNBIND;
@ -299,7 +299,7 @@ int cellFontDestroyRenderer()
int cellFontSetupRenderScalePixel(vm::ptr<CellFont> font, float w, float h) int cellFontSetupRenderScalePixel(vm::ptr<CellFont> font, float w, float h)
{ {
cellFont->Log("cellFontSetupRenderScalePixel(font_addr=0x%x, w=%f, h=%f)", font.addr(), w, h); cellFont.Log("cellFontSetupRenderScalePixel(font_addr=0x%x, w=%f, h=%f)", font.addr(), w, h);
if (!font->renderer_addr) if (!font->renderer_addr)
return CELL_FONT_ERROR_RENDERER_UNBIND; return CELL_FONT_ERROR_RENDERER_UNBIND;
@ -310,7 +310,7 @@ int cellFontSetupRenderScalePixel(vm::ptr<CellFont> font, float w, float h)
int cellFontGetRenderCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFontGlyphMetrics> metrics) int cellFontGetRenderCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFontGlyphMetrics> metrics)
{ {
cellFont->Log("cellFontGetRenderCharGlyphMetrics(font_addr=0x%x, code=0x%x, metrics_addr=0x%x)", cellFont.Log("cellFontGetRenderCharGlyphMetrics(font_addr=0x%x, code=0x%x, metrics_addr=0x%x)",
font.addr(), code, metrics.addr()); font.addr(), code, metrics.addr());
if (!font->renderer_addr) if (!font->renderer_addr)
@ -322,7 +322,7 @@ int cellFontGetRenderCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<
int cellFontRenderCharGlyphImage(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFontRenderSurface> surface, float x, float y, vm::ptr<CellFontGlyphMetrics> metrics, vm::ptr<CellFontImageTransInfo> transInfo) int cellFontRenderCharGlyphImage(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFontRenderSurface> surface, float x, float y, vm::ptr<CellFontGlyphMetrics> metrics, vm::ptr<CellFontImageTransInfo> transInfo)
{ {
cellFont->Log("cellFontRenderCharGlyphImage(font_addr=0x%x, code=0x%x, surface_addr=0x%x, x=%f, y=%f, metrics_addr=0x%x, trans_addr=0x%x)", cellFont.Log("cellFontRenderCharGlyphImage(font_addr=0x%x, code=0x%x, surface_addr=0x%x, x=%f, y=%f, metrics_addr=0x%x, trans_addr=0x%x)",
font.addr(), code, surface.addr(), x, y, metrics.addr(), transInfo.addr()); font.addr(), code, surface.addr(), x, y, metrics.addr(), transInfo.addr());
if (!font->renderer_addr) if (!font->renderer_addr)
@ -366,7 +366,7 @@ int cellFontEndLibrary()
int cellFontSetEffectSlant(vm::ptr<CellFont> font, float slantParam) int cellFontSetEffectSlant(vm::ptr<CellFont> font, float slantParam)
{ {
cellFont->Log("cellFontSetEffectSlant(font_addr=0x%x, slantParam=%f)", font.addr(), slantParam); cellFont.Log("cellFontSetEffectSlant(font_addr=0x%x, slantParam=%f)", font.addr(), slantParam);
if (slantParam < -1.0 || slantParam > 1.0) if (slantParam < -1.0 || slantParam > 1.0)
return CELL_FONT_ERROR_INVALID_PARAMETER; return CELL_FONT_ERROR_INVALID_PARAMETER;
@ -377,7 +377,7 @@ int cellFontSetEffectSlant(vm::ptr<CellFont> font, float slantParam)
int cellFontGetEffectSlant(vm::ptr<CellFont> font, vm::ptr<be_t<float>> slantParam) int cellFontGetEffectSlant(vm::ptr<CellFont> font, vm::ptr<be_t<float>> slantParam)
{ {
cellFont->Warning("cellFontSetEffectSlant(font_addr=0x%x, slantParam_addr=0x%x)", font.addr(), slantParam.addr()); cellFont.Warning("cellFontSetEffectSlant(font_addr=0x%x, slantParam_addr=0x%x)", font.addr(), slantParam.addr());
*slantParam = font->slant; *slantParam = font->slant;
return CELL_FONT_OK; return CELL_FONT_OK;
@ -385,7 +385,7 @@ int cellFontGetEffectSlant(vm::ptr<CellFont> font, vm::ptr<be_t<float>> slantPar
int cellFontGetFontIdCode(vm::ptr<CellFont> font, u32 code, vm::ptr<u32> fontId, vm::ptr<u32> fontCode) int cellFontGetFontIdCode(vm::ptr<CellFont> font, u32 code, vm::ptr<u32> fontId, vm::ptr<u32> fontCode)
{ {
cellFont->Todo("cellFontGetFontIdCode(font_addr=0x%x, code=0x%x, fontId_addr=0x%x, fontCode_addr=0x%x)", font.addr(), code, fontId.addr(), fontCode.addr()); cellFont.Todo("cellFontGetFontIdCode(font_addr=0x%x, code=0x%x, fontId_addr=0x%x, fontCode_addr=0x%x)", font.addr(), code, fontId.addr(), fontCode.addr());
// TODO: ? // TODO: ?
return CELL_FONT_OK; return CELL_FONT_OK;
@ -393,7 +393,7 @@ int cellFontGetFontIdCode(vm::ptr<CellFont> font, u32 code, vm::ptr<u32> fontId,
int cellFontCloseFont(vm::ptr<CellFont> font) int cellFontCloseFont(vm::ptr<CellFont> font)
{ {
cellFont->Warning("cellFontCloseFont(font_addr=0x%x)", font.addr()); cellFont.Warning("cellFontCloseFont(font_addr=0x%x)", font.addr());
if (font->origin == CELL_FONT_OPEN_FONTSET || if (font->origin == CELL_FONT_OPEN_FONTSET ||
font->origin == CELL_FONT_OPEN_FONT_FILE || font->origin == CELL_FONT_OPEN_FONT_FILE ||
@ -405,7 +405,7 @@ int cellFontCloseFont(vm::ptr<CellFont> font)
int cellFontGetCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFontGlyphMetrics> metrics) int cellFontGetCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFontGlyphMetrics> metrics)
{ {
cellFont->Log("cellFontGetCharGlyphMetrics(font_addr=0x%x, code=0x%x, metrics_addr=0x%x)", font.addr(), code, metrics.addr()); cellFont.Log("cellFontGetCharGlyphMetrics(font_addr=0x%x, code=0x%x, metrics_addr=0x%x)", font.addr(), code, metrics.addr());
int x0, y0, x1, y1; int x0, y0, x1, y1;
int advanceWidth, leftSideBearing; int advanceWidth, leftSideBearing;
@ -541,7 +541,7 @@ int cellFontDeleteGlyph()
int cellFontExtend(u32 a1, u32 a2, u32 a3) int cellFontExtend(u32 a1, u32 a2, u32 a3)
{ {
cellFont->Warning("cellFontExtend(a1=0x%x, a2=0x%x, a3=0x%x)", a1, a2, a3); cellFont.Warning("cellFontExtend(a1=0x%x, a2=0x%x, a3=0x%x)", a1, a2, a3);
//In a test I did: a1=0xcfe00000, a2=0x0, a3=(pointer to something) //In a test I did: a1=0xcfe00000, a2=0x0, a3=(pointer to something)
if (a1 == 0xcfe00000) if (a1 == 0xcfe00000)
{ {
@ -577,70 +577,65 @@ int cellFontGetCharGlyphMetricsVertical()
return CELL_FONT_OK; return CELL_FONT_OK;
} }
void cellFont_init(Module *pxThis) Module cellFont("cellFont", []()
{
cellFont = pxThis;
cellFont->AddFunc(0x25c107e6, cellFontInit);
cellFont->AddFunc(0x6bf6f832, cellFontSetFontsetOpenMode);
cellFont->AddFunc(0x6cfada83, cellFontSetFontOpenMode);
cellFont->AddFunc(0x042e74e3, cellFontCreateRenderer);
cellFont->AddFunc(0x1387c45c, cellFontGetHorizontalLayout);
cellFont->AddFunc(0x21ebb248, cellFontDestroyRenderer);
cellFont->AddFunc(0x227e1e3c, cellFontSetupRenderScalePixel);
cellFont->AddFunc(0x29329541, cellFontOpenFontInstance);
cellFont->AddFunc(0x297f0e93, cellFontSetScalePixel);
cellFont->AddFunc(0x2da9fd9d, cellFontGetRenderCharGlyphMetrics);
cellFont->AddFunc(0x40d40544, cellFontEndLibrary);
cellFont->AddFunc(0x66a23100, cellFontBindRenderer);
cellFont->AddFunc(0x7ab47f7e, cellFontEnd);
cellFont->AddFunc(0x8657c8f5, cellFontSetEffectSlant);
cellFont->AddFunc(0xe16e679a, cellFontGetEffectSlant);
cellFont->AddFunc(0x88be4799, cellFontRenderCharGlyphImage);
cellFont->AddFunc(0x90b9465e, cellFontRenderSurfaceInit);
cellFont->AddFunc(0x98ac5524, cellFontGetFontIdCode);
cellFont->AddFunc(0xa885cc9b, cellFontOpenFontset);
cellFont->AddFunc(0xb276f1f6, cellFontCloseFont);
cellFont->AddFunc(0xb422b005, cellFontRenderSurfaceSetScissor);
cellFont->AddFunc(0xd8eaee9f, cellFontGetCharGlyphMetrics);
cellFont->AddFunc(0xf03dcc29, cellFontInitializeWithRevision);
cellFont->AddFunc(0x061049ad, cellFontGraphicsSetFontRGBA);
cellFont->AddFunc(0x073fa321, cellFontOpenFontsetOnMemory);
cellFont->AddFunc(0x0a7306a4, cellFontOpenFontFile);
cellFont->AddFunc(0x16322df1, cellFontGraphicsSetScalePixel);
cellFont->AddFunc(0x2388186c, cellFontGraphicsGetScalePixel);
cellFont->AddFunc(0x25253fe4, cellFontSetEffectWeight);
cellFont->AddFunc(0x53f529fe, cellFontGlyphSetupVertexesGlyph);
cellFont->AddFunc(0x698897f8, cellFontGetVerticalLayout);
cellFont->AddFunc(0x700e6223, cellFontGetRenderCharGlyphMetricsVertical);
cellFont->AddFunc(0x70f3e728, cellFontSetScalePoint);
cellFont->AddFunc(0x78d05e08, cellFontSetupRenderEffectSlant);
cellFont->AddFunc(0x7c83bc15, cellFontGraphicsSetLineRGBA);
cellFont->AddFunc(0x87bd650f, cellFontGraphicsSetDrawType);
cellFont->AddFunc(0x8a35c887, cellFontEndGraphics);
cellFont->AddFunc(0x970d4c22, cellFontGraphicsSetupDrawContext);
cellFont->AddFunc(0x9e19072b, cellFontOpenFontMemory);
cellFont->AddFunc(0xa6dc25d1, cellFontSetupRenderEffectWeight);
cellFont->AddFunc(0xa8fae920, cellFontGlyphGetOutlineControlDistance);
cellFont->AddFunc(0xb4d112af, cellFontGlyphGetVertexesGlyphSize);
cellFont->AddFunc(0xc17259de, cellFontGenerateCharGlyph);
cellFont->AddFunc(0xd62f5d76, cellFontDeleteGlyph);
cellFont->AddFunc(0xdee0836c, cellFontExtend);
cellFont->AddFunc(0xe857a0ca, cellFontRenderCharGlyphImageVertical);
cellFont->AddFunc(0xfb3341ba, cellFontSetResolutionDpi);
cellFont->AddFunc(0xfe9a6dd7, cellFontGetCharGlyphMetricsVertical);
cellFont->AddFunc(0xf16379fa, cellFontUnbindRenderer);
cellFont->AddFunc(0xb015a84e, cellFontGetRevisionFlags);
}
void cellFont_load()
{ {
s_fontInternalInstance = new CCellFontInternal(); s_fontInternalInstance = new CCellFontInternal();
}
void cellFont_unload() cellFont.on_stop = []()
{ {
// s_fontInternalInstance->m_bInitialized = false; // s_fontInternalInstance->m_bInitialized = false;
// s_fontInternalInstance->m_bFontGcmInitialized = false; // s_fontInternalInstance->m_bFontGcmInitialized = false;
delete s_fontInternalInstance; delete s_fontInternalInstance;
} };
cellFont.AddFunc(0x25c107e6, cellFontInit);
cellFont.AddFunc(0x6bf6f832, cellFontSetFontsetOpenMode);
cellFont.AddFunc(0x6cfada83, cellFontSetFontOpenMode);
cellFont.AddFunc(0x042e74e3, cellFontCreateRenderer);
cellFont.AddFunc(0x1387c45c, cellFontGetHorizontalLayout);
cellFont.AddFunc(0x21ebb248, cellFontDestroyRenderer);
cellFont.AddFunc(0x227e1e3c, cellFontSetupRenderScalePixel);
cellFont.AddFunc(0x29329541, cellFontOpenFontInstance);
cellFont.AddFunc(0x297f0e93, cellFontSetScalePixel);
cellFont.AddFunc(0x2da9fd9d, cellFontGetRenderCharGlyphMetrics);
cellFont.AddFunc(0x40d40544, cellFontEndLibrary);
cellFont.AddFunc(0x66a23100, cellFontBindRenderer);
cellFont.AddFunc(0x7ab47f7e, cellFontEnd);
cellFont.AddFunc(0x8657c8f5, cellFontSetEffectSlant);
cellFont.AddFunc(0xe16e679a, cellFontGetEffectSlant);
cellFont.AddFunc(0x88be4799, cellFontRenderCharGlyphImage);
cellFont.AddFunc(0x90b9465e, cellFontRenderSurfaceInit);
cellFont.AddFunc(0x98ac5524, cellFontGetFontIdCode);
cellFont.AddFunc(0xa885cc9b, cellFontOpenFontset);
cellFont.AddFunc(0xb276f1f6, cellFontCloseFont);
cellFont.AddFunc(0xb422b005, cellFontRenderSurfaceSetScissor);
cellFont.AddFunc(0xd8eaee9f, cellFontGetCharGlyphMetrics);
cellFont.AddFunc(0xf03dcc29, cellFontInitializeWithRevision);
cellFont.AddFunc(0x061049ad, cellFontGraphicsSetFontRGBA);
cellFont.AddFunc(0x073fa321, cellFontOpenFontsetOnMemory);
cellFont.AddFunc(0x0a7306a4, cellFontOpenFontFile);
cellFont.AddFunc(0x16322df1, cellFontGraphicsSetScalePixel);
cellFont.AddFunc(0x2388186c, cellFontGraphicsGetScalePixel);
cellFont.AddFunc(0x25253fe4, cellFontSetEffectWeight);
cellFont.AddFunc(0x53f529fe, cellFontGlyphSetupVertexesGlyph);
cellFont.AddFunc(0x698897f8, cellFontGetVerticalLayout);
cellFont.AddFunc(0x700e6223, cellFontGetRenderCharGlyphMetricsVertical);
cellFont.AddFunc(0x70f3e728, cellFontSetScalePoint);
cellFont.AddFunc(0x78d05e08, cellFontSetupRenderEffectSlant);
cellFont.AddFunc(0x7c83bc15, cellFontGraphicsSetLineRGBA);
cellFont.AddFunc(0x87bd650f, cellFontGraphicsSetDrawType);
cellFont.AddFunc(0x8a35c887, cellFontEndGraphics);
cellFont.AddFunc(0x970d4c22, cellFontGraphicsSetupDrawContext);
cellFont.AddFunc(0x9e19072b, cellFontOpenFontMemory);
cellFont.AddFunc(0xa6dc25d1, cellFontSetupRenderEffectWeight);
cellFont.AddFunc(0xa8fae920, cellFontGlyphGetOutlineControlDistance);
cellFont.AddFunc(0xb4d112af, cellFontGlyphGetVertexesGlyphSize);
cellFont.AddFunc(0xc17259de, cellFontGenerateCharGlyph);
cellFont.AddFunc(0xd62f5d76, cellFontDeleteGlyph);
cellFont.AddFunc(0xdee0836c, cellFontExtend);
cellFont.AddFunc(0xe857a0ca, cellFontRenderCharGlyphImageVertical);
cellFont.AddFunc(0xfb3341ba, cellFontSetResolutionDpi);
cellFont.AddFunc(0xfe9a6dd7, cellFontGetCharGlyphMetricsVertical);
cellFont.AddFunc(0xf16379fa, cellFontUnbindRenderer);
cellFont.AddFunc(0xb015a84e, cellFontGetRevisionFlags);
});

View file

@ -5,13 +5,13 @@
#include "cellFont.h" #include "cellFont.h"
#include "cellFontFT.h" #include "cellFontFT.h"
Module *cellFontFT = nullptr; extern Module cellFontFT;
CCellFontFTInternal* s_fontFtInternalInstance = nullptr; CCellFontFTInternal* s_fontFtInternalInstance = nullptr;
int cellFontInitLibraryFreeTypeWithRevision(u64 revisionFlags, vm::ptr<CellFontLibraryConfigFT> config, u32 lib_addr_addr) int cellFontInitLibraryFreeTypeWithRevision(u64 revisionFlags, vm::ptr<CellFontLibraryConfigFT> config, u32 lib_addr_addr)
{ {
cellFontFT->Warning("cellFontInitLibraryFreeTypeWithRevision(revisionFlags=0x%llx, config_addr=0x%x, lib_addr_addr=0x%x", cellFontFT.Warning("cellFontInitLibraryFreeTypeWithRevision(revisionFlags=0x%llx, config_addr=0x%x, lib_addr_addr=0x%x",
revisionFlags, config.addr(), lib_addr_addr); revisionFlags, config.addr(), lib_addr_addr);
//if (s_fontInternalInstance->m_bInitialized) //if (s_fontInternalInstance->m_bInitialized)
@ -34,21 +34,16 @@ int cellFontFTGetInitializedRevisionFlags()
return CELL_OK; return CELL_OK;
} }
void cellFontFT_init(Module *pxThis) Module cellFontFT("cellFontFT", []()
{
cellFontFT = pxThis;
cellFontFT->AddFunc(0x7a0a83c4, cellFontInitLibraryFreeTypeWithRevision);
cellFontFT->AddFunc(0xec89a187, cellFontFTGetRevisionFlags);
cellFontFT->AddFunc(0xfa0c2de0, cellFontFTGetInitializedRevisionFlags);
}
void cellFontFT_load()
{ {
s_fontFtInternalInstance = new CCellFontFTInternal(); s_fontFtInternalInstance = new CCellFontFTInternal();
}
void cellFontFT_unload() cellFontFT.on_stop = []()
{ {
delete s_fontFtInternalInstance; delete s_fontFtInternalInstance;
} };
cellFontFT.AddFunc(0x7a0a83c4, cellFontInitLibraryFreeTypeWithRevision);
cellFontFT.AddFunc(0xec89a187, cellFontFTGetRevisionFlags);
cellFontFT.AddFunc(0xfa0c2de0, cellFontFTGetInitializedRevisionFlags);
});

View file

@ -10,7 +10,7 @@
#include "Loader/PSF.h" #include "Loader/PSF.h"
#include "cellGame.h" #include "cellGame.h"
Module *cellGame = nullptr; extern Module cellGame;
std::string contentInfo = ""; std::string contentInfo = "";
std::string usrdir = ""; std::string usrdir = "";
@ -18,7 +18,7 @@ bool path_set = false;
int cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr<CellGameContentSize> size, vm::ptr<char[CELL_GAME_DIRNAME_SIZE]> dirName) int cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr<CellGameContentSize> size, vm::ptr<char[CELL_GAME_DIRNAME_SIZE]> dirName)
{ {
cellGame->Warning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)", cellGame.Warning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)",
type.addr(), attributes.addr(), size.addr(), dirName.addr()); type.addr(), attributes.addr(), size.addr(), dirName.addr());
if (size) if (size)
@ -34,14 +34,14 @@ int cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr<CellGa
vfsFile f("/app_home/../PARAM.SFO"); vfsFile f("/app_home/../PARAM.SFO");
if (!f.IsOpened()) if (!f.IsOpened())
{ {
cellGame->Error("cellGameBootCheck(): CELL_GAME_ERROR_ACCESS_ERROR (cannot open PARAM.SFO)"); cellGame.Error("cellGameBootCheck(): CELL_GAME_ERROR_ACCESS_ERROR (cannot open PARAM.SFO)");
return CELL_GAME_ERROR_ACCESS_ERROR; return CELL_GAME_ERROR_ACCESS_ERROR;
} }
PSFLoader psf(f); PSFLoader psf(f);
if (!psf.Load(false)) if (!psf.Load(false))
{ {
cellGame->Error("cellGameBootCheck(): CELL_GAME_ERROR_ACCESS_ERROR (cannot read PARAM.SFO)"); cellGame.Error("cellGameBootCheck(): CELL_GAME_ERROR_ACCESS_ERROR (cannot read PARAM.SFO)");
return CELL_GAME_ERROR_ACCESS_ERROR; return CELL_GAME_ERROR_ACCESS_ERROR;
} }
@ -77,7 +77,7 @@ int cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr<CellGa
} }
else else
{ {
cellGame->Error("cellGameBootCheck(): CELL_GAME_ERROR_FAILURE (unknown CATEGORY)"); cellGame.Error("cellGameBootCheck(): CELL_GAME_ERROR_FAILURE (unknown CATEGORY)");
return CELL_GAME_ERROR_FAILURE; return CELL_GAME_ERROR_FAILURE;
} }
@ -86,11 +86,11 @@ int cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr<CellGa
int cellGamePatchCheck(vm::ptr<CellGameContentSize> size, u32 reserved_addr) int cellGamePatchCheck(vm::ptr<CellGameContentSize> size, u32 reserved_addr)
{ {
cellGame->Warning("cellGamePatchCheck(size_addr=0x%x, reserved_addr=0x%x)", size.addr(), reserved_addr); cellGame.Warning("cellGamePatchCheck(size_addr=0x%x, reserved_addr=0x%x)", size.addr(), reserved_addr);
if (reserved_addr != 0) if (reserved_addr != 0)
{ {
cellGame->Error("cellGamePatchCheck(): CELL_GAME_ERROR_PARAM"); cellGame.Error("cellGamePatchCheck(): CELL_GAME_ERROR_PARAM");
return CELL_GAME_ERROR_PARAM; return CELL_GAME_ERROR_PARAM;
} }
@ -107,21 +107,21 @@ int cellGamePatchCheck(vm::ptr<CellGameContentSize> size, u32 reserved_addr)
vfsFile f("/app_home/../PARAM.SFO"); vfsFile f("/app_home/../PARAM.SFO");
if (!f.IsOpened()) if (!f.IsOpened())
{ {
cellGame->Error("cellGamePatchCheck(): CELL_GAME_ERROR_ACCESS_ERROR (cannot open PARAM.SFO)"); cellGame.Error("cellGamePatchCheck(): CELL_GAME_ERROR_ACCESS_ERROR (cannot open PARAM.SFO)");
return CELL_GAME_ERROR_ACCESS_ERROR; return CELL_GAME_ERROR_ACCESS_ERROR;
} }
PSFLoader psf(f); PSFLoader psf(f);
if (!psf.Load(false)) if (!psf.Load(false))
{ {
cellGame->Error("cellGamePatchCheck(): CELL_GAME_ERROR_ACCESS_ERROR (cannot read PARAM.SFO)"); cellGame.Error("cellGamePatchCheck(): CELL_GAME_ERROR_ACCESS_ERROR (cannot read PARAM.SFO)");
return CELL_GAME_ERROR_ACCESS_ERROR; return CELL_GAME_ERROR_ACCESS_ERROR;
} }
std::string category = psf.GetString("CATEGORY"); std::string category = psf.GetString("CATEGORY");
if (category.substr(0, 2) != "GD") if (category.substr(0, 2) != "GD")
{ {
cellGame->Error("cellGamePatchCheck(): CELL_GAME_ERROR_NOTPATCH"); cellGame.Error("cellGamePatchCheck(): CELL_GAME_ERROR_NOTPATCH");
return CELL_GAME_ERROR_NOTPATCH; return CELL_GAME_ERROR_NOTPATCH;
} }
@ -135,11 +135,11 @@ int cellGamePatchCheck(vm::ptr<CellGameContentSize> size, u32 reserved_addr)
int cellGameDataCheck(u32 type, vm::ptr<const char> dirName, vm::ptr<CellGameContentSize> size) int cellGameDataCheck(u32 type, vm::ptr<const char> dirName, vm::ptr<CellGameContentSize> size)
{ {
cellGame->Warning("cellGameDataCheck(type=0x%x, dirName_addr=0x%x, size_addr=0x%x)", type, dirName.addr(), size.addr()); cellGame.Warning("cellGameDataCheck(type=0x%x, dirName_addr=0x%x, size_addr=0x%x)", type, dirName.addr(), size.addr());
if ((type - 1) >= 3) if ((type - 1) >= 3)
{ {
cellGame->Error("cellGameDataCheck(): CELL_GAME_ERROR_PARAM"); cellGame.Error("cellGameDataCheck(): CELL_GAME_ERROR_PARAM");
return CELL_GAME_ERROR_PARAM; return CELL_GAME_ERROR_PARAM;
} }
@ -159,7 +159,7 @@ int cellGameDataCheck(u32 type, vm::ptr<const char> dirName, vm::ptr<CellGameCon
if (!Emu.GetVFS().ExistsDir("/dev_bdvd/PS3_GAME")) if (!Emu.GetVFS().ExistsDir("/dev_bdvd/PS3_GAME"))
{ {
cellGame->Warning("cellGameDataCheck(): /dev_bdvd/PS3_GAME not found"); cellGame.Warning("cellGameDataCheck(): /dev_bdvd/PS3_GAME not found");
contentInfo = ""; contentInfo = "";
usrdir = ""; usrdir = "";
path_set = true; path_set = true;
@ -176,7 +176,7 @@ int cellGameDataCheck(u32 type, vm::ptr<const char> dirName, vm::ptr<CellGameCon
if (!Emu.GetVFS().ExistsDir(dir)) if (!Emu.GetVFS().ExistsDir(dir))
{ {
cellGame->Warning("cellGameDataCheck(): '%s' directory not found", dir.c_str()); cellGame.Warning("cellGameDataCheck(): '%s' directory not found", dir.c_str());
contentInfo = ""; contentInfo = "";
usrdir = ""; usrdir = "";
path_set = true; path_set = true;
@ -193,7 +193,7 @@ int cellGameDataCheck(u32 type, vm::ptr<const char> dirName, vm::ptr<CellGameCon
int cellGameContentPermit(vm::ptr<char[CELL_GAME_PATH_MAX]> contentInfoPath, vm::ptr<char[CELL_GAME_PATH_MAX]> usrdirPath) int cellGameContentPermit(vm::ptr<char[CELL_GAME_PATH_MAX]> contentInfoPath, vm::ptr<char[CELL_GAME_PATH_MAX]> usrdirPath)
{ {
cellGame->Warning("cellGameContentPermit(contentInfoPath_addr=0x%x, usrdirPath_addr=0x%x)", cellGame.Warning("cellGameContentPermit(contentInfoPath_addr=0x%x, usrdirPath_addr=0x%x)",
contentInfoPath.addr(), usrdirPath.addr()); contentInfoPath.addr(), usrdirPath.addr());
if (!contentInfoPath || !usrdirPath) if (!contentInfoPath || !usrdirPath)
@ -219,12 +219,12 @@ int cellGameContentPermit(vm::ptr<char[CELL_GAME_PATH_MAX]> contentInfoPath, vm:
int cellGameDataCheckCreate2(PPUThread& CPU, u32 version, vm::ptr<const char> dirName, u32 errDialog, int cellGameDataCheckCreate2(PPUThread& CPU, u32 version, vm::ptr<const char> dirName, u32 errDialog,
vm::ptr<void(vm::ptr<CellGameDataCBResult> cbResult, vm::ptr<CellGameDataStatGet> get, vm::ptr<CellGameDataStatSet> set)> funcStat, u32 container) vm::ptr<void(vm::ptr<CellGameDataCBResult> cbResult, vm::ptr<CellGameDataStatGet> get, vm::ptr<CellGameDataStatSet> set)> funcStat, u32 container)
{ {
cellGame->Warning("cellGameDataCheckCreate(2)(version=0x%x, dirName_addr=0x%x, errDialog=0x%x, funcStat_addr=0x%x, container=%d)", cellGame.Warning("cellGameDataCheckCreate(2)(version=0x%x, dirName_addr=0x%x, errDialog=0x%x, funcStat_addr=0x%x, container=%d)",
version, dirName.addr(), errDialog, funcStat.addr(), container); version, dirName.addr(), errDialog, funcStat.addr(), container);
if (version != CELL_GAMEDATA_VERSION_CURRENT || errDialog > 1) if (version != CELL_GAMEDATA_VERSION_CURRENT || errDialog > 1)
{ {
cellGame->Error("cellGameDataCheckCreate(2)(): CELL_GAMEDATA_ERROR_PARAM"); cellGame.Error("cellGameDataCheckCreate(2)(): CELL_GAMEDATA_ERROR_PARAM");
return CELL_GAMEDATA_ERROR_PARAM; return CELL_GAMEDATA_ERROR_PARAM;
} }
@ -234,7 +234,7 @@ int cellGameDataCheckCreate2(PPUThread& CPU, u32 version, vm::ptr<const char> di
if (!Emu.GetVFS().ExistsDir(dir)) if (!Emu.GetVFS().ExistsDir(dir))
{ {
cellGame->Todo("cellGameDataCheckCreate(2)(): creating directory '%s'", dir.c_str()); cellGame.Todo("cellGameDataCheckCreate(2)(): creating directory '%s'", dir.c_str());
// TODO: create data // TODO: create data
return CELL_GAMEDATA_RET_OK; return CELL_GAMEDATA_RET_OK;
} }
@ -242,14 +242,14 @@ int cellGameDataCheckCreate2(PPUThread& CPU, u32 version, vm::ptr<const char> di
vfsFile f(dir + "/PARAM.SFO"); vfsFile f(dir + "/PARAM.SFO");
if (!f.IsOpened()) if (!f.IsOpened())
{ {
cellGame->Error("cellGameDataCheckCreate(2)(): CELL_GAMEDATA_ERROR_BROKEN (cannot open PARAM.SFO)"); cellGame.Error("cellGameDataCheckCreate(2)(): CELL_GAMEDATA_ERROR_BROKEN (cannot open PARAM.SFO)");
return CELL_GAMEDATA_ERROR_BROKEN; return CELL_GAMEDATA_ERROR_BROKEN;
} }
PSFLoader psf(f); PSFLoader psf(f);
if (!psf.Load(false)) if (!psf.Load(false))
{ {
cellGame->Error("cellGameDataCheckCreate(2)(): CELL_GAMEDATA_ERROR_BROKEN (cannot read PARAM.SFO)"); cellGame.Error("cellGameDataCheckCreate(2)(): CELL_GAMEDATA_ERROR_BROKEN (cannot read PARAM.SFO)");
return CELL_GAMEDATA_ERROR_BROKEN; return CELL_GAMEDATA_ERROR_BROKEN;
} }
@ -287,36 +287,36 @@ int cellGameDataCheckCreate2(PPUThread& CPU, u32 version, vm::ptr<const char> di
if (cbSet->setParam) if (cbSet->setParam)
{ {
// TODO: write PARAM.SFO from cbSet // TODO: write PARAM.SFO from cbSet
cellGame->Todo("cellGameDataCheckCreate(2)(): writing PARAM.SFO parameters (addr=0x%x)", cbSet->setParam); cellGame.Todo("cellGameDataCheckCreate(2)(): writing PARAM.SFO parameters (addr=0x%x)", cbSet->setParam);
} }
switch ((s32)cbResult->result) switch ((s32)cbResult->result)
{ {
case CELL_GAMEDATA_CBRESULT_OK_CANCEL: case CELL_GAMEDATA_CBRESULT_OK_CANCEL:
// TODO: do not process game data // TODO: do not process game data
cellGame->Warning("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_OK_CANCEL"); cellGame.Warning("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_OK_CANCEL");
case CELL_GAMEDATA_CBRESULT_OK: case CELL_GAMEDATA_CBRESULT_OK:
return CELL_GAMEDATA_RET_OK; return CELL_GAMEDATA_RET_OK;
case CELL_GAMEDATA_CBRESULT_ERR_NOSPACE: // TODO: process errors, error message and needSizeKB result case CELL_GAMEDATA_CBRESULT_ERR_NOSPACE: // TODO: process errors, error message and needSizeKB result
cellGame->Error("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_ERR_NOSPACE"); cellGame.Error("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_ERR_NOSPACE");
return CELL_GAMEDATA_ERROR_CBRESULT; return CELL_GAMEDATA_ERROR_CBRESULT;
case CELL_GAMEDATA_CBRESULT_ERR_BROKEN: case CELL_GAMEDATA_CBRESULT_ERR_BROKEN:
cellGame->Error("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_ERR_BROKEN"); cellGame.Error("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_ERR_BROKEN");
return CELL_GAMEDATA_ERROR_CBRESULT; return CELL_GAMEDATA_ERROR_CBRESULT;
case CELL_GAMEDATA_CBRESULT_ERR_NODATA: case CELL_GAMEDATA_CBRESULT_ERR_NODATA:
cellGame->Error("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_ERR_NODATA"); cellGame.Error("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_ERR_NODATA");
return CELL_GAMEDATA_ERROR_CBRESULT; return CELL_GAMEDATA_ERROR_CBRESULT;
case CELL_GAMEDATA_CBRESULT_ERR_INVALID: case CELL_GAMEDATA_CBRESULT_ERR_INVALID:
cellGame->Error("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_ERR_INVALID"); cellGame.Error("cellGameDataCheckCreate(2)(): callback returned CELL_GAMEDATA_CBRESULT_ERR_INVALID");
return CELL_GAMEDATA_ERROR_CBRESULT; return CELL_GAMEDATA_ERROR_CBRESULT;
default: default:
cellGame->Error("cellGameDataCheckCreate(2)(): callback returned unknown error (code=0x%x)"); cellGame.Error("cellGameDataCheckCreate(2)(): callback returned unknown error (code=0x%x)");
return CELL_GAMEDATA_ERROR_CBRESULT; return CELL_GAMEDATA_ERROR_CBRESULT;
} }
} }
@ -330,7 +330,7 @@ int cellGameDataCheckCreate(PPUThread& CPU, u32 version, vm::ptr<const char> dir
int cellGameCreateGameData(vm::ptr<CellGameSetInitParams> init, vm::ptr<char> tmp_contentInfoPath, vm::ptr<char> tmp_usrdirPath) int cellGameCreateGameData(vm::ptr<CellGameSetInitParams> init, vm::ptr<char> tmp_contentInfoPath, vm::ptr<char> tmp_usrdirPath)
{ {
cellGame->Todo("cellGameCreateGameData(init_addr=0x%x, tmp_contentInfoPath_addr=0x%x, tmp_usrdirPath_addr=0x%x)", cellGame.Todo("cellGameCreateGameData(init_addr=0x%x, tmp_contentInfoPath_addr=0x%x, tmp_usrdirPath_addr=0x%x)",
init.addr(), tmp_contentInfoPath.addr(), tmp_usrdirPath.addr()); init.addr(), tmp_contentInfoPath.addr(), tmp_usrdirPath.addr());
// TODO: create temporary game directory, set initial PARAM.SFO parameters // TODO: create temporary game directory, set initial PARAM.SFO parameters
@ -346,7 +346,7 @@ int cellGameDeleteGameData()
int cellGameGetParamInt(u32 id, vm::ptr<u32> value) int cellGameGetParamInt(u32 id, vm::ptr<u32> value)
{ {
cellGame->Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.addr()); cellGame.Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.addr());
// TODO: Access through cellGame***Check functions // TODO: Access through cellGame***Check functions
vfsFile f("/app_home/../PARAM.SFO"); vfsFile f("/app_home/../PARAM.SFO");
@ -369,7 +369,7 @@ int cellGameGetParamInt(u32 id, vm::ptr<u32> value)
int cellGameGetParamString(u32 id, vm::ptr<char> buf, u32 bufsize) int cellGameGetParamString(u32 id, vm::ptr<char> buf, u32 bufsize)
{ {
cellGame->Warning("cellGameGetParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.addr(), bufsize); cellGame.Warning("cellGameGetParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.addr(), bufsize);
// TODO: Access through cellGame***Check functions // TODO: Access through cellGame***Check functions
vfsFile f("/app_home/../PARAM.SFO"); vfsFile f("/app_home/../PARAM.SFO");
@ -441,7 +441,7 @@ int cellGameGetLocalWebContentPath()
int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::ptr<const char> dirName) int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::ptr<const char> dirName)
{ {
cellGame->Warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName_addr=0x%x)", type, errNeedSizeKB, dirName.addr()); cellGame.Warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName_addr=0x%x)", type, errNeedSizeKB, dirName.addr());
std::string errorName; std::string errorName;
switch (type) switch (type)
@ -487,35 +487,33 @@ int cellGameThemeInstallFromBuffer()
return CELL_OK; return CELL_OK;
} }
void cellGame_init(Module *pxThis) Module cellGame("cellGame", []()
{ {
cellGame = pxThis;
contentInfo = ""; contentInfo = "";
usrdir = ""; usrdir = "";
path_set = false; path_set = false;
// (TODO: Disc Exchange functions missing) // (TODO: Disc Exchange functions missing)
cellGame->AddFunc(0xf52639ea, cellGameBootCheck); cellGame.AddFunc(0xf52639ea, cellGameBootCheck);
cellGame->AddFunc(0xce4374f6, cellGamePatchCheck); cellGame.AddFunc(0xce4374f6, cellGamePatchCheck);
cellGame->AddFunc(0xdb9819f3, cellGameDataCheck); cellGame.AddFunc(0xdb9819f3, cellGameDataCheck);
cellGame->AddFunc(0x70acec67, cellGameContentPermit); cellGame.AddFunc(0x70acec67, cellGameContentPermit);
cellGame->AddFunc(0x42a2e133, cellGameCreateGameData); cellGame.AddFunc(0x42a2e133, cellGameCreateGameData);
cellGame->AddFunc(0xb367c6e3, cellGameDeleteGameData); cellGame.AddFunc(0xb367c6e3, cellGameDeleteGameData);
cellGame->AddFunc(0xb7a45caf, cellGameGetParamInt); cellGame.AddFunc(0xb7a45caf, cellGameGetParamInt);
//cellGame->AddFunc(, cellGameSetParamInt); //cellGame.AddFunc(, cellGameSetParamInt);
cellGame->AddFunc(0x3a5d726a, cellGameGetParamString); cellGame.AddFunc(0x3a5d726a, cellGameGetParamString);
cellGame->AddFunc(0xdaa5cd20, cellGameSetParamString); cellGame.AddFunc(0xdaa5cd20, cellGameSetParamString);
cellGame->AddFunc(0xef9d42d5, cellGameGetSizeKB); cellGame.AddFunc(0xef9d42d5, cellGameGetSizeKB);
cellGame->AddFunc(0x2a8e6b92, cellGameGetDiscContentInfoUpdatePath); cellGame.AddFunc(0x2a8e6b92, cellGameGetDiscContentInfoUpdatePath);
cellGame->AddFunc(0xa80bf223, cellGameGetLocalWebContentPath); cellGame.AddFunc(0xa80bf223, cellGameGetLocalWebContentPath);
cellGame->AddFunc(0xb0a1f8c6, cellGameContentErrorDialog); cellGame.AddFunc(0xb0a1f8c6, cellGameContentErrorDialog);
cellGame->AddFunc(0xd24e3928, cellGameThemeInstall); cellGame.AddFunc(0xd24e3928, cellGameThemeInstall);
cellGame->AddFunc(0x87406734, cellGameThemeInstallFromBuffer); cellGame.AddFunc(0x87406734, cellGameThemeInstallFromBuffer);
//cellGame->AddFunc(, CellGameThemeInstallCallback); //cellGame.AddFunc(, CellGameThemeInstallCallback);
} });

View file

@ -10,7 +10,7 @@
//#include "Emu/SysCalls/lv2/sys_process.h" //#include "Emu/SysCalls/lv2/sys_process.h"
#include "cellGcmSys.h" #include "cellGcmSys.h"
Module *cellGcmSys = nullptr; extern Module cellGcmSys;
const u32 tiled_pitches[] = { const u32 tiled_pitches[] = {
0x00000000, 0x00000200, 0x00000300, 0x00000400, 0x00000000, 0x00000200, 0x00000300, 0x00000400,
@ -75,17 +75,17 @@ void InitOffsetTable()
u32 cellGcmGetLabelAddress(u8 index) u32 cellGcmGetLabelAddress(u8 index)
{ {
cellGcmSys->Log("cellGcmGetLabelAddress(index=%d)", index); cellGcmSys.Log("cellGcmGetLabelAddress(index=%d)", index);
return gcm_info.label_addr + 0x10 * index; return gcm_info.label_addr + 0x10 * index;
} }
vm::ptr<CellGcmReportData> cellGcmGetReportDataAddressLocation(u32 index, u32 location) vm::ptr<CellGcmReportData> cellGcmGetReportDataAddressLocation(u32 index, u32 location)
{ {
cellGcmSys->Warning("cellGcmGetReportDataAddressLocation(index=%d, location=%d)", index, location); cellGcmSys.Warning("cellGcmGetReportDataAddressLocation(index=%d, location=%d)", index, location);
if (location == CELL_GCM_LOCATION_LOCAL) { if (location == CELL_GCM_LOCATION_LOCAL) {
if (index >= 2048) { if (index >= 2048) {
cellGcmSys->Error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index); cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index);
return vm::ptr<CellGcmReportData>::make(0); return vm::ptr<CellGcmReportData>::make(0);
} }
return vm::ptr<CellGcmReportData>::make((u32)Memory.RSXFBMem.GetStartAddr() + index * 0x10); return vm::ptr<CellGcmReportData>::make((u32)Memory.RSXFBMem.GetStartAddr() + index * 0x10);
@ -93,23 +93,23 @@ vm::ptr<CellGcmReportData> cellGcmGetReportDataAddressLocation(u32 index, u32 lo
if (location == CELL_GCM_LOCATION_MAIN) { if (location == CELL_GCM_LOCATION_MAIN) {
if (index >= 1024 * 1024) { if (index >= 1024 * 1024) {
cellGcmSys->Error("cellGcmGetReportDataAddressLocation: Wrong main index (%d)", index); cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong main index (%d)", index);
return vm::ptr<CellGcmReportData>::make(0); return vm::ptr<CellGcmReportData>::make(0);
} }
// TODO: It seems m_report_main_addr is not initialized // TODO: It seems m_report_main_addr is not initialized
return vm::ptr<CellGcmReportData>::make(Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10); return vm::ptr<CellGcmReportData>::make(Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10);
} }
cellGcmSys->Error("cellGcmGetReportDataAddressLocation: Wrong location (%d)", location); cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong location (%d)", location);
return vm::ptr<CellGcmReportData>::make(0); return vm::ptr<CellGcmReportData>::make(0);
} }
u64 cellGcmGetTimeStamp(u32 index) u64 cellGcmGetTimeStamp(u32 index)
{ {
cellGcmSys->Log("cellGcmGetTimeStamp(index=%d)", index); cellGcmSys.Log("cellGcmGetTimeStamp(index=%d)", index);
if (index >= 2048) { if (index >= 2048) {
cellGcmSys->Error("cellGcmGetTimeStamp: Wrong local index (%d)", index); cellGcmSys.Error("cellGcmGetTimeStamp: Wrong local index (%d)", index);
return 0; return 0;
} }
return vm::read64(Memory.RSXFBMem.GetStartAddr() + index * 0x10); return vm::read64(Memory.RSXFBMem.GetStartAddr() + index * 0x10);
@ -123,7 +123,7 @@ s32 cellGcmGetCurrentField()
u32 cellGcmGetNotifyDataAddress(u32 index) u32 cellGcmGetNotifyDataAddress(u32 index)
{ {
cellGcmSys->Warning("cellGcmGetNotifyDataAddress(index=%d)", index); cellGcmSys.Warning("cellGcmGetNotifyDataAddress(index=%d)", index);
// If entry not in use, return NULL // If entry not in use, return NULL
u16 entry = offsetTable.eaAddress[241]; u16 entry = offsetTable.eaAddress[241];
@ -144,10 +144,10 @@ vm::ptr<CellGcmReportData> _cellGcmFunc12()
u32 cellGcmGetReport(u32 type, u32 index) u32 cellGcmGetReport(u32 type, u32 index)
{ {
cellGcmSys->Warning("cellGcmGetReport(type=%d, index=%d)", type, index); cellGcmSys.Warning("cellGcmGetReport(type=%d, index=%d)", type, index);
if (index >= 2048) { if (index >= 2048) {
cellGcmSys->Error("cellGcmGetReport: Wrong local index (%d)", index); cellGcmSys.Error("cellGcmGetReport: Wrong local index (%d)", index);
return -1; return -1;
} }
@ -161,10 +161,10 @@ u32 cellGcmGetReport(u32 type, u32 index)
u32 cellGcmGetReportDataAddress(u32 index) u32 cellGcmGetReportDataAddress(u32 index)
{ {
cellGcmSys->Warning("cellGcmGetReportDataAddress(index=%d)", index); cellGcmSys.Warning("cellGcmGetReportDataAddress(index=%d)", index);
if (index >= 2048) { if (index >= 2048) {
cellGcmSys->Error("cellGcmGetReportDataAddress: Wrong local index (%d)", index); cellGcmSys.Error("cellGcmGetReportDataAddress: Wrong local index (%d)", index);
return 0; return 0;
} }
return (u32)Memory.RSXFBMem.GetStartAddr() + index * 0x10; return (u32)Memory.RSXFBMem.GetStartAddr() + index * 0x10;
@ -172,7 +172,7 @@ u32 cellGcmGetReportDataAddress(u32 index)
u32 cellGcmGetReportDataLocation(u32 index, u32 location) u32 cellGcmGetReportDataLocation(u32 index, u32 location)
{ {
cellGcmSys->Warning("cellGcmGetReportDataLocation(index=%d, location=%d)", index, location); cellGcmSys.Warning("cellGcmGetReportDataLocation(index=%d, location=%d)", index, location);
vm::ptr<CellGcmReportData> report = cellGcmGetReportDataAddressLocation(index, location); vm::ptr<CellGcmReportData> report = cellGcmGetReportDataAddressLocation(index, location);
return report->value; return report->value;
@ -180,11 +180,11 @@ u32 cellGcmGetReportDataLocation(u32 index, u32 location)
u64 cellGcmGetTimeStampLocation(u32 index, u32 location) u64 cellGcmGetTimeStampLocation(u32 index, u32 location)
{ {
cellGcmSys->Warning("cellGcmGetTimeStampLocation(index=%d, location=%d)", index, location); cellGcmSys.Warning("cellGcmGetTimeStampLocation(index=%d, location=%d)", index, location);
if (location == CELL_GCM_LOCATION_LOCAL) { if (location == CELL_GCM_LOCATION_LOCAL) {
if (index >= 2048) { if (index >= 2048) {
cellGcmSys->Error("cellGcmGetTimeStampLocation: Wrong local index (%d)", index); cellGcmSys.Error("cellGcmGetTimeStampLocation: Wrong local index (%d)", index);
return 0; return 0;
} }
return vm::read64(Memory.RSXFBMem.GetStartAddr() + index * 0x10); return vm::read64(Memory.RSXFBMem.GetStartAddr() + index * 0x10);
@ -192,14 +192,14 @@ u64 cellGcmGetTimeStampLocation(u32 index, u32 location)
if (location == CELL_GCM_LOCATION_MAIN) { if (location == CELL_GCM_LOCATION_MAIN) {
if (index >= 1024 * 1024) { if (index >= 1024 * 1024) {
cellGcmSys->Error("cellGcmGetTimeStampLocation: Wrong main index (%d)", index); cellGcmSys.Error("cellGcmGetTimeStampLocation: Wrong main index (%d)", index);
return 0; return 0;
} }
// TODO: It seems m_report_main_addr is not initialized // TODO: It seems m_report_main_addr is not initialized
return vm::read64(Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10); return vm::read64(Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10);
} }
cellGcmSys->Error("cellGcmGetTimeStampLocation: Wrong location (%d)", location); cellGcmSys.Error("cellGcmGetTimeStampLocation: Wrong location (%d)", location);
return 0; return 0;
} }
@ -209,32 +209,32 @@ u64 cellGcmGetTimeStampLocation(u32 index, u32 location)
u32 cellGcmGetControlRegister() u32 cellGcmGetControlRegister()
{ {
cellGcmSys->Log("cellGcmGetControlRegister()"); cellGcmSys.Log("cellGcmGetControlRegister()");
return gcm_info.control_addr; return gcm_info.control_addr;
} }
u32 cellGcmGetDefaultCommandWordSize() u32 cellGcmGetDefaultCommandWordSize()
{ {
cellGcmSys->Log("cellGcmGetDefaultCommandWordSize()"); cellGcmSys.Log("cellGcmGetDefaultCommandWordSize()");
return 0x400; return 0x400;
} }
u32 cellGcmGetDefaultSegmentWordSize() u32 cellGcmGetDefaultSegmentWordSize()
{ {
cellGcmSys->Log("cellGcmGetDefaultSegmentWordSize()"); cellGcmSys.Log("cellGcmGetDefaultSegmentWordSize()");
return 0x100; return 0x100;
} }
s32 cellGcmInitDefaultFifoMode(s32 mode) s32 cellGcmInitDefaultFifoMode(s32 mode)
{ {
cellGcmSys->Warning("cellGcmInitDefaultFifoMode(mode=%d)", mode); cellGcmSys.Warning("cellGcmInitDefaultFifoMode(mode=%d)", mode);
return CELL_OK; return CELL_OK;
} }
s32 cellGcmSetDefaultFifoSize(u32 bufferSize, u32 segmentSize) s32 cellGcmSetDefaultFifoSize(u32 bufferSize, u32 segmentSize)
{ {
cellGcmSys->Warning("cellGcmSetDefaultFifoSize(bufferSize=0x%x, segmentSize=0x%x)", bufferSize, segmentSize); cellGcmSys.Warning("cellGcmSetDefaultFifoSize(bufferSize=0x%x, segmentSize=0x%x)", bufferSize, segmentSize);
return CELL_OK; return CELL_OK;
} }
@ -244,11 +244,11 @@ s32 cellGcmSetDefaultFifoSize(u32 bufferSize, u32 segmentSize)
s32 cellGcmBindTile(u8 index) s32 cellGcmBindTile(u8 index)
{ {
cellGcmSys->Warning("cellGcmBindTile(index=%d)", index); cellGcmSys.Warning("cellGcmBindTile(index=%d)", index);
if (index >= RSXThread::m_tiles_count) if (index >= RSXThread::m_tiles_count)
{ {
cellGcmSys->Error("cellGcmBindTile : CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmBindTile : CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
} }
@ -260,11 +260,11 @@ s32 cellGcmBindTile(u8 index)
s32 cellGcmBindZcull(u8 index) s32 cellGcmBindZcull(u8 index)
{ {
cellGcmSys->Warning("cellGcmBindZcull(index=%d)", index); cellGcmSys.Warning("cellGcmBindZcull(index=%d)", index);
if (index >= RSXThread::m_zculls_count) if (index >= RSXThread::m_zculls_count)
{ {
cellGcmSys->Error("cellGcmBindZcull : CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmBindZcull : CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
} }
@ -276,7 +276,7 @@ s32 cellGcmBindZcull(u8 index)
s32 cellGcmGetConfiguration(vm::ptr<CellGcmConfig> config) s32 cellGcmGetConfiguration(vm::ptr<CellGcmConfig> config)
{ {
cellGcmSys->Log("cellGcmGetConfiguration(config_addr=0x%x)", config.addr()); cellGcmSys.Log("cellGcmGetConfiguration(config_addr=0x%x)", config.addr());
*config = current_config; *config = current_config;
@ -287,14 +287,14 @@ s32 cellGcmGetFlipStatus()
{ {
s32 status = Emu.GetGSManager().GetRender().m_flip_status; s32 status = Emu.GetGSManager().GetRender().m_flip_status;
cellGcmSys->Log("cellGcmGetFlipStatus() -> %d", status); cellGcmSys.Log("cellGcmGetFlipStatus() -> %d", status);
return status; return status;
} }
u32 cellGcmGetTiledPitchSize(u32 size) u32 cellGcmGetTiledPitchSize(u32 size)
{ {
cellGcmSys->Log("cellGcmGetTiledPitchSize(size=%d)", size); cellGcmSys.Log("cellGcmGetTiledPitchSize(size=%d)", size);
for (size_t i=0; i < sizeof(tiled_pitches) / sizeof(tiled_pitches[0]) - 1; i++) { for (size_t i=0; i < sizeof(tiled_pitches) / sizeof(tiled_pitches[0]) - 1; i++) {
if (tiled_pitches[i] < size && size <= tiled_pitches[i+1]) { if (tiled_pitches[i] < size && size <= tiled_pitches[i+1]) {
@ -306,23 +306,20 @@ u32 cellGcmGetTiledPitchSize(u32 size)
void _cellGcmFunc1() void _cellGcmFunc1()
{ {
cellGcmSys->Todo("_cellGcmFunc1()"); cellGcmSys.Todo("_cellGcmFunc1()");
return; return;
} }
void _cellGcmFunc15(vm::ptr<CellGcmContextData> context) void _cellGcmFunc15(vm::ptr<CellGcmContextData> context)
{ {
cellGcmSys->Todo("_cellGcmFunc15(context_addr=0x%x)", context.addr()); cellGcmSys.Todo("_cellGcmFunc15(context_addr=0x%x)", context.addr());
return; return;
} }
// Called by cellGcmInit // Called by cellGcmInit
s32 _cellGcmInitBody(vm::ptr<CellGcmContextData> context, u32 cmdSize, u32 ioSize, u32 ioAddress) s32 _cellGcmInitBody(vm::ptr<CellGcmContextData> context, u32 cmdSize, u32 ioSize, u32 ioAddress)
{ {
cellGcmSys->Warning("_cellGcmInitBody(context_addr=0x%x, cmdSize=0x%x, ioSize=0x%x, ioAddress=0x%x)", context.addr(), cmdSize, ioSize, ioAddress); cellGcmSys.Warning("_cellGcmInitBody(context_addr=0x%x, cmdSize=0x%x, ioSize=0x%x, ioAddress=0x%x)", context.addr(), cmdSize, ioSize, ioAddress);
if(!cellGcmSys->IsLoaded())
cellGcmSys->Load();
if(!local_size && !local_addr) if(!local_size && !local_addr)
{ {
@ -331,23 +328,23 @@ s32 _cellGcmInitBody(vm::ptr<CellGcmContextData> context, u32 cmdSize, u32 ioSiz
Memory.RSXFBMem.AllocAlign(local_size); Memory.RSXFBMem.AllocAlign(local_size);
} }
cellGcmSys->Warning("*** local memory(addr=0x%x, size=0x%x)", local_addr, local_size); cellGcmSys.Warning("*** local memory(addr=0x%x, size=0x%x)", local_addr, local_size);
InitOffsetTable(); InitOffsetTable();
if (system_mode == CELL_GCM_SYSTEM_MODE_IOMAP_512MB) if (system_mode == CELL_GCM_SYSTEM_MODE_IOMAP_512MB)
{ {
cellGcmSys->Warning("cellGcmInit(): 512MB io address space used"); cellGcmSys.Warning("cellGcmInit(): 512MB io address space used");
Memory.RSXIOMem.SetRange(0, 0x20000000 /*512MB*/); Memory.RSXIOMem.SetRange(0, 0x20000000 /*512MB*/);
} }
else else
{ {
cellGcmSys->Warning("cellGcmInit(): 256MB io address space used"); cellGcmSys.Warning("cellGcmInit(): 256MB io address space used");
Memory.RSXIOMem.SetRange(0, 0x10000000 /*256MB*/); Memory.RSXIOMem.SetRange(0, 0x10000000 /*256MB*/);
} }
if (gcmMapEaIoAddress(ioAddress, 0, ioSize, false) != CELL_OK) if (gcmMapEaIoAddress(ioAddress, 0, ioSize, false) != CELL_OK)
{ {
cellGcmSys->Error("cellGcmInit : CELL_GCM_ERROR_FAILURE"); cellGcmSys.Error("cellGcmInit : CELL_GCM_ERROR_FAILURE");
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
@ -396,7 +393,7 @@ s32 _cellGcmInitBody(vm::ptr<CellGcmContextData> context, u32 cmdSize, u32 ioSiz
s32 cellGcmResetFlipStatus() s32 cellGcmResetFlipStatus()
{ {
cellGcmSys->Log("cellGcmResetFlipStatus()"); cellGcmSys.Log("cellGcmResetFlipStatus()");
Emu.GetGSManager().GetRender().m_flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_WAITING; Emu.GetGSManager().GetRender().m_flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_WAITING;
@ -405,7 +402,7 @@ s32 cellGcmResetFlipStatus()
s32 cellGcmSetDebugOutputLevel(s32 level) s32 cellGcmSetDebugOutputLevel(s32 level)
{ {
cellGcmSys->Warning("cellGcmSetDebugOutputLevel(level=%d)", level); cellGcmSys.Warning("cellGcmSetDebugOutputLevel(level=%d)", level);
switch (level) switch (level)
{ {
@ -423,10 +420,10 @@ s32 cellGcmSetDebugOutputLevel(s32 level)
s32 cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height) s32 cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height)
{ {
cellGcmSys->Log("cellGcmSetDisplayBuffer(id=0x%x,offset=0x%x,pitch=%d,width=%d,height=%d)", id, offset, width ? pitch / width : pitch, width, height); cellGcmSys.Log("cellGcmSetDisplayBuffer(id=0x%x,offset=0x%x,pitch=%d,width=%d,height=%d)", id, offset, width ? pitch / width : pitch, width, height);
if (id > 7) { if (id > 7) {
cellGcmSys->Error("cellGcmSetDisplayBuffer : CELL_EINVAL"); cellGcmSys.Error("cellGcmSetDisplayBuffer : CELL_EINVAL");
return CELL_EINVAL; return CELL_EINVAL;
} }
@ -446,14 +443,14 @@ s32 cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height
void cellGcmSetFlipHandler(vm::ptr<void(u32)> handler) void cellGcmSetFlipHandler(vm::ptr<void(u32)> handler)
{ {
cellGcmSys->Warning("cellGcmSetFlipHandler(handler_addr=%d)", handler.addr()); cellGcmSys.Warning("cellGcmSetFlipHandler(handler_addr=%d)", handler.addr());
Emu.GetGSManager().GetRender().m_flip_handler = handler; Emu.GetGSManager().GetRender().m_flip_handler = handler;
} }
s32 cellGcmSetFlipMode(u32 mode) s32 cellGcmSetFlipMode(u32 mode)
{ {
cellGcmSys->Warning("cellGcmSetFlipMode(mode=%d)", mode); cellGcmSys.Warning("cellGcmSetFlipMode(mode=%d)", mode);
switch (mode) switch (mode)
{ {
@ -472,18 +469,18 @@ s32 cellGcmSetFlipMode(u32 mode)
void cellGcmSetFlipStatus() void cellGcmSetFlipStatus()
{ {
cellGcmSys->Warning("cellGcmSetFlipStatus()"); cellGcmSys.Warning("cellGcmSetFlipStatus()");
Emu.GetGSManager().GetRender().m_flip_status = 0; Emu.GetGSManager().GetRender().m_flip_status = 0;
} }
s32 cellGcmSetPrepareFlip(vm::ptr<CellGcmContextData> ctxt, u32 id) s32 cellGcmSetPrepareFlip(vm::ptr<CellGcmContextData> ctxt, u32 id)
{ {
cellGcmSys->Log("cellGcmSetPrepareFlip(ctx=0x%x, id=0x%x)", ctxt.addr(), id); cellGcmSys.Log("cellGcmSetPrepareFlip(ctx=0x%x, id=0x%x)", ctxt.addr(), id);
if(id > 7) if(id > 7)
{ {
cellGcmSys->Error("cellGcmSetPrepareFlip : CELL_GCM_ERROR_FAILURE"); cellGcmSys.Error("cellGcmSetPrepareFlip : CELL_GCM_ERROR_FAILURE");
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
@ -493,16 +490,16 @@ s32 cellGcmSetPrepareFlip(vm::ptr<CellGcmContextData> ctxt, u32 id)
if (current + 8 == ctxt->begin) if (current + 8 == ctxt->begin)
{ {
cellGcmSys->Error("cellGcmSetPrepareFlip : queue is full"); cellGcmSys.Error("cellGcmSetPrepareFlip : queue is full");
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
if (current + 8 >= ctxt->end) if (current + 8 >= ctxt->end)
{ {
cellGcmSys->Error("Bad flip!"); cellGcmSys.Error("Bad flip!");
if (s32 res = ctxt->callback(ctxt, 8 /* ??? */)) if (s32 res = ctxt->callback(ctxt, 8 /* ??? */))
{ {
cellGcmSys->Error("cellGcmSetPrepareFlip : callback failed (0x%08x)", res); cellGcmSys.Error("cellGcmSetPrepareFlip : callback failed (0x%08x)", res);
return res; return res;
} }
} }
@ -526,7 +523,7 @@ s32 cellGcmSetPrepareFlip(vm::ptr<CellGcmContextData> ctxt, u32 id)
s32 cellGcmSetFlip(vm::ptr<CellGcmContextData> ctxt, u32 id) s32 cellGcmSetFlip(vm::ptr<CellGcmContextData> ctxt, u32 id)
{ {
cellGcmSys->Log("cellGcmSetFlip(ctx=0x%x, id=0x%x)", ctxt.addr(), id); cellGcmSys.Log("cellGcmSetFlip(ctx=0x%x, id=0x%x)", ctxt.addr(), id);
s32 res = cellGcmSetPrepareFlip(ctxt, id); s32 res = cellGcmSetPrepareFlip(ctxt, id);
return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK; return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK;
@ -534,17 +531,17 @@ s32 cellGcmSetFlip(vm::ptr<CellGcmContextData> ctxt, u32 id)
s32 cellGcmSetSecondVFrequency(u32 freq) s32 cellGcmSetSecondVFrequency(u32 freq)
{ {
cellGcmSys->Warning("cellGcmSetSecondVFrequency(level=%d)", freq); cellGcmSys.Warning("cellGcmSetSecondVFrequency(level=%d)", freq);
switch (freq) switch (freq)
{ {
case CELL_GCM_DISPLAY_FREQUENCY_59_94HZ: case CELL_GCM_DISPLAY_FREQUENCY_59_94HZ:
Emu.GetGSManager().GetRender().m_frequency_mode = freq; Emu.GetGSManager().GetRender().m_fps_limit = 59.94; break; Emu.GetGSManager().GetRender().m_frequency_mode = freq; Emu.GetGSManager().GetRender().m_fps_limit = 59.94; break;
case CELL_GCM_DISPLAY_FREQUENCY_SCANOUT: case CELL_GCM_DISPLAY_FREQUENCY_SCANOUT:
Emu.GetGSManager().GetRender().m_frequency_mode = freq; cellGcmSys->Todo("Unimplemented display frequency: Scanout"); break; Emu.GetGSManager().GetRender().m_frequency_mode = freq; cellGcmSys.Todo("Unimplemented display frequency: Scanout"); break;
case CELL_GCM_DISPLAY_FREQUENCY_DISABLE: case CELL_GCM_DISPLAY_FREQUENCY_DISABLE:
Emu.GetGSManager().GetRender().m_frequency_mode = freq; cellGcmSys->Todo("Unimplemented display frequency: Disabled"); break; Emu.GetGSManager().GetRender().m_frequency_mode = freq; cellGcmSys.Todo("Unimplemented display frequency: Disabled"); break;
default: cellGcmSys->Error("Improper display frequency specified!"); return CELL_OK; default: cellGcmSys.Error("Improper display frequency specified!"); return CELL_OK;
} }
return CELL_OK; return CELL_OK;
@ -552,30 +549,30 @@ s32 cellGcmSetSecondVFrequency(u32 freq)
s32 cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 comp, u16 base, u8 bank) s32 cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 comp, u16 base, u8 bank)
{ {
cellGcmSys->Warning("cellGcmSetTileInfo(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)", cellGcmSys.Warning("cellGcmSetTileInfo(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)",
index, location, offset, size, pitch, comp, base, bank); index, location, offset, size, pitch, comp, base, bank);
if (index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4) if (index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4)
{ {
cellGcmSys->Error("cellGcmSetTileInfo : CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmSetTileInfo : CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
} }
if (offset & 0xffff || size & 0xffff || pitch & 0xf) if (offset & 0xffff || size & 0xffff || pitch & 0xf)
{ {
cellGcmSys->Error("cellGcmSetTileInfo : CELL_GCM_ERROR_INVALID_ALIGNMENT"); cellGcmSys.Error("cellGcmSetTileInfo : CELL_GCM_ERROR_INVALID_ALIGNMENT");
return CELL_GCM_ERROR_INVALID_ALIGNMENT; return CELL_GCM_ERROR_INVALID_ALIGNMENT;
} }
if (location >= 2 || (comp != 0 && (comp < 7 || comp > 12))) if (location >= 2 || (comp != 0 && (comp < 7 || comp > 12)))
{ {
cellGcmSys->Error("cellGcmSetTileInfo : CELL_GCM_ERROR_INVALID_ALIGNMENT"); cellGcmSys.Error("cellGcmSetTileInfo : CELL_GCM_ERROR_INVALID_ALIGNMENT");
return CELL_GCM_ERROR_INVALID_ENUM; return CELL_GCM_ERROR_INVALID_ENUM;
} }
if (comp) if (comp)
{ {
cellGcmSys->Error("cellGcmSetTileInfo: bad compression mode! (%d)", comp); cellGcmSys.Error("cellGcmSetTileInfo: bad compression mode! (%d)", comp);
} }
auto& tile = Emu.GetGSManager().GetRender().m_tiles[index]; auto& tile = Emu.GetGSManager().GetRender().m_tiles[index];
@ -593,21 +590,21 @@ s32 cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u
void cellGcmSetUserHandler(vm::ptr<void(u32)> handler) void cellGcmSetUserHandler(vm::ptr<void(u32)> handler)
{ {
cellGcmSys->Warning("cellGcmSetUserHandler(handler_addr=0x%x)", handler.addr()); cellGcmSys.Warning("cellGcmSetUserHandler(handler_addr=0x%x)", handler.addr());
Emu.GetGSManager().GetRender().m_user_handler = handler; Emu.GetGSManager().GetRender().m_user_handler = handler;
} }
void cellGcmSetVBlankHandler(vm::ptr<void(u32)> handler) void cellGcmSetVBlankHandler(vm::ptr<void(u32)> handler)
{ {
cellGcmSys->Warning("cellGcmSetVBlankHandler(handler_addr=0x%x)", handler.addr()); cellGcmSys.Warning("cellGcmSetVBlankHandler(handler_addr=0x%x)", handler.addr());
Emu.GetGSManager().GetRender().m_vblank_handler = handler; Emu.GetGSManager().GetRender().m_vblank_handler = handler;
} }
s32 cellGcmSetWaitFlip(vm::ptr<CellGcmContextData> ctxt) s32 cellGcmSetWaitFlip(vm::ptr<CellGcmContextData> ctxt)
{ {
cellGcmSys->Log("cellGcmSetWaitFlip(ctx=0x%x)", ctxt.addr()); cellGcmSys.Log("cellGcmSetWaitFlip(ctx=0x%x)", ctxt.addr());
GSLockCurrent lock(GS_LOCK_WAIT_FLIP); GSLockCurrent lock(GS_LOCK_WAIT_FLIP);
return CELL_OK; return CELL_OK;
@ -615,12 +612,12 @@ s32 cellGcmSetWaitFlip(vm::ptr<CellGcmContextData> ctxt)
s32 cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, u32 zFormat, u32 aaFormat, u32 zCullDir, u32 zCullFormat, u32 sFunc, u32 sRef, u32 sMask) s32 cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, u32 zFormat, u32 aaFormat, u32 zCullDir, u32 zCullFormat, u32 sFunc, u32 sRef, u32 sMask)
{ {
cellGcmSys->Todo("cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)", cellGcmSys.Todo("cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)",
index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask); index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask);
if (index >= RSXThread::m_zculls_count) if (index >= RSXThread::m_zculls_count)
{ {
cellGcmSys->Error("cellGcmSetZcull : CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmSetZcull : CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
} }
@ -643,11 +640,11 @@ s32 cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart,
s32 cellGcmUnbindTile(u8 index) s32 cellGcmUnbindTile(u8 index)
{ {
cellGcmSys->Warning("cellGcmUnbindTile(index=%d)", index); cellGcmSys.Warning("cellGcmUnbindTile(index=%d)", index);
if (index >= RSXThread::m_tiles_count) if (index >= RSXThread::m_tiles_count)
{ {
cellGcmSys->Error("cellGcmUnbindTile : CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmUnbindTile : CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
} }
@ -659,11 +656,11 @@ s32 cellGcmUnbindTile(u8 index)
s32 cellGcmUnbindZcull(u8 index) s32 cellGcmUnbindZcull(u8 index)
{ {
cellGcmSys->Warning("cellGcmUnbindZcull(index=%d)", index); cellGcmSys.Warning("cellGcmUnbindZcull(index=%d)", index);
if (index >= 8) if (index >= 8)
{ {
cellGcmSys->Error("cellGcmUnbindZcull : CELL_EINVAL"); cellGcmSys.Error("cellGcmUnbindZcull : CELL_EINVAL");
return CELL_EINVAL; return CELL_EINVAL;
} }
@ -675,25 +672,25 @@ s32 cellGcmUnbindZcull(u8 index)
u32 cellGcmGetTileInfo() u32 cellGcmGetTileInfo()
{ {
cellGcmSys->Warning("cellGcmGetTileInfo()"); cellGcmSys.Warning("cellGcmGetTileInfo()");
return Emu.GetGSManager().GetRender().m_tiles_addr; return Emu.GetGSManager().GetRender().m_tiles_addr;
} }
u32 cellGcmGetZcullInfo() u32 cellGcmGetZcullInfo()
{ {
cellGcmSys->Warning("cellGcmGetZcullInfo()"); cellGcmSys.Warning("cellGcmGetZcullInfo()");
return Emu.GetGSManager().GetRender().m_zculls_addr; return Emu.GetGSManager().GetRender().m_zculls_addr;
} }
u32 cellGcmGetDisplayInfo() u32 cellGcmGetDisplayInfo()
{ {
cellGcmSys->Warning("cellGcmGetDisplayInfo() = 0x%x", Emu.GetGSManager().GetRender().m_gcm_buffers_addr); cellGcmSys.Warning("cellGcmGetDisplayInfo() = 0x%x", Emu.GetGSManager().GetRender().m_gcm_buffers_addr);
return Emu.GetGSManager().GetRender().m_gcm_buffers_addr; return Emu.GetGSManager().GetRender().m_gcm_buffers_addr;
} }
s32 cellGcmGetCurrentDisplayBufferId(u32 id_addr) s32 cellGcmGetCurrentDisplayBufferId(u32 id_addr)
{ {
cellGcmSys->Warning("cellGcmGetCurrentDisplayBufferId(id_addr=0x%x)", id_addr); cellGcmSys.Warning("cellGcmGetCurrentDisplayBufferId(id_addr=0x%x)", id_addr);
vm::write32(id_addr, Emu.GetGSManager().GetRender().m_gcm_current_buffer); vm::write32(id_addr, Emu.GetGSManager().GetRender().m_gcm_current_buffer);
@ -720,7 +717,7 @@ s32 cellGcmGetDisplayBufferByFlipIndex()
u64 cellGcmGetLastFlipTime() u64 cellGcmGetLastFlipTime()
{ {
cellGcmSys->Log("cellGcmGetLastFlipTime()"); cellGcmSys.Log("cellGcmGetLastFlipTime()");
return Emu.GetGSManager().GetRender().m_last_flip_time; return Emu.GetGSManager().GetRender().m_last_flip_time;
} }
@ -733,14 +730,14 @@ s32 cellGcmGetLastSecondVTime()
u64 cellGcmGetVBlankCount() u64 cellGcmGetVBlankCount()
{ {
cellGcmSys->Log("cellGcmGetVBlankCount()"); cellGcmSys.Log("cellGcmGetVBlankCount()");
return Emu.GetGSManager().GetRender().m_vblank_count; return Emu.GetGSManager().GetRender().m_vblank_count;
} }
s32 cellGcmInitSystemMode(u64 mode) s32 cellGcmInitSystemMode(u64 mode)
{ {
cellGcmSys->Log("cellGcmInitSystemMode(mode=0x%x)", mode); cellGcmSys.Log("cellGcmInitSystemMode(mode=0x%x)", mode);
system_mode = mode; system_mode = mode;
@ -749,11 +746,11 @@ s32 cellGcmInitSystemMode(u64 mode)
s32 cellGcmSetFlipImmediate(u8 id) s32 cellGcmSetFlipImmediate(u8 id)
{ {
cellGcmSys->Todo("cellGcmSetFlipImmediate(fid=0x%x)", id); cellGcmSys.Todo("cellGcmSetFlipImmediate(fid=0x%x)", id);
if (id > 7) if (id > 7)
{ {
cellGcmSys->Error("cellGcmSetFlipImmediate : CELL_GCM_ERROR_FAILURE"); cellGcmSys.Error("cellGcmSetFlipImmediate : CELL_GCM_ERROR_FAILURE");
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
@ -797,7 +794,7 @@ s32 cellGcmSortRemapEaIoAddress()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
s32 cellGcmAddressToOffset(u32 address, vm::ptr<be_t<u32>> offset) s32 cellGcmAddressToOffset(u32 address, vm::ptr<be_t<u32>> offset)
{ {
cellGcmSys->Log("cellGcmAddressToOffset(address=0x%x,offset_addr=0x%x)", address, offset.addr()); cellGcmSys.Log("cellGcmAddressToOffset(address=0x%x,offset_addr=0x%x)", address, offset.addr());
// Address not on main memory or local memory // Address not on main memory or local memory
if (address >= 0xD0000000) if (address >= 0xD0000000)
@ -834,14 +831,14 @@ s32 cellGcmAddressToOffset(u32 address, vm::ptr<be_t<u32>> offset)
u32 cellGcmGetMaxIoMapSize() u32 cellGcmGetMaxIoMapSize()
{ {
cellGcmSys->Log("cellGcmGetMaxIoMapSize()"); cellGcmSys.Log("cellGcmGetMaxIoMapSize()");
return (u32)(Memory.RSXIOMem.GetEndAddr() - Memory.RSXIOMem.GetReservedAmount()); return (u32)(Memory.RSXIOMem.GetEndAddr() - Memory.RSXIOMem.GetReservedAmount());
} }
void cellGcmGetOffsetTable(vm::ptr<CellGcmOffsetTable> table) void cellGcmGetOffsetTable(vm::ptr<CellGcmOffsetTable> table)
{ {
cellGcmSys->Log("cellGcmGetOffsetTable(table_addr=0x%x)", table.addr()); cellGcmSys.Log("cellGcmGetOffsetTable(table_addr=0x%x)", table.addr());
table->ioAddress = offsetTable.ioAddress; table->ioAddress = offsetTable.ioAddress;
table->eaAddress = offsetTable.eaAddress; table->eaAddress = offsetTable.eaAddress;
@ -849,7 +846,7 @@ void cellGcmGetOffsetTable(vm::ptr<CellGcmOffsetTable> table)
s32 cellGcmIoOffsetToAddress(u32 ioOffset, vm::ptr<u32> address) s32 cellGcmIoOffsetToAddress(u32 ioOffset, vm::ptr<u32> address)
{ {
cellGcmSys->Log("cellGcmIoOffsetToAddress(ioOffset=0x%x, address=0x%x)", ioOffset, address); cellGcmSys.Log("cellGcmIoOffsetToAddress(ioOffset=0x%x, address=0x%x)", ioOffset, address);
u32 realAddr; u32 realAddr;
@ -878,7 +875,7 @@ s32 gcmMapEaIoAddress(u32 ea, u32 io, u32 size, bool is_strict)
} }
else else
{ {
cellGcmSys->Error("cellGcmMapEaIoAddress : CELL_GCM_ERROR_FAILURE"); cellGcmSys.Error("cellGcmMapEaIoAddress : CELL_GCM_ERROR_FAILURE");
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
@ -887,14 +884,14 @@ s32 gcmMapEaIoAddress(u32 ea, u32 io, u32 size, bool is_strict)
s32 cellGcmMapEaIoAddress(u32 ea, u32 io, u32 size) s32 cellGcmMapEaIoAddress(u32 ea, u32 io, u32 size)
{ {
cellGcmSys->Warning("cellGcmMapEaIoAddress(ea=0x%x, io=0x%x, size=0x%x)", ea, io, size); cellGcmSys.Warning("cellGcmMapEaIoAddress(ea=0x%x, io=0x%x, size=0x%x)", ea, io, size);
return gcmMapEaIoAddress(ea, io, size, false); return gcmMapEaIoAddress(ea, io, size, false);
} }
s32 cellGcmMapEaIoAddressWithFlags(u32 ea, u32 io, u32 size, u32 flags) s32 cellGcmMapEaIoAddressWithFlags(u32 ea, u32 io, u32 size, u32 flags)
{ {
cellGcmSys->Warning("cellGcmMapEaIoAddressWithFlags(ea=0x%x, io=0x%x, size=0x%x, flags=0x%x)", ea, io, size, flags); cellGcmSys.Warning("cellGcmMapEaIoAddressWithFlags(ea=0x%x, io=0x%x, size=0x%x, flags=0x%x)", ea, io, size, flags);
assert(flags == 2 /*CELL_GCM_IOMAP_FLAG_STRICT_ORDERING*/); assert(flags == 2 /*CELL_GCM_IOMAP_FLAG_STRICT_ORDERING*/);
@ -903,7 +900,7 @@ s32 cellGcmMapEaIoAddressWithFlags(u32 ea, u32 io, u32 size, u32 flags)
s32 cellGcmMapLocalMemory(vm::ptr<u32> address, vm::ptr<u32> size) s32 cellGcmMapLocalMemory(vm::ptr<u32> address, vm::ptr<u32> size)
{ {
cellGcmSys->Warning("cellGcmMapLocalMemory(address=*0x%x, size=*0x%x)", address, size); cellGcmSys.Warning("cellGcmMapLocalMemory(address=*0x%x, size=*0x%x)", address, size);
if (!local_addr && !local_size && Memory.RSXFBMem.AllocFixed(local_addr = Memory.RSXFBMem.GetStartAddr(), local_size = 0xf900000 /* TODO */)) if (!local_addr && !local_size && Memory.RSXFBMem.AllocFixed(local_addr = Memory.RSXFBMem.GetStartAddr(), local_size = 0xf900000 /* TODO */))
{ {
@ -912,7 +909,7 @@ s32 cellGcmMapLocalMemory(vm::ptr<u32> address, vm::ptr<u32> size)
} }
else else
{ {
cellGcmSys->Error("RSX local memory already mapped"); cellGcmSys.Error("RSX local memory already mapped");
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
@ -921,7 +918,7 @@ s32 cellGcmMapLocalMemory(vm::ptr<u32> address, vm::ptr<u32> size)
s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr<u32> offset) s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr<u32> offset)
{ {
cellGcmSys->Warning("cellGcmMapMainMemory(ea=0x%x,size=0x%x,offset_addr=0x%x)", ea, size, offset.addr()); cellGcmSys.Warning("cellGcmMapMainMemory(ea=0x%x,size=0x%x,offset_addr=0x%x)", ea, size, offset.addr());
if ((ea & 0xFFFFF) || (size & 0xFFFFF)) return CELL_GCM_ERROR_FAILURE; if ((ea & 0xFFFFF) || (size & 0xFFFFF)) return CELL_GCM_ERROR_FAILURE;
@ -942,7 +939,7 @@ s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr<u32> offset)
} }
else else
{ {
cellGcmSys->Error("cellGcmMapMainMemory : CELL_GCM_ERROR_NO_IO_PAGE_TABLE"); cellGcmSys.Error("cellGcmMapMainMemory : CELL_GCM_ERROR_NO_IO_PAGE_TABLE");
return CELL_GCM_ERROR_NO_IO_PAGE_TABLE; return CELL_GCM_ERROR_NO_IO_PAGE_TABLE;
} }
@ -953,17 +950,17 @@ s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr<u32> offset)
s32 cellGcmReserveIoMapSize(u32 size) s32 cellGcmReserveIoMapSize(u32 size)
{ {
cellGcmSys->Log("cellGcmReserveIoMapSize(size=0x%x)", size); cellGcmSys.Log("cellGcmReserveIoMapSize(size=0x%x)", size);
if (size & 0xFFFFF) if (size & 0xFFFFF)
{ {
cellGcmSys->Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_ALIGNMENT"); cellGcmSys.Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_ALIGNMENT");
return CELL_GCM_ERROR_INVALID_ALIGNMENT; return CELL_GCM_ERROR_INVALID_ALIGNMENT;
} }
if (size > cellGcmGetMaxIoMapSize()) if (size > cellGcmGetMaxIoMapSize())
{ {
cellGcmSys->Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
} }
@ -973,7 +970,7 @@ s32 cellGcmReserveIoMapSize(u32 size)
s32 cellGcmUnmapEaIoAddress(u32 ea) s32 cellGcmUnmapEaIoAddress(u32 ea)
{ {
cellGcmSys->Log("cellGcmUnmapEaIoAddress(ea=0x%x)", ea); cellGcmSys.Log("cellGcmUnmapEaIoAddress(ea=0x%x)", ea);
u32 size; u32 size;
if (Memory.RSXIOMem.UnmapRealAddress(ea, size)) if (Memory.RSXIOMem.UnmapRealAddress(ea, size))
@ -988,7 +985,7 @@ s32 cellGcmUnmapEaIoAddress(u32 ea)
} }
else else
{ {
cellGcmSys->Error("cellGcmUnmapEaIoAddress(ea=0x%x): UnmapRealAddress() failed"); cellGcmSys.Error("cellGcmUnmapEaIoAddress(ea=0x%x): UnmapRealAddress() failed");
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
@ -997,7 +994,7 @@ s32 cellGcmUnmapEaIoAddress(u32 ea)
s32 cellGcmUnmapIoAddress(u32 io) s32 cellGcmUnmapIoAddress(u32 io)
{ {
cellGcmSys->Log("cellGcmUnmapIoAddress(io=0x%x)", io); cellGcmSys.Log("cellGcmUnmapIoAddress(io=0x%x)", io);
u32 size; u32 size;
if (Memory.RSXIOMem.UnmapAddress(io, size)) if (Memory.RSXIOMem.UnmapAddress(io, size))
@ -1012,7 +1009,7 @@ s32 cellGcmUnmapIoAddress(u32 io)
} }
else else
{ {
cellGcmSys->Error("cellGcmUnmapIoAddress(io=0x%x): UnmapAddress() failed"); cellGcmSys.Error("cellGcmUnmapIoAddress(io=0x%x): UnmapAddress() failed");
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
@ -1021,17 +1018,17 @@ s32 cellGcmUnmapIoAddress(u32 io)
s32 cellGcmUnreserveIoMapSize(u32 size) s32 cellGcmUnreserveIoMapSize(u32 size)
{ {
cellGcmSys->Log("cellGcmUnreserveIoMapSize(size=0x%x)", size); cellGcmSys.Log("cellGcmUnreserveIoMapSize(size=0x%x)", size);
if (size & 0xFFFFF) if (size & 0xFFFFF)
{ {
cellGcmSys->Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_ALIGNMENT"); cellGcmSys.Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_ALIGNMENT");
return CELL_GCM_ERROR_INVALID_ALIGNMENT; return CELL_GCM_ERROR_INVALID_ALIGNMENT;
} }
if (size > Memory.RSXIOMem.GetReservedAmount()) if (size > Memory.RSXIOMem.GetReservedAmount())
{ {
cellGcmSys->Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
} }
@ -1085,7 +1082,7 @@ s32 cellGcmSetCursorImageOffset(u32 offset)
void cellGcmSetDefaultCommandBuffer() void cellGcmSetDefaultCommandBuffer()
{ {
cellGcmSys->Warning("cellGcmSetDefaultCommandBuffer()"); cellGcmSys.Warning("cellGcmSetDefaultCommandBuffer()");
vm::write32(Emu.GetGSManager().GetRender().m_ctxt_addr, gcm_info.context_addr); vm::write32(Emu.GetGSManager().GetRender().m_ctxt_addr, gcm_info.context_addr);
} }
@ -1095,14 +1092,14 @@ void cellGcmSetDefaultCommandBuffer()
s32 cellGcmSetFlipCommand(vm::ptr<CellGcmContextData> ctx, u32 id) s32 cellGcmSetFlipCommand(vm::ptr<CellGcmContextData> ctx, u32 id)
{ {
cellGcmSys->Log("cellGcmSetFlipCommand(ctx_addr=0x%x, id=0x%x)", ctx.addr(), id); cellGcmSys.Log("cellGcmSetFlipCommand(ctx_addr=0x%x, id=0x%x)", ctx.addr(), id);
return cellGcmSetPrepareFlip(ctx, id); return cellGcmSetPrepareFlip(ctx, id);
} }
s32 cellGcmSetFlipCommandWithWaitLabel(vm::ptr<CellGcmContextData> ctx, u32 id, u32 label_index, u32 label_value) s32 cellGcmSetFlipCommandWithWaitLabel(vm::ptr<CellGcmContextData> ctx, u32 id, u32 label_index, u32 label_value)
{ {
cellGcmSys->Log("cellGcmSetFlipCommandWithWaitLabel(ctx_addr=0x%x, id=0x%x, label_index=0x%x, label_value=0x%x)", cellGcmSys.Log("cellGcmSetFlipCommandWithWaitLabel(ctx_addr=0x%x, id=0x%x, label_index=0x%x, label_value=0x%x)",
ctx.addr(), id, label_index, label_value); ctx.addr(), id, label_index, label_value);
s32 res = cellGcmSetPrepareFlip(ctx, id); s32 res = cellGcmSetPrepareFlip(ctx, id);
@ -1112,31 +1109,31 @@ s32 cellGcmSetFlipCommandWithWaitLabel(vm::ptr<CellGcmContextData> ctx, u32 id,
s32 cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 comp, u16 base, u8 bank) s32 cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 comp, u16 base, u8 bank)
{ {
cellGcmSys->Warning("cellGcmSetTile(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)", cellGcmSys.Warning("cellGcmSetTile(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)",
index, location, offset, size, pitch, comp, base, bank); index, location, offset, size, pitch, comp, base, bank);
// Copied form cellGcmSetTileInfo // Copied form cellGcmSetTileInfo
if(index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4) if(index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4)
{ {
cellGcmSys->Error("cellGcmSetTile : CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmSetTile : CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
} }
if(offset & 0xffff || size & 0xffff || pitch & 0xf) if(offset & 0xffff || size & 0xffff || pitch & 0xf)
{ {
cellGcmSys->Error("cellGcmSetTile : CELL_GCM_ERROR_INVALID_ALIGNMENT"); cellGcmSys.Error("cellGcmSetTile : CELL_GCM_ERROR_INVALID_ALIGNMENT");
return CELL_GCM_ERROR_INVALID_ALIGNMENT; return CELL_GCM_ERROR_INVALID_ALIGNMENT;
} }
if(location >= 2 || (comp != 0 && (comp < 7 || comp > 12))) if(location >= 2 || (comp != 0 && (comp < 7 || comp > 12)))
{ {
cellGcmSys->Error("cellGcmSetTile : CELL_GCM_ERROR_INVALID_ENUM"); cellGcmSys.Error("cellGcmSetTile : CELL_GCM_ERROR_INVALID_ENUM");
return CELL_GCM_ERROR_INVALID_ENUM; return CELL_GCM_ERROR_INVALID_ENUM;
} }
if(comp) if(comp)
{ {
cellGcmSys->Error("cellGcmSetTile: bad compression mode! (%d)", comp); cellGcmSys.Error("cellGcmSetTile: bad compression mode! (%d)", comp);
} }
auto& tile = Emu.GetGSManager().GetRender().m_tiles[index]; auto& tile = Emu.GetGSManager().GetRender().m_tiles[index];
@ -1159,7 +1156,7 @@ s32 cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
s32 cellGcmCallback(vm::ptr<CellGcmContextData> context, u32 count) s32 cellGcmCallback(vm::ptr<CellGcmContextData> context, u32 count)
{ {
cellGcmSys->Log("cellGcmCallback(context_addr=0x%x, count=0x%x)", context.addr(), count); cellGcmSys.Log("cellGcmCallback(context_addr=0x%x, count=0x%x)", context.addr(), count);
if (1) if (1)
{ {
@ -1213,122 +1210,113 @@ s32 cellGcmCallback(vm::ptr<CellGcmContextData> context, u32 count)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cellGcmSys_init(Module *pxThis) Module cellGcmSys("cellGcmSys", []()
{
cellGcmSys = pxThis;
// Data Retrieval
cellGcmSys->AddFunc(0xc8f3bd09, cellGcmGetCurrentField);
cellGcmSys->AddFunc(0xf80196c1, cellGcmGetLabelAddress);
cellGcmSys->AddFunc(0x21cee035, cellGcmGetNotifyDataAddress);
cellGcmSys->AddFunc(0x661fe266, _cellGcmFunc12);
cellGcmSys->AddFunc(0x99d397ac, cellGcmGetReport);
cellGcmSys->AddFunc(0x9a0159af, cellGcmGetReportDataAddress);
cellGcmSys->AddFunc(0x8572bce2, cellGcmGetReportDataAddressLocation);
cellGcmSys->AddFunc(0xa6b180ac, cellGcmGetReportDataLocation);
cellGcmSys->AddFunc(0x5a41c10f, cellGcmGetTimeStamp);
cellGcmSys->AddFunc(0x2ad4951b, cellGcmGetTimeStampLocation);
// Command Buffer Control
cellGcmSys->AddFunc(0xa547adde, cellGcmGetControlRegister);
cellGcmSys->AddFunc(0x5e2ee0f0, cellGcmGetDefaultCommandWordSize);
cellGcmSys->AddFunc(0x8cdf8c70, cellGcmGetDefaultSegmentWordSize);
cellGcmSys->AddFunc(0xcaabd992, cellGcmInitDefaultFifoMode);
cellGcmSys->AddFunc(0x9ba451e4, cellGcmSetDefaultFifoSize);
//cellGcmSys->AddFunc(, cellGcmReserveMethodSize);
//cellGcmSys->AddFunc(, cellGcmResetDefaultCommandBuffer);
//cellGcmSys->AddFunc(, cellGcmSetupContextData);
//cellGcmSys->AddFunc(, cellGcmCallbackForSnc);
//cellGcmSys->AddFunc(, cellGcmFinish);
//cellGcmSys->AddFunc(, cellGcmFlush);
// Hardware Resource Management
cellGcmSys->AddFunc(0x4524cccd, cellGcmBindTile);
cellGcmSys->AddFunc(0x9dc04436, cellGcmBindZcull);
cellGcmSys->AddFunc(0x1f61b3ff, cellGcmDumpGraphicsError);
cellGcmSys->AddFunc(0xe315a0b2, cellGcmGetConfiguration);
cellGcmSys->AddFunc(0x371674cf, cellGcmGetDisplayBufferByFlipIndex);
cellGcmSys->AddFunc(0x72a577ce, cellGcmGetFlipStatus);
cellGcmSys->AddFunc(0x63387071, cellGcmGetLastFlipTime);
cellGcmSys->AddFunc(0x23ae55a3, cellGcmGetLastSecondVTime);
cellGcmSys->AddFunc(0x055bd74d, cellGcmGetTiledPitchSize);
cellGcmSys->AddFunc(0x723bbc7e, cellGcmGetVBlankCount);
cellGcmSys->AddFunc(0x5f909b17, _cellGcmFunc1);
cellGcmSys->AddFunc(0x3a33c1fd, _cellGcmFunc15);
cellGcmSys->AddFunc(0x15bae46b, _cellGcmInitBody);
cellGcmSys->AddFunc(0xfce9e764, cellGcmInitSystemMode);
cellGcmSys->AddFunc(0xb2e761d4, cellGcmResetFlipStatus);
cellGcmSys->AddFunc(0x51c9d62b, cellGcmSetDebugOutputLevel);
cellGcmSys->AddFunc(0xa53d12ae, cellGcmSetDisplayBuffer);
cellGcmSys->AddFunc(0xdc09357e, cellGcmSetFlip);
cellGcmSys->AddFunc(0xa41ef7e8, cellGcmSetFlipHandler);
cellGcmSys->AddFunc(0xacee8542, cellGcmSetFlipImmediate);
cellGcmSys->AddFunc(0x4ae8d215, cellGcmSetFlipMode);
cellGcmSys->AddFunc(0xa47c09ff, cellGcmSetFlipStatus);
cellGcmSys->AddFunc(0xd01b570d, cellGcmSetGraphicsHandler);
cellGcmSys->AddFunc(0x0b4b62d5, cellGcmSetPrepareFlip);
cellGcmSys->AddFunc(0x0a862772, cellGcmSetQueueHandler);
cellGcmSys->AddFunc(0x4d7ce993, cellGcmSetSecondVFrequency);
cellGcmSys->AddFunc(0xdc494430, cellGcmSetSecondVHandler);
cellGcmSys->AddFunc(0xbd100dbc, cellGcmSetTileInfo);
cellGcmSys->AddFunc(0x06edea9e, cellGcmSetUserHandler);
cellGcmSys->AddFunc(0xffe0160e, cellGcmSetVBlankFrequency);
cellGcmSys->AddFunc(0xa91b0402, cellGcmSetVBlankHandler);
cellGcmSys->AddFunc(0x983fb9aa, cellGcmSetWaitFlip);
cellGcmSys->AddFunc(0xd34a420d, cellGcmSetZcull);
cellGcmSys->AddFunc(0x25b40ab4, cellGcmSortRemapEaIoAddress);
cellGcmSys->AddFunc(0xd9b7653e, cellGcmUnbindTile);
cellGcmSys->AddFunc(0xa75640e8, cellGcmUnbindZcull);
cellGcmSys->AddFunc(0x657571f7, cellGcmGetTileInfo);
cellGcmSys->AddFunc(0xd9a0a879, cellGcmGetZcullInfo);
cellGcmSys->AddFunc(0x0e6b0dae, cellGcmGetDisplayInfo);
cellGcmSys->AddFunc(0x93806525, cellGcmGetCurrentDisplayBufferId);
cellGcmSys->AddFunc(0xbd6d60d9, cellGcmSetInvalidateTile);
//cellGcmSys->AddFunc(, cellGcmSetFlipWithWaitLabel);
// Memory Mapping
cellGcmSys->AddFunc(0x21ac3697, cellGcmAddressToOffset);
cellGcmSys->AddFunc(0xfb81c03e, cellGcmGetMaxIoMapSize);
cellGcmSys->AddFunc(0x2922aed0, cellGcmGetOffsetTable);
cellGcmSys->AddFunc(0x2a6fba9c, cellGcmIoOffsetToAddress);
cellGcmSys->AddFunc(0x63441cb4, cellGcmMapEaIoAddress);
cellGcmSys->AddFunc(0x626e8518, cellGcmMapEaIoAddressWithFlags);
cellGcmSys->AddFunc(0xdb769b32, cellGcmMapLocalMemory);
cellGcmSys->AddFunc(0xa114ec67, cellGcmMapMainMemory);
cellGcmSys->AddFunc(0xa7ede268, cellGcmReserveIoMapSize);
cellGcmSys->AddFunc(0xefd00f54, cellGcmUnmapEaIoAddress);
cellGcmSys->AddFunc(0xdb23e867, cellGcmUnmapIoAddress);
cellGcmSys->AddFunc(0x3b9bd5bd, cellGcmUnreserveIoMapSize);
// Cursor
cellGcmSys->AddFunc(0x107bf3a1, cellGcmInitCursor);
cellGcmSys->AddFunc(0xc47d0812, cellGcmSetCursorEnable);
cellGcmSys->AddFunc(0x69c6cc82, cellGcmSetCursorDisable);
cellGcmSys->AddFunc(0xf9bfdc72, cellGcmSetCursorImageOffset);
cellGcmSys->AddFunc(0x1a0de550, cellGcmSetCursorPosition);
cellGcmSys->AddFunc(0xbd2fa0a7, cellGcmUpdateCursor);
// Functions for Maintaining Compatibility
cellGcmSys->AddFunc(0xbc982946, cellGcmSetDefaultCommandBuffer);
//cellGcmSys->AddFunc(, cellGcmGetCurrentBuffer);
//cellGcmSys->AddFunc(, cellGcmSetCurrentBuffer);
//cellGcmSys->AddFunc(, cellGcmSetDefaultCommandBufferAndSegmentWordSize);
//cellGcmSys->AddFunc(, cellGcmSetUserCallback);
// Other
cellGcmSys->AddFunc(0x21397818, cellGcmSetFlipCommand);
cellGcmSys->AddFunc(0xd8f88e1a, cellGcmSetFlipCommandWithWaitLabel);
cellGcmSys->AddFunc(0xd0b1d189, cellGcmSetTile);
}
void cellGcmSys_load()
{ {
current_config.ioAddress = 0; current_config.ioAddress = 0;
current_config.localAddress = 0; current_config.localAddress = 0;
local_size = 0; local_size = 0;
local_addr = 0; local_addr = 0;
}
void cellGcmSys_unload() // Data Retrieval
{ cellGcmSys.AddFunc(0xc8f3bd09, cellGcmGetCurrentField);
} cellGcmSys.AddFunc(0xf80196c1, cellGcmGetLabelAddress);
cellGcmSys.AddFunc(0x21cee035, cellGcmGetNotifyDataAddress);
cellGcmSys.AddFunc(0x661fe266, _cellGcmFunc12);
cellGcmSys.AddFunc(0x99d397ac, cellGcmGetReport);
cellGcmSys.AddFunc(0x9a0159af, cellGcmGetReportDataAddress);
cellGcmSys.AddFunc(0x8572bce2, cellGcmGetReportDataAddressLocation);
cellGcmSys.AddFunc(0xa6b180ac, cellGcmGetReportDataLocation);
cellGcmSys.AddFunc(0x5a41c10f, cellGcmGetTimeStamp);
cellGcmSys.AddFunc(0x2ad4951b, cellGcmGetTimeStampLocation);
// Command Buffer Control
cellGcmSys.AddFunc(0xa547adde, cellGcmGetControlRegister);
cellGcmSys.AddFunc(0x5e2ee0f0, cellGcmGetDefaultCommandWordSize);
cellGcmSys.AddFunc(0x8cdf8c70, cellGcmGetDefaultSegmentWordSize);
cellGcmSys.AddFunc(0xcaabd992, cellGcmInitDefaultFifoMode);
cellGcmSys.AddFunc(0x9ba451e4, cellGcmSetDefaultFifoSize);
//cellGcmSys.AddFunc(, cellGcmReserveMethodSize);
//cellGcmSys.AddFunc(, cellGcmResetDefaultCommandBuffer);
//cellGcmSys.AddFunc(, cellGcmSetupContextData);
//cellGcmSys.AddFunc(, cellGcmCallbackForSnc);
//cellGcmSys.AddFunc(, cellGcmFinish);
//cellGcmSys.AddFunc(, cellGcmFlush);
// Hardware Resource Management
cellGcmSys.AddFunc(0x4524cccd, cellGcmBindTile);
cellGcmSys.AddFunc(0x9dc04436, cellGcmBindZcull);
cellGcmSys.AddFunc(0x1f61b3ff, cellGcmDumpGraphicsError);
cellGcmSys.AddFunc(0xe315a0b2, cellGcmGetConfiguration);
cellGcmSys.AddFunc(0x371674cf, cellGcmGetDisplayBufferByFlipIndex);
cellGcmSys.AddFunc(0x72a577ce, cellGcmGetFlipStatus);
cellGcmSys.AddFunc(0x63387071, cellGcmGetLastFlipTime);
cellGcmSys.AddFunc(0x23ae55a3, cellGcmGetLastSecondVTime);
cellGcmSys.AddFunc(0x055bd74d, cellGcmGetTiledPitchSize);
cellGcmSys.AddFunc(0x723bbc7e, cellGcmGetVBlankCount);
cellGcmSys.AddFunc(0x5f909b17, _cellGcmFunc1);
cellGcmSys.AddFunc(0x3a33c1fd, _cellGcmFunc15);
cellGcmSys.AddFunc(0x15bae46b, _cellGcmInitBody);
cellGcmSys.AddFunc(0xfce9e764, cellGcmInitSystemMode);
cellGcmSys.AddFunc(0xb2e761d4, cellGcmResetFlipStatus);
cellGcmSys.AddFunc(0x51c9d62b, cellGcmSetDebugOutputLevel);
cellGcmSys.AddFunc(0xa53d12ae, cellGcmSetDisplayBuffer);
cellGcmSys.AddFunc(0xdc09357e, cellGcmSetFlip);
cellGcmSys.AddFunc(0xa41ef7e8, cellGcmSetFlipHandler);
cellGcmSys.AddFunc(0xacee8542, cellGcmSetFlipImmediate);
cellGcmSys.AddFunc(0x4ae8d215, cellGcmSetFlipMode);
cellGcmSys.AddFunc(0xa47c09ff, cellGcmSetFlipStatus);
cellGcmSys.AddFunc(0xd01b570d, cellGcmSetGraphicsHandler);
cellGcmSys.AddFunc(0x0b4b62d5, cellGcmSetPrepareFlip);
cellGcmSys.AddFunc(0x0a862772, cellGcmSetQueueHandler);
cellGcmSys.AddFunc(0x4d7ce993, cellGcmSetSecondVFrequency);
cellGcmSys.AddFunc(0xdc494430, cellGcmSetSecondVHandler);
cellGcmSys.AddFunc(0xbd100dbc, cellGcmSetTileInfo);
cellGcmSys.AddFunc(0x06edea9e, cellGcmSetUserHandler);
cellGcmSys.AddFunc(0xffe0160e, cellGcmSetVBlankFrequency);
cellGcmSys.AddFunc(0xa91b0402, cellGcmSetVBlankHandler);
cellGcmSys.AddFunc(0x983fb9aa, cellGcmSetWaitFlip);
cellGcmSys.AddFunc(0xd34a420d, cellGcmSetZcull);
cellGcmSys.AddFunc(0x25b40ab4, cellGcmSortRemapEaIoAddress);
cellGcmSys.AddFunc(0xd9b7653e, cellGcmUnbindTile);
cellGcmSys.AddFunc(0xa75640e8, cellGcmUnbindZcull);
cellGcmSys.AddFunc(0x657571f7, cellGcmGetTileInfo);
cellGcmSys.AddFunc(0xd9a0a879, cellGcmGetZcullInfo);
cellGcmSys.AddFunc(0x0e6b0dae, cellGcmGetDisplayInfo);
cellGcmSys.AddFunc(0x93806525, cellGcmGetCurrentDisplayBufferId);
cellGcmSys.AddFunc(0xbd6d60d9, cellGcmSetInvalidateTile);
//cellGcmSys.AddFunc(, cellGcmSetFlipWithWaitLabel);
// Memory Mapping
cellGcmSys.AddFunc(0x21ac3697, cellGcmAddressToOffset);
cellGcmSys.AddFunc(0xfb81c03e, cellGcmGetMaxIoMapSize);
cellGcmSys.AddFunc(0x2922aed0, cellGcmGetOffsetTable);
cellGcmSys.AddFunc(0x2a6fba9c, cellGcmIoOffsetToAddress);
cellGcmSys.AddFunc(0x63441cb4, cellGcmMapEaIoAddress);
cellGcmSys.AddFunc(0x626e8518, cellGcmMapEaIoAddressWithFlags);
cellGcmSys.AddFunc(0xdb769b32, cellGcmMapLocalMemory);
cellGcmSys.AddFunc(0xa114ec67, cellGcmMapMainMemory);
cellGcmSys.AddFunc(0xa7ede268, cellGcmReserveIoMapSize);
cellGcmSys.AddFunc(0xefd00f54, cellGcmUnmapEaIoAddress);
cellGcmSys.AddFunc(0xdb23e867, cellGcmUnmapIoAddress);
cellGcmSys.AddFunc(0x3b9bd5bd, cellGcmUnreserveIoMapSize);
// Cursor
cellGcmSys.AddFunc(0x107bf3a1, cellGcmInitCursor);
cellGcmSys.AddFunc(0xc47d0812, cellGcmSetCursorEnable);
cellGcmSys.AddFunc(0x69c6cc82, cellGcmSetCursorDisable);
cellGcmSys.AddFunc(0xf9bfdc72, cellGcmSetCursorImageOffset);
cellGcmSys.AddFunc(0x1a0de550, cellGcmSetCursorPosition);
cellGcmSys.AddFunc(0xbd2fa0a7, cellGcmUpdateCursor);
// Functions for Maintaining Compatibility
cellGcmSys.AddFunc(0xbc982946, cellGcmSetDefaultCommandBuffer);
//cellGcmSys.AddFunc(, cellGcmGetCurrentBuffer);
//cellGcmSys.AddFunc(, cellGcmSetCurrentBuffer);
//cellGcmSys.AddFunc(, cellGcmSetDefaultCommandBufferAndSegmentWordSize);
//cellGcmSys.AddFunc(, cellGcmSetUserCallback);
// Other
cellGcmSys.AddFunc(0x21397818, cellGcmSetFlipCommand);
cellGcmSys.AddFunc(0xd8f88e1a, cellGcmSetFlipCommandWithWaitLabel);
cellGcmSys.AddFunc(0xd0b1d189, cellGcmSetTile);
});

View file

@ -4,7 +4,7 @@
#include "cellGem.h" #include "cellGem.h"
Module *cellGem = nullptr; extern Module cellGem;
struct cellGemInternal struct cellGemInternal
{ {
@ -81,7 +81,7 @@ int cellGemEnableMagnetometer()
int cellGemEnd() int cellGemEnd()
{ {
cellGem->Warning("cellGemEnd()"); cellGem.Warning("cellGemEnd()");
if (!cellGemInstance.m_bInitialized) if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED; return CELL_GEM_ERROR_UNINITIALIZED;
@ -183,7 +183,7 @@ int cellGemGetInertialState()
int cellGemGetInfo(vm::ptr<CellGemInfo> info) int cellGemGetInfo(vm::ptr<CellGemInfo> info)
{ {
cellGem->Warning("cellGemGetInfo(info=0x%x)", info.addr()); cellGem.Warning("cellGemGetInfo(info=0x%x)", info.addr());
if (!cellGemInstance.m_bInitialized) if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED; return CELL_GEM_ERROR_UNINITIALIZED;
@ -199,7 +199,7 @@ int cellGemGetInfo(vm::ptr<CellGemInfo> info)
s32 cellGemGetMemorySize(s32 max_connect) s32 cellGemGetMemorySize(s32 max_connect)
{ {
cellGem->Warning("cellGemGetMemorySize(max_connect=%d)", max_connect); cellGem.Warning("cellGemGetMemorySize(max_connect=%d)", max_connect);
if (max_connect > CELL_GEM_MAX_NUM) if (max_connect > CELL_GEM_MAX_NUM)
return CELL_GEM_ERROR_INVALID_PARAMETER; return CELL_GEM_ERROR_INVALID_PARAMETER;
@ -265,7 +265,7 @@ int cellGemHSVtoRGB()
int cellGemInit(vm::ptr<CellGemAttribute> attribute) int cellGemInit(vm::ptr<CellGemAttribute> attribute)
{ {
cellGem->Warning("cellGemInit(attribute_addr=0x%x)", attribute.addr()); cellGem.Warning("cellGemInit(attribute_addr=0x%x)", attribute.addr());
if (cellGemInstance.m_bInitialized) if (cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_ALREADY_INITIALIZED; return CELL_GEM_ERROR_ALREADY_INITIALIZED;
@ -387,50 +387,47 @@ void cellGem_unload()
cellGemInstance.m_bInitialized = false; cellGemInstance.m_bInitialized = false;
} }
void cellGem_init(Module *pxThis) Module cellGem("cellGem", []()
{ {
cellGem = pxThis; //cellGem.AddFunc(, cellGemAttributeInit);
cellGem.AddFunc(0xafa99ead, cellGemCalibrate);
//cellGem->AddFunc(, cellGemAttributeInit); cellGem.AddFunc(0x9b9714a4, cellGemClearStatusFlags);
cellGem->AddFunc(0xafa99ead, cellGemCalibrate); cellGem.AddFunc(0x1a13d010, cellGemConvertVideoFinish);
cellGem->AddFunc(0x9b9714a4, cellGemClearStatusFlags); cellGem.AddFunc(0x6dce048c, cellGemConvertVideoStart);
cellGem->AddFunc(0x1a13d010, cellGemConvertVideoFinish); cellGem.AddFunc(0x4219de31, cellGemEnableCameraPitchAngleCorrection);
cellGem->AddFunc(0x6dce048c, cellGemConvertVideoStart); cellGem.AddFunc(0x1a2518a2, cellGemEnableMagnetometer);
cellGem->AddFunc(0x4219de31, cellGemEnableCameraPitchAngleCorrection); cellGem.AddFunc(0xe1f85a80, cellGemEnd);
cellGem->AddFunc(0x1a2518a2, cellGemEnableMagnetometer); cellGem.AddFunc(0x6fc4c791, cellGemFilterState);
cellGem->AddFunc(0xe1f85a80, cellGemEnd); cellGem.AddFunc(0xce6d7791, cellGemForceRGB);
cellGem->AddFunc(0x6fc4c791, cellGemFilterState); cellGem.AddFunc(0x6a5b7048, cellGemGetAccelerometerPositionInDevice);
cellGem->AddFunc(0xce6d7791, cellGemForceRGB); cellGem.AddFunc(0x2d2c2764, cellGemGetAllTrackableHues);
cellGem->AddFunc(0x6a5b7048, cellGemGetAccelerometerPositionInDevice); cellGem.AddFunc(0x8befac67, cellGemGetCameraState);
cellGem->AddFunc(0x2d2c2764, cellGemGetAllTrackableHues); cellGem.AddFunc(0x02eb41bb, cellGemGetEnvironmentLightingColor);
cellGem->AddFunc(0x8befac67, cellGemGetCameraState); cellGem.AddFunc(0xb8ef56a6, cellGemGetHuePixels);
cellGem->AddFunc(0x02eb41bb, cellGemGetEnvironmentLightingColor); cellGem.AddFunc(0x92cc4b34, cellGemGetImageState);
cellGem->AddFunc(0xb8ef56a6, cellGemGetHuePixels); cellGem.AddFunc(0xd37b127a, cellGemGetInertialState);
cellGem->AddFunc(0x92cc4b34, cellGemGetImageState); cellGem.AddFunc(0x9e1dff96, cellGemGetInfo);
cellGem->AddFunc(0xd37b127a, cellGemGetInertialState); cellGem.AddFunc(0x2e0a170d, cellGemGetMemorySize);
cellGem->AddFunc(0x9e1dff96, cellGemGetInfo); cellGem.AddFunc(0x1b30cc22, cellGemGetRGB);
cellGem->AddFunc(0x2e0a170d, cellGemGetMemorySize); cellGem.AddFunc(0x6db6b007, cellGemGetRumble);
cellGem->AddFunc(0x1b30cc22, cellGemGetRGB); cellGem.AddFunc(0x6441d38d, cellGemGetState);
cellGem->AddFunc(0x6db6b007, cellGemGetRumble); cellGem.AddFunc(0xfee33481, cellGemGetStatusFlags);
cellGem->AddFunc(0x6441d38d, cellGemGetState); cellGem.AddFunc(0x18ea899a, cellGemGetTrackerHue);
cellGem->AddFunc(0xfee33481, cellGemGetStatusFlags); //cellGem.AddFunc(, cellGemGetVideoConvertSize);
cellGem->AddFunc(0x18ea899a, cellGemGetTrackerHue); cellGem.AddFunc(0xc7622586, cellGemHSVtoRGB);
//cellGem->AddFunc(, cellGemGetVideoConvertSize); cellGem.AddFunc(0x13ea7c64, cellGemInit);
cellGem->AddFunc(0xc7622586, cellGemHSVtoRGB); cellGem.AddFunc(0xe3e4f0d6, cellGemInvalidateCalibration);
cellGem->AddFunc(0x13ea7c64, cellGemInit); cellGem.AddFunc(0xfb5887f9, cellGemIsTrackableHue);
cellGem->AddFunc(0xe3e4f0d6, cellGemInvalidateCalibration); cellGem.AddFunc(0xa03ef587, cellGemPrepareCamera);
cellGem->AddFunc(0xfb5887f9, cellGemIsTrackableHue); cellGem.AddFunc(0xc07896f9, cellGemPrepareVideoConvert);
cellGem->AddFunc(0xa03ef587, cellGemPrepareCamera); //cellGem.AddFunc(, cellGemReadExternalPortDeviceInfo);
cellGem->AddFunc(0xc07896f9, cellGemPrepareVideoConvert); cellGem.AddFunc(0xde54e2fc, cellGemReset);
//cellGem->AddFunc(, cellGemReadExternalPortDeviceInfo); cellGem.AddFunc(0x49609306, cellGemSetRumble);
cellGem->AddFunc(0xde54e2fc, cellGemReset); cellGem.AddFunc(0x77e08704, cellGemSetYaw);
cellGem->AddFunc(0x49609306, cellGemSetRumble); cellGem.AddFunc(0x928ac5f8, cellGemTrackHues);
cellGem->AddFunc(0x77e08704, cellGemSetYaw); cellGem.AddFunc(0x41ae9c31, cellGemUpdateFinish);
cellGem->AddFunc(0x928ac5f8, cellGemTrackHues); cellGem.AddFunc(0x0ecd2261, cellGemUpdateStart);
cellGem->AddFunc(0x41ae9c31, cellGemUpdateFinish); //cellGem.AddFunc(, cellGemVideoConvertAttributeInit);
cellGem->AddFunc(0x0ecd2261, cellGemUpdateStart); //cellGem.AddFunc(, cellGemVideoConvertAttributeInitRgba);
//cellGem->AddFunc(, cellGemVideoConvertAttributeInit); cellGem.AddFunc(0x1f6328d8, cellGemWriteExternalPort);
//cellGem->AddFunc(, cellGemVideoConvertAttributeInitRgba); });
cellGem->AddFunc(0x1f6328d8, cellGemWriteExternalPort);
}

View file

@ -7,7 +7,7 @@
#include "Emu/SysCalls/lv2/cellFs.h" #include "Emu/SysCalls/lv2/cellFs.h"
#include "cellGifDec.h" #include "cellGifDec.h"
Module *cellGifDec = nullptr; extern Module cellGifDec;
int cellGifDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam) int cellGifDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam)
{ {
@ -23,7 +23,7 @@ int cellGifDecExtCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam, u
int cellGifDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellGifDecSrc> src, vm::ptr<CellGifDecOpnInfo> openInfo) int cellGifDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellGifDecSrc> src, vm::ptr<CellGifDecOpnInfo> openInfo)
{ {
cellGifDec->Warning("cellGifDecOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x)", cellGifDec.Warning("cellGifDecOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x)",
mainHandle, subHandle.addr(), src.addr(), openInfo.addr()); mainHandle, subHandle.addr(), src.addr(), openInfo.addr());
std::shared_ptr<CellGifDecSubHandle> current_subHandle(new CellGifDecSubHandle); std::shared_ptr<CellGifDecSubHandle> current_subHandle(new CellGifDecSubHandle);
@ -52,18 +52,18 @@ int cellGifDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellGifDecSrc
} }
// From now, every u32 subHandle argument is a pointer to a CellGifDecSubHandle struct. // From now, every u32 subHandle argument is a pointer to a CellGifDecSubHandle struct.
*subHandle = cellGifDec->GetNewId(current_subHandle); *subHandle = cellGifDec.GetNewId(current_subHandle);
return CELL_OK; return CELL_OK;
} }
int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellGifDecInfo> info) int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellGifDecInfo> info)
{ {
cellGifDec->Warning("cellGifDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%x)", cellGifDec.Warning("cellGifDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%x)",
mainHandle, subHandle, info.addr()); mainHandle, subHandle, info.addr());
std::shared_ptr<CellGifDecSubHandle> subHandle_data; std::shared_ptr<CellGifDecSubHandle> subHandle_data;
if(!cellGifDec->CheckId(subHandle, subHandle_data)) if(!cellGifDec.CheckId(subHandle, subHandle_data))
return CELL_GIFDEC_ERROR_FATAL; return CELL_GIFDEC_ERROR_FATAL;
const u32& fd = subHandle_data->fd; const u32& fd = subHandle_data->fd;
@ -109,11 +109,11 @@ int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellGifDecInfo>
int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr<const CellGifDecInParam> inParam, vm::ptr<CellGifDecOutParam> outParam) int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr<const CellGifDecInParam> inParam, vm::ptr<CellGifDecOutParam> outParam)
{ {
cellGifDec->Warning("cellGifDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x)", cellGifDec.Warning("cellGifDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x)",
mainHandle, subHandle, inParam.addr(), outParam.addr()); mainHandle, subHandle, inParam.addr(), outParam.addr());
std::shared_ptr<CellGifDecSubHandle> subHandle_data; std::shared_ptr<CellGifDecSubHandle> subHandle_data;
if(!cellGifDec->CheckId(subHandle, subHandle_data)) if(!cellGifDec.CheckId(subHandle, subHandle_data))
return CELL_GIFDEC_ERROR_FATAL; return CELL_GIFDEC_ERROR_FATAL;
CellGifDecInfo& current_info = subHandle_data->info; CellGifDecInfo& current_info = subHandle_data->info;
@ -139,13 +139,13 @@ int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr<const CellGifD
int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::ptr<const CellGifDecDataCtrlParam> dataCtrlParam, vm::ptr<CellGifDecDataOutInfo> dataOutInfo) int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::ptr<const CellGifDecDataCtrlParam> dataCtrlParam, vm::ptr<CellGifDecDataOutInfo> dataOutInfo)
{ {
cellGifDec->Warning("cellGifDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x)", cellGifDec.Warning("cellGifDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x)",
mainHandle, subHandle, data.addr(), dataCtrlParam.addr(), dataOutInfo.addr()); mainHandle, subHandle, data.addr(), dataCtrlParam.addr(), dataOutInfo.addr());
dataOutInfo->status = CELL_GIFDEC_DEC_STATUS_STOP; dataOutInfo->status = CELL_GIFDEC_DEC_STATUS_STOP;
std::shared_ptr<CellGifDecSubHandle> subHandle_data; std::shared_ptr<CellGifDecSubHandle> subHandle_data;
if(!cellGifDec->CheckId(subHandle, subHandle_data)) if(!cellGifDec.CheckId(subHandle, subHandle_data))
return CELL_GIFDEC_ERROR_FATAL; return CELL_GIFDEC_ERROR_FATAL;
const u32& fd = subHandle_data->fd; const u32& fd = subHandle_data->fd;
@ -256,15 +256,15 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::pt
int cellGifDecClose(u32 mainHandle, u32 subHandle) int cellGifDecClose(u32 mainHandle, u32 subHandle)
{ {
cellGifDec->Warning("cellGifDecClose(mainHandle=0x%x, subHandle=0x%x)", cellGifDec.Warning("cellGifDecClose(mainHandle=0x%x, subHandle=0x%x)",
mainHandle, subHandle); mainHandle, subHandle);
std::shared_ptr<CellGifDecSubHandle> subHandle_data; std::shared_ptr<CellGifDecSubHandle> subHandle_data;
if(!cellGifDec->CheckId(subHandle, subHandle_data)) if(!cellGifDec.CheckId(subHandle, subHandle_data))
return CELL_GIFDEC_ERROR_FATAL; return CELL_GIFDEC_ERROR_FATAL;
cellFsClose(subHandle_data->fd); cellFsClose(subHandle_data->fd);
cellGifDec->RemoveId(subHandle); cellGifDec.RemoveId(subHandle);
return CELL_OK; return CELL_OK;
} }
@ -275,21 +275,19 @@ int cellGifDecDestroy(u32 mainHandle)
return CELL_OK; return CELL_OK;
} }
void cellGifDec_init(Module *pxThis) Module cellGifDec("cellGifDec", []()
{ {
cellGifDec = pxThis; cellGifDec.AddFunc(0xb60d42a5, cellGifDecCreate);
cellGifDec.AddFunc(0x4711cb7f, cellGifDecExtCreate);
cellGifDec.AddFunc(0x75745079, cellGifDecOpen);
cellGifDec.AddFunc(0xf0da95de, cellGifDecReadHeader);
cellGifDec.AddFunc(0x41a90dc4, cellGifDecSetParameter);
cellGifDec.AddFunc(0x44b1bc61, cellGifDecDecodeData);
cellGifDec.AddFunc(0x116a7da9, cellGifDecClose);
cellGifDec.AddFunc(0xe74b2cb1, cellGifDecDestroy);
cellGifDec->AddFunc(0xb60d42a5, cellGifDecCreate); /*cellGifDec.AddFunc(0x17fb83c1, cellGifDecExtOpen);
cellGifDec->AddFunc(0x4711cb7f, cellGifDecExtCreate); cellGifDec.AddFunc(0xe53f91f2, cellGifDecExtReadHeader);
cellGifDec->AddFunc(0x75745079, cellGifDecOpen); cellGifDec.AddFunc(0x95cae771, cellGifDecExtSetParameter);
cellGifDec->AddFunc(0xf0da95de, cellGifDecReadHeader); cellGifDec.AddFunc(0x02e7e03e, cellGifDecExtDecodeData);*/
cellGifDec->AddFunc(0x41a90dc4, cellGifDecSetParameter); });
cellGifDec->AddFunc(0x44b1bc61, cellGifDecDecodeData);
cellGifDec->AddFunc(0x116a7da9, cellGifDecClose);
cellGifDec->AddFunc(0xe74b2cb1, cellGifDecDestroy);
/*cellGifDec->AddFunc(0x17fb83c1, cellGifDecExtOpen);
cellGifDec->AddFunc(0xe53f91f2, cellGifDecExtReadHeader);
cellGifDec->AddFunc(0x95cae771, cellGifDecExtSetParameter);
cellGifDec->AddFunc(0x02e7e03e, cellGifDecExtDecodeData);*/
}

View file

@ -6,7 +6,7 @@
#include "Emu/SysCalls/lv2/cellFs.h" #include "Emu/SysCalls/lv2/cellFs.h"
#include "cellJpgDec.h" #include "cellJpgDec.h"
Module *cellJpgDec = nullptr; extern Module cellJpgDec;
int cellJpgDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam) int cellJpgDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam)
{ {
@ -28,7 +28,7 @@ int cellJpgDecDestroy(u32 mainHandle)
int cellJpgDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellJpgDecSrc> src, vm::ptr<CellJpgDecOpnInfo> openInfo) int cellJpgDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellJpgDecSrc> src, vm::ptr<CellJpgDecOpnInfo> openInfo)
{ {
cellJpgDec->Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x)", cellJpgDec.Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x)",
mainHandle, subHandle.addr(), src.addr(), openInfo.addr()); mainHandle, subHandle.addr(), src.addr(), openInfo.addr());
std::shared_ptr<CellJpgDecSubHandle> current_subHandle(new CellJpgDecSubHandle); std::shared_ptr<CellJpgDecSubHandle> current_subHandle(new CellJpgDecSubHandle);
@ -58,32 +58,32 @@ int cellJpgDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellJpgDecSrc
} }
// From now, every u32 subHandle argument is a pointer to a CellJpgDecSubHandle struct. // From now, every u32 subHandle argument is a pointer to a CellJpgDecSubHandle struct.
*subHandle = cellJpgDec->GetNewId(current_subHandle); *subHandle = cellJpgDec.GetNewId(current_subHandle);
return CELL_OK; return CELL_OK;
} }
int cellJpgDecClose(u32 mainHandle, u32 subHandle) int cellJpgDecClose(u32 mainHandle, u32 subHandle)
{ {
cellJpgDec->Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle=0x%x)", cellJpgDec.Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle=0x%x)",
mainHandle, subHandle); mainHandle, subHandle);
std::shared_ptr<CellJpgDecSubHandle> subHandle_data; std::shared_ptr<CellJpgDecSubHandle> subHandle_data;
if(!cellJpgDec->CheckId(subHandle, subHandle_data)) if(!cellJpgDec.CheckId(subHandle, subHandle_data))
return CELL_JPGDEC_ERROR_FATAL; return CELL_JPGDEC_ERROR_FATAL;
cellFsClose(subHandle_data->fd); cellFsClose(subHandle_data->fd);
cellJpgDec->RemoveId(subHandle); cellJpgDec.RemoveId(subHandle);
return CELL_OK; return CELL_OK;
} }
int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellJpgDecInfo> info) int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellJpgDecInfo> info)
{ {
cellJpgDec->Log("cellJpgDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%x)", mainHandle, subHandle, info.addr()); cellJpgDec.Log("cellJpgDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%x)", mainHandle, subHandle, info.addr());
std::shared_ptr<CellJpgDecSubHandle> subHandle_data; std::shared_ptr<CellJpgDecSubHandle> subHandle_data;
if(!cellJpgDec->CheckId(subHandle, subHandle_data)) if(!cellJpgDec.CheckId(subHandle, subHandle_data))
return CELL_JPGDEC_ERROR_FATAL; return CELL_JPGDEC_ERROR_FATAL;
const u32& fd = subHandle_data->fd; const u32& fd = subHandle_data->fd;
@ -147,12 +147,12 @@ int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellJpgDecInfo>
int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::ptr<const CellJpgDecDataCtrlParam> dataCtrlParam, vm::ptr<CellJpgDecDataOutInfo> dataOutInfo) int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::ptr<const CellJpgDecDataCtrlParam> dataCtrlParam, vm::ptr<CellJpgDecDataOutInfo> dataOutInfo)
{ {
cellJpgDec->Log("cellJpgDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x)", cellJpgDec.Log("cellJpgDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x)",
mainHandle, subHandle, data.addr(), dataCtrlParam.addr(), dataOutInfo.addr()); mainHandle, subHandle, data.addr(), dataCtrlParam.addr(), dataOutInfo.addr());
dataOutInfo->status = CELL_JPGDEC_DEC_STATUS_STOP; dataOutInfo->status = CELL_JPGDEC_DEC_STATUS_STOP;
std::shared_ptr<CellJpgDecSubHandle> subHandle_data; std::shared_ptr<CellJpgDecSubHandle> subHandle_data;
if(!cellJpgDec->CheckId(subHandle, subHandle_data)) if(!cellJpgDec.CheckId(subHandle, subHandle_data))
return CELL_JPGDEC_ERROR_FATAL; return CELL_JPGDEC_ERROR_FATAL;
const u32& fd = subHandle_data->fd; const u32& fd = subHandle_data->fd;
@ -261,7 +261,7 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::pt
case CELL_JPG_UPSAMPLE_ONLY: case CELL_JPG_UPSAMPLE_ONLY:
case CELL_JPG_GRAYSCALE_TO_ALPHA_RGBA: case CELL_JPG_GRAYSCALE_TO_ALPHA_RGBA:
case CELL_JPG_GRAYSCALE_TO_ALPHA_ARGB: case CELL_JPG_GRAYSCALE_TO_ALPHA_ARGB:
cellJpgDec->Error("cellJpgDecDecodeData: Unsupported color space (%d)", current_outParam.outputColorSpace); cellJpgDec.Error("cellJpgDecDecodeData: Unsupported color space (%d)", current_outParam.outputColorSpace);
break; break;
default: default:
@ -278,11 +278,11 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::pt
int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr<const CellJpgDecInParam> inParam, vm::ptr<CellJpgDecOutParam> outParam) int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr<const CellJpgDecInParam> inParam, vm::ptr<CellJpgDecOutParam> outParam)
{ {
cellJpgDec->Log("cellJpgDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x)", cellJpgDec.Log("cellJpgDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x)",
mainHandle, subHandle, inParam.addr(), outParam.addr()); mainHandle, subHandle, inParam.addr(), outParam.addr());
std::shared_ptr<CellJpgDecSubHandle> subHandle_data; std::shared_ptr<CellJpgDecSubHandle> subHandle_data;
if(!cellJpgDec->CheckId(subHandle, subHandle_data)) if(!cellJpgDec.CheckId(subHandle, subHandle_data))
return CELL_JPGDEC_ERROR_FATAL; return CELL_JPGDEC_ERROR_FATAL;
CellJpgDecInfo& current_info = subHandle_data->info; CellJpgDecInfo& current_info = subHandle_data->info;
@ -320,21 +320,19 @@ int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr<const CellJpgD
} }
void cellJpgDec_init(Module *pxThis) Module cellJpgDec("cellJpgDec", []()
{ {
cellJpgDec = pxThis; cellJpgDec.AddFunc(0xa7978f59, cellJpgDecCreate);
cellJpgDec.AddFunc(0x8b300f66, cellJpgDecExtCreate);
cellJpgDec.AddFunc(0x976ca5c2, cellJpgDecOpen);
cellJpgDec.AddFunc(0x6d9ebccf, cellJpgDecReadHeader);
cellJpgDec.AddFunc(0xe08f3910, cellJpgDecSetParameter);
cellJpgDec.AddFunc(0xaf8bb012, cellJpgDecDecodeData);
cellJpgDec.AddFunc(0x9338a07a, cellJpgDecClose);
cellJpgDec.AddFunc(0xd8ea91f8, cellJpgDecDestroy);
cellJpgDec->AddFunc(0xa7978f59, cellJpgDecCreate); /*cellJpgDec.AddFunc(0xa9f703e3, cellJpgDecExtOpen);
cellJpgDec->AddFunc(0x8b300f66, cellJpgDecExtCreate); cellJpgDec.AddFunc(0xb91eb3d2, cellJpgDecExtReadHeader);
cellJpgDec->AddFunc(0x976ca5c2, cellJpgDecOpen); cellJpgDec.AddFunc(0x65cbbb16, cellJpgDecExtSetParameter);
cellJpgDec->AddFunc(0x6d9ebccf, cellJpgDecReadHeader); cellJpgDec.AddFunc(0x716f8792, cellJpgDecExtDecodeData);*/
cellJpgDec->AddFunc(0xe08f3910, cellJpgDecSetParameter); });
cellJpgDec->AddFunc(0xaf8bb012, cellJpgDecDecodeData);
cellJpgDec->AddFunc(0x9338a07a, cellJpgDecClose);
cellJpgDec->AddFunc(0xd8ea91f8, cellJpgDecDestroy);
/*cellJpgDec->AddFunc(0xa9f703e3, cellJpgDecExtOpen);
cellJpgDec->AddFunc(0xb91eb3d2, cellJpgDecExtReadHeader);
cellJpgDec->AddFunc(0x65cbbb16, cellJpgDecExtSetParameter);
cellJpgDec->AddFunc(0x716f8792, cellJpgDecExtDecodeData);*/
}

View file

@ -6,11 +6,11 @@
#include "Emu/Io/Keyboard.h" #include "Emu/Io/Keyboard.h"
#include "cellKb.h" #include "cellKb.h"
extern Module *sys_io; extern Module sys_io;
int cellKbInit(u32 max_connect) int cellKbInit(u32 max_connect)
{ {
sys_io->Warning("cellKbInit(max_connect=%d)", max_connect); sys_io.Warning("cellKbInit(max_connect=%d)", max_connect);
if (Emu.GetKeyboardManager().IsInited()) if (Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_ALREADY_INITIALIZED; return CELL_KB_ERROR_ALREADY_INITIALIZED;
@ -24,7 +24,7 @@ int cellKbInit(u32 max_connect)
int cellKbEnd() int cellKbEnd()
{ {
sys_io->Log("cellKbEnd()"); sys_io.Log("cellKbEnd()");
if (!Emu.GetKeyboardManager().IsInited()) if (!Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_UNINITIALIZED; return CELL_KB_ERROR_UNINITIALIZED;
@ -35,7 +35,7 @@ int cellKbEnd()
int cellKbClearBuf(u32 port_no) int cellKbClearBuf(u32 port_no)
{ {
sys_io->Log("cellKbClearBuf(port_no=%d)", port_no); sys_io.Log("cellKbClearBuf(port_no=%d)", port_no);
if (!Emu.GetKeyboardManager().IsInited()) if (!Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_UNINITIALIZED; return CELL_KB_ERROR_UNINITIALIZED;
@ -50,7 +50,7 @@ int cellKbClearBuf(u32 port_no)
u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode) u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode)
{ {
sys_io->Log("cellKbCnvRawCode(arrange=%d,mkey=%d,led=%d,rawcode=%d)", arrange, mkey, led, rawcode); sys_io.Log("cellKbCnvRawCode(arrange=%d,mkey=%d,led=%d,rawcode=%d)", arrange, mkey, led, rawcode);
// CELL_KB_RAWDAT // CELL_KB_RAWDAT
if (rawcode <= 0x03 || rawcode == 0x29 || rawcode == 0x35 || (rawcode >= 0x39 && rawcode <= 0x53) || rawcode == 0x65 || rawcode == 0x88 || rawcode == 0x8A || rawcode == 0x8B) if (rawcode <= 0x03 || rawcode == 0x29 || rawcode == 0x35 || (rawcode >= 0x39 && rawcode <= 0x53) || rawcode == 0x65 || rawcode == 0x88 || rawcode == 0x8A || rawcode == 0x8B)
@ -96,7 +96,7 @@ u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode)
int cellKbGetInfo(vm::ptr<CellKbInfo> info) int cellKbGetInfo(vm::ptr<CellKbInfo> info)
{ {
sys_io->Log("cellKbGetInfo(info_addr=0x%x)", info.addr()); sys_io.Log("cellKbGetInfo(info_addr=0x%x)", info.addr());
if (!Emu.GetKeyboardManager().IsInited()) if (!Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_UNINITIALIZED; return CELL_KB_ERROR_UNINITIALIZED;
@ -116,7 +116,7 @@ int cellKbGetInfo(vm::ptr<CellKbInfo> info)
int cellKbRead(u32 port_no, vm::ptr<CellKbData> data) int cellKbRead(u32 port_no, vm::ptr<CellKbData> data)
{ {
sys_io->Log("cellKbRead(port_no=%d,info_addr=0x%x)", port_no, data.addr()); sys_io.Log("cellKbRead(port_no=%d,info_addr=0x%x)", port_no, data.addr());
const std::vector<Keyboard>& keyboards = Emu.GetKeyboardManager().GetKeyboards(); const std::vector<Keyboard>& keyboards = Emu.GetKeyboardManager().GetKeyboards();
if (!Emu.GetKeyboardManager().IsInited()) if (!Emu.GetKeyboardManager().IsInited())
@ -142,7 +142,7 @@ int cellKbRead(u32 port_no, vm::ptr<CellKbData> data)
int cellKbSetCodeType(u32 port_no, u32 type) int cellKbSetCodeType(u32 port_no, u32 type)
{ {
sys_io->Log("cellKbSetCodeType(port_no=%d,type=%d)", port_no, type); sys_io.Log("cellKbSetCodeType(port_no=%d,type=%d)", port_no, type);
if (!Emu.GetKeyboardManager().IsInited()) if (!Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_UNINITIALIZED; return CELL_KB_ERROR_UNINITIALIZED;
@ -160,7 +160,7 @@ int cellKbSetLEDStatus(u32 port_no, u8 led)
int cellKbSetReadMode(u32 port_no, u32 rmode) int cellKbSetReadMode(u32 port_no, u32 rmode)
{ {
sys_io->Log("cellKbSetReadMode(port_no=%d,rmode=%d)", port_no, rmode); sys_io.Log("cellKbSetReadMode(port_no=%d,rmode=%d)", port_no, rmode);
if (!Emu.GetKeyboardManager().IsInited()) if (!Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_UNINITIALIZED; return CELL_KB_ERROR_UNINITIALIZED;
@ -173,7 +173,7 @@ int cellKbSetReadMode(u32 port_no, u32 rmode)
int cellKbGetConfiguration(u32 port_no, vm::ptr<CellKbConfig> config) int cellKbGetConfiguration(u32 port_no, vm::ptr<CellKbConfig> config)
{ {
sys_io->Log("cellKbGetConfiguration(port_no=%d,config_addr=0x%x)", port_no, config.addr()); sys_io.Log("cellKbGetConfiguration(port_no=%d,config_addr=0x%x)", port_no, config.addr());
if (!Emu.GetKeyboardManager().IsInited()) if (!Emu.GetKeyboardManager().IsInited())
return CELL_KB_ERROR_UNINITIALIZED; return CELL_KB_ERROR_UNINITIALIZED;
@ -188,14 +188,14 @@ int cellKbGetConfiguration(u32 port_no, vm::ptr<CellKbConfig> config)
void cellKb_init() void cellKb_init()
{ {
sys_io->AddFunc(0x433f6ec0, cellKbInit); sys_io.AddFunc(0x433f6ec0, cellKbInit);
sys_io->AddFunc(0xbfce3285, cellKbEnd); sys_io.AddFunc(0xbfce3285, cellKbEnd);
sys_io->AddFunc(0x2073b7f6, cellKbClearBuf); sys_io.AddFunc(0x2073b7f6, cellKbClearBuf);
sys_io->AddFunc(0x4ab1fa77, cellKbCnvRawCode); sys_io.AddFunc(0x4ab1fa77, cellKbCnvRawCode);
sys_io->AddFunc(0x2f1774d5, cellKbGetInfo); sys_io.AddFunc(0x2f1774d5, cellKbGetInfo);
sys_io->AddFunc(0xff0a21b7, cellKbRead); sys_io.AddFunc(0xff0a21b7, cellKbRead);
sys_io->AddFunc(0xa5f85e4d, cellKbSetCodeType); sys_io.AddFunc(0xa5f85e4d, cellKbSetCodeType);
sys_io->AddFunc(0x3f72c56e, cellKbSetLEDStatus); sys_io.AddFunc(0x3f72c56e, cellKbSetLEDStatus);
sys_io->AddFunc(0xdeefdfa7, cellKbSetReadMode); sys_io.AddFunc(0xdeefdfa7, cellKbSetReadMode);
sys_io->AddFunc(0x1f71ecbe, cellKbGetConfiguration); sys_io.AddFunc(0x1f71ecbe, cellKbGetConfiguration);
} }

View file

@ -14,11 +14,11 @@
#include <iconv.h> #include <iconv.h>
#endif #endif
Module *cellL10n = nullptr; extern Module cellL10n;
int UTF16stoUTF8s(vm::lptrl<const char16_t> utf16, vm::ptr<u32> utf16_len, vm::ptr<char> utf8, vm::ptr<u32> utf8_len) int UTF16stoUTF8s(vm::lptrl<const char16_t> utf16, vm::ptr<u32> utf16_len, vm::ptr<char> utf8, vm::ptr<u32> utf8_len)
{ {
cellL10n->Warning("UTF16stoUTF8s(utf16_addr=0x%x, utf16_len_addr=0x%x, utf8_addr=0x%x, utf8_len_addr=0x%x)", cellL10n.Warning("UTF16stoUTF8s(utf16_addr=0x%x, utf16_len_addr=0x%x, utf8_addr=0x%x, utf8_len_addr=0x%x)",
utf16.addr(), utf16_len.addr(), utf8.addr(), utf8_len.addr()); utf16.addr(), utf16_len.addr(), utf8.addr(), utf8_len.addr());
std::u16string wstr = utf16.get_ptr(); // ??? std::u16string wstr = utf16.get_ptr(); // ???
@ -41,7 +41,7 @@ int UTF16stoUTF8s(vm::lptrl<const char16_t> utf16, vm::ptr<u32> utf16_len, vm::p
int jstrchk(vm::ptr<const char> jstr) int jstrchk(vm::ptr<const char> jstr)
{ {
cellL10n->Warning("jstrchk(jstr_addr=0x%x) -> utf8", jstr.addr()); cellL10n.Warning("jstrchk(jstr_addr=0x%x) -> utf8", jstr.addr());
return L10N_STR_UTF8; return L10N_STR_UTF8;
} }
@ -283,9 +283,9 @@ int _L10nConvertStr(int src_code, const void* src, size_t * src_len, int dst_cod
//TODO: Check the code in emulation. If support for UTF8/UTF16/UTF32/UCS2/UCS4 should use wider chars.. awful. //TODO: Check the code in emulation. If support for UTF8/UTF16/UTF32/UCS2/UCS4 should use wider chars.. awful.
int L10nConvertStr(int src_code, vm::ptr<const void> src, vm::ptr<u32> src_len, int dst_code, vm::ptr<void> dst, vm::ptr<u32> dst_len) int L10nConvertStr(int src_code, vm::ptr<const void> src, vm::ptr<u32> src_len, int dst_code, vm::ptr<void> dst, vm::ptr<u32> dst_len)
{ {
cellL10n->Error("L10nConvertStr(src_code=%d, srca_addr=0x%x, src_len_addr=0x%x, dst_code=%d, dst_addr=0x%x, dst_len_addr=0x%x)", cellL10n.Error("L10nConvertStr(src_code=%d, srca_addr=0x%x, src_len_addr=0x%x, dst_code=%d, dst_addr=0x%x, dst_len_addr=0x%x)",
src_code, src.addr(), src_len.addr(), dst_code, dst.addr(), dst_len.addr()); src_code, src.addr(), src_len.addr(), dst_code, dst.addr(), dst_len.addr());
//cellL10n->Todo("L10nConvertStr: 1st char at dst: 0x%x", *((char*)src.get_ptr())); //cellL10n.Todo("L10nConvertStr: 1st char at dst: 0x%x", *((char*)src.get_ptr()));
#ifdef _MSC_VER #ifdef _MSC_VER
unsigned int srcCode = 0, dstCode = 0; //OEM code pages unsigned int srcCode = 0, dstCode = 0; //OEM code pages
bool src_page_converted = _L10nCodeParse(src_code, srcCode); //Check if code is in list. bool src_page_converted = _L10nCodeParse(src_code, srcCode); //Check if code is in list.
@ -335,175 +335,173 @@ int L10nConvertStr(int src_code, vm::ptr<const void> src, vm::ptr<u32> src_len,
#endif #endif
} }
void cellL10n_init(Module *pxThis) Module cellL10n("cellL10n", []()
{ {
cellL10n = pxThis;
// NOTE: I think this module should be LLE'd instead of implementing all its functions // NOTE: I think this module should be LLE'd instead of implementing all its functions
// cellL10n->AddFunc(0x005200e6, UCS2toEUCJP); // cellL10n.AddFunc(0x005200e6, UCS2toEUCJP);
// cellL10n->AddFunc(0x01b0cbf4, l10n_convert); // cellL10n.AddFunc(0x01b0cbf4, l10n_convert);
// cellL10n->AddFunc(0x0356038c, UCS2toUTF32); // cellL10n.AddFunc(0x0356038c, UCS2toUTF32);
// cellL10n->AddFunc(0x05028763, jis2kuten); // cellL10n.AddFunc(0x05028763, jis2kuten);
// cellL10n->AddFunc(0x058addc8, UTF8toGB18030); // cellL10n.AddFunc(0x058addc8, UTF8toGB18030);
// cellL10n->AddFunc(0x060ee3b2, JISstoUTF8s); // cellL10n.AddFunc(0x060ee3b2, JISstoUTF8s);
// cellL10n->AddFunc(0x07168a83, SjisZen2Han); // cellL10n.AddFunc(0x07168a83, SjisZen2Han);
// cellL10n->AddFunc(0x0bc386c8, ToSjisLower); // cellL10n.AddFunc(0x0bc386c8, ToSjisLower);
// cellL10n->AddFunc(0x0bedf77d, UCS2toGB18030); // cellL10n.AddFunc(0x0bedf77d, UCS2toGB18030);
// cellL10n->AddFunc(0x0bf867e2, HZstoUCS2s); // cellL10n.AddFunc(0x0bf867e2, HZstoUCS2s);
// cellL10n->AddFunc(0x0ce278fd, UCS2stoHZs); // cellL10n.AddFunc(0x0ce278fd, UCS2stoHZs);
// cellL10n->AddFunc(0x0d90a48d, UCS2stoSJISs); // cellL10n.AddFunc(0x0d90a48d, UCS2stoSJISs);
// cellL10n->AddFunc(0x0f624540, kuten2eucjp); // cellL10n.AddFunc(0x0f624540, kuten2eucjp);
// cellL10n->AddFunc(0x14ee3649, sjis2jis); // cellL10n.AddFunc(0x14ee3649, sjis2jis);
// cellL10n->AddFunc(0x14f504b8, EUCKRstoUCS2s); // cellL10n.AddFunc(0x14f504b8, EUCKRstoUCS2s);
// cellL10n->AddFunc(0x16eaf5f1, UHCstoEUCKRs); // cellL10n.AddFunc(0x16eaf5f1, UHCstoEUCKRs);
// cellL10n->AddFunc(0x1758053c, jis2sjis); // cellL10n.AddFunc(0x1758053c, jis2sjis);
// cellL10n->AddFunc(0x1906ce6b, jstrnchk); // cellL10n.AddFunc(0x1906ce6b, jstrnchk);
// cellL10n->AddFunc(0x1ac0d23d, L10nConvert); // cellL10n.AddFunc(0x1ac0d23d, L10nConvert);
// cellL10n->AddFunc(0x1ae2acee, EUCCNstoUTF8s); // cellL10n.AddFunc(0x1ae2acee, EUCCNstoUTF8s);
// cellL10n->AddFunc(0x1cb1138f, GBKstoUCS2s); // cellL10n.AddFunc(0x1cb1138f, GBKstoUCS2s);
// cellL10n->AddFunc(0x1da42d70, eucjphan2zen); // cellL10n.AddFunc(0x1da42d70, eucjphan2zen);
// cellL10n->AddFunc(0x1ec712e0, ToSjisHira); // cellL10n.AddFunc(0x1ec712e0, ToSjisHira);
// cellL10n->AddFunc(0x1fb50183, GBKtoUCS2); // cellL10n.AddFunc(0x1fb50183, GBKtoUCS2);
// cellL10n->AddFunc(0x21948c03, eucjp2jis); // cellL10n.AddFunc(0x21948c03, eucjp2jis);
// cellL10n->AddFunc(0x21aa3045, UTF32stoUTF8s); // cellL10n.AddFunc(0x21aa3045, UTF32stoUTF8s);
// cellL10n->AddFunc(0x24fd32a9, sjishan2zen); // cellL10n.AddFunc(0x24fd32a9, sjishan2zen);
// cellL10n->AddFunc(0x256b6861, UCS2toSBCS); // cellL10n.AddFunc(0x256b6861, UCS2toSBCS);
// cellL10n->AddFunc(0x262a5ae2, UTF8stoGBKs); // cellL10n.AddFunc(0x262a5ae2, UTF8stoGBKs);
// cellL10n->AddFunc(0x28724522, UTF8toUCS2); // cellL10n.AddFunc(0x28724522, UTF8toUCS2);
// cellL10n->AddFunc(0x2ad091c6, UCS2stoUTF8s); // cellL10n.AddFunc(0x2ad091c6, UCS2stoUTF8s);
// cellL10n->AddFunc(0x2b84030c, EUCKRstoUTF8s); // cellL10n.AddFunc(0x2b84030c, EUCKRstoUTF8s);
// cellL10n->AddFunc(0x2efa7294, UTF16stoUTF32s); // cellL10n.AddFunc(0x2efa7294, UTF16stoUTF32s);
// cellL10n->AddFunc(0x2f9eb543, UTF8toEUCKR); // cellL10n.AddFunc(0x2f9eb543, UTF8toEUCKR);
// cellL10n->AddFunc(0x317ab7c2, UTF16toUTF8); // cellL10n.AddFunc(0x317ab7c2, UTF16toUTF8);
// cellL10n->AddFunc(0x32689828, ARIBstoUTF8s); // cellL10n.AddFunc(0x32689828, ARIBstoUTF8s);
// cellL10n->AddFunc(0x33435818, SJISstoUTF8s); // cellL10n.AddFunc(0x33435818, SJISstoUTF8s);
// cellL10n->AddFunc(0x33f8b35c, sjiszen2han); // cellL10n.AddFunc(0x33f8b35c, sjiszen2han);
// cellL10n->AddFunc(0x3968f176, ToEucJpLower); // cellL10n.AddFunc(0x3968f176, ToEucJpLower);
// cellL10n->AddFunc(0x398a3dee, MSJIStoUTF8); // cellL10n.AddFunc(0x398a3dee, MSJIStoUTF8);
// cellL10n->AddFunc(0x3a20bc34, UCS2stoMSJISs); // cellL10n.AddFunc(0x3a20bc34, UCS2stoMSJISs);
// cellL10n->AddFunc(0x3dabd5a7, EUCJPtoUTF8); // cellL10n.AddFunc(0x3dabd5a7, EUCJPtoUTF8);
// cellL10n->AddFunc(0x3df65b64, eucjp2sjis); // cellL10n.AddFunc(0x3df65b64, eucjp2sjis);
// cellL10n->AddFunc(0x408a622b, ToEucJpHira); // cellL10n.AddFunc(0x408a622b, ToEucJpHira);
// cellL10n->AddFunc(0x41b4a5ae, UHCstoUCS2s); // cellL10n.AddFunc(0x41b4a5ae, UHCstoUCS2s);
// cellL10n->AddFunc(0x41ccf033, ToEucJpKata); // cellL10n.AddFunc(0x41ccf033, ToEucJpKata);
// cellL10n->AddFunc(0x42838145, HZstoUTF8s); // cellL10n.AddFunc(0x42838145, HZstoUTF8s);
// cellL10n->AddFunc(0x4931b44e, UTF8toMSJIS); // cellL10n.AddFunc(0x4931b44e, UTF8toMSJIS);
// cellL10n->AddFunc(0x4b3bbacb, BIG5toUTF8); // cellL10n.AddFunc(0x4b3bbacb, BIG5toUTF8);
// cellL10n->AddFunc(0x511d386b, EUCJPstoSJISs); // cellL10n.AddFunc(0x511d386b, EUCJPstoSJISs);
// cellL10n->AddFunc(0x52b7883f, UTF8stoBIG5s); // cellL10n.AddFunc(0x52b7883f, UTF8stoBIG5s);
// cellL10n->AddFunc(0x53558b6b, UTF16stoUCS2s); // cellL10n.AddFunc(0x53558b6b, UTF16stoUCS2s);
// cellL10n->AddFunc(0x53764725, UCS2stoGB18030s); // cellL10n.AddFunc(0x53764725, UCS2stoGB18030s);
// cellL10n->AddFunc(0x53c71ac2, EUCJPtoSJIS); // cellL10n.AddFunc(0x53c71ac2, EUCJPtoSJIS);
// cellL10n->AddFunc(0x54f59807, EUCJPtoUCS2); // cellL10n.AddFunc(0x54f59807, EUCJPtoUCS2);
// cellL10n->AddFunc(0x55f6921c, UCS2stoGBKs); // cellL10n.AddFunc(0x55f6921c, UCS2stoGBKs);
// cellL10n->AddFunc(0x58246762, EUCKRtoUHC); // cellL10n.AddFunc(0x58246762, EUCKRtoUHC);
// cellL10n->AddFunc(0x596df41c, UCS2toSJIS); // cellL10n.AddFunc(0x596df41c, UCS2toSJIS);
// cellL10n->AddFunc(0x5a4ab223, MSJISstoUTF8s); // cellL10n.AddFunc(0x5a4ab223, MSJISstoUTF8s);
// cellL10n->AddFunc(0x5ac783dc, EUCJPstoUTF8s); // cellL10n.AddFunc(0x5ac783dc, EUCJPstoUTF8s);
// cellL10n->AddFunc(0x5b684dfb, UCS2toBIG5); // cellL10n.AddFunc(0x5b684dfb, UCS2toBIG5);
// cellL10n->AddFunc(0x5cd29270, UTF8stoEUCKRs); // cellL10n.AddFunc(0x5cd29270, UTF8stoEUCKRs);
// cellL10n->AddFunc(0x5e1d9330, UHCstoUTF8s); // cellL10n.AddFunc(0x5e1d9330, UHCstoUTF8s);
// cellL10n->AddFunc(0x60ffa0ec, GB18030stoUCS2s); // cellL10n.AddFunc(0x60ffa0ec, GB18030stoUCS2s);
// cellL10n->AddFunc(0x6122e000, SJIStoUTF8); // cellL10n.AddFunc(0x6122e000, SJIStoUTF8);
// cellL10n->AddFunc(0x6169f205, JISstoSJISs); // cellL10n.AddFunc(0x6169f205, JISstoSJISs);
// cellL10n->AddFunc(0x61fb9442, UTF8toUTF16); // cellL10n.AddFunc(0x61fb9442, UTF8toUTF16);
// cellL10n->AddFunc(0x62b36bcf, UTF8stoMSJISs); // cellL10n.AddFunc(0x62b36bcf, UTF8stoMSJISs);
// cellL10n->AddFunc(0x63219199, EUCKRtoUTF8); // cellL10n.AddFunc(0x63219199, EUCKRtoUTF8);
// cellL10n->AddFunc(0x638c2fc1, SjisHan2Zen); // cellL10n.AddFunc(0x638c2fc1, SjisHan2Zen);
// cellL10n->AddFunc(0x64a10ec8, UCS2toUTF16); // cellL10n.AddFunc(0x64a10ec8, UCS2toUTF16);
// cellL10n->AddFunc(0x65444204, UCS2toMSJIS); // cellL10n.AddFunc(0x65444204, UCS2toMSJIS);
// cellL10n->AddFunc(0x6621a82c, sjis2kuten); // cellL10n.AddFunc(0x6621a82c, sjis2kuten);
// cellL10n->AddFunc(0x6a6f25d1, UCS2toUHC); // cellL10n.AddFunc(0x6a6f25d1, UCS2toUHC);
// cellL10n->AddFunc(0x6c62d879, UTF32toUCS2); // cellL10n.AddFunc(0x6c62d879, UTF32toUCS2);
// cellL10n->AddFunc(0x6de4b508, ToSjisUpper); // cellL10n.AddFunc(0x6de4b508, ToSjisUpper);
// cellL10n->AddFunc(0x6e0705c4, UTF8toEUCJP); // cellL10n.AddFunc(0x6e0705c4, UTF8toEUCJP);
// cellL10n->AddFunc(0x6e5906fd, UCS2stoEUCJPs); // cellL10n.AddFunc(0x6e5906fd, UCS2stoEUCJPs);
// cellL10n->AddFunc(0x6fc530b3, UTF16toUCS2); // cellL10n.AddFunc(0x6fc530b3, UTF16toUCS2);
// cellL10n->AddFunc(0x714a9b4a, UCS2stoUTF16s); // cellL10n.AddFunc(0x714a9b4a, UCS2stoUTF16s);
// cellL10n->AddFunc(0x71804d64, UCS2stoEUCCNs); // cellL10n.AddFunc(0x71804d64, UCS2stoEUCCNs);
// cellL10n->AddFunc(0x72632e53, SBCSstoUTF8s); // cellL10n.AddFunc(0x72632e53, SBCSstoUTF8s);
// cellL10n->AddFunc(0x73f2cd21, SJISstoJISs); // cellL10n.AddFunc(0x73f2cd21, SJISstoJISs);
// cellL10n->AddFunc(0x74496718, SBCStoUTF8); // cellL10n.AddFunc(0x74496718, SBCStoUTF8);
// cellL10n->AddFunc(0x74871fe0, UTF8toUTF32); // cellL10n.AddFunc(0x74871fe0, UTF8toUTF32);
cellL10n->AddFunc(0x750c363d, jstrchk); cellL10n.AddFunc(0x750c363d, jstrchk);
// cellL10n->AddFunc(0x7c5bde1c, UHCtoEUCKR); // cellL10n.AddFunc(0x7c5bde1c, UHCtoEUCKR);
// cellL10n->AddFunc(0x7c912bda, kuten2jis); // cellL10n.AddFunc(0x7c912bda, kuten2jis);
// cellL10n->AddFunc(0x7d07a1c2, UTF8toEUCCN); // cellL10n.AddFunc(0x7d07a1c2, UTF8toEUCCN);
// cellL10n->AddFunc(0x8171c1cc, EUCCNtoUTF8); // cellL10n.AddFunc(0x8171c1cc, EUCCNtoUTF8);
// cellL10n->AddFunc(0x82d5ecdf, EucJpZen2Han); // cellL10n.AddFunc(0x82d5ecdf, EucJpZen2Han);
// cellL10n->AddFunc(0x8555fe15, UTF32stoUTF16s); // cellL10n.AddFunc(0x8555fe15, UTF32stoUTF16s);
// cellL10n->AddFunc(0x860fc741, GBKtoUTF8); // cellL10n.AddFunc(0x860fc741, GBKtoUTF8);
// cellL10n->AddFunc(0x867f7b8b, ToEucJpUpper); // cellL10n.AddFunc(0x867f7b8b, ToEucJpUpper);
// cellL10n->AddFunc(0x88f8340b, UCS2stoJISs); // cellL10n.AddFunc(0x88f8340b, UCS2stoJISs);
// cellL10n->AddFunc(0x89236c86, UTF8stoGB18030s); // cellL10n.AddFunc(0x89236c86, UTF8stoGB18030s);
// cellL10n->AddFunc(0x8a56f148, EUCKRstoUHCs); // cellL10n.AddFunc(0x8a56f148, EUCKRstoUHCs);
// cellL10n->AddFunc(0x8ccdba38, UTF8stoUTF32s); // cellL10n.AddFunc(0x8ccdba38, UTF8stoUTF32s);
// cellL10n->AddFunc(0x8f472054, UTF8stoEUCCNs); // cellL10n.AddFunc(0x8f472054, UTF8stoEUCCNs);
// cellL10n->AddFunc(0x90e9b5d2, EUCJPstoUCS2s); // cellL10n.AddFunc(0x90e9b5d2, EUCJPstoUCS2s);
// cellL10n->AddFunc(0x91a99765, UHCtoUCS2); // cellL10n.AddFunc(0x91a99765, UHCtoUCS2);
cellL10n->AddFunc(0x931ff25a, L10nConvertStr); cellL10n.AddFunc(0x931ff25a, L10nConvertStr);
// cellL10n->AddFunc(0x949bb14c, GBKstoUTF8s); // cellL10n.AddFunc(0x949bb14c, GBKstoUTF8s);
// cellL10n->AddFunc(0x9557ac9b, UTF8toUHC); // cellL10n.AddFunc(0x9557ac9b, UTF8toUHC);
// cellL10n->AddFunc(0x9768b6d3, UTF32toUTF8); // cellL10n.AddFunc(0x9768b6d3, UTF32toUTF8);
// cellL10n->AddFunc(0x9874020d, sjis2eucjp); // cellL10n.AddFunc(0x9874020d, sjis2eucjp);
// cellL10n->AddFunc(0x9a0e7d23, UCS2toEUCCN); // cellL10n.AddFunc(0x9a0e7d23, UCS2toEUCCN);
// cellL10n->AddFunc(0x9a13d6b8, UTF8stoUHCs); // cellL10n.AddFunc(0x9a13d6b8, UTF8stoUHCs);
// cellL10n->AddFunc(0x9a72059d, EUCKRtoUCS2); // cellL10n.AddFunc(0x9a72059d, EUCKRtoUCS2);
// cellL10n->AddFunc(0x9b1210c6, UTF32toUTF16); // cellL10n.AddFunc(0x9b1210c6, UTF32toUTF16);
// cellL10n->AddFunc(0x9cd8135b, EUCCNstoUCS2s); // cellL10n.AddFunc(0x9cd8135b, EUCCNstoUCS2s);
// cellL10n->AddFunc(0x9ce52809, SBCSstoUCS2s); // cellL10n.AddFunc(0x9ce52809, SBCSstoUCS2s);
// cellL10n->AddFunc(0x9cf1ab77, UTF8stoJISs); // cellL10n.AddFunc(0x9cf1ab77, UTF8stoJISs);
// cellL10n->AddFunc(0x9d14dc46, ToSjisKata); // cellL10n.AddFunc(0x9d14dc46, ToSjisKata);
// cellL10n->AddFunc(0x9dcde367, jis2eucjp); // cellL10n.AddFunc(0x9dcde367, jis2eucjp);
// cellL10n->AddFunc(0x9ec52258, BIG5toUCS2); // cellL10n.AddFunc(0x9ec52258, BIG5toUCS2);
// cellL10n->AddFunc(0xa0d463c0, UCS2toGBK); // cellL10n.AddFunc(0xa0d463c0, UCS2toGBK);
// cellL10n->AddFunc(0xa19fb9de, UTF16toUTF32); // cellL10n.AddFunc(0xa19fb9de, UTF16toUTF32);
// cellL10n->AddFunc(0xa298cad2, l10n_convert_str); // cellL10n.AddFunc(0xa298cad2, l10n_convert_str);
// cellL10n->AddFunc(0xa34fa0eb, EUCJPstoJISs); // cellL10n.AddFunc(0xa34fa0eb, EUCJPstoJISs);
// cellL10n->AddFunc(0xa5146299, UTF8stoARIBs); // cellL10n.AddFunc(0xa5146299, UTF8stoARIBs);
// cellL10n->AddFunc(0xa609f3e9, JISstoEUCJPs); // cellL10n.AddFunc(0xa609f3e9, JISstoEUCJPs);
// cellL10n->AddFunc(0xa60ff5c9, EucJpHan2Zen); // cellL10n.AddFunc(0xa60ff5c9, EucJpHan2Zen);
// cellL10n->AddFunc(0xa963619c, isEucJpKigou); // cellL10n.AddFunc(0xa963619c, isEucJpKigou);
// cellL10n->AddFunc(0xa9a76fb8, UCS2toUTF8); // cellL10n.AddFunc(0xa9a76fb8, UCS2toUTF8);
// cellL10n->AddFunc(0xaf18d499, GB18030toUCS2); // cellL10n.AddFunc(0xaf18d499, GB18030toUCS2);
// cellL10n->AddFunc(0xb3361be6, UHCtoUTF8); // cellL10n.AddFunc(0xb3361be6, UHCtoUTF8);
// cellL10n->AddFunc(0xb6e45343, MSJIStoUCS2); // cellL10n.AddFunc(0xb6e45343, MSJIStoUCS2);
// cellL10n->AddFunc(0xb7cef4a6, UTF8toGBK); // cellL10n.AddFunc(0xb7cef4a6, UTF8toGBK);
// cellL10n->AddFunc(0xb7e08f7a, kuten2sjis); // cellL10n.AddFunc(0xb7e08f7a, kuten2sjis);
// cellL10n->AddFunc(0xb9cf473d, UTF8toSBCS); // cellL10n.AddFunc(0xb9cf473d, UTF8toSBCS);
// cellL10n->AddFunc(0xbdd44ee3, SJIStoUCS2); // cellL10n.AddFunc(0xbdd44ee3, SJIStoUCS2);
// cellL10n->AddFunc(0xbe42e661, eucjpzen2han); // cellL10n.AddFunc(0xbe42e661, eucjpzen2han);
// cellL10n->AddFunc(0xbe8d5485, UCS2stoARIBs); // cellL10n.AddFunc(0xbe8d5485, UCS2stoARIBs);
// cellL10n->AddFunc(0xbefe3869, isSjisKigou); // cellL10n.AddFunc(0xbefe3869, isSjisKigou);
// cellL10n->AddFunc(0xc62b758d, UTF8stoEUCJPs); // cellL10n.AddFunc(0xc62b758d, UTF8stoEUCJPs);
// cellL10n->AddFunc(0xc7bdcb4c, UCS2toEUCKR); // cellL10n.AddFunc(0xc7bdcb4c, UCS2toEUCKR);
// cellL10n->AddFunc(0xc944fa56, SBCStoUCS2); // cellL10n.AddFunc(0xc944fa56, SBCStoUCS2);
// cellL10n->AddFunc(0xc9b78f58, MSJISstoUCS2s); // cellL10n.AddFunc(0xc9b78f58, MSJISstoUCS2s);
// cellL10n->AddFunc(0xcc1633cc, l10n_get_converter); // cellL10n.AddFunc(0xcc1633cc, l10n_get_converter);
// cellL10n->AddFunc(0xd02ef83d, GB18030stoUTF8s); // cellL10n.AddFunc(0xd02ef83d, GB18030stoUTF8s);
// cellL10n->AddFunc(0xd8721e2c, SJISstoEUCJPs); // cellL10n.AddFunc(0xd8721e2c, SJISstoEUCJPs);
// cellL10n->AddFunc(0xd8cb24cb, UTF32stoUCS2s); // cellL10n.AddFunc(0xd8cb24cb, UTF32stoUCS2s);
// cellL10n->AddFunc(0xd990858b, BIG5stoUTF8s); // cellL10n.AddFunc(0xd990858b, BIG5stoUTF8s);
// cellL10n->AddFunc(0xd9fb1224, EUCCNtoUCS2); // cellL10n.AddFunc(0xd9fb1224, EUCCNtoUCS2);
// cellL10n->AddFunc(0xda67b37f, UTF8stoSBCSs); // cellL10n.AddFunc(0xda67b37f, UTF8stoSBCSs);
// cellL10n->AddFunc(0xdc54886c, UCS2stoEUCKRs); // cellL10n.AddFunc(0xdc54886c, UCS2stoEUCKRs);
// cellL10n->AddFunc(0xdd5ebdeb, UTF8stoSJISs); // cellL10n.AddFunc(0xdd5ebdeb, UTF8stoSJISs);
// cellL10n->AddFunc(0xdefa1c17, UTF8stoHZs); // cellL10n.AddFunc(0xdefa1c17, UTF8stoHZs);
// cellL10n->AddFunc(0xe2eabb32, eucjp2kuten); // cellL10n.AddFunc(0xe2eabb32, eucjp2kuten);
// cellL10n->AddFunc(0xe6d9e234, UTF8toBIG5); // cellL10n.AddFunc(0xe6d9e234, UTF8toBIG5);
// cellL10n->AddFunc(0xe6f5711b, UTF16stoUTF8s); // cellL10n.AddFunc(0xe6f5711b, UTF16stoUTF8s);
// cellL10n->AddFunc(0xe956dc64, JISstoUCS2s); // cellL10n.AddFunc(0xe956dc64, JISstoUCS2s);
// cellL10n->AddFunc(0xeabc3d00, GB18030toUTF8); // cellL10n.AddFunc(0xeabc3d00, GB18030toUTF8);
// cellL10n->AddFunc(0xeb3dc670, UTF8toSJIS); // cellL10n.AddFunc(0xeb3dc670, UTF8toSJIS);
// cellL10n->AddFunc(0xeb41cc68, ARIBstoUCS2s); // cellL10n.AddFunc(0xeb41cc68, ARIBstoUCS2s);
// cellL10n->AddFunc(0xeb685b83, UCS2stoUTF32s); // cellL10n.AddFunc(0xeb685b83, UCS2stoUTF32s);
// cellL10n->AddFunc(0xebae29c0, UCS2stoSBCSs); // cellL10n.AddFunc(0xebae29c0, UCS2stoSBCSs);
// cellL10n->AddFunc(0xee6c6a39, UCS2stoBIG5s); // cellL10n.AddFunc(0xee6c6a39, UCS2stoBIG5s);
// cellL10n->AddFunc(0xf1dcfa71, UCS2stoUHCs); // cellL10n.AddFunc(0xf1dcfa71, UCS2stoUHCs);
// cellL10n->AddFunc(0xf439728e, SJIStoEUCJP); // cellL10n.AddFunc(0xf439728e, SJIStoEUCJP);
// cellL10n->AddFunc(0xf7681b9a, UTF8stoUTF16s); // cellL10n.AddFunc(0xf7681b9a, UTF8stoUTF16s);
// cellL10n->AddFunc(0xf9b1896d, SJISstoUCS2s); // cellL10n.AddFunc(0xf9b1896d, SJISstoUCS2s);
// cellL10n->AddFunc(0xfa4a675a, BIG5stoUCS2s); // cellL10n.AddFunc(0xfa4a675a, BIG5stoUCS2s);
// cellL10n->AddFunc(0xfdbf6ac5, UTF8stoUCS2s); // cellL10n.AddFunc(0xfdbf6ac5, UTF8stoUCS2s);
} });

View file

@ -5,7 +5,7 @@
#include "cellMic.h" #include "cellMic.h"
Module *cellMic = nullptr; extern Module cellMic;
struct cellMicInternal struct cellMicInternal
{ {
@ -21,7 +21,7 @@ cellMicInternal CellMicInstance;
int cellMicInit() int cellMicInit()
{ {
cellMic->Warning("cellMicInit()"); cellMic.Warning("cellMicInit()");
if (CellMicInstance.m_bCellMicInitialized) if (CellMicInstance.m_bCellMicInitialized)
return CELL_MICIN_ERROR_ALREADY_INIT; return CELL_MICIN_ERROR_ALREADY_INIT;
@ -33,7 +33,7 @@ int cellMicInit()
int cellMicEnd() int cellMicEnd()
{ {
cellMic->Warning("cellMicEnd()"); cellMic.Warning("cellMicEnd()");
if (!CellMicInstance.m_bCellMicInitialized) if (!CellMicInstance.m_bCellMicInitialized)
return CELL_MICIN_ERROR_NOT_INIT; return CELL_MICIN_ERROR_NOT_INIT;
@ -288,55 +288,53 @@ void cellMic_unload()
CellMicInstance.m_bCellMicInitialized = false; CellMicInstance.m_bCellMicInitialized = false;
} }
void cellMic_init(Module *pxThis) Module cellMic("cellMic", []()
{ {
cellMic = pxThis; cellMic.AddFunc(0x8325e02d, cellMicInit);
cellMic.AddFunc(0xc6328caa, cellMicEnd);
cellMic.AddFunc(0xdd1b59f0, cellMicOpen);
cellMic.AddFunc(0x8d229f8e, cellMicClose);
cellMic->AddFunc(0x8325e02d, cellMicInit); cellMic.AddFunc(0x017024a8, cellMicGetDeviceGUID);
cellMic->AddFunc(0xc6328caa, cellMicEnd); cellMic.AddFunc(0xa52d2ae4, cellMicGetType);
cellMic->AddFunc(0xdd1b59f0, cellMicOpen); cellMic.AddFunc(0x1b42101b, cellMicIsAttached);
cellMic->AddFunc(0x8d229f8e, cellMicClose); cellMic.AddFunc(0x186cb1fb, cellMicIsOpen);
cellMic.AddFunc(0x6a024aa0, cellMicGetDeviceAttr);
cellMic.AddFunc(0xb2c16321, cellMicSetDeviceAttr);
cellMic.AddFunc(0xac5ba03a, cellMicGetSignalAttr);
cellMic.AddFunc(0x323deb41, cellMicSetSignalAttr);
cellMic.AddFunc(0xb30780eb, cellMicGetSignalState);
cellMic->AddFunc(0x017024a8, cellMicGetDeviceGUID); cellMic.AddFunc(0xdd724314, cellMicStart);
cellMic->AddFunc(0xa52d2ae4, cellMicGetType); cellMic.AddFunc(0x07e1b12c, cellMicRead);
cellMic->AddFunc(0x1b42101b, cellMicIsAttached); cellMic.AddFunc(0xfcfaf246, cellMicStop);
cellMic->AddFunc(0x186cb1fb, cellMicIsOpen); cellMic.AddFunc(0x6bc46aab, cellMicReset);
cellMic->AddFunc(0x6a024aa0, cellMicGetDeviceAttr);
cellMic->AddFunc(0xb2c16321, cellMicSetDeviceAttr);
cellMic->AddFunc(0xac5ba03a, cellMicGetSignalAttr);
cellMic->AddFunc(0x323deb41, cellMicSetSignalAttr);
cellMic->AddFunc(0xb30780eb, cellMicGetSignalState);
cellMic->AddFunc(0xdd724314, cellMicStart); cellMic.AddFunc(0x7903400e, cellMicSetNotifyEventQueue);
cellMic->AddFunc(0x07e1b12c, cellMicRead); cellMic.AddFunc(0x6cc7ae00, cellMicSetNotifyEventQueue2);
cellMic->AddFunc(0xfcfaf246, cellMicStop); cellMic.AddFunc(0x65336418, cellMicRemoveNotifyEventQueue);
cellMic->AddFunc(0x6bc46aab, cellMicReset);
cellMic->AddFunc(0x7903400e, cellMicSetNotifyEventQueue); cellMic.AddFunc(0x05709bbf, cellMicOpenEx);
cellMic->AddFunc(0x6cc7ae00, cellMicSetNotifyEventQueue2); cellMic.AddFunc(0xddd19a89, cellMicStartEx);
cellMic->AddFunc(0x65336418, cellMicRemoveNotifyEventQueue); cellMic.AddFunc(0x4e0b69ee, cellMicGetFormatRaw);
cellMic.AddFunc(0xfda12276, cellMicGetFormatAux);
cellMic.AddFunc(0x87a08d29, cellMicGetFormatDsp);
cellMic.AddFunc(0xa42ac07a, cellMicOpenRaw);
cellMic.AddFunc(0x72165a7f, cellMicReadRaw);
cellMic.AddFunc(0x3acc118e, cellMicReadAux);
cellMic.AddFunc(0xc414faa5, cellMicReadDsp);
cellMic->AddFunc(0x05709bbf, cellMicOpenEx); cellMic.AddFunc(0x25c5723f, cellMicGetStatus);
cellMic->AddFunc(0xddd19a89, cellMicStartEx); cellMic.AddFunc(0xe839380f, cellMicStopEx);
cellMic->AddFunc(0x4e0b69ee, cellMicGetFormatRaw); cellMic.AddFunc(0x3ace58f3, cellMicSysShareClose);
cellMic->AddFunc(0xfda12276, cellMicGetFormatAux); cellMic.AddFunc(0x48108a23, cellMicGetFormat);
cellMic->AddFunc(0x87a08d29, cellMicGetFormatDsp); cellMic.AddFunc(0x891c6291, cellMicSetMultiMicNotifyEventQueue);
cellMic->AddFunc(0xa42ac07a, cellMicOpenRaw); cellMic.AddFunc(0xad049ecf, cellMicGetFormatEx);
cellMic->AddFunc(0x72165a7f, cellMicReadRaw); cellMic.AddFunc(0xbdfd51e2, cellMicSysShareStop);
cellMic->AddFunc(0x3acc118e, cellMicReadAux); cellMic.AddFunc(0xc3610dbd, cellMicSysShareOpen);
cellMic->AddFunc(0xc414faa5, cellMicReadDsp); cellMic.AddFunc(0xc461563c, cellMicCommand);
cellMic.AddFunc(0xcac7e7d7, cellMicSysShareStart);
cellMic->AddFunc(0x25c5723f, cellMicGetStatus); cellMic.AddFunc(0xd127cd3e, cellMicSysShareInit);
cellMic->AddFunc(0xe839380f, cellMicStopEx); cellMic.AddFunc(0xf82bbf7c, cellMicSysShareEnd);
cellMic->AddFunc(0x3ace58f3, cellMicSysShareClose); cellMic.AddFunc(0xfdbbe469, cellMicGetDeviceIdentifier);
cellMic->AddFunc(0x48108a23, cellMicGetFormat); });
cellMic->AddFunc(0x891c6291, cellMicSetMultiMicNotifyEventQueue);
cellMic->AddFunc(0xad049ecf, cellMicGetFormatEx);
cellMic->AddFunc(0xbdfd51e2, cellMicSysShareStop);
cellMic->AddFunc(0xc3610dbd, cellMicSysShareOpen);
cellMic->AddFunc(0xc461563c, cellMicCommand);
cellMic->AddFunc(0xcac7e7d7, cellMicSysShareStart);
cellMic->AddFunc(0xd127cd3e, cellMicSysShareInit);
cellMic->AddFunc(0xf82bbf7c, cellMicSysShareEnd);
cellMic->AddFunc(0xfdbbe469, cellMicGetDeviceIdentifier);
}

View file

@ -6,11 +6,11 @@
#include "Emu/Io/Mouse.h" #include "Emu/Io/Mouse.h"
#include "cellMouse.h" #include "cellMouse.h"
extern Module *sys_io; extern Module sys_io;
int cellMouseInit(u32 max_connect) int cellMouseInit(u32 max_connect)
{ {
sys_io->Warning("cellMouseInit(max_connect=%d)", max_connect); sys_io.Warning("cellMouseInit(max_connect=%d)", max_connect);
if(Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_ALREADY_INITIALIZED; if(Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_ALREADY_INITIALIZED;
if(max_connect > 7) return CELL_MOUSE_ERROR_INVALID_PARAMETER; if(max_connect > 7) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
@ -21,7 +21,7 @@ int cellMouseInit(u32 max_connect)
int cellMouseClearBuf(u32 port_no) int cellMouseClearBuf(u32 port_no)
{ {
sys_io->Log("cellMouseClearBuf(port_no=%d)", port_no); sys_io.Log("cellMouseClearBuf(port_no=%d)", port_no);
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_INVALID_PARAMETER; if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
@ -32,7 +32,7 @@ int cellMouseClearBuf(u32 port_no)
int cellMouseEnd() int cellMouseEnd()
{ {
sys_io->Log("cellMouseEnd()"); sys_io.Log("cellMouseEnd()");
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
Emu.GetMouseManager().Close(); Emu.GetMouseManager().Close();
return CELL_OK; return CELL_OK;
@ -40,7 +40,7 @@ int cellMouseEnd()
int cellMouseGetInfo(vm::ptr<CellMouseInfo> info) int cellMouseGetInfo(vm::ptr<CellMouseInfo> info)
{ {
sys_io->Log("cellMouseGetInfo(info_addr=0x%x)", info.addr()); sys_io.Log("cellMouseGetInfo(info_addr=0x%x)", info.addr());
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
const MouseInfo& current_info = Emu.GetMouseManager().GetInfo(); const MouseInfo& current_info = Emu.GetMouseManager().GetInfo();
@ -56,7 +56,7 @@ int cellMouseGetInfo(vm::ptr<CellMouseInfo> info)
int cellMouseInfoTabletMode(u32 port_no, vm::ptr<CellMouseInfoTablet> info) int cellMouseInfoTabletMode(u32 port_no, vm::ptr<CellMouseInfoTablet> info)
{ {
sys_io->Log("cellMouseInfoTabletMode(port_no=%d,info_addr=0x%x)", port_no, info.addr()); sys_io.Log("cellMouseInfoTabletMode(port_no=%d,info_addr=0x%x)", port_no, info.addr());
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_INVALID_PARAMETER; if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
@ -68,7 +68,7 @@ int cellMouseInfoTabletMode(u32 port_no, vm::ptr<CellMouseInfoTablet> info)
int cellMouseGetData(u32 port_no, vm::ptr<CellMouseData> data) int cellMouseGetData(u32 port_no, vm::ptr<CellMouseData> data)
{ {
sys_io->Log("cellMouseGetData(port_no=%d,data_addr=0x%x)", port_no, data.addr()); sys_io.Log("cellMouseGetData(port_no=%d,data_addr=0x%x)", port_no, data.addr());
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_NO_DEVICE; if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_NO_DEVICE;
@ -113,7 +113,7 @@ int cellMouseGetRawData(u32 port_no, u32 data_addr)
{ {
UNIMPLEMENTED_FUNC(sys_io); UNIMPLEMENTED_FUNC(sys_io);
/*sys_io->Log("cellMouseGetRawData(port_no=%d,data_addr=0x%x)", port_no, data.addr()); /*sys_io.Log("cellMouseGetRawData(port_no=%d,data_addr=0x%x)", port_no, data.addr());
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_NO_DEVICE; if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_NO_DEVICE;
@ -131,14 +131,14 @@ int cellMouseGetRawData(u32 port_no, u32 data_addr)
void cellMouse_init() void cellMouse_init()
{ {
sys_io->AddFunc(0xc9030138, cellMouseInit); sys_io.AddFunc(0xc9030138, cellMouseInit);
sys_io->AddFunc(0x3ef66b95, cellMouseClearBuf); sys_io.AddFunc(0x3ef66b95, cellMouseClearBuf);
sys_io->AddFunc(0xe10183ce, cellMouseEnd); sys_io.AddFunc(0xe10183ce, cellMouseEnd);
sys_io->AddFunc(0x5baf30fb, cellMouseGetInfo); sys_io.AddFunc(0x5baf30fb, cellMouseGetInfo);
sys_io->AddFunc(0x4d0b3b1f, cellMouseInfoTabletMode); sys_io.AddFunc(0x4d0b3b1f, cellMouseInfoTabletMode);
sys_io->AddFunc(0x3138e632, cellMouseGetData); sys_io.AddFunc(0x3138e632, cellMouseGetData);
sys_io->AddFunc(0x6bd131f0, cellMouseGetDataList); sys_io.AddFunc(0x6bd131f0, cellMouseGetDataList);
sys_io->AddFunc(0x2d16da4f, cellMouseSetTabletMode); sys_io.AddFunc(0x2d16da4f, cellMouseSetTabletMode);
sys_io->AddFunc(0x21a62e9b, cellMouseGetTabletDataList); sys_io.AddFunc(0x21a62e9b, cellMouseGetTabletDataList);
sys_io->AddFunc(0xa328cc35, cellMouseGetRawData); sys_io.AddFunc(0xa328cc35, cellMouseGetRawData);
} }

View file

@ -11,7 +11,7 @@
#include "cellSysutil.h" #include "cellSysutil.h"
#include "cellMsgDialog.h" #include "cellMsgDialog.h"
extern Module *cellSysutil; extern Module cellSysutil;
enum MsgDialogState enum MsgDialogState
{ {
@ -49,7 +49,7 @@ void MsgDialogClose()
s32 cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgDialogCallback> callback, u32 userData, u32 extParam) s32 cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgDialogCallback> callback, u32 userData, u32 extParam)
{ {
cellSysutil->Warning("cellMsgDialogOpen2(type=0x%x, msgString_addr=0x%x, callback_addr=0x%x, userData=0x%x, extParam=0x%x)", cellSysutil.Warning("cellMsgDialogOpen2(type=0x%x, msgString_addr=0x%x, callback_addr=0x%x, userData=0x%x, extParam=0x%x)",
type, msgString.addr(), callback.addr(), userData, extParam); type, msgString.addr(), callback.addr(), userData, extParam);
if (!msgString || strlen(msgString.get_ptr()) >= 0x200 || type & -0x33f8) if (!msgString || strlen(msgString.get_ptr()) >= 0x200 || type & -0x33f8)
@ -153,7 +153,7 @@ s32 cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgD
{ {
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
cellSysutil->Warning("MsgDialog thread aborted"); cellSysutil.Warning("MsgDialog thread aborted");
return; return;
} }
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
@ -192,7 +192,7 @@ s32 cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgD
s32 cellMsgDialogOpenErrorCode(u32 errorCode, vm::ptr<CellMsgDialogCallback> callback, u32 userData, u32 extParam) s32 cellMsgDialogOpenErrorCode(u32 errorCode, vm::ptr<CellMsgDialogCallback> callback, u32 userData, u32 extParam)
{ {
cellSysutil->Warning("cellMsgDialogOpenErrorCode(errorCode=0x%x, callback_addr=0x%x, userData=0x%x, extParam=%d)", cellSysutil.Warning("cellMsgDialogOpenErrorCode(errorCode=0x%x, callback_addr=0x%x, userData=0x%x, extParam=%d)",
errorCode, callback.addr(), userData, extParam); errorCode, callback.addr(), userData, extParam);
std::string errorMessage; std::string errorMessage;
@ -295,7 +295,7 @@ s32 cellMsgDialogOpenErrorCode(u32 errorCode, vm::ptr<CellMsgDialogCallback> cal
s32 cellMsgDialogClose(float delay) s32 cellMsgDialogClose(float delay)
{ {
cellSysutil->Warning("cellMsgDialogClose(delay=%f)", delay); cellSysutil.Warning("cellMsgDialogClose(delay=%f)", delay);
MsgDialogState old = msgDialogOpen; MsgDialogState old = msgDialogOpen;
if (!g_msg_dialog_state.compare_exchange_strong(old, msgDialogClose)) if (!g_msg_dialog_state.compare_exchange_strong(old, msgDialogClose))
@ -317,7 +317,7 @@ s32 cellMsgDialogClose(float delay)
s32 cellMsgDialogAbort() s32 cellMsgDialogAbort()
{ {
cellSysutil->Warning("cellMsgDialogAbort()"); cellSysutil.Warning("cellMsgDialogAbort()");
MsgDialogState old = msgDialogOpen; MsgDialogState old = msgDialogOpen;
if (!g_msg_dialog_state.compare_exchange_strong(old, msgDialogAbort)) if (!g_msg_dialog_state.compare_exchange_strong(old, msgDialogAbort))
@ -338,7 +338,7 @@ s32 cellMsgDialogAbort()
s32 cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::ptr<const char> msgString) s32 cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::ptr<const char> msgString)
{ {
cellSysutil->Warning("cellMsgDialogProgressBarSetMsg(progressBarIndex=%d, msgString_addr=0x%x ['%s'])", cellSysutil.Warning("cellMsgDialogProgressBarSetMsg(progressBarIndex=%d, msgString_addr=0x%x ['%s'])",
progressBarIndex, msgString.addr(), msgString.get_ptr()); progressBarIndex, msgString.addr(), msgString.get_ptr());
if (g_msg_dialog_state != msgDialogOpen) if (g_msg_dialog_state != msgDialogOpen)
@ -362,7 +362,7 @@ s32 cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::ptr<const char> msg
s32 cellMsgDialogProgressBarReset(u32 progressBarIndex) s32 cellMsgDialogProgressBarReset(u32 progressBarIndex)
{ {
cellSysutil->Warning("cellMsgDialogProgressBarReset(progressBarIndex=%d)", progressBarIndex); cellSysutil.Warning("cellMsgDialogProgressBarReset(progressBarIndex=%d)", progressBarIndex);
if (g_msg_dialog_state != msgDialogOpen) if (g_msg_dialog_state != msgDialogOpen)
{ {
@ -383,7 +383,7 @@ s32 cellMsgDialogProgressBarReset(u32 progressBarIndex)
s32 cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta) s32 cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta)
{ {
cellSysutil->Warning("cellMsgDialogProgressBarInc(progressBarIndex=%d, delta=%d)", progressBarIndex, delta); cellSysutil.Warning("cellMsgDialogProgressBarInc(progressBarIndex=%d, delta=%d)", progressBarIndex, delta);
if (g_msg_dialog_state != msgDialogOpen) if (g_msg_dialog_state != msgDialogOpen)
{ {

View file

@ -6,7 +6,7 @@
#include "cellSysutil.h" #include "cellSysutil.h"
#include "cellNetCtl.h" #include "cellNetCtl.h"
Module *cellNetCtl; extern Module cellNetCtl;
struct cellNetCtlInternal struct cellNetCtlInternal
{ {
@ -22,7 +22,7 @@ cellNetCtlInternal cellNetCtlInstance;
int cellNetCtlInit() int cellNetCtlInit()
{ {
cellNetCtl->Warning("cellNetCtlInit()"); cellNetCtl.Warning("cellNetCtlInit()");
if (cellNetCtlInstance.m_bInitialized) if (cellNetCtlInstance.m_bInitialized)
return CELL_NET_CTL_ERROR_NOT_TERMINATED; return CELL_NET_CTL_ERROR_NOT_TERMINATED;
@ -34,7 +34,7 @@ int cellNetCtlInit()
int cellNetCtlTerm() int cellNetCtlTerm()
{ {
cellNetCtl->Warning("cellNetCtlTerm()"); cellNetCtl.Warning("cellNetCtlTerm()");
if (!cellNetCtlInstance.m_bInitialized) if (!cellNetCtlInstance.m_bInitialized)
return CELL_NET_CTL_ERROR_NOT_INITIALIZED; return CELL_NET_CTL_ERROR_NOT_INITIALIZED;
@ -46,7 +46,7 @@ int cellNetCtlTerm()
int cellNetCtlGetState(vm::ptr<u32> state) int cellNetCtlGetState(vm::ptr<u32> state)
{ {
cellNetCtl->Warning("cellNetCtlGetState(state_addr=0x%x)", state.addr()); cellNetCtl.Warning("cellNetCtlGetState(state_addr=0x%x)", state.addr());
*state = CELL_NET_CTL_STATE_Disconnected; // TODO: Allow other states *state = CELL_NET_CTL_STATE_Disconnected; // TODO: Allow other states
@ -55,28 +55,33 @@ int cellNetCtlGetState(vm::ptr<u32> state)
int cellNetCtlAddHandler(vm::ptr<cellNetCtlHandler> handler, vm::ptr<void> arg, vm::ptr<s32> hid) int cellNetCtlAddHandler(vm::ptr<cellNetCtlHandler> handler, vm::ptr<void> arg, vm::ptr<s32> hid)
{ {
cellNetCtl->Todo("cellNetCtlAddHandler(handler_addr=0x%x, arg_addr=0x%x, hid_addr=0x%x)", handler.addr(), arg.addr(), hid.addr()); cellNetCtl.Todo("cellNetCtlAddHandler(handler_addr=0x%x, arg_addr=0x%x, hid_addr=0x%x)", handler.addr(), arg.addr(), hid.addr());
return CELL_OK; return CELL_OK;
} }
int cellNetCtlDelHandler(s32 hid) int cellNetCtlDelHandler(s32 hid)
{ {
cellNetCtl->Todo("cellNetCtlDelHandler(hid=0x%x)", hid); cellNetCtl.Todo("cellNetCtlDelHandler(hid=0x%x)", hid);
return CELL_OK; return CELL_OK;
} }
int cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> info) int cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> info)
{ {
cellNetCtl->Todo("cellNetCtlGetInfo(code=0x%x, info_addr=0x%x)", code, info.addr()); cellNetCtl.Todo("cellNetCtlGetInfo(code=0x%x, info_addr=0x%x)", code, info.addr());
if (code == CELL_NET_CTL_INFO_IP_ADDRESS)
{
strcpy_trunc(info->ip_address, "192.168.1.1");
}
return CELL_OK; return CELL_OK;
} }
int cellNetCtlNetStartDialogLoadAsync(vm::ptr<CellNetCtlNetStartDialogParam> param) int cellNetCtlNetStartDialogLoadAsync(vm::ptr<CellNetCtlNetStartDialogParam> param)
{ {
cellNetCtl->Warning("cellNetCtlNetStartDialogLoadAsync(param_addr=0x%x)", param.addr()); cellNetCtl.Warning("cellNetCtlNetStartDialogLoadAsync(param_addr=0x%x)", param.addr());
// TODO: Actually sign into PSN // TODO: Actually sign into PSN
sysutilSendSystemCommand(CELL_SYSUTIL_NET_CTL_NETSTART_FINISHED, 0); sysutilSendSystemCommand(CELL_SYSUTIL_NET_CTL_NETSTART_FINISHED, 0);
@ -85,14 +90,14 @@ int cellNetCtlNetStartDialogLoadAsync(vm::ptr<CellNetCtlNetStartDialogParam> par
int cellNetCtlNetStartDialogAbortAsync() int cellNetCtlNetStartDialogAbortAsync()
{ {
cellNetCtl->Todo("cellNetCtlNetStartDialogAbortAsync()"); cellNetCtl.Todo("cellNetCtlNetStartDialogAbortAsync()");
return CELL_OK; return CELL_OK;
} }
int cellNetCtlNetStartDialogUnloadAsync(vm::ptr<CellNetCtlNetStartDialogResult> result) int cellNetCtlNetStartDialogUnloadAsync(vm::ptr<CellNetCtlNetStartDialogResult> result)
{ {
cellNetCtl->Warning("cellNetCtlNetStartDialogUnloadAsync(result_addr=0x%x)", result.addr()); cellNetCtl.Warning("cellNetCtlNetStartDialogUnloadAsync(result_addr=0x%x)", result.addr());
sysutilSendSystemCommand(CELL_SYSUTIL_NET_CTL_NETSTART_UNLOADED, 0); sysutilSendSystemCommand(CELL_SYSUTIL_NET_CTL_NETSTART_UNLOADED, 0);
return CELL_OK; return CELL_OK;
@ -100,11 +105,11 @@ int cellNetCtlNetStartDialogUnloadAsync(vm::ptr<CellNetCtlNetStartDialogResult>
int cellNetCtlGetNatInfo(vm::ptr<CellNetCtlNatInfo> natInfo) int cellNetCtlGetNatInfo(vm::ptr<CellNetCtlNatInfo> natInfo)
{ {
cellNetCtl->Todo("cellNetCtlGetNatInfo(natInfo_addr=0x%x)", natInfo.addr()); cellNetCtl.Todo("cellNetCtlGetNatInfo(natInfo_addr=0x%x)", natInfo.addr());
if (natInfo->size == 0) if (natInfo->size == 0)
{ {
cellNetCtl->Error("cellNetCtlGetNatInfo : CELL_NET_CTL_ERROR_INVALID_SIZE"); cellNetCtl.Error("cellNetCtlGetNatInfo : CELL_NET_CTL_ERROR_INVALID_SIZE");
return CELL_NET_CTL_ERROR_INVALID_SIZE; return CELL_NET_CTL_ERROR_INVALID_SIZE;
} }
@ -116,22 +121,20 @@ void cellNetCtl_unload()
cellNetCtlInstance.m_bInitialized = false; cellNetCtlInstance.m_bInitialized = false;
} }
void cellNetCtl_init(Module *pxThis) Module cellNetCtl("cellNetCtl", []()
{ {
cellNetCtl = pxThis; cellNetCtl.AddFunc(0xbd5a59fc, cellNetCtlInit);
cellNetCtl.AddFunc(0x105ee2cb, cellNetCtlTerm);
cellNetCtl->AddFunc(0xbd5a59fc, cellNetCtlInit); cellNetCtl.AddFunc(0x8b3eba69, cellNetCtlGetState);
cellNetCtl->AddFunc(0x105ee2cb, cellNetCtlTerm); cellNetCtl.AddFunc(0x0ce13c6b, cellNetCtlAddHandler);
cellNetCtl.AddFunc(0x901815c3, cellNetCtlDelHandler);
cellNetCtl->AddFunc(0x8b3eba69, cellNetCtlGetState); cellNetCtl.AddFunc(0x1e585b5d, cellNetCtlGetInfo);
cellNetCtl->AddFunc(0x0ce13c6b, cellNetCtlAddHandler);
cellNetCtl->AddFunc(0x901815c3, cellNetCtlDelHandler);
cellNetCtl->AddFunc(0x1e585b5d, cellNetCtlGetInfo); cellNetCtl.AddFunc(0x04459230, cellNetCtlNetStartDialogLoadAsync);
cellNetCtl.AddFunc(0x71d53210, cellNetCtlNetStartDialogAbortAsync);
cellNetCtl.AddFunc(0x0f1f13d3, cellNetCtlNetStartDialogUnloadAsync);
cellNetCtl->AddFunc(0x04459230, cellNetCtlNetStartDialogLoadAsync); cellNetCtl.AddFunc(0x3a12865f, cellNetCtlGetNatInfo);
cellNetCtl->AddFunc(0x71d53210, cellNetCtlNetStartDialogAbortAsync); });
cellNetCtl->AddFunc(0x0f1f13d3, cellNetCtlNetStartDialogUnloadAsync);
cellNetCtl->AddFunc(0x3a12865f, cellNetCtlGetNatInfo);
}

View file

@ -2,7 +2,7 @@
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
Module *cellOvis = nullptr; extern Module cellOvis;
// Return Codes // Return Codes
enum enum
@ -14,7 +14,7 @@ enum
int cellOvisGetOverlayTableSize(vm::ptr<const char> elf) int cellOvisGetOverlayTableSize(vm::ptr<const char> elf)
{ {
cellOvis->Todo("cellOvisGetOverlayTableSize(elf_addr=0x%x)", elf.addr()); cellOvis.Todo("cellOvisGetOverlayTableSize(elf_addr=0x%x)", elf.addr());
return CELL_OK; return CELL_OK;
} }
@ -36,12 +36,10 @@ int cellOvisInvalidateOverlappedSegments()
return CELL_OK; return CELL_OK;
} }
void cellOvis_init(Module *pxThis) Module cellOvis("cellOvis", []()
{ {
cellOvis = pxThis; cellOvis.AddFunc(0x82f294b2, cellOvisGetOverlayTableSize);
cellOvis.AddFunc(0xa876c911, cellOvisInitializeOverlayTable);
cellOvis->AddFunc(0x82f294b2, cellOvisGetOverlayTableSize); cellOvis.AddFunc(0xce6cb776, cellOvisFixSpuSegments);
cellOvis->AddFunc(0xa876c911, cellOvisInitializeOverlayTable); cellOvis.AddFunc(0x629ba0c0, cellOvisInvalidateOverlappedSegments);
cellOvis->AddFunc(0xce6cb776, cellOvisFixSpuSegments); });
cellOvis->AddFunc(0x629ba0c0, cellOvisInvalidateOverlappedSegments);
}

View file

@ -6,11 +6,11 @@
#include "Emu/Io/Pad.h" #include "Emu/Io/Pad.h"
#include "cellPad.h" #include "cellPad.h"
extern Module *sys_io; extern Module sys_io;
int cellPadInit(u32 max_connect) int cellPadInit(u32 max_connect)
{ {
sys_io->Warning("cellPadInit(max_connect=%d)", max_connect); sys_io.Warning("cellPadInit(max_connect=%d)", max_connect);
if(Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_ALREADY_INITIALIZED; if(Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_ALREADY_INITIALIZED;
if (max_connect > CELL_PAD_MAX_PORT_NUM) return CELL_PAD_ERROR_INVALID_PARAMETER; if (max_connect > CELL_PAD_MAX_PORT_NUM) return CELL_PAD_ERROR_INVALID_PARAMETER;
Emu.GetPadManager().Init(max_connect); Emu.GetPadManager().Init(max_connect);
@ -19,7 +19,7 @@ int cellPadInit(u32 max_connect)
int cellPadEnd() int cellPadEnd()
{ {
sys_io->Log("cellPadEnd()"); sys_io.Log("cellPadEnd()");
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
Emu.GetPadManager().Close(); Emu.GetPadManager().Close();
return CELL_OK; return CELL_OK;
@ -27,7 +27,7 @@ int cellPadEnd()
int cellPadClearBuf(u32 port_no) int cellPadClearBuf(u32 port_no)
{ {
sys_io->Log("cellPadClearBuf(port_no=%d)", port_no); sys_io.Log("cellPadClearBuf(port_no=%d)", port_no);
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER; if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER;
@ -56,7 +56,7 @@ int cellPadClearBuf(u32 port_no)
int cellPadPeriphGetInfo(vm::ptr<CellPadPeriphInfo> info) int cellPadPeriphGetInfo(vm::ptr<CellPadPeriphInfo> info)
{ {
sys_io->Warning("cellPadPeriphGetInfo(info_addr=0x%x)", info.addr()); sys_io.Warning("cellPadPeriphGetInfo(info_addr=0x%x)", info.addr());
// TODO: Support other types of controllers // TODO: Support other types of controllers
for (int i = 0; i < info->now_connect; i++) for (int i = 0; i < info->now_connect; i++)
@ -69,7 +69,7 @@ int cellPadPeriphGetInfo(vm::ptr<CellPadPeriphInfo> info)
int cellPadGetData(u32 port_no, vm::ptr<CellPadData> data) int cellPadGetData(u32 port_no, vm::ptr<CellPadData> data)
{ {
sys_io->Log("cellPadGetData(port_no=%d, data_addr=0x%x)", port_no, data.addr()); sys_io.Log("cellPadGetData(port_no=%d, data_addr=0x%x)", port_no, data.addr());
std::vector<Pad>& pads = Emu.GetPadManager().GetPads(); std::vector<Pad>& pads = Emu.GetPadManager().GetPads();
@ -251,7 +251,7 @@ int cellPadGetData(u32 port_no, vm::ptr<CellPadData> data)
int cellPadGetDataExtra(u32 port_no, u32 device_type_addr, u32 data_addr) int cellPadGetDataExtra(u32 port_no, u32 device_type_addr, u32 data_addr)
{ {
sys_io->Log("cellPadGetDataExtra(port_no=%d, device_type_addr=0x%x, device_type_addr=0x%x)", port_no, device_type_addr, data_addr); sys_io.Log("cellPadGetDataExtra(port_no=%d, device_type_addr=0x%x, device_type_addr=0x%x)", port_no, device_type_addr, data_addr);
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER; if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER;
@ -262,7 +262,7 @@ int cellPadGetDataExtra(u32 port_no, u32 device_type_addr, u32 data_addr)
int cellPadSetActDirect(u32 port_no, u32 param_addr) int cellPadSetActDirect(u32 port_no, u32 param_addr)
{ {
sys_io->Log("cellPadSetActDirect(port_no=%d, param_addr=0x%x)", port_no, param_addr); sys_io.Log("cellPadSetActDirect(port_no=%d, param_addr=0x%x)", port_no, param_addr);
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER; if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER;
@ -273,7 +273,7 @@ int cellPadSetActDirect(u32 port_no, u32 param_addr)
int cellPadGetInfo(vm::ptr<CellPadInfo> info) int cellPadGetInfo(vm::ptr<CellPadInfo> info)
{ {
sys_io->Log("cellPadGetInfo(info_addr=0x%x)", info.addr()); sys_io.Log("cellPadGetInfo(info_addr=0x%x)", info.addr());
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
@ -301,7 +301,7 @@ int cellPadGetInfo(vm::ptr<CellPadInfo> info)
int cellPadGetInfo2(vm::ptr<CellPadInfo2> info) int cellPadGetInfo2(vm::ptr<CellPadInfo2> info)
{ {
sys_io->Log("cellPadGetInfo2(info_addr=0x%x)", info.addr()); sys_io.Log("cellPadGetInfo2(info_addr=0x%x)", info.addr());
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
@ -329,7 +329,7 @@ int cellPadGetInfo2(vm::ptr<CellPadInfo2> info)
int cellPadGetCapabilityInfo(u32 port_no, vm::ptr<CellCapabilityInfo> info) int cellPadGetCapabilityInfo(u32 port_no, vm::ptr<CellCapabilityInfo> info)
{ {
sys_io->Log("cellPadGetCapabilityInfo(port_no=%d, data_addr:=0x%x)", port_no, info.addr()); sys_io.Log("cellPadGetCapabilityInfo(port_no=%d, data_addr:=0x%x)", port_no, info.addr());
if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
@ -346,7 +346,7 @@ int cellPadGetCapabilityInfo(u32 port_no, vm::ptr<CellCapabilityInfo> info)
int cellPadSetPortSetting(u32 port_no, u32 port_setting) int cellPadSetPortSetting(u32 port_no, u32 port_setting)
{ {
sys_io->Log("cellPadSetPortSetting(port_no=%d, port_setting=0x%x)", port_no, port_setting); sys_io.Log("cellPadSetPortSetting(port_no=%d, port_setting=0x%x)", port_no, port_setting);
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER; if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER;
@ -360,7 +360,7 @@ int cellPadSetPortSetting(u32 port_no, u32 port_setting)
int cellPadInfoPressMode(u32 port_no) int cellPadInfoPressMode(u32 port_no)
{ {
sys_io->Log("cellPadInfoPressMode(port_no=%d)", port_no); sys_io.Log("cellPadInfoPressMode(port_no=%d)", port_no);
if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER; if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER;
@ -373,7 +373,7 @@ int cellPadInfoPressMode(u32 port_no)
int cellPadInfoSensorMode(u32 port_no) int cellPadInfoSensorMode(u32 port_no)
{ {
sys_io->Log("cellPadInfoSensorMode(port_no=%d)", port_no); sys_io.Log("cellPadInfoSensorMode(port_no=%d)", port_no);
if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER; if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER;
@ -386,7 +386,7 @@ int cellPadInfoSensorMode(u32 port_no)
int cellPadSetPressMode(u32 port_no, u32 mode) int cellPadSetPressMode(u32 port_no, u32 mode)
{ {
sys_io->Log("cellPadSetPressMode(port_no=%d, mode=%d)", port_no, mode); sys_io.Log("cellPadSetPressMode(port_no=%d, mode=%d)", port_no, mode);
if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
if (mode != 0 && mode != 1) return CELL_PAD_ERROR_INVALID_PARAMETER; if (mode != 0 && mode != 1) return CELL_PAD_ERROR_INVALID_PARAMETER;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
@ -405,7 +405,7 @@ int cellPadSetPressMode(u32 port_no, u32 mode)
int cellPadSetSensorMode(u32 port_no, u32 mode) int cellPadSetSensorMode(u32 port_no, u32 mode)
{ {
sys_io->Log("cellPadSetSensorMode(port_no=%d, mode=%d)", port_no, mode); sys_io.Log("cellPadSetSensorMode(port_no=%d, mode=%d)", port_no, mode);
if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
if (mode != 0 && mode != 1) return CELL_PAD_ERROR_INVALID_PARAMETER; if (mode != 0 && mode != 1) return CELL_PAD_ERROR_INVALID_PARAMETER;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
@ -424,19 +424,19 @@ int cellPadSetSensorMode(u32 port_no, u32 mode)
void cellPad_init() void cellPad_init()
{ {
sys_io->AddFunc(0x1cf98800, cellPadInit); sys_io.AddFunc(0x1cf98800, cellPadInit);
sys_io->AddFunc(0x4d9b75d5, cellPadEnd); sys_io.AddFunc(0x4d9b75d5, cellPadEnd);
sys_io->AddFunc(0x0d5f2c14, cellPadClearBuf); sys_io.AddFunc(0x0d5f2c14, cellPadClearBuf);
sys_io->AddFunc(0x8b72cda1, cellPadGetData); sys_io.AddFunc(0x8b72cda1, cellPadGetData);
sys_io->AddFunc(0x6bc09c61, cellPadGetDataExtra); sys_io.AddFunc(0x6bc09c61, cellPadGetDataExtra);
sys_io->AddFunc(0xf65544ee, cellPadSetActDirect); sys_io.AddFunc(0xf65544ee, cellPadSetActDirect);
sys_io->AddFunc(0x3aaad464, cellPadGetInfo); sys_io.AddFunc(0x3aaad464, cellPadGetInfo);
sys_io->AddFunc(0xa703a51d, cellPadGetInfo2); sys_io.AddFunc(0xa703a51d, cellPadGetInfo2);
sys_io->AddFunc(0x4cc9b68d, cellPadPeriphGetInfo); sys_io.AddFunc(0x4cc9b68d, cellPadPeriphGetInfo);
sys_io->AddFunc(0x578e3c98, cellPadSetPortSetting); sys_io.AddFunc(0x578e3c98, cellPadSetPortSetting);
sys_io->AddFunc(0x0e2dfaad, cellPadInfoPressMode); sys_io.AddFunc(0x0e2dfaad, cellPadInfoPressMode);
sys_io->AddFunc(0x78200559, cellPadInfoSensorMode); sys_io.AddFunc(0x78200559, cellPadInfoSensorMode);
sys_io->AddFunc(0xf83f8182, cellPadSetPressMode); sys_io.AddFunc(0xf83f8182, cellPadSetPressMode);
sys_io->AddFunc(0xbe5be3ba, cellPadSetSensorMode); sys_io.AddFunc(0xbe5be3ba, cellPadSetSensorMode);
sys_io->AddFunc(0xdbf4c59c, cellPadGetCapabilityInfo); sys_io.AddFunc(0xdbf4c59c, cellPadGetCapabilityInfo);
} }

View file

@ -5,7 +5,7 @@
#include "cellPamf.h" #include "cellPamf.h"
Module *cellPamf = nullptr; extern Module cellPamf;
s32 pamfStreamTypeToEsFilterId(u8 type, u8 ch, CellCodecEsFilterId& pEsFilterId) s32 pamfStreamTypeToEsFilterId(u8 type, u8 ch, CellCodecEsFilterId& pEsFilterId)
{ {
@ -98,7 +98,7 @@ s32 pamfStreamTypeToEsFilterId(u8 type, u8 ch, CellCodecEsFilterId& pEsFilterId)
default: default:
{ {
cellPamf->Error("pamfStreamTypeToEsFilterId(): unknown type (%d, ch=%d)", type, ch); cellPamf.Error("pamfStreamTypeToEsFilterId(): unknown type (%d, ch=%d)", type, ch);
Emu.Pause(); Emu.Pause();
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
} }
@ -123,7 +123,7 @@ u8 pamfGetStreamType(vm::ptr<CellPamfReader> pSelf, u32 stream)
case 0xdd: return CELL_PAMF_STREAM_TYPE_USER_DATA; case 0xdd: return CELL_PAMF_STREAM_TYPE_USER_DATA;
} }
cellPamf->Todo("pamfGetStreamType(): unsupported stream type found(0x%x)", header.type); cellPamf.Todo("pamfGetStreamType(): unsupported stream type found(0x%x)", header.type);
Emu.Pause(); Emu.Pause();
return 0xff; return 0xff;
} }
@ -166,14 +166,14 @@ u8 pamfGetStreamChannel(vm::ptr<CellPamfReader> pSelf, u32 stream)
} }
} }
cellPamf->Todo("pamfGetStreamChannel(): unsupported stream type found(0x%x)", header.type); cellPamf.Todo("pamfGetStreamChannel(): unsupported stream type found(0x%x)", header.type);
Emu.Pause(); Emu.Pause();
return 0xff; return 0xff;
} }
s32 cellPamfGetHeaderSize(vm::ptr<PamfHeader> pAddr, u64 fileSize, vm::ptr<u64> pSize) s32 cellPamfGetHeaderSize(vm::ptr<PamfHeader> pAddr, u64 fileSize, vm::ptr<u64> pSize)
{ {
cellPamf->Warning("cellPamfGetHeaderSize(pAddr=0x%x, fileSize=%d, pSize_addr=0x%x)", pAddr.addr(), fileSize, pSize.addr()); cellPamf.Warning("cellPamfGetHeaderSize(pAddr=0x%x, fileSize=%d, pSize_addr=0x%x)", pAddr.addr(), fileSize, pSize.addr());
//if ((u32)pAddr->magic != 0x464d4150) return CELL_PAMF_ERROR_UNKNOWN_TYPE; //if ((u32)pAddr->magic != 0x464d4150) return CELL_PAMF_ERROR_UNKNOWN_TYPE;
@ -184,7 +184,7 @@ s32 cellPamfGetHeaderSize(vm::ptr<PamfHeader> pAddr, u64 fileSize, vm::ptr<u64>
s32 cellPamfGetHeaderSize2(vm::ptr<PamfHeader> pAddr, u64 fileSize, u32 attribute, vm::ptr<u64> pSize) s32 cellPamfGetHeaderSize2(vm::ptr<PamfHeader> pAddr, u64 fileSize, u32 attribute, vm::ptr<u64> pSize)
{ {
cellPamf->Warning("cellPamfGetHeaderSize2(pAddr=0x%x, fileSize=%d, attribute=0x%x, pSize_addr=0x%x)", pAddr.addr(), fileSize, attribute, pSize.addr()); cellPamf.Warning("cellPamfGetHeaderSize2(pAddr=0x%x, fileSize=%d, attribute=0x%x, pSize_addr=0x%x)", pAddr.addr(), fileSize, attribute, pSize.addr());
//if ((u32)pAddr->magic != 0x464d4150) return CELL_PAMF_ERROR_UNKNOWN_TYPE; //if ((u32)pAddr->magic != 0x464d4150) return CELL_PAMF_ERROR_UNKNOWN_TYPE;
@ -195,7 +195,7 @@ s32 cellPamfGetHeaderSize2(vm::ptr<PamfHeader> pAddr, u64 fileSize, u32 attribut
s32 cellPamfGetStreamOffsetAndSize(vm::ptr<PamfHeader> pAddr, u64 fileSize, vm::ptr<u64> pOffset, vm::ptr<u64> pSize) s32 cellPamfGetStreamOffsetAndSize(vm::ptr<PamfHeader> pAddr, u64 fileSize, vm::ptr<u64> pOffset, vm::ptr<u64> pSize)
{ {
cellPamf->Warning("cellPamfGetStreamOffsetAndSize(pAddr=0x%x, fileSize=%d, pOffset_addr=0x%x, pSize_addr=0x%x)", pAddr.addr(), fileSize, pOffset.addr(), pSize.addr()); cellPamf.Warning("cellPamfGetStreamOffsetAndSize(pAddr=0x%x, fileSize=%d, pOffset_addr=0x%x, pSize_addr=0x%x)", pAddr.addr(), fileSize, pOffset.addr(), pSize.addr());
//if ((u32)pAddr->magic != 0x464d4150) return CELL_PAMF_ERROR_UNKNOWN_TYPE; //if ((u32)pAddr->magic != 0x464d4150) return CELL_PAMF_ERROR_UNKNOWN_TYPE;
@ -208,7 +208,7 @@ s32 cellPamfGetStreamOffsetAndSize(vm::ptr<PamfHeader> pAddr, u64 fileSize, vm::
s32 cellPamfVerify(vm::ptr<PamfHeader> pAddr, u64 fileSize) s32 cellPamfVerify(vm::ptr<PamfHeader> pAddr, u64 fileSize)
{ {
cellPamf->Todo("cellPamfVerify(pAddr=0x%x, fileSize=%d)", pAddr.addr(), fileSize); cellPamf.Todo("cellPamfVerify(pAddr=0x%x, fileSize=%d)", pAddr.addr(), fileSize);
// TODO // TODO
return CELL_OK; return CELL_OK;
@ -216,7 +216,7 @@ s32 cellPamfVerify(vm::ptr<PamfHeader> pAddr, u64 fileSize)
s32 cellPamfReaderInitialize(vm::ptr<CellPamfReader> pSelf, vm::ptr<const PamfHeader> pAddr, u64 fileSize, u32 attribute) s32 cellPamfReaderInitialize(vm::ptr<CellPamfReader> pSelf, vm::ptr<const PamfHeader> pAddr, u64 fileSize, u32 attribute)
{ {
cellPamf->Warning("cellPamfReaderInitialize(pSelf=0x%x, pAddr=0x%x, fileSize=%d, attribute=0x%x)", pSelf.addr(), pAddr.addr(), fileSize, attribute); cellPamf.Warning("cellPamfReaderInitialize(pSelf=0x%x, pAddr=0x%x, fileSize=%d, attribute=0x%x)", pSelf.addr(), pAddr.addr(), fileSize, attribute);
if (fileSize) if (fileSize)
{ {
@ -231,7 +231,7 @@ s32 cellPamfReaderInitialize(vm::ptr<CellPamfReader> pSelf, vm::ptr<const PamfHe
if (attribute & CELL_PAMF_ATTRIBUTE_VERIFY_ON) if (attribute & CELL_PAMF_ATTRIBUTE_VERIFY_ON)
{ {
// TODO // TODO
cellPamf->Todo("cellPamfReaderInitialize(): verification"); cellPamf.Todo("cellPamfReaderInitialize(): verification");
} }
pSelf->stream = 0; // currently set stream pSelf->stream = 0; // currently set stream
@ -240,7 +240,7 @@ s32 cellPamfReaderInitialize(vm::ptr<CellPamfReader> pSelf, vm::ptr<const PamfHe
s32 cellPamfReaderGetPresentationStartTime(vm::ptr<CellPamfReader> pSelf, vm::ptr<CellCodecTimeStamp> pTimeStamp) s32 cellPamfReaderGetPresentationStartTime(vm::ptr<CellPamfReader> pSelf, vm::ptr<CellCodecTimeStamp> pTimeStamp)
{ {
cellPamf->Warning("cellPamfReaderGetPresentationStartTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.addr(), pTimeStamp.addr()); cellPamf.Warning("cellPamfReaderGetPresentationStartTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.addr(), pTimeStamp.addr());
// always returns CELL_OK // always returns CELL_OK
@ -251,7 +251,7 @@ s32 cellPamfReaderGetPresentationStartTime(vm::ptr<CellPamfReader> pSelf, vm::pt
s32 cellPamfReaderGetPresentationEndTime(vm::ptr<CellPamfReader> pSelf, vm::ptr<CellCodecTimeStamp> pTimeStamp) s32 cellPamfReaderGetPresentationEndTime(vm::ptr<CellPamfReader> pSelf, vm::ptr<CellCodecTimeStamp> pTimeStamp)
{ {
cellPamf->Warning("cellPamfReaderGetPresentationEndTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.addr(), pTimeStamp.addr()); cellPamf.Warning("cellPamfReaderGetPresentationEndTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.addr(), pTimeStamp.addr());
// always returns CELL_OK // always returns CELL_OK
@ -262,7 +262,7 @@ s32 cellPamfReaderGetPresentationEndTime(vm::ptr<CellPamfReader> pSelf, vm::ptr<
u32 cellPamfReaderGetMuxRateBound(vm::ptr<CellPamfReader> pSelf) u32 cellPamfReaderGetMuxRateBound(vm::ptr<CellPamfReader> pSelf)
{ {
cellPamf->Warning("cellPamfReaderGetMuxRateBound(pSelf=0x%x)", pSelf.addr()); cellPamf.Warning("cellPamfReaderGetMuxRateBound(pSelf=0x%x)", pSelf.addr());
// cannot return error code // cannot return error code
return pSelf->pAddr->mux_rate_max; return pSelf->pAddr->mux_rate_max;
@ -270,7 +270,7 @@ u32 cellPamfReaderGetMuxRateBound(vm::ptr<CellPamfReader> pSelf)
u8 cellPamfReaderGetNumberOfStreams(vm::ptr<CellPamfReader> pSelf) u8 cellPamfReaderGetNumberOfStreams(vm::ptr<CellPamfReader> pSelf)
{ {
cellPamf->Warning("cellPamfReaderGetNumberOfStreams(pSelf=0x%x)", pSelf.addr()); cellPamf.Warning("cellPamfReaderGetNumberOfStreams(pSelf=0x%x)", pSelf.addr());
// cannot return error code // cannot return error code
return pSelf->pAddr->stream_count; return pSelf->pAddr->stream_count;
@ -278,7 +278,7 @@ u8 cellPamfReaderGetNumberOfStreams(vm::ptr<CellPamfReader> pSelf)
u8 cellPamfReaderGetNumberOfSpecificStreams(vm::ptr<CellPamfReader> pSelf, u8 streamType) u8 cellPamfReaderGetNumberOfSpecificStreams(vm::ptr<CellPamfReader> pSelf, u8 streamType)
{ {
cellPamf->Warning("cellPamfReaderGetNumberOfSpecificStreams(pSelf=0x%x, streamType=%d)", pSelf.addr(), streamType); cellPamf.Warning("cellPamfReaderGetNumberOfSpecificStreams(pSelf=0x%x, streamType=%d)", pSelf.addr(), streamType);
// cannot return error code // cannot return error code
@ -312,14 +312,14 @@ u8 cellPamfReaderGetNumberOfSpecificStreams(vm::ptr<CellPamfReader> pSelf, u8 st
} }
} }
cellPamf->Todo("cellPamfReaderGetNumberOfSpecificStreams(): unsupported stream type (0x%x)", streamType); cellPamf.Todo("cellPamfReaderGetNumberOfSpecificStreams(): unsupported stream type (0x%x)", streamType);
Emu.Pause(); Emu.Pause();
return 0; return 0;
} }
s32 cellPamfReaderSetStreamWithIndex(vm::ptr<CellPamfReader> pSelf, u8 streamIndex) s32 cellPamfReaderSetStreamWithIndex(vm::ptr<CellPamfReader> pSelf, u8 streamIndex)
{ {
cellPamf->Warning("cellPamfReaderSetStreamWithIndex(pSelf=0x%x, streamIndex=%d)", pSelf.addr(), streamIndex); cellPamf.Warning("cellPamfReaderSetStreamWithIndex(pSelf=0x%x, streamIndex=%d)", pSelf.addr(), streamIndex);
if (streamIndex >= pSelf->pAddr->stream_count) if (streamIndex >= pSelf->pAddr->stream_count)
{ {
@ -332,12 +332,12 @@ s32 cellPamfReaderSetStreamWithIndex(vm::ptr<CellPamfReader> pSelf, u8 streamInd
s32 cellPamfReaderSetStreamWithTypeAndChannel(vm::ptr<CellPamfReader> pSelf, u8 streamType, u8 ch) s32 cellPamfReaderSetStreamWithTypeAndChannel(vm::ptr<CellPamfReader> pSelf, u8 streamType, u8 ch)
{ {
cellPamf->Warning("cellPamfReaderSetStreamWithTypeAndChannel(pSelf=0x%x, streamType=%d, ch=%d)", pSelf.addr(), streamType, ch); cellPamf.Warning("cellPamfReaderSetStreamWithTypeAndChannel(pSelf=0x%x, streamType=%d, ch=%d)", pSelf.addr(), streamType, ch);
// it probably doesn't support "any audio" or "any video" argument // it probably doesn't support "any audio" or "any video" argument
if (streamType > 5 || ch >= 16) if (streamType > 5 || ch >= 16)
{ {
cellPamf->Error("cellPamfReaderSetStreamWithTypeAndChannel(): invalid arguments (streamType=%d, ch=%d)", streamType, ch); cellPamf.Error("cellPamfReaderSetStreamWithTypeAndChannel(): invalid arguments (streamType=%d, ch=%d)", streamType, ch);
Emu.Pause(); Emu.Pause();
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
} }
@ -359,7 +359,7 @@ s32 cellPamfReaderSetStreamWithTypeAndChannel(vm::ptr<CellPamfReader> pSelf, u8
s32 cellPamfReaderSetStreamWithTypeAndIndex(vm::ptr<CellPamfReader> pSelf, u8 streamType, u8 streamIndex) s32 cellPamfReaderSetStreamWithTypeAndIndex(vm::ptr<CellPamfReader> pSelf, u8 streamType, u8 streamIndex)
{ {
cellPamf->Warning("cellPamfReaderSetStreamWithTypeAndIndex(pSelf=0x%x, streamType=%d, streamIndex=%d)", pSelf.addr(), streamType, streamIndex); cellPamf.Warning("cellPamfReaderSetStreamWithTypeAndIndex(pSelf=0x%x, streamType=%d, streamIndex=%d)", pSelf.addr(), streamType, streamIndex);
u32 found = 0; u32 found = 0;
@ -412,7 +412,7 @@ s32 cellPamfReaderSetStreamWithTypeAndIndex(vm::ptr<CellPamfReader> pSelf, u8 st
s32 cellPamfStreamTypeToEsFilterId(u8 type, u8 ch, vm::ptr<CellCodecEsFilterId> pEsFilterId) s32 cellPamfStreamTypeToEsFilterId(u8 type, u8 ch, vm::ptr<CellCodecEsFilterId> pEsFilterId)
{ {
cellPamf->Warning("cellPamfStreamTypeToEsFilterId(type=%d, ch=%d, pEsFilterId_addr=0x%x)", type, ch, pEsFilterId.addr()); cellPamf.Warning("cellPamfStreamTypeToEsFilterId(type=%d, ch=%d, pEsFilterId_addr=0x%x)", type, ch, pEsFilterId.addr());
if (!pEsFilterId) if (!pEsFilterId)
{ {
@ -424,7 +424,7 @@ s32 cellPamfStreamTypeToEsFilterId(u8 type, u8 ch, vm::ptr<CellCodecEsFilterId>
s32 cellPamfReaderGetStreamIndex(vm::ptr<CellPamfReader> pSelf) s32 cellPamfReaderGetStreamIndex(vm::ptr<CellPamfReader> pSelf)
{ {
cellPamf->Log("cellPamfReaderGetStreamIndex(pSelf=0x%x)", pSelf.addr()); cellPamf.Log("cellPamfReaderGetStreamIndex(pSelf=0x%x)", pSelf.addr());
// seems that CELL_PAMF_ERROR_INVALID_PAMF must be already written in pSelf->stream if it's the case // seems that CELL_PAMF_ERROR_INVALID_PAMF must be already written in pSelf->stream if it's the case
return pSelf->stream; return pSelf->stream;
@ -432,7 +432,7 @@ s32 cellPamfReaderGetStreamIndex(vm::ptr<CellPamfReader> pSelf)
s32 cellPamfReaderGetStreamTypeAndChannel(vm::ptr<CellPamfReader> pSelf, vm::ptr<u8> pType, vm::ptr<u8> pCh) s32 cellPamfReaderGetStreamTypeAndChannel(vm::ptr<CellPamfReader> pSelf, vm::ptr<u8> pType, vm::ptr<u8> pCh)
{ {
cellPamf->Warning("cellPamfReaderGetStreamTypeAndChannel(pSelf=0x%x (stream=%d), pType_addr=0x%x, pCh_addr=0x%x", cellPamf.Warning("cellPamfReaderGetStreamTypeAndChannel(pSelf=0x%x (stream=%d), pType_addr=0x%x, pCh_addr=0x%x",
pSelf.addr(), pSelf->stream, pType.addr(), pCh.addr()); pSelf.addr(), pSelf->stream, pType.addr(), pCh.addr());
// unclear // unclear
@ -444,7 +444,7 @@ s32 cellPamfReaderGetStreamTypeAndChannel(vm::ptr<CellPamfReader> pSelf, vm::ptr
s32 cellPamfReaderGetEsFilterId(vm::ptr<CellPamfReader> pSelf, vm::ptr<CellCodecEsFilterId> pEsFilterId) s32 cellPamfReaderGetEsFilterId(vm::ptr<CellPamfReader> pSelf, vm::ptr<CellCodecEsFilterId> pEsFilterId)
{ {
cellPamf->Warning("cellPamfReaderGetEsFilterId(pSelf=0x%x (stream=%d), pEsFilterId_addr=0x%x)", pSelf.addr(), pSelf->stream, pEsFilterId.addr()); cellPamf.Warning("cellPamfReaderGetEsFilterId(pSelf=0x%x (stream=%d), pEsFilterId_addr=0x%x)", pSelf.addr(), pSelf->stream, pEsFilterId.addr());
// always returns CELL_OK // always returns CELL_OK
@ -459,7 +459,7 @@ s32 cellPamfReaderGetEsFilterId(vm::ptr<CellPamfReader> pSelf, vm::ptr<CellCodec
s32 cellPamfReaderGetStreamInfo(vm::ptr<CellPamfReader> pSelf, u32 pInfo_addr, u32 size) s32 cellPamfReaderGetStreamInfo(vm::ptr<CellPamfReader> pSelf, u32 pInfo_addr, u32 size)
{ {
cellPamf->Warning("cellPamfReaderGetStreamInfo(pSelf=0x%x, stream=%d, pInfo_addr=0x%x, size=%d)", pSelf.addr(), pSelf->stream, pInfo_addr, size); cellPamf.Warning("cellPamfReaderGetStreamInfo(pSelf=0x%x, stream=%d, pInfo_addr=0x%x, size=%d)", pSelf.addr(), pSelf->stream, pInfo_addr, size);
assert((u32)pSelf->stream < (u32)pSelf->pAddr->stream_count); assert((u32)pSelf->stream < (u32)pSelf->pAddr->stream_count);
auto& header = pSelf->pAddr->stream_headers[pSelf->stream]; auto& header = pSelf->pAddr->stream_headers[pSelf->stream];
@ -525,7 +525,7 @@ s32 cellPamfReaderGetStreamInfo(vm::ptr<CellPamfReader> pSelf, u32 pInfo_addr, u
info->nfwIdc = header.AVC.x18 & 0x03; info->nfwIdc = header.AVC.x18 & 0x03;
info->maxMeanBitrate = header.AVC.maxMeanBitrate; info->maxMeanBitrate = header.AVC.maxMeanBitrate;
cellPamf->Notice("cellPamfReaderGetStreamInfo(): CELL_PAMF_STREAM_TYPE_AVC"); cellPamf.Notice("cellPamfReaderGetStreamInfo(): CELL_PAMF_STREAM_TYPE_AVC");
break; break;
} }
@ -583,7 +583,7 @@ s32 cellPamfReaderGetStreamInfo(vm::ptr<CellPamfReader> pSelf, u32 pInfo_addr, u
info->matrixCoefficients = 0; info->matrixCoefficients = 0;
} }
cellPamf->Notice("cellPamfReaderGetStreamInfo(): CELL_PAMF_STREAM_TYPE_M2V"); cellPamf.Notice("cellPamfReaderGetStreamInfo(): CELL_PAMF_STREAM_TYPE_M2V");
break; break;
} }
@ -599,7 +599,7 @@ s32 cellPamfReaderGetStreamInfo(vm::ptr<CellPamfReader> pSelf, u32 pInfo_addr, u
info->samplingFrequency = header.audio.freq & 0xf; info->samplingFrequency = header.audio.freq & 0xf;
info->numberOfChannels = header.audio.channels & 0xf; info->numberOfChannels = header.audio.channels & 0xf;
cellPamf->Notice("cellPamfReaderGetStreamInfo(): CELL_PAMF_STREAM_TYPE_ATRAC3PLUS"); cellPamf.Notice("cellPamfReaderGetStreamInfo(): CELL_PAMF_STREAM_TYPE_ATRAC3PLUS");
break; break;
} }
@ -616,7 +616,7 @@ s32 cellPamfReaderGetStreamInfo(vm::ptr<CellPamfReader> pSelf, u32 pInfo_addr, u
info->numberOfChannels = header.audio.channels & 0xf; info->numberOfChannels = header.audio.channels & 0xf;
info->bitsPerSample = header.audio.bps >> 6; info->bitsPerSample = header.audio.bps >> 6;
cellPamf->Notice("cellPamfReaderGetStreamInfo(): CELL_PAMF_STREAM_TYPE_PAMF_LPCM"); cellPamf.Notice("cellPamfReaderGetStreamInfo(): CELL_PAMF_STREAM_TYPE_PAMF_LPCM");
break; break;
} }
@ -632,13 +632,13 @@ s32 cellPamfReaderGetStreamInfo(vm::ptr<CellPamfReader> pSelf, u32 pInfo_addr, u
info->samplingFrequency = header.audio.freq & 0xf; info->samplingFrequency = header.audio.freq & 0xf;
info->numberOfChannels = header.audio.channels & 0xf; info->numberOfChannels = header.audio.channels & 0xf;
cellPamf->Notice("cellPamfReaderGetStreamInfo(): CELL_PAMF_STREAM_TYPE_AC3"); cellPamf.Notice("cellPamfReaderGetStreamInfo(): CELL_PAMF_STREAM_TYPE_AC3");
break; break;
} }
case CELL_PAMF_STREAM_TYPE_USER_DATA: case CELL_PAMF_STREAM_TYPE_USER_DATA:
{ {
cellPamf->Error("cellPamfReaderGetStreamInfo(): invalid type CELL_PAMF_STREAM_TYPE_USER_DATA"); cellPamf.Error("cellPamfReaderGetStreamInfo(): invalid type CELL_PAMF_STREAM_TYPE_USER_DATA");
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
} }
@ -649,7 +649,7 @@ s32 cellPamfReaderGetStreamInfo(vm::ptr<CellPamfReader> pSelf, u32 pInfo_addr, u
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
} }
cellPamf->Todo("cellPamfReaderGetStreamInfo(): type 6"); cellPamf.Todo("cellPamfReaderGetStreamInfo(): type 6");
break; break;
} }
@ -660,7 +660,7 @@ s32 cellPamfReaderGetStreamInfo(vm::ptr<CellPamfReader> pSelf, u32 pInfo_addr, u
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
} }
cellPamf->Todo("cellPamfReaderGetStreamInfo(): type 7"); cellPamf.Todo("cellPamfReaderGetStreamInfo(): type 7");
break; break;
} }
@ -671,20 +671,20 @@ s32 cellPamfReaderGetStreamInfo(vm::ptr<CellPamfReader> pSelf, u32 pInfo_addr, u
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
} }
cellPamf->Todo("cellPamfReaderGetStreamInfo(): type 8"); cellPamf.Todo("cellPamfReaderGetStreamInfo(): type 8");
break; break;
} }
case 9: case 9:
{ {
cellPamf->Error("cellPamfReaderGetStreamInfo(): invalid type 9"); cellPamf.Error("cellPamfReaderGetStreamInfo(): invalid type 9");
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
} }
default: default:
{ {
// invalid type or getting type/ch failed // invalid type or getting type/ch failed
cellPamf->Error("cellPamfReaderGetStreamInfo(): invalid type %d (ch=%d)", type, ch); cellPamf.Error("cellPamfReaderGetStreamInfo(): invalid type %d (ch=%d)", type, ch);
return CELL_PAMF_ERROR_INVALID_PAMF; return CELL_PAMF_ERROR_INVALID_PAMF;
} }
} }
@ -694,7 +694,7 @@ s32 cellPamfReaderGetStreamInfo(vm::ptr<CellPamfReader> pSelf, u32 pInfo_addr, u
u32 cellPamfReaderGetNumberOfEp(vm::ptr<CellPamfReader> pSelf) u32 cellPamfReaderGetNumberOfEp(vm::ptr<CellPamfReader> pSelf)
{ {
cellPamf->Todo("cellPamfReaderGetNumberOfEp(pSelf=0x%x, stream=%d)", pSelf.addr(), pSelf->stream); cellPamf.Todo("cellPamfReaderGetNumberOfEp(pSelf=0x%x, stream=%d)", pSelf.addr(), pSelf->stream);
// cannot return error code // cannot return error code
return 0; //pSelf->pAddr->stream_headers[pSelf->stream].ep_num; return 0; //pSelf->pAddr->stream_headers[pSelf->stream].ep_num;
@ -702,7 +702,7 @@ u32 cellPamfReaderGetNumberOfEp(vm::ptr<CellPamfReader> pSelf)
s32 cellPamfReaderGetEpIteratorWithIndex(vm::ptr<CellPamfReader> pSelf, u32 epIndex, vm::ptr<CellPamfEpIterator> pIt) s32 cellPamfReaderGetEpIteratorWithIndex(vm::ptr<CellPamfReader> pSelf, u32 epIndex, vm::ptr<CellPamfEpIterator> pIt)
{ {
cellPamf->Todo("cellPamfReaderGetEpIteratorWithIndex(pSelf=0x%x, stream=%d, epIndex=%d, pIt_addr=0x%x)", pSelf.addr(), pSelf->stream, epIndex, pIt.addr()); cellPamf.Todo("cellPamfReaderGetEpIteratorWithIndex(pSelf=0x%x, stream=%d, epIndex=%d, pIt_addr=0x%x)", pSelf.addr(), pSelf->stream, epIndex, pIt.addr());
// TODO // TODO
return CELL_OK; return CELL_OK;
@ -710,7 +710,7 @@ s32 cellPamfReaderGetEpIteratorWithIndex(vm::ptr<CellPamfReader> pSelf, u32 epIn
s32 cellPamfReaderGetEpIteratorWithTimeStamp(vm::ptr<CellPamfReader> pSelf, vm::ptr<CellCodecTimeStamp> pTimeStamp, vm::ptr<CellPamfEpIterator> pIt) s32 cellPamfReaderGetEpIteratorWithTimeStamp(vm::ptr<CellPamfReader> pSelf, vm::ptr<CellCodecTimeStamp> pTimeStamp, vm::ptr<CellPamfEpIterator> pIt)
{ {
cellPamf->Todo("cellPamfReaderGetEpIteratorWithTimeStamp(pSelf=0x%x, pTimeStamp_addr=0x%x, pIt_addr=0x%x)", pSelf.addr(), pTimeStamp.addr(), pIt.addr()); cellPamf.Todo("cellPamfReaderGetEpIteratorWithTimeStamp(pSelf=0x%x, pTimeStamp_addr=0x%x, pIt_addr=0x%x)", pSelf.addr(), pTimeStamp.addr(), pIt.addr());
// TODO // TODO
return CELL_OK; return CELL_OK;
@ -718,7 +718,7 @@ s32 cellPamfReaderGetEpIteratorWithTimeStamp(vm::ptr<CellPamfReader> pSelf, vm::
s32 cellPamfEpIteratorGetEp(vm::ptr<CellPamfEpIterator> pIt, vm::ptr<CellPamfEp> pEp) s32 cellPamfEpIteratorGetEp(vm::ptr<CellPamfEpIterator> pIt, vm::ptr<CellPamfEp> pEp)
{ {
cellPamf->Todo("cellPamfEpIteratorGetEp(pIt_addr=0x%x, pEp_addr=0x%x)", pIt.addr(), pEp.addr()); cellPamf.Todo("cellPamfEpIteratorGetEp(pIt_addr=0x%x, pEp_addr=0x%x)", pIt.addr(), pEp.addr());
// always returns CELL_OK // always returns CELL_OK
// TODO // TODO
@ -727,39 +727,36 @@ s32 cellPamfEpIteratorGetEp(vm::ptr<CellPamfEpIterator> pIt, vm::ptr<CellPamfEp>
s32 cellPamfEpIteratorMove(vm::ptr<CellPamfEpIterator> pIt, s32 steps, vm::ptr<CellPamfEp> pEp) s32 cellPamfEpIteratorMove(vm::ptr<CellPamfEpIterator> pIt, s32 steps, vm::ptr<CellPamfEp> pEp)
{ {
cellPamf->Todo("cellPamfEpIteratorMove(pIt_addr=0x%x, steps=%d, pEp_addr=0x%x)", pIt.addr(), steps, pEp.addr()); cellPamf.Todo("cellPamfEpIteratorMove(pIt_addr=0x%x, steps=%d, pEp_addr=0x%x)", pIt.addr(), steps, pEp.addr());
// cannot return error code // cannot return error code
// TODO // TODO
return 0; return 0;
} }
void cellPamf_init(Module *pxThis) Module cellPamf("cellPamf", []()
{ {
cellPamf = pxThis; cellPamf.AddFunc(0xca8181c1, cellPamfGetHeaderSize);
cellPamf.AddFunc(0x90fc9a59, cellPamfGetHeaderSize2);
cellPamf->AddFunc(0xca8181c1, cellPamfGetHeaderSize); cellPamf.AddFunc(0x44f5c9e3, cellPamfGetStreamOffsetAndSize);
cellPamf->AddFunc(0x90fc9a59, cellPamfGetHeaderSize2); cellPamf.AddFunc(0xd1a40ef4, cellPamfVerify);
cellPamf->AddFunc(0x44f5c9e3, cellPamfGetStreamOffsetAndSize); cellPamf.AddFunc(0xb8436ee5, cellPamfReaderInitialize);
cellPamf->AddFunc(0xd1a40ef4, cellPamfVerify); cellPamf.AddFunc(0x4de501b1, cellPamfReaderGetPresentationStartTime);
cellPamf->AddFunc(0xb8436ee5, cellPamfReaderInitialize); cellPamf.AddFunc(0xf61609d6, cellPamfReaderGetPresentationEndTime);
cellPamf->AddFunc(0x4de501b1, cellPamfReaderGetPresentationStartTime); cellPamf.AddFunc(0xdb70296c, cellPamfReaderGetMuxRateBound);
cellPamf->AddFunc(0xf61609d6, cellPamfReaderGetPresentationEndTime); cellPamf.AddFunc(0x37f723f7, cellPamfReaderGetNumberOfStreams);
cellPamf->AddFunc(0xdb70296c, cellPamfReaderGetMuxRateBound); cellPamf.AddFunc(0xd0230671, cellPamfReaderGetNumberOfSpecificStreams);
cellPamf->AddFunc(0x37f723f7, cellPamfReaderGetNumberOfStreams); cellPamf.AddFunc(0x461534b4, cellPamfReaderSetStreamWithIndex);
cellPamf->AddFunc(0xd0230671, cellPamfReaderGetNumberOfSpecificStreams); cellPamf.AddFunc(0x03fd2caa, cellPamfReaderSetStreamWithTypeAndChannel);
cellPamf->AddFunc(0x461534b4, cellPamfReaderSetStreamWithIndex); cellPamf.AddFunc(0x28b4e2c1, cellPamfReaderSetStreamWithTypeAndIndex);
cellPamf->AddFunc(0x03fd2caa, cellPamfReaderSetStreamWithTypeAndChannel); cellPamf.AddFunc(0x01067e22, cellPamfStreamTypeToEsFilterId);
cellPamf->AddFunc(0x28b4e2c1, cellPamfReaderSetStreamWithTypeAndIndex); cellPamf.AddFunc(0x041cc708, cellPamfReaderGetStreamIndex);
cellPamf->AddFunc(0x01067e22, cellPamfStreamTypeToEsFilterId); cellPamf.AddFunc(0x9ab20793, cellPamfReaderGetStreamTypeAndChannel);
cellPamf->AddFunc(0x041cc708, cellPamfReaderGetStreamIndex); cellPamf.AddFunc(0x71df326a, cellPamfReaderGetEsFilterId);
cellPamf->AddFunc(0x9ab20793, cellPamfReaderGetStreamTypeAndChannel); cellPamf.AddFunc(0x67fd273b, cellPamfReaderGetStreamInfo);
cellPamf->AddFunc(0x71df326a, cellPamfReaderGetEsFilterId); cellPamf.AddFunc(0xd9ea3457, cellPamfReaderGetNumberOfEp);
cellPamf->AddFunc(0x67fd273b, cellPamfReaderGetStreamInfo); cellPamf.AddFunc(0xe8586ec6, cellPamfReaderGetEpIteratorWithIndex);
cellPamf->AddFunc(0xd9ea3457, cellPamfReaderGetNumberOfEp); cellPamf.AddFunc(0x439fba17, cellPamfReaderGetEpIteratorWithTimeStamp);
cellPamf->AddFunc(0xe8586ec6, cellPamfReaderGetEpIteratorWithIndex); cellPamf.AddFunc(0x1abeb9d6, cellPamfEpIteratorGetEp);
cellPamf->AddFunc(0x439fba17, cellPamfReaderGetEpIteratorWithTimeStamp); cellPamf.AddFunc(0x50b83205, cellPamfEpIteratorMove);
cellPamf->AddFunc(0x1abeb9d6, cellPamfEpIteratorGetEp); });
cellPamf->AddFunc(0x50b83205, cellPamfEpIteratorMove);
}

View file

@ -8,7 +8,7 @@
#include "cellPngDec.h" #include "cellPngDec.h"
#include <map> #include <map>
Module *cellPngDec = nullptr; extern Module cellPngDec;
#undef PRX_DEBUG #undef PRX_DEBUG
@ -171,7 +171,7 @@ s64 pngReadHeader(
case 4: current_info.colorSpace = CELL_PNGDEC_GRAYSCALE_ALPHA; current_info.numComponents = 2; break; case 4: current_info.colorSpace = CELL_PNGDEC_GRAYSCALE_ALPHA; current_info.numComponents = 2; break;
case 6: current_info.colorSpace = CELL_PNGDEC_RGBA; current_info.numComponents = 4; break; case 6: current_info.colorSpace = CELL_PNGDEC_RGBA; current_info.numComponents = 4; break;
default: default:
cellPngDec->Error("cellPngDecDecodeData: Unsupported color space (%d)", (u32)buffer[25]); cellPngDec.Error("cellPngDecDecodeData: Unsupported color space (%d)", (u32)buffer[25]);
return CELL_PNGDEC_ERROR_HEADER; return CELL_PNGDEC_ERROR_HEADER;
} }
@ -223,7 +223,7 @@ s64 pngDecSetParameter(
current_outParam.outputComponents = 4; break; current_outParam.outputComponents = 4; break;
default: default:
cellPngDec->Error("pngDecSetParameter: Unsupported color space (%d)", current_outParam.outputColorSpace); cellPngDec.Error("pngDecSetParameter: Unsupported color space (%d)", current_outParam.outputColorSpace);
return CELL_PNGDEC_ERROR_ARG; return CELL_PNGDEC_ERROR_ARG;
} }
@ -275,7 +275,7 @@ s64 pngDecodeData(
); );
if (!image) if (!image)
{ {
cellPngDec->Error("pngDecodeData: stbi_load_from_memory failed"); cellPngDec.Error("pngDecodeData: stbi_load_from_memory failed");
return CELL_PNGDEC_ERROR_STREAM_FORMAT; return CELL_PNGDEC_ERROR_STREAM_FORMAT;
} }
@ -352,11 +352,11 @@ s64 pngDecodeData(
case se32(CELL_PNGDEC_GRAYSCALE): case se32(CELL_PNGDEC_GRAYSCALE):
case se32(CELL_PNGDEC_PALETTE): case se32(CELL_PNGDEC_PALETTE):
case se32(CELL_PNGDEC_GRAYSCALE_ALPHA): case se32(CELL_PNGDEC_GRAYSCALE_ALPHA):
cellPngDec->Error("pngDecodeData: Unsupported color space (%d)", current_outParam.outputColorSpace); cellPngDec.Error("pngDecodeData: Unsupported color space (%d)", current_outParam.outputColorSpace);
break; break;
default: default:
cellPngDec->Error("pngDecodeData: Unsupported color space (%d)", current_outParam.outputColorSpace); cellPngDec.Error("pngDecodeData: Unsupported color space (%d)", current_outParam.outputColorSpace);
return CELL_PNGDEC_ERROR_ARG; return CELL_PNGDEC_ERROR_ARG;
} }
@ -368,11 +368,11 @@ s64 pngDecodeData(
s64 cellPngDecCreate(vm::ptr<u32> mainHandle, vm::ptr<const CellPngDecThreadInParam> threadInParam, vm::ptr<CellPngDecThreadOutParam> threadOutParam) s64 cellPngDecCreate(vm::ptr<u32> mainHandle, vm::ptr<const CellPngDecThreadInParam> threadInParam, vm::ptr<CellPngDecThreadOutParam> threadOutParam)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
const_cast<CellPngDecThreadInParam&>(*threadInParam).spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; // hack const_cast<CellPngDecThreadInParam&>(*threadInParam).spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; // hack
return GetCurrentPPUThread().FastCall2(libpngdec + 0x295C, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x295C, libpngdec_rtoc);
#else #else
cellPngDec->Warning("cellPngDecCreate(mainHandle_addr=0x%x, threadInParam_addr=0x%x, threadOutParam_addr=0x%x)", cellPngDec.Warning("cellPngDecCreate(mainHandle_addr=0x%x, threadInParam_addr=0x%x, threadOutParam_addr=0x%x)",
mainHandle.addr(), threadInParam.addr(), threadOutParam.addr()); mainHandle.addr(), threadInParam.addr(), threadOutParam.addr());
// create decoder // create decoder
@ -393,10 +393,10 @@ s64 cellPngDecExtCreate(
vm::ptr<CellPngDecExtThreadOutParam> extThreadOutParam) vm::ptr<CellPngDecExtThreadOutParam> extThreadOutParam)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x296C, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x296C, libpngdec_rtoc);
#else #else
cellPngDec->Warning("cellPngDecCreate(mainHandle_addr=0x%x, threadInParam_addr=0x%x, threadOutParam_addr=0x%x, extThreadInParam_addr=0x%x, extThreadOutParam_addr=0x%x)", cellPngDec.Warning("cellPngDecCreate(mainHandle_addr=0x%x, threadInParam_addr=0x%x, threadOutParam_addr=0x%x, extThreadInParam_addr=0x%x, extThreadOutParam_addr=0x%x)",
mainHandle.addr(), threadInParam.addr(), threadOutParam.addr(), extThreadInParam.addr(), extThreadOutParam.addr()); mainHandle.addr(), threadInParam.addr(), threadOutParam.addr(), extThreadInParam.addr(), extThreadOutParam.addr());
// create decoder // create decoder
@ -414,10 +414,10 @@ s64 cellPngDecExtCreate(
s64 cellPngDecDestroy(CellPngDecMainHandle mainHandle) s64 cellPngDecDestroy(CellPngDecMainHandle mainHandle)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x1E6C, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x1E6C, libpngdec_rtoc);
#else #else
cellPngDec->Warning("cellPngDecDestroy(mainHandle=0x%x)", mainHandle.addr()); cellPngDec.Warning("cellPngDecDestroy(mainHandle=0x%x)", mainHandle.addr());
// destroy decoder // destroy decoder
return pngDecDestroy(mainHandle); return pngDecDestroy(mainHandle);
@ -431,10 +431,10 @@ s64 cellPngDecOpen(
vm::ptr<CellPngDecOpnInfo> openInfo) vm::ptr<CellPngDecOpnInfo> openInfo)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x3F3C, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x3F3C, libpngdec_rtoc);
#else #else
cellPngDec->Warning("cellPngDecOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x)", cellPngDec.Warning("cellPngDecOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x)",
mainHandle.addr(), subHandle.addr(), src.addr(), openInfo.addr()); mainHandle.addr(), subHandle.addr(), src.addr(), openInfo.addr());
// create stream handle // create stream handle
@ -451,10 +451,10 @@ s64 cellPngDecExtOpen(
vm::ptr<const CellPngDecOpnParam> opnParam) vm::ptr<const CellPngDecOpnParam> opnParam)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x3F34, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x3F34, libpngdec_rtoc);
#else #else
cellPngDec->Warning("cellPngDecExtOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x, cbCtrlStrm_addr=0x%x, opnParam_addr=0x%x)", cellPngDec.Warning("cellPngDecExtOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x, cbCtrlStrm_addr=0x%x, opnParam_addr=0x%x)",
mainHandle.addr(), subHandle.addr(), src.addr(), openInfo.addr(), cbCtrlStrm.addr(), opnParam.addr()); mainHandle.addr(), subHandle.addr(), src.addr(), openInfo.addr(), cbCtrlStrm.addr(), opnParam.addr());
// create stream handle // create stream handle
@ -465,10 +465,10 @@ s64 cellPngDecExtOpen(
s64 cellPngDecClose(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle) s64 cellPngDecClose(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x066C, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x066C, libpngdec_rtoc);
#else #else
cellPngDec->Warning("cellPngDecClose(mainHandle=0x%x, subHandle=0x%x)", mainHandle.addr(), subHandle.addr()); cellPngDec.Warning("cellPngDecClose(mainHandle=0x%x, subHandle=0x%x)", mainHandle.addr(), subHandle.addr());
return pngDecClose(subHandle); return pngDecClose(subHandle);
#endif #endif
@ -477,10 +477,10 @@ s64 cellPngDecClose(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHand
s64 cellPngDecReadHeader(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngDecInfo> info) s64 cellPngDecReadHeader(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngDecInfo> info)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x3A3C, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x3A3C, libpngdec_rtoc);
#else #else
cellPngDec->Warning("cellPngDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%x)", cellPngDec.Warning("cellPngDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%x)",
mainHandle.addr(), subHandle.addr(), info.addr()); mainHandle.addr(), subHandle.addr(), info.addr());
return pngReadHeader(subHandle, info); return pngReadHeader(subHandle, info);
@ -494,10 +494,10 @@ s64 cellPngDecExtReadHeader(
vm::ptr<CellPngDecExtInfo> extInfo) vm::ptr<CellPngDecExtInfo> extInfo)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x3A34, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x3A34, libpngdec_rtoc);
#else #else
cellPngDec->Warning("cellPngDecExtReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%x, extInfo_addr=0x%x)", cellPngDec.Warning("cellPngDecExtReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%x, extInfo_addr=0x%x)",
mainHandle.addr(), subHandle.addr(), info.addr(), extInfo.addr()); mainHandle.addr(), subHandle.addr(), info.addr(), extInfo.addr());
return pngReadHeader(subHandle, info, extInfo); return pngReadHeader(subHandle, info, extInfo);
@ -511,10 +511,10 @@ s64 cellPngDecSetParameter(
vm::ptr<CellPngDecOutParam> outParam) vm::ptr<CellPngDecOutParam> outParam)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x33F4, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x33F4, libpngdec_rtoc);
#else #else
cellPngDec->Warning("cellPngDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x)", cellPngDec.Warning("cellPngDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x)",
mainHandle.addr(), subHandle.addr(), inParam.addr(), outParam.addr()); mainHandle.addr(), subHandle.addr(), inParam.addr(), outParam.addr());
return pngDecSetParameter(subHandle, inParam, outParam); return pngDecSetParameter(subHandle, inParam, outParam);
@ -530,10 +530,10 @@ s64 cellPngDecExtSetParameter(
vm::ptr<CellPngDecExtOutParam> extOutParam) vm::ptr<CellPngDecExtOutParam> extOutParam)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x33EC, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x33EC, libpngdec_rtoc);
#else #else
cellPngDec->Warning("cellPngDecExtSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x, extInParam=0x%x, extOutParam=0x%x", cellPngDec.Warning("cellPngDecExtSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x, extInParam=0x%x, extOutParam=0x%x",
mainHandle.addr(), subHandle.addr(), inParam.addr(), outParam.addr(), extInParam.addr(), extOutParam.addr()); mainHandle.addr(), subHandle.addr(), inParam.addr(), outParam.addr(), extInParam.addr(), extOutParam.addr());
return pngDecSetParameter(subHandle, inParam, outParam, extInParam, extOutParam); return pngDecSetParameter(subHandle, inParam, outParam, extInParam, extOutParam);
@ -548,10 +548,10 @@ s64 cellPngDecDecodeData(
vm::ptr<CellPngDecDataOutInfo> dataOutInfo) vm::ptr<CellPngDecDataOutInfo> dataOutInfo)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x5D40, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x5D40, libpngdec_rtoc);
#else #else
cellPngDec->Warning("cellPngDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x)", cellPngDec.Warning("cellPngDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x)",
mainHandle.addr(), subHandle.addr(), data.addr(), dataCtrlParam.addr(), dataOutInfo.addr()); mainHandle.addr(), subHandle.addr(), data.addr(), dataCtrlParam.addr(), dataOutInfo.addr());
return pngDecodeData(subHandle, data, dataCtrlParam, dataOutInfo); return pngDecodeData(subHandle, data, dataCtrlParam, dataOutInfo);
@ -568,10 +568,10 @@ s64 cellPngDecExtDecodeData(
vm::ptr<CellPngDecDispParam> dispParam) vm::ptr<CellPngDecDispParam> dispParam)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x5D38, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x5D38, libpngdec_rtoc);
#else #else
cellPngDec->Warning("cellPngDecExtDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x, cbCtrlDisp_addr=0x%x, dispParam_addr=0x%x)", cellPngDec.Warning("cellPngDecExtDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x, cbCtrlDisp_addr=0x%x, dispParam_addr=0x%x)",
mainHandle.addr(), subHandle.addr(), data.addr(), dataCtrlParam.addr(), dataOutInfo.addr(), cbCtrlDisp.addr(), dispParam.addr()); mainHandle.addr(), subHandle.addr(), data.addr(), dataCtrlParam.addr(), dataOutInfo.addr(), cbCtrlDisp.addr(), dispParam.addr());
return pngDecodeData(subHandle, data, dataCtrlParam, dataOutInfo, cbCtrlDisp, dispParam); return pngDecodeData(subHandle, data, dataCtrlParam, dataOutInfo, cbCtrlDisp, dispParam);
@ -585,7 +585,7 @@ s64 cellPngDecGetUnknownChunks(
vm::ptr<u32> unknownChunkNumber) vm::ptr<u32> unknownChunkNumber)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x03EC, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x03EC, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -596,7 +596,7 @@ s64 cellPngDecGetUnknownChunks(
s64 cellPngDecGetpCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPCAL> pcal) s64 cellPngDecGetpCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPCAL> pcal)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x0730, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x0730, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -607,7 +607,7 @@ s64 cellPngDecGetpCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGetcHRM(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngCHRM> chrm) s64 cellPngDecGetcHRM(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngCHRM> chrm)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x0894, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x0894, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -618,7 +618,7 @@ s64 cellPngDecGetcHRM(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGetsCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSCAL> scal) s64 cellPngDecGetsCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSCAL> scal)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x09EC, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x09EC, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -629,7 +629,7 @@ s64 cellPngDecGetsCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGetpHYs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPHYS> phys) s64 cellPngDecGetpHYs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPHYS> phys)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x0B14, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x0B14, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -640,7 +640,7 @@ s64 cellPngDecGetpHYs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGetoFFs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngOFFS> offs) s64 cellPngDecGetoFFs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngOFFS> offs)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x0C58, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x0C58, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -651,7 +651,7 @@ s64 cellPngDecGetoFFs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGetsPLT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSPLT> splt) s64 cellPngDecGetsPLT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSPLT> splt)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x0D9C, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x0D9C, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -662,7 +662,7 @@ s64 cellPngDecGetsPLT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGetbKGD(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngBKGD> bkgd) s64 cellPngDecGetbKGD(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngBKGD> bkgd)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x0ED0, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x0ED0, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -673,7 +673,7 @@ s64 cellPngDecGetbKGD(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGettIME(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTIME> time) s64 cellPngDecGettIME(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTIME> time)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x1024, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x1024, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -684,7 +684,7 @@ s64 cellPngDecGettIME(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGethIST(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngHIST> hist) s64 cellPngDecGethIST(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngHIST> hist)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x116C, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x116C, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -695,7 +695,7 @@ s64 cellPngDecGethIST(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGettRNS(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTRNS> trns) s64 cellPngDecGettRNS(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTRNS> trns)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x12A4, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x12A4, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -706,7 +706,7 @@ s64 cellPngDecGettRNS(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGetsBIT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSBIT> sbit) s64 cellPngDecGetsBIT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSBIT> sbit)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x1420, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x1420, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -717,7 +717,7 @@ s64 cellPngDecGetsBIT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGetiCCP(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngICCP> iccp) s64 cellPngDecGetiCCP(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngICCP> iccp)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x1574, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x1574, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -728,7 +728,7 @@ s64 cellPngDecGetiCCP(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGetsRGB(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSRGB> srgb) s64 cellPngDecGetsRGB(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSRGB> srgb)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x16B4, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x16B4, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -739,7 +739,7 @@ s64 cellPngDecGetsRGB(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGetgAMA(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngGAMA> gama) s64 cellPngDecGetgAMA(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngGAMA> gama)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x17CC, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x17CC, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -750,7 +750,7 @@ s64 cellPngDecGetgAMA(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
s64 cellPngDecGetPLTE(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPLTE> plte) s64 cellPngDecGetPLTE(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPLTE> plte)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x18E4, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x18E4, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -765,7 +765,7 @@ s64 cellPngDecGetTextChunk(
vm::ptr<vm::bptr<CellPngTextInfo>> textInfo) vm::ptr<vm::bptr<CellPngTextInfo>> textInfo)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__); cellPngDec.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libpngdec + 0x19FC, libpngdec_rtoc); return GetCurrentPPUThread().FastCall2(libpngdec + 0x19FC, libpngdec_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellPngDec); UNIMPLEMENTED_FUNC(cellPngDec);
@ -773,10 +773,8 @@ s64 cellPngDecGetTextChunk(
#endif #endif
} }
void cellPngDec_init(Module *pxThis) Module cellPngDec("cellPngDec", []()
{ {
cellPngDec = pxThis;
REG_FUNC(cellPngDec, cellPngDecGetUnknownChunks); REG_FUNC(cellPngDec, cellPngDecGetUnknownChunks);
REG_FUNC(cellPngDec, cellPngDecClose); REG_FUNC(cellPngDec, cellPngDecClose);
REG_FUNC(cellPngDec, cellPngDecGetpCAL); REG_FUNC(cellPngDec, cellPngDecGetpCAL);
@ -853,4 +851,4 @@ void cellPngDec_init(Module *pxThis)
fix_relocs(cellPngDec, libpngdec, 0x41C30, 0x47AB0, 0x40A00); fix_relocs(cellPngDec, libpngdec, 0x41C30, 0x47AB0, 0x40A00);
}); });
#endif #endif
} });

View file

@ -8,7 +8,7 @@
#include "Emu/RSX/GSManager.h" #include "Emu/RSX/GSManager.h"
#include "cellResc.h" #include "cellResc.h"
Module *cellResc = nullptr; extern Module cellResc;
extern s32 cellVideoOutConfigure(u32 videoOut, vm::ptr<CellVideoOutConfiguration> config, vm::ptr<CellVideoOutOption> option, u32 waitForEvent); extern s32 cellVideoOutConfigure(u32 videoOut, vm::ptr<CellVideoOutConfiguration> config, vm::ptr<CellVideoOutOption> option, u32 waitForEvent);
extern s32 cellGcmSetFlipMode(u32 mode); extern s32 cellGcmSetFlipMode(u32 mode);
@ -569,17 +569,17 @@ void SetupSurfaces(vm::ptr<CellGcmContextData>& cntxt)
// Module Functions // Module Functions
int cellRescInit(vm::ptr<CellRescInitConfig> initConfig) int cellRescInit(vm::ptr<CellRescInitConfig> initConfig)
{ {
cellResc->Warning("cellRescInit(initConfig_addr=0x%x)", initConfig.addr()); cellResc.Warning("cellRescInit(initConfig_addr=0x%x)", initConfig.addr());
if (s_rescInternalInstance->m_bInitialized) if (s_rescInternalInstance->m_bInitialized)
{ {
cellResc->Error("cellRescInit : CELL_RESC_ERROR_REINITIALIZED"); cellResc.Error("cellRescInit : CELL_RESC_ERROR_REINITIALIZED");
return CELL_RESC_ERROR_REINITIALIZED; return CELL_RESC_ERROR_REINITIALIZED;
} }
if (InternalVersion(initConfig) == -1 || !CheckInitConfig(initConfig)) if (InternalVersion(initConfig) == -1 || !CheckInitConfig(initConfig))
{ {
cellResc->Error("cellRescInit : CELL_RESC_ERROR_BAD_ARGUMENT"); cellResc.Error("cellRescInit : CELL_RESC_ERROR_BAD_ARGUMENT");
return CELL_RESC_ERROR_BAD_ARGUMENT; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -592,11 +592,11 @@ int cellRescInit(vm::ptr<CellRescInitConfig> initConfig)
void cellRescExit() void cellRescExit()
{ {
cellResc->Warning("cellRescExit()"); cellResc.Warning("cellRescExit()");
if (!s_rescInternalInstance->m_bInitialized) if (!s_rescInternalInstance->m_bInitialized)
{ {
cellResc->Error("cellRescExit(): not initialized"); cellResc.Error("cellRescExit(): not initialized");
return; return;
} }
@ -612,7 +612,7 @@ void cellRescExit()
//int ret = ExitSystemResource(); //int ret = ExitSystemResource();
//if (ret != CELL_OK) //if (ret != CELL_OK)
//{ //{
// cellResc->Error("failed to clean up system resources.. continue. 0x%x\n", ret); // cellResc.Error("failed to clean up system resources.. continue. 0x%x\n", ret);
//} //}
} }
} }
@ -622,7 +622,7 @@ void cellRescExit()
int cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, vm::ptr<u32> bufferMode) int cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, vm::ptr<u32> bufferMode)
{ {
cellResc->Log("cellRescVideoOutResolutionId2RescBufferMode(resolutionId=%d, bufferMode_addr=0x%x)", resolutionId, bufferMode.addr()); cellResc.Log("cellRescVideoOutResolutionId2RescBufferMode(resolutionId=%d, bufferMode_addr=0x%x)", resolutionId, bufferMode.addr());
switch (resolutionId) switch (resolutionId)
{ {
@ -639,7 +639,7 @@ int cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, vm::ptr<u32> b
*bufferMode = CELL_RESC_720x576; *bufferMode = CELL_RESC_720x576;
break; break;
default: default:
cellResc->Error("cellRescVideoOutResolutionId2RescBufferMod : CELL_RESC_ERROR_BAD_ARGUMENT"); cellResc.Error("cellRescVideoOutResolutionId2RescBufferMod : CELL_RESC_ERROR_BAD_ARGUMENT");
return CELL_RESC_ERROR_BAD_ARGUMENT; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -648,17 +648,17 @@ int cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, vm::ptr<u32> b
int cellRescSetDsts(u32 dstsMode, vm::ptr<CellRescDsts> dsts) int cellRescSetDsts(u32 dstsMode, vm::ptr<CellRescDsts> dsts)
{ {
cellResc->Log("cellRescSetDsts(dstsMode=%d, CellRescDsts_addr=0x%x)", dstsMode, dsts.addr()); cellResc.Log("cellRescSetDsts(dstsMode=%d, CellRescDsts_addr=0x%x)", dstsMode, dsts.addr());
if (!s_rescInternalInstance->m_bInitialized) if (!s_rescInternalInstance->m_bInitialized)
{ {
cellResc->Error("cellRescSetDst : CELL_RESC_ERROR_NOT_INITIALIZED"); cellResc.Error("cellRescSetDst : CELL_RESC_ERROR_NOT_INITIALIZED");
return CELL_RESC_ERROR_NOT_INITIALIZED; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if ((dstsMode != CELL_RESC_720x480) && (dstsMode != CELL_RESC_720x576) && (dstsMode != CELL_RESC_1280x720) && (dstsMode != CELL_RESC_1920x1080)) if ((dstsMode != CELL_RESC_720x480) && (dstsMode != CELL_RESC_720x576) && (dstsMode != CELL_RESC_1280x720) && (dstsMode != CELL_RESC_1920x1080))
{ {
cellResc->Error("cellRescSetDsts : CELL_RESC_ERROR_BAD_ARGUMENT"); cellResc.Error("cellRescSetDsts : CELL_RESC_ERROR_BAD_ARGUMENT");
return CELL_RESC_ERROR_BAD_ARGUMENT; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -715,24 +715,24 @@ void SetFlipHandler(vm::ptr<void(u32)> handler)
int cellRescSetDisplayMode(u32 displayMode) int cellRescSetDisplayMode(u32 displayMode)
{ {
cellResc->Warning("cellRescSetDisplayMode(displayMode=%d)", displayMode); cellResc.Warning("cellRescSetDisplayMode(displayMode=%d)", displayMode);
if (!s_rescInternalInstance->m_bInitialized) if (!s_rescInternalInstance->m_bInitialized)
{ {
cellResc->Error("cellRescSetDisplayMode : CELL_RESC_ERROR_NOT_INITIALIZED"); cellResc.Error("cellRescSetDisplayMode : CELL_RESC_ERROR_NOT_INITIALIZED");
return CELL_RESC_ERROR_NOT_INITIALIZED; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if (!(s_rescInternalInstance->m_initConfig.supportModes & displayMode)) if (!(s_rescInternalInstance->m_initConfig.supportModes & displayMode))
{ {
cellResc->Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_ARGUMENT"); cellResc.Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_ARGUMENT");
return CELL_RESC_ERROR_BAD_ARGUMENT; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
if ((displayMode != CELL_RESC_720x480) && (displayMode != CELL_RESC_720x576) && if ((displayMode != CELL_RESC_720x480) && (displayMode != CELL_RESC_720x576) &&
(displayMode != CELL_RESC_1280x720) && (displayMode != CELL_RESC_1920x1080)) (displayMode != CELL_RESC_1280x720) && (displayMode != CELL_RESC_1920x1080))
{ {
cellResc->Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_ARGUMENT"); cellResc.Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_ARGUMENT");
return CELL_RESC_ERROR_BAD_ARGUMENT; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -740,13 +740,13 @@ int cellRescSetDisplayMode(u32 displayMode)
if ((IsPalInterpolate() || IsPalDrop()) && s_rescInternalInstance->m_initConfig.flipMode == CELL_RESC_DISPLAY_HSYNC) if ((IsPalInterpolate() || IsPalDrop()) && s_rescInternalInstance->m_initConfig.flipMode == CELL_RESC_DISPLAY_HSYNC)
{ {
cellResc->Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_COMBINATIONT"); cellResc.Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_COMBINATIONT");
return CELL_RESC_ERROR_BAD_COMBINATION; return CELL_RESC_ERROR_BAD_COMBINATION;
} }
if (IsPal60Hsync() && s_rescInternalInstance->m_initConfig.flipMode==CELL_RESC_DISPLAY_VSYNC) if (IsPal60Hsync() && s_rescInternalInstance->m_initConfig.flipMode==CELL_RESC_DISPLAY_VSYNC)
{ {
cellResc->Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_COMBINATIONT"); cellResc.Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_COMBINATIONT");
return CELL_RESC_ERROR_BAD_COMBINATION; return CELL_RESC_ERROR_BAD_COMBINATION;
} }
@ -805,17 +805,17 @@ int cellRescSetDisplayMode(u32 displayMode)
int cellRescAdjustAspectRatio(float horizontal, float vertical) int cellRescAdjustAspectRatio(float horizontal, float vertical)
{ {
cellResc->Warning("cellRescAdjustAspectRatio(horizontal=%f, vertical=%f)", horizontal, vertical); cellResc.Warning("cellRescAdjustAspectRatio(horizontal=%f, vertical=%f)", horizontal, vertical);
if (!s_rescInternalInstance->m_bInitialized) if (!s_rescInternalInstance->m_bInitialized)
{ {
cellResc->Error("cellRescAdjustAspectRatio : CELL_RESC_ERROR_NOT_INITIALIZED"); cellResc.Error("cellRescAdjustAspectRatio : CELL_RESC_ERROR_NOT_INITIALIZED");
return CELL_RESC_ERROR_NOT_INITIALIZED; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if ((horizontal < 0.5f || 2.f < horizontal) || (vertical < 0.5f || 2.f < vertical)) if ((horizontal < 0.5f || 2.f < horizontal) || (vertical < 0.5f || 2.f < vertical))
{ {
cellResc->Error("cellRescAdjustAspectRatio : CELL_RESC_ERROR_BAD_ARGUMENT"); cellResc.Error("cellRescAdjustAspectRatio : CELL_RESC_ERROR_BAD_ARGUMENT");
return CELL_RESC_ERROR_BAD_ARGUMENT; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -839,17 +839,17 @@ int cellRescAdjustAspectRatio(float horizontal, float vertical)
int cellRescSetPalInterpolateDropFlexRatio(float ratio) int cellRescSetPalInterpolateDropFlexRatio(float ratio)
{ {
cellResc->Warning("cellRescSetPalInterpolateDropFlexRatio(ratio=%f)", ratio); cellResc.Warning("cellRescSetPalInterpolateDropFlexRatio(ratio=%f)", ratio);
if (!s_rescInternalInstance->m_bInitialized) if (!s_rescInternalInstance->m_bInitialized)
{ {
cellResc->Error("cellRescSetPalInterpolateDropFlexRatio : CELL_RESC_ERROR_NOT_INITIALIZED"); cellResc.Error("cellRescSetPalInterpolateDropFlexRatio : CELL_RESC_ERROR_NOT_INITIALIZED");
return CELL_RESC_ERROR_NOT_INITIALIZED; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if (ratio < 0.f || 1.f < ratio) if (ratio < 0.f || 1.f < ratio)
{ {
cellResc->Error("cellRescSetPalInterpolateDropFlexRatio : CELL_RESC_ERROR_BAD_ARGUMENT"); cellResc.Error("cellRescSetPalInterpolateDropFlexRatio : CELL_RESC_ERROR_BAD_ARGUMENT");
return CELL_RESC_ERROR_BAD_ARGUMENT; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -860,12 +860,12 @@ int cellRescSetPalInterpolateDropFlexRatio(float ratio)
int cellRescGetBufferSize(vm::ptr<u32> colorBuffers, vm::ptr<u32> vertexArray, vm::ptr<u32> fragmentShader) int cellRescGetBufferSize(vm::ptr<u32> colorBuffers, vm::ptr<u32> vertexArray, vm::ptr<u32> fragmentShader)
{ {
cellResc->Warning("cellRescGetBufferSize(colorBuffers_addr=0x%x, vertexArray_addr=0x%x, fragmentShader_addr=0x%x)", cellResc.Warning("cellRescGetBufferSize(colorBuffers_addr=0x%x, vertexArray_addr=0x%x, fragmentShader_addr=0x%x)",
colorBuffers.addr(), vertexArray.addr(), fragmentShader.addr()); colorBuffers.addr(), vertexArray.addr(), fragmentShader.addr());
if (!s_rescInternalInstance->m_bInitialized) if (!s_rescInternalInstance->m_bInitialized)
{ {
cellResc->Error("cellRescGetBufferSize : CELL_RESC_ERROR_NOT_INITIALIZED"); cellResc.Error("cellRescGetBufferSize : CELL_RESC_ERROR_NOT_INITIALIZED");
return CELL_RESC_ERROR_NOT_INITIALIZED; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
@ -904,11 +904,11 @@ int cellRescGetBufferSize(vm::ptr<u32> colorBuffers, vm::ptr<u32> vertexArray, v
int cellRescGetNumColorBuffers(u32 dstMode, u32 palTemporalMode, u32 reserved) int cellRescGetNumColorBuffers(u32 dstMode, u32 palTemporalMode, u32 reserved)
{ {
cellResc->Log("cellRescGetNumColorBuffers(dstMode=%d, palTemporalMode=%d, reserved=%d)", dstMode, palTemporalMode, reserved); cellResc.Log("cellRescGetNumColorBuffers(dstMode=%d, palTemporalMode=%d, reserved=%d)", dstMode, palTemporalMode, reserved);
if (reserved != 0) if (reserved != 0)
{ {
cellResc->Error("cellRescGetNumColorBuffers : CELL_RESC_ERROR_BAD_ARGUMENT"); cellResc.Error("cellRescGetNumColorBuffers : CELL_RESC_ERROR_BAD_ARGUMENT");
return CELL_RESC_ERROR_BAD_ARGUMENT; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -925,7 +925,7 @@ int cellRescGetNumColorBuffers(u32 dstMode, u32 palTemporalMode, u32 reserved)
int cellRescGcmSurface2RescSrc(vm::ptr<CellGcmSurface> gcmSurface, vm::ptr<CellRescSrc> rescSrc) int cellRescGcmSurface2RescSrc(vm::ptr<CellGcmSurface> gcmSurface, vm::ptr<CellRescSrc> rescSrc)
{ {
cellResc->Log("cellRescGcmSurface2RescSrc(gcmSurface_addr=0x%x, rescSrc_addr=0x%x)", gcmSurface.addr(), rescSrc.addr()); cellResc.Log("cellRescGcmSurface2RescSrc(gcmSurface_addr=0x%x, rescSrc_addr=0x%x)", gcmSurface.addr(), rescSrc.addr());
u8 textureFormat = GcmSurfaceFormat2GcmTextureFormat(gcmSurface->colorFormat, gcmSurface->type); u8 textureFormat = GcmSurfaceFormat2GcmTextureFormat(gcmSurface->colorFormat, gcmSurface->type);
s32 xW = 1, xH = 1; s32 xW = 1, xH = 1;
@ -956,25 +956,25 @@ int cellRescGcmSurface2RescSrc(vm::ptr<CellGcmSurface> gcmSurface, vm::ptr<CellR
int cellRescSetSrc(s32 idx, vm::ptr<CellRescSrc> src) int cellRescSetSrc(s32 idx, vm::ptr<CellRescSrc> src)
{ {
cellResc->Log("cellRescSetSrc(idx=0x%x, src_addr=0x%x)", idx, src.addr()); cellResc.Log("cellRescSetSrc(idx=0x%x, src_addr=0x%x)", idx, src.addr());
if(!s_rescInternalInstance->m_bInitialized) if(!s_rescInternalInstance->m_bInitialized)
{ {
cellResc->Error("cellRescSetSrc : CELL_RESC_ERROR_NOT_INITIALIZED"); cellResc.Error("cellRescSetSrc : CELL_RESC_ERROR_NOT_INITIALIZED");
return CELL_RESC_ERROR_NOT_INITIALIZED; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if (idx < 0 || idx >= SRC_BUFFER_NUM || src->width < 1 || src->width > 4096 || src->height < 1 || src->height > 4096) if (idx < 0 || idx >= SRC_BUFFER_NUM || src->width < 1 || src->width > 4096 || src->height < 1 || src->height > 4096)
{ {
cellResc->Error("cellRescSetSrc : CELL_RESC_ERROR_BAD_ARGUMENT"); cellResc.Error("cellRescSetSrc : CELL_RESC_ERROR_BAD_ARGUMENT");
return CELL_RESC_ERROR_BAD_ARGUMENT; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
cellResc->Log(" *** format=0x%x", src->format); cellResc.Log(" *** format=0x%x", src->format);
cellResc->Log(" *** pitch=%d", src->pitch); cellResc.Log(" *** pitch=%d", src->pitch);
cellResc->Log(" *** width=%d", src->width); cellResc.Log(" *** width=%d", src->width);
cellResc->Log(" *** height=%d", src->height); cellResc.Log(" *** height=%d", src->height);
cellResc->Log(" *** offset=0x%x", src->offset); cellResc.Log(" *** offset=0x%x", src->offset);
s_rescInternalInstance->m_rescSrc[idx] = *src; s_rescInternalInstance->m_rescSrc[idx] = *src;
@ -985,17 +985,17 @@ int cellRescSetSrc(s32 idx, vm::ptr<CellRescSrc> src)
int cellRescSetConvertAndFlip(vm::ptr<CellGcmContextData> cntxt, s32 idx) int cellRescSetConvertAndFlip(vm::ptr<CellGcmContextData> cntxt, s32 idx)
{ {
cellResc->Log("cellRescSetConvertAndFlip(cntxt_addr=0x%x, indx=0x%x)", cntxt.addr(), idx); cellResc.Log("cellRescSetConvertAndFlip(cntxt_addr=0x%x, indx=0x%x)", cntxt.addr(), idx);
if(!s_rescInternalInstance->m_bInitialized) if(!s_rescInternalInstance->m_bInitialized)
{ {
cellResc->Error("cellRescSetConvertAndFlip : CELL_RESC_ERROR_NOT_INITIALIZED"); cellResc.Error("cellRescSetConvertAndFlip : CELL_RESC_ERROR_NOT_INITIALIZED");
return CELL_RESC_ERROR_NOT_INITIALIZED; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if(idx < 0 || SRC_BUFFER_NUM <= idx) if(idx < 0 || SRC_BUFFER_NUM <= idx)
{ {
cellResc->Error("cellRescSetConvertAndFlip : CELL_RESC_ERROR_BAD_ARGUMENT"); cellResc.Error("cellRescSetConvertAndFlip : CELL_RESC_ERROR_BAD_ARGUMENT");
return CELL_RESC_ERROR_BAD_ARGUMENT; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -1023,7 +1023,7 @@ int cellRescSetConvertAndFlip(vm::ptr<CellGcmContextData> cntxt, s32 idx)
int cellRescSetWaitFlip() int cellRescSetWaitFlip()
{ {
cellResc->Log("cellRescSetWaitFlip()"); cellResc.Log("cellRescSetWaitFlip()");
GSLockCurrent lock(GS_LOCK_WAIT_FLIP); GSLockCurrent lock(GS_LOCK_WAIT_FLIP);
return CELL_OK; return CELL_OK;
@ -1031,17 +1031,17 @@ int cellRescSetWaitFlip()
int cellRescSetBufferAddress(vm::ptr<u32> colorBuffers, vm::ptr<u32> vertexArray, vm::ptr<u32> fragmentShader) int cellRescSetBufferAddress(vm::ptr<u32> colorBuffers, vm::ptr<u32> vertexArray, vm::ptr<u32> fragmentShader)
{ {
cellResc->Warning("cellRescSetBufferAddress(colorBuffers_addr=0x%x, vertexArray_addr=0x%x, fragmentShader_addr=0x%x)", colorBuffers.addr(), vertexArray.addr(), fragmentShader.addr()); cellResc.Warning("cellRescSetBufferAddress(colorBuffers_addr=0x%x, vertexArray_addr=0x%x, fragmentShader_addr=0x%x)", colorBuffers.addr(), vertexArray.addr(), fragmentShader.addr());
if(!s_rescInternalInstance->m_bInitialized) if(!s_rescInternalInstance->m_bInitialized)
{ {
cellResc->Error("cellRescSetBufferAddress : CELL_RESC_ERROR_NOT_INITIALIZED"); cellResc.Error("cellRescSetBufferAddress : CELL_RESC_ERROR_NOT_INITIALIZED");
return CELL_RESC_ERROR_NOT_INITIALIZED; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if(colorBuffers.addr() % COLOR_BUFFER_ALIGNMENT || vertexArray.addr() % VERTEX_BUFFER_ALIGNMENT || fragmentShader.addr() % FRAGMENT_SHADER_ALIGNMENT) if(colorBuffers.addr() % COLOR_BUFFER_ALIGNMENT || vertexArray.addr() % VERTEX_BUFFER_ALIGNMENT || fragmentShader.addr() % FRAGMENT_SHADER_ALIGNMENT)
{ {
cellResc->Error("cellRescSetBufferAddress : CELL_RESC_ERROR_BAD_ALIGNMENT"); cellResc.Error("cellRescSetBufferAddress : CELL_RESC_ERROR_BAD_ALIGNMENT");
return CELL_RESC_ERROR_BAD_ALIGNMENT; return CELL_RESC_ERROR_BAD_ALIGNMENT;
} }
@ -1075,21 +1075,21 @@ int cellRescSetBufferAddress(vm::ptr<u32> colorBuffers, vm::ptr<u32> vertexArray
void cellRescSetFlipHandler(vm::ptr<void(u32)> handler) void cellRescSetFlipHandler(vm::ptr<void(u32)> handler)
{ {
cellResc->Warning("cellRescSetFlipHandler(handler_addr=0x%x)", handler.addr()); cellResc.Warning("cellRescSetFlipHandler(handler_addr=0x%x)", handler.addr());
Emu.GetGSManager().GetRender().m_flip_handler = handler; Emu.GetGSManager().GetRender().m_flip_handler = handler;
} }
void cellRescResetFlipStatus() void cellRescResetFlipStatus()
{ {
cellResc->Log("cellRescResetFlipStatus()"); cellResc.Log("cellRescResetFlipStatus()");
Emu.GetGSManager().GetRender().m_flip_status = 1; Emu.GetGSManager().GetRender().m_flip_status = 1;
} }
int cellRescGetFlipStatus() int cellRescGetFlipStatus()
{ {
cellResc->Log("cellRescGetFlipStatus()"); cellResc.Log("cellRescGetFlipStatus()");
return Emu.GetGSManager().GetRender().m_flip_status; return Emu.GetGSManager().GetRender().m_flip_status;
} }
@ -1102,7 +1102,7 @@ int cellRescGetRegisterCount()
u64 cellRescGetLastFlipTime() u64 cellRescGetLastFlipTime()
{ {
cellResc->Log("cellRescGetLastFlipTime()"); cellResc.Log("cellRescGetLastFlipTime()");
return Emu.GetGSManager().GetRender().m_last_flip_time; return Emu.GetGSManager().GetRender().m_last_flip_time;
} }
@ -1115,7 +1115,7 @@ int cellRescSetRegisterCount()
void cellRescSetVBlankHandler(vm::ptr<void(u32)> handler) void cellRescSetVBlankHandler(vm::ptr<void(u32)> handler)
{ {
cellResc->Warning("cellRescSetVBlankHandler(handler_addr=0x%x)", handler.addr()); cellResc.Warning("cellRescSetVBlankHandler(handler_addr=0x%x)", handler.addr());
Emu.GetGSManager().GetRender().m_vblank_handler = handler; Emu.GetGSManager().GetRender().m_vblank_handler = handler;
} }
@ -1212,23 +1212,23 @@ int CreateInterlaceTable(u32 ea_addr, float srcH, float dstH, CellRescTableEleme
int cellRescCreateInterlaceTable(u32 ea_addr, float srcH, CellRescTableElement depth, int length) int cellRescCreateInterlaceTable(u32 ea_addr, float srcH, CellRescTableElement depth, int length)
{ {
cellResc->Warning("cellRescCreateInterlaceTable(ea_addr=0x%x, srcH=%f, depth=%d, length=%d)", ea_addr, srcH, depth, length); cellResc.Warning("cellRescCreateInterlaceTable(ea_addr=0x%x, srcH=%f, depth=%d, length=%d)", ea_addr, srcH, depth, length);
if (!s_rescInternalInstance->m_bInitialized) if (!s_rescInternalInstance->m_bInitialized)
{ {
cellResc->Error("cellRescCreateInterlaceTable : CELL_RESC_ERROR_NOT_INITIALIZED"); cellResc.Error("cellRescCreateInterlaceTable : CELL_RESC_ERROR_NOT_INITIALIZED");
return CELL_RESC_ERROR_NOT_INITIALIZED; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if ((ea_addr == 0) || (srcH <= 0.f) || (!(depth == CELL_RESC_ELEMENT_HALF || depth == CELL_RESC_ELEMENT_FLOAT)) || (length <= 0)) if ((ea_addr == 0) || (srcH <= 0.f) || (!(depth == CELL_RESC_ELEMENT_HALF || depth == CELL_RESC_ELEMENT_FLOAT)) || (length <= 0))
{ {
cellResc->Error("cellRescCreateInterlaceTable : CELL_RESC_ERROR_NOT_INITIALIZED"); cellResc.Error("cellRescCreateInterlaceTable : CELL_RESC_ERROR_NOT_INITIALIZED");
return CELL_RESC_ERROR_BAD_ARGUMENT; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
if (s_rescInternalInstance->m_dstHeight == 0) if (s_rescInternalInstance->m_dstHeight == 0)
{ {
cellResc->Error("cellRescCreateInterlaceTable : CELL_RESC_ERROR_BAD_COMBINATION"); cellResc.Error("cellRescCreateInterlaceTable : CELL_RESC_ERROR_BAD_COMBINATION");
return CELL_RESC_ERROR_BAD_COMBINATION; return CELL_RESC_ERROR_BAD_COMBINATION;
} }
@ -1249,40 +1249,35 @@ int cellRescCreateInterlaceTable(u32 ea_addr, float srcH, CellRescTableElement d
} }
void cellResc_init(Module *pxThis) Module cellResc("cellResc", []()
{
cellResc = pxThis;
cellResc->AddFunc(0x25c107e6, cellRescSetConvertAndFlip);
cellResc->AddFunc(0x0d3c22ce, cellRescSetWaitFlip);
cellResc->AddFunc(0x2ea94661, cellRescSetFlipHandler);
cellResc->AddFunc(0x01220224, cellRescGcmSurface2RescSrc);
cellResc->AddFunc(0x0a2069c7, cellRescGetNumColorBuffers);
cellResc->AddFunc(0x10db5b1a, cellRescSetDsts);
cellResc->AddFunc(0x129922a0, cellRescResetFlipStatus);
cellResc->AddFunc(0x19a2a967, cellRescSetPalInterpolateDropFlexRatio);
cellResc->AddFunc(0x1dd3c4cd, cellRescGetRegisterCount);
cellResc->AddFunc(0x22ae06d8, cellRescAdjustAspectRatio);
cellResc->AddFunc(0x23134710, cellRescSetDisplayMode);
cellResc->AddFunc(0x2ea3061e, cellRescExit);
cellResc->AddFunc(0x516ee89e, cellRescInit);
cellResc->AddFunc(0x5a338cdb, cellRescGetBufferSize);
cellResc->AddFunc(0x66f5e388, cellRescGetLastFlipTime);
cellResc->AddFunc(0x6cd0f95f, cellRescSetSrc);
cellResc->AddFunc(0x7af8a37f, cellRescSetRegisterCount);
cellResc->AddFunc(0x8107277c, cellRescSetBufferAddress);
cellResc->AddFunc(0xc47c5c22, cellRescGetFlipStatus);
cellResc->AddFunc(0xd1ca0503, cellRescVideoOutResolutionId2RescBufferMode);
cellResc->AddFunc(0xd3758645, cellRescSetVBlankHandler);
cellResc->AddFunc(0xe0cef79e, cellRescCreateInterlaceTable);
}
void cellResc_load()
{ {
s_rescInternalInstance = new CCellRescInternal(); s_rescInternalInstance = new CCellRescInternal();
}
void cellResc_unload() cellResc.on_stop = []()
{ {
delete s_rescInternalInstance; delete s_rescInternalInstance;
} };
cellResc.AddFunc(0x25c107e6, cellRescSetConvertAndFlip);
cellResc.AddFunc(0x0d3c22ce, cellRescSetWaitFlip);
cellResc.AddFunc(0x2ea94661, cellRescSetFlipHandler);
cellResc.AddFunc(0x01220224, cellRescGcmSurface2RescSrc);
cellResc.AddFunc(0x0a2069c7, cellRescGetNumColorBuffers);
cellResc.AddFunc(0x10db5b1a, cellRescSetDsts);
cellResc.AddFunc(0x129922a0, cellRescResetFlipStatus);
cellResc.AddFunc(0x19a2a967, cellRescSetPalInterpolateDropFlexRatio);
cellResc.AddFunc(0x1dd3c4cd, cellRescGetRegisterCount);
cellResc.AddFunc(0x22ae06d8, cellRescAdjustAspectRatio);
cellResc.AddFunc(0x23134710, cellRescSetDisplayMode);
cellResc.AddFunc(0x2ea3061e, cellRescExit);
cellResc.AddFunc(0x516ee89e, cellRescInit);
cellResc.AddFunc(0x5a338cdb, cellRescGetBufferSize);
cellResc.AddFunc(0x66f5e388, cellRescGetLastFlipTime);
cellResc.AddFunc(0x6cd0f95f, cellRescSetSrc);
cellResc.AddFunc(0x7af8a37f, cellRescSetRegisterCount);
cellResc.AddFunc(0x8107277c, cellRescSetBufferAddress);
cellResc.AddFunc(0xc47c5c22, cellRescGetFlipStatus);
cellResc.AddFunc(0xd1ca0503, cellRescVideoOutResolutionId2RescBufferMode);
cellResc.AddFunc(0xd3758645, cellRescSetVBlankHandler);
cellResc.AddFunc(0xe0cef79e, cellRescCreateInterlaceTable);
});

View file

@ -5,7 +5,7 @@
#include "Utilities/rTime.h" #include "Utilities/rTime.h"
#include "cellRtc.h" #include "cellRtc.h"
Module *cellRtc = nullptr; extern Module cellRtc;
s64 convertToUNIXTime(u16 seconds, u16 minutes, u16 hours, u16 days, int years) s64 convertToUNIXTime(u16 seconds, u16 minutes, u16 hours, u16 days, int years)
{ {
@ -24,7 +24,7 @@ u64 convertToWin32FILETIME(u16 seconds, u16 minutes, u16 hours, u16 days, int ye
int cellRtcGetCurrentTick(vm::ptr<CellRtcTick> pTick) int cellRtcGetCurrentTick(vm::ptr<CellRtcTick> pTick)
{ {
cellRtc->Log("cellRtcGetCurrentTick(pTick=0x%x)", pTick.addr()); cellRtc.Log("cellRtcGetCurrentTick(pTick=0x%x)", pTick.addr());
rDateTime unow = rDateTime::UNow(); rDateTime unow = rDateTime::UNow();
pTick->tick = unow.GetTicks(); pTick->tick = unow.GetTicks();
@ -33,7 +33,7 @@ int cellRtcGetCurrentTick(vm::ptr<CellRtcTick> pTick)
int cellRtcGetCurrentClock(vm::ptr<CellRtcDateTime> pClock, s32 iTimeZone) int cellRtcGetCurrentClock(vm::ptr<CellRtcDateTime> pClock, s32 iTimeZone)
{ {
cellRtc->Log("cellRtcGetCurrentClock(pClock=0x%x, time_zone=%d)", pClock.addr(), iTimeZone); cellRtc.Log("cellRtcGetCurrentClock(pClock=0x%x, time_zone=%d)", pClock.addr(), iTimeZone);
rDateTime unow = rDateTime::UNow(); rDateTime unow = rDateTime::UNow();
@ -54,7 +54,7 @@ int cellRtcGetCurrentClock(vm::ptr<CellRtcDateTime> pClock, s32 iTimeZone)
int cellRtcGetCurrentClockLocalTime(vm::ptr<CellRtcDateTime> pClock) int cellRtcGetCurrentClockLocalTime(vm::ptr<CellRtcDateTime> pClock)
{ {
cellRtc->Log("cellRtcGetCurrentClockLocalTime(pClock=0x%x)", pClock.addr()); cellRtc.Log("cellRtcGetCurrentClockLocalTime(pClock=0x%x)", pClock.addr());
rDateTime unow = rDateTime::UNow(); rDateTime unow = rDateTime::UNow();
@ -71,7 +71,7 @@ int cellRtcGetCurrentClockLocalTime(vm::ptr<CellRtcDateTime> pClock)
int cellRtcFormatRfc2822(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc, s32 iTimeZone) int cellRtcFormatRfc2822(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc, s32 iTimeZone)
{ {
cellRtc->Log("cellRtcFormatRfc2822(pszDateTime_addr=0x%x, pUtc=0x%x, time_zone=%d)", pszDateTime.addr(), pUtc.addr(), iTimeZone); cellRtc.Log("cellRtcFormatRfc2822(pszDateTime_addr=0x%x, pUtc=0x%x, time_zone=%d)", pszDateTime.addr(), pUtc.addr(), iTimeZone);
// Add time_zone as offset in minutes. // Add time_zone as offset in minutes.
rTimeSpan tz = rTimeSpan(0, (long) iTimeZone, 0, 0); rTimeSpan tz = rTimeSpan(0, (long) iTimeZone, 0, 0);
@ -89,7 +89,7 @@ int cellRtcFormatRfc2822(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc, s
int cellRtcFormatRfc2822LocalTime(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc) int cellRtcFormatRfc2822LocalTime(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc)
{ {
cellRtc->Log("cellRtcFormatRfc2822LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime.addr(), pUtc.addr()); cellRtc.Log("cellRtcFormatRfc2822LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime.addr(), pUtc.addr());
// Get date from ticks. // Get date from ticks.
rDateTime date = rDateTime((time_t)pUtc->tick); rDateTime date = rDateTime((time_t)pUtc->tick);
@ -103,7 +103,7 @@ int cellRtcFormatRfc2822LocalTime(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick
int cellRtcFormatRfc3339(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc, s32 iTimeZone) int cellRtcFormatRfc3339(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc, s32 iTimeZone)
{ {
cellRtc->Log("cellRtcFormatRfc3339(pszDateTime_addr=0x%x, pUtc=0x%x, iTimeZone=%d)", pszDateTime.addr(), pUtc.addr(), iTimeZone); cellRtc.Log("cellRtcFormatRfc3339(pszDateTime_addr=0x%x, pUtc=0x%x, iTimeZone=%d)", pszDateTime.addr(), pUtc.addr(), iTimeZone);
// Add time_zone as offset in minutes. // Add time_zone as offset in minutes.
rTimeSpan tz = rTimeSpan(0, (long) iTimeZone, 0, 0); rTimeSpan tz = rTimeSpan(0, (long) iTimeZone, 0, 0);
@ -121,7 +121,7 @@ int cellRtcFormatRfc3339(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc, s
int cellRtcFormatRfc3339LocalTime(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc) int cellRtcFormatRfc3339LocalTime(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc)
{ {
cellRtc->Log("cellRtcFormatRfc3339LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime.addr(), pUtc.addr()); cellRtc.Log("cellRtcFormatRfc3339LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime.addr(), pUtc.addr());
// Get date from ticks. // Get date from ticks.
rDateTime date = rDateTime((time_t) pUtc->tick); rDateTime date = rDateTime((time_t) pUtc->tick);
@ -135,7 +135,7 @@ int cellRtcFormatRfc3339LocalTime(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick
int cellRtcParseDateTime(vm::ptr<CellRtcTick> pUtc, vm::ptr<const char> pszDateTime) int cellRtcParseDateTime(vm::ptr<CellRtcTick> pUtc, vm::ptr<const char> pszDateTime)
{ {
cellRtc->Log("cellRtcParseDateTime(pUtc=0x%x, pszDateTime_addr=0x%x)", pUtc.addr(), pszDateTime.addr()); cellRtc.Log("cellRtcParseDateTime(pUtc=0x%x, pszDateTime_addr=0x%x)", pUtc.addr(), pszDateTime.addr());
// Get date from formatted string. // Get date from formatted string.
rDateTime date; rDateTime date;
@ -148,7 +148,7 @@ int cellRtcParseDateTime(vm::ptr<CellRtcTick> pUtc, vm::ptr<const char> pszDateT
int cellRtcParseRfc3339(vm::ptr<CellRtcTick> pUtc, vm::ptr<const char> pszDateTime) int cellRtcParseRfc3339(vm::ptr<CellRtcTick> pUtc, vm::ptr<const char> pszDateTime)
{ {
cellRtc->Log("cellRtcParseRfc3339(pUtc=0x%x, pszDateTime_addr=0x%x)", pUtc.addr(), pszDateTime.addr()); cellRtc.Log("cellRtcParseRfc3339(pUtc=0x%x, pszDateTime_addr=0x%x)", pUtc.addr(), pszDateTime.addr());
// Get date from RFC3339 formatted string. // Get date from RFC3339 formatted string.
rDateTime date; rDateTime date;
@ -161,7 +161,7 @@ int cellRtcParseRfc3339(vm::ptr<CellRtcTick> pUtc, vm::ptr<const char> pszDateTi
int cellRtcGetTick(vm::ptr<CellRtcDateTime> pTime, vm::ptr<CellRtcTick> pTick) int cellRtcGetTick(vm::ptr<CellRtcDateTime> pTime, vm::ptr<CellRtcTick> pTick)
{ {
cellRtc->Log("cellRtcGetTick(pTime=0x%x, pTick=0x%x)", pTime.addr(), pTick.addr()); cellRtc.Log("cellRtcGetTick(pTime=0x%x, pTick=0x%x)", pTime.addr(), pTick.addr());
rDateTime datetime = rDateTime(pTime->day, (rDateTime::Month)pTime->month.value(), pTime->year, pTime->hour, pTime->minute, pTime->second, (pTime->microsecond / 1000)); rDateTime datetime = rDateTime(pTime->day, (rDateTime::Month)pTime->month.value(), pTime->year, pTime->hour, pTime->minute, pTime->second, (pTime->microsecond / 1000));
pTick->tick = datetime.GetTicks(); pTick->tick = datetime.GetTicks();
@ -171,7 +171,7 @@ int cellRtcGetTick(vm::ptr<CellRtcDateTime> pTime, vm::ptr<CellRtcTick> pTick)
int cellRtcSetTick(vm::ptr<CellRtcDateTime> pTime, vm::ptr<CellRtcTick> pTick) int cellRtcSetTick(vm::ptr<CellRtcDateTime> pTime, vm::ptr<CellRtcTick> pTick)
{ {
cellRtc->Log("cellRtcSetTick(pTime=0x%x, pTick=0x%x)", pTime.addr(), pTick.addr()); cellRtc.Log("cellRtcSetTick(pTime=0x%x, pTick=0x%x)", pTime.addr(), pTick.addr());
rDateTime date = rDateTime((time_t)pTick->tick); rDateTime date = rDateTime((time_t)pTick->tick);
@ -188,7 +188,7 @@ int cellRtcSetTick(vm::ptr<CellRtcDateTime> pTime, vm::ptr<CellRtcTick> pTick)
int cellRtcTickAddTicks(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s64 lAdd) int cellRtcTickAddTicks(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s64 lAdd)
{ {
cellRtc->Log("cellRtcTickAddTicks(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.addr(), pTick1.addr(), lAdd); cellRtc.Log("cellRtcTickAddTicks(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.addr(), pTick1.addr(), lAdd);
pTick0->tick = pTick1->tick + lAdd; pTick0->tick = pTick1->tick + lAdd;
return CELL_OK; return CELL_OK;
@ -196,7 +196,7 @@ int cellRtcTickAddTicks(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1
int cellRtcTickAddMicroseconds(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s64 lAdd) int cellRtcTickAddMicroseconds(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s64 lAdd)
{ {
cellRtc->Log("cellRtcTickAddMicroseconds(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.addr(), pTick1.addr(), lAdd); cellRtc.Log("cellRtcTickAddMicroseconds(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.addr(), pTick1.addr(), lAdd);
rDateTime date = rDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
rTimeSpan microseconds = rTimeSpan(0, 0, 0, lAdd / 1000); rTimeSpan microseconds = rTimeSpan(0, 0, 0, lAdd / 1000);
@ -208,7 +208,7 @@ int cellRtcTickAddMicroseconds(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick>
int cellRtcTickAddSeconds(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s64 lAdd) int cellRtcTickAddSeconds(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s64 lAdd)
{ {
cellRtc->Log("cellRtcTickAddSeconds(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.addr(), pTick1.addr(), lAdd); cellRtc.Log("cellRtcTickAddSeconds(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.addr(), pTick1.addr(), lAdd);
rDateTime date = rDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
rTimeSpan seconds = rTimeSpan(0, 0, lAdd, 0); rTimeSpan seconds = rTimeSpan(0, 0, lAdd, 0);
@ -220,7 +220,7 @@ int cellRtcTickAddSeconds(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTic
int cellRtcTickAddMinutes(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s64 lAdd) int cellRtcTickAddMinutes(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s64 lAdd)
{ {
cellRtc->Log("cellRtcTickAddMinutes(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.addr(), pTick1.addr(), lAdd); cellRtc.Log("cellRtcTickAddMinutes(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.addr(), pTick1.addr(), lAdd);
rDateTime date = rDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
rTimeSpan minutes = rTimeSpan(0, lAdd, 0, 0); // ??? rTimeSpan minutes = rTimeSpan(0, lAdd, 0, 0); // ???
@ -232,7 +232,7 @@ int cellRtcTickAddMinutes(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTic
int cellRtcTickAddHours(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s32 iAdd) int cellRtcTickAddHours(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s32 iAdd)
{ {
cellRtc->Log("cellRtcTickAddHours(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.addr(), pTick1.addr(), iAdd); cellRtc.Log("cellRtcTickAddHours(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.addr(), pTick1.addr(), iAdd);
rDateTime date = rDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
rTimeSpan hours = rTimeSpan(iAdd, 0, 0, 0); // ??? rTimeSpan hours = rTimeSpan(iAdd, 0, 0, 0); // ???
@ -244,7 +244,7 @@ int cellRtcTickAddHours(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1
int cellRtcTickAddDays(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s32 iAdd) int cellRtcTickAddDays(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s32 iAdd)
{ {
cellRtc->Log("cellRtcTickAddDays(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.addr(), pTick1.addr(), iAdd); cellRtc.Log("cellRtcTickAddDays(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.addr(), pTick1.addr(), iAdd);
rDateTime date = rDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
rDateSpan days = rDateSpan(0, 0, 0, iAdd); // ??? rDateSpan days = rDateSpan(0, 0, 0, iAdd); // ???
@ -256,7 +256,7 @@ int cellRtcTickAddDays(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1,
int cellRtcTickAddWeeks(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s32 iAdd) int cellRtcTickAddWeeks(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s32 iAdd)
{ {
cellRtc->Log("cellRtcTickAddWeeks(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.addr(), pTick1.addr(), iAdd); cellRtc.Log("cellRtcTickAddWeeks(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.addr(), pTick1.addr(), iAdd);
rDateTime date = rDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
rDateSpan weeks = rDateSpan(0, 0, iAdd, 0); rDateSpan weeks = rDateSpan(0, 0, iAdd, 0);
@ -268,7 +268,7 @@ int cellRtcTickAddWeeks(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1
int cellRtcTickAddMonths(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s32 iAdd) int cellRtcTickAddMonths(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s32 iAdd)
{ {
cellRtc->Log("cellRtcTickAddMonths(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.addr(), pTick1.addr(), iAdd); cellRtc.Log("cellRtcTickAddMonths(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.addr(), pTick1.addr(), iAdd);
rDateTime date = rDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
rDateSpan months = rDateSpan(0, iAdd, 0, 0); rDateSpan months = rDateSpan(0, iAdd, 0, 0);
@ -280,7 +280,7 @@ int cellRtcTickAddMonths(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick
int cellRtcTickAddYears(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s32 iAdd) int cellRtcTickAddYears(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1, s32 iAdd)
{ {
cellRtc->Log("cellRtcTickAddYears(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.addr(), pTick1.addr(), iAdd); cellRtc.Log("cellRtcTickAddYears(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.addr(), pTick1.addr(), iAdd);
rDateTime date = rDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
rDateSpan years = rDateSpan(iAdd, 0, 0, 0); rDateSpan years = rDateSpan(iAdd, 0, 0, 0);
@ -292,7 +292,7 @@ int cellRtcTickAddYears(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1
int cellRtcConvertUtcToLocalTime(vm::ptr<CellRtcTick> pUtc, vm::ptr<CellRtcTick> pLocalTime) int cellRtcConvertUtcToLocalTime(vm::ptr<CellRtcTick> pUtc, vm::ptr<CellRtcTick> pLocalTime)
{ {
cellRtc->Log("cellRtcConvertUtcToLocalTime(pUtc=0x%x, pLocalTime=0x%x)", pUtc.addr(), pLocalTime.addr()); cellRtc.Log("cellRtcConvertUtcToLocalTime(pUtc=0x%x, pLocalTime=0x%x)", pUtc.addr(), pLocalTime.addr());
rDateTime time = rDateTime((time_t)pUtc->tick); rDateTime time = rDateTime((time_t)pUtc->tick);
rDateTime local_time = time.FromUTC(false); rDateTime local_time = time.FromUTC(false);
@ -302,7 +302,7 @@ int cellRtcConvertUtcToLocalTime(vm::ptr<CellRtcTick> pUtc, vm::ptr<CellRtcTick>
int cellRtcConvertLocalTimeToUtc(vm::ptr<CellRtcTick> pLocalTime, vm::ptr<CellRtcTick> pUtc) int cellRtcConvertLocalTimeToUtc(vm::ptr<CellRtcTick> pLocalTime, vm::ptr<CellRtcTick> pUtc)
{ {
cellRtc->Log("cellRtcConvertLocalTimeToUtc(pLocalTime=0x%x, pUtc=0x%x)", pLocalTime.addr(), pUtc.addr()); cellRtc.Log("cellRtcConvertLocalTimeToUtc(pLocalTime=0x%x, pUtc=0x%x)", pLocalTime.addr(), pUtc.addr());
rDateTime time = rDateTime((time_t)pLocalTime->tick); rDateTime time = rDateTime((time_t)pLocalTime->tick);
rDateTime utc_time = time.ToUTC(false); rDateTime utc_time = time.ToUTC(false);
@ -312,7 +312,7 @@ int cellRtcConvertLocalTimeToUtc(vm::ptr<CellRtcTick> pLocalTime, vm::ptr<CellRt
int cellRtcGetDosTime(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<u32> puiDosTime) int cellRtcGetDosTime(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<u32> puiDosTime)
{ {
cellRtc->Log("cellRtcGetDosTime(pDateTime=0x%x, puiDosTime=0x%x)", pDateTime.addr(), puiDosTime.addr()); cellRtc.Log("cellRtcGetDosTime(pDateTime=0x%x, puiDosTime=0x%x)", pDateTime.addr(), puiDosTime.addr());
// Convert to DOS time. // Convert to DOS time.
rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.value(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.value(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000));
@ -323,7 +323,7 @@ int cellRtcGetDosTime(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<u32> puiDosTim
int cellRtcGetTime_t(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<s64> piTime) int cellRtcGetTime_t(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<s64> piTime)
{ {
cellRtc->Log("cellRtcGetTime_t(pDateTime=0x%x, piTime=0x%x)", pDateTime.addr(), piTime.addr()); cellRtc.Log("cellRtcGetTime_t(pDateTime=0x%x, piTime=0x%x)", pDateTime.addr(), piTime.addr());
// Convert to POSIX time_t. // Convert to POSIX time_t.
rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.value(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.value(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000));
@ -335,7 +335,7 @@ int cellRtcGetTime_t(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<s64> piTime)
int cellRtcGetWin32FileTime(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<u64> pulWin32FileTime) int cellRtcGetWin32FileTime(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<u64> pulWin32FileTime)
{ {
cellRtc->Log("cellRtcGetWin32FileTime(pDateTime=0x%x, pulWin32FileTime=0x%x)", pDateTime.addr(), pulWin32FileTime.addr()); cellRtc.Log("cellRtcGetWin32FileTime(pDateTime=0x%x, pulWin32FileTime=0x%x)", pDateTime.addr(), pulWin32FileTime.addr());
// Convert to WIN32 FILETIME. // Convert to WIN32 FILETIME.
rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.value(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.value(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000));
@ -347,7 +347,7 @@ int cellRtcGetWin32FileTime(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<u64> pul
int cellRtcSetDosTime(vm::ptr<CellRtcDateTime> pDateTime, u32 uiDosTime) int cellRtcSetDosTime(vm::ptr<CellRtcDateTime> pDateTime, u32 uiDosTime)
{ {
cellRtc->Log("cellRtcSetDosTime(pDateTime=0x%x, uiDosTime=0x%x)", pDateTime.addr(), uiDosTime); cellRtc.Log("cellRtcSetDosTime(pDateTime=0x%x, uiDosTime=0x%x)", pDateTime.addr(), uiDosTime);
rDateTime date_time; rDateTime date_time;
rDateTime dos_time = date_time.SetFromDOS(uiDosTime); rDateTime dos_time = date_time.SetFromDOS(uiDosTime);
@ -365,7 +365,7 @@ int cellRtcSetDosTime(vm::ptr<CellRtcDateTime> pDateTime, u32 uiDosTime)
int cellRtcSetTime_t(vm::ptr<CellRtcDateTime> pDateTime, u64 iTime) int cellRtcSetTime_t(vm::ptr<CellRtcDateTime> pDateTime, u64 iTime)
{ {
cellRtc->Log("cellRtcSetTime_t(pDateTime=0x%x, iTime=0x%llx)", pDateTime.addr(), iTime); cellRtc.Log("cellRtcSetTime_t(pDateTime=0x%x, iTime=0x%llx)", pDateTime.addr(), iTime);
rDateTime date_time = rDateTime((time_t)iTime); rDateTime date_time = rDateTime((time_t)iTime);
@ -382,7 +382,7 @@ int cellRtcSetTime_t(vm::ptr<CellRtcDateTime> pDateTime, u64 iTime)
int cellRtcSetWin32FileTime(vm::ptr<CellRtcDateTime> pDateTime, u64 ulWin32FileTime) int cellRtcSetWin32FileTime(vm::ptr<CellRtcDateTime> pDateTime, u64 ulWin32FileTime)
{ {
cellRtc->Log("cellRtcSetWin32FileTime(pDateTime_addr=0x%x, ulWin32FileTime=0x%llx)", pDateTime.addr(), ulWin32FileTime); cellRtc.Log("cellRtcSetWin32FileTime(pDateTime_addr=0x%x, ulWin32FileTime=0x%llx)", pDateTime.addr(), ulWin32FileTime);
rDateTime date_time = rDateTime((time_t)ulWin32FileTime); rDateTime date_time = rDateTime((time_t)ulWin32FileTime);
@ -399,7 +399,7 @@ int cellRtcSetWin32FileTime(vm::ptr<CellRtcDateTime> pDateTime, u64 ulWin32FileT
int cellRtcIsLeapYear(s32 year) int cellRtcIsLeapYear(s32 year)
{ {
cellRtc->Log("cellRtcIsLeapYear(year=%d)", year); cellRtc.Log("cellRtcIsLeapYear(year=%d)", year);
rDateTime datetime; rDateTime datetime;
return datetime.IsLeapYear(year, rDateTime::Gregorian); return datetime.IsLeapYear(year, rDateTime::Gregorian);
@ -407,7 +407,7 @@ int cellRtcIsLeapYear(s32 year)
int cellRtcGetDaysInMonth(s32 year, s32 month) int cellRtcGetDaysInMonth(s32 year, s32 month)
{ {
cellRtc->Log("cellRtcGetDaysInMonth(year=%d, month=%d)", year, month); cellRtc.Log("cellRtcGetDaysInMonth(year=%d, month=%d)", year, month);
rDateTime datetime; rDateTime datetime;
return datetime.GetNumberOfDays((rDateTime::Month) month, year, rDateTime::Gregorian); return datetime.GetNumberOfDays((rDateTime::Month) month, year, rDateTime::Gregorian);
@ -415,7 +415,7 @@ int cellRtcGetDaysInMonth(s32 year, s32 month)
int cellRtcGetDayOfWeek(s32 year, s32 month, s32 day) int cellRtcGetDayOfWeek(s32 year, s32 month, s32 day)
{ {
cellRtc->Log("cellRtcGetDayOfWeek(year=%d, month=%d, day=%d)", year, month, day); cellRtc.Log("cellRtcGetDayOfWeek(year=%d, month=%d, day=%d)", year, month, day);
rDateTime datetime; rDateTime datetime;
datetime.SetToWeekDay((rDateTime::WeekDay) day, 1, (rDateTime::Month) month, year); datetime.SetToWeekDay((rDateTime::WeekDay) day, 1, (rDateTime::Month) month, year);
@ -424,7 +424,7 @@ int cellRtcGetDayOfWeek(s32 year, s32 month, s32 day)
int cellRtcCheckValid(vm::ptr<CellRtcDateTime> pTime) int cellRtcCheckValid(vm::ptr<CellRtcDateTime> pTime)
{ {
cellRtc->Log("cellRtcCheckValid(pTime=0x%x)", pTime.addr()); cellRtc.Log("cellRtcCheckValid(pTime=0x%x)", pTime.addr());
if ((pTime->year < 1) || (pTime->year > 9999)) return CELL_RTC_ERROR_INVALID_YEAR; if ((pTime->year < 1) || (pTime->year > 9999)) return CELL_RTC_ERROR_INVALID_YEAR;
else if ((pTime->month < 1) || (pTime->month > 12)) return CELL_RTC_ERROR_INVALID_MONTH; else if ((pTime->month < 1) || (pTime->month > 12)) return CELL_RTC_ERROR_INVALID_MONTH;
@ -438,55 +438,53 @@ int cellRtcCheckValid(vm::ptr<CellRtcDateTime> pTime)
int cellRtcCompareTick(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1) int cellRtcCompareTick(vm::ptr<CellRtcTick> pTick0, vm::ptr<CellRtcTick> pTick1)
{ {
cellRtc->Log("cellRtcCompareTick(pTick0=0x%x, pTick1=0x%x)", pTick0.addr(), pTick1.addr()); cellRtc.Log("cellRtcCompareTick(pTick0=0x%x, pTick1=0x%x)", pTick0.addr(), pTick1.addr());
if (pTick0->tick < pTick1->tick) return -1; if (pTick0->tick < pTick1->tick) return -1;
else if (pTick0->tick > pTick1->tick) return 1; else if (pTick0->tick > pTick1->tick) return 1;
else return CELL_OK; else return CELL_OK;
} }
void cellRtc_init(Module *pxThis) Module cellRtc("cellRtc", []()
{ {
cellRtc = pxThis; cellRtc.AddFunc(0x9dafc0d9, cellRtcGetCurrentTick);
cellRtc.AddFunc(0x32c941cf, cellRtcGetCurrentClock);
cellRtc.AddFunc(0x2cce9cf5, cellRtcGetCurrentClockLocalTime);
cellRtc->AddFunc(0x9dafc0d9, cellRtcGetCurrentTick); cellRtc.AddFunc(0x5491b9d5, cellRtcFormatRfc2822);
cellRtc->AddFunc(0x32c941cf, cellRtcGetCurrentClock); cellRtc.AddFunc(0xa07c3d2f, cellRtcFormatRfc2822LocalTime);
cellRtc->AddFunc(0x2cce9cf5, cellRtcGetCurrentClockLocalTime); cellRtc.AddFunc(0xd9c0b463, cellRtcFormatRfc3339);
cellRtc.AddFunc(0x1324948a, cellRtcFormatRfc3339LocalTime);
cellRtc.AddFunc(0xc5bc0fac, cellRtcParseDateTime);
cellRtc.AddFunc(0xcf11c3d6, cellRtcParseRfc3339);
cellRtc->AddFunc(0x5491b9d5, cellRtcFormatRfc2822); cellRtc.AddFunc(0xc7bdb7eb, cellRtcGetTick);
cellRtc->AddFunc(0xa07c3d2f, cellRtcFormatRfc2822LocalTime); cellRtc.AddFunc(0x99b13034, cellRtcSetTick);
cellRtc->AddFunc(0xd9c0b463, cellRtcFormatRfc3339); cellRtc.AddFunc(0x269a1882, cellRtcTickAddTicks);
cellRtc->AddFunc(0x1324948a, cellRtcFormatRfc3339LocalTime); cellRtc.AddFunc(0xf8509925, cellRtcTickAddMicroseconds);
cellRtc->AddFunc(0xc5bc0fac, cellRtcParseDateTime); cellRtc.AddFunc(0xccce71bd, cellRtcTickAddSeconds);
cellRtc->AddFunc(0xcf11c3d6, cellRtcParseRfc3339); cellRtc.AddFunc(0x2f010bfa, cellRtcTickAddMinutes);
cellRtc.AddFunc(0xd41d3bd2, cellRtcTickAddHours);
cellRtc->AddFunc(0xc7bdb7eb, cellRtcGetTick); cellRtc.AddFunc(0x75744e2a, cellRtcTickAddDays);
cellRtc->AddFunc(0x99b13034, cellRtcSetTick); cellRtc.AddFunc(0x64c63fd5, cellRtcTickAddWeeks);
cellRtc->AddFunc(0x269a1882, cellRtcTickAddTicks); cellRtc.AddFunc(0xe0ecbb45, cellRtcTickAddMonths);
cellRtc->AddFunc(0xf8509925, cellRtcTickAddMicroseconds); cellRtc.AddFunc(0x332a74dd, cellRtcTickAddYears);
cellRtc->AddFunc(0xccce71bd, cellRtcTickAddSeconds); cellRtc.AddFunc(0xc48d5002, cellRtcConvertUtcToLocalTime);
cellRtc->AddFunc(0x2f010bfa, cellRtcTickAddMinutes); cellRtc.AddFunc(0x46ca7fe0, cellRtcConvertLocalTimeToUtc);
cellRtc->AddFunc(0xd41d3bd2, cellRtcTickAddHours);
cellRtc->AddFunc(0x75744e2a, cellRtcTickAddDays);
cellRtc->AddFunc(0x64c63fd5, cellRtcTickAddWeeks);
cellRtc->AddFunc(0xe0ecbb45, cellRtcTickAddMonths);
cellRtc->AddFunc(0x332a74dd, cellRtcTickAddYears);
cellRtc->AddFunc(0xc48d5002, cellRtcConvertUtcToLocalTime);
cellRtc->AddFunc(0x46ca7fe0, cellRtcConvertLocalTimeToUtc);
// (TODO: Time Information Manipulation Functions missing) // (TODO: Time Information Manipulation Functions missing)
cellRtc->AddFunc(0xdfff32cf, cellRtcGetDosTime); cellRtc.AddFunc(0xdfff32cf, cellRtcGetDosTime);
cellRtc->AddFunc(0xcb90c761, cellRtcGetTime_t); cellRtc.AddFunc(0xcb90c761, cellRtcGetTime_t);
cellRtc->AddFunc(0xe7086f05, cellRtcGetWin32FileTime); cellRtc.AddFunc(0xe7086f05, cellRtcGetWin32FileTime);
cellRtc->AddFunc(0x9598d4b3, cellRtcSetDosTime); cellRtc.AddFunc(0x9598d4b3, cellRtcSetDosTime);
cellRtc->AddFunc(0xbb543189, cellRtcSetTime_t); cellRtc.AddFunc(0xbb543189, cellRtcSetTime_t);
cellRtc->AddFunc(0x5f68c268, cellRtcSetWin32FileTime); cellRtc.AddFunc(0x5f68c268, cellRtcSetWin32FileTime);
cellRtc->AddFunc(0x5316b4a8, cellRtcIsLeapYear); cellRtc.AddFunc(0x5316b4a8, cellRtcIsLeapYear);
cellRtc->AddFunc(0x5b6a0a1d, cellRtcGetDaysInMonth); cellRtc.AddFunc(0x5b6a0a1d, cellRtcGetDaysInMonth);
cellRtc->AddFunc(0xc2d8cf95, cellRtcGetDayOfWeek); cellRtc.AddFunc(0xc2d8cf95, cellRtcGetDayOfWeek);
cellRtc->AddFunc(0x7f1086e6, cellRtcCheckValid); cellRtc.AddFunc(0x7f1086e6, cellRtcCheckValid);
cellRtc->AddFunc(0xfb51fc61, cellRtcCompareTick); cellRtc.AddFunc(0xfb51fc61, cellRtcCompareTick);
} });

View file

@ -6,11 +6,11 @@
#include "cellSail.h" #include "cellSail.h"
#include "cellPamf.h" #include "cellPamf.h"
Module *cellSail = nullptr; extern Module cellSail;
int cellSailMemAllocatorInitialize(vm::ptr<CellSailMemAllocator> pSelf, vm::ptr<CellSailMemAllocatorFuncs> pCallbacks) int cellSailMemAllocatorInitialize(vm::ptr<CellSailMemAllocator> pSelf, vm::ptr<CellSailMemAllocatorFuncs> pCallbacks)
{ {
cellSail->Warning("cellSailMemAllocatorInitialize(pSelf_addr=0x%x, pCallbacks_addr=0x%x)", pSelf.addr(), pCallbacks.addr()); cellSail.Warning("cellSailMemAllocatorInitialize(pSelf_addr=0x%x, pCallbacks_addr=0x%x)", pSelf.addr(), pCallbacks.addr());
pSelf->callbacks = pCallbacks; pSelf->callbacks = pCallbacks;
// TODO: Create a cellSail thread // TODO: Create a cellSail thread
@ -74,7 +74,7 @@ int cellSailDescriptorGetMediaInfo()
int cellSailDescriptorSetAutoSelection(vm::ptr<CellSailDescriptor> pSelf, bool autoSelection) int cellSailDescriptorSetAutoSelection(vm::ptr<CellSailDescriptor> pSelf, bool autoSelection)
{ {
cellSail->Warning("cellSailDescriptorSetAutoSelection(pSelf_addr=0x%x, autoSelection=%s)", pSelf.addr(), autoSelection ? "true" : "false"); cellSail.Warning("cellSailDescriptorSetAutoSelection(pSelf_addr=0x%x, autoSelection=%s)", pSelf.addr(), autoSelection ? "true" : "false");
if (pSelf) { if (pSelf) {
pSelf->autoSelection = autoSelection; pSelf->autoSelection = autoSelection;
@ -86,7 +86,7 @@ int cellSailDescriptorSetAutoSelection(vm::ptr<CellSailDescriptor> pSelf, bool a
int cellSailDescriptorIsAutoSelection(vm::ptr<CellSailDescriptor> pSelf) int cellSailDescriptorIsAutoSelection(vm::ptr<CellSailDescriptor> pSelf)
{ {
cellSail->Warning("cellSailDescriptorIsAutoSelection(pSelf_addr=0x%x)", pSelf.addr()); cellSail.Warning("cellSailDescriptorIsAutoSelection(pSelf_addr=0x%x)", pSelf.addr());
if (pSelf) if (pSelf)
return pSelf->autoSelection; return pSelf->autoSelection;
@ -96,7 +96,7 @@ int cellSailDescriptorIsAutoSelection(vm::ptr<CellSailDescriptor> pSelf)
int cellSailDescriptorCreateDatabase(vm::ptr<CellSailDescriptor> pSelf, vm::ptr<void> pDatabase, u32 size, u64 arg) int cellSailDescriptorCreateDatabase(vm::ptr<CellSailDescriptor> pSelf, vm::ptr<void> pDatabase, u32 size, u64 arg)
{ {
cellSail->Warning("cellSailDescriptorCreateDatabase(pSelf=0x%x, pDatabase=0x%x, size=0x%x, arg=0x%x", pSelf.addr(), pDatabase.addr(), size, arg); cellSail.Warning("cellSailDescriptorCreateDatabase(pSelf=0x%x, pDatabase=0x%x, size=0x%x, arg=0x%x", pSelf.addr(), pDatabase.addr(), size, arg);
switch ((s32)pSelf->streamType) { switch ((s32)pSelf->streamType) {
case CELL_SAIL_STREAM_PAMF: case CELL_SAIL_STREAM_PAMF:
@ -107,7 +107,7 @@ int cellSailDescriptorCreateDatabase(vm::ptr<CellSailDescriptor> pSelf, vm::ptr<
break; break;
} }
default: default:
cellSail->Error("Unhandled stream type: %d", pSelf->streamType); cellSail.Error("Unhandled stream type: %d", pSelf->streamType);
} }
return CELL_OK; return CELL_OK;
@ -518,7 +518,7 @@ int cellSailPlayerInitialize()
int cellSailPlayerInitialize2(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailMemAllocator> pAllocator, vm::ptr<CellSailPlayerFuncNotified> pCallback, u64 callbackArg, int cellSailPlayerInitialize2(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailMemAllocator> pAllocator, vm::ptr<CellSailPlayerFuncNotified> pCallback, u64 callbackArg,
vm::ptr<CellSailPlayerAttribute> pAttribute, vm::ptr<CellSailPlayerResource> pResource) vm::ptr<CellSailPlayerAttribute> pAttribute, vm::ptr<CellSailPlayerResource> pResource)
{ {
cellSail->Warning("cellSailPlayerInitialize2(pSelf_addr=0x%x, pAllocator_addr=0x%x, pCallback=0x%x, callbackArg=%d, pAttribute_addr=0x%x, pResource=0x%x)", pSelf.addr(), cellSail.Warning("cellSailPlayerInitialize2(pSelf_addr=0x%x, pAllocator_addr=0x%x, pCallback=0x%x, callbackArg=%d, pAttribute_addr=0x%x, pResource=0x%x)", pSelf.addr(),
pAllocator.addr(), pCallback.addr(), callbackArg, pAttribute.addr(), pResource.addr()); pAllocator.addr(), pCallback.addr(), callbackArg, pAttribute.addr(), pResource.addr());
pSelf->allocator = pAllocator; pSelf->allocator = pAllocator;
@ -616,7 +616,7 @@ int cellSailPlayerBoot()
int cellSailPlayerAddDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailDescriptor> pDesc) int cellSailPlayerAddDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailDescriptor> pDesc)
{ {
cellSail->Warning("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), pDesc.addr()); cellSail.Warning("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), pDesc.addr());
if (pSelf && pSelf->descriptors < 3 && pDesc) if (pSelf && pSelf->descriptors < 3 && pDesc)
{ {
@ -626,7 +626,7 @@ int cellSailPlayerAddDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailD
} }
else else
{ {
cellSail->Error("Descriptor limit reached or the descriptor is unspecified! This should never happen, report this to a developer."); cellSail.Error("Descriptor limit reached or the descriptor is unspecified! This should never happen, report this to a developer.");
} }
return CELL_OK; return CELL_OK;
@ -634,7 +634,7 @@ int cellSailPlayerAddDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailD
int cellSailPlayerCreateDescriptor(vm::ptr<CellSailPlayer> pSelf, s32 streamType, vm::ptr<u32> pMediaInfo, vm::ptr<const char> pUri, vm::ptr<u32> ppDesc) int cellSailPlayerCreateDescriptor(vm::ptr<CellSailPlayer> pSelf, s32 streamType, vm::ptr<u32> pMediaInfo, vm::ptr<const char> pUri, vm::ptr<u32> ppDesc)
{ {
cellSail->Warning("cellSailPlayerCreateDescriptor(pSelf_addr=0x%x, streamType=%d, pMediaInfo_addr=0x%x, pUri_addr=0x%x, ppDesc_addr=0x%x)", pSelf.addr(), streamType, cellSail.Warning("cellSailPlayerCreateDescriptor(pSelf_addr=0x%x, streamType=%d, pMediaInfo_addr=0x%x, pUri_addr=0x%x, ppDesc_addr=0x%x)", pSelf.addr(), streamType,
pMediaInfo.addr(), pUri.addr(), ppDesc.addr()); pMediaInfo.addr(), pUri.addr(), ppDesc.addr());
u32 descriptorAddress = Memory.Alloc(sizeof(CellSailDescriptor), 1); u32 descriptorAddress = Memory.Alloc(sizeof(CellSailDescriptor), 1);
@ -668,18 +668,18 @@ int cellSailPlayerCreateDescriptor(vm::ptr<CellSailPlayer> pSelf, s32 streamType
descriptor->internalData[1] = sp_; descriptor->internalData[1] = sp_;
} }
else else
cellSail->Warning("Couldn't open PAMF: %s", uri.c_str()); cellSail.Warning("Couldn't open PAMF: %s", uri.c_str());
} }
else else
cellSail->Warning("Unhandled uri: %s", uri.c_str()); cellSail.Warning("Unhandled uri: %s", uri.c_str());
break; break;
} }
default: default:
cellSail->Error("Unhandled stream type: %d", streamType); cellSail.Error("Unhandled stream type: %d", streamType);
} }
//cellSail->Todo("pSelf_addr=0x%x, pDesc_addr=0x%x", pSelf.addr(), descriptor.addr()); //cellSail.Todo("pSelf_addr=0x%x, pDesc_addr=0x%x", pSelf.addr(), descriptor.addr());
//cellSailPlayerAddDescriptor(pSelf, ppDesc); //cellSailPlayerAddDescriptor(pSelf, ppDesc);
return CELL_OK; return CELL_OK;
@ -687,7 +687,7 @@ int cellSailPlayerCreateDescriptor(vm::ptr<CellSailPlayer> pSelf, s32 streamType
int cellSailPlayerDestroyDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailDescriptor> pDesc) int cellSailPlayerDestroyDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailDescriptor> pDesc)
{ {
cellSail->Todo("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), pDesc.addr()); cellSail.Todo("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), pDesc.addr());
if (pDesc->registered) if (pDesc->registered)
return CELL_SAIL_ERROR_INVALID_STATE; return CELL_SAIL_ERROR_INVALID_STATE;
@ -697,7 +697,7 @@ int cellSailPlayerDestroyDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellS
int cellSailPlayerRemoveDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailDescriptor> ppDesc) int cellSailPlayerRemoveDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailDescriptor> ppDesc)
{ {
cellSail->Warning("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), ppDesc.addr()); cellSail.Warning("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), ppDesc.addr());
if (pSelf->descriptors > 0) if (pSelf->descriptors > 0)
{ {
@ -711,7 +711,7 @@ int cellSailPlayerRemoveDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSa
int cellSailPlayerGetDescriptorCount(vm::ptr<CellSailPlayer> pSelf) int cellSailPlayerGetDescriptorCount(vm::ptr<CellSailPlayer> pSelf)
{ {
cellSail->Warning("cellSailPlayerGetDescriptorCount(pSelf_addr=0x%x)", pSelf.addr()); cellSail.Warning("cellSailPlayerGetDescriptorCount(pSelf_addr=0x%x)", pSelf.addr());
return pSelf->descriptors; return pSelf->descriptors;
} }
@ -813,19 +813,19 @@ int cellSailPlayerCancel()
int cellSailPlayerSetPaused(vm::ptr<CellSailPlayer> pSelf, bool paused) int cellSailPlayerSetPaused(vm::ptr<CellSailPlayer> pSelf, bool paused)
{ {
cellSail->Todo("cellSailPlayerSetPaused(pSelf_addr=0x%x, paused=)", pSelf.addr(), paused); cellSail.Todo("cellSailPlayerSetPaused(pSelf_addr=0x%x, paused=)", pSelf.addr(), paused);
return CELL_OK; return CELL_OK;
} }
int cellSailPlayerIsPaused(vm::ptr<CellSailPlayer> pSelf) int cellSailPlayerIsPaused(vm::ptr<CellSailPlayer> pSelf)
{ {
cellSail->Warning("cellSailPlayerIsPaused(pSelf_addr=0x%x)", pSelf.addr()); cellSail.Warning("cellSailPlayerIsPaused(pSelf_addr=0x%x)", pSelf.addr());
return pSelf->paused; return pSelf->paused;
} }
int cellSailPlayerSetRepeatMode(vm::ptr<CellSailPlayer> pSelf, s32 repeatMode, vm::ptr<CellSailStartCommand> pCommand) int cellSailPlayerSetRepeatMode(vm::ptr<CellSailPlayer> pSelf, s32 repeatMode, vm::ptr<CellSailStartCommand> pCommand)
{ {
cellSail->Warning("cellSailPlayerSetRepeatMode(pSelf_addr=0x%x, repeatMode=%d, pCommand_addr=0x%x)", pSelf.addr(), repeatMode, pCommand.addr()); cellSail.Warning("cellSailPlayerSetRepeatMode(pSelf_addr=0x%x, repeatMode=%d, pCommand_addr=0x%x)", pSelf.addr(), repeatMode, pCommand.addr());
pSelf->repeatMode = repeatMode; pSelf->repeatMode = repeatMode;
pSelf->playbackCommand = pCommand; pSelf->playbackCommand = pCommand;
@ -835,7 +835,7 @@ int cellSailPlayerSetRepeatMode(vm::ptr<CellSailPlayer> pSelf, s32 repeatMode, v
int cellSailPlayerGetRepeatMode(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailStartCommand> pCommand) int cellSailPlayerGetRepeatMode(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailStartCommand> pCommand)
{ {
cellSail->Warning("cellSailPlayerGetRepeatMode(pSelf_addr=0x%x, pCommand_addr=0x%x)", pSelf.addr(), pCommand.addr()); cellSail.Warning("cellSailPlayerGetRepeatMode(pSelf_addr=0x%x, pCommand_addr=0x%x)", pSelf.addr(), pCommand.addr());
pCommand = pSelf->playbackCommand; pCommand = pSelf->playbackCommand;
@ -878,146 +878,143 @@ int cellSailPlayerUnregisterSource()
return CELL_OK; return CELL_OK;
} }
void cellSail_init(Module *pxThis) Module cellSail("cellSail", []()
{ {
cellSail = pxThis; cellSail.AddFunc(0x346ebba3, cellSailMemAllocatorInitialize);
cellSail->AddFunc(0x346ebba3, cellSailMemAllocatorInitialize); cellSail.AddFunc(0x4cc54f8e, cellSailFutureInitialize);
cellSail.AddFunc(0x9553af65, cellSailFutureFinalize);
cellSail.AddFunc(0x0c4cb439, cellSailFutureReset);
cellSail.AddFunc(0xa37fed15, cellSailFutureSet);
cellSail.AddFunc(0x3a2d806c, cellSailFutureGet);
cellSail.AddFunc(0x51ecf361, cellSailFutureIsDone);
cellSail->AddFunc(0x4cc54f8e, cellSailFutureInitialize); cellSail.AddFunc(0xd5f9a15b, cellSailDescriptorGetStreamType);
cellSail->AddFunc(0x9553af65, cellSailFutureFinalize); cellSail.AddFunc(0x4c191088, cellSailDescriptorGetUri);
cellSail->AddFunc(0x0c4cb439, cellSailFutureReset); cellSail.AddFunc(0xbd1635f4, cellSailDescriptorGetMediaInfo);
cellSail->AddFunc(0xa37fed15, cellSailFutureSet); cellSail.AddFunc(0x76b1a425, cellSailDescriptorSetAutoSelection);
cellSail->AddFunc(0x3a2d806c, cellSailFutureGet); cellSail.AddFunc(0x277adf21, cellSailDescriptorIsAutoSelection);
cellSail->AddFunc(0x51ecf361, cellSailFutureIsDone); cellSail.AddFunc(0x0abb318b, cellSailDescriptorCreateDatabase);
cellSail.AddFunc(0x28336e89, cellSailDescriptorDestroyDatabase);
cellSail.AddFunc(0xc044fab1, cellSailDescriptorOpen);
cellSail.AddFunc(0x15fd6a2a, cellSailDescriptorClose);
cellSail.AddFunc(0x0d0c2f0c, cellSailDescriptorSetEs);
cellSail.AddFunc(0xdf5553ef, cellSailDescriptorClearEs);
cellSail.AddFunc(0xac9c3b1f, cellSailDescriptorGetCapabilities);
cellSail.AddFunc(0x92590d52, cellSailDescriptorInquireCapability);
cellSail.AddFunc(0xee94b99b, cellSailDescriptorSetParameter);
cellSail->AddFunc(0xd5f9a15b, cellSailDescriptorGetStreamType); cellSail.AddFunc(0x3d0d3b72, cellSailSoundAdapterInitialize);
cellSail->AddFunc(0x4c191088, cellSailDescriptorGetUri); cellSail.AddFunc(0xd1462438, cellSailSoundAdapterFinalize);
cellSail->AddFunc(0xbd1635f4, cellSailDescriptorGetMediaInfo); cellSail.AddFunc(0x1c9d5e5a, cellSailSoundAdapterSetPreferredFormat);
cellSail->AddFunc(0x76b1a425, cellSailDescriptorSetAutoSelection); cellSail.AddFunc(0x7eb8d6b5, cellSailSoundAdapterGetFrame);
cellSail->AddFunc(0x277adf21, cellSailDescriptorIsAutoSelection); cellSail.AddFunc(0xf25f197d, cellSailSoundAdapterGetFormat);
cellSail->AddFunc(0x0abb318b, cellSailDescriptorCreateDatabase); cellSail.AddFunc(0xeec22809, cellSailSoundAdapterUpdateAvSync);
cellSail->AddFunc(0x28336e89, cellSailDescriptorDestroyDatabase); cellSail.AddFunc(0x4ae979df, cellSailSoundAdapterPtsToTimePosition);
cellSail->AddFunc(0xc044fab1, cellSailDescriptorOpen);
cellSail->AddFunc(0x15fd6a2a, cellSailDescriptorClose);
cellSail->AddFunc(0x0d0c2f0c, cellSailDescriptorSetEs);
cellSail->AddFunc(0xdf5553ef, cellSailDescriptorClearEs);
cellSail->AddFunc(0xac9c3b1f, cellSailDescriptorGetCapabilities);
cellSail->AddFunc(0x92590d52, cellSailDescriptorInquireCapability);
cellSail->AddFunc(0xee94b99b, cellSailDescriptorSetParameter);
cellSail->AddFunc(0x3d0d3b72, cellSailSoundAdapterInitialize); cellSail.AddFunc(0x1c983864, cellSailGraphicsAdapterInitialize);
cellSail->AddFunc(0xd1462438, cellSailSoundAdapterFinalize); cellSail.AddFunc(0x76488bb1, cellSailGraphicsAdapterFinalize);
cellSail->AddFunc(0x1c9d5e5a, cellSailSoundAdapterSetPreferredFormat); cellSail.AddFunc(0x2e3ccb5e, cellSailGraphicsAdapterSetPreferredFormat);
cellSail->AddFunc(0x7eb8d6b5, cellSailSoundAdapterGetFrame); cellSail.AddFunc(0x0247c69e, cellSailGraphicsAdapterGetFrame);
cellSail->AddFunc(0xf25f197d, cellSailSoundAdapterGetFormat); cellSail.AddFunc(0x018281a8, cellSailGraphicsAdapterGetFrame2);
cellSail->AddFunc(0xeec22809, cellSailSoundAdapterUpdateAvSync); cellSail.AddFunc(0xffd58aa4, cellSailGraphicsAdapterGetFormat);
cellSail->AddFunc(0x4ae979df, cellSailSoundAdapterPtsToTimePosition); cellSail.AddFunc(0x44a20e79, cellSailGraphicsAdapterUpdateAvSync);
cellSail.AddFunc(0x1872331b, cellSailGraphicsAdapterPtsToTimePosition);
cellSail->AddFunc(0x1c983864, cellSailGraphicsAdapterInitialize); cellSail.AddFunc(0x3dd9639a, cellSailAuReceiverInitialize);
cellSail->AddFunc(0x76488bb1, cellSailGraphicsAdapterFinalize); cellSail.AddFunc(0xed58e3ec, cellSailAuReceiverFinalize);
cellSail->AddFunc(0x2e3ccb5e, cellSailGraphicsAdapterSetPreferredFormat); cellSail.AddFunc(0x3a1132ed, cellSailAuReceiverGet);
cellSail->AddFunc(0x0247c69e, cellSailGraphicsAdapterGetFrame);
cellSail->AddFunc(0x018281a8, cellSailGraphicsAdapterGetFrame2);
cellSail->AddFunc(0xffd58aa4, cellSailGraphicsAdapterGetFormat);
cellSail->AddFunc(0x44a20e79, cellSailGraphicsAdapterUpdateAvSync);
cellSail->AddFunc(0x1872331b, cellSailGraphicsAdapterPtsToTimePosition);
cellSail->AddFunc(0x3dd9639a, cellSailAuReceiverInitialize); cellSail.AddFunc(0x67b4d01f, cellSailRendererAudioInitialize);
cellSail->AddFunc(0xed58e3ec, cellSailAuReceiverFinalize); cellSail.AddFunc(0x06dd4174, cellSailRendererAudioFinalize);
cellSail->AddFunc(0x3a1132ed, cellSailAuReceiverGet); cellSail.AddFunc(0xb7b4ecee, cellSailRendererAudioNotifyCallCompleted);
cellSail.AddFunc(0xf841a537, cellSailRendererAudioNotifyFrameDone);
cellSail.AddFunc(0x325039b9, cellSailRendererAudioNotifyOutputEos);
cellSail->AddFunc(0x67b4d01f, cellSailRendererAudioInitialize); cellSail.AddFunc(0x8d1ff475, cellSailRendererVideoInitialize);
cellSail->AddFunc(0x06dd4174, cellSailRendererAudioFinalize); cellSail.AddFunc(0x47055fea, cellSailRendererVideoFinalize);
cellSail->AddFunc(0xb7b4ecee, cellSailRendererAudioNotifyCallCompleted); cellSail.AddFunc(0x954f48f8, cellSailRendererVideoNotifyCallCompleted);
cellSail->AddFunc(0xf841a537, cellSailRendererAudioNotifyFrameDone); cellSail.AddFunc(0x5f77e8df, cellSailRendererVideoNotifyFrameDone);
cellSail->AddFunc(0x325039b9, cellSailRendererAudioNotifyOutputEos); cellSail.AddFunc(0xdff1cda2, cellSailRendererVideoNotifyOutputEos);
cellSail->AddFunc(0x8d1ff475, cellSailRendererVideoInitialize); cellSail.AddFunc(0x9d30bdce, cellSailSourceInitialize);
cellSail->AddFunc(0x47055fea, cellSailRendererVideoFinalize); cellSail.AddFunc(0xee724c99, cellSailSourceFinalize);
cellSail->AddFunc(0x954f48f8, cellSailRendererVideoNotifyCallCompleted); cellSail.AddFunc(0x764ec2d2, cellSailSourceNotifyCallCompleted);
cellSail->AddFunc(0x5f77e8df, cellSailRendererVideoNotifyFrameDone); cellSail.AddFunc(0x54c53688, cellSailSourceNotifyInputEos);
cellSail->AddFunc(0xdff1cda2, cellSailRendererVideoNotifyOutputEos); cellSail.AddFunc(0x95ee1695, cellSailSourceNotifyStreamOut);
cellSail.AddFunc(0xf289f0cd, cellSailSourceNotifySessionError);
cellSail.AddFunc(0xf4009a94, cellSailSourceNotifyMediaStateChanged);
//cellSail.AddFunc(, cellSailSourceCheck);
cellSail.AddFunc(0x3df98d41, cellSailSourceNotifyOpenCompleted);
cellSail.AddFunc(0x640c7278, cellSailSourceNotifyStartCompleted);
cellSail.AddFunc(0x7473970a, cellSailSourceNotifyStopCompleted);
cellSail.AddFunc(0x946ecca0, cellSailSourceNotifyReadCompleted);
cellSail.AddFunc(0xbdb2251a, cellSailSourceSetDiagHandler);
cellSail.AddFunc(0xc457b203, cellSailSourceNotifyCloseCompleted);
cellSail->AddFunc(0x9d30bdce, cellSailSourceInitialize); cellSail.AddFunc(0xb980b76e, cellSailMp4MovieGetBrand);
cellSail->AddFunc(0xee724c99, cellSailSourceFinalize); cellSail.AddFunc(0xd4049de0, cellSailMp4MovieIsCompatibleBrand);
cellSail->AddFunc(0x764ec2d2, cellSailSourceNotifyCallCompleted); cellSail.AddFunc(0x5783a454, cellSailMp4MovieGetMovieInfo);
cellSail->AddFunc(0x54c53688, cellSailSourceNotifyInputEos); cellSail.AddFunc(0x5faf802b, cellSailMp4MovieGetTrackByIndex);
cellSail->AddFunc(0x95ee1695, cellSailSourceNotifyStreamOut); cellSail.AddFunc(0x85b07126, cellSailMp4MovieGetTrackById);
cellSail->AddFunc(0xf289f0cd, cellSailSourceNotifySessionError); cellSail.AddFunc(0xc2d90ec9, cellSailMp4MovieGetTrackByTypeAndIndex);
cellSail->AddFunc(0xf4009a94, cellSailSourceNotifyMediaStateChanged); cellSail.AddFunc(0xa48be428, cellSailMp4TrackGetTrackInfo);
//cellSail->AddFunc(, cellSailSourceCheck); cellSail.AddFunc(0x72236ec1, cellSailMp4TrackGetTrackReferenceCount);
cellSail->AddFunc(0x3df98d41, cellSailSourceNotifyOpenCompleted); cellSail.AddFunc(0x5f44f64f, cellSailMp4TrackGetTrackReference);
cellSail->AddFunc(0x640c7278, cellSailSourceNotifyStartCompleted); //cellSail.AddFunc(, cellSailMp4ConvertTimeScale);
cellSail->AddFunc(0x7473970a, cellSailSourceNotifyStopCompleted);
cellSail->AddFunc(0x946ecca0, cellSailSourceNotifyReadCompleted);
cellSail->AddFunc(0xbdb2251a, cellSailSourceSetDiagHandler);
cellSail->AddFunc(0xc457b203, cellSailSourceNotifyCloseCompleted);
cellSail->AddFunc(0xb980b76e, cellSailMp4MovieGetBrand); cellSail.AddFunc(0x6e83f5c0, cellSailAviMovieGetMovieInfo);
cellSail->AddFunc(0xd4049de0, cellSailMp4MovieIsCompatibleBrand); cellSail.AddFunc(0x3e908c56, cellSailAviMovieGetStreamByIndex);
cellSail->AddFunc(0x5783a454, cellSailMp4MovieGetMovieInfo); cellSail.AddFunc(0xddebd2a5, cellSailAviMovieGetStreamByTypeAndIndex);
cellSail->AddFunc(0x5faf802b, cellSailMp4MovieGetTrackByIndex); cellSail.AddFunc(0x10298371, cellSailAviMovieGetHeader);
cellSail->AddFunc(0x85b07126, cellSailMp4MovieGetTrackById); cellSail.AddFunc(0xc09e2f23, cellSailAviStreamGetMediaType);
cellSail->AddFunc(0xc2d90ec9, cellSailMp4MovieGetTrackByTypeAndIndex); cellSail.AddFunc(0xcc3cca60, cellSailAviStreamGetHeader);
cellSail->AddFunc(0xa48be428, cellSailMp4TrackGetTrackInfo);
cellSail->AddFunc(0x72236ec1, cellSailMp4TrackGetTrackReferenceCount);
cellSail->AddFunc(0x5f44f64f, cellSailMp4TrackGetTrackReference);
//cellSail->AddFunc(, cellSailMp4ConvertTimeScale);
cellSail->AddFunc(0x6e83f5c0, cellSailAviMovieGetMovieInfo);
cellSail->AddFunc(0x3e908c56, cellSailAviMovieGetStreamByIndex);
cellSail->AddFunc(0xddebd2a5, cellSailAviMovieGetStreamByTypeAndIndex);
cellSail->AddFunc(0x10298371, cellSailAviMovieGetHeader);
cellSail->AddFunc(0xc09e2f23, cellSailAviStreamGetMediaType);
cellSail->AddFunc(0xcc3cca60, cellSailAviStreamGetHeader);
cellSail->AddFunc(0x17932b26, cellSailPlayerInitialize);
cellSail->AddFunc(0x23654375, cellSailPlayerInitialize2);
cellSail->AddFunc(0x18b4629d, cellSailPlayerFinalize);
cellSail->AddFunc(0xbedccc74, cellSailPlayerRegisterSource);
cellSail->AddFunc(0x186b98d3, cellSailPlayerGetRegisteredProtocols);
cellSail->AddFunc(0x1139a206, cellSailPlayerSetSoundAdapter);
cellSail->AddFunc(0x18bcd21b, cellSailPlayerSetGraphicsAdapter);
cellSail->AddFunc(0xf5747e1f, cellSailPlayerSetAuReceiver);
cellSail->AddFunc(0x92eaf6ca, cellSailPlayerSetRendererAudio);
cellSail->AddFunc(0xecf56150, cellSailPlayerSetRendererVideo);
cellSail->AddFunc(0x5f7c7a6f, cellSailPlayerSetParameter);
cellSail->AddFunc(0x952269c9, cellSailPlayerGetParameter);
cellSail->AddFunc(0x6f0b1002, cellSailPlayerSubscribeEvent);
cellSail->AddFunc(0x69793952, cellSailPlayerUnsubscribeEvent);
cellSail->AddFunc(0x47632810, cellSailPlayerReplaceEventHandler);
cellSail->AddFunc(0xbdf21b0f, cellSailPlayerBoot);
cellSail->AddFunc(0xd7938b8d, cellSailPlayerCreateDescriptor);
cellSail->AddFunc(0xfc839bd4, cellSailPlayerDestroyDescriptor);
cellSail->AddFunc(0x7c8dff3b, cellSailPlayerAddDescriptor);
cellSail->AddFunc(0x9897fbd1, cellSailPlayerRemoveDescriptor);
cellSail->AddFunc(0x752f8585, cellSailPlayerGetDescriptorCount);
cellSail->AddFunc(0x75fca288, cellSailPlayerGetCurrentDescriptor);
cellSail->AddFunc(0x34ecc1b9, cellSailPlayerOpenStream);
cellSail->AddFunc(0x85beffcc, cellSailPlayerCloseStream);
cellSail->AddFunc(0x145f9b11, cellSailPlayerOpenEsAudio);
cellSail->AddFunc(0x477501f6, cellSailPlayerOpenEsVideo);
cellSail->AddFunc(0xa849d0a7, cellSailPlayerOpenEsUser);
cellSail->AddFunc(0x4fa5ad09, cellSailPlayerReopenEsAudio);
cellSail->AddFunc(0xf60a8a69, cellSailPlayerReopenEsVideo);
cellSail->AddFunc(0x7b6fa92e, cellSailPlayerReopenEsUser);
cellSail->AddFunc(0xbf9b8d72, cellSailPlayerCloseEsAudio);
cellSail->AddFunc(0x07924359, cellSailPlayerCloseEsVideo);
cellSail->AddFunc(0xaed9d6cd, cellSailPlayerCloseEsUser);
cellSail->AddFunc(0xe535b0d3, cellSailPlayerStart);
cellSail->AddFunc(0xeba8d4ec, cellSailPlayerStop);
cellSail->AddFunc(0x26563ddc, cellSailPlayerNext);
cellSail->AddFunc(0x950d53c1, cellSailPlayerCancel);
cellSail->AddFunc(0xd1d55a90, cellSailPlayerSetPaused);
cellSail->AddFunc(0xaafa17b8, cellSailPlayerIsPaused);
cellSail->AddFunc(0xfc5baf8a, cellSailPlayerSetRepeatMode);
cellSail->AddFunc(0x38144ecf, cellSailPlayerGetRepeatMode);
cellSail->AddFunc(0x91d287f6, cellSailPlayerSetEsAudioMuted);
cellSail->AddFunc(0xf1446a40, cellSailPlayerSetEsVideoMuted);
cellSail->AddFunc(0x09de25fd, cellSailPlayerIsEsAudioMuted);
cellSail->AddFunc(0xdbe32ed4, cellSailPlayerIsEsVideoMuted);
cellSail->AddFunc(0xcc987ba6, cellSailPlayerDumpImage);
cellSail->AddFunc(0x025b4974, cellSailPlayerUnregisterSource);
}
cellSail.AddFunc(0x17932b26, cellSailPlayerInitialize);
cellSail.AddFunc(0x23654375, cellSailPlayerInitialize2);
cellSail.AddFunc(0x18b4629d, cellSailPlayerFinalize);
cellSail.AddFunc(0xbedccc74, cellSailPlayerRegisterSource);
cellSail.AddFunc(0x186b98d3, cellSailPlayerGetRegisteredProtocols);
cellSail.AddFunc(0x1139a206, cellSailPlayerSetSoundAdapter);
cellSail.AddFunc(0x18bcd21b, cellSailPlayerSetGraphicsAdapter);
cellSail.AddFunc(0xf5747e1f, cellSailPlayerSetAuReceiver);
cellSail.AddFunc(0x92eaf6ca, cellSailPlayerSetRendererAudio);
cellSail.AddFunc(0xecf56150, cellSailPlayerSetRendererVideo);
cellSail.AddFunc(0x5f7c7a6f, cellSailPlayerSetParameter);
cellSail.AddFunc(0x952269c9, cellSailPlayerGetParameter);
cellSail.AddFunc(0x6f0b1002, cellSailPlayerSubscribeEvent);
cellSail.AddFunc(0x69793952, cellSailPlayerUnsubscribeEvent);
cellSail.AddFunc(0x47632810, cellSailPlayerReplaceEventHandler);
cellSail.AddFunc(0xbdf21b0f, cellSailPlayerBoot);
cellSail.AddFunc(0xd7938b8d, cellSailPlayerCreateDescriptor);
cellSail.AddFunc(0xfc839bd4, cellSailPlayerDestroyDescriptor);
cellSail.AddFunc(0x7c8dff3b, cellSailPlayerAddDescriptor);
cellSail.AddFunc(0x9897fbd1, cellSailPlayerRemoveDescriptor);
cellSail.AddFunc(0x752f8585, cellSailPlayerGetDescriptorCount);
cellSail.AddFunc(0x75fca288, cellSailPlayerGetCurrentDescriptor);
cellSail.AddFunc(0x34ecc1b9, cellSailPlayerOpenStream);
cellSail.AddFunc(0x85beffcc, cellSailPlayerCloseStream);
cellSail.AddFunc(0x145f9b11, cellSailPlayerOpenEsAudio);
cellSail.AddFunc(0x477501f6, cellSailPlayerOpenEsVideo);
cellSail.AddFunc(0xa849d0a7, cellSailPlayerOpenEsUser);
cellSail.AddFunc(0x4fa5ad09, cellSailPlayerReopenEsAudio);
cellSail.AddFunc(0xf60a8a69, cellSailPlayerReopenEsVideo);
cellSail.AddFunc(0x7b6fa92e, cellSailPlayerReopenEsUser);
cellSail.AddFunc(0xbf9b8d72, cellSailPlayerCloseEsAudio);
cellSail.AddFunc(0x07924359, cellSailPlayerCloseEsVideo);
cellSail.AddFunc(0xaed9d6cd, cellSailPlayerCloseEsUser);
cellSail.AddFunc(0xe535b0d3, cellSailPlayerStart);
cellSail.AddFunc(0xeba8d4ec, cellSailPlayerStop);
cellSail.AddFunc(0x26563ddc, cellSailPlayerNext);
cellSail.AddFunc(0x950d53c1, cellSailPlayerCancel);
cellSail.AddFunc(0xd1d55a90, cellSailPlayerSetPaused);
cellSail.AddFunc(0xaafa17b8, cellSailPlayerIsPaused);
cellSail.AddFunc(0xfc5baf8a, cellSailPlayerSetRepeatMode);
cellSail.AddFunc(0x38144ecf, cellSailPlayerGetRepeatMode);
cellSail.AddFunc(0x91d287f6, cellSailPlayerSetEsAudioMuted);
cellSail.AddFunc(0xf1446a40, cellSailPlayerSetEsVideoMuted);
cellSail.AddFunc(0x09de25fd, cellSailPlayerIsEsAudioMuted);
cellSail.AddFunc(0xdbe32ed4, cellSailPlayerIsEsVideoMuted);
cellSail.AddFunc(0xcc987ba6, cellSailPlayerDumpImage);
cellSail.AddFunc(0x025b4974, cellSailPlayerUnregisterSource);
});

View file

@ -18,7 +18,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
extern Module *cellSysutil; extern Module cellSysutil;
// Auxiliary Classes // Auxiliary Classes
class sortSaveDataEntry class sortSaveDataEntry
@ -80,7 +80,7 @@ void addSaveDataEntry(std::vector<SaveDataEntry>& saveEntries, const std::string
u64 mtime = 0; u64 mtime = 0;
u64 ctime = 0; u64 ctime = 0;
cellSysutil->Error("Running _stat in cellSaveData. Please report this to a RPCS3 developer!"); cellSysutil.Error("Running _stat in cellSaveData. Please report this to a RPCS3 developer!");
std::string real_path; std::string real_path;
struct stat buf; struct stat buf;
@ -88,7 +88,7 @@ void addSaveDataEntry(std::vector<SaveDataEntry>& saveEntries, const std::string
Emu.GetVFS().GetDevice(f.GetPath(), real_path); Emu.GetVFS().GetDevice(f.GetPath(), real_path);
if (stat(real_path.c_str(), &buf) != 0) if (stat(real_path.c_str(), &buf) != 0)
cellSysutil->Error("stat failed! (%s)", real_path.c_str()); cellSysutil.Error("stat failed! (%s)", real_path.c_str());
else else
{ {
atime = buf.st_atime; atime = buf.st_atime;
@ -262,7 +262,7 @@ s32 modifySaveDataFiles(vm::ptr<CellSaveDataFileCallback> funcFile, vm::ptr<Cell
{ {
funcFile(result, fileGet, fileSet); funcFile(result, fileGet, fileSet);
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("modifySaveDataFiles: CellSaveDataFileCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil.Error("modifySaveDataFiles: CellSaveDataFileCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
if (result->result == CELL_SAVEDATA_CBRESULT_OK_LAST || result->result == CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM) { if (result->result == CELL_SAVEDATA_CBRESULT_OK_LAST || result->result == CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM) {
@ -283,7 +283,7 @@ s32 modifySaveDataFiles(vm::ptr<CellSaveDataFileCallback> funcFile, vm::ptr<Cell
case CELL_SAVEDATA_FILETYPE_CONTENT_SND0: filepath += "SND0.AT3"; break; case CELL_SAVEDATA_FILETYPE_CONTENT_SND0: filepath += "SND0.AT3"; break;
default: default:
cellSysutil->Error("modifySaveDataFiles: Unknown fileType! Aborting..."); cellSysutil.Error("modifySaveDataFiles: Unknown fileType! Aborting...");
return CELL_SAVEDATA_ERROR_PARAM; return CELL_SAVEDATA_ERROR_PARAM;
} }
@ -306,11 +306,11 @@ s32 modifySaveDataFiles(vm::ptr<CellSaveDataFileCallback> funcFile, vm::ptr<Cell
break; break;
case CELL_SAVEDATA_FILEOP_WRITE_NOTRUNC: case CELL_SAVEDATA_FILEOP_WRITE_NOTRUNC:
cellSysutil->Todo("modifySaveDataFiles: CELL_SAVEDATA_FILEOP_WRITE_NOTRUNC"); cellSysutil.Todo("modifySaveDataFiles: CELL_SAVEDATA_FILEOP_WRITE_NOTRUNC");
break; break;
default: default:
cellSysutil->Error("modifySaveDataFiles: Unknown fileOperation! Aborting..."); cellSysutil.Error("modifySaveDataFiles: Unknown fileOperation! Aborting...");
return CELL_SAVEDATA_ERROR_PARAM; return CELL_SAVEDATA_ERROR_PARAM;
} }
@ -332,7 +332,7 @@ s32 cellSaveDataListSave2(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Warning("cellSaveDataListSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Warning("cellSaveDataListSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, setList.addr(), setBuf.addr(), funcList.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, setList.addr(), setBuf.addr(), funcList.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
vm::var<CellSaveDataCBResult> result; vm::var<CellSaveDataCBResult> result;
@ -378,7 +378,7 @@ s32 cellSaveDataListSave2(
funcList(result, listGet, listSet); funcList(result, listGet, listSet);
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataListSave2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil.Error("cellSaveDataListSave2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
@ -386,7 +386,7 @@ s32 cellSaveDataListSave2(
if (listSet->newData) if (listSet->newData)
addNewSaveDataEntry(saveEntries, listSet->newData.to_le()); addNewSaveDataEntry(saveEntries, listSet->newData.to_le());
if (saveEntries.size() == 0) { if (saveEntries.size() == 0) {
cellSysutil->Error("cellSaveDataListSave2: No save entries found!"); // TODO: Find a better way to handle this error cellSysutil.Error("cellSaveDataListSave2: No save entries found!"); // TODO: Find a better way to handle this error
return CELL_OK; return CELL_OK;
} }
@ -399,7 +399,7 @@ s32 cellSaveDataListSave2(
funcStat(result, statGet, statSet); funcStat(result, statGet, statSet);
Memory.Free(statGet->fileList.addr()); Memory.Free(statGet->fileList.addr());
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil.Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
@ -423,7 +423,7 @@ s32 cellSaveDataListLoad2(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Warning("cellSaveDataListLoad2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Warning("cellSaveDataListLoad2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, setList.addr(), setBuf.addr(), funcList.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, setList.addr(), setBuf.addr(), funcList.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
vm::var<CellSaveDataCBResult> result; vm::var<CellSaveDataCBResult> result;
@ -470,7 +470,7 @@ s32 cellSaveDataListLoad2(
funcList(result, listGet, listSet); funcList(result, listGet, listSet);
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataListLoad2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil.Error("cellSaveDataListLoad2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
@ -478,7 +478,7 @@ s32 cellSaveDataListLoad2(
if (listSet->newData) if (listSet->newData)
addNewSaveDataEntry(saveEntries, listSet->newData.to_le()); addNewSaveDataEntry(saveEntries, listSet->newData.to_le());
if (saveEntries.size() == 0) { if (saveEntries.size() == 0) {
cellSysutil->Error("cellSaveDataListLoad2: No save entries found!"); // TODO: Find a better way to handle this error cellSysutil.Error("cellSaveDataListLoad2: No save entries found!"); // TODO: Find a better way to handle this error
return CELL_OK; return CELL_OK;
} }
@ -491,7 +491,7 @@ s32 cellSaveDataListLoad2(
funcStat(result, statGet, statSet); funcStat(result, statGet, statSet);
Memory.Free(statGet->fileList.addr()); Memory.Free(statGet->fileList.addr());
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil.Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
@ -515,7 +515,7 @@ s32 cellSaveDataFixedSave2(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Warning("cellSaveDataFixedSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Warning("cellSaveDataFixedSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
vm::var<CellSaveDataCBResult> result; vm::var<CellSaveDataCBResult> result;
@ -557,7 +557,7 @@ s32 cellSaveDataFixedSave2(
} }
funcFixed(result, listGet, fixedSet); funcFixed(result, listGet, fixedSet);
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataFixedSave2: CellSaveDataFixedCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil.Error("cellSaveDataFixedSave2: CellSaveDataFixedCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
setSaveDataFixed(saveEntries, fixedSet); setSaveDataFixed(saveEntries, fixedSet);
@ -568,7 +568,7 @@ s32 cellSaveDataFixedSave2(
funcStat(result, statGet, statSet); funcStat(result, statGet, statSet);
Memory.Free(statGet->fileList.addr()); Memory.Free(statGet->fileList.addr());
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataFixedSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil.Error("cellSaveDataFixedSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
/*if (statSet->setParam) /*if (statSet->setParam)
@ -591,7 +591,7 @@ s32 cellSaveDataFixedLoad2(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Warning("cellSaveDataFixedLoad2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Warning("cellSaveDataFixedLoad2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
vm::var<CellSaveDataCBResult> result; vm::var<CellSaveDataCBResult> result;
@ -633,7 +633,7 @@ s32 cellSaveDataFixedLoad2(
} }
funcFixed(result, listGet, fixedSet); funcFixed(result, listGet, fixedSet);
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataFixedLoad2: CellSaveDataFixedCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil.Error("cellSaveDataFixedLoad2: CellSaveDataFixedCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
setSaveDataFixed(saveEntries, fixedSet); setSaveDataFixed(saveEntries, fixedSet);
@ -644,7 +644,7 @@ s32 cellSaveDataFixedLoad2(
funcStat(result, statGet, statSet); funcStat(result, statGet, statSet);
Memory.Free(statGet->fileList.addr()); Memory.Free(statGet->fileList.addr());
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataFixedLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil.Error("cellSaveDataFixedLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
/*if (statSet->setParam) /*if (statSet->setParam)
@ -667,7 +667,7 @@ s32 cellSaveDataAutoSave2(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Warning("cellSaveDataAutoSave2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Warning("cellSaveDataAutoSave2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, dirName.addr(), errDialog, setBuf.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, dirName.addr(), errDialog, setBuf.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
vm::var<CellSaveDataCBResult> result; vm::var<CellSaveDataCBResult> result;
@ -705,7 +705,7 @@ s32 cellSaveDataAutoSave2(
Memory.Free(statGet->fileList.addr()); Memory.Free(statGet->fileList.addr());
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataAutoSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil.Error("cellSaveDataAutoSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
/*if (statSet->setParam) /*if (statSet->setParam)
@ -728,7 +728,7 @@ s32 cellSaveDataAutoLoad2(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Warning("cellSaveDataAutoLoad2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Warning("cellSaveDataAutoLoad2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, dirName.addr(), errDialog, setBuf.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, dirName.addr(), errDialog, setBuf.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
vm::var<CellSaveDataCBResult> result; vm::var<CellSaveDataCBResult> result;
@ -751,7 +751,7 @@ s32 cellSaveDataAutoLoad2(
// The target entry does not exist // The target entry does not exist
if (saveEntries.size() == 0) { if (saveEntries.size() == 0) {
cellSysutil->Error("cellSaveDataAutoLoad2: Couldn't find save entry (%s)", dirN.c_str()); cellSysutil.Error("cellSaveDataAutoLoad2: Couldn't find save entry (%s)", dirN.c_str());
return CELL_OK; // TODO: Can anyone check the actual behaviour of a PS3 when saves are not found? return CELL_OK; // TODO: Can anyone check the actual behaviour of a PS3 when saves are not found?
} }
@ -761,7 +761,7 @@ s32 cellSaveDataAutoLoad2(
Memory.Free(statGet->fileList.addr()); Memory.Free(statGet->fileList.addr());
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataAutoLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil.Error("cellSaveDataAutoLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
/*if (statSet->setParam) /*if (statSet->setParam)
@ -785,7 +785,7 @@ s32 cellSaveDataListAutoSave(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Todo("cellSaveDataListAutoSave(version=%d, errDialog=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Todo("cellSaveDataListAutoSave(version=%d, errDialog=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, errDialog, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, errDialog, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
//vm::var<CellSaveDataCBResult> result; //vm::var<CellSaveDataCBResult> result;
@ -832,7 +832,7 @@ s32 cellSaveDataListAutoSave(
//funcFixed(result, listGet, fixedSet); //funcFixed(result, listGet, fixedSet);
//if (result->result < 0) { //if (result->result < 0) {
// cellSysutil->Error("cellSaveDataListAutoSave: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. // cellSysutil.Error("cellSaveDataListAutoSave: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
// return CELL_SAVEDATA_ERROR_CBRESULT; // return CELL_SAVEDATA_ERROR_CBRESULT;
//} //}
@ -844,7 +844,7 @@ s32 cellSaveDataListAutoSave(
//funcStat(result, statGet, statSet); //funcStat(result, statGet, statSet);
//Memory.Free(statGet->fileList.addr()); //Memory.Free(statGet->fileList.addr());
//if (result->result < 0) { //if (result->result < 0) {
// cellSysutil->Error("cellSaveDataListAutoSave: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. // cellSysutil.Error("cellSaveDataListAutoSave: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
// return CELL_SAVEDATA_ERROR_CBRESULT; // return CELL_SAVEDATA_ERROR_CBRESULT;
//} //}
@ -868,7 +868,7 @@ s32 cellSaveDataListAutoLoad(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Todo("cellSaveDataListAutoLoad(version=%d, errDialog=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Todo("cellSaveDataListAutoLoad(version=%d, errDialog=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, errDialog, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, errDialog, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
//vm::var<CellSaveDataCBResult> result; //vm::var<CellSaveDataCBResult> result;
@ -915,7 +915,7 @@ s32 cellSaveDataListAutoLoad(
//funcFixed(result, listGet, fixedSet); //funcFixed(result, listGet, fixedSet);
//if (result->result < 0) { //if (result->result < 0) {
// cellSysutil->Error("cellSaveDataListAutoLoad: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. // cellSysutil.Error("cellSaveDataListAutoLoad: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
// return CELL_SAVEDATA_ERROR_CBRESULT; // return CELL_SAVEDATA_ERROR_CBRESULT;
//} //}
@ -927,7 +927,7 @@ s32 cellSaveDataListAutoLoad(
//funcStat(result, statGet, statSet); //funcStat(result, statGet, statSet);
//Memory.Free(statGet->fileList.addr()); //Memory.Free(statGet->fileList.addr());
//if (result->result < 0) { //if (result->result < 0) {
// cellSysutil->Error("cellSaveDataFixedLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. // cellSysutil.Error("cellSaveDataFixedLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
// return CELL_SAVEDATA_ERROR_CBRESULT; // return CELL_SAVEDATA_ERROR_CBRESULT;
//} //}
///*if (statSet->setParam) ///*if (statSet->setParam)
@ -941,7 +941,7 @@ s32 cellSaveDataListAutoLoad(
s32 cellSaveDataDelete2(u32 container) s32 cellSaveDataDelete2(u32 container)
{ {
cellSysutil->Todo("cellSaveDataDelete2(container=%d)", container); cellSysutil.Todo("cellSaveDataDelete2(container=%d)", container);
return CELL_SAVEDATA_RET_CANCEL; return CELL_SAVEDATA_RET_CANCEL;
} }
@ -954,7 +954,7 @@ s32 cellSaveDataFixedDelete(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Todo("cellSaveDataFixedDelete(setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcDone_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Todo("cellSaveDataFixedDelete(setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcDone_addr=0x%x, container=%d, userdata_addr=0x%x)",
setList.addr(), setBuf.addr(), funcFixed.addr(), funcDone.addr(), container, userdata.addr()); setList.addr(), setBuf.addr(), funcFixed.addr(), funcDone.addr(), container, userdata.addr());
return CELL_OK; return CELL_OK;
@ -971,7 +971,7 @@ s32 cellSaveDataUserListSave(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Todo("cellSaveDataUserListSave(version=%d, userId=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Todo("cellSaveDataUserListSave(version=%d, userId=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, userId, setList.addr(), setBuf.addr(), funcList.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, userId, setList.addr(), setBuf.addr(), funcList.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
return CELL_OK; return CELL_OK;
@ -988,7 +988,7 @@ s32 cellSaveDataUserListLoad(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Todo("cellSaveDataUserListLoad(version=%d, userId=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Todo("cellSaveDataUserListLoad(version=%d, userId=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, userId, setList.addr(), setBuf.addr(), funcList.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, userId, setList.addr(), setBuf.addr(), funcList.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
return CELL_OK; return CELL_OK;
@ -1005,7 +1005,7 @@ s32 cellSaveDataUserFixedSave(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Todo("cellSaveDataUserFixedSave(version=%d, userId=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Todo("cellSaveDataUserFixedSave(version=%d, userId=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, userId, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, userId, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
return CELL_OK; return CELL_OK;
@ -1022,7 +1022,7 @@ s32 cellSaveDataUserFixedLoad(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Todo("cellSaveDataUserFixedLoad(version=%d, userId=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Todo("cellSaveDataUserFixedLoad(version=%d, userId=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, userId, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, userId, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
return CELL_OK; return CELL_OK;
@ -1039,7 +1039,7 @@ s32 cellSaveDataUserAutoSave(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Todo("cellSaveDataUserAutoSave(version=%d, userId=%d, dirName_addr=0x%x, errDialog=%d, setBuf_addr=0x%x, funcStat_addr=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Todo("cellSaveDataUserAutoSave(version=%d, userId=%d, dirName_addr=0x%x, errDialog=%d, setBuf_addr=0x%x, funcStat_addr=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)",
version, userId, dirName.addr(), errDialog, setBuf.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, userId, dirName.addr(), errDialog, setBuf.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
return CELL_OK; return CELL_OK;
@ -1056,7 +1056,7 @@ s32 cellSaveDataUserAutoLoad(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Todo("cellSaveDataUserAutoLoad(version=%d, userId=%d, dirName_addr=0x%x, errDialog=%d, setBuf_addr=0x%x, funcStat_addr=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Todo("cellSaveDataUserAutoLoad(version=%d, userId=%d, dirName_addr=0x%x, errDialog=%d, setBuf_addr=0x%x, funcStat_addr=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)",
version, userId, dirName.addr(), errDialog, setBuf.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, userId, dirName.addr(), errDialog, setBuf.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
return CELL_OK; return CELL_OK;
@ -1074,7 +1074,7 @@ s32 cellSaveDataUserListAutoSave(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Todo("cellSaveDataUserListAutoSave(version=%d, userId=%d, errDialog=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Todo("cellSaveDataUserListAutoSave(version=%d, userId=%d, errDialog=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, userId, errDialog, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, userId, errDialog, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
return CELL_OK; return CELL_OK;
@ -1092,7 +1092,7 @@ s32 cellSaveDataUserListAutoLoad(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Todo("cellSaveDataUserListAutoLoad(version=%d, userId=%d, errDialog=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Todo("cellSaveDataUserListAutoLoad(version=%d, userId=%d, errDialog=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
version, userId, errDialog, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr()); version, userId, errDialog, setList.addr(), setBuf.addr(), funcFixed.addr(), funcStat.addr(), funcFile.addr(), container, userdata.addr());
return CELL_OK; return CELL_OK;
@ -1107,7 +1107,7 @@ s32 cellSaveDataUserFixedDelete(
u32 container, u32 container,
vm::ptr<void> userdata) vm::ptr<void> userdata)
{ {
cellSysutil->Todo("cellSaveDataUserFixedDelete(userId=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcDone_addr=0x%x, container=%d, userdata_addr=0x%x)", cellSysutil.Todo("cellSaveDataUserFixedDelete(userId=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcDone_addr=0x%x, container=%d, userdata_addr=0x%x)",
userId, setList.addr(), setBuf.addr(), funcFixed.addr(), funcDone.addr(), container, userdata.addr()); userId, setList.addr(), setBuf.addr(), funcFixed.addr(), funcDone.addr(), container, userdata.addr());
return CELL_OK; return CELL_OK;
@ -1115,7 +1115,7 @@ s32 cellSaveDataUserFixedDelete(
void cellSaveDataEnableOverlay(s32 enable) void cellSaveDataEnableOverlay(s32 enable)
{ {
cellSysutil->Todo("cellSaveDataEnableOverlay(enable=%d)", enable); cellSysutil.Todo("cellSaveDataEnableOverlay(enable=%d)", enable);
return; return;
} }

File diff suppressed because it is too large Load diff

View file

@ -11,7 +11,7 @@
#include "cellSpurs.h" #include "cellSpurs.h"
#include "cellSpursJq.h" #include "cellSpursJq.h"
Module* cellSpursJq = nullptr; extern Module cellSpursJq;
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
#include "prx_libspurs_jq.h" #include "prx_libspurs_jq.h"
@ -22,7 +22,7 @@ u32 libspurs_jq_rtoc;
s64 cellSpursJobQueueAttributeInitialize() s64 cellSpursJobQueueAttributeInitialize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000010, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000010, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -33,7 +33,7 @@ s64 cellSpursJobQueueAttributeInitialize()
s64 cellSpursJobQueueAttributeSetMaxGrab() s64 cellSpursJobQueueAttributeSetMaxGrab()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000058, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000058, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -44,7 +44,7 @@ s64 cellSpursJobQueueAttributeSetMaxGrab()
s64 cellSpursJobQueueAttributeSetSubmitWithEntryLock() s64 cellSpursJobQueueAttributeSetSubmitWithEntryLock()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000098, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000098, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -55,7 +55,7 @@ s64 cellSpursJobQueueAttributeSetSubmitWithEntryLock()
s64 cellSpursJobQueueAttributeSetDoBusyWaiting() s64 cellSpursJobQueueAttributeSetDoBusyWaiting()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0000BC, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0000BC, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -66,7 +66,7 @@ s64 cellSpursJobQueueAttributeSetDoBusyWaiting()
s64 cellSpursJobQueueAttributeSetIsHaltOnError() s64 cellSpursJobQueueAttributeSetIsHaltOnError()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0000E0, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0000E0, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -77,7 +77,7 @@ s64 cellSpursJobQueueAttributeSetIsHaltOnError()
s64 cellSpursJobQueueAttributeSetIsJobTypeMemoryCheck() s64 cellSpursJobQueueAttributeSetIsJobTypeMemoryCheck()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000104, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000104, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -88,7 +88,7 @@ s64 cellSpursJobQueueAttributeSetIsJobTypeMemoryCheck()
s64 cellSpursJobQueueAttributeSetMaxSizeJobDescriptor() s64 cellSpursJobQueueAttributeSetMaxSizeJobDescriptor()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000128, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000128, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -99,7 +99,7 @@ s64 cellSpursJobQueueAttributeSetMaxSizeJobDescriptor()
s64 cellSpursJobQueueAttributeSetGrabParameters() s64 cellSpursJobQueueAttributeSetGrabParameters()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000178, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000178, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -110,7 +110,7 @@ s64 cellSpursJobQueueAttributeSetGrabParameters()
s64 cellSpursJobQueueSetWaitingMode() s64 cellSpursJobQueueSetWaitingMode()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0001C8, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0001C8, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -121,7 +121,7 @@ s64 cellSpursJobQueueSetWaitingMode()
s64 cellSpursShutdownJobQueue() s64 cellSpursShutdownJobQueue()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0002F0, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0002F0, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -132,7 +132,7 @@ s64 cellSpursShutdownJobQueue()
s64 _cellSpursCreateJobQueueWithJobDescriptorPool() s64 _cellSpursCreateJobQueueWithJobDescriptorPool()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0003CC, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0003CC, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -143,7 +143,7 @@ s64 _cellSpursCreateJobQueueWithJobDescriptorPool()
s64 _cellSpursCreateJobQueue() s64 _cellSpursCreateJobQueue()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000CA8, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000CA8, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -154,7 +154,7 @@ s64 _cellSpursCreateJobQueue()
s64 cellSpursJoinJobQueue() s64 cellSpursJoinJobQueue()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000CF0, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000CF0, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -165,7 +165,7 @@ s64 cellSpursJoinJobQueue()
s64 _cellSpursJobQueuePushJobListBody() s64 _cellSpursJobQueuePushJobListBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001B24, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001B24, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -176,7 +176,7 @@ s64 _cellSpursJobQueuePushJobListBody()
s64 _cellSpursJobQueuePushJobBody2() s64 _cellSpursJobQueuePushJobBody2()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001BF0, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001BF0, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -187,7 +187,7 @@ s64 _cellSpursJobQueuePushJobBody2()
s64 _cellSpursJobQueuePushJob2Body() s64 _cellSpursJobQueuePushJob2Body()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001CD0, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001CD0, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -198,7 +198,7 @@ s64 _cellSpursJobQueuePushJob2Body()
s64 _cellSpursJobQueuePushAndReleaseJobBody() s64 _cellSpursJobQueuePushAndReleaseJobBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001DC8, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001DC8, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -209,7 +209,7 @@ s64 _cellSpursJobQueuePushAndReleaseJobBody()
s64 _cellSpursJobQueuePushJobBody() s64 _cellSpursJobQueuePushJobBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001EC8, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001EC8, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -220,7 +220,7 @@ s64 _cellSpursJobQueuePushJobBody()
s64 _cellSpursJobQueuePushBody() s64 _cellSpursJobQueuePushBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001F90, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001F90, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -231,7 +231,7 @@ s64 _cellSpursJobQueuePushBody()
s64 _cellSpursJobQueueAllocateJobDescriptorBody() s64 _cellSpursJobQueueAllocateJobDescriptorBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002434, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002434, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -242,7 +242,7 @@ s64 _cellSpursJobQueueAllocateJobDescriptorBody()
s64 _cellSpursJobQueuePushSync() s64 _cellSpursJobQueuePushSync()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002498, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002498, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -253,7 +253,7 @@ s64 _cellSpursJobQueuePushSync()
s64 _cellSpursJobQueuePushFlush() s64 _cellSpursJobQueuePushFlush()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002528, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002528, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -264,7 +264,7 @@ s64 _cellSpursJobQueuePushFlush()
s64 cellSpursJobQueueGetSpurs() s64 cellSpursJobQueueGetSpurs()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002598, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002598, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -275,7 +275,7 @@ s64 cellSpursJobQueueGetSpurs()
s64 cellSpursJobQueueGetHandleCount() s64 cellSpursJobQueueGetHandleCount()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0025C4, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0025C4, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -286,7 +286,7 @@ s64 cellSpursJobQueueGetHandleCount()
s64 cellSpursJobQueueGetError() s64 cellSpursJobQueueGetError()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002600, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002600, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -297,7 +297,7 @@ s64 cellSpursJobQueueGetError()
s64 cellSpursJobQueueGetMaxSizeJobDescriptor() s64 cellSpursJobQueueGetMaxSizeJobDescriptor()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002668, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002668, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -308,7 +308,7 @@ s64 cellSpursJobQueueGetMaxSizeJobDescriptor()
s64 cellSpursGetJobQueueId() s64 cellSpursGetJobQueueId()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0026A4, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0026A4, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -319,7 +319,7 @@ s64 cellSpursGetJobQueueId()
s64 cellSpursJobQueueGetSuspendedJobSize() s64 cellSpursJobQueueGetSuspendedJobSize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002700, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002700, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -330,7 +330,7 @@ s64 cellSpursJobQueueGetSuspendedJobSize()
s64 cellSpursJobQueueClose() s64 cellSpursJobQueueClose()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002D70, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002D70, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -341,7 +341,7 @@ s64 cellSpursJobQueueClose()
s64 cellSpursJobQueueOpen() s64 cellSpursJobQueueOpen()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002E50, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002E50, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -352,7 +352,7 @@ s64 cellSpursJobQueueOpen()
s64 cellSpursJobQueueSemaphoreTryAcquire() s64 cellSpursJobQueueSemaphoreTryAcquire()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003370, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003370, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -363,7 +363,7 @@ s64 cellSpursJobQueueSemaphoreTryAcquire()
s64 cellSpursJobQueueSemaphoreAcquire() s64 cellSpursJobQueueSemaphoreAcquire()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003378, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003378, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -374,7 +374,7 @@ s64 cellSpursJobQueueSemaphoreAcquire()
s64 cellSpursJobQueueSemaphoreInitialize() s64 cellSpursJobQueueSemaphoreInitialize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003380, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003380, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -385,7 +385,7 @@ s64 cellSpursJobQueueSemaphoreInitialize()
s64 cellSpursJobQueueSendSignal() s64 cellSpursJobQueueSendSignal()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0033E0, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0033E0, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -396,7 +396,7 @@ s64 cellSpursJobQueueSendSignal()
s64 cellSpursJobQueuePortGetJobQueue() s64 cellSpursJobQueuePortGetJobQueue()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x00354C, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x00354C, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -407,7 +407,7 @@ s64 cellSpursJobQueuePortGetJobQueue()
s64 _cellSpursJobQueuePortPushSync() s64 _cellSpursJobQueuePortPushSync()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003554, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003554, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -418,7 +418,7 @@ s64 _cellSpursJobQueuePortPushSync()
s64 _cellSpursJobQueuePortPushFlush() s64 _cellSpursJobQueuePortPushFlush()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0035C0, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0035C0, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -429,7 +429,7 @@ s64 _cellSpursJobQueuePortPushFlush()
s64 _cellSpursJobQueuePortPushJobListBody() s64 _cellSpursJobQueuePortPushJobListBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003624, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003624, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -440,7 +440,7 @@ s64 _cellSpursJobQueuePortPushJobListBody()
s64 _cellSpursJobQueuePortPushJobBody() s64 _cellSpursJobQueuePortPushJobBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003A88, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003A88, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -451,7 +451,7 @@ s64 _cellSpursJobQueuePortPushJobBody()
s64 _cellSpursJobQueuePortPushJobBody2() s64 _cellSpursJobQueuePortPushJobBody2()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003A94, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003A94, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -462,7 +462,7 @@ s64 _cellSpursJobQueuePortPushJobBody2()
s64 _cellSpursJobQueuePortPushBody() s64 _cellSpursJobQueuePortPushBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003A98, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003A98, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -473,7 +473,7 @@ s64 _cellSpursJobQueuePortPushBody()
s64 cellSpursJobQueuePortTrySync() s64 cellSpursJobQueuePortTrySync()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003C38, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003C38, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -484,7 +484,7 @@ s64 cellSpursJobQueuePortTrySync()
s64 cellSpursJobQueuePortSync() s64 cellSpursJobQueuePortSync()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003C40, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003C40, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -495,7 +495,7 @@ s64 cellSpursJobQueuePortSync()
s64 cellSpursJobQueuePortInitialize() s64 cellSpursJobQueuePortInitialize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003C48, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003C48, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -506,7 +506,7 @@ s64 cellSpursJobQueuePortInitialize()
s64 cellSpursJobQueuePortInitializeWithDescriptorBuffer() s64 cellSpursJobQueuePortInitializeWithDescriptorBuffer()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003D78, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003D78, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -517,7 +517,7 @@ s64 cellSpursJobQueuePortInitializeWithDescriptorBuffer()
s64 cellSpursJobQueuePortFinalize() s64 cellSpursJobQueuePortFinalize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003E40, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003E40, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -528,7 +528,7 @@ s64 cellSpursJobQueuePortFinalize()
s64 _cellSpursJobQueuePortCopyPushJobBody() s64 _cellSpursJobQueuePortCopyPushJobBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004280, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004280, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -539,7 +539,7 @@ s64 _cellSpursJobQueuePortCopyPushJobBody()
s64 _cellSpursJobQueuePortCopyPushJobBody2() s64 _cellSpursJobQueuePortCopyPushJobBody2()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x00428C, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x00428C, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -550,7 +550,7 @@ s64 _cellSpursJobQueuePortCopyPushJobBody2()
s64 _cellSpursJobQueuePortCopyPushBody() s64 _cellSpursJobQueuePortCopyPushBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004290, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004290, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -561,7 +561,7 @@ s64 _cellSpursJobQueuePortCopyPushBody()
s64 cellSpursJobQueuePort2GetJobQueue() s64 cellSpursJobQueuePort2GetJobQueue()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0042A4, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0042A4, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -572,7 +572,7 @@ s64 cellSpursJobQueuePort2GetJobQueue()
s64 cellSpursJobQueuePort2PushSync() s64 cellSpursJobQueuePort2PushSync()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0042AC, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0042AC, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -583,7 +583,7 @@ s64 cellSpursJobQueuePort2PushSync()
s64 cellSpursJobQueuePort2PushFlush() s64 cellSpursJobQueuePort2PushFlush()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004330, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004330, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -594,7 +594,7 @@ s64 cellSpursJobQueuePort2PushFlush()
s64 _cellSpursJobQueuePort2PushJobListBody() s64 _cellSpursJobQueuePort2PushJobListBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0043B0, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0043B0, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -605,7 +605,7 @@ s64 _cellSpursJobQueuePort2PushJobListBody()
s64 cellSpursJobQueuePort2Sync() s64 cellSpursJobQueuePort2Sync()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0045AC, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0045AC, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -616,7 +616,7 @@ s64 cellSpursJobQueuePort2Sync()
s64 cellSpursJobQueuePort2Create() s64 cellSpursJobQueuePort2Create()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0046C4, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0046C4, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -627,7 +627,7 @@ s64 cellSpursJobQueuePort2Create()
s64 cellSpursJobQueuePort2Destroy() s64 cellSpursJobQueuePort2Destroy()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0047E4, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0047E4, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -638,7 +638,7 @@ s64 cellSpursJobQueuePort2Destroy()
s64 cellSpursJobQueuePort2AllocateJobDescriptor() s64 cellSpursJobQueuePort2AllocateJobDescriptor()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004928, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004928, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -649,7 +649,7 @@ s64 cellSpursJobQueuePort2AllocateJobDescriptor()
s64 _cellSpursJobQueuePort2PushAndReleaseJobBody() s64 _cellSpursJobQueuePort2PushAndReleaseJobBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004D94, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004D94, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -660,7 +660,7 @@ s64 _cellSpursJobQueuePort2PushAndReleaseJobBody()
s64 _cellSpursJobQueuePort2CopyPushJobBody() s64 _cellSpursJobQueuePort2CopyPushJobBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004DD0, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004DD0, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -671,7 +671,7 @@ s64 _cellSpursJobQueuePort2CopyPushJobBody()
s64 _cellSpursJobQueuePort2PushJobBody() s64 _cellSpursJobQueuePort2PushJobBody()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004E0C, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004E0C, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -682,7 +682,7 @@ s64 _cellSpursJobQueuePort2PushJobBody()
s64 cellSpursJobQueueSetExceptionEventHandler() s64 cellSpursJobQueueSetExceptionEventHandler()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004E48, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004E48, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -693,7 +693,7 @@ s64 cellSpursJobQueueSetExceptionEventHandler()
s64 cellSpursJobQueueUnsetExceptionEventHandler() s64 cellSpursJobQueueUnsetExceptionEventHandler()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__); cellSpursJq.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004EC0, libspurs_jq_rtoc); return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004EC0, libspurs_jq_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSpursJq); UNIMPLEMENTED_FUNC(cellSpursJq);
@ -701,10 +701,8 @@ s64 cellSpursJobQueueUnsetExceptionEventHandler()
#endif #endif
} }
void cellSpursJq_init(Module *pxThis) Module cellSpursJq("cellSpursJq", []()
{ {
cellSpursJq = pxThis;
REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeInitialize); REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeInitialize);
REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetMaxGrab); REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetMaxGrab);
REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetSubmitWithEntryLock); REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetSubmitWithEntryLock);
@ -806,4 +804,4 @@ void cellSpursJq_init(Module *pxThis)
fix_relocs(cellSpursJq, libspurs_jq, 0xFF70, 0x12370, 0xED00); fix_relocs(cellSpursJq, libspurs_jq, 0xFF70, 0x12370, 0xED00);
}); });
#endif #endif
} });

View file

@ -66,7 +66,7 @@ s32 spursTasksetProcessSyscall(SPUThread & spu, u32 syscallNum, u32 args);
void spursTasksetInit(SPUThread & spu, u32 pollStatus); void spursTasksetInit(SPUThread & spu, u32 pollStatus);
s32 spursTasksetLoadElf(SPUThread & spu, u32 * entryPoint, u32 * lowestLoadAddr, u64 elfAddr, bool skipWriteableSegments); s32 spursTasksetLoadElf(SPUThread & spu, u32 * entryPoint, u32 * lowestLoadAddr, u64 elfAddr, bool skipWriteableSegments);
extern Module *cellSpurs; extern Module cellSpurs;
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// SPURS utility functions // SPURS utility functions

View file

@ -4,7 +4,7 @@
#include "cellSubdisplay.h" #include "cellSubdisplay.h"
Module *cellSubdisplay = nullptr; extern Module cellSubdisplay;
int cellSubDisplayInit() int cellSubDisplayInit()
{ {
@ -20,7 +20,7 @@ int cellSubDisplayEnd()
int cellSubDisplayGetRequiredMemory(vm::ptr<CellSubDisplayParam> pParam) int cellSubDisplayGetRequiredMemory(vm::ptr<CellSubDisplayParam> pParam)
{ {
cellSubdisplay->Warning("cellSubDisplayGetRequiredMemory(pParam_addr=0x%x)", pParam.addr()); cellSubdisplay.Warning("cellSubDisplayGetRequiredMemory(pParam_addr=0x%x)", pParam.addr());
if (pParam->version == CELL_SUBDISPLAY_VERSION_0002) if (pParam->version == CELL_SUBDISPLAY_VERSION_0002)
{ {
@ -74,20 +74,18 @@ int cellSubDisplayGetPeerList()
return CELL_OK; return CELL_OK;
} }
void cellSubdisplay_init(Module *pxThis) Module cellSubdisplay("cellSubdisplay", []()
{ {
cellSubdisplay = pxThis; cellSubdisplay.AddFunc(0xf9a7e8a5, cellSubDisplayInit);
cellSubdisplay.AddFunc(0x551d80a5, cellSubDisplayEnd);
cellSubdisplay.AddFunc(0x6595ce22, cellSubDisplayGetRequiredMemory);
cellSubdisplay.AddFunc(0xa5bccb47, cellSubDisplayStart);
cellSubdisplay.AddFunc(0x6d85ddb3, cellSubDisplayStop);
cellSubdisplay->AddFunc(0xf9a7e8a5, cellSubDisplayInit); cellSubdisplay.AddFunc(0x938ac642, cellSubDisplayGetVideoBuffer);
cellSubdisplay->AddFunc(0x551d80a5, cellSubDisplayEnd); cellSubdisplay.AddFunc(0xaee1e0c2, cellSubDisplayAudioOutBlocking);
cellSubdisplay->AddFunc(0x6595ce22, cellSubDisplayGetRequiredMemory); cellSubdisplay.AddFunc(0x5468d6b0, cellSubDisplayAudioOutNonBlocking);
cellSubdisplay->AddFunc(0xa5bccb47, cellSubDisplayStart);
cellSubdisplay->AddFunc(0x6d85ddb3, cellSubDisplayStop);
cellSubdisplay->AddFunc(0x938ac642, cellSubDisplayGetVideoBuffer); cellSubdisplay.AddFunc(0x8a264d71, cellSubDisplayGetPeerNum);
cellSubdisplay->AddFunc(0xaee1e0c2, cellSubDisplayAudioOutBlocking); cellSubdisplay.AddFunc(0xe2485f79, cellSubDisplayGetPeerList);
cellSubdisplay->AddFunc(0x5468d6b0, cellSubDisplayAudioOutNonBlocking); });
cellSubdisplay->AddFunc(0x8a264d71, cellSubDisplayGetPeerNum);
cellSubdisplay->AddFunc(0xe2485f79, cellSubDisplayGetPeerList);
}

View file

@ -11,7 +11,7 @@
#include "Emu/Event.h" #include "Emu/Event.h"
#include "cellSync.h" #include "cellSync.h"
Module *cellSync = nullptr; extern Module cellSync;
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
#include "prx_libsre.h" #include "prx_libsre.h"
@ -44,14 +44,14 @@ s32 syncMutexInitialize(vm::ptr<CellSyncMutex> mutex)
s32 cellSyncMutexInitialize(vm::ptr<CellSyncMutex> mutex) s32 cellSyncMutexInitialize(vm::ptr<CellSyncMutex> mutex)
{ {
cellSync->Log("cellSyncMutexInitialize(mutex_addr=0x%x)", mutex.addr()); cellSync.Log("cellSyncMutexInitialize(mutex_addr=0x%x)", mutex.addr());
return syncMutexInitialize(mutex); return syncMutexInitialize(mutex);
} }
s32 cellSyncMutexLock(vm::ptr<CellSyncMutex> mutex) s32 cellSyncMutexLock(vm::ptr<CellSyncMutex> mutex)
{ {
cellSync->Log("cellSyncMutexLock(mutex_addr=0x%x)", mutex.addr()); cellSync.Log("cellSyncMutexLock(mutex_addr=0x%x)", mutex.addr());
if (!mutex) if (!mutex)
{ {
@ -82,7 +82,7 @@ s32 cellSyncMutexLock(vm::ptr<CellSyncMutex> mutex)
s32 cellSyncMutexTryLock(vm::ptr<CellSyncMutex> mutex) s32 cellSyncMutexTryLock(vm::ptr<CellSyncMutex> mutex)
{ {
cellSync->Log("cellSyncMutexTryLock(mutex_addr=0x%x)", mutex.addr()); cellSync.Log("cellSyncMutexTryLock(mutex_addr=0x%x)", mutex.addr());
if (!mutex) if (!mutex)
{ {
@ -106,7 +106,7 @@ s32 cellSyncMutexTryLock(vm::ptr<CellSyncMutex> mutex)
s32 cellSyncMutexUnlock(vm::ptr<CellSyncMutex> mutex) s32 cellSyncMutexUnlock(vm::ptr<CellSyncMutex> mutex)
{ {
cellSync->Log("cellSyncMutexUnlock(mutex_addr=0x%x)", mutex.addr()); cellSync.Log("cellSyncMutexUnlock(mutex_addr=0x%x)", mutex.addr());
if (!mutex) if (!mutex)
{ {
@ -148,7 +148,7 @@ s32 syncBarrierInitialize(vm::ptr<CellSyncBarrier> barrier, u16 total_count)
s32 cellSyncBarrierInitialize(vm::ptr<CellSyncBarrier> barrier, u16 total_count) s32 cellSyncBarrierInitialize(vm::ptr<CellSyncBarrier> barrier, u16 total_count)
{ {
cellSync->Log("cellSyncBarrierInitialize(barrier_addr=0x%x, total_count=%d)", barrier.addr(), total_count); cellSync.Log("cellSyncBarrierInitialize(barrier_addr=0x%x, total_count=%d)", barrier.addr(), total_count);
return syncBarrierInitialize(barrier, total_count); return syncBarrierInitialize(barrier, total_count);
} }
@ -173,7 +173,7 @@ s32 syncBarrierTryNotifyOp(CellSyncBarrier::data_t& barrier)
s32 cellSyncBarrierNotify(vm::ptr<CellSyncBarrier> barrier) s32 cellSyncBarrierNotify(vm::ptr<CellSyncBarrier> barrier)
{ {
cellSync->Log("cellSyncBarrierNotify(barrier_addr=0x%x)", barrier.addr()); cellSync.Log("cellSyncBarrierNotify(barrier_addr=0x%x)", barrier.addr());
if (!barrier) if (!barrier)
{ {
@ -195,7 +195,7 @@ s32 cellSyncBarrierNotify(vm::ptr<CellSyncBarrier> barrier)
s32 cellSyncBarrierTryNotify(vm::ptr<CellSyncBarrier> barrier) s32 cellSyncBarrierTryNotify(vm::ptr<CellSyncBarrier> barrier)
{ {
cellSync->Log("cellSyncBarrierTryNotify(barrier_addr=0x%x)", barrier.addr()); cellSync.Log("cellSyncBarrierTryNotify(barrier_addr=0x%x)", barrier.addr());
if (!barrier) if (!barrier)
{ {
@ -235,7 +235,7 @@ s32 syncBarrierTryWaitOp(CellSyncBarrier::data_t& barrier)
s32 cellSyncBarrierWait(vm::ptr<CellSyncBarrier> barrier) s32 cellSyncBarrierWait(vm::ptr<CellSyncBarrier> barrier)
{ {
cellSync->Log("cellSyncBarrierWait(barrier_addr=0x%x)", barrier.addr()); cellSync.Log("cellSyncBarrierWait(barrier_addr=0x%x)", barrier.addr());
if (!barrier) if (!barrier)
{ {
@ -257,7 +257,7 @@ s32 cellSyncBarrierWait(vm::ptr<CellSyncBarrier> barrier)
s32 cellSyncBarrierTryWait(vm::ptr<CellSyncBarrier> barrier) s32 cellSyncBarrierTryWait(vm::ptr<CellSyncBarrier> barrier)
{ {
cellSync->Log("cellSyncBarrierTryWait(barrier_addr=0x%x)", barrier.addr()); cellSync.Log("cellSyncBarrierTryWait(barrier_addr=0x%x)", barrier.addr());
if (!barrier) if (!barrier)
{ {
@ -301,7 +301,7 @@ s32 syncRwmInitialize(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer, u32 buffer
s32 cellSyncRwmInitialize(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer, u32 buffer_size) s32 cellSyncRwmInitialize(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer, u32 buffer_size)
{ {
cellSync->Log("cellSyncRwmInitialize(rwm_addr=0x%x, buffer_addr=0x%x, buffer_size=0x%x)", rwm.addr(), buffer.addr(), buffer_size); cellSync.Log("cellSyncRwmInitialize(rwm_addr=0x%x, buffer_addr=0x%x, buffer_size=0x%x)", rwm.addr(), buffer.addr(), buffer_size);
return syncRwmInitialize(rwm, buffer, buffer_size); return syncRwmInitialize(rwm, buffer, buffer_size);
} }
@ -330,7 +330,7 @@ s32 syncRwmReadEndOp(CellSyncRwm::data_t& rwm)
s32 cellSyncRwmRead(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer) s32 cellSyncRwmRead(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer)
{ {
cellSync->Log("cellSyncRwmRead(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.addr(), buffer.addr()); cellSync.Log("cellSyncRwmRead(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.addr(), buffer.addr());
if (!rwm || !buffer) if (!rwm || !buffer)
{ {
@ -353,7 +353,7 @@ s32 cellSyncRwmRead(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer)
// prx: decrease m_readers (return 0x8041010C if already zero) // prx: decrease m_readers (return 0x8041010C if already zero)
if (s32 res = rwm->data.atomic_op(CELL_OK, syncRwmReadEndOp)) if (s32 res = rwm->data.atomic_op(CELL_OK, syncRwmReadEndOp))
{ {
cellSync->Error("syncRwmReadEndOp(rwm=0x%x) failed: m_readers == 0", rwm); cellSync.Error("syncRwmReadEndOp(rwm=0x%x) failed: m_readers == 0", rwm);
return res; return res;
} }
@ -363,7 +363,7 @@ s32 cellSyncRwmRead(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer)
s32 cellSyncRwmTryRead(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer) s32 cellSyncRwmTryRead(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer)
{ {
cellSync->Log("cellSyncRwmTryRead(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.addr(), buffer.addr()); cellSync.Log("cellSyncRwmTryRead(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.addr(), buffer.addr());
if (!rwm || !buffer) if (!rwm || !buffer)
{ {
@ -403,7 +403,7 @@ s32 syncRwmTryWriteBeginOp(CellSyncRwm::data_t& rwm)
s32 cellSyncRwmWrite(vm::ptr<CellSyncRwm> rwm, vm::ptr<const void> buffer) s32 cellSyncRwmWrite(vm::ptr<CellSyncRwm> rwm, vm::ptr<const void> buffer)
{ {
cellSync->Log("cellSyncRwmWrite(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.addr(), buffer.addr()); cellSync.Log("cellSyncRwmWrite(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.addr(), buffer.addr());
if (!rwm || !buffer) if (!rwm || !buffer)
{ {
@ -436,7 +436,7 @@ s32 cellSyncRwmWrite(vm::ptr<CellSyncRwm> rwm, vm::ptr<const void> buffer)
s32 cellSyncRwmTryWrite(vm::ptr<CellSyncRwm> rwm, vm::ptr<const void> buffer) s32 cellSyncRwmTryWrite(vm::ptr<CellSyncRwm> rwm, vm::ptr<const void> buffer)
{ {
cellSync->Log("cellSyncRwmTryWrite(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.addr(), buffer.addr()); cellSync.Log("cellSyncRwmTryWrite(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.addr(), buffer.addr());
if (!rwm || !buffer) if (!rwm || !buffer)
{ {
@ -491,7 +491,7 @@ s32 syncQueueInitialize(vm::ptr<CellSyncQueue> queue, vm::ptr<u8> buffer, u32 si
s32 cellSyncQueueInitialize(vm::ptr<CellSyncQueue> queue, vm::ptr<u8> buffer, u32 size, u32 depth) s32 cellSyncQueueInitialize(vm::ptr<CellSyncQueue> queue, vm::ptr<u8> buffer, u32 size, u32 depth)
{ {
cellSync->Log("cellSyncQueueInitialize(queue_addr=0x%x, buffer_addr=0x%x, size=0x%x, depth=0x%x)", queue.addr(), buffer.addr(), size, depth); cellSync.Log("cellSyncQueueInitialize(queue_addr=0x%x, buffer_addr=0x%x, size=0x%x, depth=0x%x)", queue.addr(), buffer.addr(), size, depth);
return syncQueueInitialize(queue, buffer, size, depth); return syncQueueInitialize(queue, buffer, size, depth);
} }
@ -518,7 +518,7 @@ s32 syncQueueTryPushOp(CellSyncQueue::data_t& queue, u32 depth, u32& position)
s32 cellSyncQueuePush(vm::ptr<CellSyncQueue> queue, vm::ptr<const void> buffer) s32 cellSyncQueuePush(vm::ptr<CellSyncQueue> queue, vm::ptr<const void> buffer)
{ {
cellSync->Log("cellSyncQueuePush(queue_addr=0x%x, buffer_addr=0x%x)", queue.addr(), buffer.addr()); cellSync.Log("cellSyncQueuePush(queue_addr=0x%x, buffer_addr=0x%x)", queue.addr(), buffer.addr());
if (!queue || !buffer) if (!queue || !buffer)
{ {
@ -554,7 +554,7 @@ s32 cellSyncQueuePush(vm::ptr<CellSyncQueue> queue, vm::ptr<const void> buffer)
s32 cellSyncQueueTryPush(vm::ptr<CellSyncQueue> queue, vm::ptr<const void> buffer) s32 cellSyncQueueTryPush(vm::ptr<CellSyncQueue> queue, vm::ptr<const void> buffer)
{ {
cellSync->Log("cellSyncQueueTryPush(queue_addr=0x%x, buffer_addr=0x%x)", queue.addr(), buffer.addr()); cellSync.Log("cellSyncQueueTryPush(queue_addr=0x%x, buffer_addr=0x%x)", queue.addr(), buffer.addr());
if (!queue || !buffer) if (!queue || !buffer)
{ {
@ -608,7 +608,7 @@ s32 syncQueueTryPopOp(CellSyncQueue::data_t& queue, u32 depth, u32& position)
s32 cellSyncQueuePop(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer) s32 cellSyncQueuePop(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer)
{ {
cellSync->Log("cellSyncQueuePop(queue_addr=0x%x, buffer_addr=0x%x)", queue.addr(), buffer.addr()); cellSync.Log("cellSyncQueuePop(queue_addr=0x%x, buffer_addr=0x%x)", queue.addr(), buffer.addr());
if (!queue || !buffer) if (!queue || !buffer)
{ {
@ -644,7 +644,7 @@ s32 cellSyncQueuePop(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer)
s32 cellSyncQueueTryPop(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer) s32 cellSyncQueueTryPop(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer)
{ {
cellSync->Log("cellSyncQueueTryPop(queue_addr=0x%x, buffer_addr=0x%x)", queue.addr(), buffer.addr()); cellSync.Log("cellSyncQueueTryPop(queue_addr=0x%x, buffer_addr=0x%x)", queue.addr(), buffer.addr());
if (!queue || !buffer) if (!queue || !buffer)
{ {
@ -692,7 +692,7 @@ s32 syncQueueTryPeekOp(CellSyncQueue::data_t& queue, u32 depth, u32& position)
s32 cellSyncQueuePeek(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer) s32 cellSyncQueuePeek(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer)
{ {
cellSync->Log("cellSyncQueuePeek(queue_addr=0x%x, buffer_addr=0x%x)", queue.addr(), buffer.addr()); cellSync.Log("cellSyncQueuePeek(queue_addr=0x%x, buffer_addr=0x%x)", queue.addr(), buffer.addr());
if (!queue || !buffer) if (!queue || !buffer)
{ {
@ -725,7 +725,7 @@ s32 cellSyncQueuePeek(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer)
s32 cellSyncQueueTryPeek(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer) s32 cellSyncQueueTryPeek(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer)
{ {
cellSync->Log("cellSyncQueueTryPeek(queue_addr=0x%x, buffer_addr=0x%x)", queue.addr(), buffer.addr()); cellSync.Log("cellSyncQueueTryPeek(queue_addr=0x%x, buffer_addr=0x%x)", queue.addr(), buffer.addr());
if (!queue || !buffer) if (!queue || !buffer)
{ {
@ -759,7 +759,7 @@ s32 cellSyncQueueTryPeek(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer)
s32 cellSyncQueueSize(vm::ptr<CellSyncQueue> queue) s32 cellSyncQueueSize(vm::ptr<CellSyncQueue> queue)
{ {
cellSync->Log("cellSyncQueueSize(queue_addr=0x%x)", queue.addr()); cellSync.Log("cellSyncQueueSize(queue_addr=0x%x)", queue.addr());
if (!queue) if (!queue)
{ {
@ -780,7 +780,7 @@ s32 cellSyncQueueSize(vm::ptr<CellSyncQueue> queue)
s32 cellSyncQueueClear(vm::ptr<CellSyncQueue> queue) s32 cellSyncQueueClear(vm::ptr<CellSyncQueue> queue)
{ {
cellSync->Log("cellSyncQueueClear(queue_addr=0x%x)", queue.addr()); cellSync.Log("cellSyncQueueClear(queue_addr=0x%x)", queue.addr());
if (!queue) if (!queue)
{ {
@ -837,10 +837,10 @@ s32 cellSyncQueueClear(vm::ptr<CellSyncQueue> queue)
void syncLFQueueDump(vm::ptr<CellSyncLFQueue> queue) void syncLFQueueDump(vm::ptr<CellSyncLFQueue> queue)
{ {
cellSync->Notice("CellSyncLFQueue dump: addr = 0x%x", queue.addr()); cellSync.Notice("CellSyncLFQueue dump: addr = 0x%x", queue.addr());
for (u32 i = 0; i < sizeof(CellSyncLFQueue) / 16; i++) for (u32 i = 0; i < sizeof(CellSyncLFQueue) / 16; i++)
{ {
cellSync->Notice("*** 0x%.16llx 0x%.16llx", vm::read64(queue.addr() + i * 16), vm::read64(queue.addr() + i * 16 + 8)); cellSync.Notice("*** 0x%.16llx 0x%.16llx", vm::read64(queue.addr() + i * 16), vm::read64(queue.addr() + i * 16 + 8));
} }
} }
@ -992,7 +992,7 @@ s32 syncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer, u3
s32 cellSyncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer, u32 size, u32 depth, CellSyncQueueDirection direction, vm::ptr<void> eaSignal) s32 cellSyncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer, u32 size, u32 depth, CellSyncQueueDirection direction, vm::ptr<void> eaSignal)
{ {
cellSync->Warning("cellSyncLFQueueInitialize(queue_addr=0x%x, buffer_addr=0x%x, size=0x%x, depth=0x%x, direction=%d, eaSignal_addr=0x%x)", cellSync.Warning("cellSyncLFQueueInitialize(queue_addr=0x%x, buffer_addr=0x%x, size=0x%x, depth=0x%x, direction=%d, eaSignal_addr=0x%x)",
queue.addr(), buffer.addr(), size, depth, direction, eaSignal.addr()); queue.addr(), buffer.addr(), size, depth, direction, eaSignal.addr());
return syncLFQueueInitialize(queue, buffer, size, depth, direction, eaSignal); return syncLFQueueInitialize(queue, buffer, size, depth, direction, eaSignal);
@ -1101,7 +1101,7 @@ s32 syncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
s32 _cellSyncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue) s32 _cellSyncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue)
{ {
cellSync->Todo("_cellSyncLFQueueGetPushPointer(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, useEventQueue=%d)", cellSync.Todo("_cellSyncLFQueueGetPushPointer(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, useEventQueue=%d)",
queue.addr(), pointer.addr(), isBlocking, useEventQueue); queue.addr(), pointer.addr(), isBlocking, useEventQueue);
s32 pointer_value; s32 pointer_value;
@ -1121,7 +1121,7 @@ s32 syncLFQueueGetPushPointer2(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
s32 _cellSyncLFQueueGetPushPointer2(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue) s32 _cellSyncLFQueueGetPushPointer2(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue)
{ {
// arguments copied from _cellSyncLFQueueGetPushPointer // arguments copied from _cellSyncLFQueueGetPushPointer
cellSync->Todo("_cellSyncLFQueueGetPushPointer2(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, useEventQueue=%d)", cellSync.Todo("_cellSyncLFQueueGetPushPointer2(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, useEventQueue=%d)",
queue.addr(), pointer.addr(), isBlocking, useEventQueue); queue.addr(), pointer.addr(), isBlocking, useEventQueue);
s32 pointer_value; s32 pointer_value;
@ -1266,7 +1266,7 @@ s32 syncLFQueueCompletePushPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer,
s32 _cellSyncLFQueueCompletePushPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal) s32 _cellSyncLFQueueCompletePushPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal)
{ {
cellSync->Todo("_cellSyncLFQueueCompletePushPointer(queue_addr=0x%x, pointer=%d, fpSendSignal_addr=0x%x)", cellSync.Todo("_cellSyncLFQueueCompletePushPointer(queue_addr=0x%x, pointer=%d, fpSendSignal_addr=0x%x)",
queue.addr(), pointer, fpSendSignal.addr()); queue.addr(), pointer, fpSendSignal.addr());
return syncLFQueueCompletePushPointer(queue, pointer, fpSendSignal); return syncLFQueueCompletePushPointer(queue, pointer, fpSendSignal);
@ -1283,7 +1283,7 @@ s32 syncLFQueueCompletePushPointer2(vm::ptr<CellSyncLFQueue> queue, s32 pointer,
s32 _cellSyncLFQueueCompletePushPointer2(vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal) s32 _cellSyncLFQueueCompletePushPointer2(vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal)
{ {
// arguments copied from _cellSyncLFQueueCompletePushPointer // arguments copied from _cellSyncLFQueueCompletePushPointer
cellSync->Todo("_cellSyncLFQueueCompletePushPointer2(queue_addr=0x%x, pointer=%d, fpSendSignal_addr=0x%x)", cellSync.Todo("_cellSyncLFQueueCompletePushPointer2(queue_addr=0x%x, pointer=%d, fpSendSignal_addr=0x%x)",
queue.addr(), pointer, fpSendSignal.addr()); queue.addr(), pointer, fpSendSignal.addr());
return syncLFQueueCompletePushPointer2(queue, pointer, fpSendSignal); return syncLFQueueCompletePushPointer2(queue, pointer, fpSendSignal);
@ -1292,7 +1292,7 @@ s32 _cellSyncLFQueueCompletePushPointer2(vm::ptr<CellSyncLFQueue> queue, s32 poi
s32 _cellSyncLFQueuePushBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::ptr<const void> buffer, u32 isBlocking) s32 _cellSyncLFQueuePushBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::ptr<const void> buffer, u32 isBlocking)
{ {
// cellSyncLFQueuePush has 1 in isBlocking param, cellSyncLFQueueTryPush has 0 // cellSyncLFQueuePush has 1 in isBlocking param, cellSyncLFQueueTryPush has 0
cellSync->Warning("_cellSyncLFQueuePushBody(queue_addr=0x%x, buffer_addr=0x%x, isBlocking=%d)", queue.addr(), buffer.addr(), isBlocking); cellSync.Warning("_cellSyncLFQueuePushBody(queue_addr=0x%x, buffer_addr=0x%x, isBlocking=%d)", queue.addr(), buffer.addr(), isBlocking);
if (!queue || !buffer) if (!queue || !buffer)
{ {
@ -1344,7 +1344,7 @@ s32 _cellSyncLFQueuePushBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm:
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
cellSync->Warning("_cellSyncLFQueuePushBody(queue_addr=0x%x) aborted", queue.addr()); cellSync.Warning("_cellSyncLFQueuePushBody(queue_addr=0x%x) aborted", queue.addr());
return CELL_OK; return CELL_OK;
} }
} }
@ -1480,7 +1480,7 @@ s32 syncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 i
s32 _cellSyncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 arg4, u32 useEventQueue) s32 _cellSyncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 arg4, u32 useEventQueue)
{ {
cellSync->Todo("_cellSyncLFQueueGetPopPointer(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, arg4=%d, useEventQueue=%d)", cellSync.Todo("_cellSyncLFQueueGetPopPointer(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, arg4=%d, useEventQueue=%d)",
queue.addr(), pointer.addr(), isBlocking, arg4, useEventQueue); queue.addr(), pointer.addr(), isBlocking, arg4, useEventQueue);
s32 pointer_value; s32 pointer_value;
@ -1500,7 +1500,7 @@ s32 syncLFQueueGetPopPointer2(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
s32 _cellSyncLFQueueGetPopPointer2(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue) s32 _cellSyncLFQueueGetPopPointer2(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue)
{ {
// arguments copied from _cellSyncLFQueueGetPopPointer // arguments copied from _cellSyncLFQueueGetPopPointer
cellSync->Todo("_cellSyncLFQueueGetPopPointer2(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, useEventQueue=%d)", cellSync.Todo("_cellSyncLFQueueGetPopPointer2(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, useEventQueue=%d)",
queue.addr(), pointer.addr(), isBlocking, useEventQueue); queue.addr(), pointer.addr(), isBlocking, useEventQueue);
s32 pointer_value; s32 pointer_value;
@ -1645,7 +1645,7 @@ s32 syncLFQueueCompletePopPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, c
s32 _cellSyncLFQueueCompletePopPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull) s32 _cellSyncLFQueueCompletePopPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull)
{ {
// arguments copied from _cellSyncLFQueueCompletePushPointer + unknown argument (noQueueFull taken from LFQueue2CompletePopPointer) // arguments copied from _cellSyncLFQueueCompletePushPointer + unknown argument (noQueueFull taken from LFQueue2CompletePopPointer)
cellSync->Todo("_cellSyncLFQueueCompletePopPointer(queue_addr=0x%x, pointer=%d, fpSendSignal_addr=0x%x, noQueueFull=%d)", cellSync.Todo("_cellSyncLFQueueCompletePopPointer(queue_addr=0x%x, pointer=%d, fpSendSignal_addr=0x%x, noQueueFull=%d)",
queue.addr(), pointer, fpSendSignal.addr(), noQueueFull); queue.addr(), pointer, fpSendSignal.addr(), noQueueFull);
return syncLFQueueCompletePopPointer(queue, pointer, fpSendSignal, noQueueFull); return syncLFQueueCompletePopPointer(queue, pointer, fpSendSignal, noQueueFull);
@ -1662,7 +1662,7 @@ s32 syncLFQueueCompletePopPointer2(vm::ptr<CellSyncLFQueue> queue, s32 pointer,
s32 _cellSyncLFQueueCompletePopPointer2(vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull) s32 _cellSyncLFQueueCompletePopPointer2(vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull)
{ {
// arguments copied from _cellSyncLFQueueCompletePopPointer // arguments copied from _cellSyncLFQueueCompletePopPointer
cellSync->Todo("_cellSyncLFQueueCompletePopPointer2(queue_addr=0x%x, pointer=%d, fpSendSignal_addr=0x%x, noQueueFull=%d)", cellSync.Todo("_cellSyncLFQueueCompletePopPointer2(queue_addr=0x%x, pointer=%d, fpSendSignal_addr=0x%x, noQueueFull=%d)",
queue.addr(), pointer, fpSendSignal.addr(), noQueueFull); queue.addr(), pointer, fpSendSignal.addr(), noQueueFull);
return syncLFQueueCompletePopPointer2(queue, pointer, fpSendSignal, noQueueFull); return syncLFQueueCompletePopPointer2(queue, pointer, fpSendSignal, noQueueFull);
@ -1671,7 +1671,7 @@ s32 _cellSyncLFQueueCompletePopPointer2(vm::ptr<CellSyncLFQueue> queue, s32 poin
s32 _cellSyncLFQueuePopBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::ptr<void> buffer, u32 isBlocking) s32 _cellSyncLFQueuePopBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::ptr<void> buffer, u32 isBlocking)
{ {
// cellSyncLFQueuePop has 1 in isBlocking param, cellSyncLFQueueTryPop has 0 // cellSyncLFQueuePop has 1 in isBlocking param, cellSyncLFQueueTryPop has 0
cellSync->Warning("_cellSyncLFQueuePopBody(queue_addr=0x%x, buffer_addr=0x%x, isBlocking=%d)", queue.addr(), buffer.addr(), isBlocking); cellSync.Warning("_cellSyncLFQueuePopBody(queue_addr=0x%x, buffer_addr=0x%x, isBlocking=%d)", queue.addr(), buffer.addr(), isBlocking);
if (!queue || !buffer) if (!queue || !buffer)
{ {
@ -1722,7 +1722,7 @@ s32 _cellSyncLFQueuePopBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
cellSync->Warning("_cellSyncLFQueuePopBody(queue_addr=0x%x) aborted", queue.addr()); cellSync.Warning("_cellSyncLFQueuePopBody(queue_addr=0x%x) aborted", queue.addr());
return CELL_OK; return CELL_OK;
} }
} }
@ -1757,7 +1757,7 @@ s32 _cellSyncLFQueuePopBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::
s32 cellSyncLFQueueClear(vm::ptr<CellSyncLFQueue> queue) s32 cellSyncLFQueueClear(vm::ptr<CellSyncLFQueue> queue)
{ {
cellSync->Warning("cellSyncLFQueueClear(queue_addr=0x%x)", queue.addr()); cellSync.Warning("cellSyncLFQueueClear(queue_addr=0x%x)", queue.addr());
if (!queue) if (!queue)
{ {
@ -1807,7 +1807,7 @@ s32 cellSyncLFQueueClear(vm::ptr<CellSyncLFQueue> queue)
s32 cellSyncLFQueueSize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> size) s32 cellSyncLFQueueSize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> size)
{ {
cellSync->Warning("cellSyncLFQueueSize(queue_addr=0x%x, size_addr=0x%x)", queue.addr(), size.addr()); cellSync.Warning("cellSyncLFQueueSize(queue_addr=0x%x, size_addr=0x%x)", queue.addr(), size.addr());
if (!queue || !size) if (!queue || !size)
{ {
@ -1842,7 +1842,7 @@ s32 cellSyncLFQueueSize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> size)
s32 cellSyncLFQueueDepth(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> depth) s32 cellSyncLFQueueDepth(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> depth)
{ {
cellSync->Log("cellSyncLFQueueDepth(queue_addr=0x%x, depth_addr=0x%x)", queue.addr(), depth.addr()); cellSync.Log("cellSyncLFQueueDepth(queue_addr=0x%x, depth_addr=0x%x)", queue.addr(), depth.addr());
if (!queue || !depth) if (!queue || !depth)
{ {
@ -1859,7 +1859,7 @@ s32 cellSyncLFQueueDepth(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> depth)
s32 _cellSyncLFQueueGetSignalAddress(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<u32> ppSignal) s32 _cellSyncLFQueueGetSignalAddress(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<u32> ppSignal)
{ {
cellSync->Log("_cellSyncLFQueueGetSignalAddress(queue_addr=0x%x, ppSignal_addr=0x%x)", queue.addr(), ppSignal.addr()); cellSync.Log("_cellSyncLFQueueGetSignalAddress(queue_addr=0x%x, ppSignal_addr=0x%x)", queue.addr(), ppSignal.addr());
if (!queue || !ppSignal) if (!queue || !ppSignal)
{ {
@ -1876,7 +1876,7 @@ s32 _cellSyncLFQueueGetSignalAddress(vm::ptr<const CellSyncLFQueue> queue, vm::p
s32 cellSyncLFQueueGetDirection(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<CellSyncQueueDirection> direction) s32 cellSyncLFQueueGetDirection(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<CellSyncQueueDirection> direction)
{ {
cellSync->Log("cellSyncLFQueueGetDirection(queue_addr=0x%x, direction_addr=0x%x)", queue.addr(), direction.addr()); cellSync.Log("cellSyncLFQueueGetDirection(queue_addr=0x%x, direction_addr=0x%x)", queue.addr(), direction.addr());
if (!queue || !direction) if (!queue || !direction)
{ {
@ -1893,7 +1893,7 @@ s32 cellSyncLFQueueGetDirection(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<Ce
s32 cellSyncLFQueueGetEntrySize(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<u32> entry_size) s32 cellSyncLFQueueGetEntrySize(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<u32> entry_size)
{ {
cellSync->Log("cellSyncLFQueueGetEntrySize(queue_addr=0x%x, entry_size_addr=0x%x)", queue.addr(), entry_size.addr()); cellSync.Log("cellSyncLFQueueGetEntrySize(queue_addr=0x%x, entry_size_addr=0x%x)", queue.addr(), entry_size.addr());
if (!queue || !entry_size) if (!queue || !entry_size)
{ {
@ -1921,7 +1921,7 @@ s32 syncLFQueueAttachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncL
s32 _cellSyncLFQueueAttachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncLFQueue> queue) s32 _cellSyncLFQueueAttachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncLFQueue> queue)
{ {
cellSync->Todo("_cellSyncLFQueueAttachLv2EventQueue(spus_addr=0x%x, num=%d, queue_addr=0x%x)", spus.addr(), num, queue.addr()); cellSync.Todo("_cellSyncLFQueueAttachLv2EventQueue(spus_addr=0x%x, num=%d, queue_addr=0x%x)", spus.addr(), num, queue.addr());
return syncLFQueueAttachLv2EventQueue(spus, num, queue); return syncLFQueueAttachLv2EventQueue(spus, num, queue);
} }
@ -1939,61 +1939,59 @@ s32 syncLFQueueDetachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncL
s32 _cellSyncLFQueueDetachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncLFQueue> queue) s32 _cellSyncLFQueueDetachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncLFQueue> queue)
{ {
cellSync->Todo("_cellSyncLFQueueDetachLv2EventQueue(spus_addr=0x%x, num=%d, queue_addr=0x%x)", spus.addr(), num, queue.addr()); cellSync.Todo("_cellSyncLFQueueDetachLv2EventQueue(spus_addr=0x%x, num=%d, queue_addr=0x%x)", spus.addr(), num, queue.addr());
return syncLFQueueDetachLv2EventQueue(spus, num, queue); return syncLFQueueDetachLv2EventQueue(spus, num, queue);
} }
void cellSync_init(Module *pxThis) Module cellSync("cellSync", []()
{ {
cellSync = pxThis; cellSync.AddFunc(0xa9072dee, cellSyncMutexInitialize);
cellSync.AddFunc(0x1bb675c2, cellSyncMutexLock);
cellSync.AddFunc(0xd06918c4, cellSyncMutexTryLock);
cellSync.AddFunc(0x91f2b7b0, cellSyncMutexUnlock);
cellSync->AddFunc(0xa9072dee, cellSyncMutexInitialize); cellSync.AddFunc(0x07254fda, cellSyncBarrierInitialize);
cellSync->AddFunc(0x1bb675c2, cellSyncMutexLock); cellSync.AddFunc(0xf06a6415, cellSyncBarrierNotify);
cellSync->AddFunc(0xd06918c4, cellSyncMutexTryLock); cellSync.AddFunc(0x268edd6d, cellSyncBarrierTryNotify);
cellSync->AddFunc(0x91f2b7b0, cellSyncMutexUnlock); cellSync.AddFunc(0x35f21355, cellSyncBarrierWait);
cellSync.AddFunc(0x6c272124, cellSyncBarrierTryWait);
cellSync->AddFunc(0x07254fda, cellSyncBarrierInitialize); cellSync.AddFunc(0xfc48b03f, cellSyncRwmInitialize);
cellSync->AddFunc(0xf06a6415, cellSyncBarrierNotify); cellSync.AddFunc(0xcece771f, cellSyncRwmRead);
cellSync->AddFunc(0x268edd6d, cellSyncBarrierTryNotify); cellSync.AddFunc(0xa6669751, cellSyncRwmTryRead);
cellSync->AddFunc(0x35f21355, cellSyncBarrierWait); cellSync.AddFunc(0xed773f5f, cellSyncRwmWrite);
cellSync->AddFunc(0x6c272124, cellSyncBarrierTryWait); cellSync.AddFunc(0xba5bee48, cellSyncRwmTryWrite);
cellSync->AddFunc(0xfc48b03f, cellSyncRwmInitialize); cellSync.AddFunc(0x3929948d, cellSyncQueueInitialize);
cellSync->AddFunc(0xcece771f, cellSyncRwmRead); cellSync.AddFunc(0x5ae841e5, cellSyncQueuePush);
cellSync->AddFunc(0xa6669751, cellSyncRwmTryRead); cellSync.AddFunc(0x705985cd, cellSyncQueueTryPush);
cellSync->AddFunc(0xed773f5f, cellSyncRwmWrite); cellSync.AddFunc(0x4da6d7e0, cellSyncQueuePop);
cellSync->AddFunc(0xba5bee48, cellSyncRwmTryWrite); cellSync.AddFunc(0xa58df87f, cellSyncQueueTryPop);
cellSync.AddFunc(0x48154c9b, cellSyncQueuePeek);
cellSync.AddFunc(0x68af923c, cellSyncQueueTryPeek);
cellSync.AddFunc(0x4da349b2, cellSyncQueueSize);
cellSync.AddFunc(0xa5362e73, cellSyncQueueClear);
cellSync->AddFunc(0x3929948d, cellSyncQueueInitialize); cellSync.AddFunc(0x0c7cb9f7, cellSyncLFQueueGetEntrySize);
cellSync->AddFunc(0x5ae841e5, cellSyncQueuePush); cellSync.AddFunc(0x167ea63e, cellSyncLFQueueSize);
cellSync->AddFunc(0x705985cd, cellSyncQueueTryPush); cellSync.AddFunc(0x2af0c515, cellSyncLFQueueClear);
cellSync->AddFunc(0x4da6d7e0, cellSyncQueuePop); cellSync.AddFunc(0x35bbdad2, _cellSyncLFQueueCompletePushPointer2);
cellSync->AddFunc(0xa58df87f, cellSyncQueueTryPop); cellSync.AddFunc(0x46356fe0, _cellSyncLFQueueGetPopPointer2);
cellSync->AddFunc(0x48154c9b, cellSyncQueuePeek); cellSync.AddFunc(0x4e88c68d, _cellSyncLFQueueCompletePushPointer);
cellSync->AddFunc(0x68af923c, cellSyncQueueTryPeek); cellSync.AddFunc(0x54fc2032, _cellSyncLFQueueAttachLv2EventQueue);
cellSync->AddFunc(0x4da349b2, cellSyncQueueSize); cellSync.AddFunc(0x6bb4ef9d, _cellSyncLFQueueGetPushPointer2);
cellSync->AddFunc(0xa5362e73, cellSyncQueueClear); cellSync.AddFunc(0x74c37666, _cellSyncLFQueueGetPopPointer);
cellSync.AddFunc(0x7a51deee, _cellSyncLFQueueCompletePopPointer2);
cellSync->AddFunc(0x0c7cb9f7, cellSyncLFQueueGetEntrySize); cellSync.AddFunc(0x811d148e, _cellSyncLFQueueDetachLv2EventQueue);
cellSync->AddFunc(0x167ea63e, cellSyncLFQueueSize); cellSync.AddFunc(0xaa355278, cellSyncLFQueueInitialize);
cellSync->AddFunc(0x2af0c515, cellSyncLFQueueClear); cellSync.AddFunc(0xaff7627a, _cellSyncLFQueueGetSignalAddress);
cellSync->AddFunc(0x35bbdad2, _cellSyncLFQueueCompletePushPointer2); cellSync.AddFunc(0xba5961ca, _cellSyncLFQueuePushBody);
cellSync->AddFunc(0x46356fe0, _cellSyncLFQueueGetPopPointer2); cellSync.AddFunc(0xd59aa307, cellSyncLFQueueGetDirection);
cellSync->AddFunc(0x4e88c68d, _cellSyncLFQueueCompletePushPointer); cellSync.AddFunc(0xe18c273c, cellSyncLFQueueDepth);
cellSync->AddFunc(0x54fc2032, _cellSyncLFQueueAttachLv2EventQueue); cellSync.AddFunc(0xe1bc7add, _cellSyncLFQueuePopBody);
cellSync->AddFunc(0x6bb4ef9d, _cellSyncLFQueueGetPushPointer2); cellSync.AddFunc(0xe9bf2110, _cellSyncLFQueueGetPushPointer);
cellSync->AddFunc(0x74c37666, _cellSyncLFQueueGetPopPointer); cellSync.AddFunc(0xfe74e8e7, _cellSyncLFQueueCompletePopPointer);
cellSync->AddFunc(0x7a51deee, _cellSyncLFQueueCompletePopPointer2);
cellSync->AddFunc(0x811d148e, _cellSyncLFQueueDetachLv2EventQueue);
cellSync->AddFunc(0xaa355278, cellSyncLFQueueInitialize);
cellSync->AddFunc(0xaff7627a, _cellSyncLFQueueGetSignalAddress);
cellSync->AddFunc(0xba5961ca, _cellSyncLFQueuePushBody);
cellSync->AddFunc(0xd59aa307, cellSyncLFQueueGetDirection);
cellSync->AddFunc(0xe18c273c, cellSyncLFQueueDepth);
cellSync->AddFunc(0xe1bc7add, _cellSyncLFQueuePopBody);
cellSync->AddFunc(0xe9bf2110, _cellSyncLFQueueGetPushPointer);
cellSync->AddFunc(0xfe74e8e7, _cellSyncLFQueueCompletePopPointer);
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
CallAfter([]() CallAfter([]()
@ -2043,4 +2041,4 @@ void cellSync_init(Module *pxThis)
fix_relocs(cellSync, libsre, 0x31EE0, 0x3A4F0, 0x2DF00); fix_relocs(cellSync, libsre, 0x31EE0, 0x3A4F0, 0x2DF00);
}); });
#endif #endif
} });

View file

@ -5,7 +5,7 @@
#include "cellSync2.h" #include "cellSync2.h"
Module* cellSync2 = nullptr; extern Module cellSync2;
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
#include "prx_libsync2.h" #include "prx_libsync2.h"
@ -16,10 +16,10 @@ u32 libsync2_rtoc;
s64 _cellSync2MutexAttributeInitialize(vm::ptr<CellSync2MutexAttribute> attr, u32 sdkVersion) s64 _cellSync2MutexAttributeInitialize(vm::ptr<CellSync2MutexAttribute> attr, u32 sdkVersion)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x16A0, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x16A0, libsync2_rtoc);
#else #else
cellSync2->Warning("_cellSync2MutexAttributeInitialize(attr_addr=0x%x, sdkVersion=0x%x)", attr.addr(), sdkVersion); cellSync2.Warning("_cellSync2MutexAttributeInitialize(attr_addr=0x%x, sdkVersion=0x%x)", attr.addr(), sdkVersion);
attr->sdkVersion = sdkVersion; attr->sdkVersion = sdkVersion;
attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER | attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER |
@ -36,10 +36,10 @@ s64 _cellSync2MutexAttributeInitialize(vm::ptr<CellSync2MutexAttribute> attr, u3
s64 cellSync2MutexEstimateBufferSize(vm::ptr<const CellSync2MutexAttribute> attr, vm::ptr<u32> bufferSize) s64 cellSync2MutexEstimateBufferSize(vm::ptr<const CellSync2MutexAttribute> attr, vm::ptr<u32> bufferSize)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0xC3C, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0xC3C, libsync2_rtoc);
#else #else
cellSync2->Todo("cellSync2MutexEstimateBufferSize(attr_addr=0x%x, bufferSize_addr=0x%x)", attr.addr(), bufferSize.addr()); cellSync2.Todo("cellSync2MutexEstimateBufferSize(attr_addr=0x%x, bufferSize_addr=0x%x)", attr.addr(), bufferSize.addr());
if (attr->maxWaiters > 32768) if (attr->maxWaiters > 32768)
return CELL_SYNC2_ERROR_INVAL; return CELL_SYNC2_ERROR_INVAL;
@ -51,7 +51,7 @@ s64 cellSync2MutexEstimateBufferSize(vm::ptr<const CellSync2MutexAttribute> attr
s64 cellSync2MutexInitialize() s64 cellSync2MutexInitialize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x1584, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x1584, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -62,7 +62,7 @@ s64 cellSync2MutexInitialize()
s64 cellSync2MutexFinalize() s64 cellSync2MutexFinalize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x142C, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x142C, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -73,7 +73,7 @@ s64 cellSync2MutexFinalize()
s64 cellSync2MutexLock() s64 cellSync2MutexLock()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x1734, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x1734, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -84,7 +84,7 @@ s64 cellSync2MutexLock()
s64 cellSync2MutexTryLock() s64 cellSync2MutexTryLock()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x1A2C, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x1A2C, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -95,7 +95,7 @@ s64 cellSync2MutexTryLock()
s64 cellSync2MutexUnlock() s64 cellSync2MutexUnlock()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x186C, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x186C, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -106,10 +106,10 @@ s64 cellSync2MutexUnlock()
s64 _cellSync2CondAttributeInitialize(vm::ptr<CellSync2CondAttribute> attr, u32 sdkVersion) s64 _cellSync2CondAttributeInitialize(vm::ptr<CellSync2CondAttribute> attr, u32 sdkVersion)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x26DC, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x26DC, libsync2_rtoc);
#else #else
cellSync2->Warning("_cellSync2CondAttributeInitialize(attr_addr=0x%x, sdkVersion=0x%x)", attr.addr(), sdkVersion); cellSync2.Warning("_cellSync2CondAttributeInitialize(attr_addr=0x%x, sdkVersion=0x%x)", attr.addr(), sdkVersion);
attr->sdkVersion = sdkVersion; attr->sdkVersion = sdkVersion;
attr->maxWaiters = 15; attr->maxWaiters = 15;
@ -122,10 +122,10 @@ s64 _cellSync2CondAttributeInitialize(vm::ptr<CellSync2CondAttribute> attr, u32
s64 cellSync2CondEstimateBufferSize(vm::ptr<const CellSync2CondAttribute> attr, vm::ptr<u32> bufferSize) s64 cellSync2CondEstimateBufferSize(vm::ptr<const CellSync2CondAttribute> attr, vm::ptr<u32> bufferSize)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x1B90, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x1B90, libsync2_rtoc);
#else #else
cellSync2->Todo("cellSync2CondEstimateBufferSize(attr_addr=0x%x, bufferSize_addr=0x%x)", attr.addr(), bufferSize.addr()); cellSync2.Todo("cellSync2CondEstimateBufferSize(attr_addr=0x%x, bufferSize_addr=0x%x)", attr.addr(), bufferSize.addr());
if (attr->maxWaiters == 0 || attr->maxWaiters > 32768) if (attr->maxWaiters == 0 || attr->maxWaiters > 32768)
return CELL_SYNC2_ERROR_INVAL; return CELL_SYNC2_ERROR_INVAL;
@ -137,7 +137,7 @@ s64 cellSync2CondEstimateBufferSize(vm::ptr<const CellSync2CondAttribute> attr,
s64 cellSync2CondInitialize() s64 cellSync2CondInitialize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x25DC, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x25DC, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -148,7 +148,7 @@ s64 cellSync2CondInitialize()
s64 cellSync2CondFinalize() s64 cellSync2CondFinalize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x23E0, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x23E0, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -159,7 +159,7 @@ s64 cellSync2CondFinalize()
s64 cellSync2CondWait() s64 cellSync2CondWait()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x283C, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x283C, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -170,7 +170,7 @@ s64 cellSync2CondWait()
s64 cellSync2CondSignal() s64 cellSync2CondSignal()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x2768, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x2768, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -181,7 +181,7 @@ s64 cellSync2CondSignal()
s64 cellSync2CondSignalAll() s64 cellSync2CondSignalAll()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x2910, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x2910, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -192,10 +192,10 @@ s64 cellSync2CondSignalAll()
s64 _cellSync2SemaphoreAttributeInitialize(vm::ptr<CellSync2SemaphoreAttribute> attr, u32 sdkVersion) s64 _cellSync2SemaphoreAttributeInitialize(vm::ptr<CellSync2SemaphoreAttribute> attr, u32 sdkVersion)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x5644, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x5644, libsync2_rtoc);
#else #else
cellSync2->Warning("_cellSync2SemaphoreAttributeInitialize(attr_addr=0x%x, sdkVersion=0x%x)", attr.addr(), sdkVersion); cellSync2.Warning("_cellSync2SemaphoreAttributeInitialize(attr_addr=0x%x, sdkVersion=0x%x)", attr.addr(), sdkVersion);
attr->sdkVersion = sdkVersion; attr->sdkVersion = sdkVersion;
attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER | attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER |
@ -211,10 +211,10 @@ s64 _cellSync2SemaphoreAttributeInitialize(vm::ptr<CellSync2SemaphoreAttribute>
s64 cellSync2SemaphoreEstimateBufferSize(vm::ptr<const CellSync2SemaphoreAttribute> attr, vm::ptr<u32> bufferSize) s64 cellSync2SemaphoreEstimateBufferSize(vm::ptr<const CellSync2SemaphoreAttribute> attr, vm::ptr<u32> bufferSize)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x4AC4, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x4AC4, libsync2_rtoc);
#else #else
cellSync2->Todo("cellSync2SemaphoreEstimateBufferSize(attr_addr=0x%x, bufferSize_addr=0x%x)", attr.addr(), bufferSize.addr()); cellSync2.Todo("cellSync2SemaphoreEstimateBufferSize(attr_addr=0x%x, bufferSize_addr=0x%x)", attr.addr(), bufferSize.addr());
if (attr->maxWaiters == 0 || attr->maxWaiters > 32768) if (attr->maxWaiters == 0 || attr->maxWaiters > 32768)
return CELL_SYNC2_ERROR_INVAL; return CELL_SYNC2_ERROR_INVAL;
@ -226,7 +226,7 @@ s64 cellSync2SemaphoreEstimateBufferSize(vm::ptr<const CellSync2SemaphoreAttribu
s64 cellSync2SemaphoreInitialize() s64 cellSync2SemaphoreInitialize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x54E0, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x54E0, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -237,7 +237,7 @@ s64 cellSync2SemaphoreInitialize()
s64 cellSync2SemaphoreFinalize() s64 cellSync2SemaphoreFinalize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x52F0, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x52F0, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -248,7 +248,7 @@ s64 cellSync2SemaphoreFinalize()
s64 cellSync2SemaphoreAcquire() s64 cellSync2SemaphoreAcquire()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x57A4, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x57A4, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -259,7 +259,7 @@ s64 cellSync2SemaphoreAcquire()
s64 cellSync2SemaphoreTryAcquire() s64 cellSync2SemaphoreTryAcquire()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x56D8, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x56D8, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -270,7 +270,7 @@ s64 cellSync2SemaphoreTryAcquire()
s64 cellSync2SemaphoreRelease() s64 cellSync2SemaphoreRelease()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x5870, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x5870, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -281,7 +281,7 @@ s64 cellSync2SemaphoreRelease()
s64 cellSync2SemaphoreGetCount() s64 cellSync2SemaphoreGetCount()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x4B4C, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x4B4C, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -292,10 +292,10 @@ s64 cellSync2SemaphoreGetCount()
s64 _cellSync2QueueAttributeInitialize(vm::ptr<CellSync2QueueAttribute> attr, u32 sdkVersion) s64 _cellSync2QueueAttributeInitialize(vm::ptr<CellSync2QueueAttribute> attr, u32 sdkVersion)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x3C5C, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x3C5C, libsync2_rtoc);
#else #else
cellSync2->Warning("_cellSync2QueueAttributeInitialize(attr_addr=0x%x, sdkVersion=0x%x)", attr.addr(), sdkVersion); cellSync2.Warning("_cellSync2QueueAttributeInitialize(attr_addr=0x%x, sdkVersion=0x%x)", attr.addr(), sdkVersion);
attr->sdkVersion = sdkVersion; attr->sdkVersion = sdkVersion;
attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER | attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER |
@ -314,10 +314,10 @@ s64 _cellSync2QueueAttributeInitialize(vm::ptr<CellSync2QueueAttribute> attr, u3
s64 cellSync2QueueEstimateBufferSize(vm::ptr<const CellSync2QueueAttribute> attr, vm::ptr<u32> bufferSize) s64 cellSync2QueueEstimateBufferSize(vm::ptr<const CellSync2QueueAttribute> attr, vm::ptr<u32> bufferSize)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x2A98, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x2A98, libsync2_rtoc);
#else #else
cellSync2->Todo("cellSync2QueueEstimateBufferSize(attr_addr=0x%x, bufferSize_addr=0x%x)", attr.addr(), bufferSize.addr()); cellSync2.Todo("cellSync2QueueEstimateBufferSize(attr_addr=0x%x, bufferSize_addr=0x%x)", attr.addr(), bufferSize.addr());
if (attr->elementSize == 0 || attr->elementSize > 16384 || attr->elementSize % 16 || attr->depth == 0 || attr->depth > 4294967292 || if (attr->elementSize == 0 || attr->elementSize > 16384 || attr->elementSize % 16 || attr->depth == 0 || attr->depth > 4294967292 ||
attr->maxPushWaiters > 32768 || attr->maxPopWaiters > 32768) attr->maxPushWaiters > 32768 || attr->maxPopWaiters > 32768)
@ -330,7 +330,7 @@ s64 cellSync2QueueEstimateBufferSize(vm::ptr<const CellSync2QueueAttribute> attr
s64 cellSync2QueueInitialize() s64 cellSync2QueueInitialize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x3F98, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x3F98, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -341,7 +341,7 @@ s64 cellSync2QueueInitialize()
s64 cellSync2QueueFinalize() s64 cellSync2QueueFinalize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x3C28, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x3C28, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -352,7 +352,7 @@ s64 cellSync2QueueFinalize()
s64 cellSync2QueuePush() s64 cellSync2QueuePush()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x478C, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x478C, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -363,7 +363,7 @@ s64 cellSync2QueuePush()
s64 cellSync2QueueTryPush() s64 cellSync2QueueTryPush()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x4680, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x4680, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -374,7 +374,7 @@ s64 cellSync2QueueTryPush()
s64 cellSync2QueuePop() s64 cellSync2QueuePop()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x4974, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x4974, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -385,7 +385,7 @@ s64 cellSync2QueuePop()
s64 cellSync2QueueTryPop() s64 cellSync2QueueTryPop()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x4880, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x4880, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -396,7 +396,7 @@ s64 cellSync2QueueTryPop()
s64 cellSync2QueueGetSize() s64 cellSync2QueueGetSize()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x2C00, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x2C00, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -407,7 +407,7 @@ s64 cellSync2QueueGetSize()
s64 cellSync2QueueGetDepth() s64 cellSync2QueueGetDepth()
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__); cellSync2.Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x2B90, libsync2_rtoc); return GetCurrentPPUThread().FastCall2(libsync2 + 0x2B90, libsync2_rtoc);
#else #else
UNIMPLEMENTED_FUNC(cellSync2); UNIMPLEMENTED_FUNC(cellSync2);
@ -415,45 +415,43 @@ s64 cellSync2QueueGetDepth()
#endif #endif
} }
void cellSync2_init(Module *pxThis) Module cellSync2("cellSync2", []()
{ {
cellSync2 = pxThis; cellSync2.AddFunc(0x55836e73, _cellSync2MutexAttributeInitialize);
cellSync2.AddFunc(0xd51bfae7, cellSync2MutexEstimateBufferSize);
cellSync2.AddFunc(0xeb81a467, cellSync2MutexInitialize);
cellSync2.AddFunc(0x27f2d61c, cellSync2MutexFinalize);
cellSync2.AddFunc(0xa400d82e, cellSync2MutexLock);
cellSync2.AddFunc(0xa69c749c, cellSync2MutexTryLock);
cellSync2.AddFunc(0x0080fe88, cellSync2MutexUnlock);
cellSync2->AddFunc(0x55836e73, _cellSync2MutexAttributeInitialize); cellSync2.AddFunc(0xdf3c532a, _cellSync2CondAttributeInitialize);
cellSync2->AddFunc(0xd51bfae7, cellSync2MutexEstimateBufferSize); cellSync2.AddFunc(0x5b1e4d7a, cellSync2CondEstimateBufferSize);
cellSync2->AddFunc(0xeb81a467, cellSync2MutexInitialize); cellSync2.AddFunc(0x58be9a0f, cellSync2CondInitialize);
cellSync2->AddFunc(0x27f2d61c, cellSync2MutexFinalize); cellSync2.AddFunc(0x63062249, cellSync2CondFinalize);
cellSync2->AddFunc(0xa400d82e, cellSync2MutexLock); cellSync2.AddFunc(0xbc96d751, cellSync2CondWait);
cellSync2->AddFunc(0xa69c749c, cellSync2MutexTryLock); cellSync2.AddFunc(0x871af804, cellSync2CondSignal);
cellSync2->AddFunc(0x0080fe88, cellSync2MutexUnlock); cellSync2.AddFunc(0x8aae07c2, cellSync2CondSignalAll);
cellSync2->AddFunc(0xdf3c532a, _cellSync2CondAttributeInitialize); cellSync2.AddFunc(0x2d77fe17, _cellSync2SemaphoreAttributeInitialize);
cellSync2->AddFunc(0x5b1e4d7a, cellSync2CondEstimateBufferSize); cellSync2.AddFunc(0x74c2780f, cellSync2SemaphoreEstimateBufferSize);
cellSync2->AddFunc(0x58be9a0f, cellSync2CondInitialize); cellSync2.AddFunc(0xc5dee254, cellSync2SemaphoreInitialize);
cellSync2->AddFunc(0x63062249, cellSync2CondFinalize); cellSync2.AddFunc(0x164843a7, cellSync2SemaphoreFinalize);
cellSync2->AddFunc(0xbc96d751, cellSync2CondWait); cellSync2.AddFunc(0xd1b0d146, cellSync2SemaphoreAcquire);
cellSync2->AddFunc(0x871af804, cellSync2CondSignal); cellSync2.AddFunc(0x5e4b0f87, cellSync2SemaphoreTryAcquire);
cellSync2->AddFunc(0x8aae07c2, cellSync2CondSignalAll); cellSync2.AddFunc(0x0c2983ac, cellSync2SemaphoreRelease);
cellSync2.AddFunc(0x4e2ee031, cellSync2SemaphoreGetCount);
cellSync2->AddFunc(0x2d77fe17, _cellSync2SemaphoreAttributeInitialize); cellSync2.AddFunc(0x5e00d433, _cellSync2QueueAttributeInitialize);
cellSync2->AddFunc(0x74c2780f, cellSync2SemaphoreEstimateBufferSize); cellSync2.AddFunc(0xc08cc0f9, cellSync2QueueEstimateBufferSize);
cellSync2->AddFunc(0xc5dee254, cellSync2SemaphoreInitialize); cellSync2.AddFunc(0xf125e044, cellSync2QueueInitialize);
cellSync2->AddFunc(0x164843a7, cellSync2SemaphoreFinalize); cellSync2.AddFunc(0x6af85cdf, cellSync2QueueFinalize);
cellSync2->AddFunc(0xd1b0d146, cellSync2SemaphoreAcquire); cellSync2.AddFunc(0x7d967d91, cellSync2QueuePush);
cellSync2->AddFunc(0x5e4b0f87, cellSync2SemaphoreTryAcquire); cellSync2.AddFunc(0x7fd479fe, cellSync2QueueTryPush);
cellSync2->AddFunc(0x0c2983ac, cellSync2SemaphoreRelease); cellSync2.AddFunc(0xd83ab0c9, cellSync2QueuePop);
cellSync2->AddFunc(0x4e2ee031, cellSync2SemaphoreGetCount); cellSync2.AddFunc(0x0c9a0ea9, cellSync2QueueTryPop);
cellSync2.AddFunc(0x12f0a27d, cellSync2QueueGetSize);
cellSync2->AddFunc(0x5e00d433, _cellSync2QueueAttributeInitialize); cellSync2.AddFunc(0xf0e1471c, cellSync2QueueGetDepth);
cellSync2->AddFunc(0xc08cc0f9, cellSync2QueueEstimateBufferSize);
cellSync2->AddFunc(0xf125e044, cellSync2QueueInitialize);
cellSync2->AddFunc(0x6af85cdf, cellSync2QueueFinalize);
cellSync2->AddFunc(0x7d967d91, cellSync2QueuePush);
cellSync2->AddFunc(0x7fd479fe, cellSync2QueueTryPush);
cellSync2->AddFunc(0xd83ab0c9, cellSync2QueuePop);
cellSync2->AddFunc(0x0c9a0ea9, cellSync2QueueTryPop);
cellSync2->AddFunc(0x12f0a27d, cellSync2QueueGetSize);
cellSync2->AddFunc(0xf0e1471c, cellSync2QueueGetDepth);
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
CallAfter([]() CallAfter([]()
@ -487,4 +485,4 @@ void cellSync2_init(Module *pxThis)
fix_relocs(cellSync2, libsync2, 0x73A0, 0x95A0, 0x6B90); fix_relocs(cellSync2, libsync2, 0x73A0, 0x95A0, 0x6B90);
}); });
#endif #endif
} });

View file

@ -4,7 +4,7 @@
#include "Emu/SysCalls/ModuleManager.h" #include "Emu/SysCalls/ModuleManager.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
Module *cellSysmodule = nullptr; extern Module cellSysmodule;
enum enum
{ {
@ -139,88 +139,95 @@ const char *getModuleName(int id) {
return "UNKNOWN MODULE"; return "UNKNOWN MODULE";
} }
int cellSysmoduleInitialize() s32 cellSysmoduleInitialize()
{ {
cellSysmodule->Log("cellSysmoduleInitialize()"); cellSysmodule.Warning("cellSysmoduleInitialize()");
return CELL_OK; return CELL_OK;
} }
int cellSysmoduleFinalize() s32 cellSysmoduleFinalize()
{ {
cellSysmodule->Log("cellSysmoduleFinalize()"); cellSysmodule.Warning("cellSysmoduleFinalize()");
return CELL_OK; return CELL_OK;
} }
int cellSysmoduleSetMemcontainer(u32 ct_id) s32 cellSysmoduleSetMemcontainer(u32 ct_id)
{ {
cellSysmodule->Todo("cellSysmoduleSetMemcontainer(ct_id=0x%x)", ct_id); cellSysmodule.Todo("cellSysmoduleSetMemcontainer(ct_id=0x%x)", ct_id);
return CELL_OK; return CELL_OK;
} }
int cellSysmoduleLoadModule(u16 id) s32 cellSysmoduleLoadModule(u16 id)
{ {
cellSysmodule->Warning("cellSysmoduleLoadModule(id=0x%04x: %s)", id, getModuleName(id)); cellSysmodule.Warning("cellSysmoduleLoadModule(id=0x%04x: %s)", id, getModuleName(id));
if (id == 0xf054) if (!Emu.GetModuleManager().CheckModuleId(id))
{ {
cellSysmodule->Todo("cellSysmoduleLoadModule: CELL_SYSMODULE_LIBATRAC3MULTI"); cellSysmodule.Error("cellSysmoduleLoadModule() failed: unknown module (id=0x%04x)", id);
return CELL_SYSMODULE_ERROR_UNKNOWN;
} }
if (Module* m = Emu.GetModuleManager().GetModuleById(id)) if (Module* m = Emu.GetModuleManager().GetModuleById(id))
{ {
// CELL_SYSMODULE_ERROR_DUPLICATED shouldn't be returned (it breaks some games) // CELL_SYSMODULE_ERROR_DUPLICATED shouldn't be returned
// If some game requires it yet, there probably should be a configurable hack or something.
m->Load(); m->Load();
}
return CELL_OK; return CELL_OK;
} }
else
{
return CELL_SYSMODULE_ERROR_UNKNOWN;
}
}
int cellSysmoduleUnloadModule(u16 id) s32 cellSysmoduleUnloadModule(u16 id)
{ {
cellSysmodule->Warning("cellSysmoduleUnloadModule(id=0x%04x: %s)", id, getModuleName(id)); cellSysmodule.Warning("cellSysmoduleUnloadModule(id=0x%04x: %s)", id, getModuleName(id));
Module* m = Emu.GetModuleManager().GetModuleById(id); if (!Emu.GetModuleManager().CheckModuleId(id))
if(!m)
{ {
cellSysmodule.Error("cellSysmoduleUnloadModule() failed: unknown module (id=0x%04x)", id);
return CELL_SYSMODULE_ERROR_UNKNOWN; return CELL_SYSMODULE_ERROR_UNKNOWN;
} }
if (Module* m = Emu.GetModuleManager().GetModuleById(id))
{
if (!m->IsLoaded()) if (!m->IsLoaded())
{ {
return CELL_SYSMODULE_ERROR_UNLOADED; cellSysmodule.Error("cellSysmoduleUnloadModule() failed: module not loaded (id=0x%04x)", id);
return CELL_SYSMODULE_ERROR_FATAL;
}
m->Unload();
} }
m->UnLoad();
return CELL_OK; return CELL_OK;
} }
int cellSysmoduleIsLoaded(u16 id) s32 cellSysmoduleIsLoaded(u16 id)
{ {
cellSysmodule->Warning("cellSysmoduleIsLoaded(id=0x%04x: %s)", id, getModuleName(id)); cellSysmodule.Warning("cellSysmoduleIsLoaded(id=0x%04x: %s)", id, getModuleName(id));
Module* m = Emu.GetModuleManager().GetModuleById(id); if (!Emu.GetModuleManager().CheckModuleId(id))
if(!m)
{ {
cellSysmodule.Error("cellSysmoduleIsLoaded() failed: unknown module (id=0x%04x)", id);
return CELL_SYSMODULE_ERROR_UNKNOWN; return CELL_SYSMODULE_ERROR_UNKNOWN;
} }
return m->IsLoaded() ? CELL_SYSMODULE_LOADED : CELL_SYSMODULE_ERROR_UNLOADED; if (Module* m = Emu.GetModuleManager().GetModuleById(id))
}
void cellSysmodule_init(Module *pxThis)
{ {
cellSysmodule = pxThis; if (!m->IsLoaded())
{
cellSysmodule->AddFunc(0x63ff6ff9, cellSysmoduleInitialize); cellSysmodule.Error("cellSysmoduleIsLoaded() failed: module not loaded (id=0x%04x)", id);
cellSysmodule->AddFunc(0x96c07adf, cellSysmoduleFinalize); return CELL_SYSMODULE_ERROR_UNLOADED;
cellSysmodule->AddFunc(0xa193143c, cellSysmoduleSetMemcontainer);
cellSysmodule->AddFunc(0x32267a31, cellSysmoduleLoadModule);
cellSysmodule->AddFunc(0x112a5ee9, cellSysmoduleUnloadModule);
cellSysmodule->AddFunc(0x5a59e258, cellSysmoduleIsLoaded);
} }
}
return CELL_SYSMODULE_LOADED;
}
Module cellSysmodule("cellSysmodule", []()
{
cellSysmodule.AddFunc(0x63ff6ff9, cellSysmoduleInitialize);
cellSysmodule.AddFunc(0x96c07adf, cellSysmoduleFinalize);
cellSysmodule.AddFunc(0xa193143c, cellSysmoduleSetMemcontainer);
cellSysmodule.AddFunc(0x32267a31, cellSysmoduleLoadModule);
cellSysmodule.AddFunc(0x112a5ee9, cellSysmoduleUnloadModule);
cellSysmodule.AddFunc(0x5a59e258, cellSysmoduleIsLoaded);
});

View file

@ -21,86 +21,86 @@
typedef void (CellHddGameStatCallback)(vm::ptr<CellHddGameCBResult> cbResult, vm::ptr<CellHddGameStatGet> get, vm::ptr<CellHddGameStatSet> set); typedef void (CellHddGameStatCallback)(vm::ptr<CellHddGameCBResult> cbResult, vm::ptr<CellHddGameStatGet> get, vm::ptr<CellHddGameStatSet> set);
Module *cellSysutil = nullptr; extern Module cellSysutil;
int cellSysutilGetSystemParamInt(int id, vm::ptr<u32> value) int cellSysutilGetSystemParamInt(int id, vm::ptr<u32> value)
{ {
cellSysutil->Log("cellSysutilGetSystemParamInt(id=0x%x, value_addr=0x%x)", id, value.addr()); cellSysutil.Log("cellSysutilGetSystemParamInt(id=0x%x, value_addr=0x%x)", id, value.addr());
switch(id) switch(id)
{ {
case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG: case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_LANG"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_LANG");
*value = Ini.SysLanguage.GetValue(); *value = Ini.SysLanguage.GetValue();
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN: case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN");
*value = CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS; *value = CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT: case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT");
*value = CELL_SYSUTIL_DATE_FMT_DDMMYYYY; *value = CELL_SYSUTIL_DATE_FMT_DDMMYYYY;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT: case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT");
*value = CELL_SYSUTIL_TIME_FMT_CLOCK24; *value = CELL_SYSUTIL_TIME_FMT_CLOCK24;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE: case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE");
*value = 3; *value = 3;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME: case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME");
*value = 1; *value = 1;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL: case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL");
*value = CELL_SYSUTIL_GAME_PARENTAL_OFF; *value = CELL_SYSUTIL_GAME_PARENTAL_OFF;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT: case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT");
*value = CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF; *value = CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT: case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT");
*value = 0; *value = 0;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ: case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ");
*value = CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED; *value = CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE: case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE");
*value = CELL_SYSUTIL_PAD_RUMBLE_OFF; *value = CELL_SYSUTIL_PAD_RUMBLE_OFF;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE: case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE");
*value = 0; *value = 0;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD: case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD");
*value = 0; *value = 0;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD: case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD");
*value = 0; *value = 0;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF: case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF:
cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF");
*value = 0; *value = 0;
break; break;
@ -113,19 +113,19 @@ int cellSysutilGetSystemParamInt(int id, vm::ptr<u32> value)
int cellSysutilGetSystemParamString(s32 id, vm::ptr<char> buf, u32 bufsize) int cellSysutilGetSystemParamString(s32 id, vm::ptr<char> buf, u32 bufsize)
{ {
cellSysutil->Log("cellSysutilGetSystemParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.addr(), bufsize); cellSysutil.Log("cellSysutilGetSystemParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.addr(), bufsize);
memset(buf.get_ptr(), 0, bufsize); memset(buf.get_ptr(), 0, bufsize);
switch(id) switch(id)
{ {
case CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME: case CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME:
cellSysutil->Warning("cellSysutilGetSystemParamString: CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME"); cellSysutil.Warning("cellSysutilGetSystemParamString: CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME");
memcpy(buf.get_ptr(), "Unknown", 8); // for example memcpy(buf.get_ptr(), "Unknown", 8); // for example
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME: case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME:
cellSysutil->Warning("cellSysutilGetSystemParamString: CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME"); cellSysutil.Warning("cellSysutilGetSystemParamString: CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME");
memcpy(buf.get_ptr(), "Unknown", 8); memcpy(buf.get_ptr(), "Unknown", 8);
break; break;
@ -138,7 +138,7 @@ int cellSysutilGetSystemParamString(s32 id, vm::ptr<char> buf, u32 bufsize)
int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, vm::ptr<CellVideoOutState> state) int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, vm::ptr<CellVideoOutState> state)
{ {
cellSysutil->Log("cellVideoOutGetState(videoOut=0x%x, deviceIndex=0x%x, state_addr=0x%x)", videoOut, deviceIndex, state.addr()); cellSysutil.Log("cellVideoOutGetState(videoOut=0x%x, deviceIndex=0x%x, state_addr=0x%x)", videoOut, deviceIndex, state.addr());
if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND;
@ -164,7 +164,7 @@ int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, vm::ptr<CellVideoOutStat
int cellVideoOutGetResolution(u32 resolutionId, vm::ptr<CellVideoOutResolution> resolution) int cellVideoOutGetResolution(u32 resolutionId, vm::ptr<CellVideoOutResolution> resolution)
{ {
cellSysutil->Log("cellVideoOutGetResolution(resolutionId=%d, resolution_addr=0x%x)", cellSysutil.Log("cellVideoOutGetResolution(resolutionId=%d, resolution_addr=0x%x)",
resolutionId, resolution.addr()); resolutionId, resolution.addr());
u32 num = ResolutionIdToNum(resolutionId); u32 num = ResolutionIdToNum(resolutionId);
@ -179,7 +179,7 @@ int cellVideoOutGetResolution(u32 resolutionId, vm::ptr<CellVideoOutResolution>
s32 cellVideoOutConfigure(u32 videoOut, vm::ptr<CellVideoOutConfiguration> config, vm::ptr<CellVideoOutOption> option, u32 waitForEvent) s32 cellVideoOutConfigure(u32 videoOut, vm::ptr<CellVideoOutConfiguration> config, vm::ptr<CellVideoOutOption> option, u32 waitForEvent)
{ {
cellSysutil->Warning("cellVideoOutConfigure(videoOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=0x%x)", cellSysutil.Warning("cellVideoOutConfigure(videoOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=0x%x)",
videoOut, config.addr(), option.addr(), waitForEvent); videoOut, config.addr(), option.addr(), waitForEvent);
switch(videoOut) switch(videoOut)
@ -213,7 +213,7 @@ s32 cellVideoOutConfigure(u32 videoOut, vm::ptr<CellVideoOutConfiguration> confi
int cellVideoOutGetConfiguration(u32 videoOut, vm::ptr<CellVideoOutConfiguration> config, vm::ptr<CellVideoOutOption> option) int cellVideoOutGetConfiguration(u32 videoOut, vm::ptr<CellVideoOutConfiguration> config, vm::ptr<CellVideoOutOption> option)
{ {
cellSysutil->Warning("cellVideoOutGetConfiguration(videoOut=%d, config_addr=0x%x, option_addr=0x%x)", cellSysutil.Warning("cellVideoOutGetConfiguration(videoOut=%d, config_addr=0x%x, option_addr=0x%x)",
videoOut, config.addr(), option.addr()); videoOut, config.addr(), option.addr());
if (option) *option = {}; if (option) *option = {};
@ -239,7 +239,7 @@ int cellVideoOutGetConfiguration(u32 videoOut, vm::ptr<CellVideoOutConfiguration
int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, vm::ptr<CellVideoOutDeviceInfo> info) int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, vm::ptr<CellVideoOutDeviceInfo> info)
{ {
cellSysutil->Warning("cellVideoOutGetDeviceInfo(videoOut=%d, deviceIndex=%d, info_addr=0x%x)", cellSysutil.Warning("cellVideoOutGetDeviceInfo(videoOut=%d, deviceIndex=%d, info_addr=0x%x)",
videoOut, deviceIndex, info.addr()); videoOut, deviceIndex, info.addr());
if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND;
@ -271,7 +271,7 @@ int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, vm::ptr<CellVideoOu
int cellVideoOutGetNumberOfDevice(u32 videoOut) int cellVideoOutGetNumberOfDevice(u32 videoOut)
{ {
cellSysutil->Warning("cellVideoOutGetNumberOfDevice(videoOut=%d)", videoOut); cellSysutil.Warning("cellVideoOutGetNumberOfDevice(videoOut=%d)", videoOut);
switch(videoOut) switch(videoOut)
{ {
@ -284,7 +284,7 @@ int cellVideoOutGetNumberOfDevice(u32 videoOut)
int cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, u32 aspect, u32 option) int cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, u32 aspect, u32 option)
{ {
cellSysutil->Warning("cellVideoOutGetResolutionAvailability(videoOut=%d, resolutionId=0x%x, aspect=%d, option=%d)", videoOut, resolutionId, aspect, option); cellSysutil.Warning("cellVideoOutGetResolutionAvailability(videoOut=%d, resolutionId=0x%x, aspect=%d, option=%d)", videoOut, resolutionId, aspect, option);
if (!Ini.GS3DTV.GetValue() && (resolutionId == CELL_VIDEO_OUT_RESOLUTION_720_3D_FRAME_PACKING || resolutionId == CELL_VIDEO_OUT_RESOLUTION_1024x720_3D_FRAME_PACKING || if (!Ini.GS3DTV.GetValue() && (resolutionId == CELL_VIDEO_OUT_RESOLUTION_720_3D_FRAME_PACKING || resolutionId == CELL_VIDEO_OUT_RESOLUTION_1024x720_3D_FRAME_PACKING ||
resolutionId == CELL_VIDEO_OUT_RESOLUTION_960x720_3D_FRAME_PACKING || resolutionId == CELL_VIDEO_OUT_RESOLUTION_800x720_3D_FRAME_PACKING || resolutionId == CELL_VIDEO_OUT_RESOLUTION_960x720_3D_FRAME_PACKING || resolutionId == CELL_VIDEO_OUT_RESOLUTION_800x720_3D_FRAME_PACKING ||
@ -325,7 +325,7 @@ void sysutilSendSystemCommand(u64 status, u64 param)
s32 cellSysutilCheckCallback(PPUThread& CPU) s32 cellSysutilCheckCallback(PPUThread& CPU)
{ {
cellSysutil->Log("cellSysutilCheckCallback()"); cellSysutil.Log("cellSysutilCheckCallback()");
s32 res; s32 res;
u32 count = 0; u32 count = 0;
@ -336,7 +336,7 @@ s32 cellSysutilCheckCallback(PPUThread& CPU)
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
cellSysutil->Warning("cellSysutilCheckCallback() aborted"); cellSysutil.Warning("cellSysutilCheckCallback() aborted");
return CELL_OK; return CELL_OK;
} }
@ -356,7 +356,7 @@ s32 cellSysutilCheckCallback(PPUThread& CPU)
s32 cellSysutilRegisterCallback(s32 slot, vm::ptr<CellSysutilCallback> func, vm::ptr<void> userdata) s32 cellSysutilRegisterCallback(s32 slot, vm::ptr<CellSysutilCallback> func, vm::ptr<void> userdata)
{ {
cellSysutil->Warning("cellSysutilRegisterCallback(slot=%d, func_addr=0x%x, userdata=0x%x)", slot, func.addr(), userdata.addr()); cellSysutil.Warning("cellSysutilRegisterCallback(slot=%d, func_addr=0x%x, userdata=0x%x)", slot, func.addr(), userdata.addr());
if ((u32)slot > 3) if ((u32)slot > 3)
{ {
@ -370,7 +370,7 @@ s32 cellSysutilRegisterCallback(s32 slot, vm::ptr<CellSysutilCallback> func, vm:
s32 cellSysutilUnregisterCallback(s32 slot) s32 cellSysutilUnregisterCallback(s32 slot)
{ {
cellSysutil->Warning("cellSysutilUnregisterCallback(slot=%d)", slot); cellSysutil.Warning("cellSysutilUnregisterCallback(slot=%d)", slot);
if ((u32)slot > 3) if ((u32)slot > 3)
{ {
@ -384,7 +384,7 @@ s32 cellSysutilUnregisterCallback(s32 slot)
int cellAudioOutGetSoundAvailability(u32 audioOut, u32 type, u32 fs, u32 option) int cellAudioOutGetSoundAvailability(u32 audioOut, u32 type, u32 fs, u32 option)
{ {
cellSysutil->Warning("cellAudioOutGetSoundAvailability(audioOut=%d, type=%d, fs=0x%x, option=%d)", cellSysutil.Warning("cellAudioOutGetSoundAvailability(audioOut=%d, type=%d, fs=0x%x, option=%d)",
audioOut, type, fs, option); audioOut, type, fs, option);
option = 0; option = 0;
@ -425,7 +425,7 @@ int cellAudioOutGetSoundAvailability(u32 audioOut, u32 type, u32 fs, u32 option)
int cellAudioOutGetSoundAvailability2(u32 audioOut, u32 type, u32 fs, u32 ch, u32 option) int cellAudioOutGetSoundAvailability2(u32 audioOut, u32 type, u32 fs, u32 ch, u32 option)
{ {
cellSysutil->Warning("cellAudioOutGetSoundAvailability2(audioOut=%d, type=%d, fs=0x%x, ch=%d, option=%d)", cellSysutil.Warning("cellAudioOutGetSoundAvailability2(audioOut=%d, type=%d, fs=0x%x, ch=%d, option=%d)",
audioOut, type, fs, ch, option); audioOut, type, fs, ch, option);
option = 0; option = 0;
@ -475,7 +475,7 @@ int cellAudioOutGetSoundAvailability2(u32 audioOut, u32 type, u32 fs, u32 ch, u3
int cellAudioOutGetState(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutState> state) int cellAudioOutGetState(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutState> state)
{ {
cellSysutil->Warning("cellAudioOutGetState(audioOut=0x%x, deviceIndex=0x%x, state_addr=0x%x)", audioOut, deviceIndex, state.addr()); cellSysutil.Warning("cellAudioOutGetState(audioOut=0x%x, deviceIndex=0x%x, state_addr=0x%x)", audioOut, deviceIndex, state.addr());
*state = {}; *state = {};
@ -504,7 +504,7 @@ int cellAudioOutGetState(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutStat
int cellAudioOutConfigure(u32 audioOut, vm::ptr<CellAudioOutConfiguration> config, vm::ptr<CellAudioOutOption> option, u32 waitForEvent) int cellAudioOutConfigure(u32 audioOut, vm::ptr<CellAudioOutConfiguration> config, vm::ptr<CellAudioOutOption> option, u32 waitForEvent)
{ {
cellSysutil->Warning("cellAudioOutConfigure(audioOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=%d)", cellSysutil.Warning("cellAudioOutConfigure(audioOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=%d)",
audioOut, config.addr(), option.addr(), waitForEvent); audioOut, config.addr(), option.addr(), waitForEvent);
switch(audioOut) switch(audioOut)
@ -533,7 +533,7 @@ int cellAudioOutConfigure(u32 audioOut, vm::ptr<CellAudioOutConfiguration> confi
int cellAudioOutGetConfiguration(u32 audioOut, vm::ptr<CellAudioOutConfiguration> config, vm::ptr<CellAudioOutOption> option) int cellAudioOutGetConfiguration(u32 audioOut, vm::ptr<CellAudioOutConfiguration> config, vm::ptr<CellAudioOutOption> option)
{ {
cellSysutil->Warning("cellAudioOutGetConfiguration(audioOut=%d, config_addr=0x%x, option_addr=0x%x)", audioOut, config.addr(), option.addr()); cellSysutil.Warning("cellAudioOutGetConfiguration(audioOut=%d, config_addr=0x%x, option_addr=0x%x)", audioOut, config.addr(), option.addr());
if (option) *option = {}; if (option) *option = {};
*config = {}; *config = {};
@ -557,7 +557,7 @@ int cellAudioOutGetConfiguration(u32 audioOut, vm::ptr<CellAudioOutConfiguration
int cellAudioOutGetNumberOfDevice(u32 audioOut) int cellAudioOutGetNumberOfDevice(u32 audioOut)
{ {
cellSysutil->Warning("cellAudioOutGetNumberOfDevice(audioOut=%d)", audioOut); cellSysutil.Warning("cellAudioOutGetNumberOfDevice(audioOut=%d)", audioOut);
switch(audioOut) switch(audioOut)
{ {
@ -570,7 +570,7 @@ int cellAudioOutGetNumberOfDevice(u32 audioOut)
int cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutDeviceInfo> info) int cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutDeviceInfo> info)
{ {
cellSysutil->Todo("cellAudioOutGetDeviceInfo(audioOut=%d, deviceIndex=%d, info_addr=0x%x)", audioOut, deviceIndex, info.addr()); cellSysutil.Todo("cellAudioOutGetDeviceInfo(audioOut=%d, deviceIndex=%d, info_addr=0x%x)", audioOut, deviceIndex, info.addr());
if(deviceIndex) return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND; if(deviceIndex) return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND;
@ -588,7 +588,7 @@ int cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOu
int cellAudioOutSetCopyControl(u32 audioOut, u32 control) int cellAudioOutSetCopyControl(u32 audioOut, u32 control)
{ {
cellSysutil->Warning("cellAudioOutSetCopyControl(audioOut=%d,control=%d)",audioOut,control); cellSysutil.Warning("cellAudioOutSetCopyControl(audioOut=%d,control=%d)",audioOut,control);
switch(audioOut) switch(audioOut)
{ {
@ -628,7 +628,7 @@ typedef struct{
// virtual wxDirTraverseResult OnFile(const wxString& filename) // virtual wxDirTraverseResult OnFile(const wxString& filename)
// { // {
// if (!wxRemoveFile(filename)){ // if (!wxRemoveFile(filename)){
// cellSysutil->Error("Couldn't delete File: %s", fmt::ToUTF8(filename).c_str()); // cellSysutil.Error("Couldn't delete File: %s", fmt::ToUTF8(filename).c_str());
// } // }
// return wxDIR_CONTINUE; // return wxDIR_CONTINUE;
// } // }
@ -647,7 +647,7 @@ typedef struct{
int cellSysCacheClear(void) int cellSysCacheClear(void)
{ {
cellSysutil->Warning("cellSysCacheClear()"); cellSysutil.Warning("cellSysCacheClear()");
//if some software expects CELL_SYSCACHE_ERROR_NOTMOUNTED we need to check whether //if some software expects CELL_SYSCACHE_ERROR_NOTMOUNTED we need to check whether
//it was mounted before, for that we would need to save the state which I don't know //it was mounted before, for that we would need to save the state which I don't know
@ -676,7 +676,7 @@ int cellSysCacheClear(void)
int cellSysCacheMount(vm::ptr<CellSysCacheParam> param) int cellSysCacheMount(vm::ptr<CellSysCacheParam> param)
{ {
cellSysutil->Warning("cellSysCacheMount(param_addr=0x%x)", param.addr()); cellSysutil.Warning("cellSysCacheMount(param_addr=0x%x)", param.addr());
//TODO: implement //TODO: implement
char id[CELL_SYSCACHE_ID_SIZE]; char id[CELL_SYSCACHE_ID_SIZE];
@ -690,7 +690,7 @@ int cellSysCacheMount(vm::ptr<CellSysCacheParam> param)
int cellHddGameCheck(u32 version, vm::ptr<const char> dirName, u32 errDialog, vm::ptr<CellHddGameStatCallback> funcStat, u32 container) int cellHddGameCheck(u32 version, vm::ptr<const char> dirName, u32 errDialog, vm::ptr<CellHddGameStatCallback> funcStat, u32 container)
{ {
cellSysutil->Warning("cellHddGameCheck(version=%d, dirName_addr=0x%x, errDialog=%d, funcStat_addr=0x%x, container=%d)", cellSysutil.Warning("cellHddGameCheck(version=%d, dirName_addr=0x%x, errDialog=%d, funcStat_addr=0x%x, container=%d)",
version, dirName.addr(), errDialog, funcStat.addr(), container); version, dirName.addr(), errDialog, funcStat.addr(), container);
std::string dir = dirName.get_ptr(); std::string dir = dirName.get_ptr();
@ -762,7 +762,7 @@ bool bgm_playback_enabled = true;
int cellSysutilEnableBgmPlayback() int cellSysutilEnableBgmPlayback()
{ {
cellSysutil->Warning("cellSysutilEnableBgmPlayback()"); cellSysutil.Warning("cellSysutilEnableBgmPlayback()");
// TODO // TODO
bgm_playback_enabled = true; bgm_playback_enabled = true;
@ -772,7 +772,7 @@ int cellSysutilEnableBgmPlayback()
int cellSysutilEnableBgmPlaybackEx(vm::ptr<CellSysutilBgmPlaybackExtraParam> param) int cellSysutilEnableBgmPlaybackEx(vm::ptr<CellSysutilBgmPlaybackExtraParam> param)
{ {
cellSysutil->Warning("cellSysutilEnableBgmPlaybackEx(param_addr=0x%x)", param.addr()); cellSysutil.Warning("cellSysutilEnableBgmPlaybackEx(param_addr=0x%x)", param.addr());
// TODO // TODO
bgm_playback_enabled = true; bgm_playback_enabled = true;
@ -782,7 +782,7 @@ int cellSysutilEnableBgmPlaybackEx(vm::ptr<CellSysutilBgmPlaybackExtraParam> par
int cellSysutilDisableBgmPlayback() int cellSysutilDisableBgmPlayback()
{ {
cellSysutil->Warning("cellSysutilDisableBgmPlayback()"); cellSysutil.Warning("cellSysutilDisableBgmPlayback()");
// TODO // TODO
bgm_playback_enabled = false; bgm_playback_enabled = false;
@ -792,7 +792,7 @@ int cellSysutilDisableBgmPlayback()
int cellSysutilDisableBgmPlaybackEx(vm::ptr<CellSysutilBgmPlaybackExtraParam> param) int cellSysutilDisableBgmPlaybackEx(vm::ptr<CellSysutilBgmPlaybackExtraParam> param)
{ {
cellSysutil->Warning("cellSysutilDisableBgmPlaybackEx(param_addr=0x%x)", param.addr()); cellSysutil.Warning("cellSysutilDisableBgmPlaybackEx(param_addr=0x%x)", param.addr());
// TODO // TODO
bgm_playback_enabled = false; bgm_playback_enabled = false;
@ -802,7 +802,7 @@ int cellSysutilDisableBgmPlaybackEx(vm::ptr<CellSysutilBgmPlaybackExtraParam> pa
int cellSysutilGetBgmPlaybackStatus(vm::ptr<CellSysutilBgmPlaybackStatus> status) int cellSysutilGetBgmPlaybackStatus(vm::ptr<CellSysutilBgmPlaybackStatus> status)
{ {
cellSysutil->Log("cellSysutilGetBgmPlaybackStatus(status_addr=0x%x)", status.addr()); cellSysutil.Log("cellSysutilGetBgmPlaybackStatus(status_addr=0x%x)", status.addr());
// TODO // TODO
status->playerState = CELL_SYSUTIL_BGMPLAYBACK_STATUS_STOP; status->playerState = CELL_SYSUTIL_BGMPLAYBACK_STATUS_STOP;
@ -816,7 +816,7 @@ int cellSysutilGetBgmPlaybackStatus(vm::ptr<CellSysutilBgmPlaybackStatus> status
int cellSysutilGetBgmPlaybackStatus2(vm::ptr<CellSysutilBgmPlaybackStatus2> status2) int cellSysutilGetBgmPlaybackStatus2(vm::ptr<CellSysutilBgmPlaybackStatus2> status2)
{ {
cellSysutil->Log("cellSysutilGetBgmPlaybackStatus2(status2_addr=0x%x)", status2.addr()); cellSysutil.Log("cellSysutilGetBgmPlaybackStatus2(status2_addr=0x%x)", status2.addr());
// TODO // TODO
status2->playerState = CELL_SYSUTIL_BGMPLAYBACK_STATUS_STOP; status2->playerState = CELL_SYSUTIL_BGMPLAYBACK_STATUS_STOP;
@ -827,7 +827,7 @@ int cellSysutilGetBgmPlaybackStatus2(vm::ptr<CellSysutilBgmPlaybackStatus2> stat
int cellWebBrowserEstimate2(const vm::ptr<const CellWebBrowserConfig2> config, vm::ptr<u32> memSize) int cellWebBrowserEstimate2(const vm::ptr<const CellWebBrowserConfig2> config, vm::ptr<u32> memSize)
{ {
cellSysutil->Warning("cellWebBrowserEstimate2(config_addr=0x%x, memSize_addr=0x%x)", config.addr(), memSize.addr()); cellSysutil.Warning("cellWebBrowserEstimate2(config_addr=0x%x, memSize_addr=0x%x)", config.addr(), memSize.addr());
// TODO: When cellWebBrowser stuff is implemented, change this to some real // TODO: When cellWebBrowser stuff is implemented, change this to some real
// needed memory buffer size. // needed memory buffer size.
@ -843,77 +843,72 @@ extern int cellGameDataCheckCreate(PPUThread& CPU, u32 version, vm::ptr<const ch
extern void cellSysutil_SaveData_init(); extern void cellSysutil_SaveData_init();
void cellSysutil_init(Module *pxThis) Module cellSysutil("cellSysutil", []()
{
cellSysutil = pxThis;
cellSysutil->AddFunc(0x40e895d3, cellSysutilGetSystemParamInt);
cellSysutil->AddFunc(0x938013a0, cellSysutilGetSystemParamString);
cellSysutil->AddFunc(0x887572d5, cellVideoOutGetState);
cellSysutil->AddFunc(0xe558748d, cellVideoOutGetResolution);
cellSysutil->AddFunc(0x0bae8772, cellVideoOutConfigure);
cellSysutil->AddFunc(0x15b0b0cd, cellVideoOutGetConfiguration);
cellSysutil->AddFunc(0x1e930eef, cellVideoOutGetDeviceInfo);
cellSysutil->AddFunc(0x75bbb672, cellVideoOutGetNumberOfDevice);
cellSysutil->AddFunc(0xa322db75, cellVideoOutGetResolutionAvailability);
cellSysutil->AddFunc(0x189a74da, cellSysutilCheckCallback);
cellSysutil->AddFunc(0x9d98afa0, cellSysutilRegisterCallback);
cellSysutil->AddFunc(0x02ff3c1b, cellSysutilUnregisterCallback);
cellSysutil->AddFunc(0x7603d3db, cellMsgDialogOpen2);
cellSysutil->AddFunc(0x3e22cb4b, cellMsgDialogOpenErrorCode);
cellSysutil->AddFunc(0x9d6af72a, cellMsgDialogProgressBarSetMsg);
cellSysutil->AddFunc(0x7bc2c8a8, cellMsgDialogProgressBarReset);
cellSysutil->AddFunc(0x94862702, cellMsgDialogProgressBarInc);
cellSysutil->AddFunc(0x20543730, cellMsgDialogClose);
cellSysutil->AddFunc(0x62b0f803, cellMsgDialogAbort);
cellSysutil->AddFunc(0xf4e3caa0, cellAudioOutGetState);
cellSysutil->AddFunc(0x4692ab35, cellAudioOutConfigure);
cellSysutil->AddFunc(0xc01b4e7c, cellAudioOutGetSoundAvailability);
cellSysutil->AddFunc(0x2beac488, cellAudioOutGetSoundAvailability2);
cellSysutil->AddFunc(0x7663e368, cellAudioOutGetDeviceInfo);
cellSysutil->AddFunc(0xe5e2b09d, cellAudioOutGetNumberOfDevice);
cellSysutil->AddFunc(0xed5d96af, cellAudioOutGetConfiguration);
cellSysutil->AddFunc(0xc96e89e9, cellAudioOutSetCopyControl);
cellSysutil->AddFunc(0xa11552f6, cellSysutilGetBgmPlaybackStatus);
cellSysutil->AddFunc(0x6cfd856f, cellSysutilGetBgmPlaybackStatus2);
cellSysutil->AddFunc(0x220894e3, cellSysutilEnableBgmPlayback);
cellSysutil->AddFunc(0xac58ad2b, cellSysutilEnableBgmPlaybackEx);
cellSysutil->AddFunc(0xcfdd8e87, cellSysutilDisableBgmPlayback);
cellSysutil->AddFunc(0xa36335a5, cellSysutilDisableBgmPlaybackEx);
cellSysutil->AddFunc(0x1e7bff94, cellSysCacheMount);
cellSysutil->AddFunc(0x744c1544, cellSysCacheClear);
cellSysutil->AddFunc(0x9117df20, cellHddGameCheck);
//cellSysutil->AddFunc(0x4bdec82a, cellHddGameCheck2);
//cellSysutil->AddFunc(0xf82e2ef7, cellHddGameGetSizeKB);
//cellSysutil->AddFunc(0x9ca9ffa7, cellHddGameSetSystemVer);
//cellSysutil->AddFunc(0xafd605b3, cellHddGameExitBroken);
//cellSysutil->AddFunc(0x886D0747, cellSysutilRegisterCallbackDispatcher);
//cellSysutil->AddFunc(0xA2720DF2, cellSysutilPacketWrite);
//cellSysutil->AddFunc(0x75AA7373, doc.write);
//cellSysutil->AddFunc(0x2D96313F, packet_read);
// cellSaveData functions
cellSysutil_SaveData_init();
cellSysutil->AddFunc(0x6d087930, cellWebBrowserEstimate2);
cellSysutil->AddFunc(0xe7951dee, cellGameDataCheckCreate);
cellSysutil->AddFunc(0xc9645c41, cellGameDataCheckCreate2);
}
void cellSysutil_load()
{ {
for (auto& v : g_sys_callback) for (auto& v : g_sys_callback)
{ {
v.func.set(0); v.func.set(0);
v.arg.set(0); v.arg.set(0);
} }
}
cellSysutil.AddFunc(0x40e895d3, cellSysutilGetSystemParamInt);
cellSysutil.AddFunc(0x938013a0, cellSysutilGetSystemParamString);
cellSysutil.AddFunc(0x887572d5, cellVideoOutGetState);
cellSysutil.AddFunc(0xe558748d, cellVideoOutGetResolution);
cellSysutil.AddFunc(0x0bae8772, cellVideoOutConfigure);
cellSysutil.AddFunc(0x15b0b0cd, cellVideoOutGetConfiguration);
cellSysutil.AddFunc(0x1e930eef, cellVideoOutGetDeviceInfo);
cellSysutil.AddFunc(0x75bbb672, cellVideoOutGetNumberOfDevice);
cellSysutil.AddFunc(0xa322db75, cellVideoOutGetResolutionAvailability);
cellSysutil.AddFunc(0x189a74da, cellSysutilCheckCallback);
cellSysutil.AddFunc(0x9d98afa0, cellSysutilRegisterCallback);
cellSysutil.AddFunc(0x02ff3c1b, cellSysutilUnregisterCallback);
cellSysutil.AddFunc(0x7603d3db, cellMsgDialogOpen2);
cellSysutil.AddFunc(0x3e22cb4b, cellMsgDialogOpenErrorCode);
cellSysutil.AddFunc(0x9d6af72a, cellMsgDialogProgressBarSetMsg);
cellSysutil.AddFunc(0x7bc2c8a8, cellMsgDialogProgressBarReset);
cellSysutil.AddFunc(0x94862702, cellMsgDialogProgressBarInc);
cellSysutil.AddFunc(0x20543730, cellMsgDialogClose);
cellSysutil.AddFunc(0x62b0f803, cellMsgDialogAbort);
cellSysutil.AddFunc(0xf4e3caa0, cellAudioOutGetState);
cellSysutil.AddFunc(0x4692ab35, cellAudioOutConfigure);
cellSysutil.AddFunc(0xc01b4e7c, cellAudioOutGetSoundAvailability);
cellSysutil.AddFunc(0x2beac488, cellAudioOutGetSoundAvailability2);
cellSysutil.AddFunc(0x7663e368, cellAudioOutGetDeviceInfo);
cellSysutil.AddFunc(0xe5e2b09d, cellAudioOutGetNumberOfDevice);
cellSysutil.AddFunc(0xed5d96af, cellAudioOutGetConfiguration);
cellSysutil.AddFunc(0xc96e89e9, cellAudioOutSetCopyControl);
cellSysutil.AddFunc(0xa11552f6, cellSysutilGetBgmPlaybackStatus);
cellSysutil.AddFunc(0x6cfd856f, cellSysutilGetBgmPlaybackStatus2);
cellSysutil.AddFunc(0x220894e3, cellSysutilEnableBgmPlayback);
cellSysutil.AddFunc(0xac58ad2b, cellSysutilEnableBgmPlaybackEx);
cellSysutil.AddFunc(0xcfdd8e87, cellSysutilDisableBgmPlayback);
cellSysutil.AddFunc(0xa36335a5, cellSysutilDisableBgmPlaybackEx);
cellSysutil.AddFunc(0x1e7bff94, cellSysCacheMount);
cellSysutil.AddFunc(0x744c1544, cellSysCacheClear);
cellSysutil.AddFunc(0x9117df20, cellHddGameCheck);
//cellSysutil.AddFunc(0x4bdec82a, cellHddGameCheck2);
//cellSysutil.AddFunc(0xf82e2ef7, cellHddGameGetSizeKB);
//cellSysutil.AddFunc(0x9ca9ffa7, cellHddGameSetSystemVer);
//cellSysutil.AddFunc(0xafd605b3, cellHddGameExitBroken);
//cellSysutil.AddFunc(0x886D0747, cellSysutilRegisterCallbackDispatcher);
//cellSysutil.AddFunc(0xA2720DF2, cellSysutilPacketWrite);
//cellSysutil.AddFunc(0x75AA7373, doc.write);
//cellSysutil.AddFunc(0x2D96313F, packet_read);
// cellSaveData functions
cellSysutil_SaveData_init();
cellSysutil.AddFunc(0x6d087930, cellWebBrowserEstimate2);
cellSysutil.AddFunc(0xe7951dee, cellGameDataCheckCreate);
cellSysutil.AddFunc(0xc9645c41, cellGameDataCheckCreate2);
});

View file

@ -2,7 +2,7 @@
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
Module *cellSysutilAp = nullptr; extern Module cellSysutilAp;
// Return Codes // Return Codes
enum enum
@ -19,7 +19,7 @@ enum
s32 cellSysutilApGetRequiredMemSize() s32 cellSysutilApGetRequiredMemSize()
{ {
cellSysutilAp->Log("cellSysutilApGetRequiredMemSize()"); cellSysutilAp.Log("cellSysutilApGetRequiredMemSize()");
return 1024*1024; // Return 1 MB as required size return 1024*1024; // Return 1 MB as required size
} }
@ -35,11 +35,9 @@ int cellSysutilApOff()
return CELL_OK; return CELL_OK;
} }
void cellSysutilAp_init(Module *pxThis) Module cellSysutilAp("cellSysutilAp", []()
{ {
cellSysutilAp = pxThis; cellSysutilAp.AddFunc(0x9e67e0dd, cellSysutilApGetRequiredMemSize);
cellSysutilAp.AddFunc(0x3343824c, cellSysutilApOn);
cellSysutilAp->AddFunc(0x9e67e0dd, cellSysutilApGetRequiredMemSize); cellSysutilAp.AddFunc(0x90c2bb19, cellSysutilApOff);
cellSysutilAp->AddFunc(0x3343824c, cellSysutilApOn); });
cellSysutilAp->AddFunc(0x90c2bb19, cellSysutilApOff);
}

View file

@ -7,11 +7,11 @@
#include "Emu/FS/vfsFileBase.h" #include "Emu/FS/vfsFileBase.h"
#include "cellUserInfo.h" #include "cellUserInfo.h"
Module *cellUserInfo = nullptr; extern Module cellUserInfo;
int cellUserInfoGetStat(u32 id, vm::ptr<CellUserInfoUserStat> stat) int cellUserInfoGetStat(u32 id, vm::ptr<CellUserInfoUserStat> stat)
{ {
cellUserInfo->Warning("cellUserInfoGetStat(id=%d, stat_addr=0x%x)", id, stat.addr()); cellUserInfo.Warning("cellUserInfoGetStat(id=%d, stat_addr=0x%x)", id, stat.addr());
if (id > CELL_USERINFO_USER_MAX) if (id > CELL_USERINFO_USER_MAX)
return CELL_USERINFO_ERROR_NOUSER; return CELL_USERINFO_ERROR_NOUSER;
@ -57,7 +57,7 @@ int cellUserInfoEnableOverlay()
int cellUserInfoGetList(vm::ptr<u32> listNum, vm::ptr<CellUserInfoUserList> listBuf, vm::ptr<u32> currentUserId) int cellUserInfoGetList(vm::ptr<u32> listNum, vm::ptr<CellUserInfoUserList> listBuf, vm::ptr<u32> currentUserId)
{ {
cellUserInfo->Warning("cellUserInfoGetList(listNum_addr=0x%x, listBuf_addr=0x%x, currentUserId_addr=0x%x)", cellUserInfo.Warning("cellUserInfoGetList(listNum_addr=0x%x, listBuf_addr=0x%x, currentUserId_addr=0x%x)",
listNum.addr(), listBuf.addr(), currentUserId.addr()); listNum.addr(), listBuf.addr(), currentUserId.addr());
// If only listNum is NULL, an error will be returned // If only listNum is NULL, an error will be returned
@ -74,13 +74,11 @@ int cellUserInfoGetList(vm::ptr<u32> listNum, vm::ptr<CellUserInfoUserList> list
return CELL_OK; return CELL_OK;
} }
void cellUserInfo_init(Module *pxThis) Module cellUserInfo("cellUserInfo", []()
{ {
cellUserInfo = pxThis; cellUserInfo.AddFunc(0x2b761140, cellUserInfoGetStat);
cellUserInfo.AddFunc(0x3097cc1c, cellUserInfoSelectUser_ListType);
cellUserInfo->AddFunc(0x2b761140, cellUserInfoGetStat); cellUserInfo.AddFunc(0x55123a25, cellUserInfoSelectUser_SetList);
cellUserInfo->AddFunc(0x3097cc1c, cellUserInfoSelectUser_ListType); cellUserInfo.AddFunc(0xb3516536, cellUserInfoEnableOverlay);
cellUserInfo->AddFunc(0x55123a25, cellUserInfoSelectUser_SetList); cellUserInfo.AddFunc(0xc55e338b, cellUserInfoGetList);
cellUserInfo->AddFunc(0xb3516536, cellUserInfoEnableOverlay); });
cellUserInfo->AddFunc(0xc55e338b, cellUserInfoGetList);
}

View file

@ -17,9 +17,9 @@ extern "C"
#include "cellPamf.h" #include "cellPamf.h"
#include "cellVdec.h" #include "cellVdec.h"
Module *cellVdec = nullptr; extern Module cellVdec;
#define VDEC_ERROR(...) { cellVdec->Error(__VA_ARGS__); Emu.Pause(); return; } // only for decoder thread #define VDEC_ERROR(...) { cellVdec.Error(__VA_ARGS__); Emu.Pause(); return; } // only for decoder thread
VideoDecoder::VideoDecoder(CellVdecCodecType type, u32 profile, u32 addr, u32 size, vm::ptr<CellVdecCbMsg> func, u32 arg) VideoDecoder::VideoDecoder(CellVdecCodecType type, u32 profile, u32 addr, u32 size, vm::ptr<CellVdecCbMsg> func, u32 arg)
: type(type) : type(type)
@ -126,7 +126,7 @@ next:
VdecTask task; VdecTask task;
if (!vdec.job.peek(task, 0, &vdec.is_closed)) if (!vdec.job.peek(task, 0, &vdec.is_closed))
{ {
if (Emu.IsStopped()) cellVdec->Warning("vdecRead() aborted"); if (Emu.IsStopped()) cellVdec.Warning("vdecRead() aborted");
return 0; return 0;
} }
@ -159,7 +159,7 @@ next:
default: default:
{ {
cellVdec->Error("vdecRead(): unknown task (%d)", task.type); cellVdec.Error("vdecRead(): unknown task (%d)", task.type);
Emu.Pause(); Emu.Pause();
return -1; return -1;
} }
@ -190,9 +190,9 @@ u32 vdecQueryAttr(CellVdecCodecType type, u32 profile, u32 spec_addr /* may be 0
{ {
switch (type) // TODO: check profile levels switch (type) // TODO: check profile levels
{ {
case CELL_VDEC_CODEC_TYPE_AVC: cellVdec->Warning("cellVdecQueryAttr: AVC (profile=%d)", profile); break; case CELL_VDEC_CODEC_TYPE_AVC: cellVdec.Warning("cellVdecQueryAttr: AVC (profile=%d)", profile); break;
case CELL_VDEC_CODEC_TYPE_MPEG2: cellVdec->Warning("cellVdecQueryAttr: MPEG2 (profile=%d)", profile); break; case CELL_VDEC_CODEC_TYPE_MPEG2: cellVdec.Warning("cellVdecQueryAttr: MPEG2 (profile=%d)", profile); break;
case CELL_VDEC_CODEC_TYPE_DIVX: cellVdec->Warning("cellVdecQueryAttr: DivX (profile=%d)", profile); break; case CELL_VDEC_CODEC_TYPE_DIVX: cellVdec.Warning("cellVdecQueryAttr: DivX (profile=%d)", profile); break;
default: return CELL_VDEC_ERROR_ARG; default: return CELL_VDEC_ERROR_ARG;
} }
@ -209,7 +209,7 @@ u32 vdecOpen(VideoDecoder* vdec_ptr)
std::shared_ptr<VideoDecoder> sptr(vdec_ptr); std::shared_ptr<VideoDecoder> sptr(vdec_ptr);
VideoDecoder& vdec = *vdec_ptr; VideoDecoder& vdec = *vdec_ptr;
u32 vdec_id = cellVdec->GetNewId(sptr); u32 vdec_id = cellVdec.GetNewId(sptr);
vdec.id = vdec_id; vdec.id = vdec_id;
@ -244,7 +244,7 @@ u32 vdecOpen(VideoDecoder* vdec_ptr)
case vdecStartSeq: case vdecStartSeq:
{ {
// TODO: reset data // TODO: reset data
cellVdec->Warning("vdecStartSeq:"); cellVdec.Warning("vdecStartSeq:");
vdec.reader = {}; vdec.reader = {};
vdec.frc_set = 0; vdec.frc_set = 0;
@ -255,7 +255,7 @@ u32 vdecOpen(VideoDecoder* vdec_ptr)
case vdecEndSeq: case vdecEndSeq:
{ {
// TODO: finalize // TODO: finalize
cellVdec->Warning("vdecEndSeq:"); cellVdec.Warning("vdecEndSeq:");
vdec.cbFunc(*vdec.vdecCb, vdec.id, CELL_VDEC_MSG_TYPE_SEQDONE, CELL_OK, vdec.cbArg); vdec.cbFunc(*vdec.vdecCb, vdec.id, CELL_VDEC_MSG_TYPE_SEQDONE, CELL_OK, vdec.cbArg);
@ -269,7 +269,7 @@ u32 vdecOpen(VideoDecoder* vdec_ptr)
if (task.mode != CELL_VDEC_DEC_MODE_NORMAL) if (task.mode != CELL_VDEC_DEC_MODE_NORMAL)
{ {
cellVdec->Error("vdecDecodeAu: unsupported decoding mode(%d)", task.mode); cellVdec.Error("vdecDecodeAu: unsupported decoding mode(%d)", task.mode);
break; break;
} }
@ -364,7 +364,7 @@ u32 vdecOpen(VideoDecoder* vdec_ptr)
{ {
if (Emu.IsStopped() || vdec.is_closed) if (Emu.IsStopped() || vdec.is_closed)
{ {
if (Emu.IsStopped()) cellVdec->Warning("vdecDecodeAu: aborted"); if (Emu.IsStopped()) cellVdec.Warning("vdecDecodeAu: aborted");
break; break;
} }
@ -408,7 +408,7 @@ u32 vdecOpen(VideoDecoder* vdec_ptr)
{ {
if (decode < 0) if (decode < 0)
{ {
cellVdec->Error("vdecDecodeAu: AU decoding error(0x%x)", decode); cellVdec.Error("vdecDecodeAu: AU decoding error(0x%x)", decode);
} }
if (!got_picture && vdec.reader.size == 0) break; // video end? if (!got_picture && vdec.reader.size == 0) break; // video end?
} }
@ -533,7 +533,7 @@ u32 vdecOpen(VideoDecoder* vdec_ptr)
case vdecSetFrameRate: case vdecSetFrameRate:
{ {
cellVdec->Warning("vdecSetFrameRate(0x%x)", task.frc); cellVdec.Warning("vdecSetFrameRate(0x%x)", task.frc);
vdec.frc_set = task.frc; vdec.frc_set = task.frc;
break; break;
} }
@ -558,21 +558,21 @@ u32 vdecOpen(VideoDecoder* vdec_ptr)
int cellVdecQueryAttr(vm::ptr<const CellVdecType> type, vm::ptr<CellVdecAttr> attr) int cellVdecQueryAttr(vm::ptr<const CellVdecType> type, vm::ptr<CellVdecAttr> attr)
{ {
cellVdec->Warning("cellVdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.addr(), attr.addr()); cellVdec.Warning("cellVdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.addr(), attr.addr());
return vdecQueryAttr(type->codecType, type->profileLevel, 0, attr); return vdecQueryAttr(type->codecType, type->profileLevel, 0, attr);
} }
int cellVdecQueryAttrEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<CellVdecAttr> attr) int cellVdecQueryAttrEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<CellVdecAttr> attr)
{ {
cellVdec->Warning("cellVdecQueryAttrEx(type_addr=0x%x, attr_addr=0x%x)", type.addr(), attr.addr()); cellVdec.Warning("cellVdecQueryAttrEx(type_addr=0x%x, attr_addr=0x%x)", type.addr(), attr.addr());
return vdecQueryAttr(type->codecType, type->profileLevel, type->codecSpecificInfo_addr, attr); return vdecQueryAttr(type->codecType, type->profileLevel, type->codecSpecificInfo_addr, attr);
} }
int cellVdecOpen(vm::ptr<const CellVdecType> type, vm::ptr<const CellVdecResource> res, vm::ptr<const CellVdecCb> cb, vm::ptr<u32> handle) int cellVdecOpen(vm::ptr<const CellVdecType> type, vm::ptr<const CellVdecResource> res, vm::ptr<const CellVdecCb> cb, vm::ptr<u32> handle)
{ {
cellVdec->Warning("cellVdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", cellVdec.Warning("cellVdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
type.addr(), res.addr(), cb.addr(), handle.addr()); type.addr(), res.addr(), cb.addr(), handle.addr());
*handle = vdecOpen(new VideoDecoder(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc.to_le(), cb->cbArg)); *handle = vdecOpen(new VideoDecoder(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc.to_le(), cb->cbArg));
@ -582,7 +582,7 @@ int cellVdecOpen(vm::ptr<const CellVdecType> type, vm::ptr<const CellVdecResourc
int cellVdecOpenEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<const CellVdecResourceEx> res, vm::ptr<const CellVdecCb> cb, vm::ptr<u32> handle) int cellVdecOpenEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<const CellVdecResourceEx> res, vm::ptr<const CellVdecCb> cb, vm::ptr<u32> handle)
{ {
cellVdec->Warning("cellVdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", cellVdec.Warning("cellVdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
type.addr(), res.addr(), cb.addr(), handle.addr()); type.addr(), res.addr(), cb.addr(), handle.addr());
*handle = vdecOpen(new VideoDecoder(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc.to_le(), cb->cbArg)); *handle = vdecOpen(new VideoDecoder(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc.to_le(), cb->cbArg));
@ -592,7 +592,7 @@ int cellVdecOpenEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<const CellVdecRes
int cellVdecClose(u32 handle) int cellVdecClose(u32 handle)
{ {
cellVdec->Warning("cellVdecClose(handle=%d)", handle); cellVdec.Warning("cellVdecClose(handle=%d)", handle);
std::shared_ptr<VideoDecoder> vdec; std::shared_ptr<VideoDecoder> vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec)) if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -607,7 +607,7 @@ int cellVdecClose(u32 handle)
{ {
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
cellVdec->Warning("cellVdecClose(%d) aborted", handle); cellVdec.Warning("cellVdecClose(%d) aborted", handle);
break; break;
} }
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
@ -620,7 +620,7 @@ int cellVdecClose(u32 handle)
int cellVdecStartSeq(u32 handle) int cellVdecStartSeq(u32 handle)
{ {
cellVdec->Log("cellVdecStartSeq(handle=%d)", handle); cellVdec.Log("cellVdecStartSeq(handle=%d)", handle);
std::shared_ptr<VideoDecoder> vdec; std::shared_ptr<VideoDecoder> vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec)) if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -634,7 +634,7 @@ int cellVdecStartSeq(u32 handle)
int cellVdecEndSeq(u32 handle) int cellVdecEndSeq(u32 handle)
{ {
cellVdec->Warning("cellVdecEndSeq(handle=%d)", handle); cellVdec.Warning("cellVdecEndSeq(handle=%d)", handle);
std::shared_ptr<VideoDecoder> vdec; std::shared_ptr<VideoDecoder> vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec)) if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -648,7 +648,7 @@ int cellVdecEndSeq(u32 handle)
int cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, vm::ptr<const CellVdecAuInfo> auInfo) int cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, vm::ptr<const CellVdecAuInfo> auInfo)
{ {
cellVdec->Log("cellVdecDecodeAu(handle=%d, mode=0x%x, auInfo_addr=0x%x)", handle, mode, auInfo.addr()); cellVdec.Log("cellVdecDecodeAu(handle=%d, mode=0x%x, auInfo_addr=0x%x)", handle, mode, auInfo.addr());
std::shared_ptr<VideoDecoder> vdec; std::shared_ptr<VideoDecoder> vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec)) if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -672,7 +672,7 @@ int cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, vm::ptr<const CellVdec
int cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::ptr<u8> outBuff) int cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::ptr<u8> outBuff)
{ {
cellVdec->Log("cellVdecGetPicture(handle=%d, format_addr=0x%x, outBuff_addr=0x%x)", handle, format.addr(), outBuff.addr()); cellVdec.Log("cellVdecGetPicture(handle=%d, format_addr=0x%x, outBuff_addr=0x%x)", handle, format.addr(), outBuff.addr());
std::shared_ptr<VideoDecoder> vdec; std::shared_ptr<VideoDecoder> vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec)) if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -703,12 +703,12 @@ int cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::
{ {
if (format->formatType != CELL_VDEC_PICFMT_YUV420_PLANAR) if (format->formatType != CELL_VDEC_PICFMT_YUV420_PLANAR)
{ {
cellVdec->Fatal("cellVdecGetPicture: unknown formatType(%d)", format->formatType); cellVdec.Fatal("cellVdecGetPicture: unknown formatType(%d)", format->formatType);
} }
if (format->colorMatrixType != CELL_VDEC_COLOR_MATRIX_TYPE_BT709) if (format->colorMatrixType != CELL_VDEC_COLOR_MATRIX_TYPE_BT709)
{ {
cellVdec->Fatal("cellVdecGetPicture: unknown colorMatrixType(%d)", format->colorMatrixType); cellVdec.Fatal("cellVdecGetPicture: unknown colorMatrixType(%d)", format->colorMatrixType);
} }
const u32 buf_size = align(av_image_get_buffer_size(vdec->ctx->pix_fmt, vdec->ctx->width, vdec->ctx->height, 1), 128); const u32 buf_size = align(av_image_get_buffer_size(vdec->ctx->pix_fmt, vdec->ctx->width, vdec->ctx->height, 1), 128);
@ -718,7 +718,7 @@ int cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::
int err = av_image_copy_to_buffer(outBuff.get_ptr(), buf_size, frame->data, frame->linesize, vdec->ctx->pix_fmt, frame->width, frame->height, 1); int err = av_image_copy_to_buffer(outBuff.get_ptr(), buf_size, frame->data, frame->linesize, vdec->ctx->pix_fmt, frame->width, frame->height, 1);
if (err < 0) if (err < 0)
{ {
cellVdec->Fatal("cellVdecGetPicture: av_image_copy_to_buffer failed (err=0x%x)", err); cellVdec.Fatal("cellVdecGetPicture: av_image_copy_to_buffer failed (err=0x%x)", err);
} }
} }
@ -727,7 +727,7 @@ int cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::
int cellVdecGetPicItem(u32 handle, vm::ptr<u32> picItem_ptr) int cellVdecGetPicItem(u32 handle, vm::ptr<u32> picItem_ptr)
{ {
cellVdec->Log("cellVdecGetPicItem(handle=%d, picItem_ptr_addr=0x%x)", handle, picItem_ptr.addr()); cellVdec.Log("cellVdecGetPicItem(handle=%d, picItem_ptr_addr=0x%x)", handle, picItem_ptr.addr());
std::shared_ptr<VideoDecoder> vdec; std::shared_ptr<VideoDecoder> vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec)) if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -781,7 +781,7 @@ int cellVdecGetPicItem(u32 handle, vm::ptr<u32> picItem_ptr)
case AV_PICTURE_TYPE_I: avc->pictureType[0] = CELL_VDEC_AVC_PCT_I; break; case AV_PICTURE_TYPE_I: avc->pictureType[0] = CELL_VDEC_AVC_PCT_I; break;
case AV_PICTURE_TYPE_P: avc->pictureType[0] = CELL_VDEC_AVC_PCT_P; break; case AV_PICTURE_TYPE_P: avc->pictureType[0] = CELL_VDEC_AVC_PCT_P; break;
case AV_PICTURE_TYPE_B: avc->pictureType[0] = CELL_VDEC_AVC_PCT_B; break; case AV_PICTURE_TYPE_B: avc->pictureType[0] = CELL_VDEC_AVC_PCT_B; break;
default: cellVdec->Error("cellVdecGetPicItem(AVC): unknown pict_type value (0x%x)", frame.pict_type); default: cellVdec.Error("cellVdecGetPicItem(AVC): unknown pict_type value (0x%x)", frame.pict_type);
} }
avc->pictureType[1] = CELL_VDEC_AVC_PCT_UNKNOWN; // ??? avc->pictureType[1] = CELL_VDEC_AVC_PCT_UNKNOWN; // ???
avc->idrPictureFlag = false; // ??? avc->idrPictureFlag = false; // ???
@ -812,7 +812,7 @@ int cellVdecGetPicItem(u32 handle, vm::ptr<u32> picItem_ptr)
case CELL_VDEC_FRC_50: avc->frameRateCode = CELL_VDEC_AVC_FRC_50; break; case CELL_VDEC_FRC_50: avc->frameRateCode = CELL_VDEC_AVC_FRC_50; break;
case CELL_VDEC_FRC_60000DIV1001: avc->frameRateCode = CELL_VDEC_AVC_FRC_60000DIV1001; break; case CELL_VDEC_FRC_60000DIV1001: avc->frameRateCode = CELL_VDEC_AVC_FRC_60000DIV1001; break;
case CELL_VDEC_FRC_60: avc->frameRateCode = CELL_VDEC_AVC_FRC_60; break; case CELL_VDEC_FRC_60: avc->frameRateCode = CELL_VDEC_AVC_FRC_60; break;
default: cellVdec->Error("cellVdecGetPicItem(AVC): unknown frc value (0x%x)", vf.frc); default: cellVdec.Error("cellVdecGetPicItem(AVC): unknown frc value (0x%x)", vf.frc);
} }
avc->fixed_frame_rate_flag = true; avc->fixed_frame_rate_flag = true;
@ -833,7 +833,7 @@ int cellVdecGetPicItem(u32 handle, vm::ptr<u32> picItem_ptr)
case AV_PICTURE_TYPE_I: dvx->pictureType = CELL_VDEC_DIVX_VCT_I; break; case AV_PICTURE_TYPE_I: dvx->pictureType = CELL_VDEC_DIVX_VCT_I; break;
case AV_PICTURE_TYPE_P: dvx->pictureType = CELL_VDEC_DIVX_VCT_P; break; case AV_PICTURE_TYPE_P: dvx->pictureType = CELL_VDEC_DIVX_VCT_P; break;
case AV_PICTURE_TYPE_B: dvx->pictureType = CELL_VDEC_DIVX_VCT_B; break; case AV_PICTURE_TYPE_B: dvx->pictureType = CELL_VDEC_DIVX_VCT_B; break;
default: cellVdec->Error("cellVdecGetPicItem(DivX): unknown pict_type value (0x%x)", frame.pict_type); default: cellVdec.Error("cellVdecGetPicItem(DivX): unknown pict_type value (0x%x)", frame.pict_type);
} }
dvx->horizontalSize = frame.width; dvx->horizontalSize = frame.width;
dvx->verticalSize = frame.height; dvx->verticalSize = frame.height;
@ -855,14 +855,14 @@ int cellVdecGetPicItem(u32 handle, vm::ptr<u32> picItem_ptr)
case CELL_VDEC_FRC_50: dvx->frameRateCode = CELL_VDEC_DIVX_FRC_50; break; case CELL_VDEC_FRC_50: dvx->frameRateCode = CELL_VDEC_DIVX_FRC_50; break;
case CELL_VDEC_FRC_60000DIV1001: dvx->frameRateCode = CELL_VDEC_DIVX_FRC_60000DIV1001; break; case CELL_VDEC_FRC_60000DIV1001: dvx->frameRateCode = CELL_VDEC_DIVX_FRC_60000DIV1001; break;
case CELL_VDEC_FRC_60: dvx->frameRateCode = CELL_VDEC_DIVX_FRC_60; break; case CELL_VDEC_FRC_60: dvx->frameRateCode = CELL_VDEC_DIVX_FRC_60; break;
default: cellVdec->Error("cellVdecGetPicItem(DivX): unknown frc value (0x%x)", vf.frc); default: cellVdec.Error("cellVdecGetPicItem(DivX): unknown frc value (0x%x)", vf.frc);
} }
} }
else if (vdec->type == CELL_VDEC_CODEC_TYPE_MPEG2) else if (vdec->type == CELL_VDEC_CODEC_TYPE_MPEG2)
{ {
auto mp2 = vm::ptr<CellVdecMpeg2Info>::make(info.addr() + sizeof(CellVdecPicItem)); auto mp2 = vm::ptr<CellVdecMpeg2Info>::make(info.addr() + sizeof(CellVdecPicItem));
cellVdec->Fatal("cellVdecGetPicItem(MPEG2)"); cellVdec.Fatal("cellVdecGetPicItem(MPEG2)");
} }
*picItem_ptr = info.addr(); *picItem_ptr = info.addr();
@ -871,7 +871,7 @@ int cellVdecGetPicItem(u32 handle, vm::ptr<u32> picItem_ptr)
int cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc) int cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc)
{ {
cellVdec->Log("cellVdecSetFrameRate(handle=%d, frc=0x%x)", handle, frc); cellVdec.Log("cellVdecSetFrameRate(handle=%d, frc=0x%x)", handle, frc);
std::shared_ptr<VideoDecoder> vdec; std::shared_ptr<VideoDecoder> vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec)) if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -887,19 +887,17 @@ int cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc)
return CELL_OK; return CELL_OK;
} }
void cellVdec_init(Module *pxThis) Module cellVdec("cellVdec", []()
{ {
cellVdec = pxThis; cellVdec.AddFunc(0xff6f6ebe, cellVdecQueryAttr);
cellVdec.AddFunc(0xc982a84a, cellVdecQueryAttrEx);
cellVdec->AddFunc(0xff6f6ebe, cellVdecQueryAttr); cellVdec.AddFunc(0xb6bbcd5d, cellVdecOpen);
cellVdec->AddFunc(0xc982a84a, cellVdecQueryAttrEx); cellVdec.AddFunc(0x0053e2d8, cellVdecOpenEx);
cellVdec->AddFunc(0xb6bbcd5d, cellVdecOpen); cellVdec.AddFunc(0x16698e83, cellVdecClose);
cellVdec->AddFunc(0x0053e2d8, cellVdecOpenEx); cellVdec.AddFunc(0xc757c2aa, cellVdecStartSeq);
cellVdec->AddFunc(0x16698e83, cellVdecClose); cellVdec.AddFunc(0x824433f0, cellVdecEndSeq);
cellVdec->AddFunc(0xc757c2aa, cellVdecStartSeq); cellVdec.AddFunc(0x2bf4ddd2, cellVdecDecodeAu);
cellVdec->AddFunc(0x824433f0, cellVdecEndSeq); cellVdec.AddFunc(0x807c861a, cellVdecGetPicture);
cellVdec->AddFunc(0x2bf4ddd2, cellVdecDecodeAu); cellVdec.AddFunc(0x17c702b9, cellVdecGetPicItem);
cellVdec->AddFunc(0x807c861a, cellVdecGetPicture); cellVdec.AddFunc(0xe13ef6fc, cellVdecSetFrameRate);
cellVdec->AddFunc(0x17c702b9, cellVdecGetPicItem); });
cellVdec->AddFunc(0xe13ef6fc, cellVdecSetFrameRate);
}

View file

@ -10,11 +10,11 @@ extern "C"
#include "cellVpost.h" #include "cellVpost.h"
Module *cellVpost = nullptr; extern Module cellVpost;
int cellVpostQueryAttr(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<CellVpostAttr> attr) int cellVpostQueryAttr(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<CellVpostAttr> attr)
{ {
cellVpost->Warning("cellVpostQueryAttr(cfgParam_addr=0x%x, attr_addr=0x%x)", cfgParam.addr(), attr.addr()); cellVpost.Warning("cellVpostQueryAttr(cfgParam_addr=0x%x, attr_addr=0x%x)", cfgParam.addr(), attr.addr());
// TODO: check cfgParam and output values // TODO: check cfgParam and output values
@ -29,16 +29,16 @@ int cellVpostQueryAttr(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<CellVp
u32 vpostOpen(VpostInstance* data) u32 vpostOpen(VpostInstance* data)
{ {
std::shared_ptr<VpostInstance> data_ptr(data); std::shared_ptr<VpostInstance> data_ptr(data);
u32 id = cellVpost->GetNewId(data_ptr); u32 id = cellVpost.GetNewId(data_ptr);
cellVpost->Notice("*** Vpost instance created (to_rgba=%d): id = %d", data->to_rgba, id); cellVpost.Notice("*** Vpost instance created (to_rgba=%d): id = %d", data->to_rgba, id);
return id; return id;
} }
int cellVpostOpen(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResource> resource, vm::ptr<u32> handle) int cellVpostOpen(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResource> resource, vm::ptr<u32> handle)
{ {
cellVpost->Warning("cellVpostOpen(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)", cellVpost.Warning("cellVpostOpen(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)",
cfgParam.addr(), resource.addr(), handle.addr()); cfgParam.addr(), resource.addr(), handle.addr());
// TODO: check values // TODO: check values
@ -48,7 +48,7 @@ int cellVpostOpen(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellV
int cellVpostOpenEx(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResourceEx> resource, vm::ptr<u32> handle) int cellVpostOpenEx(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResourceEx> resource, vm::ptr<u32> handle)
{ {
cellVpost->Warning("cellVpostOpenEx(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)", cellVpost.Warning("cellVpostOpenEx(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)",
cfgParam.addr(), resource.addr(), handle.addr()); cfgParam.addr(), resource.addr(), handle.addr());
// TODO: check values // TODO: check values
@ -58,7 +58,7 @@ int cellVpostOpenEx(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const Cel
int cellVpostClose(u32 handle) int cellVpostClose(u32 handle)
{ {
cellVpost->Warning("cellVpostClose(handle=0x%x)", handle); cellVpost.Warning("cellVpostClose(handle=0x%x)", handle);
std::shared_ptr<VpostInstance> vpost; std::shared_ptr<VpostInstance> vpost;
if (!Emu.GetIdManager().GetIDData(handle, vpost)) if (!Emu.GetIdManager().GetIDData(handle, vpost))
@ -73,7 +73,7 @@ int cellVpostClose(u32 handle)
int cellVpostExec(u32 handle, vm::ptr<const u8> inPicBuff, vm::ptr<const CellVpostCtrlParam> ctrlParam, int cellVpostExec(u32 handle, vm::ptr<const u8> inPicBuff, vm::ptr<const CellVpostCtrlParam> ctrlParam,
vm::ptr<u8> outPicBuff, vm::ptr<CellVpostPictureInfo> picInfo) vm::ptr<u8> outPicBuff, vm::ptr<CellVpostPictureInfo> picInfo)
{ {
cellVpost->Log("cellVpostExec(handle=0x%x, inPicBuff_addr=0x%x, ctrlParam_addr=0x%x, outPicBuff_addr=0x%x, picInfo_addr=0x%x)", cellVpost.Log("cellVpostExec(handle=0x%x, inPicBuff_addr=0x%x, ctrlParam_addr=0x%x, outPicBuff_addr=0x%x, picInfo_addr=0x%x)",
handle, inPicBuff.addr(), ctrlParam.addr(), outPicBuff.addr(), picInfo.addr()); handle, inPicBuff.addr(), ctrlParam.addr(), outPicBuff.addr(), picInfo.addr());
std::shared_ptr<VpostInstance> vpost; std::shared_ptr<VpostInstance> vpost;
@ -88,15 +88,15 @@ int cellVpostExec(u32 handle, vm::ptr<const u8> inPicBuff, vm::ptr<const CellVpo
u32 oh = ctrlParam->outHeight; u32 oh = ctrlParam->outHeight;
ctrlParam->inWindow; // ignored ctrlParam->inWindow; // ignored
if (ctrlParam->inWindow.x) cellVpost->Notice("*** inWindow.x = %d", (u32)ctrlParam->inWindow.x); if (ctrlParam->inWindow.x) cellVpost.Notice("*** inWindow.x = %d", (u32)ctrlParam->inWindow.x);
if (ctrlParam->inWindow.y) cellVpost->Notice("*** inWindow.y = %d", (u32)ctrlParam->inWindow.y); if (ctrlParam->inWindow.y) cellVpost.Notice("*** inWindow.y = %d", (u32)ctrlParam->inWindow.y);
if (ctrlParam->inWindow.width != w) cellVpost->Notice("*** inWindow.width = %d", (u32)ctrlParam->inWindow.width); if (ctrlParam->inWindow.width != w) cellVpost.Notice("*** inWindow.width = %d", (u32)ctrlParam->inWindow.width);
if (ctrlParam->inWindow.height != h) cellVpost->Notice("*** inWindow.height = %d", (u32)ctrlParam->inWindow.height); if (ctrlParam->inWindow.height != h) cellVpost.Notice("*** inWindow.height = %d", (u32)ctrlParam->inWindow.height);
ctrlParam->outWindow; // ignored ctrlParam->outWindow; // ignored
if (ctrlParam->outWindow.x) cellVpost->Notice("*** outWindow.x = %d", (u32)ctrlParam->outWindow.x); if (ctrlParam->outWindow.x) cellVpost.Notice("*** outWindow.x = %d", (u32)ctrlParam->outWindow.x);
if (ctrlParam->outWindow.y) cellVpost->Notice("*** outWindow.y = %d", (u32)ctrlParam->outWindow.y); if (ctrlParam->outWindow.y) cellVpost.Notice("*** outWindow.y = %d", (u32)ctrlParam->outWindow.y);
if (ctrlParam->outWindow.width != ow) cellVpost->Notice("*** outWindow.width = %d", (u32)ctrlParam->outWindow.width); if (ctrlParam->outWindow.width != ow) cellVpost.Notice("*** outWindow.width = %d", (u32)ctrlParam->outWindow.width);
if (ctrlParam->outWindow.height != oh) cellVpost->Notice("*** outWindow.height = %d", (u32)ctrlParam->outWindow.height); if (ctrlParam->outWindow.height != oh) cellVpost.Notice("*** outWindow.height = %d", (u32)ctrlParam->outWindow.height);
ctrlParam->execType; // ignored ctrlParam->execType; // ignored
ctrlParam->scalerType; // ignored ctrlParam->scalerType; // ignored
ctrlParam->ipcType; // ignored ctrlParam->ipcType; // ignored
@ -148,13 +148,11 @@ int cellVpostExec(u32 handle, vm::ptr<const u8> inPicBuff, vm::ptr<const CellVpo
return CELL_OK; return CELL_OK;
} }
void cellVpost_init(Module *pxThis) Module cellVpost("cellVpost", []()
{ {
cellVpost = pxThis; cellVpost.AddFunc(0x95e788c3, cellVpostQueryAttr);
cellVpost.AddFunc(0xcd33f3e2, cellVpostOpen);
cellVpost->AddFunc(0x95e788c3, cellVpostQueryAttr); cellVpost.AddFunc(0x40524325, cellVpostOpenEx);
cellVpost->AddFunc(0xcd33f3e2, cellVpostOpen); cellVpost.AddFunc(0x10ef39f6, cellVpostClose);
cellVpost->AddFunc(0x40524325, cellVpostOpenEx); cellVpost.AddFunc(0xabb8cc3d, cellVpostExec);
cellVpost->AddFunc(0x10ef39f6, cellVpostClose); });
cellVpost->AddFunc(0xabb8cc3d, cellVpostExec);
}

View file

@ -8,7 +8,7 @@
#include "cellAudio.h" #include "cellAudio.h"
#include "libmixer.h" #include "libmixer.h"
Module *libmixer = nullptr; extern Module libmixer;
SurMixerConfig g_surmx; SurMixerConfig g_surmx;
vm::ptr<CellSurMixerNotifyCallbackFunction> surMixerCb; vm::ptr<CellSurMixerNotifyCallbackFunction> surMixerCb;
@ -21,7 +21,7 @@ std::vector<SSPlayer> ssp;
int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, vm::ptr<float> addr, u32 samples) int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, vm::ptr<float> addr, u32 samples)
{ {
libmixer->Log("cellAANAddData(handle=%d, port=%d, offset=0x%x, addr_addr=0x%x, samples=%d)", aan_handle, aan_port, offset, addr.addr(), samples); libmixer.Log("cellAANAddData(handle=%d, port=%d, offset=0x%x, addr_addr=0x%x, samples=%d)", aan_handle, aan_port, offset, addr.addr(), samples);
u32 type = aan_port >> 16; u32 type = aan_port >> 16;
u32 port = aan_port & 0xffff; u32 port = aan_port & 0xffff;
@ -42,7 +42,7 @@ int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, vm::ptr<float> addr
if (aan_handle != 0x11111111 || samples != 256 || !type || offset != 0) if (aan_handle != 0x11111111 || samples != 256 || !type || offset != 0)
{ {
libmixer->Error("cellAANAddData(handle=%d, port=%d, offset=0x%x, addr_addr=0x%x, samples=%d): invalid parameters", aan_handle, aan_port, offset, addr.addr(), samples); libmixer.Error("cellAANAddData(handle=%d, port=%d, offset=0x%x, addr_addr=0x%x, samples=%d): invalid parameters", aan_handle, aan_port, offset, addr.addr(), samples);
return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; return CELL_LIBMIXER_ERROR_INVALID_PARAMATER;
} }
@ -102,14 +102,14 @@ int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, vm::ptr<float> addr
int cellAANConnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePortNo) int cellAANConnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePortNo)
{ {
libmixer->Warning("cellAANConnect(receive=%d, receivePortNo=%d, source=%d, sourcePortNo=%d)", libmixer.Warning("cellAANConnect(receive=%d, receivePortNo=%d, source=%d, sourcePortNo=%d)",
receive, receivePortNo, source, sourcePortNo); receive, receivePortNo, source, sourcePortNo);
std::lock_guard<std::mutex> lock(mixer_mutex); std::lock_guard<std::mutex> lock(mixer_mutex);
if (source >= ssp.size() || !ssp[source].m_created) if (source >= ssp.size() || !ssp[source].m_created)
{ {
libmixer->Error("cellAANConnect(): invalid source (%d)", source); libmixer.Error("cellAANConnect(): invalid source (%d)", source);
return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; return CELL_LIBMIXER_ERROR_INVALID_PARAMATER;
} }
@ -120,14 +120,14 @@ int cellAANConnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePortNo)
int cellAANDisconnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePortNo) int cellAANDisconnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePortNo)
{ {
libmixer->Warning("cellAANDisconnect(receive=%d, receivePortNo=%d, source=%d, sourcePortNo=%d)", libmixer.Warning("cellAANDisconnect(receive=%d, receivePortNo=%d, source=%d, sourcePortNo=%d)",
receive, receivePortNo, source, sourcePortNo); receive, receivePortNo, source, sourcePortNo);
std::lock_guard<std::mutex> lock(mixer_mutex); std::lock_guard<std::mutex> lock(mixer_mutex);
if (source >= ssp.size() || !ssp[source].m_created) if (source >= ssp.size() || !ssp[source].m_created)
{ {
libmixer->Error("cellAANDisconnect(): invalid source (%d)", source); libmixer.Error("cellAANDisconnect(): invalid source (%d)", source);
return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; return CELL_LIBMIXER_ERROR_INVALID_PARAMATER;
} }
@ -138,12 +138,12 @@ int cellAANDisconnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePort
int cellSSPlayerCreate(vm::ptr<u32> handle, vm::ptr<CellSSPlayerConfig> config) int cellSSPlayerCreate(vm::ptr<u32> handle, vm::ptr<CellSSPlayerConfig> config)
{ {
libmixer->Warning("cellSSPlayerCreate(handle_addr=0x%x, config_addr=0x%x)", libmixer.Warning("cellSSPlayerCreate(handle_addr=0x%x, config_addr=0x%x)",
handle.addr(), config.addr()); handle.addr(), config.addr());
if (config->outputMode != 0 || config->channels - 1 >= 2) if (config->outputMode != 0 || config->channels - 1 >= 2)
{ {
libmixer->Error("cellSSPlayerCreate(config.outputMode=%d, config.channels=%d): invalid parameters", libmixer.Error("cellSSPlayerCreate(config.outputMode=%d, config.channels=%d): invalid parameters",
(u32)config->outputMode, (u32)config->channels); (u32)config->outputMode, (u32)config->channels);
return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; return CELL_LIBMIXER_ERROR_INVALID_PARAMATER;
} }
@ -163,13 +163,13 @@ int cellSSPlayerCreate(vm::ptr<u32> handle, vm::ptr<CellSSPlayerConfig> config)
int cellSSPlayerRemove(u32 handle) int cellSSPlayerRemove(u32 handle)
{ {
libmixer->Warning("cellSSPlayerRemove(handle=%d)", handle); libmixer.Warning("cellSSPlayerRemove(handle=%d)", handle);
std::lock_guard<std::mutex> lock(mixer_mutex); std::lock_guard<std::mutex> lock(mixer_mutex);
if (handle >= ssp.size() || !ssp[handle].m_created) if (handle >= ssp.size() || !ssp[handle].m_created)
{ {
libmixer->Error("cellSSPlayerRemove(): SSPlayer not found (%d)", handle); libmixer.Error("cellSSPlayerRemove(): SSPlayer not found (%d)", handle);
return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; return CELL_LIBMIXER_ERROR_INVALID_PARAMATER;
} }
@ -182,14 +182,14 @@ int cellSSPlayerRemove(u32 handle)
int cellSSPlayerSetWave(u32 handle, vm::ptr<CellSSPlayerWaveParam> waveInfo, vm::ptr<CellSSPlayerCommonParam> commonInfo) int cellSSPlayerSetWave(u32 handle, vm::ptr<CellSSPlayerWaveParam> waveInfo, vm::ptr<CellSSPlayerCommonParam> commonInfo)
{ {
libmixer->Warning("cellSSPlayerSetWave(handle=%d, waveInfo_addr=0x%x, commonInfo_addr=0x%x)", libmixer.Warning("cellSSPlayerSetWave(handle=%d, waveInfo_addr=0x%x, commonInfo_addr=0x%x)",
handle, waveInfo.addr(), commonInfo.addr()); handle, waveInfo.addr(), commonInfo.addr());
std::lock_guard<std::mutex> lock(mixer_mutex); std::lock_guard<std::mutex> lock(mixer_mutex);
if (handle >= ssp.size() || !ssp[handle].m_created) if (handle >= ssp.size() || !ssp[handle].m_created)
{ {
libmixer->Error("cellSSPlayerSetWave(): SSPlayer not found (%d)", handle); libmixer.Error("cellSSPlayerSetWave(): SSPlayer not found (%d)", handle);
return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; return CELL_LIBMIXER_ERROR_INVALID_PARAMATER;
} }
@ -206,13 +206,13 @@ int cellSSPlayerSetWave(u32 handle, vm::ptr<CellSSPlayerWaveParam> waveInfo, vm:
int cellSSPlayerPlay(u32 handle, vm::ptr<CellSSPlayerRuntimeInfo> info) int cellSSPlayerPlay(u32 handle, vm::ptr<CellSSPlayerRuntimeInfo> info)
{ {
libmixer->Warning("cellSSPlayerPlay(handle=%d, info_addr=0x%x)", handle, info.addr()); libmixer.Warning("cellSSPlayerPlay(handle=%d, info_addr=0x%x)", handle, info.addr());
std::lock_guard<std::mutex> lock(mixer_mutex); std::lock_guard<std::mutex> lock(mixer_mutex);
if (handle >= ssp.size() || !ssp[handle].m_created) if (handle >= ssp.size() || !ssp[handle].m_created)
{ {
libmixer->Error("cellSSPlayerPlay(): SSPlayer not found (%d)", handle); libmixer.Error("cellSSPlayerPlay(): SSPlayer not found (%d)", handle);
return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; return CELL_LIBMIXER_ERROR_INVALID_PARAMATER;
} }
@ -230,13 +230,13 @@ int cellSSPlayerPlay(u32 handle, vm::ptr<CellSSPlayerRuntimeInfo> info)
int cellSSPlayerStop(u32 handle, u32 mode) int cellSSPlayerStop(u32 handle, u32 mode)
{ {
libmixer->Warning("cellSSPlayerStop(handle=%d, mode=0x%x)", handle, mode); libmixer.Warning("cellSSPlayerStop(handle=%d, mode=0x%x)", handle, mode);
std::lock_guard<std::mutex> lock(mixer_mutex); std::lock_guard<std::mutex> lock(mixer_mutex);
if (handle >= ssp.size() || !ssp[handle].m_created) if (handle >= ssp.size() || !ssp[handle].m_created)
{ {
libmixer->Error("cellSSPlayerStop(): SSPlayer not found (%d)", handle); libmixer.Error("cellSSPlayerStop(): SSPlayer not found (%d)", handle);
return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; return CELL_LIBMIXER_ERROR_INVALID_PARAMATER;
} }
@ -249,13 +249,13 @@ int cellSSPlayerStop(u32 handle, u32 mode)
int cellSSPlayerSetParam(u32 handle, vm::ptr<CellSSPlayerRuntimeInfo> info) int cellSSPlayerSetParam(u32 handle, vm::ptr<CellSSPlayerRuntimeInfo> info)
{ {
libmixer->Warning("cellSSPlayerSetParam(handle=%d, info_addr=0x%x)", handle, info.addr()); libmixer.Warning("cellSSPlayerSetParam(handle=%d, info_addr=0x%x)", handle, info.addr());
std::lock_guard<std::mutex> lock(mixer_mutex); std::lock_guard<std::mutex> lock(mixer_mutex);
if (handle >= ssp.size() || !ssp[handle].m_created) if (handle >= ssp.size() || !ssp[handle].m_created)
{ {
libmixer->Error("cellSSPlayerSetParam(): SSPlayer not found (%d)", handle); libmixer.Error("cellSSPlayerSetParam(): SSPlayer not found (%d)", handle);
return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; return CELL_LIBMIXER_ERROR_INVALID_PARAMATER;
} }
@ -272,13 +272,13 @@ int cellSSPlayerSetParam(u32 handle, vm::ptr<CellSSPlayerRuntimeInfo> info)
int cellSSPlayerGetState(u32 handle) int cellSSPlayerGetState(u32 handle)
{ {
libmixer->Warning("cellSSPlayerGetState(handle=%d)", handle); libmixer.Warning("cellSSPlayerGetState(handle=%d)", handle);
std::lock_guard<std::mutex> lock(mixer_mutex); std::lock_guard<std::mutex> lock(mixer_mutex);
if (handle >= ssp.size() || !ssp[handle].m_created) if (handle >= ssp.size() || !ssp[handle].m_created)
{ {
libmixer->Warning("cellSSPlayerGetState(): SSPlayer not found (%d)", handle); libmixer.Warning("cellSSPlayerGetState(): SSPlayer not found (%d)", handle);
return CELL_SSPLAYER_STATE_ERROR; return CELL_SSPLAYER_STATE_ERROR;
} }
@ -292,7 +292,7 @@ int cellSSPlayerGetState(u32 handle)
int cellSurMixerCreate(vm::ptr<const CellSurMixerConfig> config) int cellSurMixerCreate(vm::ptr<const CellSurMixerConfig> config)
{ {
libmixer->Warning("cellSurMixerCreate(config_addr=0x%x)", config.addr()); libmixer.Warning("cellSurMixerCreate(config_addr=0x%x)", config.addr());
g_surmx.audio_port = g_audio.open_port(); g_surmx.audio_port = g_audio.open_port();
@ -315,12 +315,12 @@ int cellSurMixerCreate(vm::ptr<const CellSurMixerConfig> config)
port.level = 1.0f; port.level = 1.0f;
port.tag = 0; port.tag = 0;
libmixer->Warning("*** audio port opened(default)"); libmixer.Warning("*** audio port opened(default)");
mixcount = 0; mixcount = 0;
surMixerCb.set(0); surMixerCb.set(0);
libmixer->Warning("*** surMixer created (ch1=%d, ch2=%d, ch6=%d, ch8=%d)", config->chStrips1, config->chStrips2, config->chStrips6, config->chStrips8); libmixer.Warning("*** surMixer created (ch1=%d, ch2=%d, ch6=%d, ch8=%d)", config->chStrips1, config->chStrips2, config->chStrips6, config->chStrips8);
thread_t t("Surmixer Thread", []() thread_t t("Surmixer Thread", []()
{ {
@ -464,25 +464,25 @@ int cellSurMixerCreate(vm::ptr<const CellSurMixerConfig> config)
int cellSurMixerGetAANHandle(vm::ptr<u32> handle) int cellSurMixerGetAANHandle(vm::ptr<u32> handle)
{ {
libmixer->Warning("cellSurMixerGetAANHandle(handle_addr=0x%x) -> %d", handle.addr(), 0x11111111); libmixer.Warning("cellSurMixerGetAANHandle(handle_addr=0x%x) -> %d", handle.addr(), 0x11111111);
*handle = 0x11111111; *handle = 0x11111111;
return CELL_OK; return CELL_OK;
} }
int cellSurMixerChStripGetAANPortNo(vm::ptr<u32> port, u32 type, u32 index) int cellSurMixerChStripGetAANPortNo(vm::ptr<u32> port, u32 type, u32 index)
{ {
libmixer->Warning("cellSurMixerChStripGetAANPortNo(port_addr=0x%x, type=0x%x, index=0x%x) -> 0x%x", port.addr(), type, index, (type << 16) | index); libmixer.Warning("cellSurMixerChStripGetAANPortNo(port_addr=0x%x, type=0x%x, index=0x%x) -> 0x%x", port.addr(), type, index, (type << 16) | index);
*port = (type << 16) | index; *port = (type << 16) | index;
return CELL_OK; return CELL_OK;
} }
int cellSurMixerSetNotifyCallback(vm::ptr<CellSurMixerNotifyCallbackFunction> func, vm::ptr<void> arg) int cellSurMixerSetNotifyCallback(vm::ptr<CellSurMixerNotifyCallbackFunction> func, vm::ptr<void> arg)
{ {
libmixer->Warning("cellSurMixerSetNotifyCallback(func_addr=0x%x, arg=0x%x)", func.addr(), arg.addr()); libmixer.Warning("cellSurMixerSetNotifyCallback(func_addr=0x%x, arg=0x%x)", func.addr(), arg.addr());
if (surMixerCb) if (surMixerCb)
{ {
libmixer->Error("cellSurMixerSetNotifyCallback: surMixerCb already set (addr=0x%x)", surMixerCb.addr()); libmixer.Error("cellSurMixerSetNotifyCallback: surMixerCb already set (addr=0x%x)", surMixerCb.addr());
} }
surMixerCb = func; surMixerCb = func;
surMixerCbArg = arg; surMixerCbArg = arg;
@ -491,11 +491,11 @@ int cellSurMixerSetNotifyCallback(vm::ptr<CellSurMixerNotifyCallbackFunction> fu
int cellSurMixerRemoveNotifyCallback(vm::ptr<CellSurMixerNotifyCallbackFunction> func) int cellSurMixerRemoveNotifyCallback(vm::ptr<CellSurMixerNotifyCallbackFunction> func)
{ {
libmixer->Warning("cellSurMixerRemoveNotifyCallback(func_addr=0x%x)", func.addr()); libmixer.Warning("cellSurMixerRemoveNotifyCallback(func_addr=0x%x)", func.addr());
if (surMixerCb.addr() != func.addr()) if (surMixerCb.addr() != func.addr())
{ {
libmixer->Error("cellSurMixerRemoveNotifyCallback: surMixerCb had different value (addr=0x%x)", surMixerCb.addr()); libmixer.Error("cellSurMixerRemoveNotifyCallback: surMixerCb had different value (addr=0x%x)", surMixerCb.addr());
} }
else else
{ {
@ -506,7 +506,7 @@ int cellSurMixerRemoveNotifyCallback(vm::ptr<CellSurMixerNotifyCallbackFunction>
int cellSurMixerStart() int cellSurMixerStart()
{ {
libmixer->Warning("cellSurMixerStart()"); libmixer.Warning("cellSurMixerStart()");
if (g_surmx.audio_port >= AUDIO_PORT_COUNT) if (g_surmx.audio_port >= AUDIO_PORT_COUNT)
{ {
@ -520,13 +520,13 @@ int cellSurMixerStart()
int cellSurMixerSetParameter(u32 param, float value) int cellSurMixerSetParameter(u32 param, float value)
{ {
libmixer->Todo("cellSurMixerSetParameter(param=0x%x, value=%f)", param, value); libmixer.Todo("cellSurMixerSetParameter(param=0x%x, value=%f)", param, value);
return CELL_OK; return CELL_OK;
} }
int cellSurMixerFinalize() int cellSurMixerFinalize()
{ {
libmixer->Warning("cellSurMixerFinalize()"); libmixer.Warning("cellSurMixerFinalize()");
if (g_surmx.audio_port >= AUDIO_PORT_COUNT) if (g_surmx.audio_port >= AUDIO_PORT_COUNT)
{ {
@ -542,11 +542,11 @@ int cellSurMixerSurBusAddData(u32 busNo, u32 offset, vm::ptr<float> addr, u32 sa
{ {
if (busNo < 8 && samples == 256 && offset == 0) if (busNo < 8 && samples == 256 && offset == 0)
{ {
libmixer->Log("cellSurMixerSurBusAddData(busNo=%d, offset=0x%x, addr=0x%x, samples=%d)", busNo, offset, addr, samples); libmixer.Log("cellSurMixerSurBusAddData(busNo=%d, offset=0x%x, addr=0x%x, samples=%d)", busNo, offset, addr, samples);
} }
else else
{ {
libmixer->Todo("cellSurMixerSurBusAddData(busNo=%d, offset=0x%x, addr=0x%x, samples=%d)", busNo, offset, addr, samples); libmixer.Todo("cellSurMixerSurBusAddData(busNo=%d, offset=0x%x, addr=0x%x, samples=%d)", busNo, offset, addr, samples);
return CELL_OK; return CELL_OK;
} }
@ -563,13 +563,13 @@ int cellSurMixerSurBusAddData(u32 busNo, u32 offset, vm::ptr<float> addr, u32 sa
int cellSurMixerChStripSetParameter(u32 type, u32 index, vm::ptr<CellSurMixerChStripParam> param) int cellSurMixerChStripSetParameter(u32 type, u32 index, vm::ptr<CellSurMixerChStripParam> param)
{ {
libmixer->Todo("cellSurMixerChStripSetParameter(type=%d, index=%d, param_addr=0x%x)", type, index, param.addr()); libmixer.Todo("cellSurMixerChStripSetParameter(type=%d, index=%d, param_addr=0x%x)", type, index, param.addr());
return CELL_OK; return CELL_OK;
} }
int cellSurMixerPause(u32 type) int cellSurMixerPause(u32 type)
{ {
libmixer->Warning("cellSurMixerPause(type=%d)", type); libmixer.Warning("cellSurMixerPause(type=%d)", type);
if (g_surmx.audio_port >= AUDIO_PORT_COUNT) if (g_surmx.audio_port >= AUDIO_PORT_COUNT)
{ {
@ -583,7 +583,7 @@ int cellSurMixerPause(u32 type)
int cellSurMixerGetCurrentBlockTag(vm::ptr<u64> tag) int cellSurMixerGetCurrentBlockTag(vm::ptr<u64> tag)
{ {
libmixer->Log("cellSurMixerGetCurrentBlockTag(tag_addr=0x%x)", tag.addr()); libmixer.Log("cellSurMixerGetCurrentBlockTag(tag_addr=0x%x)", tag.addr());
*tag = mixcount; *tag = mixcount;
return CELL_OK; return CELL_OK;
@ -591,7 +591,7 @@ int cellSurMixerGetCurrentBlockTag(vm::ptr<u64> tag)
int cellSurMixerGetTimestamp(u64 tag, vm::ptr<u64> stamp) int cellSurMixerGetTimestamp(u64 tag, vm::ptr<u64> stamp)
{ {
libmixer->Log("cellSurMixerGetTimestamp(tag=0x%llx, stamp_addr=0x%x)", tag, stamp.addr()); libmixer.Log("cellSurMixerGetTimestamp(tag=0x%llx, stamp_addr=0x%x)", tag, stamp.addr());
*stamp = g_audio.start_time + (tag) * 256000000 / 48000; // ??? *stamp = g_audio.start_time + (tag) * 256000000 / 48000; // ???
return CELL_OK; return CELL_OK;
@ -599,35 +599,33 @@ int cellSurMixerGetTimestamp(u64 tag, vm::ptr<u64> stamp)
void cellSurMixerBeep(u32 arg) void cellSurMixerBeep(u32 arg)
{ {
libmixer->Todo("cellSurMixerBeep(arg=%d)", arg); libmixer.Todo("cellSurMixerBeep(arg=%d)", arg);
return; return;
} }
float cellSurMixerUtilGetLevelFromDB(float dB) float cellSurMixerUtilGetLevelFromDB(float dB)
{ {
// not hooked, probably unnecessary // not hooked, probably unnecessary
libmixer->Todo("cellSurMixerUtilGetLevelFromDB(dB=%f)", dB); libmixer.Todo("cellSurMixerUtilGetLevelFromDB(dB=%f)", dB);
return 0.0f; return 0.0f;
} }
float cellSurMixerUtilGetLevelFromDBIndex(s32 index) float cellSurMixerUtilGetLevelFromDBIndex(s32 index)
{ {
// not hooked, probably unnecessary // not hooked, probably unnecessary
libmixer->Todo("cellSurMixerUtilGetLevelFromDBIndex(index=%d)", index); libmixer.Todo("cellSurMixerUtilGetLevelFromDBIndex(index=%d)", index);
return 0.0f; return 0.0f;
} }
float cellSurMixerUtilNoteToRatio(u8 refNote, u8 note) float cellSurMixerUtilNoteToRatio(u8 refNote, u8 note)
{ {
// not hooked, probably unnecessary // not hooked, probably unnecessary
libmixer->Todo("cellSurMixerUtilNoteToRatio(refNote=%d, note=%d)", refNote, note); libmixer.Todo("cellSurMixerUtilNoteToRatio(refNote=%d, note=%d)", refNote, note);
return 0.0f; return 0.0f;
} }
void libmixer_init(Module *pxThis) Module libmixer("libmixer", []()
{ {
libmixer = pxThis;
g_surmx.audio_port = ~0; g_surmx.audio_port = ~0;
REG_SUB(libmixer, "surmxAAN", cellAANAddData, REG_SUB(libmixer, "surmxAAN", cellAANAddData,
@ -1195,4 +1193,4 @@ void libmixer_init(Module *pxThis)
REG_SUB(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDB, 0); REG_SUB(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDB, 0);
REG_SUB(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDBIndex, 0); REG_SUB(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDBIndex, 0);
REG_SUB(libmixer, "surmxUti", cellSurMixerUtilNoteToRatio, 0); REG_SUB(libmixer, "surmxUti", cellSurMixerUtilNoteToRatio, 0);
} });

View file

@ -10,7 +10,7 @@
#include "Crypto/unedat.h" #include "Crypto/unedat.h"
#include "sceNp.h" #include "sceNp.h"
Module *sceNp = nullptr; extern Module sceNp;
struct sceNpInternal struct sceNpInternal
{ {
@ -34,7 +34,7 @@ sceNpInternal sceNpInstance;
int sceNpInit(u32 mem_size, u32 mem_addr) int sceNpInit(u32 mem_size, u32 mem_addr)
{ {
sceNp->Warning("sceNpInit(mem_size=0x%x, mem_addr=0x%x)", mem_size, mem_addr); sceNp.Warning("sceNpInit(mem_size=0x%x, mem_addr=0x%x)", mem_size, mem_addr);
if (sceNpInstance.m_bSceNpInitialized) if (sceNpInstance.m_bSceNpInitialized)
return SCE_NP_ERROR_ALREADY_INITIALIZED; return SCE_NP_ERROR_ALREADY_INITIALIZED;
@ -46,7 +46,7 @@ int sceNpInit(u32 mem_size, u32 mem_addr)
int sceNp2Init(u32 mem_size, u32 mem_addr) int sceNp2Init(u32 mem_size, u32 mem_addr)
{ {
sceNp->Warning("sceNp2Init(mem_size=0x%x, mem_addr=0x%x)", mem_size, mem_addr); sceNp.Warning("sceNp2Init(mem_size=0x%x, mem_addr=0x%x)", mem_size, mem_addr);
if (sceNpInstance.m_bSceNp2Initialized) if (sceNpInstance.m_bSceNp2Initialized)
return SCE_NP_ERROR_ALREADY_INITIALIZED; return SCE_NP_ERROR_ALREADY_INITIALIZED;
@ -58,7 +58,7 @@ int sceNp2Init(u32 mem_size, u32 mem_addr)
int sceNpTerm() int sceNpTerm()
{ {
sceNp->Warning("sceNpTerm()"); sceNp.Warning("sceNpTerm()");
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_ERROR_NOT_INITIALIZED; return SCE_NP_ERROR_NOT_INITIALIZED;
@ -70,7 +70,7 @@ int sceNpTerm()
int sceNp2Term() int sceNp2Term()
{ {
sceNp->Warning("sceNp2Term()"); sceNp.Warning("sceNp2Term()");
if (!sceNpInstance.m_bSceNp2Initialized) if (!sceNpInstance.m_bSceNp2Initialized)
return SCE_NP_ERROR_NOT_INITIALIZED; return SCE_NP_ERROR_NOT_INITIALIZED;
@ -84,7 +84,7 @@ int npDrmIsAvailable(u32 k_licensee_addr, vm::ptr<const char> drm_path)
{ {
if (!Emu.GetVFS().ExistsFile(drm_path.get_ptr())) if (!Emu.GetVFS().ExistsFile(drm_path.get_ptr()))
{ {
sceNp->Warning("npDrmIsAvailable(): '%s' not found", drm_path.get_ptr()); sceNp.Warning("npDrmIsAvailable(): '%s' not found", drm_path.get_ptr());
return CELL_ENOENT; return CELL_ENOENT;
} }
@ -100,8 +100,8 @@ int npDrmIsAvailable(u32 k_licensee_addr, vm::ptr<const char> drm_path)
} }
} }
sceNp->Warning("npDrmIsAvailable: Found DRM license file at %s", drm_path.get_ptr()); sceNp.Warning("npDrmIsAvailable: Found DRM license file at %s", drm_path.get_ptr());
sceNp->Warning("npDrmIsAvailable: Using k_licensee 0x%s", k_licensee_str.c_str()); sceNp.Warning("npDrmIsAvailable: Using k_licensee 0x%s", k_licensee_str.c_str());
// Set the necessary file paths. // Set the necessary file paths.
std::string drm_file_name = fmt::AfterLast(drm_path.get_ptr(), '/'); std::string drm_file_name = fmt::AfterLast(drm_path.get_ptr(), '/');
@ -118,7 +118,7 @@ int npDrmIsAvailable(u32 k_licensee_addr, vm::ptr<const char> drm_path)
// Search dev_usb000 for a compatible RAP file. // Search dev_usb000 for a compatible RAP file.
vfsDir raps_dir(rap_path); vfsDir raps_dir(rap_path);
if (!raps_dir.IsOpened()) if (!raps_dir.IsOpened())
sceNp->Warning("npDrmIsAvailable: Can't find RAP file for DRM!"); sceNp.Warning("npDrmIsAvailable: Can't find RAP file for DRM!");
else else
{ {
for (const DirEntryInfo *entry : raps_dir) for (const DirEntryInfo *entry : raps_dir)
@ -149,28 +149,28 @@ int npDrmIsAvailable(u32 k_licensee_addr, vm::ptr<const char> drm_path)
int sceNpDrmIsAvailable(u32 k_licensee_addr, vm::ptr<const char> drm_path) int sceNpDrmIsAvailable(u32 k_licensee_addr, vm::ptr<const char> drm_path)
{ {
sceNp->Warning("sceNpDrmIsAvailable(k_licensee_addr=0x%x, drm_path_addr=0x%x('%s'))", k_licensee_addr, drm_path.addr(), drm_path.get_ptr()); sceNp.Warning("sceNpDrmIsAvailable(k_licensee_addr=0x%x, drm_path_addr=0x%x('%s'))", k_licensee_addr, drm_path.addr(), drm_path.get_ptr());
return npDrmIsAvailable(k_licensee_addr, drm_path); return npDrmIsAvailable(k_licensee_addr, drm_path);
} }
int sceNpDrmIsAvailable2(u32 k_licensee_addr, vm::ptr<const char> drm_path) int sceNpDrmIsAvailable2(u32 k_licensee_addr, vm::ptr<const char> drm_path)
{ {
sceNp->Warning("sceNpDrmIsAvailable2(k_licensee_addr=0x%x, drm_path_addr=0x%x('%s'))", k_licensee_addr, drm_path.addr(), drm_path.get_ptr()); sceNp.Warning("sceNpDrmIsAvailable2(k_licensee_addr=0x%x, drm_path_addr=0x%x('%s'))", k_licensee_addr, drm_path.addr(), drm_path.get_ptr());
return npDrmIsAvailable(k_licensee_addr, drm_path); return npDrmIsAvailable(k_licensee_addr, drm_path);
} }
int sceNpDrmVerifyUpgradeLicense(vm::ptr<const char> content_id) int sceNpDrmVerifyUpgradeLicense(vm::ptr<const char> content_id)
{ {
sceNp->Todo("sceNpDrmVerifyUpgradeLicense(content_id_addr=0x%x)", content_id.addr()); sceNp.Todo("sceNpDrmVerifyUpgradeLicense(content_id_addr=0x%x)", content_id.addr());
return CELL_OK; return CELL_OK;
} }
int sceNpDrmVerifyUpgradeLicense2(vm::ptr<const char> content_id) int sceNpDrmVerifyUpgradeLicense2(vm::ptr<const char> content_id)
{ {
sceNp->Todo("sceNpDrmVerifyUpgradeLicense2(content_id_addr=0x%x)", content_id.addr()); sceNp.Todo("sceNpDrmVerifyUpgradeLicense2(content_id_addr=0x%x)", content_id.addr());
return CELL_OK; return CELL_OK;
} }
@ -189,14 +189,14 @@ int sceNpDrmGetTimelimit(u32 drm_path_addr, vm::ptr<u64> time_remain_usec)
int sceNpDrmProcessExitSpawn(vm::ptr<const char> path, u32 argv_addr, u32 envp_addr, u32 data_addr, u32 data_size, u32 prio, u64 flags) int sceNpDrmProcessExitSpawn(vm::ptr<const char> path, u32 argv_addr, u32 envp_addr, u32 data_addr, u32 data_size, u32 prio, u64 flags)
{ {
sceNp->Warning("sceNpDrmProcessExitSpawn()"); sceNp.Warning("sceNpDrmProcessExitSpawn()");
sceNp->Warning("path: %s", path.get_ptr()); sceNp.Warning("path: %s", path.get_ptr());
sceNp->Warning("argv: 0x%x", argv_addr); sceNp.Warning("argv: 0x%x", argv_addr);
sceNp->Warning("envp: 0x%x", envp_addr); sceNp.Warning("envp: 0x%x", envp_addr);
sceNp->Warning("data: 0x%x", data_addr); sceNp.Warning("data: 0x%x", data_addr);
sceNp->Warning("data_size: 0x%x", data_size); sceNp.Warning("data_size: 0x%x", data_size);
sceNp->Warning("prio: %d", prio); sceNp.Warning("prio: %d", prio);
sceNp->Warning("flags: %d", flags); sceNp.Warning("flags: %d", flags);
sys_game_process_exitspawn(path, argv_addr, envp_addr, data_addr, data_size, prio, flags); sys_game_process_exitspawn(path, argv_addr, envp_addr, data_addr, data_size, prio, flags);
@ -205,14 +205,14 @@ int sceNpDrmProcessExitSpawn(vm::ptr<const char> path, u32 argv_addr, u32 envp_a
int sceNpDrmProcessExitSpawn2(vm::ptr<const char> path, u32 argv_addr, u32 envp_addr, u32 data_addr, u32 data_size, u32 prio, u64 flags) int sceNpDrmProcessExitSpawn2(vm::ptr<const char> path, u32 argv_addr, u32 envp_addr, u32 data_addr, u32 data_size, u32 prio, u64 flags)
{ {
sceNp->Warning("sceNpDrmProcessExitSpawn2()"); sceNp.Warning("sceNpDrmProcessExitSpawn2()");
sceNp->Warning("path: %s", path.get_ptr()); sceNp.Warning("path: %s", path.get_ptr());
sceNp->Warning("argv: 0x%x", argv_addr); sceNp.Warning("argv: 0x%x", argv_addr);
sceNp->Warning("envp: 0x%x", envp_addr); sceNp.Warning("envp: 0x%x", envp_addr);
sceNp->Warning("data: 0x%x", data_addr); sceNp.Warning("data: 0x%x", data_addr);
sceNp->Warning("data_size: 0x%x", data_size); sceNp.Warning("data_size: 0x%x", data_size);
sceNp->Warning("prio: %d", prio); sceNp.Warning("prio: %d", prio);
sceNp->Warning("flags: %d", flags); sceNp.Warning("flags: %d", flags);
sys_game_process_exitspawn2(path, argv_addr, envp_addr, data_addr, data_size, prio, flags); sys_game_process_exitspawn2(path, argv_addr, envp_addr, data_addr, data_size, prio, flags);
@ -311,7 +311,7 @@ int sceNpBasicAddFriend()
int sceNpBasicGetFriendListEntryCount(vm::ptr<u32> count) int sceNpBasicGetFriendListEntryCount(vm::ptr<u32> count)
{ {
sceNp->Warning("sceNpBasicGetFriendListEntryCount(count_addr=0x%x)", count.addr()); sceNp.Warning("sceNpBasicGetFriendListEntryCount(count_addr=0x%x)", count.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
@ -366,7 +366,7 @@ int sceNpBasicAddPlayersHistoryAsync()
int sceNpBasicGetPlayersHistoryEntryCount(u32 options, vm::ptr<u32> count) int sceNpBasicGetPlayersHistoryEntryCount(u32 options, vm::ptr<u32> count)
{ {
sceNp->Todo("sceNpBasicGetPlayersHistoryEntryCount(options=%d, count_addr=0x%x)", options, count.addr()); sceNp.Todo("sceNpBasicGetPlayersHistoryEntryCount(options=%d, count_addr=0x%x)", options, count.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
@ -388,7 +388,7 @@ int sceNpBasicAddBlockListEntry()
int sceNpBasicGetBlockListEntryCount(u32 count) int sceNpBasicGetBlockListEntryCount(u32 count)
{ {
sceNp->Todo("sceNpBasicGetBlockListEntryCount(count=%d)", count); sceNp.Todo("sceNpBasicGetBlockListEntryCount(count=%d)", count);
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
@ -404,7 +404,7 @@ int sceNpBasicGetBlockListEntry()
int sceNpBasicGetMessageAttachmentEntryCount(vm::ptr<u32> count) int sceNpBasicGetMessageAttachmentEntryCount(vm::ptr<u32> count)
{ {
sceNp->Todo("sceNpBasicGetMessageAttachmentEntryCount(count_addr=0x%x)", count.addr()); sceNp.Todo("sceNpBasicGetMessageAttachmentEntryCount(count_addr=0x%x)", count.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
@ -414,7 +414,7 @@ int sceNpBasicGetMessageAttachmentEntryCount(vm::ptr<u32> count)
int sceNpBasicGetMessageAttachmentEntry(u32 index, vm::ptr<SceNpUserInfo> from) int sceNpBasicGetMessageAttachmentEntry(u32 index, vm::ptr<SceNpUserInfo> from)
{ {
sceNp->Todo("sceNpBasicGetMessageAttachmentEntry(index=%d, from_addr=0x%x)", index, from.addr()); sceNp.Todo("sceNpBasicGetMessageAttachmentEntry(index=%d, from_addr=0x%x)", index, from.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
@ -436,7 +436,7 @@ int sceNpBasicGetCustomInvitationEntry()
int sceNpBasicGetMatchingInvitationEntryCount(vm::ptr<u32> count) int sceNpBasicGetMatchingInvitationEntryCount(vm::ptr<u32> count)
{ {
sceNp->Todo("sceNpBasicGetMatchingInvitationEntryCount(count_addr=0x%x)", count.addr()); sceNp.Todo("sceNpBasicGetMatchingInvitationEntryCount(count_addr=0x%x)", count.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
@ -446,7 +446,7 @@ int sceNpBasicGetMatchingInvitationEntryCount(vm::ptr<u32> count)
int sceNpBasicGetMatchingInvitationEntry(u32 index, vm::ptr<SceNpUserInfo> from) int sceNpBasicGetMatchingInvitationEntry(u32 index, vm::ptr<SceNpUserInfo> from)
{ {
sceNp->Todo("sceNpBasicGetMatchingInvitationEntry(index=%d, from_addr=0x%x)", index, from.addr()); sceNp.Todo("sceNpBasicGetMatchingInvitationEntry(index=%d, from_addr=0x%x)", index, from.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
@ -456,7 +456,7 @@ int sceNpBasicGetMatchingInvitationEntry(u32 index, vm::ptr<SceNpUserInfo> from)
int sceNpBasicGetClanMessageEntryCount(vm::ptr<u32> count) int sceNpBasicGetClanMessageEntryCount(vm::ptr<u32> count)
{ {
sceNp->Todo("sceNpBasicGetClanMessageEntryCount(count_addr=0x%x)", count.addr()); sceNp.Todo("sceNpBasicGetClanMessageEntryCount(count_addr=0x%x)", count.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
@ -466,7 +466,7 @@ int sceNpBasicGetClanMessageEntryCount(vm::ptr<u32> count)
int sceNpBasicGetClanMessageEntry(u32 index, vm::ptr<SceNpUserInfo> from) int sceNpBasicGetClanMessageEntry(u32 index, vm::ptr<SceNpUserInfo> from)
{ {
sceNp->Todo("sceNpBasicGetClanMessageEntry(index=%d, from_addr=0x%x)", index, from.addr()); sceNp.Todo("sceNpBasicGetClanMessageEntry(index=%d, from_addr=0x%x)", index, from.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
@ -476,7 +476,7 @@ int sceNpBasicGetClanMessageEntry(u32 index, vm::ptr<SceNpUserInfo> from)
int sceNpBasicGetMessageEntryCount(u32 type, vm::ptr<u32> count) int sceNpBasicGetMessageEntryCount(u32 type, vm::ptr<u32> count)
{ {
sceNp->Warning("sceNpBasicGetMessageEntryCount(type=%d, count_addr=0x%x)", type, count.addr()); sceNp.Warning("sceNpBasicGetMessageEntryCount(type=%d, count_addr=0x%x)", type, count.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
@ -489,7 +489,7 @@ int sceNpBasicGetMessageEntryCount(u32 type, vm::ptr<u32> count)
int sceNpBasicGetMessageEntry(u32 type, u32 index, vm::ptr<SceNpUserInfo> from) int sceNpBasicGetMessageEntry(u32 type, u32 index, vm::ptr<SceNpUserInfo> from)
{ {
sceNp->Todo("sceNpBasicGetMessageEntry(type=%d, index=%d, from_addr=0x%x)", type, index, from.addr()); sceNp.Todo("sceNpBasicGetMessageEntry(type=%d, index=%d, from_addr=0x%x)", type, index, from.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
@ -499,7 +499,7 @@ int sceNpBasicGetMessageEntry(u32 type, u32 index, vm::ptr<SceNpUserInfo> from)
int sceNpBasicGetEvent(vm::ptr<s32> event, vm::ptr<SceNpUserInfo> from, vm::ptr<s32> data, vm::ptr<u32> size) int sceNpBasicGetEvent(vm::ptr<s32> event, vm::ptr<SceNpUserInfo> from, vm::ptr<s32> data, vm::ptr<u32> size)
{ {
sceNp->Warning("sceNpBasicGetEvent(event_addr=0x%x, from_addr=0x%x, data_addr=0x%x, size_addr=0x%x)", event.addr(), from.addr(), data.addr(), size.addr()); sceNp.Warning("sceNpBasicGetEvent(event_addr=0x%x, from_addr=0x%x, data_addr=0x%x, size_addr=0x%x)", event.addr(), from.addr(), data.addr(), size.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
@ -764,7 +764,7 @@ int sceNpFriendlistAbortGui()
int sceNpLookupInit() int sceNpLookupInit()
{ {
sceNp->Warning("sceNpLookupInit()"); sceNp.Warning("sceNpLookupInit()");
// TODO: Make sure the error code returned is right, // TODO: Make sure the error code returned is right,
// since there are no error codes for Lookup utility. // since there are no error codes for Lookup utility.
@ -778,7 +778,7 @@ int sceNpLookupInit()
int sceNpLookupTerm() int sceNpLookupTerm()
{ {
sceNp->Warning("sceNpLookupTerm()"); sceNp.Warning("sceNpLookupTerm()");
if (!sceNpInstance.m_bLookupInitialized) if (!sceNpInstance.m_bLookupInitialized)
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
@ -923,7 +923,7 @@ int sceNpManagerUnregisterCallback()
int sceNpManagerGetStatus(vm::ptr<u32> status) int sceNpManagerGetStatus(vm::ptr<u32> status)
{ {
sceNp->Log("sceNpManagerGetStatus(status_addr=0x%x)", status.addr()); sceNp.Log("sceNpManagerGetStatus(status_addr=0x%x)", status.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_ERROR_NOT_INITIALIZED; return SCE_NP_ERROR_NOT_INITIALIZED;
@ -984,7 +984,7 @@ int sceNpManagerGetAccountAge()
int sceNpManagerGetContentRatingFlag(vm::ptr<u32> isRestricted, vm::ptr<u32> age) int sceNpManagerGetContentRatingFlag(vm::ptr<u32> isRestricted, vm::ptr<u32> age)
{ {
sceNp->Warning("sceNpManagerGetContentRatingFlag(isRestricted_addr=0x%x, age_addr=0x%x)", isRestricted.addr(), age.addr()); sceNp.Warning("sceNpManagerGetContentRatingFlag(isRestricted_addr=0x%x, age_addr=0x%x)", isRestricted.addr(), age.addr());
if (!sceNpInstance.m_bSceNpInitialized) if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_ERROR_NOT_INITIALIZED; return SCE_NP_ERROR_NOT_INITIALIZED;
@ -1214,7 +1214,7 @@ int sceNpProfileAbortGui()
int sceNpScoreInit() int sceNpScoreInit()
{ {
sceNp->Warning("sceNpScoreInit()"); sceNp.Warning("sceNpScoreInit()");
if (sceNpInstance.m_bScoreInitialized) if (sceNpInstance.m_bScoreInitialized)
return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED; return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED;
@ -1226,7 +1226,7 @@ int sceNpScoreInit()
int sceNpScoreTerm() int sceNpScoreTerm()
{ {
sceNp->Warning("sceNpScoreTerm()"); sceNp.Warning("sceNpScoreTerm()");
if (!sceNpInstance.m_bScoreInitialized) if (!sceNpInstance.m_bScoreInitialized)
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
@ -1643,236 +1643,234 @@ void sceNp_unload()
sceNpInstance.m_bSceNpUtilBandwidthTestInitialized = false; sceNpInstance.m_bSceNpUtilBandwidthTestInitialized = false;
} }
void sceNp_init(Module *pxThis) Module sceNp("sceNp", []()
{ {
sceNp = pxThis; sceNp.AddFunc(0xbd28fdbf, sceNpInit);
sceNp.AddFunc(0x41251f74, sceNp2Init);
sceNp->AddFunc(0xbd28fdbf, sceNpInit); sceNp.AddFunc(0xc2ced2b7, sceNpUtilBandwidthTestInitStart);
sceNp->AddFunc(0x41251f74, sceNp2Init); sceNp.AddFunc(0x4885aa18, sceNpTerm);
sceNp->AddFunc(0xc2ced2b7, sceNpUtilBandwidthTestInitStart); sceNp.AddFunc(0xaadb7c12, sceNp2Term);
sceNp->AddFunc(0x4885aa18, sceNpTerm); sceNp.AddFunc(0x432b3cbf, sceNpUtilBandwidthTestShutdown);
sceNp->AddFunc(0xaadb7c12, sceNp2Term); sceNp.AddFunc(0xad218faf, sceNpDrmIsAvailable);
sceNp->AddFunc(0x432b3cbf, sceNpUtilBandwidthTestShutdown); sceNp.AddFunc(0xf042b14f, sceNpDrmIsAvailable2);
sceNp->AddFunc(0xad218faf, sceNpDrmIsAvailable); sceNp.AddFunc(0x2ecd48ed, sceNpDrmVerifyUpgradeLicense);
sceNp->AddFunc(0xf042b14f, sceNpDrmIsAvailable2); sceNp.AddFunc(0xbe0e3ee2, sceNpDrmVerifyUpgradeLicense2);
sceNp->AddFunc(0x2ecd48ed, sceNpDrmVerifyUpgradeLicense); sceNp.AddFunc(0xf283c143, sceNpDrmExecuteGamePurchase);
sceNp->AddFunc(0xbe0e3ee2, sceNpDrmVerifyUpgradeLicense2); sceNp.AddFunc(0xcf51864b, sceNpDrmGetTimelimit);
sceNp->AddFunc(0xf283c143, sceNpDrmExecuteGamePurchase); sceNp.AddFunc(0xaa16695f, sceNpDrmProcessExitSpawn);
sceNp->AddFunc(0xcf51864b, sceNpDrmGetTimelimit); sceNp.AddFunc(0xe6c8f3f9, sceNpDrmProcessExitSpawn2);
sceNp->AddFunc(0xaa16695f, sceNpDrmProcessExitSpawn); sceNp.AddFunc(0xbcc09fe7, sceNpBasicRegisterHandler);
sceNp->AddFunc(0xe6c8f3f9, sceNpDrmProcessExitSpawn2); sceNp.AddFunc(0x4026eac5, sceNpBasicRegisterContextSensitiveHandler);
sceNp->AddFunc(0xbcc09fe7, sceNpBasicRegisterHandler); sceNp.AddFunc(0xacb9ee8e, sceNpBasicUnregisterHandler);
sceNp->AddFunc(0x4026eac5, sceNpBasicRegisterContextSensitiveHandler); sceNp.AddFunc(0x3f0808aa, sceNpBasicSetPresence);
sceNp->AddFunc(0xacb9ee8e, sceNpBasicUnregisterHandler); sceNp.AddFunc(0xbe81c71c, sceNpBasicSetPresenceDetails);
sceNp->AddFunc(0x3f0808aa, sceNpBasicSetPresence); sceNp.AddFunc(0x5e849303, sceNpBasicSetPresenceDetails2);
sceNp->AddFunc(0xbe81c71c, sceNpBasicSetPresenceDetails); sceNp.AddFunc(0xec0a1fbf, sceNpBasicSendMessage);
sceNp->AddFunc(0x5e849303, sceNpBasicSetPresenceDetails2); sceNp.AddFunc(0x01fbbc9b, sceNpBasicSendMessageGui);
sceNp->AddFunc(0xec0a1fbf, sceNpBasicSendMessage); sceNp.AddFunc(0x43b989f5, sceNpBasicSendMessageAttachment);
sceNp->AddFunc(0x01fbbc9b, sceNpBasicSendMessageGui); sceNp.AddFunc(0xb5cb2d56, sceNpBasicRecvMessageAttachment);
sceNp->AddFunc(0x43b989f5, sceNpBasicSendMessageAttachment); sceNp.AddFunc(0x64a704cc, sceNpBasicRecvMessageAttachmentLoad);
sceNp->AddFunc(0xb5cb2d56, sceNpBasicRecvMessageAttachment); sceNp.AddFunc(0x806960ab, sceNpBasicRecvMessageCustom);
sceNp->AddFunc(0x64a704cc, sceNpBasicRecvMessageAttachmentLoad); sceNp.AddFunc(0xe1c9f675, sceNpBasicMarkMessageAsUsed);
sceNp->AddFunc(0x806960ab, sceNpBasicRecvMessageCustom); sceNp.AddFunc(0x481ce0e8, sceNpBasicAbortGui);
sceNp->AddFunc(0xe1c9f675, sceNpBasicMarkMessageAsUsed); sceNp.AddFunc(0x27c69eba, sceNpBasicAddFriend);
sceNp->AddFunc(0x481ce0e8, sceNpBasicAbortGui); sceNp.AddFunc(0xafef640d, sceNpBasicGetFriendListEntryCount);
sceNp->AddFunc(0x27c69eba, sceNpBasicAddFriend); sceNp.AddFunc(0x04372385, sceNpBasicGetFriendListEntry);
sceNp->AddFunc(0xafef640d, sceNpBasicGetFriendListEntryCount); sceNp.AddFunc(0x32c78a6a, sceNpBasicGetFriendPresenceByIndex);
sceNp->AddFunc(0x04372385, sceNpBasicGetFriendListEntry); sceNp.AddFunc(0x6453b27b, sceNpBasicGetFriendPresenceByIndex2);
sceNp->AddFunc(0x32c78a6a, sceNpBasicGetFriendPresenceByIndex); sceNp.AddFunc(0xfd39ae13, sceNpBasicGetFriendPresenceByNpId);
sceNp->AddFunc(0x6453b27b, sceNpBasicGetFriendPresenceByIndex2); sceNp.AddFunc(0x260caedd, sceNpBasicGetFriendPresenceByNpId2);
sceNp->AddFunc(0xfd39ae13, sceNpBasicGetFriendPresenceByNpId); sceNp.AddFunc(0x168a3117, sceNpBasicAddPlayersHistory);
sceNp->AddFunc(0x260caedd, sceNpBasicGetFriendPresenceByNpId2); sceNp.AddFunc(0xbcdbb2ab, sceNpBasicAddPlayersHistoryAsync);
sceNp->AddFunc(0x168a3117, sceNpBasicAddPlayersHistory); sceNp.AddFunc(0xa15f35fe, sceNpBasicGetPlayersHistoryEntryCount);
sceNp->AddFunc(0xbcdbb2ab, sceNpBasicAddPlayersHistoryAsync); sceNp.AddFunc(0xbab91fc9, sceNpBasicGetPlayersHistoryEntry);
sceNp->AddFunc(0xa15f35fe, sceNpBasicGetPlayersHistoryEntryCount); sceNp.AddFunc(0x1ae8a549, sceNpBasicAddBlockListEntry);
sceNp->AddFunc(0xbab91fc9, sceNpBasicGetPlayersHistoryEntry); sceNp.AddFunc(0x73931bd0, sceNpBasicGetBlockListEntryCount);
sceNp->AddFunc(0x1ae8a549, sceNpBasicAddBlockListEntry); sceNp.AddFunc(0xf2b3338a, sceNpBasicGetBlockListEntry);
sceNp->AddFunc(0x73931bd0, sceNpBasicGetBlockListEntryCount); sceNp.AddFunc(0x9153bdf4, sceNpBasicGetMessageAttachmentEntryCount);
sceNp->AddFunc(0xf2b3338a, sceNpBasicGetBlockListEntry); sceNp.AddFunc(0x5d543bbe, sceNpBasicGetMessageAttachmentEntry);
sceNp->AddFunc(0x9153bdf4, sceNpBasicGetMessageAttachmentEntryCount); sceNp.AddFunc(0xa8afa7d4, sceNpBasicGetCustomInvitationEntryCount);
sceNp->AddFunc(0x5d543bbe, sceNpBasicGetMessageAttachmentEntry); sceNp.AddFunc(0xd053f113, sceNpBasicGetCustomInvitationEntry);
sceNp->AddFunc(0xa8afa7d4, sceNpBasicGetCustomInvitationEntryCount); sceNp.AddFunc(0xaf505def, sceNpBasicGetMatchingInvitationEntryCount);
sceNp->AddFunc(0xd053f113, sceNpBasicGetCustomInvitationEntry); sceNp.AddFunc(0x05af1cb8, sceNpBasicGetMatchingInvitationEntry);
sceNp->AddFunc(0xaf505def, sceNpBasicGetMatchingInvitationEntryCount); sceNp.AddFunc(0xbf607ec6, sceNpBasicGetClanMessageEntryCount);
sceNp->AddFunc(0x05af1cb8, sceNpBasicGetMatchingInvitationEntry); sceNp.AddFunc(0x4d9c615d, sceNpBasicGetClanMessageEntry);
sceNp->AddFunc(0xbf607ec6, sceNpBasicGetClanMessageEntryCount); sceNp.AddFunc(0xecd503de, sceNpBasicGetMessageEntryCount);
sceNp->AddFunc(0x4d9c615d, sceNpBasicGetClanMessageEntry); sceNp.AddFunc(0x30d1cbde, sceNpBasicGetMessageEntry);
sceNp->AddFunc(0xecd503de, sceNpBasicGetMessageEntryCount); sceNp.AddFunc(0xe035f7d6, sceNpBasicGetEvent);
sceNp->AddFunc(0x30d1cbde, sceNpBasicGetMessageEntry); sceNp.AddFunc(0xfcac355a, sceNpCommerceCreateCtx);
sceNp->AddFunc(0xe035f7d6, sceNpBasicGetEvent); sceNp.AddFunc(0xe2877bea, sceNpCommerceDestroyCtx);
sceNp->AddFunc(0xfcac355a, sceNpCommerceCreateCtx); sceNp.AddFunc(0x8d1d096c, sceNpCommerceInitProductCategory);
sceNp->AddFunc(0xe2877bea, sceNpCommerceDestroyCtx); sceNp.AddFunc(0x6cb81eb2, sceNpCommerceDestroyProductCategory);
sceNp->AddFunc(0x8d1d096c, sceNpCommerceInitProductCategory); sceNp.AddFunc(0x26f33146, sceNpCommerceGetProductCategoryStart);
sceNp->AddFunc(0x6cb81eb2, sceNpCommerceDestroyProductCategory); sceNp.AddFunc(0xcfd469e4, sceNpCommerceGetProductCategoryFinish);
sceNp->AddFunc(0x26f33146, sceNpCommerceGetProductCategoryStart); sceNp.AddFunc(0x3f195b3a, sceNpCommerceGetProductCategoryResult);
sceNp->AddFunc(0xcfd469e4, sceNpCommerceGetProductCategoryFinish); sceNp.AddFunc(0x674bb9ff, sceNpCommerceGetProductCategoryAbort);
sceNp->AddFunc(0x3f195b3a, sceNpCommerceGetProductCategoryResult); sceNp.AddFunc(0x936df4aa, sceNpCommerceGetProductId);
sceNp->AddFunc(0x674bb9ff, sceNpCommerceGetProductCategoryAbort); sceNp.AddFunc(0xeb5f2544, sceNpCommerceGetProductName);
sceNp->AddFunc(0x936df4aa, sceNpCommerceGetProductId); sceNp.AddFunc(0x359642a6, sceNpCommerceGetCategoryDescription);
sceNp->AddFunc(0xeb5f2544, sceNpCommerceGetProductName); sceNp.AddFunc(0xaee8cf71, sceNpCommerceGetCategoryId);
sceNp->AddFunc(0x359642a6, sceNpCommerceGetCategoryDescription); sceNp.AddFunc(0x9452f4f8, sceNpCommerceGetCategoryImageURL);
sceNp->AddFunc(0xaee8cf71, sceNpCommerceGetCategoryId); sceNp.AddFunc(0xeb9df054, sceNpCommerceGetCategoryInfo);
sceNp->AddFunc(0x9452f4f8, sceNpCommerceGetCategoryImageURL); sceNp.AddFunc(0x6e2ab18b, sceNpCommerceGetCategoryName);
sceNp->AddFunc(0xeb9df054, sceNpCommerceGetCategoryInfo); sceNp.AddFunc(0x79225aa3, sceNpCommerceGetCurrencyCode);
sceNp->AddFunc(0x6e2ab18b, sceNpCommerceGetCategoryName); sceNp.AddFunc(0xaf57d9c9, sceNpCommerceGetCurrencyDecimals);
sceNp->AddFunc(0x79225aa3, sceNpCommerceGetCurrencyCode); sceNp.AddFunc(0xb1c02d66, sceNpCommerceGetCurrencyInfo);
sceNp->AddFunc(0xaf57d9c9, sceNpCommerceGetCurrencyDecimals); sceNp.AddFunc(0x2be41ece, sceNpCommerceGetNumOfChildCategory);
sceNp->AddFunc(0xb1c02d66, sceNpCommerceGetCurrencyInfo); sceNp.AddFunc(0x7208dc08, sceNpCommerceGetNumOfChildProductSku);
sceNp->AddFunc(0x2be41ece, sceNpCommerceGetNumOfChildCategory); sceNp.AddFunc(0xa85a4951, sceNpCommerceGetSkuDescription);
sceNp->AddFunc(0x7208dc08, sceNpCommerceGetNumOfChildProductSku); sceNp.AddFunc(0x39a69619, sceNpCommerceGetSkuId);
sceNp->AddFunc(0xa85a4951, sceNpCommerceGetSkuDescription); sceNp.AddFunc(0xccbe2e69, sceNpCommerceGetSkuImageURL);
sceNp->AddFunc(0x39a69619, sceNpCommerceGetSkuId); sceNp.AddFunc(0xee530059, sceNpCommerceGetSkuName);
sceNp->AddFunc(0xccbe2e69, sceNpCommerceGetSkuImageURL); sceNp.AddFunc(0x78d7f9ad, sceNpCommerceGetSkuPrice);
sceNp->AddFunc(0xee530059, sceNpCommerceGetSkuName); sceNp.AddFunc(0x1a3fcb69, sceNpCommerceGetSkuUserData);
sceNp->AddFunc(0x78d7f9ad, sceNpCommerceGetSkuPrice); sceNp.AddFunc(0x99ac9952, sceNpCommerceSetDataFlagStart);
sceNp->AddFunc(0x1a3fcb69, sceNpCommerceGetSkuUserData); sceNp.AddFunc(0xdbdb909f, sceNpCommerceGetDataFlagStart);
sceNp->AddFunc(0x99ac9952, sceNpCommerceSetDataFlagStart); sceNp.AddFunc(0x8d4518a0, sceNpCommerceSetDataFlagFinish);
sceNp->AddFunc(0xdbdb909f, sceNpCommerceGetDataFlagStart); sceNp.AddFunc(0x9281e87a, sceNpCommerceGetDataFlagFinish);
sceNp->AddFunc(0x8d4518a0, sceNpCommerceSetDataFlagFinish); sceNp.AddFunc(0xd03cea35, sceNpCommerceGetDataFlagState);
sceNp->AddFunc(0x9281e87a, sceNpCommerceGetDataFlagFinish); sceNp.AddFunc(0x0561448b, sceNpCommerceGetDataFlagAbort);
sceNp->AddFunc(0xd03cea35, sceNpCommerceGetDataFlagState); sceNp.AddFunc(0xba65de6d, sceNpCommerceGetChildCategoryInfo);
sceNp->AddFunc(0x0561448b, sceNpCommerceGetDataFlagAbort); sceNp.AddFunc(0x01cd9cfd, sceNpCommerceGetChildProductSkuInfo);
sceNp->AddFunc(0xba65de6d, sceNpCommerceGetChildCategoryInfo); sceNp.AddFunc(0xe36c660e, sceNpCommerceDoCheckoutStartAsync);
sceNp->AddFunc(0x01cd9cfd, sceNpCommerceGetChildProductSkuInfo); sceNp.AddFunc(0xaf3eba5a, sceNpCommerceDoCheckoutFinishAsync);
sceNp->AddFunc(0xe36c660e, sceNpCommerceDoCheckoutStartAsync); sceNp.AddFunc(0x45f8f3aa, sceNpCustomMenuRegisterActions);
sceNp->AddFunc(0xaf3eba5a, sceNpCommerceDoCheckoutFinishAsync); sceNp.AddFunc(0xf9732ac8, sceNpCustomMenuActionSetActivation);
sceNp->AddFunc(0x45f8f3aa, sceNpCustomMenuRegisterActions); sceNp.AddFunc(0x9458f464, sceNpCustomMenuRegisterExceptionList);
sceNp->AddFunc(0xf9732ac8, sceNpCustomMenuActionSetActivation); sceNp.AddFunc(0xf0a9182b, sceNpFriendlist);
sceNp->AddFunc(0x9458f464, sceNpCustomMenuRegisterExceptionList); sceNp.AddFunc(0xd7fb1fa6, sceNpFriendlistCustom);
sceNp->AddFunc(0xf0a9182b, sceNpFriendlist); sceNp.AddFunc(0xf59e1da8, sceNpFriendlistAbortGui);
sceNp->AddFunc(0xd7fb1fa6, sceNpFriendlistCustom); sceNp.AddFunc(0x5f2d9257, sceNpLookupInit);
sceNp->AddFunc(0xf59e1da8, sceNpFriendlistAbortGui); sceNp.AddFunc(0x8440537c, sceNpLookupTerm);
sceNp->AddFunc(0x5f2d9257, sceNpLookupInit); sceNp.AddFunc(0xce81c7f0, sceNpLookupCreateTitleCtx);
sceNp->AddFunc(0x8440537c, sceNpLookupTerm); sceNp.AddFunc(0x5de61626, sceNpLookupDestroyTitleCtx);
sceNp->AddFunc(0xce81c7f0, sceNpLookupCreateTitleCtx); sceNp.AddFunc(0xea2e9ffc, sceNpLookupCreateTransactionCtx);
sceNp->AddFunc(0x5de61626, sceNpLookupDestroyTitleCtx); sceNp.AddFunc(0xfb87cf5e, sceNpLookupDestroyTransactionCtx);
sceNp->AddFunc(0xea2e9ffc, sceNpLookupCreateTransactionCtx); sceNp.AddFunc(0x71e5af7e, sceNpLookupSetTimeout);
sceNp->AddFunc(0xfb87cf5e, sceNpLookupDestroyTransactionCtx); sceNp.AddFunc(0x3d1760dc, sceNpLookupAbortTransaction);
sceNp->AddFunc(0x71e5af7e, sceNpLookupSetTimeout); sceNp.AddFunc(0xd737fd2d, sceNpLookupWaitAsync);
sceNp->AddFunc(0x3d1760dc, sceNpLookupAbortTransaction); sceNp.AddFunc(0x7508112e, sceNpLookupPollAsync);
sceNp->AddFunc(0xd737fd2d, sceNpLookupWaitAsync); sceNp.AddFunc(0x166dcc11, sceNpLookupNpId);
sceNp->AddFunc(0x7508112e, sceNpLookupPollAsync); sceNp.AddFunc(0xd12e40ae, sceNpLookupNpIdAsync);
sceNp->AddFunc(0x166dcc11, sceNpLookupNpId); sceNp.AddFunc(0xdfd63b62, sceNpLookupUserProfile);
sceNp->AddFunc(0xd12e40ae, sceNpLookupNpIdAsync); sceNp.AddFunc(0xff0a2378, sceNpLookupUserProfileAsync);
sceNp->AddFunc(0xdfd63b62, sceNpLookupUserProfile); sceNp.AddFunc(0x2fccbfe0, sceNpLookupUserProfileWithAvatarSize);
sceNp->AddFunc(0xff0a2378, sceNpLookupUserProfileAsync); sceNp.AddFunc(0x1fdb3ec2, sceNpLookupUserProfileWithAvatarSizeAsync);
sceNp->AddFunc(0x2fccbfe0, sceNpLookupUserProfileWithAvatarSize); sceNp.AddFunc(0xb6017827, sceNpLookupAvatarImage);
sceNp->AddFunc(0x1fdb3ec2, sceNpLookupUserProfileWithAvatarSizeAsync); sceNp.AddFunc(0xbf9eea93, sceNpLookupAvatarImageAsync);
sceNp->AddFunc(0xb6017827, sceNpLookupAvatarImage); sceNp.AddFunc(0x9ee9f97e, sceNpLookupTitleStorage);
sceNp->AddFunc(0xbf9eea93, sceNpLookupAvatarImageAsync); sceNp.AddFunc(0x5e117ed5, sceNpLookupTitleStorageAsync);
sceNp->AddFunc(0x9ee9f97e, sceNpLookupTitleStorage); sceNp.AddFunc(0xca39c4b2, sceNpLookupTitleSmallStorage);
sceNp->AddFunc(0x5e117ed5, sceNpLookupTitleStorageAsync); sceNp.AddFunc(0x860b1756, sceNpLookupTitleSmallStorageAsync);
sceNp->AddFunc(0xca39c4b2, sceNpLookupTitleSmallStorage); sceNp.AddFunc(0xe7dcd3b4, sceNpManagerRegisterCallback);
sceNp->AddFunc(0x860b1756, sceNpLookupTitleSmallStorageAsync); sceNp.AddFunc(0x52a6b523, sceNpManagerUnregisterCallback);
sceNp->AddFunc(0xe7dcd3b4, sceNpManagerRegisterCallback); sceNp.AddFunc(0xa7bff757, sceNpManagerGetStatus);
sceNp->AddFunc(0x52a6b523, sceNpManagerUnregisterCallback); sceNp.AddFunc(0xbdc07fd5, sceNpManagerGetNetworkTime);
sceNp->AddFunc(0xa7bff757, sceNpManagerGetStatus); sceNp.AddFunc(0xbe07c708, sceNpManagerGetOnlineId);
sceNp->AddFunc(0xbdc07fd5, sceNpManagerGetNetworkTime); sceNp.AddFunc(0xfe37a7f4, sceNpManagerGetNpId);
sceNp->AddFunc(0xbe07c708, sceNpManagerGetOnlineId); sceNp.AddFunc(0xf42c0df8, sceNpManagerGetOnlineName);
sceNp->AddFunc(0xfe37a7f4, sceNpManagerGetNpId); sceNp.AddFunc(0x36d0c2c5, sceNpManagerGetAvatarUrl);
sceNp->AddFunc(0xf42c0df8, sceNpManagerGetOnlineName); sceNp.AddFunc(0x32200389, sceNpManagerGetMyLanguages);
sceNp->AddFunc(0x36d0c2c5, sceNpManagerGetAvatarUrl); sceNp.AddFunc(0xb1e0718b, sceNpManagerGetAccountRegion);
sceNp->AddFunc(0x32200389, sceNpManagerGetMyLanguages); sceNp.AddFunc(0x168fcece, sceNpManagerGetAccountAge);
sceNp->AddFunc(0xb1e0718b, sceNpManagerGetAccountRegion); sceNp.AddFunc(0x6ee62ed2, sceNpManagerGetContentRatingFlag);
sceNp->AddFunc(0x168fcece, sceNpManagerGetAccountAge); sceNp.AddFunc(0xeb7a3d84, sceNpManagerGetChatRestrictionFlag);
sceNp->AddFunc(0x6ee62ed2, sceNpManagerGetContentRatingFlag); sceNp.AddFunc(0x4b9efb7a, sceNpManagerGetCachedInfo);
sceNp->AddFunc(0xeb7a3d84, sceNpManagerGetChatRestrictionFlag); sceNp.AddFunc(0x16f88a6f, sceNpManagerGetPsHandle);
sceNp->AddFunc(0x4b9efb7a, sceNpManagerGetCachedInfo); sceNp.AddFunc(0x7e2fef28, sceNpManagerRequestTicket);
sceNp->AddFunc(0x16f88a6f, sceNpManagerGetPsHandle); sceNp.AddFunc(0x8297f1ec, sceNpManagerRequestTicket2);
sceNp->AddFunc(0x7e2fef28, sceNpManagerRequestTicket); sceNp.AddFunc(0x0968aa36, sceNpManagerGetTicket);
sceNp->AddFunc(0x8297f1ec, sceNpManagerRequestTicket2); sceNp.AddFunc(0x58fa4fcd, sceNpManagerGetTicketParam);
sceNp->AddFunc(0x0968aa36, sceNpManagerGetTicket); sceNp.AddFunc(0xb66d1c46, sceNpManagerGetEntitlementIdList);
sceNp->AddFunc(0x58fa4fcd, sceNpManagerGetTicketParam); sceNp.AddFunc(0xa1709abd, sceNpManagerGetEntitlementById);
sceNp->AddFunc(0xb66d1c46, sceNpManagerGetEntitlementIdList); sceNp.AddFunc(0x442381f7, sceNpManagerSubSignin);
sceNp->AddFunc(0xa1709abd, sceNpManagerGetEntitlementById); sceNp.AddFunc(0x60440c73, sceNpManagerSubSigninAbortGui);
sceNp->AddFunc(0x442381f7, sceNpManagerSubSignin); sceNp.AddFunc(0x000e53cc, sceNpManagerSubSignout);
sceNp->AddFunc(0x60440c73, sceNpManagerSubSigninAbortGui); sceNp.AddFunc(0xac66568c, sceNpMatchingCreateCtx);
sceNp->AddFunc(0x000e53cc, sceNpManagerSubSignout); sceNp.AddFunc(0x2e1c5068, sceNpMatchingDestroyCtx);
sceNp->AddFunc(0xac66568c, sceNpMatchingCreateCtx); sceNp.AddFunc(0x03c741a7, sceNpMatchingGetResult);
sceNp->AddFunc(0x2e1c5068, sceNpMatchingDestroyCtx); sceNp.AddFunc(0x26b3bc94, sceNpMatchingGetResultGUI);
sceNp->AddFunc(0x03c741a7, sceNpMatchingGetResult); sceNp.AddFunc(0x6f8fd267, sceNpMatchingSetRoomInfo);
sceNp->AddFunc(0x26b3bc94, sceNpMatchingGetResultGUI); sceNp.AddFunc(0x4a18a89e, sceNpMatchingSetRoomInfoNoLimit);
sceNp->AddFunc(0x6f8fd267, sceNpMatchingSetRoomInfo); sceNp.AddFunc(0x691f429d, sceNpMatchingGetRoomInfo);
sceNp->AddFunc(0x4a18a89e, sceNpMatchingSetRoomInfoNoLimit); sceNp.AddFunc(0xb020684e, sceNpMatchingGetRoomInfoNoLimit);
sceNp->AddFunc(0x691f429d, sceNpMatchingGetRoomInfo); sceNp.AddFunc(0xa284bd1d, sceNpMatchingSetRoomSearchFlag);
sceNp->AddFunc(0xb020684e, sceNpMatchingGetRoomInfoNoLimit); sceNp.AddFunc(0xee64cf8e, sceNpMatchingGetRoomSearchFlag);
sceNp->AddFunc(0xa284bd1d, sceNpMatchingSetRoomSearchFlag); sceNp.AddFunc(0x73a2e36b, sceNpMatchingGetRoomMemberListLocal);
sceNp->AddFunc(0xee64cf8e, sceNpMatchingGetRoomSearchFlag); sceNp.AddFunc(0xe24eea19, sceNpMatchingGetRoomListLimitGUI);
sceNp->AddFunc(0x73a2e36b, sceNpMatchingGetRoomMemberListLocal); sceNp.AddFunc(0x34cc0ca4, sceNpMatchingKickRoomMember);
sceNp->AddFunc(0xe24eea19, sceNpMatchingGetRoomListLimitGUI); sceNp.AddFunc(0xd20d7798, sceNpMatchingKickRoomMemberWithOpt);
sceNp->AddFunc(0x34cc0ca4, sceNpMatchingKickRoomMember); sceNp.AddFunc(0x14497465, sceNpMatchingQuickMatchGUI);
sceNp->AddFunc(0xd20d7798, sceNpMatchingKickRoomMemberWithOpt); sceNp.AddFunc(0x8b7bbd73, sceNpMatchingSendInvitationGUI);
sceNp->AddFunc(0x14497465, sceNpMatchingQuickMatchGUI); sceNp.AddFunc(0x2ad7837d, sceNpMatchingAcceptInvitationGUI);
sceNp->AddFunc(0x8b7bbd73, sceNpMatchingSendInvitationGUI); sceNp.AddFunc(0x3cc8588a, sceNpMatchingCreateRoomGUI);
sceNp->AddFunc(0x2ad7837d, sceNpMatchingAcceptInvitationGUI); sceNp.AddFunc(0x474b7b13, sceNpMatchingJoinRoomGUI);
sceNp->AddFunc(0x3cc8588a, sceNpMatchingCreateRoomGUI); sceNp.AddFunc(0xf806c54c, sceNpMatchingLeaveRoom);
sceNp->AddFunc(0x474b7b13, sceNpMatchingJoinRoomGUI); sceNp.AddFunc(0x32febb4c, sceNpMatchingSearchJoinRoomGUI);
sceNp->AddFunc(0xf806c54c, sceNpMatchingLeaveRoom); sceNp.AddFunc(0xdae2d351, sceNpMatchingGrantOwnership);
sceNp->AddFunc(0x32febb4c, sceNpMatchingSearchJoinRoomGUI); sceNp.AddFunc(0xceeebc7a, sceNpProfileCallGui);
sceNp->AddFunc(0xdae2d351, sceNpMatchingGrantOwnership); sceNp.AddFunc(0x2f2c6b3e, sceNpProfileAbortGui);
sceNp->AddFunc(0xceeebc7a, sceNpProfileCallGui); sceNp.AddFunc(0x32cf311f, sceNpScoreInit);
sceNp->AddFunc(0x2f2c6b3e, sceNpProfileAbortGui); sceNp.AddFunc(0x9851f805, sceNpScoreTerm);
sceNp->AddFunc(0x32cf311f, sceNpScoreInit); sceNp.AddFunc(0xb9f93bbb, sceNpScoreCreateTitleCtx);
sceNp->AddFunc(0x9851f805, sceNpScoreTerm); sceNp.AddFunc(0x259113b8, sceNpScoreDestroyTitleCtx);
sceNp->AddFunc(0xb9f93bbb, sceNpScoreCreateTitleCtx); sceNp.AddFunc(0x6f5e8143, sceNpScoreCreateTransactionCtx);
sceNp->AddFunc(0x259113b8, sceNpScoreDestroyTitleCtx); sceNp.AddFunc(0xc5f4cf82, sceNpScoreDestroyTransactionCtx);
sceNp->AddFunc(0x6f5e8143, sceNpScoreCreateTransactionCtx); sceNp.AddFunc(0x29dd45dc, sceNpScoreSetTimeout);
sceNp->AddFunc(0xc5f4cf82, sceNpScoreDestroyTransactionCtx); sceNp.AddFunc(0x2706eaa1, sceNpScoreSetPlayerCharacterId);
sceNp->AddFunc(0x29dd45dc, sceNpScoreSetTimeout); sceNp.AddFunc(0x1a2704f7, sceNpScoreWaitAsync);
sceNp->AddFunc(0x2706eaa1, sceNpScoreSetPlayerCharacterId); sceNp.AddFunc(0xa7a090e5, sceNpScorePollAsync);
sceNp->AddFunc(0x1a2704f7, sceNpScoreWaitAsync); sceNp.AddFunc(0xf4e0f607, sceNpScoreGetBoardInfo);
sceNp->AddFunc(0xa7a090e5, sceNpScorePollAsync); sceNp.AddFunc(0xddce7d15, sceNpScoreGetBoardInfoAsync);
sceNp->AddFunc(0xf4e0f607, sceNpScoreGetBoardInfo); sceNp.AddFunc(0x1672170e, sceNpScoreRecordScore);
sceNp->AddFunc(0xddce7d15, sceNpScoreGetBoardInfoAsync); sceNp.AddFunc(0xf0b1e399, sceNpScoreRecordScoreAsync);
sceNp->AddFunc(0x1672170e, sceNpScoreRecordScore); sceNp.AddFunc(0x04ca5e6a, sceNpScoreRecordGameData);
sceNp->AddFunc(0xf0b1e399, sceNpScoreRecordScoreAsync); sceNp.AddFunc(0xf76847c2, sceNpScoreRecordGameDataAsync);
sceNp->AddFunc(0x04ca5e6a, sceNpScoreRecordGameData); sceNp.AddFunc(0x3b02418d, sceNpScoreGetGameData);
sceNp->AddFunc(0xf76847c2, sceNpScoreRecordGameDataAsync); sceNp.AddFunc(0xdb2e4dc2, sceNpScoreGetGameDataAsync);
sceNp->AddFunc(0x3b02418d, sceNpScoreGetGameData); sceNp.AddFunc(0x05d65dff, sceNpScoreGetRankingByNpId);
sceNp->AddFunc(0xdb2e4dc2, sceNpScoreGetGameDataAsync); sceNp.AddFunc(0x3db7914d, sceNpScoreGetRankingByNpIdAsync);
sceNp->AddFunc(0x05d65dff, sceNpScoreGetRankingByNpId); sceNp.AddFunc(0xfbc82301, sceNpScoreGetRankingByRange);
sceNp->AddFunc(0x3db7914d, sceNpScoreGetRankingByNpIdAsync); sceNp.AddFunc(0x21206642, sceNpScoreGetRankingByRangeAsync);
sceNp->AddFunc(0xfbc82301, sceNpScoreGetRankingByRange); sceNp.AddFunc(0x7deb244c, sceNpScoreCensorComment);
sceNp->AddFunc(0x21206642, sceNpScoreGetRankingByRangeAsync); sceNp.AddFunc(0x7be47e61, sceNpScoreCensorCommentAsync);
sceNp->AddFunc(0x7deb244c, sceNpScoreCensorComment); sceNp.AddFunc(0xf1b77918, sceNpScoreSanitizeComment);
sceNp->AddFunc(0x7be47e61, sceNpScoreCensorCommentAsync); sceNp.AddFunc(0x2cd2a1af, sceNpScoreSanitizeCommentAsync);
sceNp->AddFunc(0xf1b77918, sceNpScoreSanitizeComment); sceNp.AddFunc(0xc3a991ee, sceNpScoreGetRankingByNpIdPcId);
sceNp->AddFunc(0x2cd2a1af, sceNpScoreSanitizeCommentAsync); sceNp.AddFunc(0xc4b6cd8f, sceNpScoreGetRankingByNpIdPcIdAsync);
sceNp->AddFunc(0xc3a991ee, sceNpScoreGetRankingByNpIdPcId); sceNp.AddFunc(0xee5b20d9, sceNpScoreAbortTransaction);
sceNp->AddFunc(0xc4b6cd8f, sceNpScoreGetRankingByNpIdPcIdAsync); sceNp.AddFunc(0xded17c26, sceNpScoreGetClansMembersRankingByNpId);
sceNp->AddFunc(0xee5b20d9, sceNpScoreAbortTransaction); sceNp.AddFunc(0xe8a67160, sceNpScoreGetClansMembersRankingByNpIdAsync);
sceNp->AddFunc(0xded17c26, sceNpScoreGetClansMembersRankingByNpId); sceNp.AddFunc(0x41ffd4f2, sceNpScoreGetClansMembersRankingByNpIdPcId);
sceNp->AddFunc(0xe8a67160, sceNpScoreGetClansMembersRankingByNpIdAsync); sceNp.AddFunc(0x433fcb30, sceNpScoreGetClansMembersRankingByNpIdPcIdAsync);
sceNp->AddFunc(0x41ffd4f2, sceNpScoreGetClansMembersRankingByNpIdPcId); sceNp.AddFunc(0x6d4adc3b, sceNpScoreGetClansMembersRankingByRange);
sceNp->AddFunc(0x433fcb30, sceNpScoreGetClansMembersRankingByNpIdPcIdAsync); sceNp.AddFunc(0x4d5e0670, sceNpScoreGetClansMembersRankingByRangeAsync);
sceNp->AddFunc(0x6d4adc3b, sceNpScoreGetClansMembersRankingByRange); sceNp.AddFunc(0x741fbf24, sceNpScoreGetClanMemberGameData);
sceNp->AddFunc(0x4d5e0670, sceNpScoreGetClansMembersRankingByRangeAsync); sceNp.AddFunc(0xbef887e5, sceNpScoreGetClanMemberGameDataAsync);
sceNp->AddFunc(0x741fbf24, sceNpScoreGetClanMemberGameData); sceNp.AddFunc(0x2a76895a, sceNpScoreGetClansRankingByClanId);
sceNp->AddFunc(0xbef887e5, sceNpScoreGetClanMemberGameDataAsync); sceNp.AddFunc(0x227f8763, sceNpScoreGetClansRankingByClanIdAsync);
sceNp->AddFunc(0x2a76895a, sceNpScoreGetClansRankingByClanId); sceNp.AddFunc(0xb082003b, sceNpScoreGetClansRankingByRange);
sceNp->AddFunc(0x227f8763, sceNpScoreGetClansRankingByClanIdAsync); sceNp.AddFunc(0x7b7e9137, sceNpScoreGetClansRankingByRangeAsync);
sceNp->AddFunc(0xb082003b, sceNpScoreGetClansRankingByRange); sceNp.AddFunc(0x6356082e, sceNpSignalingCreateCtx);
sceNp->AddFunc(0x7b7e9137, sceNpScoreGetClansRankingByRangeAsync); sceNp.AddFunc(0xa8cf8451, sceNpSignalingDestroyCtx);
sceNp->AddFunc(0x6356082e, sceNpSignalingCreateCtx); sceNp.AddFunc(0x50b86d94, sceNpSignalingAddExtendedHandler);
sceNp->AddFunc(0xa8cf8451, sceNpSignalingDestroyCtx); sceNp.AddFunc(0x276c72b2, sceNpSignalingSetCtxOpt);
sceNp->AddFunc(0x50b86d94, sceNpSignalingAddExtendedHandler); sceNp.AddFunc(0x2687a127, sceNpSignalingGetCtxOpt);
sceNp->AddFunc(0x276c72b2, sceNpSignalingSetCtxOpt); sceNp.AddFunc(0x60897c38, sceNpSignalingActivateConnection);
sceNp->AddFunc(0x2687a127, sceNpSignalingGetCtxOpt); sceNp.AddFunc(0xfd0eb5ae, sceNpSignalingDeactivateConnection);
sceNp->AddFunc(0x60897c38, sceNpSignalingActivateConnection); sceNp.AddFunc(0x95c7bba3, sceNpSignalingTerminateConnection);
sceNp->AddFunc(0xfd0eb5ae, sceNpSignalingDeactivateConnection); sceNp.AddFunc(0xca0a2d04, sceNpSignalingGetConnectionStatus);
sceNp->AddFunc(0x95c7bba3, sceNpSignalingTerminateConnection); sceNp.AddFunc(0x155de760, sceNpSignalingGetConnectionInfo);
sceNp->AddFunc(0xca0a2d04, sceNpSignalingGetConnectionStatus); sceNp.AddFunc(0xe853d388, sceNpSignalingGetConnectionFromNpId);
sceNp->AddFunc(0x155de760, sceNpSignalingGetConnectionInfo); sceNp.AddFunc(0x34ce82a0, sceNpSignalingGetConnectionFromPeerAddress);
sceNp->AddFunc(0xe853d388, sceNpSignalingGetConnectionFromNpId); sceNp.AddFunc(0x9ad7fbd1, sceNpSignalingGetLocalNetInfo);
sceNp->AddFunc(0x34ce82a0, sceNpSignalingGetConnectionFromPeerAddress); sceNp.AddFunc(0x75eb50cb, sceNpSignalingGetPeerNetInfo);
sceNp->AddFunc(0x9ad7fbd1, sceNpSignalingGetLocalNetInfo); sceNp.AddFunc(0x64dbb89d, sceNpSignalingCancelPeerNetInfo);
sceNp->AddFunc(0x75eb50cb, sceNpSignalingGetPeerNetInfo); sceNp.AddFunc(0xd0958814, sceNpSignalingGetPeerNetInfoResult);
sceNp->AddFunc(0x64dbb89d, sceNpSignalingCancelPeerNetInfo); sceNp.AddFunc(0xd208f91d, sceNpUtilCmpNpId);
sceNp->AddFunc(0xd0958814, sceNpSignalingGetPeerNetInfoResult); sceNp.AddFunc(0xf5ff5f31, sceNpUtilCmpNpIdInOrder);
sceNp->AddFunc(0xd208f91d, sceNpUtilCmpNpId); sceNp.AddFunc(0xc880f37d, sceNpUtilBandwidthTestGetStatus);
sceNp->AddFunc(0xf5ff5f31, sceNpUtilCmpNpIdInOrder); sceNp.AddFunc(0xc99ee313, sceNpUtilBandwidthTestAbort);
sceNp->AddFunc(0xc880f37d, sceNpUtilBandwidthTestGetStatus); sceNp.AddFunc(0xee0cc40c, _sceNpSysutilClientMalloc);
sceNp->AddFunc(0xc99ee313, sceNpUtilBandwidthTestAbort); sceNp.AddFunc(0x816c6a5f, _sceNpSysutilClientFree);
sceNp->AddFunc(0xee0cc40c, _sceNpSysutilClientMalloc); });
sceNp->AddFunc(0x816c6a5f, _sceNpSysutilClientFree);
}

View file

@ -6,7 +6,7 @@
#include "sceNp.h" #include "sceNp.h"
#include "sceNpClans.h" #include "sceNpClans.h"
Module *sceNpClans = nullptr; extern Module sceNpClans;
struct sceNpClansInternal struct sceNpClansInternal
{ {
@ -22,7 +22,7 @@ sceNpClansInternal sceNpClansInstance;
int sceNpClansInit(vm::ptr<SceNpCommunicationId> commId, vm::ptr<SceNpCommunicationPassphrase> passphrase, vm::ptr<void> pool, vm::ptr<u32> poolSize, u32 flags) int sceNpClansInit(vm::ptr<SceNpCommunicationId> commId, vm::ptr<SceNpCommunicationPassphrase> passphrase, vm::ptr<void> pool, vm::ptr<u32> poolSize, u32 flags)
{ {
sceNpClans->Warning("sceNpClansInit(commId_addr=0x%x, passphrase_addr=0x%x, pool_addr=0x%x,poolSize_addr=0x%x, flags=%d)", commId.addr(), passphrase.addr(), pool.addr(), poolSize.addr(), flags); sceNpClans.Warning("sceNpClansInit(commId_addr=0x%x, passphrase_addr=0x%x, pool_addr=0x%x,poolSize_addr=0x%x, flags=%d)", commId.addr(), passphrase.addr(), pool.addr(), poolSize.addr(), flags);
if (sceNpClansInstance.m_bSceNpClansInitialized) if (sceNpClansInstance.m_bSceNpClansInitialized)
return SCE_NP_CLANS_ERROR_ALREADY_INITIALIZED; return SCE_NP_CLANS_ERROR_ALREADY_INITIALIZED;
@ -37,7 +37,7 @@ int sceNpClansInit(vm::ptr<SceNpCommunicationId> commId, vm::ptr<SceNpCommunicat
int sceNpClansTerm() int sceNpClansTerm()
{ {
sceNpClans->Warning("sceNpClansTerm()"); sceNpClans.Warning("sceNpClansTerm()");
if (!sceNpClansInstance.m_bSceNpClansInitialized) if (!sceNpClansInstance.m_bSceNpClansInitialized)
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
@ -49,7 +49,7 @@ int sceNpClansTerm()
int sceNpClansCreateRequest(vm::ptr<SceNpClansRequestHandle> handle,u64 flags) int sceNpClansCreateRequest(vm::ptr<SceNpClansRequestHandle> handle,u64 flags)
{ {
sceNpClans->Todo("sceNpClansCreateRequest(handle_addr=0x%x, flags=0x%llx)", handle.addr(), flags); sceNpClans.Todo("sceNpClansCreateRequest(handle_addr=0x%x, flags=0x%llx)", handle.addr(), flags);
if (!sceNpClansInstance.m_bSceNpClansInitialized) if (!sceNpClansInstance.m_bSceNpClansInitialized)
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
@ -432,47 +432,45 @@ void sceNpClans_unload()
sceNpClansInstance.m_bSceNpClansInitialized = false; sceNpClansInstance.m_bSceNpClansInitialized = false;
} }
void sceNpClans_init(Module *pxThis) Module sceNpClans("sceNpClans", []()
{ {
sceNpClans = pxThis; sceNpClans.AddFunc(0x9b820047, sceNpClansInit);
sceNpClans.AddFunc(0x42332cb7, sceNpClansTerm);
sceNpClans->AddFunc(0x9b820047, sceNpClansInit); sceNpClans.AddFunc(0x9a72232d, sceNpClansCreateRequest);
sceNpClans->AddFunc(0x42332cb7, sceNpClansTerm); sceNpClans.AddFunc(0xd6551cd1, sceNpClansDestroyRequest);
sceNpClans->AddFunc(0x9a72232d, sceNpClansCreateRequest); sceNpClans.AddFunc(0xe82969e2, sceNpClansAbortRequest);
sceNpClans->AddFunc(0xd6551cd1, sceNpClansDestroyRequest); sceNpClans.AddFunc(0xa6a31a38, sceNpClansCreateClan);
sceNpClans->AddFunc(0xe82969e2, sceNpClansAbortRequest); sceNpClans.AddFunc(0x4826f6d5, sceNpClansDisbandClan);
sceNpClans->AddFunc(0xa6a31a38, sceNpClansCreateClan); sceNpClans.AddFunc(0xca4181b4, sceNpClansGetClanList);
sceNpClans->AddFunc(0x4826f6d5, sceNpClansDisbandClan); sceNpClans.AddFunc(0x672399a8, sceNpClansGetClanListByNpId);
sceNpClans->AddFunc(0xca4181b4, sceNpClansGetClanList); sceNpClans.AddFunc(0x1221a1bf, sceNpClansSearchByProfile);
sceNpClans->AddFunc(0x672399a8, sceNpClansGetClanListByNpId); sceNpClans.AddFunc(0xace0cfba, sceNpClansSearchByName);
sceNpClans->AddFunc(0x1221a1bf, sceNpClansSearchByProfile); sceNpClans.AddFunc(0x487de998, sceNpClansGetClanInfo);
sceNpClans->AddFunc(0xace0cfba, sceNpClansSearchByName); sceNpClans.AddFunc(0x09f9e1a9, sceNpClansUpdateClanInfo);
sceNpClans->AddFunc(0x487de998, sceNpClansGetClanInfo); sceNpClans.AddFunc(0x856ff5c0, sceNpClansGetMemberList);
sceNpClans->AddFunc(0x09f9e1a9, sceNpClansUpdateClanInfo); sceNpClans.AddFunc(0x20472da0, sceNpClansGetMemberInfo);
sceNpClans->AddFunc(0x856ff5c0, sceNpClansGetMemberList); sceNpClans.AddFunc(0xf4a2d52b, sceNpClansUpdateMemberInfo);
sceNpClans->AddFunc(0x20472da0, sceNpClansGetMemberInfo); sceNpClans.AddFunc(0x9cac2085, sceNpClansChangeMemberRole);
sceNpClans->AddFunc(0xf4a2d52b, sceNpClansUpdateMemberInfo); sceNpClans.AddFunc(0x38dadf1f, sceNpClansGetAutoAcceptStatus);
sceNpClans->AddFunc(0x9cac2085, sceNpClansChangeMemberRole); sceNpClans.AddFunc(0x5da94854, sceNpClansUpdateAutoAcceptStatus);
sceNpClans->AddFunc(0x38dadf1f, sceNpClansGetAutoAcceptStatus); sceNpClans.AddFunc(0xdbf300ca, sceNpClansJoinClan);
sceNpClans->AddFunc(0x5da94854, sceNpClansUpdateAutoAcceptStatus); sceNpClans.AddFunc(0x560f717b, sceNpClansLeaveClan);
sceNpClans->AddFunc(0xdbf300ca, sceNpClansJoinClan); sceNpClans.AddFunc(0xaa7912b5, sceNpClansKickMember);
sceNpClans->AddFunc(0x560f717b, sceNpClansLeaveClan); sceNpClans.AddFunc(0xbc05ef31, sceNpClansSendInvitation);
sceNpClans->AddFunc(0xaa7912b5, sceNpClansKickMember); sceNpClans.AddFunc(0x726dffd5, sceNpClansCancelInvitation);
sceNpClans->AddFunc(0xbc05ef31, sceNpClansSendInvitation); sceNpClans.AddFunc(0x095e12c6, sceNpClansSendInvitationResponse);
sceNpClans->AddFunc(0x726dffd5, sceNpClansCancelInvitation); sceNpClans.AddFunc(0x59743b2b, sceNpClansSendMembershipRequest);
sceNpClans->AddFunc(0x095e12c6, sceNpClansSendInvitationResponse); sceNpClans.AddFunc(0x299ccc9b, sceNpClansCancelMembershipRequest);
sceNpClans->AddFunc(0x59743b2b, sceNpClansSendMembershipRequest); sceNpClans.AddFunc(0x942dbdc4, sceNpClansSendMembershipResponse);
sceNpClans->AddFunc(0x299ccc9b, sceNpClansCancelMembershipRequest); sceNpClans.AddFunc(0x56bc5a7c, sceNpClansGetBlacklist);
sceNpClans->AddFunc(0x942dbdc4, sceNpClansSendMembershipResponse); sceNpClans.AddFunc(0x4d06aef7, sceNpClansAddBlacklistEntry);
sceNpClans->AddFunc(0x56bc5a7c, sceNpClansGetBlacklist); sceNpClans.AddFunc(0x5bff9da1, sceNpClansRemoveBlacklistEntry);
sceNpClans->AddFunc(0x4d06aef7, sceNpClansAddBlacklistEntry); sceNpClans.AddFunc(0x727aa7f8, sceNpClansRetrieveAnnouncements);
sceNpClans->AddFunc(0x5bff9da1, sceNpClansRemoveBlacklistEntry); sceNpClans.AddFunc(0xada45b84, sceNpClansPostAnnouncement);
sceNpClans->AddFunc(0x727aa7f8, sceNpClansRetrieveAnnouncements); sceNpClans.AddFunc(0xe2590f60, sceNpClansRemoveAnnouncement);
sceNpClans->AddFunc(0xada45b84, sceNpClansPostAnnouncement); sceNpClans.AddFunc(0x83d65529, sceNpClansPostChallenge);
sceNpClans->AddFunc(0xe2590f60, sceNpClansRemoveAnnouncement); sceNpClans.AddFunc(0x8e785b97, sceNpClansRetrievePostedChallenges);
sceNpClans->AddFunc(0x83d65529, sceNpClansPostChallenge); sceNpClans.AddFunc(0xd3346dc4, sceNpClansRemovePostedChallenge);
sceNpClans->AddFunc(0x8e785b97, sceNpClansRetrievePostedChallenges); sceNpClans.AddFunc(0x0df25834, sceNpClansRetrieveChallenges);
sceNpClans->AddFunc(0xd3346dc4, sceNpClansRemovePostedChallenge); sceNpClans.AddFunc(0xce6dc0f0, sceNpClansRemoveChallenge);
sceNpClans->AddFunc(0x0df25834, sceNpClansRetrieveChallenges); });
sceNpClans->AddFunc(0xce6dc0f0, sceNpClansRemoveChallenge);
}

View file

@ -4,7 +4,7 @@
#include "sceNpCommerce2.h" #include "sceNpCommerce2.h"
Module *sceNpCommerce2 = nullptr; extern Module sceNpCommerce2;
struct sceNpCommerce2Internal struct sceNpCommerce2Internal
{ {
@ -32,7 +32,7 @@ int sceNpCommerce2GetStoreBrowseUserdata()
int sceNpCommerce2Init() int sceNpCommerce2Init()
{ {
sceNpCommerce2->Warning("sceNpCommerce2Init()"); sceNpCommerce2.Warning("sceNpCommerce2Init()");
if (sceNpCommerce2Instance.m_bSceNpCommerce2Initialized) if (sceNpCommerce2Instance.m_bSceNpCommerce2Initialized)
return SCE_NP_COMMERCE2_ERROR_ALREADY_INITIALIZED; return SCE_NP_COMMERCE2_ERROR_ALREADY_INITIALIZED;
@ -44,7 +44,7 @@ int sceNpCommerce2Init()
int sceNpCommerce2Term() int sceNpCommerce2Term()
{ {
sceNpCommerce2->Warning("sceNpCommerce2Term()"); sceNpCommerce2.Warning("sceNpCommerce2Term()");
if (!sceNpCommerce2Instance.m_bSceNpCommerce2Initialized) if (!sceNpCommerce2Instance.m_bSceNpCommerce2Initialized)
return SCE_NP_COMMERCE2_ERROR_NOT_INITIALIZED; return SCE_NP_COMMERCE2_ERROR_NOT_INITIALIZED;
@ -317,55 +317,53 @@ void sceNpCommerce2_unload()
sceNpCommerce2Instance.m_bSceNpCommerce2Initialized = false; sceNpCommerce2Instance.m_bSceNpCommerce2Initialized = false;
} }
void sceNpCommerce2_init(Module *pxThis) Module sceNpCommerce2("sceNpCommerce2", []()
{ {
sceNpCommerce2 = pxThis; sceNpCommerce2.AddFunc(0xeef51be0, sceNpCommerce2ExecuteStoreBrowse);
sceNpCommerce2.AddFunc(0x1fa1b312, sceNpCommerce2GetStoreBrowseUserdata);
sceNpCommerce2->AddFunc(0xeef51be0, sceNpCommerce2ExecuteStoreBrowse); sceNpCommerce2.AddFunc(0x3539d233, sceNpCommerce2Init);
sceNpCommerce2->AddFunc(0x1fa1b312, sceNpCommerce2GetStoreBrowseUserdata); sceNpCommerce2.AddFunc(0x4d4a094c, sceNpCommerce2Term);
sceNpCommerce2->AddFunc(0x3539d233, sceNpCommerce2Init); sceNpCommerce2.AddFunc(0xd9fdcec2, sceNpCommerce2CreateCtx);
sceNpCommerce2->AddFunc(0x4d4a094c, sceNpCommerce2Term); sceNpCommerce2.AddFunc(0x6f67ea80, sceNpCommerce2DestroyCtx);
sceNpCommerce2->AddFunc(0xd9fdcec2, sceNpCommerce2CreateCtx); sceNpCommerce2.AddFunc(0xcc18cd2c, sceNpCommerce2CreateSessionStart);
sceNpCommerce2->AddFunc(0x6f67ea80, sceNpCommerce2DestroyCtx); sceNpCommerce2.AddFunc(0x62023e98, sceNpCommerce2CreateSessionAbort);
sceNpCommerce2->AddFunc(0xcc18cd2c, sceNpCommerce2CreateSessionStart); sceNpCommerce2.AddFunc(0x91f8843d, sceNpCommerce2CreateSessionFinish);
sceNpCommerce2->AddFunc(0x62023e98, sceNpCommerce2CreateSessionAbort); sceNpCommerce2.AddFunc(0x7370d8d0, sceNpCommerce2GetCategoryContentsCreateReq);
sceNpCommerce2->AddFunc(0x91f8843d, sceNpCommerce2CreateSessionFinish); sceNpCommerce2.AddFunc(0x371a2edd, sceNpCommerce2GetCategoryContentsStart);
sceNpCommerce2->AddFunc(0x7370d8d0, sceNpCommerce2GetCategoryContentsCreateReq); sceNpCommerce2.AddFunc(0xca0ea996, sceNpCommerce2GetCategoryContentsGetResult);
sceNpCommerce2->AddFunc(0x371a2edd, sceNpCommerce2GetCategoryContentsStart); sceNpCommerce2.AddFunc(0xd8a473a3, sceNpCommerce2InitGetCategoryContentsResult);
sceNpCommerce2->AddFunc(0xca0ea996, sceNpCommerce2GetCategoryContentsGetResult); sceNpCommerce2.AddFunc(0xbd49eab2, sceNpCommerce2GetCategoryInfo);
sceNpCommerce2->AddFunc(0xd8a473a3, sceNpCommerce2InitGetCategoryContentsResult); sceNpCommerce2.AddFunc(0x972ab46c, sceNpCommerce2GetContentInfo);
sceNpCommerce2->AddFunc(0xbd49eab2, sceNpCommerce2GetCategoryInfo); sceNpCommerce2.AddFunc(0xfc216890, sceNpCommerce2GetCategoryInfoFromContentInfo);
sceNpCommerce2->AddFunc(0x972ab46c, sceNpCommerce2GetContentInfo); sceNpCommerce2.AddFunc(0xe51a4944, sceNpCommerce2GetGameProductInfoFromContentInfo);
sceNpCommerce2->AddFunc(0xfc216890, sceNpCommerce2GetCategoryInfoFromContentInfo); sceNpCommerce2.AddFunc(0x9d9cb96b, sceNpCommerce2DestroyGetCategoryContentsResult);
sceNpCommerce2->AddFunc(0xe51a4944, sceNpCommerce2GetGameProductInfoFromContentInfo); sceNpCommerce2.AddFunc(0xa975ebb4, sceNpCommerce2GetProductInfoCreateReq);
sceNpCommerce2->AddFunc(0x9d9cb96b, sceNpCommerce2DestroyGetCategoryContentsResult); sceNpCommerce2.AddFunc(0x8f46325b, sceNpCommerce2GetProductInfoStart);
sceNpCommerce2->AddFunc(0xa975ebb4, sceNpCommerce2GetProductInfoCreateReq); sceNpCommerce2.AddFunc(0xbf5f58ea, sceNpCommerce2GetProductInfoGetResult);
sceNpCommerce2->AddFunc(0x8f46325b, sceNpCommerce2GetProductInfoStart); sceNpCommerce2.AddFunc(0xf798f5e3, sceNpCommerce2InitGetProductInfoResult);
sceNpCommerce2->AddFunc(0xbf5f58ea, sceNpCommerce2GetProductInfoGetResult); sceNpCommerce2.AddFunc(0xef645654, sceNpCommerce2GetGameProductInfo);
sceNpCommerce2->AddFunc(0xf798f5e3, sceNpCommerce2InitGetProductInfoResult); sceNpCommerce2.AddFunc(0xef8eafcd, sceNpCommerce2DestroyGetProductInfoResult);
sceNpCommerce2->AddFunc(0xef645654, sceNpCommerce2GetGameProductInfo); sceNpCommerce2.AddFunc(0xe1e7b5ac, sceNpCommerce2GetProductInfoListCreateReq);
sceNpCommerce2->AddFunc(0xef8eafcd, sceNpCommerce2DestroyGetProductInfoResult); sceNpCommerce2.AddFunc(0x9cde07cc, sceNpCommerce2GetProductInfoListStart);
sceNpCommerce2->AddFunc(0xe1e7b5ac, sceNpCommerce2GetProductInfoListCreateReq); sceNpCommerce2.AddFunc(0x146618df, sceNpCommerce2GetProductInfoListGetResult);
sceNpCommerce2->AddFunc(0x9cde07cc, sceNpCommerce2GetProductInfoListStart); sceNpCommerce2.AddFunc(0xe0f90e44, sceNpCommerce2InitGetProductInfoListResult);
sceNpCommerce2->AddFunc(0x146618df, sceNpCommerce2GetProductInfoListGetResult); sceNpCommerce2.AddFunc(0xd9956ce7, sceNpCommerce2GetGameProductInfoFromGetProductInfoListResult);
sceNpCommerce2->AddFunc(0xe0f90e44, sceNpCommerce2InitGetProductInfoListResult); sceNpCommerce2.AddFunc(0xf6139b58, sceNpCommerce2DestroyGetProductInfoListResult);
sceNpCommerce2->AddFunc(0xd9956ce7, sceNpCommerce2GetGameProductInfoFromGetProductInfoListResult); sceNpCommerce2.AddFunc(0xec324c8f, sceNpCommerce2GetContentRatingInfoFromGameProductInfo);
sceNpCommerce2->AddFunc(0xf6139b58, sceNpCommerce2DestroyGetProductInfoListResult); sceNpCommerce2.AddFunc(0xac78c1f3, sceNpCommerce2GetContentRatingInfoFromCategoryInfo);
sceNpCommerce2->AddFunc(0xec324c8f, sceNpCommerce2GetContentRatingInfoFromGameProductInfo); sceNpCommerce2.AddFunc(0x150fdca3, sceNpCommerce2GetContentRatingDescriptor);
sceNpCommerce2->AddFunc(0xac78c1f3, sceNpCommerce2GetContentRatingInfoFromCategoryInfo); sceNpCommerce2.AddFunc(0xdb19194c, sceNpCommerce2GetGameSkuInfoFromGameProductInfo);
sceNpCommerce2->AddFunc(0x150fdca3, sceNpCommerce2GetContentRatingDescriptor); sceNpCommerce2.AddFunc(0xda8e322d, sceNpCommerce2GetPrice);
sceNpCommerce2->AddFunc(0xdb19194c, sceNpCommerce2GetGameSkuInfoFromGameProductInfo); sceNpCommerce2.AddFunc(0x104551a6, sceNpCommerce2DoCheckoutStartAsync);
sceNpCommerce2->AddFunc(0xda8e322d, sceNpCommerce2GetPrice); sceNpCommerce2.AddFunc(0xd43a130e, sceNpCommerce2DoCheckoutFinishAsync);
sceNpCommerce2->AddFunc(0x104551a6, sceNpCommerce2DoCheckoutStartAsync); sceNpCommerce2.AddFunc(0x9825a0fc, sceNpCommerce2DoProductBrowseStartAsync);
sceNpCommerce2->AddFunc(0xd43a130e, sceNpCommerce2DoCheckoutFinishAsync); sceNpCommerce2.AddFunc(0xb23e3bd1, sceNpCommerce2DoProductBrowseFinishAsync);
sceNpCommerce2->AddFunc(0x9825a0fc, sceNpCommerce2DoProductBrowseStartAsync); sceNpCommerce2.AddFunc(0x6ca9efd4, sceNpCommerce2DoDlListStartAsync);
sceNpCommerce2->AddFunc(0xb23e3bd1, sceNpCommerce2DoProductBrowseFinishAsync); sceNpCommerce2.AddFunc(0x410d42be, sceNpCommerce2DoDlListFinishAsync);
sceNpCommerce2->AddFunc(0x6ca9efd4, sceNpCommerce2DoDlListStartAsync); sceNpCommerce2.AddFunc(0xde7ab33d, sceNpCommerce2DoProductCodeStartAsync);
sceNpCommerce2->AddFunc(0x410d42be, sceNpCommerce2DoDlListFinishAsync); sceNpCommerce2.AddFunc(0xa9f945b3, sceNpCommerce2DoProductCodeFinishAsync);
sceNpCommerce2->AddFunc(0xde7ab33d, sceNpCommerce2DoProductCodeStartAsync); sceNpCommerce2.AddFunc(0x3d627d81, sceNpCommerce2GetBGDLAvailability);
sceNpCommerce2->AddFunc(0xa9f945b3, sceNpCommerce2DoProductCodeFinishAsync); sceNpCommerce2.AddFunc(0xa5a863fe, sceNpCommerce2SetBGDLAvailability);
sceNpCommerce2->AddFunc(0x3d627d81, sceNpCommerce2GetBGDLAvailability); sceNpCommerce2.AddFunc(0x8df0057f, sceNpCommerce2AbortReq);
sceNpCommerce2->AddFunc(0xa5a863fe, sceNpCommerce2SetBGDLAvailability); sceNpCommerce2.AddFunc(0x2a910f05, sceNpCommerce2DestroyReq);
sceNpCommerce2->AddFunc(0x8df0057f, sceNpCommerce2AbortReq); });
sceNpCommerce2->AddFunc(0x2a910f05, sceNpCommerce2DestroyReq);
}

View file

@ -2,16 +2,14 @@
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
#include "sceNpSns.h" #include "sceNpSns.h"
Module *sceNpSns = nullptr; extern Module sceNpSns;
void sceNpSns_unload() void sceNpSns_unload()
{ {
// TODO: Unload SNS module // TODO: Unload SNS module
} }
void sceNpSns_init(Module *pxThis) Module sceNpSns("sceNpSns", []()
{ {
sceNpSns = pxThis;
// TODO: Register SNS module functions here // TODO: Register SNS module functions here
} });

View file

@ -15,7 +15,7 @@
#include "sceNp.h" #include "sceNp.h"
#include "sceNpTrophy.h" #include "sceNpTrophy.h"
Module *sceNpTrophy = nullptr; extern Module sceNpTrophy;
// Internal Structs // Internal Structs
struct sceNpTrophyInternalContext struct sceNpTrophyInternalContext
@ -79,7 +79,7 @@ static sceNpTrophyInternalContext& getContext(u32 context) {
// Functions // Functions
int sceNpTrophyInit(u32 pool_addr, u32 poolSize, u32 containerId, u64 options) int sceNpTrophyInit(u32 pool_addr, u32 poolSize, u32 containerId, u64 options)
{ {
sceNpTrophy->Log("sceNpTrophyInit(pool_addr=0x%x, poolSize=%d, containerId=%d, options=0x%llx)", pool_addr, poolSize, containerId, options); sceNpTrophy.Log("sceNpTrophyInit(pool_addr=0x%x, poolSize=%d, containerId=%d, options=0x%llx)", pool_addr, poolSize, containerId, options);
if (sceNpTrophyInstance.m_bInitialized) if (sceNpTrophyInstance.m_bInitialized)
return SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED; return SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED;
@ -93,7 +93,7 @@ int sceNpTrophyInit(u32 pool_addr, u32 poolSize, u32 containerId, u64 options)
int sceNpTrophyCreateContext(vm::ptr<u32> context, vm::ptr<SceNpCommunicationId> commID, vm::ptr<SceNpCommunicationSignature> commSign, u64 options) int sceNpTrophyCreateContext(vm::ptr<u32> context, vm::ptr<SceNpCommunicationId> commID, vm::ptr<SceNpCommunicationSignature> commSign, u64 options)
{ {
sceNpTrophy->Warning("sceNpTrophyCreateContext(context_addr=0x%x, commID_addr=0x%x, commSign_addr=0x%x, options=0x%llx)", sceNpTrophy.Warning("sceNpTrophyCreateContext(context_addr=0x%x, commID_addr=0x%x, commSign_addr=0x%x, options=0x%llx)",
context.addr(), commID.addr(), commSign.addr(), options); context.addr(), commID.addr(), commSign.addr(), options);
if (!sceNpTrophyInstance.m_bInitialized) if (!sceNpTrophyInstance.m_bInitialized)
@ -132,7 +132,7 @@ int sceNpTrophyCreateContext(vm::ptr<u32> context, vm::ptr<SceNpCommunicationId>
int sceNpTrophyCreateHandle(vm::ptr<u32> handle) int sceNpTrophyCreateHandle(vm::ptr<u32> handle)
{ {
sceNpTrophy->Todo("sceNpTrophyCreateHandle(handle_addr=0x%x)", handle.addr()); sceNpTrophy.Todo("sceNpTrophyCreateHandle(handle_addr=0x%x)", handle.addr());
if (!sceNpTrophyInstance.m_bInitialized) if (!sceNpTrophyInstance.m_bInitialized)
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
@ -145,7 +145,7 @@ int sceNpTrophyCreateHandle(vm::ptr<u32> handle)
int sceNpTrophyRegisterContext(u32 context, u32 handle, vm::ptr<SceNpTrophyStatusCallback> statusCb, u32 arg_addr, u64 options) int sceNpTrophyRegisterContext(u32 context, u32 handle, vm::ptr<SceNpTrophyStatusCallback> statusCb, u32 arg_addr, u64 options)
{ {
sceNpTrophy->Warning("sceNpTrophyRegisterContext(context=%d, handle=%d, statusCb_addr=0x%x, arg_addr=0x%x, options=0x%llx)", sceNpTrophy.Warning("sceNpTrophyRegisterContext(context=%d, handle=%d, statusCb_addr=0x%x, arg_addr=0x%x, options=0x%llx)",
context, handle, statusCb.addr(), arg_addr, options); context, handle, statusCb.addr(), arg_addr, options);
if (!(sceNpTrophyInstance.m_bInitialized)) if (!(sceNpTrophyInstance.m_bInitialized))
@ -153,7 +153,7 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, vm::ptr<SceNpTrophyStatu
if (options & (~(u64)1)) if (options & (~(u64)1))
return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED; return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED;
if (context == 0 || context > sceNpTrophyInstance.contexts.size()) { if (context == 0 || context > sceNpTrophyInstance.contexts.size()) {
sceNpTrophy->Warning("sceNpTrophyRegisterContext: invalid context (%d)", context); sceNpTrophy.Warning("sceNpTrophyRegisterContext: invalid context (%d)", context);
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT; return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
} }
// TODO: There are other possible errors // TODO: There are other possible errors
@ -224,13 +224,13 @@ int sceNpTrophySetSoundLevel()
int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<u64> reqspace, u64 options) int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<u64> reqspace, u64 options)
{ {
sceNpTrophy->Warning("sceNpTrophyGetRequiredDiskSpace(context=%d, handle=%d, reqspace_addr=0x%x, options=0x%llx)", sceNpTrophy.Warning("sceNpTrophyGetRequiredDiskSpace(context=%d, handle=%d, reqspace_addr=0x%x, options=0x%llx)",
context, handle, reqspace.addr(), options); context, handle, reqspace.addr(), options);
if (!sceNpTrophyInstance.m_bInitialized) if (!sceNpTrophyInstance.m_bInitialized)
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
if (context == 0 || context > sceNpTrophyInstance.contexts.size()) { if (context == 0 || context > sceNpTrophyInstance.contexts.size()) {
sceNpTrophy->Warning("sceNpTrophyGetRequiredDiskSpace: invalid context (%d)", context); sceNpTrophy.Warning("sceNpTrophyGetRequiredDiskSpace: invalid context (%d)", context);
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT; return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
} }
// TODO: There are other possible errors // TODO: There are other possible errors
@ -251,7 +251,7 @@ int sceNpTrophyDestroyContext()
int sceNpTrophyAbortHandle(u32 handle) int sceNpTrophyAbortHandle(u32 handle)
{ {
sceNpTrophy->Todo("sceNpTrophyAbortHandle(handle=%d)", handle); sceNpTrophy.Todo("sceNpTrophyAbortHandle(handle=%d)", handle);
// TODO: ? // TODO: ?
@ -263,7 +263,7 @@ int sceNpTrophyAbortHandle(u32 handle)
int sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr<SceNpTrophyGameDetails> details, vm::ptr<SceNpTrophyGameData> data) int sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr<SceNpTrophyGameDetails> details, vm::ptr<SceNpTrophyGameData> data)
{ {
sceNpTrophy->Warning("sceNpTrophyGetGameInfo(context=%d, handle=%d, details_addr=0x%x, data_addr=0x%x)", sceNpTrophy.Warning("sceNpTrophyGetGameInfo(context=%d, handle=%d, details_addr=0x%x, data_addr=0x%x)",
context, handle, details.addr(), data.addr()); context, handle, details.addr(), data.addr());
if (!sceNpTrophyInstance.m_bInitialized) if (!sceNpTrophyInstance.m_bInitialized)
@ -321,7 +321,7 @@ int sceNpTrophyDestroyHandle()
int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptr<u32> platinumId) int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptr<u32> platinumId)
{ {
sceNpTrophy->Warning("sceNpTrophyUnlockTrophy(context=%d, handle=%d, trophyId=%d, platinumId_addr=0x%x)", sceNpTrophy.Warning("sceNpTrophyUnlockTrophy(context=%d, handle=%d, trophyId=%d, platinumId_addr=0x%x)",
context, handle, trophyId, platinumId.addr()); context, handle, trophyId, platinumId.addr());
if (!sceNpTrophyInstance.m_bInitialized) if (!sceNpTrophyInstance.m_bInitialized)
@ -346,7 +346,7 @@ int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptr<u32>
int sceNpTrophyTerm() int sceNpTrophyTerm()
{ {
sceNpTrophy->Warning("sceNpTrophyTerm()"); sceNpTrophy.Warning("sceNpTrophyTerm()");
if (!sceNpTrophyInstance.m_bInitialized) if (!sceNpTrophyInstance.m_bInitialized)
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
@ -358,13 +358,13 @@ int sceNpTrophyTerm()
int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr<SceNpTrophyFlagArray> flags, vm::ptr<u32> count) int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr<SceNpTrophyFlagArray> flags, vm::ptr<u32> count)
{ {
sceNpTrophy->Warning("sceNpTrophyGetTrophyUnlockState(context=%d, handle=%d, flags_addr=0x%x, count_addr=0x%x)", sceNpTrophy.Warning("sceNpTrophyGetTrophyUnlockState(context=%d, handle=%d, flags_addr=0x%x, count_addr=0x%x)",
context, handle, flags.addr(), count.addr()); context, handle, flags.addr(), count.addr());
if (!sceNpTrophyInstance.m_bInitialized) if (!sceNpTrophyInstance.m_bInitialized)
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
if (context == 0 || context > sceNpTrophyInstance.contexts.size()) { if (context == 0 || context > sceNpTrophyInstance.contexts.size()) {
sceNpTrophy->Warning("sceNpTrophyGetTrophyUnlockState: invalid context (%d)", context); sceNpTrophy.Warning("sceNpTrophyGetTrophyUnlockState: invalid context (%d)", context);
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT; return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
} }
// TODO: There are other possible errors // TODO: There are other possible errors
@ -373,7 +373,7 @@ int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr<SceNpTrophy
u32 count_ = ctxt.tropusr->GetTrophiesCount(); u32 count_ = ctxt.tropusr->GetTrophiesCount();
*count = count_; *count = count_;
if (count_ > 128) if (count_ > 128)
sceNpTrophy->Warning("sceNpTrophyGetTrophyUnlockState: More than 128 trophies detected!"); sceNpTrophy.Warning("sceNpTrophyGetTrophyUnlockState: More than 128 trophies detected!");
// Pack up to 128 bools in u32 flag_bits[4] // Pack up to 128 bools in u32 flag_bits[4]
for (u32 id = 0; id < count_; id++) for (u32 id = 0; id < count_; id++)
@ -395,7 +395,7 @@ int sceNpTrophyGetTrophyIcon()
int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptr<SceNpTrophyDetails> details, vm::ptr<SceNpTrophyData> data) int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptr<SceNpTrophyDetails> details, vm::ptr<SceNpTrophyData> data)
{ {
sceNpTrophy->Warning("sceNpTrophyGetTrophyInfo(context=%d, handle=%d, trophyId=%d, details_addr=0x%x, data_addr=0x%x)", sceNpTrophy.Warning("sceNpTrophyGetTrophyInfo(context=%d, handle=%d, trophyId=%d, details_addr=0x%x, data_addr=0x%x)",
context, handle, trophyId, details.addr(), data.addr()); context, handle, trophyId, details.addr(), data.addr());
if (!sceNpTrophyInstance.m_bInitialized) if (!sceNpTrophyInstance.m_bInitialized)
@ -453,25 +453,23 @@ void sceNpTrophy_unload()
sceNpTrophyInstance.m_bInitialized = false; sceNpTrophyInstance.m_bInitialized = false;
} }
void sceNpTrophy_init(Module *pxThis) Module sceNpTrophy("sceNpTrophy", []()
{ {
sceNpTrophy = pxThis; sceNpTrophy.AddFunc(0x079f0e87, sceNpTrophyGetGameProgress);
sceNpTrophy.AddFunc(0x1197b52c, sceNpTrophyRegisterContext);
sceNpTrophy->AddFunc(0x079f0e87, sceNpTrophyGetGameProgress); sceNpTrophy.AddFunc(0x1c25470d, sceNpTrophyCreateHandle);
sceNpTrophy->AddFunc(0x1197b52c, sceNpTrophyRegisterContext); sceNpTrophy.AddFunc(0x27deda93, sceNpTrophySetSoundLevel);
sceNpTrophy->AddFunc(0x1c25470d, sceNpTrophyCreateHandle); sceNpTrophy.AddFunc(0x370136fe, sceNpTrophyGetRequiredDiskSpace);
sceNpTrophy->AddFunc(0x27deda93, sceNpTrophySetSoundLevel); sceNpTrophy.AddFunc(0x3741ecc7, sceNpTrophyDestroyContext);
sceNpTrophy->AddFunc(0x370136fe, sceNpTrophyGetRequiredDiskSpace); sceNpTrophy.AddFunc(0x39567781, sceNpTrophyInit);
sceNpTrophy->AddFunc(0x3741ecc7, sceNpTrophyDestroyContext); sceNpTrophy.AddFunc(0x48bd97c7, sceNpTrophyAbortHandle);
sceNpTrophy->AddFunc(0x39567781, sceNpTrophyInit); sceNpTrophy.AddFunc(0x49d18217, sceNpTrophyGetGameInfo);
sceNpTrophy->AddFunc(0x48bd97c7, sceNpTrophyAbortHandle); sceNpTrophy.AddFunc(0x623cd2dc, sceNpTrophyDestroyHandle);
sceNpTrophy->AddFunc(0x49d18217, sceNpTrophyGetGameInfo); sceNpTrophy.AddFunc(0x8ceedd21, sceNpTrophyUnlockTrophy);
sceNpTrophy->AddFunc(0x623cd2dc, sceNpTrophyDestroyHandle); sceNpTrophy.AddFunc(0xa7fabf4d, sceNpTrophyTerm);
sceNpTrophy->AddFunc(0x8ceedd21, sceNpTrophyUnlockTrophy); sceNpTrophy.AddFunc(0xb3ac3478, sceNpTrophyGetTrophyUnlockState);
sceNpTrophy->AddFunc(0xa7fabf4d, sceNpTrophyTerm); sceNpTrophy.AddFunc(0xbaedf689, sceNpTrophyGetTrophyIcon);
sceNpTrophy->AddFunc(0xb3ac3478, sceNpTrophyGetTrophyUnlockState); sceNpTrophy.AddFunc(0xe3bf9a28, sceNpTrophyCreateContext);
sceNpTrophy->AddFunc(0xbaedf689, sceNpTrophyGetTrophyIcon); sceNpTrophy.AddFunc(0xfce6d30a, sceNpTrophyGetTrophyInfo);
sceNpTrophy->AddFunc(0xe3bf9a28, sceNpTrophyCreateContext); sceNpTrophy.AddFunc(0xff299e03, sceNpTrophyGetGameIcon);
sceNpTrophy->AddFunc(0xfce6d30a, sceNpTrophyGetTrophyInfo); });
sceNpTrophy->AddFunc(0xff299e03, sceNpTrophyGetGameIcon);
}

View file

@ -5,7 +5,7 @@
#include "sceNp.h" #include "sceNp.h"
#include "sceNpTus.h" #include "sceNpTus.h"
Module *sceNpTus = nullptr; extern Module sceNpTus;
struct sceNpTusInternal struct sceNpTusInternal
{ {
@ -21,7 +21,7 @@ sceNpTusInternal sceNpTusInstance;
int sceNpTusInit() int sceNpTusInit()
{ {
sceNpTus->Warning("sceNpTusInit()"); sceNpTus.Warning("sceNpTusInit()");
if (sceNpTusInstance.m_bSceNpTusInitialized) if (sceNpTusInstance.m_bSceNpTusInitialized)
return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED; return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED;
@ -33,7 +33,7 @@ int sceNpTusInit()
int sceNpTusTerm() int sceNpTusTerm()
{ {
sceNpTus->Warning("sceNpTusTerm()"); sceNpTus.Warning("sceNpTusTerm()");
if (!sceNpTusInstance.m_bSceNpTusInitialized) if (!sceNpTusInstance.m_bSceNpTusInitialized)
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
@ -568,62 +568,60 @@ void sceNpTus_unload()
sceNpTusInstance.m_bSceNpTusInitialized = false; sceNpTusInstance.m_bSceNpTusInitialized = false;
} }
void sceNpTus_init(Module *pxThis) Module sceNpTus("sceNpTus", []()
{ {
sceNpTus = pxThis; sceNpTus.AddFunc(0x8f87a06b, sceNpTusInit);
sceNpTus.AddFunc(0x225aed26, sceNpTusTerm);
sceNpTus->AddFunc(0x8f87a06b, sceNpTusInit); sceNpTus.AddFunc(0x7caf58ee, sceNpTusCreateTitleCtx);
sceNpTus->AddFunc(0x225aed26, sceNpTusTerm); sceNpTus.AddFunc(0x2e162a62, sceNpTusDestroyTitleCtx);
sceNpTus->AddFunc(0x7caf58ee, sceNpTusCreateTitleCtx); sceNpTus.AddFunc(0x1904435e, sceNpTusCreateTransactionCtx);
sceNpTus->AddFunc(0x2e162a62, sceNpTusDestroyTitleCtx); sceNpTus.AddFunc(0x44eca8b4, sceNpTusDestroyTransactionCtx);
sceNpTus->AddFunc(0x1904435e, sceNpTusCreateTransactionCtx); sceNpTus.AddFunc(0x59432970, sceNpTusSetTimeout);
sceNpTus->AddFunc(0x44eca8b4, sceNpTusDestroyTransactionCtx); sceNpTus.AddFunc(0x325c6284, sceNpTusAbortTransaction);
sceNpTus->AddFunc(0x59432970, sceNpTusSetTimeout); sceNpTus.AddFunc(0xb8e8ff22, sceNpTusWaitAsync);
sceNpTus->AddFunc(0x325c6284, sceNpTusAbortTransaction); sceNpTus.AddFunc(0x19bce18c, sceNpTusPollAsync);
sceNpTus->AddFunc(0xb8e8ff22, sceNpTusWaitAsync); sceNpTus.AddFunc(0xcc86a8f6, sceNpTusSetMultiSlotVariable);
sceNpTus->AddFunc(0x19bce18c, sceNpTusPollAsync); sceNpTus.AddFunc(0xf819be91, sceNpTusSetMultiSlotVariableVUser);
sceNpTus->AddFunc(0xcc86a8f6, sceNpTusSetMultiSlotVariable); sceNpTus.AddFunc(0x065b610d, sceNpTusSetMultiSlotVariableAsync);
sceNpTus->AddFunc(0xf819be91, sceNpTusSetMultiSlotVariableVUser); sceNpTus.AddFunc(0x96a06212, sceNpTusSetMultiSlotVariableVUserAsync);
sceNpTus->AddFunc(0x065b610d, sceNpTusSetMultiSlotVariableAsync); sceNpTus.AddFunc(0x0423e622, sceNpTusGetMultiSlotVariable);
sceNpTus->AddFunc(0x96a06212, sceNpTusSetMultiSlotVariableVUserAsync); sceNpTus.AddFunc(0x2357ba9e, sceNpTusGetMultiSlotVariableVUser);
sceNpTus->AddFunc(0x0423e622, sceNpTusGetMultiSlotVariable); sceNpTus.AddFunc(0xbb2877f2, sceNpTusGetMultiSlotVariableAsync);
sceNpTus->AddFunc(0x2357ba9e, sceNpTusGetMultiSlotVariableVUser); sceNpTus.AddFunc(0xfc7d346e, sceNpTusGetMultiSlotVariableVUserAsync);
sceNpTus->AddFunc(0xbb2877f2, sceNpTusGetMultiSlotVariableAsync); sceNpTus.AddFunc(0x0d15043b, sceNpTusGetMultiUserVariable);
sceNpTus->AddFunc(0xfc7d346e, sceNpTusGetMultiSlotVariableVUserAsync); sceNpTus.AddFunc(0x6c511024, sceNpTusGetMultiUserVariableVUser);
sceNpTus->AddFunc(0x0d15043b, sceNpTusGetMultiUserVariable); sceNpTus.AddFunc(0xcc7a31cd, sceNpTusGetMultiUserVariableAsync);
sceNpTus->AddFunc(0x6c511024, sceNpTusGetMultiUserVariableVUser); sceNpTus.AddFunc(0x9549d22c, sceNpTusGetMultiUserVariableVUserAsync);
sceNpTus->AddFunc(0xcc7a31cd, sceNpTusGetMultiUserVariableAsync); sceNpTus.AddFunc(0x94989003, sceNpTusAddAndGetVariable);
sceNpTus->AddFunc(0x9549d22c, sceNpTusGetMultiUserVariableVUserAsync); sceNpTus.AddFunc(0xf60be06f, sceNpTusAddAndGetVariableVUser);
sceNpTus->AddFunc(0x94989003, sceNpTusAddAndGetVariable); sceNpTus.AddFunc(0x1fa5c87d, sceNpTusAddAndGetVariableAsync);
sceNpTus->AddFunc(0xf60be06f, sceNpTusAddAndGetVariableVUser); sceNpTus.AddFunc(0xa7993bf3, sceNpTusAddAndGetVariableVUserAsync);
sceNpTus->AddFunc(0x1fa5c87d, sceNpTusAddAndGetVariableAsync); sceNpTus.AddFunc(0x47e9424a, sceNpTusTryAndSetVariable);
sceNpTus->AddFunc(0xa7993bf3, sceNpTusAddAndGetVariableVUserAsync); sceNpTus.AddFunc(0x3602bc80, sceNpTusTryAndSetVariableVUser);
sceNpTus->AddFunc(0x47e9424a, sceNpTusTryAndSetVariable); sceNpTus.AddFunc(0xbbb244b7, sceNpTusTryAndSetVariableAsync);
sceNpTus->AddFunc(0x3602bc80, sceNpTusTryAndSetVariableVUser); sceNpTus.AddFunc(0x17db7aa7, sceNpTusTryAndSetVariableVUserAsync);
sceNpTus->AddFunc(0xbbb244b7, sceNpTusTryAndSetVariableAsync); sceNpTus.AddFunc(0xaf985783, sceNpTusDeleteMultiSlotVariable);
sceNpTus->AddFunc(0x17db7aa7, sceNpTusTryAndSetVariableVUserAsync); sceNpTus.AddFunc(0xc4e51fbf, sceNpTusDeleteMultiSlotVariableVUser);
sceNpTus->AddFunc(0xaf985783, sceNpTusDeleteMultiSlotVariable); sceNpTus.AddFunc(0xf5363608, sceNpTusDeleteMultiSlotVariableAsync);
sceNpTus->AddFunc(0xc4e51fbf, sceNpTusDeleteMultiSlotVariableVUser); sceNpTus.AddFunc(0xc2e18da8, sceNpTusDeleteMultiSlotVariableVUserAsync);
sceNpTus->AddFunc(0xf5363608, sceNpTusDeleteMultiSlotVariableAsync); sceNpTus.AddFunc(0x7d5f0f0e, sceNpTusSetData);
sceNpTus->AddFunc(0xc2e18da8, sceNpTusDeleteMultiSlotVariableVUserAsync); sceNpTus.AddFunc(0x0835deb2, sceNpTusSetDataVUser);
sceNpTus->AddFunc(0x7d5f0f0e, sceNpTusSetData); sceNpTus.AddFunc(0xe847341f, sceNpTusSetDataAsync);
sceNpTus->AddFunc(0x0835deb2, sceNpTusSetDataVUser); sceNpTus.AddFunc(0x9cc0cf44, sceNpTusSetDataVUserAsync);
sceNpTus->AddFunc(0xe847341f, sceNpTusSetDataAsync); sceNpTus.AddFunc(0x8ddd0d85, sceNpTusGetData);
sceNpTus->AddFunc(0x9cc0cf44, sceNpTusSetDataVUserAsync); sceNpTus.AddFunc(0xae4e590e, sceNpTusGetDataVUser);
sceNpTus->AddFunc(0x8ddd0d85, sceNpTusGetData); sceNpTus.AddFunc(0x5175abb9, sceNpTusGetDataAsync);
sceNpTus->AddFunc(0xae4e590e, sceNpTusGetDataVUser); sceNpTus.AddFunc(0x38f364b0, sceNpTusGetDataVUserAsync);
sceNpTus->AddFunc(0x5175abb9, sceNpTusGetDataAsync); sceNpTus.AddFunc(0xc848d425, sceNpTusGetMultiSlotDataStatus);
sceNpTus->AddFunc(0x38f364b0, sceNpTusGetDataVUserAsync); sceNpTus.AddFunc(0xa3abfadb, sceNpTusGetMultiSlotDataStatusVUser);
sceNpTus->AddFunc(0xc848d425, sceNpTusGetMultiSlotDataStatus); sceNpTus.AddFunc(0x651fd79f, sceNpTusGetMultiSlotDataStatusAsync);
sceNpTus->AddFunc(0xa3abfadb, sceNpTusGetMultiSlotDataStatusVUser); sceNpTus.AddFunc(0x2ab21ea9, sceNpTusGetMultiSlotDataStatusVUserAsync);
sceNpTus->AddFunc(0x651fd79f, sceNpTusGetMultiSlotDataStatusAsync); sceNpTus.AddFunc(0x348dbcb4, sceNpTusGetMultiUserDataStatus);
sceNpTus->AddFunc(0x2ab21ea9, sceNpTusGetMultiSlotDataStatusVUserAsync); sceNpTus.AddFunc(0x2d1b9f1a, sceNpTusGetMultiUserDataStatusVUser);
sceNpTus->AddFunc(0x348dbcb4, sceNpTusGetMultiUserDataStatus); sceNpTus.AddFunc(0xc66ba67e, sceNpTusGetMultiUserDataStatusAsync);
sceNpTus->AddFunc(0x2d1b9f1a, sceNpTusGetMultiUserDataStatusVUser); sceNpTus.AddFunc(0x368fec59, sceNpTusGetMultiUserDataStatusVUserAsync);
sceNpTus->AddFunc(0xc66ba67e, sceNpTusGetMultiUserDataStatusAsync); sceNpTus.AddFunc(0xe0719847, sceNpTusDeleteMultiSlotData);
sceNpTus->AddFunc(0x368fec59, sceNpTusGetMultiUserDataStatusVUserAsync); sceNpTus.AddFunc(0x01711e81, sceNpTusDeleteMultiSlotDataVUser);
sceNpTus->AddFunc(0xe0719847, sceNpTusDeleteMultiSlotData); sceNpTus.AddFunc(0x3175af23, sceNpTusDeleteMultiSlotDataAsync);
sceNpTus->AddFunc(0x01711e81, sceNpTusDeleteMultiSlotDataVUser); sceNpTus.AddFunc(0xc815b219, sceNpTusDeleteMultiSlotDataVUserAsync);
sceNpTus->AddFunc(0x3175af23, sceNpTusDeleteMultiSlotDataAsync); });
sceNpTus->AddFunc(0xc815b219, sceNpTusDeleteMultiSlotDataVUserAsync);
}

View file

@ -21,7 +21,7 @@
#include "Emu/Cell/RawSPUThread.h" #include "Emu/Cell/RawSPUThread.h"
#include "sysPrxForUser.h" #include "sysPrxForUser.h"
Module *sysPrxForUser = nullptr; extern Module sysPrxForUser;
#define TLS_MAX 128 #define TLS_MAX 128
#define TLS_SYS 0x30 #define TLS_SYS 0x30
@ -33,7 +33,7 @@ std::array<std::atomic<u32>, TLS_MAX> g_tls_owners;
void sys_initialize_tls() void sys_initialize_tls()
{ {
sysPrxForUser->Log("sys_initialize_tls()"); sysPrxForUser.Log("sys_initialize_tls()");
} }
u32 ppu_get_tls(u32 thread) u32 ppu_get_tls(u32 thread)
@ -42,7 +42,7 @@ u32 ppu_get_tls(u32 thread)
{ {
g_tls_size = Emu.GetTLSMemsz() + TLS_SYS; g_tls_size = Emu.GetTLSMemsz() + TLS_SYS;
g_tls_start = Memory.MainMem.AllocAlign(g_tls_size * TLS_MAX, 4096); // memory for up to TLS_MAX threads g_tls_start = Memory.MainMem.AllocAlign(g_tls_size * TLS_MAX, 4096); // memory for up to TLS_MAX threads
sysPrxForUser->Notice("Thread Local Storage initialized (g_tls_start=0x%x, user_size=0x%x)\n*** TLS segment addr: 0x%08x\n*** TLS segment size: 0x%08x", sysPrxForUser.Notice("Thread Local Storage initialized (g_tls_start=0x%x, user_size=0x%x)\n*** TLS segment addr: 0x%08x\n*** TLS segment size: 0x%08x",
g_tls_start, Emu.GetTLSMemsz(), Emu.GetTLSAddr(), Emu.GetTLSFilesz()); g_tls_start, Emu.GetTLSMemsz(), Emu.GetTLSAddr(), Emu.GetTLSFilesz());
} }
@ -89,49 +89,49 @@ void ppu_free_tls(u32 thread)
int _sys_heap_create_heap(const u32 heap_addr, const u32 align, const u32 size) int _sys_heap_create_heap(const u32 heap_addr, const u32 align, const u32 size)
{ {
sysPrxForUser->Warning("_sys_heap_create_heap(heap_addr=0x%x, align=0x%x, size=0x%x)", heap_addr, align, size); sysPrxForUser.Warning("_sys_heap_create_heap(heap_addr=0x%x, align=0x%x, size=0x%x)", heap_addr, align, size);
std::shared_ptr<HeapInfo> heap(new HeapInfo(heap_addr, align, size)); std::shared_ptr<HeapInfo> heap(new HeapInfo(heap_addr, align, size));
u32 heap_id = sysPrxForUser->GetNewId(heap); u32 heap_id = sysPrxForUser.GetNewId(heap);
sysPrxForUser->Warning("*** sys_heap created: id = %d", heap_id); sysPrxForUser.Warning("*** sys_heap created: id = %d", heap_id);
return heap_id; return heap_id;
} }
u32 _sys_heap_malloc(const u32 heap_id, const u32 size) u32 _sys_heap_malloc(const u32 heap_id, const u32 size)
{ {
sysPrxForUser->Warning("_sys_heap_malloc(heap_id=%d, size=0x%x)", heap_id, size); sysPrxForUser.Warning("_sys_heap_malloc(heap_id=%d, size=0x%x)", heap_id, size);
std::shared_ptr<HeapInfo> heap; std::shared_ptr<HeapInfo> heap;
if(!sysPrxForUser->CheckId(heap_id, heap)) return CELL_ESRCH; if(!sysPrxForUser.CheckId(heap_id, heap)) return CELL_ESRCH;
return (u32)Memory.Alloc(size, 1); return (u32)Memory.Alloc(size, 1);
} }
u32 _sys_heap_memalign(u32 heap_id, u32 align, u32 size) u32 _sys_heap_memalign(u32 heap_id, u32 align, u32 size)
{ {
sysPrxForUser->Warning("_sys_heap_memalign(heap_id=%d, align=0x%x, size=0x%x)", heap_id, align, size); sysPrxForUser.Warning("_sys_heap_memalign(heap_id=%d, align=0x%x, size=0x%x)", heap_id, align, size);
std::shared_ptr<HeapInfo> heap; std::shared_ptr<HeapInfo> heap;
if(!sysPrxForUser->CheckId(heap_id, heap)) return CELL_ESRCH; if(!sysPrxForUser.CheckId(heap_id, heap)) return CELL_ESRCH;
return (u32)Memory.Alloc(size, align); return (u32)Memory.Alloc(size, align);
} }
s64 _sys_process_atexitspawn() s64 _sys_process_atexitspawn()
{ {
sysPrxForUser->Log("_sys_process_atexitspawn()"); sysPrxForUser.Log("_sys_process_atexitspawn()");
return CELL_OK; return CELL_OK;
} }
s64 _sys_process_at_Exitspawn() s64 _sys_process_at_Exitspawn()
{ {
sysPrxForUser->Log("_sys_process_at_Exitspawn"); sysPrxForUser.Log("_sys_process_at_Exitspawn");
return CELL_OK; return CELL_OK;
} }
int sys_process_is_stack(u32 p) int sys_process_is_stack(u32 p)
{ {
sysPrxForUser->Log("sys_process_is_stack(p=0x%x)", p); sysPrxForUser.Log("sys_process_is_stack(p=0x%x)", p);
// prx: compare high 4 bits with "0xD" // prx: compare high 4 bits with "0xD"
return (p >= Memory.StackMem.GetStartAddr() && p <= Memory.StackMem.GetEndAddr()) ? 1 : 0; return (p >= Memory.StackMem.GetStartAddr() && p <= Memory.StackMem.GetEndAddr()) ? 1 : 0;
@ -139,44 +139,44 @@ int sys_process_is_stack(u32 p)
s64 sys_prx_exitspawn_with_level() s64 sys_prx_exitspawn_with_level()
{ {
sysPrxForUser->Log("sys_prx_exitspawn_with_level()"); sysPrxForUser.Log("sys_prx_exitspawn_with_level()");
return CELL_OK; return CELL_OK;
} }
int sys_spu_elf_get_information(u32 elf_img, vm::ptr<u32> entry, vm::ptr<u32> nseg) int sys_spu_elf_get_information(u32 elf_img, vm::ptr<u32> entry, vm::ptr<u32> nseg)
{ {
sysPrxForUser->Todo("sys_spu_elf_get_information(elf_img=0x%x, entry_addr=0x%x, nseg_addr=0x%x)", elf_img, entry.addr(), nseg.addr()); sysPrxForUser.Todo("sys_spu_elf_get_information(elf_img=0x%x, entry_addr=0x%x, nseg_addr=0x%x)", elf_img, entry.addr(), nseg.addr());
return CELL_OK; return CELL_OK;
} }
int sys_spu_elf_get_segments(u32 elf_img, vm::ptr<sys_spu_segment> segments, int nseg) int sys_spu_elf_get_segments(u32 elf_img, vm::ptr<sys_spu_segment> segments, int nseg)
{ {
sysPrxForUser->Todo("sys_spu_elf_get_segments(elf_img=0x%x, segments_addr=0x%x, nseg=0x%x)", elf_img, segments.addr(), nseg); sysPrxForUser.Todo("sys_spu_elf_get_segments(elf_img=0x%x, segments_addr=0x%x, nseg=0x%x)", elf_img, segments.addr(), nseg);
return CELL_OK; return CELL_OK;
} }
int sys_spu_image_import(vm::ptr<sys_spu_image> img, u32 src, u32 type) int sys_spu_image_import(vm::ptr<sys_spu_image> img, u32 src, u32 type)
{ {
sysPrxForUser->Warning("sys_spu_image_import(img=0x%x, src=0x%x, type=%d)", img.addr(), src, type); sysPrxForUser.Warning("sys_spu_image_import(img=0x%x, src=0x%x, type=%d)", img.addr(), src, type);
return spu_image_import(*img, src, type); return spu_image_import(*img, src, type);
} }
int sys_spu_image_close(vm::ptr<sys_spu_image> img) int sys_spu_image_close(vm::ptr<sys_spu_image> img)
{ {
sysPrxForUser->Warning("sys_spu_image_close(img=0x%x)", img.addr()); sysPrxForUser.Warning("sys_spu_image_close(img=0x%x)", img.addr());
return CELL_OK; return CELL_OK;
} }
int sys_raw_spu_load(s32 id, vm::ptr<const char> path, vm::ptr<u32> entry) int sys_raw_spu_load(s32 id, vm::ptr<const char> path, vm::ptr<u32> entry)
{ {
sysPrxForUser->Warning("sys_raw_spu_load(id=0x%x, path_addr=0x%x('%s'), entry_addr=0x%x)", sysPrxForUser.Warning("sys_raw_spu_load(id=0x%x, path_addr=0x%x('%s'), entry_addr=0x%x)",
id, path.addr(), path.get_ptr(), entry.addr()); id, path.addr(), path.get_ptr(), entry.addr());
vfsFile f(path.get_ptr()); vfsFile f(path.get_ptr());
if(!f.IsOpened()) if(!f.IsOpened())
{ {
sysPrxForUser->Error("sys_raw_spu_load error: '%s' not found!", path.get_ptr()); sysPrxForUser.Error("sys_raw_spu_load error: '%s' not found!", path.get_ptr());
return CELL_ENOENT; return CELL_ENOENT;
} }
@ -185,7 +185,7 @@ int sys_raw_spu_load(s32 id, vm::ptr<const char> path, vm::ptr<u32> entry)
if (hdr.CheckMagic()) if (hdr.CheckMagic())
{ {
sysPrxForUser->Error("sys_raw_spu_load error: '%s' is encrypted! Decrypt SELF and try again.", path.get_ptr()); sysPrxForUser.Error("sys_raw_spu_load error: '%s' is encrypted! Decrypt SELF and try again.", path.get_ptr());
Emu.Pause(); Emu.Pause();
return CELL_ENOENT; return CELL_ENOENT;
} }
@ -202,7 +202,7 @@ int sys_raw_spu_load(s32 id, vm::ptr<const char> path, vm::ptr<u32> entry)
int sys_raw_spu_image_load(int id, vm::ptr<sys_spu_image> img) int sys_raw_spu_image_load(int id, vm::ptr<sys_spu_image> img)
{ {
sysPrxForUser->Warning("sys_raw_spu_image_load(id=0x%x, img_addr=0x%x)", id, img.addr()); sysPrxForUser.Warning("sys_raw_spu_image_load(id=0x%x, img_addr=0x%x)", id, img.addr());
// TODO: use segment info // TODO: use segment info
memcpy(vm::get_ptr<void>(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id), vm::get_ptr<void>(img->addr), 256 * 1024); memcpy(vm::get_ptr<void>(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id), vm::get_ptr<void>(img->addr), 256 * 1024);
@ -213,7 +213,7 @@ int sys_raw_spu_image_load(int id, vm::ptr<sys_spu_image> img)
int sys_get_random_number(vm::ptr<u8> addr, u64 size) int sys_get_random_number(vm::ptr<u8> addr, u64 size)
{ {
sysPrxForUser->Warning("sys_get_random_number(addr=0x%x, size=%d)", addr.addr(), size); sysPrxForUser.Warning("sys_get_random_number(addr=0x%x, size=%d)", addr.addr(), size);
if (size > 4096) if (size > 4096)
size = 4096; size = 4096;
@ -228,7 +228,7 @@ int sys_get_random_number(vm::ptr<u8> addr, u64 size)
vm::ptr<void> _sys_memset(vm::ptr<void> dst, s32 value, u32 size) vm::ptr<void> _sys_memset(vm::ptr<void> dst, s32 value, u32 size)
{ {
sysPrxForUser->Log("_sys_memset(dst_addr=0x%x, value=%d, size=%d)", dst.addr(), value, size); sysPrxForUser.Log("_sys_memset(dst_addr=0x%x, value=%d, size=%d)", dst.addr(), value, size);
memset(dst.get_ptr(), value, size); memset(dst.get_ptr(), value, size);
return dst; return dst;
@ -236,7 +236,7 @@ vm::ptr<void> _sys_memset(vm::ptr<void> dst, s32 value, u32 size)
vm::ptr<void> _sys_memcpy(vm::ptr<void> dst, vm::ptr<const void> src, u32 size) vm::ptr<void> _sys_memcpy(vm::ptr<void> dst, vm::ptr<const void> src, u32 size)
{ {
sysPrxForUser->Log("_sys_memcpy(dst_addr=0x%x, src_addr=0x%x, size=%d)", dst.addr(), src.addr(), size); sysPrxForUser.Log("_sys_memcpy(dst_addr=0x%x, src_addr=0x%x, size=%d)", dst.addr(), src.addr(), size);
memcpy(dst.get_ptr(), src.get_ptr(), size); memcpy(dst.get_ptr(), src.get_ptr(), size);
return dst; return dst;
@ -244,28 +244,28 @@ vm::ptr<void> _sys_memcpy(vm::ptr<void> dst, vm::ptr<const void> src, u32 size)
s32 _sys_memcmp(vm::ptr<const void> buf1, vm::ptr<const void> buf2, u32 size) s32 _sys_memcmp(vm::ptr<const void> buf1, vm::ptr<const void> buf2, u32 size)
{ {
sysPrxForUser->Log("_sys_memcmp(buf1_addr=0x%x, buf2_addr=0x%x, size=%d)", buf1.addr(), buf2.addr(), size); sysPrxForUser.Log("_sys_memcmp(buf1_addr=0x%x, buf2_addr=0x%x, size=%d)", buf1.addr(), buf2.addr(), size);
return memcmp(buf1.get_ptr(), buf2.get_ptr(), size); return memcmp(buf1.get_ptr(), buf2.get_ptr(), size);
} }
s64 _sys_strlen(vm::ptr<const char> str) s64 _sys_strlen(vm::ptr<const char> str)
{ {
sysPrxForUser->Log("_sys_strlen(str_addr=0x%x)", str.addr()); sysPrxForUser.Log("_sys_strlen(str_addr=0x%x)", str.addr());
return strlen(str.get_ptr()); return strlen(str.get_ptr());
} }
s32 _sys_strncmp(vm::ptr<const char> str1, vm::ptr<const char> str2, s32 max) s32 _sys_strncmp(vm::ptr<const char> str1, vm::ptr<const char> str2, s32 max)
{ {
sysPrxForUser->Log("_sys_strncmp(str1_addr=0x%x, str2_addr=0x%x, max=%d)", str1.addr(), str2.addr(), max); sysPrxForUser.Log("_sys_strncmp(str1_addr=0x%x, str2_addr=0x%x, max=%d)", str1.addr(), str2.addr(), max);
return strncmp(str1.get_ptr(), str2.get_ptr(), max); return strncmp(str1.get_ptr(), str2.get_ptr(), max);
} }
vm::ptr<char> _sys_strcat(vm::ptr<char> dest, vm::ptr<const char> source) vm::ptr<char> _sys_strcat(vm::ptr<char> dest, vm::ptr<const char> source)
{ {
sysPrxForUser->Log("_sys_strcat(dest_addr=0x%x, source_addr=0x%x)", dest.addr(), source.addr()); sysPrxForUser.Log("_sys_strcat(dest_addr=0x%x, source_addr=0x%x)", dest.addr(), source.addr());
if (strcat(dest.get_ptr(), source.get_ptr()) != dest.get_ptr()) if (strcat(dest.get_ptr(), source.get_ptr()) != dest.get_ptr())
{ {
@ -276,7 +276,7 @@ vm::ptr<char> _sys_strcat(vm::ptr<char> dest, vm::ptr<const char> source)
vm::ptr<char> _sys_strncat(vm::ptr<char> dest, vm::ptr<const char> source, u32 len) vm::ptr<char> _sys_strncat(vm::ptr<char> dest, vm::ptr<const char> source, u32 len)
{ {
sysPrxForUser->Log("_sys_strncat(dest_addr=0x%x, source_addr=0x%x, len=%d)", dest.addr(), source.addr(), len); sysPrxForUser.Log("_sys_strncat(dest_addr=0x%x, source_addr=0x%x, len=%d)", dest.addr(), source.addr(), len);
if (strncat(dest.get_ptr(), source.get_ptr(), len) != dest.get_ptr()) if (strncat(dest.get_ptr(), source.get_ptr(), len) != dest.get_ptr())
{ {
@ -287,7 +287,7 @@ vm::ptr<char> _sys_strncat(vm::ptr<char> dest, vm::ptr<const char> source, u32 l
vm::ptr<char> _sys_strcpy(vm::ptr<char> dest, vm::ptr<const char> source) vm::ptr<char> _sys_strcpy(vm::ptr<char> dest, vm::ptr<const char> source)
{ {
sysPrxForUser->Log("_sys_strcpy(dest_addr=0x%x, source_addr=0x%x)", dest.addr(), source.addr()); sysPrxForUser.Log("_sys_strcpy(dest_addr=0x%x, source_addr=0x%x)", dest.addr(), source.addr());
if (strcpy(dest.get_ptr(), source.get_ptr()) != dest.get_ptr()) if (strcpy(dest.get_ptr(), source.get_ptr()) != dest.get_ptr())
{ {
@ -298,7 +298,7 @@ vm::ptr<char> _sys_strcpy(vm::ptr<char> dest, vm::ptr<const char> source)
vm::ptr<char> _sys_strncpy(vm::ptr<char> dest, vm::ptr<const char> source, u32 len) vm::ptr<char> _sys_strncpy(vm::ptr<char> dest, vm::ptr<const char> source, u32 len)
{ {
sysPrxForUser->Log("_sys_strncpy(dest_addr=0x%x, source_addr=0x%x, len=%d)", dest.addr(), source.addr(), len); sysPrxForUser.Log("_sys_strncpy(dest_addr=0x%x, source_addr=0x%x, len=%d)", dest.addr(), source.addr(), len);
if (!dest || !source) if (!dest || !source)
{ {
@ -323,7 +323,7 @@ s32 _sys_spu_printf_initialize(
vm::ptr<spu_printf_cb_t> atcb, vm::ptr<spu_printf_cb_t> atcb,
vm::ptr<spu_printf_cb_t> dtcb) vm::ptr<spu_printf_cb_t> dtcb)
{ {
sysPrxForUser->Warning("_sys_spu_printf_initialize(agcb_addr=0x%x, dgcb_addr=0x%x, atcb_addr=0x%x, dtcb_addr=0x%x)", sysPrxForUser.Warning("_sys_spu_printf_initialize(agcb_addr=0x%x, dgcb_addr=0x%x, atcb_addr=0x%x, dtcb_addr=0x%x)",
agcb.addr(), dgcb.addr(), atcb.addr(), dtcb.addr()); agcb.addr(), dgcb.addr(), atcb.addr(), dtcb.addr());
// prx: register some callbacks // prx: register some callbacks
@ -336,7 +336,7 @@ s32 _sys_spu_printf_initialize(
s32 _sys_spu_printf_finalize() s32 _sys_spu_printf_finalize()
{ {
sysPrxForUser->Warning("_sys_spu_printf_finalize()"); sysPrxForUser.Warning("_sys_spu_printf_finalize()");
spu_printf_agcb.set(0); spu_printf_agcb.set(0);
spu_printf_dgcb.set(0); spu_printf_dgcb.set(0);
@ -347,7 +347,7 @@ s32 _sys_spu_printf_finalize()
s32 _sys_spu_printf_attach_group(PPUThread& CPU, u32 group) s32 _sys_spu_printf_attach_group(PPUThread& CPU, u32 group)
{ {
sysPrxForUser->Warning("_sys_spu_printf_attach_group(group=%d)", group); sysPrxForUser.Warning("_sys_spu_printf_attach_group(group=%d)", group);
if (!spu_printf_agcb) if (!spu_printf_agcb)
{ {
@ -359,7 +359,7 @@ s32 _sys_spu_printf_attach_group(PPUThread& CPU, u32 group)
s32 _sys_spu_printf_detach_group(PPUThread& CPU, u32 group) s32 _sys_spu_printf_detach_group(PPUThread& CPU, u32 group)
{ {
sysPrxForUser->Warning("_sys_spu_printf_detach_group(group=%d)", group); sysPrxForUser.Warning("_sys_spu_printf_detach_group(group=%d)", group);
if (!spu_printf_dgcb) if (!spu_printf_dgcb)
{ {
@ -371,7 +371,7 @@ s32 _sys_spu_printf_detach_group(PPUThread& CPU, u32 group)
s32 _sys_spu_printf_attach_thread(PPUThread& CPU, u32 thread) s32 _sys_spu_printf_attach_thread(PPUThread& CPU, u32 thread)
{ {
sysPrxForUser->Warning("_sys_spu_printf_attach_thread(thread=%d)", thread); sysPrxForUser.Warning("_sys_spu_printf_attach_thread(thread=%d)", thread);
if (!spu_printf_atcb) if (!spu_printf_atcb)
{ {
@ -383,7 +383,7 @@ s32 _sys_spu_printf_attach_thread(PPUThread& CPU, u32 thread)
s32 _sys_spu_printf_detach_thread(PPUThread& CPU, u32 thread) s32 _sys_spu_printf_detach_thread(PPUThread& CPU, u32 thread)
{ {
sysPrxForUser->Warning("_sys_spu_printf_detach_thread(thread=%d)", thread); sysPrxForUser.Warning("_sys_spu_printf_detach_thread(thread=%d)", thread);
if (!spu_printf_dtcb) if (!spu_printf_dtcb)
{ {
@ -395,7 +395,7 @@ s32 _sys_spu_printf_detach_thread(PPUThread& CPU, u32 thread)
s32 _sys_snprintf(vm::ptr<char> dst, u32 count, vm::ptr<const char> fmt) // va_args... s32 _sys_snprintf(vm::ptr<char> dst, u32 count, vm::ptr<const char> fmt) // va_args...
{ {
sysPrxForUser->Todo("_sys_snprintf(dst_addr=0x%x, count=%d, fmt_addr=0x%x['%s'], ...)", dst.addr(), count, fmt.addr(), fmt.get_ptr()); sysPrxForUser.Todo("_sys_snprintf(dst_addr=0x%x, count=%d, fmt_addr=0x%x['%s'], ...)", dst.addr(), count, fmt.addr(), fmt.get_ptr());
Emu.Pause(); Emu.Pause();
return 0; return 0;
@ -403,33 +403,36 @@ s32 _sys_snprintf(vm::ptr<char> dst, u32 count, vm::ptr<const char> fmt) // va_a
s32 _sys_printf(vm::ptr<const char> fmt) // va_args... s32 _sys_printf(vm::ptr<const char> fmt) // va_args...
{ {
sysPrxForUser->Todo("_sys_printf(fmt_addr=0x%x, ...)", fmt.addr()); sysPrxForUser.Todo("_sys_printf(fmt_addr=0x%x, ...)", fmt.addr());
// probably, assertion failed // probably, assertion failed
sysPrxForUser->Warning("_sys_printf: \n%s", fmt.get_ptr()); sysPrxForUser.Warning("_sys_printf: \n%s", fmt.get_ptr());
Emu.Pause(); Emu.Pause();
return CELL_OK; return CELL_OK;
} }
s32 _unnamed_E75C40F2(u32 dest) s32 _unnamed_E75C40F2(u32 dest)
{ {
sysPrxForUser->Todo("Unnamed function 0xE75C40F2 (dest=0x%x) -> CELL_ENOENT", dest); sysPrxForUser.Todo("Unnamed function 0xE75C40F2 (dest=0x%x) -> CELL_ENOENT", dest);
// prx: load some data (0x40 bytes) previously set by sys_process_get_paramsfo // prx: load some data (0x40 bytes) previously set by sys_process_get_paramsfo
//memset(Memory + dest, 0, 0x40); //memset(Memory + dest, 0, 0x40);
return CELL_ENOENT; return CELL_ENOENT;
} }
void sysPrxForUser_init(Module *pxThis) Module sysPrxForUser("sysPrxForUser", []()
{ {
sysPrxForUser = pxThis;
g_tls_start = 0; g_tls_start = 0;
for (auto& v : g_tls_owners) for (auto& v : g_tls_owners)
{ {
v.store(0, std::memory_order_relaxed); v.store(0, std::memory_order_relaxed);
} }
spu_printf_agcb.set(0);
spu_printf_dgcb.set(0);
spu_printf_atcb.set(0);
spu_printf_dtcb.set(0);
// Setup random number generator // Setup random number generator
srand(time(NULL)); srand(time(NULL));
@ -441,66 +444,66 @@ void sysPrxForUser_init(Module *pxThis)
REG_FUNC(sysPrxForUser, sys_lwmutex_trylock); REG_FUNC(sysPrxForUser, sys_lwmutex_trylock);
REG_FUNC(sysPrxForUser, sys_lwmutex_unlock); REG_FUNC(sysPrxForUser, sys_lwmutex_unlock);
sysPrxForUser->AddFunc(0x8461e528, sys_time_get_system_time); sysPrxForUser.AddFunc(0x8461e528, sys_time_get_system_time);
sysPrxForUser->AddFunc(0xe6f2c1e7, sys_process_exit); sysPrxForUser.AddFunc(0xe6f2c1e7, sys_process_exit);
sysPrxForUser->AddFunc(0x2c847572, _sys_process_atexitspawn); sysPrxForUser.AddFunc(0x2c847572, _sys_process_atexitspawn);
sysPrxForUser->AddFunc(0x96328741, _sys_process_at_Exitspawn); sysPrxForUser.AddFunc(0x96328741, _sys_process_at_Exitspawn);
sysPrxForUser->AddFunc(0x4f7172c9, sys_process_is_stack); sysPrxForUser.AddFunc(0x4f7172c9, sys_process_is_stack);
sysPrxForUser->AddFunc(0x24a1ea07, sys_ppu_thread_create); sysPrxForUser.AddFunc(0x24a1ea07, sys_ppu_thread_create);
sysPrxForUser->AddFunc(0x350d454e, sys_ppu_thread_get_id); sysPrxForUser.AddFunc(0x350d454e, sys_ppu_thread_get_id);
sysPrxForUser->AddFunc(0xaff080a4, sys_ppu_thread_exit); sysPrxForUser.AddFunc(0xaff080a4, sys_ppu_thread_exit);
sysPrxForUser->AddFunc(0xa3e3be68, sys_ppu_thread_once); sysPrxForUser.AddFunc(0xa3e3be68, sys_ppu_thread_once);
sysPrxForUser->AddFunc(0x26090058, sys_prx_load_module); sysPrxForUser.AddFunc(0x26090058, sys_prx_load_module);
sysPrxForUser->AddFunc(0x9f18429d, sys_prx_start_module); sysPrxForUser.AddFunc(0x9f18429d, sys_prx_start_module);
sysPrxForUser->AddFunc(0x80fb0c19, sys_prx_stop_module); sysPrxForUser.AddFunc(0x80fb0c19, sys_prx_stop_module);
sysPrxForUser->AddFunc(0xf0aece0d, sys_prx_unload_module); sysPrxForUser.AddFunc(0xf0aece0d, sys_prx_unload_module);
sysPrxForUser->AddFunc(0x42b23552, sys_prx_register_library); sysPrxForUser.AddFunc(0x42b23552, sys_prx_register_library);
sysPrxForUser->AddFunc(0xd0ea47a7, sys_prx_unregister_library); sysPrxForUser.AddFunc(0xd0ea47a7, sys_prx_unregister_library);
sysPrxForUser->AddFunc(0xa5d06bf0, sys_prx_get_module_list); sysPrxForUser.AddFunc(0xa5d06bf0, sys_prx_get_module_list);
sysPrxForUser->AddFunc(0x84bb6774, sys_prx_get_module_info); sysPrxForUser.AddFunc(0x84bb6774, sys_prx_get_module_info);
sysPrxForUser->AddFunc(0xe0998dbf, sys_prx_get_module_id_by_name); sysPrxForUser.AddFunc(0xe0998dbf, sys_prx_get_module_id_by_name);
sysPrxForUser->AddFunc(0xaa6d9bff, sys_prx_load_module_on_memcontainer); sysPrxForUser.AddFunc(0xaa6d9bff, sys_prx_load_module_on_memcontainer);
sysPrxForUser->AddFunc(0xa2c7ba64, sys_prx_exitspawn_with_level); sysPrxForUser.AddFunc(0xa2c7ba64, sys_prx_exitspawn_with_level);
sysPrxForUser->AddFunc(0x35168520, _sys_heap_malloc); sysPrxForUser.AddFunc(0x35168520, _sys_heap_malloc);
//sysPrxForUser->AddFunc(0xaede4b03, _sys_heap_free); //sysPrxForUser.AddFunc(0xaede4b03, _sys_heap_free);
//sysPrxForUser->AddFunc(0x8a561d92, _sys_heap_delete_heap); //sysPrxForUser.AddFunc(0x8a561d92, _sys_heap_delete_heap);
sysPrxForUser->AddFunc(0xb2fcf2c8, _sys_heap_create_heap); sysPrxForUser.AddFunc(0xb2fcf2c8, _sys_heap_create_heap);
sysPrxForUser->AddFunc(0x44265c08, _sys_heap_memalign); sysPrxForUser.AddFunc(0x44265c08, _sys_heap_memalign);
sysPrxForUser->AddFunc(0xb257540b, sys_mmapper_allocate_memory); sysPrxForUser.AddFunc(0xb257540b, sys_mmapper_allocate_memory);
sysPrxForUser->AddFunc(0x70258515, sys_mmapper_allocate_memory_from_container); sysPrxForUser.AddFunc(0x70258515, sys_mmapper_allocate_memory_from_container);
sysPrxForUser->AddFunc(0xdc578057, sys_mmapper_map_memory); sysPrxForUser.AddFunc(0xdc578057, sys_mmapper_map_memory);
sysPrxForUser->AddFunc(0x4643ba6e, sys_mmapper_unmap_memory); sysPrxForUser.AddFunc(0x4643ba6e, sys_mmapper_unmap_memory);
sysPrxForUser->AddFunc(0x409ad939, sys_mmapper_free_memory); sysPrxForUser.AddFunc(0x409ad939, sys_mmapper_free_memory);
sysPrxForUser->AddFunc(0x1ed454ce, sys_spu_elf_get_information); sysPrxForUser.AddFunc(0x1ed454ce, sys_spu_elf_get_information);
sysPrxForUser->AddFunc(0xdb6b3250, sys_spu_elf_get_segments); sysPrxForUser.AddFunc(0xdb6b3250, sys_spu_elf_get_segments);
sysPrxForUser->AddFunc(0xebe5f72f, sys_spu_image_import); sysPrxForUser.AddFunc(0xebe5f72f, sys_spu_image_import);
sysPrxForUser->AddFunc(0xe0da8efd, sys_spu_image_close); sysPrxForUser.AddFunc(0xe0da8efd, sys_spu_image_close);
sysPrxForUser->AddFunc(0x893305fa, sys_raw_spu_load); sysPrxForUser.AddFunc(0x893305fa, sys_raw_spu_load);
sysPrxForUser->AddFunc(0xb995662e, sys_raw_spu_image_load); sysPrxForUser.AddFunc(0xb995662e, sys_raw_spu_image_load);
sysPrxForUser->AddFunc(0xda0eb71a, sys_lwcond_create); sysPrxForUser.AddFunc(0xda0eb71a, sys_lwcond_create);
sysPrxForUser->AddFunc(0x1c9a942c, sys_lwcond_destroy); sysPrxForUser.AddFunc(0x1c9a942c, sys_lwcond_destroy);
sysPrxForUser->AddFunc(0xef87a695, sys_lwcond_signal); sysPrxForUser.AddFunc(0xef87a695, sys_lwcond_signal);
sysPrxForUser->AddFunc(0xe9a1bd84, sys_lwcond_signal_all); sysPrxForUser.AddFunc(0xe9a1bd84, sys_lwcond_signal_all);
sysPrxForUser->AddFunc(0x52aadadf, sys_lwcond_signal_to); sysPrxForUser.AddFunc(0x52aadadf, sys_lwcond_signal_to);
sysPrxForUser->AddFunc(0x2a6d9d51, sys_lwcond_wait); sysPrxForUser.AddFunc(0x2a6d9d51, sys_lwcond_wait);
sysPrxForUser->AddFunc(0x71a8472a, sys_get_random_number); sysPrxForUser.AddFunc(0x71a8472a, sys_get_random_number);
sysPrxForUser->AddFunc(0x8c2bb498, sys_spinlock_initialize); sysPrxForUser.AddFunc(0x8c2bb498, sys_spinlock_initialize);
sysPrxForUser->AddFunc(0xa285139d, sys_spinlock_lock); sysPrxForUser.AddFunc(0xa285139d, sys_spinlock_lock);
sysPrxForUser->AddFunc(0x722a0254, sys_spinlock_trylock); sysPrxForUser.AddFunc(0x722a0254, sys_spinlock_trylock);
sysPrxForUser->AddFunc(0x5267cb35, sys_spinlock_unlock); sysPrxForUser.AddFunc(0x5267cb35, sys_spinlock_unlock);
sysPrxForUser->AddFunc(0x67f9fedb, sys_game_process_exitspawn2); sysPrxForUser.AddFunc(0x67f9fedb, sys_game_process_exitspawn2);
sysPrxForUser->AddFunc(0xfc52a7a9, sys_game_process_exitspawn); sysPrxForUser.AddFunc(0xfc52a7a9, sys_game_process_exitspawn);
REG_FUNC(sysPrxForUser, _sys_memset); REG_FUNC(sysPrxForUser, _sys_memset);
REG_FUNC(sysPrxForUser, _sys_memcpy); REG_FUNC(sysPrxForUser, _sys_memcpy);
@ -522,13 +525,5 @@ void sysPrxForUser_init(Module *pxThis)
REG_FUNC(sysPrxForUser, _sys_snprintf); REG_FUNC(sysPrxForUser, _sys_snprintf);
REG_FUNC(sysPrxForUser, _sys_printf); REG_FUNC(sysPrxForUser, _sys_printf);
sysPrxForUser->AddFunc(0xe75c40f2, _unnamed_E75C40F2); // real name is unknown sysPrxForUser.AddFunc(0xe75c40f2, _unnamed_E75C40F2); // real name is unknown
} });
void sysPrxForUser_load()
{
spu_printf_agcb.set(0);
spu_printf_dgcb.set(0);
spu_printf_atcb.set(0);
spu_printf_dtcb.set(0);
}

View file

@ -1,17 +1,15 @@
#include "stdafx.h" #include "stdafx.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
Module *sys_io = nullptr; extern Module sys_io;
extern void cellPad_init(); extern void cellPad_init();
extern void cellKb_init(); extern void cellKb_init();
extern void cellMouse_init(); extern void cellMouse_init();
void sys_io_init(Module *pxThis) Module sys_io("sys_io", []()
{ {
sys_io = pxThis;
cellPad_init(); cellPad_init();
cellKb_init(); cellKb_init();
cellMouse_init(); cellMouse_init();
} });

View file

@ -17,7 +17,7 @@ extern "C"
#include "sys_net.h" #include "sys_net.h"
Module *sys_net = nullptr; extern Module sys_net;
vm::ptr<s32> g_lastError = vm::ptr<s32>::make(0); vm::ptr<s32> g_lastError = vm::ptr<s32>::make(0);
@ -94,7 +94,7 @@ using pck_len_t = u32;
// Functions // Functions
int sys_net_accept(s32 s, vm::ptr<sys_net_sockaddr> addr, vm::ptr<pck_len_t> paddrlen) int sys_net_accept(s32 s, vm::ptr<sys_net_sockaddr> addr, vm::ptr<pck_len_t> paddrlen)
{ {
sys_net->Warning("accept(s=%d, family_addr=0x%x, paddrlen=0x%x)", s, addr.addr(), paddrlen.addr()); sys_net.Warning("accept(s=%d, family_addr=0x%x, paddrlen=0x%x)", s, addr.addr(), paddrlen.addr());
if (!addr) { if (!addr) {
int ret = accept(s, nullptr, nullptr); int ret = accept(s, nullptr, nullptr);
*g_lastError = getLastError(); *g_lastError = getLastError();
@ -114,12 +114,12 @@ int sys_net_accept(s32 s, vm::ptr<sys_net_sockaddr> addr, vm::ptr<pck_len_t> pad
int sys_net_bind(s32 s, vm::ptr<sys_net_sockaddr_in> addr, u32 addrlen) int sys_net_bind(s32 s, vm::ptr<sys_net_sockaddr_in> addr, u32 addrlen)
{ {
sys_net->Warning("bind(s=%d, family_addr=0x%x, addrlen=%d)", s, addr.addr(), addrlen); sys_net.Warning("bind(s=%d, family_addr=0x%x, addrlen=%d)", s, addr.addr(), addrlen);
sockaddr_in saddr; sockaddr_in saddr;
memcpy(&saddr, addr.get_ptr(), sizeof(sockaddr_in)); memcpy(&saddr, addr.get_ptr(), sizeof(sockaddr_in));
saddr.sin_family = addr->sin_family; saddr.sin_family = addr->sin_family;
const char *ipaddr = inet_ntoa(saddr.sin_addr); const char *ipaddr = inet_ntoa(saddr.sin_addr);
sys_net->Warning("binding on %s to port %d", ipaddr, ntohs(saddr.sin_port)); sys_net.Warning("binding on %s to port %d", ipaddr, ntohs(saddr.sin_port));
int ret = bind(s, (const sockaddr *)&saddr, addrlen); int ret = bind(s, (const sockaddr *)&saddr, addrlen);
*g_lastError = getLastError(); *g_lastError = getLastError();
return ret; return ret;
@ -127,12 +127,12 @@ int sys_net_bind(s32 s, vm::ptr<sys_net_sockaddr_in> addr, u32 addrlen)
int sys_net_connect(s32 s, vm::ptr<sys_net_sockaddr_in> addr, u32 addrlen) int sys_net_connect(s32 s, vm::ptr<sys_net_sockaddr_in> addr, u32 addrlen)
{ {
sys_net->Warning("connect(s=%d, family_addr=0x%x, addrlen=%d)", s, addr.addr(), addrlen); sys_net.Warning("connect(s=%d, family_addr=0x%x, addrlen=%d)", s, addr.addr(), addrlen);
sockaddr_in saddr; sockaddr_in saddr;
memcpy(&saddr, addr.get_ptr(), sizeof(sockaddr_in)); memcpy(&saddr, addr.get_ptr(), sizeof(sockaddr_in));
saddr.sin_family = addr->sin_family; saddr.sin_family = addr->sin_family;
const char *ipaddr = inet_ntoa(saddr.sin_addr); const char *ipaddr = inet_ntoa(saddr.sin_addr);
sys_net->Warning("connecting on %s to port %d", ipaddr, ntohs(saddr.sin_port)); sys_net.Warning("connecting on %s to port %d", ipaddr, ntohs(saddr.sin_port));
int ret = connect(s, (const sockaddr *) &saddr, addrlen); int ret = connect(s, (const sockaddr *) &saddr, addrlen);
*g_lastError = getLastError(); *g_lastError = getLastError();
return ret; return ret;
@ -170,7 +170,7 @@ int getsockopt()
int sys_net_inet_addr(vm::ptr<const char> cp) int sys_net_inet_addr(vm::ptr<const char> cp)
{ {
sys_net->Warning("inet_addr(cp_addr=0x%x['%s'])", cp.addr(), cp.get_ptr()); sys_net.Warning("inet_addr(cp_addr=0x%x['%s'])", cp.addr(), cp.get_ptr());
return htonl(inet_addr(cp.get_ptr())); // return a big-endian IP address return htonl(inet_addr(cp.get_ptr())); // return a big-endian IP address
} }
@ -218,14 +218,14 @@ int inet_ntop()
int sys_net_inet_pton(s32 af, vm::ptr<const char> src, vm::ptr<char> dst) int sys_net_inet_pton(s32 af, vm::ptr<const char> src, vm::ptr<char> dst)
{ {
sys_net->Warning("inet_pton(af=%d, src_addr=0x%x, dst_addr=0x%x)", af, src.addr(), dst.addr()); sys_net.Warning("inet_pton(af=%d, src_addr=0x%x, dst_addr=0x%x)", af, src.addr(), dst.addr());
return inet_pton(af, src.get_ptr(), dst.get_ptr()); return inet_pton(af, src.get_ptr(), dst.get_ptr());
} }
int sys_net_listen(s32 s, s32 backlog) int sys_net_listen(s32 s, s32 backlog)
{ {
sys_net->Warning("listen(s=%d, backlog=%d)", s, backlog); sys_net.Warning("listen(s=%d, backlog=%d)", s, backlog);
int ret = listen(s, backlog); int ret = listen(s, backlog);
*g_lastError = getLastError(); *g_lastError = getLastError();
return ret; return ret;
@ -233,7 +233,7 @@ int sys_net_listen(s32 s, s32 backlog)
int sys_net_recv(s32 s, vm::ptr<char> buf, u32 len, s32 flags) int sys_net_recv(s32 s, vm::ptr<char> buf, u32 len, s32 flags)
{ {
sys_net->Warning("recv(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf.addr(), len, flags); sys_net.Warning("recv(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf.addr(), len, flags);
int ret = recv(s, buf.get_ptr(), len, flags); int ret = recv(s, buf.get_ptr(), len, flags);
*g_lastError = getLastError(); *g_lastError = getLastError();
@ -242,7 +242,7 @@ int sys_net_recv(s32 s, vm::ptr<char> buf, u32 len, s32 flags)
int sys_net_recvfrom(s32 s, vm::ptr<char> buf, u32 len, s32 flags, vm::ptr<sys_net_sockaddr> addr, vm::ptr<pck_len_t> paddrlen) int sys_net_recvfrom(s32 s, vm::ptr<char> buf, u32 len, s32 flags, vm::ptr<sys_net_sockaddr> addr, vm::ptr<pck_len_t> paddrlen)
{ {
sys_net->Warning("recvfrom(s=%d, buf_addr=0x%x, len=%d, flags=0x%x, addr_addr=0x%x, paddrlen=0x%x)", sys_net.Warning("recvfrom(s=%d, buf_addr=0x%x, len=%d, flags=0x%x, addr_addr=0x%x, paddrlen=0x%x)",
s, buf.addr(), len, flags, addr.addr(), paddrlen.addr()); s, buf.addr(), len, flags, addr.addr(), paddrlen.addr());
sockaddr _addr; sockaddr _addr;
@ -263,7 +263,7 @@ int recvmsg()
int sys_net_send(s32 s, vm::ptr<const char> buf, u32 len, s32 flags) int sys_net_send(s32 s, vm::ptr<const char> buf, u32 len, s32 flags)
{ {
sys_net->Warning("send(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf.addr(), len, flags); sys_net.Warning("send(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf.addr(), len, flags);
int ret = send(s, buf.get_ptr(), len, flags); int ret = send(s, buf.get_ptr(), len, flags);
*g_lastError = getLastError(); *g_lastError = getLastError();
@ -278,7 +278,7 @@ int sendmsg()
int sys_net_sendto(s32 s, vm::ptr<const char> buf, u32 len, s32 flags, vm::ptr<sys_net_sockaddr> addr, u32 addrlen) int sys_net_sendto(s32 s, vm::ptr<const char> buf, u32 len, s32 flags, vm::ptr<sys_net_sockaddr> addr, u32 addrlen)
{ {
sys_net->Warning("sendto(s=%d, buf_addr=0x%x, len=%d, flags=0x%x, addr=0x%x, addrlen=%d)", sys_net.Warning("sendto(s=%d, buf_addr=0x%x, len=%d, flags=0x%x, addr=0x%x, addrlen=%d)",
s, buf.addr(), len, flags, addr.addr(), addrlen); s, buf.addr(), len, flags, addr.addr(), addrlen);
sockaddr _addr; sockaddr _addr;
@ -291,7 +291,7 @@ int sys_net_sendto(s32 s, vm::ptr<const char> buf, u32 len, s32 flags, vm::ptr<s
int sys_net_setsockopt(s32 s, s32 level, s32 optname, vm::ptr<const char> optval, u32 optlen) int sys_net_setsockopt(s32 s, s32 level, s32 optname, vm::ptr<const char> optval, u32 optlen)
{ {
sys_net->Warning("socket(s=%d, level=%d, optname=%d, optval_addr=0x%x, optlen=%d)", s, level, optname, optval.addr(), optlen); sys_net.Warning("socket(s=%d, level=%d, optname=%d, optval_addr=0x%x, optlen=%d)", s, level, optname, optval.addr(), optlen);
int ret = setsockopt(s, level, optname, optval.get_ptr(), optlen); int ret = setsockopt(s, level, optname, optval.get_ptr(), optlen);
*g_lastError = getLastError(); *g_lastError = getLastError();
@ -300,7 +300,7 @@ int sys_net_setsockopt(s32 s, s32 level, s32 optname, vm::ptr<const char> optval
int sys_net_shutdown(s32 s, s32 how) int sys_net_shutdown(s32 s, s32 how)
{ {
sys_net->Warning("shutdown(s=%d, how=%d)", s, how); sys_net.Warning("shutdown(s=%d, how=%d)", s, how);
int ret = shutdown(s, how); int ret = shutdown(s, how);
*g_lastError = getLastError(); *g_lastError = getLastError();
return ret; return ret;
@ -308,7 +308,7 @@ int sys_net_shutdown(s32 s, s32 how)
int sys_net_socket(s32 family, s32 type, s32 protocol) int sys_net_socket(s32 family, s32 type, s32 protocol)
{ {
sys_net->Warning("socket(family=%d, type=%d, protocol=%d)", family, type, protocol); sys_net.Warning("socket(family=%d, type=%d, protocol=%d)", family, type, protocol);
int ret = socket(family, type, protocol); int ret = socket(family, type, protocol);
*g_lastError = getLastError(); *g_lastError = getLastError();
return ret; return ret;
@ -316,7 +316,7 @@ int sys_net_socket(s32 family, s32 type, s32 protocol)
int sys_net_socketclose(s32 s) int sys_net_socketclose(s32 s)
{ {
sys_net->Warning("socket(s=%d)", s); sys_net.Warning("socket(s=%d)", s);
#ifdef _WIN32 #ifdef _WIN32
int ret = closesocket(s); int ret = closesocket(s);
#else #else
@ -340,7 +340,7 @@ int socketselect()
int sys_net_initialize_network_ex(vm::ptr<sys_net_initialize_parameter> param) int sys_net_initialize_network_ex(vm::ptr<sys_net_initialize_parameter> param)
{ {
sys_net->Warning("sys_net_initialize_network_ex(param_addr=0x%x)", param.addr()); sys_net.Warning("sys_net_initialize_network_ex(param_addr=0x%x)", param.addr());
g_lastError = vm::ptr<s32>::make((u32)Memory.Alloc(4, 1)); g_lastError = vm::ptr<s32>::make((u32)Memory.Alloc(4, 1));
#ifdef _WIN32 #ifdef _WIN32
WSADATA wsaData; WSADATA wsaData;
@ -406,7 +406,7 @@ int sys_net_show_nameserver()
u32 _sys_net_errno_loc() u32 _sys_net_errno_loc()
{ {
sys_net->Warning("_sys_net_errno_loc()"); sys_net.Warning("_sys_net_errno_loc()");
return g_lastError.addr(); return g_lastError.addr();
} }
@ -472,7 +472,7 @@ int sys_net_show_ifconfig()
int sys_net_finalize_network() int sys_net_finalize_network()
{ {
sys_net->Warning("sys_net_initialize_network_ex()"); sys_net.Warning("sys_net_initialize_network_ex()");
Memory.Free(g_lastError.addr()); Memory.Free(g_lastError.addr());
g_lastError = vm::ptr<s32>::make(0); g_lastError = vm::ptr<s32>::make(0);
#ifdef _WIN32 #ifdef _WIN32
@ -499,67 +499,65 @@ int sys_net_free_thread_context()
return CELL_OK; return CELL_OK;
} }
void sys_net_init(Module *pxThis) Module sys_net("sys_net", []()
{ {
sys_net = pxThis;
// The names of the following functions are modified to avoid overloading problems // The names of the following functions are modified to avoid overloading problems
sys_net->AddFunc(0xc94f6939, sys_net_accept); sys_net.AddFunc(0xc94f6939, sys_net_accept);
sys_net->AddFunc(0xb0a59804, sys_net_bind); sys_net.AddFunc(0xb0a59804, sys_net_bind);
sys_net->AddFunc(0x64f66d35, sys_net_connect); sys_net.AddFunc(0x64f66d35, sys_net_connect);
//sys_net->AddFunc(0xf7ac8941, sys_net_gethostbyaddr); //sys_net.AddFunc(0xf7ac8941, sys_net_gethostbyaddr);
//sys_net->AddFunc(0x71f4c717, sys_net_gethostbyname); //sys_net.AddFunc(0x71f4c717, sys_net_gethostbyname);
//sys_net->AddFunc(0xf9ec2db6, sys_net_getpeername); //sys_net.AddFunc(0xf9ec2db6, sys_net_getpeername);
//sys_net->AddFunc(0x13efe7f5, sys_net_getsockname); //sys_net.AddFunc(0x13efe7f5, sys_net_getsockname);
//sys_net->AddFunc(0x5a045bd1, sys_net_getsockopt); //sys_net.AddFunc(0x5a045bd1, sys_net_getsockopt);
sys_net->AddFunc(0xdabbc2c0, sys_net_inet_addr); sys_net.AddFunc(0xdabbc2c0, sys_net_inet_addr);
//sys_net->AddFunc(0xa9a079e0, sys_net_inet_aton); //sys_net.AddFunc(0xa9a079e0, sys_net_inet_aton);
//sys_net->AddFunc(0x566893ce, sys_net_inet_lnaof); //sys_net.AddFunc(0x566893ce, sys_net_inet_lnaof);
//sys_net->AddFunc(0xb4152c74, sys_net_inet_makeaddr); //sys_net.AddFunc(0xb4152c74, sys_net_inet_makeaddr);
//sys_net->AddFunc(0xe39a62a7, sys_net_inet_netof); //sys_net.AddFunc(0xe39a62a7, sys_net_inet_netof);
//sys_net->AddFunc(0x506ad863, sys_net_inet_network); //sys_net.AddFunc(0x506ad863, sys_net_inet_network);
//sys_net->AddFunc(0x858a930b, sys_net_inet_ntoa); //sys_net.AddFunc(0x858a930b, sys_net_inet_ntoa);
//sys_net->AddFunc(0xc98a3146, sys_net_inet_ntop); //sys_net.AddFunc(0xc98a3146, sys_net_inet_ntop);
sys_net->AddFunc(0x8af3825e, sys_net_inet_pton); sys_net.AddFunc(0x8af3825e, sys_net_inet_pton);
sys_net->AddFunc(0x28e208bb, sys_net_listen); sys_net.AddFunc(0x28e208bb, sys_net_listen);
//sys_net->AddFunc(, sys_net_ntohl); //sys_net.AddFunc(, sys_net_ntohl);
//sys_net->AddFunc(, sys_net_ntohs); //sys_net.AddFunc(, sys_net_ntohs);
sys_net->AddFunc(0xfba04f37, sys_net_recv); sys_net.AddFunc(0xfba04f37, sys_net_recv);
sys_net->AddFunc(0x1f953b9f, sys_net_recvfrom); sys_net.AddFunc(0x1f953b9f, sys_net_recvfrom);
//sys_net->AddFunc(0xc9d09c34, sys_net_recvmsg); //sys_net.AddFunc(0xc9d09c34, sys_net_recvmsg);
sys_net->AddFunc(0xdc751b40, sys_net_send); sys_net.AddFunc(0xdc751b40, sys_net_send);
//sys_net->AddFunc(0xad09481b, sys_net_sendmsg); //sys_net.AddFunc(0xad09481b, sys_net_sendmsg);
sys_net->AddFunc(0x9647570b, sys_net_sendto); sys_net.AddFunc(0x9647570b, sys_net_sendto);
sys_net->AddFunc(0x88f03575, sys_net_setsockopt); sys_net.AddFunc(0x88f03575, sys_net_setsockopt);
sys_net->AddFunc(0xa50777c6, sys_net_shutdown); sys_net.AddFunc(0xa50777c6, sys_net_shutdown);
sys_net->AddFunc(0x9c056962, sys_net_socket); sys_net.AddFunc(0x9c056962, sys_net_socket);
sys_net->AddFunc(0x6db6e8cd, sys_net_socketclose); sys_net.AddFunc(0x6db6e8cd, sys_net_socketclose);
//sys_net->AddFunc(0x051ee3ee, sys_net_socketpoll); //sys_net.AddFunc(0x051ee3ee, sys_net_socketpoll);
//sys_net->AddFunc(0x3f09e20a, sys_net_socketselect); //sys_net.AddFunc(0x3f09e20a, sys_net_socketselect);
sys_net->AddFunc(0x139a9e9b, sys_net_initialize_network_ex); sys_net.AddFunc(0x139a9e9b, sys_net_initialize_network_ex);
sys_net->AddFunc(0x05bd4438, sys_net_get_udpp2p_test_param); sys_net.AddFunc(0x05bd4438, sys_net_get_udpp2p_test_param);
sys_net->AddFunc(0x10b81ed6, sys_net_set_udpp2p_test_param); sys_net.AddFunc(0x10b81ed6, sys_net_set_udpp2p_test_param);
sys_net->AddFunc(0x1d14d6e4, sys_net_get_lib_name_server); sys_net.AddFunc(0x1d14d6e4, sys_net_get_lib_name_server);
sys_net->AddFunc(0x27fb339d, sys_net_if_ctl); sys_net.AddFunc(0x27fb339d, sys_net_if_ctl);
sys_net->AddFunc(0x368823c0, sys_net_get_netemu_test_param); sys_net.AddFunc(0x368823c0, sys_net_get_netemu_test_param);
sys_net->AddFunc(0x3b27c780, sys_net_get_sockinfo); sys_net.AddFunc(0x3b27c780, sys_net_get_sockinfo);
sys_net->AddFunc(0x44328aa2, sys_net_close_dump); sys_net.AddFunc(0x44328aa2, sys_net_close_dump);
sys_net->AddFunc(0x4ab0b9b9, sys_net_set_test_param); sys_net.AddFunc(0x4ab0b9b9, sys_net_set_test_param);
sys_net->AddFunc(0x5420e419, sys_net_show_nameserver); sys_net.AddFunc(0x5420e419, sys_net_show_nameserver);
sys_net->AddFunc(0x6005cde1, _sys_net_errno_loc); sys_net.AddFunc(0x6005cde1, _sys_net_errno_loc);
sys_net->AddFunc(0x7687d48c, sys_net_set_resolver_configurations); sys_net.AddFunc(0x7687d48c, sys_net_set_resolver_configurations);
sys_net->AddFunc(0x79b61646, sys_net_show_route); sys_net.AddFunc(0x79b61646, sys_net_show_route);
sys_net->AddFunc(0x89c9917c, sys_net_read_dump); sys_net.AddFunc(0x89c9917c, sys_net_read_dump);
sys_net->AddFunc(0x8ccf05ed, sys_net_abort_resolver); sys_net.AddFunc(0x8ccf05ed, sys_net_abort_resolver);
sys_net->AddFunc(0x8d1b77fb, sys_net_abort_socket); sys_net.AddFunc(0x8d1b77fb, sys_net_abort_socket);
sys_net->AddFunc(0x9a318259, sys_net_set_lib_name_server); sys_net.AddFunc(0x9a318259, sys_net_set_lib_name_server);
sys_net->AddFunc(0xa5a86557, sys_net_get_test_param); sys_net.AddFunc(0xa5a86557, sys_net_get_test_param);
sys_net->AddFunc(0xa765d029, sys_net_get_sockinfo_ex); sys_net.AddFunc(0xa765d029, sys_net_get_sockinfo_ex);
sys_net->AddFunc(0xab447704, sys_net_open_dump); sys_net.AddFunc(0xab447704, sys_net_open_dump);
sys_net->AddFunc(0xb48636c4, sys_net_show_ifconfig); sys_net.AddFunc(0xb48636c4, sys_net_show_ifconfig);
sys_net->AddFunc(0xb68d5625, sys_net_finalize_network); sys_net.AddFunc(0xb68d5625, sys_net_finalize_network);
sys_net->AddFunc(0xc9157d30, _sys_net_h_errno_loc); sys_net.AddFunc(0xc9157d30, _sys_net_h_errno_loc);
sys_net->AddFunc(0xe2434507, sys_net_set_netemu_test_param); sys_net.AddFunc(0xe2434507, sys_net_set_netemu_test_param);
sys_net->AddFunc(0xfdb8f926, sys_net_free_thread_context); sys_net.AddFunc(0xfdb8f926, sys_net_free_thread_context);
} });

View file

@ -956,14 +956,7 @@ void SysCalls::DoSyscall(PPUThread& CPU, u32 code)
return; return;
} }
if(Emu.GetModuleManager().CallFunc(CPU, code)) throw "Invalid syscall number";
{
return;
}
LOG_ERROR(HLE, "TODO: %s", GetHLEFuncName(code).c_str());
CPU.GPR[3] = 0;
} }
IdManager& SysCallBase::GetIdManager() const IdManager& SysCallBase::GetIdManager() const

View file

@ -18,7 +18,7 @@
#include "Emu/FS/vfsDir.h" #include "Emu/FS/vfsDir.h"
#include "cellFs.h" #include "cellFs.h"
Module *sys_fs = nullptr; extern Module sys_fs;
struct FsRingBufferConfig struct FsRingBufferConfig
{ {
@ -41,8 +41,8 @@ struct FsRingBufferConfig
s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::ptr<const void> arg, u64 size) s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::ptr<const void> arg, u64 size)
{ {
sys_fs->Log("cellFsOpen(path_addr=0x%x, flags=0x%x, fd=0x%x, arg=0x%x, size=0x%llx)", path.addr(), flags, fd, arg, size); sys_fs.Log("cellFsOpen(path_addr=0x%x, flags=0x%x, fd=0x%x, arg=0x%x, size=0x%llx)", path.addr(), flags, fd, arg, size);
sys_fs->Log("cellFsOpen(path='%s')", path.get_ptr()); sys_fs.Log("cellFsOpen(path='%s')", path.get_ptr());
const std::string _path = path.get_ptr(); const std::string _path = path.get_ptr();
@ -97,13 +97,13 @@ s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::p
if (_oflags != 0) if (_oflags != 0)
{ {
sys_fs->Error("cellFsOpen(): '%s' has unknown flags! flags: 0x%08x", path.get_ptr(), flags); sys_fs.Error("cellFsOpen(): '%s' has unknown flags! flags: 0x%08x", path.get_ptr(), flags);
return CELL_EINVAL; return CELL_EINVAL;
} }
if (!Emu.GetVFS().ExistsFile(_path)) if (!Emu.GetVFS().ExistsFile(_path))
{ {
sys_fs->Error("cellFsOpen(): '%s' not found! flags: 0x%08x", path.get_ptr(), flags); sys_fs.Error("cellFsOpen(): '%s' not found! flags: 0x%08x", path.get_ptr(), flags);
return CELL_ENOENT; return CELL_ENOENT;
} }
@ -111,23 +111,23 @@ s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::p
if (!stream || !stream->IsOpened()) if (!stream || !stream->IsOpened())
{ {
sys_fs->Error("cellFsOpen(): '%s' not found! flags: 0x%08x", path.get_ptr(), flags); sys_fs.Error("cellFsOpen(): '%s' not found! flags: 0x%08x", path.get_ptr(), flags);
return CELL_ENOENT; return CELL_ENOENT;
} }
u32 id = sys_fs->GetNewId(stream, TYPE_FS_FILE); u32 id = sys_fs.GetNewId(stream, TYPE_FS_FILE);
*fd = id; *fd = id;
sys_fs->Notice("cellFsOpen(): '%s' opened, id -> 0x%x", path.get_ptr(), id); sys_fs.Notice("cellFsOpen(): '%s' opened, id -> 0x%x", path.get_ptr(), id);
return CELL_OK; return CELL_OK;
} }
s32 cellFsRead(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<be_t<u64>> nread) s32 cellFsRead(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<be_t<u64>> nread)
{ {
sys_fs->Log("cellFsRead(fd=0x%x, buf=0x%x, nbytes=0x%llx, nread=0x%x)", fd, buf, nbytes, nread); sys_fs.Log("cellFsRead(fd=0x%x, buf=0x%x, nbytes=0x%llx, nread=0x%x)", fd, buf, nbytes, nread);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
if (nbytes != (u32)nbytes) if (nbytes != (u32)nbytes)
@ -144,10 +144,10 @@ s32 cellFsRead(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<be_t<u64>> nread)
s32 cellFsWrite(u32 fd, vm::ptr<const void> buf, u64 nbytes, vm::ptr<u64> nwrite) s32 cellFsWrite(u32 fd, vm::ptr<const void> buf, u64 nbytes, vm::ptr<u64> nwrite)
{ {
sys_fs->Log("cellFsWrite(fd=0x%x, buf=0x%x, nbytes=0x%llx, nwrite=0x%x)", fd, buf, nbytes, nwrite); sys_fs.Log("cellFsWrite(fd=0x%x, buf=0x%x, nbytes=0x%llx, nwrite=0x%x)", fd, buf, nbytes, nwrite);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs.CheckId(fd, file)) return CELL_ESRCH;
if (nbytes != (u32)nbytes) return CELL_ENOMEM; if (nbytes != (u32)nbytes) return CELL_ENOMEM;
@ -162,7 +162,7 @@ s32 cellFsWrite(u32 fd, vm::ptr<const void> buf, u64 nbytes, vm::ptr<u64> nwrite
s32 cellFsClose(u32 fd) s32 cellFsClose(u32 fd)
{ {
sys_fs->Warning("cellFsClose(fd=0x%x)", fd); sys_fs.Warning("cellFsClose(fd=0x%x)", fd);
if (!Emu.GetIdManager().RemoveID(fd)) if (!Emu.GetIdManager().RemoveID(fd))
return CELL_ESRCH; return CELL_ESRCH;
@ -172,8 +172,8 @@ s32 cellFsClose(u32 fd)
s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<u32> fd) s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<u32> fd)
{ {
sys_fs->Warning("cellFsOpendir(path_addr=0x%x, fd=0x%x)", path.addr(), fd); sys_fs.Warning("cellFsOpendir(path_addr=0x%x, fd=0x%x)", path.addr(), fd);
sys_fs->Warning("cellFsOpendir(path='%s')", path.get_ptr()); sys_fs.Warning("cellFsOpendir(path='%s')", path.get_ptr());
std::shared_ptr<vfsDirBase> dir(Emu.GetVFS().OpenDir(path.get_ptr())); std::shared_ptr<vfsDirBase> dir(Emu.GetVFS().OpenDir(path.get_ptr()));
if (!dir || !dir->IsOpened()) if (!dir || !dir->IsOpened())
@ -181,16 +181,16 @@ s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<u32> fd)
return CELL_ENOENT; return CELL_ENOENT;
} }
*fd = sys_fs->GetNewId(dir, TYPE_FS_DIR); *fd = sys_fs.GetNewId(dir, TYPE_FS_DIR);
return CELL_OK; return CELL_OK;
} }
s32 cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread) s32 cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread)
{ {
sys_fs->Warning("cellFsReaddir(fd=0x%x, dir=0x%x, nread=0x%x)", fd, dir, nread); sys_fs.Warning("cellFsReaddir(fd=0x%x, dir=0x%x, nread=0x%x)", fd, dir, nread);
std::shared_ptr<vfsDirBase> directory; std::shared_ptr<vfsDirBase> directory;
if (!sys_fs->CheckId(fd, directory)) if (!sys_fs.CheckId(fd, directory))
return CELL_ESRCH; return CELL_ESRCH;
const DirEntryInfo* info = directory->Read(); const DirEntryInfo* info = directory->Read();
@ -211,7 +211,7 @@ s32 cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread)
s32 cellFsClosedir(u32 fd) s32 cellFsClosedir(u32 fd)
{ {
sys_fs->Warning("cellFsClosedir(fd=0x%x)", fd); sys_fs.Warning("cellFsClosedir(fd=0x%x)", fd);
if (!Emu.GetIdManager().RemoveID(fd)) if (!Emu.GetIdManager().RemoveID(fd))
return CELL_ESRCH; return CELL_ESRCH;
@ -221,8 +221,8 @@ s32 cellFsClosedir(u32 fd)
s32 cellFsStat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb) s32 cellFsStat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb)
{ {
sys_fs->Warning("cellFsStat(path_addr=0x%x, sb=0x%x)", path.addr(), sb); sys_fs.Warning("cellFsStat(path_addr=0x%x, sb=0x%x)", path.addr(), sb);
sys_fs->Warning("cellFsStat(path='%s')", path.get_ptr()); sys_fs.Warning("cellFsStat(path='%s')", path.get_ptr());
const std::string _path = path.get_ptr(); const std::string _path = path.get_ptr();
@ -248,7 +248,7 @@ s32 cellFsStat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb)
#endif #endif
if (stat_result) if (stat_result)
{ {
sys_fs->Error("cellFsStat(): stat('%s') failed -> 0x%x", real_path.c_str(), stat_result); sys_fs.Error("cellFsStat(): stat('%s') failed -> 0x%x", real_path.c_str(), stat_result);
} }
else else
{ {
@ -267,7 +267,7 @@ s32 cellFsStat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb)
CELL_FS_S_IROTH | CELL_FS_S_IWOTH | CELL_FS_S_IXOTH; CELL_FS_S_IROTH | CELL_FS_S_IWOTH | CELL_FS_S_IXOTH;
if (sb->st_mode == mode) if (sb->st_mode == mode)
sys_fs->Error("cellFsStat(): mode is the same (0x%x)", mode); sys_fs.Error("cellFsStat(): mode is the same (0x%x)", mode);
sb->st_uid = uid; sb->st_uid = uid;
sb->st_gid = gid; sb->st_gid = gid;
@ -296,19 +296,19 @@ s32 cellFsStat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb)
} }
if (sb->st_size == size && size != 0) if (sb->st_size == size && size != 0)
sys_fs->Error("cellFsStat(): size is the same (0x%x)", size); sys_fs.Error("cellFsStat(): size is the same (0x%x)", size);
sys_fs->Warning("cellFsStat(): '%s' not found", path.get_ptr()); sys_fs.Warning("cellFsStat(): '%s' not found", path.get_ptr());
return CELL_ENOENT; return CELL_ENOENT;
} }
s32 cellFsFstat(u32 fd, vm::ptr<CellFsStat> sb) s32 cellFsFstat(u32 fd, vm::ptr<CellFsStat> sb)
{ {
sys_fs->Warning("cellFsFstat(fd=0x%x, sb=0x%x)", fd, sb); sys_fs.Warning("cellFsFstat(fd=0x%x, sb=0x%x)", fd, sb);
IDType type; IDType type;
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file, type) || type != TYPE_FS_FILE) if (!sys_fs.CheckId(fd, file, type) || type != TYPE_FS_FILE)
return CELL_ESRCH; return CELL_ESRCH;
sb->st_mode = sb->st_mode =
@ -330,8 +330,8 @@ s32 cellFsFstat(u32 fd, vm::ptr<CellFsStat> sb)
s32 cellFsMkdir(vm::ptr<const char> path, u32 mode) s32 cellFsMkdir(vm::ptr<const char> path, u32 mode)
{ {
sys_fs->Warning("cellFsMkdir(path_addr=0x%x, mode=0x%x)", path.addr(), mode); sys_fs.Warning("cellFsMkdir(path_addr=0x%x, mode=0x%x)", path.addr(), mode);
sys_fs->Warning("cellFsMkdir(path='%s')", path.get_ptr()); sys_fs.Warning("cellFsMkdir(path='%s')", path.get_ptr());
const std::string _path = path.get_ptr(); const std::string _path = path.get_ptr();
@ -341,14 +341,14 @@ s32 cellFsMkdir(vm::ptr<const char> path, u32 mode)
if (!Emu.GetVFS().CreateDir(_path)) if (!Emu.GetVFS().CreateDir(_path))
return CELL_EBUSY; return CELL_EBUSY;
sys_fs->Notice("cellFsMkdir(): directory '%s' created", path.get_ptr()); sys_fs.Notice("cellFsMkdir(): directory '%s' created", path.get_ptr());
return CELL_OK; return CELL_OK;
} }
s32 cellFsRename(vm::ptr<const char> from, vm::ptr<const char> to) s32 cellFsRename(vm::ptr<const char> from, vm::ptr<const char> to)
{ {
sys_fs->Warning("cellFsRename(from_addr=0x%x, to_addr=0x%x)", from.addr(), to.addr()); sys_fs.Warning("cellFsRename(from_addr=0x%x, to_addr=0x%x)", from.addr(), to.addr());
sys_fs->Warning("cellFsRename(from='%s', to='%s')", from.get_ptr(), to.get_ptr()); sys_fs.Warning("cellFsRename(from='%s', to='%s')", from.get_ptr(), to.get_ptr());
std::string _from = from.get_ptr(); std::string _from = from.get_ptr();
std::string _to = to.get_ptr(); std::string _to = to.get_ptr();
@ -360,7 +360,7 @@ s32 cellFsRename(vm::ptr<const char> from, vm::ptr<const char> to)
if(!dir.Rename(_from, _to)) if(!dir.Rename(_from, _to))
return CELL_EBUSY; return CELL_EBUSY;
sys_fs->Notice("cellFsRename(): directory '%s' renamed to '%s'", from.get_ptr(), to.get_ptr()); sys_fs.Notice("cellFsRename(): directory '%s' renamed to '%s'", from.get_ptr(), to.get_ptr());
return CELL_OK; return CELL_OK;
} }
} }
@ -373,7 +373,7 @@ s32 cellFsRename(vm::ptr<const char> from, vm::ptr<const char> to)
if(!f.Rename(_from, _to)) if(!f.Rename(_from, _to))
return CELL_EBUSY; return CELL_EBUSY;
sys_fs->Notice("cellFsRename(): file '%s' renamed to '%s'", from.get_ptr(), to.get_ptr()); sys_fs.Notice("cellFsRename(): file '%s' renamed to '%s'", from.get_ptr(), to.get_ptr());
return CELL_OK; return CELL_OK;
} }
} }
@ -382,8 +382,8 @@ s32 cellFsRename(vm::ptr<const char> from, vm::ptr<const char> to)
} }
s32 cellFsChmod(vm::ptr<const char> path, u32 mode) s32 cellFsChmod(vm::ptr<const char> path, u32 mode)
{ {
sys_fs->Todo("cellFsChmod(path_addr=0x%x, mode=0x%x)", path.addr(), mode); sys_fs.Todo("cellFsChmod(path_addr=0x%x, mode=0x%x)", path.addr(), mode);
sys_fs->Todo("cellFsChmod(path='%s')", path.get_ptr()); sys_fs.Todo("cellFsChmod(path='%s')", path.get_ptr());
// TODO: // TODO:
@ -392,7 +392,7 @@ s32 cellFsChmod(vm::ptr<const char> path, u32 mode)
s32 cellFsFsync(u32 fd) s32 cellFsFsync(u32 fd)
{ {
sys_fs->Todo("cellFsFsync(fd=0x%x)", fd); sys_fs.Todo("cellFsFsync(fd=0x%x)", fd);
// TODO: // TODO:
@ -401,8 +401,8 @@ s32 cellFsFsync(u32 fd)
s32 cellFsRmdir(vm::ptr<const char> path) s32 cellFsRmdir(vm::ptr<const char> path)
{ {
sys_fs->Warning("cellFsRmdir(path_addr=0x%x)", path.addr()); sys_fs.Warning("cellFsRmdir(path_addr=0x%x)", path.addr());
sys_fs->Warning("cellFsRmdir(path='%s')", path.get_ptr()); sys_fs.Warning("cellFsRmdir(path='%s')", path.get_ptr());
std::string _path = path.get_ptr(); std::string _path = path.get_ptr();
@ -413,14 +413,14 @@ s32 cellFsRmdir(vm::ptr<const char> path)
if (!d.Remove(_path)) if (!d.Remove(_path))
return CELL_EBUSY; return CELL_EBUSY;
sys_fs->Notice("cellFsRmdir(): directory '%s' removed", path.get_ptr()); sys_fs.Notice("cellFsRmdir(): directory '%s' removed", path.get_ptr());
return CELL_OK; return CELL_OK;
} }
s32 cellFsUnlink(vm::ptr<const char> path) s32 cellFsUnlink(vm::ptr<const char> path)
{ {
sys_fs->Warning("cellFsUnlink(path_addr=0x%x)", path.addr()); sys_fs.Warning("cellFsUnlink(path_addr=0x%x)", path.addr());
sys_fs->Warning("cellFsUnlink(path='%s')", path.get_ptr()); sys_fs.Warning("cellFsUnlink(path='%s')", path.get_ptr());
std::string _path = path.get_ptr(); std::string _path = path.get_ptr();
@ -433,13 +433,13 @@ s32 cellFsUnlink(vm::ptr<const char> path)
if (!Emu.GetVFS().RemoveFile(_path)) if (!Emu.GetVFS().RemoveFile(_path))
return CELL_EACCES; return CELL_EACCES;
sys_fs->Notice("cellFsUnlink(): file '%s' removed", path.get_ptr()); sys_fs.Notice("cellFsUnlink(): file '%s' removed", path.get_ptr());
return CELL_OK; return CELL_OK;
} }
s32 cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<be_t<u64>> pos) s32 cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<be_t<u64>> pos)
{ {
sys_fs->Log("cellFsLseek(fd=0x%x, offset=0x%llx, whence=0x%x, pos=0x%x)", fd, offset, whence, pos); sys_fs.Log("cellFsLseek(fd=0x%x, offset=0x%llx, whence=0x%x, pos=0x%x)", fd, offset, whence, pos);
vfsSeekMode seek_mode; vfsSeekMode seek_mode;
switch(whence) switch(whence)
@ -448,13 +448,13 @@ s32 cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<be_t<u64>> pos)
case CELL_SEEK_CUR: seek_mode = vfsSeekCur; break; case CELL_SEEK_CUR: seek_mode = vfsSeekCur; break;
case CELL_SEEK_END: seek_mode = vfsSeekEnd; break; case CELL_SEEK_END: seek_mode = vfsSeekEnd; break;
default: default:
sys_fs->Error("cellFsLseek(fd=0x%x): Unknown seek whence! (0x%x)", fd, whence); sys_fs.Error("cellFsLseek(fd=0x%x): Unknown seek whence! (0x%x)", fd, whence);
return CELL_EINVAL; return CELL_EINVAL;
} }
IDType type; IDType type;
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file, type) || type != TYPE_FS_FILE) if (!sys_fs.CheckId(fd, file, type) || type != TYPE_FS_FILE)
return CELL_ESRCH; return CELL_ESRCH;
*pos = file->Seek(offset, seek_mode); *pos = file->Seek(offset, seek_mode);
@ -463,11 +463,11 @@ s32 cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<be_t<u64>> pos)
s32 cellFsFtruncate(u32 fd, u64 size) s32 cellFsFtruncate(u32 fd, u64 size)
{ {
sys_fs->Warning("cellFsFtruncate(fd=0x%x, size=0x%llx)", fd, size); sys_fs.Warning("cellFsFtruncate(fd=0x%x, size=0x%llx)", fd, size);
IDType type; IDType type;
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file, type) || type != TYPE_FS_FILE) if (!sys_fs.CheckId(fd, file, type) || type != TYPE_FS_FILE)
return CELL_ESRCH; return CELL_ESRCH;
u64 initialSize = file->GetSize(); u64 initialSize = file->GetSize();
@ -492,13 +492,13 @@ s32 cellFsFtruncate(u32 fd, u64 size)
s32 cellFsTruncate(vm::ptr<const char> path, u64 size) s32 cellFsTruncate(vm::ptr<const char> path, u64 size)
{ {
sys_fs->Warning("cellFsTruncate(path_addr=0x%x, size=0x%llx)", path.addr(), size); sys_fs.Warning("cellFsTruncate(path_addr=0x%x, size=0x%llx)", path.addr(), size);
sys_fs->Warning("cellFsTruncate(path='%s')", path.get_ptr()); sys_fs.Warning("cellFsTruncate(path='%s')", path.get_ptr());
vfsFile f(path.get_ptr(), vfsReadWrite); vfsFile f(path.get_ptr(), vfsReadWrite);
if (!f.IsOpened()) if (!f.IsOpened())
{ {
sys_fs->Warning("cellFsTruncate(): '%s' not found", path.get_ptr()); sys_fs.Warning("cellFsTruncate(): '%s' not found", path.get_ptr());
return CELL_ENOENT; return CELL_ENOENT;
} }
u64 initialSize = f.GetSize(); u64 initialSize = f.GetSize();
@ -523,12 +523,12 @@ s32 cellFsTruncate(vm::ptr<const char> path, u64 size)
s32 cellFsFGetBlockSize(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size) s32 cellFsFGetBlockSize(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size)
{ {
sys_fs->Warning("cellFsFGetBlockSize(fd=0x%x, sector_size=0x%x, block_size=0x%x)", fd, sector_size, block_size); sys_fs.Warning("cellFsFGetBlockSize(fd=0x%x, sector_size=0x%x, block_size=0x%x)", fd, sector_size, block_size);
LV2_LOCK(0); LV2_LOCK(0);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
*sector_size = 4096; // ? *sector_size = 4096; // ?
@ -539,8 +539,8 @@ s32 cellFsFGetBlockSize(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_siz
s32 cellFsGetBlockSize(vm::ptr<const char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size) s32 cellFsGetBlockSize(vm::ptr<const char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size)
{ {
sys_fs->Warning("cellFsGetBlockSize(path_addr=0x%x, sector_size=0x%x, block_size=0x%x)", path.addr(), sector_size, block_size); sys_fs.Warning("cellFsGetBlockSize(path_addr=0x%x, sector_size=0x%x, block_size=0x%x)", path.addr(), sector_size, block_size);
sys_fs->Warning("cellFsGetBlockSize(path='%s')", path.get_ptr()); sys_fs.Warning("cellFsGetBlockSize(path='%s')", path.get_ptr());
*sector_size = 4096; // ? *sector_size = 4096; // ?
*block_size = 4096; // ? *block_size = 4096; // ?
@ -550,8 +550,8 @@ s32 cellFsGetBlockSize(vm::ptr<const char> path, vm::ptr<u64> sector_size, vm::p
s32 cellFsGetFreeSize(vm::ptr<const char> path, vm::ptr<u32> block_size, vm::ptr<u64> block_count) s32 cellFsGetFreeSize(vm::ptr<const char> path, vm::ptr<u32> block_size, vm::ptr<u64> block_count)
{ {
sys_fs->Warning("cellFsGetFreeSize(path_addr=0x%x, block_size=0x%x, block_count=0x%x)", path.addr(), block_size, block_count); sys_fs.Warning("cellFsGetFreeSize(path_addr=0x%x, block_size=0x%x, block_count=0x%x)", path.addr(), block_size, block_count);
sys_fs->Warning("cellFsGetFreeSize(path='%s')", path.get_ptr()); sys_fs.Warning("cellFsGetFreeSize(path='%s')", path.get_ptr());
// TODO: Get real values. Currently, it always returns 40 GB of free space divided in 4 KB blocks // TODO: Get real values. Currently, it always returns 40 GB of free space divided in 4 KB blocks
*block_size = 4096; // ? *block_size = 4096; // ?
@ -562,10 +562,10 @@ s32 cellFsGetFreeSize(vm::ptr<const char> path, vm::ptr<u32> block_size, vm::ptr
s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32 entries_size, vm::ptr<u32> data_count) s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32 entries_size, vm::ptr<u32> data_count)
{ {
sys_fs->Warning("cellFsGetDirectoryEntries(fd=0x%x, entries=0x%x, entries_size=0x%x, data_count=0x%x)", fd, entries, entries_size, data_count); sys_fs.Warning("cellFsGetDirectoryEntries(fd=0x%x, entries=0x%x, entries_size=0x%x, data_count=0x%x)", fd, entries, entries_size, data_count);
std::shared_ptr<vfsDirBase> directory; std::shared_ptr<vfsDirBase> directory;
if (!sys_fs->CheckId(fd, directory)) if (!sys_fs.CheckId(fd, directory))
return CELL_ESRCH; return CELL_ESRCH;
const DirEntryInfo* info = directory->Read(); const DirEntryInfo* info = directory->Read();
@ -598,10 +598,10 @@ s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32
s32 cellFsStReadInit(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf) s32 cellFsStReadInit(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
{ {
sys_fs->Warning("cellFsStReadInit(fd=0x%x, ringbuf=0x%x)", fd, ringbuf); sys_fs.Warning("cellFsStReadInit(fd=0x%x, ringbuf=0x%x)", fd, ringbuf);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
fs_config.m_ring_buffer = *ringbuf; fs_config.m_ring_buffer = *ringbuf;
@ -623,10 +623,10 @@ s32 cellFsStReadInit(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
s32 cellFsStReadFinish(u32 fd) s32 cellFsStReadFinish(u32 fd)
{ {
sys_fs->Warning("cellFsStReadFinish(fd=0x%x)", fd); sys_fs.Warning("cellFsStReadFinish(fd=0x%x)", fd);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
Memory.Free(fs_config.m_buffer); Memory.Free(fs_config.m_buffer);
@ -637,25 +637,25 @@ s32 cellFsStReadFinish(u32 fd)
s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf) s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
{ {
sys_fs->Warning("cellFsStReadGetRingBuf(fd=0x%x, ringbuf=0x%x)", fd, ringbuf); sys_fs.Warning("cellFsStReadGetRingBuf(fd=0x%x, ringbuf=0x%x)", fd, ringbuf);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
*ringbuf = fs_config.m_ring_buffer; *ringbuf = fs_config.m_ring_buffer;
sys_fs->Warning("*** fs stream config: block_size=0x%llx, copy=0x%x, ringbuf_size=0x%llx, transfer_rate=0x%llx", sys_fs.Warning("*** fs stream config: block_size=0x%llx, copy=0x%x, ringbuf_size=0x%llx, transfer_rate=0x%llx",
ringbuf->block_size, ringbuf->copy, ringbuf->ringbuf_size, ringbuf->transfer_rate); ringbuf->block_size, ringbuf->copy, ringbuf->ringbuf_size, ringbuf->transfer_rate);
return CELL_OK; return CELL_OK;
} }
s32 cellFsStReadGetStatus(u32 fd, vm::ptr<u64> status) s32 cellFsStReadGetStatus(u32 fd, vm::ptr<u64> status)
{ {
sys_fs->Warning("cellFsStReadGetRingBuf(fd=0x%x, status=0x%x)", fd, status); sys_fs.Warning("cellFsStReadGetRingBuf(fd=0x%x, status=0x%x)", fd, status);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
*status = fs_config.m_fs_status; *status = fs_config.m_fs_status;
@ -665,10 +665,10 @@ s32 cellFsStReadGetStatus(u32 fd, vm::ptr<u64> status)
s32 cellFsStReadGetRegid(u32 fd, vm::ptr<u64> regid) s32 cellFsStReadGetRegid(u32 fd, vm::ptr<u64> regid)
{ {
sys_fs->Warning("cellFsStReadGetRingBuf(fd=0x%x, regid=0x%x)", fd, regid); sys_fs.Warning("cellFsStReadGetRingBuf(fd=0x%x, regid=0x%x)", fd, regid);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
*regid = fs_config.m_regid; *regid = fs_config.m_regid;
@ -678,10 +678,10 @@ s32 cellFsStReadGetRegid(u32 fd, vm::ptr<u64> regid)
s32 cellFsStReadStart(u32 fd, u64 offset, u64 size) s32 cellFsStReadStart(u32 fd, u64 offset, u64 size)
{ {
sys_fs->Todo("cellFsStReadStart(fd=0x%x, offset=0x%llx, size=0x%llx)", fd, offset, size); sys_fs.Todo("cellFsStReadStart(fd=0x%x, offset=0x%llx, size=0x%llx)", fd, offset, size);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
fs_config.m_current_addr = fs_config.m_buffer + (u32)offset; fs_config.m_current_addr = fs_config.m_buffer + (u32)offset;
@ -692,10 +692,10 @@ s32 cellFsStReadStart(u32 fd, u64 offset, u64 size)
s32 cellFsStReadStop(u32 fd) s32 cellFsStReadStop(u32 fd)
{ {
sys_fs->Warning("cellFsStReadStop(fd=0x%x)", fd); sys_fs.Warning("cellFsStReadStop(fd=0x%x)", fd);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
fs_config.m_fs_status = CELL_FS_ST_STOP; fs_config.m_fs_status = CELL_FS_ST_STOP;
@ -705,10 +705,10 @@ s32 cellFsStReadStop(u32 fd)
s32 cellFsStRead(u32 fd, vm::ptr<u8> buf, u64 size, vm::ptr<u64> rsize) s32 cellFsStRead(u32 fd, vm::ptr<u8> buf, u64 size, vm::ptr<u64> rsize)
{ {
sys_fs->Warning("cellFsStRead(fd=0x%x, buf=0x%x, size=0x%llx, rsize=0x%x)", fd, buf, size, rsize); sys_fs.Warning("cellFsStRead(fd=0x%x, buf=0x%x, size=0x%llx, rsize=0x%x)", fd, buf, size, rsize);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
// TODO: use ringbuffer (fs_config) // TODO: use ringbuffer (fs_config)
@ -724,10 +724,10 @@ s32 cellFsStRead(u32 fd, vm::ptr<u8> buf, u64 size, vm::ptr<u64> rsize)
s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<vm::ptr<u8>> addr, vm::ptr<u64> size) s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<vm::ptr<u8>> addr, vm::ptr<u64> size)
{ {
sys_fs->Todo("cellFsStReadGetCurrentAddr(fd=0x%x, addr=0x%x, size=0x%x)", fd, addr, size); sys_fs.Todo("cellFsStReadGetCurrentAddr(fd=0x%x, addr=0x%x, size=0x%x)", fd, addr, size);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
return CELL_OK; return CELL_OK;
@ -735,10 +735,10 @@ s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<vm::ptr<u8>> addr, vm::ptr<u64> s
s32 cellFsStReadPutCurrentAddr(u32 fd, vm::ptr<u8> addr, u64 size) s32 cellFsStReadPutCurrentAddr(u32 fd, vm::ptr<u8> addr, u64 size)
{ {
sys_fs->Todo("cellFsStReadPutCurrentAddr(fd=0x%x, addr=0x%x, size=0x%llx)", fd, addr, size); sys_fs.Todo("cellFsStReadPutCurrentAddr(fd=0x%x, addr=0x%x, size=0x%llx)", fd, addr, size);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
return CELL_OK; return CELL_OK;
@ -746,10 +746,10 @@ s32 cellFsStReadPutCurrentAddr(u32 fd, vm::ptr<u8> addr, u64 size)
s32 cellFsStReadWait(u32 fd, u64 size) s32 cellFsStReadWait(u32 fd, u64 size)
{ {
sys_fs->Todo("cellFsStReadWait(fd=0x%x, size=0x%llx)", fd, size); sys_fs.Todo("cellFsStReadWait(fd=0x%x, size=0x%llx)", fd, size);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
return CELL_OK; return CELL_OK;
@ -757,10 +757,10 @@ s32 cellFsStReadWait(u32 fd, u64 size)
s32 cellFsStReadWaitCallback(u32 fd, u64 size, vm::ptr<void(int xfd, u64 xsize)> func) s32 cellFsStReadWaitCallback(u32 fd, u64 size, vm::ptr<void(int xfd, u64 xsize)> func)
{ {
sys_fs->Todo("cellFsStReadWaitCallback(fd=0x%x, size=0x%llx, func=0x%x)", fd, size, func); sys_fs.Todo("cellFsStReadWaitCallback(fd=0x%x, size=0x%llx, func=0x%x)", fd, size, func);
std::shared_ptr<vfsStream> file; std::shared_ptr<vfsStream> file;
if (!sys_fs->CheckId(fd, file)) if (!sys_fs.CheckId(fd, file))
return CELL_ESRCH; return CELL_ESRCH;
return CELL_OK; return CELL_OK;
@ -799,13 +799,13 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil
if (!packed_stream || !packed_stream->IsOpened()) if (!packed_stream || !packed_stream->IsOpened())
{ {
sys_fs->Error("'%s' not found! flags: 0x%02x", packed_file.c_str(), vfsRead); sys_fs.Error("'%s' not found! flags: 0x%02x", packed_file.c_str(), vfsRead);
return CELL_ENOENT; return CELL_ENOENT;
} }
if (!unpacked_stream || !unpacked_stream->IsOpened()) if (!unpacked_stream || !unpacked_stream->IsOpened())
{ {
sys_fs->Error("'%s' couldn't be created! flags: 0x%02x", unpacked_file.c_str(), vfsWrite); sys_fs.Error("'%s' couldn't be created! flags: 0x%02x", unpacked_file.c_str(), vfsWrite);
return CELL_ENOENT; return CELL_ENOENT;
} }
@ -814,7 +814,7 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil
u32 format = re32(*(u32*)&buffer[0]); u32 format = re32(*(u32*)&buffer[0]);
if (format != 0x4E504400) // "NPD\x00" if (format != 0x4E504400) // "NPD\x00"
{ {
sys_fs->Error("Illegal format. Expected 0x4E504400, but got 0x%08x", format); sys_fs.Error("Illegal format. Expected 0x4E504400, but got 0x%08x", format);
return CELL_EFSSPECIFIC; return CELL_EFSSPECIFIC;
} }
@ -828,7 +828,7 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil
// SDATA file is compressed // SDATA file is compressed
if (flags & 0x1) if (flags & 0x1)
{ {
sys_fs->Warning("cellFsSdataOpen: Compressed SDATA files are not supported yet."); sys_fs.Warning("cellFsSdataOpen: Compressed SDATA files are not supported yet.");
return CELL_EFSSPECIFIC; return CELL_EFSSPECIFIC;
} }
@ -841,7 +841,7 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil
if (!sdata_check(version, flags, filesizeInput, filesizeTmp)) if (!sdata_check(version, flags, filesizeInput, filesizeTmp))
{ {
sys_fs->Error("cellFsSdataOpen: Wrong header information."); sys_fs.Error("cellFsSdataOpen: Wrong header information.");
return CELL_EFSSPECIFIC; return CELL_EFSSPECIFIC;
} }
@ -868,8 +868,8 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil
s32 cellFsSdataOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::ptr<const void> arg, u64 size) s32 cellFsSdataOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::ptr<const void> arg, u64 size)
{ {
sys_fs->Warning("cellFsSdataOpen(path_addr=0x%x, flags=0x%x, fd=0x%x, arg=0x%x, size=0x%llx) -> cellFsOpen()", path.addr(), flags, fd, arg, size); sys_fs.Warning("cellFsSdataOpen(path_addr=0x%x, flags=0x%x, fd=0x%x, arg=0x%x, size=0x%llx) -> cellFsOpen()", path.addr(), flags, fd, arg, size);
sys_fs->Warning("cellFsSdataOpen(path='%s')", path.get_ptr()); sys_fs.Warning("cellFsSdataOpen(path='%s')", path.get_ptr());
/*if (flags != CELL_O_RDONLY) /*if (flags != CELL_O_RDONLY)
return CELL_EINVAL; return CELL_EINVAL;
@ -884,7 +884,7 @@ s32 cellFsSdataOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd,
int ret = sdata_unpack(path, unpacked_path); int ret = sdata_unpack(path, unpacked_path);
if (ret) return ret; if (ret) return ret;
fd = sys_fs->GetNewId(Emu.GetVFS().OpenFile(unpacked_path, vfsRead), TYPE_FS_FILE); fd = sys_fs.GetNewId(Emu.GetVFS().OpenFile(unpacked_path, vfsRead), TYPE_FS_FILE);
return CELL_OK;*/ return CELL_OK;*/
@ -893,7 +893,7 @@ s32 cellFsSdataOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd,
s32 cellFsSdataOpenByFd(u32 mself_fd, s32 flags, vm::ptr<u32> sdata_fd, u64 offset, vm::ptr<const void> arg, u64 size) s32 cellFsSdataOpenByFd(u32 mself_fd, s32 flags, vm::ptr<u32> sdata_fd, u64 offset, vm::ptr<const void> arg, u64 size)
{ {
sys_fs->Todo("cellFsSdataOpenByFd(mself_fd=0x%x, flags=0x%x, sdata_fd=0x%x, offset=0x%llx, arg=0x%x, size=0x%llx)", mself_fd, flags, sdata_fd, offset, arg, size); sys_fs.Todo("cellFsSdataOpenByFd(mself_fd=0x%x, flags=0x%x, sdata_fd=0x%x, offset=0x%llx, arg=0x%x, size=0x%llx)", mself_fd, flags, sdata_fd, offset, arg, size);
// TODO: // TODO:
@ -911,7 +911,7 @@ void fsAioRead(u32 fd, vm::ptr<CellFsAio> aio, int xid, vm::ptr<void(vm::ptr<Cel
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
sys_fs->Warning("fsAioRead() aborted"); sys_fs.Warning("fsAioRead() aborted");
return; return;
} }
} }
@ -920,9 +920,9 @@ void fsAioRead(u32 fd, vm::ptr<CellFsAio> aio, int xid, vm::ptr<void(vm::ptr<Cel
u64 res = 0; u64 res = 0;
{ {
std::shared_ptr<vfsStream> orig_file; std::shared_ptr<vfsStream> orig_file;
if (!sys_fs->CheckId(fd, orig_file)) if (!sys_fs.CheckId(fd, orig_file))
{ {
sys_fs->Error("Wrong fd (%s)", fd); sys_fs.Error("Wrong fd (%s)", fd);
Emu.Pause(); Emu.Pause();
return; return;
} }
@ -944,7 +944,7 @@ void fsAioRead(u32 fd, vm::ptr<CellFsAio> aio, int xid, vm::ptr<void(vm::ptr<Cel
file.Seek(old_pos); file.Seek(old_pos);
sys_fs->Log("*** fsAioRead(fd=%d, offset=0x%llx, buf=0x%x, size=0x%llx, error=0x%x, res=0x%llx, xid=0x%x)", sys_fs.Log("*** fsAioRead(fd=%d, offset=0x%llx, buf=0x%x, size=0x%llx, error=0x%x, res=0x%llx, xid=0x%x)",
fd, aio->offset, aio->buf, aio->size, error, res, xid); fd, aio->offset, aio->buf, aio->size, error, res, xid);
} }
@ -961,7 +961,7 @@ void fsAioRead(u32 fd, vm::ptr<CellFsAio> aio, int xid, vm::ptr<void(vm::ptr<Cel
s32 cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, vm::ptr<void(vm::ptr<CellFsAio> xaio, s32 error, s32 xid, u64 size)> func) s32 cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, vm::ptr<void(vm::ptr<CellFsAio> xaio, s32 error, s32 xid, u64 size)> func)
{ {
sys_fs->Warning("cellFsAioRead(aio=0x%x, id=0x%x, func=0x%x)", aio, id, func); sys_fs.Warning("cellFsAioRead(aio=0x%x, id=0x%x, func=0x%x)", aio, id, func);
if (!aio_init) if (!aio_init)
{ {
@ -971,7 +971,7 @@ s32 cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, vm::ptr<void(vm::ptr<
std::shared_ptr<vfsStream> orig_file; std::shared_ptr<vfsStream> orig_file;
u32 fd = aio->fd; u32 fd = aio->fd;
if (!sys_fs->CheckId(fd, orig_file)) if (!sys_fs.CheckId(fd, orig_file))
{ {
return CELL_EBADF; return CELL_EBADF;
} }
@ -986,7 +986,7 @@ s32 cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, vm::ptr<void(vm::ptr<
s32 cellFsAioWrite(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, vm::ptr<void(vm::ptr<CellFsAio> xaio, s32 error, s32 xid, u64 size)> func) s32 cellFsAioWrite(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, vm::ptr<void(vm::ptr<CellFsAio> xaio, s32 error, s32 xid, u64 size)> func)
{ {
sys_fs->Todo("cellFsAioWrite(aio=0x%x, id=0x%x, func=0x%x)", aio, id, func); sys_fs.Todo("cellFsAioWrite(aio=0x%x, id=0x%x, func=0x%x)", aio, id, func);
// TODO: // TODO:
@ -995,8 +995,8 @@ s32 cellFsAioWrite(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, vm::ptr<void(vm::ptr
s32 cellFsAioInit(vm::ptr<const char> mount_point) s32 cellFsAioInit(vm::ptr<const char> mount_point)
{ {
sys_fs->Warning("cellFsAioInit(mount_point_addr=0x%x)", mount_point.addr()); sys_fs.Warning("cellFsAioInit(mount_point_addr=0x%x)", mount_point.addr());
sys_fs->Warning("cellFsAioInit(mount_point='%s')", mount_point.get_ptr()); sys_fs.Warning("cellFsAioInit(mount_point='%s')", mount_point.get_ptr());
aio_init = true; aio_init = true;
return CELL_OK; return CELL_OK;
@ -1004,8 +1004,8 @@ s32 cellFsAioInit(vm::ptr<const char> mount_point)
s32 cellFsAioFinish(vm::ptr<const char> mount_point) s32 cellFsAioFinish(vm::ptr<const char> mount_point)
{ {
sys_fs->Warning("cellFsAioFinish(mount_point_addr=0x%x)", mount_point.addr()); sys_fs.Warning("cellFsAioFinish(mount_point_addr=0x%x)", mount_point.addr());
sys_fs->Warning("cellFsAioFinish(mount_point='%s')", mount_point.get_ptr()); sys_fs.Warning("cellFsAioFinish(mount_point='%s')", mount_point.get_ptr());
//aio_init = false; //aio_init = false;
return CELL_OK; return CELL_OK;
@ -1013,7 +1013,7 @@ s32 cellFsAioFinish(vm::ptr<const char> mount_point)
s32 cellFsReadWithOffset(PPUThread& CPU, u32 fd, u64 offset, vm::ptr<void> buf, u64 buffer_size, vm::ptr<be_t<u64>> nread) s32 cellFsReadWithOffset(PPUThread& CPU, u32 fd, u64 offset, vm::ptr<void> buf, u64 buffer_size, vm::ptr<be_t<u64>> nread)
{ {
sys_fs->Warning("cellFsReadWithOffset(fd=%d, offset=0x%llx, buf=0x%x, buffer_size=%lld, nread=0x%llx)", fd, offset, buf, buffer_size, nread); sys_fs.Warning("cellFsReadWithOffset(fd=%d, offset=0x%llx, buf=0x%x, buffer_size=%lld, nread=0x%llx)", fd, offset, buf, buffer_size, nread);
int ret; int ret;
vm::stackvar<be_t<u64>> oldPos(CPU), newPos(CPU); vm::stackvar<be_t<u64>> oldPos(CPU), newPos(CPU);
@ -1029,56 +1029,51 @@ s32 cellFsReadWithOffset(PPUThread& CPU, u32 fd, u64 offset, vm::ptr<void> buf,
return CELL_OK; return CELL_OK;
} }
void sys_fs_init(Module *pxThis) Module sys_fs("sys_fs", []()
{
sys_fs = pxThis;
sys_fs->AddFunc(0x718bf5f8, cellFsOpen);
sys_fs->AddFunc(0xb1840b53, cellFsSdataOpen);
sys_fs->AddFunc(0x6d3bb15b, cellFsSdataOpenByFd);
sys_fs->AddFunc(0x4d5ff8e2, cellFsRead);
sys_fs->AddFunc(0xecdcf2ab, cellFsWrite);
sys_fs->AddFunc(0x2cb51f0d, cellFsClose);
sys_fs->AddFunc(0x3f61245c, cellFsOpendir);
sys_fs->AddFunc(0x5c74903d, cellFsReaddir);
sys_fs->AddFunc(0xff42dcc3, cellFsClosedir);
sys_fs->AddFunc(0x7de6dced, cellFsStat);
sys_fs->AddFunc(0xef3efa34, cellFsFstat);
sys_fs->AddFunc(0xba901fe6, cellFsMkdir);
sys_fs->AddFunc(0xf12eecc8, cellFsRename);
sys_fs->AddFunc(0x99406d0b, cellFsChmod);
sys_fs->AddFunc(0x967a162b, cellFsFsync);
sys_fs->AddFunc(0x2796fdf3, cellFsRmdir);
sys_fs->AddFunc(0x7f4677a8, cellFsUnlink);
sys_fs->AddFunc(0xa397d042, cellFsLseek);
sys_fs->AddFunc(0x0e2939e5, cellFsFtruncate);
sys_fs->AddFunc(0xc9dc3ac5, cellFsTruncate);
sys_fs->AddFunc(0xcb588dba, cellFsFGetBlockSize);
sys_fs->AddFunc(0xc1c507e7, cellFsAioRead);
sys_fs->AddFunc(0x4cef342e, cellFsAioWrite);
sys_fs->AddFunc(0xdb869f20, cellFsAioInit);
sys_fs->AddFunc(0x9f951810, cellFsAioFinish);
sys_fs->AddFunc(0x1a108ab7, cellFsGetBlockSize);
sys_fs->AddFunc(0xaa3b4bcd, cellFsGetFreeSize);
sys_fs->AddFunc(0x0d5b4a14, cellFsReadWithOffset);
sys_fs->AddFunc(0x9b882495, cellFsGetDirectoryEntries);
sys_fs->AddFunc(0x2664c8ae, cellFsStReadInit);
sys_fs->AddFunc(0xd73938df, cellFsStReadFinish);
sys_fs->AddFunc(0xb3afee8b, cellFsStReadGetRingBuf);
sys_fs->AddFunc(0xcf34969c, cellFsStReadGetStatus);
sys_fs->AddFunc(0xbd273a88, cellFsStReadGetRegid);
sys_fs->AddFunc(0x8df28ff9, cellFsStReadStart);
sys_fs->AddFunc(0xf8e5d9a0, cellFsStReadStop);
sys_fs->AddFunc(0x27800c6b, cellFsStRead);
sys_fs->AddFunc(0x190912f6, cellFsStReadGetCurrentAddr);
sys_fs->AddFunc(0x81f33783, cellFsStReadPutCurrentAddr);
sys_fs->AddFunc(0x8f71c5b2, cellFsStReadWait);
sys_fs->AddFunc(0x866f6aec, cellFsStReadWaitCallback);
}
void sys_fs_load()
{ {
g_FsAioReadID = 0; g_FsAioReadID = 0;
g_FsAioReadCur = 0; g_FsAioReadCur = 0;
aio_init = false; aio_init = false;
}
sys_fs.AddFunc(0x718bf5f8, cellFsOpen);
sys_fs.AddFunc(0xb1840b53, cellFsSdataOpen);
sys_fs.AddFunc(0x6d3bb15b, cellFsSdataOpenByFd);
sys_fs.AddFunc(0x4d5ff8e2, cellFsRead);
sys_fs.AddFunc(0xecdcf2ab, cellFsWrite);
sys_fs.AddFunc(0x2cb51f0d, cellFsClose);
sys_fs.AddFunc(0x3f61245c, cellFsOpendir);
sys_fs.AddFunc(0x5c74903d, cellFsReaddir);
sys_fs.AddFunc(0xff42dcc3, cellFsClosedir);
sys_fs.AddFunc(0x7de6dced, cellFsStat);
sys_fs.AddFunc(0xef3efa34, cellFsFstat);
sys_fs.AddFunc(0xba901fe6, cellFsMkdir);
sys_fs.AddFunc(0xf12eecc8, cellFsRename);
sys_fs.AddFunc(0x99406d0b, cellFsChmod);
sys_fs.AddFunc(0x967a162b, cellFsFsync);
sys_fs.AddFunc(0x2796fdf3, cellFsRmdir);
sys_fs.AddFunc(0x7f4677a8, cellFsUnlink);
sys_fs.AddFunc(0xa397d042, cellFsLseek);
sys_fs.AddFunc(0x0e2939e5, cellFsFtruncate);
sys_fs.AddFunc(0xc9dc3ac5, cellFsTruncate);
sys_fs.AddFunc(0xcb588dba, cellFsFGetBlockSize);
sys_fs.AddFunc(0xc1c507e7, cellFsAioRead);
sys_fs.AddFunc(0x4cef342e, cellFsAioWrite);
sys_fs.AddFunc(0xdb869f20, cellFsAioInit);
sys_fs.AddFunc(0x9f951810, cellFsAioFinish);
sys_fs.AddFunc(0x1a108ab7, cellFsGetBlockSize);
sys_fs.AddFunc(0xaa3b4bcd, cellFsGetFreeSize);
sys_fs.AddFunc(0x0d5b4a14, cellFsReadWithOffset);
sys_fs.AddFunc(0x9b882495, cellFsGetDirectoryEntries);
sys_fs.AddFunc(0x2664c8ae, cellFsStReadInit);
sys_fs.AddFunc(0xd73938df, cellFsStReadFinish);
sys_fs.AddFunc(0xb3afee8b, cellFsStReadGetRingBuf);
sys_fs.AddFunc(0xcf34969c, cellFsStReadGetStatus);
sys_fs.AddFunc(0xbd273a88, cellFsStReadGetRegid);
sys_fs.AddFunc(0x8df28ff9, cellFsStReadStart);
sys_fs.AddFunc(0xf8e5d9a0, cellFsStReadStop);
sys_fs.AddFunc(0x27800c6b, cellFsStRead);
sys_fs.AddFunc(0x190912f6, cellFsStReadGetCurrentAddr);
sys_fs.AddFunc(0x81f33783, cellFsStReadPutCurrentAddr);
sys_fs.AddFunc(0x8f71c5b2, cellFsStReadWait);
sys_fs.AddFunc(0x866f6aec, cellFsStReadWaitCallback);
});

View file

@ -189,7 +189,7 @@ bool Emulator::BootGame(const std::string& path, bool direct)
void Emulator::Load() void Emulator::Load()
{ {
GetModuleManager().init(); GetModuleManager().Init();
if (!rExists(m_path)) return; if (!rExists(m_path)) return;
@ -379,6 +379,8 @@ void Emulator::Stop()
// TODO: check finalization order // TODO: check finalization order
clear_ps3_functions();
SavePoints(BreakPointsDBName); SavePoints(BreakPointsDBName);
m_break_points.clear(); m_break_points.clear();
m_marked_points.clear(); m_marked_points.clear();
@ -394,7 +396,7 @@ void Emulator::Stop()
GetKeyboardManager().Close(); GetKeyboardManager().Close();
GetMouseManager().Close(); GetMouseManager().Close();
GetCallbackManager().Clear(); GetCallbackManager().Clear();
GetModuleManager().UnloadModules(); GetModuleManager().Close();
GetSFuncManager().StaticFinalize(); GetSFuncManager().StaticFinalize();
GetSyncPrimManager().Close(); GetSyncPrimManager().Close();

View file

@ -110,13 +110,13 @@ namespace loader
if (!segment.begin) if (!segment.begin)
{ {
LOG_ERROR(LOADER, "%s() sprx: AllocFixed(0x%llx, 0x%x) failed", __FUNCTION__, phdr.p_vaddr.addr(), (u32)phdr.p_memsz); LOG_ERROR(LOADER, "%s() sprx: vm::alloc(0x%x) failed", __FUNCTION__, segment.size);
return loading_error; return loading_error;
} }
segment.initial_addr.set(phdr.p_vaddr.addr()); segment.initial_addr.set(phdr.p_vaddr.addr());
LOG_ERROR(LOADER, "segment addr=0x%x, initial addr = 0x%x", segment.begin.addr(), segment.initial_addr.addr()); LOG_WARNING(LOADER, "segment addr=0x%x, initial addr = 0x%x", segment.begin.addr(), segment.initial_addr.addr());
if (phdr.p_filesz) if (phdr.p_filesz)
{ {
@ -129,16 +129,11 @@ namespace loader
sys_prx_module_info_t module_info; sys_prx_module_info_t module_info;
m_stream->Seek(handler::get_stream_offset() + phdr.p_paddr.addr()); m_stream->Seek(handler::get_stream_offset() + phdr.p_paddr.addr());
m_stream->Read(&module_info, sizeof(module_info)); m_stream->Read(&module_info, sizeof(module_info));
LOG_ERROR(LOADER, "%s (%x):", module_info.name, (u32)module_info.toc);
info.name = std::string(module_info.name, 28); info.name = std::string(module_info.name, 28);
info.rtoc = module_info.toc; info.rtoc = module_info.toc + segment.begin.addr();
int import_count = (module_info.imports_end - module_info.imports_start) / sizeof(sys_prx_library_info_t); LOG_WARNING(LOADER, "%s (rtoc=%x):", info.name, info.rtoc);
if (import_count)
{
LOG_ERROR(LOADER, "**** Lib '%s' has %d imports!", module_info.name, import_count);
}
sys_prx_library_info_t lib; sys_prx_library_info_t lib;
for (u32 e = module_info.exports_start.addr(); for (u32 e = module_info.exports_start.addr();
@ -155,12 +150,12 @@ namespace loader
m_stream->Seek(handler::get_stream_offset() + phdr.p_offset + lib.name_addr); m_stream->Seek(handler::get_stream_offset() + phdr.p_offset + lib.name_addr);
m_stream->Read(name, sizeof(name)); m_stream->Read(name, sizeof(name));
modulename = std::string(name); modulename = std::string(name);
LOG_ERROR(LOADER, "**** %s", name); LOG_WARNING(LOADER, "**** Exported: %s", name);
} }
auto &module = info.modules[modulename]; auto &module = info.modules[modulename];
LOG_ERROR(LOADER, "**** 0x%x - 0x%x - 0x%x", (u32)lib.unk4, (u32)lib.unk5, (u32)lib.unk6); LOG_WARNING(LOADER, "**** 0x%x - 0x%x - 0x%x", (u32)lib.unk4, (u32)lib.unk5, (u32)lib.unk6);
for (u16 i = 0, end = lib.num_func; i < end; ++i) for (u16 i = 0, end = lib.num_func; i < end; ++i)
{ {
@ -174,7 +169,7 @@ namespace loader
module.exports[fnid] = fstub; module.exports[fnid] = fstub;
//LOG_NOTICE(LOADER, "Exported function '%s' in '%s' module (LLE)", SysCalls::GetHLEFuncName(fnid).c_str(), module_name.c_str()); //LOG_NOTICE(LOADER, "Exported function '%s' in '%s' module (LLE)", SysCalls::GetHLEFuncName(fnid).c_str(), module_name.c_str());
LOG_ERROR(LOADER, "**** %s: [%s] -> 0x%x", modulename.c_str(), SysCalls::GetHLEFuncName(fnid).c_str(), (u32)fstub); LOG_WARNING(LOADER, "**** %s: [%s] -> 0x%x", modulename.c_str(), SysCalls::GetHLEFuncName(fnid).c_str(), (u32)fstub);
} }
} }
@ -184,6 +179,34 @@ namespace loader
{ {
m_stream->Seek(handler::get_stream_offset() + phdr.p_offset + i); m_stream->Seek(handler::get_stream_offset() + phdr.p_offset + i);
m_stream->Read(&lib, sizeof(lib)); m_stream->Read(&lib, sizeof(lib));
std::string modulename;
if (lib.name_addr)
{
char name[27];
m_stream->Seek(handler::get_stream_offset() + phdr.p_offset + lib.name_addr);
m_stream->Read(name, sizeof(name));
modulename = std::string(name);
LOG_WARNING(LOADER, "**** Imported: %s", name);
}
auto &module = info.modules[modulename];
LOG_WARNING(LOADER, "**** 0x%x - 0x%x - 0x%x", (u32)lib.unk4, (u32)lib.unk5, (u32)lib.unk6);
for (u16 i = 0, end = lib.num_func; i < end; ++i)
{
be_t<u32> fnid, fstub;
m_stream->Seek(handler::get_stream_offset() + phdr.p_offset + lib.fnid_addr + i * sizeof(fnid));
m_stream->Read(&fnid, sizeof(fnid));
m_stream->Seek(handler::get_stream_offset() + phdr.p_offset + lib.fstub_addr + i * sizeof(fstub));
m_stream->Read(&fstub, sizeof(fstub));
module.imports[fnid] = fstub;
LOG_WARNING(LOADER, "**** %s: [%s] -> 0x%x", modulename.c_str(), SysCalls::GetHLEFuncName(fnid).c_str(), (u32)fstub);
}
} }
} }
@ -207,22 +230,22 @@ namespace loader
switch ((u32)rel.type) switch ((u32)rel.type)
{ {
case 1: case 1:
LOG_WARNING(LOADER, "**** RELOCATION(1): 0x%x <- 0x%x", ADDR, (u32)(info.segments[rel.index_value].begin.addr() + rel.ptr.addr())); LOG_NOTICE(LOADER, "**** RELOCATION(1): 0x%x <- 0x%x", ADDR, (u32)(info.segments[rel.index_value].begin.addr() + rel.ptr.addr()));
*vm::ptr<u32>::make(ADDR) = info.segments[rel.index_value].begin.addr() + rel.ptr.addr(); *vm::ptr<u32>::make(ADDR) = info.segments[rel.index_value].begin.addr() + rel.ptr.addr();
break; break;
case 4: case 4:
LOG_WARNING(LOADER, "**** RELOCATION(4): 0x%x <- 0x%x", ADDR, (u16)(rel.ptr.addr())); LOG_NOTICE(LOADER, "**** RELOCATION(4): 0x%x <- 0x%x", ADDR, (u16)(rel.ptr.addr()));
*vm::ptr<u16>::make(ADDR) = (u16)(u64)rel.ptr.addr(); *vm::ptr<u16>::make(ADDR) = (u16)(u64)rel.ptr.addr();
break; break;
case 5: case 5:
LOG_WARNING(LOADER, "**** RELOCATION(5): 0x%x <- 0x%x", ADDR, (u16)(info.segments[rel.index_value].begin.addr() >> 16)); LOG_NOTICE(LOADER, "**** RELOCATION(5): 0x%x <- 0x%x", ADDR, (u16)(info.segments[rel.index_value].begin.addr() >> 16));
*vm::ptr<u16>::make(ADDR) = info.segments[rel.index_value].begin.addr() >> 16; *vm::ptr<u16>::make(ADDR) = info.segments[rel.index_value].begin.addr() >> 16;
break; break;
case 6: case 6:
LOG_ERROR(LOADER, "**** RELOCATION(6): 0x%x <- 0x%x", ADDR, (u16)(info.segments[1].begin.addr() >> 16)); LOG_WARNING(LOADER, "**** RELOCATION(6): 0x%x <- 0x%x", ADDR, (u16)(info.segments[1].begin.addr() >> 16));
*vm::ptr<u16>::make(ADDR) = info.segments[1].begin.addr() >> 16; *vm::ptr<u16>::make(ADDR) = info.segments[1].begin.addr() >> 16;
break; break;
@ -330,17 +353,40 @@ namespace loader
continue; continue;
} }
Module* module = Emu.GetModuleManager().GetModuleByName(m.first); Module* module = Emu.GetModuleManager().GetModuleByName(m.first.c_str());
if (!module) if (!module)
{ {
LOG_ERROR(LOADER, "unknown module '%s' in '%s' library", m.first.c_str(), info.name.c_str()); LOG_WARNING(LOADER, "Unknown module '%s' in '%s' library", m.first.c_str(), info.name.c_str());
module = new Module(-1, m.first.c_str());
} }
for (auto &e : m.second.exports) for (auto& f : m.second.exports)
{ {
module->RegisterLLEFunc(e.first, vm::ptr<void()>::make(e.second)); add_ps3_func(ModuleFunc(f.first, module, nullptr, vm::ptr<void()>::make(f.second)));
}
for (auto& f : m.second.imports)
{
const u32 nid = f.first;
const u32 addr = f.second + info.segments[0].begin.addr();
u32 index;
auto func = get_ps3_func_by_nid(nid, &index);
if (!func)
{
LOG_ERROR(LOADER, "Unimplemented function '%s' (0x%x)", SysCalls::GetHLEFuncName(nid), addr);
index = add_ps3_func(ModuleFunc(nid, module, nullptr));
}
else
{
LOG_NOTICE(LOADER, "Imported function '%s' (0x%x)", SysCalls::GetHLEFuncName(nid), addr);
}
vm::write32(addr + 0, HACK(index));
vm::write32(addr + 4, BLR());
} }
} }
} }
@ -505,65 +551,81 @@ namespace loader
for (auto stub = proc_prx_param.libstubstart; stub < proc_prx_param.libstubend; ++stub) for (auto stub = proc_prx_param.libstubstart; stub < proc_prx_param.libstubend; ++stub)
{ {
const std::string module_name = stub->s_modulename.get_ptr(); const std::string module_name = stub->s_modulename.get_ptr();
Module* module = Emu.GetModuleManager().GetModuleByName(module_name);
if (module) Module* module = Emu.GetModuleManager().GetModuleByName(module_name.c_str());
{
//module->SetLoaded(); if (!module)
}
else
{ {
LOG_WARNING(LOADER, "Unknown module '%s'", module_name.c_str()); LOG_WARNING(LOADER, "Unknown module '%s'", module_name.c_str());
} }
struct tbl_item //struct tbl_item
{ //{
be_t<u32> stub; // be_t<u32> stub;
be_t<u32> rtoc; // be_t<u32> rtoc;
}; //};
struct stub_data_t //struct stub_data_t
{ //{
be_t<u32> data[3]; // be_t<u32> data[3];
} //}
static const stub_data = //static const stub_data =
{ //{
be_t<u32>::make(MR(11, 2)), // be_t<u32>::make(MR(11, 2)),
be_t<u32>::make(SC(0)), // be_t<u32>::make(SC(0)),
be_t<u32>::make(BLR()) // be_t<u32>::make(BLR())
}; //};
const auto& tbl = vm::get().alloc<tbl_item>(stub->s_imports); //const auto& tbl = vm::get().alloc<tbl_item>(stub->s_imports);
const auto& dst = vm::get().alloc<stub_data_t>(stub->s_imports); //const auto& dst = vm::get().alloc<stub_data_t>(stub->s_imports);
for (u32 i = 0; i < stub->s_imports; ++i) for (u32 i = 0; i < stub->s_imports; ++i)
{ {
const u32 nid = stub->s_nid[i]; const u32 nid = stub->s_nid[i];
auto func = module ? module->GetFunc(nid) : nullptr; const u32 addr = stub->s_text[i];
if (!func || !func->lle_func) u32 index;
auto func = get_ps3_func_by_nid(nid, &index);
if (!func)
{ {
dst[i] = stub_data; LOG_ERROR(LOADER, "Unimplemented function '%s' in '%s' module (0x%x)", SysCalls::GetHLEFuncName(nid), module_name, addr);
tbl[i].stub = (dst + i).addr(); index = add_ps3_func(ModuleFunc(nid, module, nullptr));
tbl[i].rtoc = stub->s_nid[i];
stub->s_text[i] = (tbl + i).addr();
if (module && !module->Load(nid))
{
LOG_ERROR(LOADER, "Unimplemented function '%s' in '%s' module (HLE)", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str());
}
else //if (Ini.HLELogging.GetValue())
{
LOG_NOTICE(LOADER, "Imported function '%s' in '%s' module (HLE)", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str());
}
} }
else else
{ {
stub->s_text[i] = func->lle_func.addr(); LOG_NOTICE(LOADER, "Imported %sfunction '%s' in '%s' module (0x%x)", func->lle_func ? "LLE " : "", SysCalls::GetHLEFuncName(nid), module_name, addr);
//Is function auto exported, than we can use it
LOG_NOTICE(LOADER, "Imported function '%s' in '%s' module (LLE: 0x%x)", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str(), (u32)stub->s_text[i]);
} }
vm::write32(addr + 0, HACK(index));
vm::write32(addr + 4, BLR());
//if (!func || !func->lle_func)
//{
// dst[i] = stub_data;
// tbl[i].stub = (dst + i).addr();
// tbl[i].rtoc = stub->s_nid[i];
// stub->s_text[i] = (tbl + i).addr();
// if (!func)
// {
//
// }
// else //if (Ini.HLELogging.GetValue())
// {
// LOG_NOTICE(LOADER, "Imported function '%s' in '%s' module (HLE)", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str());
// }
//}
//else
//{
// stub->s_text[i] = func->lle_func.addr();
// //Is function auto exported, than we can use it
// LOG_NOTICE(LOADER, "Imported function '%s' in '%s' module (LLE: 0x%x)", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str(), (u32)stub->s_text[i]);
//}
} }
} }
} }