diff --git a/Utilities/GNU.h b/Utilities/GNU.h index 00a80a57fb..5caba7d525 100644 --- a/Utilities/GNU.h +++ b/Utilities/GNU.h @@ -7,7 +7,7 @@ #define noexcept _NOEXCEPT_OP #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) && _MSC_VER <= 1800 #define thread_local __declspec(thread) #elif __APPLE__ #define thread_local __thread diff --git a/Utilities/SSemaphore.cpp b/Utilities/SSemaphore.cpp deleted file mode 100644 index fd1aad9fbb..0000000000 --- a/Utilities/SSemaphore.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "stdafx.h" -#include "Utilities/SSemaphore.h" -#include "Emu/System.h" - -void SSemaphore::wait() -{ - u32 order; - { - std::lock_guard lock(m_mutex); - if (m_count && m_out_order == m_in_order) - { - m_count--; - return; - } - order = m_in_order++; - } - - std::unique_lock cv_lock(m_cv_mutex); - - while (true) - { - CHECK_EMU_STATUS; - - m_cond.wait_for(cv_lock, std::chrono::milliseconds(1)); - - { - std::lock_guard lock(m_mutex); - if (m_count) - { - if (m_out_order == order) - { - m_count--; - m_out_order++; - return; - } - else - { - m_cond.notify_one(); - } - } - } - } -} - -bool SSemaphore::try_wait() -{ - std::lock_guard lock(m_mutex); - - if (m_count && m_in_order == m_out_order) - { - m_count--; - return true; - } - else - { - return false; - } -} - -void SSemaphore::post() -{ - std::lock_guard lock(m_mutex); - - if (m_count < m_max) - { - m_count++; - } - else - { - return; - } - - m_cond.notify_one(); -} - -bool SSemaphore::post_and_wait() -{ - // TODO: merge these functions? Probably has a race condition. - if (try_wait()) return false; - - post(); - wait(); - - return true; -} diff --git a/Utilities/SSemaphore.h b/Utilities/SSemaphore.h deleted file mode 100644 index 2e61262959..0000000000 --- a/Utilities/SSemaphore.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -class SSemaphore -{ - const u32 m_max; - u32 m_count; - u32 m_in_order; - u32 m_out_order; - std::mutex m_cv_mutex; - std::mutex m_mutex; - std::condition_variable m_cond; - -public: - SSemaphore(u32 value, u32 max = 1) - : m_max(max > 0 ? max : 0xffffffff) - , m_count(value > m_max ? m_max : value) - , m_in_order(0) - , m_out_order(0) - { - } - - SSemaphore() - : m_max(0xffffffff) - , m_count(0) - , m_in_order(0) - , m_out_order(0) - { - } - - ~SSemaphore() - { - } - - void wait(); - - bool try_wait(); - - void post(); - - bool post_and_wait(); -}; \ No newline at end of file diff --git a/Utilities/Semaphore.cpp b/Utilities/Semaphore.cpp new file mode 100644 index 0000000000..ed3d419e12 --- /dev/null +++ b/Utilities/Semaphore.cpp @@ -0,0 +1,120 @@ +#include "stdafx.h" +#include "Utilities/Semaphore.h" + +bool semaphore_t::try_wait() +{ + // check m_value without interlocked op + if (m_var.load().value == 0) + { + return false; + } + + // try to decrement m_value atomically + const auto old = m_var.atomic_op([](sync_var_t& var) + { + if (var.value) + { + var.value--; + } + }); + + // recheck atomic result + if (old.value == 0) + { + return false; + } + + return true; +} + +bool semaphore_t::try_post() +{ + // check m_value without interlocked op + if (m_var.load().value >= max_value) + { + return false; + } + + // try to increment m_value atomically + const auto old = m_var.atomic_op([&](sync_var_t& var) + { + if (var.value < max_value) + { + var.value++; + } + }); + + // recheck atomic result + if (old.value >= max_value) + { + return false; + } + + if (old.waiters) + { + // notify waiting thread + std::lock_guard lock(m_mutex); + + m_cv.notify_one(); + } + + return true; +} + +void semaphore_t::wait() +{ + if (m_var.atomic_op([](sync_var_t& var) -> bool + { + if (var.value) + { + var.value--; + + return true; + } + else + { + //var.waiters++; + + return false; + } + })) + { + return; + } + + std::unique_lock lock(m_mutex); + + m_var.atomic_op([](sync_var_t& var) + { + var.waiters++; + }); + + while (!m_var.atomic_op([](sync_var_t& var) -> bool + { + if (var.value) + { + var.value--; + var.waiters--; + + return true; + } + else + { + return false; + } + })) + { + m_cv.wait(lock); + } +} + +bool semaphore_t::post_and_wait() +{ + // TODO: merge these functions? Probably has a race condition. + if (try_wait()) return false; + + try_post(); + wait(); + + return true; +} diff --git a/Utilities/Semaphore.h b/Utilities/Semaphore.h new file mode 100644 index 0000000000..03d3a77168 --- /dev/null +++ b/Utilities/Semaphore.h @@ -0,0 +1,37 @@ +#pragma once + +class semaphore_t +{ + // semaphore mutex + std::mutex m_mutex; + + // semaphore condition variable + std::condition_variable m_cv; + + struct sync_var_t + { + u32 value; // current semaphore value + u32 waiters; // current amount of waiters + }; + + // current semaphore value + atomic_t m_var; + +public: + // max semaphore value + const u32 max_value; + + semaphore_t(u32 max_value = 1, u32 value = 0) + : m_var({ value, 0 }) + , max_value(max_value) + { + } + + bool try_wait(); + + bool try_post(); + + void wait(); + + bool post_and_wait(); +}; \ No newline at end of file diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 2e8f672489..4913436ace 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -109,15 +109,14 @@ enum x64_op_t : u32 X64OP_NONE, X64OP_LOAD, // obtain and put the value into x64 register X64OP_STORE, // take the value from x64 register or an immediate and use it - - // example: add eax,[rax] -> X64OP_LOAD_ADD (add the value to x64 register) - // example: add [rax],eax -> X64OP_LOAD_ADD_STORE (this will probably never happen for MMIO registers) - X64OP_MOVS, X64OP_STOS, X64OP_XCHG, X64OP_CMPXCHG, X64OP_LOAD_AND_STORE, // lock and [mem],reg + X64OP_LOAD_OR_STORE, // TODO: lock or [mem], reg + X64OP_INC, // TODO: lock inc [mem] + X64OP_DEC, // TODO: lock dec [mem] }; void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, size_t& out_size, size_t& out_length) @@ -272,6 +271,18 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, siz switch (op2) { + case 0x11: + { + if (!repe && !repne && !oso) // MOVUPS xmm/m, xmm + { + out_op = X64OP_STORE; + out_reg = get_modRM_reg_xmm(code, rex); + out_size = 16; + out_length += get_modRM_size(code); + return; + } + break; + } case 0x7f: { if ((repe && !oso) || (!repe && oso)) // MOVDQU/MOVDQA xmm/m, xmm @@ -470,7 +481,6 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, siz } } - LOG_WARNING(MEMORY, "decode_x64_reg_op(%016llxh): unsupported opcode found (%016llX%016llX)", (size_t)code - out_length, *(be_t*)(code - out_length), *(be_t*)(code - out_length + 8)); out_op = X64OP_NONE; out_reg = X64_NOT_SET; out_size = 0; @@ -789,9 +799,18 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) // decode single x64 instruction that causes memory access decode_x64_reg_op(code, op, reg, d_size, i_size); + auto report_opcode = [=]() + { + if (op == X64OP_NONE) + { + LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): unsupported opcode found (%016llX%016llX)", code, *(be_t*)(code), *(be_t*)(code + 8)); + } + }; + if ((d_size | d_size + addr) >= 0x100000000ull) { LOG_ERROR(MEMORY, "Invalid d_size (0x%llx)", d_size); + report_opcode(); return false; } @@ -801,6 +820,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) if ((a_size | a_size + addr) >= 0x100000000ull) { LOG_ERROR(MEMORY, "Invalid a_size (0x%llx)", a_size); + report_opcode(); return false; } @@ -817,6 +837,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) if (a_size != 4 || !d_size || !i_size) { LOG_ERROR(MEMORY, "Invalid or unsupported instruction (op=%d, reg=%d, d_size=%lld, a_size=0x%llx, i_size=%lld)", op, reg, d_size, a_size, i_size); + report_opcode(); return false; } @@ -847,6 +868,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) default: { LOG_ERROR(MEMORY, "Invalid or unsupported operation (op=%d, reg=%d, d_size=%lld, i_size=%lld)", op, reg, d_size, i_size); + report_opcode(); return false; } } @@ -863,6 +885,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) if (!d_size || !i_size) { LOG_ERROR(MEMORY, "Invalid or unsupported instruction (op=%d, reg=%d, d_size=%lld, a_size=0x%llx, i_size=%lld)", op, reg, d_size, a_size, i_size); + report_opcode(); return false; } @@ -1074,6 +1097,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) default: { LOG_ERROR(MEMORY, "Invalid or unsupported operation (op=%d, reg=%d, d_size=%lld, a_size=0x%llx, i_size=%lld)", op, reg, d_size, a_size, i_size); + report_opcode(); return false; } } diff --git a/rpcs3/Emu/ARMv7/ARMv7Context.h b/rpcs3/Emu/ARMv7/ARMv7Context.h index 592109ae60..3de2c17bc4 100644 --- a/rpcs3/Emu/ARMv7/ARMv7Context.h +++ b/rpcs3/Emu/ARMv7/ARMv7Context.h @@ -298,16 +298,16 @@ struct cast_armv7_gpr }; template<> -struct cast_armv7_gpr +struct cast_armv7_gpr { - force_inline static u32 to_gpr(const bool& value) + force_inline static u32 to_gpr(const b8& value) { return value; } - force_inline static bool from_gpr(const u32& reg) + force_inline static b8 from_gpr(const u32& reg) { - return reinterpret_cast(reg); + return reg != 0; } }; diff --git a/rpcs3/Emu/ARMv7/Modules/sceDbg.cpp b/rpcs3/Emu/ARMv7/Modules/sceDbg.cpp index 33d3ce6a31..262b0ea7d9 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceDbg.cpp +++ b/rpcs3/Emu/ARMv7/Modules/sceDbg.cpp @@ -14,7 +14,7 @@ s32 sceDbgSetBreakOnErrorState(SceDbgBreakOnErrorState state) throw EXCEPTION(""); } -s32 sceDbgAssertionHandler(vm::cptr pFile, s32 line, bool stop, vm::cptr pComponent, vm::cptr pMessage, armv7_va_args_t va_args) +s32 sceDbgAssertionHandler(vm::cptr pFile, s32 line, b8 stop, vm::cptr pComponent, vm::cptr pMessage, armv7_va_args_t va_args) { throw EXCEPTION(""); } diff --git a/rpcs3/Emu/ARMv7/Modules/sceDeci4p.h b/rpcs3/Emu/ARMv7/Modules/sceDeci4p.h index 8f5e20acfe..98f9e59faa 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceDeci4p.h +++ b/rpcs3/Emu/ARMv7/Modules/sceDeci4p.h @@ -1,5 +1,5 @@ #pragma once -using SceKernelDeci4pCallback = func_def pCommon)>; +using SceKernelDeci4pCallback = s32(s32 notifyId, s32 notifyCount, s32 notifyArg, vm::ptr pCommon); extern psv_log_base sceDeci4p; diff --git a/rpcs3/Emu/ARMv7/Modules/sceFiber.h b/rpcs3/Emu/ARMv7/Modules/sceFiber.h index 521d0eeb13..5ad7a5251c 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceFiber.h +++ b/rpcs3/Emu/ARMv7/Modules/sceFiber.h @@ -1,6 +1,6 @@ #pragma once -using SceFiberEntry = func_def; +using SceFiberEntry = void(u32 argOnInitialize, u32 argOnRun); struct set_alignment(8) SceFiber { diff --git a/rpcs3/Emu/ARMv7/Modules/sceFios.cpp b/rpcs3/Emu/ARMv7/Modules/sceFios.cpp index 58ca7c3fa1..1ee3a319aa 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceFios.cpp +++ b/rpcs3/Emu/ARMv7/Modules/sceFios.cpp @@ -14,7 +14,7 @@ void sceFiosTerminate() throw EXCEPTION(""); } -bool sceFiosIsInitialized(vm::ptr pOutParameters) +b8 sceFiosIsInitialized(vm::ptr pOutParameters) { throw EXCEPTION(""); } @@ -29,7 +29,7 @@ void sceFiosSetGlobalDefaultOpAttr(vm::cptr pAttr) throw EXCEPTION(""); } -bool sceFiosGetGlobalDefaultOpAttr(vm::ptr pOutAttr) +b8 sceFiosGetGlobalDefaultOpAttr(vm::ptr pOutAttr) { throw EXCEPTION(""); } @@ -39,7 +39,7 @@ void sceFiosSetThreadDefaultOpAttr(vm::cptr pAttr) throw EXCEPTION(""); } -bool sceFiosGetThreadDefaultOpAttr(vm::ptr pOutAttr) +b8 sceFiosGetThreadDefaultOpAttr(vm::ptr pOutAttr) { throw EXCEPTION(""); } @@ -59,7 +59,7 @@ u32 sceFiosGetSuspendCount() throw EXCEPTION(""); } -bool sceFiosIsSuspended() +b8 sceFiosIsSuspended() { throw EXCEPTION(""); } @@ -84,7 +84,7 @@ void sceFiosCloseAllFiles() throw EXCEPTION(""); } -bool sceFiosIsIdle() +b8 sceFiosIsIdle() { throw EXCEPTION(""); } @@ -104,7 +104,7 @@ u32 sceFiosGetAllOps(vm::ptr pOutArray, u32 arraySize) throw EXCEPTION(""); } -bool sceFiosIsValidHandle(s32 h) +b8 sceFiosIsValidHandle(s32 h) { throw EXCEPTION(""); } @@ -129,12 +129,12 @@ s32 sceFiosVprintf(vm::cptr pFormat) // va_list throw EXCEPTION(""); } -s32 sceFiosFileExists(vm::cptr pAttr, vm::cptr pPath, vm::ptr pOutExists) +s32 sceFiosFileExists(vm::cptr pAttr, vm::cptr pPath, vm::ptr pOutExists) { throw EXCEPTION(""); } -bool sceFiosFileExistsSync(vm::cptr pAttr, vm::cptr pPath) +b8 sceFiosFileExistsSync(vm::cptr pAttr, vm::cptr pPath) { throw EXCEPTION(""); } @@ -159,12 +159,12 @@ s32 sceFiosFileDeleteSync(vm::cptr pAttr, vm::cptr pPath) throw EXCEPTION(""); } -s32 sceFiosDirectoryExists(vm::cptr pAttr, vm::cptr pPath, vm::ptr pOutExists) +s32 sceFiosDirectoryExists(vm::cptr pAttr, vm::cptr pPath, vm::ptr pOutExists) { throw EXCEPTION(""); } -bool sceFiosDirectoryExistsSync(vm::cptr pAttr, vm::cptr pPath) +b8 sceFiosDirectoryExistsSync(vm::cptr pAttr, vm::cptr pPath) { throw EXCEPTION(""); } @@ -189,12 +189,12 @@ s32 sceFiosDirectoryDeleteSync(vm::cptr pAttr, vm::cptr pPa throw EXCEPTION(""); } -s32 sceFiosExists(vm::cptr pAttr, vm::cptr pPath, vm::ptr pOutExists) +s32 sceFiosExists(vm::cptr pAttr, vm::cptr pPath, vm::ptr pOutExists) { throw EXCEPTION(""); } -bool sceFiosExistsSync(vm::cptr pAttr, vm::cptr pPath) +b8 sceFiosExistsSync(vm::cptr pAttr, vm::cptr pPath) { throw EXCEPTION(""); } @@ -459,7 +459,7 @@ vm::cptr sceFiosDHGetPath(s32 dh) throw EXCEPTION(""); } -bool sceFiosOpIsDone(s32 op) +b8 sceFiosOpIsDone(s32 op) { throw EXCEPTION(""); } @@ -499,7 +499,7 @@ void sceFiosOpCancel(s32 op) throw EXCEPTION(""); } -bool sceFiosOpIsCancelled(s32 op) +b8 sceFiosOpIsCancelled(s32 op) { throw EXCEPTION(""); } diff --git a/rpcs3/Emu/ARMv7/Modules/sceFios.h b/rpcs3/Emu/ARMv7/Modules/sceFios.h index 68c14608fa..195d69b74e 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceFios.h +++ b/rpcs3/Emu/ARMv7/Modules/sceFios.h @@ -1,8 +1,8 @@ #pragma once -using SceFiosOpCallback = func_def pContext, s32 op, u8 event, s32 err)>; -using SceFiosVprintfCallback = func_def fmt, va_list ap)>; -using SceFiosMemcpyCallback = func_def(vm::ptr dst, vm::cptr src, u32 len)>; +using SceFiosOpCallback = s32(vm::ptr pContext, s32 op, u8 event, s32 err); +using SceFiosVprintfCallback = s32(vm::cptr fmt, va_list ap); +using SceFiosMemcpyCallback = vm::ptr(vm::ptr dst, vm::cptr src, u32 len); enum SceFiosWhence : s32 { @@ -100,7 +100,7 @@ struct SceFiosOverlay char src[292]; }; -using SceFiosIOFilterCallback = func_def; +using SceFiosIOFilterCallback = void(); struct SceFiosPsarcDearchiverContext { diff --git a/rpcs3/Emu/ARMv7/Modules/sceGxm.cpp b/rpcs3/Emu/ARMv7/Modules/sceGxm.cpp index 0a176282a9..ae0f51a416 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceGxm.cpp +++ b/rpcs3/Emu/ARMv7/Modules/sceGxm.cpp @@ -85,7 +85,7 @@ s32 sceGxmDestroyContext(vm::ptr context) throw EXCEPTION(""); } -void sceGxmSetValidationEnable(vm::ptr context, bool enable) +void sceGxmSetValidationEnable(vm::ptr context, b8 enable) { throw EXCEPTION(""); } @@ -388,7 +388,7 @@ s32 sceGxmColorSurfaceInitDisabled(vm::ptr surface) throw EXCEPTION(""); } -bool sceGxmColorSurfaceIsEnabled(vm::cptr surface) +b8 sceGxmColorSurfaceIsEnabled(vm::cptr surface) { throw EXCEPTION(""); } @@ -473,7 +473,7 @@ void sceGxmDepthStencilSurfaceSetBackgroundStencil(vm::ptr surface) +b8 sceGxmDepthStencilSurfaceIsEnabled(vm::cptr surface) { throw EXCEPTION(""); } @@ -544,17 +544,17 @@ SceGxmProgramType sceGxmProgramGetType(vm::cptr program) throw EXCEPTION(""); } -bool sceGxmProgramIsDiscardUsed(vm::cptr program) +b8 sceGxmProgramIsDiscardUsed(vm::cptr program) { throw EXCEPTION(""); } -bool sceGxmProgramIsDepthReplaceUsed(vm::cptr program) +b8 sceGxmProgramIsDepthReplaceUsed(vm::cptr program) { throw EXCEPTION(""); } -bool sceGxmProgramIsSpriteCoordUsed(vm::cptr program) +b8 sceGxmProgramIsSpriteCoordUsed(vm::cptr program) { throw EXCEPTION(""); } @@ -634,7 +634,7 @@ u32 sceGxmProgramParameterGetContainerIndex(vm::cptr par throw EXCEPTION(""); } -bool sceGxmProgramParameterIsSamplerCube(vm::cptr parameter) +b8 sceGxmProgramParameterIsSamplerCube(vm::cptr parameter) { throw EXCEPTION(""); } diff --git a/rpcs3/Emu/ARMv7/Modules/sceGxm.h b/rpcs3/Emu/ARMv7/Modules/sceGxm.h index c6a37730d8..bd6d5c7fe5 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceGxm.h +++ b/rpcs3/Emu/ARMv7/Modules/sceGxm.h @@ -29,7 +29,7 @@ enum SCE_GXM_ERROR_DRIVER = 0x805B0017, }; -using SceGxmDisplayQueueCallback = func_def callbackData)>; +using SceGxmDisplayQueueCallback = void(vm::cptr callbackData); struct SceGxmInitializeParams { @@ -1193,12 +1193,12 @@ struct SceGxmShaderPatcher; struct SceGxmRegisteredProgram; -using SceGxmShaderPatcherHostAllocCallback = func_def(vm::ptr userData, u32 size)>; -using SceGxmShaderPatcherHostFreeCallback = func_def userData, vm::ptr mem)>; -using SceGxmShaderPatcherBufferAllocCallback = func_def(vm::ptr userData, u32 size)>; -using SceGxmShaderPatcherBufferFreeCallback = func_def userData, vm::ptr mem)>; -using SceGxmShaderPatcherUsseAllocCallback = func_def(vm::ptr userData, u32 size, vm::ptr usseOffset)>; -using SceGxmShaderPatcherUsseFreeCallback = func_def userData, vm::ptr mem)>; +using SceGxmShaderPatcherHostAllocCallback = vm::ptr(vm::ptr userData, u32 size); +using SceGxmShaderPatcherHostFreeCallback = void(vm::ptr userData, vm::ptr mem); +using SceGxmShaderPatcherBufferAllocCallback = vm::ptr(vm::ptr userData, u32 size); +using SceGxmShaderPatcherBufferFreeCallback = void(vm::ptr userData, vm::ptr mem); +using SceGxmShaderPatcherUsseAllocCallback = vm::ptr(vm::ptr userData, u32 size, vm::ptr usseOffset); +using SceGxmShaderPatcherUsseFreeCallback = void(vm::ptr userData, vm::ptr mem); struct SceGxmShaderPatcherParams { diff --git a/rpcs3/Emu/ARMv7/Modules/sceHttp.h b/rpcs3/Emu/ARMv7/Modules/sceHttp.h index 6b957307ef..69e027bb06 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceHttp.h +++ b/rpcs3/Emu/ARMv7/Modules/sceHttp.h @@ -29,8 +29,8 @@ enum SceHttpAuthType : s32 SCE_HTTP_AUTH_RESERVED2 }; -using SceHttpAuthInfoCallback = func_def realm, vm::ptr username, vm::ptr password, s32 needEntity, vm::pptr entityBody, vm::ptr entitySize, vm::ptr save, vm::ptr userArg)>; -using SceHttpRedirectCallback = func_def method, vm::cptr location, vm::ptr userArg)>; +using SceHttpAuthInfoCallback = s32(s32 request, SceHttpAuthType authType, vm::cptr realm, vm::ptr username, vm::ptr password, s32 needEntity, vm::pptr entityBody, vm::ptr entitySize, vm::ptr save, vm::ptr userArg); +using SceHttpRedirectCallback = s32(s32 request, s32 statusCode, vm::ptr method, vm::cptr location, vm::ptr userArg); struct SceHttpMemoryPoolStats { @@ -54,8 +54,8 @@ struct SceHttpUriElement u8 reserved[10]; }; -using SceHttpCookieRecvCallback = func_def url, vm::cptr cookieHeader, u32 headerLen, vm::ptr userArg)>; -using SceHttpCookieSendCallback = func_def url, vm::cptr cookieHeader, vm::ptr userArg)>; +using SceHttpCookieRecvCallback = s32(s32 request, vm::cptr url, vm::cptr cookieHeader, u32 headerLen, vm::ptr userArg); +using SceHttpCookieSendCallback = s32(s32 request, vm::cptr url, vm::cptr cookieHeader, vm::ptr userArg); struct SceHttpsData { @@ -69,6 +69,6 @@ struct SceHttpsCaList le_t caNum; }; -using SceHttpsCallback = func_def> sslCert, s32 certNum, vm::ptr userArg)>; +using SceHttpsCallback = s32(u32 verifyEsrr, vm::cptr> sslCert, s32 certNum, vm::ptr userArg); extern psv_log_base sceHttp; diff --git a/rpcs3/Emu/ARMv7/Modules/sceIme.h b/rpcs3/Emu/ARMv7/Modules/sceIme.h index 4e1fda1849..27aaf63987 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceIme.h +++ b/rpcs3/Emu/ARMv7/Modules/sceIme.h @@ -1,6 +1,6 @@ #pragma once -using SceImeCharFilter = func_def; +using SceImeCharFilter = s32(u16 ch); struct SceImeRect { @@ -46,7 +46,7 @@ struct SceImePreeditGeometry le_t height; }; -using SceImeEventHandler = func_def arg, vm::cptr e)>; +using SceImeEventHandler = void(vm::ptr arg, vm::cptr e); struct SceImeParam { diff --git a/rpcs3/Emu/ARMv7/Modules/sceLibKernel.h b/rpcs3/Emu/ARMv7/Modules/sceLibKernel.h index 3fd02fa5e5..5b77b2c239 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceLibKernel.h +++ b/rpcs3/Emu/ARMv7/Modules/sceLibKernel.h @@ -305,7 +305,7 @@ struct SceKernelAllocMemBlockOpt // Thread Manager definitions (threads) -using SceKernelThreadEntry = func_def pArgBlock)>; +using SceKernelThreadEntry = s32(u32 argSize, vm::ptr pArgBlock); struct SceKernelThreadOptParam { @@ -370,7 +370,7 @@ struct SceKernelSystemInfo // Thread Manager definitions (callbacks) -using SceKernelCallbackFunction = func_def pCommon)>; +using SceKernelCallbackFunction = s32(s32 notifyId, s32 notifyCount, s32 notifyArg, vm::ptr pCommon); struct SceKernelCallbackInfo { @@ -388,7 +388,7 @@ struct SceKernelCallbackInfo // Thread Manager definitions (events) -using SceKernelThreadEventHandler = func_def pCommon)>; +using SceKernelThreadEventHandler = s32(s32 type, s32 threadId, s32 arg, vm::ptr pCommon); struct SceKernelEventInfo { diff --git a/rpcs3/Emu/ARMv7/Modules/sceLibc.h b/rpcs3/Emu/ARMv7/Modules/sceLibc.h index b09d575cf7..2766711aea 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceLibc.h +++ b/rpcs3/Emu/ARMv7/Modules/sceLibc.h @@ -1,5 +1,5 @@ #pragma once -using atexit_func_t = func_def)>; +using atexit_func_t = void(vm::ptr); extern psv_log_base sceLibc; diff --git a/rpcs3/Emu/ARMv7/Modules/sceLocation.h b/rpcs3/Emu/ARMv7/Modules/sceLocation.h index 08253563bd..95d809797c 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceLocation.h +++ b/rpcs3/Emu/ARMv7/Modules/sceLocation.h @@ -70,8 +70,8 @@ struct SceLocationHeadingInfo le_t timestamp; }; -using SceLocationLocationInfoCallback = func_def location, vm::ptr userdata)>; -using SceLocationHeadingInfoCallback = func_def heading, vm::ptr userdata)>; +using SceLocationLocationInfoCallback = void(s32 result, u8 handle, vm::cptr location, vm::ptr userdata); +using SceLocationHeadingInfoCallback = void(s32 result, u8 handle, vm::cptr heading, vm::ptr userdata); struct SceLocationPermissionInfo { diff --git a/rpcs3/Emu/ARMv7/Modules/sceNet.h b/rpcs3/Emu/ARMv7/Modules/sceNet.h index 37548dc287..816f31541a 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceNet.h +++ b/rpcs3/Emu/ARMv7/Modules/sceNet.h @@ -115,8 +115,8 @@ struct SceNetEmulationParam u8 reserved[44]; }; -using SceNetResolverFunctionAllocate = func_def(u32 size, s32 rid, vm::cptr name, vm::ptr user)>; -using SceNetResolverFunctionFree = func_def ptr, s32 rid, vm::cptr name, vm::ptr user)>; +using SceNetResolverFunctionAllocate = vm::ptr(u32 size, s32 rid, vm::cptr name, vm::ptr user); +using SceNetResolverFunctionFree = void(vm::ptr ptr, s32 rid, vm::cptr name, vm::ptr user); struct SceNetResolverParam { diff --git a/rpcs3/Emu/ARMv7/Modules/sceNetCtl.h b/rpcs3/Emu/ARMv7/Modules/sceNetCtl.h index 864194c30b..212ed9bd4b 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceNetCtl.h +++ b/rpcs3/Emu/ARMv7/Modules/sceNetCtl.h @@ -42,6 +42,6 @@ struct SceNetCtlAdhocPeerInfo SceNetInAddr inet_addr; }; -using SceNetCtlCallback = func_def arg)>; +using SceNetCtlCallback = void(s32 event_type, vm::ptr arg); extern psv_log_base sceNetCtl; diff --git a/rpcs3/Emu/ARMv7/Modules/sceNgs.h b/rpcs3/Emu/ARMv7/Modules/sceNgs.h index c9955aa814..ce2d70751a 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceNgs.h +++ b/rpcs3/Emu/ARMv7/Modules/sceNgs.h @@ -95,7 +95,7 @@ struct SceNgsCallbackInfo vm::lptr pUserData; }; -using SceNgsCallbackFunc = func_def pCallbackInfo)>; +using SceNgsCallbackFunc = void(vm::cptr pCallbackInfo); struct SceSulphaNgsConfig { diff --git a/rpcs3/Emu/ARMv7/Modules/sceNpBasic.h b/rpcs3/Emu/ARMv7/Modules/sceNpBasic.h index acf4b67438..02c6f4b19e 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceNpBasic.h +++ b/rpcs3/Emu/ARMv7/Modules/sceNpBasic.h @@ -10,7 +10,7 @@ enum SceNpBasicFriendListEventType : s32 SCE_NP_BASIC_FRIEND_LIST_EVENT_TYPE_DELETED = 4 }; -using SceNpBasicFriendListEventHandler = func_def friendId, vm::ptr userdata)>; +using SceNpBasicFriendListEventHandler = void(SceNpBasicFriendListEventType eventType, vm::cptr friendId, vm::ptr userdata); enum SceNpBasicFriendOnlineStatusEventType : s32 { @@ -28,7 +28,7 @@ enum SceNpBasicFriendOnlineStatus : s32 SCE_NP_BASIC_FRIEND_ONLINE_STATUS_ONLINE_IN_CONTEXT = 4 }; -using SceNpBasicFriendOnlineStatusEventHandler = func_def friendId, SceNpBasicFriendOnlineStatus status, vm::ptr userdata)>; +using SceNpBasicFriendOnlineStatusEventHandler = void(SceNpBasicFriendOnlineStatusEventType eventType, vm::cptr friendId, SceNpBasicFriendOnlineStatus status, vm::ptr userdata); enum SceNpBasicBlockListEventType : s32 { @@ -38,7 +38,7 @@ enum SceNpBasicBlockListEventType : s32 SCE_NP_BASIC_BLOCK_LIST_EVENT_TYPE_DELETED = 4 }; -using SceNpBasicBlockListEventHandler = func_def playerId, vm::ptr userdata)>; +using SceNpBasicBlockListEventHandler = void(SceNpBasicBlockListEventType eventType, vm::cptr playerId, vm::ptr userdata); enum SceNpBasicFriendGamePresenceEventType : s32 { @@ -72,7 +72,7 @@ struct SceNpBasicGamePresence SceNpBasicInGamePresence inGamePresence; }; -using SceNpBasicFriendGamePresenceEventHandler = func_def friendId, vm::cptr presence, vm::ptr userdata)>; +using SceNpBasicFriendGamePresenceEventHandler = void(SceNpBasicFriendGamePresenceEventType eventtype, vm::cptr friendId, vm::cptr presence, vm::ptr userdata); struct SceNpBasicInGameDataMessage { @@ -80,7 +80,7 @@ struct SceNpBasicInGameDataMessage le_t dataSize; }; -using SceNpBasicInGameDataMessageEventHandler = func_def from, vm::cptr message, vm::ptr userdata)>; +using SceNpBasicInGameDataMessageEventHandler = void(vm::cptr from, vm::cptr message, vm::ptr userdata); struct SceNpBasicEventHandlers { diff --git a/rpcs3/Emu/ARMv7/Modules/sceNpCommon.h b/rpcs3/Emu/ARMv7/Modules/sceNpCommon.h index 56e2a65252..31c2ff9937 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceNpCommon.h +++ b/rpcs3/Emu/ARMv7/Modules/sceNpCommon.h @@ -117,7 +117,7 @@ struct SceNpTicketVersion le_t minor; }; -using SceNpAuthCallback = func_def arg)>; +using SceNpAuthCallback = s32(s32 id, s32 result, vm::ptr arg); struct SceNpAuthRequestParameter { diff --git a/rpcs3/Emu/ARMv7/Modules/sceNpManager.h b/rpcs3/Emu/ARMv7/Modules/sceNpManager.h index 3b07700d44..5753bf421d 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceNpManager.h +++ b/rpcs3/Emu/ARMv7/Modules/sceNpManager.h @@ -7,6 +7,6 @@ struct SceNpOptParam le_t optParamSize; }; -using SceNpServiceStateCallback = func_def userdata)>; +using SceNpServiceStateCallback = void(SceNpServiceState state, vm::ptr userdata); extern psv_log_base sceNpManager; diff --git a/rpcs3/Emu/ARMv7/Modules/sceNpMatching.h b/rpcs3/Emu/ARMv7/Modules/sceNpMatching.h index 75b2053649..e438c38655 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceNpMatching.h +++ b/rpcs3/Emu/ARMv7/Modules/sceNpMatching.h @@ -109,7 +109,7 @@ struct SceNpMatching2World le_t curNumOfTotalLobbyMember; le_t curNumOfRoom; le_t curNumOfTotalRoomMember; - bool withEntitlementId; + b8 withEntitlementId; SceNpEntitlementId entitlementId; u8 padding[3]; }; @@ -214,9 +214,9 @@ struct SceNpMatching2GroupLabel struct SceNpMatching2RoomGroupConfig { le_t slotNum; - bool withLabel; + b8 withLabel; SceNpMatching2GroupLabel label; - bool withPassword; + b8 withPassword; u8 padding[2]; }; @@ -224,7 +224,7 @@ struct SceNpMatching2RoomGroupConfig struct SceNpMatching2RoomGroupPasswordConfig { u8 groupId; - bool withPassword; + b8 withPassword; u8 padding[1]; }; @@ -240,8 +240,8 @@ struct SceNpMatching2RoomMemberBinAttrInternal struct SceNpMatching2RoomGroup { u8 groupId; - bool withPassword; - bool withLabel; + b8 withPassword; + b8 withLabel; u8 padding[1]; SceNpMatching2GroupLabel label; le_t slotNum; @@ -382,13 +382,13 @@ struct SceNpMatching2InvitationData le_t optDataLen; }; -using SceNpMatching2RequestCallback = func_def data, vm::ptr arg)>; -using SceNpMatching2LobbyEventCallback = func_def data, vm::ptr arg)>; -using SceNpMatching2RoomEventCallback = func_def data, vm::ptr arg)>; -using SceNpMatching2LobbyMessageCallback = func_def data, vm::ptr arg)>; -using SceNpMatching2RoomMessageCallback = func_def data, vm::ptr arg)>; -using SceNpMatching2SignalingCallback = func_def arg)>; -using SceNpMatching2ContextCallback = func_def arg)>; +using SceNpMatching2RequestCallback = void(u16 ctxId, u32 reqId, u16 event, s32 errorCode, vm::cptr data, vm::ptr arg); +using SceNpMatching2LobbyEventCallback = void(u16 ctxId, u64 lobbyId, u16 event, s32 errorCode, vm::cptr data, vm::ptr arg); +using SceNpMatching2RoomEventCallback = void(u16 ctxId, u64 roomId, u16 event, s32 errorCode, vm::cptr data, vm::ptr arg); +using SceNpMatching2LobbyMessageCallback = void(u16 ctxId, u64 lobbyId, u16 srcMemberId, u16 event, s32 errorCode, vm::cptr data, vm::ptr arg); +using SceNpMatching2RoomMessageCallback = void(u16 ctxId, u64 roomId, u16 srcMemberId, u16 event, s32 errorCode, vm::cptr data, vm::ptr arg); +using SceNpMatching2SignalingCallback = void(u16 ctxId, u64 roomId, u16 peerMemberId, u16 event, s32 errorCode, vm::ptr arg); +using SceNpMatching2ContextCallback = void(u16 ctxId, u16 event, u8 eventCause, s32 errorCode, vm::ptr arg); struct SceNpMatching2RequestOptParam { @@ -638,7 +638,7 @@ struct SceNpMatching2SendRoomChatMessageRequest struct SceNpMatching2SendRoomChatMessageResponse { - bool filtered; + b8 filtered; }; @@ -794,7 +794,7 @@ struct SceNpMatching2GetLobbyMemberDataInternalListRequest le_t memberIdNum; vm::lcptr attrId; le_t attrIdNum; - bool extendedData; + b8 extendedData; u8 padding[7]; }; @@ -822,7 +822,7 @@ struct SceNpMatching2SendLobbyChatMessageRequest struct SceNpMatching2SendLobbyChatMessageResponse { - bool filtered; + b8 filtered; }; @@ -899,7 +899,7 @@ struct SceNpMatching2SignalingOptParamUpdateInfo struct SceNpMatching2RoomMessageInfo { - bool filtered; + b8 filtered; u8 castType; u8 padding[2]; vm::lptr dst; @@ -942,7 +942,7 @@ struct SceNpMatching2LobbyMemberDataInternalUpdateInfo struct SceNpMatching2LobbyMessageInfo { - bool filtered; + b8 filtered; u8 castType; u8 padding[2]; vm::lptr dst; diff --git a/rpcs3/Emu/ARMv7/Modules/scePhotoExport.h b/rpcs3/Emu/ARMv7/Modules/scePhotoExport.h index ca7bb6931b..23b25755b8 100644 --- a/rpcs3/Emu/ARMv7/Modules/scePhotoExport.h +++ b/rpcs3/Emu/ARMv7/Modules/scePhotoExport.h @@ -9,6 +9,6 @@ struct ScePhotoExportParam char reserved[32]; }; -using ScePhotoExportCancelFunc = func_def)>; +using ScePhotoExportCancelFunc = s32(vm::ptr); extern psv_log_base scePhotoExport; diff --git a/rpcs3/Emu/ARMv7/Modules/sceRazorCapture.cpp b/rpcs3/Emu/ARMv7/Modules/sceRazorCapture.cpp index 0bd13559a0..9107db2660 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceRazorCapture.cpp +++ b/rpcs3/Emu/ARMv7/Modules/sceRazorCapture.cpp @@ -14,7 +14,7 @@ void sceRazorCaptureSetTriggerNextFrame(vm::cptr captureFilename) throw EXCEPTION(""); } -bool sceRazorCaptureIsInProgress() +b8 sceRazorCaptureIsInProgress() { throw EXCEPTION(""); } diff --git a/rpcs3/Emu/ARMv7/Modules/sceSulpha.h b/rpcs3/Emu/ARMv7/Modules/sceSulpha.h index 646d73e2f1..e373c37e8e 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceSulpha.h +++ b/rpcs3/Emu/ARMv7/Modules/sceSulpha.h @@ -1,6 +1,6 @@ #pragma once -using SceSulphaCallback = func_def arg)>; +using SceSulphaCallback = void(vm::ptr arg); struct SceSulphaConfig { diff --git a/rpcs3/Emu/ARMv7/Modules/sceUlt.h b/rpcs3/Emu/ARMv7/Modules/sceUlt.h index f26f4d303f..42e741f2a7 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceUlt.h +++ b/rpcs3/Emu/ARMv7/Modules/sceUlt.h @@ -153,6 +153,6 @@ struct SceUltUlthread CHECK_SIZE(SceUltUlthread, 256); -using SceUltUlthreadEntry = func_def; +using SceUltUlthreadEntry = s32(u32 arg); extern psv_log_base sceUlt; diff --git a/rpcs3/Emu/ARMv7/Modules/sceVoice.h b/rpcs3/Emu/ARMv7/Modules/sceVoice.h index 267ca6e335..a7986df9a6 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceVoice.h +++ b/rpcs3/Emu/ARMv7/Modules/sceVoice.h @@ -114,7 +114,7 @@ struct SceVoicePortParam }; }; -using SceVoiceEventCallback = func_def event)>; +using SceVoiceEventCallback = void(vm::ptr event); struct SceVoiceInitParam { diff --git a/rpcs3/Emu/ARMv7/PSVFuncList.h b/rpcs3/Emu/ARMv7/PSVFuncList.h index c104585ebe..13bf6af807 100644 --- a/rpcs3/Emu/ARMv7/PSVFuncList.h +++ b/rpcs3/Emu/ARMv7/PSVFuncList.h @@ -25,6 +25,11 @@ public: void Init() { + on_load = nullptr; + on_unload = nullptr; + on_stop = nullptr; + on_error = nullptr; + m_init(); } diff --git a/rpcs3/Emu/CPU/CPUThread.h b/rpcs3/Emu/CPU/CPUThread.h index dac76e1b3c..b43f9ad805 100644 --- a/rpcs3/Emu/CPU/CPUThread.h +++ b/rpcs3/Emu/CPU/CPUThread.h @@ -2,6 +2,11 @@ #include "Utilities/Thread.h" +namespace vm +{ + class waiter_lock_t; +} + enum CPUThreadType { CPU_THREAD_PPU, @@ -53,6 +58,8 @@ public: using thread_t::is_current; using thread_t::get_thread_ctrl; + friend vm::waiter_lock_t; + protected: CPUThread(CPUThreadType type, const std::string& name, std::function thread_name); diff --git a/rpcs3/Emu/Cell/PPUInterpreter.cpp b/rpcs3/Emu/Cell/PPUInterpreter.cpp index ce2c2330c2..21b45365b5 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.cpp +++ b/rpcs3/Emu/Cell/PPUInterpreter.cpp @@ -2488,7 +2488,7 @@ void ppu_interpreter::LVLX(PPUThread& CPU, ppu_opcode_t op) void ppu_interpreter::LDBRX(PPUThread& CPU, ppu_opcode_t op) { const u64 addr = op.ra ? CPU.GPR[op.ra] + CPU.GPR[op.rb] : CPU.GPR[op.rb]; - CPU.GPR[op.rd] = vm::get_ref(VM_CAST(addr)); + CPU.GPR[op.rd] = vm::get_ref>(VM_CAST(addr)); } void ppu_interpreter::LSWX(PPUThread& CPU, ppu_opcode_t op) @@ -2514,7 +2514,7 @@ void ppu_interpreter::LSWX(PPUThread& CPU, ppu_opcode_t op) void ppu_interpreter::LWBRX(PPUThread& CPU, ppu_opcode_t op) { const u64 addr = op.ra ? CPU.GPR[op.ra] + CPU.GPR[op.rb] : CPU.GPR[op.rb]; - CPU.GPR[op.rd] = vm::get_ref(VM_CAST(addr)); + CPU.GPR[op.rd] = vm::get_ref>(VM_CAST(addr)); } void ppu_interpreter::LFSX(PPUThread& CPU, ppu_opcode_t op) @@ -2619,7 +2619,7 @@ void ppu_interpreter::STVLX(PPUThread& CPU, ppu_opcode_t op) void ppu_interpreter::STDBRX(PPUThread& CPU, ppu_opcode_t op) { const u64 addr = op.ra ? CPU.GPR[op.ra] + CPU.GPR[op.rb] : CPU.GPR[op.rb]; - vm::get_ref(VM_CAST(addr)) = CPU.GPR[op.rs]; + vm::get_ref>(VM_CAST(addr)) = CPU.GPR[op.rs]; } void ppu_interpreter::STSWX(PPUThread& CPU, ppu_opcode_t op) @@ -2644,7 +2644,7 @@ void ppu_interpreter::STSWX(PPUThread& CPU, ppu_opcode_t op) void ppu_interpreter::STWBRX(PPUThread& CPU, ppu_opcode_t op) { const u64 addr = op.ra ? CPU.GPR[op.ra] + CPU.GPR[op.rb] : CPU.GPR[op.rb]; - vm::get_ref(VM_CAST(addr)) = (u32)CPU.GPR[op.rs]; + vm::get_ref>(VM_CAST(addr)) = (u32)CPU.GPR[op.rs]; } void ppu_interpreter::STFSX(PPUThread& CPU, ppu_opcode_t op) @@ -2722,7 +2722,7 @@ void ppu_interpreter::LVLXL(PPUThread& CPU, ppu_opcode_t op) void ppu_interpreter::LHBRX(PPUThread& CPU, ppu_opcode_t op) { const u64 addr = op.ra ? CPU.GPR[op.ra] + CPU.GPR[op.rb] : CPU.GPR[op.rb]; - CPU.GPR[op.rd] = vm::get_ref(VM_CAST(addr)); + CPU.GPR[op.rd] = vm::get_ref>(VM_CAST(addr)); } void ppu_interpreter::SRAW(PPUThread& CPU, ppu_opcode_t op) @@ -2809,7 +2809,7 @@ void ppu_interpreter::STVLXL(PPUThread& CPU, ppu_opcode_t op) void ppu_interpreter::STHBRX(PPUThread& CPU, ppu_opcode_t op) { const u64 addr = op.ra ? CPU.GPR[op.ra] + CPU.GPR[op.rb] : CPU.GPR[op.rb]; - vm::get_ref(VM_CAST(addr)) = (u16)CPU.GPR[op.rs]; + vm::get_ref>(VM_CAST(addr)) = (u16)CPU.GPR[op.rs]; } void ppu_interpreter::EXTSH(PPUThread& CPU, ppu_opcode_t op) diff --git a/rpcs3/Emu/Cell/PPUInterpreter.h b/rpcs3/Emu/Cell/PPUInterpreter.h index 94948cc7bd..c9c4ea7482 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.h +++ b/rpcs3/Emu/Cell/PPUInterpreter.h @@ -3072,7 +3072,7 @@ private: void LDBRX(u32 rd, u32 ra, u32 rb) { const u64 addr = ra ? CPU.GPR[ra] + CPU.GPR[rb] : CPU.GPR[rb]; - CPU.GPR[rd] = vm::get_ref(VM_CAST(addr)); + CPU.GPR[rd] = vm::get_ref>(VM_CAST(addr)); } void LSWX(u32 rd, u32 ra, u32 rb) { @@ -3096,7 +3096,7 @@ private: void LWBRX(u32 rd, u32 ra, u32 rb) { const u64 addr = ra ? CPU.GPR[ra] + CPU.GPR[rb] : CPU.GPR[rb]; - CPU.GPR[rd] = vm::get_ref(VM_CAST(addr)); + CPU.GPR[rd] = vm::get_ref>(VM_CAST(addr)); } void LFSX(u32 frd, u32 ra, u32 rb) { @@ -3208,7 +3208,7 @@ private: void STDBRX(u32 rs, u32 ra, u32 rb) { const u64 addr = ra ? CPU.GPR[ra] + CPU.GPR[rb] : CPU.GPR[rb]; - vm::get_ref(VM_CAST(addr)) = CPU.GPR[rs]; + vm::get_ref>(VM_CAST(addr)) = CPU.GPR[rs]; } void STSWX(u32 rs, u32 ra, u32 rb) { @@ -3231,7 +3231,7 @@ private: void STWBRX(u32 rs, u32 ra, u32 rb) { const u64 addr = ra ? CPU.GPR[ra] + CPU.GPR[rb] : CPU.GPR[rb]; - vm::get_ref(VM_CAST(addr)) = (u32)CPU.GPR[rs]; + vm::get_ref>(VM_CAST(addr)) = (u32)CPU.GPR[rs]; } void STFSX(u32 frs, u32 ra, u32 rb) { @@ -3321,7 +3321,7 @@ private: void LHBRX(u32 rd, u32 ra, u32 rb) { const u64 addr = ra ? CPU.GPR[ra] + CPU.GPR[rb] : CPU.GPR[rb]; - CPU.GPR[rd] = vm::get_ref(VM_CAST(addr)); + CPU.GPR[rd] = vm::get_ref>(VM_CAST(addr)); } void SRAW(u32 ra, u32 rs, u32 rb, u32 rc) { @@ -3402,7 +3402,7 @@ private: void STHBRX(u32 rs, u32 ra, u32 rb) { const u64 addr = ra ? CPU.GPR[ra] + CPU.GPR[rb] : CPU.GPR[rb]; - vm::get_ref(VM_CAST(addr)) = (u16)CPU.GPR[rs]; + vm::get_ref>(VM_CAST(addr)) = (u16)CPU.GPR[rs]; } void EXTSH(u32 ra, u32 rs, u32 rc) { diff --git a/rpcs3/Emu/Cell/PPUThread.h b/rpcs3/Emu/Cell/PPUThread.h index 5dbd52bf68..bd0a98160d 100644 --- a/rpcs3/Emu/Cell/PPUThread.h +++ b/rpcs3/Emu/Cell/PPUThread.h @@ -981,16 +981,16 @@ struct cast_ppu_gpr }; template<> -struct cast_ppu_gpr +struct cast_ppu_gpr { - force_inline static u64 to_gpr(const bool& value) + force_inline static u64 to_gpr(const b8& value) { return value; } - force_inline static bool from_gpr(const u64& reg) + force_inline static b8 from_gpr(const u64& reg) { - return reinterpret_cast(reg); + return static_cast(reg) != 0; } }; diff --git a/rpcs3/Emu/Cell/RawSPUThread.h b/rpcs3/Emu/Cell/RawSPUThread.h index 32a14277df..fbd011aa41 100644 --- a/rpcs3/Emu/Cell/RawSPUThread.h +++ b/rpcs3/Emu/Cell/RawSPUThread.h @@ -1,11 +1,12 @@ #pragma once + #include "SPUThread.h" enum : u32 { - RAW_SPU_OFFSET = 0x00100000, - RAW_SPU_BASE_ADDR = 0xE0000000, - RAW_SPU_LS_OFFSET = 0x00000000, + RAW_SPU_OFFSET = 0x00100000, + RAW_SPU_BASE_ADDR = 0xE0000000, + RAW_SPU_LS_OFFSET = 0x00000000, RAW_SPU_PROB_OFFSET = 0x00040000, }; diff --git a/rpcs3/Emu/Memory/atomic.h b/rpcs3/Emu/Memory/atomic.h index 385a3477db..48fd65d3d7 100644 --- a/rpcs3/Emu/Memory/atomic.h +++ b/rpcs3/Emu/Memory/atomic.h @@ -33,12 +33,12 @@ template struct _to_atomic_subtype template using atomic_subtype_t = typename _to_atomic_subtype::type; // result wrapper to deal with void result type -template struct atomic_op_result_t +template struct atomic_op_result_t { RT result; - template inline atomic_op_result_t(T func, Args&&... args) - : result(std::move(func(std::forward(args)...))) + template inline atomic_op_result_t(T func, VT& var, Args&&... args) + : result(std::move(func(var, std::forward(args)...))) { } @@ -48,16 +48,53 @@ template struct atomic_op_result_t } }; -// void specialization -template<> struct atomic_op_result_t +// void specialization: result is the initial value of the first arg +template struct atomic_op_result_t { - template inline atomic_op_result_t(T func, Args&&... args) + VT result; + + template inline atomic_op_result_t(T func, VT& var, Args&&... args) + : result(var) { - func(std::forward(args)...); + func(var, std::forward(args)...); } - inline void move() + inline VT move() { + return std::move(result); + } +}; + +// member function specialization +template struct atomic_op_result_t +{ + RT result; + + template inline atomic_op_result_t(RT(CT::*func)(FArgs...), VT& var, Args&&... args) + : result(std::move((var.*func)(std::forward(args)...))) + { + } + + inline RT move() + { + return std::move(result); + } +}; + +// member function void specialization +template struct atomic_op_result_t +{ + VT result; + + template inline atomic_op_result_t(void(CT::*func)(FArgs...), VT& var, Args&&... args) + : result(var) + { + (var.*func)(std::forward(args)...); + } + + inline VT move() + { + return std::move(result); } }; @@ -144,7 +181,7 @@ public: } // perform an atomic operation on data (callable object version, first arg is a reference to atomic type) - template auto atomic_op(F func, Args&&... args) volatile -> decltype(func(std::declval(), args...)) + template> auto atomic_op(F func, Args&&... args) volatile -> decltype(atomic_op_result_t::result) { while (true) { @@ -155,19 +192,13 @@ public: subtype _new = old; // call atomic op for the local copy of the old value and save the return value of the function - atomic_op_result_t> result(func, to_type(_new), args...); + atomic_op_result_t result(func, to_type(_new), args...); // atomically compare value with `old`, replace with `_new` and return on success if (sync_bool_compare_and_swap(&sub_data, old, _new)) return result.move(); } } - // perform an atomic operation on data (member function version) - template::value>> auto atomic_op(RT(CT::* func)(FArgs...), Args&&... args) volatile -> decltype((std::declval().*func)(args...)) - { - return atomic_op(std::mem_fn(func), std::forward(args)...); - } - // atomic bitwise OR, returns previous data force_inline const type _or(const type& right) volatile { diff --git a/rpcs3/Emu/Memory/vm.cpp b/rpcs3/Emu/Memory/vm.cpp index 14f891a683..88938355f5 100644 --- a/rpcs3/Emu/Memory/vm.cpp +++ b/rpcs3/Emu/Memory/vm.cpp @@ -80,6 +80,8 @@ namespace vm std::array, 0x100000000ull / 4096> g_pages = {}; // information about every page const thread_ctrl_t* const INVALID_THREAD = reinterpret_cast(~0ull); + + //using reservation_mutex_t = std::mutex; class reservation_mutex_t { @@ -152,7 +154,7 @@ namespace vm std::mutex g_waiter_list_mutex; - waiter_t* _add_waiter(CPUThread& thread, u32 addr, u32 size) + waiter_t* _add_waiter(thread_t& thread, u32 addr, u32 size) { std::lock_guard lock(g_waiter_list_mutex); @@ -242,25 +244,18 @@ namespace vm addr = 0; mask = ~0; - // signal thread (must not be signaled yet) - if (!thread->signal()) - { - throw EXCEPTION("Thread already signaled"); - } + // signal thread + thread->cv.notify_one(); return true; } - waiter_lock_t::waiter_lock_t(CPUThread& thread, u32 addr, u32 size) - : m_waiter(_add_waiter(thread, addr, size)) - , m_lock(thread.mutex, std::adopt_lock) // must be locked in _add_waiter - { - } - void waiter_lock_t::wait() { - while (!m_waiter->thread->unsignal()) + // if another thread successfully called pred(), it must be set to null + while (m_waiter->pred) { + // if pred() called by another thread threw an exception, it'll be rethrown if (m_waiter->pred()) { return; @@ -270,15 +265,6 @@ namespace vm m_waiter->thread->cv.wait(m_lock); } - - // if another thread successfully called pred(), it must be set to null - if (m_waiter->pred) - { - // if pred() called by another thread threw an exception, rethrow it - m_waiter->pred(); - - throw EXCEPTION("Unexpected"); - } } waiter_lock_t::~waiter_lock_t() diff --git a/rpcs3/Emu/Memory/vm.h b/rpcs3/Emu/Memory/vm.h index a39e76b00f..7b4fd197ed 100644 --- a/rpcs3/Emu/Memory/vm.h +++ b/rpcs3/Emu/Memory/vm.h @@ -4,7 +4,7 @@ const class thread_ctrl_t* get_current_thread_ctrl(); -class CPUThread; +class thread_t; namespace vm { @@ -38,13 +38,13 @@ namespace vm { u32 addr = 0; u32 mask = ~0; - CPUThread* thread = nullptr; + thread_t* thread = nullptr; std::function pred; waiter_t() = default; - waiter_t* reset(u32 addr, u32 size, CPUThread& thread) + waiter_t* reset(u32 addr, u32 size, thread_t& thread) { this->addr = addr; this->mask = ~(size - 1); @@ -62,6 +62,9 @@ namespace vm bool try_notify(); }; + // for internal use + waiter_t* _add_waiter(thread_t& thread, u32 addr, u32 size); + class waiter_lock_t { waiter_t* m_waiter; @@ -70,7 +73,11 @@ namespace vm public: waiter_lock_t() = delete; - waiter_lock_t(CPUThread& thread, u32 addr, u32 size); + template inline waiter_lock_t(T& thread, u32 addr, u32 size) + : m_waiter(_add_waiter(static_cast(thread), addr, size)) + , m_lock(thread.mutex, std::adopt_lock) // must be locked in _add_waiter + { + } waiter_t* operator ->() const { @@ -83,7 +90,7 @@ namespace vm }; // wait until pred() returns true, addr must be aligned to size which must be a power of 2, pred() may be called by any thread - template auto wait_op(CPUThread& thread, u32 addr, u32 size, F pred, Args&&... args) -> decltype(static_cast(pred(args...))) + template auto wait_op(T& thread, u32 addr, u32 size, F pred, Args&&... args) -> decltype(static_cast(pred(args...))) { // return immediately if condition passed (optimistic case) if (pred(args...)) return; @@ -174,7 +181,7 @@ namespace vm const u32 size; // total size const u64 flags; // currently unused - atomic_t used{}; // amount of memory used, may be increased manually prevent some memory from allocating + atomic_t used{}; // amount of memory used, may be increased manually to prevent some memory from allocating // Search and map memory (don't pass alignment smaller than 4096) u32 alloc(u32 size, u32 align = 4096); @@ -396,14 +403,12 @@ namespace vm } void close(); - - u32 stack_push(CPUThread& CPU, u32 size, u32 align, u32& old_pos); - void stack_pop(CPUThread& CPU, u32 addr, u32 old_pos); } #include "vm_ref.h" #include "vm_ptr.h" -#include "vm_var.h" + +class CPUThread; namespace vm { @@ -439,4 +444,9 @@ namespace vm return m_begin + m_position; } }; + + u32 stack_push(CPUThread& cpu, u32 size, u32 align, u32& old_pos); + void stack_pop(CPUThread& cpu, u32 addr, u32 old_pos); } + +#include "vm_var.h" diff --git a/rpcs3/Emu/Memory/vm_ptr.h b/rpcs3/Emu/Memory/vm_ptr.h index 66a68f9976..bd8201521e 100644 --- a/rpcs3/Emu/Memory/vm_ptr.h +++ b/rpcs3/Emu/Memory/vm_ptr.h @@ -116,8 +116,6 @@ namespace vm { AT m_addr; - using type = func_def; - AT addr() const { return m_addr; @@ -141,7 +139,7 @@ namespace vm RT operator()(ARMv7Context& context, T... args) const; // conversion to another function pointer - template operator _ptr_base() const + template operator _ptr_base() const { return{ VM_CAST(m_addr) }; } diff --git a/rpcs3/Emu/RSX/GCM.h b/rpcs3/Emu/RSX/GCM.h index 375788fdb7..71aa10ee82 100644 --- a/rpcs3/Emu/RSX/GCM.h +++ b/rpcs3/Emu/RSX/GCM.h @@ -224,9 +224,9 @@ typedef s32(CellGcmContextCallback)(vm::ptr, u32); struct CellGcmContextData { - be_t begin; - be_t end; - be_t current; + vm::bptr begin; + vm::bptr end; + vm::bptr current; vm::bptr callback; }; diff --git a/rpcs3/Emu/RSX/GSManager.cpp b/rpcs3/Emu/RSX/GSManager.cpp index ed26fc0790..1c3d02d2f7 100644 --- a/rpcs3/Emu/RSX/GSManager.cpp +++ b/rpcs3/Emu/RSX/GSManager.cpp @@ -2,7 +2,7 @@ #include "rpcs3/Ini.h" #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" -#include "sysutil_video.h" +#include "Emu/SysCalls/Modules/cellVideoOut.h" #include "GSManager.h" #include "Null/NullGSRender.h" diff --git a/rpcs3/Emu/RSX/GSRender.cpp b/rpcs3/Emu/RSX/GSRender.cpp index 371db32257..cebc2d08a8 100644 --- a/rpcs3/Emu/RSX/GSRender.cpp +++ b/rpcs3/Emu/RSX/GSRender.cpp @@ -12,7 +12,6 @@ GSLock::GSLock(GSRender& renderer, GSLockType type) switch (m_type) { case GS_LOCK_NOT_WAIT: m_renderer.m_cs_main.lock(); break; - case GS_LOCK_WAIT_FLUSH: m_renderer.m_sem_flush.wait(); break; case GS_LOCK_WAIT_FLIP: m_renderer.m_sem_flip.wait(); break; } } @@ -22,8 +21,7 @@ GSLock::~GSLock() switch (m_type) { case GS_LOCK_NOT_WAIT: m_renderer.m_cs_main.unlock(); break; - case GS_LOCK_WAIT_FLUSH: m_renderer.m_sem_flush.post(); break; - case GS_LOCK_WAIT_FLIP: m_renderer.m_sem_flip.post(); break; + case GS_LOCK_WAIT_FLIP: m_renderer.m_sem_flip.try_post(); break; } } diff --git a/rpcs3/Emu/RSX/GSRender.h b/rpcs3/Emu/RSX/GSRender.h index 4b376e5187..d0755e5659 100644 --- a/rpcs3/Emu/RSX/GSRender.h +++ b/rpcs3/Emu/RSX/GSRender.h @@ -17,7 +17,6 @@ struct GSRender : public RSXThread enum GSLockType { GS_LOCK_NOT_WAIT, - GS_LOCK_WAIT_FLUSH, GS_LOCK_WAIT_FLIP, }; diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 8363adc6a5..9cfbd6f291 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -5,7 +5,7 @@ #include "Emu/System.h" #include "Emu/RSX/GSManager.h" #include "Emu/RSX/GSRender.h" -#include "Emu/RSX/sysutil_video.h" +#include "Emu/SysCalls/Modules/cellVideoOut.h" #include "RSXThread.h" #include "Emu/SysCalls/Callback.h" @@ -258,6 +258,8 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const }); } + m_sem_flip.post_and_wait(); + auto sync = [&]() { double limit; @@ -2499,14 +2501,6 @@ void RSXThread::Task() if (put == get || !Emu.IsRunning()) { - if (put == get) - { - if (m_flip_status == 0) - m_sem_flip.post_and_wait(); - - m_sem_flush.post_and_wait(); - } - std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack continue; } diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index ce0d92c819..6cacabc967 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -5,7 +5,7 @@ #include "RSXFragmentProgram.h" #include -#include "Utilities/SSemaphore.h" +#include "Utilities/Semaphore.h" #include "Utilities/Thread.h" #include "Utilities/Timer.h" @@ -155,8 +155,7 @@ public: public: std::mutex m_cs_main; - SSemaphore m_sem_flush; - SSemaphore m_sem_flip; + semaphore_t m_sem_flip; u64 m_last_flip_time; vm::ptr m_flip_handler; vm::ptr m_user_handler; diff --git a/rpcs3/Emu/SysCalls/ModuleManager.cpp b/rpcs3/Emu/SysCalls/ModuleManager.cpp index ce1a2f5925..1cc7ce90a5 100644 --- a/rpcs3/Emu/SysCalls/ModuleManager.cpp +++ b/rpcs3/Emu/SysCalls/ModuleManager.cpp @@ -4,47 +4,83 @@ extern Module cellAdec; extern Module cellAtrac; +extern Module cellAtracMulti; extern Module cellAudio; extern Module cellAvconfExt; +extern Module cellBGDL; extern Module cellCamera; +extern Module cellCelp8Enc; +extern Module cellCelpEnc; +extern Module cellDaisy; extern Module cellDmux; extern Module cellFiber; extern Module cellFont; extern Module cellFontFT; extern Module cellFs; extern Module cellGame; +extern Module cellGameExec; extern Module cellGcmSys; extern Module cellGem; extern Module cellGifDec; +extern Module cellHttp; +extern Module cellHttps; +extern Module cellHttpUtil; +extern Module cellImeJp; extern Module cellJpgDec; +extern Module cellJpgEnc; +extern Module cellKey2char; extern Module cellL10n; extern Module cellMic; -extern Module cellSysutil; +extern Module cellMusic; +extern Module cellMusicDecode; +extern Module cellMusicExport; extern Module cellNetCtl; +extern Module cellOskDialog; extern Module cellOvis; extern Module cellPamf; +extern Module cellPhotoDecode; +extern Module cellPhotoExport; +extern Module cellPhotoImportUtil; extern Module cellPngDec; +extern Module cellPngEnc; +extern Module cellPrint; +extern Module cellRec; +extern Module cellRemotePlay; extern Module cellResc; extern Module cellRtc; extern Module cellRudp; extern Module cellSail; +extern Module cellSailRec; +extern Module cellSaveData; +extern Module cellMinisSaveData; extern Module cellScreenshot; extern Module cellSearch; -extern Module cellSysutil; +extern Module cellSheap; +extern Module cellSpudll; extern Module cellSpurs; extern Module cellSpursJq; +extern Module cellSsl; extern Module cellSubdisplay; extern Module cellSync; extern Module cellSync2; +extern Module cellSysconf; extern Module cellSysmodule; extern Module cellSysutil; extern Module cellSysutilAp; +extern Module cellSysutilAvc; +extern Module cellSysutilAvc2; +extern Module cellSysutilMisc; extern Module cellUsbd; +extern Module cellUsbPspcm; extern Module cellUserInfo; extern Module cellVdec; +extern Module cellVideoExport; +extern Module cellVideoUpload; extern Module cellVoice; extern Module cellVpost; extern Module libmixer; +extern Module libsnd3; +extern Module libsynth2; extern Module sceNp; extern Module sceNp2; extern Module sceNpClans; @@ -61,17 +97,32 @@ extern Module sys_lv2dbg; struct ModuleInfo { - s32 id; //-1 is used by module with only name - const char* name; - Module* module; + const s32 id; // -1 if the module doesn't have corresponding CELL_SYSMODULE_* id + const char* const name; + Module* const module; + + explicit operator bool() const + { + return module != nullptr; + } + + operator Module*() const + { + return module; + } + + Module* operator ->() const + { + return module; + } } -static const g_module_list[] = +const g_module_list[] = { { 0x0000, "sys_net", &sys_net }, - { 0x0001, "sys_http", nullptr }, - { 0x0002, "cellHttpUtil", nullptr }, - { 0x0003, "cellSsl", nullptr }, - { 0x0004, "cellHttps", nullptr }, + { 0x0001, "cellHttp", &cellHttp }, + { 0x0002, "cellHttpUtil", &cellHttpUtil }, + { 0x0003, "cellSsl", &cellSsl }, + { 0x0004, "cellHttps", &cellHttps }, { 0x0005, "libvdec", &cellVdec }, { 0x0006, "cellAdec", &cellAdec }, { 0x0007, "cellDmux", &cellDmux }, @@ -79,8 +130,8 @@ static const g_module_list[] = { 0x0009, "cellRtc", &cellRtc }, { 0x000a, "cellSpurs", &cellSpurs }, { 0x000b, "cellOvis", &cellOvis }, - { 0x000c, "cellSheap", nullptr }, - { 0x000d, "sys_sync", &cellSync }, + { 0x000c, "cellSheap", &cellSheap }, + { 0x000d, "cellSync", &cellSync }, { 0x000e, "sys_fs", &cellFs }, { 0x000f, "cellJpgDec", &cellJpgDec }, { 0x0010, "cellGcmSys", &cellGcmSys }, @@ -94,13 +145,13 @@ static const g_module_list[] = { 0x0018, "cellPngDec", &cellPngDec }, { 0x0019, "cellFont", &cellFont }, { 0x001a, "cellFontFT", &cellFontFT }, - { 0x001b, "cellFreetype", nullptr }, + { 0x001b, "cell_FreeType2", nullptr }, { 0x001c, "cellUsbd", &cellUsbd }, { 0x001d, "cellSail", &cellSail }, { 0x001e, "cellL10n", &cellL10n }, { 0x001f, "cellResc", &cellResc }, - { 0x0020, "cellDaisy", nullptr }, - { 0x0021, "cellKey2char", nullptr }, + { 0x0020, "cellDaisy", &cellDaisy }, + { 0x0021, "cellKey2char", &cellKey2char }, { 0x0022, "cellMic", &cellMic }, { 0x0023, "cellCamera", &cellCamera }, { 0x0024, "cellVdecMpeg2", nullptr }, @@ -110,119 +161,137 @@ static const g_module_list[] = { 0x0028, "cellAdecAtx", nullptr }, { 0x0029, "cellAdecAt3", nullptr }, { 0x002a, "cellDmuxPamf", nullptr }, + { 0x002b, "?", nullptr }, + { 0x002c, "?", nullptr }, + { 0x002d, "?", nullptr }, { 0x002e, "sys_lv2dbg", &sys_lv2dbg }, - { 0x0030, "cellUsbpspcm", nullptr }, - { 0x0031, "cellAvconfExt", &cellAvconfExt }, + { 0x002f, "cellSysutilAvcExt", &cellSysutilAvc }, + { 0x0030, "cellUsbPspcm", &cellUsbPspcm }, + { 0x0031, "cellSysutilAvconfExt", &cellAvconfExt }, { 0x0032, "cellUserInfo", &cellUserInfo }, - { 0x0033, "cellSysutilSavedata", nullptr }, - { 0x0034, "cellSubdisplay", &cellSubdisplay }, - { 0x0035, "cellSysutilRec", nullptr }, - { 0x0036, "cellVideoExport", nullptr }, - { 0x0037, "cellGameExec", nullptr }, + { 0x0033, "cellSaveData", &cellSaveData }, + { 0x0034, "cellSubDisplay", &cellSubdisplay }, + { 0x0035, "cellRec", &cellRec }, + { 0x0036, "cellVideoExportUtility", &cellVideoExport }, + { 0x0037, "cellGameExec", &cellGameExec }, { 0x0038, "sceNp2", &sceNp2 }, { 0x0039, "cellSysutilAp", &cellSysutilAp }, { 0x003a, "sceNpClans", &sceNpClans }, - { 0x003b, "cellSysutilOskExt", nullptr }, + { 0x003b, "cellOskExtUtility", &cellOskDialog }, { 0x003c, "cellVdecDivx", nullptr }, - { 0x003d, "cellJpgEnc", nullptr }, + { 0x003d, "cellJpgEnc", &cellJpgEnc }, { 0x003e, "cellGame", &cellGame }, - { 0x003f, "cellBgdl", nullptr }, - { 0x0040, "cellFreetypeTT", nullptr }, - { 0x0041, "cellSysutilVideoUpload", nullptr }, - { 0x0042, "cellSysutilSysconfExt", nullptr }, + { 0x003f, "cellBGDLUtility", &cellBGDL }, + { 0x0040, "cell_FreeType2", nullptr }, + { 0x0041, "cellVideoUpload", &cellVideoUpload }, + { 0x0042, "cellSysconfExtUtility", &cellSysconf }, { 0x0043, "cellFiber", &cellFiber }, { 0x0044, "sceNpCommerce2", &sceNpCommerce2 }, { 0x0045, "sceNpTus", &sceNpTus }, { 0x0046, "cellVoice", &cellVoice }, { 0x0047, "cellAdecCelp8", nullptr }, - { 0x0048, "cellCelp8Enc", nullptr }, - { 0x0049, "cellLicenseArea", nullptr }, - { 0x004a, "cellMusic2", nullptr }, + { 0x0048, "cellCelp8Enc", &cellCelp8Enc }, + { 0x0049, "cellSysutilMisc", &cellSysutilMisc }, + { 0x004a, "cellMusicUtility", &cellMusic }, // 2 { 0x004e, "cellScreenShotUtility", &cellScreenshot }, - { 0x004f, "cellMusicDecode", nullptr }, + { 0x004f, "cellMusicDecodeUtility", &cellMusicDecode }, { 0x0050, "cellSpursJq", &cellSpursJq }, - { 0x0052, "cellPngEnc", nullptr }, - { 0x0053, "cellMusicDecode2", nullptr }, + { 0x0052, "cellPngEnc", &cellPngEnc }, + { 0x0053, "cellMusicDecodeUtility", &cellMusicDecode }, // 2 { 0x0055, "cellSync2", &cellSync2 }, { 0x0056, "sceNpUtil", &sceNpUtil }, { 0x0057, "cellRudp", &cellRudp }, { 0x0059, "sceNpSns", &sceNpSns }, - { 0x005a, "cellGem", &cellGem }, - { 0xf00a, "cellCelpEnc", nullptr }, + { 0x005a, "libgem", &cellGem }, + { 0xf00a, "cellCelpEnc", &cellCelpEnc }, { 0xf010, "cellGifDec", &cellGifDec }, { 0xf019, "cellAdecCelp", nullptr }, { 0xf01b, "cellAdecM2bc", nullptr }, { 0xf01d, "cellAdecM4aac", nullptr }, { 0xf01e, "cellAdecMp3", nullptr }, - { 0xf023, "cellImejp", nullptr }, - { 0xf028, "cellMusic", nullptr }, - { 0xf029, "cellPhotoExport", nullptr }, - { 0xf02a, "cellPrint", nullptr }, - { 0xf02b, "cellPhotoImport", nullptr }, - { 0xf02c, "cellMusicExport", nullptr }, - { 0xf02e, "cellPhotoDecode", nullptr }, - { 0xf02f, "cellSearch", &cellSearch }, - { 0xf030, "cellAvchat2", nullptr }, - { 0xf034, "cellSailRec", nullptr }, + { 0xf023, "cellImeJpUtility", &cellImeJp }, + { 0xf028, "cellMusicUtility", &cellMusic }, + { 0xf029, "cellPhotoUtility", &cellPhotoExport }, + { 0xf02a, "cellPrintUtility", &cellPrint }, + { 0xf02b, "cellPhotoImportUtil", &cellPhotoImportUtil }, + { 0xf02c, "cellMusicExportUtility", &cellMusicExport }, + { 0xf02e, "cellPhotoDecodeUtil", &cellPhotoDecode }, + { 0xf02f, "cellSearchUtility", &cellSearch }, + { 0xf030, "cellSysutilAvc2", &cellSysutilAvc2 }, + { 0xf034, "cellSailRec", &cellSailRec }, { 0xf035, "sceNpTrophy", &sceNpTrophy }, { 0xf053, "cellAdecAt3multi", nullptr }, - { 0xf054, "cellLibatrac3multi", nullptr }, + { 0xf054, "cellAtracMulti", &cellAtracMulti }, { -1, "cellSysmodule", &cellSysmodule }, { -1, "libmixer", &libmixer }, { -1, "sysPrxForUser", &sysPrxForUser }, { -1, "sys_libc", &sys_libc }, + { -1, "cellMinisSaveData", &cellMinisSaveData }, + { -1, "cellSpudll", &cellSpudll }, + { -1, "cellRemotePlay", &cellRemotePlay }, + { -1, "libsnd3", &libsnd3 }, + { -1, "libsynth2", &libsynth2 }, }; void ModuleManager::Init() { - if (initialized) + if (m_init) { Close(); } clear_ppu_functions(); - for (auto& m : g_module_list) + std::unordered_set processed; + + for (auto& module : g_module_list) { - if (m.module) + if (module && processed.emplace(module).second) { - m.module->Init(); + module->Init(); } } - initialized = true; + m_init = true; } ModuleManager::ModuleManager() - : initialized(false) { } ModuleManager::~ModuleManager() { + Close(); } void ModuleManager::Close() { - for (auto& m : g_module_list) + if (!m_init) { - if (m.module && m.module->on_stop) + return; + } + + std::unordered_set processed; + + for (auto& module : g_module_list) + { + if (module && module->on_stop && processed.emplace(module).second) { - m.module->on_stop(); + module->on_stop(); } } - initialized = false; + m_init = false; } Module* ModuleManager::GetModuleByName(const char* name) { - for (auto& m : g_module_list) + for (auto& module : g_module_list) { - if (!strcmp(name, m.name)) + if (!strcmp(name, module.name)) { - return m.module; + return module; } } @@ -231,11 +300,11 @@ Module* ModuleManager::GetModuleByName(const char* name) Module* ModuleManager::GetModuleById(u16 id) { - for (auto& m : g_module_list) + for (auto& module : g_module_list) { - if (m.id == id) + if (module.id == id) { - return m.module; + return module; } } @@ -244,9 +313,9 @@ Module* ModuleManager::GetModuleById(u16 id) bool ModuleManager::CheckModuleId(u16 id) { - for (auto& m : g_module_list) + for (auto& module : g_module_list) { - if (m.id == id) + if (module.id == id) { return true; } diff --git a/rpcs3/Emu/SysCalls/ModuleManager.h b/rpcs3/Emu/SysCalls/ModuleManager.h index 68dc46444d..45a4c7d69c 100644 --- a/rpcs3/Emu/SysCalls/ModuleManager.h +++ b/rpcs3/Emu/SysCalls/ModuleManager.h @@ -4,7 +4,7 @@ class Module; class ModuleManager { - bool initialized; + bool m_init = false; public: ModuleManager(); @@ -12,7 +12,8 @@ public: void Init(); void Close(); - Module* GetModuleByName(const char* name); - Module* GetModuleById(u16 id); - bool CheckModuleId(u16 id); + + static Module* GetModuleByName(const char* name); + static Module* GetModuleById(u16 id); + static bool CheckModuleId(u16 id); }; diff --git a/rpcs3/Emu/SysCalls/Modules.cpp b/rpcs3/Emu/SysCalls/Modules.cpp index cde8a38972..51c2959214 100644 --- a/rpcs3/Emu/SysCalls/Modules.cpp +++ b/rpcs3/Emu/SysCalls/Modules.cpp @@ -35,37 +35,19 @@ u32 add_ppu_func(ModuleFunc func) u32 add_ppu_func_sub(StaticFunc func) { - g_ppu_func_subs.push_back(func); + g_ppu_func_subs.emplace_back(func); return func.index; } -u32 add_ppu_func_sub(const char group[8], const SearchPatternEntry ops[], const size_t count, const char* name, Module* module, ppu_func_caller func) +u32 add_ppu_func_sub(const std::initializer_list& ops, const char* name, Module* module, ppu_func_caller func) { - char group_name[9] = {}; - - if (group) - { - strcpy_trunc(group_name, group); - } - StaticFunc sf; sf.index = add_ppu_func(ModuleFunc(get_function_id(name), 0, module, name, func)); sf.name = name; - sf.group = *(u64*)group_name; sf.found = 0; + sf.ops = ops; - for (u32 i = 0; i < count; i++) - { - SearchPatternEntry op; - op.type = ops[i].type; - op.data = _byteswap_ulong(ops[i].data); // TODO: use be_t<> - op.mask = _byteswap_ulong(ops[i].mask); - op.num = ops[i].num; - assert(!op.mask || (op.data & ~op.mask) == 0); - sf.ops.push_back(op); - } - - return add_ppu_func_sub(sf); + return add_ppu_func_sub(std::move(sf)); } ModuleFunc* get_ppu_func_by_nid(u32 nid, u32* out_index) @@ -198,6 +180,12 @@ void execute_ppu_func_by_index(PPUThread& CPU, u32 index) CPU.PC = VM_CAST(CPU.LR & ~3) - 4; } + // execute module-specific error check + if ((s64)CPU.GPR[3] < 0 && func->module && func->module->on_error) + { + func->module->on_error(CPU.GPR[3], func); + } + CPU.hle_code = last_code; } else @@ -234,7 +222,7 @@ void hook_ppu_func(vm::ptr base, u32 pos, u32 size) for (auto& sub : g_ppu_func_subs) { - bool found = true; + bool found = sub.ops.size() != 0; for (u32 k = pos, x = 0; x + 1 <= sub.ops.size(); k++, x++) { @@ -251,8 +239,8 @@ void hook_ppu_func(vm::ptr base, u32 pos, u32 size) continue; } - const u32 data = sub.ops[x].data; - const u32 mask = sub.ops[x].mask; + const u32 data = sub.ops[x].data.data(); + const u32 mask = sub.ops[x].mask.data(); const bool match = (base[k].data() & mask) == data; @@ -344,7 +332,7 @@ void hook_ppu_func(vm::ptr base, u32 pos, u32 size) if (found) { - LOG_SUCCESS(LOADER, "Function '%s' hooked (addr=0x%x)", sub.name, (base + pos).addr()); + LOG_SUCCESS(LOADER, "Function '%s' hooked (addr=*0x%x)", sub.name, base + pos); sub.found++; base[pos] = HACK(sub.index | EIF_PERFORM_BLR); } @@ -360,11 +348,6 @@ void hook_ppu_funcs(vm::ptr base, u32 size) { using namespace PPU_instr; - if (!Ini.HLEHookStFunc.GetValue()) - { - return; - } - // TODO: optimize search for (u32 i = 0; i < size; i++) { @@ -377,95 +360,12 @@ void hook_ppu_funcs(vm::ptr base, u32 size) hook_ppu_func(base, i, size); } - // check function groups + // check functions for (u32 i = 0; i < g_ppu_func_subs.size(); i++) { - if (g_ppu_func_subs[i].found) // start from some group + if (g_ppu_func_subs[i].found > 1) { - const u64 group = g_ppu_func_subs[i].group; - - if (!group) - { - // skip if group not set - continue; - } - - enum : u32 - { - GSR_SUCCESS = 0, // every function from this group has been found once - GSR_MISSING = 1, // (error) some function not found - GSR_EXCESS = 2, // (error) some function found twice or more - }; - - u32 res = GSR_SUCCESS; - - // analyse - for (u32 j = 0; j < g_ppu_func_subs.size(); j++) if (g_ppu_func_subs[j].group == group) - { - u32 count = g_ppu_func_subs[j].found; - - if (count == 0) // not found - { - // check if this function has been found with different pattern - for (u32 k = 0; k < g_ppu_func_subs.size(); k++) if (g_ppu_func_subs[k].group == group) - { - if (k != j && g_ppu_func_subs[k].index == g_ppu_func_subs[j].index) - { - count += g_ppu_func_subs[k].found; - } - } - if (count == 0) - { - res |= GSR_MISSING; - LOG_ERROR(LOADER, "Function '%s' not found", g_ppu_func_subs[j].name); - } - else if (count > 1) - { - res |= GSR_EXCESS; - } - } - else if (count == 1) // found - { - // ensure that this function has NOT been found with different pattern - for (u32 k = 0; k < g_ppu_func_subs.size(); k++) if (g_ppu_func_subs[k].group == group) - { - if (k != j && g_ppu_func_subs[k].index == g_ppu_func_subs[j].index) - { - if (g_ppu_func_subs[k].found) - { - res |= GSR_EXCESS; - LOG_ERROR(LOADER, "Function '%s' hooked twice", g_ppu_func_subs[j].name); - } - } - } - } - else - { - res |= GSR_EXCESS; - LOG_ERROR(LOADER, "Function '%s' hooked twice", g_ppu_func_subs[j].name); - } - } - - // clear data - for (u32 j = 0; j < g_ppu_func_subs.size(); j++) - { - if (g_ppu_func_subs[j].group == group) g_ppu_func_subs[j].found = 0; - } - - char group_name[9] = {}; - - *(u64*)group_name = group; - - if (res == GSR_SUCCESS) - { - LOG_SUCCESS(LOADER, "Function group [%s] successfully hooked", group_name); - } - else - { - LOG_ERROR(LOADER, "Function group [%s] failed:%s%s", group_name, - (res & GSR_MISSING ? " missing;" : ""), - (res & GSR_EXCESS ? " excess;" : "")); - } + LOG_ERROR(LOADER, "Function '%s' hooked %u times", g_ppu_func_subs[i].found); } } } @@ -610,6 +510,11 @@ Module::~Module() void Module::Init() { + on_load = nullptr; + on_unload = nullptr; + on_stop = nullptr; + on_error = nullptr; + m_init(); } diff --git a/rpcs3/Emu/SysCalls/Modules.h b/rpcs3/Emu/SysCalls/Modules.h index 10203a49bc..6855c42c40 100644 --- a/rpcs3/Emu/SysCalls/Modules.h +++ b/rpcs3/Emu/SysCalls/Modules.h @@ -62,8 +62,8 @@ enum : u32 struct SearchPatternEntry { u32 type; - u32 data; - u32 mask; + be_t data; + be_t mask; u32 num; // supplement info }; @@ -72,7 +72,6 @@ struct StaticFunc u32 index; const char* name; std::vector ops; - u64 group; u32 found; std::unordered_map labels; }; @@ -88,17 +87,18 @@ class Module : public LogBase public: Module(const char* name, void(*init)()); - Module(Module &other) = delete; - Module(Module &&other) = delete; + Module(Module& other) = delete; + Module(Module&& other) = delete; - Module &operator =(Module &other) = delete; - Module &operator =(Module &&other) = delete; + Module& operator =(Module& other) = delete; + Module& operator =(Module&& other) = delete; ~Module(); std::function on_load; std::function on_unload; std::function on_stop; + std::function on_error; void Init(); void Load(); @@ -119,7 +119,7 @@ void clear_ppu_functions(); u32 get_function_id(const char* name); u32 add_ppu_func_sub(StaticFunc sf); -u32 add_ppu_func_sub(const char group[8], const SearchPatternEntry ops[], size_t count, const char* name, Module* module, ppu_func_caller func); +u32 add_ppu_func_sub(const std::initializer_list& ops, const char* name, Module* module, ppu_func_caller func); void hook_ppu_funcs(vm::ptr base, u32 size); @@ -151,15 +151,13 @@ template inline auto hle_call_func(PPUThread& CPU, #define REG_UNNAMED(module, nid) add_ppu_func(ModuleFunc(0x##nid, 0, &module, "_nid_"#nid, bind_func(_nid_##nid))) -#define REG_SUB(module, group, ns, name, ...) \ - const SearchPatternEntry name##_table[] = {__VA_ARGS__}; \ - add_ppu_func_sub(group, name##_table, sizeof(name##_table) / sizeof(SearchPatternEntry), #name, &module, bind_func(ns::name)) +#define REG_SUB(module, ns, name, ...) add_ppu_func_sub({ __VA_ARGS__ }, #name, &module, bind_func(ns::name)) -#define se_op_all(type, op, sup) []() { s32 XXX = 0; SearchPatternEntry res = { (type), (op), 0, (sup) }; XXX = -1; res.mask = (op) ^ ~res.data; return res; }() -#define se_op(op) se_op_all(SPET_MASKED_OPCODE, op, 0) -#define se_opt_op(op) se_op_all(SPET_OPTIONAL_MASKED_OPCODE, op, 0) -#define se_label(label) { SPET_LABEL, (label) } -#define se_br_label(op, label) se_op_all(SPET_BRANCH_TO_LABEL, op, label) -#define se_func_call(op, name) se_op_all(SPET_BRANCH_TO_FUNC, op, get_function_id(#name)) +#define SP_OP(type, op, sup) []() { s32 XXX = 0; SearchPatternEntry res = { (type), (op), 0, (sup) }; XXX = -1; res.mask = (op) ^ ~res.data; return res; }() +#define SP_I(op) SP_OP(SPET_MASKED_OPCODE, op, 0) +#define OPT_SP_I(op) SP_OP(SPET_OPTIONAL_MASKED_OPCODE, op, 0) +#define SET_LABEL(label) { SPET_LABEL, (label) } +#define SP_LABEL_BR(op, label) SP_OP(SPET_BRANCH_TO_LABEL, op, label) +#define SP_CALL(op, name) SP_OP(SPET_BRANCH_TO_FUNC, op, get_function_id(#name)) #define UNIMPLEMENTED_FUNC(module) module.Error("%s", __FUNCTION__) diff --git a/rpcs3/Emu/SysCalls/Modules/cellAdec.h b/rpcs3/Emu/SysCalls/Modules/cellAdec.h index 5ef4594a5d..f6e72ed086 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAdec.h +++ b/rpcs3/Emu/SysCalls/Modules/cellAdec.h @@ -368,7 +368,7 @@ enum CellAdecMsgType : s32 CELL_ADEC_MSG_TYPE_SEQDONE, }; -using CellAdecCbMsg = func_def; +using CellAdecCbMsg = s32(u32 handle, CellAdecMsgType msgType, s32 msgData, u32 cbArg); struct CellAdecCb { diff --git a/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp b/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp index f3553f463f..590ba0145b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp @@ -3,8 +3,6 @@ #include "Emu/System.h" #include "Emu/SysCalls/Modules.h" -extern Module cellAtrac; - #include "cellAtrac.h" s32 cellAtracSetDataAndGetMemSize(vm::ptr pHandle, vm::ptr pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, vm::ptr puiWorkMemByte) diff --git a/rpcs3/Emu/SysCalls/Modules/cellAtrac.h b/rpcs3/Emu/SysCalls/Modules/cellAtrac.h index 639afbc122..3df525aaa5 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAtrac.h +++ b/rpcs3/Emu/SysCalls/Modules/cellAtrac.h @@ -28,32 +28,6 @@ enum CELL_ATRAC_ERROR_ILLEGAL_SPU_THREAD_PRIORITY = 0x80610382, }; -enum -{ - CELL_ATRACMULTI_ERROR_API_FAIL = 0x80610b01, - CELL_ATRACMULTI_ERROR_READSIZE_OVER_BUFFER = 0x80610b11, - CELL_ATRACMULTI_ERROR_UNKNOWN_FORMAT = 0x80610b12, - CELL_ATRACMULTI_ERROR_READSIZE_IS_TOO_SMALL = 0x80610b13, - CELL_ATRACMULTI_ERROR_ILLEGAL_SAMPLING_RATE = 0x80610b14, - CELL_ATRACMULTI_ERROR_ILLEGAL_DATA = 0x80610b15, - CELL_ATRACMULTI_ERROR_NO_DECODER = 0x80610b21, - CELL_ATRACMULTI_ERROR_UNSET_DATA = 0x80610b22, - CELL_ATRACMULTI_ERROR_DECODER_WAS_CREATED = 0x80610b23, - CELL_ATRACMULTI_ERROR_ALLDATA_WAS_DECODED = 0x80610b31, - CELL_ATRACMULTI_ERROR_NODATA_IN_BUFFER = 0x80610b32, - CELL_ATRACMULTI_ERROR_NOT_ALIGNED_OUT_BUFFER = 0x80610b33, - CELL_ATRACMULTI_ERROR_NEED_SECOND_BUFFER = 0x80610b34, - CELL_ATRACMULTI_ERROR_ALLDATA_IS_ONMEMORY = 0x80610b41, - CELL_ATRACMULTI_ERROR_ADD_DATA_IS_TOO_BIG = 0x80610b42, - CELL_ATRACMULTI_ERROR_NONEED_SECOND_BUFFER = 0x80610b51, - CELL_ATRACMULTI_ERROR_UNSET_LOOP_NUM = 0x80610b61, - CELL_ATRACMULTI_ERROR_ILLEGAL_SAMPLE = 0x80610b71, - CELL_ATRACMULTI_ERROR_ILLEGAL_RESET_BYTE = 0x80610b72, - CELL_ATRACMULTI_ERROR_ILLEGAL_PPU_THREAD_PRIORITY = 0x80610b81, - CELL_ATRACMULTI_ERROR_ILLEGAL_SPU_THREAD_PRIORITY = 0x80610b82, - CELL_ATRACMULTI_ERROR_API_PARAMETER = 0x80610b91, -}; - // Remain Frame enum : s32 { @@ -62,7 +36,7 @@ enum : s32 CELL_ATRAC_LOOP_STREAM_DATA_IS_ON_MEMORY = -3, }; -union CellAtracHandle +struct set_alignment(8) CellAtracHandle { vm::ptr pucWorkMem; // ... @@ -83,3 +57,5 @@ struct CellAtracExtRes vm::ptr pSpurs; u8 priority[8]; }; + +extern Module cellAtrac; diff --git a/rpcs3/Emu/SysCalls/Modules/cellAtracMulti.cpp b/rpcs3/Emu/SysCalls/Modules/cellAtracMulti.cpp new file mode 100644 index 0000000000..cc3bc9a2e5 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellAtracMulti.cpp @@ -0,0 +1,238 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" + +#include "cellAtracMulti.h" + +s32 cellAtracMultiSetDataAndGetMemSize(vm::ptr pHandle, vm::ptr pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, u32 uiOutputChNum, vm::ptr piTrackArray, vm::ptr puiWorkMemByte) +{ + cellAtracMulti.Warning("cellAtracMultiSetDataAndGetMemSize(pHandle=*0x%x, pucBufferAddr=*0x%x, uiReadByte=0x%x, uiBufferByte=0x%x, uiOutputChNum=%d, piTrackArray=*0x%x, puiWorkMemByte=*0x%x)", + pHandle, pucBufferAddr, uiReadByte, uiBufferByte, uiOutputChNum, piTrackArray, puiWorkMemByte); + + *puiWorkMemByte = 0x1000; + return CELL_OK; +} + +s32 cellAtracMultiCreateDecoder(vm::ptr pHandle, vm::ptr pucWorkMem, u32 uiPpuThreadPriority, u32 uiSpuThreadPriority) +{ + cellAtracMulti.Warning("cellAtracMultiCreateDecoder(pHandle=*0x%x, pucWorkMem=*0x%x, uiPpuThreadPriority=%d, uiSpuThreadPriority=%d)", pHandle, pucWorkMem, uiPpuThreadPriority, uiSpuThreadPriority); + + pHandle->pucWorkMem = pucWorkMem; + return CELL_OK; +} + +s32 cellAtracMultiCreateDecoderExt(vm::ptr pHandle, vm::ptr pucWorkMem, u32 uiPpuThreadPriority, vm::ptr pExtRes) +{ + cellAtracMulti.Warning("cellAtracMultiCreateDecoderExt(pHandle=*0x%x, pucWorkMem=*0x%x, uiPpuThreadPriority=%d, pExtRes=*0x%x)", pHandle, pucWorkMem, uiPpuThreadPriority, pExtRes); + + pHandle->pucWorkMem = pucWorkMem; + return CELL_OK; +} + +s32 cellAtracMultiDeleteDecoder(vm::ptr pHandle) +{ + cellAtracMulti.Warning("cellAtracMultiDeleteDecoder(pHandle=*0x%x)", pHandle); + + return CELL_OK; +} + +s32 cellAtracMultiDecode(vm::ptr pHandle, vm::ptr pfOutAddr, vm::ptr puiSamples, vm::ptr puiFinishflag, vm::ptr piRemainFrame) +{ + cellAtracMulti.Warning("cellAtracMultiDecode(pHandle=*0x%x, pfOutAddr=*0x%x, puiSamples=*0x%x, puiFinishFlag=*0x%x, piRemainFrame=*0x%x)", pHandle, pfOutAddr, puiSamples, puiFinishflag, piRemainFrame); + + *puiSamples = 0; + *puiFinishflag = 1; + *piRemainFrame = CELL_ATRACMULTI_ALLDATA_IS_ON_MEMORY; + return CELL_OK; +} + +s32 cellAtracMultiGetStreamDataInfo(vm::ptr pHandle, vm::pptr ppucWritePointer, vm::ptr puiWritableByte, vm::ptr puiReadPosition) +{ + cellAtracMulti.Warning("cellAtracMultiGetStreamDataInfo(pHandle=*0x%x, ppucWritePointer=**0x%x, puiWritableByte=*0x%x, puiReadPosition=*0x%x)", pHandle, ppucWritePointer, puiWritableByte, puiReadPosition); + + *ppucWritePointer = pHandle->pucWorkMem; + *puiWritableByte = 0x1000; + *puiReadPosition = 0; + return CELL_OK; +} + +s32 cellAtracMultiAddStreamData(vm::ptr pHandle, u32 uiAddByte) +{ + cellAtracMulti.Warning("cellAtracMultiAddStreamData(pHandle=*0x%x, uiAddByte=0x%x)", pHandle, uiAddByte); + + return CELL_OK; +} + +s32 cellAtracMultiGetRemainFrame(vm::ptr pHandle, vm::ptr piRemainFrame) +{ + cellAtracMulti.Warning("cellAtracMultiGetRemainFrame(pHandle=*0x%x, piRemainFrame=*0x%x)", pHandle, piRemainFrame); + + *piRemainFrame = CELL_ATRACMULTI_ALLDATA_IS_ON_MEMORY; + return CELL_OK; +} + +s32 cellAtracMultiGetVacantSize(vm::ptr pHandle, vm::ptr puiVacantSize) +{ + cellAtracMulti.Warning("cellAtracMultiGetVacantSize(pHandle=*0x%x, puiVacantSize=*0x%x)", pHandle, puiVacantSize); + + *puiVacantSize = 0x1000; + return CELL_OK; +} + +s32 cellAtracMultiIsSecondBufferNeeded(vm::ptr pHandle) +{ + cellAtracMulti.Warning("cellAtracMultiIsSecondBufferNeeded(pHandle=*0x%x)", pHandle); + + return 0; +} + +s32 cellAtracMultiGetSecondBufferInfo(vm::ptr pHandle, vm::ptr puiReadPosition, vm::ptr puiDataByte) +{ + cellAtracMulti.Warning("cellAtracMultiGetSecondBufferInfo(pHandle=*0x%x, puiReadPosition=*0x%x, puiDataByte=*0x%x)", pHandle, puiReadPosition, puiDataByte); + + *puiReadPosition = 0; + *puiDataByte = 0; // write to null block will occur + return CELL_OK; +} + +s32 cellAtracMultiSetSecondBuffer(vm::ptr pHandle, vm::ptr pucSecondBufferAddr, u32 uiSecondBufferByte) +{ + cellAtracMulti.Warning("cellAtracMultiSetSecondBuffer(pHandle=*0x%x, pucSecondBufferAddr=*0x%x, uiSecondBufferByte=0x%x)", pHandle, pucSecondBufferAddr, uiSecondBufferByte); + + return CELL_OK; +} + +s32 cellAtracMultiGetChannel(vm::ptr pHandle, vm::ptr puiChannel) +{ + cellAtracMulti.Warning("cellAtracMultiGetChannel(pHandle=*0x%x, puiChannel=*0x%x)", pHandle, puiChannel); + + *puiChannel = 2; + return CELL_OK; +} + +s32 cellAtracMultiGetMaxSample(vm::ptr pHandle, vm::ptr puiMaxSample) +{ + cellAtracMulti.Warning("cellAtracMultiGetMaxSample(pHandle=*0x%x, puiMaxSample=*0x%x)", pHandle, puiMaxSample); + + *puiMaxSample = 512; + return CELL_OK; +} + +s32 cellAtracMultiGetNextSample(vm::ptr pHandle, vm::ptr puiNextSample) +{ + cellAtracMulti.Warning("cellAtracMultiGetNextSample(pHandle=*0x%x, puiNextSample=*0x%x)", pHandle, puiNextSample); + + *puiNextSample = 0; + return CELL_OK; +} + +s32 cellAtracMultiGetSoundInfo(vm::ptr pHandle, vm::ptr piEndSample, vm::ptr piLoopStartSample, vm::ptr piLoopEndSample) +{ + cellAtracMulti.Warning("cellAtracMultiGetSoundInfo(pHandle=*0x%x, piEndSample=*0x%x, piLoopStartSample=*0x%x, piLoopEndSample=*0x%x)", pHandle, piEndSample, piLoopStartSample, piLoopEndSample); + + *piEndSample = 0; + *piLoopStartSample = 0; + *piLoopEndSample = 0; + return CELL_OK; +} + +s32 cellAtracMultiGetNextDecodePosition(vm::ptr pHandle, vm::ptr puiSamplePosition) +{ + cellAtracMulti.Warning("cellAtracMultiGetNextDecodePosition(pHandle=*0x%x, puiSamplePosition=*0x%x)", pHandle, puiSamplePosition); + + *puiSamplePosition = 0; + return CELL_ATRACMULTI_ERROR_ALLDATA_WAS_DECODED; +} + +s32 cellAtracMultiGetBitrate(vm::ptr pHandle, vm::ptr puiBitrate) +{ + cellAtracMulti.Warning("cellAtracMultiGetBitrate(pHandle=*0x%x, puiBitrate=*0x%x)", pHandle, puiBitrate); + + *puiBitrate = 128; + return CELL_OK; +} + +s32 cellAtracMultiGetTrackArray(vm::ptr pHandle, vm::ptr piTrackArray) +{ + cellAtracMulti.Error("cellAtracMultiGetTrackArray(pHandle=*0x%x, piTrackArray=*0x%x)", pHandle, piTrackArray); + + return CELL_OK; +} + +s32 cellAtracMultiGetLoopInfo(vm::ptr pHandle, vm::ptr piLoopNum, vm::ptr puiLoopStatus) +{ + cellAtracMulti.Warning("cellAtracMultiGetLoopInfo(pHandle=*0x%x, piLoopNum=*0x%x, puiLoopStatus=*0x%x)", pHandle, piLoopNum, puiLoopStatus); + + *piLoopNum = 0; + *puiLoopStatus = 0; + return CELL_OK; +} + +s32 cellAtracMultiSetLoopNum(vm::ptr pHandle, s32 iLoopNum) +{ + cellAtracMulti.Warning("cellAtracMultiSetLoopNum(pHandle=*0x%x, iLoopNum=%d)", pHandle, iLoopNum); + + return CELL_OK; +} + +s32 cellAtracMultiGetBufferInfoForResetting(vm::ptr pHandle, u32 uiSample, vm::ptr pBufferInfo) +{ + cellAtracMulti.Warning("cellAtracMultiGetBufferInfoForResetting(pHandle=*0x%x, uiSample=0x%x, pBufferInfo=*0x%x)", pHandle, uiSample, pBufferInfo); + + pBufferInfo->pucWriteAddr = pHandle->pucWorkMem; + pBufferInfo->uiWritableByte = 0x1000; + pBufferInfo->uiMinWriteByte = 0; + pBufferInfo->uiReadPosition = 0; + return CELL_OK; +} + +s32 cellAtracMultiResetPlayPosition(vm::ptr pHandle, u32 uiSample, u32 uiWriteByte, vm::ptr piTrackArray) +{ + cellAtracMulti.Warning("cellAtracMultiResetPlayPosition(pHandle=*0x%x, uiSample=0x%x, uiWriteByte=0x%x, piTrackArray=*0x%x)", pHandle, uiSample, uiWriteByte, piTrackArray); + + return CELL_OK; +} + +s32 cellAtracMultiGetInternalErrorInfo(vm::ptr pHandle, vm::ptr piResult) +{ + cellAtracMulti.Warning("cellAtracMultiGetInternalErrorInfo(pHandle=*0x%x, piResult=*0x%x)", pHandle, piResult); + + *piResult = 0; + return CELL_OK; +} + +Module cellAtracMulti("cellAtrac", []() +{ + REG_FUNC(cellAtracMulti, cellAtracMultiSetDataAndGetMemSize); + + REG_FUNC(cellAtracMulti, cellAtracMultiCreateDecoder); + REG_FUNC(cellAtracMulti, cellAtracMultiCreateDecoderExt); + REG_FUNC(cellAtracMulti, cellAtracMultiDeleteDecoder); + + REG_FUNC(cellAtracMulti, cellAtracMultiDecode); + + REG_FUNC(cellAtracMulti, cellAtracMultiGetStreamDataInfo); + REG_FUNC(cellAtracMulti, cellAtracMultiAddStreamData); + REG_FUNC(cellAtracMulti, cellAtracMultiGetRemainFrame); + REG_FUNC(cellAtracMulti, cellAtracMultiGetVacantSize); + REG_FUNC(cellAtracMulti, cellAtracMultiIsSecondBufferNeeded); + REG_FUNC(cellAtracMulti, cellAtracMultiGetSecondBufferInfo); + REG_FUNC(cellAtracMulti, cellAtracMultiSetSecondBuffer); + + REG_FUNC(cellAtracMulti, cellAtracMultiGetChannel); + REG_FUNC(cellAtracMulti, cellAtracMultiGetMaxSample); + REG_FUNC(cellAtracMulti, cellAtracMultiGetNextSample); + REG_FUNC(cellAtracMulti, cellAtracMultiGetSoundInfo); + REG_FUNC(cellAtracMulti, cellAtracMultiGetNextDecodePosition); + REG_FUNC(cellAtracMulti, cellAtracMultiGetBitrate); + REG_FUNC(cellAtracMulti, cellAtracMultiGetTrackArray); + + REG_FUNC(cellAtracMulti, cellAtracMultiGetLoopInfo); + REG_FUNC(cellAtracMulti, cellAtracMultiSetLoopNum); + + REG_FUNC(cellAtracMulti, cellAtracMultiGetBufferInfoForResetting); + REG_FUNC(cellAtracMulti, cellAtracMultiResetPlayPosition); + + REG_FUNC(cellAtracMulti, cellAtracMultiGetInternalErrorInfo); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellAtracMulti.h b/rpcs3/Emu/SysCalls/Modules/cellAtracMulti.h new file mode 100644 index 0000000000..1577e98fc6 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellAtracMulti.h @@ -0,0 +1,62 @@ +#pragma once + +namespace vm { using namespace ps3; } + +// Return Codes +enum +{ + CELL_ATRACMULTI_ERROR_API_FAIL = 0x80610b01, + CELL_ATRACMULTI_ERROR_READSIZE_OVER_BUFFER = 0x80610b11, + CELL_ATRACMULTI_ERROR_UNKNOWN_FORMAT = 0x80610b12, + CELL_ATRACMULTI_ERROR_READSIZE_IS_TOO_SMALL = 0x80610b13, + CELL_ATRACMULTI_ERROR_ILLEGAL_SAMPLING_RATE = 0x80610b14, + CELL_ATRACMULTI_ERROR_ILLEGAL_DATA = 0x80610b15, + CELL_ATRACMULTI_ERROR_NO_DECODER = 0x80610b21, + CELL_ATRACMULTI_ERROR_UNSET_DATA = 0x80610b22, + CELL_ATRACMULTI_ERROR_DECODER_WAS_CREATED = 0x80610b23, + CELL_ATRACMULTI_ERROR_ALLDATA_WAS_DECODED = 0x80610b31, + CELL_ATRACMULTI_ERROR_NODATA_IN_BUFFER = 0x80610b32, + CELL_ATRACMULTI_ERROR_NOT_ALIGNED_OUT_BUFFER = 0x80610b33, + CELL_ATRACMULTI_ERROR_NEED_SECOND_BUFFER = 0x80610b34, + CELL_ATRACMULTI_ERROR_ALLDATA_IS_ONMEMORY = 0x80610b41, + CELL_ATRACMULTI_ERROR_ADD_DATA_IS_TOO_BIG = 0x80610b42, + CELL_ATRACMULTI_ERROR_NONEED_SECOND_BUFFER = 0x80610b51, + CELL_ATRACMULTI_ERROR_UNSET_LOOP_NUM = 0x80610b61, + CELL_ATRACMULTI_ERROR_ILLEGAL_SAMPLE = 0x80610b71, + CELL_ATRACMULTI_ERROR_ILLEGAL_RESET_BYTE = 0x80610b72, + CELL_ATRACMULTI_ERROR_ILLEGAL_PPU_THREAD_PRIORITY = 0x80610b81, + CELL_ATRACMULTI_ERROR_ILLEGAL_SPU_THREAD_PRIORITY = 0x80610b82, + CELL_ATRACMULTI_ERROR_API_PARAMETER = 0x80610b91, +}; + +// Remain Frame +enum : s32 +{ + CELL_ATRACMULTI_ALLDATA_IS_ON_MEMORY = -1, + CELL_ATRACMULTI_NONLOOP_STREAM_DATA_IS_ON_MEMORY = -2, + CELL_ATRACMULTI_LOOP_STREAM_DATA_IS_ON_MEMORY = -3, +}; + +struct set_alignment(8) CellAtracMultiHandle +{ + vm::ptr pucWorkMem; + // ... +}; + +CHECK_MAX_SIZE(CellAtracMultiHandle, 512); + +struct CellAtracMultiBufferInfo +{ + vm::ptr pucWriteAddr; + be_t uiWritableByte; + be_t uiMinWriteByte; + be_t uiReadPosition; +}; + +struct CellAtracMultiExtRes +{ + vm::ptr pSpurs; + u8 priority[8]; +}; + +extern Module cellAtracMulti; diff --git a/rpcs3/Emu/SysCalls/Modules/cellAudioOut.cpp b/rpcs3/Emu/SysCalls/Modules/cellAudioOut.cpp new file mode 100644 index 0000000000..ea1b47e6a8 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellAudioOut.cpp @@ -0,0 +1,259 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +#include "cellAudioOut.h" + +extern Module cellSysutil; + +s32 cellAudioOutGetSoundAvailability(u32 audioOut, u32 type, u32 fs, u32 option) +{ + cellSysutil.Warning("cellAudioOutGetSoundAvailability(audioOut=%d, type=%d, fs=0x%x, option=%d)", audioOut, type, fs, option); + + option = 0; + + s32 available = 8; // should be at least 2 + + switch (fs) + { + case CELL_AUDIO_OUT_FS_32KHZ: + case CELL_AUDIO_OUT_FS_44KHZ: + case CELL_AUDIO_OUT_FS_48KHZ: + case CELL_AUDIO_OUT_FS_88KHZ: + case CELL_AUDIO_OUT_FS_96KHZ: + case CELL_AUDIO_OUT_FS_176KHZ: + case CELL_AUDIO_OUT_FS_192KHZ: + break; + + default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE; + } + + switch (type) + { + case CELL_AUDIO_OUT_CODING_TYPE_LPCM: break; + case CELL_AUDIO_OUT_CODING_TYPE_AC3: available = 0; break; + case CELL_AUDIO_OUT_CODING_TYPE_DTS: available = 0; break; + + default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE; + } + + switch (audioOut) + { + case CELL_AUDIO_OUT_PRIMARY: return available; + case CELL_AUDIO_OUT_SECONDARY: return 0; + } + + return CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION; +} + +s32 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)", audioOut, type, fs, ch, option); + + option = 0; + + s32 available = 8; // should be at least 2 + + switch (fs) + { + case CELL_AUDIO_OUT_FS_32KHZ: + case CELL_AUDIO_OUT_FS_44KHZ: + case CELL_AUDIO_OUT_FS_48KHZ: + case CELL_AUDIO_OUT_FS_88KHZ: + case CELL_AUDIO_OUT_FS_96KHZ: + case CELL_AUDIO_OUT_FS_176KHZ: + case CELL_AUDIO_OUT_FS_192KHZ: + break; + + default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE; + } + + switch (ch) + { + case 2: break; + case 6: available = 0; break; + case 8: available = 0; break; + + default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE; + } + + switch (type) + { + case CELL_AUDIO_OUT_CODING_TYPE_LPCM: break; + case CELL_AUDIO_OUT_CODING_TYPE_AC3: available = 0; break; + case CELL_AUDIO_OUT_CODING_TYPE_DTS: available = 0; break; + + default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE; + } + + switch (audioOut) + { + case CELL_AUDIO_OUT_PRIMARY: return available; + case CELL_AUDIO_OUT_SECONDARY: return 0; + } + + return CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION; +} + +s32 cellAudioOutGetState(u32 audioOut, u32 deviceIndex, vm::ptr state) +{ + cellSysutil.Warning("cellAudioOutGetState(audioOut=0x%x, deviceIndex=0x%x, state=*0x%x)", audioOut, deviceIndex, state); + + *state = {}; + + switch (audioOut) + { + case CELL_AUDIO_OUT_PRIMARY: + state->state = CELL_AUDIO_OUT_OUTPUT_STATE_ENABLED; + state->encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; + state->downMixer = CELL_AUDIO_OUT_DOWNMIXER_NONE; + state->soundMode.type = CELL_AUDIO_OUT_CODING_TYPE_LPCM; + state->soundMode.channel = CELL_AUDIO_OUT_CHNUM_8; + state->soundMode.fs = CELL_AUDIO_OUT_FS_48KHZ; + state->soundMode.reserved = 0; + state->soundMode.layout = CELL_AUDIO_OUT_SPEAKER_LAYOUT_8CH_LREClrxy; + + return CELL_OK; + + case CELL_AUDIO_OUT_SECONDARY: + state->state = CELL_AUDIO_OUT_OUTPUT_STATE_DISABLED; + + return CELL_OK; + } + + return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT; +} + +s32 cellAudioOutConfigure(u32 audioOut, vm::ptr config, vm::ptr option, u32 waitForEvent) +{ + cellSysutil.Warning("cellAudioOutConfigure(audioOut=%d, config=*0x%x, option=*0x%x, waitForEvent=%d)", audioOut, config, option, waitForEvent); + + switch (audioOut) + { + case CELL_AUDIO_OUT_PRIMARY: + if (config->channel) + { + //Emu.GetAudioManager().GetInfo().mode.channel = config->channel; + } + + //Emu.GetAudioManager().GetInfo().mode.encoder = config->encoder; + + if (config->downMixer) + { + //Emu.GetAudioManager().GetInfo().mode.downMixer = config->downMixer; + } + + return CELL_OK; + + case CELL_AUDIO_OUT_SECONDARY: + return CELL_OK; + } + + return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT; +} + +s32 cellAudioOutGetConfiguration(u32 audioOut, vm::ptr config, vm::ptr option) +{ + cellSysutil.Warning("cellAudioOutGetConfiguration(audioOut=%d, config=*0x%x, option=*0x%x)", audioOut, config, option); + + if (option) *option = {}; + *config = {}; + + switch (audioOut) + { + case CELL_AUDIO_OUT_PRIMARY: + config->channel = CELL_AUDIO_OUT_CHNUM_8; + config->encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; + config->downMixer = CELL_AUDIO_OUT_DOWNMIXER_NONE; + + return CELL_OK; + + case CELL_AUDIO_OUT_SECONDARY: + + return CELL_OK; + } + + return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT; +} + +s32 cellAudioOutGetNumberOfDevice(u32 audioOut) +{ + cellSysutil.Warning("cellAudioOutGetNumberOfDevice(audioOut=%d)", audioOut); + + switch (audioOut) + { + case CELL_AUDIO_OUT_PRIMARY: return 1; + case CELL_AUDIO_OUT_SECONDARY: return 0; + } + + return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT; +} + +s32 cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, vm::ptr info) +{ + cellSysutil.Todo("cellAudioOutGetDeviceInfo(audioOut=%d, deviceIndex=%d, info=*0x%x)", audioOut, deviceIndex, info); + + if (deviceIndex) return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND; + + info->portType = CELL_AUDIO_OUT_PORT_HDMI; + info->availableModeCount = 1; + info->state = CELL_AUDIO_OUT_DEVICE_STATE_AVAILABLE; + info->latency = 1000; + info->availableModes[0].type = CELL_AUDIO_OUT_CODING_TYPE_LPCM; + info->availableModes[0].channel = CELL_AUDIO_OUT_CHNUM_8; + info->availableModes[0].fs = CELL_AUDIO_OUT_FS_48KHZ; + info->availableModes[0].layout = CELL_AUDIO_OUT_SPEAKER_LAYOUT_8CH_LREClrxy; + + return CELL_OK; +} + +s32 cellAudioOutSetCopyControl(u32 audioOut, u32 control) +{ + cellSysutil.Warning("cellAudioOutSetCopyControl(audioOut=%d, control=%d)", audioOut, control); + + switch (audioOut) + { + case CELL_AUDIO_OUT_PRIMARY: + case CELL_AUDIO_OUT_SECONDARY: + break; + + default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT; + } + + switch (control) + { + case CELL_AUDIO_OUT_COPY_CONTROL_COPY_FREE: + case CELL_AUDIO_OUT_COPY_CONTROL_COPY_ONCE: + case CELL_AUDIO_OUT_COPY_CONTROL_COPY_NEVER: + break; + + default: return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER; + } + + return CELL_OK; +} + +s32 cellAudioOutRegisterCallback() +{ + throw EXCEPTION(""); +} + +s32 cellAudioOutUnregisterCallback() +{ + throw EXCEPTION(""); +} + + +void cellSysutil_AudioOut_init() +{ + REG_FUNC(cellSysutil, cellAudioOutGetState); + REG_FUNC(cellSysutil, cellAudioOutConfigure); + REG_FUNC(cellSysutil, cellAudioOutGetSoundAvailability); + REG_FUNC(cellSysutil, cellAudioOutGetSoundAvailability2); + REG_FUNC(cellSysutil, cellAudioOutGetDeviceInfo); + REG_FUNC(cellSysutil, cellAudioOutGetNumberOfDevice); + REG_FUNC(cellSysutil, cellAudioOutGetConfiguration); + REG_FUNC(cellSysutil, cellAudioOutSetCopyControl); + REG_FUNC(cellSysutil, cellAudioOutRegisterCallback); + REG_FUNC(cellSysutil, cellAudioOutUnregisterCallback); +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp b/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp index 5499ac05b4..bfa5df5c33 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp @@ -1,17 +1,87 @@ #include "stdafx.h" -#include "Ini.h" #include "Emu/Memory/Memory.h" #include "Emu/SysCalls/Modules.h" -#include "Emu/RSX/sysutil_video.h" -namespace vm { using namespace ps3; } +#include "Ini.h" +#include "cellAudioIn.h" +#include "cellAudioOut.h" +#include "cellVideoOut.h" extern Module cellAvconfExt; +s32 cellAudioOutUnregisterDevice() +{ + throw EXCEPTION(""); +} + +s32 cellAudioOutGetDeviceInfo2() +{ + throw EXCEPTION(""); +} + +s32 cellVideoOutSetXVColor() +{ + throw EXCEPTION(""); +} + +s32 cellVideoOutSetupDisplay() +{ + throw EXCEPTION(""); +} + +s32 cellAudioInGetDeviceInfo() +{ + throw EXCEPTION(""); +} + s32 cellVideoOutConvertCursorColor() { - UNIMPLEMENTED_FUNC(cellAvconfExt); - return CELL_OK; + throw EXCEPTION(""); +} + +s32 cellVideoOutGetGamma() +{ + throw EXCEPTION(""); +} + +s32 cellAudioInGetAvailableDeviceInfo() +{ + throw EXCEPTION(""); +} + +s32 cellAudioOutGetAvailableDeviceInfo() +{ + throw EXCEPTION(""); +} + +s32 cellVideoOutSetGamma() +{ + throw EXCEPTION(""); +} + +s32 cellAudioOutRegisterDevice() +{ + throw EXCEPTION(""); +} + +s32 cellAudioOutSetDeviceMode() +{ + throw EXCEPTION(""); +} + +s32 cellAudioInSetDeviceMode() +{ + throw EXCEPTION(""); +} + +s32 cellAudioInRegisterDevice() +{ + throw EXCEPTION(""); +} + +s32 cellAudioInUnregisterDevice() +{ + throw EXCEPTION(""); } s32 cellVideoOutGetScreenSize(u32 videoOut, vm::ptr screenSize) @@ -41,22 +111,23 @@ s32 cellVideoOutGetScreenSize(u32 videoOut, vm::ptr screenSize) return CELL_VIDEO_OUT_ERROR_VALUE_IS_NOT_SET; } -s32 cellVideoOutGetGamma() -{ - UNIMPLEMENTED_FUNC(cellAvconfExt); - return CELL_OK; -} - -s32 cellVideoOutSetGamma() -{ - UNIMPLEMENTED_FUNC(cellAvconfExt); - return CELL_OK; -} Module cellAvconfExt("cellAvconfExt", []() { + REG_FUNC(cellAvconfExt, cellAudioOutUnregisterDevice); + REG_FUNC(cellAvconfExt, cellAudioOutGetDeviceInfo2); + REG_FUNC(cellAvconfExt, cellVideoOutSetXVColor); + REG_FUNC(cellAvconfExt, cellVideoOutSetupDisplay); + REG_FUNC(cellAvconfExt, cellAudioInGetDeviceInfo); REG_FUNC(cellAvconfExt, cellVideoOutConvertCursorColor); - REG_FUNC(cellAvconfExt, cellVideoOutGetScreenSize); REG_FUNC(cellAvconfExt, cellVideoOutGetGamma); + REG_FUNC(cellAvconfExt, cellAudioInGetAvailableDeviceInfo); + REG_FUNC(cellAvconfExt, cellAudioOutGetAvailableDeviceInfo); REG_FUNC(cellAvconfExt, cellVideoOutSetGamma); + REG_FUNC(cellAvconfExt, cellAudioOutRegisterDevice); + REG_FUNC(cellAvconfExt, cellAudioOutSetDeviceMode); + REG_FUNC(cellAvconfExt, cellAudioInSetDeviceMode); + REG_FUNC(cellAvconfExt, cellAudioInRegisterDevice); + REG_FUNC(cellAvconfExt, cellAudioInUnregisterDevice); + REG_FUNC(cellAvconfExt, cellVideoOutGetScreenSize); }); diff --git a/rpcs3/Emu/SysCalls/Modules/cellBgdl.cpp b/rpcs3/Emu/SysCalls/Modules/cellBgdl.cpp index e047c4ea06..ff7bf62f4f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellBgdl.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellBgdl.cpp @@ -1,8 +1,9 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" -void cellBgdl_init(); -Module cellBgdl(0x003f, cellBgdl_init); +extern Module cellBGDL; // Return Codes enum @@ -15,35 +16,34 @@ enum CELL_BGDL_UTIL_ERROR_INITIALIZE = 0x8002ce05, }; -int cellBGDLGetInfo() +s32 cellBGDLGetInfo() { - UNIMPLEMENTED_FUNC(cellBgdl); + UNIMPLEMENTED_FUNC(cellBGDL); return CELL_OK; } -int cellBGDLGetInfo2() +s32 cellBGDLGetInfo2() { - UNIMPLEMENTED_FUNC(cellBgdl); + UNIMPLEMENTED_FUNC(cellBGDL); return CELL_OK; } -int cellBGDLSetMode() +s32 cellBGDLSetMode() { - UNIMPLEMENTED_FUNC(cellBgdl); + UNIMPLEMENTED_FUNC(cellBGDL); return CELL_OK; } -int cellBGDLGetMode() +s32 cellBGDLGetMode() { - UNIMPLEMENTED_FUNC(cellBgdl); + UNIMPLEMENTED_FUNC(cellBGDL); return CELL_OK; } -void cellBgdl_init() +Module cellBGDL("cellBGDL", []() { - REG_FUNC(cellBgdl, cellBGDLGetInfo); - REG_FUNC(cellBgdl, cellBGDLGetInfo2); - REG_FUNC(cellBgdl, cellBGDLSetMode); - REG_FUNC(cellBgdl, cellBGDLGetMode); -} -#endif + REG_FUNC(cellBGDL, cellBGDLGetInfo); + REG_FUNC(cellBGDL, cellBGDLGetInfo2); + REG_FUNC(cellBGDL, cellBGDLSetMode); + REG_FUNC(cellBGDL, cellBGDLGetMode); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellCamera.cpp b/rpcs3/Emu/SysCalls/Modules/cellCamera.cpp index 73b41413ab..bb3ca59368 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellCamera.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellCamera.cpp @@ -18,7 +18,7 @@ s32 cellCameraInit() return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND; } - if (g_camera->init.exchange(true)) + if (g_camera->init) { return CELL_CAMERA_ERROR_ALREADY_INIT; } @@ -60,6 +60,11 @@ s32 cellCameraInit() } // TODO: Some other default attributes? Need to check the actual behaviour on a real PS3. + if (g_camera->init.exchange(true)) + { + throw EXCEPTION("Unexpected"); + } + return CELL_OK; } @@ -67,11 +72,16 @@ s32 cellCameraEnd() { cellCamera.Warning("cellCameraEnd()"); - if (!g_camera->init.exchange(false)) + if (!g_camera->init) { return CELL_CAMERA_ERROR_NOT_INIT; } + if (!g_camera->init.exchange(false)) + { + throw EXCEPTION("Unexpected"); + } + return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellCamera.h b/rpcs3/Emu/SysCalls/Modules/cellCamera.h index 4a82a0b5b8..2718516e6d 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellCamera.h +++ b/rpcs3/Emu/SysCalls/Modules/cellCamera.h @@ -315,13 +315,13 @@ struct CellCameraReadEx // Custom struct to keep track of cameras struct camera_t { + std::atomic init{ false }; + struct attr_t { u32 v1, v2; }; - std::atomic init{ false }; - attr_t attr[500]{}; static const char* get_attr_name(s32 value) diff --git a/rpcs3/Emu/SysCalls/Modules/cellCelp8Enc.cpp b/rpcs3/Emu/SysCalls/Modules/cellCelp8Enc.cpp index e89fe43bce..676eeaa3a7 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellCelp8Enc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellCelp8Enc.cpp @@ -1,8 +1,9 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" -void cellCelp8Enc_init(); -Module cellCelp8Enc(0x0048, cellCelp8Enc_init); +extern Module cellCelp8Enc; // Return Codes enum @@ -15,61 +16,61 @@ enum CELL_CELP8ENC_ERROR_CORE_ARG = 0x806140b3, }; -int cellCelp8EncQueryAttr() +s32 cellCelp8EncQueryAttr() { UNIMPLEMENTED_FUNC(cellCelp8Enc); return CELL_OK; } -int cellCelp8EncOpen() +s32 cellCelp8EncOpen() { UNIMPLEMENTED_FUNC(cellCelp8Enc); return CELL_OK; } -int cellCelp8EncOpenEx() +s32 cellCelp8EncOpenEx() { UNIMPLEMENTED_FUNC(cellCelp8Enc); return CELL_OK; } -int cellCelp8EncClose() +s32 cellCelp8EncClose() { UNIMPLEMENTED_FUNC(cellCelp8Enc); return CELL_OK; } -int cellCelp8EncStart() +s32 cellCelp8EncStart() { UNIMPLEMENTED_FUNC(cellCelp8Enc); return CELL_OK; } -int cellCelp8EncEnd() +s32 cellCelp8EncEnd() { UNIMPLEMENTED_FUNC(cellCelp8Enc); return CELL_OK; } -int cellCelp8EncEncodeFrame() +s32 cellCelp8EncEncodeFrame() { UNIMPLEMENTED_FUNC(cellCelp8Enc); return CELL_OK; } -int cellCelp8EncWaitForOutput() +s32 cellCelp8EncWaitForOutput() { UNIMPLEMENTED_FUNC(cellCelp8Enc); return CELL_OK; } -int cellCelp8EncGetAu() +s32 cellCelp8EncGetAu() { UNIMPLEMENTED_FUNC(cellCelp8Enc); return CELL_OK; } -void cellCelp8Enc_init() +Module cellCelp8Enc("cellCelp8Enc", []() { REG_FUNC(cellCelp8Enc, cellCelp8EncQueryAttr); REG_FUNC(cellCelp8Enc, cellCelp8EncOpen); @@ -80,5 +81,4 @@ void cellCelp8Enc_init() REG_FUNC(cellCelp8Enc, cellCelp8EncEncodeFrame); REG_FUNC(cellCelp8Enc, cellCelp8EncWaitForOutput); REG_FUNC(cellCelp8Enc, cellCelp8EncGetAu); -} -#endif +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp b/rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp index 9ee9c60953..60041821a8 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp @@ -1,8 +1,9 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" -void cellCelpEnc_init(); -Module cellCelpEnc(0xf00a, cellCelpEnc_init); +extern Module cellCelpEnc; // Return Codes enum @@ -15,61 +16,61 @@ enum CELL_CELPENC_ERROR_CORE_ARG = 0x80614083, }; -int cellCelpEncQueryAttr() +s32 cellCelpEncQueryAttr() { UNIMPLEMENTED_FUNC(cellCelpEnc); return CELL_OK; } -int cellCelpEncOpen() +s32 cellCelpEncOpen() { UNIMPLEMENTED_FUNC(cellCelpEnc); return CELL_OK; } -int cellCelpEncOpenEx() +s32 cellCelpEncOpenEx() { UNIMPLEMENTED_FUNC(cellCelpEnc); return CELL_OK; } -int cellCelpEncClose() +s32 cellCelpEncClose() { UNIMPLEMENTED_FUNC(cellCelpEnc); return CELL_OK; } -int cellCelpEncStart() +s32 cellCelpEncStart() { UNIMPLEMENTED_FUNC(cellCelpEnc); return CELL_OK; } -int cellCelpEncEnd() +s32 cellCelpEncEnd() { UNIMPLEMENTED_FUNC(cellCelpEnc); return CELL_OK; } -int cellCelpEncEncodeFrame() +s32 cellCelpEncEncodeFrame() { UNIMPLEMENTED_FUNC(cellCelpEnc); return CELL_OK; } -int cellCelpEncWaitForOutput() +s32 cellCelpEncWaitForOutput() { UNIMPLEMENTED_FUNC(cellCelpEnc); return CELL_OK; } -int cellCelpEncGetAu() +s32 cellCelpEncGetAu() { UNIMPLEMENTED_FUNC(cellCelpEnc); return CELL_OK; } -void cellCelpEnc_init() +Module cellCelpEnc("cellCelpEnc", []() { REG_FUNC(cellCelpEnc, cellCelpEncQueryAttr); REG_FUNC(cellCelpEnc, cellCelpEncOpen); @@ -80,5 +81,4 @@ void cellCelpEnc_init() REG_FUNC(cellCelpEnc, cellCelpEncEncodeFrame); REG_FUNC(cellCelpEnc, cellCelpEncWaitForOutput); REG_FUNC(cellCelpEnc, cellCelpEncGetAu); -} -#endif +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellDaisy.cpp b/rpcs3/Emu/SysCalls/Modules/cellDaisy.cpp new file mode 100644 index 0000000000..22cfb40b8f --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellDaisy.cpp @@ -0,0 +1,322 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellDaisy; + +s32 _ZN4cell5Daisy17LFQueue2PushCloseEPNS0_8LFQueue2EPFiPvjE() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy21LFQueue2GetPopPointerEPNS0_8LFQueue2EPij() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy4Lock15completeConsumeEj() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy9_snprintfEPcjPKcz() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy4Lock7popOpenEv() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy26LFQueue2CompletePopPointerEPNS0_8LFQueue2EiPFiPvjEj() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy22ScatterGatherInterlock7releaseEv() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy4Lock7popOpenEv() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy22ScatterGatherInterlockC1EPVNS0_16_AtomicInterlockEjPjjh() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy22ScatterGatherInterlockC1EPVNS0_16_AtomicInterlockEjPjjh() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy9_snprintfEPcjPKcz() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy29LFQueue2HasUnfinishedConsumerEPNS0_8LFQueue2Ej() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy4Lock18getNextHeadPointerEv() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy4Lock10initializeEj() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy22ScatterGatherInterlockC1EPVNS0_16_AtomicInterlockEjPvPFiS5_jE() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy22ScatterGatherInterlockC2EPVNS0_16_AtomicInterlockEjPjjh() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy4Lock15completeProduceEj() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy16LFQueue2PushOpenEPNS0_8LFQueue2E() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy16LFQueue2PopCloseEPNS0_8LFQueue2EPFiPvjE() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy4Lock8popCloseEv() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy4Lock8popCloseEv() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy22ScatterGatherInterlockD2Ev() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy21LFQueue2GetPopPointerEPNS0_8LFQueue2EPij() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy4Lock18getNextTailPointerEv() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy4Lock8pushOpenEv() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy29LFQueue2HasUnfinishedConsumerEPNS0_8LFQueue2Ej() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy4Lock9pushCloseEv() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy22ScatterGatherInterlockD2Ev() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy15LFQueue2PopOpenEPNS0_8LFQueue2E() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy22ScatterGatherInterlockC1EPVNS0_16_AtomicInterlockEjPvPFiS5_jE() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy22ScatterGatherInterlockD1Ev() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy4Lock10initializeEj() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy4Lock15completeProduceEj() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy16LFQueue2PopCloseEPNS0_8LFQueue2EPFiPvjE() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy15LFQueue2PopOpenEPNS0_8LFQueue2E() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy17LFQueue2PushCloseEPNS0_8LFQueue2EPFiPvjE() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy22ScatterGatherInterlockC2EPVNS0_16_AtomicInterlockEjPvPFiS5_jE() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy22ScatterGatherInterlock21proceedSequenceNumberEv() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy22ScatterGatherInterlockC2EPVNS0_16_AtomicInterlockEjPvPFiS5_jE() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy22ScatterGatherInterlockC2EPVNS0_16_AtomicInterlockEjPjjh() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy4Lock15completeConsumeEj() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy22ScatterGatherInterlock21proceedSequenceNumberEv() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy4Lock18getNextHeadPointerEv() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy4Lock9pushCloseEv() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy26LFQueue2CompletePopPointerEPNS0_8LFQueue2EiPFiPvjEj() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy22ScatterGatherInterlock5probeEj() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy4Lock8pushOpenEv() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy22ScatterGatherInterlock5probeEj() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy22ScatterGatherInterlockD1Ev() +{ + throw EXCEPTION(""); +} + +s32 _ZN4cell5Daisy16LFQueue2PushOpenEPNS0_8LFQueue2E() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy4Lock18getNextTailPointerEv() +{ + throw EXCEPTION(""); +} + +s32 _QN4cell5Daisy22ScatterGatherInterlock7releaseEv() +{ + throw EXCEPTION(""); +} + + +Module cellDaisy("cellDaisy", []() +{ + REG_FUNC(cellDaisy, _ZN4cell5Daisy17LFQueue2PushCloseEPNS0_8LFQueue2EPFiPvjE); + REG_FUNC(cellDaisy, _ZN4cell5Daisy21LFQueue2GetPopPointerEPNS0_8LFQueue2EPij); + REG_FUNC(cellDaisy, _QN4cell5Daisy4Lock15completeConsumeEj); + REG_FUNC(cellDaisy, _QN4cell5Daisy9_snprintfEPcjPKcz); + REG_FUNC(cellDaisy, _ZN4cell5Daisy4Lock7popOpenEv); + REG_FUNC(cellDaisy, _ZN4cell5Daisy26LFQueue2CompletePopPointerEPNS0_8LFQueue2EiPFiPvjEj); + REG_FUNC(cellDaisy, _ZN4cell5Daisy22ScatterGatherInterlock7releaseEv); + REG_FUNC(cellDaisy, _QN4cell5Daisy4Lock7popOpenEv); + REG_FUNC(cellDaisy, _ZN4cell5Daisy22ScatterGatherInterlockC1EPVNS0_16_AtomicInterlockEjPjjh); + REG_FUNC(cellDaisy, _QN4cell5Daisy22ScatterGatherInterlockC1EPVNS0_16_AtomicInterlockEjPjjh); + REG_FUNC(cellDaisy, _ZN4cell5Daisy9_snprintfEPcjPKcz); + REG_FUNC(cellDaisy, _ZN4cell5Daisy29LFQueue2HasUnfinishedConsumerEPNS0_8LFQueue2Ej); + REG_FUNC(cellDaisy, _ZN4cell5Daisy4Lock18getNextHeadPointerEv); + REG_FUNC(cellDaisy, _ZN4cell5Daisy4Lock10initializeEj); + REG_FUNC(cellDaisy, _ZN4cell5Daisy22ScatterGatherInterlockC1EPVNS0_16_AtomicInterlockEjPvPFiS5_jE); + REG_FUNC(cellDaisy, _ZN4cell5Daisy22ScatterGatherInterlockC2EPVNS0_16_AtomicInterlockEjPjjh); + REG_FUNC(cellDaisy, _ZN4cell5Daisy4Lock15completeProduceEj); + REG_FUNC(cellDaisy, _QN4cell5Daisy16LFQueue2PushOpenEPNS0_8LFQueue2E); + REG_FUNC(cellDaisy, _QN4cell5Daisy16LFQueue2PopCloseEPNS0_8LFQueue2EPFiPvjE); + REG_FUNC(cellDaisy, _QN4cell5Daisy4Lock8popCloseEv); + REG_FUNC(cellDaisy, _ZN4cell5Daisy4Lock8popCloseEv); + REG_FUNC(cellDaisy, _ZN4cell5Daisy22ScatterGatherInterlockD2Ev); + REG_FUNC(cellDaisy, _QN4cell5Daisy21LFQueue2GetPopPointerEPNS0_8LFQueue2EPij); + REG_FUNC(cellDaisy, _ZN4cell5Daisy4Lock18getNextTailPointerEv); + REG_FUNC(cellDaisy, _ZN4cell5Daisy4Lock8pushOpenEv); + REG_FUNC(cellDaisy, _QN4cell5Daisy29LFQueue2HasUnfinishedConsumerEPNS0_8LFQueue2Ej); + REG_FUNC(cellDaisy, _ZN4cell5Daisy4Lock9pushCloseEv); + REG_FUNC(cellDaisy, _QN4cell5Daisy22ScatterGatherInterlockD2Ev); + REG_FUNC(cellDaisy, _QN4cell5Daisy15LFQueue2PopOpenEPNS0_8LFQueue2E); + REG_FUNC(cellDaisy, _QN4cell5Daisy22ScatterGatherInterlockC1EPVNS0_16_AtomicInterlockEjPvPFiS5_jE); + REG_FUNC(cellDaisy, _ZN4cell5Daisy22ScatterGatherInterlockD1Ev); + REG_FUNC(cellDaisy, _QN4cell5Daisy4Lock10initializeEj); + REG_FUNC(cellDaisy, _QN4cell5Daisy4Lock15completeProduceEj); + REG_FUNC(cellDaisy, _ZN4cell5Daisy16LFQueue2PopCloseEPNS0_8LFQueue2EPFiPvjE); + REG_FUNC(cellDaisy, _ZN4cell5Daisy15LFQueue2PopOpenEPNS0_8LFQueue2E); + REG_FUNC(cellDaisy, _QN4cell5Daisy17LFQueue2PushCloseEPNS0_8LFQueue2EPFiPvjE); + REG_FUNC(cellDaisy, _QN4cell5Daisy22ScatterGatherInterlockC2EPVNS0_16_AtomicInterlockEjPvPFiS5_jE); + REG_FUNC(cellDaisy, _QN4cell5Daisy22ScatterGatherInterlock21proceedSequenceNumberEv); + REG_FUNC(cellDaisy, _ZN4cell5Daisy22ScatterGatherInterlockC2EPVNS0_16_AtomicInterlockEjPvPFiS5_jE); + REG_FUNC(cellDaisy, _QN4cell5Daisy22ScatterGatherInterlockC2EPVNS0_16_AtomicInterlockEjPjjh); + REG_FUNC(cellDaisy, _ZN4cell5Daisy4Lock15completeConsumeEj); + REG_FUNC(cellDaisy, _ZN4cell5Daisy22ScatterGatherInterlock21proceedSequenceNumberEv); + REG_FUNC(cellDaisy, _QN4cell5Daisy4Lock18getNextHeadPointerEv); + REG_FUNC(cellDaisy, _QN4cell5Daisy4Lock9pushCloseEv); + REG_FUNC(cellDaisy, _QN4cell5Daisy26LFQueue2CompletePopPointerEPNS0_8LFQueue2EiPFiPvjEj); + REG_FUNC(cellDaisy, _ZN4cell5Daisy22ScatterGatherInterlock5probeEj); + REG_FUNC(cellDaisy, _QN4cell5Daisy4Lock8pushOpenEv); + REG_FUNC(cellDaisy, _QN4cell5Daisy22ScatterGatherInterlock5probeEj); + REG_FUNC(cellDaisy, _QN4cell5Daisy22ScatterGatherInterlockD1Ev); + REG_FUNC(cellDaisy, _ZN4cell5Daisy16LFQueue2PushOpenEPNS0_8LFQueue2E); + REG_FUNC(cellDaisy, _QN4cell5Daisy4Lock18getNextTailPointerEv); + REG_FUNC(cellDaisy, _QN4cell5Daisy22ScatterGatherInterlock7releaseEv); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp index b95078ed2b..5eb7ca3962 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp @@ -877,7 +877,7 @@ s32 cellDmuxClose(u32 handle) return CELL_OK; } -s32 cellDmuxSetStream(u32 handle, u32 streamAddress, u32 streamSize, bool discontinuity, u64 userData) +s32 cellDmuxSetStream(u32 handle, u32 streamAddress, u32 streamSize, b8 discontinuity, u64 userData) { cellDmux.Log("cellDmuxSetStream(handle=0x%x, streamAddress=0x%x, streamSize=%d, discontinuity=%d, userData=0x%llx)", handle, streamAddress, streamSize, discontinuity, userData); diff --git a/rpcs3/Emu/SysCalls/Modules/cellDmux.h b/rpcs3/Emu/SysCalls/Modules/cellDmux.h index ea7d3cc83b..efebcdd4c1 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellDmux.h +++ b/rpcs3/Emu/SysCalls/Modules/cellDmux.h @@ -165,7 +165,7 @@ struct CellDmuxType struct CellDmuxPamfSpecificInfo { be_t thisSize; - bool programEndCodeCb; + b8 programEndCodeCb; }; struct CellDmuxType2 @@ -198,20 +198,20 @@ struct CellDmuxResourceEx /* struct CellDmuxResource2Ex { - bool isResourceEx; //true + b8 isResourceEx; //true CellDmuxResourceEx resourceEx; }; struct CellDmuxResource2NoEx { - bool isResourceEx; //false + b8 isResourceEx; //false CellDmuxResource resource; }; */ struct CellDmuxResource2 { - bool isResourceEx; + b8 isResourceEx; be_t memAddr; be_t memSize; be_t ppuThreadPriority; @@ -219,7 +219,7 @@ struct CellDmuxResource2 be_t shit[4]; }; -using CellDmuxCbMsg = func_def demuxerMsg, u32 cbArg)>; +using CellDmuxCbMsg = u32(u32 demuxerHandle, vm::ptr demuxerMsg, u32 cbArg); struct CellDmuxCb { @@ -227,7 +227,7 @@ struct CellDmuxCb be_t cbArg; }; -using CellDmuxCbEsMsg = func_def esMsg, u32 cbArg)>; +using CellDmuxCbEsMsg = u32(u32 demuxerHandle, u32 esHandle, vm::ptr esMsg, u32 cbArg); struct CellDmuxEsCb { @@ -270,7 +270,7 @@ struct CellDmuxAuInfoEx be_t auAddr; be_t auSize; be_t reserved; - bool isRap; + b8 isRap; be_t userData; CellCodecTimeStamp pts; CellCodecTimeStamp dts; diff --git a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp index 2330feaab3..7433d187fc 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp @@ -8,19 +8,23 @@ extern Module cellFont; -std::unique_ptr g_font; +struct font_instance_t +{ + std::atomic init{ false }; +} +g_font; // Functions s32 cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr config) { cellFont.Warning("cellFontInitializeWithRevision(revisionFlags=0x%llx, config=*0x%x)", revisionFlags, config); - - if (g_font->m_bInitialized) + + if (g_font.init.load()) { return CELL_FONT_ERROR_ALREADY_INITIALIZED; } - - if (config->FileCache.size < 24) + + if (config->fc_size < 24) { return CELL_FONT_ERROR_INVALID_PARAMETER; } @@ -30,11 +34,11 @@ s32 cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr co cellFont.Error("cellFontInitializeWithRevision: Unknown flags (0x%x)", config->flags); } - g_font->m_buffer_addr = config->FileCache.buffer_addr; - g_font->m_buffer_size = config->FileCache.size; - g_font->m_userFontEntrys_addr = config->userFontEntrys_addr; - g_font->m_userFontEntryMax = config->userFontEntryMax; - g_font->m_bInitialized = true; + if (g_font.init.exchange(true)) + { + throw EXCEPTION("Unexpected"); + } + return CELL_OK; } @@ -44,11 +48,11 @@ s32 cellFontGetRevisionFlags(vm::ptr revisionFlags) return CELL_OK; } -s32 cellFontInit(PPUThread& CPU, vm::ptr config) +s32 cellFontInit(PPUThread& ppu, vm::ptr config) { cellFont.Warning("cellFontInit(config=*0x%x)", config); - vm::stackvar> revisionFlags(CPU); + vm::stackvar> revisionFlags(ppu); revisionFlags.value() = 0; cellFontGetRevisionFlags(revisionFlags); @@ -59,12 +63,15 @@ s32 cellFontEnd() { cellFont.Warning("cellFontEnd()"); - if (!g_font->m_bInitialized) + if (!g_font.init.load()) { return CELL_FONT_ERROR_UNINITIALIZED; } - g_font->m_bInitialized = false; + if (!g_font.init.exchange(false)) + { + throw EXCEPTION("Unexpected"); + } return CELL_OK; } @@ -79,7 +86,7 @@ s32 cellFontOpenFontMemory(vm::ptr library, u32 fontAddr, u32 f { cellFont.Warning("cellFontOpenFontMemory(library=*0x%x, fontAddr=0x%x, fontSize=%d, subNum=%d, uniqueId=%d, font=*0x%x)", library, fontAddr, fontSize, subNum, uniqueId, font); - if (!g_font->m_bInitialized) + if (!g_font.init.load()) { return CELL_FONT_ERROR_UNINITIALIZED; } @@ -115,11 +122,11 @@ s32 cellFontOpenFontFile(vm::ptr library, vm::cptr fontPa return ret; } -s32 cellFontOpenFontset(PPUThread& CPU, vm::ptr library, vm::ptr fontType, vm::ptr font) +s32 cellFontOpenFontset(PPUThread& ppu, vm::ptr library, vm::ptr fontType, vm::ptr font) { cellFont.Warning("cellFontOpenFontset(library=*0x%x, fontType=*0x%x, font=*0x%x)", library, fontType, font); - if (!g_font->m_bInitialized) + if (!g_font.init.load()) { return CELL_FONT_ERROR_UNINITIALIZED; } @@ -195,7 +202,7 @@ s32 cellFontOpenFontset(PPUThread& CPU, vm::ptr library, vm::pt return CELL_FONT_ERROR_NO_SUPPORT_FONTSET; } - vm::stackvar f(CPU, (u32)file.length() + 1, 1); + vm::stackvar f(ppu, (u32)file.length() + 1, 1); memcpy(f.get_ptr(), file.c_str(), file.size() + 1); s32 ret = cellFontOpenFontFile(library, f, 0, 0, font); //TODO: Find the correct values of subNum, uniqueId font->origin = CELL_FONT_OPEN_FONTSET; @@ -227,7 +234,7 @@ s32 cellFontCreateRenderer(vm::ptr library, vm::ptrm_bInitialized) + if (!g_font.init.load()) { return CELL_FONT_ERROR_UNINITIALIZED; } @@ -241,26 +248,21 @@ void cellFontRenderSurfaceInit(vm::ptr surface, vm::ptrbuffer_addr = buffer.addr(); - surface->widthByte = bufferWidthByte; - surface->pixelSizeByte = pixelSizeByte; - surface->width = w; - surface->height = h; - - if (!buffer) - { - surface->buffer_addr = vm::alloc(bufferWidthByte * h, vm::main); // TODO: Huge memory leak - } + surface->buffer = buffer; + surface->widthByte = bufferWidthByte; + surface->pixelSizeByte = pixelSizeByte; + surface->width = w; + surface->height = h; } void cellFontRenderSurfaceSetScissor(vm::ptr surface, s32 x0, s32 y0, s32 w, s32 h) { cellFont.Warning("cellFontRenderSurfaceSetScissor(surface=*0x%x, x0=%d, y0=%d, w=%d, h=%d)", surface, x0, y0, w, h); - surface->Scissor.x0 = x0; - surface->Scissor.y0 = y0; - surface->Scissor.x1 = w; - surface->Scissor.y1 = h; + surface->sc_x0 = x0; + surface->sc_y0 = y0; + surface->sc_x1 = w; + surface->sc_y1 = h; } s32 cellFontSetScalePixel(vm::ptr font, float w, float h) @@ -374,7 +376,7 @@ s32 cellFontRenderCharGlyphImage(vm::ptr font, u32 code, vm::ptr(surface->buffer_addr); + unsigned char* buffer = vm::get_ptr(surface->buffer.addr()); for (u32 ypos = 0; ypos < (u32)height; ypos++) { if ((u32)y + ypos + yoff + baseLineY >= surface->height) @@ -457,12 +459,12 @@ s32 cellFontGetCharGlyphMetrics(vm::ptr font, u32 code, vm::ptrwidth = (x1-x0) * scale; metrics->height = (y1-y0) * scale; - metrics->Horizontal.bearingX = (float)leftSideBearing * scale; - metrics->Horizontal.bearingY = 0.f; - metrics->Horizontal.advance = (float)advanceWidth * scale; - metrics->Vertical.bearingX = 0.f; - metrics->Vertical.bearingY = 0.f; - metrics->Vertical.advance = 0.f; + metrics->h_bearingX = (float)leftSideBearing * scale; + metrics->h_bearingY = 0.f; + metrics->h_advance = (float)advanceWidth * scale; + metrics->v_bearingX = 0.f; + metrics->v_bearingY = 0.f; + metrics->v_advance = 0.f; return CELL_OK; } @@ -473,11 +475,11 @@ s32 cellFontGraphicsSetFontRGBA() return CELL_OK; } -s32 cellFontOpenFontsetOnMemory(PPUThread& CPU, vm::ptr library, vm::ptr fontType, vm::ptr font) +s32 cellFontOpenFontsetOnMemory(PPUThread& ppu, vm::ptr library, vm::ptr fontType, vm::ptr font) { cellFont.Todo("cellFontOpenFontsetOnMemory(library=*0x%x, fontType=*0x%x, font=*0x%x)", library, fontType, font); - if (!g_font->m_bInitialized) + if (!g_font.init.load()) { return CELL_FONT_ERROR_UNINITIALIZED; } @@ -632,7 +634,7 @@ s32 cellFontGetCharGlyphMetricsVertical() Module cellFont("cellFont", []() { - g_font = std::make_unique(); + g_font.init = false; REG_FUNC(cellFont, cellFontInit); REG_FUNC(cellFont, cellFontSetFontsetOpenMode); diff --git a/rpcs3/Emu/SysCalls/Modules/cellFont.h b/rpcs3/Emu/SysCalls/Modules/cellFont.h index 8cfc8430e8..0b1d3274a0 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFont.h +++ b/rpcs3/Emu/SysCalls/Modules/cellFont.h @@ -32,21 +32,6 @@ enum CELL_FONT_ERROR_NO_SUPPORT_SURFACE = 0x80540040, }; -struct CellFontLibrary -{ - u32 libraryType, libraryVersion; - //u32 SystemClosed[]; -}; - -struct CellFontMemoryInterface -{ - u32 Object_addr; //void* - //CellFontMallocCallback Malloc; - //CellFontFreeCallback Free; - //CellFontReallocCallback Realloc; - //CellFontCallocCallback Calloc; -}; - // Font Set Types enum { @@ -115,24 +100,6 @@ enum CELL_FONT_MAP_UNICODE = 1, }; -struct CellFontConfig -{ - struct - { - be_t buffer_addr; - be_t size; - } FileCache; - - be_t userFontEntryMax; - be_t userFontEntrys_addr; - be_t flags; -}; - -struct CellFontRenderer -{ - void *systemReserved[64]; -}; - //Custom enum to determine the origin of a CellFont object enum { @@ -142,20 +109,46 @@ enum CELL_FONT_OPEN_MEMORY, }; -struct stbtt_fontinfo; -struct CellFont +using CellFontMallocCallback = vm::ptr(vm::ptr arg, u32 size); +using CellFontFreeCallback = void(vm::ptr arg, vm::ptr ptr); +using CellFontReallocCallback = vm::ptr(vm::ptr arg, vm::ptr p, u32 reallocSize); +using CellFontCallocCallback = vm::ptr(vm::ptr arg, u32 num, u32 size); + +struct CellFontMemoryInterface { - //void* SystemReserved[64]; - be_t scale_x; - be_t scale_y; - be_t slant; - be_t renderer_addr; + vm::bptr arg; + vm::bptr malloc; + vm::bptr free; + vm::bptr realloc; + vm::bptr calloc; +}; - be_t fontdata_addr; - be_t origin; - stbtt_fontinfo* stbfont; - // hack: don't place anything after pointer +struct CellFontEntry +{ + be_t lock; + be_t uniqueId; + vm::bcptr fontLib; + vm::bptr fontH; +}; + +struct CellFontConfig +{ + // FileCache + vm::bptr fc_buffer; + be_t fc_size; + + be_t userFontEntryMax; + vm::bptr userFontEntrys; + + be_t flags; +}; + +struct CellFontLibrary +{ + be_t libraryType; + be_t libraryVersion; + // ... }; struct CellFontType @@ -164,119 +157,89 @@ struct CellFontType be_t map; }; -struct CellFontInitGraphicsConfigGcm -{ - be_t configType; - - struct - { - be_t address; - be_t size; - } GraphicsMemory; - - struct - { - be_t address; - be_t size; - } MappedMainMemory; - - struct - { - be_t slotNumber; - be_t slotCount; - } VertexShader; -}; - -struct CellFontGraphics -{ - u32 graphicsType; - u32 SystemClosed_addr; -}; - struct CellFontHorizontalLayout { - be_t baseLineY; - be_t lineHeight; - be_t effectHeight; + be_t baseLineY; + be_t lineHeight; + be_t effectHeight; }; struct CellFontVerticalLayout { - be_t baseLineX; - be_t lineWidth; - be_t effectWidth; + be_t baseLineX; + be_t lineWidth; + be_t effectWidth; }; struct CellFontGlyphMetrics { - be_t width; - be_t height; + be_t width; + be_t height; - struct - { - be_t bearingX; - be_t bearingY; - be_t advance; - } Horizontal; + be_t h_bearingX; + be_t h_bearingY; + be_t h_advance; - struct - { - be_t bearingX; - be_t bearingY; - be_t advance; - } Vertical; -}; - -struct CellFontImageTransInfo -{ - be_t Image_addr; - be_t imageWidthByte; - be_t imageWidth; - be_t imageHeight; - be_t Surface_addr; - be_t surfWidthByte; -}; - -struct CellFontRendererConfig -{ - struct BufferingPolicy - { - be_t buffer; - be_t initSize; - be_t maxSize; - be_t expandSize; - be_t resetSize; - }; + be_t v_bearingX; + be_t v_bearingY; + be_t v_advance; }; struct CellFontRenderSurface { - be_t buffer_addr; - be_t widthByte; - be_t pixelSizeByte; - be_t width, height; + vm::bptr buffer; + be_t widthByte; + be_t pixelSizeByte; + be_t width; + be_t height; - struct - { - be_t x0, y0; - be_t x1, y1; - } Scissor; + // Scissor + be_t sc_x0; + be_t sc_y0; + be_t sc_x1; + be_t sc_y1; }; -// Internal Datatypes -struct CellFontInternal //Module cellFont +struct CellFontImageTransInfo { - u32 m_buffer_addr, m_buffer_size; - u32 m_userFontEntrys_addr, m_userFontEntryMax; + vm::bptr image; + be_t imageWidthByte; + be_t imageWidth; + be_t imageHeight; + vm::bptr surface; + be_t surfWidthByte; +}; - bool m_bInitialized; - bool m_bFontGcmInitialized; +struct CellFont +{ + be_t scale_x; + be_t scale_y; + be_t slant; + be_t renderer_addr; - CellFontInternal() - : m_buffer_addr(0) - , m_buffer_size(0) - , m_bInitialized(false) - , m_bFontGcmInitialized(false) - { - } -}; \ No newline at end of file + be_t fontdata_addr; + be_t origin; + struct stbtt_fontinfo* stbfont; + // hack: don't place anything after pointer +}; + +struct CellFontRendererConfig +{ + // Buffering Policy + vm::bptr buffer; + be_t initSize; + be_t maxSize; + be_t expandSize; + be_t resetSize; +}; + +struct CellFontRenderer +{ + void *systemReserved[64]; +}; + +struct CellFontGraphics +{ + be_t graphicsType; + // ... +}; diff --git a/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp b/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp index 376eb611d6..e5b5048999 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp @@ -2,20 +2,14 @@ #include "Emu/Memory/Memory.h" #include "Emu/SysCalls/Modules.h" -#include "cellFont.h" #include "cellFontFT.h" extern Module cellFontFT; -CCellFontFTInternal* s_fontFtInternalInstance = nullptr; - s32 cellFontInitLibraryFreeTypeWithRevision(u64 revisionFlags, vm::ptr config, vm::pptr lib) { cellFontFT.Warning("cellFontInitLibraryFreeTypeWithRevision(revisionFlags=0x%llx, config=*0x%x, lib=**0x%x)", revisionFlags, config, lib); - //if (s_fontInternalInstance->m_bInitialized) - //return CELL_FONT_ERROR_UNINITIALIZED; - lib->set(vm::alloc(sizeof(CellFontLibrary), vm::main)); return CELL_OK; @@ -35,13 +29,6 @@ s32 cellFontFTGetInitializedRevisionFlags() Module cellFontFT("cellFontFT", []() { - s_fontFtInternalInstance = new CCellFontFTInternal(); - - cellFontFT.on_stop = []() - { - delete s_fontFtInternalInstance; - }; - REG_FUNC(cellFontFT, cellFontInitLibraryFreeTypeWithRevision); REG_FUNC(cellFontFT, cellFontFTGetRevisionFlags); REG_FUNC(cellFontFT, cellFontFTGetInitializedRevisionFlags); diff --git a/rpcs3/Emu/SysCalls/Modules/cellFontFT.h b/rpcs3/Emu/SysCalls/Modules/cellFontFT.h index 541f5f287d..37f8204062 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFontFT.h +++ b/rpcs3/Emu/SysCalls/Modules/cellFontFT.h @@ -1,30 +1,13 @@ #pragma once +#include "cellFont.h" + namespace vm { using namespace ps3; } struct CellFontLibraryConfigFT { - u32 library_addr; //void* + vm::bptr library; CellFontMemoryInterface MemoryIF; }; -struct CellFontRendererConfigFT -{ - struct { - u32 buffer_addr; //void* - u32 initSize; - u32 maxSize; - u32 expandSize; - u32 resetSize; - } BufferingPolicy; -}; - -struct CCellFontFTInternal -{ - bool m_bInitialized; - - CCellFontFTInternal() - : m_bInitialized(false) - { - } -}; \ No newline at end of file +using CellFontRendererConfigFT = CellFontRendererConfig; diff --git a/rpcs3/Emu/SysCalls/Modules/cellFs.cpp b/rpcs3/Emu/SysCalls/Modules/cellFs.cpp index 5fe9eeaf1a..478c7c80c6 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFs.cpp @@ -14,6 +14,8 @@ extern Module cellFs; +extern u32 _fd_to_id(u32 fd); + s32 cellFsOpen(vm::cptr path, s32 flags, vm::ptr fd, vm::cptr arg, u64 size) { cellFs.Warning("cellFsOpen(path=*0x%x, flags=%#o, fd=*0x%x, arg=*0x%x, size=0x%llx) -> sys_fs_open()", path, flags, fd, arg, size); @@ -207,9 +209,9 @@ s32 cellFsGetFreeSize(vm::cptr path, vm::ptr block_size, vm::ptr s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr entries, u32 entries_size, vm::ptr data_count) { - cellFs.Warning("cellFsGetDirectoryEntries(fd=0x%x, entries=*0x%x, entries_size=0x%x, data_count=*0x%x)", fd, entries, entries_size, data_count); + cellFs.Warning("cellFsGetDirectoryEntries(fd=%d, entries=*0x%x, entries_size=0x%x, data_count=*0x%x)", fd, entries, entries_size, data_count); - const auto directory = Emu.GetIdManager().get(fd); + const auto directory = Emu.GetIdManager().get(_fd_to_id(fd)); if (!directory) { @@ -250,11 +252,11 @@ s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr entries, u32 s32 cellFsReadWithOffset(u32 fd, u64 offset, vm::ptr buf, u64 buffer_size, vm::ptr nread) { - cellFs.Log("cellFsReadWithOffset(fd=0x%x, offset=0x%llx, buf=*0x%x, buffer_size=0x%llx, nread=*0x%x)", fd, offset, buf, buffer_size, nread); + cellFs.Log("cellFsReadWithOffset(fd=%d, offset=0x%llx, buf=*0x%x, buffer_size=0x%llx, nread=*0x%x)", fd, offset, buf, buffer_size, nread); // TODO: use single sys_fs_fcntl syscall - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file || file->flags & CELL_FS_O_WRONLY) { @@ -281,11 +283,11 @@ s32 cellFsReadWithOffset(u32 fd, u64 offset, vm::ptr buf, u64 buffer_size, s32 cellFsWriteWithOffset(u32 fd, u64 offset, vm::cptr buf, u64 data_size, vm::ptr nwrite) { - cellFs.Log("cellFsWriteWithOffset(fd=0x%x, offset=0x%llx, buf=*0x%x, data_size=0x%llx, nwrite=*0x%x)", fd, offset, buf, data_size, nwrite); + cellFs.Log("cellFsWriteWithOffset(fd=%d, offset=0x%llx, buf=*0x%x, data_size=0x%llx, nwrite=*0x%x)", fd, offset, buf, data_size, nwrite); // TODO: use single sys_fs_fcntl syscall - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file || !(file->flags & CELL_FS_O_ACCMODE)) { @@ -312,7 +314,7 @@ s32 cellFsWriteWithOffset(u32 fd, u64 offset, vm::cptr buf, u64 data_size, s32 cellFsStReadInit(u32 fd, vm::cptr ringbuf) { - cellFs.Warning("cellFsStReadInit(fd=0x%x, ringbuf=*0x%x)", fd, ringbuf); + cellFs.Warning("cellFsStReadInit(fd=%d, ringbuf=*0x%x)", fd, ringbuf); if (ringbuf->copy & ~CELL_FS_ST_COPYLESS) { @@ -329,7 +331,7 @@ s32 cellFsStReadInit(u32 fd, vm::cptr ringbuf) return CELL_FS_EINVAL; } - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -365,9 +367,9 @@ s32 cellFsStReadInit(u32 fd, vm::cptr ringbuf) s32 cellFsStReadFinish(u32 fd) { - cellFs.Warning("cellFsStReadFinish(fd=0x%x)", fd); + cellFs.Warning("cellFsStReadFinish(fd=%d)", fd); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -388,9 +390,9 @@ s32 cellFsStReadFinish(u32 fd) s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr ringbuf) { - cellFs.Warning("cellFsStReadGetRingBuf(fd=0x%x, ringbuf=*0x%x)", fd, ringbuf); + cellFs.Warning("cellFsStReadGetRingBuf(fd=%d, ringbuf=*0x%x)", fd, ringbuf); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -412,9 +414,9 @@ s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr ringbuf) s32 cellFsStReadGetStatus(u32 fd, vm::ptr status) { - cellFs.Warning("cellFsStReadGetRingBuf(fd=0x%x, status=*0x%x)", fd, status); + cellFs.Warning("cellFsStReadGetRingBuf(fd=%d, status=*0x%x)", fd, status); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -446,9 +448,9 @@ s32 cellFsStReadGetStatus(u32 fd, vm::ptr status) s32 cellFsStReadGetRegid(u32 fd, vm::ptr regid) { - cellFs.Warning("cellFsStReadGetRingBuf(fd=0x%x, regid=*0x%x)", fd, regid); + cellFs.Warning("cellFsStReadGetRingBuf(fd=%d, regid=*0x%x)", fd, regid); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -467,9 +469,9 @@ s32 cellFsStReadGetRegid(u32 fd, vm::ptr regid) s32 cellFsStReadStart(u32 fd, u64 offset, u64 size) { - cellFs.Warning("cellFsStReadStart(fd=0x%x, offset=0x%llx, size=0x%llx)", fd, offset, size); + cellFs.Warning("cellFsStReadStart(fd=%d, offset=0x%llx, size=0x%llx)", fd, offset, size); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -548,9 +550,9 @@ s32 cellFsStReadStart(u32 fd, u64 offset, u64 size) s32 cellFsStReadStop(u32 fd) { - cellFs.Warning("cellFsStReadStop(fd=0x%x)", fd); + cellFs.Warning("cellFsStReadStop(fd=%d)", fd); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -579,9 +581,9 @@ s32 cellFsStReadStop(u32 fd) s32 cellFsStRead(u32 fd, vm::ptr buf, u64 size, vm::ptr rsize) { - cellFs.Warning("cellFsStRead(fd=0x%x, buf=*0x%x, size=0x%llx, rsize=*0x%x)", fd, buf, size, rsize); + cellFs.Warning("cellFsStRead(fd=%d, buf=*0x%x, size=0x%llx, rsize=*0x%x)", fd, buf, size, rsize); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -613,9 +615,9 @@ s32 cellFsStRead(u32 fd, vm::ptr buf, u64 size, vm::ptr rsize) s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr addr, vm::ptr size) { - cellFs.Warning("cellFsStReadGetCurrentAddr(fd=0x%x, addr=*0x%x, size=*0x%x)", fd, addr, size); + cellFs.Warning("cellFsStReadGetCurrentAddr(fd=%d, addr=*0x%x, size=*0x%x)", fd, addr, size); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -646,9 +648,9 @@ s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr addr, vm::ptr size) s32 cellFsStReadPutCurrentAddr(u32 fd, vm::ptr addr, u64 size) { - cellFs.Warning("cellFsStReadPutCurrentAddr(fd=0x%x, addr=*0x%x, size=0x%llx)", fd, addr, size); + cellFs.Warning("cellFsStReadPutCurrentAddr(fd=%d, addr=*0x%x, size=0x%llx)", fd, addr, size); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -673,9 +675,9 @@ s32 cellFsStReadPutCurrentAddr(u32 fd, vm::ptr addr, u64 size) s32 cellFsStReadWait(u32 fd, u64 size) { - cellFs.Warning("cellFsStReadWait(fd=0x%x, size=0x%llx)", fd, size); + cellFs.Warning("cellFsStReadWait(fd=%d, size=0x%llx)", fd, size); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -702,9 +704,9 @@ s32 cellFsStReadWait(u32 fd, u64 size) s32 cellFsStReadWaitCallback(u32 fd, u64 size, fs_st_cb_t func) { - cellFs.Warning("cellFsStReadWaitCallback(fd=0x%x, size=0x%llx, func=*0x%x)", fd, size, func); + cellFs.Warning("cellFsStReadWaitCallback(fd=%d, size=0x%llx, func=*0x%x)", fd, size, func); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -867,12 +869,12 @@ using fs_aio_cb_t = vm::ptr xaio, s32 error, s32 xid, u6 void fsAio(vm::ptr aio, bool write, s32 xid, fs_aio_cb_t func) { - cellFs.Notice("FS AIO Request(%d): fd=0x%x, offset=0x%llx, buf=*0x%x, size=0x%llx, user_data=0x%llx", xid, aio->fd, aio->offset, aio->buf, aio->size, aio->user_data); + cellFs.Notice("FS AIO Request(%d): fd=%d, offset=0x%llx, buf=*0x%x, size=0x%llx, user_data=0x%llx", xid, aio->fd, aio->offset, aio->buf, aio->size, aio->user_data); s32 error = CELL_OK; u64 result = 0; - const auto file = Emu.GetIdManager().get(aio->fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(aio->fd)); if (!file || (!write && file->flags & CELL_FS_O_WRONLY) || (write && !(file->flags & CELL_FS_O_ACCMODE))) { @@ -964,9 +966,9 @@ s32 cellFsSetDefaultContainer(u32 id, u32 total_limit) s32 cellFsSetIoBufferFromDefaultContainer(u32 fd, u32 buffer_size, u32 page_type) { - cellFs.Todo("cellFsSetIoBufferFromDefaultContainer(fd=0x%x, buffer_size=%d, page_type=%d)", fd, buffer_size, page_type); + cellFs.Todo("cellFsSetIoBufferFromDefaultContainer(fd=%d, buffer_size=%d, page_type=%d)", fd, buffer_size, page_type); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { diff --git a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp index 70aa44ec38..bc61b88bd6 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp @@ -89,6 +89,43 @@ s32 cellHddGameCheck(PPUThread& CPU, u32 version, vm::cptr dirName, u32 er return CELL_OK; } +s32 cellHddGameCheck2() +{ + throw EXCEPTION(""); +} + +s32 cellHddGameGetSizeKB() +{ + throw EXCEPTION(""); +} + +s32 cellHddGameSetSystemVer() +{ + throw EXCEPTION(""); +} + +s32 cellHddGameExitBroken() +{ + throw EXCEPTION(""); +} + + +s32 cellGameDataGetSizeKB() +{ + throw EXCEPTION(""); +} + +s32 cellGameDataSetSystemVer() +{ + throw EXCEPTION(""); +} + +s32 cellGameDataExitBroken() +{ + throw EXCEPTION(""); +} + + s32 cellGameBootCheck(vm::ptr type, vm::ptr attributes, vm::ptr size, vm::ptr dirName) { cellGame.Warning("cellGameBootCheck(type=*0x%x, attributes=*0x%x, size=*0x%x, dirName=*0x%x)", type, attributes, size, dirName); @@ -575,14 +612,63 @@ s32 cellGameThemeInstallFromBuffer() return CELL_OK; } + +s32 cellDiscGameGetBootDiscInfo() +{ + throw EXCEPTION(""); +} + +s32 cellDiscGameRegisterDiscChangeCallback() +{ + throw EXCEPTION(""); +} + +s32 cellDiscGameUnregisterDiscChangeCallback() +{ + throw EXCEPTION(""); +} + +s32 cellGameRegisterDiscChangeCallback() +{ + throw EXCEPTION(""); +} + +s32 cellGameUnregisterDiscChangeCallback() +{ + throw EXCEPTION(""); +} + + +void cellSysutil_GameData_init() +{ + extern Module cellSysutil; + + REG_FUNC(cellSysutil, cellHddGameCheck); + REG_FUNC(cellSysutil, cellHddGameCheck2); + REG_FUNC(cellSysutil, cellHddGameGetSizeKB); + REG_FUNC(cellSysutil, cellHddGameSetSystemVer); + REG_FUNC(cellSysutil, cellHddGameExitBroken); + + REG_FUNC(cellSysutil, cellGameDataGetSizeKB); + REG_FUNC(cellSysutil, cellGameDataSetSystemVer); + REG_FUNC(cellSysutil, cellGameDataExitBroken); + + REG_FUNC(cellSysutil, cellGameDataCheckCreate); + REG_FUNC(cellSysutil, cellGameDataCheckCreate2); + + REG_FUNC(cellSysutil, cellDiscGameGetBootDiscInfo); + REG_FUNC(cellSysutil, cellDiscGameRegisterDiscChangeCallback); + REG_FUNC(cellSysutil, cellDiscGameUnregisterDiscChangeCallback); + REG_FUNC(cellSysutil, cellGameRegisterDiscChangeCallback); + REG_FUNC(cellSysutil, cellGameUnregisterDiscChangeCallback); +} + Module cellGame("cellGame", []() { contentInfo = ""; usrdir = ""; path_set = false; - // (TODO: Disc Exchange functions missing) - REG_FUNC(cellGame, cellGameBootCheck); REG_FUNC(cellGame, cellGamePatchCheck); REG_FUNC(cellGame, cellGameDataCheck); @@ -592,7 +678,6 @@ Module cellGame("cellGame", []() REG_FUNC(cellGame, cellGameDeleteGameData); REG_FUNC(cellGame, cellGameGetParamInt); - //cellGame.AddFunc(, cellGameSetParamInt); REG_FUNC(cellGame, cellGameGetParamString); REG_FUNC(cellGame, cellGameSetParamString); REG_FUNC(cellGame, cellGameGetSizeKB); @@ -603,17 +688,4 @@ Module cellGame("cellGame", []() REG_FUNC(cellGame, cellGameThemeInstall); REG_FUNC(cellGame, cellGameThemeInstallFromBuffer); - //cellGame.AddFunc(, CellGameThemeInstallCallback); }); - -void cellSysutil_GameData_init() -{ - REG_FUNC(cellGame, cellHddGameCheck); - //REG_FUNC(cellGame, cellHddGameCheck2); - //REG_FUNC(cellGame, cellHddGameGetSizeKB); - //REG_FUNC(cellGame, cellHddGameSetSystemVer); - //REG_FUNC(cellGame, cellHddGameExitBroken); - - REG_FUNC(cellGame, cellGameDataCheckCreate); - REG_FUNC(cellGame, cellGameDataCheckCreate2); -} diff --git a/rpcs3/Emu/SysCalls/Modules/cellGameExec.cpp b/rpcs3/Emu/SysCalls/Modules/cellGameExec.cpp new file mode 100644 index 0000000000..0ccbb7174a --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellGameExec.cpp @@ -0,0 +1,46 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellGameExec; + +s32 cellGameSetExitParam() +{ + throw EXCEPTION(""); +} + +s32 cellGameGetHomeDataExportPath() +{ + throw EXCEPTION(""); +} + +s32 cellGameGetHomePath() +{ + throw EXCEPTION(""); +} + +s32 cellGameGetHomeDataImportPath() +{ + throw EXCEPTION(""); +} + +s32 cellGameGetHomeLaunchOptionPath() +{ + throw EXCEPTION(""); +} + +s32 cellGameGetBootGameInfo() +{ + throw EXCEPTION(""); +} + + +Module cellGameExec("cellGameExec", []() +{ + REG_FUNC(cellGameExec, cellGameSetExitParam); + REG_FUNC(cellGameExec, cellGameGetHomeDataExportPath); + REG_FUNC(cellGameExec, cellGameGetHomePath); + REG_FUNC(cellGameExec, cellGameGetHomeDataImportPath); + REG_FUNC(cellGameExec, cellGameGetHomeLaunchOptionPath); + REG_FUNC(cellGameExec, cellGameGetBootGameInfo); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp index 3c3d292c91..e4b4cf1ffc 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp @@ -320,9 +320,9 @@ void _cellGcmFunc15(vm::ptr context) u32 g_defaultCommandBufferBegin, g_defaultCommandBufferFragmentCount; // Called by cellGcmInit -s32 _cellGcmInitBody(vm::ptr context, u32 cmdSize, u32 ioSize, u32 ioAddress) +s32 _cellGcmInitBody(vm::pptr context, u32 cmdSize, u32 ioSize, u32 ioAddress) { - cellGcmSys.Warning("_cellGcmInitBody(context=*0x%x, cmdSize=0x%x, ioSize=0x%x, ioAddress=0x%x)", context, cmdSize, ioSize, ioAddress); + cellGcmSys.Warning("_cellGcmInitBody(context=**0x%x, cmdSize=0x%x, ioSize=0x%x, ioAddress=0x%x)", context, cmdSize, ioSize, ioAddress); if(!local_size && !local_addr) { @@ -365,8 +365,8 @@ s32 _cellGcmInitBody(vm::ptr context, u32 cmdSize, u32 ioSiz g_defaultCommandBufferBegin = ioAddress; g_defaultCommandBufferFragmentCount = cmdSize / (32 * 1024); - current_context.begin = g_defaultCommandBufferBegin + 4096; // 4 kb reserved at the beginning - current_context.end = g_defaultCommandBufferBegin + 32 * 1024 - 4; // 4b at the end for jump + current_context.begin.set(g_defaultCommandBufferBegin + 4096); // 4 kb reserved at the beginning + current_context.end.set(g_defaultCommandBufferBegin + 32 * 1024 - 4); // 4b at the end for jump current_context.current = current_context.begin; current_context.callback.set(Emu.GetRSXCallback() - 4); @@ -376,7 +376,7 @@ s32 _cellGcmInitBody(vm::ptr context, u32 cmdSize, u32 ioSiz gcm_info.label_addr = vm::alloc(0x1000, vm::main); // ??? vm::get_ref(gcm_info.context_addr) = current_context; - vm::write32(context.addr(), gcm_info.context_addr); + context->set(gcm_info.context_addr); auto& ctrl = vm::get_ref(gcm_info.control_addr); ctrl.put.store(0); @@ -480,59 +480,46 @@ void cellGcmSetFlipStatus() Emu.GetGSManager().GetRender().m_flip_status = 0; } -s32 cellGcmSetPrepareFlip(PPUThread& CPU, vm::ptr ctxt, u32 id) +s32 cellGcmSetPrepareFlip(PPUThread& ppu, vm::ptr 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, id); - if(id > 7) + if (id > 7) { cellGcmSys.Error("cellGcmSetPrepareFlip : CELL_GCM_ERROR_FAILURE"); return CELL_GCM_ERROR_FAILURE; } - GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH); - - u32 current = ctxt->current; - - if (current + 8 == ctxt->begin) + if (ctxt->current + 2 >= ctxt->end) { - cellGcmSys.Error("cellGcmSetPrepareFlip : queue is full"); - return CELL_GCM_ERROR_FAILURE; - } - - if (current + 8 >= ctxt->end) - { - cellGcmSys.Error("Bad flip!"); - if (s32 res = ctxt->callback(CPU, ctxt, 8 /* ??? */)) + if (s32 res = ctxt->callback(ppu, ctxt, 8 /* ??? */)) { cellGcmSys.Error("cellGcmSetPrepareFlip : callback failed (0x%08x)", res); return res; } } - current = ctxt->current; - vm::write32(current, 0x3fead | (1 << 18)); - vm::write32(current + 4, id); - ctxt->current += 8; + *ctxt->current++ = 0x3fead | (1 << 18); + *ctxt->current++ = id; - if(ctxt.addr() == gcm_info.context_addr) + if (ctxt.addr() == gcm_info.context_addr) { - auto& ctrl = vm::get_ref(gcm_info.control_addr); - ctrl.put.atomic_op([](be_t& value) - { - value += 8; - }); + vm::get_ref(gcm_info.control_addr).put += 8; } return id; } -s32 cellGcmSetFlip(PPUThread& CPU, vm::ptr ctxt, u32 id) +s32 cellGcmSetFlip(PPUThread& ppu, vm::ptr ctxt, u32 id) { - cellGcmSys.Log("cellGcmSetFlip(ctx=0x%x, id=0x%x)", ctxt.addr(), id); + cellGcmSys.Log("cellGcmSetFlip(ctxt=*0x%x, id=0x%x)", ctxt, id); - s32 res = cellGcmSetPrepareFlip(CPU, ctxt, id); - return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK; + if (s32 res = cellGcmSetPrepareFlip(ppu, ctxt, id)) + { + if (res < 0) return CELL_GCM_ERROR_FAILURE; + } + + return CELL_OK; } s32 cellGcmSetSecondVFrequency(u32 freq) @@ -610,9 +597,10 @@ void cellGcmSetVBlankHandler(vm::ptr handler) s32 cellGcmSetWaitFlip(vm::ptr ctxt) { - cellGcmSys.Log("cellGcmSetWaitFlip(ctx=*0x%x)", ctxt); + cellGcmSys.Warning("cellGcmSetWaitFlip(ctx=*0x%x)", ctxt); + + // TODO: emit RSX command for "wait flip" operation - GSLockCurrent lock(GS_LOCK_WAIT_FLIP); return CELL_OK; } @@ -1101,18 +1089,18 @@ void cellGcmSetDefaultCommandBuffer() // Other //------------------------------------------------------------------------ -s32 _cellGcmSetFlipCommand(PPUThread& CPU, vm::ptr ctx, u32 id) +s32 _cellGcmSetFlipCommand(PPUThread& ppu, vm::ptr ctx, u32 id) { cellGcmSys.Log("cellGcmSetFlipCommand(ctx=*0x%x, id=0x%x)", ctx, id); - return cellGcmSetPrepareFlip(CPU, ctx, id); + return cellGcmSetPrepareFlip(ppu, ctx, id); } -s32 _cellGcmSetFlipCommandWithWaitLabel(PPUThread& CPU, vm::ptr ctx, u32 id, u32 label_index, u32 label_value) +s32 _cellGcmSetFlipCommandWithWaitLabel(PPUThread& ppu, vm::ptr ctx, u32 id, u32 label_index, u32 label_value) { cellGcmSys.Log("cellGcmSetFlipCommandWithWaitLabel(ctx=*0x%x, id=0x%x, label_index=0x%x, label_value=0x%x)", ctx, id, label_index, label_value); - s32 res = cellGcmSetPrepareFlip(CPU, ctx, id); + s32 res = cellGcmSetPrepareFlip(ppu, ctx, id); vm::write32(gcm_info.label_addr + 0x10 * label_index, label_value); return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK; } @@ -1200,9 +1188,7 @@ static bool isInCommandBufferExcept(u32 getPos, u32 bufferBegin, u32 bufferEnd) return true; } -// TODO: This function was originally located in lv2/SC_GCM and appears in RPCS3 as a lv2 syscall with id 1023, -// which according to lv2 dumps isn't the case. So, is this a proper place for this function? - +// TODO: Avoid using syscall 1023 for calling this function s32 cellGcmCallback(vm::ptr context, u32 count) { cellGcmSys.Log("cellGcmCallback(context=*0x%x, count=0x%x)", context, count); @@ -1210,16 +1196,16 @@ s32 cellGcmCallback(vm::ptr context, u32 count) auto& ctrl = vm::get_ref(gcm_info.control_addr); const std::chrono::time_point enterWait = std::chrono::system_clock::now(); // Flush command buffer (ie allow RSX to read up to context->current) - ctrl.put.exchange(getOffsetFromAddress(context->current)); + ctrl.put.exchange(getOffsetFromAddress(context->current.addr())); - std::pair newCommandBuffer = getNextCommandBufferBeginEnd(context->current); + std::pair newCommandBuffer = getNextCommandBufferBeginEnd(context->current.addr()); u32 offset = getOffsetFromAddress(newCommandBuffer.first); // Write jump instruction - vm::write32(context->current, CELL_GCM_METHOD_FLAG_JUMP | offset); + *context->current = CELL_GCM_METHOD_FLAG_JUMP | offset; // Update current command buffer - context->begin = newCommandBuffer.first; - context->current = newCommandBuffer.first; - context->end = newCommandBuffer.second; + context->begin.set(newCommandBuffer.first); + context->current.set(newCommandBuffer.first); + context->end.set(newCommandBuffer.second); // Wait for rsx to "release" the new command buffer while (!Emu.IsStopped()) @@ -1235,55 +1221,6 @@ s32 cellGcmCallback(vm::ptr context, u32 count) } return CELL_OK; - - //if (0) - //{ - // auto& ctrl = vm::get_ref(gcm_info.control_addr); - // be_t res = context->current - context->begin - ctrl.put.load(); - - // if (res != 0) - // { - // GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH); - // } - - // memmove(vm::get_ptr(context->begin), vm::get_ptr(context->current - res), res); - - // context->current = context->begin + res; - // ctrl.put.store(res); - // ctrl.get.store(0); - - // return CELL_OK; - //} - - //auto& ctrl = vm::get_ref(gcm_info.control_addr); - - // preparations for changing the place (for optimized FIFO mode) - //auto cmd = vm::ptr::make(context->current); - //cmd[0] = 0x41D6C; - //cmd[1] = 0x20; - //cmd[2] = 0x41D74; - //cmd[3] = 0; // some incrementing by module value - //context->current += 0x10; - - //if (0) - //{ - // const u32 address = context->begin; - // const u32 upper = offsetTable.ioAddress[address >> 20]; // 12 bits - // assert(upper != 0xFFFF); - // const u32 offset = (upper << 20) | (address & 0xFFFFF); - // vm::write32(context->current, CELL_GCM_METHOD_FLAG_JUMP | offset); // set JUMP cmd - - // auto& ctrl = vm::get_ref(gcm_info.control_addr); - // ctrl.put.exchange(offset); - //} - //else - //{ - // vm::write32(context->current, CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_NON_INCREMENT | (0)); - //} - - //context->current = context->begin; // rewind to the beginning - // TODO: something is missing - return CELL_OK; } //---------------------------------------------------------------------------- diff --git a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp index 506d1accd3..1498f67b8f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp @@ -6,193 +6,108 @@ extern Module cellGem; -struct cellGemInternal -{ - bool m_bInitialized; - CellGemAttribute attribute; - - cellGemInternal() - : m_bInitialized(false) - { - } -}; - -cellGemInternal cellGemInstance; - s32 cellGemCalibrate() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemClearStatusFlags() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemConvertVideoFinish() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemConvertVideoStart() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemEnableCameraPitchAngleCorrection() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemEnableMagnetometer() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemEnd() { cellGem.Warning("cellGemEnd()"); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - - cellGemInstance.m_bInitialized = false; - return CELL_OK; } s32 cellGemFilterState() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemForceRGB() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemGetAccelerometerPositionInDevice() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemGetAllTrackableHues() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemGetCameraState() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemGetEnvironmentLightingColor() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemGetHuePixels() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemGetImageState() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemGetInertialState() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemGetInfo(vm::ptr info) { - cellGem.Warning("cellGemGetInfo(info=0x%x)", info.addr()); + cellGem.Todo("cellGemGetInfo(info=*0x%x)", info); - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - - info->max_connect = cellGemInstance.attribute.max_connect; // TODO: Support many controllers to be connected - info->now_connect = 1; - info->status[0] = CELL_GEM_STATUS_READY; - info->port[0] = 7; + *info = {}; return CELL_OK; } @@ -201,59 +116,41 @@ s32 cellGemGetMemorySize(s32 max_connect) { cellGem.Warning("cellGemGetMemorySize(max_connect=%d)", max_connect); - if (max_connect > CELL_GEM_MAX_NUM) + if (max_connect > CELL_GEM_MAX_NUM || max_connect <= 0) + { return CELL_GEM_ERROR_INVALID_PARAMETER; + } - return 1024 * 1024 * max_connect; // 1 MB * max_connect + return max_connect <= 2 ? 0x120000 : 0x140000; } s32 cellGemGetRGB() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemGetRumble() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemGetState() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemGetStatusFlags() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemGetTrackerHue() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } @@ -267,22 +164,12 @@ s32 cellGemInit(vm::ptr attribute) { cellGem.Warning("cellGemInit(attribute=*0x%x)", attribute); - if (cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_ALREADY_INITIALIZED; - - cellGemInstance.m_bInitialized = true; - cellGemInstance.attribute = *attribute; - return CELL_OK; } s32 cellGemInvalidateCalibration() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } @@ -295,98 +182,65 @@ s32 cellGemIsTrackableHue() s32 cellGemPrepareCamera() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemPrepareVideoConvert() { UNIMPLEMENTED_FUNC(cellGem); + return CELL_OK; +} - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - +s32 cellGemReadExternalPortDeviceInfo() +{ + UNIMPLEMENTED_FUNC(cellGem); return CELL_OK; } s32 cellGemReset() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemSetRumble() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemSetYaw() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemTrackHues() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemUpdateFinish() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemUpdateStart() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } s32 cellGemWriteExternalPort() { UNIMPLEMENTED_FUNC(cellGem); - - if (!cellGemInstance.m_bInitialized) - return CELL_GEM_ERROR_UNINITIALIZED; - return CELL_OK; } Module cellGem("cellGem", []() { - cellGemInstance.m_bInitialized = false; - - //REG_FUNC(cellGem, cellGemAttributeInit); REG_FUNC(cellGem, cellGemCalibrate); REG_FUNC(cellGem, cellGemClearStatusFlags); REG_FUNC(cellGem, cellGemConvertVideoFinish); @@ -410,21 +264,18 @@ Module cellGem("cellGem", []() REG_FUNC(cellGem, cellGemGetState); REG_FUNC(cellGem, cellGemGetStatusFlags); REG_FUNC(cellGem, cellGemGetTrackerHue); - //REG_FUNC(cellGem, cellGemGetVideoConvertSize); REG_FUNC(cellGem, cellGemHSVtoRGB); REG_FUNC(cellGem, cellGemInit); REG_FUNC(cellGem, cellGemInvalidateCalibration); REG_FUNC(cellGem, cellGemIsTrackableHue); REG_FUNC(cellGem, cellGemPrepareCamera); REG_FUNC(cellGem, cellGemPrepareVideoConvert); - //REG_FUNC(cellGem, cellGemReadExternalPortDeviceInfo); + REG_FUNC(cellGem, cellGemReadExternalPortDeviceInfo); REG_FUNC(cellGem, cellGemReset); REG_FUNC(cellGem, cellGemSetRumble); REG_FUNC(cellGem, cellGemSetYaw); REG_FUNC(cellGem, cellGemTrackHues); REG_FUNC(cellGem, cellGemUpdateFinish); REG_FUNC(cellGem, cellGemUpdateStart); - //REG_FUNC(cellGem, cellGemVideoConvertAttributeInit); - //REG_FUNC(cellGem, cellGemVideoConvertAttributeInitRgba); REG_FUNC(cellGem, cellGemWriteExternalPort); }); diff --git a/rpcs3/Emu/SysCalls/Modules/cellGem.h b/rpcs3/Emu/SysCalls/Modules/cellGem.h index d86af2edf1..fce1ea14fb 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGem.h +++ b/rpcs3/Emu/SysCalls/Modules/cellGem.h @@ -186,4 +186,4 @@ struct CellGemVideoConvertAttribute be_t buffer_memory; be_t video_data_out; u8 alpha; -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp index 1e332cdab0..cea04c4bf9 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp @@ -74,6 +74,11 @@ s32 cellGifDecOpen( return CELL_OK; } +s32 cellGifDecExtOpen() +{ + throw EXCEPTION(""); +} + s32 cellGifDecReadHeader( CellGifDecMainHandle mainHandle, CellGifDecSubHandle subHandle, @@ -131,6 +136,11 @@ s32 cellGifDecReadHeader( return CELL_OK; } +s32 cellGifDecExtReadHeader() +{ + throw EXCEPTION(""); +} + s32 cellGifDecSetParameter( CellGifDecMainHandle mainHandle, CellGifDecSubHandle subHandle, @@ -167,6 +177,11 @@ s32 cellGifDecSetParameter( return CELL_OK; } +s32 cellGifDecExtSetParameter() +{ + throw EXCEPTION(""); +} + s32 cellGifDecDecodeData( CellGifDecMainHandle mainHandle, CellGifDecSubHandle subHandle, @@ -293,6 +308,11 @@ s32 cellGifDecDecodeData( return CELL_OK; } +s32 cellGifDecExtDecodeData() +{ + throw EXCEPTION(""); +} + s32 cellGifDecClose(CellGifDecMainHandle mainHandle, CellGifDecSubHandle subHandle) { cellGifDec.Warning("cellGifDecClose(mainHandle=0x%x, subHandle=0x%x)", mainHandle, subHandle); @@ -327,8 +347,8 @@ Module cellGifDec("cellGifDec", []() REG_FUNC(cellGifDec, cellGifDecClose); REG_FUNC(cellGifDec, cellGifDecDestroy); - /*REG_FUNC(cellGifDec, cellGifDecExtOpen); + REG_FUNC(cellGifDec, cellGifDecExtOpen); REG_FUNC(cellGifDec, cellGifDecExtReadHeader); REG_FUNC(cellGifDec, cellGifDecExtSetParameter); - REG_FUNC(cellGifDec, cellGifDecExtDecodeData);*/ + REG_FUNC(cellGifDec, cellGifDecExtDecodeData); }); diff --git a/rpcs3/Emu/SysCalls/Modules/cellGifDec.h b/rpcs3/Emu/SysCalls/Modules/cellGifDec.h index 5e17576136..8bc28cf434 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGifDec.h +++ b/rpcs3/Emu/SysCalls/Modules/cellGifDec.h @@ -57,8 +57,8 @@ using CellGifDecMainHandle = vm::ptr; using CellGifDecSubHandle = u32; // vm::ptr; // Callbacks for memory management -using CellGifDecCbControlMalloc = func_def(u32 size, vm::ptr cbCtrlMallocArg)>; -using CellGifDecCbControlFree = func_def ptr, vm::ptr cbCtrlFreeArg)>; +using CellGifDecCbControlMalloc = vm::ptr(u32 size, vm::ptr cbCtrlMallocArg); +using CellGifDecCbControlFree = s32(vm::ptr ptr, vm::ptr cbCtrlFreeArg); // Structs struct CellGifDecThreadInParam diff --git a/rpcs3/Emu/SysCalls/Modules/cellHttp.cpp b/rpcs3/Emu/SysCalls/Modules/cellHttp.cpp new file mode 100644 index 0000000000..4af23b0f4d --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellHttp.cpp @@ -0,0 +1,719 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellHttp; +extern Module cellHttps; + +s32 cellHttpInit() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpEnd() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpsInit() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpsEnd() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpSetProxy() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpGetProxy() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpInitCookie() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpEndCookie() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpAddCookieWithClientId() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpSessionCookieFlush() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpCookieExportWithClientId() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpCookieImportWithClientId() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetCookieSendCallback() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetCookieRecvCallback() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpCreateClient() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpDestroyClient() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetAuthenticationCallback() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetTransactionStateCallback() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetRedirectCallback() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetProxy() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetProxy() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetVersion() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetVersion() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetPipeline() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetPipeline() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetKeepAlive() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetKeepAlive() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetAutoRedirect() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetAutoRedirect() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetAutoAuthentication() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetAutoAuthentication() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetAuthenticationCacheStatus() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetAuthenticationCacheStatus() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetCookieStatus() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetCookieStatus() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetUserAgent() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetUserAgent() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetResponseBufferMax() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetResponseBufferMax() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientCloseAllConnections() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientCloseConnections() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientPollConnections() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetRecvTimeout() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetRecvTimeout() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetSendTimeout() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetSendTimeout() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetConnTimeout() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetConnTimeout() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetTotalPoolSize() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetTotalPoolSize() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetPerHostPoolSize() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetPerHostPoolSize() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetPerHostKeepAliveMax() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetPerHostKeepAliveMax() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetPerPipelineMax() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetPerPipelineMax() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetRecvBufferSize() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetRecvBufferSize() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetSendBufferSize() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetSendBufferSize() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetAllHeaders() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetHeader() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetHeader() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientAddHeader() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientDeleteHeader() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetSslCallback() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetSslClientCertificate() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpCreateTransaction() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpDestroyTransaction() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpTransactionGetUri() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpTransactionCloseConnection() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpTransactionReleaseConnection() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpTransactionAbortConnection() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpSendRequest() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpRequestSetContentLength() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpRequestGetContentLength() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpRequestSetChunkedTransferStatus() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpRequestGetChunkedTransferStatus() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpRequestGetAllHeaders() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpRequestSetHeader() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpRequestGetHeader() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpRequestAddHeader() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpRequestDeleteHeader() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpRecvResponse() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpResponseGetAllHeaders() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpResponseGetHeader() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpResponseGetContentLength() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpResponseGetStatusCode() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpResponseGetStatusLine() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpTransactionGetSslCipherName() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpTransactionGetSslCipherId() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpTransactionGetSslCipherVersion() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpTransactionGetSslCipherBits() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpTransactionGetSslCipherString() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpTransactionGetSslVersion() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpTransactionGetSslId() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetSslVersion() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientGetSslVersion() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +s32 cellHttpClientSetSslIdDestroyCallback() +{ + UNIMPLEMENTED_FUNC(cellHttp); + return CELL_OK; +} + +Module cellHttp("cellHttp", []() +{ + REG_FUNC(cellHttp, cellHttpInit); + REG_FUNC(cellHttp, cellHttpEnd); + REG_FUNC(cellHttp, cellHttpsInit); + REG_FUNC(cellHttp, cellHttpsEnd); + REG_FUNC(cellHttp, cellHttpSetProxy); + REG_FUNC(cellHttp, cellHttpGetProxy); + + REG_FUNC(cellHttp, cellHttpInitCookie); + REG_FUNC(cellHttp, cellHttpEndCookie); + REG_FUNC(cellHttp, cellHttpAddCookieWithClientId); + REG_FUNC(cellHttp, cellHttpSessionCookieFlush); + REG_FUNC(cellHttp, cellHttpCookieExportWithClientId); + REG_FUNC(cellHttp, cellHttpCookieImportWithClientId); + REG_FUNC(cellHttp, cellHttpClientSetCookieSendCallback); + REG_FUNC(cellHttp, cellHttpClientSetCookieRecvCallback); + + REG_FUNC(cellHttp, cellHttpCreateClient); + REG_FUNC(cellHttp, cellHttpDestroyClient); + REG_FUNC(cellHttp, cellHttpClientSetAuthenticationCallback); + REG_FUNC(cellHttp, cellHttpClientSetTransactionStateCallback); + REG_FUNC(cellHttp, cellHttpClientSetRedirectCallback); + + REG_FUNC(cellHttp, cellHttpClientSetProxy); + REG_FUNC(cellHttp, cellHttpClientGetProxy); + REG_FUNC(cellHttp, cellHttpClientSetVersion); + REG_FUNC(cellHttp, cellHttpClientGetVersion); + REG_FUNC(cellHttp, cellHttpClientSetPipeline); + REG_FUNC(cellHttp, cellHttpClientGetPipeline); + REG_FUNC(cellHttp, cellHttpClientSetKeepAlive); + REG_FUNC(cellHttp, cellHttpClientGetKeepAlive); + REG_FUNC(cellHttp, cellHttpClientSetAutoRedirect); + REG_FUNC(cellHttp, cellHttpClientGetAutoRedirect); + REG_FUNC(cellHttp, cellHttpClientSetAutoAuthentication); + REG_FUNC(cellHttp, cellHttpClientGetAutoAuthentication); + REG_FUNC(cellHttp, cellHttpClientSetAuthenticationCacheStatus); + REG_FUNC(cellHttp, cellHttpClientGetAuthenticationCacheStatus); + REG_FUNC(cellHttp, cellHttpClientSetCookieStatus); + REG_FUNC(cellHttp, cellHttpClientGetCookieStatus); + REG_FUNC(cellHttp, cellHttpClientSetUserAgent); + REG_FUNC(cellHttp, cellHttpClientGetUserAgent); + REG_FUNC(cellHttp, cellHttpClientSetResponseBufferMax); + REG_FUNC(cellHttp, cellHttpClientGetResponseBufferMax); + + REG_FUNC(cellHttp, cellHttpClientCloseAllConnections); + REG_FUNC(cellHttp, cellHttpClientCloseConnections); + REG_FUNC(cellHttp, cellHttpClientPollConnections); + REG_FUNC(cellHttp, cellHttpClientSetRecvTimeout); + REG_FUNC(cellHttp, cellHttpClientGetRecvTimeout); + REG_FUNC(cellHttp, cellHttpClientSetSendTimeout); + REG_FUNC(cellHttp, cellHttpClientGetSendTimeout); + REG_FUNC(cellHttp, cellHttpClientSetConnTimeout); + REG_FUNC(cellHttp, cellHttpClientGetConnTimeout); + REG_FUNC(cellHttp, cellHttpClientSetTotalPoolSize); + REG_FUNC(cellHttp, cellHttpClientGetTotalPoolSize); + REG_FUNC(cellHttp, cellHttpClientSetPerHostPoolSize); + REG_FUNC(cellHttp, cellHttpClientGetPerHostPoolSize); + REG_FUNC(cellHttp, cellHttpClientSetPerHostKeepAliveMax); + REG_FUNC(cellHttp, cellHttpClientGetPerHostKeepAliveMax); + REG_FUNC(cellHttp, cellHttpClientSetPerPipelineMax); + REG_FUNC(cellHttp, cellHttpClientGetPerPipelineMax); + REG_FUNC(cellHttp, cellHttpClientSetRecvBufferSize); + REG_FUNC(cellHttp, cellHttpClientGetRecvBufferSize); + REG_FUNC(cellHttp, cellHttpClientSetSendBufferSize); + REG_FUNC(cellHttp, cellHttpClientGetSendBufferSize); + + REG_FUNC(cellHttp, cellHttpClientGetAllHeaders); + REG_FUNC(cellHttp, cellHttpClientSetHeader); + REG_FUNC(cellHttp, cellHttpClientGetHeader); + REG_FUNC(cellHttp, cellHttpClientAddHeader); + REG_FUNC(cellHttp, cellHttpClientDeleteHeader); + + REG_FUNC(cellHttp, cellHttpClientSetSslCallback); + REG_FUNC(cellHttp, cellHttpClientSetSslClientCertificate); + + REG_FUNC(cellHttp, cellHttpCreateTransaction); + REG_FUNC(cellHttp, cellHttpDestroyTransaction); + REG_FUNC(cellHttp, cellHttpTransactionGetUri); + REG_FUNC(cellHttp, cellHttpTransactionCloseConnection); + REG_FUNC(cellHttp, cellHttpTransactionReleaseConnection); + REG_FUNC(cellHttp, cellHttpTransactionAbortConnection); + + REG_FUNC(cellHttp, cellHttpSendRequest); + REG_FUNC(cellHttp, cellHttpRequestSetContentLength); + REG_FUNC(cellHttp, cellHttpRequestGetContentLength); + REG_FUNC(cellHttp, cellHttpRequestSetChunkedTransferStatus); + REG_FUNC(cellHttp, cellHttpRequestGetChunkedTransferStatus); + REG_FUNC(cellHttp, cellHttpRequestGetAllHeaders); + REG_FUNC(cellHttp, cellHttpRequestSetHeader); + REG_FUNC(cellHttp, cellHttpRequestGetHeader); + REG_FUNC(cellHttp, cellHttpRequestAddHeader); + REG_FUNC(cellHttp, cellHttpRequestDeleteHeader); + + REG_FUNC(cellHttp, cellHttpRecvResponse); + REG_FUNC(cellHttp, cellHttpResponseGetAllHeaders); + REG_FUNC(cellHttp, cellHttpResponseGetHeader); + REG_FUNC(cellHttp, cellHttpResponseGetContentLength); + REG_FUNC(cellHttp, cellHttpResponseGetStatusCode); + REG_FUNC(cellHttp, cellHttpResponseGetStatusLine); + + REG_FUNC(cellHttp, cellHttpTransactionGetSslCipherName); + REG_FUNC(cellHttp, cellHttpTransactionGetSslCipherId); + REG_FUNC(cellHttp, cellHttpTransactionGetSslCipherVersion); + REG_FUNC(cellHttp, cellHttpTransactionGetSslCipherBits); + REG_FUNC(cellHttp, cellHttpTransactionGetSslCipherString); + REG_FUNC(cellHttp, cellHttpTransactionGetSslVersion); + REG_FUNC(cellHttp, cellHttpTransactionGetSslId); + + REG_FUNC(cellHttp, cellHttpClientSetSslVersion); + REG_FUNC(cellHttp, cellHttpClientGetSslVersion); + REG_FUNC(cellHttp, cellHttpClientSetSslIdDestroyCallback); +}); + +Module cellHttps("cellHttps", []() +{ + // cellHttps doesn't have functions (cellHttpsInit belongs to cellHttp, for example) +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellHttpUtil.cpp b/rpcs3/Emu/SysCalls/Modules/cellHttpUtil.cpp index 7e116bed58..a61c787e78 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellHttpUtil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellHttpUtil.cpp @@ -1,130 +1,130 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellHttpUtil_init(); -Module cellHttpUtil(0x0002, cellHttpUtil_init); +extern Module cellHttpUtil; -int cellHttpUtilParseUri() +s32 cellHttpUtilParseUri() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilParseUriPath() +s32 cellHttpUtilParseUriPath() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilParseProxy() +s32 cellHttpUtilParseProxy() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilParseStatusLine() +s32 cellHttpUtilParseStatusLine() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilParseHeader() +s32 cellHttpUtilParseHeader() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilBuildRequestLine() +s32 cellHttpUtilBuildRequestLine() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilBuildHeader() +s32 cellHttpUtilBuildHeader() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilBuildUri() +s32 cellHttpUtilBuildUri() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilCopyUri() +s32 cellHttpUtilCopyUri() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilMergeUriPath() +s32 cellHttpUtilMergeUriPath() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilSweepPath() +s32 cellHttpUtilSweepPath() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilCopyStatusLine() +s32 cellHttpUtilCopyStatusLine() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilCopyHeader() +s32 cellHttpUtilCopyHeader() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilAppendHeaderValue() +s32 cellHttpUtilAppendHeaderValue() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilEscapeUri() +s32 cellHttpUtilEscapeUri() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilUnescapeUri() +s32 cellHttpUtilUnescapeUri() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilFormUrlEncode() +s32 cellHttpUtilFormUrlEncode() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilFormUrlDecode() +s32 cellHttpUtilFormUrlDecode() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilBase64Encoder() +s32 cellHttpUtilBase64Encoder() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -int cellHttpUtilBase64Decoder() +s32 cellHttpUtilBase64Decoder() { UNIMPLEMENTED_FUNC(cellHttpUtil); return CELL_OK; } -void cellHttpUtil_init() +Module cellHttpUtil("cellHttpUtil", []() { REG_FUNC(cellHttpUtil, cellHttpUtilParseUri); REG_FUNC(cellHttpUtil, cellHttpUtilParseUriPath); @@ -149,5 +149,4 @@ void cellHttpUtil_init() REG_FUNC(cellHttpUtil, cellHttpUtilFormUrlDecode); REG_FUNC(cellHttpUtil, cellHttpUtilBase64Encoder); REG_FUNC(cellHttpUtil, cellHttpUtilBase64Decoder); -} -#endif +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellImejp.cpp b/rpcs3/Emu/SysCalls/Modules/cellImejp.cpp index f7e0966fd1..21f1cebe4e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellImejp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellImejp.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellImejp_init(); -Module cellImejp(0xf023, cellImejp_init); +extern Module cellImeJp; // Return Codes enum @@ -16,291 +16,296 @@ enum CELL_IMEJP_ERROR_OTHER = 0x8002bfff, }; -int cellImeJpOpen() +s32 cellImeJpOpen() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpOpen2() +s32 cellImeJpOpen2() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpOpen3() +s32 cellImeJpOpen3() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpClose() +s32 cellImeJpClose() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpSetKanaInputMode() +s32 cellImeJpSetKanaInputMode() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpSetInputCharType() +s32 cellImeJpSetInputCharType() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpSetFixInputMode() +s32 cellImeJpSetFixInputMode() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpReset() +s32 cellImeJpAllowExtensionCharacters() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpGetStatus() +s32 cellImeJpReset() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpEnterChar() +s32 cellImeJpGetStatus() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpEnterCharExt() +s32 cellImeJpEnterChar() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpEnterString() +s32 cellImeJpEnterCharExt() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpEnterStringExt() +s32 cellImeJpEnterString() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpModeCaretRight() +s32 cellImeJpEnterStringExt() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpModeCaretLeft() +s32 cellImeJpModeCaretRight() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpBackspaceWord() +s32 cellImeJpModeCaretLeft() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpDeleteWord() +s32 cellImeJpBackspaceWord() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpAllDeleteConvertString() +s32 cellImeJpDeleteWord() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpConvertForward() +s32 cellImeJpAllDeleteConvertString() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpConvertBackward() +s32 cellImeJpConvertForward() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpCurrentPartConfirm() +s32 cellImeJpConvertBackward() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpAllConfirm() +s32 cellImeJpCurrentPartConfirm() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpConvertCancel() +s32 cellImeJpAllConfirm() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpAllConvertCancel() +s32 cellImeJpConvertCancel() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpExtendConvertArea() +s32 cellImeJpAllConvertCancel() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpShortenConvertArea() +s32 cellImeJpExtendConvertArea() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpTemporalConfirm() +s32 cellImeJpShortenConvertArea() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpPostConvert() +s32 cellImeJpTemporalConfirm() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpMoveFocusClause() +s32 cellImeJpPostConvert() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpGetFocusTop() +s32 cellImeJpMoveFocusClause() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpGetFocusLength() +s32 cellImeJpGetFocusTop() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpGetConfirmYomiString() +s32 cellImeJpGetFocusLength() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpGetConfirmString() +s32 cellImeJpGetConfirmYomiString() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpGetConvertYomiString() +s32 cellImeJpGetConfirmString() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpGetConvertString() +s32 cellImeJpGetConvertYomiString() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpGetCandidateListSize() +s32 cellImeJpGetConvertString() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpGetCandidateList() +s32 cellImeJpGetCandidateListSize() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpGetCandidateSelect() +s32 cellImeJpGetCandidateList() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpGetPredictList() +s32 cellImeJpGetCandidateSelect() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -int cellImeJpConfirmPrediction() +s32 cellImeJpGetPredictList() { - UNIMPLEMENTED_FUNC(cellImejp); + UNIMPLEMENTED_FUNC(cellImeJp); return CELL_OK; } -void cellImejp_init() +s32 cellImeJpConfirmPrediction() { - REG_FUNC(cellImejp, cellImeJpOpen); - REG_FUNC(cellImejp, cellImeJpOpen2); - REG_FUNC(cellImejp, cellImeJpOpen3); - REG_FUNC(cellImejp, cellImeJpClose); - - REG_FUNC(cellImejp, cellImeJpSetKanaInputMode); - REG_FUNC(cellImejp, cellImeJpSetInputCharType); - REG_FUNC(cellImejp, cellImeJpSetFixInputMode); - //cellImejp.AddFunc(, cellImeJpAllowExtensionCharacters); - REG_FUNC(cellImejp, cellImeJpReset); - - REG_FUNC(cellImejp, cellImeJpGetStatus); - - REG_FUNC(cellImejp, cellImeJpEnterChar); - REG_FUNC(cellImejp, cellImeJpEnterCharExt); - REG_FUNC(cellImejp, cellImeJpEnterString); - REG_FUNC(cellImejp, cellImeJpEnterStringExt); - REG_FUNC(cellImejp, cellImeJpModeCaretRight); - REG_FUNC(cellImejp, cellImeJpModeCaretLeft); - REG_FUNC(cellImejp, cellImeJpBackspaceWord); - REG_FUNC(cellImejp, cellImeJpDeleteWord); - REG_FUNC(cellImejp, cellImeJpAllDeleteConvertString); - REG_FUNC(cellImejp, cellImeJpConvertForward); - REG_FUNC(cellImejp, cellImeJpConvertBackward); - REG_FUNC(cellImejp, cellImeJpCurrentPartConfirm); - REG_FUNC(cellImejp, cellImeJpAllConfirm); - REG_FUNC(cellImejp, cellImeJpConvertCancel); - REG_FUNC(cellImejp, cellImeJpAllConvertCancel); - REG_FUNC(cellImejp, cellImeJpExtendConvertArea); - REG_FUNC(cellImejp, cellImeJpShortenConvertArea); - REG_FUNC(cellImejp, cellImeJpTemporalConfirm); - REG_FUNC(cellImejp, cellImeJpPostConvert); - REG_FUNC(cellImejp, cellImeJpMoveFocusClause); - REG_FUNC(cellImejp, cellImeJpGetFocusTop); - REG_FUNC(cellImejp, cellImeJpGetFocusLength); - REG_FUNC(cellImejp, cellImeJpGetConfirmYomiString); - REG_FUNC(cellImejp, cellImeJpGetConfirmString); - REG_FUNC(cellImejp, cellImeJpGetConvertYomiString); - REG_FUNC(cellImejp, cellImeJpGetConvertString); - REG_FUNC(cellImejp, cellImeJpGetCandidateListSize); - REG_FUNC(cellImejp, cellImeJpGetCandidateList); - REG_FUNC(cellImejp, cellImeJpGetCandidateSelect); - REG_FUNC(cellImejp, cellImeJpGetPredictList); - REG_FUNC(cellImejp, cellImeJpConfirmPrediction); + UNIMPLEMENTED_FUNC(cellImeJp); + return CELL_OK; } -#endif + +Module cellImeJp("cellImeJp", []() +{ + REG_FUNC(cellImeJp, cellImeJpOpen); + REG_FUNC(cellImeJp, cellImeJpOpen2); + REG_FUNC(cellImeJp, cellImeJpOpen3); + REG_FUNC(cellImeJp, cellImeJpClose); + + REG_FUNC(cellImeJp, cellImeJpSetKanaInputMode); + REG_FUNC(cellImeJp, cellImeJpSetInputCharType); + REG_FUNC(cellImeJp, cellImeJpSetFixInputMode); + REG_FUNC(cellImeJp, cellImeJpAllowExtensionCharacters); + REG_FUNC(cellImeJp, cellImeJpReset); + + REG_FUNC(cellImeJp, cellImeJpGetStatus); + + REG_FUNC(cellImeJp, cellImeJpEnterChar); + REG_FUNC(cellImeJp, cellImeJpEnterCharExt); + REG_FUNC(cellImeJp, cellImeJpEnterString); + REG_FUNC(cellImeJp, cellImeJpEnterStringExt); + REG_FUNC(cellImeJp, cellImeJpModeCaretRight); + REG_FUNC(cellImeJp, cellImeJpModeCaretLeft); + REG_FUNC(cellImeJp, cellImeJpBackspaceWord); + REG_FUNC(cellImeJp, cellImeJpDeleteWord); + REG_FUNC(cellImeJp, cellImeJpAllDeleteConvertString); + REG_FUNC(cellImeJp, cellImeJpConvertForward); + REG_FUNC(cellImeJp, cellImeJpConvertBackward); + REG_FUNC(cellImeJp, cellImeJpCurrentPartConfirm); + REG_FUNC(cellImeJp, cellImeJpAllConfirm); + REG_FUNC(cellImeJp, cellImeJpConvertCancel); + REG_FUNC(cellImeJp, cellImeJpAllConvertCancel); + REG_FUNC(cellImeJp, cellImeJpExtendConvertArea); + REG_FUNC(cellImeJp, cellImeJpShortenConvertArea); + REG_FUNC(cellImeJp, cellImeJpTemporalConfirm); + REG_FUNC(cellImeJp, cellImeJpPostConvert); + REG_FUNC(cellImeJp, cellImeJpMoveFocusClause); + REG_FUNC(cellImeJp, cellImeJpGetFocusTop); + REG_FUNC(cellImeJp, cellImeJpGetFocusLength); + REG_FUNC(cellImeJp, cellImeJpGetConfirmYomiString); + REG_FUNC(cellImeJp, cellImeJpGetConfirmString); + REG_FUNC(cellImeJp, cellImeJpGetConvertYomiString); + REG_FUNC(cellImeJp, cellImeJpGetConvertString); + REG_FUNC(cellImeJp, cellImeJpGetCandidateListSize); + REG_FUNC(cellImeJp, cellImeJpGetCandidateList); + REG_FUNC(cellImeJp, cellImeJpGetCandidateSelect); + REG_FUNC(cellImeJp, cellImeJpGetPredictList); + REG_FUNC(cellImeJp, cellImeJpConfirmPrediction); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp index 0548d82ac0..6566b4a8e0 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp @@ -68,6 +68,11 @@ s32 cellJpgDecOpen(u32 mainHandle, vm::ptr subHandle, vm::ptr return CELL_OK; } +s32 cellJpgDecExtReadHeader() +{ + throw EXCEPTION(""); +} + s32 cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr data, vm::cptr dataCtrlParam, vm::ptr dataOutInfo) { cellJpgDec.Log("cellJpgDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data=*0x%x, dataCtrlParam=*0x%x, dataOutInfo=*0x%x)", mainHandle, subHandle, data, dataCtrlParam, dataOutInfo); @@ -293,6 +303,11 @@ s32 cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr data, vm::cp return CELL_OK; } +s32 cellJpgDecExtDecodeData() +{ + throw EXCEPTION(""); +} + s32 cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, vm::cptr inParam, vm::ptr outParam) { cellJpgDec.Log("cellJpgDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam=*0x%x, outParam=*0x%x)", mainHandle, subHandle, inParam, outParam); @@ -338,6 +353,11 @@ s32 cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, vm::cptr #endif -//#include #include "cellL10n.h" extern Module cellL10n; -s32 UTF16stoUTF8s(vm::cptr utf16, vm::ref utf16_len, vm::ptr utf8, vm::ref utf8_len) -{ - cellL10n.Todo("UTF16stoUTF8s(utf16=*0x%x, utf16_len=*0x%x, utf8=*0x%x, utf8_len=*0x%x)", utf16, utf16_len, utf8, utf8_len); - - const u32 max_len = utf8_len; utf8_len = 0; - - for (u32 i = 0, len = 0; i < utf16_len; i++, utf8_len = len) - { - const char16_t ch = utf16[i]; - - // increase required length (TODO) - len = len + 1; - - // validate character (TODO) - //if () - //{ - // utf16_len -= i; - // return SRCIllegal; - //} - - if (utf8 != vm::null) - { - if (len > max_len) - { - utf16_len -= i; - return DSTExhausted; - } - - if (ch <= 0x7f) - { - *utf8++ = static_cast(ch); - } - else - { - *utf8++ = '?'; // TODO - } - } - } - - return ConversionOK; -} - -s32 jstrchk(vm::cptr jstr) -{ - cellL10n.Warning("jstrchk(jstr=*0x%x) -> utf8", jstr); - - return L10N_STR_UTF8; -} - //translate code id to code name. some codepage may has another name. //If this makes your compilation fail, try replace the string code with one in "iconv -l" bool _L10nCodeParse(s32 code, std::string& retCode) @@ -296,11 +246,516 @@ s32 _L10nConvertStr(s32 src_code, const void* src, size_t * src_len, s32 dst_cod }*/ #endif -//TODO: Check the code in emulation. If support for UTF8/UTF16/UTF32/UCS2/UCS4 should use wider chars.. awful. +s32 UCS2toEUCJP() +{ + throw EXCEPTION(""); +} + +s32 l10n_convert() +{ + throw EXCEPTION(""); +} + +s32 UCS2toUTF32() +{ + throw EXCEPTION(""); +} + +s32 jis2kuten() +{ + throw EXCEPTION(""); +} + +s32 UTF8toGB18030() +{ + throw EXCEPTION(""); +} + +s32 JISstoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 SjisZen2Han() +{ + throw EXCEPTION(""); +} + +s32 ToSjisLower() +{ + throw EXCEPTION(""); +} + +s32 UCS2toGB18030() +{ + throw EXCEPTION(""); +} + +s32 HZstoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoHZs() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoSJISs() +{ + throw EXCEPTION(""); +} + +s32 kuten2eucjp() +{ + throw EXCEPTION(""); +} + +s32 sjis2jis() +{ + throw EXCEPTION(""); +} + +s32 EUCKRstoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 UHCstoEUCKRs() +{ + throw EXCEPTION(""); +} + +s32 jis2sjis() +{ + throw EXCEPTION(""); +} + +s32 jstrnchk() +{ + throw EXCEPTION(""); +} + +s32 L10nConvert() +{ + throw EXCEPTION(""); +} + +s32 EUCCNstoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 GBKstoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 eucjphan2zen() +{ + throw EXCEPTION(""); +} + +s32 ToSjisHira() +{ + throw EXCEPTION(""); +} + +s32 GBKtoUCS2() +{ + throw EXCEPTION(""); +} + +s32 eucjp2jis() +{ + throw EXCEPTION(""); +} + +s32 UTF32stoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 sjishan2zen() +{ + throw EXCEPTION(""); +} + +s32 UCS2toSBCS() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoGBKs() +{ + throw EXCEPTION(""); +} + +s32 UTF8toUCS2() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 EUCKRstoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 UTF16stoUTF32s() +{ + throw EXCEPTION(""); +} + +s32 UTF8toEUCKR() +{ + throw EXCEPTION(""); +} + +s32 UTF16toUTF8() +{ + throw EXCEPTION(""); +} + +s32 ARIBstoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 SJISstoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 sjiszen2han() +{ + throw EXCEPTION(""); +} + +s32 ToEucJpLower() +{ + throw EXCEPTION(""); +} + +s32 MSJIStoUTF8() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoMSJISs() +{ + throw EXCEPTION(""); +} + +s32 EUCJPtoUTF8() +{ + throw EXCEPTION(""); +} + +s32 eucjp2sjis() +{ + throw EXCEPTION(""); +} + +s32 ToEucJpHira() +{ + throw EXCEPTION(""); +} + +s32 UHCstoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 ToEucJpKata() +{ + throw EXCEPTION(""); +} + +s32 HZstoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 UTF8toMSJIS() +{ + throw EXCEPTION(""); +} + +s32 BIG5toUTF8() +{ + throw EXCEPTION(""); +} + +s32 EUCJPstoSJISs() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoBIG5s() +{ + throw EXCEPTION(""); +} + +s32 UTF16stoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoGB18030s() +{ + throw EXCEPTION(""); +} + +s32 EUCJPtoSJIS() +{ + throw EXCEPTION(""); +} + +s32 EUCJPtoUCS2() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoGBKs() +{ + throw EXCEPTION(""); +} + +s32 EUCKRtoUHC() +{ + throw EXCEPTION(""); +} + +s32 UCS2toSJIS() +{ + throw EXCEPTION(""); +} + +s32 MSJISstoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 EUCJPstoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 UCS2toBIG5() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoEUCKRs() +{ + throw EXCEPTION(""); +} + +s32 UHCstoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 GB18030stoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 SJIStoUTF8() +{ + throw EXCEPTION(""); +} + +s32 JISstoSJISs() +{ + throw EXCEPTION(""); +} + +s32 UTF8toUTF16() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoMSJISs() +{ + throw EXCEPTION(""); +} + +s32 EUCKRtoUTF8() +{ + throw EXCEPTION(""); +} + +s32 SjisHan2Zen() +{ + throw EXCEPTION(""); +} + +s32 UCS2toUTF16() +{ + throw EXCEPTION(""); +} + +s32 UCS2toMSJIS() +{ + throw EXCEPTION(""); +} + +s32 sjis2kuten() +{ + throw EXCEPTION(""); +} + +s32 UCS2toUHC() +{ + throw EXCEPTION(""); +} + +s32 UTF32toUCS2() +{ + throw EXCEPTION(""); +} + +s32 ToSjisUpper() +{ + throw EXCEPTION(""); +} + +s32 UTF8toEUCJP() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoEUCJPs() +{ + throw EXCEPTION(""); +} + +s32 UTF16toUCS2() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoUTF16s() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoEUCCNs() +{ + throw EXCEPTION(""); +} + +s32 SBCSstoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 SJISstoJISs() +{ + throw EXCEPTION(""); +} + +s32 SBCStoUTF8() +{ + throw EXCEPTION(""); +} + +s32 UTF8toUTF32() +{ + throw EXCEPTION(""); +} + +s32 jstrchk(vm::cptr jstr) +{ + cellL10n.Warning("jstrchk(jstr=*0x%x) -> utf8", jstr); + + return L10N_STR_UTF8; +} + +s32 UHCtoEUCKR() +{ + throw EXCEPTION(""); +} + +s32 kuten2jis() +{ + throw EXCEPTION(""); +} + +s32 UTF8toEUCCN() +{ + throw EXCEPTION(""); +} + +s32 EUCCNtoUTF8() +{ + throw EXCEPTION(""); +} + +s32 EucJpZen2Han() +{ + throw EXCEPTION(""); +} + +s32 UTF32stoUTF16s() +{ + throw EXCEPTION(""); +} + +s32 GBKtoUTF8() +{ + throw EXCEPTION(""); +} + +s32 ToEucJpUpper() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoJISs() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoGB18030s() +{ + throw EXCEPTION(""); +} + +s32 EUCKRstoUHCs() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoUTF32s() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoEUCCNs() +{ + throw EXCEPTION(""); +} + +s32 EUCJPstoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 UHCtoUCS2() +{ + throw EXCEPTION(""); +} + s32 L10nConvertStr(s32 src_code, vm::cptr src, vm::ptr src_len, s32 dst_code, vm::ptr dst, vm::ptr dst_len) { cellL10n.Error("L10nConvertStr(src_code=%d, srca=*0x%x, src_len=*0x%x, dst_code=%d, dst=*0x%x, dst_len=*0x%x)", src_code, src, src_len, dst_code, dst, dst_len); - //cellL10n.Todo("L10nConvertStr: 1st char at dst: 0x%x", *((char*)src.get_ptr())); #ifdef _MSC_VER u32 srcCode = 0, dstCode = 0; //OEM code pages bool src_page_converted = _L10nCodeParse(src_code, srcCode); //Check if code is in list. @@ -350,173 +805,524 @@ s32 L10nConvertStr(s32 src_code, vm::cptr src, vm::ptr src_len, s32 d #endif } +s32 GBKstoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 UTF8toUHC() +{ + throw EXCEPTION(""); +} + +s32 UTF32toUTF8() +{ + throw EXCEPTION(""); +} + +s32 sjis2eucjp() +{ + throw EXCEPTION(""); +} + +s32 UCS2toEUCCN() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoUHCs() +{ + throw EXCEPTION(""); +} + +s32 EUCKRtoUCS2() +{ + throw EXCEPTION(""); +} + +s32 UTF32toUTF16() +{ + throw EXCEPTION(""); +} + +s32 EUCCNstoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 SBCSstoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoJISs() +{ + throw EXCEPTION(""); +} + +s32 ToSjisKata() +{ + throw EXCEPTION(""); +} + +s32 jis2eucjp() +{ + throw EXCEPTION(""); +} + +s32 BIG5toUCS2() +{ + throw EXCEPTION(""); +} + +s32 UCS2toGBK() +{ + throw EXCEPTION(""); +} + +s32 UTF16toUTF32() +{ + throw EXCEPTION(""); +} + +s32 l10n_convert_str() +{ + throw EXCEPTION(""); +} + +s32 EUCJPstoJISs() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoARIBs() +{ + throw EXCEPTION(""); +} + +s32 JISstoEUCJPs() +{ + throw EXCEPTION(""); +} + +s32 EucJpHan2Zen() +{ + throw EXCEPTION(""); +} + +s32 isEucJpKigou() +{ + throw EXCEPTION(""); +} + +s32 UCS2toUTF8() +{ + throw EXCEPTION(""); +} + +s32 GB18030toUCS2() +{ + throw EXCEPTION(""); +} + +s32 UHCtoUTF8() +{ + throw EXCEPTION(""); +} + +s32 MSJIStoUCS2() +{ + throw EXCEPTION(""); +} + +s32 UTF8toGBK() +{ + throw EXCEPTION(""); +} + +s32 kuten2sjis() +{ + throw EXCEPTION(""); +} + +s32 UTF8toSBCS() +{ + throw EXCEPTION(""); +} + +s32 SJIStoUCS2() +{ + throw EXCEPTION(""); +} + +s32 eucjpzen2han() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoARIBs() +{ + throw EXCEPTION(""); +} + +s32 isSjisKigou() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoEUCJPs() +{ + throw EXCEPTION(""); +} + +s32 UCS2toEUCKR() +{ + throw EXCEPTION(""); +} + +s32 SBCStoUCS2() +{ + throw EXCEPTION(""); +} + +s32 MSJISstoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 l10n_get_converter() +{ + throw EXCEPTION(""); +} + +s32 GB18030stoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 SJISstoEUCJPs() +{ + throw EXCEPTION(""); +} + +s32 UTF32stoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 BIG5stoUTF8s() +{ + throw EXCEPTION(""); +} + +s32 EUCCNtoUCS2() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoSBCSs() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoEUCKRs() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoSJISs() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoHZs() +{ + throw EXCEPTION(""); +} + +s32 eucjp2kuten() +{ + throw EXCEPTION(""); +} + +s32 UTF8toBIG5() +{ + throw EXCEPTION(""); +} + +s32 UTF16stoUTF8s(vm::cptr utf16, vm::ref utf16_len, vm::ptr utf8, vm::ref utf8_len) +{ + cellL10n.Error("UTF16stoUTF8s(utf16=*0x%x, utf16_len=*0x%x, utf8=*0x%x, utf8_len=*0x%x)", utf16, utf16_len, utf8, utf8_len); + + const u32 max_len = utf8_len; utf8_len = 0; + + for (u32 i = 0, len = 0; i < utf16_len; i++, utf8_len = len) + { + const char16_t ch = utf16[i]; + + // increase required length (TODO) + len = len + 1; + + // validate character (TODO) + //if () + //{ + // utf16_len -= i; + // return SRCIllegal; + //} + + if (utf8 != vm::null) + { + if (len > max_len) + { + utf16_len -= i; + return DSTExhausted; + } + + if (ch <= 0x7f) + { + *utf8++ = static_cast(ch); + } + else + { + *utf8++ = '?'; // TODO + } + } + } + + return ConversionOK; +} + +s32 JISstoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 GB18030toUTF8() +{ + throw EXCEPTION(""); +} + +s32 UTF8toSJIS() +{ + throw EXCEPTION(""); +} + +s32 ARIBstoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoUTF32s() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoSBCSs() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoBIG5s() +{ + throw EXCEPTION(""); +} + +s32 UCS2stoUHCs() +{ + throw EXCEPTION(""); +} + +s32 SJIStoEUCJP() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoUTF16s() +{ + throw EXCEPTION(""); +} + +s32 SJISstoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 BIG5stoUCS2s() +{ + throw EXCEPTION(""); +} + +s32 UTF8stoUCS2s() +{ + throw EXCEPTION(""); +} + + Module cellL10n("cellL10n", []() { - // NOTE: I think this module should be LLE'd instead of implementing all its functions - - // REG_FUNC(cellL10n, UCS2toEUCJP); - // REG_FUNC(cellL10n, l10n_convert); - // REG_FUNC(cellL10n, UCS2toUTF32); - // REG_FUNC(cellL10n, jis2kuten); - // REG_FUNC(cellL10n, UTF8toGB18030); - // REG_FUNC(cellL10n, JISstoUTF8s); - // REG_FUNC(cellL10n, SjisZen2Han); - // REG_FUNC(cellL10n, ToSjisLower); - // REG_FUNC(cellL10n, UCS2toGB18030); - // REG_FUNC(cellL10n, HZstoUCS2s); - // REG_FUNC(cellL10n, UCS2stoHZs); - // REG_FUNC(cellL10n, UCS2stoSJISs); - // REG_FUNC(cellL10n, kuten2eucjp); - // REG_FUNC(cellL10n, sjis2jis); - // REG_FUNC(cellL10n, EUCKRstoUCS2s); - // REG_FUNC(cellL10n, UHCstoEUCKRs); - // REG_FUNC(cellL10n, jis2sjis); - // REG_FUNC(cellL10n, jstrnchk); - // REG_FUNC(cellL10n, L10nConvert); - // REG_FUNC(cellL10n, EUCCNstoUTF8s); - // REG_FUNC(cellL10n, GBKstoUCS2s); - // REG_FUNC(cellL10n, eucjphan2zen); - // REG_FUNC(cellL10n, ToSjisHira); - // REG_FUNC(cellL10n, GBKtoUCS2); - // REG_FUNC(cellL10n, eucjp2jis); - // REG_FUNC(cellL10n, UTF32stoUTF8s); - // REG_FUNC(cellL10n, sjishan2zen); - // REG_FUNC(cellL10n, UCS2toSBCS); - // REG_FUNC(cellL10n, UTF8stoGBKs); - // REG_FUNC(cellL10n, UTF8toUCS2); - // REG_FUNC(cellL10n, UCS2stoUTF8s); - // REG_FUNC(cellL10n, EUCKRstoUTF8s); - // REG_FUNC(cellL10n, UTF16stoUTF32s); - // REG_FUNC(cellL10n, UTF8toEUCKR); - // REG_FUNC(cellL10n, UTF16toUTF8); - // REG_FUNC(cellL10n, ARIBstoUTF8s); - // REG_FUNC(cellL10n, SJISstoUTF8s); - // REG_FUNC(cellL10n, sjiszen2han); - // REG_FUNC(cellL10n, ToEucJpLower); - // REG_FUNC(cellL10n, MSJIStoUTF8); - // REG_FUNC(cellL10n, UCS2stoMSJISs); - // REG_FUNC(cellL10n, EUCJPtoUTF8); - // REG_FUNC(cellL10n, eucjp2sjis); - // REG_FUNC(cellL10n, ToEucJpHira); - // REG_FUNC(cellL10n, UHCstoUCS2s); - // REG_FUNC(cellL10n, ToEucJpKata); - // REG_FUNC(cellL10n, HZstoUTF8s); - // REG_FUNC(cellL10n, UTF8toMSJIS); - // REG_FUNC(cellL10n, BIG5toUTF8); - // REG_FUNC(cellL10n, EUCJPstoSJISs); - // REG_FUNC(cellL10n, UTF8stoBIG5s); - // REG_FUNC(cellL10n, UTF16stoUCS2s); - // REG_FUNC(cellL10n, UCS2stoGB18030s); - // REG_FUNC(cellL10n, EUCJPtoSJIS); - // REG_FUNC(cellL10n, EUCJPtoUCS2); - // REG_FUNC(cellL10n, UCS2stoGBKs); - // REG_FUNC(cellL10n, EUCKRtoUHC); - // REG_FUNC(cellL10n, UCS2toSJIS); - // REG_FUNC(cellL10n, MSJISstoUTF8s); - // REG_FUNC(cellL10n, EUCJPstoUTF8s); - // REG_FUNC(cellL10n, UCS2toBIG5); - // REG_FUNC(cellL10n, UTF8stoEUCKRs); - // REG_FUNC(cellL10n, UHCstoUTF8s); - // REG_FUNC(cellL10n, GB18030stoUCS2s); - // REG_FUNC(cellL10n, SJIStoUTF8); - // REG_FUNC(cellL10n, JISstoSJISs); - // REG_FUNC(cellL10n, UTF8toUTF16); - // REG_FUNC(cellL10n, UTF8stoMSJISs); - // REG_FUNC(cellL10n, EUCKRtoUTF8); - // REG_FUNC(cellL10n, SjisHan2Zen); - // REG_FUNC(cellL10n, UCS2toUTF16); - // REG_FUNC(cellL10n, UCS2toMSJIS); - // REG_FUNC(cellL10n, sjis2kuten); - // REG_FUNC(cellL10n, UCS2toUHC); - // REG_FUNC(cellL10n, UTF32toUCS2); - // REG_FUNC(cellL10n, ToSjisUpper); - // REG_FUNC(cellL10n, UTF8toEUCJP); - // REG_FUNC(cellL10n, UCS2stoEUCJPs); - // REG_FUNC(cellL10n, UTF16toUCS2); - // REG_FUNC(cellL10n, UCS2stoUTF16s); - // REG_FUNC(cellL10n, UCS2stoEUCCNs); - // REG_FUNC(cellL10n, SBCSstoUTF8s); - // REG_FUNC(cellL10n, SJISstoJISs); - // REG_FUNC(cellL10n, SBCStoUTF8); - // REG_FUNC(cellL10n, UTF8toUTF32); + REG_FUNC(cellL10n, UCS2toEUCJP); + REG_FUNC(cellL10n, l10n_convert); + REG_FUNC(cellL10n, UCS2toUTF32); + REG_FUNC(cellL10n, jis2kuten); + REG_FUNC(cellL10n, UTF8toGB18030); + REG_FUNC(cellL10n, JISstoUTF8s); + REG_FUNC(cellL10n, SjisZen2Han); + REG_FUNC(cellL10n, ToSjisLower); + REG_FUNC(cellL10n, UCS2toGB18030); + REG_FUNC(cellL10n, HZstoUCS2s); + REG_FUNC(cellL10n, UCS2stoHZs); + REG_FUNC(cellL10n, UCS2stoSJISs); + REG_FUNC(cellL10n, kuten2eucjp); + REG_FUNC(cellL10n, sjis2jis); + REG_FUNC(cellL10n, EUCKRstoUCS2s); + REG_FUNC(cellL10n, UHCstoEUCKRs); + REG_FUNC(cellL10n, jis2sjis); + REG_FUNC(cellL10n, jstrnchk); + REG_FUNC(cellL10n, L10nConvert); + REG_FUNC(cellL10n, EUCCNstoUTF8s); + REG_FUNC(cellL10n, GBKstoUCS2s); + REG_FUNC(cellL10n, eucjphan2zen); + REG_FUNC(cellL10n, ToSjisHira); + REG_FUNC(cellL10n, GBKtoUCS2); + REG_FUNC(cellL10n, eucjp2jis); + REG_FUNC(cellL10n, UTF32stoUTF8s); + REG_FUNC(cellL10n, sjishan2zen); + REG_FUNC(cellL10n, UCS2toSBCS); + REG_FUNC(cellL10n, UTF8stoGBKs); + REG_FUNC(cellL10n, UTF8toUCS2); + REG_FUNC(cellL10n, UCS2stoUTF8s); + REG_FUNC(cellL10n, EUCKRstoUTF8s); + REG_FUNC(cellL10n, UTF16stoUTF32s); + REG_FUNC(cellL10n, UTF8toEUCKR); + REG_FUNC(cellL10n, UTF16toUTF8); + REG_FUNC(cellL10n, ARIBstoUTF8s); + REG_FUNC(cellL10n, SJISstoUTF8s); + REG_FUNC(cellL10n, sjiszen2han); + REG_FUNC(cellL10n, ToEucJpLower); + REG_FUNC(cellL10n, MSJIStoUTF8); + REG_FUNC(cellL10n, UCS2stoMSJISs); + REG_FUNC(cellL10n, EUCJPtoUTF8); + REG_FUNC(cellL10n, eucjp2sjis); + REG_FUNC(cellL10n, ToEucJpHira); + REG_FUNC(cellL10n, UHCstoUCS2s); + REG_FUNC(cellL10n, ToEucJpKata); + REG_FUNC(cellL10n, HZstoUTF8s); + REG_FUNC(cellL10n, UTF8toMSJIS); + REG_FUNC(cellL10n, BIG5toUTF8); + REG_FUNC(cellL10n, EUCJPstoSJISs); + REG_FUNC(cellL10n, UTF8stoBIG5s); + REG_FUNC(cellL10n, UTF16stoUCS2s); + REG_FUNC(cellL10n, UCS2stoGB18030s); + REG_FUNC(cellL10n, EUCJPtoSJIS); + REG_FUNC(cellL10n, EUCJPtoUCS2); + REG_FUNC(cellL10n, UCS2stoGBKs); + REG_FUNC(cellL10n, EUCKRtoUHC); + REG_FUNC(cellL10n, UCS2toSJIS); + REG_FUNC(cellL10n, MSJISstoUTF8s); + REG_FUNC(cellL10n, EUCJPstoUTF8s); + REG_FUNC(cellL10n, UCS2toBIG5); + REG_FUNC(cellL10n, UTF8stoEUCKRs); + REG_FUNC(cellL10n, UHCstoUTF8s); + REG_FUNC(cellL10n, GB18030stoUCS2s); + REG_FUNC(cellL10n, SJIStoUTF8); + REG_FUNC(cellL10n, JISstoSJISs); + REG_FUNC(cellL10n, UTF8toUTF16); + REG_FUNC(cellL10n, UTF8stoMSJISs); + REG_FUNC(cellL10n, EUCKRtoUTF8); + REG_FUNC(cellL10n, SjisHan2Zen); + REG_FUNC(cellL10n, UCS2toUTF16); + REG_FUNC(cellL10n, UCS2toMSJIS); + REG_FUNC(cellL10n, sjis2kuten); + REG_FUNC(cellL10n, UCS2toUHC); + REG_FUNC(cellL10n, UTF32toUCS2); + REG_FUNC(cellL10n, ToSjisUpper); + REG_FUNC(cellL10n, UTF8toEUCJP); + REG_FUNC(cellL10n, UCS2stoEUCJPs); + REG_FUNC(cellL10n, UTF16toUCS2); + REG_FUNC(cellL10n, UCS2stoUTF16s); + REG_FUNC(cellL10n, UCS2stoEUCCNs); + REG_FUNC(cellL10n, SBCSstoUTF8s); + REG_FUNC(cellL10n, SJISstoJISs); + REG_FUNC(cellL10n, SBCStoUTF8); + REG_FUNC(cellL10n, UTF8toUTF32); REG_FUNC(cellL10n, jstrchk); - // REG_FUNC(cellL10n, UHCtoEUCKR); - // REG_FUNC(cellL10n, kuten2jis); - // REG_FUNC(cellL10n, UTF8toEUCCN); - // REG_FUNC(cellL10n, EUCCNtoUTF8); - // REG_FUNC(cellL10n, EucJpZen2Han); - // REG_FUNC(cellL10n, UTF32stoUTF16s); - // REG_FUNC(cellL10n, GBKtoUTF8); - // REG_FUNC(cellL10n, ToEucJpUpper); - // REG_FUNC(cellL10n, UCS2stoJISs); - // REG_FUNC(cellL10n, UTF8stoGB18030s); - // REG_FUNC(cellL10n, EUCKRstoUHCs); - // REG_FUNC(cellL10n, UTF8stoUTF32s); - // REG_FUNC(cellL10n, UTF8stoEUCCNs); - // REG_FUNC(cellL10n, EUCJPstoUCS2s); - // REG_FUNC(cellL10n, UHCtoUCS2); + REG_FUNC(cellL10n, UHCtoEUCKR); + REG_FUNC(cellL10n, kuten2jis); + REG_FUNC(cellL10n, UTF8toEUCCN); + REG_FUNC(cellL10n, EUCCNtoUTF8); + REG_FUNC(cellL10n, EucJpZen2Han); + REG_FUNC(cellL10n, UTF32stoUTF16s); + REG_FUNC(cellL10n, GBKtoUTF8); + REG_FUNC(cellL10n, ToEucJpUpper); + REG_FUNC(cellL10n, UCS2stoJISs); + REG_FUNC(cellL10n, UTF8stoGB18030s); + REG_FUNC(cellL10n, EUCKRstoUHCs); + REG_FUNC(cellL10n, UTF8stoUTF32s); + REG_FUNC(cellL10n, UTF8stoEUCCNs); + REG_FUNC(cellL10n, EUCJPstoUCS2s); + REG_FUNC(cellL10n, UHCtoUCS2); REG_FUNC(cellL10n, L10nConvertStr); - // REG_FUNC(cellL10n, GBKstoUTF8s); - // REG_FUNC(cellL10n, UTF8toUHC); - // REG_FUNC(cellL10n, UTF32toUTF8); - // REG_FUNC(cellL10n, sjis2eucjp); - // REG_FUNC(cellL10n, UCS2toEUCCN); - // REG_FUNC(cellL10n, UTF8stoUHCs); - // REG_FUNC(cellL10n, EUCKRtoUCS2); - // REG_FUNC(cellL10n, UTF32toUTF16); - // REG_FUNC(cellL10n, EUCCNstoUCS2s); - // REG_FUNC(cellL10n, SBCSstoUCS2s); - // REG_FUNC(cellL10n, UTF8stoJISs); - // REG_FUNC(cellL10n, ToSjisKata); - // REG_FUNC(cellL10n, jis2eucjp); - // REG_FUNC(cellL10n, BIG5toUCS2); - // REG_FUNC(cellL10n, UCS2toGBK); - // REG_FUNC(cellL10n, UTF16toUTF32); - // REG_FUNC(cellL10n, l10n_convert_str); - // REG_FUNC(cellL10n, EUCJPstoJISs); - // REG_FUNC(cellL10n, UTF8stoARIBs); - // REG_FUNC(cellL10n, JISstoEUCJPs); - // REG_FUNC(cellL10n, EucJpHan2Zen); - // REG_FUNC(cellL10n, isEucJpKigou); - // REG_FUNC(cellL10n, UCS2toUTF8); - // REG_FUNC(cellL10n, GB18030toUCS2); - // REG_FUNC(cellL10n, UHCtoUTF8); - // REG_FUNC(cellL10n, MSJIStoUCS2); - // REG_FUNC(cellL10n, UTF8toGBK); - // REG_FUNC(cellL10n, kuten2sjis); - // REG_FUNC(cellL10n, UTF8toSBCS); - // REG_FUNC(cellL10n, SJIStoUCS2); - // REG_FUNC(cellL10n, eucjpzen2han); - // REG_FUNC(cellL10n, UCS2stoARIBs); - // REG_FUNC(cellL10n, isSjisKigou); - // REG_FUNC(cellL10n, UTF8stoEUCJPs); - // REG_FUNC(cellL10n, UCS2toEUCKR); - // REG_FUNC(cellL10n, SBCStoUCS2); - // REG_FUNC(cellL10n, MSJISstoUCS2s); - // REG_FUNC(cellL10n, l10n_get_converter); - // REG_FUNC(cellL10n, GB18030stoUTF8s); - // REG_FUNC(cellL10n, SJISstoEUCJPs); - // REG_FUNC(cellL10n, UTF32stoUCS2s); - // REG_FUNC(cellL10n, BIG5stoUTF8s); - // REG_FUNC(cellL10n, EUCCNtoUCS2); - // REG_FUNC(cellL10n, UTF8stoSBCSs); - // REG_FUNC(cellL10n, UCS2stoEUCKRs); - // REG_FUNC(cellL10n, UTF8stoSJISs); - // REG_FUNC(cellL10n, UTF8stoHZs); - // REG_FUNC(cellL10n, eucjp2kuten); - // REG_FUNC(cellL10n, UTF8toBIG5); + REG_FUNC(cellL10n, GBKstoUTF8s); + REG_FUNC(cellL10n, UTF8toUHC); + REG_FUNC(cellL10n, UTF32toUTF8); + REG_FUNC(cellL10n, sjis2eucjp); + REG_FUNC(cellL10n, UCS2toEUCCN); + REG_FUNC(cellL10n, UTF8stoUHCs); + REG_FUNC(cellL10n, EUCKRtoUCS2); + REG_FUNC(cellL10n, UTF32toUTF16); + REG_FUNC(cellL10n, EUCCNstoUCS2s); + REG_FUNC(cellL10n, SBCSstoUCS2s); + REG_FUNC(cellL10n, UTF8stoJISs); + REG_FUNC(cellL10n, ToSjisKata); + REG_FUNC(cellL10n, jis2eucjp); + REG_FUNC(cellL10n, BIG5toUCS2); + REG_FUNC(cellL10n, UCS2toGBK); + REG_FUNC(cellL10n, UTF16toUTF32); + REG_FUNC(cellL10n, l10n_convert_str); + REG_FUNC(cellL10n, EUCJPstoJISs); + REG_FUNC(cellL10n, UTF8stoARIBs); + REG_FUNC(cellL10n, JISstoEUCJPs); + REG_FUNC(cellL10n, EucJpHan2Zen); + REG_FUNC(cellL10n, isEucJpKigou); + REG_FUNC(cellL10n, UCS2toUTF8); + REG_FUNC(cellL10n, GB18030toUCS2); + REG_FUNC(cellL10n, UHCtoUTF8); + REG_FUNC(cellL10n, MSJIStoUCS2); + REG_FUNC(cellL10n, UTF8toGBK); + REG_FUNC(cellL10n, kuten2sjis); + REG_FUNC(cellL10n, UTF8toSBCS); + REG_FUNC(cellL10n, SJIStoUCS2); + REG_FUNC(cellL10n, eucjpzen2han); + REG_FUNC(cellL10n, UCS2stoARIBs); + REG_FUNC(cellL10n, isSjisKigou); + REG_FUNC(cellL10n, UTF8stoEUCJPs); + REG_FUNC(cellL10n, UCS2toEUCKR); + REG_FUNC(cellL10n, SBCStoUCS2); + REG_FUNC(cellL10n, MSJISstoUCS2s); + REG_FUNC(cellL10n, l10n_get_converter); + REG_FUNC(cellL10n, GB18030stoUTF8s); + REG_FUNC(cellL10n, SJISstoEUCJPs); + REG_FUNC(cellL10n, UTF32stoUCS2s); + REG_FUNC(cellL10n, BIG5stoUTF8s); + REG_FUNC(cellL10n, EUCCNtoUCS2); + REG_FUNC(cellL10n, UTF8stoSBCSs); + REG_FUNC(cellL10n, UCS2stoEUCKRs); + REG_FUNC(cellL10n, UTF8stoSJISs); + REG_FUNC(cellL10n, UTF8stoHZs); + REG_FUNC(cellL10n, eucjp2kuten); + REG_FUNC(cellL10n, UTF8toBIG5); REG_FUNC(cellL10n, UTF16stoUTF8s); - // REG_FUNC(cellL10n, JISstoUCS2s); - // REG_FUNC(cellL10n, GB18030toUTF8); - // REG_FUNC(cellL10n, UTF8toSJIS); - // REG_FUNC(cellL10n, ARIBstoUCS2s); - // REG_FUNC(cellL10n, UCS2stoUTF32s); - // REG_FUNC(cellL10n, UCS2stoSBCSs); - // REG_FUNC(cellL10n, UCS2stoBIG5s); - // REG_FUNC(cellL10n, UCS2stoUHCs); - // REG_FUNC(cellL10n, SJIStoEUCJP); - // REG_FUNC(cellL10n, UTF8stoUTF16s); - // REG_FUNC(cellL10n, SJISstoUCS2s); - // REG_FUNC(cellL10n, BIG5stoUCS2s); - // REG_FUNC(cellL10n, UTF8stoUCS2s); + REG_FUNC(cellL10n, JISstoUCS2s); + REG_FUNC(cellL10n, GB18030toUTF8); + REG_FUNC(cellL10n, UTF8toSJIS); + REG_FUNC(cellL10n, ARIBstoUCS2s); + REG_FUNC(cellL10n, UCS2stoUTF32s); + REG_FUNC(cellL10n, UCS2stoSBCSs); + REG_FUNC(cellL10n, UCS2stoBIG5s); + REG_FUNC(cellL10n, UCS2stoUHCs); + REG_FUNC(cellL10n, SJIStoEUCJP); + REG_FUNC(cellL10n, UTF8stoUTF16s); + REG_FUNC(cellL10n, SJISstoUCS2s); + REG_FUNC(cellL10n, BIG5stoUCS2s); + REG_FUNC(cellL10n, UTF8stoUCS2s); }); diff --git a/rpcs3/Emu/SysCalls/Modules/cellMic.cpp b/rpcs3/Emu/SysCalls/Modules/cellMic.cpp index 1328d9d589..83ff0fae6e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellMic.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellMic.cpp @@ -7,27 +7,10 @@ extern Module cellMic; -struct cellMicInternal -{ - bool m_bCellMicInitialized;; - - cellMicInternal() - : m_bCellMicInitialized(false) - { - } -}; - -cellMicInternal cellMicInstance; - s32 cellMicInit() { cellMic.Warning("cellMicInit()"); - if (cellMicInstance.m_bCellMicInitialized) - return CELL_MICIN_ERROR_ALREADY_INIT; - - cellMicInstance.m_bCellMicInitialized = true; - return CELL_OK; } @@ -35,11 +18,6 @@ s32 cellMicEnd() { cellMic.Warning("cellMicEnd()"); - if (!cellMicInstance.m_bCellMicInitialized) - return CELL_MICIN_ERROR_NOT_INIT; - - cellMicInstance.m_bCellMicInitialized = false; - return CELL_OK; } @@ -213,8 +191,7 @@ s32 cellMicGetStatus() s32 cellMicStopEx() { - UNIMPLEMENTED_FUNC(cellMic); - return CELL_OK; + throw EXCEPTION("Unexpected function"); } s32 cellMicSysShareClose() @@ -285,8 +262,6 @@ s32 cellMicGetDeviceIdentifier() Module cellMic("cellMic", []() { - cellMicInstance.m_bCellMicInitialized = false; - REG_FUNC(cellMic, cellMicInit); REG_FUNC(cellMic, cellMicEnd); REG_FUNC(cellMic, cellMicOpen); @@ -322,7 +297,7 @@ Module cellMic("cellMic", []() REG_FUNC(cellMic, cellMicReadDsp); REG_FUNC(cellMic, cellMicGetStatus); - REG_FUNC(cellMic, cellMicStopEx); + REG_FUNC(cellMic, cellMicStopEx); // this function shouldn't exist REG_FUNC(cellMic, cellMicSysShareClose); REG_FUNC(cellMic, cellMicGetFormat); REG_FUNC(cellMic, cellMicSetMultiMicNotifyEventQueue); diff --git a/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.cpp b/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.cpp index 485635e15d..e97ff5c9c3 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.cpp @@ -14,7 +14,6 @@ extern u64 get_system_time(); std::unique_ptr g_msg_dialog; MsgDialogInstance::MsgDialogInstance() - : state(msgDialogNone) { } @@ -24,6 +23,11 @@ void MsgDialogInstance::Close() wait_until = get_system_time(); } +s32 cellMsgDialogOpen() +{ + throw EXCEPTION(""); +} + s32 cellMsgDialogOpen2(u32 type, vm::cptr msgString, vm::ptr callback, vm::ptr userData, vm::ptr extParam) { cellSysutil.Warning("cellMsgDialogOpen2(type=0x%x, msgString=*0x%x, callback=*0x%x, userData=*0x%x, extParam=*0x%x)", type, msgString, callback, userData, extParam); @@ -83,7 +87,7 @@ s32 cellMsgDialogOpen2(u32 type, vm::cptr msgString, vm::ptrstate.compare_exchange_strong(old, msgDialogOpen)) + if (!g_msg_dialog->state.compare_exchange_strong(old, msgDialogInit)) { return CELL_SYSUTIL_ERROR_BUSY; } @@ -105,33 +109,45 @@ s32 cellMsgDialogOpen2(u32 type, vm::cptr msgString, vm::ptrstatus = CELL_MSGDIALOG_BUTTON_NONE; + + CallAfter([type, msg]() + { + if (Emu.IsStopped()) + { + g_msg_dialog->state.exchange(msgDialogNone); + + return; + } + + g_msg_dialog->Create(type, msg); + + g_msg_dialog->state.exchange(msgDialogOpen); + }); + + while (g_msg_dialog->state == msgDialogInit) + { + if (Emu.IsStopped()) + { + if (g_msg_dialog->state != msgDialogNone) + { + break; + } + + CHECK_EMU_STATUS; + } + + std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack + } + thread_t(WRAP_EXPR("MsgDialog Thread"), [=]() { - switch (type & CELL_MSGDIALOG_TYPE_SE_TYPE) - { - case CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL: cellSysutil.Warning("%s", msg); break; - case CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR: cellSysutil.Error("%s", msg); break; - } - - g_msg_dialog->status = CELL_MSGDIALOG_BUTTON_NONE; - - volatile bool m_signal = false; - CallAfter([type, msg, &m_signal]() - { - if (Emu.IsStopped()) return; - - g_msg_dialog->Create(type, msg); - - m_signal = true; - }); - - while (!m_signal) - { - CHECK_EMU_STATUS; - - std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack - } - while (g_msg_dialog->state == msgDialogOpen || (s64)(get_system_time() - g_msg_dialog->wait_until) < 0) { if (Emu.IsStopped()) @@ -142,7 +158,7 @@ s32 cellMsgDialogOpen2(u32 type, vm::cptr msgString, vm::ptrstate != msgDialogAbort)) + if (callback && g_msg_dialog->state != msgDialogAbort) { const s32 status = g_msg_dialog->status; @@ -245,6 +261,11 @@ s32 cellMsgDialogOpenErrorCode(PPUThread& CPU, u32 errorCode, vm::ptrstate = msgDialogNone; + + REG_FUNC(cellSysutil, cellMsgDialogOpen); REG_FUNC(cellSysutil, cellMsgDialogOpen2); REG_FUNC(cellSysutil, cellMsgDialogOpenErrorCode); + REG_FUNC(cellSysutil, cellMsgDialogOpenSimulViewWarning); REG_FUNC(cellSysutil, cellMsgDialogProgressBarSetMsg); REG_FUNC(cellSysutil, cellMsgDialogProgressBarReset); REG_FUNC(cellSysutil, cellMsgDialogProgressBarInc); diff --git a/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.h b/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.h index f861c054af..41664c1b96 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.h +++ b/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.h @@ -82,11 +82,12 @@ enum : s32 CELL_MSGDIALOG_BUTTON_ESCAPE = 3, }; -typedef void(CellMsgDialogCallback)(s32 buttonType, vm::ptr userData); +using CellMsgDialogCallback = void(s32 buttonType, vm::ptr userData); enum MsgDialogState { msgDialogNone, + msgDialogInit, msgDialogOpen, msgDialogClose, msgDialogAbort, @@ -96,9 +97,9 @@ struct MsgDialogInstance { std::atomic state; - s32 status = 0; - u64 wait_until = 0; - u32 progress_bar_count = 0; + s32 status; + u64 wait_until; + u32 progress_bar_count; MsgDialogInstance(); virtual ~MsgDialogInstance() = default; diff --git a/rpcs3/Emu/SysCalls/Modules/cellMusic.cpp b/rpcs3/Emu/SysCalls/Modules/cellMusic.cpp new file mode 100644 index 0000000000..ed3b438b2d --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellMusic.cpp @@ -0,0 +1,142 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellMusic; + +s32 cellMusicGetSelectionContext() +{ + throw EXCEPTION(""); +} + +s32 cellMusicSetSelectionContext2() +{ + throw EXCEPTION(""); +} + +s32 cellMusicSetVolume2() +{ + throw EXCEPTION(""); +} + +s32 cellMusicGetContentsId() +{ + throw EXCEPTION(""); +} + +s32 cellMusicSetSelectionContext() +{ + throw EXCEPTION(""); +} + +s32 cellMusicInitialize2SystemWorkload() +{ + throw EXCEPTION(""); +} + +s32 cellMusicGetPlaybackStatus2() +{ + throw EXCEPTION(""); +} + +s32 cellMusicGetContentsId2() +{ + throw EXCEPTION(""); +} + +s32 cellMusicFinalize() +{ + throw EXCEPTION(""); +} + +s32 cellMusicInitializeSystemWorkload() +{ + throw EXCEPTION(""); +} + +s32 cellMusicInitialize() +{ + throw EXCEPTION(""); +} + +s32 cellMusicFinalize2() +{ + throw EXCEPTION(""); +} + +s32 cellMusicGetSelectionContext2() +{ + throw EXCEPTION(""); +} + +s32 cellMusicGetVolume() +{ + throw EXCEPTION(""); +} + +s32 cellMusicGetPlaybackStatus() +{ + throw EXCEPTION(""); +} + +s32 cellMusicSetPlaybackCommand2() +{ + throw EXCEPTION(""); +} + +s32 cellMusicSetPlaybackCommand() +{ + throw EXCEPTION(""); +} + +s32 cellMusicSelectContents2() +{ + throw EXCEPTION(""); +} + +s32 cellMusicSelectContents() +{ + throw EXCEPTION(""); +} + +s32 cellMusicInitialize2() +{ + throw EXCEPTION(""); +} + +s32 cellMusicSetVolume() +{ + throw EXCEPTION(""); +} + +s32 cellMusicGetVolume2() +{ + throw EXCEPTION(""); +} + + +Module cellMusic("cellMusic", []() +{ + REG_FUNC(cellMusic, cellMusicGetSelectionContext); + REG_FUNC(cellMusic, cellMusicSetSelectionContext2); + REG_FUNC(cellMusic, cellMusicSetVolume2); + REG_FUNC(cellMusic, cellMusicGetContentsId); + REG_FUNC(cellMusic, cellMusicSetSelectionContext); + REG_FUNC(cellMusic, cellMusicInitialize2SystemWorkload); + REG_FUNC(cellMusic, cellMusicGetPlaybackStatus2); + REG_FUNC(cellMusic, cellMusicGetContentsId2); + REG_FUNC(cellMusic, cellMusicFinalize); + REG_FUNC(cellMusic, cellMusicInitializeSystemWorkload); + REG_FUNC(cellMusic, cellMusicInitialize); + REG_FUNC(cellMusic, cellMusicFinalize2); + REG_FUNC(cellMusic, cellMusicGetSelectionContext2); + REG_FUNC(cellMusic, cellMusicGetVolume); + REG_FUNC(cellMusic, cellMusicGetPlaybackStatus); + REG_FUNC(cellMusic, cellMusicSetPlaybackCommand2); + REG_FUNC(cellMusic, cellMusicSetPlaybackCommand); + REG_FUNC(cellMusic, cellMusicSelectContents2); + REG_FUNC(cellMusic, cellMusicSelectContents); + REG_FUNC(cellMusic, cellMusicInitialize2); + REG_FUNC(cellMusic, cellMusicSetVolume); + REG_FUNC(cellMusic, cellMusicGetVolume2); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellMusicDecode.cpp b/rpcs3/Emu/SysCalls/Modules/cellMusicDecode.cpp index da47cfdcef..f0fbb5dcd7 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellMusicDecode.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellMusicDecode.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellMusicDecode_init(); -Module cellMusicDecode(0x004f, cellMusicDecode_init); +extern Module cellMusicDecode; // Return Codes enum @@ -24,67 +24,128 @@ enum CELL_MUSIC_DECODE_ERROR_GENERIC = 0x8002C1FF, }; -int cellMusicDecodeInitialize() +s32 cellMusicDecodeInitialize() { UNIMPLEMENTED_FUNC(cellMusicDecode); return CELL_OK; } -int cellMusicDecodeInitializeSystemWorkload() +s32 cellMusicDecodeInitializeSystemWorkload() { UNIMPLEMENTED_FUNC(cellMusicDecode); return CELL_OK; } -int cellMusicDecodeFinalize() +s32 cellMusicDecodeFinalize() { UNIMPLEMENTED_FUNC(cellMusicDecode); return CELL_OK; } -int cellMusicDecodeSelectContents() +s32 cellMusicDecodeSelectContents() { UNIMPLEMENTED_FUNC(cellMusicDecode); return CELL_OK; } -int cellMusicDecodeSetDecodeCommand() +s32 cellMusicDecodeSetDecodeCommand() { UNIMPLEMENTED_FUNC(cellMusicDecode); return CELL_OK; } -int cellMusicDecodeGetDecodeStatus() +s32 cellMusicDecodeGetDecodeStatus() { UNIMPLEMENTED_FUNC(cellMusicDecode); return CELL_OK; } -int cellMusicDecodeRead() +s32 cellMusicDecodeRead() { UNIMPLEMENTED_FUNC(cellMusicDecode); return CELL_OK; } -int cellMusicDecodeGetSelectionContext() +s32 cellMusicDecodeGetSelectionContext() { UNIMPLEMENTED_FUNC(cellMusicDecode); return CELL_OK; } -int cellMusicDecodeSetSelectionContext() +s32 cellMusicDecodeSetSelectionContext() { UNIMPLEMENTED_FUNC(cellMusicDecode); return CELL_OK; } -int cellMusicDecodeGetContentsId() +s32 cellMusicDecodeGetContentsId() { UNIMPLEMENTED_FUNC(cellMusicDecode); return CELL_OK; } -void cellMusicDecode_init() +s32 cellMusicDecodeInitialize2() +{ + UNIMPLEMENTED_FUNC(cellMusicDecode); + return CELL_OK; +} + +s32 cellMusicDecodeInitialize2SystemWorkload() +{ + UNIMPLEMENTED_FUNC(cellMusicDecode); + return CELL_OK; +} + +s32 cellMusicDecodeFinalize2() +{ + UNIMPLEMENTED_FUNC(cellMusicDecode); + return CELL_OK; +} + +s32 cellMusicDecodeSelectContents2() +{ + UNIMPLEMENTED_FUNC(cellMusicDecode); + return CELL_OK; +} + +s32 cellMusicDecodeSetDecodeCommand2() +{ + UNIMPLEMENTED_FUNC(cellMusicDecode); + return CELL_OK; +} + +s32 cellMusicDecodeGetDecodeStatus2() +{ + UNIMPLEMENTED_FUNC(cellMusicDecode); + return CELL_OK; +} + +s32 cellMusicDecodeRead2() +{ + UNIMPLEMENTED_FUNC(cellMusicDecode); + return CELL_OK; +} + +s32 cellMusicDecodeGetSelectionContext2() +{ + UNIMPLEMENTED_FUNC(cellMusicDecode); + return CELL_OK; +} + +s32 cellMusicDecodeSetSelectionContext2() +{ + UNIMPLEMENTED_FUNC(cellMusicDecode); + return CELL_OK; +} + +s32 cellMusicDecodeGetContentsId2() +{ + UNIMPLEMENTED_FUNC(cellMusicDecode); + return CELL_OK; +} + + +Module cellMusicDecode("cellMusicDecode", []() { REG_FUNC(cellMusicDecode, cellMusicDecodeInitialize); REG_FUNC(cellMusicDecode, cellMusicDecodeInitializeSystemWorkload); @@ -96,5 +157,15 @@ void cellMusicDecode_init() REG_FUNC(cellMusicDecode, cellMusicDecodeGetSelectionContext); REG_FUNC(cellMusicDecode, cellMusicDecodeSetSelectionContext); REG_FUNC(cellMusicDecode, cellMusicDecodeGetContentsId); -} -#endif + + REG_FUNC(cellMusicDecode, cellMusicDecodeInitialize2); + REG_FUNC(cellMusicDecode, cellMusicDecodeInitialize2SystemWorkload); + REG_FUNC(cellMusicDecode, cellMusicDecodeFinalize2); + REG_FUNC(cellMusicDecode, cellMusicDecodeSelectContents2); + REG_FUNC(cellMusicDecode, cellMusicDecodeSetDecodeCommand2); + REG_FUNC(cellMusicDecode, cellMusicDecodeGetDecodeStatus2); + REG_FUNC(cellMusicDecode, cellMusicDecodeRead2); + REG_FUNC(cellMusicDecode, cellMusicDecodeGetSelectionContext2); + REG_FUNC(cellMusicDecode, cellMusicDecodeSetSelectionContext2); + REG_FUNC(cellMusicDecode, cellMusicDecodeGetContentsId2); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellMusicExport.cpp b/rpcs3/Emu/SysCalls/Modules/cellMusicExport.cpp index 0eccd57292..571a4a5e88 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellMusicExport.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellMusicExport.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellMusicExport_init(); -Module cellMusicExport(0xf02c, cellMusicExport_init); +extern Module cellMusicExport; // Return Codes enum @@ -21,42 +21,41 @@ enum CELL_MUSIC_EXPORT_UTIL_ERROR_INITIALIZE = 0x8002c60a, }; -int cellMusicExportInitialize() +s32 cellMusicExportInitialize() { UNIMPLEMENTED_FUNC(cellMusicExport); return CELL_OK; } -int cellMusicExportInitialize2() +s32 cellMusicExportInitialize2() { UNIMPLEMENTED_FUNC(cellMusicExport); return CELL_OK; } -int cellMusicExportFinalize() +s32 cellMusicExportFinalize() { UNIMPLEMENTED_FUNC(cellMusicExport); return CELL_OK; } -int cellMusicExportFromFile() +s32 cellMusicExportFromFile() { UNIMPLEMENTED_FUNC(cellMusicExport); return CELL_OK; } -int cellMusicExportProgress() +s32 cellMusicExportProgress() { UNIMPLEMENTED_FUNC(cellMusicExport); return CELL_OK; } -void cellMusicExport_init() +Module cellMusicExport("cellMusicExport", []() { REG_FUNC(cellMusicExport, cellMusicExportInitialize); REG_FUNC(cellMusicExport, cellMusicExportInitialize2); REG_FUNC(cellMusicExport, cellMusicExportFinalize); REG_FUNC(cellMusicExport, cellMusicExportFromFile); REG_FUNC(cellMusicExport, cellMusicExportProgress); -} -#endif +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp b/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp index cf0e011d14..6eae2852de 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp @@ -28,32 +28,16 @@ extern Module cellNetCtl; -std::unique_ptr g_netCtl; - s32 cellNetCtlInit() { - cellNetCtl.Log("cellNetCtlInit()"); - - if (g_netCtl->m_bInitialized) - { - return CELL_NET_CTL_ERROR_NOT_TERMINATED; - } - - g_netCtl->m_bInitialized = true; + cellNetCtl.Warning("cellNetCtlInit()"); return CELL_OK; } s32 cellNetCtlTerm() { - cellNetCtl.Log("cellNetCtlTerm()"); - - if (!g_netCtl->m_bInitialized) - { - return CELL_NET_CTL_ERROR_NOT_INITIALIZED; - } - - g_netCtl->m_bInitialized = false; + cellNetCtl.Warning("cellNetCtlTerm()"); return CELL_OK; } @@ -268,10 +252,55 @@ s32 cellNetCtlGetNatInfo(vm::ptr natInfo) return CELL_OK; } +s32 cellGameUpdateInit() +{ + throw EXCEPTION(""); +} + +s32 cellGameUpdateTerm() +{ + throw EXCEPTION(""); +} + + +s32 cellGameUpdateCheckStartAsync() +{ + throw EXCEPTION(""); +} + +s32 cellGameUpdateCheckFinishAsync() +{ + throw EXCEPTION(""); +} + +s32 cellGameUpdateCheckStartWithoutDialogAsync() +{ + throw EXCEPTION(""); +} + +s32 cellGameUpdateCheckAbort() +{ + throw EXCEPTION(""); +} + +s32 cellGameUpdateCheckStartAsyncEx() +{ + throw EXCEPTION(""); +} + +s32 cellGameUpdateCheckFinishAsyncEx() +{ + throw EXCEPTION(""); +} + +s32 cellGameUpdateCheckStartWithoutDialogAsyncEx() +{ + throw EXCEPTION(""); +} + + Module cellNetCtl("cellNetCtl", []() { - g_netCtl = std::make_unique(); - REG_FUNC(cellNetCtl, cellNetCtlInit); REG_FUNC(cellNetCtl, cellNetCtlTerm); @@ -286,4 +315,15 @@ Module cellNetCtl("cellNetCtl", []() REG_FUNC(cellNetCtl, cellNetCtlNetStartDialogUnloadAsync); REG_FUNC(cellNetCtl, cellNetCtlGetNatInfo); + + REG_FUNC(cellNetCtl, cellGameUpdateInit); + REG_FUNC(cellNetCtl, cellGameUpdateTerm); + + REG_FUNC(cellNetCtl, cellGameUpdateCheckStartAsync); + REG_FUNC(cellNetCtl, cellGameUpdateCheckFinishAsync); + REG_FUNC(cellNetCtl, cellGameUpdateCheckStartWithoutDialogAsync); + REG_FUNC(cellNetCtl, cellGameUpdateCheckAbort); + REG_FUNC(cellNetCtl, cellGameUpdateCheckStartAsyncEx); + REG_FUNC(cellNetCtl, cellGameUpdateCheckFinishAsyncEx); + REG_FUNC(cellNetCtl, cellGameUpdateCheckStartWithoutDialogAsyncEx); }); diff --git a/rpcs3/Emu/SysCalls/Modules/cellNetCtl.h b/rpcs3/Emu/SysCalls/Modules/cellNetCtl.h index 603aaef607..65275e4c62 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellNetCtl.h +++ b/rpcs3/Emu/SysCalls/Modules/cellNetCtl.h @@ -196,18 +196,6 @@ enum CELL_NET_CTL_NATINFO_NAT_TYPE_3 = 3, }; -struct CellNetCtlInternal -{ - bool m_bInitialized; - - CellNetCtlInternal() - : m_bInitialized(false) - { - } -}; - -extern std::unique_ptr g_netCtl; - struct CellNetCtlEtherAddr { u8 data[6]; diff --git a/rpcs3/Emu/SysCalls/Modules/cellOskDialog.cpp b/rpcs3/Emu/SysCalls/Modules/cellOskDialog.cpp new file mode 100644 index 0000000000..1a0ead6313 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellOskDialog.cpp @@ -0,0 +1,193 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellOskDialog; + +s32 cellOskDialogLoadAsync() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogUnloadAsync() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogGetSize() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogAbort() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogSetDeviceMask() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogSetSeparateWindowOption() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogSetInitialInputDevice() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogSetInitialKeyLayout() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogDisableDimmer() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogSetKeyLayoutOption() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogAddSupportLanguage() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogSetLayoutMode() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogGetInputText() +{ + throw EXCEPTION(""); +} + + +s32 cellOskDialogExtInputDeviceUnlock() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtRegisterKeyboardEventHookCallback() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtAddJapaneseOptionDictionary() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtEnableClipboard() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtSendFinishMessage() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtAddOptionDictionary() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtSetInitialScale() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtInputDeviceLock() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtSetBaseColor() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtRegisterConfirmWordFilterCallback() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtUpdateInputText() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtDisableHalfByteKana() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtSetPointerEnable() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtUpdatePointerDisplayPos() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtEnableHalfByteKana() +{ + throw EXCEPTION(""); +} + +s32 cellOskDialogExtRegisterForceFinishCallback() +{ + throw EXCEPTION(""); +} + + +void cellSysutil_OskDialog_init() +{ + extern Module cellSysutil; + + // cellOskDialog functions: + REG_FUNC(cellSysutil, cellOskDialogLoadAsync); + REG_FUNC(cellSysutil, cellOskDialogUnloadAsync); + REG_FUNC(cellSysutil, cellOskDialogGetSize); + REG_FUNC(cellSysutil, cellOskDialogAbort); + REG_FUNC(cellSysutil, cellOskDialogSetDeviceMask); + REG_FUNC(cellSysutil, cellOskDialogSetSeparateWindowOption); + REG_FUNC(cellSysutil, cellOskDialogSetInitialInputDevice); + REG_FUNC(cellSysutil, cellOskDialogSetInitialKeyLayout); + REG_FUNC(cellSysutil, cellOskDialogDisableDimmer); + REG_FUNC(cellSysutil, cellOskDialogSetKeyLayoutOption); + REG_FUNC(cellSysutil, cellOskDialogAddSupportLanguage); + REG_FUNC(cellSysutil, cellOskDialogSetLayoutMode); + REG_FUNC(cellSysutil, cellOskDialogGetInputText); +} + +Module cellOskDialog("cellOskDialog", []() +{ + // cellOskDialogExt functions: + REG_FUNC(cellOskDialog, cellOskDialogExtInputDeviceUnlock); + REG_FUNC(cellOskDialog, cellOskDialogExtRegisterKeyboardEventHookCallback); + REG_FUNC(cellOskDialog, cellOskDialogExtAddJapaneseOptionDictionary); + REG_FUNC(cellOskDialog, cellOskDialogExtEnableClipboard); + REG_FUNC(cellOskDialog, cellOskDialogExtSendFinishMessage); + REG_FUNC(cellOskDialog, cellOskDialogExtAddOptionDictionary); + REG_FUNC(cellOskDialog, cellOskDialogExtSetInitialScale); + REG_FUNC(cellOskDialog, cellOskDialogExtInputDeviceLock); + REG_FUNC(cellOskDialog, cellOskDialogExtSetBaseColor); + REG_FUNC(cellOskDialog, cellOskDialogExtRegisterConfirmWordFilterCallback); + REG_FUNC(cellOskDialog, cellOskDialogExtUpdateInputText); + REG_FUNC(cellOskDialog, cellOskDialogExtDisableHalfByteKana); + REG_FUNC(cellOskDialog, cellOskDialogExtSetPointerEnable); + REG_FUNC(cellOskDialog, cellOskDialogExtUpdatePointerDisplayPos); + REG_FUNC(cellOskDialog, cellOskDialogExtEnableHalfByteKana); + REG_FUNC(cellOskDialog, cellOskDialogExtRegisterForceFinishCallback); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellPad.cpp b/rpcs3/Emu/SysCalls/Modules/cellPad.cpp index 6f84a61b73..4ec390e81b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPad.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPad.cpp @@ -83,6 +83,11 @@ s32 cellPadPeriphGetInfo(vm::ptr info) return CELL_OK; } +s32 cellPadPeriphGetData() +{ + throw EXCEPTION(""); +} + s32 cellPadGetData(u32 port_no, vm::ptr data) { sys_io.Log("cellPadGetData(port_no=%d, data=*0x%x)", port_no, data); @@ -262,6 +267,11 @@ s32 cellPadGetData(u32 port_no, vm::ptr data) return CELL_OK; } +s32 cellPadGetRawData(u32 port_no, vm::ptr data) +{ + throw EXCEPTION(""); +} + s32 cellPadGetDataExtra(u32 port_no, vm::ptr device_type, vm::ptr data) { sys_io.Log("cellPadGetDataExtra(port_no=%d, device_type=*0x%x, device_type=*0x%x)", port_no, device_type, data); @@ -526,23 +536,26 @@ s32 cellPadLddUnregisterController(s32 handle) return CELL_OK; } + void cellPad_init() { REG_FUNC(sys_io, cellPadInit); REG_FUNC(sys_io, cellPadEnd); REG_FUNC(sys_io, cellPadClearBuf); REG_FUNC(sys_io, cellPadGetData); + REG_FUNC(sys_io, cellPadGetRawData); // REG_FUNC(sys_io, cellPadGetDataExtra); REG_FUNC(sys_io, cellPadSetActDirect); - REG_FUNC(sys_io, cellPadGetInfo); + REG_FUNC(sys_io, cellPadGetInfo); // REG_FUNC(sys_io, cellPadGetInfo2); REG_FUNC(sys_io, cellPadPeriphGetInfo); + REG_FUNC(sys_io, cellPadPeriphGetData); REG_FUNC(sys_io, cellPadSetPortSetting); - REG_FUNC(sys_io, cellPadInfoPressMode); - REG_FUNC(sys_io, cellPadInfoSensorMode); - REG_FUNC(sys_io, cellPadSetPressMode); - REG_FUNC(sys_io, cellPadSetSensorMode); - REG_FUNC(sys_io, cellPadGetCapabilityInfo); + REG_FUNC(sys_io, cellPadInfoPressMode); // + REG_FUNC(sys_io, cellPadInfoSensorMode); // + REG_FUNC(sys_io, cellPadSetPressMode); // + REG_FUNC(sys_io, cellPadSetSensorMode); // + REG_FUNC(sys_io, cellPadGetCapabilityInfo); // REG_FUNC(sys_io, cellPadLddRegisterController); REG_FUNC(sys_io, cellPadLddDataInsert); REG_FUNC(sys_io, cellPadLddGetPortNo); diff --git a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp index b08b31ccc5..b954f0ad0b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp @@ -458,7 +458,7 @@ s32 cellPamfReaderGetEsFilterId(vm::ptr pSelf, vm::ptr pSelf, vm::ptr pInfo, u32 size) { - cellPamf.Warning("cellPamfReaderGetStreamInfo(pSelf=*0x%x, pInfo_addr=0x%x, size=%d)", pSelf, pInfo, size); + cellPamf.Warning("cellPamfReaderGetStreamInfo(pSelf=*0x%x, pInfo=*0x%x, size=%d)", pSelf, pInfo, size); assert((u32)pSelf->stream < (u32)pSelf->pAddr->stream_count); auto& header = pSelf->pAddr->stream_headers[pSelf->stream]; diff --git a/rpcs3/Emu/SysCalls/Modules/cellPamf.h b/rpcs3/Emu/SysCalls/Modules/cellPamf.h index d919b491ea..823a1b564f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPamf.h +++ b/rpcs3/Emu/SysCalls/Modules/cellPamf.h @@ -157,7 +157,7 @@ struct CellPamfEp // Entry point iterator struct CellPamfEpIterator { - bool isPamf; + b8 isPamf; be_t index; be_t num; be_t pCur_addr; diff --git a/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp b/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp index a69b587650..f0eb743eb0 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellPhotoDecode_init(); -Module cellPhotoDecode(0xf02e, cellPhotoDecode_init); +extern Module cellPhotoDecode; // Return Codes enum @@ -32,35 +32,34 @@ struct CellPhotoDecodeReturnParam }; // Functions -int cellPhotoDecodeInitialize() +s32 cellPhotoDecodeInitialize() { UNIMPLEMENTED_FUNC(cellPhotoDecode); return CELL_OK; } -int cellPhotoDecodeInitialize2() +s32 cellPhotoDecodeInitialize2() { UNIMPLEMENTED_FUNC(cellPhotoDecode); return CELL_OK; } -int cellPhotoDecodeFinalize() +s32 cellPhotoDecodeFinalize() { UNIMPLEMENTED_FUNC(cellPhotoDecode); return CELL_OK; } -int cellPhotoDecodeFromFile() +s32 cellPhotoDecodeFromFile() { UNIMPLEMENTED_FUNC(cellPhotoDecode); return CELL_OK; } -void cellPhotoDecode_init() +Module cellPhotoDecode("cellPhotoDecode", []() { REG_FUNC(cellPhotoDecode, cellPhotoDecodeInitialize); REG_FUNC(cellPhotoDecode, cellPhotoDecodeInitialize2); REG_FUNC(cellPhotoDecode, cellPhotoDecodeFinalize); REG_FUNC(cellPhotoDecode, cellPhotoDecodeFromFile); -} -#endif +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellPhotoExport.cpp b/rpcs3/Emu/SysCalls/Modules/cellPhotoExport.cpp index 1e5b1fd375..998a24b51e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPhotoExport.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPhotoExport.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellPhotoExport_init(); -Module cellPhotoExport(0xf029, cellPhotoExport_init); +extern Module cellPhotoExport; // Return Codes enum @@ -21,43 +21,69 @@ enum CELL_PHOTO_EXPORT_UTIL_ERROR_INITIALIZE = 0x8002c20a, }; -int cellPhotoExportInitialize() +s32 cellPhotoInitialize() { UNIMPLEMENTED_FUNC(cellPhotoExport); return CELL_OK; } -int cellPhotoExportInitialize2() +s32 cellPhotoFinalize() { UNIMPLEMENTED_FUNC(cellPhotoExport); return CELL_OK; } -int cellPhotoExportFinalize() +s32 cellPhotoRegistFromFile() { UNIMPLEMENTED_FUNC(cellPhotoExport); return CELL_OK; } -int cellPhotoExportFromFile() +s32 cellPhotoExportInitialize() { UNIMPLEMENTED_FUNC(cellPhotoExport); return CELL_OK; } -int cellPhotoExportProgress() +s32 cellPhotoExportInitialize2() { UNIMPLEMENTED_FUNC(cellPhotoExport); return CELL_OK; } -void cellPhotoExport_init() +s32 cellPhotoExportFinalize() { + UNIMPLEMENTED_FUNC(cellPhotoExport); + return CELL_OK; +} + +s32 cellPhotoExportFromFile() +{ + UNIMPLEMENTED_FUNC(cellPhotoExport); + return CELL_OK; +} + +s32 cellPhotoExportFromFileWithCopy() +{ + UNIMPLEMENTED_FUNC(cellPhotoExport); + return CELL_OK; +} + +s32 cellPhotoExportProgress() +{ + UNIMPLEMENTED_FUNC(cellPhotoExport); + return CELL_OK; +} + +Module cellPhotoExport("cellPhotoExport", []() +{ + REG_FUNC(cellPhotoExport, cellPhotoInitialize); + REG_FUNC(cellPhotoExport, cellPhotoFinalize); + REG_FUNC(cellPhotoExport, cellPhotoRegistFromFile); REG_FUNC(cellPhotoExport, cellPhotoExportInitialize); REG_FUNC(cellPhotoExport, cellPhotoExportInitialize2); REG_FUNC(cellPhotoExport, cellPhotoExportFinalize); REG_FUNC(cellPhotoExport, cellPhotoExportFromFile); - //cellPhotoExport.AddFunc(, cellPhotoExportFromFileWithCopy); + REG_FUNC(cellPhotoExport, cellPhotoExportFromFileWithCopy); REG_FUNC(cellPhotoExport, cellPhotoExportProgress); -} -#endif +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellPhotoImport.cpp b/rpcs3/Emu/SysCalls/Modules/cellPhotoImport.cpp index e655d86bba..eaa9f3fe73 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPhotoImport.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPhotoImport.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellPhotoImport_init(); -Module cellPhotoImport(0xf02b, cellPhotoImport_init); +extern Module cellPhotoImportUtil; // Return Codes enum @@ -41,21 +41,20 @@ struct CellPhotoImportSetParam }; // Functions -int _cellPhotoImport() +s32 cellPhotoImport() { - UNIMPLEMENTED_FUNC(cellPhotoImport); + UNIMPLEMENTED_FUNC(cellPhotoImportUtil); return CELL_OK; } -int _cellPhotoImport2() +s32 cellPhotoImport2() { - UNIMPLEMENTED_FUNC(cellPhotoImport); + UNIMPLEMENTED_FUNC(cellPhotoImportUtil); return CELL_OK; } -void cellPhotoImport_init() +Module cellPhotoImportUtil("cellPhotoImport", []() { - REG_FUNC(cellPhotoImport, _cellPhotoImport); - REG_FUNC(cellPhotoImport, _cellPhotoImport2); -} -#endif + REG_FUNC(cellPhotoImportUtil, cellPhotoImport); + REG_FUNC(cellPhotoImportUtil, cellPhotoImport2); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngDec.h b/rpcs3/Emu/SysCalls/Modules/cellPngDec.h index 9606576d2f..4996622d72 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngDec.h +++ b/rpcs3/Emu/SysCalls/Modules/cellPngDec.h @@ -88,8 +88,8 @@ using CellPngDecMainHandle = vm::ptr; using CellPngDecSubHandle = vm::ptr; // Callbacks for memory management -using CellPngDecCbControlMalloc = func_def(u32 size, vm::ptr cbCtrlMallocArg)>; -using CellPngDecCbControlFree = func_def ptr, vm::ptr cbCtrlFreeArg)>; +using CellPngDecCbControlMalloc = vm::ptr(u32 size, vm::ptr cbCtrlMallocArg); +using CellPngDecCbControlFree = s32(vm::ptr ptr, vm::ptr cbCtrlFreeArg); // Structs struct CellPngDecThreadInParam @@ -251,8 +251,8 @@ struct CellPngDecExtOutParam }; // Callbacks for decoding partial streams -using CellPngDecCbControlStream = func_def strmInfo, vm::ptr strmParam, vm::ptr cbCtrlStrmArg)>; -using CellPngDecCbControlDisp = func_def dispInfo, vm::ptr dispParam, vm::ptr cbCtrlDispArg)>; +using CellPngDecCbControlStream = s32(vm::ptr strmInfo, vm::ptr strmParam, vm::ptr cbCtrlStrmArg); +using CellPngDecCbControlDisp = s32(vm::ptr dispInfo, vm::ptr dispParam, vm::ptr cbCtrlDispArg); struct CellPngDecCbCtrlStrm { diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngEnc.cpp b/rpcs3/Emu/SysCalls/Modules/cellPngEnc.cpp index 8c05cb884d..d65ed8a933 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngEnc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPngEnc.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellPngEnc_init(); -Module cellPngEnc(0x0052, cellPngEnc_init); +extern Module cellPngEnc; // Error Codes enum @@ -15,61 +15,61 @@ enum CELL_PNGENC_ERROR_FATAL = 0x80611296, }; -int cellPngEncQueryAttr() +s32 cellPngEncQueryAttr() { UNIMPLEMENTED_FUNC(cellPngEnc); return CELL_OK; } -int cellPngEncOpen() +s32 cellPngEncOpen() { UNIMPLEMENTED_FUNC(cellPngEnc); return CELL_OK; } -int cellPngEncOpenEx() +s32 cellPngEncOpenEx() { UNIMPLEMENTED_FUNC(cellPngEnc); return CELL_OK; } -int cellPngEncClose() +s32 cellPngEncClose() { UNIMPLEMENTED_FUNC(cellPngEnc); return CELL_OK; } -int cellPngEncWaitForInput() +s32 cellPngEncWaitForInput() { UNIMPLEMENTED_FUNC(cellPngEnc); return CELL_OK; } -int cellPngEncEncodePicture() +s32 cellPngEncEncodePicture() { UNIMPLEMENTED_FUNC(cellPngEnc); return CELL_OK; } -int cellPngEncWaitForOutput() +s32 cellPngEncWaitForOutput() { UNIMPLEMENTED_FUNC(cellPngEnc); return CELL_OK; } -int cellPngEncGetStreamInfo() +s32 cellPngEncGetStreamInfo() { UNIMPLEMENTED_FUNC(cellPngEnc); return CELL_OK; } -int cellPngEncReset() +s32 cellPngEncReset() { UNIMPLEMENTED_FUNC(cellPngEnc); return CELL_OK; } -void cellPngEnc_init() +Module cellPngEnc("cellPngEnc", []() { REG_FUNC(cellPngEnc, cellPngEncQueryAttr); REG_FUNC(cellPngEnc, cellPngEncOpen); @@ -80,5 +80,4 @@ void cellPngEnc_init() REG_FUNC(cellPngEnc, cellPngEncWaitForOutput); REG_FUNC(cellPngEnc, cellPngEncGetStreamInfo); REG_FUNC(cellPngEnc, cellPngEncReset); -} -#endif +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellPrint.cpp b/rpcs3/Emu/SysCalls/Modules/cellPrint.cpp index 291ce344ef..707cf908a5 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPrint.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPrint.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellPrint_init(); -Module cellPrint(0xf02a, cellPrint_init); +extern Module cellPrint; // Error Codes enum @@ -17,80 +17,95 @@ enum CELL_PRINT_ERROR_CANCELED_BY_PRINTER = 0x8002c408, }; -int cellPrintLoadAsync() +s32 cellSysutilPrintInit() { UNIMPLEMENTED_FUNC(cellPrint); return CELL_OK; } -int cellPrintLoadAsync2() +s32 cellSysutilPrintShutdown() { UNIMPLEMENTED_FUNC(cellPrint); return CELL_OK; } -int cellPrintUnloadAsync() +s32 cellPrintLoadAsync() { UNIMPLEMENTED_FUNC(cellPrint); return CELL_OK; } -int cellPrintGetStatus() +s32 cellPrintLoadAsync2() { UNIMPLEMENTED_FUNC(cellPrint); return CELL_OK; } -int cellPrintOpenConfig() +s32 cellPrintUnloadAsync() { UNIMPLEMENTED_FUNC(cellPrint); return CELL_OK; } -int cellPrintGetPrintableArea() +s32 cellPrintGetStatus() { UNIMPLEMENTED_FUNC(cellPrint); return CELL_OK; } -int cellPrintStartJob() +s32 cellPrintOpenConfig() { UNIMPLEMENTED_FUNC(cellPrint); return CELL_OK; } -int cellPrintEndJob() +s32 cellPrintGetPrintableArea() { UNIMPLEMENTED_FUNC(cellPrint); return CELL_OK; } -int cellPrintCancelJob() +s32 cellPrintStartJob() { UNIMPLEMENTED_FUNC(cellPrint); return CELL_OK; } -int cellPrintStartPage() +s32 cellPrintEndJob() { UNIMPLEMENTED_FUNC(cellPrint); return CELL_OK; } -int cellPrintEndPage() +s32 cellPrintCancelJob() { UNIMPLEMENTED_FUNC(cellPrint); return CELL_OK; } -int cellPrintSendBand() +s32 cellPrintStartPage() { UNIMPLEMENTED_FUNC(cellPrint); return CELL_OK; } -void cellPrint_init() +s32 cellPrintEndPage() { + UNIMPLEMENTED_FUNC(cellPrint); + return CELL_OK; +} + +s32 cellPrintSendBand() +{ + UNIMPLEMENTED_FUNC(cellPrint); + return CELL_OK; +} + +Module cellPrint("cellPrint", []() +{ + REG_FUNC(cellPrint, cellSysutilPrintInit); + REG_FUNC(cellPrint, cellSysutilPrintShutdown); + REG_FUNC(cellPrint, cellPrintLoadAsync); REG_FUNC(cellPrint, cellPrintLoadAsync2); REG_FUNC(cellPrint, cellPrintUnloadAsync); @@ -103,5 +118,4 @@ void cellPrint_init() REG_FUNC(cellPrint, cellPrintStartPage); REG_FUNC(cellPrint, cellPrintEndPage); REG_FUNC(cellPrint, cellPrintSendBand); -} -#endif +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellRec.cpp b/rpcs3/Emu/SysCalls/Modules/cellRec.cpp new file mode 100644 index 0000000000..8886c882fa --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellRec.cpp @@ -0,0 +1,52 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellRec; + +s32 cellRecOpen() +{ + throw EXCEPTION(""); +} + +s32 cellRecClose() +{ + throw EXCEPTION(""); +} + +s32 cellRecGetInfo() +{ + throw EXCEPTION(""); +} + +s32 cellRecStop() +{ + throw EXCEPTION(""); +} + +s32 cellRecStart() +{ + throw EXCEPTION(""); +} + +s32 cellRecQueryMemSize() +{ + throw EXCEPTION(""); +} + +s32 cellRecSetInfo() +{ + throw EXCEPTION(""); +} + + +Module cellRec("cellRec", []() +{ + REG_FUNC(cellRec, cellRecOpen); + REG_FUNC(cellRec, cellRecClose); + REG_FUNC(cellRec, cellRecGetInfo); + REG_FUNC(cellRec, cellRecStop); + REG_FUNC(cellRec, cellRecStart); + REG_FUNC(cellRec, cellRecQueryMemSize); + REG_FUNC(cellRec, cellRecSetInfo); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellRemotePlay.cpp b/rpcs3/Emu/SysCalls/Modules/cellRemotePlay.cpp new file mode 100644 index 0000000000..024327e61d --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellRemotePlay.cpp @@ -0,0 +1,58 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellRemotePlay; + +s32 cellRemotePlayGetStatus() +{ + throw EXCEPTION(""); +} + +s32 cellRemotePlaySetComparativeVolume() +{ + throw EXCEPTION(""); +} + +s32 cellRemotePlayGetPeerInfo() +{ + throw EXCEPTION(""); +} + +s32 cellRemotePlayGetSharedMemory() +{ + throw EXCEPTION(""); +} + +s32 cellRemotePlayEncryptAllData() +{ + throw EXCEPTION(""); +} + +s32 cellRemotePlayStopPeerVideoOut() +{ + throw EXCEPTION(""); +} + +s32 cellRemotePlayGetComparativeVolume() +{ + throw EXCEPTION(""); +} + +s32 cellRemotePlayBreak() +{ + throw EXCEPTION(""); +} + + +Module cellRemotePlay("cellRemotePlay", []() +{ + REG_FUNC(cellRemotePlay, cellRemotePlayGetStatus); + REG_FUNC(cellRemotePlay, cellRemotePlaySetComparativeVolume); + REG_FUNC(cellRemotePlay, cellRemotePlayGetPeerInfo); + REG_FUNC(cellRemotePlay, cellRemotePlayGetSharedMemory); + REG_FUNC(cellRemotePlay, cellRemotePlayEncryptAllData); + REG_FUNC(cellRemotePlay, cellRemotePlayStopPeerVideoOut); + REG_FUNC(cellRemotePlay, cellRemotePlayGetComparativeVolume); + REG_FUNC(cellRemotePlay, cellRemotePlayBreak); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index ac2b403f04..a73e62c8ec 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -4,7 +4,7 @@ #include "Emu/SysCalls/Modules.h" #include "cellSysutil.h" -#include "Emu/RSX/sysutil_video.h" +#include "Emu/SysCalls/Modules/cellVideoOut.h" #include "Emu/RSX/GSManager.h" #include "Emu/RSX/GSRender.h" #include "cellResc.h" @@ -17,7 +17,7 @@ extern void cellGcmSetFlipHandler(vm::ptr handler); extern void cellGcmSetVBlankHandler(vm::ptr handler); extern s32 cellGcmAddressToOffset(u32 address, vm::ptr offset); extern s32 cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height); -extern s32 cellGcmSetPrepareFlip(PPUThread& CPU, vm::ptr ctx, u32 id); +extern s32 cellGcmSetPrepareFlip(PPUThread& ppu, vm::ptr ctx, u32 id); extern s32 cellGcmSetSecondVFrequency(u32 freq); extern u32 cellGcmGetLabelAddress(u8 index); extern u32 cellGcmGetTiledPitchSize(u32 size); @@ -467,7 +467,6 @@ void InitMembers() void SetupRsxRenderingStates(vm::ptr& cntxt) { //TODO: use cntxt - GSLockCurrent lock(GS_LOCK_WAIT_FLUSH); GSRender& r = Emu.GetGSManager().GetRender(); r.m_set_color_mask = true; r.m_color_mask_a = r.m_color_mask_r = r.m_color_mask_g = r.m_color_mask_b = true; r.m_set_depth_mask = true; r.m_depth_mask = 0; @@ -514,7 +513,6 @@ void SetupRsxRenderingStates(vm::ptr& cntxt) void SetupVertexArrays(vm::ptr& cntxt) { - GSLockCurrent lock(GS_LOCK_WAIT_FLUSH); GSRender& r = Emu.GetGSManager().GetRender(); //TODO @@ -538,7 +536,6 @@ void SetupSurfaces(vm::ptr& cntxt) dstOffset1 = s_rescInternalInstance->m_dstOffsets[s_rescInternalInstance->m_bufIdPalMidNow]; } - GSLockCurrent lock(GS_LOCK_WAIT_FLUSH); GSRender& r = Emu.GetGSManager().GetRender(); r.m_surface_type = CELL_GCM_SURFACE_PITCH; @@ -1023,8 +1020,9 @@ s32 cellRescSetConvertAndFlip(PPUThread& CPU, vm::ptr cntxt, s32 cellRescSetWaitFlip() { - cellResc.Log("cellRescSetWaitFlip()"); - GSLockCurrent lock(GS_LOCK_WAIT_FLIP); + cellResc.Warning("cellRescSetWaitFlip()"); + + // TODO: emit RSX command for "wait flip" operation return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp index 47ecffb94a..278dc0a40a 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp @@ -24,7 +24,7 @@ u64 convertToWin32FILETIME(u16 seconds, u16 minutes, u16 hours, u16 days, s32 ye s32 cellRtcGetCurrentTick(vm::ptr pTick) { - cellRtc.Log("cellRtcGetCurrentTick(pTick=0x%x)", pTick.addr()); + cellRtc.Log("cellRtcGetCurrentTick(pTick=*0x%x)", pTick); rDateTime unow = rDateTime::UNow(); pTick->tick = unow.GetTicks(); @@ -33,7 +33,7 @@ s32 cellRtcGetCurrentTick(vm::ptr pTick) s32 cellRtcGetCurrentClock(vm::ptr 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, iTimeZone); rDateTime unow = rDateTime::UNow(); @@ -54,7 +54,7 @@ s32 cellRtcGetCurrentClock(vm::ptr pClock, s32 iTimeZone) s32 cellRtcGetCurrentClockLocalTime(vm::ptr pClock) { - cellRtc.Log("cellRtcGetCurrentClockLocalTime(pClock=0x%x)", pClock.addr()); + cellRtc.Log("cellRtcGetCurrentClockLocalTime(pClock=*0x%x)", pClock); rDateTime unow = rDateTime::UNow(); @@ -161,7 +161,7 @@ s32 cellRtcParseRfc3339(vm::ptr pUtc, vm::cptr pszDateTime) s32 cellRtcGetTick(vm::ptr pTime, vm::ptr pTick) { - cellRtc.Log("cellRtcGetTick(pTime=0x%x, pTick=0x%x)", pTime.addr(), pTick.addr()); + cellRtc.Log("cellRtcGetTick(pTime=*0x%x, pTick=*0x%x)", pTime, pTick); 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(); @@ -171,7 +171,7 @@ s32 cellRtcGetTick(vm::ptr pTime, vm::ptr pTick) s32 cellRtcSetTick(vm::ptr pTime, vm::ptr pTick) { - cellRtc.Log("cellRtcSetTick(pTime=0x%x, pTick=0x%x)", pTime.addr(), pTick.addr()); + cellRtc.Log("cellRtcSetTick(pTime=*0x%x, pTick=*0x%x)", pTime, pTick); rDateTime date = rDateTime((time_t)pTick->tick); @@ -188,7 +188,7 @@ s32 cellRtcSetTick(vm::ptr pTime, vm::ptr pTick) s32 cellRtcTickAddTicks(vm::ptr pTick0, vm::ptr 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, pTick1, lAdd); pTick0->tick = pTick1->tick + lAdd; return CELL_OK; @@ -196,7 +196,7 @@ s32 cellRtcTickAddTicks(vm::ptr pTick0, vm::ptr pTick1 s32 cellRtcTickAddMicroseconds(vm::ptr pTick0, vm::ptr 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, pTick1, lAdd); rDateTime date = rDateTime((time_t)pTick1->tick); rTimeSpan microseconds = rTimeSpan(0, 0, 0, lAdd / 1000); @@ -208,7 +208,7 @@ s32 cellRtcTickAddMicroseconds(vm::ptr pTick0, vm::ptr s32 cellRtcTickAddSeconds(vm::ptr pTick0, vm::ptr 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, pTick1, lAdd); rDateTime date = rDateTime((time_t)pTick1->tick); rTimeSpan seconds = rTimeSpan(0, 0, lAdd, 0); @@ -220,7 +220,7 @@ s32 cellRtcTickAddSeconds(vm::ptr pTick0, vm::ptr pTic s32 cellRtcTickAddMinutes(vm::ptr pTick0, vm::ptr 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, pTick1, lAdd); rDateTime date = rDateTime((time_t)pTick1->tick); rTimeSpan minutes = rTimeSpan(0, lAdd, 0, 0); // ??? @@ -232,7 +232,7 @@ s32 cellRtcTickAddMinutes(vm::ptr pTick0, vm::ptr pTic s32 cellRtcTickAddHours(vm::ptr pTick0, vm::ptr 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, pTick1, iAdd); rDateTime date = rDateTime((time_t)pTick1->tick); rTimeSpan hours = rTimeSpan(iAdd, 0, 0, 0); // ??? @@ -244,7 +244,7 @@ s32 cellRtcTickAddHours(vm::ptr pTick0, vm::ptr pTick1 s32 cellRtcTickAddDays(vm::ptr pTick0, vm::ptr 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, pTick1, iAdd); rDateTime date = rDateTime((time_t)pTick1->tick); rDateSpan days = rDateSpan(0, 0, 0, iAdd); // ??? @@ -256,7 +256,7 @@ s32 cellRtcTickAddDays(vm::ptr pTick0, vm::ptr pTick1, s32 cellRtcTickAddWeeks(vm::ptr pTick0, vm::ptr 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, pTick1, iAdd); rDateTime date = rDateTime((time_t)pTick1->tick); rDateSpan weeks = rDateSpan(0, 0, iAdd, 0); @@ -268,7 +268,7 @@ s32 cellRtcTickAddWeeks(vm::ptr pTick0, vm::ptr pTick1 s32 cellRtcTickAddMonths(vm::ptr pTick0, vm::ptr 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, pTick1, iAdd); rDateTime date = rDateTime((time_t)pTick1->tick); rDateSpan months = rDateSpan(0, iAdd, 0, 0); @@ -280,7 +280,7 @@ s32 cellRtcTickAddMonths(vm::ptr pTick0, vm::ptr pTick s32 cellRtcTickAddYears(vm::ptr pTick0, vm::ptr 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, pTick1, iAdd); rDateTime date = rDateTime((time_t)pTick1->tick); rDateSpan years = rDateSpan(iAdd, 0, 0, 0); @@ -292,7 +292,7 @@ s32 cellRtcTickAddYears(vm::ptr pTick0, vm::ptr pTick1 s32 cellRtcConvertUtcToLocalTime(vm::ptr pUtc, vm::ptr pLocalTime) { - cellRtc.Log("cellRtcConvertUtcToLocalTime(pUtc=0x%x, pLocalTime=0x%x)", pUtc.addr(), pLocalTime.addr()); + cellRtc.Log("cellRtcConvertUtcToLocalTime(pUtc=*0x%x, pLocalTime=*0x%x)", pUtc, pLocalTime); rDateTime time = rDateTime((time_t)pUtc->tick); rDateTime local_time = time.FromUTC(false); @@ -302,7 +302,7 @@ s32 cellRtcConvertUtcToLocalTime(vm::ptr pUtc, vm::ptr s32 cellRtcConvertLocalTimeToUtc(vm::ptr pLocalTime, vm::ptr pUtc) { - cellRtc.Log("cellRtcConvertLocalTimeToUtc(pLocalTime=0x%x, pUtc=0x%x)", pLocalTime.addr(), pUtc.addr()); + cellRtc.Log("cellRtcConvertLocalTimeToUtc(pLocalTime=*0x%x, pUtc=*0x%x)", pLocalTime, pUtc); rDateTime time = rDateTime((time_t)pLocalTime->tick); rDateTime utc_time = time.ToUTC(false); @@ -312,7 +312,7 @@ s32 cellRtcConvertLocalTimeToUtc(vm::ptr pLocalTime, vm::ptr pDateTime, vm::ptr puiDosTime) { - cellRtc.Log("cellRtcGetDosTime(pDateTime=0x%x, puiDosTime=0x%x)", pDateTime.addr(), puiDosTime.addr()); + cellRtc.Log("cellRtcGetDosTime(pDateTime=*0x%x, puiDosTime=*0x%x)", pDateTime, puiDosTime); // 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)); @@ -323,7 +323,7 @@ s32 cellRtcGetDosTime(vm::ptr pDateTime, vm::ptr puiDosTim s32 cellRtcGetTime_t(vm::ptr pDateTime, vm::ptr 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, piTime); // 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)); @@ -335,7 +335,7 @@ s32 cellRtcGetTime_t(vm::ptr pDateTime, vm::ptr piTime) s32 cellRtcGetWin32FileTime(vm::ptr pDateTime, vm::ptr pulWin32FileTime) { - cellRtc.Log("cellRtcGetWin32FileTime(pDateTime=0x%x, pulWin32FileTime=0x%x)", pDateTime.addr(), pulWin32FileTime.addr()); + cellRtc.Log("cellRtcGetWin32FileTime(pDateTime=*0x%x, pulWin32FileTime=*0x%x)", pDateTime, pulWin32FileTime); // 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)); @@ -347,7 +347,7 @@ s32 cellRtcGetWin32FileTime(vm::ptr pDateTime, vm::ptr pul s32 cellRtcSetDosTime(vm::ptr 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, uiDosTime); rDateTime date_time; rDateTime dos_time = date_time.SetFromDOS(uiDosTime); @@ -365,7 +365,7 @@ s32 cellRtcSetDosTime(vm::ptr pDateTime, u32 uiDosTime) s32 cellRtcSetTime_t(vm::ptr 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, iTime); rDateTime date_time = rDateTime((time_t)iTime); @@ -424,7 +424,7 @@ s32 cellRtcGetDayOfWeek(s32 year, s32 month, s32 day) s32 cellRtcCheckValid(vm::ptr pTime) { - cellRtc.Log("cellRtcCheckValid(pTime=0x%x)", pTime.addr()); + cellRtc.Log("cellRtcCheckValid(pTime=*0x%x)", pTime); 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; @@ -438,7 +438,7 @@ s32 cellRtcCheckValid(vm::ptr pTime) s32 cellRtcCompareTick(vm::ptr pTick0, vm::ptr pTick1) { - cellRtc.Log("cellRtcCompareTick(pTick0=0x%x, pTick1=0x%x)", pTick0.addr(), pTick1.addr()); + cellRtc.Log("cellRtcCompareTick(pTick0=*0x%x, pTick1=*0x%x)", pTick0, pTick1); if (pTick0->tick < pTick1->tick) return -1; else if (pTick0->tick > pTick1->tick) return 1; @@ -472,8 +472,6 @@ Module cellRtc("cellRtc", []() REG_FUNC(cellRtc, cellRtcConvertUtcToLocalTime); REG_FUNC(cellRtc, cellRtcConvertLocalTimeToUtc); - // (TODO: Time Information Manipulation Functions missing) - REG_FUNC(cellRtc, cellRtcGetDosTime); REG_FUNC(cellRtc, cellRtcGetTime_t); REG_FUNC(cellRtc, cellRtcGetWin32FileTime); diff --git a/rpcs3/Emu/SysCalls/Modules/cellRudp.cpp b/rpcs3/Emu/SysCalls/Modules/cellRudp.cpp index de1eb2cee1..9bd3f84131 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRudp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellRudp.cpp @@ -8,52 +8,71 @@ extern Module cellRudp; -struct cellRudpInternal +struct RudpInternal { - bool m_bInitialized; - CellRudpAllocator allocator; + std::atomic init; + + // allocator functions + std::function(PPUThread& ppu, u32 size)> malloc; + std::function ptr)> free; + + // event handler function vm::ptr handler; - u32 argument; - - cellRudpInternal() - : m_bInitialized(false) - { - } -}; - -cellRudpInternal cellRudpInstance; + vm::ptr handler_arg; +} +g_rudp; s32 cellRudpInit(vm::ptr allocator) { - cellRudp.Warning("cellRudpInit(allocator_addr=0x%x)", allocator.addr()); + cellRudp.Warning("cellRudpInit(allocator=*0x%x)", allocator); - if (cellRudpInstance.m_bInitialized) + if (g_rudp.init.load()) { - cellRudp.Error("cellRudpInit(): cellRudp has already been initialized."); return CELL_RUDP_ERROR_ALREADY_INITIALIZED; } if (allocator) { - cellRudpInstance.allocator = *allocator.get_ptr(); + g_rudp.malloc = allocator->app_malloc; + g_rudp.free = allocator->app_free; + } + else + { + g_rudp.malloc = [](PPUThread& ppu, u32 size) + { + return vm::ptr::make(vm::alloc(size, vm::main)); + }; + + g_rudp.free = [](PPUThread& ppu, vm::ptr ptr) + { + if (!vm::dealloc(ptr.addr(), vm::main)) + { + throw EXCEPTION("Memory deallocation failed (ptr=0x%x)", ptr); + } + }; } - cellRudpInstance.m_bInitialized = true; + if (g_rudp.init.exchange(true)) + { + throw EXCEPTION("Unexpected"); + } return CELL_OK; } s32 cellRudpEnd() { - cellRudp.Log("cellRudpEnd()"); + cellRudp.Warning("cellRudpEnd()"); - if (!cellRudpInstance.m_bInitialized) + if (!g_rudp.init.load()) { - cellRudp.Error("cellRudpEnd(): cellRudp has not been initialized."); return CELL_RUDP_ERROR_NOT_INITIALIZED; } - cellRudpInstance.m_bInitialized = false; + if (!g_rudp.init.exchange(false)) + { + throw EXCEPTION("Unexpected"); + } return CELL_OK; } @@ -64,22 +83,17 @@ s32 cellRudpEnableInternalIOThread() return CELL_OK; } -s32 cellRudpSetEventHandler(vm::ptr handler, vm::ptr arg) +s32 cellRudpSetEventHandler(vm::ptr handler, vm::ptr arg) { - cellRudp.Todo("cellRudpSetEventHandler(handler=0x%x, arg_addr=0x%x)", handler, arg.addr()); + cellRudp.Todo("cellRudpSetEventHandler(handler=*0x%x, arg=*0x%x)", handler, arg); - if (!cellRudpInstance.m_bInitialized) + if (!g_rudp.init.load()) { - cellRudp.Error("cellRudpInit(): cellRudp has not been initialized."); return CELL_RUDP_ERROR_NOT_INITIALIZED; } - if (arg) - { - cellRudpInstance.argument = *arg.get_ptr(); - } - - cellRudpInstance.handler = handler; + g_rudp.handler = handler; + g_rudp.handler_arg = arg; return CELL_OK; } @@ -216,6 +230,12 @@ s32 cellRudpPollWait() return CELL_OK; } +s32 cellRudpPollCancel() +{ + UNIMPLEMENTED_FUNC(cellRudp); + return CELL_OK; +} + s32 cellRudpNetReceived() { UNIMPLEMENTED_FUNC(cellRudp); @@ -230,7 +250,7 @@ s32 cellRudpProcessEvents() Module cellRudp("cellRudp", []() { - cellRudpInstance.m_bInitialized = false; + g_rudp.init = false; REG_FUNC(cellRudp, cellRudpInit); REG_FUNC(cellRudp, cellRudpEnd); @@ -263,7 +283,7 @@ Module cellRudp("cellRudp", []() REG_FUNC(cellRudp, cellRudpPollDestroy); REG_FUNC(cellRudp, cellRudpPollControl); REG_FUNC(cellRudp, cellRudpPollWait); - //REG_FUNC(cellRudp, cellRudpPollCancel); + REG_FUNC(cellRudp, cellRudpPollCancel); REG_FUNC(cellRudp, cellRudpNetReceived); REG_FUNC(cellRudp, cellRudpProcessEvents); diff --git a/rpcs3/Emu/SysCalls/Modules/cellRudp.h b/rpcs3/Emu/SysCalls/Modules/cellRudp.h index 9ae50fa65e..8eddf2eb27 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRudp.h +++ b/rpcs3/Emu/SysCalls/Modules/cellRudp.h @@ -77,10 +77,10 @@ enum CELL_RUDP_POLL_EV_ERROR = 0x0008, }; -typedef s32(CellRudpEventHandler)(s32 event_id, s32 soc, vm::cptr data, u32 datalen, vm::cptr addr, u32 addrlen, vm::ptr arg); +using CellRudpEventHandler = s32(s32 event_id, s32 soc, vm::cptr data, u32 datalen, vm::cptr addr, u32 addrlen, vm::ptr arg); -using CellRudpAllocatorFuncAlloc = func_def(u32 size)>; -using CellRudpAllocatorFuncFree = func_def ptr)>; +using CellRudpAllocatorFuncAlloc = vm::ptr(u32 size); +using CellRudpAllocatorFuncFree = void(vm::ptr ptr); struct CellRudpAllocator { diff --git a/rpcs3/Emu/SysCalls/Modules/cellSail.cpp b/rpcs3/Emu/SysCalls/Modules/cellSail.cpp index 4f886dbec0..28d7353ca9 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSail.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSail.cpp @@ -12,7 +12,7 @@ extern Module cellSail; s32 cellSailMemAllocatorInitialize(vm::ptr pSelf, vm::ptr pCallbacks) { - cellSail.Warning("cellSailMemAllocatorInitialize(pSelf_addr=0x%x, pCallbacks_addr=0x%x)", pSelf.addr(), pCallbacks.addr()); + cellSail.Warning("cellSailMemAllocatorInitialize(pSelf=*0x%x, pCallbacks=*0x%x)", pSelf, pCallbacks); pSelf->callbacks = pCallbacks; @@ -73,9 +73,9 @@ s32 cellSailDescriptorGetMediaInfo() return CELL_OK; } -s32 cellSailDescriptorSetAutoSelection(vm::ptr pSelf, bool autoSelection) +s32 cellSailDescriptorSetAutoSelection(vm::ptr pSelf, b8 autoSelection) { - cellSail.Warning("cellSailDescriptorSetAutoSelection(pSelf_addr=0x%x, autoSelection=%s)", pSelf.addr(), autoSelection ? "true" : "false"); + cellSail.Warning("cellSailDescriptorSetAutoSelection(pSelf=*0x%x, autoSelection=%d)", pSelf, autoSelection); if (pSelf) { pSelf->autoSelection = autoSelection; @@ -87,7 +87,7 @@ s32 cellSailDescriptorSetAutoSelection(vm::ptr pSelf, bool a s32 cellSailDescriptorIsAutoSelection(vm::ptr pSelf) { - cellSail.Warning("cellSailDescriptorIsAutoSelection(pSelf_addr=0x%x)", pSelf.addr()); + cellSail.Warning("cellSailDescriptorIsAutoSelection(pSelf=*0x%x)", pSelf); if (pSelf) return pSelf->autoSelection; @@ -97,7 +97,7 @@ s32 cellSailDescriptorIsAutoSelection(vm::ptr pSelf) s32 cellSailDescriptorCreateDatabase(vm::ptr pSelf, vm::ptr 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, pDatabase, size, arg); switch ((s32)pSelf->streamType) { case CELL_SAIL_STREAM_PAMF: @@ -372,34 +372,24 @@ s32 cellSailSourceNotifyMediaStateChanged() return CELL_OK; } -s32 cellSailSourceCheck() -{ - UNIMPLEMENTED_FUNC(cellSail); - return CELL_OK; -} - s32 cellSailSourceNotifyOpenCompleted() { - UNIMPLEMENTED_FUNC(cellSail); - return CELL_OK; + throw EXCEPTION("Unexpected function"); } s32 cellSailSourceNotifyStartCompleted() { - UNIMPLEMENTED_FUNC(cellSail); - return CELL_OK; + throw EXCEPTION("Unexpected function"); } s32 cellSailSourceNotifyStopCompleted() { - UNIMPLEMENTED_FUNC(cellSail); - return CELL_OK; + throw EXCEPTION("Unexpected function"); } s32 cellSailSourceNotifyReadCompleted() { - UNIMPLEMENTED_FUNC(cellSail); - return CELL_OK; + throw EXCEPTION("Unexpected function"); } s32 cellSailSourceSetDiagHandler() @@ -410,8 +400,7 @@ s32 cellSailSourceSetDiagHandler() s32 cellSailSourceNotifyCloseCompleted() { - UNIMPLEMENTED_FUNC(cellSail); - return CELL_OK; + throw EXCEPTION("Unexpected function"); } s32 cellSailMp4MovieGetBrand() @@ -468,12 +457,6 @@ s32 cellSailMp4TrackGetTrackReference() return CELL_OK; } -s32 cellSailMp4ConvertTimeScale() -{ - UNIMPLEMENTED_FUNC(cellSail); - return CELL_OK; -} - s32 cellSailAviMovieGetMovieInfo() { UNIMPLEMENTED_FUNC(cellSail); @@ -516,17 +499,23 @@ s32 cellSailPlayerInitialize() return CELL_OK; } -s32 cellSailPlayerInitialize2(vm::ptr pSelf, vm::ptr pAllocator, vm::ptr pCallback, u64 callbackArg, - vm::ptr pAttribute, vm::ptr pResource) +s32 cellSailPlayerInitialize2( + vm::ptr pSelf, + vm::ptr pAllocator, + vm::ptr pCallback, + vm::ptr callbackArg, + vm::ptr pAttribute, + vm::ptr 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(), - pAllocator.addr(), pCallback.addr(), callbackArg, pAttribute.addr(), pResource.addr()); + cellSail.Warning("cellSailPlayerInitialize2(pSelf=*0x%x, pAllocator=*0x%x, pCallback=*0x%x, callbackArg=*0x%x, pAttribute=*0x%x, pResource=*0x%x)", + pSelf, pAllocator, pCallback, callbackArg, pAttribute, pResource); - pSelf->allocator = pAllocator; + pSelf->allocator = *pAllocator; pSelf->callback = pCallback; - pSelf->callbackArgument = callbackArg; - pSelf->attribute = pAttribute; - pSelf->resource = pResource; + pSelf->callbackArg = callbackArg; + pSelf->attribute = *pAttribute; + pSelf->resource = *pResource; + pSelf->paused = true; return CELL_OK; } @@ -617,7 +606,7 @@ s32 cellSailPlayerBoot() s32 cellSailPlayerAddDescriptor(vm::ptr pSelf, vm::ptr pDesc) { - cellSail.Warning("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), pDesc.addr()); + cellSail.Warning("cellSailPlayerAddDescriptor(pSelf=*0x%x, pDesc=*0x%x)", pSelf, pDesc); if (pSelf && pSelf->descriptors < 3 && pDesc) { @@ -633,14 +622,13 @@ s32 cellSailPlayerAddDescriptor(vm::ptr pSelf, vm::ptr pSelf, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, vm::ptr ppDesc) +s32 cellSailPlayerCreateDescriptor(vm::ptr pSelf, s32 streamType, vm::ptr pMediaInfo, vm::cptr pUri, vm::pptr 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, - pMediaInfo.addr(), pUri.addr(), ppDesc.addr()); + cellSail.Warning("cellSailPlayerCreateDescriptor(pSelf=*0x%x, streamType=%d, pMediaInfo=*0x%x, pUri=*0x%x, ppDesc=**0x%x)", pSelf, streamType, pMediaInfo, pUri, ppDesc); u32 descriptorAddress = vm::alloc(sizeof(CellSailDescriptor), vm::main); auto descriptor = vm::ptr::make(descriptorAddress); - *ppDesc = descriptorAddress; + *ppDesc = descriptor; descriptor->streamType = streamType; descriptor->registered = false; @@ -680,7 +668,6 @@ s32 cellSailPlayerCreateDescriptor(vm::ptr pSelf, s32 streamType cellSail.Error("Unhandled stream type: %d", streamType); } - //cellSail.Todo("pSelf_addr=0x%x, pDesc_addr=0x%x", pSelf.addr(), descriptor.addr()); //cellSailPlayerAddDescriptor(pSelf, ppDesc); return CELL_OK; @@ -688,7 +675,7 @@ s32 cellSailPlayerCreateDescriptor(vm::ptr pSelf, s32 streamType s32 cellSailPlayerDestroyDescriptor(vm::ptr pSelf, vm::ptr pDesc) { - cellSail.Todo("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), pDesc.addr()); + cellSail.Todo("cellSailPlayerAddDescriptor(pSelf=*0x%x, pDesc=*0x%x)", pSelf, pDesc); if (pDesc->registered) return CELL_SAIL_ERROR_INVALID_STATE; @@ -698,7 +685,7 @@ s32 cellSailPlayerDestroyDescriptor(vm::ptr pSelf, vm::ptr pSelf, vm::ptr ppDesc) { - cellSail.Warning("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), ppDesc.addr()); + cellSail.Warning("cellSailPlayerAddDescriptor(pSelf=*0x%x, pDesc=*0x%x)", pSelf, ppDesc); if (pSelf->descriptors > 0) { @@ -712,7 +699,7 @@ s32 cellSailPlayerRemoveDescriptor(vm::ptr pSelf, vm::ptr pSelf) { - cellSail.Warning("cellSailPlayerGetDescriptorCount(pSelf_addr=0x%x)", pSelf.addr()); + cellSail.Warning("cellSailPlayerGetDescriptorCount(pSelf=*0x%x)", pSelf); return pSelf->descriptors; } @@ -812,21 +799,21 @@ s32 cellSailPlayerCancel() return CELL_OK; } -s32 cellSailPlayerSetPaused(vm::ptr pSelf, bool paused) +s32 cellSailPlayerSetPaused(vm::ptr pSelf, b8 paused) { - cellSail.Todo("cellSailPlayerSetPaused(pSelf_addr=0x%x, paused=%d)", pSelf.addr(), paused); + cellSail.Todo("cellSailPlayerSetPaused(pSelf=*0x%x, paused=%d)", pSelf, paused); return CELL_OK; } s32 cellSailPlayerIsPaused(vm::ptr pSelf) { - cellSail.Warning("cellSailPlayerIsPaused(pSelf_addr=0x%x)", pSelf.addr()); + cellSail.Warning("cellSailPlayerIsPaused(pSelf=*0x%x)", pSelf); return pSelf->paused; } s32 cellSailPlayerSetRepeatMode(vm::ptr pSelf, s32 repeatMode, vm::ptr pCommand) { - cellSail.Warning("cellSailPlayerSetRepeatMode(pSelf_addr=0x%x, repeatMode=%d, pCommand_addr=0x%x)", pSelf.addr(), repeatMode, pCommand.addr()); + cellSail.Warning("cellSailPlayerSetRepeatMode(pSelf=*0x%x, repeatMode=%d, pCommand=*0x%x)", pSelf, repeatMode, pCommand); pSelf->repeatMode = repeatMode; pSelf->playbackCommand = pCommand; @@ -836,7 +823,7 @@ s32 cellSailPlayerSetRepeatMode(vm::ptr pSelf, s32 repeatMode, v s32 cellSailPlayerGetRepeatMode(vm::ptr pSelf, vm::ptr pCommand) { - cellSail.Warning("cellSailPlayerGetRepeatMode(pSelf_addr=0x%x, pCommand_addr=0x%x)", pSelf.addr(), pCommand.addr()); + cellSail.Warning("cellSailPlayerGetRepeatMode(pSelf=*0x%x, pCommand=*0x%x)", pSelf, pCommand); pCommand = pSelf->playbackCommand; @@ -945,12 +932,16 @@ Module cellSail("cellSail", []() REG_FUNC(cellSail, cellSailSourceNotifyStreamOut); REG_FUNC(cellSail, cellSailSourceNotifySessionError); REG_FUNC(cellSail, cellSailSourceNotifyMediaStateChanged); - REG_FUNC(cellSail, cellSailSourceNotifyOpenCompleted); - REG_FUNC(cellSail, cellSailSourceNotifyStartCompleted); - REG_FUNC(cellSail, cellSailSourceNotifyStopCompleted); - REG_FUNC(cellSail, cellSailSourceNotifyReadCompleted); REG_FUNC(cellSail, cellSailSourceSetDiagHandler); - REG_FUNC(cellSail, cellSailSourceNotifyCloseCompleted); + + { + // these functions shouldn't exist + REG_FUNC(cellSail, cellSailSourceNotifyOpenCompleted); + REG_FUNC(cellSail, cellSailSourceNotifyStartCompleted); + REG_FUNC(cellSail, cellSailSourceNotifyStopCompleted); + REG_FUNC(cellSail, cellSailSourceNotifyReadCompleted); + REG_FUNC(cellSail, cellSailSourceNotifyCloseCompleted); + } REG_FUNC(cellSail, cellSailMp4MovieGetBrand); REG_FUNC(cellSail, cellSailMp4MovieIsCompatibleBrand); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSail.h b/rpcs3/Emu/SysCalls/Modules/cellSail.h index 7d1b886748..182bf00cd4 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSail.h +++ b/rpcs3/Emu/SysCalls/Modules/cellSail.h @@ -661,8 +661,8 @@ typedef s32(CellSailRendererAudioFuncMakeup)(vm::ptr pArg); typedef s32(CellSailRendererAudioFuncCleanup)(vm::ptr pArg); typedef void(CellSailRendererAudioFuncOpen)(vm::ptr pArg, vm::ptr pInfo, u32 frameNum); typedef void(CellSailRendererAudioFuncClose)(vm::ptr pArg); -typedef void(CellSailRendererAudioFuncStart)(vm::ptr pArg, bool buffering); -typedef void(CellSailRendererAudioFuncStop)(vm::ptr pArg, bool flush); +typedef void(CellSailRendererAudioFuncStart)(vm::ptr pArg, b8 buffering); +typedef void(CellSailRendererAudioFuncStop)(vm::ptr pArg, b8 flush); typedef void(CellSailRendererAudioFuncCancel)(vm::ptr pArg); typedef s32(CellSailRendererAudioFuncCheckout)(vm::ptr pArg, vm::pptr ppInfo); typedef s32(CellSailRendererAudioFuncCheckin)(vm::ptr pArg, vm::ptr pInfo); @@ -671,8 +671,8 @@ typedef s32(CellSailRendererVideoFuncMakeup)(vm::ptr pArg); typedef s32(CellSailRendererVideoFuncCleanup)(vm::ptr pArg); typedef void(CellSailRendererVideoFuncOpen)(vm::ptr pArg, vm::ptr pInfo, u32 frameNum, u32 minFrameNum); typedef void(CellSailRendererVideoFuncClose)(vm::ptr pArg); -typedef void(CellSailRendererVideoFuncStart)(vm::ptr pArg, bool buffering); -typedef void(CellSailRendererVideoFuncStop)(vm::ptr pArg, bool flush, bool keepRendering); +typedef void(CellSailRendererVideoFuncStart)(vm::ptr pArg, b8 buffering); +typedef void(CellSailRendererVideoFuncStop)(vm::ptr pArg, b8 flush, b8 keepRendering); typedef void(CellSailRendererVideoFuncCancel)(vm::ptr pArg); typedef s32(CellSailRendererVideoFuncCheckout)(vm::ptr pArg, vm::pptr ppInfo); typedef s32(CellSailRendererVideoFuncCheckin)(vm::ptr pArg, vm::ptr pInfo); @@ -881,7 +881,7 @@ struct CellSailMp4Track struct CellSailMp4TrackInfo { - bool isTrackEnabled; + b8 isTrackEnabled; u8 reserved0[3]; be_t trackId; be_t trackDuration; @@ -1037,8 +1037,8 @@ struct CellSailMpegLayer3WaveFormat struct CellSailDescriptor { - bool autoSelection; - bool registered; + b8 autoSelection; + b8 registered; be_t streamType; be_t internalData[31]; }; @@ -1097,17 +1097,16 @@ struct CellSailPlayerResource struct CellSailPlayer { - vm::ptr allocator; + CellSailMemAllocator allocator; vm::ptr callback; - be_t callbackArgument; - vm::ptr attribute; - vm::ptr resource; + vm::ptr callbackArg; + CellSailPlayerAttribute attribute; + CellSailPlayerResource resource; vm::ptr playbackCommand; - be_t repeatMode; - be_t descriptors; + s32 repeatMode; + s32 descriptors; vm::ptr registeredDescriptors[2]; - bool paused = true; - be_t internalData[26]; + bool paused; }; -CHECK_SIZE(CellSailPlayer, 0x100); +CHECK_MAX_SIZE(CellSailPlayer, 0x100); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSailRec.cpp b/rpcs3/Emu/SysCalls/Modules/cellSailRec.cpp index 3a23954543..242e57079e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSailRec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSailRec.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellSailRec_init(); -Module cellSailRec(0xf034, cellSailRec_init); +extern Module cellSailRec; // Error Codes enum @@ -21,223 +21,241 @@ enum CELL_SAIL_ERROR_FATAL = 0x806107FF, }; -int cellSailProfileSetEsAudioParameter() +s32 cellSailProfileSetEsAudioParameter() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailProfileSetEsVideoParameter() +s32 cellSailProfileSetEsVideoParameter() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailProfileSetStreamParameter() +s32 cellSailProfileSetStreamParameter() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailVideoConverterCanProcess() +s32 cellSailVideoConverterCanProcess() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailVideoConverterProcess() +s32 cellSailVideoConverterProcess() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailVideoConverterCanGetResult() +s32 cellSailVideoConverterCanGetResult() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailVideoConverterGetResult() +s32 cellSailVideoConverterGetResult() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailFeederAudioInitialize() +s32 cellSailFeederAudioInitialize() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailFeederAudioFinalize() +s32 cellSailFeederAudioFinalize() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailFeederAudioNotifyCallCompleted() +s32 cellSailFeederAudioNotifyCallCompleted() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailFeederAudioNotifyFrameOut() +s32 cellSailFeederAudioNotifyFrameOut() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailFeederAudioNotifySessionEnd() +s32 cellSailFeederAudioNotifySessionEnd() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailFeederAudioNotifySessionError() +s32 cellSailFeederAudioNotifySessionError() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailFeederVideoInitialize() +s32 cellSailFeederVideoInitialize() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailFeederVideoFinalize() +s32 cellSailFeederVideoFinalize() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailFeederVideoNotifyCallCompleted() +s32 cellSailFeederVideoNotifyCallCompleted() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailFeederVideoNotifyFrameOut() +s32 cellSailFeederVideoNotifyFrameOut() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailFeederVideoNotifySessionEnd() +s32 cellSailFeederVideoNotifySessionEnd() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailFeederVideoNotifySessionError() +s32 cellSailFeederVideoNotifySessionError() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderInitialize() +s32 cellSailRecorderInitialize() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderFinalize() +s32 cellSailRecorderFinalize() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderSetFeederAudio() +s32 cellSailRecorderSetFeederAudio() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderSetFeederVideo() +s32 cellSailRecorderSetFeederVideo() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderSetParameter() +s32 cellSailRecorderSetParameter() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderGetParameter() +s32 cellSailRecorderGetParameter() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderBoot() +s32 cellSailRecorderSubscribeEvent() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderCreateProfile() +s32 cellSailRecorderUnsubscribeEvent() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderDestroyProfile() +s32 cellSailRecorderReplaceEventHandler() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderCreateVideoConverter() +s32 cellSailRecorderBoot() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderDestroyVideoConverter() +s32 cellSailRecorderCreateProfile() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderOpenStream() +s32 cellSailRecorderDestroyProfile() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderCloseStream() +s32 cellSailRecorderCreateVideoConverter() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderStart() +s32 cellSailRecorderDestroyVideoConverter() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderStop() +s32 cellSailRecorderOpenStream() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderCancel() +s32 cellSailRecorderCloseStream() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -int cellSailRecorderDumpImage() +s32 cellSailRecorderStart() { UNIMPLEMENTED_FUNC(cellSailRec); return CELL_OK; } -void cellSailRec_init() +s32 cellSailRecorderStop() +{ + UNIMPLEMENTED_FUNC(cellSailRec); + return CELL_OK; +} + +s32 cellSailRecorderCancel() +{ + UNIMPLEMENTED_FUNC(cellSailRec); + return CELL_OK; +} + +s32 cellSailRecorderDumpImage() +{ + UNIMPLEMENTED_FUNC(cellSailRec); + return CELL_OK; +} + +Module cellSailRec("cellSailRec", []() { REG_FUNC(cellSailRec, cellSailProfileSetEsAudioParameter); REG_FUNC(cellSailRec, cellSailProfileSetEsVideoParameter); @@ -247,7 +265,6 @@ void cellSailRec_init() REG_FUNC(cellSailRec, cellSailVideoConverterProcess); REG_FUNC(cellSailRec, cellSailVideoConverterCanGetResult); REG_FUNC(cellSailRec, cellSailVideoConverterGetResult); - //cellSailRec.AddFunc(, CellSailVideoConverterFuncProcessDone); REG_FUNC(cellSailRec, cellSailFeederAudioInitialize); REG_FUNC(cellSailRec, cellSailFeederAudioFinalize); @@ -269,9 +286,9 @@ void cellSailRec_init() REG_FUNC(cellSailRec, cellSailRecorderSetFeederVideo); REG_FUNC(cellSailRec, cellSailRecorderSetParameter); REG_FUNC(cellSailRec, cellSailRecorderGetParameter); - //cellSailRec.AddFunc(, cellSailRecorderSubscribeEvent); - //cellSailRec.AddFunc(, cellSailRecorderUnsubscribeEvent); - //cellSailRec.AddFunc(, cellSailRecorderReplaceEventHandler); + REG_FUNC(cellSailRec, cellSailRecorderSubscribeEvent); + REG_FUNC(cellSailRec, cellSailRecorderUnsubscribeEvent); + REG_FUNC(cellSailRec, cellSailRecorderReplaceEventHandler); REG_FUNC(cellSailRec, cellSailRecorderBoot); REG_FUNC(cellSailRec, cellSailRecorderCreateProfile); REG_FUNC(cellSailRec, cellSailRecorderDestroyProfile); @@ -284,5 +301,4 @@ void cellSailRec_init() REG_FUNC(cellSailRec, cellSailRecorderCancel); REG_FUNC(cellSailRec, cellSailRecorderDumpImage); -} -#endif +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp index 089874f152..d1bd1f03eb 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp @@ -33,7 +33,7 @@ enum : u32 }; never_inline s32 savedata_op( - PPUThread& CPU, + PPUThread& ppu, u32 operation, u32 version, vm::cptr dirName, @@ -63,7 +63,7 @@ never_inline s32 savedata_op( // path of the specified user (00000001 by default) const std::string base_dir = fmt::format("/dev_hdd0/home/%08d/savedata/", userId ? userId : 1u); - vm::stackvar result(CPU); + vm::stackvar result(ppu); result->userdata = userdata; // probably should be assigned only once (allows the callback to change it) @@ -73,7 +73,7 @@ never_inline s32 savedata_op( { std::vector save_entries; - vm::stackvar listGet(CPU); + vm::stackvar listGet(ppu); listGet->dirNum = 0; listGet->dirListNum = 0; @@ -184,10 +184,10 @@ never_inline s32 savedata_op( if (funcList) { - vm::stackvar listSet(CPU); + vm::stackvar listSet(ppu); // List Callback - funcList(CPU, result, listGet, listSet); + funcList(ppu, result, listGet, listSet); if (result->result < 0) { @@ -296,10 +296,10 @@ never_inline s32 savedata_op( if (funcFixed) { - vm::stackvar fixedSet(CPU); + vm::stackvar fixedSet(ppu); // Fixed Callback - funcFixed(CPU, result, listGet, fixedSet); + funcFixed(ppu, result, listGet, fixedSet); if (result->result < 0) { @@ -353,8 +353,8 @@ never_inline s32 savedata_op( // Get save stats { - vm::stackvar statGet(CPU); - vm::stackvar statSet(CPU); + vm::stackvar statGet(ppu); + vm::stackvar statSet(ppu); std::string dir_local_path; @@ -434,7 +434,7 @@ never_inline s32 savedata_op( } // Stat Callback - funcStat(CPU, result, statGet, statSet); + funcStat(ppu, result, statGet, statSet); if (result->result < 0) { @@ -495,15 +495,15 @@ never_inline s32 savedata_op( } // Enter the loop where the save files are read/created/deleted - vm::stackvar fileGet(CPU); - vm::stackvar fileSet(CPU); + vm::stackvar fileGet(ppu); + vm::stackvar fileSet(ppu); fileGet->excSize = 0; memset(fileGet->reserved, 0, sizeof(fileGet->reserved)); while (funcFile) { - funcFile(CPU, result, fileGet, fileSet); + funcFile(ppu, result, fileGet, fileSet); if (result->result < 0) { @@ -618,7 +618,7 @@ never_inline s32 savedata_op( // Functions s32 cellSaveDataListSave2( - PPUThread& CPU, + PPUThread& ppu, u32 version, vm::ptr setList, vm::ptr setBuf, @@ -631,11 +631,11 @@ s32 cellSaveDataListSave2( cellSysutil.Warning("cellSaveDataListSave2(version=%d, setList=*0x%x, setBuf=*0x%x, funcList=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, setList, setBuf, funcList, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_LIST_SAVE, version, vm::null, 1, setList, setBuf, funcList, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); + return savedata_op(ppu, SAVEDATA_OP_LIST_SAVE, version, vm::null, 1, setList, setBuf, funcList, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); } s32 cellSaveDataListLoad2( - PPUThread& CPU, + PPUThread& ppu, u32 version, vm::ptr setList, vm::ptr setBuf, @@ -648,11 +648,21 @@ s32 cellSaveDataListLoad2( cellSysutil.Warning("cellSaveDataListLoad2(version=%d, setList=*0x%x, setBuf=*0x%x, funcList=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, setList, setBuf, funcList, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_LIST_LOAD, version, vm::null, 1, setList, setBuf, funcList, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); + return savedata_op(ppu, SAVEDATA_OP_LIST_LOAD, version, vm::null, 1, setList, setBuf, funcList, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); +} + +s32 cellSaveDataListSave() +{ + throw EXCEPTION(""); +} + +s32 cellSaveDataListLoad() +{ + throw EXCEPTION(""); } s32 cellSaveDataFixedSave2( - PPUThread& CPU, + PPUThread& ppu, u32 version, vm::ptr setList, vm::ptr setBuf, @@ -665,11 +675,11 @@ s32 cellSaveDataFixedSave2( cellSysutil.Warning("cellSaveDataFixedSave2(version=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_FIXED_SAVE, version, vm::null, 1, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 2, userdata, 0, vm::null); + return savedata_op(ppu, SAVEDATA_OP_FIXED_SAVE, version, vm::null, 1, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 2, userdata, 0, vm::null); } s32 cellSaveDataFixedLoad2( - PPUThread& CPU, + PPUThread& ppu, u32 version, vm::ptr setList, vm::ptr setBuf, @@ -682,11 +692,21 @@ s32 cellSaveDataFixedLoad2( cellSysutil.Warning("cellSaveDataFixedLoad2(version=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_FIXED_LOAD, version, vm::null, 1, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 2, userdata, 0, vm::null); + return savedata_op(ppu, SAVEDATA_OP_FIXED_LOAD, version, vm::null, 1, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 2, userdata, 0, vm::null); +} + +s32 cellSaveDataFixedSave() +{ + throw EXCEPTION(""); +} + +s32 cellSaveDataFixedLoad() +{ + throw EXCEPTION(""); } s32 cellSaveDataAutoSave2( - PPUThread& CPU, + PPUThread& ppu, u32 version, vm::cptr dirName, u32 errDialog, @@ -699,11 +719,11 @@ s32 cellSaveDataAutoSave2( cellSysutil.Warning("cellSaveDataAutoSave2(version=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_AUTO_SAVE, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); + return savedata_op(ppu, SAVEDATA_OP_AUTO_SAVE, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); } s32 cellSaveDataAutoLoad2( - PPUThread& CPU, + PPUThread& ppu, u32 version, vm::cptr dirName, u32 errDialog, @@ -716,11 +736,21 @@ s32 cellSaveDataAutoLoad2( cellSysutil.Warning("cellSaveDataAutoLoad2(version=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_AUTO_LOAD, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); + return savedata_op(ppu, SAVEDATA_OP_AUTO_LOAD, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); +} + +s32 cellSaveDataAutoSave() +{ + throw EXCEPTION(""); +} + +s32 cellSaveDataAutoLoad() +{ + throw EXCEPTION(""); } s32 cellSaveDataListAutoSave( - PPUThread& CPU, + PPUThread& ppu, u32 version, u32 errDialog, vm::ptr setList, @@ -734,11 +764,11 @@ s32 cellSaveDataListAutoSave( cellSysutil.Warning("cellSaveDataListAutoSave(version=%d, errDialog=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, errDialog, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_LIST_AUTO_SAVE, version, vm::null, errDialog, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 0, userdata, 0, vm::null); + return savedata_op(ppu, SAVEDATA_OP_LIST_AUTO_SAVE, version, vm::null, errDialog, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 0, userdata, 0, vm::null); } s32 cellSaveDataListAutoLoad( - PPUThread& CPU, + PPUThread& ppu, u32 version, u32 errDialog, vm::ptr setList, @@ -752,7 +782,7 @@ s32 cellSaveDataListAutoLoad( cellSysutil.Warning("cellSaveDataListAutoLoad(version=%d, errDialog=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, errDialog, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_LIST_AUTO_LOAD, version, vm::null, errDialog, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 0, userdata, 0, vm::null); + return savedata_op(ppu, SAVEDATA_OP_LIST_AUTO_LOAD, version, vm::null, errDialog, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 0, userdata, 0, vm::null); } s32 cellSaveDataDelete2(u32 container) @@ -762,8 +792,13 @@ s32 cellSaveDataDelete2(u32 container) return CELL_SAVEDATA_RET_CANCEL; } +s32 cellSaveDataDelete() +{ + throw EXCEPTION(""); +} + s32 cellSaveDataFixedDelete( - PPUThread& CPU, + PPUThread& ppu, vm::ptr setList, vm::ptr setBuf, vm::ptr funcFixed, @@ -778,7 +813,7 @@ s32 cellSaveDataFixedDelete( } s32 cellSaveDataUserListSave( - PPUThread& CPU, + PPUThread& ppu, u32 version, u32 userId, vm::ptr setList, @@ -792,11 +827,11 @@ s32 cellSaveDataUserListSave( cellSysutil.Error("cellSaveDataUserListSave(version=%d, userId=%d, setList=*0x%x, setBuf=*0x%x, funcList=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, userId, setList, setBuf, funcList, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_LIST_SAVE, version, vm::null, 0, setList, setBuf, funcList, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null); + return savedata_op(ppu, SAVEDATA_OP_LIST_SAVE, version, vm::null, 0, setList, setBuf, funcList, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null); } s32 cellSaveDataUserListLoad( - PPUThread& CPU, + PPUThread& ppu, u32 version, u32 userId, vm::ptr setList, @@ -810,11 +845,11 @@ s32 cellSaveDataUserListLoad( cellSysutil.Error("cellSaveDataUserListLoad(version=%d, userId=%d, setList=*0x%x, setBuf=*0x%x, funcList=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, userId, setList, setBuf, funcList, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_LIST_LOAD, version, vm::null, 0, setList, setBuf, funcList, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null); + return savedata_op(ppu, SAVEDATA_OP_LIST_LOAD, version, vm::null, 0, setList, setBuf, funcList, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null); } s32 cellSaveDataUserFixedSave( - PPUThread& CPU, + PPUThread& ppu, u32 version, u32 userId, vm::ptr setList, @@ -828,11 +863,11 @@ s32 cellSaveDataUserFixedSave( cellSysutil.Error("cellSaveDataUserFixedSave(version=%d, userId=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, userId, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_FIXED_SAVE, version, vm::null, 0, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 6, userdata, userId, vm::null); + return savedata_op(ppu, SAVEDATA_OP_FIXED_SAVE, version, vm::null, 0, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 6, userdata, userId, vm::null); } s32 cellSaveDataUserFixedLoad( - PPUThread& CPU, + PPUThread& ppu, u32 version, u32 userId, vm::ptr setList, @@ -846,11 +881,11 @@ s32 cellSaveDataUserFixedLoad( cellSysutil.Error("cellSaveDataUserFixedLoad(version=%d, userId=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, userId, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_FIXED_LOAD, version, vm::null, 0, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 6, userdata, userId, vm::null); + return savedata_op(ppu, SAVEDATA_OP_FIXED_LOAD, version, vm::null, 0, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 6, userdata, userId, vm::null); } s32 cellSaveDataUserAutoSave( - PPUThread& CPU, + PPUThread& ppu, u32 version, u32 userId, vm::cptr dirName, @@ -864,11 +899,11 @@ s32 cellSaveDataUserAutoSave( cellSysutil.Error("cellSaveDataUserAutoSave(version=%d, userId=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, userId, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_AUTO_SAVE, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null); + return savedata_op(ppu, SAVEDATA_OP_AUTO_SAVE, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null); } s32 cellSaveDataUserAutoLoad( - PPUThread& CPU, + PPUThread& ppu, u32 version, u32 userId, vm::cptr dirName, @@ -882,11 +917,11 @@ s32 cellSaveDataUserAutoLoad( cellSysutil.Error("cellSaveDataUserAutoLoad(version=%d, userId=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, userId, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_AUTO_LOAD, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null); + return savedata_op(ppu, SAVEDATA_OP_AUTO_LOAD, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null); } s32 cellSaveDataUserListAutoSave( - PPUThread& CPU, + PPUThread& ppu, u32 version, u32 userId, u32 errDialog, @@ -901,11 +936,11 @@ s32 cellSaveDataUserListAutoSave( cellSysutil.Error("cellSaveDataUserListAutoSave(version=%d, userId=%d, errDialog=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, userId, errDialog, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_LIST_AUTO_SAVE, version, vm::null, errDialog, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 6, userdata, userId, vm::null); + return savedata_op(ppu, SAVEDATA_OP_LIST_AUTO_SAVE, version, vm::null, errDialog, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 6, userdata, userId, vm::null); } s32 cellSaveDataUserListAutoLoad( - PPUThread& CPU, + PPUThread& ppu, u32 version, u32 userId, u32 errDialog, @@ -920,11 +955,11 @@ s32 cellSaveDataUserListAutoLoad( cellSysutil.Error("cellSaveDataUserListAutoLoad(version=%d, userId=%d, errDialog=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", version, userId, errDialog, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata); - return savedata_op(CPU, SAVEDATA_OP_LIST_AUTO_LOAD, version, vm::null, errDialog, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 6, userdata, userId, vm::null); + return savedata_op(ppu, SAVEDATA_OP_LIST_AUTO_LOAD, version, vm::null, errDialog, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 6, userdata, userId, vm::null); } s32 cellSaveDataUserFixedDelete( - PPUThread& CPU, + PPUThread& ppu, u32 userId, vm::ptr setList, vm::ptr setBuf, @@ -949,7 +984,7 @@ void cellSaveDataEnableOverlay(s32 enable) // Functions (Extensions) s32 cellSaveDataListDelete( - PPUThread& CPU, + PPUThread& ppu, vm::ptr setList, vm::ptr setBuf, vm::ptr funcList, @@ -957,59 +992,59 @@ s32 cellSaveDataListDelete( u32 container, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellSysutil); + UNIMPLEMENTED_FUNC(cellSaveData); return CELL_OK; } s32 cellSaveDataListImport( - PPUThread& CPU, + PPUThread& ppu, vm::ptr setList, u32 maxSizeKB, vm::ptr funcDone, u32 container, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellSysutil); + UNIMPLEMENTED_FUNC(cellSaveData); return CELL_OK; } s32 cellSaveDataListExport( - PPUThread& CPU, + PPUThread& ppu, vm::ptr setList, u32 maxSizeKB, vm::ptr funcDone, u32 container, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellSysutil); + UNIMPLEMENTED_FUNC(cellSaveData); return CELL_OK; } s32 cellSaveDataFixedImport( - PPUThread& CPU, + PPUThread& ppu, vm::cptr dirName, u32 maxSizeKB, vm::ptr funcDone, u32 container, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellSysutil); + UNIMPLEMENTED_FUNC(cellSaveData); return CELL_OK; } s32 cellSaveDataFixedExport( - PPUThread& CPU, + PPUThread& ppu, vm::cptr dirName, u32 maxSizeKB, vm::ptr funcDone, u32 container, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellSysutil); + UNIMPLEMENTED_FUNC(cellSaveData); return CELL_OK; } @@ -1021,13 +1056,13 @@ s32 cellSaveDataGetListItem( vm::ptr bind, vm::ptr sizeKB) { - UNIMPLEMENTED_FUNC(cellSysutil); + UNIMPLEMENTED_FUNC(cellSaveData); return CELL_OK; } s32 cellSaveDataUserListDelete( - PPUThread& CPU, + PPUThread& ppu, u32 userId, vm::ptr setList, vm::ptr setBuf, @@ -1036,13 +1071,13 @@ s32 cellSaveDataUserListDelete( u32 container, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellSysutil); + UNIMPLEMENTED_FUNC(cellSaveData); return CELL_OK; } s32 cellSaveDataUserListImport( - PPUThread& CPU, + PPUThread& ppu, u32 userId, vm::ptr setList, u32 maxSizeKB, @@ -1050,13 +1085,13 @@ s32 cellSaveDataUserListImport( u32 container, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellSysutil); + UNIMPLEMENTED_FUNC(cellSaveData); return CELL_OK; } s32 cellSaveDataUserListExport( - PPUThread& CPU, + PPUThread& ppu, u32 userId, vm::ptr setList, u32 maxSizeKB, @@ -1064,13 +1099,13 @@ s32 cellSaveDataUserListExport( u32 container, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellSysutil); + UNIMPLEMENTED_FUNC(cellSaveData); return CELL_OK; } s32 cellSaveDataUserFixedImport( - PPUThread& CPU, + PPUThread& ppu, u32 userId, vm::cptr dirName, u32 maxSizeKB, @@ -1078,13 +1113,13 @@ s32 cellSaveDataUserFixedImport( u32 container, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellSysutil); + UNIMPLEMENTED_FUNC(cellSaveData); return CELL_OK; } s32 cellSaveDataUserFixedExport( - PPUThread& CPU, + PPUThread& ppu, u32 userId, vm::cptr dirName, u32 maxSizeKB, @@ -1092,7 +1127,7 @@ s32 cellSaveDataUserFixedExport( u32 container, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellSysutil); + UNIMPLEMENTED_FUNC(cellSaveData); return CELL_OK; } @@ -1105,7 +1140,7 @@ s32 cellSaveDataUserGetListItem( vm::ptr bind, vm::ptr sizeKB) { - UNIMPLEMENTED_FUNC(cellSysutil); + UNIMPLEMENTED_FUNC(cellSaveData); return CELL_OK; } @@ -1113,11 +1148,10 @@ s32 cellSaveDataUserGetListItem( void cellSysutil_SaveData_init() { // libsysutil functions: - REG_FUNC(cellSysutil, cellSaveDataEnableOverlay); REG_FUNC(cellSysutil, cellSaveDataDelete2); - //REG_FUNC(cellSysutil, cellSaveDataDelete); + REG_FUNC(cellSysutil, cellSaveDataDelete); REG_FUNC(cellSysutil, cellSaveDataUserFixedDelete); REG_FUNC(cellSysutil, cellSaveDataFixedDelete); @@ -1125,15 +1159,15 @@ void cellSysutil_SaveData_init() REG_FUNC(cellSysutil, cellSaveDataUserFixedSave); REG_FUNC(cellSysutil, cellSaveDataFixedLoad2); REG_FUNC(cellSysutil, cellSaveDataFixedSave2); - //REG_FUNC(cellSysutil, cellSaveDataFixedLoad); - //REG_FUNC(cellSysutil, cellSaveDataFixedSave); + REG_FUNC(cellSysutil, cellSaveDataFixedLoad); + REG_FUNC(cellSysutil, cellSaveDataFixedSave); REG_FUNC(cellSysutil, cellSaveDataUserListLoad); REG_FUNC(cellSysutil, cellSaveDataUserListSave); REG_FUNC(cellSysutil, cellSaveDataListLoad2); REG_FUNC(cellSysutil, cellSaveDataListSave2); - //REG_FUNC(cellSysutil, cellSaveDataListLoad); - //REG_FUNC(cellSysutil, cellSaveDataListSave); + REG_FUNC(cellSysutil, cellSaveDataListLoad); + REG_FUNC(cellSysutil, cellSaveDataListSave); REG_FUNC(cellSysutil, cellSaveDataUserListAutoLoad); REG_FUNC(cellSysutil, cellSaveDataUserListAutoSave); @@ -1144,22 +1178,38 @@ void cellSysutil_SaveData_init() REG_FUNC(cellSysutil, cellSaveDataUserAutoSave); REG_FUNC(cellSysutil, cellSaveDataAutoLoad2); REG_FUNC(cellSysutil, cellSaveDataAutoSave2); - //REG_FUNC(cellSysutil, cellSaveDataAutoLoad); - //REG_FUNC(cellSysutil, cellSaveDataAutoSave); - - // libsysutil_savedata functions: - REG_FUNC(cellSysutil, cellSaveDataUserGetListItem); - REG_FUNC(cellSysutil, cellSaveDataGetListItem); - REG_FUNC(cellSysutil, cellSaveDataUserListDelete); - REG_FUNC(cellSysutil, cellSaveDataListDelete); - REG_FUNC(cellSysutil, cellSaveDataUserFixedExport); - REG_FUNC(cellSysutil, cellSaveDataUserFixedImport); - REG_FUNC(cellSysutil, cellSaveDataUserListExport); - REG_FUNC(cellSysutil, cellSaveDataUserListImport); - REG_FUNC(cellSysutil, cellSaveDataFixedExport); - REG_FUNC(cellSysutil, cellSaveDataFixedImport); - REG_FUNC(cellSysutil, cellSaveDataListExport); - REG_FUNC(cellSysutil, cellSaveDataListImport); - - // libsysutil_savedata_psp functions: + REG_FUNC(cellSysutil, cellSaveDataAutoLoad); + REG_FUNC(cellSysutil, cellSaveDataAutoSave); } + +Module cellSaveData("cellSaveData", []() +{ + // libsysutil_savedata functions: + REG_FUNC(cellSaveData, cellSaveDataUserGetListItem); + REG_FUNC(cellSaveData, cellSaveDataGetListItem); + REG_FUNC(cellSaveData, cellSaveDataUserListDelete); + REG_FUNC(cellSaveData, cellSaveDataListDelete); + REG_FUNC(cellSaveData, cellSaveDataUserFixedExport); + REG_FUNC(cellSaveData, cellSaveDataUserFixedImport); + REG_FUNC(cellSaveData, cellSaveDataUserListExport); + REG_FUNC(cellSaveData, cellSaveDataUserListImport); + REG_FUNC(cellSaveData, cellSaveDataFixedExport); + REG_FUNC(cellSaveData, cellSaveDataFixedImport); + REG_FUNC(cellSaveData, cellSaveDataListExport); + REG_FUNC(cellSaveData, cellSaveDataListImport); +}); + +Module cellMinisSaveData("cellMinisSaveData", []() +{ + // libsysutil_savedata_psp functions: + //REG_FUNC(cellMinisSaveData, cellMinisSaveDataDelete); // 0x6eb168b3 + //REG_FUNC(cellMinisSaveData, cellMinisSaveDataListDelete); // 0xe63eb964 + + //REG_FUNC(cellMinisSaveData, cellMinisSaveDataFixedLoad); // 0x66515c18 + //REG_FUNC(cellMinisSaveData, cellMinisSaveDataFixedSave); // 0xf3f974b8 + //REG_FUNC(cellMinisSaveData, cellMinisSaveDataListLoad); // 0xba161d45 + //REG_FUNC(cellMinisSaveData, cellMinisSaveDataListSave); // 0xa342a73f + //REG_FUNC(cellMinisSaveData, cellMinisSaveDataListAutoLoad); // 0x22f2a553 + //REG_FUNC(cellMinisSaveData, cellMinisSaveDataListAutoSave); // 0xa931356e + //REG_FUNC(cellMinisSaveData, cellMinisSaveDataAutoLoad); // 0xfc3045d9 +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSaveData.h b/rpcs3/Emu/SysCalls/Modules/cellSaveData.h index 5e7e4e71b5..9101d75c0d 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSaveData.h +++ b/rpcs3/Emu/SysCalls/Modules/cellSaveData.h @@ -265,11 +265,11 @@ struct CellSaveDataDoneGet // Callback Functions -typedef void(CellSaveDataFixedCallback)(vm::ptr cbResult, vm::ptr get, vm::ptr set); -typedef void(CellSaveDataListCallback)(vm::ptr cbResult, vm::ptr get, vm::ptr set); -typedef void(CellSaveDataStatCallback)(vm::ptr cbResult, vm::ptr get, vm::ptr set); -typedef void(CellSaveDataFileCallback)(vm::ptr cbResult, vm::ptr get, vm::ptr set); -typedef void(CellSaveDataDoneCallback)(vm::ptr cbResult, vm::ptr get); +using CellSaveDataFixedCallback = void(vm::ptr cbResult, vm::ptr get, vm::ptr set); +using CellSaveDataListCallback = void(vm::ptr cbResult, vm::ptr get, vm::ptr set); +using CellSaveDataStatCallback = void(vm::ptr cbResult, vm::ptr get, vm::ptr set); +using CellSaveDataFileCallback = void(vm::ptr cbResult, vm::ptr get, vm::ptr set); +using CellSaveDataDoneCallback = void(vm::ptr cbResult, vm::ptr get); // Auxiliary Structs @@ -298,3 +298,5 @@ struct SaveDataDialogInstance virtual s32 ShowSaveDataList(std::vector& save_entries, s32 focused, vm::ptr listSet) = 0; }; + +extern class Module cellSaveData; diff --git a/rpcs3/Emu/SysCalls/Modules/cellSearch.cpp b/rpcs3/Emu/SysCalls/Modules/cellSearch.cpp index 537b62c15d..62293ba559 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSearch.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSearch.cpp @@ -6,30 +6,9 @@ extern Module cellSearch; -struct cellSearchInternal -{ - bool m_bInitialized; - - cellSearchInternal() - : m_bInitialized(false) - { - } -}; - -cellSearchInternal cellSearchInstance; - s32 cellSearchInitialize(CellSearchMode mode, u32 container, vm::ptr func, vm::ptr userData) { - cellSearch.Todo("cellSearchInitialize()"); - - if (cellSearchInstance.m_bInitialized) - return CELL_SEARCH_ERROR_ALREADY_INITIALIZED; - if (mode != 0) - return CELL_SEARCH_ERROR_UNKNOWN_MODE; - if (!func) - return CELL_SEARCH_ERROR_PARAM; - - cellSearchInstance.m_bInitialized = true; + cellSearch.Warning("cellSearchInitialize()"); // TODO: Store the arguments somewhere so we can use them later. @@ -38,12 +17,7 @@ s32 cellSearchInitialize(CellSearchMode mode, u32 container, vm::ptr param, vm::ptr userData)>; +using CellSearchSystemCallback = void(CellSearchEvent event, s32 result, vm::cptr param, vm::ptr userData); struct CellSearchContentId { diff --git a/rpcs3/Emu/SysCalls/Modules/cellSheap.cpp b/rpcs3/Emu/SysCalls/Modules/cellSheap.cpp index 5f6982b496..98599ba76d 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSheap.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSheap.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellSheap_init(); -Module cellSheap(0x000c, cellSheap_init); +extern Module cellSheap; // Return Codes enum @@ -13,115 +13,115 @@ enum CELL_SHEAP_ERROR_SHORTAGE = 0x80410312, }; -int cellSheapInitialize() +s32 cellSheapInitialize() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellSheapAllocate() +s32 cellSheapAllocate() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellSheapFree() +s32 cellSheapFree() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellSheapQueryMax() +s32 cellSheapQueryMax() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellSheapQueryFree() +s32 cellSheapQueryFree() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapInitialize() +s32 cellKeySheapInitialize() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapBufferNew() +s32 cellKeySheapBufferNew() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapBufferDelete() +s32 cellKeySheapBufferDelete() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapMutexNew() +s32 cellKeySheapMutexNew() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapMutexDelete() +s32 cellKeySheapMutexDelete() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapBarrierNew() +s32 cellKeySheapBarrierNew() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapBarrierDelete() +s32 cellKeySheapBarrierDelete() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapSemaphoreNew() +s32 cellKeySheapSemaphoreNew() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapSemaphoreDelete() +s32 cellKeySheapSemaphoreDelete() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapRwmNew() +s32 cellKeySheapRwmNew() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapRwmDelete() +s32 cellKeySheapRwmDelete() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapQueueNew() +s32 cellKeySheapQueueNew() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -int cellKeySheapQueueDelete() +s32 cellKeySheapQueueDelete() { UNIMPLEMENTED_FUNC(cellSheap); return CELL_OK; } -void cellSheap_init() +Module cellSheap("cellSheap", []() { REG_FUNC(cellSheap, cellSheapInitialize); REG_FUNC(cellSheap, cellSheapAllocate); @@ -129,7 +129,6 @@ void cellSheap_init() REG_FUNC(cellSheap, cellSheapQueryMax); REG_FUNC(cellSheap, cellSheapQueryFree); - // (TODO: Some cellKeySheap* functions are missing) REG_FUNC(cellSheap, cellKeySheapInitialize); REG_FUNC(cellSheap, cellKeySheapBufferNew); REG_FUNC(cellSheap, cellKeySheapBufferDelete); @@ -144,5 +143,4 @@ void cellSheap_init() REG_FUNC(cellSheap, cellKeySheapRwmDelete); REG_FUNC(cellSheap, cellKeySheapQueueNew); REG_FUNC(cellSheap, cellKeySheapQueueDelete); -} -#endif +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSpudll.cpp b/rpcs3/Emu/SysCalls/Modules/cellSpudll.cpp new file mode 100644 index 0000000000..3ac245ae77 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellSpudll.cpp @@ -0,0 +1,21 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellSpudll; + +s32 cellSpudllGetImageSize(vm::ptr psize, vm::cptr so_elf, vm::cptr config) +{ + throw EXCEPTION(""); +} + +s32 cellSpudllHandleConfigSetDefaultValues(vm::ptr config) +{ + throw EXCEPTION(""); +} + +Module cellSpudll("cellSpudll", []() +{ + REG_FUNC(cellSpudll, cellSpudllGetImageSize); + REG_FUNC(cellSpudll, cellSpudllHandleConfigSetDefaultValues); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp b/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp index 456f91569e..37c2239d4a 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp @@ -60,25 +60,25 @@ s32 spursSignalToHandlerThread(PPUThread& ppu, vm::ptr spurs); s32 spursJoinHandlerThread(PPUThread& ppu, vm::ptr spurs); s32 spursInit(PPUThread& ppu, vm::ptr spurs, u32 revision, u32 sdkVersion, s32 nSpus, s32 spuPriority, s32 ppuPriority, u32 flags, vm::cptr prefix, u32 prefixSize, u32 container, vm::cptr swlPriority, u32 swlMaxSpu, u32 swlIsPreem); -s32 cellSpursInitialize(PPUThread& ppu, vm::ptr spurs, s32 nSpus, s32 spuPriority, s32 ppuPriority, bool exitIfNoWork); +s32 cellSpursInitialize(PPUThread& ppu, vm::ptr spurs, s32 nSpus, s32 spuPriority, s32 ppuPriority, b8 exitIfNoWork); s32 cellSpursInitializeWithAttribute(PPUThread& ppu, vm::ptr spurs, vm::cptr attr); s32 cellSpursInitializeWithAttribute2(PPUThread& ppu, vm::ptr spurs, vm::cptr attr); -s32 _cellSpursAttributeInitialize(vm::ptr attr, u32 revision, u32 sdkVersion, u32 nSpus, s32 spuPriority, s32 ppuPriority, bool exitIfNoWork); +s32 _cellSpursAttributeInitialize(vm::ptr attr, u32 revision, u32 sdkVersion, u32 nSpus, s32 spuPriority, s32 ppuPriority, b8 exitIfNoWork); s32 cellSpursAttributeSetMemoryContainerForSpuThread(vm::ptr attr, u32 container); s32 cellSpursAttributeSetNamePrefix(vm::ptr attr, vm::cptr prefix, u32 size); s32 cellSpursAttributeEnableSpuPrintfIfAvailable(vm::ptr attr); s32 cellSpursAttributeSetSpuThreadGroupType(vm::ptr attr, s32 type); -s32 cellSpursAttributeEnableSystemWorkload(vm::ptr attr, vm::cptr priority, u32 maxSpu, vm::cptr isPreemptible); +s32 cellSpursAttributeEnableSystemWorkload(vm::ptr attr, vm::cptr priority, u32 maxSpu, vm::cptr isPreemptible); s32 cellSpursFinalize(vm::ptr spurs); s32 cellSpursGetSpuThreadGroupId(vm::ptr spurs, vm::ptr group); s32 cellSpursGetNumSpuThread(vm::ptr spurs, vm::ptr nThreads); s32 cellSpursGetSpuThreadId(vm::ptr spurs, vm::ptr thread, vm::ptr nThreads); s32 cellSpursSetMaxContention(vm::ptr spurs, u32 wid, u32 maxContention); s32 cellSpursSetPriorities(vm::ptr spurs, u32 wid, vm::cptr priorities); -s32 cellSpursSetPreemptionVictimHints(vm::ptr spurs, vm::cptr isPreemptible); +s32 cellSpursSetPreemptionVictimHints(vm::ptr spurs, vm::cptr isPreemptible); s32 cellSpursAttachLv2EventQueue(PPUThread& ppu, vm::ptr spurs, u32 queue, vm::ptr port, s32 isDynamic); s32 cellSpursDetachLv2EventQueue(vm::ptr spurs, u8 port); -s32 cellSpursEnableExceptionEventHandler(vm::ptr spurs, bool flag); +s32 cellSpursEnableExceptionEventHandler(vm::ptr spurs, b8 flag); s32 cellSpursSetGlobalExceptionEventHandler(vm::ptr spurs, vm::ptr eaHandler, vm::ptr arg); s32 cellSpursUnsetGlobalExceptionEventHandler(vm::ptr spurs); s32 cellSpursGetInfo(vm::ptr spurs, vm::ptr info); @@ -1167,7 +1167,7 @@ s32 spursInit( if (flags & SAF_SPU_PRINTF_ENABLED) { // spu_printf: attach group - if (!spu_printf_agcb || spu_printf_agcb(ppu, spurs->spuTG) != CELL_OK) + if (!g_spu_printf_agcb || g_spu_printf_agcb(ppu, spurs->spuTG) != CELL_OK) { // remove flag if failed spurs->flags &= ~SAF_SPU_PRINTF_ENABLED; @@ -1266,7 +1266,7 @@ s32 spursInit( } /// Initialise SPURS -s32 cellSpursInitialize(PPUThread& ppu, vm::ptr spurs, s32 nSpus, s32 spuPriority, s32 ppuPriority, bool exitIfNoWork) +s32 cellSpursInitialize(PPUThread& ppu, vm::ptr spurs, s32 nSpus, s32 spuPriority, s32 ppuPriority, b8 exitIfNoWork) { cellSpurs.Warning("cellSpursInitialize(spurs=*0x%x, nSpus=%d, spuPriority=%d, ppuPriority=%d, exitIfNoWork=%d)", spurs, nSpus, spuPriority, ppuPriority, exitIfNoWork); @@ -1348,7 +1348,7 @@ s32 cellSpursInitializeWithAttribute2(PPUThread& ppu, vm::ptr spurs, } /// Initialise SPURS attribute -s32 _cellSpursAttributeInitialize(vm::ptr attr, u32 revision, u32 sdkVersion, u32 nSpus, s32 spuPriority, s32 ppuPriority, bool exitIfNoWork) +s32 _cellSpursAttributeInitialize(vm::ptr attr, u32 revision, u32 sdkVersion, u32 nSpus, s32 spuPriority, s32 ppuPriority, b8 exitIfNoWork) { cellSpurs.Warning("_cellSpursAttributeInitialize(attr=*0x%x, revision=%d, sdkVersion=0x%x, nSpus=%d, spuPriority=%d, ppuPriority=%d, exitIfNoWork=%d)", attr, revision, sdkVersion, nSpus, spuPriority, ppuPriority, exitIfNoWork); @@ -1478,7 +1478,7 @@ s32 cellSpursAttributeSetSpuThreadGroupType(vm::ptr attr, s3 } /// Enable the system workload -s32 cellSpursAttributeEnableSystemWorkload(vm::ptr attr, vm::cptr priority, u32 maxSpu, vm::cptr isPreemptible) +s32 cellSpursAttributeEnableSystemWorkload(vm::ptr attr, vm::cptr priority, u32 maxSpu, vm::cptr isPreemptible) { cellSpurs.Warning("cellSpursAttributeEnableSystemWorkload(attr=*0x%x, priority=*0x%x, maxSpu=%d, isPreemptible=*0x%x)", attr, priority, maxSpu, isPreemptible); @@ -1737,8 +1737,15 @@ s32 cellSpursSetPriorities(vm::ptr spurs, u32 wid, vm::cptr prior return CELL_OK; } +/// Set the priority of a workload for the specified SPU +s32 cellSpursSetPriority(vm::ptr spurs, u32 wid, u32 spuId, u32 priority) +{ + cellSpurs.Todo("cellSpursSetPriority(spurs=*0x%x, wid=%d, spuId=%d, priority=%d)", spurs, wid, spuId, priority); + return CELL_OK; +} + /// Set preemption victim SPU -s32 cellSpursSetPreemptionVictimHints(vm::ptr spurs, vm::cptr isPreemptible) +s32 cellSpursSetPreemptionVictimHints(vm::ptr spurs, vm::cptr isPreemptible) { UNIMPLEMENTED_FUNC(cellSpurs); return CELL_OK; @@ -1761,7 +1768,7 @@ s32 cellSpursDetachLv2EventQueue(vm::ptr spurs, u8 port) } /// Enable the SPU exception event handler -s32 cellSpursEnableExceptionEventHandler(vm::ptr spurs, bool flag) +s32 cellSpursEnableExceptionEventHandler(vm::ptr spurs, b8 flag) { cellSpurs.Warning("cellSpursEnableExceptionEventHandler(spurs=*0x%x, flag=%d)", spurs, flag); @@ -4226,6 +4233,7 @@ Module cellSpurs("cellSpurs", []() REG_FUNC(cellSpurs, cellSpursGetInfo); REG_FUNC(cellSpurs, cellSpursSetMaxContention); REG_FUNC(cellSpurs, cellSpursSetPriorities); + REG_FUNC(cellSpurs, cellSpursSetPriority); REG_FUNC(cellSpurs, cellSpursSetPreemptionVictimHints); REG_FUNC(cellSpurs, cellSpursAttachLv2EventQueue); REG_FUNC(cellSpurs, cellSpursDetachLv2EventQueue); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSpurs.h b/rpcs3/Emu/SysCalls/Modules/cellSpurs.h index 952c848f27..f4cc4174d6 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSpurs.h +++ b/rpcs3/Emu/SysCalls/Modules/cellSpurs.h @@ -317,7 +317,7 @@ struct set_alignment(8) CellSpursAttribute CHECK_SIZE_ALIGN(CellSpursAttribute, 512, 8); -using CellSpursShutdownCompletionEventHook = func_def spurs, u32 wid, vm::ptr arg)>; +using CellSpursShutdownCompletionEventHook = void(vm::ptr spurs, u32 wid, vm::ptr arg); struct set_alignment(16) CellSpursTraceInfo { @@ -428,7 +428,7 @@ struct set_alignment(128) CellSpurs struct EventPortMux; - using EventHandlerCallback = func_def, u64 data)>; + using EventHandlerCallback = void(vm::ptr, u64 data); struct EventHandlerListNode { @@ -588,7 +588,7 @@ struct CellSpursExceptionInfo }; // Exception handler -using CellSpursGlobalExceptionEventHandler = func_def spurs, vm::cptr info, u32 id, vm::ptr arg)>; +using CellSpursGlobalExceptionEventHandler = void(vm::ptr spurs, vm::cptr info, u32 id, vm::ptr arg); struct CellSpursWorkloadAttribute { @@ -678,7 +678,7 @@ struct set_alignment(16) CellSpursTaskAttribute2 CHECK_SIZE_ALIGN(CellSpursTaskAttribute2, 256, 16); // Exception handler -using CellSpursTasksetExceptionEventHandler = func_def spurs, vm::ptr taskset, u32 idTask, vm::cptr info, vm::ptr arg)>; +using CellSpursTasksetExceptionEventHandler = void(vm::ptr spurs, vm::ptr taskset, u32 idTask, vm::cptr info, vm::ptr arg); struct set_alignment(128) CellSpursTaskExitCode { diff --git a/rpcs3/Emu/SysCalls/Modules/cellSpursJq.cpp b/rpcs3/Emu/SysCalls/Modules/cellSpursJq.cpp index 0b8ae8ef09..7ead629d4b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSpursJq.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSpursJq.cpp @@ -378,6 +378,12 @@ s32 cellSpursJobQueueSetExceptionEventHandler() return CELL_OK; } +s32 cellSpursJobQueueSetExceptionEventHandler2() +{ + UNIMPLEMENTED_FUNC(cellSpursJq); + return CELL_OK; +} + s32 cellSpursJobQueueUnsetExceptionEventHandler() { UNIMPLEMENTED_FUNC(cellSpursJq); @@ -447,5 +453,6 @@ Module cellSpursJq("cellSpursJq", []() REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2CopyPushJobBody); REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2PushJobBody); REG_FUNC(cellSpursJq, cellSpursJobQueueSetExceptionEventHandler); + REG_FUNC(cellSpursJq, cellSpursJobQueueSetExceptionEventHandler2); REG_FUNC(cellSpursJq, cellSpursJobQueueUnsetExceptionEventHandler); }); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSsl.cpp b/rpcs3/Emu/SysCalls/Modules/cellSsl.cpp index 3b53c3a142..dc39b2fb7a 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSsl.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSsl.cpp @@ -1,94 +1,94 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellSsl_init(); -Module cellSsl(0x0003, cellSsl_init); +extern Module cellSsl; -int cellSslInit() +s32 cellSslInit() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslEnd() +s32 cellSslEnd() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslCertificateLoader() +s32 cellSslCertificateLoader() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslCertGetSerialNumber() +s32 cellSslCertGetSerialNumber() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslCertGetPublicKey() +s32 cellSslCertGetPublicKey() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslCertGetRsaPublicKeyModulus() +s32 cellSslCertGetRsaPublicKeyModulus() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslCertGetRsaPublicKeyExponent() +s32 cellSslCertGetRsaPublicKeyExponent() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslCertGetNotBefore() +s32 cellSslCertGetNotBefore() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslCertGetNotAfter() +s32 cellSslCertGetNotAfter() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslCertGetSubjectName() +s32 cellSslCertGetSubjectName() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslCertGetIssuerName() +s32 cellSslCertGetIssuerName() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslCertGetNameEntryCount() +s32 cellSslCertGetNameEntryCount() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslCertGetNameEntryInfo() +s32 cellSslCertGetNameEntryInfo() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -int cellSslCertGetMd5Fingerprint() +s32 cellSslCertGetMd5Fingerprint() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; } -void cellSsl_init() +Module cellSsl("cellSsl", []() { REG_FUNC(cellSsl, cellSslInit); REG_FUNC(cellSsl, cellSslEnd); @@ -106,5 +106,4 @@ void cellSsl_init() REG_FUNC(cellSsl, cellSslCertGetNameEntryCount); REG_FUNC(cellSsl, cellSslCertGetNameEntryInfo); REG_FUNC(cellSsl, cellSslCertGetMd5Fingerprint); -} -#endif +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellStorage.cpp b/rpcs3/Emu/SysCalls/Modules/cellStorage.cpp new file mode 100644 index 0000000000..90a49f9f81 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellStorage.cpp @@ -0,0 +1,28 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellSysutil; + +s32 cellStorageDataImportMove() +{ + throw EXCEPTION(""); +} + +s32 cellStorageDataImport() +{ + throw EXCEPTION(""); +} + +s32 cellStorageDataExport() +{ + throw EXCEPTION(""); +} + + +void cellSysutil_Storage_init() +{ + REG_FUNC(cellSysutil, cellStorageDataImportMove); + REG_FUNC(cellSysutil, cellStorageDataImport); + REG_FUNC(cellSysutil, cellStorageDataExport); +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.h b/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.h index 590a6aa41b..ca217f71eb 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.h +++ b/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.h @@ -82,4 +82,4 @@ struct CellSubDisplayPeerInfo CellSubDisplayNickname pspNickname; }; -using CellSubDisplayHandler = func_def userdata)>; +using CellSubDisplayHandler = void(s32 cbMsg, u64 cbParam, vm::ptr userdata); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSync.cpp b/rpcs3/Emu/SysCalls/Modules/cellSync.cpp index 27a6000acc..048423451b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSync.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSync.cpp @@ -1596,6 +1596,41 @@ s32 _cellSyncLFQueueDetachLv2EventQueue(vm::ptr spus, u32 num, vm::ptr const char* + { + switch (code) + { + case CELL_SYNC_ERROR_AGAIN: return "CELL_SYNC_ERROR_AGAIN"; + case CELL_SYNC_ERROR_INVAL: return "CELL_SYNC_ERROR_INVAL"; + case CELL_SYNC_ERROR_NOSYS: return "CELL_SYNC_ERROR_NOSYS"; + case CELL_SYNC_ERROR_NOMEM: return "CELL_SYNC_ERROR_NOMEM"; + case CELL_SYNC_ERROR_SRCH: return "CELL_SYNC_ERROR_SRCH"; + case CELL_SYNC_ERROR_NOENT: return "CELL_SYNC_ERROR_NOENT"; + case CELL_SYNC_ERROR_NOEXEC: return "CELL_SYNC_ERROR_NOEXEC"; + case CELL_SYNC_ERROR_DEADLK: return "CELL_SYNC_ERROR_DEADLK"; + case CELL_SYNC_ERROR_PERM: return "CELL_SYNC_ERROR_PERM"; + case CELL_SYNC_ERROR_BUSY: return "CELL_SYNC_ERROR_BUSY"; + case CELL_SYNC_ERROR_ABORT: return "CELL_SYNC_ERROR_ABORT"; + case CELL_SYNC_ERROR_FAULT: return "CELL_SYNC_ERROR_FAULT"; + case CELL_SYNC_ERROR_CHILD: return "CELL_SYNC_ERROR_CHILD"; + case CELL_SYNC_ERROR_STAT: return "CELL_SYNC_ERROR_STAT"; + case CELL_SYNC_ERROR_ALIGN: return "CELL_SYNC_ERROR_ALIGN"; + } + + return "???"; + }; + + // analyse error code + if (u32 code = (value & 0xffffff00) == 0x80410100 ? static_cast(value) : 0) + { + cellSync.Error("%s() -> %s (0x%x)", func->name, get_error(code), code); + } + }; + REG_FUNC(cellSync, cellSyncMutexInitialize); REG_FUNC(cellSync, cellSyncMutexLock); REG_FUNC(cellSync, cellSyncMutexTryLock); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSync2.cpp b/rpcs3/Emu/SysCalls/Modules/cellSync2.cpp index b1406ea74e..c5ebc8911c 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSync2.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSync2.cpp @@ -251,6 +251,13 @@ s32 cellSync2QueueGetDepth() Module cellSync2("cellSync2", []() { + //REG_VARIABLE(cellSync2, gCellSync2CallerThreadTypePpuThread); + //REG_VARIABLE(cellSync2, gCellSync2NotifierPpuThread); + //REG_VARIABLE(cellSync2, gCellSync2CallerThreadTypePpuFiber); + //REG_VARIABLE(cellSync2, gCellSync2NotifierPpuFiber); + //REG_VARIABLE(cellSync2, gCellSync2NotifierSpursTask); + //REG_VARIABLE(cellSync2, gCellSync2NotifierSpursJobQueueJob); + REG_FUNC(cellSync2, _cellSync2MutexAttributeInitialize); REG_FUNC(cellSync2, cellSync2MutexEstimateBufferSize); REG_FUNC(cellSync2, cellSync2MutexInitialize); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSync2.h b/rpcs3/Emu/SysCalls/Modules/cellSync2.h index 557562b8d7..50538dc570 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSync2.h +++ b/rpcs3/Emu/SysCalls/Modules/cellSync2.h @@ -35,7 +35,7 @@ struct CellSync2MutexAttribute be_t sdkVersion; be_t threadTypes; be_t maxWaiters; - bool recursive; + b8 recursive; u8 padding; char name[CELL_SYNC2_NAME_MAX_LENGTH + 1]; u8 reserved[86]; diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysconf.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysconf.cpp new file mode 100644 index 0000000000..7988c5312a --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellSysconf.cpp @@ -0,0 +1,33 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellSysconf; + +s32 cellSysconfAbort() +{ + throw EXCEPTION(""); +} + +s32 cellSysconfOpen() +{ + throw EXCEPTION(""); +} + +s32 cellSysconfBtGetDeviceList() +{ + throw EXCEPTION(""); +} + +void cellSysutil_Sysconf_init() +{ + extern Module cellSysutil; + + REG_FUNC(cellSysutil, cellSysconfAbort); + REG_FUNC(cellSysutil, cellSysconfOpen); +} + +Module cellSysconf("cellSysconf", []() +{ + REG_FUNC(cellSysconf, cellSysconfBtGetDeviceList); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp index 3a51927a28..db958914f9 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp @@ -4,8 +4,6 @@ #include "Emu/SysCalls/ModuleManager.h" #include "Emu/SysCalls/Modules.h" -namespace vm { using namespace ps3; } - extern Module cellSysmodule; enum @@ -18,124 +16,114 @@ enum CELL_SYSMODULE_ERROR_FATAL = 0x800120ff, }; -const char *getModuleName(int id) { - struct +const char* get_module_id(u16 id) +{ + switch (id) { - const char *name; - int id; - } static const entries[] = { - {"CELL_SYSMODULE_INVALID", 0x0000ffff}, - {"CELL_SYSMODULE_NET", 0x00000000}, - {"CELL_SYSMODULE_HTTP", 0x00000001}, - {"CELL_SYSMODULE_HTTP_UTIL", 0x00000002}, - {"CELL_SYSMODULE_SSL", 0x00000003}, - {"CELL_SYSMODULE_HTTPS", 0x00000004}, - {"CELL_SYSMODULE_VDEC", 0x00000005}, - {"CELL_SYSMODULE_ADEC", 0x00000006}, - {"CELL_SYSMODULE_DMUX", 0x00000007}, - {"CELL_SYSMODULE_VPOST", 0x00000008}, - {"CELL_SYSMODULE_RTC", 0x00000009}, - {"CELL_SYSMODULE_SPURS", 0x0000000a}, - {"CELL_SYSMODULE_OVIS", 0x0000000b}, - {"CELL_SYSMODULE_SHEAP", 0x0000000c}, - {"CELL_SYSMODULE_SYNC", 0x0000000d}, - {"CELL_SYSMODULE_FS", 0x0000000e}, - {"CELL_SYSMODULE_JPGDEC", 0x0000000f}, - {"CELL_SYSMODULE_GCM_SYS", 0x00000010}, - {"CELL_SYSMODULE_GCM", 0x00000010}, - {"CELL_SYSMODULE_AUDIO", 0x00000011}, - {"CELL_SYSMODULE_PAMF", 0x00000012}, - {"CELL_SYSMODULE_ATRAC3PLUS", 0x00000013}, - {"CELL_SYSMODULE_NETCTL", 0x00000014}, - {"CELL_SYSMODULE_SYSUTIL", 0x00000015}, - {"CELL_SYSMODULE_SYSUTIL_NP", 0x00000016}, - {"CELL_SYSMODULE_IO", 0x00000017}, - {"CELL_SYSMODULE_PNGDEC", 0x00000018}, - {"CELL_SYSMODULE_FONT", 0x00000019}, - {"CELL_SYSMODULE_FONTFT", 0x0000001a}, - {"CELL_SYSMODULE_FREETYPE", 0x0000001b}, - {"CELL_SYSMODULE_USBD", 0x0000001c}, - {"CELL_SYSMODULE_SAIL", 0x0000001d}, - {"CELL_SYSMODULE_L10N", 0x0000001e}, - {"CELL_SYSMODULE_RESC", 0x0000001f}, - {"CELL_SYSMODULE_DAISY", 0x00000020}, - {"CELL_SYSMODULE_KEY2CHAR", 0x00000021}, - {"CELL_SYSMODULE_MIC", 0x00000022}, - {"CELL_SYSMODULE_CAMERA", 0x00000023}, - {"CELL_SYSMODULE_VDEC_MPEG2", 0x00000024}, - {"CELL_SYSMODULE_VDEC_AVC", 0x00000025}, - {"CELL_SYSMODULE_ADEC_LPCM", 0x00000026}, - {"CELL_SYSMODULE_ADEC_AC3", 0x00000027}, - {"CELL_SYSMODULE_ADEC_ATX", 0x00000028}, - {"CELL_SYSMODULE_ADEC_AT3", 0x00000029}, - {"CELL_SYSMODULE_DMUX_PAMF", 0x0000002a}, - {"CELL_SYSMODULE_VDEC_AL", 0x0000002b}, - {"CELL_SYSMODULE_ADEC_AL", 0x0000002c}, - {"CELL_SYSMODULE_DMUX_AL", 0x0000002d}, - {"CELL_SYSMODULE_LV2DBG", 0x0000002e}, - {"CELL_SYSMODULE_USBPSPCM", 0x00000030}, - {"CELL_SYSMODULE_AVCONF_EXT", 0x00000031}, - {"CELL_SYSMODULE_SYSUTIL_USERINFO", 0x00000032}, - {"CELL_SYSMODULE_SYSUTIL_SAVEDATA", 0x00000033}, - {"CELL_SYSMODULE_SUBDISPLAY", 0x00000034}, - {"CELL_SYSMODULE_SYSUTIL_REC", 0x00000035}, - {"CELL_SYSMODULE_VIDEO_EXPORT", 0x00000036}, - {"CELL_SYSMODULE_SYSUTIL_GAME_EXEC", 0x00000037}, - {"CELL_SYSMODULE_SYSUTIL_NP2", 0x00000038}, - {"CELL_SYSMODULE_SYSUTIL_AP", 0x00000039}, - {"CELL_SYSMODULE_SYSUTIL_NP_CLANS", 0x0000003a}, - {"CELL_SYSMODULE_SYSUTIL_OSK_EXT", 0x0000003b}, - {"CELL_SYSMODULE_VDEC_DIVX", 0x0000003c}, - {"CELL_SYSMODULE_JPGENC", 0x0000003d}, - {"CELL_SYSMODULE_SYSUTIL_GAME", 0x0000003e}, - {"CELL_SYSMODULE_BGDL", 0x0000003f}, - {"CELL_SYSMODULE_FREETYPE_TT", 0x00000040}, - {"CELL_SYSMODULE_SYSUTIL_VIDEO_UPLOAD", 0x00000041}, - {"CELL_SYSMODULE_SYSUTIL_SYSCONF_EXT", 0x00000042}, - {"CELL_SYSMODULE_FIBER", 0x00000043}, - {"CELL_SYSMODULE_SYSUTIL_NP_COMMERCE2", 0x00000044}, - {"CELL_SYSMODULE_SYSUTIL_NP_TUS", 0x00000045}, - {"CELL_SYSMODULE_VOICE", 0x00000046}, - {"CELL_SYSMODULE_ADEC_CELP8", 0x00000047}, - {"CELL_SYSMODULE_CELP8ENC", 0x00000048}, - {"CELL_SYSMODULE_SYSUTIL_LICENSEAREA", 0x00000049}, - {"CELL_SYSMODULE_SYSUTIL_MUSIC2", 0x0000004a}, - {"CELL_SYSMODULE_SYSUTIL_SCREENSHOT", 0x0000004e}, - {"CELL_SYSMODULE_SYSUTIL_MUSIC_DECODE", 0x0000004f}, - {"CELL_SYSMODULE_SPURS_JQ", 0x00000050}, - {"CELL_SYSMODULE_PNGENC", 0x00000052}, - {"CELL_SYSMODULE_SYSUTIL_MUSIC_DECODE2", 0x00000053}, - {"CELL_SYSMODULE_SYNC2", 0x00000055}, - {"CELL_SYSMODULE_SYSUTIL_NP_UTIL", 0x00000056}, - {"CELL_SYSMODULE_RUDP", 0x00000057}, - {"CELL_SYSMODULE_SYSUTIL_NP_SNS", 0x00000059}, - {"CELL_SYSMODULE_GEM", 0x0000005a}, - {"CELL_SYSMODULE_CELPENC", 0x0000f00a}, - {"CELL_SYSMODULE_GIFDEC", 0x0000f010}, - {"CELL_SYSMODULE_ADEC_CELP", 0x0000f019}, - {"CELL_SYSMODULE_ADEC_M2BC", 0x0000f01b}, - {"CELL_SYSMODULE_ADEC_M4AAC", 0x0000f01d}, - {"CELL_SYSMODULE_ADEC_MP3", 0x0000f01e}, - {"CELL_SYSMODULE_IMEJP", 0x0000f023}, - {"CELL_SYSMODULE_SYSUTIL_MUSIC", 0x0000f028}, - {"CELL_SYSMODULE_PHOTO_EXPORT", 0x0000f029}, - {"CELL_SYSMODULE_PRINT", 0x0000f02a}, - {"CELL_SYSMODULE_PHOTO_IMPORT", 0x0000f02b}, - {"CELL_SYSMODULE_MUSIC_EXPORT", 0x0000f02c}, - {"CELL_SYSMODULE_PHOTO_DECODE", 0x0000f02e}, - {"CELL_SYSMODULE_SYSUTIL_SEARCH", 0x0000f02f}, - {"CELL_SYSMODULE_SYSUTIL_AVCHAT2", 0x0000f030}, - {"CELL_SYSMODULE_SAIL_REC", 0x0000f034}, - {"CELL_SYSMODULE_SYSUTIL_NP_TROPHY", 0x0000f035}, - {"CELL_SYSMODULE_LIBATRAC3MULTI", 0x0000f054}, - }; - - for (int i = 0; i < sizeof(entries) / sizeof(entries[0]); ++i) - { - if (entries[i].id == id) - { - return entries[i].name; - } + case 0x0000: return "CELL_SYSMODULE_NET"; + case 0x0001: return "CELL_SYSMODULE_HTTP"; + case 0x0002: return "CELL_SYSMODULE_HTTP_UTIL"; + case 0x0003: return "CELL_SYSMODULE_SSL"; + case 0x0004: return "CELL_SYSMODULE_HTTPS"; + case 0x0005: return "CELL_SYSMODULE_VDEC"; + case 0x0006: return "CELL_SYSMODULE_ADEC"; + case 0x0007: return "CELL_SYSMODULE_DMUX"; + case 0x0008: return "CELL_SYSMODULE_VPOST"; + case 0x0009: return "CELL_SYSMODULE_RTC"; + case 0x000a: return "CELL_SYSMODULE_SPURS"; + case 0x000b: return "CELL_SYSMODULE_OVIS"; + case 0x000c: return "CELL_SYSMODULE_SHEAP"; + case 0x000d: return "CELL_SYSMODULE_SYNC"; + case 0x000e: return "CELL_SYSMODULE_FS"; + case 0x000f: return "CELL_SYSMODULE_JPGDEC"; + case 0x0010: return "CELL_SYSMODULE_GCM_SYS"; + case 0x0011: return "CELL_SYSMODULE_AUDIO"; + case 0x0012: return "CELL_SYSMODULE_PAMF"; + case 0x0013: return "CELL_SYSMODULE_ATRAC3PLUS"; + case 0x0014: return "CELL_SYSMODULE_NETCTL"; + case 0x0015: return "CELL_SYSMODULE_SYSUTIL"; + case 0x0016: return "CELL_SYSMODULE_SYSUTIL_NP"; + case 0x0017: return "CELL_SYSMODULE_IO"; + case 0x0018: return "CELL_SYSMODULE_PNGDEC"; + case 0x0019: return "CELL_SYSMODULE_FONT"; + case 0x001a: return "CELL_SYSMODULE_FONTFT"; + case 0x001b: return "CELL_SYSMODULE_FREETYPE"; + case 0x001c: return "CELL_SYSMODULE_USBD"; + case 0x001d: return "CELL_SYSMODULE_SAIL"; + case 0x001e: return "CELL_SYSMODULE_L10N"; + case 0x001f: return "CELL_SYSMODULE_RESC"; + case 0x0020: return "CELL_SYSMODULE_DAISY"; + case 0x0021: return "CELL_SYSMODULE_KEY2CHAR"; + case 0x0022: return "CELL_SYSMODULE_MIC"; + case 0x0023: return "CELL_SYSMODULE_CAMERA"; + case 0x0024: return "CELL_SYSMODULE_VDEC_MPEG2"; + case 0x0025: return "CELL_SYSMODULE_VDEC_AVC"; + case 0x0026: return "CELL_SYSMODULE_ADEC_LPCM"; + case 0x0027: return "CELL_SYSMODULE_ADEC_AC3"; + case 0x0028: return "CELL_SYSMODULE_ADEC_ATX"; + case 0x0029: return "CELL_SYSMODULE_ADEC_AT3"; + case 0x002a: return "CELL_SYSMODULE_DMUX_PAMF"; + case 0x002b: return "CELL_SYSMODULE_VDEC_AL"; + case 0x002c: return "CELL_SYSMODULE_ADEC_AL"; + case 0x002d: return "CELL_SYSMODULE_DMUX_AL"; + case 0x002e: return "CELL_SYSMODULE_LV2DBG"; + case 0x002f: return "CELL_SYSMODULE_SYSUTIL_AVCHAT"; + case 0x0030: return "CELL_SYSMODULE_USBPSPCM"; + case 0x0031: return "CELL_SYSMODULE_AVCONF_EXT"; + case 0x0032: return "CELL_SYSMODULE_SYSUTIL_USERINFO"; + case 0x0033: return "CELL_SYSMODULE_SYSUTIL_SAVEDATA"; + case 0x0034: return "CELL_SYSMODULE_SUBDISPLAY"; + case 0x0035: return "CELL_SYSMODULE_SYSUTIL_REC"; + case 0x0036: return "CELL_SYSMODULE_VIDEO_EXPORT"; + case 0x0037: return "CELL_SYSMODULE_SYSUTIL_GAME_EXEC"; + case 0x0038: return "CELL_SYSMODULE_SYSUTIL_NP2"; + case 0x0039: return "CELL_SYSMODULE_SYSUTIL_AP"; + case 0x003a: return "CELL_SYSMODULE_SYSUTIL_NP_CLANS"; + case 0x003b: return "CELL_SYSMODULE_SYSUTIL_OSK_EXT"; + case 0x003c: return "CELL_SYSMODULE_VDEC_DIVX"; + case 0x003d: return "CELL_SYSMODULE_JPGENC"; + case 0x003e: return "CELL_SYSMODULE_SYSUTIL_GAME"; + case 0x003f: return "CELL_SYSMODULE_BGDL"; + case 0x0040: return "CELL_SYSMODULE_FREETYPE_TT"; + case 0x0041: return "CELL_SYSMODULE_SYSUTIL_VIDEO_UPLOAD"; + case 0x0042: return "CELL_SYSMODULE_SYSUTIL_SYSCONF_EXT"; + case 0x0043: return "CELL_SYSMODULE_FIBER"; + case 0x0044: return "CELL_SYSMODULE_SYSUTIL_NP_COMMERCE2"; + case 0x0045: return "CELL_SYSMODULE_SYSUTIL_NP_TUS"; + case 0x0046: return "CELL_SYSMODULE_VOICE"; + case 0x0047: return "CELL_SYSMODULE_ADEC_CELP8"; + case 0x0048: return "CELL_SYSMODULE_CELP8ENC"; + case 0x0049: return "CELL_SYSMODULE_SYSUTIL_LICENSEAREA"; + case 0x004a: return "CELL_SYSMODULE_SYSUTIL_MUSIC2"; + case 0x004e: return "CELL_SYSMODULE_SYSUTIL_SCREENSHOT"; + case 0x004f: return "CELL_SYSMODULE_SYSUTIL_MUSIC_DECODE"; + case 0x0050: return "CELL_SYSMODULE_SPURS_JQ"; + case 0x0052: return "CELL_SYSMODULE_PNGENC"; + case 0x0053: return "CELL_SYSMODULE_SYSUTIL_MUSIC_DECODE2"; + case 0x0055: return "CELL_SYSMODULE_SYNC2"; + case 0x0056: return "CELL_SYSMODULE_SYSUTIL_NP_UTIL"; + case 0x0057: return "CELL_SYSMODULE_RUDP"; + case 0x0059: return "CELL_SYSMODULE_SYSUTIL_NP_SNS"; + case 0x005a: return "CELL_SYSMODULE_GEM"; + case 0xf00a: return "CELL_SYSMODULE_CELPENC"; + case 0xf010: return "CELL_SYSMODULE_GIFDEC"; + case 0xf019: return "CELL_SYSMODULE_ADEC_CELP"; + case 0xf01b: return "CELL_SYSMODULE_ADEC_M2BC"; + case 0xf01d: return "CELL_SYSMODULE_ADEC_M4AAC"; + case 0xf01e: return "CELL_SYSMODULE_ADEC_MP3"; + case 0xf023: return "CELL_SYSMODULE_IMEJP"; + case 0xf028: return "CELL_SYSMODULE_SYSUTIL_MUSIC"; + case 0xf029: return "CELL_SYSMODULE_PHOTO_EXPORT"; + case 0xf02a: return "CELL_SYSMODULE_PRINT"; + case 0xf02b: return "CELL_SYSMODULE_PHOTO_IMPORT"; + case 0xf02c: return "CELL_SYSMODULE_MUSIC_EXPORT"; + case 0xf02e: return "CELL_SYSMODULE_PHOTO_DECODE"; + case 0xf02f: return "CELL_SYSMODULE_SYSUTIL_SEARCH"; + case 0xf030: return "CELL_SYSMODULE_SYSUTIL_AVCHAT2"; + case 0xf034: return "CELL_SYSMODULE_SAIL_REC"; + case 0xf035: return "CELL_SYSMODULE_SYSUTIL_NP_TROPHY"; + case 0xf054: return "CELL_SYSMODULE_LIBATRAC3MULTI"; + case 0xffff: return "CELL_SYSMODULE_INVALID"; } return "UNKNOWN MODULE"; @@ -161,11 +149,10 @@ s32 cellSysmoduleSetMemcontainer(u32 ct_id) s32 cellSysmoduleLoadModule(u16 id) { - cellSysmodule.Warning("cellSysmoduleLoadModule(id=0x%04x: %s)", id, getModuleName(id)); + cellSysmodule.Warning("cellSysmoduleLoadModule(id=0x%04x: %s)", id, get_module_id(id)); if (!Emu.GetModuleManager().CheckModuleId(id)) { - cellSysmodule.Error("cellSysmoduleLoadModule() failed: unknown module (id=0x%04x)", id); return CELL_SYSMODULE_ERROR_UNKNOWN; } @@ -180,11 +167,10 @@ s32 cellSysmoduleLoadModule(u16 id) s32 cellSysmoduleUnloadModule(u16 id) { - cellSysmodule.Warning("cellSysmoduleUnloadModule(id=0x%04x: %s)", id, getModuleName(id)); + cellSysmodule.Warning("cellSysmoduleUnloadModule(id=0x%04x: %s)", id, get_module_id(id)); if (!Emu.GetModuleManager().CheckModuleId(id)) { - cellSysmodule.Error("cellSysmoduleUnloadModule() failed: unknown module (id=0x%04x)", id); return CELL_SYSMODULE_ERROR_UNKNOWN; } @@ -204,11 +190,10 @@ s32 cellSysmoduleUnloadModule(u16 id) s32 cellSysmoduleIsLoaded(u16 id) { - cellSysmodule.Warning("cellSysmoduleIsLoaded(id=0x%04x: %s)", id, getModuleName(id)); + cellSysmodule.Warning("cellSysmoduleIsLoaded(id=0x%04x: %s)", id, get_module_id(id)); if (!Emu.GetModuleManager().CheckModuleId(id)) { - cellSysmodule.Error("cellSysmoduleIsLoaded() failed: unknown module (id=0x%04x)", id); return CELL_SYSMODULE_ERROR_UNKNOWN; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp index 159bfdd3bf..ea49057c69 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp @@ -5,17 +5,8 @@ #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Callback.h" -#include "Emu/DbgCommand.h" -#include "rpcs3/Ini.h" -#include "Emu/FS/vfsFile.h" -#include "Loader/PSF.h" -#include "Emu/RSX/sysutil_video.h" -#include "Emu/RSX/GSManager.h" -#include "Emu/Audio/AudioManager.h" +#include "Ini.h" #include "Emu/FS/VFS.h" -#include "cellMsgDialog.h" -#include "cellAudioIn.h" -#include "cellAudioOut.h" #include "cellSysutil.h" extern Module cellSysutil; @@ -141,166 +132,6 @@ s32 cellSysutilGetSystemParamString(s32 id, vm::ptr buf, u32 bufsize) return CELL_OK; } -s32 cellVideoOutGetState(u32 videoOut, u32 deviceIndex, vm::ptr state) -{ - cellSysutil.Log("cellVideoOutGetState(videoOut=%d, deviceIndex=%d, state=*0x%x)", videoOut, deviceIndex, state); - - if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; - - switch(videoOut) - { - case CELL_VIDEO_OUT_PRIMARY: - state->state = Emu.GetGSManager().GetState(); - state->colorSpace = Emu.GetGSManager().GetColorSpace(); - state->displayMode.resolutionId = Emu.GetGSManager().GetInfo().mode.resolutionId; - state->displayMode.scanMode = Emu.GetGSManager().GetInfo().mode.scanMode; - state->displayMode.conversion = Emu.GetGSManager().GetInfo().mode.conversion; - state->displayMode.aspect = Emu.GetGSManager().GetInfo().mode.aspect; - state->displayMode.refreshRates = Emu.GetGSManager().GetInfo().mode.refreshRates; - return CELL_VIDEO_OUT_SUCCEEDED; - - case CELL_VIDEO_OUT_SECONDARY: - *state = { CELL_VIDEO_OUT_OUTPUT_STATE_DISABLED }; // ??? - return CELL_VIDEO_OUT_SUCCEEDED; - } - - return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; -} - -s32 cellVideoOutGetResolution(u32 resolutionId, vm::ptr resolution) -{ - cellSysutil.Log("cellVideoOutGetResolution(resolutionId=%d, resolution=*0x%x)", resolutionId, resolution); - - u32 num = ResolutionIdToNum(resolutionId); - if(!num) - return CELL_EINVAL; - - resolution->width = ResolutionTable[num].width; - resolution->height = ResolutionTable[num].height; - - return CELL_VIDEO_OUT_SUCCEEDED; -} - -s32 cellVideoOutConfigure(u32 videoOut, vm::ptr config, vm::ptr option, u32 waitForEvent) -{ - cellSysutil.Warning("cellVideoOutConfigure(videoOut=%d, config=*0x%x, option=*0x%x, waitForEvent=0x%x)", videoOut, config, option, waitForEvent); - - switch(videoOut) - { - case CELL_VIDEO_OUT_PRIMARY: - if(config->resolutionId) - { - Emu.GetGSManager().GetInfo().mode.resolutionId = config->resolutionId; - } - - Emu.GetGSManager().GetInfo().mode.format = config->format; - - if(config->aspect) - { - Emu.GetGSManager().GetInfo().mode.aspect = config->aspect; - } - - if(config->pitch) - { - Emu.GetGSManager().GetInfo().mode.pitch = config->pitch; - } - - return CELL_VIDEO_OUT_SUCCEEDED; - - case CELL_VIDEO_OUT_SECONDARY: - return CELL_VIDEO_OUT_SUCCEEDED; - } - - return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; -} - -s32 cellVideoOutGetConfiguration(u32 videoOut, vm::ptr config, vm::ptr option) -{ - cellSysutil.Warning("cellVideoOutGetConfiguration(videoOut=%d, config=*0x%x, option=*0x%x)", videoOut, config, option); - - if (option) *option = {}; - *config = {}; - - switch(videoOut) - { - case CELL_VIDEO_OUT_PRIMARY: - config->resolutionId = Emu.GetGSManager().GetInfo().mode.resolutionId; - config->format = Emu.GetGSManager().GetInfo().mode.format; - config->aspect = Emu.GetGSManager().GetInfo().mode.aspect; - config->pitch = Emu.GetGSManager().GetInfo().mode.pitch; - - return CELL_VIDEO_OUT_SUCCEEDED; - - case CELL_VIDEO_OUT_SECONDARY: - - return CELL_VIDEO_OUT_SUCCEEDED; - } - - return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; -} - -s32 cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, vm::ptr info) -{ - cellSysutil.Warning("cellVideoOutGetDeviceInfo(videoOut=%d, deviceIndex=%d, info=*0x%x)", videoOut, deviceIndex, info); - - if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; - - // Use standard dummy values for now. - info->portType = CELL_VIDEO_OUT_PORT_HDMI; - info->colorSpace = Emu.GetGSManager().GetColorSpace(); - info->latency = 1000; - info->availableModeCount = 1; - info->state = CELL_VIDEO_OUT_DEVICE_STATE_AVAILABLE; - info->rgbOutputRange = 1; - info->colorInfo.blueX = 0xFFFF; - info->colorInfo.blueY = 0xFFFF; - info->colorInfo.greenX = 0xFFFF; - info->colorInfo.greenY = 0xFFFF; - info->colorInfo.redX = 0xFFFF; - info->colorInfo.redY = 0xFFFF; - info->colorInfo.whiteX = 0xFFFF; - info->colorInfo.whiteY = 0xFFFF; - info->colorInfo.gamma = 100; - info->availableModes[0].aspect = 0; - info->availableModes[0].conversion = 0; - info->availableModes[0].refreshRates = 0xF; - info->availableModes[0].resolutionId = 1; - info->availableModes[0].scanMode = 0; - - return CELL_OK; -} - -s32 cellVideoOutGetNumberOfDevice(u32 videoOut) -{ - cellSysutil.Warning("cellVideoOutGetNumberOfDevice(videoOut=%d)", videoOut); - - switch(videoOut) - { - case CELL_VIDEO_OUT_PRIMARY: return 1; - case CELL_VIDEO_OUT_SECONDARY: return 0; - } - - return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; -} - -s32 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); - - 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_640x720_3D_FRAME_PACKING)) - return 0; - - switch(videoOut) - { - case CELL_VIDEO_OUT_PRIMARY: return 1; - case CELL_VIDEO_OUT_SECONDARY: return 0; - } - - return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; -} - struct sys_callback { vm::ptr func; @@ -369,233 +200,6 @@ s32 cellSysutilUnregisterCallback(s32 slot) return CELL_OK; } -s32 cellAudioOutGetSoundAvailability(u32 audioOut, u32 type, u32 fs, u32 option) -{ - cellSysutil.Warning("cellAudioOutGetSoundAvailability(audioOut=%d, type=%d, fs=0x%x, option=%d)", audioOut, type, fs, option); - - option = 0; - - s32 available = 8; // should be at least 2 - - switch(fs) - { - case CELL_AUDIO_OUT_FS_32KHZ: - case CELL_AUDIO_OUT_FS_44KHZ: - case CELL_AUDIO_OUT_FS_48KHZ: - case CELL_AUDIO_OUT_FS_88KHZ: - case CELL_AUDIO_OUT_FS_96KHZ: - case CELL_AUDIO_OUT_FS_176KHZ: - case CELL_AUDIO_OUT_FS_192KHZ: - break; - - default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE; - } - - switch(type) - { - case CELL_AUDIO_OUT_CODING_TYPE_LPCM: break; - case CELL_AUDIO_OUT_CODING_TYPE_AC3: available = 0; break; - case CELL_AUDIO_OUT_CODING_TYPE_DTS: available = 0; break; - - default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE; - } - - switch(audioOut) - { - case CELL_AUDIO_OUT_PRIMARY: return available; - case CELL_AUDIO_OUT_SECONDARY: return 0; - } - - return CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION; -} - -s32 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)", audioOut, type, fs, ch, option); - - option = 0; - - s32 available = 8; // should be at least 2 - - switch(fs) - { - case CELL_AUDIO_OUT_FS_32KHZ: - case CELL_AUDIO_OUT_FS_44KHZ: - case CELL_AUDIO_OUT_FS_48KHZ: - case CELL_AUDIO_OUT_FS_88KHZ: - case CELL_AUDIO_OUT_FS_96KHZ: - case CELL_AUDIO_OUT_FS_176KHZ: - case CELL_AUDIO_OUT_FS_192KHZ: - break; - - default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE; - } - - switch(ch) - { - case 2: break; - case 6: available = 0; break; - case 8: available = 0; break; - - default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE; - } - - switch(type) - { - case CELL_AUDIO_OUT_CODING_TYPE_LPCM: break; - case CELL_AUDIO_OUT_CODING_TYPE_AC3: available = 0; break; - case CELL_AUDIO_OUT_CODING_TYPE_DTS: available = 0; break; - - default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE; - } - - switch(audioOut) - { - case CELL_AUDIO_OUT_PRIMARY: return available; - case CELL_AUDIO_OUT_SECONDARY: return 0; - } - - return CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION; -} - -s32 cellAudioOutGetState(u32 audioOut, u32 deviceIndex, vm::ptr state) -{ - cellSysutil.Warning("cellAudioOutGetState(audioOut=0x%x, deviceIndex=0x%x, state=*0x%x)", audioOut, deviceIndex, state); - - *state = {}; - - switch(audioOut) - { - case CELL_AUDIO_OUT_PRIMARY: - state->state = CELL_AUDIO_OUT_OUTPUT_STATE_ENABLED; - state->encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; - state->downMixer = CELL_AUDIO_OUT_DOWNMIXER_NONE; - state->soundMode.type = CELL_AUDIO_OUT_CODING_TYPE_LPCM; - state->soundMode.channel = CELL_AUDIO_OUT_CHNUM_8; - state->soundMode.fs = CELL_AUDIO_OUT_FS_48KHZ; - state->soundMode.reserved = 0; - state->soundMode.layout = CELL_AUDIO_OUT_SPEAKER_LAYOUT_8CH_LREClrxy; - - return CELL_OK; - - case CELL_AUDIO_OUT_SECONDARY: - state->state = CELL_AUDIO_OUT_OUTPUT_STATE_DISABLED; - - return CELL_OK; - } - - return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT; -} - -s32 cellAudioOutConfigure(u32 audioOut, vm::ptr config, vm::ptr option, u32 waitForEvent) -{ - cellSysutil.Warning("cellAudioOutConfigure(audioOut=%d, config=*0x%x, option=*0x%x, waitForEvent=%d)", audioOut, config, option, waitForEvent); - - switch(audioOut) - { - case CELL_AUDIO_OUT_PRIMARY: - if (config->channel) - { - //Emu.GetAudioManager().GetInfo().mode.channel = config->channel; - } - - //Emu.GetAudioManager().GetInfo().mode.encoder = config->encoder; - - if(config->downMixer) - { - //Emu.GetAudioManager().GetInfo().mode.downMixer = config->downMixer; - } - - return CELL_OK; - - case CELL_AUDIO_OUT_SECONDARY: - return CELL_OK; - } - - return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT; -} - -s32 cellAudioOutGetConfiguration(u32 audioOut, vm::ptr config, vm::ptr option) -{ - cellSysutil.Warning("cellAudioOutGetConfiguration(audioOut=%d, config=*0x%x, option=*0x%x)", audioOut, config, option); - - if (option) *option = {}; - *config = {}; - - switch(audioOut) - { - case CELL_AUDIO_OUT_PRIMARY: - config->channel = CELL_AUDIO_OUT_CHNUM_8; - config->encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; - config->downMixer = CELL_AUDIO_OUT_DOWNMIXER_NONE; - - return CELL_OK; - - case CELL_AUDIO_OUT_SECONDARY: - - return CELL_OK; - } - - return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT; -} - -s32 cellAudioOutGetNumberOfDevice(u32 audioOut) -{ - cellSysutil.Warning("cellAudioOutGetNumberOfDevice(audioOut=%d)", audioOut); - - switch(audioOut) - { - case CELL_AUDIO_OUT_PRIMARY: return 1; - case CELL_AUDIO_OUT_SECONDARY: return 0; - } - - return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT; -} - -s32 cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, vm::ptr info) -{ - cellSysutil.Todo("cellAudioOutGetDeviceInfo(audioOut=%d, deviceIndex=%d, info=*0x%x)", audioOut, deviceIndex, info); - - if(deviceIndex) return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND; - - info->portType = CELL_AUDIO_OUT_PORT_HDMI; - info->availableModeCount = 1; - info->state = CELL_AUDIO_OUT_DEVICE_STATE_AVAILABLE; - info->latency = 1000; - info->availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM; - info->availableModes[0].channel = CELL_AUDIO_OUT_CHNUM_8; - info->availableModes[0].fs = CELL_AUDIO_OUT_FS_48KHZ; - info->availableModes[0].layout = CELL_AUDIO_OUT_SPEAKER_LAYOUT_8CH_LREClrxy; - - return CELL_OK; -} - -s32 cellAudioOutSetCopyControl(u32 audioOut, u32 control) -{ - cellSysutil.Warning("cellAudioOutSetCopyControl(audioOut=%d, control=%d)", audioOut, control); - - switch(audioOut) - { - case CELL_AUDIO_OUT_PRIMARY: - case CELL_AUDIO_OUT_SECONDARY: - break; - - default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT; - } - - switch(control) - { - case CELL_AUDIO_OUT_COPY_CONTROL_COPY_FREE: - case CELL_AUDIO_OUT_COPY_CONTROL_COPY_ONCE: - case CELL_AUDIO_OUT_COPY_CONTROL_COPY_NEVER: - break; - - default: return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER; - } - - return CELL_OK; -} - struct CellSysCacheParam { char cacheId[CELL_SYSCACHE_ID_SIZE]; @@ -697,19 +301,58 @@ s32 cellSysutilGetBgmPlaybackStatus2(vm::ptr stat return CELL_OK; } -s32 cellWebBrowserEstimate2(vm::cptr config, vm::ptr memSize) +s32 cellSysutilSetBgmPlaybackExtraParam() { - cellSysutil.Warning("cellWebBrowserEstimate2(config=*0x%x, memSize=*0x%x)", config, memSize); - - // TODO: When cellWebBrowser stuff is implemented, change this to some real - // needed memory buffer size. - *memSize = 1 * 1024 * 1024; // 1 MB - return CELL_OK; + throw EXCEPTION(""); } +s32 cellSysutilRegisterCallbackDispatcher() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilPacketWrite() +{ + throw EXCEPTION(""); +} + + +s32 cellSysutilGameDataAssignVmc() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilGameDataExit() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilGameExit_I() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilGamePowerOff_I() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilGameReboot_I() +{ + throw EXCEPTION(""); +} + + extern void cellSysutil_SaveData_init(); extern void cellSysutil_GameData_init(); extern void cellSysutil_MsgDialog_init(); +extern void cellSysutil_OskDialog_init(); +extern void cellSysutil_Storage_init(); +extern void cellSysutil_Sysconf_init(); +extern void cellSysutil_SysutilAvc_init(); +extern void cellSysutil_WebBrowser_init(); +extern void cellSysutil_AudioOut_init(); +extern void cellSysutil_VideoOut_init(); Module cellSysutil("cellSysutil", []() { @@ -722,43 +365,38 @@ Module cellSysutil("cellSysutil", []() cellSysutil_SaveData_init(); // cellSaveData functions cellSysutil_GameData_init(); // cellGameData, cellHddGame functions cellSysutil_MsgDialog_init(); // cellMsgDialog functions + cellSysutil_OskDialog_init(); // cellOskDialog functions + cellSysutil_Storage_init(); // cellStorage functions + cellSysutil_Sysconf_init(); // cellSysconf functions + cellSysutil_SysutilAvc_init(); // cellSysutilAvc functions + cellSysutil_WebBrowser_init(); // cellWebBrowser, cellWebComponent functions + cellSysutil_AudioOut_init(); // cellAudioOut functions + cellSysutil_VideoOut_init(); // cellVideoOut functions REG_FUNC(cellSysutil, cellSysutilGetSystemParamInt); REG_FUNC(cellSysutil, cellSysutilGetSystemParamString); - REG_FUNC(cellSysutil, cellVideoOutGetState); - REG_FUNC(cellSysutil, cellVideoOutGetResolution); - REG_FUNC(cellSysutil, cellVideoOutConfigure); - REG_FUNC(cellSysutil, cellVideoOutGetConfiguration); - REG_FUNC(cellSysutil, cellVideoOutGetDeviceInfo); - REG_FUNC(cellSysutil, cellVideoOutGetNumberOfDevice); - REG_FUNC(cellSysutil, cellVideoOutGetResolutionAvailability); - REG_FUNC(cellSysutil, cellSysutilCheckCallback); REG_FUNC(cellSysutil, cellSysutilRegisterCallback); REG_FUNC(cellSysutil, cellSysutilUnregisterCallback); - REG_FUNC(cellSysutil, cellAudioOutGetState); - REG_FUNC(cellSysutil, cellAudioOutConfigure); - REG_FUNC(cellSysutil, cellAudioOutGetSoundAvailability); - REG_FUNC(cellSysutil, cellAudioOutGetSoundAvailability2); - REG_FUNC(cellSysutil, cellAudioOutGetDeviceInfo); - REG_FUNC(cellSysutil, cellAudioOutGetNumberOfDevice); - REG_FUNC(cellSysutil, cellAudioOutGetConfiguration); - REG_FUNC(cellSysutil, cellAudioOutSetCopyControl); - REG_FUNC(cellSysutil, cellSysutilGetBgmPlaybackStatus); REG_FUNC(cellSysutil, cellSysutilGetBgmPlaybackStatus2); REG_FUNC(cellSysutil, cellSysutilEnableBgmPlayback); REG_FUNC(cellSysutil, cellSysutilEnableBgmPlaybackEx); REG_FUNC(cellSysutil, cellSysutilDisableBgmPlayback); REG_FUNC(cellSysutil, cellSysutilDisableBgmPlaybackEx); + REG_FUNC(cellSysutil, cellSysutilSetBgmPlaybackExtraParam); REG_FUNC(cellSysutil, cellSysCacheMount); REG_FUNC(cellSysutil, cellSysCacheClear); - //REG_FUNC(cellSysutil, cellSysutilRegisterCallbackDispatcher); - //REG_FUNC(cellSysutil, cellSysutilPacketWrite); + REG_FUNC(cellSysutil, cellSysutilRegisterCallbackDispatcher); + REG_FUNC(cellSysutil, cellSysutilPacketWrite); - REG_FUNC(cellSysutil, cellWebBrowserEstimate2); + REG_FUNC(cellSysutil, cellSysutilGameDataAssignVmc); + REG_FUNC(cellSysutil, cellSysutilGameDataExit); + REG_FUNC(cellSysutil, cellSysutilGameExit_I); + REG_FUNC(cellSysutil, cellSysutilGamePowerOff_I); + REG_FUNC(cellSysutil, cellSysutilGameReboot_I); }); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.h b/rpcs3/Emu/SysCalls/Modules/cellSysutil.h index 8cfdbfeef6..385a0bef70 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.h +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.h @@ -80,7 +80,7 @@ enum CELL_SYSUTIL_SYSCHAT_VOICE_STREAMING_PAUSED = 0x0164, }; -using CellSysutilCallback = func_def userdata)>; +using CellSysutilCallback = void(u64 status, u64 param, vm::ptr userdata); void sysutilSendSystemCommand(u64 status, u64 param); @@ -154,71 +154,6 @@ enum CELL_SYSCACHE_ERROR_NOTMOUNTED = 0x8002bc04, // We don't really need to simulate the mounting, so this is probably useless }; -using CellWebBrowserCallback = func_def client_session, vm::ptr usrdata)>; -using CellWebComponentCallback = func_def client_session, vm::ptr usrdata)>; -using CellWebBrowserSystemCallback = func_def usrdata)>; - -using CellWebBrowserMIMETypeCallback = func_def mimetype, vm::cptr url, vm::ptr usrdata)>; -using CellWebBrowserErrorCallback = func_def usrdata)>; -using CellWebBrowserStatusCallback = func_def usrdata)>; -using CellWebBrowserNotify = func_def message, vm::ptr usrdata)>; -using CellWebBrowserUsrdata = func_def usrdata)>; - -struct CellWebBrowserMimeSet -{ - vm::bcptr type; - vm::bcptr directory; -}; - -struct CellWebBrowserPos -{ - be_t x; - be_t y; -}; - -struct CellWebBrowserSize -{ - be_t width; - be_t height; -}; - -struct CellWebBrowserRect -{ - CellWebBrowserPos pos; - CellWebBrowserSize size; -}; - -struct CellWebBrowserConfig -{ - be_t version; - be_t heap_size; - vm::bcptr mimesets; - be_t mimeset_num; - be_t functions; - be_t tab_count; - vm::bptr exit_cb; - vm::bptr download_cb; - vm::bptr navigated_cb; -}; - -struct CellWebBrowserConfig2 -{ - be_t version; - be_t heap_size; - be_t functions; - be_t tab_count; - be_t size_mode; - be_t view_restriction; - vm::bptr unknown_mimetype_cb; - vm::bptr error_cb; - vm::bptr status_error_cb; - vm::bptr notify_cb; - vm::bptr request_cb; - CellWebBrowserRect rect; - be_t resolution_factor; - be_t magic_number_; -}; - enum CellSysutilBgmPlaybackStatusState { CELL_SYSUTIL_BGMPLAYBACK_STATUS_PLAY = 0, diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp index 396c6a6093..a5277ffb39 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp @@ -2,8 +2,6 @@ #include "Emu/Memory/Memory.h" #include "Emu/SysCalls/Modules.h" -namespace vm { using namespace ps3; } - extern Module cellSysutilAp; // Return Codes diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutilAvc.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutilAvc.cpp new file mode 100644 index 0000000000..7e25b01051 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutilAvc.cpp @@ -0,0 +1,269 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellSysutilAvc; + +s32 cellSysutilAvcByeRequest() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcCancelByeRequest() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcCancelJoinRequest() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcEnumPlayers() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcGetAttribute() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcGetLayoutMode() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcGetShowStatus() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcGetSpeakerVolumeLevel() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcGetVideoMuting() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcGetVoiceMuting() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcHidePanel() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcJoinRequest() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcLoadAsync() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcSetAttribute() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcSetLayoutMode() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcSetSpeakerVolumeLevel() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcSetVideoMuting() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcSetVoiceMuting() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcShowPanel() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcUnloadAsync() +{ + throw EXCEPTION(""); +} + + +s32 cellSysutilAvcExtInitOptionParam() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtSetHideNamePlate() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtSetShowNamePlate() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtHideWindow() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtShowWindow() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtGetWindowAlpha() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtGetWindowSize() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtGetWindowRotation() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtGetWindowPosition() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtSetWindowAlpha() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtSetWindowSize() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtSetWindowRotation() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtSetWindowPosition() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtLoadAsyncEx() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtHidePanelEx() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtShowPanelEx() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtGetNamePlateShowStatus() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtStopVoiceDetection() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtStartVoiceDetection() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtGetSurfacePointer() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtSetWindowZorder() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvcExtGetWindowShowStatus() +{ + throw EXCEPTION(""); +} + + +void cellSysutil_SysutilAvc_init() +{ + extern Module cellSysutil; + + REG_FUNC(cellSysutil, cellSysutilAvcByeRequest); + REG_FUNC(cellSysutil, cellSysutilAvcCancelByeRequest); + REG_FUNC(cellSysutil, cellSysutilAvcCancelJoinRequest); + REG_FUNC(cellSysutil, cellSysutilAvcEnumPlayers); + REG_FUNC(cellSysutil, cellSysutilAvcGetAttribute); + REG_FUNC(cellSysutil, cellSysutilAvcGetLayoutMode); + REG_FUNC(cellSysutil, cellSysutilAvcGetShowStatus); + REG_FUNC(cellSysutil, cellSysutilAvcGetSpeakerVolumeLevel); + REG_FUNC(cellSysutil, cellSysutilAvcGetVideoMuting); + REG_FUNC(cellSysutil, cellSysutilAvcGetVoiceMuting); + REG_FUNC(cellSysutil, cellSysutilAvcHidePanel); + REG_FUNC(cellSysutil, cellSysutilAvcJoinRequest); + REG_FUNC(cellSysutil, cellSysutilAvcLoadAsync); + REG_FUNC(cellSysutil, cellSysutilAvcSetAttribute); + REG_FUNC(cellSysutil, cellSysutilAvcSetLayoutMode); + REG_FUNC(cellSysutil, cellSysutilAvcSetSpeakerVolumeLevel); + REG_FUNC(cellSysutil, cellSysutilAvcSetVideoMuting); + REG_FUNC(cellSysutil, cellSysutilAvcSetVoiceMuting); + REG_FUNC(cellSysutil, cellSysutilAvcShowPanel); + REG_FUNC(cellSysutil, cellSysutilAvcUnloadAsync); +} + +Module cellSysutilAvc("cellSysutilAvc", []() +{ + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtInitOptionParam); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtSetHideNamePlate); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtSetShowNamePlate); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtHideWindow); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtShowWindow); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtGetWindowAlpha); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtGetWindowSize); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtGetWindowRotation); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtGetWindowPosition); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtSetWindowAlpha); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtSetWindowSize); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtSetWindowRotation); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtSetWindowPosition); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtLoadAsyncEx); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtHidePanelEx); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtShowPanelEx); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtGetNamePlateShowStatus); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtStopVoiceDetection); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtStartVoiceDetection); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtGetSurfacePointer); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtSetWindowZorder); + REG_FUNC(cellSysutilAvc, cellSysutilAvcExtGetWindowShowStatus); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutilAvc2.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutilAvc2.cpp new file mode 100644 index 0000000000..3f726b2a4b --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutilAvc2.cpp @@ -0,0 +1,334 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellSysutilAvc2; + +s32 cellSysutilAvc2GetPlayerInfo() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2JoinChat() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2StopStreaming() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2ChangeVideoResolution() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2ShowScreen() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2GetVideoMuting() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2GetWindowAttribute() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2StopStreaming2() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2SetVoiceMuting() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2StartVoiceDetection() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2UnloadAsync() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2StopVoiceDetection() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2GetAttribute() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2LoadAsync() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2SetSpeakerVolumeLevel() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2SetWindowString() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2EstimateMemoryContainerSize() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2SetVideoMuting() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2SetPlayerVoiceMuting() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2SetStreamingTarget() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2Unload() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2DestroyWindow() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2SetWindowPosition() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2GetSpeakerVolumeLevel() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2IsCameraAttached() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2MicRead() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2GetPlayerVoiceMuting() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2JoinChatRequest() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2StartStreaming() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2SetWindowAttribute() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2GetWindowShowStatus() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2InitParam() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2GetWindowSize() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2SetStreamPriority() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2LeaveChatRequest() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2IsMicAttached() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2CreateWindow() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2GetSpeakerMuting() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2ShowWindow() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2SetWindowSize() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2EnumPlayers() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2GetWindowString() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2LeaveChat() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2SetSpeakerMuting() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2Load() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2SetAttribute() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2UnloadAsync2() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2StartStreaming2() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2HideScreen() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2HideWindow() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2GetVoiceMuting() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2GetScreenShowStatus() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2Unload2() +{ + throw EXCEPTION(""); +} + +s32 cellSysutilAvc2GetWindowPosition() +{ + throw EXCEPTION(""); +} + + +Module cellSysutilAvc2("cellSysutilAvc2", []() +{ + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetPlayerInfo); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2JoinChat); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2StopStreaming); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2ChangeVideoResolution); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2ShowScreen); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetVideoMuting); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetWindowAttribute); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2StopStreaming2); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2SetVoiceMuting); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2StartVoiceDetection); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2UnloadAsync); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2StopVoiceDetection); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetAttribute); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2LoadAsync); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2SetSpeakerVolumeLevel); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2SetWindowString); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2EstimateMemoryContainerSize); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2SetVideoMuting); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2SetPlayerVoiceMuting); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2SetStreamingTarget); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2Unload); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2DestroyWindow); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2SetWindowPosition); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetSpeakerVolumeLevel); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2IsCameraAttached); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2MicRead); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetPlayerVoiceMuting); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2JoinChatRequest); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2StartStreaming); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2SetWindowAttribute); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetWindowShowStatus); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2InitParam); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetWindowSize); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2SetStreamPriority); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2LeaveChatRequest); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2IsMicAttached); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2CreateWindow); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetSpeakerMuting); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2ShowWindow); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2SetWindowSize); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2EnumPlayers); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetWindowString); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2LeaveChat); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2SetSpeakerMuting); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2Load); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2SetAttribute); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2UnloadAsync2); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2StartStreaming2); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2HideScreen); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2HideWindow); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetVoiceMuting); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetScreenShowStatus); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2Unload2); + REG_FUNC(cellSysutilAvc2, cellSysutilAvc2GetWindowPosition); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutilMisc.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutilMisc.cpp new file mode 100644 index 0000000000..7658cbee4c --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutilMisc.cpp @@ -0,0 +1,15 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellSysutilMisc; + +s32 cellSysutilGetLicenseArea() +{ + throw EXCEPTION(""); +} + +Module cellSysutilMisc("cellSysutilMisc", []() +{ + REG_FUNC(cellSysutilMisc, cellSysutilGetLicenseArea); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellUsbd.cpp b/rpcs3/Emu/SysCalls/Modules/cellUsbd.cpp index df6c8693c9..decd6f680f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellUsbd.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellUsbd.cpp @@ -6,38 +6,16 @@ extern Module cellUsbd; -struct cellUsbdInternal -{ - bool m_bInitialized; - - cellUsbdInternal() - : m_bInitialized(false) - { - } -}; - -cellUsbdInternal cellUsbdInstance; - s32 cellUsbdInit() { - cellUsbd.Log("cellUsbdInit()"); - - if (cellUsbdInstance.m_bInitialized) - return CELL_USBD_ERROR_ALREADY_INITIALIZED; - - cellUsbdInstance.m_bInitialized = true; + cellUsbd.Warning("cellUsbdInit()"); return CELL_OK; } s32 cellUsbdEnd() { - cellUsbd.Log("cellUsbdEnd()"); - - if (!cellUsbdInstance.m_bInitialized) - return CELL_USBD_ERROR_NOT_INITIALIZED; - - cellUsbdInstance.m_bInitialized = false; + cellUsbd.Warning("cellUsbdEnd()"); return CELL_OK; } @@ -176,8 +154,6 @@ s32 cellUsbdFreeMemory() Module cellUsbd("cellUsbd", []() { - cellUsbdInstance.m_bInitialized = false; - REG_FUNC(cellUsbd, cellUsbdInit); REG_FUNC(cellUsbd, cellUsbdEnd); diff --git a/rpcs3/Emu/SysCalls/Modules/cellUsbpspcm.cpp b/rpcs3/Emu/SysCalls/Modules/cellUsbpspcm.cpp index 6a1603a546..c69e0cb85e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellUsbpspcm.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellUsbpspcm.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" -void cellUsbpspcm_init(); -Module cellUsbpspcm(0x0030, cellUsbpspcm_init); +extern Module cellUsbPspcm; // Return Codes enum @@ -21,196 +21,195 @@ enum CELL_USBPSPCM_ERROR_NO_DATA = 0x8011040C, }; -int cellUsbPspcmInit() +s32 cellUsbPspcmInit() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmEnd() +s32 cellUsbPspcmEnd() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmCalcPoolSize() +s32 cellUsbPspcmCalcPoolSize() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmRegister() +s32 cellUsbPspcmRegister() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmUnregister() +s32 cellUsbPspcmUnregister() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmGetAddr() +s32 cellUsbPspcmGetAddr() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmBind() +s32 cellUsbPspcmBind() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmBindAsync() +s32 cellUsbPspcmBindAsync() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmWaitBindAsync() +s32 cellUsbPspcmWaitBindAsync() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmPollBindAsync() +s32 cellUsbPspcmPollBindAsync() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmCancelBind() +s32 cellUsbPspcmCancelBind() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmClose() +s32 cellUsbPspcmClose() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmSend() +s32 cellUsbPspcmSend() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmSendAsync() +s32 cellUsbPspcmSendAsync() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmWaitSendAsync() +s32 cellUsbPspcmWaitSendAsync() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmPollSendAsync() +s32 cellUsbPspcmPollSendAsync() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmRecv() +s32 cellUsbPspcmRecv() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmRecvAsync() +s32 cellUsbPspcmRecvAsync() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmWaitRecvAsync() +s32 cellUsbPspcmWaitRecvAsync() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmPollRecvAsync() +s32 cellUsbPspcmPollRecvAsync() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmReset() +s32 cellUsbPspcmReset() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmResetAsync() +s32 cellUsbPspcmResetAsync() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmWaitResetAsync() +s32 cellUsbPspcmWaitResetAsync() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmPollResetAsync() +s32 cellUsbPspcmPollResetAsync() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmWaitData() +s32 cellUsbPspcmWaitData() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmPollData() +s32 cellUsbPspcmPollData() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -int cellUsbPspcmCancelWaitData() +s32 cellUsbPspcmCancelWaitData() { - UNIMPLEMENTED_FUNC(cellUsbpspcm); + UNIMPLEMENTED_FUNC(cellUsbPspcm); return CELL_OK; } -void cellUsbpspcm_init() +Module cellUsbPspcm("cellUsbPspcm", []() { - REG_FUNC(cellUsbpspcm, cellUsbPspcmInit); - REG_FUNC(cellUsbpspcm, cellUsbPspcmEnd); - REG_FUNC(cellUsbpspcm, cellUsbPspcmCalcPoolSize); - REG_FUNC(cellUsbpspcm, cellUsbPspcmRegister); - REG_FUNC(cellUsbpspcm, cellUsbPspcmUnregister); - REG_FUNC(cellUsbpspcm, cellUsbPspcmGetAddr); - REG_FUNC(cellUsbpspcm, cellUsbPspcmBind); - REG_FUNC(cellUsbpspcm, cellUsbPspcmBindAsync); - REG_FUNC(cellUsbpspcm, cellUsbPspcmWaitBindAsync); - REG_FUNC(cellUsbpspcm, cellUsbPspcmPollBindAsync); - REG_FUNC(cellUsbpspcm, cellUsbPspcmCancelBind); - REG_FUNC(cellUsbpspcm, cellUsbPspcmClose); - REG_FUNC(cellUsbpspcm, cellUsbPspcmSend); - REG_FUNC(cellUsbpspcm, cellUsbPspcmSendAsync); - REG_FUNC(cellUsbpspcm, cellUsbPspcmWaitSendAsync); - REG_FUNC(cellUsbpspcm, cellUsbPspcmPollSendAsync); - REG_FUNC(cellUsbpspcm, cellUsbPspcmRecv); - REG_FUNC(cellUsbpspcm, cellUsbPspcmRecvAsync); - REG_FUNC(cellUsbpspcm, cellUsbPspcmWaitRecvAsync); - REG_FUNC(cellUsbpspcm, cellUsbPspcmPollRecvAsync); - REG_FUNC(cellUsbpspcm, cellUsbPspcmReset); - REG_FUNC(cellUsbpspcm, cellUsbPspcmResetAsync); - REG_FUNC(cellUsbpspcm, cellUsbPspcmWaitResetAsync); - REG_FUNC(cellUsbpspcm, cellUsbPspcmPollResetAsync); - REG_FUNC(cellUsbpspcm, cellUsbPspcmWaitData); - REG_FUNC(cellUsbpspcm, cellUsbPspcmPollData); - REG_FUNC(cellUsbpspcm, cellUsbPspcmCancelWaitData); -} -#endif + REG_FUNC(cellUsbPspcm, cellUsbPspcmInit); + REG_FUNC(cellUsbPspcm, cellUsbPspcmEnd); + REG_FUNC(cellUsbPspcm, cellUsbPspcmCalcPoolSize); + REG_FUNC(cellUsbPspcm, cellUsbPspcmRegister); + REG_FUNC(cellUsbPspcm, cellUsbPspcmUnregister); + REG_FUNC(cellUsbPspcm, cellUsbPspcmGetAddr); + REG_FUNC(cellUsbPspcm, cellUsbPspcmBind); + REG_FUNC(cellUsbPspcm, cellUsbPspcmBindAsync); + REG_FUNC(cellUsbPspcm, cellUsbPspcmWaitBindAsync); + REG_FUNC(cellUsbPspcm, cellUsbPspcmPollBindAsync); + REG_FUNC(cellUsbPspcm, cellUsbPspcmCancelBind); + REG_FUNC(cellUsbPspcm, cellUsbPspcmClose); + REG_FUNC(cellUsbPspcm, cellUsbPspcmSend); + REG_FUNC(cellUsbPspcm, cellUsbPspcmSendAsync); + REG_FUNC(cellUsbPspcm, cellUsbPspcmWaitSendAsync); + REG_FUNC(cellUsbPspcm, cellUsbPspcmPollSendAsync); + REG_FUNC(cellUsbPspcm, cellUsbPspcmRecv); + REG_FUNC(cellUsbPspcm, cellUsbPspcmRecvAsync); + REG_FUNC(cellUsbPspcm, cellUsbPspcmWaitRecvAsync); + REG_FUNC(cellUsbPspcm, cellUsbPspcmPollRecvAsync); + REG_FUNC(cellUsbPspcm, cellUsbPspcmReset); + REG_FUNC(cellUsbPspcm, cellUsbPspcmResetAsync); + REG_FUNC(cellUsbPspcm, cellUsbPspcmWaitResetAsync); + REG_FUNC(cellUsbPspcm, cellUsbPspcmPollResetAsync); + REG_FUNC(cellUsbPspcm, cellUsbPspcmWaitData); + REG_FUNC(cellUsbPspcm, cellUsbPspcmPollData); + REG_FUNC(cellUsbPspcm, cellUsbPspcmCancelWaitData); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp index 67a2d8f160..dfaf79ff0f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp @@ -950,6 +950,8 @@ s32 cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc) Module cellVdec("cellVdec", []() { + //REG_VARIABLE(cellVdec, _cell_vdec_prx_ver); // 0x085a7ecb + REG_FUNC(cellVdec, cellVdecQueryAttr); REG_FUNC(cellVdec, cellVdecQueryAttrEx); REG_FUNC(cellVdec, cellVdecOpen); diff --git a/rpcs3/Emu/SysCalls/Modules/cellVdec.h b/rpcs3/Emu/SysCalls/Modules/cellVdec.h index 8afb573ffa..b578f8f190 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVdec.h +++ b/rpcs3/Emu/SysCalls/Modules/cellVdec.h @@ -171,7 +171,7 @@ struct CellVdecPicFormat2 be_t unk1; }; -using CellVdecCbMsg = func_def; +using CellVdecCbMsg = u32(u32 handle, CellVdecMsgType msgType, s32 msgData, u32 cbArg); // Callback Function Information struct CellVdecCb @@ -208,7 +208,7 @@ struct CellVdecAvcSpecificInfo be_t thisSize; be_t maxDecodedFrameWidth; be_t maxDecodedFrameHeight; - bool disableDeblockingFilter; + b8 disableDeblockingFilter; u8 numberOfDecodedFrameBuffer; }; @@ -331,26 +331,26 @@ struct CellVdecAvcInfo be_t horizontalSize; be_t verticalSize; AVC_PictureType pictureType[2]; - bool idrPictureFlag; + b8 idrPictureFlag; AVC_aspect_ratio_idc aspect_ratio_idc; be_t sar_height; be_t sar_width; AVC_pic_struct pic_struct; be_t picOrderCount[2]; - bool vui_parameters_present_flag; - bool frame_mbs_only_flag; - bool video_signal_type_present_flag; + b8 vui_parameters_present_flag; + b8 frame_mbs_only_flag; + b8 video_signal_type_present_flag; AVC_video_format video_format; - bool video_full_range_flag; - bool colour_description_present_flag; + b8 video_full_range_flag; + b8 colour_description_present_flag; AVC_colour_primaries colour_primaries; AVC_transfer_characteristics transfer_characteristics; AVC_matrix_coefficients matrix_coefficients; - bool timing_info_present_flag; + b8 timing_info_present_flag; AVC_FrameRateCode frameRateCode; // ??? - bool fixed_frame_rate_flag; - bool low_delay_hrd_flag; - bool entropy_coding_mode_flag; + b8 fixed_frame_rate_flag; + b8 low_delay_hrd_flag; + b8 entropy_coding_mode_flag; be_t nalUnitPresentFlags; u8 ccDataLength[2]; u8 ccData[2][CELL_VDEC_AVC_CCD_MAX]; @@ -462,7 +462,7 @@ struct CellVdecDivxInfo DIVX_pixelAspectRatio pixelAspectRatio; u8 parWidth; u8 parHeight; - bool colourDescription; + b8 colourDescription; DIVX_colourPrimaries colourPrimaries; DIVX_transferCharacteristics transferCharacteristics; DIVX_matrixCoefficients matrixCoefficients; @@ -615,22 +615,22 @@ struct CellVdecMpeg2Info MPEG1_aspectRatio aspect_ratio_information1; }; MPEG2_frameRate frame_rate_code; - bool progressive_sequence; - bool low_delay; + b8 progressive_sequence; + b8 low_delay; MPEG2_videoFormat video_format; - bool colour_description; + b8 colour_description; MPEG2_colourPrimaries colour_primaries; MPEG2_transferCharacteristics transfer_characteristics; MPEG2_matrixCoefficients matrix_coefficients; be_t temporal_reference[2]; MPEG2_pictureCodingType picture_coding_type[2]; MPEG2_pictureStructure picture_structure[2]; - bool top_field_first; - bool repeat_first_field; - bool progressive_frame; + b8 top_field_first; + b8 repeat_first_field; + b8 progressive_frame; be_t time_code; - bool closed_gop; - bool broken_link; + b8 closed_gop; + b8 broken_link; be_t vbv_delay[2]; be_t display_horizontal_size; be_t display_vertical_size; @@ -639,7 +639,7 @@ struct CellVdecMpeg2Info be_t frame_centre_vertical_offset[2][3]; be_t headerPresentFlags; // MPEG2_headerFlags be_t headerRetentionFlags; // MPEG2_headerFlags - bool mpeg1Flag; + b8 mpeg1Flag; u8 ccDataLength[2]; u8 ccData[2][128]; be_t reserved[2]; diff --git a/rpcs3/Emu/SysCalls/Modules/cellVideoExport.cpp b/rpcs3/Emu/SysCalls/Modules/cellVideoExport.cpp new file mode 100644 index 0000000000..b87d560c82 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellVideoExport.cpp @@ -0,0 +1,46 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellVideoExport; + +s32 cellVideoExportProgress() +{ + throw EXCEPTION(""); +} + +s32 cellVideoExportInitialize2() +{ + throw EXCEPTION(""); +} + +s32 cellVideoExportInitialize() +{ + throw EXCEPTION(""); +} + +s32 cellVideoExportFromFileWithCopy() +{ + throw EXCEPTION(""); +} + +s32 cellVideoExportFromFile() +{ + throw EXCEPTION(""); +} + +s32 cellVideoExportFinalize() +{ + throw EXCEPTION(""); +} + + +Module cellVideoExport("cellVideoExport", []() +{ + REG_FUNC(cellVideoExport, cellVideoExportProgress); + REG_FUNC(cellVideoExport, cellVideoExportInitialize2); + REG_FUNC(cellVideoExport, cellVideoExportInitialize); + REG_FUNC(cellVideoExport, cellVideoExportFromFileWithCopy); + REG_FUNC(cellVideoExport, cellVideoExportFromFile); + REG_FUNC(cellVideoExport, cellVideoExportFinalize); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellVideoOut.cpp b/rpcs3/Emu/SysCalls/Modules/cellVideoOut.cpp new file mode 100644 index 0000000000..b5ebae5cf8 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellVideoOut.cpp @@ -0,0 +1,206 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" + +#include "Ini.h" +#include "Emu/RSX/GSManager.h" +#include "cellVideoOut.h" + +extern Module cellSysutil; + +s32 cellVideoOutGetState(u32 videoOut, u32 deviceIndex, vm::ptr state) +{ + cellSysutil.Log("cellVideoOutGetState(videoOut=%d, deviceIndex=%d, state=*0x%x)", videoOut, deviceIndex, state); + + if (deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; + + switch (videoOut) + { + case CELL_VIDEO_OUT_PRIMARY: + state->state = Emu.GetGSManager().GetState(); + state->colorSpace = Emu.GetGSManager().GetColorSpace(); + state->displayMode.resolutionId = Emu.GetGSManager().GetInfo().mode.resolutionId; + state->displayMode.scanMode = Emu.GetGSManager().GetInfo().mode.scanMode; + state->displayMode.conversion = Emu.GetGSManager().GetInfo().mode.conversion; + state->displayMode.aspect = Emu.GetGSManager().GetInfo().mode.aspect; + state->displayMode.refreshRates = Emu.GetGSManager().GetInfo().mode.refreshRates; + return CELL_VIDEO_OUT_SUCCEEDED; + + case CELL_VIDEO_OUT_SECONDARY: + *state = { CELL_VIDEO_OUT_OUTPUT_STATE_DISABLED }; // ??? + return CELL_VIDEO_OUT_SUCCEEDED; + } + + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; +} + +s32 cellVideoOutGetResolution(u32 resolutionId, vm::ptr resolution) +{ + cellSysutil.Log("cellVideoOutGetResolution(resolutionId=%d, resolution=*0x%x)", resolutionId, resolution); + + u32 num = ResolutionIdToNum(resolutionId); + if (!num) + return CELL_EINVAL; + + resolution->width = ResolutionTable[num].width; + resolution->height = ResolutionTable[num].height; + + return CELL_VIDEO_OUT_SUCCEEDED; +} + +s32 cellVideoOutConfigure(u32 videoOut, vm::ptr config, vm::ptr option, u32 waitForEvent) +{ + cellSysutil.Warning("cellVideoOutConfigure(videoOut=%d, config=*0x%x, option=*0x%x, waitForEvent=0x%x)", videoOut, config, option, waitForEvent); + + switch (videoOut) + { + case CELL_VIDEO_OUT_PRIMARY: + if (config->resolutionId) + { + Emu.GetGSManager().GetInfo().mode.resolutionId = config->resolutionId; + } + + Emu.GetGSManager().GetInfo().mode.format = config->format; + + if (config->aspect) + { + Emu.GetGSManager().GetInfo().mode.aspect = config->aspect; + } + + if (config->pitch) + { + Emu.GetGSManager().GetInfo().mode.pitch = config->pitch; + } + + return CELL_VIDEO_OUT_SUCCEEDED; + + case CELL_VIDEO_OUT_SECONDARY: + return CELL_VIDEO_OUT_SUCCEEDED; + } + + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; +} + +s32 cellVideoOutGetConfiguration(u32 videoOut, vm::ptr config, vm::ptr option) +{ + cellSysutil.Warning("cellVideoOutGetConfiguration(videoOut=%d, config=*0x%x, option=*0x%x)", videoOut, config, option); + + if (option) *option = {}; + *config = {}; + + switch (videoOut) + { + case CELL_VIDEO_OUT_PRIMARY: + config->resolutionId = Emu.GetGSManager().GetInfo().mode.resolutionId; + config->format = Emu.GetGSManager().GetInfo().mode.format; + config->aspect = Emu.GetGSManager().GetInfo().mode.aspect; + config->pitch = Emu.GetGSManager().GetInfo().mode.pitch; + + return CELL_VIDEO_OUT_SUCCEEDED; + + case CELL_VIDEO_OUT_SECONDARY: + + return CELL_VIDEO_OUT_SUCCEEDED; + } + + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; +} + +s32 cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, vm::ptr info) +{ + cellSysutil.Warning("cellVideoOutGetDeviceInfo(videoOut=%d, deviceIndex=%d, info=*0x%x)", videoOut, deviceIndex, info); + + if (deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; + + // Use standard dummy values for now. + info->portType = CELL_VIDEO_OUT_PORT_HDMI; + info->colorSpace = Emu.GetGSManager().GetColorSpace(); + info->latency = 1000; + info->availableModeCount = 1; + info->state = CELL_VIDEO_OUT_DEVICE_STATE_AVAILABLE; + info->rgbOutputRange = 1; + info->colorInfo.blueX = 0xFFFF; + info->colorInfo.blueY = 0xFFFF; + info->colorInfo.greenX = 0xFFFF; + info->colorInfo.greenY = 0xFFFF; + info->colorInfo.redX = 0xFFFF; + info->colorInfo.redY = 0xFFFF; + info->colorInfo.whiteX = 0xFFFF; + info->colorInfo.whiteY = 0xFFFF; + info->colorInfo.gamma = 100; + info->availableModes[0].aspect = 0; + info->availableModes[0].conversion = 0; + info->availableModes[0].refreshRates = 0xF; + info->availableModes[0].resolutionId = 1; + info->availableModes[0].scanMode = 0; + + return CELL_OK; +} + +s32 cellVideoOutGetNumberOfDevice(u32 videoOut) +{ + cellSysutil.Warning("cellVideoOutGetNumberOfDevice(videoOut=%d)", videoOut); + + switch (videoOut) + { + case CELL_VIDEO_OUT_PRIMARY: return 1; + case CELL_VIDEO_OUT_SECONDARY: return 0; + } + + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; +} + +s32 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); + + 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_640x720_3D_FRAME_PACKING)) + return 0; + + switch (videoOut) + { + case CELL_VIDEO_OUT_PRIMARY: return 1; + case CELL_VIDEO_OUT_SECONDARY: return 0; + } + + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; +} + +s32 cellVideoOutGetConvertCursorColorInfo() +{ + throw EXCEPTION(""); +} + +s32 cellVideoOutDebugSetMonitorType() +{ + throw EXCEPTION(""); +} + +s32 cellVideoOutRegisterCallback() +{ + throw EXCEPTION(""); +} + +s32 cellVideoOutUnregisterCallback() +{ + throw EXCEPTION(""); +} + + +void cellSysutil_VideoOut_init() +{ + REG_FUNC(cellSysutil, cellVideoOutGetState); + REG_FUNC(cellSysutil, cellVideoOutGetResolution); + REG_FUNC(cellSysutil, cellVideoOutConfigure); + REG_FUNC(cellSysutil, cellVideoOutGetConfiguration); + REG_FUNC(cellSysutil, cellVideoOutGetDeviceInfo); + REG_FUNC(cellSysutil, cellVideoOutGetNumberOfDevice); + REG_FUNC(cellSysutil, cellVideoOutGetResolutionAvailability); + REG_FUNC(cellSysutil, cellVideoOutGetConvertCursorColorInfo); + REG_FUNC(cellSysutil, cellVideoOutDebugSetMonitorType); + REG_FUNC(cellSysutil, cellVideoOutRegisterCallback); + REG_FUNC(cellSysutil, cellVideoOutUnregisterCallback); +} diff --git a/rpcs3/Emu/RSX/sysutil_video.h b/rpcs3/Emu/SysCalls/Modules/cellVideoOut.h similarity index 100% rename from rpcs3/Emu/RSX/sysutil_video.h rename to rpcs3/Emu/SysCalls/Modules/cellVideoOut.h diff --git a/rpcs3/Emu/SysCalls/Modules/cellVideoUpload.cpp b/rpcs3/Emu/SysCalls/Modules/cellVideoUpload.cpp new file mode 100644 index 0000000000..3bf7b3ce30 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellVideoUpload.cpp @@ -0,0 +1,15 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +extern Module cellVideoUpload; + +s32 cellVideoUploadInitialize() +{ + throw EXCEPTION(""); +} + +Module cellVideoUpload("cellVideoUpload", []() +{ + REG_FUNC(cellVideoUpload, cellVideoUploadInitialize); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/cellVoice.cpp b/rpcs3/Emu/SysCalls/Modules/cellVoice.cpp index 3ffa9c52ad..0195052edd 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVoice.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVoice.cpp @@ -3,8 +3,6 @@ #include "Emu/System.h" #include "Emu/SysCalls/Modules.h" -namespace vm { using namespace ps3; } - extern Module cellVoice; // Error Codes @@ -222,6 +220,11 @@ s32 cellVoiceWriteToIPortEx() return CELL_OK; } +s32 cellVoiceWriteToIPortEx2() +{ + throw EXCEPTION(""); +} + s32 cellVoiceReadFromOPort() { UNIMPLEMENTED_FUNC(cellVoice); @@ -268,6 +271,7 @@ Module cellVoice("cellVoice", []() REG_FUNC(cellVoice, cellVoiceUpdatePort); REG_FUNC(cellVoice, cellVoiceWriteToIPort); REG_FUNC(cellVoice, cellVoiceWriteToIPortEx); + REG_FUNC(cellVoice, cellVoiceWriteToIPortEx2); REG_FUNC(cellVoice, cellVoiceReadFromOPort); REG_FUNC(cellVoice, cellVoiceDebugTopology); }); diff --git a/rpcs3/Emu/SysCalls/Modules/cellWebBrowser.cpp b/rpcs3/Emu/SysCalls/Modules/cellWebBrowser.cpp new file mode 100644 index 0000000000..1b429b7419 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellWebBrowser.cpp @@ -0,0 +1,299 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" + +#include "cellWebBrowser.h" + +extern Module cellSysutil; + +s32 cellWebBrowserActivate() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfig() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfig2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigGetHeapSize() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigGetHeapSize2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetCustomExit() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetDisableTabs() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetErrorHook2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetFullScreen2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetFullVersion2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetFunction() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetFunction2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetHeapSize() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetHeapSize2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetMimeSet() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetNotifyHook2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetRequestHook2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetStatusHook2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetTabCount2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetUnknownMIMETypeHook2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetVersion() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetViewCondition2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigSetViewRect2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserConfigWithVer() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserCreate() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserCreate2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserCreateRender2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserCreateRenderWithRect2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserCreateWithConfig() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserCreateWithConfigFull() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserCreateWithRect2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserDeactivate() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserDestroy() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserDestroy2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserEstimate() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserEstimate2(vm::cptr config, vm::ptr memSize) +{ + cellSysutil.Warning("cellWebBrowserEstimate2(config=*0x%x, memSize=*0x%x)", config, memSize); + + // TODO: When cellWebBrowser stuff is implemented, change this to some real + // needed memory buffer size. + *memSize = 1 * 1024 * 1024; // 1 MB + return CELL_OK; +} + +s32 cellWebBrowserGetUsrdataOnGameExit() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserInitialize() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserNavigate2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserSetLocalContentsAdditionalTitleID() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserSetSystemCallbackUsrdata() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserShutdown() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserUpdatePointerDisplayPos2() +{ + throw EXCEPTION(""); +} + +s32 cellWebBrowserWakeupWithGameExit() +{ + throw EXCEPTION(""); +} + +s32 cellWebComponentCreate() +{ + throw EXCEPTION(""); +} + +s32 cellWebComponentCreateAsync() +{ + throw EXCEPTION(""); +} + +s32 cellWebComponentDestroy() +{ + throw EXCEPTION(""); +} + + +void cellSysutil_WebBrowser_init() +{ + REG_FUNC(cellSysutil, cellWebBrowserActivate); + REG_FUNC(cellSysutil, cellWebBrowserConfig); + REG_FUNC(cellSysutil, cellWebBrowserConfig2); + REG_FUNC(cellSysutil, cellWebBrowserConfigGetHeapSize); + REG_FUNC(cellSysutil, cellWebBrowserConfigGetHeapSize2); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetCustomExit); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetDisableTabs); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetErrorHook2); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetFullScreen2); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetFullVersion2); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetFunction); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetFunction2); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetHeapSize); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetHeapSize2); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetMimeSet); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetNotifyHook2); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetRequestHook2); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetStatusHook2); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetTabCount2); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetUnknownMIMETypeHook2); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetVersion); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetViewCondition2); + REG_FUNC(cellSysutil, cellWebBrowserConfigSetViewRect2); + REG_FUNC(cellSysutil, cellWebBrowserConfigWithVer); + REG_FUNC(cellSysutil, cellWebBrowserCreate); + REG_FUNC(cellSysutil, cellWebBrowserCreate2); + REG_FUNC(cellSysutil, cellWebBrowserCreateRender2); + REG_FUNC(cellSysutil, cellWebBrowserCreateRenderWithRect2); + REG_FUNC(cellSysutil, cellWebBrowserCreateWithConfig); + REG_FUNC(cellSysutil, cellWebBrowserCreateWithConfigFull); + REG_FUNC(cellSysutil, cellWebBrowserCreateWithRect2); + REG_FUNC(cellSysutil, cellWebBrowserDeactivate); + REG_FUNC(cellSysutil, cellWebBrowserDestroy); + REG_FUNC(cellSysutil, cellWebBrowserDestroy2); + REG_FUNC(cellSysutil, cellWebBrowserEstimate); + REG_FUNC(cellSysutil, cellWebBrowserEstimate2); + REG_FUNC(cellSysutil, cellWebBrowserGetUsrdataOnGameExit); + REG_FUNC(cellSysutil, cellWebBrowserInitialize); + REG_FUNC(cellSysutil, cellWebBrowserNavigate2); + REG_FUNC(cellSysutil, cellWebBrowserSetLocalContentsAdditionalTitleID); + REG_FUNC(cellSysutil, cellWebBrowserSetSystemCallbackUsrdata); + REG_FUNC(cellSysutil, cellWebBrowserShutdown); + REG_FUNC(cellSysutil, cellWebBrowserUpdatePointerDisplayPos2); + REG_FUNC(cellSysutil, cellWebBrowserWakeupWithGameExit); + REG_FUNC(cellSysutil, cellWebComponentCreate); + REG_FUNC(cellSysutil, cellWebComponentCreateAsync); + REG_FUNC(cellSysutil, cellWebComponentDestroy); +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellWebBrowser.h b/rpcs3/Emu/SysCalls/Modules/cellWebBrowser.h new file mode 100644 index 0000000000..0b6254b05c --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellWebBrowser.h @@ -0,0 +1,68 @@ +#pragma once + +#include "cellSysutil.h" + +using CellWebBrowserCallback = void(s32 cb_type, vm::ptr client_session, vm::ptr usrdata); +using CellWebComponentCallback = void(s32 web_browser_id, s32 cb_type, vm::ptr client_session, vm::ptr usrdata); +using CellWebBrowserSystemCallback = void(s32 cb_type, vm::ptr usrdata); + +using CellWebBrowserMIMETypeCallback = void(vm::cptr mimetype, vm::cptr url, vm::ptr usrdata); +using CellWebBrowserErrorCallback = void(s32 err_type, vm::ptr usrdata); +using CellWebBrowserStatusCallback = void(s32 err_type, vm::ptr usrdata); +using CellWebBrowserNotify = void(vm::cptr message, vm::ptr usrdata); +using CellWebBrowserUsrdata = void(vm::ptr usrdata); + +struct CellWebBrowserMimeSet +{ + vm::bcptr type; + vm::bcptr directory; +}; + +struct CellWebBrowserPos +{ + be_t x; + be_t y; +}; + +struct CellWebBrowserSize +{ + be_t width; + be_t height; +}; + +struct CellWebBrowserRect +{ + CellWebBrowserPos pos; + CellWebBrowserSize size; +}; + +struct CellWebBrowserConfig +{ + be_t version; + be_t heap_size; + vm::bcptr mimesets; + be_t mimeset_num; + be_t functions; + be_t tab_count; + vm::bptr exit_cb; + vm::bptr download_cb; + vm::bptr navigated_cb; +}; + +struct CellWebBrowserConfig2 +{ + be_t version; + be_t heap_size; + be_t functions; + be_t tab_count; + be_t size_mode; + be_t view_restriction; + vm::bptr unknown_mimetype_cb; + vm::bptr error_cb; + vm::bptr status_error_cb; + vm::bptr notify_cb; + vm::bptr request_cb; + CellWebBrowserRect rect; + be_t resolution_factor; + be_t magic_number_; +}; diff --git a/rpcs3/Emu/SysCalls/Modules/libmixer.cpp b/rpcs3/Emu/SysCalls/Modules/libmixer.cpp index 0ba81e9289..fbdec71c22 100644 --- a/rpcs3/Emu/SysCalls/Modules/libmixer.cpp +++ b/rpcs3/Emu/SysCalls/Modules/libmixer.cpp @@ -12,13 +12,8 @@ extern Module libmixer; SurMixerConfig g_surmx; -vm::ptr surMixerCb; -vm::ptr surMixerCbArg; -std::mutex mixer_mutex; -float mixdata[8*256]; -u64 mixcount; -std::vector ssp; +std::vector g_ssp; s32 cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, vm::ptr addr, u32 samples) { @@ -47,7 +42,7 @@ s32 cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, vm::ptr addr return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; } - std::lock_guard lock(mixer_mutex); + std::lock_guard lock(g_surmx.mutex); if (type == CELL_SURMIXER_CHSTRIP_TYPE1A) { @@ -55,8 +50,8 @@ s32 cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, vm::ptr addr for (u32 i = 0; i < samples; i++) { const float center = addr[i]; - mixdata[i * 8 + 0] += center; - mixdata[i * 8 + 1] += center; + g_surmx.mixdata[i * 8 + 0] += center; + g_surmx.mixdata[i * 8 + 1] += center; } } else if (type == CELL_SURMIXER_CHSTRIP_TYPE2A) @@ -66,8 +61,8 @@ s32 cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, vm::ptr addr { const float left = addr[i * 2 + 0]; const float right = addr[i * 2 + 1]; - mixdata[i * 8 + 0] += left; - mixdata[i * 8 + 1] += right; + g_surmx.mixdata[i * 8 + 0] += left; + g_surmx.mixdata[i * 8 + 1] += right; } } else if (type == CELL_SURMIXER_CHSTRIP_TYPE6A) @@ -81,12 +76,12 @@ s32 cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, vm::ptr addr const float low_freq = addr[i * 6 + 3]; const float rear_left = addr[i * 6 + 4]; const float rear_right = addr[i * 6 + 5]; - mixdata[i * 8 + 0] += left; - mixdata[i * 8 + 1] += right; - mixdata[i * 8 + 2] += center; - mixdata[i * 8 + 3] += low_freq; - mixdata[i * 8 + 4] += rear_left; - mixdata[i * 8 + 5] += rear_right; + g_surmx.mixdata[i * 8 + 0] += left; + g_surmx.mixdata[i * 8 + 1] += right; + g_surmx.mixdata[i * 8 + 2] += center; + g_surmx.mixdata[i * 8 + 3] += low_freq; + g_surmx.mixdata[i * 8 + 4] += rear_left; + g_surmx.mixdata[i * 8 + 5] += rear_right; } } else if (type == CELL_SURMIXER_CHSTRIP_TYPE8A) @@ -94,7 +89,7 @@ s32 cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, vm::ptr addr // 7.1 for (u32 i = 0; i < samples * 8; i++) { - mixdata[i] += addr[i]; + g_surmx.mixdata[i] += addr[i]; } } @@ -106,15 +101,15 @@ s32 cellAANConnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePortNo) libmixer.Warning("cellAANConnect(receive=0x%x, receivePortNo=0x%x, source=0x%x, sourcePortNo=0x%x)", receive, receivePortNo, source, sourcePortNo); - std::lock_guard lock(mixer_mutex); + std::lock_guard lock(g_surmx.mutex); - if (source >= ssp.size() || !ssp[source].m_created) + if (source >= g_ssp.size() || !g_ssp[source].m_created) { libmixer.Error("cellAANConnect(): invalid source (%d)", source); return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; } - ssp[source].m_connected = true; + g_ssp[source].m_connected = true; return CELL_OK; } @@ -124,15 +119,15 @@ s32 cellAANDisconnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePort libmixer.Warning("cellAANDisconnect(receive=0x%x, receivePortNo=0x%x, source=0x%x, sourcePortNo=0x%x)", receive, receivePortNo, source, sourcePortNo); - std::lock_guard lock(mixer_mutex); + std::lock_guard lock(g_surmx.mutex); - if (source >= ssp.size() || !ssp[source].m_created) + if (source >= g_ssp.size() || !g_ssp[source].m_created) { libmixer.Error("cellAANDisconnect(): invalid source (%d)", source); return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; } - ssp[source].m_connected = false; + g_ssp[source].m_connected = false; return CELL_OK; } @@ -147,7 +142,7 @@ s32 cellSSPlayerCreate(vm::ptr handle, vm::ptr config) return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; } - std::lock_guard lock(mixer_mutex); + std::lock_guard lock(g_surmx.mutex); SSPlayer p; p.m_created = true; @@ -155,8 +150,8 @@ s32 cellSSPlayerCreate(vm::ptr handle, vm::ptr config) p.m_active = false; p.m_channels = config->channels; - ssp.push_back(p); - *handle = (u32)ssp.size() - 1; + g_ssp.push_back(p); + *handle = (u32)g_ssp.size() - 1; return CELL_OK; } @@ -164,17 +159,17 @@ s32 cellSSPlayerRemove(u32 handle) { libmixer.Warning("cellSSPlayerRemove(handle=0x%x)", handle); - std::lock_guard lock(mixer_mutex); + std::lock_guard lock(g_surmx.mutex); - if (handle >= ssp.size() || !ssp[handle].m_created) + if (handle >= g_ssp.size() || !g_ssp[handle].m_created) { libmixer.Error("cellSSPlayerRemove(): SSPlayer not found (%d)", handle); return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; } - ssp[handle].m_active = false; - ssp[handle].m_created = false; - ssp[handle].m_connected = false; + g_ssp[handle].m_active = false; + g_ssp[handle].m_created = false; + g_ssp[handle].m_connected = false; return CELL_OK; } @@ -183,9 +178,9 @@ s32 cellSSPlayerSetWave(u32 handle, vm::ptr waveInfo, vm: { libmixer.Warning("cellSSPlayerSetWave(handle=0x%x, waveInfo=*0x%x, commonInfo=*0x%x)", handle, waveInfo, commonInfo); - std::lock_guard lock(mixer_mutex); + std::lock_guard lock(g_surmx.mutex); - if (handle >= ssp.size() || !ssp[handle].m_created) + if (handle >= g_ssp.size() || !g_ssp[handle].m_created) { libmixer.Error("cellSSPlayerSetWave(): SSPlayer not found (%d)", handle); return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; @@ -193,11 +188,11 @@ s32 cellSSPlayerSetWave(u32 handle, vm::ptr waveInfo, vm: // TODO: check parameters - ssp[handle].m_addr = waveInfo->addr; - ssp[handle].m_samples = waveInfo->samples; - ssp[handle].m_loop_start = waveInfo->loopStartOffset - 1; - ssp[handle].m_loop_mode = commonInfo ? (u32)commonInfo->loopMode : CELL_SSPLAYER_ONESHOT; - ssp[handle].m_position = waveInfo->startOffset - 1; + g_ssp[handle].m_addr = waveInfo->addr; + g_ssp[handle].m_samples = waveInfo->samples; + g_ssp[handle].m_loop_start = waveInfo->loopStartOffset - 1; + g_ssp[handle].m_loop_mode = commonInfo ? (u32)commonInfo->loopMode : CELL_SSPLAYER_ONESHOT; + g_ssp[handle].m_position = waveInfo->startOffset - 1; return CELL_OK; } @@ -206,9 +201,9 @@ s32 cellSSPlayerPlay(u32 handle, vm::ptr info) { libmixer.Warning("cellSSPlayerPlay(handle=0x%x, info=*0x%x)", handle, info); - std::lock_guard lock(mixer_mutex); + std::lock_guard lock(g_surmx.mutex); - if (handle >= ssp.size() || !ssp[handle].m_created) + if (handle >= g_ssp.size() || !g_ssp[handle].m_created) { libmixer.Error("cellSSPlayerPlay(): SSPlayer not found (%d)", handle); return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; @@ -216,12 +211,12 @@ s32 cellSSPlayerPlay(u32 handle, vm::ptr info) // TODO: check parameters - ssp[handle].m_active = true; - ssp[handle].m_level = info->level; - ssp[handle].m_speed = info->speed; - ssp[handle].m_x = info->position.x; - ssp[handle].m_y = info->position.y; - ssp[handle].m_z = info->position.z; + g_ssp[handle].m_active = true; + g_ssp[handle].m_level = info->level; + g_ssp[handle].m_speed = info->speed; + g_ssp[handle].m_x = info->position.x; + g_ssp[handle].m_y = info->position.y; + g_ssp[handle].m_z = info->position.z; return CELL_OK; } @@ -230,9 +225,9 @@ s32 cellSSPlayerStop(u32 handle, u32 mode) { libmixer.Warning("cellSSPlayerStop(handle=0x%x, mode=0x%x)", handle, mode); - std::lock_guard lock(mixer_mutex); + std::lock_guard lock(g_surmx.mutex); - if (handle >= ssp.size() || !ssp[handle].m_created) + if (handle >= g_ssp.size() || !g_ssp[handle].m_created) { libmixer.Error("cellSSPlayerStop(): SSPlayer not found (%d)", handle); return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; @@ -240,7 +235,7 @@ s32 cellSSPlayerStop(u32 handle, u32 mode) // TODO: transition to stop state - ssp[handle].m_active = false; + g_ssp[handle].m_active = false; return CELL_OK; } @@ -249,9 +244,9 @@ s32 cellSSPlayerSetParam(u32 handle, vm::ptr info) { libmixer.Warning("cellSSPlayerSetParam(handle=0x%x, info=*0x%x)", handle, info); - std::lock_guard lock(mixer_mutex); + std::lock_guard lock(g_surmx.mutex); - if (handle >= ssp.size() || !ssp[handle].m_created) + if (handle >= g_ssp.size() || !g_ssp[handle].m_created) { libmixer.Error("cellSSPlayerSetParam(): SSPlayer not found (%d)", handle); return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; @@ -259,11 +254,11 @@ s32 cellSSPlayerSetParam(u32 handle, vm::ptr info) // TODO: check parameters - ssp[handle].m_level = info->level; - ssp[handle].m_speed = info->speed; - ssp[handle].m_x = info->position.x; - ssp[handle].m_y = info->position.y; - ssp[handle].m_z = info->position.z; + g_ssp[handle].m_level = info->level; + g_ssp[handle].m_speed = info->speed; + g_ssp[handle].m_x = info->position.x; + g_ssp[handle].m_y = info->position.y; + g_ssp[handle].m_z = info->position.z; return CELL_OK; } @@ -272,15 +267,15 @@ s32 cellSSPlayerGetState(u32 handle) { libmixer.Warning("cellSSPlayerGetState(handle=0x%x)", handle); - std::lock_guard lock(mixer_mutex); + std::lock_guard lock(g_surmx.mutex); - if (handle >= ssp.size() || !ssp[handle].m_created) + if (handle >= g_ssp.size() || !g_ssp[handle].m_created) { libmixer.Warning("cellSSPlayerGetState(): SSPlayer not found (%d)", handle); return CELL_SSPLAYER_STATE_ERROR; } - if (ssp[handle].m_active) + if (g_ssp[handle].m_active) { return CELL_SSPLAYER_STATE_ON; } @@ -319,8 +314,10 @@ s32 cellSurMixerCreate(vm::cptr config) libmixer.Warning("*** audio port opened (port=%d)", g_surmx.audio_port); - mixcount = 0; - surMixerCb.set(0); + g_surmx.mixcount = 0; + g_surmx.cb = vm::null; + + g_ssp.clear(); libmixer.Warning("*** surMixer created (ch1=%d, ch2=%d, ch6=%d, ch8=%d)", config->chStrips1, config->chStrips2, config->chStrips6, config->chStrips8); @@ -335,7 +332,7 @@ s32 cellSurMixerCreate(vm::cptr config) { CHECK_EMU_STATUS; - if (mixcount > (port.tag + 0)) // adding positive value (1-15): preemptive buffer filling (hack) + if (g_surmx.mixcount > (port.tag + 0)) // adding positive value (1-15): preemptive buffer filling (hack) { std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack continue; @@ -345,18 +342,18 @@ s32 cellSurMixerCreate(vm::cptr config) { //u64 stamp0 = get_system_time(); - memset(mixdata, 0, sizeof(mixdata)); - if (surMixerCb) + memset(g_surmx.mixdata, 0, sizeof(g_surmx.mixdata)); + if (g_surmx.cb) { - surMixerCb(ppu, surMixerCbArg, (u32)mixcount, 256); + g_surmx.cb(ppu, g_surmx.cb_arg, (u32)g_surmx.mixcount, 256); } //u64 stamp1 = get_system_time(); { - std::lock_guard lock(mixer_mutex); + std::lock_guard lock(g_surmx.mutex); - for (auto& p : ssp) if (p.m_active && p.m_created) + for (auto& p : g_ssp) if (p.m_active && p.m_created) { auto v = vm::ptrl::make(p.m_addr); // 16-bit LE audio data float left = 0.0f; @@ -406,8 +403,8 @@ s32 cellSurMixerCreate(vm::cptr config) if (p.m_connected) // mix { // TODO: m_x, m_y, m_z ignored - mixdata[i * 8 + 0] += left; - mixdata[i * 8 + 1] += right; + g_surmx.mixdata[i * 8 + 0] += left; + g_surmx.mixdata[i * 8 + 1] += right; } if ((p.m_position == p.m_samples && p.m_speed > 0.0f) || (p.m_position == ~0 && p.m_speed < 0.0f)) // loop or stop @@ -432,12 +429,12 @@ s32 cellSurMixerCreate(vm::cptr config) //u64 stamp2 = get_system_time(); - auto buf = vm::get_ptr>(port.addr + (mixcount % port.block) * port.channel * AUDIO_SAMPLES * sizeof(float)); + auto buf = vm::get_ptr>(port.addr + (g_surmx.mixcount % port.block) * port.channel * AUDIO_SAMPLES * sizeof(float)); - for (u32 i = 0; i < (sizeof(mixdata) / sizeof(float)); i++) + for (auto& mixdata : g_surmx.mixdata) { // reverse byte order - buf[i] = mixdata[i]; + *buf++ = mixdata; } //u64 stamp3 = get_system_time(); @@ -445,16 +442,9 @@ s32 cellSurMixerCreate(vm::cptr config) //ConLog.Write("Libmixer perf: start=%lld (cb=%lld, ssp=%lld, finalize=%lld)", stamp0 - m_config.start_time, stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2); } - mixcount++; + g_surmx.mixcount++; } - { - std::lock_guard lock(mixer_mutex); - ssp.clear(); - } - - surMixerCb.set(0); - Emu.GetIdManager().remove(ppu.get_id()); }; @@ -482,13 +472,13 @@ s32 cellSurMixerSetNotifyCallback(vm::ptr fu { libmixer.Warning("cellSurMixerSetNotifyCallback(func=*0x%x, arg=*0x%x)", func, arg); - if (surMixerCb) + if (g_surmx.cb) { - libmixer.Error("cellSurMixerSetNotifyCallback: surMixerCb already set (*0x%x)", surMixerCb); + throw EXCEPTION("Callback already set"); } - surMixerCb = func; - surMixerCbArg = arg; + g_surmx.cb = func; + g_surmx.cb_arg = arg; return CELL_OK; } @@ -497,15 +487,13 @@ s32 cellSurMixerRemoveNotifyCallback(vm::ptr { libmixer.Warning("cellSurMixerRemoveNotifyCallback(func=*0x%x)", func); - if (surMixerCb != func) + if (g_surmx.cb != func) { - libmixer.Error("cellSurMixerRemoveNotifyCallback: surMixerCb had different value (*0x%x)", surMixerCb); - } - else - { - surMixerCb = vm::null; + throw EXCEPTION("Callback not set"); } + g_surmx.cb = vm::null; + return CELL_OK; } @@ -555,12 +543,12 @@ s32 cellSurMixerSurBusAddData(u32 busNo, u32 offset, vm::ptr addr, u32 sa return CELL_OK; } - std::lock_guard lock(mixer_mutex); + std::lock_guard lock(g_surmx.mutex); for (u32 i = 0; i < samples; i++) { // reverse byte order and mix - mixdata[i * 8 + busNo] += addr[i]; + g_surmx.mixdata[i * 8 + busNo] += addr[i]; } return CELL_OK; @@ -590,7 +578,7 @@ s32 cellSurMixerGetCurrentBlockTag(vm::ptr tag) { libmixer.Log("cellSurMixerGetCurrentBlockTag(tag=*0x%x)", tag); - *tag = mixcount; + *tag = g_surmx.mixcount; return CELL_OK; } @@ -610,23 +598,20 @@ void cellSurMixerBeep(u32 arg) float cellSurMixerUtilGetLevelFromDB(float dB) { - // not hooked, probably unnecessary libmixer.Todo("cellSurMixerUtilGetLevelFromDB(dB=%f)", dB); - return 0.0f; + throw EXCEPTION(""); } float cellSurMixerUtilGetLevelFromDBIndex(s32 index) { - // not hooked, probably unnecessary libmixer.Todo("cellSurMixerUtilGetLevelFromDBIndex(index=%d)", index); - return 0.0f; + throw EXCEPTION(""); } float cellSurMixerUtilNoteToRatio(u8 refNote, u8 note) { - // not hooked, probably unnecessary libmixer.Todo("cellSurMixerUtilNoteToRatio(refNote=%d, note=%d)", refNote, note); - return 0.0f; + throw EXCEPTION(""); } Module libmixer("libmixer", []() @@ -635,12 +620,12 @@ Module libmixer("libmixer", []() libmixer.on_stop = []() { - ssp.clear(); + g_ssp.clear(); }; using namespace PPU_instr; - REG_SUB(libmixer, "surmxAAN", , cellAANAddData, + REG_SUB(libmixer,, cellAANAddData, { SPET_MASKED_OPCODE, 0x7c691b78, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf821ff91, 0xffffffff }, @@ -666,7 +651,7 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff }, ); - REG_SUB(libmixer, "surmxAAN", , cellAANConnect, + REG_SUB(libmixer,, cellAANConnect, { SPET_MASKED_OPCODE, 0xf821ff71, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0x2f830000, 0xffffffff }, @@ -675,18 +660,18 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x7c691b78, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c8a2378, 0xffffffff }, { SPET_MASKED_OPCODE, 0x60000003, 0xffffffff }, - se_br_label(BNE(cr7, XXX), 0x24), - se_label(0x24), + SP_LABEL_BR(BNE(cr7, XXX), 0x24), + SET_LABEL(0x24), { SPET_MASKED_OPCODE, 0x7c0307b4, 0xffffffff }, { SPET_MASKED_OPCODE, 0xe80100a0, 0xffffffff }, { SPET_MASKED_OPCODE, 0x38210090, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c0803a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff }, - se_label(0x38), + SET_LABEL(0x38), { SPET_MASKED_OPCODE, 0x2f850000, 0xffffffff }, { SPET_MASKED_OPCODE, 0x78630020, 0xffffffff }, { SPET_MASKED_OPCODE, 0x38810070, 0xffffffff }, - se_br_label(BEQ(cr7, XXX), 0x38), + SP_LABEL_BR(BEQ(cr7, XXX), 0x38), { SPET_MASKED_OPCODE, 0x81690000, 0xffffffff }, { SPET_MASKED_OPCODE, 0x38000001, 0xffffffff }, { SPET_MASKED_OPCODE, 0x91210074, 0xffffffff }, @@ -709,7 +694,7 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff }, ); - REG_SUB(libmixer, "surmxAAN", , cellAANDisconnect, + REG_SUB(libmixer,, cellAANDisconnect, { SPET_MASKED_OPCODE, 0xf821ff71, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0x2f830000, 0xffffffff }, @@ -718,18 +703,18 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x7c691b78, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c8a2378, 0xffffffff }, { SPET_MASKED_OPCODE, 0x60000003, 0xffffffff }, - se_br_label(BNE(cr7, XXX), 0x24), - se_label(0x24), + SP_LABEL_BR(BNE(cr7, XXX), 0x24), + SET_LABEL(0x24), { SPET_MASKED_OPCODE, 0x7c0307b4, 0xffffffff }, { SPET_MASKED_OPCODE, 0xe80100a0, 0xffffffff }, { SPET_MASKED_OPCODE, 0x38210090, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c0803a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff }, - se_label(0x38), + SET_LABEL(0x38), { SPET_MASKED_OPCODE, 0x2f850000, 0xffffffff }, { SPET_MASKED_OPCODE, 0x78630020, 0xffffffff }, { SPET_MASKED_OPCODE, 0x38810070, 0xffffffff }, - se_br_label(BEQ(cr7, XXX), 0x38), + SP_LABEL_BR(BEQ(cr7, XXX), 0x38), { SPET_MASKED_OPCODE, 0x81690000, 0xffffffff }, { SPET_MASKED_OPCODE, 0x38000001, 0xffffffff }, { SPET_MASKED_OPCODE, 0x91210074, 0xffffffff }, @@ -752,7 +737,7 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff }, ); - REG_SUB(libmixer, "surmixer", , cellSurMixerCreate, + REG_SUB(libmixer,, cellSurMixerCreate, { SPET_MASKED_OPCODE, 0x2f830000, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf821ff51, 0xffffffff }, @@ -765,7 +750,7 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0xfbe100a8, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf80100c0, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c7e1b78, 0xffffffff }, - se_br_label(BNE(cr7, XXX), 0x6c), + SP_LABEL_BR(BNE(cr7, XXX), 0x6c), { SPET_MASKED_OPCODE, 0x3fe08031, 0xffffffff }, { SPET_MASKED_OPCODE, 0x63ff0003, 0xffffffff }, { SPET_MASKED_OPCODE, 0xe80100c0, 0xffffffff }, @@ -780,11 +765,11 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0xebe100a8, 0xffffffff }, { SPET_MASKED_OPCODE, 0x382100b0, 0xffffffff }, { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff }, - se_label(0x6c), + SET_LABEL(0x6c), ); - REG_SUB(libmixer, "surmixer", , cellSurMixerGetAANHandle, - se_op(LWZ(r10, r2, XXX)), + REG_SUB(libmixer,, cellSurMixerGetAANHandle, + SP_I(LWZ(r10, r2, XXX)), { SPET_MASKED_OPCODE, 0x3d607fce, 0xffffffff }, { SPET_MASKED_OPCODE, 0x616bfffe, 0xffffffff }, { SPET_MASKED_OPCODE, 0x812a0018, 0xffffffff }, @@ -800,8 +785,8 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff }, ); - REG_SUB(libmixer, "surmixer", , cellSurMixerChStripGetAANPortNo, - se_op(LWZ(r9, r2, XXX)), + REG_SUB(libmixer,, cellSurMixerChStripGetAANPortNo, + SP_I(LWZ(r9, r2, XXX)), { SPET_MASKED_OPCODE, 0x7c661b78, 0xffffffff }, { SPET_MASKED_OPCODE, 0x3c608031, 0xffffffff }, { SPET_MASKED_OPCODE, 0x78c60020, 0xffffffff }, @@ -812,11 +797,11 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x2f800000, 0xffffffff }, { SPET_MASKED_OPCODE, 0x4d9e0020, 0xffffffff }, { SPET_MASKED_OPCODE, 0x78030020, 0xffffffff }, - se_op(B(XXX, 0, 0)), + SP_I(B(XXX, 0, 0)), ); - REG_SUB(libmixer, "surmixer", , cellSurMixerSetNotifyCallback, - se_op(LWZ(r10, r2, XXX)), + REG_SUB(libmixer,, cellSurMixerSetNotifyCallback, + SP_I(LWZ(r10, r2, XXX)), { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf821ff81, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf8010090, 0xffffffff }, @@ -836,15 +821,15 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x7c0803a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff }, { SPET_MASKED_OPCODE, 0x419aff00, 0xffffff00 }, // beq - se_op(LWZ(r0, r10, XXX)), + SP_I(LWZ(r0, r10, XXX)), { SPET_MASKED_OPCODE, 0x79290020, 0xffffffff }, { SPET_MASKED_OPCODE, 0x38810070, 0xffffffff }, { SPET_MASKED_OPCODE, 0x2f800000, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7d234b78, 0xffffffff } ); - REG_SUB(libmixer, "surmixer", , cellSurMixerRemoveNotifyCallback, - se_op(LWZ(r11, r2, XXX)), + REG_SUB(libmixer,, cellSurMixerRemoveNotifyCallback, + SP_I(LWZ(r11, r2, XXX)), { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf821ff81, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf8010090, 0xffffffff }, @@ -861,11 +846,11 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff } ); - REG_SUB(libmixer, "surmixer", , cellSurMixerStart, + REG_SUB(libmixer,, cellSurMixerStart, { SPET_MASKED_OPCODE, 0xf821ff71, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0xfbc10080, 0xffffffff }, - se_op(LWZ(r30, r2, XXX)), + SP_I(LWZ(r30, r2, XXX)), { SPET_MASKED_OPCODE, 0xf80100a0, 0xffffffff }, { SPET_MASKED_OPCODE, 0xfba10078, 0xffffffff }, { SPET_MASKED_OPCODE, 0xfbe10088, 0xffffffff }, @@ -884,12 +869,12 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff } ); - REG_SUB(libmixer, "surmixer", , cellSurMixerSetParameter, + REG_SUB(libmixer,, cellSurMixerSetParameter, { SPET_MASKED_OPCODE, 0xf821ff81, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0xfbc10070, 0xffffffff }, { SPET_MASKED_OPCODE, 0xfc000890, 0xffffffff }, - se_op(LWZ(r30, r2, XXX)), + SP_I(LWZ(r30, r2, XXX)), { SPET_MASKED_OPCODE, 0x3d208031, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf8010090, 0xffffffff }, { SPET_MASKED_OPCODE, 0xfbe10078, 0xffffffff }, @@ -914,7 +899,7 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x409d0000, 0xffff0000 }, // ble ); - REG_SUB(libmixer, "surmixer", , cellSurMixerFinalize, + REG_SUB(libmixer,, cellSurMixerFinalize, { SPET_MASKED_OPCODE, 0xf821ff91, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf8010080, 0xffffffff }, @@ -940,8 +925,8 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x4e800421, 0xffffffff } ); - REG_SUB(libmixer, "surmixer", , cellSurMixerSurBusAddData, - se_op(LWZ(r10, r2, XXX)), + REG_SUB(libmixer,, cellSurMixerSurBusAddData, + SP_I(LWZ(r10, r2, XXX)), { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf821ff91, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf8010080, 0xffffffff }, @@ -969,8 +954,8 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x419c0000, 0xffff0000 } // blt ); - REG_SUB(libmixer, "surmixer", , cellSurMixerChStripSetParameter, - se_op(LWZ(r8, r2, XXX)), + REG_SUB(libmixer,, cellSurMixerChStripSetParameter, + SP_I(LWZ(r8, r2, XXX)), { SPET_MASKED_OPCODE, 0x7c6b1b78, 0xffffffff }, { SPET_MASKED_OPCODE, 0x3c608031, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c8a2378, 0xffffffff }, @@ -989,8 +974,8 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x40000000, 0xf0000000 } // b ); - REG_SUB(libmixer, "surmixer", , cellSurMixerPause, - se_op(LWZ(r10, r2, XXX)), + REG_SUB(libmixer,, cellSurMixerPause, + SP_I(LWZ(r10, r2, XXX)), { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf821ff81, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf8010090, 0xffffffff }, @@ -1014,8 +999,8 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x2f800000, 0xffffffff } ); - REG_SUB(libmixer, "surmixer", , cellSurMixerGetCurrentBlockTag, - se_op(LWZ(r11, r2, XXX)), + REG_SUB(libmixer,, cellSurMixerGetCurrentBlockTag, + SP_I(LWZ(r11, r2, XXX)), { SPET_MASKED_OPCODE, 0x3d208031, 0xffffffff }, { SPET_MASKED_OPCODE, 0x61290002, 0xffffffff }, { SPET_MASKED_OPCODE, 0x880b0020, 0xffffffff }, @@ -1028,8 +1013,8 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff } ); - REG_SUB(libmixer, "surmixer", , cellSurMixerGetTimestamp, - se_op(LWZ(r11, r2, XXX)), + REG_SUB(libmixer,, cellSurMixerGetTimestamp, + SP_I(LWZ(r11, r2, XXX)), { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf821ff91, 0xffffffff }, { SPET_MASKED_OPCODE, 0xf8010080, 0xffffffff }, @@ -1050,8 +1035,8 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x40000000, 0xf0000000 } // bl ); - REG_SUB(libmixer, "surmixer", , cellSurMixerBeep, - se_op(LWZ(r9, r2, XXX)), + REG_SUB(libmixer,, cellSurMixerBeep, + SP_I(LWZ(r9, r2, XXX)), { SPET_MASKED_OPCODE, 0x7c641b78, 0xffffffff }, { SPET_MASKED_OPCODE, 0x80690018, 0xffffffff }, { SPET_MASKED_OPCODE, 0x2f830000, 0xffffffff }, @@ -1064,7 +1049,7 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x40000000, 0xf0000000 } // b ); - REG_SUB(libmixer, "surmxSSP", , cellSSPlayerCreate, + REG_SUB(libmixer,, cellSSPlayerCreate, { SPET_MASKED_OPCODE, 0xf821ff51, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0x2f840000, 0xffffffff }, @@ -1098,7 +1083,7 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x40000000, 0xf0000000 } // bl ); - REG_SUB(libmixer, "surmxSSP", , cellSSPlayerRemove, + REG_SUB(libmixer,, cellSSPlayerRemove, { SPET_MASKED_OPCODE, 0x7c641b78, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0x3c608031, 0xffffffff }, @@ -1128,7 +1113,7 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x4e800421, 0xffffffff } ); - REG_SUB(libmixer, "surmxSSP", , cellSSPlayerSetWave, + REG_SUB(libmixer,, cellSSPlayerSetWave, { SPET_MASKED_OPCODE, 0x7c601b78, 0xffffffff }, { SPET_MASKED_OPCODE, 0x78840020, 0xffffffff }, { SPET_MASKED_OPCODE, 0x2f800000, 0xffffffff }, @@ -1141,7 +1126,7 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff } ); - REG_SUB(libmixer, "surmxSSP", , cellSSPlayerPlay, + REG_SUB(libmixer,, cellSSPlayerPlay, { SPET_MASKED_OPCODE, 0x7c601b78, 0xffffffff }, { SPET_MASKED_OPCODE, 0x3c608031, 0xffffffff }, { SPET_MASKED_OPCODE, 0x2f800000, 0xffffffff }, @@ -1160,7 +1145,7 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x38630010, 0xffffffff } ); - REG_SUB(libmixer, "surmxSSP", , cellSSPlayerStop, + REG_SUB(libmixer,, cellSSPlayerStop, { SPET_MASKED_OPCODE, 0xf821ff91, 0xffffffff }, { SPET_MASKED_OPCODE, 0x7c0802a6, 0xffffffff }, { SPET_MASKED_OPCODE, 0x2f830000, 0xffffffff }, @@ -1179,7 +1164,7 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x4e800020, 0xffffffff } ); - REG_SUB(libmixer, "surmxSSP", , cellSSPlayerSetParam, + REG_SUB(libmixer,, cellSSPlayerSetParam, { SPET_MASKED_OPCODE, 0x7c601b78, 0xffffffff }, { SPET_MASKED_OPCODE, 0x3c608031, 0xffffffff }, { SPET_MASKED_OPCODE, 0x2f800000, 0xffffffff }, @@ -1198,17 +1183,17 @@ Module libmixer("libmixer", []() { SPET_MASKED_OPCODE, 0x2f800000, 0xffffffff } ); - REG_SUB(libmixer, "surmxSSP", , cellSSPlayerGetState, + REG_SUB(libmixer,, cellSSPlayerGetState, { SPET_MASKED_OPCODE, 0x7c601b78, 0xffffffff }, { SPET_MASKED_OPCODE, 0x3c608031, 0xffffffff }, { SPET_MASKED_OPCODE, 0x2f800000, 0xffffffff }, { SPET_MASKED_OPCODE, 0x60630003, 0xffffffff }, { SPET_MASKED_OPCODE, 0x4d9e0020, 0xffffffff }, { SPET_MASKED_OPCODE, 0x78030020, 0xffffffff }, - { SPET_MASKED_OPCODE, 0x40000000, 0xf0000000 } // b + { SPET_MASKED_OPCODE, 0x40000000, 0xf0000000 }, // b ); - //REG_SUB(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDB); - //REG_SUB(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDBIndex); - //REG_SUB(libmixer, "surmxUti", cellSurMixerUtilNoteToRatio); + REG_SUB(libmixer,, cellSurMixerUtilGetLevelFromDB); + REG_SUB(libmixer,, cellSurMixerUtilGetLevelFromDBIndex); + REG_SUB(libmixer,, cellSurMixerUtilNoteToRatio); }); diff --git a/rpcs3/Emu/SysCalls/Modules/libmixer.h b/rpcs3/Emu/SysCalls/Modules/libmixer.h index 0ad5f6832e..87487b761b 100644 --- a/rpcs3/Emu/SysCalls/Modules/libmixer.h +++ b/rpcs3/Emu/SysCalls/Modules/libmixer.h @@ -112,7 +112,7 @@ enum CELL_SSPLAYER_STATE_ON = 0x20, }; -typedef s32(CellSurMixerNotifyCallbackFunction)(vm::ptr arg, u32 counter, u32 samples); +using CellSurMixerNotifyCallbackFunction = s32(vm::ptr arg, u32 counter, u32 samples); struct CellSSPlayerConfig { @@ -169,12 +169,20 @@ struct CellSurMixerChStripParam struct SurMixerConfig { + std::mutex mutex; + u32 audio_port; s32 priority; u32 ch_strips_1; u32 ch_strips_2; u32 ch_strips_6; u32 ch_strips_8; + + vm::ptr cb; + vm::ptr cb_arg; + + f32 mixdata[8 * 256]; + u64 mixcount; }; struct SSPlayer diff --git a/rpcs3/Emu/SysCalls/Modules/libsnd3.cpp b/rpcs3/Emu/SysCalls/Modules/libsnd3.cpp index d386b5e709..c3c23c74a6 100644 --- a/rpcs3/Emu/SysCalls/Modules/libsnd3.cpp +++ b/rpcs3/Emu/SysCalls/Modules/libsnd3.cpp @@ -1,12 +1,10 @@ #include "stdafx.h" -#if 0 - -void libsnd3_init(); -Module libsnd3("libsnd3", libsnd3_init); +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" #include "libsnd3.h" -s32 cellSnd3Init() //u32 maxVoice, u32 samples, CellSnd3RequestQueueCtx *queue +s32 cellSnd3Init(u32 maxVoice, u32 samples, vm::ptr queue) { UNIMPLEMENTED_FUNC(libsnd3); return CELL_OK; @@ -18,31 +16,35 @@ s32 cellSnd3Exit() return CELL_OK; } -s32 cellSnd3SetOutputMode() //u32 mode +u16 cellSnd3Note2Pitch(u16 center_note, u16 center_fine, u16 note, s16 fine) +{ + throw EXCEPTION(""); +} + +u16 cellSnd3Pitch2Note(u16 center_note, u16 center_fine, u16 pitch) +{ + throw EXCEPTION(""); +} + +s32 cellSnd3SetOutputMode(u32 mode) { UNIMPLEMENTED_FUNC(libsnd3); return CELL_OK; } -s32 cellSnd3Synthesis() //float *pOutL, float *pOutR +s32 cellSnd3Synthesis(vm::ptr pOutL, vm::ptr pOutR) { UNIMPLEMENTED_FUNC(libsnd3); return CELL_OK; } -s32 cellSnd3SynthesisEx() //float *pOutL, float *pOutR, float *pOutRL, float *pOutRR +s32 cellSnd3SynthesisEx(vm::ptr pOutL, vm::ptr pOutR, vm::ptr pOutRL, vm::ptr pOutRR) { UNIMPLEMENTED_FUNC(libsnd3); return CELL_OK; } -s32 cellSnd3VoiceSetReserveMode() //u32 voiceNum, u32 reserveMode -{ - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; -} - -s32 cellSnd3BindSoundData() //CellSnd3DataCtx *snd3Ctx, void *hd3, u32 synthMemOffset +s32 cellSnd3BindSoundData(vm::ptr snd3Ctx, vm::ptr hd3, u32 synthMemOffset) { UNIMPLEMENTED_FUNC(libsnd3); return CELL_OK; @@ -54,32 +56,30 @@ s32 cellSnd3UnbindSoundData(u32 hd3ID) return CELL_OK; } -s32 cellSnd3NoteOnByTone() //u32 hd3ID, u32 toneIndex, u32 note, u32 keyOnID, CellSnd3KeyOnParam *keyOnParam +s32 cellSnd3NoteOnByTone(u32 hd3ID, u32 toneIndex, u32 note, u32 keyOnID, vm::ptr keyOnParam) { - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO + throw EXCEPTION(""); } -s32 cellSnd3KeyOnByTone() //u32 hd3ID, u32 toneIndex, u32 pitch,u32 keyOnID,CellSnd3KeyOnParam *keyOnParam +s32 cellSnd3KeyOnByTone(u32 hd3ID, u32 toneIndex, u32 pitch, u32 keyOnID, vm::ptr keyOnParam) { - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO + throw EXCEPTION(""); } -s32 cellSnd3VoiceNoteOnByTone() //u32 hd3ID, u32 voiceNum, u32 toneIndex, u32 note, u32 keyOnID, CellSnd3KeyOnParam *keyOnParam +s32 cellSnd3VoiceNoteOnByTone(u32 hd3ID, u32 voiceNum, u32 toneIndex, u32 note, u32 keyOnID, vm::ptr keyOnParam) { - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO + throw EXCEPTION(""); } -s32 cellSnd3VoiceKeyOnByTone() //u32 hd3ID, u32 voiceNum, u32 toneIndex, u32 pitch, u32 keyOnID, CellSnd3KeyOnParam *keyOnParam +s32 cellSnd3VoiceKeyOnByTone(u32 hd3ID, u32 voiceNum, u32 toneIndex, u32 pitch, u32 keyOnID, vm::ptr keyOnParam) +{ + throw EXCEPTION(""); +} + +s32 cellSnd3VoiceSetReserveMode(u32 voiceNum, u32 reserveMode) { UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO + return CELL_OK; } s32 cellSnd3VoiceSetSustainHold(u32 voiceNum, u32 sustainHold) @@ -136,11 +136,9 @@ s32 cellSnd3VoiceGetEnvelope(u32 voiceNum) return CELL_OK; } -s32 cellSnd3VoiceGetStatus() //u32 voiceNum +s32 cellSnd3VoiceGetStatus(u32 voiceNum) { - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO + throw EXCEPTION(""); } u32 cellSnd3KeyOffByID(u32 keyOnID) @@ -149,19 +147,19 @@ u32 cellSnd3KeyOffByID(u32 keyOnID) return CELL_OK; } -s32 cellSnd3GetVoice() //u32 midiChannel, u32 keyOnID, CellSnd3VoiceBitCtx *voiceBit +s32 cellSnd3GetVoice(u32 midiChannel, u32 keyOnID, vm::ptr voiceBit) { UNIMPLEMENTED_FUNC(libsnd3); return CELL_OK; } -s32 cellSnd3GetVoiceByID() //u32 keyOnID, CellSnd3VoiceBitCtx *voiceBit +s32 cellSnd3GetVoiceByID(u32 ID, vm::ptr voiceBit) { UNIMPLEMENTED_FUNC(libsnd3); return CELL_OK; } -s32 cellSnd3NoteOn() //u32 hd3ID, u32 midiChannel, u32 midiProgram, u32 midiNote, u32 sustain,CellSnd3KeyOnParam *keyOnParam, u32 keyOnID +s32 cellSnd3NoteOn(u32 hd3ID, u32 midiChannel, u32 midiProgram, u32 midiNote, u32 sustain, vm::ptr keyOnParam, u32 keyOnID) { UNIMPLEMENTED_FUNC(libsnd3); return CELL_OK; @@ -173,7 +171,7 @@ s32 cellSnd3NoteOff(u32 midiChannel, u32 midiNote, u32 keyOnID) return CELL_OK; } -s32 cellSnd3SetSustainHold(u32 midiChannel, u32 sustainHold, u32 ID) +s32 cellSnd3SetSustainHold(u32 midiChannel, u32 sustainHold, u32 keyOnID) { UNIMPLEMENTED_FUNC(libsnd3); return CELL_OK; @@ -185,32 +183,14 @@ s32 cellSnd3SetEffectType(u16 effectType, s16 returnVol, u16 delay, u16 feedback return CELL_OK; } -u16 cellSnd3Note2Pitch() //u16 center_note, u16 center_fine, u16 note, s16 fine +s32 cellSnd3SMFBind(vm::ptr smfCtx, vm::ptr smf, u32 hd3ID) { - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO + throw EXCEPTION(""); } -u16 cellSnd3Pitch2Note() //u16 center_note, u16 center_fine, u16 pitch +s32 cellSnd3SMFUnbind(u32 smfID) { - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO -} - -s32 cellSnd3SMFBind() //CellSnd3SmfCtx *smfCtx, void *smf, u32 hd3ID -{ - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO -} - -s32 cellSnd3SMFUnbind() //u32 smfID -{ - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO + throw EXCEPTION(""); } s32 cellSnd3SMFPlay(u32 smfID, u32 playVelocity, u32 playPan, u32 playCount) @@ -249,11 +229,9 @@ s32 cellSnd3SMFAddTempo(u32 smfID, s32 addTempo) return CELL_OK; } -s32 cellSnd3SMFGetTempo() //u32 smfID +s32 cellSnd3SMFGetTempo(u32 smfID) { - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO + throw EXCEPTION(""); } s32 cellSnd3SMFSetPlayVelocity(u32 smfID, u32 playVelocity) @@ -262,11 +240,9 @@ s32 cellSnd3SMFSetPlayVelocity(u32 smfID, u32 playVelocity) return CELL_OK; } -s32 cellSnd3SMFGetPlayVelocity() //u32 smfID +s32 cellSnd3SMFGetPlayVelocity(u32 smfID) { - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO + throw EXCEPTION(""); } s32 cellSnd3SMFSetPlayPanpot(u32 smfID, u32 playPanpot) @@ -281,25 +257,19 @@ s32 cellSnd3SMFSetPlayPanpotEx(u32 smfID, u32 playPanpotEx) return CELL_OK; } -s32 cellSnd3SMFGetPlayPanpot() //u32 smfID +s32 cellSnd3SMFGetPlayPanpot(u32 smfID) { - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO + throw EXCEPTION(""); } -s32 cellSnd3SMFGetPlayPanpotEx() //u32 smfID +s32 cellSnd3SMFGetPlayPanpotEx(u32 smfID) { - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO + throw EXCEPTION(""); } -s32 cellSnd3SMFGetPlayStatus() //u32 smfID +s32 cellSnd3SMFGetPlayStatus(u32 smfID) { - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; //it's NOT real value - //TODO + throw EXCEPTION(""); } s32 cellSnd3SMFSetPlayChannel(u32 smfID, u32 playChannelBit) @@ -308,20 +278,68 @@ s32 cellSnd3SMFSetPlayChannel(u32 smfID, u32 playChannelBit) return CELL_OK; } -s32 cellSnd3SMFGetPlayChannel() //u32 smfID, u32 *playChannelBit +s32 cellSnd3SMFGetPlayChannel(u32 smfID, vm::ptr playChannelBit) +{ + throw EXCEPTION(""); +} + +s32 cellSnd3SMFGetKeyOnID(u32 smfID, u32 midiChannel, vm::ptr keyOnID) { UNIMPLEMENTED_FUNC(libsnd3); return CELL_OK; } -s32 cellSnd3SMFGetKeyOnID() //u32 smfID, u32 midiChannel, u32 *keyOnID -{ - UNIMPLEMENTED_FUNC(libsnd3); - return CELL_OK; -} -void libsnd3_init() +Module libsnd3("libsnd3", []() { - -} -#endif + REG_SUB(libsnd3,, cellSnd3Init); + REG_SUB(libsnd3,, cellSnd3Exit); + REG_SUB(libsnd3,, cellSnd3Note2Pitch); + REG_SUB(libsnd3,, cellSnd3Pitch2Note); + REG_SUB(libsnd3,, cellSnd3SetOutputMode); + REG_SUB(libsnd3,, cellSnd3Synthesis); + REG_SUB(libsnd3,, cellSnd3SynthesisEx); + REG_SUB(libsnd3,, cellSnd3BindSoundData); + REG_SUB(libsnd3,, cellSnd3UnbindSoundData); + REG_SUB(libsnd3,, cellSnd3NoteOnByTone); + REG_SUB(libsnd3,, cellSnd3KeyOnByTone); + REG_SUB(libsnd3,, cellSnd3VoiceNoteOnByTone); + REG_SUB(libsnd3,, cellSnd3VoiceKeyOnByTone); + REG_SUB(libsnd3,, cellSnd3VoiceSetReserveMode); + REG_SUB(libsnd3,, cellSnd3VoiceSetSustainHold); + REG_SUB(libsnd3,, cellSnd3VoiceKeyOff); + REG_SUB(libsnd3,, cellSnd3VoiceSetPitch); + REG_SUB(libsnd3,, cellSnd3VoiceSetVelocity); + REG_SUB(libsnd3,, cellSnd3VoiceSetPanpot); + REG_SUB(libsnd3,, cellSnd3VoiceSetPanpotEx); + REG_SUB(libsnd3,, cellSnd3VoiceSetPitchBend); + REG_SUB(libsnd3,, cellSnd3VoiceAllKeyOff); + REG_SUB(libsnd3,, cellSnd3VoiceGetEnvelope); + REG_SUB(libsnd3,, cellSnd3VoiceGetStatus); + REG_SUB(libsnd3,, cellSnd3KeyOffByID); + REG_SUB(libsnd3,, cellSnd3GetVoice); + REG_SUB(libsnd3,, cellSnd3GetVoiceByID); + REG_SUB(libsnd3,, cellSnd3NoteOn); + REG_SUB(libsnd3,, cellSnd3NoteOff); + REG_SUB(libsnd3,, cellSnd3SetSustainHold); + REG_SUB(libsnd3,, cellSnd3SetEffectType); + REG_SUB(libsnd3,, cellSnd3SMFBind); + REG_SUB(libsnd3,, cellSnd3SMFUnbind); + REG_SUB(libsnd3,, cellSnd3SMFPlay); + REG_SUB(libsnd3,, cellSnd3SMFPlayEx); + REG_SUB(libsnd3,, cellSnd3SMFPause); + REG_SUB(libsnd3,, cellSnd3SMFResume); + REG_SUB(libsnd3,, cellSnd3SMFStop); + REG_SUB(libsnd3,, cellSnd3SMFAddTempo); + REG_SUB(libsnd3,, cellSnd3SMFGetTempo); + REG_SUB(libsnd3,, cellSnd3SMFSetPlayVelocity); + REG_SUB(libsnd3,, cellSnd3SMFGetPlayVelocity); + REG_SUB(libsnd3,, cellSnd3SMFSetPlayPanpot); + REG_SUB(libsnd3,, cellSnd3SMFSetPlayPanpotEx); + REG_SUB(libsnd3,, cellSnd3SMFGetPlayPanpot); + REG_SUB(libsnd3,, cellSnd3SMFGetPlayPanpotEx); + REG_SUB(libsnd3,, cellSnd3SMFGetPlayStatus); + REG_SUB(libsnd3,, cellSnd3SMFSetPlayChannel); + REG_SUB(libsnd3,, cellSnd3SMFGetPlayChannel); + REG_SUB(libsnd3,, cellSnd3SMFGetKeyOnID); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/libsnd3.h b/rpcs3/Emu/SysCalls/Modules/libsnd3.h index 7e97a34839..80d8dc8c82 100644 --- a/rpcs3/Emu/SysCalls/Modules/libsnd3.h +++ b/rpcs3/Emu/SysCalls/Modules/libsnd3.h @@ -1,6 +1,6 @@ #pragma once -//libsnd3 Error Codes +// Error Codes enum { CELL_SND3_ERROR_PARAM = 0x80310301, @@ -21,17 +21,6 @@ enum CELL_SND3_ERROR_OUTPUTMODE = 0x80310310, }; -//libsnd3 datatypes -struct CellSnd3DataCtx -{ - s8 system; //[CELL_SND3_DATA_CTX_SIZE], unknown identifier -}; - -struct CellSnd3SmfCtx -{ - s8 system; //[CELL_SND3_SMF_CTX_SIZE], unknown identifier -}; - struct CellSnd3KeyOnParam { u8 vel; @@ -42,13 +31,25 @@ struct CellSnd3KeyOnParam struct CellSnd3VoiceBitCtx { - be_t core; //[CELL_SND3_MAX_CORE], unknown identifier + be_t core[4]; +}; + +struct CellSnd3DataCtx +{ + s8 system[32]; +}; + +struct CellSnd3SmfCtx +{ + s8 system[352]; }; struct CellSnd3RequestQueueCtx { - void *frontQueue; + vm::bptr frontQueue; be_t frontQueueSize; - void *rearQueue; + vm::bptr rearQueue; be_t rearQueueSize; }; + +extern Module libsnd3; diff --git a/rpcs3/Emu/SysCalls/Modules/libsynth2.cpp b/rpcs3/Emu/SysCalls/Modules/libsynth2.cpp index 6c1304868d..86b91edda6 100644 --- a/rpcs3/Emu/SysCalls/Modules/libsynth2.cpp +++ b/rpcs3/Emu/SysCalls/Modules/libsynth2.cpp @@ -1,24 +1,22 @@ #include "stdafx.h" -#if 0 - -void libsynth2_init(); -Module libsynth2("libsynth2", libsynth2_init); +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" #include "libsynth2.h" -int cellSoundSynth2Config(s16 param, int value) +s32 cellSoundSynth2Config(s16 param, s32 value) { libsynth2.Todo("cellSoundSynth2Config(param=%d, value=%d)", param, value); return CELL_OK; } -int cellSoundSynth2Init(s16 flag) +s32 cellSoundSynth2Init(s16 flag) { libsynth2.Todo("cellSoundSynth2Init(flag=%d)", flag); return CELL_OK; } -int cellSoundSynth2Exit() +s32 cellSoundSynth2Exit() { libsynth2.Todo("cellSoundSynth2Exit()"); return CELL_OK; @@ -31,8 +29,8 @@ void cellSoundSynth2SetParam(u16 reg, u16 value) u16 cellSoundSynth2GetParam(u16 reg) { - libsynth2.Todo("cellSoundSynth2GetParam(register=0x%x) -> 0", reg); - return 0; + libsynth2.Todo("cellSoundSynth2GetParam(register=0x%x)", reg); + throw EXCEPTION(""); } void cellSoundSynth2SetSwitch(u16 reg, u32 value) @@ -42,11 +40,11 @@ void cellSoundSynth2SetSwitch(u16 reg, u32 value) u32 cellSoundSynth2GetSwitch(u16 reg) { - libsynth2.Todo("cellSoundSynth2GetSwitch(register=0x%x) -> 0", reg); - return 0; + libsynth2.Todo("cellSoundSynth2GetSwitch(register=0x%x)", reg); + throw EXCEPTION(""); } -int cellSoundSynth2SetAddr(u16 reg, u32 value) +s32 cellSoundSynth2SetAddr(u16 reg, u32 value) { libsynth2.Todo("cellSoundSynth2SetAddr(register=0x%x, value=0x%x)", reg, value); return CELL_OK; @@ -54,19 +52,19 @@ int cellSoundSynth2SetAddr(u16 reg, u32 value) u32 cellSoundSynth2GetAddr(u16 reg) { - libsynth2.Todo("cellSoundSynth2GetAddr(register=0x%x) -> 0", reg); - return 0; + libsynth2.Todo("cellSoundSynth2GetAddr(register=0x%x)", reg); + throw EXCEPTION(""); } -int cellSoundSynth2SetEffectAttr(s16 bus, vm::ptr attr) +s32 cellSoundSynth2SetEffectAttr(s16 bus, vm::ptr attr) { - libsynth2.Todo("cellSoundSynth2SetEffectAttr(bus=%d, attr=0x%x)", bus, attr); + libsynth2.Todo("cellSoundSynth2SetEffectAttr(bus=%d, attr=*0x%x)", bus, attr); return CELL_OK; } -int cellSoundSynth2SetEffectMode(s16 bus, vm::ptr attr) +s32 cellSoundSynth2SetEffectMode(s16 bus, vm::ptr attr) { - libsynth2.Todo("cellSoundSynth2SetEffectMode(bus=%d, attr=0x%x)", bus, attr); + libsynth2.Todo("cellSoundSynth2SetEffectMode(bus=%d, attr=*0x%x)", bus, attr); return CELL_OK; } @@ -75,20 +73,19 @@ void cellSoundSynth2SetCoreAttr(u16 entry, u16 value) libsynth2.Todo("cellSoundSynth2SetCoreAttr(entry=0x%x, value=0x%x)", entry, value); } -int cellSoundSynth2Generate(u16 samples, u32 L_addr, u32 R_addr, u32 Lr_addr, u32 Rr_addr) +s32 cellSoundSynth2Generate(u16 samples, vm::ptr Lout, vm::ptr Rout, vm::ptr Ls, vm::ptr Rs) { - libsynth2.Todo("cellSoundSynth2Generate(samples=0x%x, left=0x%x, right=0x%x, left_rear=0x%x, right_rear=0x%x)", samples, L_addr, R_addr, Lr_addr, Rr_addr); + libsynth2.Todo("cellSoundSynth2Generate(samples=0x%x, Lout=*0x%x, Rout=*0x%x, Ls=*0x%x, Rs=*0x%x)", samples, Lout, Rout, Ls, Rs); return CELL_OK; } -int cellSoundSynth2VoiceTrans(s16 channel, u16 mode, u32 mem_side_addr, u32 lib_side_addr, u32 size) +s32 cellSoundSynth2VoiceTrans(s16 channel, u16 mode, vm::ptr m_addr, u32 s_addr, u32 size) { - libsynth2.Todo("cellSoundSynth2VoiceTrans(channel=%d, mode=0x%x, m_addr=0x%x, s_addr=0x%x, size=0x%x)", - channel, mode, mem_side_addr, lib_side_addr, size); + libsynth2.Todo("cellSoundSynth2VoiceTrans(channel=%d, mode=0x%x, m_addr=*0x%x, s_addr=0x%x, size=0x%x)", channel, mode, m_addr, s_addr, size); return CELL_OK; } -int cellSoundSynth2VoiceTransStatus(s16 channel, s16 flag) +s32 cellSoundSynth2VoiceTransStatus(s16 channel, s16 flag) { libsynth2.Todo("cellSoundSynth2VoiceTransStatus(channel=%d, flag=%d)", channel, flag); return CELL_OK; @@ -96,63 +93,34 @@ int cellSoundSynth2VoiceTransStatus(s16 channel, s16 flag) u16 cellSoundSynth2Note2Pitch(u16 center_note, u16 center_fine, u16 note, s16 fine) { - libsynth2.Todo("cellSoundSynth2Note2Pitch(center_note=0x%x, center_fine=0x%x, note=0x%x, fine=%d) -> 0", - center_note, center_fine, note, fine); - return 0; + libsynth2.Todo("cellSoundSynth2Note2Pitch(center_note=0x%x, center_fine=0x%x, note=0x%x, fine=%d)", center_note, center_fine, note, fine); + throw EXCEPTION(""); } u16 cellSoundSynth2Pitch2Note(u16 center_note, u16 center_fine, u16 pitch) { - libsynth2.Todo("cellSoundSynth2Pitch2Note(center_note=0x%x, center_fine=0x%x, pitch=0x%x) -> 0", - center_note, center_fine, pitch); - return 0; + libsynth2.Todo("cellSoundSynth2Pitch2Note(center_note=0x%x, center_fine=0x%x, pitch=0x%x)", center_note, center_fine, pitch); + throw EXCEPTION(""); } -void libsynth2_init() + +Module libsynth2("libsynth2", []() { - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2Init, - /* - 0xffffffff7d800026, - 0xfffffffff821ff41, - 0xfffffffffb610098, - 0xff0000008362001c, // lwz - 0xfffffffffb8100a0, - 0xffffffff3f9b0008, - 0xfffffffffba100a8, - 0xffffffff3fa08031, - 0xfffffffffbe100b8, - 0xfffffffffb010080, - 0xfffffffffb210088, - 0xfffffffffb410090, - 0xfffffffffbc100b0, - 0xffffffff7c7f1b78, - 0xffffffff63bd0203, - 0xffffffff918100c8, - 0xffffffff7c0802a6, - 0xfffffffff80100d0, - 0xffffffff897c7688, - 0xffffffff2f8b0000, - 0xffffff00409e01fc, // bne - 0xffffffff38000002, - 0xffffffff39200020, - 0xffffffff3ba00000, - */ - ); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2Exit); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2Config); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2GetAddr); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2GetParam); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2GetSwitch); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2SetAddr); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2SetParam); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2SetSwitch); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2SetEffectMode); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2SetEffectAttr); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2Note2Pitch); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2Pitch2Note); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2VoiceTrans); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2VoiceTransStatus); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2SetCoreAttr); - REG_SUB_EMPTY(libsynth2, "synth2", cellSoundSynth2Generate); -} -#endif + REG_SUB(libsynth2,, cellSoundSynth2Config); + REG_SUB(libsynth2,, cellSoundSynth2Init); + REG_SUB(libsynth2,, cellSoundSynth2Exit); + REG_SUB(libsynth2,, cellSoundSynth2SetParam); + REG_SUB(libsynth2,, cellSoundSynth2GetParam); + REG_SUB(libsynth2,, cellSoundSynth2SetSwitch); + REG_SUB(libsynth2,, cellSoundSynth2GetSwitch); + REG_SUB(libsynth2,, cellSoundSynth2SetAddr); + REG_SUB(libsynth2,, cellSoundSynth2GetAddr); + REG_SUB(libsynth2,, cellSoundSynth2SetEffectAttr); + REG_SUB(libsynth2,, cellSoundSynth2SetEffectMode); + REG_SUB(libsynth2,, cellSoundSynth2SetCoreAttr); + REG_SUB(libsynth2,, cellSoundSynth2Generate); + REG_SUB(libsynth2,, cellSoundSynth2VoiceTrans); + REG_SUB(libsynth2,, cellSoundSynth2VoiceTransStatus); + REG_SUB(libsynth2,, cellSoundSynth2Note2Pitch); + REG_SUB(libsynth2,, cellSoundSynth2Pitch2Note); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/libsynth2.h b/rpcs3/Emu/SysCalls/Modules/libsynth2.h index 8b1c428855..2ebdebda49 100644 --- a/rpcs3/Emu/SysCalls/Modules/libsynth2.h +++ b/rpcs3/Emu/SysCalls/Modules/libsynth2.h @@ -1,8 +1,8 @@ #pragma once +// Error Codes enum { - //libsynt2 Error Codes CELL_SOUND_SYNTH2_ERROR_FATAL = 0x80310201, CELL_SOUND_SYNTH2_ERROR_INVALID_PARAMETER = 0x80310202, CELL_SOUND_SYNTH2_ERROR_ALREADY_INITIALIZED = 0x80310203, @@ -16,4 +16,6 @@ struct CellSoundSynth2EffectAttr be_t depth_R; be_t delay; be_t feedback; -}; \ No newline at end of file +}; + +extern Module libsynth2; diff --git a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp index c556bc8ea0..2cedce03ca 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp @@ -12,37 +12,24 @@ extern Module sceNp; -std::unique_ptr g_sceNp; - -s32 sceNpInit(u32 poolsize, vm::ptr poolptr) +s32 sceNpInit(u32 poolsize, vm::ptr poolptr) { - sceNp.Warning("sceNpInit(poolsize=%d, poolptr=0x%x)", poolsize, poolptr); - - if (g_sceNp->m_bSceNpInitialized) - { - sceNp.Error("sceNpInit(): sceNp has been already initialized."); - return SCE_NP_ERROR_ALREADY_INITIALIZED; - } + sceNp.Warning("sceNpInit(poolsize=0x%x, poolptr=*0x%x)", poolsize, poolptr); if (poolsize == 0) { - sceNp.Error("sceNpInit(): poolsize given is 0."); return SCE_NP_ERROR_INVALID_ARGUMENT; } else if (poolsize < 128 * 1024) { - sceNp.Error("sceNp2Init(): poolsize given is under 131072 bytes."); return SCE_NP_ERROR_INSUFFICIENT_BUFFER; } if (!poolptr) { - sceNp.Error("sceNpInit(): poolptr is invalid."); return SCE_NP_ERROR_INVALID_ARGUMENT; } - g_sceNp->m_bSceNpInitialized = true; - return CELL_OK; } @@ -50,14 +37,6 @@ s32 sceNpTerm() { sceNp.Warning("sceNpTerm()"); - if (!g_sceNp->m_bSceNpInitialized) - { - sceNp.Error("sceNpTerm(): sceNp has not been intialized."); - return SCE_NP_ERROR_NOT_INITIALIZED; - } - - g_sceNp->m_bSceNpInitialized = false; - return CELL_OK; } @@ -129,28 +108,28 @@ s32 npDrmIsAvailable(u32 k_licensee_addr, vm::cptr drm_path) s32 sceNpDrmIsAvailable(u32 k_licensee_addr, vm::cptr 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=*0x%x, drm_path=*0x%x)", k_licensee_addr, drm_path); return npDrmIsAvailable(k_licensee_addr, drm_path); } s32 sceNpDrmIsAvailable2(u32 k_licensee_addr, vm::cptr 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=*0x%x, drm_path=*0x%x)", k_licensee_addr, drm_path); return npDrmIsAvailable(k_licensee_addr, drm_path); } s32 sceNpDrmVerifyUpgradeLicense(vm::cptr content_id) { - sceNp.Todo("sceNpDrmVerifyUpgradeLicense(content_id_addr=0x%x)", content_id.addr()); + sceNp.Todo("sceNpDrmVerifyUpgradeLicense(content_id=*0x%x)", content_id); return CELL_OK; } s32 sceNpDrmVerifyUpgradeLicense2(vm::cptr content_id) { - sceNp.Todo("sceNpDrmVerifyUpgradeLicense2(content_id_addr=0x%x)", content_id.addr()); + sceNp.Todo("sceNpDrmVerifyUpgradeLicense2(content_id=*0x%x)", content_id); return CELL_OK; } @@ -163,7 +142,7 @@ s32 sceNpDrmExecuteGamePurchase() s32 sceNpDrmGetTimelimit(vm::ptr path, vm::ptr time_remain) { - sceNp.Warning("sceNpDrmGetTimelimit(path_addr=0x%x, time_remain=0x%x)", path.addr(), time_remain.addr()); + sceNp.Warning("sceNpDrmGetTimelimit(path=*0x%x, time_remain=*0x%x)", path, time_remain); *time_remain = 0x7FFFFFFFFFFFFFFFULL; @@ -280,12 +259,7 @@ s32 sceNpBasicAddFriend() s32 sceNpBasicGetFriendListEntryCount(vm::ptr count) { - sceNp.Warning("sceNpBasicGetFriendListEntryCount(count_addr=0x%x)", count.addr()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; - } + sceNp.Warning("sceNpBasicGetFriendListEntryCount(count=*0x%x)", count); // TODO: Check if there are any friends *count = 0; @@ -337,12 +311,7 @@ s32 sceNpBasicAddPlayersHistoryAsync() s32 sceNpBasicGetPlayersHistoryEntryCount(u32 options, vm::ptr count) { - sceNp.Todo("sceNpBasicGetPlayersHistoryEntryCount(options=%d, count_addr=0x%x)", options, count.addr()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; - } + sceNp.Todo("sceNpBasicGetPlayersHistoryEntryCount(options=%d, count=*0x%x)", options, count); return CELL_OK; } @@ -363,11 +332,6 @@ s32 sceNpBasicGetBlockListEntryCount(u32 count) { sceNp.Todo("sceNpBasicGetBlockListEntryCount(count=%d)", count); - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } @@ -379,24 +343,14 @@ s32 sceNpBasicGetBlockListEntry() s32 sceNpBasicGetMessageAttachmentEntryCount(vm::ptr count) { - sceNp.Todo("sceNpBasicGetMessageAttachmentEntryCount(count_addr=0x%x)", count.addr()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; - } + sceNp.Todo("sceNpBasicGetMessageAttachmentEntryCount(count=*0x%x)", count); return CELL_OK; } s32 sceNpBasicGetMessageAttachmentEntry(u32 index, vm::ptr from) { - sceNp.Todo("sceNpBasicGetMessageAttachmentEntry(index=%d, from_addr=0x%x)", index, from.addr()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; - } + sceNp.Todo("sceNpBasicGetMessageAttachmentEntry(index=%d, from=*0x%x)", index, from); return CELL_OK; } @@ -415,60 +369,35 @@ s32 sceNpBasicGetCustomInvitationEntry() s32 sceNpBasicGetMatchingInvitationEntryCount(vm::ptr count) { - sceNp.Todo("sceNpBasicGetMatchingInvitationEntryCount(count_addr=0x%x)", count.addr()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; - } + sceNp.Todo("sceNpBasicGetMatchingInvitationEntryCount(count=*0x%x)", count); return CELL_OK; } s32 sceNpBasicGetMatchingInvitationEntry(u32 index, vm::ptr from) { - sceNp.Todo("sceNpBasicGetMatchingInvitationEntry(index=%d, from_addr=0x%x)", index, from.addr()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; - } + sceNp.Todo("sceNpBasicGetMatchingInvitationEntry(index=%d, from=*0x%x)", index, from); return CELL_OK; } s32 sceNpBasicGetClanMessageEntryCount(vm::ptr count) { - sceNp.Todo("sceNpBasicGetClanMessageEntryCount(count_addr=0x%x)", count.addr()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; - } + sceNp.Todo("sceNpBasicGetClanMessageEntryCount(count=*0x%x)", count); return CELL_OK; } s32 sceNpBasicGetClanMessageEntry(u32 index, vm::ptr from) { - sceNp.Todo("sceNpBasicGetClanMessageEntry(index=%d, from_addr=0x%x)", index, from.addr()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; - } + sceNp.Todo("sceNpBasicGetClanMessageEntry(index=%d, from=*0x%x)", index, from); return CELL_OK; } s32 sceNpBasicGetMessageEntryCount(u32 type, vm::ptr count) { - sceNp.Warning("sceNpBasicGetMessageEntryCount(type=%d, count_addr=0x%x)", type, count.addr()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; - } + sceNp.Warning("sceNpBasicGetMessageEntryCount(type=%d, count=*0x%x)", type, count); // TODO: Check if there are messages *count = 0; @@ -478,24 +407,14 @@ s32 sceNpBasicGetMessageEntryCount(u32 type, vm::ptr count) s32 sceNpBasicGetMessageEntry(u32 type, u32 index, vm::ptr from) { - sceNp.Todo("sceNpBasicGetMessageEntry(type=%d, index=%d, from_addr=0x%x)", type, index, from.addr()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; - } + sceNp.Todo("sceNpBasicGetMessageEntry(type=%d, index=%d, from=*0x%x)", type, index, from); return CELL_OK; } s32 sceNpBasicGetEvent(vm::ptr event, vm::ptr from, vm::ptr data, vm::ptr 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()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; - } + sceNp.Warning("sceNpBasicGetEvent(event=*0x%x, from=*0x%x, data=*0x%x, size=*0x%x)", event, from, data, size); // TODO: Check for other error and pass other events *event = SCE_NP_BASIC_EVENT_OFFLINE; @@ -759,15 +678,6 @@ s32 sceNpLookupInit() { sceNp.Warning("sceNpLookupInit()"); - // TODO: Make sure the error code returned is right, - // since there are no error codes for Lookup utility. - if (g_sceNp->m_bLookupInitialized) - { - return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED; - } - - g_sceNp->m_bLookupInitialized = true; - return CELL_OK; } @@ -775,13 +685,6 @@ s32 sceNpLookupTerm() { sceNp.Warning("sceNpLookupTerm()"); - if (!g_sceNp->m_bLookupInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - - g_sceNp->m_bLookupInitialized = false; - return CELL_OK; } @@ -920,12 +823,7 @@ s32 sceNpManagerUnregisterCallback() s32 sceNpManagerGetStatus(vm::ptr status) { - sceNp.Warning("sceNpManagerGetStatus(status_addr=0x%x)", status.addr()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_ERROR_NOT_INITIALIZED; - } + sceNp.Warning("sceNpManagerGetStatus(status=*0x%x)", status); // TODO: Support different statuses *status = SCE_NP_MANAGER_STATUS_OFFLINE; @@ -983,12 +881,7 @@ s32 sceNpManagerGetAccountAge() s32 sceNpManagerGetContentRatingFlag(vm::ptr isRestricted, vm::ptr age) { - sceNp.Warning("sceNpManagerGetContentRatingFlag(isRestricted_addr=0x%x, age_addr=0x%x)", isRestricted.addr(), age.addr()); - - if (!g_sceNp->m_bSceNpInitialized) - { - return SCE_NP_ERROR_NOT_INITIALIZED; - } + sceNp.Warning("sceNpManagerGetContentRatingFlag(isRestricted=*0x%x, age=*0x%x)", isRestricted, age); // TODO: read user's parental control information *isRestricted = 0; @@ -1217,13 +1110,6 @@ s32 sceNpScoreInit() { sceNp.Warning("sceNpScoreInit()"); - if (g_sceNp->m_bScoreInitialized) - { - return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED; - } - - g_sceNp->m_bScoreInitialized = true; - return CELL_OK; } @@ -1231,13 +1117,6 @@ s32 sceNpScoreTerm() { sceNp.Warning("sceNpScoreTerm()"); - if (!g_sceNp->m_bScoreInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - - g_sceNp->m_bScoreInitialized = false; - return CELL_OK; } @@ -1571,6 +1450,18 @@ s32 sceNpSignalingGetPeerNetInfoResult() return CELL_OK; } +s32 sceNpUtilCmpNpId() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +s32 sceNpUtilCmpNpIdInOrder() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + s32 _sceNpSysutilClientMalloc() { UNIMPLEMENTED_FUNC(sceNp); @@ -1583,10 +1474,54 @@ s32 _sceNpSysutilClientFree() return CELL_OK; } +s32 _Z33_sce_np_sysutil_send_empty_packetiPN16sysutil_cxmlutil11FixedMemoryEPKcS3_() +{ + throw EXCEPTION(""); +} + +s32 _Z27_sce_np_sysutil_send_packetiRN4cxml8DocumentE() +{ + throw EXCEPTION(""); +} + +s32 _Z36_sce_np_sysutil_recv_packet_fixedmemiPN16sysutil_cxmlutil11FixedMemoryERN4cxml8DocumentERNS2_7ElementE() +{ + throw EXCEPTION(""); +} + +s32 _Z40_sce_np_sysutil_recv_packet_fixedmem_subiPN16sysutil_cxmlutil11FixedMemoryERN4cxml8DocumentERNS2_7ElementE() +{ + throw EXCEPTION(""); +} + +s32 _Z27_sce_np_sysutil_recv_packetiRN4cxml8DocumentERNS_7ElementE() +{ + throw EXCEPTION(""); +} + +s32 _Z29_sce_np_sysutil_cxml_set_npidRN4cxml8DocumentERNS_7ElementEPKcPK7SceNpId() +{ + throw EXCEPTION(""); +} + +s32 _Z31_sce_np_sysutil_send_packet_subiRN4cxml8DocumentE() +{ + throw EXCEPTION(""); +} + +s32 _Z37sce_np_matching_set_matching2_runningb() +{ + throw EXCEPTION(""); +} + +s32 _Z32_sce_np_sysutil_cxml_prepare_docPN16sysutil_cxmlutil11FixedMemoryERN4cxml8DocumentEPKcRNS2_7ElementES6_i() +{ + throw EXCEPTION(""); +} + + Module sceNp("sceNp", []() { - g_sceNp = std::make_unique(); - REG_FUNC(sceNp, sceNpInit); REG_FUNC(sceNp, sceNpTerm); REG_FUNC(sceNp, sceNpDrmIsAvailable); @@ -1805,6 +1740,17 @@ Module sceNp("sceNp", []() REG_FUNC(sceNp, sceNpSignalingGetPeerNetInfo); REG_FUNC(sceNp, sceNpSignalingCancelPeerNetInfo); REG_FUNC(sceNp, sceNpSignalingGetPeerNetInfoResult); + REG_FUNC(sceNp, sceNpUtilCmpNpId); + REG_FUNC(sceNp, sceNpUtilCmpNpIdInOrder); REG_FUNC(sceNp, _sceNpSysutilClientMalloc); REG_FUNC(sceNp, _sceNpSysutilClientFree); + REG_FUNC(sceNp, _Z33_sce_np_sysutil_send_empty_packetiPN16sysutil_cxmlutil11FixedMemoryEPKcS3_); + REG_FUNC(sceNp, _Z27_sce_np_sysutil_send_packetiRN4cxml8DocumentE); + REG_FUNC(sceNp, _Z36_sce_np_sysutil_recv_packet_fixedmemiPN16sysutil_cxmlutil11FixedMemoryERN4cxml8DocumentERNS2_7ElementE); + REG_FUNC(sceNp, _Z40_sce_np_sysutil_recv_packet_fixedmem_subiPN16sysutil_cxmlutil11FixedMemoryERN4cxml8DocumentERNS2_7ElementE); + REG_FUNC(sceNp, _Z27_sce_np_sysutil_recv_packetiRN4cxml8DocumentERNS_7ElementE); + REG_FUNC(sceNp, _Z29_sce_np_sysutil_cxml_set_npidRN4cxml8DocumentERNS_7ElementEPKcPK7SceNpId); + REG_FUNC(sceNp, _Z31_sce_np_sysutil_send_packet_subiRN4cxml8DocumentE); + REG_FUNC(sceNp, _Z37sce_np_matching_set_matching2_runningb); + REG_FUNC(sceNp, _Z32_sce_np_sysutil_cxml_prepare_docPN16sysutil_cxmlutil11FixedMemoryERN4cxml8DocumentEPKcRNS2_7ElementES6_i); }); diff --git a/rpcs3/Emu/SysCalls/Modules/sceNp.h b/rpcs3/Emu/SysCalls/Modules/sceNp.h index abae653a66..8bcd04255e 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNp.h +++ b/rpcs3/Emu/SysCalls/Modules/sceNp.h @@ -217,7 +217,7 @@ enum // SCE_NP_MATCHING2_NET_H_ERRNO_BASE = 0x800225XX, }; -using SceNpBasicEventHandler = func_def arg)>; +using SceNpBasicEventHandler = s32(s32 event, s32 retCode, u32 reqId, vm::ptr arg); // NP Manager Utility statuses enum @@ -807,37 +807,6 @@ enum SCE_NP_SIGNALING_CTX_MAX = 8, }; -struct SceNpInternal -{ - bool m_bSceNpInitialized; - bool m_bScoreInitialized; - bool m_bLookupInitialized; - - SceNpInternal() - : m_bSceNpInitialized(false), - m_bScoreInitialized(false), - m_bLookupInitialized(false) - { - } -}; - -struct SceNp2Internal -{ - bool m_bSceNp2Initialized; - bool m_bSceNp2Matching2Initialized; - bool m_bSceNp2Matching2Initialized2; - - SceNp2Internal() - : m_bSceNp2Initialized(false), - m_bSceNp2Matching2Initialized(false), - m_bSceNp2Matching2Initialized2(false) - { - } -}; - -extern std::unique_ptr g_sceNp; -extern std::unique_ptr g_sceNp2; - // NP communication ID structure struct SceNpCommunicationId { @@ -954,7 +923,7 @@ struct SceNpBasicExtendedAttachmentData be_t msgId; SceNpBasicAttachmentData data; be_t userAction; - bool markedAsUsed; + b8 markedAsUsed; //be_t reserved[3]; }; @@ -1130,7 +1099,7 @@ struct SceNpMatching2World be_t curNumOfTotalLobbyMember; be_t curNumOfRoom; be_t curNumOfTotalRoomMember; - bool withEntitlementId; + b8 withEntitlementId; SceNpEntitlementId entitlementId; u8 padding[3]; }; @@ -1234,9 +1203,9 @@ struct SceNpMatching2GroupLabel struct SceNpMatching2RoomGroupConfig { be_t slotNum; - bool withLabel; + b8 withLabel; SceNpMatching2GroupLabel label; - bool withPassword; + b8 withPassword; u8 padding[2]; }; @@ -1244,7 +1213,7 @@ struct SceNpMatching2RoomGroupConfig struct SceNpMatching2RoomGroupPasswordConfig { u8 groupId; - bool withPassword; + b8 withPassword; u8 padding[1]; }; @@ -1252,8 +1221,8 @@ struct SceNpMatching2RoomGroupPasswordConfig struct SceNpMatching2RoomGroup { u8 groupId; - bool withPassword; - bool withLabel; + b8 withPassword; + b8 withLabel; u8 padding[1]; SceNpMatching2GroupLabel label; be_t slotNum; @@ -1652,7 +1621,7 @@ struct SceNpMatching2SendRoomChatMessageRequest // Room chat message send request response data struct SceNpMatching2SendRoomChatMessageResponse { - bool filtered; + b8 filtered; }; // Internal room data configuration request parameters @@ -1778,7 +1747,7 @@ struct SceNpMatching2SendLobbyChatMessageRequest // Lobby chat message sending response data struct SceNpMatching2SendLobbyChatMessageResponse { - bool filtered; + b8 filtered; }; // Lobby invitation message sending request parameter @@ -1831,7 +1800,7 @@ struct SceNpMatching2GetLobbyMemberDataInternalListRequest be_t memberIdNum; be_t attrId; be_t attrIdNum; - bool extendedData; + b8 extendedData; u8 padding[7]; }; @@ -1925,7 +1894,7 @@ struct SceNpMatching2RoomMemberDataInternalUpdateInfo // Room message information struct SceNpMatching2RoomMessageInfo { - bool filtered; + b8 filtered; u8 castType; u8 padding[2]; SceNpMatching2RoomMessageDestination dst; @@ -1968,7 +1937,7 @@ struct SceNpMatching2LobbyMemberDataInternalUpdateInfo // Lobby message information struct SceNpMatching2LobbyMessageInfo { - bool filtered; + b8 filtered; u8 castType; u8 padding[2]; SceNpMatching2LobbyMessageDestination dst; @@ -1998,8 +1967,8 @@ struct SceNpMatching2UtilityInitParam { be_t containerId; be_t requestCbQueueLen; - be_t sessionEventCbQueueLen;; - be_t sessionMsgCbQueueLen;; + be_t sessionEventCbQueueLen; + be_t sessionMsgCbQueueLen; u8 reserved[16]; }; @@ -2007,8 +1976,8 @@ struct SceNpMatching2UtilityInitParam struct SceNpMatching2MemoryInfo { be_t totalMemSize; - be_t curMemUsage;; - be_t maxMemUsage;; + be_t curMemUsage; + be_t maxMemUsage; u8 reserved[12]; }; @@ -2016,14 +1985,14 @@ struct SceNpMatching2MemoryInfo struct SceNpMatching2CbQueueInfo { be_t requestCbQueueLen; - be_t curRequestCbQueueLen;; - be_t maxRequestCbQueueLen;; - be_t sessionEventCbQueueLen;; - be_t curSessionEventCbQueueLen;; - be_t maxSessionEventCbQueueLen;; - be_t sessionMsgCbQueueLen;; - be_t curSessionMsgCbQueueLen;; - be_t maxSessionMsgCbQueueLen;; + be_t curRequestCbQueueLen; + be_t maxRequestCbQueueLen; + be_t sessionEventCbQueueLen; + be_t curSessionEventCbQueueLen; + be_t maxSessionEventCbQueueLen; + be_t sessionMsgCbQueueLen; + be_t curSessionMsgCbQueueLen; + be_t maxSessionMsgCbQueueLen; u8 reserved[12]; }; diff --git a/rpcs3/Emu/SysCalls/Modules/sceNp2.cpp b/rpcs3/Emu/SysCalls/Modules/sceNp2.cpp index 471bf1c236..114c16c7b4 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNp2.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNp2.cpp @@ -6,79 +6,37 @@ extern Module sceNp2; -std::unique_ptr g_sceNp2; - -s32 sceNp2Init(u32 poolsize, vm::ptr poolptr) +s32 sceNp2Init(u32 poolsize, vm::ptr poolptr) { - sceNp2.Warning("sceNp2Init(poolsize=%d, poolptr=0x%x)", poolsize, poolptr); - - if (g_sceNp2->m_bSceNp2Initialized) - { - sceNp2.Error("sceNp2Init(): sceNp2 has been already initialized."); - return SCE_NP_ERROR_ALREADY_INITIALIZED; - } + sceNp2.Warning("sceNp2Init(poolsize=0x%x, poolptr=*0x%x)", poolsize, poolptr); if (poolsize == 0) { - sceNp2.Error("sceNp2Init(): poolsize given is 0."); return SCE_NP_ERROR_INVALID_ARGUMENT; } else if (poolsize < 128 * 1024) { - sceNp2.Error("sceNp2Init(): poolsize given is under 131072 bytes."); return SCE_NP_ERROR_INSUFFICIENT_BUFFER; } if (!poolptr) { - sceNp2.Error("sceNp2Init(): poolptr is invalid."); return SCE_NP_ERROR_INVALID_ARGUMENT; } - g_sceNp->m_bSceNpInitialized = true; - g_sceNp2->m_bSceNp2Initialized = true; - return CELL_OK; } s32 sceNpMatching2Init(u32 poolsize, s32 priority) { - sceNp2.Todo("sceNpMatching2Init(poolsize=%d, priority=%d)", poolsize, priority); - - if (!g_sceNp2->m_bSceNp2Initialized) - { - sceNp2.Error("sceNpMatching2Init(): sceNp2 has not been intialized."); - return SCE_NP_ERROR_NOT_INITIALIZED; - } - - if (g_sceNp2->m_bSceNp2Matching2Initialized) - { - sceNp2.Error("sceNpMatching2Init(): sceNpMatching2 has already been intialized."); - return SCE_NP_MATCHING2_ERROR_ALREADY_INITIALIZED; - } - - g_sceNp2->m_bSceNp2Matching2Initialized = true; + sceNp2.Todo("sceNpMatching2Init(poolsize=0x%x, priority=%d)", poolsize, priority); return CELL_OK; } s32 sceNpMatching2Init2(u32 poolsize, s32 priority, vm::ptr param) { - sceNp2.Todo("sceNpMatching2Init2(poolsize=%d, priority=%d, param_addr=0x%x)", poolsize, priority, param.addr()); - - if (!g_sceNp2->m_bSceNp2Initialized) - { - sceNp2.Error("sceNpMatching2Init2(): sceNp2 has not been intialized."); - return SCE_NP_ERROR_NOT_INITIALIZED; - } - - if (g_sceNp2->m_bSceNp2Matching2Initialized2) - { - sceNp2.Error("sceNpMatching2Init2(): new sceNpMatching2 has already been intialized."); - return SCE_NP_MATCHING2_ERROR_ALREADY_INITIALIZED; - } - - g_sceNp2->m_bSceNp2Matching2Initialized2 = true; + sceNp2.Todo("sceNpMatching2Init2(poolsize=0x%x, priority=%d, param=*0x%x)", poolsize, priority, param); // TODO: // 1. Create an internal thread @@ -92,14 +50,6 @@ s32 sceNp2Term() { sceNp2.Warning("sceNp2Term()"); - if (!g_sceNp2->m_bSceNp2Initialized) - { - sceNp2.Error("sceNp2Term(): sceNp2 has not been intialized."); - return SCE_NP_ERROR_NOT_INITIALIZED; - } - - g_sceNp2->m_bSceNp2Initialized = false; - return CELL_OK; } @@ -107,20 +57,6 @@ s32 sceNpMatching2Term(PPUThread& ppu) { sceNp2.Warning("sceNpMatching2Term()"); - if (!g_sceNp2->m_bSceNp2Initialized) - { - sceNp2.Error("sceNpMatching2Term(): sceNp2 has not been intialized."); - return SCE_NP_ERROR_NOT_INITIALIZED; - } - - if (!g_sceNp2->m_bSceNp2Matching2Initialized) - { - sceNp2.Error("sceNpMatching2Term(): sceNpMatching2 has not been intialized."); - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - g_sceNp2->m_bSceNp2Matching2Initialized = false; - return CELL_OK; } @@ -128,31 +64,394 @@ s32 sceNpMatching2Term2() { sceNp2.Warning("sceNpMatching2Term2()"); - if (!g_sceNp2->m_bSceNp2Initialized) - { - sceNp2.Error("sceNpMatching2Term2(): sceNp2 has not been intialized."); - return SCE_NP_ERROR_NOT_INITIALIZED; - } - - if (!g_sceNp2->m_bSceNp2Matching2Initialized2) - { - sceNp2.Error("sceNpMatching2Term(): new sceNpMatching2 has not been intialized."); - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - g_sceNp2->m_bSceNp2Matching2Initialized2 = false; - return CELL_OK; } +s32 sceNpMatching2DestroyContext() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2LeaveLobby() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2RegisterLobbyMessageCallback() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetWorldInfoList() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2RegisterLobbyEventCallback() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetLobbyMemberDataInternalList() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SearchRoom() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SignalingGetConnectionStatus() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SetUserInfo() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetClanLobbyId() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetLobbyMemberDataInternal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2ContextStart() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2CreateServerContext() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetMemoryInfo() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2LeaveRoom() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SetRoomDataExternal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SignalingGetConnectionInfo() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SendRoomMessage() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2JoinLobby() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetRoomMemberDataExternalList() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2AbortRequest() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetServerInfo() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetEventData() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetRoomSlotInfoLocal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SendLobbyChatMessage() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2AbortContextStart() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetRoomMemberIdListLocal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2JoinRoom() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetRoomMemberDataInternalLocal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetCbQueueInfo() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2KickoutRoomMember() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2ContextStartAsync() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SetSignalingOptParam() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2RegisterContextCallback() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SendRoomChatMessage() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SetRoomDataInternal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetRoomDataInternal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SignalingGetPingInfo() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetServerIdListLocal() +{ + throw EXCEPTION(""); +} + +s32 sceNpUtilBuildCdnUrl() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GrantRoomOwner() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2CreateContext() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetSignalingOptParamLocal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2RegisterSignalingCallback() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2ClearEventData() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetUserInfoList() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetRoomMemberDataInternal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SetRoomMemberDataInternal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2JoinProhibitiveRoom() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SignalingSetCtxOpt() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2DeleteServerContext() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SetDefaultRequestOptParam() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2RegisterRoomEventCallback() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetRoomPasswordLocal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetRoomDataExternalList() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2CreateJoinRoom() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SignalingGetCtxOpt() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetLobbyInfoList() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2GetLobbyMemberIdListLocal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SendLobbyInvitation() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2ContextStop() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2SetLobbyMemberDataInternal() +{ + throw EXCEPTION(""); +} + +s32 sceNpMatching2RegisterRoomMessageCallback() +{ + throw EXCEPTION(""); +} + + Module sceNp2("sceNp2", []() { - g_sceNp2 = std::make_unique(); - - REG_FUNC(sceNp2, sceNp2Init); - REG_FUNC(sceNp2, sceNpMatching2Init); - REG_FUNC(sceNp2, sceNpMatching2Init2); - REG_FUNC(sceNp2, sceNp2Term); - REG_FUNC(sceNp2, sceNpMatching2Term); + REG_FUNC(sceNp2, sceNpMatching2DestroyContext); + REG_FUNC(sceNp2, sceNpMatching2LeaveLobby); + REG_FUNC(sceNp2, sceNpMatching2RegisterLobbyMessageCallback); + REG_FUNC(sceNp2, sceNpMatching2GetWorldInfoList); + REG_FUNC(sceNp2, sceNpMatching2RegisterLobbyEventCallback); + REG_FUNC(sceNp2, sceNpMatching2GetLobbyMemberDataInternalList); + REG_FUNC(sceNp2, sceNpMatching2SearchRoom); + REG_FUNC(sceNp2, sceNpMatching2SignalingGetConnectionStatus); + REG_FUNC(sceNp2, sceNpMatching2SetUserInfo); + REG_FUNC(sceNp2, sceNpMatching2GetClanLobbyId); + REG_FUNC(sceNp2, sceNpMatching2GetLobbyMemberDataInternal); + REG_FUNC(sceNp2, sceNpMatching2ContextStart); + REG_FUNC(sceNp2, sceNpMatching2CreateServerContext); + REG_FUNC(sceNp2, sceNpMatching2GetMemoryInfo); + REG_FUNC(sceNp2, sceNpMatching2LeaveRoom); + REG_FUNC(sceNp2, sceNpMatching2SetRoomDataExternal); REG_FUNC(sceNp2, sceNpMatching2Term2); -}); \ No newline at end of file + REG_FUNC(sceNp2, sceNpMatching2SignalingGetConnectionInfo); + REG_FUNC(sceNp2, sceNpMatching2SendRoomMessage); + REG_FUNC(sceNp2, sceNpMatching2JoinLobby); + REG_FUNC(sceNp2, sceNpMatching2GetRoomMemberDataExternalList); + REG_FUNC(sceNp2, sceNpMatching2AbortRequest); + REG_FUNC(sceNp2, sceNpMatching2Term); + REG_FUNC(sceNp2, sceNpMatching2GetServerInfo); + REG_FUNC(sceNp2, sceNpMatching2GetEventData); + REG_FUNC(sceNp2, sceNpMatching2GetRoomSlotInfoLocal); + REG_FUNC(sceNp2, sceNpMatching2SendLobbyChatMessage); + REG_FUNC(sceNp2, sceNpMatching2Init); + REG_FUNC(sceNp2, sceNp2Init); + REG_FUNC(sceNp2, sceNpMatching2AbortContextStart); + REG_FUNC(sceNp2, sceNpMatching2GetRoomMemberIdListLocal); + REG_FUNC(sceNp2, sceNpMatching2JoinRoom); + REG_FUNC(sceNp2, sceNpMatching2GetRoomMemberDataInternalLocal); + REG_FUNC(sceNp2, sceNpMatching2GetCbQueueInfo); + REG_FUNC(sceNp2, sceNpMatching2KickoutRoomMember); + REG_FUNC(sceNp2, sceNpMatching2ContextStartAsync); + REG_FUNC(sceNp2, sceNpMatching2SetSignalingOptParam); + REG_FUNC(sceNp2, sceNpMatching2RegisterContextCallback); + REG_FUNC(sceNp2, sceNpMatching2SendRoomChatMessage); + REG_FUNC(sceNp2, sceNpMatching2SetRoomDataInternal); + REG_FUNC(sceNp2, sceNpMatching2GetRoomDataInternal); + REG_FUNC(sceNp2, sceNpMatching2SignalingGetPingInfo); + REG_FUNC(sceNp2, sceNpMatching2GetServerIdListLocal); + REG_FUNC(sceNp2, sceNpUtilBuildCdnUrl); + REG_FUNC(sceNp2, sceNpMatching2GrantRoomOwner); + REG_FUNC(sceNp2, sceNpMatching2CreateContext); + REG_FUNC(sceNp2, sceNpMatching2GetSignalingOptParamLocal); + REG_FUNC(sceNp2, sceNpMatching2RegisterSignalingCallback); + REG_FUNC(sceNp2, sceNpMatching2ClearEventData); + REG_FUNC(sceNp2, sceNp2Term); + REG_FUNC(sceNp2, sceNpMatching2GetUserInfoList); + REG_FUNC(sceNp2, sceNpMatching2GetRoomMemberDataInternal); + REG_FUNC(sceNp2, sceNpMatching2SetRoomMemberDataInternal); + REG_FUNC(sceNp2, sceNpMatching2JoinProhibitiveRoom); + REG_FUNC(sceNp2, sceNpMatching2SignalingSetCtxOpt); + REG_FUNC(sceNp2, sceNpMatching2DeleteServerContext); + REG_FUNC(sceNp2, sceNpMatching2SetDefaultRequestOptParam); + REG_FUNC(sceNp2, sceNpMatching2RegisterRoomEventCallback); + REG_FUNC(sceNp2, sceNpMatching2GetRoomPasswordLocal); + REG_FUNC(sceNp2, sceNpMatching2GetRoomDataExternalList); + REG_FUNC(sceNp2, sceNpMatching2CreateJoinRoom); + REG_FUNC(sceNp2, sceNpMatching2SignalingGetCtxOpt); + REG_FUNC(sceNp2, sceNpMatching2GetLobbyInfoList); + REG_FUNC(sceNp2, sceNpMatching2GetLobbyMemberIdListLocal); + REG_FUNC(sceNp2, sceNpMatching2SendLobbyInvitation); + REG_FUNC(sceNp2, sceNpMatching2ContextStop); + REG_FUNC(sceNp2, sceNpMatching2Init2); + REG_FUNC(sceNp2, sceNpMatching2SetLobbyMemberDataInternal); + REG_FUNC(sceNp2, sceNpMatching2RegisterRoomMessageCallback); +}); diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpClans.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpClans.cpp index 5dd7c04f76..e046f3403e 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpClans.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpClans.cpp @@ -8,24 +8,15 @@ extern Module sceNpClans; -std::unique_ptr g_sceNpClans; - s32 sceNpClansInit(vm::ptr commId, vm::ptr passphrase, vm::ptr pool, vm::ptr poolSize, u32 flags) { sceNpClans.Warning("sceNpClansInit(commId=*0x%x, passphrase=*0x%x, pool=*0x%x, poolSize=*0x%x, flags=0x%x)", commId, passphrase, pool, poolSize, flags); - if (g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_ALREADY_INITIALIZED; - } - if (flags != 0) { return SCE_NP_CLANS_ERROR_NOT_SUPPORTED; } - g_sceNpClans->m_bSceNpClansInitialized = true; - return CELL_OK; } @@ -33,13 +24,6 @@ s32 sceNpClansTerm() { sceNpClans.Warning("sceNpClansTerm()"); - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - - g_sceNpClans->m_bSceNpClansInitialized = false; - return CELL_OK; } @@ -47,11 +31,6 @@ s32 sceNpClansCreateRequest(vm::ptr handle, u64 flags) { sceNpClans.Todo("sceNpClansCreateRequest(handle=*0x%x, flags=0x%llx)", handle, flags); - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - if (flags != 0) { return SCE_NP_CLANS_ERROR_NOT_SUPPORTED; @@ -63,444 +42,221 @@ s32 sceNpClansCreateRequest(vm::ptr handle, u64 flags) s32 sceNpClansDestroyRequest(vm::ptr handle) { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansAbortRequest(vm::ptr handle) { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansCreateClan(vm::ptr handle, vm::cptr name, vm::cptr tag, vm::ptr clanId) { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansDisbandClan(vm::ptr handle, u32 clanId) { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansGetClanList(vm::ptr handle, vm::cptr paging, vm::ptr clanList, vm::ptr pageResult) { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansGetClanListByNpId() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansSearchByProfile() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansSearchByName() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansGetClanInfo() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansUpdateClanInfo() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansGetMemberList() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansGetMemberInfo() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansUpdateMemberInfo() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansChangeMemberRole() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansGetAutoAcceptStatus() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansUpdateAutoAcceptStatus() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansJoinClan() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansLeaveClan() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansKickMember(vm::ptr handle, u32 clanId, vm::ptr npid, vm::ptr message) { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansSendInvitation(vm::ptr handle, u32 clanId, vm::ptr npid, vm::ptr message) { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansCancelInvitation() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } -s32 sceNpClansSendInvitationResponse(vm::ptr handle, u32 clanId, vm::ptr message, bool accept) +s32 sceNpClansSendInvitationResponse(vm::ptr handle, u32 clanId, vm::ptr message, b8 accept) { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansSendMembershipRequest(vm::ptr handle, u32 clanId, vm::ptr message) { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansCancelMembershipRequest() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansSendMembershipResponse() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansGetBlacklist() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansAddBlacklistEntry() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansRemoveBlacklistEntry() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansRetrieveAnnouncements() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansPostAnnouncement() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansRemoveAnnouncement() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansPostChallenge(vm::ptr handle, u32 clanId, u32 targetClan, vm::ptr message, vm::ptr data, u32 duration, vm::ptr mId) { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - - if (data) - { - return SCE_NP_CLANS_ERROR_NOT_SUPPORTED; - } - return CELL_OK; } s32 sceNpClansRetrievePostedChallenges() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansRemovePostedChallenge() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansRetrieveChallenges() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpClansRemoveChallenge() { UNIMPLEMENTED_FUNC(sceNpClans); - - if (!g_sceNpClans->m_bSceNpClansInitialized) - { - return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } Module sceNpClans("sceNpClans", []() { - g_sceNpClans = std::make_unique(); - REG_FUNC(sceNpClans, sceNpClansInit); REG_FUNC(sceNpClans, sceNpClansTerm); REG_FUNC(sceNpClans, sceNpClansCreateRequest); diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpClans.h b/rpcs3/Emu/SysCalls/Modules/sceNpClans.h index aacd12f3d4..11ce289c75 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpClans.h +++ b/rpcs3/Emu/SysCalls/Modules/sceNpClans.h @@ -60,18 +60,6 @@ enum SCE_NP_CLANS_SERVER_ERROR_FAILED_TO_SEND_NP_MESSAGE = 0x8002284c, }; -struct SceNpClansInternal -{ - bool m_bSceNpClansInitialized; - - SceNpClansInternal() - : m_bSceNpClansInitialized(false) - { - } -}; - -extern SceNpClansInternal* sceNpClansInstance; - // Clan roles enum { @@ -154,7 +142,7 @@ struct SceNpClansEntry SceNpClansClanBasicInfo info; be_t role; be_t status; - bool allowMsg; + b8 allowMsg; u8 reserved[3]; }; @@ -219,7 +207,7 @@ struct SceNpClansUpdatableMemberInfo be_t binData1Size; u8 binAttr1[SCE_NP_CLANS_CLAN_BINARY_ATTRIBUTE1_MAX_SIZE + 1]; s8 description[SCE_NP_CLANS_MEMBER_DESCRIPTION_MAX_LENGTH + 1]; - bool allowMsg; + b8 allowMsg; u8 reserved[3]; }; @@ -263,4 +251,4 @@ struct SceNpClansBlacklistEntry { SceNpId entry; SceNpId registeredBy; -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.cpp index ce8dad36ca..06623bf0f4 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.cpp @@ -6,8 +6,6 @@ extern Module sceNpCommerce2; -std::unique_ptr g_sceNpCommerce2; - s32 sceNpCommerce2ExecuteStoreBrowse() { UNIMPLEMENTED_FUNC(sceNpCommerce2); @@ -24,13 +22,6 @@ s32 sceNpCommerce2Init() { sceNpCommerce2.Warning("sceNpCommerce2Init()"); - if (g_sceNpCommerce2->m_bSceNpCommerce2Initialized) - { - return SCE_NP_COMMERCE2_ERROR_ALREADY_INITIALIZED; - } - - g_sceNpCommerce2->m_bSceNpCommerce2Initialized = true; - return CELL_OK; } @@ -38,13 +29,6 @@ s32 sceNpCommerce2Term() { sceNpCommerce2.Warning("sceNpCommerce2Term()"); - if (!g_sceNpCommerce2->m_bSceNpCommerce2Initialized) - { - return SCE_NP_COMMERCE2_ERROR_NOT_INITIALIZED; - } - - g_sceNpCommerce2->m_bSceNpCommerce2Initialized = false; - return CELL_OK; } @@ -60,6 +44,21 @@ s32 sceNpCommerce2DestroyCtx() return CELL_OK; } +s32 sceNpCommerce2EmptyStoreCheckStart() +{ + throw EXCEPTION(""); +} + +s32 sceNpCommerce2EmptyStoreCheckAbort() +{ + throw EXCEPTION(""); +} + +s32 sceNpCommerce2EmptyStoreCheckFinish() +{ + throw EXCEPTION(""); +} + s32 sceNpCommerce2CreateSessionStart() { UNIMPLEMENTED_FUNC(sceNpCommerce2); @@ -306,16 +305,27 @@ s32 sceNpCommerce2DestroyReq() return CELL_OK; } +s32 sceNpCommerce2DoServiceListStartAsync() +{ + throw EXCEPTION(""); +} + +s32 sceNpCommerce2DoServiceListFinishAsync() +{ + throw EXCEPTION(""); +} + Module sceNpCommerce2("sceNpCommerce2", []() { - g_sceNpCommerce2 = std::make_unique(); - REG_FUNC(sceNpCommerce2, sceNpCommerce2ExecuteStoreBrowse); REG_FUNC(sceNpCommerce2, sceNpCommerce2GetStoreBrowseUserdata); REG_FUNC(sceNpCommerce2, sceNpCommerce2Init); REG_FUNC(sceNpCommerce2, sceNpCommerce2Term); REG_FUNC(sceNpCommerce2, sceNpCommerce2CreateCtx); REG_FUNC(sceNpCommerce2, sceNpCommerce2DestroyCtx); + REG_FUNC(sceNpCommerce2, sceNpCommerce2EmptyStoreCheckStart); + REG_FUNC(sceNpCommerce2, sceNpCommerce2EmptyStoreCheckAbort); + REG_FUNC(sceNpCommerce2, sceNpCommerce2EmptyStoreCheckFinish); REG_FUNC(sceNpCommerce2, sceNpCommerce2CreateSessionStart); REG_FUNC(sceNpCommerce2, sceNpCommerce2CreateSessionAbort); REG_FUNC(sceNpCommerce2, sceNpCommerce2CreateSessionFinish); @@ -357,4 +367,7 @@ Module sceNpCommerce2("sceNpCommerce2", []() REG_FUNC(sceNpCommerce2, sceNpCommerce2SetBGDLAvailability); REG_FUNC(sceNpCommerce2, sceNpCommerce2AbortReq); REG_FUNC(sceNpCommerce2, sceNpCommerce2DestroyReq); + + REG_FUNC(sceNpCommerce2, sceNpCommerce2DoServiceListStartAsync); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DoServiceListFinishAsync); }); diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.h b/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.h index 06760d7d4d..2b97705e05 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.h +++ b/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.h @@ -132,18 +132,6 @@ enum SCE_NP_COMMERCE2_DO_PRODUCT_CODE_MEMORY_CONTAINER_SIZE = 16777216, }; -struct SceNpCommerce2Internal -{ - bool m_bSceNpCommerce2Initialized; - - SceNpCommerce2Internal() - : m_bSceNpCommerce2Initialized(false) - { - } -}; - -extern std::unique_ptr g_sceNpCommerce2; - // Common structure used when receiving data struct SceNpCommerce2CommonData { @@ -171,7 +159,7 @@ struct SceNpCommerce2SessionInfo be_t decimals; s8 currencySymbol[SCE_NP_COMMERCE2_CURRENCY_SYMBOL_LEN + 1]; be_t symbolPosition; - bool symbolWithSpace; + b8 symbolWithSpace; u8 padding1[3]; s8 thousandSeparator[SCE_NP_COMMERCE2_THOUSAND_SEPARATOR_LEN + 1]; s8 decimalLetter[SCE_NP_COMMERCE2_DECIMAL_LETTER_LEN + 1]; @@ -259,7 +247,7 @@ struct SceNpCommerce2GameSkuInfo be_t timeUntilExpiration; be_t purchasabilityFlag; be_t annotation; - bool downloadable; + b8 downloadable; u8 padding[3]; be_t price; s8 skuName; @@ -288,4 +276,4 @@ struct SceNpCommerce2ProductCodeParam s8 padding3[3]; }; -typedef void(*SceNpCommerce2Handler)(u32 ctx_id, u32 subject_id, s32 event, s32 error_code, u32 arg); +using SceNpCommerce2Handler = void(u32 ctx_id, u32 subject_id, s32 event, s32 error_code, vm::ptr arg); diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpSns.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpSns.cpp index 914cca991e..ec50fc3a4e 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpSns.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpSns.cpp @@ -5,18 +5,9 @@ extern Module sceNpSns; -std::unique_ptr g_sceNpSns; - -s32 sceNpSnsFbInit(/*const SceNpSnsFbInitParams params*/) +s32 sceNpSnsFbInit(vm::ptr params) { - sceNpSns.Todo("sceNpSnsFbInit(params=?)"/*, params*/); - - if (g_sceNpSns->m_bSceNpSnsInitialized) - { - return SCE_NP_SNS_FB_ERROR_ALREADY_INITIALIZED; - } - - g_sceNpSns->m_bSceNpSnsInitialized = true; + sceNpSns.Todo("sceNpSnsFbInit(params=*0x%x)", params); // TODO: Use the initialization parameters somewhere @@ -27,72 +18,65 @@ s32 sceNpSnsFbTerm() { sceNpSns.Warning("sceNpSnsFbTerm()"); - if (!g_sceNpSns->m_bSceNpSnsInitialized) - { - return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; - } - - g_sceNpSns->m_bSceNpSnsInitialized = false; - return CELL_OK; } s32 sceNpSnsFbCreateHandle() { UNIMPLEMENTED_FUNC(sceNpSns); - - if (!g_sceNpSns->m_bSceNpSnsInitialized) - { - return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpSnsFbDestroyHandle() { UNIMPLEMENTED_FUNC(sceNpSns); - - if (!g_sceNpSns->m_bSceNpSnsInitialized) - { - return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpSnsFbAbortHandle() { UNIMPLEMENTED_FUNC(sceNpSns); - - if (!g_sceNpSns->m_bSceNpSnsInitialized) - { - return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpSnsFbGetAccessToken() { UNIMPLEMENTED_FUNC(sceNpSns); - - if (!g_sceNpSns->m_bSceNpSnsInitialized) - { - return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } +s32 sceNpSnsFbStreamPublish() +{ + throw EXCEPTION(""); +} + +s32 sceNpSnsFbCheckThrottle() +{ + throw EXCEPTION(""); +} + +s32 sceNpSnsFbCheckConfig() +{ + throw EXCEPTION(""); +} + +s32 sceNpSnsFbLoadThrottle() +{ + throw EXCEPTION(""); +} + + Module sceNpSns("sceNpSns", []() { - g_sceNpSns = std::make_unique(); - REG_FUNC(sceNpSns, sceNpSnsFbInit); REG_FUNC(sceNpSns, sceNpSnsFbTerm); REG_FUNC(sceNpSns, sceNpSnsFbCreateHandle); REG_FUNC(sceNpSns, sceNpSnsFbDestroyHandle); REG_FUNC(sceNpSns, sceNpSnsFbAbortHandle); REG_FUNC(sceNpSns, sceNpSnsFbGetAccessToken); + + REG_FUNC(sceNpSns, sceNpSnsFbStreamPublish); + REG_FUNC(sceNpSns, sceNpSnsFbCheckThrottle); + REG_FUNC(sceNpSns, sceNpSnsFbCheckConfig); + REG_FUNC(sceNpSns, sceNpSnsFbLoadThrottle); }); diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpSns.h b/rpcs3/Emu/SysCalls/Modules/sceNpSns.h index 212d700d17..b8510669d0 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpSns.h +++ b/rpcs3/Emu/SysCalls/Modules/sceNpSns.h @@ -25,18 +25,6 @@ enum SCE_NP_SNS_FB_ERROR_ACCESS_NOT_ALLOWED = 0x8002451c, }; -struct SceNpSnsInternal -{ - bool m_bSceNpSnsInitialized; - - SceNpSnsInternal() - : m_bSceNpSnsInitialized(false) - { - } -}; - -extern std::unique_ptr g_sceNpSns; - // Constants for SNS functions enum { @@ -47,6 +35,6 @@ enum // Intilization parameters for functionalities coordinated with Facebook struct SceNpSnsFbInitParams { - be_t pool; + vm::bptr pool; be_t poolSize; -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp index 3a501249ee..7e8d2e4a71 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp @@ -40,20 +40,11 @@ struct trophy_handle_t } }; -std::unique_ptr g_sceNpTrophy; - // Functions s32 sceNpTrophyInit(vm::ptr pool, u32 poolSize, u32 containerId, u64 options) { sceNpTrophy.Warning("sceNpTrophyInit(pool=*0x%x, poolSize=0x%x, containerId=0x%x, options=0x%llx)", pool, poolSize, containerId, options); - if (g_sceNpTrophy->m_bInitialized) - { - return SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED; - } - - g_sceNpTrophy->m_bInitialized = true; - return CELL_OK; } @@ -61,13 +52,6 @@ s32 sceNpTrophyTerm() { sceNpTrophy.Warning("sceNpTrophyTerm()"); - if (!g_sceNpTrophy->m_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - - g_sceNpTrophy->m_bInitialized = false; - return CELL_OK; } @@ -75,11 +59,6 @@ s32 sceNpTrophyCreateHandle(vm::ptr handle) { sceNpTrophy.Warning("sceNpTrophyCreateHandle(handle=*0x%x)", handle); - if (!g_sceNpTrophy->m_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - if (!handle) { return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT; @@ -94,11 +73,6 @@ s32 sceNpTrophyDestroyHandle(u32 handle) { sceNpTrophy.Warning("sceNpTrophyDestroyHandle(handle=0x%x)", handle); - if (!g_sceNpTrophy->m_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - const auto hndl = Emu.GetIdManager().get(handle); if (!hndl) @@ -115,11 +89,6 @@ s32 sceNpTrophyAbortHandle(u32 handle) { sceNpTrophy.Todo("sceNpTrophyAbortHandle(handle=0x%x)", handle); - if (!g_sceNpTrophy->m_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - const auto hndl = Emu.GetIdManager().get(handle); if (!hndl) @@ -134,11 +103,6 @@ s32 sceNpTrophyCreateContext(vm::ptr context, vm::cptrm_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - // rough checks for further fmt::format call if (commId->term || commId->num > 99) { @@ -172,11 +136,6 @@ s32 sceNpTrophyDestroyContext(u32 context) { sceNpTrophy.Warning("sceNpTrophyDestroyContext(context=0x%x)", context); - if (!g_sceNpTrophy->m_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - const auto ctxt = Emu.GetIdManager().get(context); if (!ctxt) @@ -193,11 +152,6 @@ s32 sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr< { sceNpTrophy.Error("sceNpTrophyRegisterContext(context=0x%x, handle=0x%x, statusCb=*0x%x, arg=*0x%x, options=0x%llx)", context, handle, statusCb, arg, options); - if (!g_sceNpTrophy->m_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - const auto ctxt = Emu.GetIdManager().get(context); if (!ctxt) @@ -278,11 +232,6 @@ s32 sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr reqspa { sceNpTrophy.Todo("sceNpTrophyGetRequiredDiskSpace(context=0x%x, handle=0x%x, reqspace*=0x%x, options=0x%llx)", context, handle, reqspace, options); - if (!g_sceNpTrophy->m_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - const auto ctxt = Emu.GetIdManager().get(context); if (!ctxt) @@ -307,11 +256,6 @@ s32 sceNpTrophySetSoundLevel(u32 context, u32 handle, u32 level, u64 options) { sceNpTrophy.Todo("sceNpTrophySetSoundLevel(context=0x%x, handle=0x%x, level=%d, options=0x%llx)", context, handle, level, options); - if (!g_sceNpTrophy->m_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } @@ -319,11 +263,6 @@ s32 sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptrm_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - const auto ctxt = Emu.GetIdManager().get(context); if (!ctxt) @@ -385,11 +324,6 @@ s32 sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptr { sceNpTrophy.Error("sceNpTrophyUnlockTrophy(context=0x%x, handle=0x%x, trophyId=%d, platinumId=*0x%x)", context, handle, trophyId, platinumId); - if (!g_sceNpTrophy->m_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - const auto ctxt = Emu.GetIdManager().get(context); if (!ctxt) @@ -421,11 +355,6 @@ s32 sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptrm_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - const auto ctxt = Emu.GetIdManager().get(context); if (!ctxt) @@ -461,11 +390,6 @@ s32 sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptrm_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - const auto ctxt = Emu.GetIdManager().get(context); if (!ctxt) @@ -523,11 +447,6 @@ s32 sceNpTrophyGetGameProgress(u32 context, u32 handle, vm::ptr percentage) { sceNpTrophy.Todo("sceNpTrophyGetGameProgress(context=0x%x, handle=0x%x, percentage=*0x%x)", context, handle, percentage); - if (!g_sceNpTrophy->m_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } @@ -535,11 +454,6 @@ s32 sceNpTrophyGetGameIcon(u32 context, u32 handle, vm::ptr buffer, vm::pt { sceNpTrophy.Todo("sceNpTrophyGetGameIcon(context=0x%x, handle=0x%x, buffer=*0x%x, size=*0x%x)", context, handle, buffer, size); - if (!g_sceNpTrophy->m_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } @@ -547,19 +461,12 @@ s32 sceNpTrophyGetTrophyIcon(u32 context, u32 handle, s32 trophyId, vm::ptrm_bInitialized) - { - return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } Module sceNpTrophy("sceNpTrophy", []() { - g_sceNpTrophy = std::make_unique(); - REG_FUNC(sceNpTrophy, sceNpTrophyGetGameProgress); REG_FUNC(sceNpTrophy, sceNpTrophyRegisterContext); REG_FUNC(sceNpTrophy, sceNpTrophyCreateHandle); diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h index d9efc9236f..9d9234af56 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h @@ -75,18 +75,6 @@ enum SceNpTrophyGrade SCE_NP_TROPHY_GRADE_BRONZE = 4, }; -struct SceNpTrophyInternal -{ - bool m_bInitialized; - - SceNpTrophyInternal() - : m_bInitialized(false) - { - } -}; - -extern std::unique_ptr g_sceNpTrophy; - struct SceNpTrophyGameDetails { be_t numTrophies; @@ -148,4 +136,4 @@ enum SCE_NP_TROPHY_STATUS_CHANGES_DETECTED = 9, }; -using SceNpTrophyStatusCallback = func_def arg)>; +using SceNpTrophyStatusCallback = s32(u32 context, u32 status, s32 completed, s32 total, vm::ptr arg); diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTus.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpTus.cpp index 7fd48ecee0..10abfcbd4a 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTus.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTus.cpp @@ -7,32 +7,16 @@ extern Module sceNpTus; -std::unique_ptr g_sceNpTus; - s32 sceNpTusInit() { sceNpTus.Warning("sceNpTusInit()"); - if (g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED; - } - - g_sceNpTus->m_bSceNpTusInitialized = true; - return CELL_OK; } s32 sceNpTusTerm() { sceNpTus.Warning("sceNpTusTerm()"); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - - g_sceNpTus->m_bSceNpTusInitialized = false; return CELL_OK; } @@ -40,631 +24,317 @@ s32 sceNpTusTerm() s32 sceNpTusCreateTitleCtx() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusDestroyTitleCtx() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusCreateTransactionCtx() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusDestroyTransactionCtx() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusSetTimeout() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusAbortTransaction() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusWaitAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusPollAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusSetMultiSlotVariable() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusSetMultiSlotVariableVUser() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusSetMultiSlotVariableAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusSetMultiSlotVariableVUserAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiSlotVariable() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiSlotVariableVUser() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiSlotVariableAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiSlotVariableVUserAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiUserVariable() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiUserVariableVUser() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiUserVariableAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiUserVariableVUserAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusAddAndGetVariable() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusAddAndGetVariableVUser() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusAddAndGetVariableAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusAddAndGetVariableVUserAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusTryAndSetVariable() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusTryAndSetVariableVUser() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusTryAndSetVariableAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusTryAndSetVariableVUserAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusDeleteMultiSlotVariable() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusDeleteMultiSlotVariableVUser() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusDeleteMultiSlotVariableAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusDeleteMultiSlotVariableVUserAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusSetData() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusSetDataVUser() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusSetDataAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusSetDataVUserAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetData() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetDataVUser() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetDataAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetDataVUserAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiSlotDataStatus() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiSlotDataStatusVUser() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiSlotDataStatusAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiSlotDataStatusVUserAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiUserDataStatus() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiUserDataStatusVUser() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiUserDataStatusAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusGetMultiUserDataStatusVUserAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusDeleteMultiSlotData() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusDeleteMultiSlotDataVUser() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusDeleteMultiSlotDataAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpTusDeleteMultiSlotDataVUserAsync() { UNIMPLEMENTED_FUNC(sceNpTus); - - if (!g_sceNpTus->m_bSceNpTusInitialized) - { - return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } Module sceNpTus("sceNpTus", []() { - g_sceNpTus = std::make_unique(); - REG_FUNC(sceNpTus, sceNpTusInit); REG_FUNC(sceNpTus, sceNpTusTerm); REG_FUNC(sceNpTus, sceNpTusCreateTitleCtx); diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTus.h b/rpcs3/Emu/SysCalls/Modules/sceNpTus.h index 446526242e..26c7dffeb2 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTus.h +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTus.h @@ -13,18 +13,6 @@ enum SCE_NP_TUS_MAX_USER_NUM_PER_TRANS = 101, }; -struct SceNpTusInternal -{ - bool m_bSceNpTusInitialized; - - SceNpTusInternal() - : m_bSceNpTusInitialized(false) - { - } -}; - -extern std::unique_ptr g_sceNpTus; - SceNpOnlineId SceNpTusVirtualUserId; // Structure for representing a TUS variable diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpUtil.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpUtil.cpp index 5bf622736c..fa8802bff2 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpUtil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpUtil.cpp @@ -7,80 +7,34 @@ extern Module sceNpUtil; -std::unique_ptr g_sceNpUtil; - -s32 sceNpUtilCmpNpId() -{ - UNIMPLEMENTED_FUNC(sceNpUtil); - return CELL_OK; -} - -s32 sceNpUtilCmpNpIdInOrder() -{ - UNIMPLEMENTED_FUNC(sceNpUtil); - return CELL_OK; -} - s32 sceNpUtilBandwidthTestInitStart(u32 prio, size_t stack) { UNIMPLEMENTED_FUNC(sceNpUtil); - - if (g_sceNpUtil->m_bSceNpUtilBandwidthTestInitialized) - { - return SCE_NP_ERROR_ALREADY_INITIALIZED; - } - - g_sceNpUtil->m_bSceNpUtilBandwidthTestInitialized = true; - return CELL_OK; } s32 sceNpUtilBandwidthTestGetStatus() { UNIMPLEMENTED_FUNC(sceNpUtil); - - if (!g_sceNpUtil->m_bSceNpUtilBandwidthTestInitialized) - { - return SCE_NP_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } s32 sceNpUtilBandwidthTestShutdown() { UNIMPLEMENTED_FUNC(sceNpUtil); - - if (!g_sceNpUtil->m_bSceNpUtilBandwidthTestInitialized) - { - return SCE_NP_ERROR_NOT_INITIALIZED; - } - - g_sceNpUtil->m_bSceNpUtilBandwidthTestInitialized = false; - return CELL_OK; } s32 sceNpUtilBandwidthTestAbort() { UNIMPLEMENTED_FUNC(sceNpUtil); - - if (!g_sceNpUtil->m_bSceNpUtilBandwidthTestInitialized) - { - return SCE_NP_ERROR_NOT_INITIALIZED; - } - return CELL_OK; } Module sceNpUtil("sceNpUtil", []() { - g_sceNpUtil = std::make_unique(); - REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestInitStart); REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestShutdown); - REG_FUNC(sceNpUtil, sceNpUtilCmpNpId); - REG_FUNC(sceNpUtil, sceNpUtilCmpNpIdInOrder); REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestGetStatus); REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestAbort); -}); \ No newline at end of file +}); diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpUtil.h b/rpcs3/Emu/SysCalls/Modules/sceNpUtil.h index 2dfa44ec13..6f70f09bee 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpUtil.h +++ b/rpcs3/Emu/SysCalls/Modules/sceNpUtil.h @@ -1,13 +1 @@ #pragma once - -struct SceNpUtilInternal -{ - bool m_bSceNpUtilBandwidthTestInitialized; - - SceNpUtilInternal() - : m_bSceNpUtilBandwidthTestInitialized(false) - { - } -}; - -extern std::unique_ptr g_sceNpUtil; \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp index 556bb0d6c4..59fd592c15 100644 --- a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp @@ -1,23 +1,10 @@ #include "stdafx.h" -#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/IdManager.h" #include "Emu/SysCalls/Modules.h" -#include "Emu/FS/vfsFile.h" -#include "Emu/SysCalls/lv2/sleep_queue.h" #include "Emu/SysCalls/lv2/sys_interrupt.h" -#include "Emu/SysCalls/lv2/sys_spu.h" -#include "Emu/SysCalls/lv2/sys_lwmutex.h" -#include "Emu/SysCalls/lv2/sys_prx.h" -#include "Emu/SysCalls/lv2/sys_ppu_thread.h" #include "Emu/SysCalls/lv2/sys_process.h" -#include "Emu/SysCalls/lv2/sys_mmapper.h" -#include "Emu/SysCalls/lv2/sys_lwcond.h" -#include "Loader/ELF32.h" -#include "Crypto/unself.h" -#include "Emu/Cell/RawSPUThread.h" #include "sysPrxForUser.h" extern Module sysPrxForUser; @@ -88,544 +75,6 @@ void ppu_free_tls(u32 thread) } } -s32 sys_lwmutex_create(vm::ptr lwmutex, vm::ptr attr) -{ - sysPrxForUser.Warning("sys_lwmutex_create(lwmutex=*0x%x, attr=*0x%x)", lwmutex, attr); - - const bool recursive = attr->recursive == SYS_SYNC_RECURSIVE; - - if (!recursive && attr->recursive != SYS_SYNC_NOT_RECURSIVE) - { - sysPrxForUser.Error("sys_lwmutex_create(): invalid recursive attribute (0x%x)", attr->recursive); - return CELL_EINVAL; - } - - const u32 protocol = attr->protocol; - - switch (protocol) - { - case SYS_SYNC_FIFO: break; - case SYS_SYNC_RETRY: break; - case SYS_SYNC_PRIORITY: break; - default: sysPrxForUser.Error("sys_lwmutex_create(): invalid protocol (0x%x)", protocol); return CELL_EINVAL; - } - - lwmutex->lock_var = { { lwmutex_free, 0 } }; - lwmutex->attribute = attr->recursive | attr->protocol; - lwmutex->recursive_count = 0; - lwmutex->sleep_queue = Emu.GetIdManager().make(protocol, attr->name_u64); - - return CELL_OK; -} - -s32 sys_lwmutex_destroy(PPUThread& ppu, vm::ptr lwmutex) -{ - sysPrxForUser.Log("sys_lwmutex_destroy(lwmutex=*0x%x)", lwmutex); - - // check to prevent recursive locking in the next call - if (lwmutex->vars.owner.load() == ppu.get_id()) - { - return CELL_EBUSY; - } - - // attempt to lock the mutex - if (s32 res = sys_lwmutex_trylock(ppu, lwmutex)) - { - return res; - } - - // call the syscall - if (s32 res = _sys_lwmutex_destroy(lwmutex->sleep_queue)) - { - // unlock the mutex if failed - sys_lwmutex_unlock(ppu, lwmutex); - - return res; - } - - // deleting succeeded - lwmutex->vars.owner.exchange(lwmutex_dead); - - return CELL_OK; -} - -s32 sys_lwmutex_lock(PPUThread& ppu, vm::ptr lwmutex, u64 timeout) -{ - sysPrxForUser.Log("sys_lwmutex_lock(lwmutex=*0x%x, timeout=0x%llx)", lwmutex, timeout); - - const be_t tid = ppu.get_id(); - - // try to lock lightweight mutex - const be_t old_owner = lwmutex->vars.owner.compare_and_swap(lwmutex_free, tid); - - if (old_owner == lwmutex_free) - { - // locking succeeded - return CELL_OK; - } - - if (old_owner.data() == tid.data()) - { - // recursive locking - - if ((lwmutex->attribute & SYS_SYNC_RECURSIVE) == 0) - { - // if not recursive - return CELL_EDEADLK; - } - - if (lwmutex->recursive_count.data() == -1) - { - // if recursion limit reached - return CELL_EKRESOURCE; - } - - // recursive locking succeeded - lwmutex->recursive_count++; - _mm_mfence(); - - return CELL_OK; - } - - if (old_owner == lwmutex_dead) - { - // invalid or deleted mutex - return CELL_EINVAL; - } - - for (u32 i = 0; i < 300; i++) - { - if (lwmutex->vars.owner.load() == lwmutex_free) - { - if (lwmutex->vars.owner.compare_and_swap_test(lwmutex_free, tid)) - { - // locking succeeded - return CELL_OK; - } - } - } - - // atomically increment waiter value using 64 bit op - lwmutex->all_info++; - - if (lwmutex->vars.owner.compare_and_swap_test(lwmutex_free, tid)) - { - // locking succeeded - lwmutex->all_info--; - - return CELL_OK; - } - - // lock using the syscall - const s32 res = _sys_lwmutex_lock(ppu, lwmutex->sleep_queue, timeout); - - lwmutex->all_info--; - - if (res == CELL_OK) - { - // locking succeeded - auto old = lwmutex->vars.owner.exchange(tid); - - if (old != lwmutex_reserved) - { - throw EXCEPTION("Locking failed (lwmutex=*0x%x, owner=0x%x)", lwmutex, old); - } - - return CELL_OK; - } - - if (res == CELL_EBUSY && lwmutex->attribute & SYS_SYNC_RETRY) - { - // TODO (protocol is ignored in current implementation) - throw EXCEPTION(""); - } - - return res; -} - -s32 sys_lwmutex_trylock(PPUThread& ppu, vm::ptr lwmutex) -{ - sysPrxForUser.Log("sys_lwmutex_trylock(lwmutex=*0x%x)", lwmutex); - - const be_t tid = ppu.get_id(); - - // try to lock lightweight mutex - const be_t old_owner = lwmutex->vars.owner.compare_and_swap(lwmutex_free, tid); - - if (old_owner == lwmutex_free) - { - // locking succeeded - return CELL_OK; - } - - if (old_owner.data() == tid.data()) - { - // recursive locking - - if ((lwmutex->attribute & SYS_SYNC_RECURSIVE) == 0) - { - // if not recursive - return CELL_EDEADLK; - } - - if (lwmutex->recursive_count.data() == -1) - { - // if recursion limit reached - return CELL_EKRESOURCE; - } - - // recursive locking succeeded - lwmutex->recursive_count++; - _mm_mfence(); - - return CELL_OK; - } - - if (old_owner == lwmutex_dead) - { - // invalid or deleted mutex - return CELL_EINVAL; - } - - if (old_owner == lwmutex_reserved) - { - // should be locked by the syscall - const s32 res = _sys_lwmutex_trylock(lwmutex->sleep_queue); - - if (res == CELL_OK) - { - // locking succeeded - auto old = lwmutex->vars.owner.exchange(tid); - - if (old != lwmutex_reserved) - { - throw EXCEPTION("Locking failed (lwmutex=*0x%x, owner=0x%x)", lwmutex, old); - } - } - - return res; - } - - // locked by another thread - return CELL_EBUSY; -} - -s32 sys_lwmutex_unlock(PPUThread& ppu, vm::ptr lwmutex) -{ - sysPrxForUser.Log("sys_lwmutex_unlock(lwmutex=*0x%x)", lwmutex); - - const be_t tid = ppu.get_id(); - - // check owner - if (lwmutex->vars.owner.load() != tid) - { - return CELL_EPERM; - } - - if (lwmutex->recursive_count.data()) - { - // recursive unlocking succeeded - lwmutex->recursive_count--; - - return CELL_OK; - } - - // ensure that waiter is zero - if (lwmutex->lock_var.compare_and_swap_test({ tid, 0 }, { lwmutex_free, 0 })) - { - // unlocking succeeded - return CELL_OK; - } - - if (lwmutex->attribute & SYS_SYNC_RETRY) - { - // TODO (protocol is ignored in current implementation) - } - - // set special value - lwmutex->vars.owner.exchange(lwmutex_reserved); - - // call the syscall - if (_sys_lwmutex_unlock(lwmutex->sleep_queue) == CELL_ESRCH) - { - return CELL_ESRCH; - } - - return CELL_OK; -} - -s32 sys_lwcond_create(vm::ptr lwcond, vm::ptr lwmutex, vm::ptr attr) -{ - sysPrxForUser.Warning("sys_lwcond_create(lwcond=*0x%x, lwmutex=*0x%x, attr=*0x%x)", lwcond, lwmutex, attr); - - lwcond->lwcond_queue = Emu.GetIdManager().make(attr->name_u64); - lwcond->lwmutex = lwmutex; - - return CELL_OK; -} - -s32 sys_lwcond_destroy(vm::ptr lwcond) -{ - sysPrxForUser.Log("sys_lwcond_destroy(lwcond=*0x%x)", lwcond); - - const s32 res = _sys_lwcond_destroy(lwcond->lwcond_queue); - - if (res == CELL_OK) - { - lwcond->lwcond_queue = lwmutex_dead; - } - - return res; -} - -s32 sys_lwcond_signal(PPUThread& ppu, vm::ptr lwcond) -{ - sysPrxForUser.Log("sys_lwcond_signal(lwcond=*0x%x)", lwcond); - - const vm::ptr lwmutex = lwcond->lwmutex; - - if ((lwmutex->attribute & SYS_SYNC_ATTR_PROTOCOL_MASK) == SYS_SYNC_RETRY) - { - // TODO (protocol ignored) - //return _sys_lwcond_signal(lwcond->lwcond_queue, 0, -1, 2); - } - - if (lwmutex->vars.owner.load() == ppu.get_id()) - { - // if owns the mutex - lwmutex->all_info++; - - // call the syscall - if (s32 res = _sys_lwcond_signal(lwcond->lwcond_queue, lwmutex->sleep_queue, -1, 1)) - { - lwmutex->all_info--; - - return res == CELL_EPERM ? CELL_OK : res; - } - - return CELL_OK; - } - - if (s32 res = sys_lwmutex_trylock(ppu, lwmutex)) - { - // if locking failed - - if (res != CELL_EBUSY) - { - return CELL_ESRCH; - } - - // call the syscall - return _sys_lwcond_signal(lwcond->lwcond_queue, 0, -1, 2); - } - - // if locking succeeded - lwmutex->all_info++; - - // call the syscall - if (s32 res = _sys_lwcond_signal(lwcond->lwcond_queue, lwmutex->sleep_queue, -1, 3)) - { - lwmutex->all_info--; - - // unlock the lightweight mutex - sys_lwmutex_unlock(ppu, lwmutex); - - return res == CELL_ENOENT ? CELL_OK : res; - } - - return CELL_OK; -} - -s32 sys_lwcond_signal_all(PPUThread& ppu, vm::ptr lwcond) -{ - sysPrxForUser.Log("sys_lwcond_signal_all(lwcond=*0x%x)", lwcond); - - const vm::ptr lwmutex = lwcond->lwmutex; - - if ((lwmutex->attribute & SYS_SYNC_ATTR_PROTOCOL_MASK) == SYS_SYNC_RETRY) - { - // TODO (protocol ignored) - //return _sys_lwcond_signal_all(lwcond->lwcond_queue, lwmutex->sleep_queue, 2); - } - - if (lwmutex->vars.owner.load() == ppu.get_id()) - { - // if owns the mutex, call the syscall - const s32 res = _sys_lwcond_signal_all(lwcond->lwcond_queue, lwmutex->sleep_queue, 1); - - if (res <= 0) - { - // return error or CELL_OK - return res; - } - - lwmutex->all_info += res; - - return CELL_OK; - } - - if (s32 res = sys_lwmutex_trylock(ppu, lwmutex)) - { - // if locking failed - - if (res != CELL_EBUSY) - { - return CELL_ESRCH; - } - - // call the syscall - return _sys_lwcond_signal_all(lwcond->lwcond_queue, lwmutex->sleep_queue, 2); - } - - // if locking succeeded, call the syscall - s32 res = _sys_lwcond_signal_all(lwcond->lwcond_queue, lwmutex->sleep_queue, 1); - - if (res > 0) - { - lwmutex->all_info += res; - - res = CELL_OK; - } - - // unlock mutex - sys_lwmutex_unlock(ppu, lwmutex); - - return res; -} - -s32 sys_lwcond_signal_to(PPUThread& ppu, vm::ptr lwcond, u32 ppu_thread_id) -{ - sysPrxForUser.Log("sys_lwcond_signal_to(lwcond=*0x%x, ppu_thread_id=0x%x)", lwcond, ppu_thread_id); - - const vm::ptr lwmutex = lwcond->lwmutex; - - if ((lwmutex->attribute & SYS_SYNC_ATTR_PROTOCOL_MASK) == SYS_SYNC_RETRY) - { - // TODO (protocol ignored) - //return _sys_lwcond_signal(lwcond->lwcond_queue, 0, ppu_thread_id, 2); - } - - if (lwmutex->vars.owner.load() == ppu.get_id()) - { - // if owns the mutex - lwmutex->all_info++; - - // call the syscall - if (s32 res = _sys_lwcond_signal(lwcond->lwcond_queue, lwmutex->sleep_queue, ppu_thread_id, 1)) - { - lwmutex->all_info--; - - return res; - } - - return CELL_OK; - } - - if (s32 res = sys_lwmutex_trylock(ppu, lwmutex)) - { - // if locking failed - - if (res != CELL_EBUSY) - { - return CELL_ESRCH; - } - - // call the syscall - return _sys_lwcond_signal(lwcond->lwcond_queue, 0, ppu_thread_id, 2); - } - - // if locking succeeded - lwmutex->all_info++; - - // call the syscall - if (s32 res = _sys_lwcond_signal(lwcond->lwcond_queue, lwmutex->sleep_queue, ppu_thread_id, 3)) - { - lwmutex->all_info--; - - // unlock the lightweight mutex - sys_lwmutex_unlock(ppu, lwmutex); - - return res; - } - - return CELL_OK; -} - -s32 sys_lwcond_wait(PPUThread& ppu, vm::ptr lwcond, u64 timeout) -{ - sysPrxForUser.Log("sys_lwcond_wait(lwcond=*0x%x, timeout=0x%llx)", lwcond, timeout); - - const be_t tid = ppu.get_id(); - - const vm::ptr lwmutex = lwcond->lwmutex; - - if (lwmutex->vars.owner.load() != tid) - { - // if not owner of the mutex - return CELL_EPERM; - } - - // save old recursive value - const be_t recursive_value = lwmutex->recursive_count; - - // set special value - lwmutex->vars.owner = { lwmutex_reserved }; - lwmutex->recursive_count = 0; - - // call the syscall - s32 res = _sys_lwcond_queue_wait(ppu, lwcond->lwcond_queue, lwmutex->sleep_queue, timeout); - - if (res == CELL_OK || res == CELL_ESRCH) - { - if (res == CELL_OK) - { - lwmutex->all_info--; - } - - // restore owner and recursive value - const auto old = lwmutex->vars.owner.exchange(tid); - lwmutex->recursive_count = recursive_value; - - if (old != lwmutex_reserved) - { - throw EXCEPTION("Locking failed (lwmutex=*0x%x, owner=0x%x)", lwmutex, old); - } - - return res; - } - - if (res == CELL_EBUSY || res == CELL_ETIMEDOUT) - { - const s32 res2 = sys_lwmutex_lock(ppu, lwmutex, 0); - - if (res2 == CELL_OK) - { - // if successfully locked, restore recursive value - lwmutex->recursive_count = recursive_value; - - return res == CELL_EBUSY ? CELL_OK : res; - } - - return res2; - } - - if (res == CELL_EDEADLK) - { - // restore owner and recursive value - const auto old = lwmutex->vars.owner.exchange(tid); - lwmutex->recursive_count = recursive_value; - - if (old != lwmutex_reserved) - { - throw EXCEPTION("Locking failed (lwmutex=*0x%x, owner=0x%x)", lwmutex, old); - } - - return CELL_ETIMEDOUT; - } - - throw EXCEPTION("Unexpected syscall result (lwcond=*0x%x, result=0x%x)", lwcond, res); -} - s64 sys_time_get_system_time() { sysPrxForUser.Log("sys_time_get_system_time()"); @@ -633,178 +82,6 @@ s64 sys_time_get_system_time() return get_system_time(); } -std::string ps3_fmt(PPUThread& context, vm::cptr fmt, u32 g_count, u32 f_count, u32 v_count) -{ - std::string result; - - for (char c = *fmt++; c; c = *fmt++) - { - switch (c) - { - case '%': - { - const auto start = fmt - 1; - - // read flags - const bool plus_sign = *fmt == '+' ? fmt++, true : false; - const bool minus_sign = *fmt == '-' ? fmt++, true : false; - const bool space_sign = *fmt == ' ' ? fmt++, true : false; - const bool number_sign = *fmt == '#' ? fmt++, true : false; - const bool zero_padding = *fmt == '0' ? fmt++, true : false; - - // read width - const u32 width = [&]() -> u32 - { - u32 width = 0; - - if (*fmt == '*') - { - fmt++; - return context.get_next_gpr_arg(g_count, f_count, v_count); - } - - while (*fmt - '0' < 10) - { - width = width * 10 + (*fmt++ - '0'); - } - - return width; - }(); - - // read precision - const u32 prec = [&]() -> u32 - { - u32 prec = 0; - - if (*fmt != '.') - { - return 0; - } - - if (*++fmt == '*') - { - fmt++; - return context.get_next_gpr_arg(g_count, f_count, v_count); - } - - while (*fmt - '0' < 10) - { - prec = prec * 10 + (*fmt++ - '0'); - } - - return prec; - }(); - - switch (char cf = *fmt++) - { - case '%': - { - if (plus_sign || minus_sign || space_sign || number_sign || zero_padding || width || prec) break; - - result += '%'; - continue; - } - case 'd': - case 'i': - { - // signed decimal - const s64 value = context.get_next_gpr_arg(g_count, f_count, v_count); - - if (plus_sign || minus_sign || space_sign || number_sign || zero_padding || width || prec) break; - - result += fmt::to_sdec(value); - continue; - } - case 'x': - case 'X': - { - // hexadecimal - const u64 value = context.get_next_gpr_arg(g_count, f_count, v_count); - - if (plus_sign || minus_sign || space_sign || prec) break; - - if (number_sign && value) - { - result += cf == 'x' ? "0x" : "0X"; - } - - const std::string& hex = cf == 'x' ? fmt::to_hex(value) : fmt::toupper(fmt::to_hex(value)); - - if (hex.length() >= width) - { - result += hex; - } - else if (zero_padding) - { - result += std::string(width - hex.length(), '0') + hex; - } - else - { - result += hex + std::string(width - hex.length(), ' '); - } - continue; - } - case 's': - { - // string - auto string = vm::cptr::make(context.get_next_gpr_arg(g_count, f_count, v_count)); - - if (plus_sign || minus_sign || space_sign || number_sign || zero_padding || width || prec) break; - - result += string.get_ptr(); - continue; - } - } - - throw EXCEPTION("Unknown formatting: '%s'", start.get_ptr()); - } - } - - result += c; - } - - return result; -} - -u32 _sys_heap_create_heap(vm::cptr name, u32 arg2, u32 arg3, u32 arg4) -{ - sysPrxForUser.Warning("_sys_heap_create_heap(name=*0x%x, arg2=0x%x, arg3=0x%x, arg4=0x%x)", name, arg2, arg3, arg4); - - return Emu.GetIdManager().make(name.get_ptr()); -} - -s32 _sys_heap_delete_heap(u32 heap) -{ - sysPrxForUser.Warning("_sys_heap_delete_heap(heap=0x%x)", heap); - - Emu.GetIdManager().remove(heap); - - return CELL_OK; -} - -u32 _sys_heap_malloc(u32 heap, u32 size) -{ - sysPrxForUser.Warning("_sys_heap_malloc(heap=0x%x, size=0x%x)", heap, size); - - return vm::alloc(size, vm::main); -} - -u32 _sys_heap_memalign(u32 heap, u32 align, u32 size) -{ - sysPrxForUser.Warning("_sys_heap_memalign(heap=0x%x, align=0x%x, size=0x%x)", heap, align, size); - - return vm::alloc(size, vm::main, std::max(align, 4096)); -} - -s32 _sys_heap_free(u32 heap, u32 addr) -{ - sysPrxForUser.Warning("_sys_heap_free(heap=0x%x, addr=0x%x)", heap, addr); - - vm::dealloc(addr, vm::main); - - return CELL_OK; -} - s64 _sys_process_atexitspawn() { sysPrxForUser.Log("_sys_process_atexitspawn()"); @@ -832,90 +109,12 @@ s32 sys_process_is_stack(u32 p) return (p >> 28) == 0xD; } -s64 sys_prx_exitspawn_with_level() +s32 sys_process_get_paramsfo(vm::ptr buffer) { - sysPrxForUser.Log("sys_prx_exitspawn_with_level()"); - return CELL_OK; -} + sysPrxForUser.Warning("sys_process_get_paramsfo(buffer=*0x%x)", buffer); -s32 sys_spu_elf_get_information(u32 elf_img, vm::ptr entry, vm::ptr 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()); - return CELL_OK; -} - -s32 sys_spu_elf_get_segments(u32 elf_img, vm::ptr segments, s32 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; -} - -s32 sys_spu_image_import(vm::ptr img, u32 src, u32 type) -{ - sysPrxForUser.Warning("sys_spu_image_import(img=*0x%x, src=0x%x, type=%d)", img, src, type); - - return spu_image_import(*img, src, type); -} - -s32 sys_spu_image_close(vm::ptr img) -{ - sysPrxForUser.Todo("sys_spu_image_close(img=*0x%x)", img); - - return CELL_OK; -} - -s32 sys_raw_spu_load(s32 id, vm::cptr path, vm::ptr entry) -{ - sysPrxForUser.Warning("sys_raw_spu_load(id=%d, path=*0x%x, entry=*0x%x)", id, path, entry); - sysPrxForUser.Warning("*** path = '%s'", path.get_ptr()); - - vfsFile f(path.get_ptr()); - if(!f.IsOpened()) - { - sysPrxForUser.Error("sys_raw_spu_load error: '%s' not found!", path.get_ptr()); - return CELL_ENOENT; - } - - SceHeader hdr; - hdr.Load(f); - - if (hdr.CheckMagic()) - { - sysPrxForUser.Error("sys_raw_spu_load error: '%s' is encrypted! Decrypt SELF and try again.", path.get_ptr()); - Emu.Pause(); - return CELL_ENOENT; - } - - f.Seek(0); - - u32 _entry; - LoadSpuImage(f, _entry, RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id); - - *entry = _entry | 1; - - return CELL_OK; -} - -s32 sys_raw_spu_image_load(PPUThread& ppu, s32 id, vm::ptr img) -{ - sysPrxForUser.Warning("sys_raw_spu_image_load(id=%d, img=*0x%x)", id, img); - - // TODO: use segment info - - const auto stamp0 = get_system_time(); - - memcpy(vm::get_ptr(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id), vm::get_ptr(img->addr), 256 * 1024); - - const auto stamp1 = get_system_time(); - - vm::write32(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id + RAW_SPU_PROB_OFFSET + SPU_NPC_offs, img->entry_point | 1); - - const auto stamp2 = get_system_time(); - - LOG_ERROR(GENERAL, "memcpy() latency: %lldus", (stamp1 - stamp0)); - LOG_ERROR(GENERAL, "MMIO latency: %lldus", (stamp2 - stamp1)); - - return CELL_OK; + // prx: load some data (0x40 bytes) previously set by _sys_process_get_paramsfo syscall + return _sys_process_get_paramsfo(buffer); } s32 sys_get_random_number(vm::ptr addr, u64 size) @@ -933,353 +132,33 @@ s32 sys_get_random_number(vm::ptr addr, u64 size) return CELL_OK; } -vm::ptr _sys_memset(vm::ptr dst, s32 value, u32 size) +s32 console_getc() { - sysPrxForUser.Log("_sys_memset(dst=*0x%x, value=%d, size=0x%x)", dst, value, size); - - memset(dst.get_ptr(), value, size); - - return dst; + throw EXCEPTION(""); } -vm::ptr _sys_memcpy(vm::ptr dst, vm::cptr src, u32 size) +s32 console_putc() { - sysPrxForUser.Log("_sys_memcpy(dst=*0x%x, src=*0x%x, size=0x%x)", dst, src, size); - - memcpy(dst.get_ptr(), src.get_ptr(), size); - - return dst; + throw EXCEPTION(""); } -s32 _sys_memcmp(vm::cptr buf1, vm::cptr buf2, u32 size) +s32 console_write() { - sysPrxForUser.Log("_sys_memcmp(buf1=*0x%x, buf2=*0x%x, size=%d)", buf1, buf2, size); - - return memcmp(buf1.get_ptr(), buf2.get_ptr(), size); + throw EXCEPTION(""); } -s64 _sys_strlen(vm::cptr str) -{ - sysPrxForUser.Log("_sys_strlen(str=*0x%x)", str); - return strlen(str.get_ptr()); -} - -s32 _sys_strcmp(vm::cptr str1, vm::cptr str2) -{ - sysPrxForUser.Log("_sys_strcmp(str1=*0x%x, str2=*0x%x)", str1, str2); - - return strcmp(str1.get_ptr(), str2.get_ptr()); -} - -s32 _sys_strncmp(vm::cptr str1, vm::cptr str2, s32 max) -{ - sysPrxForUser.Log("_sys_strncmp(str1=*0x%x, str2=*0x%x, max=%d)", str1, str2, max); - - return strncmp(str1.get_ptr(), str2.get_ptr(), max); -} - -vm::ptr _sys_strcat(vm::ptr dest, vm::cptr source) -{ - sysPrxForUser.Log("_sys_strcat(dest=*0x%x, source=*0x%x)", dest, source); - - if (strcat(dest.get_ptr(), source.get_ptr()) != dest.get_ptr()) - { - throw EXCEPTION("Unexpected strcat() result"); - } - - return dest; -} - -vm::cptr _sys_strchr(vm::cptr str, s32 ch) -{ - sysPrxForUser.Log("_sys_strchr(str=*0x%x, ch=0x%x)", str, ch); - - return vm::cptr::make(vm::get_addr(strchr(str.get_ptr(), ch))); -} - -vm::ptr _sys_strncat(vm::ptr dest, vm::cptr source, u32 len) -{ - sysPrxForUser.Log("_sys_strncat(dest=*0x%x, source=*0x%x, len=%d)", dest, source, len); - - if (strncat(dest.get_ptr(), source.get_ptr(), len) != dest.get_ptr()) - { - throw EXCEPTION("Unexpected strncat() result"); - } - - return dest; -} - -vm::ptr _sys_strcpy(vm::ptr dest, vm::cptr source) -{ - sysPrxForUser.Log("_sys_strcpy(dest=*0x%x, source=*0x%x)", dest, source); - - if (strcpy(dest.get_ptr(), source.get_ptr()) != dest.get_ptr()) - { - throw EXCEPTION("Unexpected strcpy() result"); - } - - return dest; -} - -vm::ptr _sys_strncpy(vm::ptr dest, vm::cptr source, u32 len) -{ - sysPrxForUser.Log("_sys_strncpy(dest=*0x%x, source=*0x%x, len=%d)", dest, source, len); - - if (!dest || !source) - { - return vm::null; - } - - if (strncpy(dest.get_ptr(), source.get_ptr(), len) != dest.get_ptr()) - { - throw EXCEPTION("Unexpected strncpy() result"); - } - - return dest; -} - -spu_printf_cb_t spu_printf_agcb; -spu_printf_cb_t spu_printf_dgcb; -spu_printf_cb_t spu_printf_atcb; -spu_printf_cb_t spu_printf_dtcb; - -s32 _sys_spu_printf_initialize(spu_printf_cb_t agcb, spu_printf_cb_t dgcb, spu_printf_cb_t atcb, spu_printf_cb_t dtcb) -{ - sysPrxForUser.Warning("_sys_spu_printf_initialize(agcb=*0x%x, dgcb=*0x%x, atcb=*0x%x, dtcb=*0x%x)", agcb, dgcb, atcb, dtcb); - - // prx: register some callbacks - spu_printf_agcb = agcb; - spu_printf_dgcb = dgcb; - spu_printf_atcb = atcb; - spu_printf_dtcb = dtcb; - return CELL_OK; -} - -s32 _sys_spu_printf_finalize() -{ - sysPrxForUser.Warning("_sys_spu_printf_finalize()"); - - spu_printf_agcb.set(0); - spu_printf_dgcb.set(0); - spu_printf_atcb.set(0); - spu_printf_dtcb.set(0); - return CELL_OK; -} - -s32 _sys_spu_printf_attach_group(PPUThread& ppu, u32 group) -{ - sysPrxForUser.Warning("_sys_spu_printf_attach_group(group=0x%x)", group); - - if (!spu_printf_agcb) - { - return CELL_ESTAT; - } - - return spu_printf_agcb(ppu, group); -} - -s32 _sys_spu_printf_detach_group(PPUThread& ppu, u32 group) -{ - sysPrxForUser.Warning("_sys_spu_printf_detach_group(group=0x%x)", group); - - if (!spu_printf_dgcb) - { - return CELL_ESTAT; - } - - return spu_printf_dgcb(ppu, group); -} - -s32 _sys_spu_printf_attach_thread(PPUThread& ppu, u32 thread) -{ - sysPrxForUser.Warning("_sys_spu_printf_attach_thread(thread=0x%x)", thread); - - if (!spu_printf_atcb) - { - return CELL_ESTAT; - } - - return spu_printf_atcb(ppu, thread); -} - -s32 _sys_spu_printf_detach_thread(PPUThread& ppu, u32 thread) -{ - sysPrxForUser.Warning("_sys_spu_printf_detach_thread(thread=0x%x)", thread); - - if (!spu_printf_dtcb) - { - return CELL_ESTAT; - } - - return spu_printf_dtcb(ppu, thread); -} - -u32 _sys_malloc(u32 size) -{ - sysPrxForUser.Warning("_sys_malloc(size=0x%x)", size); - - return vm::alloc(size, vm::main); -} - -u32 _sys_memalign(u32 align, u32 size) -{ - sysPrxForUser.Warning("_sys_memalign(align=0x%x, size=0x%x)", align, size); - - return vm::alloc(size, vm::main, std::max(align, 4096)); -} - -s32 _sys_free(u32 addr) -{ - sysPrxForUser.Warning("_sys_free(addr=0x%x)", addr); - - vm::dealloc(addr, vm::main); - - return CELL_OK; -} - -s32 _sys_snprintf(PPUThread& ppu, vm::ptr dst, u32 count, vm::cptr fmt, ppu_va_args_t va_args) -{ - sysPrxForUser.Warning("_sys_snprintf(dst=*0x%x, count=%d, fmt=*0x%x, ...)", dst, count, fmt); - - std::string result = ps3_fmt(ppu, fmt, va_args.g_count, va_args.f_count, va_args.v_count); - - sysPrxForUser.Warning("*** '%s' -> '%s'", fmt.get_ptr(), result); - - if (!count) - { - return 0; // ??? - } - else - { - count = (u32)std::min(count - 1, result.size()); - - memcpy(dst.get_ptr(), result.c_str(), count); - dst[count] = 0; - return count; - } -} - -s32 _sys_printf(vm::cptr fmt, ppu_va_args_t va_args) -{ - sysPrxForUser.Todo("_sys_printf(fmt=*0x%x, ...)", fmt); - - // probably, assertion failed - throw EXCEPTION("%s", fmt.get_ptr()); -} - -s32 sys_process_get_paramsfo(vm::ptr buffer) -{ - sysPrxForUser.Warning("sys_process_get_paramsfo(buffer=*0x%x)", buffer); - - // prx: load some data (0x40 bytes) previously set by _sys_process_get_paramsfo syscall - return _sys_process_get_paramsfo(buffer); -} - -void sys_spinlock_initialize(vm::ptr> lock) -{ - sysPrxForUser.Log("sys_spinlock_initialize(lock=*0x%x)", lock); - - // prx: set 0 and sync - lock->exchange(0); -} - -void sys_spinlock_lock(PPUThread& ppu, vm::ptr> lock) -{ - sysPrxForUser.Log("sys_spinlock_lock(lock=*0x%x)", lock); - - // prx: exchange with 0xabadcafe, repeat until exchanged with 0 - while (lock->exchange(0xabadcafe).data()) - { - vm::wait_op(ppu, lock.addr(), 4, WRAP_EXPR(!lock->load().data())); - - CHECK_EMU_STATUS; - } -} - -s32 sys_spinlock_trylock(vm::ptr> lock) -{ - sysPrxForUser.Log("sys_spinlock_trylock(lock=*0x%x)", lock); - - // prx: exchange with 0xabadcafe, translate exchanged value - if (lock->exchange(0xabadcafe).data()) - { - return CELL_EBUSY; - } - - return CELL_OK; -} - -void sys_spinlock_unlock(vm::ptr> lock) -{ - sysPrxForUser.Log("sys_spinlock_unlock(lock=*0x%x)", lock); - - // prx: sync and set 0 - lock->exchange(0); - - vm::notify_at(lock.addr(), 4); -} - -s32 sys_ppu_thread_create(PPUThread& ppu, vm::ptr thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, vm::cptr threadname) -{ - sysPrxForUser.Warning("sys_ppu_thread_create(thread_id=*0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname=*0x%x)", thread_id, entry, arg, prio, stacksize, flags, threadname); - - // (allocate TLS) - // (return CELL_ENOMEM if failed) - // ... - - vm::stackvar attr(ppu); - - attr->entry = entry; - attr->tls = 0; - - // call the syscall - if (s32 res = _sys_ppu_thread_create(thread_id, attr, arg, 0, prio, stacksize, flags, threadname)) - { - return res; - } - - // run the thread - return flags & SYS_PPU_THREAD_CREATE_INTERRUPT ? CELL_OK : sys_ppu_thread_start(static_cast(*thread_id)); -} - -s32 sys_ppu_thread_get_id(PPUThread& ppu, vm::ptr thread_id) -{ - sysPrxForUser.Log("sys_ppu_thread_get_id(thread_id=*0x%x)", thread_id); - - *thread_id = ppu.get_id(); - - return CELL_OK; -} - -void sys_ppu_thread_exit(PPUThread& ppu, u64 val) -{ - sysPrxForUser.Log("sys_ppu_thread_exit(val=0x%llx)", val); - - // (call registered atexit functions) - // (deallocate TLS) - // ... - - // call the syscall - _sys_ppu_thread_exit(ppu, val); -} - -std::mutex g_once_mutex; - -void sys_ppu_thread_once(PPUThread& ppu, vm::ptr> once_ctrl, vm::ptr init) -{ - sysPrxForUser.Warning("sys_ppu_thread_once(once_ctrl=*0x%x, init=*0x%x)", once_ctrl, init); - - std::lock_guard lock(g_once_mutex); - - if (once_ctrl->compare_and_swap_test(SYS_PPU_THREAD_ONCE_INIT, SYS_PPU_THREAD_DONE_INIT)) - { - // call init function using current thread context - init(ppu); - } -} - -u32 g_ppu_func_index__sys_lwmutex_unlock; // test +extern void sysPrxForUser_sys_lwmutex_init(); +extern void sysPrxForUser_sys_lwcond_init(); +extern void sysPrxForUser_sys_ppu_thread_init(); +extern void sysPrxForUser_sys_prx_init(); +extern void sysPrxForUser_sys_heap_init(); +extern void sysPrxForUser_sys_spinlock_init(); +extern void sysPrxForUser_sys_mmapper_init(); +extern void sysPrxForUser_sys_mempool_init(); +extern void sysPrxForUser_sys_spu_init(); +extern void sysPrxForUser_sys_game_init(); +extern void sysPrxForUser_sys_libc_init(); Module sysPrxForUser("sysPrxForUser", []() { @@ -1289,111 +168,39 @@ Module sysPrxForUser("sysPrxForUser", []() 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 srand(time(NULL)); - REG_FUNC(sysPrxForUser, sys_initialize_tls); - - REG_FUNC(sysPrxForUser, sys_lwmutex_create); - REG_FUNC(sysPrxForUser, sys_lwmutex_destroy); - REG_FUNC(sysPrxForUser, sys_lwmutex_lock); - REG_FUNC(sysPrxForUser, sys_lwmutex_trylock); - g_ppu_func_index__sys_lwmutex_unlock = REG_FUNC(sysPrxForUser, sys_lwmutex_unlock); // test + //REG_VARIABLE(sysPrxForUser, sys_prx_version); // 0x7df066cf - REG_FUNC(sysPrxForUser, sys_lwcond_create); - REG_FUNC(sysPrxForUser, sys_lwcond_destroy); - REG_FUNC(sysPrxForUser, sys_lwcond_signal); - REG_FUNC(sysPrxForUser, sys_lwcond_signal_all); - REG_FUNC(sysPrxForUser, sys_lwcond_signal_to); - REG_FUNC(sysPrxForUser, sys_lwcond_wait); + sysPrxForUser_sys_lwmutex_init(); + sysPrxForUser_sys_lwcond_init(); + sysPrxForUser_sys_ppu_thread_init(); + sysPrxForUser_sys_prx_init(); + sysPrxForUser_sys_heap_init(); + sysPrxForUser_sys_spinlock_init(); + sysPrxForUser_sys_mmapper_init(); + sysPrxForUser_sys_mempool_init(); + sysPrxForUser_sys_spu_init(); + sysPrxForUser_sys_game_init(); + sysPrxForUser_sys_libc_init(); + + REG_FUNC(sysPrxForUser, sys_initialize_tls); REG_FUNC(sysPrxForUser, sys_time_get_system_time); + // TODO: split syscalls and liblv2 functions REG_FUNC(sysPrxForUser, sys_process_exit); REG_FUNC(sysPrxForUser, _sys_process_atexitspawn); REG_FUNC(sysPrxForUser, _sys_process_at_Exitspawn); REG_FUNC(sysPrxForUser, sys_process_is_stack); + REG_FUNC(sysPrxForUser, sys_process_get_paramsfo); // 0xe75c40f2 REG_FUNC(sysPrxForUser, sys_interrupt_thread_disestablish); - REG_FUNC(sysPrxForUser, sys_ppu_thread_create); - REG_FUNC(sysPrxForUser, sys_ppu_thread_get_id); - REG_FUNC(sysPrxForUser, sys_ppu_thread_exit); - REG_FUNC(sysPrxForUser, sys_ppu_thread_once); - - REG_FUNC(sysPrxForUser, sys_prx_load_module); - REG_FUNC(sysPrxForUser, sys_prx_start_module); - REG_FUNC(sysPrxForUser, sys_prx_stop_module); - REG_FUNC(sysPrxForUser, sys_prx_unload_module); - REG_FUNC(sysPrxForUser, sys_prx_register_library); - REG_FUNC(sysPrxForUser, sys_prx_unregister_library); - REG_FUNC(sysPrxForUser, sys_prx_get_module_list); - REG_FUNC(sysPrxForUser, sys_prx_get_module_info); - REG_FUNC(sysPrxForUser, sys_prx_get_module_id_by_name); - REG_FUNC(sysPrxForUser, sys_prx_load_module_on_memcontainer); - REG_FUNC(sysPrxForUser, sys_prx_exitspawn_with_level); - - REG_FUNC(sysPrxForUser, _sys_heap_create_heap); - REG_FUNC(sysPrxForUser, _sys_heap_delete_heap); - REG_FUNC(sysPrxForUser, _sys_heap_malloc); - REG_FUNC(sysPrxForUser, _sys_heap_memalign); - REG_FUNC(sysPrxForUser, _sys_heap_free); - - REG_FUNC(sysPrxForUser, sys_mmapper_allocate_memory); - REG_FUNC(sysPrxForUser, sys_mmapper_allocate_memory_from_container); - REG_FUNC(sysPrxForUser, sys_mmapper_map_memory); - REG_FUNC(sysPrxForUser, sys_mmapper_unmap_memory); - REG_FUNC(sysPrxForUser, sys_mmapper_free_memory); - - REG_FUNC(sysPrxForUser, sys_spu_elf_get_information); - REG_FUNC(sysPrxForUser, sys_spu_elf_get_segments); - REG_FUNC(sysPrxForUser, sys_spu_image_import); - REG_FUNC(sysPrxForUser, sys_spu_image_close); - - REG_FUNC(sysPrxForUser, sys_raw_spu_load); - REG_FUNC(sysPrxForUser, sys_raw_spu_image_load); - REG_FUNC(sysPrxForUser, sys_get_random_number); - REG_FUNC(sysPrxForUser, sys_spinlock_initialize); - REG_FUNC(sysPrxForUser, sys_spinlock_lock); - REG_FUNC(sysPrxForUser, sys_spinlock_trylock); - REG_FUNC(sysPrxForUser, sys_spinlock_unlock); - - REG_FUNC(sysPrxForUser, sys_game_process_exitspawn2); - REG_FUNC(sysPrxForUser, sys_game_process_exitspawn); - - REG_FUNC(sysPrxForUser, _sys_memset); - REG_FUNC(sysPrxForUser, _sys_memcpy); - REG_FUNC(sysPrxForUser, _sys_memcmp); - REG_FUNC(sysPrxForUser, _sys_strlen); - REG_FUNC(sysPrxForUser, _sys_strcmp); - REG_FUNC(sysPrxForUser, _sys_strncmp); - REG_FUNC(sysPrxForUser, _sys_strcat); - REG_FUNC(sysPrxForUser, _sys_strchr); - REG_FUNC(sysPrxForUser, _sys_strncat); - REG_FUNC(sysPrxForUser, _sys_strcpy); - REG_FUNC(sysPrxForUser, _sys_strncpy); - - REG_FUNC(sysPrxForUser, _sys_spu_printf_initialize); - REG_FUNC(sysPrxForUser, _sys_spu_printf_finalize); - REG_FUNC(sysPrxForUser, _sys_spu_printf_attach_group); - REG_FUNC(sysPrxForUser, _sys_spu_printf_detach_group); - REG_FUNC(sysPrxForUser, _sys_spu_printf_attach_thread); - REG_FUNC(sysPrxForUser, _sys_spu_printf_detach_thread); - - REG_FUNC(sysPrxForUser, _sys_malloc); - REG_FUNC(sysPrxForUser, _sys_memalign); - REG_FUNC(sysPrxForUser, _sys_free); - - REG_FUNC(sysPrxForUser, _sys_snprintf); - - REG_FUNC(sysPrxForUser, _sys_printf); - - REG_FUNC(sysPrxForUser, sys_process_get_paramsfo); + REG_FUNC(sysPrxForUser, console_getc); + REG_FUNC(sysPrxForUser, console_putc); + REG_FUNC(sysPrxForUser, console_write); }); diff --git a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.h b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.h index f491f38465..d430f7cddc 100644 --- a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.h +++ b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.h @@ -2,23 +2,13 @@ namespace vm { using namespace ps3; } -struct HeapInfo -{ - const std::string name; - - HeapInfo(const char* name) - : name(name) - { - } -}; - using spu_printf_cb_t = vm::ptr; // Aux -extern spu_printf_cb_t spu_printf_agcb; -extern spu_printf_cb_t spu_printf_dgcb; -extern spu_printf_cb_t spu_printf_atcb; -extern spu_printf_cb_t spu_printf_dtcb; +extern spu_printf_cb_t g_spu_printf_agcb; +extern spu_printf_cb_t g_spu_printf_dgcb; +extern spu_printf_cb_t g_spu_printf_atcb; +extern spu_printf_cb_t g_spu_printf_dtcb; // Functions vm::ptr _sys_memset(vm::ptr dst, s32 value, u32 size); diff --git a/rpcs3/Emu/SysCalls/Modules/sys_game.cpp b/rpcs3/Emu/SysCalls/Modules/sys_game.cpp new file mode 100644 index 0000000000..9f06602f29 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/sys_game.cpp @@ -0,0 +1,216 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" + +#include "Emu/FS/VFS.h" +#include "sysPrxForUser.h" + +extern Module sysPrxForUser; + +void sys_game_process_exitspawn(vm::cptr path, u32 argv_addr, u32 envp_addr, u32 data_addr, u32 data_size, u32 prio, u64 flags) +{ + std::string _path = path.get_ptr(); + const std::string& from = "//"; + const std::string& to = "/"; + + size_t start_pos = 0; + while ((start_pos = _path.find(from, start_pos)) != std::string::npos) { + _path.replace(start_pos, from.length(), to); + start_pos += to.length(); + } + + sysPrxForUser.Todo("sys_game_process_exitspawn()"); + sysPrxForUser.Warning("path: %s", _path.c_str()); + sysPrxForUser.Warning("argv: 0x%x", argv_addr); + sysPrxForUser.Warning("envp: 0x%x", envp_addr); + sysPrxForUser.Warning("data: 0x%x", data_addr); + sysPrxForUser.Warning("data_size: 0x%x", data_size); + sysPrxForUser.Warning("prio: %d", prio); + sysPrxForUser.Warning("flags: %d", flags); + + std::vector argv; + std::vector env; + + if (argv_addr) + { + auto argvp = vm::cpptr::make(argv_addr); + while (argvp && *argvp) + { + argv.push_back(argvp[0].get_ptr()); + argvp++; + } + + for (auto &arg : argv) + { + sysPrxForUser.Log("argument: %s", arg.c_str()); + } + } + + if (envp_addr) + { + auto envp = vm::cpptr::make(envp_addr); + while (envp && *envp) + { + env.push_back(envp[0].get_ptr()); + envp++; + } + + for (auto &en : env) + { + sysPrxForUser.Log("env_argument: %s", en.c_str()); + } + } + + //TODO: execute the file in with the args in argv + //and the environment parameters in envp and copy the data + //from data_addr into the adress space of the new process + //then kill the current process + + Emu.Pause(); + sysPrxForUser.Success("Process finished"); + + CallAfter([=]() + { + Emu.Stop(); + + std::string real_path; + + Emu.GetVFS().GetDevice(_path.c_str(), real_path); + + Emu.BootGame(real_path, true); + }); + + return; +} + +void sys_game_process_exitspawn2(vm::cptr path, u32 argv_addr, u32 envp_addr, u32 data_addr, u32 data_size, u32 prio, u64 flags) +{ + std::string _path = path.get_ptr(); + const std::string& from = "//"; + const std::string& to = "/"; + + size_t start_pos = 0; + while ((start_pos = _path.find(from, start_pos)) != std::string::npos) { + _path.replace(start_pos, from.length(), to); + start_pos += to.length(); + } + + sysPrxForUser.Warning("sys_game_process_exitspawn2()"); + sysPrxForUser.Warning("path: %s", _path.c_str()); + sysPrxForUser.Warning("argv: 0x%x", argv_addr); + sysPrxForUser.Warning("envp: 0x%x", envp_addr); + sysPrxForUser.Warning("data: 0x%x", data_addr); + sysPrxForUser.Warning("data_size: 0x%x", data_size); + sysPrxForUser.Warning("prio: %d", prio); + sysPrxForUser.Warning("flags: %d", flags); + + std::vector argv; + std::vector env; + + if (argv_addr) + { + auto argvp = vm::cpptr::make(argv_addr); + while (argvp && *argvp) + { + argv.push_back(argvp[0].get_ptr()); + argvp++; + } + + for (auto &arg : argv) + { + sysPrxForUser.Log("argument: %s", arg.c_str()); + } + } + + if (envp_addr) + { + auto envp = vm::cpptr::make(envp_addr); + while (envp && *envp) + { + env.push_back(envp[0].get_ptr()); + envp++; + } + + for (auto &en : env) + { + sysPrxForUser.Log("env_argument: %s", en.c_str()); + } + } + + //TODO: execute the file in with the args in argv + //and the environment parameters in envp and copy the data + //from data_addr into the adress space of the new process + //then kill the current process + + Emu.Pause(); + sysPrxForUser.Success("Process finished"); + + CallAfter([=]() + { + Emu.Stop(); + + std::string real_path; + + Emu.GetVFS().GetDevice(_path.c_str(), real_path); + + Emu.BootGame(real_path, true); + }); + + return; +} + +s32 sys_game_board_storage_read() +{ + throw EXCEPTION(""); +} + +s32 sys_game_board_storage_write() +{ + throw EXCEPTION(""); +} + +s32 sys_game_get_rtc_status() +{ + throw EXCEPTION(""); +} + +s32 sys_game_get_system_sw_version() +{ + throw EXCEPTION(""); +} + +s32 sys_game_get_temperature() +{ + throw EXCEPTION(""); +} + +s32 sys_game_watchdog_clear() +{ + throw EXCEPTION(""); +} + +s32 sys_game_watchdog_start() +{ + throw EXCEPTION(""); +} + +s32 sys_game_watchdog_stop() +{ + throw EXCEPTION(""); +} + + +void sysPrxForUser_sys_game_init() +{ + REG_FUNC(sysPrxForUser, sys_game_process_exitspawn2); + REG_FUNC(sysPrxForUser, sys_game_process_exitspawn); + REG_FUNC(sysPrxForUser, sys_game_board_storage_read); + REG_FUNC(sysPrxForUser, sys_game_board_storage_write); + REG_FUNC(sysPrxForUser, sys_game_get_rtc_status); + REG_FUNC(sysPrxForUser, sys_game_get_system_sw_version); + REG_FUNC(sysPrxForUser, sys_game_get_temperature); + REG_FUNC(sysPrxForUser, sys_game_watchdog_clear); + REG_FUNC(sysPrxForUser, sys_game_watchdog_start); + REG_FUNC(sysPrxForUser, sys_game_watchdog_stop); +} diff --git a/rpcs3/Emu/SysCalls/Modules/sys_heap.cpp b/rpcs3/Emu/SysCalls/Modules/sys_heap.cpp new file mode 100644 index 0000000000..f4f04a3586 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/sys_heap.cpp @@ -0,0 +1,91 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/IdManager.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" + +#include "sysPrxForUser.h" + +extern Module sysPrxForUser; + +struct HeapInfo +{ + const std::string name; + + HeapInfo(const char* name) + : name(name) + { + } +}; + +u32 _sys_heap_create_heap(vm::cptr name, u32 arg2, u32 arg3, u32 arg4) +{ + sysPrxForUser.Warning("_sys_heap_create_heap(name=*0x%x, arg2=0x%x, arg3=0x%x, arg4=0x%x)", name, arg2, arg3, arg4); + + return Emu.GetIdManager().make(name.get_ptr()); +} + +s32 _sys_heap_delete_heap(u32 heap) +{ + sysPrxForUser.Warning("_sys_heap_delete_heap(heap=0x%x)", heap); + + Emu.GetIdManager().remove(heap); + + return CELL_OK; +} + +u32 _sys_heap_malloc(u32 heap, u32 size) +{ + sysPrxForUser.Warning("_sys_heap_malloc(heap=0x%x, size=0x%x)", heap, size); + + return vm::alloc(size, vm::main); +} + +u32 _sys_heap_memalign(u32 heap, u32 align, u32 size) +{ + sysPrxForUser.Warning("_sys_heap_memalign(heap=0x%x, align=0x%x, size=0x%x)", heap, align, size); + + return vm::alloc(size, vm::main, std::max(align, 4096)); +} + +s32 _sys_heap_free(u32 heap, u32 addr) +{ + sysPrxForUser.Warning("_sys_heap_free(heap=0x%x, addr=0x%x)", heap, addr); + + vm::dealloc(addr, vm::main); + + return CELL_OK; +} + +s32 _sys_heap_alloc_heap_memory() +{ + throw EXCEPTION(""); +} + +s32 _sys_heap_get_mallinfo() +{ + throw EXCEPTION(""); +} + +s32 _sys_heap_get_total_free_size() +{ + throw EXCEPTION(""); +} + +s32 _sys_heap_stats() +{ + throw EXCEPTION(""); +} + +void sysPrxForUser_sys_heap_init() +{ + REG_FUNC(sysPrxForUser, _sys_heap_create_heap); + REG_FUNC(sysPrxForUser, _sys_heap_delete_heap); + REG_FUNC(sysPrxForUser, _sys_heap_malloc); + REG_FUNC(sysPrxForUser, _sys_heap_memalign); + REG_FUNC(sysPrxForUser, _sys_heap_free); + REG_FUNC(sysPrxForUser, _sys_heap_alloc_heap_memory); + REG_FUNC(sysPrxForUser, _sys_heap_get_mallinfo); + REG_FUNC(sysPrxForUser, _sys_heap_get_total_free_size); + REG_FUNC(sysPrxForUser, _sys_heap_stats); +} diff --git a/rpcs3/Emu/SysCalls/Modules/sys_http.cpp b/rpcs3/Emu/SysCalls/Modules/sys_http.cpp deleted file mode 100644 index 94aa8fb720..0000000000 --- a/rpcs3/Emu/SysCalls/Modules/sys_http.cpp +++ /dev/null @@ -1,704 +0,0 @@ -#include "stdafx.h" -#if 0 - -void sys_http_init(); -Module sys_http(0x0001, sys_http_init); - -int cellHttpInit() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpEnd() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpsInit() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpsEnd() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpSetProxy() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpGetProxy() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpInitCookie() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpEndCookie() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpAddCookieWithClientId() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpSessionCookieFlush() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpCookieExportWithClientId() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpCookieImportWithClientId() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetCookieSendCallback() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetCookieRecvCallback() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpCreateClient() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpDestroyClient() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetAuthenticationCallback() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetTransactionStateCallback() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetRedirectCallback() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetProxy() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetProxy() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetVersion() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetVersion() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetPipeline() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetPipeline() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetKeepAlive() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetKeepAlive() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetAutoRedirect() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetAutoRedirect() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetAutoAuthentication() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetAutoAuthentication() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetAuthenticationCacheStatus() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetAuthenticationCacheStatus() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetCookieStatus() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetCookieStatus() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetUserAgent() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetUserAgent() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetResponseBufferMax() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetResponseBufferMax() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientCloseAllConnections() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientCloseConnections() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientPollConnections() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetRecvTimeout() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetRecvTimeout() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetSendTimeout() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetSendTimeout() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetConnTimeout() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetConnTimeout() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetTotalPoolSize() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetTotalPoolSize() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetPerHostPoolSize() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetPerHostPoolSize() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetPerHostKeepAliveMax() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetPerHostKeepAliveMax() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetPerPipelineMax() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetPerPipelineMax() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetRecvBufferSize() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetRecvBufferSize() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetAllHeaders() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetHeader() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetHeader() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientAddHeader() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientDeleteHeader() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetSslCallback() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetSslClientCertificate() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpCreateTransaction() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpDestroyTransaction() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpTransactionGetUri() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpTransactionCloseConnection() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpTransactionReleaseConnection() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpTransactionAbortConnection() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpSendRequest() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpRequestSetContentLength() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpRequestGetContentLength() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpRequestSetChunkedTransferStatus() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpRequestGetChunkedTransferStatus() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpRequestGetAllHeaders() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpRequestSetHeader() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpRequestGetHeader() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpRequestAddHeader() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpRequestDeleteHeader() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpRecvResponse() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpResponseGetAllHeaders() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpResponseGetHeader() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpResponseGetContentLength() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpResponseGetStatusCode() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpResponseGetStatusLine() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpTransactionGetSslCipherName() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpTransactionGetSslCipherId() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpTransactionGetSslCipherVersion() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpTransactionGetSslCipherBits() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpTransactionGetSslCipherString() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpTransactionGetSslVersion() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpTransactionGetSslId() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetSslVersion() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientGetSslVersion() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -int cellHttpClientSetSslIdDestroyCallback() -{ - UNIMPLEMENTED_FUNC(sys_http); - return CELL_OK; -} - -void sys_http_init() -{ - // (TODO: Find addresses for cellHttpClientSetSendBufferSize and cellHttpClientGetSendBufferSize) - - REG_FUNC(sys_http, cellHttpInit); - REG_FUNC(sys_http, cellHttpEnd); - REG_FUNC(sys_http, cellHttpsInit); - REG_FUNC(sys_http, cellHttpsEnd); - REG_FUNC(sys_http, cellHttpSetProxy); - REG_FUNC(sys_http, cellHttpGetProxy); - - REG_FUNC(sys_http, cellHttpInitCookie); - REG_FUNC(sys_http, cellHttpEndCookie); - REG_FUNC(sys_http, cellHttpAddCookieWithClientId); - REG_FUNC(sys_http, cellHttpSessionCookieFlush); - REG_FUNC(sys_http, cellHttpCookieExportWithClientId); - REG_FUNC(sys_http, cellHttpCookieImportWithClientId); - REG_FUNC(sys_http, cellHttpClientSetCookieSendCallback); - REG_FUNC(sys_http, cellHttpClientSetCookieRecvCallback); - - REG_FUNC(sys_http, cellHttpCreateClient); - REG_FUNC(sys_http, cellHttpDestroyClient); - REG_FUNC(sys_http, cellHttpClientSetAuthenticationCallback); - REG_FUNC(sys_http, cellHttpClientSetTransactionStateCallback); - REG_FUNC(sys_http, cellHttpClientSetRedirectCallback); - - REG_FUNC(sys_http, cellHttpClientSetProxy); - REG_FUNC(sys_http, cellHttpClientGetProxy); - REG_FUNC(sys_http, cellHttpClientSetVersion); - REG_FUNC(sys_http, cellHttpClientGetVersion); - REG_FUNC(sys_http, cellHttpClientSetPipeline); - REG_FUNC(sys_http, cellHttpClientGetPipeline); - REG_FUNC(sys_http, cellHttpClientSetKeepAlive); - REG_FUNC(sys_http, cellHttpClientGetKeepAlive); - REG_FUNC(sys_http, cellHttpClientSetAutoRedirect); - REG_FUNC(sys_http, cellHttpClientGetAutoRedirect); - REG_FUNC(sys_http, cellHttpClientSetAutoAuthentication); - REG_FUNC(sys_http, cellHttpClientGetAutoAuthentication); - REG_FUNC(sys_http, cellHttpClientSetAuthenticationCacheStatus); - REG_FUNC(sys_http, cellHttpClientGetAuthenticationCacheStatus); - REG_FUNC(sys_http, cellHttpClientSetCookieStatus); - REG_FUNC(sys_http, cellHttpClientGetCookieStatus); - REG_FUNC(sys_http, cellHttpClientSetUserAgent); - REG_FUNC(sys_http, cellHttpClientGetUserAgent); - REG_FUNC(sys_http, cellHttpClientSetResponseBufferMax); - REG_FUNC(sys_http, cellHttpClientGetResponseBufferMax); - - REG_FUNC(sys_http, cellHttpClientCloseAllConnections); - REG_FUNC(sys_http, cellHttpClientCloseConnections); - REG_FUNC(sys_http, cellHttpClientPollConnections); - REG_FUNC(sys_http, cellHttpClientSetRecvTimeout); - REG_FUNC(sys_http, cellHttpClientGetRecvTimeout); - REG_FUNC(sys_http, cellHttpClientSetSendTimeout); - REG_FUNC(sys_http, cellHttpClientGetSendTimeout); - REG_FUNC(sys_http, cellHttpClientSetConnTimeout); - REG_FUNC(sys_http, cellHttpClientGetConnTimeout); - REG_FUNC(sys_http, cellHttpClientSetTotalPoolSize); - REG_FUNC(sys_http, cellHttpClientGetTotalPoolSize); - REG_FUNC(sys_http, cellHttpClientSetPerHostPoolSize); - REG_FUNC(sys_http, cellHttpClientGetPerHostPoolSize); - REG_FUNC(sys_http, cellHttpClientSetPerHostKeepAliveMax); - REG_FUNC(sys_http, cellHttpClientGetPerHostKeepAliveMax); - REG_FUNC(sys_http, cellHttpClientSetPerPipelineMax); - REG_FUNC(sys_http, cellHttpClientGetPerPipelineMax); - REG_FUNC(sys_http, cellHttpClientSetRecvBufferSize); - REG_FUNC(sys_http, cellHttpClientGetRecvBufferSize); - //sys_http.AddFunc(, cellHttpClientSetSendBufferSize); - //sys_http.AddFunc(, cellHttpClientGetSendBufferSize); - - REG_FUNC(sys_http, cellHttpClientGetAllHeaders); - REG_FUNC(sys_http, cellHttpClientSetHeader); - REG_FUNC(sys_http, cellHttpClientGetHeader); - REG_FUNC(sys_http, cellHttpClientAddHeader); - REG_FUNC(sys_http, cellHttpClientDeleteHeader); - - REG_FUNC(sys_http, cellHttpClientSetSslCallback); - REG_FUNC(sys_http, cellHttpClientSetSslClientCertificate); - - REG_FUNC(sys_http, cellHttpCreateTransaction); - REG_FUNC(sys_http, cellHttpDestroyTransaction); - REG_FUNC(sys_http, cellHttpTransactionGetUri); - REG_FUNC(sys_http, cellHttpTransactionCloseConnection); - REG_FUNC(sys_http, cellHttpTransactionReleaseConnection); - REG_FUNC(sys_http, cellHttpTransactionAbortConnection); - - REG_FUNC(sys_http, cellHttpSendRequest); - REG_FUNC(sys_http, cellHttpRequestSetContentLength); - REG_FUNC(sys_http, cellHttpRequestGetContentLength); - REG_FUNC(sys_http, cellHttpRequestSetChunkedTransferStatus); - REG_FUNC(sys_http, cellHttpRequestGetChunkedTransferStatus); - REG_FUNC(sys_http, cellHttpRequestGetAllHeaders); - REG_FUNC(sys_http, cellHttpRequestSetHeader); - REG_FUNC(sys_http, cellHttpRequestGetHeader); - REG_FUNC(sys_http, cellHttpRequestAddHeader); - REG_FUNC(sys_http, cellHttpRequestDeleteHeader); - - REG_FUNC(sys_http, cellHttpRecvResponse); - REG_FUNC(sys_http, cellHttpResponseGetAllHeaders); - REG_FUNC(sys_http, cellHttpResponseGetHeader); - REG_FUNC(sys_http, cellHttpResponseGetContentLength); - REG_FUNC(sys_http, cellHttpResponseGetStatusCode); - REG_FUNC(sys_http, cellHttpResponseGetStatusLine); - - REG_FUNC(sys_http, cellHttpTransactionGetSslCipherName); - REG_FUNC(sys_http, cellHttpTransactionGetSslCipherId); - REG_FUNC(sys_http, cellHttpTransactionGetSslCipherVersion); - REG_FUNC(sys_http, cellHttpTransactionGetSslCipherBits); - REG_FUNC(sys_http, cellHttpTransactionGetSslCipherString); - REG_FUNC(sys_http, cellHttpTransactionGetSslVersion); - REG_FUNC(sys_http, cellHttpTransactionGetSslId); - - REG_FUNC(sys_http, cellHttpClientSetSslVersion); - REG_FUNC(sys_http, cellHttpClientGetSslVersion); - REG_FUNC(sys_http, cellHttpClientSetSslIdDestroyCallback); -} -#endif diff --git a/rpcs3/Emu/SysCalls/Modules/sys_io.cpp b/rpcs3/Emu/SysCalls/Modules/sys_io.cpp index 35f019dd52..dd7f0afd00 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_io.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_io.cpp @@ -7,9 +7,48 @@ extern void cellPad_init(); extern void cellKb_init(); extern void cellMouse_init(); + +s32 sys_config_start() +{ + throw EXCEPTION(""); +} + +s32 sys_config_stop() +{ + throw EXCEPTION(""); +} + +s32 sys_config_add_service_listener() +{ + throw EXCEPTION(""); +} + +s32 sys_config_remove_service_listener() +{ + throw EXCEPTION(""); +} + +s32 sys_config_register_service() +{ + throw EXCEPTION(""); +} + +s32 sys_config_unregister_service() +{ + throw EXCEPTION(""); +} + + Module sys_io("sys_io", []() { cellPad_init(); cellKb_init(); cellMouse_init(); + + REG_FUNC(sys_io, sys_config_start); + REG_FUNC(sys_io, sys_config_stop); + REG_FUNC(sys_io, sys_config_add_service_listener); + REG_FUNC(sys_io, sys_config_remove_service_listener); + REG_FUNC(sys_io, sys_config_register_service); + REG_FUNC(sys_io, sys_config_unregister_service); }); diff --git a/rpcs3/Emu/SysCalls/Modules/sys_libc.cpp b/rpcs3/Emu/SysCalls/Modules/sys_libc.cpp index 7f824b27ff..ef7ee9b871 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_libc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_libc.cpp @@ -4,10 +4,141 @@ #include "Emu/SysCalls/Modules.h" #include "Emu/Cell/PPUInstrTable.h" -namespace vm { using namespace ps3; } - extern Module sys_libc; +std::string ps3_fmt(PPUThread& context, vm::cptr fmt, u32 g_count, u32 f_count, u32 v_count) +{ + std::string result; + + for (char c = *fmt++; c; c = *fmt++) + { + switch (c) + { + case '%': + { + const auto start = fmt - 1; + + // read flags + const bool plus_sign = *fmt == '+' ? fmt++, true : false; + const bool minus_sign = *fmt == '-' ? fmt++, true : false; + const bool space_sign = *fmt == ' ' ? fmt++, true : false; + const bool number_sign = *fmt == '#' ? fmt++, true : false; + const bool zero_padding = *fmt == '0' ? fmt++, true : false; + + // read width + const u32 width = [&]() -> u32 + { + u32 width = 0; + + if (*fmt == '*') + { + fmt++; + return context.get_next_gpr_arg(g_count, f_count, v_count); + } + + while (*fmt - '0' < 10) + { + width = width * 10 + (*fmt++ - '0'); + } + + return width; + }(); + + // read precision + const u32 prec = [&]() -> u32 + { + u32 prec = 0; + + if (*fmt != '.') + { + return 0; + } + + if (*++fmt == '*') + { + fmt++; + return context.get_next_gpr_arg(g_count, f_count, v_count); + } + + while (*fmt - '0' < 10) + { + prec = prec * 10 + (*fmt++ - '0'); + } + + return prec; + }(); + + switch (char cf = *fmt++) + { + case '%': + { + if (plus_sign || minus_sign || space_sign || number_sign || zero_padding || width || prec) break; + + result += '%'; + continue; + } + case 'd': + case 'i': + { + // signed decimal + const s64 value = context.get_next_gpr_arg(g_count, f_count, v_count); + + if (plus_sign || minus_sign || space_sign || number_sign || zero_padding || width || prec) break; + + result += fmt::to_sdec(value); + continue; + } + case 'x': + case 'X': + { + // hexadecimal + const u64 value = context.get_next_gpr_arg(g_count, f_count, v_count); + + if (plus_sign || minus_sign || space_sign || prec) break; + + if (number_sign && value) + { + result += cf == 'x' ? "0x" : "0X"; + } + + const std::string& hex = cf == 'x' ? fmt::to_hex(value) : fmt::toupper(fmt::to_hex(value)); + + if (hex.length() >= width) + { + result += hex; + } + else if (zero_padding) + { + result += std::string(width - hex.length(), '0') + hex; + } + else + { + result += hex + std::string(width - hex.length(), ' '); + } + continue; + } + case 's': + { + // string + auto string = vm::cptr::make(context.get_next_gpr_arg(g_count, f_count, v_count)); + + if (plus_sign || minus_sign || space_sign || number_sign || zero_padding || width || prec) break; + + result += string.get_ptr(); + continue; + } + } + + throw EXCEPTION("Unknown formatting: '%s'", start.get_ptr()); + } + } + + result += c; + } + + return result; +} + namespace sys_libc_func { void memcpy(vm::ptr dst, vm::cptr src, u32 size) @@ -18,18 +149,269 @@ namespace sys_libc_func } } +extern Module sysPrxForUser; + +vm::ptr _sys_memset(vm::ptr dst, s32 value, u32 size) +{ + sysPrxForUser.Log("_sys_memset(dst=*0x%x, value=%d, size=0x%x)", dst, value, size); + + memset(dst.get_ptr(), value, size); + + return dst; +} + +vm::ptr _sys_memcpy(vm::ptr dst, vm::cptr src, u32 size) +{ + sysPrxForUser.Log("_sys_memcpy(dst=*0x%x, src=*0x%x, size=0x%x)", dst, src, size); + + memcpy(dst.get_ptr(), src.get_ptr(), size); + + return dst; +} + +s32 _sys_memcmp(vm::cptr buf1, vm::cptr buf2, u32 size) +{ + sysPrxForUser.Log("_sys_memcmp(buf1=*0x%x, buf2=*0x%x, size=%d)", buf1, buf2, size); + + return memcmp(buf1.get_ptr(), buf2.get_ptr(), size); +} + +s32 _sys_memchr() +{ + throw EXCEPTION(""); +} + +s32 _sys_memmove() +{ + throw EXCEPTION(""); +} + +s64 _sys_strlen(vm::cptr str) +{ + sysPrxForUser.Log("_sys_strlen(str=*0x%x)", str); + + return strlen(str.get_ptr()); +} + +s32 _sys_strcmp(vm::cptr str1, vm::cptr str2) +{ + sysPrxForUser.Log("_sys_strcmp(str1=*0x%x, str2=*0x%x)", str1, str2); + + return strcmp(str1.get_ptr(), str2.get_ptr()); +} + +s32 _sys_strncmp(vm::cptr str1, vm::cptr str2, s32 max) +{ + sysPrxForUser.Log("_sys_strncmp(str1=*0x%x, str2=*0x%x, max=%d)", str1, str2, max); + + return strncmp(str1.get_ptr(), str2.get_ptr(), max); +} + +vm::ptr _sys_strcat(vm::ptr dest, vm::cptr source) +{ + sysPrxForUser.Log("_sys_strcat(dest=*0x%x, source=*0x%x)", dest, source); + + if (strcat(dest.get_ptr(), source.get_ptr()) != dest.get_ptr()) + { + throw EXCEPTION("Unexpected strcat() result"); + } + + return dest; +} + +vm::cptr _sys_strchr(vm::cptr str, s32 ch) +{ + sysPrxForUser.Log("_sys_strchr(str=*0x%x, ch=0x%x)", str, ch); + + return vm::cptr::make(vm::get_addr(strchr(str.get_ptr(), ch))); +} + +vm::ptr _sys_strncat(vm::ptr dest, vm::cptr source, u32 len) +{ + sysPrxForUser.Log("_sys_strncat(dest=*0x%x, source=*0x%x, len=%d)", dest, source, len); + + if (strncat(dest.get_ptr(), source.get_ptr(), len) != dest.get_ptr()) + { + throw EXCEPTION("Unexpected strncat() result"); + } + + return dest; +} + +vm::ptr _sys_strcpy(vm::ptr dest, vm::cptr source) +{ + sysPrxForUser.Log("_sys_strcpy(dest=*0x%x, source=*0x%x)", dest, source); + + if (strcpy(dest.get_ptr(), source.get_ptr()) != dest.get_ptr()) + { + throw EXCEPTION("Unexpected strcpy() result"); + } + + return dest; +} + +vm::ptr _sys_strncpy(vm::ptr dest, vm::cptr source, u32 len) +{ + sysPrxForUser.Log("_sys_strncpy(dest=*0x%x, source=*0x%x, len=%d)", dest, source, len); + + if (!dest || !source) + { + return vm::null; + } + + if (strncpy(dest.get_ptr(), source.get_ptr(), len) != dest.get_ptr()) + { + throw EXCEPTION("Unexpected strncpy() result"); + } + + return dest; +} + +s32 _sys_strncasecmp() +{ + throw EXCEPTION(""); +} + +s32 _sys_strrchr() +{ + throw EXCEPTION(""); +} + +s32 _sys_tolower() +{ + throw EXCEPTION(""); +} + +s32 _sys_toupper() +{ + throw EXCEPTION(""); +} + +u32 _sys_malloc(u32 size) +{ + sysPrxForUser.Warning("_sys_malloc(size=0x%x)", size); + + return vm::alloc(size, vm::main); +} + +u32 _sys_memalign(u32 align, u32 size) +{ + sysPrxForUser.Warning("_sys_memalign(align=0x%x, size=0x%x)", align, size); + + return vm::alloc(size, vm::main, std::max(align, 4096)); +} + +s32 _sys_free(u32 addr) +{ + sysPrxForUser.Warning("_sys_free(addr=0x%x)", addr); + + vm::dealloc(addr, vm::main); + + return CELL_OK; +} + +s32 _sys_snprintf(PPUThread& ppu, vm::ptr dst, u32 count, vm::cptr fmt, ppu_va_args_t va_args) +{ + sysPrxForUser.Warning("_sys_snprintf(dst=*0x%x, count=%d, fmt=*0x%x, ...)", dst, count, fmt); + + std::string result = ps3_fmt(ppu, fmt, va_args.g_count, va_args.f_count, va_args.v_count); + + sysPrxForUser.Warning("*** '%s' -> '%s'", fmt.get_ptr(), result); + + if (!count) + { + return 0; // ??? + } + else + { + count = (u32)std::min(count - 1, result.size()); + + memcpy(dst.get_ptr(), result.c_str(), count); + dst[count] = 0; + return count; + } +} + +s32 _sys_printf(vm::cptr fmt, ppu_va_args_t va_args) +{ + sysPrxForUser.Todo("_sys_printf(fmt=*0x%x, ...)", fmt); + + // probably, assertion failed + throw EXCEPTION("%s", fmt.get_ptr()); +} + +s32 _sys_sprintf() +{ + throw EXCEPTION(""); +} + +s32 _sys_vprintf() +{ + throw EXCEPTION(""); +} + +s32 _sys_vsnprintf() +{ + throw EXCEPTION(""); +} + +s32 _sys_vsprintf() +{ + throw EXCEPTION(""); +} + +s32 _sys_qsort() +{ + throw EXCEPTION(""); +} + +void sysPrxForUser_sys_libc_init() +{ + REG_FUNC(sysPrxForUser, _sys_memset); + REG_FUNC(sysPrxForUser, _sys_memcpy); + REG_FUNC(sysPrxForUser, _sys_memcmp); + REG_FUNC(sysPrxForUser, _sys_memchr); + REG_FUNC(sysPrxForUser, _sys_memmove); + + REG_FUNC(sysPrxForUser, _sys_strlen); + REG_FUNC(sysPrxForUser, _sys_strcmp); + REG_FUNC(sysPrxForUser, _sys_strncmp); + REG_FUNC(sysPrxForUser, _sys_strcat); + REG_FUNC(sysPrxForUser, _sys_strchr); + REG_FUNC(sysPrxForUser, _sys_strncat); + REG_FUNC(sysPrxForUser, _sys_strcpy); + REG_FUNC(sysPrxForUser, _sys_strncpy); + REG_FUNC(sysPrxForUser, _sys_strncasecmp); + REG_FUNC(sysPrxForUser, _sys_strrchr); + REG_FUNC(sysPrxForUser, _sys_tolower); + REG_FUNC(sysPrxForUser, _sys_toupper); + + REG_FUNC(sysPrxForUser, _sys_malloc); + REG_FUNC(sysPrxForUser, _sys_memalign); + REG_FUNC(sysPrxForUser, _sys_free); + + REG_FUNC(sysPrxForUser, _sys_snprintf); + REG_FUNC(sysPrxForUser, _sys_printf); + REG_FUNC(sysPrxForUser, _sys_sprintf); + REG_FUNC(sysPrxForUser, _sys_vprintf); + REG_FUNC(sysPrxForUser, _sys_vsnprintf); + REG_FUNC(sysPrxForUser, _sys_vsprintf); + + REG_FUNC(sysPrxForUser, _sys_qsort); +} + Module sys_libc("sys_libc", []() { using namespace PPU_instr; - REG_SUB(sys_libc, "", sys_libc_func, memcpy, - se_op(CMPLDI(cr7, r5, 7)), - se_op(CLRLDI(r3, r3, 32)), - se_op(CLRLDI(r4, r4, 32)), - se_op(MR(r11, r3)), - se_op(BGT(cr7, XXX & 0xff)), - se_op(CMPDI(r5, 0)), - se_opt_op(MR(r9, r3)), + REG_SUB(sys_libc, sys_libc_func, memcpy, + SP_I(CMPLDI(cr7, r5, 7)), + SP_I(CLRLDI(r3, r3, 32)), + SP_I(CLRLDI(r4, r4, 32)), + SP_I(MR(r11, r3)), + SP_I(BGT(cr7, XXX & 0xff)), + SP_I(CMPDI(r5, 0)), + OPT_SP_I(MR(r9, r3)), { SPET_MASKED_OPCODE, 0x4d820020, 0xffffffff }, ); }); diff --git a/rpcs3/Emu/SysCalls/Modules/sys_lv2dbg.h b/rpcs3/Emu/SysCalls/Modules/sys_lv2dbg.h index 04a786d0dd..5661690945 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_lv2dbg.h +++ b/rpcs3/Emu/SysCalls/Modules/sys_lv2dbg.h @@ -252,7 +252,7 @@ struct sys_dbg_event_flag_information_t be_t wait_all_threads_num; }; -using dbg_exception_handler_t = func_def; +using dbg_exception_handler_t = void(u64 exception_type, u64 thread_id, u64 dar); enum : u64 { diff --git a/rpcs3/Emu/SysCalls/Modules/sys_lwcond_.cpp b/rpcs3/Emu/SysCalls/Modules/sys_lwcond_.cpp new file mode 100644 index 0000000000..d2d714a0c5 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/sys_lwcond_.cpp @@ -0,0 +1,293 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/IdManager.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" + +#include "Emu/SysCalls/lv2/sys_lwmutex.h" +#include "Emu/SysCalls/lv2/sys_lwcond.h" +#include "sysPrxForUser.h" + +extern Module sysPrxForUser; + +s32 sys_lwcond_create(vm::ptr lwcond, vm::ptr lwmutex, vm::ptr attr) +{ + sysPrxForUser.Warning("sys_lwcond_create(lwcond=*0x%x, lwmutex=*0x%x, attr=*0x%x)", lwcond, lwmutex, attr); + + lwcond->lwcond_queue = Emu.GetIdManager().make(attr->name_u64); + lwcond->lwmutex = lwmutex; + + return CELL_OK; +} + +s32 sys_lwcond_destroy(vm::ptr lwcond) +{ + sysPrxForUser.Log("sys_lwcond_destroy(lwcond=*0x%x)", lwcond); + + const s32 res = _sys_lwcond_destroy(lwcond->lwcond_queue); + + if (res == CELL_OK) + { + lwcond->lwcond_queue = lwmutex_dead; + } + + return res; +} + +s32 sys_lwcond_signal(PPUThread& ppu, vm::ptr lwcond) +{ + sysPrxForUser.Log("sys_lwcond_signal(lwcond=*0x%x)", lwcond); + + const vm::ptr lwmutex = lwcond->lwmutex; + + if ((lwmutex->attribute & SYS_SYNC_ATTR_PROTOCOL_MASK) == SYS_SYNC_RETRY) + { + // TODO (protocol ignored) + //return _sys_lwcond_signal(lwcond->lwcond_queue, 0, -1, 2); + } + + if (lwmutex->vars.owner.load() == ppu.get_id()) + { + // if owns the mutex + lwmutex->all_info++; + + // call the syscall + if (s32 res = _sys_lwcond_signal(lwcond->lwcond_queue, lwmutex->sleep_queue, -1, 1)) + { + lwmutex->all_info--; + + return res == CELL_EPERM ? CELL_OK : res; + } + + return CELL_OK; + } + + if (s32 res = sys_lwmutex_trylock(ppu, lwmutex)) + { + // if locking failed + + if (res != CELL_EBUSY) + { + return CELL_ESRCH; + } + + // call the syscall + return _sys_lwcond_signal(lwcond->lwcond_queue, 0, -1, 2); + } + + // if locking succeeded + lwmutex->all_info++; + + // call the syscall + if (s32 res = _sys_lwcond_signal(lwcond->lwcond_queue, lwmutex->sleep_queue, -1, 3)) + { + lwmutex->all_info--; + + // unlock the lightweight mutex + sys_lwmutex_unlock(ppu, lwmutex); + + return res == CELL_ENOENT ? CELL_OK : res; + } + + return CELL_OK; +} + +s32 sys_lwcond_signal_all(PPUThread& ppu, vm::ptr lwcond) +{ + sysPrxForUser.Log("sys_lwcond_signal_all(lwcond=*0x%x)", lwcond); + + const vm::ptr lwmutex = lwcond->lwmutex; + + if ((lwmutex->attribute & SYS_SYNC_ATTR_PROTOCOL_MASK) == SYS_SYNC_RETRY) + { + // TODO (protocol ignored) + //return _sys_lwcond_signal_all(lwcond->lwcond_queue, lwmutex->sleep_queue, 2); + } + + if (lwmutex->vars.owner.load() == ppu.get_id()) + { + // if owns the mutex, call the syscall + const s32 res = _sys_lwcond_signal_all(lwcond->lwcond_queue, lwmutex->sleep_queue, 1); + + if (res <= 0) + { + // return error or CELL_OK + return res; + } + + lwmutex->all_info += res; + + return CELL_OK; + } + + if (s32 res = sys_lwmutex_trylock(ppu, lwmutex)) + { + // if locking failed + + if (res != CELL_EBUSY) + { + return CELL_ESRCH; + } + + // call the syscall + return _sys_lwcond_signal_all(lwcond->lwcond_queue, lwmutex->sleep_queue, 2); + } + + // if locking succeeded, call the syscall + s32 res = _sys_lwcond_signal_all(lwcond->lwcond_queue, lwmutex->sleep_queue, 1); + + if (res > 0) + { + lwmutex->all_info += res; + + res = CELL_OK; + } + + // unlock mutex + sys_lwmutex_unlock(ppu, lwmutex); + + return res; +} + +s32 sys_lwcond_signal_to(PPUThread& ppu, vm::ptr lwcond, u32 ppu_thread_id) +{ + sysPrxForUser.Log("sys_lwcond_signal_to(lwcond=*0x%x, ppu_thread_id=0x%x)", lwcond, ppu_thread_id); + + const vm::ptr lwmutex = lwcond->lwmutex; + + if ((lwmutex->attribute & SYS_SYNC_ATTR_PROTOCOL_MASK) == SYS_SYNC_RETRY) + { + // TODO (protocol ignored) + //return _sys_lwcond_signal(lwcond->lwcond_queue, 0, ppu_thread_id, 2); + } + + if (lwmutex->vars.owner.load() == ppu.get_id()) + { + // if owns the mutex + lwmutex->all_info++; + + // call the syscall + if (s32 res = _sys_lwcond_signal(lwcond->lwcond_queue, lwmutex->sleep_queue, ppu_thread_id, 1)) + { + lwmutex->all_info--; + + return res; + } + + return CELL_OK; + } + + if (s32 res = sys_lwmutex_trylock(ppu, lwmutex)) + { + // if locking failed + + if (res != CELL_EBUSY) + { + return CELL_ESRCH; + } + + // call the syscall + return _sys_lwcond_signal(lwcond->lwcond_queue, 0, ppu_thread_id, 2); + } + + // if locking succeeded + lwmutex->all_info++; + + // call the syscall + if (s32 res = _sys_lwcond_signal(lwcond->lwcond_queue, lwmutex->sleep_queue, ppu_thread_id, 3)) + { + lwmutex->all_info--; + + // unlock the lightweight mutex + sys_lwmutex_unlock(ppu, lwmutex); + + return res; + } + + return CELL_OK; +} + +s32 sys_lwcond_wait(PPUThread& ppu, vm::ptr lwcond, u64 timeout) +{ + sysPrxForUser.Log("sys_lwcond_wait(lwcond=*0x%x, timeout=0x%llx)", lwcond, timeout); + + const be_t tid = ppu.get_id(); + + const vm::ptr lwmutex = lwcond->lwmutex; + + if (lwmutex->vars.owner.load() != tid) + { + // if not owner of the mutex + return CELL_EPERM; + } + + // save old recursive value + const be_t recursive_value = lwmutex->recursive_count; + + // set special value + lwmutex->vars.owner = { lwmutex_reserved }; + lwmutex->recursive_count = 0; + + // call the syscall + s32 res = _sys_lwcond_queue_wait(ppu, lwcond->lwcond_queue, lwmutex->sleep_queue, timeout); + + if (res == CELL_OK || res == CELL_ESRCH) + { + if (res == CELL_OK) + { + lwmutex->all_info--; + } + + // restore owner and recursive value + const auto old = lwmutex->vars.owner.exchange(tid); + lwmutex->recursive_count = recursive_value; + + if (old != lwmutex_reserved) + { + throw EXCEPTION("Locking failed (lwmutex=*0x%x, owner=0x%x)", lwmutex, old); + } + + return res; + } + + if (res == CELL_EBUSY || res == CELL_ETIMEDOUT) + { + const s32 res2 = sys_lwmutex_lock(ppu, lwmutex, 0); + + if (res2 == CELL_OK) + { + // if successfully locked, restore recursive value + lwmutex->recursive_count = recursive_value; + + return res == CELL_EBUSY ? CELL_OK : res; + } + + return res2; + } + + if (res == CELL_EDEADLK) + { + // restore owner and recursive value + const auto old = lwmutex->vars.owner.exchange(tid); + lwmutex->recursive_count = recursive_value; + + if (old != lwmutex_reserved) + { + throw EXCEPTION("Locking failed (lwmutex=*0x%x, owner=0x%x)", lwmutex, old); + } + + return CELL_ETIMEDOUT; + } + + throw EXCEPTION("Unexpected syscall result (lwcond=*0x%x, result=0x%x)", lwcond, res); +} + +void sysPrxForUser_sys_lwcond_init() +{ + REG_FUNC(sysPrxForUser, sys_lwcond_create); + REG_FUNC(sysPrxForUser, sys_lwcond_destroy); + REG_FUNC(sysPrxForUser, sys_lwcond_signal); + REG_FUNC(sysPrxForUser, sys_lwcond_signal_all); + REG_FUNC(sysPrxForUser, sys_lwcond_signal_to); + REG_FUNC(sysPrxForUser, sys_lwcond_wait); +} diff --git a/rpcs3/Emu/SysCalls/Modules/sys_lwmutex_.cpp b/rpcs3/Emu/SysCalls/Modules/sys_lwmutex_.cpp new file mode 100644 index 0000000000..209aa86a6e --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/sys_lwmutex_.cpp @@ -0,0 +1,287 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/IdManager.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" + +#include "Emu/SysCalls/lv2/sys_lwmutex.h" +#include "sysPrxForUser.h" + +extern Module sysPrxForUser; + +s32 sys_lwmutex_create(vm::ptr lwmutex, vm::ptr attr) +{ + sysPrxForUser.Warning("sys_lwmutex_create(lwmutex=*0x%x, attr=*0x%x)", lwmutex, attr); + + const bool recursive = attr->recursive == SYS_SYNC_RECURSIVE; + + if (!recursive && attr->recursive != SYS_SYNC_NOT_RECURSIVE) + { + sysPrxForUser.Error("sys_lwmutex_create(): invalid recursive attribute (0x%x)", attr->recursive); + return CELL_EINVAL; + } + + const u32 protocol = attr->protocol; + + switch (protocol) + { + case SYS_SYNC_FIFO: break; + case SYS_SYNC_RETRY: break; + case SYS_SYNC_PRIORITY: break; + default: sysPrxForUser.Error("sys_lwmutex_create(): invalid protocol (0x%x)", protocol); return CELL_EINVAL; + } + + lwmutex->lock_var = { { lwmutex_free, 0 } }; + lwmutex->attribute = attr->recursive | attr->protocol; + lwmutex->recursive_count = 0; + lwmutex->sleep_queue = Emu.GetIdManager().make(protocol, attr->name_u64); + + return CELL_OK; +} + +s32 sys_lwmutex_destroy(PPUThread& ppu, vm::ptr lwmutex) +{ + sysPrxForUser.Log("sys_lwmutex_destroy(lwmutex=*0x%x)", lwmutex); + + // check to prevent recursive locking in the next call + if (lwmutex->vars.owner.load() == ppu.get_id()) + { + return CELL_EBUSY; + } + + // attempt to lock the mutex + if (s32 res = sys_lwmutex_trylock(ppu, lwmutex)) + { + return res; + } + + // call the syscall + if (s32 res = _sys_lwmutex_destroy(lwmutex->sleep_queue)) + { + // unlock the mutex if failed + sys_lwmutex_unlock(ppu, lwmutex); + + return res; + } + + // deleting succeeded + lwmutex->vars.owner.exchange(lwmutex_dead); + + return CELL_OK; +} + +s32 sys_lwmutex_lock(PPUThread& ppu, vm::ptr lwmutex, u64 timeout) +{ + sysPrxForUser.Log("sys_lwmutex_lock(lwmutex=*0x%x, timeout=0x%llx)", lwmutex, timeout); + + const be_t tid = ppu.get_id(); + + // try to lock lightweight mutex + const be_t old_owner = lwmutex->vars.owner.compare_and_swap(lwmutex_free, tid); + + if (old_owner == lwmutex_free) + { + // locking succeeded + return CELL_OK; + } + + if (old_owner.data() == tid.data()) + { + // recursive locking + + if ((lwmutex->attribute & SYS_SYNC_RECURSIVE) == 0) + { + // if not recursive + return CELL_EDEADLK; + } + + if (lwmutex->recursive_count.data() == -1) + { + // if recursion limit reached + return CELL_EKRESOURCE; + } + + // recursive locking succeeded + lwmutex->recursive_count++; + _mm_mfence(); + + return CELL_OK; + } + + if (old_owner == lwmutex_dead) + { + // invalid or deleted mutex + return CELL_EINVAL; + } + + for (u32 i = 0; i < 300; i++) + { + if (lwmutex->vars.owner.load() == lwmutex_free) + { + if (lwmutex->vars.owner.compare_and_swap_test(lwmutex_free, tid)) + { + // locking succeeded + return CELL_OK; + } + } + } + + // atomically increment waiter value using 64 bit op + lwmutex->all_info++; + + if (lwmutex->vars.owner.compare_and_swap_test(lwmutex_free, tid)) + { + // locking succeeded + lwmutex->all_info--; + + return CELL_OK; + } + + // lock using the syscall + const s32 res = _sys_lwmutex_lock(ppu, lwmutex->sleep_queue, timeout); + + lwmutex->all_info--; + + if (res == CELL_OK) + { + // locking succeeded + auto old = lwmutex->vars.owner.exchange(tid); + + if (old != lwmutex_reserved) + { + throw EXCEPTION("Locking failed (lwmutex=*0x%x, owner=0x%x)", lwmutex, old); + } + + return CELL_OK; + } + + if (res == CELL_EBUSY && lwmutex->attribute & SYS_SYNC_RETRY) + { + // TODO (protocol is ignored in current implementation) + throw EXCEPTION(""); + } + + return res; +} + +s32 sys_lwmutex_trylock(PPUThread& ppu, vm::ptr lwmutex) +{ + sysPrxForUser.Log("sys_lwmutex_trylock(lwmutex=*0x%x)", lwmutex); + + const be_t tid = ppu.get_id(); + + // try to lock lightweight mutex + const be_t old_owner = lwmutex->vars.owner.compare_and_swap(lwmutex_free, tid); + + if (old_owner == lwmutex_free) + { + // locking succeeded + return CELL_OK; + } + + if (old_owner.data() == tid.data()) + { + // recursive locking + + if ((lwmutex->attribute & SYS_SYNC_RECURSIVE) == 0) + { + // if not recursive + return CELL_EDEADLK; + } + + if (lwmutex->recursive_count.data() == -1) + { + // if recursion limit reached + return CELL_EKRESOURCE; + } + + // recursive locking succeeded + lwmutex->recursive_count++; + _mm_mfence(); + + return CELL_OK; + } + + if (old_owner == lwmutex_dead) + { + // invalid or deleted mutex + return CELL_EINVAL; + } + + if (old_owner == lwmutex_reserved) + { + // should be locked by the syscall + const s32 res = _sys_lwmutex_trylock(lwmutex->sleep_queue); + + if (res == CELL_OK) + { + // locking succeeded + auto old = lwmutex->vars.owner.exchange(tid); + + if (old != lwmutex_reserved) + { + throw EXCEPTION("Locking failed (lwmutex=*0x%x, owner=0x%x)", lwmutex, old); + } + } + + return res; + } + + // locked by another thread + return CELL_EBUSY; +} + +s32 sys_lwmutex_unlock(PPUThread& ppu, vm::ptr lwmutex) +{ + sysPrxForUser.Log("sys_lwmutex_unlock(lwmutex=*0x%x)", lwmutex); + + const be_t tid = ppu.get_id(); + + // check owner + if (lwmutex->vars.owner.load() != tid) + { + return CELL_EPERM; + } + + if (lwmutex->recursive_count.data()) + { + // recursive unlocking succeeded + lwmutex->recursive_count--; + + return CELL_OK; + } + + // ensure that waiter is zero + if (lwmutex->lock_var.compare_and_swap_test({ tid, 0 }, { lwmutex_free, 0 })) + { + // unlocking succeeded + return CELL_OK; + } + + if (lwmutex->attribute & SYS_SYNC_RETRY) + { + // TODO (protocol is ignored in current implementation) + } + + // set special value + lwmutex->vars.owner.exchange(lwmutex_reserved); + + // call the syscall + if (_sys_lwmutex_unlock(lwmutex->sleep_queue) == CELL_ESRCH) + { + return CELL_ESRCH; + } + + return CELL_OK; +} + +u32 g_ppu_func_index__sys_lwmutex_unlock; // test + +void sysPrxForUser_sys_lwmutex_init() +{ + REG_FUNC(sysPrxForUser, sys_lwmutex_create); + REG_FUNC(sysPrxForUser, sys_lwmutex_destroy); + REG_FUNC(sysPrxForUser, sys_lwmutex_lock); + REG_FUNC(sysPrxForUser, sys_lwmutex_trylock); + g_ppu_func_index__sys_lwmutex_unlock = REG_FUNC(sysPrxForUser, sys_lwmutex_unlock); // test +} diff --git a/rpcs3/Emu/SysCalls/Modules/sys_mempool.cpp b/rpcs3/Emu/SysCalls/Modules/sys_mempool.cpp new file mode 100644 index 0000000000..0b76cd3943 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/sys_mempool.cpp @@ -0,0 +1,49 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" + +#include "sysPrxForUser.h" + +extern Module sysPrxForUser; + +s32 sys_mempool_allocate_block() +{ + throw EXCEPTION(""); +} + +s32 sys_mempool_create() +{ + throw EXCEPTION(""); +} + +s32 sys_mempool_destroy() +{ + throw EXCEPTION(""); +} + +s32 sys_mempool_free_block() +{ + throw EXCEPTION(""); +} + +s32 sys_mempool_get_count() +{ + throw EXCEPTION(""); +} + +s32 sys_mempool_try_allocate_block() +{ + throw EXCEPTION(""); +} + + +void sysPrxForUser_sys_mempool_init() +{ + REG_FUNC(sysPrxForUser, sys_mempool_allocate_block); + REG_FUNC(sysPrxForUser, sys_mempool_create); + REG_FUNC(sysPrxForUser, sys_mempool_destroy); + REG_FUNC(sysPrxForUser, sys_mempool_free_block); + REG_FUNC(sysPrxForUser, sys_mempool_get_count); + REG_FUNC(sysPrxForUser, sys_mempool_try_allocate_block); +} diff --git a/rpcs3/Emu/SysCalls/Modules/sys_mmapper_.cpp b/rpcs3/Emu/SysCalls/Modules/sys_mmapper_.cpp new file mode 100644 index 0000000000..89c2fce1fe --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/sys_mmapper_.cpp @@ -0,0 +1,19 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" + +#include "Emu/SysCalls/lv2/sys_mmapper.h" +#include "sysPrxForUser.h" + +extern Module sysPrxForUser; + +void sysPrxForUser_sys_mmapper_init() +{ + // TODO: split syscalls and liblv2 functions + REG_FUNC(sysPrxForUser, sys_mmapper_allocate_memory); + REG_FUNC(sysPrxForUser, sys_mmapper_allocate_memory_from_container); + REG_FUNC(sysPrxForUser, sys_mmapper_map_memory); + REG_FUNC(sysPrxForUser, sys_mmapper_unmap_memory); + REG_FUNC(sysPrxForUser, sys_mmapper_free_memory); +} diff --git a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp index eb01d24b88..0d039d8b73 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp @@ -364,8 +364,7 @@ namespace sys_net_func s32 socketselect(s32 nfds, vm::ptr readfds, vm::ptr writefds, vm::ptr exceptfds, vm::ptr timeout) { - sys_net.Warning("socketselect(nfds=%d, readfds_addr=0x%x, writefds_addr=0x%x, exceptfds_addr=0x%x, timeout_addr=0x%x)", - nfds, readfds.addr(), writefds.addr(), exceptfds.addr(), timeout.addr()); + sys_net.Warning("socketselect(nfds=%d, readfds=*0x%x, writefds=*0x%x, exceptfds=*0x%x, timeout=*0x%x)", nfds, readfds, writefds, exceptfds, timeout); timeval _timeout; diff --git a/rpcs3/Emu/SysCalls/Modules/sys_net.h b/rpcs3/Emu/SysCalls/Modules/sys_net.h index b42ac38e3e..070f161d1b 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_net.h +++ b/rpcs3/Emu/SysCalls/Modules/sys_net.h @@ -38,6 +38,6 @@ struct sys_net_fd_set struct sys_net_timeval { - be_t tv_sec; - be_t tv_usec; -}; \ No newline at end of file + be_t tv_sec; + be_t tv_usec; +}; diff --git a/rpcs3/Emu/SysCalls/Modules/sys_ppu_thread_.cpp b/rpcs3/Emu/SysCalls/Modules/sys_ppu_thread_.cpp new file mode 100644 index 0000000000..c91521c9d6 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/sys_ppu_thread_.cpp @@ -0,0 +1,88 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" + +#include "Emu/SysCalls/lv2/sys_ppu_thread.h" +#include "sysPrxForUser.h" + +extern Module sysPrxForUser; + +s32 sys_ppu_thread_create(PPUThread& ppu, vm::ptr thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, vm::cptr threadname) +{ + sysPrxForUser.Warning("sys_ppu_thread_create(thread_id=*0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname=*0x%x)", thread_id, entry, arg, prio, stacksize, flags, threadname); + + // (allocate TLS) + // (return CELL_ENOMEM if failed) + // ... + + vm::stackvar attr(ppu); + + attr->entry = entry; + attr->tls = 0; + + // call the syscall + if (s32 res = _sys_ppu_thread_create(thread_id, attr, arg, 0, prio, stacksize, flags, threadname)) + { + return res; + } + + // run the thread + return flags & SYS_PPU_THREAD_CREATE_INTERRUPT ? CELL_OK : sys_ppu_thread_start(static_cast(*thread_id)); +} + +s32 sys_ppu_thread_get_id(PPUThread& ppu, vm::ptr thread_id) +{ + sysPrxForUser.Log("sys_ppu_thread_get_id(thread_id=*0x%x)", thread_id); + + *thread_id = ppu.get_id(); + + return CELL_OK; +} + +void sys_ppu_thread_exit(PPUThread& ppu, u64 val) +{ + sysPrxForUser.Log("sys_ppu_thread_exit(val=0x%llx)", val); + + // (call registered atexit functions) + // (deallocate TLS) + // ... + + // call the syscall + _sys_ppu_thread_exit(ppu, val); +} + +std::mutex g_once_mutex; + +void sys_ppu_thread_once(PPUThread& ppu, vm::ptr> once_ctrl, vm::ptr init) +{ + sysPrxForUser.Warning("sys_ppu_thread_once(once_ctrl=*0x%x, init=*0x%x)", once_ctrl, init); + + std::lock_guard lock(g_once_mutex); + + if (once_ctrl->compare_and_swap_test(SYS_PPU_THREAD_ONCE_INIT, SYS_PPU_THREAD_DONE_INIT)) + { + // call init function using current thread context + init(ppu); + } +} + +s32 sys_ppu_thread_register_atexit() +{ + throw EXCEPTION(""); +} + +s32 sys_ppu_thread_unregister_atexit() +{ + throw EXCEPTION(""); +} + +void sysPrxForUser_sys_ppu_thread_init() +{ + REG_FUNC(sysPrxForUser, sys_ppu_thread_create); + REG_FUNC(sysPrxForUser, sys_ppu_thread_get_id); + REG_FUNC(sysPrxForUser, sys_ppu_thread_exit); + REG_FUNC(sysPrxForUser, sys_ppu_thread_once); + REG_FUNC(sysPrxForUser, sys_ppu_thread_register_atexit); + REG_FUNC(sysPrxForUser, sys_ppu_thread_unregister_atexit); +} diff --git a/rpcs3/Emu/SysCalls/Modules/sys_prx_.cpp b/rpcs3/Emu/SysCalls/Modules/sys_prx_.cpp new file mode 100644 index 0000000000..c8d99309bc --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/sys_prx_.cpp @@ -0,0 +1,43 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" + +#include "Emu/SysCalls/lv2/sys_prx.h" +#include "sysPrxForUser.h" + +extern Module sysPrxForUser; + +s64 sys_prx_exitspawn_with_level() +{ + sysPrxForUser.Log("sys_prx_exitspawn_with_level()"); + return CELL_OK; +} + +s32 sys_prx_load_module_list_on_memcontainer() +{ + throw EXCEPTION(""); +} + +void sysPrxForUser_sys_prx_init() +{ + // TODO: split syscalls and liblv2 functions + + REG_FUNC(sysPrxForUser, sys_prx_load_module); + REG_FUNC(sysPrxForUser, sys_prx_load_module_by_fd); + REG_FUNC(sysPrxForUser, sys_prx_load_module_list); + REG_FUNC(sysPrxForUser, sys_prx_load_module_list_on_memcontainer); + REG_FUNC(sysPrxForUser, sys_prx_start_module); + REG_FUNC(sysPrxForUser, sys_prx_stop_module); + REG_FUNC(sysPrxForUser, sys_prx_unload_module); + REG_FUNC(sysPrxForUser, sys_prx_register_library); + REG_FUNC(sysPrxForUser, sys_prx_unregister_library); + REG_FUNC(sysPrxForUser, sys_prx_get_module_list); + REG_FUNC(sysPrxForUser, sys_prx_get_module_info); + REG_FUNC(sysPrxForUser, sys_prx_get_module_id_by_name); + REG_FUNC(sysPrxForUser, sys_prx_get_module_id_by_address); + REG_FUNC(sysPrxForUser, sys_prx_load_module_on_memcontainer); + REG_FUNC(sysPrxForUser, sys_prx_load_module_on_memcontainer_by_fd); + REG_FUNC(sysPrxForUser, sys_prx_exitspawn_with_level); + REG_FUNC(sysPrxForUser, sys_prx_get_my_module_id); +} diff --git a/rpcs3/Emu/SysCalls/Modules/sys_spinlock.cpp b/rpcs3/Emu/SysCalls/Modules/sys_spinlock.cpp new file mode 100644 index 0000000000..f1c7b85166 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/sys_spinlock.cpp @@ -0,0 +1,52 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" + +#include "sysPrxForUser.h" + +extern Module sysPrxForUser; + +void sys_spinlock_initialize(vm::ptr> lock) +{ + sysPrxForUser.Log("sys_spinlock_initialize(lock=*0x%x)", lock); + + lock->exchange(0); +} + +void sys_spinlock_lock(PPUThread& ppu, vm::ptr> lock) +{ + sysPrxForUser.Log("sys_spinlock_lock(lock=*0x%x)", lock); + + // prx: exchange with 0xabadcafe, repeat until exchanged with 0 + vm::wait_op(ppu, lock.addr(), 4, WRAP_EXPR(!lock->exchange(0xabadcafe).data())); +} + +s32 sys_spinlock_trylock(vm::ptr> lock) +{ + sysPrxForUser.Log("sys_spinlock_trylock(lock=*0x%x)", lock); + + if (lock->exchange(0xabadcafe).data()) + { + return CELL_EBUSY; + } + + return CELL_OK; +} + +void sys_spinlock_unlock(vm::ptr> lock) +{ + sysPrxForUser.Log("sys_spinlock_unlock(lock=*0x%x)", lock); + + lock->exchange(0); + + vm::notify_at(lock.addr(), 4); +} + +void sysPrxForUser_sys_spinlock_init() +{ + REG_FUNC(sysPrxForUser, sys_spinlock_initialize); + REG_FUNC(sysPrxForUser, sys_spinlock_lock); + REG_FUNC(sysPrxForUser, sys_spinlock_trylock); + REG_FUNC(sysPrxForUser, sys_spinlock_unlock); +} diff --git a/rpcs3/Emu/SysCalls/Modules/sys_spu_.cpp b/rpcs3/Emu/SysCalls/Modules/sys_spu_.cpp new file mode 100644 index 0000000000..2521f38b3f --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/sys_spu_.cpp @@ -0,0 +1,195 @@ +#include "stdafx.h" +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" + +#include "Emu/Cell/RawSPUThread.h" +#include "Emu/SysCalls/lv2/sys_spu.h" +#include "Emu/FS/vfsFile.h" +#include "Crypto/unself.h" +#include "sysPrxForUser.h" + +extern Module sysPrxForUser; + +extern u64 get_system_time(); + +spu_printf_cb_t g_spu_printf_agcb; +spu_printf_cb_t g_spu_printf_dgcb; +spu_printf_cb_t g_spu_printf_atcb; +spu_printf_cb_t g_spu_printf_dtcb; + +s32 sys_spu_elf_get_information(u32 elf_img, vm::ptr entry, vm::ptr nseg) +{ + sysPrxForUser.Todo("sys_spu_elf_get_information(elf_img=0x%x, entry=*0x%x, nseg=*0x%x)", elf_img, entry, nseg); + return CELL_OK; +} + +s32 sys_spu_elf_get_segments(u32 elf_img, vm::ptr segments, s32 nseg) +{ + sysPrxForUser.Todo("sys_spu_elf_get_segments(elf_img=0x%x, segments=*0x%x, nseg=0x%x)", elf_img, segments, nseg); + return CELL_OK; +} + +s32 sys_spu_image_import(vm::ptr img, u32 src, u32 type) +{ + sysPrxForUser.Warning("sys_spu_image_import(img=*0x%x, src=0x%x, type=%d)", img, src, type); + + return spu_image_import(*img, src, type); +} + +s32 sys_spu_image_close(vm::ptr img) +{ + sysPrxForUser.Todo("sys_spu_image_close(img=*0x%x)", img); + + return CELL_OK; +} + +s32 sys_raw_spu_load(s32 id, vm::cptr path, vm::ptr entry) +{ + sysPrxForUser.Warning("sys_raw_spu_load(id=%d, path=*0x%x, entry=*0x%x)", id, path, entry); + sysPrxForUser.Warning("*** path = '%s'", path.get_ptr()); + + vfsFile f(path.get_ptr()); + if (!f.IsOpened()) + { + sysPrxForUser.Error("sys_raw_spu_load error: '%s' not found!", path.get_ptr()); + return CELL_ENOENT; + } + + SceHeader hdr; + hdr.Load(f); + + if (hdr.CheckMagic()) + { + sysPrxForUser.Error("sys_raw_spu_load error: '%s' is encrypted! Decrypt SELF and try again.", path.get_ptr()); + Emu.Pause(); + return CELL_ENOENT; + } + + f.Seek(0); + + u32 _entry; + LoadSpuImage(f, _entry, RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id); + + *entry = _entry | 1; + + return CELL_OK; +} + +s32 sys_raw_spu_image_load(PPUThread& ppu, s32 id, vm::ptr img) +{ + sysPrxForUser.Warning("sys_raw_spu_image_load(id=%d, img=*0x%x)", id, img); + + // TODO: use segment info + + const auto stamp0 = get_system_time(); + + memcpy(vm::get_ptr(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id), vm::get_ptr(img->addr), 256 * 1024); + + const auto stamp1 = get_system_time(); + + vm::write32(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id + RAW_SPU_PROB_OFFSET + SPU_NPC_offs, img->entry_point | 1); + + const auto stamp2 = get_system_time(); + + sysPrxForUser.Error("memcpy() latency: %lldus", (stamp1 - stamp0)); + sysPrxForUser.Error("MMIO latency: %lldus", (stamp2 - stamp1)); + + return CELL_OK; +} + +s32 _sys_spu_printf_initialize(spu_printf_cb_t agcb, spu_printf_cb_t dgcb, spu_printf_cb_t atcb, spu_printf_cb_t dtcb) +{ + sysPrxForUser.Warning("_sys_spu_printf_initialize(agcb=*0x%x, dgcb=*0x%x, atcb=*0x%x, dtcb=*0x%x)", agcb, dgcb, atcb, dtcb); + + // register callbacks + g_spu_printf_agcb = agcb; + g_spu_printf_dgcb = dgcb; + g_spu_printf_atcb = atcb; + g_spu_printf_dtcb = dtcb; + + return CELL_OK; +} + +s32 _sys_spu_printf_finalize() +{ + sysPrxForUser.Warning("_sys_spu_printf_finalize()"); + + g_spu_printf_agcb = vm::null; + g_spu_printf_dgcb = vm::null; + g_spu_printf_atcb = vm::null; + g_spu_printf_dtcb = vm::null; + + return CELL_OK; +} + +s32 _sys_spu_printf_attach_group(PPUThread& ppu, u32 group) +{ + sysPrxForUser.Warning("_sys_spu_printf_attach_group(group=0x%x)", group); + + if (!g_spu_printf_agcb) + { + return CELL_ESTAT; + } + + return g_spu_printf_agcb(ppu, group); +} + +s32 _sys_spu_printf_detach_group(PPUThread& ppu, u32 group) +{ + sysPrxForUser.Warning("_sys_spu_printf_detach_group(group=0x%x)", group); + + if (!g_spu_printf_dgcb) + { + return CELL_ESTAT; + } + + return g_spu_printf_dgcb(ppu, group); +} + +s32 _sys_spu_printf_attach_thread(PPUThread& ppu, u32 thread) +{ + sysPrxForUser.Warning("_sys_spu_printf_attach_thread(thread=0x%x)", thread); + + if (!g_spu_printf_atcb) + { + return CELL_ESTAT; + } + + return g_spu_printf_atcb(ppu, thread); +} + +s32 _sys_spu_printf_detach_thread(PPUThread& ppu, u32 thread) +{ + sysPrxForUser.Warning("_sys_spu_printf_detach_thread(thread=0x%x)", thread); + + if (!g_spu_printf_dtcb) + { + return CELL_ESTAT; + } + + return g_spu_printf_dtcb(ppu, thread); +} + +void sysPrxForUser_sys_spu_init() +{ + g_spu_printf_agcb = vm::null; + g_spu_printf_dgcb = vm::null; + g_spu_printf_atcb = vm::null; + g_spu_printf_dtcb = vm::null; + + REG_FUNC(sysPrxForUser, sys_spu_elf_get_information); + REG_FUNC(sysPrxForUser, sys_spu_elf_get_segments); + REG_FUNC(sysPrxForUser, sys_spu_image_import); + REG_FUNC(sysPrxForUser, sys_spu_image_close); + + REG_FUNC(sysPrxForUser, sys_raw_spu_load); + REG_FUNC(sysPrxForUser, sys_raw_spu_image_load); + + REG_FUNC(sysPrxForUser, _sys_spu_printf_initialize); + REG_FUNC(sysPrxForUser, _sys_spu_printf_finalize); + REG_FUNC(sysPrxForUser, _sys_spu_printf_attach_group); + REG_FUNC(sysPrxForUser, _sys_spu_printf_detach_group); + REG_FUNC(sysPrxForUser, _sys_spu_printf_attach_thread); + REG_FUNC(sysPrxForUser, _sys_spu_printf_detach_thread); +} diff --git a/rpcs3/Emu/SysCalls/Modules/sysutil_audio.h b/rpcs3/Emu/SysCalls/Modules/sysutil_audio.h deleted file mode 100644 index ca09ee29d1..0000000000 --- a/rpcs3/Emu/SysCalls/Modules/sysutil_audio.h +++ /dev/null @@ -1,296 +0,0 @@ -#pragma once - -namespace vm { using namespace ps3; } - -//error codes -enum AudioErrorCode -{ - CELL_AUDIO_OUT_SUCCEEDED = 0, - CELL_AUDIO_OUT_ERROR_NOT_IMPLEMENTED = 0x8002b240, - CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION = 0x8002b241, - CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER = 0x8002b242, - CELL_AUDIO_OUT_ERROR_PARAMETER_OUT_OF_RANGE = 0x8002b243, - CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND = 0x8002b244, - CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT = 0x8002b245, - CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE = 0x8002b246, - CELL_AUDIO_OUT_ERROR_CONDITION_BUSY = 0x8002b247, - CELL_AUDIO_IN_ERROR_NOT_IMPLEMENTED = 0x8002b260, - CELL_AUDIO_IN_ERROR_ILLEGAL_CONFIGURATION = 0x8002b261, - CELL_AUDIO_IN_ERROR_ILLEGAL_PARAMETER = 0x8002b262, - CELL_AUDIO_IN_ERROR_PARAMETER_OUT_OF_RANGE = 0x8002b263, - CELL_AUDIO_IN_ERROR_DEVICE_NOT_FOUND = 0x8002b264, - CELL_AUDIO_IN_ERROR_UNSUPPORTED_AUDIO_IN = 0x8002b265, - CELL_AUDIO_IN_ERROR_UNSUPPORTED_SOUND_MODE = 0x8002b266, - CELL_AUDIO_IN_ERROR_CONDITION_BUSY = 0x8002b267, -}; - -enum CellAudioOut -{ - CELL_AUDIO_OUT_PRIMARY = 0, - CELL_AUDIO_OUT_SECONDARY = 1, -}; - -enum CellAudioOutDownMixer -{ - CELL_AUDIO_OUT_DOWNMIXER_NONE = 0, - CELL_AUDIO_OUT_DOWNMIXER_TYPE_A = 1, - CELL_AUDIO_OUT_DOWNMIXER_TYPE_B = 2, -}; - -enum -{ - CELL_AUDIO_OUT_SINGLE_DEVICE_MODE = 0, - CELL_AUDIO_OUT_MULTI_DEVICE_MODE = 1, - CELL_AUDIO_OUT_MULTI_DEVICE_MODE_2 = 2, -}; - -enum CellAudioOutPortType -{ - CELL_AUDIO_OUT_PORT_HDMI = 0, - CELL_AUDIO_OUT_PORT_SPDIF = 1, - CELL_AUDIO_OUT_PORT_ANALOG = 2, - CELL_AUDIO_OUT_PORT_USB = 3, - CELL_AUDIO_OUT_PORT_BLUETOOTH = 4, - CELL_AUDIO_OUT_PORT_NETWORK = 5, -}; - -enum CellAudioOutDeviceState -{ - CELL_AUDIO_OUT_DEVICE_STATE_UNAVAILABLE = 0, - CELL_AUDIO_OUT_DEVICE_STATE_AVAILABLE = 1, -}; - -enum CellAudioOutOutputState -{ - CELL_AUDIO_OUT_OUTPUT_STATE_ENABLED = 0, - CELL_AUDIO_OUT_OUTPUT_STATE_DISABLED = 1, - CELL_AUDIO_OUT_OUTPUT_STATE_PREPARING = 2, -}; - -enum CellAudioOutCodingType -{ - CELL_AUDIO_OUT_CODING_TYPE_LPCM = 0, - CELL_AUDIO_OUT_CODING_TYPE_AC3 = 1, - CELL_AUDIO_OUT_CODING_TYPE_MPEG1 = 2, - CELL_AUDIO_OUT_CODING_TYPE_MP3 = 3, - CELL_AUDIO_OUT_CODING_TYPE_MPEG2 = 4, - CELL_AUDIO_OUT_CODING_TYPE_AAC = 5, - CELL_AUDIO_OUT_CODING_TYPE_DTS = 6, - CELL_AUDIO_OUT_CODING_TYPE_ATRAC = 7, - CELL_AUDIO_OUT_CODING_TYPE_BITSTREAM = 0xff, -}; - -enum CellAudioOutChnum -{ - CELL_AUDIO_OUT_CHNUM_2 = 2, - CELL_AUDIO_OUT_CHNUM_4 = 4, - CELL_AUDIO_OUT_CHNUM_6 = 6, - CELL_AUDIO_OUT_CHNUM_8 = 8, -}; - -enum CellAudioOutFs -{ - CELL_AUDIO_OUT_FS_32KHZ = 0x01, - CELL_AUDIO_OUT_FS_44KHZ = 0x02, - CELL_AUDIO_OUT_FS_48KHZ = 0x04, - CELL_AUDIO_OUT_FS_88KHZ = 0x08, - CELL_AUDIO_OUT_FS_96KHZ = 0x10, - CELL_AUDIO_OUT_FS_176KHZ = 0x20, - CELL_AUDIO_OUT_FS_192KHZ = 0x40, -}; - -enum -{ - CELL_AUDIO_OUT_SPEAKER_LAYOUT_2CH = 0x00000001, - CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr = 0x00010000, - CELL_AUDIO_OUT_SPEAKER_LAYOUT_8CH_LREClrxy = 0x40000000, -}; - -enum -{ - CELL_AUDIO_OUT_COPY_CONTROL_COPY_FREE = 0, - CELL_AUDIO_OUT_COPY_CONTROL_COPY_ONCE = 1, - CELL_AUDIO_OUT_COPY_CONTROL_COPY_NEVER = 2, -}; - -enum -{ - CELL_AUDIO_IN_SINGLE_DEVICE_MODE = 0, - CELL_AUDIO_IN_MULTI_DEVICE_MODE = 1, - CELL_AUDIO_IN_MULTI_DEVICE_MODE_2 = 2, -}; - -enum CellAudioInPortType -{ - CELL_AUDIO_IN_PORT_USB = 3, - CELL_AUDIO_IN_PORT_BLUETOOTH = 4, -}; - -enum CellAudioInDeviceState -{ - CELL_AUDIO_IN_DEVICE_STATE_UNAVAILABLE = 0, - CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE = 1, -}; - -enum CellAudioInCodingType -{ - CELL_AUDIO_IN_CODING_TYPE_LPCM = 0, -}; - -enum CellAudioInChnum -{ - CELL_AUDIO_IN_CHNUM_NONE = 0, - CELL_AUDIO_IN_CHNUM_1 = 1, - CELL_AUDIO_IN_CHNUM_2 = 2, -}; - -enum CellAudioInFs -{ - CELL_AUDIO_IN_FS_UNDEFINED = 0x00, - CELL_AUDIO_IN_FS_8KHZ = 0x01, - CELL_AUDIO_IN_FS_12KHZ = 0x02, - CELL_AUDIO_IN_FS_16KHZ = 0x04, - CELL_AUDIO_IN_FS_24KHZ = 0x08, - CELL_AUDIO_IN_FS_32KHZ = 0x10, - CELL_AUDIO_IN_FS_48KHZ = 0x20, -}; - -struct CellAudioOutConfiguration -{ - u8 channel; - u8 encoder; - u8 reserved[10]; - be_t downMixer; -}; - -struct CellAudioOutSoundMode -{ - u8 type; - u8 channel; - u8 fs; - u8 reserved; - be_t layout; -}; - -struct CellAudioOutDeviceInfo -{ - u8 portType; - u8 availableModeCount; - u8 state; - u8 reserved[3]; - be_t latency; - CellAudioOutSoundMode availableModes[16]; -}; - -struct CellAudioOutState -{ - u8 state; - u8 encoder; - u8 reserved[6]; - be_t downMixer; - CellAudioOutSoundMode soundMode; -}; - -struct CellAudioOutSoundMode2 -{ - u8 type; - u8 channel; - be_t fs; - u8 reserved[4]; -}; - -struct CellAudioOutDeviceInfo2 -{ - u8 portType; - u8 availableModeCount; - u8 state; - u8 deviceNumber; - u8 reserved[12]; - be_t deviceId; - be_t type; - char name[64]; - CellAudioOutSoundMode2 availableModes2[16]; -}; - -struct CellAudioOutOption -{ - //(Omitted) -}; - -struct CellAudioOutRegistrationOption -{ - //(Omitted) -}; - -struct CellAudioOutDeviceConfiguration -{ - //(Omitted) -}; - -struct CellAudioInSoundMode -{ - u8 type; - u8 channel; - be_t fs; - u8 reserved[4]; -}; - -struct CellAudioInDeviceInfo -{ - u8 portType; - u8 availableModeCount; - u8 state; - u8 deviceNumber; - u8 reserved[12]; - be_t deviceId; - be_t type; - char name[64]; - CellAudioInSoundMode availableModes[16]; -}; - -struct CellAudioInRegistrationOption -{ - //(Omitted) -}; - -struct CellAudioInDeviceConfiguration -{ - u8 volume; - u8 reserved[31]; -}; - -enum CellSysutilBgmPlaybackStatusState -{ - CELL_SYSUTIL_BGMPLAYBACK_STATUS_PLAY = 0, - CELL_SYSUTIL_BGMPLAYBACK_STATUS_STOP = 1 -}; - -enum CellSysutilBgmPlaybackStatusEnabled -{ - CELL_SYSUTIL_BGMPLAYBACK_STATUS_ENABLE = 0, - CELL_SYSUTIL_BGMPLAYBACK_STATUS_DISABLE = 1 -}; - -struct CellSysutilBgmPlaybackStatus -{ - u8 playerState; - u8 enableState; - char contentId[16]; - u8 currentFadeRatio; - char reserved[13]; -}; - -struct CellSysutilBgmPlaybackStatus2 -{ - u8 playerState; - char reserved[7]; -}; - -struct CellSysutilBgmPlaybackExtraParam -{ - be_t systemBgmFadeInTime; - be_t systemBgmFadeOutTime; - be_t gameBgmFadeInTime; - be_t gameBgmFadeOutTime; - char reserved[8]; -}; diff --git a/rpcs3/Emu/SysCalls/SC_FUNC.h b/rpcs3/Emu/SysCalls/SC_FUNC.h index 64b22680d2..489257aa41 100644 --- a/rpcs3/Emu/SysCalls/SC_FUNC.h +++ b/rpcs3/Emu/SysCalls/SC_FUNC.h @@ -218,28 +218,6 @@ namespace ppu_func_detail } }; - template<> - struct func_binder // redundant specialization to bypass internal compiler error in MSVC - { - using func_t = void(*)(); - - static force_inline void do_call(PPUThread& CPU, func_t func) - { - func(); - } - }; - - template - struct func_binder // redundant specialization to bypass internal compiler error in MSVC - { - using func_t = RT(*)(); - - static force_inline void do_call(PPUThread& CPU, func_t func) - { - bind_result::value>::put_result(CPU, func()); - } - }; - template struct func_binder { diff --git a/rpcs3/Emu/SysCalls/SysCalls.cpp b/rpcs3/Emu/SysCalls/SysCalls.cpp index 1e8aed17d9..42880c8c36 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.cpp +++ b/rpcs3/Emu/SysCalls/SysCalls.cpp @@ -37,7 +37,7 @@ void null_func(PPUThread& ppu) { - const auto code = ppu.GPR[11]; + const u64 code = ppu.GPR[11]; LOG_ERROR(HLE, "Unimplemented syscall %lld: %s -> CELL_OK", code, SysCalls::GetFuncName(~code)); ppu.GPR[3] = 0; } diff --git a/rpcs3/Emu/SysCalls/lv2/sys_cond.cpp b/rpcs3/Emu/SysCalls/lv2/sys_cond.cpp index 1f77a1ebe6..8001ededbc 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_cond.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_cond.cpp @@ -12,12 +12,10 @@ SysCallBase sys_cond("sys_cond"); extern u64 get_system_time(); -void lv2_cond_t::notify(lv2_lock_t& lv2_lock, sleep_queue_t::iterator it) +void lv2_cond_t::notify(lv2_lock_t& lv2_lock, sleep_queue_t::value_type& thread) { CHECK_LV2_LOCK(lv2_lock); - auto& thread = *it; - if (mutex->owner) { // add thread to the mutex sleep queue if cannot lock immediately @@ -107,7 +105,7 @@ s32 sys_cond_signal(u32 cond_id) // signal one waiting thread; protocol is ignored in current implementation if (!cond->sq.empty()) { - cond->notify(lv2_lock, cond->sq.begin()); + cond->notify(lv2_lock, cond->sq.front()); cond->sq.pop_front(); } @@ -128,9 +126,9 @@ s32 sys_cond_signal_all(u32 cond_id) } // signal all waiting threads; protocol is ignored in current implementation - for (auto it = cond->sq.begin(); it != cond->sq.end(); it++) + for (auto& thread : cond->sq) { - cond->notify(lv2_lock, it); + cond->notify(lv2_lock, thread); } cond->sq.clear(); @@ -151,20 +149,22 @@ s32 sys_cond_signal_to(u32 cond_id, u32 thread_id) return CELL_ESRCH; } - // TODO: check if CELL_ESRCH is returned if thread_id is invalid - - // signal specified thread (protocol is not required) - for (auto it = cond->sq.begin(); it != cond->sq.end(); it++) + const auto found = std::find_if(cond->sq.begin(), cond->sq.end(), [=](sleep_queue_t::value_type& thread) { - if ((*it)->get_id() == thread_id) - { - cond->notify(lv2_lock, it); - cond->sq.erase(it); - return CELL_OK; - } + return thread->get_id() == thread_id; + }); + + // TODO: check if CELL_ESRCH is returned if thread_id is invalid + if (found == cond->sq.end()) + { + return CELL_EPERM; } - return CELL_EPERM; + // signal specified thread + cond->notify(lv2_lock, *found); + cond->sq.erase(found); + + return CELL_OK; } s32 sys_cond_wait(PPUThread& ppu, u32 cond_id, u64 timeout) diff --git a/rpcs3/Emu/SysCalls/lv2/sys_cond.h b/rpcs3/Emu/SysCalls/lv2/sys_cond.h index 10038d8a9c..64d1460468 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_cond.h +++ b/rpcs3/Emu/SysCalls/lv2/sys_cond.h @@ -32,7 +32,7 @@ struct lv2_cond_t { } - void notify(lv2_lock_t& lv2_lock, sleep_queue_t::iterator it); + void notify(lv2_lock_t& lv2_lock, sleep_queue_t::value_type& thread); }; REG_ID_TYPE(lv2_cond_t, 0x86); // SYS_COND_OBJECT diff --git a/rpcs3/Emu/SysCalls/lv2/sys_fs.cpp b/rpcs3/Emu/SysCalls/lv2/sys_fs.cpp index 76213f1c3d..6c2225528f 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_fs.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_fs.cpp @@ -13,6 +13,29 @@ SysCallBase sys_fs("sys_fs"); +std::array, 256> g_fds = {}; // file descriptors 0..255 mapped to IDs + +u32 _fd_to_id(u32 fd) +{ + return fd < g_fds.size() ? g_fds[fd].load() : 0; +} + +lv2_file_t::~lv2_file_t() +{ + if (Emu.IsStopped()) + { + g_fds = {}; + } +} + +lv2_dir_t::~lv2_dir_t() +{ + if (Emu.IsStopped()) + { + g_fds = {}; + } +} + s32 sys_fs_test(u32 arg1, u32 arg2, vm::ptr arg3, u32 arg4, vm::ptr arg5, u32 arg6) { sys_fs.Todo("sys_fs_test(arg1=0x%x, arg2=0x%x, arg3=*0x%x, arg4=0x%x, arg5=*0x%x, arg6=0x%x) -> CELL_OK", arg1, arg2, arg3, arg4, arg5, arg6); @@ -113,17 +136,29 @@ s32 sys_fs_open(vm::cptr path, s32 flags, vm::ptr fd, s32 mode, vm::c return CELL_FS_ENOENT; } - - *fd = Emu.GetIdManager().make(std::move(file), mode, flags); - return CELL_OK; + for (u32 i = 3; i < g_fds.size(); i++) + { + // try to reserve fd + if (g_fds[i].compare_and_swap_test(0, ~0)) + { + g_fds[i].store(Emu.GetIdManager().make(std::move(file), mode, flags)); + + *fd = i; + + return CELL_OK; + } + } + + // out of file descriptors + return CELL_FS_EMFILE; } s32 sys_fs_read(u32 fd, vm::ptr buf, u64 nbytes, vm::ptr nread) { - sys_fs.Log("sys_fs_read(fd=0x%x, buf=0x%x, nbytes=0x%llx, nread=0x%x)", fd, buf, nbytes, nread); + sys_fs.Log("sys_fs_read(fd=%d, buf=0x%x, nbytes=0x%llx, nread=0x%x)", fd, buf, nbytes, nread); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file || file->flags & CELL_FS_O_WRONLY) { @@ -139,9 +174,9 @@ s32 sys_fs_read(u32 fd, vm::ptr buf, u64 nbytes, vm::ptr nread) s32 sys_fs_write(u32 fd, vm::cptr buf, u64 nbytes, vm::ptr nwrite) { - sys_fs.Log("sys_fs_write(fd=0x%x, buf=*0x%x, nbytes=0x%llx, nwrite=*0x%x)", fd, buf, nbytes, nwrite); + sys_fs.Log("sys_fs_write(fd=%d, buf=*0x%x, nbytes=0x%llx, nwrite=*0x%x)", fd, buf, nbytes, nwrite); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file || !(file->flags & CELL_FS_O_ACCMODE)) { @@ -159,9 +194,9 @@ s32 sys_fs_write(u32 fd, vm::cptr buf, u64 nbytes, vm::ptr nwrite) s32 sys_fs_close(u32 fd) { - sys_fs.Log("sys_fs_close(fd=0x%x)", fd); + sys_fs.Log("sys_fs_close(fd=%d)", fd); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -170,7 +205,9 @@ s32 sys_fs_close(u32 fd) // TODO: return CELL_FS_EBUSY if locked - Emu.GetIdManager().remove(fd); + Emu.GetIdManager().remove(_fd_to_id(fd)); + + g_fds[fd].store(0); return CELL_OK; } @@ -188,16 +225,28 @@ s32 sys_fs_opendir(vm::cptr path, vm::ptr fd) return CELL_FS_ENOENT; } - *fd = Emu.GetIdManager().make(std::move(dir)); + for (u32 i = 3; i < g_fds.size(); i++) + { + // try to reserve fd + if (g_fds[i].compare_and_swap_test(0, ~0)) + { + g_fds[i].store(Emu.GetIdManager().make(std::move(dir))); - return CELL_OK; + *fd = i; + + return CELL_OK; + } + } + + // out of file descriptors + return CELL_FS_EMFILE; } s32 sys_fs_readdir(u32 fd, vm::ptr dir, vm::ptr nread) { - sys_fs.Warning("sys_fs_readdir(fd=0x%x, dir=*0x%x, nread=*0x%x)", fd, dir, nread); + sys_fs.Warning("sys_fs_readdir(fd=%d, dir=*0x%x, nread=*0x%x)", fd, dir, nread); - const auto directory = Emu.GetIdManager().get(fd); + const auto directory = Emu.GetIdManager().get(_fd_to_id(fd)); if (!directory) { @@ -223,16 +272,18 @@ s32 sys_fs_readdir(u32 fd, vm::ptr dir, vm::ptr nread) s32 sys_fs_closedir(u32 fd) { - sys_fs.Log("sys_fs_closedir(fd=0x%x)", fd); + sys_fs.Log("sys_fs_closedir(fd=%d)", fd); - const auto directory = Emu.GetIdManager().get(fd); + const auto directory = Emu.GetIdManager().get(_fd_to_id(fd)); if (!directory) { return CELL_FS_EBADF; } - Emu.GetIdManager().remove(fd); + Emu.GetIdManager().remove(_fd_to_id(fd)); + + g_fds[fd].store(0); return CELL_OK; } @@ -272,9 +323,9 @@ s32 sys_fs_stat(vm::cptr path, vm::ptr sb) s32 sys_fs_fstat(u32 fd, vm::ptr sb) { - sys_fs.Warning("sys_fs_fstat(fd=0x%x, sb=*0x%x)", fd, sb); + sys_fs.Warning("sys_fs_fstat(fd=%d, sb=*0x%x)", fd, sb); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -415,15 +466,15 @@ s32 sys_fs_fcntl(u32 fd, s32 flags, u32 addr, u32 arg4, u32 arg5, u32 arg6) s32 sys_fs_lseek(u32 fd, s64 offset, s32 whence, vm::ptr pos) { - sys_fs.Log("sys_fs_lseek(fd=0x%x, offset=0x%llx, whence=0x%x, pos=*0x%x)", fd, offset, whence, pos); + sys_fs.Log("sys_fs_lseek(fd=%d, offset=0x%llx, whence=0x%x, pos=*0x%x)", fd, offset, whence, pos); if (whence >= 3) { - sys_fs.Error("sys_fs_lseek(fd=0x%x): unknown seek whence (%d)", fd, whence); + sys_fs.Error("sys_fs_lseek(): unknown seek whence (%d)", whence); return CELL_FS_EINVAL; } - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -439,9 +490,9 @@ s32 sys_fs_lseek(u32 fd, s64 offset, s32 whence, vm::ptr pos) s32 sys_fs_fget_block_size(u32 fd, vm::ptr sector_size, vm::ptr block_size, vm::ptr arg4, vm::ptr arg5) { - sys_fs.Todo("sys_fs_fget_block_size(fd=0x%x, sector_size=*0x%x, block_size=*0x%x, arg4=*0x%x, arg5=*0x%x)", fd, sector_size, block_size, arg4, arg5); + sys_fs.Todo("sys_fs_fget_block_size(fd=%d, sector_size=*0x%x, block_size=*0x%x, arg4=*0x%x, arg5=*0x%x)", fd, sector_size, block_size, arg4, arg5); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file) { @@ -487,9 +538,9 @@ s32 sys_fs_truncate(vm::cptr path, u64 size) s32 sys_fs_ftruncate(u32 fd, u64 size) { - sys_fs.Warning("sys_fs_ftruncate(fd=0x%x, size=0x%llx)", fd, size); + sys_fs.Warning("sys_fs_ftruncate(fd=%d, size=0x%llx)", fd, size); - const auto file = Emu.GetIdManager().get(fd); + const auto file = Emu.GetIdManager().get(_fd_to_id(fd)); if (!file || !(file->flags & CELL_FS_O_ACCMODE)) { diff --git a/rpcs3/Emu/SysCalls/lv2/sys_fs.h b/rpcs3/Emu/SysCalls/lv2/sys_fs.h index 8d282f13e6..3f5f43ce79 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_fs.h +++ b/rpcs3/Emu/SysCalls/lv2/sys_fs.h @@ -201,6 +201,8 @@ struct lv2_file_t , st_callback({}) { } + + ~lv2_file_t(); }; REG_ID_TYPE(lv2_file_t, 0x73); // SYS_FS_FD_OBJECT @@ -215,6 +217,8 @@ struct lv2_dir_t : dir(std::move(dir)) { } + + ~lv2_dir_t(); }; REG_ID_TYPE(lv2_dir_t, 0x73); // SYS_FS_FD_OBJECT diff --git a/rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp b/rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp index 8f9b52585a..4fd6f08b9f 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp @@ -12,11 +12,11 @@ SysCallBase sys_lwcond("sys_lwcond"); extern u64 get_system_time(); -void lv2_lwcond_t::notify(lv2_lock_t & lv2_lock, sleep_queue_t::iterator it, const std::shared_ptr& mutex, bool mode2) +void lv2_lwcond_t::notify(lv2_lock_t & lv2_lock, sleep_queue_t::value_type& thread, const std::shared_ptr& mutex, bool mode2) { CHECK_LV2_LOCK(lv2_lock); - auto& ppu = static_cast(*it->get()); + auto& ppu = static_cast(*thread); ppu.GPR[3] = mode2; // set to return CELL_EBUSY @@ -24,7 +24,7 @@ void lv2_lwcond_t::notify(lv2_lock_t & lv2_lock, sleep_queue_t::iterator it, con { if (!mutex->signaled) { - return mutex->sq.emplace_back(*it); + return mutex->sq.emplace_back(thread); } mutex->signaled--; @@ -114,7 +114,7 @@ s32 _sys_lwcond_signal(u32 lwcond_id, u32 lwmutex_id, u32 ppu_thread_id, u32 mod } // signal specified waiting thread - cond->notify(lv2_lock, found, mutex, mode == 2); + cond->notify(lv2_lock, *found, mutex, mode == 2); cond->sq.erase(found); @@ -144,9 +144,9 @@ s32 _sys_lwcond_signal_all(u32 lwcond_id, u32 lwmutex_id, u32 mode) // mode 2: lightweight mutex was not owned by the calling thread and waiter hasn't been increased // signal all waiting threads; protocol is ignored in current implementation - for (auto it = cond->sq.begin(); it != cond->sq.end(); it++) + for (auto& thread : cond->sq) { - cond->notify(lv2_lock, it, mutex, mode == 2); + cond->notify(lv2_lock, thread, mutex, mode == 2); } // in mode 1, return the amount of threads signaled diff --git a/rpcs3/Emu/SysCalls/lv2/sys_lwcond.h b/rpcs3/Emu/SysCalls/lv2/sys_lwcond.h index 8541ec3486..d898bcb416 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_lwcond.h +++ b/rpcs3/Emu/SysCalls/lv2/sys_lwcond.h @@ -32,7 +32,7 @@ struct lv2_lwcond_t { } - void notify(lv2_lock_t& lv2_lock, sleep_queue_t::iterator it, const std::shared_ptr& mutex, bool mode2); + void notify(lv2_lock_t& lv2_lock, sleep_queue_t::value_type& thread, const std::shared_ptr& mutex, bool mode2); }; REG_ID_TYPE(lv2_lwcond_t, 0x97); // SYS_LWCOND_OBJECT diff --git a/rpcs3/Emu/SysCalls/lv2/sys_process.cpp b/rpcs3/Emu/SysCalls/lv2/sys_process.cpp index 186c943626..9580a4cf98 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_process.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_process.cpp @@ -55,156 +55,6 @@ s32 sys_process_exit(s32 status) return CELL_OK; } -void sys_game_process_exitspawn(vm::cptr path, u32 argv_addr, u32 envp_addr, u32 data_addr, u32 data_size, u32 prio, u64 flags) -{ - std::string _path = path.get_ptr(); - const std::string& from = "//"; - const std::string& to = "/"; - - size_t start_pos = 0; - while ((start_pos = _path.find(from, start_pos)) != std::string::npos) { - _path.replace(start_pos, from.length(), to); - start_pos += to.length(); - } - - sys_process.Todo("sys_game_process_exitspawn()"); - sys_process.Warning("path: %s", _path.c_str()); - sys_process.Warning("argv: 0x%x", argv_addr); - sys_process.Warning("envp: 0x%x", envp_addr); - sys_process.Warning("data: 0x%x", data_addr); - sys_process.Warning("data_size: 0x%x", data_size); - sys_process.Warning("prio: %d", prio); - sys_process.Warning("flags: %d", flags); - - std::vector argv; - std::vector env; - - if (argv_addr) - { - auto argvp = vm::cpptr::make(argv_addr); - while (argvp && *argvp) - { - argv.push_back(argvp[0].get_ptr()); - argvp++; - } - - for (auto &arg : argv) { - sys_process.Log("argument: %s", arg.c_str()); - } - } - - if (envp_addr) - { - auto envp = vm::cpptr::make(envp_addr); - while (envp && *envp) - { - env.push_back(envp[0].get_ptr()); - envp++; - } - - for (auto &en : env) { - sys_process.Log("env_argument: %s", en.c_str()); - } - } - - //TODO: execute the file in with the args in argv - //and the environment parameters in envp and copy the data - //from data_addr into the adress space of the new process - //then kill the current process - - Emu.Pause(); - sys_process.Success("Process finished"); - - CallAfter([]() - { - Emu.Stop(); - }); - - std::string real_path; - - Emu.GetVFS().GetDevice(_path.c_str(), real_path); - - Emu.BootGame(real_path, true); - - return; -} - -void sys_game_process_exitspawn2(vm::cptr path, u32 argv_addr, u32 envp_addr, u32 data_addr, u32 data_size, u32 prio, u64 flags) -{ - std::string _path = path.get_ptr(); - const std::string& from = "//"; - const std::string& to = "/"; - - size_t start_pos = 0; - while ((start_pos = _path.find(from, start_pos)) != std::string::npos) { - _path.replace(start_pos, from.length(), to); - start_pos += to.length(); - } - - sys_process.Warning("sys_game_process_exitspawn2()"); - sys_process.Warning("path: %s", _path.c_str()); - sys_process.Warning("argv: 0x%x", argv_addr); - sys_process.Warning("envp: 0x%x", envp_addr); - sys_process.Warning("data: 0x%x", data_addr); - sys_process.Warning("data_size: 0x%x", data_size); - sys_process.Warning("prio: %d", prio); - sys_process.Warning("flags: %d", flags); - - std::vector argv; - std::vector env; - - if (argv_addr) - { - auto argvp = vm::cpptr::make(argv_addr); - while (argvp && *argvp) - { - argv.push_back(argvp[0].get_ptr()); - argvp++; - } - - for (auto &arg : argv) - { - sys_process.Log("argument: %s", arg.c_str()); - } - } - - if (envp_addr) - { - auto envp = vm::cpptr::make(envp_addr); - while (envp && *envp) - { - env.push_back(envp[0].get_ptr()); - envp++; - } - - for (auto &en : env) - { - sys_process.Log("env_argument: %s", en.c_str()); - } - } - - //TODO: execute the file in with the args in argv - //and the environment parameters in envp and copy the data - //from data_addr into the adress space of the new process - //then kill the current process - - Emu.Pause(); - sys_process.Success("Process finished"); - - CallAfter([]() - { - Emu.Stop(); - }); - - std::string real_path; - - Emu.GetVFS().GetDevice(_path.c_str(), real_path); - - Emu.BootGame(real_path, true); - - return; -} - s32 sys_process_get_number_of_object(u32 object, vm::ptr nump) { sys_process.Error("sys_process_get_number_of_object(object=0x%x, nump=*0x%x)", object, nump); @@ -324,7 +174,7 @@ s32 process_get_sdk_version(u32 pid, s32& ver) s32 sys_process_get_sdk_version(u32 pid, vm::ptr version) { - sys_process.Warning("sys_process_get_sdk_version(pid=0x%x, version_addr=0x%x)", pid, version.addr()); + sys_process.Warning("sys_process_get_sdk_version(pid=0x%x, version=*0x%x)", pid, version); s32 sdk_ver; s32 ret = process_get_sdk_version(pid, sdk_ver); @@ -347,8 +197,8 @@ s32 sys_process_kill(u32 pid) s32 sys_process_wait_for_child(u32 pid, vm::ptr status, u64 unk) { - sys_process.Todo("sys_process_wait_for_child(pid=0x%x, status_addr=0x%x, unk=0x%llx", - pid, status.addr(), unk); + sys_process.Todo("sys_process_wait_for_child(pid=0x%x, status=*0x%x, unk=0x%llx", pid, status, unk); + return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/lv2/sys_spu.cpp b/rpcs3/Emu/SysCalls/lv2/sys_spu.cpp index 3c25aff897..3bba13e75d 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_spu.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_spu.cpp @@ -61,7 +61,7 @@ s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu) s32 sys_spu_image_open(vm::ptr img, vm::cptr path) { - sys_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.addr(), path.addr(), path.get_ptr()); + sys_spu.Warning("sys_spu_image_open(img=*0x%x, path=*0x%x)", img, path); vfsFile f(path.get_ptr()); if(!f.IsOpened()) diff --git a/rpcs3/Emu/SysCalls/lv2/sys_tty.cpp b/rpcs3/Emu/SysCalls/lv2/sys_tty.cpp index 0c63d21500..1460056046 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_tty.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_tty.cpp @@ -8,9 +8,9 @@ SysCallBase sys_tty("sys_tty"); -s32 sys_tty_read(s32 ch, vm::ptr buf, u32 len, vm::ptr preadlen) +s32 sys_tty_read(s32 ch, vm::ptr buf, u32 len, vm::ptr preadlen) { - sys_tty.Error("sys_tty_read(ch=%d, buf_addr=0x%x, len=%d, preadlen_addr=0x%x)", ch, buf.addr(), len, preadlen.addr()); + sys_tty.Error("sys_tty_read(ch=%d, buf=*0x%x, len=%d, preadlen=*0x%x)", ch, buf, len, preadlen); // We currently do not support reading from the Console *preadlen = 0; @@ -18,31 +18,25 @@ s32 sys_tty_read(s32 ch, vm::ptr buf, u32 len, vm::ptr preadlen) return CELL_OK; } -s32 sys_tty_write(s32 ch, vm::cptr buf, u32 len, vm::ptr pwritelen) +s32 sys_tty_write(s32 ch, vm::cptr buf, u32 len, vm::ptr pwritelen) { - sys_tty.Log("sys_tty_write(ch=%d, buf_addr=0x%x, len=%d, preadlen_addr=0x%x)", ch, buf.addr(), len, pwritelen.addr()); + sys_tty.Log("sys_tty_write(ch=%d, buf=*0x%x, len=%d, pwritelen=*0x%x)", ch, buf, len, pwritelen); if (ch > 15) { - sys_tty.Error("sys_tty_write(): specified channel was higher than 15."); return CELL_EINVAL; } - if ((s32) len <= 0) + if ((s32)len <= 0) { - sys_tty.Error("sys_tty_write(): specified length was 0."); + *pwritelen = 0; + return CELL_OK; } - const std::string data((const char*)buf.get_ptr(), len); - - if (ch == SYS_TTYP_PPU_STDOUT || ch == SYS_TTYP_SPU_STDOUT || (ch >= SYS_TTYP_USER1 && ch <= SYS_TTYP_USER13)) { - LOG_NOTICE(TTY, "%s", data.c_str()); - } - if (ch == SYS_TTYP_PPU_STDERR) { - LOG_ERROR(TTY, "%s", data.c_str()); - } + log_message(Log::LogType::TTY, ch == SYS_TTYP_PPU_STDERR ? Log::Severity::Error : Log::Severity::Notice, { buf.get_ptr(), len }); - *pwritelen = (u32)data.size(); + *pwritelen = len; + return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/lv2/sys_tty.h b/rpcs3/Emu/SysCalls/lv2/sys_tty.h index 244d4d2d8c..7c7f7ddba0 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_tty.h +++ b/rpcs3/Emu/SysCalls/lv2/sys_tty.h @@ -25,5 +25,5 @@ enum }; // SysCalls -s32 sys_tty_read(s32 ch, vm::ptr buf, u32 len, vm::ptr preadlen); -s32 sys_tty_write(s32 ch, vm::cptr buf, u32 len, vm::ptr pwritelen); +s32 sys_tty_read(s32 ch, vm::ptr buf, u32 len, vm::ptr preadlen); +s32 sys_tty_write(s32 ch, vm::cptr buf, u32 len, vm::ptr pwritelen); diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index d4228ea8af..fa2a95b389 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -200,15 +200,20 @@ public: force_inline bool IsReady() const { return m_status == Ready; } }; +extern Emulator Emu; + using lv2_lock_t = std::unique_lock; +inline bool check_lv2_lock(lv2_lock_t& lv2_lock) +{ + return lv2_lock.owns_lock() && lv2_lock.mutex() == &Emu.GetCoreMutex(); +} + #define LV2_LOCK lv2_lock_t lv2_lock(Emu.GetCoreMutex()) #define LV2_DEFER_LOCK lv2_lock_t lv2_lock -#define CHECK_LV2_LOCK(x) if (!(x).owns_lock() || (x).mutex() != &Emu.GetCoreMutex()) throw EXCEPTION("Invalid LV2_LOCK (locked=%d)", (x).owns_lock()) +#define CHECK_LV2_LOCK(x) if (!check_lv2_lock(x)) throw EXCEPTION("lv2_lock is invalid or not locked") #define CHECK_EMU_STATUS if (Emu.IsStopped()) throw EXCEPTION("Aborted (emulation stopped)") -extern Emulator Emu; - typedef void(*CallAfterCbType)(std::function func); void CallAfter(std::function func); diff --git a/rpcs3/Gui/GSFrame.cpp b/rpcs3/Gui/GSFrame.cpp index 589d940f53..c34509bb3e 100644 --- a/rpcs3/Gui/GSFrame.cpp +++ b/rpcs3/Gui/GSFrame.cpp @@ -1,7 +1,7 @@ #include "stdafx_gui.h" #include "GSFrame.h" #include "Emu/System.h" -#include "Emu/RSX/sysutil_video.h" +#include "Emu/SysCalls/Modules/cellVideoOut.h" #include "rpcs3.h" BEGIN_EVENT_TABLE(GSFrame, wxFrame) diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index d4e876eb36..5a06624cf3 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -25,7 +25,7 @@ #include "git-version.h" #include "Ini.h" #include "Emu/SysCalls/Modules/cellSysutil.h" -#include "Emu/RSX/sysutil_video.h" +#include "Emu/SysCalls/Modules/cellVideoOut.h" #include "Gui/PADManager.h" #include "Gui/VHDDManager.h" #include "Gui/VFSManager.h" @@ -370,32 +370,32 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) // Settings panels wxNotebook* nb_config = new wxNotebook(&diag, wxID_ANY, wxPoint(6,6), wxSize(width, height)); wxPanel* p_system = new wxPanel(nb_config, wxID_ANY); - wxPanel* p_cpu = new wxPanel(nb_config, wxID_ANY); + wxPanel* p_core = new wxPanel(nb_config, wxID_ANY); wxPanel* p_graphics = new wxPanel(nb_config, wxID_ANY); wxPanel* p_audio = new wxPanel(nb_config, wxID_ANY); wxPanel* p_io = new wxPanel(nb_config, wxID_ANY); - wxPanel* p_hle = new wxPanel(nb_config, wxID_ANY); + wxPanel* p_misc = new wxPanel(nb_config, wxID_ANY); wxPanel* p_networking = new wxPanel(nb_config, wxID_ANY); - nb_config->AddPage(p_cpu, wxT("Core")); + nb_config->AddPage(p_core, wxT("Core")); nb_config->AddPage(p_graphics, wxT("Graphics")); nb_config->AddPage(p_audio, wxT("Audio")); nb_config->AddPage(p_io, wxT("Input / Output")); - nb_config->AddPage(p_hle, wxT("HLE / Misc.")); + nb_config->AddPage(p_misc, wxT("Miscellaneous")); nb_config->AddPage(p_networking, wxT("Networking")); nb_config->AddPage(p_system, wxT("System")); wxBoxSizer* s_subpanel_system = new wxBoxSizer(wxVERTICAL); - wxBoxSizer* s_subpanel_cpu = new wxBoxSizer(wxVERTICAL); + wxBoxSizer* s_subpanel_core = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_subpanel_graphics = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_subpanel_audio = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_subpanel_io = new wxBoxSizer(wxVERTICAL); - wxBoxSizer* s_subpanel_hle = new wxBoxSizer(wxVERTICAL); + wxBoxSizer* s_subpanel_misc = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_subpanel_networking = new wxBoxSizer(wxVERTICAL); - // CPU/SPU settings - wxStaticBoxSizer* s_round_cpu_decoder = new wxStaticBoxSizer(wxVERTICAL, p_cpu, _("CPU")); - wxStaticBoxSizer* s_round_spu_decoder = new wxStaticBoxSizer(wxVERTICAL, p_cpu, _("SPU")); + // Core settings + wxStaticBoxSizer* s_round_cpu_decoder = new wxStaticBoxSizer(wxVERTICAL, p_core, _("CPU")); + wxStaticBoxSizer* s_round_spu_decoder = new wxStaticBoxSizer(wxVERTICAL, p_core, _("SPU")); // Graphics wxStaticBoxSizer* s_round_gs_render = new wxStaticBoxSizer(wxVERTICAL, p_graphics, _("Render")); @@ -413,8 +413,8 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) // Audio wxStaticBoxSizer* s_round_audio_out = new wxStaticBoxSizer(wxVERTICAL, p_audio, _("Audio Out")); - // HLE / Misc. - wxStaticBoxSizer* s_round_hle_log_lvl = new wxStaticBoxSizer(wxVERTICAL, p_hle, _("Log Level")); + // Miscellaneous + wxStaticBoxSizer* s_round_hle_log_lvl = new wxStaticBoxSizer(wxVERTICAL, p_misc, _("Log Level")); // Networking wxStaticBoxSizer* s_round_net_status = new wxStaticBoxSizer(wxVERTICAL, p_networking, _("Connection status")); @@ -423,8 +423,8 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) // System wxStaticBoxSizer* s_round_sys_lang = new wxStaticBoxSizer(wxVERTICAL, p_system, _("Language")); - wxComboBox* cbox_cpu_decoder = new wxComboBox(p_cpu, wxID_ANY); - wxComboBox* cbox_spu_decoder = new wxComboBox(p_cpu, wxID_ANY); + wxComboBox* cbox_cpu_decoder = new wxComboBox(p_core, wxID_ANY); + wxComboBox* cbox_spu_decoder = new wxComboBox(p_core, wxID_ANY); wxComboBox* cbox_gs_render = new wxComboBox(p_graphics, wxID_ANY); wxComboBox* cbox_gs_resolution = new wxComboBox(p_graphics, wxID_ANY); wxComboBox* cbox_gs_aspect = new wxComboBox(p_graphics, wxID_ANY); @@ -435,11 +435,13 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) wxComboBox* cbox_camera = new wxComboBox(p_io, wxID_ANY); wxComboBox* cbox_camera_type = new wxComboBox(p_io, wxID_ANY); wxComboBox* cbox_audio_out = new wxComboBox(p_audio, wxID_ANY); - wxComboBox* cbox_hle_loglvl = new wxComboBox(p_hle, wxID_ANY); + wxComboBox* cbox_hle_loglvl = new wxComboBox(p_misc, wxID_ANY); wxComboBox* cbox_net_status = new wxComboBox(p_networking, wxID_ANY); wxComboBox* cbox_net_interface = new wxComboBox(p_networking, wxID_ANY); wxComboBox* cbox_sys_lang = new wxComboBox(p_system, wxID_ANY); + wxCheckBox* chbox_core_hook_stfunc = new wxCheckBox(p_core, wxID_ANY, "Hook static functions"); + wxCheckBox* chbox_core_load_liblv2 = new wxCheckBox(p_core, wxID_ANY, "Load liblv2.sprx"); wxCheckBox* chbox_gs_log_prog = new wxCheckBox(p_graphics, wxID_ANY, "Log vertex/fragment programs"); wxCheckBox* chbox_gs_dump_depth = new wxCheckBox(p_graphics, wxID_ANY, "Write Depth Buffer"); wxCheckBox* chbox_gs_dump_color = new wxCheckBox(p_graphics, wxID_ANY, "Write Color Buffers"); @@ -448,16 +450,15 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) wxCheckBox* chbox_gs_3dmonitor = new wxCheckBox(p_graphics, wxID_ANY, "3D Monitor"); wxCheckBox* chbox_audio_dump = new wxCheckBox(p_audio, wxID_ANY, "Dump to file"); wxCheckBox* chbox_audio_conv = new wxCheckBox(p_audio, wxID_ANY, "Convert to 16 bit"); - wxCheckBox* chbox_hle_logging = new wxCheckBox(p_hle, wxID_ANY, "Log everything"); - wxCheckBox* chbox_rsx_logging = new wxCheckBox(p_hle, wxID_ANY, "RSX Logging"); - wxCheckBox* chbox_hle_hook_stfunc = new wxCheckBox(p_hle, wxID_ANY, "Hook static functions"); - wxCheckBox* chbox_hle_savetty = new wxCheckBox(p_hle, wxID_ANY, "Save TTY output to file"); - wxCheckBox* chbox_hle_exitonstop = new wxCheckBox(p_hle, wxID_ANY, "Exit RPCS3 when process finishes"); - wxCheckBox* chbox_hle_always_start = new wxCheckBox(p_hle, wxID_ANY, "Always start after boot"); + wxCheckBox* chbox_hle_logging = new wxCheckBox(p_misc, wxID_ANY, "Log everything"); + wxCheckBox* chbox_rsx_logging = new wxCheckBox(p_misc, wxID_ANY, "RSX Logging"); + wxCheckBox* chbox_hle_savetty = new wxCheckBox(p_misc, wxID_ANY, "Save TTY output to file"); + wxCheckBox* chbox_hle_exitonstop = new wxCheckBox(p_misc, wxID_ANY, "Exit RPCS3 when process finishes"); + wxCheckBox* chbox_hle_always_start = new wxCheckBox(p_misc, wxID_ANY, "Always start after boot"); //Auto Pause - wxCheckBox* chbox_dbg_ap_systemcall = new wxCheckBox(p_hle, wxID_ANY, "Auto Pause at System Call"); - wxCheckBox* chbox_dbg_ap_functioncall = new wxCheckBox(p_hle, wxID_ANY, "Auto Pause at Function Call"); + wxCheckBox* chbox_dbg_ap_systemcall = new wxCheckBox(p_misc, wxID_ANY, "Auto Pause at System Call"); + wxCheckBox* chbox_dbg_ap_functioncall = new wxCheckBox(p_misc, wxID_ANY, "Auto Pause at Function Call"); //Custom EmulationDir wxCheckBox* chbox_emulationdir_enable = new wxCheckBox(p_system, wxID_ANY, "Use Path Below as EmulationDir ? (Need Restart)"); @@ -610,10 +611,11 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) chbox_audio_conv ->SetValue(Ini.AudioConvertToU16.GetValue()); chbox_hle_logging ->SetValue(Ini.HLELogging.GetValue()); chbox_rsx_logging ->SetValue(Ini.RSXLogging.GetValue()); - chbox_hle_hook_stfunc ->SetValue(Ini.HLEHookStFunc.GetValue()); chbox_hle_savetty ->SetValue(Ini.HLESaveTTY.GetValue()); chbox_hle_exitonstop ->SetValue(Ini.HLEExitOnStop.GetValue()); chbox_hle_always_start ->SetValue(Ini.HLEAlwaysStart.GetValue()); + chbox_core_hook_stfunc ->SetValue(Ini.HookStFunc.GetValue()); + chbox_core_load_liblv2 ->SetValue(Ini.LoadLibLv2.GetValue()); //Auto Pause related chbox_dbg_ap_systemcall ->SetValue(Ini.DBGAutoPauseSystemCall.GetValue()); @@ -668,8 +670,10 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) s_round_sys_lang->Add(cbox_sys_lang, wxSizerFlags().Border(wxALL, 5).Expand()); // Core - s_subpanel_cpu->Add(s_round_cpu_decoder, wxSizerFlags().Border(wxALL, 5).Expand()); - s_subpanel_cpu->Add(s_round_spu_decoder, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_core->Add(s_round_cpu_decoder, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_core->Add(s_round_spu_decoder, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_core->Add(chbox_core_hook_stfunc, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_core->Add(chbox_core_load_liblv2, wxSizerFlags().Border(wxALL, 5).Expand()); // Graphics s_subpanel_graphics->Add(s_round_gs_render, wxSizerFlags().Border(wxALL, 5).Expand()); @@ -695,18 +699,17 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) s_subpanel_audio->Add(chbox_audio_dump, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_audio->Add(chbox_audio_conv, wxSizerFlags().Border(wxALL, 5).Expand()); - // HLE / Misc. - s_subpanel_hle->Add(s_round_hle_log_lvl, wxSizerFlags().Border(wxALL, 5).Expand()); - s_subpanel_hle->Add(chbox_hle_logging, wxSizerFlags().Border(wxALL, 5).Expand()); - s_subpanel_hle->Add(chbox_rsx_logging, wxSizerFlags().Border(wxALL, 5).Expand()); - s_subpanel_hle->Add(chbox_hle_hook_stfunc, wxSizerFlags().Border(wxALL, 5).Expand()); - s_subpanel_hle->Add(chbox_hle_savetty, wxSizerFlags().Border(wxALL, 5).Expand()); - s_subpanel_hle->Add(chbox_hle_exitonstop, wxSizerFlags().Border(wxALL, 5).Expand()); - s_subpanel_hle->Add(chbox_hle_always_start, wxSizerFlags().Border(wxALL, 5).Expand()); + // Miscellaneous + s_subpanel_misc->Add(s_round_hle_log_lvl, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_misc->Add(chbox_hle_logging, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_misc->Add(chbox_rsx_logging, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_misc->Add(chbox_hle_savetty, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_misc->Add(chbox_hle_exitonstop, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_misc->Add(chbox_hle_always_start, wxSizerFlags().Border(wxALL, 5).Expand()); // Auto Pause - s_subpanel_hle->Add(chbox_dbg_ap_systemcall, wxSizerFlags().Border(wxALL, 5).Expand()); - s_subpanel_hle->Add(chbox_dbg_ap_functioncall, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_misc->Add(chbox_dbg_ap_systemcall, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_misc->Add(chbox_dbg_ap_functioncall, wxSizerFlags().Border(wxALL, 5).Expand()); // Networking s_subpanel_networking->Add(s_round_net_status, wxSizerFlags().Border(wxALL, 5).Expand()); @@ -725,11 +728,11 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) s_b_panel->Add(new wxButton(&diag, wxID_CANCEL), wxSizerFlags().Border(wxALL, 5).Bottom()); // Resize panels - diag.SetSizerAndFit(s_subpanel_cpu, false); + diag.SetSizerAndFit(s_subpanel_core, false); diag.SetSizerAndFit(s_subpanel_graphics, false); diag.SetSizerAndFit(s_subpanel_io, false); diag.SetSizerAndFit(s_subpanel_audio, false); - diag.SetSizerAndFit(s_subpanel_hle, false); + diag.SetSizerAndFit(s_subpanel_misc, false); diag.SetSizerAndFit(s_subpanel_networking, false); diag.SetSizerAndFit(s_subpanel_system, false); diag.SetSizerAndFit(s_b_panel, false); @@ -740,6 +743,8 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) { Ini.CPUDecoderMode.SetValue(cbox_cpu_decoder->GetSelection()); Ini.SPUDecoderMode.SetValue(cbox_spu_decoder->GetSelection()); + Ini.HookStFunc.SetValue(chbox_core_hook_stfunc->GetValue()); + Ini.LoadLibLv2.SetValue(chbox_core_load_liblv2->GetValue()); Ini.GSRenderMode.SetValue(cbox_gs_render->GetSelection()); Ini.GSResolution.SetValue(ResolutionNumToId(cbox_gs_resolution->GetSelection() + 1)); Ini.GSAspectRatio.SetValue(cbox_gs_aspect->GetSelection() + 1); @@ -760,7 +765,6 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) Ini.CameraType.SetValue(cbox_camera_type->GetSelection()); Ini.HLELogging.SetValue(chbox_hle_logging->GetValue()); Ini.RSXLogging.SetValue(chbox_rsx_logging->GetValue()); - Ini.HLEHookStFunc.SetValue(chbox_hle_hook_stfunc->GetValue()); Ini.HLESaveTTY.SetValue(chbox_hle_savetty->GetValue()); Ini.HLEExitOnStop.SetValue(chbox_hle_exitonstop->GetValue()); Ini.HLELogLvl.SetValue(cbox_hle_loglvl->GetSelection()); diff --git a/rpcs3/Gui/MemoryStringSearcher.cpp b/rpcs3/Gui/MemoryStringSearcher.cpp index 5019ed7985..c30f02091d 100644 --- a/rpcs3/Gui/MemoryStringSearcher.cpp +++ b/rpcs3/Gui/MemoryStringSearcher.cpp @@ -6,9 +6,6 @@ #include "Emu/System.h" #include "MemoryStringSearcher.h" -#include "Emu/RSX/sysutil_video.h" -#include "Emu/RSX/GSManager.h" -//#include "Emu/RSX/GCM.h" #include diff --git a/rpcs3/Gui/MsgDialog.cpp b/rpcs3/Gui/MsgDialog.cpp index 6a713908d8..b58d01b595 100644 --- a/rpcs3/Gui/MsgDialog.cpp +++ b/rpcs3/Gui/MsgDialog.cpp @@ -17,27 +17,27 @@ void MsgDialogFrame::Create(u32 type, std::string msg) m_button_yes = nullptr; m_button_no = nullptr; - m_dialog = new wxDialog(parent, wxID_ANY, type & CELL_MSGDIALOG_TYPE_SE_TYPE ? "" : "Error", wxDefaultPosition, wxDefaultSize); + m_dialog = std::make_unique(parent, wxID_ANY, type & CELL_MSGDIALOG_TYPE_SE_TYPE ? "" : "Error", wxDefaultPosition, wxDefaultSize); m_dialog->SetExtraStyle(m_dialog->GetExtraStyle() | wxWS_EX_TRANSIENT); m_dialog->SetTransparent(127 + (type & CELL_MSGDIALOG_TYPE_BG) * (128 / CELL_MSGDIALOG_TYPE_BG_INVISIBLE)); m_sizer1 = new wxBoxSizer(wxVERTICAL); - m_text = new wxStaticText(m_dialog, wxID_ANY, wxString(msg.c_str(), wxConvUTF8)); + m_text = new wxStaticText(m_dialog.get(), wxID_ANY, wxString(msg.c_str(), wxConvUTF8)); m_sizer1->Add(m_text, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 16); switch (type & CELL_MSGDIALOG_TYPE_PROGRESSBAR) { case CELL_MSGDIALOG_TYPE_PROGRESSBAR_DOUBLE: - m_gauge2 = new wxGauge(m_dialog, wxID_ANY, 100, wxDefaultPosition, wxSize(300, -1), wxGA_HORIZONTAL | wxGA_SMOOTH); - m_text2 = new wxStaticText(m_dialog, wxID_ANY, ""); + m_gauge2 = new wxGauge(m_dialog.get(), wxID_ANY, 100, wxDefaultPosition, wxSize(300, -1), wxGA_HORIZONTAL | wxGA_SMOOTH); + m_text2 = new wxStaticText(m_dialog.get(), wxID_ANY, ""); m_text2->SetAutoLayout(true); // fallthrough case CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE: - m_gauge1 = new wxGauge(m_dialog, wxID_ANY, 100, wxDefaultPosition, wxSize(300, -1), wxGA_HORIZONTAL | wxGA_SMOOTH); - m_text1 = new wxStaticText(m_dialog, wxID_ANY, ""); + m_gauge1 = new wxGauge(m_dialog.get(), wxID_ANY, 100, wxDefaultPosition, wxSize(300, -1), wxGA_HORIZONTAL | wxGA_SMOOTH); + m_text1 = new wxStaticText(m_dialog.get(), wxID_ANY, ""); m_text1->SetAutoLayout(true); } @@ -59,9 +59,9 @@ void MsgDialogFrame::Create(u32 type, std::string msg) if (type & CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO) { - m_button_yes = new wxButton(m_dialog, wxID_YES); + m_button_yes = new wxButton(m_dialog.get(), wxID_YES); m_buttons->Add(m_button_yes, 0, wxALIGN_CENTER_HORIZONTAL | wxRIGHT, 8); - m_button_no = new wxButton(m_dialog, wxID_NO); + m_button_no = new wxButton(m_dialog.get(), wxID_NO); m_buttons->Add(m_button_no, 0, wxALIGN_CENTER_HORIZONTAL, 16); if ((type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR) == CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO) @@ -78,7 +78,7 @@ void MsgDialogFrame::Create(u32 type, std::string msg) if (type & CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK) { - m_button_ok = new wxButton(m_dialog, wxID_OK); + m_button_ok = new wxButton(m_dialog.get(), wxID_OK); m_buttons->Add(m_button_ok, 0, wxALIGN_CENTER_HORIZONTAL, 16); if ((type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR) == CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK) @@ -119,8 +119,7 @@ void MsgDialogFrame::Create(u32 type, std::string msg) void MsgDialogFrame::Destroy() { - delete m_dialog; - m_dialog = nullptr; + m_dialog.reset(); } void MsgDialogFrame::ProgressBarSetMsg(u32 index, std::string msg) diff --git a/rpcs3/Gui/MsgDialog.h b/rpcs3/Gui/MsgDialog.h index 413e4efe4e..84fcb23799 100644 --- a/rpcs3/Gui/MsgDialog.h +++ b/rpcs3/Gui/MsgDialog.h @@ -4,7 +4,7 @@ class MsgDialogFrame : public MsgDialogInstance { - wxDialog* m_dialog; + std::unique_ptr m_dialog; wxGauge* m_gauge1; wxGauge* m_gauge2; wxStaticText* m_text1; diff --git a/rpcs3/Gui/RSXDebugger.cpp b/rpcs3/Gui/RSXDebugger.cpp index 49eba35722..21af469a7a 100644 --- a/rpcs3/Gui/RSXDebugger.cpp +++ b/rpcs3/Gui/RSXDebugger.cpp @@ -6,7 +6,7 @@ #include "Emu/System.h" #include "RSXDebugger.h" -#include "Emu/RSX/sysutil_video.h" +#include "Emu/SysCalls/Modules/cellVideoOut.h" #include "Emu/RSX/GSManager.h" #include "Emu/RSX/GSRender.h" //#include "Emu/RSX/GCM.h" diff --git a/rpcs3/Ini.h b/rpcs3/Ini.h index c3e9432d9a..5e43bc0353 100644 --- a/rpcs3/Ini.h +++ b/rpcs3/Ini.h @@ -93,6 +93,8 @@ public: // Core IniEntry CPUDecoderMode; IniEntry SPUDecoderMode; + IniEntry HookStFunc; + IniEntry LoadLibLv2; // Graphics IniEntry GSRenderMode; @@ -150,7 +152,6 @@ public: IniEntry NETInterface; IniEntry HLELogging; IniEntry RSXLogging; - IniEntry HLEHookStFunc; IniEntry HLESaveTTY; IniEntry HLEExitOnStop; IniEntry HLEAlwaysStart; @@ -174,8 +175,10 @@ public: path = DefPath; // Core - CPUDecoderMode.Init("CPU_DecoderMode", path); - SPUDecoderMode.Init("CPU_SPUDecoderMode", path); + CPUDecoderMode.Init("CORE_DecoderMode", path); + SPUDecoderMode.Init("CORE_SPUDecoderMode", path); + HookStFunc.Init("CORE_HookStFunc", path); + LoadLibLv2.Init("CORE_LoadLibLv2", path); // Graphics GSRenderMode.Init("GS_RenderMode", path); @@ -227,12 +230,11 @@ public: PadHandlerRStickRight.Init("ControlSetings_PadHandlerRStickRight", path); PadHandlerRStickUp.Init("ControlSetings_PadHandlerRStickUp", path); - // HLE/Misc + // Miscellaneous HLELogging.Init("HLE_HLELogging", path); RSXLogging.Init("RSX_Logging", path); NETStatus.Init("NET_Status", path); NETInterface.Init("NET_Interface", path); - HLEHookStFunc.Init("HLE_HLEHookStFunc", path); HLESaveTTY.Init("HLE_HLESaveTTY", path); HLEExitOnStop.Init("HLE_HLEExitOnStop", path); HLELogLvl.Init("HLE_HLELogLvl", path); @@ -255,6 +257,8 @@ public: // Core CPUDecoderMode.Load(0); SPUDecoderMode.Load(0); + HookStFunc.Load(false); + LoadLibLv2.Load(false); // Graphics GSRenderMode.Load(1); @@ -306,12 +310,11 @@ public: PadHandlerRStickRight.Load(312); //WXK_END PadHandlerRStickUp.Load(366); //WXK_PAGEUP - // HLE/Miscs + // Miscellaneous HLELogging.Load(false); RSXLogging.Load(false); NETStatus.Load(0); NETInterface.Load(0); - HLEHookStFunc.Load(false); HLESaveTTY.Load(false); HLEExitOnStop.Load(false); HLELogLvl.Load(3); @@ -331,9 +334,11 @@ public: void Save() { - // CPU/SPU + // Core CPUDecoderMode.Save(); SPUDecoderMode.Save(); + HookStFunc.Save(); + LoadLibLv2.Save(); // Graphics GSRenderMode.Save(); @@ -385,12 +390,11 @@ public: PadHandlerRStickRight.Save(); PadHandlerRStickUp.Save(); - // HLE/Miscs + // Miscellaneous HLELogging.Save(); RSXLogging.Save(); NETStatus.Save(); NETInterface.Save(); - HLEHookStFunc.Save(); HLESaveTTY.Save(); HLEExitOnStop.Save(); HLELogLvl.Save(); diff --git a/rpcs3/Loader/ELF64.cpp b/rpcs3/Loader/ELF64.cpp index 15bd8d054f..59fd74e558 100644 --- a/rpcs3/Loader/ELF64.cpp +++ b/rpcs3/Loader/ELF64.cpp @@ -606,7 +606,11 @@ namespace loader { m_stream->Seek(handler::get_stream_offset() + phdr.p_offset); m_stream->Read(phdr.p_vaddr.get_ptr(), phdr.p_filesz); - hook_ppu_funcs(vm::static_ptr_cast>(phdr.p_vaddr), phdr.p_filesz / 4); + + if (Ini.HookStFunc.GetValue()) + { + hook_ppu_funcs(vm::static_ptr_cast>(phdr.p_vaddr), phdr.p_filesz / 4); + } } } break; diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index b0b9837289..55c03ef611 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -30,7 +30,7 @@ - + @@ -44,7 +44,16 @@ + + + + + + + + + @@ -251,19 +260,27 @@ + + + + + + + + @@ -278,12 +295,23 @@ + + + - + + + + + + + + + @@ -318,9 +346,9 @@ + - @@ -487,7 +515,6 @@ - @@ -524,6 +551,7 @@ + @@ -562,7 +590,9 @@ + + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index f69dd07f16..61a820ccb3 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -57,9 +57,6 @@ {fcac6852-b45f-4cf2-afee-cf56bcea14e5} - - {ead7494f-a872-4b4d-a864-1a61c3b6012f} - {13d20086-2188-425a-9856-0440fe6f79f2} @@ -413,72 +410,6 @@ Emu\SysCalls - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - - - Utilities - Emu\SysCalls\lv2 @@ -884,6 +815,156 @@ Emu\SysCalls\Modules + + Utilities + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + @@ -1258,18 +1339,9 @@ Emu - - Emu\SysCalls\currently_unused - - - Emu\SysCalls\currently_unused - Emu\SysCalls - - Utilities - Emu\SysCalls\lv2 @@ -1384,9 +1456,6 @@ Emu\GPU\RSX - - Emu\GPU\RSX - Emu\GPU\RSX @@ -1738,5 +1807,23 @@ Emu\SysCalls\Modules + + Utilities + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + \ No newline at end of file diff --git a/rpcs3/stdafx.h b/rpcs3/stdafx.h index 401e14293c..0e6635f399 100644 --- a/rpcs3/stdafx.h +++ b/rpcs3/stdafx.h @@ -42,6 +42,11 @@ #include "Utilities/GNU.h" +#define CHECK_SIZE(type, size) static_assert(sizeof(type) == size, "Invalid " #type " type size") +#define CHECK_ALIGN(type, align) static_assert(__alignof(type) == align, "Invalid " #type " type alignment") +#define CHECK_MAX_SIZE(type, size) static_assert(sizeof(type) <= size, #type " type size is too big") +#define CHECK_SIZE_ALIGN(type, size, align) CHECK_SIZE(type, size); CHECK_ALIGN(type, align) + using uint = unsigned int; using u8 = std::uint8_t; @@ -54,11 +59,28 @@ using s16 = std::int16_t; using s32 = std::int32_t; using s64 = std::int64_t; -using b8 = std::uint8_t; - using f32 = float; using f64 = double; +// bool type replacement for PS3/PSV +class b8 +{ + std::uint8_t m_value; + +public: + b8(const bool value) + : m_value(value) + { + } + + operator bool() const //template::value>> operator T() const + { + return m_value != 0; + } +}; + +CHECK_SIZE_ALIGN(b8, 1, 1); + template::value>> inline T align(const T& value, u64 align) { return static_cast((value + (align - 1)) & ~(align - 1)); @@ -97,36 +119,15 @@ struct explicit_bool_t }; // return 32 bit sizeof() to avoid widening/narrowing conversions with size_t -#define sizeof32(type) static_cast(sizeof32_t::value) +#define sizeof32(type) static_cast(sizeof(type)) // return 32 bit alignof() to avoid widening/narrowing conversions with size_t -#define alignof32(type) static_cast(alignof32_t<__alignof(type)>::value) - -template struct sizeof32_t -{ - static_assert(Size <= UINT32_MAX, "sizeof32() error: size is too big"); - - enum : u32 { value = static_cast(Size) }; -}; - -template struct alignof32_t -{ - static_assert(Align <= UINT32_MAX, "alignof32() error: alignment is too big"); - - enum : u32 { value = static_cast(Align) }; -}; - -template using func_def = T; // workaround for MSVC bug: `using X = func_def;` instead of `using X = void();` +#define alignof32(type) static_cast(__alignof(type)) template struct ID_type; #define REG_ID_TYPE(t, id) template<> struct ID_type { enum : u32 { type = id }; } -#define CHECK_SIZE(type, size) static_assert(sizeof(type) == size, "Invalid " #type " type size") -#define CHECK_ALIGN(type, align) static_assert(__alignof(type) == align, "Invalid " #type " type alignment") -#define CHECK_MAX_SIZE(type, size) static_assert(sizeof(type) <= size, #type " type size is too big") -#define CHECK_SIZE_ALIGN(type, size, align) CHECK_SIZE(type, size); CHECK_ALIGN(type, align) - #define WRAP_EXPR(expr) [&]{ return expr; } #define COPY_EXPR(expr) [=]{ return expr; } #define EXCEPTION(text, ...) fmt::exception(__FILE__, __LINE__, __FUNCTION__, text, ##__VA_ARGS__)