diff --git a/orbis-kernel/include/orbis/error/ErrorCode.hpp b/orbis-kernel/include/orbis/error/ErrorCode.hpp index 04be1bfa0..5105987c2 100644 --- a/orbis-kernel/include/orbis/error/ErrorCode.hpp +++ b/orbis-kernel/include/orbis/error/ErrorCode.hpp @@ -110,9 +110,9 @@ enum class ErrorCode : int { }; } // namespace orbis -#define ORBIS_RET_ON_ERROR(...) \ - do { \ - if (auto errc___ = (__VA_ARGS__); errc___ != ::orbis::ErrorCode{}) { \ - return errc___; \ - } \ +#define ORBIS_RET_ON_ERROR(...) \ + do { \ + if (auto errc___ = (__VA_ARGS__); errc___ != ::orbis::ErrorCode{}) { \ + return errc___; \ + } \ } while (false) diff --git a/orbis-kernel/include/orbis/thread/ProcessOps.hpp b/orbis-kernel/include/orbis/thread/ProcessOps.hpp index ecb36a8ac..08cbf5251 100644 --- a/orbis-kernel/include/orbis/thread/ProcessOps.hpp +++ b/orbis-kernel/include/orbis/thread/ProcessOps.hpp @@ -65,8 +65,8 @@ struct ProcessOps { uint64_t arg3); SysResult (*dynlib_unload_prx)(Thread *thread, ModuleHandle handle); - SysResult (*thr_create)(Thread *thread, ptr ctxt, - ptr arg, sint flags); + SysResult (*thr_create)(Thread *thread, ptr ctxt, ptr arg, + sint flags); SysResult (*thr_new)(Thread *thread, ptr param, sint param_size); SysResult (*thr_exit)(Thread *thread, ptr state); SysResult (*thr_kill)(Thread *thread, slong id, sint sig); diff --git a/orbis-kernel/include/orbis/ucontext.hpp b/orbis-kernel/include/orbis/ucontext.hpp index 3d8cff4b8..6882132b3 100644 --- a/orbis-kernel/include/orbis/ucontext.hpp +++ b/orbis-kernel/include/orbis/ucontext.hpp @@ -83,7 +83,6 @@ struct UContext { static_assert(sizeof(UContext) == 0x500); - enum Signal { kSigHup = 1, kSigInt = 2, diff --git a/orbis-kernel/include/orbis/uio.hpp b/orbis-kernel/include/orbis/uio.hpp index 959445114..d80e8a49e 100644 --- a/orbis-kernel/include/orbis/uio.hpp +++ b/orbis-kernel/include/orbis/uio.hpp @@ -1,7 +1,7 @@ #pragma once -#include "orbis-config.hpp" #include "error/ErrorCode.hpp" +#include "orbis-config.hpp" #include #include #include @@ -49,8 +49,7 @@ struct Uio { return {}; } - template - ErrorCode write(const T &object) { + template ErrorCode write(const T &object) { return write(&object, sizeof(T)); } }; diff --git a/orbis-kernel/include/orbis/umtx.hpp b/orbis-kernel/include/orbis/umtx.hpp index 79234d6e8..3999ba96a 100644 --- a/orbis-kernel/include/orbis/umtx.hpp +++ b/orbis-kernel/include/orbis/umtx.hpp @@ -54,7 +54,6 @@ inline constexpr auto kUmtxOpNwakePrivate = 21; inline constexpr auto kUmtxOpMutexWake2 = 22; inline constexpr auto kUmtxOpMutexWake3 = 23; - inline constexpr auto kSemNamed = 2; struct umtx { diff --git a/orbis-kernel/src/module.cpp b/orbis-kernel/src/module.cpp index f78e0c67a..8d002ab5b 100644 --- a/orbis-kernel/src/module.cpp +++ b/orbis-kernel/src/module.cpp @@ -203,7 +203,8 @@ static orbis::SysResult doRelocation(orbis::Process *process, auto &defModule = module->importedModules.at(symbol.moduleIndex); if (!defModule) { - // std::printf("'%s' ('%s') uses undefined symbol '%llx' in unloaded module " + // std::printf("'%s' ('%s') uses undefined symbol '%llx' in unloaded + // module " // "'%s', rel %u\n", // module->moduleName, module->soName, // (unsigned long long)symbol.id, @@ -295,7 +296,8 @@ static orbis::SysResult doRelocation(orbis::Process *process, if (defObj == nullptr) { return orbis::ErrorCode::INVAL; } - *where32 = S ? reinterpret_cast(defObj->base) + S + A - P : 0; + *where32 = + S ? reinterpret_cast(defObj->base) + S + A - P : 0; return {}; } // case kRelCopy: diff --git a/orbis-kernel/src/pipe.cpp b/orbis-kernel/src/pipe.cpp index 1458c0a74..21577b823 100644 --- a/orbis-kernel/src/pipe.cpp +++ b/orbis-kernel/src/pipe.cpp @@ -12,8 +12,8 @@ static orbis::ErrorCode pipe_read(orbis::File *file, orbis::Uio *uio, while (true) { if (pipe->data.empty()) { // pipe->cv.wait(file->mtx); - // ORBIS_LOG_ERROR(__FUNCTION__, "wakeup", thread->name, thread->tid, file); - // continue; + // ORBIS_LOG_ERROR(__FUNCTION__, "wakeup", thread->name, thread->tid, + // file); continue; return orbis::ErrorCode::WOULDBLOCK; } @@ -32,7 +32,8 @@ static orbis::ErrorCode pipe_read(orbis::File *file, orbis::Uio *uio, uio->offset += size; std::memcpy(vec.base, pipe->data.data(), size); - ORBIS_LOG_ERROR(__FUNCTION__, thread->name, thread->tid, file, size, pipe->data.size(), uio->offset, file->nextOff); + ORBIS_LOG_ERROR(__FUNCTION__, thread->name, thread->tid, file, size, + pipe->data.size(), uio->offset, file->nextOff); if (pipe->data.size() == size) { pipe->data.clear(); @@ -69,9 +70,10 @@ static orbis::ErrorCode pipe_write(orbis::File *file, orbis::Uio *uio, uio->resid -= cnt; uio->offset += cnt; - ORBIS_LOG_ERROR(__FUNCTION__, thread->name, thread->tid, file, uio->resid, uio->offset, file->nextOff, cnt); + ORBIS_LOG_ERROR(__FUNCTION__, thread->name, thread->tid, file, uio->resid, + uio->offset, file->nextOff, cnt); thread->where(); - return{}; + return {}; } static orbis::FileOps pipe_ops = { @@ -79,7 +81,8 @@ static orbis::FileOps pipe_ops = { .write = pipe_write, }; -std::pair, orbis::Ref> orbis::createPipe() { +std::pair, orbis::Ref> +orbis::createPipe() { auto a = knew(); auto b = knew(); a->event = knew(); diff --git a/orbis-kernel/src/sys/sys_context.cpp b/orbis-kernel/src/sys/sys_context.cpp index cfd0c2d62..70b1b7eca 100644 --- a/orbis-kernel/src/sys/sys_context.cpp +++ b/orbis-kernel/src/sys/sys_context.cpp @@ -1,15 +1,12 @@ #include "sys/sysproto.hpp" -orbis::SysResult orbis::sys_getcontext(Thread *thread, - ptr ucp) { +orbis::SysResult orbis::sys_getcontext(Thread *thread, ptr ucp) { return ErrorCode::NOSYS; } -orbis::SysResult orbis::sys_setcontext(Thread *thread, - ptr ucp) { +orbis::SysResult orbis::sys_setcontext(Thread *thread, ptr ucp) { return ErrorCode::NOSYS; } -orbis::SysResult orbis::sys_swapcontext(Thread *thread, - ptr oucp, +orbis::SysResult orbis::sys_swapcontext(Thread *thread, ptr oucp, ptr ucp) { return ErrorCode::NOSYS; } diff --git a/orbis-kernel/src/sys/sys_cpuset.cpp b/orbis-kernel/src/sys/sys_cpuset.cpp index 5852e068c..6e2af6f6c 100644 --- a/orbis-kernel/src/sys/sys_cpuset.cpp +++ b/orbis-kernel/src/sys/sys_cpuset.cpp @@ -148,7 +148,8 @@ orbis::SysResult orbis::sys_cpuset_setaffinity(Thread *thread, cpulevel_t level, auto threadHandle = whichThread->getNativeHandle(); auto hostCpuSet = toHostCpuSet(whichThread->affinity); ORBIS_LOG_ERROR(__FUNCTION__, threadHandle, thread->tid, id); - if (pthread_setaffinity_np(threadHandle, sizeof(hostCpuSet), &hostCpuSet)) { + if (pthread_setaffinity_np(threadHandle, sizeof(hostCpuSet), + &hostCpuSet)) { ORBIS_LOG_ERROR(__FUNCTION__, "failed to set affinity mask for host thread", whichThread->hostTid, whichThread->affinity.bits); diff --git a/orbis-kernel/src/sys/sys_descrip.cpp b/orbis-kernel/src/sys/sys_descrip.cpp index 300d72b9b..55ae68bf8 100644 --- a/orbis-kernel/src/sys/sys_descrip.cpp +++ b/orbis-kernel/src/sys/sys_descrip.cpp @@ -2,8 +2,8 @@ #include "orbis/utils/Logs.hpp" #include "stat.hpp" #include "sys/sysproto.hpp" -#include "thread/Thread.hpp" #include "thread/Process.hpp" +#include "thread/Thread.hpp" orbis::SysResult orbis::sys_getdtablesize(Thread *thread) { return ErrorCode::NOSYS; diff --git a/orbis-kernel/src/sys/sys_exec.cpp b/orbis-kernel/src/sys/sys_exec.cpp index cf423b5a3..756d1fabb 100644 --- a/orbis-kernel/src/sys/sys_exec.cpp +++ b/orbis-kernel/src/sys/sys_exec.cpp @@ -1,7 +1,7 @@ #include "sys/sysproto.hpp" -#include "thread/Thread.hpp" #include "thread/Process.hpp" #include "thread/ProcessOps.hpp" +#include "thread/Thread.hpp" orbis::SysResult orbis::sys_execve(Thread *thread, ptr fname, ptr> argv, ptr> envv) { diff --git a/orbis-kernel/src/sys/sys_exit.cpp b/orbis-kernel/src/sys/sys_exit.cpp index 85d144197..968d24d55 100644 --- a/orbis-kernel/src/sys/sys_exit.cpp +++ b/orbis-kernel/src/sys/sys_exit.cpp @@ -1,11 +1,11 @@ #include "KernelContext.hpp" #include "sys/sysproto.hpp" +#include "thread/Process.hpp" #include "thread/ProcessOps.hpp" #include "utils/Logs.hpp" #include #include #include -#include "thread/Process.hpp" orbis::SysResult orbis::sys_exit(Thread *thread, sint status) { if (auto exit = thread->tproc->ops->exit) { diff --git a/orbis-kernel/src/sys/sys_generic.cpp b/orbis-kernel/src/sys/sys_generic.cpp index cd0c44676..c56cf6735 100644 --- a/orbis-kernel/src/sys/sys_generic.cpp +++ b/orbis-kernel/src/sys/sys_generic.cpp @@ -1,8 +1,8 @@ #include "file.hpp" #include "orbis/utils/Logs.hpp" #include "sys/sysproto.hpp" -#include "thread/Thread.hpp" #include "thread/Process.hpp" +#include "thread/Thread.hpp" #include "uio.hpp" #include diff --git a/orbis-kernel/src/sys/sys_pipe.cpp b/orbis-kernel/src/sys/sys_pipe.cpp index 0c959e96e..396f6574d 100644 --- a/orbis-kernel/src/sys/sys_pipe.cpp +++ b/orbis-kernel/src/sys/sys_pipe.cpp @@ -1,6 +1,6 @@ #include "sys/sysproto.hpp" -#include "thread/Thread.hpp" #include "thread/Process.hpp" +#include "thread/Thread.hpp" #include "utils/Logs.hpp" #include diff --git a/orbis-kernel/src/sys/sys_resource.cpp b/orbis-kernel/src/sys/sys_resource.cpp index b59bbef0b..22327f42c 100644 --- a/orbis-kernel/src/sys/sys_resource.cpp +++ b/orbis-kernel/src/sys/sys_resource.cpp @@ -59,12 +59,12 @@ orbis::SysResult orbis::sys_rtprio_thread(Thread *thread, sint function, hostPolicy = SCHED_IDLE; } - if (pthread_setschedparam(targetThread->getNativeHandle(), - hostPolicy, &hostParam)) { - ORBIS_LOG_ERROR(__FUNCTION__, "failed to set host priority", - hostPriority, targetThread->prio.prio, - targetThread->prio.type, errno, - targetThread->getNativeHandle(), prioMin, prioMax, errno); + if (pthread_setschedparam(targetThread->getNativeHandle(), hostPolicy, + &hostParam)) { + ORBIS_LOG_ERROR( + __FUNCTION__, "failed to set host priority", hostPriority, + targetThread->prio.prio, targetThread->prio.type, errno, + targetThread->getNativeHandle(), prioMin, prioMax, errno); } } else { ORBIS_LOG_ERROR(__FUNCTION__, "set host priority", hostPriority, diff --git a/orbis-kernel/src/sys/sys_sce.cpp b/orbis-kernel/src/sys/sys_sce.cpp index 028da63bf..f7f9a9435 100644 --- a/orbis-kernel/src/sys/sys_sce.cpp +++ b/orbis-kernel/src/sys/sys_sce.cpp @@ -1165,8 +1165,7 @@ orbis::sys_dynlib_get_info_ex(Thread *thread, SceKernelModule handle, result.ehFrame = module->ehFrame; result.ehFrameHdrSize = module->ehFrameHdrSize; result.ehFrameSize = module->ehFrameSize; - std::memcpy(result.segments, module->segments, - sizeof(ModuleSegment) * 2); + std::memcpy(result.segments, module->segments, sizeof(ModuleSegment) * 2); result.segmentCount = 2; result.refCount = 1; ORBIS_LOG_WARNING(__FUNCTION__, result.id, result.name, result.tlsIndex, diff --git a/orbis-kernel/src/sys/sys_sig.cpp b/orbis-kernel/src/sys/sys_sig.cpp index 7cdee71cb..5b63bc233 100644 --- a/orbis-kernel/src/sys/sys_sig.cpp +++ b/orbis-kernel/src/sys/sys_sig.cpp @@ -140,14 +140,15 @@ orbis::SysResult orbis::sys_sigreturn(Thread *thread, ptr sigcntxp) { ORBIS_LOG_WARNING(__FUNCTION__, sigcntxp); // auto sigRet = thread->sigReturns.front(); - // thread->sigReturns.erase(thread->sigReturns.begin(), thread->sigReturns.begin() + 1); - // writeRegister(thread->context, RegisterId::rip, sigRet.rip); - // writeRegister(thread->context, RegisterId::rsp, sigRet.rsp); - // ORBIS_LOG_ERROR(__FUNCTION__, sigRet.rip, sigRet.rsp); + // thread->sigReturns.erase(thread->sigReturns.begin(), + // thread->sigReturns.begin() + 1); writeRegister(thread->context, + // RegisterId::rip, sigRet.rip); writeRegister(thread->context, + // RegisterId::rsp, sigRet.rsp); ORBIS_LOG_ERROR(__FUNCTION__, sigRet.rip, + // sigRet.rsp); return {}; } orbis::SysResult orbis::nosys(Thread *thread) { thread->sendSignal(kSigSys); - return{}; + return {}; } diff --git a/orbis-kernel/src/sys/sys_synch.cpp b/orbis-kernel/src/sys/sys_synch.cpp index 5485d48b5..1461a3598 100644 --- a/orbis-kernel/src/sys/sys_synch.cpp +++ b/orbis-kernel/src/sys/sys_synch.cpp @@ -2,6 +2,6 @@ #include orbis::SysResult orbis::sys_yield(Thread *thread) { - std::this_thread::yield(); - return {}; + std::this_thread::yield(); + return {}; } diff --git a/orbis-kernel/src/sys/sys_thr.cpp b/orbis-kernel/src/sys/sys_thr.cpp index d5f3d6945..7241496fd 100644 --- a/orbis-kernel/src/sys/sys_thr.cpp +++ b/orbis-kernel/src/sys/sys_thr.cpp @@ -1,11 +1,10 @@ #include "sys/sysproto.hpp" +#include "thread/Process.hpp" #include "thread/ProcessOps.hpp" #include "thread/Thread.hpp" -#include "thread/Process.hpp" #include "ucontext.hpp" -orbis::SysResult orbis::sys_thr_create(Thread *thread, - ptr ctxt, +orbis::SysResult orbis::sys_thr_create(Thread *thread, ptr ctxt, ptr arg, sint flags) { if (auto thr_create = thread->tproc->ops->thr_create) { return thr_create(thread, ctxt, arg, flags); diff --git a/orbis-kernel/src/sys/sys_uipc.cpp b/orbis-kernel/src/sys/sys_uipc.cpp index 1d04ffedd..7266ed877 100644 --- a/orbis-kernel/src/sys/sys_uipc.cpp +++ b/orbis-kernel/src/sys/sys_uipc.cpp @@ -1,8 +1,8 @@ #include "file.hpp" #include "sys/sysproto.hpp" +#include "thread/Process.hpp" #include "thread/ProcessOps.hpp" #include "thread/Thread.hpp" -#include "thread/Process.hpp" #include "uio.hpp" #include "utils/Logs.hpp" #include @@ -128,7 +128,8 @@ orbis::SysResult orbis::sys_recvfrom(Thread *thread, sint s, caddr_t buf, } if (auto recvfrom = file->ops->recvfrom) { - return SysResult::notAnError(recvfrom(file.get(), buf, len, flags, from, fromlenaddr, thread)); + return SysResult::notAnError( + recvfrom(file.get(), buf, len, flags, from, fromlenaddr, thread)); } return ErrorCode::NOTSUP; diff --git a/orbis-kernel/src/sys/sys_uipc_shm.cpp b/orbis-kernel/src/sys/sys_uipc_shm.cpp index 7883d0cdd..b13c3e3e4 100644 --- a/orbis-kernel/src/sys/sys_uipc_shm.cpp +++ b/orbis-kernel/src/sys/sys_uipc_shm.cpp @@ -1,9 +1,9 @@ #include "file.hpp" #include "orbis-config.hpp" #include "sys/sysproto.hpp" +#include "thread/Process.hpp" #include "thread/ProcessOps.hpp" #include "thread/Thread.hpp" -#include "thread/Process.hpp" orbis::SysResult orbis::sys_shm_open(Thread *thread, ptr path, sint flags, mode_t mode) { diff --git a/orbis-kernel/src/sys/sys_vfs.cpp b/orbis-kernel/src/sys/sys_vfs.cpp index 41d150ca2..50cb9ff22 100644 --- a/orbis-kernel/src/sys/sys_vfs.cpp +++ b/orbis-kernel/src/sys/sys_vfs.cpp @@ -1,8 +1,8 @@ #include "stat.hpp" #include "sys/sysproto.hpp" +#include "thread/Process.hpp" #include "thread/ProcessOps.hpp" #include "thread/Thread.hpp" -#include "thread/Process.hpp" #include "utils/Logs.hpp" #include #include @@ -71,8 +71,8 @@ orbis::SysResult orbis::sys_chroot(Thread *thread, ptr path) { } // volatile bool debuggerPresent = false; -orbis::SysResult orbis::sys_open(Thread *thread, ptr path, sint flags, - sint mode) { +orbis::SysResult orbis::sys_open(Thread *thread, ptr path, + sint flags, sint mode) { if (auto open = thread->tproc->ops->open) { Ref file; auto result = open(thread, path, flags, mode, &file); @@ -82,16 +82,18 @@ orbis::SysResult orbis::sys_open(Thread *thread, ptr path, sint flag auto fd = thread->tproc->fileDescriptors.insert(file); thread->retval[0] = fd; - // if (path == std::string_view{"/app0/psm/Application/resource/Sce.Vsh.ShellUI.SystemMessage.rco"}) { + // if (path == + // std::string_view{"/app0/psm/Application/resource/Sce.Vsh.ShellUI.SystemMessage.rco"}) + // { ORBIS_LOG_SUCCESS(__FUNCTION__, thread->tid, path, flags, mode, fd); if (path == std::string_view{"/app0/wave/wave1.fbxd"}) { thread->where(); } - // while (debuggerPresent == false) { - // std::this_thread::sleep_for(std::chrono::seconds(1)); - // } - // // thread->where(); + // while (debuggerPresent == false) { + // std::this_thread::sleep_for(std::chrono::seconds(1)); + // } + // // thread->where(); // } return {}; } @@ -288,13 +290,14 @@ orbis::SysResult orbis::sys_readlink(Thread *thread, ptr path, } Ref file; - if (auto error = thread->tproc->ops->open(thread, path, 0, 0, &file); error.value()) { + if (auto error = thread->tproc->ops->open(thread, path, 0, 0, &file); + error.value()) { return error; } ORBIS_RET_ON_ERROR(uwriteRaw(buf, _path, pathLen)); thread->retval[0] = pathLen; - return{}; + return {}; } orbis::SysResult orbis::sys_readlinkat(Thread *thread, sint fd, ptr path, ptr buf, size_t bufsize) { diff --git a/orbis-kernel/src/sys/sys_vfs_cache.cpp b/orbis-kernel/src/sys/sys_vfs_cache.cpp index 1455c965f..0983310f7 100644 --- a/orbis-kernel/src/sys/sys_vfs_cache.cpp +++ b/orbis-kernel/src/sys/sys_vfs_cache.cpp @@ -1,14 +1,14 @@ #include "sys/sysproto.hpp" -#include "thread/Thread.hpp" #include "thread/Process.hpp" +#include "thread/Thread.hpp" #include #include orbis::SysResult orbis::sys___getcwd(Thread *thread, ptr buf, uint buflen) { - + std::string cwd; - + { std::lock_guard lock(thread->tproc->mtx); cwd = std::string(thread->tproc->cwd); @@ -19,5 +19,5 @@ orbis::SysResult orbis::sys___getcwd(Thread *thread, ptr buf, } ORBIS_RET_ON_ERROR(uwriteRaw(buf, cwd.data(), cwd.size() + 1)); - return{}; + return {}; } diff --git a/orbis-kernel/src/sys/sys_vfs_mount.cpp b/orbis-kernel/src/sys/sys_vfs_mount.cpp index 2bb249ef1..6654593b1 100644 --- a/orbis-kernel/src/sys/sys_vfs_mount.cpp +++ b/orbis-kernel/src/sys/sys_vfs_mount.cpp @@ -1,7 +1,7 @@ #include "sys/sysproto.hpp" +#include "thread/Process.hpp" #include "thread/ProcessOps.hpp" #include "thread/Thread.hpp" -#include "thread/Process.hpp" orbis::SysResult orbis::sys_mount(Thread *thread, ptr type, ptr path, sint flags, caddr_t data) { diff --git a/orbis-kernel/src/sys/sys_vm_mmap.cpp b/orbis-kernel/src/sys/sys_vm_mmap.cpp index 811ff8ecc..0c8fa67fe 100644 --- a/orbis-kernel/src/sys/sys_vm_mmap.cpp +++ b/orbis-kernel/src/sys/sys_vm_mmap.cpp @@ -1,8 +1,8 @@ #include "error.hpp" #include "sys/sysproto.hpp" +#include "thread/Process.hpp" #include "thread/ProcessOps.hpp" #include "thread/Thread.hpp" -#include "thread/Process.hpp" orbis::SysResult orbis::sys_sbrk(Thread *, sint) { return ErrorCode::OPNOTSUPP; diff --git a/orbis-kernel/src/utils/SharedMutex.cpp b/orbis-kernel/src/utils/SharedMutex.cpp index af88cde71..23f68c214 100644 --- a/orbis-kernel/src/utils/SharedMutex.cpp +++ b/orbis-kernel/src/utils/SharedMutex.cpp @@ -47,7 +47,8 @@ void shared_mutex::impl_lock_shared(unsigned val) { if ((old % c_sig) + c_one >= c_sig) std::abort(); // "shared_mutex overflow" - while (impl_wait() != std::errc{}) {} + while (impl_wait() != std::errc{}) { + } lock_downgrade(); } void shared_mutex::impl_unlock_shared(unsigned old) { @@ -80,7 +81,7 @@ std::errc shared_mutex::impl_wait() { } } - return{}; + return {}; } void shared_mutex::impl_signal() { m_value += c_sig; @@ -120,7 +121,8 @@ void shared_mutex::impl_lock(unsigned val) { if ((old % c_sig) + c_one >= c_sig) std::abort(); // "shared_mutex overflow" - while (impl_wait() != std::errc{}) {} + while (impl_wait() != std::errc{}) { + } } void shared_mutex::impl_unlock(unsigned old) { if (old - c_one >= c_err) @@ -152,7 +154,8 @@ void shared_mutex::impl_lock_upgrade() { return; } - while (impl_wait() != std::errc{}) {} + while (impl_wait() != std::errc{}) { + } } bool shared_mutex::lock_forced(int count) { if (count == 0) diff --git a/rpcs3/3rdparty/CMakeLists.txt b/rpcs3/3rdparty/CMakeLists.txt index 05cd5511c..c21d73605 100644 --- a/rpcs3/3rdparty/CMakeLists.txt +++ b/rpcs3/3rdparty/CMakeLists.txt @@ -102,7 +102,7 @@ add_subdirectory(yaml-cpp) # OpenGL -if (NOT ANDROID) +if (NOT ANDROID AND NOT WITHOUT_OPENGL) find_package(OpenGL REQUIRED OPTIONAL_COMPONENTS EGL) add_library(3rdparty_opengl INTERFACE) @@ -212,7 +212,7 @@ endif() add_subdirectory(asmjit EXCLUDE_FROM_ALL) # OpenAL -if (NOT ANDROID) +if (NOT ANDROID AND NOT WITHOUT_OPENAL) add_subdirectory(OpenAL EXCLUDE_FROM_ALL) else() add_library(3rdparty_openal INTERFACE) @@ -303,7 +303,7 @@ endif() # GLEW add_library(3rdparty_glew INTERFACE) -if(NOT MSVC AND NOT ANDROID) +if(NOT MSVC AND NOT ANDROID AND NOT WITHOUT_OPENGLEW) find_package(GLEW REQUIRED) target_link_libraries(3rdparty_glew INTERFACE GLEW::GLEW) endif() diff --git a/rpcs3/3rdparty/zstd/CMakeLists.txt b/rpcs3/3rdparty/zstd/CMakeLists.txt index 5a8b6f3d9..a7711928f 100644 --- a/rpcs3/3rdparty/zstd/CMakeLists.txt +++ b/rpcs3/3rdparty/zstd/CMakeLists.txt @@ -2,6 +2,7 @@ option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" OFF) option(ZSTD_BUILD_SHARED "BUILD SHARED LIBRARIES" OFF) option(ZSTD_BUILD_STATIC "BUILD STATIC LIBRARIES" ON) option(ZSTD_BUILD_TESTS "BUILD TESTS" OFF) +option(ZSTD_USE_STATIC_RUNTIME "LINK TO STATIC RUN-TIME LIBRARIES" ON) add_subdirectory(zstd/build/cmake EXLUDE_FROM_ALL) add_library(3rdparty_zstd INTERFACE) diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 40f48a6d5..4c45e0e3c 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -101,8 +101,8 @@ if(MSVC) add_compile_options(/MP) endif() -if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) - message( FATAL_ERROR "RPCS3 can only be compiled on 64-bit platforms." ) +if(CMAKE_SIZEOF_VOID_P AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8) + message( FATAL_ERROR "RPCS3 can only be compiled on 64-bit platforms. ${CMAKE_SIZEOF_VOID_P}" ) endif() find_program(CCACHE_FOUND ccache) diff --git a/rpcs3/Utilities/BitField.h b/rpcs3/Utilities/BitField.h index b2243dbe1..c29f15589 100644 --- a/rpcs3/Utilities/BitField.h +++ b/rpcs3/Utilities/BitField.h @@ -19,7 +19,8 @@ struct bf_base using compact_type = std::conditional_t, uint, int>, vtype>; // Datatype bitsize - static constexpr uint bitmax = sizeof(T) * 8; static_assert(N - 1 < bitmax, "bf_base<> error: N out of bounds"); + static constexpr uint bitmax = sizeof(T) * 8; + static_assert(N - 1 < bitmax, "bf_base<> error: N out of bounds"); // Field bitsize static constexpr uint bitsize = N; @@ -44,7 +45,8 @@ struct bf_t : bf_base using compact_type = typename bf_t::compact_type; // Field offset - static constexpr uint bitpos = I; static_assert(bitpos + N <= bf_t::bitmax, "bf_t<> error: I out of bounds"); + static constexpr uint bitpos = I; + static_assert(bitpos + N <= bf_t::bitmax, "bf_t<> error: I out of bounds"); // Get bitmask of size N, at I pos static constexpr utype data_mask() @@ -92,64 +94,64 @@ struct bf_t : bf_base } // Store bitfield value - bf_t& operator =(compact_type value) noexcept + bf_t& operator=(compact_type value) noexcept { this->m_data = static_cast((this->m_data & ~data_mask()) | insert(value)); return *this; } - compact_type operator ++(int) + compact_type operator++(int) { compact_type result = *this; *this = static_cast(result + 1u); return result; } - bf_t& operator ++() + bf_t& operator++() { return *this = static_cast(*this + 1u); } - compact_type operator --(int) + compact_type operator--(int) { compact_type result = *this; *this = static_cast(result - 1u); return result; } - bf_t& operator --() + bf_t& operator--() { return *this = static_cast(*this - 1u); } - bf_t& operator +=(compact_type right) + bf_t& operator+=(compact_type right) { return *this = static_cast(*this + right); } - bf_t& operator -=(compact_type right) + bf_t& operator-=(compact_type right) { return *this = static_cast(*this - right); } - bf_t& operator *=(compact_type right) + bf_t& operator*=(compact_type right) { return *this = static_cast(*this * right); } - bf_t& operator &=(compact_type right) + bf_t& operator&=(compact_type right) { this->m_data &= static_cast(((static_cast(right + 0u) & bf_t::vmask) << bitpos) | ~(bf_t::vmask << bitpos)); return *this; } - bf_t& operator |=(compact_type right) + bf_t& operator|=(compact_type right) { this->m_data |= static_cast((static_cast(right + 0u) & bf_t::vmask) << bitpos); return *this; } - bf_t& operator ^=(compact_type right) + bf_t& operator^=(compact_type right) { this->m_data ^= static_cast((static_cast(right + 0u) & bf_t::vmask) << bitpos); return *this; @@ -157,13 +159,19 @@ struct bf_t : bf_base }; template -struct std::common_type, bf_t> : std::common_type {}; +struct std::common_type, bf_t> : std::common_type +{ +}; template -struct std::common_type, T2> : std::common_type> {}; +struct std::common_type, T2> : std::common_type> +{ +}; template -struct std::common_type> : std::common_type, T2> {}; +struct std::common_type> : std::common_type, T2> +{ +}; // Field pack (concatenated from left to right) template @@ -199,7 +207,7 @@ struct cf_t : bf_base::bitsize> } // Store value - cf_t& operator =(compact_type value) noexcept + cf_t& operator=(compact_type value) noexcept { this->m_data = (this->m_data & ~data_mask()) | insert(value); return *this; diff --git a/rpcs3/Utilities/CRC.h b/rpcs3/Utilities/CRC.h index df2cbb202..63beb3267 100644 --- a/rpcs3/Utilities/CRC.h +++ b/rpcs3/Utilities/CRC.h @@ -62,73 +62,73 @@ may be faster on processor architectures which support single-instruction intege #ifndef CRCPP_CRC_H_ #define CRCPP_CRC_H_ -#include // Includes CHAR_BIT +#include // Includes CHAR_BIT #ifdef CRCPP_USE_CPP11 -#include // Includes ::std::size_t -#include // Includes ::std::uint8_t, ::std::uint16_t, ::std::uint32_t, ::std::uint64_t +#include // Includes ::std::size_t +#include // Includes ::std::uint8_t, ::std::uint16_t, ::std::uint32_t, ::std::uint64_t #else #include // Includes size_t #include // Includes uint8_t, uint16_t, uint32_t, uint64_t #endif -#include // Includes ::std::numeric_limits -#include // Includes ::std::move +#include // Includes ::std::numeric_limits +#include // Includes ::std::move #ifndef crcpp_uint8 -# ifdef CRCPP_USE_CPP11 +#ifdef CRCPP_USE_CPP11 /// @brief Unsigned 8-bit integer definition, used primarily for parameter definitions. -# define crcpp_uint8 ::std::uint8_t -# else +#define crcpp_uint8 ::std::uint8_t +#else /// @brief Unsigned 8-bit integer definition, used primarily for parameter definitions. -# define crcpp_uint8 uint8_t -# endif +#define crcpp_uint8 uint8_t +#endif #endif #ifndef crcpp_uint16 -# ifdef CRCPP_USE_CPP11 +#ifdef CRCPP_USE_CPP11 /// @brief Unsigned 16-bit integer definition, used primarily for parameter definitions. -# define crcpp_uint16 ::std::uint16_t -# else +#define crcpp_uint16 ::std::uint16_t +#else /// @brief Unsigned 16-bit integer definition, used primarily for parameter definitions. -# define crcpp_uint16 uint16_t -# endif +#define crcpp_uint16 uint16_t +#endif #endif #ifndef crcpp_uint32 -# ifdef CRCPP_USE_CPP11 +#ifdef CRCPP_USE_CPP11 /// @brief Unsigned 32-bit integer definition, used primarily for parameter definitions. -# define crcpp_uint32 ::std::uint32_t -# else +#define crcpp_uint32 ::std::uint32_t +#else /// @brief Unsigned 32-bit integer definition, used primarily for parameter definitions. -# define crcpp_uint32 uint32_t -# endif +#define crcpp_uint32 uint32_t +#endif #endif #ifndef crcpp_uint64 -# ifdef CRCPP_USE_CPP11 +#ifdef CRCPP_USE_CPP11 /// @brief Unsigned 64-bit integer definition, used primarily for parameter definitions. -# define crcpp_uint64 ::std::uint64_t -# else +#define crcpp_uint64 ::std::uint64_t +#else /// @brief Unsigned 64-bit integer definition, used primarily for parameter definitions. -# define crcpp_uint64 uint64_t -# endif +#define crcpp_uint64 uint64_t +#endif #endif #ifndef crcpp_size -# ifdef CRCPP_USE_CPP11 +#ifdef CRCPP_USE_CPP11 /// @brief Unsigned size definition, used for specifying data sizes. -# define crcpp_size ::std::size_t -# else +#define crcpp_size ::std::size_t +#else /// @brief Unsigned size definition, used for specifying data sizes. -# define crcpp_size size_t -# endif +#define crcpp_size size_t +#endif #endif #ifdef CRCPP_USE_CPP11 /// @brief Compile-time expression definition. -# define crcpp_constexpr constexpr +#define crcpp_constexpr constexpr #else /// @brief Compile-time expression definition. -# define crcpp_constexpr const +#define crcpp_constexpr const #endif #ifdef CRCPP_USE_NAMESPACE @@ -173,15 +173,15 @@ namespace CRCPP struct Table { // Constructors are intentionally NOT marked explicit. - Table(const Parameters & parameters); + Table(const Parameters& parameters); #ifdef CRCPP_USE_CPP11 - Table(Parameters && parameters); + Table(Parameters&& parameters); #endif - const Parameters & GetParameters() const; + const Parameters& GetParameters() const; - const CRCType * GetTable() const; + const CRCType* GetTable() const; CRCType operator[](unsigned char index) const; @@ -195,97 +195,97 @@ namespace CRCPP // The number of bits in CRCType must be at least as large as CRCWidth. // CRCType must be an unsigned integer type or a custom type with operator overloads. template - static CRCType Calculate(const void * data, crcpp_size size, const Parameters & parameters); + static CRCType Calculate(const void* data, crcpp_size size, const Parameters& parameters); template - static CRCType Calculate(const void * data, crcpp_size size, const Parameters & parameters, CRCType crc); + static CRCType Calculate(const void* data, crcpp_size size, const Parameters& parameters, CRCType crc); template - static CRCType Calculate(const void * data, crcpp_size size, const Table & lookupTable); + static CRCType Calculate(const void* data, crcpp_size size, const Table& lookupTable); template - static CRCType Calculate(const void * data, crcpp_size size, const Table & lookupTable, CRCType crc); + static CRCType Calculate(const void* data, crcpp_size size, const Table& lookupTable, CRCType crc); // Common CRCs up to 64 bits. // Note: Check values are the computed CRCs when given an ASCII input of "123456789" (without null terminator) #ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS - static const Parameters< crcpp_uint8, 4> & CRC_4_ITU(); - static const Parameters< crcpp_uint8, 5> & CRC_5_EPC(); - static const Parameters< crcpp_uint8, 5> & CRC_5_ITU(); - static const Parameters< crcpp_uint8, 5> & CRC_5_USB(); - static const Parameters< crcpp_uint8, 6> & CRC_6_CDMA2000A(); - static const Parameters< crcpp_uint8, 6> & CRC_6_CDMA2000B(); - static const Parameters< crcpp_uint8, 6> & CRC_6_ITU(); - static const Parameters< crcpp_uint8, 7> & CRC_7(); + static const Parameters& CRC_4_ITU(); + static const Parameters& CRC_5_EPC(); + static const Parameters& CRC_5_ITU(); + static const Parameters& CRC_5_USB(); + static const Parameters& CRC_6_CDMA2000A(); + static const Parameters& CRC_6_CDMA2000B(); + static const Parameters& CRC_6_ITU(); + static const Parameters& CRC_7(); #endif - static const Parameters< crcpp_uint8, 8> & CRC_8(); + static const Parameters& CRC_8(); #ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS - static const Parameters< crcpp_uint8, 8> & CRC_8_EBU(); - static const Parameters< crcpp_uint8, 8> & CRC_8_MAXIM(); - static const Parameters< crcpp_uint8, 8> & CRC_8_WCDMA(); - static const Parameters & CRC_10(); - static const Parameters & CRC_10_CDMA2000(); - static const Parameters & CRC_11(); - static const Parameters & CRC_12_CDMA2000(); - static const Parameters & CRC_12_DECT(); - static const Parameters & CRC_12_UMTS(); - static const Parameters & CRC_13_BBC(); - static const Parameters & CRC_15(); - static const Parameters & CRC_15_MPT1327(); + static const Parameters& CRC_8_EBU(); + static const Parameters& CRC_8_MAXIM(); + static const Parameters& CRC_8_WCDMA(); + static const Parameters& CRC_10(); + static const Parameters& CRC_10_CDMA2000(); + static const Parameters& CRC_11(); + static const Parameters& CRC_12_CDMA2000(); + static const Parameters& CRC_12_DECT(); + static const Parameters& CRC_12_UMTS(); + static const Parameters& CRC_13_BBC(); + static const Parameters& CRC_15(); + static const Parameters& CRC_15_MPT1327(); #endif - static const Parameters & CRC_16_ARC(); - static const Parameters & CRC_16_BUYPASS(); - static const Parameters & CRC_16_CCITTFALSE(); + static const Parameters& CRC_16_ARC(); + static const Parameters& CRC_16_BUYPASS(); + static const Parameters& CRC_16_CCITTFALSE(); #ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS - static const Parameters & CRC_16_CDMA2000(); - static const Parameters & CRC_16_DECTR(); - static const Parameters & CRC_16_DECTX(); - static const Parameters & CRC_16_DNP(); + static const Parameters& CRC_16_CDMA2000(); + static const Parameters& CRC_16_DECTR(); + static const Parameters& CRC_16_DECTX(); + static const Parameters& CRC_16_DNP(); #endif - static const Parameters & CRC_16_GENIBUS(); - static const Parameters & CRC_16_KERMIT(); + static const Parameters& CRC_16_GENIBUS(); + static const Parameters& CRC_16_KERMIT(); #ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS - static const Parameters & CRC_16_MAXIM(); - static const Parameters & CRC_16_MODBUS(); - static const Parameters & CRC_16_T10DIF(); - static const Parameters & CRC_16_USB(); + static const Parameters& CRC_16_MAXIM(); + static const Parameters& CRC_16_MODBUS(); + static const Parameters& CRC_16_T10DIF(); + static const Parameters& CRC_16_USB(); #endif - static const Parameters & CRC_16_X25(); - static const Parameters & CRC_16_XMODEM(); + static const Parameters& CRC_16_X25(); + static const Parameters& CRC_16_XMODEM(); #ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS - static const Parameters & CRC_17_CAN(); - static const Parameters & CRC_21_CAN(); - static const Parameters & CRC_24(); - static const Parameters & CRC_24_FLEXRAYA(); - static const Parameters & CRC_24_FLEXRAYB(); - static const Parameters & CRC_30(); + static const Parameters& CRC_17_CAN(); + static const Parameters& CRC_21_CAN(); + static const Parameters& CRC_24(); + static const Parameters& CRC_24_FLEXRAYA(); + static const Parameters& CRC_24_FLEXRAYB(); + static const Parameters& CRC_30(); #endif - static const Parameters & CRC_32(); - static const Parameters & CRC_32_BZIP2(); + static const Parameters& CRC_32(); + static const Parameters& CRC_32_BZIP2(); #ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS - static const Parameters & CRC_32_C(); + static const Parameters& CRC_32_C(); #endif - static const Parameters & CRC_32_MPEG2(); - static const Parameters & CRC_32_POSIX(); + static const Parameters& CRC_32_MPEG2(); + static const Parameters& CRC_32_POSIX(); #ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS - static const Parameters & CRC_32_Q(); - static const Parameters & CRC_40_GSM(); - static const Parameters & CRC_64(); + static const Parameters& CRC_32_Q(); + static const Parameters& CRC_40_GSM(); + static const Parameters& CRC_64(); #endif #ifdef CRCPP_USE_CPP11 CRC() = delete; - CRC(const CRC & other) = delete; - CRC & operator=(const CRC & other) = delete; - CRC(CRC && other) = delete; - CRC & operator=(CRC && other) = delete; + CRC(const CRC& other) = delete; + CRC& operator=(const CRC& other) = delete; + CRC(CRC&& other) = delete; + CRC& operator=(CRC&& other) = delete; #endif private: #ifndef CRCPP_USE_CPP11 CRC(); - CRC(const CRC & other); - CRC & operator=(const CRC & other); + CRC(const CRC& other); + CRC& operator=(const CRC& other); #endif template @@ -298,10 +298,10 @@ namespace CRCPP static CRCType UndoFinalize(CRCType crc, CRCType finalXOR, bool reflectOutput); template - static CRCType CalculateRemainder(const void * data, crcpp_size size, const Parameters & parameters, CRCType remainder); + static CRCType CalculateRemainder(const void* data, crcpp_size size, const Parameters& parameters, CRCType remainder); template - static CRCType CalculateRemainder(const void * data, crcpp_size size, const Table & lookupTable, CRCType remainder); + static CRCType CalculateRemainder(const void* data, crcpp_size size, const Table& lookupTable, CRCType remainder); template static crcpp_constexpr IntegerType BoundedConstexprValue(IntegerType x); @@ -329,8 +329,7 @@ namespace CRCPP @tparam CRCWidth Number of bits in the CRC */ template - inline CRC::Table::Table(const Parameters & parameters) : - parameters(parameters) + inline CRC::Table::Table(const Parameters& parameters) : parameters(parameters) { InitTable(); } @@ -343,8 +342,7 @@ namespace CRCPP @tparam CRCWidth Number of bits in the CRC */ template - inline CRC::Table::Table(Parameters && parameters) : - parameters(::std::move(parameters)) + inline CRC::Table::Table(Parameters&& parameters) : parameters(::std::move(parameters)) { InitTable(); } @@ -357,7 +355,7 @@ namespace CRCPP @return CRC parameters */ template - inline const CRC::Parameters & CRC::Table::GetParameters() const + inline const CRC::Parameters& CRC::Table::GetParameters() const { return parameters; } @@ -369,7 +367,7 @@ namespace CRCPP @return CRC table */ template - inline const CRCType * CRC::Table::GetTable() const + inline const CRCType* CRC::Table::GetTable() const { return table; } @@ -397,7 +395,7 @@ namespace CRCPP { // For masking off the bits for the CRC (in the event that the number of bits in CRCType is larger than CRCWidth) static crcpp_constexpr CRCType BIT_MASK((CRCType(1) << (CRCWidth - CRCType(1))) | - ((CRCType(1) << (CRCWidth - CRCType(1))) - CRCType(1))); + ((CRCType(1) << (CRCWidth - CRCType(1))) - CRCType(1))); static crcpp_constexpr CRCType SHIFT(CRC::BoundedConstexprValue(CHAR_BIT - CRCWidth)); @@ -435,7 +433,7 @@ namespace CRCPP @return CRC */ template - inline CRCType CRC::Calculate(const void * data, crcpp_size size, const Parameters & parameters) + inline CRCType CRC::Calculate(const void* data, crcpp_size size, const Parameters& parameters) { CRCType remainder = CalculateRemainder(data, size, parameters, parameters.initialValue); @@ -455,7 +453,7 @@ namespace CRCPP @return CRC */ template - inline CRCType CRC::Calculate(const void * data, crcpp_size size, const Parameters & parameters, CRCType crc) + inline CRCType CRC::Calculate(const void* data, crcpp_size size, const Parameters& parameters, CRCType crc) { CRCType remainder = UndoFinalize(crc, parameters.finalXOR, parameters.reflectInput != parameters.reflectOutput); @@ -476,9 +474,9 @@ namespace CRCPP @return CRC */ template - inline CRCType CRC::Calculate(const void * data, crcpp_size size, const Table & lookupTable) + inline CRCType CRC::Calculate(const void* data, crcpp_size size, const Table& lookupTable) { - const Parameters & parameters = lookupTable.GetParameters(); + const Parameters& parameters = lookupTable.GetParameters(); CRCType remainder = CalculateRemainder(data, size, lookupTable, parameters.initialValue); @@ -499,9 +497,9 @@ namespace CRCPP @return CRC */ template - inline CRCType CRC::Calculate(const void * data, crcpp_size size, const Table & lookupTable, CRCType crc) + inline CRCType CRC::Calculate(const void* data, crcpp_size size, const Table& lookupTable, CRCType crc) { - const Parameters & parameters = lookupTable.GetParameters(); + const Parameters& parameters = lookupTable.GetParameters(); CRCType remainder = UndoFinalize(crc, parameters.finalXOR, parameters.reflectInput != parameters.reflectOutput); @@ -547,7 +545,7 @@ namespace CRCPP { // For masking off the bits for the CRC (in the event that the number of bits in CRCType is larger than CRCWidth) static crcpp_constexpr CRCType BIT_MASK = (CRCType(1) << (CRCWidth - CRCType(1))) | - ((CRCType(1) << (CRCWidth - CRCType(1))) - CRCType(1)); + ((CRCType(1) << (CRCWidth - CRCType(1))) - CRCType(1)); if (reflectOutput) { @@ -579,7 +577,7 @@ namespace CRCPP { // For masking off the bits for the CRC (in the event that the number of bits in CRCType is larger than CRCWidth) static crcpp_constexpr CRCType BIT_MASK = (CRCType(1) << (CRCWidth - CRCType(1))) | - ((CRCType(1) << (CRCWidth - CRCType(1))) - CRCType(1)); + ((CRCType(1) << (CRCWidth - CRCType(1))) - CRCType(1)); crc = (crc & BIT_MASK) ^ finalXOR; @@ -602,19 +600,22 @@ namespace CRCPP @return CRC remainder */ template - inline CRCType CRC::CalculateRemainder(const void * data, crcpp_size size, const Parameters & parameters, CRCType remainder) + inline CRCType CRC::CalculateRemainder(const void* data, crcpp_size size, const Parameters& parameters, CRCType remainder) { #ifdef CRCPP_USE_CPP11 // This static_assert is put here because this function will always be compiled in no matter what // the template parameters are and whether or not a table lookup or bit-by-bit algorithm is used. static_assert(::std::numeric_limits::digits >= CRCWidth, "CRCType is too small to contain a CRC of width CRCWidth."); #else - // Catching this compile-time error is very important. Sadly, the compiler error will be very cryptic, but it's - // better than nothing. - enum { static_assert_failed_CRCType_is_too_small_to_contain_a_CRC_of_width_CRCWidth = 1 / (::std::numeric_limits::digits >= CRCWidth ? 1 : 0) }; + // Catching this compile-time error is very important. Sadly, the compiler error will be very cryptic, but it's + // better than nothing. + enum + { + static_assert_failed_CRCType_is_too_small_to_contain_a_CRC_of_width_CRCWidth = 1 / (::std::numeric_limits::digits >= CRCWidth ? 1 : 0) + }; #endif - const unsigned char * current = reinterpret_cast(data); + const unsigned char* current = reinterpret_cast(data); // Slightly different implementations based on the parameters. The current implementations try to eliminate as much // computation from the inner loop (looping over each bit) as possible. @@ -636,7 +637,7 @@ namespace CRCPP // remainder >>= 1; remainder = (remainder >> 1) ^ ((remainder & 1) * polynomial); #else - remainder = (remainder & 1) ? ((remainder >> 1) ^ polynomial) : (remainder >> 1); + remainder = (remainder & 1) ? ((remainder >> 1) ^ polynomial) : (remainder >> 1); #endif } } @@ -664,7 +665,7 @@ namespace CRCPP // remainder <<= 1; remainder = (remainder << 1) ^ (((remainder >> CRC_WIDTH_MINUS_ONE) & 1) * parameters.polynomial); #else - remainder = (remainder & CRC_HIGHEST_BIT_MASK) ? ((remainder << 1) ^ parameters.polynomial) : (remainder << 1); + remainder = (remainder & CRC_HIGHEST_BIT_MASK) ? ((remainder << 1) ^ parameters.polynomial) : (remainder << 1); #endif } } @@ -695,7 +696,7 @@ namespace CRCPP // remainder <<= 1; remainder = (remainder << 1) ^ (((remainder >> CHAR_BIT_MINUS_ONE) & 1) * polynomial); #else - remainder = (remainder & CHAR_BIT_HIGHEST_BIT_MASK) ? ((remainder << 1) ^ polynomial) : (remainder << 1); + remainder = (remainder & CHAR_BIT_HIGHEST_BIT_MASK) ? ((remainder << 1) ^ polynomial) : (remainder << 1); #endif } } @@ -717,9 +718,9 @@ namespace CRCPP @return CRC remainder */ template - inline CRCType CRC::CalculateRemainder(const void * data, crcpp_size size, const Table & lookupTable, CRCType remainder) + inline CRCType CRC::CalculateRemainder(const void* data, crcpp_size size, const Table& lookupTable, CRCType remainder) { - const unsigned char * current = reinterpret_cast(data); + const unsigned char* current = reinterpret_cast(data); if (lookupTable.GetParameters().reflectInput) { @@ -729,12 +730,12 @@ namespace CRCPP // Disable warning about data loss when doing (remainder >> CHAR_BIT) when // remainder is one byte long. The algorithm is still correct in this case, // though it's possible that one additional machine instruction will be executed. -# pragma warning (push) -# pragma warning (disable : 4333) +#pragma warning(push) +#pragma warning(disable : 4333) #endif remainder = (remainder >> CHAR_BIT) ^ lookupTable[static_cast(remainder ^ *current++)]; #ifdef _MSC_VER -# pragma warning (pop) +#pragma warning(pop) #endif } } @@ -792,9 +793,9 @@ namespace CRCPP - check value = 0x7 @return CRC-4 ITU parameters */ - inline const CRC::Parameters & CRC::CRC_4_ITU() + inline const CRC::Parameters& CRC::CRC_4_ITU() { - static const Parameters parameters = { 0x3, 0x0, 0x0, true, true }; + static const Parameters parameters = {0x3, 0x0, 0x0, true, true}; return parameters; } @@ -810,9 +811,9 @@ namespace CRCPP - check value = 0x00 @return CRC-5 EPC parameters */ - inline const CRC::Parameters & CRC::CRC_5_EPC() + inline const CRC::Parameters& CRC::CRC_5_EPC() { - static const Parameters parameters = { 0x09, 0x09, 0x00, false, false }; + static const Parameters parameters = {0x09, 0x09, 0x00, false, false}; return parameters; } @@ -828,9 +829,9 @@ namespace CRCPP - check value = 0x07 @return CRC-5 ITU parameters */ - inline const CRC::Parameters & CRC::CRC_5_ITU() + inline const CRC::Parameters& CRC::CRC_5_ITU() { - static const Parameters parameters = { 0x15, 0x00, 0x00, true, true }; + static const Parameters parameters = {0x15, 0x00, 0x00, true, true}; return parameters; } @@ -846,9 +847,9 @@ namespace CRCPP - check value = 0x19 @return CRC-5 USB parameters */ - inline const CRC::Parameters & CRC::CRC_5_USB() + inline const CRC::Parameters& CRC::CRC_5_USB() { - static const Parameters parameters = { 0x05, 0x1F, 0x1F, true, true }; + static const Parameters parameters = {0x05, 0x1F, 0x1F, true, true}; return parameters; } @@ -864,9 +865,9 @@ namespace CRCPP - check value = 0x0D @return CRC-6 CDMA2000-A parameters */ - inline const CRC::Parameters & CRC::CRC_6_CDMA2000A() + inline const CRC::Parameters& CRC::CRC_6_CDMA2000A() { - static const Parameters parameters = { 0x27, 0x3F, 0x00, false, false }; + static const Parameters parameters = {0x27, 0x3F, 0x00, false, false}; return parameters; } @@ -882,9 +883,9 @@ namespace CRCPP - check value = 0x3B @return CRC-6 CDMA2000-B parameters */ - inline const CRC::Parameters & CRC::CRC_6_CDMA2000B() + inline const CRC::Parameters& CRC::CRC_6_CDMA2000B() { - static const Parameters parameters = { 0x07, 0x3F, 0x00, false, false }; + static const Parameters parameters = {0x07, 0x3F, 0x00, false, false}; return parameters; } @@ -900,9 +901,9 @@ namespace CRCPP - check value = 0x06 @return CRC-6 ITU parameters */ - inline const CRC::Parameters & CRC::CRC_6_ITU() + inline const CRC::Parameters& CRC::CRC_6_ITU() { - static const Parameters parameters = { 0x03, 0x00, 0x00, true, true }; + static const Parameters parameters = {0x03, 0x00, 0x00, true, true}; return parameters; } @@ -918,9 +919,9 @@ namespace CRCPP - check value = 0x75 @return CRC-7 JEDEC parameters */ - inline const CRC::Parameters & CRC::CRC_7() + inline const CRC::Parameters& CRC::CRC_7() { - static const Parameters parameters = { 0x09, 0x00, 0x00, false, false }; + static const Parameters parameters = {0x09, 0x00, 0x00, false, false}; return parameters; } #endif // CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS @@ -937,9 +938,9 @@ namespace CRCPP - check value = 0xF4 @return CRC-8 SMBus parameters */ - inline const CRC::Parameters & CRC::CRC_8() + inline const CRC::Parameters& CRC::CRC_8() { - static const Parameters parameters = { 0x07, 0x00, 0x00, false, false }; + static const Parameters parameters = {0x07, 0x00, 0x00, false, false}; return parameters; } @@ -956,9 +957,9 @@ namespace CRCPP - check value = 0x97 @return CRC-8 EBU parameters */ - inline const CRC::Parameters & CRC::CRC_8_EBU() + inline const CRC::Parameters& CRC::CRC_8_EBU() { - static const Parameters parameters = { 0x1D, 0xFF, 0x00, true, true }; + static const Parameters parameters = {0x1D, 0xFF, 0x00, true, true}; return parameters; } @@ -974,9 +975,9 @@ namespace CRCPP - check value = 0xA1 @return CRC-8 MAXIM parameters */ - inline const CRC::Parameters & CRC::CRC_8_MAXIM() + inline const CRC::Parameters& CRC::CRC_8_MAXIM() { - static const Parameters parameters = { 0x31, 0x00, 0x00, true, true }; + static const Parameters parameters = {0x31, 0x00, 0x00, true, true}; return parameters; } @@ -992,9 +993,9 @@ namespace CRCPP - check value = 0x25 @return CRC-8 WCDMA parameters */ - inline const CRC::Parameters & CRC::CRC_8_WCDMA() + inline const CRC::Parameters& CRC::CRC_8_WCDMA() { - static const Parameters parameters = { 0x9B, 0x00, 0x00, true, true }; + static const Parameters parameters = {0x9B, 0x00, 0x00, true, true}; return parameters; } @@ -1010,9 +1011,9 @@ namespace CRCPP - check value = 0x199 @return CRC-10 ITU parameters */ - inline const CRC::Parameters & CRC::CRC_10() + inline const CRC::Parameters& CRC::CRC_10() { - static const Parameters parameters = { 0x233, 0x000, 0x000, false, false }; + static const Parameters parameters = {0x233, 0x000, 0x000, false, false}; return parameters; } @@ -1028,9 +1029,9 @@ namespace CRCPP - check value = 0x233 @return CRC-10 CDMA2000 parameters */ - inline const CRC::Parameters & CRC::CRC_10_CDMA2000() + inline const CRC::Parameters& CRC::CRC_10_CDMA2000() { - static const Parameters parameters = { 0x3D9, 0x3FF, 0x000, false, false }; + static const Parameters parameters = {0x3D9, 0x3FF, 0x000, false, false}; return parameters; } @@ -1046,9 +1047,9 @@ namespace CRCPP - check value = 0x5A3 @return CRC-11 FlexRay parameters */ - inline const CRC::Parameters & CRC::CRC_11() + inline const CRC::Parameters& CRC::CRC_11() { - static const Parameters parameters = { 0x385, 0x01A, 0x000, false, false }; + static const Parameters parameters = {0x385, 0x01A, 0x000, false, false}; return parameters; } @@ -1064,9 +1065,9 @@ namespace CRCPP - check value = 0xD4D @return CRC-12 CDMA2000 parameters */ - inline const CRC::Parameters & CRC::CRC_12_CDMA2000() + inline const CRC::Parameters& CRC::CRC_12_CDMA2000() { - static const Parameters parameters = { 0xF13, 0xFFF, 0x000, false, false }; + static const Parameters parameters = {0xF13, 0xFFF, 0x000, false, false}; return parameters; } @@ -1082,9 +1083,9 @@ namespace CRCPP - check value = 0xF5B @return CRC-12 DECT parameters */ - inline const CRC::Parameters & CRC::CRC_12_DECT() + inline const CRC::Parameters& CRC::CRC_12_DECT() { - static const Parameters parameters = { 0x80F, 0x000, 0x000, false, false }; + static const Parameters parameters = {0x80F, 0x000, 0x000, false, false}; return parameters; } @@ -1100,9 +1101,9 @@ namespace CRCPP - check value = 0xDAF @return CRC-12 UMTS parameters */ - inline const CRC::Parameters & CRC::CRC_12_UMTS() + inline const CRC::Parameters& CRC::CRC_12_UMTS() { - static const Parameters parameters = { 0x80F, 0x000, 0x000, false, true }; + static const Parameters parameters = {0x80F, 0x000, 0x000, false, true}; return parameters; } @@ -1118,9 +1119,9 @@ namespace CRCPP - check value = 0x04FA @return CRC-13 BBC parameters */ - inline const CRC::Parameters & CRC::CRC_13_BBC() + inline const CRC::Parameters& CRC::CRC_13_BBC() { - static const Parameters parameters = { 0x1CF5, 0x0000, 0x0000, false, false }; + static const Parameters parameters = {0x1CF5, 0x0000, 0x0000, false, false}; return parameters; } @@ -1136,9 +1137,9 @@ namespace CRCPP - check value = 0x059E @return CRC-15 CAN parameters */ - inline const CRC::Parameters & CRC::CRC_15() + inline const CRC::Parameters& CRC::CRC_15() { - static const Parameters parameters = { 0x4599, 0x0000, 0x0000, false, false }; + static const Parameters parameters = {0x4599, 0x0000, 0x0000, false, false}; return parameters; } @@ -1154,9 +1155,9 @@ namespace CRCPP - check value = 0x2566 @return CRC-15 MPT1327 parameters */ - inline const CRC::Parameters & CRC::CRC_15_MPT1327() + inline const CRC::Parameters& CRC::CRC_15_MPT1327() { - static const Parameters parameters = { 0x6815, 0x0000, 0x0001, false, false }; + static const Parameters parameters = {0x6815, 0x0000, 0x0001, false, false}; return parameters; } #endif // CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS @@ -1173,9 +1174,9 @@ namespace CRCPP - check value = 0xBB3D @return CRC-16 ARC parameters */ - inline const CRC::Parameters & CRC::CRC_16_ARC() + inline const CRC::Parameters& CRC::CRC_16_ARC() { - static const Parameters parameters = { 0x8005, 0x0000, 0x0000, true, true }; + static const Parameters parameters = {0x8005, 0x0000, 0x0000, true, true}; return parameters; } @@ -1191,9 +1192,9 @@ namespace CRCPP - check value = 0xFEE8 @return CRC-16 BUYPASS parameters */ - inline const CRC::Parameters & CRC::CRC_16_BUYPASS() + inline const CRC::Parameters& CRC::CRC_16_BUYPASS() { - static const Parameters parameters = { 0x8005, 0x0000, 0x0000, false, false }; + static const Parameters parameters = {0x8005, 0x0000, 0x0000, false, false}; return parameters; } @@ -1209,9 +1210,9 @@ namespace CRCPP - check value = 0x29B1 @return CRC-16 CCITT FALSE parameters */ - inline const CRC::Parameters & CRC::CRC_16_CCITTFALSE() + inline const CRC::Parameters& CRC::CRC_16_CCITTFALSE() { - static const Parameters parameters = { 0x1021, 0xFFFF, 0x0000, false, false }; + static const Parameters parameters = {0x1021, 0xFFFF, 0x0000, false, false}; return parameters; } @@ -1228,9 +1229,9 @@ namespace CRCPP - check value = 0x4C06 @return CRC-16 CDMA2000 parameters */ - inline const CRC::Parameters & CRC::CRC_16_CDMA2000() + inline const CRC::Parameters& CRC::CRC_16_CDMA2000() { - static const Parameters parameters = { 0xC867, 0xFFFF, 0x0000, false, false }; + static const Parameters parameters = {0xC867, 0xFFFF, 0x0000, false, false}; return parameters; } @@ -1246,9 +1247,9 @@ namespace CRCPP - check value = 0x007E @return CRC-16 DECT-R parameters */ - inline const CRC::Parameters & CRC::CRC_16_DECTR() + inline const CRC::Parameters& CRC::CRC_16_DECTR() { - static const Parameters parameters = { 0x0589, 0x0000, 0x0001, false, false }; + static const Parameters parameters = {0x0589, 0x0000, 0x0001, false, false}; return parameters; } @@ -1264,9 +1265,9 @@ namespace CRCPP - check value = 0x007F @return CRC-16 DECT-X parameters */ - inline const CRC::Parameters & CRC::CRC_16_DECTX() + inline const CRC::Parameters& CRC::CRC_16_DECTX() { - static const Parameters parameters = { 0x0589, 0x0000, 0x0000, false, false }; + static const Parameters parameters = {0x0589, 0x0000, 0x0000, false, false}; return parameters; } @@ -1282,9 +1283,9 @@ namespace CRCPP - check value = 0xEA82 @return CRC-16 DNP parameters */ - inline const CRC::Parameters & CRC::CRC_16_DNP() + inline const CRC::Parameters& CRC::CRC_16_DNP() { - static const Parameters parameters = { 0x3D65, 0x0000, 0xFFFF, true, true }; + static const Parameters parameters = {0x3D65, 0x0000, 0xFFFF, true, true}; return parameters; } #endif // CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS @@ -1301,9 +1302,9 @@ namespace CRCPP - check value = 0xD64E @return CRC-16 GENIBUS parameters */ - inline const CRC::Parameters & CRC::CRC_16_GENIBUS() + inline const CRC::Parameters& CRC::CRC_16_GENIBUS() { - static const Parameters parameters = { 0x1021, 0xFFFF, 0xFFFF, false, false }; + static const Parameters parameters = {0x1021, 0xFFFF, 0xFFFF, false, false}; return parameters; } @@ -1319,9 +1320,9 @@ namespace CRCPP - check value = 0x2189 @return CRC-16 KERMIT parameters */ - inline const CRC::Parameters & CRC::CRC_16_KERMIT() + inline const CRC::Parameters& CRC::CRC_16_KERMIT() { - static const Parameters parameters = { 0x1021, 0x0000, 0x0000, true, true }; + static const Parameters parameters = {0x1021, 0x0000, 0x0000, true, true}; return parameters; } @@ -1338,9 +1339,9 @@ namespace CRCPP - check value = 0x44C2 @return CRC-16 MAXIM parameters */ - inline const CRC::Parameters & CRC::CRC_16_MAXIM() + inline const CRC::Parameters& CRC::CRC_16_MAXIM() { - static const Parameters parameters = { 0x8005, 0x0000, 0xFFFF, true, true }; + static const Parameters parameters = {0x8005, 0x0000, 0xFFFF, true, true}; return parameters; } @@ -1356,9 +1357,9 @@ namespace CRCPP - check value = 0x4B37 @return CRC-16 MODBUS parameters */ - inline const CRC::Parameters & CRC::CRC_16_MODBUS() + inline const CRC::Parameters& CRC::CRC_16_MODBUS() { - static const Parameters parameters = { 0x8005, 0xFFFF, 0x0000, true, true }; + static const Parameters parameters = {0x8005, 0xFFFF, 0x0000, true, true}; return parameters; } @@ -1374,9 +1375,9 @@ namespace CRCPP - check value = 0xD0DB @return CRC-16 T10-DIF parameters */ - inline const CRC::Parameters & CRC::CRC_16_T10DIF() + inline const CRC::Parameters& CRC::CRC_16_T10DIF() { - static const Parameters parameters = { 0x8BB7, 0x0000, 0x0000, false, false }; + static const Parameters parameters = {0x8BB7, 0x0000, 0x0000, false, false}; return parameters; } @@ -1392,9 +1393,9 @@ namespace CRCPP - check value = 0xB4C8 @return CRC-16 USB parameters */ - inline const CRC::Parameters & CRC::CRC_16_USB() + inline const CRC::Parameters& CRC::CRC_16_USB() { - static const Parameters parameters = { 0x8005, 0xFFFF, 0xFFFF, true, true }; + static const Parameters parameters = {0x8005, 0xFFFF, 0xFFFF, true, true}; return parameters; } #endif // CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS @@ -1411,9 +1412,9 @@ namespace CRCPP - check value = 0x906E @return CRC-16 X-25 parameters */ - inline const CRC::Parameters & CRC::CRC_16_X25() + inline const CRC::Parameters& CRC::CRC_16_X25() { - static const Parameters parameters = { 0x1021, 0xFFFF, 0xFFFF, true, true }; + static const Parameters parameters = {0x1021, 0xFFFF, 0xFFFF, true, true}; return parameters; } @@ -1429,9 +1430,9 @@ namespace CRCPP - check value = 0x31C3 @return CRC-16 XMODEM parameters */ - inline const CRC::Parameters & CRC::CRC_16_XMODEM() + inline const CRC::Parameters& CRC::CRC_16_XMODEM() { - static const Parameters parameters = { 0x1021, 0x0000, 0x0000, false, false }; + static const Parameters parameters = {0x1021, 0x0000, 0x0000, false, false}; return parameters; } @@ -1448,9 +1449,9 @@ namespace CRCPP - check value = 0x04F03 @return CRC-17 CAN parameters */ - inline const CRC::Parameters & CRC::CRC_17_CAN() + inline const CRC::Parameters& CRC::CRC_17_CAN() { - static const Parameters parameters = { 0x1685B, 0x00000, 0x00000, false, false }; + static const Parameters parameters = {0x1685B, 0x00000, 0x00000, false, false}; return parameters; } @@ -1466,9 +1467,9 @@ namespace CRCPP - check value = 0x0ED841 @return CRC-21 CAN parameters */ - inline const CRC::Parameters & CRC::CRC_21_CAN() + inline const CRC::Parameters& CRC::CRC_21_CAN() { - static const Parameters parameters = { 0x102899, 0x000000, 0x000000, false, false }; + static const Parameters parameters = {0x102899, 0x000000, 0x000000, false, false}; return parameters; } @@ -1484,9 +1485,9 @@ namespace CRCPP - check value = 0x21CF02 @return CRC-24 OPENPGP parameters */ - inline const CRC::Parameters & CRC::CRC_24() + inline const CRC::Parameters& CRC::CRC_24() { - static const Parameters parameters = { 0x864CFB, 0xB704CE, 0x000000, false, false }; + static const Parameters parameters = {0x864CFB, 0xB704CE, 0x000000, false, false}; return parameters; } @@ -1502,9 +1503,9 @@ namespace CRCPP - check value = 0x7979BD @return CRC-24 FlexRay-A parameters */ - inline const CRC::Parameters & CRC::CRC_24_FLEXRAYA() + inline const CRC::Parameters& CRC::CRC_24_FLEXRAYA() { - static const Parameters parameters = { 0x5D6DCB, 0xFEDCBA, 0x000000, false, false }; + static const Parameters parameters = {0x5D6DCB, 0xFEDCBA, 0x000000, false, false}; return parameters; } @@ -1520,9 +1521,9 @@ namespace CRCPP - check value = 0x1F23B8 @return CRC-24 FlexRay-B parameters */ - inline const CRC::Parameters & CRC::CRC_24_FLEXRAYB() + inline const CRC::Parameters& CRC::CRC_24_FLEXRAYB() { - static const Parameters parameters = { 0x5D6DCB, 0xABCDEF, 0x000000, false, false }; + static const Parameters parameters = {0x5D6DCB, 0xABCDEF, 0x000000, false, false}; return parameters; } @@ -1538,9 +1539,9 @@ namespace CRCPP - check value = 0x3B3CB540 @return CRC-30 CDMA parameters */ - inline const CRC::Parameters & CRC::CRC_30() + inline const CRC::Parameters& CRC::CRC_30() { - static const Parameters parameters = { 0x2030B9C7, 0x3FFFFFFF, 0x00000000, false, false }; + static const Parameters parameters = {0x2030B9C7, 0x3FFFFFFF, 0x00000000, false, false}; return parameters; } #endif // CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS @@ -1557,9 +1558,9 @@ namespace CRCPP - check value = 0xCBF43926 @return CRC-32 parameters */ - inline const CRC::Parameters & CRC::CRC_32() + inline const CRC::Parameters& CRC::CRC_32() { - static const Parameters parameters = { 0x04C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, true, true }; + static const Parameters parameters = {0x04C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, true, true}; return parameters; } @@ -1575,9 +1576,9 @@ namespace CRCPP - check value = 0xFC891918 @return CRC-32 BZIP2 parameters */ - inline const CRC::Parameters & CRC::CRC_32_BZIP2() + inline const CRC::Parameters& CRC::CRC_32_BZIP2() { - static const Parameters parameters = { 0x04C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, false, false }; + static const Parameters parameters = {0x04C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, false, false}; return parameters; } @@ -1594,9 +1595,9 @@ namespace CRCPP - check value = 0xE3069283 @return CRC-32 C parameters */ - inline const CRC::Parameters & CRC::CRC_32_C() + inline const CRC::Parameters& CRC::CRC_32_C() { - static const Parameters parameters = { 0x1EDC6F41, 0xFFFFFFFF, 0xFFFFFFFF, true, true }; + static const Parameters parameters = {0x1EDC6F41, 0xFFFFFFFF, 0xFFFFFFFF, true, true}; return parameters; } #endif @@ -1613,9 +1614,9 @@ namespace CRCPP - check value = 0x0376E6E7 @return CRC-32 MPEG-2 parameters */ - inline const CRC::Parameters & CRC::CRC_32_MPEG2() + inline const CRC::Parameters& CRC::CRC_32_MPEG2() { - static const Parameters parameters = { 0x04C11DB7, 0xFFFFFFFF, 0x00000000, false, false }; + static const Parameters parameters = {0x04C11DB7, 0xFFFFFFFF, 0x00000000, false, false}; return parameters; } @@ -1631,9 +1632,9 @@ namespace CRCPP - check value = 0x765E7680 @return CRC-32 POSIX parameters */ - inline const CRC::Parameters & CRC::CRC_32_POSIX() + inline const CRC::Parameters& CRC::CRC_32_POSIX() { - static const Parameters parameters = { 0x04C11DB7, 0x00000000, 0xFFFFFFFF, false, false }; + static const Parameters parameters = {0x04C11DB7, 0x00000000, 0xFFFFFFFF, false, false}; return parameters; } @@ -1650,9 +1651,9 @@ namespace CRCPP - check value = 0x3010BF7F @return CRC-32 Q parameters */ - inline const CRC::Parameters & CRC::CRC_32_Q() + inline const CRC::Parameters& CRC::CRC_32_Q() { - static const Parameters parameters = { 0x814141AB, 0x00000000, 0x00000000, false, false }; + static const Parameters parameters = {0x814141AB, 0x00000000, 0x00000000, false, false}; return parameters; } @@ -1668,9 +1669,9 @@ namespace CRCPP - check value = 0xD4164FC646 @return CRC-40 GSM parameters */ - inline const CRC::Parameters & CRC::CRC_40_GSM() + inline const CRC::Parameters& CRC::CRC_40_GSM() { - static const Parameters parameters = { 0x0004820009, 0x0000000000, 0xFFFFFFFFFF, false, false }; + static const Parameters parameters = {0x0004820009, 0x0000000000, 0xFFFFFFFFFF, false, false}; return parameters; } @@ -1686,9 +1687,9 @@ namespace CRCPP - check value = 0x6C40DF5F0B497347 @return CRC-64 ECMA parameters */ - inline const CRC::Parameters & CRC::CRC_64() + inline const CRC::Parameters& CRC::CRC_64() { - static const Parameters parameters = { 0x42F0E1EBA9EA3693, 0x0000000000000000, 0x0000000000000000, false, false }; + static const Parameters parameters = {0x42F0E1EBA9EA3693, 0x0000000000000000, 0x0000000000000000, false, false}; return parameters; } #endif // CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS diff --git a/rpcs3/Utilities/Config.cpp b/rpcs3/Utilities/Config.cpp index e955263c8..e152a930d 100644 --- a/rpcs3/Utilities/Config.cpp +++ b/rpcs3/Utilities/Config.cpp @@ -10,7 +10,7 @@ LOG_CHANNEL(cfg_log, "CFG"); template <> void fmt_class_string::format(std::string& out, u64 arg) { - out += get_object(arg).to_string(); + out += get_object(arg).to_string(); } namespace cfg @@ -69,7 +69,7 @@ namespace cfg // Incrementally load config entries from YAML::Node. // The config value is preserved if the corresponding YAML node doesn't exist. static void decode(const YAML::Node& data, class _base& rhs, bool dynamic = false); -} +} // namespace cfg std::vector cfg::make_int_range(s64 min, s64 max) { @@ -80,7 +80,8 @@ bool try_to_int64(s64* out, std::string_view value, s64 min, s64 max) { if (value.empty()) { - if (out) cfg_log.error("cfg::try_to_int64(): called with an empty string"); + if (out) + cfg_log.error("cfg::try_to_int64(): called with an empty string"); return false; } @@ -107,7 +108,8 @@ bool try_to_int64(s64* out, std::string_view value, s64 min, s64 max) if (ret.ec != std::errc() || ret.ptr != end || (start[0] == '-' && sign < 0)) { - if (out) cfg_log.error("cfg::try_to_int64('%s'): invalid integer", value); + if (out) + cfg_log.error("cfg::try_to_int64('%s'): invalid integer", value); return false; } @@ -115,11 +117,13 @@ bool try_to_int64(s64* out, std::string_view value, s64 min, s64 max) if (result < min || result > max) { - if (out) cfg_log.error("cfg::try_to_int64('%s'): out of bounds (val=%d, min=%d, max=%d)", value, result, min, max); + if (out) + cfg_log.error("cfg::try_to_int64('%s'): out of bounds (val=%d, min=%d, max=%d)", value, result, min, max); return false; } - if (out) *out = result; + if (out) + *out = result; return true; } @@ -132,7 +136,8 @@ bool try_to_uint64(u64* out, std::string_view value, u64 min, u64 max) { if (value.empty()) { - if (out) cfg_log.error("cfg::try_to_uint64(): called with an empty string"); + if (out) + cfg_log.error("cfg::try_to_uint64(): called with an empty string"); return false; } @@ -152,17 +157,20 @@ bool try_to_uint64(u64* out, std::string_view value, u64 min, u64 max) if (ret.ec != std::errc() || ret.ptr != end) { - if (out) cfg_log.error("cfg::try_to_uint64('%s'): invalid integer", value); + if (out) + cfg_log.error("cfg::try_to_uint64('%s'): invalid integer", value); return false; } if (result < min || result > max) { - if (out) cfg_log.error("cfg::try_to_uint64('%s'): out of bounds (val=%u, min=%u, max=%u)", value, result, min, max); + if (out) + cfg_log.error("cfg::try_to_uint64('%s'): out of bounds (val=%u, min=%u, max=%u)", value, result, min, max); return false; } - if (out) *out = result; + if (out) + *out = result; return true; } @@ -175,7 +183,8 @@ bool try_to_float(f64* out, std::string_view value, f64 min, f64 max) { if (value.empty()) { - if (out) cfg_log.error("cfg::try_to_float(): called with an empty string"); + if (out) + cfg_log.error("cfg::try_to_float(): called with an empty string"); return false; } @@ -188,36 +197,42 @@ bool try_to_float(f64* out, std::string_view value, f64 min, f64 max) if (end_check != str.data() + str.size()) { - if (out) cfg_log.error("cfg::try_to_float('%s'): invalid float", value); + if (out) + cfg_log.error("cfg::try_to_float('%s'): invalid float", value); return false; } if (result < min || result > max) { - if (out) cfg_log.error("cfg::try_to_float('%s'): out of bounds (val=%f, min=%f, max=%f)", value, result, min, max); + if (out) + cfg_log.error("cfg::try_to_float('%s'): out of bounds (val=%f, min=%f, max=%f)", value, result, min, max); return false; } - if (out) *out = result; + if (out) + *out = result; return true; } bool try_to_string(std::string* out, const f64& value) { #ifdef __APPLE__ - if (out) *out = std::to_string(value); + if (out) + *out = std::to_string(value); return true; #else std::array str{}; if (auto [ptr, ec] = std::to_chars(str.data(), str.data() + str.size(), value, std::chars_format::fixed); ec == std::errc()) { - if (out) *out = std::string(str.data(), ptr); + if (out) + *out = std::string(str.data(), ptr); return true; } else { - if (out) cfg_log.error("cfg::try_to_string(): could not convert value '%f' to string. error='%s'", value, std::make_error_code(ec).message()); + if (out) + cfg_log.error("cfg::try_to_string(): could not convert value '%f' to string. error='%s'", value, std::make_error_code(ec).message()); return false; } #endif @@ -235,7 +250,8 @@ bool cfg::try_to_enum_value(u64* out, decltype(&fmt_class_string::format) f if (var == value) { - if (out) *out = i; + if (out) + *out = i; return true; } @@ -271,17 +287,20 @@ bool cfg::try_to_enum_value(u64* out, decltype(&fmt_class_string::format) f if (ret.ec != std::errc() || ret.ptr != end) { - if (out) cfg_log.error("cfg::try_to_enum_value('%s'): invalid enum or integer", value); + if (out) + cfg_log.error("cfg::try_to_enum_value('%s'): invalid enum or integer", value); return false; } if (result > max) { - if (out) cfg_log.error("cfg::try_to_enum_value('%s'): out of bounds(val=%u, min=0, max=%u)", value, result, max); + if (out) + cfg_log.error("cfg::try_to_enum_value('%s'): out of bounds(val=%u, min=0, max=%u)", value, result, max); return false; } - if (out) *out = result; + if (out) + *out = result; return true; } @@ -354,7 +373,7 @@ void cfg::encode(YAML::Emitter& out, const cfg::_base& rhs) } case type::node_map: { - //out << YAML::Block; // Does nothing, output is in Flow mode still (TODO) + // out << YAML::Block; // Does nothing, output is in Flow mode still (TODO) out << YAML::BeginMap; for (const auto& np : static_cast(rhs).get_map()) { @@ -369,7 +388,8 @@ void cfg::encode(YAML::Emitter& out, const cfg::_base& rhs) out << YAML::BeginMap; for (const auto& np : static_cast(rhs).get_map()) { - if (np.second == logs::level::notice) continue; + if (np.second == logs::level::notice) + continue; out << YAML::Key << np.first; out << YAML::Value << fmt::format("%s", np.second); } @@ -418,7 +438,8 @@ void cfg::decode(const YAML::Node& data, cfg::_base& rhs, bool dynamic) for (const auto& pair : data) { - if (!pair.first.IsScalar()) continue; + if (!pair.first.IsScalar()) + continue; // Find the key among existing nodes for (const auto& node : static_cast(rhs).get_nodes()) @@ -455,7 +476,8 @@ void cfg::decode(const YAML::Node& data, cfg::_base& rhs, bool dynamic) for (const auto& pair : data) { - if (!pair.first.IsScalar() || !pair.second.IsScalar()) continue; + if (!pair.first.IsScalar() || !pair.second.IsScalar()) + continue; values.emplace(pair.first.Scalar(), pair.second.Scalar()); } @@ -474,7 +496,8 @@ void cfg::decode(const YAML::Node& data, cfg::_base& rhs, bool dynamic) for (const auto& pair : data) { - if (!pair.first.IsScalar() || !pair.second.IsScalar()) continue; + if (!pair.first.IsScalar() || !pair.second.IsScalar()) + continue; u64 value; if (cfg::try_to_enum_value(&value, &fmt_class_string::format, pair.second.Scalar())) @@ -497,13 +520,15 @@ void cfg::decode(const YAML::Node& data, cfg::_base& rhs, bool dynamic) for (const auto& pair : data) { - if (!pair.first.IsScalar() || !pair.second.IsMap()) continue; + if (!pair.first.IsScalar() || !pair.second.IsMap()) + continue; device_info info{}; for (const auto& key_value : pair.second) { - if (!key_value.first.IsScalar() || !key_value.second.IsScalar()) continue; + if (!key_value.first.IsScalar() || !key_value.second.IsScalar()) + continue; if (key_value.first.Scalar() == "Path") info.path = key_value.second.Scalar(); @@ -546,7 +571,7 @@ std::string cfg::node::to_string() const return {out.c_str(), out.size()}; } -nlohmann::ordered_json cfg::node::to_json() const +nlohmann::ordered_json cfg::node::to_json() const { auto result = nlohmann::ordered_json::object(); @@ -558,14 +583,14 @@ nlohmann::ordered_json cfg::node::to_json() const return result; } -bool cfg::node::from_json(const nlohmann::json &json, bool dynamic) +bool cfg::node::from_json(const nlohmann::json& json, bool dynamic) { if (!json.is_object()) { return false; } - auto find_node = [this](std::string_view name) -> _base * + auto find_node = [this](std::string_view name) -> _base* { for (const auto& node : get_nodes()) { @@ -578,8 +603,7 @@ bool cfg::node::from_json(const nlohmann::json &json, bool dynamic) return nullptr; }; - - for (auto &[key, value] : json.get()) + for (auto& [key, value] : json.get()) { auto keyNode = find_node(key); diff --git a/rpcs3/Utilities/Config.h b/rpcs3/Utilities/Config.h index 96a0d1dbf..9d1c58090 100644 --- a/rpcs3/Utilities/Config.h +++ b/rpcs3/Utilities/Config.h @@ -36,16 +36,16 @@ namespace cfg enum class type : unsigned { node = 0, // cfg::node type - _bool, // cfg::_bool type - _enum, // cfg::_enum type - _int, // cfg::_int type - uint, // cfg::uint type - string, // cfg::string type - set, // cfg::set_entry type - map, // cfg::map_entry type + _bool, // cfg::_bool type + _enum, // cfg::_enum type + _int, // cfg::_int type + uint, // cfg::uint type + string, // cfg::string type + set, // cfg::set_entry type + map, // cfg::map_entry type node_map, // cfg::node_map_entry type - log, // cfg::log_entry type - device, // cfg::device_entry type + log, // cfg::log_entry type + device, // cfg::device_entry type }; // Config tree entry abstract base class @@ -75,19 +75,34 @@ namespace cfg virtual ~_base() = default; // Get unique ID - u32 get_id() const { return m_id; } + u32 get_id() const + { + return m_id; + } // Get parent - _base* get_parent() const { return m_parent; } + _base* get_parent() const + { + return m_parent; + } // Get type - type get_type() const { return m_type; } + type get_type() const + { + return m_type; + } // Get name - const std::string& get_name() const { return m_name; } + const std::string& get_name() const + { + return m_name; + } // Get dynamic property for reloading configs during games - bool get_is_dynamic() const { return m_dynamic; } + bool get_is_dynamic() const + { + return m_dynamic; + } // Reset defaults virtual void from_default() = 0; @@ -99,7 +114,7 @@ namespace cfg } virtual nlohmann::ordered_json to_json() const = 0; - virtual bool from_json(const nlohmann::json &, bool dynamic = false) = 0; + virtual bool from_json(const nlohmann::json&, bool dynamic = false) = 0; // Convert default to string (optional) virtual std::string def_to_string() const @@ -154,7 +169,7 @@ namespace cfg // Deserialize node bool from_string(std::string_view value, bool dynamic = false) override; - bool from_json(const nlohmann::json &, bool dynamic = false) override; + bool from_json(const nlohmann::json&, bool dynamic = false) override; // Set default values void from_default() override; @@ -168,9 +183,7 @@ namespace cfg bool def; _bool(node* owner, std::string name, bool def = false, bool dynamic = false) - : _base(type::_bool, owner, std::move(name), dynamic) - , m_value(def) - , def(def) + : _base(type::_bool, owner, std::move(name), dynamic), m_value(def), def(def) { } @@ -193,8 +206,7 @@ namespace cfg nlohmann::ordered_json to_json() const override { - return - { + return { {"type", "bool"}, {"value", m_value.load()}, {"default", def}, @@ -226,7 +238,7 @@ namespace cfg return true; } - bool from_json(const nlohmann::json &json, bool) override + bool from_json(const nlohmann::json& json, bool) override { if (!json.is_boolean()) { @@ -253,9 +265,7 @@ namespace cfg const T def; _enum(node* owner, const std::string& name, T value = {}, bool dynamic = false) - : _base(type::_enum, owner, name, dynamic) - , m_value(value) - , def(value) + : _base(type::_enum, owner, name, dynamic), m_value(value), def(value) { } @@ -293,8 +303,7 @@ namespace cfg nlohmann::ordered_json to_json() const override { - return - { + return { {"type", "enum"}, {"value", to_string()}, {"default", def_to_string()}, @@ -323,7 +332,7 @@ namespace cfg return false; } - bool from_json(const nlohmann::json &json, bool dynamic) override + bool from_json(const nlohmann::json& json, bool dynamic) override { if (!json.is_string()) { @@ -360,13 +369,9 @@ namespace cfg static constexpr s64 min = Min; _int(node* owner, const std::string& name, int_type def = std::min(Max, std::max(Min, 0)), bool dynamic = false, - std::function min_fn = nullptr, - std::function max_fn = nullptr) - : _base(type::_int, owner, name, dynamic) - , m_value(def) - , m_min_fn(std::move(min_fn)) - , m_max_fn(std::move(max_fn)) - , def(def) + std::function min_fn = nullptr, + std::function max_fn = nullptr) + : _base(type::_int, owner, name, dynamic), m_value(def), m_min_fn(std::move(min_fn)), m_max_fn(std::move(max_fn)), def(def) { } @@ -412,8 +417,7 @@ namespace cfg nlohmann::ordered_json to_json() const override { - return - { + return { {"type", "int"}, {"value", to_string()}, {"default", def_to_string()}, @@ -439,7 +443,7 @@ namespace cfg return false; } - bool from_json(const nlohmann::json &json, bool) override + bool from_json(const nlohmann::json& json, bool) override { if (!json.is_number_integer()) { @@ -485,9 +489,7 @@ namespace cfg static constexpr float_type min = Min; _float(node* owner, const std::string& name, float_type def = std::min(Max, std::max(Min, 0)), bool dynamic = false) - : _base(type::_int, owner, name, dynamic) - , m_value(def) - , def(def) + : _base(type::_int, owner, name, dynamic), m_value(def), def(def) { } @@ -519,8 +521,7 @@ namespace cfg nlohmann::ordered_json to_json() const override { - return - { + return { {"type", "float"}, {"value", to_string()}, {"default", def_to_string()}, @@ -552,7 +553,7 @@ namespace cfg return false; } - bool from_json(const nlohmann::json &json, bool) override + bool from_json(const nlohmann::json& json, bool) override { if (!json.is_number_float()) { @@ -606,9 +607,7 @@ namespace cfg static constexpr u64 min = Min; uint(node* owner, const std::string& name, int_type def = std::max(Min, 0), bool dynamic = false) - : _base(type::uint, owner, name, dynamic) - , m_value(def) - , def(def) + : _base(type::uint, owner, name, dynamic), m_value(def), def(def) { } @@ -634,8 +633,7 @@ namespace cfg nlohmann::ordered_json to_json() const override { - return - { + return { {"type", "uint"}, {"value", to_string()}, {"default", def_to_string()}, @@ -661,7 +659,7 @@ namespace cfg return false; } - bool from_json(const nlohmann::json &json, bool) override + bool from_json(const nlohmann::json& json, bool) override { if (!json.is_number_unsigned()) { @@ -705,9 +703,7 @@ namespace cfg std::string def; string(node* owner, std::string name, std::string def = {}, bool dynamic = false) - : _base(type::string, owner, std::move(name), dynamic) - , m_value(def) - , def(std::move(def)) + : _base(type::string, owner, std::move(name), dynamic), m_value(def), def(std::move(def)) { } @@ -725,8 +721,7 @@ namespace cfg nlohmann::ordered_json to_json() const override { - return - { + return { {"type", "string"}, {"value", to_string()}, {"default", def_to_string()}, @@ -744,7 +739,7 @@ namespace cfg return true; } - bool from_json(const nlohmann::json &json, bool) override + bool from_json(const nlohmann::json& json, bool) override { if (!json.is_string()) { @@ -782,13 +777,12 @@ namespace cfg std::vector to_list() const override { - return { m_set.begin(), m_set.end() }; + return {m_set.begin(), m_set.end()}; } nlohmann::ordered_json to_json() const override { - return - { + return { {"type", "set"}, {"value", to_list()}, }; @@ -796,12 +790,12 @@ namespace cfg bool from_list(std::vector&& list) override { - m_set = { std::make_move_iterator(list.begin()), std::make_move_iterator(list.end()) }; + m_set = {std::make_move_iterator(list.begin()), std::make_move_iterator(list.end())}; return true; } - bool from_json(const nlohmann::json &json, bool) override + bool from_json(const nlohmann::json& json, bool) override { if (!json.is_array()) { @@ -813,7 +807,7 @@ namespace cfg std::vector string_array; string_array.reserve(array.size()); - for (auto &elem : array) + for (auto& elem : array) { if (!elem.is_string()) { @@ -827,7 +821,7 @@ namespace cfg } }; - template + template using map_of_type = std::map>; class map_entry : public _base @@ -847,22 +841,20 @@ namespace cfg nlohmann::ordered_json to_json() const override { - return - { + return { {"type", "map"}, {"value", m_map}, }; } - - bool from_json(const nlohmann::json &json, bool) override + bool from_json(const nlohmann::json& json, bool) override { if (!json.is_object()) { return false; } - for (auto &elem : json.get()) + for (auto& elem : json.get()) { set_value(elem.first, elem.second); } @@ -915,22 +907,21 @@ namespace cfg values[key] = level_string; } - return - { + return { {"type", "log_map"}, {"values", values}, {"levels", levels}, }; } - bool from_json(const nlohmann::json &json, bool) override + bool from_json(const nlohmann::json& json, bool) override { if (!json.is_object()) { return false; } - for (auto [key, valueString] : json.get()) + for (auto [key, valueString] : json.get()) { if (!valueString.is_string()) { @@ -978,7 +969,7 @@ namespace cfg }; } - bool from_json(const nlohmann::json &json) + bool from_json(const nlohmann::json& json) { if (json.contains("path")) { @@ -1031,8 +1022,7 @@ namespace cfg public: device_entry(node* owner, const std::string& name, map_of_type def = {}) - : _base(type::device, owner, name, true) - , m_map(std::move(def)) + : _base(type::device, owner, name, true), m_map(std::move(def)) { m_default = m_map; } @@ -1042,7 +1032,7 @@ namespace cfg return {}; } - bool from_json(const nlohmann::json &, bool) override + bool from_json(const nlohmann::json&, bool) override { return false; } @@ -1061,4 +1051,4 @@ namespace cfg void from_default() override; }; -} +} // namespace cfg diff --git a/rpcs3/Utilities/File.cpp b/rpcs3/Utilities/File.cpp index dc137cecc..2c79e7fbe 100644 --- a/rpcs3/Utilities/File.cpp +++ b/rpcs3/Utilities/File.cpp @@ -25,7 +25,7 @@ std::string g_android_cache_dir; #include "Utilities/StrUtil.h" #include -#include +#include static std::unique_ptr to_wchar(std::string_view source) { @@ -205,7 +205,7 @@ namespace fs std::unordered_map> m_map{}; public: - shared_ptr get_device(const std::string& path, std::string_view *device_path = nullptr); + shared_ptr get_device(const std::string& path, std::string_view* device_path = nullptr); shared_ptr set_device(const std::string& name, shared_ptr); }; @@ -402,8 +402,7 @@ namespace fs public: windows_file(HANDLE handle) - : m_handle(handle) - , m_pos(0) + : m_handle(handle), m_pos(0) { } @@ -577,7 +576,8 @@ namespace fs const s64 new_pos = whence == fs::seek_set ? offset : whence == fs::seek_cur ? offset + m_pos : - whence == fs::seek_end ? offset + size() : -1; + whence == fs::seek_end ? offset + size() : + -1; if (new_pos < 0) { @@ -766,7 +766,8 @@ namespace fs const int mode = whence == seek_set ? SEEK_SET : - whence == seek_cur ? SEEK_CUR : SEEK_END; + whence == seek_cur ? SEEK_CUR : + SEEK_END; const auto result = ::lseek(m_fd, offset, mode); @@ -833,9 +834,9 @@ namespace fs } }; #endif -} +} // namespace fs -shared_ptr fs::device_manager::get_device(const std::string& path, std::string_view *device_path) +shared_ptr fs::device_manager::get_device(const std::string& path, std::string_view* device_path) { auto prefix = path.substr(0, path.find_first_of("/\\", 1)); @@ -885,7 +886,7 @@ shared_ptr fs::device_manager::set_device(const std::string& na return null_ptr; } -shared_ptr fs::get_virtual_device(const std::string& path, std::string_view *device_path) +shared_ptr fs::get_virtual_device(const std::string& path, std::string_view* device_path) { // Every virtual device path must have specific name at the beginning if ((path.starts_with("/vfsv0_") || path.starts_with("\\vfsv0_")) && path.size() >= 8 + 22 && path[29] == '_' && path.find_first_of("/\\", 1) > 29) @@ -1019,7 +1020,10 @@ bool fs::get_stat(const std::string& path, stat_t& info) struct close_t { HANDLE handle; - ~close_t() { FindClose(handle); } + ~close_t() + { + FindClose(handle); + } }; for (close_t find_manage{handle}; attrs.cFileName != wpath_view.substr(wpath_view.find_last_of(wdelim) + 1);) @@ -1426,7 +1430,7 @@ bool fs::copy_file(const std::string& from, const std::string& to, bool overwrit if (::fcopyfile(input, output, 0, COPYFILE_ALL)) #elif defined(__linux__) || defined(__sun) // sendfile will work with non-socket output (i.e. regular file) on Linux 2.6.33+ - struct ::stat fileinfo = { 0 }; + struct ::stat fileinfo = {0}; bool result = ::fstat(input, &fileinfo) != -1; if (result) { @@ -1466,7 +1470,7 @@ bool fs::copy_file(const std::string& from, const std::string& to, bool overwrit } std::ifstream in{from, std::ios::binary}; - std::ofstream out{to, std::ios::binary}; + std::ofstream out{to, std::ios::binary}; if (!in.good() || !out.good()) { @@ -1653,15 +1657,18 @@ fs::file::file(const std::string& path, bs_t mode) #ifdef _WIN32 DWORD access = 0; - if (mode & fs::read) access |= GENERIC_READ; - if (mode & fs::write) access |= DELETE | (mode & fs::append ? FILE_APPEND_DATA : GENERIC_WRITE); + if (mode & fs::read) + access |= GENERIC_READ; + if (mode & fs::write) + access |= DELETE | (mode & fs::append ? FILE_APPEND_DATA : GENERIC_WRITE); DWORD disp = 0; if (mode & fs::create) { disp = - mode & fs::excl ? CREATE_NEW : - mode & fs::trunc ? CREATE_ALWAYS : OPEN_ALWAYS; + mode & fs::excl ? CREATE_NEW : + mode & fs::trunc ? CREATE_ALWAYS : + OPEN_ALWAYS; } else { @@ -1697,14 +1704,21 @@ fs::file::file(const std::string& path, bs_t mode) #else int flags = O_CLOEXEC; // Ensures all files are closed on execl for auto updater - if (mode & fs::read && mode & fs::write) flags |= O_RDWR; - else if (mode & fs::read) flags |= O_RDONLY; - else if (mode & fs::write) flags |= O_WRONLY; + if (mode & fs::read && mode & fs::write) + flags |= O_RDWR; + else if (mode & fs::read) + flags |= O_RDONLY; + else if (mode & fs::write) + flags |= O_WRONLY; - if (mode & fs::append) flags |= O_APPEND; - if (mode & fs::create) flags |= O_CREAT; - if (mode & fs::trunc && !(mode & fs::lock)) flags |= O_TRUNC; - if (mode & fs::excl) flags |= O_EXCL; + if (mode & fs::append) + flags |= O_APPEND; + if (mode & fs::create) + flags |= O_CREAT; + if (mode & fs::trunc && !(mode & fs::lock)) + flags |= O_TRUNC; + if (mode & fs::excl) + flags |= O_EXCL; int perm = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; @@ -1753,8 +1767,6 @@ fs::file::file(const std::string& path, bs_t mode) #endif } - - fs::file fs::file::from_native_handle(native_handle handle) { fs::file result; @@ -1779,8 +1791,7 @@ fs::file::file(const void* ptr, usz size) public: memory_stream(const void* ptr, u64 size) - : m_ptr(static_cast(ptr)) - , m_size(size) + : m_ptr(static_cast(ptr)), m_size(size) { } @@ -1834,7 +1845,8 @@ fs::file::file(const void* ptr, usz size) const s64 new_pos = whence == fs::seek_set ? offset : whence == fs::seek_cur ? offset + m_pos : - whence == fs::seek_end ? offset + size() : -1; + whence == fs::seek_end ? offset + size() : + -1; if (new_pos < 0) { @@ -2006,7 +2018,7 @@ bool fs::dir::open(const std::string& path) if (::fstatat(::dirfd(m_dd), found->d_name, &file_info, 0) != 0) { - //failed metadata (broken symlink?), ignore and skip to next file + // failed metadata (broken symlink?), ignore and skip to next file return read(info); } @@ -2455,11 +2467,11 @@ fs::file fs::make_gather(std::vector files) files[it->second].seek(pos - it->first, fs::seek_end); const u64 count = std::min(it->first - pos, buf_max); - const u64 read = files[it->second].read(buf_out, count); + const u64 read = files[it->second].read(buf_out, count); buf_out += count; buf_max -= count; - pos += read; + pos += read; if (read < count || buf_max == 0) { @@ -2489,11 +2501,11 @@ fs::file fs::make_gather(std::vector files) for (auto it = ends.upper_bound(pos); it != ends.end(); ++it) { const u64 count = std::min(it->first - pos, buf_max); - const u64 read = files[it->second].read_at(files[it->second].size() + pos - it->first, buf_out, count); + const u64 read = files[it->second].read_at(files[it->second].size() + pos - it->first, buf_out, count); buf_out += count; buf_max -= count; - pos += read; + pos += read; if (read < count || buf_max == 0) { @@ -2518,7 +2530,8 @@ fs::file fs::make_gather(std::vector files) const s64 new_pos = whence == fs::seek_set ? offset : whence == fs::seek_cur ? offset + pos : - whence == fs::seek_end ? offset + end : -1; + whence == fs::seek_end ? offset + end : + -1; if (new_pos < 0) { @@ -2581,8 +2594,7 @@ bool fs::pending_file::open(std::string_view path) } m_path.clear(); - } - while (fs::g_tls_error == fs::error::exist); // Only retry if failed due to existing file + } while (fs::g_tls_error == fs::error::exist); // Only retry if failed due to existing file return file.operator bool(); } @@ -2626,8 +2638,7 @@ bool fs::pending_file::commit(bool overwrite) const auto ws1 = to_wchar(m_path); - const HANDLE file_handle = !overwrite ? INVALID_HANDLE_VALUE - : CreateFileW(ws1.get(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); + const HANDLE file_handle = !overwrite ? INVALID_HANDLE_VALUE : CreateFileW(ws1.get(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); while (file_handle != INVALID_HANDLE_VALUE) { @@ -2734,8 +2745,7 @@ bool fs::pending_file::commit(bool overwrite) break; } - } - while (fs::g_tls_error == fs::error::exist); // Only retry if failed due to existing file + } while (fs::g_tls_error == fs::error::exist); // Only retry if failed due to existing file if (write_temp_path) { @@ -2787,23 +2797,23 @@ stx::generator fs::list_dir_recursively(const std::string& path) } } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto arg) - { - switch (arg) { - STR_CASE(fs::seek_mode::seek_set); - STR_CASE(fs::seek_mode::seek_cur); - STR_CASE(fs::seek_mode::seek_end); - } + switch (arg) + { + STR_CASE(fs::seek_mode::seek_set); + STR_CASE(fs::seek_mode::seek_cur); + STR_CASE(fs::seek_mode::seek_end); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { if (arg == static_cast(fs::error::unknown)) @@ -2818,29 +2828,29 @@ void fmt_class_string::format(std::string& out, u64 arg) } format_enum(out, arg, [](auto arg) - { - switch (arg) { - case fs::error::ok: return "OK"; + switch (arg) + { + case fs::error::ok: return "OK"; - case fs::error::inval: return "Invalid arguments"; - case fs::error::noent: return "Not found"; - case fs::error::exist: return "Already exists"; - case fs::error::acces: return "Access violation"; - case fs::error::notempty: return "Not empty"; - case fs::error::readonly: return "Read only"; - case fs::error::isdir: return "Is a directory"; - case fs::error::toolong: return "Path too long"; - case fs::error::nospace: return "Not enough space on the device"; - case fs::error::xdev: return "Device mismatch"; - case fs::error::unknown: return "Unknown system error"; - } + case fs::error::inval: return "Invalid arguments"; + case fs::error::noent: return "Not found"; + case fs::error::exist: return "Already exists"; + case fs::error::acces: return "Access violation"; + case fs::error::notempty: return "Not empty"; + case fs::error::readonly: return "Read only"; + case fs::error::isdir: return "Is a directory"; + case fs::error::toolong: return "Path too long"; + case fs::error::nospace: return "Not enough space on the device"; + case fs::error::xdev: return "Device mismatch"; + case fs::error::unknown: return "Unknown system error"; + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { const fs::file_id& id = get_object(arg); diff --git a/rpcs3/Utilities/File.h b/rpcs3/Utilities/File.h index e3af73935..1a63d4eb9 100644 --- a/rpcs3/Utilities/File.h +++ b/rpcs3/Utilities/File.h @@ -38,15 +38,15 @@ namespace fs __bitset_enum_max }; - constexpr auto read = +open_mode::read; // Enable reading - constexpr auto write = +open_mode::write; // Enable writing - constexpr auto append = +open_mode::append; // Always append to the end of the file - constexpr auto create = +open_mode::create; // Create file if it doesn't exist - constexpr auto trunc = +open_mode::trunc; // Clear opened file if it's not empty - constexpr auto excl = +open_mode::excl; // Failure if the file already exists (used with `create`) - constexpr auto lock = +open_mode::lock; // Prevent opening the file more than once - constexpr auto unread = +open_mode::unread; // Aggressively prevent reading the opened file (do not use) - constexpr auto isfile = +open_mode::isfile; // Ensure valid fs::file handle is not of directory + constexpr auto read = +open_mode::read; // Enable reading + constexpr auto write = +open_mode::write; // Enable writing + constexpr auto append = +open_mode::append; // Always append to the end of the file + constexpr auto create = +open_mode::create; // Create file if it doesn't exist + constexpr auto trunc = +open_mode::trunc; // Clear opened file if it's not empty + constexpr auto excl = +open_mode::excl; // Failure if the file already exists (used with `create`) + constexpr auto lock = +open_mode::lock; // Prevent opening the file more than once + constexpr auto unread = +open_mode::unread; // Aggressively prevent reading the opened file (do not use) + constexpr auto isfile = +open_mode::isfile; // Ensure valid fs::file handle is not of directory constexpr auto write_new = write + create + excl; constexpr auto rewrite = write + create + trunc; @@ -182,10 +182,12 @@ namespace fs [[noreturn]] void xfail(std::source_location); [[noreturn]] void xovfl(); - constexpr struct pod_tag_t{} pod_tag; + constexpr struct pod_tag_t + { + } pod_tag; // Get virtual device for specified path (nullptr for real path) - shared_ptr get_virtual_device(const std::string& path, std::string_view *device_path); + shared_ptr get_virtual_device(const std::string& path, std::string_view* device_path); // Set virtual device with specified name (nullptr for deletion) shared_ptr set_virtual_device(const std::string& name, shared_ptr device); @@ -305,21 +307,24 @@ namespace fs // Change file size (possibly appending zero bytes) bool trunc(u64 length, std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); return m_file->trunc(length); } // Get file information stat_t get_stat(std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); return m_file->get_stat(); } // Sync file buffers void sync(std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); return m_file->sync(); } @@ -329,80 +334,95 @@ namespace fs // Read the data from the file and return the amount of data written in buffer u64 read(void* buffer, u64 count, std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); return m_file->read(buffer, count); } // Read the data from the file at specified offset in thread-safe manner u64 read_at(u64 offset, void* buffer, u64 count, std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); return m_file->read_at(offset, buffer, count); } // Write the data to the file and return the amount of data actually written u64 write(const void* buffer, u64 count, std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); return m_file->write(buffer, count); } u64 write_at(u64 offset, const void* buffer, u64 count, std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); return m_file->write_at(offset, buffer, count); } // Change current position, returns resulting position u64 seek(s64 offset, seek_mode whence = seek_set, std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); return m_file->seek(offset, whence); } // Get file size u64 size(std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); return m_file->size(); } // Get current position u64 pos(std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); return m_file->seek(0, seek_cur); } // Write std::basic_string unconditionally - template requires (std::is_trivially_copyable_v && !std::is_pointer_v) + template + requires(std::is_trivially_copyable_v && !std::is_pointer_v) const file& write(const std::basic_string& str, std::source_location src_loc = std::source_location::current()) const { - if (write(str.data(), str.size() * sizeof(T), src_loc) != str.size() * sizeof(T)) xfail(src_loc); + if (write(str.data(), str.size() * sizeof(T), src_loc) != str.size() * sizeof(T)) + xfail(src_loc); return *this; } // Write POD unconditionally - template requires (std::is_trivially_copyable_v && !std::is_pointer_v) + template + requires(std::is_trivially_copyable_v && !std::is_pointer_v) const file& write(const T& data, std::source_location src_loc = std::source_location::current()) const { - if (write(std::addressof(data), sizeof(T), src_loc) != sizeof(T)) xfail(src_loc); + if (write(std::addressof(data), sizeof(T), src_loc) != sizeof(T)) + xfail(src_loc); return *this; } // Write POD std::vector unconditionally - template requires (std::is_trivially_copyable_v && !std::is_pointer_v) + template + requires(std::is_trivially_copyable_v && !std::is_pointer_v) const file& write(const std::vector& vec, std::source_location src_loc = std::source_location::current()) const { - if (write(vec.data(), vec.size() * sizeof(T), src_loc) != vec.size() * sizeof(T)) xfail(src_loc); + if (write(vec.data(), vec.size() * sizeof(T), src_loc) != vec.size() * sizeof(T)) + xfail(src_loc); return *this; } // Read std::basic_string - template requires (std::is_trivially_copyable_v && !std::is_pointer_v) + template + requires(std::is_trivially_copyable_v && !std::is_pointer_v) bool read(std::basic_string& str, usz _size = umax, std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); if (_size != umax) { @@ -419,7 +439,8 @@ namespace fs } // Read POD, sizeof(T) is used - template requires (std::is_trivially_copyable_v && !std::is_pointer_v) + template + requires(std::is_trivially_copyable_v && !std::is_pointer_v) bool read(T& data, pod_tag_t = pod_tag, std::source_location src_loc = std::source_location::current()) const { @@ -427,10 +448,12 @@ namespace fs } // Read POD std::vector - template requires (std::is_trivially_copyable_v && !std::is_pointer_v) + template + requires(std::is_trivially_copyable_v && !std::is_pointer_v) bool read(std::vector& vec, usz _size = umax, bool use_offs = false, usz offset = umax, std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); if (_size != umax) { @@ -452,11 +475,13 @@ namespace fs } // Read POD (experimental) - template requires (std::is_trivially_copyable_v && !std::is_pointer_v) + template + requires(std::is_trivially_copyable_v && !std::is_pointer_v) T read(pod_tag_t = pod_tag, std::source_location src_loc = std::source_location::current()) const { T result; - if (!read(result, pod_tag, src_loc)) xfail(src_loc); + if (!read(result, pod_tag, src_loc)) + xfail(src_loc); return result; } @@ -467,17 +492,20 @@ namespace fs std::basic_string result; result.resize(size() / sizeof(T)); seek(0); - if (!read(result, result.size(), src_loc)) xfail(src_loc); + if (!read(result, result.size(), src_loc)) + xfail(src_loc); return result; } // Read full file to std::vector - template requires (std::is_trivially_copyable_v && !std::is_pointer_v) + template + requires(std::is_trivially_copyable_v && !std::is_pointer_v) std::vector to_vector(std::source_location src_loc = std::source_location::current()) const { std::vector result; result.resize(size() / sizeof(T)); - if (!read(result, result.size(), true, 0, src_loc)) xfail(src_loc); + if (!read(result, result.size(), true, 0, src_loc)) + xfail(src_loc); return result; } @@ -490,7 +518,8 @@ namespace fs // Gathered write u64 write_gather(const iovec_clone* buffers, u64 buf_count, std::source_location src_loc = std::source_location::current()) const { - if (!m_file) xnull(src_loc); + if (!m_file) + xnull(src_loc); return m_file->write_gather(buffers, buf_count); } }; @@ -536,14 +565,16 @@ namespace fs // Get next directory entry bool read(dir_entry& out, std::source_location src_loc = std::source_location::current()) const { - if (!m_dir) xnull(src_loc); + if (!m_dir) + xnull(src_loc); return m_dir->read(out); } // Reset to the beginning void rewind(std::source_location src_loc = std::source_location::current()) const { - if (!m_dir) xnull(src_loc); + if (!m_dir) + xnull(src_loc); return m_dir->rewind(); } @@ -586,7 +617,7 @@ namespace fs iterator& operator=(iterator&&) = default; - dir_entry& operator *() + dir_entry& operator*() { return m_entry; } @@ -604,7 +635,7 @@ namespace fs return old; } - bool operator !=(const iterator& rhs) const + bool operator!=(const iterator& rhs) const { return m_parent != rhs.m_parent; } @@ -625,23 +656,26 @@ namespace fs { std::vector m_entries; std::size_t m_offset = 0; - + public: virtual_dir(std::vector entries) : m_entries(std::move(entries)) {} - - bool read(fs::dir_entry &entry) override + + bool read(fs::dir_entry& entry) override { if (m_offset < m_entries.size()) { entry = m_entries[m_offset++]; return true; } - + return false; } - - void rewind() override { m_offset = 0; } + + void rewind() override + { + m_offset = 0; + } }; // Get executable path @@ -730,9 +764,7 @@ namespace fs u64 pos; container_stream(T&& obj, const stat_t& init_stat = {}) - : obj(std::forward(obj)) - , pos(0) - , m_stat(init_stat) + : obj(std::forward(obj)), pos(0), m_stat(init_stat) { } @@ -795,7 +827,7 @@ namespace fs if (pos > old_size) { - // Reserve memory + // Reserve memory obj.reserve(pos + size); // Fill gap if necessary (default-initialized) @@ -812,7 +844,8 @@ namespace fs obj.insert(obj.end(), src + overlap, src + size); pos += size; - if (size) update_time(true); + if (size) + update_time(true); return size; } @@ -821,7 +854,8 @@ namespace fs const s64 new_pos = whence == fs::seek_set ? offset : whence == fs::seek_cur ? offset + pos : - whence == fs::seek_end ? offset + size() : -1; + whence == fs::seek_end ? offset + size() : + -1; if (new_pos < 0) { @@ -899,4 +933,4 @@ namespace fs file make_gather(std::vector); stx::generator list_dir_recursively(const std::string& path); -} +} // namespace fs diff --git a/rpcs3/Utilities/JIT.h b/rpcs3/Utilities/JIT.h index 6dfa9e7cd..df0eec7db 100644 --- a/rpcs3/Utilities/JIT.h +++ b/rpcs3/Utilities/JIT.h @@ -432,7 +432,7 @@ namespace asmjit c.bind(next); } #endif -} +} // namespace asmjit // Build runtime function with asmjit::X86Assembler template @@ -501,7 +501,7 @@ namespace llvm class ExecutionEngine; class Module; class StringRef; -} +} // namespace llvm enum class thread_state : u32; @@ -569,6 +569,6 @@ public: bool add_sub_disk_space(ssz space); }; -const char *fallback_cpu_detection(); +const char* fallback_cpu_detection(); #endif // LLVM_AVAILABLE diff --git a/rpcs3/Utilities/JITASM.cpp b/rpcs3/Utilities/JITASM.cpp index 63628f448..b39e6f497 100644 --- a/rpcs3/Utilities/JITASM.cpp +++ b/rpcs3/Utilities/JITASM.cpp @@ -80,7 +80,7 @@ void jit_announce(uptr func, usz size, std::string_view name) { u64 addr; // RPCS3 process address u32 size; // Function size - u32 off; // Function offset + u32 off; // Function offset }; // Write index entry at the beginning of file, and data + NTS name at fixed offset @@ -157,30 +157,30 @@ static u8* add_jit_memory(usz size, usz align) // Simple allocation by incrementing pointer to the next free data const u64 pos = Ctr.atomic_op([&](u64& ctr) -> u64 - { - const u64 _pos = utils::align(ctr & 0xffff'ffff, align); - const u64 _new = utils::align(_pos + size, align); - - if (_new > 0x40000000) [[unlikely]] { - // Sorry, we failed, and further attempts should fail too. - ctr |= 0x40000000; - return -1; - } + const u64 _pos = utils::align(ctr & 0xffff'ffff, align); + const u64 _new = utils::align(_pos + size, align); - // Last allocation is stored in highest bits - olda = ctr >> 32; - newa = olda; + if (_new > 0x40000000) [[unlikely]] + { + // Sorry, we failed, and further attempts should fail too. + ctr |= 0x40000000; + return -1; + } - // Check the necessity to commit more memory - if (_new > olda) [[unlikely]] - { - newa = utils::align(_new, 0x200000); - } + // Last allocation is stored in highest bits + olda = ctr >> 32; + newa = olda; - ctr += _new - (ctr & 0xffff'ffff); - return _pos; - }); + // Check the necessity to commit more memory + if (_new > olda) [[unlikely]] + { + newa = utils::align(_new, 0x200000); + } + + ctr += _new - (ctr & 0xffff'ffff); + return _pos; + }); if (pos == umax) [[unlikely]] { @@ -196,12 +196,12 @@ static u8* add_jit_memory(usz size, usz align) #endif // Acknowledge committed memory Ctr.atomic_op([&](u64& ctr) - { - if ((ctr >> 32) < newa) { - ctr += (newa - (ctr >> 32)) << 32; - } - }); + if ((ctr >> 32) < newa) + { + ctr += (newa - (ctr >> 32)) << 32; + } + }); } ensure(pointer + pos >= get_jit_memory() + Off); @@ -364,17 +364,17 @@ jit_runtime_base& asmjit::get_global_runtime() uchar* _alloc(usz size, usz align) noexcept override { return m_pos.atomic_op([&](uchar*& pos) -> uchar* - { - const auto r = reinterpret_cast(utils::align(uptr(pos), align)); - - if (r >= pos && r + size > pos && r + size <= m_max) { - pos = r + size; - return r; - } + const auto r = reinterpret_cast(utils::align(uptr(pos), align)); - return nullptr; - }); + if (r >= pos && r + size > pos && r + size <= m_max) + { + pos = r + size; + return r; + } + + return nullptr; + }); } private: @@ -389,8 +389,7 @@ jit_runtime_base& asmjit::get_global_runtime() } asmjit::inline_runtime::inline_runtime(uchar* data, usz size) - : m_data(data) - , m_size(size) + : m_data(data), m_size(size) { } diff --git a/rpcs3/Utilities/JITLLVM.cpp b/rpcs3/Utilities/JITLLVM.cpp index 7e0512a64..86657aaaf 100644 --- a/rpcs3/Utilities/JITLLVM.cpp +++ b/rpcs3/Utilities/JITLLVM.cpp @@ -99,39 +99,39 @@ static u64 make_null_function(const std::string& name) // Build a "null" function that contains its name const auto func = build_function_asm("NULL", [&](native_asm& c, auto& args) - { + { #if defined(ARCH_X64) - Label data = c.newLabel(); - c.lea(args[0], x86::qword_ptr(data, 0)); - c.jmp(Imm(&null)); - c.align(AlignMode::kCode, 16); - c.bind(data); + Label data = c.newLabel(); + c.lea(args[0], x86::qword_ptr(data, 0)); + c.jmp(Imm(&null)); + c.align(AlignMode::kCode, 16); + c.bind(data); - // Copy function name bytes - for (char ch : name) - c.db(ch); - c.db(0); - c.align(AlignMode::kData, 16); + // Copy function name bytes + for (char ch : name) + c.db(ch); + c.db(0); + c.align(AlignMode::kData, 16); #else - // AArch64 implementation - Label data = c.newLabel(); - Label jump_address = c.newLabel(); - c.ldr(args[0], arm::ptr(data, 0)); - c.ldr(a64::x14, arm::ptr(jump_address, 0)); - c.br(a64::x14); + // AArch64 implementation + Label data = c.newLabel(); + Label jump_address = c.newLabel(); + c.ldr(args[0], arm::ptr(data, 0)); + c.ldr(a64::x14, arm::ptr(jump_address, 0)); + c.br(a64::x14); - // Data frame - c.align(AlignMode::kCode, 16); - c.bind(jump_address); - c.embedUInt64(reinterpret_cast(&null)); + // Data frame + c.align(AlignMode::kCode, 16); + c.bind(jump_address); + c.embedUInt64(reinterpret_cast(&null)); - c.align(AlignMode::kData, 16); - c.bind(data); - c.embed(name.c_str(), name.size()); - c.embedUInt8(0U); - c.align(AlignMode::kData, 16); + c.align(AlignMode::kData, 16); + c.bind(data); + c.embed(name.c_str(), name.size()); + c.embedUInt8(0U); + c.align(AlignMode::kData, 16); #endif - }); + }); func_ptr = reinterpret_cast(func); return func_ptr; @@ -203,7 +203,7 @@ struct MemoryManager1 : llvm::RTDyldMemoryManager m_code_mems = ptr; // ptr += c_max_size; // m_data_ro_mems = ptr; - ptr += c_max_size; + ptr += c_max_size; m_data_rw_mems = ptr; } @@ -246,7 +246,7 @@ struct MemoryManager1 : llvm::RTDyldMemoryManager u8* allocate(u64& alloc_pos, void* block, uptr size, u64 align, utils::protection prot) { align = align ? align : 16; - + const u64 sizea = utils::align(size, align); if (!size || align > c_page_size || sizea > c_max_size || sizea < size) @@ -312,7 +312,7 @@ struct MemoryManager1 : llvm::RTDyldMemoryManager if (is_ro) { // Disabled - //return allocate(data_ro_ptr, m_data_ro_mems, size, align, utils::protection::rw); + // return allocate(data_ro_ptr, m_data_ro_mems, size, align, utils::protection::rw); } return allocate(data_rw_ptr, m_data_rw_mems, size, align, utils::protection::rw); @@ -402,8 +402,7 @@ class ObjectCache final : public llvm::ObjectCache public: ObjectCache(const std::string& path, jit_compiler* compiler = nullptr) - : m_path(path) - , m_compiler(compiler) + : m_path(path), m_compiler(compiler) { } @@ -414,7 +413,7 @@ public: std::string name = m_path; name.append(_module->getName()); - //fs::file(name, fs::rewrite).write(obj.getBufferStart(), obj.getBufferSize()); + // fs::file(name, fs::rewrite).write(obj.getBufferStart(), obj.getBufferSize()); name.append(".gz"); if (!obj.getBufferSize()) @@ -628,36 +627,37 @@ bool jit_compiler::add_sub_disk_space(ssz space) } return m_disk_space.fetch_op([sub_size = static_cast(0 - space)](usz& val) - { - if (val >= sub_size) - { - val -= sub_size; - return true; - } + { + if (val >= sub_size) + { + val -= sub_size; + return true; + } - return false; - }).second; + return false; + }) + .second; } jit_compiler::jit_compiler(const std::unordered_map& _link, const std::string& _cpu, u32 flags, std::function symbols_cement) noexcept - : m_context(new llvm::LLVMContext) - , m_cpu(cpu(_cpu)) + : m_context(new llvm::LLVMContext), m_cpu(cpu(_cpu)) { [[maybe_unused]] static const bool s_install_llvm_error_handler = []() { llvm::remove_fatal_error_handler(); llvm::install_fatal_error_handler([](void*, const char* msg, bool) - { - const std::string_view out = msg ? msg : ""; - fmt::throw_exception("LLVM Emergency Exit Invoked: '%s'", out); - }, nullptr); + { + const std::string_view out = msg ? msg : ""; + fmt::throw_exception("LLVM Emergency Exit Invoked: '%s'", out); + }, + nullptr); return true; }(); std::string result; - auto null_mod = std::make_unique ("null_", *m_context); + auto null_mod = std::make_unique("null_", *m_context); null_mod->setTargetTriple(jit_compiler::triple1()); std::unique_ptr mem; @@ -682,17 +682,17 @@ jit_compiler::jit_compiler(const std::unordered_map& _link, co { m_engine.reset(llvm::EngineBuilder(std::move(null_mod)) - .setErrorStr(&result) - .setEngineKind(llvm::EngineKind::JIT) - .setMCJITMemoryManager(std::move(mem)) - .setOptLevel(llvm::CodeGenOptLevel::Aggressive) - .setCodeModel(flags & 0x2 ? llvm::CodeModel::Large : llvm::CodeModel::Small) + .setErrorStr(&result) + .setEngineKind(llvm::EngineKind::JIT) + .setMCJITMemoryManager(std::move(mem)) + .setOptLevel(llvm::CodeGenOptLevel::Aggressive) + .setCodeModel(flags & 0x2 ? llvm::CodeModel::Large : llvm::CodeModel::Small) #ifdef __APPLE__ - //.setCodeModel(llvm::CodeModel::Large) + //.setCodeModel(llvm::CodeModel::Large) #endif - .setRelocationModel(llvm::Reloc::Model::PIC_) - .setMCPU(m_cpu) - .create()); + .setRelocationModel(llvm::Reloc::Model::PIC_) + .setMCPU(m_cpu) + .create()); } if (!_link.empty()) @@ -824,7 +824,7 @@ u64 jit_compiler::get(const std::string& name) return m_engine->getGlobalValueAddress(name); } -const char * fallback_cpu_detection() +const char* fallback_cpu_detection() { #if defined(ARCH_X64) // If we got here we either have a very old and outdated CPU or a new CPU that has not been seen by LLVM yet. diff --git a/rpcs3/Utilities/LUrlParser.cpp b/rpcs3/Utilities/LUrlParser.cpp index a6be4b5a0..81ffecdd8 100644 --- a/rpcs3/Utilities/LUrlParser.cpp +++ b/rpcs3/Utilities/LUrlParser.cpp @@ -1,21 +1,21 @@ /* * Lightweight URL & URI parser (RFC 1738, RFC 3986) * https://github.com/corporateshark/LUrlParser - * + * * The MIT License (MIT) - * + * * Copyright (C) 2015 Sergey Kosarevsky (sk@linderdaum.com) - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -32,29 +32,38 @@ #include // check if the scheme name is valid -static bool IsSchemeValid( const std::string& SchemeName ) +static bool IsSchemeValid(const std::string& SchemeName) { return std::all_of(SchemeName.cbegin(), SchemeName.cend(), [](const auto& c) - { - return isalpha(c) || c == '+' || c == '-' || c == '.'; - }); + { + return isalpha(c) || c == '+' || c == '-' || c == '.'; + }); } -bool LUrlParser::clParseURL::GetPort( int* OutPort ) const +bool LUrlParser::clParseURL::GetPort(int* OutPort) const { - if ( !IsValid() ) { return false; } + if (!IsValid()) + { + return false; + } - const int Port = atoi( m_Port.c_str() ); + const int Port = atoi(m_Port.c_str()); - if ( Port <= 0 || Port > 65535 ) { return false; } + if (Port <= 0 || Port > 65535) + { + return false; + } - if ( OutPort ) { *OutPort = Port; } + if (OutPort) + { + *OutPort = Port; + } return true; } // based on RFC 1738 and RFC 3986 -LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL ) +LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL(const std::string& URL) { LUrlParser::clParseURL Result; @@ -68,26 +77,26 @@ LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL // try to read scheme { - const char* LocalString = strchr( CurrentString, ':' ); + const char* LocalString = strchr(CurrentString, ':'); - if ( !LocalString ) + if (!LocalString) { - return clParseURL( LUrlParserError_NoUrlCharacter ); + return clParseURL(LUrlParserError_NoUrlCharacter); } // save the scheme name - Result.m_Scheme = std::string( CurrentString, LocalString - CurrentString ); + Result.m_Scheme = std::string(CurrentString, LocalString - CurrentString); - if ( !IsSchemeValid( Result.m_Scheme ) ) + if (!IsSchemeValid(Result.m_Scheme)) { - return clParseURL( LUrlParserError_InvalidSchemeName ); + return clParseURL(LUrlParserError_InvalidSchemeName); } // scheme should be lowercase - std::transform( Result.m_Scheme.begin(), Result.m_Scheme.end(), Result.m_Scheme.begin(), ::tolower ); + std::transform(Result.m_Scheme.begin(), Result.m_Scheme.end(), Result.m_Scheme.begin(), ::tolower); // skip ':' - CurrentString = LocalString+1; + CurrentString = LocalString + 1; } /* @@ -96,23 +105,25 @@ LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL */ // skip "//" - if ( *CurrentString++ != '/' ) return clParseURL( LUrlParserError_NoDoubleSlash ); - if ( *CurrentString++ != '/' ) return clParseURL( LUrlParserError_NoDoubleSlash ); + if (*CurrentString++ != '/') + return clParseURL(LUrlParserError_NoDoubleSlash); + if (*CurrentString++ != '/') + return clParseURL(LUrlParserError_NoDoubleSlash); // check if the user name and password are specified bool bHasUserName = false; const char* LocalString = CurrentString; - while ( *LocalString ) + while (*LocalString) { - if ( *LocalString == '@' ) + if (*LocalString == '@') { // user name and password are specified bHasUserName = true; break; } - else if ( *LocalString == '/' ) + else if (*LocalString == '/') { // end of : specification bHasUserName = false; @@ -125,17 +136,18 @@ LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL // user name and password LocalString = CurrentString; - if ( bHasUserName ) + if (bHasUserName) { // read user name - while ( *LocalString && *LocalString != ':' && *LocalString != '@' ) LocalString++; + while (*LocalString && *LocalString != ':' && *LocalString != '@') + LocalString++; - Result.m_UserName = std::string( CurrentString, LocalString - CurrentString ); + Result.m_UserName = std::string(CurrentString, LocalString - CurrentString); // proceed with the current pointer CurrentString = LocalString; - if ( *CurrentString == ':' ) + if (*CurrentString == ':') { // skip ':' CurrentString++; @@ -143,36 +155,37 @@ LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL // read password LocalString = CurrentString; - while ( *LocalString && *LocalString != '@' ) LocalString++; + while (*LocalString && *LocalString != '@') + LocalString++; - Result.m_Password = std::string( CurrentString, LocalString - CurrentString ); + Result.m_Password = std::string(CurrentString, LocalString - CurrentString); CurrentString = LocalString; } // skip '@' - if ( *CurrentString != '@' ) + if (*CurrentString != '@') { - return clParseURL( LUrlParserError_NoAtSign ); + return clParseURL(LUrlParserError_NoAtSign); } CurrentString++; } - bool bHasBracket = ( *CurrentString == '[' ); + bool bHasBracket = (*CurrentString == '['); // go ahead, read the host name LocalString = CurrentString; - while ( *LocalString ) + while (*LocalString) { - if ( bHasBracket && *LocalString == ']' ) + if (bHasBracket && *LocalString == ']') { // end of IPv6 address LocalString++; break; } - else if ( !bHasBracket && ( *LocalString == ':' || *LocalString == '/' ) ) + else if (!bHasBracket && (*LocalString == ':' || *LocalString == '/')) { // port number is specified break; @@ -181,27 +194,28 @@ LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL LocalString++; } - Result.m_Host = std::string( CurrentString, LocalString - CurrentString ); + Result.m_Host = std::string(CurrentString, LocalString - CurrentString); CurrentString = LocalString; // is port number specified? - if ( *CurrentString == ':' ) + if (*CurrentString == ':') { CurrentString++; // read port number LocalString = CurrentString; - while ( *LocalString && *LocalString != '/' ) LocalString++; + while (*LocalString && *LocalString != '/') + LocalString++; - Result.m_Port = std::string( CurrentString, LocalString - CurrentString ); + Result.m_Port = std::string(CurrentString, LocalString - CurrentString); CurrentString = LocalString; } // end of string - if ( !*CurrentString ) + if (!*CurrentString) { Result.m_ErrorCode = LUrlParserError_Ok; @@ -209,9 +223,9 @@ LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL } // skip '/' - if ( *CurrentString != '/' ) + if (*CurrentString != '/') { - return clParseURL( LUrlParserError_NoSlash ); + return clParseURL(LUrlParserError_NoSlash); } CurrentString++; @@ -219,14 +233,15 @@ LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL // parse the path LocalString = CurrentString; - while ( *LocalString && *LocalString != '#' && *LocalString != '?' ) LocalString++; + while (*LocalString && *LocalString != '#' && *LocalString != '?') + LocalString++; - Result.m_Path = std::string( CurrentString, LocalString - CurrentString ); + Result.m_Path = std::string(CurrentString, LocalString - CurrentString); CurrentString = LocalString; // check for query - if ( *CurrentString == '?' ) + if (*CurrentString == '?') { // skip '?' CurrentString++; @@ -234,15 +249,16 @@ LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL // read query LocalString = CurrentString; - while ( *LocalString && *LocalString != '#' ) LocalString++; + while (*LocalString && *LocalString != '#') + LocalString++; - Result.m_Query = std::string( CurrentString, LocalString - CurrentString ); + Result.m_Query = std::string(CurrentString, LocalString - CurrentString); CurrentString = LocalString; } // check for fragment - if ( *CurrentString == '#' ) + if (*CurrentString == '#') { // skip '#' CurrentString++; @@ -250,9 +266,10 @@ LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL // read fragment LocalString = CurrentString; - while ( *LocalString ) LocalString++; + while (*LocalString) + LocalString++; - Result.m_Fragment = std::string( CurrentString, LocalString - CurrentString ); + Result.m_Fragment = std::string(CurrentString, LocalString - CurrentString); CurrentString = LocalString; } diff --git a/rpcs3/Utilities/LUrlParser.h b/rpcs3/Utilities/LUrlParser.h index 1947f1ef4..782546de8 100644 --- a/rpcs3/Utilities/LUrlParser.h +++ b/rpcs3/Utilities/LUrlParser.h @@ -57,22 +57,27 @@ namespace LUrlParser std::string m_Password{}; clParseURL() - : m_ErrorCode( LUrlParserError_Uninitialized ) - {} + : m_ErrorCode(LUrlParserError_Uninitialized) + { + } /// return 'true' if the parsing was successful - bool IsValid() const { return m_ErrorCode == LUrlParserError_Ok; } + bool IsValid() const + { + return m_ErrorCode == LUrlParserError_Ok; + } /// helper to convert the port number to int, return 'true' if the port is valid (within the 0..65535 range) - bool GetPort( int* OutPort ) const; + bool GetPort(int* OutPort) const; /// parse the URL - static clParseURL ParseURL( const std::string& URL ); + static clParseURL ParseURL(const std::string& URL); private: - explicit clParseURL( LUrlParserError ErrorCode ) - : m_ErrorCode( ErrorCode ) - {} + explicit clParseURL(LUrlParserError ErrorCode) + : m_ErrorCode(ErrorCode) + { + } }; } // namespace LUrlParser diff --git a/rpcs3/Utilities/StrFmt.cpp b/rpcs3/Utilities/StrFmt.cpp index 3b55ae386..9abca8cde 100644 --- a/rpcs3/Utilities/StrFmt.cpp +++ b/rpcs3/Utilities/StrFmt.cpp @@ -8,10 +8,11 @@ #include #include #include +#include #include "Thread.h" #ifdef _WIN32 -#include +#include #else #include #endif @@ -568,19 +569,18 @@ void fmt_class_string::format(std::string& out, u64 arg) if (std::string_view full_func{loc.function_name() ? loc.function_name() : ""}; !full_func.empty()) { // Remove useless disambiguators - std::string func = fmt::replace_all(std::string(full_func), { - {"struct ", ""}, - {"class ", ""}, - {"enum ", ""}, - {"typename ", ""}, + std::string func = fmt::replace_all(std::string(full_func), {{"struct ", ""}, + {"class ", ""}, + {"enum ", ""}, + {"typename ", ""}, #ifdef _MSC_VER - {"__cdecl ", ""}, + {"__cdecl ", ""}, #endif - {"unsigned long long", "ullong"}, - //{"unsigned long", "ulong"}, // ullong - {"unsigned int", "uint"}, - {"unsigned short", "ushort"}, - {"unsigned char", "uchar"}}); + {"unsigned long long", "ullong"}, + //{"unsigned long", "ulong"}, // ullong + {"unsigned int", "uint"}, + {"unsigned short", "ushort"}, + {"unsigned char", "uchar"}}); // Remove function argument signature for long names for (usz index = func.find_first_of('('); index != umax && func.size() >= 100u; index = func.find_first_of('(', index)) @@ -670,7 +670,7 @@ namespace fmt } struct cfmt_src; -} +} // namespace fmt // Temporary implementation struct fmt::cfmt_src @@ -713,14 +713,16 @@ struct fmt::cfmt_src usz type(usz extra) const { // Hack: use known function pointers to determine type -#define TYPE(type) \ - if (sup[extra].fmt_string == &fmt_class_string::format) return sizeof(type); +#define TYPE(type) \ + if (sup[extra].fmt_string == &fmt_class_string::format) \ + return sizeof(type); TYPE(int); TYPE(llong); TYPE(schar); TYPE(short); - if constexpr (std::is_signed_v) TYPE(char); + if constexpr (std::is_signed_v) + TYPE(char); TYPE(long); TYPE(s128); @@ -731,14 +733,14 @@ struct fmt::cfmt_src return 0; } - static constexpr usz size_char = 1; + static constexpr usz size_char = 1; static constexpr usz size_short = 2; - static constexpr usz size_int = 0; - static constexpr usz size_long = sizeof(ulong); + static constexpr usz size_int = 0; + static constexpr usz size_long = sizeof(ulong); static constexpr usz size_llong = sizeof(ullong); - static constexpr usz size_size = sizeof(usz); - static constexpr usz size_max = sizeof(std::uintmax_t); - static constexpr usz size_diff = sizeof(std::ptrdiff_t); + static constexpr usz size_size = sizeof(usz); + static constexpr usz size_max = sizeof(std::uintmax_t); + static constexpr usz size_diff = sizeof(std::ptrdiff_t); }; void fmt::raw_append(std::string& out, const char* fmt, const fmt_type_info* sup, const u64* args) noexcept @@ -806,7 +808,7 @@ std::vector fmt::split(std::string_view source, std::initializer_li continue; } - result.emplace_back(std::string(piece)); + result.emplace_back(piece); } if (result.empty() && !is_skip_empty) diff --git a/rpcs3/Utilities/StrFmt.h b/rpcs3/Utilities/StrFmt.h index 05d98fdfa..2a044f55e 100644 --- a/rpcs3/Utilities/StrFmt.h +++ b/rpcs3/Utilities/StrFmt.h @@ -7,7 +7,7 @@ namespace fmt { template - static std::string format(const CharT(&)[N], const Args&...); + static std::string format(const CharT (&)[N], const Args&...); #ifdef _WIN32 struct win_error @@ -20,7 +20,7 @@ namespace fmt std::string win_error_to_string(unsigned long error, void* module_handle = nullptr); std::string win_error_to_string(const win_error& error); #endif -} +} // namespace fmt template struct fmt_unveil @@ -146,7 +146,7 @@ struct fmt_class_string } // Enum -> string function type - using convert_t = const char*(*)(T value); + using convert_t = const char* (*)(T value); // Helper function (safely converts arg to enum value) static FORCE_INLINE SAFE_BUFFERS(void) format_enum(std::string& out, u64 arg, convert_t convert) @@ -250,11 +250,10 @@ struct fmt_class_string : fmt_class_string namespace fmt { template - concept StringConvertible = requires (T & t) - { + concept StringConvertible = requires(T& t) { { t.to_string() } -> std::convertible_to; }; -} +} // namespace fmt template struct fmt_class_string @@ -274,8 +273,8 @@ namespace fmt { // Both uchar and std::byte are allowed template - concept ByteArray = requires (T& t) { const_cast, std::byte, uchar>&>(std::data(t)[0]); }; -} + concept ByteArray = requires(T& t) { const_cast, std::byte, uchar>&>(std::data(t)[0]); }; +} // namespace fmt template struct fmt_class_string @@ -301,8 +300,7 @@ struct fmt_type_info template static constexpr fmt_type_info make() { - return fmt_type_info - { + return fmt_type_info{ &fmt_class_string::format, }; } @@ -310,7 +308,7 @@ struct fmt_type_info // Argument array type (each element generated via fmt_unveil<>) template -using fmt_args_t = const u64(&&)[sizeof...(Args) + 1]; +using fmt_args_t = const u64 (&&)[sizeof...(Args) + 1]; template using fmt_unveil_t = typename fmt_unveil::type; @@ -327,14 +325,12 @@ namespace fmt template base57(const T& arg) noexcept - : data(reinterpret_cast(std::addressof(arg))) - , size(sizeof(T)) + : data(reinterpret_cast(std::addressof(arg))), size(sizeof(T)) { } base57(const uchar* data, usz size) noexcept - : data(data) - , size(size) + : data(data), size(size) { } }; @@ -348,8 +344,7 @@ namespace fmt base57_result& operator=(base57_result&&) = default; explicit base57_result(usz size) noexcept - : base57(size ? new uchar[size] : nullptr, size) - , memory(const_cast(this->data)) + : base57(size ? new uchar[size] : nullptr, size), memory(const_cast(this->data)) { } @@ -364,14 +359,14 @@ namespace fmt // Formatting function template - FORCE_INLINE SAFE_BUFFERS(void) append(std::string& out, const CharT(&fmt)[N], const Args&... args) + FORCE_INLINE SAFE_BUFFERS(void) append(std::string& out, const CharT (&fmt)[N], const Args&... args) { raw_append(out, reinterpret_cast(fmt), type_info_v, fmt_args_t{fmt_unveil::get(args)...}); } // Formatting function template - FORCE_INLINE SAFE_BUFFERS(std::string) format(const CharT(&fmt)[N], const Args&... args) + FORCE_INLINE SAFE_BUFFERS(std::string) format(const CharT (&fmt)[N], const Args&... args) { std::string result; append(result, fmt, args...); @@ -385,9 +380,11 @@ namespace fmt template struct throw_exception { - struct args_break_t {}; + struct args_break_t + { + }; - [[noreturn]] FORCE_INLINE SAFE_BUFFERS() throw_exception(const CharT(&fmt)[N], const Args&... args, + [[noreturn]] FORCE_INLINE SAFE_BUFFERS() throw_exception(const CharT (&fmt)[N], const Args&... args, args_break_t = args_break_t{}, std::source_location src_loc = std::source_location::current()) { raw_throw_exception(src_loc, reinterpret_cast(fmt), type_info_v, fmt_args_t{fmt_unveil::get(args)...}); @@ -399,7 +396,7 @@ namespace fmt }; template - throw_exception(const CharT(&)[N], const Args&...) -> throw_exception; + throw_exception(const CharT (&)[N], const Args&...) -> throw_exception; // Helper template: pack format variables template @@ -412,8 +409,7 @@ namespace fmt // Store only references, unveil op is postponed tie(Arg&& arg, Args&&... args) noexcept - : arg(std::forward(arg)) - , next(std::forward(args)...) + : arg(std::forward(arg)), next(std::forward(args)...) { } @@ -445,7 +441,7 @@ namespace fmt // Ensure with formatting template - decltype(auto) ensure(T&& arg, const CharT(&fmt)[N], tie args, std::source_location src_loc = std::source_location::current()) noexcept + decltype(auto) ensure(T&& arg, const CharT (&fmt)[N], tie args, std::source_location src_loc = std::source_location::current()) noexcept { if (std::forward(arg)) [[likely]] { @@ -458,4 +454,4 @@ namespace fmt raw_throw_exception(src_loc, reinterpret_cast(fmt), type_info_v...>, +data); } -} +} // namespace fmt diff --git a/rpcs3/Utilities/StrUtil.h b/rpcs3/Utilities/StrUtil.h index 4614f6f62..47a03451e 100644 --- a/rpcs3/Utilities/StrUtil.h +++ b/rpcs3/Utilities/StrUtil.h @@ -96,8 +96,7 @@ namespace fmt return src; } - static inline - std::string replace_all(std::string src, const std::vector>& list) + static inline std::string replace_all(std::string src, const std::vector>& list) { for (usz pos = 0; pos < src.length(); ++pos) { @@ -138,7 +137,7 @@ namespace fmt std::string result; - auto it = source.begin(); + auto it = source.begin(); auto end = source.end(); for (--end; it != end; ++it) { @@ -164,7 +163,7 @@ namespace fmt if (first) { result = fmt::merge(v, separator); - first = false; + first = false; } else { @@ -211,4 +210,4 @@ namespace fmt return hash_type{}(str); } }; -} +} // namespace fmt diff --git a/rpcs3/Utilities/Thread.cpp b/rpcs3/Utilities/Thread.cpp index 34e95b438..32ece914e 100644 --- a/rpcs3/Utilities/Thread.cpp +++ b/rpcs3/Utilities/Thread.cpp @@ -16,7 +16,7 @@ #endif #ifdef _WIN32 -#include +#include #include #include #include @@ -56,34 +56,34 @@ DYNAMIC_IMPORT_RENAME("Kernel32.dll", SetThreadDescriptionImport, "SetThreadDesc #endif #if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -# include -# include -# if defined(__DragonFly__) || defined(__FreeBSD__) -# include -# endif -# if defined(__OpenBSD__) -# include -# include -# endif +#include +#include +#if defined(__DragonFly__) || defined(__FreeBSD__) +#include +#endif +#if defined(__OpenBSD__) +#include +#include +#endif -# if defined(__NetBSD__) -# undef KERN_PROC -# define KERN_PROC KERN_PROC2 -# define kinfo_proc kinfo_proc2 -# endif +#if defined(__NetBSD__) +#undef KERN_PROC +#define KERN_PROC KERN_PROC2 +#define kinfo_proc kinfo_proc2 +#endif -# if defined(__APPLE__) -# define KP_FLAGS kp_proc.p_flag -# elif defined(__DragonFly__) -# define KP_FLAGS kp_flags -# elif defined(__FreeBSD__) -# define KP_FLAGS ki_flag -# elif defined(__NetBSD__) -# define KP_FLAGS p_flag -# elif defined(__OpenBSD__) -# define KP_FLAGS p_psflags -# define P_TRACED PS_TRACED -# endif +#if defined(__APPLE__) +#define KP_FLAGS kp_proc.p_flag +#elif defined(__DragonFly__) +#define KP_FLAGS kp_flags +#elif defined(__FreeBSD__) +#define KP_FLAGS ki_flag +#elif defined(__NetBSD__) +#define KP_FLAGS p_flag +#elif defined(__OpenBSD__) +#define KP_FLAGS p_psflags +#define P_TRACED PS_TRACED +#endif #endif #include "util/vm.hpp" @@ -104,27 +104,29 @@ thread_local u64 g_tls_fault_spu = 0; thread_local u64 g_tls_wait_time = 0; thread_local u64 g_tls_wait_fail = 0; thread_local bool g_tls_access_violation_recovered = false; -extern thread_local std::string(*g_tls_log_prefix)(); +extern thread_local std::string (*g_tls_log_prefix)(); // Report error and call std::abort(), defined in main.cpp [[noreturn]] void report_fatal_error(std::string_view text, bool is_html = false, bool include_help_text = true); -enum cpu_threads_emulation_info_dump_t : u32 {}; +enum cpu_threads_emulation_info_dump_t : u32 +{ +}; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](thread_class value) - { - switch (value) { - case thread_class::general: return "General"; - case thread_class::ppu: return "PPU"; - case thread_class::spu: return "SPU"; - case thread_class::rsx: return "RSX"; - } - return unknown; - }); + switch (value) + { + case thread_class::general: return "General"; + case thread_class::ppu: return "PPU"; + case thread_class::spu: return "SPU"; + case thread_class::rsx: return "RSX"; + } + return unknown; + }); } std::string dump_useful_thread_info() @@ -148,10 +150,10 @@ bool IsDebuggerPresent() KERN_PROC, KERN_PROC_PID, getpid(), -# if defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__NetBSD__) || defined(__OpenBSD__) sizeof(struct kinfo_proc), 1, -# endif +#endif }; u_int miblen = std::size(mib); struct kinfo_proc info; @@ -318,9 +320,9 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, usz enum : u8 { - LOCK = 0xf0, + LOCK = 0xf0, REPNE = 0xf2, - REPE = 0xf3, + REPE = 0xf3, }; // check prefixes: @@ -590,7 +592,7 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, usz { switch (get_modRM_reg(code, 0)) { - //case 0: out_op = X64OP_ADD; break; // TODO: strange info in instruction manual + // case 0: out_op = X64OP_ADD; break; // TODO: strange info in instruction manual case 1: out_op = X64OP_OR; break; case 2: out_op = X64OP_ADC; break; case 3: out_op = X64OP_SBB; break; @@ -758,7 +760,7 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, usz const u8 opx = op1 == 0xc5 ? op2 : op3; // Implied prefixes - rex |= op2 & 0x80 ? 0 : 0x4; // REX.R + rex |= op2 & 0x80 ? 0 : 0x4; // REX.R rex |= op1 == 0xc4 && op3 & 0x80 ? 0x8 : 0; // REX.W ??? oso = (opx & 0x3) == 0x1; repe = (opx & 0x3) == 0x2; @@ -773,50 +775,52 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, usz s_tls_reg3 = x64_reg_t{vreg}; - if (vopm == 0x1) switch (vop1) // Implied leading byte 0x0F - { - case 0x11: - case 0x29: - { - if (!repe && !repne) // VMOVAPS/VMOVAPD/VMOVUPS/VMOVUPD mem,reg + if (vopm == 0x1) + switch (vop1) // Implied leading byte 0x0F { - out_op = X64OP_STORE; - out_reg = get_modRM_reg_xmm(code, rex); - out_size = vlen; - out_length += get_modRM_size(code); - return; - } - break; - } - case 0x7f: - { - if (repe || oso) // VMOVDQU/VMOVDQA mem,reg + case 0x11: + case 0x29: { - out_op = X64OP_STORE; - out_reg = get_modRM_reg_xmm(code, rex); - out_size = vlen; - out_length += get_modRM_size(code); - return; + if (!repe && !repne) // VMOVAPS/VMOVAPD/VMOVUPS/VMOVUPD mem,reg + { + out_op = X64OP_STORE; + out_reg = get_modRM_reg_xmm(code, rex); + out_size = vlen; + out_length += get_modRM_size(code); + return; + } + break; + } + case 0x7f: + { + if (repe || oso) // VMOVDQU/VMOVDQA mem,reg + { + out_op = X64OP_STORE; + out_reg = get_modRM_reg_xmm(code, rex); + out_size = vlen; + out_length += get_modRM_size(code); + return; + } + break; + } } - break; - } - } - if (vopm == 0x2) switch (vop1) // Implied leading bytes 0x0F 0x38 - { - case 0xf7: - { - if (!repe && !repne && vlen == 16) // BEXTR r32,mem,r32 + if (vopm == 0x2) + switch (vop1) // Implied leading bytes 0x0F 0x38 { - out_op = X64OP_BEXTR; - out_reg = get_modRM_reg_xmm(code, rex); - out_size = opx & 0x80 ? 8 : 4; - out_length += get_modRM_size(code); - return; + case 0xf7: + { + if (!repe && !repne && vlen == 16) // BEXTR r32,mem,r32 + { + out_op = X64OP_BEXTR; + out_reg = get_modRM_reg_xmm(code, rex); + out_size = opx & 0x80 ? 8 : 4; + out_length += get_modRM_size(code); + return; + } + break; + } } - break; - } - } break; } @@ -900,10 +904,10 @@ typedef ucontext_t x64_context; #define XMMREG(context, reg) (reinterpret_cast(&(context)->uc_mcontext->__fs.__fpu_xmm0.__xmm_reg[reg])) #define EFLAGS(context) ((context)->uc_mcontext->__ss.__rflags) -u64* darwin_x64reg(x64_context *context, int reg) +u64* darwin_x64reg(x64_context* context, int reg) { - auto *state = &context->uc_mcontext->__ss; - switch(reg) + auto* state = &context->uc_mcontext->__ss; + switch (reg) { case 0: return &state->__rax; case 1: return &state->__rcx; @@ -932,16 +936,16 @@ u64* darwin_x64reg(x64_context *context, int reg) #define X64REG(context, reg) (freebsd_x64reg(context, reg)) #ifdef __DragonFly__ -# define XMMREG(context, reg) (reinterpret_cast((reinterpret_cast(context)->uc_mcontext.mc_fpregs)->sv_xmm.sv_xmm[reg])) +#define XMMREG(context, reg) (reinterpret_cast((reinterpret_cast(context)->uc_mcontext.mc_fpregs)->sv_xmm.sv_xmm[reg])) #else -# define XMMREG(context, reg) (reinterpret_cast((reinterpret_cast(context)->uc_mcontext.mc_fpstate)->sv_xmm[reg])) +#define XMMREG(context, reg) (reinterpret_cast((reinterpret_cast(context)->uc_mcontext.mc_fpstate)->sv_xmm[reg])) #endif #define EFLAGS(context) ((context)->uc_mcontext.mc_rflags) -register_t* freebsd_x64reg(x64_context *context, int reg) +register_t* freebsd_x64reg(x64_context* context, int reg) { - auto *state = &context->uc_mcontext; - switch(reg) + auto* state = &context->uc_mcontext; + switch (reg) { case 0: return &state->mc_rax; case 1: return &state->mc_rcx; @@ -972,10 +976,10 @@ register_t* freebsd_x64reg(x64_context *context, int reg) #define XMMREG(context, reg) (reinterpret_cast((context)->sc_fpstate->fx_xmm[reg])) #define EFLAGS(context) ((context)->sc_rflags) -long* openbsd_x64reg(x64_context *context, int reg) +long* openbsd_x64reg(x64_context* context, int reg) { - auto *state = &context; - switch(reg) + auto* state = &context; + switch (reg) { case 0: return &state->sc_rax; case 1: return &state->sc_rcx; @@ -1003,10 +1007,9 @@ long* openbsd_x64reg(x64_context *context, int reg) #elif defined(__NetBSD__) static const decltype(_REG_RAX) reg_table[] = -{ - _REG_RAX, _REG_RCX, _REG_RDX, _REG_RBX, _REG_RSP, _REG_RBP, _REG_RSI, _REG_RDI, - _REG_R8, _REG_R9, _REG_R10, _REG_R11, _REG_R12, _REG_R13, _REG_R14, _REG_R15, _REG_RIP -}; + { + _REG_RAX, _REG_RCX, _REG_RDX, _REG_RBX, _REG_RSP, _REG_RBP, _REG_RSI, _REG_RDI, + _REG_R8, _REG_R9, _REG_R10, _REG_R11, _REG_R12, _REG_R13, _REG_R14, _REG_R15, _REG_RIP}; #define X64REG(context, reg) (&(context)->uc_mcontext.__gregs[reg_table[reg]]) #define XMM_sig(context, reg) (reinterpret_cast(((struct fxsave64*)(context)->uc_mcontext.__fpregs)->fx_xmm[reg])) @@ -1015,10 +1018,9 @@ static const decltype(_REG_RAX) reg_table[] = #else static const int reg_table[] = -{ - REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI, - REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP -}; + { + REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI, + REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP}; #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) #ifdef __sun @@ -1374,138 +1376,140 @@ bool handle_access_violation(u32 addr, bool is_writing, ucontext_t* context) noe } // check if address is RawSPU MMIO register - do if (addr - RAW_SPU_BASE_ADDR < (6 * RAW_SPU_OFFSET) && (addr % RAW_SPU_OFFSET) >= RAW_SPU_PROB_OFFSET) - { - auto thread = idm::get_unlocked>(spu_thread::find_raw_spu((addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET)); + do + if (addr - RAW_SPU_BASE_ADDR < (6 * RAW_SPU_OFFSET) && (addr % RAW_SPU_OFFSET) >= RAW_SPU_PROB_OFFSET) + { + auto thread = idm::get_unlocked>(spu_thread::find_raw_spu((addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET)); - if (!thread) - { - break; - } - - if (!a_size || !d_size || !i_size) - { - sig_log.error("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; - } - - if (a_size != 4) - { - // Might be unimplemented, such as writing MFC proxy EAL+EAH using 64-bit store - break; - } - - switch (op) - { - case X64OP_LOAD: - case X64OP_LOAD_BE: - case X64OP_LOAD_CMP: - case X64OP_LOAD_TEST: - { - u32 value; - if (is_writing || !thread->read_reg(addr, value)) + if (!thread) { + break; + } + + if (!a_size || !d_size || !i_size) + { + sig_log.error("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; } - if (op != X64OP_LOAD_BE) + if (a_size != 4) { + // Might be unimplemented, such as writing MFC proxy EAL+EAH using 64-bit store + break; + } + + switch (op) + { + case X64OP_LOAD: + case X64OP_LOAD_BE: + case X64OP_LOAD_CMP: + case X64OP_LOAD_TEST: + { + u32 value; + if (is_writing || !thread->read_reg(addr, value)) + { + return false; + } + + if (op != X64OP_LOAD_BE) + { + value = stx::se_storage::swap(value); + } + + if (op == X64OP_LOAD_CMP) + { + u64 rvalue; + if (!get_x64_reg_value(context, reg, d_size, i_size, rvalue) || !set_x64_cmp_flags(context, d_size, value, rvalue)) + { + return false; + } + + break; + } + + if (op == X64OP_LOAD_TEST) + { + u64 rvalue; + if (!get_x64_reg_value(context, reg, d_size, i_size, rvalue) || !set_x64_cmp_flags(context, d_size, value & rvalue, 0)) + { + return false; + } + + break; + } + + if (!put_x64_reg_value(context, reg, d_size, value)) + { + return false; + } + + break; + } + case X64OP_BEXTR: + { + u32 value; + if (is_writing || !thread->read_reg(addr, value)) + { + return false; + } + value = stx::se_storage::swap(value); - } - if (op == X64OP_LOAD_CMP) - { - u64 rvalue; - if (!get_x64_reg_value(context, reg, d_size, i_size, rvalue) || !set_x64_cmp_flags(context, d_size, value, rvalue)) + u64 ctrl; + if (!get_x64_reg_value(context, s_tls_reg3, d_size, i_size, ctrl)) + { + return false; + } + + u8 start = ctrl & 0xff; + u8 _len = (ctrl & 0xff00) >> 8; + if (_len > 32) + _len = 32; + if (start > 32) + start = 32; + value = (u64{value} >> start) & ~(u64{umax} << _len); + + if (!put_x64_reg_value(context, reg, d_size, value) || !set_x64_cmp_flags(context, d_size, value, 0)) { return false; } break; } - - if (op == X64OP_LOAD_TEST) + case X64OP_STORE: + case X64OP_STORE_BE: { - u64 rvalue; - if (!get_x64_reg_value(context, reg, d_size, i_size, rvalue) || !set_x64_cmp_flags(context, d_size, value & rvalue, 0)) + u64 reg_value; + if (!is_writing || !get_x64_reg_value(context, reg, d_size, i_size, reg_value)) + { + return false; + } + + u32 val32 = static_cast(reg_value); + if (!thread->write_reg(addr, op == X64OP_STORE ? stx::se_storage::swap(val32) : val32)) { return false; } break; } - - if (!put_x64_reg_value(context, reg, d_size, value)) + case X64OP_MOVS: // possibly, TODO + case X64OP_STOS: + default: { + sig_log.error("Invalid or unsupported operation (op=%d, reg=%d, d_size=%lld, i_size=%lld)", +op, +reg, d_size, i_size); + report_opcode(); return false; } + } - break; + // skip processed instruction + RIP(context) += i_size; + g_tls_fault_spu++; + return true; } - case X64OP_BEXTR: - { - u32 value; - if (is_writing || !thread->read_reg(addr, value)) - { - return false; - } - - value = stx::se_storage::swap(value); - - u64 ctrl; - if (!get_x64_reg_value(context, s_tls_reg3, d_size, i_size, ctrl)) - { - return false; - } - - u8 start = ctrl & 0xff; - u8 _len = (ctrl & 0xff00) >> 8; - if (_len > 32) - _len = 32; - if (start > 32) - start = 32; - value = (u64{value} >> start) & ~(u64{umax} << _len); - - if (!put_x64_reg_value(context, reg, d_size, value) || !set_x64_cmp_flags(context, d_size, value, 0)) - { - return false; - } - - break; - } - case X64OP_STORE: - case X64OP_STORE_BE: - { - u64 reg_value; - if (!is_writing || !get_x64_reg_value(context, reg, d_size, i_size, reg_value)) - { - return false; - } - - u32 val32 = static_cast(reg_value); - if (!thread->write_reg(addr, op == X64OP_STORE ? stx::se_storage::swap(val32) : val32)) - { - return false; - } - - break; - } - case X64OP_MOVS: // possibly, TODO - case X64OP_STOS: - default: - { - sig_log.error("Invalid or unsupported operation (op=%d, reg=%d, d_size=%lld, i_size=%lld)", +op, +reg, d_size, i_size); - report_opcode(); - return false; - } - } - - // skip processed instruction - RIP(context) += i_size; - g_tls_fault_spu++; - return true; - } while (0); + while (0); #else static_cast(context); #endif /* ARCH_ */ @@ -1578,8 +1582,8 @@ bool handle_access_violation(u32 addr, bool is_writing, ucontext_t* context) noe else if (auto spu = cpu->try_get()) { const u64 type = spu->get_type() == spu_type::threaded ? - SYS_MEMORY_PAGE_FAULT_TYPE_SPU_THREAD : - SYS_MEMORY_PAGE_FAULT_TYPE_RAW_SPU; + SYS_MEMORY_PAGE_FAULT_TYPE_SPU_THREAD : + SYS_MEMORY_PAGE_FAULT_TYPE_RAW_SPU; data2 = (type << 32) | spu->lv2_id; } @@ -1602,7 +1606,6 @@ bool handle_access_violation(u32 addr, bool is_writing, ucontext_t* context) noe } } - // Now, place the page fault event onto table so that other functions [sys_mmapper_free_address and pagefault recovery funcs etc] // know that this thread is page faulted and where. @@ -1843,12 +1846,12 @@ static LONG exception_handler(PEXCEPTION_POINTERS pExp) noexcept case EXCEPTION_INT_DIVIDE_BY_ZERO: case EXCEPTION_NONCONTINUABLE_EXCEPTION: case EXCEPTION_PRIV_INSTRUCTION: - //case EXCEPTION_STACK_OVERFLOW: - { - sys_log.notice("\n%s", dump_useful_thread_info()); - logs::listener::sync_all(); - break; - } + // case EXCEPTION_STACK_OVERFLOW: + { + sys_log.notice("\n%s", dump_useful_thread_info()); + logs::listener::sync_all(); + break; + } default: { break; @@ -1866,7 +1869,8 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept { const auto cause = pExp->ExceptionRecord->ExceptionInformation[0] == 8 ? "executing" : - pExp->ExceptionRecord->ExceptionInformation[0] == 1 ? "writing" : "reading"; + pExp->ExceptionRecord->ExceptionInformation[0] == 1 ? "writing" : + "reading"; fmt::append(msg, "Segfault %s location %p at %p.\n", cause, pExp->ExceptionRecord->ExceptionInformation[1], pExp->ExceptionRecord->ExceptionAddress); @@ -1916,7 +1920,7 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept fmt::append(msg, "Function address: %p (base+0x%x).\n", func_addr, rtf->BeginAddress); // Access UNWIND_INFO structure - //const auto uw = (u8*)(unwind_base + rtf->UnwindData); + // const auto uw = (u8*)(unwind_base + rtf->UnwindData); } for (HMODULE _module : modules) @@ -2014,19 +2018,19 @@ static void signal_handler(int /*sig*/, siginfo_t* info, void* uct) noexcept #else const u32 insn = is_executing ? 0 : *reinterpret_cast(RIP(context)); const bool is_writing = - (insn & 0xbfff0000) == 0x0c000000 || // STR , [, #] (store word with immediate offset) - (insn & 0xbfe00000) == 0x0c800000 || // STP , , [, #] (store pair of registers with immediate offset) - (insn & 0xbfdf0000) == 0x0d000000 || // STR , [, ] (store word with register offset) - (insn & 0xbfc00000) == 0x0d800000 || // STP , , [, ] (store pair of registers with register offset) - (insn & 0x3f400000) == 0x08000000 || // STR , [, #] (store SIMD/FP register with immediate offset) - (insn & 0x3bc00000) == 0x39000000 || // STR , [, #] (store word with immediate offset) - (insn & 0x3fc00000) == 0x3d800000 || // STR , [, ] (store SIMD/FP register with register offset) - (insn & 0x3bc00000) == 0x38000000 || // STR , [, ] (store word with register offset) - (insn & 0x3fe00000) == 0x3c800000 || // STUR , [, #] (store unprivileged register with immediate offset) - (insn & 0x3fe00000) == 0x3ca00000 || // STR , [, #] (store SIMD/FP register with immediate offset) - (insn & 0x3a400000) == 0x28000000 || // STP , , [, #] (store pair of registers with immediate offset) - (insn & 0xbf000000) == 0xad000000 || // STP , , [, #] (store SIMD/FP 128-bit register pair with immediate offset) - (insn & 0xbf000000) == 0x6d000000; // STP , , [, #] (store SIMD/FP 64-bit register pair with immediate offset) + (insn & 0xbfff0000) == 0x0c000000 || // STR , [, #] (store word with immediate offset) + (insn & 0xbfe00000) == 0x0c800000 || // STP , , [, #] (store pair of registers with immediate offset) + (insn & 0xbfdf0000) == 0x0d000000 || // STR , [, ] (store word with register offset) + (insn & 0xbfc00000) == 0x0d800000 || // STP , , [, ] (store pair of registers with register offset) + (insn & 0x3f400000) == 0x08000000 || // STR , [, #] (store SIMD/FP register with immediate offset) + (insn & 0x3bc00000) == 0x39000000 || // STR , [, #] (store word with immediate offset) + (insn & 0x3fc00000) == 0x3d800000 || // STR , [, ] (store SIMD/FP register with register offset) + (insn & 0x3bc00000) == 0x38000000 || // STR , [, ] (store word with register offset) + (insn & 0x3fe00000) == 0x3c800000 || // STUR , [, #] (store unprivileged register with immediate offset) + (insn & 0x3fe00000) == 0x3ca00000 || // STR , [, #] (store SIMD/FP register with immediate offset) + (insn & 0x3a400000) == 0x28000000 || // STP , , [, #] (store pair of registers with immediate offset) + (insn & 0xbf000000) == 0xad000000 || // STP , , [, #] (store SIMD/FP 128-bit register pair with immediate offset) + (insn & 0xbf000000) == 0x6d000000; // STP , , [, #] (store SIMD/FP 64-bit register pair with immediate offset) #endif #else @@ -2034,7 +2038,8 @@ static void signal_handler(int /*sig*/, siginfo_t* info, void* uct) noexcept #endif const u64 exec64 = (reinterpret_cast(info->si_addr) - reinterpret_cast(vm::g_exec_addr)) / 2; - const auto cause = is_executing ? "executing" : is_writing ? "writing" : "reading"; + const auto cause = is_executing ? "executing" : is_writing ? "writing" : + "reading"; if (auto [addr, ok] = vm::try_get_addr(info->si_addr); ok && !is_executing) { @@ -2144,15 +2149,15 @@ const bool s_exception_handler_set = []() -> bool const bool s_terminate_handler_set = []() -> bool { std::set_terminate([]() - { - if (IsDebuggerPresent()) { - logs::listener::sync_all(); - utils::trap(); - } + if (IsDebuggerPresent()) + { + logs::listener::sync_all(); + utils::trap(); + } - report_fatal_error("RPCS3 has abnormally terminated."); - }); + report_fatal_error("RPCS3 has abnormally terminated."); + }); return true; }(); @@ -2161,15 +2166,15 @@ thread_local DECLARE(thread_ctrl::g_tls_this_thread) = nullptr; thread_local DECLARE(thread_ctrl::g_tls_error_callback) = nullptr; -DECLARE(thread_ctrl::g_native_core_layout) { native_core_arrangement::undefined }; +DECLARE(thread_ctrl::g_native_core_layout){native_core_arrangement::undefined}; void thread_base::start() { m_sync.atomic_op([&](u32& v) - { - v &= ~static_cast(thread_state::mask); - v |= static_cast(thread_state::created); - }); + { + v &= ~static_cast(thread_state::mask); + v |= static_cast(thread_state::created); + }); #ifdef _WIN32 m_thread = ::_beginthreadex(nullptr, 0, entry_point, this, CREATE_SUSPENDED, nullptr); @@ -2206,18 +2211,18 @@ void thread_base::initialize(void (*error_cb)()) }; atomic_wait_engine::set_wait_callback([](const void*, u64 attempts, u64 stamp0) -> bool - { - if (attempts == umax) { - g_tls_wait_time += utils::get_tsc() - stamp0; - } - else if (attempts > 1) - { - g_tls_wait_fail += attempts - 1; - } + if (attempts == umax) + { + g_tls_wait_time += utils::get_tsc() - stamp0; + } + else if (attempts > 1) + { + g_tls_wait_fail += attempts - 1; + } - return true; - }); + return true; + }); set_name(thread_ctrl::get_name_cached()); } @@ -2241,22 +2246,23 @@ void thread_base::set_name(std::string name) }; // Set thread name for VS debugger - if (IsDebuggerPresent()) [&]() NEVER_INLINE - { - THREADNAME_INFO info; - info.dwType = 0x1000; - info.szName = name.c_str(); - info.dwThreadID = -1; - info.dwFlags = 0; + if (IsDebuggerPresent()) + [&]() NEVER_INLINE + { + THREADNAME_INFO info; + info.dwType = 0x1000; + info.szName = name.c_str(); + info.dwThreadID = -1; + info.dwFlags = 0; - __try - { - RaiseException(0x406D1388, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - } - }(); + __try + { + RaiseException(0x406D1388, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + } + }(); #endif #if defined(__APPLE__) @@ -2341,10 +2347,10 @@ u64 thread_base::finalize(thread_state result_state) noexcept // Set result state (errored or finalized) m_sync.fetch_op([&](u32& v) - { - v &= -4; - v |= static_cast(result_state); - }); + { + v &= -4; + v |= static_cast(result_state); + }); // Signal waiting threads m_sync.notify_all(); @@ -2361,7 +2367,10 @@ thread_base::native_entry thread_base::finalize(u64 _self) noexcept g_tls_wait_fail = 0; g_tls_access_violation_recovered = false; - g_tls_log_prefix = []() -> std::string { return {}; }; + g_tls_log_prefix = []() -> std::string + { + return {}; + }; if (_self == umax) { @@ -2378,42 +2387,42 @@ thread_base::native_entry thread_base::finalize(u64 _self) noexcept return nullptr; } -thread_base::native_entry thread_base::make_trampoline(u64(*entry)(thread_base* _base)) +thread_base::native_entry thread_base::make_trampoline(u64 (*entry)(thread_base* _base)) { return build_function_asm("", [&](native_asm& c, auto& args) - { - using namespace asmjit; + { + using namespace asmjit; #if defined(ARCH_X64) - Label _ret = c.newLabel(); - c.push(x86::rbp); - c.sub(x86::rsp, 0x20); + Label _ret = c.newLabel(); + c.push(x86::rbp); + c.sub(x86::rsp, 0x20); - // Call entry point (TODO: support for detached threads missing?) - c.call(entry); + // Call entry point (TODO: support for detached threads missing?) + c.call(entry); - // Call finalize, return if zero - c.mov(args[0], x86::rax); - c.call(static_cast(&finalize)); - c.test(x86::rax, x86::rax); - c.jz(_ret); + // Call finalize, return if zero + c.mov(args[0], x86::rax); + c.call(static_cast(&finalize)); + c.test(x86::rax, x86::rax); + c.jz(_ret); - // Otherwise, call it as an entry point with first arg = new current thread - c.mov(x86::rbp, x86::rax); - c.call(thread_ctrl::get_current); - c.mov(args[0], x86::rax); - c.add(x86::rsp, 0x28); - c.jmp(x86::rbp); + // Otherwise, call it as an entry point with first arg = new current thread + c.mov(x86::rbp, x86::rax); + c.call(thread_ctrl::get_current); + c.mov(args[0], x86::rax); + c.add(x86::rsp, 0x28); + c.jmp(x86::rbp); - c.bind(_ret); - c.add(x86::rsp, 0x28); - c.ret(); + c.bind(_ret); + c.add(x86::rsp, 0x28); + c.ret(); #else - UNUSED(c); - UNUSED(args); - UNUSED(entry); + UNUSED(c); + UNUSED(args); + UNUSED(entry); #endif - }); + }); } thread_state thread_ctrl::state() @@ -2516,7 +2525,6 @@ void thread_ctrl::wait_for(u64 usec, [[maybe_unused]] bool alert /* true */) list.wait(atomic_wait_timeout{usec <= 0xffff'ffff'ffff'ffff / 1000 ? usec * 1000 : 0xffff'ffff'ffff'ffff}); } - void thread_ctrl::wait_until(u64* wait_time, u64 add_time, u64 min_wait, bool update_to_current_time) { *wait_time = utils::add_saturate(*wait_time, add_time); @@ -2609,20 +2617,19 @@ std::string thread_ctrl::get_name_cached() if (!_this->m_tname.is_equal(name_cache)) [[unlikely]] { _this->m_tname.peek_op([&](const shared_ptr& ptr) - { - if (ptr != name_cache) { - name_cache = ptr; - } - }); + if (ptr != name_cache) + { + name_cache = ptr; + } + }); } return *name_cache; } thread_base::thread_base(native_entry entry, std::string name) noexcept - : entry_point(entry) - , m_tname(make_single_value(std::move(name))) + : entry_point(entry), m_tname(make_single_value(std::move(name))) { } @@ -2709,7 +2716,7 @@ u64 thread_base::get_cycles() if (ret == KERN_SUCCESS) { cycles = static_cast(info.user_time.seconds + info.system_time.seconds) * 1'000'000'000 + - static_cast(info.user_time.microseconds + info.system_time.microseconds) * 1'000; + static_cast(info.user_time.microseconds + info.system_time.microseconds) * 1'000; #else clockid_t _clock; struct timespec thread_time; @@ -2836,22 +2843,23 @@ void thread_base::exec() const u64 current_break = get_system_time() & -2; if (s_last_break.fetch_op([current_break](u64& v) - { - if (current_break >= (v & -2) && current_break - (v & -2) >= 20'000'000) - { - v = current_break; - return true; - } + { + if (current_break >= (v & -2) && current_break - (v & -2) >= 20'000'000) + { + v = current_break; + return true; + } - // Let's allow a single more thread to halt the debugger so the programmer sees the pattern - if (!(v & 1)) - { - v |= 1; - return true; - } + // Let's allow a single more thread to halt the debugger so the programmer sees the pattern + if (!(v & 1)) + { + v |= 1; + return true; + } - return false; - }).second) + return false; + }) + .second) { utils::trap(); } @@ -2913,7 +2921,7 @@ void thread_ctrl::detect_cpu_layout() std::vector buffer(buffer_size); if (!GetLogicalProcessorInformationEx(relationship, - reinterpret_cast(buffer.data()), &buffer_size)) + reinterpret_cast(buffer.data()), &buffer_size)) { sig_log.error("GetLogicalProcessorInformationEx failed (size=%u, error=%s)", buffer_size, fmt::win_error{GetLastError(), nullptr}); } @@ -2925,7 +2933,7 @@ void thread_ctrl::detect_cpu_layout() while (ptr < end) { - auto info = reinterpret_cast(ptr); + auto info = reinterpret_cast(ptr); if (info->Relationship == relationship && info->Processor.Flags == LTP_PC_SMT) { g_native_core_layout.store(native_core_arrangement::intel_ht); @@ -2945,16 +2953,15 @@ u64 thread_ctrl::get_affinity_mask(thread_class group) #ifdef ANDROID u64 mask = 0; thread_class affinities[] = - { - g_cfg.core.affinity.cpu0.get(), - g_cfg.core.affinity.cpu1.get(), - g_cfg.core.affinity.cpu2.get(), - g_cfg.core.affinity.cpu3.get(), - g_cfg.core.affinity.cpu4.get(), - g_cfg.core.affinity.cpu5.get(), - g_cfg.core.affinity.cpu6.get(), - g_cfg.core.affinity.cpu7.get() - }; + { + g_cfg.core.affinity.cpu0.get(), + g_cfg.core.affinity.cpu1.get(), + g_cfg.core.affinity.cpu2.get(), + g_cfg.core.affinity.cpu3.get(), + g_cfg.core.affinity.cpu4.get(), + g_cfg.core.affinity.cpu5.get(), + g_cfg.core.affinity.cpu6.get(), + g_cfg.core.affinity.cpu7.get()}; for (std::size_t i = 0; i < std::min(std::thread::hardware_concurrency(), std::size(affinities)); ++i) { @@ -3248,7 +3255,7 @@ void thread_ctrl::set_thread_affinity_mask(u64 mask) } #elif __APPLE__ // Supports only one core - thread_affinity_policy_data_t policy = { static_cast(std::countr_zero(mask)) }; + thread_affinity_policy_data_t policy = {static_cast(std::countr_zero(mask))}; thread_port_t mach_thread = pthread_mach_thread_np(pthread_self()); thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, reinterpret_cast(&policy), !mask ? 0 : 1); #elif (defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__)) diff --git a/rpcs3/Utilities/Thread.h b/rpcs3/Utilities/Thread.h index 52096a270..258bffcd3 100644 --- a/rpcs3/Utilities/Thread.h +++ b/rpcs3/Utilities/Thread.h @@ -27,8 +27,8 @@ enum class thread_state : u32 { created = 0, // Initial state aborting = 1, // The thread has been joined in the destructor or explicitly aborted - errored = 2, // Set after the emergency_exit call - finished = 3, // Final state, always set at the end of thread execution + errored = 2, // Set after the emergency_exit call + finished = 3, // Final state, always set at the end of thread execution mask = 3, destroying_context = 7, // Special value assigned to destroy data explicitly before the destructor }; @@ -46,7 +46,8 @@ struct result_storage using type = void; }; -template requires (!std::is_void_v>) +template + requires(!std::is_void_v>) struct result_storage { using T = std::invoke_result_t; @@ -81,8 +82,7 @@ struct result_storage }; template -concept NamedThreadName = requires (const T&) -{ +concept NamedThreadName = requires(const T&) { std::string(T::thread_name); }; @@ -96,7 +96,7 @@ class thread_future thread_future* prev{}; protected: - atomic_t exec{}; + atomic_t exec{}; atomic_t done{0}; @@ -122,7 +122,7 @@ public: #ifdef _WIN32 using native_entry = uint(__stdcall*)(void* arg); #else - using native_entry = void*(*)(void* arg); + using native_entry = void* (*)(void* arg); #endif const native_entry entry_point; @@ -161,7 +161,7 @@ private: static native_entry finalize(u64 _self) noexcept; // Make entry point - static native_entry make_trampoline(u64(*entry)(thread_base* _base)); + static native_entry make_trampoline(u64 (*entry)(thread_base* _base)); friend class thread_ctrl; @@ -201,7 +201,7 @@ class thread_ctrl final static thread_local thread_base* g_tls_this_thread; // Error handling details - static thread_local void(*g_tls_error_callback)(); + static thread_local void (*g_tls_error_callback)(); // Target cpu core layout static atomic_t g_native_core_layout; @@ -306,13 +306,20 @@ public: template static inline void wait_on(T& wait, U old, u64 usec = -1) { - wait_on_custom<1>([&](atomic_wait::list<3>& list) { list.template set<0>(wait, old); }, usec); + wait_on_custom<1>([&](atomic_wait::list<3>& list) + { + list.template set<0>(wait, old); + }, + usec); } template static inline void wait_on(T& wait) { - wait_on_custom<1>([&](atomic_wait::list<3>& list) { list.template set<0>(wait); }); + wait_on_custom<1>([&](atomic_wait::list<3>& list) + { + list.template set<0>(wait); + }); } // Exit. @@ -386,8 +393,7 @@ class thread_future_t : public thread_future, result_storage(args)...) - , m_func(std::forward(func)) + : m_args(std::forward(args)...), m_func(std::forward(func)) { thread_future::exec.raw() = +[](thread_base* tb, thread_future* tf) { @@ -472,13 +478,13 @@ class named_thread final : public Context, result_storage, thread_base u64 entry_point2() { thread::initialize([]() - { - if constexpr (!result::empty) { - // Construct using default constructor in the case of failure - static_cast(static_cast(thread_ctrl::get_current()))->init(); - } - }); + if constexpr (!result::empty) + { + // Construct using default constructor in the case of failure + static_cast(static_cast(thread_ctrl::get_current()))->init(); + } + }); if constexpr (result::empty) { @@ -527,37 +533,37 @@ class named_thread final : public Context, result_storage, thread_base public: // Forwarding constructor with default name (also potentially the default constructor) - template requires (std::is_constructible_v) && (!(std::is_same_v, stx::launch_retainer> || ...)) && (NamedThreadName) + template + requires(std::is_constructible_v) && (!(std::is_same_v, stx::launch_retainer> || ...)) && (NamedThreadName) named_thread(Args&&... args) noexcept - : Context(std::forward(args)...) - , thread(trampoline, std::string(Context::thread_name)) + : Context(std::forward(args)...), thread(trampoline, std::string(Context::thread_name)) { thread::start(); } // Forwarding constructor with default name, does not automatically run the thread - template requires (std::is_constructible_v) && (NamedThreadName) + template + requires(std::is_constructible_v) && (NamedThreadName) named_thread(const stx::launch_retainer&, Args&&... args) noexcept - : Context(std::forward(args)...) - , thread(trampoline, std::string(Context::thread_name)) + : Context(std::forward(args)...), thread(trampoline, std::string(Context::thread_name)) { // Create a stand-by thread context m_sync |= static_cast(thread_state::finished); } // Normal forwarding constructor - template requires (std::is_constructible_v) && (!NamedThreadName) + template + requires(std::is_constructible_v) && (!NamedThreadName) named_thread(std::string name, Args&&... args) noexcept - : Context(std::forward(args)...) - , thread(trampoline, std::move(name)) + : Context(std::forward(args)...), thread(trampoline, std::move(name)) { thread::start(); } // Lambda constructor, also the implicit deduction guide candidate - named_thread(std::string_view name, Context&& f) noexcept requires (!NamedThreadName) - : Context(std::forward(f)) - , thread(trampoline, std::string(name)) + named_thread(std::string_view name, Context&& f) noexcept + requires(!NamedThreadName) + : Context(std::forward(f)), thread(trampoline, std::string(name)) { thread::start(); } @@ -683,7 +689,11 @@ public: // Try to abort by assigning thread_state::aborting/finished // Join thread by thread_state::finished - if (s >= thread_state::aborting && thread::m_sync.fetch_op([](u32& v) { return !(v & 3) && (v |= 1); }).second) + if (s >= thread_state::aborting && thread::m_sync.fetch_op([](u32& v) + { + return !(v & 3) && (v |= 1); + }) + .second) { notify_sync = true; } @@ -747,8 +757,7 @@ class named_thread_group final public: // Lambda constructor, also the implicit deduction guide candidate named_thread_group(std::string_view name, u32 count, Context&& f) noexcept - : m_count(count) - , m_threads(nullptr) + : m_count(count), m_threads(nullptr) { if (count == 0) { @@ -771,8 +780,7 @@ public: // Constructor with a function performed before adding more threads template named_thread_group(std::string_view name, u32 count, Context&& f, CheckAndPrepare&& check) noexcept - : m_count(count) - , m_threads(nullptr) + : m_count(count), m_threads(nullptr) { if (count == 0) { @@ -812,8 +820,7 @@ public: // Default constructor named_thread_group(std::string_view name, u32 count) noexcept - : m_count(count) - , m_threads(nullptr) + : m_count(count), m_threads(nullptr) { if (count == 0) { @@ -840,7 +847,7 @@ public: for (u32 i = 0; i < m_count; i++) { - std::as_const(*std::launder(m_threads + i))(); + std::as_const (*std::launder(m_threads + i))(); if (std::as_const(*std::launder(m_threads + i)) != thread_state::finished) result = false; diff --git a/rpcs3/Utilities/address_range.h b/rpcs3/Utilities/address_range.h index 71fbd4a38..9e9359fed 100644 --- a/rpcs3/Utilities/address_range.h +++ b/rpcs3/Utilities/address_range.h @@ -33,7 +33,6 @@ namespace utils return (val & (get_page_size() - 1)) == 0; } - /** * Address Range utility class */ @@ -41,7 +40,7 @@ namespace utils { public: u32 start = umax; // First address in range - u32 end = 0; // Last address + u32 end = 0; // Last address private: // Helper constexprs @@ -105,7 +104,7 @@ namespace utils } // Overlapping checks - bool overlaps(const address_range &other) const + bool overlaps(const address_range& other) const { AUDIT(valid() && other.valid()); return range_overlaps(start, end, other.start, other.end); @@ -117,16 +116,16 @@ namespace utils return address_overlaps(addr, start, end); } - bool inside(const address_range &other) const + bool inside(const address_range& other) const { AUDIT(valid() && other.valid()); return range_inside_range(start, end, other.start, other.end); } - inline bool inside(const address_range_vector &vec) const; - inline bool overlaps(const address_range_vector &vec) const; + inline bool inside(const address_range_vector& vec) const; + inline bool overlaps(const address_range_vector& vec) const; - bool touches(const address_range &other) const + bool touches(const address_range& other) const { AUDIT(valid() && other.valid()); // returns true if there is overlap, or if sections are side-by-side @@ -134,7 +133,7 @@ namespace utils } // Utilities - s32 signed_distance(const address_range &other) const + s32 signed_distance(const address_range& other) const { if (touches(other)) { @@ -152,7 +151,7 @@ namespace utils return -static_cast(start - other.end - 1); } - u32 distance(const address_range &other) const + u32 distance(const address_range& other) const { if (touches(other)) { @@ -170,15 +169,14 @@ namespace utils return (start - other.end - 1); } - address_range get_min_max(const address_range &other) const + address_range get_min_max(const address_range& other) const { return { std::min(valid() ? start : umax, other.valid() ? other.start : umax), - std::max(valid() ? end : 0, other.valid() ? other.end : 0) - }; + std::max(valid() ? end : 0, other.valid() ? other.end : 0)}; } - void set_min_max(const address_range &other) + void set_min_max(const address_range& other) { *this = get_min_max(other); } @@ -191,7 +189,7 @@ namespace utils address_range to_page_range() const { AUDIT(valid()); - return { page_start(start), page_end(end) }; + return {page_start(start), page_end(end)}; } void page_align() @@ -202,17 +200,17 @@ namespace utils AUDIT(is_page_range()); } - address_range get_intersect(const address_range &clamp) const + address_range get_intersect(const address_range& clamp) const { if (!valid() || !clamp.valid()) { return {}; } - return { std::max(start, clamp.start), std::min(end, clamp.end) }; + return {std::max(start, clamp.start), std::min(end, clamp.end)}; } - void intersect(const address_range &clamp) + void intersect(const address_range& clamp) { if (!clamp.valid()) { @@ -238,7 +236,7 @@ namespace utils } // Comparison Operators - bool operator ==(const address_range& other) const + bool operator==(const address_range& other) const { return (start == other.start && end == other.end); } @@ -257,7 +255,6 @@ namespace utils return address_range::start_end(page_start(addr), page_end(addr)); } - /** * Address Range Vector utility class * @@ -276,20 +273,50 @@ namespace utils public: // Wrapped functions - inline void reserve(usz nr) { data.reserve(nr); } - inline void clear() { data.clear(); } - inline size_type size() const { return data.size(); } - inline bool empty() const { return data.empty(); } - inline address_range& operator[](size_type n) { return data[n]; } - inline const address_range& operator[](size_type n) const { return data[n]; } - inline iterator begin() { return data.begin(); } - inline const_iterator begin() const { return data.begin(); } - inline iterator end() { return data.end(); } - inline const_iterator end() const { return data.end(); } + inline void reserve(usz nr) + { + data.reserve(nr); + } + inline void clear() + { + data.clear(); + } + inline size_type size() const + { + return data.size(); + } + inline bool empty() const + { + return data.empty(); + } + inline address_range& operator[](size_type n) + { + return data[n]; + } + inline const address_range& operator[](size_type n) const + { + return data[n]; + } + inline iterator begin() + { + return data.begin(); + } + inline const_iterator begin() const + { + return data.begin(); + } + inline iterator end() + { + return data.end(); + } + inline const_iterator end() const + { + return data.end(); + } // Search for ranges that touch new_range. If found, merge instead of adding new_range. // When adding a new range, re-use invalid ranges whenever possible - void merge(const address_range &new_range) + void merge(const address_range& new_range) { // Note the case where we have // AAAA BBBB @@ -301,10 +328,10 @@ namespace utils return; } - address_range *found = nullptr; - address_range *invalid = nullptr; + address_range* found = nullptr; + address_range* invalid = nullptr; - for (auto &existing : data) + for (auto& existing : data) { if (!existing.valid()) { @@ -347,16 +374,16 @@ namespace utils AUDIT(check_consistency()); } - void merge(const address_range_vector &other) + void merge(const address_range_vector& other) { - for (const address_range &new_range : other) + for (const address_range& new_range : other) { merge(new_range); } } // Exclude a given range from data - void exclude(const address_range &exclusion) + void exclude(const address_range& exclusion) { // Note the case where we have // AAAAAAA @@ -371,13 +398,13 @@ namespace utils return; } - address_range *invalid = nullptr; // try to re-use an invalid range instead of calling push_back + address_range* invalid = nullptr; // try to re-use an invalid range instead of calling push_back // We use index access because we might have to push_back within the loop, which could invalidate the iterators size_type _size = data.size(); for (size_type n = 0; n < _size; ++n) { - address_range &existing = data[n]; + address_range& existing = data[n]; if (!existing.valid()) { @@ -393,7 +420,7 @@ namespace utils } const bool head_excluded = exclusion.overlaps(existing.start); // This section has its start inside excluded range - const bool tail_excluded = exclusion.overlaps(existing.end); // This section has its end inside excluded range + const bool tail_excluded = exclusion.overlaps(existing.end); // This section has its end inside excluded range if (head_excluded && tail_excluded) { @@ -438,9 +465,9 @@ namespace utils AUDIT(!overlaps(exclusion)); } - void exclude(const address_range_vector &other) + void exclude(const address_range_vector& other) { - for (const address_range &exclusion : other) + for (const address_range& exclusion : other) { exclude(exclusion); } @@ -454,7 +481,7 @@ namespace utils for (usz i = 0; i < _size; ++i) { - const auto &r1 = data[i]; + const auto& r1 = data[i]; if (!r1.valid()) { continue; @@ -462,7 +489,7 @@ namespace utils for (usz j = i + 1; j < _size; ++j) { - const auto &r2 = data[j]; + const auto& r2 = data[j]; if (!r2.valid()) { continue; @@ -478,25 +505,25 @@ namespace utils } // Test for overlap with a given range - bool overlaps(const address_range &range) const + bool overlaps(const address_range& range) const { return std::any_of(data.cbegin(), data.cend(), [&range](const address_range& cur) - { - return cur.valid() && cur.overlaps(range); - }); + { + return cur.valid() && cur.overlaps(range); + }); } // Test for overlap with a given address_range vector - bool overlaps(const address_range_vector &other) const + bool overlaps(const address_range_vector& other) const { - for (const address_range &rng1 : data) + for (const address_range& rng1 : data) { if (!rng1.valid()) { continue; } - for (const address_range &rng2 : other.data) + for (const address_range& rng2 : other.data) { if (!rng2.valid()) { @@ -513,39 +540,37 @@ namespace utils } // Test if a given range is fully contained inside this vector - bool contains(const address_range &range) const + bool contains(const address_range& range) const { return std::any_of(this->begin(), this->end(), [&range](const address_range& cur) - { - return cur.valid() && cur.inside(range); - }); + { + return cur.valid() && cur.inside(range); + }); } // Test if all ranges in this vector are full contained inside a specific range - bool inside(const address_range &range) const + bool inside(const address_range& range) const { return std::all_of(this->begin(), this->end(), [&range](const address_range& cur) - { - return !cur.valid() || cur.inside(range); - }); + { + return !cur.valid() || cur.inside(range); + }); } }; - // These declarations must be done after address_range_vector has been defined - bool address_range::inside(const address_range_vector &vec) const + bool address_range::inside(const address_range_vector& vec) const { return vec.contains(*this); } - bool address_range::overlaps(const address_range_vector &vec) const + bool address_range::overlaps(const address_range_vector& vec) const { return vec.overlaps(*this); } } // namespace utils - namespace std { static_assert(sizeof(usz) >= 2 * sizeof(u32), "usz must be at least twice the size of u32"); @@ -556,7 +581,7 @@ namespace std usz operator()(const utils::address_range& k) const { // we can guarantee a unique hash since our type is 64 bits and usz as well - return (usz{ k.start } << 32) | usz{ k.end }; + return (usz{k.start} << 32) | usz{k.end}; } }; -} +} // namespace std diff --git a/rpcs3/Utilities/bin_patch.cpp b/rpcs3/Utilities/bin_patch.cpp index 8d3fa1dee..70cff3c27 100644 --- a/rpcs3/Utilities/bin_patch.cpp +++ b/rpcs3/Utilities/bin_patch.cpp @@ -21,73 +21,73 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](YAML::NodeType::value value) - { - switch (value) { - case YAML::NodeType::Undefined: return "Undefined"; - case YAML::NodeType::Null: return "Null"; - case YAML::NodeType::Scalar: return "Scalar"; - case YAML::NodeType::Sequence: return "Sequence"; - case YAML::NodeType::Map: return "Map"; - } + switch (value) + { + case YAML::NodeType::Undefined: return "Undefined"; + case YAML::NodeType::Null: return "Null"; + case YAML::NodeType::Scalar: return "Scalar"; + case YAML::NodeType::Sequence: return "Sequence"; + case YAML::NodeType::Map: return "Map"; + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](patch_configurable_type value) - { - switch (value) { - case patch_configurable_type::double_range: return "double_range"; - case patch_configurable_type::double_enum: return "double_enum"; - case patch_configurable_type::long_range: return "long_range"; - case patch_configurable_type::long_enum: return "long_enum"; - } + switch (value) + { + case patch_configurable_type::double_range: return "double_range"; + case patch_configurable_type::double_enum: return "double_enum"; + case patch_configurable_type::long_range: return "long_range"; + case patch_configurable_type::long_enum: return "long_enum"; + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](patch_type value) - { - switch (value) { - case patch_type::invalid: return "invalid"; - case patch_type::alloc: return "alloc"; - case patch_type::code_alloc: return "calloc"; - case patch_type::jump: return "jump"; - case patch_type::jump_link: return "jumpl"; - case patch_type::jump_func: return "jumpf"; - case patch_type::load: return "load"; - case patch_type::byte: return "byte"; - case patch_type::le16: return "le16"; - case patch_type::le32: return "le32"; - case patch_type::le64: return "le64"; - case patch_type::bef32: return "bef32"; - case patch_type::bef64: return "bef64"; - case patch_type::be16: return "be16"; - case patch_type::be32: return "be32"; - case patch_type::bd32: return "bd32"; - case patch_type::be64: return "be64"; - case patch_type::bd64: return "bd64"; - case patch_type::lef32: return "lef32"; - case patch_type::lef64: return "lef64"; - case patch_type::bp_exec: return "bpex"; - case patch_type::utf8: return "utf8"; - case patch_type::c_utf8: return "cutf8"; - case patch_type::move_file: return "move_file"; - case patch_type::hide_file: return "hide_file"; - } + switch (value) + { + case patch_type::invalid: return "invalid"; + case patch_type::alloc: return "alloc"; + case patch_type::code_alloc: return "calloc"; + case patch_type::jump: return "jump"; + case patch_type::jump_link: return "jumpl"; + case patch_type::jump_func: return "jumpf"; + case patch_type::load: return "load"; + case patch_type::byte: return "byte"; + case patch_type::le16: return "le16"; + case patch_type::le32: return "le32"; + case patch_type::le64: return "le64"; + case patch_type::bef32: return "bef32"; + case patch_type::bef64: return "bef64"; + case patch_type::be16: return "be16"; + case patch_type::be32: return "be32"; + case patch_type::bd32: return "bd32"; + case patch_type::be64: return "be64"; + case patch_type::bd64: return "bd64"; + case patch_type::lef32: return "lef32"; + case patch_type::lef64: return "lef64"; + case patch_type::bp_exec: return "bpex"; + case patch_type::utf8: return "utf8"; + case patch_type::c_utf8: return "cutf8"; + case patch_type::move_file: return "move_file"; + case patch_type::hide_file: return "hide_file"; + } - return unknown; - }); + return unknown; + }); } void patch_engine::patch_config_value::set_and_check_value(f64 new_value, std::string_view name) @@ -97,7 +97,10 @@ void patch_engine::patch_config_value::set_and_check_value(f64 new_value, std::s case patch_configurable_type::double_enum: case patch_configurable_type::long_enum: { - if (std::none_of(allowed_values.begin(), allowed_values.end(), [&new_value](const patch_allowed_value& allowed_value){ return allowed_value.value == new_value; })) + if (std::none_of(allowed_values.begin(), allowed_values.end(), [&new_value](const patch_allowed_value& allowed_value) + { + return allowed_value.value == new_value; + })) { patch_log.error("Can't set configurable enumerated value '%s' to %f. Using default value %f", name, new_value, value); return; @@ -243,7 +246,7 @@ bool patch_engine::load(patch_map& patches_map, const std::string& path, std::st // Find or create an entry matching the key/hash in our map patch_container& container = patches_map[main_key]; - container.hash = main_key; + container.hash = main_key; container.version = version; // Go through each patch @@ -268,10 +271,10 @@ bool patch_engine::load(patch_map& patches_map, const std::string& path, std::st continue; } - struct patch_info info {}; + struct patch_info info{}; info.description = description; - info.hash = main_key; - info.version = version; + info.hash = main_key; + info.version = version; info.source_path = path; if (const auto games_node = patches_entry.second[patch_key::games]) @@ -329,7 +332,10 @@ bool patch_engine::load(patch_map& patches_map, const std::string& path, std::st is_valid = false; continue; } - else if (serial.size() != 9 || !std::all_of(serial.begin(), serial.end(), [](char c) { return std::isalnum(c); })) + else if (serial.size() != 9 || !std::all_of(serial.begin(), serial.end(), [](char c) + { + return std::isalnum(c); + })) { append_log_message(log_messages, fmt::format("Error: Serial '%s' invalid (patch: %s, key: %s, location: %s, file: %s)", serial, description, main_key, get_yaml_node_location(serial_node), path), &patch_log.error); is_valid = false; @@ -457,7 +463,7 @@ bool patch_engine::load(patch_map& patches_map, const std::string& path, std::st const std::string& str_type = config_value_type_node.Scalar(); bool is_valid_type = false; - for (patch_configurable_type type : { patch_configurable_type::double_range, patch_configurable_type::double_enum, patch_configurable_type::long_range, patch_configurable_type::long_enum }) + for (patch_configurable_type type : {patch_configurable_type::double_range, patch_configurable_type::double_enum, patch_configurable_type::long_range, patch_configurable_type::long_enum}) { if (str_type == fmt::format("%s", type)) { @@ -558,7 +564,10 @@ bool patch_engine::load(patch_map& patches_map, const std::string& path, std::st new_allowed_value.label = allowed_value.first.Scalar(); new_allowed_value.value = get_and_check_config_value(allowed_value.second); - if (std::any_of(config_value.allowed_values.begin(), config_value.allowed_values.end(), [&new_allowed_value](const patch_allowed_value& other){ return new_allowed_value.value == other.value || new_allowed_value.label == other.label; })) + if (std::any_of(config_value.allowed_values.begin(), config_value.allowed_values.end(), [&new_allowed_value](const patch_allowed_value& other) + { + return new_allowed_value.value == other.value || new_allowed_value.label == other.label; + })) { append_log_message(log_messages, fmt::format("Error: Skipping configurable allowed value. Another entry with the same label or value already exists. (patch: %s, key: %s, location: %s, file: %s)", description, main_key, get_yaml_node_location(allowed_value), path), &patch_log.error); is_valid = false; @@ -581,7 +590,10 @@ bool patch_engine::load(patch_map& patches_map, const std::string& path, std::st is_valid = false; } - if (std::none_of(config_value.allowed_values.begin(), config_value.allowed_values.end(), [&config_value](const patch_allowed_value& other){ return other.value == config_value.value; })) + if (std::none_of(config_value.allowed_values.begin(), config_value.allowed_values.end(), [&config_value](const patch_allowed_value& other) + { + return other.value == config_value.value; + })) { append_log_message(log_messages, fmt::format("Error: Configurable value was not found in allowed values (key: %s, location: %s, file: %s)", main_key, get_yaml_node_location(config_value_allowed_values_node), path), &patch_log.error); is_valid = false; @@ -643,7 +655,7 @@ bool patch_engine::load(patch_map& patches_map, const std::string& path, std::st if (!importing) { - patch_log.warning("A lower patch version was found ('%s' vs '%s') for %s: %s (in file %s)", existing_version, info.patch_version, main_key, description, container.patch_info_map[description].source_path); + patch_log.warning("A lower patch version was found ('%s' vs '%s') for %s: %s (in file %s)", existing_version, info.patch_version, main_key, description, container.patch_info_map[description].source_path); } } @@ -685,8 +697,8 @@ bool patch_engine::add_patch_data(YAML::Node node, patch_info& info, u32 modifie return false; } - const auto type_node = node[0]; - const auto addr_node = node[1]; + const auto type_node = node[0]; + const auto addr_node = node[1]; const auto value_node = node[2]; const auto type = get_patch_type(type_node); @@ -738,10 +750,10 @@ bool patch_engine::add_patch_data(YAML::Node node, patch_info& info, u32 modifie } patch_data p_data{}; - p_data.type = type; - p_data.offset = addr_node.as(0) + modifier; + p_data.type = type; + p_data.offset = addr_node.as(0) + modifier; p_data.original_offset = addr_node.Scalar(); - p_data.original_value = value_node.Scalar(); + p_data.original_value = value_node.Scalar(); const bool is_config_value = info.default_config_values.contains(p_data.original_value); const patch_config_value config_value = is_config_value ? ::at32(info.default_config_values, p_data.original_value) : patch_config_value{}; @@ -954,7 +966,8 @@ static usz apply_modification(std::vector& applied, patch_engine::patch_inf for (const patch_engine::patch_data& p : patch.data_list) { - if (p.type != patch_type::alloc) continue; + if (p.type != patch_type::alloc) + continue; // Do not allow null address or if resultant ptr is not a VM ptr if (const u32 alloc_at = (p.offset & -4096); alloc_at >> 16) @@ -1008,14 +1021,14 @@ static usz apply_modification(std::vector& applied, patch_engine::patch_inf // Revert in case of failure std::for_each(applied.begin() + old_applied_size, applied.end(), [&](u32 index) - { - const u32 addr = std::exchange(patch.data_list[index].alloc_addr, 0); + { + const u32 addr = std::exchange(patch.data_list[index].alloc_addr, 0); - vm::dealloc(addr); + vm::dealloc(addr); - auto alloc_map = vm::get(vm::any, addr); - unmap_vm_area(alloc_map); - }); + auto alloc_map = vm::get(vm::any, addr); + unmap_vm_area(alloc_map); + }); applied.resize(old_applied_size); return old_applied_size; @@ -1568,12 +1581,11 @@ void patch_engine::apply(std::vector& applied_total, const std::string& nam // Sort specific patches after global patches // So they will determine the end results const auto patch_super_list = - { - &patches_for_all_serials_and_all_versions, - &patches_for_all_serials_and_this_version, - &patches_for_this_serial_and_all_versions, - &patches_for_this_serial_and_this_version - }; + { + &patches_for_all_serials_and_all_versions, + &patches_for_all_serials_and_this_version, + &patches_for_this_serial_and_all_versions, + &patches_for_this_serial_and_this_version}; // Filter by patch group (reverse so specific patches will be prioritized over globals) for (auto it = std::rbegin(patch_super_list); it != std::rend(patch_super_list); it++) @@ -1790,11 +1802,16 @@ static void append_patches(patch_engine::patch_map& existing_patches, const patc } } - if (!new_info.patch_version.empty()) info.patch_version = new_info.patch_version; - if (!new_info.author.empty()) info.author = new_info.author; - if (!new_info.notes.empty()) info.notes = new_info.notes; - if (!new_info.data_list.empty()) info.data_list = new_info.data_list; - if (!new_info.source_path.empty()) info.source_path = new_info.source_path; + if (!new_info.patch_version.empty()) + info.patch_version = new_info.patch_version; + if (!new_info.author.empty()) + info.author = new_info.author; + if (!new_info.notes.empty()) + info.notes = new_info.notes; + if (!new_info.data_list.empty()) + info.data_list = new_info.data_list; + if (!new_info.source_path.empty()) + info.source_path = new_info.source_path; count++; } @@ -1850,10 +1867,14 @@ bool patch_engine::save_patches(const patch_map& patches, const std::string& pat out << YAML::EndMap; - if (!info.author.empty()) out << patch_key::author << info.author; - if (!info.patch_version.empty()) out << patch_key::patch_version << info.patch_version; - if (!info.patch_group.empty()) out << patch_key::group << info.patch_group; - if (!info.notes.empty()) out << patch_key::notes << info.notes; + if (!info.author.empty()) + out << patch_key::author << info.author; + if (!info.patch_version.empty()) + out << patch_key::patch_version << info.patch_version; + if (!info.patch_group.empty()) + out << patch_key::group << info.patch_group; + if (!info.notes.empty()) + out << patch_key::notes << info.notes; if (!info.default_config_values.empty()) { @@ -1964,7 +1985,7 @@ patch_engine::patch_map patch_engine::load_config() const std::string path = get_patch_config_path(); patch_log.notice("Loading patch config file %s", path); - if (fs::file f{ path }) + if (fs::file f{path}) { auto [root, error] = yaml_load(f.to_string()); diff --git a/rpcs3/Utilities/bin_patch.h b/rpcs3/Utilities/bin_patch.h index 1e06c5457..a95876f8c 100644 --- a/rpcs3/Utilities/bin_patch.h +++ b/rpcs3/Utilities/bin_patch.h @@ -26,7 +26,7 @@ namespace patch_key static const std::string min = "Min"; static const std::string max = "Max"; static const std::string allowed_values = "Allowed Values"; -} +} // namespace patch_key inline static const std::string patch_engine_version = "1.2"; @@ -34,11 +34,11 @@ enum class patch_type { invalid, load, - alloc, // Allocate memory at address (zeroized executable memory) - code_alloc,// Allocate memory somewhere, saves branch to memory at specfied address (filled with PPU NOP and branch for returning) - jump, // Install special 32-bit jump instruction (PPU only atm) - jump_link, // jump + set link (PPU only atm) - jump_func, // jump to exported function (PPU only, forever) + alloc, // Allocate memory at address (zeroized executable memory) + code_alloc, // Allocate memory somewhere, saves branch to memory at specfied address (filled with PPU NOP and branch for returning) + jump, // Install special 32-bit jump instruction (PPU only atm) + jump_link, // jump + set link (PPU only atm) + jump_func, // jump to exported function (PPU only, forever) byte, le16, le32, @@ -52,9 +52,9 @@ enum class patch_type bd64, // be64 with data hint (non-code) bef32, bef64, - bp_exec, // Execution Breakpoint - utf8, // Text of string (not null-terminated automatically) - c_utf8, // Text of string (null-terminated automatically) + bp_exec, // Execution Breakpoint + utf8, // Text of string (not null-terminated automatically) + c_utf8, // Text of string (null-terminated automatically) move_file, // Move file hide_file, // Hide file }; @@ -80,7 +80,7 @@ public: patch_type type = patch_type::load; u32 offset = 0; std::string original_offset{}; // Used for specifying paths - std::string original_value{}; // Used for import consistency (avoid rounding etc.) + std::string original_value{}; // Used for import consistency (avoid rounding etc.) union { u64 long_value; diff --git a/rpcs3/Utilities/bit_set.h b/rpcs3/Utilities/bit_set.h index 8b98ae0fd..a731b89e1 100644 --- a/rpcs3/Utilities/bit_set.h +++ b/rpcs3/Utilities/bit_set.h @@ -6,10 +6,10 @@ To enable bs_t<>, enum scope must contain `__bitset_enum_max` entry. enum class flagzz : u32 { - flag1, // Bit indices start from zero - flag2, + flag1, // Bit indices start from zero + flag2, - __bitset_enum_max // It must be the last value + __bitset_enum_max // It must be the last value }; This also enables helper operators for this enum type. @@ -26,8 +26,7 @@ Intersection (&) and symmetric difference (^) is also available. #include "Utilities/StrFmt.h" template -concept BitSetEnum = std::is_enum_v && requires(T x) -{ +concept BitSetEnum = std::is_enum_v && requires(T x) { T::__bitset_enum_max; }; @@ -91,56 +90,56 @@ public: } // Copy - constexpr bs_t operator +() const + constexpr bs_t operator+() const { return *this; } - constexpr bs_t& operator +=(bs_t rhs) + constexpr bs_t& operator+=(bs_t rhs) { m_data |= static_cast(rhs); return *this; } - constexpr bs_t& operator -=(bs_t rhs) + constexpr bs_t& operator-=(bs_t rhs) { m_data &= ~static_cast(rhs); return *this; } - constexpr bs_t& operator &=(bs_t rhs) + constexpr bs_t& operator&=(bs_t rhs) { m_data &= static_cast(rhs); return *this; } - constexpr bs_t& operator ^=(bs_t rhs) + constexpr bs_t& operator^=(bs_t rhs) { m_data ^= static_cast(rhs); return *this; } - friend constexpr bs_t operator +(bs_t lhs, bs_t rhs) + friend constexpr bs_t operator+(bs_t lhs, bs_t rhs) { return bs_t(0, lhs.m_data | rhs.m_data); } - friend constexpr bs_t operator -(bs_t lhs, bs_t rhs) + friend constexpr bs_t operator-(bs_t lhs, bs_t rhs) { return bs_t(0, lhs.m_data & ~rhs.m_data); } - friend constexpr bs_t operator &(bs_t lhs, bs_t rhs) + friend constexpr bs_t operator&(bs_t lhs, bs_t rhs) { return bs_t(0, lhs.m_data & rhs.m_data); } - friend constexpr bs_t operator ^(bs_t lhs, bs_t rhs) + friend constexpr bs_t operator^(bs_t lhs, bs_t rhs) { return bs_t(0, lhs.m_data ^ rhs.m_data); } - constexpr bool operator ==(bs_t rhs) const noexcept + constexpr bool operator==(bs_t rhs) const noexcept { return m_data == rhs.m_data; } @@ -179,63 +178,71 @@ public: // Unary '+' operator: promote plain enum value to bitset value template -constexpr bs_t operator +(T bit) +constexpr bs_t operator+(T bit) { return bs_t(bit); } // Binary '+' operator: bitset union -template requires (std::is_constructible_v, U>) -constexpr bs_t operator +(T lhs, const U& rhs) +template + requires(std::is_constructible_v, U>) +constexpr bs_t operator+(T lhs, const U& rhs) { return bs_t(lhs) + bs_t(rhs); } // Binary '+' operator: bitset union -template requires (std::is_constructible_v, U> && !std::is_enum_v) -constexpr bs_t operator +(const U& lhs, T rhs) +template + requires(std::is_constructible_v, U> && !std::is_enum_v) +constexpr bs_t operator+(const U& lhs, T rhs) { return bs_t(lhs) + bs_t(rhs); } // Binary '-' operator: bitset difference -template requires (std::is_constructible_v, U>) -constexpr bs_t operator -(T lhs, const U& rhs) +template + requires(std::is_constructible_v, U>) +constexpr bs_t operator-(T lhs, const U& rhs) { return bs_t(lhs) - bs_t(rhs); } // Binary '-' operator: bitset difference -template requires (std::is_constructible_v, U> && !std::is_enum_v) -constexpr bs_t operator -(const U& lhs, T rhs) +template + requires(std::is_constructible_v, U> && !std::is_enum_v) +constexpr bs_t operator-(const U& lhs, T rhs) { return bs_t(lhs) - bs_t(rhs); } // Binary '&' operator: bitset intersection -template requires (std::is_constructible_v, U>) -constexpr bs_t operator &(T lhs, const U& rhs) +template + requires(std::is_constructible_v, U>) +constexpr bs_t operator&(T lhs, const U& rhs) { return bs_t(lhs) & bs_t(rhs); } // Binary '&' operator: bitset intersection -template requires (std::is_constructible_v, U> && !std::is_enum_v) -constexpr bs_t operator &(const U& lhs, T rhs) +template + requires(std::is_constructible_v, U> && !std::is_enum_v) +constexpr bs_t operator&(const U& lhs, T rhs) { return bs_t(lhs) & bs_t(rhs); } // Binary '^' operator: bitset symmetric difference -template requires (std::is_constructible_v, U>) -constexpr bs_t operator ^(T lhs, const U& rhs) +template + requires(std::is_constructible_v, U>) +constexpr bs_t operator^(T lhs, const U& rhs) { return bs_t(lhs) ^ bs_t(rhs); } // Binary '^' operator: bitset symmetric difference -template requires (std::is_constructible_v, U> && !std::is_enum_v) -constexpr bs_t operator ^(const U& lhs, T rhs) +template + requires(std::is_constructible_v, U> && !std::is_enum_v) +constexpr bs_t operator^(const U& lhs, T rhs) { return bs_t(lhs) ^ bs_t(rhs); } @@ -261,7 +268,7 @@ public: atomic_bs_t(const atomic_bs_t&) = delete; - atomic_bs_t& operator =(const atomic_bs_t&) = delete; + atomic_bs_t& operator=(const atomic_bs_t&) = delete; explicit constexpr atomic_bs_t(bs_t value) : base(value) @@ -285,7 +292,7 @@ public: return static_cast(base::load()); } - bs_t operator +() const + bs_t operator+() const { return base::load(); } @@ -300,7 +307,7 @@ public: return bs_t(0, atomic_storage::or_fetch(m_data.m_data, rhs.m_data)); } - bs_t operator +=(const bs_t& rhs) + bs_t operator+=(const bs_t& rhs) { return add_fetch(rhs); } @@ -315,7 +322,7 @@ public: return bs_t(0, atomic_storage::and_fetch(m_data.m_data, ~rhs.m_data)); } - bs_t operator -=(const bs_t& rhs) + bs_t operator-=(const bs_t& rhs) { return sub_fetch(rhs); } @@ -330,7 +337,7 @@ public: return bs_t(0, atomic_storage::and_fetch(m_data.m_data, rhs.m_data)); } - bs_t operator &=(const bs_t& rhs) + bs_t operator&=(const bs_t& rhs) { return and_fetch(rhs); } @@ -345,14 +352,14 @@ public: return bs_t(0, atomic_storage::xor_fetch(m_data.m_data, rhs.m_data)); } - bs_t operator ^=(const bs_t& rhs) + bs_t operator^=(const bs_t& rhs) { return xor_fetch(rhs); } auto fetch_or(const bs_t&) = delete; auto or_fetch(const bs_t&) = delete; - auto operator |=(const bs_t&) = delete; + auto operator|=(const bs_t&) = delete; bool test_and_set(T rhs) { diff --git a/rpcs3/Utilities/cfmt.h b/rpcs3/Utilities/cfmt.h index 9d23c6f75..cca564c15 100644 --- a/rpcs3/Utilities/cfmt.h +++ b/rpcs3/Utilities/cfmt.h @@ -11,7 +11,7 @@ C-style format parser. Appends formatted string to `out`, returns number of char `fmt`: null-terminated string of `Char` type (char or constructible from char) `src`: rvalue reference to argument provider. */ -template +template usz cfmt_append(Dst& out, const Char* fmt, Src&& src) { ensure(fmt); @@ -22,8 +22,8 @@ usz cfmt_append(Dst& out, const Char* fmt, Src&& src) { usz size; // Size of current format sequence - u8 args; // Number of extra args used - u8 type; // Integral type bytesize + u8 args; // Number of extra args used + u8 type; // Integral type bytesize bool dot; // Precision enabled bool left; bool sign; @@ -114,8 +114,7 @@ usz cfmt_append(Dst& out, const Char* fmt, Src&& src) out.push_back(value % 10 + '0'); value /= 10; } - } - while (0 < --min_size || value); + } while (0 < --min_size || value); // Revert written characters for (usz i = start, j = out.size() - 1; i < j; i++, j--) @@ -125,584 +124,586 @@ usz cfmt_append(Dst& out, const Char* fmt, Src&& src) }; // Single pass over fmt string (null-terminated), TODO: check correct order - while (const Char ch = *fmt++) if (ctx.size == 0) - { - if (ch == '%') + while (const Char ch = *fmt++) + if (ctx.size == 0) { - ctx.size = 1; + if (ch == '%') + { + ctx.size = 1; + } + else + { + out.push_back(ch); + } } - else + else if (ctx.size == 1 && ch == '%') + { + ctx = {0}; + out.push_back(ch); + } + else if (ctx.size == umax) { out.push_back(ch); } - } - else if (ctx.size == 1 && ch == '%') - { - ctx = {0}; - out.push_back(ch); - } - else if (ctx.size == umax) - { - out.push_back(ch); - } - else switch (ctx.size++, ch) - { - case '-': ctx.left = true; break; - case '+': ctx.sign = true; break; - case ' ': ctx.space = true; break; - case '#': ctx.alter = true; break; - case '0': ctx.zeros = true; break; - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - { - if (ctx.width) [[unlikely]] - { - drop_sequence(); - } else - { - ctx.width = read_decimal(ch - '0'); - } + switch (ctx.size++, ch) + { + case '-': ctx.left = true; break; + case '+': ctx.sign = true; break; + case ' ': ctx.space = true; break; + case '#': ctx.alter = true; break; + case '0': ctx.zeros = true; break; - break; - } + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + if (ctx.width) [[unlikely]] + { + drop_sequence(); + } + else + { + ctx.width = read_decimal(ch - '0'); + } - case '*': - { - if (ctx.width || !src.test(ctx.args)) [[unlikely]] - { - drop_sequence(); - } - else - { - const int warg = src.template get(ctx.args++); - ctx.width = std::abs(warg); - ctx.left |= warg < 0; - } + break; + } - break; - } + case '*': + { + if (ctx.width || !src.test(ctx.args)) [[unlikely]] + { + drop_sequence(); + } + else + { + const int warg = src.template get(ctx.args++); + ctx.width = std::abs(warg); + ctx.left |= warg < 0; + } - case '.': - { - if (ctx.dot || ctx.prec) [[unlikely]] - { - drop_sequence(); - } - else if (*fmt >= '0' && *fmt <= '9') // TODO: does it allow '0'? - { - ctx.prec = read_decimal(0); - ctx.dot = true; - } - else if (*fmt == '*') - { - if (!src.test(ctx.args)) [[unlikely]] + break; + } + + case '.': + { + if (ctx.dot || ctx.prec) [[unlikely]] + { + drop_sequence(); + } + else if (*fmt >= '0' && *fmt <= '9') // TODO: does it allow '0'? + { + ctx.prec = read_decimal(0); + ctx.dot = true; + } + else if (*fmt == '*') + { + if (!src.test(ctx.args)) [[unlikely]] + { + drop_sequence(); + } + else + { + fmt++, ctx.size++; + const int parg = src.template get(ctx.args++); + ctx.prec = std::max(parg, 0); + ctx.dot = parg >= 0; + } + } + else + { + ctx.prec = 0; + ctx.dot = true; + } + + break; + } + + case 'h': + { + if (ctx.type) [[unlikely]] + { + drop_sequence(); + } + else if (fmt[0] == 'h') + { + fmt++, ctx.size++; + ctx.type = src.size_char; + } + else + { + ctx.type = src.size_short; + } + + break; + } + + case 'l': + { + if (ctx.type) [[unlikely]] + { + drop_sequence(); + } + else if (fmt[0] == 'l') + { + fmt++, ctx.size++; + ctx.type = src.size_llong; + } + else + { + ctx.type = src.size_long; + } + + break; + } + + case 'z': + { + if (ctx.type) [[unlikely]] + { + drop_sequence(); + } + else + { + ctx.type = src.size_size; + } + + break; + } + + case 'j': + { + if (ctx.type) [[unlikely]] + { + drop_sequence(); + } + else + { + ctx.type = src.size_max; + } + + break; + } + + case 't': + { + if (ctx.type) [[unlikely]] + { + drop_sequence(); + } + else + { + ctx.type = src.size_diff; + } + + break; + } + + case 'c': + { + if (ctx.type || !src.test(ctx.args)) [[unlikely]] + { + drop_sequence(); + break; + } + + const usz start = out.size(); + out.push_back(src.template get(ctx.args)); + + if (1 < ctx.width) + { + // Add spaces if necessary + out.insert(out.begin() + start + ctx.left, ctx.width - 1, ' '); + } + + src.skip(ctx.args); + ctx = {0}; + break; + } + + case 's': + { + if (ctx.type || !src.test(ctx.args)) [[unlikely]] + { + drop_sequence(); + break; + } + + const usz start = out.size(); + const usz size1 = src.fmt_string(out, ctx.args); + + if (ctx.dot && size1 > ctx.prec) + { + // Shrink if necessary + out.resize(start + ctx.prec); + } + + const usz size2 = out.size() - start; + + if (size2 < ctx.width) + { + // Add spaces if necessary + out.insert(ctx.left ? out.end() : out.begin() + start, ctx.width - size2, ' '); + } + + src.skip(ctx.args); + ctx = {0}; + break; + } + + case 'd': + case 'i': + { + if (!src.test(ctx.args)) [[unlikely]] + { + drop_sequence(); + break; + } + + const usz src_type = src.type(ctx.args); + + if (!ctx.type || src_type > 8) + { + ctx.type = static_cast(src_type); + + if (!ctx.type) + { + ctx.type = src.size_int; + } + } + + // Sign-extended argument expected + const u64 val = src.template get(ctx.args); + bool negative = ctx.type && ctx.type <= 8 && static_cast(val) < 0; + + if (ctx.type == 16) + { + u128 val2 = *reinterpret_cast(val); + negative = !!(val2 & (u128{1} << 127)); + } + + const usz start = out.size(); + + if (!ctx.dot || ctx.prec) + { + if (negative) + { + out.push_back('-'); + } + else if (ctx.sign) + { + out.push_back('+'); + } + else if (ctx.space) + { + out.push_back(' '); + } + + if (ctx.type >= 16) + { + u128 val2 = *reinterpret_cast(val); + write_decimal(negative ? u128{} - val2 : val2, ctx.prec); + } + else + { + write_decimal(negative ? u64{} - val : val, ctx.prec); + } + } + + const usz size2 = out.size() - start; + + if (size2 < ctx.width) + { + // Add padding if necessary + if (ctx.zeros && !ctx.left && !ctx.dot) + { + out.insert(out.begin() + start + (negative || ctx.sign || ctx.space), ctx.width - size2, '0'); + } + else + { + out.insert(ctx.left ? out.end() : out.begin() + start, ctx.width - size2, ' '); + } + } + + src.skip(ctx.args); + ctx = {0}; + break; + } + + case 'o': + { + if (!src.test(ctx.args)) [[unlikely]] + { + drop_sequence(); + break; + } + + const usz src_type = src.type(ctx.args); + + if (!ctx.type || src_type > 8) + { + ctx.type = static_cast(src_type); + + if (!ctx.type) + { + ctx.type = src.size_int; + } + } + + const u64 mask = + ctx.type == 1 ? 0xff : + ctx.type == 2 ? 0xffff : + ctx.type == 4 ? 0xffff'ffffu : + 0xffff'ffff'ffff'ffffu; + + // Trunc sign-extended signed types + const u64 val = src.template get(ctx.args) & mask; + + const usz start = out.size(); + + if (ctx.alter) + { + out.push_back('0'); + + if (ctx.prec) + { + ctx.prec--; + } + } + + if ((ctx.alter && val) || !ctx.dot || ctx.prec) + { + if (ctx.type >= 16) + { + u128 val2 = *reinterpret_cast(val); + write_octal(val2, ctx.prec); + } + else + { + write_octal(val, ctx.prec); + } + } + + const usz size2 = out.size() - start; + + if (size2 < ctx.width) + { + // Add padding if necessary + out.insert(ctx.left ? out.end() : out.begin() + start, ctx.width - size2, ctx.zeros && !ctx.left && !ctx.dot ? '0' : ' '); + } + + src.skip(ctx.args); + ctx = {0}; + break; + } + + case 'x': + case 'X': + { + if (!src.test(ctx.args)) [[unlikely]] + { + drop_sequence(); + break; + } + + const usz src_type = src.type(ctx.args); + + if (!ctx.type || src_type > 8) + { + ctx.type = static_cast(src_type); + + if (!ctx.type) + { + ctx.type = src.size_int; + } + } + + const u64 mask = + ctx.type == 1 ? 0xff : + ctx.type == 2 ? 0xffff : + ctx.type == 4 ? 0xffff'ffffu : + 0xffff'ffff'ffff'ffffu; + + // Trunc sign-extended signed types + const u64 val = src.template get(ctx.args) & mask; + + const usz start = out.size(); + + if (ctx.alter) + { + out.push_back('0'); + + if (val) + { + out.push_back(ch); // Prepend 0x or 0X + } + } + + if ((ctx.alter && val) || !ctx.dot || ctx.prec) + { + if (ctx.type >= 16) + { + u128 val2 = *reinterpret_cast(val); + write_hex(val2, ch == 'X', ctx.prec); + } + else + { + write_hex(val, ch == 'X', ctx.prec); + } + } + + const usz size2 = out.size() - start; + + if (size2 < ctx.width) + { + // Add padding if necessary + if (ctx.zeros && !ctx.left && !ctx.dot) + { + out.insert(out.begin() + start + (ctx.alter && val ? 2 : 0), ctx.width - size2, '0'); + } + else + { + out.insert(ctx.left ? out.end() : out.begin() + start, ctx.width - size2, ' '); + } + } + + src.skip(ctx.args); + ctx = {0}; + break; + } + + case 'u': + { + if (!src.test(ctx.args)) [[unlikely]] + { + drop_sequence(); + break; + } + + const usz src_type = src.type(ctx.args); + + if (!ctx.type || src_type > 8) + { + ctx.type = static_cast(src_type); + + if (!ctx.type) + { + ctx.type = src.size_int; + } + } + + const u64 mask = + ctx.type == 1 ? 0xff : + ctx.type == 2 ? 0xffff : + ctx.type == 4 ? 0xffff'ffffu : + 0xffff'ffff'ffff'ffffu; + + // Trunc sign-extended signed types + const u64 val = src.template get(ctx.args) & mask; + + const usz start = out.size(); + + if (!ctx.dot || ctx.prec) + { + if (ctx.type >= 16) + { + u128 val2 = *reinterpret_cast(val); + write_decimal(val2, ctx.prec); + } + else + { + write_decimal(val, ctx.prec); + } + } + + const usz size2 = out.size() - start; + + if (size2 < ctx.width) + { + // Add padding if necessary + out.insert(ctx.left ? out.end() : out.begin() + start, ctx.width - size2, ctx.zeros && !ctx.left && !ctx.dot ? '0' : ' '); + } + + src.skip(ctx.args); + ctx = {0}; + break; + } + + case 'p': + { + if (!src.test(ctx.args) || ctx.type) [[unlikely]] + { + drop_sequence(); + break; + } + + const u64 val = src.template get(ctx.args); + + const usz start = out.size(); + + write_hex(val, false, sizeof(void*) * 2); + + const usz size2 = out.size() - start; + + if (size2 < ctx.width) + { + // Add padding if necessary + out.insert(ctx.left ? out.end() : out.begin() + start, ctx.width - size2, ' '); + } + + src.skip(ctx.args); + ctx = {0}; + break; + } + + case 'f': + case 'F': + case 'e': + case 'E': + case 'a': + case 'A': + case 'g': + case 'G': + { + if (!src.test(ctx.args) || ctx.type) [[unlikely]] + { + drop_sequence(); + break; + } + + // Fallback (TODO) + + const std::string _fmt(fmt - ctx.size, fmt); + + const f64 arg0 = src.template get(0); + const u64 arg1 = ctx.args >= 1 ? src.template get(1) : 0; + const u64 arg2 = ctx.args >= 2 ? src.template get(2) : 0; + + if (const usz _size = std::snprintf(nullptr, 0, _fmt.c_str(), arg0, arg1, arg2)) + { + out.resize(out.size() + _size); + std::snprintf(&out.front() + out.size() - _size, _size + 1, _fmt.c_str(), arg0, arg1, arg2); + } + + src.skip(ctx.args); + ctx = {0}; + break; + } + + case 'L': // long double, not supported + case 'n': // writeback, not supported + default: { drop_sequence(); } - else - { - fmt++, ctx.size++; - const int parg = src.template get(ctx.args++); - ctx.prec = std::max(parg, 0); - ctx.dot = parg >= 0; } - } - else - { - ctx.prec = 0; - ctx.dot = true; - } - - break; - } - - case 'h': - { - if (ctx.type) [[unlikely]] - { - drop_sequence(); - } - else if (fmt[0] == 'h') - { - fmt++, ctx.size++; - ctx.type = src.size_char; - } - else - { - ctx.type = src.size_short; - } - - break; - } - - case 'l': - { - if (ctx.type) [[unlikely]] - { - drop_sequence(); - } - else if (fmt[0] == 'l') - { - fmt++, ctx.size++; - ctx.type = src.size_llong; - } - else - { - ctx.type = src.size_long; - } - - break; - } - - case 'z': - { - if (ctx.type) [[unlikely]] - { - drop_sequence(); - } - else - { - ctx.type = src.size_size; - } - - break; - } - - case 'j': - { - if (ctx.type) [[unlikely]] - { - drop_sequence(); - } - else - { - ctx.type = src.size_max; - } - - break; - } - - case 't': - { - if (ctx.type) [[unlikely]] - { - drop_sequence(); - } - else - { - ctx.type = src.size_diff; - } - - break; - } - - case 'c': - { - if (ctx.type || !src.test(ctx.args)) [[unlikely]] - { - drop_sequence(); - break; - } - - const usz start = out.size(); - out.push_back(src.template get(ctx.args)); - - if (1 < ctx.width) - { - // Add spaces if necessary - out.insert(out.begin() + start + ctx.left, ctx.width - 1, ' '); - } - - src.skip(ctx.args); - ctx = {0}; - break; - } - - case 's': - { - if (ctx.type || !src.test(ctx.args)) [[unlikely]] - { - drop_sequence(); - break; - } - - const usz start = out.size(); - const usz size1 = src.fmt_string(out, ctx.args); - - if (ctx.dot && size1 > ctx.prec) - { - // Shrink if necessary - out.resize(start + ctx.prec); - } - - const usz size2 = out.size() - start; - - if (size2 < ctx.width) - { - // Add spaces if necessary - out.insert(ctx.left ? out.end() : out.begin() + start, ctx.width - size2, ' '); - } - - src.skip(ctx.args); - ctx = {0}; - break; - } - - case 'd': - case 'i': - { - if (!src.test(ctx.args)) [[unlikely]] - { - drop_sequence(); - break; - } - - const usz src_type = src.type(ctx.args); - - if (!ctx.type || src_type > 8) - { - ctx.type = static_cast(src_type); - - if (!ctx.type) - { - ctx.type = src.size_int; - } - } - - // Sign-extended argument expected - const u64 val = src.template get(ctx.args); - bool negative = ctx.type && ctx.type <= 8 && static_cast(val) < 0; - - if (ctx.type == 16) - { - u128 val2 = *reinterpret_cast(val); - negative = !!(val2 & (u128{1} << 127)); - } - - const usz start = out.size(); - - if (!ctx.dot || ctx.prec) - { - if (negative) - { - out.push_back('-'); - } - else if (ctx.sign) - { - out.push_back('+'); - } - else if (ctx.space) - { - out.push_back(' '); - } - - if (ctx.type >= 16) - { - u128 val2 = *reinterpret_cast(val); - write_decimal(negative ? u128{} - val2 : val2, ctx.prec); - } - else - { - write_decimal(negative ? u64{} - val : val, ctx.prec); - } - } - - const usz size2 = out.size() - start; - - if (size2 < ctx.width) - { - // Add padding if necessary - if (ctx.zeros && !ctx.left && !ctx.dot) - { - out.insert(out.begin() + start + (negative || ctx.sign || ctx.space), ctx.width - size2, '0'); - } - else - { - out.insert(ctx.left ? out.end() : out.begin() + start, ctx.width - size2, ' '); - } - } - - src.skip(ctx.args); - ctx = {0}; - break; - } - - case 'o': - { - if (!src.test(ctx.args)) [[unlikely]] - { - drop_sequence(); - break; - } - - const usz src_type = src.type(ctx.args); - - if (!ctx.type || src_type > 8) - { - ctx.type = static_cast(src_type); - - if (!ctx.type) - { - ctx.type = src.size_int; - } - } - - const u64 mask = - ctx.type == 1 ? 0xff : - ctx.type == 2 ? 0xffff : - ctx.type == 4 ? 0xffff'ffffu : - 0xffff'ffff'ffff'ffffu; - - // Trunc sign-extended signed types - const u64 val = src.template get(ctx.args) & mask; - - const usz start = out.size(); - - if (ctx.alter) - { - out.push_back('0'); - - if (ctx.prec) - { - ctx.prec--; - } - } - - if ((ctx.alter && val) || !ctx.dot || ctx.prec) - { - if (ctx.type >= 16) - { - u128 val2 = *reinterpret_cast(val); - write_octal(val2, ctx.prec); - } - else - { - write_octal(val, ctx.prec); - } - } - - const usz size2 = out.size() - start; - - if (size2 < ctx.width) - { - // Add padding if necessary - out.insert(ctx.left ? out.end() : out.begin() + start, ctx.width - size2, ctx.zeros && !ctx.left && !ctx.dot ? '0' : ' '); - } - - src.skip(ctx.args); - ctx = {0}; - break; - } - - case 'x': - case 'X': - { - if (!src.test(ctx.args)) [[unlikely]] - { - drop_sequence(); - break; - } - - const usz src_type = src.type(ctx.args); - - if (!ctx.type || src_type > 8) - { - ctx.type = static_cast(src_type); - - if (!ctx.type) - { - ctx.type = src.size_int; - } - } - - const u64 mask = - ctx.type == 1 ? 0xff : - ctx.type == 2 ? 0xffff : - ctx.type == 4 ? 0xffff'ffffu : - 0xffff'ffff'ffff'ffffu; - - // Trunc sign-extended signed types - const u64 val = src.template get(ctx.args) & mask; - - const usz start = out.size(); - - if (ctx.alter) - { - out.push_back('0'); - - if (val) - { - out.push_back(ch); // Prepend 0x or 0X - } - } - - if ((ctx.alter && val) || !ctx.dot || ctx.prec) - { - if (ctx.type >= 16) - { - u128 val2 = *reinterpret_cast(val); - write_hex(val2, ch == 'X', ctx.prec); - } - else - { - write_hex(val, ch == 'X', ctx.prec); - } - } - - const usz size2 = out.size() - start; - - if (size2 < ctx.width) - { - // Add padding if necessary - if (ctx.zeros && !ctx.left && !ctx.dot) - { - out.insert(out.begin() + start + (ctx.alter && val ? 2 : 0), ctx.width - size2, '0'); - } - else - { - out.insert(ctx.left ? out.end() : out.begin() + start, ctx.width - size2, ' '); - } - } - - src.skip(ctx.args); - ctx = {0}; - break; - } - - case 'u': - { - if (!src.test(ctx.args)) [[unlikely]] - { - drop_sequence(); - break; - } - - const usz src_type = src.type(ctx.args); - - if (!ctx.type || src_type > 8) - { - ctx.type = static_cast(src_type); - - if (!ctx.type) - { - ctx.type = src.size_int; - } - } - - const u64 mask = - ctx.type == 1 ? 0xff : - ctx.type == 2 ? 0xffff : - ctx.type == 4 ? 0xffff'ffffu : - 0xffff'ffff'ffff'ffffu; - - // Trunc sign-extended signed types - const u64 val = src.template get(ctx.args) & mask; - - const usz start = out.size(); - - if (!ctx.dot || ctx.prec) - { - if (ctx.type >= 16) - { - u128 val2 = *reinterpret_cast(val); - write_decimal(val2, ctx.prec); - } - else - { - write_decimal(val, ctx.prec); - } - } - - const usz size2 = out.size() - start; - - if (size2 < ctx.width) - { - // Add padding if necessary - out.insert(ctx.left ? out.end() : out.begin() + start, ctx.width - size2, ctx.zeros && !ctx.left && !ctx.dot ? '0' : ' '); - } - - src.skip(ctx.args); - ctx = {0}; - break; - } - - case 'p': - { - if (!src.test(ctx.args) || ctx.type) [[unlikely]] - { - drop_sequence(); - break; - } - - const u64 val = src.template get(ctx.args); - - const usz start = out.size(); - - write_hex(val, false, sizeof(void*) * 2); - - const usz size2 = out.size() - start; - - if (size2 < ctx.width) - { - // Add padding if necessary - out.insert(ctx.left ? out.end() : out.begin() + start, ctx.width - size2, ' '); - } - - src.skip(ctx.args); - ctx = {0}; - break; - } - - case 'f': - case 'F': - case 'e': - case 'E': - case 'a': - case 'A': - case 'g': - case 'G': - { - if (!src.test(ctx.args) || ctx.type) [[unlikely]] - { - drop_sequence(); - break; - } - - // Fallback (TODO) - - const std::string _fmt(fmt - ctx.size, fmt); - - const f64 arg0 = src.template get(0); - const u64 arg1 = ctx.args >= 1 ? src.template get(1) : 0; - const u64 arg2 = ctx.args >= 2 ? src.template get(2) : 0; - - if (const usz _size = std::snprintf(nullptr, 0, _fmt.c_str(), arg0, arg1, arg2)) - { - out.resize(out.size() + _size); - std::snprintf(&out.front() + out.size() - _size, _size + 1, _fmt.c_str(), arg0, arg1, arg2); - } - - src.skip(ctx.args); - ctx = {0}; - break; - } - - case 'L': // long double, not supported - case 'n': // writeback, not supported - default: - { - drop_sequence(); - } - } // Handle unfinished sequence if (ctx.size && ctx.size != umax) diff --git a/rpcs3/Utilities/cheat_info.cpp b/rpcs3/Utilities/cheat_info.cpp index a16be2767..f84206787 100644 --- a/rpcs3/Utilities/cheat_info.cpp +++ b/rpcs3/Utilities/cheat_info.cpp @@ -8,23 +8,23 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](cheat_type value) - { - switch (value) { - case cheat_type::unsigned_8_cheat: return "Unsigned 8 bits"; - case cheat_type::unsigned_16_cheat: return "Unsigned 16 bits"; - case cheat_type::unsigned_32_cheat: return "Unsigned 32 bits"; - case cheat_type::unsigned_64_cheat: return "Unsigned 64 bits"; - case cheat_type::signed_8_cheat: return "Signed 8 bits"; - case cheat_type::signed_16_cheat: return "Signed 16 bits"; - case cheat_type::signed_32_cheat: return "Signed 32 bits"; - case cheat_type::signed_64_cheat: return "Signed 64 bits"; - case cheat_type::float_32_cheat: return "Float 32 bits"; - case cheat_type::max: break; - } + switch (value) + { + case cheat_type::unsigned_8_cheat: return "Unsigned 8 bits"; + case cheat_type::unsigned_16_cheat: return "Unsigned 16 bits"; + case cheat_type::unsigned_32_cheat: return "Unsigned 32 bits"; + case cheat_type::unsigned_64_cheat: return "Unsigned 64 bits"; + case cheat_type::signed_8_cheat: return "Signed 8 bits"; + case cheat_type::signed_16_cheat: return "Signed 16 bits"; + case cheat_type::signed_32_cheat: return "Signed 32 bits"; + case cheat_type::signed_64_cheat: return "Signed 64 bits"; + case cheat_type::float_32_cheat: return "Float 32 bits"; + case cheat_type::max: break; + } - return unknown; - }); + return unknown; + }); } bool cheat_info::from_str(const std::string& cheat_line) @@ -38,11 +38,11 @@ bool cheat_info::from_str(const std::string& cheat_line) return false; } - game = cheat_vec[0]; + game = cheat_vec[0]; description = cheat_vec[1]; - type = cheat_type{::narrow(val64)}; - offset = std::stoul(cheat_vec[3]); - red_script = cheat_vec[4]; + type = cheat_type{::narrow(val64)}; + offset = std::stoul(cheat_vec[3]); + red_script = cheat_vec[4]; return true; } diff --git a/rpcs3/Utilities/cond.cpp b/rpcs3/Utilities/cond.cpp index 425f74d80..13ca76871 100644 --- a/rpcs3/Utilities/cond.cpp +++ b/rpcs3/Utilities/cond.cpp @@ -12,31 +12,31 @@ void cond_variable::imp_wait(u32 _old, u64 _timeout) noexcept // Cleanup m_value.atomic_op([](u32& value) - { - // Remove waiter (c_waiter_mask) - value -= 1; - - if ((value & c_waiter_mask) == 0) { - // Last waiter removed, clean signals - value = 0; - } - }); + // Remove waiter (c_waiter_mask) + value -= 1; + + if ((value & c_waiter_mask) == 0) + { + // Last waiter removed, clean signals + value = 0; + } + }); } void cond_variable::imp_wake(u32 _count) noexcept { const auto [_old, ok] = m_value.fetch_op([](u32& value) - { - if (!value || (value & c_signal_mask) == c_signal_mask) { - return false; - } + if (!value || (value & c_signal_mask) == c_signal_mask) + { + return false; + } - // Add signal - value += c_signal_mask & (0 - c_signal_mask); - return true; - }); + // Add signal + value += c_signal_mask & (0 - c_signal_mask); + return true; + }); if (!ok || !_count) { diff --git a/rpcs3/Utilities/cond.h b/rpcs3/Utilities/cond.h index b0fbbbb37..1efc2de8c 100644 --- a/rpcs3/Utilities/cond.h +++ b/rpcs3/Utilities/cond.h @@ -20,17 +20,17 @@ protected: u32 add_waiter() noexcept { return m_value.atomic_op([](u32& value) -> u32 - { - if ((value & c_signal_mask) == c_signal_mask || (value & c_waiter_mask) == c_waiter_mask) { - // Signal or waiter overflow, return immediately - return 0; - } + if ((value & c_signal_mask) == c_signal_mask || (value & c_waiter_mask) == c_waiter_mask) + { + // Signal or waiter overflow, return immediately + return 0; + } - // Add waiter (c_waiter_mask) - value += 1; - return value; - }); + // Add waiter (c_waiter_mask) + value += 1; + return value; + }); } // Internal waiting function diff --git a/rpcs3/Utilities/date_time.h b/rpcs3/Utilities/date_time.h index e0cd1ad67..36bfcc79a 100644 --- a/rpcs3/Utilities/date_time.h +++ b/rpcs3/Utilities/date_time.h @@ -39,7 +39,7 @@ namespace date_time return str; } - template + template static inline std::string current_time_narrow() { char str[80]; @@ -47,7 +47,7 @@ namespace date_time std::string parse_buf; - if constexpr(separator != 0) + if constexpr (separator != 0) parse_buf = std::string("%Y") + separator + "%m" + separator + "%d" + separator + "%H" + separator + "%M" + separator + "%S"; else parse_buf = "%Y%m%d%H%M%S"; @@ -55,4 +55,4 @@ namespace date_time strftime(str, sizeof(str), parse_buf.c_str(), &now); return str; } -} +} // namespace date_time diff --git a/rpcs3/Utilities/geometry.h b/rpcs3/Utilities/geometry.h index faace6c77..f65756678 100644 --- a/rpcs3/Utilities/geometry.h +++ b/rpcs3/Utilities/geometry.h @@ -3,7 +3,7 @@ #include #include -template +template struct size2_base { T width, height; @@ -12,202 +12,202 @@ struct size2_base { } - constexpr size2_base(T width, T height) : width{ width }, height{ height } + constexpr size2_base(T width, T height) : width{width}, height{height} { } - constexpr size2_base operator -(const size2_base& rhs) const + constexpr size2_base operator-(const size2_base& rhs) const { - return{ width - rhs.width, height - rhs.height }; + return {width - rhs.width, height - rhs.height}; } - constexpr size2_base operator -(T rhs) const + constexpr size2_base operator-(T rhs) const { - return{ width - rhs, height - rhs }; + return {width - rhs, height - rhs}; } - constexpr size2_base operator +(const size2_base& rhs) const + constexpr size2_base operator+(const size2_base& rhs) const { - return{ width + rhs.width, height + rhs.height }; + return {width + rhs.width, height + rhs.height}; } - constexpr size2_base operator +(T rhs) const + constexpr size2_base operator+(T rhs) const { - return{ width + rhs, height + rhs }; + return {width + rhs, height + rhs}; } - constexpr size2_base operator /(const size2_base& rhs) const + constexpr size2_base operator/(const size2_base& rhs) const { - return{ width / rhs.width, height / rhs.height }; + return {width / rhs.width, height / rhs.height}; } - constexpr size2_base operator /(T rhs) const + constexpr size2_base operator/(T rhs) const { - return{ width / rhs, height / rhs }; + return {width / rhs, height / rhs}; } - constexpr size2_base operator *(const size2_base& rhs) const + constexpr size2_base operator*(const size2_base& rhs) const { - return{ width * rhs.width, height * rhs.height }; + return {width * rhs.width, height * rhs.height}; } - constexpr size2_base operator *(T rhs) const + constexpr size2_base operator*(T rhs) const { - return{ width * rhs, height * rhs }; + return {width * rhs, height * rhs}; } - size2_base& operator -=(const size2_base& rhs) + size2_base& operator-=(const size2_base& rhs) { width -= rhs.width; height -= rhs.height; return *this; } - size2_base& operator -=(T rhs) + size2_base& operator-=(T rhs) { width -= rhs; height -= rhs; return *this; } - size2_base& operator +=(const size2_base& rhs) + size2_base& operator+=(const size2_base& rhs) { width += rhs.width; height += rhs.height; return *this; } - size2_base& operator +=(T rhs) + size2_base& operator+=(T rhs) { width += rhs; height += rhs; return *this; } - size2_base& operator /=(const size2_base& rhs) + size2_base& operator/=(const size2_base& rhs) { width /= rhs.width; height /= rhs.height; return *this; } - size2_base& operator /=(T rhs) + size2_base& operator/=(T rhs) { width /= rhs; height /= rhs; return *this; } - size2_base& operator *=(const size2_base& rhs) + size2_base& operator*=(const size2_base& rhs) { width *= rhs.width; height *= rhs.height; return *this; } - size2_base& operator *=(T rhs) + size2_base& operator*=(T rhs) { width *= rhs; height *= rhs; return *this; } - constexpr bool operator ==(const size2_base& rhs) const + constexpr bool operator==(const size2_base& rhs) const { return width == rhs.width && height == rhs.height; } - template + template explicit constexpr operator size2_base() const { - return{ static_cast(width), static_cast(height) }; + return {static_cast(width), static_cast(height)}; } }; -template +template struct position1_base { T x; - position1_base operator -(const position1_base& rhs) const + position1_base operator-(const position1_base& rhs) const { - return{ x - rhs.x }; + return {x - rhs.x}; } - position1_base operator -(T rhs) const + position1_base operator-(T rhs) const { - return{ x - rhs }; + return {x - rhs}; } - position1_base operator +(const position1_base& rhs) const + position1_base operator+(const position1_base& rhs) const { - return{ x + rhs.x }; + return {x + rhs.x}; } - position1_base operator +(T rhs) const + position1_base operator+(T rhs) const { - return{ x + rhs }; + return {x + rhs}; } - template - position1_base operator *(RhsT rhs) const + template + position1_base operator*(RhsT rhs) const { - return{ static_cast(x * rhs) }; + return {static_cast(x * rhs)}; } - position1_base operator *(const position1_base& rhs) const + position1_base operator*(const position1_base& rhs) const { - return{ static_cast(x * rhs.x) }; + return {static_cast(x * rhs.x)}; } - template - position1_base operator /(RhsT rhs) const + template + position1_base operator/(RhsT rhs) const { - return{ x / rhs }; + return {x / rhs}; } - position1_base operator /(const position1_base& rhs) const + position1_base operator/(const position1_base& rhs) const { - return{ x / rhs.x }; + return {x / rhs.x}; } - position1_base& operator -=(const position1_base& rhs) + position1_base& operator-=(const position1_base& rhs) { x -= rhs.x; return *this; } - position1_base& operator -=(T rhs) + position1_base& operator-=(T rhs) { x -= rhs; return *this; } - position1_base& operator +=(const position1_base& rhs) + position1_base& operator+=(const position1_base& rhs) { x += rhs.x; return *this; } - position1_base& operator +=(T rhs) + position1_base& operator+=(T rhs) { x += rhs; return *this; } - template - position1_base& operator *=(RhsT rhs) const + template + position1_base& operator*=(RhsT rhs) const { x *= rhs; return *this; } - position1_base& operator *=(const position1_base& rhs) const + position1_base& operator*=(const position1_base& rhs) const { x *= rhs.x; return *this; } - template - position1_base& operator /=(RhsT rhs) const + template + position1_base& operator/=(RhsT rhs) const { x /= rhs; return *this; } - position1_base& operator /=(const position1_base& rhs) const + position1_base& operator/=(const position1_base& rhs) const { x /= rhs.x; return *this; } - bool operator ==(const position1_base& rhs) const + bool operator==(const position1_base& rhs) const { return x == rhs.x; } - bool operator ==(T rhs) const + bool operator==(T rhs) const { return x == rhs; } - template + template explicit operator position1_base() const { - return{ static_cast(x) }; + return {static_cast(x)}; } double distance(const position1_base& to) @@ -216,7 +216,7 @@ struct position1_base } }; -template +template struct position2_base { T x, y; @@ -225,148 +225,148 @@ struct position2_base { } - constexpr position2_base(T x, T y) : x{ x }, y{ y } + constexpr position2_base(T x, T y) : x{x}, y{y} { } - constexpr bool operator >(const position2_base& rhs) const + constexpr bool operator>(const position2_base& rhs) const { return x > rhs.x && y > rhs.y; } - constexpr bool operator >(T rhs) const + constexpr bool operator>(T rhs) const { return x > rhs && y > rhs; } - constexpr bool operator <(const position2_base& rhs) const + constexpr bool operator<(const position2_base& rhs) const { return x < rhs.x && y < rhs.y; } - constexpr bool operator <(T rhs) const + constexpr bool operator<(T rhs) const { return x < rhs && y < rhs; } - constexpr bool operator >=(const position2_base& rhs) const + constexpr bool operator>=(const position2_base& rhs) const { return x >= rhs.x && y >= rhs.y; } - constexpr bool operator >=(T rhs) const + constexpr bool operator>=(T rhs) const { return x >= rhs && y >= rhs; } - constexpr bool operator <=(const position2_base& rhs) const + constexpr bool operator<=(const position2_base& rhs) const { return x <= rhs.x && y <= rhs.y; } - constexpr bool operator <=(T rhs) const + constexpr bool operator<=(T rhs) const { return x <= rhs && y <= rhs; } - constexpr position2_base operator -(const position2_base& rhs) const + constexpr position2_base operator-(const position2_base& rhs) const { - return{ x - rhs.x, y - rhs.y }; + return {x - rhs.x, y - rhs.y}; } - constexpr position2_base operator -(T rhs) const + constexpr position2_base operator-(T rhs) const { - return{ x - rhs, y - rhs }; + return {x - rhs, y - rhs}; } - constexpr position2_base operator +(const position2_base& rhs) const + constexpr position2_base operator+(const position2_base& rhs) const { - return{ x + rhs.x, y + rhs.y }; + return {x + rhs.x, y + rhs.y}; } - constexpr position2_base operator +(T rhs) const + constexpr position2_base operator+(T rhs) const { - return{ x + rhs, y + rhs }; + return {x + rhs, y + rhs}; } - template - constexpr position2_base operator *(RhsT rhs) const + template + constexpr position2_base operator*(RhsT rhs) const { - return{ static_cast(x * rhs), static_cast(y * rhs) }; + return {static_cast(x * rhs), static_cast(y * rhs)}; } - constexpr position2_base operator *(const position2_base& rhs) const + constexpr position2_base operator*(const position2_base& rhs) const { - return{ static_cast(x * rhs.x), static_cast(y * rhs.y) }; + return {static_cast(x * rhs.x), static_cast(y * rhs.y)}; } - template - constexpr position2_base operator /(RhsT rhs) const + template + constexpr position2_base operator/(RhsT rhs) const { - return{ x / rhs, y / rhs }; + return {x / rhs, y / rhs}; } - constexpr position2_base operator /(const position2_base& rhs) const + constexpr position2_base operator/(const position2_base& rhs) const { - return{ x / rhs.x, y / rhs.y }; + return {x / rhs.x, y / rhs.y}; } - constexpr position2_base operator /(const size2_base& rhs) const + constexpr position2_base operator/(const size2_base& rhs) const { - return{ x / rhs.width, y / rhs.height }; + return {x / rhs.width, y / rhs.height}; } - position2_base& operator -=(const position2_base& rhs) + position2_base& operator-=(const position2_base& rhs) { x -= rhs.x; y -= rhs.y; return *this; } - position2_base& operator -=(T rhs) + position2_base& operator-=(T rhs) { x -= rhs; y -= rhs; return *this; } - position2_base& operator +=(const position2_base& rhs) + position2_base& operator+=(const position2_base& rhs) { x += rhs.x; y += rhs.y; return *this; } - position2_base& operator +=(T rhs) + position2_base& operator+=(T rhs) { x += rhs; y += rhs; return *this; } - template - position2_base& operator *=(RhsT rhs) + template + position2_base& operator*=(RhsT rhs) { x *= rhs; y *= rhs; return *this; } - position2_base& operator *=(const position2_base& rhs) + position2_base& operator*=(const position2_base& rhs) { x *= rhs.x; y *= rhs.y; return *this; } - template - position2_base& operator /=(RhsT rhs) + template + position2_base& operator/=(RhsT rhs) { x /= rhs; y /= rhs; return *this; } - position2_base& operator /=(const position2_base& rhs) + position2_base& operator/=(const position2_base& rhs) { x /= rhs.x; y /= rhs.y; return *this; } - constexpr bool operator ==(const position2_base& rhs) const + constexpr bool operator==(const position2_base& rhs) const { return x == rhs.x && y == rhs.y; } - constexpr bool operator ==(T rhs) const + constexpr bool operator==(T rhs) const { return x == rhs && y == rhs; } - template + template explicit constexpr operator position2_base() const { - return{ static_cast(x), static_cast(y) }; + return {static_cast(x), static_cast(y)}; } double distance(const position2_base& to) const @@ -375,7 +375,7 @@ struct position2_base } }; -template +template struct position3_base { T x, y, z; @@ -389,45 +389,45 @@ struct position3_base } */ - position3_base operator -(const position3_base& rhs) const + position3_base operator-(const position3_base& rhs) const { - return{ x - rhs.x, y - rhs.y, z - rhs.z }; + return {x - rhs.x, y - rhs.y, z - rhs.z}; } - position3_base operator -(T rhs) const + position3_base operator-(T rhs) const { - return{ x - rhs, y - rhs, z - rhs }; + return {x - rhs, y - rhs, z - rhs}; } - position3_base operator +(const position3_base& rhs) const + position3_base operator+(const position3_base& rhs) const { - return{ x + rhs.x, y + rhs.y, z + rhs.z }; + return {x + rhs.x, y + rhs.y, z + rhs.z}; } - position3_base operator +(T rhs) const + position3_base operator+(T rhs) const { - return{ x + rhs, y + rhs, z + rhs }; + return {x + rhs, y + rhs, z + rhs}; } - position3_base& operator -=(const position3_base& rhs) + position3_base& operator-=(const position3_base& rhs) { x -= rhs.x; y -= rhs.y; z -= rhs.z; return *this; } - position3_base& operator -=(T rhs) + position3_base& operator-=(T rhs) { x -= rhs; y -= rhs; z -= rhs; return *this; } - position3_base& operator +=(const position3_base& rhs) + position3_base& operator+=(const position3_base& rhs) { x += rhs.x; y += rhs.y; z += rhs.z; return *this; } - position3_base& operator +=(T rhs) + position3_base& operator+=(T rhs) { x += rhs; y += rhs; @@ -435,24 +435,24 @@ struct position3_base return *this; } - bool operator ==(const position3_base& rhs) const + bool operator==(const position3_base& rhs) const { return x == rhs.x && y == rhs.y && z == rhs.z; } - bool operator ==(T rhs) const + bool operator==(T rhs) const { return x == rhs && y == rhs && z == rhs; } - template + template explicit operator position3_base() const { - return{ static_cast(x), static_cast(y), static_cast(z) }; + return {static_cast(x), static_cast(y), static_cast(z)}; } }; -template +template struct position4_base { T x, y, z, w; @@ -461,28 +461,28 @@ struct position4_base { } - constexpr position4_base(T x, T y = {}, T z = {}, T w = { T(1) }) : x{ x }, y{ y }, z{ z }, w{ w } + constexpr position4_base(T x, T y = {}, T z = {}, T w = {T(1)}) : x{x}, y{y}, z{z}, w{w} { } - constexpr position4_base operator -(const position4_base& rhs) const + constexpr position4_base operator-(const position4_base& rhs) const { - return{ x - rhs.x, y - rhs.y, z - rhs.z, w - rhs.w }; + return {x - rhs.x, y - rhs.y, z - rhs.z, w - rhs.w}; } - constexpr position4_base operator -(T rhs) const + constexpr position4_base operator-(T rhs) const { - return{ x - rhs, y - rhs, z - rhs, w - rhs }; + return {x - rhs, y - rhs, z - rhs, w - rhs}; } - constexpr position4_base operator +(const position4_base& rhs) const + constexpr position4_base operator+(const position4_base& rhs) const { - return{ x + rhs.x, y + rhs.y, z + rhs.z, w + rhs.w }; + return {x + rhs.x, y + rhs.y, z + rhs.z, w + rhs.w}; } - constexpr position4_base operator +(T rhs) const + constexpr position4_base operator+(T rhs) const { - return{ x + rhs, y + rhs, z + rhs, w + rhs }; + return {x + rhs, y + rhs, z + rhs, w + rhs}; } - position4_base& operator -=(const position4_base& rhs) + position4_base& operator-=(const position4_base& rhs) { x -= rhs.x; y -= rhs.y; @@ -490,7 +490,7 @@ struct position4_base w -= rhs.w; return *this; } - position4_base& operator -=(T rhs) + position4_base& operator-=(T rhs) { x -= rhs; y -= rhs; @@ -498,7 +498,7 @@ struct position4_base w -= rhs; return *this; } - position4_base& operator +=(const position4_base& rhs) + position4_base& operator+=(const position4_base& rhs) { x += rhs.x; y += rhs.y; @@ -506,7 +506,7 @@ struct position4_base w += rhs.w; return *this; } - position4_base& operator +=(T rhs) + position4_base& operator+=(T rhs) { x += rhs; y += rhs; @@ -515,39 +515,45 @@ struct position4_base return *this; } - constexpr bool operator ==(const position4_base& rhs) const + constexpr bool operator==(const position4_base& rhs) const { return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w; } - constexpr bool operator ==(T rhs) const + constexpr bool operator==(T rhs) const { return x == rhs && y == rhs && z == rhs && w == rhs; } - template + template explicit constexpr operator position4_base() const { - return{ static_cast(x), static_cast(y), static_cast(z), static_cast(w) }; + return {static_cast(x), static_cast(y), static_cast(z), static_cast(w)}; } }; -template +template using position_base = position2_base; -template +template struct coord_base { union { position_base position; - struct { T x, y; }; + struct + { + T x, y; + }; }; union { size2_base size; - struct { T width, height; }; + struct + { + T width, height; + }; }; constexpr coord_base() : position{}, size{} @@ -555,12 +561,12 @@ struct coord_base } constexpr coord_base(const position_base& position, const size2_base& size) - : position{ position }, size{ size } + : position{position}, size{size} { } constexpr coord_base(T x, T y, T width, T height) - : x{ x }, y{ y }, width{ width }, height{ height } + : x{x}, y{y}, width{width}, height{height} { } @@ -575,19 +581,19 @@ struct coord_base return true; } - constexpr bool operator == (const coord_base& rhs) const + constexpr bool operator==(const coord_base& rhs) const { return position == rhs.position && size == rhs.size; } - template + template explicit constexpr operator coord_base() const { - return{ static_cast(x), static_cast(y), static_cast(width), static_cast(height) }; + return {static_cast(x), static_cast(y), static_cast(width), static_cast(height)}; } }; -template +template struct area_base { T x1, x2; @@ -597,18 +603,18 @@ struct area_base { } - constexpr area_base(T x1, T y1, T x2, T y2) : x1{ x1 }, x2{ x2 }, y1{ y1 }, y2{ y2 } + constexpr area_base(T x1, T y1, T x2, T y2) : x1{x1}, x2{x2}, y1{y1}, y2{y2} { } - template - constexpr area_base(const coord_base& coord) : x1{ T(coord.x) }, x2{ T(coord.x + coord.width) }, y1{ T(coord.y) }, y2{ T(coord.y + coord.height) } + template + constexpr area_base(const coord_base& coord) : x1{T(coord.x)}, x2{T(coord.x + coord.width)}, y1{T(coord.y)}, y2{T(coord.y + coord.height)} { } constexpr operator coord_base() const { - return{ x1, y1, x2 - x1, y2 - y1 }; + return {x1, y1, x2 - x1, y2 - y1}; } constexpr T width() const @@ -623,22 +629,26 @@ struct area_base void flip_vertical() { - T _y = y1; y1 = y2; y2 = _y; + T _y = y1; + y1 = y2; + y2 = _y; } void flip_horizontal() { - T _x = x1; x1 = x2; x2 = _x; + T _x = x1; + x1 = x2; + x2 = _x; } constexpr area_base flipped_vertical() const { - return{ x1, y2, x2, y1 }; + return {x1, y2, x2, y1}; } constexpr area_base flipped_horizontal() const { - return{ x2, y1, x1, y2 }; + return {x2, y1, x1, y2}; } constexpr bool is_flipped() const @@ -646,92 +656,100 @@ struct area_base return (x1 > x2 || y1 > y2); } - constexpr bool operator == (const area_base& rhs) const + constexpr bool operator==(const area_base& rhs) const { return x1 == rhs.x1 && x2 == rhs.x2 && y1 == rhs.y1 && y2 == rhs.y2; } - constexpr area_base operator - (const size2_base& size) const + constexpr area_base operator-(const size2_base& size) const { - return{ x1 - size.width, y1 - size.height, x2 - size.width, y2 - size.height }; + return {x1 - size.width, y1 - size.height, x2 - size.width, y2 - size.height}; } - constexpr area_base operator - (const T& value) const + constexpr area_base operator-(const T& value) const { - return{ x1 - value, y1 - value, x2 - value, y2 - value }; + return {x1 - value, y1 - value, x2 - value, y2 - value}; } - constexpr area_base operator + (const size2_base& size) const + constexpr area_base operator+(const size2_base& size) const { - return{ x1 + size.width, y1 + size.height, x2 + size.width, y2 + size.height }; + return {x1 + size.width, y1 + size.height, x2 + size.width, y2 + size.height}; } - constexpr area_base operator + (const T& value) const + constexpr area_base operator+(const T& value) const { - return{ x1 + value, y1 + value, x2 + value, y2 + value }; + return {x1 + value, y1 + value, x2 + value, y2 + value}; } - constexpr area_base operator / (const size2_base& size) const + constexpr area_base operator/(const size2_base& size) const { - return{ x1 / size.width, y1 / size.height, x2 / size.width, y2 / size.height }; + return {x1 / size.width, y1 / size.height, x2 / size.width, y2 / size.height}; } - template requires (std::is_arithmetic_v) - constexpr area_base operator / (const U& value) const + template + requires(std::is_arithmetic_v) + constexpr area_base operator/(const U& value) const { return area_base{static_cast(x1 / value), static_cast(y1 / value), static_cast(x2 / value), static_cast(y2 / value)}; } - constexpr area_base operator * (const size2_base& size) const + constexpr area_base operator*(const size2_base& size) const { - return{ x1 * size.width, y1 * size.height, x2 * size.width, y2 * size.height }; + return {x1 * size.width, y1 * size.height, x2 * size.width, y2 * size.height}; } - template requires (std::is_arithmetic_v) - constexpr area_base operator * (const U& value) const + template + requires(std::is_arithmetic_v) + constexpr area_base operator*(const U& value) const { return area_base{static_cast(x1 * value), static_cast(y1 * value), static_cast(x2 * value), static_cast(y2 * value)}; } - template + template explicit constexpr operator area_base() const { - return{ static_cast(x1), static_cast(y1), static_cast(x2), static_cast(y2) }; + return {static_cast(x1), static_cast(y1), static_cast(x2), static_cast(y2)}; } }; -template +template struct size3_base { T width, height, depth; - template + template explicit constexpr operator size3_base() const { - return{ static_cast(width), static_cast(height), static_cast(depth) }; + return {static_cast(width), static_cast(height), static_cast(depth)}; } }; -template +template struct coord3_base { union { position3_base position; - struct { T x, y, z; }; + struct + { + T x, y, z; + }; }; union { size3_base size; - struct { T width, height, depth; }; + struct + { + T width, height, depth; + }; }; constexpr coord3_base() : position{}, size{} { } - constexpr coord3_base(const position3_base& position, const size3_base& size) : position{ position }, size{ size } + constexpr coord3_base(const position3_base& position, const size3_base& size) : position{position}, size{size} { } - constexpr coord3_base(T x, T y, T z, T width, T height, T depth) : x{ x }, y{ y }, z{ z }, width{ width }, height{ height }, depth{ depth } + constexpr coord3_base(T x, T y, T z, T width, T height, T depth) : x{x}, y{y}, z{z}, width{width}, height{height}, depth{depth} { } @@ -749,15 +767,14 @@ struct coord3_base return true; } - template + template explicit constexpr operator coord3_base() const { - return{ static_cast(x), static_cast(y), static_cast(z), static_cast(width), static_cast(height), static_cast(depth) }; + return {static_cast(x), static_cast(y), static_cast(z), static_cast(width), static_cast(height), static_cast(depth)}; } }; - -template +template struct color4_base { union @@ -777,35 +794,26 @@ struct color4_base }; constexpr color4_base() - : x{ T{0} } - , y{ T{0} } - , z{ T{0} } - , w{ T(1) } + : x{T{0}}, y{T{0}}, z{T{0}}, w{T(1)} { } constexpr color4_base(T x, T y, T z, T w) - : x(x) - , y(y) - , z(z) - , w(w) + : x(x), y(y), z(z), w(w) { } constexpr color4_base(T value) - : x(value) - , y(value) - , z(value) - , w(value) + : x(value), y(value), z(value), w(value) { } - constexpr bool operator ==(const color4_base& rhs) const + constexpr bool operator==(const color4_base& rhs) const { return r == rhs.r && g == rhs.g && b == rhs.b && a == rhs.a; } - void operator *= (const color4_base& rhs) + void operator*=(const color4_base& rhs) { r *= rhs.r; g *= rhs.g; @@ -813,7 +821,7 @@ struct color4_base a *= rhs.a; } - void operator *= (const T& rhs) + void operator*=(const T& rhs) { r *= rhs; g *= rhs; @@ -821,29 +829,29 @@ struct color4_base a *= rhs; } - constexpr color4_base operator * (const color4_base& rhs) const + constexpr color4_base operator*(const color4_base& rhs) const { - return { r * rhs.r, g * rhs.g, b * rhs.b, a * rhs.a }; + return {r * rhs.r, g * rhs.g, b * rhs.b, a * rhs.a}; } - constexpr color4_base operator * (const T& rhs) const + constexpr color4_base operator*(const T& rhs) const { - return { r * rhs, g * rhs, b * rhs, a * rhs }; + return {r * rhs, g * rhs, b * rhs, a * rhs}; } - constexpr color4_base operator + (const color4_base& rhs) const + constexpr color4_base operator+(const color4_base& rhs) const { - return { r + rhs.r, g + rhs.g, b + rhs.b, a + rhs.a }; + return {r + rhs.r, g + rhs.g, b + rhs.b, a + rhs.a}; } - template + template explicit constexpr operator color4_base() const { - return{ static_cast(x), static_cast(y), static_cast(z), static_cast(w) }; + return {static_cast(x), static_cast(y), static_cast(z), static_cast(w)}; } }; -template +template struct color3_base { union @@ -863,25 +871,23 @@ struct color3_base }; constexpr color3_base(T x = {}, T y = {}, T z = {}) - : x(x) - , y(y) - , z(z) + : x(x), y(y), z(z) { } - constexpr bool operator ==(const color3_base& rhs) const + constexpr bool operator==(const color3_base& rhs) const { return r == rhs.r && g == rhs.g && b == rhs.b; } - template + template explicit constexpr operator color3_base() const { - return{ static_cast(x), static_cast(y), static_cast(z) }; + return {static_cast(x), static_cast(y), static_cast(z)}; } }; -template +template struct color2_base { union @@ -901,24 +907,23 @@ struct color2_base }; constexpr color2_base(T x = {}, T y = {}) - : x(x) - , y(y) + : x(x), y(y) { } - constexpr bool operator ==(const color2_base& rhs) const + constexpr bool operator==(const color2_base& rhs) const { return r == rhs.r && g == rhs.g; } - template + template explicit constexpr operator color2_base() const { - return{ static_cast(x), static_cast(y) }; + return {static_cast(x), static_cast(y)}; } }; -template +template struct color1_base { union @@ -932,19 +937,19 @@ struct color1_base { } - constexpr bool operator ==(const color1_base& rhs) const + constexpr bool operator==(const color1_base& rhs) const { return r == rhs.r; } - template + template explicit constexpr operator color1_base() const { - return{ static_cast(x) }; + return {static_cast(x)}; } }; -//specializations +// specializations using positionu = position_base; using positioni = position_base; using positionf = position_base; diff --git a/rpcs3/Utilities/lockless.h b/rpcs3/Utilities/lockless.h index 48142de96..1de039098 100644 --- a/rpcs3/Utilities/lockless.h +++ b/rpcs3/Utilities/lockless.h @@ -30,7 +30,7 @@ public: } } - T& operator [](usz index) + T& operator[](usz index) { lf_array* _this = this; @@ -49,7 +49,7 @@ public: if (!next) { - // Do not allow access beyond many element more at a time + // Do not allow access beyond many element more at a time ensure(!installed && index - i < N * 2); installed = true; @@ -73,7 +73,8 @@ public: return *result; } - template requires (std::is_invocable_v) + template + requires(std::is_invocable_v) auto for_each(F&& func, bool is_finite = true) { lf_array* _this = this; @@ -143,7 +144,7 @@ public: // Simple lock-free FIFO queue base. Based on lf_array itself. Currently uses 32-bit counters. // There is no "push_end" or "pop_begin" provided, the queue element must signal its state on its own. -template(256 / sizeof(T), 1)> +template (256 / sizeof(T), 1)> class lf_fifo : public lf_array { // LSB 32-bit: push, MSB 32-bit: pop @@ -176,17 +177,17 @@ public: u32 pop_end(u32 count = 1) { return m_ctrl.atomic_op([&](u64& ctrl) - { - ctrl += u64{count} << 32; - - if (ctrl >> 32 == static_cast(ctrl)) { - // Clean if possible - ctrl = 0; - } + ctrl += u64{count} << 32; - return static_cast(ctrl >> 32); - }); + if (ctrl >> 32 == static_cast(ctrl)) + { + // Clean if possible + ctrl = 0; + } + + return static_cast(ctrl >> 32); + }); } }; @@ -214,8 +215,7 @@ class lf_queue_item final template constexpr lf_queue_item(lf_queue_item* link, Args&&... args) - : m_link(link) - , m_data(std::forward(args)...) + : m_link(link), m_data(std::forward(args)...) { } @@ -248,28 +248,28 @@ class lf_queue_iterator public: constexpr lf_queue_iterator() = default; - bool operator ==(const lf_queue_iterator& rhs) const + bool operator==(const lf_queue_iterator& rhs) const { return m_ptr == rhs.m_ptr; } - T& operator *() const + T& operator*() const { return m_ptr->m_data; } - T* operator ->() const + T* operator->() const { return &m_ptr->m_data; } - lf_queue_iterator& operator ++() + lf_queue_iterator& operator++() { m_ptr = m_ptr->m_link; return *this; } - lf_queue_iterator operator ++(int) + lf_queue_iterator operator++(int) { lf_queue_iterator result; result.m_ptr = m_ptr; @@ -298,9 +298,9 @@ public: r.m_head = nullptr; } - lf_queue_slice& operator =(const lf_queue_slice&) = delete; + lf_queue_slice& operator=(const lf_queue_slice&) = delete; - lf_queue_slice& operator =(lf_queue_slice&& r) noexcept + lf_queue_slice& operator=(lf_queue_slice&& r) noexcept { if (this != &r) { @@ -317,12 +317,12 @@ public: delete m_head; } - T& operator *() const + T& operator*() const { return m_head->m_data; } - T* operator ->() const + T* operator->() const { return &m_head->m_data; } @@ -402,11 +402,10 @@ class lf_queue final do { - auto* pprev = prev->m_link; + auto* pprev = prev->m_link; prev->m_link = head; - head = std::exchange(prev, pprev); - } - while (prev); + head = std::exchange(prev, pprev); + } while (prev); } return head; @@ -573,8 +572,7 @@ public: // Set to not check already checked items _chk = _old; - } - while (!m_head.compare_exchange(_old, item)); + } while (!m_head.compare_exchange(_old, item)); return &item->m_data; } diff --git a/rpcs3/Utilities/mutex.cpp b/rpcs3/Utilities/mutex.cpp index 0cbd0df30..ae0582c49 100644 --- a/rpcs3/Utilities/mutex.cpp +++ b/rpcs3/Utilities/mutex.cpp @@ -59,15 +59,15 @@ void shared_mutex::imp_wait() while (true) { const auto [old, ok] = m_value.fetch_op([](u32& value) - { - if (value >= c_sig) { - value -= c_sig; - return true; - } + if (value >= c_sig) + { + value -= c_sig; + return true; + } - return false; - }); + return false; + }); if (ok) { diff --git a/rpcs3/Utilities/ppu_patch.h b/rpcs3/Utilities/ppu_patch.h index f88786cf2..a727ebc36 100644 --- a/rpcs3/Utilities/ppu_patch.h +++ b/rpcs3/Utilities/ppu_patch.h @@ -7,11 +7,11 @@ // Patch utilities specific to PPU code struct ppu_patch_block_registry_t { - ppu_patch_block_registry_t() = default; - ppu_patch_block_registry_t(const ppu_patch_block_registry_t&) = delete; - ppu_patch_block_registry_t& operator=(const ppu_patch_block_registry_t&) = delete; + ppu_patch_block_registry_t() = default; + ppu_patch_block_registry_t(const ppu_patch_block_registry_t&) = delete; + ppu_patch_block_registry_t& operator=(const ppu_patch_block_registry_t&) = delete; - std::unordered_set block_addresses{}; + std::unordered_set block_addresses{}; }; void ppu_register_range(u32 addr, u32 size); diff --git a/rpcs3/Utilities/rXml.h b/rpcs3/Utilities/rXml.h index 8b70d06ee..39150b4cc 100644 --- a/rpcs3/Utilities/rXml.h +++ b/rpcs3/Utilities/rXml.h @@ -33,7 +33,7 @@ struct rXmlDocument { rXmlDocument(); rXmlDocument(const rXmlDocument& other) = delete; - rXmlDocument &operator=(const rXmlDocument& other) = delete; + rXmlDocument& operator=(const rXmlDocument& other) = delete; pugi::xml_parse_result Read(std::string_view data); virtual std::shared_ptr GetRoot(); diff --git a/rpcs3/Utilities/sema.cpp b/rpcs3/Utilities/sema.cpp index ee3dd98ff..193924a72 100644 --- a/rpcs3/Utilities/sema.cpp +++ b/rpcs3/Utilities/sema.cpp @@ -22,26 +22,26 @@ void semaphore_base::imp_wait() { // Try hard way const u32 value = m_value.fetch_op([&](u32& value) - { - ensure(value != c_waiter_mask); // "semaphore_base: overflow" - - if (value & c_value_mask) { - // Obtain signal - value -= c_value; + ensure(value != c_waiter_mask); // "semaphore_base: overflow" - if (waits) + if (value & c_value_mask) { - // Remove waiter - value -= c_waiter; + // Obtain signal + value -= c_value; + + if (waits) + { + // Remove waiter + value -= c_waiter; + } } - } - else if (!waits) - { - // Add waiter - value += c_waiter; - } - }); + else if (!waits) + { + // Add waiter + value += c_waiter; + } + }); if (value & c_value_mask) { @@ -67,15 +67,15 @@ bool semaphore_base::try_post(u32 _max) { // Conditional increment const auto [value, ok] = m_value.fetch_op([&](u32& value) - { - if ((value & c_value_mask) <= _max) { - value += c_value; - return true; - } + if ((value & c_value_mask) <= _max) + { + value += c_value; + return true; + } - return false; - }); + return false; + }); if (!ok) { diff --git a/rpcs3/Utilities/sema.h b/rpcs3/Utilities/sema.h index 45080ebed..dfa9effbd 100644 --- a/rpcs3/Utilities/sema.h +++ b/rpcs3/Utilities/sema.h @@ -42,15 +42,16 @@ protected: bool try_wait() { return m_value.fetch_op([](u32& value) - { - if (value & c_value_mask) - { - value -= c_value; - return true; - } + { + if (value & c_value_mask) + { + value -= c_value; + return true; + } - return false; - }).second; + return false; + }) + .second; } void post(u32 _max) diff --git a/rpcs3/Utilities/simple_ringbuf.cpp b/rpcs3/Utilities/simple_ringbuf.cpp index c31b7af6f..0d9b8042e 100644 --- a/rpcs3/Utilities/simple_ringbuf.cpp +++ b/rpcs3/Utilities/simple_ringbuf.cpp @@ -30,7 +30,8 @@ simple_ringbuf::simple_ringbuf(const simple_ringbuf& other) simple_ringbuf& simple_ringbuf::operator=(const simple_ringbuf& other) { - if (this == &other) return *this; + if (this == &other) + return *this; ctr_state old = other.rw_ptr.load(); @@ -61,7 +62,8 @@ simple_ringbuf::simple_ringbuf(simple_ringbuf&& other) simple_ringbuf& simple_ringbuf::operator=(simple_ringbuf&& other) { - if (this == &other) return *this; + if (this == &other) + return *this; const ctr_state other_rw_ptr = other.rw_ptr.load(); buf = std::move(other.buf); @@ -117,20 +119,21 @@ void simple_ringbuf::set_buf_size(u64 size) void simple_ringbuf::writer_flush(u64 cnt) { rw_ptr.atomic_op([&](ctr_state& val) - { - const u64 used = get_used_size(val); - if (used == 0) return; + { + const u64 used = get_used_size(val); + if (used == 0) + return; - val.write_ptr += buf.size() - std::min(used, cnt); - }); + val.write_ptr += buf.size() - std::min(used, cnt); + }); } void simple_ringbuf::reader_flush(u64 cnt) { rw_ptr.atomic_op([&](ctr_state& val) - { - val.read_ptr += std::min(get_used_size(val), cnt); - }); + { + val.read_ptr += std::min(get_used_size(val), cnt); + }); } u64 simple_ringbuf::push(const void* data, u64 size, bool force) @@ -138,33 +141,33 @@ u64 simple_ringbuf::push(const void* data, u64 size, bool force) ensure(data != nullptr); return rw_ptr.atomic_op([&](ctr_state& val) -> u64 - { - const u64 buf_size = buf.size(); - const u64 old = val.write_ptr % buf_size; - const u64 free_size = get_free_size(val); - const u64 to_push = std::min(size, free_size); - const auto b_data = static_cast(data); - - if (!to_push || (!force && free_size < size)) { - return 0; - } + const u64 buf_size = buf.size(); + const u64 old = val.write_ptr % buf_size; + const u64 free_size = get_free_size(val); + const u64 to_push = std::min(size, free_size); + const auto b_data = static_cast(data); - if (old + to_push > buf_size) - { - const auto first_write_sz = buf_size - old; - memcpy(&buf[old], b_data, first_write_sz); - memcpy(&buf[0], b_data + first_write_sz, to_push - first_write_sz); - } - else - { - memcpy(&buf[old], b_data, to_push); - } + if (!to_push || (!force && free_size < size)) + { + return 0; + } - val.write_ptr += to_push; + if (old + to_push > buf_size) + { + const auto first_write_sz = buf_size - old; + memcpy(&buf[old], b_data, first_write_sz); + memcpy(&buf[0], b_data + first_write_sz, to_push - first_write_sz); + } + else + { + memcpy(&buf[old], b_data, to_push); + } - return to_push; - }); + val.write_ptr += to_push; + + return to_push; + }); } u64 simple_ringbuf::pop(void* data, u64 size, bool force) @@ -172,31 +175,31 @@ u64 simple_ringbuf::pop(void* data, u64 size, bool force) ensure(data != nullptr); return rw_ptr.atomic_op([&](ctr_state& val) -> u64 - { - const u64 buf_size = buf.size(); - const u64 old = val.read_ptr % buf_size; - const u64 used_size = get_used_size(val); - const u64 to_pop = std::min(size, used_size); - const auto b_data = static_cast(data); - - if (!to_pop || (!force && used_size < size)) { - return 0; - } + const u64 buf_size = buf.size(); + const u64 old = val.read_ptr % buf_size; + const u64 used_size = get_used_size(val); + const u64 to_pop = std::min(size, used_size); + const auto b_data = static_cast(data); - if (old + to_pop > buf_size) - { - const auto first_read_sz = buf_size - old; - memcpy(b_data, &buf[old], first_read_sz); - memcpy(b_data + first_read_sz, &buf[0], to_pop - first_read_sz); - } - else - { - memcpy(b_data, &buf[old], to_pop); - } + if (!to_pop || (!force && used_size < size)) + { + return 0; + } - val.read_ptr += to_pop; + if (old + to_pop > buf_size) + { + const auto first_read_sz = buf_size - old; + memcpy(b_data, &buf[old], first_read_sz); + memcpy(b_data + first_read_sz, &buf[0], to_pop - first_read_sz); + } + else + { + memcpy(b_data, &buf[old], to_pop); + } - return to_pop; - }); + val.read_ptr += to_pop; + + return to_pop; + }); } diff --git a/rpcs3/Utilities/simple_ringbuf.h b/rpcs3/Utilities/simple_ringbuf.h index 92151f7a9..6675fd09e 100644 --- a/rpcs3/Utilities/simple_ringbuf.h +++ b/rpcs3/Utilities/simple_ringbuf.h @@ -8,7 +8,6 @@ class simple_ringbuf { public: - simple_ringbuf(u64 size = 0); virtual ~simple_ringbuf(); @@ -34,11 +33,10 @@ public: void reader_flush(u64 cnt = umax); private: - struct ctr_state { alignas(sizeof(u64) * 2) - u64 read_ptr = 0; + u64 read_ptr = 0; u64 write_ptr = 0; auto operator<=>(const ctr_state& other) const = default; diff --git a/rpcs3/Utilities/stack_trace.cpp b/rpcs3/Utilities/stack_trace.cpp index f44751fcd..9464e68bf 100644 --- a/rpcs3/Utilities/stack_trace.cpp +++ b/rpcs3/Utilities/stack_trace.cpp @@ -3,7 +3,7 @@ #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN -#include +#include #define DBGHELP_TRANSLATE_TCHAR #include #include @@ -57,15 +57,15 @@ namespace utils while (max_depth--) { if (!StackWalk64( - IMAGE_FILE_MACHINE_AMD64, - hProcess, - hThread, - &stack, - &context, - NULL, - SymFunctionTableAccess64, - SymGetModuleBase64, - NULL)) + IMAGE_FILE_MACHINE_AMD64, + hProcess, + hThread, + &stack, + &context, + NULL, + SymFunctionTableAccess64, + SymGetModuleBase64, + NULL)) { break; } @@ -150,4 +150,4 @@ namespace utils return result; } #endif -} +} // namespace utils diff --git a/rpcs3/Utilities/stack_trace.h b/rpcs3/Utilities/stack_trace.h index f57175611..32e4655fe 100644 --- a/rpcs3/Utilities/stack_trace.h +++ b/rpcs3/Utilities/stack_trace.h @@ -9,8 +9,7 @@ namespace utils // Printing utilities template - concept Logger = requires (T& t, const std::string& msg) - { + concept Logger = requires(T& t, const std::string& msg) { { t.print(msg) }; }; @@ -21,14 +20,15 @@ namespace utils public: print_to_log(logs::channel& chan) : log(chan) - {} + { + } void print(const std::string& s) { log.error("%s", s); } }; - } + } // namespace stack_trace std::vector get_backtrace(int max_depth = 255); std::vector get_backtrace_symbols(const std::vector& stack); @@ -43,4 +43,4 @@ namespace utils logger.print(line); } } -} +} // namespace utils diff --git a/rpcs3/Utilities/sync.h b/rpcs3/Utilities/sync.h index db46d6104..ab06306a2 100644 --- a/rpcs3/Utilities/sync.h +++ b/rpcs3/Utilities/sync.h @@ -9,7 +9,7 @@ #ifndef NOMINMAX #define NOMINMAX #endif -#include +#include #include #elif __linux__ #include @@ -20,12 +20,18 @@ #endif #ifdef _WIN32 +#if !defined(NTSTATUS) +typedef _Return_type_success_(return >= 0) LONG NTSTATUS; +#endif + +#ifndef __GNUC__ DYNAMIC_IMPORT("ntdll.dll", NtWaitForKeyedEvent, NTSTATUS(HANDLE, PVOID Key, BOOLEAN Alertable, PLARGE_INTEGER Timeout)); DYNAMIC_IMPORT("ntdll.dll", NtReleaseKeyedEvent, NTSTATUS(HANDLE, PVOID Key, BOOLEAN Alertable, PLARGE_INTEGER Timeout)); DYNAMIC_IMPORT("ntdll.dll", NtWaitForSingleObject, NTSTATUS(HANDLE Handle, BOOLEAN Alertable, PLARGE_INTEGER Timeout)); DYNAMIC_IMPORT("ntdll.dll", NtDelayExecution, NTSTATUS(BOOLEAN Alertable, PLARGE_INTEGER DelayInterval)); DYNAMIC_IMPORT("ntdll.dll", NtWaitForAlertByThreadId, NTSTATUS(PVOID Address, PLARGE_INTEGER Timeout)); DYNAMIC_IMPORT("ntdll.dll", NtAlertThreadByThreadId, NTSTATUS(DWORD_PTR ThreadId)); +#endif constexpr NTSTATUS NTSTATUS_SUCCESS = 0; constexpr NTSTATUS NTSTATUS_ALERTED = 0x101; @@ -81,9 +87,9 @@ inline int futex(volatile void* uaddr, int futex_op, uint val, const timespec* t { struct waiter { - uint val; - uint mask; - std::condition_variable cv; + uint val; + uint mask; + std::condition_variable cv; }; std::mutex mutex; diff --git a/rpcs3/Utilities/transactional_storage.h b/rpcs3/Utilities/transactional_storage.h index 55e8aa9f9..a731f7cd6 100644 --- a/rpcs3/Utilities/transactional_storage.h +++ b/rpcs3/Utilities/transactional_storage.h @@ -7,7 +7,6 @@ class universal_pool { public: - universal_pool(u32 gc_interval = 10000) : gc_interval(gc_interval) { } @@ -27,7 +26,7 @@ public: } template - requires (std::invocable && std::is_same_v, std::shared_ptr>) + requires(std::invocable && std::is_same_v, std::shared_ptr>) void add_op(F func) { std::lock_guard lock(mutex); @@ -45,7 +44,6 @@ public: } private: - void delete_unused() { const u32 gc_int = gc_interval.observe(); @@ -53,11 +51,12 @@ private: if (u64 crnt_time = get_system_time(); gc_int == 0 || crnt_time > gc_last_time + gc_int) { gc_last_time = crnt_time; - storage.erase - ( - std::remove_if(storage.begin(), storage.end(), [](auto& obj) { return obj.use_count() <= 1; }), - storage.end() - ); + storage.erase( + std::remove_if(storage.begin(), storage.end(), [](auto& obj) + { + return obj.use_count() <= 1; + }), + storage.end()); } } @@ -67,11 +66,10 @@ private: atomic_t gc_interval = 0; }; -template +template class transactional_storage { public: - transactional_storage(std::shared_ptr pool, std::shared_ptr obj = std::make_shared()) { ensure(pool && obj); @@ -98,7 +96,8 @@ public: transactional_storage& operator=(transactional_storage&& other) { - if (this == &other) return *this; + if (this == &other) + return *this; pool = std::move(other.pool); @@ -127,33 +126,32 @@ public: } pool->add_op([&]() -> std::shared_ptr - { { - std::lock_guard lock{current_mutex}; - current = obj; - } - return std::move(obj); - }); + { + std::lock_guard lock{current_mutex}; + current = obj; + } + return std::move(obj); + }); } template - requires (std::invocable && std::is_same_v, std::shared_ptr>) + requires(std::invocable && std::is_same_v, std::shared_ptr>) void add_op(F func) { pool->add_op([&]() -> std::shared_ptr - { - std::shared_ptr obj = std::invoke(func); - if (obj) { - std::lock_guard lock{current_mutex}; - current = obj; - } - return obj; - }); + std::shared_ptr obj = std::invoke(func); + if (obj) + { + std::lock_guard lock{current_mutex}; + current = obj; + } + return obj; + }); } private: - shared_mutex current_mutex{}; std::shared_ptr current{}; std::shared_ptr pool{}; diff --git a/rpcs3/Utilities/version.cpp b/rpcs3/Utilities/version.cpp index 0c3cbb6da..85e1449a2 100644 --- a/rpcs3/Utilities/version.cpp +++ b/rpcs3/Utilities/version.cpp @@ -99,4 +99,4 @@ namespace utils return 0; } -} +} // namespace utils diff --git a/rpcs3/Utilities/version.h b/rpcs3/Utilities/version.h index 00180b543..a10a6327a 100644 --- a/rpcs3/Utilities/version.h +++ b/rpcs3/Utilities/version.h @@ -27,12 +27,7 @@ namespace utils public: constexpr version(uint hi, uint mid, uint lo, version_type type, uint type_index, const char* postfix) - : m_hi(hi) - , m_mid(mid) - , m_lo(lo) - , m_type(type) - , m_type_index(type_index) - , m_postfix(postfix) + : m_hi(hi), m_mid(mid), m_lo(lo), m_type(type), m_type_index(type_index), m_postfix(postfix) { } @@ -72,4 +67,4 @@ namespace utils // Generic version comparison (e.g. 0.0.5 vs 1.3) int compare_versions(const std::string& v1, const std::string& v2, bool& ok); -} +} // namespace utils diff --git a/rpcs3/objdump.cpp b/rpcs3/objdump.cpp index 76caef1c9..7ec60e4cf 100644 --- a/rpcs3/objdump.cpp +++ b/rpcs3/objdump.cpp @@ -29,8 +29,11 @@ std::string to_hex(std::uint64_t value, bool prfx = true) { char buf[20]{}, *ptr = buf + 19; - do *--ptr = "0123456789abcdef"[value % 16], value /= 16; while (value); - if (!prfx) return ptr; + do + *--ptr = "0123456789abcdef"[value % 16], value /= 16; + while (value); + if (!prfx) + return ptr; *--ptr = 'x'; *--ptr = '0'; return ptr; @@ -200,7 +203,9 @@ int main(int argc, char* argv[]) } else { - while ((dup2(fds[1], STDOUT_FILENO) == -1) && (errno == EINTR)) {} + while ((dup2(fds[1], STDOUT_FILENO) == -1) && (errno == EINTR)) + { + } close(fds[1]); close(fds[0]); // Fallthrough diff --git a/rpcs3/rpcs3/Crypto/aes.cpp b/rpcs3/rpcs3/Crypto/aes.cpp index 1cfc72aaa..d2f166498 100644 --- a/rpcs3/rpcs3/Crypto/aes.cpp +++ b/rpcs3/rpcs3/Crypto/aes.cpp @@ -38,23 +38,20 @@ * 32-bit integer manipulation macros (little endian) */ #ifndef GET_UINT32_LE -#define GET_UINT32_LE(n,b,i) \ -{ \ - (n) = ( static_cast((b)[(i) ]) ) \ - | ( static_cast((b)[(i) + 1]) << 8 ) \ - | ( static_cast((b)[(i) + 2]) << 16 ) \ - | ( static_cast((b)[(i) + 3]) << 24 );\ -} +#define GET_UINT32_LE(n, b, i) \ + { \ + (n) = (static_cast((b)[(i)])) | (static_cast((b)[(i) + 1]) << 8) | (static_cast((b)[(i) + 2]) << 16) | (static_cast((b)[(i) + 3]) << 24); \ + } #endif #ifndef PUT_UINT32_LE -#define PUT_UINT32_LE(n,b,i) \ -{ \ - (b)[(i) ] = static_cast ( (n) ); \ - (b)[(i) + 1] = static_cast ( (n) >> 8 ); \ - (b)[(i) + 2] = static_cast ( (n) >> 16 ); \ - (b)[(i) + 3] = static_cast ( (n) >> 24 ); \ -} +#define PUT_UINT32_LE(n, b, i) \ + { \ + (b)[(i)] = static_cast((n)); \ + (b)[(i) + 1] = static_cast((n) >> 8); \ + (b)[(i) + 2] = static_cast((n) >> 16); \ + (b)[(i) + 3] = static_cast((n) >> 24); \ + } #endif #if defined(POLARSSL_AES_ROM_TABLES) @@ -62,125 +59,124 @@ * Forward S-box */ static const unsigned char FSb[256] = -{ - 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, - 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, - 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, - 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, - 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, - 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, - 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, - 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75, - 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, - 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, - 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, - 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF, - 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, - 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8, - 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, - 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, - 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, - 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73, - 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, - 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB, - 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, - 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79, - 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, - 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08, - 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, - 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A, - 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, - 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, - 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, - 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF, - 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, - 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 -}; + { + 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, + 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, + 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, + 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, + 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, + 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, + 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, + 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75, + 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, + 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, + 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, + 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF, + 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, + 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8, + 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, + 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, + 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, + 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73, + 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, + 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB, + 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, + 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79, + 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, + 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08, + 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, + 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A, + 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, + 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, + 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, + 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF, + 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, + 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16}; /* * Forward tables */ -#define FT \ -\ - V(A5,63,63,C6), V(84,7C,7C,F8), V(99,77,77,EE), V(8D,7B,7B,F6), \ - V(0D,F2,F2,FF), V(BD,6B,6B,D6), V(B1,6F,6F,DE), V(54,C5,C5,91), \ - V(50,30,30,60), V(03,01,01,02), V(A9,67,67,CE), V(7D,2B,2B,56), \ - V(19,FE,FE,E7), V(62,D7,D7,B5), V(E6,AB,AB,4D), V(9A,76,76,EC), \ - V(45,CA,CA,8F), V(9D,82,82,1F), V(40,C9,C9,89), V(87,7D,7D,FA), \ - V(15,FA,FA,EF), V(EB,59,59,B2), V(C9,47,47,8E), V(0B,F0,F0,FB), \ - V(EC,AD,AD,41), V(67,D4,D4,B3), V(FD,A2,A2,5F), V(EA,AF,AF,45), \ - V(BF,9C,9C,23), V(F7,A4,A4,53), V(96,72,72,E4), V(5B,C0,C0,9B), \ - V(C2,B7,B7,75), V(1C,FD,FD,E1), V(AE,93,93,3D), V(6A,26,26,4C), \ - V(5A,36,36,6C), V(41,3F,3F,7E), V(02,F7,F7,F5), V(4F,CC,CC,83), \ - V(5C,34,34,68), V(F4,A5,A5,51), V(34,E5,E5,D1), V(08,F1,F1,F9), \ - V(93,71,71,E2), V(73,D8,D8,AB), V(53,31,31,62), V(3F,15,15,2A), \ - V(0C,04,04,08), V(52,C7,C7,95), V(65,23,23,46), V(5E,C3,C3,9D), \ - V(28,18,18,30), V(A1,96,96,37), V(0F,05,05,0A), V(B5,9A,9A,2F), \ - V(09,07,07,0E), V(36,12,12,24), V(9B,80,80,1B), V(3D,E2,E2,DF), \ - V(26,EB,EB,CD), V(69,27,27,4E), V(CD,B2,B2,7F), V(9F,75,75,EA), \ - V(1B,09,09,12), V(9E,83,83,1D), V(74,2C,2C,58), V(2E,1A,1A,34), \ - V(2D,1B,1B,36), V(B2,6E,6E,DC), V(EE,5A,5A,B4), V(FB,A0,A0,5B), \ - V(F6,52,52,A4), V(4D,3B,3B,76), V(61,D6,D6,B7), V(CE,B3,B3,7D), \ - V(7B,29,29,52), V(3E,E3,E3,DD), V(71,2F,2F,5E), V(97,84,84,13), \ - V(F5,53,53,A6), V(68,D1,D1,B9), V(00,00,00,00), V(2C,ED,ED,C1), \ - V(60,20,20,40), V(1F,FC,FC,E3), V(C8,B1,B1,79), V(ED,5B,5B,B6), \ - V(BE,6A,6A,D4), V(46,CB,CB,8D), V(D9,BE,BE,67), V(4B,39,39,72), \ - V(DE,4A,4A,94), V(D4,4C,4C,98), V(E8,58,58,B0), V(4A,CF,CF,85), \ - V(6B,D0,D0,BB), V(2A,EF,EF,C5), V(E5,AA,AA,4F), V(16,FB,FB,ED), \ - V(C5,43,43,86), V(D7,4D,4D,9A), V(55,33,33,66), V(94,85,85,11), \ - V(CF,45,45,8A), V(10,F9,F9,E9), V(06,02,02,04), V(81,7F,7F,FE), \ - V(F0,50,50,A0), V(44,3C,3C,78), V(BA,9F,9F,25), V(E3,A8,A8,4B), \ - V(F3,51,51,A2), V(FE,A3,A3,5D), V(C0,40,40,80), V(8A,8F,8F,05), \ - V(AD,92,92,3F), V(BC,9D,9D,21), V(48,38,38,70), V(04,F5,F5,F1), \ - V(DF,BC,BC,63), V(C1,B6,B6,77), V(75,DA,DA,AF), V(63,21,21,42), \ - V(30,10,10,20), V(1A,FF,FF,E5), V(0E,F3,F3,FD), V(6D,D2,D2,BF), \ - V(4C,CD,CD,81), V(14,0C,0C,18), V(35,13,13,26), V(2F,EC,EC,C3), \ - V(E1,5F,5F,BE), V(A2,97,97,35), V(CC,44,44,88), V(39,17,17,2E), \ - V(57,C4,C4,93), V(F2,A7,A7,55), V(82,7E,7E,FC), V(47,3D,3D,7A), \ - V(AC,64,64,C8), V(E7,5D,5D,BA), V(2B,19,19,32), V(95,73,73,E6), \ - V(A0,60,60,C0), V(98,81,81,19), V(D1,4F,4F,9E), V(7F,DC,DC,A3), \ - V(66,22,22,44), V(7E,2A,2A,54), V(AB,90,90,3B), V(83,88,88,0B), \ - V(CA,46,46,8C), V(29,EE,EE,C7), V(D3,B8,B8,6B), V(3C,14,14,28), \ - V(79,DE,DE,A7), V(E2,5E,5E,BC), V(1D,0B,0B,16), V(76,DB,DB,AD), \ - V(3B,E0,E0,DB), V(56,32,32,64), V(4E,3A,3A,74), V(1E,0A,0A,14), \ - V(DB,49,49,92), V(0A,06,06,0C), V(6C,24,24,48), V(E4,5C,5C,B8), \ - V(5D,C2,C2,9F), V(6E,D3,D3,BD), V(EF,AC,AC,43), V(A6,62,62,C4), \ - V(A8,91,91,39), V(A4,95,95,31), V(37,E4,E4,D3), V(8B,79,79,F2), \ - V(32,E7,E7,D5), V(43,C8,C8,8B), V(59,37,37,6E), V(B7,6D,6D,DA), \ - V(8C,8D,8D,01), V(64,D5,D5,B1), V(D2,4E,4E,9C), V(E0,A9,A9,49), \ - V(B4,6C,6C,D8), V(FA,56,56,AC), V(07,F4,F4,F3), V(25,EA,EA,CF), \ - V(AF,65,65,CA), V(8E,7A,7A,F4), V(E9,AE,AE,47), V(18,08,08,10), \ - V(D5,BA,BA,6F), V(88,78,78,F0), V(6F,25,25,4A), V(72,2E,2E,5C), \ - V(24,1C,1C,38), V(F1,A6,A6,57), V(C7,B4,B4,73), V(51,C6,C6,97), \ - V(23,E8,E8,CB), V(7C,DD,DD,A1), V(9C,74,74,E8), V(21,1F,1F,3E), \ - V(DD,4B,4B,96), V(DC,BD,BD,61), V(86,8B,8B,0D), V(85,8A,8A,0F), \ - V(90,70,70,E0), V(42,3E,3E,7C), V(C4,B5,B5,71), V(AA,66,66,CC), \ - V(D8,48,48,90), V(05,03,03,06), V(01,F6,F6,F7), V(12,0E,0E,1C), \ - V(A3,61,61,C2), V(5F,35,35,6A), V(F9,57,57,AE), V(D0,B9,B9,69), \ - V(91,86,86,17), V(58,C1,C1,99), V(27,1D,1D,3A), V(B9,9E,9E,27), \ - V(38,E1,E1,D9), V(13,F8,F8,EB), V(B3,98,98,2B), V(33,11,11,22), \ - V(BB,69,69,D2), V(70,D9,D9,A9), V(89,8E,8E,07), V(A7,94,94,33), \ - V(B6,9B,9B,2D), V(22,1E,1E,3C), V(92,87,87,15), V(20,E9,E9,C9), \ - V(49,CE,CE,87), V(FF,55,55,AA), V(78,28,28,50), V(7A,DF,DF,A5), \ - V(8F,8C,8C,03), V(F8,A1,A1,59), V(80,89,89,09), V(17,0D,0D,1A), \ - V(DA,BF,BF,65), V(31,E6,E6,D7), V(C6,42,42,84), V(B8,68,68,D0), \ - V(C3,41,41,82), V(B0,99,99,29), V(77,2D,2D,5A), V(11,0F,0F,1E), \ - V(CB,B0,B0,7B), V(FC,54,54,A8), V(D6,BB,BB,6D), V(3A,16,16,2C) +#define FT \ + \ + V(A5, 63, 63, C6), V(84, 7C, 7C, F8), V(99, 77, 77, EE), V(8D, 7B, 7B, F6), \ + V(0D, F2, F2, FF), V(BD, 6B, 6B, D6), V(B1, 6F, 6F, DE), V(54, C5, C5, 91), \ + V(50, 30, 30, 60), V(03, 01, 01, 02), V(A9, 67, 67, CE), V(7D, 2B, 2B, 56), \ + V(19, FE, FE, E7), V(62, D7, D7, B5), V(E6, AB, AB, 4D), V(9A, 76, 76, EC), \ + V(45, CA, CA, 8F), V(9D, 82, 82, 1F), V(40, C9, C9, 89), V(87, 7D, 7D, FA), \ + V(15, FA, FA, EF), V(EB, 59, 59, B2), V(C9, 47, 47, 8E), V(0B, F0, F0, FB), \ + V(EC, AD, AD, 41), V(67, D4, D4, B3), V(FD, A2, A2, 5F), V(EA, AF, AF, 45), \ + V(BF, 9C, 9C, 23), V(F7, A4, A4, 53), V(96, 72, 72, E4), V(5B, C0, C0, 9B), \ + V(C2, B7, B7, 75), V(1C, FD, FD, E1), V(AE, 93, 93, 3D), V(6A, 26, 26, 4C), \ + V(5A, 36, 36, 6C), V(41, 3F, 3F, 7E), V(02, F7, F7, F5), V(4F, CC, CC, 83), \ + V(5C, 34, 34, 68), V(F4, A5, A5, 51), V(34, E5, E5, D1), V(08, F1, F1, F9), \ + V(93, 71, 71, E2), V(73, D8, D8, AB), V(53, 31, 31, 62), V(3F, 15, 15, 2A), \ + V(0C, 04, 04, 08), V(52, C7, C7, 95), V(65, 23, 23, 46), V(5E, C3, C3, 9D), \ + V(28, 18, 18, 30), V(A1, 96, 96, 37), V(0F, 05, 05, 0A), V(B5, 9A, 9A, 2F), \ + V(09, 07, 07, 0E), V(36, 12, 12, 24), V(9B, 80, 80, 1B), V(3D, E2, E2, DF), \ + V(26, EB, EB, CD), V(69, 27, 27, 4E), V(CD, B2, B2, 7F), V(9F, 75, 75, EA), \ + V(1B, 09, 09, 12), V(9E, 83, 83, 1D), V(74, 2C, 2C, 58), V(2E, 1A, 1A, 34), \ + V(2D, 1B, 1B, 36), V(B2, 6E, 6E, DC), V(EE, 5A, 5A, B4), V(FB, A0, A0, 5B), \ + V(F6, 52, 52, A4), V(4D, 3B, 3B, 76), V(61, D6, D6, B7), V(CE, B3, B3, 7D), \ + V(7B, 29, 29, 52), V(3E, E3, E3, DD), V(71, 2F, 2F, 5E), V(97, 84, 84, 13), \ + V(F5, 53, 53, A6), V(68, D1, D1, B9), V(00, 00, 00, 00), V(2C, ED, ED, C1), \ + V(60, 20, 20, 40), V(1F, FC, FC, E3), V(C8, B1, B1, 79), V(ED, 5B, 5B, B6), \ + V(BE, 6A, 6A, D4), V(46, CB, CB, 8D), V(D9, BE, BE, 67), V(4B, 39, 39, 72), \ + V(DE, 4A, 4A, 94), V(D4, 4C, 4C, 98), V(E8, 58, 58, B0), V(4A, CF, CF, 85), \ + V(6B, D0, D0, BB), V(2A, EF, EF, C5), V(E5, AA, AA, 4F), V(16, FB, FB, ED), \ + V(C5, 43, 43, 86), V(D7, 4D, 4D, 9A), V(55, 33, 33, 66), V(94, 85, 85, 11), \ + V(CF, 45, 45, 8A), V(10, F9, F9, E9), V(06, 02, 02, 04), V(81, 7F, 7F, FE), \ + V(F0, 50, 50, A0), V(44, 3C, 3C, 78), V(BA, 9F, 9F, 25), V(E3, A8, A8, 4B), \ + V(F3, 51, 51, A2), V(FE, A3, A3, 5D), V(C0, 40, 40, 80), V(8A, 8F, 8F, 05), \ + V(AD, 92, 92, 3F), V(BC, 9D, 9D, 21), V(48, 38, 38, 70), V(04, F5, F5, F1), \ + V(DF, BC, BC, 63), V(C1, B6, B6, 77), V(75, DA, DA, AF), V(63, 21, 21, 42), \ + V(30, 10, 10, 20), V(1A, FF, FF, E5), V(0E, F3, F3, FD), V(6D, D2, D2, BF), \ + V(4C, CD, CD, 81), V(14, 0C, 0C, 18), V(35, 13, 13, 26), V(2F, EC, EC, C3), \ + V(E1, 5F, 5F, BE), V(A2, 97, 97, 35), V(CC, 44, 44, 88), V(39, 17, 17, 2E), \ + V(57, C4, C4, 93), V(F2, A7, A7, 55), V(82, 7E, 7E, FC), V(47, 3D, 3D, 7A), \ + V(AC, 64, 64, C8), V(E7, 5D, 5D, BA), V(2B, 19, 19, 32), V(95, 73, 73, E6), \ + V(A0, 60, 60, C0), V(98, 81, 81, 19), V(D1, 4F, 4F, 9E), V(7F, DC, DC, A3), \ + V(66, 22, 22, 44), V(7E, 2A, 2A, 54), V(AB, 90, 90, 3B), V(83, 88, 88, 0B), \ + V(CA, 46, 46, 8C), V(29, EE, EE, C7), V(D3, B8, B8, 6B), V(3C, 14, 14, 28), \ + V(79, DE, DE, A7), V(E2, 5E, 5E, BC), V(1D, 0B, 0B, 16), V(76, DB, DB, AD), \ + V(3B, E0, E0, DB), V(56, 32, 32, 64), V(4E, 3A, 3A, 74), V(1E, 0A, 0A, 14), \ + V(DB, 49, 49, 92), V(0A, 06, 06, 0C), V(6C, 24, 24, 48), V(E4, 5C, 5C, B8), \ + V(5D, C2, C2, 9F), V(6E, D3, D3, BD), V(EF, AC, AC, 43), V(A6, 62, 62, C4), \ + V(A8, 91, 91, 39), V(A4, 95, 95, 31), V(37, E4, E4, D3), V(8B, 79, 79, F2), \ + V(32, E7, E7, D5), V(43, C8, C8, 8B), V(59, 37, 37, 6E), V(B7, 6D, 6D, DA), \ + V(8C, 8D, 8D, 01), V(64, D5, D5, B1), V(D2, 4E, 4E, 9C), V(E0, A9, A9, 49), \ + V(B4, 6C, 6C, D8), V(FA, 56, 56, AC), V(07, F4, F4, F3), V(25, EA, EA, CF), \ + V(AF, 65, 65, CA), V(8E, 7A, 7A, F4), V(E9, AE, AE, 47), V(18, 08, 08, 10), \ + V(D5, BA, BA, 6F), V(88, 78, 78, F0), V(6F, 25, 25, 4A), V(72, 2E, 2E, 5C), \ + V(24, 1C, 1C, 38), V(F1, A6, A6, 57), V(C7, B4, B4, 73), V(51, C6, C6, 97), \ + V(23, E8, E8, CB), V(7C, DD, DD, A1), V(9C, 74, 74, E8), V(21, 1F, 1F, 3E), \ + V(DD, 4B, 4B, 96), V(DC, BD, BD, 61), V(86, 8B, 8B, 0D), V(85, 8A, 8A, 0F), \ + V(90, 70, 70, E0), V(42, 3E, 3E, 7C), V(C4, B5, B5, 71), V(AA, 66, 66, CC), \ + V(D8, 48, 48, 90), V(05, 03, 03, 06), V(01, F6, F6, F7), V(12, 0E, 0E, 1C), \ + V(A3, 61, 61, C2), V(5F, 35, 35, 6A), V(F9, 57, 57, AE), V(D0, B9, B9, 69), \ + V(91, 86, 86, 17), V(58, C1, C1, 99), V(27, 1D, 1D, 3A), V(B9, 9E, 9E, 27), \ + V(38, E1, E1, D9), V(13, F8, F8, EB), V(B3, 98, 98, 2B), V(33, 11, 11, 22), \ + V(BB, 69, 69, D2), V(70, D9, D9, A9), V(89, 8E, 8E, 07), V(A7, 94, 94, 33), \ + V(B6, 9B, 9B, 2D), V(22, 1E, 1E, 3C), V(92, 87, 87, 15), V(20, E9, E9, C9), \ + V(49, CE, CE, 87), V(FF, 55, 55, AA), V(78, 28, 28, 50), V(7A, DF, DF, A5), \ + V(8F, 8C, 8C, 03), V(F8, A1, A1, 59), V(80, 89, 89, 09), V(17, 0D, 0D, 1A), \ + V(DA, BF, BF, 65), V(31, E6, E6, D7), V(C6, 42, 42, 84), V(B8, 68, 68, D0), \ + V(C3, 41, 41, 82), V(B0, 99, 99, 29), V(77, 2D, 2D, 5A), V(11, 0F, 0F, 1E), \ + V(CB, B0, B0, 7B), V(FC, 54, 54, A8), V(D6, BB, BB, 6D), V(3A, 16, 16, 2C) -#define V(a,b,c,d) 0x##a##b##c##d -static const uint32_t FT0[256] = { FT }; +#define V(a, b, c, d) 0x##a##b##c##d +static const uint32_t FT0[256] = {FT}; #undef V -#define V(a,b,c,d) 0x##b##c##d##a -static const uint32_t FT1[256] = { FT }; +#define V(a, b, c, d) 0x##b##c##d##a +static const uint32_t FT1[256] = {FT}; #undef V -#define V(a,b,c,d) 0x##c##d##a##b -static const uint32_t FT2[256] = { FT }; +#define V(a, b, c, d) 0x##c##d##a##b +static const uint32_t FT2[256] = {FT}; #undef V -#define V(a,b,c,d) 0x##d##a##b##c -static const uint32_t FT3[256] = { FT }; +#define V(a, b, c, d) 0x##d##a##b##c +static const uint32_t FT3[256] = {FT}; #undef V #undef FT @@ -189,125 +185,124 @@ static const uint32_t FT3[256] = { FT }; * Reverse S-box */ static const unsigned char RSb[256] = -{ - 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, - 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, - 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, - 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, - 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, - 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, - 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, - 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25, - 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, - 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, - 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, - 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84, - 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, - 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, - 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, - 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, - 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, - 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73, - 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, - 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, - 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, - 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, - 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, - 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, - 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, - 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, - 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, - 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, - 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, - 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, - 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, - 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D -}; + { + 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, + 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, + 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, + 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, + 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, + 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, + 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, + 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25, + 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, + 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, + 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, + 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84, + 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, + 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, + 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, + 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, + 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, + 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73, + 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, + 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, + 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, + 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, + 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, + 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, + 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, + 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, + 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, + 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, + 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, + 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, + 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, + 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D}; /* * Reverse tables */ -#define RT \ -\ - V(50,A7,F4,51), V(53,65,41,7E), V(C3,A4,17,1A), V(96,5E,27,3A), \ - V(CB,6B,AB,3B), V(F1,45,9D,1F), V(AB,58,FA,AC), V(93,03,E3,4B), \ - V(55,FA,30,20), V(F6,6D,76,AD), V(91,76,CC,88), V(25,4C,02,F5), \ - V(FC,D7,E5,4F), V(D7,CB,2A,C5), V(80,44,35,26), V(8F,A3,62,B5), \ - V(49,5A,B1,DE), V(67,1B,BA,25), V(98,0E,EA,45), V(E1,C0,FE,5D), \ - V(02,75,2F,C3), V(12,F0,4C,81), V(A3,97,46,8D), V(C6,F9,D3,6B), \ - V(E7,5F,8F,03), V(95,9C,92,15), V(EB,7A,6D,BF), V(DA,59,52,95), \ - V(2D,83,BE,D4), V(D3,21,74,58), V(29,69,E0,49), V(44,C8,C9,8E), \ - V(6A,89,C2,75), V(78,79,8E,F4), V(6B,3E,58,99), V(DD,71,B9,27), \ - V(B6,4F,E1,BE), V(17,AD,88,F0), V(66,AC,20,C9), V(B4,3A,CE,7D), \ - V(18,4A,DF,63), V(82,31,1A,E5), V(60,33,51,97), V(45,7F,53,62), \ - V(E0,77,64,B1), V(84,AE,6B,BB), V(1C,A0,81,FE), V(94,2B,08,F9), \ - V(58,68,48,70), V(19,FD,45,8F), V(87,6C,DE,94), V(B7,F8,7B,52), \ - V(23,D3,73,AB), V(E2,02,4B,72), V(57,8F,1F,E3), V(2A,AB,55,66), \ - V(07,28,EB,B2), V(03,C2,B5,2F), V(9A,7B,C5,86), V(A5,08,37,D3), \ - V(F2,87,28,30), V(B2,A5,BF,23), V(BA,6A,03,02), V(5C,82,16,ED), \ - V(2B,1C,CF,8A), V(92,B4,79,A7), V(F0,F2,07,F3), V(A1,E2,69,4E), \ - V(CD,F4,DA,65), V(D5,BE,05,06), V(1F,62,34,D1), V(8A,FE,A6,C4), \ - V(9D,53,2E,34), V(A0,55,F3,A2), V(32,E1,8A,05), V(75,EB,F6,A4), \ - V(39,EC,83,0B), V(AA,EF,60,40), V(06,9F,71,5E), V(51,10,6E,BD), \ - V(F9,8A,21,3E), V(3D,06,DD,96), V(AE,05,3E,DD), V(46,BD,E6,4D), \ - V(B5,8D,54,91), V(05,5D,C4,71), V(6F,D4,06,04), V(FF,15,50,60), \ - V(24,FB,98,19), V(97,E9,BD,D6), V(CC,43,40,89), V(77,9E,D9,67), \ - V(BD,42,E8,B0), V(88,8B,89,07), V(38,5B,19,E7), V(DB,EE,C8,79), \ - V(47,0A,7C,A1), V(E9,0F,42,7C), V(C9,1E,84,F8), V(00,00,00,00), \ - V(83,86,80,09), V(48,ED,2B,32), V(AC,70,11,1E), V(4E,72,5A,6C), \ - V(FB,FF,0E,FD), V(56,38,85,0F), V(1E,D5,AE,3D), V(27,39,2D,36), \ - V(64,D9,0F,0A), V(21,A6,5C,68), V(D1,54,5B,9B), V(3A,2E,36,24), \ - V(B1,67,0A,0C), V(0F,E7,57,93), V(D2,96,EE,B4), V(9E,91,9B,1B), \ - V(4F,C5,C0,80), V(A2,20,DC,61), V(69,4B,77,5A), V(16,1A,12,1C), \ - V(0A,BA,93,E2), V(E5,2A,A0,C0), V(43,E0,22,3C), V(1D,17,1B,12), \ - V(0B,0D,09,0E), V(AD,C7,8B,F2), V(B9,A8,B6,2D), V(C8,A9,1E,14), \ - V(85,19,F1,57), V(4C,07,75,AF), V(BB,DD,99,EE), V(FD,60,7F,A3), \ - V(9F,26,01,F7), V(BC,F5,72,5C), V(C5,3B,66,44), V(34,7E,FB,5B), \ - V(76,29,43,8B), V(DC,C6,23,CB), V(68,FC,ED,B6), V(63,F1,E4,B8), \ - V(CA,DC,31,D7), V(10,85,63,42), V(40,22,97,13), V(20,11,C6,84), \ - V(7D,24,4A,85), V(F8,3D,BB,D2), V(11,32,F9,AE), V(6D,A1,29,C7), \ - V(4B,2F,9E,1D), V(F3,30,B2,DC), V(EC,52,86,0D), V(D0,E3,C1,77), \ - V(6C,16,B3,2B), V(99,B9,70,A9), V(FA,48,94,11), V(22,64,E9,47), \ - V(C4,8C,FC,A8), V(1A,3F,F0,A0), V(D8,2C,7D,56), V(EF,90,33,22), \ - V(C7,4E,49,87), V(C1,D1,38,D9), V(FE,A2,CA,8C), V(36,0B,D4,98), \ - V(CF,81,F5,A6), V(28,DE,7A,A5), V(26,8E,B7,DA), V(A4,BF,AD,3F), \ - V(E4,9D,3A,2C), V(0D,92,78,50), V(9B,CC,5F,6A), V(62,46,7E,54), \ - V(C2,13,8D,F6), V(E8,B8,D8,90), V(5E,F7,39,2E), V(F5,AF,C3,82), \ - V(BE,80,5D,9F), V(7C,93,D0,69), V(A9,2D,D5,6F), V(B3,12,25,CF), \ - V(3B,99,AC,C8), V(A7,7D,18,10), V(6E,63,9C,E8), V(7B,BB,3B,DB), \ - V(09,78,26,CD), V(F4,18,59,6E), V(01,B7,9A,EC), V(A8,9A,4F,83), \ - V(65,6E,95,E6), V(7E,E6,FF,AA), V(08,CF,BC,21), V(E6,E8,15,EF), \ - V(D9,9B,E7,BA), V(CE,36,6F,4A), V(D4,09,9F,EA), V(D6,7C,B0,29), \ - V(AF,B2,A4,31), V(31,23,3F,2A), V(30,94,A5,C6), V(C0,66,A2,35), \ - V(37,BC,4E,74), V(A6,CA,82,FC), V(B0,D0,90,E0), V(15,D8,A7,33), \ - V(4A,98,04,F1), V(F7,DA,EC,41), V(0E,50,CD,7F), V(2F,F6,91,17), \ - V(8D,D6,4D,76), V(4D,B0,EF,43), V(54,4D,AA,CC), V(DF,04,96,E4), \ - V(E3,B5,D1,9E), V(1B,88,6A,4C), V(B8,1F,2C,C1), V(7F,51,65,46), \ - V(04,EA,5E,9D), V(5D,35,8C,01), V(73,74,87,FA), V(2E,41,0B,FB), \ - V(5A,1D,67,B3), V(52,D2,DB,92), V(33,56,10,E9), V(13,47,D6,6D), \ - V(8C,61,D7,9A), V(7A,0C,A1,37), V(8E,14,F8,59), V(89,3C,13,EB), \ - V(EE,27,A9,CE), V(35,C9,61,B7), V(ED,E5,1C,E1), V(3C,B1,47,7A), \ - V(59,DF,D2,9C), V(3F,73,F2,55), V(79,CE,14,18), V(BF,37,C7,73), \ - V(EA,CD,F7,53), V(5B,AA,FD,5F), V(14,6F,3D,DF), V(86,DB,44,78), \ - V(81,F3,AF,CA), V(3E,C4,68,B9), V(2C,34,24,38), V(5F,40,A3,C2), \ - V(72,C3,1D,16), V(0C,25,E2,BC), V(8B,49,3C,28), V(41,95,0D,FF), \ - V(71,01,A8,39), V(DE,B3,0C,08), V(9C,E4,B4,D8), V(90,C1,56,64), \ - V(61,84,CB,7B), V(70,B6,32,D5), V(74,5C,6C,48), V(42,57,B8,D0) +#define RT \ + \ + V(50, A7, F4, 51), V(53, 65, 41, 7E), V(C3, A4, 17, 1A), V(96, 5E, 27, 3A), \ + V(CB, 6B, AB, 3B), V(F1, 45, 9D, 1F), V(AB, 58, FA, AC), V(93, 03, E3, 4B), \ + V(55, FA, 30, 20), V(F6, 6D, 76, AD), V(91, 76, CC, 88), V(25, 4C, 02, F5), \ + V(FC, D7, E5, 4F), V(D7, CB, 2A, C5), V(80, 44, 35, 26), V(8F, A3, 62, B5), \ + V(49, 5A, B1, DE), V(67, 1B, BA, 25), V(98, 0E, EA, 45), V(E1, C0, FE, 5D), \ + V(02, 75, 2F, C3), V(12, F0, 4C, 81), V(A3, 97, 46, 8D), V(C6, F9, D3, 6B), \ + V(E7, 5F, 8F, 03), V(95, 9C, 92, 15), V(EB, 7A, 6D, BF), V(DA, 59, 52, 95), \ + V(2D, 83, BE, D4), V(D3, 21, 74, 58), V(29, 69, E0, 49), V(44, C8, C9, 8E), \ + V(6A, 89, C2, 75), V(78, 79, 8E, F4), V(6B, 3E, 58, 99), V(DD, 71, B9, 27), \ + V(B6, 4F, E1, BE), V(17, AD, 88, F0), V(66, AC, 20, C9), V(B4, 3A, CE, 7D), \ + V(18, 4A, DF, 63), V(82, 31, 1A, E5), V(60, 33, 51, 97), V(45, 7F, 53, 62), \ + V(E0, 77, 64, B1), V(84, AE, 6B, BB), V(1C, A0, 81, FE), V(94, 2B, 08, F9), \ + V(58, 68, 48, 70), V(19, FD, 45, 8F), V(87, 6C, DE, 94), V(B7, F8, 7B, 52), \ + V(23, D3, 73, AB), V(E2, 02, 4B, 72), V(57, 8F, 1F, E3), V(2A, AB, 55, 66), \ + V(07, 28, EB, B2), V(03, C2, B5, 2F), V(9A, 7B, C5, 86), V(A5, 08, 37, D3), \ + V(F2, 87, 28, 30), V(B2, A5, BF, 23), V(BA, 6A, 03, 02), V(5C, 82, 16, ED), \ + V(2B, 1C, CF, 8A), V(92, B4, 79, A7), V(F0, F2, 07, F3), V(A1, E2, 69, 4E), \ + V(CD, F4, DA, 65), V(D5, BE, 05, 06), V(1F, 62, 34, D1), V(8A, FE, A6, C4), \ + V(9D, 53, 2E, 34), V(A0, 55, F3, A2), V(32, E1, 8A, 05), V(75, EB, F6, A4), \ + V(39, EC, 83, 0B), V(AA, EF, 60, 40), V(06, 9F, 71, 5E), V(51, 10, 6E, BD), \ + V(F9, 8A, 21, 3E), V(3D, 06, DD, 96), V(AE, 05, 3E, DD), V(46, BD, E6, 4D), \ + V(B5, 8D, 54, 91), V(05, 5D, C4, 71), V(6F, D4, 06, 04), V(FF, 15, 50, 60), \ + V(24, FB, 98, 19), V(97, E9, BD, D6), V(CC, 43, 40, 89), V(77, 9E, D9, 67), \ + V(BD, 42, E8, B0), V(88, 8B, 89, 07), V(38, 5B, 19, E7), V(DB, EE, C8, 79), \ + V(47, 0A, 7C, A1), V(E9, 0F, 42, 7C), V(C9, 1E, 84, F8), V(00, 00, 00, 00), \ + V(83, 86, 80, 09), V(48, ED, 2B, 32), V(AC, 70, 11, 1E), V(4E, 72, 5A, 6C), \ + V(FB, FF, 0E, FD), V(56, 38, 85, 0F), V(1E, D5, AE, 3D), V(27, 39, 2D, 36), \ + V(64, D9, 0F, 0A), V(21, A6, 5C, 68), V(D1, 54, 5B, 9B), V(3A, 2E, 36, 24), \ + V(B1, 67, 0A, 0C), V(0F, E7, 57, 93), V(D2, 96, EE, B4), V(9E, 91, 9B, 1B), \ + V(4F, C5, C0, 80), V(A2, 20, DC, 61), V(69, 4B, 77, 5A), V(16, 1A, 12, 1C), \ + V(0A, BA, 93, E2), V(E5, 2A, A0, C0), V(43, E0, 22, 3C), V(1D, 17, 1B, 12), \ + V(0B, 0D, 09, 0E), V(AD, C7, 8B, F2), V(B9, A8, B6, 2D), V(C8, A9, 1E, 14), \ + V(85, 19, F1, 57), V(4C, 07, 75, AF), V(BB, DD, 99, EE), V(FD, 60, 7F, A3), \ + V(9F, 26, 01, F7), V(BC, F5, 72, 5C), V(C5, 3B, 66, 44), V(34, 7E, FB, 5B), \ + V(76, 29, 43, 8B), V(DC, C6, 23, CB), V(68, FC, ED, B6), V(63, F1, E4, B8), \ + V(CA, DC, 31, D7), V(10, 85, 63, 42), V(40, 22, 97, 13), V(20, 11, C6, 84), \ + V(7D, 24, 4A, 85), V(F8, 3D, BB, D2), V(11, 32, F9, AE), V(6D, A1, 29, C7), \ + V(4B, 2F, 9E, 1D), V(F3, 30, B2, DC), V(EC, 52, 86, 0D), V(D0, E3, C1, 77), \ + V(6C, 16, B3, 2B), V(99, B9, 70, A9), V(FA, 48, 94, 11), V(22, 64, E9, 47), \ + V(C4, 8C, FC, A8), V(1A, 3F, F0, A0), V(D8, 2C, 7D, 56), V(EF, 90, 33, 22), \ + V(C7, 4E, 49, 87), V(C1, D1, 38, D9), V(FE, A2, CA, 8C), V(36, 0B, D4, 98), \ + V(CF, 81, F5, A6), V(28, DE, 7A, A5), V(26, 8E, B7, DA), V(A4, BF, AD, 3F), \ + V(E4, 9D, 3A, 2C), V(0D, 92, 78, 50), V(9B, CC, 5F, 6A), V(62, 46, 7E, 54), \ + V(C2, 13, 8D, F6), V(E8, B8, D8, 90), V(5E, F7, 39, 2E), V(F5, AF, C3, 82), \ + V(BE, 80, 5D, 9F), V(7C, 93, D0, 69), V(A9, 2D, D5, 6F), V(B3, 12, 25, CF), \ + V(3B, 99, AC, C8), V(A7, 7D, 18, 10), V(6E, 63, 9C, E8), V(7B, BB, 3B, DB), \ + V(09, 78, 26, CD), V(F4, 18, 59, 6E), V(01, B7, 9A, EC), V(A8, 9A, 4F, 83), \ + V(65, 6E, 95, E6), V(7E, E6, FF, AA), V(08, CF, BC, 21), V(E6, E8, 15, EF), \ + V(D9, 9B, E7, BA), V(CE, 36, 6F, 4A), V(D4, 09, 9F, EA), V(D6, 7C, B0, 29), \ + V(AF, B2, A4, 31), V(31, 23, 3F, 2A), V(30, 94, A5, C6), V(C0, 66, A2, 35), \ + V(37, BC, 4E, 74), V(A6, CA, 82, FC), V(B0, D0, 90, E0), V(15, D8, A7, 33), \ + V(4A, 98, 04, F1), V(F7, DA, EC, 41), V(0E, 50, CD, 7F), V(2F, F6, 91, 17), \ + V(8D, D6, 4D, 76), V(4D, B0, EF, 43), V(54, 4D, AA, CC), V(DF, 04, 96, E4), \ + V(E3, B5, D1, 9E), V(1B, 88, 6A, 4C), V(B8, 1F, 2C, C1), V(7F, 51, 65, 46), \ + V(04, EA, 5E, 9D), V(5D, 35, 8C, 01), V(73, 74, 87, FA), V(2E, 41, 0B, FB), \ + V(5A, 1D, 67, B3), V(52, D2, DB, 92), V(33, 56, 10, E9), V(13, 47, D6, 6D), \ + V(8C, 61, D7, 9A), V(7A, 0C, A1, 37), V(8E, 14, F8, 59), V(89, 3C, 13, EB), \ + V(EE, 27, A9, CE), V(35, C9, 61, B7), V(ED, E5, 1C, E1), V(3C, B1, 47, 7A), \ + V(59, DF, D2, 9C), V(3F, 73, F2, 55), V(79, CE, 14, 18), V(BF, 37, C7, 73), \ + V(EA, CD, F7, 53), V(5B, AA, FD, 5F), V(14, 6F, 3D, DF), V(86, DB, 44, 78), \ + V(81, F3, AF, CA), V(3E, C4, 68, B9), V(2C, 34, 24, 38), V(5F, 40, A3, C2), \ + V(72, C3, 1D, 16), V(0C, 25, E2, BC), V(8B, 49, 3C, 28), V(41, 95, 0D, FF), \ + V(71, 01, A8, 39), V(DE, B3, 0C, 08), V(9C, E4, B4, D8), V(90, C1, 56, 64), \ + V(61, 84, CB, 7B), V(70, B6, 32, D5), V(74, 5C, 6C, 48), V(42, 57, B8, D0) -#define V(a,b,c,d) 0x##a##b##c##d -static const uint32_t RT0[256] = { RT }; +#define V(a, b, c, d) 0x##a##b##c##d +static const uint32_t RT0[256] = {RT}; #undef V -#define V(a,b,c,d) 0x##b##c##d##a -static const uint32_t RT1[256] = { RT }; +#define V(a, b, c, d) 0x##b##c##d##a +static const uint32_t RT1[256] = {RT}; #undef V -#define V(a,b,c,d) 0x##c##d##a##b -static const uint32_t RT2[256] = { RT }; +#define V(a, b, c, d) 0x##c##d##a##b +static const uint32_t RT2[256] = {RT}; #undef V -#define V(a,b,c,d) 0x##d##a##b##c -static const uint32_t RT3[256] = { RT }; +#define V(a, b, c, d) 0x##d##a##b##c +static const uint32_t RT3[256] = {RT}; #undef V #undef RT @@ -316,11 +311,10 @@ static const uint32_t RT3[256] = { RT }; * Round constants */ static const uint32_t RCON[10] = -{ - 0x00000001, 0x00000002, 0x00000004, 0x00000008, - 0x00000010, 0x00000020, 0x00000040, 0x00000080, - 0x0000001B, 0x00000036 -}; + { + 0x00000001, 0x00000002, 0x00000004, 0x00000008, + 0x00000010, 0x00000020, 0x00000040, 0x00000080, + 0x0000001B, 0x00000036}; #else @@ -350,67 +344,71 @@ static uint32_t RCON[10]; /* * Tables generation code */ -#define ROTL8(x) ( ( x << 8 ) & 0xFFFFFFFF ) | ( x >> 24 ) -#define XTIME(x) ( ( x << 1 ) ^ ( ( x & 0x80 ) ? 0x1B : 0x00 ) ) -#define MUL(x,y) ( ( x && y ) ? pow[(log[x]+log[y]) % 255] : 0 ) +#define ROTL8(x) ((x << 8) & 0xFFFFFFFF) | (x >> 24) +#define XTIME(x) ((x << 1) ^ ((x & 0x80) ? 0x1B : 0x00)) +#define MUL(x, y) ((x && y) ? pow[(log[x] + log[y]) % 255] : 0) static int aes_init_done = 0; -static void aes_gen_tables( void ) +static void aes_gen_tables(void) { - int i, x, y, z; - int pow[256]; - int log[256]; + int i, x, y, z; + int pow[256]; + int log[256]; - /* - * compute pow and log tables over GF(2^8) - */ - for( i = 0, x = 1; i < 256; i++ ) - { - pow[i] = x; - log[x] = i; - x = ( x ^ XTIME( x ) ) & 0xFF; - } + /* + * compute pow and log tables over GF(2^8) + */ + for (i = 0, x = 1; i < 256; i++) + { + pow[i] = x; + log[x] = i; + x = (x ^ XTIME(x)) & 0xFF; + } - /* - * calculate the round constants - */ - for( i = 0, x = 1; i < 10; i++ ) - { - RCON[i] = static_cast(x; + /* + * calculate the round constants + */ + for (i = 0, x = 1; i < 10; i++) + { + RCON[i] = static_cast(x; x = XTIME( x ) & 0xFF; - } + } - /* - * generate the forward and reverse S-boxes - */ - FSb[0x00] = 0x63; - RSb[0x63] = 0x00; + /* + * generate the forward and reverse S-boxes + */ + FSb[0x00] = 0x63; + RSb[0x63] = 0x00; - for( i = 1; i < 256; i++ ) - { - x = pow[255 - log[i]]; + for (i = 1; i < 256; i++) + { + x = pow[255 - log[i]]; - y = x; y = ( (y << 1) | (y >> 7) ) & 0xFF; - x ^= y; y = ( (y << 1) | (y >> 7) ) & 0xFF; - x ^= y; y = ( (y << 1) | (y >> 7) ) & 0xFF; - x ^= y; y = ( (y << 1) | (y >> 7) ) & 0xFF; - x ^= y ^ 0x63; + y = x; + y = ((y << 1) | (y >> 7)) & 0xFF; + x ^= y; + y = ((y << 1) | (y >> 7)) & 0xFF; + x ^= y; + y = ((y << 1) | (y >> 7)) & 0xFF; + x ^= y; + y = ((y << 1) | (y >> 7)) & 0xFF; + x ^= y ^ 0x63; - FSb[i] = (unsigned char) x; - RSb[x] = (unsigned char) i; - } + FSb[i] = (unsigned char)x; + RSb[x] = (unsigned char)i; + } - /* - * generate the forward and reverse tables - */ - for( i = 0; i < 256; i++ ) - { - x = FSb[i]; - y = XTIME( x ) & 0xFF; - z = ( y ^ x ) & 0xFF; + /* + * generate the forward and reverse tables + */ + for (i = 0; i < 256; i++) + { + x = FSb[i]; + y = XTIME(x) & 0xFF; + z = (y ^ x) & 0xFF; - FT0[i] = ( static_cast(y ) ^ + FT0[i] = ( static_cast(y ) ^ ( static_cast(x << 8 ) ^ ( static_cast(x << 16 ) ^ ( static_cast(z << 24 ); @@ -429,7 +427,7 @@ static void aes_gen_tables( void ) RT1[i] = ROTL8( RT0[i] ); RT2[i] = ROTL8( RT1[i] ); RT3[i] = ROTL8( RT2[i] ); - } + } } #endif @@ -437,470 +435,472 @@ static void aes_gen_tables( void ) /* * AES key schedule (encryption) */ -int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int keysize ) +int aes_setkey_enc(aes_context* ctx, const unsigned char* key, unsigned int keysize) { - unsigned int i; - uint32_t *RK; + unsigned int i; + uint32_t* RK; #if !defined(POLARSSL_AES_ROM_TABLES) - if( aes_init_done == 0 ) - { - aes_gen_tables(); - aes_init_done = 1; - - } + if (aes_init_done == 0) + { + aes_gen_tables(); + aes_init_done = 1; + } #endif - switch( keysize ) - { - case 128: ctx->nr = 10; break; - case 192: ctx->nr = 12; break; - case 256: ctx->nr = 14; break; - default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH ); - } + switch (keysize) + { + case 128: ctx->nr = 10; break; + case 192: ctx->nr = 12; break; + case 256: ctx->nr = 14; break; + default: return (POLARSSL_ERR_AES_INVALID_KEY_LENGTH); + } - ctx->rk = RK = ctx->buf; + ctx->rk = RK = ctx->buf; #if defined(__SSE2__) || defined(_M_X64) - if( aesni_supports( POLARSSL_AESNI_AES ) ) - return( aesni_setkey_enc( reinterpret_cast(ctx->rk), key, keysize ) ); + if (aesni_supports(POLARSSL_AESNI_AES)) + return (aesni_setkey_enc(reinterpret_cast(ctx->rk), key, keysize)); #endif - for( i = 0; i < (keysize >> 5); i++ ) - { - GET_UINT32_LE( RK[i], key, i << 2 ); - } + for (i = 0; i < (keysize >> 5); i++) + { + GET_UINT32_LE(RK[i], key, i << 2); + } - switch( ctx->nr ) - { - case 10: + switch (ctx->nr) + { + case 10: - for( i = 0; i < 10; i++, RK += 4 ) - { - RK[4] = RK[0] ^ RCON[i] ^ - ( static_cast(FSb[ ( RK[3] >> 8 ) & 0xFF ]) ) ^ - ( static_cast(FSb[ ( RK[3] >> 16 ) & 0xFF ]) << 8 ) ^ - ( static_cast(FSb[ ( RK[3] >> 24 ) & 0xFF ]) << 16 ) ^ - ( static_cast(FSb[ ( RK[3] ) & 0xFF ]) << 24 ); + for (i = 0; i < 10; i++, RK += 4) + { + RK[4] = RK[0] ^ RCON[i] ^ + (static_cast(FSb[(RK[3] >> 8) & 0xFF])) ^ + (static_cast(FSb[(RK[3] >> 16) & 0xFF]) << 8) ^ + (static_cast(FSb[(RK[3] >> 24) & 0xFF]) << 16) ^ + (static_cast(FSb[(RK[3]) & 0xFF]) << 24); - RK[5] = RK[1] ^ RK[4]; - RK[6] = RK[2] ^ RK[5]; - RK[7] = RK[3] ^ RK[6]; - } - break; + RK[5] = RK[1] ^ RK[4]; + RK[6] = RK[2] ^ RK[5]; + RK[7] = RK[3] ^ RK[6]; + } + break; - case 12: + case 12: - for( i = 0; i < 8; i++, RK += 6 ) - { - RK[6] = RK[0] ^ RCON[i] ^ - ( static_cast(FSb[ ( RK[5] >> 8 ) & 0xFF ]) ) ^ - ( static_cast(FSb[ ( RK[5] >> 16 ) & 0xFF ]) << 8 ) ^ - ( static_cast(FSb[ ( RK[5] >> 24 ) & 0xFF ]) << 16 ) ^ - ( static_cast(FSb[ ( RK[5] ) & 0xFF ]) << 24 ); + for (i = 0; i < 8; i++, RK += 6) + { + RK[6] = RK[0] ^ RCON[i] ^ + (static_cast(FSb[(RK[5] >> 8) & 0xFF])) ^ + (static_cast(FSb[(RK[5] >> 16) & 0xFF]) << 8) ^ + (static_cast(FSb[(RK[5] >> 24) & 0xFF]) << 16) ^ + (static_cast(FSb[(RK[5]) & 0xFF]) << 24); - RK[7] = RK[1] ^ RK[6]; - RK[8] = RK[2] ^ RK[7]; - RK[9] = RK[3] ^ RK[8]; - RK[10] = RK[4] ^ RK[9]; - RK[11] = RK[5] ^ RK[10]; - } - break; + RK[7] = RK[1] ^ RK[6]; + RK[8] = RK[2] ^ RK[7]; + RK[9] = RK[3] ^ RK[8]; + RK[10] = RK[4] ^ RK[9]; + RK[11] = RK[5] ^ RK[10]; + } + break; - case 14: + case 14: - for( i = 0; i < 7; i++, RK += 8 ) - { - RK[8] = RK[0] ^ RCON[i] ^ - ( static_cast(FSb[ ( RK[7] >> 8 ) & 0xFF ]) ) ^ - ( static_cast(FSb[ ( RK[7] >> 16 ) & 0xFF ]) << 8 ) ^ - ( static_cast(FSb[ ( RK[7] >> 24 ) & 0xFF ]) << 16 ) ^ - ( static_cast(FSb[ ( RK[7] ) & 0xFF ]) << 24 ); + for (i = 0; i < 7; i++, RK += 8) + { + RK[8] = RK[0] ^ RCON[i] ^ + (static_cast(FSb[(RK[7] >> 8) & 0xFF])) ^ + (static_cast(FSb[(RK[7] >> 16) & 0xFF]) << 8) ^ + (static_cast(FSb[(RK[7] >> 24) & 0xFF]) << 16) ^ + (static_cast(FSb[(RK[7]) & 0xFF]) << 24); - RK[9] = RK[1] ^ RK[8]; - RK[10] = RK[2] ^ RK[9]; - RK[11] = RK[3] ^ RK[10]; + RK[9] = RK[1] ^ RK[8]; + RK[10] = RK[2] ^ RK[9]; + RK[11] = RK[3] ^ RK[10]; - RK[12] = RK[4] ^ - ( static_cast(FSb[ ( RK[11] ) & 0xFF ]) ) ^ - ( static_cast(FSb[ ( RK[11] >> 8 ) & 0xFF ]) << 8 ) ^ - ( static_cast(FSb[ ( RK[11] >> 16 ) & 0xFF ]) << 16 ) ^ - ( static_cast(FSb[ ( RK[11] >> 24 ) & 0xFF ]) << 24 ); + RK[12] = RK[4] ^ + (static_cast(FSb[(RK[11]) & 0xFF])) ^ + (static_cast(FSb[(RK[11] >> 8) & 0xFF]) << 8) ^ + (static_cast(FSb[(RK[11] >> 16) & 0xFF]) << 16) ^ + (static_cast(FSb[(RK[11] >> 24) & 0xFF]) << 24); - RK[13] = RK[5] ^ RK[12]; - RK[14] = RK[6] ^ RK[13]; - RK[15] = RK[7] ^ RK[14]; - } - break; + RK[13] = RK[5] ^ RK[12]; + RK[14] = RK[6] ^ RK[13]; + RK[15] = RK[7] ^ RK[14]; + } + break; - default: + default: - break; - } + break; + } - return( 0 ); + return (0); } /* * AES key schedule (decryption) */ -int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int keysize ) +int aes_setkey_dec(aes_context* ctx, const unsigned char* key, unsigned int keysize) { - int i, j; - aes_context cty; - uint32_t *RK; - uint32_t *SK; - int ret; + int i, j; + aes_context cty; + uint32_t* RK; + uint32_t* SK; + int ret; - switch( keysize ) - { - case 128: ctx->nr = 10; break; - case 192: ctx->nr = 12; break; - case 256: ctx->nr = 14; break; - default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH ); - } + switch (keysize) + { + case 128: ctx->nr = 10; break; + case 192: ctx->nr = 12; break; + case 256: ctx->nr = 14; break; + default: return (POLARSSL_ERR_AES_INVALID_KEY_LENGTH); + } - ctx->rk = RK = ctx->buf; + ctx->rk = RK = ctx->buf; - ret = aes_setkey_enc( &cty, key, keysize ); - if( ret != 0 ) - return( ret ); + ret = aes_setkey_enc(&cty, key, keysize); + if (ret != 0) + return (ret); #if defined(__SSE2__) || defined(_M_X64) - if( aesni_supports( POLARSSL_AESNI_AES ) ) - { - aesni_inverse_key( reinterpret_cast(ctx->rk), - reinterpret_cast(cty.rk), ctx->nr ); - goto done; - } + if (aesni_supports(POLARSSL_AESNI_AES)) + { + aesni_inverse_key(reinterpret_cast(ctx->rk), + reinterpret_cast(cty.rk), ctx->nr); + goto done; + } #endif - SK = cty.rk + cty.nr * 4; + SK = cty.rk + cty.nr * 4; - *RK++ = *SK++; - *RK++ = *SK++; - *RK++ = *SK++; - *RK++ = *SK++; + *RK++ = *SK++; + *RK++ = *SK++; + *RK++ = *SK++; + *RK++ = *SK++; - for( i = ctx->nr - 1, SK -= 8; i > 0; i--, SK -= 8 ) - { - for( j = 0; j < 4; j++, SK++ ) - { - *RK++ = RT0[ FSb[ ( *SK ) & 0xFF ] ] ^ - RT1[ FSb[ ( *SK >> 8 ) & 0xFF ] ] ^ - RT2[ FSb[ ( *SK >> 16 ) & 0xFF ] ] ^ - RT3[ FSb[ ( *SK >> 24 ) & 0xFF ] ]; - } - } + for (i = ctx->nr - 1, SK -= 8; i > 0; i--, SK -= 8) + { + for (j = 0; j < 4; j++, SK++) + { + *RK++ = RT0[FSb[(*SK) & 0xFF]] ^ + RT1[FSb[(*SK >> 8) & 0xFF]] ^ + RT2[FSb[(*SK >> 16) & 0xFF]] ^ + RT3[FSb[(*SK >> 24) & 0xFF]]; + } + } - *RK++ = *SK++; - *RK++ = *SK++; - *RK++ = *SK++; - *RK++ = *SK++; + *RK++ = *SK++; + *RK++ = *SK++; + *RK++ = *SK++; + *RK++ = *SK++; #if defined(__SSE2__) || defined(_M_X64) done: #endif - // Wipe the stack buffer clean - std::fill_n(reinterpret_cast(&cty), sizeof(cty), 0); + // Wipe the stack buffer clean + std::fill_n(reinterpret_cast(&cty), sizeof(cty), 0); - return( 0 ); + return (0); } -#define AES_FROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \ -{ \ - X0 = *RK++ ^ FT0[ ( Y0 ) & 0xFF ] ^ \ - FT1[ ( Y1 >> 8 ) & 0xFF ] ^ \ - FT2[ ( Y2 >> 16 ) & 0xFF ] ^ \ - FT3[ ( Y3 >> 24 ) & 0xFF ]; \ - \ - X1 = *RK++ ^ FT0[ ( Y1 ) & 0xFF ] ^ \ - FT1[ ( Y2 >> 8 ) & 0xFF ] ^ \ - FT2[ ( Y3 >> 16 ) & 0xFF ] ^ \ - FT3[ ( Y0 >> 24 ) & 0xFF ]; \ - \ - X2 = *RK++ ^ FT0[ ( Y2 ) & 0xFF ] ^ \ - FT1[ ( Y3 >> 8 ) & 0xFF ] ^ \ - FT2[ ( Y0 >> 16 ) & 0xFF ] ^ \ - FT3[ ( Y1 >> 24 ) & 0xFF ]; \ - \ - X3 = *RK++ ^ FT0[ ( Y3 ) & 0xFF ] ^ \ - FT1[ ( Y0 >> 8 ) & 0xFF ] ^ \ - FT2[ ( Y1 >> 16 ) & 0xFF ] ^ \ - FT3[ ( Y2 >> 24 ) & 0xFF ]; \ -} +#define AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3) \ + { \ + X0 = *RK++ ^ FT0[(Y0) & 0xFF] ^ \ + FT1[(Y1 >> 8) & 0xFF] ^ \ + FT2[(Y2 >> 16) & 0xFF] ^ \ + FT3[(Y3 >> 24) & 0xFF]; \ + \ + X1 = *RK++ ^ FT0[(Y1) & 0xFF] ^ \ + FT1[(Y2 >> 8) & 0xFF] ^ \ + FT2[(Y3 >> 16) & 0xFF] ^ \ + FT3[(Y0 >> 24) & 0xFF]; \ + \ + X2 = *RK++ ^ FT0[(Y2) & 0xFF] ^ \ + FT1[(Y3 >> 8) & 0xFF] ^ \ + FT2[(Y0 >> 16) & 0xFF] ^ \ + FT3[(Y1 >> 24) & 0xFF]; \ + \ + X3 = *RK++ ^ FT0[(Y3) & 0xFF] ^ \ + FT1[(Y0 >> 8) & 0xFF] ^ \ + FT2[(Y1 >> 16) & 0xFF] ^ \ + FT3[(Y2 >> 24) & 0xFF]; \ + } -#define AES_RROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \ -{ \ - X0 = *RK++ ^ RT0[ ( Y0 ) & 0xFF ] ^ \ - RT1[ ( Y3 >> 8 ) & 0xFF ] ^ \ - RT2[ ( Y2 >> 16 ) & 0xFF ] ^ \ - RT3[ ( Y1 >> 24 ) & 0xFF ]; \ - \ - X1 = *RK++ ^ RT0[ ( Y1 ) & 0xFF ] ^ \ - RT1[ ( Y0 >> 8 ) & 0xFF ] ^ \ - RT2[ ( Y3 >> 16 ) & 0xFF ] ^ \ - RT3[ ( Y2 >> 24 ) & 0xFF ]; \ - \ - X2 = *RK++ ^ RT0[ ( Y2 ) & 0xFF ] ^ \ - RT1[ ( Y1 >> 8 ) & 0xFF ] ^ \ - RT2[ ( Y0 >> 16 ) & 0xFF ] ^ \ - RT3[ ( Y3 >> 24 ) & 0xFF ]; \ - \ - X3 = *RK++ ^ RT0[ ( Y3 ) & 0xFF ] ^ \ - RT1[ ( Y2 >> 8 ) & 0xFF ] ^ \ - RT2[ ( Y1 >> 16 ) & 0xFF ] ^ \ - RT3[ ( Y0 >> 24 ) & 0xFF ]; \ -} +#define AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3) \ + { \ + X0 = *RK++ ^ RT0[(Y0) & 0xFF] ^ \ + RT1[(Y3 >> 8) & 0xFF] ^ \ + RT2[(Y2 >> 16) & 0xFF] ^ \ + RT3[(Y1 >> 24) & 0xFF]; \ + \ + X1 = *RK++ ^ RT0[(Y1) & 0xFF] ^ \ + RT1[(Y0 >> 8) & 0xFF] ^ \ + RT2[(Y3 >> 16) & 0xFF] ^ \ + RT3[(Y2 >> 24) & 0xFF]; \ + \ + X2 = *RK++ ^ RT0[(Y2) & 0xFF] ^ \ + RT1[(Y1 >> 8) & 0xFF] ^ \ + RT2[(Y0 >> 16) & 0xFF] ^ \ + RT3[(Y3 >> 24) & 0xFF]; \ + \ + X3 = *RK++ ^ RT0[(Y3) & 0xFF] ^ \ + RT1[(Y2 >> 8) & 0xFF] ^ \ + RT2[(Y1 >> 16) & 0xFF] ^ \ + RT3[(Y0 >> 24) & 0xFF]; \ + } /* * AES-ECB block encryption/decryption */ -int aes_crypt_ecb( aes_context *ctx, - int mode, - const unsigned char input[16], - unsigned char output[16] ) +int aes_crypt_ecb(aes_context* ctx, + int mode, + const unsigned char input[16], + unsigned char output[16]) { - int i; - uint32_t *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; + int i; + uint32_t *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; #if defined(__SSE2__) || defined(_M_X64) - if( aesni_supports( POLARSSL_AESNI_AES ) ) - return( aesni_crypt_ecb( ctx, mode, input, output ) ); + if (aesni_supports(POLARSSL_AESNI_AES)) + return (aesni_crypt_ecb(ctx, mode, input, output)); #endif - RK = ctx->rk; + RK = ctx->rk; - GET_UINT32_LE( X0, input, 0 ); X0 ^= *RK++; - GET_UINT32_LE( X1, input, 4 ); X1 ^= *RK++; - GET_UINT32_LE( X2, input, 8 ); X2 ^= *RK++; - GET_UINT32_LE( X3, input, 12 ); X3 ^= *RK++; + GET_UINT32_LE(X0, input, 0); + X0 ^= *RK++; + GET_UINT32_LE(X1, input, 4); + X1 ^= *RK++; + GET_UINT32_LE(X2, input, 8); + X2 ^= *RK++; + GET_UINT32_LE(X3, input, 12); + X3 ^= *RK++; - if( mode == AES_DECRYPT ) - { - for( i = (ctx->nr >> 1) - 1; i > 0; i-- ) - { - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); - } + if (mode == AES_DECRYPT) + { + for (i = (ctx->nr >> 1) - 1; i > 0; i--) + { + AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); + AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); + } - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); + AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); - X0 = *RK++ ^ \ - ( static_cast(RSb[ ( Y0 ) & 0xFF ]) ) ^ - ( static_cast(RSb[ ( Y3 >> 8 ) & 0xFF ]) << 8 ) ^ - ( static_cast(RSb[ ( Y2 >> 16 ) & 0xFF ]) << 16 ) ^ - ( static_cast(RSb[ ( Y1 >> 24 ) & 0xFF ]) << 24 ); + X0 = *RK++ ^ + (static_cast(RSb[(Y0) & 0xFF])) ^ + (static_cast(RSb[(Y3 >> 8) & 0xFF]) << 8) ^ + (static_cast(RSb[(Y2 >> 16) & 0xFF]) << 16) ^ + (static_cast(RSb[(Y1 >> 24) & 0xFF]) << 24); - X1 = *RK++ ^ \ - ( static_cast(RSb[ ( Y1 ) & 0xFF ]) ) ^ - ( static_cast(RSb[ ( Y0 >> 8 ) & 0xFF ]) << 8 ) ^ - ( static_cast(RSb[ ( Y3 >> 16 ) & 0xFF ]) << 16 ) ^ - ( static_cast(RSb[ ( Y2 >> 24 ) & 0xFF ]) << 24 ); + X1 = *RK++ ^ + (static_cast(RSb[(Y1) & 0xFF])) ^ + (static_cast(RSb[(Y0 >> 8) & 0xFF]) << 8) ^ + (static_cast(RSb[(Y3 >> 16) & 0xFF]) << 16) ^ + (static_cast(RSb[(Y2 >> 24) & 0xFF]) << 24); - X2 = *RK++ ^ \ - ( static_cast(RSb[ ( Y2 ) & 0xFF ]) ) ^ - ( static_cast(RSb[ ( Y1 >> 8 ) & 0xFF ]) << 8 ) ^ - ( static_cast(RSb[ ( Y0 >> 16 ) & 0xFF ]) << 16 ) ^ - ( static_cast(RSb[ ( Y3 >> 24 ) & 0xFF ]) << 24 ); + X2 = *RK++ ^ + (static_cast(RSb[(Y2) & 0xFF])) ^ + (static_cast(RSb[(Y1 >> 8) & 0xFF]) << 8) ^ + (static_cast(RSb[(Y0 >> 16) & 0xFF]) << 16) ^ + (static_cast(RSb[(Y3 >> 24) & 0xFF]) << 24); - X3 = *RK++ ^ \ - ( static_cast(RSb[ ( Y3 ) & 0xFF ]) ) ^ - ( static_cast(RSb[ ( Y2 >> 8 ) & 0xFF ]) << 8 ) ^ - ( static_cast(RSb[ ( Y1 >> 16 ) & 0xFF ]) << 16 ) ^ - ( static_cast(RSb[ ( Y0 >> 24 ) & 0xFF ]) << 24 ); - } - else /* AES_ENCRYPT */ - { - for( i = (ctx->nr >> 1) - 1; i > 0; i-- ) - { - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); - } + X3 = *RK++ ^ + (static_cast(RSb[(Y3) & 0xFF])) ^ + (static_cast(RSb[(Y2 >> 8) & 0xFF]) << 8) ^ + (static_cast(RSb[(Y1 >> 16) & 0xFF]) << 16) ^ + (static_cast(RSb[(Y0 >> 24) & 0xFF]) << 24); + } + else /* AES_ENCRYPT */ + { + for (i = (ctx->nr >> 1) - 1; i > 0; i--) + { + AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); + AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); + } - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); + AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); - X0 = *RK++ ^ \ - ( static_cast(FSb[ ( Y0 ) & 0xFF ]) ) ^ - ( static_cast(FSb[ ( Y1 >> 8 ) & 0xFF ]) << 8 ) ^ - ( static_cast(FSb[ ( Y2 >> 16 ) & 0xFF ]) << 16 ) ^ - ( static_cast(FSb[ ( Y3 >> 24 ) & 0xFF ]) << 24 ); + X0 = *RK++ ^ + (static_cast(FSb[(Y0) & 0xFF])) ^ + (static_cast(FSb[(Y1 >> 8) & 0xFF]) << 8) ^ + (static_cast(FSb[(Y2 >> 16) & 0xFF]) << 16) ^ + (static_cast(FSb[(Y3 >> 24) & 0xFF]) << 24); - X1 = *RK++ ^ \ - ( static_cast(FSb[ ( Y1 ) & 0xFF ]) ) ^ - ( static_cast(FSb[ ( Y2 >> 8 ) & 0xFF ]) << 8 ) ^ - ( static_cast(FSb[ ( Y3 >> 16 ) & 0xFF ]) << 16 ) ^ - ( static_cast(FSb[ ( Y0 >> 24 ) & 0xFF ]) << 24 ); + X1 = *RK++ ^ + (static_cast(FSb[(Y1) & 0xFF])) ^ + (static_cast(FSb[(Y2 >> 8) & 0xFF]) << 8) ^ + (static_cast(FSb[(Y3 >> 16) & 0xFF]) << 16) ^ + (static_cast(FSb[(Y0 >> 24) & 0xFF]) << 24); - X2 = *RK++ ^ \ - ( static_cast(FSb[ ( Y2 ) & 0xFF ]) ) ^ - ( static_cast(FSb[ ( Y3 >> 8 ) & 0xFF ]) << 8 ) ^ - ( static_cast(FSb[ ( Y0 >> 16 ) & 0xFF ]) << 16 ) ^ - ( static_cast(FSb[ ( Y1 >> 24 ) & 0xFF ]) << 24 ); + X2 = *RK++ ^ + (static_cast(FSb[(Y2) & 0xFF])) ^ + (static_cast(FSb[(Y3 >> 8) & 0xFF]) << 8) ^ + (static_cast(FSb[(Y0 >> 16) & 0xFF]) << 16) ^ + (static_cast(FSb[(Y1 >> 24) & 0xFF]) << 24); - X3 = *RK++ ^ \ - ( static_cast(FSb[ ( Y3 ) & 0xFF ]) ) ^ - ( static_cast(FSb[ ( Y0 >> 8 ) & 0xFF ]) << 8 ) ^ - ( static_cast(FSb[ ( Y1 >> 16 ) & 0xFF ]) << 16 ) ^ - ( static_cast(FSb[ ( Y2 >> 24 ) & 0xFF ]) << 24 ); - } + X3 = *RK++ ^ + (static_cast(FSb[(Y3) & 0xFF])) ^ + (static_cast(FSb[(Y0 >> 8) & 0xFF]) << 8) ^ + (static_cast(FSb[(Y1 >> 16) & 0xFF]) << 16) ^ + (static_cast(FSb[(Y2 >> 24) & 0xFF]) << 24); + } - PUT_UINT32_LE( X0, output, 0 ); - PUT_UINT32_LE( X1, output, 4 ); - PUT_UINT32_LE( X2, output, 8 ); - PUT_UINT32_LE( X3, output, 12 ); + PUT_UINT32_LE(X0, output, 0); + PUT_UINT32_LE(X1, output, 4); + PUT_UINT32_LE(X2, output, 8); + PUT_UINT32_LE(X3, output, 12); - return( 0 ); + return (0); } /* * AES-CBC buffer encryption/decryption */ -int aes_crypt_cbc( aes_context *ctx, - int mode, - size_t length, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output ) +int aes_crypt_cbc(aes_context* ctx, + int mode, + size_t length, + unsigned char iv[16], + const unsigned char* input, + unsigned char* output) { - int i; - unsigned char temp[16]; + int i; + unsigned char temp[16]; - if( length % 16 ) - return( POLARSSL_ERR_AES_INVALID_INPUT_LENGTH ); + if (length % 16) + return (POLARSSL_ERR_AES_INVALID_INPUT_LENGTH); - if( mode == AES_DECRYPT ) - { - while( length > 0 ) - { - memcpy( temp, input, 16 ); - aes_crypt_ecb( ctx, mode, input, output ); + if (mode == AES_DECRYPT) + { + while (length > 0) + { + memcpy(temp, input, 16); + aes_crypt_ecb(ctx, mode, input, output); - for( i = 0; i < 16; i++ ) - output[i] ^= iv[i]; + for (i = 0; i < 16; i++) + output[i] ^= iv[i]; - memcpy( iv, temp, 16 ); + memcpy(iv, temp, 16); - input += 16; - output += 16; - length -= 16; - } - } - else - { - while( length > 0 ) - { - for( i = 0; i < 16; i++ ) - output[i] = input[i] ^ iv[i]; + input += 16; + output += 16; + length -= 16; + } + } + else + { + while (length > 0) + { + for (i = 0; i < 16; i++) + output[i] = input[i] ^ iv[i]; - aes_crypt_ecb( ctx, mode, output, output ); - memcpy( iv, output, 16 ); + aes_crypt_ecb(ctx, mode, output, output); + memcpy(iv, output, 16); - input += 16; - output += 16; - length -= 16; - } - } + input += 16; + output += 16; + length -= 16; + } + } - return( 0 ); + return (0); } /* * AES-CFB128 buffer encryption/decryption */ -int aes_crypt_cfb128( aes_context *ctx, - int mode, - size_t length, - size_t *iv_off, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output ) +int aes_crypt_cfb128(aes_context* ctx, + int mode, + size_t length, + size_t* iv_off, + unsigned char iv[16], + const unsigned char* input, + unsigned char* output) { - int c; - size_t n = *iv_off; + int c; + size_t n = *iv_off; - if( mode == AES_DECRYPT ) - { - while( length-- ) - { - if( n == 0 ) - aes_crypt_ecb( ctx, AES_ENCRYPT, iv, iv ); + if (mode == AES_DECRYPT) + { + while (length--) + { + if (n == 0) + aes_crypt_ecb(ctx, AES_ENCRYPT, iv, iv); - c = *input++; - *output++ = static_cast( c ^ iv[n] ); - iv[n] = static_cast(c); + c = *input++; + *output++ = static_cast(c ^ iv[n]); + iv[n] = static_cast(c); - n = (n + 1) & 0x0F; - } - } - else - { - while( length-- ) - { - if( n == 0 ) - aes_crypt_ecb( ctx, AES_ENCRYPT, iv, iv ); + n = (n + 1) & 0x0F; + } + } + else + { + while (length--) + { + if (n == 0) + aes_crypt_ecb(ctx, AES_ENCRYPT, iv, iv); - iv[n] = *output++ = static_cast( iv[n] ^ *input++ ); + iv[n] = *output++ = static_cast(iv[n] ^ *input++); - n = (n + 1) & 0x0F; - } - } + n = (n + 1) & 0x0F; + } + } - *iv_off = n; + *iv_off = n; - return( 0 ); + return (0); } /* * AES-CTR buffer encryption/decryption */ -int aes_crypt_ctr( aes_context *ctx, - size_t length, - size_t *nc_off, - unsigned char nonce_counter[16], - unsigned char stream_block[16], - const unsigned char *input, - unsigned char *output ) +int aes_crypt_ctr(aes_context* ctx, + size_t length, + size_t* nc_off, + unsigned char nonce_counter[16], + unsigned char stream_block[16], + const unsigned char* input, + unsigned char* output) { - int c, i; - size_t n = *nc_off; + int c, i; + size_t n = *nc_off; - while( length-- ) - { - if( n == 0 ) { - aes_crypt_ecb( ctx, AES_ENCRYPT, nonce_counter, stream_block ); + while (length--) + { + if (n == 0) + { + aes_crypt_ecb(ctx, AES_ENCRYPT, nonce_counter, stream_block); - for( i = 16; i > 0; i-- ) - if( ++nonce_counter[i - 1] != 0 ) - break; - } - c = *input++; - *output++ = static_cast( c ^ stream_block[n] ); + for (i = 16; i > 0; i--) + if (++nonce_counter[i - 1] != 0) + break; + } + c = *input++; + *output++ = static_cast(c ^ stream_block[n]); - n = (n + 1) & 0x0F; - } + n = (n + 1) & 0x0F; + } - *nc_off = n; + *nc_off = n; - return( 0 ); + return (0); } /* AES-CMAC */ unsigned char const_Rb[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87 -}; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87}; unsigned char const_Zero[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -void leftshift_onebit(const unsigned char *input, unsigned char *output) +void leftshift_onebit(const unsigned char* input, unsigned char* output) { int i; - unsigned char overflow = 0; + unsigned char overflow = 0; for (i = 15; i >= 0; i--) { @@ -910,91 +910,101 @@ void leftshift_onebit(const unsigned char *input, unsigned char *output) } } -void xor_128(const unsigned char *a, const unsigned char *b, unsigned char *out) +void xor_128(const unsigned char* a, const unsigned char* b, unsigned char* out) { int i; for (i = 0; i < 16; i++) out[i] = a[i] ^ b[i]; } -void generate_subkey(aes_context *ctx, unsigned char *K1, unsigned char *K2) +void generate_subkey(aes_context* ctx, unsigned char* K1, unsigned char* K2) { unsigned char L[16]; unsigned char Z[16]; unsigned char tmp[16]; int i; - for (i = 0; i < 16; i++) Z[i] = 0; + for (i = 0; i < 16; i++) + Z[i] = 0; aes_crypt_ecb(ctx, AES_ENCRYPT, Z, L); if ((L[0] & 0x80) == 0) { - leftshift_onebit(L,K1); - } else { - leftshift_onebit(L,tmp); - xor_128(tmp,const_Rb,K1); - } + leftshift_onebit(L, K1); + } + else + { + leftshift_onebit(L, tmp); + xor_128(tmp, const_Rb, K1); + } if ((K1[0] & 0x80) == 0) { - leftshift_onebit(K1,K2); - } else { - leftshift_onebit(K1,tmp); - xor_128(tmp,const_Rb,K2); - } + leftshift_onebit(K1, K2); + } + else + { + leftshift_onebit(K1, tmp); + xor_128(tmp, const_Rb, K2); + } } -void padding(const unsigned char *lastb, unsigned char *pad, size_t length) +void padding(const unsigned char* lastb, unsigned char* pad, size_t length) { for (unsigned int i = 0; i < 16; i++) { if (i < length) pad[i] = lastb[i]; - else if (i == length) - pad[i] = 0x80; - else - pad[i] = 0x00; + else if (i == length) + pad[i] = 0x80; + else + pad[i] = 0x00; } } -void aes_cmac(aes_context *ctx, size_t length, unsigned char *input, unsigned char *output) +void aes_cmac(aes_context* ctx, size_t length, unsigned char* input, unsigned char* output) { - unsigned char X[16], Y[16], M_last[16], padded[16]; - unsigned char K1[16], K2[16]; - int i, flag; - generate_subkey(ctx, K1, K2); + unsigned char X[16], Y[16], M_last[16], padded[16]; + unsigned char K1[16], K2[16]; + int i, flag; + generate_subkey(ctx, K1, K2); - size_t n = (length + 15) / 16; - if (n == 0) + size_t n = (length + 15) / 16; + if (n == 0) + { + n = 1; + flag = 0; + } + else { - n = 1; - flag = 0; - } else { if ((length % 16) == 0) - flag = 1; + flag = 1; else flag = 0; - } + } - if (flag) + if (flag) { - xor_128(&input[16 * (n - 1)], K1, M_last); - } else { - padding(&input[16 * (n - 1)], padded, length % 16); - xor_128(padded, K2, M_last); - } + xor_128(&input[16 * (n - 1)], K1, M_last); + } + else + { + padding(&input[16 * (n - 1)], padded, length % 16); + xor_128(padded, K2, M_last); + } - for (i = 0; i < 16; i++) X[i] = 0; - for (size_t i = 0; i < n - 1; i++) - { - xor_128(X, &input[16*i], Y); + for (i = 0; i < 16; i++) + X[i] = 0; + for (size_t i = 0; i < n - 1; i++) + { + xor_128(X, &input[16 * i], Y); aes_crypt_ecb(ctx, AES_ENCRYPT, Y, X); - } + } - xor_128(X,M_last,Y); - aes_crypt_ecb(ctx, AES_ENCRYPT, Y, X); + xor_128(X, M_last, Y); + aes_crypt_ecb(ctx, AES_ENCRYPT, Y, X); - for (i = 0; i < 16; i++) + for (i = 0; i < 16; i++) output[i] = X[i]; } diff --git a/rpcs3/rpcs3/Crypto/aes.h b/rpcs3/rpcs3/Crypto/aes.h index 42e20e664..860935ab2 100644 --- a/rpcs3/rpcs3/Crypto/aes.h +++ b/rpcs3/rpcs3/Crypto/aes.h @@ -35,11 +35,11 @@ typedef UINT32 uint32_t; #include #endif -#define AES_ENCRYPT 1 -#define AES_DECRYPT 0 +#define AES_ENCRYPT 1 +#define AES_DECRYPT 0 -#define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0020 /**< Invalid key length. */ -#define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH -0x0022 /**< Invalid data input length. */ +#define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0020 /**< Invalid key length. */ +#define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH -0x0022 /**< Invalid data input length. */ // Regular implementation // @@ -49,130 +49,130 @@ typedef UINT32 uint32_t; */ typedef struct { - int nr; /*!< number of rounds */ - uint32_t *rk; /*!< AES round keys */ - uint32_t buf[68]; /*!< unaligned data */ -} -aes_context; + int nr; /*!< number of rounds */ + uint32_t* rk; /*!< AES round keys */ + uint32_t buf[68]; /*!< unaligned data */ +} aes_context; #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif -/** - * \brief AES key schedule (encryption) - * - * \param ctx AES context to be initialized - * \param key encryption key - * \param keysize must be 128, 192 or 256 - * - * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH - */ -int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int keysize ); + /** + * \brief AES key schedule (encryption) + * + * \param ctx AES context to be initialized + * \param key encryption key + * \param keysize must be 128, 192 or 256 + * + * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH + */ + int aes_setkey_enc(aes_context* ctx, const unsigned char* key, unsigned int keysize); -/** - * \brief AES key schedule (decryption) - * - * \param ctx AES context to be initialized - * \param key decryption key - * \param keysize must be 128, 192 or 256 - * - * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH - */ -int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int keysize ); + /** + * \brief AES key schedule (decryption) + * + * \param ctx AES context to be initialized + * \param key decryption key + * \param keysize must be 128, 192 or 256 + * + * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH + */ + int aes_setkey_dec(aes_context* ctx, const unsigned char* key, unsigned int keysize); -/** - * \brief AES-ECB block encryption/decryption - * - * \param ctx AES context - * \param mode AES_ENCRYPT or AES_DECRYPT - * \param input 16-byte input block - * \param output 16-byte output block - * - * \return 0 if successful - */ -int aes_crypt_ecb( aes_context *ctx, - int mode, - const unsigned char input[16], - unsigned char output[16] ); + /** + * \brief AES-ECB block encryption/decryption + * + * \param ctx AES context + * \param mode AES_ENCRYPT or AES_DECRYPT + * \param input 16-byte input block + * \param output 16-byte output block + * + * \return 0 if successful + */ + int aes_crypt_ecb(aes_context* ctx, + int mode, + const unsigned char input[16], + unsigned char output[16]); -/** - * \brief AES-CBC buffer encryption/decryption - * Length should be a multiple of the block - * size (16 bytes) - * - * \param ctx AES context - * \param mode AES_ENCRYPT or AES_DECRYPT - * \param length length of the input data - * \param iv initialization vector (updated after use) - * \param input buffer holding the input data - * \param output buffer holding the output data - * - * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_INPUT_LENGTH - */ -int aes_crypt_cbc( aes_context *ctx, - int mode, - size_t length, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output ); + /** + * \brief AES-CBC buffer encryption/decryption + * Length should be a multiple of the block + * size (16 bytes) + * + * \param ctx AES context + * \param mode AES_ENCRYPT or AES_DECRYPT + * \param length length of the input data + * \param iv initialization vector (updated after use) + * \param input buffer holding the input data + * \param output buffer holding the output data + * + * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_INPUT_LENGTH + */ + int aes_crypt_cbc(aes_context* ctx, + int mode, + size_t length, + unsigned char iv[16], + const unsigned char* input, + unsigned char* output); -/** - * \brief AES-CFB128 buffer encryption/decryption. - * - * Note: Due to the nature of CFB you should use the same key schedule for - * both encryption and decryption. So a context initialized with - * aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT. - * - * both - * \param ctx AES context - * \param mode AES_ENCRYPT or AES_DECRYPT - * \param length length of the input data - * \param iv_off offset in IV (updated after use) - * \param iv initialization vector (updated after use) - * \param input buffer holding the input data - * \param output buffer holding the output data - * - * \return 0 if successful - */ -int aes_crypt_cfb128( aes_context *ctx, - int mode, - size_t length, - size_t *iv_off, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output ); + /** + * \brief AES-CFB128 buffer encryption/decryption. + * + * Note: Due to the nature of CFB you should use the same key schedule for + * both encryption and decryption. So a context initialized with + * aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT. + * + * both + * \param ctx AES context + * \param mode AES_ENCRYPT or AES_DECRYPT + * \param length length of the input data + * \param iv_off offset in IV (updated after use) + * \param iv initialization vector (updated after use) + * \param input buffer holding the input data + * \param output buffer holding the output data + * + * \return 0 if successful + */ + int aes_crypt_cfb128(aes_context* ctx, + int mode, + size_t length, + size_t* iv_off, + unsigned char iv[16], + const unsigned char* input, + unsigned char* output); -/** - * \brief AES-CTR buffer encryption/decryption - * - * Warning: You have to keep the maximum use of your counter in mind! - * - * Note: Due to the nature of CTR you should use the same key schedule for - * both encryption and decryption. So a context initialized with - * aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT. - * - * \param length The length of the data - * \param nc_off The offset in the current stream_block (for resuming - * within current cipher stream). The offset pointer to - * should be 0 at the start of a stream. - * \param nonce_counter The 128-bit nonce and counter. - * \param stream_block The saved stream-block for resuming. Is overwritten - * by the function. - * \param input The input data stream - * \param output The output data stream - * - * \return 0 if successful - */ -int aes_crypt_ctr( aes_context *ctx, - size_t length, - size_t *nc_off, - unsigned char nonce_counter[16], - unsigned char stream_block[16], - const unsigned char *input, - unsigned char *output ); + /** + * \brief AES-CTR buffer encryption/decryption + * + * Warning: You have to keep the maximum use of your counter in mind! + * + * Note: Due to the nature of CTR you should use the same key schedule for + * both encryption and decryption. So a context initialized with + * aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT. + * + * \param length The length of the data + * \param nc_off The offset in the current stream_block (for resuming + * within current cipher stream). The offset pointer to + * should be 0 at the start of a stream. + * \param nonce_counter The 128-bit nonce and counter. + * \param stream_block The saved stream-block for resuming. Is overwritten + * by the function. + * \param input The input data stream + * \param output The output data stream + * + * \return 0 if successful + */ + int aes_crypt_ctr(aes_context* ctx, + size_t length, + size_t* nc_off, + unsigned char nonce_counter[16], + unsigned char stream_block[16], + const unsigned char* input, + unsigned char* output); -void aes_cmac(aes_context *ctx, size_t length, unsigned char *input, unsigned char *output); + void aes_cmac(aes_context* ctx, size_t length, unsigned char* input, unsigned char* output); #ifdef __cplusplus } diff --git a/rpcs3/rpcs3/Crypto/aesni.cpp b/rpcs3/rpcs3/Crypto/aesni.cpp index 05bb65fe7..922fedf08 100644 --- a/rpcs3/rpcs3/Crypto/aesni.cpp +++ b/rpcs3/rpcs3/Crypto/aesni.cpp @@ -40,151 +40,151 @@ /* * AES-NI support detection routine */ -int aesni_supports( unsigned int what ) +int aesni_supports(unsigned int what) { - static int done = 0; - static unsigned int c = 0; + static int done = 0; + static unsigned int c = 0; - if( ! done ) - { + if (!done) + { #if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS) - int regs[4]; // eax, ebx, ecx, edx - __cpuid( regs, 1 ); - c = regs[2]; + int regs[4]; // eax, ebx, ecx, edx + __cpuid(regs, 1); + c = regs[2]; #else - asm( "movl $1, %%eax \n" - "cpuid \n" - : "=c" (c) - : - : "eax", "ebx", "edx" ); + asm("movl $1, %%eax \n" + "cpuid \n" + : "=c"(c) + : + : "eax", "ebx", "edx"); #endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */ - done = 1; - } + done = 1; + } - return( ( c & what ) != 0 ); + return ((c & what) != 0); } /* * AES-NI AES-ECB block en(de)cryption */ -int aesni_crypt_ecb( aes_context *ctx, - int mode, - const unsigned char input[16], - unsigned char output[16] ) +int aesni_crypt_ecb(aes_context* ctx, + int mode, + const unsigned char input[16], + unsigned char output[16]) { #if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS) - __m128i* rk, a; - int i; + __m128i *rk, a; + int i; - rk = (__m128i*)ctx->rk; - a = _mm_xor_si128( _mm_loadu_si128( (__m128i*)input ), _mm_loadu_si128( rk++ ) ); + rk = (__m128i*)ctx->rk; + a = _mm_xor_si128(_mm_loadu_si128((__m128i*)input), _mm_loadu_si128(rk++)); - if (mode == AES_ENCRYPT) - { - for (i = ctx->nr - 1; i; --i) - a = _mm_aesenc_si128( a, _mm_loadu_si128( rk++ ) ); - a = _mm_aesenclast_si128( a, _mm_loadu_si128( rk ) ); - } - else - { - for (i = ctx->nr - 1; i; --i) - a = _mm_aesdec_si128( a, _mm_loadu_si128( rk++ ) ); - a = _mm_aesdeclast_si128( a, _mm_loadu_si128( rk ) ); - } + if (mode == AES_ENCRYPT) + { + for (i = ctx->nr - 1; i; --i) + a = _mm_aesenc_si128(a, _mm_loadu_si128(rk++)); + a = _mm_aesenclast_si128(a, _mm_loadu_si128(rk)); + } + else + { + for (i = ctx->nr - 1; i; --i) + a = _mm_aesdec_si128(a, _mm_loadu_si128(rk++)); + a = _mm_aesdeclast_si128(a, _mm_loadu_si128(rk)); + } - _mm_storeu_si128( (__m128i*)output, a ); + _mm_storeu_si128((__m128i*)output, a); #else - asm( "movdqu (%3), %%xmm0 \n" // load input - "movdqu (%1), %%xmm1 \n" // load round key 0 - "pxor %%xmm1, %%xmm0 \n" // round 0 - "addq $16, %1 \n" // point to next round key - "subl $1, %0 \n" // normal rounds = nr - 1 - "test %2, %2 \n" // mode? - "jz 2f \n" // 0 = decrypt + asm("movdqu (%3), %%xmm0 \n" // load input + "movdqu (%1), %%xmm1 \n" // load round key 0 + "pxor %%xmm1, %%xmm0 \n" // round 0 + "addq $16, %1 \n" // point to next round key + "subl $1, %0 \n" // normal rounds = nr - 1 + "test %2, %2 \n" // mode? + "jz 2f \n" // 0 = decrypt - "1: \n" // encryption loop - "movdqu (%1), %%xmm1 \n" // load round key - "aesenc %%xmm1, %%xmm0 \n" // do round - "addq $16, %1 \n" // point to next round key - "subl $1, %0 \n" // loop - "jnz 1b \n" - "movdqu (%1), %%xmm1 \n" // load round key - "aesenclast %%xmm1, %%xmm0 \n" // last round - "jmp 3f \n" + "1: \n" // encryption loop + "movdqu (%1), %%xmm1 \n" // load round key + "aesenc %%xmm1, %%xmm0 \n" // do round + "addq $16, %1 \n" // point to next round key + "subl $1, %0 \n" // loop + "jnz 1b \n" + "movdqu (%1), %%xmm1 \n" // load round key + "aesenclast %%xmm1, %%xmm0 \n" // last round + "jmp 3f \n" - "2: \n" // decryption loop - "movdqu (%1), %%xmm1 \n" - "aesdec %%xmm1, %%xmm0 \n" - "addq $16, %1 \n" - "subl $1, %0 \n" - "jnz 2b \n" - "movdqu (%1), %%xmm1 \n" // load round key - "aesdeclast %%xmm1, %%xmm0 \n" // last round + "2: \n" // decryption loop + "movdqu (%1), %%xmm1 \n" + "aesdec %%xmm1, %%xmm0 \n" + "addq $16, %1 \n" + "subl $1, %0 \n" + "jnz 2b \n" + "movdqu (%1), %%xmm1 \n" // load round key + "aesdeclast %%xmm1, %%xmm0 \n" // last round - "3: \n" - "movdqu %%xmm0, (%4) \n" // export output - : - : "r" (ctx->nr), "r" (ctx->rk), "r" (mode), "r" (input), "r" (output) - : "memory", "cc", "xmm0", "xmm1" ); + "3: \n" + "movdqu %%xmm0, (%4) \n" // export output + : + : "r"(ctx->nr), "r"(ctx->rk), "r"(mode), "r"(input), "r"(output) + : "memory", "cc", "xmm0", "xmm1"); #endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */ - return( 0 ); + return (0); } #if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS) -static inline void clmul256( __m128i a, __m128i b, __m128i* r0, __m128i* r1 ) +static inline void clmul256(__m128i a, __m128i b, __m128i* r0, __m128i* r1) { - __m128i c, d, e, f, ef; - c = _mm_clmulepi64_si128( a, b, 0x00 ); - d = _mm_clmulepi64_si128( a, b, 0x11 ); - e = _mm_clmulepi64_si128( a, b, 0x10 ); - f = _mm_clmulepi64_si128( a, b, 0x01 ); + __m128i c, d, e, f, ef; + c = _mm_clmulepi64_si128(a, b, 0x00); + d = _mm_clmulepi64_si128(a, b, 0x11); + e = _mm_clmulepi64_si128(a, b, 0x10); + f = _mm_clmulepi64_si128(a, b, 0x01); - // r0 = f0^e0^c1:c0 = c1:c0 ^ f0^e0:0 - // r1 = d1:f1^e1^d0 = d1:d0 ^ 0:f1^e1 + // r0 = f0^e0^c1:c0 = c1:c0 ^ f0^e0:0 + // r1 = d1:f1^e1^d0 = d1:d0 ^ 0:f1^e1 - ef = _mm_xor_si128( e, f ); - *r0 = _mm_xor_si128( c, _mm_slli_si128( ef, 8 ) ); - *r1 = _mm_xor_si128( d, _mm_srli_si128( ef, 8 ) ); + ef = _mm_xor_si128(e, f); + *r0 = _mm_xor_si128(c, _mm_slli_si128(ef, 8)); + *r1 = _mm_xor_si128(d, _mm_srli_si128(ef, 8)); } -static inline void sll256( __m128i a0, __m128i a1, __m128i* s0, __m128i* s1 ) +static inline void sll256(__m128i a0, __m128i a1, __m128i* s0, __m128i* s1) { - __m128i l0, l1, r0, r1; + __m128i l0, l1, r0, r1; - l0 = _mm_slli_epi64( a0, 1 ); - l1 = _mm_slli_epi64( a1, 1 ); + l0 = _mm_slli_epi64(a0, 1); + l1 = _mm_slli_epi64(a1, 1); - r0 = _mm_srli_epi64( a0, 63 ); - r1 = _mm_srli_epi64( a1, 63 ); + r0 = _mm_srli_epi64(a0, 63); + r1 = _mm_srli_epi64(a1, 63); - *s0 = _mm_or_si128( l0, _mm_slli_si128( r0, 8 ) ); - *s1 = _mm_or_si128( _mm_or_si128( l1, _mm_srli_si128( r0, 8 ) ), _mm_slli_si128( r1, 8 ) ); + *s0 = _mm_or_si128(l0, _mm_slli_si128(r0, 8)); + *s1 = _mm_or_si128(_mm_or_si128(l1, _mm_srli_si128(r0, 8)), _mm_slli_si128(r1, 8)); } -static inline __m128i reducemod128( __m128i x10, __m128i x32 ) +static inline __m128i reducemod128(__m128i x10, __m128i x32) { - __m128i a, b, c, dx0, e, f, g, h; + __m128i a, b, c, dx0, e, f, g, h; - // (1) left shift x0 by 63, 62 and 57 - a = _mm_slli_epi64( x10, 63 ); - b = _mm_slli_epi64( x10, 62 ); - c = _mm_slli_epi64( x10, 57 ); + // (1) left shift x0 by 63, 62 and 57 + a = _mm_slli_epi64(x10, 63); + b = _mm_slli_epi64(x10, 62); + c = _mm_slli_epi64(x10, 57); - // (2) compute D xor'ing a, b, c and x1 - // d:x0 = x1:x0 ^ [a^b^c:0] - dx0 = _mm_xor_si128( x10, _mm_slli_si128( _mm_xor_si128( _mm_xor_si128( a, b ), c ), 8 ) ); + // (2) compute D xor'ing a, b, c and x1 + // d:x0 = x1:x0 ^ [a^b^c:0] + dx0 = _mm_xor_si128(x10, _mm_slli_si128(_mm_xor_si128(_mm_xor_si128(a, b), c), 8)); - // (3) right shift [d:x0] by 1, 2, 7 - e = _mm_or_si128( _mm_srli_epi64( dx0, 1 ), _mm_srli_si128( _mm_slli_epi64( dx0, 63 ), 8 ) ); - f = _mm_or_si128( _mm_srli_epi64( dx0, 2 ), _mm_srli_si128( _mm_slli_epi64( dx0, 62 ), 8 ) ); - g = _mm_or_si128( _mm_srli_epi64( dx0, 7 ), _mm_srli_si128( _mm_slli_epi64( dx0, 57 ), 8 ) ); + // (3) right shift [d:x0] by 1, 2, 7 + e = _mm_or_si128(_mm_srli_epi64(dx0, 1), _mm_srli_si128(_mm_slli_epi64(dx0, 63), 8)); + f = _mm_or_si128(_mm_srli_epi64(dx0, 2), _mm_srli_si128(_mm_slli_epi64(dx0, 62), 8)); + g = _mm_or_si128(_mm_srli_epi64(dx0, 7), _mm_srli_si128(_mm_slli_epi64(dx0, 57), 8)); - // (4) compute h = d^e1^f1^g1 : x0^e0^f0^g0 - h = _mm_xor_si128( dx0, _mm_xor_si128( e, _mm_xor_si128( f, g ) ) ); + // (4) compute h = d^e1^f1^g1 : x0^e0^f0^g0 + h = _mm_xor_si128(dx0, _mm_xor_si128(e, _mm_xor_si128(f, g))); - // result is x3^h1:x2^h0 - return _mm_xor_si128( x32, h ); + // result is x3^h1:x2^h0 + return _mm_xor_si128(x32, h); } #endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */ @@ -192,495 +192,495 @@ static inline __m128i reducemod128( __m128i x10, __m128i x32 ) * GCM multiplication: c = a times b in GF(2^128) * Based on [CLMUL-WP] algorithms 1 (with equation 27) and 5. */ -void aesni_gcm_mult( unsigned char c[16], - const unsigned char a[16], - const unsigned char b[16] ) +void aesni_gcm_mult(unsigned char c[16], + const unsigned char a[16], + const unsigned char b[16]) { #if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS) - __m128i xa, xb, m0, m1, x10, x32, r; + __m128i xa, xb, m0, m1, x10, x32, r; - xa.m128i_u64[1] = _byteswap_uint64( *((unsigned __int64*)a + 0) ); - xa.m128i_u64[0] = _byteswap_uint64( *((unsigned __int64*)a + 1) ); - xb.m128i_u64[1] = _byteswap_uint64( *((unsigned __int64*)b + 0) ); - xb.m128i_u64[0] = _byteswap_uint64( *((unsigned __int64*)b + 1) ); + xa.m128i_u64[1] = _byteswap_uint64(*((unsigned __int64*)a + 0)); + xa.m128i_u64[0] = _byteswap_uint64(*((unsigned __int64*)a + 1)); + xb.m128i_u64[1] = _byteswap_uint64(*((unsigned __int64*)b + 0)); + xb.m128i_u64[0] = _byteswap_uint64(*((unsigned __int64*)b + 1)); - clmul256( xa, xb, &m0, &m1 ); - sll256( m0, m1, &x10, &x32 ); - r = reducemod128( x10, x32 ); + clmul256(xa, xb, &m0, &m1); + sll256(m0, m1, &x10, &x32); + r = reducemod128(x10, x32); - *((unsigned __int64*)c + 0) = _byteswap_uint64( r.m128i_u64[1] ); - *((unsigned __int64*)c + 1) = _byteswap_uint64( r.m128i_u64[0] ); + *((unsigned __int64*)c + 0) = _byteswap_uint64(r.m128i_u64[1]); + *((unsigned __int64*)c + 1) = _byteswap_uint64(r.m128i_u64[0]); #else - unsigned char aa[16], bb[16], cc[16]; - size_t i; + unsigned char aa[16], bb[16], cc[16]; + size_t i; - /* The inputs are in big-endian order, so byte-reverse them */ - for( i = 0; i < 16; i++ ) - { - aa[i] = a[15 - i]; - bb[i] = b[15 - i]; - } + /* The inputs are in big-endian order, so byte-reverse them */ + for (i = 0; i < 16; i++) + { + aa[i] = a[15 - i]; + bb[i] = b[15 - i]; + } - asm( "movdqu (%0), %%xmm0 \n" // a1:a0 - "movdqu (%1), %%xmm1 \n" // b1:b0 + asm("movdqu (%0), %%xmm0 \n" // a1:a0 + "movdqu (%1), %%xmm1 \n" // b1:b0 - /* - * Caryless multiplication xmm2:xmm1 = xmm0 * xmm1 - * using [CLMUL-WP] algorithm 1 (p. 13). - */ - "movdqa %%xmm1, %%xmm2 \n" // copy of b1:b0 - "movdqa %%xmm1, %%xmm3 \n" // same - "movdqa %%xmm1, %%xmm4 \n" // same - "pclmulqdq $0x00, %%xmm0, %%xmm1 \n" // a0*b0 = c1:c0 - "pclmulqdq $0x11, %%xmm0, %%xmm2 \n" // a1*b1 = d1:d0 - "pclmulqdq $0x10, %%xmm0, %%xmm3 \n" // a0*b1 = e1:e0 - "pclmulqdq $0x01, %%xmm0, %%xmm4 \n" // a1*b0 = f1:f0 - "pxor %%xmm3, %%xmm4 \n" // e1+f1:e0+f0 - "movdqa %%xmm4, %%xmm3 \n" // same - "psrldq $8, %%xmm4 \n" // 0:e1+f1 - "pslldq $8, %%xmm3 \n" // e0+f0:0 - "pxor %%xmm4, %%xmm2 \n" // d1:d0+e1+f1 - "pxor %%xmm3, %%xmm1 \n" // c1+e0+f1:c0 + /* + * Caryless multiplication xmm2:xmm1 = xmm0 * xmm1 + * using [CLMUL-WP] algorithm 1 (p. 13). + */ + "movdqa %%xmm1, %%xmm2 \n" // copy of b1:b0 + "movdqa %%xmm1, %%xmm3 \n" // same + "movdqa %%xmm1, %%xmm4 \n" // same + "pclmulqdq $0x00, %%xmm0, %%xmm1 \n" // a0*b0 = c1:c0 + "pclmulqdq $0x11, %%xmm0, %%xmm2 \n" // a1*b1 = d1:d0 + "pclmulqdq $0x10, %%xmm0, %%xmm3 \n" // a0*b1 = e1:e0 + "pclmulqdq $0x01, %%xmm0, %%xmm4 \n" // a1*b0 = f1:f0 + "pxor %%xmm3, %%xmm4 \n" // e1+f1:e0+f0 + "movdqa %%xmm4, %%xmm3 \n" // same + "psrldq $8, %%xmm4 \n" // 0:e1+f1 + "pslldq $8, %%xmm3 \n" // e0+f0:0 + "pxor %%xmm4, %%xmm2 \n" // d1:d0+e1+f1 + "pxor %%xmm3, %%xmm1 \n" // c1+e0+f1:c0 - /* - * Now shift the result one bit to the left, - * taking advantage of [CLMUL-WP] eq 27 (p. 20) - */ - "movdqa %%xmm1, %%xmm3 \n" // r1:r0 - "movdqa %%xmm2, %%xmm4 \n" // r3:r2 - "psllq $1, %%xmm1 \n" // r1<<1:r0<<1 - "psllq $1, %%xmm2 \n" // r3<<1:r2<<1 - "psrlq $63, %%xmm3 \n" // r1>>63:r0>>63 - "psrlq $63, %%xmm4 \n" // r3>>63:r2>>63 - "movdqa %%xmm3, %%xmm5 \n" // r1>>63:r0>>63 - "pslldq $8, %%xmm3 \n" // r0>>63:0 - "pslldq $8, %%xmm4 \n" // r2>>63:0 - "psrldq $8, %%xmm5 \n" // 0:r1>>63 - "por %%xmm3, %%xmm1 \n" // r1<<1|r0>>63:r0<<1 - "por %%xmm4, %%xmm2 \n" // r3<<1|r2>>62:r2<<1 - "por %%xmm5, %%xmm2 \n" // r3<<1|r2>>62:r2<<1|r1>>63 + /* + * Now shift the result one bit to the left, + * taking advantage of [CLMUL-WP] eq 27 (p. 20) + */ + "movdqa %%xmm1, %%xmm3 \n" // r1:r0 + "movdqa %%xmm2, %%xmm4 \n" // r3:r2 + "psllq $1, %%xmm1 \n" // r1<<1:r0<<1 + "psllq $1, %%xmm2 \n" // r3<<1:r2<<1 + "psrlq $63, %%xmm3 \n" // r1>>63:r0>>63 + "psrlq $63, %%xmm4 \n" // r3>>63:r2>>63 + "movdqa %%xmm3, %%xmm5 \n" // r1>>63:r0>>63 + "pslldq $8, %%xmm3 \n" // r0>>63:0 + "pslldq $8, %%xmm4 \n" // r2>>63:0 + "psrldq $8, %%xmm5 \n" // 0:r1>>63 + "por %%xmm3, %%xmm1 \n" // r1<<1|r0>>63:r0<<1 + "por %%xmm4, %%xmm2 \n" // r3<<1|r2>>62:r2<<1 + "por %%xmm5, %%xmm2 \n" // r3<<1|r2>>62:r2<<1|r1>>63 - /* - * Now reduce modulo the GCM polynomial x^128 + x^7 + x^2 + x + 1 - * using [CLMUL-WP] algorithm 5 (p. 20). - * Currently xmm2:xmm1 holds x3:x2:x1:x0 (already shifted). - */ - /* Step 2 (1) */ - "movdqa %%xmm1, %%xmm3 \n" // x1:x0 - "movdqa %%xmm1, %%xmm4 \n" // same - "movdqa %%xmm1, %%xmm5 \n" // same - "psllq $63, %%xmm3 \n" // x1<<63:x0<<63 = stuff:a - "psllq $62, %%xmm4 \n" // x1<<62:x0<<62 = stuff:b - "psllq $57, %%xmm5 \n" // x1<<57:x0<<57 = stuff:c + /* + * Now reduce modulo the GCM polynomial x^128 + x^7 + x^2 + x + 1 + * using [CLMUL-WP] algorithm 5 (p. 20). + * Currently xmm2:xmm1 holds x3:x2:x1:x0 (already shifted). + */ + /* Step 2 (1) */ + "movdqa %%xmm1, %%xmm3 \n" // x1:x0 + "movdqa %%xmm1, %%xmm4 \n" // same + "movdqa %%xmm1, %%xmm5 \n" // same + "psllq $63, %%xmm3 \n" // x1<<63:x0<<63 = stuff:a + "psllq $62, %%xmm4 \n" // x1<<62:x0<<62 = stuff:b + "psllq $57, %%xmm5 \n" // x1<<57:x0<<57 = stuff:c - /* Step 2 (2) */ - "pxor %%xmm4, %%xmm3 \n" // stuff:a+b - "pxor %%xmm5, %%xmm3 \n" // stuff:a+b+c - "pslldq $8, %%xmm3 \n" // a+b+c:0 - "pxor %%xmm3, %%xmm1 \n" // x1+a+b+c:x0 = d:x0 + /* Step 2 (2) */ + "pxor %%xmm4, %%xmm3 \n" // stuff:a+b + "pxor %%xmm5, %%xmm3 \n" // stuff:a+b+c + "pslldq $8, %%xmm3 \n" // a+b+c:0 + "pxor %%xmm3, %%xmm1 \n" // x1+a+b+c:x0 = d:x0 - /* Steps 3 and 4 */ - "movdqa %%xmm1,%%xmm0 \n" // d:x0 - "movdqa %%xmm1,%%xmm4 \n" // same - "movdqa %%xmm1,%%xmm5 \n" // same - "psrlq $1, %%xmm0 \n" // e1:x0>>1 = e1:e0' - "psrlq $2, %%xmm4 \n" // f1:x0>>2 = f1:f0' - "psrlq $7, %%xmm5 \n" // g1:x0>>7 = g1:g0' - "pxor %%xmm4, %%xmm0 \n" // e1+f1:e0'+f0' - "pxor %%xmm5, %%xmm0 \n" // e1+f1+g1:e0'+f0'+g0' - // e0'+f0'+g0' is almost e0+f0+g0, except for some missing - // bits carried from d. Now get those bits back in. - "movdqa %%xmm1,%%xmm3 \n" // d:x0 - "movdqa %%xmm1,%%xmm4 \n" // same - "movdqa %%xmm1,%%xmm5 \n" // same - "psllq $63, %%xmm3 \n" // d<<63:stuff - "psllq $62, %%xmm4 \n" // d<<62:stuff - "psllq $57, %%xmm5 \n" // d<<57:stuff - "pxor %%xmm4, %%xmm3 \n" // d<<63+d<<62:stuff - "pxor %%xmm5, %%xmm3 \n" // missing bits of d:stuff - "psrldq $8, %%xmm3 \n" // 0:missing bits of d - "pxor %%xmm3, %%xmm0 \n" // e1+f1+g1:e0+f0+g0 - "pxor %%xmm1, %%xmm0 \n" // h1:h0 - "pxor %%xmm2, %%xmm0 \n" // x3+h1:x2+h0 + /* Steps 3 and 4 */ + "movdqa %%xmm1,%%xmm0 \n" // d:x0 + "movdqa %%xmm1,%%xmm4 \n" // same + "movdqa %%xmm1,%%xmm5 \n" // same + "psrlq $1, %%xmm0 \n" // e1:x0>>1 = e1:e0' + "psrlq $2, %%xmm4 \n" // f1:x0>>2 = f1:f0' + "psrlq $7, %%xmm5 \n" // g1:x0>>7 = g1:g0' + "pxor %%xmm4, %%xmm0 \n" // e1+f1:e0'+f0' + "pxor %%xmm5, %%xmm0 \n" // e1+f1+g1:e0'+f0'+g0' + // e0'+f0'+g0' is almost e0+f0+g0, except for some missing + // bits carried from d. Now get those bits back in. + "movdqa %%xmm1,%%xmm3 \n" // d:x0 + "movdqa %%xmm1,%%xmm4 \n" // same + "movdqa %%xmm1,%%xmm5 \n" // same + "psllq $63, %%xmm3 \n" // d<<63:stuff + "psllq $62, %%xmm4 \n" // d<<62:stuff + "psllq $57, %%xmm5 \n" // d<<57:stuff + "pxor %%xmm4, %%xmm3 \n" // d<<63+d<<62:stuff + "pxor %%xmm5, %%xmm3 \n" // missing bits of d:stuff + "psrldq $8, %%xmm3 \n" // 0:missing bits of d + "pxor %%xmm3, %%xmm0 \n" // e1+f1+g1:e0+f0+g0 + "pxor %%xmm1, %%xmm0 \n" // h1:h0 + "pxor %%xmm2, %%xmm0 \n" // x3+h1:x2+h0 - "movdqu %%xmm0, (%2) \n" // done - : - : "r" (aa), "r" (bb), "r" (cc) - : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5" ); + "movdqu %%xmm0, (%2) \n" // done + : + : "r"(aa), "r"(bb), "r"(cc) + : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5"); - /* Now byte-reverse the outputs */ - for( i = 0; i < 16; i++ ) - c[i] = cc[15 - i]; + /* Now byte-reverse the outputs */ + for (i = 0; i < 16; i++) + c[i] = cc[15 - i]; #endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */ - return; + return; } /* * Compute decryption round keys from encryption round keys */ -void aesni_inverse_key( unsigned char *invkey, - const unsigned char *fwdkey, int nr ) +void aesni_inverse_key(unsigned char* invkey, + const unsigned char* fwdkey, int nr) { - unsigned char *ik = invkey; - const unsigned char *fk = fwdkey + 16 * nr; + unsigned char* ik = invkey; + const unsigned char* fk = fwdkey + 16 * nr; - memcpy( ik, fk, 16 ); + memcpy(ik, fk, 16); - for( fk -= 16, ik += 16; fk > fwdkey; fk -= 16, ik += 16 ) + for (fk -= 16, ik += 16; fk > fwdkey; fk -= 16, ik += 16) #if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS) - _mm_storeu_si128( (__m128i*)ik, _mm_aesimc_si128( _mm_loadu_si128( (__m128i*)fk) ) ); + _mm_storeu_si128((__m128i*)ik, _mm_aesimc_si128(_mm_loadu_si128((__m128i*)fk))); #else - asm( "movdqu (%0), %%xmm0 \n" - "aesimc %%xmm0, %%xmm0 \n" - "movdqu %%xmm0, (%1) \n" - : - : "r" (fk), "r" (ik) - : "memory", "xmm0" ); + asm("movdqu (%0), %%xmm0 \n" + "aesimc %%xmm0, %%xmm0 \n" + "movdqu %%xmm0, (%1) \n" + : + : "r"(fk), "r"(ik) + : "memory", "xmm0"); #endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */ - memcpy( ik, fk, 16 ); + memcpy(ik, fk, 16); } #if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS) -inline static __m128i aes_key_128_assist( __m128i key, __m128i kg ) +inline static __m128i aes_key_128_assist(__m128i key, __m128i kg) { - key = _mm_xor_si128( key, _mm_slli_si128( key, 4 ) ); - key = _mm_xor_si128( key, _mm_slli_si128( key, 4 ) ); - key = _mm_xor_si128( key, _mm_slli_si128( key, 4 ) ); - kg = _mm_shuffle_epi32( kg, _MM_SHUFFLE( 3, 3, 3, 3 ) ); - return _mm_xor_si128( key, kg ); + key = _mm_xor_si128(key, _mm_slli_si128(key, 4)); + key = _mm_xor_si128(key, _mm_slli_si128(key, 4)); + key = _mm_xor_si128(key, _mm_slli_si128(key, 4)); + kg = _mm_shuffle_epi32(kg, _MM_SHUFFLE(3, 3, 3, 3)); + return _mm_xor_si128(key, kg); } // [AES-WP] Part of Fig. 25 page 32 -inline static void aes_key_192_assist( __m128i* temp1, __m128i * temp3, __m128i kg ) +inline static void aes_key_192_assist(__m128i* temp1, __m128i* temp3, __m128i kg) { - __m128i temp4; - kg = _mm_shuffle_epi32( kg, 0x55 ); - temp4 = _mm_slli_si128( *temp1, 0x4 ); - *temp1 = _mm_xor_si128( *temp1, temp4 ); - temp4 = _mm_slli_si128( temp4, 0x4 ); - *temp1 = _mm_xor_si128( *temp1, temp4 ); - temp4 = _mm_slli_si128( temp4, 0x4 ); - *temp1 = _mm_xor_si128( *temp1, temp4 ); - *temp1 = _mm_xor_si128( *temp1, kg ); - kg = _mm_shuffle_epi32( *temp1, 0xff ); - temp4 = _mm_slli_si128( *temp3, 0x4 ); - *temp3 = _mm_xor_si128( *temp3, temp4 ); - *temp3 = _mm_xor_si128( *temp3, kg ); + __m128i temp4; + kg = _mm_shuffle_epi32(kg, 0x55); + temp4 = _mm_slli_si128(*temp1, 0x4); + *temp1 = _mm_xor_si128(*temp1, temp4); + temp4 = _mm_slli_si128(temp4, 0x4); + *temp1 = _mm_xor_si128(*temp1, temp4); + temp4 = _mm_slli_si128(temp4, 0x4); + *temp1 = _mm_xor_si128(*temp1, temp4); + *temp1 = _mm_xor_si128(*temp1, kg); + kg = _mm_shuffle_epi32(*temp1, 0xff); + temp4 = _mm_slli_si128(*temp3, 0x4); + *temp3 = _mm_xor_si128(*temp3, temp4); + *temp3 = _mm_xor_si128(*temp3, kg); } // [AES-WP] Part of Fig. 26 page 34 -inline static void aes_key_256_assist_1( __m128i* temp1, __m128i kg ) +inline static void aes_key_256_assist_1(__m128i* temp1, __m128i kg) { - __m128i temp4; - kg = _mm_shuffle_epi32( kg, 0xff ); - temp4 = _mm_slli_si128( *temp1, 0x4 ); - *temp1 = _mm_xor_si128( *temp1, temp4 ); - temp4 = _mm_slli_si128( temp4, 0x4 ); - *temp1 = _mm_xor_si128( *temp1, temp4 ); - temp4 = _mm_slli_si128( temp4, 0x4 ); - *temp1 = _mm_xor_si128( *temp1, temp4 ); - *temp1 = _mm_xor_si128( *temp1, kg ); + __m128i temp4; + kg = _mm_shuffle_epi32(kg, 0xff); + temp4 = _mm_slli_si128(*temp1, 0x4); + *temp1 = _mm_xor_si128(*temp1, temp4); + temp4 = _mm_slli_si128(temp4, 0x4); + *temp1 = _mm_xor_si128(*temp1, temp4); + temp4 = _mm_slli_si128(temp4, 0x4); + *temp1 = _mm_xor_si128(*temp1, temp4); + *temp1 = _mm_xor_si128(*temp1, kg); } -inline static void aes_key_256_assist_2( __m128i* temp1, __m128i* temp3 ) +inline static void aes_key_256_assist_2(__m128i* temp1, __m128i* temp3) { - __m128i temp2, temp4; - temp4 = _mm_aeskeygenassist_si128( *temp1, 0x0 ); - temp2 = _mm_shuffle_epi32( temp4, 0xaa ); - temp4 = _mm_slli_si128( *temp3, 0x4 ); - *temp3 = _mm_xor_si128( *temp3, temp4 ); - temp4 = _mm_slli_si128( temp4, 0x4 ); - *temp3 = _mm_xor_si128( *temp3, temp4 ); - temp4 = _mm_slli_si128( temp4, 0x4 ); - *temp3 = _mm_xor_si128( *temp3, temp4 ); - *temp3 = _mm_xor_si128( *temp3, temp2 ); + __m128i temp2, temp4; + temp4 = _mm_aeskeygenassist_si128(*temp1, 0x0); + temp2 = _mm_shuffle_epi32(temp4, 0xaa); + temp4 = _mm_slli_si128(*temp3, 0x4); + *temp3 = _mm_xor_si128(*temp3, temp4); + temp4 = _mm_slli_si128(temp4, 0x4); + *temp3 = _mm_xor_si128(*temp3, temp4); + temp4 = _mm_slli_si128(temp4, 0x4); + *temp3 = _mm_xor_si128(*temp3, temp4); + *temp3 = _mm_xor_si128(*temp3, temp2); } #endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */ /* * Key expansion, 128-bit case */ -static void aesni_setkey_enc_128( unsigned char *rk, - const unsigned char *key ) +static void aesni_setkey_enc_128(unsigned char* rk, + const unsigned char* key) { #if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS) - __m128i* xrk, k; + __m128i *xrk, k; - xrk = (__m128i*)rk; + xrk = (__m128i*)rk; -#define EXPAND_ROUND(k, rcon) \ - _mm_storeu_si128( xrk++, k ); \ - k = aes_key_128_assist( k, _mm_aeskeygenassist_si128( k, rcon ) ) +#define EXPAND_ROUND(k, rcon) \ + _mm_storeu_si128(xrk++, k); \ + k = aes_key_128_assist(k, _mm_aeskeygenassist_si128(k, rcon)) - k = _mm_loadu_si128( (__m128i*)key ); - EXPAND_ROUND( k, 0x01 ); - EXPAND_ROUND( k, 0x02 ); - EXPAND_ROUND( k, 0x04 ); - EXPAND_ROUND( k, 0x08 ); - EXPAND_ROUND( k, 0x10 ); - EXPAND_ROUND( k, 0x20 ); - EXPAND_ROUND( k, 0x40 ); - EXPAND_ROUND( k, 0x80 ); - EXPAND_ROUND( k, 0x1b ); - EXPAND_ROUND( k, 0x36 ); - _mm_storeu_si128( xrk, k ); + k = _mm_loadu_si128((__m128i*)key); + EXPAND_ROUND(k, 0x01); + EXPAND_ROUND(k, 0x02); + EXPAND_ROUND(k, 0x04); + EXPAND_ROUND(k, 0x08); + EXPAND_ROUND(k, 0x10); + EXPAND_ROUND(k, 0x20); + EXPAND_ROUND(k, 0x40); + EXPAND_ROUND(k, 0x80); + EXPAND_ROUND(k, 0x1b); + EXPAND_ROUND(k, 0x36); + _mm_storeu_si128(xrk, k); #undef EXPAND_ROUND #else - asm( "movdqu (%1), %%xmm0 \n" // copy the original key - "movdqu %%xmm0, (%0) \n" // as round key 0 - "jmp 2f \n" // skip auxiliary routine + asm("movdqu (%1), %%xmm0 \n" // copy the original key + "movdqu %%xmm0, (%0) \n" // as round key 0 + "jmp 2f \n" // skip auxiliary routine - /* - * Finish generating the next round key. - * - * On entry xmm0 is r3:r2:r1:r0 and xmm1 is X:stuff:stuff:stuff - * with X = rot( sub( r3 ) ) ^ RCON. - * - * On exit, xmm0 is r7:r6:r5:r4 - * with r4 = X + r0, r5 = r4 + r1, r6 = r5 + r2, r7 = r6 + r3 - * and those are written to the round key buffer. - */ - "1: \n" - "pshufd $0xff, %%xmm1, %%xmm1 \n" // X:X:X:X - "pxor %%xmm0, %%xmm1 \n" // X+r3:X+r2:X+r1:r4 - "pslldq $4, %%xmm0 \n" // r2:r1:r0:0 - "pxor %%xmm0, %%xmm1 \n" // X+r3+r2:X+r2+r1:r5:r4 - "pslldq $4, %%xmm0 \n" // etc - "pxor %%xmm0, %%xmm1 \n" - "pslldq $4, %%xmm0 \n" - "pxor %%xmm1, %%xmm0 \n" // update xmm0 for next time! - "add $16, %0 \n" // point to next round key - "movdqu %%xmm0, (%0) \n" // write it - "ret \n" + /* + * Finish generating the next round key. + * + * On entry xmm0 is r3:r2:r1:r0 and xmm1 is X:stuff:stuff:stuff + * with X = rot( sub( r3 ) ) ^ RCON. + * + * On exit, xmm0 is r7:r6:r5:r4 + * with r4 = X + r0, r5 = r4 + r1, r6 = r5 + r2, r7 = r6 + r3 + * and those are written to the round key buffer. + */ + "1: \n" + "pshufd $0xff, %%xmm1, %%xmm1 \n" // X:X:X:X + "pxor %%xmm0, %%xmm1 \n" // X+r3:X+r2:X+r1:r4 + "pslldq $4, %%xmm0 \n" // r2:r1:r0:0 + "pxor %%xmm0, %%xmm1 \n" // X+r3+r2:X+r2+r1:r5:r4 + "pslldq $4, %%xmm0 \n" // etc + "pxor %%xmm0, %%xmm1 \n" + "pslldq $4, %%xmm0 \n" + "pxor %%xmm1, %%xmm0 \n" // update xmm0 for next time! + "add $16, %0 \n" // point to next round key + "movdqu %%xmm0, (%0) \n" // write it + "ret \n" - /* Main "loop" */ - "2: \n" - "aeskeygenassist $0x01, %%xmm0, %%xmm1 \ncall 1b \n" - "aeskeygenassist $0x02, %%xmm0, %%xmm1 \ncall 1b \n" - "aeskeygenassist $0x04, %%xmm0, %%xmm1 \ncall 1b \n" - "aeskeygenassist $0x08, %%xmm0, %%xmm1 \ncall 1b \n" - "aeskeygenassist $0x10, %%xmm0, %%xmm1 \ncall 1b \n" - "aeskeygenassist $0x20, %%xmm0, %%xmm1 \ncall 1b \n" - "aeskeygenassist $0x40, %%xmm0, %%xmm1 \ncall 1b \n" - "aeskeygenassist $0x80, %%xmm0, %%xmm1 \ncall 1b \n" - "aeskeygenassist $0x1B, %%xmm0, %%xmm1 \ncall 1b \n" - "aeskeygenassist $0x36, %%xmm0, %%xmm1 \ncall 1b \n" - : - : "r" (rk), "r" (key) - : "memory", "cc", "0" ); + /* Main "loop" */ + "2: \n" + "aeskeygenassist $0x01, %%xmm0, %%xmm1 \ncall 1b \n" + "aeskeygenassist $0x02, %%xmm0, %%xmm1 \ncall 1b \n" + "aeskeygenassist $0x04, %%xmm0, %%xmm1 \ncall 1b \n" + "aeskeygenassist $0x08, %%xmm0, %%xmm1 \ncall 1b \n" + "aeskeygenassist $0x10, %%xmm0, %%xmm1 \ncall 1b \n" + "aeskeygenassist $0x20, %%xmm0, %%xmm1 \ncall 1b \n" + "aeskeygenassist $0x40, %%xmm0, %%xmm1 \ncall 1b \n" + "aeskeygenassist $0x80, %%xmm0, %%xmm1 \ncall 1b \n" + "aeskeygenassist $0x1B, %%xmm0, %%xmm1 \ncall 1b \n" + "aeskeygenassist $0x36, %%xmm0, %%xmm1 \ncall 1b \n" + : + : "r"(rk), "r"(key) + : "memory", "cc", "0"); #endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */ } /* * Key expansion, 192-bit case */ -static void aesni_setkey_enc_192( unsigned char *rk, - const unsigned char *key ) +static void aesni_setkey_enc_192(unsigned char* rk, + const unsigned char* key) { #if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS) - __m128i temp1, temp3; - __m128i *key_schedule = (__m128i*)rk; - temp1 = _mm_loadu_si128( (__m128i*)key ); - temp3 = _mm_loadu_si128( (__m128i*)(key + 16) ); - key_schedule[0] = temp1; - key_schedule[1] = temp3; - aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128(temp3, 0x1) ); - key_schedule[1] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( key_schedule[1] ), _mm_castsi128_pd( temp1 ), 0 ) ); - key_schedule[2] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( temp1 ), _mm_castsi128_pd( temp3 ), 1 ) ); - aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x2 ) ); - key_schedule[3] = temp1; - key_schedule[4] = temp3; - aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x4 ) ); - key_schedule[4] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( key_schedule[4] ), _mm_castsi128_pd( temp1 ), 0 ) ); - key_schedule[5] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( temp1 ), _mm_castsi128_pd( temp3 ), 1 ) ); - aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x8 ) ); - key_schedule[6] = temp1; - key_schedule[7] = temp3; - aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x10 ) ); - key_schedule[7] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( key_schedule[7] ), _mm_castsi128_pd( temp1 ), 0 ) ); - key_schedule[8] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( temp1 ), _mm_castsi128_pd( temp3 ), 1 ) ); - aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x20 ) ); - key_schedule[9] = temp1; - key_schedule[10] = temp3; - aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x40 ) ); - key_schedule[10] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( key_schedule[10] ), _mm_castsi128_pd( temp1 ), 0 ) ); - key_schedule[11] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( temp1 ), _mm_castsi128_pd( temp3 ), 1 ) ); - aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x80 ) ); - key_schedule[12] = temp1; + __m128i temp1, temp3; + __m128i* key_schedule = (__m128i*)rk; + temp1 = _mm_loadu_si128((__m128i*)key); + temp3 = _mm_loadu_si128((__m128i*)(key + 16)); + key_schedule[0] = temp1; + key_schedule[1] = temp3; + aes_key_192_assist(&temp1, &temp3, _mm_aeskeygenassist_si128(temp3, 0x1)); + key_schedule[1] = _mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd(key_schedule[1]), _mm_castsi128_pd(temp1), 0)); + key_schedule[2] = _mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd(temp1), _mm_castsi128_pd(temp3), 1)); + aes_key_192_assist(&temp1, &temp3, _mm_aeskeygenassist_si128(temp3, 0x2)); + key_schedule[3] = temp1; + key_schedule[4] = temp3; + aes_key_192_assist(&temp1, &temp3, _mm_aeskeygenassist_si128(temp3, 0x4)); + key_schedule[4] = _mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd(key_schedule[4]), _mm_castsi128_pd(temp1), 0)); + key_schedule[5] = _mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd(temp1), _mm_castsi128_pd(temp3), 1)); + aes_key_192_assist(&temp1, &temp3, _mm_aeskeygenassist_si128(temp3, 0x8)); + key_schedule[6] = temp1; + key_schedule[7] = temp3; + aes_key_192_assist(&temp1, &temp3, _mm_aeskeygenassist_si128(temp3, 0x10)); + key_schedule[7] = _mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd(key_schedule[7]), _mm_castsi128_pd(temp1), 0)); + key_schedule[8] = _mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd(temp1), _mm_castsi128_pd(temp3), 1)); + aes_key_192_assist(&temp1, &temp3, _mm_aeskeygenassist_si128(temp3, 0x20)); + key_schedule[9] = temp1; + key_schedule[10] = temp3; + aes_key_192_assist(&temp1, &temp3, _mm_aeskeygenassist_si128(temp3, 0x40)); + key_schedule[10] = _mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd(key_schedule[10]), _mm_castsi128_pd(temp1), 0)); + key_schedule[11] = _mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd(temp1), _mm_castsi128_pd(temp3), 1)); + aes_key_192_assist(&temp1, &temp3, _mm_aeskeygenassist_si128(temp3, 0x80)); + key_schedule[12] = temp1; #else - asm( "movdqu (%1), %%xmm0 \n" // copy original round key - "movdqu %%xmm0, (%0) \n" - "add $16, %0 \n" - "movq 16(%1), %%xmm1 \n" - "movq %%xmm1, (%0) \n" - "add $8, %0 \n" - "jmp 2f \n" // skip auxiliary routine + asm("movdqu (%1), %%xmm0 \n" // copy original round key + "movdqu %%xmm0, (%0) \n" + "add $16, %0 \n" + "movq 16(%1), %%xmm1 \n" + "movq %%xmm1, (%0) \n" + "add $8, %0 \n" + "jmp 2f \n" // skip auxiliary routine - /* - * Finish generating the next 6 quarter-keys. - * - * On entry xmm0 is r3:r2:r1:r0, xmm1 is stuff:stuff:r5:r4 - * and xmm2 is stuff:stuff:X:stuff with X = rot( sub( r3 ) ) ^ RCON. - * - * On exit, xmm0 is r9:r8:r7:r6 and xmm1 is stuff:stuff:r11:r10 - * and those are written to the round key buffer. - */ - "1: \n" - "pshufd $0x55, %%xmm2, %%xmm2 \n" // X:X:X:X - "pxor %%xmm0, %%xmm2 \n" // X+r3:X+r2:X+r1:r4 - "pslldq $4, %%xmm0 \n" // etc - "pxor %%xmm0, %%xmm2 \n" - "pslldq $4, %%xmm0 \n" - "pxor %%xmm0, %%xmm2 \n" - "pslldq $4, %%xmm0 \n" - "pxor %%xmm2, %%xmm0 \n" // update xmm0 = r9:r8:r7:r6 - "movdqu %%xmm0, (%0) \n" - "add $16, %0 \n" - "pshufd $0xff, %%xmm0, %%xmm2 \n" // r9:r9:r9:r9 - "pxor %%xmm1, %%xmm2 \n" // stuff:stuff:r9+r5:r10 - "pslldq $4, %%xmm1 \n" // r2:r1:r0:0 - "pxor %%xmm2, %%xmm1 \n" // update xmm1 = stuff:stuff:r11:r10 - "movq %%xmm1, (%0) \n" - "add $8, %0 \n" - "ret \n" + /* + * Finish generating the next 6 quarter-keys. + * + * On entry xmm0 is r3:r2:r1:r0, xmm1 is stuff:stuff:r5:r4 + * and xmm2 is stuff:stuff:X:stuff with X = rot( sub( r3 ) ) ^ RCON. + * + * On exit, xmm0 is r9:r8:r7:r6 and xmm1 is stuff:stuff:r11:r10 + * and those are written to the round key buffer. + */ + "1: \n" + "pshufd $0x55, %%xmm2, %%xmm2 \n" // X:X:X:X + "pxor %%xmm0, %%xmm2 \n" // X+r3:X+r2:X+r1:r4 + "pslldq $4, %%xmm0 \n" // etc + "pxor %%xmm0, %%xmm2 \n" + "pslldq $4, %%xmm0 \n" + "pxor %%xmm0, %%xmm2 \n" + "pslldq $4, %%xmm0 \n" + "pxor %%xmm2, %%xmm0 \n" // update xmm0 = r9:r8:r7:r6 + "movdqu %%xmm0, (%0) \n" + "add $16, %0 \n" + "pshufd $0xff, %%xmm0, %%xmm2 \n" // r9:r9:r9:r9 + "pxor %%xmm1, %%xmm2 \n" // stuff:stuff:r9+r5:r10 + "pslldq $4, %%xmm1 \n" // r2:r1:r0:0 + "pxor %%xmm2, %%xmm1 \n" // update xmm1 = stuff:stuff:r11:r10 + "movq %%xmm1, (%0) \n" + "add $8, %0 \n" + "ret \n" - "2: \n" - "aeskeygenassist $0x01, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x02, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x04, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x08, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x10, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x20, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x40, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x80, %%xmm1, %%xmm2 \ncall 1b \n" + "2: \n" + "aeskeygenassist $0x01, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x02, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x04, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x08, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x10, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x20, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x40, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x80, %%xmm1, %%xmm2 \ncall 1b \n" - : - : "r" (rk), "r" (key) - : "memory", "cc", "0" ); + : + : "r"(rk), "r"(key) + : "memory", "cc", "0"); #endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */ } /* * Key expansion, 256-bit case */ -static void aesni_setkey_enc_256( unsigned char *rk, - const unsigned char *key ) +static void aesni_setkey_enc_256(unsigned char* rk, + const unsigned char* key) { #if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS) - __m128i temp1, temp3; - __m128i *key_schedule = (__m128i*)rk; - temp1 = _mm_loadu_si128( (__m128i*)key ); - temp3 = _mm_loadu_si128( (__m128i*)(key + 16) ); - key_schedule[0] = temp1; - key_schedule[1] = temp3; - aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x01 ) ); - key_schedule[2] = temp1; - aes_key_256_assist_2( &temp1, &temp3 ); - key_schedule[3] = temp3; - aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x02 ) ); - key_schedule[4] = temp1; - aes_key_256_assist_2( &temp1, &temp3 ); - key_schedule[5] = temp3; - aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x04 ) ); - key_schedule[6] = temp1; - aes_key_256_assist_2( &temp1, &temp3 ); - key_schedule[7] = temp3; - aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x08 ) ); - key_schedule[8] = temp1; - aes_key_256_assist_2( &temp1, &temp3 ); - key_schedule[9] = temp3; - aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x10 ) ); - key_schedule[10] = temp1; - aes_key_256_assist_2( &temp1, &temp3 ); - key_schedule[11] = temp3; - aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x20 ) ); - key_schedule[12] = temp1; - aes_key_256_assist_2( &temp1, &temp3 ); - key_schedule[13] = temp3; - aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x40 ) ); - key_schedule[14] = temp1; + __m128i temp1, temp3; + __m128i* key_schedule = (__m128i*)rk; + temp1 = _mm_loadu_si128((__m128i*)key); + temp3 = _mm_loadu_si128((__m128i*)(key + 16)); + key_schedule[0] = temp1; + key_schedule[1] = temp3; + aes_key_256_assist_1(&temp1, _mm_aeskeygenassist_si128(temp3, 0x01)); + key_schedule[2] = temp1; + aes_key_256_assist_2(&temp1, &temp3); + key_schedule[3] = temp3; + aes_key_256_assist_1(&temp1, _mm_aeskeygenassist_si128(temp3, 0x02)); + key_schedule[4] = temp1; + aes_key_256_assist_2(&temp1, &temp3); + key_schedule[5] = temp3; + aes_key_256_assist_1(&temp1, _mm_aeskeygenassist_si128(temp3, 0x04)); + key_schedule[6] = temp1; + aes_key_256_assist_2(&temp1, &temp3); + key_schedule[7] = temp3; + aes_key_256_assist_1(&temp1, _mm_aeskeygenassist_si128(temp3, 0x08)); + key_schedule[8] = temp1; + aes_key_256_assist_2(&temp1, &temp3); + key_schedule[9] = temp3; + aes_key_256_assist_1(&temp1, _mm_aeskeygenassist_si128(temp3, 0x10)); + key_schedule[10] = temp1; + aes_key_256_assist_2(&temp1, &temp3); + key_schedule[11] = temp3; + aes_key_256_assist_1(&temp1, _mm_aeskeygenassist_si128(temp3, 0x20)); + key_schedule[12] = temp1; + aes_key_256_assist_2(&temp1, &temp3); + key_schedule[13] = temp3; + aes_key_256_assist_1(&temp1, _mm_aeskeygenassist_si128(temp3, 0x40)); + key_schedule[14] = temp1; #else - asm( "movdqu (%1), %%xmm0 \n" - "movdqu %%xmm0, (%0) \n" - "add $16, %0 \n" - "movdqu 16(%1), %%xmm1 \n" - "movdqu %%xmm1, (%0) \n" - "jmp 2f \n" // skip auxiliary routine + asm("movdqu (%1), %%xmm0 \n" + "movdqu %%xmm0, (%0) \n" + "add $16, %0 \n" + "movdqu 16(%1), %%xmm1 \n" + "movdqu %%xmm1, (%0) \n" + "jmp 2f \n" // skip auxiliary routine - /* - * Finish generating the next two round keys. - * - * On entry xmm0 is r3:r2:r1:r0, xmm1 is r7:r6:r5:r4 and - * xmm2 is X:stuff:stuff:stuff with X = rot( sub( r7 )) ^ RCON - * - * On exit, xmm0 is r11:r10:r9:r8 and xmm1 is r15:r14:r13:r12 - * and those have been written to the output buffer. - */ - "1: \n" - "pshufd $0xff, %%xmm2, %%xmm2 \n" - "pxor %%xmm0, %%xmm2 \n" - "pslldq $4, %%xmm0 \n" - "pxor %%xmm0, %%xmm2 \n" - "pslldq $4, %%xmm0 \n" - "pxor %%xmm0, %%xmm2 \n" - "pslldq $4, %%xmm0 \n" - "pxor %%xmm2, %%xmm0 \n" - "add $16, %0 \n" - "movdqu %%xmm0, (%0) \n" + /* + * Finish generating the next two round keys. + * + * On entry xmm0 is r3:r2:r1:r0, xmm1 is r7:r6:r5:r4 and + * xmm2 is X:stuff:stuff:stuff with X = rot( sub( r7 )) ^ RCON + * + * On exit, xmm0 is r11:r10:r9:r8 and xmm1 is r15:r14:r13:r12 + * and those have been written to the output buffer. + */ + "1: \n" + "pshufd $0xff, %%xmm2, %%xmm2 \n" + "pxor %%xmm0, %%xmm2 \n" + "pslldq $4, %%xmm0 \n" + "pxor %%xmm0, %%xmm2 \n" + "pslldq $4, %%xmm0 \n" + "pxor %%xmm0, %%xmm2 \n" + "pslldq $4, %%xmm0 \n" + "pxor %%xmm2, %%xmm0 \n" + "add $16, %0 \n" + "movdqu %%xmm0, (%0) \n" - /* Set xmm2 to stuff:Y:stuff:stuff with Y = subword( r11 ) - * and proceed to generate next round key from there */ - "aeskeygenassist $0, %%xmm0, %%xmm2\n" - "pshufd $0xaa, %%xmm2, %%xmm2 \n" - "pxor %%xmm1, %%xmm2 \n" - "pslldq $4, %%xmm1 \n" - "pxor %%xmm1, %%xmm2 \n" - "pslldq $4, %%xmm1 \n" - "pxor %%xmm1, %%xmm2 \n" - "pslldq $4, %%xmm1 \n" - "pxor %%xmm2, %%xmm1 \n" - "add $16, %0 \n" - "movdqu %%xmm1, (%0) \n" - "ret \n" + /* Set xmm2 to stuff:Y:stuff:stuff with Y = subword( r11 ) + * and proceed to generate next round key from there */ + "aeskeygenassist $0, %%xmm0, %%xmm2\n" + "pshufd $0xaa, %%xmm2, %%xmm2 \n" + "pxor %%xmm1, %%xmm2 \n" + "pslldq $4, %%xmm1 \n" + "pxor %%xmm1, %%xmm2 \n" + "pslldq $4, %%xmm1 \n" + "pxor %%xmm1, %%xmm2 \n" + "pslldq $4, %%xmm1 \n" + "pxor %%xmm2, %%xmm1 \n" + "add $16, %0 \n" + "movdqu %%xmm1, (%0) \n" + "ret \n" - /* - * Main "loop" - Generating one more key than necessary, - * see definition of aes_context.buf - */ - "2: \n" - "aeskeygenassist $0x01, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x02, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x04, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x08, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x10, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x20, %%xmm1, %%xmm2 \ncall 1b \n" - "aeskeygenassist $0x40, %%xmm1, %%xmm2 \ncall 1b \n" - : - : "r" (rk), "r" (key) - : "memory", "cc", "0" ); + /* + * Main "loop" - Generating one more key than necessary, + * see definition of aes_context.buf + */ + "2: \n" + "aeskeygenassist $0x01, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x02, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x04, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x08, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x10, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x20, %%xmm1, %%xmm2 \ncall 1b \n" + "aeskeygenassist $0x40, %%xmm1, %%xmm2 \ncall 1b \n" + : + : "r"(rk), "r"(key) + : "memory", "cc", "0"); #endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */ } /* * Key expansion, wrapper */ -int aesni_setkey_enc( unsigned char *rk, - const unsigned char *key, - size_t bits ) +int aesni_setkey_enc(unsigned char* rk, + const unsigned char* key, + size_t bits) { - switch( bits ) - { - case 128: aesni_setkey_enc_128( rk, key ); break; - case 192: aesni_setkey_enc_192( rk, key ); break; - case 256: aesni_setkey_enc_256( rk, key ); break; - default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH ); - } + switch (bits) + { + case 128: aesni_setkey_enc_128(rk, key); break; + case 192: aesni_setkey_enc_192(rk, key); break; + case 256: aesni_setkey_enc_256(rk, key); break; + default: return (POLARSSL_ERR_AES_INVALID_KEY_LENGTH); + } - return( 0 ); + return (0); } #endif diff --git a/rpcs3/rpcs3/Crypto/aesni.h b/rpcs3/rpcs3/Crypto/aesni.h index 55b2f57e7..e577183e6 100644 --- a/rpcs3/rpcs3/Crypto/aesni.h +++ b/rpcs3/rpcs3/Crypto/aesni.h @@ -29,74 +29,75 @@ #include "aes.h" -#define POLARSSL_AESNI_AES 0x02000000u -#define POLARSSL_AESNI_CLMUL 0x00000002u +#define POLARSSL_AESNI_AES 0x02000000u +#define POLARSSL_AESNI_CLMUL 0x00000002u #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif -/** - * \brief AES-NI features detection routine - * - * \param what The feature to detect - * (POLARSSL_AESNI_AES or POLARSSL_AESNI_CLMUL) - * - * \return 1 if CPU has support for the feature, 0 otherwise - */ -int aesni_supports( unsigned int what ); + /** + * \brief AES-NI features detection routine + * + * \param what The feature to detect + * (POLARSSL_AESNI_AES or POLARSSL_AESNI_CLMUL) + * + * \return 1 if CPU has support for the feature, 0 otherwise + */ + int aesni_supports(unsigned int what); -/** - * \brief AES-NI AES-ECB block en(de)cryption - * - * \param ctx AES context - * \param mode AES_ENCRYPT or AES_DECRYPT - * \param input 16-byte input block - * \param output 16-byte output block - * - * \return 0 on success (cannot fail) - */ -int aesni_crypt_ecb( aes_context *ctx, - int mode, - const unsigned char input[16], - unsigned char output[16] ); + /** + * \brief AES-NI AES-ECB block en(de)cryption + * + * \param ctx AES context + * \param mode AES_ENCRYPT or AES_DECRYPT + * \param input 16-byte input block + * \param output 16-byte output block + * + * \return 0 on success (cannot fail) + */ + int aesni_crypt_ecb(aes_context* ctx, + int mode, + const unsigned char input[16], + unsigned char output[16]); -/** - * \brief GCM multiplication: c = a * b in GF(2^128) - * - * \param c Result - * \param a First operand - * \param b Second operand - * - * \note Both operands and result are bit strings interpreted as - * elements of GF(2^128) as per the GCM spec. - */ -void aesni_gcm_mult( unsigned char c[16], - const unsigned char a[16], - const unsigned char b[16] ); + /** + * \brief GCM multiplication: c = a * b in GF(2^128) + * + * \param c Result + * \param a First operand + * \param b Second operand + * + * \note Both operands and result are bit strings interpreted as + * elements of GF(2^128) as per the GCM spec. + */ + void aesni_gcm_mult(unsigned char c[16], + const unsigned char a[16], + const unsigned char b[16]); -/** - * \brief Compute decryption round keys from encryption round keys - * - * \param invkey Round keys for the equivalent inverse cipher - * \param fwdkey Original round keys (for encryption) - * \param nr Number of rounds (that is, number of round keys minus one) - */ -void aesni_inverse_key( unsigned char *invkey, - const unsigned char *fwdkey, int nr ); + /** + * \brief Compute decryption round keys from encryption round keys + * + * \param invkey Round keys for the equivalent inverse cipher + * \param fwdkey Original round keys (for encryption) + * \param nr Number of rounds (that is, number of round keys minus one) + */ + void aesni_inverse_key(unsigned char* invkey, + const unsigned char* fwdkey, int nr); -/** - * \brief Perform key expansion (for encryption) - * - * \param rk Destination buffer where the round keys are written - * \param key Encryption key - * \param bits Key size in bits (must be 128, 192 or 256) - * - * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH - */ -int aesni_setkey_enc( unsigned char *rk, - const unsigned char *key, - size_t bits ); + /** + * \brief Perform key expansion (for encryption) + * + * \param rk Destination buffer where the round keys are written + * \param key Encryption key + * \param bits Key size in bits (must be 128, 192 or 256) + * + * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH + */ + int aesni_setkey_enc(unsigned char* rk, + const unsigned char* key, + size_t bits); #ifdef __cplusplus } diff --git a/rpcs3/rpcs3/Crypto/decrypt_binaries.cpp b/rpcs3/rpcs3/Crypto/decrypt_binaries.cpp index 6205ac6d4..35a0b69d6 100644 --- a/rpcs3/rpcs3/Crypto/decrypt_binaries.cpp +++ b/rpcs3/rpcs3/Crypto/decrypt_binaries.cpp @@ -139,7 +139,7 @@ usz decrypt_binaries_t::decrypt(std::string_view klic_input) { const std::string exec_ext = fmt::to_lower(_module).ends_with(".sprx") ? ".prx" : ".elf"; const std::string new_path = file_magic == "NPD\0"_u32 ? old_path + ".unedat" : - old_path.substr(0, old_path.find_last_of('.')) + exec_ext; + old_path.substr(0, old_path.find_last_of('.')) + exec_ext; if (fs::file new_file{new_path, fs::rewrite}) { diff --git a/rpcs3/rpcs3/Crypto/decrypt_binaries.h b/rpcs3/rpcs3/Crypto/decrypt_binaries.h index 09eeaf6d3..c5afbc7a1 100644 --- a/rpcs3/rpcs3/Crypto/decrypt_binaries.h +++ b/rpcs3/rpcs3/Crypto/decrypt_binaries.h @@ -2,25 +2,25 @@ class decrypt_binaries_t { - std::vector m_klics; - std::vector m_modules; - usz m_index = 0; + std::vector m_klics; + std::vector m_modules; + usz m_index = 0; public: - decrypt_binaries_t(std::vector modules) noexcept - : m_modules(std::move(modules)) - { - } + decrypt_binaries_t(std::vector modules) noexcept + : m_modules(std::move(modules)) + { + } - usz decrypt(std::string_view klic_input = {}); + usz decrypt(std::string_view klic_input = {}); - bool done() const - { - return m_index >= m_modules.size(); - } + bool done() const + { + return m_index >= m_modules.size(); + } - const std::string& operator[](usz index) const - { - return ::at32(m_modules, index); - } + const std::string& operator[](usz index) const + { + return ::at32(m_modules, index); + } }; diff --git a/rpcs3/rpcs3/Crypto/ec.cpp b/rpcs3/rpcs3/Crypto/ec.cpp index 378992849..944ac7d5b 100644 --- a/rpcs3/rpcs3/Crypto/ec.cpp +++ b/rpcs3/rpcs3/Crypto/ec.cpp @@ -24,7 +24,7 @@ static u8 bn_add_1(u8* d, const u8* a, const u8* b, u32 n) for (u32 i = n - 1; i != umax; i--) { const u32 dig = a[i] + b[i] + c; - c = dig >> 8; + c = dig >> 8; d[i] = dig; } @@ -37,7 +37,7 @@ static u8 bn_sub_1(u8* d, const u8* a, const u8* b, u32 n) for (u32 i = n - 1; i != umax; i--) { const u32 dig = a[i] + 255 - b[i] + c; - c = dig >> 8; + c = dig >> 8; d[i] = dig; } @@ -65,22 +65,134 @@ static void bn_sub(u8* d, const u8* a, const u8* b, const u8* N, u32 n) } static constexpr u8 inv256[0x80] = { - 0x01, 0xab, 0xcd, 0xb7, 0x39, 0xa3, 0xc5, 0xef, - 0xf1, 0x1b, 0x3d, 0xa7, 0x29, 0x13, 0x35, 0xdf, - 0xe1, 0x8b, 0xad, 0x97, 0x19, 0x83, 0xa5, 0xcf, - 0xd1, 0xfb, 0x1d, 0x87, 0x09, 0xf3, 0x15, 0xbf, - 0xc1, 0x6b, 0x8d, 0x77, 0xf9, 0x63, 0x85, 0xaf, - 0xb1, 0xdb, 0xfd, 0x67, 0xe9, 0xd3, 0xf5, 0x9f, - 0xa1, 0x4b, 0x6d, 0x57, 0xd9, 0x43, 0x65, 0x8f, - 0x91, 0xbb, 0xdd, 0x47, 0xc9, 0xb3, 0xd5, 0x7f, - 0x81, 0x2b, 0x4d, 0x37, 0xb9, 0x23, 0x45, 0x6f, - 0x71, 0x9b, 0xbd, 0x27, 0xa9, 0x93, 0xb5, 0x5f, - 0x61, 0x0b, 0x2d, 0x17, 0x99, 0x03, 0x25, 0x4f, - 0x51, 0x7b, 0x9d, 0x07, 0x89, 0x73, 0x95, 0x3f, - 0x41, 0xeb, 0x0d, 0xf7, 0x79, 0xe3, 0x05, 0x2f, - 0x31, 0x5b, 0x7d, 0xe7, 0x69, 0x53, 0x75, 0x1f, - 0x21, 0xcb, 0xed, 0xd7, 0x59, 0xc3, 0xe5, 0x0f, - 0x11, 0x3b, 0x5d, 0xc7, 0x49, 0x33, 0x55, 0xff, + 0x01, + 0xab, + 0xcd, + 0xb7, + 0x39, + 0xa3, + 0xc5, + 0xef, + 0xf1, + 0x1b, + 0x3d, + 0xa7, + 0x29, + 0x13, + 0x35, + 0xdf, + 0xe1, + 0x8b, + 0xad, + 0x97, + 0x19, + 0x83, + 0xa5, + 0xcf, + 0xd1, + 0xfb, + 0x1d, + 0x87, + 0x09, + 0xf3, + 0x15, + 0xbf, + 0xc1, + 0x6b, + 0x8d, + 0x77, + 0xf9, + 0x63, + 0x85, + 0xaf, + 0xb1, + 0xdb, + 0xfd, + 0x67, + 0xe9, + 0xd3, + 0xf5, + 0x9f, + 0xa1, + 0x4b, + 0x6d, + 0x57, + 0xd9, + 0x43, + 0x65, + 0x8f, + 0x91, + 0xbb, + 0xdd, + 0x47, + 0xc9, + 0xb3, + 0xd5, + 0x7f, + 0x81, + 0x2b, + 0x4d, + 0x37, + 0xb9, + 0x23, + 0x45, + 0x6f, + 0x71, + 0x9b, + 0xbd, + 0x27, + 0xa9, + 0x93, + 0xb5, + 0x5f, + 0x61, + 0x0b, + 0x2d, + 0x17, + 0x99, + 0x03, + 0x25, + 0x4f, + 0x51, + 0x7b, + 0x9d, + 0x07, + 0x89, + 0x73, + 0x95, + 0x3f, + 0x41, + 0xeb, + 0x0d, + 0xf7, + 0x79, + 0xe3, + 0x05, + 0x2f, + 0x31, + 0x5b, + 0x7d, + 0xe7, + 0x69, + 0x53, + 0x75, + 0x1f, + 0x21, + 0xcb, + 0xed, + 0xd7, + 0x59, + 0xc3, + 0xe5, + 0x0f, + 0x11, + 0x3b, + 0x5d, + 0xc7, + 0x49, + 0x33, + 0x55, + 0xff, }; static void bn_mon_muladd_dig(u8* d, const u8* a, u8 b, const u8* N, u32 n) @@ -384,7 +496,8 @@ static bool check_ecdsa(const struct point* Q, u8* R, u8* S, const u8* hash) void ecdsa_set_curve(const u8* p, const u8* a, const u8* b, const u8* N, const u8* Gx, const u8* Gy) { - if (ec_curve_initialized) return; + if (ec_curve_initialized) + return; memcpy(ec_p, p, 20); memcpy(ec_a, a, 20); @@ -403,7 +516,8 @@ void ecdsa_set_curve(const u8* p, const u8* a, const u8* b, const u8* N, const u void ecdsa_set_pub(const u8* Q) { - if (ec_pub_initialized) return; + if (ec_pub_initialized) + return; memcpy(ec_Q.x, Q, 20); memcpy(ec_Q.y, Q + 20, 20); diff --git a/rpcs3/rpcs3/Crypto/key_vault.cpp b/rpcs3/rpcs3/Crypto/key_vault.cpp index 2533b4d7f..c5a0e4fa2 100644 --- a/rpcs3/rpcs3/Crypto/key_vault.cpp +++ b/rpcs3/rpcs3/Crypto/key_vault.cpp @@ -8,9 +8,9 @@ LOG_CHANNEL(key_vault_log, "KEY_VAULT"); SELF_KEY::SELF_KEY(u64 ver_start, u64 ver_end, u16 rev, u32 type, const std::string& e, const std::string& r, const std::string& pb, const std::string& pr, u32 ct) { version_start = ver_start; - version_end = ver_end; - revision = rev; - self_type = type; + version_end = ver_end; + revision = rev; + self_type = type; hex_to_bytes(erk, e.c_str(), 0); hex_to_bytes(riv, r.c_str(), 0); hex_to_bytes(pub, pb.c_str(), 0); @@ -787,19 +787,19 @@ void rap_to_rif(const unsigned char* rap, unsigned char* rif) } for (i = 15; i >= 1; --i) { - const int p = RAP_PBOX[i]; + const int p = RAP_PBOX[i]; const int pp = RAP_PBOX[i - 1]; key[p] ^= key[pp]; } int o = 0; for (i = 0; i < 16; ++i) { - const int p = RAP_PBOX[i]; - const unsigned char kc = key[p] - o; + const int p = RAP_PBOX[i]; + const unsigned char kc = key[p] - o; const unsigned char ec2 = RAP_E2[p]; if (o != 1 || kc != 0xFF) { - o = kc < ec2 ? 1 : 0; + o = kc < ec2 ? 1 : 0; key[p] = kc - ec2; } else if (kc == 0xFF) diff --git a/rpcs3/rpcs3/Crypto/key_vault.h b/rpcs3/rpcs3/Crypto/key_vault.h index 4dff84992..9976f47ca 100644 --- a/rpcs3/rpcs3/Crypto/key_vault.h +++ b/rpcs3/rpcs3/Crypto/key_vault.h @@ -65,153 +65,118 @@ constexpr u8 SC_ISO_SERIES_INTERNAL_KEY_3[PASSPHRASE_KEY_LEN] = { }; constexpr u8 PKG_AES_KEY_IDU[0x10] = { - 0x5d, 0xb9, 0x11, 0xe6, 0xb7, 0xe5, 0x0a, 0x7d, 0x32, 0x15, 0x38, 0xfd, 0x7c, 0x66, 0xf1, 0x7b -}; + 0x5d, 0xb9, 0x11, 0xe6, 0xb7, 0xe5, 0x0a, 0x7d, 0x32, 0x15, 0x38, 0xfd, 0x7c, 0x66, 0xf1, 0x7b}; constexpr u8 PKG_AES_KEY[0x10] = { - 0x2e, 0x7b, 0x71, 0xd7, 0xc9, 0xc9, 0xa1, 0x4e, 0xa3, 0x22, 0x1f, 0x18, 0x88, 0x28, 0xb8, 0xf8 -}; + 0x2e, 0x7b, 0x71, 0xd7, 0xc9, 0xc9, 0xa1, 0x4e, 0xa3, 0x22, 0x1f, 0x18, 0x88, 0x28, 0xb8, 0xf8}; constexpr u8 PKG_AES_KEY2[0x10] = { - 0x07, 0xf2, 0xc6, 0x82, 0x90, 0xb5, 0x0d, 0x2c, 0x33, 0x81, 0x8d, 0x70, 0x9b, 0x60, 0xe6, 0x2b -}; + 0x07, 0xf2, 0xc6, 0x82, 0x90, 0xb5, 0x0d, 0x2c, 0x33, 0x81, 0x8d, 0x70, 0x9b, 0x60, 0xe6, 0x2b}; constexpr u8 PKG_AES_KEY_VITA_1[0x10] = { - 0xE3, 0x1A, 0x70, 0xC9, 0xCE, 0x1D, 0xD7, 0x2B, 0xF3, 0xC0, 0x62, 0x29, 0x63, 0xF2, 0xEC, 0xCB -}; + 0xE3, 0x1A, 0x70, 0xC9, 0xCE, 0x1D, 0xD7, 0x2B, 0xF3, 0xC0, 0x62, 0x29, 0x63, 0xF2, 0xEC, 0xCB}; constexpr u8 PKG_AES_KEY_VITA_2[0x10] = { - 0x42, 0x3A, 0xCA, 0x3A, 0x2B, 0xD5, 0x64, 0x9F, 0x96, 0x86, 0xAB, 0xAD, 0x6F, 0xD8, 0x80, 0x1F -}; + 0x42, 0x3A, 0xCA, 0x3A, 0x2B, 0xD5, 0x64, 0x9F, 0x96, 0x86, 0xAB, 0xAD, 0x6F, 0xD8, 0x80, 0x1F}; constexpr u8 PKG_AES_KEY_VITA_3[0x10] = { - 0xAF, 0x07, 0xFD, 0x59, 0x65, 0x25, 0x27, 0xBA, 0xF1, 0x33, 0x89, 0x66, 0x8B, 0x17, 0xD9, 0xEA -}; + 0xAF, 0x07, 0xFD, 0x59, 0x65, 0x25, 0x27, 0xBA, 0xF1, 0x33, 0x89, 0x66, 0x8B, 0x17, 0xD9, 0xEA}; constexpr u8 NP_IDPS[0x10] = { - 0x5E, 0x06, 0xE0, 0x4F, 0xD9, 0x4A, 0x71, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 -}; + 0x5E, 0x06, 0xE0, 0x4F, 0xD9, 0x4A, 0x71, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; constexpr u8 NP_KLIC_FREE[0x10] = { - 0x72, 0xF9, 0x90, 0x78, 0x8F, 0x9C, 0xFF, 0x74, 0x57, 0x25, 0xF0, 0x8E, 0x4C, 0x12, 0x83, 0x87 -}; + 0x72, 0xF9, 0x90, 0x78, 0x8F, 0x9C, 0xFF, 0x74, 0x57, 0x25, 0xF0, 0x8E, 0x4C, 0x12, 0x83, 0x87}; constexpr u8 NP_OMAC_KEY_2[0x10] = { - 0x6B, 0xA5, 0x29, 0x76, 0xEF, 0xDA, 0x16, 0xEF, 0x3C, 0x33, 0x9F, 0xB2, 0x97, 0x1E, 0x25, 0x6B -}; + 0x6B, 0xA5, 0x29, 0x76, 0xEF, 0xDA, 0x16, 0xEF, 0x3C, 0x33, 0x9F, 0xB2, 0x97, 0x1E, 0x25, 0x6B}; constexpr u8 NP_OMAC_KEY_3[0x10] = { - 0x9B, 0x51, 0x5F, 0xEA, 0xCF, 0x75, 0x06, 0x49, 0x81, 0xAA, 0x60, 0x4D, 0x91, 0xA5, 0x4E, 0x97 -}; + 0x9B, 0x51, 0x5F, 0xEA, 0xCF, 0x75, 0x06, 0x49, 0x81, 0xAA, 0x60, 0x4D, 0x91, 0xA5, 0x4E, 0x97}; constexpr u8 NP_KLIC_KEY[0x10] = { - 0xF2, 0xFB, 0xCA, 0x7A, 0x75, 0xB0, 0x4E, 0xDC, 0x13, 0x90, 0x63, 0x8C, 0xCD, 0xFD, 0xD1, 0xEE -}; + 0xF2, 0xFB, 0xCA, 0x7A, 0x75, 0xB0, 0x4E, 0xDC, 0x13, 0x90, 0x63, 0x8C, 0xCD, 0xFD, 0xD1, 0xEE}; constexpr u8 NP_RIF_KEY[0x10] = { - 0xDA, 0x7D, 0x4B, 0x5E, 0x49, 0x9A, 0x4F, 0x53, 0xB1, 0xC1, 0xA1, 0x4A, 0x74, 0x84, 0x44, 0x3B -}; + 0xDA, 0x7D, 0x4B, 0x5E, 0x49, 0x9A, 0x4F, 0x53, 0xB1, 0xC1, 0xA1, 0x4A, 0x74, 0x84, 0x44, 0x3B}; // PSP Minis constexpr u8 NP_PSP_KEY_1[0x10] = { - 0x2A, 0x6A, 0xFB, 0xCF, 0x43, 0xD1, 0x57, 0x9F, 0x7D, 0x73, 0x87, 0x41, 0xA1, 0x3B, 0xD4, 0x2E -}; + 0x2A, 0x6A, 0xFB, 0xCF, 0x43, 0xD1, 0x57, 0x9F, 0x7D, 0x73, 0x87, 0x41, 0xA1, 0x3B, 0xD4, 0x2E}; // PSP Remasters constexpr u8 NP_PSP_KEY_2[0x10] = { - 0x0D, 0xB8, 0x57, 0x32, 0x36, 0x6C, 0xD7, 0x34, 0xFC, 0x87, 0x9E, 0x74, 0x33, 0x43, 0xBB, 0x4F -}; + 0x0D, 0xB8, 0x57, 0x32, 0x36, 0x6C, 0xD7, 0x34, 0xFC, 0x87, 0x9E, 0x74, 0x33, 0x43, 0xBB, 0x4F}; constexpr u8 NP_PSX_KEY[0x10] = { - 0x52, 0xC0, 0xB5, 0xCA, 0x76, 0xD6, 0x13, 0x4B, 0xB4, 0x5F, 0xC6, 0x6C, 0xA6, 0x37, 0xF2, 0xC1 -}; + 0x52, 0xC0, 0xB5, 0xCA, 0x76, 0xD6, 0x13, 0x4B, 0xB4, 0x5F, 0xC6, 0x6C, 0xA6, 0x37, 0xF2, 0xC1}; constexpr u8 RAP_KEY[0x10] = { - 0x86, 0x9F, 0x77, 0x45, 0xC1, 0x3F, 0xD8, 0x90, 0xCC, 0xF2, 0x91, 0x88, 0xE3, 0xCC, 0x3E, 0xDF -}; + 0x86, 0x9F, 0x77, 0x45, 0xC1, 0x3F, 0xD8, 0x90, 0xCC, 0xF2, 0x91, 0x88, 0xE3, 0xCC, 0x3E, 0xDF}; constexpr u8 RAP_PBOX[0x10] = { - 0x0C, 0x03, 0x06, 0x04, 0x01, 0x0B, 0x0F, 0x08, 0x02, 0x07, 0x00, 0x05, 0x0A, 0x0E, 0x0D, 0x09 -}; + 0x0C, 0x03, 0x06, 0x04, 0x01, 0x0B, 0x0F, 0x08, 0x02, 0x07, 0x00, 0x05, 0x0A, 0x0E, 0x0D, 0x09}; constexpr u8 RAP_E1[0x10] = { - 0xA9, 0x3E, 0x1F, 0xD6, 0x7C, 0x55, 0xA3, 0x29, 0xB7, 0x5F, 0xDD, 0xA6, 0x2A, 0x95, 0xC7, 0xA5 -}; + 0xA9, 0x3E, 0x1F, 0xD6, 0x7C, 0x55, 0xA3, 0x29, 0xB7, 0x5F, 0xDD, 0xA6, 0x2A, 0x95, 0xC7, 0xA5}; constexpr u8 RAP_E2[0x10] = { - 0x67, 0xD4, 0x5D, 0xA3, 0x29, 0x6D, 0x00, 0x6A, 0x4E, 0x7C, 0x53, 0x7B, 0xF5, 0x53, 0x8C, 0x74 -}; + 0x67, 0xD4, 0x5D, 0xA3, 0x29, 0x6D, 0x00, 0x6A, 0x4E, 0x7C, 0x53, 0x7B, 0xF5, 0x53, 0x8C, 0x74}; constexpr u8 SDAT_KEY[0x10] = { - 0x0D, 0x65, 0x5E, 0xF8, 0xE6, 0x74, 0xA9, 0x8A, 0xB8, 0x50, 0x5C, 0xFA, 0x7D, 0x01, 0x29, 0x33 -}; + 0x0D, 0x65, 0x5E, 0xF8, 0xE6, 0x74, 0xA9, 0x8A, 0xB8, 0x50, 0x5C, 0xFA, 0x7D, 0x01, 0x29, 0x33}; constexpr u8 EDAT_KEY_0[0x10] = { - 0xBE, 0x95, 0x9C, 0xA8, 0x30, 0x8D, 0xEF, 0xA2, 0xE5, 0xE1, 0x80, 0xC6, 0x37, 0x12, 0xA9, 0xAE -}; + 0xBE, 0x95, 0x9C, 0xA8, 0x30, 0x8D, 0xEF, 0xA2, 0xE5, 0xE1, 0x80, 0xC6, 0x37, 0x12, 0xA9, 0xAE}; constexpr u8 EDAT_HASH_0[0x10] = { - 0xEF, 0xFE, 0x5B, 0xD1, 0x65, 0x2E, 0xEB, 0xC1, 0x19, 0x18, 0xCF, 0x7C, 0x04, 0xD4, 0xF0, 0x11 -}; + 0xEF, 0xFE, 0x5B, 0xD1, 0x65, 0x2E, 0xEB, 0xC1, 0x19, 0x18, 0xCF, 0x7C, 0x04, 0xD4, 0xF0, 0x11}; constexpr u8 EDAT_KEY_1[0x10] = { - 0x4C, 0xA9, 0xC1, 0x4B, 0x01, 0xC9, 0x53, 0x09, 0x96, 0x9B, 0xEC, 0x68, 0xAA, 0x0B, 0xC0, 0x81 -}; + 0x4C, 0xA9, 0xC1, 0x4B, 0x01, 0xC9, 0x53, 0x09, 0x96, 0x9B, 0xEC, 0x68, 0xAA, 0x0B, 0xC0, 0x81}; constexpr u8 EDAT_HASH_1[0x10] = { - 0x3D, 0x92, 0x69, 0x9B, 0x70, 0x5B, 0x07, 0x38, 0x54, 0xD8, 0xFC, 0xC6, 0xC7, 0x67, 0x27, 0x47 -}; + 0x3D, 0x92, 0x69, 0x9B, 0x70, 0x5B, 0x07, 0x38, 0x54, 0xD8, 0xFC, 0xC6, 0xC7, 0x67, 0x27, 0x47}; constexpr u8 EDAT_IV[0x10] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; constexpr u8 VSH_CURVE_P[0x14] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF -}; + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; constexpr u8 VSH_CURVE_A[0x14] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC -}; + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC}; constexpr u8 VSH_CURVE_B[0x14] = { - 0xA6, 0x8B, 0xED, 0xC3, 0x34, 0x18, 0x02, 0x9C, 0x1D, 0x3C, 0xE3, 0x3B, 0x9A, 0x32, 0x1F, 0xCC, 0xBB, 0x9E, 0x0F, 0x0B -}; + 0xA6, 0x8B, 0xED, 0xC3, 0x34, 0x18, 0x02, 0x9C, 0x1D, 0x3C, 0xE3, 0x3B, 0x9A, 0x32, 0x1F, 0xCC, 0xBB, 0x9E, 0x0F, 0x0B}; constexpr u8 VSH_CURVE_N[0x15] = { - 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xB5, 0xAE, 0x3C, 0x52, 0x3E, 0x63, 0x94, 0x4F, 0x21, 0x27 -}; + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xB5, 0xAE, 0x3C, 0x52, 0x3E, 0x63, 0x94, 0x4F, 0x21, 0x27}; constexpr u8 VSH_CURVE_GX[0x14] = { - 0x12, 0x8E, 0xC4, 0x25, 0x64, 0x87, 0xFD, 0x8F, 0xDF, 0x64, 0xE2, 0x43, 0x7B, 0xC0, 0xA1, 0xF6, 0xD5, 0xAF, 0xDE, 0x2C -}; + 0x12, 0x8E, 0xC4, 0x25, 0x64, 0x87, 0xFD, 0x8F, 0xDF, 0x64, 0xE2, 0x43, 0x7B, 0xC0, 0xA1, 0xF6, 0xD5, 0xAF, 0xDE, 0x2C}; constexpr u8 VSH_CURVE_GY[0x14] = { - 0x59, 0x58, 0x55, 0x7E, 0xB1, 0xDB, 0x00, 0x12, 0x60, 0x42, 0x55, 0x24, 0xDB, 0xC3, 0x79, 0xD5, 0xAC, 0x5F, 0x4A, 0xDF -}; + 0x59, 0x58, 0x55, 0x7E, 0xB1, 0xDB, 0x00, 0x12, 0x60, 0x42, 0x55, 0x24, 0xDB, 0xC3, 0x79, 0xD5, 0xAC, 0x5F, 0x4A, 0xDF}; constexpr u8 VSH_PUB[0x28] = { 0x62, 0x27, 0xB0, 0x0A, 0x02, 0x85, 0x6F, 0xB0, 0x41, 0x08, 0x87, 0x67, 0x19, 0xE0, 0xA0, 0x18, 0x32, 0x91, 0xEE, 0xB9, - 0x6E, 0x73, 0x6A, 0xBF, 0x81, 0xF7, 0x0E, 0xE9, 0x16, 0x1B, 0x0D, 0xDE, 0xB0, 0x26, 0x76, 0x1A, 0xFF, 0x7B, 0xC8, 0x5B -}; + 0x6E, 0x73, 0x6A, 0xBF, 0x81, 0xF7, 0x0E, 0xE9, 0x16, 0x1B, 0x0D, 0xDE, 0xB0, 0x26, 0x76, 0x1A, 0xFF, 0x7B, 0xC8, 0x5B}; constexpr u8 SCEPKG_RIV[0x10] = { - 0x4A, 0xCE, 0xF0, 0x12, 0x24, 0xFB, 0xEE, 0xDF, 0x82, 0x45, 0xF8, 0xFF, 0x10, 0x21, 0x1E, 0x6E -}; + 0x4A, 0xCE, 0xF0, 0x12, 0x24, 0xFB, 0xEE, 0xDF, 0x82, 0x45, 0xF8, 0xFF, 0x10, 0x21, 0x1E, 0x6E}; constexpr u8 SCEPKG_ERK[0x20] = { 0xA9, 0x78, 0x18, 0xBD, 0x19, 0x3A, 0x67, 0xA1, 0x6F, 0xE8, 0x3A, 0x85, 0x5E, 0x1B, 0xE9, 0xFB, 0x56, 0x40, 0x93, 0x8D, - 0x4D, 0xBC, 0xB2, 0xCB, 0x52, 0xC5, 0xA2, 0xF8, 0xB0, 0x2B, 0x10, 0x31 -}; + 0x4D, 0xBC, 0xB2, 0xCB, 0x52, 0xC5, 0xA2, 0xF8, 0xB0, 0x2B, 0x10, 0x31}; constexpr u8 PUP_KEY[0x40] = { 0xF4, 0x91, 0xAD, 0x94, 0xC6, 0x81, 0x10, 0x96, 0x91, 0x5F, 0xD5, 0xD2, 0x44, 0x81, 0xAE, 0xDC, 0xED, 0xED, 0xBE, 0x6B, 0xE5, 0x13, 0x72, 0x4D, 0xD8, 0xF7, 0xB6, 0x91, 0xE8, 0x8A, 0x38, 0xF4, 0xB5, 0x16, 0x2B, 0xFB, 0xEC, 0xBE, 0x3A, 0x62, 0x18, 0x5D, 0xD7, 0xC9, 0x4D, 0xA2, 0x22, 0x5A, 0xDA, 0x3F, 0xBF, 0xCE, 0x55, 0x5B, 0x9E, 0xA9, 0x64, 0x98, 0x29, 0xEB, - 0x30, 0xCE, 0x83, 0x66 -}; + 0x30, 0xCE, 0x83, 0x66}; - // name; location; notes +// name; location; notes constexpr s64 PAID_01 = 0x0003CD28CB47D3C1L; // spu_token_processor.self; CoreOS; Only for 2E - 083.007 constexpr s64 PAID_02 = 0x1010000001000001L; // vsh / games / utilities; /dev_flash/, cell_root/target/images; only for 2E - 080.006 constexpr s64 PAID_03 = 0x1010000001000003L; // retail games and their updates diff --git a/rpcs3/rpcs3/Crypto/lz.cpp b/rpcs3/rpcs3/Crypto/lz.cpp index f8a5aa010..ce32e99a9 100644 --- a/rpcs3/rpcs3/Crypto/lz.cpp +++ b/rpcs3/rpcs3/Crypto/lz.cpp @@ -6,7 +6,7 @@ #include #include "lz.h" -void decode_range(unsigned int *range, unsigned int *code, unsigned char **src) +void decode_range(unsigned int* range, unsigned int* code, unsigned char** src) { if (!((*range) >> 24)) { @@ -15,20 +15,22 @@ void decode_range(unsigned int *range, unsigned int *code, unsigned char **src) } } -int decode_bit(unsigned int *range, unsigned int *code, int *index, unsigned char **src, unsigned char *c) +int decode_bit(unsigned int* range, unsigned int* code, int* index, unsigned char** src, unsigned char* c) { decode_range(range, code, src); unsigned int val = ((*range) >> 8) * (*c); *c -= ((*c) >> 3); - if (index) (*index) <<= 1; + if (index) + (*index) <<= 1; if (*code < val) { *range = val; *c += 31; - if (index) (*index)++; + if (index) + (*index)++; return 1; } else @@ -39,7 +41,7 @@ int decode_bit(unsigned int *range, unsigned int *code, int *index, unsigned cha } } -int decode_number(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src) +int decode_number(unsigned char* ptr, int index, int* bit_flag, unsigned int* range, unsigned int* code, unsigned char** src) { int i = 1; @@ -79,7 +81,7 @@ int decode_number(unsigned char *ptr, int index, int *bit_flag, unsigned int *ra return i; } -int decode_word(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src) +int decode_word(unsigned char* ptr, int index, int* bit_flag, unsigned int* range, unsigned int* code, unsigned char** src) { int i = 1; index /= 8; @@ -120,7 +122,7 @@ int decode_word(unsigned char *ptr, int index, int *bit_flag, unsigned int *rang return i; } -int decompress(unsigned char *out, unsigned char *in, unsigned int size) +int decompress(unsigned char* out, unsigned char* in, unsigned int size) { int result; @@ -133,8 +135,8 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size) const unsigned char *buf_start, *buf_end; unsigned char prev = 0; - unsigned char *start = out; - const unsigned char *end = (out + size); + unsigned char* start = out; + const unsigned char* end = (out + size); unsigned char head = in[0]; unsigned int range = 0xFFFFFFFF; @@ -160,11 +162,13 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size) { // Start reading at 0xB68. tmp_sect1 = tmp + offset + 0xB68; - if (!decode_bit(&range, &code, 0, &in, tmp_sect1)) // Raw char. + if (!decode_bit(&range, &code, 0, &in, tmp_sect1)) // Raw char. { // Adjust offset and check for stream end. - if (offset > 0) offset--; - if (start == end) return static_cast(start - out); + if (offset > 0) + offset--; + if (start == end) + return static_cast(start - out); // Locate first section. int sect = ((((((static_cast(start - out)) & 7) << 8) + prev) >> head) & 7) * 0xFF - 1; @@ -180,7 +184,7 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size) // Save index. *start++ = index; } - else // Compressed char stream. + else // Compressed char stream. { int index = -1; @@ -205,7 +209,8 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size) // Decode the data length (8 bit fields). data_length = decode_number(tmp_sect1, index, &bit_flag, &range, &code, &in); - if (data_length == 0xFF) return static_cast(start - out); // End of stream. + if (data_length == 0xFF) + return static_cast(start - out); // End of stream. } else { @@ -217,7 +222,7 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size) if ((data_length <= 2)) { tmp_sect2 += 0xF8; - b_size = 0x40; // Block size is now 0x40. + b_size = 0x40; // Block size is now 0x40. } int diff = 0; @@ -234,7 +239,8 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size) if ((diff > 0) || (bit_flag != 0)) { // Adjust diff if needed. - if (bit_flag == 0) diff -= 8; + if (bit_flag == 0) + diff -= 8; // Locate section. tmp_sect3 = tmp + 0x928 + diff; @@ -272,7 +278,6 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size) { *start++ = *buf_start++; } while (start < buf_end); - } prev = *(start - 1); } diff --git a/rpcs3/rpcs3/Crypto/lz.h b/rpcs3/rpcs3/Crypto/lz.h index 5ad68ea66..ff4154d1d 100644 --- a/rpcs3/rpcs3/Crypto/lz.h +++ b/rpcs3/rpcs3/Crypto/lz.h @@ -6,8 +6,8 @@ // Reverse-engineered custom Lempel–Ziv–Markov based compression. -void decode_range(unsigned int *range, unsigned int *code, unsigned char **src); -int decode_bit(unsigned int *range, unsigned int *code, int *index, unsigned char **src, unsigned char *c); -int decode_number(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src); -int decode_word(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src); -int decompress(unsigned char *out, unsigned char *in, unsigned int size); +void decode_range(unsigned int* range, unsigned int* code, unsigned char** src); +int decode_bit(unsigned int* range, unsigned int* code, int* index, unsigned char** src, unsigned char* c); +int decode_number(unsigned char* ptr, int index, int* bit_flag, unsigned int* range, unsigned int* code, unsigned char** src); +int decode_word(unsigned char* ptr, int index, int* bit_flag, unsigned int* range, unsigned int* code, unsigned char** src); +int decompress(unsigned char* out, unsigned char* in, unsigned int size); diff --git a/rpcs3/rpcs3/Crypto/md5.cpp b/rpcs3/rpcs3/Crypto/md5.cpp index e20cf20be..55af16fcd 100644 --- a/rpcs3/rpcs3/Crypto/md5.cpp +++ b/rpcs3/rpcs3/Crypto/md5.cpp @@ -37,199 +37,197 @@ * 32-bit integer manipulation macros (little endian) */ #ifndef GET_UINT32_LE -#define GET_UINT32_LE(n,b,i) \ -{ \ - (n) = ( static_cast((b)[(i) ]) ) \ - | ( static_cast((b)[(i) + 1]) << 8 ) \ - | ( static_cast((b)[(i) + 2]) << 16 ) \ - | ( static_cast((b)[(i) + 3]) << 24 );\ -} +#define GET_UINT32_LE(n, b, i) \ + { \ + (n) = (static_cast((b)[(i)])) | (static_cast((b)[(i) + 1]) << 8) | (static_cast((b)[(i) + 2]) << 16) | (static_cast((b)[(i) + 3]) << 24); \ + } #endif #ifndef PUT_UINT32_LE -#define PUT_UINT32_LE(n,b,i) \ -{ \ - (b)[(i) ] = static_cast(( (n) ) & 0xFF ); \ - (b)[(i) + 1] = static_cast(( (n) >> 8 ) & 0xFF ); \ - (b)[(i) + 2] = static_cast(( (n) >> 16 ) & 0xFF ); \ - (b)[(i) + 3] = static_cast(( (n) >> 24 ) & 0xFF ); \ -} +#define PUT_UINT32_LE(n, b, i) \ + { \ + (b)[(i)] = static_cast(((n)) & 0xFF); \ + (b)[(i) + 1] = static_cast(((n) >> 8) & 0xFF); \ + (b)[(i) + 2] = static_cast(((n) >> 16) & 0xFF); \ + (b)[(i) + 3] = static_cast(((n) >> 24) & 0xFF); \ + } #endif -void mbedtls_md5_init( mbedtls_md5_context *ctx ) +void mbedtls_md5_init(mbedtls_md5_context* ctx) { - memset( ctx, 0, sizeof( mbedtls_md5_context ) ); + memset(ctx, 0, sizeof(mbedtls_md5_context)); } -void mbedtls_md5_free( mbedtls_md5_context *ctx ) +void mbedtls_md5_free(mbedtls_md5_context* ctx) { - if( ctx == NULL ) - return; + if (ctx == NULL) + return; - mbedtls_zeroize( ctx, sizeof( mbedtls_md5_context ) ); + mbedtls_zeroize(ctx, sizeof(mbedtls_md5_context)); } -void mbedtls_md5_clone( mbedtls_md5_context *dst, - const mbedtls_md5_context *src ) +void mbedtls_md5_clone(mbedtls_md5_context* dst, + const mbedtls_md5_context* src) { - *dst = *src; + *dst = *src; } /* * MD5 context setup */ -int mbedtls_md5_starts_ret( mbedtls_md5_context *ctx ) +int mbedtls_md5_starts_ret(mbedtls_md5_context* ctx) { - ctx->total[0] = 0; - ctx->total[1] = 0; + ctx->total[0] = 0; + ctx->total[1] = 0; - ctx->state[0] = 0x67452301; - ctx->state[1] = 0xEFCDAB89; - ctx->state[2] = 0x98BADCFE; - ctx->state[3] = 0x10325476; + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xEFCDAB89; + ctx->state[2] = 0x98BADCFE; + ctx->state[3] = 0x10325476; - return( 0 ); + return (0); } #if !defined(MBEDTLS_DEPRECATED_REMOVED) -void mbedtls_md5_starts( mbedtls_md5_context *ctx ) +void mbedtls_md5_starts(mbedtls_md5_context* ctx) { - mbedtls_md5_starts_ret( ctx ); + mbedtls_md5_starts_ret(ctx); } #endif #if !defined(MBEDTLS_MD5_PROCESS_ALT) -int mbedtls_internal_md5_process( mbedtls_md5_context *ctx, - const unsigned char data[64] ) +int mbedtls_internal_md5_process(mbedtls_md5_context* ctx, + const unsigned char data[64]) { - uint32_t X[16], A, B, C, D; + uint32_t X[16], A, B, C, D; - GET_UINT32_LE( X[ 0], data, 0 ); - GET_UINT32_LE( X[ 1], data, 4 ); - GET_UINT32_LE( X[ 2], data, 8 ); - GET_UINT32_LE( X[ 3], data, 12 ); - GET_UINT32_LE( X[ 4], data, 16 ); - GET_UINT32_LE( X[ 5], data, 20 ); - GET_UINT32_LE( X[ 6], data, 24 ); - GET_UINT32_LE( X[ 7], data, 28 ); - GET_UINT32_LE( X[ 8], data, 32 ); - GET_UINT32_LE( X[ 9], data, 36 ); - GET_UINT32_LE( X[10], data, 40 ); - GET_UINT32_LE( X[11], data, 44 ); - GET_UINT32_LE( X[12], data, 48 ); - GET_UINT32_LE( X[13], data, 52 ); - GET_UINT32_LE( X[14], data, 56 ); - GET_UINT32_LE( X[15], data, 60 ); + GET_UINT32_LE(X[0], data, 0); + GET_UINT32_LE(X[1], data, 4); + GET_UINT32_LE(X[2], data, 8); + GET_UINT32_LE(X[3], data, 12); + GET_UINT32_LE(X[4], data, 16); + GET_UINT32_LE(X[5], data, 20); + GET_UINT32_LE(X[6], data, 24); + GET_UINT32_LE(X[7], data, 28); + GET_UINT32_LE(X[8], data, 32); + GET_UINT32_LE(X[9], data, 36); + GET_UINT32_LE(X[10], data, 40); + GET_UINT32_LE(X[11], data, 44); + GET_UINT32_LE(X[12], data, 48); + GET_UINT32_LE(X[13], data, 52); + GET_UINT32_LE(X[14], data, 56); + GET_UINT32_LE(X[15], data, 60); -#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) +#define S(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) -#define P(a,b,c,d,k,s,t) \ -{ \ - a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \ -} +#define P(a, b, c, d, k, s, t) \ + { \ + a += F(b, c, d) + X[k] + t; \ + a = S(a, s) + b; \ + } - A = ctx->state[0]; - B = ctx->state[1]; - C = ctx->state[2]; - D = ctx->state[3]; + A = ctx->state[0]; + B = ctx->state[1]; + C = ctx->state[2]; + D = ctx->state[3]; -#define F(x,y,z) (z ^ (x & (y ^ z))) +#define F(x, y, z) (z ^ (x & (y ^ z))) - P( A, B, C, D, 0, 7, 0xD76AA478 ); - P( D, A, B, C, 1, 12, 0xE8C7B756 ); - P( C, D, A, B, 2, 17, 0x242070DB ); - P( B, C, D, A, 3, 22, 0xC1BDCEEE ); - P( A, B, C, D, 4, 7, 0xF57C0FAF ); - P( D, A, B, C, 5, 12, 0x4787C62A ); - P( C, D, A, B, 6, 17, 0xA8304613 ); - P( B, C, D, A, 7, 22, 0xFD469501 ); - P( A, B, C, D, 8, 7, 0x698098D8 ); - P( D, A, B, C, 9, 12, 0x8B44F7AF ); - P( C, D, A, B, 10, 17, 0xFFFF5BB1 ); - P( B, C, D, A, 11, 22, 0x895CD7BE ); - P( A, B, C, D, 12, 7, 0x6B901122 ); - P( D, A, B, C, 13, 12, 0xFD987193 ); - P( C, D, A, B, 14, 17, 0xA679438E ); - P( B, C, D, A, 15, 22, 0x49B40821 ); + P(A, B, C, D, 0, 7, 0xD76AA478); + P(D, A, B, C, 1, 12, 0xE8C7B756); + P(C, D, A, B, 2, 17, 0x242070DB); + P(B, C, D, A, 3, 22, 0xC1BDCEEE); + P(A, B, C, D, 4, 7, 0xF57C0FAF); + P(D, A, B, C, 5, 12, 0x4787C62A); + P(C, D, A, B, 6, 17, 0xA8304613); + P(B, C, D, A, 7, 22, 0xFD469501); + P(A, B, C, D, 8, 7, 0x698098D8); + P(D, A, B, C, 9, 12, 0x8B44F7AF); + P(C, D, A, B, 10, 17, 0xFFFF5BB1); + P(B, C, D, A, 11, 22, 0x895CD7BE); + P(A, B, C, D, 12, 7, 0x6B901122); + P(D, A, B, C, 13, 12, 0xFD987193); + P(C, D, A, B, 14, 17, 0xA679438E); + P(B, C, D, A, 15, 22, 0x49B40821); #undef F -#define F(x,y,z) (y ^ (z & (x ^ y))) +#define F(x, y, z) (y ^ (z & (x ^ y))) - P( A, B, C, D, 1, 5, 0xF61E2562 ); - P( D, A, B, C, 6, 9, 0xC040B340 ); - P( C, D, A, B, 11, 14, 0x265E5A51 ); - P( B, C, D, A, 0, 20, 0xE9B6C7AA ); - P( A, B, C, D, 5, 5, 0xD62F105D ); - P( D, A, B, C, 10, 9, 0x02441453 ); - P( C, D, A, B, 15, 14, 0xD8A1E681 ); - P( B, C, D, A, 4, 20, 0xE7D3FBC8 ); - P( A, B, C, D, 9, 5, 0x21E1CDE6 ); - P( D, A, B, C, 14, 9, 0xC33707D6 ); - P( C, D, A, B, 3, 14, 0xF4D50D87 ); - P( B, C, D, A, 8, 20, 0x455A14ED ); - P( A, B, C, D, 13, 5, 0xA9E3E905 ); - P( D, A, B, C, 2, 9, 0xFCEFA3F8 ); - P( C, D, A, B, 7, 14, 0x676F02D9 ); - P( B, C, D, A, 12, 20, 0x8D2A4C8A ); + P(A, B, C, D, 1, 5, 0xF61E2562); + P(D, A, B, C, 6, 9, 0xC040B340); + P(C, D, A, B, 11, 14, 0x265E5A51); + P(B, C, D, A, 0, 20, 0xE9B6C7AA); + P(A, B, C, D, 5, 5, 0xD62F105D); + P(D, A, B, C, 10, 9, 0x02441453); + P(C, D, A, B, 15, 14, 0xD8A1E681); + P(B, C, D, A, 4, 20, 0xE7D3FBC8); + P(A, B, C, D, 9, 5, 0x21E1CDE6); + P(D, A, B, C, 14, 9, 0xC33707D6); + P(C, D, A, B, 3, 14, 0xF4D50D87); + P(B, C, D, A, 8, 20, 0x455A14ED); + P(A, B, C, D, 13, 5, 0xA9E3E905); + P(D, A, B, C, 2, 9, 0xFCEFA3F8); + P(C, D, A, B, 7, 14, 0x676F02D9); + P(B, C, D, A, 12, 20, 0x8D2A4C8A); #undef F -#define F(x,y,z) (x ^ y ^ z) +#define F(x, y, z) (x ^ y ^ z) - P( A, B, C, D, 5, 4, 0xFFFA3942 ); - P( D, A, B, C, 8, 11, 0x8771F681 ); - P( C, D, A, B, 11, 16, 0x6D9D6122 ); - P( B, C, D, A, 14, 23, 0xFDE5380C ); - P( A, B, C, D, 1, 4, 0xA4BEEA44 ); - P( D, A, B, C, 4, 11, 0x4BDECFA9 ); - P( C, D, A, B, 7, 16, 0xF6BB4B60 ); - P( B, C, D, A, 10, 23, 0xBEBFBC70 ); - P( A, B, C, D, 13, 4, 0x289B7EC6 ); - P( D, A, B, C, 0, 11, 0xEAA127FA ); - P( C, D, A, B, 3, 16, 0xD4EF3085 ); - P( B, C, D, A, 6, 23, 0x04881D05 ); - P( A, B, C, D, 9, 4, 0xD9D4D039 ); - P( D, A, B, C, 12, 11, 0xE6DB99E5 ); - P( C, D, A, B, 15, 16, 0x1FA27CF8 ); - P( B, C, D, A, 2, 23, 0xC4AC5665 ); + P(A, B, C, D, 5, 4, 0xFFFA3942); + P(D, A, B, C, 8, 11, 0x8771F681); + P(C, D, A, B, 11, 16, 0x6D9D6122); + P(B, C, D, A, 14, 23, 0xFDE5380C); + P(A, B, C, D, 1, 4, 0xA4BEEA44); + P(D, A, B, C, 4, 11, 0x4BDECFA9); + P(C, D, A, B, 7, 16, 0xF6BB4B60); + P(B, C, D, A, 10, 23, 0xBEBFBC70); + P(A, B, C, D, 13, 4, 0x289B7EC6); + P(D, A, B, C, 0, 11, 0xEAA127FA); + P(C, D, A, B, 3, 16, 0xD4EF3085); + P(B, C, D, A, 6, 23, 0x04881D05); + P(A, B, C, D, 9, 4, 0xD9D4D039); + P(D, A, B, C, 12, 11, 0xE6DB99E5); + P(C, D, A, B, 15, 16, 0x1FA27CF8); + P(B, C, D, A, 2, 23, 0xC4AC5665); #undef F -#define F(x,y,z) (y ^ (x | ~z)) +#define F(x, y, z) (y ^ (x | ~z)) - P( A, B, C, D, 0, 6, 0xF4292244 ); - P( D, A, B, C, 7, 10, 0x432AFF97 ); - P( C, D, A, B, 14, 15, 0xAB9423A7 ); - P( B, C, D, A, 5, 21, 0xFC93A039 ); - P( A, B, C, D, 12, 6, 0x655B59C3 ); - P( D, A, B, C, 3, 10, 0x8F0CCC92 ); - P( C, D, A, B, 10, 15, 0xFFEFF47D ); - P( B, C, D, A, 1, 21, 0x85845DD1 ); - P( A, B, C, D, 8, 6, 0x6FA87E4F ); - P( D, A, B, C, 15, 10, 0xFE2CE6E0 ); - P( C, D, A, B, 6, 15, 0xA3014314 ); - P( B, C, D, A, 13, 21, 0x4E0811A1 ); - P( A, B, C, D, 4, 6, 0xF7537E82 ); - P( D, A, B, C, 11, 10, 0xBD3AF235 ); - P( C, D, A, B, 2, 15, 0x2AD7D2BB ); - P( B, C, D, A, 9, 21, 0xEB86D391 ); + P(A, B, C, D, 0, 6, 0xF4292244); + P(D, A, B, C, 7, 10, 0x432AFF97); + P(C, D, A, B, 14, 15, 0xAB9423A7); + P(B, C, D, A, 5, 21, 0xFC93A039); + P(A, B, C, D, 12, 6, 0x655B59C3); + P(D, A, B, C, 3, 10, 0x8F0CCC92); + P(C, D, A, B, 10, 15, 0xFFEFF47D); + P(B, C, D, A, 1, 21, 0x85845DD1); + P(A, B, C, D, 8, 6, 0x6FA87E4F); + P(D, A, B, C, 15, 10, 0xFE2CE6E0); + P(C, D, A, B, 6, 15, 0xA3014314); + P(B, C, D, A, 13, 21, 0x4E0811A1); + P(A, B, C, D, 4, 6, 0xF7537E82); + P(D, A, B, C, 11, 10, 0xBD3AF235); + P(C, D, A, B, 2, 15, 0x2AD7D2BB); + P(B, C, D, A, 9, 21, 0xEB86D391); #undef F - ctx->state[0] += A; - ctx->state[1] += B; - ctx->state[2] += C; - ctx->state[3] += D; + ctx->state[0] += A; + ctx->state[1] += B; + ctx->state[2] += C; + ctx->state[3] += D; - return( 0 ); + return (0); } #if !defined(MBEDTLS_DEPRECATED_REMOVED) -void mbedtls_md5_process( mbedtls_md5_context *ctx, - const unsigned char data[64] ) +void mbedtls_md5_process(mbedtls_md5_context* ctx, + const unsigned char data[64]) { - mbedtls_internal_md5_process( ctx, data ); + mbedtls_internal_md5_process(ctx, data); } #endif #endif /* !MBEDTLS_MD5_PROCESS_ALT */ @@ -237,125 +235,124 @@ void mbedtls_md5_process( mbedtls_md5_context *ctx, /* * MD5 process buffer */ -int mbedtls_md5_update_ret( mbedtls_md5_context *ctx, - const unsigned char *input, - size_t ilen ) +int mbedtls_md5_update_ret(mbedtls_md5_context* ctx, + const unsigned char* input, + size_t ilen) { - int ret; - size_t fill; - uint32_t left; + int ret; + size_t fill; + uint32_t left; - if( ilen == 0 ) - return( 0 ); + if (ilen == 0) + return (0); - left = ctx->total[0] & 0x3F; - fill = 64 - left; + left = ctx->total[0] & 0x3F; + fill = 64 - left; - ctx->total[0] += static_cast(ilen); - ctx->total[0] &= 0xFFFFFFFF; + ctx->total[0] += static_cast(ilen); + ctx->total[0] &= 0xFFFFFFFF; - if( ctx->total[0] < static_cast(ilen) ) - ctx->total[1]++; + if (ctx->total[0] < static_cast(ilen)) + ctx->total[1]++; - if( left && ilen >= fill ) - { - memcpy( ctx->buffer + left, input, fill ); - if( ( ret = mbedtls_internal_md5_process( ctx, ctx->buffer ) ) != 0 ) - return( ret ); + if (left && ilen >= fill) + { + memcpy(ctx->buffer + left, input, fill); + if ((ret = mbedtls_internal_md5_process(ctx, ctx->buffer)) != 0) + return (ret); - input += fill; - ilen -= fill; - left = 0; - } + input += fill; + ilen -= fill; + left = 0; + } - while( ilen >= 64 ) - { - if( ( ret = mbedtls_internal_md5_process( ctx, input ) ) != 0 ) - return( ret ); + while (ilen >= 64) + { + if ((ret = mbedtls_internal_md5_process(ctx, input)) != 0) + return (ret); - input += 64; - ilen -= 64; - } + input += 64; + ilen -= 64; + } - if( ilen > 0 ) - { - memcpy( ctx->buffer + left, input, ilen ); - } + if (ilen > 0) + { + memcpy(ctx->buffer + left, input, ilen); + } - return( 0 ); + return (0); } #if !defined(MBEDTLS_DEPRECATED_REMOVED) -void mbedtls_md5_update( mbedtls_md5_context *ctx, - const unsigned char *input, - size_t ilen ) +void mbedtls_md5_update(mbedtls_md5_context* ctx, + const unsigned char* input, + size_t ilen) { - mbedtls_md5_update_ret( ctx, input, ilen ); + mbedtls_md5_update_ret(ctx, input, ilen); } #endif /* * MD5 final digest */ -int mbedtls_md5_finish_ret( mbedtls_md5_context *ctx, - unsigned char output[16] ) +int mbedtls_md5_finish_ret(mbedtls_md5_context* ctx, + unsigned char output[16]) { - int ret; - uint32_t used; - uint32_t high, low; + int ret; + uint32_t used; + uint32_t high, low; - /* - * Add padding: 0x80 then 0x00 until 8 bytes remain for the length - */ - used = ctx->total[0] & 0x3F; + /* + * Add padding: 0x80 then 0x00 until 8 bytes remain for the length + */ + used = ctx->total[0] & 0x3F; - ctx->buffer[used++] = 0x80; + ctx->buffer[used++] = 0x80; - if( used <= 56 ) - { - /* Enough room for padding + length in current block */ - memset( ctx->buffer + used, 0, 56 - used ); - } - else - { - /* We'll need an extra block */ - memset( ctx->buffer + used, 0, 64 - used ); + if (used <= 56) + { + /* Enough room for padding + length in current block */ + memset(ctx->buffer + used, 0, 56 - used); + } + else + { + /* We'll need an extra block */ + memset(ctx->buffer + used, 0, 64 - used); - if( ( ret = mbedtls_internal_md5_process( ctx, ctx->buffer ) ) != 0 ) - return( ret ); + if ((ret = mbedtls_internal_md5_process(ctx, ctx->buffer)) != 0) + return (ret); - memset( ctx->buffer, 0, 56 ); - } + memset(ctx->buffer, 0, 56); + } - /* - * Add message length - */ - high = ( ctx->total[0] >> 29 ) - | ( ctx->total[1] << 3 ); - low = ( ctx->total[0] << 3 ); + /* + * Add message length + */ + high = (ctx->total[0] >> 29) | (ctx->total[1] << 3); + low = (ctx->total[0] << 3); - PUT_UINT32_LE( low, ctx->buffer, 56 ); - PUT_UINT32_LE( high, ctx->buffer, 60 ); + PUT_UINT32_LE(low, ctx->buffer, 56); + PUT_UINT32_LE(high, ctx->buffer, 60); - if( ( ret = mbedtls_internal_md5_process( ctx, ctx->buffer ) ) != 0 ) - return( ret ); + if ((ret = mbedtls_internal_md5_process(ctx, ctx->buffer)) != 0) + return (ret); - /* - * Output final state - */ - PUT_UINT32_LE( ctx->state[0], output, 0 ); - PUT_UINT32_LE( ctx->state[1], output, 4 ); - PUT_UINT32_LE( ctx->state[2], output, 8 ); - PUT_UINT32_LE( ctx->state[3], output, 12 ); + /* + * Output final state + */ + PUT_UINT32_LE(ctx->state[0], output, 0); + PUT_UINT32_LE(ctx->state[1], output, 4); + PUT_UINT32_LE(ctx->state[2], output, 8); + PUT_UINT32_LE(ctx->state[3], output, 12); - return( 0 ); + return (0); } #if !defined(MBEDTLS_DEPRECATED_REMOVED) -void mbedtls_md5_finish( mbedtls_md5_context *ctx, - unsigned char output[16] ) +void mbedtls_md5_finish(mbedtls_md5_context* ctx, + unsigned char output[16]) { - mbedtls_md5_finish_ret( ctx, output ); + mbedtls_md5_finish_ret(ctx, output); } #endif @@ -364,36 +361,36 @@ void mbedtls_md5_finish( mbedtls_md5_context *ctx, /* * output = MD5( input buffer ) */ -int mbedtls_md5_ret( const unsigned char *input, - size_t ilen, - unsigned char output[16] ) +int mbedtls_md5_ret(const unsigned char* input, + size_t ilen, + unsigned char output[16]) { - int ret; - mbedtls_md5_context ctx; + int ret; + mbedtls_md5_context ctx; - mbedtls_md5_init( &ctx ); + mbedtls_md5_init(&ctx); - if( ( ret = mbedtls_md5_starts_ret( &ctx ) ) != 0 ) - goto exit; + if ((ret = mbedtls_md5_starts_ret(&ctx)) != 0) + goto exit; - if( ( ret = mbedtls_md5_update_ret( &ctx, input, ilen ) ) != 0 ) - goto exit; + if ((ret = mbedtls_md5_update_ret(&ctx, input, ilen)) != 0) + goto exit; - if( ( ret = mbedtls_md5_finish_ret( &ctx, output ) ) != 0 ) - goto exit; + if ((ret = mbedtls_md5_finish_ret(&ctx, output)) != 0) + goto exit; exit: - mbedtls_md5_free( &ctx ); + mbedtls_md5_free(&ctx); - return( ret ); + return (ret); } #if !defined(MBEDTLS_DEPRECATED_REMOVED) -void mbedtls_md5( const unsigned char *input, - size_t ilen, - unsigned char output[16] ) +void mbedtls_md5(const unsigned char* input, + size_t ilen, + unsigned char output[16]) { - mbedtls_md5_ret( input, ilen, output ); + mbedtls_md5_ret(input, ilen, output); } #endif @@ -402,77 +399,74 @@ void mbedtls_md5( const unsigned char *input, * RFC 1321 test vectors */ static const unsigned char md5_test_buf[7][81] = -{ - { "" }, - { "a" }, - { "abc" }, - { "message digest" }, - { "abcdefghijklmnopqrstuvwxyz" }, - { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" }, - { "12345678901234567890123456789012345678901234567890123456789012" - "345678901234567890" } -}; + { + {""}, + {"a"}, + {"abc"}, + {"message digest"}, + {"abcdefghijklmnopqrstuvwxyz"}, + {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"}, + {"12345678901234567890123456789012345678901234567890123456789012" + "345678901234567890"}}; static const size_t md5_test_buflen[7] = -{ - 0, 1, 3, 14, 26, 62, 80 -}; + { + 0, 1, 3, 14, 26, 62, 80}; static const unsigned char md5_test_sum[7][16] = -{ - { 0xD4, 0x1D, 0x8C, 0xD9, 0x8F, 0x00, 0xB2, 0x04, - 0xE9, 0x80, 0x09, 0x98, 0xEC, 0xF8, 0x42, 0x7E }, - { 0x0C, 0xC1, 0x75, 0xB9, 0xC0, 0xF1, 0xB6, 0xA8, - 0x31, 0xC3, 0x99, 0xE2, 0x69, 0x77, 0x26, 0x61 }, - { 0x90, 0x01, 0x50, 0x98, 0x3C, 0xD2, 0x4F, 0xB0, - 0xD6, 0x96, 0x3F, 0x7D, 0x28, 0xE1, 0x7F, 0x72 }, - { 0xF9, 0x6B, 0x69, 0x7D, 0x7C, 0xB7, 0x93, 0x8D, - 0x52, 0x5A, 0x2F, 0x31, 0xAA, 0xF1, 0x61, 0xD0 }, - { 0xC3, 0xFC, 0xD3, 0xD7, 0x61, 0x92, 0xE4, 0x00, - 0x7D, 0xFB, 0x49, 0x6C, 0xCA, 0x67, 0xE1, 0x3B }, - { 0xD1, 0x74, 0xAB, 0x98, 0xD2, 0x77, 0xD9, 0xF5, - 0xA5, 0x61, 0x1C, 0x2C, 0x9F, 0x41, 0x9D, 0x9F }, - { 0x57, 0xED, 0xF4, 0xA2, 0x2B, 0xE3, 0xC9, 0x55, - 0xAC, 0x49, 0xDA, 0x2E, 0x21, 0x07, 0xB6, 0x7A } -}; + { + {0xD4, 0x1D, 0x8C, 0xD9, 0x8F, 0x00, 0xB2, 0x04, + 0xE9, 0x80, 0x09, 0x98, 0xEC, 0xF8, 0x42, 0x7E}, + {0x0C, 0xC1, 0x75, 0xB9, 0xC0, 0xF1, 0xB6, 0xA8, + 0x31, 0xC3, 0x99, 0xE2, 0x69, 0x77, 0x26, 0x61}, + {0x90, 0x01, 0x50, 0x98, 0x3C, 0xD2, 0x4F, 0xB0, + 0xD6, 0x96, 0x3F, 0x7D, 0x28, 0xE1, 0x7F, 0x72}, + {0xF9, 0x6B, 0x69, 0x7D, 0x7C, 0xB7, 0x93, 0x8D, + 0x52, 0x5A, 0x2F, 0x31, 0xAA, 0xF1, 0x61, 0xD0}, + {0xC3, 0xFC, 0xD3, 0xD7, 0x61, 0x92, 0xE4, 0x00, + 0x7D, 0xFB, 0x49, 0x6C, 0xCA, 0x67, 0xE1, 0x3B}, + {0xD1, 0x74, 0xAB, 0x98, 0xD2, 0x77, 0xD9, 0xF5, + 0xA5, 0x61, 0x1C, 0x2C, 0x9F, 0x41, 0x9D, 0x9F}, + {0x57, 0xED, 0xF4, 0xA2, 0x2B, 0xE3, 0xC9, 0x55, + 0xAC, 0x49, 0xDA, 0x2E, 0x21, 0x07, 0xB6, 0x7A}}; /* * Checkup routine */ -int mbedtls_md5_self_test( int verbose ) +int mbedtls_md5_self_test(int verbose) { - int i, ret = 0; - unsigned char md5sum[16]; + int i, ret = 0; + unsigned char md5sum[16]; - for( i = 0; i < 7; i++ ) - { - if( verbose != 0 ) - mbedtls_printf( " MD5 test #%d: ", i + 1 ); + for (i = 0; i < 7; i++) + { + if (verbose != 0) + mbedtls_printf(" MD5 test #%d: ", i + 1); - ret = mbedtls_md5_ret( md5_test_buf[i], md5_test_buflen[i], md5sum ); - if( ret != 0 ) - goto fail; + ret = mbedtls_md5_ret(md5_test_buf[i], md5_test_buflen[i], md5sum); + if (ret != 0) + goto fail; - if( memcmp( md5sum, md5_test_sum[i], 16 ) != 0 ) - { - ret = 1; - goto fail; - } + if (memcmp(md5sum, md5_test_sum[i], 16) != 0) + { + ret = 1; + goto fail; + } - if( verbose != 0 ) - mbedtls_printf( "passed\n" ); - } + if (verbose != 0) + mbedtls_printf("passed\n"); + } - if( verbose != 0 ) - mbedtls_printf( "\n" ); + if (verbose != 0) + mbedtls_printf("\n"); - return( 0 ); + return (0); fail: - if( verbose != 0 ) - mbedtls_printf( "failed\n" ); + if (verbose != 0) + mbedtls_printf("failed\n"); - return( ret ); + return (ret); } #endif /* MBEDTLS_SELF_TEST */ diff --git a/rpcs3/rpcs3/Crypto/md5.h b/rpcs3/rpcs3/Crypto/md5.h index 18b434779..6a7169a00 100644 --- a/rpcs3/rpcs3/Crypto/md5.h +++ b/rpcs3/rpcs3/Crypto/md5.h @@ -34,269 +34,269 @@ #include /* MBEDTLS_ERR_MD5_HW_ACCEL_FAILED is deprecated and should not be used. */ -#define MBEDTLS_ERR_MD5_HW_ACCEL_FAILED -0x002F /**< MD5 hardware accelerator failed */ +#define MBEDTLS_ERR_MD5_HW_ACCEL_FAILED -0x002F /**< MD5 hardware accelerator failed */ #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif #if !defined(MBEDTLS_MD5_ALT) -// Regular implementation -// + // Regular implementation + // -/** - * \brief MD5 context structure - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -typedef struct mbedtls_md5_context -{ - uint32_t total[2]; /*!< number of bytes processed */ - uint32_t state[4]; /*!< intermediate digest state */ - unsigned char buffer[64]; /*!< data block being processed */ -} -mbedtls_md5_context; + /** + * \brief MD5 context structure + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + typedef struct mbedtls_md5_context + { + uint32_t total[2]; /*!< number of bytes processed */ + uint32_t state[4]; /*!< intermediate digest state */ + unsigned char buffer[64]; /*!< data block being processed */ + } mbedtls_md5_context; -#else /* MBEDTLS_MD5_ALT */ +#else /* MBEDTLS_MD5_ALT */ #include "md5_alt.h" #endif /* MBEDTLS_MD5_ALT */ -/** - * \brief Initialize MD5 context - * - * \param ctx MD5 context to be initialized - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -void mbedtls_md5_init( mbedtls_md5_context *ctx ); + /** + * \brief Initialize MD5 context + * + * \param ctx MD5 context to be initialized + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + void mbedtls_md5_init(mbedtls_md5_context* ctx); -/** - * \brief Clear MD5 context - * - * \param ctx MD5 context to be cleared - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -void mbedtls_md5_free( mbedtls_md5_context *ctx ); + /** + * \brief Clear MD5 context + * + * \param ctx MD5 context to be cleared + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + void mbedtls_md5_free(mbedtls_md5_context* ctx); -/** - * \brief Clone (the state of) an MD5 context - * - * \param dst The destination context - * \param src The context to be cloned - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -void mbedtls_md5_clone( mbedtls_md5_context *dst, - const mbedtls_md5_context *src ); + /** + * \brief Clone (the state of) an MD5 context + * + * \param dst The destination context + * \param src The context to be cloned + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + void mbedtls_md5_clone(mbedtls_md5_context* dst, + const mbedtls_md5_context* src); -/** - * \brief MD5 context setup - * - * \param ctx context to be initialized - * - * \return 0 if successful - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -int mbedtls_md5_starts_ret( mbedtls_md5_context *ctx ); + /** + * \brief MD5 context setup + * + * \param ctx context to be initialized + * + * \return 0 if successful + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + int mbedtls_md5_starts_ret(mbedtls_md5_context* ctx); -/** - * \brief MD5 process buffer - * - * \param ctx MD5 context - * \param input buffer holding the data - * \param ilen length of the input data - * - * \return 0 if successful - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -int mbedtls_md5_update_ret( mbedtls_md5_context *ctx, - const unsigned char *input, - size_t ilen ); + /** + * \brief MD5 process buffer + * + * \param ctx MD5 context + * \param input buffer holding the data + * \param ilen length of the input data + * + * \return 0 if successful + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + int mbedtls_md5_update_ret(mbedtls_md5_context* ctx, + const unsigned char* input, + size_t ilen); -/** - * \brief MD5 final digest - * - * \param ctx MD5 context - * \param output MD5 checksum result - * - * \return 0 if successful - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -int mbedtls_md5_finish_ret( mbedtls_md5_context *ctx, - unsigned char output[16] ); + /** + * \brief MD5 final digest + * + * \param ctx MD5 context + * \param output MD5 checksum result + * + * \return 0 if successful + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + int mbedtls_md5_finish_ret(mbedtls_md5_context* ctx, + unsigned char output[16]); -/** - * \brief MD5 process data block (internal use only) - * - * \param ctx MD5 context - * \param data buffer holding one block of data - * - * \return 0 if successful - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -int mbedtls_internal_md5_process( mbedtls_md5_context *ctx, - const unsigned char data[64] ); + /** + * \brief MD5 process data block (internal use only) + * + * \param ctx MD5 context + * \param data buffer holding one block of data + * + * \return 0 if successful + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + int mbedtls_internal_md5_process(mbedtls_md5_context* ctx, + const unsigned char data[64]); #if !defined(MBEDTLS_DEPRECATED_REMOVED) #if defined(MBEDTLS_DEPRECATED_WARNING) -#define MBEDTLS_DEPRECATED __attribute__((deprecated)) +#define MBEDTLS_DEPRECATED __attribute__((deprecated)) #else #define MBEDTLS_DEPRECATED #endif -/** - * \brief MD5 context setup - * - * \deprecated Superseded by mbedtls_md5_starts_ret() in 2.7.0 - * - * \param ctx context to be initialized - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -MBEDTLS_DEPRECATED void mbedtls_md5_starts( mbedtls_md5_context *ctx ); + /** + * \brief MD5 context setup + * + * \deprecated Superseded by mbedtls_md5_starts_ret() in 2.7.0 + * + * \param ctx context to be initialized + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + MBEDTLS_DEPRECATED void mbedtls_md5_starts(mbedtls_md5_context* ctx); -/** - * \brief MD5 process buffer - * - * \deprecated Superseded by mbedtls_md5_update_ret() in 2.7.0 - * - * \param ctx MD5 context - * \param input buffer holding the data - * \param ilen length of the input data - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -MBEDTLS_DEPRECATED void mbedtls_md5_update( mbedtls_md5_context *ctx, - const unsigned char *input, - size_t ilen ); + /** + * \brief MD5 process buffer + * + * \deprecated Superseded by mbedtls_md5_update_ret() in 2.7.0 + * + * \param ctx MD5 context + * \param input buffer holding the data + * \param ilen length of the input data + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + MBEDTLS_DEPRECATED void mbedtls_md5_update(mbedtls_md5_context* ctx, + const unsigned char* input, + size_t ilen); -/** - * \brief MD5 final digest - * - * \deprecated Superseded by mbedtls_md5_finish_ret() in 2.7.0 - * - * \param ctx MD5 context - * \param output MD5 checksum result - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -MBEDTLS_DEPRECATED void mbedtls_md5_finish( mbedtls_md5_context *ctx, - unsigned char output[16] ); + /** + * \brief MD5 final digest + * + * \deprecated Superseded by mbedtls_md5_finish_ret() in 2.7.0 + * + * \param ctx MD5 context + * \param output MD5 checksum result + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + MBEDTLS_DEPRECATED void mbedtls_md5_finish(mbedtls_md5_context* ctx, + unsigned char output[16]); -/** - * \brief MD5 process data block (internal use only) - * - * \deprecated Superseded by mbedtls_internal_md5_process() in 2.7.0 - * - * \param ctx MD5 context - * \param data buffer holding one block of data - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -MBEDTLS_DEPRECATED void mbedtls_md5_process( mbedtls_md5_context *ctx, - const unsigned char data[64] ); + /** + * \brief MD5 process data block (internal use only) + * + * \deprecated Superseded by mbedtls_internal_md5_process() in 2.7.0 + * + * \param ctx MD5 context + * \param data buffer holding one block of data + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + MBEDTLS_DEPRECATED void mbedtls_md5_process(mbedtls_md5_context* ctx, + const unsigned char data[64]); #undef MBEDTLS_DEPRECATED #endif /* !MBEDTLS_DEPRECATED_REMOVED */ -/** - * \brief Output = MD5( input buffer ) - * - * \param input buffer holding the data - * \param ilen length of the input data - * \param output MD5 checksum result - * - * \return 0 if successful - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -int mbedtls_md5_ret( const unsigned char *input, - size_t ilen, - unsigned char output[16] ); + /** + * \brief Output = MD5( input buffer ) + * + * \param input buffer holding the data + * \param ilen length of the input data + * \param output MD5 checksum result + * + * \return 0 if successful + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + int mbedtls_md5_ret(const unsigned char* input, + size_t ilen, + unsigned char output[16]); #if !defined(MBEDTLS_DEPRECATED_REMOVED) #if defined(MBEDTLS_DEPRECATED_WARNING) -#define MBEDTLS_DEPRECATED __attribute__((deprecated)) +#define MBEDTLS_DEPRECATED __attribute__((deprecated)) #else #define MBEDTLS_DEPRECATED #endif -/** - * \brief Output = MD5( input buffer ) - * - * \deprecated Superseded by mbedtls_md5_ret() in 2.7.0 - * - * \param input buffer holding the data - * \param ilen length of the input data - * \param output MD5 checksum result - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -MBEDTLS_DEPRECATED void mbedtls_md5( const unsigned char *input, - size_t ilen, - unsigned char output[16] ); + /** + * \brief Output = MD5( input buffer ) + * + * \deprecated Superseded by mbedtls_md5_ret() in 2.7.0 + * + * \param input buffer holding the data + * \param ilen length of the input data + * \param output MD5 checksum result + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + MBEDTLS_DEPRECATED void mbedtls_md5(const unsigned char* input, + size_t ilen, + unsigned char output[16]); #undef MBEDTLS_DEPRECATED #endif /* !MBEDTLS_DEPRECATED_REMOVED */ #if defined(MBEDTLS_SELF_TEST) -/** - * \brief Checkup routine - * - * \return 0 if successful, or 1 if the test failed - * - * \warning MD5 is considered a weak message digest and its use - * constitutes a security risk. We recommend considering - * stronger message digests instead. - * - */ -int mbedtls_md5_self_test( int verbose ); + /** + * \brief Checkup routine + * + * \return 0 if successful, or 1 if the test failed + * + * \warning MD5 is considered a weak message digest and its use + * constitutes a security risk. We recommend considering + * stronger message digests instead. + * + */ + int mbedtls_md5_self_test(int verbose); #endif /* MBEDTLS_SELF_TEST */ diff --git a/rpcs3/rpcs3/Crypto/sha1.cpp b/rpcs3/rpcs3/Crypto/sha1.cpp index ee982e705..ea33f9ec8 100644 --- a/rpcs3/rpcs3/Crypto/sha1.cpp +++ b/rpcs3/rpcs3/Crypto/sha1.cpp @@ -35,363 +35,358 @@ * 32-bit integer manipulation macros (big endian) */ #ifndef GET_UINT32_BE -#define GET_UINT32_BE(n,b,i) \ -{ \ - (n) = ( static_cast((b)[(i) ]) << 24 ) \ - | ( static_cast((b)[(i) + 1]) << 16 ) \ - | ( static_cast((b)[(i) + 2]) << 8 ) \ - | ( static_cast((b)[(i) + 3]) );\ -} +#define GET_UINT32_BE(n, b, i) \ + { \ + (n) = (static_cast((b)[(i)]) << 24) | (static_cast((b)[(i) + 1]) << 16) | (static_cast((b)[(i) + 2]) << 8) | (static_cast((b)[(i) + 3])); \ + } #endif #ifndef PUT_UINT32_BE -#define PUT_UINT32_BE(n,b,i) \ -{ \ - (b)[(i) ] = static_cast ( (n) >> 24 ); \ - (b)[(i) + 1] = static_cast ( (n) >> 16 ); \ - (b)[(i) + 2] = static_cast ( (n) >> 8 ); \ - (b)[(i) + 3] = static_cast ( (n) ); \ -} +#define PUT_UINT32_BE(n, b, i) \ + { \ + (b)[(i)] = static_cast((n) >> 24); \ + (b)[(i) + 1] = static_cast((n) >> 16); \ + (b)[(i) + 2] = static_cast((n) >> 8); \ + (b)[(i) + 3] = static_cast((n)); \ + } #endif /* * SHA-1 context setup */ -void sha1_starts( sha1_context *ctx ) +void sha1_starts(sha1_context* ctx) { - ctx->total[0] = 0; - ctx->total[1] = 0; + ctx->total[0] = 0; + ctx->total[1] = 0; - ctx->state[0] = 0x67452301; - ctx->state[1] = 0xEFCDAB89; - ctx->state[2] = 0x98BADCFE; - ctx->state[3] = 0x10325476; - ctx->state[4] = 0xC3D2E1F0; + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xEFCDAB89; + ctx->state[2] = 0x98BADCFE; + ctx->state[3] = 0x10325476; + ctx->state[4] = 0xC3D2E1F0; } -void sha1_process( sha1_context *ctx, const unsigned char data[64] ) +void sha1_process(sha1_context* ctx, const unsigned char data[64]) { - uint32_t temp, W[16], A, B, C, D, E; + uint32_t temp, W[16], A, B, C, D, E; - GET_UINT32_BE( W[ 0], data, 0 ); - GET_UINT32_BE( W[ 1], data, 4 ); - GET_UINT32_BE( W[ 2], data, 8 ); - GET_UINT32_BE( W[ 3], data, 12 ); - GET_UINT32_BE( W[ 4], data, 16 ); - GET_UINT32_BE( W[ 5], data, 20 ); - GET_UINT32_BE( W[ 6], data, 24 ); - GET_UINT32_BE( W[ 7], data, 28 ); - GET_UINT32_BE( W[ 8], data, 32 ); - GET_UINT32_BE( W[ 9], data, 36 ); - GET_UINT32_BE( W[10], data, 40 ); - GET_UINT32_BE( W[11], data, 44 ); - GET_UINT32_BE( W[12], data, 48 ); - GET_UINT32_BE( W[13], data, 52 ); - GET_UINT32_BE( W[14], data, 56 ); - GET_UINT32_BE( W[15], data, 60 ); + GET_UINT32_BE(W[0], data, 0); + GET_UINT32_BE(W[1], data, 4); + GET_UINT32_BE(W[2], data, 8); + GET_UINT32_BE(W[3], data, 12); + GET_UINT32_BE(W[4], data, 16); + GET_UINT32_BE(W[5], data, 20); + GET_UINT32_BE(W[6], data, 24); + GET_UINT32_BE(W[7], data, 28); + GET_UINT32_BE(W[8], data, 32); + GET_UINT32_BE(W[9], data, 36); + GET_UINT32_BE(W[10], data, 40); + GET_UINT32_BE(W[11], data, 44); + GET_UINT32_BE(W[12], data, 48); + GET_UINT32_BE(W[13], data, 52); + GET_UINT32_BE(W[14], data, 56); + GET_UINT32_BE(W[15], data, 60); -#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) +#define S(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) -#define R(t) \ -( \ - temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \ - W[(t - 14) & 0x0F] ^ W[ t & 0x0F], \ - ( W[t & 0x0F] = S(temp,1) ) \ -) +#define R(t) \ + ( \ + temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \ + W[(t - 14) & 0x0F] ^ W[t & 0x0F], \ + (W[t & 0x0F] = S(temp, 1))) -#define P(a,b,c,d,e,x) \ -{ \ - e += S(a,5) + F(b,c,d) + K + x; b = S(b,30); \ -} +#define P(a, b, c, d, e, x) \ + { \ + e += S(a, 5) + F(b, c, d) + K + x; \ + b = S(b, 30); \ + } - A = ctx->state[0]; - B = ctx->state[1]; - C = ctx->state[2]; - D = ctx->state[3]; - E = ctx->state[4]; + A = ctx->state[0]; + B = ctx->state[1]; + C = ctx->state[2]; + D = ctx->state[3]; + E = ctx->state[4]; -#define F(x,y,z) (z ^ (x & (y ^ z))) +#define F(x, y, z) (z ^ (x & (y ^ z))) #define K 0x5A827999 - P( A, B, C, D, E, W[0] ); - P( E, A, B, C, D, W[1] ); - P( D, E, A, B, C, W[2] ); - P( C, D, E, A, B, W[3] ); - P( B, C, D, E, A, W[4] ); - P( A, B, C, D, E, W[5] ); - P( E, A, B, C, D, W[6] ); - P( D, E, A, B, C, W[7] ); - P( C, D, E, A, B, W[8] ); - P( B, C, D, E, A, W[9] ); - P( A, B, C, D, E, W[10] ); - P( E, A, B, C, D, W[11] ); - P( D, E, A, B, C, W[12] ); - P( C, D, E, A, B, W[13] ); - P( B, C, D, E, A, W[14] ); - P( A, B, C, D, E, W[15] ); - P( E, A, B, C, D, R(16) ); - P( D, E, A, B, C, R(17) ); - P( C, D, E, A, B, R(18) ); - P( B, C, D, E, A, R(19) ); + P(A, B, C, D, E, W[0]); + P(E, A, B, C, D, W[1]); + P(D, E, A, B, C, W[2]); + P(C, D, E, A, B, W[3]); + P(B, C, D, E, A, W[4]); + P(A, B, C, D, E, W[5]); + P(E, A, B, C, D, W[6]); + P(D, E, A, B, C, W[7]); + P(C, D, E, A, B, W[8]); + P(B, C, D, E, A, W[9]); + P(A, B, C, D, E, W[10]); + P(E, A, B, C, D, W[11]); + P(D, E, A, B, C, W[12]); + P(C, D, E, A, B, W[13]); + P(B, C, D, E, A, W[14]); + P(A, B, C, D, E, W[15]); + P(E, A, B, C, D, R(16)); + P(D, E, A, B, C, R(17)); + P(C, D, E, A, B, R(18)); + P(B, C, D, E, A, R(19)); #undef K #undef F -#define F(x,y,z) (x ^ y ^ z) +#define F(x, y, z) (x ^ y ^ z) #define K 0x6ED9EBA1 - P( A, B, C, D, E, R(20) ); - P( E, A, B, C, D, R(21) ); - P( D, E, A, B, C, R(22) ); - P( C, D, E, A, B, R(23) ); - P( B, C, D, E, A, R(24) ); - P( A, B, C, D, E, R(25) ); - P( E, A, B, C, D, R(26) ); - P( D, E, A, B, C, R(27) ); - P( C, D, E, A, B, R(28) ); - P( B, C, D, E, A, R(29) ); - P( A, B, C, D, E, R(30) ); - P( E, A, B, C, D, R(31) ); - P( D, E, A, B, C, R(32) ); - P( C, D, E, A, B, R(33) ); - P( B, C, D, E, A, R(34) ); - P( A, B, C, D, E, R(35) ); - P( E, A, B, C, D, R(36) ); - P( D, E, A, B, C, R(37) ); - P( C, D, E, A, B, R(38) ); - P( B, C, D, E, A, R(39) ); + P(A, B, C, D, E, R(20)); + P(E, A, B, C, D, R(21)); + P(D, E, A, B, C, R(22)); + P(C, D, E, A, B, R(23)); + P(B, C, D, E, A, R(24)); + P(A, B, C, D, E, R(25)); + P(E, A, B, C, D, R(26)); + P(D, E, A, B, C, R(27)); + P(C, D, E, A, B, R(28)); + P(B, C, D, E, A, R(29)); + P(A, B, C, D, E, R(30)); + P(E, A, B, C, D, R(31)); + P(D, E, A, B, C, R(32)); + P(C, D, E, A, B, R(33)); + P(B, C, D, E, A, R(34)); + P(A, B, C, D, E, R(35)); + P(E, A, B, C, D, R(36)); + P(D, E, A, B, C, R(37)); + P(C, D, E, A, B, R(38)); + P(B, C, D, E, A, R(39)); #undef K #undef F -#define F(x,y,z) ((x & y) | (z & (x | y))) +#define F(x, y, z) ((x & y) | (z & (x | y))) #define K 0x8F1BBCDC - P( A, B, C, D, E, R(40) ); - P( E, A, B, C, D, R(41) ); - P( D, E, A, B, C, R(42) ); - P( C, D, E, A, B, R(43) ); - P( B, C, D, E, A, R(44) ); - P( A, B, C, D, E, R(45) ); - P( E, A, B, C, D, R(46) ); - P( D, E, A, B, C, R(47) ); - P( C, D, E, A, B, R(48) ); - P( B, C, D, E, A, R(49) ); - P( A, B, C, D, E, R(50) ); - P( E, A, B, C, D, R(51) ); - P( D, E, A, B, C, R(52) ); - P( C, D, E, A, B, R(53) ); - P( B, C, D, E, A, R(54) ); - P( A, B, C, D, E, R(55) ); - P( E, A, B, C, D, R(56) ); - P( D, E, A, B, C, R(57) ); - P( C, D, E, A, B, R(58) ); - P( B, C, D, E, A, R(59) ); + P(A, B, C, D, E, R(40)); + P(E, A, B, C, D, R(41)); + P(D, E, A, B, C, R(42)); + P(C, D, E, A, B, R(43)); + P(B, C, D, E, A, R(44)); + P(A, B, C, D, E, R(45)); + P(E, A, B, C, D, R(46)); + P(D, E, A, B, C, R(47)); + P(C, D, E, A, B, R(48)); + P(B, C, D, E, A, R(49)); + P(A, B, C, D, E, R(50)); + P(E, A, B, C, D, R(51)); + P(D, E, A, B, C, R(52)); + P(C, D, E, A, B, R(53)); + P(B, C, D, E, A, R(54)); + P(A, B, C, D, E, R(55)); + P(E, A, B, C, D, R(56)); + P(D, E, A, B, C, R(57)); + P(C, D, E, A, B, R(58)); + P(B, C, D, E, A, R(59)); #undef K #undef F -#define F(x,y,z) (x ^ y ^ z) +#define F(x, y, z) (x ^ y ^ z) #define K 0xCA62C1D6 - P( A, B, C, D, E, R(60) ); - P( E, A, B, C, D, R(61) ); - P( D, E, A, B, C, R(62) ); - P( C, D, E, A, B, R(63) ); - P( B, C, D, E, A, R(64) ); - P( A, B, C, D, E, R(65) ); - P( E, A, B, C, D, R(66) ); - P( D, E, A, B, C, R(67) ); - P( C, D, E, A, B, R(68) ); - P( B, C, D, E, A, R(69) ); - P( A, B, C, D, E, R(70) ); - P( E, A, B, C, D, R(71) ); - P( D, E, A, B, C, R(72) ); - P( C, D, E, A, B, R(73) ); - P( B, C, D, E, A, R(74) ); - P( A, B, C, D, E, R(75) ); - P( E, A, B, C, D, R(76) ); - P( D, E, A, B, C, R(77) ); - P( C, D, E, A, B, R(78) ); - P( B, C, D, E, A, R(79) ); + P(A, B, C, D, E, R(60)); + P(E, A, B, C, D, R(61)); + P(D, E, A, B, C, R(62)); + P(C, D, E, A, B, R(63)); + P(B, C, D, E, A, R(64)); + P(A, B, C, D, E, R(65)); + P(E, A, B, C, D, R(66)); + P(D, E, A, B, C, R(67)); + P(C, D, E, A, B, R(68)); + P(B, C, D, E, A, R(69)); + P(A, B, C, D, E, R(70)); + P(E, A, B, C, D, R(71)); + P(D, E, A, B, C, R(72)); + P(C, D, E, A, B, R(73)); + P(B, C, D, E, A, R(74)); + P(A, B, C, D, E, R(75)); + P(E, A, B, C, D, R(76)); + P(D, E, A, B, C, R(77)); + P(C, D, E, A, B, R(78)); + P(B, C, D, E, A, R(79)); #undef K #undef F - ctx->state[0] += A; - ctx->state[1] += B; - ctx->state[2] += C; - ctx->state[3] += D; - ctx->state[4] += E; + ctx->state[0] += A; + ctx->state[1] += B; + ctx->state[2] += C; + ctx->state[3] += D; + ctx->state[4] += E; } /* * SHA-1 process buffer */ -void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen ) +void sha1_update(sha1_context* ctx, const unsigned char* input, size_t ilen) { - size_t fill; - uint32_t left; + size_t fill; + uint32_t left; - // TODO:: Syphurith: Orz. It is said that size_t is an unsigned type.. - if( ilen <= 0 ) - return; + // TODO:: Syphurith: Orz. It is said that size_t is an unsigned type.. + if (ilen <= 0) + return; - left = ctx->total[0] & 0x3F; - fill = 64 - left; + left = ctx->total[0] & 0x3F; + fill = 64 - left; - ctx->total[0] += static_cast(ilen); - ctx->total[0] &= 0xFFFFFFFF; + ctx->total[0] += static_cast(ilen); + ctx->total[0] &= 0xFFFFFFFF; - if( ctx->total[0] < static_cast(ilen) ) - ctx->total[1]++; + if (ctx->total[0] < static_cast(ilen)) + ctx->total[1]++; - if( left && ilen >= fill ) - { - memcpy( ctx->buffer + left, input, fill ); - sha1_process( ctx, ctx->buffer ); - input += fill; - ilen -= fill; - left = 0; - } + if (left && ilen >= fill) + { + memcpy(ctx->buffer + left, input, fill); + sha1_process(ctx, ctx->buffer); + input += fill; + ilen -= fill; + left = 0; + } - while( ilen >= 64 ) - { - sha1_process( ctx, input ); - input += 64; - ilen -= 64; - } + while (ilen >= 64) + { + sha1_process(ctx, input); + input += 64; + ilen -= 64; + } - if( ilen > 0 ) - memcpy( ctx->buffer + left, input, ilen ); + if (ilen > 0) + memcpy(ctx->buffer + left, input, ilen); } static const unsigned char sha1_padding[64] = -{ - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; + { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* * SHA-1 final digest */ -void sha1_finish( sha1_context *ctx, unsigned char output[20] ) +void sha1_finish(sha1_context* ctx, unsigned char output[20]) { - uint32_t last, padn; - uint32_t high, low; - unsigned char msglen[8]; + uint32_t last, padn; + uint32_t high, low; + unsigned char msglen[8]; - high = ( ctx->total[0] >> 29 ) - | ( ctx->total[1] << 3 ); - low = ( ctx->total[0] << 3 ); + high = (ctx->total[0] >> 29) | (ctx->total[1] << 3); + low = (ctx->total[0] << 3); - PUT_UINT32_BE( high, msglen, 0 ); - PUT_UINT32_BE( low, msglen, 4 ); + PUT_UINT32_BE(high, msglen, 0); + PUT_UINT32_BE(low, msglen, 4); - last = ctx->total[0] & 0x3F; - padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); + last = ctx->total[0] & 0x3F; + padn = (last < 56) ? (56 - last) : (120 - last); - sha1_update( ctx, sha1_padding, padn ); - sha1_update( ctx, msglen, 8 ); + sha1_update(ctx, sha1_padding, padn); + sha1_update(ctx, msglen, 8); - PUT_UINT32_BE( ctx->state[0], output, 0 ); - PUT_UINT32_BE( ctx->state[1], output, 4 ); - PUT_UINT32_BE( ctx->state[2], output, 8 ); - PUT_UINT32_BE( ctx->state[3], output, 12 ); - PUT_UINT32_BE( ctx->state[4], output, 16 ); + PUT_UINT32_BE(ctx->state[0], output, 0); + PUT_UINT32_BE(ctx->state[1], output, 4); + PUT_UINT32_BE(ctx->state[2], output, 8); + PUT_UINT32_BE(ctx->state[3], output, 12); + PUT_UINT32_BE(ctx->state[4], output, 16); } /* * output = SHA-1( input buffer ) */ -void sha1( const unsigned char *input, size_t ilen, unsigned char output[20] ) +void sha1(const unsigned char* input, size_t ilen, unsigned char output[20]) { - sha1_context ctx; + sha1_context ctx; - sha1_starts( &ctx ); - sha1_update( &ctx, input, ilen ); - sha1_finish( &ctx, output ); + sha1_starts(&ctx); + sha1_update(&ctx, input, ilen); + sha1_finish(&ctx, output); - mbedtls_zeroize( &ctx, sizeof( sha1_context ) ); + mbedtls_zeroize(&ctx, sizeof(sha1_context)); } /* * SHA-1 HMAC context setup */ -void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keylen ) +void sha1_hmac_starts(sha1_context* ctx, const unsigned char* key, size_t keylen) { - size_t i; - unsigned char sum[20]; + size_t i; + unsigned char sum[20]; - if( keylen > 64 ) - { - sha1( key, keylen, sum ); - keylen = 20; - key = sum; - } + if (keylen > 64) + { + sha1(key, keylen, sum); + keylen = 20; + key = sum; + } - memset( ctx->ipad, 0x36, 64 ); - memset( ctx->opad, 0x5C, 64 ); + memset(ctx->ipad, 0x36, 64); + memset(ctx->opad, 0x5C, 64); - for( i = 0; i < keylen; i++ ) - { - ctx->ipad[i] ^= key[i]; - ctx->opad[i] ^= key[i]; - } + for (i = 0; i < keylen; i++) + { + ctx->ipad[i] ^= key[i]; + ctx->opad[i] ^= key[i]; + } - sha1_starts( ctx ); - sha1_update( ctx, ctx->ipad, 64 ); + sha1_starts(ctx); + sha1_update(ctx, ctx->ipad, 64); - mbedtls_zeroize( sum, sizeof( sum ) ); + mbedtls_zeroize(sum, sizeof(sum)); } /* * SHA-1 HMAC process buffer */ -void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, size_t ilen ) +void sha1_hmac_update(sha1_context* ctx, const unsigned char* input, size_t ilen) { - sha1_update( ctx, input, ilen ); + sha1_update(ctx, input, ilen); } /* * SHA-1 HMAC final digest */ -void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] ) +void sha1_hmac_finish(sha1_context* ctx, unsigned char output[20]) { - unsigned char tmpbuf[20]; + unsigned char tmpbuf[20]; - sha1_finish( ctx, tmpbuf ); - sha1_starts( ctx ); - sha1_update( ctx, ctx->opad, 64 ); - sha1_update( ctx, tmpbuf, 20 ); - sha1_finish( ctx, output ); + sha1_finish(ctx, tmpbuf); + sha1_starts(ctx); + sha1_update(ctx, ctx->opad, 64); + sha1_update(ctx, tmpbuf, 20); + sha1_finish(ctx, output); - memset( tmpbuf, 0, sizeof( tmpbuf ) ); + memset(tmpbuf, 0, sizeof(tmpbuf)); } /* * SHA1 HMAC context reset */ -void sha1_hmac_reset( sha1_context *ctx ) +void sha1_hmac_reset(sha1_context* ctx) { - sha1_starts( ctx ); - sha1_update( ctx, ctx->ipad, 64 ); + sha1_starts(ctx); + sha1_update(ctx, ctx->ipad, 64); } /* * output = HMAC-SHA-1( hmac key, input buffer ) */ -void sha1_hmac( const unsigned char *key, size_t keylen, - const unsigned char *input, size_t ilen, - unsigned char output[20] ) +void sha1_hmac(const unsigned char* key, size_t keylen, + const unsigned char* input, size_t ilen, + unsigned char output[20]) { - sha1_context ctx; + sha1_context ctx; - sha1_hmac_starts( &ctx, key, keylen ); - sha1_hmac_update( &ctx, input, ilen ); - sha1_hmac_finish( &ctx, output ); + sha1_hmac_starts(&ctx, key, keylen); + sha1_hmac_update(&ctx, input, ilen); + sha1_hmac_finish(&ctx, output); - memset( &ctx, 0, sizeof( sha1_context ) ); + memset(&ctx, 0, sizeof(sha1_context)); } diff --git a/rpcs3/rpcs3/Crypto/sha1.h b/rpcs3/rpcs3/Crypto/sha1.h index f616f468b..e0358db54 100644 --- a/rpcs3/rpcs3/Crypto/sha1.h +++ b/rpcs3/rpcs3/Crypto/sha1.h @@ -35,7 +35,7 @@ typedef UINT32 uint32_t; #include #endif -#define POLARSSL_ERR_SHA1_FILE_IO_ERROR -0x0076 /**< Read/write error in file. */ +#define POLARSSL_ERR_SHA1_FILE_IO_ERROR -0x0076 /**< Read/write error in file. */ // Regular implementation // @@ -45,118 +45,119 @@ typedef UINT32 uint32_t; */ typedef struct { - uint32_t total[2]; /*!< number of bytes processed */ - uint32_t state[5]; /*!< intermediate digest state */ - unsigned char buffer[64]; /*!< data block being processed */ + uint32_t total[2]; /*!< number of bytes processed */ + uint32_t state[5]; /*!< intermediate digest state */ + unsigned char buffer[64]; /*!< data block being processed */ - unsigned char ipad[64]; /*!< HMAC: inner padding */ - unsigned char opad[64]; /*!< HMAC: outer padding */ -} -sha1_context; + unsigned char ipad[64]; /*!< HMAC: inner padding */ + unsigned char opad[64]; /*!< HMAC: outer padding */ +} sha1_context; #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif -/** - * \brief SHA-1 context setup - * - * \param ctx context to be initialized - */ -void sha1_starts( sha1_context *ctx ); + /** + * \brief SHA-1 context setup + * + * \param ctx context to be initialized + */ + void sha1_starts(sha1_context* ctx); -/** - * \brief SHA-1 process buffer - * - * \param ctx SHA-1 context - * \param input buffer holding the data - * \param ilen length of the input data - */ -void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen ); + /** + * \brief SHA-1 process buffer + * + * \param ctx SHA-1 context + * \param input buffer holding the data + * \param ilen length of the input data + */ + void sha1_update(sha1_context* ctx, const unsigned char* input, size_t ilen); -/** - * \brief SHA-1 final digest - * - * \param ctx SHA-1 context - * \param output SHA-1 checksum result - */ -void sha1_finish( sha1_context *ctx, unsigned char output[20] ); + /** + * \brief SHA-1 final digest + * + * \param ctx SHA-1 context + * \param output SHA-1 checksum result + */ + void sha1_finish(sha1_context* ctx, unsigned char output[20]); -/* Internal use */ -void sha1_process( sha1_context *ctx, const unsigned char data[64] ); + /* Internal use */ + void sha1_process(sha1_context* ctx, const unsigned char data[64]); #ifdef __cplusplus } #endif #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif -/** - * \brief Output = SHA-1( input buffer ) - * - * \param input buffer holding the data - * \param ilen length of the input data - * \param output SHA-1 checksum result - */ -void sha1( const unsigned char *input, size_t ilen, unsigned char output[20] ); + /** + * \brief Output = SHA-1( input buffer ) + * + * \param input buffer holding the data + * \param ilen length of the input data + * \param output SHA-1 checksum result + */ + void sha1(const unsigned char* input, size_t ilen, unsigned char output[20]); -/** - * \brief Output = SHA-1( file contents ) - * - * \param path input file name - * \param output SHA-1 checksum result - * - * \return 0 if successful, or POLARSSL_ERR_SHA1_FILE_IO_ERROR - */ -int sha1_file( const char *path, unsigned char output[20] ); + /** + * \brief Output = SHA-1( file contents ) + * + * \param path input file name + * \param output SHA-1 checksum result + * + * \return 0 if successful, or POLARSSL_ERR_SHA1_FILE_IO_ERROR + */ + int sha1_file(const char* path, unsigned char output[20]); -/** - * \brief SHA-1 HMAC context setup - * - * \param ctx HMAC context to be initialized - * \param key HMAC secret key - * \param keylen length of the HMAC key - */ -void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keylen ); + /** + * \brief SHA-1 HMAC context setup + * + * \param ctx HMAC context to be initialized + * \param key HMAC secret key + * \param keylen length of the HMAC key + */ + void sha1_hmac_starts(sha1_context* ctx, const unsigned char* key, size_t keylen); -/** - * \brief SHA-1 HMAC process buffer - * - * \param ctx HMAC context - * \param input buffer holding the data - * \param ilen length of the input data - */ -void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, size_t ilen ); + /** + * \brief SHA-1 HMAC process buffer + * + * \param ctx HMAC context + * \param input buffer holding the data + * \param ilen length of the input data + */ + void sha1_hmac_update(sha1_context* ctx, const unsigned char* input, size_t ilen); -/** - * \brief SHA-1 HMAC final digest - * - * \param ctx HMAC context - * \param output SHA-1 HMAC checksum result - */ -void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] ); + /** + * \brief SHA-1 HMAC final digest + * + * \param ctx HMAC context + * \param output SHA-1 HMAC checksum result + */ + void sha1_hmac_finish(sha1_context* ctx, unsigned char output[20]); -/** - * \brief SHA-1 HMAC context reset - * - * \param ctx HMAC context to be reset - */ -void sha1_hmac_reset( sha1_context *ctx ); + /** + * \brief SHA-1 HMAC context reset + * + * \param ctx HMAC context to be reset + */ + void sha1_hmac_reset(sha1_context* ctx); -/** - * \brief Output = HMAC-SHA-1( hmac key, input buffer ) - * - * \param key HMAC secret key - * \param keylen length of the HMAC key - * \param input buffer holding the data - * \param ilen length of the input data - * \param output HMAC-SHA-1 result - */ -void sha1_hmac( const unsigned char *key, size_t keylen, - const unsigned char *input, size_t ilen, - unsigned char output[20] ); + /** + * \brief Output = HMAC-SHA-1( hmac key, input buffer ) + * + * \param key HMAC secret key + * \param keylen length of the HMAC key + * \param input buffer holding the data + * \param ilen length of the input data + * \param output HMAC-SHA-1 result + */ + void sha1_hmac(const unsigned char* key, size_t keylen, + const unsigned char* input, size_t ilen, + unsigned char output[20]); #ifdef __cplusplus } diff --git a/rpcs3/rpcs3/Crypto/sha256.cpp b/rpcs3/rpcs3/Crypto/sha256.cpp index 83d143574..2f0759985 100644 --- a/rpcs3/rpcs3/Crypto/sha256.cpp +++ b/rpcs3/rpcs3/Crypto/sha256.cpp @@ -38,8 +38,8 @@ #include #include #define mbedtls_printf printf -#define mbedtls_calloc calloc -#define mbedtls_free free +#define mbedtls_calloc calloc +#define mbedtls_free free #endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ @@ -52,211 +52,265 @@ * 32-bit integer manipulation macros (big endian) */ #ifndef GET_UINT32_BE -#define GET_UINT32_BE(n,b,i) \ -do { \ - (n) = ( static_cast((b)[(i) ]) << 24 ) \ - | ( static_cast((b)[(i) + 1]) << 16 ) \ - | ( static_cast((b)[(i) + 2]) << 8 ) \ - | ( static_cast((b)[(i) + 3]) );\ -} while( 0 ) +#define GET_UINT32_BE(n, b, i) \ + do \ + { \ + (n) = (static_cast((b)[(i)]) << 24) | (static_cast((b)[(i) + 1]) << 16) | (static_cast((b)[(i) + 2]) << 8) | (static_cast((b)[(i) + 3])); \ + } while (0) #endif #ifndef PUT_UINT32_BE -#define PUT_UINT32_BE(n,b,i) \ -do { \ - (b)[(i) ] = static_cast ( (n) >> 24 ); \ - (b)[(i) + 1] = static_cast ( (n) >> 16 ); \ - (b)[(i) + 2] = static_cast ( (n) >> 8 ); \ - (b)[(i) + 3] = static_cast ( (n) ); \ -} while( 0 ) +#define PUT_UINT32_BE(n, b, i) \ + do \ + { \ + (b)[(i)] = static_cast((n) >> 24); \ + (b)[(i) + 1] = static_cast((n) >> 16); \ + (b)[(i) + 2] = static_cast((n) >> 8); \ + (b)[(i) + 3] = static_cast((n)); \ + } while (0) #endif -void mbedtls_sha256_init( mbedtls_sha256_context *ctx ) +void mbedtls_sha256_init(mbedtls_sha256_context* ctx) { - SHA256_VALIDATE( ctx != NULL ); + SHA256_VALIDATE(ctx != NULL); - memset( ctx, 0, sizeof( mbedtls_sha256_context ) ); + memset(ctx, 0, sizeof(mbedtls_sha256_context)); } -void mbedtls_sha256_free( mbedtls_sha256_context *ctx ) +void mbedtls_sha256_free(mbedtls_sha256_context* ctx) { - if( ctx == NULL ) - return; + if (ctx == NULL) + return; - mbedtls_zeroize(ctx, sizeof(mbedtls_sha256_context)); + mbedtls_zeroize(ctx, sizeof(mbedtls_sha256_context)); } -void mbedtls_sha256_clone( mbedtls_sha256_context *dst, - const mbedtls_sha256_context *src ) +void mbedtls_sha256_clone(mbedtls_sha256_context* dst, + const mbedtls_sha256_context* src) { - SHA256_VALIDATE( dst != NULL ); - SHA256_VALIDATE( src != NULL ); + SHA256_VALIDATE(dst != NULL); + SHA256_VALIDATE(src != NULL); - *dst = *src; + *dst = *src; } /* * SHA-256 context setup */ -int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 ) +int mbedtls_sha256_starts_ret(mbedtls_sha256_context* ctx, int is224) { - SHA256_VALIDATE_RET( ctx != NULL ); - SHA256_VALIDATE_RET( is224 == 0 || is224 == 1 ); + SHA256_VALIDATE_RET(ctx != NULL); + SHA256_VALIDATE_RET(is224 == 0 || is224 == 1); - ctx->total[0] = 0; - ctx->total[1] = 0; + ctx->total[0] = 0; + ctx->total[1] = 0; - if( is224 == 0 ) - { - /* SHA-256 */ - ctx->state[0] = 0x6A09E667; - ctx->state[1] = 0xBB67AE85; - ctx->state[2] = 0x3C6EF372; - ctx->state[3] = 0xA54FF53A; - ctx->state[4] = 0x510E527F; - ctx->state[5] = 0x9B05688C; - ctx->state[6] = 0x1F83D9AB; - ctx->state[7] = 0x5BE0CD19; - } - else - { - /* SHA-224 */ - ctx->state[0] = 0xC1059ED8; - ctx->state[1] = 0x367CD507; - ctx->state[2] = 0x3070DD17; - ctx->state[3] = 0xF70E5939; - ctx->state[4] = 0xFFC00B31; - ctx->state[5] = 0x68581511; - ctx->state[6] = 0x64F98FA7; - ctx->state[7] = 0xBEFA4FA4; - } + if (is224 == 0) + { + /* SHA-256 */ + ctx->state[0] = 0x6A09E667; + ctx->state[1] = 0xBB67AE85; + ctx->state[2] = 0x3C6EF372; + ctx->state[3] = 0xA54FF53A; + ctx->state[4] = 0x510E527F; + ctx->state[5] = 0x9B05688C; + ctx->state[6] = 0x1F83D9AB; + ctx->state[7] = 0x5BE0CD19; + } + else + { + /* SHA-224 */ + ctx->state[0] = 0xC1059ED8; + ctx->state[1] = 0x367CD507; + ctx->state[2] = 0x3070DD17; + ctx->state[3] = 0xF70E5939; + ctx->state[4] = 0xFFC00B31; + ctx->state[5] = 0x68581511; + ctx->state[6] = 0x64F98FA7; + ctx->state[7] = 0xBEFA4FA4; + } - ctx->is224 = is224; + ctx->is224 = is224; - return( 0 ); + return (0); } #if !defined(MBEDTLS_DEPRECATED_REMOVED) -void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, - int is224 ) +void mbedtls_sha256_starts(mbedtls_sha256_context* ctx, + int is224) { - mbedtls_sha256_starts_ret( ctx, is224 ); + mbedtls_sha256_starts_ret(ctx, is224); } #endif #if !defined(MBEDTLS_SHA256_PROCESS_ALT) static const uint32_t K[] = -{ - 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, - 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, - 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, - 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, - 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, - 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, - 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, - 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, - 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, - 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, - 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, - 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, - 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, - 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, - 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, - 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2, + { + 0x428A2F98, + 0x71374491, + 0xB5C0FBCF, + 0xE9B5DBA5, + 0x3956C25B, + 0x59F111F1, + 0x923F82A4, + 0xAB1C5ED5, + 0xD807AA98, + 0x12835B01, + 0x243185BE, + 0x550C7DC3, + 0x72BE5D74, + 0x80DEB1FE, + 0x9BDC06A7, + 0xC19BF174, + 0xE49B69C1, + 0xEFBE4786, + 0x0FC19DC6, + 0x240CA1CC, + 0x2DE92C6F, + 0x4A7484AA, + 0x5CB0A9DC, + 0x76F988DA, + 0x983E5152, + 0xA831C66D, + 0xB00327C8, + 0xBF597FC7, + 0xC6E00BF3, + 0xD5A79147, + 0x06CA6351, + 0x14292967, + 0x27B70A85, + 0x2E1B2138, + 0x4D2C6DFC, + 0x53380D13, + 0x650A7354, + 0x766A0ABB, + 0x81C2C92E, + 0x92722C85, + 0xA2BFE8A1, + 0xA81A664B, + 0xC24B8B70, + 0xC76C51A3, + 0xD192E819, + 0xD6990624, + 0xF40E3585, + 0x106AA070, + 0x19A4C116, + 0x1E376C08, + 0x2748774C, + 0x34B0BCB5, + 0x391C0CB3, + 0x4ED8AA4A, + 0x5B9CCA4F, + 0x682E6FF3, + 0x748F82EE, + 0x78A5636F, + 0x84C87814, + 0x8CC70208, + 0x90BEFFFA, + 0xA4506CEB, + 0xBEF9A3F7, + 0xC67178F2, }; -#define SHR(x,n) (((x) & 0xFFFFFFFF) >> (n)) -#define ROTR(x,n) (SHR(x,n) | ((x) << (32 - (n)))) +#define SHR(x, n) (((x) & 0xFFFFFFFF) >> (n)) +#define ROTR(x, n) (SHR(x, n) | ((x) << (32 - (n)))) -#define S0(x) (ROTR(x, 7) ^ ROTR(x,18) ^ SHR(x, 3)) -#define S1(x) (ROTR(x,17) ^ ROTR(x,19) ^ SHR(x,10)) +#define S0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3)) +#define S1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10)) -#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22)) -#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25)) +#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) +#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) -#define F0(x,y,z) (((x) & (y)) | ((z) & ((x) | (y)))) -#define F1(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) +#define F0(x, y, z) (((x) & (y)) | ((z) & ((x) | (y)))) +#define F1(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) -#define R(t) \ - ( \ - W[t] = S1(W[(t) - 2]) + W[(t) - 7] + \ - S0(W[(t) - 15]) + W[(t) - 16] \ - ) +#define R(t) \ + ( \ + W[t] = S1(W[(t) - 2]) + W[(t) - 7] + \ + S0(W[(t) - 15]) + W[(t) - 16]) -#define P(a,b,c,d,e,f,g,h,x,K) \ - do \ - { \ - temp1 = (h) + S3(e) + F1((e),(f),(g)) + (K) + (x); \ - temp2 = S2(a) + F0((a),(b),(c)); \ - (d) += temp1; (h) = temp1 + temp2; \ - } while( 0 ) +#define P(a, b, c, d, e, f, g, h, x, K) \ + do \ + { \ + temp1 = (h) + S3(e) + F1((e), (f), (g)) + (K) + (x); \ + temp2 = S2(a) + F0((a), (b), (c)); \ + (d) += temp1; \ + (h) = temp1 + temp2; \ + } while (0) -int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx, - const unsigned char data[64] ) +int mbedtls_internal_sha256_process(mbedtls_sha256_context* ctx, + const unsigned char data[64]) { - uint32_t temp1, temp2, W[64]; - uint32_t A[8]; - unsigned int i; + uint32_t temp1, temp2, W[64]; + uint32_t A[8]; + unsigned int i; - SHA256_VALIDATE_RET( ctx != NULL ); - SHA256_VALIDATE_RET( (const unsigned char *)data != NULL ); + SHA256_VALIDATE_RET(ctx != NULL); + SHA256_VALIDATE_RET((const unsigned char*)data != NULL); - for( i = 0; i < 8; i++ ) - A[i] = ctx->state[i]; + for (i = 0; i < 8; i++) + A[i] = ctx->state[i]; #if defined(MBEDTLS_SHA256_SMALLER) - for( i = 0; i < 64; i++ ) - { - if( i < 16 ) - GET_UINT32_BE( W[i], data, 4 * i ); - else - R( i ); + for (i = 0; i < 64; i++) + { + if (i < 16) + GET_UINT32_BE(W[i], data, 4 * i); + else + R(i); - P( A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], W[i], K[i] ); + P(A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], W[i], K[i]); - temp1 = A[7]; A[7] = A[6]; A[6] = A[5]; A[5] = A[4]; A[4] = A[3]; - A[3] = A[2]; A[2] = A[1]; A[1] = A[0]; A[0] = temp1; - } -#else /* MBEDTLS_SHA256_SMALLER */ - for( i = 0; i < 16; i++ ) - GET_UINT32_BE( W[i], data, 4 * i ); + temp1 = A[7]; + A[7] = A[6]; + A[6] = A[5]; + A[5] = A[4]; + A[4] = A[3]; + A[3] = A[2]; + A[2] = A[1]; + A[1] = A[0]; + A[0] = temp1; + } +#else /* MBEDTLS_SHA256_SMALLER */ + for (i = 0; i < 16; i++) + GET_UINT32_BE(W[i], data, 4 * i); - for( i = 0; i < 16; i += 8 ) - { - P( A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], W[i+0], K[i+0] ); - P( A[7], A[0], A[1], A[2], A[3], A[4], A[5], A[6], W[i+1], K[i+1] ); - P( A[6], A[7], A[0], A[1], A[2], A[3], A[4], A[5], W[i+2], K[i+2] ); - P( A[5], A[6], A[7], A[0], A[1], A[2], A[3], A[4], W[i+3], K[i+3] ); - P( A[4], A[5], A[6], A[7], A[0], A[1], A[2], A[3], W[i+4], K[i+4] ); - P( A[3], A[4], A[5], A[6], A[7], A[0], A[1], A[2], W[i+5], K[i+5] ); - P( A[2], A[3], A[4], A[5], A[6], A[7], A[0], A[1], W[i+6], K[i+6] ); - P( A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[0], W[i+7], K[i+7] ); - } + for (i = 0; i < 16; i += 8) + { + P(A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], W[i + 0], K[i + 0]); + P(A[7], A[0], A[1], A[2], A[3], A[4], A[5], A[6], W[i + 1], K[i + 1]); + P(A[6], A[7], A[0], A[1], A[2], A[3], A[4], A[5], W[i + 2], K[i + 2]); + P(A[5], A[6], A[7], A[0], A[1], A[2], A[3], A[4], W[i + 3], K[i + 3]); + P(A[4], A[5], A[6], A[7], A[0], A[1], A[2], A[3], W[i + 4], K[i + 4]); + P(A[3], A[4], A[5], A[6], A[7], A[0], A[1], A[2], W[i + 5], K[i + 5]); + P(A[2], A[3], A[4], A[5], A[6], A[7], A[0], A[1], W[i + 6], K[i + 6]); + P(A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[0], W[i + 7], K[i + 7]); + } - for( i = 16; i < 64; i += 8 ) - { - P( A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], R(i+0), K[i+0] ); - P( A[7], A[0], A[1], A[2], A[3], A[4], A[5], A[6], R(i+1), K[i+1] ); - P( A[6], A[7], A[0], A[1], A[2], A[3], A[4], A[5], R(i+2), K[i+2] ); - P( A[5], A[6], A[7], A[0], A[1], A[2], A[3], A[4], R(i+3), K[i+3] ); - P( A[4], A[5], A[6], A[7], A[0], A[1], A[2], A[3], R(i+4), K[i+4] ); - P( A[3], A[4], A[5], A[6], A[7], A[0], A[1], A[2], R(i+5), K[i+5] ); - P( A[2], A[3], A[4], A[5], A[6], A[7], A[0], A[1], R(i+6), K[i+6] ); - P( A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[0], R(i+7), K[i+7] ); - } + for (i = 16; i < 64; i += 8) + { + P(A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], R(i + 0), K[i + 0]); + P(A[7], A[0], A[1], A[2], A[3], A[4], A[5], A[6], R(i + 1), K[i + 1]); + P(A[6], A[7], A[0], A[1], A[2], A[3], A[4], A[5], R(i + 2), K[i + 2]); + P(A[5], A[6], A[7], A[0], A[1], A[2], A[3], A[4], R(i + 3), K[i + 3]); + P(A[4], A[5], A[6], A[7], A[0], A[1], A[2], A[3], R(i + 4), K[i + 4]); + P(A[3], A[4], A[5], A[6], A[7], A[0], A[1], A[2], R(i + 5), K[i + 5]); + P(A[2], A[3], A[4], A[5], A[6], A[7], A[0], A[1], R(i + 6), K[i + 6]); + P(A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[0], R(i + 7), K[i + 7]); + } #endif /* MBEDTLS_SHA256_SMALLER */ - for( i = 0; i < 8; i++ ) - ctx->state[i] += A[i]; + for (i = 0; i < 8; i++) + ctx->state[i] += A[i]; - return( 0 ); + return (0); } #if !defined(MBEDTLS_DEPRECATED_REMOVED) -void mbedtls_sha256_process( mbedtls_sha256_context *ctx, - const unsigned char data[64] ) +void mbedtls_sha256_process(mbedtls_sha256_context* ctx, + const unsigned char data[64]) { - mbedtls_internal_sha256_process( ctx, data ); + mbedtls_internal_sha256_process(ctx, data); } #endif #endif /* !MBEDTLS_SHA256_PROCESS_ALT */ @@ -264,136 +318,135 @@ void mbedtls_sha256_process( mbedtls_sha256_context *ctx, /* * SHA-256 process buffer */ -int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, - const unsigned char *input, - size_t ilen ) +int mbedtls_sha256_update_ret(mbedtls_sha256_context* ctx, + const unsigned char* input, + size_t ilen) { - int ret; - size_t fill; - uint32_t left; + int ret; + size_t fill; + uint32_t left; - SHA256_VALIDATE_RET( ctx != NULL ); - SHA256_VALIDATE_RET( ilen == 0 || input != NULL ); + SHA256_VALIDATE_RET(ctx != NULL); + SHA256_VALIDATE_RET(ilen == 0 || input != NULL); - if( ilen == 0 ) - return( 0 ); + if (ilen == 0) + return (0); - left = ctx->total[0] & 0x3F; - fill = 64 - left; + left = ctx->total[0] & 0x3F; + fill = 64 - left; - ctx->total[0] += static_cast(ilen); - ctx->total[0] &= 0xFFFFFFFF; + ctx->total[0] += static_cast(ilen); + ctx->total[0] &= 0xFFFFFFFF; - if( ctx->total[0] < static_cast(ilen) ) - ctx->total[1]++; + if (ctx->total[0] < static_cast(ilen)) + ctx->total[1]++; - if( left && ilen >= fill ) - { - memcpy( ctx->buffer + left, input, fill ); + if (left && ilen >= fill) + { + memcpy(ctx->buffer + left, input, fill); - if( ( ret = mbedtls_internal_sha256_process( ctx, ctx->buffer ) ) != 0 ) - return( ret ); + if ((ret = mbedtls_internal_sha256_process(ctx, ctx->buffer)) != 0) + return (ret); - input += fill; - ilen -= fill; - left = 0; - } + input += fill; + ilen -= fill; + left = 0; + } - while( ilen >= 64 ) - { - if( ( ret = mbedtls_internal_sha256_process( ctx, input ) ) != 0 ) - return( ret ); + while (ilen >= 64) + { + if ((ret = mbedtls_internal_sha256_process(ctx, input)) != 0) + return (ret); - input += 64; - ilen -= 64; - } + input += 64; + ilen -= 64; + } - if( ilen > 0 ) - memcpy( ctx->buffer + left, input, ilen ); + if (ilen > 0) + memcpy(ctx->buffer + left, input, ilen); - return( 0 ); + return (0); } #if !defined(MBEDTLS_DEPRECATED_REMOVED) -void mbedtls_sha256_update( mbedtls_sha256_context *ctx, - const unsigned char *input, - size_t ilen ) +void mbedtls_sha256_update(mbedtls_sha256_context* ctx, + const unsigned char* input, + size_t ilen) { - mbedtls_sha256_update_ret( ctx, input, ilen ); + mbedtls_sha256_update_ret(ctx, input, ilen); } #endif /* * SHA-256 final digest */ -int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, - unsigned char output[32] ) +int mbedtls_sha256_finish_ret(mbedtls_sha256_context* ctx, + unsigned char output[32]) { - int ret; - uint32_t used; - uint32_t high, low; + int ret; + uint32_t used; + uint32_t high, low; - SHA256_VALIDATE_RET( ctx != NULL ); - SHA256_VALIDATE_RET( (unsigned char *)output != NULL ); + SHA256_VALIDATE_RET(ctx != NULL); + SHA256_VALIDATE_RET((unsigned char*)output != NULL); - /* - * Add padding: 0x80 then 0x00 until 8 bytes remain for the length - */ - used = ctx->total[0] & 0x3F; + /* + * Add padding: 0x80 then 0x00 until 8 bytes remain for the length + */ + used = ctx->total[0] & 0x3F; - ctx->buffer[used++] = 0x80; + ctx->buffer[used++] = 0x80; - if( used <= 56 ) - { - /* Enough room for padding + length in current block */ - memset( ctx->buffer + used, 0, 56 - used ); - } - else - { - /* We'll need an extra block */ - memset( ctx->buffer + used, 0, 64 - used ); + if (used <= 56) + { + /* Enough room for padding + length in current block */ + memset(ctx->buffer + used, 0, 56 - used); + } + else + { + /* We'll need an extra block */ + memset(ctx->buffer + used, 0, 64 - used); - if( ( ret = mbedtls_internal_sha256_process( ctx, ctx->buffer ) ) != 0 ) - return( ret ); + if ((ret = mbedtls_internal_sha256_process(ctx, ctx->buffer)) != 0) + return (ret); - memset( ctx->buffer, 0, 56 ); - } + memset(ctx->buffer, 0, 56); + } - /* - * Add message length - */ - high = ( ctx->total[0] >> 29 ) - | ( ctx->total[1] << 3 ); - low = ( ctx->total[0] << 3 ); + /* + * Add message length + */ + high = (ctx->total[0] >> 29) | (ctx->total[1] << 3); + low = (ctx->total[0] << 3); - PUT_UINT32_BE( high, ctx->buffer, 56 ); - PUT_UINT32_BE( low, ctx->buffer, 60 ); + PUT_UINT32_BE(high, ctx->buffer, 56); + PUT_UINT32_BE(low, ctx->buffer, 60); - if( ( ret = mbedtls_internal_sha256_process( ctx, ctx->buffer ) ) != 0 ) - return( ret ); + if ((ret = mbedtls_internal_sha256_process(ctx, ctx->buffer)) != 0) + return (ret); - /* - * Output final state - */ - PUT_UINT32_BE( ctx->state[0], output, 0 ); - PUT_UINT32_BE( ctx->state[1], output, 4 ); - PUT_UINT32_BE( ctx->state[2], output, 8 ); - PUT_UINT32_BE( ctx->state[3], output, 12 ); - PUT_UINT32_BE( ctx->state[4], output, 16 ); - PUT_UINT32_BE( ctx->state[5], output, 20 ); - PUT_UINT32_BE( ctx->state[6], output, 24 ); + /* + * Output final state + */ + PUT_UINT32_BE(ctx->state[0], output, 0); + PUT_UINT32_BE(ctx->state[1], output, 4); + PUT_UINT32_BE(ctx->state[2], output, 8); + PUT_UINT32_BE(ctx->state[3], output, 12); + PUT_UINT32_BE(ctx->state[4], output, 16); + PUT_UINT32_BE(ctx->state[5], output, 20); + PUT_UINT32_BE(ctx->state[6], output, 24); - if( ctx->is224 == 0 ) - PUT_UINT32_BE( ctx->state[7], output, 28 ); + if (ctx->is224 == 0) + PUT_UINT32_BE(ctx->state[7], output, 28); - return( 0 ); + return (0); } #if !defined(MBEDTLS_DEPRECATED_REMOVED) -void mbedtls_sha256_finish( mbedtls_sha256_context *ctx, - unsigned char output[32] ) +void mbedtls_sha256_finish(mbedtls_sha256_context* ctx, + unsigned char output[32]) { - mbedtls_sha256_finish_ret( ctx, output ); + mbedtls_sha256_finish_ret(ctx, output); } #endif @@ -402,41 +455,41 @@ void mbedtls_sha256_finish( mbedtls_sha256_context *ctx, /* * output = SHA-256( input buffer ) */ -int mbedtls_sha256_ret( const unsigned char *input, - size_t ilen, - unsigned char output[32], - int is224 ) +int mbedtls_sha256_ret(const unsigned char* input, + size_t ilen, + unsigned char output[32], + int is224) { - int ret; - mbedtls_sha256_context ctx; + int ret; + mbedtls_sha256_context ctx; - SHA256_VALIDATE_RET( is224 == 0 || is224 == 1 ); - SHA256_VALIDATE_RET( ilen == 0 || input != NULL ); - SHA256_VALIDATE_RET( (unsigned char *)output != NULL ); + SHA256_VALIDATE_RET(is224 == 0 || is224 == 1); + SHA256_VALIDATE_RET(ilen == 0 || input != NULL); + SHA256_VALIDATE_RET((unsigned char*)output != NULL); - mbedtls_sha256_init( &ctx ); + mbedtls_sha256_init(&ctx); - if( ( ret = mbedtls_sha256_starts_ret( &ctx, is224 ) ) != 0 ) - goto exit; + if ((ret = mbedtls_sha256_starts_ret(&ctx, is224)) != 0) + goto exit; - if( ( ret = mbedtls_sha256_update_ret( &ctx, input, ilen ) ) != 0 ) - goto exit; + if ((ret = mbedtls_sha256_update_ret(&ctx, input, ilen)) != 0) + goto exit; - if( ( ret = mbedtls_sha256_finish_ret( &ctx, output ) ) != 0 ) - goto exit; + if ((ret = mbedtls_sha256_finish_ret(&ctx, output)) != 0) + goto exit; exit: - mbedtls_sha256_free( &ctx ); + mbedtls_sha256_free(&ctx); - return( ret ); + return (ret); } #if !defined(MBEDTLS_DEPRECATED_REMOVED) -void mbedtls_sha256( const unsigned char *input, - size_t ilen, - unsigned char output[32], - int is224 ) +void mbedtls_sha256(const unsigned char* input, + size_t ilen, + unsigned char output[32], + int is224) { - mbedtls_sha256_ret( input, ilen, output, is224 ); + mbedtls_sha256_ret(input, ilen, output, is224); } #endif diff --git a/rpcs3/rpcs3/Crypto/sha256.h b/rpcs3/rpcs3/Crypto/sha256.h index 6dbf0babb..1263370bd 100644 --- a/rpcs3/rpcs3/Crypto/sha256.h +++ b/rpcs3/rpcs3/Crypto/sha256.h @@ -33,243 +33,243 @@ #include /* MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED is deprecated and should not be used. */ -#define MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED -0x0037 /**< SHA-256 hardware accelerator failed */ -#define MBEDTLS_ERR_SHA256_BAD_INPUT_DATA -0x0074 /**< SHA-256 input data was malformed. */ +#define MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED -0x0037 /**< SHA-256 hardware accelerator failed */ +#define MBEDTLS_ERR_SHA256_BAD_INPUT_DATA -0x0074 /**< SHA-256 input data was malformed. */ #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif #if !defined(MBEDTLS_SHA256_ALT) -// Regular implementation -// + // Regular implementation + // -/** - * \brief The SHA-256 context structure. - * - * The structure is used both for SHA-256 and for SHA-224 - * checksum calculations. The choice between these two is - * made in the call to mbedtls_sha256_starts_ret(). - */ -typedef struct mbedtls_sha256_context -{ - uint32_t total[2]; /*!< The number of Bytes processed. */ - uint32_t state[8]; /*!< The intermediate digest state. */ - unsigned char buffer[64]; /*!< The data block being processed. */ - int is224; /*!< Determines which function to use: - 0: Use SHA-256, or 1: Use SHA-224. */ -} -mbedtls_sha256_context; + /** + * \brief The SHA-256 context structure. + * + * The structure is used both for SHA-256 and for SHA-224 + * checksum calculations. The choice between these two is + * made in the call to mbedtls_sha256_starts_ret(). + */ + typedef struct mbedtls_sha256_context + { + uint32_t total[2]; /*!< The number of Bytes processed. */ + uint32_t state[8]; /*!< The intermediate digest state. */ + unsigned char buffer[64]; /*!< The data block being processed. */ + int is224; /*!< Determines which function to use: + 0: Use SHA-256, or 1: Use SHA-224. */ + } mbedtls_sha256_context; -#else /* MBEDTLS_SHA256_ALT */ +#else /* MBEDTLS_SHA256_ALT */ #include "sha256_alt.h" #endif /* MBEDTLS_SHA256_ALT */ -/** - * \brief This function initializes a SHA-256 context. - * - * \param ctx The SHA-256 context to initialize. This must not be \c NULL. - */ -void mbedtls_sha256_init( mbedtls_sha256_context *ctx ); + /** + * \brief This function initializes a SHA-256 context. + * + * \param ctx The SHA-256 context to initialize. This must not be \c NULL. + */ + void mbedtls_sha256_init(mbedtls_sha256_context* ctx); -/** - * \brief This function clears a SHA-256 context. - * - * \param ctx The SHA-256 context to clear. This may be \c NULL, in which - * case this function returns immediately. If it is not \c NULL, - * it must point to an initialized SHA-256 context. - */ -void mbedtls_sha256_free( mbedtls_sha256_context *ctx ); + /** + * \brief This function clears a SHA-256 context. + * + * \param ctx The SHA-256 context to clear. This may be \c NULL, in which + * case this function returns immediately. If it is not \c NULL, + * it must point to an initialized SHA-256 context. + */ + void mbedtls_sha256_free(mbedtls_sha256_context* ctx); -/** - * \brief This function clones the state of a SHA-256 context. - * - * \param dst The destination context. This must be initialized. - * \param src The context to clone. This must be initialized. - */ -void mbedtls_sha256_clone( mbedtls_sha256_context *dst, - const mbedtls_sha256_context *src ); + /** + * \brief This function clones the state of a SHA-256 context. + * + * \param dst The destination context. This must be initialized. + * \param src The context to clone. This must be initialized. + */ + void mbedtls_sha256_clone(mbedtls_sha256_context* dst, + const mbedtls_sha256_context* src); -/** - * \brief This function starts a SHA-224 or SHA-256 checksum - * calculation. - * - * \param ctx The context to use. This must be initialized. - * \param is224 This determines which function to use. This must be - * either \c 0 for SHA-256, or \c 1 for SHA-224. - * - * \return \c 0 on success. - * \return A negative error code on failure. - */ -int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 ); + /** + * \brief This function starts a SHA-224 or SHA-256 checksum + * calculation. + * + * \param ctx The context to use. This must be initialized. + * \param is224 This determines which function to use. This must be + * either \c 0 for SHA-256, or \c 1 for SHA-224. + * + * \return \c 0 on success. + * \return A negative error code on failure. + */ + int mbedtls_sha256_starts_ret(mbedtls_sha256_context* ctx, int is224); -/** - * \brief This function feeds an input buffer into an ongoing - * SHA-256 checksum calculation. - * - * \param ctx The SHA-256 context. This must be initialized - * and have a hash operation started. - * \param input The buffer holding the data. This must be a readable - * buffer of length \p ilen Bytes. - * \param ilen The length of the input data in Bytes. - * - * \return \c 0 on success. - * \return A negative error code on failure. - */ -int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, - const unsigned char *input, - size_t ilen ); + /** + * \brief This function feeds an input buffer into an ongoing + * SHA-256 checksum calculation. + * + * \param ctx The SHA-256 context. This must be initialized + * and have a hash operation started. + * \param input The buffer holding the data. This must be a readable + * buffer of length \p ilen Bytes. + * \param ilen The length of the input data in Bytes. + * + * \return \c 0 on success. + * \return A negative error code on failure. + */ + int mbedtls_sha256_update_ret(mbedtls_sha256_context* ctx, + const unsigned char* input, + size_t ilen); -/** - * \brief This function finishes the SHA-256 operation, and writes - * the result to the output buffer. - * - * \param ctx The SHA-256 context. This must be initialized - * and have a hash operation started. - * \param output The SHA-224 or SHA-256 checksum result. - * This must be a writable buffer of length \c 32 Bytes. - * - * \return \c 0 on success. - * \return A negative error code on failure. - */ -int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, - unsigned char output[32] ); + /** + * \brief This function finishes the SHA-256 operation, and writes + * the result to the output buffer. + * + * \param ctx The SHA-256 context. This must be initialized + * and have a hash operation started. + * \param output The SHA-224 or SHA-256 checksum result. + * This must be a writable buffer of length \c 32 Bytes. + * + * \return \c 0 on success. + * \return A negative error code on failure. + */ + int mbedtls_sha256_finish_ret(mbedtls_sha256_context* ctx, + unsigned char output[32]); -/** - * \brief This function processes a single data block within - * the ongoing SHA-256 computation. This function is for - * internal use only. - * - * \param ctx The SHA-256 context. This must be initialized. - * \param data The buffer holding one block of data. This must - * be a readable buffer of length \c 64 Bytes. - * - * \return \c 0 on success. - * \return A negative error code on failure. - */ -int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx, - const unsigned char data[64] ); + /** + * \brief This function processes a single data block within + * the ongoing SHA-256 computation. This function is for + * internal use only. + * + * \param ctx The SHA-256 context. This must be initialized. + * \param data The buffer holding one block of data. This must + * be a readable buffer of length \c 64 Bytes. + * + * \return \c 0 on success. + * \return A negative error code on failure. + */ + int mbedtls_internal_sha256_process(mbedtls_sha256_context* ctx, + const unsigned char data[64]); #if !defined(MBEDTLS_DEPRECATED_REMOVED) #if defined(MBEDTLS_DEPRECATED_WARNING) -#define MBEDTLS_DEPRECATED __attribute__((deprecated)) +#define MBEDTLS_DEPRECATED __attribute__((deprecated)) #else #define MBEDTLS_DEPRECATED #endif -/** - * \brief This function starts a SHA-224 or SHA-256 checksum - * calculation. - * - * \deprecated Superseded by mbedtls_sha256_starts_ret() in 2.7.0. - * - * \param ctx The context to use. This must be initialized. - * \param is224 Determines which function to use. This must be - * either \c 0 for SHA-256, or \c 1 for SHA-224. - */ -MBEDTLS_DEPRECATED void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, - int is224 ); + /** + * \brief This function starts a SHA-224 or SHA-256 checksum + * calculation. + * + * \deprecated Superseded by mbedtls_sha256_starts_ret() in 2.7.0. + * + * \param ctx The context to use. This must be initialized. + * \param is224 Determines which function to use. This must be + * either \c 0 for SHA-256, or \c 1 for SHA-224. + */ + MBEDTLS_DEPRECATED void mbedtls_sha256_starts(mbedtls_sha256_context* ctx, + int is224); -/** - * \brief This function feeds an input buffer into an ongoing - * SHA-256 checksum calculation. - * - * \deprecated Superseded by mbedtls_sha256_update_ret() in 2.7.0. - * - * \param ctx The SHA-256 context to use. This must be - * initialized and have a hash operation started. - * \param input The buffer holding the data. This must be a readable - * buffer of length \p ilen Bytes. - * \param ilen The length of the input data in Bytes. - */ -MBEDTLS_DEPRECATED void mbedtls_sha256_update( mbedtls_sha256_context *ctx, - const unsigned char *input, - size_t ilen ); + /** + * \brief This function feeds an input buffer into an ongoing + * SHA-256 checksum calculation. + * + * \deprecated Superseded by mbedtls_sha256_update_ret() in 2.7.0. + * + * \param ctx The SHA-256 context to use. This must be + * initialized and have a hash operation started. + * \param input The buffer holding the data. This must be a readable + * buffer of length \p ilen Bytes. + * \param ilen The length of the input data in Bytes. + */ + MBEDTLS_DEPRECATED void mbedtls_sha256_update(mbedtls_sha256_context* ctx, + const unsigned char* input, + size_t ilen); -/** - * \brief This function finishes the SHA-256 operation, and writes - * the result to the output buffer. - * - * \deprecated Superseded by mbedtls_sha256_finish_ret() in 2.7.0. - * - * \param ctx The SHA-256 context. This must be initialized and - * have a hash operation started. - * \param output The SHA-224 or SHA-256 checksum result. This must be - * a writable buffer of length \c 32 Bytes. - */ -MBEDTLS_DEPRECATED void mbedtls_sha256_finish( mbedtls_sha256_context *ctx, - unsigned char output[32] ); + /** + * \brief This function finishes the SHA-256 operation, and writes + * the result to the output buffer. + * + * \deprecated Superseded by mbedtls_sha256_finish_ret() in 2.7.0. + * + * \param ctx The SHA-256 context. This must be initialized and + * have a hash operation started. + * \param output The SHA-224 or SHA-256 checksum result. This must be + * a writable buffer of length \c 32 Bytes. + */ + MBEDTLS_DEPRECATED void mbedtls_sha256_finish(mbedtls_sha256_context* ctx, + unsigned char output[32]); -/** - * \brief This function processes a single data block within - * the ongoing SHA-256 computation. This function is for - * internal use only. - * - * \deprecated Superseded by mbedtls_internal_sha256_process() in 2.7.0. - * - * \param ctx The SHA-256 context. This must be initialized. - * \param data The buffer holding one block of data. This must be - * a readable buffer of size \c 64 Bytes. - */ -MBEDTLS_DEPRECATED void mbedtls_sha256_process( mbedtls_sha256_context *ctx, - const unsigned char data[64] ); + /** + * \brief This function processes a single data block within + * the ongoing SHA-256 computation. This function is for + * internal use only. + * + * \deprecated Superseded by mbedtls_internal_sha256_process() in 2.7.0. + * + * \param ctx The SHA-256 context. This must be initialized. + * \param data The buffer holding one block of data. This must be + * a readable buffer of size \c 64 Bytes. + */ + MBEDTLS_DEPRECATED void mbedtls_sha256_process(mbedtls_sha256_context* ctx, + const unsigned char data[64]); #undef MBEDTLS_DEPRECATED #endif /* !MBEDTLS_DEPRECATED_REMOVED */ -/** - * \brief This function calculates the SHA-224 or SHA-256 - * checksum of a buffer. - * - * The function allocates the context, performs the - * calculation, and frees the context. - * - * The SHA-256 result is calculated as - * output = SHA-256(input buffer). - * - * \param input The buffer holding the data. This must be a readable - * buffer of length \p ilen Bytes. - * \param ilen The length of the input data in Bytes. - * \param output The SHA-224 or SHA-256 checksum result. This must - * be a writable buffer of length \c 32 Bytes. - * \param is224 Determines which function to use. This must be - * either \c 0 for SHA-256, or \c 1 for SHA-224. - */ -int mbedtls_sha256_ret( const unsigned char *input, - size_t ilen, - unsigned char output[32], - int is224 ); + /** + * \brief This function calculates the SHA-224 or SHA-256 + * checksum of a buffer. + * + * The function allocates the context, performs the + * calculation, and frees the context. + * + * The SHA-256 result is calculated as + * output = SHA-256(input buffer). + * + * \param input The buffer holding the data. This must be a readable + * buffer of length \p ilen Bytes. + * \param ilen The length of the input data in Bytes. + * \param output The SHA-224 or SHA-256 checksum result. This must + * be a writable buffer of length \c 32 Bytes. + * \param is224 Determines which function to use. This must be + * either \c 0 for SHA-256, or \c 1 for SHA-224. + */ + int mbedtls_sha256_ret(const unsigned char* input, + size_t ilen, + unsigned char output[32], + int is224); #if !defined(MBEDTLS_DEPRECATED_REMOVED) #if defined(MBEDTLS_DEPRECATED_WARNING) -#define MBEDTLS_DEPRECATED __attribute__((deprecated)) +#define MBEDTLS_DEPRECATED __attribute__((deprecated)) #else #define MBEDTLS_DEPRECATED #endif -/** - * \brief This function calculates the SHA-224 or SHA-256 checksum - * of a buffer. - * - * The function allocates the context, performs the - * calculation, and frees the context. - * - * The SHA-256 result is calculated as - * output = SHA-256(input buffer). - * - * \deprecated Superseded by mbedtls_sha256_ret() in 2.7.0. - * - * \param input The buffer holding the data. This must be a readable - * buffer of length \p ilen Bytes. - * \param ilen The length of the input data in Bytes. - * \param output The SHA-224 or SHA-256 checksum result. This must be - * a writable buffer of length \c 32 Bytes. - * \param is224 Determines which function to use. This must be either - * \c 0 for SHA-256, or \c 1 for SHA-224. - */ -MBEDTLS_DEPRECATED void mbedtls_sha256( const unsigned char *input, - size_t ilen, - unsigned char output[32], - int is224 ); + /** + * \brief This function calculates the SHA-224 or SHA-256 checksum + * of a buffer. + * + * The function allocates the context, performs the + * calculation, and frees the context. + * + * The SHA-256 result is calculated as + * output = SHA-256(input buffer). + * + * \deprecated Superseded by mbedtls_sha256_ret() in 2.7.0. + * + * \param input The buffer holding the data. This must be a readable + * buffer of length \p ilen Bytes. + * \param ilen The length of the input data in Bytes. + * \param output The SHA-224 or SHA-256 checksum result. This must be + * a writable buffer of length \c 32 Bytes. + * \param is224 Determines which function to use. This must be either + * \c 0 for SHA-256, or \c 1 for SHA-224. + */ + MBEDTLS_DEPRECATED void mbedtls_sha256(const unsigned char* input, + size_t ilen, + unsigned char output[32], + int is224); #undef MBEDTLS_DEPRECATED #endif /* !MBEDTLS_DEPRECATED_REMOVED */ diff --git a/rpcs3/rpcs3/Crypto/unedat.cpp b/rpcs3/rpcs3/Crypto/unedat.cpp index 1ffaa33fc..c31a849b3 100644 --- a/rpcs3/rpcs3/Crypto/unedat.cpp +++ b/rpcs3/rpcs3/Crypto/unedat.cpp @@ -14,7 +14,7 @@ LOG_CHANNEL(edat_log, "EDAT"); -void generate_key(int crypto_mode, int version, unsigned char *key_final, unsigned char *iv_final, unsigned char *key, unsigned char *iv) +void generate_key(int crypto_mode, int version, unsigned char* key_final, unsigned char* iv_final, unsigned char* key, unsigned char* iv) { int mode = crypto_mode & 0xF0000000; uchar temp_iv[16]{}; @@ -42,7 +42,7 @@ void generate_key(int crypto_mode, int version, unsigned char *key_final, unsign } } -void generate_hash(int hash_mode, int version, unsigned char *hash_final, unsigned char *hash) +void generate_hash(int hash_mode, int version, unsigned char* hash_final, unsigned char* hash) { int mode = hash_mode & 0xF0000000; uchar temp_iv[16]{}; @@ -67,7 +67,7 @@ void generate_hash(int hash_mode, int version, unsigned char *hash_final, unsign }; } -bool decrypt(int hash_mode, int crypto_mode, int version, unsigned char *in, unsigned char *out, usz length, unsigned char *key, unsigned char *iv, unsigned char *hash, unsigned char *test_hash) +bool decrypt(int hash_mode, int crypto_mode, int version, unsigned char* in, unsigned char* out, usz length, unsigned char* key, unsigned char* iv, unsigned char* hash, unsigned char* test_hash) { // Setup buffers for key, iv and hash. unsigned char key_final[0x10] = {}; @@ -82,11 +82,11 @@ bool decrypt(int hash_mode, int crypto_mode, int version, unsigned char *in, uns else generate_hash(hash_mode, version, hash_final_10, hash); - if ((crypto_mode & 0xFF) == 0x01) // No algorithm. + if ((crypto_mode & 0xFF) == 0x01) // No algorithm. { memcpy(out, in, length); } - else if ((crypto_mode & 0xFF) == 0x02) // AES128-CBC + else if ((crypto_mode & 0xFF) == 0x02) // AES128-CBC { aescbc128_decrypt(key_final, iv_final, in, out, length); } @@ -100,11 +100,11 @@ bool decrypt(int hash_mode, int crypto_mode, int version, unsigned char *in, uns { return hmac_hash_compare(hash_final_14, 0x14, in, length, test_hash, 0x14); } - else if ((hash_mode & 0xFF) == 0x02) // 0x10 AES-CMAC + else if ((hash_mode & 0xFF) == 0x02) // 0x10 AES-CMAC { return cmac_hash_compare(hash_final_10, 0x10, in, length, test_hash, 0x10); } - else if ((hash_mode & 0xFF) == 0x04) //0x10 SHA1-HMAC + else if ((hash_mode & 0xFF) == 0x04) // 0x10 SHA1-HMAC { return hmac_hash_compare(hash_final_10, 0x10, in, length, test_hash, 0x10); } @@ -143,10 +143,10 @@ std::tuple dec_section(unsigned char* metadata) return std::make_tuple(offset, length, compression_end); } -u128 get_block_key(int block, NPD_HEADER *npd) +u128 get_block_key(int block, NPD_HEADER* npd) { unsigned char empty_key[0x10] = {}; - unsigned char *src_key = (npd->version <= 1) ? empty_key : npd->dev_hash; + unsigned char* src_key = (npd->version <= 1) ? empty_key : npd->dev_hash; u128 dest_key{}; std::memcpy(&dest_key, src_key, 0xC); @@ -158,15 +158,15 @@ u128 get_block_key(int block, NPD_HEADER *npd) // for out data, allocate a buffer the size of 'edat->block_size' // Also, set 'in file' to the beginning of the encrypted data, which may be offset if inside another file, but normally just reset to beginning of file // returns number of bytes written, -1 for error -s64 decrypt_block(const fs::file* in, u8* out, EDAT_HEADER *edat, NPD_HEADER *npd, u8* crypt_key, u32 block_num, u32 total_blocks, u64 size_left, bool is_out_buffer_aligned = false) +s64 decrypt_block(const fs::file* in, u8* out, EDAT_HEADER* edat, NPD_HEADER* npd, u8* crypt_key, u32 block_num, u32 total_blocks, u64 size_left, bool is_out_buffer_aligned = false) { // Get metadata info and setup buffers. const int metadata_section_size = ((edat->flags & EDAT_COMPRESSED_FLAG) != 0 || (edat->flags & EDAT_FLAG_0x20) != 0) ? 0x20 : 0x10; const int metadata_offset = 0x100; - u8 hash[0x10] = { 0 }; - u8 key_result[0x10] = { 0 }; - u8 hash_result[0x14] = { 0 }; + u8 hash[0x10] = {0}; + u8 key_result[0x10] = {0}; + u8 hash_result[0x14] = {0}; u64 offset = 0; u64 metadata_sec_offset = 0; @@ -258,7 +258,7 @@ s64 decrypt_block(const fs::file* in, u8* out, EDAT_HEADER *edat, NPD_HEADER *np if ((edat->flags & EDAT_FLAG_0x10) != 0) { - aesecb128_encrypt(crypt_key, key_result, hash); // If FLAG 0x10 is set, encrypt again to get the final hash. + aesecb128_encrypt(crypt_key, key_result, hash); // If FLAG 0x10 is set, encrypt again to get the final hash. } else { @@ -344,10 +344,10 @@ s64 decrypt_block(const fs::file* in, u8* out, EDAT_HEADER *edat, NPD_HEADER *np // set file offset to beginning before calling bool check_data(u8* key, EDAT_HEADER* edat, NPD_HEADER* npd, const fs::file* f, bool verbose) { - u8 header[0xA0] = { 0 }; - u8 empty_header[0xA0] = { 0 }; - u8 header_hash[0x10] = { 0 }; - u8 metadata_hash[0x10] = { 0 }; + u8 header[0xA0] = {0}; + u8 empty_header[0xA0] = {0}; + u8 header_hash[0x10] = {0}; + u8 metadata_hash[0x10] = {0}; const u64 file_offset = f->pos(); @@ -402,8 +402,8 @@ bool check_data(u8* key, EDAT_HEADER* edat, NPD_HEADER* npd, const fs::file* f, } // Setup header key and iv buffers. - unsigned char header_key[0x10] = { 0 }; - unsigned char header_iv[0x10] = { 0 }; + unsigned char header_key[0x10] = {0}; + unsigned char header_iv[0x10] = {0}; // Test the header hash (located at offset 0xA0). if (!decrypt(hash_mode, crypto_mode, (npd->version == 4), header, empty_header, 0xA0, header_key, header_iv, key, header_hash)) @@ -474,12 +474,12 @@ bool check_data(u8* key, EDAT_HEADER* edat, NPD_HEADER* npd, const fs::file* f, if ((edat->flags & EDAT_DEBUG_DATA_FLAG) == 0) { // Setup buffers. - unsigned char metadata_signature[0x28] = { 0 }; - unsigned char header_signature[0x28] = { 0 }; - unsigned char signature_hash[20] = { 0 }; - unsigned char signature_r[0x15] = { 0 }; - unsigned char signature_s[0x15] = { 0 }; - unsigned char zero_buf[0x15] = { 0 }; + unsigned char metadata_signature[0x28] = {0}; + unsigned char header_signature[0x28] = {0}; + unsigned char signature_hash[20] = {0}; + unsigned char signature_r[0x15] = {0}; + unsigned char signature_s[0x15] = {0}; + unsigned char zero_buf[0x15] = {0}; // Setup ECDSA curve and public key. ecdsa_set_curve(VSH_CURVE_P, VSH_CURVE_A, VSH_CURVE_B, VSH_CURVE_N, VSH_CURVE_GX, VSH_CURVE_GY); @@ -503,7 +503,7 @@ bool check_data(u8* key, EDAT_HEADER* edat, NPD_HEADER* npd, const fs::file* f, else { // Setup signature hash. - if ((edat->flags & EDAT_FLAG_0x20) != 0) //Sony failed again, they used buffer from 0x100 with half size of real metadata. + if ((edat->flags & EDAT_FLAG_0x20) != 0) // Sony failed again, they used buffer from 0x100 with half size of real metadata. { const usz metadata_buf_size = block_num * 0x10; @@ -553,7 +553,7 @@ bool check_data(u8* key, EDAT_HEADER* edat, NPD_HEADER* npd, const fs::file* f, return true; } -bool validate_dev_klic(const u8* klicensee, NPD_HEADER *npd) +bool validate_dev_klic(const u8* klicensee, NPD_HEADER* npd) { if ((npd->license & 0x3) != 0x3) { @@ -718,7 +718,7 @@ bool VerifyEDATHeaderWithKLicense(const fs::file& input, const std::string& inpu } // Decrypts full file -fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8 *custom_klic) +fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8* custom_klic) { if (!input) { @@ -758,16 +758,16 @@ fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, memcpy(&devklic, NP_PSP_KEY_2, 0x10); break; case 8: + { + if (custom_klic != NULL) + memcpy(&devklic, custom_klic, 0x10); + else { - if (custom_klic != NULL) - memcpy(&devklic, custom_klic, 0x10); - else - { - edat_log.error("Invalid custom klic!"); - return fs::file{}; - } - break; + edat_log.error("Invalid custom klic!"); + return fs::file{}; } + break; + } default: edat_log.error("Invalid mode!"); return fs::file{}; @@ -829,7 +829,7 @@ bool EDATADecrypter::ReadHeader() // } // Type 2: Use key from RAP file (RIF key). (also used for type 1 at the moment) - else + else { const std::string rap_path = rpcs3::utils::get_rap_file_path(npdHeader.content_id); @@ -853,7 +853,7 @@ bool EDATADecrypter::ReadHeader() // k the ecdsa_verify function in this check_data function takes a ridiculous amount of time // like it slows down load time by a factor of x20, at least, so its ignored for now - //if (!check_data(reinterpret_cast(&dec_key), &edatHeader, &npdHeader, &edata_file, false)) + // if (!check_data(reinterpret_cast(&dec_key), &edatHeader, &npdHeader, &edata_file, false)) //{ // edat_log.error("NPDRM check_data() failed!"); // return false; diff --git a/rpcs3/rpcs3/Crypto/unedat.h b/rpcs3/rpcs3/Crypto/unedat.h index 31fce60d4..6b96d598b 100644 --- a/rpcs3/rpcs3/Crypto/unedat.h +++ b/rpcs3/rpcs3/Crypto/unedat.h @@ -20,7 +20,10 @@ struct loaded_npdrm_keys void install_decryption_key(u128 key) { - dec_keys_pos.atomic_op([&](u64& pos) { dec_keys[pos++ % std::size(dec_keys)] = key; }); + dec_keys_pos.atomic_op([&](u64& pos) + { + dec_keys[pos++ % std::size(dec_keys)] = key; + }); } // TODO: Check if correct for ELF files usage @@ -59,10 +62,10 @@ struct EDAT_HEADER }; // Decrypts full file, or null/empty file -extern fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8 *custom_klic); +extern fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8* custom_klic); extern void read_npd_edat_header(const fs::file* input, NPD_HEADER& NPD, EDAT_HEADER& EDAT); -extern bool VerifyEDATHeaderWithKLicense(const fs::file& input, const std::string& input_file_name, const u8* custom_klic, NPD_HEADER *npd_out = nullptr); +extern bool VerifyEDATHeaderWithKLicense(const fs::file& input, const std::string& input_file_name, const u8* custom_klic, NPD_HEADER* npd_out = nullptr); u128 GetEdatRifKeyFromRapFile(const fs::file& rap_file); @@ -84,20 +87,12 @@ struct EDATADecrypter final : fs::file_base public: EDATADecrypter(fs::file&& input, u128 dec_key = {}, std::string file_name = {}, bool is_key_final = true) noexcept - : m_edata_file(std::move(input)) - , edata_file(m_edata_file) - , m_file_name(std::move(file_name)) - , m_is_key_final(is_key_final) - , dec_key(dec_key) + : m_edata_file(std::move(input)), edata_file(m_edata_file), m_file_name(std::move(file_name)), m_is_key_final(is_key_final), dec_key(dec_key) { } EDATADecrypter(const fs::file& input, u128 dec_key = {}, std::string file_name = {}, bool is_key_final = true) noexcept - : m_edata_file(fs::file{}) - , edata_file(input) - , m_file_name(std::move(file_name)) - , m_is_key_final(is_key_final) - , dec_key(dec_key) + : m_edata_file(fs::file{}), edata_file(input), m_file_name(std::move(file_name)), m_is_key_final(is_key_final), dec_key(dec_key) { } @@ -140,7 +135,8 @@ public: const s64 new_pos = whence == fs::seek_set ? offset : whence == fs::seek_cur ? offset + pos : - whence == fs::seek_end ? offset + size() : -1; + whence == fs::seek_end ? offset + size() : + -1; if (new_pos < 0) { @@ -152,7 +148,10 @@ public: return pos; } - u64 size() override { return file_size; } + u64 size() override + { + return file_size; + } fs::file_id get_id() override { diff --git a/rpcs3/rpcs3/Crypto/unpkg.cpp b/rpcs3/rpcs3/Crypto/unpkg.cpp index bc7481fcd..935bb17fe 100644 --- a/rpcs3/rpcs3/Crypto/unpkg.cpp +++ b/rpcs3/rpcs3/Crypto/unpkg.cpp @@ -17,8 +17,7 @@ LOG_CHANNEL(pkg_log, "PKG"); package_reader::package_reader(const std::string& path, fs::file file) - : m_path(path) - , m_file(std::move(file)) + : m_path(path), m_file(std::move(file)) { if (!m_file && !m_file.open(path)) { @@ -108,10 +107,10 @@ bool package_reader::read_header() pkg_log.notice("Extended header: main_and_ext_headers_hmac_offset = 0x%x = %d", ext_header.main_and_ext_headers_hmac_offset, ext_header.main_and_ext_headers_hmac_offset); pkg_log.notice("Extended header: metadata_header_hmac_offset = 0x%x = %d", ext_header.metadata_header_hmac_offset, ext_header.metadata_header_hmac_offset); pkg_log.notice("Extended header: tail_offset = 0x%x = %d", ext_header.tail_offset, ext_header.tail_offset); - //pkg_log.notice("Extended header: padding1 = 0x%x = %d", ext_header.padding1, ext_header.padding1); + // pkg_log.notice("Extended header: padding1 = 0x%x = %d", ext_header.padding1, ext_header.padding1); pkg_log.notice("Extended header: pkg_key_id = 0x%x = %d", ext_header.pkg_key_id, ext_header.pkg_key_id); pkg_log.notice("Extended header: full_header_hmac_offset = 0x%x = %d", ext_header.full_header_hmac_offset, ext_header.full_header_hmac_offset); - //pkg_log.notice("Extended header: padding2 = 0x%x = %d", ext_header.padding2, ext_header.padding2); + // pkg_log.notice("Extended header: padding2 = 0x%x = %d", ext_header.padding2, ext_header.padding2); } if (m_header.pkg_magic != std::bit_cast>("\x7FPKG"_u32)) @@ -128,7 +127,7 @@ bool package_reader::read_header() switch (const u16 type = m_header.pkg_type) { - case PKG_RELEASE_TYPE_DEBUG: break; + case PKG_RELEASE_TYPE_DEBUG: break; case PKG_RELEASE_TYPE_RELEASE: break; default: { @@ -500,7 +499,9 @@ bool package_reader::set_decryption_key() // TODO: Not all the keys seem to match the content types. I was only able to install a dlc (0x16) with PKG_AES_KEY_VITA_1 aes_context ctx; - aes_setkey_enc(&ctx, m_metadata.content_type == 0x15u ? PKG_AES_KEY_VITA_1 : m_metadata.content_type == 0x16u ? PKG_AES_KEY_VITA_2 : PKG_AES_KEY_VITA_3, 128); + aes_setkey_enc(&ctx, m_metadata.content_type == 0x15u ? PKG_AES_KEY_VITA_1 : m_metadata.content_type == 0x16u ? PKG_AES_KEY_VITA_2 : + PKG_AES_KEY_VITA_3, + 128); aes_crypt_ecb(&ctx, AES_ENCRYPT, reinterpret_cast(&m_header.klicensee), m_dec_key.data()); return true; } @@ -661,9 +662,9 @@ package_install_result package_reader::check_target_app_version() const return {package_install_result::error_type::other}; } - const auto category = psf::get_string(m_psf, "CATEGORY", ""); - const auto title_id = psf::get_string(m_psf, "TITLE_ID", ""); - const auto app_ver = psf::get_string(m_psf, "APP_VER", ""); + const auto category = psf::get_string(m_psf, "CATEGORY", ""); + const auto title_id = psf::get_string(m_psf, "TITLE_ID", ""); + const auto app_ver = psf::get_string(m_psf, "APP_VER", ""); const auto target_app_ver = psf::get_string(m_psf, "TARGET_APP_VER", ""); if (category != "GD") @@ -708,7 +709,7 @@ package_install_result package_reader::check_target_app_version() const const auto installed_psf = psf::load_object(installed_sfo_file, sfo_path); const auto installed_title_id = psf::get_string(installed_psf, "TITLE_ID", ""); - const auto installed_app_ver = psf::get_string(installed_psf, "APP_VER", ""); + const auto installed_app_ver = psf::get_string(installed_psf, "APP_VER", ""); if (title_id != installed_title_id || installed_app_ver.empty()) { @@ -915,14 +916,12 @@ bool package_reader::fill_data(std::map& all_instal auto map_ptr = &*all_install_entries.try_emplace(true_path).first; - m_install_entries.push_back({ - .weak_reference = map_ptr, + m_install_entries.push_back({.weak_reference = map_ptr, .name = std::string(name), .file_offset = entry.file_offset, .file_size = entry.file_size, .type = entry.type, - .pad = entry.pad - }); + .pad = entry.pad}); if (map_ptr->second && !(entry.type & PKG_FILE_ENTRY_OVERWRITE)) { @@ -946,7 +945,7 @@ bool package_reader::fill_data(std::map& all_instal return true; } -fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8 *custom_klic); +fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8* custom_klic); void package_reader::extract_worker() { @@ -956,15 +955,16 @@ void package_reader::extract_worker() { // Make sure m_entry_indexer does not exceed m_install_entries const usz index = m_entry_indexer.fetch_op([this](usz& v) - { - if (v < m_install_entries.size()) - { - v++; - return true; - } + { + if (v < m_install_entries.size()) + { + v++; + return true; + } - return false; - }).first; + return false; + }) + .first; if (index >= m_install_entries.size()) { @@ -1027,7 +1027,7 @@ void package_reader::extract_worker() pkg_log.warning("NPDRM EDAT!"); } - if (fs::file out{ path, did_overwrite ? fs::rewrite : fs::write_new }) + if (fs::file out{path, did_overwrite ? fs::rewrite : fs::write_new}) { bool extract_success = true; @@ -1038,9 +1038,7 @@ void package_reader::extract_worker() usz m_pos; explicit pkg_file_reader(std::function read_func, const install_entry& entry) noexcept - : m_read_func(std::move(read_func)) - , m_entry(entry) - , m_pos(0) + : m_read_func(std::move(read_func)), m_entry(entry), m_pos(0) { } @@ -1078,7 +1076,8 @@ void package_reader::extract_worker() const s64 new_pos = whence == fs::seek_set ? offset : whence == fs::seek_cur ? offset + m_pos : - whence == fs::seek_end ? offset + size() : -1; + whence == fs::seek_end ? offset + size() : + -1; if (new_pos < 0) { @@ -1107,78 +1106,79 @@ void package_reader::extract_worker() read_cache.clear(); auto reader = std::make_unique([&, cache_off = u64{umax}](usz pos, void* ptr, usz size) mutable -> u64 - { - if (pos >= entry.file_size || !size) { - return 0; - } - - size = std::min(entry.file_size - pos, size); - - u64 size_cache_end = 0; - u64 read_size = 0; - - // Check if exists in cache - if (!read_cache.empty() && cache_off <= pos && pos < cache_off + read_cache.size()) - { - read_size = std::min(pos + size, cache_off + read_cache.size()) - pos; - - std::memcpy(ptr, read_cache.data() + (pos - cache_off), read_size); - pos += read_size; - } - else if (!read_cache.empty() && cache_off < pos + size && cache_off + read_cache.size() >= pos + size) - { - size_cache_end = size - (std::max(cache_off, pos) - pos); - - std::memcpy(static_cast(ptr) + (cache_off - pos), read_cache.data(), size_cache_end); - size -= size_cache_end; - } - - if (pos >= entry.file_size || !size) - { - return read_size + size_cache_end; - } - - // Try to cache for later - if (size <= BUF_SIZE && !size_cache_end && !read_size) - { - const u64 block_size = std::min({BUF_SIZE, std::max(size * 5 / 3, 65536), entry.file_size - pos}); - - read_cache.resize(block_size + BUF_PADDING); - cache_off = pos; - - const usz advance_size = decrypt(entry.file_offset + pos, block_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data(), read_cache.data()); - - if (!advance_size) + if (pos >= entry.file_size || !size) { - cache_off = umax; return 0; } - read_cache.resize(advance_size); + size = std::min(entry.file_size - pos, size); - size = std::min(advance_size, size); - std::memcpy(ptr, read_cache.data(), size); - return size; - } + u64 size_cache_end = 0; + u64 read_size = 0; - while (read_size < size) - { - const u64 block_size = std::min(BUF_SIZE, size - read_size); - - const usz advance_size = decrypt(entry.file_offset + pos, block_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data(), static_cast(ptr) + read_size); - - if (!advance_size) + // Check if exists in cache + if (!read_cache.empty() && cache_off <= pos && pos < cache_off + read_cache.size()) { - break; + read_size = std::min(pos + size, cache_off + read_cache.size()) - pos; + + std::memcpy(ptr, read_cache.data() + (pos - cache_off), read_size); + pos += read_size; + } + else if (!read_cache.empty() && cache_off < pos + size && cache_off + read_cache.size() >= pos + size) + { + size_cache_end = size - (std::max(cache_off, pos) - pos); + + std::memcpy(static_cast(ptr) + (cache_off - pos), read_cache.data(), size_cache_end); + size -= size_cache_end; } - read_size += advance_size; - pos += advance_size; - } + if (pos >= entry.file_size || !size) + { + return read_size + size_cache_end; + } - return read_size + size_cache_end; - }, entry); + // Try to cache for later + if (size <= BUF_SIZE && !size_cache_end && !read_size) + { + const u64 block_size = std::min({BUF_SIZE, std::max(size * 5 / 3, 65536), entry.file_size - pos}); + + read_cache.resize(block_size + BUF_PADDING); + cache_off = pos; + + const usz advance_size = decrypt(entry.file_offset + pos, block_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data(), read_cache.data()); + + if (!advance_size) + { + cache_off = umax; + return 0; + } + + read_cache.resize(advance_size); + + size = std::min(advance_size, size); + std::memcpy(ptr, read_cache.data(), size); + return size; + } + + while (read_size < size) + { + const u64 block_size = std::min(BUF_SIZE, size - read_size); + + const usz advance_size = decrypt(entry.file_offset + pos, block_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data(), static_cast(ptr) + read_size); + + if (!advance_size) + { + break; + } + + read_size += advance_size; + pos += advance_size; + } + + return read_size + size_cache_end; + }, + entry); fs::file in_data; in_data.reset(std::move(reader)); @@ -1308,9 +1308,9 @@ package_install_result package_reader::extract_data(std::deque& const usz thread_count = std::min(utils::get_thread_count(), reader.m_install_entries.size()); named_thread_group workers("PKG Installer "sv, std::max(::narrow(thread_count), 1) - 1, [&]() - { - reader.extract_worker(); - }); + { + reader.extract_worker(); + }); reader.extract_worker(); workers.join(); @@ -1373,7 +1373,8 @@ package_install_result package_reader::extract_data(std::deque& void package_reader::archive_seek(const s64 new_offset, const fs::seek_mode damode) { - if (m_file) m_file.seek(new_offset, damode); + if (m_file) + m_file.seek(new_offset, damode); } u64 package_reader::archive_read(void* data_ptr, const u64 num_bytes) @@ -1412,12 +1413,12 @@ usz package_reader::decrypt(u64 offset, u64 size, const uchar* key, void* local_ { // Debug key be_t input[8] = - { - m_header.qa_digest[0], - m_header.qa_digest[0], - m_header.qa_digest[1], - m_header.qa_digest[1], - }; + { + m_header.qa_digest[0], + m_header.qa_digest[0], + m_header.qa_digest[1], + m_header.qa_digest[1], + }; for (u64 i = 0; i < blocks; i++) { diff --git a/rpcs3/rpcs3/Crypto/unpkg.h b/rpcs3/rpcs3/Crypto/unpkg.h index d25356150..c103e6d75 100644 --- a/rpcs3/rpcs3/Crypto/unpkg.h +++ b/rpcs3/rpcs3/Crypto/unpkg.h @@ -12,69 +12,69 @@ // Constants enum : u32 { - PKG_HEADER_SIZE = 0xC0, // sizeof(pkg_header) + sizeof(pkg_unk_checksum) + PKG_HEADER_SIZE = 0xC0, // sizeof(pkg_header) + sizeof(pkg_unk_checksum) PKG_HEADER_SIZE2 = 0x280, PKG_MAX_FILENAME_SIZE = 256, }; enum : u16 { - PKG_RELEASE_TYPE_RELEASE = 0x8000, - PKG_RELEASE_TYPE_DEBUG = 0x0000, + PKG_RELEASE_TYPE_RELEASE = 0x8000, + PKG_RELEASE_TYPE_DEBUG = 0x0000, - PKG_PLATFORM_TYPE_PS3 = 0x0001, - PKG_PLATFORM_TYPE_PSP_PSVITA = 0x0002, + PKG_PLATFORM_TYPE_PS3 = 0x0001, + PKG_PLATFORM_TYPE_PSP_PSVITA = 0x0002, }; enum : u32 { - PKG_FILE_ENTRY_NPDRM = 1, - PKG_FILE_ENTRY_NPDRMEDAT = 2, - PKG_FILE_ENTRY_REGULAR = 3, - PKG_FILE_ENTRY_FOLDER = 4, - PKG_FILE_ENTRY_UNK0 = 5, - PKG_FILE_ENTRY_UNK1 = 6, - PKG_FILE_ENTRY_SDAT = 9, + PKG_FILE_ENTRY_NPDRM = 1, + PKG_FILE_ENTRY_NPDRMEDAT = 2, + PKG_FILE_ENTRY_REGULAR = 3, + PKG_FILE_ENTRY_FOLDER = 4, + PKG_FILE_ENTRY_UNK0 = 5, + PKG_FILE_ENTRY_UNK1 = 6, + PKG_FILE_ENTRY_SDAT = 9, - PKG_FILE_ENTRY_OVERWRITE = 0x80000000, - PKG_FILE_ENTRY_PSP = 0x10000000, + PKG_FILE_ENTRY_OVERWRITE = 0x80000000, + PKG_FILE_ENTRY_PSP = 0x10000000, - PKG_FILE_ENTRY_KNOWN_BITS = 0xff | PKG_FILE_ENTRY_PSP | PKG_FILE_ENTRY_OVERWRITE, + PKG_FILE_ENTRY_KNOWN_BITS = 0xff | PKG_FILE_ENTRY_PSP | PKG_FILE_ENTRY_OVERWRITE, }; enum : u32 { - PKG_CONTENT_TYPE_UNKNOWN_1 = 0x01, // ? - PKG_CONTENT_TYPE_UNKNOWN_2 = 0x02, // ? - PKG_CONTENT_TYPE_UNKNOWN_3 = 0x03, // ? - PKG_CONTENT_TYPE_GAME_DATA = 0x04, // GameData (also patches) - PKG_CONTENT_TYPE_GAME_EXEC = 0x05, // GameExec - PKG_CONTENT_TYPE_PS1_EMU = 0x06, // PS1emu - PKG_CONTENT_TYPE_PC_ENGINE = 0x07, // PSP & PCEngine - PKG_CONTENT_TYPE_UNKNOWN_4 = 0x08, // ? - PKG_CONTENT_TYPE_THEME = 0x09, // Theme - PKG_CONTENT_TYPE_WIDGET = 0x0A, // Widget - PKG_CONTENT_TYPE_LICENSE = 0x0B, // License - PKG_CONTENT_TYPE_VSH_MODULE = 0x0C, // VSHModule - PKG_CONTENT_TYPE_PSN_AVATAR = 0x0D, // PSN Avatar - PKG_CONTENT_TYPE_PSP_GO = 0x0E, // PSPgo - PKG_CONTENT_TYPE_MINIS = 0x0F, // Minis - PKG_CONTENT_TYPE_NEOGEO = 0x10, // NEOGEO - PKG_CONTENT_TYPE_VMC = 0x11, // VMC - PKG_CONTENT_TYPE_PS2_CLASSIC = 0x12, // ?PS2Classic? Seen on PS2 classic - PKG_CONTENT_TYPE_UNKNOWN_5 = 0x13, // ? + PKG_CONTENT_TYPE_UNKNOWN_1 = 0x01, // ? + PKG_CONTENT_TYPE_UNKNOWN_2 = 0x02, // ? + PKG_CONTENT_TYPE_UNKNOWN_3 = 0x03, // ? + PKG_CONTENT_TYPE_GAME_DATA = 0x04, // GameData (also patches) + PKG_CONTENT_TYPE_GAME_EXEC = 0x05, // GameExec + PKG_CONTENT_TYPE_PS1_EMU = 0x06, // PS1emu + PKG_CONTENT_TYPE_PC_ENGINE = 0x07, // PSP & PCEngine + PKG_CONTENT_TYPE_UNKNOWN_4 = 0x08, // ? + PKG_CONTENT_TYPE_THEME = 0x09, // Theme + PKG_CONTENT_TYPE_WIDGET = 0x0A, // Widget + PKG_CONTENT_TYPE_LICENSE = 0x0B, // License + PKG_CONTENT_TYPE_VSH_MODULE = 0x0C, // VSHModule + PKG_CONTENT_TYPE_PSN_AVATAR = 0x0D, // PSN Avatar + PKG_CONTENT_TYPE_PSP_GO = 0x0E, // PSPgo + PKG_CONTENT_TYPE_MINIS = 0x0F, // Minis + PKG_CONTENT_TYPE_NEOGEO = 0x10, // NEOGEO + PKG_CONTENT_TYPE_VMC = 0x11, // VMC + PKG_CONTENT_TYPE_PS2_CLASSIC = 0x12, // ?PS2Classic? Seen on PS2 classic + PKG_CONTENT_TYPE_UNKNOWN_5 = 0x13, // ? PKG_CONTENT_TYPE_PSP_REMASTERED = 0x14, // ? - PKG_CONTENT_TYPE_PSP2_GD = 0x15, // PSVita Game Data - PKG_CONTENT_TYPE_PSP2_AC = 0x16, // PSVita Additional Content - PKG_CONTENT_TYPE_PSP2_LA = 0x17, // PSVita LiveArea - PKG_CONTENT_TYPE_PSM_1 = 0x18, // PSVita PSM ? - PKG_CONTENT_TYPE_WT = 0x19, // Web TV ? - PKG_CONTENT_TYPE_UNKNOWN_6 = 0x1A, // ? - PKG_CONTENT_TYPE_UNKNOWN_7 = 0x1B, // ? - PKG_CONTENT_TYPE_UNKNOWN_8 = 0x1C, // ? - PKG_CONTENT_TYPE_PSM_2 = 0x1D, // PSVita PSM ? - PKG_CONTENT_TYPE_UNKNOWN_9 = 0x1E, // ? - PKG_CONTENT_TYPE_PSP2_THEME = 0x1F, // PSVita Theme + PKG_CONTENT_TYPE_PSP2_GD = 0x15, // PSVita Game Data + PKG_CONTENT_TYPE_PSP2_AC = 0x16, // PSVita Additional Content + PKG_CONTENT_TYPE_PSP2_LA = 0x17, // PSVita LiveArea + PKG_CONTENT_TYPE_PSM_1 = 0x18, // PSVita PSM ? + PKG_CONTENT_TYPE_WT = 0x19, // Web TV ? + PKG_CONTENT_TYPE_UNKNOWN_6 = 0x1A, // ? + PKG_CONTENT_TYPE_UNKNOWN_7 = 0x1B, // ? + PKG_CONTENT_TYPE_UNKNOWN_8 = 0x1C, // ? + PKG_CONTENT_TYPE_PSM_2 = 0x1D, // PSVita PSM ? + PKG_CONTENT_TYPE_UNKNOWN_9 = 0x1E, // ? + PKG_CONTENT_TYPE_PSP2_THEME = 0x1F, // PSVita Theme }; // Structs @@ -93,7 +93,7 @@ struct PKGHeader char title_id[48]; // Title ID be_t qa_digest[2]; // This should be the hash of "files + attribs" be_t klicensee; // Nonce - // + some stuff + // + some stuff }; // Extended header in PSP and PSVita packages @@ -107,19 +107,19 @@ struct PKGExtHeader be_t metadata_header_hmac_offset; // ex: 0x360, 0x390, 0x490 be_t tail_offset; // tail size seams to be always 0x1A0 be_t padding1; - be_t pkg_key_id; // Id of the AES key used for decryption. PSP = 0x1, PSVita = 0xC0000002, PSM = 0xC0000004 - be_t full_header_hmac_offset; // ex: none (old pkg): 0, 0x930 + be_t pkg_key_id; // Id of the AES key used for decryption. PSP = 0x1, PSVita = 0xC0000002, PSM = 0xC0000004 + be_t full_header_hmac_offset; // ex: none (old pkg): 0, 0x930 u8 padding2[20]; }; struct PKGEntry { - be_t name_offset; // File name offset - be_t name_size; // File name size - be_t file_offset; // File offset - be_t file_size; // File size - be_t type; // File type - be_t pad; // Padding (zeros) + be_t name_offset; // File name offset + be_t name_size; // File name size + be_t file_offset; // File offset + be_t file_size; // File size + be_t type; // File type + be_t pad; // Padding (zeros) }; // https://www.psdevwiki.com/ps3/PKG_files#PKG_Metadata @@ -144,22 +144,23 @@ private: } return result; } -public: - be_t drm_type{ 0 }; - be_t content_type{ 0 }; - be_t package_type{ 0 }; - be_t package_size{ 0 }; - u8 qa_digest[24]{ 0 }; - be_t unk_0x9{ 0 }; - be_t unk_0xB{ 0 }; +public: + be_t drm_type{0}; + be_t content_type{0}; + be_t package_type{0}; + be_t package_size{0}; + u8 qa_digest[24]{0}; + + be_t unk_0x9{0}; + be_t unk_0xB{0}; struct package_revision { struct package_revision_data { - u8 make_package_npdrm_ver[2]{ 0 }; - u8 version[2]{ 0 }; + u8 make_package_npdrm_ver[2]{0}; + u8 version[2]{0}; } data{}; std::string make_package_npdrm_ver; @@ -180,10 +181,10 @@ public: { struct software_revision_data { - u8 unk[1]{ 0 }; - u8 firmware_version[3]{ 0 }; - u8 version[2]{ 0 }; - u8 app_version[2]{ 0 }; + u8 unk[1]{0}; + u8 firmware_version[3]{0}; + u8 version[2]{0}; + u8 app_version[2]{0}; } data{}; std::string unk; // maybe hardware id @@ -212,9 +213,9 @@ public: struct vita_item_info // size is 0x28 (40) { - be_t offset{ 0 }; - be_t size{ 0 }; - u8 sha256[32]{ 0 }; + be_t offset{0}; + be_t size{0}; + u8 sha256[32]{0}; std::string to_string() const { @@ -224,12 +225,12 @@ public: struct vita_sfo_info // size is 0x38 (56) { - be_t param_offset{ 0 }; - be_t param_size{ 0 }; - be_t unk_1{ 0 }; // seen values: 0x00000001-0x00000018, 0x0000001b-0x0000001c - be_t psp2_system_ver{ 0 }; // BCD encoded - u8 unk_2[8]{ 0 }; - u8 param_digest[32]{ 0 }; // SHA256 of param_data. Called ParamDigest: This is sha256 digest of param.sfo. + be_t param_offset{0}; + be_t param_size{0}; + be_t unk_1{0}; // seen values: 0x00000001-0x00000018, 0x0000001b-0x0000001c + be_t psp2_system_ver{0}; // BCD encoded + u8 unk_2[8]{0}; + u8 param_digest[32]{0}; // SHA256 of param_data. Called ParamDigest: This is sha256 digest of param.sfo. std::string to_string() const { @@ -240,10 +241,10 @@ public: struct vita_unknown_data_info // size is 0x48 (72) { - be_t unknown_data_offset{ 0 }; - be_t unknown_data_size{ 0 }; // ex: 0x320 - u8 unk[32]{ 0 }; - u8 unknown_data_sha256[32]{ 0 }; + be_t unknown_data_offset{0}; + be_t unknown_data_size{0}; // ex: 0x320 + u8 unk[32]{0}; + u8 unknown_data_sha256[32]{0}; std::string to_string() const { @@ -254,13 +255,13 @@ public: struct vita_entirety_info // size is 0x38 (56) { - be_t entirety_data_offset{ 0 }; // located just before SFO - be_t entirety_data_size{ 0 }; // ex: 0xA0, C0, 0x100, 0x120, 0x160 - be_t flags{ 0 }; // ex: EE 00, FE 10, FE 78, FE F8, FF 10, FF 90, FF D0, flags indicating which digests it embeds - be_t unk_1{ 0 }; // always 00 00 - be_t unk_2{ 0 }; // ex: 1, 0 - u8 unk_3[8]{ 0 }; - u8 entirety_digest[32]{ 0 }; + be_t entirety_data_offset{0}; // located just before SFO + be_t entirety_data_size{0}; // ex: 0xA0, C0, 0x100, 0x120, 0x160 + be_t flags{0}; // ex: EE 00, FE 10, FE 78, FE F8, FF 10, FF 90, FF D0, flags indicating which digests it embeds + be_t unk_1{0}; // always 00 00 + be_t unk_2{0}; // ex: 1, 0 + u8 unk_3[8]{0}; + u8 entirety_digest[32]{0}; std::string to_string() const { @@ -271,9 +272,9 @@ public: struct vita_version_info // size is 0x28 (40) { - be_t publishing_tools_version{ 0 }; - be_t psf_builder_version{ 0 }; - u8 padding[32]{ 0 }; + be_t publishing_tools_version{0}; + be_t psf_builder_version{0}; + u8 padding[32]{0}; std::string to_string() const { @@ -284,10 +285,10 @@ public: struct vita_self_info // size is 0x38 (56) { - be_t self_info_offset{ 0 }; // offset to the first self_info_data_element - be_t self_info_size{ 0 }; // usually 0x10 or 0x20 - u8 unk[16]{ 0 }; - u8 self_sha256[32]{ 0 }; + be_t self_info_offset{0}; // offset to the first self_info_data_element + be_t self_info_size{0}; // usually 0x10 or 0x20 + u8 unk[16]{0}; + u8 self_sha256[32]{0}; std::string to_string() const { @@ -346,17 +347,26 @@ public: error_dirty }; - bool is_valid() const { return m_is_valid; } + bool is_valid() const + { + return m_is_valid; + } package_install_result check_target_app_version() const; static package_install_result extract_data(std::deque& readers, std::deque& bootable_paths); - const psf::registry& get_psf() const { return m_psf; } - result get_result() const { return m_result; }; + const psf::registry& get_psf() const + { + return m_psf; + } + result get_result() const + { + return m_result; + }; int get_progress(int maximum = 100) const; void abort_extract(); - fs::file &file() + fs::file& file() { return m_file; } diff --git a/rpcs3/rpcs3/Crypto/unself.cpp b/rpcs3/rpcs3/Crypto/unself.cpp index 3855dcd62..5673e60cf 100644 --- a/rpcs3/rpcs3/Crypto/unself.cpp +++ b/rpcs3/rpcs3/Crypto/unself.cpp @@ -188,14 +188,13 @@ void WriteShdr(const fs::file& f, Elf32_Shdr& shdr) Write32(f, shdr.sh_entsize); } - void program_identification_header::Load(const fs::file& f) { program_authority_id = Read64(f); - program_vendor_id = Read32(f); - program_type = Read32(f); - program_sceversion = Read64(f); - padding = Read64(f); + program_vendor_id = Read32(f); + program_type = Read32(f); + program_sceversion = Read64(f); + padding = Read64(f); } void program_identification_header::Show() const @@ -208,11 +207,11 @@ void program_identification_header::Show() const void segment_ext_header::Load(const fs::file& f) { - offset = Read64(f); - size = Read64(f); + offset = Read64(f); + size = Read64(f); compression = Read32(f); - unknown = Read32(f); - encryption = Read64(f); + unknown = Read32(f); + encryption = Read64(f); } void segment_ext_header::Show() const @@ -227,9 +226,9 @@ void segment_ext_header::Show() const void version_header::Load(const fs::file& f) { subheader_type = Read32(f); - present = Read32(f); - size = Read32(f); - unknown4 = Read32(f); + present = Read32(f); + size = Read32(f); + unknown4 = Read32(f); } void version_header::Show() const @@ -364,12 +363,12 @@ void MetadataHeader::Load(u8* in) { // Endian swap. signature_input_length = read_from_ptr>(in); - unknown1 = read_from_ptr>(in, 8); - section_count = read_from_ptr>(in, 12); - key_count = read_from_ptr>(in, 16); - opt_header_size = read_from_ptr>(in, 20); - unknown2 = read_from_ptr>(in, 24); - unknown3 = read_from_ptr>(in, 28); + unknown1 = read_from_ptr>(in, 8); + section_count = read_from_ptr>(in, 12); + key_count = read_from_ptr>(in, 16); + opt_header_size = read_from_ptr>(in, 20); + unknown2 = read_from_ptr>(in, 24); + unknown3 = read_from_ptr>(in, 28); } void MetadataHeader::Show() const @@ -387,15 +386,15 @@ void MetadataSectionHeader::Load(u8* in) { // Endian swap. data_offset = read_from_ptr>(in); - data_size = read_from_ptr>(in, 8); - type = read_from_ptr>(in, 16); + data_size = read_from_ptr>(in, 8); + type = read_from_ptr>(in, 16); program_idx = read_from_ptr>(in, 20); - hashed = read_from_ptr>(in, 24); - sha1_idx = read_from_ptr>(in, 28); - encrypted = read_from_ptr>(in, 32); - key_idx = read_from_ptr>(in, 36); - iv_idx = read_from_ptr>(in, 40); - compressed = read_from_ptr>(in, 44); + hashed = read_from_ptr>(in, 24); + sha1_idx = read_from_ptr>(in, 28); + encrypted = read_from_ptr>(in, 32); + key_idx = read_from_ptr>(in, 36); + iv_idx = read_from_ptr>(in, 40); + compressed = read_from_ptr>(in, 44); } void MetadataSectionHeader::Show() const @@ -421,13 +420,13 @@ void SectionHash::Load(const fs::file& f) void CapabilitiesInfo::Load(const fs::file& f) { - type = Read32(f); + type = Read32(f); capabilities_size = Read32(f); - next = Read32(f); + next = Read32(f); unknown1 = Read32(f); unknown2 = Read64(f); unknown3 = Read64(f); - flags = Read64(f); + flags = Read64(f); unknown4 = Read32(f); unknown5 = Read32(f); } @@ -601,8 +600,7 @@ void ext_hdr::Load(const fs::file& f) } SCEDecrypter::SCEDecrypter(const fs::file& s) - : sce_f(s) - , data_buf_length(0) + : sce_f(s), data_buf_length(0) { } @@ -647,7 +645,7 @@ bool SCEDecrypter::LoadMetadata(const u8 erk[32], const u8 riv[16]) if ((sce_hdr.se_flags & 0x8000) != 0x8000) { // Decrypt the metadata info. - aes_setkey_dec(&aes, metadata_key, 256); // AES-256 + aes_setkey_dec(&aes, metadata_key, 256); // AES-256 aes_crypt_cbc(&aes, AES_DECRYPT, sizeof(meta_info), metadata_iv, metadata_info.get(), metadata_info.get()); } @@ -789,15 +787,15 @@ std::vector SCEDecrypter::MakeFile() if (out_f.pos() != out_f.size()) fmt::throw_exception("MakeELF written bytes (%llu) does not equal buffer size (%llu).", out_f.pos(), out_f.size()); - if (is_valid) vec.push_back(std::move(out_f)); + if (is_valid) + vec.push_back(std::move(out_f)); } return vec; } SELFDecrypter::SELFDecrypter(const fs::file& s) - : self_f(s) - , key_v() + : self_f(s), key_v() { } @@ -843,13 +841,13 @@ bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info) if (isElf32) { phdr32_arr.clear(); - if(elf32_hdr.e_phoff == 0 && elf32_hdr.e_phnum) + if (elf32_hdr.e_phoff == 0 && elf32_hdr.e_phnum) { self_log.error("ELF program header offset is null!"); return false; } self_f.seek(m_ext_hdr.phdr_offset); - for(u32 i = 0; i < elf32_hdr.e_phnum; ++i) + for (u32 i = 0; i < elf32_hdr.e_phnum; ++i) { phdr32_arr.emplace_back(); phdr32_arr.back().Load(self_f); @@ -878,7 +876,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info) m_seg_ext_hdr.clear(); self_f.seek(m_ext_hdr.segment_ext_hdr_offset); - for(u32 i = 0; i < (isElf32 ? elf32_hdr.e_phnum : elf64_hdr.e_phnum); ++i) + for (u32 i = 0; i < (isElf32 ? elf32_hdr.e_phnum : elf64_hdr.e_phnum); ++i) { if (self_f.pos() >= self_f.size()) { @@ -934,7 +932,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info) self_f.seek(m_ext_hdr.shdr_offset); - for(u32 i = 0; i < elf32_hdr.e_shnum; ++i) + for (u32 i = 0; i < elf32_hdr.e_shnum; ++i) { shdr32_arr.emplace_back(); shdr32_arr.back().Load(self_f); @@ -951,7 +949,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info) self_f.seek(m_ext_hdr.shdr_offset); - for(u32 i = 0; i < elf64_hdr.e_shnum; ++i) + for (u32 i = 0; i < elf64_hdr.e_shnum; ++i) { shdr64_arr.emplace_back(); shdr64_arr.back().Load(self_f); @@ -986,12 +984,12 @@ void SELFDecrypter::ShowHeaders(bool isElf32) self_log.notice("----------------------------------------------------"); self_log.notice("ELF program headers"); self_log.notice("----------------------------------------------------"); - for(unsigned int i = 0; i < ((isElf32) ? phdr32_arr.size() : phdr64_arr.size()); i++) + for (unsigned int i = 0; i < ((isElf32) ? phdr32_arr.size() : phdr64_arr.size()); i++) isElf32 ? phdr32_arr[i].Show() : phdr64_arr[i].Show(); self_log.notice("----------------------------------------------------"); self_log.notice("Section info"); self_log.notice("----------------------------------------------------"); - for(unsigned int i = 0; i < m_seg_ext_hdr.size(); i++) + for (unsigned int i = 0; i < m_seg_ext_hdr.size(); i++) m_seg_ext_hdr[i].Show(); self_log.notice("----------------------------------------------------"); self_log.notice("SCE version info"); @@ -1000,17 +998,17 @@ void SELFDecrypter::ShowHeaders(bool isElf32) self_log.notice("----------------------------------------------------"); self_log.notice("Control info"); self_log.notice("----------------------------------------------------"); - for(unsigned int i = 0; i < m_supplemental_hdr_arr.size(); i++) + for (unsigned int i = 0; i < m_supplemental_hdr_arr.size(); i++) m_supplemental_hdr_arr[i].Show(); self_log.notice("----------------------------------------------------"); self_log.notice("ELF section headers"); self_log.notice("----------------------------------------------------"); - for(unsigned int i = 0; i < ((isElf32) ? shdr32_arr.size() : shdr64_arr.size()); i++) + for (unsigned int i = 0; i < ((isElf32) ? shdr32_arr.size() : shdr64_arr.size()); i++) isElf32 ? shdr32_arr[i].Show() : shdr64_arr[i].Show(); self_log.notice("----------------------------------------------------"); } -bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size) +bool SELFDecrypter::DecryptNPDRM(u8* metadata, u32 metadata_size) { aes_context aes; u8 npdrm_key[0x10]; @@ -1025,7 +1023,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size) return true; } - if (npd->license == 1) // Network license. + if (npd->license == 1) // Network license. { // Try to find a RAP file to get the key. if (!GetKeyFromRap(npd->content_id, npdrm_key)) @@ -1034,7 +1032,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size) return false; } } - else if (npd->license == 2) // Local license. + else if (npd->license == 2) // Local license. { // Try to find a RAP file to get the key. if (!GetKeyFromRap(npd->content_id, npdrm_key)) @@ -1043,7 +1041,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size) return false; } } - else if (npd->license == 3) // Free license. + else if (npd->license == 3) // Free license. { // Use klicensee if available. (may be set to NP_KLIC_FREE if none is set) std::memcpy(npdrm_key, key_v.GetKlicenseeKey(), 0x10); @@ -1118,7 +1116,7 @@ bool SELFDecrypter::LoadMetadata(const u8* klic_key) return false; // Decrypt the metadata info. - aes_setkey_dec(&aes, metadata_key, 256); // AES-256 + aes_setkey_dec(&aes, metadata_key, 256); // AES-256 aes_crypt_cbc(&aes, AES_DECRYPT, sizeof(meta_info), metadata_iv, metadata_info.get(), metadata_info.get()); } @@ -1191,7 +1189,7 @@ bool SELFDecrypter::DecryptData() if (meta_shdr[i].encrypted == 3) { // Make sure the key and iv are not out of boundaries. - if((meta_shdr[i].key_idx <= meta_hdr.key_count - 1) && (meta_shdr[i].iv_idx <= meta_hdr.key_count)) + if ((meta_shdr[i].key_idx <= meta_hdr.key_count - 1) && (meta_shdr[i].iv_idx <= meta_hdr.key_count)) { // Get the key and iv from the previously stored key buffer. memcpy(data_key, data_keys.get() + meta_shdr[i].key_idx * 0x10, 0x10); @@ -1256,8 +1254,9 @@ bool SELFDecrypter::GetKeyFromRap(const char* content_id, u8* npdrm_key) if (!rap_file) { self_log.fatal("Failed to locate the game license file: %s." - "\nEnsure the .rap license file is placed in the dev_hdd0/home/%s/exdata folder with a lowercase file extension." - "\nIf you need assistance on dumping the license file from your PS3, read our quickstart guide: https://rpcs3.net/quickstart", rap_path, Emu.GetUsr()); + "\nEnsure the .rap license file is placed in the dev_hdd0/home/%s/exdata folder with a lowercase file extension." + "\nIf you need assistance on dumping the license file from your PS3, read our quickstart guide: https://rpcs3.net/quickstart", + rap_path, Emu.GetUsr()); return false; } @@ -1277,7 +1276,8 @@ bool SELFDecrypter::GetKeyFromRap(const char* content_id, u8* npdrm_key) static bool IsSelfElf32(const fs::file& f) { - if (!f) return false; + if (!f) + return false; f.seek(0); @@ -1454,7 +1454,7 @@ bool verify_npdrm_self_headers(const fs::file& self, u8* klic_key, NPD_HEADER* n return true; } -bool get_npdrm_self_header(const fs::file& self, NPD_HEADER &npd_out) +bool get_npdrm_self_header(const fs::file& self, NPD_HEADER& npd_out) { if (!self) return false; diff --git a/rpcs3/rpcs3/Crypto/unself.h b/rpcs3/rpcs3/Crypto/unself.h index 1279bc961..c823db402 100644 --- a/rpcs3/rpcs3/Crypto/unself.h +++ b/rpcs3/rpcs3/Crypto/unself.h @@ -14,19 +14,19 @@ LOG_CHANNEL(self_log, "SELF"); // SCE-specific definitions for e_type: enum { - ET_SCE_EXEC = 0xFE00, // SCE Executable - PRX2 - ET_SCE_RELEXEC = 0xFE04, // SCE Relocatable Executable - PRX2 - ET_SCE_STUBLIB = 0xFE0C, // SCE SDK Stubs - ET_SCE_DYNEXEC = 0xFE10, // SCE EXEC_ASLR (PS4 Executable with ASLR) - ET_SCE_DYNAMIC = 0xFE18, // ? - ET_SCE_IOPRELEXEC = 0xFF80, // SCE IOP Relocatable Executable - ET_SCE_IOPRELEXEC2 = 0xFF81, // SCE IOP Relocatable Executable Version 2 - ET_SCE_EERELEXEC = 0xFF90, // SCE EE Relocatable Executable - ET_SCE_EERELEXEC2 = 0xFF91, // SCE EE Relocatable Executable Version 2 - ET_SCE_PSPRELEXEC = 0xFFA0, // SCE PSP Relocatable Executable - ET_SCE_PPURELEXEC = 0xFFA4, // SCE PPU Relocatable Executable - ET_SCE_ARMRELEXEC = 0xFFA5, // ?SCE ARM Relocatable Executable (PS Vita System Software earlier or equal 0.931.010) - ET_SCE_PSPOVERLAY = 0xFFA8, // ? + ET_SCE_EXEC = 0xFE00, // SCE Executable - PRX2 + ET_SCE_RELEXEC = 0xFE04, // SCE Relocatable Executable - PRX2 + ET_SCE_STUBLIB = 0xFE0C, // SCE SDK Stubs + ET_SCE_DYNEXEC = 0xFE10, // SCE EXEC_ASLR (PS4 Executable with ASLR) + ET_SCE_DYNAMIC = 0xFE18, // ? + ET_SCE_IOPRELEXEC = 0xFF80, // SCE IOP Relocatable Executable + ET_SCE_IOPRELEXEC2 = 0xFF81, // SCE IOP Relocatable Executable Version 2 + ET_SCE_EERELEXEC = 0xFF90, // SCE EE Relocatable Executable + ET_SCE_EERELEXEC2 = 0xFF91, // SCE EE Relocatable Executable Version 2 + ET_SCE_PSPRELEXEC = 0xFFA0, // SCE PSP Relocatable Executable + ET_SCE_PPURELEXEC = 0xFFA4, // SCE PPU Relocatable Executable + ET_SCE_ARMRELEXEC = 0xFFA5, // ?SCE ARM Relocatable Executable (PS Vita System Software earlier or equal 0.931.010) + ET_SCE_PSPOVERLAY = 0xFFA8, // ? }; enum @@ -36,21 +36,21 @@ enum enum { - PT_SCE_RELA = 0x60000000, - PT_SCE_LICINFO_1 = 0x60000001, - PT_SCE_LICINFO_2 = 0x60000002, - PT_SCE_DYNLIBDATA = 0x61000000, - PT_SCE_PROCPARAM = 0x61000001, + PT_SCE_RELA = 0x60000000, + PT_SCE_LICINFO_1 = 0x60000001, + PT_SCE_LICINFO_2 = 0x60000002, + PT_SCE_DYNLIBDATA = 0x61000000, + PT_SCE_PROCPARAM = 0x61000001, PT_SCE_UNK_61000010 = 0x61000010, - PT_SCE_COMMENT = 0x6FFFFF00, - PT_SCE_LIBVERSION = 0x6FFFFF01, + PT_SCE_COMMENT = 0x6FFFFF00, + PT_SCE_LIBVERSION = 0x6FFFFF01, PT_SCE_UNK_70000001 = 0x70000001, - PT_SCE_IOPMOD = 0x70000080, - PT_SCE_EEMOD = 0x70000090, - PT_SCE_PSPRELA = 0x700000A0, - PT_SCE_PSPRELA2 = 0x700000A1, - PT_SCE_PPURELA = 0x700000A4, - PT_SCE_SEGSYM = 0x700000A8, + PT_SCE_IOPMOD = 0x70000080, + PT_SCE_EEMOD = 0x70000090, + PT_SCE_PSPRELA = 0x700000A0, + PT_SCE_PSPRELA2 = 0x700000A1, + PT_SCE_PPURELA = 0x700000A4, + PT_SCE_SEGSYM = 0x700000A8, }; enum @@ -65,10 +65,10 @@ enum enum { - SHT_SCE_RELA = 0x60000000, - SHT_SCE_NID = 0x61000001, - SHT_SCE_IOPMOD = 0x70000080, - SHT_SCE_EEMOD = 0x70000090, + SHT_SCE_RELA = 0x60000000, + SHT_SCE_NID = 0x61000001, + SHT_SCE_IOPMOD = 0x70000080, + SHT_SCE_EEMOD = 0x70000090, SHT_SCE_PSPRELA = 0x700000A0, SHT_SCE_PPURELA = 0x700000A4, }; @@ -132,8 +132,8 @@ struct supplemental_header // type 2, 0x40 bytes struct // 0x30 bytes of data { - u8 constant[0x14]; // same for every PS3/PS Vita SELF, hardcoded in make_fself.exe: 627CB1808AB938E32C8C091708726A579E2586E4 - u8 elf_digest[0x14]; // SHA-1. Hash F2C552BF716ED24759CBE8A0A9A6DB9965F3811C is blacklisted by appldr + u8 constant[0x14]; // same for every PS3/PS Vita SELF, hardcoded in make_fself.exe: 627CB1808AB938E32C8C091708726A579E2586E4 + u8 elf_digest[0x14]; // SHA-1. Hash F2C552BF716ED24759CBE8A0A9A6DB9965F3811C is blacklisted by appldr u64 required_system_version; // filled on Sony authentication server, contains decimal PS3_SYSTEM_VER value from PARAM.SFO } PS3_elf_digest_header_40; @@ -155,7 +155,6 @@ struct supplemental_header void Show() const; }; - struct MetadataInfo { u8 key[0x10]; @@ -242,32 +241,41 @@ struct SelfSection struct Elf32_Ehdr { - //u8 e_ident[16]; // ELF identification + // u8 e_ident[16]; // ELF identification u32 e_magic; u8 e_class; u8 e_data; u8 e_curver; u8 e_os_abi; u64 e_abi_ver; - u16 e_type; // object file type - u16 e_machine; // machine type - u32 e_version; // object file version - u32 e_entry; // entry point address - u32 e_phoff; // program header offset - u32 e_shoff; // section header offset - u32 e_flags; // processor-specific flags - u16 e_ehsize; // ELF header size - u16 e_phentsize; // size of program header entry - u16 e_phnum; // number of program header entries - u16 e_shentsize; // size of section header entry - u16 e_shnum; // number of section header entries - u16 e_shstrndx; // section name string table index + u16 e_type; // object file type + u16 e_machine; // machine type + u32 e_version; // object file version + u32 e_entry; // entry point address + u32 e_phoff; // program header offset + u32 e_shoff; // section header offset + u32 e_flags; // processor-specific flags + u16 e_ehsize; // ELF header size + u16 e_phentsize; // size of program header entry + u16 e_phnum; // number of program header entries + u16 e_shentsize; // size of section header entry + u16 e_shnum; // number of section header entries + u16 e_shstrndx; // section name string table index void Load(const fs::file& f); static void Show() {} - bool IsLittleEndian() const { return e_data == 1; } - bool CheckMagic() const { return e_magic == 0x7F454C46; } - u32 GetEntry() const { return e_entry; } + bool IsLittleEndian() const + { + return e_data == 1; + } + bool CheckMagic() const + { + return e_magic == 0x7F454C46; + } + u32 GetEntry() const + { + return e_entry; + } }; struct Elf32_Shdr @@ -306,31 +314,37 @@ struct Elf32_Phdr struct Elf64_Ehdr { - //u8 e_ident[16]; // ELF identification + // u8 e_ident[16]; // ELF identification u32 e_magic; u8 e_class; u8 e_data; u8 e_curver; u8 e_os_abi; u64 e_abi_ver; - u16 e_type; // object file type - u16 e_machine; // machine type - u32 e_version; // object file version - u64 e_entry; // entry point address - u64 e_phoff; // program header offset - u64 e_shoff; // section header offset - u32 e_flags; // processor-specific flags - u16 e_ehsize; // ELF header size - u16 e_phentsize; // size of program header entry - u16 e_phnum; // number of program header entries - u16 e_shentsize; // size of section header entry - u16 e_shnum; // number of section header entries - u16 e_shstrndx; // section name string table index + u16 e_type; // object file type + u16 e_machine; // machine type + u32 e_version; // object file version + u64 e_entry; // entry point address + u64 e_phoff; // program header offset + u64 e_shoff; // section header offset + u32 e_flags; // processor-specific flags + u16 e_ehsize; // ELF header size + u16 e_phentsize; // size of program header entry + u16 e_phnum; // number of program header entries + u16 e_shentsize; // size of section header entry + u16 e_shnum; // number of section header entries + u16 e_shstrndx; // section name string table index void Load(const fs::file& f); static void Show() {} - bool CheckMagic() const { return e_magic == 0x7F454C46; } - u64 GetEntry() const { return e_entry; } + bool CheckMagic() const + { + return e_magic == 0x7F454C46; + } + u64 GetEntry() const + { + return e_entry; + } }; struct Elf64_Shdr @@ -347,7 +361,7 @@ struct Elf64_Shdr u64 sh_entsize; // size of entries, if section has table void Load(const fs::file& f); - static void Show(){} + static void Show() {} }; struct Elf64_Phdr @@ -362,7 +376,7 @@ struct Elf64_Phdr u64 p_align; // Segment alignment void Load(const fs::file& f); - static void Show(){} + static void Show() {} }; struct SceHeader @@ -376,8 +390,11 @@ struct SceHeader u64 se_esize; void Load(const fs::file& f); - static void Show(){} - bool CheckMagic() const { return se_magic == 0x53434500; } + static void Show() {} + bool CheckMagic() const + { + return se_magic == 0x53434500; + } }; struct ext_hdr @@ -394,7 +411,7 @@ struct ext_hdr u64 padding; void Load(const fs::file& f); - static void Show(){} + static void Show() {} }; struct SelfAdditionalInfo @@ -478,12 +495,12 @@ public: void ShowHeaders(bool isElf32); bool LoadMetadata(const u8* klic_key); bool DecryptData(); - bool DecryptNPDRM(u8 *metadata, u32 metadata_size); + bool DecryptNPDRM(u8* metadata, u32 metadata_size); const NPD_HEADER* GetNPDHeader() const; - static bool GetKeyFromRap(const char *content_id, u8 *npdrm_key); + static bool GetKeyFromRap(const char* content_id, u8* npdrm_key); private: - template + template void WriteElf(fs::file& e, EHdr ehdr, SHdr shdr, PHdr phdr) { // Set initial offset. diff --git a/rpcs3/rpcs3/Crypto/unzip.cpp b/rpcs3/rpcs3/Crypto/unzip.cpp index 6485e4d94..2de74313e 100644 --- a/rpcs3/rpcs3/Crypto/unzip.cpp +++ b/rpcs3/rpcs3/Crypto/unzip.cpp @@ -30,7 +30,7 @@ std::vector unzip(const void* src, usz size) zs.avail_in = static_cast(size); zs.next_in = reinterpret_cast(src); zs.avail_out = static_cast(out.size()); - zs.next_out = out.data(); + zs.next_out = out.data(); while (zs.avail_in) { diff --git a/rpcs3/rpcs3/Crypto/utils.cpp b/rpcs3/rpcs3/Crypto/utils.cpp index 1858fb1fa..4cab23071 100644 --- a/rpcs3/rpcs3/Crypto/utils.cpp +++ b/rpcs3/rpcs3/Crypto/utils.cpp @@ -31,11 +31,11 @@ u64 hex_to_u64(const char* hex_str) while (length--) { c = *hex_str++; - if((c >= '0') && (c <= '9')) + if ((c >= '0') && (c <= '9')) tmp = c - '0'; - else if((c >= 'a') && (c <= 'f')) + else if ((c >= 'a') && (c <= 'f')) tmp = c - 'a' + 10; - else if((c >= 'A') && (c <= 'F')) + else if ((c >= 'A') && (c <= 'F')) tmp = c - 'A' + 10; else tmp = 0; @@ -64,9 +64,8 @@ void hex_to_bytes(unsigned char* data, const char* hex_str, unsigned int str_len } } - // Crypto functions (AES128-CBC, AES128-ECB, SHA1-HMAC and AES-CMAC). -void aescbc128_decrypt(unsigned char *key, unsigned char *iv, unsigned char *in, unsigned char *out, usz len) +void aescbc128_decrypt(unsigned char* key, unsigned char* iv, unsigned char* in, unsigned char* out, usz len) { aes_context ctx; aes_setkey_dec(&ctx, key, 128); @@ -76,7 +75,7 @@ void aescbc128_decrypt(unsigned char *key, unsigned char *iv, unsigned char *in, memset(iv, 0, 0x10); } -void aescbc128_encrypt(unsigned char *key, unsigned char *iv, unsigned char *in, unsigned char *out, usz len) +void aescbc128_encrypt(unsigned char* key, unsigned char* iv, unsigned char* in, unsigned char* out, usz len) { aes_context ctx; aes_setkey_enc(&ctx, key, 128); @@ -86,14 +85,14 @@ void aescbc128_encrypt(unsigned char *key, unsigned char *iv, unsigned char *in, memset(iv, 0, 0x10); } -void aesecb128_encrypt(unsigned char *key, unsigned char *in, unsigned char *out) +void aesecb128_encrypt(unsigned char* key, unsigned char* in, unsigned char* out) { aes_context ctx; aes_setkey_enc(&ctx, key, 128); aes_crypt_ecb(&ctx, AES_ENCRYPT, in, out); } -bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, usz in_len, unsigned char *hash, usz hash_len) +bool hmac_hash_compare(unsigned char* key, int key_len, unsigned char* in, usz in_len, unsigned char* hash, usz hash_len) { const std::unique_ptr out(new u8[key_len]); @@ -102,12 +101,12 @@ bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, usz i return std::memcmp(out.get(), hash, hash_len) == 0; } -void hmac_hash_forge(unsigned char *key, int key_len, unsigned char *in, usz in_len, unsigned char *hash) +void hmac_hash_forge(unsigned char* key, int key_len, unsigned char* in, usz in_len, unsigned char* hash) { sha1_hmac(key, key_len, in, in_len, hash); } -bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, usz in_len, unsigned char *hash, usz hash_len) +bool cmac_hash_compare(unsigned char* key, int key_len, unsigned char* in, usz in_len, unsigned char* hash, usz hash_len) { const std::unique_ptr out(new u8[key_len]); @@ -118,7 +117,7 @@ bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, usz i return std::memcmp(out.get(), hash, hash_len) == 0; } -void cmac_hash_forge(unsigned char *key, int /*key_len*/, unsigned char *in, usz in_len, unsigned char *hash) +void cmac_hash_forge(unsigned char* key, int /*key_len*/, unsigned char* in, usz in_len, unsigned char* hash) { aes_context ctx; aes_setkey_enc(&ctx, key, 128); @@ -152,21 +151,20 @@ std::string sha256_get_hash(const char* data, usz size, bool lower_case) for (usz index = 0; index < 32; index++) { - const auto pal = lower_case ? "0123456789abcdef" : "0123456789ABCDEF"; - res_hash_string[index * 2] = pal[res_hash[index] >> 4]; + const auto pal = lower_case ? "0123456789abcdef" : "0123456789ABCDEF"; + res_hash_string[index * 2] = pal[res_hash[index] >> 4]; res_hash_string[(index * 2) + 1] = pal[res_hash[index] & 15]; } return res_hash_string; } -void mbedtls_zeroize(void *v, size_t n) +void mbedtls_zeroize(void* v, size_t n) { - static void *(*const volatile unop_memset)(void *, int, size_t) = &memset; + static void* (*const volatile unop_memset)(void*, int, size_t) = &memset; (void)unop_memset(v, 0, n); } - // SC passphrase crypto void sc_form_key(const u8* sc_key, const std::array& laid_paid, u8* key) @@ -229,7 +227,7 @@ const u8* vtrm_portability_type_mapper(int type) // No idea what this type stands for switch (type) { - //case 0: return key_for_type_1; + // case 0: return key_for_type_1; case 1: return SC_ISO_SERIES_KEY_2; case 2: return SC_ISO_SERIES_KEY_1; case 3: return SC_KEY_FOR_MASTER_2; diff --git a/rpcs3/rpcs3/Crypto/utils.h b/rpcs3/rpcs3/Crypto/utils.h index 25cdeb719..27712e159 100644 --- a/rpcs3/rpcs3/Crypto/utils.h +++ b/rpcs3/rpcs3/Crypto/utils.h @@ -8,7 +8,10 @@ #include -enum { CRYPTO_MAX_PATH = 4096 }; +enum +{ + CRYPTO_MAX_PATH = 4096 +}; char* extract_file_name(const char* file_path, char real_file_name[CRYPTO_MAX_PATH]); @@ -16,17 +19,17 @@ std::string sha256_get_hash(const char* data, usz size, bool lower_case); // Hex string conversion auxiliary functions. u64 hex_to_u64(const char* hex_str); -void hex_to_bytes(unsigned char *data, const char *hex_str, unsigned int str_length); +void hex_to_bytes(unsigned char* data, const char* hex_str, unsigned int str_length); // Crypto functions (AES128-CBC, AES128-ECB, SHA1-HMAC and AES-CMAC). -void aescbc128_decrypt(unsigned char *key, unsigned char *iv, unsigned char *in, unsigned char *out, usz len); -void aescbc128_encrypt(unsigned char *key, unsigned char *iv, unsigned char *in, unsigned char *out, usz len); -void aesecb128_encrypt(unsigned char *key, unsigned char *in, unsigned char *out); -bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, usz in_len, unsigned char *hash, usz hash_len); -void hmac_hash_forge(unsigned char *key, int key_len, unsigned char *in, usz in_len, unsigned char *hash); -bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, usz in_len, unsigned char *hash, usz hash_len); -void cmac_hash_forge(unsigned char *key, int key_len, unsigned char *in, usz in_len, unsigned char *hash); -void mbedtls_zeroize(void *v, size_t n); +void aescbc128_decrypt(unsigned char* key, unsigned char* iv, unsigned char* in, unsigned char* out, usz len); +void aescbc128_encrypt(unsigned char* key, unsigned char* iv, unsigned char* in, unsigned char* out, usz len); +void aesecb128_encrypt(unsigned char* key, unsigned char* in, unsigned char* out); +bool hmac_hash_compare(unsigned char* key, int key_len, unsigned char* in, usz in_len, unsigned char* hash, usz hash_len); +void hmac_hash_forge(unsigned char* key, int key_len, unsigned char* in, usz in_len, unsigned char* hash); +bool cmac_hash_compare(unsigned char* key, int key_len, unsigned char* in, usz in_len, unsigned char* hash, usz hash_len); +void cmac_hash_forge(unsigned char* key, int key_len, unsigned char* in, usz in_len, unsigned char* hash); +void mbedtls_zeroize(void* v, size_t n); // SC passphrase crypto diff --git a/rpcs3/rpcs3/Emu/Audio/AudioBackend.h b/rpcs3/rpcs3/Emu/Audio/AudioBackend.h index cbd8e045c..062b22305 100644 --- a/rpcs3/rpcs3/Emu/Audio/AudioBackend.h +++ b/rpcs3/rpcs3/Emu/Audio/AudioBackend.h @@ -17,11 +17,11 @@ enum : u32 enum class AudioFreq : u32 { - FREQ_32K = 32000, - FREQ_44K = 44100, - FREQ_48K = 48000, - FREQ_88K = 88200, - FREQ_96K = 96000, + FREQ_32K = 32000, + FREQ_44K = 44100, + FREQ_48K = 48000, + FREQ_88K = 88200, + FREQ_96K = 96000, FREQ_176K = 176400, FREQ_192K = 192000, }; @@ -35,7 +35,7 @@ enum class AudioSampleSize : u32 // This enum is only used for emulation enum class AudioChannelCnt : u32 { - STEREO = 2, + STEREO = 2, SURROUND_5_1 = 6, SURROUND_7_1 = 8, }; @@ -49,7 +49,6 @@ enum class AudioStateEvent : u32 class AudioBackend { public: - struct VolumeParam { f32 initial_volume = 1.0f; @@ -93,7 +92,10 @@ public: virtual f64 GetCallbackFrameLen() = 0; // Returns true if audio is currently being played, false otherwise. Reflects end result of Play() and Pause() calls. - virtual bool IsPlaying() { return m_playing; } + virtual bool IsPlaying() + { + return m_playing; + } // Start playing enqueued data. virtual void Play() = 0; @@ -105,17 +107,26 @@ public: * This virtual method should be reimplemented if backend can fail to be initialized under non-error conditions * eg. when there is no audio devices attached */ - virtual bool Initialized() { return true; } + virtual bool Initialized() + { + return true; + } /* * This virtual method should be reimplemented if backend can fail during normal operation */ - virtual bool Operational() { return true; } + virtual bool Operational() + { + return true; + } /* * This virtual method should be reimplemented if backend can report device changes */ - virtual bool DefaultDeviceChanged() { return false; } + virtual bool DefaultDeviceChanged() + { + return false; + } /* * Helper methods @@ -180,20 +191,21 @@ public: /* * Downmix audio stream. */ - template + template static void downmix(u32 sample_cnt, const f32* src, f32* dst) { const u32 dst_ch_cnt = default_layout_channel_count(dst_layout); - if (static_cast(src_ch_cnt) <= dst_ch_cnt) fmt::throw_exception("src channel count must be bigger than dst channel count"); + if (static_cast(src_ch_cnt) <= dst_ch_cnt) + fmt::throw_exception("src channel count must be bigger than dst channel count"); static constexpr f32 center_coef = std::numbers::sqrt2_v / 2; static constexpr f32 surround_coef = std::numbers::sqrt2_v / 2; for (u32 src_sample = 0, dst_sample = 0; src_sample < sample_cnt; src_sample += static_cast(src_ch_cnt), dst_sample += dst_ch_cnt) { - const f32 left = src[src_sample + 0]; + const f32 left = src[src_sample + 0]; const f32 right = src[src_sample + 1]; - + if constexpr (src_ch_cnt == AudioChannelCnt::STEREO) { if constexpr (dst_layout == audio_channel_layout::mono) @@ -203,9 +215,9 @@ public: } else if constexpr (src_ch_cnt == AudioChannelCnt::SURROUND_5_1) { - const f32 center = src[src_sample + 2]; - const f32 low_freq = src[src_sample + 3]; - const f32 side_left = src[src_sample + 4]; + const f32 center = src[src_sample + 2]; + const f32 low_freq = src[src_sample + 3]; + const f32 side_left = src[src_sample + 4]; const f32 side_right = src[src_sample + 5]; if constexpr (dst_layout == audio_channel_layout::quadraphonic || dst_layout == audio_channel_layout::quadraphonic_lfe) @@ -239,11 +251,11 @@ public: } else if constexpr (src_ch_cnt == AudioChannelCnt::SURROUND_7_1) { - const f32 center = src[src_sample + 2]; - const f32 low_freq = src[src_sample + 3]; - const f32 rear_left = src[src_sample + 4]; + const f32 center = src[src_sample + 2]; + const f32 low_freq = src[src_sample + 3]; + const f32 rear_left = src[src_sample + 4]; const f32 rear_right = src[src_sample + 5]; - const f32 side_left = src[src_sample + 6]; + const f32 side_left = src[src_sample + 6]; const f32 side_right = src[src_sample + 7]; if constexpr (dst_layout == audio_channel_layout::surround_5_1) @@ -372,12 +384,12 @@ protected: void setup_channel_layout(u32 input_channel_count, u32 output_channel_count, audio_channel_layout layout, logs::channel& log); AudioSampleSize m_sample_size = AudioSampleSize::FLOAT; - AudioFreq m_sampling_rate = AudioFreq::FREQ_48K; - u32 m_channels = 2; + AudioFreq m_sampling_rate = AudioFreq::FREQ_48K; + u32 m_channels = 2; audio_channel_layout m_layout = audio_channel_layout::automatic; std::timed_mutex m_cb_mutex{}; - std::function m_write_callback{}; + std::function m_write_callback{}; shared_mutex m_state_cb_mutex{}; std::function m_state_callback{}; @@ -385,6 +397,5 @@ protected: bool m_playing = false; private: - static constexpr f32 VOLUME_CHANGE_DURATION = 0.016f; // sec }; diff --git a/rpcs3/rpcs3/Emu/Audio/AudioDumper.h b/rpcs3/rpcs3/Emu/Audio/AudioDumper.h index 1fff1352b..0bea072e0 100644 --- a/rpcs3/rpcs3/Emu/Audio/AudioDumper.h +++ b/rpcs3/rpcs3/Emu/Audio/AudioDumper.h @@ -8,9 +8,9 @@ struct WAVHeader { struct RIFFHeader { - u8 ID[4] = { 'R', 'I', 'F', 'F' }; + u8 ID[4] = {'R', 'I', 'F', 'F'}; le_t Size{}; // FileSize - 8 - u8 WAVE[4] = { 'W', 'A', 'V', 'E' }; + u8 WAVE[4] = {'W', 'A', 'V', 'E'}; RIFFHeader() = default; @@ -22,31 +22,26 @@ struct WAVHeader struct FMTHeader { - u8 ID[4] = { 'f', 'm', 't', ' ' }; + u8 ID[4] = {'f', 'm', 't', ' '}; le_t Size = 16; - le_t AudioFormat{}; // 1 for PCM, 3 for IEEE Floating Point - le_t NumChannels{}; // 1, 2, 6, 8 - le_t SampleRate{}; // 44100-192000 - le_t ByteRate{}; // SampleRate * NumChannels * BitsPerSample/8 - le_t BlockAlign{}; // NumChannels * BitsPerSample/8 + le_t AudioFormat{}; // 1 for PCM, 3 for IEEE Floating Point + le_t NumChannels{}; // 1, 2, 6, 8 + le_t SampleRate{}; // 44100-192000 + le_t ByteRate{}; // SampleRate * NumChannels * BitsPerSample/8 + le_t BlockAlign{}; // NumChannels * BitsPerSample/8 le_t BitsPerSample{}; // SampleSize * 8 FMTHeader() = default; FMTHeader(AudioChannelCnt ch, AudioFreq sample_rate, AudioSampleSize sample_size) - : AudioFormat(sample_size == AudioSampleSize::FLOAT ? 3 : 1) - , NumChannels(static_cast(ch)) - , SampleRate(static_cast(sample_rate)) - , ByteRate(SampleRate * NumChannels * static_cast(sample_size)) - , BlockAlign(NumChannels * static_cast(sample_size)) - , BitsPerSample(static_cast(sample_size) * 8) + : AudioFormat(sample_size == AudioSampleSize::FLOAT ? 3 : 1), NumChannels(static_cast(ch)), SampleRate(static_cast(sample_rate)), ByteRate(SampleRate * NumChannels * static_cast(sample_size)), BlockAlign(NumChannels * static_cast(sample_size)), BitsPerSample(static_cast(sample_size) * 8) { } } FMT; struct FACTChunk { - u8 ID[4] = { 'f', 'a', 'c', 't' }; + u8 ID[4] = {'f', 'a', 'c', 't'}; le_t ChunkLength = 4; le_t SampleLength = 0; // total samples per channel @@ -58,16 +53,13 @@ struct WAVHeader } } FACT; - u8 ID[4] = { 'd', 'a', 't', 'a' }; + u8 ID[4] = {'d', 'a', 't', 'a'}; le_t Size{}; // size of data (256 * NumChannels * sizeof(f32)) WAVHeader() = default; WAVHeader(AudioChannelCnt ch, AudioFreq sample_rate, AudioSampleSize sample_size) - : RIFF(sizeof(RIFFHeader) + sizeof(FMTHeader)) - , FMT(ch, sample_rate, sample_size) - , FACT(0) - , Size(0) + : RIFF(sizeof(RIFFHeader) + sizeof(FMTHeader)), FMT(ch, sample_rate, sample_size), FACT(0), Size(0) { } }; @@ -85,6 +77,12 @@ public: void Close(); void WriteData(const void* buffer, u32 size); - u16 GetCh() const { return m_header.FMT.NumChannels; } - u16 GetSampleSize() const { return m_header.FMT.BitsPerSample / 8; } + u16 GetCh() const + { + return m_header.FMT.NumChannels; + } + u16 GetSampleSize() const + { + return m_header.FMT.BitsPerSample / 8; + } }; diff --git a/rpcs3/rpcs3/Emu/Audio/Cubeb/CubebBackend.cpp b/rpcs3/rpcs3/Emu/Audio/Cubeb/CubebBackend.cpp index dbaf4aa8d..a39bad5e7 100644 --- a/rpcs3/rpcs3/Emu/Audio/Cubeb/CubebBackend.cpp +++ b/rpcs3/rpcs3/Emu/Audio/Cubeb/CubebBackend.cpp @@ -6,7 +6,7 @@ #include "Emu/Audio/audio_device_enumerator.h" #ifdef _WIN32 -#include +#include #include #endif @@ -23,7 +23,7 @@ CubebBackend::CubebBackend() } #endif - cubeb *ctx{}; + cubeb* ctx{}; if (int err = cubeb_init(&ctx, "RPCS3", nullptr)) { Cubeb.error("cubeb_init() failed: %i", err); @@ -112,8 +112,10 @@ bool CubebBackend::Open(std::string_view dev_id, AudioFreq freq, AudioSampleSize const bool use_default_device = dev_id.empty() || dev_id == audio_device_enumerator::DEFAULT_DEV_ID; - if (use_default_device) Cubeb.notice("Trying to open default device"); - else Cubeb.notice("Trying to open device with dev_id='%s'", dev_id); + if (use_default_device) + Cubeb.notice("Trying to open default device"); + else + Cubeb.notice("Trying to open device with dev_id='%s'", dev_id); device_handle device = GetDevice(use_default_device ? "" : dev_id); @@ -164,14 +166,14 @@ bool CubebBackend::Open(std::string_view dev_id, AudioFreq freq, AudioSampleSize { switch (m_layout) { - case audio_channel_layout::automatic: break; - case audio_channel_layout::mono: return CUBEB_LAYOUT_MONO; - case audio_channel_layout::stereo: return CUBEB_LAYOUT_STEREO; - case audio_channel_layout::stereo_lfe: return CUBEB_LAYOUT_STEREO_LFE; - case audio_channel_layout::quadraphonic: return CUBEB_LAYOUT_QUAD; + case audio_channel_layout::automatic: break; + case audio_channel_layout::mono: return CUBEB_LAYOUT_MONO; + case audio_channel_layout::stereo: return CUBEB_LAYOUT_STEREO; + case audio_channel_layout::stereo_lfe: return CUBEB_LAYOUT_STEREO_LFE; + case audio_channel_layout::quadraphonic: return CUBEB_LAYOUT_QUAD; case audio_channel_layout::quadraphonic_lfe: return CUBEB_LAYOUT_QUAD_LFE; - case audio_channel_layout::surround_5_1: return CUBEB_LAYOUT_3F2_LFE; - case audio_channel_layout::surround_7_1: return CUBEB_LAYOUT_3F4_LFE; + case audio_channel_layout::surround_5_1: return CUBEB_LAYOUT_3F2_LFE; + case audio_channel_layout::surround_7_1: return CUBEB_LAYOUT_3F4_LFE; } fmt::throw_exception("Invalid audio layout %d", static_cast(m_layout)); @@ -240,7 +242,8 @@ void CubebBackend::Play() return; } - if (m_playing) return; + if (m_playing) + return; std::lock_guard lock(m_cb_mutex); m_playing = true; @@ -254,7 +257,8 @@ void CubebBackend::Pause() return; } - if (!m_playing) return; + if (!m_playing) + return; std::lock_guard lock(m_cb_mutex); m_playing = false; @@ -283,8 +287,10 @@ CubebBackend::device_handle CubebBackend::GetDevice(std::string_view dev_id) { const bool default_dev = dev_id.empty(); - if (default_dev) Cubeb.notice("Searching for default device"); - else Cubeb.notice("Searching for device with dev_id='%s'", dev_id); + if (default_dev) + Cubeb.notice("Searching for default device"); + else + Cubeb.notice("Searching for device with dev_id='%s'", dev_id); cubeb_device_collection dev_collection{}; if (int err = cubeb_enumerate_devices(m_ctx, CUBEB_DEVICE_TYPE_OUTPUT, &dev_collection)) @@ -363,13 +369,12 @@ CubebBackend::device_handle CubebBackend::GetDefaultDeviceAlt(AudioFreq freq, Au Cubeb.notice("Starting alternative search for default device with freq=%d, sample_size=%d and ch_cnt=%d", static_cast(freq), static_cast(sample_size), static_cast(ch_cnt)); cubeb_stream_params param = - { - .format = sample_size == AudioSampleSize::S16 ? CUBEB_SAMPLE_S16NE : CUBEB_SAMPLE_FLOAT32NE, - .rate = static_cast(freq), - .channels = static_cast(ch_cnt), - .layout = CUBEB_LAYOUT_UNDEFINED, - .prefs = CUBEB_STREAM_PREF_DISABLE_DEVICE_SWITCHING - }; + { + .format = sample_size == AudioSampleSize::S16 ? CUBEB_SAMPLE_S16NE : CUBEB_SAMPLE_FLOAT32NE, + .rate = static_cast(freq), + .channels = static_cast(ch_cnt), + .layout = CUBEB_LAYOUT_UNDEFINED, + .prefs = CUBEB_STREAM_PREF_DISABLE_DEVICE_SWITCHING}; u32 min_latency{}; if (int err = cubeb_get_min_latency(m_ctx, ¶m, &min_latency)) @@ -379,7 +384,10 @@ CubebBackend::device_handle CubebBackend::GetDefaultDeviceAlt(AudioFreq freq, Au } cubeb_stream* tmp_stream{}; - static auto dummy_data_cb = [](cubeb_stream*, void*, void const*, void*, long) -> long { return 0; }; + static auto dummy_data_cb = [](cubeb_stream*, void*, void const*, void*, long) -> long + { + return 0; + }; static auto dummy_state_cb = [](cubeb_stream*, void*, cubeb_state) {}; if (int err = cubeb_stream_init(m_ctx, &tmp_stream, "Default device detector", nullptr, nullptr, nullptr, ¶m, min_latency, dummy_data_cb, dummy_state_cb, nullptr)) diff --git a/rpcs3/rpcs3/Emu/Audio/Cubeb/CubebBackend.h b/rpcs3/rpcs3/Emu/Audio/Cubeb/CubebBackend.h index 1f230ec23..cf3a97825 100644 --- a/rpcs3/rpcs3/Emu/Audio/Cubeb/CubebBackend.h +++ b/rpcs3/rpcs3/Emu/Audio/Cubeb/CubebBackend.h @@ -14,7 +14,10 @@ public: CubebBackend(const CubebBackend&) = delete; CubebBackend& operator=(const CubebBackend&) = delete; - std::string_view GetName() const override { return "Cubeb"sv; } + std::string_view GetName() const override + { + return "Cubeb"sv; + } bool Initialized() override; bool Operational() override; @@ -51,7 +54,7 @@ private: static long data_cb(cubeb_stream* stream, void* user_ptr, void const* input_buffer, void* output_buffer, long nframes); static void state_cb(cubeb_stream* stream, void* user_ptr, cubeb_state state); static void device_collection_changed_cb(cubeb* context, void* user_ptr); - static void log_cb(const char *fmt, ...); + static void log_cb(const char* fmt, ...); struct device_handle { diff --git a/rpcs3/rpcs3/Emu/Audio/Cubeb/cubeb_enumerator.cpp b/rpcs3/rpcs3/Emu/Audio/Cubeb/cubeb_enumerator.cpp index c669d0e87..f4d516c84 100644 --- a/rpcs3/rpcs3/Emu/Audio/Cubeb/cubeb_enumerator.cpp +++ b/rpcs3/rpcs3/Emu/Audio/Cubeb/cubeb_enumerator.cpp @@ -3,7 +3,7 @@ #include #ifdef _WIN32 -#include +#include #include #endif @@ -78,11 +78,10 @@ std::vector cubeb_enumerator::get_output_ } audio_device dev = - { - .id = std::string{dev_info.device_id}, - .name = std::string{dev_info.friendly_name}, - .max_ch = dev_info.max_channels - }; + { + .id = std::string{dev_info.device_id}, + .name = std::string{dev_info.friendly_name}, + .max_ch = dev_info.max_channels}; if (dev.id.empty()) { @@ -105,9 +104,9 @@ std::vector cubeb_enumerator::get_output_ } std::sort(device_list.begin(), device_list.end(), [](const audio_device_enumerator::audio_device& a, const audio_device_enumerator::audio_device& b) - { - return a.name < b.name; - }); + { + return a.name < b.name; + }); return device_list; } diff --git a/rpcs3/rpcs3/Emu/Audio/Cubeb/cubeb_enumerator.h b/rpcs3/rpcs3/Emu/Audio/Cubeb/cubeb_enumerator.h index 586521028..eb5b1cb83 100644 --- a/rpcs3/rpcs3/Emu/Audio/Cubeb/cubeb_enumerator.h +++ b/rpcs3/rpcs3/Emu/Audio/Cubeb/cubeb_enumerator.h @@ -7,14 +7,12 @@ class cubeb_enumerator final : public audio_device_enumerator { public: - cubeb_enumerator(); ~cubeb_enumerator() override; std::vector get_output_devices() override; private: - cubeb* ctx{}; #ifdef _WIN32 bool com_init_success = false; diff --git a/rpcs3/rpcs3/Emu/Audio/FAudio/FAudioBackend.cpp b/rpcs3/rpcs3/Emu/Audio/FAudio/FAudioBackend.cpp index d0e5728b2..9d6099ec1 100644 --- a/rpcs3/rpcs3/Emu/Audio/FAudio/FAudioBackend.cpp +++ b/rpcs3/rpcs3/Emu/Audio/FAudio/FAudioBackend.cpp @@ -13,7 +13,7 @@ LOG_CHANNEL(FAudio_, "FAudio"); FAudioBackend::FAudioBackend() : AudioBackend() { - FAudio *instance; + FAudio* instance; if (u32 res = FAudioCreate(&instance, 0, FAUDIO_DEFAULT_PROCESSOR)) { @@ -54,7 +54,8 @@ void FAudioBackend::Play() return; } - if (m_playing) return; + if (m_playing) + return; std::lock_guard lock(m_cb_mutex); m_playing = true; @@ -68,7 +69,8 @@ void FAudioBackend::Pause() return; } - if (!m_playing) return; + if (!m_playing) + return; { std::lock_guard lock(m_cb_mutex); @@ -231,9 +233,9 @@ f64 FAudioBackend::GetCallbackFrameLen() return std::max(min_latency, _10ms); } -void FAudioBackend::OnVoiceProcessingPassStart_func(FAudioVoiceCallback *cb_obj, u32 BytesRequired) +void FAudioBackend::OnVoiceProcessingPassStart_func(FAudioVoiceCallback* cb_obj, u32 BytesRequired) { - FAudioBackend *faudio = static_cast(cb_obj); + FAudioBackend* faudio = static_cast(cb_obj); std::unique_lock lock(faudio->m_cb_mutex, std::defer_lock); if (BytesRequired && !faudio->m_reset_req.observe() && lock.try_lock_for(std::chrono::microseconds{50}) && faudio->m_write_callback && faudio->m_playing) @@ -262,11 +264,11 @@ void FAudioBackend::OnVoiceProcessingPassStart_func(FAudioVoiceCallback *cb_obj, } } -void FAudioBackend::OnCriticalError_func(FAudioEngineCallback *cb_obj, u32 Error) +void FAudioBackend::OnCriticalError_func(FAudioEngineCallback* cb_obj, u32 Error) { FAudio_.error("OnCriticalError() failed(0x%08x)", Error); - FAudioBackend *faudio = static_cast(cb_obj); + FAudioBackend* faudio = static_cast(cb_obj); std::lock_guard lock(faudio->m_state_cb_mutex); diff --git a/rpcs3/rpcs3/Emu/Audio/FAudio/FAudioBackend.h b/rpcs3/rpcs3/Emu/Audio/FAudio/FAudioBackend.h index 734f56156..d00bfd9e5 100644 --- a/rpcs3/rpcs3/Emu/Audio/FAudio/FAudioBackend.h +++ b/rpcs3/rpcs3/Emu/Audio/FAudio/FAudioBackend.h @@ -17,7 +17,10 @@ public: FAudioBackend(const FAudioBackend&) = delete; FAudioBackend& operator=(const FAudioBackend&) = delete; - std::string_view GetName() const override { return "FAudio"sv; } + std::string_view GetName() const override + { + return "FAudio"sv; + } bool Initialized() override; bool Operational() override; @@ -43,10 +46,10 @@ private: atomic_t m_reset_req = false; // FAudio voice callbacks - static void OnVoiceProcessingPassStart_func(FAudioVoiceCallback *cb_obj, u32 BytesRequired); + static void OnVoiceProcessingPassStart_func(FAudioVoiceCallback* cb_obj, u32 BytesRequired); // FAudio engine callbacks - static void OnCriticalError_func(FAudioEngineCallback *cb_obj, u32 Error); + static void OnCriticalError_func(FAudioEngineCallback* cb_obj, u32 Error); void CloseUnlocked(); }; diff --git a/rpcs3/rpcs3/Emu/Audio/FAudio/faudio_enumerator.cpp b/rpcs3/rpcs3/Emu/Audio/FAudio/faudio_enumerator.cpp index fdbfd2a6a..0eff57e8a 100644 --- a/rpcs3/rpcs3/Emu/Audio/FAudio/faudio_enumerator.cpp +++ b/rpcs3/rpcs3/Emu/Audio/FAudio/faudio_enumerator.cpp @@ -11,7 +11,7 @@ LOG_CHANNEL(faudio_dev_enum); faudio_enumerator::faudio_enumerator() : audio_device_enumerator() { - FAudio *tmp{}; + FAudio* tmp{}; if (u32 res = FAudioCreate(&tmp, 0, FAUDIO_DEFAULT_PROCESSOR)) { @@ -65,11 +65,10 @@ std::vector faudio_enumerator::get_output } audio_device dev = - { - .id = std::to_string(dev_idx), - .name = utf16_to_utf8(std::bit_cast(&dev_info.DisplayName[0])), - .max_ch = dev_info.OutputFormat.Format.nChannels - }; + { + .id = std::to_string(dev_idx), + .name = utf16_to_utf8(std::bit_cast(&dev_info.DisplayName[0])), + .max_ch = dev_info.OutputFormat.Format.nChannels}; if (dev.name.empty()) { @@ -81,9 +80,9 @@ std::vector faudio_enumerator::get_output } std::sort(device_list.begin(), device_list.end(), [](audio_device_enumerator::audio_device a, audio_device_enumerator::audio_device b) - { - return a.name < b.name; - }); + { + return a.name < b.name; + }); return device_list; } diff --git a/rpcs3/rpcs3/Emu/Audio/FAudio/faudio_enumerator.h b/rpcs3/rpcs3/Emu/Audio/FAudio/faudio_enumerator.h index 406bfa09a..4f572aa70 100644 --- a/rpcs3/rpcs3/Emu/Audio/FAudio/faudio_enumerator.h +++ b/rpcs3/rpcs3/Emu/Audio/FAudio/faudio_enumerator.h @@ -10,13 +10,11 @@ class faudio_enumerator final : public audio_device_enumerator { public: - faudio_enumerator(); ~faudio_enumerator() override; std::vector get_output_devices() override; private: - FAudio* instance{}; }; diff --git a/rpcs3/rpcs3/Emu/Audio/Null/NullAudioBackend.h b/rpcs3/rpcs3/Emu/Audio/Null/NullAudioBackend.h index abb78ff46..a5f9b7c06 100644 --- a/rpcs3/rpcs3/Emu/Audio/Null/NullAudioBackend.h +++ b/rpcs3/rpcs3/Emu/Audio/Null/NullAudioBackend.h @@ -8,20 +8,38 @@ public: NullAudioBackend() {} ~NullAudioBackend() {} - std::string_view GetName() const override { return "Null"sv; } + std::string_view GetName() const override + { + return "Null"sv; + } bool Open(std::string_view /* dev_id */, AudioFreq /* freq */, AudioSampleSize /* sample_size */, AudioChannelCnt /* ch_cnt */, audio_channel_layout /*layout*/) override { Close(); return true; } - void Close() override { m_playing = false; } + void Close() override + { + m_playing = false; + } - f64 GetCallbackFrameLen() override { return 0.01; }; + f64 GetCallbackFrameLen() override + { + return 0.01; + }; - void Play() override { m_playing = true; } - void Pause() override { m_playing = false; } - bool IsPlaying() override { return m_playing; } + void Play() override + { + m_playing = true; + } + void Pause() override + { + m_playing = false; + } + bool IsPlaying() override + { + return m_playing; + } private: bool m_playing = false; diff --git a/rpcs3/rpcs3/Emu/Audio/Null/null_enumerator.h b/rpcs3/rpcs3/Emu/Audio/Null/null_enumerator.h index 9a889cdce..4014c133e 100644 --- a/rpcs3/rpcs3/Emu/Audio/Null/null_enumerator.h +++ b/rpcs3/rpcs3/Emu/Audio/Null/null_enumerator.h @@ -5,9 +5,11 @@ class null_enumerator final : public audio_device_enumerator { public: - null_enumerator() {}; ~null_enumerator() override {}; - std::vector get_output_devices() override { return {}; } + std::vector get_output_devices() override + { + return {}; + } }; diff --git a/rpcs3/rpcs3/Emu/Audio/XAudio2/XAudio2Backend.cpp b/rpcs3/rpcs3/Emu/Audio/XAudio2/XAudio2Backend.cpp index 0a84d747b..32af4d494 100644 --- a/rpcs3/rpcs3/Emu/Audio/XAudio2/XAudio2Backend.cpp +++ b/rpcs3/rpcs3/Emu/Audio/XAudio2/XAudio2Backend.cpp @@ -9,7 +9,7 @@ #include "Utilities/StrUtil.h" #include "XAudio2Backend.h" -#include +#include #include #ifndef XAUDIO2_USE_DEFAULT_PROCESSOR @@ -22,34 +22,34 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto value) - { - switch (value) { - case eConsole: return "eConsole"; - case eMultimedia: return "eMultimedia"; - case eCommunications: return "eCommunications"; - case ERole_enum_count: return unknown; - } + switch (value) + { + case eConsole: return "eConsole"; + case eMultimedia: return "eMultimedia"; + case eCommunications: return "eCommunications"; + case ERole_enum_count: return unknown; + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto value) - { - switch (value) { - case eRender: return "eRender"; - case eCapture: return "eCapture"; - case eAll: return "eAll"; - case EDataFlow_enum_count: return unknown; - } + switch (value) + { + case eRender: return "eRender"; + case eCapture: return "eCapture"; + case eAll: return "eAll"; + case EDataFlow_enum_count: return unknown; + } - return unknown; - }); + return unknown; + }); } XAudio2Backend::XAudio2Backend() @@ -135,7 +135,8 @@ void XAudio2Backend::Play() return; } - if (m_playing) return; + if (m_playing) + return; std::lock_guard lock(m_cb_mutex); m_playing = true; @@ -184,7 +185,8 @@ void XAudio2Backend::Pause() return; } - if (!m_playing) return; + if (!m_playing) + return; { std::lock_guard lock(m_cb_mutex); diff --git a/rpcs3/rpcs3/Emu/Audio/XAudio2/XAudio2Backend.h b/rpcs3/rpcs3/Emu/Audio/XAudio2/XAudio2Backend.h index 0312e7f63..bb7e1fa10 100644 --- a/rpcs3/rpcs3/Emu/Audio/XAudio2/XAudio2Backend.h +++ b/rpcs3/rpcs3/Emu/Audio/XAudio2/XAudio2Backend.h @@ -20,7 +20,10 @@ public: XAudio2Backend(const XAudio2Backend&) = delete; XAudio2Backend& operator=(const XAudio2Backend&) = delete; - std::string_view GetName() const override { return "XAudio2"sv; } + std::string_view GetName() const override + { + return "XAudio2"sv; + } bool Initialized() override; bool Operational() override; @@ -68,13 +71,36 @@ private: void OnCriticalError(HRESULT Error) override; // IMMNotificationClient callbacks - IFACEMETHODIMP_(ULONG) AddRef() override { return 1; }; - IFACEMETHODIMP_(ULONG) Release() override { return 1; }; - IFACEMETHODIMP QueryInterface(REFIID /*iid*/, void** /*object*/) override { return E_NOINTERFACE; }; - IFACEMETHODIMP OnPropertyValueChanged(LPCWSTR /*device_id*/, const PROPERTYKEY /*key*/) override { return S_OK; }; - IFACEMETHODIMP OnDeviceAdded(LPCWSTR /*device_id*/) override { return S_OK; }; - IFACEMETHODIMP OnDeviceRemoved(LPCWSTR /*device_id*/) override { return S_OK; }; - IFACEMETHODIMP OnDeviceStateChanged(LPCWSTR /*device_id*/, DWORD /*new_state*/) override { return S_OK; }; + IFACEMETHODIMP_(ULONG) + AddRef() override + { + return 1; + }; + IFACEMETHODIMP_(ULONG) + Release() override + { + return 1; + }; + IFACEMETHODIMP QueryInterface(REFIID /*iid*/, void** /*object*/) override + { + return E_NOINTERFACE; + }; + IFACEMETHODIMP OnPropertyValueChanged(LPCWSTR /*device_id*/, const PROPERTYKEY /*key*/) override + { + return S_OK; + }; + IFACEMETHODIMP OnDeviceAdded(LPCWSTR /*device_id*/) override + { + return S_OK; + }; + IFACEMETHODIMP OnDeviceRemoved(LPCWSTR /*device_id*/) override + { + return S_OK; + }; + IFACEMETHODIMP OnDeviceStateChanged(LPCWSTR /*device_id*/, DWORD /*new_state*/) override + { + return S_OK; + }; IFACEMETHODIMP OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR new_default_device_id) override; void CloseUnlocked(); diff --git a/rpcs3/rpcs3/Emu/Audio/XAudio2/xaudio2_enumerator.cpp b/rpcs3/rpcs3/Emu/Audio/XAudio2/xaudio2_enumerator.cpp index e170addb0..2e8ef0cd9 100644 --- a/rpcs3/rpcs3/Emu/Audio/XAudio2/xaudio2_enumerator.cpp +++ b/rpcs3/rpcs3/Emu/Audio/XAudio2/xaudio2_enumerator.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include @@ -145,9 +145,9 @@ std::vector xaudio2_enumerator::get_outpu } std::sort(device_list.begin(), device_list.end(), [](const audio_device_enumerator::audio_device& a, const audio_device_enumerator::audio_device& b) - { - return a.name < b.name; - }); + { + return a.name < b.name; + }); return device_list; } diff --git a/rpcs3/rpcs3/Emu/Audio/XAudio2/xaudio2_enumerator.h b/rpcs3/rpcs3/Emu/Audio/XAudio2/xaudio2_enumerator.h index e96e3fe9b..81f3cc19a 100644 --- a/rpcs3/rpcs3/Emu/Audio/XAudio2/xaudio2_enumerator.h +++ b/rpcs3/rpcs3/Emu/Audio/XAudio2/xaudio2_enumerator.h @@ -9,7 +9,6 @@ class xaudio2_enumerator final : public audio_device_enumerator { public: - xaudio2_enumerator(); ~xaudio2_enumerator() override; diff --git a/rpcs3/rpcs3/Emu/Audio/audio_device_enumerator.h b/rpcs3/rpcs3/Emu/Audio/audio_device_enumerator.h index 6c81dedee..3e4b1615a 100644 --- a/rpcs3/rpcs3/Emu/Audio/audio_device_enumerator.h +++ b/rpcs3/rpcs3/Emu/Audio/audio_device_enumerator.h @@ -7,7 +7,6 @@ class audio_device_enumerator { public: - static constexpr std::string_view DEFAULT_DEV_ID = "@@@default@@@"; struct audio_device diff --git a/rpcs3/rpcs3/Emu/Audio/audio_resampler.cpp b/rpcs3/rpcs3/Emu/Audio/audio_resampler.cpp index 32c7109b4..7e41d7ddd 100644 --- a/rpcs3/rpcs3/Emu/Audio/audio_resampler.cpp +++ b/rpcs3/rpcs3/Emu/Audio/audio_resampler.cpp @@ -4,7 +4,7 @@ audio_resampler::audio_resampler() { - resampler.setSetting(SETTING_SEQUENCE_MS, 20); // Resampler frame size (reduce latency at cost of slight sound quality degradation) + resampler.setSetting(SETTING_SEQUENCE_MS, 20); // Resampler frame size (reduce latency at cost of slight sound quality degradation) resampler.setSetting(SETTING_USE_QUICKSEEK, 1); // Use fast quick seeking algorithm (substantally reduces computation time) } @@ -35,7 +35,7 @@ std::pair audio_resampler::get_samples(u32 { // NOTE: Make sure to get the buffer first because receiveSamples advances its position internally // and std::make_pair evaluates the second parameter first... - f32 *const buf = resampler.bufBegin(); + f32* const buf = resampler.bufBegin(); return std::make_pair(buf, resampler.receiveSamples(sample_cnt)); } diff --git a/rpcs3/rpcs3/Emu/Audio/audio_utils.cpp b/rpcs3/rpcs3/Emu/Audio/audio_utils.cpp index bcff7bf94..079543150 100644 --- a/rpcs3/rpcs3/Emu/Audio/audio_utils.cpp +++ b/rpcs3/rpcs3/Emu/Audio/audio_utils.cpp @@ -24,16 +24,18 @@ namespace audio void change_volume(s32 delta) { // Ignore if muted - if (g_fxo->get().audio_muted) return; + if (g_fxo->get().audio_muted) + return; const s32 old_volume = g_cfg.audio.volume; const s32 new_volume = old_volume + delta; - if (old_volume == new_volume) return; + if (old_volume == new_volume) + return; g_cfg.audio.volume.set(std::clamp(new_volume, g_cfg.audio.volume.min, g_cfg.audio.volume.max)); Emu.GetCallbacks().update_emu_settings(); rsx::overlays::queue_message(get_localized_string(localized_string_id::AUDIO_CHANGED, fmt::format("%d%%", g_cfg.audio.volume.get()).c_str()), 3'000'000); } -} +} // namespace audio diff --git a/rpcs3/rpcs3/Emu/Audio/audio_utils.h b/rpcs3/rpcs3/Emu/Audio/audio_utils.h index 048776c1c..1ad984500 100644 --- a/rpcs3/rpcs3/Emu/Audio/audio_utils.h +++ b/rpcs3/rpcs3/Emu/Audio/audio_utils.h @@ -4,11 +4,11 @@ namespace audio { struct audio_fxo { - atomic_t audio_muted {false}; + atomic_t audio_muted{false}; }; f32 get_volume(); void toggle_mute(); void change_volume(s32 delta); -} +} // namespace audio diff --git a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64ASM.cpp b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64ASM.cpp index 4c8a01e0e..a34e35fe5 100644 --- a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64ASM.cpp +++ b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64ASM.cpp @@ -5,294 +5,287 @@ namespace aarch64 { - using fmt_replacement_list_t = std::vector>; + using fmt_replacement_list_t = std::vector>; - void UASM::embed_args(compiled_instruction_t& instruction, const std::vector& args, const std::vector& clobbered) - { - for (const auto& arg : args) - { - switch (arg.type) - { - case ArgType::Immediate: - case ArgType::Register: - case ArgType::SRegister: - // Embedded directly - break; - case ArgType::LLVMInt: - instruction.constraints.push_back("i"); - instruction.args.push_back(arg.value); - break; - case ArgType::LLVMReg: - instruction.constraints.push_back("r"); - instruction.args.push_back(arg.value); - break; - case ArgType::LLVMPtr: - instruction.constraints.push_back("m"); - instruction.args.push_back(arg.value); - break; - default: - break; - } - } + void UASM::embed_args(compiled_instruction_t& instruction, const std::vector& args, const std::vector& clobbered) + { + for (const auto& arg : args) + { + switch (arg.type) + { + case ArgType::Immediate: + case ArgType::Register: + case ArgType::SRegister: + // Embedded directly + break; + case ArgType::LLVMInt: + instruction.constraints.push_back("i"); + instruction.args.push_back(arg.value); + break; + case ArgType::LLVMReg: + instruction.constraints.push_back("r"); + instruction.args.push_back(arg.value); + break; + case ArgType::LLVMPtr: + instruction.constraints.push_back("m"); + instruction.args.push_back(arg.value); + break; + default: + break; + } + } - for (const auto& reg : clobbered) - { - const auto clobber = fmt::format("~{%s}", gpr_names[static_cast(reg)]); - instruction.constraints.push_back(clobber); - } - } + for (const auto& reg : clobbered) + { + const auto clobber = fmt::format("~{%s}", gpr_names[static_cast(reg)]); + instruction.constraints.push_back(clobber); + } + } - void UASM::emit0(const char* inst) - { - compiled_instruction_t i{}; - i.asm_ = inst; - m_instructions.push_back(i); - } + void UASM::emit0(const char* inst) + { + compiled_instruction_t i{}; + i.asm_ = inst; + m_instructions.push_back(i); + } - void UASM::emit1(const char* inst, const Arg& arg0, const std::vector& clobbered) - { - int arg_id = 0; - fmt_replacement_list_t repl = { - { "{0}", arg0.to_string(&arg_id) } - }; + void UASM::emit1(const char* inst, const Arg& arg0, const std::vector& clobbered) + { + int arg_id = 0; + fmt_replacement_list_t repl = { + {"{0}", arg0.to_string(&arg_id)}}; - compiled_instruction_t i{}; - i.asm_ = fmt::replace_all(inst, repl); - embed_args(i, { arg0 }, clobbered); - m_instructions.push_back(i); - } + compiled_instruction_t i{}; + i.asm_ = fmt::replace_all(inst, repl); + embed_args(i, {arg0}, clobbered); + m_instructions.push_back(i); + } - void UASM::emit2(const char* inst, const Arg& arg0, const Arg& arg1, const std::vector& clobbered) - { - int arg_id = 0; - fmt_replacement_list_t repl = { - { "{0}", arg0.to_string(&arg_id) }, - { "{1}", arg1.to_string(&arg_id) }, - }; + void UASM::emit2(const char* inst, const Arg& arg0, const Arg& arg1, const std::vector& clobbered) + { + int arg_id = 0; + fmt_replacement_list_t repl = { + {"{0}", arg0.to_string(&arg_id)}, + {"{1}", arg1.to_string(&arg_id)}, + }; - compiled_instruction_t i{}; - i.asm_ = fmt::replace_all(inst, repl); - embed_args(i, { arg0, arg1 }, clobbered); - m_instructions.push_back(i); - } + compiled_instruction_t i{}; + i.asm_ = fmt::replace_all(inst, repl); + embed_args(i, {arg0, arg1}, clobbered); + m_instructions.push_back(i); + } - void UASM::emit3(const char* inst, const Arg& arg0, const Arg& arg1, const Arg& arg2, const std::vector& clobbered) - { - int arg_id = 0; - fmt_replacement_list_t repl = { - { "{0}", arg0.to_string(&arg_id) }, - { "{1}", arg1.to_string(&arg_id) }, - { "{2}", arg2.to_string(&arg_id) }, - }; + void UASM::emit3(const char* inst, const Arg& arg0, const Arg& arg1, const Arg& arg2, const std::vector& clobbered) + { + int arg_id = 0; + fmt_replacement_list_t repl = { + {"{0}", arg0.to_string(&arg_id)}, + {"{1}", arg1.to_string(&arg_id)}, + {"{2}", arg2.to_string(&arg_id)}, + }; - compiled_instruction_t i{}; - i.asm_ = fmt::replace_all(inst, repl); - embed_args(i, { arg0, arg1, arg2 }, clobbered); - m_instructions.push_back(i); - } + compiled_instruction_t i{}; + i.asm_ = fmt::replace_all(inst, repl); + embed_args(i, {arg0, arg1, arg2}, clobbered); + m_instructions.push_back(i); + } - void UASM::emit4(const char* inst, const Arg& arg0, const Arg& arg1, const Arg& arg2, const Arg& arg3, const std::vector& clobbered) - { - int arg_id = 0; - fmt_replacement_list_t repl = { - { "{0}", arg0.to_string(&arg_id) }, - { "{1}", arg1.to_string(&arg_id) }, - { "{2}", arg2.to_string(&arg_id) }, - { "{3}", arg3.to_string(&arg_id) }, - }; + void UASM::emit4(const char* inst, const Arg& arg0, const Arg& arg1, const Arg& arg2, const Arg& arg3, const std::vector& clobbered) + { + int arg_id = 0; + fmt_replacement_list_t repl = { + {"{0}", arg0.to_string(&arg_id)}, + {"{1}", arg1.to_string(&arg_id)}, + {"{2}", arg2.to_string(&arg_id)}, + {"{3}", arg3.to_string(&arg_id)}, + }; - compiled_instruction_t i{}; - i.asm_ = fmt::replace_all(inst, repl); - embed_args(i, { arg0, arg1, arg2, arg3 }, clobbered); - m_instructions.push_back(i); - } + compiled_instruction_t i{}; + i.asm_ = fmt::replace_all(inst, repl); + embed_args(i, {arg0, arg1, arg2, arg3}, clobbered); + m_instructions.push_back(i); + } - void UASM::insert(llvm::IRBuilder<>* irb, llvm::LLVMContext& ctx) const - { - for (const auto& inst : m_instructions) - { - auto constraints = fmt::merge(inst.constraints, ","); - llvm_asm(irb, inst.asm_, inst.args, constraints, ctx); - } - } + void UASM::insert(llvm::IRBuilder<>* irb, llvm::LLVMContext& ctx) const + { + for (const auto& inst : m_instructions) + { + auto constraints = fmt::merge(inst.constraints, ","); + llvm_asm(irb, inst.asm_, inst.args, constraints, ctx); + } + } - void UASM::append(const UASM& that) - { - m_instructions.reserve(m_instructions.size() + that.m_instructions.size()); - std::copy(that.m_instructions.begin(), that.m_instructions.end(), std::back_inserter(this->m_instructions)); - } + void UASM::append(const UASM& that) + { + m_instructions.reserve(m_instructions.size() + that.m_instructions.size()); + std::copy(that.m_instructions.begin(), that.m_instructions.end(), std::back_inserter(this->m_instructions)); + } - void UASM::prepend(const UASM& that) - { - auto new_instructions = that.m_instructions; - new_instructions.reserve(m_instructions.size() + that.m_instructions.size()); - std::copy(m_instructions.begin(), m_instructions.end(), std::back_inserter(new_instructions)); - m_instructions = std::move(new_instructions); - } + void UASM::prepend(const UASM& that) + { + auto new_instructions = that.m_instructions; + new_instructions.reserve(m_instructions.size() + that.m_instructions.size()); + std::copy(m_instructions.begin(), m_instructions.end(), std::back_inserter(new_instructions)); + m_instructions = std::move(new_instructions); + } - // Convenience arg wrappers - UASM::Arg UASM::Int(llvm::Value* v) - { - return Arg { - .type = ArgType::LLVMInt, - .value = v - }; - } + // Convenience arg wrappers + UASM::Arg UASM::Int(llvm::Value* v) + { + return Arg{ + .type = ArgType::LLVMInt, + .value = v}; + } - UASM::Arg UASM::Imm(s64 v) - { - return Arg { - .type = ArgType::Immediate, - .imm = v - }; - } + UASM::Arg UASM::Imm(s64 v) + { + return Arg{ + .type = ArgType::Immediate, + .imm = v}; + } - UASM::Arg UASM::Reg(gpr reg) - { - return Arg { - .type = ArgType::Register, - .reg = reg - }; - } + UASM::Arg UASM::Reg(gpr reg) + { + return Arg{ + .type = ArgType::Register, + .reg = reg}; + } - UASM::Arg UASM::Reg(spr reg) - { - return Arg { - .type = ArgType::SRegister, - .sreg = reg - }; - } + UASM::Arg UASM::Reg(spr reg) + { + return Arg{ + .type = ArgType::SRegister, + .sreg = reg}; + } - UASM::Arg UASM::Ptr(llvm::Value* v) - { - return Arg { - .type = ArgType::LLVMPtr, - .value = v - }; - } + UASM::Arg UASM::Ptr(llvm::Value* v) + { + return Arg{ + .type = ArgType::LLVMPtr, + .value = v}; + } - UASM::Arg UASM::Var(llvm::Value* v) - { - return Arg { - .type = ArgType::LLVMReg, - .value = v - }; - } + UASM::Arg UASM::Var(llvm::Value* v) + { + return Arg{ + .type = ArgType::LLVMReg, + .value = v}; + } - void UASM::mov(gpr dst, gpr src) - { - emit2("mov {0}, {1}", Reg(dst), Reg(src), { dst }); - } + void UASM::mov(gpr dst, gpr src) + { + emit2("mov {0}, {1}", Reg(dst), Reg(src), {dst}); + } - void UASM::mov(gpr dst, const Arg& src) - { - emit2("mov {0}, {1}", Reg(dst), src, { dst }); - } + void UASM::mov(gpr dst, const Arg& src) + { + emit2("mov {0}, {1}", Reg(dst), src, {dst}); + } - void UASM::movnt(gpr dst, const Arg& src) - { - emit2("mov {0}, {1}", Reg(dst), src, {}); - } + void UASM::movnt(gpr dst, const Arg& src) + { + emit2("mov {0}, {1}", Reg(dst), src, {}); + } - void UASM::str(gpr src, gpr base, const Arg& offset) - { - emit3("str {0}, [{1}, {2}]", Reg(src), Reg(base), offset, {}); - } + void UASM::str(gpr src, gpr base, const Arg& offset) + { + emit3("str {0}, [{1}, {2}]", Reg(src), Reg(base), offset, {}); + } - void UASM::str(const Arg& src, spr base, const Arg& offset) - { - emit3("str {0}, [{1}, {2}]", src, Reg(base), offset, {}); - } + void UASM::str(const Arg& src, spr base, const Arg& offset) + { + emit3("str {0}, [{1}, {2}]", src, Reg(base), offset, {}); + } - void UASM::ldr(gpr dst, gpr base, const Arg& offset) - { - emit3("ldr {0}, [{1}, {2}]", Reg(dst), Reg(base), offset, { dst }); - } + void UASM::ldr(gpr dst, gpr base, const Arg& offset) + { + emit3("ldr {0}, [{1}, {2}]", Reg(dst), Reg(base), offset, {dst}); + } - void UASM::ldr(gpr dst, spr base, const Arg& offset) - { - emit3("ldr {0}, [{1}, {2}]", Reg(dst), Reg(base), offset, { dst }); - } + void UASM::ldr(gpr dst, spr base, const Arg& offset) + { + emit3("ldr {0}, [{1}, {2}]", Reg(dst), Reg(base), offset, {dst}); + } - void UASM::stp(gpr src0, gpr src1, gpr base, const Arg& offset) - { - emit4("stp {0}, {1}, [{2}, {3}]", Reg(src0), Reg(src1), Reg(base), offset, {}); - } + void UASM::stp(gpr src0, gpr src1, gpr base, const Arg& offset) + { + emit4("stp {0}, {1}, [{2}, {3}]", Reg(src0), Reg(src1), Reg(base), offset, {}); + } - void UASM::ldp(gpr dst0, gpr dst1, gpr base, const Arg& offset) - { - emit4("ldp {0}, {1}, [{2}, {3}]", Reg(dst0), Reg(dst1), Reg(base), offset, { dst0, dst1 }); - } + void UASM::ldp(gpr dst0, gpr dst1, gpr base, const Arg& offset) + { + emit4("ldp {0}, {1}, [{2}, {3}]", Reg(dst0), Reg(dst1), Reg(base), offset, {dst0, dst1}); + } - void UASM::b(const Arg& target) - { - emit1("b {0}", target, {}); - } + void UASM::b(const Arg& target) + { + emit1("b {0}", target, {}); + } - void UASM::br(gpr target) - { - emit1("br {0}", Reg(target), {}); - } + void UASM::br(gpr target) + { + emit1("br {0}", Reg(target), {}); + } - void UASM::br(const Arg& target) - { - emit1("br {0}", target, {}); - } + void UASM::br(const Arg& target) + { + emit1("br {0}", target, {}); + } - void UASM::ret() - { - emit0("ret"); - } + void UASM::ret() + { + emit0("ret"); + } - void UASM::adr(gpr dst, const Arg& src) - { - emit2("adr {0}, {1}", Reg(dst), src, { dst }); - } + void UASM::adr(gpr dst, const Arg& src) + { + emit2("adr {0}, {1}", Reg(dst), src, {dst}); + } - void UASM::add(spr dst, spr src0, const Arg& src1) - { - emit3("add {0}, {1}, {2}", Reg(dst), Reg(src0), src1, {}); - } + void UASM::add(spr dst, spr src0, const Arg& src1) + { + emit3("add {0}, {1}, {2}", Reg(dst), Reg(src0), src1, {}); + } - void UASM::sub(spr dst, spr src0, const Arg& src1) - { - emit3("sub {0}, {1}, {2}", Reg(dst), Reg(src0), src1, {}); - } + void UASM::sub(spr dst, spr src0, const Arg& src1) + { + emit3("sub {0}, {1}, {2}", Reg(dst), Reg(src0), src1, {}); + } - void UASM::nop(const std::vector& refs) - { - emit0("nop"); - embed_args(m_instructions.back(), refs, {}); - } + void UASM::nop(const std::vector& refs) + { + emit0("nop"); + embed_args(m_instructions.back(), refs, {}); + } - void UASM::brk(int mark) - { - emit1("brk {0}", Imm(mark), {}); - } + void UASM::brk(int mark) + { + emit1("brk {0}", Imm(mark), {}); + } - std::string UASM::Arg::to_string(int* id) const - { - // Safety checks around the optional arg incrementer - int dummy = 0; - if (!id) - { - id = &dummy; - } + std::string UASM::Arg::to_string(int* id) const + { + // Safety checks around the optional arg incrementer + int dummy = 0; + if (!id) + { + id = &dummy; + } - switch (type) - { - case ArgType::Immediate: - return std::string("#") + std::to_string(imm); - case ArgType::Register: - return gpr_names[static_cast(reg)]; - case ArgType::SRegister: - return spr_asm_names[static_cast(sreg)]; - case ArgType::LLVMInt: - case ArgType::LLVMReg: - case ArgType::LLVMPtr: - default: - // Return placeholder identifier - return std::string("$") + std::to_string(*id++); - } - } -} + switch (type) + { + case ArgType::Immediate: + return std::string("#") + std::to_string(imm); + case ArgType::Register: + return gpr_names[static_cast(reg)]; + case ArgType::SRegister: + return spr_asm_names[static_cast(sreg)]; + case ArgType::LLVMInt: + case ArgType::LLVMReg: + case ArgType::LLVMPtr: + default: + // Return placeholder identifier + return std::string("$") + std::to_string(*id++); + } + } +} // namespace aarch64 diff --git a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64ASM.h b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64ASM.h index f494fafc6..28b666696 100644 --- a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64ASM.h +++ b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64ASM.h @@ -4,99 +4,99 @@ namespace aarch64 { - // Micro-assembler - class UASM - { - public: - enum ArgType - { - Register = 0, - SRegister, - Immediate, - LLVMInt, - LLVMPtr, - LLVMReg - }; + // Micro-assembler + class UASM + { + public: + enum ArgType + { + Register = 0, + SRegister, + Immediate, + LLVMInt, + LLVMPtr, + LLVMReg + }; - struct Arg - { - ArgType type; - union - { - llvm::Value* value; - gpr reg; - spr sreg; - s64 imm; - }; + struct Arg + { + ArgType type; + union + { + llvm::Value* value; + gpr reg; + spr sreg; + s64 imm; + }; - std::string to_string(int* id = nullptr) const; - }; + std::string to_string(int* id = nullptr) const; + }; - protected: - struct compiled_instruction_t - { - std::string asm_; - std::vector constraints; - std::vector args; - }; + protected: + struct compiled_instruction_t + { + std::string asm_; + std::vector constraints; + std::vector args; + }; - std::vector m_instructions; + std::vector m_instructions; - void emit0(const char* inst); - void emit1(const char* inst, const Arg& arg0, const std::vector& clobbered); - void emit2(const char* inst, const Arg& arg0, const Arg& arg1, const std::vector& clobbered); - void emit3(const char* inst, const Arg& arg0, const Arg& arg1, const Arg& arg2, const std::vector& clobbered); - void emit4(const char* inst, const Arg& arg0, const Arg& arg1, const Arg& arg2, const Arg& arg3, const std::vector& clobbered); + void emit0(const char* inst); + void emit1(const char* inst, const Arg& arg0, const std::vector& clobbered); + void emit2(const char* inst, const Arg& arg0, const Arg& arg1, const std::vector& clobbered); + void emit3(const char* inst, const Arg& arg0, const Arg& arg1, const Arg& arg2, const std::vector& clobbered); + void emit4(const char* inst, const Arg& arg0, const Arg& arg1, const Arg& arg2, const Arg& arg3, const std::vector& clobbered); - void embed_args(compiled_instruction_t& instruction, const std::vector& args, const std::vector& clobbered); + void embed_args(compiled_instruction_t& instruction, const std::vector& args, const std::vector& clobbered); - public: - UASM() = default; + public: + UASM() = default; - // Convenience wrappers - static Arg Int(llvm::Value* v); - static Arg Imm(s64 v); - static Arg Reg(gpr reg); - static Arg Reg(spr reg); - static Arg Ptr(llvm::Value* v); - static Arg Var(llvm::Value* v); + // Convenience wrappers + static Arg Int(llvm::Value* v); + static Arg Imm(s64 v); + static Arg Reg(gpr reg); + static Arg Reg(spr reg); + static Arg Ptr(llvm::Value* v); + static Arg Var(llvm::Value* v); - void mov(gpr dst, gpr src); - void mov(gpr dst, const Arg& src); - void movnt(gpr dst, const Arg& src); + void mov(gpr dst, gpr src); + void mov(gpr dst, const Arg& src); + void movnt(gpr dst, const Arg& src); - void adr(gpr dst, const Arg& src); + void adr(gpr dst, const Arg& src); - void str(gpr src, gpr base, const Arg& offset); - void str(gpr src, spr base, const Arg& offset); - void str(const Arg& src, gpr base, const Arg& offset); - void str(const Arg& src, spr base, const Arg& offset); - void ldr(gpr dst, gpr base, const Arg& offset); - void ldr(gpr dst, spr base, const Arg& offset); + void str(gpr src, gpr base, const Arg& offset); + void str(gpr src, spr base, const Arg& offset); + void str(const Arg& src, gpr base, const Arg& offset); + void str(const Arg& src, spr base, const Arg& offset); + void ldr(gpr dst, gpr base, const Arg& offset); + void ldr(gpr dst, spr base, const Arg& offset); - void stp(gpr src0, gpr src1, gpr base, const Arg& offset); - void stp(gpr src0, gpr src1, spr base, const Arg& offset); - void ldp(gpr dst0, gpr dst1, gpr base, const Arg& offset); - void ldp(gpr dst0, gpr dst1, spr base, const Arg& offset); + void stp(gpr src0, gpr src1, gpr base, const Arg& offset); + void stp(gpr src0, gpr src1, spr base, const Arg& offset); + void ldp(gpr dst0, gpr dst1, gpr base, const Arg& offset); + void ldp(gpr dst0, gpr dst1, spr base, const Arg& offset); - void add(spr dst, spr src0, const Arg& src1); - void add(gpr dst, gpr src0, const Arg& src1); - void sub(spr dst, spr src0, const Arg& src1); - void sub(gpr dst, gpr src0, const Arg& src1); + void add(spr dst, spr src0, const Arg& src1); + void add(gpr dst, gpr src0, const Arg& src1); + void sub(spr dst, spr src0, const Arg& src1); + void sub(gpr dst, gpr src0, const Arg& src1); - void b(const Arg& target); - void br(gpr target); - void br(const Arg& target); - void ret(); + void b(const Arg& target); + void br(gpr target); + void br(const Arg& target); + void ret(); - void nop(const std::vector& refs = {}); - void brk(int mark = 0); + void nop(const std::vector& refs = {}); + void brk(int mark = 0); - void append(const UASM& other); - void prepend(const UASM& other); + void append(const UASM& other); + void prepend(const UASM& other); - void insert(llvm::IRBuilder<>* irb, llvm::LLVMContext& ctx) const; - }; + void insert(llvm::IRBuilder<>* irb, llvm::LLVMContext& ctx) const; + }; - using ASMBlock = UASM; -} + using ASMBlock = UASM; +} // namespace aarch64 diff --git a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Common.cpp b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Common.cpp index 132ac8611..cc27c0fb2 100644 --- a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Common.cpp +++ b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Common.cpp @@ -11,411 +11,411 @@ namespace aarch64 { #if !defined(__APPLE__) - struct cpu_entry_t - { - u32 vendor; - u32 part; - const char* arch; - const char* family; - const char* name; - }; + struct cpu_entry_t + { + u32 vendor; + u32 part; + const char* arch; + const char* family; + const char* name; + }; - struct cpu_vendor_t - { - u32 id; - const char* name; - const char* short_name; - }; + struct cpu_vendor_t + { + u32 id; + const char* name; + const char* short_name; + }; - static cpu_vendor_t s_vendors_list[] = - { - { 0x41, "Arm Limited.", "ARM" }, - { 0x42, "Broadcom Corporation.", "Broadcom" }, - { 0x43, "Cavium Inc.", "Cavium" }, - { 0x44, "Digital Equipment Corporation.", "DEC" }, - { 0x46, "Fujitsu Ltd.", "Fujitsu" }, - { 0x49, "Infineon Technologies AG.", "Infineon" }, - { 0x4D, "Motorola or Freescale Semiconductor Inc.", "Motorola" }, - { 0x4E, "NVIDIA Corporation.", "NVIDIA" }, - { 0x50, "Applied Micro Circuits Corporation.", "AMCC" }, - { 0x51, "Qualcomm Inc.", "Qualcomm" }, - { 0x56, "Marvell International Ltd.", "Marvell" }, - { 0x69, "Intel Corporation.", "Intel" }, - { 0xC0, "Ampere Computing", "Ampere" }, + static cpu_vendor_t s_vendors_list[] = + { + {0x41, "Arm Limited.", "ARM"}, + {0x42, "Broadcom Corporation.", "Broadcom"}, + {0x43, "Cavium Inc.", "Cavium"}, + {0x44, "Digital Equipment Corporation.", "DEC"}, + {0x46, "Fujitsu Ltd.", "Fujitsu"}, + {0x49, "Infineon Technologies AG.", "Infineon"}, + {0x4D, "Motorola or Freescale Semiconductor Inc.", "Motorola"}, + {0x4E, "NVIDIA Corporation.", "NVIDIA"}, + {0x50, "Applied Micro Circuits Corporation.", "AMCC"}, + {0x51, "Qualcomm Inc.", "Qualcomm"}, + {0x56, "Marvell International Ltd.", "Marvell"}, + {0x69, "Intel Corporation.", "Intel"}, + {0xC0, "Ampere Computing", "Ampere"}, - // Unofficial but existing in the wild - { 0x61, "Apple Inc.", "Apple" }, - }; + // Unofficial but existing in the wild + {0x61, "Apple Inc.", "Apple"}, + }; - static cpu_entry_t s_cpu_list[] = - { - // ARM - 0x41 - { 0x41, 0x926, "", "", "arm926ej-s" }, - { 0x41, 0xb02, "", "", "mpcore" }, - { 0x41, 0xb36, "", "", "arm1136j-s" }, - { 0x41, 0xb56, "", "", "arm1156t2-s" }, - { 0x41, 0xb76, "", "", "arm1176jz-s" }, - { 0x41, 0xc05, "", "", "cortex-a5" }, - { 0x41, 0xc07, "", "", "cortex-a7" }, - { 0x41, 0xc08, "", "", "cortex-a8" }, - { 0x41, 0xc09, "", "", "cortex-a9" }, - { 0x41, 0xc0f, "", "", "cortex-a15" }, - { 0x41, 0xc0e, "", "", "cortex-a17" }, - { 0x41, 0xc20, "", "", "cortex-m0" }, - { 0x41, 0xc23, "", "", "cortex-m3" }, - { 0x41, 0xc24, "", "", "cortex-m4" }, - { 0x41, 0xc27, "", "", "cortex-m7" }, - { 0x41, 0xd20, "", "", "cortex-m23" }, - { 0x41, 0xd21, "", "", "cortex-m33" }, - { 0x41, 0xd24, "", "", "cortex-m52" }, - { 0x41, 0xd22, "", "", "cortex-m55" }, - { 0x41, 0xd23, "armv8.1-m.main+pacbti+mve.fp+fp.dp", "", "Cortex-M85" }, - { 0x41, 0xc18, "", "", "cortex-r8" }, - { 0x41, 0xd13, "armv8-r+crc+simd", "", "cortex-r52" }, - { 0x41, 0xd16, "armv8-r+crc+simd", "", "cortex-r52plus" }, - { 0x41, 0xd15, "", "", "cortex-r82" }, - { 0x41, 0xd14, "", "", "cortex-r82ae" }, - { 0x41, 0xd01, "armv8-a+crc+simd", "", "Cortex-A32" }, - { 0x41, 0xd02, "", "", "cortex-a34" }, - { 0x41, 0xd04, "armv8-a+crc+simd", "", "Cortex-A35" }, - { 0x41, 0xd03, "armv8-a+crc+simd", "", "Cortex-A53" }, + static cpu_entry_t s_cpu_list[] = + { + // ARM - 0x41 + {0x41, 0x926, "", "", "arm926ej-s"}, + {0x41, 0xb02, "", "", "mpcore"}, + {0x41, 0xb36, "", "", "arm1136j-s"}, + {0x41, 0xb56, "", "", "arm1156t2-s"}, + {0x41, 0xb76, "", "", "arm1176jz-s"}, + {0x41, 0xc05, "", "", "cortex-a5"}, + {0x41, 0xc07, "", "", "cortex-a7"}, + {0x41, 0xc08, "", "", "cortex-a8"}, + {0x41, 0xc09, "", "", "cortex-a9"}, + {0x41, 0xc0f, "", "", "cortex-a15"}, + {0x41, 0xc0e, "", "", "cortex-a17"}, + {0x41, 0xc20, "", "", "cortex-m0"}, + {0x41, 0xc23, "", "", "cortex-m3"}, + {0x41, 0xc24, "", "", "cortex-m4"}, + {0x41, 0xc27, "", "", "cortex-m7"}, + {0x41, 0xd20, "", "", "cortex-m23"}, + {0x41, 0xd21, "", "", "cortex-m33"}, + {0x41, 0xd24, "", "", "cortex-m52"}, + {0x41, 0xd22, "", "", "cortex-m55"}, + {0x41, 0xd23, "armv8.1-m.main+pacbti+mve.fp+fp.dp", "", "Cortex-M85"}, + {0x41, 0xc18, "", "", "cortex-r8"}, + {0x41, 0xd13, "armv8-r+crc+simd", "", "cortex-r52"}, + {0x41, 0xd16, "armv8-r+crc+simd", "", "cortex-r52plus"}, + {0x41, 0xd15, "", "", "cortex-r82"}, + {0x41, 0xd14, "", "", "cortex-r82ae"}, + {0x41, 0xd01, "armv8-a+crc+simd", "", "Cortex-A32"}, + {0x41, 0xd02, "", "", "cortex-a34"}, + {0x41, 0xd04, "armv8-a+crc+simd", "", "Cortex-A35"}, + {0x41, 0xd03, "armv8-a+crc+simd", "", "Cortex-A53"}, - { 0x51, 0x201, "", "", "kryo" }, - { 0x51, 0x205, "", "", "kryo" }, - { 0x51, 0x211, "", "", "kryo" }, + {0x51, 0x201, "", "", "kryo"}, + {0x51, 0x205, "", "", "kryo"}, + {0x51, 0x211, "", "", "kryo"}, - { 0x41, 0xd05, "armv8.2-a+fp16+dotprod", "", "Cortex-A55" }, - { 0x41, 0xd46, "", "", "cortex-a510" }, - { 0x41, 0xd80, "", "", "cortex-a520" }, - { 0x41, 0xd88, "", "", "cortex-a520ae" }, - { 0x41, 0xd07, "armv8-a+crc+simd", "", "Cortex-A57" }, - { 0x41, 0xd06, "", "", "cortex-a65" }, - { 0x41, 0xd43, "", "", "cortex-a65ae" }, - { 0x41, 0xd08, "armv8-a+crc+simd", "", "Cortex-A72" }, - { 0x41, 0xd09, "armv8-a+crc+simd", "", "Cortex-A73" }, + {0x41, 0xd05, "armv8.2-a+fp16+dotprod", "", "Cortex-A55"}, + {0x41, 0xd46, "", "", "cortex-a510"}, + {0x41, 0xd80, "", "", "cortex-a520"}, + {0x41, 0xd88, "", "", "cortex-a520ae"}, + {0x41, 0xd07, "armv8-a+crc+simd", "", "Cortex-A57"}, + {0x41, 0xd06, "", "", "cortex-a65"}, + {0x41, 0xd43, "", "", "cortex-a65ae"}, + {0x41, 0xd08, "armv8-a+crc+simd", "", "Cortex-A72"}, + {0x41, 0xd09, "armv8-a+crc+simd", "", "Cortex-A73"}, - { 0x51, 0x800, "", "", "cortex-a73" }, - { 0x51, 0x801, "", "", "cortex-a73" }, + {0x51, 0x800, "", "", "cortex-a73"}, + {0x51, 0x801, "", "", "cortex-a73"}, - { 0x41, 0xd0a, "armv8.2-a+fp16+dotprod", "", "Cortex-A75" }, + {0x41, 0xd0a, "armv8.2-a+fp16+dotprod", "", "Cortex-A75"}, - { 0x51, 0x802, "", "", "cortex-a75" }, - { 0x51, 0x803, "", "", "cortex-a75" }, + {0x51, 0x802, "", "", "cortex-a75"}, + {0x51, 0x803, "", "", "cortex-a75"}, - { 0x41, 0xd0b, "armv8.2-a+fp16+dotprod", "", "Cortex-A76" }, + {0x41, 0xd0b, "armv8.2-a+fp16+dotprod", "", "Cortex-A76"}, - { 0x51, 0x804, "", "", "cortex-a76" }, - { 0x51, 0x805, "", "", "cortex-a76" }, + {0x51, 0x804, "", "", "cortex-a76"}, + {0x51, 0x805, "", "", "cortex-a76"}, - { 0x41, 0xd0e, "armv8.2-a+fp16+dotprod", "", "Cortex-A76ae" }, - { 0x41, 0xd0d, "armv8.2-a+fp16+dotprod", "", "Cortex-A77" }, - { 0x41, 0xd41, "armv8.2-a+fp16+dotprod", "", "Cortex-A78" }, - { 0x41, 0xd42, "armv8.2-a+fp16+dotprod", "", "Cortex-A78ae" }, - { 0x41, 0xd4b, "armv8.2-a+fp16+dotprod", "", "Cortex-A78c" }, - { 0x41, 0xd47, "armv9-a+fp16+bf16+i8mm", "", "Cortex-A710" }, + {0x41, 0xd0e, "armv8.2-a+fp16+dotprod", "", "Cortex-A76ae"}, + {0x41, 0xd0d, "armv8.2-a+fp16+dotprod", "", "Cortex-A77"}, + {0x41, 0xd41, "armv8.2-a+fp16+dotprod", "", "Cortex-A78"}, + {0x41, 0xd42, "armv8.2-a+fp16+dotprod", "", "Cortex-A78ae"}, + {0x41, 0xd4b, "armv8.2-a+fp16+dotprod", "", "Cortex-A78c"}, + {0x41, 0xd47, "armv9-a+fp16+bf16+i8mm", "", "Cortex-A710"}, - { 0x41, 0xd4d, "", "", "Cortex-A715" }, - { 0x41, 0xd81, "", "", "Cortex-A720" }, - { 0x41, 0xd89, "", "", "Cortex-A720AE" }, - { 0x41, 0xd87, "", "", "Cortex-A725" }, - { 0x41, 0xd44, "armv8.2-a+fp16+dotprod", "", "Cortex-X1" }, - { 0x41, 0xd4c, "armv8.2-a+fp16+dotprod", "", "Cortex-X1c" }, - { 0x41, 0xd48, "", "", "Cortex-X2" }, - { 0x41, 0xd4e, "", "", "Cortex-X3" }, - { 0x41, 0xd82, "", "", "Cortex-X4" }, - { 0x41, 0xd85, "", "", "Cortex-X925" }, - { 0x41, 0xd4a, "", "", "Neoverse-e1" }, - { 0x41, 0xd0c, "armv8.2-a+fp16+dotprod", "", "Neoverse-N1" }, - { 0x41, 0xd49, "armv8.5-a+fp16+bf16+i8mm", "", "Neoverse-N2" }, - { 0x41, 0xd8e, "", "", "Neoverse-N3" }, - { 0x41, 0xd40, "armv8.4-a+fp16+bf16+i8mm", "", "Neoverse-V1" }, - { 0x41, 0xd4f, "", "", "Neoverse-V2" }, - { 0x41, 0xd84, "", "", "Neoverse-V3" }, - { 0x41, 0xd83, "", "", "Neoverse-V3AE" }, + {0x41, 0xd4d, "", "", "Cortex-A715"}, + {0x41, 0xd81, "", "", "Cortex-A720"}, + {0x41, 0xd89, "", "", "Cortex-A720AE"}, + {0x41, 0xd87, "", "", "Cortex-A725"}, + {0x41, 0xd44, "armv8.2-a+fp16+dotprod", "", "Cortex-X1"}, + {0x41, 0xd4c, "armv8.2-a+fp16+dotprod", "", "Cortex-X1c"}, + {0x41, 0xd48, "", "", "Cortex-X2"}, + {0x41, 0xd4e, "", "", "Cortex-X3"}, + {0x41, 0xd82, "", "", "Cortex-X4"}, + {0x41, 0xd85, "", "", "Cortex-X925"}, + {0x41, 0xd4a, "", "", "Neoverse-e1"}, + {0x41, 0xd0c, "armv8.2-a+fp16+dotprod", "", "Neoverse-N1"}, + {0x41, 0xd49, "armv8.5-a+fp16+bf16+i8mm", "", "Neoverse-N2"}, + {0x41, 0xd8e, "", "", "Neoverse-N3"}, + {0x41, 0xd40, "armv8.4-a+fp16+bf16+i8mm", "", "Neoverse-V1"}, + {0x41, 0xd4f, "", "", "Neoverse-V2"}, + {0x41, 0xd84, "", "", "Neoverse-V3"}, + {0x41, 0xd83, "", "", "Neoverse-V3AE"}, - // Broadcom - 0x42 - { 0x42, 0x516, "", "", "thunderx2t99" }, - { 0x42, 0x0516, "", "", "thunderx2t99" }, - { 0x42, 0xaf, "", "", "thunderx2t99" }, - { 0x42, 0x0af, "", "", "thunderx2t99" }, - { 0x42, 0xa1, "", "", "thunderxt88" }, - { 0x42, 0x0a1, "", "", "thunderxt88" }, + // Broadcom - 0x42 + {0x42, 0x516, "", "", "thunderx2t99"}, + {0x42, 0x0516, "", "", "thunderx2t99"}, + {0x42, 0xaf, "", "", "thunderx2t99"}, + {0x42, 0x0af, "", "", "thunderx2t99"}, + {0x42, 0xa1, "", "", "thunderxt88"}, + {0x42, 0x0a1, "", "", "thunderxt88"}, - // Cavium - 0x43 - { 0x43, 0x516, "", "", "thunderx2t99" }, - { 0x43, 0x0516, "", "", "thunderx2t99" }, - { 0x43, 0xaf, "", "", "thunderx2t99" }, - { 0x43, 0x0af, "", "", "thunderx2t99" }, - { 0x43, 0xa1, "", "", "thunderxt88" }, - { 0x43, 0x0a1, "", "", "thunderxt88" }, + // Cavium - 0x43 + {0x43, 0x516, "", "", "thunderx2t99"}, + {0x43, 0x0516, "", "", "thunderx2t99"}, + {0x43, 0xaf, "", "", "thunderx2t99"}, + {0x43, 0x0af, "", "", "thunderx2t99"}, + {0x43, 0xa1, "", "", "thunderxt88"}, + {0x43, 0x0a1, "", "", "thunderxt88"}, - // HiSilicon - 0x48 - { 0x48, 0xd01, "", "", "tsv110" }, + // HiSilicon - 0x48 + {0x48, 0xd01, "", "", "tsv110"}, - // NVIDIA - 0x4e - { 0x4e, 0x004, "", "", "carmel" }, + // NVIDIA - 0x4e + {0x4e, 0x004, "", "", "carmel"}, - // APM - 0x50 - // Qualcomm - 0x51 - { 0x51, 0x06f, "", "", "krait" }, - { 0x51, 0xc00, "", "", "falkor" }, - { 0x51, 0xc01, "", "", "saphira" }, - { 0x51, 0x001, "armv8.5-a", "Snapdragon", "oryon-1" }, + // APM - 0x50 + // Qualcomm - 0x51 + {0x51, 0x06f, "", "", "krait"}, + {0x51, 0xc00, "", "", "falkor"}, + {0x51, 0xc01, "", "", "saphira"}, + {0x51, 0x001, "armv8.5-a", "Snapdragon", "oryon-1"}, - // Samsung - 0x53 - // ???? + // Samsung - 0x53 + // ???? - // Apple - 0x61 - { 0x61, 0x020, "", "", "apple-m1" }, - { 0x61, 0x021, "", "", "apple-m1" }, - { 0x61, 0x022, "", "", "apple-m1" }, - { 0x61, 0x023, "", "", "apple-m1" }, - { 0x61, 0x024, "", "", "apple-m1" }, - { 0x61, 0x025, "", "", "apple-m1" }, - { 0x61, 0x028, "", "", "apple-m1" }, - { 0x61, 0x029, "", "", "apple-m1" }, - { 0x61, 0x030, "", "", "apple-m2" }, - { 0x61, 0x031, "", "", "apple-m2" }, - { 0x61, 0x032, "", "", "apple-m2" }, - { 0x61, 0x033, "", "", "apple-m2" }, - { 0x61, 0x034, "", "", "apple-m2" }, - { 0x61, 0x035, "", "", "apple-m2" }, - { 0x61, 0x038, "", "", "apple-m2" }, - { 0x61, 0x039, "", "", "apple-m2" }, - { 0x61, 0x049, "", "", "apple-m3" }, - { 0x61, 0x048, "", "", "apple-m3" }, - - // ARM China - 0x64 - { 0x63, 0x132, "", "", "star-mc1" }, + // Apple - 0x61 + {0x61, 0x020, "", "", "apple-m1"}, + {0x61, 0x021, "", "", "apple-m1"}, + {0x61, 0x022, "", "", "apple-m1"}, + {0x61, 0x023, "", "", "apple-m1"}, + {0x61, 0x024, "", "", "apple-m1"}, + {0x61, 0x025, "", "", "apple-m1"}, + {0x61, 0x028, "", "", "apple-m1"}, + {0x61, 0x029, "", "", "apple-m1"}, + {0x61, 0x030, "", "", "apple-m2"}, + {0x61, 0x031, "", "", "apple-m2"}, + {0x61, 0x032, "", "", "apple-m2"}, + {0x61, 0x033, "", "", "apple-m2"}, + {0x61, 0x034, "", "", "apple-m2"}, + {0x61, 0x035, "", "", "apple-m2"}, + {0x61, 0x038, "", "", "apple-m2"}, + {0x61, 0x039, "", "", "apple-m2"}, + {0x61, 0x049, "", "", "apple-m3"}, + {0x61, 0x048, "", "", "apple-m3"}, - // Faraday - 0x66 - // Microsoft - 0x6d - { 0x6d, 0xd49, "", "", "neoverse-n2" }, + // ARM China - 0x64 + {0x63, 0x132, "", "", "star-mc1"}, - // Ampere - 0xc0 - { 0xc0, 0xac3, "", "", "ampere1" }, - { 0xc0, 0xac4, "", "", "ampere1a" }, - { 0xc0, 0xac5, "", "", "ampere1b" }, - }; + // Faraday - 0x66 + // Microsoft - 0x6d + {0x6d, 0xd49, "", "", "neoverse-n2"}, - static const cpu_vendor_t* find_cpu_vendor(u64 id) - { - for (const auto& vendor : s_vendors_list) - { - if (id == vendor.id) - { - return &vendor; - } - } + // Ampere - 0xc0 + {0xc0, 0xac3, "", "", "ampere1"}, + {0xc0, 0xac4, "", "", "ampere1a"}, + {0xc0, 0xac5, "", "", "ampere1b"}, + }; - return nullptr; - } + static const cpu_vendor_t* find_cpu_vendor(u64 id) + { + for (const auto& vendor : s_vendors_list) + { + if (id == vendor.id) + { + return &vendor; + } + } - static const cpu_entry_t* find_cpu_part(u64 vendor, u64 part) - { - for (const auto& cpu : s_cpu_list) - { - if (cpu.vendor == vendor && cpu.part == part) - { - return &cpu; - } - } + return nullptr; + } - return nullptr; - } + static const cpu_entry_t* find_cpu_part(u64 vendor, u64 part) + { + for (const auto& cpu : s_cpu_list) + { + if (cpu.vendor == vendor && cpu.part == part) + { + return &cpu; + } + } - // Read main ID register - static u64 read_MIDR_EL1([[maybe_unused]] u32 cpu_id) - { + return nullptr; + } + + // Read main ID register + static u64 read_MIDR_EL1([[maybe_unused]] u32 cpu_id) + { #if defined(__linux__) - const std::string path = fmt::format("/sys/devices/system/cpu/cpu%u/regs/identification/midr_el1", cpu_id); - if (!fs::is_file(path)) - { - return umax; - } + const std::string path = fmt::format("/sys/devices/system/cpu/cpu%u/regs/identification/midr_el1", cpu_id); + if (!fs::is_file(path)) + { + return umax; + } - std::string value; - if (!fs::file(path, fs::read).read(value, 18)) - { - return 0; - } - return std::stoull(value, nullptr, 16); + std::string value; + if (!fs::file(path, fs::read).read(value, 18)) + { + return 0; + } + return std::stoull(value, nullptr, 16); #else - // Unimplemented - return 0; + // Unimplemented + return 0; #endif - } + } - const char *get_cpu_name(int cpu) - { - const auto midr = read_MIDR_EL1(cpu); - const auto implementer_id = (midr >> 24) & 0xff; - const auto part_id = (midr >> 4) & 0xfff; + const char* get_cpu_name(int cpu) + { + const auto midr = read_MIDR_EL1(cpu); + const auto implementer_id = (midr >> 24) & 0xff; + const auto part_id = (midr >> 4) & 0xfff; - const auto part_info = find_cpu_part(implementer_id, part_id); - return part_info ? part_info->name : nullptr; - } + const auto part_info = find_cpu_part(implementer_id, part_id); + return part_info ? part_info->name : nullptr; + } - std::string get_cpu_name() - { - std::map core_layout; - for (u32 i = 0; i < std::thread::hardware_concurrency(); ++i) - { - const auto midr = read_MIDR_EL1(i); - if (midr == umax) - { - break; - } + std::string get_cpu_name() + { + std::map core_layout; + for (u32 i = 0; i < std::thread::hardware_concurrency(); ++i) + { + const auto midr = read_MIDR_EL1(i); + if (midr == umax) + { + break; + } - core_layout[midr]++; - } + core_layout[midr]++; + } - if (core_layout.empty()) - { - return {}; - } + if (core_layout.empty()) + { + return {}; + } - const cpu_entry_t* lowest_part_info = nullptr; - for (const auto& [midr, count] : core_layout) - { - const auto implementer_id = (midr >> 24) & 0xff; - const auto part_id = (midr >> 4) & 0xfff; + const cpu_entry_t* lowest_part_info = nullptr; + for (const auto& [midr, count] : core_layout) + { + const auto implementer_id = (midr >> 24) & 0xff; + const auto part_id = (midr >> 4) & 0xfff; - const auto part_info = find_cpu_part(implementer_id, part_id); - if (!part_info) - { - return {}; - } + const auto part_info = find_cpu_part(implementer_id, part_id); + if (!part_info) + { + return {}; + } - if (lowest_part_info == nullptr || lowest_part_info > part_info) - { - lowest_part_info = part_info; - } - } + if (lowest_part_info == nullptr || lowest_part_info > part_info) + { + lowest_part_info = part_info; + } + } - return lowest_part_info ? lowest_part_info->name : ""; - } + return lowest_part_info ? lowest_part_info->name : ""; + } - std::string get_cpu_brand() - { - // Fetch vendor and part numbers. ARM CPUs often have more than 1 architecture on the SoC, so we check all of them. - std::map core_layout; - for (u32 i = 0; i < std::thread::hardware_concurrency(); ++i) - { - const auto midr = read_MIDR_EL1(i); - if (midr == umax) - { - break; - } + std::string get_cpu_brand() + { + // Fetch vendor and part numbers. ARM CPUs often have more than 1 architecture on the SoC, so we check all of them. + std::map core_layout; + for (u32 i = 0; i < std::thread::hardware_concurrency(); ++i) + { + const auto midr = read_MIDR_EL1(i); + if (midr == umax) + { + break; + } - core_layout[midr]++; - } + core_layout[midr]++; + } - if (core_layout.empty()) - { - return "Unidentified CPU"; - } + if (core_layout.empty()) + { + return "Unidentified CPU"; + } - std::string vendor_name; - std::string part_family; - std::vector core_names; - for (const auto& [midr, count] : core_layout) - { - const auto implementer_id = (midr >> 24) & 0xff; - const auto part_id = (midr >> 4) & 0xfff; + std::string vendor_name; + std::string part_family; + std::vector core_names; + for (const auto& [midr, count] : core_layout) + { + const auto implementer_id = (midr >> 24) & 0xff; + const auto part_id = (midr >> 4) & 0xfff; - if (vendor_name.empty()) - { - const auto vendor_info = find_cpu_vendor(implementer_id); - vendor_name = vendor_info ? vendor_info->short_name : "Unknown"; - } + if (vendor_name.empty()) + { + const auto vendor_info = find_cpu_vendor(implementer_id); + vendor_name = vendor_info ? vendor_info->short_name : "Unknown"; + } - const auto part_info = find_cpu_part(implementer_id, part_id); - if (!part_info) - { - core_names.push_back(fmt::format("%dx\"Unidentified cores\"", count)); - continue; - } + const auto part_info = find_cpu_part(implementer_id, part_id); + if (!part_info) + { + core_names.push_back(fmt::format("%dx\"Unidentified cores\"", count)); + continue; + } - if (part_family.empty() && part_info->family) - { - part_family = part_info->family; - } + if (part_family.empty() && part_info->family) + { + part_family = part_info->family; + } - core_names.push_back(fmt::format("%dx\"%s\"", count, part_info->name)); - } + core_names.push_back(fmt::format("%dx\"%s\"", count, part_info->name)); + } - // Assemble everything - std::string result = vendor_name + " "; - std::string suffix; - if (!part_family.empty()) - { - // Since we have a known family name, the core layout is just extra info. - // Wrap core layout in brackets. - result += part_family + " ("; - suffix = ")"; - } - result += fmt::merge(core_names, " + "); - result += suffix; - return result; - } + // Assemble everything + std::string result = vendor_name + " "; + std::string suffix; + if (!part_family.empty()) + { + // Since we have a known family name, the core layout is just extra info. + // Wrap core layout in brackets. + result += part_family + " ("; + suffix = ")"; + } + result += fmt::merge(core_names, " + "); + result += suffix; + return result; + } #else - static std::string sysctl_s(const std::string_view& variable_name) - { - // Determine required buffer size - size_t length = 0; - if (sysctlbyname(variable_name.data(), nullptr, &length, nullptr, 0) == -1) - { - return ""; - } + static std::string sysctl_s(const std::string_view& variable_name) + { + // Determine required buffer size + size_t length = 0; + if (sysctlbyname(variable_name.data(), nullptr, &length, nullptr, 0) == -1) + { + return ""; + } - // Allocate space for the variable. - std::vector text(length + 1); - text[length] = 0; - if (sysctlbyname(variable_name.data(), text.data(), &length, nullptr, 0) == -1) - { - return ""; - } + // Allocate space for the variable. + std::vector text(length + 1); + text[length] = 0; + if (sysctlbyname(variable_name.data(), text.data(), &length, nullptr, 0) == -1) + { + return ""; + } - return text.data(); - } + return text.data(); + } - static u64 sysctl_u64(const std::string_view& variable_name) - { - u64 value = 0; - size_t data_len = sizeof(value); - if (sysctlbyname(variable_name.data(), &value, &data_len, nullptr, 0) == -1) - { - return umax; - } - return value; - } + static u64 sysctl_u64(const std::string_view& variable_name) + { + u64 value = 0; + size_t data_len = sizeof(value); + if (sysctlbyname(variable_name.data(), &value, &data_len, nullptr, 0) == -1) + { + return umax; + } + return value; + } - // We can get the brand name from sysctl directly - // Once we have windows implemented, we should probably separate the different OS-dependent bits to avoid clutter - std::string get_cpu_brand() - { - const auto brand = sysctl_s("machdep.cpu.brand_string"); - if (brand.empty()) - { - return "Unidentified CPU"; - } + // We can get the brand name from sysctl directly + // Once we have windows implemented, we should probably separate the different OS-dependent bits to avoid clutter + std::string get_cpu_brand() + { + const auto brand = sysctl_s("machdep.cpu.brand_string"); + if (brand.empty()) + { + return "Unidentified CPU"; + } - // Parse extra core information (P and E cores) - if (sysctl_u64("hw.nperflevels") < 2) - { - return brand; - } + // Parse extra core information (P and E cores) + if (sysctl_u64("hw.nperflevels") < 2) + { + return brand; + } - u64 pcores = sysctl_u64("hw.perflevel0.physicalcpu"); - u64 ecores = sysctl_u64("hw.perflevel1.physicalcpu"); + u64 pcores = sysctl_u64("hw.perflevel0.physicalcpu"); + u64 ecores = sysctl_u64("hw.perflevel1.physicalcpu"); - if (sysctl_s("hw.perflevel0.name") == "Efficiency") - { - std::swap(ecores, pcores); - } + if (sysctl_s("hw.perflevel0.name") == "Efficiency") + { + std::swap(ecores, pcores); + } - return fmt::format("%s (%lluP+%lluE)", brand, pcores, ecores); - } + return fmt::format("%s (%lluP+%lluE)", brand, pcores, ecores); + } #endif -} +} // namespace aarch64 diff --git a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Common.h b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Common.h index de373909d..50ec45100 100644 --- a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Common.h +++ b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Common.h @@ -5,39 +5,63 @@ namespace aarch64 { - enum gpr : s32 - { - x0 = 0, - x1, x2, x3, x4, x5, x6, x7, x8, x9, - x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, - x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x30 - }; + enum gpr : s32 + { + x0 = 0, + x1, + x2, + x3, + x4, + x5, + x6, + x7, + x8, + x9, + x10, + x11, + x12, + x13, + x14, + x15, + x16, + x17, + x18, + x19, + x20, + x21, + x22, + x23, + x24, + x25, + x26, + x27, + x28, + x29, + x30 + }; - enum spr : s32 - { - xzr = 0, - pc, - sp - }; + enum spr : s32 + { + xzr = 0, + pc, + sp + }; - static const char* gpr_names[] = - { - "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", - "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "x19", - "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "x29", "x30" - }; + static const char* gpr_names[] = + { + "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", + "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "x19", + "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "x29", "x30"}; - static const char* spr_names[] = - { - "xzr", "pc", "sp" - }; + static const char* spr_names[] = + { + "xzr", "pc", "sp"}; - static const char* spr_asm_names[] = - { - "xzr", ".", "sp" - }; + static const char* spr_asm_names[] = + { + "xzr", ".", "sp"}; - const char *get_cpu_name(int cpu); - std::string get_cpu_name(); - std::string get_cpu_brand(); -} + const char* get_cpu_name(int cpu); + std::string get_cpu_name(); + std::string get_cpu_brand(); +} // namespace aarch64 diff --git a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64JIT.cpp b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64JIT.cpp index 91aedffd8..0400add6a 100644 --- a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64JIT.cpp +++ b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64JIT.cpp @@ -7,12 +7,13 @@ LOG_CHANNEL(jit_log, "JIT"); #define STDOUT_DEBUG 0 -#define DPRINT1(...)\ - do {\ - printf(__VA_ARGS__);\ - printf("\n");\ - fflush(stdout);\ - } while (0) +#define DPRINT1(...) \ + do \ + { \ + printf(__VA_ARGS__); \ + printf("\n"); \ + fflush(stdout); \ + } while (0) #if STDOUT_DEBUG #define DPRINT DPRINT1 @@ -22,529 +23,530 @@ LOG_CHANNEL(jit_log, "JIT"); namespace aarch64 { - using instruction_info_t = GHC_frame_preservation_pass::instruction_info_t; - using function_info_t = GHC_frame_preservation_pass::function_info_t; - - GHC_frame_preservation_pass::GHC_frame_preservation_pass(const config_t& configuration) - : m_config(configuration) - {} - - void GHC_frame_preservation_pass::reset() - { - m_visited_functions.clear(); - } - - void GHC_frame_preservation_pass::force_tail_call_terminators(llvm::Function& f) - { - // GHC functions are not call-stack preserving and can therefore never return if they make any external calls at all. - // Replace every terminator clause with a tail call explicitly. This is already done for X64 to work, but better safe than sorry. - for (auto& bb : f) - { - auto bit = bb.begin(), prev = bb.end(); - for (; bit != bb.end(); prev = bit, ++bit) - { - if (prev == bb.end()) - { - continue; - } - - if (llvm::isa(&*bit)) - { - if (auto ci = llvm::dyn_cast(&*prev)) - { - // This is a "ret" that is coming after a "call" to another funciton. - // Enforce that it must be a tail call. - if (!ci->isTailCall()) - { - ci->setTailCall(); - } - } - } - } - } - } - - function_info_t GHC_frame_preservation_pass::preprocess_function(const llvm::Function& f) - { - function_info_t result{}; - result.instruction_count = f.getInstructionCount(); - - // Blanket exclusions. Stubs or dispatchers that do not compute anything themselves. - if (f.getName() == "__spu-null") - { - // Don't waste the effort processing this stub. It has no points of concern - result.num_external_calls = 1; - return result; - } - - if (m_config.use_stack_frames) - { - // Stack frame estimation. SPU code can be very long and consumes several KB of stack. - u32 stack_frame_size = 128u; - // Actual ratio is usually around 1:4 - const u32 expected_compiled_instr_count = f.getInstructionCount() * 4; - // Because GHC doesn't preserve stack (all stack is scratch), we know we'll start to spill once we go over the number of actual regs. - // We use a naive allocator that just assumes each instruction consumes a register slot. We "spill" every 32 instructions. - // FIXME: Aggressive spill is only really a thing with vector operations. We can detect those instead. - // A proper fix is to port this to a MF pass, but I have PTSD from working at MF level. - const u32 spill_pages = (expected_compiled_instr_count + 127u) / 128u; - stack_frame_size *= std::min(spill_pages, 32u); // 128 to 4k dynamic. It is unlikely that any frame consumes more than 4096 bytes - - result.stack_frame_size = stack_frame_size; - } - - result.instruction_count = f.getInstructionCount(); - result.num_external_calls = 0; - - // The LR is not spared by LLVM in cases where there is a lot of spilling. - // This is much easier to manage with a custom LLVM branch as we can just mark X30 as off-limits as a GPR. - // This is another thing to be moved to a MachineFunction pass. Ideally we should check the instruction stream for writes to LR and reload it on exit. - // For now, assume it is dirtied if the function is of any reasonable length. - result.clobbers_x30 = result.instruction_count > 32; - result.is_leaf = true; - - for (auto& bb : f) - { - for (auto& inst : bb) - { - if (auto ci = llvm::dyn_cast(&inst)) - { - if (llvm::isa(ci->getCalledOperand())) - { - // Inline ASM blocks are ignored - continue; - } - - result.num_external_calls++; - if (ci->isTailCall()) - { - // This is not a leaf if it has at least one exit point / terminator that is not a return instruction. - result.is_leaf = false; - } - else - { - // Returning calls always clobber x30 - result.clobbers_x30 = true; - } - } - } - } - - return result; - } - - instruction_info_t GHC_frame_preservation_pass::decode_instruction(const llvm::Function& f, const llvm::Instruction* i) - { - instruction_info_t result{}; - if (auto ci = llvm::dyn_cast(i)) - { - // Watch out for injected ASM blocks... - if (llvm::isa(ci->getCalledOperand())) - { - // Not a real call. This is just an insert of inline asm - return result; - } - - result.is_call_inst = true; - result.is_returning = true; - result.preserve_stack = !ci->isTailCall(); - result.callee = ci->getCalledFunction(); - result.is_tail_call = ci->isTailCall(); - - if (!result.callee) - { - // Indirect call (call from raw value). - result.is_indirect = true; - result.callee_is_GHC = ci->getCallingConv() == llvm::CallingConv::GHC; - result.callee_name = "__indirect_call"; - } - else - { - result.callee_is_GHC = result.callee->getCallingConv() == llvm::CallingConv::GHC; - result.callee_name = result.callee->getName().str(); - } - return result; - } - - if (auto bi = llvm::dyn_cast(i)) - { - // More likely to jump out via an unconditional... - if (!bi->isConditional()) - { - ensure(bi->getNumSuccessors() == 1); - auto targetbb = bi->getSuccessor(0); - - result.callee = targetbb->getParent(); - result.callee_name = result.callee->getName().str(); - result.is_call_inst = result.callee_name != f.getName(); - } - - return result; - } - - if (auto bi = llvm::dyn_cast(i)) - { - // Very unlikely to be the same function. Can be considered a function exit. - ensure(bi->getNumDestinations() == 1); - auto targetbb = ensure(bi->getSuccessor(0)); // This is guaranteed to fail but I've yet to encounter this - - result.callee = targetbb->getParent(); - result.callee_name = result.callee->getName().str(); - result.is_call_inst = result.callee_name != f.getName(); - return result; - } - - if (auto bi = llvm::dyn_cast(i)) - { - ensure(bi->getNumSuccessors() == 1); - auto targetbb = bi->getSuccessor(0); - - result.callee = targetbb->getParent(); - result.callee_name = result.callee->getName().str(); - result.is_call_inst = result.callee_name != f.getName(); - return result; - } - - if (auto bi = llvm::dyn_cast(i)) - { - ensure(bi->getNumSuccessors() == 2); - auto targetbb = bi->getSuccessor(0); - - result.callee = targetbb->getParent(); - result.callee_name = result.callee->getName().str(); - result.is_call_inst = result.callee_name != f.getName(); - return result; - } - - return result; - } - - gpr GHC_frame_preservation_pass::get_base_register_for_call(const std::string& callee_name, gpr default_reg) - { - // We go over the base_register_lookup table and find the first matching pattern - for (const auto& pattern : m_config.base_register_lookup) - { - if (callee_name.starts_with(pattern.first)) - { - return pattern.second; - } - } - - return default_reg; - } - - void GHC_frame_preservation_pass::run(llvm::IRBuilder<>* irb, llvm::Function& f) - { - if (f.getCallingConv() != llvm::CallingConv::GHC) - { - // If we're not doing GHC, the calling conv will have stack fixup on its own via prologue/epilogue - return; - } - - if (f.getInstructionCount() == 0) - { - // Nothing to do. Happens with placeholder functions such as branch patchpoints - return; - } - - const auto this_name = f.getName().str(); - if (m_visited_functions.find(this_name) != m_visited_functions.end()) - { - // Already processed. Only useful when recursing which is currently not used. - DPRINT("Function %s was already processed. Skipping.\n", this_name.c_str()); - return; - } - - if (this_name != "__spu-null") // This name is meaningless and doesn't uniquely identify a function - { - m_visited_functions.insert(this_name); - } - - if (m_config.exclusion_callback && m_config.exclusion_callback(this_name)) - { - // Function is explicitly excluded - return; - } - - // Preprocessing. - auto function_info = preprocess_function(f); - if (function_info.num_external_calls == 0 && function_info.stack_frame_size == 0) - { - // No stack frame injection and no external calls to patch up. This is a leaf function, nothing to do. - DPRINT("Ignoring function %s", this_name.c_str()); - return; - } - - // Force tail calls on all terminators - force_tail_call_terminators(f); - - // Check for leaves - if (function_info.is_leaf && !m_config.use_stack_frames) - { - // Sanity check. If this function had no returning calls, it should have been omitted from processing. - ensure(function_info.clobbers_x30, "Function has no terminator and no non-tail calls but was allowed for frame processing!"); - DPRINT("Function %s is a leaf.", this_name.c_str()); - process_leaf_function(irb, f); - return; - } - - // Asm snippets for patching stack frame - ASMBlock frame_prologue, frame_epilogue; - - if (function_info.stack_frame_size > 0) - { - // NOTE: The stack frame here is purely optional, we can pre-allocate scratch on the gateway. - // However, that is an optimization for another time, this helps make debugging easier. - frame_prologue.sub(sp, sp, UASM::Imm(function_info.stack_frame_size)); - frame_epilogue.add(sp, sp, UASM::Imm(function_info.stack_frame_size)); - - // Emit the frame prologue. We use a BB here for extra safety as it solves the problem of backwards jumps re-executing the prologue. - auto functionStart = &f.front(); - auto prologueBB = llvm::BasicBlock::Create(f.getContext(), "", &f, functionStart); - irb->SetInsertPoint(prologueBB, prologueBB->begin()); - frame_prologue.insert(irb, f.getContext()); - irb->CreateBr(functionStart); - } - - // Now we start processing - bool terminator_found = false; - for (auto& bb : f) - { - for (auto bit = bb.begin(); bit != bb.end();) - { - const auto instruction_info = decode_instruction(f, &(*bit)); - if (!instruction_info.is_call_inst) - { - ++bit; - continue; - } - - std::string callee_name = "__unknown"; - if (const auto cf = instruction_info.callee) - { - callee_name = cf->getName().str(); - if (cf->hasFnAttribute(llvm::Attribute::AlwaysInline) || callee_name.starts_with("llvm.")) - { - // Always inlined call. Likely inline Asm. Skip - ++bit; - continue; - } - - // Technically We should also ignore any host functions linked in, usually starting with ppu_ or spu_ prefix. - // However, there is not much guarantee that those are safe with only rare exceptions, and it doesn't hurt to patch the frame around them that much anyway. - } - - if (instruction_info.preserve_stack) - { - // Non-tail call. If we have a stack allocated, we preserve it across the call - ++bit; - continue; - } - - ensure(instruction_info.is_tail_call); - terminator_found = true; - - // Now we patch the call if required. For normal calls that 'return' (i.e calls to C/C++ ABI), we do not patch them as they will manage the stack themselves (callee-managed) - bit = patch_tail_call(irb, f, bit, instruction_info, function_info, frame_epilogue); - - // Next - if (bit != bb.end()) - { - ++bit; - } - } - } - - if (!terminator_found) - { - // If we got here, we must be using stack frames. - ensure(function_info.is_leaf && function_info.stack_frame_size > 0, "Leaf function was processed without using stack frames!"); - - // We want to insert a frame cleanup at the tail at every return instruction we find. - for (auto& bb : f) - { - for (auto& i : bb) - { - if (is_ret_instruction(&i)) - { - irb->SetInsertPoint(&i); - frame_epilogue.insert(irb, f.getContext()); - } - } - } - } - } - - llvm::BasicBlock::iterator - GHC_frame_preservation_pass::patch_tail_call( - llvm::IRBuilder<>* irb, - llvm::Function& f, - llvm::BasicBlock::iterator where, - const instruction_info_t& instruction_info, - const function_info_t& function_info, - const UASM& frame_epilogue) - { - auto ci = llvm::dyn_cast(where); - irb->SetInsertPoint(ensure(ci)); - - const auto this_name = f.getName().str(); - - // Insert breadcrumb info before the call - // WARNING: This can corrupt the call because LLVM somehow ignores the clobbered register during a call instruction for some reason - // In case of a blr on x27..x29 you can end up corrupting the binary, but it is invaluable for debugging. - // Debug frames are disabled in shipping code so this is not a big deal. - if (m_config.debug_info) - { - // Call-chain tracing - ASMBlock c; - c.mov(x29, x28); - c.mov(x28, x27); - c.adr(x27, UASM::Reg(pc)); - c.insert(irb, f.getContext()); - } - - // Clean up any injected frames before the call - if (function_info.stack_frame_size > 0) - { - frame_epilogue.insert(irb, f.getContext()); - } - - // Insert the next piece after the call, before the ret - ++where; - ensure(llvm::isa(where)); - irb->SetInsertPoint(llvm::dyn_cast(where)); - - if (instruction_info.callee_is_GHC && // Calls to C++ ABI will always return - !instruction_info.is_indirect && // We don't know enough when calling indirectly to know if we'll return or not - !is_faux_function(instruction_info.callee_name)) // Ignore branch patch-points and imposter functions. Their behavior is unreliable. - { - // We're making a one-way call. This branch shouldn't even bother linking as it will never return here. - ASMBlock c; - c.brk(0x99); - c.insert(irb, f.getContext()); - return where; - } - - // Patch the return path. No GHC call shall ever return to another. If we reach the function endpoint, immediately abort to GW - auto thread_base_reg = get_base_register_for_call(f.getName().str()); - auto arg_index = static_cast(thread_base_reg) - static_cast(x19); - ASMBlock c; - - auto thread_arg = ensure(f.getArg(arg_index)); // Guaranteed to hold our original 'thread' - c.mov(x30, UASM::Var(thread_arg)); - c.ldr(x30, x30, UASM::Imm(m_config.hypervisor_context_offset)); - c.insert(irb, f.getContext()); - - // Next - return where; - } - - bool GHC_frame_preservation_pass::is_ret_instruction(const llvm::Instruction* i) - { - if (llvm::isa(i)) - { - return true; - } - - // Check for inline asm invoking "ret". This really shouldn't be a thing, but it is present in SPULLVMRecompiler for some reason. - if (auto ci = llvm::dyn_cast(i)) - { - if (auto asm_ = llvm::dyn_cast(ci->getCalledOperand())) - { - if (asm_->getAsmString() == "ret") - { - return true; - } - } - } - - return false; - } - - bool GHC_frame_preservation_pass::is_inlined_call(const llvm::CallInst* ci) - { - const auto callee = ci->getCalledFunction(); - if (!callee) - { - // Indirect BLR - return false; - } - - const std::string callee_name = callee->getName().str(); - if (callee_name.starts_with("llvm.")) - { - // Intrinsic - return true; - } - - if (callee->hasFnAttribute(llvm::Attribute::AlwaysInline)) - { - // Assume LLVM always obeys this - return true; - } - - return false; - } - - bool GHC_frame_preservation_pass::is_faux_function(const std::string& function_name) - { - // Is it a branch patch-point? - if (function_name.find("-pp-") != umax) - { - return true; - } - - // Now we search the known imposters list - if (m_config.faux_function_list.empty()) - { - return false; - } - - const auto& x = m_config.faux_function_list; - return std::find(x.begin(), x.end(), function_name) != x.end(); - } - - void GHC_frame_preservation_pass::process_leaf_function(llvm::IRBuilder<>* irb, llvm::Function& f) - { - for (auto &bb : f) - { - for (auto bit = bb.begin(); bit != bb.end();) - { - auto i = llvm::dyn_cast(bit); - if (!is_ret_instruction(i)) - { - ++bit; - continue; - } - - // Insert sequence before the return - irb->SetInsertPoint(llvm::dyn_cast(bit)); - - if (m_config.debug_info) - { - // We need to save the chain return point. - ASMBlock c; - c.mov(x29, x28); - c.mov(x28, x27); - c.adr(x27, UASM::Reg(pc)); - c.insert(irb, f.getContext()); - } - - // Now we need to reload LR. We abuse the function's caller arg set for this to avoid messing with regs too much - auto thread_base_reg = get_base_register_for_call(f.getName().str()); - auto arg_index = static_cast(thread_base_reg) - static_cast(x19); - ASMBlock c; - - auto thread_arg = ensure(f.getArg(arg_index)); // Guaranteed to hold our original 'thread' - c.mov(x30, UASM::Var(thread_arg)); - c.ldr(x30, x30, UASM::Imm(m_config.hypervisor_context_offset)); - c.insert(irb, f.getContext()); - - if (bit != bb.end()) - { - ++bit; - } - } - } - } -} + using instruction_info_t = GHC_frame_preservation_pass::instruction_info_t; + using function_info_t = GHC_frame_preservation_pass::function_info_t; + + GHC_frame_preservation_pass::GHC_frame_preservation_pass(const config_t& configuration) + : m_config(configuration) + { + } + + void GHC_frame_preservation_pass::reset() + { + m_visited_functions.clear(); + } + + void GHC_frame_preservation_pass::force_tail_call_terminators(llvm::Function& f) + { + // GHC functions are not call-stack preserving and can therefore never return if they make any external calls at all. + // Replace every terminator clause with a tail call explicitly. This is already done for X64 to work, but better safe than sorry. + for (auto& bb : f) + { + auto bit = bb.begin(), prev = bb.end(); + for (; bit != bb.end(); prev = bit, ++bit) + { + if (prev == bb.end()) + { + continue; + } + + if (llvm::isa(&*bit)) + { + if (auto ci = llvm::dyn_cast(&*prev)) + { + // This is a "ret" that is coming after a "call" to another funciton. + // Enforce that it must be a tail call. + if (!ci->isTailCall()) + { + ci->setTailCall(); + } + } + } + } + } + } + + function_info_t GHC_frame_preservation_pass::preprocess_function(const llvm::Function& f) + { + function_info_t result{}; + result.instruction_count = f.getInstructionCount(); + + // Blanket exclusions. Stubs or dispatchers that do not compute anything themselves. + if (f.getName() == "__spu-null") + { + // Don't waste the effort processing this stub. It has no points of concern + result.num_external_calls = 1; + return result; + } + + if (m_config.use_stack_frames) + { + // Stack frame estimation. SPU code can be very long and consumes several KB of stack. + u32 stack_frame_size = 128u; + // Actual ratio is usually around 1:4 + const u32 expected_compiled_instr_count = f.getInstructionCount() * 4; + // Because GHC doesn't preserve stack (all stack is scratch), we know we'll start to spill once we go over the number of actual regs. + // We use a naive allocator that just assumes each instruction consumes a register slot. We "spill" every 32 instructions. + // FIXME: Aggressive spill is only really a thing with vector operations. We can detect those instead. + // A proper fix is to port this to a MF pass, but I have PTSD from working at MF level. + const u32 spill_pages = (expected_compiled_instr_count + 127u) / 128u; + stack_frame_size *= std::min(spill_pages, 32u); // 128 to 4k dynamic. It is unlikely that any frame consumes more than 4096 bytes + + result.stack_frame_size = stack_frame_size; + } + + result.instruction_count = f.getInstructionCount(); + result.num_external_calls = 0; + + // The LR is not spared by LLVM in cases where there is a lot of spilling. + // This is much easier to manage with a custom LLVM branch as we can just mark X30 as off-limits as a GPR. + // This is another thing to be moved to a MachineFunction pass. Ideally we should check the instruction stream for writes to LR and reload it on exit. + // For now, assume it is dirtied if the function is of any reasonable length. + result.clobbers_x30 = result.instruction_count > 32; + result.is_leaf = true; + + for (auto& bb : f) + { + for (auto& inst : bb) + { + if (auto ci = llvm::dyn_cast(&inst)) + { + if (llvm::isa(ci->getCalledOperand())) + { + // Inline ASM blocks are ignored + continue; + } + + result.num_external_calls++; + if (ci->isTailCall()) + { + // This is not a leaf if it has at least one exit point / terminator that is not a return instruction. + result.is_leaf = false; + } + else + { + // Returning calls always clobber x30 + result.clobbers_x30 = true; + } + } + } + } + + return result; + } + + instruction_info_t GHC_frame_preservation_pass::decode_instruction(const llvm::Function& f, const llvm::Instruction* i) + { + instruction_info_t result{}; + if (auto ci = llvm::dyn_cast(i)) + { + // Watch out for injected ASM blocks... + if (llvm::isa(ci->getCalledOperand())) + { + // Not a real call. This is just an insert of inline asm + return result; + } + + result.is_call_inst = true; + result.is_returning = true; + result.preserve_stack = !ci->isTailCall(); + result.callee = ci->getCalledFunction(); + result.is_tail_call = ci->isTailCall(); + + if (!result.callee) + { + // Indirect call (call from raw value). + result.is_indirect = true; + result.callee_is_GHC = ci->getCallingConv() == llvm::CallingConv::GHC; + result.callee_name = "__indirect_call"; + } + else + { + result.callee_is_GHC = result.callee->getCallingConv() == llvm::CallingConv::GHC; + result.callee_name = result.callee->getName().str(); + } + return result; + } + + if (auto bi = llvm::dyn_cast(i)) + { + // More likely to jump out via an unconditional... + if (!bi->isConditional()) + { + ensure(bi->getNumSuccessors() == 1); + auto targetbb = bi->getSuccessor(0); + + result.callee = targetbb->getParent(); + result.callee_name = result.callee->getName().str(); + result.is_call_inst = result.callee_name != f.getName(); + } + + return result; + } + + if (auto bi = llvm::dyn_cast(i)) + { + // Very unlikely to be the same function. Can be considered a function exit. + ensure(bi->getNumDestinations() == 1); + auto targetbb = ensure(bi->getSuccessor(0)); // This is guaranteed to fail but I've yet to encounter this + + result.callee = targetbb->getParent(); + result.callee_name = result.callee->getName().str(); + result.is_call_inst = result.callee_name != f.getName(); + return result; + } + + if (auto bi = llvm::dyn_cast(i)) + { + ensure(bi->getNumSuccessors() == 1); + auto targetbb = bi->getSuccessor(0); + + result.callee = targetbb->getParent(); + result.callee_name = result.callee->getName().str(); + result.is_call_inst = result.callee_name != f.getName(); + return result; + } + + if (auto bi = llvm::dyn_cast(i)) + { + ensure(bi->getNumSuccessors() == 2); + auto targetbb = bi->getSuccessor(0); + + result.callee = targetbb->getParent(); + result.callee_name = result.callee->getName().str(); + result.is_call_inst = result.callee_name != f.getName(); + return result; + } + + return result; + } + + gpr GHC_frame_preservation_pass::get_base_register_for_call(const std::string& callee_name, gpr default_reg) + { + // We go over the base_register_lookup table and find the first matching pattern + for (const auto& pattern : m_config.base_register_lookup) + { + if (callee_name.starts_with(pattern.first)) + { + return pattern.second; + } + } + + return default_reg; + } + + void GHC_frame_preservation_pass::run(llvm::IRBuilder<>* irb, llvm::Function& f) + { + if (f.getCallingConv() != llvm::CallingConv::GHC) + { + // If we're not doing GHC, the calling conv will have stack fixup on its own via prologue/epilogue + return; + } + + if (f.getInstructionCount() == 0) + { + // Nothing to do. Happens with placeholder functions such as branch patchpoints + return; + } + + const auto this_name = f.getName().str(); + if (m_visited_functions.find(this_name) != m_visited_functions.end()) + { + // Already processed. Only useful when recursing which is currently not used. + DPRINT("Function %s was already processed. Skipping.\n", this_name.c_str()); + return; + } + + if (this_name != "__spu-null") // This name is meaningless and doesn't uniquely identify a function + { + m_visited_functions.insert(this_name); + } + + if (m_config.exclusion_callback && m_config.exclusion_callback(this_name)) + { + // Function is explicitly excluded + return; + } + + // Preprocessing. + auto function_info = preprocess_function(f); + if (function_info.num_external_calls == 0 && function_info.stack_frame_size == 0) + { + // No stack frame injection and no external calls to patch up. This is a leaf function, nothing to do. + DPRINT("Ignoring function %s", this_name.c_str()); + return; + } + + // Force tail calls on all terminators + force_tail_call_terminators(f); + + // Check for leaves + if (function_info.is_leaf && !m_config.use_stack_frames) + { + // Sanity check. If this function had no returning calls, it should have been omitted from processing. + ensure(function_info.clobbers_x30, "Function has no terminator and no non-tail calls but was allowed for frame processing!"); + DPRINT("Function %s is a leaf.", this_name.c_str()); + process_leaf_function(irb, f); + return; + } + + // Asm snippets for patching stack frame + ASMBlock frame_prologue, frame_epilogue; + + if (function_info.stack_frame_size > 0) + { + // NOTE: The stack frame here is purely optional, we can pre-allocate scratch on the gateway. + // However, that is an optimization for another time, this helps make debugging easier. + frame_prologue.sub(sp, sp, UASM::Imm(function_info.stack_frame_size)); + frame_epilogue.add(sp, sp, UASM::Imm(function_info.stack_frame_size)); + + // Emit the frame prologue. We use a BB here for extra safety as it solves the problem of backwards jumps re-executing the prologue. + auto functionStart = &f.front(); + auto prologueBB = llvm::BasicBlock::Create(f.getContext(), "", &f, functionStart); + irb->SetInsertPoint(prologueBB, prologueBB->begin()); + frame_prologue.insert(irb, f.getContext()); + irb->CreateBr(functionStart); + } + + // Now we start processing + bool terminator_found = false; + for (auto& bb : f) + { + for (auto bit = bb.begin(); bit != bb.end();) + { + const auto instruction_info = decode_instruction(f, &(*bit)); + if (!instruction_info.is_call_inst) + { + ++bit; + continue; + } + + std::string callee_name = "__unknown"; + if (const auto cf = instruction_info.callee) + { + callee_name = cf->getName().str(); + if (cf->hasFnAttribute(llvm::Attribute::AlwaysInline) || callee_name.starts_with("llvm.")) + { + // Always inlined call. Likely inline Asm. Skip + ++bit; + continue; + } + + // Technically We should also ignore any host functions linked in, usually starting with ppu_ or spu_ prefix. + // However, there is not much guarantee that those are safe with only rare exceptions, and it doesn't hurt to patch the frame around them that much anyway. + } + + if (instruction_info.preserve_stack) + { + // Non-tail call. If we have a stack allocated, we preserve it across the call + ++bit; + continue; + } + + ensure(instruction_info.is_tail_call); + terminator_found = true; + + // Now we patch the call if required. For normal calls that 'return' (i.e calls to C/C++ ABI), we do not patch them as they will manage the stack themselves (callee-managed) + bit = patch_tail_call(irb, f, bit, instruction_info, function_info, frame_epilogue); + + // Next + if (bit != bb.end()) + { + ++bit; + } + } + } + + if (!terminator_found) + { + // If we got here, we must be using stack frames. + ensure(function_info.is_leaf && function_info.stack_frame_size > 0, "Leaf function was processed without using stack frames!"); + + // We want to insert a frame cleanup at the tail at every return instruction we find. + for (auto& bb : f) + { + for (auto& i : bb) + { + if (is_ret_instruction(&i)) + { + irb->SetInsertPoint(&i); + frame_epilogue.insert(irb, f.getContext()); + } + } + } + } + } + + llvm::BasicBlock::iterator + GHC_frame_preservation_pass::patch_tail_call( + llvm::IRBuilder<>* irb, + llvm::Function& f, + llvm::BasicBlock::iterator where, + const instruction_info_t& instruction_info, + const function_info_t& function_info, + const UASM& frame_epilogue) + { + auto ci = llvm::dyn_cast(where); + irb->SetInsertPoint(ensure(ci)); + + const auto this_name = f.getName().str(); + + // Insert breadcrumb info before the call + // WARNING: This can corrupt the call because LLVM somehow ignores the clobbered register during a call instruction for some reason + // In case of a blr on x27..x29 you can end up corrupting the binary, but it is invaluable for debugging. + // Debug frames are disabled in shipping code so this is not a big deal. + if (m_config.debug_info) + { + // Call-chain tracing + ASMBlock c; + c.mov(x29, x28); + c.mov(x28, x27); + c.adr(x27, UASM::Reg(pc)); + c.insert(irb, f.getContext()); + } + + // Clean up any injected frames before the call + if (function_info.stack_frame_size > 0) + { + frame_epilogue.insert(irb, f.getContext()); + } + + // Insert the next piece after the call, before the ret + ++where; + ensure(llvm::isa(where)); + irb->SetInsertPoint(llvm::dyn_cast(where)); + + if (instruction_info.callee_is_GHC && // Calls to C++ ABI will always return + !instruction_info.is_indirect && // We don't know enough when calling indirectly to know if we'll return or not + !is_faux_function(instruction_info.callee_name)) // Ignore branch patch-points and imposter functions. Their behavior is unreliable. + { + // We're making a one-way call. This branch shouldn't even bother linking as it will never return here. + ASMBlock c; + c.brk(0x99); + c.insert(irb, f.getContext()); + return where; + } + + // Patch the return path. No GHC call shall ever return to another. If we reach the function endpoint, immediately abort to GW + auto thread_base_reg = get_base_register_for_call(f.getName().str()); + auto arg_index = static_cast(thread_base_reg) - static_cast(x19); + ASMBlock c; + + auto thread_arg = ensure(f.getArg(arg_index)); // Guaranteed to hold our original 'thread' + c.mov(x30, UASM::Var(thread_arg)); + c.ldr(x30, x30, UASM::Imm(m_config.hypervisor_context_offset)); + c.insert(irb, f.getContext()); + + // Next + return where; + } + + bool GHC_frame_preservation_pass::is_ret_instruction(const llvm::Instruction* i) + { + if (llvm::isa(i)) + { + return true; + } + + // Check for inline asm invoking "ret". This really shouldn't be a thing, but it is present in SPULLVMRecompiler for some reason. + if (auto ci = llvm::dyn_cast(i)) + { + if (auto asm_ = llvm::dyn_cast(ci->getCalledOperand())) + { + if (asm_->getAsmString() == "ret") + { + return true; + } + } + } + + return false; + } + + bool GHC_frame_preservation_pass::is_inlined_call(const llvm::CallInst* ci) + { + const auto callee = ci->getCalledFunction(); + if (!callee) + { + // Indirect BLR + return false; + } + + const std::string callee_name = callee->getName().str(); + if (callee_name.starts_with("llvm.")) + { + // Intrinsic + return true; + } + + if (callee->hasFnAttribute(llvm::Attribute::AlwaysInline)) + { + // Assume LLVM always obeys this + return true; + } + + return false; + } + + bool GHC_frame_preservation_pass::is_faux_function(const std::string& function_name) + { + // Is it a branch patch-point? + if (function_name.find("-pp-") != umax) + { + return true; + } + + // Now we search the known imposters list + if (m_config.faux_function_list.empty()) + { + return false; + } + + const auto& x = m_config.faux_function_list; + return std::find(x.begin(), x.end(), function_name) != x.end(); + } + + void GHC_frame_preservation_pass::process_leaf_function(llvm::IRBuilder<>* irb, llvm::Function& f) + { + for (auto& bb : f) + { + for (auto bit = bb.begin(); bit != bb.end();) + { + auto i = llvm::dyn_cast(bit); + if (!is_ret_instruction(i)) + { + ++bit; + continue; + } + + // Insert sequence before the return + irb->SetInsertPoint(llvm::dyn_cast(bit)); + + if (m_config.debug_info) + { + // We need to save the chain return point. + ASMBlock c; + c.mov(x29, x28); + c.mov(x28, x27); + c.adr(x27, UASM::Reg(pc)); + c.insert(irb, f.getContext()); + } + + // Now we need to reload LR. We abuse the function's caller arg set for this to avoid messing with regs too much + auto thread_base_reg = get_base_register_for_call(f.getName().str()); + auto arg_index = static_cast(thread_base_reg) - static_cast(x19); + ASMBlock c; + + auto thread_arg = ensure(f.getArg(arg_index)); // Guaranteed to hold our original 'thread' + c.mov(x30, UASM::Var(thread_arg)); + c.ldr(x30, x30, UASM::Imm(m_config.hypervisor_context_offset)); + c.insert(irb, f.getContext()); + + if (bit != bb.end()) + { + ++bit; + } + } + } + } +} // namespace aarch64 diff --git a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64JIT.h b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64JIT.h index 701fe85be..423299996 100644 --- a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64JIT.h +++ b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64JIT.h @@ -10,80 +10,80 @@ namespace aarch64 { - class UASM; - using ASMBlock = UASM; + class UASM; + using ASMBlock = UASM; - // On non-x86 architectures GHC runs stackless. SP is treated as a pointer to scratchpad memory. - // This pass keeps this behavior intact while preserving the expectations of the host's C++ ABI. - class GHC_frame_preservation_pass : public translator_pass - { - public: - struct function_info_t - { - u32 instruction_count; - u32 num_external_calls; - u32 stack_frame_size; // Guessing this properly is critical for vector-heavy functions where spilling is a lot more common - bool clobbers_x30; - bool is_leaf; - }; + // On non-x86 architectures GHC runs stackless. SP is treated as a pointer to scratchpad memory. + // This pass keeps this behavior intact while preserving the expectations of the host's C++ ABI. + class GHC_frame_preservation_pass : public translator_pass + { + public: + struct function_info_t + { + u32 instruction_count; + u32 num_external_calls; + u32 stack_frame_size; // Guessing this properly is critical for vector-heavy functions where spilling is a lot more common + bool clobbers_x30; + bool is_leaf; + }; - struct instruction_info_t - { - bool is_call_inst; // Is a function call. This includes a branch to external code. - bool preserve_stack; // Preserve the stack around this call. - bool is_returning; // This instruction "returns" to the next instruction (typically just llvm::CallInst*) - bool callee_is_GHC; // The other function is GHC - bool is_tail_call; // Tail call. Assume it is an exit/terminator. - bool is_indirect; // Indirect call. Target is the first operand. - llvm::Function* callee; // Callee if any - std::string callee_name; // Name of the callee. - }; + struct instruction_info_t + { + bool is_call_inst; // Is a function call. This includes a branch to external code. + bool preserve_stack; // Preserve the stack around this call. + bool is_returning; // This instruction "returns" to the next instruction (typically just llvm::CallInst*) + bool callee_is_GHC; // The other function is GHC + bool is_tail_call; // Tail call. Assume it is an exit/terminator. + bool is_indirect; // Indirect call. Target is the first operand. + llvm::Function* callee; // Callee if any + std::string callee_name; // Name of the callee. + }; - struct config_t - { - bool debug_info = false; // Record debug information - bool use_stack_frames = true; // Allocate a stack frame for each function. The gateway can alternatively manage a global stack to use as scratch. - bool optimize = true; // Optimize instructions when possible. Set to false when debugging. - u32 hypervisor_context_offset = 0; // Offset within the "thread" object where we can find the hypervisor context (registers configured at gateway). - std::function exclusion_callback; // [Optional] Callback run on each function before transform. Return "true" to exclude from frame processing. - std::vector> base_register_lookup; // [Optional] Function lookup table to determine the location of the "thread" context. - std::vector faux_function_list; // [Optional] List of faux block names to treat as untrusted - typically fake functions representing codecaves. - }; + struct config_t + { + bool debug_info = false; // Record debug information + bool use_stack_frames = true; // Allocate a stack frame for each function. The gateway can alternatively manage a global stack to use as scratch. + bool optimize = true; // Optimize instructions when possible. Set to false when debugging. + u32 hypervisor_context_offset = 0; // Offset within the "thread" object where we can find the hypervisor context (registers configured at gateway). + std::function exclusion_callback; // [Optional] Callback run on each function before transform. Return "true" to exclude from frame processing. + std::vector> base_register_lookup; // [Optional] Function lookup table to determine the location of the "thread" context. + std::vector faux_function_list; // [Optional] List of faux block names to treat as untrusted - typically fake functions representing codecaves. + }; - protected: - std::unordered_set m_visited_functions; + protected: + std::unordered_set m_visited_functions; - config_t m_config; + config_t m_config; - void force_tail_call_terminators(llvm::Function& f); + void force_tail_call_terminators(llvm::Function& f); - function_info_t preprocess_function(const llvm::Function& f); + function_info_t preprocess_function(const llvm::Function& f); - instruction_info_t decode_instruction(const llvm::Function& f, const llvm::Instruction* i); + instruction_info_t decode_instruction(const llvm::Function& f, const llvm::Instruction* i); - bool is_ret_instruction(const llvm::Instruction* i); + bool is_ret_instruction(const llvm::Instruction* i); - bool is_inlined_call(const llvm::CallInst* ci); + bool is_inlined_call(const llvm::CallInst* ci); - bool is_faux_function(const std::string& function_name); + bool is_faux_function(const std::string& function_name); - gpr get_base_register_for_call(const std::string& callee_name, gpr default_reg = gpr::x19); + gpr get_base_register_for_call(const std::string& callee_name, gpr default_reg = gpr::x19); - void process_leaf_function(llvm::IRBuilder<>* irb, llvm::Function& f); + void process_leaf_function(llvm::IRBuilder<>* irb, llvm::Function& f); - llvm::BasicBlock::iterator patch_tail_call( - llvm::IRBuilder<>* irb, - llvm::Function& f, - llvm::BasicBlock::iterator where, - const instruction_info_t& instruction_info, - const function_info_t& function_info, - const ASMBlock& frame_epilogue); - public: + llvm::BasicBlock::iterator patch_tail_call( + llvm::IRBuilder<>* irb, + llvm::Function& f, + llvm::BasicBlock::iterator where, + const instruction_info_t& instruction_info, + const function_info_t& function_info, + const ASMBlock& frame_epilogue); - GHC_frame_preservation_pass(const config_t& configuration); - ~GHC_frame_preservation_pass() = default; + public: + GHC_frame_preservation_pass(const config_t& configuration); + ~GHC_frame_preservation_pass() = default; - void run(llvm::IRBuilder<>* irb, llvm::Function& f) override; - void reset() override; - }; -} + void run(llvm::IRBuilder<>* irb, llvm::Function& f) override; + void reset() override; + }; +} // namespace aarch64 diff --git a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Signal.cpp b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Signal.cpp index 48b651d1a..49e7d9035 100644 --- a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Signal.cpp +++ b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Signal.cpp @@ -3,103 +3,103 @@ namespace aarch64 { - // Some of the EC codes we care about - enum class EL1_exception_class - { - undefined = 0, + // Some of the EC codes we care about + enum class EL1_exception_class + { + undefined = 0, - instr_abort_0 = 32, // PAGE_FAULT - Execute, change in EL - instr_abort_1 = 33, // PAGE_FAULT - Execute, same EL - data_abort_0 = 36, // PAGE_FAULT - Generic, causing change in EL (e.g kernel sig handler back to EL0) - data_abort_1 = 37, // PAGE_FAULT - Generic, no change in EL, e.g EL1 driver fault + instr_abort_0 = 32, // PAGE_FAULT - Execute, change in EL + instr_abort_1 = 33, // PAGE_FAULT - Execute, same EL + data_abort_0 = 36, // PAGE_FAULT - Generic, causing change in EL (e.g kernel sig handler back to EL0) + data_abort_1 = 37, // PAGE_FAULT - Generic, no change in EL, e.g EL1 driver fault - illegal_execution = 14, // BUS_ERROR - unaligned_pc = 34, // BUS_ERROR - unaligned_sp = 38, // BUS_ERROR + illegal_execution = 14, // BUS_ERROR + unaligned_pc = 34, // BUS_ERROR + unaligned_sp = 38, // BUS_ERROR - breakpoint = 60, // BRK - }; + breakpoint = 60, // BRK + }; #ifdef __linux__ - constexpr u32 ESR_CTX_MAGIC = 0x45535201; + constexpr u32 ESR_CTX_MAGIC = 0x45535201; - const aarch64_esr_ctx* find_EL1_esr_context(const ucontext_t* ctx) - { - u32 offset = 0; - const auto& mctx = ctx->uc_mcontext; + const aarch64_esr_ctx* find_EL1_esr_context(const ucontext_t* ctx) + { + u32 offset = 0; + const auto& mctx = ctx->uc_mcontext; - while ((offset + 4) < sizeof(mctx.__reserved)) - { - const auto head = reinterpret_cast(&mctx.__reserved[offset]); - if (!head->magic) - { - // End of linked list - return nullptr; - } + while ((offset + 4) < sizeof(mctx.__reserved)) + { + const auto head = reinterpret_cast(&mctx.__reserved[offset]); + if (!head->magic) + { + // End of linked list + return nullptr; + } - if (head->magic == ESR_CTX_MAGIC) - { - return reinterpret_cast(head); - } + if (head->magic == ESR_CTX_MAGIC) + { + return reinterpret_cast(head); + } - offset += head->size; - } + offset += head->size; + } - return nullptr; - } + return nullptr; + } - u64 _read_ESR_EL1(const ucontext_t* uctx) - { - auto esr_ctx = find_EL1_esr_context(uctx); - return esr_ctx ? esr_ctx->esr : 0; - } + u64 _read_ESR_EL1(const ucontext_t* uctx) + { + auto esr_ctx = find_EL1_esr_context(uctx); + return esr_ctx ? esr_ctx->esr : 0; + } #elif defined(__APPLE__) - u64 _read_ESR_EL1(const ucontext_t* uctx) - { - // Easy to read from mcontext - const auto darwin_ctx = reinterpret_cast(uctx->uc_mcontext); - return darwin_ctx->es.ESR; - } + u64 _read_ESR_EL1(const ucontext_t* uctx) + { + // Easy to read from mcontext + const auto darwin_ctx = reinterpret_cast(uctx->uc_mcontext); + return darwin_ctx->es.ESR; + } #else - u64 _read_ESR_EL1(const ucontext_t*) - { - // Unimplemented - return 0; - } + u64 _read_ESR_EL1(const ucontext_t*) + { + // Unimplemented + return 0; + } #endif - fault_reason decode_fault_reason(const ucontext_t* uctx) - { - auto esr = _read_ESR_EL1(uctx); - if (!esr) - { - return fault_reason::undefined; - } + fault_reason decode_fault_reason(const ucontext_t* uctx) + { + auto esr = _read_ESR_EL1(uctx); + if (!esr) + { + return fault_reason::undefined; + } - // We don't really care about most of the register fields, but we can check for a few things. - const auto exception_class = (esr >> 26) & 0b111111; - switch (static_cast(exception_class)) - { - case EL1_exception_class::breakpoint: - // Debug break - return fault_reason::breakpoint; - case EL1_exception_class::illegal_execution: - case EL1_exception_class::unaligned_pc: - case EL1_exception_class::unaligned_sp: - return fault_reason::illegal_instruction; - case EL1_exception_class::instr_abort_0: - case EL1_exception_class::instr_abort_1: - return fault_reason::instruction_execute; - case EL1_exception_class::data_abort_0: - case EL1_exception_class::data_abort_1: - // Page fault - break; - default: - return fault_reason::undefined; - } + // We don't really care about most of the register fields, but we can check for a few things. + const auto exception_class = (esr >> 26) & 0b111111; + switch (static_cast(exception_class)) + { + case EL1_exception_class::breakpoint: + // Debug break + return fault_reason::breakpoint; + case EL1_exception_class::illegal_execution: + case EL1_exception_class::unaligned_pc: + case EL1_exception_class::unaligned_sp: + return fault_reason::illegal_instruction; + case EL1_exception_class::instr_abort_0: + case EL1_exception_class::instr_abort_1: + return fault_reason::instruction_execute; + case EL1_exception_class::data_abort_0: + case EL1_exception_class::data_abort_1: + // Page fault + break; + default: + return fault_reason::undefined; + } - // Check direction bit - const auto direction = (esr >> 6u) & 1u; - return direction ? fault_reason::data_write : fault_reason::data_read; - } -} + // Check direction bit + const auto direction = (esr >> 6u) & 1u; + return direction ? fault_reason::data_write : fault_reason::data_read; + } +} // namespace aarch64 diff --git a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Signal.h b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Signal.h index ed743ff9b..26a95784b 100644 --- a/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Signal.h +++ b/rpcs3/rpcs3/Emu/CPU/Backends/AArch64/AArch64Signal.h @@ -10,48 +10,48 @@ using ucontext_t = void; namespace aarch64 { - // Some renamed kernel definitions, we don't need to include kernel headers directly + // Some renamed kernel definitions, we don't need to include kernel headers directly #pragma pack(push, 1) #if defined(__linux__) - struct aarch64_cpu_ctx_block - { - u32 magic; - u32 size; - }; + struct aarch64_cpu_ctx_block + { + u32 magic; + u32 size; + }; - struct aarch64_esr_ctx - { - aarch64_cpu_ctx_block head; - u64 esr; // Exception syndrome register - }; + struct aarch64_esr_ctx + { + aarch64_cpu_ctx_block head; + u64 esr; // Exception syndrome register + }; #elif defined(__APPLE__) - struct aarch64_exception_state - { - u64 FAR; // Fault address reg - u32 ESR; // Exception syndrome reg (ESR_EL1) - u32 exception_id; - }; + struct aarch64_exception_state + { + u64 FAR; // Fault address reg + u32 ESR; // Exception syndrome reg (ESR_EL1) + u32 exception_id; + }; - struct aarch64_darwin_mcontext64 - { - aarch64_exception_state es; - // Other states we don't care about follow this field - }; + struct aarch64_darwin_mcontext64 + { + aarch64_exception_state es; + // Other states we don't care about follow this field + }; #endif #pragma pack(pop) - // Fault reason - enum class fault_reason - { - undefined = 0, - data_read, - data_write, - instruction_execute, - illegal_instruction, - breakpoint - }; + // Fault reason + enum class fault_reason + { + undefined = 0, + data_read, + data_write, + instruction_execute, + illegal_instruction, + breakpoint + }; - fault_reason decode_fault_reason(const ucontext_t* uctx); -} + fault_reason decode_fault_reason(const ucontext_t* uctx); +} // namespace aarch64 diff --git a/rpcs3/rpcs3/Emu/CPU/CPUDisAsm.h b/rpcs3/rpcs3/Emu/CPU/CPUDisAsm.h index 9e9054d62..db48e33a7 100644 --- a/rpcs3/rpcs3/Emu/CPU/CPUDisAsm.h +++ b/rpcs3/rpcs3/Emu/CPU/CPUDisAsm.h @@ -10,7 +10,7 @@ enum class cpu_disasm_mode interpreter, normal, compiler_elf, - list, // RSX exclusive + list, // RSX exclusive survey_cmd_size, // RSX exclusive }; @@ -30,36 +30,36 @@ protected: { switch (m_mode) { - case cpu_disasm_mode::dump: - { - last_opcode = fmt::format("\t%08x:\t%02x %02x %02x %02x\t%s\n", dump_pc, - static_cast(m_op >> 24), - static_cast(m_op >> 16), - static_cast(m_op >> 8), - static_cast(m_op >> 0), last_opcode); - break; - } + case cpu_disasm_mode::dump: + { + last_opcode = fmt::format("\t%08x:\t%02x %02x %02x %02x\t%s\n", dump_pc, + static_cast(m_op >> 24), + static_cast(m_op >> 16), + static_cast(m_op >> 8), + static_cast(m_op >> 0), last_opcode); + break; + } - case cpu_disasm_mode::interpreter: - { - last_opcode.insert(0, fmt::format("[%08x] %02x %02x %02x %02x: ", dump_pc, - static_cast(m_op >> 24), - static_cast(m_op >> 16), - static_cast(m_op >> 8), - static_cast(m_op >> 0))); - break; - } + case cpu_disasm_mode::interpreter: + { + last_opcode.insert(0, fmt::format("[%08x] %02x %02x %02x %02x: ", dump_pc, + static_cast(m_op >> 24), + static_cast(m_op >> 16), + static_cast(m_op >> 8), + static_cast(m_op >> 0))); + break; + } - case cpu_disasm_mode::compiler_elf: - { - last_opcode += '\n'; - break; - } - case cpu_disasm_mode::normal: - { - break; - } - default: fmt::throw_exception("Unreachable"); + case cpu_disasm_mode::compiler_elf: + { + last_opcode += '\n'; + break; + } + case cpu_disasm_mode::normal: + { + break; + } + default: fmt::throw_exception("Unreachable"); } } @@ -98,10 +98,7 @@ public: protected: CPUDisAsm(cpu_disasm_mode mode, const u8* offset, u32 start_pc = 0, const cpu_thread* cpu = nullptr) - : m_mode(mode) - , m_offset(offset - start_pc) - , m_start_pc(start_pc) - , m_cpu(cpu) + : m_mode(mode), m_offset(offset - start_pc), m_start_pc(start_pc), m_cpu(cpu) { } diff --git a/rpcs3/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/rpcs3/Emu/CPU/CPUThread.cpp index 242dcb9d9..079d2824c 100644 --- a/rpcs3/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/rpcs3/Emu/CPU/CPUThread.cpp @@ -36,50 +36,52 @@ static thread_local u32 s_tls_thread_slot = -1; // Suspend counter stamp static thread_local u64 s_tls_sctr = -1; -extern thread_local void(*g_tls_log_control)(const char* fmt, u64 progress); -extern thread_local std::string(*g_tls_log_prefix)(); +extern thread_local void (*g_tls_log_control)(const char* fmt, u64 progress); +extern thread_local std::string (*g_tls_log_prefix)(); template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](cpu_flag f) - { - switch (f) { - case cpu_flag::stop: return "STOP"; - case cpu_flag::exit: return "EXIT"; - case cpu_flag::wait: return "w"; - case cpu_flag::temp: return "t"; - case cpu_flag::pause: return "p"; - case cpu_flag::suspend: return "s"; - case cpu_flag::ret: return "ret"; - case cpu_flag::again: return "a"; - case cpu_flag::signal: return "sig"; - case cpu_flag::memory: return "mem"; - case cpu_flag::pending: return "pend"; - case cpu_flag::pending_recheck: return "pend-re"; - case cpu_flag::notify: return "ntf"; - case cpu_flag::yield: return "y"; - case cpu_flag::preempt: return "PREEMPT"; - case cpu_flag::dbg_global_pause: return "G-PAUSE"; - case cpu_flag::dbg_pause: return "PAUSE"; - case cpu_flag::dbg_step: return "STEP"; - case cpu_flag::__bitset_enum_max: break; - } + switch (f) + { + case cpu_flag::stop: return "STOP"; + case cpu_flag::exit: return "EXIT"; + case cpu_flag::wait: return "w"; + case cpu_flag::temp: return "t"; + case cpu_flag::pause: return "p"; + case cpu_flag::suspend: return "s"; + case cpu_flag::ret: return "ret"; + case cpu_flag::again: return "a"; + case cpu_flag::signal: return "sig"; + case cpu_flag::memory: return "mem"; + case cpu_flag::pending: return "pend"; + case cpu_flag::pending_recheck: return "pend-re"; + case cpu_flag::notify: return "ntf"; + case cpu_flag::yield: return "y"; + case cpu_flag::preempt: return "PREEMPT"; + case cpu_flag::dbg_global_pause: return "G-PAUSE"; + case cpu_flag::dbg_pause: return "PAUSE"; + case cpu_flag::dbg_step: return "STEP"; + case cpu_flag::__bitset_enum_max: break; + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string>::format(std::string& out, u64 arg) { format_bitset(out, arg, "[", "|", "]", &fmt_class_string::format); } -enum cpu_threads_emulation_info_dump_t : u32 {}; +enum cpu_threads_emulation_info_dump_t : u32 +{ +}; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { // Do not dump all threads, only select few @@ -448,7 +450,6 @@ struct cpu_prof static constexpr auto thread_name = "CPU Profiler"sv; }; - using cpu_profiler = named_thread; extern f64 get_cpu_program_usage_percent(u64 hash) @@ -485,7 +486,7 @@ thread_local DECLARE(cpu_thread::g_tls_this_thread) = nullptr; static atomic_t s_cpu_counter{0}; // List of posted tasks for suspend_all -//static atomic_t s_cpu_work[128]{}; +// static atomic_t s_cpu_work[128]{}; // Linked list of pushed tasks for suspend_all static atomic_t s_pushed{}; @@ -518,16 +519,16 @@ namespace cpu_counter for (u64 i = 0;; i++) { const auto [bits, ok] = s_cpu_bits.fetch_op([](u128& bits) - { - if (~bits) [[likely]] { - // Set lowest clear bit - bits |= bits + 1; - return true; - } + if (~bits) [[likely]] + { + // Set lowest clear bit + bits |= bits + 1; + return true; + } - return false; - }); + return false; + }); if (ok) [[likely]] { @@ -560,9 +561,9 @@ namespace cpu_counter static void remove_cpu_bit(u32 bit) { s_cpu_bits.atomic_op([=](u128& val) - { - val &= ~(u128{1} << (bit % 128)); - }); + { + val &= ~(u128{1} << (bit % 128)); + }); } void remove(cpu_thread* _this) noexcept @@ -626,7 +627,7 @@ namespace cpu_counter return copy; } -} +} // namespace cpu_counter void cpu_thread::operator()() { @@ -654,7 +655,7 @@ void cpu_thread::operator()() { case thread_class::ppu: { - //g_fxo->get().registered.push(id); + // g_fxo->get().registered.push(id); break; } case thread_class::spu: @@ -676,7 +677,7 @@ void cpu_thread::operator()() { cpu_thread* _this = nullptr; std::string name; - std::string(*log_prefix)() = nullptr; + std::string (*log_prefix)() = nullptr; void cleanup() { @@ -690,7 +691,7 @@ void cpu_thread::operator()() ptr->compare_and_swap(_this, nullptr); } - g_tls_log_control = [](const char*, u64){}; + g_tls_log_control = [](const char*, u64) {}; if (s_tls_thread_slot != umax) { @@ -817,141 +818,142 @@ bool cpu_thread::check_state() noexcept // Process all flags in a single atomic op bs_t state1; auto state0 = state.fetch_op([&](bs_t& flags) - { - bool store = false; + { + bool store = false; - if (flags & cpu_flag::pause && s_tls_thread_slot != umax) - { - // Save value before state is saved and cpu_flag::wait is observed - if (s_tls_sctr == umax) - { - u64 ctr = g_suspend_counter; + if (flags & cpu_flag::pause && s_tls_thread_slot != umax) + { + // Save value before state is saved and cpu_flag::wait is observed + if (s_tls_sctr == umax) + { + u64 ctr = g_suspend_counter; - if (flags & cpu_flag::wait) - { - if ((ctr & 3) == 2) - { - s_tls_sctr = ctr; - } - } - else - { - s_tls_sctr = ctr; - } - } - } - else - { - // Cleanup after asynchronous remove() - if (flags & cpu_flag::pause && s_tls_thread_slot == umax) - { - flags -= cpu_flag::pause; - store = true; - } + if (flags & cpu_flag::wait) + { + if ((ctr & 3) == 2) + { + s_tls_sctr = ctr; + } + } + else + { + s_tls_sctr = ctr; + } + } + } + else + { + // Cleanup after asynchronous remove() + if (flags & cpu_flag::pause && s_tls_thread_slot == umax) + { + flags -= cpu_flag::pause; + store = true; + } - s_tls_sctr = -1; - } + s_tls_sctr = -1; + } - if (flags & cpu_flag::temp) [[unlikely]] - { - // Sticky flag, indicates check_state() is not allowed to return true - flags -= cpu_flag::temp; - cpu_can_stop = false; - store = true; - } + if (flags & cpu_flag::temp) [[unlikely]] + { + // Sticky flag, indicates check_state() is not allowed to return true + flags -= cpu_flag::temp; + cpu_can_stop = false; + store = true; + } - if (cpu_can_stop && flags & cpu_flag::signal) - { - flags -= cpu_flag::signal; - cpu_sleep_called = false; - store = true; - } + if (cpu_can_stop && flags & cpu_flag::signal) + { + flags -= cpu_flag::signal; + cpu_sleep_called = false; + store = true; + } - if (flags & cpu_flag::notify) - { - flags -= cpu_flag::notify; - store = true; - } + if (flags & cpu_flag::notify) + { + flags -= cpu_flag::notify; + store = true; + } - // Can't process dbg_step if we only paused temporarily - if (cpu_can_stop && flags & cpu_flag::dbg_step) - { - if (u32 pc = get_pc(), *pc2 = get_pc2(); pc != umax && pc2) - { - if (pc != *pc2) - { - flags -= cpu_flag::dbg_step; - flags += cpu_flag::dbg_pause; - store = true; - } - } - else - { - // Can't test, ignore flag - flags -= cpu_flag::dbg_step; - store = true; - } - } + // Can't process dbg_step if we only paused temporarily + if (cpu_can_stop && flags & cpu_flag::dbg_step) + { + if (u32 pc = get_pc(), *pc2 = get_pc2(); pc != umax && pc2) + { + if (pc != *pc2) + { + flags -= cpu_flag::dbg_step; + flags += cpu_flag::dbg_pause; + store = true; + } + } + else + { + // Can't test, ignore flag + flags -= cpu_flag::dbg_step; + store = true; + } + } - // Atomically clean wait flag and escape - if (!is_stopped(flags) && flags.none_of(cpu_flag::ret)) - { - // Check pause flags which hold thread inside check_state (ignore suspend/debug flags on cpu_flag::temp) - if (flags & cpu_flag::pause || (!cpu_memory_checked && flags & cpu_flag::memory) || (cpu_can_stop && flags & (cpu_flag::dbg_global_pause + cpu_flag::dbg_pause + cpu_flag::suspend + cpu_flag::yield + cpu_flag::preempt))) - { - if (!(flags & cpu_flag::wait)) - { - flags += cpu_flag::wait; - store = true; - } + // Atomically clean wait flag and escape + if (!is_stopped(flags) && flags.none_of(cpu_flag::ret)) + { + // Check pause flags which hold thread inside check_state (ignore suspend/debug flags on cpu_flag::temp) + if (flags & cpu_flag::pause || (!cpu_memory_checked && flags & cpu_flag::memory) || (cpu_can_stop && flags & (cpu_flag::dbg_global_pause + cpu_flag::dbg_pause + cpu_flag::suspend + cpu_flag::yield + cpu_flag::preempt))) + { + if (!(flags & cpu_flag::wait)) + { + flags += cpu_flag::wait; + store = true; + } - if (flags & (cpu_flag::yield + cpu_flag::preempt) && cpu_can_stop) - { - flags -= (cpu_flag::yield + cpu_flag::preempt); - store = true; - } + if (flags & (cpu_flag::yield + cpu_flag::preempt) && cpu_can_stop) + { + flags -= (cpu_flag::yield + cpu_flag::preempt); + store = true; + } - escape = false; - state1 = flags; - return store; - } + escape = false; + state1 = flags; + return store; + } - if (flags & (cpu_flag::wait + cpu_flag::memory)) - { - flags -= (cpu_flag::wait + cpu_flag::memory); - store = true; - } + if (flags & (cpu_flag::wait + cpu_flag::memory)) + { + flags -= (cpu_flag::wait + cpu_flag::memory); + store = true; + } - if (s_tls_thread_slot == umax) - { - if (cpu_flag::wait - this->state.load()) - { - // Force wait flag (must be set during ownership of s_cpu_lock), this makes the atomic op fail as a side effect - this->state += cpu_flag::wait; - store = true; - } + if (s_tls_thread_slot == umax) + { + if (cpu_flag::wait - this->state.load()) + { + // Force wait flag (must be set during ownership of s_cpu_lock), this makes the atomic op fail as a side effect + this->state += cpu_flag::wait; + store = true; + } - // Restore thread in the suspend list - cpu_counter::add(this); - } + // Restore thread in the suspend list + cpu_counter::add(this); + } - retval = false; - } - else - { - if (flags & cpu_flag::wait) - { - flags -= cpu_flag::wait; - store = true; - } + retval = false; + } + else + { + if (flags & cpu_flag::wait) + { + flags -= cpu_flag::wait; + store = true; + } - retval = cpu_can_stop; - } + retval = cpu_can_stop; + } - escape = true; - state1 = flags; - return store; - }).first; + escape = true; + state1 = flags; + return store; + }) + .first; if (state0 & cpu_flag::preempt && cpu_can_stop) { @@ -970,14 +972,14 @@ bool cpu_thread::check_state() noexcept reader_lock lock(s_cpu_lock); cpu_counter::for_all_cpu(bits & s_cpu_bits, [](cpu_thread* cpu) - { - if (cpu->state.none_of(cpu_flag::wait + cpu_flag::yield)) { - cpu->state += cpu_flag::yield; - } + if (cpu->state.none_of(cpu_flag::wait + cpu_flag::yield)) + { + cpu->state += cpu_flag::yield; + } - return true; - }); + return true; + }); } } @@ -1182,11 +1184,11 @@ void cpu_thread::add_remove_flags(bs_t to_add, bs_t to_remov else { result = state.atomic_op([&](bs_t& v) - { - v += to_add; - v -= to_remove; - return v; - }); + { + v += to_add; + v -= to_remove; + return v; + }); } if (!::is_paused(to_remove) && !::is_stopped(to_remove)) @@ -1358,7 +1360,9 @@ std::vector> cpu_thread::dump_callstack_list() const std::string cpu_thread::dump_misc() const { - return fmt::format("Type: %s; State: %s\n", get_class() == thread_class::ppu ? "PPU" : get_class() == thread_class::spu ? "SPU" : "RSX", state.load()); + return fmt::format("Type: %s; State: %s\n", get_class() == thread_class::ppu ? "PPU" : get_class() == thread_class::spu ? "SPU" : + "RSX", + state.load()); } bool cpu_thread::suspend_work::push(cpu_thread* _this) noexcept @@ -1383,8 +1387,7 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this) noexcept s_cpu_lock.lock_unlock(); continue; } - } - while (!s_pushed.compare_and_swap_test(next, this)); + } while (!s_pushed.compare_and_swap_test(next, this)); if (!next) { @@ -1398,15 +1401,15 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this) noexcept // Try to prefetch cpu->state earlier copy = cpu_counter::for_all_cpu(copy, [&](cpu_thread* cpu) - { - if (cpu != _this) { - utils::prefetch_write(&cpu->state); - return true; - } + if (cpu != _this) + { + utils::prefetch_write(&cpu->state); + return true; + } - return false; - }); + return false; + }); // Initialization (first increment) g_suspend_counter += 2; @@ -1415,29 +1418,29 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this) noexcept u128 copy2 = copy; copy = cpu_counter::for_all_cpu(copy, [&](cpu_thread* cpu, u32 /*index*/) - { - if (cpu->state.fetch_add(cpu_flag::pause) & cpu_flag::wait) { - // Clear bits as long as wait flag is set - return false; - } - - return true; - }); - - while (copy) - { - // Check only CPUs which haven't acknowledged their waiting state yet - copy = cpu_counter::for_all_cpu(copy, [&](cpu_thread* cpu, u32 /*index*/) - { - if (cpu->state & cpu_flag::wait) + if (cpu->state.fetch_add(cpu_flag::pause) & cpu_flag::wait) { + // Clear bits as long as wait flag is set return false; } return true; }); + while (copy) + { + // Check only CPUs which haven't acknowledged their waiting state yet + copy = cpu_counter::for_all_cpu(copy, [&](cpu_thread* cpu, u32 /*index*/) + { + if (cpu->state & cpu_flag::wait) + { + return false; + } + + return true; + }); + if (!copy) { break; @@ -1469,8 +1472,7 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this) noexcept // Fill priority range min_prio = std::min(min_prio, head->prio); max_prio = std::max(max_prio, head->prio); - } - while (prev); + } while (prev); } // Execute prefetch hint(s) @@ -1483,10 +1485,10 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this) noexcept } cpu_counter::for_all_cpu(copy2, [&](cpu_thread* cpu) - { - utils::prefetch_write(&cpu->state); - return true; - }); + { + utils::prefetch_write(&cpu->state); + return true; + }); // Execute all stored workload for (s32 prio = max_prio; prio >= min_prio; prio--) @@ -1506,10 +1508,10 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this) noexcept ensure(g_suspend_counter++ & 1); cpu_counter::for_all_cpu(copy2, [&](cpu_thread* cpu) - { - cpu->state -= cpu_flag::pause; - return true; - }); + { + cpu->state -= cpu_flag::pause; + return true; + }); } else { @@ -1584,20 +1586,20 @@ extern bool try_lock_spu_threads_in_a_state_compatible_with_savestates(bool reve bool give_up = false; idm::select>([&](u32 id, spu_thread& spu) - { - spu_list.emplace_back(ensure(idm::get_unlocked>(id))); - - if (spu.current_func && spu.unsavable) { - const u64 start = spu.start_time; + spu_list.emplace_back(ensure(idm::get_unlocked>(id))); - // Automatically give up if it is asleep 15 seconds or more - if (start && current > start && current - start >= 15'000'000) + if (spu.current_func && spu.unsavable) { - give_up = true; + const u64 start = spu.start_time; + + // Automatically give up if it is asleep 15 seconds or more + if (start && current > start && current - start >= 15'000'000) + { + give_up = true; + } } - } - }); + }); if (!force_collect && give_up) { @@ -1668,51 +1670,51 @@ extern bool try_lock_spu_threads_in_a_state_compatible_with_savestates(bool reve bool paused_anyone = false; if (cpu_thread::suspend_all(nullptr, {}, [&]() - { - if (!get_spus(false, true)) - { - // Avoid locking IDM here because this is a critical section - return true; - } - - bool failed = false; - const bool is_emu_paused = Emu.IsPaused(); - - for (auto& spu : *spu_list) - { - if (spu->unsavable) { - failed = true; - break; - } - - if (is_emu_paused) - { - // If emulation is paused, we can only hope it's already in a state compatible with savestates - if (!(spu->state & (cpu_flag::dbg_global_pause + cpu_flag::dbg_pause))) + if (!get_spus(false, true)) { - failed = true; - break; + // Avoid locking IDM here because this is a critical section + return true; } - } - else - { - paused_anyone = true; - ensure(!spu->state.test_and_set(cpu_flag::dbg_global_pause)); - } - } - if (failed && paused_anyone) - { - // For faster signalling, first remove state flags then batch notifications - for (auto& spu : *spu_list) - { - spu->state -= cpu_flag::dbg_global_pause; - } - } + bool failed = false; + const bool is_emu_paused = Emu.IsPaused(); - return failed; - })) + for (auto& spu : *spu_list) + { + if (spu->unsavable) + { + failed = true; + break; + } + + if (is_emu_paused) + { + // If emulation is paused, we can only hope it's already in a state compatible with savestates + if (!(spu->state & (cpu_flag::dbg_global_pause + cpu_flag::dbg_pause))) + { + failed = true; + break; + } + } + else + { + paused_anyone = true; + ensure(!spu->state.test_and_set(cpu_flag::dbg_global_pause)); + } + } + + if (failed && paused_anyone) + { + // For faster signalling, first remove state flags then batch notifications + for (auto& spu : *spu_list) + { + spu->state -= cpu_flag::dbg_global_pause; + } + } + + return failed; + })) { if (Emu.IsPaused()) { diff --git a/rpcs3/rpcs3/Emu/CPU/CPUThread.h b/rpcs3/rpcs3/Emu/CPU/CPUThread.h index 5e3484f7f..4780578df 100644 --- a/rpcs3/rpcs3/Emu/CPU/CPUThread.h +++ b/rpcs3/rpcs3/Emu/CPU/CPUThread.h @@ -8,30 +8,30 @@ template concept DerivedFrom = std::is_base_of_v && - std::is_convertible_v; + std::is_convertible_v; // Thread state flags enum class cpu_flag : u32 { - stop, // Thread not running (HLE, initial state) - exit, // Irreversible exit - wait, // Indicates waiting state, set by the thread itself - temp, // Indicates that the thread cannot properly return after next check_state() - pause, // Thread suspended by suspend_all technique - suspend, // Thread suspended - ret, // Callback return requested - again, // Thread must complete the syscall after deserialization - signal, // Thread received a signal (HLE) - memory, // Thread must unlock memory mutex - pending, // Thread has postponed work + stop, // Thread not running (HLE, initial state) + exit, // Irreversible exit + wait, // Indicates waiting state, set by the thread itself + temp, // Indicates that the thread cannot properly return after next check_state() + pause, // Thread suspended by suspend_all technique + suspend, // Thread suspended + ret, // Callback return requested + again, // Thread must complete the syscall after deserialization + signal, // Thread received a signal (HLE) + memory, // Thread must unlock memory mutex + pending, // Thread has postponed work pending_recheck, // Thread needs to recheck if there is pending work before ::pending removal - notify, // Flag meant solely to allow atomic notification on state without changing other flags - yield, // Thread is being requested to yield its execution time if it's running - preempt, // Thread is being requested to preempt the execution of all CPU threads + notify, // Flag meant solely to allow atomic notification on state without changing other flags + yield, // Thread is being requested to yield its execution time if it's running + preempt, // Thread is being requested to preempt the execution of all CPU threads dbg_global_pause, // Emulation paused - dbg_pause, // Thread paused - dbg_step, // Thread forced to pause after one step (one instruction, etc) + dbg_pause, // Thread paused + dbg_step, // Thread forced to pause after one step (one instruction, etc) __bitset_enum_max }; @@ -148,7 +148,7 @@ public: } u32 get_pc() const; - u32* get_pc2(); // Last PC before stepping for the debugger (may be null) + u32* get_pc2(); // Last PC before stepping for the debugger (may be null) cpu_thread* get_next_cpu(); // Access next_cpu member if the is one void notify(); @@ -185,7 +185,10 @@ public: virtual void cpu_sleep() {} // Callback for cpu_flag::pending - virtual void cpu_work() { state -= cpu_flag::pending + cpu_flag::pending_recheck; } + virtual void cpu_work() + { + state -= cpu_flag::pending + cpu_flag::pending_recheck; + } // Callback for cpu_flag::ret virtual void cpu_return() {} @@ -230,9 +233,9 @@ public: if constexpr (std::is_void_v>) { suspend_work work{prio, false, false, ::size32(hints), hints.begin(), &op, nullptr, [](void* func, void*) - { - std::invoke(*static_cast(func)); - }}; + { + std::invoke(*static_cast(func)); + }}; work.push(_this); return; @@ -242,9 +245,9 @@ public: std::invoke_result_t result; suspend_work work{prio, false, false, ::size32(hints), hints.begin(), &op, &result, [](void* func, void* res_buf) - { - *static_cast*>(res_buf) = std::invoke(*static_cast(func)); - }}; + { + *static_cast*>(res_buf) = std::invoke(*static_cast(func)); + }}; work.push(_this); return result; @@ -259,9 +262,9 @@ public: static_assert(std::is_void_v>, "cpu_thread::suspend_post only supports void as return type"); return suspend_work{prio, false, true, ::size32(hints), hints.begin(), &op, nullptr, [](void* func, void*) - { - std::invoke(*static_cast(func)); - }}; + { + std::invoke(*static_cast(func)); + }}; } // Push the workload only if threads are being suspended by suspend_all() @@ -274,9 +277,9 @@ public: { suspend_work work{prio, true, false, ::size32(hints), hints.begin(), &op, nullptr, [](void* func, void*) - { - std::invoke(*static_cast(func)); - }}; + { + std::invoke(*static_cast(func)); + }}; return work.push(_this); } diff --git a/rpcs3/rpcs3/Emu/CPU/CPUTranslator.cpp b/rpcs3/rpcs3/Emu/CPU/CPUTranslator.cpp index f6893358f..cbe93fd32 100644 --- a/rpcs3/rpcs3/Emu/CPU/CPUTranslator.cpp +++ b/rpcs3/rpcs3/Emu/CPU/CPUTranslator.cpp @@ -22,69 +22,68 @@ llvm::Value* peek_through_bitcasts(llvm::Value* arg) } cpu_translator::cpu_translator(llvm::Module* _module, bool is_be) - : m_context(g_llvm_ctx) - , m_module(_module) - , m_is_be(is_be) + : m_context(g_llvm_ctx), m_module(_module), m_is_be(is_be) { register_intrinsic("x86_pshufb", [&](llvm::CallInst* ci) -> llvm::Value* - { - const auto data0 = ci->getOperand(0); - const auto index = ci->getOperand(1); - const auto zeros = llvm::ConstantAggregateZero::get(get_type()); - - if (m_use_ssse3) { + const auto data0 = ci->getOperand(0); + const auto index = ci->getOperand(1); + const auto zeros = llvm::ConstantAggregateZero::get(get_type()); + + if (m_use_ssse3) + { #if defined(ARCH_X64) - return m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::x86_ssse3_pshuf_b_128), {data0, index}); + return m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::x86_ssse3_pshuf_b_128), {data0, index}); #elif defined(ARCH_ARM64) - // Modified from sse2neon - // movi v2.16b, #143 - // and v1.16b, v1.16b, v2.16b - // tbl v0.16b, { v0.16b }, v1.16b - auto mask = llvm::ConstantInt::get(get_type(), 0x8F); - auto and_mask = llvm::ConstantInt::get(get_type(), true); - auto vec_len = llvm::ConstantInt::get(get_type(), 16); - auto index_masked = m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::vp_and), {index, mask, and_mask, vec_len}); - return m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::aarch64_neon_tbl1), {data0, index_masked}); + // Modified from sse2neon + // movi v2.16b, #143 + // and v1.16b, v1.16b, v2.16b + // tbl v0.16b, { v0.16b }, v1.16b + auto mask = llvm::ConstantInt::get(get_type(), 0x8F); + auto and_mask = llvm::ConstantInt::get(get_type(), true); + auto vec_len = llvm::ConstantInt::get(get_type(), 16); + auto index_masked = m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::vp_and), {index, mask, and_mask, vec_len}); + return m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::aarch64_neon_tbl1), {data0, index_masked}); #else #error "Unimplemented" #endif - } - else - { - // Emulate PSHUFB (TODO) - const auto mask = m_ir->CreateAnd(index, 0xf); - const auto loop = llvm::BasicBlock::Create(m_context, "", m_ir->GetInsertBlock()->getParent()); - const auto prev = ci->getParent(); - const auto next = prev->splitBasicBlock(ci->getNextNode()); + } + else + { + // Emulate PSHUFB (TODO) + const auto mask = m_ir->CreateAnd(index, 0xf); + const auto loop = llvm::BasicBlock::Create(m_context, "", m_ir->GetInsertBlock()->getParent()); + const auto prev = ci->getParent(); + const auto next = prev->splitBasicBlock(ci->getNextNode()); - llvm::cast(m_ir->GetInsertBlock()->getTerminator())->setOperand(0, loop); + llvm::cast(m_ir->GetInsertBlock()->getTerminator())->setOperand(0, loop); - llvm::Value* result; - //m_ir->CreateBr(loop); - m_ir->SetInsertPoint(loop); - const auto i = m_ir->CreatePHI(get_type(), 2); - const auto v = m_ir->CreatePHI(get_type(), 2); - i->addIncoming(m_ir->getInt32(0), prev); - i->addIncoming(m_ir->CreateAdd(i, m_ir->getInt32(1)), loop); - v->addIncoming(zeros, prev); - result = m_ir->CreateInsertElement(v, m_ir->CreateExtractElement(data0, m_ir->CreateExtractElement(mask, i)), i); - v->addIncoming(result, loop); - m_ir->CreateCondBr(m_ir->CreateICmpULT(i, m_ir->getInt32(16)), loop, next); - m_ir->SetInsertPoint(next->getFirstNonPHI()); - result = m_ir->CreateSelect(m_ir->CreateICmpSLT(index, zeros), zeros, result); + llvm::Value* result; + // m_ir->CreateBr(loop); + m_ir->SetInsertPoint(loop); + const auto i = m_ir->CreatePHI(get_type(), 2); + const auto v = m_ir->CreatePHI(get_type(), 2); + i->addIncoming(m_ir->getInt32(0), prev); + i->addIncoming(m_ir->CreateAdd(i, m_ir->getInt32(1)), loop); + v->addIncoming(zeros, prev); + result = m_ir->CreateInsertElement(v, m_ir->CreateExtractElement(data0, m_ir->CreateExtractElement(mask, i)), i); + v->addIncoming(result, loop); + m_ir->CreateCondBr(m_ir->CreateICmpULT(i, m_ir->getInt32(16)), loop, next); + m_ir->SetInsertPoint(next->getFirstNonPHI()); + result = m_ir->CreateSelect(m_ir->CreateICmpSLT(index, zeros), zeros, result); - return result; - } - }); + return result; + } + }); register_intrinsic("any_select_by_bit4", [&](llvm::CallInst* ci) -> llvm::Value* - { - const auto s = bitcast(m_ir->CreateShl(bitcast(ci->getOperand(0)), 3));; - const auto a = bitcast(ci->getOperand(1)); - const auto b = bitcast(ci->getOperand(2)); - return m_ir->CreateSelect(m_ir->CreateICmpSLT(s, llvm::ConstantAggregateZero::get(get_type())), b, a); - }); + { + const auto s = bitcast(m_ir->CreateShl(bitcast(ci->getOperand(0)), 3)); + ; + const auto a = bitcast(ci->getOperand(1)); + const auto b = bitcast(ci->getOperand(2)); + return m_ir->CreateSelect(m_ir->CreateICmpSLT(s, llvm::ConstantAggregateZero::get(get_type())), b, a); + }); } void cpu_translator::initialize(llvm::LLVMContext& context, llvm::ExecutionEngine& engine) diff --git a/rpcs3/rpcs3/Emu/CPU/CPUTranslator.h b/rpcs3/rpcs3/Emu/CPU/CPUTranslator.h index 088bd0801..d129ed4fc 100644 --- a/rpcs3/rpcs3/Emu/CPU/CPUTranslator.h +++ b/rpcs3/rpcs3/Emu/CPU/CPUTranslator.h @@ -129,13 +129,13 @@ struct llvm_value_t using type = void; using base = llvm_value_t; - static constexpr uint esize = 0; - static constexpr bool is_int = false; - static constexpr bool is_sint = false; - static constexpr bool is_uint = false; - static constexpr bool is_float = false; - static constexpr uint is_array = false; - static constexpr uint is_vector = false; + static constexpr uint esize = 0; + static constexpr bool is_int = false; + static constexpr bool is_sint = false; + static constexpr bool is_uint = false; + static constexpr bool is_float = false; + static constexpr uint is_array = false; + static constexpr uint is_vector = false; static constexpr uint is_pointer = false; static llvm::Type* get_type(llvm::LLVMContext& context) @@ -175,7 +175,7 @@ struct llvm_value_t : llvm_value_t using base = llvm_value_t; using base::base; - static constexpr uint esize = 1; + static constexpr uint esize = 1; static constexpr bool is_int = true; static llvm::Type* get_type(llvm::LLVMContext& context) @@ -191,7 +191,7 @@ struct llvm_value_t : llvm_value_t using base = llvm_value_t; using base::base; - static constexpr uint esize = 2; + static constexpr uint esize = 2; static constexpr bool is_int = true; static llvm::Type* get_type(llvm::LLVMContext& context) @@ -207,7 +207,7 @@ struct llvm_value_t : llvm_value_t using base = llvm_value_t; using base::base; - static constexpr uint esize = 4; + static constexpr uint esize = 4; static constexpr bool is_int = true; static llvm::Type* get_type(llvm::LLVMContext& context) @@ -223,7 +223,7 @@ struct llvm_value_t : llvm_value_t using base = llvm_value_t; using base::base; - static constexpr uint esize = 8; + static constexpr uint esize = 8; static constexpr bool is_int = true; static llvm::Type* get_type(llvm::LLVMContext& context) @@ -389,7 +389,7 @@ struct llvm_value_t : llvm_value_t using base = llvm_value_t; using base::base; - static constexpr uint esize = 32; + static constexpr uint esize = 32; static constexpr bool is_float = true; static llvm::Type* get_type(llvm::LLVMContext& context) @@ -405,7 +405,7 @@ struct llvm_value_t : llvm_value_t using base = llvm_value_t; using base::base; - static constexpr uint esize = 64; + static constexpr uint esize = 64; static constexpr bool is_float = true; static llvm::Type* get_type(llvm::LLVMContext& context) @@ -423,13 +423,13 @@ struct llvm_value_t : llvm_value_t using base = llvm_value_t; using base::base; - static constexpr uint esize = 64; - static constexpr bool is_int = false; - static constexpr bool is_sint = false; - static constexpr bool is_uint = false; - static constexpr bool is_float = false; - static constexpr uint is_array = false; - static constexpr uint is_vector = false; + static constexpr uint esize = 64; + static constexpr bool is_int = false; + static constexpr bool is_sint = false; + static constexpr bool is_uint = false; + static constexpr bool is_float = false; + static constexpr uint is_array = false; + static constexpr uint is_vector = false; static constexpr uint is_pointer = llvm_value_t::is_pointer + 1; static llvm::Type* get_type(llvm::LLVMContext& context) @@ -448,13 +448,13 @@ struct llvm_value_t : llvm_value_t > using base = llvm_value_t > 1), T, std::remove_extent_t>>; using base::base; - static constexpr uint esize = std::is_array_v ? 0 : base::esize; - static constexpr bool is_int = !std::is_array_v && base::is_int; - static constexpr bool is_sint = !std::is_array_v && base::is_sint; - static constexpr bool is_uint = !std::is_array_v && base::is_uint; - static constexpr bool is_float = !std::is_array_v && base::is_float; - static constexpr uint is_array = std::is_array_v ? N : 0; - static constexpr uint is_vector = std::is_array_v ? 0 : N; + static constexpr uint esize = std::is_array_v ? 0 : base::esize; + static constexpr bool is_int = !std::is_array_v && base::is_int; + static constexpr bool is_sint = !std::is_array_v && base::is_sint; + static constexpr bool is_uint = !std::is_array_v && base::is_uint; + static constexpr bool is_float = !std::is_array_v && base::is_float; + static constexpr uint is_array = std::is_array_v ? N : 0; + static constexpr uint is_vector = std::is_array_v ? 0 : N; static constexpr uint is_pointer = 0; static llvm::Type* get_type(llvm::LLVMContext& context) @@ -707,13 +707,13 @@ struct llvm_add }; template -inline llvm_add operator +(T1&& a1, T2&& a2) +inline llvm_add operator+(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_add::type>> operator +(T1&& a1, u64 c) +inline llvm_add::type>> operator+(T1&& a1, u64 c) { return {a1, {c}}; } @@ -819,19 +819,19 @@ struct llvm_sub }; template -inline llvm_sub operator -(T1&& a1, T2&& a2) +inline llvm_sub operator-(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_sub::type>> operator -(T1&& a1, u64 c) +inline llvm_sub::type>> operator-(T1&& a1, u64 c) { return {a1, {c}}; } template -inline llvm_sub::type>, T1> operator -(u64 c, T1&& a1) +inline llvm_sub::type>, T1> operator-(u64 c, T1&& a1) { return {{c}, a1}; } @@ -892,7 +892,7 @@ struct llvm_mul }; template -inline llvm_mul operator *(T1&& a1, T2&& a2) +inline llvm_mul operator*(T1&& a1, T2&& a2) { return {a1, a2}; } @@ -909,7 +909,8 @@ struct llvm_div static constexpr auto opc = llvm_value_t::is_float ? llvm::Instruction::FDiv : - llvm_value_t::is_uint ? llvm::Instruction::UDiv : llvm::Instruction::SDiv; + llvm_value_t::is_uint ? llvm::Instruction::UDiv : + llvm::Instruction::SDiv; llvm::Value* eval(llvm::IRBuilder<>* ir) const { @@ -943,7 +944,7 @@ struct llvm_div }; template -inline llvm_div operator /(T1&& a1, T2&& a2) +inline llvm_div operator/(T1&& a1, T2&& a2) { return {a1, a2}; } @@ -1020,7 +1021,7 @@ struct llvm_neg }; template -inline llvm_neg operator -(T1 a1) +inline llvm_neg operator-(T1 a1) { return {a1}; } @@ -1067,13 +1068,13 @@ struct llvm_shl }; template -inline llvm_shl operator <<(T1&& a1, T2&& a2) +inline llvm_shl operator<<(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_shl::type>> operator <<(T1&& a1, u64 c) +inline llvm_shl::type>> operator<<(T1&& a1, u64 c) { return {a1, {c}}; } @@ -1122,13 +1123,13 @@ struct llvm_shr }; template -inline llvm_shr operator >>(T1&& a1, T2&& a2) +inline llvm_shr operator>>(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_shr::type>> operator >>(T1&& a1, u64 c) +inline llvm_shr::type>> operator>>(T1&& a1, u64 c) { return {a1, {c}}; } @@ -1371,13 +1372,13 @@ struct llvm_and }; template -inline llvm_and operator &(T1&& a1, T2&& a2) +inline llvm_and operator&(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_and::type>> operator &(T1&& a1, u64 c) +inline llvm_and::type>> operator&(T1&& a1, u64 c) { return {a1, {c}}; } @@ -1424,13 +1425,13 @@ struct llvm_or }; template -inline llvm_or operator |(T1&& a1, T2&& a2) +inline llvm_or operator|(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_or::type>> operator |(T1&& a1, u64 c) +inline llvm_or::type>> operator|(T1&& a1, u64 c) { return {a1, {c}}; } @@ -1477,19 +1478,19 @@ struct llvm_xor }; template -inline llvm_xor operator ^(T1&& a1, T2&& a2) +inline llvm_xor operator^(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_xor::type>> operator ^(T1&& a1, u64 c) +inline llvm_xor::type>> operator^(T1&& a1, u64 c) { return {a1, {c}}; } template -inline llvm_xor::type, true>> operator ~(T1&& a1) +inline llvm_xor::type, true>> operator~(T1&& a1) { return {a1, {u64{umax}}}; } @@ -1507,11 +1508,12 @@ struct llvm_cmp static_assert(llvm_value_t::is_int || is_float, "llvm_cmp<>: invalid type"); // Convert unsigned comparison predicate to signed if necessary - static constexpr llvm::CmpInst::Predicate pred = llvm_value_t::is_uint ? UPred : - UPred == llvm::ICmpInst::ICMP_UGT ? llvm::ICmpInst::ICMP_SGT : - UPred == llvm::ICmpInst::ICMP_UGE ? llvm::ICmpInst::ICMP_SGE : - UPred == llvm::ICmpInst::ICMP_ULT ? llvm::ICmpInst::ICMP_SLT : - UPred == llvm::ICmpInst::ICMP_ULE ? llvm::ICmpInst::ICMP_SLE : UPred; + static constexpr llvm::CmpInst::Predicate pred = llvm_value_t::is_uint ? UPred : + UPred == llvm::ICmpInst::ICMP_UGT ? llvm::ICmpInst::ICMP_SGT : + UPred == llvm::ICmpInst::ICMP_UGE ? llvm::ICmpInst::ICMP_SGE : + UPred == llvm::ICmpInst::ICMP_ULT ? llvm::ICmpInst::ICMP_SLT : + UPred == llvm::ICmpInst::ICMP_ULE ? llvm::ICmpInst::ICMP_SLE : + UPred; static_assert(llvm_value_t::is_sint || llvm_value_t::is_uint || is_float || UPred == llvm::ICmpInst::ICMP_EQ || UPred == llvm::ICmpInst::ICMP_NE, "llvm_cmp<>: invalid operation on sign-undefined type"); @@ -1568,12 +1570,13 @@ struct llvm_ord // Convert comparison predicate to ordered static constexpr llvm::CmpInst::Predicate pred = - base::pred == llvm::ICmpInst::ICMP_EQ ? llvm::ICmpInst::FCMP_OEQ : - base::pred == llvm::ICmpInst::ICMP_NE ? llvm::ICmpInst::FCMP_ONE : + base::pred == llvm::ICmpInst::ICMP_EQ ? llvm::ICmpInst::FCMP_OEQ : + base::pred == llvm::ICmpInst::ICMP_NE ? llvm::ICmpInst::FCMP_ONE : base::pred == llvm::ICmpInst::ICMP_SGT ? llvm::ICmpInst::FCMP_OGT : base::pred == llvm::ICmpInst::ICMP_SGE ? llvm::ICmpInst::FCMP_OGE : base::pred == llvm::ICmpInst::ICMP_SLT ? llvm::ICmpInst::FCMP_OLT : - base::pred == llvm::ICmpInst::ICMP_SLE ? llvm::ICmpInst::FCMP_OLE : base::pred; + base::pred == llvm::ICmpInst::ICMP_SLE ? llvm::ICmpInst::FCMP_OLE : + base::pred; static_assert(base::is_float, "llvm_ord<>: invalid type"); @@ -1622,12 +1625,13 @@ struct llvm_uno // Convert comparison predicate to unordered static constexpr llvm::CmpInst::Predicate pred = - base::pred == llvm::ICmpInst::ICMP_EQ ? llvm::ICmpInst::FCMP_UEQ : - base::pred == llvm::ICmpInst::ICMP_NE ? llvm::ICmpInst::FCMP_UNE : + base::pred == llvm::ICmpInst::ICMP_EQ ? llvm::ICmpInst::FCMP_UEQ : + base::pred == llvm::ICmpInst::ICMP_NE ? llvm::ICmpInst::FCMP_UNE : base::pred == llvm::ICmpInst::ICMP_SGT ? llvm::ICmpInst::FCMP_UGT : base::pred == llvm::ICmpInst::ICMP_SGE ? llvm::ICmpInst::FCMP_UGE : base::pred == llvm::ICmpInst::ICMP_SLT ? llvm::ICmpInst::FCMP_ULT : - base::pred == llvm::ICmpInst::ICMP_SLE ? llvm::ICmpInst::FCMP_ULE : base::pred; + base::pred == llvm::ICmpInst::ICMP_SLE ? llvm::ICmpInst::FCMP_ULE : + base::pred; static_assert(base::is_float, "llvm_uno<>: invalid type"); @@ -1667,73 +1671,73 @@ template llvm_uno(T&&) -> llvm_uno; template -inline llvm_cmp operator ==(T1&& a1, T2&& a2) +inline llvm_cmp operator==(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_cmp::type>, llvm::ICmpInst::ICMP_EQ> operator ==(T1&& a1, u64 c) +inline llvm_cmp::type>, llvm::ICmpInst::ICMP_EQ> operator==(T1&& a1, u64 c) { return {a1, {c}}; } template -inline llvm_cmp operator !=(T1&& a1, T2&& a2) +inline llvm_cmp operator!=(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_cmp::type>, llvm::ICmpInst::ICMP_NE> operator !=(T1&& a1, u64 c) +inline llvm_cmp::type>, llvm::ICmpInst::ICMP_NE> operator!=(T1&& a1, u64 c) { return {a1, {c}}; } template -inline llvm_cmp operator >(T1&& a1, T2&& a2) +inline llvm_cmp operator>(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_cmp::type>, llvm::ICmpInst::ICMP_UGT> operator >(T1&& a1, u64 c) +inline llvm_cmp::type>, llvm::ICmpInst::ICMP_UGT> operator>(T1&& a1, u64 c) { return {a1, {c}}; } template -inline llvm_cmp operator >=(T1&& a1, T2&& a2) +inline llvm_cmp operator>=(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_cmp::type>, llvm::ICmpInst::ICMP_UGE> operator >=(T1&& a1, u64 c) +inline llvm_cmp::type>, llvm::ICmpInst::ICMP_UGE> operator>=(T1&& a1, u64 c) { return {a1, {c}}; } template -inline llvm_cmp operator <(T1&& a1, T2&& a2) +inline llvm_cmp operator<(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_cmp::type>, llvm::ICmpInst::ICMP_ULT> operator <(T1&& a1, u64 c) +inline llvm_cmp::type>, llvm::ICmpInst::ICMP_ULT> operator<(T1&& a1, u64 c) { return {a1, {c}}; } template -inline llvm_cmp operator <=(T1&& a1, T2&& a2) +inline llvm_cmp operator<=(T1&& a1, T2&& a2) { return {a1, a2}; } template -inline llvm_cmp::type>, llvm::ICmpInst::ICMP_ULE> operator <=(T1&& a1, u64 c) +inline llvm_cmp::type>, llvm::ICmpInst::ICMP_ULE> operator<=(T1&& a1, u64 c) { return {a1, {c}}; } @@ -1875,12 +1879,13 @@ struct llvm_fpcast using type = U; static constexpr auto opc = - llvm_value_t::is_sint ? llvm::Instruction::SIToFP : - llvm_value_t::is_sint ? llvm::Instruction::FPToSI : - llvm_value_t::is_int ? llvm::Instruction::UIToFP : - llvm_value_t::is_int ? llvm::Instruction::FPToUI : + llvm_value_t::is_sint ? llvm::Instruction::SIToFP : + llvm_value_t::is_sint ? llvm::Instruction::FPToSI : + llvm_value_t::is_int ? llvm::Instruction::UIToFP : + llvm_value_t::is_int ? llvm::Instruction::FPToUI : llvm_value_t::esize > llvm_value_t::esize ? llvm::Instruction::FPTrunc : - llvm_value_t::esize < llvm_value_t::esize ? llvm::Instruction::FPExt : llvm::Instruction::BitCast; + llvm_value_t::esize < llvm_value_t::esize ? llvm::Instruction::FPExt : + llvm::Instruction::BitCast; llvm_expr_t a1; static_assert(llvm_value_t::is_float || llvm_value_t::is_float, "llvm_fpcast<>: invalid type(s)"); @@ -1933,8 +1938,9 @@ struct llvm_trunc static constexpr bool is_ok = llvm_value_t::is_int && llvm_value_t::is_int && - llvm_value_t::esize > llvm_value_t::esize && - llvm_value_t::is_vector == llvm_value_t::is_vector; + llvm_value_t::esize > llvm_value_t::esize&& + llvm_value_t::is_vector == + llvm_value_t::is_vector; llvm::Value* eval(llvm::IRBuilder<>* ir) const { @@ -2235,7 +2241,7 @@ struct llvm_add_sat if constexpr (llvm_value_t::is_sint) { const auto max = llvm::ConstantInt::get(v1->getType(), llvm::APInt::getSignedMaxValue(llvm_value_t::esize)); - const auto sat = ir->CreateXor(ir->CreateAShr(v1, llvm_value_t::esize - 1), max); // Max -> min if v1 < 0 + const auto sat = ir->CreateXor(ir->CreateAShr(v1, llvm_value_t::esize - 1), max); // Max -> min if v1 < 0 const auto ovf = ir->CreateAnd(ir->CreateXor(v2, sum), ir->CreateNot(ir->CreateXor(v1, v2))); // Get overflow return ir->CreateSelect(ir->CreateICmpSLT(ovf, llvm::ConstantInt::get(v1->getType(), 0)), sat, sum); } @@ -2319,7 +2325,7 @@ struct llvm_sub_sat { const auto max = llvm::ConstantInt::get(v1->getType(), llvm::APInt::getSignedMaxValue(llvm_value_t::esize)); const auto sat = ir->CreateXor(ir->CreateAShr(v1, llvm_value_t::esize - 1), max); // Max -> min if v1 < 0 - const auto ovf = ir->CreateAnd(ir->CreateXor(v1, dif), ir->CreateXor(v1, v2)); // Get overflow (subtraction) + const auto ovf = ir->CreateAnd(ir->CreateXor(v1, dif), ir->CreateXor(v1, v2)); // Get overflow (subtraction) return ir->CreateSelect(ir->CreateICmpSLT(ovf, llvm::ConstantInt::get(v1->getType(), 0)), sat, dif); } @@ -2368,7 +2374,7 @@ struct llvm_extract static_assert(llvm_value_t::is_int && !llvm_value_t::is_vector, "llvm_extract<>: invalid index type"); static constexpr bool is_ok = llvm_value_t::is_vector && - llvm_value_t::is_int && !llvm_value_t::is_vector; + llvm_value_t::is_int && !llvm_value_t::is_vector; llvm::Value* eval(llvm::IRBuilder<>* ir) const { @@ -2416,7 +2422,7 @@ struct llvm_insert static_assert(std::is_same_v>, "llvm_insert<>: invalid element type"); static constexpr bool is_ok = llvm_extract::is_ok && - std::is_same_v>; + std::is_same_v>; llvm::Value* eval(llvm::IRBuilder<>* ir) const { @@ -2952,7 +2958,7 @@ struct llvm_calli return r; }(); - llvm::Value*(*c)(llvm::Value**, llvm::IRBuilder<>*){}; + llvm::Value* (*c)(llvm::Value**, llvm::IRBuilder<>*){}; llvm::Value* eval(llvm::IRBuilder<>* ir) const { @@ -2985,7 +2991,8 @@ struct llvm_calli return *this; } - template requires (sizeof...(Args) == sizeof...(A)) + template + requires(sizeof...(Args) == sizeof...(A)) llvm_calli& set_order_equality_hint(Args... args) { order_equality_hint = {static_cast(args)...}; @@ -3150,7 +3157,7 @@ public: // Call external function: provide name and function pointer template - llvm::CallInst* call(std::string_view lame, RT(*_func)(FArgs...), Args... args) + llvm::CallInst* call(std::string_view lame, RT (*_func)(FArgs...), Args... args) { static_assert(sizeof...(FArgs) == sizeof...(Args), "spu_llvm_recompiler::call(): unexpected arg number"); const auto type = llvm::FunctionType::get(get_type, RT, RetT>>(), {args->getType()...}, false); @@ -3168,8 +3175,9 @@ public: return inst; } - template requires (sizeof...(Args) != 0) - auto call(std::string_view name, RT(*_func)(FArgs...), Args&&... args) + template + requires(sizeof...(Args) != 0) + auto call(std::string_view name, RT (*_func)(FArgs...), Args&&... args) { llvm_value_t r; r.value = call(name, _func, std::forward(args).eval(m_ir)...); @@ -3482,32 +3490,32 @@ public: static auto absd(T&& a, U&& b) { return expr(max(a, b) - min(a, b), [](llvm::Value*& value, llvm::Module* _m) -> llvm_match_tuple - { - static const auto M = match(); - - if (auto [ok, _max, _min] = match_expr(value, _m, M - M); ok) { - if (auto [ok1, a, b] = match_expr(_max.value, _m, max(M, M)); ok1 && !a.eq(b)) + static const auto M = match(); + + if (auto [ok, _max, _min] = match_expr(value, _m, M - M); ok) { - if (auto [ok2, c, d] = match_expr(_min.value, _m, min(M, M)); ok2 && !c.eq(d)) + if (auto [ok1, a, b] = match_expr(_max.value, _m, max(M, M)); ok1 && !a.eq(b)) { - if ((a.eq(c) && b.eq(d)) || (a.eq(d) && b.eq(c))) + if (auto [ok2, c, d] = match_expr(_min.value, _m, min(M, M)); ok2 && !c.eq(d)) { - if (auto r1 = llvm_expr_t{}.match(a.value, _m); a.eq()) + if ((a.eq(c) && b.eq(d)) || (a.eq(d) && b.eq(c))) { - if (auto r2 = llvm_expr_t{}.match(b.value, _m); b.eq()) + if (auto r1 = llvm_expr_t{}.match(a.value, _m); a.eq()) { - return std::tuple_cat(r1, r2); + if (auto r2 = llvm_expr_t{}.match(b.value, _m); b.eq()) + { + return std::tuple_cat(r1, r2); + } } } } } } - } - value = nullptr; - return {}; - }); + value = nullptr; + return {}; + }); } // Infinite-precision shift left @@ -3517,23 +3525,23 @@ public: static constexpr u32 esz = llvm_value_t::esize; return expr(select(b < esz, a << b, splat(0)), [](llvm::Value*& value, llvm::Module* _m) -> llvm_match_tuple - { - static const auto M = match(); - - if (auto [ok, b, a, b2] = match_expr(value, _m, select(M < esz, M << M, splat(0))); ok && b.eq(b2)) { - if (auto r1 = llvm_expr_t{}.match(a.value, _m); a.eq()) + static const auto M = match(); + + if (auto [ok, b, a, b2] = match_expr(value, _m, select(M < esz, M << M, splat(0))); ok && b.eq(b2)) { - if (auto r2 = llvm_expr_t{}.match(b.value, _m); b.eq()) + if (auto r1 = llvm_expr_t{}.match(a.value, _m); a.eq()) { - return std::tuple_cat(r1, r2); + if (auto r2 = llvm_expr_t{}.match(b.value, _m); b.eq()) + { + return std::tuple_cat(r1, r2); + } } } - } - value = nullptr; - return {}; - }); + value = nullptr; + return {}; + }); } // Infinite-precision logical shift right (unsigned) @@ -3543,23 +3551,23 @@ public: static constexpr u32 esz = llvm_value_t::esize; return expr(select(b < esz, a >> b, splat(0)), [](llvm::Value*& value, llvm::Module* _m) -> llvm_match_tuple - { - static const auto M = match(); - - if (auto [ok, b, a, b2] = match_expr(value, _m, select(M < esz, M >> M, splat(0))); ok && b.eq(b2)) { - if (auto r1 = llvm_expr_t{}.match(a.value, _m); a.eq()) + static const auto M = match(); + + if (auto [ok, b, a, b2] = match_expr(value, _m, select(M < esz, M >> M, splat(0))); ok && b.eq(b2)) { - if (auto r2 = llvm_expr_t{}.match(b.value, _m); b.eq()) + if (auto r1 = llvm_expr_t{}.match(a.value, _m); a.eq()) { - return std::tuple_cat(r1, r2); + if (auto r2 = llvm_expr_t{}.match(b.value, _m); b.eq()) + { + return std::tuple_cat(r1, r2); + } } } - } - value = nullptr; - return {}; - }); + value = nullptr; + return {}; + }); } // Infinite-precision arithmetic shift right (signed) @@ -3569,23 +3577,23 @@ public: static constexpr u32 esz = llvm_value_t::esize; return expr(a >> select(b > (esz - 1), splat(esz - 1), b), [](llvm::Value*& value, llvm::Module* _m) -> llvm_match_tuple - { - static const auto M = match(); - - if (auto [ok, a, b, b2] = match_expr(value, _m, M >> select(M > (esz - 1), splat(esz - 1), M)); ok && b.eq(b2)) { - if (auto r1 = llvm_expr_t{}.match(a.value, _m); a.eq()) + static const auto M = match(); + + if (auto [ok, a, b, b2] = match_expr(value, _m, M >> select(M > (esz - 1), splat(esz - 1), M)); ok && b.eq(b2)) { - if (auto r2 = llvm_expr_t{}.match(b.value, _m); b.eq()) + if (auto r1 = llvm_expr_t{}.match(a.value, _m); a.eq()) { - return std::tuple_cat(r1, r2); + if (auto r2 = llvm_expr_t{}.match(b.value, _m); b.eq()) + { + return std::tuple_cat(r1, r2); + } } } - } - value = nullptr; - return {}; - }); + value = nullptr; + return {}; + }); } template @@ -3852,9 +3860,9 @@ public: else { m_intrinsics.try_emplace(name, [=, this](llvm::CallInst* ci) - { - return replace_with(ci).eval(m_ir); - }); + { + return replace_with(ci).eval(m_ir); + }); } } @@ -3874,37 +3882,37 @@ public: static auto pshufb(T&& a, U&& b) { return llvm_calli{"x86_pshufb", {std::forward(a), std::forward(b)}}.if_const([](llvm::Value* args[], llvm::IRBuilder<>* ir) -> llvm::Value* - { - const auto zeros = llvm::ConstantAggregateZero::get(llvm_value_t::get_type(ir->getContext())); - - if (auto c = llvm::dyn_cast(args[1])) { - // Convert PSHUFB index back to LLVM vector shuffle mask - v128 mask{}; + const auto zeros = llvm::ConstantAggregateZero::get(llvm_value_t::get_type(ir->getContext())); - const auto cv = llvm::dyn_cast(c); - - if (cv) + if (auto c = llvm::dyn_cast(args[1])) { - for (u32 i = 0; i < 16; i++) + // Convert PSHUFB index back to LLVM vector shuffle mask + v128 mask{}; + + const auto cv = llvm::dyn_cast(c); + + if (cv) { - const u64 b = cv->getElementAsInteger(i); - mask._u8[i] = b < 128 ? b % 16 : 16; + for (u32 i = 0; i < 16; i++) + { + const u64 b = cv->getElementAsInteger(i); + mask._u8[i] = b < 128 ? b % 16 : 16; + } + } + + if (cv || llvm::isa(c)) + { + llvm::Value* r = nullptr; + r = llvm::ConstantDataVector::get(ir->getContext(), llvm::ArrayRef(reinterpret_cast(&mask), 16)); + r = ir->CreateZExt(r, llvm_value_t::get_type(ir->getContext())); + r = ir->CreateShuffleVector(args[0], zeros, r); + return r; } } - if (cv || llvm::isa(c)) - { - llvm::Value* r = nullptr; - r = llvm::ConstantDataVector::get(ir->getContext(), llvm::ArrayRef(reinterpret_cast(&mask), 16)); - r = ir->CreateZExt(r, llvm_value_t::get_type(ir->getContext())); - r = ir->CreateShuffleVector(args[0], zeros, r); - return r; - } - } - - return nullptr; - }); + return nullptr; + }); } // (m << 3) >= 0 ? a : b @@ -3987,8 +3995,7 @@ struct fmt_unveil // Inline assembly wrappers. // TODO: Move these to proper location and replace macros with templates -static inline -llvm::InlineAsm* compile_inline_asm( +static inline llvm::InlineAsm* compile_inline_asm( llvm::Type* returnType, llvm::ArrayRef argTypes, const std::string& code, @@ -3999,8 +4006,7 @@ llvm::InlineAsm* compile_inline_asm( } // Helper for ASM generation with dynamic number of arguments -static inline -llvm::CallInst* llvm_asm( +static inline llvm::CallInst* llvm_asm( llvm::IRBuilder<>* irb, const std::string& asm_, llvm::ArrayRef args, @@ -4027,11 +4033,11 @@ llvm::CallInst* llvm_asm( return c; } -#define LLVM_ASM(asm_, args, constraints, irb, ctx)\ +#define LLVM_ASM(asm_, args, constraints, irb, ctx) \ llvm_asm(irb, asm_, args, constraints, ctx) // Helper for ASM generation with 0 args -#define LLVM_ASM_VOID(asm_, irb, ctx)\ +#define LLVM_ASM_VOID(asm_, irb, ctx) \ llvm_asm(irb, asm_, {}, "", ctx) #endif diff --git a/rpcs3/rpcs3/Emu/CPU/Hypervisor.h b/rpcs3/rpcs3/Emu/CPU/Hypervisor.h index f40428cc4..32ccae961 100644 --- a/rpcs3/rpcs3/Emu/CPU/Hypervisor.h +++ b/rpcs3/rpcs3/Emu/CPU/Hypervisor.h @@ -43,4 +43,4 @@ namespace rpcs3 } aarch64; }; #endif -} +} // namespace rpcs3 diff --git a/rpcs3/rpcs3/Emu/CPU/sse2neon.h b/rpcs3/rpcs3/Emu/CPU/sse2neon.h index dfb0b1a0e..88ec9d6cb 100644 --- a/rpcs3/rpcs3/Emu/CPU/sse2neon.h +++ b/rpcs3/rpcs3/Emu/CPU/sse2neon.h @@ -136,19 +136,19 @@ #if defined(_WIN32) static inline int posix_memalign(void** memptr, size_t alignment, size_t size) { - // Check for valid alignment (must be a power of two and multiple of sizeof(void*)) - if (alignment == 0 || (alignment & (alignment - 1)) != 0 || alignment % sizeof(void*) != 0) - return EINVAL; + // Check for valid alignment (must be a power of two and multiple of sizeof(void*)) + if (alignment == 0 || (alignment & (alignment - 1)) != 0 || alignment % sizeof(void*) != 0) + return EINVAL; - // Allocate memory using _aligned_malloc - void* ptr = _aligned_malloc(size, alignment); - if (!ptr) - // NOTE: _aligned_malloc sets errno, ideally we should use that to generate the return code - return ENOMEM; + // Allocate memory using _aligned_malloc + void* ptr = _aligned_malloc(size, alignment); + if (!ptr) + // NOTE: _aligned_malloc sets errno, ideally we should use that to generate the return code + return ENOMEM; - // Success - *memptr = ptr; - return 0; + // Success + *memptr = ptr; + return 0; } #endif /* End RPCS3 additions */ @@ -176,7 +176,7 @@ static inline int posix_memalign(void** memptr, size_t alignment, size_t size) * fp0 is the same for fp0 of result. */ #define _MM_SHUFFLE(fp3, fp2, fp1, fp0) \ - (((fp3) << 6) | ((fp2) << 4) | ((fp1) << 2) | ((fp0))) + (((fp3) << 6) | ((fp2) << 4) | ((fp1) << 2) | ((fp0))) /* Rounding mode macros. */ #define _MM_FROUND_TO_NEAREST_INT 0x00 @@ -371,22 +371,23 @@ typedef int64x2_t __m128i; /* 128-bit vector containing integers */ // individual components. The use of this union should be hidden behind a macro // that is used throughout the codebase to access the members instead of always // declaring this type of variable. -typedef union ALIGN_STRUCT(16) SIMDVec { - float m128_f32[4]; // as floats - DON'T USE. Added for convenience. - int8_t m128_i8[16]; // as signed 8-bit integers. - int16_t m128_i16[8]; // as signed 16-bit integers. - int32_t m128_i32[4]; // as signed 32-bit integers. - int64_t m128_i64[2]; // as signed 64-bit integers. - uint8_t m128_u8[16]; // as unsigned 8-bit integers. - uint16_t m128_u16[8]; // as unsigned 16-bit integers. - uint32_t m128_u32[4]; // as unsigned 32-bit integers. - uint64_t m128_u64[2]; // as unsigned 64-bit integers. +typedef union ALIGN_STRUCT(16) SIMDVec +{ + float m128_f32[4]; // as floats - DON'T USE. Added for convenience. + int8_t m128_i8[16]; // as signed 8-bit integers. + int16_t m128_i16[8]; // as signed 16-bit integers. + int32_t m128_i32[4]; // as signed 32-bit integers. + int64_t m128_i64[2]; // as signed 64-bit integers. + uint8_t m128_u8[16]; // as unsigned 8-bit integers. + uint16_t m128_u16[8]; // as unsigned 16-bit integers. + uint32_t m128_u32[4]; // as unsigned 32-bit integers. + uint64_t m128_u64[2]; // as unsigned 64-bit integers. } SIMDVec; // casting using SIMDVec -#define vreinterpretq_nth_u64_m128i(x, n) (((SIMDVec *) &x)->m128_u64[n]) -#define vreinterpretq_nth_u32_m128i(x, n) (((SIMDVec *) &x)->m128_u32[n]) -#define vreinterpretq_nth_u8_m128i(x, n) (((SIMDVec *) &x)->m128_u8[n]) +#define vreinterpretq_nth_u64_m128i(x, n) (((SIMDVec*)&x)->m128_u64[n]) +#define vreinterpretq_nth_u32_m128i(x, n) (((SIMDVec*)&x)->m128_u32[n]) +#define vreinterpretq_nth_u8_m128i(x, n) (((SIMDVec*)&x)->m128_u8[n]) /* SSE macros */ #define _MM_GET_FLUSH_ZERO_MODE _sse2neon_mm_get_flush_zero_mode @@ -426,24 +427,24 @@ FORCE_INLINE uint32_t _mm_crc32_u8(uint32_t, uint8_t); /* Backwards compatibility for compilers with lack of specific type support */ // Older gcc does not define vld1q_u8_x4 type -#if defined(__GNUC__) && !defined(__clang__) && \ - ((__GNUC__ <= 10 && defined(__arm__)) || \ - (__GNUC__ == 10 && __GNUC_MINOR__ < 3 && defined(__aarch64__)) || \ - (__GNUC__ <= 9 && defined(__aarch64__))) -FORCE_INLINE uint8x16x4_t _sse2neon_vld1q_u8_x4(const uint8_t *p) +#if defined(__GNUC__) && !defined(__clang__) && \ + ((__GNUC__ <= 10 && defined(__arm__)) || \ + (__GNUC__ == 10 && __GNUC_MINOR__ < 3 && defined(__aarch64__)) || \ + (__GNUC__ <= 9 && defined(__aarch64__))) +FORCE_INLINE uint8x16x4_t _sse2neon_vld1q_u8_x4(const uint8_t* p) { - uint8x16x4_t ret; - ret.val[0] = vld1q_u8(p + 0); - ret.val[1] = vld1q_u8(p + 16); - ret.val[2] = vld1q_u8(p + 32); - ret.val[3] = vld1q_u8(p + 48); - return ret; + uint8x16x4_t ret; + ret.val[0] = vld1q_u8(p + 0); + ret.val[1] = vld1q_u8(p + 16); + ret.val[2] = vld1q_u8(p + 32); + ret.val[3] = vld1q_u8(p + 48); + return ret; } #else // Wraps vld1q_u8_x4 -FORCE_INLINE uint8x16x4_t _sse2neon_vld1q_u8_x4(const uint8_t *p) +FORCE_INLINE uint8x16x4_t _sse2neon_vld1q_u8_x4(const uint8_t* p) { - return vld1q_u8_x4(p); + return vld1q_u8_x4(p); } #endif @@ -525,27 +526,29 @@ FORCE_INLINE uint8x16x4_t _sse2neon_vld1q_u8_x4(const uint8_t *p) */ /* Constants for use with _mm_prefetch. */ -enum _mm_hint { - _MM_HINT_NTA = 0, /* load data to L1 and L2 cache, mark it as NTA */ - _MM_HINT_T0 = 1, /* load data to L1 and L2 cache */ - _MM_HINT_T1 = 2, /* load data to L2 cache only */ - _MM_HINT_T2 = 3, /* load data to L2 cache only, mark it as NTA */ - _MM_HINT_ENTA = 4, /* exclusive version of _MM_HINT_NTA */ - _MM_HINT_ET0 = 5, /* exclusive version of _MM_HINT_T0 */ - _MM_HINT_ET1 = 6, /* exclusive version of _MM_HINT_T1 */ - _MM_HINT_ET2 = 7 /* exclusive version of _MM_HINT_T2 */ +enum _mm_hint +{ + _MM_HINT_NTA = 0, /* load data to L1 and L2 cache, mark it as NTA */ + _MM_HINT_T0 = 1, /* load data to L1 and L2 cache */ + _MM_HINT_T1 = 2, /* load data to L2 cache only */ + _MM_HINT_T2 = 3, /* load data to L2 cache only, mark it as NTA */ + _MM_HINT_ENTA = 4, /* exclusive version of _MM_HINT_NTA */ + _MM_HINT_ET0 = 5, /* exclusive version of _MM_HINT_T0 */ + _MM_HINT_ET1 = 6, /* exclusive version of _MM_HINT_T1 */ + _MM_HINT_ET2 = 7 /* exclusive version of _MM_HINT_T2 */ }; // The bit field mapping to the FPCR(floating-point control register) -typedef struct { - uint16_t res0; - uint8_t res1 : 6; - uint8_t bit22 : 1; - uint8_t bit23 : 1; - uint8_t bit24 : 1; - uint8_t res2 : 7; +typedef struct +{ + uint16_t res0; + uint8_t res1 : 6; + uint8_t bit22 : 1; + uint8_t bit23 : 1; + uint8_t bit24 : 1; + uint8_t res2 : 7; #if defined(__aarch64__) - uint32_t res3; + uint32_t res3; #endif } fpcr_bitfield; @@ -553,9 +556,9 @@ typedef struct { // Takes the lower 64 bits of b and places it into the high end of the result. FORCE_INLINE __m128 _mm_shuffle_ps_1032(__m128 a, __m128 b) { - float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a)); - float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b)); - return vreinterpretq_m128_f32(vcombine_f32(a32, b10)); + float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a)); + float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b)); + return vreinterpretq_m128_f32(vcombine_f32(a32, b10)); } // takes the lower two 32-bit values from a and swaps them and places in high @@ -563,146 +566,146 @@ FORCE_INLINE __m128 _mm_shuffle_ps_1032(__m128 a, __m128 b) // places in low end of result. FORCE_INLINE __m128 _mm_shuffle_ps_2301(__m128 a, __m128 b) { - float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a))); - float32x2_t b23 = vrev64_f32(vget_high_f32(vreinterpretq_f32_m128(b))); - return vreinterpretq_m128_f32(vcombine_f32(a01, b23)); + float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a))); + float32x2_t b23 = vrev64_f32(vget_high_f32(vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_f32(vcombine_f32(a01, b23)); } FORCE_INLINE __m128 _mm_shuffle_ps_0321(__m128 a, __m128 b) { - float32x2_t a21 = vget_high_f32( - vextq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 3)); - float32x2_t b03 = vget_low_f32( - vextq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b), 3)); - return vreinterpretq_m128_f32(vcombine_f32(a21, b03)); + float32x2_t a21 = vget_high_f32( + vextq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 3)); + float32x2_t b03 = vget_low_f32( + vextq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b), 3)); + return vreinterpretq_m128_f32(vcombine_f32(a21, b03)); } FORCE_INLINE __m128 _mm_shuffle_ps_2103(__m128 a, __m128 b) { - float32x2_t a03 = vget_low_f32( - vextq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 3)); - float32x2_t b21 = vget_high_f32( - vextq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b), 3)); - return vreinterpretq_m128_f32(vcombine_f32(a03, b21)); + float32x2_t a03 = vget_low_f32( + vextq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 3)); + float32x2_t b21 = vget_high_f32( + vextq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b), 3)); + return vreinterpretq_m128_f32(vcombine_f32(a03, b21)); } FORCE_INLINE __m128 _mm_shuffle_ps_1010(__m128 a, __m128 b) { - float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a)); - float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b)); - return vreinterpretq_m128_f32(vcombine_f32(a10, b10)); + float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a)); + float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b)); + return vreinterpretq_m128_f32(vcombine_f32(a10, b10)); } FORCE_INLINE __m128 _mm_shuffle_ps_1001(__m128 a, __m128 b) { - float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a))); - float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b)); - return vreinterpretq_m128_f32(vcombine_f32(a01, b10)); + float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a))); + float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b)); + return vreinterpretq_m128_f32(vcombine_f32(a01, b10)); } FORCE_INLINE __m128 _mm_shuffle_ps_0101(__m128 a, __m128 b) { - float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a))); - float32x2_t b01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(b))); - return vreinterpretq_m128_f32(vcombine_f32(a01, b01)); + float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a))); + float32x2_t b01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_f32(vcombine_f32(a01, b01)); } // keeps the low 64 bits of b in the low and puts the high 64 bits of a in the // high FORCE_INLINE __m128 _mm_shuffle_ps_3210(__m128 a, __m128 b) { - float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a)); - float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b)); - return vreinterpretq_m128_f32(vcombine_f32(a10, b32)); + float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a)); + float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b)); + return vreinterpretq_m128_f32(vcombine_f32(a10, b32)); } FORCE_INLINE __m128 _mm_shuffle_ps_0011(__m128 a, __m128 b) { - float32x2_t a11 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(a)), 1); - float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0); - return vreinterpretq_m128_f32(vcombine_f32(a11, b00)); + float32x2_t a11 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(a)), 1); + float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0); + return vreinterpretq_m128_f32(vcombine_f32(a11, b00)); } FORCE_INLINE __m128 _mm_shuffle_ps_0022(__m128 a, __m128 b) { - float32x2_t a22 = - vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(a)), 0); - float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0); - return vreinterpretq_m128_f32(vcombine_f32(a22, b00)); + float32x2_t a22 = + vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(a)), 0); + float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0); + return vreinterpretq_m128_f32(vcombine_f32(a22, b00)); } FORCE_INLINE __m128 _mm_shuffle_ps_2200(__m128 a, __m128 b) { - float32x2_t a00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(a)), 0); - float32x2_t b22 = - vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(b)), 0); - return vreinterpretq_m128_f32(vcombine_f32(a00, b22)); + float32x2_t a00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(a)), 0); + float32x2_t b22 = + vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(b)), 0); + return vreinterpretq_m128_f32(vcombine_f32(a00, b22)); } FORCE_INLINE __m128 _mm_shuffle_ps_3202(__m128 a, __m128 b) { - float32_t a0 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0); - float32x2_t a22 = - vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(a)), 0); - float32x2_t a02 = vset_lane_f32(a0, a22, 1); /* TODO: use vzip ?*/ - float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b)); - return vreinterpretq_m128_f32(vcombine_f32(a02, b32)); + float32_t a0 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0); + float32x2_t a22 = + vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(a)), 0); + float32x2_t a02 = vset_lane_f32(a0, a22, 1); /* TODO: use vzip ?*/ + float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b)); + return vreinterpretq_m128_f32(vcombine_f32(a02, b32)); } FORCE_INLINE __m128 _mm_shuffle_ps_1133(__m128 a, __m128 b) { - float32x2_t a33 = - vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(a)), 1); - float32x2_t b11 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 1); - return vreinterpretq_m128_f32(vcombine_f32(a33, b11)); + float32x2_t a33 = + vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(a)), 1); + float32x2_t b11 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 1); + return vreinterpretq_m128_f32(vcombine_f32(a33, b11)); } FORCE_INLINE __m128 _mm_shuffle_ps_2010(__m128 a, __m128 b) { - float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a)); - float32_t b2 = vgetq_lane_f32(vreinterpretq_f32_m128(b), 2); - float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0); - float32x2_t b20 = vset_lane_f32(b2, b00, 1); - return vreinterpretq_m128_f32(vcombine_f32(a10, b20)); + float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a)); + float32_t b2 = vgetq_lane_f32(vreinterpretq_f32_m128(b), 2); + float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0); + float32x2_t b20 = vset_lane_f32(b2, b00, 1); + return vreinterpretq_m128_f32(vcombine_f32(a10, b20)); } FORCE_INLINE __m128 _mm_shuffle_ps_2001(__m128 a, __m128 b) { - float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a))); - float32_t b2 = vgetq_lane_f32(b, 2); - float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0); - float32x2_t b20 = vset_lane_f32(b2, b00, 1); - return vreinterpretq_m128_f32(vcombine_f32(a01, b20)); + float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a))); + float32_t b2 = vgetq_lane_f32(b, 2); + float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0); + float32x2_t b20 = vset_lane_f32(b2, b00, 1); + return vreinterpretq_m128_f32(vcombine_f32(a01, b20)); } FORCE_INLINE __m128 _mm_shuffle_ps_2032(__m128 a, __m128 b) { - float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a)); - float32_t b2 = vgetq_lane_f32(b, 2); - float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0); - float32x2_t b20 = vset_lane_f32(b2, b00, 1); - return vreinterpretq_m128_f32(vcombine_f32(a32, b20)); + float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a)); + float32_t b2 = vgetq_lane_f32(b, 2); + float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0); + float32x2_t b20 = vset_lane_f32(b2, b00, 1); + return vreinterpretq_m128_f32(vcombine_f32(a32, b20)); } // Kahan summation for accurate summation of floating-point numbers. // http://blog.zachbjornson.com/2019/08/11/fast-float-summation.html -FORCE_INLINE void _sse2neon_kadd_f32(float *sum, float *c, float y) +FORCE_INLINE void _sse2neon_kadd_f32(float* sum, float* c, float y) { - y -= *c; - float t = *sum + y; - *c = (t - *sum) - y; - *sum = t; + y -= *c; + float t = *sum + y; + *c = (t - *sum) - y; + *sum = t; } #if defined(__ARM_FEATURE_CRYPTO) // Wraps vmull_p64 FORCE_INLINE uint64x2_t _sse2neon_vmull_p64(uint64x1_t _a, uint64x1_t _b) { - poly64_t a = vget_lane_p64(vreinterpret_p64_u64(_a), 0); - poly64_t b = vget_lane_p64(vreinterpret_p64_u64(_b), 0); - return vreinterpretq_u64_p128(vmull_p64(a, b)); + poly64_t a = vget_lane_p64(vreinterpret_p64_u64(_a), 0); + poly64_t b = vget_lane_p64(vreinterpret_p64_u64(_b), 0); + return vreinterpretq_u64_p128(vmull_p64(a, b)); } -#else // ARMv7 polyfill +#else // ARMv7 polyfill // ARMv7/some A64 lacks vmull_p64, but it has vmull_p8. // // vmull_p8 calculates 8 8-bit->16-bit polynomial multiplies, but we need a @@ -718,96 +721,96 @@ FORCE_INLINE uint64x2_t _sse2neon_vmull_p64(uint64x1_t _a, uint64x1_t _b) // (https://hal.inria.fr/hal-01506572) static uint64x2_t _sse2neon_vmull_p64(uint64x1_t _a, uint64x1_t _b) { - poly8x8_t a = vreinterpret_p8_u64(_a); - poly8x8_t b = vreinterpret_p8_u64(_b); + poly8x8_t a = vreinterpret_p8_u64(_a); + poly8x8_t b = vreinterpret_p8_u64(_b); - // Masks - uint8x16_t k48_32 = vcombine_u8(vcreate_u8(0x0000ffffffffffff), - vcreate_u8(0x00000000ffffffff)); - uint8x16_t k16_00 = vcombine_u8(vcreate_u8(0x000000000000ffff), - vcreate_u8(0x0000000000000000)); + // Masks + uint8x16_t k48_32 = vcombine_u8(vcreate_u8(0x0000ffffffffffff), + vcreate_u8(0x00000000ffffffff)); + uint8x16_t k16_00 = vcombine_u8(vcreate_u8(0x000000000000ffff), + vcreate_u8(0x0000000000000000)); - // Do the multiplies, rotating with vext to get all combinations - uint8x16_t d = vreinterpretq_u8_p16(vmull_p8(a, b)); // D = A0 * B0 - uint8x16_t e = - vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 1))); // E = A0 * B1 - uint8x16_t f = - vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 1), b)); // F = A1 * B0 - uint8x16_t g = - vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 2))); // G = A0 * B2 - uint8x16_t h = - vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 2), b)); // H = A2 * B0 - uint8x16_t i = - vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 3))); // I = A0 * B3 - uint8x16_t j = - vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 3), b)); // J = A3 * B0 - uint8x16_t k = - vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 4))); // L = A0 * B4 + // Do the multiplies, rotating with vext to get all combinations + uint8x16_t d = vreinterpretq_u8_p16(vmull_p8(a, b)); // D = A0 * B0 + uint8x16_t e = + vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 1))); // E = A0 * B1 + uint8x16_t f = + vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 1), b)); // F = A1 * B0 + uint8x16_t g = + vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 2))); // G = A0 * B2 + uint8x16_t h = + vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 2), b)); // H = A2 * B0 + uint8x16_t i = + vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 3))); // I = A0 * B3 + uint8x16_t j = + vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 3), b)); // J = A3 * B0 + uint8x16_t k = + vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 4))); // L = A0 * B4 - // Add cross products - uint8x16_t l = veorq_u8(e, f); // L = E + F - uint8x16_t m = veorq_u8(g, h); // M = G + H - uint8x16_t n = veorq_u8(i, j); // N = I + J + // Add cross products + uint8x16_t l = veorq_u8(e, f); // L = E + F + uint8x16_t m = veorq_u8(g, h); // M = G + H + uint8x16_t n = veorq_u8(i, j); // N = I + J - // Interleave. Using vzip1 and vzip2 prevents Clang from emitting TBL - // instructions. + // Interleave. Using vzip1 and vzip2 prevents Clang from emitting TBL + // instructions. #if defined(__aarch64__) - uint8x16_t lm_p0 = vreinterpretq_u8_u64( - vzip1q_u64(vreinterpretq_u64_u8(l), vreinterpretq_u64_u8(m))); - uint8x16_t lm_p1 = vreinterpretq_u8_u64( - vzip2q_u64(vreinterpretq_u64_u8(l), vreinterpretq_u64_u8(m))); - uint8x16_t nk_p0 = vreinterpretq_u8_u64( - vzip1q_u64(vreinterpretq_u64_u8(n), vreinterpretq_u64_u8(k))); - uint8x16_t nk_p1 = vreinterpretq_u8_u64( - vzip2q_u64(vreinterpretq_u64_u8(n), vreinterpretq_u64_u8(k))); + uint8x16_t lm_p0 = vreinterpretq_u8_u64( + vzip1q_u64(vreinterpretq_u64_u8(l), vreinterpretq_u64_u8(m))); + uint8x16_t lm_p1 = vreinterpretq_u8_u64( + vzip2q_u64(vreinterpretq_u64_u8(l), vreinterpretq_u64_u8(m))); + uint8x16_t nk_p0 = vreinterpretq_u8_u64( + vzip1q_u64(vreinterpretq_u64_u8(n), vreinterpretq_u64_u8(k))); + uint8x16_t nk_p1 = vreinterpretq_u8_u64( + vzip2q_u64(vreinterpretq_u64_u8(n), vreinterpretq_u64_u8(k))); #else - uint8x16_t lm_p0 = vcombine_u8(vget_low_u8(l), vget_low_u8(m)); - uint8x16_t lm_p1 = vcombine_u8(vget_high_u8(l), vget_high_u8(m)); - uint8x16_t nk_p0 = vcombine_u8(vget_low_u8(n), vget_low_u8(k)); - uint8x16_t nk_p1 = vcombine_u8(vget_high_u8(n), vget_high_u8(k)); + uint8x16_t lm_p0 = vcombine_u8(vget_low_u8(l), vget_low_u8(m)); + uint8x16_t lm_p1 = vcombine_u8(vget_high_u8(l), vget_high_u8(m)); + uint8x16_t nk_p0 = vcombine_u8(vget_low_u8(n), vget_low_u8(k)); + uint8x16_t nk_p1 = vcombine_u8(vget_high_u8(n), vget_high_u8(k)); #endif - // t0 = (L) (P0 + P1) << 8 - // t1 = (M) (P2 + P3) << 16 - uint8x16_t t0t1_tmp = veorq_u8(lm_p0, lm_p1); - uint8x16_t t0t1_h = vandq_u8(lm_p1, k48_32); - uint8x16_t t0t1_l = veorq_u8(t0t1_tmp, t0t1_h); + // t0 = (L) (P0 + P1) << 8 + // t1 = (M) (P2 + P3) << 16 + uint8x16_t t0t1_tmp = veorq_u8(lm_p0, lm_p1); + uint8x16_t t0t1_h = vandq_u8(lm_p1, k48_32); + uint8x16_t t0t1_l = veorq_u8(t0t1_tmp, t0t1_h); - // t2 = (N) (P4 + P5) << 24 - // t3 = (K) (P6 + P7) << 32 - uint8x16_t t2t3_tmp = veorq_u8(nk_p0, nk_p1); - uint8x16_t t2t3_h = vandq_u8(nk_p1, k16_00); - uint8x16_t t2t3_l = veorq_u8(t2t3_tmp, t2t3_h); + // t2 = (N) (P4 + P5) << 24 + // t3 = (K) (P6 + P7) << 32 + uint8x16_t t2t3_tmp = veorq_u8(nk_p0, nk_p1); + uint8x16_t t2t3_h = vandq_u8(nk_p1, k16_00); + uint8x16_t t2t3_l = veorq_u8(t2t3_tmp, t2t3_h); - // De-interleave + // De-interleave #if defined(__aarch64__) - uint8x16_t t0 = vreinterpretq_u8_u64( - vuzp1q_u64(vreinterpretq_u64_u8(t0t1_l), vreinterpretq_u64_u8(t0t1_h))); - uint8x16_t t1 = vreinterpretq_u8_u64( - vuzp2q_u64(vreinterpretq_u64_u8(t0t1_l), vreinterpretq_u64_u8(t0t1_h))); - uint8x16_t t2 = vreinterpretq_u8_u64( - vuzp1q_u64(vreinterpretq_u64_u8(t2t3_l), vreinterpretq_u64_u8(t2t3_h))); - uint8x16_t t3 = vreinterpretq_u8_u64( - vuzp2q_u64(vreinterpretq_u64_u8(t2t3_l), vreinterpretq_u64_u8(t2t3_h))); + uint8x16_t t0 = vreinterpretq_u8_u64( + vuzp1q_u64(vreinterpretq_u64_u8(t0t1_l), vreinterpretq_u64_u8(t0t1_h))); + uint8x16_t t1 = vreinterpretq_u8_u64( + vuzp2q_u64(vreinterpretq_u64_u8(t0t1_l), vreinterpretq_u64_u8(t0t1_h))); + uint8x16_t t2 = vreinterpretq_u8_u64( + vuzp1q_u64(vreinterpretq_u64_u8(t2t3_l), vreinterpretq_u64_u8(t2t3_h))); + uint8x16_t t3 = vreinterpretq_u8_u64( + vuzp2q_u64(vreinterpretq_u64_u8(t2t3_l), vreinterpretq_u64_u8(t2t3_h))); #else - uint8x16_t t1 = vcombine_u8(vget_high_u8(t0t1_l), vget_high_u8(t0t1_h)); - uint8x16_t t0 = vcombine_u8(vget_low_u8(t0t1_l), vget_low_u8(t0t1_h)); - uint8x16_t t3 = vcombine_u8(vget_high_u8(t2t3_l), vget_high_u8(t2t3_h)); - uint8x16_t t2 = vcombine_u8(vget_low_u8(t2t3_l), vget_low_u8(t2t3_h)); + uint8x16_t t1 = vcombine_u8(vget_high_u8(t0t1_l), vget_high_u8(t0t1_h)); + uint8x16_t t0 = vcombine_u8(vget_low_u8(t0t1_l), vget_low_u8(t0t1_h)); + uint8x16_t t3 = vcombine_u8(vget_high_u8(t2t3_l), vget_high_u8(t2t3_h)); + uint8x16_t t2 = vcombine_u8(vget_low_u8(t2t3_l), vget_low_u8(t2t3_h)); #endif - // Shift the cross products - uint8x16_t t0_shift = vextq_u8(t0, t0, 15); // t0 << 8 - uint8x16_t t1_shift = vextq_u8(t1, t1, 14); // t1 << 16 - uint8x16_t t2_shift = vextq_u8(t2, t2, 13); // t2 << 24 - uint8x16_t t3_shift = vextq_u8(t3, t3, 12); // t3 << 32 + // Shift the cross products + uint8x16_t t0_shift = vextq_u8(t0, t0, 15); // t0 << 8 + uint8x16_t t1_shift = vextq_u8(t1, t1, 14); // t1 << 16 + uint8x16_t t2_shift = vextq_u8(t2, t2, 13); // t2 << 24 + uint8x16_t t3_shift = vextq_u8(t3, t3, 12); // t3 << 32 - // Accumulate the products - uint8x16_t cross1 = veorq_u8(t0_shift, t1_shift); - uint8x16_t cross2 = veorq_u8(t2_shift, t3_shift); - uint8x16_t mix = veorq_u8(d, cross1); - uint8x16_t r = veorq_u8(mix, cross2); - return vreinterpretq_u64_u8(r); + // Accumulate the products + uint8x16_t cross1 = veorq_u8(t0_shift, t1_shift); + uint8x16_t cross2 = veorq_u8(t2_shift, t3_shift); + uint8x16_t mix = veorq_u8(d, cross1); + uint8x16_t r = veorq_u8(mix, cross2); + return vreinterpretq_u64_u8(r); } -#endif // ARMv7 polyfill +#endif // ARMv7 polyfill // C equivalent: // __m128i _mm_shuffle_epi32_default(__m128i a, @@ -818,29 +821,29 @@ static uint64x2_t _sse2neon_vmull_p64(uint64x1_t _a, uint64x1_t _b) // return ret; // } #define _mm_shuffle_epi32_default(a, imm) \ - __extension__({ \ - int32x4_t ret; \ - ret = vmovq_n_s32( \ - vgetq_lane_s32(vreinterpretq_s32_m128i(a), (imm) & (0x3))); \ - ret = vsetq_lane_s32( \ - vgetq_lane_s32(vreinterpretq_s32_m128i(a), ((imm) >> 2) & 0x3), \ - ret, 1); \ - ret = vsetq_lane_s32( \ - vgetq_lane_s32(vreinterpretq_s32_m128i(a), ((imm) >> 4) & 0x3), \ - ret, 2); \ - ret = vsetq_lane_s32( \ - vgetq_lane_s32(vreinterpretq_s32_m128i(a), ((imm) >> 6) & 0x3), \ - ret, 3); \ - vreinterpretq_m128i_s32(ret); \ - }) + __extension__({ \ + int32x4_t ret; \ + ret = vmovq_n_s32( \ + vgetq_lane_s32(vreinterpretq_s32_m128i(a), (imm) & (0x3))); \ + ret = vsetq_lane_s32( \ + vgetq_lane_s32(vreinterpretq_s32_m128i(a), ((imm) >> 2) & 0x3), \ + ret, 1); \ + ret = vsetq_lane_s32( \ + vgetq_lane_s32(vreinterpretq_s32_m128i(a), ((imm) >> 4) & 0x3), \ + ret, 2); \ + ret = vsetq_lane_s32( \ + vgetq_lane_s32(vreinterpretq_s32_m128i(a), ((imm) >> 6) & 0x3), \ + ret, 3); \ + vreinterpretq_m128i_s32(ret); \ + }) // Takes the upper 64 bits of a and places it in the low end of the result // Takes the lower 64 bits of a and places it into the high end of the result. FORCE_INLINE __m128i _mm_shuffle_epi_1032(__m128i a) { - int32x2_t a32 = vget_high_s32(vreinterpretq_s32_m128i(a)); - int32x2_t a10 = vget_low_s32(vreinterpretq_s32_m128i(a)); - return vreinterpretq_m128i_s32(vcombine_s32(a32, a10)); + int32x2_t a32 = vget_high_s32(vreinterpretq_s32_m128i(a)); + int32x2_t a10 = vget_low_s32(vreinterpretq_s32_m128i(a)); + return vreinterpretq_m128i_s32(vcombine_s32(a32, a10)); } // takes the lower two 32-bit values from a and swaps them and places in low end @@ -848,42 +851,42 @@ FORCE_INLINE __m128i _mm_shuffle_epi_1032(__m128i a) // in high end of result. FORCE_INLINE __m128i _mm_shuffle_epi_2301(__m128i a) { - int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a))); - int32x2_t a23 = vrev64_s32(vget_high_s32(vreinterpretq_s32_m128i(a))); - return vreinterpretq_m128i_s32(vcombine_s32(a01, a23)); + int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a))); + int32x2_t a23 = vrev64_s32(vget_high_s32(vreinterpretq_s32_m128i(a))); + return vreinterpretq_m128i_s32(vcombine_s32(a01, a23)); } // rotates the least significant 32 bits into the most significant 32 bits, and // shifts the rest down FORCE_INLINE __m128i _mm_shuffle_epi_0321(__m128i a) { - return vreinterpretq_m128i_s32( - vextq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(a), 1)); + return vreinterpretq_m128i_s32( + vextq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(a), 1)); } // rotates the most significant 32 bits into the least significant 32 bits, and // shifts the rest up FORCE_INLINE __m128i _mm_shuffle_epi_2103(__m128i a) { - return vreinterpretq_m128i_s32( - vextq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(a), 3)); + return vreinterpretq_m128i_s32( + vextq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(a), 3)); } // gets the lower 64 bits of a, and places it in the upper 64 bits // gets the lower 64 bits of a and places it in the lower 64 bits FORCE_INLINE __m128i _mm_shuffle_epi_1010(__m128i a) { - int32x2_t a10 = vget_low_s32(vreinterpretq_s32_m128i(a)); - return vreinterpretq_m128i_s32(vcombine_s32(a10, a10)); + int32x2_t a10 = vget_low_s32(vreinterpretq_s32_m128i(a)); + return vreinterpretq_m128i_s32(vcombine_s32(a10, a10)); } // gets the lower 64 bits of a, swaps the 0 and 1 elements, and places it in the // lower 64 bits gets the lower 64 bits of a, and places it in the upper 64 bits FORCE_INLINE __m128i _mm_shuffle_epi_1001(__m128i a) { - int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a))); - int32x2_t a10 = vget_low_s32(vreinterpretq_s32_m128i(a)); - return vreinterpretq_m128i_s32(vcombine_s32(a01, a10)); + int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a))); + int32x2_t a10 = vget_low_s32(vreinterpretq_s32_m128i(a)); + return vreinterpretq_m128i_s32(vcombine_s32(a01, a10)); } // gets the lower 64 bits of a, swaps the 0 and 1 elements and places it in the @@ -891,45 +894,45 @@ FORCE_INLINE __m128i _mm_shuffle_epi_1001(__m128i a) // places it in the lower 64 bits FORCE_INLINE __m128i _mm_shuffle_epi_0101(__m128i a) { - int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a))); - return vreinterpretq_m128i_s32(vcombine_s32(a01, a01)); + int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a))); + return vreinterpretq_m128i_s32(vcombine_s32(a01, a01)); } FORCE_INLINE __m128i _mm_shuffle_epi_2211(__m128i a) { - int32x2_t a11 = vdup_lane_s32(vget_low_s32(vreinterpretq_s32_m128i(a)), 1); - int32x2_t a22 = vdup_lane_s32(vget_high_s32(vreinterpretq_s32_m128i(a)), 0); - return vreinterpretq_m128i_s32(vcombine_s32(a11, a22)); + int32x2_t a11 = vdup_lane_s32(vget_low_s32(vreinterpretq_s32_m128i(a)), 1); + int32x2_t a22 = vdup_lane_s32(vget_high_s32(vreinterpretq_s32_m128i(a)), 0); + return vreinterpretq_m128i_s32(vcombine_s32(a11, a22)); } FORCE_INLINE __m128i _mm_shuffle_epi_0122(__m128i a) { - int32x2_t a22 = vdup_lane_s32(vget_high_s32(vreinterpretq_s32_m128i(a)), 0); - int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a))); - return vreinterpretq_m128i_s32(vcombine_s32(a22, a01)); + int32x2_t a22 = vdup_lane_s32(vget_high_s32(vreinterpretq_s32_m128i(a)), 0); + int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a))); + return vreinterpretq_m128i_s32(vcombine_s32(a22, a01)); } FORCE_INLINE __m128i _mm_shuffle_epi_3332(__m128i a) { - int32x2_t a32 = vget_high_s32(vreinterpretq_s32_m128i(a)); - int32x2_t a33 = vdup_lane_s32(vget_high_s32(vreinterpretq_s32_m128i(a)), 1); - return vreinterpretq_m128i_s32(vcombine_s32(a32, a33)); + int32x2_t a32 = vget_high_s32(vreinterpretq_s32_m128i(a)); + int32x2_t a33 = vdup_lane_s32(vget_high_s32(vreinterpretq_s32_m128i(a)), 1); + return vreinterpretq_m128i_s32(vcombine_s32(a32, a33)); } // FORCE_INLINE __m128i _mm_shuffle_epi32_splat(__m128i a, __constrange(0,255) // int imm) #if defined(__aarch64__) #define _mm_shuffle_epi32_splat(a, imm) \ - __extension__({ \ - vreinterpretq_m128i_s32( \ - vdupq_laneq_s32(vreinterpretq_s32_m128i(a), (imm))); \ - }) + __extension__({ \ + vreinterpretq_m128i_s32( \ + vdupq_laneq_s32(vreinterpretq_s32_m128i(a), (imm))); \ + }) #else #define _mm_shuffle_epi32_splat(a, imm) \ - __extension__({ \ - vreinterpretq_m128i_s32( \ - vdupq_n_s32(vgetq_lane_s32(vreinterpretq_s32_m128i(a), (imm)))); \ - }) + __extension__({ \ + vreinterpretq_m128i_s32( \ + vdupq_n_s32(vgetq_lane_s32(vreinterpretq_s32_m128i(a), (imm)))); \ + }) #endif // NEON does not support a general purpose permute intrinsic @@ -947,21 +950,21 @@ FORCE_INLINE __m128i _mm_shuffle_epi_3332(__m128i a) // // https://msdn.microsoft.com/en-us/library/vstudio/5f0858x0(v=vs.100).aspx #define _mm_shuffle_ps_default(a, b, imm) \ - __extension__({ \ - float32x4_t ret; \ - ret = vmovq_n_f32( \ - vgetq_lane_f32(vreinterpretq_f32_m128(a), (imm) & (0x3))); \ - ret = vsetq_lane_f32( \ - vgetq_lane_f32(vreinterpretq_f32_m128(a), ((imm) >> 2) & 0x3), \ - ret, 1); \ - ret = vsetq_lane_f32( \ - vgetq_lane_f32(vreinterpretq_f32_m128(b), ((imm) >> 4) & 0x3), \ - ret, 2); \ - ret = vsetq_lane_f32( \ - vgetq_lane_f32(vreinterpretq_f32_m128(b), ((imm) >> 6) & 0x3), \ - ret, 3); \ - vreinterpretq_m128_f32(ret); \ - }) + __extension__({ \ + float32x4_t ret; \ + ret = vmovq_n_f32( \ + vgetq_lane_f32(vreinterpretq_f32_m128(a), (imm) & (0x3))); \ + ret = vsetq_lane_f32( \ + vgetq_lane_f32(vreinterpretq_f32_m128(a), ((imm) >> 2) & 0x3), \ + ret, 1); \ + ret = vsetq_lane_f32( \ + vgetq_lane_f32(vreinterpretq_f32_m128(b), ((imm) >> 4) & 0x3), \ + ret, 2); \ + ret = vsetq_lane_f32( \ + vgetq_lane_f32(vreinterpretq_f32_m128(b), ((imm) >> 6) & 0x3), \ + ret, 3); \ + vreinterpretq_m128_f32(ret); \ + }) // Shuffles the lower 4 signed or unsigned 16-bit integers in a as specified // by imm. @@ -970,18 +973,18 @@ FORCE_INLINE __m128i _mm_shuffle_epi_3332(__m128i a) // __constrange(0,255) int // imm) #define _mm_shufflelo_epi16_function(a, imm) \ - __extension__({ \ - int16x8_t ret = vreinterpretq_s16_m128i(a); \ - int16x4_t lowBits = vget_low_s16(ret); \ - ret = vsetq_lane_s16(vget_lane_s16(lowBits, (imm) & (0x3)), ret, 0); \ - ret = vsetq_lane_s16(vget_lane_s16(lowBits, ((imm) >> 2) & 0x3), ret, \ - 1); \ - ret = vsetq_lane_s16(vget_lane_s16(lowBits, ((imm) >> 4) & 0x3), ret, \ - 2); \ - ret = vsetq_lane_s16(vget_lane_s16(lowBits, ((imm) >> 6) & 0x3), ret, \ - 3); \ - vreinterpretq_m128i_s16(ret); \ - }) + __extension__({ \ + int16x8_t ret = vreinterpretq_s16_m128i(a); \ + int16x4_t lowBits = vget_low_s16(ret); \ + ret = vsetq_lane_s16(vget_lane_s16(lowBits, (imm) & (0x3)), ret, 0); \ + ret = vsetq_lane_s16(vget_lane_s16(lowBits, ((imm) >> 2) & 0x3), ret, \ + 1); \ + ret = vsetq_lane_s16(vget_lane_s16(lowBits, ((imm) >> 4) & 0x3), ret, \ + 2); \ + ret = vsetq_lane_s16(vget_lane_s16(lowBits, ((imm) >> 6) & 0x3), ret, \ + 3); \ + vreinterpretq_m128i_s16(ret); \ + }) // Shuffles the upper 4 signed or unsigned 16-bit integers in a as specified // by imm. @@ -990,18 +993,18 @@ FORCE_INLINE __m128i _mm_shuffle_epi_3332(__m128i a) // __constrange(0,255) int // imm) #define _mm_shufflehi_epi16_function(a, imm) \ - __extension__({ \ - int16x8_t ret = vreinterpretq_s16_m128i(a); \ - int16x4_t highBits = vget_high_s16(ret); \ - ret = vsetq_lane_s16(vget_lane_s16(highBits, (imm) & (0x3)), ret, 4); \ - ret = vsetq_lane_s16(vget_lane_s16(highBits, ((imm) >> 2) & 0x3), ret, \ - 5); \ - ret = vsetq_lane_s16(vget_lane_s16(highBits, ((imm) >> 4) & 0x3), ret, \ - 6); \ - ret = vsetq_lane_s16(vget_lane_s16(highBits, ((imm) >> 6) & 0x3), ret, \ - 7); \ - vreinterpretq_m128i_s16(ret); \ - }) + __extension__({ \ + int16x8_t ret = vreinterpretq_s16_m128i(a); \ + int16x4_t highBits = vget_high_s16(ret); \ + ret = vsetq_lane_s16(vget_lane_s16(highBits, (imm) & (0x3)), ret, 4); \ + ret = vsetq_lane_s16(vget_lane_s16(highBits, ((imm) >> 2) & 0x3), ret, \ + 5); \ + ret = vsetq_lane_s16(vget_lane_s16(highBits, ((imm) >> 4) & 0x3), ret, \ + 6); \ + ret = vsetq_lane_s16(vget_lane_s16(highBits, ((imm) >> 6) & 0x3), ret, \ + 7); \ + vreinterpretq_m128i_s16(ret); \ + }) /* MMX */ @@ -1020,18 +1023,18 @@ FORCE_INLINE void _mm_empty(void) {} // https://msdn.microsoft.com/en-us/library/vstudio/c9848chc(v=vs.100).aspx FORCE_INLINE __m128 _mm_add_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_f32( - vaddq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_f32( + vaddq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); } // adds the scalar single-precision floating point values of a and b. // https://msdn.microsoft.com/en-us/library/be94x2y6(v=vs.100).aspx FORCE_INLINE __m128 _mm_add_ss(__m128 a, __m128 b) { - float32_t b0 = vgetq_lane_f32(vreinterpretq_f32_m128(b), 0); - float32x4_t value = vsetq_lane_f32(b0, vdupq_n_f32(0), 0); - // the upper values in the result must be the remnants of . - return vreinterpretq_m128_f32(vaddq_f32(a, value)); + float32_t b0 = vgetq_lane_f32(vreinterpretq_f32_m128(b), 0); + float32x4_t value = vsetq_lane_f32(b0, vdupq_n_f32(0), 0); + // the upper values in the result must be the remnants of . + return vreinterpretq_m128_f32(vaddq_f32(a, value)); } // Computes the bitwise AND of the four single-precision, floating-point values @@ -1045,8 +1048,8 @@ FORCE_INLINE __m128 _mm_add_ss(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/vstudio/73ck1xc5(v=vs.100).aspx FORCE_INLINE __m128 _mm_and_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_s32( - vandq_s32(vreinterpretq_s32_m128(a), vreinterpretq_s32_m128(b))); + return vreinterpretq_m128_s32( + vandq_s32(vreinterpretq_s32_m128(a), vreinterpretq_s32_m128(b))); } // Computes the bitwise AND-NOT of the four single-precision, floating-point @@ -1060,9 +1063,9 @@ FORCE_INLINE __m128 _mm_and_ps(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/vstudio/68h7wd02(v=vs.100).aspx FORCE_INLINE __m128 _mm_andnot_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_s32( - vbicq_s32(vreinterpretq_s32_m128(b), - vreinterpretq_s32_m128(a))); // *NOTE* argument swap + return vreinterpretq_m128_s32( + vbicq_s32(vreinterpretq_s32_m128(b), + vreinterpretq_s32_m128(a))); // *NOTE* argument swap } // Average packed unsigned 16-bit integers in a and b, and store the results in @@ -1076,8 +1079,8 @@ FORCE_INLINE __m128 _mm_andnot_ps(__m128 a, __m128 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_avg_pu16 FORCE_INLINE __m64 _mm_avg_pu16(__m64 a, __m64 b) { - return vreinterpret_m64_u16( - vrhadd_u16(vreinterpret_u16_m64(a), vreinterpret_u16_m64(b))); + return vreinterpret_m64_u16( + vrhadd_u16(vreinterpret_u16_m64(a), vreinterpret_u16_m64(b))); } // Average packed unsigned 8-bit integers in a and b, and store the results in @@ -1091,38 +1094,38 @@ FORCE_INLINE __m64 _mm_avg_pu16(__m64 a, __m64 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_avg_pu8 FORCE_INLINE __m64 _mm_avg_pu8(__m64 a, __m64 b) { - return vreinterpret_m64_u8( - vrhadd_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b))); + return vreinterpret_m64_u8( + vrhadd_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b))); } // Compares for equality. // https://msdn.microsoft.com/en-us/library/vstudio/36aectz5(v=vs.100).aspx FORCE_INLINE __m128 _mm_cmpeq_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_u32( - vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_u32( + vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); } // Compares for equality. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/k423z28e(v=vs.100) FORCE_INLINE __m128 _mm_cmpeq_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_cmpeq_ps(a, b)); + return _mm_move_ss(a, _mm_cmpeq_ps(a, b)); } // Compares for greater than or equal. // https://msdn.microsoft.com/en-us/library/vstudio/fs813y2t(v=vs.100).aspx FORCE_INLINE __m128 _mm_cmpge_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_u32( - vcgeq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_u32( + vcgeq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); } // Compares for greater than or equal. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/kesh3ddc(v=vs.100) FORCE_INLINE __m128 _mm_cmpge_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_cmpge_ps(a, b)); + return _mm_move_ss(a, _mm_cmpge_ps(a, b)); } // Compares for greater than. @@ -1135,15 +1138,15 @@ FORCE_INLINE __m128 _mm_cmpge_ss(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/vstudio/11dy102s(v=vs.100).aspx FORCE_INLINE __m128 _mm_cmpgt_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_u32( - vcgtq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_u32( + vcgtq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); } // Compares for greater than. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/1xyyyy9e(v=vs.100) FORCE_INLINE __m128 _mm_cmpgt_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_cmpgt_ps(a, b)); + return _mm_move_ss(a, _mm_cmpgt_ps(a, b)); } // Compares for less than or equal. @@ -1156,105 +1159,105 @@ FORCE_INLINE __m128 _mm_cmpgt_ss(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/vstudio/1s75w83z(v=vs.100).aspx FORCE_INLINE __m128 _mm_cmple_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_u32( - vcleq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_u32( + vcleq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); } // Compares for less than or equal. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/a7x0hbhw(v=vs.100) FORCE_INLINE __m128 _mm_cmple_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_cmple_ps(a, b)); + return _mm_move_ss(a, _mm_cmple_ps(a, b)); } // Compares for less than // https://msdn.microsoft.com/en-us/library/vstudio/f330yhc8(v=vs.100).aspx FORCE_INLINE __m128 _mm_cmplt_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_u32( - vcltq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_u32( + vcltq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); } // Compares for less than // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/fy94wye7(v=vs.100) FORCE_INLINE __m128 _mm_cmplt_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_cmplt_ps(a, b)); + return _mm_move_ss(a, _mm_cmplt_ps(a, b)); } // Compares for inequality. // https://msdn.microsoft.com/en-us/library/sf44thbx(v=vs.100).aspx FORCE_INLINE __m128 _mm_cmpneq_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_u32(vmvnq_u32( - vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)))); + return vreinterpretq_m128_u32(vmvnq_u32( + vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)))); } // Compares for inequality. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/ekya8fh4(v=vs.100) FORCE_INLINE __m128 _mm_cmpneq_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_cmpneq_ps(a, b)); + return _mm_move_ss(a, _mm_cmpneq_ps(a, b)); } // Compares for not greater than or equal. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/wsexys62(v=vs.100) FORCE_INLINE __m128 _mm_cmpnge_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_u32(vmvnq_u32( - vcgeq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)))); + return vreinterpretq_m128_u32(vmvnq_u32( + vcgeq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)))); } // Compares for not greater than or equal. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/fk2y80s8(v=vs.100) FORCE_INLINE __m128 _mm_cmpnge_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_cmpnge_ps(a, b)); + return _mm_move_ss(a, _mm_cmpnge_ps(a, b)); } // Compares for not greater than. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/d0xh7w0s(v=vs.100) FORCE_INLINE __m128 _mm_cmpngt_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_u32(vmvnq_u32( - vcgtq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)))); + return vreinterpretq_m128_u32(vmvnq_u32( + vcgtq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)))); } // Compares for not greater than. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/z7x9ydwh(v=vs.100) FORCE_INLINE __m128 _mm_cmpngt_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_cmpngt_ps(a, b)); + return _mm_move_ss(a, _mm_cmpngt_ps(a, b)); } // Compares for not less than or equal. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/6a330kxw(v=vs.100) FORCE_INLINE __m128 _mm_cmpnle_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_u32(vmvnq_u32( - vcleq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)))); + return vreinterpretq_m128_u32(vmvnq_u32( + vcleq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)))); } // Compares for not less than or equal. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/z7x9ydwh(v=vs.100) FORCE_INLINE __m128 _mm_cmpnle_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_cmpnle_ps(a, b)); + return _mm_move_ss(a, _mm_cmpnle_ps(a, b)); } // Compares for not less than. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/4686bbdw(v=vs.100) FORCE_INLINE __m128 _mm_cmpnlt_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_u32(vmvnq_u32( - vcltq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)))); + return vreinterpretq_m128_u32(vmvnq_u32( + vcltq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)))); } // Compares for not less than. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/56b9z2wf(v=vs.100) FORCE_INLINE __m128 _mm_cmpnlt_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_cmpnlt_ps(a, b)); + return _mm_move_ss(a, _mm_cmpnlt_ps(a, b)); } // Compares the four 32-bit floats in a and b to check if any values are NaN. @@ -1266,39 +1269,39 @@ FORCE_INLINE __m128 _mm_cmpnlt_ss(__m128 a, __m128 b) // http://stackoverflow.com/questions/29349621/neon-isnanval-intrinsics FORCE_INLINE __m128 _mm_cmpord_ps(__m128 a, __m128 b) { - // Note: NEON does not have ordered compare builtin - // Need to compare a eq a and b eq b to check for NaN - // Do AND of results to get final - uint32x4_t ceqaa = - vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a)); - uint32x4_t ceqbb = - vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b)); - return vreinterpretq_m128_u32(vandq_u32(ceqaa, ceqbb)); + // Note: NEON does not have ordered compare builtin + // Need to compare a eq a and b eq b to check for NaN + // Do AND of results to get final + uint32x4_t ceqaa = + vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a)); + uint32x4_t ceqbb = + vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b)); + return vreinterpretq_m128_u32(vandq_u32(ceqaa, ceqbb)); } // Compares for ordered. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/343t62da(v=vs.100) FORCE_INLINE __m128 _mm_cmpord_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_cmpord_ps(a, b)); + return _mm_move_ss(a, _mm_cmpord_ps(a, b)); } // Compares for unordered. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/khy6fk1t(v=vs.100) FORCE_INLINE __m128 _mm_cmpunord_ps(__m128 a, __m128 b) { - uint32x4_t f32a = - vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a)); - uint32x4_t f32b = - vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b)); - return vreinterpretq_m128_u32(vmvnq_u32(vandq_u32(f32a, f32b))); + uint32x4_t f32a = + vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a)); + uint32x4_t f32b = + vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b)); + return vreinterpretq_m128_u32(vmvnq_u32(vandq_u32(f32a, f32b))); } // Compares for unordered. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/2as2387b(v=vs.100) FORCE_INLINE __m128 _mm_cmpunord_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_cmpunord_ps(a, b)); + return _mm_move_ss(a, _mm_cmpunord_ps(a, b)); } // Compares the lower single-precision floating point scalar values of a and b @@ -1306,9 +1309,9 @@ FORCE_INLINE __m128 _mm_cmpunord_ss(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/93yx2h2b(v=vs.100).aspx FORCE_INLINE int _mm_comieq_ss(__m128 a, __m128 b) { - uint32x4_t a_eq_b = - vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)); - return vgetq_lane_u32(a_eq_b, 0) & 0x1; + uint32x4_t a_eq_b = + vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)); + return vgetq_lane_u32(a_eq_b, 0) & 0x1; } // Compares the lower single-precision floating point scalar values of a and b @@ -1316,9 +1319,9 @@ FORCE_INLINE int _mm_comieq_ss(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/8t80des6(v=vs.100).aspx FORCE_INLINE int _mm_comige_ss(__m128 a, __m128 b) { - uint32x4_t a_ge_b = - vcgeq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)); - return vgetq_lane_u32(a_ge_b, 0) & 0x1; + uint32x4_t a_ge_b = + vcgeq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)); + return vgetq_lane_u32(a_ge_b, 0) & 0x1; } // Compares the lower single-precision floating point scalar values of a and b @@ -1326,9 +1329,9 @@ FORCE_INLINE int _mm_comige_ss(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/b0738e0t(v=vs.100).aspx FORCE_INLINE int _mm_comigt_ss(__m128 a, __m128 b) { - uint32x4_t a_gt_b = - vcgtq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)); - return vgetq_lane_u32(a_gt_b, 0) & 0x1; + uint32x4_t a_gt_b = + vcgtq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)); + return vgetq_lane_u32(a_gt_b, 0) & 0x1; } // Compares the lower single-precision floating point scalar values of a and b @@ -1336,9 +1339,9 @@ FORCE_INLINE int _mm_comigt_ss(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/1w4t7c57(v=vs.90).aspx FORCE_INLINE int _mm_comile_ss(__m128 a, __m128 b) { - uint32x4_t a_le_b = - vcleq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)); - return vgetq_lane_u32(a_le_b, 0) & 0x1; + uint32x4_t a_le_b = + vcleq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)); + return vgetq_lane_u32(a_le_b, 0) & 0x1; } // Compares the lower single-precision floating point scalar values of a and b @@ -1348,9 +1351,9 @@ FORCE_INLINE int _mm_comile_ss(__m128 a, __m128 b) // NAN the docs say you will get a one, but in fact, it will return a zero!! FORCE_INLINE int _mm_comilt_ss(__m128 a, __m128 b) { - uint32x4_t a_lt_b = - vcltq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)); - return vgetq_lane_u32(a_lt_b, 0) & 0x1; + uint32x4_t a_lt_b = + vcltq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)); + return vgetq_lane_u32(a_lt_b, 0) & 0x1; } // Compares the lower single-precision floating point scalar values of a and b @@ -1358,7 +1361,7 @@ FORCE_INLINE int _mm_comilt_ss(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/bafh5e0a(v=vs.90).aspx FORCE_INLINE int _mm_comineq_ss(__m128 a, __m128 b) { - return !_mm_comieq_ss(a, b); + return !_mm_comieq_ss(a, b); } // Convert packed signed 32-bit integers in b to packed single-precision @@ -1374,9 +1377,9 @@ FORCE_INLINE int _mm_comineq_ss(__m128 a, __m128 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvt_pi2ps FORCE_INLINE __m128 _mm_cvt_pi2ps(__m128 a, __m64 b) { - return vreinterpretq_m128_f32( - vcombine_f32(vcvt_f32_s32(vreinterpret_s32_m64(b)), - vget_high_f32(vreinterpretq_f32_m128(a)))); + return vreinterpretq_m128_f32( + vcombine_f32(vcvt_f32_s32(vreinterpret_s32_m64(b)), + vget_high_f32(vreinterpretq_f32_m128(a)))); } // Convert packed single-precision (32-bit) floating-point elements in a to @@ -1391,11 +1394,11 @@ FORCE_INLINE __m128 _mm_cvt_pi2ps(__m128 a, __m64 b) FORCE_INLINE __m64 _mm_cvt_ps2pi(__m128 a) { #if defined(__aarch64__) - return vreinterpret_m64_s32( - vget_low_s32(vcvtnq_s32_f32(vrndiq_f32(vreinterpretq_f32_m128(a))))); + return vreinterpret_m64_s32( + vget_low_s32(vcvtnq_s32_f32(vrndiq_f32(vreinterpretq_f32_m128(a))))); #else - return vreinterpret_m64_s32(vcvt_s32_f32(vget_low_f32( - vreinterpretq_f32_m128(_mm_round_ps(a, _MM_FROUND_CUR_DIRECTION))))); + return vreinterpret_m64_s32(vcvt_s32_f32(vget_low_f32( + vreinterpretq_f32_m128(_mm_round_ps(a, _MM_FROUND_CUR_DIRECTION))))); #endif } @@ -1409,8 +1412,8 @@ FORCE_INLINE __m64 _mm_cvt_ps2pi(__m128 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvt_si2ss FORCE_INLINE __m128 _mm_cvt_si2ss(__m128 a, int b) { - return vreinterpretq_m128_f32( - vsetq_lane_f32((float) b, vreinterpretq_f32_m128(a), 0)); + return vreinterpretq_m128_f32( + vsetq_lane_f32((float)b, vreinterpretq_f32_m128(a), 0)); } // Convert the lower single-precision (32-bit) floating-point element in a to a @@ -1419,12 +1422,12 @@ FORCE_INLINE __m128 _mm_cvt_si2ss(__m128 a, int b) FORCE_INLINE int _mm_cvt_ss2si(__m128 a) { #if defined(__aarch64__) - return vgetq_lane_s32(vcvtnq_s32_f32(vrndiq_f32(vreinterpretq_f32_m128(a))), - 0); + return vgetq_lane_s32(vcvtnq_s32_f32(vrndiq_f32(vreinterpretq_f32_m128(a))), + 0); #else - float32_t data = vgetq_lane_f32( - vreinterpretq_f32_m128(_mm_round_ps(a, _MM_FROUND_CUR_DIRECTION)), 0); - return (int32_t) data; + float32_t data = vgetq_lane_f32( + vreinterpretq_f32_m128(_mm_round_ps(a, _MM_FROUND_CUR_DIRECTION)), 0); + return (int32_t)data; #endif } @@ -1440,8 +1443,8 @@ FORCE_INLINE int _mm_cvt_ss2si(__m128 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpi16_ps FORCE_INLINE __m128 _mm_cvtpi16_ps(__m64 a) { - return vreinterpretq_m128_f32( - vcvtq_f32_s32(vmovl_s16(vreinterpret_s16_m64(a)))); + return vreinterpretq_m128_f32( + vcvtq_f32_s32(vmovl_s16(vreinterpret_s16_m64(a)))); } // Convert packed 32-bit integers in b to packed single-precision (32-bit) @@ -1456,9 +1459,9 @@ FORCE_INLINE __m128 _mm_cvtpi16_ps(__m64 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpi32_ps FORCE_INLINE __m128 _mm_cvtpi32_ps(__m128 a, __m64 b) { - return vreinterpretq_m128_f32( - vcombine_f32(vcvt_f32_s32(vreinterpret_s32_m64(b)), - vget_high_f32(vreinterpretq_f32_m128(a)))); + return vreinterpretq_m128_f32( + vcombine_f32(vcvt_f32_s32(vreinterpret_s32_m64(b)), + vget_high_f32(vreinterpretq_f32_m128(a)))); } // Convert packed signed 32-bit integers in a to packed single-precision @@ -1475,8 +1478,8 @@ FORCE_INLINE __m128 _mm_cvtpi32_ps(__m128 a, __m64 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpi32x2_ps FORCE_INLINE __m128 _mm_cvtpi32x2_ps(__m64 a, __m64 b) { - return vreinterpretq_m128_f32(vcvtq_f32_s32( - vcombine_s32(vreinterpret_s32_m64(a), vreinterpret_s32_m64(b)))); + return vreinterpretq_m128_f32(vcvtq_f32_s32( + vcombine_s32(vreinterpret_s32_m64(a), vreinterpret_s32_m64(b)))); } // Convert the lower packed 8-bit integers in a to packed single-precision @@ -1491,8 +1494,8 @@ FORCE_INLINE __m128 _mm_cvtpi32x2_ps(__m64 a, __m64 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpi8_ps FORCE_INLINE __m128 _mm_cvtpi8_ps(__m64 a) { - return vreinterpretq_m128_f32(vcvtq_f32_s32( - vmovl_s16(vget_low_s16(vmovl_s8(vreinterpret_s8_m64(a)))))); + return vreinterpretq_m128_f32(vcvtq_f32_s32( + vmovl_s16(vget_low_s16(vmovl_s8(vreinterpret_s8_m64(a)))))); } // Convert packed single-precision (32-bit) floating-point elements in a to @@ -1513,20 +1516,20 @@ FORCE_INLINE __m128 _mm_cvtpi8_ps(__m64 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtps_pi16 FORCE_INLINE __m64 _mm_cvtps_pi16(__m128 a) { - const __m128 i16Min = _mm_set_ps1((float) INT16_MIN); - const __m128 i16Max = _mm_set_ps1((float) INT16_MAX); - const __m128 i32Max = _mm_set_ps1((float) INT32_MAX); - const __m128i maxMask = _mm_castps_si128( - _mm_and_ps(_mm_cmpge_ps(a, i16Max), _mm_cmple_ps(a, i32Max))); - const __m128i betweenMask = _mm_castps_si128( - _mm_and_ps(_mm_cmpgt_ps(a, i16Min), _mm_cmplt_ps(a, i16Max))); - const __m128i minMask = _mm_cmpeq_epi32(_mm_or_si128(maxMask, betweenMask), - _mm_setzero_si128()); - __m128i max = _mm_and_si128(maxMask, _mm_set1_epi32(INT16_MAX)); - __m128i min = _mm_and_si128(minMask, _mm_set1_epi32(INT16_MIN)); - __m128i cvt = _mm_and_si128(betweenMask, _mm_cvtps_epi32(a)); - __m128i res32 = _mm_or_si128(_mm_or_si128(max, min), cvt); - return vreinterpret_m64_s16(vmovn_s32(vreinterpretq_s32_m128i(res32))); + const __m128 i16Min = _mm_set_ps1((float)INT16_MIN); + const __m128 i16Max = _mm_set_ps1((float)INT16_MAX); + const __m128 i32Max = _mm_set_ps1((float)INT32_MAX); + const __m128i maxMask = _mm_castps_si128( + _mm_and_ps(_mm_cmpge_ps(a, i16Max), _mm_cmple_ps(a, i32Max))); + const __m128i betweenMask = _mm_castps_si128( + _mm_and_ps(_mm_cmpgt_ps(a, i16Min), _mm_cmplt_ps(a, i16Max))); + const __m128i minMask = _mm_cmpeq_epi32(_mm_or_si128(maxMask, betweenMask), + _mm_setzero_si128()); + __m128i max = _mm_and_si128(maxMask, _mm_set1_epi32(INT16_MAX)); + __m128i min = _mm_and_si128(minMask, _mm_set1_epi32(INT16_MIN)); + __m128i cvt = _mm_and_si128(betweenMask, _mm_cvtps_epi32(a)); + __m128i res32 = _mm_or_si128(_mm_or_si128(max, min), cvt); + return vreinterpret_m64_s16(vmovn_s32(vreinterpretq_s32_m128i(res32))); } // Convert packed single-precision (32-bit) floating-point elements in a to @@ -1558,25 +1561,25 @@ FORCE_INLINE __m64 _mm_cvtps_pi16(__m128 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtps_pi8 FORCE_INLINE __m64 _mm_cvtps_pi8(__m128 a) { - const __m128 i8Min = _mm_set_ps1((float) INT8_MIN); - const __m128 i8Max = _mm_set_ps1((float) INT8_MAX); - const __m128 i32Max = _mm_set_ps1((float) INT32_MAX); - const __m128i maxMask = _mm_castps_si128( - _mm_and_ps(_mm_cmpge_ps(a, i8Max), _mm_cmple_ps(a, i32Max))); - const __m128i betweenMask = _mm_castps_si128( - _mm_and_ps(_mm_cmpgt_ps(a, i8Min), _mm_cmplt_ps(a, i8Max))); - const __m128i minMask = _mm_cmpeq_epi32(_mm_or_si128(maxMask, betweenMask), - _mm_setzero_si128()); - __m128i max = _mm_and_si128(maxMask, _mm_set1_epi32(INT8_MAX)); - __m128i min = _mm_and_si128(minMask, _mm_set1_epi32(INT8_MIN)); - __m128i cvt = _mm_and_si128(betweenMask, _mm_cvtps_epi32(a)); - __m128i res32 = _mm_or_si128(_mm_or_si128(max, min), cvt); - int16x4_t res16 = vmovn_s32(vreinterpretq_s32_m128i(res32)); - int8x8_t res8 = vmovn_s16(vcombine_s16(res16, res16)); - static const uint32_t bitMask[2] = {0xFFFFFFFF, 0}; - int8x8_t mask = vreinterpret_s8_u32(vld1_u32(bitMask)); + const __m128 i8Min = _mm_set_ps1((float)INT8_MIN); + const __m128 i8Max = _mm_set_ps1((float)INT8_MAX); + const __m128 i32Max = _mm_set_ps1((float)INT32_MAX); + const __m128i maxMask = _mm_castps_si128( + _mm_and_ps(_mm_cmpge_ps(a, i8Max), _mm_cmple_ps(a, i32Max))); + const __m128i betweenMask = _mm_castps_si128( + _mm_and_ps(_mm_cmpgt_ps(a, i8Min), _mm_cmplt_ps(a, i8Max))); + const __m128i minMask = _mm_cmpeq_epi32(_mm_or_si128(maxMask, betweenMask), + _mm_setzero_si128()); + __m128i max = _mm_and_si128(maxMask, _mm_set1_epi32(INT8_MAX)); + __m128i min = _mm_and_si128(minMask, _mm_set1_epi32(INT8_MIN)); + __m128i cvt = _mm_and_si128(betweenMask, _mm_cvtps_epi32(a)); + __m128i res32 = _mm_or_si128(_mm_or_si128(max, min), cvt); + int16x4_t res16 = vmovn_s32(vreinterpretq_s32_m128i(res32)); + int8x8_t res8 = vmovn_s16(vcombine_s16(res16, res16)); + static const uint32_t bitMask[2] = {0xFFFFFFFF, 0}; + int8x8_t mask = vreinterpret_s8_u32(vld1_u32(bitMask)); - return vreinterpret_m64_s8(vorr_s8(vand_s8(mask, res8), vdup_n_s8(0))); + return vreinterpret_m64_s8(vorr_s8(vand_s8(mask, res8), vdup_n_s8(0))); } // Convert packed unsigned 16-bit integers in a to packed single-precision @@ -1591,8 +1594,8 @@ FORCE_INLINE __m64 _mm_cvtps_pi8(__m128 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpu16_ps FORCE_INLINE __m128 _mm_cvtpu16_ps(__m64 a) { - return vreinterpretq_m128_f32( - vcvtq_f32_u32(vmovl_u16(vreinterpret_u16_m64(a)))); + return vreinterpretq_m128_f32( + vcvtq_f32_u32(vmovl_u16(vreinterpret_u16_m64(a)))); } // Convert the lower packed unsigned 8-bit integers in a to packed @@ -1608,8 +1611,8 @@ FORCE_INLINE __m128 _mm_cvtpu16_ps(__m64 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpu8_ps FORCE_INLINE __m128 _mm_cvtpu8_ps(__m64 a) { - return vreinterpretq_m128_f32(vcvtq_f32_u32( - vmovl_u16(vget_low_u16(vmovl_u8(vreinterpret_u8_m64(a)))))); + return vreinterpretq_m128_f32(vcvtq_f32_u32( + vmovl_u16(vget_low_u16(vmovl_u8(vreinterpret_u8_m64(a)))))); } // Convert the signed 32-bit integer b to a single-precision (32-bit) @@ -1632,8 +1635,8 @@ FORCE_INLINE __m128 _mm_cvtpu8_ps(__m64 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtsi64_ss FORCE_INLINE __m128 _mm_cvtsi64_ss(__m128 a, int64_t b) { - return vreinterpretq_m128_f32( - vsetq_lane_f32((float) b, vreinterpretq_f32_m128(a), 0)); + return vreinterpretq_m128_f32( + vsetq_lane_f32((float)b, vreinterpretq_f32_m128(a), 0)); } // Copy the lower single-precision (32-bit) floating-point element of a to dst. @@ -1643,7 +1646,7 @@ FORCE_INLINE __m128 _mm_cvtsi64_ss(__m128 a, int64_t b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtss_f32 FORCE_INLINE float _mm_cvtss_f32(__m128 a) { - return vgetq_lane_f32(vreinterpretq_f32_m128(a), 0); + return vgetq_lane_f32(vreinterpretq_f32_m128(a), 0); } // Convert the lower single-precision (32-bit) floating-point element in a to a @@ -1663,11 +1666,11 @@ FORCE_INLINE float _mm_cvtss_f32(__m128 a) FORCE_INLINE int64_t _mm_cvtss_si64(__m128 a) { #if defined(__aarch64__) - return (int64_t) vgetq_lane_f32(vrndiq_f32(vreinterpretq_f32_m128(a)), 0); + return (int64_t)vgetq_lane_f32(vrndiq_f32(vreinterpretq_f32_m128(a)), 0); #else - float32_t data = vgetq_lane_f32( - vreinterpretq_f32_m128(_mm_round_ps(a, _MM_FROUND_CUR_DIRECTION)), 0); - return (int64_t) data; + float32_t data = vgetq_lane_f32( + vreinterpretq_f32_m128(_mm_round_ps(a, _MM_FROUND_CUR_DIRECTION)), 0); + return (int64_t)data; #endif } @@ -1682,8 +1685,8 @@ FORCE_INLINE int64_t _mm_cvtss_si64(__m128 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtt_ps2pi FORCE_INLINE __m64 _mm_cvtt_ps2pi(__m128 a) { - return vreinterpret_m64_s32( - vget_low_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a)))); + return vreinterpret_m64_s32( + vget_low_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a)))); } // Convert the lower single-precision (32-bit) floating-point element in a to a @@ -1694,7 +1697,7 @@ FORCE_INLINE __m64 _mm_cvtt_ps2pi(__m128 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtt_ss2si FORCE_INLINE int _mm_cvtt_ss2si(__m128 a) { - return vgetq_lane_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a)), 0); + return vgetq_lane_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a)), 0); } // Convert packed single-precision (32-bit) floating-point elements in a to @@ -1724,7 +1727,7 @@ FORCE_INLINE int _mm_cvtt_ss2si(__m128 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvttss_si64 FORCE_INLINE int64_t _mm_cvttss_si64(__m128 a) { - return (int64_t) vgetq_lane_f32(vreinterpretq_f32_m128(a), 0); + return (int64_t)vgetq_lane_f32(vreinterpretq_f32_m128(a), 0); } // Divides the four single-precision, floating-point values of a and b. @@ -1738,16 +1741,16 @@ FORCE_INLINE int64_t _mm_cvttss_si64(__m128 a) FORCE_INLINE __m128 _mm_div_ps(__m128 a, __m128 b) { #if defined(__aarch64__) && !SSE2NEON_PRECISE_DIV - return vreinterpretq_m128_f32( - vdivq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_f32( + vdivq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); #else - float32x4_t recip = vrecpeq_f32(vreinterpretq_f32_m128(b)); - recip = vmulq_f32(recip, vrecpsq_f32(recip, vreinterpretq_f32_m128(b))); + float32x4_t recip = vrecpeq_f32(vreinterpretq_f32_m128(b)); + recip = vmulq_f32(recip, vrecpsq_f32(recip, vreinterpretq_f32_m128(b))); #if SSE2NEON_PRECISE_DIV - // Additional Netwon-Raphson iteration for accuracy - recip = vmulq_f32(recip, vrecpsq_f32(recip, vreinterpretq_f32_m128(b))); + // Additional Netwon-Raphson iteration for accuracy + recip = vmulq_f32(recip, vrecpsq_f32(recip, vreinterpretq_f32_m128(b))); #endif - return vreinterpretq_m128_f32(vmulq_f32(vreinterpretq_f32_m128(a), recip)); + return vreinterpretq_m128_f32(vmulq_f32(vreinterpretq_f32_m128(a), recip)); #endif } @@ -1755,23 +1758,23 @@ FORCE_INLINE __m128 _mm_div_ps(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/4y73xa49(v=vs.100).aspx FORCE_INLINE __m128 _mm_div_ss(__m128 a, __m128 b) { - float32_t value = - vgetq_lane_f32(vreinterpretq_f32_m128(_mm_div_ps(a, b)), 0); - return vreinterpretq_m128_f32( - vsetq_lane_f32(value, vreinterpretq_f32_m128(a), 0)); + float32_t value = + vgetq_lane_f32(vreinterpretq_f32_m128(_mm_div_ps(a, b)), 0); + return vreinterpretq_m128_f32( + vsetq_lane_f32(value, vreinterpretq_f32_m128(a), 0)); } // Extract a 16-bit integer from a, selected with imm8, and store the result in // the lower element of dst. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_pi16 #define _mm_extract_pi16(a, imm) \ - (int32_t) vget_lane_u16(vreinterpret_u16_m64(a), (imm)) + (int32_t)vget_lane_u16(vreinterpret_u16_m64(a), (imm)) // Free aligned memory that was allocated with _mm_malloc. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_free -FORCE_INLINE void _mm_free(void *addr) +FORCE_INLINE void _mm_free(void* addr) { - free(addr); + free(addr); } // Macro: Get the flush zero bits from the MXCSR control and status register. @@ -1780,22 +1783,23 @@ FORCE_INLINE void _mm_free(void *addr) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_MM_GET_FLUSH_ZERO_MODE FORCE_INLINE unsigned int _sse2neon_mm_get_flush_zero_mode() { - union { - fpcr_bitfield field; + union + { + fpcr_bitfield field; #if defined(__aarch64__) - uint64_t value; + uint64_t value; #else - uint32_t value; + uint32_t value; #endif - } r; + } r; #if defined(__aarch64__) - asm volatile("mrs %0, FPCR" : "=r"(r.value)); /* read */ + asm volatile("mrs %0, FPCR" : "=r"(r.value)); /* read */ #else - asm volatile("vmrs %0, FPSCR" : "=r"(r.value)); /* read */ + asm volatile("vmrs %0, FPSCR" : "=r"(r.value)); /* read */ #endif - return r.field.bit24 ? _MM_FLUSH_ZERO_ON : _MM_FLUSH_ZERO_OFF; + return r.field.bit24 ? _MM_FLUSH_ZERO_ON : _MM_FLUSH_ZERO_OFF; } // Macro: Get the rounding mode bits from the MXCSR control and status register. @@ -1804,42 +1808,46 @@ FORCE_INLINE unsigned int _sse2neon_mm_get_flush_zero_mode() // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_MM_GET_ROUNDING_MODE FORCE_INLINE unsigned int _MM_GET_ROUNDING_MODE() { - union { - fpcr_bitfield field; + union + { + fpcr_bitfield field; #if defined(__aarch64__) - uint64_t value; + uint64_t value; #else - uint32_t value; + uint32_t value; #endif - } r; + } r; #if defined(__aarch64__) - asm volatile("mrs %0, FPCR" : "=r"(r.value)); /* read */ + asm volatile("mrs %0, FPCR" : "=r"(r.value)); /* read */ #else - asm volatile("vmrs %0, FPSCR" : "=r"(r.value)); /* read */ + asm volatile("vmrs %0, FPSCR" : "=r"(r.value)); /* read */ #endif - if (r.field.bit22) { - return r.field.bit23 ? _MM_ROUND_TOWARD_ZERO : _MM_ROUND_UP; - } else { - return r.field.bit23 ? _MM_ROUND_DOWN : _MM_ROUND_NEAREST; - } + if (r.field.bit22) + { + return r.field.bit23 ? _MM_ROUND_TOWARD_ZERO : _MM_ROUND_UP; + } + else + { + return r.field.bit23 ? _MM_ROUND_DOWN : _MM_ROUND_NEAREST; + } } // Copy a to dst, and insert the 16-bit integer i into dst at the location // specified by imm8. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_insert_pi16 #define _mm_insert_pi16(a, b, imm) \ - __extension__({ \ - vreinterpret_m64_s16( \ - vset_lane_s16((b), vreinterpret_s16_m64(a), (imm))); \ - }) + __extension__({ \ + vreinterpret_m64_s16( \ + vset_lane_s16((b), vreinterpret_s16_m64(a), (imm))); \ + }) // Loads four single-precision, floating-point values. // https://msdn.microsoft.com/en-us/library/vstudio/zzd50xxt(v=vs.100).aspx -FORCE_INLINE __m128 _mm_load_ps(const float *p) +FORCE_INLINE __m128 _mm_load_ps(const float* p) { - return vreinterpretq_m128_f32(vld1q_f32(p)); + return vreinterpretq_m128_f32(vld1q_f32(p)); } // Load a single-precision (32-bit) floating-point element from memory into all @@ -1856,17 +1864,17 @@ FORCE_INLINE __m128 _mm_load_ps(const float *p) // Loads an single - precision, floating - point value into the low word and // clears the upper three words. // https://msdn.microsoft.com/en-us/library/548bb9h4%28v=vs.90%29.aspx -FORCE_INLINE __m128 _mm_load_ss(const float *p) +FORCE_INLINE __m128 _mm_load_ss(const float* p) { - return vreinterpretq_m128_f32(vsetq_lane_f32(*p, vdupq_n_f32(0), 0)); + return vreinterpretq_m128_f32(vsetq_lane_f32(*p, vdupq_n_f32(0), 0)); } // Loads a single single-precision, floating-point value, copying it into all // four words // https://msdn.microsoft.com/en-us/library/vstudio/5cdkf716(v=vs.100).aspx -FORCE_INLINE __m128 _mm_load1_ps(const float *p) +FORCE_INLINE __m128 _mm_load1_ps(const float* p) { - return vreinterpretq_m128_f32(vld1q_dup_f32(p)); + return vreinterpretq_m128_f32(vld1q_dup_f32(p)); } // Sets the upper two single-precision, floating-point values with 64 @@ -1879,10 +1887,10 @@ FORCE_INLINE __m128 _mm_load1_ps(const float *p) // r3 := *p1 // // https://msdn.microsoft.com/en-us/library/w92wta0x(v%3dvs.100).aspx -FORCE_INLINE __m128 _mm_loadh_pi(__m128 a, __m64 const *p) +FORCE_INLINE __m128 _mm_loadh_pi(__m128 a, __m64 const* p) { - return vreinterpretq_m128_f32( - vcombine_f32(vget_low_f32(a), vld1_f32((const float32_t *) p))); + return vreinterpretq_m128_f32( + vcombine_f32(vget_low_f32(a), vld1_f32((const float32_t*)p))); } // Sets the lower two single-precision, floating-point values with 64 @@ -1896,10 +1904,10 @@ FORCE_INLINE __m128 _mm_loadh_pi(__m128 a, __m64 const *p) // r3 := a3 // // https://msdn.microsoft.com/en-us/library/s57cyak2(v=vs.100).aspx -FORCE_INLINE __m128 _mm_loadl_pi(__m128 a, __m64 const *p) +FORCE_INLINE __m128 _mm_loadl_pi(__m128 a, __m64 const* p) { - return vreinterpretq_m128_f32( - vcombine_f32(vld1_f32((const float32_t *) p), vget_high_f32(a))); + return vreinterpretq_m128_f32( + vcombine_f32(vld1_f32((const float32_t*)p), vget_high_f32(a))); } // Load 4 single-precision (32-bit) floating-point elements from memory into dst @@ -1912,19 +1920,19 @@ FORCE_INLINE __m128 _mm_loadl_pi(__m128 a, __m64 const *p) // dst[127:96] := MEM[mem_addr+31:mem_addr] // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadr_ps -FORCE_INLINE __m128 _mm_loadr_ps(const float *p) +FORCE_INLINE __m128 _mm_loadr_ps(const float* p) { - float32x4_t v = vrev64q_f32(vld1q_f32(p)); - return vreinterpretq_m128_f32(vextq_f32(v, v, 2)); + float32x4_t v = vrev64q_f32(vld1q_f32(p)); + return vreinterpretq_m128_f32(vextq_f32(v, v, 2)); } // Loads four single-precision, floating-point values. // https://msdn.microsoft.com/en-us/library/x1b16s7z%28v=vs.90%29.aspx -FORCE_INLINE __m128 _mm_loadu_ps(const float *p) +FORCE_INLINE __m128 _mm_loadu_ps(const float* p) { - // for neon, alignment doesn't matter, so _mm_load_ps and _mm_loadu_ps are - // equivalent for neon - return vreinterpretq_m128_f32(vld1q_f32(p)); + // for neon, alignment doesn't matter, so _mm_load_ps and _mm_loadu_ps are + // equivalent for neon + return vreinterpretq_m128_f32(vld1q_f32(p)); } // Load unaligned 16-bit integer from memory into the first element of dst. @@ -1933,10 +1941,10 @@ FORCE_INLINE __m128 _mm_loadu_ps(const float *p) // dst[MAX:16] := 0 // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadu_si16 -FORCE_INLINE __m128i _mm_loadu_si16(const void *p) +FORCE_INLINE __m128i _mm_loadu_si16(const void* p) { - return vreinterpretq_m128i_s16( - vsetq_lane_s16(*(const int16_t *) p, vdupq_n_s16(0), 0)); + return vreinterpretq_m128i_s16( + vsetq_lane_s16(*(const int16_t*)p, vdupq_n_s16(0), 0)); } // Load unaligned 64-bit integer from memory into the first element of dst. @@ -1945,39 +1953,39 @@ FORCE_INLINE __m128i _mm_loadu_si16(const void *p) // dst[MAX:64] := 0 // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadu_si64 -FORCE_INLINE __m128i _mm_loadu_si64(const void *p) +FORCE_INLINE __m128i _mm_loadu_si64(const void* p) { - return vreinterpretq_m128i_s64( - vcombine_s64(vld1_s64((const int64_t *) p), vdup_n_s64(0))); + return vreinterpretq_m128i_s64( + vcombine_s64(vld1_s64((const int64_t*)p), vdup_n_s64(0))); } // Allocate aligned blocks of memory. // https://software.intel.com/en-us/ // cpp-compiler-developer-guide-and-reference-allocating-and-freeing-aligned-memory-blocks -FORCE_INLINE void *_mm_malloc(size_t size, size_t align) +FORCE_INLINE void* _mm_malloc(size_t size, size_t align) { - void *ptr; - if (align == 1) - return malloc(size); - if (align == 2 || (sizeof(void *) == 8 && align == 4)) - align = sizeof(void *); - if (!posix_memalign(&ptr, align, size)) - return ptr; - return NULL; + void* ptr; + if (align == 1) + return malloc(size); + if (align == 2 || (sizeof(void*) == 8 && align == 4)) + align = sizeof(void*); + if (!posix_memalign(&ptr, align, size)) + return ptr; + return NULL; } // Conditionally store 8-bit integer elements from a into memory using mask // (elements are not stored when the highest bit is not set in the corresponding // element) and a non-temporal memory hint. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_maskmove_si64 -FORCE_INLINE void _mm_maskmove_si64(__m64 a, __m64 mask, char *mem_addr) +FORCE_INLINE void _mm_maskmove_si64(__m64 a, __m64 mask, char* mem_addr) { - int8x8_t shr_mask = vshr_n_s8(vreinterpret_s8_m64(mask), 7); - __m128 b = _mm_load_ps((const float *) mem_addr); - int8x8_t masked = - vbsl_s8(vreinterpret_u8_s8(shr_mask), vreinterpret_s8_m64(a), - vreinterpret_s8_u64(vget_low_u64(vreinterpretq_u64_m128(b)))); - vst1_s8((int8_t *) mem_addr, masked); + int8x8_t shr_mask = vshr_n_s8(vreinterpret_s8_m64(mask), 7); + __m128 b = _mm_load_ps((const float*)mem_addr); + int8x8_t masked = + vbsl_s8(vreinterpret_u8_s8(shr_mask), vreinterpret_s8_m64(a), + vreinterpret_s8_u64(vget_low_u64(vreinterpretq_u64_m128(b)))); + vst1_s8((int8_t*)mem_addr, masked); } // Conditionally store 8-bit integer elements from a into memory using mask @@ -1997,8 +2005,8 @@ FORCE_INLINE void _mm_maskmove_si64(__m64 a, __m64 mask, char *mem_addr) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_pi16 FORCE_INLINE __m64 _mm_max_pi16(__m64 a, __m64 b) { - return vreinterpret_m64_s16( - vmax_s16(vreinterpret_s16_m64(a), vreinterpret_s16_m64(b))); + return vreinterpret_m64_s16( + vmax_s16(vreinterpret_s16_m64(a), vreinterpret_s16_m64(b))); } // Computes the maximums of the four single-precision, floating-point values of @@ -2007,12 +2015,12 @@ FORCE_INLINE __m64 _mm_max_pi16(__m64 a, __m64 b) FORCE_INLINE __m128 _mm_max_ps(__m128 a, __m128 b) { #if SSE2NEON_PRECISE_MINMAX - float32x4_t _a = vreinterpretq_f32_m128(a); - float32x4_t _b = vreinterpretq_f32_m128(b); - return vreinterpretq_m128_f32(vbslq_f32(vcgtq_f32(_a, _b), _a, _b)); + float32x4_t _a = vreinterpretq_f32_m128(a); + float32x4_t _b = vreinterpretq_f32_m128(b); + return vreinterpretq_m128_f32(vbslq_f32(vcgtq_f32(_a, _b), _a, _b)); #else - return vreinterpretq_m128_f32( - vmaxq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_f32( + vmaxq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); #endif } @@ -2027,8 +2035,8 @@ FORCE_INLINE __m128 _mm_max_ps(__m128 a, __m128 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_pu8 FORCE_INLINE __m64 _mm_max_pu8(__m64 a, __m64 b) { - return vreinterpret_m64_u8( - vmax_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b))); + return vreinterpret_m64_u8( + vmax_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b))); } // Computes the maximum of the two lower scalar single-precision floating point @@ -2036,9 +2044,9 @@ FORCE_INLINE __m64 _mm_max_pu8(__m64 a, __m64 b) // https://msdn.microsoft.com/en-us/library/s6db5esz(v=vs.100).aspx FORCE_INLINE __m128 _mm_max_ss(__m128 a, __m128 b) { - float32_t value = vgetq_lane_f32(_mm_max_ps(a, b), 0); - return vreinterpretq_m128_f32( - vsetq_lane_f32(value, vreinterpretq_f32_m128(a), 0)); + float32_t value = vgetq_lane_f32(_mm_max_ps(a, b), 0); + return vreinterpretq_m128_f32( + vsetq_lane_f32(value, vreinterpretq_f32_m128(a), 0)); } // Compare packed signed 16-bit integers in a and b, and store packed minimum @@ -2052,8 +2060,8 @@ FORCE_INLINE __m128 _mm_max_ss(__m128 a, __m128 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_pi16 FORCE_INLINE __m64 _mm_min_pi16(__m64 a, __m64 b) { - return vreinterpret_m64_s16( - vmin_s16(vreinterpret_s16_m64(a), vreinterpret_s16_m64(b))); + return vreinterpret_m64_s16( + vmin_s16(vreinterpret_s16_m64(a), vreinterpret_s16_m64(b))); } // Computes the minima of the four single-precision, floating-point values of a @@ -2062,12 +2070,12 @@ FORCE_INLINE __m64 _mm_min_pi16(__m64 a, __m64 b) FORCE_INLINE __m128 _mm_min_ps(__m128 a, __m128 b) { #if SSE2NEON_PRECISE_MINMAX - float32x4_t _a = vreinterpretq_f32_m128(a); - float32x4_t _b = vreinterpretq_f32_m128(b); - return vreinterpretq_m128_f32(vbslq_f32(vcltq_f32(_a, _b), _a, _b)); + float32x4_t _a = vreinterpretq_f32_m128(a); + float32x4_t _b = vreinterpretq_f32_m128(b); + return vreinterpretq_m128_f32(vbslq_f32(vcltq_f32(_a, _b), _a, _b)); #else - return vreinterpretq_m128_f32( - vminq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_f32( + vminq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); #endif } @@ -2082,8 +2090,8 @@ FORCE_INLINE __m128 _mm_min_ps(__m128 a, __m128 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_pu8 FORCE_INLINE __m64 _mm_min_pu8(__m64 a, __m64 b) { - return vreinterpret_m64_u8( - vmin_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b))); + return vreinterpret_m64_u8( + vmin_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b))); } // Computes the minimum of the two lower scalar single-precision floating point @@ -2091,18 +2099,18 @@ FORCE_INLINE __m64 _mm_min_pu8(__m64 a, __m64 b) // https://msdn.microsoft.com/en-us/library/0a9y7xaa(v=vs.100).aspx FORCE_INLINE __m128 _mm_min_ss(__m128 a, __m128 b) { - float32_t value = vgetq_lane_f32(_mm_min_ps(a, b), 0); - return vreinterpretq_m128_f32( - vsetq_lane_f32(value, vreinterpretq_f32_m128(a), 0)); + float32_t value = vgetq_lane_f32(_mm_min_ps(a, b), 0); + return vreinterpretq_m128_f32( + vsetq_lane_f32(value, vreinterpretq_f32_m128(a), 0)); } // Sets the low word to the single-precision, floating-point value of b // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/35hdzazd(v=vs.100) FORCE_INLINE __m128 _mm_move_ss(__m128 a, __m128 b) { - return vreinterpretq_m128_f32( - vsetq_lane_f32(vgetq_lane_f32(vreinterpretq_f32_m128(b), 0), - vreinterpretq_f32_m128(a), 0)); + return vreinterpretq_m128_f32( + vsetq_lane_f32(vgetq_lane_f32(vreinterpretq_f32_m128(b), 0), + vreinterpretq_f32_m128(a), 0)); } // Moves the upper two values of B into the lower two values of A. @@ -2113,9 +2121,9 @@ FORCE_INLINE __m128 _mm_move_ss(__m128 a, __m128 b) // r0 := b2 FORCE_INLINE __m128 _mm_movehl_ps(__m128 __A, __m128 __B) { - float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(__A)); - float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(__B)); - return vreinterpretq_m128_f32(vcombine_f32(b32, a32)); + float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(__A)); + float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(__B)); + return vreinterpretq_m128_f32(vcombine_f32(b32, a32)); } // Moves the lower two values of B into the upper two values of A. @@ -2126,9 +2134,9 @@ FORCE_INLINE __m128 _mm_movehl_ps(__m128 __A, __m128 __B) // r0 := a0 FORCE_INLINE __m128 _mm_movelh_ps(__m128 __A, __m128 __B) { - float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(__A)); - float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(__B)); - return vreinterpretq_m128_f32(vcombine_f32(a10, b10)); + float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(__A)); + float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(__B)); + return vreinterpretq_m128_f32(vcombine_f32(a10, b10)); } // Create mask from the most significant bit of each 8-bit element in a, and @@ -2136,19 +2144,19 @@ FORCE_INLINE __m128 _mm_movelh_ps(__m128 __A, __m128 __B) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_movemask_pi8 FORCE_INLINE int _mm_movemask_pi8(__m64 a) { - uint8x8_t input = vreinterpret_u8_m64(a); + uint8x8_t input = vreinterpret_u8_m64(a); #if defined(__aarch64__) - static const int8x8_t shift = {0, 1, 2, 3, 4, 5, 6, 7}; - uint8x8_t tmp = vshr_n_u8(input, 7); - return vaddv_u8(vshl_u8(tmp, shift)); + static const int8x8_t shift = {0, 1, 2, 3, 4, 5, 6, 7}; + uint8x8_t tmp = vshr_n_u8(input, 7); + return vaddv_u8(vshl_u8(tmp, shift)); #else - // Refer the implementation of `_mm_movemask_epi8` - uint16x4_t high_bits = vreinterpret_u16_u8(vshr_n_u8(input, 7)); - uint32x2_t paired16 = - vreinterpret_u32_u16(vsra_n_u16(high_bits, high_bits, 7)); - uint8x8_t paired32 = - vreinterpret_u8_u32(vsra_n_u32(paired16, paired16, 14)); - return vget_lane_u8(paired32, 0) | ((int) vget_lane_u8(paired32, 4) << 4); + // Refer the implementation of `_mm_movemask_epi8` + uint16x4_t high_bits = vreinterpret_u16_u8(vshr_n_u8(input, 7)); + uint32x2_t paired16 = + vreinterpret_u32_u16(vsra_n_u16(high_bits, high_bits, 7)); + uint8x8_t paired32 = + vreinterpret_u8_u32(vsra_n_u32(paired16, paired16, 14)); + return vget_lane_u8(paired32, 0) | ((int)vget_lane_u8(paired32, 4) << 4); #endif } @@ -2158,21 +2166,21 @@ FORCE_INLINE int _mm_movemask_pi8(__m64 a) // https://msdn.microsoft.com/en-us/library/vstudio/4490ys29(v=vs.100).aspx FORCE_INLINE int _mm_movemask_ps(__m128 a) { - uint32x4_t input = vreinterpretq_u32_m128(a); + uint32x4_t input = vreinterpretq_u32_m128(a); #if defined(__aarch64__) - static const int32x4_t shift = {0, 1, 2, 3}; - uint32x4_t tmp = vshrq_n_u32(input, 31); - return vaddvq_u32(vshlq_u32(tmp, shift)); + static const int32x4_t shift = {0, 1, 2, 3}; + uint32x4_t tmp = vshrq_n_u32(input, 31); + return vaddvq_u32(vshlq_u32(tmp, shift)); #else - // Uses the exact same method as _mm_movemask_epi8, see that for details. - // Shift out everything but the sign bits with a 32-bit unsigned shift - // right. - uint64x2_t high_bits = vreinterpretq_u64_u32(vshrq_n_u32(input, 31)); - // Merge the two pairs together with a 64-bit unsigned shift right + add. - uint8x16_t paired = - vreinterpretq_u8_u64(vsraq_n_u64(high_bits, high_bits, 31)); - // Extract the result. - return vgetq_lane_u8(paired, 0) | (vgetq_lane_u8(paired, 8) << 2); + // Uses the exact same method as _mm_movemask_epi8, see that for details. + // Shift out everything but the sign bits with a 32-bit unsigned shift + // right. + uint64x2_t high_bits = vreinterpretq_u64_u32(vshrq_n_u32(input, 31)); + // Merge the two pairs together with a 64-bit unsigned shift right + add. + uint8x16_t paired = + vreinterpretq_u8_u64(vsraq_n_u64(high_bits, high_bits, 31)); + // Extract the result. + return vgetq_lane_u8(paired, 0) | (vgetq_lane_u8(paired, 8) << 2); #endif } @@ -2186,8 +2194,8 @@ FORCE_INLINE int _mm_movemask_ps(__m128 a) // https://msdn.microsoft.com/en-us/library/vstudio/22kbk6t9(v=vs.100).aspx FORCE_INLINE __m128 _mm_mul_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_f32( - vmulq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_f32( + vmulq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); } // Multiply the lower single-precision (32-bit) floating-point element in a and @@ -2200,7 +2208,7 @@ FORCE_INLINE __m128 _mm_mul_ps(__m128 a, __m128 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mul_ss FORCE_INLINE __m128 _mm_mul_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_mul_ps(a, b)); + return _mm_move_ss(a, _mm_mul_ps(a, b)); } // Multiply the packed unsigned 16-bit integers in a and b, producing @@ -2209,8 +2217,8 @@ FORCE_INLINE __m128 _mm_mul_ss(__m128 a, __m128 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mulhi_pu16 FORCE_INLINE __m64 _mm_mulhi_pu16(__m64 a, __m64 b) { - return vreinterpret_m64_u16(vshrn_n_u32( - vmull_u16(vreinterpret_u16_m64(a), vreinterpret_u16_m64(b)), 16)); + return vreinterpret_m64_u16(vshrn_n_u32( + vmull_u16(vreinterpret_u16_m64(a), vreinterpret_u16_m64(b)), 16)); } // Computes the bitwise OR of the four single-precision, floating-point values @@ -2218,8 +2226,8 @@ FORCE_INLINE __m64 _mm_mulhi_pu16(__m64 a, __m64 b) // https://msdn.microsoft.com/en-us/library/vstudio/7ctdsyy0(v=vs.100).aspx FORCE_INLINE __m128 _mm_or_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_s32( - vorrq_s32(vreinterpretq_s32_m128(a), vreinterpretq_s32_m128(b))); + return vreinterpretq_m128_s32( + vorrq_s32(vreinterpretq_s32_m128(a), vreinterpretq_s32_m128(b))); } // Average packed unsigned 8-bit integers in a and b, and store the results in @@ -2287,10 +2295,10 @@ FORCE_INLINE __m128 _mm_or_ps(__m128 a, __m128 b) // Loads one cache line of data from address p to a location closer to the // processor. https://msdn.microsoft.com/en-us/library/84szxsww(v=vs.100).aspx -FORCE_INLINE void _mm_prefetch(const void *p, int i) +FORCE_INLINE void _mm_prefetch(const void* p, int i) { - (void) i; - __builtin_prefetch(p); + (void)i; + __builtin_prefetch(p); } // Compute the absolute differences of packed unsigned 8-bit integers in a and @@ -2311,13 +2319,13 @@ FORCE_INLINE void _mm_prefetch(const void *p, int i) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_rcp_ps FORCE_INLINE __m128 _mm_rcp_ps(__m128 in) { - float32x4_t recip = vrecpeq_f32(vreinterpretq_f32_m128(in)); - recip = vmulq_f32(recip, vrecpsq_f32(recip, vreinterpretq_f32_m128(in))); + float32x4_t recip = vrecpeq_f32(vreinterpretq_f32_m128(in)); + recip = vmulq_f32(recip, vrecpsq_f32(recip, vreinterpretq_f32_m128(in))); #if SSE2NEON_PRECISE_DIV - // Additional Netwon-Raphson iteration for accuracy - recip = vmulq_f32(recip, vrecpsq_f32(recip, vreinterpretq_f32_m128(in))); + // Additional Netwon-Raphson iteration for accuracy + recip = vmulq_f32(recip, vrecpsq_f32(recip, vreinterpretq_f32_m128(in))); #endif - return vreinterpretq_m128_f32(recip); + return vreinterpretq_m128_f32(recip); } // Compute the approximate reciprocal of the lower single-precision (32-bit) @@ -2331,7 +2339,7 @@ FORCE_INLINE __m128 _mm_rcp_ps(__m128 in) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_rcp_ss FORCE_INLINE __m128 _mm_rcp_ss(__m128 a) { - return _mm_move_ss(a, _mm_rcp_ps(a)); + return _mm_move_ss(a, _mm_rcp_ps(a)); } // Computes the approximations of the reciprocal square roots of the four @@ -2340,15 +2348,15 @@ FORCE_INLINE __m128 _mm_rcp_ss(__m128 a) // https://msdn.microsoft.com/en-us/library/22hfsh53(v=vs.100).aspx FORCE_INLINE __m128 _mm_rsqrt_ps(__m128 in) { - float32x4_t out = vrsqrteq_f32(vreinterpretq_f32_m128(in)); + float32x4_t out = vrsqrteq_f32(vreinterpretq_f32_m128(in)); #if SSE2NEON_PRECISE_SQRT - // Additional Netwon-Raphson iteration for accuracy - out = vmulq_f32( - out, vrsqrtsq_f32(vmulq_f32(vreinterpretq_f32_m128(in), out), out)); - out = vmulq_f32( - out, vrsqrtsq_f32(vmulq_f32(vreinterpretq_f32_m128(in), out), out)); + // Additional Netwon-Raphson iteration for accuracy + out = vmulq_f32( + out, vrsqrtsq_f32(vmulq_f32(vreinterpretq_f32_m128(in), out), out)); + out = vmulq_f32( + out, vrsqrtsq_f32(vmulq_f32(vreinterpretq_f32_m128(in), out), out)); #endif - return vreinterpretq_m128_f32(out); + return vreinterpretq_m128_f32(out); } // Compute the approximate reciprocal square root of the lower single-precision @@ -2358,7 +2366,7 @@ FORCE_INLINE __m128 _mm_rsqrt_ps(__m128 in) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_rsqrt_ss FORCE_INLINE __m128 _mm_rsqrt_ss(__m128 in) { - return vsetq_lane_f32(vgetq_lane_f32(_mm_rsqrt_ps(in), 0), in, 0); + return vsetq_lane_f32(vgetq_lane_f32(_mm_rsqrt_ps(in), 0), in, 0); } // Compute the absolute differences of packed unsigned 8-bit integers in a and @@ -2368,10 +2376,10 @@ FORCE_INLINE __m128 _mm_rsqrt_ss(__m128 in) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sad_pu8 FORCE_INLINE __m64 _mm_sad_pu8(__m64 a, __m64 b) { - uint64x1_t t = vpaddl_u32(vpaddl_u16( - vpaddl_u8(vabd_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b))))); - return vreinterpret_m64_u16( - vset_lane_u16(vget_lane_u64(t, 0), vdup_n_u16(0), 0)); + uint64x1_t t = vpaddl_u32(vpaddl_u16( + vpaddl_u8(vabd_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b))))); + return vreinterpret_m64_u16( + vset_lane_u16(vget_lane_u64(t, 0), vdup_n_u16(0), 0)); } // Macro: Set the flush zero bits of the MXCSR control and status register to @@ -2380,29 +2388,30 @@ FORCE_INLINE __m64 _mm_sad_pu8(__m64 a, __m64 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_MM_SET_FLUSH_ZERO_MODE FORCE_INLINE void _sse2neon_mm_set_flush_zero_mode(unsigned int flag) { - // AArch32 Advanced SIMD arithmetic always uses the Flush-to-zero setting, - // regardless of the value of the FZ bit. - union { - fpcr_bitfield field; + // AArch32 Advanced SIMD arithmetic always uses the Flush-to-zero setting, + // regardless of the value of the FZ bit. + union + { + fpcr_bitfield field; #if defined(__aarch64__) - uint64_t value; + uint64_t value; #else - uint32_t value; + uint32_t value; #endif - } r; + } r; #if defined(__aarch64__) - asm volatile("mrs %0, FPCR" : "=r"(r.value)); /* read */ + asm volatile("mrs %0, FPCR" : "=r"(r.value)); /* read */ #else - asm volatile("vmrs %0, FPSCR" : "=r"(r.value)); /* read */ + asm volatile("vmrs %0, FPSCR" : "=r"(r.value)); /* read */ #endif - r.field.bit24 = (flag & _MM_FLUSH_ZERO_MASK) == _MM_FLUSH_ZERO_ON; + r.field.bit24 = (flag & _MM_FLUSH_ZERO_MASK) == _MM_FLUSH_ZERO_ON; #if defined(__aarch64__) - asm volatile("msr FPCR, %0" ::"r"(r)); /* write */ + asm volatile("msr FPCR, %0" ::"r"(r)); /* write */ #else - asm volatile("vmsr FPSCR, %0" ::"r"(r)); /* write */ + asm volatile("vmsr FPSCR, %0" ::"r"(r)); /* write */ #endif } @@ -2410,15 +2419,15 @@ FORCE_INLINE void _sse2neon_mm_set_flush_zero_mode(unsigned int flag) // https://msdn.microsoft.com/en-us/library/vstudio/afh0zf75(v=vs.100).aspx FORCE_INLINE __m128 _mm_set_ps(float w, float z, float y, float x) { - float ALIGN_STRUCT(16) data[4] = {x, y, z, w}; - return vreinterpretq_m128_f32(vld1q_f32(data)); + float ALIGN_STRUCT(16) data[4] = {x, y, z, w}; + return vreinterpretq_m128_f32(vld1q_f32(data)); } // Sets the four single-precision, floating-point values to w. // https://msdn.microsoft.com/en-us/library/vstudio/2x1se8ha(v=vs.100).aspx FORCE_INLINE __m128 _mm_set_ps1(float _w) { - return vreinterpretq_m128_f32(vdupq_n_f32(_w)); + return vreinterpretq_m128_f32(vdupq_n_f32(_w)); } // Macro: Set the rounding mode bits of the MXCSR control and status register to @@ -2428,43 +2437,45 @@ FORCE_INLINE __m128 _mm_set_ps1(float _w) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_MM_SET_ROUNDING_MODE FORCE_INLINE void _MM_SET_ROUNDING_MODE(int rounding) { - union { - fpcr_bitfield field; + union + { + fpcr_bitfield field; #if defined(__aarch64__) - uint64_t value; + uint64_t value; #else - uint32_t value; + uint32_t value; #endif - } r; + } r; #if defined(__aarch64__) - asm volatile("mrs %0, FPCR" : "=r"(r.value)); /* read */ + asm volatile("mrs %0, FPCR" : "=r"(r.value)); /* read */ #else - asm volatile("vmrs %0, FPSCR" : "=r"(r.value)); /* read */ + asm volatile("vmrs %0, FPSCR" : "=r"(r.value)); /* read */ #endif - switch (rounding) { - case _MM_ROUND_TOWARD_ZERO: - r.field.bit22 = 1; - r.field.bit23 = 1; - break; - case _MM_ROUND_DOWN: - r.field.bit22 = 0; - r.field.bit23 = 1; - break; - case _MM_ROUND_UP: - r.field.bit22 = 1; - r.field.bit23 = 0; - break; - default: //_MM_ROUND_NEAREST - r.field.bit22 = 0; - r.field.bit23 = 0; - } + switch (rounding) + { + case _MM_ROUND_TOWARD_ZERO: + r.field.bit22 = 1; + r.field.bit23 = 1; + break; + case _MM_ROUND_DOWN: + r.field.bit22 = 0; + r.field.bit23 = 1; + break; + case _MM_ROUND_UP: + r.field.bit22 = 1; + r.field.bit23 = 0; + break; + default: //_MM_ROUND_NEAREST + r.field.bit22 = 0; + r.field.bit23 = 0; + } #if defined(__aarch64__) - asm volatile("msr FPCR, %0" ::"r"(r)); /* write */ + asm volatile("msr FPCR, %0" ::"r"(r)); /* write */ #else - asm volatile("vmsr FPSCR, %0" ::"r"(r)); /* write */ + asm volatile("vmsr FPSCR, %0" ::"r"(r)); /* write */ #endif } @@ -2473,8 +2484,8 @@ FORCE_INLINE void _MM_SET_ROUNDING_MODE(int rounding) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_ss FORCE_INLINE __m128 _mm_set_ss(float a) { - float ALIGN_STRUCT(16) data[4] = {a, 0, 0, 0}; - return vreinterpretq_m128_f32(vld1q_f32(data)); + float ALIGN_STRUCT(16) data[4] = {a, 0, 0, 0}; + return vreinterpretq_m128_f32(vld1q_f32(data)); } // Sets the four single-precision, floating-point values to w. @@ -2484,19 +2495,19 @@ FORCE_INLINE __m128 _mm_set_ss(float a) // https://msdn.microsoft.com/en-us/library/vstudio/2x1se8ha(v=vs.100).aspx FORCE_INLINE __m128 _mm_set1_ps(float _w) { - return vreinterpretq_m128_f32(vdupq_n_f32(_w)); + return vreinterpretq_m128_f32(vdupq_n_f32(_w)); } // FIXME: _mm_setcsr() implementation supports changing the rounding mode only. FORCE_INLINE void _mm_setcsr(unsigned int a) { - _MM_SET_ROUNDING_MODE(a); + _MM_SET_ROUNDING_MODE(a); } // FIXME: _mm_getcsr() implementation supports reading the rounding mode only. FORCE_INLINE unsigned int _mm_getcsr() { - return _MM_GET_ROUNDING_MODE(); + return _MM_GET_ROUNDING_MODE(); } // Sets the four single-precision, floating-point values to the four inputs in @@ -2504,15 +2515,15 @@ FORCE_INLINE unsigned int _mm_getcsr() // https://msdn.microsoft.com/en-us/library/vstudio/d2172ct3(v=vs.100).aspx FORCE_INLINE __m128 _mm_setr_ps(float w, float z, float y, float x) { - float ALIGN_STRUCT(16) data[4] = {w, z, y, x}; - return vreinterpretq_m128_f32(vld1q_f32(data)); + float ALIGN_STRUCT(16) data[4] = {w, z, y, x}; + return vreinterpretq_m128_f32(vld1q_f32(data)); } // Clears the four single-precision, floating-point values. // https://msdn.microsoft.com/en-us/library/vstudio/tk1t2tbz(v=vs.100).aspx FORCE_INLINE __m128 _mm_setzero_ps(void) { - return vreinterpretq_m128_f32(vdupq_n_f32(0)); + return vreinterpretq_m128_f32(vdupq_n_f32(0)); } // Shuffle 16-bit integers in a using the control in imm8, and store the results @@ -2520,28 +2531,28 @@ FORCE_INLINE __m128 _mm_setzero_ps(void) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_pi16 #if __has_builtin(__builtin_shufflevector) #define _mm_shuffle_pi16(a, imm) \ - __extension__({ \ - vreinterpret_m64_s16(__builtin_shufflevector( \ - vreinterpret_s16_m64(a), vreinterpret_s16_m64(a), (imm & 0x3), \ - ((imm >> 2) & 0x3), ((imm >> 4) & 0x3), ((imm >> 6) & 0x3))); \ - }) + __extension__({ \ + vreinterpret_m64_s16(__builtin_shufflevector( \ + vreinterpret_s16_m64(a), vreinterpret_s16_m64(a), (imm & 0x3), \ + ((imm >> 2) & 0x3), ((imm >> 4) & 0x3), ((imm >> 6) & 0x3))); \ + }) #else #define _mm_shuffle_pi16(a, imm) \ - __extension__({ \ - int16x4_t ret; \ - ret = \ - vmov_n_s16(vget_lane_s16(vreinterpret_s16_m64(a), (imm) & (0x3))); \ - ret = vset_lane_s16( \ - vget_lane_s16(vreinterpret_s16_m64(a), ((imm) >> 2) & 0x3), ret, \ - 1); \ - ret = vset_lane_s16( \ - vget_lane_s16(vreinterpret_s16_m64(a), ((imm) >> 4) & 0x3), ret, \ - 2); \ - ret = vset_lane_s16( \ - vget_lane_s16(vreinterpret_s16_m64(a), ((imm) >> 6) & 0x3), ret, \ - 3); \ - vreinterpret_m64_s16(ret); \ - }) + __extension__({ \ + int16x4_t ret; \ + ret = \ + vmov_n_s16(vget_lane_s16(vreinterpret_s16_m64(a), (imm) & (0x3))); \ + ret = vset_lane_s16( \ + vget_lane_s16(vreinterpret_s16_m64(a), ((imm) >> 2) & 0x3), ret, \ + 1); \ + ret = vset_lane_s16( \ + vget_lane_s16(vreinterpret_s16_m64(a), ((imm) >> 4) & 0x3), ret, \ + 2); \ + ret = vset_lane_s16( \ + vget_lane_s16(vreinterpret_s16_m64(a), ((imm) >> 6) & 0x3), ret, \ + 3); \ + vreinterpret_m64_s16(ret); \ + }) #endif // Guarantees that every preceding store is globally visible before any @@ -2549,83 +2560,84 @@ FORCE_INLINE __m128 _mm_setzero_ps(void) // https://msdn.microsoft.com/en-us/library/5h2w73d1%28v=vs.90%29.aspx FORCE_INLINE void _mm_sfence(void) { - __sync_synchronize(); + __sync_synchronize(); } // FORCE_INLINE __m128 _mm_shuffle_ps(__m128 a, __m128 b, __constrange(0,255) // int imm) #if __has_builtin(__builtin_shufflevector) #define _mm_shuffle_ps(a, b, imm) \ - __extension__({ \ - float32x4_t _input1 = vreinterpretq_f32_m128(a); \ - float32x4_t _input2 = vreinterpretq_f32_m128(b); \ - float32x4_t _shuf = __builtin_shufflevector( \ - _input1, _input2, (imm) & (0x3), ((imm) >> 2) & 0x3, \ - (((imm) >> 4) & 0x3) + 4, (((imm) >> 6) & 0x3) + 4); \ - vreinterpretq_m128_f32(_shuf); \ - }) -#else // generic + __extension__({ \ + float32x4_t _input1 = vreinterpretq_f32_m128(a); \ + float32x4_t _input2 = vreinterpretq_f32_m128(b); \ + float32x4_t _shuf = __builtin_shufflevector( \ + _input1, _input2, (imm) & (0x3), ((imm) >> 2) & 0x3, \ + (((imm) >> 4) & 0x3) + 4, (((imm) >> 6) & 0x3) + 4); \ + vreinterpretq_m128_f32(_shuf); \ + }) +#else // generic #define _mm_shuffle_ps(a, b, imm) \ - __extension__({ \ - __m128 ret; \ - switch (imm) { \ - case _MM_SHUFFLE(1, 0, 3, 2): \ - ret = _mm_shuffle_ps_1032((a), (b)); \ - break; \ - case _MM_SHUFFLE(2, 3, 0, 1): \ - ret = _mm_shuffle_ps_2301((a), (b)); \ - break; \ - case _MM_SHUFFLE(0, 3, 2, 1): \ - ret = _mm_shuffle_ps_0321((a), (b)); \ - break; \ - case _MM_SHUFFLE(2, 1, 0, 3): \ - ret = _mm_shuffle_ps_2103((a), (b)); \ - break; \ - case _MM_SHUFFLE(1, 0, 1, 0): \ - ret = _mm_movelh_ps((a), (b)); \ - break; \ - case _MM_SHUFFLE(1, 0, 0, 1): \ - ret = _mm_shuffle_ps_1001((a), (b)); \ - break; \ - case _MM_SHUFFLE(0, 1, 0, 1): \ - ret = _mm_shuffle_ps_0101((a), (b)); \ - break; \ - case _MM_SHUFFLE(3, 2, 1, 0): \ - ret = _mm_shuffle_ps_3210((a), (b)); \ - break; \ - case _MM_SHUFFLE(0, 0, 1, 1): \ - ret = _mm_shuffle_ps_0011((a), (b)); \ - break; \ - case _MM_SHUFFLE(0, 0, 2, 2): \ - ret = _mm_shuffle_ps_0022((a), (b)); \ - break; \ - case _MM_SHUFFLE(2, 2, 0, 0): \ - ret = _mm_shuffle_ps_2200((a), (b)); \ - break; \ - case _MM_SHUFFLE(3, 2, 0, 2): \ - ret = _mm_shuffle_ps_3202((a), (b)); \ - break; \ - case _MM_SHUFFLE(3, 2, 3, 2): \ - ret = _mm_movehl_ps((b), (a)); \ - break; \ - case _MM_SHUFFLE(1, 1, 3, 3): \ - ret = _mm_shuffle_ps_1133((a), (b)); \ - break; \ - case _MM_SHUFFLE(2, 0, 1, 0): \ - ret = _mm_shuffle_ps_2010((a), (b)); \ - break; \ - case _MM_SHUFFLE(2, 0, 0, 1): \ - ret = _mm_shuffle_ps_2001((a), (b)); \ - break; \ - case _MM_SHUFFLE(2, 0, 3, 2): \ - ret = _mm_shuffle_ps_2032((a), (b)); \ - break; \ - default: \ - ret = _mm_shuffle_ps_default((a), (b), (imm)); \ - break; \ - } \ - ret; \ - }) + __extension__({ \ + __m128 ret; \ + switch (imm) \ + { \ + case _MM_SHUFFLE(1, 0, 3, 2): \ + ret = _mm_shuffle_ps_1032((a), (b)); \ + break; \ + case _MM_SHUFFLE(2, 3, 0, 1): \ + ret = _mm_shuffle_ps_2301((a), (b)); \ + break; \ + case _MM_SHUFFLE(0, 3, 2, 1): \ + ret = _mm_shuffle_ps_0321((a), (b)); \ + break; \ + case _MM_SHUFFLE(2, 1, 0, 3): \ + ret = _mm_shuffle_ps_2103((a), (b)); \ + break; \ + case _MM_SHUFFLE(1, 0, 1, 0): \ + ret = _mm_movelh_ps((a), (b)); \ + break; \ + case _MM_SHUFFLE(1, 0, 0, 1): \ + ret = _mm_shuffle_ps_1001((a), (b)); \ + break; \ + case _MM_SHUFFLE(0, 1, 0, 1): \ + ret = _mm_shuffle_ps_0101((a), (b)); \ + break; \ + case _MM_SHUFFLE(3, 2, 1, 0): \ + ret = _mm_shuffle_ps_3210((a), (b)); \ + break; \ + case _MM_SHUFFLE(0, 0, 1, 1): \ + ret = _mm_shuffle_ps_0011((a), (b)); \ + break; \ + case _MM_SHUFFLE(0, 0, 2, 2): \ + ret = _mm_shuffle_ps_0022((a), (b)); \ + break; \ + case _MM_SHUFFLE(2, 2, 0, 0): \ + ret = _mm_shuffle_ps_2200((a), (b)); \ + break; \ + case _MM_SHUFFLE(3, 2, 0, 2): \ + ret = _mm_shuffle_ps_3202((a), (b)); \ + break; \ + case _MM_SHUFFLE(3, 2, 3, 2): \ + ret = _mm_movehl_ps((b), (a)); \ + break; \ + case _MM_SHUFFLE(1, 1, 3, 3): \ + ret = _mm_shuffle_ps_1133((a), (b)); \ + break; \ + case _MM_SHUFFLE(2, 0, 1, 0): \ + ret = _mm_shuffle_ps_2010((a), (b)); \ + break; \ + case _MM_SHUFFLE(2, 0, 0, 1): \ + ret = _mm_shuffle_ps_2001((a), (b)); \ + break; \ + case _MM_SHUFFLE(2, 0, 3, 2): \ + ret = _mm_shuffle_ps_2032((a), (b)); \ + break; \ + default: \ + ret = _mm_shuffle_ps_default((a), (b), (imm)); \ + break; \ + } \ + ret; \ + }) #endif // Computes the approximations of square roots of the four single-precision, @@ -2641,32 +2653,32 @@ FORCE_INLINE void _mm_sfence(void) FORCE_INLINE __m128 _mm_sqrt_ps(__m128 in) { #if SSE2NEON_PRECISE_SQRT - float32x4_t recip = vrsqrteq_f32(vreinterpretq_f32_m128(in)); + float32x4_t recip = vrsqrteq_f32(vreinterpretq_f32_m128(in)); - // Test for vrsqrteq_f32(0) -> positive infinity case. - // Change to zero, so that s * 1/sqrt(s) result is zero too. - const uint32x4_t pos_inf = vdupq_n_u32(0x7F800000); - const uint32x4_t div_by_zero = - vceqq_u32(pos_inf, vreinterpretq_u32_f32(recip)); - recip = vreinterpretq_f32_u32( - vandq_u32(vmvnq_u32(div_by_zero), vreinterpretq_u32_f32(recip))); + // Test for vrsqrteq_f32(0) -> positive infinity case. + // Change to zero, so that s * 1/sqrt(s) result is zero too. + const uint32x4_t pos_inf = vdupq_n_u32(0x7F800000); + const uint32x4_t div_by_zero = + vceqq_u32(pos_inf, vreinterpretq_u32_f32(recip)); + recip = vreinterpretq_f32_u32( + vandq_u32(vmvnq_u32(div_by_zero), vreinterpretq_u32_f32(recip))); - // Additional Netwon-Raphson iteration for accuracy - recip = vmulq_f32( - vrsqrtsq_f32(vmulq_f32(recip, recip), vreinterpretq_f32_m128(in)), - recip); - recip = vmulq_f32( - vrsqrtsq_f32(vmulq_f32(recip, recip), vreinterpretq_f32_m128(in)), - recip); + // Additional Netwon-Raphson iteration for accuracy + recip = vmulq_f32( + vrsqrtsq_f32(vmulq_f32(recip, recip), vreinterpretq_f32_m128(in)), + recip); + recip = vmulq_f32( + vrsqrtsq_f32(vmulq_f32(recip, recip), vreinterpretq_f32_m128(in)), + recip); - // sqrt(s) = s * 1/sqrt(s) - return vreinterpretq_m128_f32(vmulq_f32(vreinterpretq_f32_m128(in), recip)); + // sqrt(s) = s * 1/sqrt(s) + return vreinterpretq_m128_f32(vmulq_f32(vreinterpretq_f32_m128(in), recip)); #elif defined(__aarch64__) - return vreinterpretq_m128_f32(vsqrtq_f32(vreinterpretq_f32_m128(in))); + return vreinterpretq_m128_f32(vsqrtq_f32(vreinterpretq_f32_m128(in))); #else - float32x4_t recipsq = vrsqrteq_f32(vreinterpretq_f32_m128(in)); - float32x4_t sq = vrecpeq_f32(recipsq); - return vreinterpretq_m128_f32(sq); + float32x4_t recipsq = vrsqrteq_f32(vreinterpretq_f32_m128(in)); + float32x4_t sq = vrecpeq_f32(recipsq); + return vreinterpretq_m128_f32(sq); #endif } @@ -2675,17 +2687,17 @@ FORCE_INLINE __m128 _mm_sqrt_ps(__m128 in) // https://msdn.microsoft.com/en-us/library/ahfsc22d(v=vs.100).aspx FORCE_INLINE __m128 _mm_sqrt_ss(__m128 in) { - float32_t value = - vgetq_lane_f32(vreinterpretq_f32_m128(_mm_sqrt_ps(in)), 0); - return vreinterpretq_m128_f32( - vsetq_lane_f32(value, vreinterpretq_f32_m128(in), 0)); + float32_t value = + vgetq_lane_f32(vreinterpretq_f32_m128(_mm_sqrt_ps(in)), 0); + return vreinterpretq_m128_f32( + vsetq_lane_f32(value, vreinterpretq_f32_m128(in), 0)); } // Stores four single-precision, floating-point values. // https://msdn.microsoft.com/en-us/library/vstudio/s3h4ay6y(v=vs.100).aspx -FORCE_INLINE void _mm_store_ps(float *p, __m128 a) +FORCE_INLINE void _mm_store_ps(float* p, __m128 a) { - vst1q_f32(p, vreinterpretq_f32_m128(a)); + vst1q_f32(p, vreinterpretq_f32_m128(a)); } // Store the lower single-precision (32-bit) floating-point element from a into @@ -2698,17 +2710,17 @@ FORCE_INLINE void _mm_store_ps(float *p, __m128 a) // MEM[mem_addr+127:mem_addr+96] := a[31:0] // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_store_ps1 -FORCE_INLINE void _mm_store_ps1(float *p, __m128 a) +FORCE_INLINE void _mm_store_ps1(float* p, __m128 a) { - float32_t a0 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0); - vst1q_f32(p, vdupq_n_f32(a0)); + float32_t a0 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0); + vst1q_f32(p, vdupq_n_f32(a0)); } // Stores the lower single - precision, floating - point value. // https://msdn.microsoft.com/en-us/library/tzz10fbx(v=vs.100).aspx -FORCE_INLINE void _mm_store_ss(float *p, __m128 a) +FORCE_INLINE void _mm_store_ss(float* p, __m128 a) { - vst1q_lane_f32(p, vreinterpretq_f32_m128(a), 0); + vst1q_lane_f32(p, vreinterpretq_f32_m128(a), 0); } // Store the lower single-precision (32-bit) floating-point element from a into @@ -2730,9 +2742,9 @@ FORCE_INLINE void _mm_store_ss(float *p, __m128 a) // *p1 := a3 // // https://msdn.microsoft.com/en-us/library/a7525fs8(v%3dvs.90).aspx -FORCE_INLINE void _mm_storeh_pi(__m64 *p, __m128 a) +FORCE_INLINE void _mm_storeh_pi(__m64* p, __m128 a) { - *p = vreinterpret_m64_f32(vget_high_f32(a)); + *p = vreinterpret_m64_f32(vget_high_f32(a)); } // Stores the lower two single-precision floating point values of a to the @@ -2742,9 +2754,9 @@ FORCE_INLINE void _mm_storeh_pi(__m64 *p, __m128 a) // *p1 := a1 // // https://msdn.microsoft.com/en-us/library/h54t98ks(v=vs.90).aspx -FORCE_INLINE void _mm_storel_pi(__m64 *p, __m128 a) +FORCE_INLINE void _mm_storel_pi(__m64* p, __m128 a) { - *p = vreinterpret_m64_f32(vget_low_f32(a)); + *p = vreinterpret_m64_f32(vget_low_f32(a)); } // Store 4 single-precision (32-bit) floating-point elements from a into memory @@ -2757,51 +2769,51 @@ FORCE_INLINE void _mm_storel_pi(__m64 *p, __m128 a) // MEM[mem_addr+127:mem_addr+96] := a[31:0] // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_storer_ps -FORCE_INLINE void _mm_storer_ps(float *p, __m128 a) +FORCE_INLINE void _mm_storer_ps(float* p, __m128 a) { - float32x4_t tmp = vrev64q_f32(vreinterpretq_f32_m128(a)); - float32x4_t rev = vextq_f32(tmp, tmp, 2); - vst1q_f32(p, rev); + float32x4_t tmp = vrev64q_f32(vreinterpretq_f32_m128(a)); + float32x4_t rev = vextq_f32(tmp, tmp, 2); + vst1q_f32(p, rev); } // Stores four single-precision, floating-point values. // https://msdn.microsoft.com/en-us/library/44e30x22(v=vs.100).aspx -FORCE_INLINE void _mm_storeu_ps(float *p, __m128 a) +FORCE_INLINE void _mm_storeu_ps(float* p, __m128 a) { - vst1q_f32(p, vreinterpretq_f32_m128(a)); + vst1q_f32(p, vreinterpretq_f32_m128(a)); } // Stores 16-bits of integer data a at the address p. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_storeu_si16 -FORCE_INLINE void _mm_storeu_si16(void *p, __m128i a) +FORCE_INLINE void _mm_storeu_si16(void* p, __m128i a) { - vst1q_lane_s16((int16_t *) p, vreinterpretq_s16_m128i(a), 0); + vst1q_lane_s16((int16_t*)p, vreinterpretq_s16_m128i(a), 0); } // Stores 64-bits of integer data a at the address p. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_storeu_si64 -FORCE_INLINE void _mm_storeu_si64(void *p, __m128i a) +FORCE_INLINE void _mm_storeu_si64(void* p, __m128i a) { - vst1q_lane_s64((int64_t *) p, vreinterpretq_s64_m128i(a), 0); + vst1q_lane_s64((int64_t*)p, vreinterpretq_s64_m128i(a), 0); } // Store 64-bits of integer data from a into memory using a non-temporal memory // hint. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_stream_pi -FORCE_INLINE void _mm_stream_pi(__m64 *p, __m64 a) +FORCE_INLINE void _mm_stream_pi(__m64* p, __m64 a) { - vst1_s64((int64_t *) p, vreinterpret_s64_m64(a)); + vst1_s64((int64_t*)p, vreinterpret_s64_m64(a)); } // Store 128-bits (composed of 4 packed single-precision (32-bit) floating- // point elements) from a into memory using a non-temporal memory hint. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_stream_ps -FORCE_INLINE void _mm_stream_ps(float *p, __m128 a) +FORCE_INLINE void _mm_stream_ps(float* p, __m128 a) { #if __has_builtin(__builtin_nontemporal_store) - __builtin_nontemporal_store(a, (float32x4_t *) p); + __builtin_nontemporal_store(a, (float32x4_t*)p); #else - vst1q_f32(p, vreinterpretq_f32_m128(a)); + vst1q_f32(p, vreinterpretq_f32_m128(a)); #endif } @@ -2815,8 +2827,8 @@ FORCE_INLINE void _mm_stream_ps(float *p, __m128 a) // https://msdn.microsoft.com/en-us/library/vstudio/1zad2k61(v=vs.100).aspx FORCE_INLINE __m128 _mm_sub_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_f32( - vsubq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_f32( + vsubq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); } // Subtract the lower single-precision (32-bit) floating-point element in b from @@ -2830,26 +2842,27 @@ FORCE_INLINE __m128 _mm_sub_ps(__m128 a, __m128 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sub_ss FORCE_INLINE __m128 _mm_sub_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_sub_ps(a, b)); + return _mm_move_ss(a, _mm_sub_ps(a, b)); } // Macro: Transpose the 4x4 matrix formed by the 4 rows of single-precision // (32-bit) floating-point elements in row0, row1, row2, and row3, and store the // transposed matrix in these vectors (row0 now contains column 0, etc.). // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=MM_TRANSPOSE4_PS -#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \ - do { \ - float32x4x2_t ROW01 = vtrnq_f32(row0, row1); \ - float32x4x2_t ROW23 = vtrnq_f32(row2, row3); \ - row0 = vcombine_f32(vget_low_f32(ROW01.val[0]), \ - vget_low_f32(ROW23.val[0])); \ - row1 = vcombine_f32(vget_low_f32(ROW01.val[1]), \ - vget_low_f32(ROW23.val[1])); \ - row2 = vcombine_f32(vget_high_f32(ROW01.val[0]), \ - vget_high_f32(ROW23.val[0])); \ - row3 = vcombine_f32(vget_high_f32(ROW01.val[1]), \ - vget_high_f32(ROW23.val[1])); \ - } while (0) +#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \ + do \ + { \ + float32x4x2_t ROW01 = vtrnq_f32(row0, row1); \ + float32x4x2_t ROW23 = vtrnq_f32(row2, row3); \ + row0 = vcombine_f32(vget_low_f32(ROW01.val[0]), \ + vget_low_f32(ROW23.val[0])); \ + row1 = vcombine_f32(vget_low_f32(ROW01.val[1]), \ + vget_low_f32(ROW23.val[1])); \ + row2 = vcombine_f32(vget_high_f32(ROW01.val[0]), \ + vget_high_f32(ROW23.val[0])); \ + row3 = vcombine_f32(vget_high_f32(ROW01.val[1]), \ + vget_high_f32(ROW23.val[1])); \ + } while (0) // according to the documentation, these intrinsics behave the same as the // non-'u' versions. We'll just alias them here. @@ -2868,8 +2881,8 @@ FORCE_INLINE __m128i _mm_undefined_si128(void) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wuninitialized" #endif - __m128i a; - return a; + __m128i a; + return a; #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #endif @@ -2883,8 +2896,8 @@ FORCE_INLINE __m128 _mm_undefined_ps(void) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wuninitialized" #endif - __m128 a; - return a; + __m128 a; + return a; #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #endif @@ -2902,13 +2915,13 @@ FORCE_INLINE __m128 _mm_undefined_ps(void) FORCE_INLINE __m128 _mm_unpackhi_ps(__m128 a, __m128 b) { #if defined(__aarch64__) - return vreinterpretq_m128_f32( - vzip2q_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_f32( + vzip2q_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); #else - float32x2_t a1 = vget_high_f32(vreinterpretq_f32_m128(a)); - float32x2_t b1 = vget_high_f32(vreinterpretq_f32_m128(b)); - float32x2x2_t result = vzip_f32(a1, b1); - return vreinterpretq_m128_f32(vcombine_f32(result.val[0], result.val[1])); + float32x2_t a1 = vget_high_f32(vreinterpretq_f32_m128(a)); + float32x2_t b1 = vget_high_f32(vreinterpretq_f32_m128(b)); + float32x2x2_t result = vzip_f32(a1, b1); + return vreinterpretq_m128_f32(vcombine_f32(result.val[0], result.val[1])); #endif } @@ -2924,13 +2937,13 @@ FORCE_INLINE __m128 _mm_unpackhi_ps(__m128 a, __m128 b) FORCE_INLINE __m128 _mm_unpacklo_ps(__m128 a, __m128 b) { #if defined(__aarch64__) - return vreinterpretq_m128_f32( - vzip1q_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_f32( + vzip1q_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); #else - float32x2_t a1 = vget_low_f32(vreinterpretq_f32_m128(a)); - float32x2_t b1 = vget_low_f32(vreinterpretq_f32_m128(b)); - float32x2x2_t result = vzip_f32(a1, b1); - return vreinterpretq_m128_f32(vcombine_f32(result.val[0], result.val[1])); + float32x2_t a1 = vget_low_f32(vreinterpretq_f32_m128(a)); + float32x2_t b1 = vget_low_f32(vreinterpretq_f32_m128(b)); + float32x2x2_t result = vzip_f32(a1, b1); + return vreinterpretq_m128_f32(vcombine_f32(result.val[0], result.val[1])); #endif } @@ -2939,8 +2952,8 @@ FORCE_INLINE __m128 _mm_unpacklo_ps(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/ss6k3wk8(v=vs.100).aspx FORCE_INLINE __m128 _mm_xor_ps(__m128 a, __m128 b) { - return vreinterpretq_m128_s32( - veorq_s32(vreinterpretq_s32_m128(a), vreinterpretq_s32_m128(b))); + return vreinterpretq_m128_s32( + veorq_s32(vreinterpretq_s32_m128(a), vreinterpretq_s32_m128(b))); } /* SSE2 */ @@ -2950,8 +2963,8 @@ FORCE_INLINE __m128 _mm_xor_ps(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/fceha5k4(v=vs.100).aspx FORCE_INLINE __m128i _mm_add_epi16(__m128i a, __m128i b) { - return vreinterpretq_m128i_s16( - vaddq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); + return vreinterpretq_m128i_s16( + vaddq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); } // Adds the 4 signed or unsigned 32-bit integers in a to the 4 signed or @@ -2965,8 +2978,8 @@ FORCE_INLINE __m128i _mm_add_epi16(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/vstudio/09xs4fkk(v=vs.100).aspx FORCE_INLINE __m128i _mm_add_epi32(__m128i a, __m128i b) { - return vreinterpretq_m128i_s32( - vaddq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_s32( + vaddq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); } // Adds the 4 signed or unsigned 64-bit integers in a to the 4 signed or @@ -2974,8 +2987,8 @@ FORCE_INLINE __m128i _mm_add_epi32(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/vstudio/09xs4fkk(v=vs.100).aspx FORCE_INLINE __m128i _mm_add_epi64(__m128i a, __m128i b) { - return vreinterpretq_m128i_s64( - vaddq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b))); + return vreinterpretq_m128i_s64( + vaddq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b))); } // Adds the 16 signed or unsigned 8-bit integers in a to the 16 signed or @@ -2983,8 +2996,8 @@ FORCE_INLINE __m128i _mm_add_epi64(__m128i a, __m128i b) // https://technet.microsoft.com/en-us/subscriptions/yc7tcyzs(v=vs.90) FORCE_INLINE __m128i _mm_add_epi8(__m128i a, __m128i b) { - return vreinterpretq_m128i_s8( - vaddq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); + return vreinterpretq_m128i_s8( + vaddq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); } // Add packed double-precision (64-bit) floating-point elements in a and b, and @@ -2993,15 +3006,15 @@ FORCE_INLINE __m128i _mm_add_epi8(__m128i a, __m128i b) FORCE_INLINE __m128d _mm_add_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vaddq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_f64( + vaddq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #else - double *da = (double *) &a; - double *db = (double *) &b; - double c[2]; - c[0] = da[0] + db[0]; - c[1] = da[1] + db[1]; - return vld1q_f32((float32_t *) c); + double* da = (double*)&a; + double* db = (double*)&b; + double c[2]; + c[0] = da[0] + db[0]; + c[1] = da[1] + db[1]; + return vld1q_f32((float32_t*)c); #endif } @@ -3016,14 +3029,14 @@ FORCE_INLINE __m128d _mm_add_pd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_add_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return _mm_move_sd(a, _mm_add_pd(a, b)); + return _mm_move_sd(a, _mm_add_pd(a, b)); #else - double *da = (double *) &a; - double *db = (double *) &b; - double c[2]; - c[0] = da[0] + db[0]; - c[1] = da[1]; - return vld1q_f32((float32_t *) c); + double* da = (double*)&a; + double* db = (double*)&b; + double c[2]; + c[0] = da[0] + db[0]; + c[1] = da[1]; + return vld1q_f32((float32_t*)c); #endif } @@ -3034,8 +3047,8 @@ FORCE_INLINE __m128d _mm_add_sd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_add_si64 FORCE_INLINE __m64 _mm_add_si64(__m64 a, __m64 b) { - return vreinterpret_m64_s64( - vadd_s64(vreinterpret_s64_m64(a), vreinterpret_s64_m64(b))); + return vreinterpret_m64_s64( + vadd_s64(vreinterpret_s64_m64(a), vreinterpret_s64_m64(b))); } // Adds the 8 signed 16-bit integers in a to the 8 signed 16-bit integers in b @@ -3049,8 +3062,8 @@ FORCE_INLINE __m64 _mm_add_si64(__m64 a, __m64 b) // https://msdn.microsoft.com/en-us/library/1a306ef8(v=vs.100).aspx FORCE_INLINE __m128i _mm_adds_epi16(__m128i a, __m128i b) { - return vreinterpretq_m128i_s16( - vqaddq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); + return vreinterpretq_m128i_s16( + vqaddq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); } // Add packed signed 8-bit integers in a and b using saturation, and store the @@ -3064,8 +3077,8 @@ FORCE_INLINE __m128i _mm_adds_epi16(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_adds_epi8 FORCE_INLINE __m128i _mm_adds_epi8(__m128i a, __m128i b) { - return vreinterpretq_m128i_s8( - vqaddq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); + return vreinterpretq_m128i_s8( + vqaddq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); } // Add packed unsigned 16-bit integers in a and b using saturation, and store @@ -3073,8 +3086,8 @@ FORCE_INLINE __m128i _mm_adds_epi8(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_adds_epu16 FORCE_INLINE __m128i _mm_adds_epu16(__m128i a, __m128i b) { - return vreinterpretq_m128i_u16( - vqaddq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b))); + return vreinterpretq_m128i_u16( + vqaddq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b))); } // Adds the 16 unsigned 8-bit integers in a to the 16 unsigned 8-bit integers in @@ -3082,8 +3095,8 @@ FORCE_INLINE __m128i _mm_adds_epu16(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/9hahyddy(v=vs.100).aspx FORCE_INLINE __m128i _mm_adds_epu8(__m128i a, __m128i b) { - return vreinterpretq_m128i_u8( - vqaddq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b))); + return vreinterpretq_m128i_u8( + vqaddq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b))); } // Compute the bitwise AND of packed double-precision (64-bit) floating-point @@ -3097,8 +3110,8 @@ FORCE_INLINE __m128i _mm_adds_epu8(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_and_pd FORCE_INLINE __m128d _mm_and_pd(__m128d a, __m128d b) { - return vreinterpretq_m128d_s64( - vandq_s64(vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b))); + return vreinterpretq_m128d_s64( + vandq_s64(vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b))); } // Computes the bitwise AND of the 128-bit value in a and the 128-bit value in @@ -3109,8 +3122,8 @@ FORCE_INLINE __m128d _mm_and_pd(__m128d a, __m128d b) // https://msdn.microsoft.com/en-us/library/vstudio/6d1txsa8(v=vs.100).aspx FORCE_INLINE __m128i _mm_and_si128(__m128i a, __m128i b) { - return vreinterpretq_m128i_s32( - vandq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_s32( + vandq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); } // Compute the bitwise NOT of packed double-precision (64-bit) floating-point @@ -3124,9 +3137,9 @@ FORCE_INLINE __m128i _mm_and_si128(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_andnot_pd FORCE_INLINE __m128d _mm_andnot_pd(__m128d a, __m128d b) { - // *NOTE* argument swap - return vreinterpretq_m128d_s64( - vbicq_s64(vreinterpretq_s64_m128d(b), vreinterpretq_s64_m128d(a))); + // *NOTE* argument swap + return vreinterpretq_m128d_s64( + vbicq_s64(vreinterpretq_s64_m128d(b), vreinterpretq_s64_m128d(a))); } // Computes the bitwise AND of the 128-bit value in b and the bitwise NOT of the @@ -3137,9 +3150,9 @@ FORCE_INLINE __m128d _mm_andnot_pd(__m128d a, __m128d b) // https://msdn.microsoft.com/en-us/library/vstudio/1beaceh8(v=vs.100).aspx FORCE_INLINE __m128i _mm_andnot_si128(__m128i a, __m128i b) { - return vreinterpretq_m128i_s32( - vbicq_s32(vreinterpretq_s32_m128i(b), - vreinterpretq_s32_m128i(a))); // *NOTE* argument swap + return vreinterpretq_m128i_s32( + vbicq_s32(vreinterpretq_s32_m128i(b), + vreinterpretq_s32_m128i(a))); // *NOTE* argument swap } // Computes the average of the 8 unsigned 16-bit integers in a and the 8 @@ -3153,8 +3166,8 @@ FORCE_INLINE __m128i _mm_andnot_si128(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/vstudio/y13ca3c8(v=vs.90).aspx FORCE_INLINE __m128i _mm_avg_epu16(__m128i a, __m128i b) { - return (__m128i) vrhaddq_u16(vreinterpretq_u16_m128i(a), - vreinterpretq_u16_m128i(b)); + return (__m128i)vrhaddq_u16(vreinterpretq_u16_m128i(a), + vreinterpretq_u16_m128i(b)); } // Computes the average of the 16 unsigned 8-bit integers in a and the 16 @@ -3168,8 +3181,8 @@ FORCE_INLINE __m128i _mm_avg_epu16(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/vstudio/8zwh554a(v%3dvs.90).aspx FORCE_INLINE __m128i _mm_avg_epu8(__m128i a, __m128i b) { - return vreinterpretq_m128i_u8( - vrhaddq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b))); + return vreinterpretq_m128i_u8( + vrhaddq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b))); } // Shift a left by imm8 bytes while shifting in zeros, and store the results in @@ -3187,7 +3200,7 @@ FORCE_INLINE __m128i _mm_avg_epu8(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_castpd_ps FORCE_INLINE __m128 _mm_castpd_ps(__m128d a) { - return vreinterpretq_m128_s64(vreinterpretq_s64_m128d(a)); + return vreinterpretq_m128_s64(vreinterpretq_s64_m128d(a)); } // Cast vector of type __m128d to type __m128i. This intrinsic is only used for @@ -3195,7 +3208,7 @@ FORCE_INLINE __m128 _mm_castpd_ps(__m128d a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_castpd_si128 FORCE_INLINE __m128i _mm_castpd_si128(__m128d a) { - return vreinterpretq_m128i_s64(vreinterpretq_s64_m128d(a)); + return vreinterpretq_m128i_s64(vreinterpretq_s64_m128d(a)); } // Cast vector of type __m128 to type __m128d. This intrinsic is only used for @@ -3203,7 +3216,7 @@ FORCE_INLINE __m128i _mm_castpd_si128(__m128d a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_castps_pd FORCE_INLINE __m128d _mm_castps_pd(__m128 a) { - return vreinterpretq_m128d_s32(vreinterpretq_s32_m128(a)); + return vreinterpretq_m128d_s32(vreinterpretq_s32_m128(a)); } // Applies a type cast to reinterpret four 32-bit floating point values passed @@ -3211,7 +3224,7 @@ FORCE_INLINE __m128d _mm_castps_pd(__m128 a) // https://msdn.microsoft.com/en-us/library/bb514099.aspx FORCE_INLINE __m128i _mm_castps_si128(__m128 a) { - return vreinterpretq_m128i_s32(vreinterpretq_s32_m128(a)); + return vreinterpretq_m128i_s32(vreinterpretq_s32_m128(a)); } // Cast vector of type __m128i to type __m128d. This intrinsic is only used for @@ -3220,9 +3233,9 @@ FORCE_INLINE __m128i _mm_castps_si128(__m128 a) FORCE_INLINE __m128d _mm_castsi128_pd(__m128i a) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64(vreinterpretq_f64_m128i(a)); + return vreinterpretq_m128d_f64(vreinterpretq_f64_m128i(a)); #else - return vreinterpretq_m128d_f32(vreinterpretq_f32_m128i(a)); + return vreinterpretq_m128d_f32(vreinterpretq_f32_m128i(a)); #endif } @@ -3231,16 +3244,16 @@ FORCE_INLINE __m128d _mm_castsi128_pd(__m128i a) // https://msdn.microsoft.com/en-us/library/bb514029.aspx FORCE_INLINE __m128 _mm_castsi128_ps(__m128i a) { - return vreinterpretq_m128_s32(vreinterpretq_s32_m128i(a)); + return vreinterpretq_m128_s32(vreinterpretq_s32_m128i(a)); } // Cache line containing p is flushed and invalidated from all caches in the // coherency domain. : // https://msdn.microsoft.com/en-us/library/ba08y07y(v=vs.100).aspx -FORCE_INLINE void _mm_clflush(void const *p) +FORCE_INLINE void _mm_clflush(void const* p) { - (void) p; - // no corollary for Neon? + (void)p; + // no corollary for Neon? } // Compares the 8 signed or unsigned 16-bit integers in a and the 8 signed or @@ -3248,16 +3261,16 @@ FORCE_INLINE void _mm_clflush(void const *p) // https://msdn.microsoft.com/en-us/library/2ay060te(v=vs.100).aspx FORCE_INLINE __m128i _mm_cmpeq_epi16(__m128i a, __m128i b) { - return vreinterpretq_m128i_u16( - vceqq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); + return vreinterpretq_m128i_u16( + vceqq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); } // Compare packed 32-bit integers in a and b for equality, and store the results // in dst FORCE_INLINE __m128i _mm_cmpeq_epi32(__m128i a, __m128i b) { - return vreinterpretq_m128i_u32( - vceqq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_u32( + vceqq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); } // Compares the 16 signed or unsigned 8-bit integers in a and the 16 signed or @@ -3265,8 +3278,8 @@ FORCE_INLINE __m128i _mm_cmpeq_epi32(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/windows/desktop/bz5xk21a(v=vs.90).aspx FORCE_INLINE __m128i _mm_cmpeq_epi8(__m128i a, __m128i b) { - return vreinterpretq_m128i_u8( - vceqq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); + return vreinterpretq_m128i_u8( + vceqq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); } // Compare packed double-precision (64-bit) floating-point elements in a and b @@ -3275,14 +3288,14 @@ FORCE_INLINE __m128i _mm_cmpeq_epi8(__m128i a, __m128i b) FORCE_INLINE __m128d _mm_cmpeq_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_u64( - vceqq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_u64( + vceqq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #else - // (a == b) -> (a_lo == b_lo) && (a_hi == b_hi) - uint32x4_t cmp = - vceqq_u32(vreinterpretq_u32_m128d(a), vreinterpretq_u32_m128d(b)); - uint32x4_t swapped = vrev64q_u32(cmp); - return vreinterpretq_m128d_u32(vandq_u32(cmp, swapped)); + // (a == b) -> (a_lo == b_lo) && (a_hi == b_hi) + uint32x4_t cmp = + vceqq_u32(vreinterpretq_u32_m128d(a), vreinterpretq_u32_m128d(b)); + uint32x4_t swapped = vrev64q_u32(cmp); + return vreinterpretq_m128d_u32(vandq_u32(cmp, swapped)); #endif } @@ -3292,7 +3305,7 @@ FORCE_INLINE __m128d _mm_cmpeq_pd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpeq_sd FORCE_INLINE __m128d _mm_cmpeq_sd(__m128d a, __m128d b) { - return _mm_move_sd(a, _mm_cmpeq_pd(a, b)); + return _mm_move_sd(a, _mm_cmpeq_pd(a, b)); } // Compare packed double-precision (64-bit) floating-point elements in a and b @@ -3301,18 +3314,18 @@ FORCE_INLINE __m128d _mm_cmpeq_sd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmpge_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_u64( - vcgeq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_u64( + vcgeq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = (*(double *) &a0) >= (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0); - d[1] = (*(double *) &a1) >= (*(double *) &b1) ? ~UINT64_C(0) : UINT64_C(0); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t b1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = (*(double*)&a0) >= (*(double*)&b0) ? ~UINT64_C(0) : UINT64_C(0); + d[1] = (*(double*)&a1) >= (*(double*)&b1) ? ~UINT64_C(0) : UINT64_C(0); - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3323,17 +3336,17 @@ FORCE_INLINE __m128d _mm_cmpge_pd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmpge_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return _mm_move_sd(a, _mm_cmpge_pd(a, b)); + return _mm_move_sd(a, _mm_cmpge_pd(a, b)); #else - // expand "_mm_cmpge_pd()" to reduce unnecessary operations - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = (*(double *) &a0) >= (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0); - d[1] = a1; + // expand "_mm_cmpge_pd()" to reduce unnecessary operations + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = (*(double*)&a0) >= (*(double*)&b0) ? ~UINT64_C(0) : UINT64_C(0); + d[1] = a1; - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3348,8 +3361,8 @@ FORCE_INLINE __m128d _mm_cmpge_sd(__m128d a, __m128d b) // https://technet.microsoft.com/en-us/library/xd43yfsa(v=vs.100).aspx FORCE_INLINE __m128i _mm_cmpgt_epi16(__m128i a, __m128i b) { - return vreinterpretq_m128i_u16( - vcgtq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); + return vreinterpretq_m128i_u16( + vcgtq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); } // Compares the 4 signed 32-bit integers in a and the 4 signed 32-bit integers @@ -3357,8 +3370,8 @@ FORCE_INLINE __m128i _mm_cmpgt_epi16(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/vstudio/1s9f2z0y(v=vs.100).aspx FORCE_INLINE __m128i _mm_cmpgt_epi32(__m128i a, __m128i b) { - return vreinterpretq_m128i_u32( - vcgtq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_u32( + vcgtq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); } // Compares the 16 signed 8-bit integers in a and the 16 signed 8-bit integers @@ -3372,8 +3385,8 @@ FORCE_INLINE __m128i _mm_cmpgt_epi32(__m128i a, __m128i b) // https://msdn.microsoft.com/zh-tw/library/wf45zt2b(v=vs.100).aspx FORCE_INLINE __m128i _mm_cmpgt_epi8(__m128i a, __m128i b) { - return vreinterpretq_m128i_u8( - vcgtq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); + return vreinterpretq_m128i_u8( + vcgtq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); } // Compare packed double-precision (64-bit) floating-point elements in a and b @@ -3382,18 +3395,18 @@ FORCE_INLINE __m128i _mm_cmpgt_epi8(__m128i a, __m128i b) FORCE_INLINE __m128d _mm_cmpgt_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_u64( - vcgtq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_u64( + vcgtq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = (*(double *) &a0) > (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0); - d[1] = (*(double *) &a1) > (*(double *) &b1) ? ~UINT64_C(0) : UINT64_C(0); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t b1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = (*(double*)&a0) > (*(double*)&b0) ? ~UINT64_C(0) : UINT64_C(0); + d[1] = (*(double*)&a1) > (*(double*)&b1) ? ~UINT64_C(0) : UINT64_C(0); - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3404,17 +3417,17 @@ FORCE_INLINE __m128d _mm_cmpgt_pd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmpgt_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return _mm_move_sd(a, _mm_cmpgt_pd(a, b)); + return _mm_move_sd(a, _mm_cmpgt_pd(a, b)); #else - // expand "_mm_cmpge_pd()" to reduce unnecessary operations - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = (*(double *) &a0) > (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0); - d[1] = a1; + // expand "_mm_cmpge_pd()" to reduce unnecessary operations + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = (*(double*)&a0) > (*(double*)&b0) ? ~UINT64_C(0) : UINT64_C(0); + d[1] = a1; - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3424,18 +3437,18 @@ FORCE_INLINE __m128d _mm_cmpgt_sd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmple_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_u64( - vcleq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_u64( + vcleq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = (*(double *) &a0) <= (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0); - d[1] = (*(double *) &a1) <= (*(double *) &b1) ? ~UINT64_C(0) : UINT64_C(0); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t b1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = (*(double*)&a0) <= (*(double*)&b0) ? ~UINT64_C(0) : UINT64_C(0); + d[1] = (*(double*)&a1) <= (*(double*)&b1) ? ~UINT64_C(0) : UINT64_C(0); - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3446,17 +3459,17 @@ FORCE_INLINE __m128d _mm_cmple_pd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmple_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return _mm_move_sd(a, _mm_cmple_pd(a, b)); + return _mm_move_sd(a, _mm_cmple_pd(a, b)); #else - // expand "_mm_cmpge_pd()" to reduce unnecessary operations - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = (*(double *) &a0) <= (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0); - d[1] = a1; + // expand "_mm_cmpge_pd()" to reduce unnecessary operations + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = (*(double*)&a0) <= (*(double*)&b0) ? ~UINT64_C(0) : UINT64_C(0); + d[1] = a1; - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3471,18 +3484,17 @@ FORCE_INLINE __m128d _mm_cmple_sd(__m128d a, __m128d b) // https://technet.microsoft.com/en-us/library/t863edb2(v=vs.100).aspx FORCE_INLINE __m128i _mm_cmplt_epi16(__m128i a, __m128i b) { - return vreinterpretq_m128i_u16( - vcltq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); + return vreinterpretq_m128i_u16( + vcltq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); } - // Compares the 4 signed 32-bit integers in a and the 4 signed 32-bit integers // in b for less than. // https://msdn.microsoft.com/en-us/library/vstudio/4ak0bf5d(v=vs.100).aspx FORCE_INLINE __m128i _mm_cmplt_epi32(__m128i a, __m128i b) { - return vreinterpretq_m128i_u32( - vcltq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_u32( + vcltq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); } // Compares the 16 signed 8-bit integers in a and the 16 signed 8-bit integers @@ -3490,8 +3502,8 @@ FORCE_INLINE __m128i _mm_cmplt_epi32(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/windows/desktop/9s46csht(v=vs.90).aspx FORCE_INLINE __m128i _mm_cmplt_epi8(__m128i a, __m128i b) { - return vreinterpretq_m128i_u8( - vcltq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); + return vreinterpretq_m128i_u8( + vcltq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); } // Compare packed double-precision (64-bit) floating-point elements in a and b @@ -3500,18 +3512,18 @@ FORCE_INLINE __m128i _mm_cmplt_epi8(__m128i a, __m128i b) FORCE_INLINE __m128d _mm_cmplt_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_u64( - vcltq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_u64( + vcltq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = (*(double *) &a0) < (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0); - d[1] = (*(double *) &a1) < (*(double *) &b1) ? ~UINT64_C(0) : UINT64_C(0); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t b1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = (*(double*)&a0) < (*(double*)&b0) ? ~UINT64_C(0) : UINT64_C(0); + d[1] = (*(double*)&a1) < (*(double*)&b1) ? ~UINT64_C(0) : UINT64_C(0); - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3522,16 +3534,16 @@ FORCE_INLINE __m128d _mm_cmplt_pd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmplt_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return _mm_move_sd(a, _mm_cmplt_pd(a, b)); + return _mm_move_sd(a, _mm_cmplt_pd(a, b)); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = (*(double *) &a0) < (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0); - d[1] = a1; + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = (*(double*)&a0) < (*(double*)&b0) ? ~UINT64_C(0) : UINT64_C(0); + d[1] = a1; - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3541,14 +3553,14 @@ FORCE_INLINE __m128d _mm_cmplt_sd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmpneq_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_s32(vmvnq_s32(vreinterpretq_s32_u64( - vceqq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))))); + return vreinterpretq_m128d_s32(vmvnq_s32(vreinterpretq_s32_u64( + vceqq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))))); #else - // (a == b) -> (a_lo == b_lo) && (a_hi == b_hi) - uint32x4_t cmp = - vceqq_u32(vreinterpretq_u32_m128d(a), vreinterpretq_u32_m128d(b)); - uint32x4_t swapped = vrev64q_u32(cmp); - return vreinterpretq_m128d_u32(vmvnq_u32(vandq_u32(cmp, swapped))); + // (a == b) -> (a_lo == b_lo) && (a_hi == b_hi) + uint32x4_t cmp = + vceqq_u32(vreinterpretq_u32_m128d(a), vreinterpretq_u32_m128d(b)); + uint32x4_t swapped = vrev64q_u32(cmp); + return vreinterpretq_m128d_u32(vmvnq_u32(vandq_u32(cmp, swapped))); #endif } @@ -3558,7 +3570,7 @@ FORCE_INLINE __m128d _mm_cmpneq_pd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpneq_sd FORCE_INLINE __m128d _mm_cmpneq_sd(__m128d a, __m128d b) { - return _mm_move_sd(a, _mm_cmpneq_pd(a, b)); + return _mm_move_sd(a, _mm_cmpneq_pd(a, b)); } // Compare packed double-precision (64-bit) floating-point elements in a and b @@ -3567,21 +3579,21 @@ FORCE_INLINE __m128d _mm_cmpneq_sd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmpnge_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_u64(veorq_u64( - vcgeq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)), - vdupq_n_u64(UINT64_MAX))); + return vreinterpretq_m128d_u64(veorq_u64( + vcgeq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)), + vdupq_n_u64(UINT64_MAX))); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = - !((*(double *) &a0) >= (*(double *) &b0)) ? ~UINT64_C(0) : UINT64_C(0); - d[1] = - !((*(double *) &a1) >= (*(double *) &b1)) ? ~UINT64_C(0) : UINT64_C(0); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t b1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = + !((*(double*)&a0) >= (*(double*)&b0)) ? ~UINT64_C(0) : UINT64_C(0); + d[1] = + !((*(double*)&a1) >= (*(double*)&b1)) ? ~UINT64_C(0) : UINT64_C(0); - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3591,7 +3603,7 @@ FORCE_INLINE __m128d _mm_cmpnge_pd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpnge_sd FORCE_INLINE __m128d _mm_cmpnge_sd(__m128d a, __m128d b) { - return _mm_move_sd(a, _mm_cmpnge_pd(a, b)); + return _mm_move_sd(a, _mm_cmpnge_pd(a, b)); } // Compare packed double-precision (64-bit) floating-point elements in a and b @@ -3600,21 +3612,21 @@ FORCE_INLINE __m128d _mm_cmpnge_sd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmpngt_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_u64(veorq_u64( - vcgtq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)), - vdupq_n_u64(UINT64_MAX))); + return vreinterpretq_m128d_u64(veorq_u64( + vcgtq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)), + vdupq_n_u64(UINT64_MAX))); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = - !((*(double *) &a0) > (*(double *) &b0)) ? ~UINT64_C(0) : UINT64_C(0); - d[1] = - !((*(double *) &a1) > (*(double *) &b1)) ? ~UINT64_C(0) : UINT64_C(0); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t b1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = + !((*(double*)&a0) > (*(double*)&b0)) ? ~UINT64_C(0) : UINT64_C(0); + d[1] = + !((*(double*)&a1) > (*(double*)&b1)) ? ~UINT64_C(0) : UINT64_C(0); - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3624,7 +3636,7 @@ FORCE_INLINE __m128d _mm_cmpngt_pd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpngt_sd FORCE_INLINE __m128d _mm_cmpngt_sd(__m128d a, __m128d b) { - return _mm_move_sd(a, _mm_cmpngt_pd(a, b)); + return _mm_move_sd(a, _mm_cmpngt_pd(a, b)); } // Compare packed double-precision (64-bit) floating-point elements in a and b @@ -3633,21 +3645,21 @@ FORCE_INLINE __m128d _mm_cmpngt_sd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmpnle_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_u64(veorq_u64( - vcleq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)), - vdupq_n_u64(UINT64_MAX))); + return vreinterpretq_m128d_u64(veorq_u64( + vcleq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)), + vdupq_n_u64(UINT64_MAX))); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = - !((*(double *) &a0) <= (*(double *) &b0)) ? ~UINT64_C(0) : UINT64_C(0); - d[1] = - !((*(double *) &a1) <= (*(double *) &b1)) ? ~UINT64_C(0) : UINT64_C(0); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t b1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = + !((*(double*)&a0) <= (*(double*)&b0)) ? ~UINT64_C(0) : UINT64_C(0); + d[1] = + !((*(double*)&a1) <= (*(double*)&b1)) ? ~UINT64_C(0) : UINT64_C(0); - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3657,7 +3669,7 @@ FORCE_INLINE __m128d _mm_cmpnle_pd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpnle_sd FORCE_INLINE __m128d _mm_cmpnle_sd(__m128d a, __m128d b) { - return _mm_move_sd(a, _mm_cmpnle_pd(a, b)); + return _mm_move_sd(a, _mm_cmpnle_pd(a, b)); } // Compare packed double-precision (64-bit) floating-point elements in a and b @@ -3666,21 +3678,21 @@ FORCE_INLINE __m128d _mm_cmpnle_sd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmpnlt_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_u64(veorq_u64( - vcltq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)), - vdupq_n_u64(UINT64_MAX))); + return vreinterpretq_m128d_u64(veorq_u64( + vcltq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)), + vdupq_n_u64(UINT64_MAX))); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = - !((*(double *) &a0) < (*(double *) &b0)) ? ~UINT64_C(0) : UINT64_C(0); - d[1] = - !((*(double *) &a1) < (*(double *) &b1)) ? ~UINT64_C(0) : UINT64_C(0); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t b1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = + !((*(double*)&a0) < (*(double*)&b0)) ? ~UINT64_C(0) : UINT64_C(0); + d[1] = + !((*(double*)&a1) < (*(double*)&b1)) ? ~UINT64_C(0) : UINT64_C(0); - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3690,7 +3702,7 @@ FORCE_INLINE __m128d _mm_cmpnlt_pd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmpnlt_sd FORCE_INLINE __m128d _mm_cmpnlt_sd(__m128d a, __m128d b) { - return _mm_move_sd(a, _mm_cmpnlt_pd(a, b)); + return _mm_move_sd(a, _mm_cmpnlt_pd(a, b)); } // Compare packed double-precision (64-bit) floating-point elements in a and b @@ -3699,28 +3711,28 @@ FORCE_INLINE __m128d _mm_cmpnlt_sd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmpord_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - // Excluding NaNs, any two floating point numbers can be compared. - uint64x2_t not_nan_a = - vceqq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(a)); - uint64x2_t not_nan_b = - vceqq_f64(vreinterpretq_f64_m128d(b), vreinterpretq_f64_m128d(b)); - return vreinterpretq_m128d_u64(vandq_u64(not_nan_a, not_nan_b)); + // Excluding NaNs, any two floating point numbers can be compared. + uint64x2_t not_nan_a = + vceqq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(a)); + uint64x2_t not_nan_b = + vceqq_f64(vreinterpretq_f64_m128d(b), vreinterpretq_f64_m128d(b)); + return vreinterpretq_m128d_u64(vandq_u64(not_nan_a, not_nan_b)); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = ((*(double *) &a0) == (*(double *) &a0) && - (*(double *) &b0) == (*(double *) &b0)) - ? ~UINT64_C(0) - : UINT64_C(0); - d[1] = ((*(double *) &a1) == (*(double *) &a1) && - (*(double *) &b1) == (*(double *) &b1)) - ? ~UINT64_C(0) - : UINT64_C(0); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t b1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = ((*(double*)&a0) == (*(double*)&a0) && + (*(double*)&b0) == (*(double*)&b0)) ? + ~UINT64_C(0) : + UINT64_C(0); + d[1] = ((*(double*)&a1) == (*(double*)&a1) && + (*(double*)&b1) == (*(double*)&b1)) ? + ~UINT64_C(0) : + UINT64_C(0); - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3731,19 +3743,19 @@ FORCE_INLINE __m128d _mm_cmpord_pd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmpord_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return _mm_move_sd(a, _mm_cmpord_pd(a, b)); + return _mm_move_sd(a, _mm_cmpord_pd(a, b)); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t d[2]; - d[0] = ((*(double *) &a0) == (*(double *) &a0) && - (*(double *) &b0) == (*(double *) &b0)) - ? ~UINT64_C(0) - : UINT64_C(0); - d[1] = a1; + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t d[2]; + d[0] = ((*(double*)&a0) == (*(double*)&a0) && + (*(double*)&b0) == (*(double*)&b0)) ? + ~UINT64_C(0) : + UINT64_C(0); + d[1] = a1; - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3753,29 +3765,29 @@ FORCE_INLINE __m128d _mm_cmpord_sd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmpunord_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - // Two NaNs are not equal in comparison operation. - uint64x2_t not_nan_a = - vceqq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(a)); - uint64x2_t not_nan_b = - vceqq_f64(vreinterpretq_f64_m128d(b), vreinterpretq_f64_m128d(b)); - return vreinterpretq_m128d_s32( - vmvnq_s32(vreinterpretq_s32_u64(vandq_u64(not_nan_a, not_nan_b)))); + // Two NaNs are not equal in comparison operation. + uint64x2_t not_nan_a = + vceqq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(a)); + uint64x2_t not_nan_b = + vceqq_f64(vreinterpretq_f64_m128d(b), vreinterpretq_f64_m128d(b)); + return vreinterpretq_m128d_s32( + vmvnq_s32(vreinterpretq_s32_u64(vandq_u64(not_nan_a, not_nan_b)))); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = ((*(double *) &a0) == (*(double *) &a0) && - (*(double *) &b0) == (*(double *) &b0)) - ? UINT64_C(0) - : ~UINT64_C(0); - d[1] = ((*(double *) &a1) == (*(double *) &a1) && - (*(double *) &b1) == (*(double *) &b1)) - ? UINT64_C(0) - : ~UINT64_C(0); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t b1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = ((*(double*)&a0) == (*(double*)&a0) && + (*(double*)&b0) == (*(double*)&b0)) ? + UINT64_C(0) : + ~UINT64_C(0); + d[1] = ((*(double*)&a1) == (*(double*)&a1) && + (*(double*)&b1) == (*(double*)&b1)) ? + UINT64_C(0) : + ~UINT64_C(0); - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3786,19 +3798,19 @@ FORCE_INLINE __m128d _mm_cmpunord_pd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cmpunord_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return _mm_move_sd(a, _mm_cmpunord_pd(a, b)); + return _mm_move_sd(a, _mm_cmpunord_pd(a, b)); #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t d[2]; - d[0] = ((*(double *) &a0) == (*(double *) &a0) && - (*(double *) &b0) == (*(double *) &b0)) - ? UINT64_C(0) - : ~UINT64_C(0); - d[1] = a1; + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t d[2]; + d[0] = ((*(double*)&a0) == (*(double*)&a0) && + (*(double*)&b0) == (*(double*)&b0)) ? + UINT64_C(0) : + ~UINT64_C(0); + d[1] = a1; - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -3808,12 +3820,12 @@ FORCE_INLINE __m128d _mm_cmpunord_sd(__m128d a, __m128d b) FORCE_INLINE int _mm_comige_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vgetq_lane_u64(vcgeq_f64(a, b), 0) & 0x1; + return vgetq_lane_u64(vcgeq_f64(a, b), 0) & 0x1; #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); - return (*(double *) &a0 >= *(double *) &b0); + return (*(double*)&a0 >= *(double*)&b0); #endif } @@ -3823,12 +3835,12 @@ FORCE_INLINE int _mm_comige_sd(__m128d a, __m128d b) FORCE_INLINE int _mm_comigt_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vgetq_lane_u64(vcgtq_f64(a, b), 0) & 0x1; + return vgetq_lane_u64(vcgtq_f64(a, b), 0) & 0x1; #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); - return (*(double *) &a0 > *(double *) &b0); + return (*(double*)&a0 > *(double*)&b0); #endif } @@ -3838,12 +3850,12 @@ FORCE_INLINE int _mm_comigt_sd(__m128d a, __m128d b) FORCE_INLINE int _mm_comile_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vgetq_lane_u64(vcleq_f64(a, b), 0) & 0x1; + return vgetq_lane_u64(vcleq_f64(a, b), 0) & 0x1; #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); - return (*(double *) &a0 <= *(double *) &b0); + return (*(double*)&a0 <= *(double*)&b0); #endif } @@ -3853,12 +3865,12 @@ FORCE_INLINE int _mm_comile_sd(__m128d a, __m128d b) FORCE_INLINE int _mm_comilt_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vgetq_lane_u64(vcltq_f64(a, b), 0) & 0x1; + return vgetq_lane_u64(vcltq_f64(a, b), 0) & 0x1; #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); - return (*(double *) &a0 < *(double *) &b0); + return (*(double*)&a0 < *(double*)&b0); #endif } @@ -3868,18 +3880,18 @@ FORCE_INLINE int _mm_comilt_sd(__m128d a, __m128d b) FORCE_INLINE int _mm_comieq_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vgetq_lane_u64(vceqq_f64(a, b), 0) & 0x1; + return vgetq_lane_u64(vceqq_f64(a, b), 0) & 0x1; #else - uint32x4_t a_not_nan = - vceqq_u32(vreinterpretq_u32_m128d(a), vreinterpretq_u32_m128d(a)); - uint32x4_t b_not_nan = - vceqq_u32(vreinterpretq_u32_m128d(b), vreinterpretq_u32_m128d(b)); - uint32x4_t a_and_b_not_nan = vandq_u32(a_not_nan, b_not_nan); - uint32x4_t a_eq_b = - vceqq_u32(vreinterpretq_u32_m128d(a), vreinterpretq_u32_m128d(b)); - uint64x2_t and_results = vandq_u64(vreinterpretq_u64_u32(a_and_b_not_nan), - vreinterpretq_u64_u32(a_eq_b)); - return vgetq_lane_u64(and_results, 0) & 0x1; + uint32x4_t a_not_nan = + vceqq_u32(vreinterpretq_u32_m128d(a), vreinterpretq_u32_m128d(a)); + uint32x4_t b_not_nan = + vceqq_u32(vreinterpretq_u32_m128d(b), vreinterpretq_u32_m128d(b)); + uint32x4_t a_and_b_not_nan = vandq_u32(a_not_nan, b_not_nan); + uint32x4_t a_eq_b = + vceqq_u32(vreinterpretq_u32_m128d(a), vreinterpretq_u32_m128d(b)); + uint64x2_t and_results = vandq_u64(vreinterpretq_u64_u32(a_and_b_not_nan), + vreinterpretq_u64_u32(a_eq_b)); + return vgetq_lane_u64(and_results, 0) & 0x1; #endif } @@ -3888,7 +3900,7 @@ FORCE_INLINE int _mm_comieq_sd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_comineq_sd FORCE_INLINE int _mm_comineq_sd(__m128d a, __m128d b) { - return !_mm_comieq_sd(a, b); + return !_mm_comieq_sd(a, b); } // Convert packed signed 32-bit integers in a to packed double-precision @@ -3904,12 +3916,12 @@ FORCE_INLINE int _mm_comineq_sd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_cvtepi32_pd(__m128i a) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vcvtq_f64_s64(vmovl_s32(vget_low_s32(vreinterpretq_s32_m128i(a))))); + return vreinterpretq_m128d_f64( + vcvtq_f64_s64(vmovl_s32(vget_low_s32(vreinterpretq_s32_m128i(a))))); #else - double a0 = (double) vgetq_lane_s32(vreinterpretq_s32_m128i(a), 0); - double a1 = (double) vgetq_lane_s32(vreinterpretq_s32_m128i(a), 1); - return _mm_set_pd(a1, a0); + double a0 = (double)vgetq_lane_s32(vreinterpretq_s32_m128i(a), 0); + double a1 = (double)vgetq_lane_s32(vreinterpretq_s32_m128i(a), 1); + return _mm_set_pd(a1, a0); #endif } @@ -3918,7 +3930,7 @@ FORCE_INLINE __m128d _mm_cvtepi32_pd(__m128i a) // https://msdn.microsoft.com/en-us/library/vstudio/36bwxcx5(v=vs.100).aspx FORCE_INLINE __m128 _mm_cvtepi32_ps(__m128i a) { - return vreinterpretq_m128_f32(vcvtq_f32_s32(vreinterpretq_s32_m128i(a))); + return vreinterpretq_m128_f32(vcvtq_f32_s32(vreinterpretq_s32_m128i(a))); } // Convert packed double-precision (64-bit) floating-point elements in a to @@ -3933,10 +3945,10 @@ FORCE_INLINE __m128 _mm_cvtepi32_ps(__m128i a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpd_epi32 FORCE_INLINE __m128i _mm_cvtpd_epi32(__m128d a) { - __m128d rnd = _mm_round_pd(a, _MM_FROUND_CUR_DIRECTION); - double d0 = ((double *) &rnd)[0]; - double d1 = ((double *) &rnd)[1]; - return _mm_set_epi32(0, 0, (int32_t) d1, (int32_t) d0); + __m128d rnd = _mm_round_pd(a, _MM_FROUND_CUR_DIRECTION); + double d0 = ((double*)&rnd)[0]; + double d1 = ((double*)&rnd)[1]; + return _mm_set_epi32(0, 0, (int32_t)d1, (int32_t)d0); } // Convert packed double-precision (64-bit) floating-point elements in a to @@ -3951,11 +3963,11 @@ FORCE_INLINE __m128i _mm_cvtpd_epi32(__m128d a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpd_pi32 FORCE_INLINE __m64 _mm_cvtpd_pi32(__m128d a) { - __m128d rnd = _mm_round_pd(a, _MM_FROUND_CUR_DIRECTION); - double d0 = ((double *) &rnd)[0]; - double d1 = ((double *) &rnd)[1]; - int32_t ALIGN_STRUCT(16) data[2] = {(int32_t) d0, (int32_t) d1}; - return vreinterpret_m64_s32(vld1_s32(data)); + __m128d rnd = _mm_round_pd(a, _MM_FROUND_CUR_DIRECTION); + double d0 = ((double*)&rnd)[0]; + double d1 = ((double*)&rnd)[1]; + int32_t ALIGN_STRUCT(16) data[2] = {(int32_t)d0, (int32_t)d1}; + return vreinterpret_m64_s32(vld1_s32(data)); } // Convert packed double-precision (64-bit) floating-point elements in a to @@ -3973,12 +3985,12 @@ FORCE_INLINE __m64 _mm_cvtpd_pi32(__m128d a) FORCE_INLINE __m128 _mm_cvtpd_ps(__m128d a) { #if defined(__aarch64__) - float32x2_t tmp = vcvt_f32_f64(vreinterpretq_f64_m128d(a)); - return vreinterpretq_m128_f32(vcombine_f32(tmp, vdup_n_f32(0))); + float32x2_t tmp = vcvt_f32_f64(vreinterpretq_f64_m128d(a)); + return vreinterpretq_m128_f32(vcombine_f32(tmp, vdup_n_f32(0))); #else - float a0 = (float) ((double *) &a)[0]; - float a1 = (float) ((double *) &a)[1]; - return _mm_set_ps(0, 0, a1, a0); + float a0 = (float)((double*)&a)[0]; + float a1 = (float)((double*)&a)[1]; + return _mm_set_ps(0, 0, a1, a0); #endif } @@ -3995,12 +4007,12 @@ FORCE_INLINE __m128 _mm_cvtpd_ps(__m128d a) FORCE_INLINE __m128d _mm_cvtpi32_pd(__m64 a) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vcvtq_f64_s64(vmovl_s32(vreinterpret_s32_m64(a)))); + return vreinterpretq_m128d_f64( + vcvtq_f64_s64(vmovl_s32(vreinterpret_s32_m64(a)))); #else - double a0 = (double) vget_lane_s32(vreinterpret_s32_m64(a), 0); - double a1 = (double) vget_lane_s32(vreinterpret_s32_m64(a), 1); - return _mm_set_pd(a1, a0); + double a0 = (double)vget_lane_s32(vreinterpret_s32_m64(a), 0); + double a1 = (double)vget_lane_s32(vreinterpret_s32_m64(a), 1); + return _mm_set_pd(a1, a0); #endif } @@ -4018,49 +4030,52 @@ FORCE_INLINE __m128d _mm_cvtpi32_pd(__m64 a) FORCE_INLINE __m128i _mm_cvtps_epi32(__m128 a) { #if defined(__aarch64__) - switch (_MM_GET_ROUNDING_MODE()) { - case _MM_ROUND_NEAREST: - return vreinterpretq_m128i_s32(vcvtnq_s32_f32(a)); - case _MM_ROUND_DOWN: - return vreinterpretq_m128i_s32(vcvtmq_s32_f32(a)); - case _MM_ROUND_UP: - return vreinterpretq_m128i_s32(vcvtpq_s32_f32(a)); - default: // _MM_ROUND_TOWARD_ZERO - return vreinterpretq_m128i_s32(vcvtq_s32_f32(a)); - } + switch (_MM_GET_ROUNDING_MODE()) + { + case _MM_ROUND_NEAREST: + return vreinterpretq_m128i_s32(vcvtnq_s32_f32(a)); + case _MM_ROUND_DOWN: + return vreinterpretq_m128i_s32(vcvtmq_s32_f32(a)); + case _MM_ROUND_UP: + return vreinterpretq_m128i_s32(vcvtpq_s32_f32(a)); + default: // _MM_ROUND_TOWARD_ZERO + return vreinterpretq_m128i_s32(vcvtq_s32_f32(a)); + } #else - float *f = (float *) &a; - switch (_MM_GET_ROUNDING_MODE()) { - case _MM_ROUND_NEAREST: { - uint32x4_t signmask = vdupq_n_u32(0x80000000); - float32x4_t half = vbslq_f32(signmask, vreinterpretq_f32_m128(a), - vdupq_n_f32(0.5f)); /* +/- 0.5 */ - int32x4_t r_normal = vcvtq_s32_f32(vaddq_f32( - vreinterpretq_f32_m128(a), half)); /* round to integer: [a + 0.5]*/ - int32x4_t r_trunc = vcvtq_s32_f32( - vreinterpretq_f32_m128(a)); /* truncate to integer: [a] */ - int32x4_t plusone = vreinterpretq_s32_u32(vshrq_n_u32( - vreinterpretq_u32_s32(vnegq_s32(r_trunc)), 31)); /* 1 or 0 */ - int32x4_t r_even = vbicq_s32(vaddq_s32(r_trunc, plusone), - vdupq_n_s32(1)); /* ([a] + {0,1}) & ~1 */ - float32x4_t delta = vsubq_f32( - vreinterpretq_f32_m128(a), - vcvtq_f32_s32(r_trunc)); /* compute delta: delta = (a - [a]) */ - uint32x4_t is_delta_half = - vceqq_f32(delta, half); /* delta == +/- 0.5 */ - return vreinterpretq_m128i_s32( - vbslq_s32(is_delta_half, r_even, r_normal)); - } - case _MM_ROUND_DOWN: - return _mm_set_epi32(floorf(f[3]), floorf(f[2]), floorf(f[1]), - floorf(f[0])); - case _MM_ROUND_UP: - return _mm_set_epi32(ceilf(f[3]), ceilf(f[2]), ceilf(f[1]), - ceilf(f[0])); - default: // _MM_ROUND_TOWARD_ZERO - return _mm_set_epi32((int32_t) f[3], (int32_t) f[2], (int32_t) f[1], - (int32_t) f[0]); - } + float* f = (float*)&a; + switch (_MM_GET_ROUNDING_MODE()) + { + case _MM_ROUND_NEAREST: + { + uint32x4_t signmask = vdupq_n_u32(0x80000000); + float32x4_t half = vbslq_f32(signmask, vreinterpretq_f32_m128(a), + vdupq_n_f32(0.5f)); /* +/- 0.5 */ + int32x4_t r_normal = vcvtq_s32_f32(vaddq_f32( + vreinterpretq_f32_m128(a), half)); /* round to integer: [a + 0.5]*/ + int32x4_t r_trunc = vcvtq_s32_f32( + vreinterpretq_f32_m128(a)); /* truncate to integer: [a] */ + int32x4_t plusone = vreinterpretq_s32_u32(vshrq_n_u32( + vreinterpretq_u32_s32(vnegq_s32(r_trunc)), 31)); /* 1 or 0 */ + int32x4_t r_even = vbicq_s32(vaddq_s32(r_trunc, plusone), + vdupq_n_s32(1)); /* ([a] + {0,1}) & ~1 */ + float32x4_t delta = vsubq_f32( + vreinterpretq_f32_m128(a), + vcvtq_f32_s32(r_trunc)); /* compute delta: delta = (a - [a]) */ + uint32x4_t is_delta_half = + vceqq_f32(delta, half); /* delta == +/- 0.5 */ + return vreinterpretq_m128i_s32( + vbslq_s32(is_delta_half, r_even, r_normal)); + } + case _MM_ROUND_DOWN: + return _mm_set_epi32(floorf(f[3]), floorf(f[2]), floorf(f[1]), + floorf(f[0])); + case _MM_ROUND_UP: + return _mm_set_epi32(ceilf(f[3]), ceilf(f[2]), ceilf(f[1]), + ceilf(f[0])); + default: // _MM_ROUND_TOWARD_ZERO + return _mm_set_epi32((int32_t)f[3], (int32_t)f[2], (int32_t)f[1], + (int32_t)f[0]); + } #endif } @@ -4078,12 +4093,12 @@ FORCE_INLINE __m128i _mm_cvtps_epi32(__m128 a) FORCE_INLINE __m128d _mm_cvtps_pd(__m128 a) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vcvt_f64_f32(vget_low_f32(vreinterpretq_f32_m128(a)))); + return vreinterpretq_m128d_f64( + vcvt_f64_f32(vget_low_f32(vreinterpretq_f32_m128(a)))); #else - double a0 = (double) vgetq_lane_f32(vreinterpretq_f32_m128(a), 0); - double a1 = (double) vgetq_lane_f32(vreinterpretq_f32_m128(a), 1); - return _mm_set_pd(a1, a0); + double a0 = (double)vgetq_lane_f32(vreinterpretq_f32_m128(a), 0); + double a1 = (double)vgetq_lane_f32(vreinterpretq_f32_m128(a), 1); + return _mm_set_pd(a1, a0); #endif } @@ -4095,9 +4110,9 @@ FORCE_INLINE __m128d _mm_cvtps_pd(__m128 a) FORCE_INLINE double _mm_cvtsd_f64(__m128d a) { #if defined(__aarch64__) - return (double) vgetq_lane_f64(vreinterpretq_f64_m128d(a), 0); + return (double)vgetq_lane_f64(vreinterpretq_f64_m128d(a), 0); #else - return ((double *) &a)[0]; + return ((double*)&a)[0]; #endif } @@ -4110,11 +4125,11 @@ FORCE_INLINE double _mm_cvtsd_f64(__m128d a) FORCE_INLINE int32_t _mm_cvtsd_si32(__m128d a) { #if defined(__aarch64__) - return (int32_t) vgetq_lane_f64(vrndiq_f64(vreinterpretq_f64_m128d(a)), 0); + return (int32_t)vgetq_lane_f64(vrndiq_f64(vreinterpretq_f64_m128d(a)), 0); #else - __m128d rnd = _mm_round_pd(a, _MM_FROUND_CUR_DIRECTION); - double ret = ((double *) &rnd)[0]; - return (int32_t) ret; + __m128d rnd = _mm_round_pd(a, _MM_FROUND_CUR_DIRECTION); + double ret = ((double*)&rnd)[0]; + return (int32_t)ret; #endif } @@ -4127,11 +4142,11 @@ FORCE_INLINE int32_t _mm_cvtsd_si32(__m128d a) FORCE_INLINE int64_t _mm_cvtsd_si64(__m128d a) { #if defined(__aarch64__) - return (int64_t) vgetq_lane_f64(vrndiq_f64(vreinterpretq_f64_m128d(a)), 0); + return (int64_t)vgetq_lane_f64(vrndiq_f64(vreinterpretq_f64_m128d(a)), 0); #else - __m128d rnd = _mm_round_pd(a, _MM_FROUND_CUR_DIRECTION); - double ret = ((double *) &rnd)[0]; - return (int64_t) ret; + __m128d rnd = _mm_round_pd(a, _MM_FROUND_CUR_DIRECTION); + double ret = ((double*)&rnd)[0]; + return (int64_t)ret; #endif } @@ -4151,12 +4166,12 @@ FORCE_INLINE int64_t _mm_cvtsd_si64(__m128d a) FORCE_INLINE __m128 _mm_cvtsd_ss(__m128 a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128_f32(vsetq_lane_f32( - vget_lane_f32(vcvt_f32_f64(vreinterpretq_f64_m128d(b)), 0), - vreinterpretq_f32_m128(a), 0)); + return vreinterpretq_m128_f32(vsetq_lane_f32( + vget_lane_f32(vcvt_f32_f64(vreinterpretq_f64_m128d(b)), 0), + vreinterpretq_f32_m128(a), 0)); #else - return vreinterpretq_m128_f32(vsetq_lane_f32((float) ((double *) &b)[0], - vreinterpretq_f32_m128(a), 0)); + return vreinterpretq_m128_f32(vsetq_lane_f32((float)((double*)&b)[0], + vreinterpretq_f32_m128(a), 0)); #endif } @@ -4167,7 +4182,7 @@ FORCE_INLINE __m128 _mm_cvtsd_ss(__m128 a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtsi128_si32 FORCE_INLINE int _mm_cvtsi128_si32(__m128i a) { - return vgetq_lane_s32(vreinterpretq_s32_m128i(a), 0); + return vgetq_lane_s32(vreinterpretq_s32_m128i(a), 0); } // Copy the lower 64-bit integer in a to dst. @@ -4177,7 +4192,7 @@ FORCE_INLINE int _mm_cvtsi128_si32(__m128i a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtsi128_si64 FORCE_INLINE int64_t _mm_cvtsi128_si64(__m128i a) { - return vgetq_lane_s64(vreinterpretq_s64_m128i(a), 0); + return vgetq_lane_s64(vreinterpretq_s64_m128i(a), 0); } // Copy the lower 64-bit integer in a to dst. @@ -4191,12 +4206,12 @@ FORCE_INLINE int64_t _mm_cvtsi128_si64(__m128i a) FORCE_INLINE __m128d _mm_cvtsi32_sd(__m128d a, int32_t b) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vsetq_lane_f64((double) b, vreinterpretq_f64_m128d(a), 0)); + return vreinterpretq_m128d_f64( + vsetq_lane_f64((double)b, vreinterpretq_f64_m128d(a), 0)); #else - double bf = (double) b; - return vreinterpretq_m128d_s64( - vsetq_lane_s64(*(int64_t *) &bf, vreinterpretq_s64_m128d(a), 0)); + double bf = (double)b; + return vreinterpretq_m128d_s64( + vsetq_lane_s64(*(int64_t*)&bf, vreinterpretq_s64_m128d(a), 0)); #endif } @@ -4218,7 +4233,7 @@ FORCE_INLINE __m128d _mm_cvtsi32_sd(__m128d a, int32_t b) // https://msdn.microsoft.com/en-us/library/ct3539ha%28v=vs.90%29.aspx FORCE_INLINE __m128i _mm_cvtsi32_si128(int a) { - return vreinterpretq_m128i_s32(vsetq_lane_s32(a, vdupq_n_s32(0), 0)); + return vreinterpretq_m128i_s32(vsetq_lane_s32(a, vdupq_n_s32(0), 0)); } // Convert the signed 64-bit integer b to a double-precision (64-bit) @@ -4228,12 +4243,12 @@ FORCE_INLINE __m128i _mm_cvtsi32_si128(int a) FORCE_INLINE __m128d _mm_cvtsi64_sd(__m128d a, int64_t b) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vsetq_lane_f64((double) b, vreinterpretq_f64_m128d(a), 0)); + return vreinterpretq_m128d_f64( + vsetq_lane_f64((double)b, vreinterpretq_f64_m128d(a), 0)); #else - double bf = (double) b; - return vreinterpretq_m128d_s64( - vsetq_lane_s64(*(int64_t *) &bf, vreinterpretq_s64_m128d(a), 0)); + double bf = (double)b; + return vreinterpretq_m128d_s64( + vsetq_lane_s64(*(int64_t*)&bf, vreinterpretq_s64_m128d(a), 0)); #endif } @@ -4244,7 +4259,7 @@ FORCE_INLINE __m128d _mm_cvtsi64_sd(__m128d a, int64_t b) // r1 := 0x0 FORCE_INLINE __m128i _mm_cvtsi64_si128(int64_t a) { - return vreinterpretq_m128i_s64(vsetq_lane_s64(a, vdupq_n_s64(0), 0)); + return vreinterpretq_m128i_s64(vsetq_lane_s64(a, vdupq_n_s64(0), 0)); } // Copy 64-bit integer a to the lower element of dst, and zero the upper @@ -4269,13 +4284,13 @@ FORCE_INLINE __m128i _mm_cvtsi64_si128(int64_t a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtss_sd FORCE_INLINE __m128d _mm_cvtss_sd(__m128d a, __m128 b) { - double d = (double) vgetq_lane_f32(vreinterpretq_f32_m128(b), 0); + double d = (double)vgetq_lane_f32(vreinterpretq_f32_m128(b), 0); #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vsetq_lane_f64(d, vreinterpretq_f64_m128d(a), 0)); + return vreinterpretq_m128d_f64( + vsetq_lane_f64(d, vreinterpretq_f64_m128d(a), 0)); #else - return vreinterpretq_m128d_s64( - vsetq_lane_s64(*(int64_t *) &d, vreinterpretq_s64_m128d(a), 0)); + return vreinterpretq_m128d_s64( + vsetq_lane_s64(*(int64_t*)&d, vreinterpretq_s64_m128d(a), 0)); #endif } @@ -4284,9 +4299,9 @@ FORCE_INLINE __m128d _mm_cvtss_sd(__m128d a, __m128 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvttpd_epi32 FORCE_INLINE __m128i _mm_cvttpd_epi32(__m128d a) { - double a0 = ((double *) &a)[0]; - double a1 = ((double *) &a)[1]; - return _mm_set_epi32(0, 0, (int32_t) a1, (int32_t) a0); + double a0 = ((double*)&a)[0]; + double a1 = ((double*)&a)[1]; + return _mm_set_epi32(0, 0, (int32_t)a1, (int32_t)a0); } // Convert packed double-precision (64-bit) floating-point elements in a to @@ -4294,10 +4309,10 @@ FORCE_INLINE __m128i _mm_cvttpd_epi32(__m128d a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvttpd_pi32 FORCE_INLINE __m64 _mm_cvttpd_pi32(__m128d a) { - double a0 = ((double *) &a)[0]; - double a1 = ((double *) &a)[1]; - int32_t ALIGN_STRUCT(16) data[2] = {(int32_t) a0, (int32_t) a1}; - return vreinterpret_m64_s32(vld1_s32(data)); + double a0 = ((double*)&a)[0]; + double a1 = ((double*)&a)[1]; + int32_t ALIGN_STRUCT(16) data[2] = {(int32_t)a0, (int32_t)a1}; + return vreinterpret_m64_s32(vld1_s32(data)); } // Converts the four single-precision, floating-point values of a to signed @@ -4305,7 +4320,7 @@ FORCE_INLINE __m64 _mm_cvttpd_pi32(__m128d a) // https://msdn.microsoft.com/en-us/library/vstudio/1h005y6x(v=vs.100).aspx FORCE_INLINE __m128i _mm_cvttps_epi32(__m128 a) { - return vreinterpretq_m128i_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a))); + return vreinterpretq_m128i_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a))); } // Convert the lower double-precision (64-bit) floating-point element in a to a @@ -4316,8 +4331,8 @@ FORCE_INLINE __m128i _mm_cvttps_epi32(__m128 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvttsd_si32 FORCE_INLINE int32_t _mm_cvttsd_si32(__m128d a) { - double ret = *((double *) &a); - return (int32_t) ret; + double ret = *((double*)&a); + return (int32_t)ret; } // Convert the lower double-precision (64-bit) floating-point element in a to a @@ -4329,10 +4344,10 @@ FORCE_INLINE int32_t _mm_cvttsd_si32(__m128d a) FORCE_INLINE int64_t _mm_cvttsd_si64(__m128d a) { #if defined(__aarch64__) - return vgetq_lane_s64(vcvtq_s64_f64(vreinterpretq_f64_m128d(a)), 0); + return vgetq_lane_s64(vcvtq_s64_f64(vreinterpretq_f64_m128d(a)), 0); #else - double ret = *((double *) &a); - return (int64_t) ret; + double ret = *((double*)&a); + return (int64_t)ret; #endif } @@ -4356,15 +4371,15 @@ FORCE_INLINE int64_t _mm_cvttsd_si64(__m128d a) FORCE_INLINE __m128d _mm_div_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vdivq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_f64( + vdivq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #else - double *da = (double *) &a; - double *db = (double *) &b; - double c[2]; - c[0] = da[0] / db[0]; - c[1] = da[1] / db[1]; - return vld1q_f32((float32_t *) c); + double* da = (double*)&a; + double* db = (double*)&b; + double c[2]; + c[0] = da[0] / db[0]; + c[1] = da[1] / db[1]; + return vld1q_f32((float32_t*)c); #endif } @@ -4376,12 +4391,12 @@ FORCE_INLINE __m128d _mm_div_pd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_div_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - float64x2_t tmp = - vdivq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)); - return vreinterpretq_m128d_f64( - vsetq_lane_f64(vgetq_lane_f64(vreinterpretq_f64_m128d(a), 1), tmp, 1)); + float64x2_t tmp = + vdivq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)); + return vreinterpretq_m128d_f64( + vsetq_lane_f64(vgetq_lane_f64(vreinterpretq_f64_m128d(a), 1), tmp, 1)); #else - return _mm_move_sd(a, _mm_div_pd(a, b)); + return _mm_move_sd(a, _mm_div_pd(a, b)); #endif } @@ -4390,7 +4405,7 @@ FORCE_INLINE __m128d _mm_div_sd(__m128d a, __m128d b) // https://msdn.microsoft.com/en-us/library/6dceta0c(v=vs.100).aspx // FORCE_INLINE int _mm_extract_epi16(__m128i a, __constrange(0,8) int imm) #define _mm_extract_epi16(a, imm) \ - vgetq_lane_u16(vreinterpretq_u16_m128i(a), (imm)) + vgetq_lane_u16(vreinterpretq_u16_m128i(a), (imm)) // Inserts the least significant 16 bits of b into the selected 16-bit integer // of a. @@ -4398,10 +4413,10 @@ FORCE_INLINE __m128d _mm_div_sd(__m128d a, __m128d b) // FORCE_INLINE __m128i _mm_insert_epi16(__m128i a, int b, // __constrange(0,8) int imm) #define _mm_insert_epi16(a, b, imm) \ - __extension__({ \ - vreinterpretq_m128i_s16( \ - vsetq_lane_s16((b), vreinterpretq_s16_m128i(a), (imm))); \ - }) + __extension__({ \ + vreinterpretq_m128i_s16( \ + vsetq_lane_s16((b), vreinterpretq_s16_m128i(a), (imm))); \ + }) // Loads two double-precision from 16-byte aligned memory, floating-point // values. @@ -4409,14 +4424,14 @@ FORCE_INLINE __m128d _mm_div_sd(__m128d a, __m128d b) // dst[127:0] := MEM[mem_addr+127:mem_addr] // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_load_pd -FORCE_INLINE __m128d _mm_load_pd(const double *p) +FORCE_INLINE __m128d _mm_load_pd(const double* p) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64(vld1q_f64(p)); + return vreinterpretq_m128d_f64(vld1q_f64(p)); #else - const float *fp = (const float *) p; - float ALIGN_STRUCT(16) data[4] = {fp[0], fp[1], fp[2], fp[3]}; - return vreinterpretq_m128d_f32(vld1q_f32(data)); + const float* fp = (const float*)p; + float ALIGN_STRUCT(16) data[4] = {fp[0], fp[1], fp[2], fp[3]}; + return vreinterpretq_m128d_f32(vld1q_f32(data)); #endif } @@ -4437,22 +4452,22 @@ FORCE_INLINE __m128d _mm_load_pd(const double *p) // dst[127:64] := 0 // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_load_sd -FORCE_INLINE __m128d _mm_load_sd(const double *p) +FORCE_INLINE __m128d _mm_load_sd(const double* p) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64(vsetq_lane_f64(*p, vdupq_n_f64(0), 0)); + return vreinterpretq_m128d_f64(vsetq_lane_f64(*p, vdupq_n_f64(0), 0)); #else - const float *fp = (const float *) p; - float ALIGN_STRUCT(16) data[4] = {fp[0], fp[1], 0, 0}; - return vreinterpretq_m128d_f32(vld1q_f32(data)); + const float* fp = (const float*)p; + float ALIGN_STRUCT(16) data[4] = {fp[0], fp[1], 0, 0}; + return vreinterpretq_m128d_f32(vld1q_f32(data)); #endif } // Loads 128-bit value. : // https://msdn.microsoft.com/en-us/library/atzzad1h(v=vs.80).aspx -FORCE_INLINE __m128i _mm_load_si128(const __m128i *p) +FORCE_INLINE __m128i _mm_load_si128(const __m128i* p) { - return vreinterpretq_m128i_s32(vld1q_s32((const int32_t *) p)); + return vreinterpretq_m128i_s32(vld1q_s32((const int32_t*)p)); } // Load a double-precision (64-bit) floating-point element from memory into both @@ -4462,12 +4477,12 @@ FORCE_INLINE __m128i _mm_load_si128(const __m128i *p) // dst[127:64] := MEM[mem_addr+63:mem_addr] // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_load1_pd -FORCE_INLINE __m128d _mm_load1_pd(const double *p) +FORCE_INLINE __m128d _mm_load1_pd(const double* p) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64(vld1q_dup_f64(p)); + return vreinterpretq_m128d_f64(vld1q_dup_f64(p)); #else - return vreinterpretq_m128d_s64(vdupq_n_s64(*(const int64_t *) p)); + return vreinterpretq_m128d_s64(vdupq_n_s64(*(const int64_t*)p)); #endif } @@ -4479,26 +4494,26 @@ FORCE_INLINE __m128d _mm_load1_pd(const double *p) // dst[127:64] := MEM[mem_addr+63:mem_addr] // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadh_pd -FORCE_INLINE __m128d _mm_loadh_pd(__m128d a, const double *p) +FORCE_INLINE __m128d _mm_loadh_pd(__m128d a, const double* p) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vcombine_f64(vget_low_f64(vreinterpretq_f64_m128d(a)), vld1_f64(p))); + return vreinterpretq_m128d_f64( + vcombine_f64(vget_low_f64(vreinterpretq_f64_m128d(a)), vld1_f64(p))); #else - return vreinterpretq_m128d_f32(vcombine_f32( - vget_low_f32(vreinterpretq_f32_m128d(a)), vld1_f32((const float *) p))); + return vreinterpretq_m128d_f32(vcombine_f32( + vget_low_f32(vreinterpretq_f32_m128d(a)), vld1_f32((const float*)p))); #endif } // Load 64-bit integer from memory into the first element of dst. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadl_epi64 -FORCE_INLINE __m128i _mm_loadl_epi64(__m128i const *p) +FORCE_INLINE __m128i _mm_loadl_epi64(__m128i const* p) { - /* Load the lower 64 bits of the value pointed to by p into the - * lower 64 bits of the result, zeroing the upper 64 bits of the result. - */ - return vreinterpretq_m128i_s32( - vcombine_s32(vld1_s32((int32_t const *) p), vcreate_s32(0))); + /* Load the lower 64 bits of the value pointed to by p into the + * lower 64 bits of the result, zeroing the upper 64 bits of the result. + */ + return vreinterpretq_m128i_s32( + vcombine_s32(vld1_s32((int32_t const*)p), vcreate_s32(0))); } // Load a double-precision (64-bit) floating-point element from memory into the @@ -4509,15 +4524,15 @@ FORCE_INLINE __m128i _mm_loadl_epi64(__m128i const *p) // dst[127:64] := a[127:64] // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadl_pd -FORCE_INLINE __m128d _mm_loadl_pd(__m128d a, const double *p) +FORCE_INLINE __m128d _mm_loadl_pd(__m128d a, const double* p) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vcombine_f64(vld1_f64(p), vget_high_f64(vreinterpretq_f64_m128d(a)))); + return vreinterpretq_m128d_f64( + vcombine_f64(vld1_f64(p), vget_high_f64(vreinterpretq_f64_m128d(a)))); #else - return vreinterpretq_m128d_f32( - vcombine_f32(vld1_f32((const float *) p), - vget_high_f32(vreinterpretq_f32_m128d(a)))); + return vreinterpretq_m128d_f32( + vcombine_f32(vld1_f32((const float*)p), + vget_high_f32(vreinterpretq_f32_m128d(a)))); #endif } @@ -4529,29 +4544,29 @@ FORCE_INLINE __m128d _mm_loadl_pd(__m128d a, const double *p) // dst[127:64] := MEM[mem_addr+63:mem_addr] // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadr_pd -FORCE_INLINE __m128d _mm_loadr_pd(const double *p) +FORCE_INLINE __m128d _mm_loadr_pd(const double* p) { #if defined(__aarch64__) - float64x2_t v = vld1q_f64(p); - return vreinterpretq_m128d_f64(vextq_f64(v, v, 1)); + float64x2_t v = vld1q_f64(p); + return vreinterpretq_m128d_f64(vextq_f64(v, v, 1)); #else - int64x2_t v = vld1q_s64((const int64_t *) p); - return vreinterpretq_m128d_s64(vextq_s64(v, v, 1)); + int64x2_t v = vld1q_s64((const int64_t*)p); + return vreinterpretq_m128d_s64(vextq_s64(v, v, 1)); #endif } // Loads two double-precision from unaligned memory, floating-point values. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadu_pd -FORCE_INLINE __m128d _mm_loadu_pd(const double *p) +FORCE_INLINE __m128d _mm_loadu_pd(const double* p) { - return _mm_load_pd(p); + return _mm_load_pd(p); } // Loads 128-bit value. : // https://msdn.microsoft.com/zh-cn/library/f4k12ae8(v=vs.90).aspx -FORCE_INLINE __m128i _mm_loadu_si128(const __m128i *p) +FORCE_INLINE __m128i _mm_loadu_si128(const __m128i* p) { - return vreinterpretq_m128i_s32(vld1q_s32((const int32_t *) p)); + return vreinterpretq_m128i_s32(vld1q_s32((const int32_t*)p)); } // Load unaligned 32-bit integer from memory into the first element of dst. @@ -4560,10 +4575,10 @@ FORCE_INLINE __m128i _mm_loadu_si128(const __m128i *p) // dst[MAX:32] := 0 // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadu_si32 -FORCE_INLINE __m128i _mm_loadu_si32(const void *p) +FORCE_INLINE __m128i _mm_loadu_si32(const void* p) { - return vreinterpretq_m128i_s32( - vsetq_lane_s32(*(const int32_t *) p, vdupq_n_s32(0), 0)); + return vreinterpretq_m128i_s32( + vsetq_lane_s32(*(const int32_t*)p, vdupq_n_s32(0), 0)); } // Multiplies the 8 signed 16-bit integers from a by the 8 signed 16-bit @@ -4576,15 +4591,15 @@ FORCE_INLINE __m128i _mm_loadu_si32(const void *p) // https://msdn.microsoft.com/en-us/library/yht36sa6(v=vs.90).aspx FORCE_INLINE __m128i _mm_madd_epi16(__m128i a, __m128i b) { - int32x4_t low = vmull_s16(vget_low_s16(vreinterpretq_s16_m128i(a)), - vget_low_s16(vreinterpretq_s16_m128i(b))); - int32x4_t high = vmull_s16(vget_high_s16(vreinterpretq_s16_m128i(a)), - vget_high_s16(vreinterpretq_s16_m128i(b))); + int32x4_t low = vmull_s16(vget_low_s16(vreinterpretq_s16_m128i(a)), + vget_low_s16(vreinterpretq_s16_m128i(b))); + int32x4_t high = vmull_s16(vget_high_s16(vreinterpretq_s16_m128i(a)), + vget_high_s16(vreinterpretq_s16_m128i(b))); - int32x2_t low_sum = vpadd_s32(vget_low_s32(low), vget_high_s32(low)); - int32x2_t high_sum = vpadd_s32(vget_low_s32(high), vget_high_s32(high)); + int32x2_t low_sum = vpadd_s32(vget_low_s32(low), vget_high_s32(low)); + int32x2_t high_sum = vpadd_s32(vget_low_s32(high), vget_high_s32(high)); - return vreinterpretq_m128i_s32(vcombine_s32(low_sum, high_sum)); + return vreinterpretq_m128i_s32(vcombine_s32(low_sum, high_sum)); } // Conditionally store 8-bit integer elements from a into memory using mask @@ -4592,14 +4607,14 @@ FORCE_INLINE __m128i _mm_madd_epi16(__m128i a, __m128i b) // element) and a non-temporal memory hint. mem_addr does not need to be aligned // on any particular boundary. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_maskmoveu_si128 -FORCE_INLINE void _mm_maskmoveu_si128(__m128i a, __m128i mask, char *mem_addr) +FORCE_INLINE void _mm_maskmoveu_si128(__m128i a, __m128i mask, char* mem_addr) { - int8x16_t shr_mask = vshrq_n_s8(vreinterpretq_s8_m128i(mask), 7); - __m128 b = _mm_load_ps((const float *) mem_addr); - int8x16_t masked = - vbslq_s8(vreinterpretq_u8_s8(shr_mask), vreinterpretq_s8_m128i(a), - vreinterpretq_s8_m128(b)); - vst1q_s8((int8_t *) mem_addr, masked); + int8x16_t shr_mask = vshrq_n_s8(vreinterpretq_s8_m128i(mask), 7); + __m128 b = _mm_load_ps((const float*)mem_addr); + int8x16_t masked = + vbslq_s8(vreinterpretq_u8_s8(shr_mask), vreinterpretq_s8_m128i(a), + vreinterpretq_s8_m128(b)); + vst1q_s8((int8_t*)mem_addr, masked); } // Computes the pairwise maxima of the 8 signed 16-bit integers from a and the 8 @@ -4607,8 +4622,8 @@ FORCE_INLINE void _mm_maskmoveu_si128(__m128i a, __m128i mask, char *mem_addr) // https://msdn.microsoft.com/en-us/LIBRary/3x060h7c(v=vs.100).aspx FORCE_INLINE __m128i _mm_max_epi16(__m128i a, __m128i b) { - return vreinterpretq_m128i_s16( - vmaxq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); + return vreinterpretq_m128i_s16( + vmaxq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); } // Computes the pairwise maxima of the 16 unsigned 8-bit integers from a and the @@ -4616,8 +4631,8 @@ FORCE_INLINE __m128i _mm_max_epi16(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/st6634za(v=vs.100).aspx FORCE_INLINE __m128i _mm_max_epu8(__m128i a, __m128i b) { - return vreinterpretq_m128i_u8( - vmaxq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b))); + return vreinterpretq_m128i_u8( + vmaxq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b))); } // Compare packed double-precision (64-bit) floating-point elements in a and b, @@ -4627,23 +4642,23 @@ FORCE_INLINE __m128d _mm_max_pd(__m128d a, __m128d b) { #if defined(__aarch64__) #if SSE2NEON_PRECISE_MINMAX - float64x2_t _a = vreinterpretq_f64_m128d(a); - float64x2_t _b = vreinterpretq_f64_m128d(b); - return vreinterpretq_m128d_f64(vbslq_f64(vcgtq_f64(_a, _b), _a, _b)); + float64x2_t _a = vreinterpretq_f64_m128d(a); + float64x2_t _b = vreinterpretq_f64_m128d(b); + return vreinterpretq_m128d_f64(vbslq_f64(vcgtq_f64(_a, _b), _a, _b)); #else - return vreinterpretq_m128d_f64( - vmaxq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_f64( + vmaxq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #endif #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = (*(double *) &a0) > (*(double *) &b0) ? a0 : b0; - d[1] = (*(double *) &a1) > (*(double *) &b1) ? a1 : b1; + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t b1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = (*(double*)&a0) > (*(double*)&b0) ? a0 : b0; + d[1] = (*(double*)&a1) > (*(double*)&b1) ? a1 : b1; - return vreinterpretq_m128d_u64(vld1q_u64(d)); + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -4654,12 +4669,12 @@ FORCE_INLINE __m128d _mm_max_pd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_max_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return _mm_move_sd(a, _mm_max_pd(a, b)); + return _mm_move_sd(a, _mm_max_pd(a, b)); #else - double *da = (double *) &a; - double *db = (double *) &b; - double c[2] = {da[0] > db[0] ? da[0] : db[0], da[1]}; - return vreinterpretq_m128d_f32(vld1q_f32((float32_t *) c)); + double* da = (double*)&a; + double* db = (double*)&b; + double c[2] = {da[0] > db[0] ? da[0] : db[0], da[1]}; + return vreinterpretq_m128d_f32(vld1q_f32((float32_t*)c)); #endif } @@ -4668,8 +4683,8 @@ FORCE_INLINE __m128d _mm_max_sd(__m128d a, __m128d b) // https://msdn.microsoft.com/en-us/library/vstudio/6te997ew(v=vs.100).aspx FORCE_INLINE __m128i _mm_min_epi16(__m128i a, __m128i b) { - return vreinterpretq_m128i_s16( - vminq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); + return vreinterpretq_m128i_s16( + vminq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); } // Computes the pairwise minima of the 16 unsigned 8-bit integers from a and the @@ -4677,8 +4692,8 @@ FORCE_INLINE __m128i _mm_min_epi16(__m128i a, __m128i b) // https://msdn.microsoft.com/ko-kr/library/17k8cf58(v=vs.100).aspxx FORCE_INLINE __m128i _mm_min_epu8(__m128i a, __m128i b) { - return vreinterpretq_m128i_u8( - vminq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b))); + return vreinterpretq_m128i_u8( + vminq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b))); } // Compare packed double-precision (64-bit) floating-point elements in a and b, @@ -4688,22 +4703,22 @@ FORCE_INLINE __m128d _mm_min_pd(__m128d a, __m128d b) { #if defined(__aarch64__) #if SSE2NEON_PRECISE_MINMAX - float64x2_t _a = vreinterpretq_f64_m128d(a); - float64x2_t _b = vreinterpretq_f64_m128d(b); - return vreinterpretq_m128d_f64(vbslq_f64(vcltq_f64(_a, _b), _a, _b)); + float64x2_t _a = vreinterpretq_f64_m128d(a); + float64x2_t _b = vreinterpretq_f64_m128d(b); + return vreinterpretq_m128d_f64(vbslq_f64(vcltq_f64(_a, _b), _a, _b)); #else - return vreinterpretq_m128d_f64( - vminq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_f64( + vminq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #endif #else - uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a)); - uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a)); - uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b)); - uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b)); - uint64_t d[2]; - d[0] = (*(double *) &a0) < (*(double *) &b0) ? a0 : b0; - d[1] = (*(double *) &a1) < (*(double *) &b1) ? a1 : b1; - return vreinterpretq_m128d_u64(vld1q_u64(d)); + uint64_t a0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(a)); + uint64_t a1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(a)); + uint64_t b0 = (uint64_t)vget_low_u64(vreinterpretq_u64_m128d(b)); + uint64_t b1 = (uint64_t)vget_high_u64(vreinterpretq_u64_m128d(b)); + uint64_t d[2]; + d[0] = (*(double*)&a0) < (*(double*)&b0) ? a0 : b0; + d[1] = (*(double*)&a1) < (*(double*)&b1) ? a1 : b1; + return vreinterpretq_m128d_u64(vld1q_u64(d)); #endif } @@ -4714,12 +4729,12 @@ FORCE_INLINE __m128d _mm_min_pd(__m128d a, __m128d b) FORCE_INLINE __m128d _mm_min_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return _mm_move_sd(a, _mm_min_pd(a, b)); + return _mm_move_sd(a, _mm_min_pd(a, b)); #else - double *da = (double *) &a; - double *db = (double *) &b; - double c[2] = {da[0] < db[0] ? da[0] : db[0], da[1]}; - return vreinterpretq_m128d_f32(vld1q_f32((float32_t *) c)); + double* da = (double*)&a; + double* db = (double*)&b; + double c[2] = {da[0] < db[0] ? da[0] : db[0], da[1]}; + return vreinterpretq_m128d_f32(vld1q_f32((float32_t*)c)); #endif } @@ -4732,8 +4747,8 @@ FORCE_INLINE __m128d _mm_min_sd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_move_epi64 FORCE_INLINE __m128i _mm_move_epi64(__m128i a) { - return vreinterpretq_m128i_s64( - vsetq_lane_s64(0, vreinterpretq_s64_m128i(a), 1)); + return vreinterpretq_m128i_s64( + vsetq_lane_s64(0, vreinterpretq_s64_m128i(a), 1)); } // Move the lower double-precision (64-bit) floating-point element from b to the @@ -4746,9 +4761,9 @@ FORCE_INLINE __m128i _mm_move_epi64(__m128i a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_move_sd FORCE_INLINE __m128d _mm_move_sd(__m128d a, __m128d b) { - return vreinterpretq_m128d_f32( - vcombine_f32(vget_low_f32(vreinterpretq_f32_m128d(b)), - vget_high_f32(vreinterpretq_f32_m128d(a)))); + return vreinterpretq_m128d_f32( + vcombine_f32(vget_low_f32(vreinterpretq_f32_m128d(b)), + vget_high_f32(vreinterpretq_f32_m128d(a)))); } // NEON does not provide a version of this function. @@ -4757,82 +4772,82 @@ FORCE_INLINE __m128d _mm_move_sd(__m128d a, __m128d b) // https://msdn.microsoft.com/en-us/library/vstudio/s090c8fk(v=vs.100).aspx FORCE_INLINE int _mm_movemask_epi8(__m128i a) { - // Use increasingly wide shifts+adds to collect the sign bits - // together. - // Since the widening shifts would be rather confusing to follow in little - // endian, everything will be illustrated in big endian order instead. This - // has a different result - the bits would actually be reversed on a big - // endian machine. + // Use increasingly wide shifts+adds to collect the sign bits + // together. + // Since the widening shifts would be rather confusing to follow in little + // endian, everything will be illustrated in big endian order instead. This + // has a different result - the bits would actually be reversed on a big + // endian machine. - // Starting input (only half the elements are shown): - // 89 ff 1d c0 00 10 99 33 - uint8x16_t input = vreinterpretq_u8_m128i(a); + // Starting input (only half the elements are shown): + // 89 ff 1d c0 00 10 99 33 + uint8x16_t input = vreinterpretq_u8_m128i(a); - // Shift out everything but the sign bits with an unsigned shift right. - // - // Bytes of the vector:: - // 89 ff 1d c0 00 10 99 33 - // \ \ \ \ \ \ \ \ high_bits = (uint16x4_t)(input >> 7) - // | | | | | | | | - // 01 01 00 01 00 00 01 00 - // - // Bits of first important lane(s): - // 10001001 (89) - // \______ - // | - // 00000001 (01) - uint16x8_t high_bits = vreinterpretq_u16_u8(vshrq_n_u8(input, 7)); + // Shift out everything but the sign bits with an unsigned shift right. + // + // Bytes of the vector:: + // 89 ff 1d c0 00 10 99 33 + // \ \ \ \ \ \ \ \ high_bits = (uint16x4_t)(input >> 7) + // | | | | | | | | + // 01 01 00 01 00 00 01 00 + // + // Bits of first important lane(s): + // 10001001 (89) + // \______ + // | + // 00000001 (01) + uint16x8_t high_bits = vreinterpretq_u16_u8(vshrq_n_u8(input, 7)); - // Merge the even lanes together with a 16-bit unsigned shift right + add. - // 'xx' represents garbage data which will be ignored in the final result. - // In the important bytes, the add functions like a binary OR. - // - // 01 01 00 01 00 00 01 00 - // \_ | \_ | \_ | \_ | paired16 = (uint32x4_t)(input + (input >> 7)) - // \| \| \| \| - // xx 03 xx 01 xx 00 xx 02 - // - // 00000001 00000001 (01 01) - // \_______ | - // \| - // xxxxxxxx xxxxxx11 (xx 03) - uint32x4_t paired16 = - vreinterpretq_u32_u16(vsraq_n_u16(high_bits, high_bits, 7)); + // Merge the even lanes together with a 16-bit unsigned shift right + add. + // 'xx' represents garbage data which will be ignored in the final result. + // In the important bytes, the add functions like a binary OR. + // + // 01 01 00 01 00 00 01 00 + // \_ | \_ | \_ | \_ | paired16 = (uint32x4_t)(input + (input >> 7)) + // \| \| \| \| + // xx 03 xx 01 xx 00 xx 02 + // + // 00000001 00000001 (01 01) + // \_______ | + // \| + // xxxxxxxx xxxxxx11 (xx 03) + uint32x4_t paired16 = + vreinterpretq_u32_u16(vsraq_n_u16(high_bits, high_bits, 7)); - // Repeat with a wider 32-bit shift + add. - // xx 03 xx 01 xx 00 xx 02 - // \____ | \____ | paired32 = (uint64x1_t)(paired16 + (paired16 >> - // 14)) - // \| \| - // xx xx xx 0d xx xx xx 02 - // - // 00000011 00000001 (03 01) - // \\_____ || - // '----.\|| - // xxxxxxxx xxxx1101 (xx 0d) - uint64x2_t paired32 = - vreinterpretq_u64_u32(vsraq_n_u32(paired16, paired16, 14)); + // Repeat with a wider 32-bit shift + add. + // xx 03 xx 01 xx 00 xx 02 + // \____ | \____ | paired32 = (uint64x1_t)(paired16 + (paired16 >> + // 14)) + // \| \| + // xx xx xx 0d xx xx xx 02 + // + // 00000011 00000001 (03 01) + // \\_____ || + // '----.\|| + // xxxxxxxx xxxx1101 (xx 0d) + uint64x2_t paired32 = + vreinterpretq_u64_u32(vsraq_n_u32(paired16, paired16, 14)); - // Last, an even wider 64-bit shift + add to get our result in the low 8 bit - // lanes. xx xx xx 0d xx xx xx 02 - // \_________ | paired64 = (uint8x8_t)(paired32 + (paired32 >> - // 28)) - // \| - // xx xx xx xx xx xx xx d2 - // - // 00001101 00000010 (0d 02) - // \ \___ | | - // '---. \| | - // xxxxxxxx 11010010 (xx d2) - uint8x16_t paired64 = - vreinterpretq_u8_u64(vsraq_n_u64(paired32, paired32, 28)); + // Last, an even wider 64-bit shift + add to get our result in the low 8 bit + // lanes. xx xx xx 0d xx xx xx 02 + // \_________ | paired64 = (uint8x8_t)(paired32 + (paired32 >> + // 28)) + // \| + // xx xx xx xx xx xx xx d2 + // + // 00001101 00000010 (0d 02) + // \ \___ | | + // '---. \| | + // xxxxxxxx 11010010 (xx d2) + uint8x16_t paired64 = + vreinterpretq_u8_u64(vsraq_n_u64(paired32, paired32, 28)); - // Extract the low 8 bits from each 64-bit lane with 2 8-bit extracts. - // xx xx xx xx xx xx xx d2 - // || return paired64[0] - // d2 - // Note: Little endian would return the correct value 4b (01001011) instead. - return vgetq_lane_u8(paired64, 0) | ((int) vgetq_lane_u8(paired64, 8) << 8); + // Extract the low 8 bits from each 64-bit lane with 2 8-bit extracts. + // xx xx xx xx xx xx xx d2 + // || return paired64[0] + // d2 + // Note: Little endian would return the correct value 4b (01001011) instead. + return vgetq_lane_u8(paired64, 0) | ((int)vgetq_lane_u8(paired64, 8) << 8); } // Set each bit of mask dst based on the most significant bit of the @@ -4840,9 +4855,9 @@ FORCE_INLINE int _mm_movemask_epi8(__m128i a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_movemask_pd FORCE_INLINE int _mm_movemask_pd(__m128d a) { - uint64x2_t input = vreinterpretq_u64_m128d(a); - uint64x2_t high_bits = vshrq_n_u64(input, 63); - return vgetq_lane_u64(high_bits, 0) | (vgetq_lane_u64(high_bits, 1) << 1); + uint64x2_t input = vreinterpretq_u64_m128d(a); + uint64x2_t high_bits = vshrq_n_u64(input, 63); + return vgetq_lane_u64(high_bits, 0) | (vgetq_lane_u64(high_bits, 1) << 1); } // Copy the lower 64-bit integer in a to dst. @@ -4852,7 +4867,7 @@ FORCE_INLINE int _mm_movemask_pd(__m128d a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_movepi64_pi64 FORCE_INLINE __m64 _mm_movepi64_pi64(__m128i a) { - return vreinterpret_m64_s64(vget_low_s64(vreinterpretq_s64_m128i(a))); + return vreinterpret_m64_s64(vget_low_s64(vreinterpretq_s64_m128i(a))); } // Copy the 64-bit integer a to the lower element of dst, and zero the upper @@ -4864,8 +4879,8 @@ FORCE_INLINE __m64 _mm_movepi64_pi64(__m128i a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_movpi64_epi64 FORCE_INLINE __m128i _mm_movpi64_epi64(__m64 a) { - return vreinterpretq_m128i_s64( - vcombine_s64(vreinterpret_s64_m64(a), vdup_n_s64(0))); + return vreinterpretq_m128i_s64( + vcombine_s64(vreinterpret_s64_m64(a), vdup_n_s64(0))); } // Multiply the low unsigned 32-bit integers from each packed 64-bit element in @@ -4875,10 +4890,10 @@ FORCE_INLINE __m128i _mm_movpi64_epi64(__m64 a) // r1 := (a2 & 0xFFFFFFFF) * (b2 & 0xFFFFFFFF) FORCE_INLINE __m128i _mm_mul_epu32(__m128i a, __m128i b) { - // vmull_u32 upcasts instead of masking, so we downcast. - uint32x2_t a_lo = vmovn_u64(vreinterpretq_u64_m128i(a)); - uint32x2_t b_lo = vmovn_u64(vreinterpretq_u64_m128i(b)); - return vreinterpretq_m128i_u64(vmull_u32(a_lo, b_lo)); + // vmull_u32 upcasts instead of masking, so we downcast. + uint32x2_t a_lo = vmovn_u64(vreinterpretq_u64_m128i(a)); + uint32x2_t b_lo = vmovn_u64(vreinterpretq_u64_m128i(b)); + return vreinterpretq_m128i_u64(vmull_u32(a_lo, b_lo)); } // Multiply packed double-precision (64-bit) floating-point elements in a and b, @@ -4887,15 +4902,15 @@ FORCE_INLINE __m128i _mm_mul_epu32(__m128i a, __m128i b) FORCE_INLINE __m128d _mm_mul_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vmulq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_f64( + vmulq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #else - double *da = (double *) &a; - double *db = (double *) &b; - double c[2]; - c[0] = da[0] * db[0]; - c[1] = da[1] * db[1]; - return vld1q_f32((float32_t *) c); + double* da = (double*)&a; + double* db = (double*)&b; + double c[2]; + c[0] = da[0] * db[0]; + c[1] = da[1] * db[1]; + return vld1q_f32((float32_t*)c); #endif } @@ -4905,7 +4920,7 @@ FORCE_INLINE __m128d _mm_mul_pd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=mm_mul_sd FORCE_INLINE __m128d _mm_mul_sd(__m128d a, __m128d b) { - return _mm_move_sd(a, _mm_mul_pd(a, b)); + return _mm_move_sd(a, _mm_mul_pd(a, b)); } // Multiply the low unsigned 32-bit integers from a and b, and store the @@ -4916,8 +4931,8 @@ FORCE_INLINE __m128d _mm_mul_sd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mul_su32 FORCE_INLINE __m64 _mm_mul_su32(__m64 a, __m64 b) { - return vreinterpret_m64_u64(vget_low_u64( - vmull_u32(vreinterpret_u32_m64(a), vreinterpret_u32_m64(b)))); + return vreinterpret_m64_u64(vget_low_u64( + vmull_u32(vreinterpret_u32_m64(a), vreinterpret_u32_m64(b)))); } // Multiplies the 8 signed 16-bit integers from a by the 8 signed 16-bit @@ -4931,19 +4946,19 @@ FORCE_INLINE __m64 _mm_mul_su32(__m64 a, __m64 b) // https://msdn.microsoft.com/en-us/library/vstudio/59hddw1d(v=vs.100).aspx FORCE_INLINE __m128i _mm_mulhi_epi16(__m128i a, __m128i b) { - /* FIXME: issue with large values because of result saturation */ - // int16x8_t ret = vqdmulhq_s16(vreinterpretq_s16_m128i(a), - // vreinterpretq_s16_m128i(b)); /* =2*a*b */ return - // vreinterpretq_m128i_s16(vshrq_n_s16(ret, 1)); - int16x4_t a3210 = vget_low_s16(vreinterpretq_s16_m128i(a)); - int16x4_t b3210 = vget_low_s16(vreinterpretq_s16_m128i(b)); - int32x4_t ab3210 = vmull_s16(a3210, b3210); /* 3333222211110000 */ - int16x4_t a7654 = vget_high_s16(vreinterpretq_s16_m128i(a)); - int16x4_t b7654 = vget_high_s16(vreinterpretq_s16_m128i(b)); - int32x4_t ab7654 = vmull_s16(a7654, b7654); /* 7777666655554444 */ - uint16x8x2_t r = - vuzpq_u16(vreinterpretq_u16_s32(ab3210), vreinterpretq_u16_s32(ab7654)); - return vreinterpretq_m128i_u16(r.val[1]); + /* FIXME: issue with large values because of result saturation */ + // int16x8_t ret = vqdmulhq_s16(vreinterpretq_s16_m128i(a), + // vreinterpretq_s16_m128i(b)); /* =2*a*b */ return + // vreinterpretq_m128i_s16(vshrq_n_s16(ret, 1)); + int16x4_t a3210 = vget_low_s16(vreinterpretq_s16_m128i(a)); + int16x4_t b3210 = vget_low_s16(vreinterpretq_s16_m128i(b)); + int32x4_t ab3210 = vmull_s16(a3210, b3210); /* 3333222211110000 */ + int16x4_t a7654 = vget_high_s16(vreinterpretq_s16_m128i(a)); + int16x4_t b7654 = vget_high_s16(vreinterpretq_s16_m128i(b)); + int32x4_t ab7654 = vmull_s16(a7654, b7654); /* 7777666655554444 */ + uint16x8x2_t r = + vuzpq_u16(vreinterpretq_u16_s32(ab3210), vreinterpretq_u16_s32(ab7654)); + return vreinterpretq_m128i_u16(r.val[1]); } // Multiply the packed unsigned 16-bit integers in a and b, producing @@ -4952,22 +4967,22 @@ FORCE_INLINE __m128i _mm_mulhi_epi16(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mulhi_epu16 FORCE_INLINE __m128i _mm_mulhi_epu16(__m128i a, __m128i b) { - uint16x4_t a3210 = vget_low_u16(vreinterpretq_u16_m128i(a)); - uint16x4_t b3210 = vget_low_u16(vreinterpretq_u16_m128i(b)); - uint32x4_t ab3210 = vmull_u16(a3210, b3210); + uint16x4_t a3210 = vget_low_u16(vreinterpretq_u16_m128i(a)); + uint16x4_t b3210 = vget_low_u16(vreinterpretq_u16_m128i(b)); + uint32x4_t ab3210 = vmull_u16(a3210, b3210); #if defined(__aarch64__) - uint32x4_t ab7654 = - vmull_high_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b)); - uint16x8_t r = vuzp2q_u16(vreinterpretq_u16_u32(ab3210), - vreinterpretq_u16_u32(ab7654)); - return vreinterpretq_m128i_u16(r); + uint32x4_t ab7654 = + vmull_high_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b)); + uint16x8_t r = vuzp2q_u16(vreinterpretq_u16_u32(ab3210), + vreinterpretq_u16_u32(ab7654)); + return vreinterpretq_m128i_u16(r); #else - uint16x4_t a7654 = vget_high_u16(vreinterpretq_u16_m128i(a)); - uint16x4_t b7654 = vget_high_u16(vreinterpretq_u16_m128i(b)); - uint32x4_t ab7654 = vmull_u16(a7654, b7654); - uint16x8x2_t r = - vuzpq_u16(vreinterpretq_u16_u32(ab3210), vreinterpretq_u16_u32(ab7654)); - return vreinterpretq_m128i_u16(r.val[1]); + uint16x4_t a7654 = vget_high_u16(vreinterpretq_u16_m128i(a)); + uint16x4_t b7654 = vget_high_u16(vreinterpretq_u16_m128i(b)); + uint32x4_t ab7654 = vmull_u16(a7654, b7654); + uint16x8x2_t r = + vuzpq_u16(vreinterpretq_u16_u32(ab3210), vreinterpretq_u16_u32(ab7654)); + return vreinterpretq_m128i_u16(r.val[1]); #endif } @@ -4982,8 +4997,8 @@ FORCE_INLINE __m128i _mm_mulhi_epu16(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/vstudio/9ks1472s(v=vs.100).aspx FORCE_INLINE __m128i _mm_mullo_epi16(__m128i a, __m128i b) { - return vreinterpretq_m128i_s16( - vmulq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); + return vreinterpretq_m128i_s16( + vmulq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); } // Compute the bitwise OR of packed double-precision (64-bit) floating-point @@ -4991,8 +5006,8 @@ FORCE_INLINE __m128i _mm_mullo_epi16(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=mm_or_pd FORCE_INLINE __m128d _mm_or_pd(__m128d a, __m128d b) { - return vreinterpretq_m128d_s64( - vorrq_s64(vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b))); + return vreinterpretq_m128d_s64( + vorrq_s64(vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b))); } // Computes the bitwise OR of the 128-bit value in a and the 128-bit value in b. @@ -5002,8 +5017,8 @@ FORCE_INLINE __m128d _mm_or_pd(__m128d a, __m128d b) // https://msdn.microsoft.com/en-us/library/vstudio/ew8ty0db(v=vs.100).aspx FORCE_INLINE __m128i _mm_or_si128(__m128i a, __m128i b) { - return vreinterpretq_m128i_s32( - vorrq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_s32( + vorrq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); } // Packs the 16 signed 16-bit integers from a and b into 8-bit integers and @@ -5011,9 +5026,9 @@ FORCE_INLINE __m128i _mm_or_si128(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/k4y4f7w5%28v=vs.90%29.aspx FORCE_INLINE __m128i _mm_packs_epi16(__m128i a, __m128i b) { - return vreinterpretq_m128i_s8( - vcombine_s8(vqmovn_s16(vreinterpretq_s16_m128i(a)), - vqmovn_s16(vreinterpretq_s16_m128i(b)))); + return vreinterpretq_m128i_s8( + vcombine_s8(vqmovn_s16(vreinterpretq_s16_m128i(a)), + vqmovn_s16(vreinterpretq_s16_m128i(b)))); } // Packs the 8 signed 32-bit integers from a and b into signed 16-bit integers @@ -5031,9 +5046,9 @@ FORCE_INLINE __m128i _mm_packs_epi16(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/393t56f9%28v=vs.90%29.aspx FORCE_INLINE __m128i _mm_packs_epi32(__m128i a, __m128i b) { - return vreinterpretq_m128i_s16( - vcombine_s16(vqmovn_s32(vreinterpretq_s32_m128i(a)), - vqmovn_s32(vreinterpretq_s32_m128i(b)))); + return vreinterpretq_m128i_s16( + vcombine_s16(vqmovn_s32(vreinterpretq_s32_m128i(a)), + vqmovn_s32(vreinterpretq_s32_m128i(b)))); } // Packs the 16 signed 16 - bit integers from a and b into 8 - bit unsigned @@ -5051,9 +5066,9 @@ FORCE_INLINE __m128i _mm_packs_epi32(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/07ad1wx4(v=vs.100).aspx FORCE_INLINE __m128i _mm_packus_epi16(const __m128i a, const __m128i b) { - return vreinterpretq_m128i_u8( - vcombine_u8(vqmovun_s16(vreinterpretq_s16_m128i(a)), - vqmovun_s16(vreinterpretq_s16_m128i(b)))); + return vreinterpretq_m128i_u8( + vcombine_u8(vqmovun_s16(vreinterpretq_s16_m128i(a)), + vqmovun_s16(vreinterpretq_s16_m128i(b)))); } // Pause the processor. This is typically used in spin-wait loops and depending @@ -5063,7 +5078,7 @@ FORCE_INLINE __m128i _mm_packus_epi16(const __m128i a, const __m128i b) // a reasonable approximation. FORCE_INLINE void _mm_pause() { - __asm__ __volatile__("isb\n"); + __asm__ __volatile__("isb\n"); } // Compute the absolute differences of packed unsigned 8-bit integers in a and @@ -5073,31 +5088,31 @@ FORCE_INLINE void _mm_pause() // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sad_epu8 FORCE_INLINE __m128i _mm_sad_epu8(__m128i a, __m128i b) { - uint16x8_t t = vpaddlq_u8(vabdq_u8((uint8x16_t) a, (uint8x16_t) b)); - return vreinterpretq_m128i_u64(vpaddlq_u32(vpaddlq_u16(t))); + uint16x8_t t = vpaddlq_u8(vabdq_u8((uint8x16_t)a, (uint8x16_t)b)); + return vreinterpretq_m128i_u64(vpaddlq_u32(vpaddlq_u16(t))); } // Sets the 8 signed 16-bit integer values. // https://msdn.microsoft.com/en-au/library/3e0fek84(v=vs.90).aspx FORCE_INLINE __m128i _mm_set_epi16(short i7, - short i6, - short i5, - short i4, - short i3, - short i2, - short i1, - short i0) + short i6, + short i5, + short i4, + short i3, + short i2, + short i1, + short i0) { - int16_t ALIGN_STRUCT(16) data[8] = {i0, i1, i2, i3, i4, i5, i6, i7}; - return vreinterpretq_m128i_s16(vld1q_s16(data)); + int16_t ALIGN_STRUCT(16) data[8] = {i0, i1, i2, i3, i4, i5, i6, i7}; + return vreinterpretq_m128i_s16(vld1q_s16(data)); } // Sets the 4 signed 32-bit integer values. // https://msdn.microsoft.com/en-us/library/vstudio/019beekt(v=vs.100).aspx FORCE_INLINE __m128i _mm_set_epi32(int i3, int i2, int i1, int i0) { - int32_t ALIGN_STRUCT(16) data[4] = {i0, i1, i2, i3}; - return vreinterpretq_m128i_s32(vld1q_s32(data)); + int32_t ALIGN_STRUCT(16) data[4] = {i0, i1, i2, i3}; + return vreinterpretq_m128i_s32(vld1q_s32(data)); } // Returns the __m128i structure with its two 64-bit integer values @@ -5105,7 +5120,7 @@ FORCE_INLINE __m128i _mm_set_epi32(int i3, int i2, int i1, int i0) // https://msdn.microsoft.com/en-us/library/dk2sdw0h(v=vs.120).aspx FORCE_INLINE __m128i _mm_set_epi64(__m64 i1, __m64 i2) { - return _mm_set_epi64x((int64_t) i1, (int64_t) i2); + return _mm_set_epi64x((int64_t)i1, (int64_t)i2); } // Returns the __m128i structure with its two 64-bit integer values @@ -5113,35 +5128,35 @@ FORCE_INLINE __m128i _mm_set_epi64(__m64 i1, __m64 i2) // https://msdn.microsoft.com/en-us/library/dk2sdw0h(v=vs.120).aspx FORCE_INLINE __m128i _mm_set_epi64x(int64_t i1, int64_t i2) { - return vreinterpretq_m128i_s64( - vcombine_s64(vcreate_s64(i2), vcreate_s64(i1))); + return vreinterpretq_m128i_s64( + vcombine_s64(vcreate_s64(i2), vcreate_s64(i1))); } // Sets the 16 signed 8-bit integer values. // https://msdn.microsoft.com/en-us/library/x0cx8zd3(v=vs.90).aspx FORCE_INLINE __m128i _mm_set_epi8(signed char b15, - signed char b14, - signed char b13, - signed char b12, - signed char b11, - signed char b10, - signed char b9, - signed char b8, - signed char b7, - signed char b6, - signed char b5, - signed char b4, - signed char b3, - signed char b2, - signed char b1, - signed char b0) + signed char b14, + signed char b13, + signed char b12, + signed char b11, + signed char b10, + signed char b9, + signed char b8, + signed char b7, + signed char b6, + signed char b5, + signed char b4, + signed char b3, + signed char b2, + signed char b1, + signed char b0) { - int8_t ALIGN_STRUCT(16) - data[16] = {(int8_t) b0, (int8_t) b1, (int8_t) b2, (int8_t) b3, - (int8_t) b4, (int8_t) b5, (int8_t) b6, (int8_t) b7, - (int8_t) b8, (int8_t) b9, (int8_t) b10, (int8_t) b11, - (int8_t) b12, (int8_t) b13, (int8_t) b14, (int8_t) b15}; - return (__m128i) vld1q_s8(data); + int8_t ALIGN_STRUCT(16) + data[16] = {(int8_t)b0, (int8_t)b1, (int8_t)b2, (int8_t)b3, + (int8_t)b4, (int8_t)b5, (int8_t)b6, (int8_t)b7, + (int8_t)b8, (int8_t)b9, (int8_t)b10, (int8_t)b11, + (int8_t)b12, (int8_t)b13, (int8_t)b14, (int8_t)b15}; + return (__m128i)vld1q_s8(data); } // Set packed double-precision (64-bit) floating-point elements in dst with the @@ -5149,11 +5164,11 @@ FORCE_INLINE __m128i _mm_set_epi8(signed char b15, // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_pd FORCE_INLINE __m128d _mm_set_pd(double e1, double e0) { - double ALIGN_STRUCT(16) data[2] = {e0, e1}; + double ALIGN_STRUCT(16) data[2] = {e0, e1}; #if defined(__aarch64__) - return vreinterpretq_m128d_f64(vld1q_f64((float64_t *) data)); + return vreinterpretq_m128d_f64(vld1q_f64((float64_t*)data)); #else - return vreinterpretq_m128d_f32(vld1q_f32((float32_t *) data)); + return vreinterpretq_m128d_f32(vld1q_f32((float32_t*)data)); #endif } @@ -5167,7 +5182,7 @@ FORCE_INLINE __m128d _mm_set_pd(double e1, double e0) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_sd FORCE_INLINE __m128d _mm_set_sd(double a) { - return _mm_set_pd(0, a); + return _mm_set_pd(0, a); } // Sets the 8 signed 16-bit integer values to w. @@ -5180,7 +5195,7 @@ FORCE_INLINE __m128d _mm_set_sd(double a) // https://msdn.microsoft.com/en-us/library/k0ya3x0e(v=vs.90).aspx FORCE_INLINE __m128i _mm_set1_epi16(short w) { - return vreinterpretq_m128i_s16(vdupq_n_s16(w)); + return vreinterpretq_m128i_s16(vdupq_n_s16(w)); } // Sets the 4 signed 32-bit integer values to i. @@ -5193,21 +5208,21 @@ FORCE_INLINE __m128i _mm_set1_epi16(short w) // https://msdn.microsoft.com/en-us/library/vstudio/h4xscxat(v=vs.100).aspx FORCE_INLINE __m128i _mm_set1_epi32(int _i) { - return vreinterpretq_m128i_s32(vdupq_n_s32(_i)); + return vreinterpretq_m128i_s32(vdupq_n_s32(_i)); } // Sets the 2 signed 64-bit integer values to i. // https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/whtfzhzk(v=vs.100) FORCE_INLINE __m128i _mm_set1_epi64(__m64 _i) { - return vreinterpretq_m128i_s64(vdupq_n_s64((int64_t) _i)); + return vreinterpretq_m128i_s64(vdupq_n_s64((int64_t)_i)); } // Sets the 2 signed 64-bit integer values to i. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi64x FORCE_INLINE __m128i _mm_set1_epi64x(int64_t _i) { - return vreinterpretq_m128i_s64(vdupq_n_s64(_i)); + return vreinterpretq_m128i_s64(vdupq_n_s64(_i)); } // Sets the 16 signed 8-bit integer values to b. @@ -5220,7 +5235,7 @@ FORCE_INLINE __m128i _mm_set1_epi64x(int64_t _i) // https://msdn.microsoft.com/en-us/library/6e14xhyf(v=vs.100).aspx FORCE_INLINE __m128i _mm_set1_epi8(signed char w) { - return vreinterpretq_m128i_s8(vdupq_n_s8(w)); + return vreinterpretq_m128i_s8(vdupq_n_s8(w)); } // Broadcast double-precision (64-bit) floating-point value a to all elements of @@ -5229,9 +5244,9 @@ FORCE_INLINE __m128i _mm_set1_epi8(signed char w) FORCE_INLINE __m128d _mm_set1_pd(double d) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64(vdupq_n_f64(d)); + return vreinterpretq_m128d_f64(vdupq_n_f64(d)); #else - return vreinterpretq_m128d_s64(vdupq_n_s64(*(int64_t *) &d)); + return vreinterpretq_m128d_s64(vdupq_n_s64(*(int64_t*)&d)); #endif } @@ -5243,58 +5258,58 @@ FORCE_INLINE __m128d _mm_set1_pd(double d) // ... // r7 := w7 FORCE_INLINE __m128i _mm_setr_epi16(short w0, - short w1, - short w2, - short w3, - short w4, - short w5, - short w6, - short w7) + short w1, + short w2, + short w3, + short w4, + short w5, + short w6, + short w7) { - int16_t ALIGN_STRUCT(16) data[8] = {w0, w1, w2, w3, w4, w5, w6, w7}; - return vreinterpretq_m128i_s16(vld1q_s16((int16_t *) data)); + int16_t ALIGN_STRUCT(16) data[8] = {w0, w1, w2, w3, w4, w5, w6, w7}; + return vreinterpretq_m128i_s16(vld1q_s16((int16_t*)data)); } // Sets the 4 signed 32-bit integer values in reverse order // https://technet.microsoft.com/en-us/library/security/27yb3ee5(v=vs.90).aspx FORCE_INLINE __m128i _mm_setr_epi32(int i3, int i2, int i1, int i0) { - int32_t ALIGN_STRUCT(16) data[4] = {i3, i2, i1, i0}; - return vreinterpretq_m128i_s32(vld1q_s32(data)); + int32_t ALIGN_STRUCT(16) data[4] = {i3, i2, i1, i0}; + return vreinterpretq_m128i_s32(vld1q_s32(data)); } // Set packed 64-bit integers in dst with the supplied values in reverse order. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_setr_epi64 FORCE_INLINE __m128i _mm_setr_epi64(__m64 e1, __m64 e0) { - return vreinterpretq_m128i_s64(vcombine_s64(e1, e0)); + return vreinterpretq_m128i_s64(vcombine_s64(e1, e0)); } // Sets the 16 signed 8-bit integer values in reverse order. // https://msdn.microsoft.com/en-us/library/2khb9c7k(v=vs.90).aspx FORCE_INLINE __m128i _mm_setr_epi8(signed char b0, - signed char b1, - signed char b2, - signed char b3, - signed char b4, - signed char b5, - signed char b6, - signed char b7, - signed char b8, - signed char b9, - signed char b10, - signed char b11, - signed char b12, - signed char b13, - signed char b14, - signed char b15) + signed char b1, + signed char b2, + signed char b3, + signed char b4, + signed char b5, + signed char b6, + signed char b7, + signed char b8, + signed char b9, + signed char b10, + signed char b11, + signed char b12, + signed char b13, + signed char b14, + signed char b15) { - int8_t ALIGN_STRUCT(16) - data[16] = {(int8_t) b0, (int8_t) b1, (int8_t) b2, (int8_t) b3, - (int8_t) b4, (int8_t) b5, (int8_t) b6, (int8_t) b7, - (int8_t) b8, (int8_t) b9, (int8_t) b10, (int8_t) b11, - (int8_t) b12, (int8_t) b13, (int8_t) b14, (int8_t) b15}; - return (__m128i) vld1q_s8(data); + int8_t ALIGN_STRUCT(16) + data[16] = {(int8_t)b0, (int8_t)b1, (int8_t)b2, (int8_t)b3, + (int8_t)b4, (int8_t)b5, (int8_t)b6, (int8_t)b7, + (int8_t)b8, (int8_t)b9, (int8_t)b10, (int8_t)b11, + (int8_t)b12, (int8_t)b13, (int8_t)b14, (int8_t)b15}; + return (__m128i)vld1q_s8(data); } // Set packed double-precision (64-bit) floating-point elements in dst with the @@ -5302,7 +5317,7 @@ FORCE_INLINE __m128i _mm_setr_epi8(signed char b0, // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_setr_pd FORCE_INLINE __m128d _mm_setr_pd(double e1, double e0) { - return _mm_set_pd(e0, e1); + return _mm_set_pd(e0, e1); } // Return vector of type __m128d with all elements set to zero. @@ -5310,9 +5325,9 @@ FORCE_INLINE __m128d _mm_setr_pd(double e1, double e0) FORCE_INLINE __m128d _mm_setzero_pd(void) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64(vdupq_n_f64(0)); + return vreinterpretq_m128d_f64(vdupq_n_f64(0)); #else - return vreinterpretq_m128d_f32(vdupq_n_f32(0)); + return vreinterpretq_m128d_f32(vdupq_n_f32(0)); #endif } @@ -5320,7 +5335,7 @@ FORCE_INLINE __m128d _mm_setzero_pd(void) // https://msdn.microsoft.com/en-us/library/vstudio/ys7dw0kh(v=vs.100).aspx FORCE_INLINE __m128i _mm_setzero_si128(void) { - return vreinterpretq_m128i_s32(vdupq_n_s32(0)); + return vreinterpretq_m128i_s32(vdupq_n_s32(0)); } // Shuffles the 4 signed or unsigned 32-bit integers in a as specified by imm. @@ -5329,66 +5344,67 @@ FORCE_INLINE __m128i _mm_setzero_si128(void) // __constrange(0,255) int imm) #if __has_builtin(__builtin_shufflevector) #define _mm_shuffle_epi32(a, imm) \ - __extension__({ \ - int32x4_t _input = vreinterpretq_s32_m128i(a); \ - int32x4_t _shuf = __builtin_shufflevector( \ - _input, _input, (imm) & (0x3), ((imm) >> 2) & 0x3, \ - ((imm) >> 4) & 0x3, ((imm) >> 6) & 0x3); \ - vreinterpretq_m128i_s32(_shuf); \ - }) -#else // generic + __extension__({ \ + int32x4_t _input = vreinterpretq_s32_m128i(a); \ + int32x4_t _shuf = __builtin_shufflevector( \ + _input, _input, (imm) & (0x3), ((imm) >> 2) & 0x3, \ + ((imm) >> 4) & 0x3, ((imm) >> 6) & 0x3); \ + vreinterpretq_m128i_s32(_shuf); \ + }) +#else // generic #define _mm_shuffle_epi32(a, imm) \ - __extension__({ \ - __m128i ret; \ - switch (imm) { \ - case _MM_SHUFFLE(1, 0, 3, 2): \ - ret = _mm_shuffle_epi_1032((a)); \ - break; \ - case _MM_SHUFFLE(2, 3, 0, 1): \ - ret = _mm_shuffle_epi_2301((a)); \ - break; \ - case _MM_SHUFFLE(0, 3, 2, 1): \ - ret = _mm_shuffle_epi_0321((a)); \ - break; \ - case _MM_SHUFFLE(2, 1, 0, 3): \ - ret = _mm_shuffle_epi_2103((a)); \ - break; \ - case _MM_SHUFFLE(1, 0, 1, 0): \ - ret = _mm_shuffle_epi_1010((a)); \ - break; \ - case _MM_SHUFFLE(1, 0, 0, 1): \ - ret = _mm_shuffle_epi_1001((a)); \ - break; \ - case _MM_SHUFFLE(0, 1, 0, 1): \ - ret = _mm_shuffle_epi_0101((a)); \ - break; \ - case _MM_SHUFFLE(2, 2, 1, 1): \ - ret = _mm_shuffle_epi_2211((a)); \ - break; \ - case _MM_SHUFFLE(0, 1, 2, 2): \ - ret = _mm_shuffle_epi_0122((a)); \ - break; \ - case _MM_SHUFFLE(3, 3, 3, 2): \ - ret = _mm_shuffle_epi_3332((a)); \ - break; \ - case _MM_SHUFFLE(0, 0, 0, 0): \ - ret = _mm_shuffle_epi32_splat((a), 0); \ - break; \ - case _MM_SHUFFLE(1, 1, 1, 1): \ - ret = _mm_shuffle_epi32_splat((a), 1); \ - break; \ - case _MM_SHUFFLE(2, 2, 2, 2): \ - ret = _mm_shuffle_epi32_splat((a), 2); \ - break; \ - case _MM_SHUFFLE(3, 3, 3, 3): \ - ret = _mm_shuffle_epi32_splat((a), 3); \ - break; \ - default: \ - ret = _mm_shuffle_epi32_default((a), (imm)); \ - break; \ - } \ - ret; \ - }) + __extension__({ \ + __m128i ret; \ + switch (imm) \ + { \ + case _MM_SHUFFLE(1, 0, 3, 2): \ + ret = _mm_shuffle_epi_1032((a)); \ + break; \ + case _MM_SHUFFLE(2, 3, 0, 1): \ + ret = _mm_shuffle_epi_2301((a)); \ + break; \ + case _MM_SHUFFLE(0, 3, 2, 1): \ + ret = _mm_shuffle_epi_0321((a)); \ + break; \ + case _MM_SHUFFLE(2, 1, 0, 3): \ + ret = _mm_shuffle_epi_2103((a)); \ + break; \ + case _MM_SHUFFLE(1, 0, 1, 0): \ + ret = _mm_shuffle_epi_1010((a)); \ + break; \ + case _MM_SHUFFLE(1, 0, 0, 1): \ + ret = _mm_shuffle_epi_1001((a)); \ + break; \ + case _MM_SHUFFLE(0, 1, 0, 1): \ + ret = _mm_shuffle_epi_0101((a)); \ + break; \ + case _MM_SHUFFLE(2, 2, 1, 1): \ + ret = _mm_shuffle_epi_2211((a)); \ + break; \ + case _MM_SHUFFLE(0, 1, 2, 2): \ + ret = _mm_shuffle_epi_0122((a)); \ + break; \ + case _MM_SHUFFLE(3, 3, 3, 2): \ + ret = _mm_shuffle_epi_3332((a)); \ + break; \ + case _MM_SHUFFLE(0, 0, 0, 0): \ + ret = _mm_shuffle_epi32_splat((a), 0); \ + break; \ + case _MM_SHUFFLE(1, 1, 1, 1): \ + ret = _mm_shuffle_epi32_splat((a), 1); \ + break; \ + case _MM_SHUFFLE(2, 2, 2, 2): \ + ret = _mm_shuffle_epi32_splat((a), 2); \ + break; \ + case _MM_SHUFFLE(3, 3, 3, 3): \ + ret = _mm_shuffle_epi32_splat((a), 3); \ + break; \ + default: \ + ret = _mm_shuffle_epi32_default((a), (imm)); \ + break; \ + } \ + ret; \ + }) #endif // Shuffle double-precision (64-bit) floating-point elements using the control @@ -5400,29 +5416,29 @@ FORCE_INLINE __m128i _mm_setzero_si128(void) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_pd #if __has_builtin(__builtin_shufflevector) #define _mm_shuffle_pd(a, b, imm8) \ - vreinterpretq_m128d_s64(__builtin_shufflevector( \ - vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b), imm8 & 0x1, \ - ((imm8 & 0x2) >> 1) + 2)) + vreinterpretq_m128d_s64(__builtin_shufflevector( \ + vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b), imm8 & 0x1, \ + ((imm8 & 0x2) >> 1) + 2)) #else #define _mm_shuffle_pd(a, b, imm8) \ - _mm_castsi128_pd(_mm_set_epi64x( \ - vgetq_lane_s64(vreinterpretq_s64_m128d(b), (imm8 & 0x2) >> 1), \ - vgetq_lane_s64(vreinterpretq_s64_m128d(a), imm8 & 0x1))) + _mm_castsi128_pd(_mm_set_epi64x( \ + vgetq_lane_s64(vreinterpretq_s64_m128d(b), (imm8 & 0x2) >> 1), \ + vgetq_lane_s64(vreinterpretq_s64_m128d(a), imm8 & 0x1))) #endif // FORCE_INLINE __m128i _mm_shufflehi_epi16(__m128i a, // __constrange(0,255) int imm) #if __has_builtin(__builtin_shufflevector) #define _mm_shufflehi_epi16(a, imm) \ - __extension__({ \ - int16x8_t _input = vreinterpretq_s16_m128i(a); \ - int16x8_t _shuf = __builtin_shufflevector( \ - _input, _input, 0, 1, 2, 3, ((imm) & (0x3)) + 4, \ - (((imm) >> 2) & 0x3) + 4, (((imm) >> 4) & 0x3) + 4, \ - (((imm) >> 6) & 0x3) + 4); \ - vreinterpretq_m128i_s16(_shuf); \ - }) -#else // generic + __extension__({ \ + int16x8_t _input = vreinterpretq_s16_m128i(a); \ + int16x8_t _shuf = __builtin_shufflevector( \ + _input, _input, 0, 1, 2, 3, ((imm) & (0x3)) + 4, \ + (((imm) >> 2) & 0x3) + 4, (((imm) >> 4) & 0x3) + 4, \ + (((imm) >> 6) & 0x3) + 4); \ + vreinterpretq_m128i_s16(_shuf); \ + }) +#else // generic #define _mm_shufflehi_epi16(a, imm) _mm_shufflehi_epi16_function((a), (imm)) #endif @@ -5430,14 +5446,14 @@ FORCE_INLINE __m128i _mm_setzero_si128(void) // __constrange(0,255) int imm) #if __has_builtin(__builtin_shufflevector) #define _mm_shufflelo_epi16(a, imm) \ - __extension__({ \ - int16x8_t _input = vreinterpretq_s16_m128i(a); \ - int16x8_t _shuf = __builtin_shufflevector( \ - _input, _input, ((imm) & (0x3)), (((imm) >> 2) & 0x3), \ - (((imm) >> 4) & 0x3), (((imm) >> 6) & 0x3), 4, 5, 6, 7); \ - vreinterpretq_m128i_s16(_shuf); \ - }) -#else // generic + __extension__({ \ + int16x8_t _input = vreinterpretq_s16_m128i(a); \ + int16x8_t _shuf = __builtin_shufflevector( \ + _input, _input, ((imm) & (0x3)), (((imm) >> 2) & 0x3), \ + (((imm) >> 4) & 0x3), (((imm) >> 6) & 0x3), 4, 5, 6, 7); \ + vreinterpretq_m128i_s16(_shuf); \ + }) +#else // generic #define _mm_shufflelo_epi16(a, imm) _mm_shufflelo_epi16_function((a), (imm)) #endif @@ -5456,12 +5472,12 @@ FORCE_INLINE __m128i _mm_setzero_si128(void) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sll_epi16 FORCE_INLINE __m128i _mm_sll_epi16(__m128i a, __m128i count) { - uint64_t c = vreinterpretq_nth_u64_m128i(count, 0); - if (_sse2neon_unlikely(c & ~15)) - return _mm_setzero_si128(); + uint64_t c = vreinterpretq_nth_u64_m128i(count, 0); + if (_sse2neon_unlikely(c & ~15)) + return _mm_setzero_si128(); - int16x8_t vc = vdupq_n_s16((int16_t) c); - return vreinterpretq_m128i_s16(vshlq_s16(vreinterpretq_s16_m128i(a), vc)); + int16x8_t vc = vdupq_n_s16((int16_t)c); + return vreinterpretq_m128i_s16(vshlq_s16(vreinterpretq_s16_m128i(a), vc)); } // Shift packed 32-bit integers in a left by count while shifting in zeros, and @@ -5479,12 +5495,12 @@ FORCE_INLINE __m128i _mm_sll_epi16(__m128i a, __m128i count) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sll_epi32 FORCE_INLINE __m128i _mm_sll_epi32(__m128i a, __m128i count) { - uint64_t c = vreinterpretq_nth_u64_m128i(count, 0); - if (_sse2neon_unlikely(c & ~31)) - return _mm_setzero_si128(); + uint64_t c = vreinterpretq_nth_u64_m128i(count, 0); + if (_sse2neon_unlikely(c & ~31)) + return _mm_setzero_si128(); - int32x4_t vc = vdupq_n_s32((int32_t) c); - return vreinterpretq_m128i_s32(vshlq_s32(vreinterpretq_s32_m128i(a), vc)); + int32x4_t vc = vdupq_n_s32((int32_t)c); + return vreinterpretq_m128i_s32(vshlq_s32(vreinterpretq_s32_m128i(a), vc)); } // Shift packed 64-bit integers in a left by count while shifting in zeros, and @@ -5502,12 +5518,12 @@ FORCE_INLINE __m128i _mm_sll_epi32(__m128i a, __m128i count) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sll_epi64 FORCE_INLINE __m128i _mm_sll_epi64(__m128i a, __m128i count) { - uint64_t c = vreinterpretq_nth_u64_m128i(count, 0); - if (_sse2neon_unlikely(c & ~63)) - return _mm_setzero_si128(); + uint64_t c = vreinterpretq_nth_u64_m128i(count, 0); + if (_sse2neon_unlikely(c & ~63)) + return _mm_setzero_si128(); - int64x2_t vc = vdupq_n_s64((int64_t) c); - return vreinterpretq_m128i_s64(vshlq_s64(vreinterpretq_s64_m128i(a), vc)); + int64x2_t vc = vdupq_n_s64((int64_t)c); + return vreinterpretq_m128i_s64(vshlq_s64(vreinterpretq_s64_m128i(a), vc)); } // Shift packed 16-bit integers in a left by imm8 while shifting in zeros, and @@ -5525,10 +5541,10 @@ FORCE_INLINE __m128i _mm_sll_epi64(__m128i a, __m128i count) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_slli_epi16 FORCE_INLINE __m128i _mm_slli_epi16(__m128i a, int imm) { - if (_sse2neon_unlikely(imm & ~15)) - return _mm_setzero_si128(); - return vreinterpretq_m128i_s16( - vshlq_s16(vreinterpretq_s16_m128i(a), vdupq_n_s16(imm))); + if (_sse2neon_unlikely(imm & ~15)) + return _mm_setzero_si128(); + return vreinterpretq_m128i_s16( + vshlq_s16(vreinterpretq_s16_m128i(a), vdupq_n_s16(imm))); } // Shift packed 32-bit integers in a left by imm8 while shifting in zeros, and @@ -5546,10 +5562,10 @@ FORCE_INLINE __m128i _mm_slli_epi16(__m128i a, int imm) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_slli_epi32 FORCE_INLINE __m128i _mm_slli_epi32(__m128i a, int imm) { - if (_sse2neon_unlikely(imm & ~31)) - return _mm_setzero_si128(); - return vreinterpretq_m128i_s32( - vshlq_s32(vreinterpretq_s32_m128i(a), vdupq_n_s32(imm))); + if (_sse2neon_unlikely(imm & ~31)) + return _mm_setzero_si128(); + return vreinterpretq_m128i_s32( + vshlq_s32(vreinterpretq_s32_m128i(a), vdupq_n_s32(imm))); } // Shift packed 64-bit integers in a left by imm8 while shifting in zeros, and @@ -5567,10 +5583,10 @@ FORCE_INLINE __m128i _mm_slli_epi32(__m128i a, int imm) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_slli_epi64 FORCE_INLINE __m128i _mm_slli_epi64(__m128i a, int imm) { - if (_sse2neon_unlikely(imm & ~63)) - return _mm_setzero_si128(); - return vreinterpretq_m128i_s64( - vshlq_s64(vreinterpretq_s64_m128i(a), vdupq_n_s64(imm))); + if (_sse2neon_unlikely(imm & ~63)) + return _mm_setzero_si128(); + return vreinterpretq_m128i_s64( + vshlq_s64(vreinterpretq_s64_m128i(a), vdupq_n_s64(imm))); } // Shift a left by imm8 bytes while shifting in zeros, and store the results in @@ -5585,11 +5601,11 @@ FORCE_INLINE __m128i _mm_slli_epi64(__m128i a, int imm) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_slli_si128 FORCE_INLINE __m128i _mm_slli_si128(__m128i a, int imm) { - if (_sse2neon_unlikely(imm & ~15)) - return _mm_setzero_si128(); - uint8x16_t tmp[2] = {vdupq_n_u8(0), vreinterpretq_u8_m128i(a)}; - return vreinterpretq_m128i_u8( - vld1q_u8(((uint8_t const *) tmp) + (16 - imm))); + if (_sse2neon_unlikely(imm & ~15)) + return _mm_setzero_si128(); + uint8x16_t tmp[2] = {vdupq_n_u8(0), vreinterpretq_u8_m128i(a)}; + return vreinterpretq_m128i_u8( + vld1q_u8(((uint8_t const*)tmp) + (16 - imm))); } // Compute the square root of packed double-precision (64-bit) floating-point @@ -5598,11 +5614,11 @@ FORCE_INLINE __m128i _mm_slli_si128(__m128i a, int imm) FORCE_INLINE __m128d _mm_sqrt_pd(__m128d a) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64(vsqrtq_f64(vreinterpretq_f64_m128d(a))); + return vreinterpretq_m128d_f64(vsqrtq_f64(vreinterpretq_f64_m128d(a))); #else - double a0 = sqrt(((double *) &a)[0]); - double a1 = sqrt(((double *) &a)[1]); - return _mm_set_pd(a1, a0); + double a0 = sqrt(((double*)&a)[0]); + double a1 = sqrt(((double*)&a)[1]); + return _mm_set_pd(a1, a0); #endif } @@ -5613,9 +5629,9 @@ FORCE_INLINE __m128d _mm_sqrt_pd(__m128d a) FORCE_INLINE __m128d _mm_sqrt_sd(__m128d a, __m128d b) { #if defined(__aarch64__) - return _mm_move_sd(a, _mm_sqrt_pd(b)); + return _mm_move_sd(a, _mm_sqrt_pd(b)); #else - return _mm_set_pd(((double *) &a)[1], sqrt(((double *) &b)[0])); + return _mm_set_pd(((double*)&a)[1], sqrt(((double*)&b)[0])); #endif } @@ -5634,10 +5650,10 @@ FORCE_INLINE __m128d _mm_sqrt_sd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sra_epi16 FORCE_INLINE __m128i _mm_sra_epi16(__m128i a, __m128i count) { - int64_t c = (int64_t) vget_low_s64((int64x2_t) count); - if (_sse2neon_unlikely(c & ~15)) - return _mm_cmplt_epi16(a, _mm_setzero_si128()); - return vreinterpretq_m128i_s16(vshlq_s16((int16x8_t) a, vdupq_n_s16(-c))); + int64_t c = (int64_t)vget_low_s64((int64x2_t)count); + if (_sse2neon_unlikely(c & ~15)) + return _mm_cmplt_epi16(a, _mm_setzero_si128()); + return vreinterpretq_m128i_s16(vshlq_s16((int16x8_t)a, vdupq_n_s16(-c))); } // Shift packed 32-bit integers in a right by count while shifting in sign bits, @@ -5655,10 +5671,10 @@ FORCE_INLINE __m128i _mm_sra_epi16(__m128i a, __m128i count) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sra_epi32 FORCE_INLINE __m128i _mm_sra_epi32(__m128i a, __m128i count) { - int64_t c = (int64_t) vget_low_s64((int64x2_t) count); - if (_sse2neon_unlikely(c & ~31)) - return _mm_cmplt_epi32(a, _mm_setzero_si128()); - return vreinterpretq_m128i_s32(vshlq_s32((int32x4_t) a, vdupq_n_s32(-c))); + int64_t c = (int64_t)vget_low_s64((int64x2_t)count); + if (_sse2neon_unlikely(c & ~31)) + return _mm_cmplt_epi32(a, _mm_setzero_si128()); + return vreinterpretq_m128i_s32(vshlq_s32((int32x4_t)a, vdupq_n_s32(-c))); } // Shift packed 16-bit integers in a right by imm8 while shifting in sign @@ -5676,8 +5692,8 @@ FORCE_INLINE __m128i _mm_sra_epi32(__m128i a, __m128i count) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srai_epi16 FORCE_INLINE __m128i _mm_srai_epi16(__m128i a, int imm) { - const int count = (imm & ~15) ? 15 : imm; - return (__m128i) vshlq_s16((int16x8_t) a, vdupq_n_s16(-count)); + const int count = (imm & ~15) ? 15 : imm; + return (__m128i)vshlq_s16((int16x8_t)a, vdupq_n_s16(-count)); } // Shift packed 32-bit integers in a right by imm8 while shifting in sign bits, @@ -5695,19 +5711,24 @@ FORCE_INLINE __m128i _mm_srai_epi16(__m128i a, int imm) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srai_epi32 // FORCE_INLINE __m128i _mm_srai_epi32(__m128i a, __constrange(0,255) int imm) #define _mm_srai_epi32(a, imm) \ - __extension__({ \ - __m128i ret; \ - if (_sse2neon_unlikely((imm) == 0)) { \ - ret = a; \ - } else if (_sse2neon_likely(0 < (imm) && (imm) < 32)) { \ - ret = vreinterpretq_m128i_s32( \ - vshlq_s32(vreinterpretq_s32_m128i(a), vdupq_n_s32(-imm))); \ - } else { \ - ret = vreinterpretq_m128i_s32( \ - vshrq_n_s32(vreinterpretq_s32_m128i(a), 31)); \ - } \ - ret; \ - }) + __extension__({ \ + __m128i ret; \ + if (_sse2neon_unlikely((imm) == 0)) \ + { \ + ret = a; \ + } \ + else if (_sse2neon_likely(0 < (imm) && (imm) < 32)) \ + { \ + ret = vreinterpretq_m128i_s32( \ + vshlq_s32(vreinterpretq_s32_m128i(a), vdupq_n_s32(-imm))); \ + } \ + else \ + { \ + ret = vreinterpretq_m128i_s32( \ + vshrq_n_s32(vreinterpretq_s32_m128i(a), 31)); \ + } \ + ret; \ + }) // Shift packed 16-bit integers in a right by count while shifting in zeros, and // store the results in dst. @@ -5724,12 +5745,12 @@ FORCE_INLINE __m128i _mm_srai_epi16(__m128i a, int imm) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srl_epi16 FORCE_INLINE __m128i _mm_srl_epi16(__m128i a, __m128i count) { - uint64_t c = vreinterpretq_nth_u64_m128i(count, 0); - if (_sse2neon_unlikely(c & ~15)) - return _mm_setzero_si128(); + uint64_t c = vreinterpretq_nth_u64_m128i(count, 0); + if (_sse2neon_unlikely(c & ~15)) + return _mm_setzero_si128(); - int16x8_t vc = vdupq_n_s16(-(int16_t) c); - return vreinterpretq_m128i_u16(vshlq_u16(vreinterpretq_u16_m128i(a), vc)); + int16x8_t vc = vdupq_n_s16(-(int16_t)c); + return vreinterpretq_m128i_u16(vshlq_u16(vreinterpretq_u16_m128i(a), vc)); } // Shift packed 32-bit integers in a right by count while shifting in zeros, and @@ -5747,12 +5768,12 @@ FORCE_INLINE __m128i _mm_srl_epi16(__m128i a, __m128i count) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srl_epi32 FORCE_INLINE __m128i _mm_srl_epi32(__m128i a, __m128i count) { - uint64_t c = vreinterpretq_nth_u64_m128i(count, 0); - if (_sse2neon_unlikely(c & ~31)) - return _mm_setzero_si128(); + uint64_t c = vreinterpretq_nth_u64_m128i(count, 0); + if (_sse2neon_unlikely(c & ~31)) + return _mm_setzero_si128(); - int32x4_t vc = vdupq_n_s32(-(int32_t) c); - return vreinterpretq_m128i_u32(vshlq_u32(vreinterpretq_u32_m128i(a), vc)); + int32x4_t vc = vdupq_n_s32(-(int32_t)c); + return vreinterpretq_m128i_u32(vshlq_u32(vreinterpretq_u32_m128i(a), vc)); } // Shift packed 64-bit integers in a right by count while shifting in zeros, and @@ -5770,12 +5791,12 @@ FORCE_INLINE __m128i _mm_srl_epi32(__m128i a, __m128i count) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srl_epi64 FORCE_INLINE __m128i _mm_srl_epi64(__m128i a, __m128i count) { - uint64_t c = vreinterpretq_nth_u64_m128i(count, 0); - if (_sse2neon_unlikely(c & ~63)) - return _mm_setzero_si128(); + uint64_t c = vreinterpretq_nth_u64_m128i(count, 0); + if (_sse2neon_unlikely(c & ~63)) + return _mm_setzero_si128(); - int64x2_t vc = vdupq_n_s64(-(int64_t) c); - return vreinterpretq_m128i_u64(vshlq_u64(vreinterpretq_u64_m128i(a), vc)); + int64x2_t vc = vdupq_n_s64(-(int64_t)c); + return vreinterpretq_m128i_u64(vshlq_u64(vreinterpretq_u64_m128i(a), vc)); } // Shift packed 16-bit integers in a right by imm8 while shifting in zeros, and @@ -5792,16 +5813,19 @@ FORCE_INLINE __m128i _mm_srl_epi64(__m128i a, __m128i count) // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srli_epi16 #define _mm_srli_epi16(a, imm) \ - __extension__({ \ - __m128i ret; \ - if (_sse2neon_unlikely((imm) & ~15)) { \ - ret = _mm_setzero_si128(); \ - } else { \ - ret = vreinterpretq_m128i_u16( \ - vshlq_u16(vreinterpretq_u16_m128i(a), vdupq_n_s16(-(imm)))); \ - } \ - ret; \ - }) + __extension__({ \ + __m128i ret; \ + if (_sse2neon_unlikely((imm) & ~15)) \ + { \ + ret = _mm_setzero_si128(); \ + } \ + else \ + { \ + ret = vreinterpretq_m128i_u16( \ + vshlq_u16(vreinterpretq_u16_m128i(a), vdupq_n_s16(-(imm)))); \ + } \ + ret; \ + }) // Shift packed 32-bit integers in a right by imm8 while shifting in zeros, and // store the results in dst. @@ -5818,16 +5842,19 @@ FORCE_INLINE __m128i _mm_srl_epi64(__m128i a, __m128i count) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srli_epi32 // FORCE_INLINE __m128i _mm_srli_epi32(__m128i a, __constrange(0,255) int imm) #define _mm_srli_epi32(a, imm) \ - __extension__({ \ - __m128i ret; \ - if (_sse2neon_unlikely((imm) & ~31)) { \ - ret = _mm_setzero_si128(); \ - } else { \ - ret = vreinterpretq_m128i_u32( \ - vshlq_u32(vreinterpretq_u32_m128i(a), vdupq_n_s32(-(imm)))); \ - } \ - ret; \ - }) + __extension__({ \ + __m128i ret; \ + if (_sse2neon_unlikely((imm) & ~31)) \ + { \ + ret = _mm_setzero_si128(); \ + } \ + else \ + { \ + ret = vreinterpretq_m128i_u32( \ + vshlq_u32(vreinterpretq_u32_m128i(a), vdupq_n_s32(-(imm)))); \ + } \ + ret; \ + }) // Shift packed 64-bit integers in a right by imm8 while shifting in zeros, and // store the results in dst. @@ -5843,16 +5870,19 @@ FORCE_INLINE __m128i _mm_srl_epi64(__m128i a, __m128i count) // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srli_epi64 #define _mm_srli_epi64(a, imm) \ - __extension__({ \ - __m128i ret; \ - if (_sse2neon_unlikely((imm) & ~63)) { \ - ret = _mm_setzero_si128(); \ - } else { \ - ret = vreinterpretq_m128i_u64( \ - vshlq_u64(vreinterpretq_u64_m128i(a), vdupq_n_s64(-(imm)))); \ - } \ - ret; \ - }) + __extension__({ \ + __m128i ret; \ + if (_sse2neon_unlikely((imm) & ~63)) \ + { \ + ret = _mm_setzero_si128(); \ + } \ + else \ + { \ + ret = vreinterpretq_m128i_u64( \ + vshlq_u64(vreinterpretq_u64_m128i(a), vdupq_n_s64(-(imm)))); \ + } \ + ret; \ + }) // Shift a right by imm8 bytes while shifting in zeros, and store the results in // dst. @@ -5866,22 +5896,22 @@ FORCE_INLINE __m128i _mm_srl_epi64(__m128i a, __m128i count) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srli_si128 FORCE_INLINE __m128i _mm_srli_si128(__m128i a, int imm) { - if (_sse2neon_unlikely(imm & ~15)) - return _mm_setzero_si128(); - uint8x16_t tmp[2] = {vreinterpretq_u8_m128i(a), vdupq_n_u8(0)}; - return vreinterpretq_m128i_u8(vld1q_u8(((uint8_t const *) tmp) + imm)); + if (_sse2neon_unlikely(imm & ~15)) + return _mm_setzero_si128(); + uint8x16_t tmp[2] = {vreinterpretq_u8_m128i(a), vdupq_n_u8(0)}; + return vreinterpretq_m128i_u8(vld1q_u8(((uint8_t const*)tmp) + imm)); } // Store 128-bits (composed of 2 packed double-precision (64-bit) floating-point // elements) from a into memory. mem_addr must be aligned on a 16-byte boundary // or a general-protection exception may be generated. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_store_pd -FORCE_INLINE void _mm_store_pd(double *mem_addr, __m128d a) +FORCE_INLINE void _mm_store_pd(double* mem_addr, __m128d a) { #if defined(__aarch64__) - vst1q_f64((float64_t *) mem_addr, vreinterpretq_f64_m128d(a)); + vst1q_f64((float64_t*)mem_addr, vreinterpretq_f64_m128d(a)); #else - vst1q_f32((float32_t *) mem_addr, vreinterpretq_f32_m128d(a)); + vst1q_f32((float32_t*)mem_addr, vreinterpretq_f32_m128d(a)); #endif } @@ -5889,36 +5919,36 @@ FORCE_INLINE void _mm_store_pd(double *mem_addr, __m128d a) // 2 contiguous elements in memory. mem_addr must be aligned on a 16-byte // boundary or a general-protection exception may be generated. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_store_pd1 -FORCE_INLINE void _mm_store_pd1(double *mem_addr, __m128d a) +FORCE_INLINE void _mm_store_pd1(double* mem_addr, __m128d a) { #if defined(__aarch64__) - float64x1_t a_low = vget_low_f64(vreinterpretq_f64_m128d(a)); - vst1q_f64((float64_t *) mem_addr, - vreinterpretq_f64_m128d(vcombine_f64(a_low, a_low))); + float64x1_t a_low = vget_low_f64(vreinterpretq_f64_m128d(a)); + vst1q_f64((float64_t*)mem_addr, + vreinterpretq_f64_m128d(vcombine_f64(a_low, a_low))); #else - float32x2_t a_low = vget_low_f32(vreinterpretq_f32_m128d(a)); - vst1q_f32((float32_t *) mem_addr, - vreinterpretq_f32_m128d(vcombine_f32(a_low, a_low))); + float32x2_t a_low = vget_low_f32(vreinterpretq_f32_m128d(a)); + vst1q_f32((float32_t*)mem_addr, + vreinterpretq_f32_m128d(vcombine_f32(a_low, a_low))); #endif } // Store the lower double-precision (64-bit) floating-point element from a into // memory. mem_addr does not need to be aligned on any particular boundary. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=mm_store_sd -FORCE_INLINE void _mm_store_sd(double *mem_addr, __m128d a) +FORCE_INLINE void _mm_store_sd(double* mem_addr, __m128d a) { #if defined(__aarch64__) - vst1_f64((float64_t *) mem_addr, vget_low_f64(vreinterpretq_f64_m128d(a))); + vst1_f64((float64_t*)mem_addr, vget_low_f64(vreinterpretq_f64_m128d(a))); #else - vst1_u64((uint64_t *) mem_addr, vget_low_u64(vreinterpretq_u64_m128d(a))); + vst1_u64((uint64_t*)mem_addr, vget_low_u64(vreinterpretq_u64_m128d(a))); #endif } // Stores four 32-bit integer values as (as a __m128i value) at the address p. // https://msdn.microsoft.com/en-us/library/vstudio/edk11s13(v=vs.100).aspx -FORCE_INLINE void _mm_store_si128(__m128i *p, __m128i a) +FORCE_INLINE void _mm_store_si128(__m128i* p, __m128i a) { - vst1q_s32((int32_t *) p, vreinterpretq_s32_m128i(a)); + vst1q_s32((int32_t*)p, vreinterpretq_s32_m128i(a)); } // Store the lower double-precision (64-bit) floating-point element from a into @@ -5933,22 +5963,22 @@ FORCE_INLINE void _mm_store_si128(__m128i *p, __m128i a) // MEM[mem_addr+63:mem_addr] := a[127:64] // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_storeh_pd -FORCE_INLINE void _mm_storeh_pd(double *mem_addr, __m128d a) +FORCE_INLINE void _mm_storeh_pd(double* mem_addr, __m128d a) { #if defined(__aarch64__) - vst1_f64((float64_t *) mem_addr, vget_high_f64(vreinterpretq_f64_m128d(a))); + vst1_f64((float64_t*)mem_addr, vget_high_f64(vreinterpretq_f64_m128d(a))); #else - vst1_f32((float32_t *) mem_addr, vget_high_f32(vreinterpretq_f32_m128d(a))); + vst1_f32((float32_t*)mem_addr, vget_high_f32(vreinterpretq_f32_m128d(a))); #endif } // Reads the lower 64 bits of b and stores them into the lower 64 bits of a. // https://msdn.microsoft.com/en-us/library/hhwf428f%28v=vs.90%29.aspx -FORCE_INLINE void _mm_storel_epi64(__m128i *a, __m128i b) +FORCE_INLINE void _mm_storel_epi64(__m128i* a, __m128i b) { - uint64x1_t hi = vget_high_u64(vreinterpretq_u64_m128i(*a)); - uint64x1_t lo = vget_low_u64(vreinterpretq_u64_m128i(b)); - *a = vreinterpretq_m128i_u64(vcombine_u64(lo, hi)); + uint64x1_t hi = vget_high_u64(vreinterpretq_u64_m128i(*a)); + uint64x1_t lo = vget_low_u64(vreinterpretq_u64_m128i(b)); + *a = vreinterpretq_m128i_u64(vcombine_u64(lo, hi)); } // Store the lower double-precision (64-bit) floating-point element from a into @@ -5957,12 +5987,12 @@ FORCE_INLINE void _mm_storel_epi64(__m128i *a, __m128i b) // MEM[mem_addr+63:mem_addr] := a[63:0] // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_storel_pd -FORCE_INLINE void _mm_storel_pd(double *mem_addr, __m128d a) +FORCE_INLINE void _mm_storel_pd(double* mem_addr, __m128d a) { #if defined(__aarch64__) - vst1_f64((float64_t *) mem_addr, vget_low_f64(vreinterpretq_f64_m128d(a))); + vst1_f64((float64_t*)mem_addr, vget_low_f64(vreinterpretq_f64_m128d(a))); #else - vst1_f32((float32_t *) mem_addr, vget_low_f32(vreinterpretq_f32_m128d(a))); + vst1_f32((float32_t*)mem_addr, vget_low_f32(vreinterpretq_f32_m128d(a))); #endif } @@ -5974,33 +6004,33 @@ FORCE_INLINE void _mm_storel_pd(double *mem_addr, __m128d a) // MEM[mem_addr+127:mem_addr+64] := a[63:0] // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_storer_pd -FORCE_INLINE void _mm_storer_pd(double *mem_addr, __m128d a) +FORCE_INLINE void _mm_storer_pd(double* mem_addr, __m128d a) { - float32x4_t f = vreinterpretq_f32_m128d(a); - _mm_store_pd(mem_addr, vreinterpretq_m128d_f32(vextq_f32(f, f, 2))); + float32x4_t f = vreinterpretq_f32_m128d(a); + _mm_store_pd(mem_addr, vreinterpretq_m128d_f32(vextq_f32(f, f, 2))); } // Store 128-bits (composed of 2 packed double-precision (64-bit) floating-point // elements) from a into memory. mem_addr does not need to be aligned on any // particular boundary. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_storeu_pd -FORCE_INLINE void _mm_storeu_pd(double *mem_addr, __m128d a) +FORCE_INLINE void _mm_storeu_pd(double* mem_addr, __m128d a) { - _mm_store_pd(mem_addr, a); + _mm_store_pd(mem_addr, a); } // Stores 128-bits of integer data a at the address p. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_storeu_si128 -FORCE_INLINE void _mm_storeu_si128(__m128i *p, __m128i a) +FORCE_INLINE void _mm_storeu_si128(__m128i* p, __m128i a) { - vst1q_s32((int32_t *) p, vreinterpretq_s32_m128i(a)); + vst1q_s32((int32_t*)p, vreinterpretq_s32_m128i(a)); } // Stores 32-bits of integer data a at the address p. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_storeu_si32 -FORCE_INLINE void _mm_storeu_si32(void *p, __m128i a) +FORCE_INLINE void _mm_storeu_si32(void* p, __m128i a) { - vst1q_lane_s32((int32_t *) p, vreinterpretq_s32_m128i(a), 0); + vst1q_lane_s32((int32_t*)p, vreinterpretq_s32_m128i(a), 0); } // Store 128-bits (composed of 2 packed double-precision (64-bit) floating-point @@ -6008,14 +6038,14 @@ FORCE_INLINE void _mm_storeu_si32(void *p, __m128i a) // be aligned on a 16-byte boundary or a general-protection exception may be // generated. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_stream_pd -FORCE_INLINE void _mm_stream_pd(double *p, __m128d a) +FORCE_INLINE void _mm_stream_pd(double* p, __m128d a) { #if __has_builtin(__builtin_nontemporal_store) - __builtin_nontemporal_store(a, (float32x4_t *) p); + __builtin_nontemporal_store(a, (float32x4_t*)p); #elif defined(__aarch64__) - vst1q_f64(p, vreinterpretq_f64_m128d(a)); + vst1q_f64(p, vreinterpretq_f64_m128d(a)); #else - vst1q_s64((int64_t *) p, vreinterpretq_s64_m128d(a)); + vst1q_s64((int64_t*)p, vreinterpretq_s64_m128d(a)); #endif } @@ -6023,12 +6053,12 @@ FORCE_INLINE void _mm_stream_pd(double *p, __m128d a) // cache line containing address p is already in the cache, the cache will be // updated. // https://msdn.microsoft.com/en-us/library/ba08y07y%28v=vs.90%29.aspx -FORCE_INLINE void _mm_stream_si128(__m128i *p, __m128i a) +FORCE_INLINE void _mm_stream_si128(__m128i* p, __m128i a) { #if __has_builtin(__builtin_nontemporal_store) - __builtin_nontemporal_store(a, p); + __builtin_nontemporal_store(a, p); #else - vst1q_s64((int64_t *) p, vreinterpretq_s64_m128i(a)); + vst1q_s64((int64_t*)p, vreinterpretq_s64_m128i(a)); #endif } @@ -6036,18 +6066,18 @@ FORCE_INLINE void _mm_stream_si128(__m128i *p, __m128i a) // cache pollution. If the cache line containing address mem_addr is already in // the cache, the cache will be updated. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_stream_si32 -FORCE_INLINE void _mm_stream_si32(int *p, int a) +FORCE_INLINE void _mm_stream_si32(int* p, int a) { - vst1q_lane_s32((int32_t *) p, vdupq_n_s32(a), 0); + vst1q_lane_s32((int32_t*)p, vdupq_n_s32(a), 0); } // Store 64-bit integer a into memory using a non-temporal hint to minimize // cache pollution. If the cache line containing address mem_addr is already in // the cache, the cache will be updated. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_stream_si64 -FORCE_INLINE void _mm_stream_si64(__int64 *p, __int64 a) +FORCE_INLINE void _mm_stream_si64(__int64* p, __int64 a) { - vst1_s64((int64_t *) p, vdup_n_s64((int64_t) a)); + vst1_s64((int64_t*)p, vdup_n_s64((int64_t)a)); } // Subtract packed 16-bit integers in b from packed 16-bit integers in a, and @@ -6055,8 +6085,8 @@ FORCE_INLINE void _mm_stream_si64(__int64 *p, __int64 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sub_epi16 FORCE_INLINE __m128i _mm_sub_epi16(__m128i a, __m128i b) { - return vreinterpretq_m128i_s16( - vsubq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); + return vreinterpretq_m128i_s16( + vsubq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); } // Subtracts the 4 signed or unsigned 32-bit integers of b from the 4 signed or @@ -6070,8 +6100,8 @@ FORCE_INLINE __m128i _mm_sub_epi16(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/vstudio/fhh866h0(v=vs.100).aspx FORCE_INLINE __m128i _mm_sub_epi32(__m128i a, __m128i b) { - return vreinterpretq_m128i_s32( - vsubq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_s32( + vsubq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); } // Subtract 2 packed 64-bit integers in b from 2 packed 64-bit integers in a, @@ -6080,8 +6110,8 @@ FORCE_INLINE __m128i _mm_sub_epi32(__m128i a, __m128i b) // r1 := a1 - b1 FORCE_INLINE __m128i _mm_sub_epi64(__m128i a, __m128i b) { - return vreinterpretq_m128i_s64( - vsubq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b))); + return vreinterpretq_m128i_s64( + vsubq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b))); } // Subtract packed 8-bit integers in b from packed 8-bit integers in a, and @@ -6089,8 +6119,8 @@ FORCE_INLINE __m128i _mm_sub_epi64(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sub_epi8 FORCE_INLINE __m128i _mm_sub_epi8(__m128i a, __m128i b) { - return vreinterpretq_m128i_s8( - vsubq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); + return vreinterpretq_m128i_s8( + vsubq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); } // Subtract packed double-precision (64-bit) floating-point elements in b from @@ -6106,15 +6136,15 @@ FORCE_INLINE __m128i _mm_sub_epi8(__m128i a, __m128i b) FORCE_INLINE __m128d _mm_sub_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vsubq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_f64( + vsubq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #else - double *da = (double *) &a; - double *db = (double *) &b; - double c[2]; - c[0] = da[0] - db[0]; - c[1] = da[1] - db[1]; - return vld1q_f32((float32_t *) c); + double* da = (double*)&a; + double* db = (double*)&b; + double c[2]; + c[0] = da[0] - db[0]; + c[1] = da[1] - db[1]; + return vld1q_f32((float32_t*)c); #endif } @@ -6125,7 +6155,7 @@ FORCE_INLINE __m128d _mm_sub_pd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sub_sd FORCE_INLINE __m128d _mm_sub_sd(__m128d a, __m128d b) { - return _mm_move_sd(a, _mm_sub_pd(a, b)); + return _mm_move_sd(a, _mm_sub_pd(a, b)); } // Subtract 64-bit integer b from 64-bit integer a, and store the result in dst. @@ -6135,8 +6165,8 @@ FORCE_INLINE __m128d _mm_sub_sd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sub_si64 FORCE_INLINE __m64 _mm_sub_si64(__m64 a, __m64 b) { - return vreinterpret_m64_s64( - vsub_s64(vreinterpret_s64_m64(a), vreinterpret_s64_m64(b))); + return vreinterpret_m64_s64( + vsub_s64(vreinterpret_s64_m64(a), vreinterpret_s64_m64(b))); } // Subtracts the 8 signed 16-bit integers of b from the 8 signed 16-bit integers @@ -6150,8 +6180,8 @@ FORCE_INLINE __m64 _mm_sub_si64(__m64 a, __m64 b) // https://technet.microsoft.com/en-us/subscriptions/3247z5b8(v=vs.90) FORCE_INLINE __m128i _mm_subs_epi16(__m128i a, __m128i b) { - return vreinterpretq_m128i_s16( - vqsubq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); + return vreinterpretq_m128i_s16( + vqsubq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); } // Subtracts the 16 signed 8-bit integers of b from the 16 signed 8-bit integers @@ -6165,8 +6195,8 @@ FORCE_INLINE __m128i _mm_subs_epi16(__m128i a, __m128i b) // https://technet.microsoft.com/en-us/subscriptions/by7kzks1(v=vs.90) FORCE_INLINE __m128i _mm_subs_epi8(__m128i a, __m128i b) { - return vreinterpretq_m128i_s8( - vqsubq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); + return vreinterpretq_m128i_s8( + vqsubq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); } // Subtracts the 8 unsigned 16-bit integers of bfrom the 8 unsigned 16-bit @@ -6174,8 +6204,8 @@ FORCE_INLINE __m128i _mm_subs_epi8(__m128i a, __m128i b) // https://technet.microsoft.com/en-us/subscriptions/index/f44y0s19(v=vs.90).aspx FORCE_INLINE __m128i _mm_subs_epu16(__m128i a, __m128i b) { - return vreinterpretq_m128i_u16( - vqsubq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b))); + return vreinterpretq_m128i_u16( + vqsubq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b))); } // Subtracts the 16 unsigned 8-bit integers of b from the 16 unsigned 8-bit @@ -6189,8 +6219,8 @@ FORCE_INLINE __m128i _mm_subs_epu16(__m128i a, __m128i b) // https://technet.microsoft.com/en-us/subscriptions/yadkxc18(v=vs.90) FORCE_INLINE __m128i _mm_subs_epu8(__m128i a, __m128i b) { - return vreinterpretq_m128i_u8( - vqsubq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b))); + return vreinterpretq_m128i_u8( + vqsubq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b))); } #define _mm_ucomieq_sd _mm_comieq_sd @@ -6208,8 +6238,8 @@ FORCE_INLINE __m128d _mm_undefined_pd(void) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wuninitialized" #endif - __m128d a; - return a; + __m128d a; + return a; #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #endif @@ -6231,13 +6261,13 @@ FORCE_INLINE __m128d _mm_undefined_pd(void) FORCE_INLINE __m128i _mm_unpackhi_epi16(__m128i a, __m128i b) { #if defined(__aarch64__) - return vreinterpretq_m128i_s16( - vzip2q_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); + return vreinterpretq_m128i_s16( + vzip2q_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); #else - int16x4_t a1 = vget_high_s16(vreinterpretq_s16_m128i(a)); - int16x4_t b1 = vget_high_s16(vreinterpretq_s16_m128i(b)); - int16x4x2_t result = vzip_s16(a1, b1); - return vreinterpretq_m128i_s16(vcombine_s16(result.val[0], result.val[1])); + int16x4_t a1 = vget_high_s16(vreinterpretq_s16_m128i(a)); + int16x4_t b1 = vget_high_s16(vreinterpretq_s16_m128i(b)); + int16x4x2_t result = vzip_s16(a1, b1); + return vreinterpretq_m128i_s16(vcombine_s16(result.val[0], result.val[1])); #endif } @@ -6247,13 +6277,13 @@ FORCE_INLINE __m128i _mm_unpackhi_epi16(__m128i a, __m128i b) FORCE_INLINE __m128i _mm_unpackhi_epi32(__m128i a, __m128i b) { #if defined(__aarch64__) - return vreinterpretq_m128i_s32( - vzip2q_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_s32( + vzip2q_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); #else - int32x2_t a1 = vget_high_s32(vreinterpretq_s32_m128i(a)); - int32x2_t b1 = vget_high_s32(vreinterpretq_s32_m128i(b)); - int32x2x2_t result = vzip_s32(a1, b1); - return vreinterpretq_m128i_s32(vcombine_s32(result.val[0], result.val[1])); + int32x2_t a1 = vget_high_s32(vreinterpretq_s32_m128i(a)); + int32x2_t b1 = vget_high_s32(vreinterpretq_s32_m128i(b)); + int32x2x2_t result = vzip_s32(a1, b1); + return vreinterpretq_m128i_s32(vcombine_s32(result.val[0], result.val[1])); #endif } @@ -6264,9 +6294,9 @@ FORCE_INLINE __m128i _mm_unpackhi_epi32(__m128i a, __m128i b) // r1 := b1 FORCE_INLINE __m128i _mm_unpackhi_epi64(__m128i a, __m128i b) { - int64x1_t a_h = vget_high_s64(vreinterpretq_s64_m128i(a)); - int64x1_t b_h = vget_high_s64(vreinterpretq_s64_m128i(b)); - return vreinterpretq_m128i_s64(vcombine_s64(a_h, b_h)); + int64x1_t a_h = vget_high_s64(vreinterpretq_s64_m128i(a)); + int64x1_t b_h = vget_high_s64(vreinterpretq_s64_m128i(b)); + return vreinterpretq_m128i_s64(vcombine_s64(a_h, b_h)); } // Interleaves the upper 8 signed or unsigned 8-bit integers in a with the upper @@ -6284,15 +6314,15 @@ FORCE_INLINE __m128i _mm_unpackhi_epi64(__m128i a, __m128i b) FORCE_INLINE __m128i _mm_unpackhi_epi8(__m128i a, __m128i b) { #if defined(__aarch64__) - return vreinterpretq_m128i_s8( - vzip2q_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); + return vreinterpretq_m128i_s8( + vzip2q_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); #else - int8x8_t a1 = - vreinterpret_s8_s16(vget_high_s16(vreinterpretq_s16_m128i(a))); - int8x8_t b1 = - vreinterpret_s8_s16(vget_high_s16(vreinterpretq_s16_m128i(b))); - int8x8x2_t result = vzip_s8(a1, b1); - return vreinterpretq_m128i_s8(vcombine_s8(result.val[0], result.val[1])); + int8x8_t a1 = + vreinterpret_s8_s16(vget_high_s16(vreinterpretq_s16_m128i(a))); + int8x8_t b1 = + vreinterpret_s8_s16(vget_high_s16(vreinterpretq_s16_m128i(b))); + int8x8x2_t result = vzip_s8(a1, b1); + return vreinterpretq_m128i_s8(vcombine_s8(result.val[0], result.val[1])); #endif } @@ -6310,12 +6340,12 @@ FORCE_INLINE __m128i _mm_unpackhi_epi8(__m128i a, __m128i b) FORCE_INLINE __m128d _mm_unpackhi_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vzip2q_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_f64( + vzip2q_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #else - return vreinterpretq_m128d_s64( - vcombine_s64(vget_high_s64(vreinterpretq_s64_m128d(a)), - vget_high_s64(vreinterpretq_s64_m128d(b)))); + return vreinterpretq_m128d_s64( + vcombine_s64(vget_high_s64(vreinterpretq_s64_m128d(a)), + vget_high_s64(vreinterpretq_s64_m128d(b)))); #endif } @@ -6335,13 +6365,13 @@ FORCE_INLINE __m128d _mm_unpackhi_pd(__m128d a, __m128d b) FORCE_INLINE __m128i _mm_unpacklo_epi16(__m128i a, __m128i b) { #if defined(__aarch64__) - return vreinterpretq_m128i_s16( - vzip1q_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); + return vreinterpretq_m128i_s16( + vzip1q_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b))); #else - int16x4_t a1 = vget_low_s16(vreinterpretq_s16_m128i(a)); - int16x4_t b1 = vget_low_s16(vreinterpretq_s16_m128i(b)); - int16x4x2_t result = vzip_s16(a1, b1); - return vreinterpretq_m128i_s16(vcombine_s16(result.val[0], result.val[1])); + int16x4_t a1 = vget_low_s16(vreinterpretq_s16_m128i(a)); + int16x4_t b1 = vget_low_s16(vreinterpretq_s16_m128i(b)); + int16x4x2_t result = vzip_s16(a1, b1); + return vreinterpretq_m128i_s16(vcombine_s16(result.val[0], result.val[1])); #endif } @@ -6357,21 +6387,21 @@ FORCE_INLINE __m128i _mm_unpacklo_epi16(__m128i a, __m128i b) FORCE_INLINE __m128i _mm_unpacklo_epi32(__m128i a, __m128i b) { #if defined(__aarch64__) - return vreinterpretq_m128i_s32( - vzip1q_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_s32( + vzip1q_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); #else - int32x2_t a1 = vget_low_s32(vreinterpretq_s32_m128i(a)); - int32x2_t b1 = vget_low_s32(vreinterpretq_s32_m128i(b)); - int32x2x2_t result = vzip_s32(a1, b1); - return vreinterpretq_m128i_s32(vcombine_s32(result.val[0], result.val[1])); + int32x2_t a1 = vget_low_s32(vreinterpretq_s32_m128i(a)); + int32x2_t b1 = vget_low_s32(vreinterpretq_s32_m128i(b)); + int32x2x2_t result = vzip_s32(a1, b1); + return vreinterpretq_m128i_s32(vcombine_s32(result.val[0], result.val[1])); #endif } FORCE_INLINE __m128i _mm_unpacklo_epi64(__m128i a, __m128i b) { - int64x1_t a_l = vget_low_s64(vreinterpretq_s64_m128i(a)); - int64x1_t b_l = vget_low_s64(vreinterpretq_s64_m128i(b)); - return vreinterpretq_m128i_s64(vcombine_s64(a_l, b_l)); + int64x1_t a_l = vget_low_s64(vreinterpretq_s64_m128i(a)); + int64x1_t b_l = vget_low_s64(vreinterpretq_s64_m128i(b)); + return vreinterpretq_m128i_s64(vcombine_s64(a_l, b_l)); } // Interleaves the lower 8 signed or unsigned 8-bit integers in a with the lower @@ -6389,13 +6419,13 @@ FORCE_INLINE __m128i _mm_unpacklo_epi64(__m128i a, __m128i b) FORCE_INLINE __m128i _mm_unpacklo_epi8(__m128i a, __m128i b) { #if defined(__aarch64__) - return vreinterpretq_m128i_s8( - vzip1q_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); + return vreinterpretq_m128i_s8( + vzip1q_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); #else - int8x8_t a1 = vreinterpret_s8_s16(vget_low_s16(vreinterpretq_s16_m128i(a))); - int8x8_t b1 = vreinterpret_s8_s16(vget_low_s16(vreinterpretq_s16_m128i(b))); - int8x8x2_t result = vzip_s8(a1, b1); - return vreinterpretq_m128i_s8(vcombine_s8(result.val[0], result.val[1])); + int8x8_t a1 = vreinterpret_s8_s16(vget_low_s16(vreinterpretq_s16_m128i(a))); + int8x8_t b1 = vreinterpret_s8_s16(vget_low_s16(vreinterpretq_s16_m128i(b))); + int8x8x2_t result = vzip_s8(a1, b1); + return vreinterpretq_m128i_s8(vcombine_s8(result.val[0], result.val[1])); #endif } @@ -6413,12 +6443,12 @@ FORCE_INLINE __m128i _mm_unpacklo_epi8(__m128i a, __m128i b) FORCE_INLINE __m128d _mm_unpacklo_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vzip1q_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_f64( + vzip1q_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #else - return vreinterpretq_m128d_s64( - vcombine_s64(vget_low_s64(vreinterpretq_s64_m128d(a)), - vget_low_s64(vreinterpretq_s64_m128d(b)))); + return vreinterpretq_m128d_s64( + vcombine_s64(vget_low_s64(vreinterpretq_s64_m128d(a)), + vget_low_s64(vreinterpretq_s64_m128d(b)))); #endif } @@ -6433,16 +6463,16 @@ FORCE_INLINE __m128d _mm_unpacklo_pd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_xor_pd FORCE_INLINE __m128d _mm_xor_pd(__m128d a, __m128d b) { - return vreinterpretq_m128d_s64( - veorq_s64(vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b))); + return vreinterpretq_m128d_s64( + veorq_s64(vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b))); } // Computes the bitwise XOR of the 128-bit value in a and the 128-bit value in // b. https://msdn.microsoft.com/en-us/library/fzt08www(v=vs.100).aspx FORCE_INLINE __m128i _mm_xor_si128(__m128i a, __m128i b) { - return vreinterpretq_m128i_s32( - veorq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_s32( + veorq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); } /* SSE3 */ @@ -6463,13 +6493,13 @@ FORCE_INLINE __m128i _mm_xor_si128(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_addsub_pd FORCE_INLINE __m128d _mm_addsub_pd(__m128d a, __m128d b) { - static const __m128d mask = _mm_set_pd(1.0f, -1.0f); + static const __m128d mask = _mm_set_pd(1.0f, -1.0f); #if defined(__aarch64__) - return vreinterpretq_m128d_f64(vfmaq_f64(vreinterpretq_f64_m128d(a), - vreinterpretq_f64_m128d(b), - vreinterpretq_f64_m128d(mask))); + return vreinterpretq_m128d_f64(vfmaq_f64(vreinterpretq_f64_m128d(a), + vreinterpretq_f64_m128d(b), + vreinterpretq_f64_m128d(mask))); #else - return _mm_add_pd(_mm_mul_pd(b, mask), a); + return _mm_add_pd(_mm_mul_pd(b, mask), a); #endif } @@ -6479,13 +6509,13 @@ FORCE_INLINE __m128d _mm_addsub_pd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=addsub_ps FORCE_INLINE __m128 _mm_addsub_ps(__m128 a, __m128 b) { - static const __m128 mask = _mm_setr_ps(-1.0f, 1.0f, -1.0f, 1.0f); + static const __m128 mask = _mm_setr_ps(-1.0f, 1.0f, -1.0f, 1.0f); #if defined(__aarch64__) || defined(__ARM_FEATURE_FMA) /* VFPv4+ */ - return vreinterpretq_m128_f32(vfmaq_f32(vreinterpretq_f32_m128(a), - vreinterpretq_f32_m128(mask), - vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_f32(vfmaq_f32(vreinterpretq_f32_m128(a), + vreinterpretq_f32_m128(mask), + vreinterpretq_f32_m128(b))); #else - return _mm_add_ps(_mm_mul_ps(b, mask), a); + return _mm_add_ps(_mm_mul_ps(b, mask), a); #endif } @@ -6495,13 +6525,13 @@ FORCE_INLINE __m128 _mm_addsub_ps(__m128 a, __m128 b) FORCE_INLINE __m128d _mm_hadd_pd(__m128d a, __m128d b) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vpaddq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); + return vreinterpretq_m128d_f64( + vpaddq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b))); #else - double *da = (double *) &a; - double *db = (double *) &b; - double c[] = {da[0] + da[1], db[0] + db[1]}; - return vreinterpretq_m128d_u64(vld1q_u64((uint64_t *) c)); + double* da = (double*)&a; + double* db = (double*)&b; + double c[] = {da[0] + da[1], db[0] + db[1]}; + return vreinterpretq_m128d_u64(vld1q_u64((uint64_t*)c)); #endif } @@ -6511,15 +6541,15 @@ FORCE_INLINE __m128d _mm_hadd_pd(__m128d a, __m128d b) FORCE_INLINE __m128 _mm_hadd_ps(__m128 a, __m128 b) { #if defined(__aarch64__) - return vreinterpretq_m128_f32( - vpaddq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); + return vreinterpretq_m128_f32( + vpaddq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))); #else - float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a)); - float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a)); - float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b)); - float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b)); - return vreinterpretq_m128_f32( - vcombine_f32(vpadd_f32(a10, a32), vpadd_f32(b10, b32))); + float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a)); + float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a)); + float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b)); + float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b)); + return vreinterpretq_m128_f32( + vcombine_f32(vpadd_f32(a10, a32), vpadd_f32(b10, b32))); #endif } @@ -6529,15 +6559,15 @@ FORCE_INLINE __m128 _mm_hadd_ps(__m128 a, __m128 b) FORCE_INLINE __m128d _mm_hsub_pd(__m128d _a, __m128d _b) { #if defined(__aarch64__) - float64x2_t a = vreinterpretq_f64_m128d(_a); - float64x2_t b = vreinterpretq_f64_m128d(_b); - return vreinterpretq_m128d_f64( - vsubq_f64(vuzp1q_f64(a, b), vuzp2q_f64(a, b))); + float64x2_t a = vreinterpretq_f64_m128d(_a); + float64x2_t b = vreinterpretq_f64_m128d(_b); + return vreinterpretq_m128d_f64( + vsubq_f64(vuzp1q_f64(a, b), vuzp2q_f64(a, b))); #else - double *da = (double *) &_a; - double *db = (double *) &_b; - double c[] = {da[0] - da[1], db[0] - db[1]}; - return vreinterpretq_m128d_u64(vld1q_u64((uint64_t *) c)); + double* da = (double*)&_a; + double* db = (double*)&_b; + double c[] = {da[0] - da[1], db[0] - db[1]}; + return vreinterpretq_m128d_u64(vld1q_u64((uint64_t*)c)); #endif } @@ -6546,14 +6576,14 @@ FORCE_INLINE __m128d _mm_hsub_pd(__m128d _a, __m128d _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hsub_ps FORCE_INLINE __m128 _mm_hsub_ps(__m128 _a, __m128 _b) { - float32x4_t a = vreinterpretq_f32_m128(_a); - float32x4_t b = vreinterpretq_f32_m128(_b); + float32x4_t a = vreinterpretq_f32_m128(_a); + float32x4_t b = vreinterpretq_f32_m128(_b); #if defined(__aarch64__) - return vreinterpretq_m128_f32( - vsubq_f32(vuzp1q_f32(a, b), vuzp2q_f32(a, b))); + return vreinterpretq_m128_f32( + vsubq_f32(vuzp1q_f32(a, b), vuzp2q_f32(a, b))); #else - float32x4x2_t c = vuzpq_f32(a, b); - return vreinterpretq_m128_f32(vsubq_f32(c.val[0], c.val[1])); + float32x4x2_t c = vuzpq_f32(a, b); + return vreinterpretq_m128_f32(vsubq_f32(c.val[0], c.val[1])); #endif } @@ -6581,11 +6611,11 @@ FORCE_INLINE __m128 _mm_hsub_ps(__m128 _a, __m128 _b) FORCE_INLINE __m128d _mm_movedup_pd(__m128d a) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64( - vdupq_laneq_f64(vreinterpretq_f64_m128d(a), 0)); + return vreinterpretq_m128d_f64( + vdupq_laneq_f64(vreinterpretq_f64_m128d(a), 0)); #else - return vreinterpretq_m128d_u64( - vdupq_n_u64(vgetq_lane_u64(vreinterpretq_u64_m128d(a), 0))); + return vreinterpretq_m128d_u64( + vdupq_n_u64(vgetq_lane_u64(vreinterpretq_u64_m128d(a), 0))); #endif } @@ -6595,13 +6625,13 @@ FORCE_INLINE __m128d _mm_movedup_pd(__m128d a) FORCE_INLINE __m128 _mm_movehdup_ps(__m128 a) { #if __has_builtin(__builtin_shufflevector) - return vreinterpretq_m128_f32(__builtin_shufflevector( - vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 1, 1, 3, 3)); + return vreinterpretq_m128_f32(__builtin_shufflevector( + vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 1, 1, 3, 3)); #else - float32_t a1 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 1); - float32_t a3 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 3); - float ALIGN_STRUCT(16) data[4] = {a1, a1, a3, a3}; - return vreinterpretq_m128_f32(vld1q_f32(data)); + float32_t a1 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 1); + float32_t a3 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 3); + float ALIGN_STRUCT(16) data[4] = {a1, a1, a3, a3}; + return vreinterpretq_m128_f32(vld1q_f32(data)); #endif } @@ -6611,13 +6641,13 @@ FORCE_INLINE __m128 _mm_movehdup_ps(__m128 a) FORCE_INLINE __m128 _mm_moveldup_ps(__m128 a) { #if __has_builtin(__builtin_shufflevector) - return vreinterpretq_m128_f32(__builtin_shufflevector( - vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 0, 0, 2, 2)); + return vreinterpretq_m128_f32(__builtin_shufflevector( + vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 0, 0, 2, 2)); #else - float32_t a0 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0); - float32_t a2 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 2); - float ALIGN_STRUCT(16) data[4] = {a0, a0, a2, a2}; - return vreinterpretq_m128_f32(vld1q_f32(data)); + float32_t a0 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0); + float32_t a2 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 2); + float ALIGN_STRUCT(16) data[4] = {a0, a0, a2, a2}; + return vreinterpretq_m128_f32(vld1q_f32(data)); #endif } @@ -6634,7 +6664,7 @@ FORCE_INLINE __m128 _mm_moveldup_ps(__m128 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_abs_epi16 FORCE_INLINE __m128i _mm_abs_epi16(__m128i a) { - return vreinterpretq_m128i_s16(vabsq_s16(vreinterpretq_s16_m128i(a))); + return vreinterpretq_m128i_s16(vabsq_s16(vreinterpretq_s16_m128i(a))); } // Compute the absolute value of packed signed 32-bit integers in a, and store @@ -6648,7 +6678,7 @@ FORCE_INLINE __m128i _mm_abs_epi16(__m128i a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_abs_epi32 FORCE_INLINE __m128i _mm_abs_epi32(__m128i a) { - return vreinterpretq_m128i_s32(vabsq_s32(vreinterpretq_s32_m128i(a))); + return vreinterpretq_m128i_s32(vabsq_s32(vreinterpretq_s32_m128i(a))); } // Compute the absolute value of packed signed 8-bit integers in a, and store @@ -6662,7 +6692,7 @@ FORCE_INLINE __m128i _mm_abs_epi32(__m128i a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_abs_epi8 FORCE_INLINE __m128i _mm_abs_epi8(__m128i a) { - return vreinterpretq_m128i_s8(vabsq_s8(vreinterpretq_s8_m128i(a))); + return vreinterpretq_m128i_s8(vabsq_s8(vreinterpretq_s8_m128i(a))); } // Compute the absolute value of packed signed 16-bit integers in a, and store @@ -6676,7 +6706,7 @@ FORCE_INLINE __m128i _mm_abs_epi8(__m128i a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_abs_pi16 FORCE_INLINE __m64 _mm_abs_pi16(__m64 a) { - return vreinterpret_m64_s16(vabs_s16(vreinterpret_s16_m64(a))); + return vreinterpret_m64_s16(vabs_s16(vreinterpret_s16_m64(a))); } // Compute the absolute value of packed signed 32-bit integers in a, and store @@ -6690,7 +6720,7 @@ FORCE_INLINE __m64 _mm_abs_pi16(__m64 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_abs_pi32 FORCE_INLINE __m64 _mm_abs_pi32(__m64 a) { - return vreinterpret_m64_s32(vabs_s32(vreinterpret_s32_m64(a))); + return vreinterpret_m64_s32(vabs_s32(vreinterpret_s32_m64(a))); } // Compute the absolute value of packed signed 8-bit integers in a, and store @@ -6704,7 +6734,7 @@ FORCE_INLINE __m64 _mm_abs_pi32(__m64 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_abs_pi8 FORCE_INLINE __m64 _mm_abs_pi8(__m64 a) { - return vreinterpret_m64_s8(vabs_s8(vreinterpret_s8_m64(a))); + return vreinterpret_m64_s8(vabs_s8(vreinterpret_s8_m64(a))); } // Concatenate 16-byte blocks in a and b into a 32-byte temporary result, shift @@ -6716,20 +6746,23 @@ FORCE_INLINE __m64 _mm_abs_pi8(__m64 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_alignr_epi8 FORCE_INLINE __m128i _mm_alignr_epi8(__m128i a, __m128i b, int imm) { - if (_sse2neon_unlikely(imm & ~31)) - return _mm_setzero_si128(); - int idx; - uint8x16_t tmp[2]; - if (imm >= 16) { - idx = imm - 16; - tmp[0] = vreinterpretq_u8_m128i(a); - tmp[1] = vdupq_n_u8(0); - } else { - idx = imm; - tmp[0] = vreinterpretq_u8_m128i(b); - tmp[1] = vreinterpretq_u8_m128i(a); - } - return vreinterpretq_m128i_u8(vld1q_u8(((uint8_t const *) tmp) + idx)); + if (_sse2neon_unlikely(imm & ~31)) + return _mm_setzero_si128(); + int idx; + uint8x16_t tmp[2]; + if (imm >= 16) + { + idx = imm - 16; + tmp[0] = vreinterpretq_u8_m128i(a); + tmp[1] = vdupq_n_u8(0); + } + else + { + idx = imm; + tmp[0] = vreinterpretq_u8_m128i(b); + tmp[1] = vreinterpretq_u8_m128i(a); + } + return vreinterpretq_m128i_u8(vld1q_u8(((uint8_t const*)tmp) + idx)); } // Concatenate 8-byte blocks in a and b into a 16-byte temporary result, shift @@ -6740,39 +6773,45 @@ FORCE_INLINE __m128i _mm_alignr_epi8(__m128i a, __m128i b, int imm) // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_alignr_pi8 #define _mm_alignr_pi8(a, b, imm) \ - __extension__({ \ - __m64 ret; \ - if (_sse2neon_unlikely((imm) >= 16)) { \ - ret = vreinterpret_m64_s8(vdup_n_s8(0)); \ - } else { \ - uint8x8_t tmp_low, tmp_high; \ - if ((imm) >= 8) { \ - const int idx = (imm) -8; \ - tmp_low = vreinterpret_u8_m64(a); \ - tmp_high = vdup_n_u8(0); \ - ret = vreinterpret_m64_u8(vext_u8(tmp_low, tmp_high, idx)); \ - } else { \ - const int idx = (imm); \ - tmp_low = vreinterpret_u8_m64(b); \ - tmp_high = vreinterpret_u8_m64(a); \ - ret = vreinterpret_m64_u8(vext_u8(tmp_low, tmp_high, idx)); \ - } \ - } \ - ret; \ - }) + __extension__({ \ + __m64 ret; \ + if (_sse2neon_unlikely((imm) >= 16)) \ + { \ + ret = vreinterpret_m64_s8(vdup_n_s8(0)); \ + } \ + else \ + { \ + uint8x8_t tmp_low, tmp_high; \ + if ((imm) >= 8) \ + { \ + const int idx = (imm) - 8; \ + tmp_low = vreinterpret_u8_m64(a); \ + tmp_high = vdup_n_u8(0); \ + ret = vreinterpret_m64_u8(vext_u8(tmp_low, tmp_high, idx)); \ + } \ + else \ + { \ + const int idx = (imm); \ + tmp_low = vreinterpret_u8_m64(b); \ + tmp_high = vreinterpret_u8_m64(a); \ + ret = vreinterpret_m64_u8(vext_u8(tmp_low, tmp_high, idx)); \ + } \ + } \ + ret; \ + }) // Computes pairwise add of each argument as a 16-bit signed or unsigned integer // values a and b. FORCE_INLINE __m128i _mm_hadd_epi16(__m128i _a, __m128i _b) { - int16x8_t a = vreinterpretq_s16_m128i(_a); - int16x8_t b = vreinterpretq_s16_m128i(_b); + int16x8_t a = vreinterpretq_s16_m128i(_a); + int16x8_t b = vreinterpretq_s16_m128i(_b); #if defined(__aarch64__) - return vreinterpretq_m128i_s16(vpaddq_s16(a, b)); + return vreinterpretq_m128i_s16(vpaddq_s16(a, b)); #else - return vreinterpretq_m128i_s16( - vcombine_s16(vpadd_s16(vget_low_s16(a), vget_high_s16(a)), - vpadd_s16(vget_low_s16(b), vget_high_s16(b)))); + return vreinterpretq_m128i_s16( + vcombine_s16(vpadd_s16(vget_low_s16(a), vget_high_s16(a)), + vpadd_s16(vget_low_s16(b), vget_high_s16(b)))); #endif } @@ -6780,11 +6819,11 @@ FORCE_INLINE __m128i _mm_hadd_epi16(__m128i _a, __m128i _b) // values a and b. FORCE_INLINE __m128i _mm_hadd_epi32(__m128i _a, __m128i _b) { - int32x4_t a = vreinterpretq_s32_m128i(_a); - int32x4_t b = vreinterpretq_s32_m128i(_b); - return vreinterpretq_m128i_s32( - vcombine_s32(vpadd_s32(vget_low_s32(a), vget_high_s32(a)), - vpadd_s32(vget_low_s32(b), vget_high_s32(b)))); + int32x4_t a = vreinterpretq_s32_m128i(_a); + int32x4_t b = vreinterpretq_s32_m128i(_b); + return vreinterpretq_m128i_s32( + vcombine_s32(vpadd_s32(vget_low_s32(a), vget_high_s32(a)), + vpadd_s32(vget_low_s32(b), vget_high_s32(b)))); } // Horizontally add adjacent pairs of 16-bit integers in a and b, and pack the @@ -6792,8 +6831,8 @@ FORCE_INLINE __m128i _mm_hadd_epi32(__m128i _a, __m128i _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hadd_pi16 FORCE_INLINE __m64 _mm_hadd_pi16(__m64 a, __m64 b) { - return vreinterpret_m64_s16( - vpadd_s16(vreinterpret_s16_m64(a), vreinterpret_s16_m64(b))); + return vreinterpret_m64_s16( + vpadd_s16(vreinterpret_s16_m64(a), vreinterpret_s16_m64(b))); } // Horizontally add adjacent pairs of 32-bit integers in a and b, and pack the @@ -6801,8 +6840,8 @@ FORCE_INLINE __m64 _mm_hadd_pi16(__m64 a, __m64 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hadd_pi32 FORCE_INLINE __m64 _mm_hadd_pi32(__m64 a, __m64 b) { - return vreinterpret_m64_s32( - vpadd_s32(vreinterpret_s32_m64(a), vreinterpret_s32_m64(b))); + return vreinterpret_m64_s32( + vpadd_s32(vreinterpret_s32_m64(a), vreinterpret_s32_m64(b))); } // Computes saturated pairwise sub of each argument as a 16-bit signed @@ -6810,20 +6849,20 @@ FORCE_INLINE __m64 _mm_hadd_pi32(__m64 a, __m64 b) FORCE_INLINE __m128i _mm_hadds_epi16(__m128i _a, __m128i _b) { #if defined(__aarch64__) - int16x8_t a = vreinterpretq_s16_m128i(_a); - int16x8_t b = vreinterpretq_s16_m128i(_b); - return vreinterpretq_s64_s16( - vqaddq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b))); + int16x8_t a = vreinterpretq_s16_m128i(_a); + int16x8_t b = vreinterpretq_s16_m128i(_b); + return vreinterpretq_s64_s16( + vqaddq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b))); #else - int32x4_t a = vreinterpretq_s32_m128i(_a); - int32x4_t b = vreinterpretq_s32_m128i(_b); - // Interleave using vshrn/vmovn - // [a0|a2|a4|a6|b0|b2|b4|b6] - // [a1|a3|a5|a7|b1|b3|b5|b7] - int16x8_t ab0246 = vcombine_s16(vmovn_s32(a), vmovn_s32(b)); - int16x8_t ab1357 = vcombine_s16(vshrn_n_s32(a, 16), vshrn_n_s32(b, 16)); - // Saturated add - return vreinterpretq_m128i_s16(vqaddq_s16(ab0246, ab1357)); + int32x4_t a = vreinterpretq_s32_m128i(_a); + int32x4_t b = vreinterpretq_s32_m128i(_b); + // Interleave using vshrn/vmovn + // [a0|a2|a4|a6|b0|b2|b4|b6] + // [a1|a3|a5|a7|b1|b3|b5|b7] + int16x8_t ab0246 = vcombine_s16(vmovn_s32(a), vmovn_s32(b)); + int16x8_t ab1357 = vcombine_s16(vshrn_n_s32(a, 16), vshrn_n_s32(b, 16)); + // Saturated add + return vreinterpretq_m128i_s16(vqaddq_s16(ab0246, ab1357)); #endif } @@ -6832,13 +6871,13 @@ FORCE_INLINE __m128i _mm_hadds_epi16(__m128i _a, __m128i _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hadds_pi16 FORCE_INLINE __m64 _mm_hadds_pi16(__m64 _a, __m64 _b) { - int16x4_t a = vreinterpret_s16_m64(_a); - int16x4_t b = vreinterpret_s16_m64(_b); + int16x4_t a = vreinterpret_s16_m64(_a); + int16x4_t b = vreinterpret_s16_m64(_b); #if defined(__aarch64__) - return vreinterpret_s64_s16(vqadd_s16(vuzp1_s16(a, b), vuzp2_s16(a, b))); + return vreinterpret_s64_s16(vqadd_s16(vuzp1_s16(a, b), vuzp2_s16(a, b))); #else - int16x4x2_t res = vuzp_s16(a, b); - return vreinterpret_s64_s16(vqadd_s16(res.val[0], res.val[1])); + int16x4x2_t res = vuzp_s16(a, b); + return vreinterpret_s64_s16(vqadd_s16(res.val[0], res.val[1])); #endif } @@ -6847,14 +6886,14 @@ FORCE_INLINE __m64 _mm_hadds_pi16(__m64 _a, __m64 _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hsub_epi16 FORCE_INLINE __m128i _mm_hsub_epi16(__m128i _a, __m128i _b) { - int16x8_t a = vreinterpretq_s16_m128i(_a); - int16x8_t b = vreinterpretq_s16_m128i(_b); + int16x8_t a = vreinterpretq_s16_m128i(_a); + int16x8_t b = vreinterpretq_s16_m128i(_b); #if defined(__aarch64__) - return vreinterpretq_m128i_s16( - vsubq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b))); + return vreinterpretq_m128i_s16( + vsubq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b))); #else - int16x8x2_t c = vuzpq_s16(a, b); - return vreinterpretq_m128i_s16(vsubq_s16(c.val[0], c.val[1])); + int16x8x2_t c = vuzpq_s16(a, b); + return vreinterpretq_m128i_s16(vsubq_s16(c.val[0], c.val[1])); #endif } @@ -6863,14 +6902,14 @@ FORCE_INLINE __m128i _mm_hsub_epi16(__m128i _a, __m128i _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hsub_epi32 FORCE_INLINE __m128i _mm_hsub_epi32(__m128i _a, __m128i _b) { - int32x4_t a = vreinterpretq_s32_m128i(_a); - int32x4_t b = vreinterpretq_s32_m128i(_b); + int32x4_t a = vreinterpretq_s32_m128i(_a); + int32x4_t b = vreinterpretq_s32_m128i(_b); #if defined(__aarch64__) - return vreinterpretq_m128i_s32( - vsubq_s32(vuzp1q_s32(a, b), vuzp2q_s32(a, b))); + return vreinterpretq_m128i_s32( + vsubq_s32(vuzp1q_s32(a, b), vuzp2q_s32(a, b))); #else - int32x4x2_t c = vuzpq_s32(a, b); - return vreinterpretq_m128i_s32(vsubq_s32(c.val[0], c.val[1])); + int32x4x2_t c = vuzpq_s32(a, b); + return vreinterpretq_m128i_s32(vsubq_s32(c.val[0], c.val[1])); #endif } @@ -6879,13 +6918,13 @@ FORCE_INLINE __m128i _mm_hsub_epi32(__m128i _a, __m128i _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hsub_pi16 FORCE_INLINE __m64 _mm_hsub_pi16(__m64 _a, __m64 _b) { - int16x4_t a = vreinterpret_s16_m64(_a); - int16x4_t b = vreinterpret_s16_m64(_b); + int16x4_t a = vreinterpret_s16_m64(_a); + int16x4_t b = vreinterpret_s16_m64(_b); #if defined(__aarch64__) - return vreinterpret_m64_s16(vsub_s16(vuzp1_s16(a, b), vuzp2_s16(a, b))); + return vreinterpret_m64_s16(vsub_s16(vuzp1_s16(a, b), vuzp2_s16(a, b))); #else - int16x4x2_t c = vuzp_s16(a, b); - return vreinterpret_m64_s16(vsub_s16(c.val[0], c.val[1])); + int16x4x2_t c = vuzp_s16(a, b); + return vreinterpret_m64_s16(vsub_s16(c.val[0], c.val[1])); #endif } @@ -6894,13 +6933,13 @@ FORCE_INLINE __m64 _mm_hsub_pi16(__m64 _a, __m64 _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=mm_hsub_pi32 FORCE_INLINE __m64 _mm_hsub_pi32(__m64 _a, __m64 _b) { - int32x2_t a = vreinterpret_s32_m64(_a); - int32x2_t b = vreinterpret_s32_m64(_b); + int32x2_t a = vreinterpret_s32_m64(_a); + int32x2_t b = vreinterpret_s32_m64(_b); #if defined(__aarch64__) - return vreinterpret_m64_s32(vsub_s32(vuzp1_s32(a, b), vuzp2_s32(a, b))); + return vreinterpret_m64_s32(vsub_s32(vuzp1_s32(a, b), vuzp2_s32(a, b))); #else - int32x2x2_t c = vuzp_s32(a, b); - return vreinterpret_m64_s32(vsub_s32(c.val[0], c.val[1])); + int32x2x2_t c = vuzp_s32(a, b); + return vreinterpret_m64_s32(vsub_s32(c.val[0], c.val[1])); #endif } @@ -6909,14 +6948,14 @@ FORCE_INLINE __m64 _mm_hsub_pi32(__m64 _a, __m64 _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hsubs_epi16 FORCE_INLINE __m128i _mm_hsubs_epi16(__m128i _a, __m128i _b) { - int16x8_t a = vreinterpretq_s16_m128i(_a); - int16x8_t b = vreinterpretq_s16_m128i(_b); + int16x8_t a = vreinterpretq_s16_m128i(_a); + int16x8_t b = vreinterpretq_s16_m128i(_b); #if defined(__aarch64__) - return vreinterpretq_m128i_s16( - vqsubq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b))); + return vreinterpretq_m128i_s16( + vqsubq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b))); #else - int16x8x2_t c = vuzpq_s16(a, b); - return vreinterpretq_m128i_s16(vqsubq_s16(c.val[0], c.val[1])); + int16x8x2_t c = vuzpq_s16(a, b); + return vreinterpretq_m128i_s16(vqsubq_s16(c.val[0], c.val[1])); #endif } @@ -6925,13 +6964,13 @@ FORCE_INLINE __m128i _mm_hsubs_epi16(__m128i _a, __m128i _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hsubs_pi16 FORCE_INLINE __m64 _mm_hsubs_pi16(__m64 _a, __m64 _b) { - int16x4_t a = vreinterpret_s16_m64(_a); - int16x4_t b = vreinterpret_s16_m64(_b); + int16x4_t a = vreinterpret_s16_m64(_a); + int16x4_t b = vreinterpret_s16_m64(_b); #if defined(__aarch64__) - return vreinterpret_m64_s16(vqsub_s16(vuzp1_s16(a, b), vuzp2_s16(a, b))); + return vreinterpret_m64_s16(vqsub_s16(vuzp1_s16(a, b), vuzp2_s16(a, b))); #else - int16x4x2_t c = vuzp_s16(a, b); - return vreinterpret_m64_s16(vqsub_s16(c.val[0], c.val[1])); + int16x4x2_t c = vuzp_s16(a, b); + return vreinterpret_m64_s16(vqsub_s16(c.val[0], c.val[1])); #endif } @@ -6948,34 +6987,34 @@ FORCE_INLINE __m64 _mm_hsubs_pi16(__m64 _a, __m64 _b) FORCE_INLINE __m128i _mm_maddubs_epi16(__m128i _a, __m128i _b) { #if defined(__aarch64__) - uint8x16_t a = vreinterpretq_u8_m128i(_a); - int8x16_t b = vreinterpretq_s8_m128i(_b); - int16x8_t tl = vmulq_s16(vreinterpretq_s16_u16(vmovl_u8(vget_low_u8(a))), - vmovl_s8(vget_low_s8(b))); - int16x8_t th = vmulq_s16(vreinterpretq_s16_u16(vmovl_u8(vget_high_u8(a))), - vmovl_s8(vget_high_s8(b))); - return vreinterpretq_m128i_s16( - vqaddq_s16(vuzp1q_s16(tl, th), vuzp2q_s16(tl, th))); + uint8x16_t a = vreinterpretq_u8_m128i(_a); + int8x16_t b = vreinterpretq_s8_m128i(_b); + int16x8_t tl = vmulq_s16(vreinterpretq_s16_u16(vmovl_u8(vget_low_u8(a))), + vmovl_s8(vget_low_s8(b))); + int16x8_t th = vmulq_s16(vreinterpretq_s16_u16(vmovl_u8(vget_high_u8(a))), + vmovl_s8(vget_high_s8(b))); + return vreinterpretq_m128i_s16( + vqaddq_s16(vuzp1q_s16(tl, th), vuzp2q_s16(tl, th))); #else - // This would be much simpler if x86 would choose to zero extend OR sign - // extend, not both. This could probably be optimized better. - uint16x8_t a = vreinterpretq_u16_m128i(_a); - int16x8_t b = vreinterpretq_s16_m128i(_b); + // This would be much simpler if x86 would choose to zero extend OR sign + // extend, not both. This could probably be optimized better. + uint16x8_t a = vreinterpretq_u16_m128i(_a); + int16x8_t b = vreinterpretq_s16_m128i(_b); - // Zero extend a - int16x8_t a_odd = vreinterpretq_s16_u16(vshrq_n_u16(a, 8)); - int16x8_t a_even = vreinterpretq_s16_u16(vbicq_u16(a, vdupq_n_u16(0xff00))); + // Zero extend a + int16x8_t a_odd = vreinterpretq_s16_u16(vshrq_n_u16(a, 8)); + int16x8_t a_even = vreinterpretq_s16_u16(vbicq_u16(a, vdupq_n_u16(0xff00))); - // Sign extend by shifting left then shifting right. - int16x8_t b_even = vshrq_n_s16(vshlq_n_s16(b, 8), 8); - int16x8_t b_odd = vshrq_n_s16(b, 8); + // Sign extend by shifting left then shifting right. + int16x8_t b_even = vshrq_n_s16(vshlq_n_s16(b, 8), 8); + int16x8_t b_odd = vshrq_n_s16(b, 8); - // multiply - int16x8_t prod1 = vmulq_s16(a_even, b_even); - int16x8_t prod2 = vmulq_s16(a_odd, b_odd); + // multiply + int16x8_t prod1 = vmulq_s16(a_even, b_even); + int16x8_t prod2 = vmulq_s16(a_odd, b_odd); - // saturated add - return vreinterpretq_m128i_s16(vqaddq_s16(prod1, prod2)); + // saturated add + return vreinterpretq_m128i_s16(vqaddq_s16(prod1, prod2)); #endif } @@ -6986,23 +7025,23 @@ FORCE_INLINE __m128i _mm_maddubs_epi16(__m128i _a, __m128i _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_maddubs_pi16 FORCE_INLINE __m64 _mm_maddubs_pi16(__m64 _a, __m64 _b) { - uint16x4_t a = vreinterpret_u16_m64(_a); - int16x4_t b = vreinterpret_s16_m64(_b); + uint16x4_t a = vreinterpret_u16_m64(_a); + int16x4_t b = vreinterpret_s16_m64(_b); - // Zero extend a - int16x4_t a_odd = vreinterpret_s16_u16(vshr_n_u16(a, 8)); - int16x4_t a_even = vreinterpret_s16_u16(vand_u16(a, vdup_n_u16(0xff))); + // Zero extend a + int16x4_t a_odd = vreinterpret_s16_u16(vshr_n_u16(a, 8)); + int16x4_t a_even = vreinterpret_s16_u16(vand_u16(a, vdup_n_u16(0xff))); - // Sign extend by shifting left then shifting right. - int16x4_t b_even = vshr_n_s16(vshl_n_s16(b, 8), 8); - int16x4_t b_odd = vshr_n_s16(b, 8); + // Sign extend by shifting left then shifting right. + int16x4_t b_even = vshr_n_s16(vshl_n_s16(b, 8), 8); + int16x4_t b_odd = vshr_n_s16(b, 8); - // multiply - int16x4_t prod1 = vmul_s16(a_even, b_even); - int16x4_t prod2 = vmul_s16(a_odd, b_odd); + // multiply + int16x4_t prod1 = vmul_s16(a_even, b_even); + int16x4_t prod2 = vmul_s16(a_odd, b_odd); - // saturated add - return vreinterpret_m64_s16(vqadd_s16(prod1, prod2)); + // saturated add + return vreinterpret_m64_s16(vqadd_s16(prod1, prod2)); } // Multiply packed signed 16-bit integers in a and b, producing intermediate @@ -7016,22 +7055,22 @@ FORCE_INLINE __m64 _mm_maddubs_pi16(__m64 _a, __m64 _b) // r7 := Round(((int32_t)a7 * (int32_t)b7) >> 15) FORCE_INLINE __m128i _mm_mulhrs_epi16(__m128i a, __m128i b) { - // Has issues due to saturation - // return vreinterpretq_m128i_s16(vqrdmulhq_s16(a, b)); + // Has issues due to saturation + // return vreinterpretq_m128i_s16(vqrdmulhq_s16(a, b)); - // Multiply - int32x4_t mul_lo = vmull_s16(vget_low_s16(vreinterpretq_s16_m128i(a)), - vget_low_s16(vreinterpretq_s16_m128i(b))); - int32x4_t mul_hi = vmull_s16(vget_high_s16(vreinterpretq_s16_m128i(a)), - vget_high_s16(vreinterpretq_s16_m128i(b))); + // Multiply + int32x4_t mul_lo = vmull_s16(vget_low_s16(vreinterpretq_s16_m128i(a)), + vget_low_s16(vreinterpretq_s16_m128i(b))); + int32x4_t mul_hi = vmull_s16(vget_high_s16(vreinterpretq_s16_m128i(a)), + vget_high_s16(vreinterpretq_s16_m128i(b))); - // Rounding narrowing shift right - // narrow = (int16_t)((mul + 16384) >> 15); - int16x4_t narrow_lo = vrshrn_n_s32(mul_lo, 15); - int16x4_t narrow_hi = vrshrn_n_s32(mul_hi, 15); + // Rounding narrowing shift right + // narrow = (int16_t)((mul + 16384) >> 15); + int16x4_t narrow_lo = vrshrn_n_s32(mul_lo, 15); + int16x4_t narrow_hi = vrshrn_n_s32(mul_hi, 15); - // Join together - return vreinterpretq_m128i_s16(vcombine_s16(narrow_lo, narrow_hi)); + // Join together + return vreinterpretq_m128i_s16(vcombine_s16(narrow_lo, narrow_hi)); } // Multiply packed signed 16-bit integers in a and b, producing intermediate @@ -7040,11 +7079,11 @@ FORCE_INLINE __m128i _mm_mulhrs_epi16(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mulhrs_pi16 FORCE_INLINE __m64 _mm_mulhrs_pi16(__m64 a, __m64 b) { - int32x4_t mul_extend = - vmull_s16((vreinterpret_s16_m64(a)), (vreinterpret_s16_m64(b))); + int32x4_t mul_extend = + vmull_s16((vreinterpret_s16_m64(a)), (vreinterpret_s16_m64(b))); - // Rounding narrowing shift right - return vreinterpret_m64_s16(vrshrn_n_s32(mul_extend, 15)); + // Rounding narrowing shift right + return vreinterpret_m64_s16(vrshrn_n_s32(mul_extend, 15)); } // Shuffle packed 8-bit integers in a according to shuffle control mask in the @@ -7052,28 +7091,28 @@ FORCE_INLINE __m64 _mm_mulhrs_pi16(__m64 a, __m64 b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_epi8 FORCE_INLINE __m128i _mm_shuffle_epi8(__m128i a, __m128i b) { - int8x16_t tbl = vreinterpretq_s8_m128i(a); // input a - uint8x16_t idx = vreinterpretq_u8_m128i(b); // input b - uint8x16_t idx_masked = - vandq_u8(idx, vdupq_n_u8(0x8F)); // avoid using meaningless bits + int8x16_t tbl = vreinterpretq_s8_m128i(a); // input a + uint8x16_t idx = vreinterpretq_u8_m128i(b); // input b + uint8x16_t idx_masked = + vandq_u8(idx, vdupq_n_u8(0x8F)); // avoid using meaningless bits #if defined(__aarch64__) - return vreinterpretq_m128i_s8(vqtbl1q_s8(tbl, idx_masked)); + return vreinterpretq_m128i_s8(vqtbl1q_s8(tbl, idx_masked)); #elif defined(__GNUC__) - int8x16_t ret; - // %e and %f represent the even and odd D registers - // respectively. - __asm__ __volatile__( - "vtbl.8 %e[ret], {%e[tbl], %f[tbl]}, %e[idx]\n" - "vtbl.8 %f[ret], {%e[tbl], %f[tbl]}, %f[idx]\n" - : [ret] "=&w"(ret) - : [tbl] "w"(tbl), [idx] "w"(idx_masked)); - return vreinterpretq_m128i_s8(ret); + int8x16_t ret; + // %e and %f represent the even and odd D registers + // respectively. + __asm__ __volatile__( + "vtbl.8 %e[ret], {%e[tbl], %f[tbl]}, %e[idx]\n" + "vtbl.8 %f[ret], {%e[tbl], %f[tbl]}, %f[idx]\n" + : [ret] "=&w"(ret) + : [tbl] "w"(tbl), [idx] "w"(idx_masked)); + return vreinterpretq_m128i_s8(ret); #else - // use this line if testing on aarch64 - int8x8x2_t a_split = {vget_low_s8(tbl), vget_high_s8(tbl)}; - return vreinterpretq_m128i_s8( - vcombine_s8(vtbl2_s8(a_split, vget_low_u8(idx_masked)), - vtbl2_s8(a_split, vget_high_u8(idx_masked)))); + // use this line if testing on aarch64 + int8x8x2_t a_split = {vget_low_s8(tbl), vget_high_s8(tbl)}; + return vreinterpretq_m128i_s8( + vcombine_s8(vtbl2_s8(a_split, vget_low_u8(idx_masked)), + vtbl2_s8(a_split, vget_high_u8(idx_masked)))); #endif } @@ -7093,10 +7132,10 @@ FORCE_INLINE __m128i _mm_shuffle_epi8(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_pi8 FORCE_INLINE __m64 _mm_shuffle_pi8(__m64 a, __m64 b) { - const int8x8_t controlMask = - vand_s8(vreinterpret_s8_m64(b), vdup_n_s8((int8_t)(0x1 << 7 | 0x07))); - int8x8_t res = vtbl1_s8(vreinterpret_s8_m64(a), controlMask); - return vreinterpret_m64_s8(res); + const int8x8_t controlMask = + vand_s8(vreinterpret_s8_m64(b), vdup_n_s8((int8_t)(0x1 << 7 | 0x07))); + int8x8_t res = vtbl1_s8(vreinterpret_s8_m64(a), controlMask); + return vreinterpret_m64_s8(res); } // Negate packed 16-bit integers in a when the corresponding signed @@ -7115,25 +7154,25 @@ FORCE_INLINE __m64 _mm_shuffle_pi8(__m64 a, __m64 b) // done FORCE_INLINE __m128i _mm_sign_epi16(__m128i _a, __m128i _b) { - int16x8_t a = vreinterpretq_s16_m128i(_a); - int16x8_t b = vreinterpretq_s16_m128i(_b); + int16x8_t a = vreinterpretq_s16_m128i(_a); + int16x8_t b = vreinterpretq_s16_m128i(_b); - // signed shift right: faster than vclt - // (b < 0) ? 0xFFFF : 0 - uint16x8_t ltMask = vreinterpretq_u16_s16(vshrq_n_s16(b, 15)); - // (b == 0) ? 0xFFFF : 0 + // signed shift right: faster than vclt + // (b < 0) ? 0xFFFF : 0 + uint16x8_t ltMask = vreinterpretq_u16_s16(vshrq_n_s16(b, 15)); + // (b == 0) ? 0xFFFF : 0 #if defined(__aarch64__) - int16x8_t zeroMask = vreinterpretq_s16_u16(vceqzq_s16(b)); + int16x8_t zeroMask = vreinterpretq_s16_u16(vceqzq_s16(b)); #else - int16x8_t zeroMask = vreinterpretq_s16_u16(vceqq_s16(b, vdupq_n_s16(0))); + int16x8_t zeroMask = vreinterpretq_s16_u16(vceqq_s16(b, vdupq_n_s16(0))); #endif - // bitwise select either a or negative 'a' (vnegq_s16(a) equals to negative - // 'a') based on ltMask - int16x8_t masked = vbslq_s16(ltMask, vnegq_s16(a), a); - // res = masked & (~zeroMask) - int16x8_t res = vbicq_s16(masked, zeroMask); - return vreinterpretq_m128i_s16(res); + // bitwise select either a or negative 'a' (vnegq_s16(a) equals to negative + // 'a') based on ltMask + int16x8_t masked = vbslq_s16(ltMask, vnegq_s16(a), a); + // res = masked & (~zeroMask) + int16x8_t res = vbicq_s16(masked, zeroMask); + return vreinterpretq_m128i_s16(res); } // Negate packed 32-bit integers in a when the corresponding signed @@ -7152,26 +7191,26 @@ FORCE_INLINE __m128i _mm_sign_epi16(__m128i _a, __m128i _b) // done FORCE_INLINE __m128i _mm_sign_epi32(__m128i _a, __m128i _b) { - int32x4_t a = vreinterpretq_s32_m128i(_a); - int32x4_t b = vreinterpretq_s32_m128i(_b); + int32x4_t a = vreinterpretq_s32_m128i(_a); + int32x4_t b = vreinterpretq_s32_m128i(_b); - // signed shift right: faster than vclt - // (b < 0) ? 0xFFFFFFFF : 0 - uint32x4_t ltMask = vreinterpretq_u32_s32(vshrq_n_s32(b, 31)); + // signed shift right: faster than vclt + // (b < 0) ? 0xFFFFFFFF : 0 + uint32x4_t ltMask = vreinterpretq_u32_s32(vshrq_n_s32(b, 31)); - // (b == 0) ? 0xFFFFFFFF : 0 + // (b == 0) ? 0xFFFFFFFF : 0 #if defined(__aarch64__) - int32x4_t zeroMask = vreinterpretq_s32_u32(vceqzq_s32(b)); + int32x4_t zeroMask = vreinterpretq_s32_u32(vceqzq_s32(b)); #else - int32x4_t zeroMask = vreinterpretq_s32_u32(vceqq_s32(b, vdupq_n_s32(0))); + int32x4_t zeroMask = vreinterpretq_s32_u32(vceqq_s32(b, vdupq_n_s32(0))); #endif - // bitwise select either a or negative 'a' (vnegq_s32(a) equals to negative - // 'a') based on ltMask - int32x4_t masked = vbslq_s32(ltMask, vnegq_s32(a), a); - // res = masked & (~zeroMask) - int32x4_t res = vbicq_s32(masked, zeroMask); - return vreinterpretq_m128i_s32(res); + // bitwise select either a or negative 'a' (vnegq_s32(a) equals to negative + // 'a') based on ltMask + int32x4_t masked = vbslq_s32(ltMask, vnegq_s32(a), a); + // res = masked & (~zeroMask) + int32x4_t res = vbicq_s32(masked, zeroMask); + return vreinterpretq_m128i_s32(res); } // Negate packed 8-bit integers in a when the corresponding signed @@ -7190,27 +7229,27 @@ FORCE_INLINE __m128i _mm_sign_epi32(__m128i _a, __m128i _b) // done FORCE_INLINE __m128i _mm_sign_epi8(__m128i _a, __m128i _b) { - int8x16_t a = vreinterpretq_s8_m128i(_a); - int8x16_t b = vreinterpretq_s8_m128i(_b); + int8x16_t a = vreinterpretq_s8_m128i(_a); + int8x16_t b = vreinterpretq_s8_m128i(_b); - // signed shift right: faster than vclt - // (b < 0) ? 0xFF : 0 - uint8x16_t ltMask = vreinterpretq_u8_s8(vshrq_n_s8(b, 7)); + // signed shift right: faster than vclt + // (b < 0) ? 0xFF : 0 + uint8x16_t ltMask = vreinterpretq_u8_s8(vshrq_n_s8(b, 7)); - // (b == 0) ? 0xFF : 0 + // (b == 0) ? 0xFF : 0 #if defined(__aarch64__) - int8x16_t zeroMask = vreinterpretq_s8_u8(vceqzq_s8(b)); + int8x16_t zeroMask = vreinterpretq_s8_u8(vceqzq_s8(b)); #else - int8x16_t zeroMask = vreinterpretq_s8_u8(vceqq_s8(b, vdupq_n_s8(0))); + int8x16_t zeroMask = vreinterpretq_s8_u8(vceqq_s8(b, vdupq_n_s8(0))); #endif - // bitwise select either a or nagative 'a' (vnegq_s8(a) return nagative 'a') - // based on ltMask - int8x16_t masked = vbslq_s8(ltMask, vnegq_s8(a), a); - // res = masked & (~zeroMask) - int8x16_t res = vbicq_s8(masked, zeroMask); + // bitwise select either a or nagative 'a' (vnegq_s8(a) return nagative 'a') + // based on ltMask + int8x16_t masked = vbslq_s8(ltMask, vnegq_s8(a), a); + // res = masked & (~zeroMask) + int8x16_t res = vbicq_s8(masked, zeroMask); - return vreinterpretq_m128i_s8(res); + return vreinterpretq_m128i_s8(res); } // Negate packed 16-bit integers in a when the corresponding signed 16-bit @@ -7231,27 +7270,27 @@ FORCE_INLINE __m128i _mm_sign_epi8(__m128i _a, __m128i _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sign_pi16 FORCE_INLINE __m64 _mm_sign_pi16(__m64 _a, __m64 _b) { - int16x4_t a = vreinterpret_s16_m64(_a); - int16x4_t b = vreinterpret_s16_m64(_b); + int16x4_t a = vreinterpret_s16_m64(_a); + int16x4_t b = vreinterpret_s16_m64(_b); - // signed shift right: faster than vclt - // (b < 0) ? 0xFFFF : 0 - uint16x4_t ltMask = vreinterpret_u16_s16(vshr_n_s16(b, 15)); + // signed shift right: faster than vclt + // (b < 0) ? 0xFFFF : 0 + uint16x4_t ltMask = vreinterpret_u16_s16(vshr_n_s16(b, 15)); - // (b == 0) ? 0xFFFF : 0 + // (b == 0) ? 0xFFFF : 0 #if defined(__aarch64__) - int16x4_t zeroMask = vreinterpret_s16_u16(vceqz_s16(b)); + int16x4_t zeroMask = vreinterpret_s16_u16(vceqz_s16(b)); #else - int16x4_t zeroMask = vreinterpret_s16_u16(vceq_s16(b, vdup_n_s16(0))); + int16x4_t zeroMask = vreinterpret_s16_u16(vceq_s16(b, vdup_n_s16(0))); #endif - // bitwise select either a or nagative 'a' (vneg_s16(a) return nagative 'a') - // based on ltMask - int16x4_t masked = vbsl_s16(ltMask, vneg_s16(a), a); - // res = masked & (~zeroMask) - int16x4_t res = vbic_s16(masked, zeroMask); + // bitwise select either a or nagative 'a' (vneg_s16(a) return nagative 'a') + // based on ltMask + int16x4_t masked = vbsl_s16(ltMask, vneg_s16(a), a); + // res = masked & (~zeroMask) + int16x4_t res = vbic_s16(masked, zeroMask); - return vreinterpret_m64_s16(res); + return vreinterpret_m64_s16(res); } // Negate packed 32-bit integers in a when the corresponding signed 32-bit @@ -7272,27 +7311,27 @@ FORCE_INLINE __m64 _mm_sign_pi16(__m64 _a, __m64 _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sign_pi32 FORCE_INLINE __m64 _mm_sign_pi32(__m64 _a, __m64 _b) { - int32x2_t a = vreinterpret_s32_m64(_a); - int32x2_t b = vreinterpret_s32_m64(_b); + int32x2_t a = vreinterpret_s32_m64(_a); + int32x2_t b = vreinterpret_s32_m64(_b); - // signed shift right: faster than vclt - // (b < 0) ? 0xFFFFFFFF : 0 - uint32x2_t ltMask = vreinterpret_u32_s32(vshr_n_s32(b, 31)); + // signed shift right: faster than vclt + // (b < 0) ? 0xFFFFFFFF : 0 + uint32x2_t ltMask = vreinterpret_u32_s32(vshr_n_s32(b, 31)); - // (b == 0) ? 0xFFFFFFFF : 0 + // (b == 0) ? 0xFFFFFFFF : 0 #if defined(__aarch64__) - int32x2_t zeroMask = vreinterpret_s32_u32(vceqz_s32(b)); + int32x2_t zeroMask = vreinterpret_s32_u32(vceqz_s32(b)); #else - int32x2_t zeroMask = vreinterpret_s32_u32(vceq_s32(b, vdup_n_s32(0))); + int32x2_t zeroMask = vreinterpret_s32_u32(vceq_s32(b, vdup_n_s32(0))); #endif - // bitwise select either a or nagative 'a' (vneg_s32(a) return nagative 'a') - // based on ltMask - int32x2_t masked = vbsl_s32(ltMask, vneg_s32(a), a); - // res = masked & (~zeroMask) - int32x2_t res = vbic_s32(masked, zeroMask); + // bitwise select either a or nagative 'a' (vneg_s32(a) return nagative 'a') + // based on ltMask + int32x2_t masked = vbsl_s32(ltMask, vneg_s32(a), a); + // res = masked & (~zeroMask) + int32x2_t res = vbic_s32(masked, zeroMask); - return vreinterpret_m64_s32(res); + return vreinterpret_m64_s32(res); } // Negate packed 8-bit integers in a when the corresponding signed 8-bit integer @@ -7313,27 +7352,27 @@ FORCE_INLINE __m64 _mm_sign_pi32(__m64 _a, __m64 _b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sign_pi8 FORCE_INLINE __m64 _mm_sign_pi8(__m64 _a, __m64 _b) { - int8x8_t a = vreinterpret_s8_m64(_a); - int8x8_t b = vreinterpret_s8_m64(_b); + int8x8_t a = vreinterpret_s8_m64(_a); + int8x8_t b = vreinterpret_s8_m64(_b); - // signed shift right: faster than vclt - // (b < 0) ? 0xFF : 0 - uint8x8_t ltMask = vreinterpret_u8_s8(vshr_n_s8(b, 7)); + // signed shift right: faster than vclt + // (b < 0) ? 0xFF : 0 + uint8x8_t ltMask = vreinterpret_u8_s8(vshr_n_s8(b, 7)); - // (b == 0) ? 0xFF : 0 + // (b == 0) ? 0xFF : 0 #if defined(__aarch64__) - int8x8_t zeroMask = vreinterpret_s8_u8(vceqz_s8(b)); + int8x8_t zeroMask = vreinterpret_s8_u8(vceqz_s8(b)); #else - int8x8_t zeroMask = vreinterpret_s8_u8(vceq_s8(b, vdup_n_s8(0))); + int8x8_t zeroMask = vreinterpret_s8_u8(vceq_s8(b, vdup_n_s8(0))); #endif - // bitwise select either a or nagative 'a' (vneg_s8(a) return nagative 'a') - // based on ltMask - int8x8_t masked = vbsl_s8(ltMask, vneg_s8(a), a); - // res = masked & (~zeroMask) - int8x8_t res = vbic_s8(masked, zeroMask); + // bitwise select either a or nagative 'a' (vneg_s8(a) return nagative 'a') + // based on ltMask + int8x8_t masked = vbsl_s8(ltMask, vneg_s8(a), a); + // res = masked & (~zeroMask) + int8x8_t res = vbic_s8(masked, zeroMask); - return vreinterpret_m64_s8(res); + return vreinterpret_m64_s8(res); } /* SSE4.1 */ @@ -7351,50 +7390,50 @@ FORCE_INLINE __m64 _mm_sign_pi8(__m64 _a, __m64 _b) // ENDFOR // FORCE_INLINE __m128i _mm_blend_epi16(__m128i a, __m128i b, // __constrange(0,255) int imm) -#define _mm_blend_epi16(a, b, imm) \ - __extension__({ \ - const uint16_t _mask[8] = {((imm) & (1 << 0)) ? (uint16_t) -1 : 0x0, \ - ((imm) & (1 << 1)) ? (uint16_t) -1 : 0x0, \ - ((imm) & (1 << 2)) ? (uint16_t) -1 : 0x0, \ - ((imm) & (1 << 3)) ? (uint16_t) -1 : 0x0, \ - ((imm) & (1 << 4)) ? (uint16_t) -1 : 0x0, \ - ((imm) & (1 << 5)) ? (uint16_t) -1 : 0x0, \ - ((imm) & (1 << 6)) ? (uint16_t) -1 : 0x0, \ - ((imm) & (1 << 7)) ? (uint16_t) -1 : 0x0}; \ - uint16x8_t _mask_vec = vld1q_u16(_mask); \ - uint16x8_t _a = vreinterpretq_u16_m128i(a); \ - uint16x8_t _b = vreinterpretq_u16_m128i(b); \ - vreinterpretq_m128i_u16(vbslq_u16(_mask_vec, _b, _a)); \ - }) +#define _mm_blend_epi16(a, b, imm) \ + __extension__({ \ + const uint16_t _mask[8] = {((imm) & (1 << 0)) ? (uint16_t)-1 : 0x0, \ + ((imm) & (1 << 1)) ? (uint16_t)-1 : 0x0, \ + ((imm) & (1 << 2)) ? (uint16_t)-1 : 0x0, \ + ((imm) & (1 << 3)) ? (uint16_t)-1 : 0x0, \ + ((imm) & (1 << 4)) ? (uint16_t)-1 : 0x0, \ + ((imm) & (1 << 5)) ? (uint16_t)-1 : 0x0, \ + ((imm) & (1 << 6)) ? (uint16_t)-1 : 0x0, \ + ((imm) & (1 << 7)) ? (uint16_t)-1 : 0x0}; \ + uint16x8_t _mask_vec = vld1q_u16(_mask); \ + uint16x8_t _a = vreinterpretq_u16_m128i(a); \ + uint16x8_t _b = vreinterpretq_u16_m128i(b); \ + vreinterpretq_m128i_u16(vbslq_u16(_mask_vec, _b, _a)); \ + }) // Blend packed double-precision (64-bit) floating-point elements from a and b // using control mask imm8, and store the results in dst. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_blend_pd #define _mm_blend_pd(a, b, imm) \ - __extension__({ \ - const uint64_t _mask[2] = { \ - ((imm) & (1 << 0)) ? ~UINT64_C(0) : UINT64_C(0), \ - ((imm) & (1 << 1)) ? ~UINT64_C(0) : UINT64_C(0)}; \ - uint64x2_t _mask_vec = vld1q_u64(_mask); \ - uint64x2_t _a = vreinterpretq_u64_m128d(a); \ - uint64x2_t _b = vreinterpretq_u64_m128d(b); \ - vreinterpretq_m128d_u64(vbslq_u64(_mask_vec, _b, _a)); \ - }) + __extension__({ \ + const uint64_t _mask[2] = { \ + ((imm) & (1 << 0)) ? ~UINT64_C(0) : UINT64_C(0), \ + ((imm) & (1 << 1)) ? ~UINT64_C(0) : UINT64_C(0)}; \ + uint64x2_t _mask_vec = vld1q_u64(_mask); \ + uint64x2_t _a = vreinterpretq_u64_m128d(a); \ + uint64x2_t _b = vreinterpretq_u64_m128d(b); \ + vreinterpretq_m128d_u64(vbslq_u64(_mask_vec, _b, _a)); \ + }) // Blend packed single-precision (32-bit) floating-point elements from a and b // using mask, and store the results in dst. // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_blend_ps FORCE_INLINE __m128 _mm_blend_ps(__m128 _a, __m128 _b, const char imm8) { - const uint32_t ALIGN_STRUCT(16) - data[4] = {((imm8) & (1 << 0)) ? UINT32_MAX : 0, - ((imm8) & (1 << 1)) ? UINT32_MAX : 0, - ((imm8) & (1 << 2)) ? UINT32_MAX : 0, - ((imm8) & (1 << 3)) ? UINT32_MAX : 0}; - uint32x4_t mask = vld1q_u32(data); - float32x4_t a = vreinterpretq_f32_m128(_a); - float32x4_t b = vreinterpretq_f32_m128(_b); - return vreinterpretq_m128_f32(vbslq_f32(mask, b, a)); + const uint32_t ALIGN_STRUCT(16) + data[4] = {((imm8) & (1 << 0)) ? UINT32_MAX : 0, + ((imm8) & (1 << 1)) ? UINT32_MAX : 0, + ((imm8) & (1 << 2)) ? UINT32_MAX : 0, + ((imm8) & (1 << 3)) ? UINT32_MAX : 0}; + uint32x4_t mask = vld1q_u32(data); + float32x4_t a = vreinterpretq_f32_m128(_a); + float32x4_t b = vreinterpretq_f32_m128(_b); + return vreinterpretq_m128_f32(vbslq_f32(mask, b, a)); } // Blend packed 8-bit integers from a and b using mask, and store the results in @@ -7410,12 +7449,12 @@ FORCE_INLINE __m128 _mm_blend_ps(__m128 _a, __m128 _b, const char imm8) // ENDFOR FORCE_INLINE __m128i _mm_blendv_epi8(__m128i _a, __m128i _b, __m128i _mask) { - // Use a signed shift right to create a mask with the sign bit - uint8x16_t mask = - vreinterpretq_u8_s8(vshrq_n_s8(vreinterpretq_s8_m128i(_mask), 7)); - uint8x16_t a = vreinterpretq_u8_m128i(_a); - uint8x16_t b = vreinterpretq_u8_m128i(_b); - return vreinterpretq_m128i_u8(vbslq_u8(mask, b, a)); + // Use a signed shift right to create a mask with the sign bit + uint8x16_t mask = + vreinterpretq_u8_s8(vshrq_n_s8(vreinterpretq_s8_m128i(_mask), 7)); + uint8x16_t a = vreinterpretq_u8_m128i(_a); + uint8x16_t b = vreinterpretq_u8_m128i(_b); + return vreinterpretq_m128i_u8(vbslq_u8(mask, b, a)); } // Blend packed double-precision (64-bit) floating-point elements from a and b @@ -7423,16 +7462,16 @@ FORCE_INLINE __m128i _mm_blendv_epi8(__m128i _a, __m128i _b, __m128i _mask) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_blendv_pd FORCE_INLINE __m128d _mm_blendv_pd(__m128d _a, __m128d _b, __m128d _mask) { - uint64x2_t mask = - vreinterpretq_u64_s64(vshrq_n_s64(vreinterpretq_s64_m128d(_mask), 63)); + uint64x2_t mask = + vreinterpretq_u64_s64(vshrq_n_s64(vreinterpretq_s64_m128d(_mask), 63)); #if defined(__aarch64__) - float64x2_t a = vreinterpretq_f64_m128d(_a); - float64x2_t b = vreinterpretq_f64_m128d(_b); - return vreinterpretq_m128d_f64(vbslq_f64(mask, b, a)); + float64x2_t a = vreinterpretq_f64_m128d(_a); + float64x2_t b = vreinterpretq_f64_m128d(_b); + return vreinterpretq_m128d_f64(vbslq_f64(mask, b, a)); #else - uint64x2_t a = vreinterpretq_u64_m128d(_a); - uint64x2_t b = vreinterpretq_u64_m128d(_b); - return vreinterpretq_m128d_u64(vbslq_u64(mask, b, a)); + uint64x2_t a = vreinterpretq_u64_m128d(_a); + uint64x2_t b = vreinterpretq_u64_m128d(_b); + return vreinterpretq_m128d_u64(vbslq_u64(mask, b, a)); #endif } @@ -7441,12 +7480,12 @@ FORCE_INLINE __m128d _mm_blendv_pd(__m128d _a, __m128d _b, __m128d _mask) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_blendv_ps FORCE_INLINE __m128 _mm_blendv_ps(__m128 _a, __m128 _b, __m128 _mask) { - // Use a signed shift right to create a mask with the sign bit - uint32x4_t mask = - vreinterpretq_u32_s32(vshrq_n_s32(vreinterpretq_s32_m128(_mask), 31)); - float32x4_t a = vreinterpretq_f32_m128(_a); - float32x4_t b = vreinterpretq_f32_m128(_b); - return vreinterpretq_m128_f32(vbslq_f32(mask, b, a)); + // Use a signed shift right to create a mask with the sign bit + uint32x4_t mask = + vreinterpretq_u32_s32(vshrq_n_s32(vreinterpretq_s32_m128(_mask), 31)); + float32x4_t a = vreinterpretq_f32_m128(_a); + float32x4_t b = vreinterpretq_f32_m128(_b); + return vreinterpretq_m128_f32(vbslq_f32(mask, b, a)); } // Round the packed double-precision (64-bit) floating-point elements in a up @@ -7456,10 +7495,10 @@ FORCE_INLINE __m128 _mm_blendv_ps(__m128 _a, __m128 _b, __m128 _mask) FORCE_INLINE __m128d _mm_ceil_pd(__m128d a) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64(vrndpq_f64(vreinterpretq_f64_m128d(a))); + return vreinterpretq_m128d_f64(vrndpq_f64(vreinterpretq_f64_m128d(a))); #else - double *f = (double *) &a; - return _mm_set_pd(ceil(f[1]), ceil(f[0])); + double* f = (double*)&a; + return _mm_set_pd(ceil(f[1]), ceil(f[0])); #endif } @@ -7470,10 +7509,10 @@ FORCE_INLINE __m128d _mm_ceil_pd(__m128d a) FORCE_INLINE __m128 _mm_ceil_ps(__m128 a) { #if defined(__aarch64__) - return vreinterpretq_m128_f32(vrndpq_f32(vreinterpretq_f32_m128(a))); + return vreinterpretq_m128_f32(vrndpq_f32(vreinterpretq_f32_m128(a))); #else - float *f = (float *) &a; - return _mm_set_ps(ceilf(f[3]), ceilf(f[2]), ceilf(f[1]), ceilf(f[0])); + float* f = (float*)&a; + return _mm_set_ps(ceilf(f[3]), ceilf(f[2]), ceilf(f[1]), ceilf(f[0])); #endif } @@ -7484,7 +7523,7 @@ FORCE_INLINE __m128 _mm_ceil_ps(__m128 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_ceil_sd FORCE_INLINE __m128d _mm_ceil_sd(__m128d a, __m128d b) { - return _mm_move_sd(a, _mm_ceil_pd(b)); + return _mm_move_sd(a, _mm_ceil_pd(b)); } // Round the lower single-precision (32-bit) floating-point element in b up to @@ -7498,7 +7537,7 @@ FORCE_INLINE __m128d _mm_ceil_sd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_ceil_ss FORCE_INLINE __m128 _mm_ceil_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_ceil_ps(b)); + return _mm_move_ss(a, _mm_ceil_ps(b)); } // Compare packed 64-bit integers in a and b for equality, and store the results @@ -7506,15 +7545,15 @@ FORCE_INLINE __m128 _mm_ceil_ss(__m128 a, __m128 b) FORCE_INLINE __m128i _mm_cmpeq_epi64(__m128i a, __m128i b) { #if defined(__aarch64__) - return vreinterpretq_m128i_u64( - vceqq_u64(vreinterpretq_u64_m128i(a), vreinterpretq_u64_m128i(b))); + return vreinterpretq_m128i_u64( + vceqq_u64(vreinterpretq_u64_m128i(a), vreinterpretq_u64_m128i(b))); #else - // ARMv7 lacks vceqq_u64 - // (a == b) -> (a_lo == b_lo) && (a_hi == b_hi) - uint32x4_t cmp = - vceqq_u32(vreinterpretq_u32_m128i(a), vreinterpretq_u32_m128i(b)); - uint32x4_t swapped = vrev64q_u32(cmp); - return vreinterpretq_m128i_u32(vandq_u32(cmp, swapped)); + // ARMv7 lacks vceqq_u64 + // (a == b) -> (a_lo == b_lo) && (a_hi == b_hi) + uint32x4_t cmp = + vceqq_u32(vreinterpretq_u32_m128i(a), vreinterpretq_u32_m128i(b)); + uint32x4_t swapped = vrev64q_u32(cmp); + return vreinterpretq_m128i_u32(vandq_u32(cmp, swapped)); #endif } @@ -7522,82 +7561,82 @@ FORCE_INLINE __m128i _mm_cmpeq_epi64(__m128i a, __m128i b) // 32-bit integers. FORCE_INLINE __m128i _mm_cvtepi16_epi32(__m128i a) { - return vreinterpretq_m128i_s32( - vmovl_s16(vget_low_s16(vreinterpretq_s16_m128i(a)))); + return vreinterpretq_m128i_s32( + vmovl_s16(vget_low_s16(vreinterpretq_s16_m128i(a)))); } // Converts the two signed 16-bit integers in the lower 32 bits two signed // 32-bit integers. FORCE_INLINE __m128i _mm_cvtepi16_epi64(__m128i a) { - int16x8_t s16x8 = vreinterpretq_s16_m128i(a); /* xxxx xxxx xxxx 0B0A */ - int32x4_t s32x4 = vmovl_s16(vget_low_s16(s16x8)); /* 000x 000x 000B 000A */ - int64x2_t s64x2 = vmovl_s32(vget_low_s32(s32x4)); /* 0000 000B 0000 000A */ - return vreinterpretq_m128i_s64(s64x2); + int16x8_t s16x8 = vreinterpretq_s16_m128i(a); /* xxxx xxxx xxxx 0B0A */ + int32x4_t s32x4 = vmovl_s16(vget_low_s16(s16x8)); /* 000x 000x 000B 000A */ + int64x2_t s64x2 = vmovl_s32(vget_low_s32(s32x4)); /* 0000 000B 0000 000A */ + return vreinterpretq_m128i_s64(s64x2); } // Converts the two signed 32-bit integers in the lower 64 bits to two signed // 64-bit integers. FORCE_INLINE __m128i _mm_cvtepi32_epi64(__m128i a) { - return vreinterpretq_m128i_s64( - vmovl_s32(vget_low_s32(vreinterpretq_s32_m128i(a)))); + return vreinterpretq_m128i_s64( + vmovl_s32(vget_low_s32(vreinterpretq_s32_m128i(a)))); } // Converts the four unsigned 8-bit integers in the lower 16 bits to four // unsigned 32-bit integers. FORCE_INLINE __m128i _mm_cvtepi8_epi16(__m128i a) { - int8x16_t s8x16 = vreinterpretq_s8_m128i(a); /* xxxx xxxx xxxx DCBA */ - int16x8_t s16x8 = vmovl_s8(vget_low_s8(s8x16)); /* 0x0x 0x0x 0D0C 0B0A */ - return vreinterpretq_m128i_s16(s16x8); + int8x16_t s8x16 = vreinterpretq_s8_m128i(a); /* xxxx xxxx xxxx DCBA */ + int16x8_t s16x8 = vmovl_s8(vget_low_s8(s8x16)); /* 0x0x 0x0x 0D0C 0B0A */ + return vreinterpretq_m128i_s16(s16x8); } // Converts the four unsigned 8-bit integers in the lower 32 bits to four // unsigned 32-bit integers. FORCE_INLINE __m128i _mm_cvtepi8_epi32(__m128i a) { - int8x16_t s8x16 = vreinterpretq_s8_m128i(a); /* xxxx xxxx xxxx DCBA */ - int16x8_t s16x8 = vmovl_s8(vget_low_s8(s8x16)); /* 0x0x 0x0x 0D0C 0B0A */ - int32x4_t s32x4 = vmovl_s16(vget_low_s16(s16x8)); /* 000D 000C 000B 000A */ - return vreinterpretq_m128i_s32(s32x4); + int8x16_t s8x16 = vreinterpretq_s8_m128i(a); /* xxxx xxxx xxxx DCBA */ + int16x8_t s16x8 = vmovl_s8(vget_low_s8(s8x16)); /* 0x0x 0x0x 0D0C 0B0A */ + int32x4_t s32x4 = vmovl_s16(vget_low_s16(s16x8)); /* 000D 000C 000B 000A */ + return vreinterpretq_m128i_s32(s32x4); } // Converts the two signed 8-bit integers in the lower 32 bits to four // signed 64-bit integers. FORCE_INLINE __m128i _mm_cvtepi8_epi64(__m128i a) { - int8x16_t s8x16 = vreinterpretq_s8_m128i(a); /* xxxx xxxx xxxx xxBA */ - int16x8_t s16x8 = vmovl_s8(vget_low_s8(s8x16)); /* 0x0x 0x0x 0x0x 0B0A */ - int32x4_t s32x4 = vmovl_s16(vget_low_s16(s16x8)); /* 000x 000x 000B 000A */ - int64x2_t s64x2 = vmovl_s32(vget_low_s32(s32x4)); /* 0000 000B 0000 000A */ - return vreinterpretq_m128i_s64(s64x2); + int8x16_t s8x16 = vreinterpretq_s8_m128i(a); /* xxxx xxxx xxxx xxBA */ + int16x8_t s16x8 = vmovl_s8(vget_low_s8(s8x16)); /* 0x0x 0x0x 0x0x 0B0A */ + int32x4_t s32x4 = vmovl_s16(vget_low_s16(s16x8)); /* 000x 000x 000B 000A */ + int64x2_t s64x2 = vmovl_s32(vget_low_s32(s32x4)); /* 0000 000B 0000 000A */ + return vreinterpretq_m128i_s64(s64x2); } // Converts the four unsigned 16-bit integers in the lower 64 bits to four // unsigned 32-bit integers. FORCE_INLINE __m128i _mm_cvtepu16_epi32(__m128i a) { - return vreinterpretq_m128i_u32( - vmovl_u16(vget_low_u16(vreinterpretq_u16_m128i(a)))); + return vreinterpretq_m128i_u32( + vmovl_u16(vget_low_u16(vreinterpretq_u16_m128i(a)))); } // Converts the two unsigned 16-bit integers in the lower 32 bits to two // unsigned 64-bit integers. FORCE_INLINE __m128i _mm_cvtepu16_epi64(__m128i a) { - uint16x8_t u16x8 = vreinterpretq_u16_m128i(a); /* xxxx xxxx xxxx 0B0A */ - uint32x4_t u32x4 = vmovl_u16(vget_low_u16(u16x8)); /* 000x 000x 000B 000A */ - uint64x2_t u64x2 = vmovl_u32(vget_low_u32(u32x4)); /* 0000 000B 0000 000A */ - return vreinterpretq_m128i_u64(u64x2); + uint16x8_t u16x8 = vreinterpretq_u16_m128i(a); /* xxxx xxxx xxxx 0B0A */ + uint32x4_t u32x4 = vmovl_u16(vget_low_u16(u16x8)); /* 000x 000x 000B 000A */ + uint64x2_t u64x2 = vmovl_u32(vget_low_u32(u32x4)); /* 0000 000B 0000 000A */ + return vreinterpretq_m128i_u64(u64x2); } // Converts the two unsigned 32-bit integers in the lower 64 bits to two // unsigned 64-bit integers. FORCE_INLINE __m128i _mm_cvtepu32_epi64(__m128i a) { - return vreinterpretq_m128i_u64( - vmovl_u32(vget_low_u32(vreinterpretq_u32_m128i(a)))); + return vreinterpretq_m128i_u64( + vmovl_u32(vget_low_u32(vreinterpretq_u32_m128i(a)))); } // Zero extend packed unsigned 8-bit integers in a to packed 16-bit integers, @@ -7605,9 +7644,9 @@ FORCE_INLINE __m128i _mm_cvtepu32_epi64(__m128i a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtepu8_epi16 FORCE_INLINE __m128i _mm_cvtepu8_epi16(__m128i a) { - uint8x16_t u8x16 = vreinterpretq_u8_m128i(a); /* xxxx xxxx HGFE DCBA */ - uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0H0G 0F0E 0D0C 0B0A */ - return vreinterpretq_m128i_u16(u16x8); + uint8x16_t u8x16 = vreinterpretq_u8_m128i(a); /* xxxx xxxx HGFE DCBA */ + uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0H0G 0F0E 0D0C 0B0A */ + return vreinterpretq_m128i_u16(u16x8); } // Converts the four unsigned 8-bit integers in the lower 32 bits to four @@ -7615,21 +7654,21 @@ FORCE_INLINE __m128i _mm_cvtepu8_epi16(__m128i a) // https://msdn.microsoft.com/en-us/library/bb531467%28v=vs.100%29.aspx FORCE_INLINE __m128i _mm_cvtepu8_epi32(__m128i a) { - uint8x16_t u8x16 = vreinterpretq_u8_m128i(a); /* xxxx xxxx xxxx DCBA */ - uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0x0x 0x0x 0D0C 0B0A */ - uint32x4_t u32x4 = vmovl_u16(vget_low_u16(u16x8)); /* 000D 000C 000B 000A */ - return vreinterpretq_m128i_u32(u32x4); + uint8x16_t u8x16 = vreinterpretq_u8_m128i(a); /* xxxx xxxx xxxx DCBA */ + uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0x0x 0x0x 0D0C 0B0A */ + uint32x4_t u32x4 = vmovl_u16(vget_low_u16(u16x8)); /* 000D 000C 000B 000A */ + return vreinterpretq_m128i_u32(u32x4); } // Converts the two unsigned 8-bit integers in the lower 16 bits to two // unsigned 64-bit integers. FORCE_INLINE __m128i _mm_cvtepu8_epi64(__m128i a) { - uint8x16_t u8x16 = vreinterpretq_u8_m128i(a); /* xxxx xxxx xxxx xxBA */ - uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0x0x 0x0x 0x0x 0B0A */ - uint32x4_t u32x4 = vmovl_u16(vget_low_u16(u16x8)); /* 000x 000x 000B 000A */ - uint64x2_t u64x2 = vmovl_u32(vget_low_u32(u32x4)); /* 0000 000B 0000 000A */ - return vreinterpretq_m128i_u64(u64x2); + uint8x16_t u8x16 = vreinterpretq_u8_m128i(a); /* xxxx xxxx xxxx xxBA */ + uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0x0x 0x0x 0x0x 0B0A */ + uint32x4_t u32x4 = vmovl_u16(vget_low_u16(u16x8)); /* 000x 000x 000B 000A */ + uint64x2_t u64x2 = vmovl_u32(vget_low_u32(u32x4)); /* 0000 000B 0000 000A */ + return vreinterpretq_m128i_u64(u64x2); } // Conditionally multiply the packed double-precision (64-bit) floating-point @@ -7638,44 +7677,44 @@ FORCE_INLINE __m128i _mm_cvtepu8_epi64(__m128i a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_dp_pd FORCE_INLINE __m128d _mm_dp_pd(__m128d a, __m128d b, const int imm) { - // Generate mask value from constant immediate bit value - const int64_t bit0Mask = imm & 0x01 ? UINT64_MAX : 0; - const int64_t bit1Mask = imm & 0x02 ? UINT64_MAX : 0; + // Generate mask value from constant immediate bit value + const int64_t bit0Mask = imm & 0x01 ? UINT64_MAX : 0; + const int64_t bit1Mask = imm & 0x02 ? UINT64_MAX : 0; #if !SSE2NEON_PRECISE_DP - const int64_t bit4Mask = imm & 0x10 ? UINT64_MAX : 0; - const int64_t bit5Mask = imm & 0x20 ? UINT64_MAX : 0; + const int64_t bit4Mask = imm & 0x10 ? UINT64_MAX : 0; + const int64_t bit5Mask = imm & 0x20 ? UINT64_MAX : 0; #endif - // Conditional multiplication + // Conditional multiplication #if !SSE2NEON_PRECISE_DP - __m128d mul = _mm_mul_pd(a, b); - const __m128d mulMask = - _mm_castsi128_pd(_mm_set_epi64x(bit5Mask, bit4Mask)); - __m128d tmp = _mm_and_pd(mul, mulMask); + __m128d mul = _mm_mul_pd(a, b); + const __m128d mulMask = + _mm_castsi128_pd(_mm_set_epi64x(bit5Mask, bit4Mask)); + __m128d tmp = _mm_and_pd(mul, mulMask); #else #if defined(__aarch64__) - double d0 = (imm & 0x10) ? vgetq_lane_f64(vreinterpretq_f64_m128d(a), 0) * - vgetq_lane_f64(vreinterpretq_f64_m128d(b), 0) - : 0; - double d1 = (imm & 0x20) ? vgetq_lane_f64(vreinterpretq_f64_m128d(a), 1) * - vgetq_lane_f64(vreinterpretq_f64_m128d(b), 1) - : 0; + double d0 = (imm & 0x10) ? vgetq_lane_f64(vreinterpretq_f64_m128d(a), 0) * + vgetq_lane_f64(vreinterpretq_f64_m128d(b), 0) : + 0; + double d1 = (imm & 0x20) ? vgetq_lane_f64(vreinterpretq_f64_m128d(a), 1) * + vgetq_lane_f64(vreinterpretq_f64_m128d(b), 1) : + 0; #else - double d0 = (imm & 0x10) ? ((double *) &a)[0] * ((double *) &b)[0] : 0; - double d1 = (imm & 0x20) ? ((double *) &a)[1] * ((double *) &b)[1] : 0; + double d0 = (imm & 0x10) ? ((double*)&a)[0] * ((double*)&b)[0] : 0; + double d1 = (imm & 0x20) ? ((double*)&a)[1] * ((double*)&b)[1] : 0; #endif - __m128d tmp = _mm_set_pd(d1, d0); + __m128d tmp = _mm_set_pd(d1, d0); #endif - // Sum the products + // Sum the products #if defined(__aarch64__) - double sum = vpaddd_f64(vreinterpretq_f64_m128d(tmp)); + double sum = vpaddd_f64(vreinterpretq_f64_m128d(tmp)); #else - double sum = *((double *) &tmp) + *(((double *) &tmp) + 1); + double sum = *((double*)&tmp) + *(((double*)&tmp) + 1); #endif - // Conditionally store the sum - const __m128d sumMask = - _mm_castsi128_pd(_mm_set_epi64x(bit1Mask, bit0Mask)); - __m128d res = _mm_and_pd(_mm_set_pd1(sum), sumMask); - return res; + // Conditionally store the sum + const __m128d sumMask = + _mm_castsi128_pd(_mm_set_epi64x(bit1Mask, bit0Mask)); + __m128d res = _mm_and_pd(_mm_set_pd1(sum), sumMask); + return res; } // Conditionally multiply the packed single-precision (32-bit) floating-point @@ -7685,54 +7724,56 @@ FORCE_INLINE __m128d _mm_dp_pd(__m128d a, __m128d b, const int imm) FORCE_INLINE __m128 _mm_dp_ps(__m128 a, __m128 b, const int imm) { #if defined(__aarch64__) - /* shortcuts */ - if (imm == 0xFF) { - return _mm_set1_ps(vaddvq_f32(_mm_mul_ps(a, b))); - } - if (imm == 0x7F) { - float32x4_t m = _mm_mul_ps(a, b); - m[3] = 0; - return _mm_set1_ps(vaddvq_f32(m)); - } + /* shortcuts */ + if (imm == 0xFF) + { + return _mm_set1_ps(vaddvq_f32(_mm_mul_ps(a, b))); + } + if (imm == 0x7F) + { + float32x4_t m = _mm_mul_ps(a, b); + m[3] = 0; + return _mm_set1_ps(vaddvq_f32(m)); + } #endif - float s = 0, c = 0; - float32x4_t f32a = vreinterpretq_f32_m128(a); - float32x4_t f32b = vreinterpretq_f32_m128(b); + float s = 0, c = 0; + float32x4_t f32a = vreinterpretq_f32_m128(a); + float32x4_t f32b = vreinterpretq_f32_m128(b); - /* To improve the accuracy of floating-point summation, Kahan algorithm - * is used for each operation. - */ - if (imm & (1 << 4)) - _sse2neon_kadd_f32(&s, &c, f32a[0] * f32b[0]); - if (imm & (1 << 5)) - _sse2neon_kadd_f32(&s, &c, f32a[1] * f32b[1]); - if (imm & (1 << 6)) - _sse2neon_kadd_f32(&s, &c, f32a[2] * f32b[2]); - if (imm & (1 << 7)) - _sse2neon_kadd_f32(&s, &c, f32a[3] * f32b[3]); - s += c; + /* To improve the accuracy of floating-point summation, Kahan algorithm + * is used for each operation. + */ + if (imm & (1 << 4)) + _sse2neon_kadd_f32(&s, &c, f32a[0] * f32b[0]); + if (imm & (1 << 5)) + _sse2neon_kadd_f32(&s, &c, f32a[1] * f32b[1]); + if (imm & (1 << 6)) + _sse2neon_kadd_f32(&s, &c, f32a[2] * f32b[2]); + if (imm & (1 << 7)) + _sse2neon_kadd_f32(&s, &c, f32a[3] * f32b[3]); + s += c; - float32x4_t res = { - (imm & 0x1) ? s : 0, - (imm & 0x2) ? s : 0, - (imm & 0x4) ? s : 0, - (imm & 0x8) ? s : 0, - }; - return vreinterpretq_m128_f32(res); + float32x4_t res = { + (imm & 0x1) ? s : 0, + (imm & 0x2) ? s : 0, + (imm & 0x4) ? s : 0, + (imm & 0x8) ? s : 0, + }; + return vreinterpretq_m128_f32(res); } // Extracts the selected signed or unsigned 32-bit integer from a and zero // extends. // FORCE_INLINE int _mm_extract_epi32(__m128i a, __constrange(0,4) int imm) #define _mm_extract_epi32(a, imm) \ - vgetq_lane_s32(vreinterpretq_s32_m128i(a), (imm)) + vgetq_lane_s32(vreinterpretq_s32_m128i(a), (imm)) // Extracts the selected signed or unsigned 64-bit integer from a and zero // extends. // FORCE_INLINE __int64 _mm_extract_epi64(__m128i a, __constrange(0,2) int imm) #define _mm_extract_epi64(a, imm) \ - vgetq_lane_s64(vreinterpretq_s64_m128i(a), (imm)) + vgetq_lane_s64(vreinterpretq_s64_m128i(a), (imm)) // Extracts the selected signed or unsigned 8-bit integer from a and zero // extends. @@ -7751,10 +7792,10 @@ FORCE_INLINE __m128 _mm_dp_ps(__m128 a, __m128 b, const int imm) FORCE_INLINE __m128d _mm_floor_pd(__m128d a) { #if defined(__aarch64__) - return vreinterpretq_m128d_f64(vrndmq_f64(vreinterpretq_f64_m128d(a))); + return vreinterpretq_m128d_f64(vrndmq_f64(vreinterpretq_f64_m128d(a))); #else - double *f = (double *) &a; - return _mm_set_pd(floor(f[1]), floor(f[0])); + double* f = (double*)&a; + return _mm_set_pd(floor(f[1]), floor(f[0])); #endif } @@ -7765,10 +7806,10 @@ FORCE_INLINE __m128d _mm_floor_pd(__m128d a) FORCE_INLINE __m128 _mm_floor_ps(__m128 a) { #if defined(__aarch64__) - return vreinterpretq_m128_f32(vrndmq_f32(vreinterpretq_f32_m128(a))); + return vreinterpretq_m128_f32(vrndmq_f32(vreinterpretq_f32_m128(a))); #else - float *f = (float *) &a; - return _mm_set_ps(floorf(f[3]), floorf(f[2]), floorf(f[1]), floorf(f[0])); + float* f = (float*)&a; + return _mm_set_ps(floorf(f[3]), floorf(f[2]), floorf(f[1]), floorf(f[0])); #endif } @@ -7779,7 +7820,7 @@ FORCE_INLINE __m128 _mm_floor_ps(__m128 a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_floor_sd FORCE_INLINE __m128d _mm_floor_sd(__m128d a, __m128d b) { - return _mm_move_sd(a, _mm_floor_pd(b)); + return _mm_move_sd(a, _mm_floor_pd(b)); } // Round the lower single-precision (32-bit) floating-point element in b down to @@ -7793,7 +7834,7 @@ FORCE_INLINE __m128d _mm_floor_sd(__m128d a, __m128d b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_floor_ss FORCE_INLINE __m128 _mm_floor_ss(__m128 a, __m128 b) { - return _mm_move_ss(a, _mm_floor_ps(b)); + return _mm_move_ss(a, _mm_floor_ps(b)); } // Inserts the least significant 32 bits of b into the selected 32-bit integer @@ -7801,53 +7842,53 @@ FORCE_INLINE __m128 _mm_floor_ss(__m128 a, __m128 b) // FORCE_INLINE __m128i _mm_insert_epi32(__m128i a, int b, // __constrange(0,4) int imm) #define _mm_insert_epi32(a, b, imm) \ - __extension__({ \ - vreinterpretq_m128i_s32( \ - vsetq_lane_s32((b), vreinterpretq_s32_m128i(a), (imm))); \ - }) + __extension__({ \ + vreinterpretq_m128i_s32( \ + vsetq_lane_s32((b), vreinterpretq_s32_m128i(a), (imm))); \ + }) // Inserts the least significant 64 bits of b into the selected 64-bit integer // of a. // FORCE_INLINE __m128i _mm_insert_epi64(__m128i a, __int64 b, // __constrange(0,2) int imm) #define _mm_insert_epi64(a, b, imm) \ - __extension__({ \ - vreinterpretq_m128i_s64( \ - vsetq_lane_s64((b), vreinterpretq_s64_m128i(a), (imm))); \ - }) + __extension__({ \ + vreinterpretq_m128i_s64( \ + vsetq_lane_s64((b), vreinterpretq_s64_m128i(a), (imm))); \ + }) // Inserts the least significant 8 bits of b into the selected 8-bit integer // of a. // FORCE_INLINE __m128i _mm_insert_epi8(__m128i a, int b, // __constrange(0,16) int imm) #define _mm_insert_epi8(a, b, imm) \ - __extension__({ \ - vreinterpretq_m128i_s8( \ - vsetq_lane_s8((b), vreinterpretq_s8_m128i(a), (imm))); \ - }) + __extension__({ \ + vreinterpretq_m128i_s8( \ + vsetq_lane_s8((b), vreinterpretq_s8_m128i(a), (imm))); \ + }) // Copy a to tmp, then insert a single-precision (32-bit) floating-point // element from b into tmp using the control in imm8. Store tmp to dst using // the mask in imm8 (elements are zeroed out when the corresponding bit is set). // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=insert_ps #define _mm_insert_ps(a, b, imm8) \ - __extension__({ \ - float32x4_t tmp1 = \ - vsetq_lane_f32(vgetq_lane_f32(b, (imm8 >> 6) & 0x3), \ - vreinterpretq_f32_m128(a), 0); \ - float32x4_t tmp2 = \ - vsetq_lane_f32(vgetq_lane_f32(tmp1, 0), vreinterpretq_f32_m128(a), \ - ((imm8 >> 4) & 0x3)); \ - const uint32_t data[4] = {((imm8) & (1 << 0)) ? UINT32_MAX : 0, \ - ((imm8) & (1 << 1)) ? UINT32_MAX : 0, \ - ((imm8) & (1 << 2)) ? UINT32_MAX : 0, \ - ((imm8) & (1 << 3)) ? UINT32_MAX : 0}; \ - uint32x4_t mask = vld1q_u32(data); \ - float32x4_t all_zeros = vdupq_n_f32(0); \ + __extension__({ \ + float32x4_t tmp1 = \ + vsetq_lane_f32(vgetq_lane_f32(b, (imm8 >> 6) & 0x3), \ + vreinterpretq_f32_m128(a), 0); \ + float32x4_t tmp2 = \ + vsetq_lane_f32(vgetq_lane_f32(tmp1, 0), vreinterpretq_f32_m128(a), \ + ((imm8 >> 4) & 0x3)); \ + const uint32_t data[4] = {((imm8) & (1 << 0)) ? UINT32_MAX : 0, \ + ((imm8) & (1 << 1)) ? UINT32_MAX : 0, \ + ((imm8) & (1 << 2)) ? UINT32_MAX : 0, \ + ((imm8) & (1 << 3)) ? UINT32_MAX : 0}; \ + uint32x4_t mask = vld1q_u32(data); \ + float32x4_t all_zeros = vdupq_n_f32(0); \ \ - vreinterpretq_m128_f32( \ - vbslq_f32(mask, all_zeros, vreinterpretq_f32_m128(tmp2))); \ - }) + vreinterpretq_m128_f32( \ + vbslq_f32(mask, all_zeros, vreinterpretq_f32_m128(tmp2))); \ + }) // epi versions of min/max // Computes the pariwise maximums of the four signed 32-bit integer values of a @@ -7862,8 +7903,8 @@ FORCE_INLINE __m128 _mm_floor_ss(__m128 a, __m128 b) // https://msdn.microsoft.com/en-us/library/vstudio/bb514055(v=vs.100).aspx FORCE_INLINE __m128i _mm_max_epi32(__m128i a, __m128i b) { - return vreinterpretq_m128i_s32( - vmaxq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_s32( + vmaxq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); } // Compare packed signed 8-bit integers in a and b, and store packed maximum @@ -7871,8 +7912,8 @@ FORCE_INLINE __m128i _mm_max_epi32(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epi8 FORCE_INLINE __m128i _mm_max_epi8(__m128i a, __m128i b) { - return vreinterpretq_m128i_s8( - vmaxq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); + return vreinterpretq_m128i_s8( + vmaxq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); } // Compare packed unsigned 16-bit integers in a and b, and store packed maximum @@ -7880,8 +7921,8 @@ FORCE_INLINE __m128i _mm_max_epi8(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epu16 FORCE_INLINE __m128i _mm_max_epu16(__m128i a, __m128i b) { - return vreinterpretq_m128i_u16( - vmaxq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b))); + return vreinterpretq_m128i_u16( + vmaxq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b))); } // Compare packed unsigned 32-bit integers in a and b, and store packed maximum @@ -7889,8 +7930,8 @@ FORCE_INLINE __m128i _mm_max_epu16(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epu32 FORCE_INLINE __m128i _mm_max_epu32(__m128i a, __m128i b) { - return vreinterpretq_m128i_u32( - vmaxq_u32(vreinterpretq_u32_m128i(a), vreinterpretq_u32_m128i(b))); + return vreinterpretq_m128i_u32( + vmaxq_u32(vreinterpretq_u32_m128i(a), vreinterpretq_u32_m128i(b))); } // Computes the pariwise minima of the four signed 32-bit integer values of a @@ -7905,8 +7946,8 @@ FORCE_INLINE __m128i _mm_max_epu32(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/vstudio/bb531476(v=vs.100).aspx FORCE_INLINE __m128i _mm_min_epi32(__m128i a, __m128i b) { - return vreinterpretq_m128i_s32( - vminq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_s32( + vminq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); } // Compare packed signed 8-bit integers in a and b, and store packed minimum @@ -7914,8 +7955,8 @@ FORCE_INLINE __m128i _mm_min_epi32(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_epi8 FORCE_INLINE __m128i _mm_min_epi8(__m128i a, __m128i b) { - return vreinterpretq_m128i_s8( - vminq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); + return vreinterpretq_m128i_s8( + vminq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b))); } // Compare packed unsigned 16-bit integers in a and b, and store packed minimum @@ -7923,8 +7964,8 @@ FORCE_INLINE __m128i _mm_min_epi8(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_epu16 FORCE_INLINE __m128i _mm_min_epu16(__m128i a, __m128i b) { - return vreinterpretq_m128i_u16( - vminq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b))); + return vreinterpretq_m128i_u16( + vminq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b))); } // Compare packed unsigned 32-bit integers in a and b, and store packed minimum @@ -7932,8 +7973,8 @@ FORCE_INLINE __m128i _mm_min_epu16(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epu32 FORCE_INLINE __m128i _mm_min_epu32(__m128i a, __m128i b) { - return vreinterpretq_m128i_u32( - vminq_u32(vreinterpretq_u32_m128i(a), vreinterpretq_u32_m128i(b))); + return vreinterpretq_m128i_u32( + vminq_u32(vreinterpretq_u32_m128i(a), vreinterpretq_u32_m128i(b))); } // Horizontally compute the minimum amongst the packed unsigned 16-bit integers @@ -7955,38 +7996,40 @@ FORCE_INLINE __m128i _mm_min_epu32(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_minpos_epu16 FORCE_INLINE __m128i _mm_minpos_epu16(__m128i a) { - __m128i dst; - uint16_t min, idx = 0; - // Find the minimum value + __m128i dst; + uint16_t min, idx = 0; + // Find the minimum value #if defined(__aarch64__) - min = vminvq_u16(vreinterpretq_u16_m128i(a)); + min = vminvq_u16(vreinterpretq_u16_m128i(a)); #else - __m64 tmp; - tmp = vreinterpret_m64_u16( - vmin_u16(vget_low_u16(vreinterpretq_u16_m128i(a)), - vget_high_u16(vreinterpretq_u16_m128i(a)))); - tmp = vreinterpret_m64_u16( - vpmin_u16(vreinterpret_u16_m64(tmp), vreinterpret_u16_m64(tmp))); - tmp = vreinterpret_m64_u16( - vpmin_u16(vreinterpret_u16_m64(tmp), vreinterpret_u16_m64(tmp))); - min = vget_lane_u16(vreinterpret_u16_m64(tmp), 0); + __m64 tmp; + tmp = vreinterpret_m64_u16( + vmin_u16(vget_low_u16(vreinterpretq_u16_m128i(a)), + vget_high_u16(vreinterpretq_u16_m128i(a)))); + tmp = vreinterpret_m64_u16( + vpmin_u16(vreinterpret_u16_m64(tmp), vreinterpret_u16_m64(tmp))); + tmp = vreinterpret_m64_u16( + vpmin_u16(vreinterpret_u16_m64(tmp), vreinterpret_u16_m64(tmp))); + min = vget_lane_u16(vreinterpret_u16_m64(tmp), 0); #endif - // Get the index of the minimum value - int i; - for (i = 0; i < 8; i++) { - if (min == vgetq_lane_u16(vreinterpretq_u16_m128i(a), 0)) { - idx = (uint16_t) i; - break; - } - a = _mm_srli_si128(a, 2); - } - // Generate result - dst = _mm_setzero_si128(); - dst = vreinterpretq_m128i_u16( - vsetq_lane_u16(min, vreinterpretq_u16_m128i(dst), 0)); - dst = vreinterpretq_m128i_u16( - vsetq_lane_u16(idx, vreinterpretq_u16_m128i(dst), 1)); - return dst; + // Get the index of the minimum value + int i; + for (i = 0; i < 8; i++) + { + if (min == vgetq_lane_u16(vreinterpretq_u16_m128i(a), 0)) + { + idx = (uint16_t)i; + break; + } + a = _mm_srli_si128(a, 2); + } + // Generate result + dst = _mm_setzero_si128(); + dst = vreinterpretq_m128i_u16( + vsetq_lane_u16(min, vreinterpretq_u16_m128i(dst), 0)); + dst = vreinterpretq_m128i_u16( + vsetq_lane_u16(idx, vreinterpretq_u16_m128i(dst), 1)); + return dst; } // Compute the sum of absolute differences (SADs) of quadruplets of unsigned @@ -7998,78 +8041,80 @@ FORCE_INLINE __m128i _mm_minpos_epu16(__m128i a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mpsadbw_epu8 FORCE_INLINE __m128i _mm_mpsadbw_epu8(__m128i a, __m128i b, const int imm) { - uint8x16_t _a, _b; + uint8x16_t _a, _b; - switch (imm & 0x4) { - case 0: - // do nothing - _a = vreinterpretq_u8_m128i(a); - break; - case 4: - _a = vreinterpretq_u8_u32(vextq_u32(vreinterpretq_u32_m128i(a), - vreinterpretq_u32_m128i(a), 1)); - break; - default: + switch (imm & 0x4) + { + case 0: + // do nothing + _a = vreinterpretq_u8_m128i(a); + break; + case 4: + _a = vreinterpretq_u8_u32(vextq_u32(vreinterpretq_u32_m128i(a), + vreinterpretq_u32_m128i(a), 1)); + break; + default: #if defined(__GNUC__) || defined(__clang__) - __builtin_unreachable(); + __builtin_unreachable(); #endif - break; - } + break; + } - switch (imm & 0x3) { - case 0: - _b = vreinterpretq_u8_u32( - vdupq_n_u32(vgetq_lane_u32(vreinterpretq_u32_m128i(b), 0))); - break; - case 1: - _b = vreinterpretq_u8_u32( - vdupq_n_u32(vgetq_lane_u32(vreinterpretq_u32_m128i(b), 1))); - break; - case 2: - _b = vreinterpretq_u8_u32( - vdupq_n_u32(vgetq_lane_u32(vreinterpretq_u32_m128i(b), 2))); - break; - case 3: - _b = vreinterpretq_u8_u32( - vdupq_n_u32(vgetq_lane_u32(vreinterpretq_u32_m128i(b), 3))); - break; - default: + switch (imm & 0x3) + { + case 0: + _b = vreinterpretq_u8_u32( + vdupq_n_u32(vgetq_lane_u32(vreinterpretq_u32_m128i(b), 0))); + break; + case 1: + _b = vreinterpretq_u8_u32( + vdupq_n_u32(vgetq_lane_u32(vreinterpretq_u32_m128i(b), 1))); + break; + case 2: + _b = vreinterpretq_u8_u32( + vdupq_n_u32(vgetq_lane_u32(vreinterpretq_u32_m128i(b), 2))); + break; + case 3: + _b = vreinterpretq_u8_u32( + vdupq_n_u32(vgetq_lane_u32(vreinterpretq_u32_m128i(b), 3))); + break; + default: #if defined(__GNUC__) || defined(__clang__) - __builtin_unreachable(); + __builtin_unreachable(); #endif - break; - } + break; + } - int16x8_t c04, c15, c26, c37; - uint8x8_t low_b = vget_low_u8(_b); - c04 = vabsq_s16(vreinterpretq_s16_u16(vsubl_u8(vget_low_u8(_a), low_b))); - _a = vextq_u8(_a, _a, 1); - c15 = vabsq_s16(vreinterpretq_s16_u16(vsubl_u8(vget_low_u8(_a), low_b))); - _a = vextq_u8(_a, _a, 1); - c26 = vabsq_s16(vreinterpretq_s16_u16(vsubl_u8(vget_low_u8(_a), low_b))); - _a = vextq_u8(_a, _a, 1); - c37 = vabsq_s16(vreinterpretq_s16_u16(vsubl_u8(vget_low_u8(_a), low_b))); + int16x8_t c04, c15, c26, c37; + uint8x8_t low_b = vget_low_u8(_b); + c04 = vabsq_s16(vreinterpretq_s16_u16(vsubl_u8(vget_low_u8(_a), low_b))); + _a = vextq_u8(_a, _a, 1); + c15 = vabsq_s16(vreinterpretq_s16_u16(vsubl_u8(vget_low_u8(_a), low_b))); + _a = vextq_u8(_a, _a, 1); + c26 = vabsq_s16(vreinterpretq_s16_u16(vsubl_u8(vget_low_u8(_a), low_b))); + _a = vextq_u8(_a, _a, 1); + c37 = vabsq_s16(vreinterpretq_s16_u16(vsubl_u8(vget_low_u8(_a), low_b))); #if defined(__aarch64__) - // |0|4|2|6| - c04 = vpaddq_s16(c04, c26); - // |1|5|3|7| - c15 = vpaddq_s16(c15, c37); + // |0|4|2|6| + c04 = vpaddq_s16(c04, c26); + // |1|5|3|7| + c15 = vpaddq_s16(c15, c37); - int32x4_t trn1_c = - vtrn1q_s32(vreinterpretq_s32_s16(c04), vreinterpretq_s32_s16(c15)); - int32x4_t trn2_c = - vtrn2q_s32(vreinterpretq_s32_s16(c04), vreinterpretq_s32_s16(c15)); - return vreinterpretq_m128i_s16(vpaddq_s16(vreinterpretq_s16_s32(trn1_c), - vreinterpretq_s16_s32(trn2_c))); + int32x4_t trn1_c = + vtrn1q_s32(vreinterpretq_s32_s16(c04), vreinterpretq_s32_s16(c15)); + int32x4_t trn2_c = + vtrn2q_s32(vreinterpretq_s32_s16(c04), vreinterpretq_s32_s16(c15)); + return vreinterpretq_m128i_s16(vpaddq_s16(vreinterpretq_s16_s32(trn1_c), + vreinterpretq_s16_s32(trn2_c))); #else - int16x4_t c01, c23, c45, c67; - c01 = vpadd_s16(vget_low_s16(c04), vget_low_s16(c15)); - c23 = vpadd_s16(vget_low_s16(c26), vget_low_s16(c37)); - c45 = vpadd_s16(vget_high_s16(c04), vget_high_s16(c15)); - c67 = vpadd_s16(vget_high_s16(c26), vget_high_s16(c37)); + int16x4_t c01, c23, c45, c67; + c01 = vpadd_s16(vget_low_s16(c04), vget_low_s16(c15)); + c23 = vpadd_s16(vget_low_s16(c26), vget_low_s16(c37)); + c45 = vpadd_s16(vget_high_s16(c04), vget_high_s16(c15)); + c67 = vpadd_s16(vget_high_s16(c26), vget_high_s16(c37)); - return vreinterpretq_m128i_s16( - vcombine_s16(vpadd_s16(c01, c23), vpadd_s16(c45, c67))); + return vreinterpretq_m128i_s16( + vcombine_s16(vpadd_s16(c01, c23), vpadd_s16(c45, c67))); #endif } @@ -8080,10 +8125,10 @@ FORCE_INLINE __m128i _mm_mpsadbw_epu8(__m128i a, __m128i b, const int imm) // r1 := (int64_t)(int32_t)a2 * (int64_t)(int32_t)b2 FORCE_INLINE __m128i _mm_mul_epi32(__m128i a, __m128i b) { - // vmull_s32 upcasts instead of masking, so we downcast. - int32x2_t a_lo = vmovn_s64(vreinterpretq_s64_m128i(a)); - int32x2_t b_lo = vmovn_s64(vreinterpretq_s64_m128i(b)); - return vreinterpretq_m128i_s64(vmull_s32(a_lo, b_lo)); + // vmull_s32 upcasts instead of masking, so we downcast. + int32x2_t a_lo = vmovn_s64(vreinterpretq_s64_m128i(a)); + int32x2_t b_lo = vmovn_s64(vreinterpretq_s64_m128i(b)); + return vreinterpretq_m128i_s64(vmull_s32(a_lo, b_lo)); } // Multiplies the 4 signed or unsigned 32-bit integers from a by the 4 signed or @@ -8091,8 +8136,8 @@ FORCE_INLINE __m128i _mm_mul_epi32(__m128i a, __m128i b) // https://msdn.microsoft.com/en-us/library/vstudio/bb531409(v=vs.100).aspx FORCE_INLINE __m128i _mm_mullo_epi32(__m128i a, __m128i b) { - return vreinterpretq_m128i_s32( - vmulq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); + return vreinterpretq_m128i_s32( + vmulq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b))); } // Packs the 8 unsigned 32-bit integers from a and b into unsigned 16-bit @@ -8108,9 +8153,9 @@ FORCE_INLINE __m128i _mm_mullo_epi32(__m128i a, __m128i b) // r7 := UnsignedSaturate(b3) FORCE_INLINE __m128i _mm_packus_epi32(__m128i a, __m128i b) { - return vreinterpretq_m128i_u16( - vcombine_u16(vqmovun_s32(vreinterpretq_s32_m128i(a)), - vqmovun_s32(vreinterpretq_s32_m128i(b)))); + return vreinterpretq_m128i_u16( + vcombine_u16(vqmovun_s32(vreinterpretq_s32_m128i(a)), + vqmovun_s32(vreinterpretq_s32_m128i(b)))); } // Round the packed double-precision (64-bit) floating-point elements in a using @@ -8120,65 +8165,80 @@ FORCE_INLINE __m128i _mm_packus_epi32(__m128i a, __m128i b) FORCE_INLINE __m128d _mm_round_pd(__m128d a, int rounding) { #if defined(__aarch64__) - switch (rounding) { - case (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC): - return vreinterpretq_m128d_f64(vrndnq_f64(vreinterpretq_f64_m128d(a))); - case (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC): - return _mm_floor_pd(a); - case (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC): - return _mm_ceil_pd(a); - case (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC): - return vreinterpretq_m128d_f64(vrndq_f64(vreinterpretq_f64_m128d(a))); - default: //_MM_FROUND_CUR_DIRECTION - return vreinterpretq_m128d_f64(vrndiq_f64(vreinterpretq_f64_m128d(a))); - } + switch (rounding) + { + case (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC): + return vreinterpretq_m128d_f64(vrndnq_f64(vreinterpretq_f64_m128d(a))); + case (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC): + return _mm_floor_pd(a); + case (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC): + return _mm_ceil_pd(a); + case (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC): + return vreinterpretq_m128d_f64(vrndq_f64(vreinterpretq_f64_m128d(a))); + default: //_MM_FROUND_CUR_DIRECTION + return vreinterpretq_m128d_f64(vrndiq_f64(vreinterpretq_f64_m128d(a))); + } #else - double *v_double = (double *) &a; + double* v_double = (double*)&a; - if (rounding == (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC) || - (rounding == _MM_FROUND_CUR_DIRECTION && - _MM_GET_ROUNDING_MODE() == _MM_ROUND_NEAREST)) { - double res[2], tmp; - for (int i = 0; i < 2; i++) { - tmp = (v_double[i] < 0) ? -v_double[i] : v_double[i]; - double roundDown = floor(tmp); // Round down value - double roundUp = ceil(tmp); // Round up value - double diffDown = tmp - roundDown; - double diffUp = roundUp - tmp; - if (diffDown < diffUp) { - /* If it's closer to the round down value, then use it */ - res[i] = roundDown; - } else if (diffDown > diffUp) { - /* If it's closer to the round up value, then use it */ - res[i] = roundUp; - } else { - /* If it's equidistant between round up and round down value, - * pick the one which is an even number */ - double half = roundDown / 2; - if (half != floor(half)) { - /* If the round down value is odd, return the round up value - */ - res[i] = roundUp; - } else { - /* If the round up value is odd, return the round down value - */ - res[i] = roundDown; - } - } - res[i] = (v_double[i] < 0) ? -res[i] : res[i]; - } - return _mm_set_pd(res[1], res[0]); - } else if (rounding == (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC) || - (rounding == _MM_FROUND_CUR_DIRECTION && - _MM_GET_ROUNDING_MODE() == _MM_ROUND_DOWN)) { - return _mm_floor_pd(a); - } else if (rounding == (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC) || - (rounding == _MM_FROUND_CUR_DIRECTION && - _MM_GET_ROUNDING_MODE() == _MM_ROUND_UP)) { - return _mm_ceil_pd(a); - } - return _mm_set_pd(v_double[1] > 0 ? floor(v_double[1]) : ceil(v_double[1]), - v_double[0] > 0 ? floor(v_double[0]) : ceil(v_double[0])); + if (rounding == (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC) || + (rounding == _MM_FROUND_CUR_DIRECTION && + _MM_GET_ROUNDING_MODE() == _MM_ROUND_NEAREST)) + { + double res[2], tmp; + for (int i = 0; i < 2; i++) + { + tmp = (v_double[i] < 0) ? -v_double[i] : v_double[i]; + double roundDown = floor(tmp); // Round down value + double roundUp = ceil(tmp); // Round up value + double diffDown = tmp - roundDown; + double diffUp = roundUp - tmp; + if (diffDown < diffUp) + { + /* If it's closer to the round down value, then use it */ + res[i] = roundDown; + } + else if (diffDown > diffUp) + { + /* If it's closer to the round up value, then use it */ + res[i] = roundUp; + } + else + { + /* If it's equidistant between round up and round down value, + * pick the one which is an even number */ + double half = roundDown / 2; + if (half != floor(half)) + { + /* If the round down value is odd, return the round up value + */ + res[i] = roundUp; + } + else + { + /* If the round up value is odd, return the round down value + */ + res[i] = roundDown; + } + } + res[i] = (v_double[i] < 0) ? -res[i] : res[i]; + } + return _mm_set_pd(res[1], res[0]); + } + else if (rounding == (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC) || + (rounding == _MM_FROUND_CUR_DIRECTION && + _MM_GET_ROUNDING_MODE() == _MM_ROUND_DOWN)) + { + return _mm_floor_pd(a); + } + else if (rounding == (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC) || + (rounding == _MM_FROUND_CUR_DIRECTION && + _MM_GET_ROUNDING_MODE() == _MM_ROUND_UP)) + { + return _mm_ceil_pd(a); + } + return _mm_set_pd(v_double[1] > 0 ? floor(v_double[1]) : ceil(v_double[1]), + v_double[0] > 0 ? floor(v_double[0]) : ceil(v_double[0])); #endif } @@ -8189,55 +8249,61 @@ FORCE_INLINE __m128d _mm_round_pd(__m128d a, int rounding) FORCE_INLINE __m128 _mm_round_ps(__m128 a, int rounding) { #if defined(__aarch64__) - switch (rounding) { - case (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC): - return vreinterpretq_m128_f32(vrndnq_f32(vreinterpretq_f32_m128(a))); - case (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC): - return _mm_floor_ps(a); - case (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC): - return _mm_ceil_ps(a); - case (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC): - return vreinterpretq_m128_f32(vrndq_f32(vreinterpretq_f32_m128(a))); - default: //_MM_FROUND_CUR_DIRECTION - return vreinterpretq_m128_f32(vrndiq_f32(vreinterpretq_f32_m128(a))); - } + switch (rounding) + { + case (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC): + return vreinterpretq_m128_f32(vrndnq_f32(vreinterpretq_f32_m128(a))); + case (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC): + return _mm_floor_ps(a); + case (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC): + return _mm_ceil_ps(a); + case (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC): + return vreinterpretq_m128_f32(vrndq_f32(vreinterpretq_f32_m128(a))); + default: //_MM_FROUND_CUR_DIRECTION + return vreinterpretq_m128_f32(vrndiq_f32(vreinterpretq_f32_m128(a))); + } #else - float *v_float = (float *) &a; + float* v_float = (float*)&a; - if (rounding == (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC) || - (rounding == _MM_FROUND_CUR_DIRECTION && - _MM_GET_ROUNDING_MODE() == _MM_ROUND_NEAREST)) { - uint32x4_t signmask = vdupq_n_u32(0x80000000); - float32x4_t half = vbslq_f32(signmask, vreinterpretq_f32_m128(a), - vdupq_n_f32(0.5f)); /* +/- 0.5 */ - int32x4_t r_normal = vcvtq_s32_f32(vaddq_f32( - vreinterpretq_f32_m128(a), half)); /* round to integer: [a + 0.5]*/ - int32x4_t r_trunc = vcvtq_s32_f32( - vreinterpretq_f32_m128(a)); /* truncate to integer: [a] */ - int32x4_t plusone = vreinterpretq_s32_u32(vshrq_n_u32( - vreinterpretq_u32_s32(vnegq_s32(r_trunc)), 31)); /* 1 or 0 */ - int32x4_t r_even = vbicq_s32(vaddq_s32(r_trunc, plusone), - vdupq_n_s32(1)); /* ([a] + {0,1}) & ~1 */ - float32x4_t delta = vsubq_f32( - vreinterpretq_f32_m128(a), - vcvtq_f32_s32(r_trunc)); /* compute delta: delta = (a - [a]) */ - uint32x4_t is_delta_half = - vceqq_f32(delta, half); /* delta == +/- 0.5 */ - return vreinterpretq_m128_f32( - vcvtq_f32_s32(vbslq_s32(is_delta_half, r_even, r_normal))); - } else if (rounding == (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC) || - (rounding == _MM_FROUND_CUR_DIRECTION && - _MM_GET_ROUNDING_MODE() == _MM_ROUND_DOWN)) { - return _mm_floor_ps(a); - } else if (rounding == (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC) || - (rounding == _MM_FROUND_CUR_DIRECTION && - _MM_GET_ROUNDING_MODE() == _MM_ROUND_UP)) { - return _mm_ceil_ps(a); - } - return _mm_set_ps(v_float[3] > 0 ? floorf(v_float[3]) : ceilf(v_float[3]), - v_float[2] > 0 ? floorf(v_float[2]) : ceilf(v_float[2]), - v_float[1] > 0 ? floorf(v_float[1]) : ceilf(v_float[1]), - v_float[0] > 0 ? floorf(v_float[0]) : ceilf(v_float[0])); + if (rounding == (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC) || + (rounding == _MM_FROUND_CUR_DIRECTION && + _MM_GET_ROUNDING_MODE() == _MM_ROUND_NEAREST)) + { + uint32x4_t signmask = vdupq_n_u32(0x80000000); + float32x4_t half = vbslq_f32(signmask, vreinterpretq_f32_m128(a), + vdupq_n_f32(0.5f)); /* +/- 0.5 */ + int32x4_t r_normal = vcvtq_s32_f32(vaddq_f32( + vreinterpretq_f32_m128(a), half)); /* round to integer: [a + 0.5]*/ + int32x4_t r_trunc = vcvtq_s32_f32( + vreinterpretq_f32_m128(a)); /* truncate to integer: [a] */ + int32x4_t plusone = vreinterpretq_s32_u32(vshrq_n_u32( + vreinterpretq_u32_s32(vnegq_s32(r_trunc)), 31)); /* 1 or 0 */ + int32x4_t r_even = vbicq_s32(vaddq_s32(r_trunc, plusone), + vdupq_n_s32(1)); /* ([a] + {0,1}) & ~1 */ + float32x4_t delta = vsubq_f32( + vreinterpretq_f32_m128(a), + vcvtq_f32_s32(r_trunc)); /* compute delta: delta = (a - [a]) */ + uint32x4_t is_delta_half = + vceqq_f32(delta, half); /* delta == +/- 0.5 */ + return vreinterpretq_m128_f32( + vcvtq_f32_s32(vbslq_s32(is_delta_half, r_even, r_normal))); + } + else if (rounding == (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC) || + (rounding == _MM_FROUND_CUR_DIRECTION && + _MM_GET_ROUNDING_MODE() == _MM_ROUND_DOWN)) + { + return _mm_floor_ps(a); + } + else if (rounding == (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC) || + (rounding == _MM_FROUND_CUR_DIRECTION && + _MM_GET_ROUNDING_MODE() == _MM_ROUND_UP)) + { + return _mm_ceil_ps(a); + } + return _mm_set_ps(v_float[3] > 0 ? floorf(v_float[3]) : ceilf(v_float[3]), + v_float[2] > 0 ? floorf(v_float[2]) : ceilf(v_float[2]), + v_float[1] > 0 ? floorf(v_float[1]) : ceilf(v_float[1]), + v_float[0] > 0 ? floorf(v_float[0]) : ceilf(v_float[0])); #endif } @@ -8248,7 +8314,7 @@ FORCE_INLINE __m128 _mm_round_ps(__m128 a, int rounding) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_round_sd FORCE_INLINE __m128d _mm_round_sd(__m128d a, __m128d b, int rounding) { - return _mm_move_sd(a, _mm_round_pd(b, rounding)); + return _mm_move_sd(a, _mm_round_pd(b, rounding)); } // Round the lower single-precision (32-bit) floating-point element in b using @@ -8268,7 +8334,7 @@ FORCE_INLINE __m128d _mm_round_sd(__m128d a, __m128d b, int rounding) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_round_ss FORCE_INLINE __m128 _mm_round_ss(__m128 a, __m128 b, int rounding) { - return _mm_move_ss(a, _mm_round_ps(b, rounding)); + return _mm_move_ss(a, _mm_round_ps(b, rounding)); } // Load 128-bits of integer data from memory into dst using a non-temporal @@ -8278,12 +8344,12 @@ FORCE_INLINE __m128 _mm_round_ss(__m128 a, __m128 b, int rounding) // dst[127:0] := MEM[mem_addr+127:mem_addr] // // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_stream_load_si128 -FORCE_INLINE __m128i _mm_stream_load_si128(__m128i *p) +FORCE_INLINE __m128i _mm_stream_load_si128(__m128i* p) { #if __has_builtin(__builtin_nontemporal_store) - return __builtin_nontemporal_load(p); + return __builtin_nontemporal_load(p); #else - return vreinterpretq_m128i_s64(vld1q_s64((int64_t *) p)); + return vreinterpretq_m128i_s64(vld1q_s64((int64_t*)p)); #endif } @@ -8292,8 +8358,8 @@ FORCE_INLINE __m128i _mm_stream_load_si128(__m128i *p) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_test_all_ones FORCE_INLINE int _mm_test_all_ones(__m128i a) { - return (uint64_t)(vgetq_lane_s64(a, 0) & vgetq_lane_s64(a, 1)) == - ~(uint64_t) 0; + return (uint64_t)(vgetq_lane_s64(a, 0) & vgetq_lane_s64(a, 1)) == + ~(uint64_t)0; } // Compute the bitwise AND of 128 bits (representing integer data) in a and @@ -8301,9 +8367,9 @@ FORCE_INLINE int _mm_test_all_ones(__m128i a) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_test_all_zeros FORCE_INLINE int _mm_test_all_zeros(__m128i a, __m128i mask) { - int64x2_t a_and_mask = - vandq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(mask)); - return !(vgetq_lane_s64(a_and_mask, 0) | vgetq_lane_s64(a_and_mask, 1)); + int64x2_t a_and_mask = + vandq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(mask)); + return !(vgetq_lane_s64(a_and_mask, 0) | vgetq_lane_s64(a_and_mask, 1)); } // Compute the bitwise AND of 128 bits (representing integer data) in a and @@ -8314,12 +8380,12 @@ FORCE_INLINE int _mm_test_all_zeros(__m128i a, __m128i mask) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=mm_test_mix_ones_zero FORCE_INLINE int _mm_test_mix_ones_zeros(__m128i a, __m128i mask) { - uint64x2_t zf = - vandq_u64(vreinterpretq_u64_m128i(mask), vreinterpretq_u64_m128i(a)); - uint64x2_t cf = - vbicq_u64(vreinterpretq_u64_m128i(mask), vreinterpretq_u64_m128i(a)); - uint64x2_t result = vandq_u64(zf, cf); - return !(vgetq_lane_u64(result, 0) | vgetq_lane_u64(result, 1)); + uint64x2_t zf = + vandq_u64(vreinterpretq_u64_m128i(mask), vreinterpretq_u64_m128i(a)); + uint64x2_t cf = + vbicq_u64(vreinterpretq_u64_m128i(mask), vreinterpretq_u64_m128i(a)); + uint64x2_t result = vandq_u64(zf, cf); + return !(vgetq_lane_u64(result, 0) | vgetq_lane_u64(result, 1)); } // Compute the bitwise AND of 128 bits (representing integer data) in a and b, @@ -8329,10 +8395,10 @@ FORCE_INLINE int _mm_test_mix_ones_zeros(__m128i a, __m128i mask) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_testc_si128 FORCE_INLINE int _mm_testc_si128(__m128i a, __m128i b) { - int64x2_t s64 = - vandq_s64(vreinterpretq_s64_s32(vmvnq_s32(vreinterpretq_s32_m128i(a))), - vreinterpretq_s64_m128i(b)); - return !(vgetq_lane_s64(s64, 0) | vgetq_lane_s64(s64, 1)); + int64x2_t s64 = + vandq_s64(vreinterpretq_s64_s32(vmvnq_s32(vreinterpretq_s32_m128i(a))), + vreinterpretq_s64_m128i(b)); + return !(vgetq_lane_s64(s64, 0) | vgetq_lane_s64(s64, 1)); } // Compute the bitwise AND of 128 bits (representing integer data) in a and b, @@ -8350,9 +8416,9 @@ FORCE_INLINE int _mm_testc_si128(__m128i a, __m128i b) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_testz_si128 FORCE_INLINE int _mm_testz_si128(__m128i a, __m128i b) { - int64x2_t s64 = - vandq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b)); - return !(vgetq_lane_s64(s64, 0) | vgetq_lane_s64(s64, 1)); + int64x2_t s64 = + vandq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b)); + return !(vgetq_lane_s64(s64, 0) | vgetq_lane_s64(s64, 1)); } /* SSE4.2 */ @@ -8362,12 +8428,12 @@ FORCE_INLINE int _mm_testz_si128(__m128i a, __m128i b) FORCE_INLINE __m128i _mm_cmpgt_epi64(__m128i a, __m128i b) { #if defined(__aarch64__) - return vreinterpretq_m128i_u64( - vcgtq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b))); + return vreinterpretq_m128i_u64( + vcgtq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b))); #else - return vreinterpretq_m128i_s64(vshrq_n_s64( - vqsubq_s64(vreinterpretq_s64_m128i(b), vreinterpretq_s64_m128i(a)), - 63)); + return vreinterpretq_m128i_s64(vshrq_n_s64( + vqsubq_s64(vreinterpretq_s64_m128i(b), vreinterpretq_s64_m128i(a)), + 63)); #endif } @@ -8377,14 +8443,14 @@ FORCE_INLINE __m128i _mm_cmpgt_epi64(__m128i a, __m128i b) FORCE_INLINE uint32_t _mm_crc32_u16(uint32_t crc, uint16_t v) { #if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) - __asm__ __volatile__("crc32ch %w[c], %w[c], %w[v]\n\t" - : [c] "+r"(crc) - : [v] "r"(v)); + __asm__ __volatile__("crc32ch %w[c], %w[c], %w[v]\n\t" + : [c] "+r"(crc) + : [v] "r"(v)); #else - crc = _mm_crc32_u8(crc, v & 0xff); - crc = _mm_crc32_u8(crc, (v >> 8) & 0xff); + crc = _mm_crc32_u8(crc, v & 0xff); + crc = _mm_crc32_u8(crc, (v >> 8) & 0xff); #endif - return crc; + return crc; } // Starting with the initial value in crc, accumulates a CRC32 value for @@ -8393,14 +8459,14 @@ FORCE_INLINE uint32_t _mm_crc32_u16(uint32_t crc, uint16_t v) FORCE_INLINE uint32_t _mm_crc32_u32(uint32_t crc, uint32_t v) { #if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) - __asm__ __volatile__("crc32cw %w[c], %w[c], %w[v]\n\t" - : [c] "+r"(crc) - : [v] "r"(v)); + __asm__ __volatile__("crc32cw %w[c], %w[c], %w[v]\n\t" + : [c] "+r"(crc) + : [v] "r"(v)); #else - crc = _mm_crc32_u16(crc, v & 0xffff); - crc = _mm_crc32_u16(crc, (v >> 16) & 0xffff); + crc = _mm_crc32_u16(crc, v & 0xffff); + crc = _mm_crc32_u16(crc, (v >> 16) & 0xffff); #endif - return crc; + return crc; } // Starting with the initial value in crc, accumulates a CRC32 value for @@ -8409,14 +8475,14 @@ FORCE_INLINE uint32_t _mm_crc32_u32(uint32_t crc, uint32_t v) FORCE_INLINE uint64_t _mm_crc32_u64(uint64_t crc, uint64_t v) { #if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) - __asm__ __volatile__("crc32cx %w[c], %w[c], %x[v]\n\t" - : [c] "+r"(crc) - : [v] "r"(v)); + __asm__ __volatile__("crc32cx %w[c], %w[c], %x[v]\n\t" + : [c] "+r"(crc) + : [v] "r"(v)); #else - crc = _mm_crc32_u32((uint32_t)(crc), v & 0xffffffff); - crc = _mm_crc32_u32((uint32_t)(crc), (v >> 32) & 0xffffffff); + crc = _mm_crc32_u32((uint32_t)(crc), v & 0xffffffff); + crc = _mm_crc32_u32((uint32_t)(crc), (v >> 32) & 0xffffffff); #endif - return crc; + return crc; } // Starting with the initial value in crc, accumulates a CRC32 value for @@ -8425,19 +8491,20 @@ FORCE_INLINE uint64_t _mm_crc32_u64(uint64_t crc, uint64_t v) FORCE_INLINE uint32_t _mm_crc32_u8(uint32_t crc, uint8_t v) { #if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) - __asm__ __volatile__("crc32cb %w[c], %w[c], %w[v]\n\t" - : [c] "+r"(crc) - : [v] "r"(v)); + __asm__ __volatile__("crc32cb %w[c], %w[c], %w[v]\n\t" + : [c] "+r"(crc) + : [v] "r"(v)); #else - crc ^= v; - for (int bit = 0; bit < 8; bit++) { - if (crc & 1) - crc = (crc >> 1) ^ UINT32_C(0x82f63b78); - else - crc = (crc >> 1); - } + crc ^= v; + for (int bit = 0; bit < 8; bit++) + { + if (crc & 1) + crc = (crc >> 1) ^ UINT32_C(0x82f63b78); + else + crc = (crc >> 1); + } #endif - return crc; + return crc; } /* AES */ @@ -8500,52 +8567,52 @@ static const uint8_t SSE2NEON_sbox[256] = SSE2NEON_AES_DATA(SSE2NEON_AES_H0); FORCE_INLINE __m128i _mm_aesenc_si128(__m128i EncBlock, __m128i RoundKey) { #if defined(__aarch64__) - static const uint8_t shift_rows[] = {0x0, 0x5, 0xa, 0xf, 0x4, 0x9, - 0xe, 0x3, 0x8, 0xd, 0x2, 0x7, - 0xc, 0x1, 0x6, 0xb}; - static const uint8_t ror32by8[] = {0x1, 0x2, 0x3, 0x0, 0x5, 0x6, 0x7, 0x4, - 0x9, 0xa, 0xb, 0x8, 0xd, 0xe, 0xf, 0xc}; + static const uint8_t shift_rows[] = {0x0, 0x5, 0xa, 0xf, 0x4, 0x9, + 0xe, 0x3, 0x8, 0xd, 0x2, 0x7, + 0xc, 0x1, 0x6, 0xb}; + static const uint8_t ror32by8[] = {0x1, 0x2, 0x3, 0x0, 0x5, 0x6, 0x7, 0x4, + 0x9, 0xa, 0xb, 0x8, 0xd, 0xe, 0xf, 0xc}; - uint8x16_t v; - uint8x16_t w = vreinterpretq_u8_m128i(EncBlock); + uint8x16_t v; + uint8x16_t w = vreinterpretq_u8_m128i(EncBlock); - // shift rows - w = vqtbl1q_u8(w, vld1q_u8(shift_rows)); + // shift rows + w = vqtbl1q_u8(w, vld1q_u8(shift_rows)); - // sub bytes - v = vqtbl4q_u8(_sse2neon_vld1q_u8_x4(SSE2NEON_sbox), w); - v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(SSE2NEON_sbox + 0x40), w - 0x40); - v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(SSE2NEON_sbox + 0x80), w - 0x80); - v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(SSE2NEON_sbox + 0xc0), w - 0xc0); + // sub bytes + v = vqtbl4q_u8(_sse2neon_vld1q_u8_x4(SSE2NEON_sbox), w); + v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(SSE2NEON_sbox + 0x40), w - 0x40); + v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(SSE2NEON_sbox + 0x80), w - 0x80); + v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(SSE2NEON_sbox + 0xc0), w - 0xc0); - // mix columns - w = (v << 1) ^ (uint8x16_t)(((int8x16_t) v >> 7) & 0x1b); - w ^= (uint8x16_t) vrev32q_u16((uint16x8_t) v); - w ^= vqtbl1q_u8(v ^ w, vld1q_u8(ror32by8)); + // mix columns + w = (v << 1) ^ (uint8x16_t)(((int8x16_t)v >> 7) & 0x1b); + w ^= (uint8x16_t)vrev32q_u16((uint16x8_t)v); + w ^= vqtbl1q_u8(v ^ w, vld1q_u8(ror32by8)); - // add round key - return vreinterpretq_m128i_u8(w) ^ RoundKey; + // add round key + return vreinterpretq_m128i_u8(w) ^ RoundKey; #else /* ARMv7-A NEON implementation */ #define SSE2NEON_AES_B2W(b0, b1, b2, b3) \ - (((uint32_t)(b3) << 24) | ((uint32_t)(b2) << 16) | ((uint32_t)(b1) << 8) | \ - (b0)) + (((uint32_t)(b3) << 24) | ((uint32_t)(b2) << 16) | ((uint32_t)(b1) << 8) | \ + (b0)) #define SSE2NEON_AES_F2(x) ((x << 1) ^ (((x >> 7) & 1) * 0x011b /* WPOLY */)) #define SSE2NEON_AES_F3(x) (SSE2NEON_AES_F2(x) ^ x) #define SSE2NEON_AES_U0(p) \ - SSE2NEON_AES_B2W(SSE2NEON_AES_F2(p), p, p, SSE2NEON_AES_F3(p)) + SSE2NEON_AES_B2W(SSE2NEON_AES_F2(p), p, p, SSE2NEON_AES_F3(p)) #define SSE2NEON_AES_U1(p) \ - SSE2NEON_AES_B2W(SSE2NEON_AES_F3(p), SSE2NEON_AES_F2(p), p, p) + SSE2NEON_AES_B2W(SSE2NEON_AES_F3(p), SSE2NEON_AES_F2(p), p, p) #define SSE2NEON_AES_U2(p) \ - SSE2NEON_AES_B2W(p, SSE2NEON_AES_F3(p), SSE2NEON_AES_F2(p), p) + SSE2NEON_AES_B2W(p, SSE2NEON_AES_F3(p), SSE2NEON_AES_F2(p), p) #define SSE2NEON_AES_U3(p) \ - SSE2NEON_AES_B2W(p, p, SSE2NEON_AES_F3(p), SSE2NEON_AES_F2(p)) - static const uint32_t ALIGN_STRUCT(16) aes_table[4][256] = { - SSE2NEON_AES_DATA(SSE2NEON_AES_U0), - SSE2NEON_AES_DATA(SSE2NEON_AES_U1), - SSE2NEON_AES_DATA(SSE2NEON_AES_U2), - SSE2NEON_AES_DATA(SSE2NEON_AES_U3), - }; + SSE2NEON_AES_B2W(p, p, SSE2NEON_AES_F3(p), SSE2NEON_AES_F2(p)) + static const uint32_t ALIGN_STRUCT(16) aes_table[4][256] = { + SSE2NEON_AES_DATA(SSE2NEON_AES_U0), + SSE2NEON_AES_DATA(SSE2NEON_AES_U1), + SSE2NEON_AES_DATA(SSE2NEON_AES_U2), + SSE2NEON_AES_DATA(SSE2NEON_AES_U3), + }; #undef SSE2NEON_AES_B2W #undef SSE2NEON_AES_F2 #undef SSE2NEON_AES_F3 @@ -8554,22 +8621,22 @@ FORCE_INLINE __m128i _mm_aesenc_si128(__m128i EncBlock, __m128i RoundKey) #undef SSE2NEON_AES_U2 #undef SSE2NEON_AES_U3 - uint32_t x0 = _mm_cvtsi128_si32(EncBlock); - uint32_t x1 = _mm_cvtsi128_si32(_mm_shuffle_epi32(EncBlock, 0x55)); - uint32_t x2 = _mm_cvtsi128_si32(_mm_shuffle_epi32(EncBlock, 0xAA)); - uint32_t x3 = _mm_cvtsi128_si32(_mm_shuffle_epi32(EncBlock, 0xFF)); + uint32_t x0 = _mm_cvtsi128_si32(EncBlock); + uint32_t x1 = _mm_cvtsi128_si32(_mm_shuffle_epi32(EncBlock, 0x55)); + uint32_t x2 = _mm_cvtsi128_si32(_mm_shuffle_epi32(EncBlock, 0xAA)); + uint32_t x3 = _mm_cvtsi128_si32(_mm_shuffle_epi32(EncBlock, 0xFF)); - __m128i out = _mm_set_epi32( - (aes_table[0][x3 & 0xff] ^ aes_table[1][(x0 >> 8) & 0xff] ^ - aes_table[2][(x1 >> 16) & 0xff] ^ aes_table[3][x2 >> 24]), - (aes_table[0][x2 & 0xff] ^ aes_table[1][(x3 >> 8) & 0xff] ^ - aes_table[2][(x0 >> 16) & 0xff] ^ aes_table[3][x1 >> 24]), - (aes_table[0][x1 & 0xff] ^ aes_table[1][(x2 >> 8) & 0xff] ^ - aes_table[2][(x3 >> 16) & 0xff] ^ aes_table[3][x0 >> 24]), - (aes_table[0][x0 & 0xff] ^ aes_table[1][(x1 >> 8) & 0xff] ^ - aes_table[2][(x2 >> 16) & 0xff] ^ aes_table[3][x3 >> 24])); + __m128i out = _mm_set_epi32( + (aes_table[0][x3 & 0xff] ^ aes_table[1][(x0 >> 8) & 0xff] ^ + aes_table[2][(x1 >> 16) & 0xff] ^ aes_table[3][x2 >> 24]), + (aes_table[0][x2 & 0xff] ^ aes_table[1][(x3 >> 8) & 0xff] ^ + aes_table[2][(x0 >> 16) & 0xff] ^ aes_table[3][x1 >> 24]), + (aes_table[0][x1 & 0xff] ^ aes_table[1][(x2 >> 8) & 0xff] ^ + aes_table[2][(x3 >> 16) & 0xff] ^ aes_table[3][x0 >> 24]), + (aes_table[0][x0 & 0xff] ^ aes_table[1][(x1 >> 8) & 0xff] ^ + aes_table[2][(x2 >> 16) & 0xff] ^ aes_table[3][x3 >> 24])); - return _mm_xor_si128(out, RoundKey); + return _mm_xor_si128(out, RoundKey); #endif } @@ -8578,29 +8645,29 @@ FORCE_INLINE __m128i _mm_aesenc_si128(__m128i EncBlock, __m128i RoundKey) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_aesenclast_si128 FORCE_INLINE __m128i _mm_aesenclast_si128(__m128i a, __m128i RoundKey) { - /* FIXME: optimized for NEON */ - uint8_t v[4][4] = { - {SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 0)], - SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 5)], - SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 10)], - SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 15)]}, - {SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 4)], - SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 9)], - SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 14)], - SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 3)]}, - {SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 8)], - SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 13)], - SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 2)], - SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 7)]}, - {SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 12)], - SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 1)], - SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 6)], - SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 11)]}, - }; - for (int i = 0; i < 16; i++) - vreinterpretq_nth_u8_m128i(a, i) = - v[i / 4][i % 4] ^ vreinterpretq_nth_u8_m128i(RoundKey, i); - return a; + /* FIXME: optimized for NEON */ + uint8_t v[4][4] = { + {SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 0)], + SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 5)], + SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 10)], + SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 15)]}, + {SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 4)], + SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 9)], + SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 14)], + SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 3)]}, + {SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 8)], + SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 13)], + SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 2)], + SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 7)]}, + {SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 12)], + SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 1)], + SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 6)], + SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 11)]}, + }; + for (int i = 0; i < 16; i++) + vreinterpretq_nth_u8_m128i(a, i) = + v[i / 4][i % 4] ^ vreinterpretq_nth_u8_m128i(RoundKey, i); + return a; } // Emits the Advanced Encryption Standard (AES) instruction aeskeygenassist. @@ -8611,14 +8678,15 @@ FORCE_INLINE __m128i _mm_aesenclast_si128(__m128i a, __m128i RoundKey) // https://msdn.microsoft.com/en-us/library/cc714138(v=vs.120).aspx FORCE_INLINE __m128i _mm_aeskeygenassist_si128(__m128i key, const int rcon) { - uint32_t X1 = _mm_cvtsi128_si32(_mm_shuffle_epi32(key, 0x55)); - uint32_t X3 = _mm_cvtsi128_si32(_mm_shuffle_epi32(key, 0xFF)); - for (int i = 0; i < 4; ++i) { - ((uint8_t *) &X1)[i] = SSE2NEON_sbox[((uint8_t *) &X1)[i]]; - ((uint8_t *) &X3)[i] = SSE2NEON_sbox[((uint8_t *) &X3)[i]]; - } - return _mm_set_epi32(((X3 >> 8) | (X3 << 24)) ^ rcon, X3, - ((X1 >> 8) | (X1 << 24)) ^ rcon, X1); + uint32_t X1 = _mm_cvtsi128_si32(_mm_shuffle_epi32(key, 0x55)); + uint32_t X3 = _mm_cvtsi128_si32(_mm_shuffle_epi32(key, 0xFF)); + for (int i = 0; i < 4; ++i) + { + ((uint8_t*)&X1)[i] = SSE2NEON_sbox[((uint8_t*)&X1)[i]]; + ((uint8_t*)&X3)[i] = SSE2NEON_sbox[((uint8_t*)&X3)[i]]; + } + return _mm_set_epi32(((X3 >> 8) | (X3 << 24)) ^ rcon, X3, + ((X1 >> 8) | (X1 << 24)) ^ rcon, X1); } #undef SSE2NEON_AES_DATA @@ -8631,33 +8699,33 @@ FORCE_INLINE __m128i _mm_aeskeygenassist_si128(__m128i key, const int rcon) // for more details. FORCE_INLINE __m128i _mm_aesenc_si128(__m128i a, __m128i b) { - return vreinterpretq_m128i_u8( - vaesmcq_u8(vaeseq_u8(vreinterpretq_u8_m128i(a), vdupq_n_u8(0))) ^ - vreinterpretq_u8_m128i(b)); + return vreinterpretq_m128i_u8( + vaesmcq_u8(vaeseq_u8(vreinterpretq_u8_m128i(a), vdupq_n_u8(0))) ^ + vreinterpretq_u8_m128i(b)); } // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_aesenclast_si128 FORCE_INLINE __m128i _mm_aesenclast_si128(__m128i a, __m128i RoundKey) { - return _mm_xor_si128(vreinterpretq_m128i_u8(vaeseq_u8( - vreinterpretq_u8_m128i(a), vdupq_n_u8(0))), - RoundKey); + return _mm_xor_si128(vreinterpretq_m128i_u8(vaeseq_u8( + vreinterpretq_u8_m128i(a), vdupq_n_u8(0))), + RoundKey); } FORCE_INLINE __m128i _mm_aeskeygenassist_si128(__m128i a, const int rcon) { - // AESE does ShiftRows and SubBytes on A - uint8x16_t u8 = vaeseq_u8(vreinterpretq_u8_m128i(a), vdupq_n_u8(0)); + // AESE does ShiftRows and SubBytes on A + uint8x16_t u8 = vaeseq_u8(vreinterpretq_u8_m128i(a), vdupq_n_u8(0)); - uint8x16_t dest = { - // Undo ShiftRows step from AESE and extract X1 and X3 - u8[0x4], u8[0x1], u8[0xE], u8[0xB], // SubBytes(X1) - u8[0x1], u8[0xE], u8[0xB], u8[0x4], // ROT(SubBytes(X1)) - u8[0xC], u8[0x9], u8[0x6], u8[0x3], // SubBytes(X3) - u8[0x9], u8[0x6], u8[0x3], u8[0xC], // ROT(SubBytes(X3)) - }; - uint32x4_t r = {0, (unsigned) rcon, 0, (unsigned) rcon}; - return vreinterpretq_m128i_u8(dest) ^ vreinterpretq_m128i_u32(r); + uint8x16_t dest = { + // Undo ShiftRows step from AESE and extract X1 and X3 + u8[0x4], u8[0x1], u8[0xE], u8[0xB], // SubBytes(X1) + u8[0x1], u8[0xE], u8[0xB], u8[0x4], // ROT(SubBytes(X1)) + u8[0xC], u8[0x9], u8[0x6], u8[0x3], // SubBytes(X3) + u8[0x9], u8[0x6], u8[0x3], u8[0xC], // ROT(SubBytes(X3)) + }; + uint32x4_t r = {0, (unsigned)rcon, 0, (unsigned)rcon}; + return vreinterpretq_m128i_u8(dest) ^ vreinterpretq_m128i_u32(r); } #endif @@ -8668,44 +8736,46 @@ FORCE_INLINE __m128i _mm_aeskeygenassist_si128(__m128i a, const int rcon) // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_clmulepi64_si128 FORCE_INLINE __m128i _mm_clmulepi64_si128(__m128i _a, __m128i _b, const int imm) { - uint64x2_t a = vreinterpretq_u64_m128i(_a); - uint64x2_t b = vreinterpretq_u64_m128i(_b); - switch (imm & 0x11) { - case 0x00: - return vreinterpretq_m128i_u64( - _sse2neon_vmull_p64(vget_low_u64(a), vget_low_u64(b))); - case 0x01: - return vreinterpretq_m128i_u64( - _sse2neon_vmull_p64(vget_high_u64(a), vget_low_u64(b))); - case 0x10: - return vreinterpretq_m128i_u64( - _sse2neon_vmull_p64(vget_low_u64(a), vget_high_u64(b))); - case 0x11: - return vreinterpretq_m128i_u64( - _sse2neon_vmull_p64(vget_high_u64(a), vget_high_u64(b))); - default: - abort(); - } + uint64x2_t a = vreinterpretq_u64_m128i(_a); + uint64x2_t b = vreinterpretq_u64_m128i(_b); + switch (imm & 0x11) + { + case 0x00: + return vreinterpretq_m128i_u64( + _sse2neon_vmull_p64(vget_low_u64(a), vget_low_u64(b))); + case 0x01: + return vreinterpretq_m128i_u64( + _sse2neon_vmull_p64(vget_high_u64(a), vget_low_u64(b))); + case 0x10: + return vreinterpretq_m128i_u64( + _sse2neon_vmull_p64(vget_low_u64(a), vget_high_u64(b))); + case 0x11: + return vreinterpretq_m128i_u64( + _sse2neon_vmull_p64(vget_high_u64(a), vget_high_u64(b))); + default: + abort(); + } } FORCE_INLINE unsigned int _sse2neon_mm_get_denormals_zero_mode() { - union { - fpcr_bitfield field; + union + { + fpcr_bitfield field; #if defined(__aarch64__) - uint64_t value; + uint64_t value; #else - uint32_t value; + uint32_t value; #endif - } r; + } r; #if defined(__aarch64__) - asm volatile("mrs %0, FPCR" : "=r"(r.value)); /* read */ + asm volatile("mrs %0, FPCR" : "=r"(r.value)); /* read */ #else - asm volatile("vmrs %0, FPSCR" : "=r"(r.value)); /* read */ + asm volatile("vmrs %0, FPSCR" : "=r"(r.value)); /* read */ #endif - return r.field.bit24 ? _MM_DENORMALS_ZERO_ON : _MM_DENORMALS_ZERO_OFF; + return r.field.bit24 ? _MM_DENORMALS_ZERO_ON : _MM_DENORMALS_ZERO_OFF; } // Count the number of bits set to 1 in unsigned 32-bit integer a, and @@ -8715,23 +8785,23 @@ FORCE_INLINE int _mm_popcnt_u32(unsigned int a) { #if defined(__aarch64__) #if __has_builtin(__builtin_popcount) - return __builtin_popcount(a); + return __builtin_popcount(a); #else - return (int) vaddlv_u8(vcnt_u8(vcreate_u8((uint64_t) a))); + return (int)vaddlv_u8(vcnt_u8(vcreate_u8((uint64_t)a))); #endif #else - uint32_t count = 0; - uint8x8_t input_val, count8x8_val; - uint16x4_t count16x4_val; - uint32x2_t count32x2_val; + uint32_t count = 0; + uint8x8_t input_val, count8x8_val; + uint16x4_t count16x4_val; + uint32x2_t count32x2_val; - input_val = vld1_u8((uint8_t *) &a); - count8x8_val = vcnt_u8(input_val); - count16x4_val = vpaddl_u8(count8x8_val); - count32x2_val = vpaddl_u16(count16x4_val); + input_val = vld1_u8((uint8_t*)&a); + count8x8_val = vcnt_u8(input_val); + count16x4_val = vpaddl_u8(count8x8_val); + count32x2_val = vpaddl_u16(count16x4_val); - vst1_u32(&count, count32x2_val); - return count; + vst1_u32(&count, count32x2_val); + return count; #endif } @@ -8742,52 +8812,53 @@ FORCE_INLINE int64_t _mm_popcnt_u64(uint64_t a) { #if defined(__aarch64__) #if __has_builtin(__builtin_popcountll) - return __builtin_popcountll(a); + return __builtin_popcountll(a); #else - return (int64_t) vaddlv_u8(vcnt_u8(vcreate_u8(a))); + return (int64_t)vaddlv_u8(vcnt_u8(vcreate_u8(a))); #endif #else - uint64_t count = 0; - uint8x8_t input_val, count8x8_val; - uint16x4_t count16x4_val; - uint32x2_t count32x2_val; - uint64x1_t count64x1_val; + uint64_t count = 0; + uint8x8_t input_val, count8x8_val; + uint16x4_t count16x4_val; + uint32x2_t count32x2_val; + uint64x1_t count64x1_val; - input_val = vld1_u8((uint8_t *) &a); - count8x8_val = vcnt_u8(input_val); - count16x4_val = vpaddl_u8(count8x8_val); - count32x2_val = vpaddl_u16(count16x4_val); - count64x1_val = vpaddl_u32(count32x2_val); - vst1_u64(&count, count64x1_val); - return count; + input_val = vld1_u8((uint8_t*)&a); + count8x8_val = vcnt_u8(input_val); + count16x4_val = vpaddl_u8(count8x8_val); + count32x2_val = vpaddl_u16(count16x4_val); + count64x1_val = vpaddl_u32(count32x2_val); + vst1_u64(&count, count64x1_val); + return count; #endif } FORCE_INLINE void _sse2neon_mm_set_denormals_zero_mode(unsigned int flag) { - // AArch32 Advanced SIMD arithmetic always uses the Flush-to-zero setting, - // regardless of the value of the FZ bit. - union { - fpcr_bitfield field; + // AArch32 Advanced SIMD arithmetic always uses the Flush-to-zero setting, + // regardless of the value of the FZ bit. + union + { + fpcr_bitfield field; #if defined(__aarch64__) - uint64_t value; + uint64_t value; #else - uint32_t value; + uint32_t value; #endif - } r; + } r; #if defined(__aarch64__) - asm volatile("mrs %0, FPCR" : "=r"(r.value)); /* read */ + asm volatile("mrs %0, FPCR" : "=r"(r.value)); /* read */ #else - asm volatile("vmrs %0, FPSCR" : "=r"(r.value)); /* read */ + asm volatile("vmrs %0, FPSCR" : "=r"(r.value)); /* read */ #endif - r.field.bit24 = (flag & _MM_DENORMALS_ZERO_MASK) == _MM_DENORMALS_ZERO_ON; + r.field.bit24 = (flag & _MM_DENORMALS_ZERO_MASK) == _MM_DENORMALS_ZERO_ON; #if defined(__aarch64__) - asm volatile("msr FPCR, %0" ::"r"(r)); /* write */ + asm volatile("msr FPCR, %0" ::"r"(r)); /* write */ #else - asm volatile("vmsr FPSCR, %0" ::"r"(r)); /* write */ + asm volatile("vmsr FPSCR, %0" ::"r"(r)); /* write */ #endif } diff --git a/rpcs3/rpcs3/Emu/Cell/Common.h b/rpcs3/rpcs3/Emu/Cell/Common.h index 19e6433fb..4bf9e4687 100644 --- a/rpcs3/rpcs3/Emu/Cell/Common.h +++ b/rpcs3/rpcs3/Emu/Cell/Common.h @@ -18,143 +18,155 @@ inline int fexpf(float x) } constexpr u32 ppu_fres_mantissas[128] = -{ - 0x007f0000, - 0x007d0800, - 0x007b1800, - 0x00793000, - 0x00775000, - 0x00757000, - 0x0073a000, - 0x0071e000, - 0x00700000, - 0x006e4000, - 0x006ca000, - 0x006ae000, - 0x00694000, - 0x00678000, - 0x00660000, - 0x00646000, - 0x0062c000, - 0x00614000, - 0x005fc000, - 0x005e4000, - 0x005cc000, - 0x005b4000, - 0x0059c000, - 0x00584000, - 0x00570000, - 0x00558000, - 0x00540000, - 0x0052c000, - 0x00518000, - 0x00500000, - 0x004ec000, - 0x004d8000, - 0x004c0000, - 0x004b0000, - 0x00498000, - 0x00488000, - 0x00474000, - 0x00460000, - 0x0044c000, - 0x00438000, - 0x00428000, - 0x00418000, - 0x00400000, - 0x003f0000, - 0x003e0000, - 0x003d0000, - 0x003bc000, - 0x003ac000, - 0x00398000, - 0x00388000, - 0x00378000, - 0x00368000, - 0x00358000, - 0x00348000, - 0x00338000, - 0x00328000, - 0x00318000, - 0x00308000, - 0x002f8000, - 0x002ec000, - 0x002e0000, - 0x002d0000, - 0x002c0000, - 0x002b0000, - 0x002a0000, - 0x00298000, - 0x00288000, - 0x00278000, - 0x0026c000, - 0x00260000, - 0x00250000, - 0x00244000, - 0x00238000, - 0x00228000, - 0x00220000, - 0x00210000, - 0x00200000, - 0x001f8000, - 0x001e8000, - 0x001e0000, - 0x001d0000, - 0x001c8000, - 0x001b8000, - 0x001b0000, - 0x001a0000, - 0x00198000, - 0x00190000, - 0x00180000, - 0x00178000, - 0x00168000, - 0x00160000, - 0x00158000, - 0x00148000, - 0x00140000, - 0x00138000, - 0x00128000, - 0x00120000, - 0x00118000, - 0x00108000, - 0x00100000, - 0x000f8000, - 0x000f0000, - 0x000e0000, - 0x000d8000, - 0x000d0000, - 0x000c8000, - 0x000b8000, - 0x000b0000, - 0x000a8000, - 0x000a0000, - 0x00098000, - 0x00090000, - 0x00080000, - 0x00078000, - 0x00070000, - 0x00068000, - 0x00060000, - 0x00058000, - 0x00050000, - 0x00048000, - 0x00040000, - 0x00038000, - 0x00030000, - 0x00028000, - 0x00020000, - 0x00018000, - 0x00010000, - 0x00000000, + { + 0x007f0000, + 0x007d0800, + 0x007b1800, + 0x00793000, + 0x00775000, + 0x00757000, + 0x0073a000, + 0x0071e000, + 0x00700000, + 0x006e4000, + 0x006ca000, + 0x006ae000, + 0x00694000, + 0x00678000, + 0x00660000, + 0x00646000, + 0x0062c000, + 0x00614000, + 0x005fc000, + 0x005e4000, + 0x005cc000, + 0x005b4000, + 0x0059c000, + 0x00584000, + 0x00570000, + 0x00558000, + 0x00540000, + 0x0052c000, + 0x00518000, + 0x00500000, + 0x004ec000, + 0x004d8000, + 0x004c0000, + 0x004b0000, + 0x00498000, + 0x00488000, + 0x00474000, + 0x00460000, + 0x0044c000, + 0x00438000, + 0x00428000, + 0x00418000, + 0x00400000, + 0x003f0000, + 0x003e0000, + 0x003d0000, + 0x003bc000, + 0x003ac000, + 0x00398000, + 0x00388000, + 0x00378000, + 0x00368000, + 0x00358000, + 0x00348000, + 0x00338000, + 0x00328000, + 0x00318000, + 0x00308000, + 0x002f8000, + 0x002ec000, + 0x002e0000, + 0x002d0000, + 0x002c0000, + 0x002b0000, + 0x002a0000, + 0x00298000, + 0x00288000, + 0x00278000, + 0x0026c000, + 0x00260000, + 0x00250000, + 0x00244000, + 0x00238000, + 0x00228000, + 0x00220000, + 0x00210000, + 0x00200000, + 0x001f8000, + 0x001e8000, + 0x001e0000, + 0x001d0000, + 0x001c8000, + 0x001b8000, + 0x001b0000, + 0x001a0000, + 0x00198000, + 0x00190000, + 0x00180000, + 0x00178000, + 0x00168000, + 0x00160000, + 0x00158000, + 0x00148000, + 0x00140000, + 0x00138000, + 0x00128000, + 0x00120000, + 0x00118000, + 0x00108000, + 0x00100000, + 0x000f8000, + 0x000f0000, + 0x000e0000, + 0x000d8000, + 0x000d0000, + 0x000c8000, + 0x000b8000, + 0x000b0000, + 0x000a8000, + 0x000a0000, + 0x00098000, + 0x00090000, + 0x00080000, + 0x00078000, + 0x00070000, + 0x00068000, + 0x00060000, + 0x00058000, + 0x00050000, + 0x00048000, + 0x00040000, + 0x00038000, + 0x00030000, + 0x00028000, + 0x00020000, + 0x00018000, + 0x00010000, + 0x00000000, }; constexpr u32 ppu_frsqrte_mantissas[16] = -{ - 0x000f1000u, 0x000d8000u, 0x000c0000u, 0x000a8000u, - 0x00098000u, 0x00088000u, 0x00080000u, 0x00070000u, - 0x00060000u, 0x0004c000u, 0x0003c000u, 0x00030000u, - 0x00020000u, 0x00018000u, 0x00010000u, 0x00008000u, + { + 0x000f1000u, + 0x000d8000u, + 0x000c0000u, + 0x000a8000u, + 0x00098000u, + 0x00088000u, + 0x00080000u, + 0x00070000u, + 0x00060000u, + 0x0004c000u, + 0x0003c000u, + 0x00030000u, + 0x00020000u, + 0x00018000u, + 0x00010000u, + 0x00008000u, }; // Large lookup table for FRSQRTE instruction diff --git a/rpcs3/rpcs3/Emu/Cell/ErrorCodes.h b/rpcs3/rpcs3/Emu/Cell/ErrorCodes.h index 7f6a3892d..6224b2fb3 100644 --- a/rpcs3/rpcs3/Emu/Cell/ErrorCodes.h +++ b/rpcs3/rpcs3/Emu/Cell/ErrorCodes.h @@ -14,21 +14,24 @@ class error_code s32 value; // Common constructor - template requires requires (ET v) { static_cast(v); } + template + requires requires(ET v) { static_cast(v); } error_code(const logs::message* ch, const ET& value) noexcept : value(error_report(static_cast(value), ch, " : %s", fmt::type_info_v, fmt_args_t{fmt_unveil::get(value)})) { } // Error constructor (2 args) - template requires requires (ET v) { static_cast(v); } + template + requires requires(ET v) { static_cast(v); } error_code(const logs::message* ch, const ET& value, const T& arg) noexcept : value(error_report(static_cast(value), ch, " : %s, %s", fmt::type_info_v, fmt_args_t{fmt_unveil::get(value), fmt_unveil::get(arg)})) { } // Formatting constructor (error, format string, variadic list) - template requires requires (ET v) { static_cast(v); } + template + requires requires(ET v) { static_cast(v); } error_code(const logs::message* ch, const ET& value, const const_str& fmt, const Args&... args) noexcept : value(error_report(static_cast(value), ch, fmt, fmt::type_info_v, fmt_args_t{fmt_unveil::get(args)...})) { @@ -41,7 +44,8 @@ public: error_code() = default; // Constructor without channel - template requires (sizeof...(Args) > 0 && !(std::is_same_v>, logs::message> || ...)) + template + requires(sizeof...(Args) > 0 && !(std::is_same_v>, logs::message> || ...)) error_code(const Args&... args) noexcept : error_code(std::add_pointer_t{}, args...) { @@ -64,7 +68,7 @@ public: enum CellNotAnError : s32 { - CELL_OK = 0, + CELL_OK = 0, CELL_CANCEL = 1, }; @@ -101,66 +105,66 @@ struct ppu_gpr_cast_impl enum CellError : u32 { - CELL_EAGAIN = 0x80010001, // The resource is temporarily unavailable - CELL_EINVAL = 0x80010002, // An invalid argument value is specified - CELL_ENOSYS = 0x80010003, // The feature is not yet implemented - CELL_ENOMEM = 0x80010004, // Memory allocation failure - CELL_ESRCH = 0x80010005, // The resource with the specified identifier does not exist - CELL_ENOENT = 0x80010006, // The file does not exist - CELL_ENOEXEC = 0x80010007, // The file is in unrecognized format - CELL_EDEADLK = 0x80010008, // Resource deadlock is avoided - CELL_EPERM = 0x80010009, // The operation is not permitted - CELL_EBUSY = 0x8001000A, // The device or resource is busy - CELL_ETIMEDOUT = 0x8001000B, // The operation is timed out - CELL_EABORT = 0x8001000C, // The operation is aborted - CELL_EFAULT = 0x8001000D, // Invalid memory access - CELL_ENOCHILD = 0x8001000E, // Process has no child(s) - CELL_ESTAT = 0x8001000F, // State of the target thread is invalid - CELL_EALIGN = 0x80010010, // Alignment is invalid. - CELL_EKRESOURCE = 0x80010011, // Shortage of the kernel resources - CELL_EISDIR = 0x80010012, // The file is a directory - CELL_ECANCELED = 0x80010013, // Operation canceled - CELL_EEXIST = 0x80010014, // Entry already exists - CELL_EISCONN = 0x80010015, // Port is already connected - CELL_ENOTCONN = 0x80010016, // Port is not connected - CELL_EAUTHFAIL = 0x80010017, // Program authentication fail - CELL_ENOTMSELF = 0x80010018, // The file is not a MSELF - CELL_ESYSVER = 0x80010019, // System version error - CELL_EAUTHFATAL = 0x8001001A, // Fatal system error - CELL_EDOM = 0x8001001B, // Math domain violation - CELL_ERANGE = 0x8001001C, // Math range violation - CELL_EILSEQ = 0x8001001D, // Illegal multi-byte sequence in input - CELL_EFPOS = 0x8001001E, // File position error - CELL_EINTR = 0x8001001F, // Syscall was interrupted - CELL_EFBIG = 0x80010020, // File too large - CELL_EMLINK = 0x80010021, // Too many links - CELL_ENFILE = 0x80010022, // File table overflow - CELL_ENOSPC = 0x80010023, // No space left on device - CELL_ENOTTY = 0x80010024, // Not a TTY - CELL_EPIPE = 0x80010025, // Broken pipe - CELL_EROFS = 0x80010026, // Read-only filesystem (write fail) - CELL_ESPIPE = 0x80010027, // Illegal seek (e.g. seek on pipe) - CELL_E2BIG = 0x80010028, // Arg list too long - CELL_EACCES = 0x80010029, // Access violation - CELL_EBADF = 0x8001002A, // Invalid file descriptor - CELL_EIO = 0x8001002B, // Filesystem mounting failed (actually IO error...EIO) - CELL_EMFILE = 0x8001002C, // Too many files open - CELL_ENODEV = 0x8001002D, // No device - CELL_ENOTDIR = 0x8001002E, // Not a directory - CELL_ENXIO = 0x8001002F, // No such device or IO - CELL_EXDEV = 0x80010030, // Cross-device link error - CELL_EBADMSG = 0x80010031, // Bad Message - CELL_EINPROGRESS = 0x80010032, // In progress - CELL_EMSGSIZE = 0x80010033, // Message size error - CELL_ENAMETOOLONG = 0x80010034, // Name too long - CELL_ENOLCK = 0x80010035, // No lock - CELL_ENOTEMPTY = 0x80010036, // Not empty - CELL_ENOTSUP = 0x80010037, // Not supported - CELL_EFSSPECIFIC = 0x80010038, // File-system specific error - CELL_EOVERFLOW = 0x80010039, // Overflow occured - CELL_ENOTMOUNTED = 0x8001003A, // Filesystem not mounted - CELL_ENOTSDATA = 0x8001003B, // Not SData - CELL_ESDKVER = 0x8001003C, // Incorrect version in sys_load_param - CELL_ENOLICDISC = 0x8001003D, // Pointer is null. Similar than 0x8001003E but with some PARAM.SFO parameter (TITLE_ID?) embedded. - CELL_ENOLICENT = 0x8001003E, // Pointer is null + CELL_EAGAIN = 0x80010001, // The resource is temporarily unavailable + CELL_EINVAL = 0x80010002, // An invalid argument value is specified + CELL_ENOSYS = 0x80010003, // The feature is not yet implemented + CELL_ENOMEM = 0x80010004, // Memory allocation failure + CELL_ESRCH = 0x80010005, // The resource with the specified identifier does not exist + CELL_ENOENT = 0x80010006, // The file does not exist + CELL_ENOEXEC = 0x80010007, // The file is in unrecognized format + CELL_EDEADLK = 0x80010008, // Resource deadlock is avoided + CELL_EPERM = 0x80010009, // The operation is not permitted + CELL_EBUSY = 0x8001000A, // The device or resource is busy + CELL_ETIMEDOUT = 0x8001000B, // The operation is timed out + CELL_EABORT = 0x8001000C, // The operation is aborted + CELL_EFAULT = 0x8001000D, // Invalid memory access + CELL_ENOCHILD = 0x8001000E, // Process has no child(s) + CELL_ESTAT = 0x8001000F, // State of the target thread is invalid + CELL_EALIGN = 0x80010010, // Alignment is invalid. + CELL_EKRESOURCE = 0x80010011, // Shortage of the kernel resources + CELL_EISDIR = 0x80010012, // The file is a directory + CELL_ECANCELED = 0x80010013, // Operation canceled + CELL_EEXIST = 0x80010014, // Entry already exists + CELL_EISCONN = 0x80010015, // Port is already connected + CELL_ENOTCONN = 0x80010016, // Port is not connected + CELL_EAUTHFAIL = 0x80010017, // Program authentication fail + CELL_ENOTMSELF = 0x80010018, // The file is not a MSELF + CELL_ESYSVER = 0x80010019, // System version error + CELL_EAUTHFATAL = 0x8001001A, // Fatal system error + CELL_EDOM = 0x8001001B, // Math domain violation + CELL_ERANGE = 0x8001001C, // Math range violation + CELL_EILSEQ = 0x8001001D, // Illegal multi-byte sequence in input + CELL_EFPOS = 0x8001001E, // File position error + CELL_EINTR = 0x8001001F, // Syscall was interrupted + CELL_EFBIG = 0x80010020, // File too large + CELL_EMLINK = 0x80010021, // Too many links + CELL_ENFILE = 0x80010022, // File table overflow + CELL_ENOSPC = 0x80010023, // No space left on device + CELL_ENOTTY = 0x80010024, // Not a TTY + CELL_EPIPE = 0x80010025, // Broken pipe + CELL_EROFS = 0x80010026, // Read-only filesystem (write fail) + CELL_ESPIPE = 0x80010027, // Illegal seek (e.g. seek on pipe) + CELL_E2BIG = 0x80010028, // Arg list too long + CELL_EACCES = 0x80010029, // Access violation + CELL_EBADF = 0x8001002A, // Invalid file descriptor + CELL_EIO = 0x8001002B, // Filesystem mounting failed (actually IO error...EIO) + CELL_EMFILE = 0x8001002C, // Too many files open + CELL_ENODEV = 0x8001002D, // No device + CELL_ENOTDIR = 0x8001002E, // Not a directory + CELL_ENXIO = 0x8001002F, // No such device or IO + CELL_EXDEV = 0x80010030, // Cross-device link error + CELL_EBADMSG = 0x80010031, // Bad Message + CELL_EINPROGRESS = 0x80010032, // In progress + CELL_EMSGSIZE = 0x80010033, // Message size error + CELL_ENAMETOOLONG = 0x80010034, // Name too long + CELL_ENOLCK = 0x80010035, // No lock + CELL_ENOTEMPTY = 0x80010036, // Not empty + CELL_ENOTSUP = 0x80010037, // Not supported + CELL_EFSSPECIFIC = 0x80010038, // File-system specific error + CELL_EOVERFLOW = 0x80010039, // Overflow occured + CELL_ENOTMOUNTED = 0x8001003A, // Filesystem not mounted + CELL_ENOTSDATA = 0x8001003B, // Not SData + CELL_ESDKVER = 0x8001003C, // Incorrect version in sys_load_param + CELL_ENOLICDISC = 0x8001003D, // Pointer is null. Similar than 0x8001003E but with some PARAM.SFO parameter (TITLE_ID?) embedded. + CELL_ENOLICENT = 0x8001003E, // Pointer is null }; diff --git a/rpcs3/rpcs3/Emu/Cell/MFC.cpp b/rpcs3/rpcs3/Emu/Cell/MFC.cpp index 1af9f4aa1..81f5b67fb 100644 --- a/rpcs3/rpcs3/Emu/Cell/MFC.cpp +++ b/rpcs3/rpcs3/Emu/Cell/MFC.cpp @@ -5,62 +5,62 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](MFC cmd) - { - switch (cmd) { - case MFC_PUT_CMD: return "PUT"; - case MFC_PUTB_CMD: return "PUTB"; - case MFC_PUTF_CMD: return "PUTF"; - case MFC_PUTS_CMD: return "PUTS"; - case MFC_PUTBS_CMD: return "PUTBS"; - case MFC_PUTFS_CMD: return "PUTFS"; - case MFC_PUTR_CMD: return "PUTR"; - case MFC_PUTRB_CMD: return "PUTRB"; - case MFC_PUTRF_CMD: return "PUTRF"; - case MFC_GET_CMD: return "GET"; - case MFC_GETB_CMD: return "GETB"; - case MFC_GETF_CMD: return "GETF"; - case MFC_GETS_CMD: return "GETS"; - case MFC_GETBS_CMD: return "GETBS"; - case MFC_GETFS_CMD: return "GETFS"; - case MFC_PUTL_CMD: return "PUTL"; - case MFC_PUTLB_CMD: return "PUTLB"; - case MFC_PUTLF_CMD: return "PUTLF"; - case MFC_PUTRL_CMD: return "PUTRL"; - case MFC_PUTRLB_CMD: return "PUTRLB"; - case MFC_PUTRLF_CMD: return "PUTRLF"; - case MFC_GETL_CMD: return "GETL"; - case MFC_GETLB_CMD: return "GETLB"; - case MFC_GETLF_CMD: return "GETLF"; + switch (cmd) + { + case MFC_PUT_CMD: return "PUT"; + case MFC_PUTB_CMD: return "PUTB"; + case MFC_PUTF_CMD: return "PUTF"; + case MFC_PUTS_CMD: return "PUTS"; + case MFC_PUTBS_CMD: return "PUTBS"; + case MFC_PUTFS_CMD: return "PUTFS"; + case MFC_PUTR_CMD: return "PUTR"; + case MFC_PUTRB_CMD: return "PUTRB"; + case MFC_PUTRF_CMD: return "PUTRF"; + case MFC_GET_CMD: return "GET"; + case MFC_GETB_CMD: return "GETB"; + case MFC_GETF_CMD: return "GETF"; + case MFC_GETS_CMD: return "GETS"; + case MFC_GETBS_CMD: return "GETBS"; + case MFC_GETFS_CMD: return "GETFS"; + case MFC_PUTL_CMD: return "PUTL"; + case MFC_PUTLB_CMD: return "PUTLB"; + case MFC_PUTLF_CMD: return "PUTLF"; + case MFC_PUTRL_CMD: return "PUTRL"; + case MFC_PUTRLB_CMD: return "PUTRLB"; + case MFC_PUTRLF_CMD: return "PUTRLF"; + case MFC_GETL_CMD: return "GETL"; + case MFC_GETLB_CMD: return "GETLB"; + case MFC_GETLF_CMD: return "GETLF"; - case MFC_GETLLAR_CMD: return "GETLLAR"; - case MFC_PUTLLC_CMD: return "PUTLLC"; - case MFC_PUTLLUC_CMD: return "PUTLLUC"; - case MFC_PUTQLLUC_CMD: return "PUTQLLUC"; + case MFC_GETLLAR_CMD: return "GETLLAR"; + case MFC_PUTLLC_CMD: return "PUTLLC"; + case MFC_PUTLLUC_CMD: return "PUTLLUC"; + case MFC_PUTQLLUC_CMD: return "PUTQLLUC"; - case MFC_SNDSIG_CMD: return "SNDSIG"; - case MFC_SNDSIGB_CMD: return "SNDSIGB"; - case MFC_SNDSIGF_CMD: return "SNDSIGF"; - case MFC_BARRIER_CMD: return "BARRIER"; - case MFC_EIEIO_CMD: return "EIEIO"; - case MFC_SYNC_CMD: return "SYNC"; + case MFC_SNDSIG_CMD: return "SNDSIG"; + case MFC_SNDSIGB_CMD: return "SNDSIGB"; + case MFC_SNDSIGF_CMD: return "SNDSIGF"; + case MFC_BARRIER_CMD: return "BARRIER"; + case MFC_EIEIO_CMD: return "EIEIO"; + case MFC_SYNC_CMD: return "SYNC"; - case MFC_SDCRT_CMD: return "SDCRT"; - case MFC_SDCRTST_CMD: return "SDCRTST"; - case MFC_SDCRZ_CMD: return "SDCRZ"; - case MFC_SDCRS_CMD: return "SDCRS"; - case MFC_SDCRF_CMD: return "SDCRF"; + case MFC_SDCRT_CMD: return "SDCRT"; + case MFC_SDCRTST_CMD: return "SDCRTST"; + case MFC_SDCRZ_CMD: return "SDCRZ"; + case MFC_SDCRS_CMD: return "SDCRS"; + case MFC_SDCRF_CMD: return "SDCRF"; - case MFC_BARRIER_MASK: - case MFC_FENCE_MASK: - case MFC_LIST_MASK: - case MFC_START_MASK: - case MFC_RESULT_MASK: - break; - } + case MFC_BARRIER_MASK: + case MFC_FENCE_MASK: + case MFC_LIST_MASK: + case MFC_START_MASK: + case MFC_RESULT_MASK: + break; + } - return unknown; - }); + return unknown; + }); } template <> diff --git a/rpcs3/rpcs3/Emu/Cell/MFC.h b/rpcs3/rpcs3/Emu/Cell/MFC.h index c7fe58835..5d7601087 100644 --- a/rpcs3/rpcs3/Emu/Cell/MFC.h +++ b/rpcs3/rpcs3/Emu/Cell/MFC.h @@ -4,35 +4,53 @@ enum MFC : u8 { - MFC_PUT_CMD = 0x20, MFC_PUTB_CMD = 0x21, MFC_PUTF_CMD = 0x22, - MFC_PUTS_CMD = 0x28, MFC_PUTBS_CMD = 0x29, MFC_PUTFS_CMD = 0x2a, - MFC_PUTR_CMD = 0x30, MFC_PUTRB_CMD = 0x31, MFC_PUTRF_CMD = 0x32, - MFC_GET_CMD = 0x40, MFC_GETB_CMD = 0x41, MFC_GETF_CMD = 0x42, - MFC_GETS_CMD = 0x48, MFC_GETBS_CMD = 0x49, MFC_GETFS_CMD = 0x4a, - MFC_PUTL_CMD = 0x24, MFC_PUTLB_CMD = 0x25, MFC_PUTLF_CMD = 0x26, - MFC_PUTRL_CMD = 0x34, MFC_PUTRLB_CMD = 0x35, MFC_PUTRLF_CMD = 0x36, - MFC_GETL_CMD = 0x44, MFC_GETLB_CMD = 0x45, MFC_GETLF_CMD = 0x46, - MFC_GETLLAR_CMD = 0xD0, - MFC_PUTLLC_CMD = 0xB4, - MFC_PUTLLUC_CMD = 0xB0, + MFC_PUT_CMD = 0x20, + MFC_PUTB_CMD = 0x21, + MFC_PUTF_CMD = 0x22, + MFC_PUTS_CMD = 0x28, + MFC_PUTBS_CMD = 0x29, + MFC_PUTFS_CMD = 0x2a, + MFC_PUTR_CMD = 0x30, + MFC_PUTRB_CMD = 0x31, + MFC_PUTRF_CMD = 0x32, + MFC_GET_CMD = 0x40, + MFC_GETB_CMD = 0x41, + MFC_GETF_CMD = 0x42, + MFC_GETS_CMD = 0x48, + MFC_GETBS_CMD = 0x49, + MFC_GETFS_CMD = 0x4a, + MFC_PUTL_CMD = 0x24, + MFC_PUTLB_CMD = 0x25, + MFC_PUTLF_CMD = 0x26, + MFC_PUTRL_CMD = 0x34, + MFC_PUTRLB_CMD = 0x35, + MFC_PUTRLF_CMD = 0x36, + MFC_GETL_CMD = 0x44, + MFC_GETLB_CMD = 0x45, + MFC_GETLF_CMD = 0x46, + MFC_GETLLAR_CMD = 0xD0, + MFC_PUTLLC_CMD = 0xB4, + MFC_PUTLLUC_CMD = 0xB0, MFC_PUTQLLUC_CMD = 0xB8, - MFC_SNDSIG_CMD = 0xA0, MFC_SNDSIGB_CMD = 0xA1, MFC_SNDSIGF_CMD = 0xA2, - MFC_BARRIER_CMD = 0xC0, - MFC_EIEIO_CMD = 0xC8, - MFC_SYNC_CMD = 0xCC, + MFC_SNDSIG_CMD = 0xA0, + MFC_SNDSIGB_CMD = 0xA1, + MFC_SNDSIGF_CMD = 0xA2, + MFC_BARRIER_CMD = 0xC0, + MFC_EIEIO_CMD = 0xC8, + MFC_SYNC_CMD = 0xCC, MFC_BARRIER_MASK = 0x01, - MFC_FENCE_MASK = 0x02, - MFC_LIST_MASK = 0x04, - MFC_START_MASK = 0x08, - MFC_RESULT_MASK = 0x10, // ??? + MFC_FENCE_MASK = 0x02, + MFC_LIST_MASK = 0x04, + MFC_START_MASK = 0x08, + MFC_RESULT_MASK = 0x10, // ??? - MFC_SDCRT_CMD = 0x80, + MFC_SDCRT_CMD = 0x80, MFC_SDCRTST_CMD = 0x81, - MFC_SDCRZ_CMD = 0x89, - MFC_SDCRS_CMD = 0x8D, - MFC_SDCRF_CMD = 0x8F, + MFC_SDCRZ_CMD = 0x89, + MFC_SDCRS_CMD = 0x8D, + MFC_SDCRF_CMD = 0x8F, }; // Atomic Status Update @@ -48,42 +66,42 @@ enum mfc_atomic_status : u32 enum mfc_tag_update : u32 { MFC_TAG_UPDATE_IMMEDIATE = 0, - MFC_TAG_UPDATE_ANY = 1, - MFC_TAG_UPDATE_ALL = 2, + MFC_TAG_UPDATE_ANY = 1, + MFC_TAG_UPDATE_ALL = 2, }; enum : u32 { - MFC_PPU_DMA_CMD_ENQUEUE_SUCCESSFUL = 0x00, - MFC_PPU_DMA_CMD_SEQUENCE_ERROR = 0x01, - MFC_PPU_DMA_QUEUE_FULL = 0x02, + MFC_PPU_DMA_CMD_ENQUEUE_SUCCESSFUL = 0x00, + MFC_PPU_DMA_CMD_SEQUENCE_ERROR = 0x01, + MFC_PPU_DMA_QUEUE_FULL = 0x02, }; enum : u32 { - MFC_PROXY_COMMAND_QUEUE_EMPTY_FLAG = 0x80000000, + MFC_PROXY_COMMAND_QUEUE_EMPTY_FLAG = 0x80000000, }; enum : u32 { - MFC_PPU_MAX_QUEUE_SPACE = 0x08, - MFC_SPU_MAX_QUEUE_SPACE = 0x10, + MFC_PPU_MAX_QUEUE_SPACE = 0x08, + MFC_SPU_MAX_QUEUE_SPACE = 0x10, }; enum : u32 { - MFC_DMA_TAG_STATUS_UPDATE_EVENT = 0x00000001, + MFC_DMA_TAG_STATUS_UPDATE_EVENT = 0x00000001, MFC_DMA_TAG_CMD_STALL_NOTIFY_EVENT = 0x00000002, - MFC_DMA_QUEUE_VACANCY_EVENT = 0x00000008, - MFC_SPU_MAILBOX_WRITTEN_EVENT = 0x00000010, - MFC_DECREMENTER_EVENT = 0x00000020, - MFC_PU_INT_MAILBOX_AVAIL_EVENT = 0x00000040, - MFC_PU_MAILBOX_AVAIL_EVENT = 0x00000080, - MFC_SIGNAL_2_EVENT = 0x00000100, - MFC_SIGNAL_1_EVENT = 0x00000200, - MFC_LLR_LOST_EVENT = 0x00000400, - MFC_PRIV_ATTN_EVENT = 0x00000800, - MFC_MULTISOURCE_SYNC_EVENT = 0x00001000, + MFC_DMA_QUEUE_VACANCY_EVENT = 0x00000008, + MFC_SPU_MAILBOX_WRITTEN_EVENT = 0x00000010, + MFC_DECREMENTER_EVENT = 0x00000020, + MFC_PU_INT_MAILBOX_AVAIL_EVENT = 0x00000040, + MFC_PU_MAILBOX_AVAIL_EVENT = 0x00000080, + MFC_SIGNAL_2_EVENT = 0x00000100, + MFC_SIGNAL_1_EVENT = 0x00000200, + MFC_LLR_LOST_EVENT = 0x00000400, + MFC_PRIV_ATTN_EVENT = 0x00000800, + MFC_MULTISOURCE_SYNC_EVENT = 0x00001000, }; struct alignas(16) spu_mfc_cmd diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/HLE_PATCHES.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/HLE_PATCHES.cpp index 8b3ad0b63..cf2536ea9 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/HLE_PATCHES.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/HLE_PATCHES.cpp @@ -52,6 +52,6 @@ void WaitForSPUsToEmptySNRs(ppu_thread& ppu, u32 spu_id, u32 snr_mask) } DECLARE(ppu_module_manager::hle_patches)("RPCS3_HLE_LIBRARY", []() -{ - REG_FUNC(RPCS3_HLE_LIBRARY, WaitForSPUsToEmptySNRs); -}); + { + REG_FUNC(RPCS3_HLE_LIBRARY, WaitForSPUsToEmptySNRs); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/StaticHLE.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/StaticHLE.cpp index bce536d22..c16668c02 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/StaticHLE.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/StaticHLE.cpp @@ -7,21 +7,18 @@ LOG_CHANNEL(static_hle); // for future use -DECLARE(ppu_module_manager::static_hle) ("static_hle", []() -{ -}); +DECLARE(ppu_module_manager::static_hle)("static_hle", []() {}); -std::vector> shle_patterns_list -{ - { "2BA5000778630020788400207C6B1B78419D00702C2500004D82002028A5000F", "FF", "36D0", "05C4", "sys_libc", "memcpy" }, - { "2BA5000778630020788400207C6B1B78419D00702C2500004D82002028A5000F", "5C", "87A0", "05C4", "sys_libc", "memcpy" }, - { "2B8500077CA32A14788406207C6A1B78409D009C3903000198830000788B45E4", "B4", "1453", "00D4", "sys_libc", "memset" }, - { "280500087C661B7840800020280500004D8200207CA903A69886000038C60001", "F8", "F182", "0118", "sys_libc", "memset" }, - { "2B8500077CA32A14788406207C6A1B78409D009C3903000198830000788B45E4", "70", "DFDA", "00D4", "sys_libc", "memset" }, - { "7F832000FB61FFD8FBE1FFF8FB81FFE0FBA1FFE8FBC1FFF07C7B1B787C9F2378", "FF", "25B5", "12D4", "sys_libc", "memmove" }, - { "2B850007409D00B07C6923785520077E2F800000409E00ACE8030000E9440000", "FF", "71F1", "0158", "sys_libc", "memcmp" }, - { "280500007CE32050788B0760418200E028850100786A07607C2A580040840210", "FF", "87F2", "0470", "sys_libc", "memcmp" }, - { "2B850007409D00B07C6923785520077E2F800000409E00ACE8030000E9440000", "68", "EF18", "0158", "sys_libc", "memcmp" }, +std::vector> shle_patterns_list{ + {"2BA5000778630020788400207C6B1B78419D00702C2500004D82002028A5000F", "FF", "36D0", "05C4", "sys_libc", "memcpy"}, + {"2BA5000778630020788400207C6B1B78419D00702C2500004D82002028A5000F", "5C", "87A0", "05C4", "sys_libc", "memcpy"}, + {"2B8500077CA32A14788406207C6A1B78409D009C3903000198830000788B45E4", "B4", "1453", "00D4", "sys_libc", "memset"}, + {"280500087C661B7840800020280500004D8200207CA903A69886000038C60001", "F8", "F182", "0118", "sys_libc", "memset"}, + {"2B8500077CA32A14788406207C6A1B78409D009C3903000198830000788B45E4", "70", "DFDA", "00D4", "sys_libc", "memset"}, + {"7F832000FB61FFD8FBE1FFF8FB81FFE0FBA1FFE8FBC1FFF07C7B1B787C9F2378", "FF", "25B5", "12D4", "sys_libc", "memmove"}, + {"2B850007409D00B07C6923785520077E2F800000409E00ACE8030000E9440000", "FF", "71F1", "0158", "sys_libc", "memcmp"}, + {"280500007CE32050788B0760418200E028850100786A07607C2A580040840210", "FF", "87F2", "0470", "sys_libc", "memcmp"}, + {"2B850007409D00B07C6923785520077E2F800000409E00ACE8030000E9440000", "68", "EF18", "0158", "sys_libc", "memcmp"}, }; statichle_handler::statichle_handler(int) @@ -83,10 +80,10 @@ bool statichle_handler::load_patterns() dapat.start_pattern[j] = char_to_u8(pattern[0][j * 2], pattern[0][(j * 2) + 1]); dapat.crc16_length = ::narrow(char_to_u8(pattern[1][0], pattern[1][1])); - dapat.crc16 = (char_to_u8(pattern[2][0], pattern[2][1]) << 8) | char_to_u8(pattern[2][2], pattern[2][3]); + dapat.crc16 = (char_to_u8(pattern[2][0], pattern[2][1]) << 8) | char_to_u8(pattern[2][2], pattern[2][3]); dapat.total_length = (char_to_u8(pattern[3][0], pattern[3][1]) << 8) | char_to_u8(pattern[3][2], pattern[3][3]); - dapat._module = pattern[4]; - dapat.name = pattern[5]; + dapat._module = pattern[4]; + dapat.name = pattern[5]; dapat.fnid = ppu_generate_id(dapat.name.c_str()); @@ -119,9 +116,9 @@ u16 statichle_handler::gen_CRC16(const u8* data_p, usz length) } } while (--length != 0); - crc = ~crc; + crc = ~crc; data = crc; - crc = (crc << 8) | ((data >> 8) & 0xff); + crc = (crc << 8) | ((data >> 8) & 0xff); return static_cast(crc); } @@ -162,14 +159,14 @@ bool statichle_handler::check_against_patterns(vm::cptr& data, u32 size, u32 return false; } - const auto sfunc = &::at32(smodule->functions, pat.fnid); - const u32 target = g_fxo->get().func_addr(sfunc->index, true); + const auto sfunc = &::at32(smodule->functions, pat.fnid); + const u32 target = g_fxo->get().func_addr(sfunc->index, true); // write stub - vm::write32(addr, ppu_instructions::LIS(0, (target&0xFFFF0000)>>16)); - vm::write32(addr+4, ppu_instructions::ORI(0, 0, target&0xFFFF)); - vm::write32(addr+8, ppu_instructions::MTCTR(0)); - vm::write32(addr+12, ppu_instructions::BCTR()); + vm::write32(addr, ppu_instructions::LIS(0, (target & 0xFFFF0000) >> 16)); + vm::write32(addr + 4, ppu_instructions::ORI(0, 0, target & 0xFFFF)); + vm::write32(addr + 8, ppu_instructions::MTCTR(0)); + vm::write32(addr + 12, ppu_instructions::BCTR()); return true; } diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAdec.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellAdec.cpp index dfc91c8d2..232993d10 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAdec.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAdec.cpp @@ -36,194 +36,265 @@ vm::gvar g_cell_adec_core_ops_truehd; vm::gvar g_cell_adec_core_ops_wma; vm::gvar g_cell_adec_core_ops_WmaLsl; vm::gvar g_cell_adec_core_ops_WmaPro; -error_code _SceAdecCorrectPtsValue_Celp8(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_Celp(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_Ddp(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_DtsCore(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_DtsHd_Core(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_DtsHd(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_DtsLbr(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_Aac(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_mpmc(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_M4Aac(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_M4Aac2ch(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_M4Aac2chmod(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_Mp3s(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_mpmcl1(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_truehd(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_wma(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_WmaLsl(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } -error_code _SceAdecCorrectPtsValue_WmaPro(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_Celp8(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_Celp(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_Ddp(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_DtsCore(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_DtsHd_Core(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_DtsHd(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_DtsLbr(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_Aac(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_mpmc(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_M4Aac(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_M4Aac2ch(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_M4Aac2chmod(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_Mp3s(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_mpmcl1(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_truehd(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_wma(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_WmaLsl(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} +error_code _SceAdecCorrectPtsValue_WmaPro(ppu_thread&, vm::ptr, vm::ptr) +{ + UNIMPLEMENTED_FUNC(cellAdec); + return CELL_OK; +} template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellAdecError value) - { - switch (value) { - STR_CASE(CELL_ADEC_ERROR_FATAL); - STR_CASE(CELL_ADEC_ERROR_SEQ); - STR_CASE(CELL_ADEC_ERROR_ARG); - STR_CASE(CELL_ADEC_ERROR_BUSY); - STR_CASE(CELL_ADEC_ERROR_EMPTY); - STR_CASE(CELL_ADEC_ERROR_CELP_BUSY); - STR_CASE(CELL_ADEC_ERROR_CELP_EMPTY); - STR_CASE(CELL_ADEC_ERROR_CELP_ARG); - STR_CASE(CELL_ADEC_ERROR_CELP_SEQ); - STR_CASE(CELL_ADEC_ERROR_CELP_CORE_FATAL); - STR_CASE(CELL_ADEC_ERROR_CELP_CORE_ARG); - STR_CASE(CELL_ADEC_ERROR_CELP_CORE_SEQ); - STR_CASE(CELL_ADEC_ERROR_CELP8_BUSY); - STR_CASE(CELL_ADEC_ERROR_CELP8_EMPTY); - STR_CASE(CELL_ADEC_ERROR_CELP8_ARG); - STR_CASE(CELL_ADEC_ERROR_CELP8_SEQ); - STR_CASE(CELL_ADEC_ERROR_CELP8_CORE_FATAL); - STR_CASE(CELL_ADEC_ERROR_CELP8_CORE_ARG); - STR_CASE(CELL_ADEC_ERROR_CELP8_CORE_SEQ); - STR_CASE(CELL_ADEC_ERROR_M4AAC_FATAL); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SEQ); - STR_CASE(CELL_ADEC_ERROR_M4AAC_ARG); - STR_CASE(CELL_ADEC_ERROR_M4AAC_BUSY); - STR_CASE(CELL_ADEC_ERROR_M4AAC_EMPTY); - STR_CASE(CELL_ADEC_ERROR_M4AAC_BUFFER_OVERFLOW); - STR_CASE(CELL_ADEC_ERROR_M4AAC_END_OF_BITSTREAM); - STR_CASE(CELL_ADEC_ERROR_M4AAC_CH_CONFIG_INCONSISTENCY); - STR_CASE(CELL_ADEC_ERROR_M4AAC_NO_CH_DEFAULT_POS); - STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_CH_POS); - STR_CASE(CELL_ADEC_ERROR_M4AAC_UNANTICIPATED_COUPLING_CH); - STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_LAYER_ID); - STR_CASE(CELL_ADEC_ERROR_M4AAC_ADTS_SYNCWORD_ERROR); - STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_ADTS_ID); - STR_CASE(CELL_ADEC_ERROR_M4AAC_CH_CHANGED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SAMPLING_FREQ_CHANGED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_WRONG_SBR_CH); - STR_CASE(CELL_ADEC_ERROR_M4AAC_WRONG_SCALE_FACTOR); - STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_BOOKS); - STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_SECTION_DATA); - STR_CASE(CELL_ADEC_ERROR_M4AAC_PULSE_IS_NOT_LONG); - STR_CASE(CELL_ADEC_ERROR_M4AAC_GC_IS_NOT_SUPPORTED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_ELEMENT_ID); - STR_CASE(CELL_ADEC_ERROR_M4AAC_NO_CH_CONFIG); - STR_CASE(CELL_ADEC_ERROR_M4AAC_UNEXPECTED_OVERLAP_CRC); - STR_CASE(CELL_ADEC_ERROR_M4AAC_CRC_BUFFER_EXCEEDED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_CRC); - STR_CASE(CELL_ADEC_ERROR_M4AAC_BAD_WINDOW_CODE); - STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_ADIF_HEADER_ID); - STR_CASE(CELL_ADEC_ERROR_M4AAC_NOT_SUPPORTED_PROFILE); - STR_CASE(CELL_ADEC_ERROR_M4AAC_PROG_NUMBER_NOT_FOUND); - STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_SAMP_RATE_INDEX); - STR_CASE(CELL_ADEC_ERROR_M4AAC_UNANTICIPATED_CH_CONFIG); - STR_CASE(CELL_ADEC_ERROR_M4AAC_PULSE_OVERFLOWED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_CAN_NOT_UNPACK_INDEX); - STR_CASE(CELL_ADEC_ERROR_M4AAC_DEINTERLEAVE_FAILED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_CALC_BAND_OFFSET_FAILED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_SCALE_FACTOR_FAILED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_CC_GAIN_FAILED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_MIX_COUPLING_CH_FAILED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_GROUP_IS_INVALID); - STR_CASE(CELL_ADEC_ERROR_M4AAC_PREDICT_FAILED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_PREDICT_RESET_PATTERN); - STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_TNS_FRAME_INFO); - STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_MASK_FAILED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_GROUP_FAILED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_LPFLAG_FAILED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_INVERSE_QUANTIZATION_FAILED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_CB_MAP_FAILED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_PULSE_FAILED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_MONO_MIXDOWN_ELEMENT_IS_NOT_SUPPORTED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_STEREO_MIXDOWN_ELEMENT_IS_NOT_SUPPORTED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_CH_OVERFLOW); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_NOSYNCH); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_PROGRAM); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_TAG); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_CHN_CONFIG); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_SECTION); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_SCFACTORS); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_PULSE_DATA); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_MAIN_PROFILE_NOT_IMPLEMENTED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_GC_NOT_IMPLEMENTED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_PLUS_ELE_ID); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_CREATE_ERROR); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_NOT_INITIALIZED); - STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_INVALID_ENVELOPE); - STR_CASE(CELL_ADEC_ERROR_AC3_BUSY); - STR_CASE(CELL_ADEC_ERROR_AC3_EMPTY); - STR_CASE(CELL_ADEC_ERROR_AC3_PARAM); - STR_CASE(CELL_ADEC_ERROR_AC3_FRAME); - STR_CASE(CELL_ADEC_ERROR_AT3_OK); // CELL_ADEC_ERROR_AT3_OFFSET - STR_CASE(CELL_ADEC_ERROR_AT3_BUSY); - STR_CASE(CELL_ADEC_ERROR_AT3_EMPTY); - STR_CASE(CELL_ADEC_ERROR_AT3_ERROR); - STR_CASE(CELL_ADEC_ERROR_LPCM_FATAL); - STR_CASE(CELL_ADEC_ERROR_LPCM_SEQ); - STR_CASE(CELL_ADEC_ERROR_LPCM_ARG); - STR_CASE(CELL_ADEC_ERROR_LPCM_BUSY); - STR_CASE(CELL_ADEC_ERROR_LPCM_EMPTY); - STR_CASE(CELL_ADEC_ERROR_MP3_OK); // CELL_ADEC_ERROR_MP3_OFFSET - STR_CASE(CELL_ADEC_ERROR_MP3_BUSY); - STR_CASE(CELL_ADEC_ERROR_MP3_EMPTY); - STR_CASE(CELL_ADEC_ERROR_MP3_ERROR); - STR_CASE(CELL_ADEC_ERROR_MP3_LOST_SYNC); - STR_CASE(CELL_ADEC_ERROR_MP3_NOT_L3); - STR_CASE(CELL_ADEC_ERROR_MP3_BAD_BITRATE); - STR_CASE(CELL_ADEC_ERROR_MP3_BAD_SFREQ); - STR_CASE(CELL_ADEC_ERROR_MP3_BAD_EMPHASIS); - STR_CASE(CELL_ADEC_ERROR_MP3_BAD_BLKTYPE); - STR_CASE(CELL_ADEC_ERROR_MP3_BAD_VERSION); - STR_CASE(CELL_ADEC_ERROR_MP3_BAD_MODE); - STR_CASE(CELL_ADEC_ERROR_MP3_BAD_MODE_EXT); - STR_CASE(CELL_ADEC_ERROR_MP3_HUFFMAN_NUM); - STR_CASE(CELL_ADEC_ERROR_MP3_HUFFMAN_CASE_ID); - STR_CASE(CELL_ADEC_ERROR_MP3_SCALEFAC_COMPRESS); - STR_CASE(CELL_ADEC_ERROR_MP3_HGETBIT); - STR_CASE(CELL_ADEC_ERROR_MP3_FLOATING_EXCEPTION); - STR_CASE(CELL_ADEC_ERROR_MP3_ARRAY_OVERFLOW); - STR_CASE(CELL_ADEC_ERROR_MP3_STEREO_PROCESSING); - STR_CASE(CELL_ADEC_ERROR_MP3_JS_BOUND); - STR_CASE(CELL_ADEC_ERROR_MP3_PCMOUT); - STR_CASE(CELL_ADEC_ERROR_M2BC_FATAL); - STR_CASE(CELL_ADEC_ERROR_M2BC_SEQ); - STR_CASE(CELL_ADEC_ERROR_M2BC_ARG); - STR_CASE(CELL_ADEC_ERROR_M2BC_BUSY); - STR_CASE(CELL_ADEC_ERROR_M2BC_EMPTY); - STR_CASE(CELL_ADEC_ERROR_M2BC_SYNCF); - STR_CASE(CELL_ADEC_ERROR_M2BC_LAYER); - STR_CASE(CELL_ADEC_ERROR_M2BC_BITRATE); - STR_CASE(CELL_ADEC_ERROR_M2BC_SAMPLEFREQ); - STR_CASE(CELL_ADEC_ERROR_M2BC_VERSION); - STR_CASE(CELL_ADEC_ERROR_M2BC_MODE_EXT); - STR_CASE(CELL_ADEC_ERROR_M2BC_UNSUPPORT); - STR_CASE(CELL_ADEC_ERROR_M2BC_OPENBS_EX); - STR_CASE(CELL_ADEC_ERROR_M2BC_SYNCF_EX); - STR_CASE(CELL_ADEC_ERROR_M2BC_CRCGET_EX); - STR_CASE(CELL_ADEC_ERROR_M2BC_CRC_EX); - STR_CASE(CELL_ADEC_ERROR_M2BC_CRCGET); - STR_CASE(CELL_ADEC_ERROR_M2BC_CRC); - STR_CASE(CELL_ADEC_ERROR_M2BC_BITALLOC); - STR_CASE(CELL_ADEC_ERROR_M2BC_SCALE); - STR_CASE(CELL_ADEC_ERROR_M2BC_SAMPLE); - STR_CASE(CELL_ADEC_ERROR_M2BC_OPENBS); - STR_CASE(CELL_ADEC_ERROR_M2BC_MC_CRCGET); - STR_CASE(CELL_ADEC_ERROR_M2BC_MC_CRC); - STR_CASE(CELL_ADEC_ERROR_M2BC_MC_BITALLOC); - STR_CASE(CELL_ADEC_ERROR_M2BC_MC_SCALE); - STR_CASE(CELL_ADEC_ERROR_M2BC_MC_SAMPLE); - STR_CASE(CELL_ADEC_ERROR_M2BC_MC_HEADER); - STR_CASE(CELL_ADEC_ERROR_M2BC_MC_STATUS); - STR_CASE(CELL_ADEC_ERROR_M2BC_AG_CCRCGET); - STR_CASE(CELL_ADEC_ERROR_M2BC_AG_CRC); - STR_CASE(CELL_ADEC_ERROR_M2BC_AG_BITALLOC); - STR_CASE(CELL_ADEC_ERROR_M2BC_AG_SCALE); - STR_CASE(CELL_ADEC_ERROR_M2BC_AG_SAMPLE); - STR_CASE(CELL_ADEC_ERROR_M2BC_AG_STATUS); - } + switch (value) + { + STR_CASE(CELL_ADEC_ERROR_FATAL); + STR_CASE(CELL_ADEC_ERROR_SEQ); + STR_CASE(CELL_ADEC_ERROR_ARG); + STR_CASE(CELL_ADEC_ERROR_BUSY); + STR_CASE(CELL_ADEC_ERROR_EMPTY); + STR_CASE(CELL_ADEC_ERROR_CELP_BUSY); + STR_CASE(CELL_ADEC_ERROR_CELP_EMPTY); + STR_CASE(CELL_ADEC_ERROR_CELP_ARG); + STR_CASE(CELL_ADEC_ERROR_CELP_SEQ); + STR_CASE(CELL_ADEC_ERROR_CELP_CORE_FATAL); + STR_CASE(CELL_ADEC_ERROR_CELP_CORE_ARG); + STR_CASE(CELL_ADEC_ERROR_CELP_CORE_SEQ); + STR_CASE(CELL_ADEC_ERROR_CELP8_BUSY); + STR_CASE(CELL_ADEC_ERROR_CELP8_EMPTY); + STR_CASE(CELL_ADEC_ERROR_CELP8_ARG); + STR_CASE(CELL_ADEC_ERROR_CELP8_SEQ); + STR_CASE(CELL_ADEC_ERROR_CELP8_CORE_FATAL); + STR_CASE(CELL_ADEC_ERROR_CELP8_CORE_ARG); + STR_CASE(CELL_ADEC_ERROR_CELP8_CORE_SEQ); + STR_CASE(CELL_ADEC_ERROR_M4AAC_FATAL); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SEQ); + STR_CASE(CELL_ADEC_ERROR_M4AAC_ARG); + STR_CASE(CELL_ADEC_ERROR_M4AAC_BUSY); + STR_CASE(CELL_ADEC_ERROR_M4AAC_EMPTY); + STR_CASE(CELL_ADEC_ERROR_M4AAC_BUFFER_OVERFLOW); + STR_CASE(CELL_ADEC_ERROR_M4AAC_END_OF_BITSTREAM); + STR_CASE(CELL_ADEC_ERROR_M4AAC_CH_CONFIG_INCONSISTENCY); + STR_CASE(CELL_ADEC_ERROR_M4AAC_NO_CH_DEFAULT_POS); + STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_CH_POS); + STR_CASE(CELL_ADEC_ERROR_M4AAC_UNANTICIPATED_COUPLING_CH); + STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_LAYER_ID); + STR_CASE(CELL_ADEC_ERROR_M4AAC_ADTS_SYNCWORD_ERROR); + STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_ADTS_ID); + STR_CASE(CELL_ADEC_ERROR_M4AAC_CH_CHANGED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SAMPLING_FREQ_CHANGED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_WRONG_SBR_CH); + STR_CASE(CELL_ADEC_ERROR_M4AAC_WRONG_SCALE_FACTOR); + STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_BOOKS); + STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_SECTION_DATA); + STR_CASE(CELL_ADEC_ERROR_M4AAC_PULSE_IS_NOT_LONG); + STR_CASE(CELL_ADEC_ERROR_M4AAC_GC_IS_NOT_SUPPORTED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_ELEMENT_ID); + STR_CASE(CELL_ADEC_ERROR_M4AAC_NO_CH_CONFIG); + STR_CASE(CELL_ADEC_ERROR_M4AAC_UNEXPECTED_OVERLAP_CRC); + STR_CASE(CELL_ADEC_ERROR_M4AAC_CRC_BUFFER_EXCEEDED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_CRC); + STR_CASE(CELL_ADEC_ERROR_M4AAC_BAD_WINDOW_CODE); + STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_ADIF_HEADER_ID); + STR_CASE(CELL_ADEC_ERROR_M4AAC_NOT_SUPPORTED_PROFILE); + STR_CASE(CELL_ADEC_ERROR_M4AAC_PROG_NUMBER_NOT_FOUND); + STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_SAMP_RATE_INDEX); + STR_CASE(CELL_ADEC_ERROR_M4AAC_UNANTICIPATED_CH_CONFIG); + STR_CASE(CELL_ADEC_ERROR_M4AAC_PULSE_OVERFLOWED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_CAN_NOT_UNPACK_INDEX); + STR_CASE(CELL_ADEC_ERROR_M4AAC_DEINTERLEAVE_FAILED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_CALC_BAND_OFFSET_FAILED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_SCALE_FACTOR_FAILED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_CC_GAIN_FAILED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_MIX_COUPLING_CH_FAILED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_GROUP_IS_INVALID); + STR_CASE(CELL_ADEC_ERROR_M4AAC_PREDICT_FAILED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_PREDICT_RESET_PATTERN); + STR_CASE(CELL_ADEC_ERROR_M4AAC_INVALID_TNS_FRAME_INFO); + STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_MASK_FAILED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_GROUP_FAILED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_LPFLAG_FAILED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_INVERSE_QUANTIZATION_FAILED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_CB_MAP_FAILED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_GET_PULSE_FAILED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_MONO_MIXDOWN_ELEMENT_IS_NOT_SUPPORTED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_STEREO_MIXDOWN_ELEMENT_IS_NOT_SUPPORTED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_CH_OVERFLOW); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_NOSYNCH); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_PROGRAM); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_TAG); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_CHN_CONFIG); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_SECTION); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_SCFACTORS); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_PULSE_DATA); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_MAIN_PROFILE_NOT_IMPLEMENTED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_GC_NOT_IMPLEMENTED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_PLUS_ELE_ID); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_CREATE_ERROR); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_NOT_INITIALIZED); + STR_CASE(CELL_ADEC_ERROR_M4AAC_SBR_INVALID_ENVELOPE); + STR_CASE(CELL_ADEC_ERROR_AC3_BUSY); + STR_CASE(CELL_ADEC_ERROR_AC3_EMPTY); + STR_CASE(CELL_ADEC_ERROR_AC3_PARAM); + STR_CASE(CELL_ADEC_ERROR_AC3_FRAME); + STR_CASE(CELL_ADEC_ERROR_AT3_OK); // CELL_ADEC_ERROR_AT3_OFFSET + STR_CASE(CELL_ADEC_ERROR_AT3_BUSY); + STR_CASE(CELL_ADEC_ERROR_AT3_EMPTY); + STR_CASE(CELL_ADEC_ERROR_AT3_ERROR); + STR_CASE(CELL_ADEC_ERROR_LPCM_FATAL); + STR_CASE(CELL_ADEC_ERROR_LPCM_SEQ); + STR_CASE(CELL_ADEC_ERROR_LPCM_ARG); + STR_CASE(CELL_ADEC_ERROR_LPCM_BUSY); + STR_CASE(CELL_ADEC_ERROR_LPCM_EMPTY); + STR_CASE(CELL_ADEC_ERROR_MP3_OK); // CELL_ADEC_ERROR_MP3_OFFSET + STR_CASE(CELL_ADEC_ERROR_MP3_BUSY); + STR_CASE(CELL_ADEC_ERROR_MP3_EMPTY); + STR_CASE(CELL_ADEC_ERROR_MP3_ERROR); + STR_CASE(CELL_ADEC_ERROR_MP3_LOST_SYNC); + STR_CASE(CELL_ADEC_ERROR_MP3_NOT_L3); + STR_CASE(CELL_ADEC_ERROR_MP3_BAD_BITRATE); + STR_CASE(CELL_ADEC_ERROR_MP3_BAD_SFREQ); + STR_CASE(CELL_ADEC_ERROR_MP3_BAD_EMPHASIS); + STR_CASE(CELL_ADEC_ERROR_MP3_BAD_BLKTYPE); + STR_CASE(CELL_ADEC_ERROR_MP3_BAD_VERSION); + STR_CASE(CELL_ADEC_ERROR_MP3_BAD_MODE); + STR_CASE(CELL_ADEC_ERROR_MP3_BAD_MODE_EXT); + STR_CASE(CELL_ADEC_ERROR_MP3_HUFFMAN_NUM); + STR_CASE(CELL_ADEC_ERROR_MP3_HUFFMAN_CASE_ID); + STR_CASE(CELL_ADEC_ERROR_MP3_SCALEFAC_COMPRESS); + STR_CASE(CELL_ADEC_ERROR_MP3_HGETBIT); + STR_CASE(CELL_ADEC_ERROR_MP3_FLOATING_EXCEPTION); + STR_CASE(CELL_ADEC_ERROR_MP3_ARRAY_OVERFLOW); + STR_CASE(CELL_ADEC_ERROR_MP3_STEREO_PROCESSING); + STR_CASE(CELL_ADEC_ERROR_MP3_JS_BOUND); + STR_CASE(CELL_ADEC_ERROR_MP3_PCMOUT); + STR_CASE(CELL_ADEC_ERROR_M2BC_FATAL); + STR_CASE(CELL_ADEC_ERROR_M2BC_SEQ); + STR_CASE(CELL_ADEC_ERROR_M2BC_ARG); + STR_CASE(CELL_ADEC_ERROR_M2BC_BUSY); + STR_CASE(CELL_ADEC_ERROR_M2BC_EMPTY); + STR_CASE(CELL_ADEC_ERROR_M2BC_SYNCF); + STR_CASE(CELL_ADEC_ERROR_M2BC_LAYER); + STR_CASE(CELL_ADEC_ERROR_M2BC_BITRATE); + STR_CASE(CELL_ADEC_ERROR_M2BC_SAMPLEFREQ); + STR_CASE(CELL_ADEC_ERROR_M2BC_VERSION); + STR_CASE(CELL_ADEC_ERROR_M2BC_MODE_EXT); + STR_CASE(CELL_ADEC_ERROR_M2BC_UNSUPPORT); + STR_CASE(CELL_ADEC_ERROR_M2BC_OPENBS_EX); + STR_CASE(CELL_ADEC_ERROR_M2BC_SYNCF_EX); + STR_CASE(CELL_ADEC_ERROR_M2BC_CRCGET_EX); + STR_CASE(CELL_ADEC_ERROR_M2BC_CRC_EX); + STR_CASE(CELL_ADEC_ERROR_M2BC_CRCGET); + STR_CASE(CELL_ADEC_ERROR_M2BC_CRC); + STR_CASE(CELL_ADEC_ERROR_M2BC_BITALLOC); + STR_CASE(CELL_ADEC_ERROR_M2BC_SCALE); + STR_CASE(CELL_ADEC_ERROR_M2BC_SAMPLE); + STR_CASE(CELL_ADEC_ERROR_M2BC_OPENBS); + STR_CASE(CELL_ADEC_ERROR_M2BC_MC_CRCGET); + STR_CASE(CELL_ADEC_ERROR_M2BC_MC_CRC); + STR_CASE(CELL_ADEC_ERROR_M2BC_MC_BITALLOC); + STR_CASE(CELL_ADEC_ERROR_M2BC_MC_SCALE); + STR_CASE(CELL_ADEC_ERROR_M2BC_MC_SAMPLE); + STR_CASE(CELL_ADEC_ERROR_M2BC_MC_HEADER); + STR_CASE(CELL_ADEC_ERROR_M2BC_MC_STATUS); + STR_CASE(CELL_ADEC_ERROR_M2BC_AG_CCRCGET); + STR_CASE(CELL_ADEC_ERROR_M2BC_AG_CRC); + STR_CASE(CELL_ADEC_ERROR_M2BC_AG_BITALLOC); + STR_CASE(CELL_ADEC_ERROR_M2BC_AG_SCALE); + STR_CASE(CELL_ADEC_ERROR_M2BC_AG_SAMPLE); + STR_CASE(CELL_ADEC_ERROR_M2BC_AG_STATUS); + } - return unknown; - }); + return unknown; + }); } - // LPCM decoder (included in cellAdec/libadec.sprx) vm::gvar g_cell_adec_core_ops_lpcm; @@ -259,7 +330,7 @@ void LpcmDecContext::exec(ppu_thread& ppu) // Wait for the output to be consumed. // The output has to be consumed even if the next command is not a decode command savestate = lpcm_dec_state::waiting_for_output_mutex_lock; - output_mutex_lock: + output_mutex_lock: error_occurred |= static_cast(sys_mutex_lock(ppu, output_mutex, 0) != CELL_OK); @@ -271,7 +342,7 @@ void LpcmDecContext::exec(ppu_thread& ppu) while (output_locked) { savestate = lpcm_dec_state::waiting_for_output_cond_wait; - output_cond_wait: + output_cond_wait: ensure(sys_cond_wait(ppu, output_consumed, 0) == CELL_OK); // Error code isn't checked on LLE @@ -285,7 +356,7 @@ void LpcmDecContext::exec(ppu_thread& ppu) // Pop command from queue savestate = lpcm_dec_state::queue_mutex_lock; - queue_mutex_lock: + queue_mutex_lock: ensure(sys_mutex_lock(ppu, queue_mutex, 0) == CELL_OK); // Error code isn't checked on LLE @@ -301,7 +372,7 @@ void LpcmDecContext::exec(ppu_thread& ppu) cellAdec.trace("Command type: %d", static_cast(cmd.type.get())); savestate = lpcm_dec_state::executing_cmd; - execute_cmd: + execute_cmd: switch (cmd.type) { @@ -351,26 +422,44 @@ void LpcmDecContext::exec(ppu_thread& ppu) { switch (lpcm_param->sizeOfWord) { - case CELL_ADEC_BIT_LENGTH_16: output_size = output_size * 32 / 16; sample_num /= 2; break; + case CELL_ADEC_BIT_LENGTH_16: + output_size = output_size * 32 / 16; + sample_num /= 2; + break; case CELL_ADEC_BIT_LENGTH_20: // Same as below - case CELL_ADEC_BIT_LENGTH_24: output_size = output_size * 32 / 24; sample_num /= 3; break; - default: ; // LLE skips decoding entirely, the output buffer isn't written to, and it outputs whatever was there before + case CELL_ADEC_BIT_LENGTH_24: + output_size = output_size * 32 / 24; + sample_num /= 3; + break; + default:; // LLE skips decoding entirely, the output buffer isn't written to, and it outputs whatever was there before } // LPCM streams with an odd number of channels contain an empty dummy channel switch (lpcm_param->channelNumber) { - case CELL_ADEC_CH_MONO: channel_num = 1; output_size = output_size * 1 / 2; break; - case CELL_ADEC_CH_STEREO: channel_num = 2; break; - case CELL_ADEC_CH_3_0: // Same as below - case CELL_ADEC_CH_2_1: channel_num = 3; output_size = output_size * 3 / 4; break; - case CELL_ADEC_CH_3_1: // Same as below - case CELL_ADEC_CH_2_2: channel_num = 4; break; - case CELL_ADEC_CH_3_2: channel_num = 5; output_size = output_size * 5 / 6; break; + case CELL_ADEC_CH_MONO: + channel_num = 1; + output_size = output_size * 1 / 2; + break; + case CELL_ADEC_CH_STEREO: channel_num = 2; break; + case CELL_ADEC_CH_3_0: // Same as below + case CELL_ADEC_CH_2_1: + channel_num = 3; + output_size = output_size * 3 / 4; + break; + case CELL_ADEC_CH_3_1: // Same as below + case CELL_ADEC_CH_2_2: channel_num = 4; break; + case CELL_ADEC_CH_3_2: + channel_num = 5; + output_size = output_size * 5 / 6; + break; case CELL_ADEC_CH_3_2_LFE: channel_num = 6; break; - case CELL_ADEC_CH_3_4: channel_num = 7; output_size = output_size * 7 / 8; break; + case CELL_ADEC_CH_3_4: + channel_num = 7; + output_size = output_size * 7 / 8; + break; case CELL_ADEC_CH_3_4_LFE: channel_num = 8; break; - default: ; // Don't do anything, LLE simply skips reordering channels + default:; // Don't do anything, LLE simply skips reordering channels } // LLE doesn't check the output size @@ -391,13 +480,9 @@ void LpcmDecContext::exec(ppu_thread& ppu) const v128 s32_1 = gv_unpacklo16(gv_bcst16(0), s16le); const v128 s32_2 = gv_unpackhi16(gv_bcst16(0), s16le); #else - const v128 s32_1 = std::endian::native == std::endian::little - ? gv_shuffle8(s16be, v128::normal_array_t{ -1, -1, 1, 0, -1, -1, 3, 2, -1, -1, 5, 4, -1, -1, 7, 6 }) - : gv_unpacklo16(s16be, gv_bcst16(0)); + const v128 s32_1 = std::endian::native == std::endian::little ? gv_shuffle8(s16be, v128::normal_array_t{-1, -1, 1, 0, -1, -1, 3, 2, -1, -1, 5, 4, -1, -1, 7, 6}) : gv_unpacklo16(s16be, gv_bcst16(0)); - const v128 s32_2 = std::endian::native == std::endian::little - ? gv_shuffle8(s16be, v128::normal_array_t{ -1, -1, 9, 8, -1, -1, 11, 10, -1, -1, 13, 12, -1, -1, 15, 14 }) - : gv_unpackhi16(s16be, gv_bcst16(0)); + const v128 s32_2 = std::endian::native == std::endian::little ? gv_shuffle8(s16be, v128::normal_array_t{-1, -1, 9, 8, -1, -1, 11, 10, -1, -1, 13, 12, -1, -1, 15, 14}) : gv_unpackhi16(s16be, gv_bcst16(0)); #endif // Convert to float and divide by INT32_MAX + 1 const v128 f32_1 = gv_mulfs(gv_cvts32_tofs(s32_1), 1.f / static_cast(0x80000000u)); @@ -418,9 +503,7 @@ void LpcmDecContext::exec(ppu_thread& ppu) for (; i * 3 <= au_size_u8 - static_cast(sizeof(v128)); i += 4) { // Load four samples, convert endianness if necessary and shift left by 8 - const v128 _s32 = std::endian::native == std::endian::little - ? gv_shuffle8(v128::loadu(&input_u8[i * 3]), v128::normal_array_t{ -1, 2, 1, 0, -1, 5, 4, 3, -1, 8, 7, 6, -1, 11, 10, 9 }) - : gv_shuffle8(v128::loadu(&input_u8[i * 3]), v128::normal_array_t{ 0, 1, 2, -1, 3, 4, 5, -1, 6, 7, 8, -1, 9, 10, 11, -1 }); + const v128 _s32 = std::endian::native == std::endian::little ? gv_shuffle8(v128::loadu(&input_u8[i * 3]), v128::normal_array_t{-1, 2, 1, 0, -1, 5, 4, 3, -1, 8, 7, 6, -1, 11, 10, 9}) : gv_shuffle8(v128::loadu(&input_u8[i * 3]), v128::normal_array_t{0, 1, 2, -1, 3, 4, 5, -1, 6, 7, 8, -1, 9, 10, 11, -1}); // Convert to float and divide by INT32_MAX + 1 const v128 _f32 = gv_mulfs(gv_cvts32_tofs(_s32), 1.f / static_cast(0x80000000u)); @@ -430,7 +513,7 @@ void LpcmDecContext::exec(ppu_thread& ppu) for (; i * 3 <= au_size_u8 - 3; i++) { - alignas(alignof(s32)) const u8 s32le[4] = { 0, input_u8[i * 3 + 2], input_u8[i * 3 + 1], input_u8[i * 3] }; + alignas(alignof(s32)) const u8 s32le[4] = {0, input_u8[i * 3 + 2], input_u8[i * 3 + 1], input_u8[i * 3]}; _output[i] = static_cast(std::bit_cast>(s32le)) / static_cast(0x80000000u); } @@ -499,7 +582,7 @@ void LpcmDecContext::exec(ppu_thread& ppu) case CELL_ADEC_CH_3_4: for (s32 i_in = 0, i_out = 0; i_in < sample_num; i_in += 8, i_out += 7) { - const v128 tmp1 = gv_shuffle32<0, 2, 1, 3>(v128::loadu(&_output[i_in])); // Swap Front Right and Center + const v128 tmp1 = gv_shuffle32<0, 2, 1, 3>(v128::loadu(&_output[i_in])); // Swap Front Right and Center const v128 tmp2 = gv_shuffle32<2, 0, 1, 3>(v128::loadu(&_output[i_in + 4])); // Reorder Rear Left, Rear Right, Side Right -> Side Right, Rear Left, Rear Right v128::storeu(tmp1, &_output[i_out]); v128::storeu(tmp2, &_output[i_out + 4]); @@ -516,8 +599,7 @@ void LpcmDecContext::exec(ppu_thread& ppu) } break; - default: - ; // Don't do anything + default:; // Don't do anything } } else @@ -534,13 +616,31 @@ void LpcmDecContext::exec(ppu_thread& ppu) switch (lpcm_param->channelNumber) { case CELL_ADEC_LPCM_DVD_CH_MONO: // Set channel_num to two for mono as well - case CELL_ADEC_LPCM_DVD_CH_STEREO: channel_num = 2; break; - case 4: channel_num = 3; output_size = output_size * 2 / 3; break; - case 5: channel_num = 4; output_size = output_size * 2 / 4; break; - case CELL_ADEC_LPCM_DVD_CH_3_2: channel_num = 5; output_size = output_size * 2 / 5; break; - case CELL_ADEC_LPCM_DVD_CH_3_2_LFE: channel_num = 6; output_size = output_size * 2 / 6; break; - case CELL_ADEC_LPCM_DVD_CH_3_4: channel_num = 7; output_size = output_size * 2 / 7; break; - case CELL_ADEC_LPCM_DVD_CH_3_4_LFE: channel_num = 8; output_size = output_size * 2 / 8; break; + case CELL_ADEC_LPCM_DVD_CH_STEREO: channel_num = 2; break; + case 4: + channel_num = 3; + output_size = output_size * 2 / 3; + break; + case 5: + channel_num = 4; + output_size = output_size * 2 / 4; + break; + case CELL_ADEC_LPCM_DVD_CH_3_2: + channel_num = 5; + output_size = output_size * 2 / 5; + break; + case CELL_ADEC_LPCM_DVD_CH_3_2_LFE: + channel_num = 6; + output_size = output_size * 2 / 6; + break; + case CELL_ADEC_LPCM_DVD_CH_3_4: + channel_num = 7; + output_size = output_size * 2 / 7; + break; + case CELL_ADEC_LPCM_DVD_CH_3_4_LFE: + channel_num = 8; + output_size = output_size * 2 / 8; + break; default: fmt::throw_exception("Unreachable"); // Parameters get verified in adecSetLpcmDvdParams() } @@ -562,9 +662,7 @@ void LpcmDecContext::exec(ppu_thread& ppu) const v128 s16be = gv_unpacklo32(tmp1, tmp2); // Convert endianess if necessary and shift left by 16 - const v128 _s32 = std::endian::native == std::endian::little - ? gv_shuffle8(s16be, v128::normal_array_t{ -1, -1, 1, 0, -1, -1, 3, 2, -1, -1, 5, 4, -1, -1, 7, 6 }) - : gv_unpacklo16(s16be, gv_bcst16(0)); + const v128 _s32 = std::endian::native == std::endian::little ? gv_shuffle8(s16be, v128::normal_array_t{-1, -1, 1, 0, -1, -1, 3, 2, -1, -1, 5, 4, -1, -1, 7, 6}) : gv_unpacklo16(s16be, gv_bcst16(0)); // Convert to float and divide by INT32_MAX + 1 const v128 _f32 = gv_mulfs(gv_cvts32_tofs(_s32), 1.f / static_cast(0x80000000u)); @@ -576,9 +674,7 @@ void LpcmDecContext::exec(ppu_thread& ppu) { const v128 s16be = gv_loadu32(&input_s16[i_in]); - const v128 _s32 = std::endian::native == std::endian::little - ? gv_shuffle8(s16be, v128::normal_array_t{ -1, -1, 1, 0, -1, -1, 3, 2, -1, -1, 5, 4, -1, -1, 7, 6 }) - : gv_unpacklo16(s16be, gv_bcst16(0)); + const v128 _s32 = std::endian::native == std::endian::little ? gv_shuffle8(s16be, v128::normal_array_t{-1, -1, 1, 0, -1, -1, 3, 2, -1, -1, 5, 4, -1, -1, 7, 6}) : gv_unpacklo16(s16be, gv_bcst16(0)); const v128 _f32 = gv_mulfs(gv_cvts32_tofs(_s32), 1.f / static_cast(0x80000000u)); @@ -594,23 +690,15 @@ void LpcmDecContext::exec(ppu_thread& ppu) const s64 next_samples_offset = channel_num * 5; // If channel_num is odd, the low bits of samples three and four are in different bytes - alignas(alignof(v128)) static constexpr auto shuffle_ctrl_same_offset = std::endian::native == std::endian::little - ? v128::normal_array_t{ -1, 8, 1, 0, -1, 8, 3, 2, -1, 11, 5, 4, -1, 11, 7, 6 } - : v128::normal_array_t{ 0, 1, 8, -1, 2, 3, 8, -1, 4, 5, 11, -1, 6, 7, 11, -1 }; + alignas(alignof(v128)) static constexpr auto shuffle_ctrl_same_offset = std::endian::native == std::endian::little ? v128::normal_array_t{-1, 8, 1, 0, -1, 8, 3, 2, -1, 11, 5, 4, -1, 11, 7, 6} : v128::normal_array_t{0, 1, 8, -1, 2, 3, 8, -1, 4, 5, 11, -1, 6, 7, 11, -1}; - alignas(alignof(v128)) static constexpr auto shuffle_ctrl_different_offset = std::endian::native == std::endian::little - ? v128::normal_array_t{ -1, 8, 1, 0, -1, 8, 3, 2, -1, 10, 5, 4, -1, 11, 7, 6 } - : v128::normal_array_t{ 0, 1, 8, -1, 2, 3, 8, -1, 4, 5, 10, -1, 6, 7, 11, -1 }; + alignas(alignof(v128)) static constexpr auto shuffle_ctrl_different_offset = std::endian::native == std::endian::little ? v128::normal_array_t{-1, 8, 1, 0, -1, 8, 3, 2, -1, 10, 5, 4, -1, 11, 7, 6} : v128::normal_array_t{0, 1, 8, -1, 2, 3, 8, -1, 4, 5, 10, -1, 6, 7, 11, -1}; const v128 shuffle_ctrl = channel_num & 1 ? v128::loadu(&shuffle_ctrl_different_offset) : v128::loadu(&shuffle_ctrl_same_offset); - alignas(alignof(v128)) static constexpr auto low_bits_mask_same_offset = std::endian::native == std::endian::little - ? v128::normal_array_t{ 0x00, 0xf0, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff } - : v128::normal_array_t{ 0xff, 0xff, 0xf0, 0x00, 0xff, 0xff, 0x0f, 0x00, 0xff, 0xff, 0xf0, 0x00, 0xff, 0xff, 0x0f, 0x00 }; + alignas(alignof(v128)) static constexpr auto low_bits_mask_same_offset = std::endian::native == std::endian::little ? v128::normal_array_t{0x00, 0xf0, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff} : v128::normal_array_t{0xff, 0xff, 0xf0, 0x00, 0xff, 0xff, 0x0f, 0x00, 0xff, 0xff, 0xf0, 0x00, 0xff, 0xff, 0x0f, 0x00}; - alignas(alignof(v128)) static constexpr auto low_bits_mask_different_offset = std::endian::native == std::endian::little - ? v128::normal_array_t{ 0x00, 0xf0, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff } - : v128::normal_array_t{ 0xff, 0xff, 0xf0, 0x00, 0xff, 0xff, 0x0f, 0x00, 0xff, 0xff, 0x0f, 0x00, 0xff, 0xff, 0xf0, 0x00 }; + alignas(alignof(v128)) static constexpr auto low_bits_mask_different_offset = std::endian::native == std::endian::little ? v128::normal_array_t{0x00, 0xf0, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff} : v128::normal_array_t{0xff, 0xff, 0xf0, 0x00, 0xff, 0xff, 0x0f, 0x00, 0xff, 0xff, 0x0f, 0x00, 0xff, 0xff, 0xf0, 0x00}; const v128 low_bits_mask = channel_num & 1 ? v128::loadu(&low_bits_mask_different_offset) : v128::loadu(&low_bits_mask_same_offset); @@ -655,9 +743,7 @@ void LpcmDecContext::exec(ppu_thread& ppu) s24be = gv_insert16<5>(s24be, read_from_ptr(&input_u8[i_in + low_bytes_3_4_offset])); // Reorder bytes to form four 32-bit integer samples - const v128 _s32 = std::endian::native == std::endian::little - ? gv_shuffle8(s24be, v128::normal_array_t{ -1, 8, 1, 0, -1, 9, 3, 2, -1, 10, 5, 4, -1, 11, 7, 6 }) - : gv_shuffle8(s24be, v128::normal_array_t{ 0, 1, 8, -1, 2, 3, 9, -1, 4, 5, 10, -1, 6, 7, 11, -1 }); + const v128 _s32 = std::endian::native == std::endian::little ? gv_shuffle8(s24be, v128::normal_array_t{-1, 8, 1, 0, -1, 9, 3, 2, -1, 10, 5, 4, -1, 11, 7, 6}) : gv_shuffle8(s24be, v128::normal_array_t{0, 1, 8, -1, 2, 3, 9, -1, 4, 5, 10, -1, 6, 7, 11, -1}); // Convert to float and divide by INT32_MAX + 1 const v128 _f32 = gv_mulfs(gv_cvts32_tofs(_s32), 1.f / static_cast(0x80000000u)); @@ -687,7 +773,7 @@ void LpcmDecContext::exec(ppu_thread& ppu) output_locked = true; error_occurred |= static_cast(sys_mutex_unlock(ppu, output_mutex) != CELL_OK); - const vm::var bsi_info{{ lpcm_param->channelNumber, lpcm_param->sampleRate, static_cast(output_size) }}; + const vm::var bsi_info{{lpcm_param->channelNumber, lpcm_param->sampleRate, static_cast(output_size)}}; notify_pcm_out.cbFunc(ppu, cmd.pcm_handle, output, static_cast(output_size), notify_pcm_out.cbArg, vm::make_var>(bsi_info), ADEC_CORRECT_PTS_VALUE_TYPE_LPCM_HDMV, error_occurred ? static_cast(CELL_ADEC_ERROR_FATAL) : CELL_OK); break; @@ -717,7 +803,7 @@ error_code LpcmDecContext::send_command(ppu_thread& ppu, auto&&... args) // LLE copies the parameters directly into the context if constexpr (type == LpcmDecCmdType::start_seq) { - *lpcm_param = { args... }; + *lpcm_param = {args...}; } if (error_code ret = sys_mutex_lock(ppu, queue_mutex, 0); ret != CELL_OK) @@ -728,8 +814,7 @@ error_code LpcmDecContext::send_command(ppu_thread& ppu, auto&&... args) cmd_queue.emplace(type, std::forward(args)...); - if (error_code ret = sys_mutex_unlock(ppu, queue_mutex); ret != CELL_OK - || (ret = cmd_available.release(ppu)) != CELL_OK) + if (error_code ret = sys_mutex_unlock(ppu, queue_mutex); ret != CELL_OK || (ret = cmd_available.release(ppu)) != CELL_OK) { ensure(sys_mutex_unlock(ppu, queue_size_mutex) == CELL_OK); // Error code isn't checked on LLE return ret; @@ -775,14 +860,11 @@ error_code _CellAdecCoreOpGetMemSize_lpcm(vm::ptr attr) cellAdec.notice("_CellAdecCoreOpGetMemSize_lpcm(attr=*0x%x)", attr); constexpr u32 mem_size = - utils::align(static_cast(sizeof(LpcmDecContext)), 0x80) - + utils::align(static_cast(sizeof(CellAdecParamLpcm)), 0x80) - + 0x100 // Command data for Spurs task - + LPCM_DEC_OUTPUT_BUFFER_SIZE - + 0x2900 // sizeof(CellSpurs) + sizeof(CellSpursTaskset) - + 0x3b400 // Spurs context - + 0x300 // (sizeof(CellSpursQueue) + 0x80 + queue buffer) * 2 - + 0x855; // Unused + utils::align(static_cast(sizeof(LpcmDecContext)), 0x80) + utils::align(static_cast(sizeof(CellAdecParamLpcm)), 0x80) + 0x100 // Command data for Spurs task + + LPCM_DEC_OUTPUT_BUFFER_SIZE + 0x2900 // sizeof(CellSpurs) + sizeof(CellSpursTaskset) + + 0x3b400 // Spurs context + + 0x300 // (sizeof(CellSpursQueue) + 0x80 + queue buffer) * 2 + + 0x855; // Unused static_assert(mem_size == 0x7ebd5); @@ -797,8 +879,8 @@ error_code _CellAdecCoreOpOpenExt_lpcm(ppu_thread& ppu, vm::ptr cellAdec.notice("_CellAdecCoreOpOpenExt_lpcm(handle=*0x%x, notifyAuDone=*0x%x, notifyAuDoneArg=0x%x, notifyPcmOut=*0x%x, notifyPcmOutArg=0x%x, notifyError=*0x%x, notifyErrorArg=0x%x, notifySeqDone=*0x%x, notifySeqDoneArg=0x%x, res=*0x%x, spursRes=*0x%x)", handle, notifyAuDone, notifyAuDoneArg, notifyPcmOut, notifyPcmOutArg, notifyError, notifyErrorArg, notifySeqDone, notifySeqDoneArg, res, spursRes); - ensure(!!handle && !!res); // Not checked on LLE - ensure(handle.aligned(0x80)); // LLE doesn't check the alignment or aligns the address itself + ensure(!!handle && !!res); // Not checked on LLE + ensure(handle.aligned(0x80)); // LLE doesn't check the alignment or aligns the address itself ensure(!!notifyAuDone && !!notifyAuDoneArg && !!notifyPcmOut && !!notifyPcmOutArg && !!notifyError && !!notifyErrorArg && !!notifySeqDone && !!notifySeqDoneArg); // These should always be set const u32 end_of_context_addr = handle.addr() + utils::align(static_cast(sizeof(LpcmDecContext)), 0x80); @@ -807,18 +889,18 @@ error_code _CellAdecCoreOpOpenExt_lpcm(ppu_thread& ppu, vm::ptr handle->cmd_queue.back = 0; handle->cmd_queue.size = 0; handle->run_thread = true; - handle->notify_au_done = { notifyAuDone, notifyAuDoneArg }; - handle->notify_pcm_out = { notifyPcmOut, notifyPcmOutArg }; - handle->notify_error = { notifyError, notifyErrorArg }; - handle->notify_seq_done = { notifySeqDone, notifySeqDoneArg }; + handle->notify_au_done = {notifyAuDone, notifyAuDoneArg}; + handle->notify_pcm_out = {notifyPcmOut, notifyPcmOutArg}; + handle->notify_error = {notifyError, notifyErrorArg}; + handle->notify_seq_done = {notifySeqDone, notifySeqDoneArg}; handle->output = vm::bptr::make(end_of_context_addr + 0x180); handle->lpcm_param.set(end_of_context_addr); handle->error_occurred = false; - const vm::var mutex_attr{{ SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, { "_adem04"_u64 } }}; - const vm::var output_mutex_attr{{ SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, { "_adem05"_u64 } }}; - const vm::var queue_mutex_attr{{ SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, { "_adem06"_u64 } }}; - const vm::var cond_attr{{ SYS_SYNC_NOT_PROCESS_SHARED, 0, 0, { "_adec03"_u64 } }}; + const vm::var mutex_attr{{SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, {"_adem04"_u64}}}; + const vm::var output_mutex_attr{{SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, {"_adem05"_u64}}}; + const vm::var queue_mutex_attr{{SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, {"_adem06"_u64}}}; + const vm::var cond_attr{{SYS_SYNC_NOT_PROCESS_SHARED, 0, 0, {"_adec03"_u64}}}; error_code ret = sys_mutex_create(ppu, handle.ptr(&LpcmDecContext::queue_size_mutex), mutex_attr); ret = ret ? ret : sys_cond_create(ppu, handle.ptr(&LpcmDecContext::queue_size_cond), handle->queue_size_mutex, cond_attr); @@ -865,8 +947,7 @@ error_code _CellAdecCoreOpClose_lpcm(ppu_thread& ppu, vm::ptr ha cellAdec.notice("_CellAdecCoreOpClose_lpcm(handle=*0x%x)", handle); - if (error_code ret = sys_mutex_lock(ppu, handle->queue_size_mutex, 0); ret != CELL_OK - || (ret = sys_mutex_lock(ppu, handle->queue_mutex, 0)) != CELL_OK) + if (error_code ret = sys_mutex_lock(ppu, handle->queue_size_mutex, 0); ret != CELL_OK || (ret = sys_mutex_lock(ppu, handle->queue_mutex, 0)) != CELL_OK) { return ret; } @@ -1008,7 +1089,6 @@ u32 _CellAdecCoreOpGetBsiInfoSize_lpcm() return sizeof(CellAdecLpcmInfo); } - // cellAdec abstraction layer, operates the individual decoders error_code AdecContext::get_new_pcm_handle(vm::ptr au_info) const @@ -1195,29 +1275,29 @@ error_code AdecContext::correct_pts_value(ppu_thread& ppu, s32 pcm_handle, s8 co switch (correct_pts_type) { - case ADEC_CORRECT_PTS_VALUE_TYPE_EAC3: return ppu_execute<&_SceAdecCorrectPtsValue_Ddp>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHD: return ppu_execute<&_SceAdecCorrectPtsValue_DtsHd>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - case ADEC_CORRECT_PTS_VALUE_TYPE_CELP: return ppu_execute<&_SceAdecCorrectPtsValue_Celp>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - case ADEC_CORRECT_PTS_VALUE_TYPE_M2AAC: return ppu_execute<&_SceAdecCorrectPtsValue_Aac>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_EAC3: return ppu_execute<&_SceAdecCorrectPtsValue_Ddp>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHD: return ppu_execute<&_SceAdecCorrectPtsValue_DtsHd>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_CELP: return ppu_execute<&_SceAdecCorrectPtsValue_Celp>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_M2AAC: return ppu_execute<&_SceAdecCorrectPtsValue_Aac>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); case ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L2: return ppu_execute<&_SceAdecCorrectPtsValue_mpmc>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - case ADEC_CORRECT_PTS_VALUE_TYPE_TRUEHD: return ppu_execute<&_SceAdecCorrectPtsValue_truehd>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - case ADEC_CORRECT_PTS_VALUE_TYPE_DTS: return ppu_execute<&_SceAdecCorrectPtsValue_DtsCore>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_TRUEHD: return ppu_execute<&_SceAdecCorrectPtsValue_truehd>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_DTS: return ppu_execute<&_SceAdecCorrectPtsValue_DtsCore>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); case ADEC_CORRECT_PTS_VALUE_TYPE_M4AAC: switch (type.audioCodecType) { - case CELL_ADEC_TYPE_M4AAC: return ppu_execute<&_SceAdecCorrectPtsValue_M4Aac>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - case CELL_ADEC_TYPE_M4AAC_2CH: return ppu_execute<&_SceAdecCorrectPtsValue_M4Aac2ch>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case CELL_ADEC_TYPE_M4AAC: return ppu_execute<&_SceAdecCorrectPtsValue_M4Aac>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case CELL_ADEC_TYPE_M4AAC_2CH: return ppu_execute<&_SceAdecCorrectPtsValue_M4Aac2ch>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); case CELL_ADEC_TYPE_M4AAC_2CH_MOD: return ppu_execute<&_SceAdecCorrectPtsValue_M4Aac2chmod>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - default: return CELL_OK; + default: return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_WMA: return ppu_execute<&_SceAdecCorrectPtsValue_wma>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - case ADEC_CORRECT_PTS_VALUE_TYPE_DTSLBR: return ppu_execute<&_SceAdecCorrectPtsValue_DtsLbr>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - case ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L1: return ppu_execute<&_SceAdecCorrectPtsValue_mpmcl1>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - case ADEC_CORRECT_PTS_VALUE_TYPE_MP3S: return ppu_execute<&_SceAdecCorrectPtsValue_Mp3s>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - case ADEC_CORRECT_PTS_VALUE_TYPE_CELP8: return ppu_execute<&_SceAdecCorrectPtsValue_Celp8>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - case ADEC_CORRECT_PTS_VALUE_TYPE_WMAPRO: return ppu_execute<&_SceAdecCorrectPtsValue_WmaPro>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); - case ADEC_CORRECT_PTS_VALUE_TYPE_WMALSL: return ppu_execute<&_SceAdecCorrectPtsValue_WmaLsl>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_WMA: return ppu_execute<&_SceAdecCorrectPtsValue_wma>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_DTSLBR: return ppu_execute<&_SceAdecCorrectPtsValue_DtsLbr>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L1: return ppu_execute<&_SceAdecCorrectPtsValue_mpmcl1>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_MP3S: return ppu_execute<&_SceAdecCorrectPtsValue_Mp3s>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_CELP8: return ppu_execute<&_SceAdecCorrectPtsValue_Celp8>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_WMAPRO: return ppu_execute<&_SceAdecCorrectPtsValue_WmaPro>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_WMALSL: return ppu_execute<&_SceAdecCorrectPtsValue_WmaLsl>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHDCORE_UNK1: // Same as below case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHDCORE_UNK2: return ppu_execute<&_SceAdecCorrectPtsValue_DtsHd_Core>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); } @@ -1239,18 +1319,18 @@ error_code AdecContext::correct_pts_value(ppu_thread& ppu, s32 pcm_handle, s8 co { switch (correct_pts_type) { - case ADEC_CORRECT_PTS_VALUE_TYPE_LPCM_HDMV: return 450; - case ADEC_CORRECT_PTS_VALUE_TYPE_LPCM_DVD: return 150; + case ADEC_CORRECT_PTS_VALUE_TYPE_LPCM_HDMV: return 450; + case ADEC_CORRECT_PTS_VALUE_TYPE_LPCM_DVD: return 150; case ADEC_CORRECT_PTS_VALUE_TYPE_ATRACX_48000Hz: return 3840; case ADEC_CORRECT_PTS_VALUE_TYPE_ATRACX_44100Hz: return 4180; case ADEC_CORRECT_PTS_VALUE_TYPE_ATRACX_32000Hz: return 5760; - case ADEC_CORRECT_PTS_VALUE_TYPE_AC3: return 2880; - case ADEC_CORRECT_PTS_VALUE_TYPE_ATRAC3: return 4180; - case ADEC_CORRECT_PTS_VALUE_TYPE_MP3_48000Hz: return 2160; - case ADEC_CORRECT_PTS_VALUE_TYPE_MP3_44100Hz: return 2351; - case ADEC_CORRECT_PTS_VALUE_TYPE_MP3_32000Hz: return 3240; - case ADEC_CORRECT_PTS_VALUE_TYPE_ATRAC3MULTI: return 3840; - default: return 0; + case ADEC_CORRECT_PTS_VALUE_TYPE_AC3: return 2880; + case ADEC_CORRECT_PTS_VALUE_TYPE_ATRAC3: return 4180; + case ADEC_CORRECT_PTS_VALUE_TYPE_MP3_48000Hz: return 2160; + case ADEC_CORRECT_PTS_VALUE_TYPE_MP3_44100Hz: return 2351; + case ADEC_CORRECT_PTS_VALUE_TYPE_MP3_32000Hz: return 3240; + case ADEC_CORRECT_PTS_VALUE_TYPE_ATRAC3MULTI: return 3840; + default: return 0; } }(); @@ -1282,39 +1362,39 @@ static vm::cptr get_core_ops(s32 type) { switch (type) { - case CELL_ADEC_TYPE_INVALID1: fmt::throw_exception("Invalid audio codec: CELL_ADEC_TYPE_INVALID1"); - case CELL_ADEC_TYPE_LPCM_PAMF: return g_cell_adec_core_ops_lpcm; - case CELL_ADEC_TYPE_AC3: return vm::cptr::make(*ppu_module_manager::cell_libac3dec.variables.find(0xc58bb170)->second.export_addr); - case CELL_ADEC_TYPE_ATRACX: return vm::cptr::make(*ppu_module_manager::cellAtracXdec.variables.find(0x4944af9a)->second.export_addr); - case CELL_ADEC_TYPE_MP3: return vm::cptr::make(*ppu_module_manager::cellMP3dec.variables.find(0x84276a23)->second.export_addr); - case CELL_ADEC_TYPE_ATRAC3: return vm::cptr::make(*ppu_module_manager::cellAtrac3dec.variables.find(0x60487d65)->second.export_addr); - case CELL_ADEC_TYPE_MPEG_L2: return vm::cptr::make(*ppu_module_manager::cellM2BCdec.variables.find(0x300afe4d)->second.export_addr); - case CELL_ADEC_TYPE_M2AAC: return vm::cptr::make(*ppu_module_manager::cellM2AACdec.variables.find(0xac2f0831)->second.export_addr); - case CELL_ADEC_TYPE_EAC3: return vm::cptr::make(*ppu_module_manager::cellDDPdec.variables.find(0xf5e9c15c)->second.export_addr); - case CELL_ADEC_TYPE_TRUEHD: return vm::cptr::make(*ppu_module_manager::cellTRHDdec.variables.find(0xe88e381b)->second.export_addr); - case CELL_ADEC_TYPE_DTS: return vm::cptr::make(*ppu_module_manager::cellDTSdec.variables.find(0x15248ec5)->second.export_addr); - case CELL_ADEC_TYPE_CELP: return vm::cptr::make(*ppu_module_manager::cellCelpDec.variables.find(0xffe42c22)->second.export_addr); - case CELL_ADEC_TYPE_LPCM_BLURAY: return g_cell_adec_core_ops_lpcm; - case CELL_ADEC_TYPE_ATRACX_2CH: return vm::cptr::make(*ppu_module_manager::cellAtracXdec.variables.find(0x076b33ab)->second.export_addr); - case CELL_ADEC_TYPE_ATRACX_6CH: return vm::cptr::make(*ppu_module_manager::cellAtracXdec.variables.find(0x1d210eaa)->second.export_addr); - case CELL_ADEC_TYPE_ATRACX_8CH: return vm::cptr::make(*ppu_module_manager::cellAtracXdec.variables.find(0xe9a86e54)->second.export_addr); - case CELL_ADEC_TYPE_M4AAC: return vm::cptr::make(*ppu_module_manager::cellM4AacDec.variables.find(0xab61278d)->second.export_addr); - case CELL_ADEC_TYPE_LPCM_DVD: return g_cell_adec_core_ops_lpcm; - case CELL_ADEC_TYPE_WMA: return vm::cptr::make(*ppu_module_manager::cellWMAdec.variables.find(0x88320b10)->second.export_addr); - case CELL_ADEC_TYPE_DTSLBR: return vm::cptr::make(*ppu_module_manager::cellDTSLBRdec.variables.find(0x8c50af52)->second.export_addr); - case CELL_ADEC_TYPE_M4AAC_2CH: return vm::cptr::make(*ppu_module_manager::cellM4AacDec2ch.variables.find(0xe996c664)->second.export_addr); - case CELL_ADEC_TYPE_DTSHD: return vm::cptr::make(*ppu_module_manager::cellDTSHDdec.variables.find(0x51ac2b6c)->second.export_addr); - case CELL_ADEC_TYPE_MPEG_L1: return vm::cptr::make(*ppu_module_manager::cellMPL1dec.variables.find(0xbbc70551)->second.export_addr); - case CELL_ADEC_TYPE_MP3S: return vm::cptr::make(*ppu_module_manager::cellMP3Sdec.variables.find(0x292cdf0a)->second.export_addr); + case CELL_ADEC_TYPE_INVALID1: fmt::throw_exception("Invalid audio codec: CELL_ADEC_TYPE_INVALID1"); + case CELL_ADEC_TYPE_LPCM_PAMF: return g_cell_adec_core_ops_lpcm; + case CELL_ADEC_TYPE_AC3: return vm::cptr::make(*ppu_module_manager::cell_libac3dec.variables.find(0xc58bb170)->second.export_addr); + case CELL_ADEC_TYPE_ATRACX: return vm::cptr::make(*ppu_module_manager::cellAtracXdec.variables.find(0x4944af9a)->second.export_addr); + case CELL_ADEC_TYPE_MP3: return vm::cptr::make(*ppu_module_manager::cellMP3dec.variables.find(0x84276a23)->second.export_addr); + case CELL_ADEC_TYPE_ATRAC3: return vm::cptr::make(*ppu_module_manager::cellAtrac3dec.variables.find(0x60487d65)->second.export_addr); + case CELL_ADEC_TYPE_MPEG_L2: return vm::cptr::make(*ppu_module_manager::cellM2BCdec.variables.find(0x300afe4d)->second.export_addr); + case CELL_ADEC_TYPE_M2AAC: return vm::cptr::make(*ppu_module_manager::cellM2AACdec.variables.find(0xac2f0831)->second.export_addr); + case CELL_ADEC_TYPE_EAC3: return vm::cptr::make(*ppu_module_manager::cellDDPdec.variables.find(0xf5e9c15c)->second.export_addr); + case CELL_ADEC_TYPE_TRUEHD: return vm::cptr::make(*ppu_module_manager::cellTRHDdec.variables.find(0xe88e381b)->second.export_addr); + case CELL_ADEC_TYPE_DTS: return vm::cptr::make(*ppu_module_manager::cellDTSdec.variables.find(0x15248ec5)->second.export_addr); + case CELL_ADEC_TYPE_CELP: return vm::cptr::make(*ppu_module_manager::cellCelpDec.variables.find(0xffe42c22)->second.export_addr); + case CELL_ADEC_TYPE_LPCM_BLURAY: return g_cell_adec_core_ops_lpcm; + case CELL_ADEC_TYPE_ATRACX_2CH: return vm::cptr::make(*ppu_module_manager::cellAtracXdec.variables.find(0x076b33ab)->second.export_addr); + case CELL_ADEC_TYPE_ATRACX_6CH: return vm::cptr::make(*ppu_module_manager::cellAtracXdec.variables.find(0x1d210eaa)->second.export_addr); + case CELL_ADEC_TYPE_ATRACX_8CH: return vm::cptr::make(*ppu_module_manager::cellAtracXdec.variables.find(0xe9a86e54)->second.export_addr); + case CELL_ADEC_TYPE_M4AAC: return vm::cptr::make(*ppu_module_manager::cellM4AacDec.variables.find(0xab61278d)->second.export_addr); + case CELL_ADEC_TYPE_LPCM_DVD: return g_cell_adec_core_ops_lpcm; + case CELL_ADEC_TYPE_WMA: return vm::cptr::make(*ppu_module_manager::cellWMAdec.variables.find(0x88320b10)->second.export_addr); + case CELL_ADEC_TYPE_DTSLBR: return vm::cptr::make(*ppu_module_manager::cellDTSLBRdec.variables.find(0x8c50af52)->second.export_addr); + case CELL_ADEC_TYPE_M4AAC_2CH: return vm::cptr::make(*ppu_module_manager::cellM4AacDec2ch.variables.find(0xe996c664)->second.export_addr); + case CELL_ADEC_TYPE_DTSHD: return vm::cptr::make(*ppu_module_manager::cellDTSHDdec.variables.find(0x51ac2b6c)->second.export_addr); + case CELL_ADEC_TYPE_MPEG_L1: return vm::cptr::make(*ppu_module_manager::cellMPL1dec.variables.find(0xbbc70551)->second.export_addr); + case CELL_ADEC_TYPE_MP3S: return vm::cptr::make(*ppu_module_manager::cellMP3Sdec.variables.find(0x292cdf0a)->second.export_addr); case CELL_ADEC_TYPE_M4AAC_2CH_MOD: return vm::cptr::make(*ppu_module_manager::cellM4AacDec2chmod.variables.find(0xdbd26836)->second.export_addr); - case CELL_ADEC_TYPE_CELP8: return vm::cptr::make(*ppu_module_manager::cellCelp8Dec.variables.find(0xf0190c6c)->second.export_addr); - case CELL_ADEC_TYPE_INVALID2: fmt::throw_exception("Invalid audio codec: CELL_ADEC_TYPE_INVALID2"); - case CELL_ADEC_TYPE_INVALID3: fmt::throw_exception("Invalid audio codec: CELL_ADEC_TYPE_INVALID3"); - case CELL_ADEC_TYPE_RESERVED22: fmt::throw_exception("Invalid audio codec: CELL_ADEC_TYPE_RESERVED22"); - case CELL_ADEC_TYPE_RESERVED23: fmt::throw_exception("Invalid audio codec: CELL_ADEC_TYPE_RESERVED23"); - case CELL_ADEC_TYPE_DTSHDCORE: return vm::cptr::make(*ppu_module_manager::cellDTSHDCOREdec.variables.find(0x6c8f4f1c)->second.export_addr); - case CELL_ADEC_TYPE_ATRAC3MULTI: return vm::cptr::make(*ppu_module_manager::cellAtrac3multidec.variables.find(0xc20c6bd7)->second.export_addr); - default: fmt::throw_exception("Invalid audio codec: %d", type); + case CELL_ADEC_TYPE_CELP8: return vm::cptr::make(*ppu_module_manager::cellCelp8Dec.variables.find(0xf0190c6c)->second.export_addr); + case CELL_ADEC_TYPE_INVALID2: fmt::throw_exception("Invalid audio codec: CELL_ADEC_TYPE_INVALID2"); + case CELL_ADEC_TYPE_INVALID3: fmt::throw_exception("Invalid audio codec: CELL_ADEC_TYPE_INVALID3"); + case CELL_ADEC_TYPE_RESERVED22: fmt::throw_exception("Invalid audio codec: CELL_ADEC_TYPE_RESERVED22"); + case CELL_ADEC_TYPE_RESERVED23: fmt::throw_exception("Invalid audio codec: CELL_ADEC_TYPE_RESERVED23"); + case CELL_ADEC_TYPE_DTSHDCORE: return vm::cptr::make(*ppu_module_manager::cellDTSHDCOREdec.variables.find(0x6c8f4f1c)->second.export_addr); + case CELL_ADEC_TYPE_ATRAC3MULTI: return vm::cptr::make(*ppu_module_manager::cellAtrac3multidec.variables.find(0xc20c6bd7)->second.export_addr); + default: fmt::throw_exception("Invalid audio codec: %d", type); } } @@ -1530,14 +1610,14 @@ error_code adecOpen(ppu_thread& ppu, vm::ptr type, vm::cptrcallback = *cb; _this->core_handle = core_handle; _this->core_ops = core_ops; - _this->previous_pts = { CODEC_TS_INVALID, CODEC_TS_INVALID }; + _this->previous_pts = {CODEC_TS_INVALID, CODEC_TS_INVALID}; _this->frames_num = pcm_handle_num; _this->reserved1 = 0; _this->frames_head = -1; _this->frames_tail = -1; _this->frames = frames; _this->bitstream_info_size = bitstream_info_size; - _this->mutex_attribute = { SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, { "_adem03"_u64 } }; + _this->mutex_attribute = {SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, {"_adem03"_u64}}; _this->pcm_queue.init(ppu, _this.ptr(&AdecContext::pcm_queue)); _this->pcm_item_queue.init(ppu, _this.ptr(&AdecContext::pcm_item_queue)); @@ -1590,8 +1670,8 @@ error_code cellAdecOpenExt(ppu_thread& ppu, vm::ptr type, vm::ptr< return CELL_ADEC_ERROR_ARG; } - const vm::var _res{{ res->totalMemSize, res->startAddr, res->ppuThreadPriority, 0, res->ppuThreadStackSize }}; - const vm::var spursRes{{ res->spurs_addr, res->priority, res->maxContention }}; + const vm::var _res{{res->totalMemSize, res->startAddr, res->ppuThreadPriority, 0, res->ppuThreadStackSize}}; + const vm::var spursRes{{res->spurs_addr, res->priority, res->maxContention}}; return adecOpen(ppu, type, _res, cb, handle, spursRes); } @@ -2031,181 +2111,181 @@ error_code cellAdecGetPcmItem(ppu_thread& ppu, vm::ptr handle, vm:: } DECLARE(ppu_module_manager::cellAdec)("cellAdec", []() -{ - REG_FUNC(cellAdec, cellAdecQueryAttr); - REG_FUNC(cellAdec, cellAdecOpen); - REG_FUNC(cellAdec, cellAdecOpenEx); - REG_FUNC(cellAdec, cellAdecOpenExt); // 0xdf982d2c - REG_FUNC(cellAdec, cellAdecClose); - REG_FUNC(cellAdec, cellAdecStartSeq); - REG_FUNC(cellAdec, cellAdecEndSeq); - REG_FUNC(cellAdec, cellAdecDecodeAu); - REG_FUNC(cellAdec, cellAdecGetPcm); - REG_FUNC(cellAdec, cellAdecGetPcmItem); - - REG_HIDDEN_FUNC(adecNotifyAuDone); - REG_HIDDEN_FUNC(adecNotifyPcmOut); - REG_HIDDEN_FUNC(adecNotifyError); - REG_HIDDEN_FUNC(adecNotifySeqDone); - - ppu_static_variable& lpcm_gvar = REG_VAR(cellAdec, g_cell_adec_core_ops_lpcm); - lpcm_gvar.flags = MFF_HIDDEN; - lpcm_gvar.init = [] { - g_cell_adec_core_ops_lpcm->getMemSize.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetMemSize_lpcm))); - g_cell_adec_core_ops_lpcm->open.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpOpen_lpcm))); - g_cell_adec_core_ops_lpcm->close.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpClose_lpcm))); - g_cell_adec_core_ops_lpcm->startSeq.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpStartSeq_lpcm))); - g_cell_adec_core_ops_lpcm->endSeq.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpEndSeq_lpcm))); - g_cell_adec_core_ops_lpcm->decodeAu.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpDecodeAu_lpcm))); - g_cell_adec_core_ops_lpcm->getVersion.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetVersion_lpcm))); - g_cell_adec_core_ops_lpcm->realign.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpRealign_lpcm))); - g_cell_adec_core_ops_lpcm->releasePcm.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpReleasePcm_lpcm))); - g_cell_adec_core_ops_lpcm->getPcmHandleNum.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetPcmHandleNum_lpcm))); - g_cell_adec_core_ops_lpcm->getBsiInfoSize.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetBsiInfoSize_lpcm))); - g_cell_adec_core_ops_lpcm->openExt.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpOpenExt_lpcm))); - }; + REG_FUNC(cellAdec, cellAdecQueryAttr); + REG_FUNC(cellAdec, cellAdecOpen); + REG_FUNC(cellAdec, cellAdecOpenEx); + REG_FUNC(cellAdec, cellAdecOpenExt); // 0xdf982d2c + REG_FUNC(cellAdec, cellAdecClose); + REG_FUNC(cellAdec, cellAdecStartSeq); + REG_FUNC(cellAdec, cellAdecEndSeq); + REG_FUNC(cellAdec, cellAdecDecodeAu); + REG_FUNC(cellAdec, cellAdecGetPcm); + REG_FUNC(cellAdec, cellAdecGetPcmItem); - REG_HIDDEN_FUNC(_CellAdecCoreOpGetMemSize_lpcm); - REG_HIDDEN_FUNC(_CellAdecCoreOpOpen_lpcm); - REG_HIDDEN_FUNC(_CellAdecCoreOpClose_lpcm); - REG_HIDDEN_FUNC(_CellAdecCoreOpStartSeq_lpcm); - REG_HIDDEN_FUNC(_CellAdecCoreOpEndSeq_lpcm); - REG_HIDDEN_FUNC(_CellAdecCoreOpDecodeAu_lpcm); - REG_HIDDEN_FUNC(_CellAdecCoreOpGetVersion_lpcm); - REG_HIDDEN_FUNC(_CellAdecCoreOpRealign_lpcm); - REG_HIDDEN_FUNC(_CellAdecCoreOpReleasePcm_lpcm); - REG_HIDDEN_FUNC(_CellAdecCoreOpGetPcmHandleNum_lpcm); - REG_HIDDEN_FUNC(_CellAdecCoreOpGetBsiInfoSize_lpcm); - REG_HIDDEN_FUNC(_CellAdecCoreOpOpenExt_lpcm); + REG_HIDDEN_FUNC(adecNotifyAuDone); + REG_HIDDEN_FUNC(adecNotifyPcmOut); + REG_HIDDEN_FUNC(adecNotifyError); + REG_HIDDEN_FUNC(adecNotifySeqDone); - REG_HIDDEN_FUNC(lpcmDecEntry); -}); + ppu_static_variable& lpcm_gvar = REG_VAR(cellAdec, g_cell_adec_core_ops_lpcm); + lpcm_gvar.flags = MFF_HIDDEN; + lpcm_gvar.init = [] + { + g_cell_adec_core_ops_lpcm->getMemSize.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetMemSize_lpcm))); + g_cell_adec_core_ops_lpcm->open.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpOpen_lpcm))); + g_cell_adec_core_ops_lpcm->close.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpClose_lpcm))); + g_cell_adec_core_ops_lpcm->startSeq.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpStartSeq_lpcm))); + g_cell_adec_core_ops_lpcm->endSeq.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpEndSeq_lpcm))); + g_cell_adec_core_ops_lpcm->decodeAu.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpDecodeAu_lpcm))); + g_cell_adec_core_ops_lpcm->getVersion.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetVersion_lpcm))); + g_cell_adec_core_ops_lpcm->realign.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpRealign_lpcm))); + g_cell_adec_core_ops_lpcm->releasePcm.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpReleasePcm_lpcm))); + g_cell_adec_core_ops_lpcm->getPcmHandleNum.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetPcmHandleNum_lpcm))); + g_cell_adec_core_ops_lpcm->getBsiInfoSize.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetBsiInfoSize_lpcm))); + g_cell_adec_core_ops_lpcm->openExt.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpOpenExt_lpcm))); + }; + + REG_HIDDEN_FUNC(_CellAdecCoreOpGetMemSize_lpcm); + REG_HIDDEN_FUNC(_CellAdecCoreOpOpen_lpcm); + REG_HIDDEN_FUNC(_CellAdecCoreOpClose_lpcm); + REG_HIDDEN_FUNC(_CellAdecCoreOpStartSeq_lpcm); + REG_HIDDEN_FUNC(_CellAdecCoreOpEndSeq_lpcm); + REG_HIDDEN_FUNC(_CellAdecCoreOpDecodeAu_lpcm); + REG_HIDDEN_FUNC(_CellAdecCoreOpGetVersion_lpcm); + REG_HIDDEN_FUNC(_CellAdecCoreOpRealign_lpcm); + REG_HIDDEN_FUNC(_CellAdecCoreOpReleasePcm_lpcm); + REG_HIDDEN_FUNC(_CellAdecCoreOpGetPcmHandleNum_lpcm); + REG_HIDDEN_FUNC(_CellAdecCoreOpGetBsiInfoSize_lpcm); + REG_HIDDEN_FUNC(_CellAdecCoreOpOpenExt_lpcm); + + REG_HIDDEN_FUNC(lpcmDecEntry); + }); DECLARE(ppu_module_manager::cell_libac3dec)("cell_libac3dec", [] -{ - REG_VNID(cell_libac3dec, 0xc58bb170, g_cell_adec_core_ops_ac3); -}); + { + REG_VNID(cell_libac3dec, 0xc58bb170, g_cell_adec_core_ops_ac3); + }); DECLARE(ppu_module_manager::cellAtrac3dec)("cellAtrac3dec", [] -{ - REG_VNID(cellAtrac3dec, 0x60487d65, g_cell_adec_core_ops_atrac3); -}); + { + REG_VNID(cellAtrac3dec, 0x60487d65, g_cell_adec_core_ops_atrac3); + }); DECLARE(ppu_module_manager::cellAtrac3multidec)("cellAtrac3multidec", [] -{ - REG_VNID(cellAtrac3multidec, 0xc20c6bd7, g_cell_adec_core_ops_atrac3multi); -}); + { + REG_VNID(cellAtrac3multidec, 0xc20c6bd7, g_cell_adec_core_ops_atrac3multi); + }); DECLARE(ppu_module_manager::cellCelp8Dec)("cellCelp8Dec", [] -{ - REG_VNID(cellCelp8Dec, 0xf0190c6c, g_cell_adec_core_ops_Celp8); - REG_FUNC(cellCelp8Dec, _SceAdecCorrectPtsValue_Celp8); -}); + { + REG_VNID(cellCelp8Dec, 0xf0190c6c, g_cell_adec_core_ops_Celp8); + REG_FUNC(cellCelp8Dec, _SceAdecCorrectPtsValue_Celp8); + }); DECLARE(ppu_module_manager::cellCelpDec)("cellCelpDec", [] -{ - REG_VNID(cellCelpDec, 0xffe42c22, g_cell_adec_core_ops_Celp); - REG_FUNC(cellCelpDec, _SceAdecCorrectPtsValue_Celp); -}); + { + REG_VNID(cellCelpDec, 0xffe42c22, g_cell_adec_core_ops_Celp); + REG_FUNC(cellCelpDec, _SceAdecCorrectPtsValue_Celp); + }); DECLARE(ppu_module_manager::cellDDPdec)("cellDDPdec", [] -{ - REG_VNID(cellDDPdec, 0xf5e9c15c, g_cell_adec_core_ops_Ddp); - REG_FUNC(cellDDPdec, _SceAdecCorrectPtsValue_Ddp); -}); + { + REG_VNID(cellDDPdec, 0xf5e9c15c, g_cell_adec_core_ops_Ddp); + REG_FUNC(cellDDPdec, _SceAdecCorrectPtsValue_Ddp); + }); DECLARE(ppu_module_manager::cellDTSdec)("cellDTSdec", [] -{ - REG_VNID(cellDTSdec, 0x15248ec5, g_cell_adec_core_ops_DtsCore); - REG_FUNC(cellDTSdec, _SceAdecCorrectPtsValue_DtsCore); -}); + { + REG_VNID(cellDTSdec, 0x15248ec5, g_cell_adec_core_ops_DtsCore); + REG_FUNC(cellDTSdec, _SceAdecCorrectPtsValue_DtsCore); + }); DECLARE(ppu_module_manager::cellDTSHDCOREdec)("cellDTSHDCOREdec", [] -{ - REG_VNID(cellDTSHDCOREdec, 0x6c8f4f1c, g_cell_adec_core_ops_DtsHd_Core); - REG_FUNC(cellDTSHDCOREdec, _SceAdecCorrectPtsValue_DtsHd_Core); -}); + { + REG_VNID(cellDTSHDCOREdec, 0x6c8f4f1c, g_cell_adec_core_ops_DtsHd_Core); + REG_FUNC(cellDTSHDCOREdec, _SceAdecCorrectPtsValue_DtsHd_Core); + }); DECLARE(ppu_module_manager::cellDTSHDdec)("cellDTSHDdec", [] -{ - REG_VNID(cellDTSHDdec, 0x51ac2b6c, g_cell_adec_core_ops_DtsHd); - REG_FUNC(cellDTSHDdec, _SceAdecCorrectPtsValue_DtsHd); -}); + { + REG_VNID(cellDTSHDdec, 0x51ac2b6c, g_cell_adec_core_ops_DtsHd); + REG_FUNC(cellDTSHDdec, _SceAdecCorrectPtsValue_DtsHd); + }); DECLARE(ppu_module_manager::cellDTSLBRdec)("cellDTSLBRdec", [] -{ - REG_VNID(cellDTSLBRdec, 0x8c50af52, g_cell_adec_core_ops_DtsLbr); - REG_FUNC(cellDTSLBRdec, _SceAdecCorrectPtsValue_DtsLbr); -}); + { + REG_VNID(cellDTSLBRdec, 0x8c50af52, g_cell_adec_core_ops_DtsLbr); + REG_FUNC(cellDTSLBRdec, _SceAdecCorrectPtsValue_DtsLbr); + }); DECLARE(ppu_module_manager::cellM2AACdec)("cellM2AACdec", [] -{ - REG_VNID(cellM2AACdec, 0xac2f0831, g_cell_adec_core_ops_Aac); - REG_FUNC(cellM2AACdec, _SceAdecCorrectPtsValue_Aac); -}); + { + REG_VNID(cellM2AACdec, 0xac2f0831, g_cell_adec_core_ops_Aac); + REG_FUNC(cellM2AACdec, _SceAdecCorrectPtsValue_Aac); + }); DECLARE(ppu_module_manager::cellM2BCdec)("cellM2BCdec", [] -{ - REG_VNID(cellM2BCdec, 0x300afe4d, g_cell_adec_core_ops_mpmc); - REG_FUNC(cellM2BCdec, _SceAdecCorrectPtsValue_mpmc); -}); + { + REG_VNID(cellM2BCdec, 0x300afe4d, g_cell_adec_core_ops_mpmc); + REG_FUNC(cellM2BCdec, _SceAdecCorrectPtsValue_mpmc); + }); DECLARE(ppu_module_manager::cellM4AacDec)("cellM4AacDec", [] -{ - REG_VNID(cellM4AacDec, 0xab61278d, g_cell_adec_core_ops_M4Aac); - REG_FUNC(cellM4AacDec, _SceAdecCorrectPtsValue_M4Aac); -}); + { + REG_VNID(cellM4AacDec, 0xab61278d, g_cell_adec_core_ops_M4Aac); + REG_FUNC(cellM4AacDec, _SceAdecCorrectPtsValue_M4Aac); + }); DECLARE(ppu_module_manager::cellM4AacDec2ch)("cellM4AacDec2ch", [] -{ - REG_VNID(cellM4AacDec2ch, 0xe996c664, g_cell_adec_core_ops_M4Aac2ch); - REG_FUNC(cellM4AacDec2ch, _SceAdecCorrectPtsValue_M4Aac2ch); -}); + { + REG_VNID(cellM4AacDec2ch, 0xe996c664, g_cell_adec_core_ops_M4Aac2ch); + REG_FUNC(cellM4AacDec2ch, _SceAdecCorrectPtsValue_M4Aac2ch); + }); DECLARE(ppu_module_manager::cellM4AacDec2chmod)("cellM4AacDec2chmod", [] -{ - REG_VNID(cellM4AacDec2chmod, 0xdbd26836, g_cell_adec_core_ops_M4Aac2chmod); - REG_FUNC(cellM4AacDec2chmod, _SceAdecCorrectPtsValue_M4Aac2chmod); -}); + { + REG_VNID(cellM4AacDec2chmod, 0xdbd26836, g_cell_adec_core_ops_M4Aac2chmod); + REG_FUNC(cellM4AacDec2chmod, _SceAdecCorrectPtsValue_M4Aac2chmod); + }); DECLARE(ppu_module_manager::cellMP3dec)("cellMP3dec", [] -{ - REG_VNID(cellMP3dec, 0x84276a23, g_cell_adec_core_ops_Mp3); -}); + { + REG_VNID(cellMP3dec, 0x84276a23, g_cell_adec_core_ops_Mp3); + }); DECLARE(ppu_module_manager::cellMP3Sdec)("cellMP3Sdec", [] -{ - REG_VNID(cellMP3Sdec, 0x292cdf0a, g_cell_adec_core_ops_Mp3s); - REG_FUNC(cellMP3Sdec, _SceAdecCorrectPtsValue_Mp3s); -}); + { + REG_VNID(cellMP3Sdec, 0x292cdf0a, g_cell_adec_core_ops_Mp3s); + REG_FUNC(cellMP3Sdec, _SceAdecCorrectPtsValue_Mp3s); + }); DECLARE(ppu_module_manager::cellMPL1dec)("cellMPL1dec", [] -{ - REG_VNID(cellMPL1dec, 0xbbc70551, g_cell_adec_core_ops_mpmcl1); - REG_FUNC(cellMPL1dec, _SceAdecCorrectPtsValue_mpmcl1); -}); + { + REG_VNID(cellMPL1dec, 0xbbc70551, g_cell_adec_core_ops_mpmcl1); + REG_FUNC(cellMPL1dec, _SceAdecCorrectPtsValue_mpmcl1); + }); DECLARE(ppu_module_manager::cellTRHDdec)("cellTRHDdec", [] -{ - REG_VNID(cellTRHDdec, 0xe88e381b, g_cell_adec_core_ops_truehd); - REG_FUNC(cellTRHDdec, _SceAdecCorrectPtsValue_truehd); -}); + { + REG_VNID(cellTRHDdec, 0xe88e381b, g_cell_adec_core_ops_truehd); + REG_FUNC(cellTRHDdec, _SceAdecCorrectPtsValue_truehd); + }); DECLARE(ppu_module_manager::cellWMAdec)("cellWMAdec", [] -{ - REG_VNID(cellWMAdec, 0x88320b10, g_cell_adec_core_ops_wma); - REG_FUNC(cellWMAdec, _SceAdecCorrectPtsValue_wma); -}); + { + REG_VNID(cellWMAdec, 0x88320b10, g_cell_adec_core_ops_wma); + REG_FUNC(cellWMAdec, _SceAdecCorrectPtsValue_wma); + }); DECLARE(ppu_module_manager::cellWMALSLdec)("cellWMALSLdec", [] -{ - REG_VNID(cellWMALSLdec, 0x602aab16, g_cell_adec_core_ops_WmaLsl); - REG_FUNC(cellWMALSLdec, _SceAdecCorrectPtsValue_WmaLsl); -}); + { + REG_VNID(cellWMALSLdec, 0x602aab16, g_cell_adec_core_ops_WmaLsl); + REG_FUNC(cellWMALSLdec, _SceAdecCorrectPtsValue_WmaLsl); + }); DECLARE(ppu_module_manager::cellWMAPROdec)("cellWMAPROdec", [] -{ - REG_VNID(cellWMAPROdec, 0xa8bac670, g_cell_adec_core_ops_WmaPro); - REG_FUNC(cellWMAPROdec, _SceAdecCorrectPtsValue_WmaPro); -}); + { + REG_VNID(cellWMAPROdec, 0xa8bac670, g_cell_adec_core_ops_WmaPro); + REG_FUNC(cellWMAPROdec, _SceAdecCorrectPtsValue_WmaPro); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAdec.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellAdec.h index a43c3f0ae..4015d721a 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAdec.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAdec.h @@ -7,184 +7,179 @@ // Error Codes enum CellAdecError : u32 { - CELL_ADEC_ERROR_FATAL = 0x80610001, - CELL_ADEC_ERROR_SEQ = 0x80610002, - CELL_ADEC_ERROR_ARG = 0x80610003, - CELL_ADEC_ERROR_BUSY = 0x80610004, - CELL_ADEC_ERROR_EMPTY = 0x80610005, + CELL_ADEC_ERROR_FATAL = 0x80610001, + CELL_ADEC_ERROR_SEQ = 0x80610002, + CELL_ADEC_ERROR_ARG = 0x80610003, + CELL_ADEC_ERROR_BUSY = 0x80610004, + CELL_ADEC_ERROR_EMPTY = 0x80610005, - CELL_ADEC_ERROR_CELP_BUSY = 0x80612e01, - CELL_ADEC_ERROR_CELP_EMPTY = 0x80612e02, - CELL_ADEC_ERROR_CELP_ARG = 0x80612e03, - CELL_ADEC_ERROR_CELP_SEQ = 0x80612e04, - CELL_ADEC_ERROR_CELP_CORE_FATAL = 0x80612e81, - CELL_ADEC_ERROR_CELP_CORE_ARG = 0x80612e82, - CELL_ADEC_ERROR_CELP_CORE_SEQ = 0x80612e83, + CELL_ADEC_ERROR_CELP_BUSY = 0x80612e01, + CELL_ADEC_ERROR_CELP_EMPTY = 0x80612e02, + CELL_ADEC_ERROR_CELP_ARG = 0x80612e03, + CELL_ADEC_ERROR_CELP_SEQ = 0x80612e04, + CELL_ADEC_ERROR_CELP_CORE_FATAL = 0x80612e81, + CELL_ADEC_ERROR_CELP_CORE_ARG = 0x80612e82, + CELL_ADEC_ERROR_CELP_CORE_SEQ = 0x80612e83, - CELL_ADEC_ERROR_CELP8_BUSY = 0x80612ea1, - CELL_ADEC_ERROR_CELP8_EMPTY = 0x80612ea2, - CELL_ADEC_ERROR_CELP8_ARG = 0x80612ea3, - CELL_ADEC_ERROR_CELP8_SEQ = 0x80612ea4, - CELL_ADEC_ERROR_CELP8_CORE_FATAL = 0x80612eb1, - CELL_ADEC_ERROR_CELP8_CORE_ARG = 0x80612eb2, - CELL_ADEC_ERROR_CELP8_CORE_SEQ = 0x80612eb3, + CELL_ADEC_ERROR_CELP8_BUSY = 0x80612ea1, + CELL_ADEC_ERROR_CELP8_EMPTY = 0x80612ea2, + CELL_ADEC_ERROR_CELP8_ARG = 0x80612ea3, + CELL_ADEC_ERROR_CELP8_SEQ = 0x80612ea4, + CELL_ADEC_ERROR_CELP8_CORE_FATAL = 0x80612eb1, + CELL_ADEC_ERROR_CELP8_CORE_ARG = 0x80612eb2, + CELL_ADEC_ERROR_CELP8_CORE_SEQ = 0x80612eb3, - CELL_ADEC_ERROR_M4AAC_FATAL = 0x80612401, - CELL_ADEC_ERROR_M4AAC_SEQ = 0x80612402, - CELL_ADEC_ERROR_M4AAC_ARG = 0x80612403, - CELL_ADEC_ERROR_M4AAC_BUSY = 0x80612404, - CELL_ADEC_ERROR_M4AAC_EMPTY = 0x80612405, - CELL_ADEC_ERROR_M4AAC_BUFFER_OVERFLOW = 0x80612406, - CELL_ADEC_ERROR_M4AAC_END_OF_BITSTREAM = 0x80612407, + CELL_ADEC_ERROR_M4AAC_FATAL = 0x80612401, + CELL_ADEC_ERROR_M4AAC_SEQ = 0x80612402, + CELL_ADEC_ERROR_M4AAC_ARG = 0x80612403, + CELL_ADEC_ERROR_M4AAC_BUSY = 0x80612404, + CELL_ADEC_ERROR_M4AAC_EMPTY = 0x80612405, + CELL_ADEC_ERROR_M4AAC_BUFFER_OVERFLOW = 0x80612406, + CELL_ADEC_ERROR_M4AAC_END_OF_BITSTREAM = 0x80612407, /* Core */ - CELL_ADEC_ERROR_M4AAC_CH_CONFIG_INCONSISTENCY = 0x80612410, - CELL_ADEC_ERROR_M4AAC_NO_CH_DEFAULT_POS = 0x80612411, - CELL_ADEC_ERROR_M4AAC_INVALID_CH_POS = 0x80612412, - CELL_ADEC_ERROR_M4AAC_UNANTICIPATED_COUPLING_CH = 0x80612413, - CELL_ADEC_ERROR_M4AAC_INVALID_LAYER_ID = 0x80612414, - CELL_ADEC_ERROR_M4AAC_ADTS_SYNCWORD_ERROR = 0x80612415, - CELL_ADEC_ERROR_M4AAC_INVALID_ADTS_ID = 0x80612416, - CELL_ADEC_ERROR_M4AAC_CH_CHANGED = 0x80612417, - CELL_ADEC_ERROR_M4AAC_SAMPLING_FREQ_CHANGED = 0x80612418, - CELL_ADEC_ERROR_M4AAC_WRONG_SBR_CH = 0x80612419, - CELL_ADEC_ERROR_M4AAC_WRONG_SCALE_FACTOR = 0x8061241a, - CELL_ADEC_ERROR_M4AAC_INVALID_BOOKS = 0x8061241b, - CELL_ADEC_ERROR_M4AAC_INVALID_SECTION_DATA = 0x8061241c, - CELL_ADEC_ERROR_M4AAC_PULSE_IS_NOT_LONG = 0x8061241d, - CELL_ADEC_ERROR_M4AAC_GC_IS_NOT_SUPPORTED = 0x8061241e, - CELL_ADEC_ERROR_M4AAC_INVALID_ELEMENT_ID = 0x8061241f, - CELL_ADEC_ERROR_M4AAC_NO_CH_CONFIG = 0x80612420, - CELL_ADEC_ERROR_M4AAC_UNEXPECTED_OVERLAP_CRC = 0x80612421, - CELL_ADEC_ERROR_M4AAC_CRC_BUFFER_EXCEEDED = 0x80612422, - CELL_ADEC_ERROR_M4AAC_INVALID_CRC = 0x80612423, - CELL_ADEC_ERROR_M4AAC_BAD_WINDOW_CODE = 0x80612424, - CELL_ADEC_ERROR_M4AAC_INVALID_ADIF_HEADER_ID = 0x80612425, - CELL_ADEC_ERROR_M4AAC_NOT_SUPPORTED_PROFILE = 0x80612426, - CELL_ADEC_ERROR_M4AAC_PROG_NUMBER_NOT_FOUND = 0x80612427, - CELL_ADEC_ERROR_M4AAC_INVALID_SAMP_RATE_INDEX = 0x80612428, - CELL_ADEC_ERROR_M4AAC_UNANTICIPATED_CH_CONFIG = 0x80612429, - CELL_ADEC_ERROR_M4AAC_PULSE_OVERFLOWED = 0x8061242a, - CELL_ADEC_ERROR_M4AAC_CAN_NOT_UNPACK_INDEX = 0x8061242b, - CELL_ADEC_ERROR_M4AAC_DEINTERLEAVE_FAILED = 0x8061242c, - CELL_ADEC_ERROR_M4AAC_CALC_BAND_OFFSET_FAILED = 0x8061242d, - CELL_ADEC_ERROR_M4AAC_GET_SCALE_FACTOR_FAILED = 0x8061242e, - CELL_ADEC_ERROR_M4AAC_GET_CC_GAIN_FAILED = 0x8061242f, - CELL_ADEC_ERROR_M4AAC_MIX_COUPLING_CH_FAILED = 0x80612430, - CELL_ADEC_ERROR_M4AAC_GROUP_IS_INVALID = 0x80612431, - CELL_ADEC_ERROR_M4AAC_PREDICT_FAILED = 0x80612432, - CELL_ADEC_ERROR_M4AAC_INVALID_PREDICT_RESET_PATTERN = 0x80612433, - CELL_ADEC_ERROR_M4AAC_INVALID_TNS_FRAME_INFO = 0x80612434, - CELL_ADEC_ERROR_M4AAC_GET_MASK_FAILED = 0x80612435, - CELL_ADEC_ERROR_M4AAC_GET_GROUP_FAILED = 0x80612436, - CELL_ADEC_ERROR_M4AAC_GET_LPFLAG_FAILED = 0x80612437, - CELL_ADEC_ERROR_M4AAC_INVERSE_QUANTIZATION_FAILED = 0x80612438, - CELL_ADEC_ERROR_M4AAC_GET_CB_MAP_FAILED = 0x80612439, - CELL_ADEC_ERROR_M4AAC_GET_PULSE_FAILED = 0x8061243a, - CELL_ADEC_ERROR_M4AAC_MONO_MIXDOWN_ELEMENT_IS_NOT_SUPPORTED = 0x8061243b, + CELL_ADEC_ERROR_M4AAC_CH_CONFIG_INCONSISTENCY = 0x80612410, + CELL_ADEC_ERROR_M4AAC_NO_CH_DEFAULT_POS = 0x80612411, + CELL_ADEC_ERROR_M4AAC_INVALID_CH_POS = 0x80612412, + CELL_ADEC_ERROR_M4AAC_UNANTICIPATED_COUPLING_CH = 0x80612413, + CELL_ADEC_ERROR_M4AAC_INVALID_LAYER_ID = 0x80612414, + CELL_ADEC_ERROR_M4AAC_ADTS_SYNCWORD_ERROR = 0x80612415, + CELL_ADEC_ERROR_M4AAC_INVALID_ADTS_ID = 0x80612416, + CELL_ADEC_ERROR_M4AAC_CH_CHANGED = 0x80612417, + CELL_ADEC_ERROR_M4AAC_SAMPLING_FREQ_CHANGED = 0x80612418, + CELL_ADEC_ERROR_M4AAC_WRONG_SBR_CH = 0x80612419, + CELL_ADEC_ERROR_M4AAC_WRONG_SCALE_FACTOR = 0x8061241a, + CELL_ADEC_ERROR_M4AAC_INVALID_BOOKS = 0x8061241b, + CELL_ADEC_ERROR_M4AAC_INVALID_SECTION_DATA = 0x8061241c, + CELL_ADEC_ERROR_M4AAC_PULSE_IS_NOT_LONG = 0x8061241d, + CELL_ADEC_ERROR_M4AAC_GC_IS_NOT_SUPPORTED = 0x8061241e, + CELL_ADEC_ERROR_M4AAC_INVALID_ELEMENT_ID = 0x8061241f, + CELL_ADEC_ERROR_M4AAC_NO_CH_CONFIG = 0x80612420, + CELL_ADEC_ERROR_M4AAC_UNEXPECTED_OVERLAP_CRC = 0x80612421, + CELL_ADEC_ERROR_M4AAC_CRC_BUFFER_EXCEEDED = 0x80612422, + CELL_ADEC_ERROR_M4AAC_INVALID_CRC = 0x80612423, + CELL_ADEC_ERROR_M4AAC_BAD_WINDOW_CODE = 0x80612424, + CELL_ADEC_ERROR_M4AAC_INVALID_ADIF_HEADER_ID = 0x80612425, + CELL_ADEC_ERROR_M4AAC_NOT_SUPPORTED_PROFILE = 0x80612426, + CELL_ADEC_ERROR_M4AAC_PROG_NUMBER_NOT_FOUND = 0x80612427, + CELL_ADEC_ERROR_M4AAC_INVALID_SAMP_RATE_INDEX = 0x80612428, + CELL_ADEC_ERROR_M4AAC_UNANTICIPATED_CH_CONFIG = 0x80612429, + CELL_ADEC_ERROR_M4AAC_PULSE_OVERFLOWED = 0x8061242a, + CELL_ADEC_ERROR_M4AAC_CAN_NOT_UNPACK_INDEX = 0x8061242b, + CELL_ADEC_ERROR_M4AAC_DEINTERLEAVE_FAILED = 0x8061242c, + CELL_ADEC_ERROR_M4AAC_CALC_BAND_OFFSET_FAILED = 0x8061242d, + CELL_ADEC_ERROR_M4AAC_GET_SCALE_FACTOR_FAILED = 0x8061242e, + CELL_ADEC_ERROR_M4AAC_GET_CC_GAIN_FAILED = 0x8061242f, + CELL_ADEC_ERROR_M4AAC_MIX_COUPLING_CH_FAILED = 0x80612430, + CELL_ADEC_ERROR_M4AAC_GROUP_IS_INVALID = 0x80612431, + CELL_ADEC_ERROR_M4AAC_PREDICT_FAILED = 0x80612432, + CELL_ADEC_ERROR_M4AAC_INVALID_PREDICT_RESET_PATTERN = 0x80612433, + CELL_ADEC_ERROR_M4AAC_INVALID_TNS_FRAME_INFO = 0x80612434, + CELL_ADEC_ERROR_M4AAC_GET_MASK_FAILED = 0x80612435, + CELL_ADEC_ERROR_M4AAC_GET_GROUP_FAILED = 0x80612436, + CELL_ADEC_ERROR_M4AAC_GET_LPFLAG_FAILED = 0x80612437, + CELL_ADEC_ERROR_M4AAC_INVERSE_QUANTIZATION_FAILED = 0x80612438, + CELL_ADEC_ERROR_M4AAC_GET_CB_MAP_FAILED = 0x80612439, + CELL_ADEC_ERROR_M4AAC_GET_PULSE_FAILED = 0x8061243a, + CELL_ADEC_ERROR_M4AAC_MONO_MIXDOWN_ELEMENT_IS_NOT_SUPPORTED = 0x8061243b, CELL_ADEC_ERROR_M4AAC_STEREO_MIXDOWN_ELEMENT_IS_NOT_SUPPORTED = 0x8061243c, - CELL_ADEC_ERROR_M4AAC_SBR_CH_OVERFLOW = 0x80612480, - CELL_ADEC_ERROR_M4AAC_SBR_NOSYNCH = 0x80612481, - CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_PROGRAM = 0x80612482, - CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_TAG = 0x80612483, - CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_CHN_CONFIG = 0x80612484, - CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_SECTION = 0x80612485, - CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_SCFACTORS = 0x80612486, - CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_PULSE_DATA = 0x80612487, - CELL_ADEC_ERROR_M4AAC_SBR_MAIN_PROFILE_NOT_IMPLEMENTED = 0x80612488, - CELL_ADEC_ERROR_M4AAC_SBR_GC_NOT_IMPLEMENTED = 0x80612489, - CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_PLUS_ELE_ID = 0x8061248a, - CELL_ADEC_ERROR_M4AAC_SBR_CREATE_ERROR = 0x8061248b, - CELL_ADEC_ERROR_M4AAC_SBR_NOT_INITIALIZED = 0x8061248c, - CELL_ADEC_ERROR_M4AAC_SBR_INVALID_ENVELOPE = 0x8061248d, - + CELL_ADEC_ERROR_M4AAC_SBR_CH_OVERFLOW = 0x80612480, + CELL_ADEC_ERROR_M4AAC_SBR_NOSYNCH = 0x80612481, + CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_PROGRAM = 0x80612482, + CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_TAG = 0x80612483, + CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_CHN_CONFIG = 0x80612484, + CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_SECTION = 0x80612485, + CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_SCFACTORS = 0x80612486, + CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_PULSE_DATA = 0x80612487, + CELL_ADEC_ERROR_M4AAC_SBR_MAIN_PROFILE_NOT_IMPLEMENTED = 0x80612488, + CELL_ADEC_ERROR_M4AAC_SBR_GC_NOT_IMPLEMENTED = 0x80612489, + CELL_ADEC_ERROR_M4AAC_SBR_ILLEGAL_PLUS_ELE_ID = 0x8061248a, + CELL_ADEC_ERROR_M4AAC_SBR_CREATE_ERROR = 0x8061248b, + CELL_ADEC_ERROR_M4AAC_SBR_NOT_INITIALIZED = 0x8061248c, + CELL_ADEC_ERROR_M4AAC_SBR_INVALID_ENVELOPE = 0x8061248d, CELL_ADEC_ERROR_AC3_BUSY = 0x80612500, CELL_ADEC_ERROR_AC3_EMPTY = 0x80612501, CELL_ADEC_ERROR_AC3_PARAM = 0x80612502, CELL_ADEC_ERROR_AC3_FRAME = 0x80612503, - CELL_ADEC_ERROR_AT3_OFFSET = 0x80612100, - CELL_ADEC_ERROR_AT3_OK = 0x80612100, - CELL_ADEC_ERROR_AT3_BUSY = 0x80612164, - CELL_ADEC_ERROR_AT3_EMPTY = 0x80612165, - CELL_ADEC_ERROR_AT3_ERROR = 0x80612180, - + CELL_ADEC_ERROR_AT3_OK = 0x80612100, + CELL_ADEC_ERROR_AT3_BUSY = 0x80612164, + CELL_ADEC_ERROR_AT3_EMPTY = 0x80612165, + CELL_ADEC_ERROR_AT3_ERROR = 0x80612180, CELL_ADEC_ERROR_LPCM_FATAL = 0x80612001, - CELL_ADEC_ERROR_LPCM_SEQ = 0x80612002, - CELL_ADEC_ERROR_LPCM_ARG = 0x80612003, - CELL_ADEC_ERROR_LPCM_BUSY = 0x80612004, + CELL_ADEC_ERROR_LPCM_SEQ = 0x80612002, + CELL_ADEC_ERROR_LPCM_ARG = 0x80612003, + CELL_ADEC_ERROR_LPCM_BUSY = 0x80612004, CELL_ADEC_ERROR_LPCM_EMPTY = 0x80612005, - CELL_ADEC_ERROR_MP3_OFFSET = 0x80612700U, - CELL_ADEC_ERROR_MP3_OK = 0x80612700, - CELL_ADEC_ERROR_MP3_BUSY = 0x80612764, - CELL_ADEC_ERROR_MP3_EMPTY = 0x80612765, - CELL_ADEC_ERROR_MP3_ERROR = 0x80612781, - CELL_ADEC_ERROR_MP3_LOST_SYNC = 0x80612782, - CELL_ADEC_ERROR_MP3_NOT_L3 = 0x80612783, - CELL_ADEC_ERROR_MP3_BAD_BITRATE = 0x80612784, - CELL_ADEC_ERROR_MP3_BAD_SFREQ = 0x80612785, - CELL_ADEC_ERROR_MP3_BAD_EMPHASIS = 0x80612786, - CELL_ADEC_ERROR_MP3_BAD_BLKTYPE = 0x80612787, - CELL_ADEC_ERROR_MP3_BAD_VERSION = 0x8061278c, - CELL_ADEC_ERROR_MP3_BAD_MODE = 0x8061278d, - CELL_ADEC_ERROR_MP3_BAD_MODE_EXT = 0x8061278e, - CELL_ADEC_ERROR_MP3_HUFFMAN_NUM = 0x80612796, - CELL_ADEC_ERROR_MP3_HUFFMAN_CASE_ID = 0x80612797, - CELL_ADEC_ERROR_MP3_SCALEFAC_COMPRESS = 0x80612798, - CELL_ADEC_ERROR_MP3_HGETBIT = 0x80612799, - CELL_ADEC_ERROR_MP3_FLOATING_EXCEPTION = 0x8061279a, - CELL_ADEC_ERROR_MP3_ARRAY_OVERFLOW = 0x8061279b, - CELL_ADEC_ERROR_MP3_STEREO_PROCESSING = 0x8061279c, - CELL_ADEC_ERROR_MP3_JS_BOUND = 0x8061279d, - CELL_ADEC_ERROR_MP3_PCMOUT = 0x8061279e, + CELL_ADEC_ERROR_MP3_OK = 0x80612700, + CELL_ADEC_ERROR_MP3_BUSY = 0x80612764, + CELL_ADEC_ERROR_MP3_EMPTY = 0x80612765, + CELL_ADEC_ERROR_MP3_ERROR = 0x80612781, + CELL_ADEC_ERROR_MP3_LOST_SYNC = 0x80612782, + CELL_ADEC_ERROR_MP3_NOT_L3 = 0x80612783, + CELL_ADEC_ERROR_MP3_BAD_BITRATE = 0x80612784, + CELL_ADEC_ERROR_MP3_BAD_SFREQ = 0x80612785, + CELL_ADEC_ERROR_MP3_BAD_EMPHASIS = 0x80612786, + CELL_ADEC_ERROR_MP3_BAD_BLKTYPE = 0x80612787, + CELL_ADEC_ERROR_MP3_BAD_VERSION = 0x8061278c, + CELL_ADEC_ERROR_MP3_BAD_MODE = 0x8061278d, + CELL_ADEC_ERROR_MP3_BAD_MODE_EXT = 0x8061278e, + CELL_ADEC_ERROR_MP3_HUFFMAN_NUM = 0x80612796, + CELL_ADEC_ERROR_MP3_HUFFMAN_CASE_ID = 0x80612797, + CELL_ADEC_ERROR_MP3_SCALEFAC_COMPRESS = 0x80612798, + CELL_ADEC_ERROR_MP3_HGETBIT = 0x80612799, + CELL_ADEC_ERROR_MP3_FLOATING_EXCEPTION = 0x8061279a, + CELL_ADEC_ERROR_MP3_ARRAY_OVERFLOW = 0x8061279b, + CELL_ADEC_ERROR_MP3_STEREO_PROCESSING = 0x8061279c, + CELL_ADEC_ERROR_MP3_JS_BOUND = 0x8061279d, + CELL_ADEC_ERROR_MP3_PCMOUT = 0x8061279e, + CELL_ADEC_ERROR_M2BC_FATAL = 0x80612b01, + CELL_ADEC_ERROR_M2BC_SEQ = 0x80612b02, + CELL_ADEC_ERROR_M2BC_ARG = 0x80612b03, + CELL_ADEC_ERROR_M2BC_BUSY = 0x80612b04, + CELL_ADEC_ERROR_M2BC_EMPTY = 0x80612b05, - CELL_ADEC_ERROR_M2BC_FATAL = 0x80612b01, - CELL_ADEC_ERROR_M2BC_SEQ = 0x80612b02, - CELL_ADEC_ERROR_M2BC_ARG = 0x80612b03, - CELL_ADEC_ERROR_M2BC_BUSY = 0x80612b04, - CELL_ADEC_ERROR_M2BC_EMPTY = 0x80612b05, + CELL_ADEC_ERROR_M2BC_SYNCF = 0x80612b11, + CELL_ADEC_ERROR_M2BC_LAYER = 0x80612b12, + CELL_ADEC_ERROR_M2BC_BITRATE = 0x80612b13, + CELL_ADEC_ERROR_M2BC_SAMPLEFREQ = 0x80612b14, + CELL_ADEC_ERROR_M2BC_VERSION = 0x80612b15, + CELL_ADEC_ERROR_M2BC_MODE_EXT = 0x80612b16, + CELL_ADEC_ERROR_M2BC_UNSUPPORT = 0x80612b17, - CELL_ADEC_ERROR_M2BC_SYNCF = 0x80612b11, - CELL_ADEC_ERROR_M2BC_LAYER = 0x80612b12, - CELL_ADEC_ERROR_M2BC_BITRATE = 0x80612b13, - CELL_ADEC_ERROR_M2BC_SAMPLEFREQ = 0x80612b14, - CELL_ADEC_ERROR_M2BC_VERSION = 0x80612b15, - CELL_ADEC_ERROR_M2BC_MODE_EXT = 0x80612b16, - CELL_ADEC_ERROR_M2BC_UNSUPPORT = 0x80612b17, + CELL_ADEC_ERROR_M2BC_OPENBS_EX = 0x80612b21, + CELL_ADEC_ERROR_M2BC_SYNCF_EX = 0x80612b22, + CELL_ADEC_ERROR_M2BC_CRCGET_EX = 0x80612b23, + CELL_ADEC_ERROR_M2BC_CRC_EX = 0x80612b24, - CELL_ADEC_ERROR_M2BC_OPENBS_EX = 0x80612b21, - CELL_ADEC_ERROR_M2BC_SYNCF_EX = 0x80612b22, - CELL_ADEC_ERROR_M2BC_CRCGET_EX = 0x80612b23, - CELL_ADEC_ERROR_M2BC_CRC_EX = 0x80612b24, + CELL_ADEC_ERROR_M2BC_CRCGET = 0x80612b31, + CELL_ADEC_ERROR_M2BC_CRC = 0x80612b32, + CELL_ADEC_ERROR_M2BC_BITALLOC = 0x80612b33, + CELL_ADEC_ERROR_M2BC_SCALE = 0x80612b34, + CELL_ADEC_ERROR_M2BC_SAMPLE = 0x80612b35, + CELL_ADEC_ERROR_M2BC_OPENBS = 0x80612b36, - CELL_ADEC_ERROR_M2BC_CRCGET = 0x80612b31, - CELL_ADEC_ERROR_M2BC_CRC = 0x80612b32, - CELL_ADEC_ERROR_M2BC_BITALLOC = 0x80612b33, - CELL_ADEC_ERROR_M2BC_SCALE = 0x80612b34, - CELL_ADEC_ERROR_M2BC_SAMPLE = 0x80612b35, - CELL_ADEC_ERROR_M2BC_OPENBS = 0x80612b36, + CELL_ADEC_ERROR_M2BC_MC_CRCGET = 0x80612b41, + CELL_ADEC_ERROR_M2BC_MC_CRC = 0x80612b42, + CELL_ADEC_ERROR_M2BC_MC_BITALLOC = 0x80612b43, + CELL_ADEC_ERROR_M2BC_MC_SCALE = 0x80612b44, + CELL_ADEC_ERROR_M2BC_MC_SAMPLE = 0x80612b45, + CELL_ADEC_ERROR_M2BC_MC_HEADER = 0x80612b46, + CELL_ADEC_ERROR_M2BC_MC_STATUS = 0x80612b47, - CELL_ADEC_ERROR_M2BC_MC_CRCGET = 0x80612b41, - CELL_ADEC_ERROR_M2BC_MC_CRC = 0x80612b42, - CELL_ADEC_ERROR_M2BC_MC_BITALLOC = 0x80612b43, - CELL_ADEC_ERROR_M2BC_MC_SCALE = 0x80612b44, - CELL_ADEC_ERROR_M2BC_MC_SAMPLE = 0x80612b45, - CELL_ADEC_ERROR_M2BC_MC_HEADER = 0x80612b46, - CELL_ADEC_ERROR_M2BC_MC_STATUS = 0x80612b47, - - CELL_ADEC_ERROR_M2BC_AG_CCRCGET = 0x80612b51, - CELL_ADEC_ERROR_M2BC_AG_CRC = 0x80612b52, - CELL_ADEC_ERROR_M2BC_AG_BITALLOC = 0x80612b53, - CELL_ADEC_ERROR_M2BC_AG_SCALE = 0x80612b54, - CELL_ADEC_ERROR_M2BC_AG_SAMPLE = 0x80612b55, - CELL_ADEC_ERROR_M2BC_AG_STATUS = 0x80612b57, + CELL_ADEC_ERROR_M2BC_AG_CCRCGET = 0x80612b51, + CELL_ADEC_ERROR_M2BC_AG_CRC = 0x80612b52, + CELL_ADEC_ERROR_M2BC_AG_BITALLOC = 0x80612b53, + CELL_ADEC_ERROR_M2BC_AG_SCALE = 0x80612b54, + CELL_ADEC_ERROR_M2BC_AG_SAMPLE = 0x80612b55, + CELL_ADEC_ERROR_M2BC_AG_STATUS = 0x80612b57, }; // Audio Codec Type @@ -220,7 +215,7 @@ enum AudioCodecType : s32 CELL_ADEC_TYPE_INVALID3, CELL_ADEC_TYPE_RESERVED22, // Either WMA Pro or WMA Lossless, was never released CELL_ADEC_TYPE_RESERVED23, // Either WMA Pro or WMA Lossless, was never released - CELL_ADEC_TYPE_DTSHDCORE, // Removed in firmware 4.00, integrated into DTSHD + CELL_ADEC_TYPE_DTSHDCORE, // Removed in firmware 4.00, integrated into DTSHD CELL_ADEC_TYPE_ATRAC3MULTI, }; @@ -342,7 +337,7 @@ struct CellAdecPcmItem be_t status; vm::bcptr startAddr; be_t size; - CellAdecPcmAttr pcmAttr; + CellAdecPcmAttr pcmAttr; CellAdecAuInfo auInfo; }; @@ -455,9 +450,18 @@ struct AdecCmdQueue size++; } - void peek(T& cmd) const { return pop(cmd); } - bool empty() const { return size == 0; } - bool full() const { return size >= 4; } + void peek(T& cmd) const + { + return pop(cmd); + } + bool empty() const + { + return size == 0; + } + bool full() const + { + return size >= 4; + } }; struct AdecFrame @@ -490,11 +494,10 @@ class AdecOutputQueue struct entry { be_t this_index; // Unused - be_t state; // 0xff = empty, 0x10 = filled + be_t state; // 0xff = empty, 0x10 = filled vm::bptr pcm_item; be_t pcm_handle; - } - entries[4]; + } entries[4]; be_t front; be_t back; @@ -510,15 +513,15 @@ public: this->back = 0; this->size = 0; - const vm::var mutex_attr = {{ SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, { "_adem07"_u64 } }}; + const vm::var mutex_attr = {{SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, {"_adem07"_u64}}}; ensure(sys_mutex_create(ppu, _this.ptr(&AdecOutputQueue::mutex), mutex_attr) == CELL_OK); // Error code isn't checked on LLE - const vm::var cond_attr = {{ SYS_SYNC_NOT_PROCESS_SHARED, 0, 0, { "_adec05"_u64 } }}; + const vm::var cond_attr = {{SYS_SYNC_NOT_PROCESS_SHARED, 0, 0, {"_adec05"_u64}}}; ensure(sys_cond_create(ppu, _this.ptr(&AdecOutputQueue::cond), mutex, cond_attr) == CELL_OK); // Error code isn't checked on LLE for (s32 i = 0; i < 4; i++) { - entries[i] = { i, 0xff, vm::null, -1 }; + entries[i] = {i, 0xff, vm::null, -1}; } } @@ -544,7 +547,7 @@ public: if (entries[back].state != 0xff) { ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE - return true; // LLE returns the result of the comparison above + return true; // LLE returns the result of the comparison above } entries[back].state = 0x10; @@ -652,7 +655,6 @@ struct AdecContext // CellAdecHandle = AdecContext* static_assert(std::is_standard_layout_v && std::is_trivial_v); CHECK_SIZE_ALIGN(AdecContext, 0x530, 8); - enum : u32 { CELL_ADEC_LPCM_DVD_CH_RESERVED1, @@ -705,8 +707,8 @@ public: { value = initial_value; - const vm::var mutex_attr{{ SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, { "_adem01"_u64 } }}; - const vm::var cond_attr{{ SYS_SYNC_NOT_PROCESS_SHARED, 0, 0, { "_adec01"_u64 } }}; + const vm::var mutex_attr{{SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, {"_adem01"_u64}}}; + const vm::var cond_attr{{SYS_SYNC_NOT_PROCESS_SHARED, 0, 0, {"_adec01"_u64}}}; if (error_code ret = sys_mutex_create(ppu, _this.ptr(&LpcmDecSemaphore::mutex), mutex_attr); ret != CELL_OK) { @@ -765,7 +767,7 @@ public: if (value == 0u) { savestate = lpcm_dec_state::waiting_for_cmd_cond_wait; - cond_wait: + cond_wait: if (error_code ret = sys_cond_wait(ppu, cond, 0); ret != CELL_OK) { @@ -942,10 +944,10 @@ enum CELP8_ExcitationMode : s32 // CELP8 MPE Configuration enum CELP8_MPEConfig : s32 { - CELL_ADEC_CELP8_MPE_CONFIG_0 = 0, - CELL_ADEC_CELP8_MPE_CONFIG_2 = 2, - CELL_ADEC_CELP8_MPE_CONFIG_6 = 6, - CELL_ADEC_CELP8_MPE_CONFIG_9 = 9, + CELL_ADEC_CELP8_MPE_CONFIG_0 = 0, + CELL_ADEC_CELP8_MPE_CONFIG_2 = 2, + CELL_ADEC_CELP8_MPE_CONFIG_6 = 6, + CELL_ADEC_CELP8_MPE_CONFIG_9 = 9, CELL_ADEC_CELP8_MPE_CONFIG_12 = 12, CELL_ADEC_CELP8_MPE_CONFIG_15 = 15, CELL_ADEC_CELP8_MPE_CONFIG_18 = 18, @@ -1011,17 +1013,14 @@ struct CellAdecParamM4Aac struct { be_t programNumber; - } - adifConfig; + } adifConfig; struct { be_t samplingFreqIndex; // MPEG4AAC_SamplingFreq - be_t profile; // LC profile (1) - } - rawDataBlockConfig; - } - configInfo; + be_t profile; // LC profile (1) + } rawDataBlockConfig; + } configInfo; be_t enableDownmix; // enable downmix to 2.0 (if (enableDownmix)) }; @@ -1053,8 +1052,7 @@ struct alignas(16) CellAdecM4AacInfo be_t bitrate; be_t numberOfProgramConfigElements; be_t bufferFullness; - } - adif; + } adif; struct mp8 { @@ -1073,18 +1071,15 @@ struct alignas(16) CellAdecM4AacInfo be_t bufferFullness; be_t numberOfRawDataBlocks; be_t crcCheck; - } - adts; - } - bsi; + } adts; + } bsi; struct { be_t matrixMixdownPresent; be_t mixdownIndex; be_t pseudoSurroundEnable; - } - matrixMixdown; + } matrixMixdown; be_t reserved; }; @@ -1234,10 +1229,10 @@ enum ATRAC3_JointType : s32 struct CellAdecParamAtrac3 { - be_t nch; // channel count + be_t nch; // channel count be_t isJoint; // ATRAC3_JointType - be_t nbytes; // byte count of single AU (???) - be_t bw_pcm; // ATRAC3_WordSize, bit length of output PCM sample + be_t nbytes; // byte count of single AU (???) + be_t bw_pcm; // ATRAC3_WordSize, bit length of output PCM sample }; struct CellAdecAtrac3Info diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAtrac.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellAtrac.cpp index e094fa042..c797c981f 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAtrac.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAtrac.cpp @@ -9,34 +9,34 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellAtracError value) - { - switch (value) { - STR_CASE(CELL_ATRAC_ERROR_API_FAIL); - STR_CASE(CELL_ATRAC_ERROR_READSIZE_OVER_BUFFER); - STR_CASE(CELL_ATRAC_ERROR_UNKNOWN_FORMAT); - STR_CASE(CELL_ATRAC_ERROR_READSIZE_IS_TOO_SMALL); - STR_CASE(CELL_ATRAC_ERROR_ILLEGAL_SAMPLING_RATE); - STR_CASE(CELL_ATRAC_ERROR_ILLEGAL_DATA); - STR_CASE(CELL_ATRAC_ERROR_NO_DECODER); - STR_CASE(CELL_ATRAC_ERROR_UNSET_DATA); - STR_CASE(CELL_ATRAC_ERROR_DECODER_WAS_CREATED); - STR_CASE(CELL_ATRAC_ERROR_ALLDATA_WAS_DECODED); - STR_CASE(CELL_ATRAC_ERROR_NODATA_IN_BUFFER); - STR_CASE(CELL_ATRAC_ERROR_NOT_ALIGNED_OUT_BUFFER); - STR_CASE(CELL_ATRAC_ERROR_NEED_SECOND_BUFFER); - STR_CASE(CELL_ATRAC_ERROR_ALLDATA_IS_ONMEMORY); - STR_CASE(CELL_ATRAC_ERROR_ADD_DATA_IS_TOO_BIG); - STR_CASE(CELL_ATRAC_ERROR_NONEED_SECOND_BUFFER); - STR_CASE(CELL_ATRAC_ERROR_UNSET_LOOP_NUM); - STR_CASE(CELL_ATRAC_ERROR_ILLEGAL_SAMPLE); - STR_CASE(CELL_ATRAC_ERROR_ILLEGAL_RESET_BYTE); - STR_CASE(CELL_ATRAC_ERROR_ILLEGAL_PPU_THREAD_PRIORITY); - STR_CASE(CELL_ATRAC_ERROR_ILLEGAL_SPU_THREAD_PRIORITY); - } + switch (value) + { + STR_CASE(CELL_ATRAC_ERROR_API_FAIL); + STR_CASE(CELL_ATRAC_ERROR_READSIZE_OVER_BUFFER); + STR_CASE(CELL_ATRAC_ERROR_UNKNOWN_FORMAT); + STR_CASE(CELL_ATRAC_ERROR_READSIZE_IS_TOO_SMALL); + STR_CASE(CELL_ATRAC_ERROR_ILLEGAL_SAMPLING_RATE); + STR_CASE(CELL_ATRAC_ERROR_ILLEGAL_DATA); + STR_CASE(CELL_ATRAC_ERROR_NO_DECODER); + STR_CASE(CELL_ATRAC_ERROR_UNSET_DATA); + STR_CASE(CELL_ATRAC_ERROR_DECODER_WAS_CREATED); + STR_CASE(CELL_ATRAC_ERROR_ALLDATA_WAS_DECODED); + STR_CASE(CELL_ATRAC_ERROR_NODATA_IN_BUFFER); + STR_CASE(CELL_ATRAC_ERROR_NOT_ALIGNED_OUT_BUFFER); + STR_CASE(CELL_ATRAC_ERROR_NEED_SECOND_BUFFER); + STR_CASE(CELL_ATRAC_ERROR_ALLDATA_IS_ONMEMORY); + STR_CASE(CELL_ATRAC_ERROR_ADD_DATA_IS_TOO_BIG); + STR_CASE(CELL_ATRAC_ERROR_NONEED_SECOND_BUFFER); + STR_CASE(CELL_ATRAC_ERROR_UNSET_LOOP_NUM); + STR_CASE(CELL_ATRAC_ERROR_ILLEGAL_SAMPLE); + STR_CASE(CELL_ATRAC_ERROR_ILLEGAL_RESET_BYTE); + STR_CASE(CELL_ATRAC_ERROR_ILLEGAL_PPU_THREAD_PRIORITY); + STR_CASE(CELL_ATRAC_ERROR_ILLEGAL_SPU_THREAD_PRIORITY); + } - return unknown; - }); + return unknown; + }); } error_code cellAtracSetDataAndGetMemSize(vm::ptr pHandle, vm::ptr pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, vm::ptr puiWorkMemByte) @@ -235,37 +235,37 @@ error_code cellAtracGetSamplingRate() } DECLARE(ppu_module_manager::cellAtrac)("cellAtrac", []() -{ - REG_FUNC(cellAtrac, cellAtracSetDataAndGetMemSize); + { + REG_FUNC(cellAtrac, cellAtracSetDataAndGetMemSize); - REG_FUNC(cellAtrac, cellAtracCreateDecoder); - REG_FUNC(cellAtrac, cellAtracCreateDecoderExt); - REG_FUNC(cellAtrac, cellAtracDeleteDecoder); + REG_FUNC(cellAtrac, cellAtracCreateDecoder); + REG_FUNC(cellAtrac, cellAtracCreateDecoderExt); + REG_FUNC(cellAtrac, cellAtracDeleteDecoder); - REG_FUNC(cellAtrac, cellAtracDecode); + REG_FUNC(cellAtrac, cellAtracDecode); - REG_FUNC(cellAtrac, cellAtracGetStreamDataInfo); - REG_FUNC(cellAtrac, cellAtracAddStreamData); - REG_FUNC(cellAtrac, cellAtracGetRemainFrame); - REG_FUNC(cellAtrac, cellAtracGetVacantSize); - REG_FUNC(cellAtrac, cellAtracIsSecondBufferNeeded); - REG_FUNC(cellAtrac, cellAtracGetSecondBufferInfo); - REG_FUNC(cellAtrac, cellAtracSetSecondBuffer); + REG_FUNC(cellAtrac, cellAtracGetStreamDataInfo); + REG_FUNC(cellAtrac, cellAtracAddStreamData); + REG_FUNC(cellAtrac, cellAtracGetRemainFrame); + REG_FUNC(cellAtrac, cellAtracGetVacantSize); + REG_FUNC(cellAtrac, cellAtracIsSecondBufferNeeded); + REG_FUNC(cellAtrac, cellAtracGetSecondBufferInfo); + REG_FUNC(cellAtrac, cellAtracSetSecondBuffer); - REG_FUNC(cellAtrac, cellAtracGetChannel); - REG_FUNC(cellAtrac, cellAtracGetMaxSample); - REG_FUNC(cellAtrac, cellAtracGetNextSample); - REG_FUNC(cellAtrac, cellAtracGetSoundInfo); - REG_FUNC(cellAtrac, cellAtracGetNextDecodePosition); - REG_FUNC(cellAtrac, cellAtracGetBitrate); + REG_FUNC(cellAtrac, cellAtracGetChannel); + REG_FUNC(cellAtrac, cellAtracGetMaxSample); + REG_FUNC(cellAtrac, cellAtracGetNextSample); + REG_FUNC(cellAtrac, cellAtracGetSoundInfo); + REG_FUNC(cellAtrac, cellAtracGetNextDecodePosition); + REG_FUNC(cellAtrac, cellAtracGetBitrate); - REG_FUNC(cellAtrac, cellAtracGetLoopInfo); - REG_FUNC(cellAtrac, cellAtracSetLoopNum); + REG_FUNC(cellAtrac, cellAtracGetLoopInfo); + REG_FUNC(cellAtrac, cellAtracSetLoopNum); - REG_FUNC(cellAtrac, cellAtracGetBufferInfoForResetting); - REG_FUNC(cellAtrac, cellAtracResetPlayPosition); + REG_FUNC(cellAtrac, cellAtracGetBufferInfoForResetting); + REG_FUNC(cellAtrac, cellAtracResetPlayPosition); - REG_FUNC(cellAtrac, cellAtracGetInternalErrorInfo); + REG_FUNC(cellAtrac, cellAtracGetInternalErrorInfo); - REG_FUNC(cellAtrac, cellAtracGetSamplingRate); -}); + REG_FUNC(cellAtrac, cellAtracGetSamplingRate); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAtrac.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellAtrac.h index 6c9cb6824..133b1e6c8 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAtrac.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAtrac.h @@ -5,25 +5,25 @@ // Return Codes enum CellAtracError : u32 { - CELL_ATRAC_ERROR_API_FAIL = 0x80610301, - CELL_ATRAC_ERROR_READSIZE_OVER_BUFFER = 0x80610311, - CELL_ATRAC_ERROR_UNKNOWN_FORMAT = 0x80610312, - CELL_ATRAC_ERROR_READSIZE_IS_TOO_SMALL = 0x80610313, - CELL_ATRAC_ERROR_ILLEGAL_SAMPLING_RATE = 0x80610314, - CELL_ATRAC_ERROR_ILLEGAL_DATA = 0x80610315, - CELL_ATRAC_ERROR_NO_DECODER = 0x80610321, - CELL_ATRAC_ERROR_UNSET_DATA = 0x80610322, - CELL_ATRAC_ERROR_DECODER_WAS_CREATED = 0x80610323, - CELL_ATRAC_ERROR_ALLDATA_WAS_DECODED = 0x80610331, - CELL_ATRAC_ERROR_NODATA_IN_BUFFER = 0x80610332, - CELL_ATRAC_ERROR_NOT_ALIGNED_OUT_BUFFER = 0x80610333, - CELL_ATRAC_ERROR_NEED_SECOND_BUFFER = 0x80610334, - CELL_ATRAC_ERROR_ALLDATA_IS_ONMEMORY = 0x80610341, - CELL_ATRAC_ERROR_ADD_DATA_IS_TOO_BIG = 0x80610342, - CELL_ATRAC_ERROR_NONEED_SECOND_BUFFER = 0x80610351, - CELL_ATRAC_ERROR_UNSET_LOOP_NUM = 0x80610361, - CELL_ATRAC_ERROR_ILLEGAL_SAMPLE = 0x80610371, - CELL_ATRAC_ERROR_ILLEGAL_RESET_BYTE = 0x80610372, + CELL_ATRAC_ERROR_API_FAIL = 0x80610301, + CELL_ATRAC_ERROR_READSIZE_OVER_BUFFER = 0x80610311, + CELL_ATRAC_ERROR_UNKNOWN_FORMAT = 0x80610312, + CELL_ATRAC_ERROR_READSIZE_IS_TOO_SMALL = 0x80610313, + CELL_ATRAC_ERROR_ILLEGAL_SAMPLING_RATE = 0x80610314, + CELL_ATRAC_ERROR_ILLEGAL_DATA = 0x80610315, + CELL_ATRAC_ERROR_NO_DECODER = 0x80610321, + CELL_ATRAC_ERROR_UNSET_DATA = 0x80610322, + CELL_ATRAC_ERROR_DECODER_WAS_CREATED = 0x80610323, + CELL_ATRAC_ERROR_ALLDATA_WAS_DECODED = 0x80610331, + CELL_ATRAC_ERROR_NODATA_IN_BUFFER = 0x80610332, + CELL_ATRAC_ERROR_NOT_ALIGNED_OUT_BUFFER = 0x80610333, + CELL_ATRAC_ERROR_NEED_SECOND_BUFFER = 0x80610334, + CELL_ATRAC_ERROR_ALLDATA_IS_ONMEMORY = 0x80610341, + CELL_ATRAC_ERROR_ADD_DATA_IS_TOO_BIG = 0x80610342, + CELL_ATRAC_ERROR_NONEED_SECOND_BUFFER = 0x80610351, + CELL_ATRAC_ERROR_UNSET_LOOP_NUM = 0x80610361, + CELL_ATRAC_ERROR_ILLEGAL_SAMPLE = 0x80610371, + CELL_ATRAC_ERROR_ILLEGAL_RESET_BYTE = 0x80610372, CELL_ATRAC_ERROR_ILLEGAL_PPU_THREAD_PRIORITY = 0x80610381, CELL_ATRAC_ERROR_ILLEGAL_SPU_THREAD_PRIORITY = 0x80610382, }; @@ -31,9 +31,9 @@ enum CellAtracError : u32 // Remain Frame enum : s32 { - CELL_ATRAC_ALLDATA_IS_ON_MEMORY = -1, + CELL_ATRAC_ALLDATA_IS_ON_MEMORY = -1, CELL_ATRAC_NONLOOP_STREAM_DATA_IS_ON_MEMORY = -2, - CELL_ATRAC_LOOP_STREAM_DATA_IS_ON_MEMORY = -3, + CELL_ATRAC_LOOP_STREAM_DATA_IS_ON_MEMORY = -3, }; enum diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracMulti.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracMulti.cpp index d003ad211..ad534187d 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracMulti.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracMulti.cpp @@ -9,35 +9,35 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellAtracMultiError value) - { - switch (value) { - STR_CASE(CELL_ATRACMULTI_ERROR_API_FAIL); - STR_CASE(CELL_ATRACMULTI_ERROR_READSIZE_OVER_BUFFER); - STR_CASE(CELL_ATRACMULTI_ERROR_UNKNOWN_FORMAT); - STR_CASE(CELL_ATRACMULTI_ERROR_READSIZE_IS_TOO_SMALL); - STR_CASE(CELL_ATRACMULTI_ERROR_ILLEGAL_SAMPLING_RATE); - STR_CASE(CELL_ATRACMULTI_ERROR_ILLEGAL_DATA); - STR_CASE(CELL_ATRACMULTI_ERROR_NO_DECODER); - STR_CASE(CELL_ATRACMULTI_ERROR_UNSET_DATA); - STR_CASE(CELL_ATRACMULTI_ERROR_DECODER_WAS_CREATED); - STR_CASE(CELL_ATRACMULTI_ERROR_ALLDATA_WAS_DECODED); - STR_CASE(CELL_ATRACMULTI_ERROR_NODATA_IN_BUFFER); - STR_CASE(CELL_ATRACMULTI_ERROR_NOT_ALIGNED_OUT_BUFFER); - STR_CASE(CELL_ATRACMULTI_ERROR_NEED_SECOND_BUFFER); - STR_CASE(CELL_ATRACMULTI_ERROR_ALLDATA_IS_ONMEMORY); - STR_CASE(CELL_ATRACMULTI_ERROR_ADD_DATA_IS_TOO_BIG); - STR_CASE(CELL_ATRACMULTI_ERROR_NONEED_SECOND_BUFFER); - STR_CASE(CELL_ATRACMULTI_ERROR_UNSET_LOOP_NUM); - STR_CASE(CELL_ATRACMULTI_ERROR_ILLEGAL_SAMPLE); - STR_CASE(CELL_ATRACMULTI_ERROR_ILLEGAL_RESET_BYTE); - STR_CASE(CELL_ATRACMULTI_ERROR_ILLEGAL_PPU_THREAD_PRIORITY); - STR_CASE(CELL_ATRACMULTI_ERROR_ILLEGAL_SPU_THREAD_PRIORITY); - STR_CASE(CELL_ATRACMULTI_ERROR_API_PARAMETER); - } + switch (value) + { + STR_CASE(CELL_ATRACMULTI_ERROR_API_FAIL); + STR_CASE(CELL_ATRACMULTI_ERROR_READSIZE_OVER_BUFFER); + STR_CASE(CELL_ATRACMULTI_ERROR_UNKNOWN_FORMAT); + STR_CASE(CELL_ATRACMULTI_ERROR_READSIZE_IS_TOO_SMALL); + STR_CASE(CELL_ATRACMULTI_ERROR_ILLEGAL_SAMPLING_RATE); + STR_CASE(CELL_ATRACMULTI_ERROR_ILLEGAL_DATA); + STR_CASE(CELL_ATRACMULTI_ERROR_NO_DECODER); + STR_CASE(CELL_ATRACMULTI_ERROR_UNSET_DATA); + STR_CASE(CELL_ATRACMULTI_ERROR_DECODER_WAS_CREATED); + STR_CASE(CELL_ATRACMULTI_ERROR_ALLDATA_WAS_DECODED); + STR_CASE(CELL_ATRACMULTI_ERROR_NODATA_IN_BUFFER); + STR_CASE(CELL_ATRACMULTI_ERROR_NOT_ALIGNED_OUT_BUFFER); + STR_CASE(CELL_ATRACMULTI_ERROR_NEED_SECOND_BUFFER); + STR_CASE(CELL_ATRACMULTI_ERROR_ALLDATA_IS_ONMEMORY); + STR_CASE(CELL_ATRACMULTI_ERROR_ADD_DATA_IS_TOO_BIG); + STR_CASE(CELL_ATRACMULTI_ERROR_NONEED_SECOND_BUFFER); + STR_CASE(CELL_ATRACMULTI_ERROR_UNSET_LOOP_NUM); + STR_CASE(CELL_ATRACMULTI_ERROR_ILLEGAL_SAMPLE); + STR_CASE(CELL_ATRACMULTI_ERROR_ILLEGAL_RESET_BYTE); + STR_CASE(CELL_ATRACMULTI_ERROR_ILLEGAL_PPU_THREAD_PRIORITY); + STR_CASE(CELL_ATRACMULTI_ERROR_ILLEGAL_SPU_THREAD_PRIORITY); + STR_CASE(CELL_ATRACMULTI_ERROR_API_PARAMETER); + } - return unknown; - }); + return unknown; + }); } error_code cellAtracMultiSetDataAndGetMemSize(vm::ptr pHandle, vm::ptr pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, u32 uiOutputChNum, vm::ptr piTrackArray, vm::ptr puiWorkMemByte) @@ -244,38 +244,38 @@ error_code cellAtracMultiGetSamplingRate() } DECLARE(ppu_module_manager::cellAtracMulti)("cellAtracMulti", []() -{ - REG_FUNC(cellAtracMulti, cellAtracMultiSetDataAndGetMemSize); + { + REG_FUNC(cellAtracMulti, cellAtracMultiSetDataAndGetMemSize); - REG_FUNC(cellAtracMulti, cellAtracMultiCreateDecoder); - REG_FUNC(cellAtracMulti, cellAtracMultiCreateDecoderExt); - REG_FUNC(cellAtracMulti, cellAtracMultiDeleteDecoder); + REG_FUNC(cellAtracMulti, cellAtracMultiCreateDecoder); + REG_FUNC(cellAtracMulti, cellAtracMultiCreateDecoderExt); + REG_FUNC(cellAtracMulti, cellAtracMultiDeleteDecoder); - REG_FUNC(cellAtracMulti, cellAtracMultiDecode); + 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, 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, 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, cellAtracMultiGetLoopInfo); + REG_FUNC(cellAtracMulti, cellAtracMultiSetLoopNum); - REG_FUNC(cellAtracMulti, cellAtracMultiGetBufferInfoForResetting); - REG_FUNC(cellAtracMulti, cellAtracMultiResetPlayPosition); + REG_FUNC(cellAtracMulti, cellAtracMultiGetBufferInfoForResetting); + REG_FUNC(cellAtracMulti, cellAtracMultiResetPlayPosition); - REG_FUNC(cellAtracMulti, cellAtracMultiGetInternalErrorInfo); + REG_FUNC(cellAtracMulti, cellAtracMultiGetInternalErrorInfo); - REG_FUNC(cellAtracMulti, cellAtracMultiGetSamplingRate); -}); + REG_FUNC(cellAtracMulti, cellAtracMultiGetSamplingRate); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracMulti.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracMulti.h index bbeded81c..fee0b6f43 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracMulti.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracMulti.h @@ -5,36 +5,36 @@ // Return Codes enum CellAtracMultiError : u32 { - 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_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, + CELL_ATRACMULTI_ERROR_API_PARAMETER = 0x80610b91, }; // Remain Frame enum : s32 { - CELL_ATRACMULTI_ALLDATA_IS_ON_MEMORY = -1, + 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, + CELL_ATRACMULTI_LOOP_STREAM_DATA_IS_ON_MEMORY = -3, }; enum diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracXdec.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracXdec.cpp index 36228d8a5..1b2a58f1d 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracXdec.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracXdec.cpp @@ -21,70 +21,70 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellAtracXdecError value) - { - switch (value) { - STR_CASE(CELL_ADEC_ERROR_ATX_OK); // CELL_ADEC_ERROR_ATX_OFFSET, CELL_ADEC_ERROR_ATX_NONE - STR_CASE(CELL_ADEC_ERROR_ATX_BUSY); - STR_CASE(CELL_ADEC_ERROR_ATX_EMPTY); - STR_CASE(CELL_ADEC_ERROR_ATX_ATSHDR); - STR_CASE(CELL_ADEC_ERROR_ATX_NON_FATAL); - STR_CASE(CELL_ADEC_ERROR_ATX_NOT_IMPLE); - STR_CASE(CELL_ADEC_ERROR_ATX_PACK_CE_OVERFLOW); - STR_CASE(CELL_ADEC_ERROR_ATX_ILLEGAL_NPROCQUS); - STR_CASE(CELL_ADEC_ERROR_ATX_FATAL); - STR_CASE(CELL_ADEC_ERROR_ATX_ENC_OVERFLOW); - STR_CASE(CELL_ADEC_ERROR_ATX_PACK_CE_UNDERFLOW); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDCT); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GAINADJ); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDSF); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_SPECTRA); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDWL); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GHWAVE); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_SHEADER); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_A); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_B); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_C); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_D); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_E); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_A); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_B); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_C); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_D); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDCT_A); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GC_NGC); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLEV_A); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLOC_A); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLEV_B); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLOC_B); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_SN_NWVS); - STR_CASE(CELL_ADEC_ERROR_ATX_FATAL_HANDLE); - STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_SAMPLING_FREQ); - STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_CH_CONFIG_INDEX); - STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_NBYTES); - STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_BLOCK_NUM); - STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_BLOCK_ID); - STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_CHANNELS); - STR_CASE(CELL_ADEC_ERROR_ATX_UNINIT_BLOCK_SPECIFIED); - STR_CASE(CELL_ADEC_ERROR_ATX_POSCFG_PRESENT); - STR_CASE(CELL_ADEC_ERROR_ATX_BUFFER_OVERFLOW); - STR_CASE(CELL_ADEC_ERROR_ATX_ILL_BLK_TYPE_ID); - STR_CASE(CELL_ADEC_ERROR_ATX_UNPACK_CHANNEL_BLK_FAILED); - STR_CASE(CELL_ADEC_ERROR_ATX_ILL_BLK_ID_USED_1); - STR_CASE(CELL_ADEC_ERROR_ATX_ILL_BLK_ID_USED_2); - STR_CASE(CELL_ADEC_ERROR_ATX_ILLEGAL_ENC_SETTING); - STR_CASE(CELL_ADEC_ERROR_ATX_ILLEGAL_DEC_SETTING); - STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_NSAMPLES); - STR_CASE(CELL_ADEC_ERROR_ATX_ILL_SYNCWORD); - STR_CASE(CELL_ADEC_ERROR_ATX_ILL_SAMPLING_FREQ); - STR_CASE(CELL_ADEC_ERROR_ATX_ILL_CH_CONFIG_INDEX); - STR_CASE(CELL_ADEC_ERROR_ATX_RAW_DATA_FRAME_SIZE_OVER); - STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_ENHANCE_LENGTH_OVER); - STR_CASE(CELL_ADEC_ERROR_ATX_SPU_INTERNAL_FAIL); - } + switch (value) + { + STR_CASE(CELL_ADEC_ERROR_ATX_OK); // CELL_ADEC_ERROR_ATX_OFFSET, CELL_ADEC_ERROR_ATX_NONE + STR_CASE(CELL_ADEC_ERROR_ATX_BUSY); + STR_CASE(CELL_ADEC_ERROR_ATX_EMPTY); + STR_CASE(CELL_ADEC_ERROR_ATX_ATSHDR); + STR_CASE(CELL_ADEC_ERROR_ATX_NON_FATAL); + STR_CASE(CELL_ADEC_ERROR_ATX_NOT_IMPLE); + STR_CASE(CELL_ADEC_ERROR_ATX_PACK_CE_OVERFLOW); + STR_CASE(CELL_ADEC_ERROR_ATX_ILLEGAL_NPROCQUS); + STR_CASE(CELL_ADEC_ERROR_ATX_FATAL); + STR_CASE(CELL_ADEC_ERROR_ATX_ENC_OVERFLOW); + STR_CASE(CELL_ADEC_ERROR_ATX_PACK_CE_UNDERFLOW); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDCT); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GAINADJ); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDSF); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_SPECTRA); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDWL); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GHWAVE); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_SHEADER); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_A); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_B); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_C); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_D); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_E); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_A); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_B); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_C); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_D); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_IDCT_A); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GC_NGC); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLEV_A); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLOC_A); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLEV_B); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLOC_B); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_SN_NWVS); + STR_CASE(CELL_ADEC_ERROR_ATX_FATAL_HANDLE); + STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_SAMPLING_FREQ); + STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_CH_CONFIG_INDEX); + STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_NBYTES); + STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_BLOCK_NUM); + STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_BLOCK_ID); + STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_CHANNELS); + STR_CASE(CELL_ADEC_ERROR_ATX_UNINIT_BLOCK_SPECIFIED); + STR_CASE(CELL_ADEC_ERROR_ATX_POSCFG_PRESENT); + STR_CASE(CELL_ADEC_ERROR_ATX_BUFFER_OVERFLOW); + STR_CASE(CELL_ADEC_ERROR_ATX_ILL_BLK_TYPE_ID); + STR_CASE(CELL_ADEC_ERROR_ATX_UNPACK_CHANNEL_BLK_FAILED); + STR_CASE(CELL_ADEC_ERROR_ATX_ILL_BLK_ID_USED_1); + STR_CASE(CELL_ADEC_ERROR_ATX_ILL_BLK_ID_USED_2); + STR_CASE(CELL_ADEC_ERROR_ATX_ILLEGAL_ENC_SETTING); + STR_CASE(CELL_ADEC_ERROR_ATX_ILLEGAL_DEC_SETTING); + STR_CASE(CELL_ADEC_ERROR_ATX_ASSERT_NSAMPLES); + STR_CASE(CELL_ADEC_ERROR_ATX_ILL_SYNCWORD); + STR_CASE(CELL_ADEC_ERROR_ATX_ILL_SAMPLING_FREQ); + STR_CASE(CELL_ADEC_ERROR_ATX_ILL_CH_CONFIG_INDEX); + STR_CASE(CELL_ADEC_ERROR_ATX_RAW_DATA_FRAME_SIZE_OVER); + STR_CASE(CELL_ADEC_ERROR_ATX_SYNTAX_ENHANCE_LENGTH_OVER); + STR_CASE(CELL_ADEC_ERROR_ATX_SPU_INTERNAL_FAIL); + } - return unknown; - }); + return unknown; + }); } constexpr u32 atracXdecGetSpursMemSize(u32 nch_in) @@ -130,7 +130,7 @@ void AtracXdecDecoder::alloc_avcodec() frame->linesize[i] = ATXDEC_SAMPLES_PER_FRAME * sizeof(f32); } - frame->buf[0] = av_buffer_create(frame->data[0], ATXDEC_SAMPLES_PER_FRAME * sizeof(f32) * frame->ch_layout.nb_channels, [](void*, uint8_t*){}, nullptr, 0); + frame->buf[0] = av_buffer_create(frame->data[0], ATXDEC_SAMPLES_PER_FRAME * sizeof(f32) * frame->ch_layout.nb_channels, [](void*, uint8_t*) {}, nullptr, 0); return 0; }; @@ -172,7 +172,7 @@ void AtracXdecDecoder::init_avcodec() packet->data = work_mem.get_ptr(); packet->size = nbytes; - packet->buf = av_buffer_create(work_mem.get_ptr(), nbytes, [](void*, uint8_t*){}, nullptr, 0); + packet->buf = av_buffer_create(work_mem.get_ptr(), nbytes, [](void*, uint8_t*) {}, nullptr, 0); } error_code AtracXdecDecoder::set_config_info(u32 sampling_freq, u32 ch_config_idx, u32 nbytes) @@ -188,7 +188,7 @@ error_code AtracXdecDecoder::set_config_info(u32 sampling_freq, u32 ch_config_id if (ch_config_idx > 7u) { this->config_is_set = false; - return { 0x80004005, "AtracXdecDecoder::set_config_info() failed: Invalid channel configuration: %d", ch_config_idx }; + return {0x80004005, "AtracXdecDecoder::set_config_info() failed: Invalid channel configuration: %d", ch_config_idx}; } this->nch_blocks = ATXDEC_NCH_BLOCKS_MAP[ch_config_idx]; @@ -197,19 +197,19 @@ error_code AtracXdecDecoder::set_config_info(u32 sampling_freq, u32 ch_config_id if (ch_config_idx == 0u) { this->config_is_set = false; - return { 0x80004005, "AtracXdecDecoder::set_config_info() failed: Invalid channel configuration: %d", ch_config_idx }; + return {0x80004005, "AtracXdecDecoder::set_config_info() failed: Invalid channel configuration: %d", ch_config_idx}; } if (sampling_freq != 48000u && sampling_freq != 44100u) // 32kHz is not supported, even though official docs claim it is { this->config_is_set = false; - return { 0x80004005, "AtracXdecDecoder::set_config_info() failed: Invalid sample rate: %d", sampling_freq }; + return {0x80004005, "AtracXdecDecoder::set_config_info() failed: Invalid sample rate: %d", sampling_freq}; } if (nbytes == 0u || nbytes > ATXDEC_MAX_FRAME_LENGTH) { this->config_is_set = false; - return { 0x80004005, "AtracXdecDecoder::set_config_info() failed: Invalid frame length: 0x%x", nbytes }; + return {0x80004005, "AtracXdecDecoder::set_config_info() failed: Invalid frame length: 0x%x", nbytes}; } this->config_is_set = true; @@ -220,7 +220,7 @@ error_code AtracXdecDecoder::init_decode(u32 bw_pcm, u32 nch_out) { if (bw_pcm < CELL_ADEC_ATRACX_WORD_SZ_16BIT || (bw_pcm > CELL_ADEC_ATRACX_WORD_SZ_32BIT && bw_pcm != CELL_ADEC_ATRACX_WORD_SZ_FLOAT)) { - return { 0x80004005, "AtracXdecDecoder::init_decode() failed: Invalid PCM output format" }; + return {0x80004005, "AtracXdecDecoder::init_decode() failed: Invalid PCM output format"}; } this->bw_pcm = bw_pcm; @@ -237,7 +237,7 @@ error_code AtracXdecDecoder::parse_ats_header(vm::cptr au_start_addr) if (ats.sync_word != 0x0fd0) { - return { CELL_ADEC_ERROR_ATX_ATSHDR, "AtracXdecDecoder::parse_ats_header() failed: Invalid sync word: 0x%x", ats.sync_word }; + return {CELL_ADEC_ERROR_ATX_ATSHDR, "AtracXdecDecoder::parse_ats_header() failed: Invalid sync word: 0x%x", ats.sync_word}; } const u8 sample_rate_idx = ats.params >> 13; @@ -246,7 +246,7 @@ error_code AtracXdecDecoder::parse_ats_header(vm::cptr au_start_addr) if (ch_config_idx == 0u) { - return { CELL_ADEC_ERROR_ATX_ATSHDR, "AtracXdecDecoder::parse_ats_header() failed: Invalid channel configuration: %d", ch_config_idx }; + return {CELL_ADEC_ERROR_ATX_ATSHDR, "AtracXdecDecoder::parse_ats_header() failed: Invalid channel configuration: %d", ch_config_idx}; } u32 sampling_freq; @@ -254,7 +254,7 @@ error_code AtracXdecDecoder::parse_ats_header(vm::cptr au_start_addr) { case 1: sampling_freq = 44100; break; case 2: sampling_freq = 48000; break; - default: return { CELL_ADEC_ERROR_ATX_ATSHDR, "AtracXdecDecoder::parse_ats_header() failed: Invalid sample rate index: %d", sample_rate_idx }; + default: return {CELL_ADEC_ERROR_ATX_ATSHDR, "AtracXdecDecoder::parse_ats_header() failed: Invalid sample rate index: %d", sample_rate_idx}; } return set_config_info(sampling_freq, ch_config_idx, nbytes); // Cannot return error here, values were already checked @@ -281,7 +281,7 @@ void AtracXdecContext::exec(ppu_thread& ppu) case atracxdec_state::decoding: goto label6_decode_state; } - for (;;cmd_counter++) + for (;; cmd_counter++) { cellAtracXdec.trace("Command counter: %llu, waiting for next command...", cmd_counter); @@ -302,7 +302,7 @@ void AtracXdecContext::exec(ppu_thread& ppu) } savestate = atracxdec_state::waiting_for_cmd; - label1_wait_for_cmd_state: + label1_wait_for_cmd_state: ensure(sys_cond_wait(ppu, queue_not_empty, 0) == CELL_OK); @@ -319,7 +319,7 @@ void AtracXdecContext::exec(ppu_thread& ppu) ensure(sys_mutex_unlock(ppu, queue_mutex) == CELL_OK); savestate = atracxdec_state::checking_run_thread_1; - label2_check_run_thread_1_state: + label2_check_run_thread_1_state: ensure(sys_mutex_lock(ppu, run_thread_mutex, 0) == CELL_OK); @@ -337,7 +337,7 @@ void AtracXdecContext::exec(ppu_thread& ppu) ensure(sys_mutex_unlock(ppu, run_thread_mutex) == CELL_OK); savestate = atracxdec_state::executing_cmd; - label3_execute_cmd_state: + label3_execute_cmd_state: cellAtracXdec.trace("Command type: %d", static_cast(cmd.type.get())); @@ -396,7 +396,7 @@ void AtracXdecContext::exec(ppu_thread& ppu) while (output_locked) { savestate = atracxdec_state::waiting_for_output; - label4_wait_for_output_state: + label4_wait_for_output_state: ensure(sys_cond_wait(ppu, output_consumed, 0) == CELL_OK); @@ -409,7 +409,7 @@ void AtracXdecContext::exec(ppu_thread& ppu) cellAtracXdec.trace("Output consumed"); savestate = atracxdec_state::checking_run_thread_2; - label5_check_run_thread_2_state: + label5_check_run_thread_2_state: ensure(sys_mutex_lock(ppu, run_thread_mutex, 0) == CELL_OK); @@ -428,7 +428,7 @@ void AtracXdecContext::exec(ppu_thread& ppu) ensure(sys_mutex_unlock(ppu, run_thread_mutex) == CELL_OK); savestate = atracxdec_state::decoding; - label6_decode_state: + label6_decode_state: u32 error = CELL_OK; @@ -643,7 +643,7 @@ void AtracXdecContext::exec(ppu_thread& ppu) const u32 output_size = decoded_samples_num * (decoder.bw_pcm & 0x7fu) * decoder.nch_out; - const vm::var bsi_info{{ decoder.sampling_freq, decoder.ch_config_idx, decoder.nbytes }}; + const vm::var bsi_info{{decoder.sampling_freq, decoder.ch_config_idx, decoder.nbytes}}; const AdecCorrectPtsValueType correct_pts_type = [&] { @@ -652,7 +652,7 @@ void AtracXdecContext::exec(ppu_thread& ppu) case 32000u: return ADEC_CORRECT_PTS_VALUE_TYPE_ATRACX_32000Hz; case 44100u: return ADEC_CORRECT_PTS_VALUE_TYPE_ATRACX_44100Hz; case 48000u: return ADEC_CORRECT_PTS_VALUE_TYPE_ATRACX_48000Hz; - default: return ADEC_CORRECT_PTS_VALUE_TYPE_UNSPECIFIED; + default: return ADEC_CORRECT_PTS_VALUE_TYPE_UNSPECIFIED; } }(); @@ -739,10 +739,7 @@ error_code _CellAdecCoreOpGetMemSize_atracx(vm::ptr attr) ensure(!!attr); // Not checked on LLE constexpr u32 mem_size = - sizeof(AtracXdecContext) + 0x7f - + ATXDEC_SPURS_STRUCTS_SIZE + 0x1d8 - + atracXdecGetSpursMemSize(nch_in) - + ATXDEC_SAMPLES_PER_FRAME * sizeof(f32) * nch_in; + sizeof(AtracXdecContext) + 0x7f + ATXDEC_SPURS_STRUCTS_SIZE + 0x1d8 + atracXdecGetSpursMemSize(nch_in) + ATXDEC_SAMPLES_PER_FRAME * sizeof(f32) * nch_in; attr->workMemSize = utils::align(mem_size, 0x80); @@ -763,15 +760,15 @@ error_code _CellAdecCoreOpOpenExt_atracx(ppu_thread& ppu, vm::ptr::make(handle.addr() + utils::align(static_cast(sizeof(AtracXdecContext)), 0x80) + ATXDEC_SPURS_STRUCTS_SIZE))); + vm::bptr::make(handle.addr() + utils::align(static_cast(sizeof(AtracXdecContext)), 0x80) + ATXDEC_SPURS_STRUCTS_SIZE))); - const vm::var mutex_attr{{ SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, { "_atd001"_u64 } }}; - const vm::var cond_attr{{ SYS_SYNC_NOT_PROCESS_SHARED, 0, 0, { "_atd002"_u64 } }}; + const vm::var mutex_attr{{SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, {"_atd001"_u64}}}; + const vm::var cond_attr{{SYS_SYNC_NOT_PROCESS_SHARED, 0, 0, {"_atd002"_u64}}}; ensure(sys_mutex_create(ppu, handle.ptr(&AtracXdecContext::queue_mutex), mutex_attr) == CELL_OK); ensure(sys_cond_create(ppu, handle.ptr(&AtracXdecContext::queue_not_empty), handle->queue_mutex, cond_attr) == CELL_OK); @@ -968,42 +965,42 @@ static void init_gvar(vm::gvar& var) } DECLARE(ppu_module_manager::cellAtracXdec)("cellAtracXdec", []() -{ - REG_VNID(cellAtracXdec, 0x076b33ab, g_cell_adec_core_ops_atracx2ch).init = []() { - g_cell_adec_core_ops_atracx2ch->getMemSize.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetMemSize_atracx<2>))); - init_gvar(g_cell_adec_core_ops_atracx2ch); - }; - REG_VNID(cellAtracXdec, 0x1d210eaa, g_cell_adec_core_ops_atracx6ch).init = []() - { - g_cell_adec_core_ops_atracx6ch->getMemSize.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetMemSize_atracx<6>))); - init_gvar(g_cell_adec_core_ops_atracx6ch); - }; - REG_VNID(cellAtracXdec, 0xe9a86e54, g_cell_adec_core_ops_atracx8ch).init = []() - { - g_cell_adec_core_ops_atracx8ch->getMemSize.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetMemSize_atracx<8>))); - init_gvar(g_cell_adec_core_ops_atracx8ch); - }; - REG_VNID(cellAtracXdec, 0x4944af9a, g_cell_adec_core_ops_atracx).init = []() - { - g_cell_adec_core_ops_atracx->getMemSize.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetMemSize_atracx<8>))); - init_gvar(g_cell_adec_core_ops_atracx); - }; + REG_VNID(cellAtracXdec, 0x076b33ab, g_cell_adec_core_ops_atracx2ch).init = []() + { + g_cell_adec_core_ops_atracx2ch->getMemSize.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetMemSize_atracx<2>))); + init_gvar(g_cell_adec_core_ops_atracx2ch); + }; + REG_VNID(cellAtracXdec, 0x1d210eaa, g_cell_adec_core_ops_atracx6ch).init = []() + { + g_cell_adec_core_ops_atracx6ch->getMemSize.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetMemSize_atracx<6>))); + init_gvar(g_cell_adec_core_ops_atracx6ch); + }; + REG_VNID(cellAtracXdec, 0xe9a86e54, g_cell_adec_core_ops_atracx8ch).init = []() + { + g_cell_adec_core_ops_atracx8ch->getMemSize.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetMemSize_atracx<8>))); + init_gvar(g_cell_adec_core_ops_atracx8ch); + }; + REG_VNID(cellAtracXdec, 0x4944af9a, g_cell_adec_core_ops_atracx).init = []() + { + g_cell_adec_core_ops_atracx->getMemSize.set(g_fxo->get().func_addr(FIND_FUNC(_CellAdecCoreOpGetMemSize_atracx<8>))); + init_gvar(g_cell_adec_core_ops_atracx); + }; - REG_HIDDEN_FUNC(_CellAdecCoreOpGetMemSize_atracx<2>); - REG_HIDDEN_FUNC(_CellAdecCoreOpGetMemSize_atracx<6>); - REG_HIDDEN_FUNC(_CellAdecCoreOpGetMemSize_atracx<8>); - REG_HIDDEN_FUNC(_CellAdecCoreOpOpen_atracx); - REG_HIDDEN_FUNC(_CellAdecCoreOpClose_atracx); - REG_HIDDEN_FUNC(_CellAdecCoreOpStartSeq_atracx); - REG_HIDDEN_FUNC(_CellAdecCoreOpEndSeq_atracx); - REG_HIDDEN_FUNC(_CellAdecCoreOpDecodeAu_atracx); - REG_HIDDEN_FUNC(_CellAdecCoreOpGetVersion_atracx); - REG_HIDDEN_FUNC(_CellAdecCoreOpRealign_atracx); - REG_HIDDEN_FUNC(_CellAdecCoreOpReleasePcm_atracx); - REG_HIDDEN_FUNC(_CellAdecCoreOpGetPcmHandleNum_atracx); - REG_HIDDEN_FUNC(_CellAdecCoreOpGetBsiInfoSize_atracx); - REG_HIDDEN_FUNC(_CellAdecCoreOpOpenExt_atracx); + REG_HIDDEN_FUNC(_CellAdecCoreOpGetMemSize_atracx<2>); + REG_HIDDEN_FUNC(_CellAdecCoreOpGetMemSize_atracx<6>); + REG_HIDDEN_FUNC(_CellAdecCoreOpGetMemSize_atracx<8>); + REG_HIDDEN_FUNC(_CellAdecCoreOpOpen_atracx); + REG_HIDDEN_FUNC(_CellAdecCoreOpClose_atracx); + REG_HIDDEN_FUNC(_CellAdecCoreOpStartSeq_atracx); + REG_HIDDEN_FUNC(_CellAdecCoreOpEndSeq_atracx); + REG_HIDDEN_FUNC(_CellAdecCoreOpDecodeAu_atracx); + REG_HIDDEN_FUNC(_CellAdecCoreOpGetVersion_atracx); + REG_HIDDEN_FUNC(_CellAdecCoreOpRealign_atracx); + REG_HIDDEN_FUNC(_CellAdecCoreOpReleasePcm_atracx); + REG_HIDDEN_FUNC(_CellAdecCoreOpGetPcmHandleNum_atracx); + REG_HIDDEN_FUNC(_CellAdecCoreOpGetBsiInfoSize_atracx); + REG_HIDDEN_FUNC(_CellAdecCoreOpOpenExt_atracx); - REG_HIDDEN_FUNC(atracXdecEntry); -}); + REG_HIDDEN_FUNC(atracXdecEntry); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracXdec.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracXdec.h index a670a242c..519438b8f 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracXdec.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAtracXdec.h @@ -25,65 +25,65 @@ constexpr int averror_eof = AVERROR_EOF; // Workaround for old-style-cast error enum CellAtracXdecError : u32 { - CELL_ADEC_ERROR_ATX_OFFSET = 0x80612200, - CELL_ADEC_ERROR_ATX_NONE = 0x80612200, - CELL_ADEC_ERROR_ATX_OK = 0x80612200, - CELL_ADEC_ERROR_ATX_BUSY = 0x80612264, - CELL_ADEC_ERROR_ATX_EMPTY = 0x80612265, - CELL_ADEC_ERROR_ATX_ATSHDR = 0x80612266, - CELL_ADEC_ERROR_ATX_NON_FATAL = 0x80612281, - CELL_ADEC_ERROR_ATX_NOT_IMPLE = 0x80612282, - CELL_ADEC_ERROR_ATX_PACK_CE_OVERFLOW = 0x80612283, - CELL_ADEC_ERROR_ATX_ILLEGAL_NPROCQUS = 0x80612284, - CELL_ADEC_ERROR_ATX_FATAL = 0x8061228c, - CELL_ADEC_ERROR_ATX_ENC_OVERFLOW = 0x8061228d, - CELL_ADEC_ERROR_ATX_PACK_CE_UNDERFLOW = 0x8061228e, - CELL_ADEC_ERROR_ATX_SYNTAX_IDCT = 0x8061228f, - CELL_ADEC_ERROR_ATX_SYNTAX_GAINADJ = 0x80612290, - CELL_ADEC_ERROR_ATX_SYNTAX_IDSF = 0x80612291, - CELL_ADEC_ERROR_ATX_SYNTAX_SPECTRA = 0x80612292, - CELL_ADEC_ERROR_ATX_SYNTAX_IDWL = 0x80612293, - CELL_ADEC_ERROR_ATX_SYNTAX_GHWAVE = 0x80612294, - CELL_ADEC_ERROR_ATX_SYNTAX_SHEADER = 0x80612295, - CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_A = 0x80612296, - CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_B = 0x80612297, - CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_C = 0x80612298, - CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_D = 0x80612299, - CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_E = 0x8061229a, - CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_A = 0x8061229b, - CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_B = 0x8061229c, - CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_C = 0x8061229d, - CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_D = 0x8061229e, - CELL_ADEC_ERROR_ATX_SYNTAX_IDCT_A = 0x8061229f, - CELL_ADEC_ERROR_ATX_SYNTAX_GC_NGC = 0x806122a0, - CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLEV_A = 0x806122a1, - CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLOC_A = 0x806122a2, - CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLEV_B = 0x806122a3, - CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLOC_B = 0x806122a4, - CELL_ADEC_ERROR_ATX_SYNTAX_SN_NWVS = 0x806122a5, - CELL_ADEC_ERROR_ATX_FATAL_HANDLE = 0x806122aa, - CELL_ADEC_ERROR_ATX_ASSERT_SAMPLING_FREQ = 0x806122ab, - CELL_ADEC_ERROR_ATX_ASSERT_CH_CONFIG_INDEX = 0x806122ac, - CELL_ADEC_ERROR_ATX_ASSERT_NBYTES = 0x806122ad, - CELL_ADEC_ERROR_ATX_ASSERT_BLOCK_NUM = 0x806122ae, - CELL_ADEC_ERROR_ATX_ASSERT_BLOCK_ID = 0x806122af, - CELL_ADEC_ERROR_ATX_ASSERT_CHANNELS = 0x806122b0, - CELL_ADEC_ERROR_ATX_UNINIT_BLOCK_SPECIFIED = 0x806122b1, - CELL_ADEC_ERROR_ATX_POSCFG_PRESENT = 0x806122b2, - CELL_ADEC_ERROR_ATX_BUFFER_OVERFLOW = 0x806122b3, - CELL_ADEC_ERROR_ATX_ILL_BLK_TYPE_ID = 0x806122b4, - CELL_ADEC_ERROR_ATX_UNPACK_CHANNEL_BLK_FAILED = 0x806122b5, - CELL_ADEC_ERROR_ATX_ILL_BLK_ID_USED_1 = 0x806122b6, - CELL_ADEC_ERROR_ATX_ILL_BLK_ID_USED_2 = 0x806122b7, - CELL_ADEC_ERROR_ATX_ILLEGAL_ENC_SETTING = 0x806122b8, - CELL_ADEC_ERROR_ATX_ILLEGAL_DEC_SETTING = 0x806122b9, - CELL_ADEC_ERROR_ATX_ASSERT_NSAMPLES = 0x806122ba, - CELL_ADEC_ERROR_ATX_ILL_SYNCWORD = 0x806122bb, - CELL_ADEC_ERROR_ATX_ILL_SAMPLING_FREQ = 0x806122bc, - CELL_ADEC_ERROR_ATX_ILL_CH_CONFIG_INDEX = 0x806122bd, - CELL_ADEC_ERROR_ATX_RAW_DATA_FRAME_SIZE_OVER = 0x806122be, + CELL_ADEC_ERROR_ATX_OFFSET = 0x80612200, + CELL_ADEC_ERROR_ATX_NONE = 0x80612200, + CELL_ADEC_ERROR_ATX_OK = 0x80612200, + CELL_ADEC_ERROR_ATX_BUSY = 0x80612264, + CELL_ADEC_ERROR_ATX_EMPTY = 0x80612265, + CELL_ADEC_ERROR_ATX_ATSHDR = 0x80612266, + CELL_ADEC_ERROR_ATX_NON_FATAL = 0x80612281, + CELL_ADEC_ERROR_ATX_NOT_IMPLE = 0x80612282, + CELL_ADEC_ERROR_ATX_PACK_CE_OVERFLOW = 0x80612283, + CELL_ADEC_ERROR_ATX_ILLEGAL_NPROCQUS = 0x80612284, + CELL_ADEC_ERROR_ATX_FATAL = 0x8061228c, + CELL_ADEC_ERROR_ATX_ENC_OVERFLOW = 0x8061228d, + CELL_ADEC_ERROR_ATX_PACK_CE_UNDERFLOW = 0x8061228e, + CELL_ADEC_ERROR_ATX_SYNTAX_IDCT = 0x8061228f, + CELL_ADEC_ERROR_ATX_SYNTAX_GAINADJ = 0x80612290, + CELL_ADEC_ERROR_ATX_SYNTAX_IDSF = 0x80612291, + CELL_ADEC_ERROR_ATX_SYNTAX_SPECTRA = 0x80612292, + CELL_ADEC_ERROR_ATX_SYNTAX_IDWL = 0x80612293, + CELL_ADEC_ERROR_ATX_SYNTAX_GHWAVE = 0x80612294, + CELL_ADEC_ERROR_ATX_SYNTAX_SHEADER = 0x80612295, + CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_A = 0x80612296, + CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_B = 0x80612297, + CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_C = 0x80612298, + CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_D = 0x80612299, + CELL_ADEC_ERROR_ATX_SYNTAX_IDWL_E = 0x8061229a, + CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_A = 0x8061229b, + CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_B = 0x8061229c, + CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_C = 0x8061229d, + CELL_ADEC_ERROR_ATX_SYNTAX_IDSF_D = 0x8061229e, + CELL_ADEC_ERROR_ATX_SYNTAX_IDCT_A = 0x8061229f, + CELL_ADEC_ERROR_ATX_SYNTAX_GC_NGC = 0x806122a0, + CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLEV_A = 0x806122a1, + CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLOC_A = 0x806122a2, + CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLEV_B = 0x806122a3, + CELL_ADEC_ERROR_ATX_SYNTAX_GC_IDLOC_B = 0x806122a4, + CELL_ADEC_ERROR_ATX_SYNTAX_SN_NWVS = 0x806122a5, + CELL_ADEC_ERROR_ATX_FATAL_HANDLE = 0x806122aa, + CELL_ADEC_ERROR_ATX_ASSERT_SAMPLING_FREQ = 0x806122ab, + CELL_ADEC_ERROR_ATX_ASSERT_CH_CONFIG_INDEX = 0x806122ac, + CELL_ADEC_ERROR_ATX_ASSERT_NBYTES = 0x806122ad, + CELL_ADEC_ERROR_ATX_ASSERT_BLOCK_NUM = 0x806122ae, + CELL_ADEC_ERROR_ATX_ASSERT_BLOCK_ID = 0x806122af, + CELL_ADEC_ERROR_ATX_ASSERT_CHANNELS = 0x806122b0, + CELL_ADEC_ERROR_ATX_UNINIT_BLOCK_SPECIFIED = 0x806122b1, + CELL_ADEC_ERROR_ATX_POSCFG_PRESENT = 0x806122b2, + CELL_ADEC_ERROR_ATX_BUFFER_OVERFLOW = 0x806122b3, + CELL_ADEC_ERROR_ATX_ILL_BLK_TYPE_ID = 0x806122b4, + CELL_ADEC_ERROR_ATX_UNPACK_CHANNEL_BLK_FAILED = 0x806122b5, + CELL_ADEC_ERROR_ATX_ILL_BLK_ID_USED_1 = 0x806122b6, + CELL_ADEC_ERROR_ATX_ILL_BLK_ID_USED_2 = 0x806122b7, + CELL_ADEC_ERROR_ATX_ILLEGAL_ENC_SETTING = 0x806122b8, + CELL_ADEC_ERROR_ATX_ILLEGAL_DEC_SETTING = 0x806122b9, + CELL_ADEC_ERROR_ATX_ASSERT_NSAMPLES = 0x806122ba, + CELL_ADEC_ERROR_ATX_ILL_SYNCWORD = 0x806122bb, + CELL_ADEC_ERROR_ATX_ILL_SAMPLING_FREQ = 0x806122bc, + CELL_ADEC_ERROR_ATX_ILL_CH_CONFIG_INDEX = 0x806122bd, + CELL_ADEC_ERROR_ATX_RAW_DATA_FRAME_SIZE_OVER = 0x806122be, CELL_ADEC_ERROR_ATX_SYNTAX_ENHANCE_LENGTH_OVER = 0x806122bf, - CELL_ADEC_ERROR_ATX_SPU_INTERNAL_FAIL = 0x806122c8, + CELL_ADEC_ERROR_ATX_SPU_INTERNAL_FAIL = 0x806122c8, }; enum : u32 @@ -199,7 +199,7 @@ struct AtracXdecDecoder u8 spurs_stuff[84]; // 120 bytes on LLE, pointers to CellSpurs, CellSpursTaskset, etc. - be_t spurs_task_id; // CellSpursTaskId + be_t spurs_task_id; // CellSpursTaskId AtracXdecDecoder(vm::ptr work_mem) : work_mem(work_mem) {} @@ -266,12 +266,7 @@ struct AtracXdecContext AtracXdecContext(vm::ptr notifyAuDone, vm::ptr notifyAuDoneArg, vm::ptr notifyPcmOut, vm::ptr notifyPcmOutArg, vm::ptr notifyError, vm::ptr notifyErrorArg, vm::ptr notifySeqDone, vm::ptr notifySeqDoneArg, vm::bptr work_mem) - : notify_au_done{ notifyAuDone, notifyAuDoneArg } - , notify_pcm_out{ notifyPcmOut, notifyPcmOutArg } - , notify_error{ notifyError, notifyErrorArg } - , notify_seq_done{ notifySeqDone, notifySeqDoneArg } - , work_mem(work_mem) - , decoder(work_mem) + : notify_au_done{notifyAuDone, notifyAuDoneArg}, notify_pcm_out{notifyPcmOut, notifyPcmOutArg}, notify_error{notifyError, notifyErrorArg}, notify_seq_done{notifySeqDone, notifySeqDoneArg}, work_mem(work_mem), decoder(work_mem) { } @@ -287,7 +282,7 @@ CHECK_SIZE_ALIGN(AtracXdecContext, 0x268, 8); constexpr u32 ATXDEC_SPURS_STRUCTS_SIZE = 0x1cf00; // CellSpurs, CellSpursTaskset, context, etc. constexpr u16 ATXDEC_SAMPLES_PER_FRAME = 0x800; constexpr u16 ATXDEC_MAX_FRAME_LENGTH = 0x2000; -constexpr std::array ATXDEC_NCH_BLOCKS_MAP = { 0, 1, 1, 2, 3, 4, 5, 5 }; +constexpr std::array ATXDEC_NCH_BLOCKS_MAP = {0, 1, 1, 2, 3, 4, 5, 5}; // Expected output channel order // - for 1 to 7 channels: Front Left, Center, Front Right, Rear Left, Rear Right, Rear Center, LFE @@ -296,18 +291,18 @@ constexpr std::array ATXDEC_NCH_BLOCKS_MAP = { 0, 1, 1, 2, 3, 4, 5, 5 }; // - ver <= 5.1.2: Front Left, Front Right, Center, Rear Left, Rear Right, Rear Center, Side Left, Side Right, LFE // - ver >= 5.1.3: Front Left, Front Right, Center, LFE, Rear Left, Rear Right, Rear Center, Side Left, Side Right constexpr u8 ATXDEC_AVCODEC_CH_MAP[7][8] = -{ - { 0 }, - { 0, 1 }, - { 0, 2, 1 }, - { 0, 2, 1, 3 }, + { + {0}, + {0, 1}, + {0, 2, 1}, + {0, 2, 1, 3}, #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59, 51, 101) - { 0, 2, 1, 3, 4, 5 }, - { 0, 2, 1, 3, 4, 5, 6 }, - { 0, 1, 2, 4, 5, 6, 7, 3 } + {0, 2, 1, 3, 4, 5}, + {0, 2, 1, 3, 4, 5, 6}, + {0, 1, 2, 4, 5, 6, 7, 3} #else - { 0, 2, 1, 4, 5, 3 }, - { 0, 2, 1, 4, 5, 6, 3 }, - { 0, 1, 2, 3, 4, 5, 6, 7 } + {0, 2, 1, 4, 5, 3}, + {0, 2, 1, 4, 5, 6, 3}, + {0, 1, 2, 3, 4, 5, 6, 7} #endif }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAudio.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellAudio.cpp index 379c17f11..0203cb6b0 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAudio.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAudio.cpp @@ -31,31 +31,30 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellAudioError value) - { - switch (value) { - STR_CASE(CELL_AUDIO_ERROR_ALREADY_INIT); - STR_CASE(CELL_AUDIO_ERROR_AUDIOSYSTEM); - STR_CASE(CELL_AUDIO_ERROR_NOT_INIT); - STR_CASE(CELL_AUDIO_ERROR_PARAM); - STR_CASE(CELL_AUDIO_ERROR_PORT_FULL); - STR_CASE(CELL_AUDIO_ERROR_PORT_ALREADY_RUN); - STR_CASE(CELL_AUDIO_ERROR_PORT_NOT_OPEN); - STR_CASE(CELL_AUDIO_ERROR_PORT_NOT_RUN); - STR_CASE(CELL_AUDIO_ERROR_TRANS_EVENT); - STR_CASE(CELL_AUDIO_ERROR_PORT_OPEN); - STR_CASE(CELL_AUDIO_ERROR_SHAREDMEMORY); - STR_CASE(CELL_AUDIO_ERROR_MUTEX); - STR_CASE(CELL_AUDIO_ERROR_EVENT_QUEUE); - STR_CASE(CELL_AUDIO_ERROR_AUDIOSYSTEM_NOT_FOUND); - STR_CASE(CELL_AUDIO_ERROR_TAG_NOT_FOUND); - } + switch (value) + { + STR_CASE(CELL_AUDIO_ERROR_ALREADY_INIT); + STR_CASE(CELL_AUDIO_ERROR_AUDIOSYSTEM); + STR_CASE(CELL_AUDIO_ERROR_NOT_INIT); + STR_CASE(CELL_AUDIO_ERROR_PARAM); + STR_CASE(CELL_AUDIO_ERROR_PORT_FULL); + STR_CASE(CELL_AUDIO_ERROR_PORT_ALREADY_RUN); + STR_CASE(CELL_AUDIO_ERROR_PORT_NOT_OPEN); + STR_CASE(CELL_AUDIO_ERROR_PORT_NOT_RUN); + STR_CASE(CELL_AUDIO_ERROR_TRANS_EVENT); + STR_CASE(CELL_AUDIO_ERROR_PORT_OPEN); + STR_CASE(CELL_AUDIO_ERROR_SHAREDMEMORY); + STR_CASE(CELL_AUDIO_ERROR_MUTEX); + STR_CASE(CELL_AUDIO_ERROR_EVENT_QUEUE); + STR_CASE(CELL_AUDIO_ERROR_AUDIOSYSTEM_NOT_FOUND); + STR_CASE(CELL_AUDIO_ERROR_TAG_NOT_FOUND); + } - return unknown; - }); + return unknown; + }); } - cell_audio_config::cell_audio_config() { raw = audio::get_raw_config(); @@ -132,9 +131,7 @@ void cell_audio_config::reset(bool backend_changed) } audio_ringbuffer::audio_ringbuffer(cell_audio_config& _cfg) - : backend(_cfg.backend) - , cfg(_cfg) - , buf_sz(AUDIO_BUFFER_SAMPLES * _cfg.audio_channels) + : backend(_cfg.backend), cfg(_cfg), buf_sz(AUDIO_BUFFER_SAMPLES * _cfg.audio_channels) { // Initialize buffers if (cfg.num_allocated_buffers > MAX_AUDIO_BUFFERS) @@ -196,9 +193,10 @@ float* audio_ringbuffer::get_buffer(u32 num) const return buffer[num].get(); } -u32 audio_ringbuffer::backend_write_callback(u32 size, void *buf) +u32 audio_ringbuffer::backend_write_callback(u32 size, void* buf) { - if (!backend_active.observe()) backend_active = true; + if (!backend_active.observe()) + backend_active = true; return static_cast(cb_ringbuf.pop(buf, size, true)); } @@ -283,7 +281,8 @@ void audio_ringbuffer::enqueue_silence(u32 buf_count, bool force) void audio_ringbuffer::process_resampled_data() { - if (!cfg.time_stretching_enabled) return; + if (!cfg.time_stretching_enabled) + return; const auto& [buffer, samples] = resampler.get_samples(static_cast(cb_ringbuf.get_free_size() / (cfg.audio_sample_size * cfg.backend_ch_cnt))); commit_data(buffer, samples); @@ -443,7 +442,8 @@ std::tuple cell_audio_thread::count_port_buffer_tags() for (audio_port& port : ports) { - if (port.state != audio_port_state::started) continue; + if (port.state != audio_port_state::started) + continue; active++; auto port_buf = port.get_vm_ptr(); @@ -514,7 +514,8 @@ void cell_audio_thread::reset_ports(s32 offset) // Memset buffer to 0 and tag for (audio_port& port : ports) { - if (port.state != audio_port_state::started) continue; + if (port.state != audio_port_state::started) + continue; memset(port.get_vm_ptr(offset), 0, port.block_size() * sizeof(float)); @@ -536,7 +537,8 @@ void cell_audio_thread::advance(u64 timestamp) for (audio_port& port : ports) { - if (port.state != audio_port_state::started) continue; + if (port.state != audio_port_state::started) + continue; port.global_counter = m_counter; port.active_counter++; @@ -610,8 +612,7 @@ namespace audio { cell_audio_config::raw_config get_raw_config() { - return - { + return { .audio_device = g_cfg.audio.audio_device, .buffering_enabled = static_cast(g_cfg.audio.enable_buffering), .desired_buffer_duration = g_cfg.audio.desired_buffer_duration, @@ -621,8 +622,7 @@ namespace audio .dump_to_file = static_cast(g_cfg.audio.dump_to_file), .channel_layout = g_cfg.audio.channel_layout, .renderer = g_cfg.audio.renderer, - .provider = g_cfg.audio.provider - }; + .provider = g_cfg.audio.provider}; } void configure_audio(bool force_reset) @@ -654,7 +654,7 @@ namespace audio } } } -} +} // namespace audio void cell_audio_thread::update_config(bool backend_changed) { @@ -827,9 +827,9 @@ void cell_audio_thread::operator()() const auto tag_info = count_port_buffer_tags(); const u32 active_ports = std::get<0>(tag_info); - const u32 in_progress = std::get<1>(tag_info); - const u32 untouched = std::get<2>(tag_info); - const u32 incomplete = std::get<3>(tag_info); + const u32 in_progress = std::get<1>(tag_info); + const u32 untouched = std::get<2>(tag_info); + const u32 incomplete = std::get<3>(tag_info); // Ratio between the rolling average of the audio period, and the desired audio period const f32 average_playtime_ratio = m_average_playtime / cfg.audio_buffer_length; @@ -903,15 +903,14 @@ void cell_audio_thread::operator()() } // Wait until buffers have been touched - //cellAudio.error("active=%u, in_progress=%u, untouched=%u, incomplete=%u", active_ports, in_progress, untouched, incomplete); + // cellAudio.error("active=%u, in_progress=%u, untouched=%u, incomplete=%u", active_ports, in_progress, untouched, incomplete); if (untouched > untouched_expected) { // Games may sometimes "skip" audio periods entirely if they're falling behind (a sort of "frameskip" for audio) // As such, if the game doesn't touch buffers for too long we advance time hoping the game recovers if ( (untouched == active_ports && time_since_last_period > cfg.fully_untouched_timeout) || - (time_since_last_period > cfg.partially_untouched_timeout) || g_cfg.audio.disable_sampling_skip - ) + (time_since_last_period > cfg.partially_untouched_timeout) || g_cfg.audio.disable_sampling_skip) { // There's no audio in the buffers, simply advance time and hope the game recovers cellAudio.trace("advancing time: untouched=%u/%u (expected=%u), enqueued_buffers=%llu", untouched, active_ports, untouched_expected, enqueued_buffers); @@ -944,7 +943,7 @@ void cell_audio_thread::operator()() continue; } - //cellAudio.error("active=%u, untouched=%u, in_progress=%d, incomplete=%d, enqueued_buffers=%u", active_ports, untouched, in_progress, incomplete, enqueued_buffers); + // cellAudio.error("active=%u, untouched=%u, in_progress=%d, incomplete=%d, enqueued_buffers=%u", active_ports, untouched, in_progress, incomplete, enqueued_buffers); // Store number of untouched buffers for future reference untouched_expected = untouched; @@ -1050,7 +1049,8 @@ void cell_audio_thread::mix(float* out_buffer, s32 offset) // mixing for (audio_port& port : ports) { - if (port.state != audio_port_state::started) continue; + if (port.state != audio_port_state::started) + continue; auto buf = port.get_vm_ptr(offset); @@ -1071,7 +1071,7 @@ void cell_audio_thread::mix(float* out_buffer, s32 offset) if ((!dec && param.value - port.level <= 0.0f) || (dec && param.value - port.level >= 0.0f)) { port.level = param.value; - port.level_set.compare_and_swap(param, { param.value, 0.0f }); + port.level_set.compare_and_swap(param, {param.value, 0.0f}); } } @@ -1084,7 +1084,7 @@ void cell_audio_thread::mix(float* out_buffer, s32 offset) { step_volume(port); - const float left = buf[in + 0] * m; + const float left = buf[in + 0] * m; const float right = buf[in + 1] * m; out_buffer[out + 0] += left; @@ -1097,13 +1097,13 @@ void cell_audio_thread::mix(float* out_buffer, s32 offset) { step_volume(port); - const float left = buf[in + 0] * m; - const float right = buf[in + 1] * m; - const float center = buf[in + 2] * m; - const float low_freq = buf[in + 3] * m; - const float side_left = buf[in + 4] * m; + const float left = buf[in + 0] * m; + const float right = buf[in + 1] * m; + const float center = buf[in + 2] * m; + const float low_freq = buf[in + 3] * m; + const float side_left = buf[in + 4] * m; const float side_right = buf[in + 5] * m; - const float rear_left = buf[in + 6] * m; + const float rear_left = buf[in + 6] * m; const float rear_right = buf[in + 7] * m; if constexpr (downmix == AudioChannelCnt::STEREO) @@ -1173,11 +1173,12 @@ void cell_audio_thread::finish_port_volume_stepping() // part of cellAudioSetPortLevel functionality for (audio_port& port : ports) { - if (port.state != audio_port_state::started) continue; + if (port.state != audio_port_state::started) + continue; const audio_port::level_set_t param = port.level_set.load(); port.level = param.value; - port.level_set.compare_and_swap(param, { param.value, 0.0f }); + port.level_set.compare_and_swap(param, {param.value, 0.0f}); } } @@ -1200,9 +1201,9 @@ error_code cellAudioInit() for (u32 i = 0; i < AUDIO_PORT_COUNT; i++) { g_audio.ports[i].number = i; - g_audio.ports[i].addr = g_audio_buffer + AUDIO_PORT_OFFSET * i; - g_audio.ports[i].index = (g_audio_indices + i).ptr(&aligned_index_t::index); - g_audio.ports[i].state = audio_port_state::closed; + g_audio.ports[i].addr = g_audio_buffer + AUDIO_PORT_OFFSET * i; + g_audio.ports[i].index = (g_audio_indices + i).ptr(&aligned_index_t::index); + g_audio.ports[i].state = audio_port_state::closed; } g_audio.init = 1; @@ -1319,16 +1320,16 @@ error_code cellAudioPortOpen(vm::ptr audioParam, vm::ptr(1, num_channels); + // const u64 num_channels_non_0 = std::max(1, num_channels); - port->num_channels = ::narrow(num_channels); - port->num_blocks = ::narrow(num_blocks); - port->attr = attr; - port->size = ::narrow(num_channels * num_blocks * AUDIO_BUFFER_SAMPLES * sizeof(f32)); - port->cur_pos = 0; + port->num_channels = ::narrow(num_channels); + port->num_blocks = ::narrow(num_blocks); + port->attr = attr; + port->size = ::narrow(num_channels * num_blocks * AUDIO_BUFFER_SAMPLES * sizeof(f32)); + port->cur_pos = 0; port->global_counter = g_audio.m_counter; port->active_counter = 0; - port->timestamp = get_guest_system_time(g_audio.m_last_period_end); + port->timestamp = get_guest_system_time(g_audio.m_last_period_end); if (attr & CELL_AUDIO_PORTATTR_INITLEVEL) { @@ -1339,7 +1340,7 @@ error_code cellAudioPortOpen(vm::ptr audioParam, vm::ptrlevel = 1.0f; } - port->level_set.store({ port->level, 0.0f }); + port->level_set.store({port->level, 0.0f}); if (port->level <= -1.0f) { @@ -1389,7 +1390,7 @@ error_code cellAudioGetPortConfig(u32 portNum, vm::ptr port } portConfig->nChannel = port.num_channels; - portConfig->nBlock = port.num_blocks; + portConfig->nBlock = port.num_blocks; portConfig->portSize = port.size; portConfig->portAddr = port.addr.addr(); return CELL_OK; @@ -1586,7 +1587,7 @@ error_code cellAudioSetPortLevel(u32 portNum, float level) if (level >= 0.0f) { - port.level_set.exchange({ level, (port.level - level) / 624.0f }); + port.level_set.exchange({level, (port.level - level) / 624.0f}); } else { @@ -1600,7 +1601,7 @@ static error_code AudioCreateNotifyEventQueue(ppu_thread& ppu, vm::ptr id, { vm::var attr; attr->protocol = SYS_SYNC_FIFO; - attr->type = queue_type; + attr->type = queue_type; attr->name_u64 = 0; for (u64 i = 0; i < MAX_AUDIO_EVENT_QUEUES; i++) @@ -1671,22 +1672,23 @@ error_code AudioSetNotifyEventQueue(ppu_thread& ppu, u64 key, u32 iFlags) for (usz count = 0; !lv2_event_queue::find(c_mxr000) && count < 100; count++) { if (has_sur_mixer_thread || idm::select>([&](u32 id, named_thread& test_ppu) - { - // Confirm thread existence - if (id == ppu.id) - { - return false; - } + { + // Confirm thread existence + if (id == ppu.id) + { + return false; + } - const auto ptr = test_ppu.ppu_tname.load(); + const auto ptr = test_ppu.ppu_tname.load(); - if (!ptr) - { - return false; - } + if (!ptr) + { + return false; + } - return *ptr == "_cellsurMixerMain"sv; - }).ret) + return *ptr == "_cellsurMixerMain"sv; + }) + .ret) { has_sur_mixer_thread = true; } @@ -1745,14 +1747,11 @@ error_code AudioSetNotifyEventQueue(ppu_thread& ppu, u64 key, u32 iFlags) } // Set unique source associated with the key - g_audio.keys.push_back - ({ - .start_period = g_audio.event_period, + g_audio.keys.push_back({.start_period = g_audio.event_period, .flags = iFlags, .source = ((process_getpid() + u64{}) << 32) + lv2_event_port::id_base + (g_audio.key_count++ * lv2_event_port::id_step), .ack_timestamp = 0, - .port = std::move(q) - }); + .port = std::move(q)}); g_audio.key_count %= lv2_event_port::id_count; @@ -1904,12 +1903,12 @@ error_code cellAudioAdd2chData(u32 portNum, vm::ptr src, u32 samples, flo { dst[i * 8 + 0] += src[i * 2 + 0] * volume; // mix L ch dst[i * 8 + 1] += src[i * 2 + 1] * volume; // mix R ch - //dst[i * 8 + 2] += 0.0f; // center - //dst[i * 8 + 3] += 0.0f; // LFE - //dst[i * 8 + 4] += 0.0f; // rear L - //dst[i * 8 + 5] += 0.0f; // rear R - //dst[i * 8 + 6] += 0.0f; // side L - //dst[i * 8 + 7] += 0.0f; // side R + // dst[i * 8 + 2] += 0.0f; // center + // dst[i * 8 + 3] += 0.0f; // LFE + // dst[i * 8 + 4] += 0.0f; // rear L + // dst[i * 8 + 5] += 0.0f; // rear R + // dst[i * 8 + 6] += 0.0f; // side L + // dst[i * 8 + 7] += 0.0f; // side R } } else @@ -1957,8 +1956,8 @@ error_code cellAudioAdd6chData(u32 portNum, vm::ptr src, float volume) dst[i * 8 + 3] += src[i * 6 + 5] * volume; // mix LFE dst[i * 8 + 4] += src[i * 6 + 3] * volume; // mix rear L dst[i * 8 + 5] += src[i * 6 + 4] * volume; // mix rear R - //dst[i * 8 + 6] += 0.0f; // side L - //dst[i * 8 + 7] += 0.0f; // side R + // dst[i * 8 + 6] += 0.0f; // side L + // dst[i * 8 + 7] += 0.0f; // side R } } else @@ -2062,32 +2061,32 @@ error_code cellAudioUnsetPersonalDevice(s32 iPersonalStream) } DECLARE(ppu_module_manager::cellAudio)("cellAudio", []() -{ - // Private variables - REG_VAR(cellAudio, g_audio_buffer).flag(MFF_HIDDEN); - REG_VAR(cellAudio, g_audio_indices).flag(MFF_HIDDEN); + { + // Private variables + REG_VAR(cellAudio, g_audio_buffer).flag(MFF_HIDDEN); + REG_VAR(cellAudio, g_audio_indices).flag(MFF_HIDDEN); - REG_FUNC(cellAudio, cellAudioInit); - REG_FUNC(cellAudio, cellAudioPortClose); - REG_FUNC(cellAudio, cellAudioPortStop); - REG_FUNC(cellAudio, cellAudioGetPortConfig); - REG_FUNC(cellAudio, cellAudioPortStart); - REG_FUNC(cellAudio, cellAudioQuit); - REG_FUNC(cellAudio, cellAudioPortOpen); - REG_FUNC(cellAudio, cellAudioSetPortLevel); - REG_FUNC(cellAudio, cellAudioCreateNotifyEventQueue); - REG_FUNC(cellAudio, cellAudioCreateNotifyEventQueueEx); - REG_FUNC(cellAudio, cellAudioMiscSetAccessoryVolume); - REG_FUNC(cellAudio, cellAudioSetNotifyEventQueue); - REG_FUNC(cellAudio, cellAudioSetNotifyEventQueueEx); - REG_FUNC(cellAudio, cellAudioGetPortTimestamp); - REG_FUNC(cellAudio, cellAudioAdd2chData); - REG_FUNC(cellAudio, cellAudioAdd6chData); - REG_FUNC(cellAudio, cellAudioAddData); - REG_FUNC(cellAudio, cellAudioGetPortBlockTag); - REG_FUNC(cellAudio, cellAudioRemoveNotifyEventQueue); - REG_FUNC(cellAudio, cellAudioRemoveNotifyEventQueueEx); - REG_FUNC(cellAudio, cellAudioSendAck); - REG_FUNC(cellAudio, cellAudioSetPersonalDevice); - REG_FUNC(cellAudio, cellAudioUnsetPersonalDevice); -}); + REG_FUNC(cellAudio, cellAudioInit); + REG_FUNC(cellAudio, cellAudioPortClose); + REG_FUNC(cellAudio, cellAudioPortStop); + REG_FUNC(cellAudio, cellAudioGetPortConfig); + REG_FUNC(cellAudio, cellAudioPortStart); + REG_FUNC(cellAudio, cellAudioQuit); + REG_FUNC(cellAudio, cellAudioPortOpen); + REG_FUNC(cellAudio, cellAudioSetPortLevel); + REG_FUNC(cellAudio, cellAudioCreateNotifyEventQueue); + REG_FUNC(cellAudio, cellAudioCreateNotifyEventQueueEx); + REG_FUNC(cellAudio, cellAudioMiscSetAccessoryVolume); + REG_FUNC(cellAudio, cellAudioSetNotifyEventQueue); + REG_FUNC(cellAudio, cellAudioSetNotifyEventQueueEx); + REG_FUNC(cellAudio, cellAudioGetPortTimestamp); + REG_FUNC(cellAudio, cellAudioAdd2chData); + REG_FUNC(cellAudio, cellAudioAdd6chData); + REG_FUNC(cellAudio, cellAudioAddData); + REG_FUNC(cellAudio, cellAudioGetPortBlockTag); + REG_FUNC(cellAudio, cellAudioRemoveNotifyEventQueue); + REG_FUNC(cellAudio, cellAudioRemoveNotifyEventQueueEx); + REG_FUNC(cellAudio, cellAudioSendAck); + REG_FUNC(cellAudio, cellAudioSetPersonalDevice); + REG_FUNC(cellAudio, cellAudioUnsetPersonalDevice); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAudio.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellAudio.h index a88ac6eda..04e7a2dd5 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAudio.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAudio.h @@ -14,64 +14,64 @@ struct lv2_event_queue; // Error codes enum CellAudioError : u32 { - CELL_AUDIO_ERROR_ALREADY_INIT = 0x80310701, - CELL_AUDIO_ERROR_AUDIOSYSTEM = 0x80310702, - CELL_AUDIO_ERROR_NOT_INIT = 0x80310703, - CELL_AUDIO_ERROR_PARAM = 0x80310704, - CELL_AUDIO_ERROR_PORT_FULL = 0x80310705, - CELL_AUDIO_ERROR_PORT_ALREADY_RUN = 0x80310706, - CELL_AUDIO_ERROR_PORT_NOT_OPEN = 0x80310707, - CELL_AUDIO_ERROR_PORT_NOT_RUN = 0x80310708, - CELL_AUDIO_ERROR_TRANS_EVENT = 0x80310709, - CELL_AUDIO_ERROR_PORT_OPEN = 0x8031070a, - CELL_AUDIO_ERROR_SHAREDMEMORY = 0x8031070b, - CELL_AUDIO_ERROR_MUTEX = 0x8031070c, - CELL_AUDIO_ERROR_EVENT_QUEUE = 0x8031070d, - CELL_AUDIO_ERROR_AUDIOSYSTEM_NOT_FOUND = 0x8031070e, - CELL_AUDIO_ERROR_TAG_NOT_FOUND = 0x8031070f, + CELL_AUDIO_ERROR_ALREADY_INIT = 0x80310701, + CELL_AUDIO_ERROR_AUDIOSYSTEM = 0x80310702, + CELL_AUDIO_ERROR_NOT_INIT = 0x80310703, + CELL_AUDIO_ERROR_PARAM = 0x80310704, + CELL_AUDIO_ERROR_PORT_FULL = 0x80310705, + CELL_AUDIO_ERROR_PORT_ALREADY_RUN = 0x80310706, + CELL_AUDIO_ERROR_PORT_NOT_OPEN = 0x80310707, + CELL_AUDIO_ERROR_PORT_NOT_RUN = 0x80310708, + CELL_AUDIO_ERROR_TRANS_EVENT = 0x80310709, + CELL_AUDIO_ERROR_PORT_OPEN = 0x8031070a, + CELL_AUDIO_ERROR_SHAREDMEMORY = 0x8031070b, + CELL_AUDIO_ERROR_MUTEX = 0x8031070c, + CELL_AUDIO_ERROR_EVENT_QUEUE = 0x8031070d, + CELL_AUDIO_ERROR_AUDIOSYSTEM_NOT_FOUND = 0x8031070e, + CELL_AUDIO_ERROR_TAG_NOT_FOUND = 0x8031070f, }; // constants enum { - CELL_AUDIO_BLOCK_8 = 8, - CELL_AUDIO_BLOCK_16 = 16, - CELL_AUDIO_BLOCK_32 = 32, - CELL_AUDIO_BLOCK_SAMPLES = 256, + CELL_AUDIO_BLOCK_8 = 8, + CELL_AUDIO_BLOCK_16 = 16, + CELL_AUDIO_BLOCK_32 = 32, + CELL_AUDIO_BLOCK_SAMPLES = 256, - CELL_AUDIO_CREATEEVENTFLAG_SPU = 0x00000001, + CELL_AUDIO_CREATEEVENTFLAG_SPU = 0x00000001, - CELL_AUDIO_EVENT_MIX = 0, - CELL_AUDIO_EVENT_HEADPHONE = 1, + CELL_AUDIO_EVENT_MIX = 0, + CELL_AUDIO_EVENT_HEADPHONE = 1, - CELL_AUDIO_EVENTFLAG_BEFOREMIX = 0x80000000, - CELL_AUDIO_EVENTFLAG_DECIMATE_2 = 0x08000000, - CELL_AUDIO_EVENTFLAG_DECIMATE_4 = 0x10000000, - CELL_AUDIO_EVENTFLAG_HEADPHONE = 0x20000000, - CELL_AUDIO_EVENTFLAG_NOMIX = 0x40000000, + CELL_AUDIO_EVENTFLAG_BEFOREMIX = 0x80000000, + CELL_AUDIO_EVENTFLAG_DECIMATE_2 = 0x08000000, + CELL_AUDIO_EVENTFLAG_DECIMATE_4 = 0x10000000, + CELL_AUDIO_EVENTFLAG_HEADPHONE = 0x20000000, + CELL_AUDIO_EVENTFLAG_NOMIX = 0x40000000, - CELL_AUDIO_MAX_PORT = 4, - CELL_AUDIO_MAX_PORT_2 = 8, + CELL_AUDIO_MAX_PORT = 4, + CELL_AUDIO_MAX_PORT_2 = 8, - CELL_AUDIO_MISC_ACCVOL_ALLDEVICE = 0x0000ffffUL, + CELL_AUDIO_MISC_ACCVOL_ALLDEVICE = 0x0000ffffUL, CELL_AUDIO_PERSONAL_DEVICE_PRIMARY = 0x8000, - CELL_AUDIO_PORT_2CH = 2, - CELL_AUDIO_PORT_8CH = 8, + CELL_AUDIO_PORT_2CH = 2, + CELL_AUDIO_PORT_8CH = 8, - CELL_AUDIO_PORTATTR_BGM = 0x0000000000000010ULL, - CELL_AUDIO_PORTATTR_INITLEVEL = 0x0000000000001000ULL, - CELL_AUDIO_PORTATTR_OUT_NO_ROUTE = 0x0000000000100000ULL, + CELL_AUDIO_PORTATTR_BGM = 0x0000000000000010ULL, + CELL_AUDIO_PORTATTR_INITLEVEL = 0x0000000000001000ULL, + CELL_AUDIO_PORTATTR_OUT_NO_ROUTE = 0x0000000000100000ULL, CELL_AUDIO_PORTATTR_OUT_PERSONAL_0 = 0x0000000001000000ULL, CELL_AUDIO_PORTATTR_OUT_PERSONAL_1 = 0x0000000002000000ULL, CELL_AUDIO_PORTATTR_OUT_PERSONAL_2 = 0x0000000004000000ULL, CELL_AUDIO_PORTATTR_OUT_PERSONAL_3 = 0x0000000008000000ULL, - CELL_AUDIO_PORTATTR_OUT_SECONDARY = 0x0000000000000001ULL, - CELL_AUDIO_PORTATTR_OUT_STREAM1 = 0x0000000000000001ULL, + CELL_AUDIO_PORTATTR_OUT_SECONDARY = 0x0000000000000001ULL, + CELL_AUDIO_PORTATTR_OUT_STREAM1 = 0x0000000000000001ULL, - CELL_AUDIO_STATUS_CLOSE = 0x1010, - CELL_AUDIO_STATUS_READY = 1, - CELL_AUDIO_STATUS_RUN = 2, + CELL_AUDIO_STATUS_CLOSE = 0x1010, + CELL_AUDIO_STATUS_READY = 1, + CELL_AUDIO_STATUS_RUN = 2, }; enum class audio_backend_update : u32 @@ -81,7 +81,7 @@ enum class audio_backend_update : u32 ALL, }; -//libaudio datatypes +// libaudio datatypes struct CellAudioPortParam { be_t nChannel{}; @@ -183,10 +183,9 @@ struct audio_port return vm::_ptr(buf_addr(offset)); } - // Tags u32 prev_touched_tag_nr = 0; - f32 last_tag_value[PORT_BUFFER_TAG_COUNT] = { 0 }; + f32 last_tag_value[PORT_BUFFER_TAG_COUNT] = {0}; void tag(s32 offset = 0); @@ -258,7 +257,7 @@ struct cell_audio_config static constexpr s64 period_comparison_margin = 5; #endif - u64 fully_untouched_timeout = 0; // timeout if the game has not touched any audio buffer yet + u64 fully_untouched_timeout = 0; // timeout if the game has not touched any audio buffer yet u64 partially_untouched_timeout = 0; // timeout if the game has not touched all audio buffers yet /* @@ -268,7 +267,7 @@ struct cell_audio_config // We need to be able to set a dynamic frequency ratio to be able to do time stretching bool time_stretching_enabled = false; - f32 time_stretching_threshold = 0.0f; // we only apply time stretching below this buffer fill rate (adjusted for average period) + f32 time_stretching_threshold = 0.0f; // we only apply time stretching below this buffer fill rate (adjusted for average period) static constexpr f32 time_stretching_step = 0.1f; // will only reduce/increase the frequency ratio in steps of at least this value /* @@ -317,11 +316,11 @@ private: } void commit_data(f32* buf, u32 sample_cnt); - u32 backend_write_callback(u32 size, void *buf); + u32 backend_write_callback(u32 size, void* buf); void backend_state_callback(AudioStateEvent event); public: - audio_ringbuffer(cell_audio_config &cfg); + audio_ringbuffer(cell_audio_config& cfg); ~audio_ringbuffer(); void play(); @@ -365,7 +364,6 @@ public: } }; - class cell_audio_thread { private: @@ -396,10 +394,10 @@ public: struct key_info { - u8 start_period = 0; // Starting event_period - u32 flags = 0; // iFlags - u64 source = 0; // Event source - u64 ack_timestamp = 0; // timestamp of last call of cellAudioSendAck + u8 start_period = 0; // Starting event_period + u32 flags = 0; // iFlags + u64 source = 0; // Event source + u64 ack_timestamp = 0; // timestamp of last call of cellAudioSendAck shared_ptr port{}; // Underlying event port }; @@ -433,4 +431,4 @@ namespace audio { cell_audio_config::raw_config get_raw_config(); extern void configure_audio(bool force_reset = false); -} +} // namespace audio diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAudioIn.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellAudioIn.h index dc2ca6d13..b49b3de6e 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAudioIn.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAudioIn.h @@ -5,34 +5,34 @@ // Error codes enum CellAudioInError : u32 { - 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_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_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, + CELL_AUDIO_IN_ERROR_CONDITION_BUSY = 0x8002b267, }; enum CellAudioInDeviceMode { - CELL_AUDIO_IN_SINGLE_DEVICE_MODE = 0, - CELL_AUDIO_IN_MULTI_DEVICE_MODE = 1, - CELL_AUDIO_IN_MULTI_DEVICE_MODE_2 = 2, + CELL_AUDIO_IN_SINGLE_DEVICE_MODE = 0, + CELL_AUDIO_IN_MULTI_DEVICE_MODE = 1, + CELL_AUDIO_IN_MULTI_DEVICE_MODE_2 = 2, CELL_AUDIO_IN_MULTI_DEVICE_MODE_10 = 10, }; enum CellAudioInPortType { - CELL_AUDIO_IN_PORT_USB = 3, + 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, + CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE = 1, }; enum CellAudioInCodingType @@ -43,19 +43,19 @@ enum CellAudioInCodingType enum CellAudioInChnum { CELL_AUDIO_IN_CHNUM_NONE = 0, - CELL_AUDIO_IN_CHNUM_1 = 1, - CELL_AUDIO_IN_CHNUM_2 = 2, + 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, + 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 CellAudioInSoundMode diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp index 28888fcd0..23519a54e 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp @@ -11,25 +11,25 @@ LOG_CHANNEL(cellSysutil); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_AUDIO_OUT_ERROR_NOT_IMPLEMENTED); - STR_CASE(CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION); - STR_CASE(CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER); - STR_CASE(CELL_AUDIO_OUT_ERROR_PARAMETER_OUT_OF_RANGE); - STR_CASE(CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND); - STR_CASE(CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT); - STR_CASE(CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE); - STR_CASE(CELL_AUDIO_OUT_ERROR_CONDITION_BUSY); - } + switch (error) + { + STR_CASE(CELL_AUDIO_OUT_ERROR_NOT_IMPLEMENTED); + STR_CASE(CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION); + STR_CASE(CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER); + STR_CASE(CELL_AUDIO_OUT_ERROR_PARAMETER_OUT_OF_RANGE); + STR_CASE(CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND); + STR_CASE(CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT); + STR_CASE(CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE); + STR_CASE(CELL_AUDIO_OUT_ERROR_CONDITION_BUSY); + } - return unknown; - }); + return unknown; + }); } audio_out_configuration::audio_out_configuration() @@ -43,17 +43,22 @@ audio_out_configuration::audio_out_configuration() const psf::registry sfo = psf::load_object(Emu.GetSfoDir(true) + "/PARAM.SFO"); const s32 sound_format = psf::get_integer(sfo, "SOUND_FORMAT", psf::sound_format_flag::lpcm_2); // Default to Linear PCM 2 Ch. - const bool supports_lpcm_2 = (sound_format & psf::sound_format_flag::lpcm_2); // Linear PCM 2 Ch. + const bool supports_lpcm_2 = (sound_format & psf::sound_format_flag::lpcm_2); // Linear PCM 2 Ch. const bool supports_lpcm_5_1 = (sound_format & psf::sound_format_flag::lpcm_5_1); // Linear PCM 5.1 Ch. const bool supports_lpcm_7_1 = (sound_format & psf::sound_format_flag::lpcm_7_1); // Linear PCM 7.1 Ch. - const bool supports_ac3 = (sound_format & psf::sound_format_flag::ac3); // Dolby Digital 5.1 Ch. - const bool supports_dts = (sound_format & psf::sound_format_flag::dts); // DTS 5.1 Ch. + const bool supports_ac3 = (sound_format & psf::sound_format_flag::ac3); // Dolby Digital 5.1 Ch. + const bool supports_dts = (sound_format & psf::sound_format_flag::dts); // DTS 5.1 Ch. - if (supports_lpcm_2) cellSysutil.notice("cellAudioOut: found support for Linear PCM 2 Ch."); - if (supports_lpcm_5_1) cellSysutil.notice("cellAudioOut: found support for Linear PCM 5.1 Ch."); - if (supports_lpcm_7_1) cellSysutil.notice("cellAudioOut: found support for Linear PCM 7.1 Ch."); - if (supports_ac3) cellSysutil.notice("cellAudioOut: found support for Dolby Digital 5.1 Ch."); - if (supports_dts) cellSysutil.notice("cellAudioOut: found support for DTS 5.1 Ch."); + if (supports_lpcm_2) + cellSysutil.notice("cellAudioOut: found support for Linear PCM 2 Ch."); + if (supports_lpcm_5_1) + cellSysutil.notice("cellAudioOut: found support for Linear PCM 5.1 Ch."); + if (supports_lpcm_7_1) + cellSysutil.notice("cellAudioOut: found support for Linear PCM 7.1 Ch."); + if (supports_ac3) + cellSysutil.notice("cellAudioOut: found support for Dolby Digital 5.1 Ch."); + if (supports_dts) + cellSysutil.notice("cellAudioOut: found support for DTS 5.1 Ch."); std::array initial_mode_selected = {}; @@ -73,7 +78,7 @@ audio_out_configuration::audio_out_configuration() { // Pre-select the first available sound mode output.channels = channel; - output.encoder = type; + output.encoder = type; output.sound_mode = output.sound_modes.back(); selected = true; @@ -460,8 +465,8 @@ error_code cellAudioOutGetConfiguration(u32 audioOut, vm::ptr info, vm::ptr userData); - // FXO Object struct audio_out_configuration diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAuthDialog.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellAuthDialog.cpp index d5e671835..fae19e979 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAuthDialog.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAuthDialog.cpp @@ -6,25 +6,25 @@ LOG_CHANNEL(cellSysutil); // All error codes are unknown at this point in implementation enum cellSysutilAuthDialogError : u32 { - CELL_AUTHDIALOG_UNKNOWN_201 = 0x8002D201, + CELL_AUTHDIALOG_UNKNOWN_201 = 0x8002D201, CELL_AUTHDIALOG_ARG1_IS_ZERO = 0x8002D202, - CELL_AUTHDIALOG_UNKNOWN_203 = 0x8002D203, + CELL_AUTHDIALOG_UNKNOWN_203 = 0x8002D203, }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_AUTHDIALOG_UNKNOWN_201); - STR_CASE(CELL_AUTHDIALOG_ARG1_IS_ZERO); - STR_CASE(CELL_AUTHDIALOG_UNKNOWN_203); - } + switch (error) + { + STR_CASE(CELL_AUTHDIALOG_UNKNOWN_201); + STR_CASE(CELL_AUTHDIALOG_ARG1_IS_ZERO); + STR_CASE(CELL_AUTHDIALOG_UNKNOWN_203); + } - return unknown; - }); + return unknown; + }); } // Decompilation suggests arg1 is s64 but the check is for == 0 instead of >= 0 @@ -59,8 +59,8 @@ error_code cellAuthDialogClose(/* arg1 */) } DECLARE(ppu_module_manager::cellAuthDialogUtility)("cellAuthDialogUtility", []() -{ - REG_FUNC(cellAuthDialogUtility, cellAuthDialogOpen); - REG_FUNC(cellAuthDialogUtility, cellAuthDialogAbort); - REG_FUNC(cellAuthDialogUtility, cellAuthDialogClose); -}); + { + REG_FUNC(cellAuthDialogUtility, cellAuthDialogOpen); + REG_FUNC(cellAuthDialogUtility, cellAuthDialogAbort); + REG_FUNC(cellAuthDialogUtility, cellAuthDialogClose); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp index ed0e3d752..b35b14bad 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp @@ -14,25 +14,25 @@ LOG_CHANNEL(cellAvconfExt); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_AUDIO_IN_ERROR_NOT_IMPLEMENTED); - STR_CASE(CELL_AUDIO_IN_ERROR_ILLEGAL_CONFIGURATION); - STR_CASE(CELL_AUDIO_IN_ERROR_ILLEGAL_PARAMETER); - STR_CASE(CELL_AUDIO_IN_ERROR_PARAMETER_OUT_OF_RANGE); - STR_CASE(CELL_AUDIO_IN_ERROR_DEVICE_NOT_FOUND); - STR_CASE(CELL_AUDIO_IN_ERROR_UNSUPPORTED_AUDIO_IN); - STR_CASE(CELL_AUDIO_IN_ERROR_UNSUPPORTED_SOUND_MODE); - STR_CASE(CELL_AUDIO_IN_ERROR_CONDITION_BUSY); - } + switch (error) + { + STR_CASE(CELL_AUDIO_IN_ERROR_NOT_IMPLEMENTED); + STR_CASE(CELL_AUDIO_IN_ERROR_ILLEGAL_CONFIGURATION); + STR_CASE(CELL_AUDIO_IN_ERROR_ILLEGAL_PARAMETER); + STR_CASE(CELL_AUDIO_IN_ERROR_PARAMETER_OUT_OF_RANGE); + STR_CASE(CELL_AUDIO_IN_ERROR_DEVICE_NOT_FOUND); + STR_CASE(CELL_AUDIO_IN_ERROR_UNSUPPORTED_AUDIO_IN); + STR_CASE(CELL_AUDIO_IN_ERROR_UNSUPPORTED_SOUND_MODE); + STR_CASE(CELL_AUDIO_IN_ERROR_CONDITION_BUSY); + } - return unknown; - }); + return unknown; + }); } struct avconf_manager @@ -66,15 +66,15 @@ avconf_manager::avconf_manager() { devices.emplace_back(); - devices[curindex].portType = CELL_AUDIO_IN_PORT_USB; - devices[curindex].availableModeCount = 1; - devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE; - devices[curindex].deviceId = 0xE11CC0DE + curindex; - devices[curindex].type = 0xC0DEE11C; - devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM; + devices[curindex].portType = CELL_AUDIO_IN_PORT_USB; + devices[curindex].availableModeCount = 1; + devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE; + devices[curindex].deviceId = 0xE11CC0DE + curindex; + devices[curindex].type = 0xC0DEE11C; + devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM; devices[curindex].availableModes[0].channel = CELL_AUDIO_IN_CHNUM_2; - devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ; - devices[curindex].deviceNumber = curindex; + devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ; + devices[curindex].deviceNumber = curindex; strcpy_trunc(devices[curindex].name, mic_list[index]); curindex++; @@ -85,15 +85,15 @@ avconf_manager::avconf_manager() // Only one device for singstar device devices.emplace_back(); - devices[curindex].portType = CELL_AUDIO_IN_PORT_USB; - devices[curindex].availableModeCount = 1; - devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE; - devices[curindex].deviceId = 0x00000001; - devices[curindex].type = 0x14150000; - devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM; + devices[curindex].portType = CELL_AUDIO_IN_PORT_USB; + devices[curindex].availableModeCount = 1; + devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE; + devices[curindex].deviceId = 0x00000001; + devices[curindex].type = 0x14150000; + devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM; devices[curindex].availableModes[0].channel = CELL_AUDIO_IN_CHNUM_2; - devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ; - devices[curindex].deviceNumber = curindex; + devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ; + devices[curindex].deviceNumber = curindex; strcpy_trunc(devices[curindex].name, mic_list[0]); curindex++; @@ -101,15 +101,15 @@ avconf_manager::avconf_manager() case microphone_handler::rocksmith: devices.emplace_back(); - devices[curindex].portType = CELL_AUDIO_IN_PORT_USB; - devices[curindex].availableModeCount = 1; - devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE; - devices[curindex].deviceId = 0x12BA00FF; // Specific to rocksmith usb input - devices[curindex].type = 0xC0DE73C4; - devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM; + devices[curindex].portType = CELL_AUDIO_IN_PORT_USB; + devices[curindex].availableModeCount = 1; + devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE; + devices[curindex].deviceId = 0x12BA00FF; // Specific to rocksmith usb input + devices[curindex].type = 0xC0DE73C4; + devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM; devices[curindex].availableModes[0].channel = CELL_AUDIO_IN_CHNUM_1; - devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ; - devices[curindex].deviceNumber = curindex; + devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ; + devices[curindex].deviceNumber = curindex; strcpy_trunc(devices[curindex].name, mic_list[0]); curindex++; @@ -123,15 +123,15 @@ avconf_manager::avconf_manager() { devices.emplace_back(); - devices[curindex].portType = CELL_AUDIO_IN_PORT_USB; - devices[curindex].availableModeCount = 1; - devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE; - devices[curindex].deviceId = 0xDEADBEEF; - devices[curindex].type = 0xBEEFDEAD; - devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM; + devices[curindex].portType = CELL_AUDIO_IN_PORT_USB; + devices[curindex].availableModeCount = 1; + devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE; + devices[curindex].deviceId = 0xDEADBEEF; + devices[curindex].type = 0xBEEFDEAD; + devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM; devices[curindex].availableModes[0].channel = CELL_AUDIO_IN_CHNUM_NONE; - devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ; - devices[curindex].deviceNumber = curindex; + devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ; + devices[curindex].deviceNumber = curindex; strcpy_trunc(devices[curindex].name, "USB Camera"); curindex++; @@ -223,7 +223,7 @@ error_code cellAudioInGetDeviceInfo(u32 deviceNumber, u32 deviceIndex, vm::ptr src_addr, vm::ptr dest_addr, s32 num) { cellAvconfExt.todo("cellVideoOutConvertCursorColor(videoOut=%d, displaybuffer_format=0x%x, gamma=0x%x, source_buffer_format=0x%x, src_addr=*0x%x, dest_addr=*0x%x, num=0x%x)", videoOut, - displaybuffer_format, gamma, source_buffer_format, src_addr, dest_addr, num); + displaybuffer_format, gamma, source_buffer_format, src_addr, dest_addr, num); if (!dest_addr || num == 0) { @@ -517,26 +517,26 @@ error_code cellVideoOutGetResolutionAvailability2() } DECLARE(ppu_module_manager::cellAvconfExt)("cellSysutilAvconfExt", []() -{ - REG_FUNC(cellSysutilAvconfExt, cellAudioOutUnregisterDevice); - REG_FUNC(cellSysutilAvconfExt, cellAudioOutGetDeviceInfo2); - REG_FUNC(cellSysutilAvconfExt, cellVideoOutSetXVColor); - REG_FUNC(cellSysutilAvconfExt, cellVideoOutSetupDisplay); - REG_FUNC(cellSysutilAvconfExt, cellAudioInGetDeviceInfo); - REG_FUNC(cellSysutilAvconfExt, cellVideoOutConvertCursorColor); - REG_FUNC(cellSysutilAvconfExt, cellVideoOutGetGamma); - REG_FUNC(cellSysutilAvconfExt, cellAudioInGetAvailableDeviceInfo); - REG_FUNC(cellSysutilAvconfExt, cellAudioOutGetAvailableDeviceInfo); - REG_FUNC(cellSysutilAvconfExt, cellVideoOutSetGamma); - REG_FUNC(cellSysutilAvconfExt, cellAudioOutRegisterDevice); - REG_FUNC(cellSysutilAvconfExt, cellAudioOutSetDeviceMode); - REG_FUNC(cellSysutilAvconfExt, cellAudioInSetDeviceMode); - REG_FUNC(cellSysutilAvconfExt, cellAudioInRegisterDevice); - REG_FUNC(cellSysutilAvconfExt, cellAudioInUnregisterDevice); - REG_FUNC(cellSysutilAvconfExt, cellVideoOutGetScreenSize); - REG_FUNC(cellSysutilAvconfExt, cellVideoOutSetCopyControl); - REG_FUNC(cellSysutilAvconfExt, cellVideoOutConfigure2); - REG_FUNC(cellSysutilAvconfExt, cellAudioOutGetConfiguration2); - REG_FUNC(cellSysutilAvconfExt, cellAudioOutConfigure2); - REG_FUNC(cellSysutilAvconfExt, cellVideoOutGetResolutionAvailability2); -}); + { + REG_FUNC(cellSysutilAvconfExt, cellAudioOutUnregisterDevice); + REG_FUNC(cellSysutilAvconfExt, cellAudioOutGetDeviceInfo2); + REG_FUNC(cellSysutilAvconfExt, cellVideoOutSetXVColor); + REG_FUNC(cellSysutilAvconfExt, cellVideoOutSetupDisplay); + REG_FUNC(cellSysutilAvconfExt, cellAudioInGetDeviceInfo); + REG_FUNC(cellSysutilAvconfExt, cellVideoOutConvertCursorColor); + REG_FUNC(cellSysutilAvconfExt, cellVideoOutGetGamma); + REG_FUNC(cellSysutilAvconfExt, cellAudioInGetAvailableDeviceInfo); + REG_FUNC(cellSysutilAvconfExt, cellAudioOutGetAvailableDeviceInfo); + REG_FUNC(cellSysutilAvconfExt, cellVideoOutSetGamma); + REG_FUNC(cellSysutilAvconfExt, cellAudioOutRegisterDevice); + REG_FUNC(cellSysutilAvconfExt, cellAudioOutSetDeviceMode); + REG_FUNC(cellSysutilAvconfExt, cellAudioInSetDeviceMode); + REG_FUNC(cellSysutilAvconfExt, cellAudioInRegisterDevice); + REG_FUNC(cellSysutilAvconfExt, cellAudioInUnregisterDevice); + REG_FUNC(cellSysutilAvconfExt, cellVideoOutGetScreenSize); + REG_FUNC(cellSysutilAvconfExt, cellVideoOutSetCopyControl); + REG_FUNC(cellSysutilAvconfExt, cellVideoOutConfigure2); + REG_FUNC(cellSysutilAvconfExt, cellAudioOutGetConfiguration2); + REG_FUNC(cellSysutilAvconfExt, cellAudioOutConfigure2); + REG_FUNC(cellSysutilAvconfExt, cellVideoOutGetResolutionAvailability2); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellBgdl.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellBgdl.cpp index d07f5092b..b09ada513 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellBgdl.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellBgdl.cpp @@ -30,9 +30,9 @@ error_code cellBGDLGetMode(vm::ptr mode) } DECLARE(ppu_module_manager::cellBGDL)("cellBGDLUtility", []() -{ - REG_FUNC(cellBGDLUtility, cellBGDLGetInfo); - REG_FUNC(cellBGDLUtility, cellBGDLGetInfo2); - REG_FUNC(cellBGDLUtility, cellBGDLSetMode); - REG_FUNC(cellBGDLUtility, cellBGDLGetMode); -}); + { + REG_FUNC(cellBGDLUtility, cellBGDLGetInfo); + REG_FUNC(cellBGDLUtility, cellBGDLGetInfo2); + REG_FUNC(cellBGDLUtility, cellBGDLSetMode); + REG_FUNC(cellBGDLUtility, cellBGDLGetMode); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellBgdl.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellBgdl.h index cf27a2d13..b8ebc3064 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellBgdl.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellBgdl.h @@ -5,11 +5,11 @@ // Return Codes enum { - CELL_BGDL_UTIL_ERROR_BUSY = 0x8002ce01, - CELL_BGDL_UTIL_ERROR_INTERNAL = 0x8002ce02, - CELL_BGDL_UTIL_ERROR_PARAM = 0x8002ce03, + CELL_BGDL_UTIL_ERROR_BUSY = 0x8002ce01, + CELL_BGDL_UTIL_ERROR_INTERNAL = 0x8002ce02, + CELL_BGDL_UTIL_ERROR_PARAM = 0x8002ce03, CELL_BGDL_UTIL_ERROR_ACCESS_ERROR = 0x8002ce04, - CELL_BGDL_UTIL_ERROR_INITIALIZE = 0x8002ce05, + CELL_BGDL_UTIL_ERROR_INITIALIZE = 0x8002ce05, }; enum CellBGDLState : s32 diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellCamera.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellCamera.cpp index 6c0abcc16..4077cfc87 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellCamera.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellCamera.cpp @@ -16,49 +16,49 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellCameraError value) - { - switch (value) { - STR_CASE(CELL_CAMERA_ERROR_ALREADY_INIT); - STR_CASE(CELL_CAMERA_ERROR_NOT_INIT); - STR_CASE(CELL_CAMERA_ERROR_PARAM); - STR_CASE(CELL_CAMERA_ERROR_ALREADY_OPEN); - STR_CASE(CELL_CAMERA_ERROR_NOT_OPEN); - STR_CASE(CELL_CAMERA_ERROR_DEVICE_NOT_FOUND); - STR_CASE(CELL_CAMERA_ERROR_DEVICE_DEACTIVATED); - STR_CASE(CELL_CAMERA_ERROR_NOT_STARTED); - STR_CASE(CELL_CAMERA_ERROR_FORMAT_UNKNOWN); - STR_CASE(CELL_CAMERA_ERROR_RESOLUTION_UNKNOWN); - STR_CASE(CELL_CAMERA_ERROR_BAD_FRAMERATE); - STR_CASE(CELL_CAMERA_ERROR_TIMEOUT); - STR_CASE(CELL_CAMERA_ERROR_BUSY); - STR_CASE(CELL_CAMERA_ERROR_FATAL); - STR_CASE(CELL_CAMERA_ERROR_MUTEX); - } + switch (value) + { + STR_CASE(CELL_CAMERA_ERROR_ALREADY_INIT); + STR_CASE(CELL_CAMERA_ERROR_NOT_INIT); + STR_CASE(CELL_CAMERA_ERROR_PARAM); + STR_CASE(CELL_CAMERA_ERROR_ALREADY_OPEN); + STR_CASE(CELL_CAMERA_ERROR_NOT_OPEN); + STR_CASE(CELL_CAMERA_ERROR_DEVICE_NOT_FOUND); + STR_CASE(CELL_CAMERA_ERROR_DEVICE_DEACTIVATED); + STR_CASE(CELL_CAMERA_ERROR_NOT_STARTED); + STR_CASE(CELL_CAMERA_ERROR_FORMAT_UNKNOWN); + STR_CASE(CELL_CAMERA_ERROR_RESOLUTION_UNKNOWN); + STR_CASE(CELL_CAMERA_ERROR_BAD_FRAMERATE); + STR_CASE(CELL_CAMERA_ERROR_TIMEOUT); + STR_CASE(CELL_CAMERA_ERROR_BUSY); + STR_CASE(CELL_CAMERA_ERROR_FATAL); + STR_CASE(CELL_CAMERA_ERROR_MUTEX); + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellCameraFormat value) - { - switch (value) { - STR_CASE(CELL_CAMERA_FORMAT_UNKNOWN); - STR_CASE(CELL_CAMERA_JPG); - STR_CASE(CELL_CAMERA_RAW8); - STR_CASE(CELL_CAMERA_YUV422); - STR_CASE(CELL_CAMERA_RAW10); - STR_CASE(CELL_CAMERA_RGBA); - STR_CASE(CELL_CAMERA_YUV420); - STR_CASE(CELL_CAMERA_V_Y1_U_Y0); - } + switch (value) + { + STR_CASE(CELL_CAMERA_FORMAT_UNKNOWN); + STR_CASE(CELL_CAMERA_JPG); + STR_CASE(CELL_CAMERA_RAW8); + STR_CASE(CELL_CAMERA_YUV422); + STR_CASE(CELL_CAMERA_RAW10); + STR_CASE(CELL_CAMERA_RGBA); + STR_CASE(CELL_CAMERA_YUV420); + STR_CASE(CELL_CAMERA_V_Y1_U_Y0); + } - return unknown; - }); + return unknown; + }); } // Temporarily @@ -229,11 +229,11 @@ static error_code check_camera_info(const VariantOfCellCameraInfo& info) { case CELL_CAMERA_VGA: case CELL_CAMERA_WGA: - if (!check_fps({ 25, 30 })) + if (!check_fps({25, 30})) return CELL_CAMERA_ERROR_FORMAT_UNKNOWN; break; case CELL_CAMERA_QVGA: - if (!check_fps({ 25, 30, 50, 60 })) + if (!check_fps({25, 30, 50, 60})) return CELL_CAMERA_ERROR_FORMAT_UNKNOWN; break; case CELL_CAMERA_SPECIFIED_WIDTH_HEIGHT: @@ -264,11 +264,11 @@ static error_code check_camera_info(const VariantOfCellCameraInfo& info) { case CELL_CAMERA_VGA: case CELL_CAMERA_WGA: - if (!check_fps({ 25, 30, 50, 60 })) + if (!check_fps({25, 30, 50, 60})) return CELL_CAMERA_ERROR_FORMAT_UNKNOWN; break; case CELL_CAMERA_QVGA: - if (!check_fps({ 25, 30, 50, 60, 100, 120 })) + if (!check_fps({25, 30, 50, 60, 100, 120})) return CELL_CAMERA_ERROR_FORMAT_UNKNOWN; break; case CELL_CAMERA_SPECIFIED_WIDTH_HEIGHT: @@ -286,11 +286,11 @@ static error_code check_camera_info(const VariantOfCellCameraInfo& info) { case CELL_CAMERA_VGA: case CELL_CAMERA_WGA: - if (!check_fps({ 25, 30 })) + if (!check_fps({25, 30})) return CELL_CAMERA_ERROR_FORMAT_UNKNOWN; break; case CELL_CAMERA_QVGA: - if (!check_fps({ 25, 30, 50, 60 })) + if (!check_fps({25, 30, 50, 60})) return CELL_CAMERA_ERROR_FORMAT_UNKNOWN; break; case CELL_CAMERA_SPECIFIED_WIDTH_HEIGHT: @@ -329,12 +329,12 @@ std::pair get_video_resolution(const CellCameraInfoEx& info) { switch (info.resolution) { - case CELL_CAMERA_VGA: return{ 640, 480 }; - case CELL_CAMERA_QVGA: return { 320, 240 }; - case CELL_CAMERA_WGA: return{ 640, 360 }; - case CELL_CAMERA_SPECIFIED_WIDTH_HEIGHT: return{ info.width, info.height }; + case CELL_CAMERA_VGA: return {640, 480}; + case CELL_CAMERA_QVGA: return {320, 240}; + case CELL_CAMERA_WGA: return {640, 360}; + case CELL_CAMERA_SPECIFIED_WIDTH_HEIGHT: return {info.width, info.height}; case CELL_CAMERA_RESOLUTION_UNKNOWN: - default: return{ 0, 0 }; + default: return {0, 0}; } } @@ -367,7 +367,6 @@ u32 get_buffer_size_by_format(s32 format, s32 width, s32 height) return ::narrow(static_cast(std::ceil(width * height * bytes_per_pixel))); } - u32 get_video_buffer_size(const CellCameraInfoEx& info) { u32 width, height; @@ -405,7 +404,7 @@ error_code check_init_and_open(s32 dev_num) error_code check_resolution(s32 dev_num) { // TODO: Some sort of connection check maybe? - //if (error == CELL_CAMERA_ERROR_RESOLUTION_UNKNOWN) + // if (error == CELL_CAMERA_ERROR_RESOLUTION_UNKNOWN) //{ // return CELL_CAMERA_ERROR_TIMEOUT; //} @@ -430,7 +429,6 @@ error_code check_resolution_ex(s32 dev_num) return CELL_OK; } - error_code cellCameraInit() { cellCamera.todo("cellCameraInit()"); @@ -455,46 +453,46 @@ error_code cellCameraInit() { case fake_camera_type::eyetoy: { - g_camera.attr[CELL_CAMERA_SATURATION] = { 164 }; - g_camera.attr[CELL_CAMERA_BRIGHTNESS] = { 96 }; - g_camera.attr[CELL_CAMERA_AEC] = { 1 }; - g_camera.attr[CELL_CAMERA_AGC] = { 1 }; - g_camera.attr[CELL_CAMERA_AWB] = { 1 }; - g_camera.attr[CELL_CAMERA_ABC] = { 0 }; - g_camera.attr[CELL_CAMERA_LED] = { 1 }; - g_camera.attr[CELL_CAMERA_QS] = { 0 }; - g_camera.attr[CELL_CAMERA_NONZEROCOEFFS] = { 32, 32 }; - g_camera.attr[CELL_CAMERA_YUVFLAG] = { 0 }; - g_camera.attr[CELL_CAMERA_BACKLIGHTCOMP] = { 0 }; - g_camera.attr[CELL_CAMERA_MIRRORFLAG] = { 1 }; - g_camera.attr[CELL_CAMERA_422FLAG] = { 1 }; - g_camera.attr[CELL_CAMERA_USBLOAD] = { 4 }; + g_camera.attr[CELL_CAMERA_SATURATION] = {164}; + g_camera.attr[CELL_CAMERA_BRIGHTNESS] = {96}; + g_camera.attr[CELL_CAMERA_AEC] = {1}; + g_camera.attr[CELL_CAMERA_AGC] = {1}; + g_camera.attr[CELL_CAMERA_AWB] = {1}; + g_camera.attr[CELL_CAMERA_ABC] = {0}; + g_camera.attr[CELL_CAMERA_LED] = {1}; + g_camera.attr[CELL_CAMERA_QS] = {0}; + g_camera.attr[CELL_CAMERA_NONZEROCOEFFS] = {32, 32}; + g_camera.attr[CELL_CAMERA_YUVFLAG] = {0}; + g_camera.attr[CELL_CAMERA_BACKLIGHTCOMP] = {0}; + g_camera.attr[CELL_CAMERA_MIRRORFLAG] = {1}; + g_camera.attr[CELL_CAMERA_422FLAG] = {1}; + g_camera.attr[CELL_CAMERA_USBLOAD] = {4}; break; } case fake_camera_type::eyetoy2: { - g_camera.attr[CELL_CAMERA_SATURATION] = { 64 }; - g_camera.attr[CELL_CAMERA_BRIGHTNESS] = { 8 }; - g_camera.attr[CELL_CAMERA_AEC] = { 1 }; - g_camera.attr[CELL_CAMERA_AGC] = { 1 }; - g_camera.attr[CELL_CAMERA_AWB] = { 1 }; - g_camera.attr[CELL_CAMERA_LED] = { 1 }; - g_camera.attr[CELL_CAMERA_BACKLIGHTCOMP] = { 0 }; - g_camera.attr[CELL_CAMERA_MIRRORFLAG] = { 1 }; - g_camera.attr[CELL_CAMERA_GAMMA] = { 1 }; - g_camera.attr[CELL_CAMERA_AGCLIMIT] = { 4 }; - g_camera.attr[CELL_CAMERA_DENOISE] = { 0 }; - g_camera.attr[CELL_CAMERA_FRAMERATEADJUST] = { 0 }; - g_camera.attr[CELL_CAMERA_PIXELOUTLIERFILTER] = { 1 }; - g_camera.attr[CELL_CAMERA_AGCLOW] = { 48 }; - g_camera.attr[CELL_CAMERA_AGCHIGH] = { 64 }; + g_camera.attr[CELL_CAMERA_SATURATION] = {64}; + g_camera.attr[CELL_CAMERA_BRIGHTNESS] = {8}; + g_camera.attr[CELL_CAMERA_AEC] = {1}; + g_camera.attr[CELL_CAMERA_AGC] = {1}; + g_camera.attr[CELL_CAMERA_AWB] = {1}; + g_camera.attr[CELL_CAMERA_LED] = {1}; + g_camera.attr[CELL_CAMERA_BACKLIGHTCOMP] = {0}; + g_camera.attr[CELL_CAMERA_MIRRORFLAG] = {1}; + g_camera.attr[CELL_CAMERA_GAMMA] = {1}; + g_camera.attr[CELL_CAMERA_AGCLIMIT] = {4}; + g_camera.attr[CELL_CAMERA_DENOISE] = {0}; + g_camera.attr[CELL_CAMERA_FRAMERATEADJUST] = {0}; + g_camera.attr[CELL_CAMERA_PIXELOUTLIERFILTER] = {1}; + g_camera.attr[CELL_CAMERA_AGCLOW] = {48}; + g_camera.attr[CELL_CAMERA_AGCHIGH] = {64}; break; } case fake_camera_type::uvc1_1: { - g_camera.attr[CELL_CAMERA_DEVICEID] = { 0x5ca, 0x18d0 }; // KBCR-S01MU - g_camera.attr[CELL_CAMERA_FORMATCAP] = { CELL_CAMERA_JPG | CELL_CAMERA_YUV422 }; - g_camera.attr[CELL_CAMERA_NUMFRAME] = { 1 }; // Amount of supported resolutions + g_camera.attr[CELL_CAMERA_DEVICEID] = {0x5ca, 0x18d0}; // KBCR-S01MU + g_camera.attr[CELL_CAMERA_FORMATCAP] = {CELL_CAMERA_JPG | CELL_CAMERA_YUV422}; + g_camera.attr[CELL_CAMERA_NUMFRAME] = {1}; // Amount of supported resolutions break; } default: @@ -780,9 +778,9 @@ error_code cellCameraGetType(s32 dev_num, vm::ptr type) switch (g_cfg.io.camera_type.get()) { case fake_camera_type::unknown: *type = CELL_CAMERA_TYPE_UNKNOWN; break; - case fake_camera_type::eyetoy: *type = CELL_CAMERA_EYETOY; break; + case fake_camera_type::eyetoy: *type = CELL_CAMERA_EYETOY; break; case fake_camera_type::eyetoy2: *type = CELL_CAMERA_EYETOY2; break; - case fake_camera_type::uvc1_1: *type = CELL_CAMERA_USBVIDEOCLASS; break; + case fake_camera_type::uvc1_1: *type = CELL_CAMERA_USBVIDEOCLASS; break; } return CELL_OK; @@ -1584,55 +1582,55 @@ error_code cellCameraRemoveNotifyEventQueue2(u64 key) } DECLARE(ppu_module_manager::cellCamera)("cellCamera", []() -{ - REG_FUNC(cellCamera, cellCameraInit); - REG_FUNC(cellCamera, cellCameraEnd); - REG_FUNC(cellCamera, cellCameraOpen); - REG_FUNC(cellCamera, cellCameraOpenAsync); - REG_FUNC(cellCamera, cellCameraOpenEx); - REG_FUNC(cellCamera, cellCameraOpenPost); - REG_FUNC(cellCamera, cellCameraClose); - REG_FUNC(cellCamera, cellCameraCloseAsync); - REG_FUNC(cellCamera, cellCameraClosePost); + { + REG_FUNC(cellCamera, cellCameraInit); + REG_FUNC(cellCamera, cellCameraEnd); + REG_FUNC(cellCamera, cellCameraOpen); + REG_FUNC(cellCamera, cellCameraOpenAsync); + REG_FUNC(cellCamera, cellCameraOpenEx); + REG_FUNC(cellCamera, cellCameraOpenPost); + REG_FUNC(cellCamera, cellCameraClose); + REG_FUNC(cellCamera, cellCameraCloseAsync); + REG_FUNC(cellCamera, cellCameraClosePost); - REG_FUNC(cellCamera, cellCameraGetDeviceGUID); - REG_FUNC(cellCamera, cellCameraGetType); - REG_FUNC(cellCamera, cellCameraIsAvailable); - REG_FUNC(cellCamera, cellCameraIsAttached); - REG_FUNC(cellCamera, cellCameraIsOpen); - REG_FUNC(cellCamera, cellCameraIsStarted); - REG_FUNC(cellCamera, cellCameraGetAttribute); - REG_FUNC(cellCamera, cellCameraSetAttribute); - REG_FUNC(cellCamera, cellCameraResetAttribute); - REG_FUNC(cellCamera, cellCameraGetBufferSize); - REG_FUNC(cellCamera, cellCameraGetBufferInfo); - REG_FUNC(cellCamera, cellCameraGetBufferInfoEx); + REG_FUNC(cellCamera, cellCameraGetDeviceGUID); + REG_FUNC(cellCamera, cellCameraGetType); + REG_FUNC(cellCamera, cellCameraIsAvailable); + REG_FUNC(cellCamera, cellCameraIsAttached); + REG_FUNC(cellCamera, cellCameraIsOpen); + REG_FUNC(cellCamera, cellCameraIsStarted); + REG_FUNC(cellCamera, cellCameraGetAttribute); + REG_FUNC(cellCamera, cellCameraSetAttribute); + REG_FUNC(cellCamera, cellCameraResetAttribute); + REG_FUNC(cellCamera, cellCameraGetBufferSize); + REG_FUNC(cellCamera, cellCameraGetBufferInfo); + REG_FUNC(cellCamera, cellCameraGetBufferInfoEx); - REG_FUNC(cellCamera, cellCameraPrepExtensionUnit); - REG_FUNC(cellCamera, cellCameraCtrlExtensionUnit); - REG_FUNC(cellCamera, cellCameraGetExtensionUnit); - REG_FUNC(cellCamera, cellCameraSetExtensionUnit); - REG_FUNC(cellCamera, cellCameraSetContainer); + REG_FUNC(cellCamera, cellCameraPrepExtensionUnit); + REG_FUNC(cellCamera, cellCameraCtrlExtensionUnit); + REG_FUNC(cellCamera, cellCameraGetExtensionUnit); + REG_FUNC(cellCamera, cellCameraSetExtensionUnit); + REG_FUNC(cellCamera, cellCameraSetContainer); - REG_FUNC(cellCamera, cellCameraReset); - REG_FUNC(cellCamera, cellCameraResetAsync); - REG_FUNC(cellCamera, cellCameraResetPost); - REG_FUNC(cellCamera, cellCameraStart); - REG_FUNC(cellCamera, cellCameraStartAsync); - REG_FUNC(cellCamera, cellCameraStartPost); - REG_FUNC(cellCamera, cellCameraRead); - REG_FUNC(cellCamera, cellCameraRead2); - REG_FUNC(cellCamera, cellCameraReadEx); - REG_FUNC(cellCamera, cellCameraReadComplete); - REG_FUNC(cellCamera, cellCameraStop); - REG_FUNC(cellCamera, cellCameraStopAsync); - REG_FUNC(cellCamera, cellCameraStopPost); + REG_FUNC(cellCamera, cellCameraReset); + REG_FUNC(cellCamera, cellCameraResetAsync); + REG_FUNC(cellCamera, cellCameraResetPost); + REG_FUNC(cellCamera, cellCameraStart); + REG_FUNC(cellCamera, cellCameraStartAsync); + REG_FUNC(cellCamera, cellCameraStartPost); + REG_FUNC(cellCamera, cellCameraRead); + REG_FUNC(cellCamera, cellCameraRead2); + REG_FUNC(cellCamera, cellCameraReadEx); + REG_FUNC(cellCamera, cellCameraReadComplete); + REG_FUNC(cellCamera, cellCameraStop); + REG_FUNC(cellCamera, cellCameraStopAsync); + REG_FUNC(cellCamera, cellCameraStopPost); - REG_FUNC(cellCamera, cellCameraSetNotifyEventQueue); - REG_FUNC(cellCamera, cellCameraRemoveNotifyEventQueue); - REG_FUNC(cellCamera, cellCameraSetNotifyEventQueue2); - REG_FUNC(cellCamera, cellCameraRemoveNotifyEventQueue2); -}); + REG_FUNC(cellCamera, cellCameraSetNotifyEventQueue); + REG_FUNC(cellCamera, cellCameraRemoveNotifyEventQueue); + REG_FUNC(cellCamera, cellCameraSetNotifyEventQueue2); + REG_FUNC(cellCamera, cellCameraRemoveNotifyEventQueue2); + }); // camera_thread members @@ -1754,14 +1752,14 @@ void camera_context::operator()() bool camera_context::open_camera() { Emu.BlockingCallFromMainThread([this]() - { - handler.reset(); - handler = Emu.GetCallbacks().get_camera_handler(); - if (handler) { - handler->open_camera(); - } - }); + handler.reset(); + handler = Emu.GetCallbacks().get_camera_handler(); + if (handler) + { + handler->open_camera(); + } + }); return !handler || on_handler_state(handler->get_state()); } @@ -1776,9 +1774,9 @@ bool camera_context::start_camera() handler->set_format(info.format, info.bytesize); Emu.BlockingCallFromMainThread([this]() - { - handler->start_camera(); - }); + { + handler->start_camera(); + }); return on_handler_state(handler->get_state()); } @@ -1801,9 +1799,9 @@ void camera_context::stop_camera() if (handler) { Emu.BlockingCallFromMainThread([this]() - { - handler->stop_camera(); - }); + { + handler->stop_camera(); + }); } } @@ -1812,9 +1810,9 @@ void camera_context::close_camera() if (handler) { Emu.BlockingCallFromMainThread([this]() - { - handler->close_camera(); - }); + { + handler->close_camera(); + }); } } @@ -1907,7 +1905,7 @@ void camera_context::add_queue(u64 key, u64 source, u64 flag) { std::lock_guard lock_data_map(mutex_notify_data_map); - notify_data_map[key] = { source, flag }; + notify_data_map[key] = {source, flag}; } is_attached_dirty = true; @@ -1946,18 +1944,18 @@ bool camera_context::on_handler_state(camera_handler_base::camera_handler_state { cellCamera.warning("Camera closed or disconnected (state=%d). Trying to start camera...", static_cast(state)); Emu.BlockingCallFromMainThread([&]() - { - handler->open_camera(); - handler->start_camera(); - }); + { + handler->open_camera(); + handler->start_camera(); + }); } else if (is_open) { cellCamera.warning("Camera closed or disconnected (state=%d). Trying to open camera...", static_cast(state)); Emu.BlockingCallFromMainThread([&]() - { - handler->open_camera(); - }); + { + handler->open_camera(); + }); } } return false; @@ -1968,9 +1966,9 @@ bool camera_context::on_handler_state(camera_handler_base::camera_handler_state { cellCamera.warning("Camera handler not running (state=%d). Trying to start camera...", static_cast(state)); Emu.BlockingCallFromMainThread([&]() - { - handler->start_camera(); - }); + { + handler->start_camera(); + }); } break; } diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellCamera.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellCamera.h index 56b8334c4..2a29a01ca 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellCamera.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellCamera.h @@ -7,218 +7,217 @@ #include - // Error Codes enum CellCameraError : u32 { - CELL_CAMERA_ERROR_ALREADY_INIT = 0x80140801, - CELL_CAMERA_ERROR_NOT_INIT = 0x80140803, - CELL_CAMERA_ERROR_PARAM = 0x80140804, - CELL_CAMERA_ERROR_ALREADY_OPEN = 0x80140805, - CELL_CAMERA_ERROR_NOT_OPEN = 0x80140806, - CELL_CAMERA_ERROR_DEVICE_NOT_FOUND = 0x80140807, + CELL_CAMERA_ERROR_ALREADY_INIT = 0x80140801, + CELL_CAMERA_ERROR_NOT_INIT = 0x80140803, + CELL_CAMERA_ERROR_PARAM = 0x80140804, + CELL_CAMERA_ERROR_ALREADY_OPEN = 0x80140805, + CELL_CAMERA_ERROR_NOT_OPEN = 0x80140806, + CELL_CAMERA_ERROR_DEVICE_NOT_FOUND = 0x80140807, CELL_CAMERA_ERROR_DEVICE_DEACTIVATED = 0x80140808, - CELL_CAMERA_ERROR_NOT_STARTED = 0x80140809, - CELL_CAMERA_ERROR_FORMAT_UNKNOWN = 0x8014080a, + CELL_CAMERA_ERROR_NOT_STARTED = 0x80140809, + CELL_CAMERA_ERROR_FORMAT_UNKNOWN = 0x8014080a, CELL_CAMERA_ERROR_RESOLUTION_UNKNOWN = 0x8014080b, - CELL_CAMERA_ERROR_BAD_FRAMERATE = 0x8014080c, - CELL_CAMERA_ERROR_TIMEOUT = 0x8014080d, - CELL_CAMERA_ERROR_BUSY = 0x8014080e, - CELL_CAMERA_ERROR_FATAL = 0x8014080f, - CELL_CAMERA_ERROR_MUTEX = 0x80140810, + CELL_CAMERA_ERROR_BAD_FRAMERATE = 0x8014080c, + CELL_CAMERA_ERROR_TIMEOUT = 0x8014080d, + CELL_CAMERA_ERROR_BUSY = 0x8014080e, + CELL_CAMERA_ERROR_FATAL = 0x8014080f, + CELL_CAMERA_ERROR_MUTEX = 0x80140810, }; // Event masks enum { CELL_CAMERA_EFLAG_FRAME_UPDATE = 0x00000001, - CELL_CAMERA_EFLAG_OPEN = 0x00000002, - CELL_CAMERA_EFLAG_CLOSE = 0x00000004, - CELL_CAMERA_EFLAG_START = 0x00000008, - CELL_CAMERA_EFLAG_STOP = 0x00000010, - CELL_CAMERA_EFLAG_RESET = 0x00000020, + CELL_CAMERA_EFLAG_OPEN = 0x00000002, + CELL_CAMERA_EFLAG_CLOSE = 0x00000004, + CELL_CAMERA_EFLAG_START = 0x00000008, + CELL_CAMERA_EFLAG_STOP = 0x00000010, + CELL_CAMERA_EFLAG_RESET = 0x00000020, }; // Event types enum { - CELL_CAMERA_DETACH = 0, - CELL_CAMERA_ATTACH = 1, + CELL_CAMERA_DETACH = 0, + CELL_CAMERA_ATTACH = 1, CELL_CAMERA_FRAME_UPDATE = 2, - CELL_CAMERA_OPEN = 3, - CELL_CAMERA_CLOSE = 4, - CELL_CAMERA_START = 5, - CELL_CAMERA_STOP = 6, - CELL_CAMERA_RESET = 7 + CELL_CAMERA_OPEN = 3, + CELL_CAMERA_CLOSE = 4, + CELL_CAMERA_START = 5, + CELL_CAMERA_STOP = 6, + CELL_CAMERA_RESET = 7 }; // Read mode enum { CELL_CAMERA_READ_FUNCCALL = 0, - CELL_CAMERA_READ_DIRECT = 1, + CELL_CAMERA_READ_DIRECT = 1, }; // Colormatching enum { CELL_CAMERA_CM_CP_UNSPECIFIED = 0, - CELL_CAMERA_CM_CP_BT709_sRGB = 1, - CELL_CAMERA_CM_CP_BT470_2M = 2, - CELL_CAMERA_CM_CP_BT470_2BG = 3, - CELL_CAMERA_CM_CP_SMPTE170M = 4, - CELL_CAMERA_CM_CP_SMPTE240M = 5, + CELL_CAMERA_CM_CP_BT709_sRGB = 1, + CELL_CAMERA_CM_CP_BT470_2M = 2, + CELL_CAMERA_CM_CP_BT470_2BG = 3, + CELL_CAMERA_CM_CP_SMPTE170M = 4, + CELL_CAMERA_CM_CP_SMPTE240M = 5, CELL_CAMERA_CM_TC_UNSPECIFIED = 0, - CELL_CAMERA_CM_TC_BT709 = 1, - CELL_CAMERA_CM_TC_BT470_2M = 2, - CELL_CAMERA_CM_TC_BT470_2BG = 3, - CELL_CAMERA_CM_TC_SMPTE170M = 4, - CELL_CAMERA_CM_TC_SMPTE240M = 5, - CELL_CAMERA_CM_TC_LINEAR = 6, - CELL_CAMERA_CM_TC_sRGB = 7, + CELL_CAMERA_CM_TC_BT709 = 1, + CELL_CAMERA_CM_TC_BT470_2M = 2, + CELL_CAMERA_CM_TC_BT470_2BG = 3, + CELL_CAMERA_CM_TC_SMPTE170M = 4, + CELL_CAMERA_CM_TC_SMPTE240M = 5, + CELL_CAMERA_CM_TC_LINEAR = 6, + CELL_CAMERA_CM_TC_sRGB = 7, CELL_CAMERA_CM_MC_UNSPECIFIED = 0, - CELL_CAMERA_CM_MC_BT709 = 1, - CELL_CAMERA_CM_MC_FCC = 2, - CELL_CAMERA_CM_MC_BT470_2BG = 3, - CELL_CAMERA_CM_MC_SMPTE170M = 4, - CELL_CAMERA_CM_MC_SMPTE240M = 5, + CELL_CAMERA_CM_MC_BT709 = 1, + CELL_CAMERA_CM_MC_FCC = 2, + CELL_CAMERA_CM_MC_BT470_2BG = 3, + CELL_CAMERA_CM_MC_SMPTE170M = 4, + CELL_CAMERA_CM_MC_SMPTE240M = 5, }; // Power Line Frequency enum { CELL_CAMERA_PLFREQ_DISABLED = 0, - CELL_CAMERA_PLFREQ_50Hz = 1, - CELL_CAMERA_PLFREQ_60Hz = 2, + CELL_CAMERA_PLFREQ_50Hz = 1, + CELL_CAMERA_PLFREQ_60Hz = 2, }; // DEVICECAP enum { - CELL_CAMERA_CTC_SCANNING_MODE = (1 << 0), - CELL_CAMERA_CTC_AUTO_EXPOSURE_MODE = (1 << 1), - CELL_CAMERA_CTC_AUTO_EXPOSURE_PRIORITY = (1 << 2), - CELL_CAMERA_CTC_EXPOSURE_TIME_ABS = (1 << 3), - CELL_CAMERA_CTC_EXPOSURE_TIME_REL = (1 << 4), - CELL_CAMERA_CTC_FOCUS_ABS = (1 << 5), - CELL_CAMERA_CTC_FOCUS_REL = (1 << 6), - CELL_CAMERA_CTC_IRIS_ABS = (1 << 7), - CELL_CAMERA_CTC_IRIS_REL = (1 << 8), - CELL_CAMERA_CTC_ZOOM_ABS = (1 << 9), - CELL_CAMERA_CTC_ZOOM_REL = (1 << 10), - CELL_CAMERA_CTC_PANTILT_ABS = (1 << 11), - CELL_CAMERA_CTC_PANTILT_REL = (1 << 12), - CELL_CAMERA_CTC_ROLL_ABS = (1 << 13), - CELL_CAMERA_CTC_ROLL_REL = (1 << 14), - CELL_CAMERA_CTC_RESERVED_15 = (1 << 15), - CELL_CAMERA_CTC_RESERVED_16 = (1 << 16), - CELL_CAMERA_CTC_FOCUS_AUTO = (1 << 17), - CELL_CAMERA_CTC_PRIVACY = (1 << 18), + CELL_CAMERA_CTC_SCANNING_MODE = (1 << 0), + CELL_CAMERA_CTC_AUTO_EXPOSURE_MODE = (1 << 1), + CELL_CAMERA_CTC_AUTO_EXPOSURE_PRIORITY = (1 << 2), + CELL_CAMERA_CTC_EXPOSURE_TIME_ABS = (1 << 3), + CELL_CAMERA_CTC_EXPOSURE_TIME_REL = (1 << 4), + CELL_CAMERA_CTC_FOCUS_ABS = (1 << 5), + CELL_CAMERA_CTC_FOCUS_REL = (1 << 6), + CELL_CAMERA_CTC_IRIS_ABS = (1 << 7), + CELL_CAMERA_CTC_IRIS_REL = (1 << 8), + CELL_CAMERA_CTC_ZOOM_ABS = (1 << 9), + CELL_CAMERA_CTC_ZOOM_REL = (1 << 10), + CELL_CAMERA_CTC_PANTILT_ABS = (1 << 11), + CELL_CAMERA_CTC_PANTILT_REL = (1 << 12), + CELL_CAMERA_CTC_ROLL_ABS = (1 << 13), + CELL_CAMERA_CTC_ROLL_REL = (1 << 14), + CELL_CAMERA_CTC_RESERVED_15 = (1 << 15), + CELL_CAMERA_CTC_RESERVED_16 = (1 << 16), + CELL_CAMERA_CTC_FOCUS_AUTO = (1 << 17), + CELL_CAMERA_CTC_PRIVACY = (1 << 18), - CELL_CAMERA_PUC_BRIGHTNESS = (1 << 0), - CELL_CAMERA_PUC_CONTRAST = (1 << 1), - CELL_CAMERA_PUC_HUE = (1 << 2), - CELL_CAMERA_PUC_SATURATION = (1 << 3), - CELL_CAMERA_PUC_SHARPNESS = (1 << 4), - CELL_CAMERA_PUC_GAMMA = (1 << 5), - CELL_CAMERA_PUC_WHITE_BALANCE_TEMPERATURE = (1 << 6), - CELL_CAMERA_PUC_WHITE_BALANCE_COMPONENT = (1 << 7), - CELL_CAMERA_PUC_BACKLIGHT_COMPENSATION = (1 << 8), - CELL_CAMERA_PUC_GAIN = (1 << 9), - CELL_CAMERA_PUC_POWER_LINE_FREQUENCY = (1 << 10), - CELL_CAMERA_PUC_HUE_AUTO = (1 << 11), + CELL_CAMERA_PUC_BRIGHTNESS = (1 << 0), + CELL_CAMERA_PUC_CONTRAST = (1 << 1), + CELL_CAMERA_PUC_HUE = (1 << 2), + CELL_CAMERA_PUC_SATURATION = (1 << 3), + CELL_CAMERA_PUC_SHARPNESS = (1 << 4), + CELL_CAMERA_PUC_GAMMA = (1 << 5), + CELL_CAMERA_PUC_WHITE_BALANCE_TEMPERATURE = (1 << 6), + CELL_CAMERA_PUC_WHITE_BALANCE_COMPONENT = (1 << 7), + CELL_CAMERA_PUC_BACKLIGHT_COMPENSATION = (1 << 8), + CELL_CAMERA_PUC_GAIN = (1 << 9), + CELL_CAMERA_PUC_POWER_LINE_FREQUENCY = (1 << 10), + CELL_CAMERA_PUC_HUE_AUTO = (1 << 11), CELL_CAMERA_PUC_WHITE_BALANCE_TEMPERATURE_AUTO = (1 << 12), - CELL_CAMERA_PUC_WHITE_BALANCE_COMPONENT_AUTO = (1 << 13), - CELL_CAMERA_PUC_DIGITAL_MULTIPLIER = (1 << 14), - CELL_CAMERA_PUC_DIGITAL_MULTIPLIER_LIMIT = (1 << 15), - CELL_CAMERA_PUC_ANALOG_VIDEO_STANDARD = (1 << 16), - CELL_CAMERA_PUC_ANALOG_VIDEO_LOCK_STATUS = (1 << 17), + CELL_CAMERA_PUC_WHITE_BALANCE_COMPONENT_AUTO = (1 << 13), + CELL_CAMERA_PUC_DIGITAL_MULTIPLIER = (1 << 14), + CELL_CAMERA_PUC_DIGITAL_MULTIPLIER_LIMIT = (1 << 15), + CELL_CAMERA_PUC_ANALOG_VIDEO_STANDARD = (1 << 16), + CELL_CAMERA_PUC_ANALOG_VIDEO_LOCK_STATUS = (1 << 17), }; // UVCREQCODE Control Selector enum { - CELL_CAMERA_CS_SHIFT = 0, - CELL_CAMERA_CS_BITS = 0x000000ff, + CELL_CAMERA_CS_SHIFT = 0, + CELL_CAMERA_CS_BITS = 0x000000ff, CELL_CAMERA_CAP_SHIFT = 8, - CELL_CAMERA_CAP_BITS = 0x0000ff00, + CELL_CAMERA_CAP_BITS = 0x0000ff00, CELL_CAMERA_NUM_SHIFT = 16, - CELL_CAMERA_NUM_BITS = 0x000f0000, - CELL_CAMERA_NUM_1 = 0x00010000, - CELL_CAMERA_NUM_2 = 0x00020000, - CELL_CAMERA_NUM_3 = 0x00030000, - CELL_CAMERA_NUM_4 = 0x00040000, + CELL_CAMERA_NUM_BITS = 0x000f0000, + CELL_CAMERA_NUM_1 = 0x00010000, + CELL_CAMERA_NUM_2 = 0x00020000, + CELL_CAMERA_NUM_3 = 0x00030000, + CELL_CAMERA_NUM_4 = 0x00040000, CELL_CAMERA_LEN_SHIFT = 20, - CELL_CAMERA_LEN_BITS = 0x00f00000, - CELL_CAMERA_LEN_1 = 0x00100000, - CELL_CAMERA_LEN_2 = 0x00200000, - CELL_CAMERA_LEN_4 = 0x00400000, - CELL_CAMERA_ID_SHIFT = 24, - CELL_CAMERA_ID_BITS = 0x0f000000, - CELL_CAMERA_ID_CT = 0x01000000, - CELL_CAMERA_ID_SU = 0x02000000, - CELL_CAMERA_ID_PU = 0x04000000, + CELL_CAMERA_LEN_BITS = 0x00f00000, + CELL_CAMERA_LEN_1 = 0x00100000, + CELL_CAMERA_LEN_2 = 0x00200000, + CELL_CAMERA_LEN_4 = 0x00400000, + CELL_CAMERA_ID_SHIFT = 24, + CELL_CAMERA_ID_BITS = 0x0f000000, + CELL_CAMERA_ID_CT = 0x01000000, + CELL_CAMERA_ID_SU = 0x02000000, + CELL_CAMERA_ID_PU = 0x04000000, }; // UVCREQCODE Camera Terminal Control enum { - CELL_CAMERA_UVC_SCANNING_MODE = 0x01110001, - CELL_CAMERA_UVC_AUTO_EXPOSURE_MODE = 0x01110102, + CELL_CAMERA_UVC_SCANNING_MODE = 0x01110001, + CELL_CAMERA_UVC_AUTO_EXPOSURE_MODE = 0x01110102, CELL_CAMERA_UVC_AUTO_EXPOSURE_PRIORITY = 0x01110203, - CELL_CAMERA_UVC_EXPOSURE_TIME_ABS = 0x01410304, - CELL_CAMERA_UVC_EXPOSURE_TIME_REL = 0x01110405, - CELL_CAMERA_UVC_FOCUS_ABS = 0x01210506, - CELL_CAMERA_UVC_FOCUS_REL = 0x01120607, - CELL_CAMERA_UVC_FOCUS_AUTO = 0x01111108, - CELL_CAMERA_UVC_IRIS_ABS = 0x01210709, - CELL_CAMERA_UVC_IRIS_REL = 0x0111080a, - CELL_CAMERA_UVC_ZOOM_ABS = 0x0121090b, - CELL_CAMERA_UVC_ZOOM_REL = 0x01130a0c, - CELL_CAMERA_UVC_PANTILT_ABS = 0x01420b0d, - CELL_CAMERA_UVC_PANTILT_REL = 0x01140c0e, - CELL_CAMERA_UVC_ROLL_ABS = 0x01210d0f, - CELL_CAMERA_UVC_ROLL_REL = 0x01120e10, - CELL_CAMERA_UVC_PRIVACY = 0x01111211, + CELL_CAMERA_UVC_EXPOSURE_TIME_ABS = 0x01410304, + CELL_CAMERA_UVC_EXPOSURE_TIME_REL = 0x01110405, + CELL_CAMERA_UVC_FOCUS_ABS = 0x01210506, + CELL_CAMERA_UVC_FOCUS_REL = 0x01120607, + CELL_CAMERA_UVC_FOCUS_AUTO = 0x01111108, + CELL_CAMERA_UVC_IRIS_ABS = 0x01210709, + CELL_CAMERA_UVC_IRIS_REL = 0x0111080a, + CELL_CAMERA_UVC_ZOOM_ABS = 0x0121090b, + CELL_CAMERA_UVC_ZOOM_REL = 0x01130a0c, + CELL_CAMERA_UVC_PANTILT_ABS = 0x01420b0d, + CELL_CAMERA_UVC_PANTILT_REL = 0x01140c0e, + CELL_CAMERA_UVC_ROLL_ABS = 0x01210d0f, + CELL_CAMERA_UVC_ROLL_REL = 0x01120e10, + CELL_CAMERA_UVC_PRIVACY = 0x01111211, }; // UVCREQCODE Selector Unit Control/Processing Unit Control enum { - CELL_CAMERA_UVC_INPUT_SELECT = 0x02110101, + CELL_CAMERA_UVC_INPUT_SELECT = 0x02110101, - CELL_CAMERA_UVC_BACKLIGHT_COMPENSATION = 0x04210801, - CELL_CAMERA_UVC_BRIGHTNESS = 0x04210002, - CELL_CAMERA_UVC_CONTRAST = 0x04210103, - CELL_CAMERA_UVC_GAIN = 0x04210904, - CELL_CAMERA_UVC_POWER_LINE_FREQUENCY = 0x04110a05, - CELL_CAMERA_UVC_HUE = 0x04210206, - CELL_CAMERA_UVC_HUE_AUTO = 0x04110b10, - CELL_CAMERA_UVC_SATURATION = 0x04210307, - CELL_CAMERA_UVC_SHARPNESS = 0x04210408, - CELL_CAMERA_UVC_GAMMA = 0x04210509, - CELL_CAMERA_UVC_WHITE_BALANCE_TEMPERATURE = 0x0421060a, + CELL_CAMERA_UVC_BACKLIGHT_COMPENSATION = 0x04210801, + CELL_CAMERA_UVC_BRIGHTNESS = 0x04210002, + CELL_CAMERA_UVC_CONTRAST = 0x04210103, + CELL_CAMERA_UVC_GAIN = 0x04210904, + CELL_CAMERA_UVC_POWER_LINE_FREQUENCY = 0x04110a05, + CELL_CAMERA_UVC_HUE = 0x04210206, + CELL_CAMERA_UVC_HUE_AUTO = 0x04110b10, + CELL_CAMERA_UVC_SATURATION = 0x04210307, + CELL_CAMERA_UVC_SHARPNESS = 0x04210408, + CELL_CAMERA_UVC_GAMMA = 0x04210509, + CELL_CAMERA_UVC_WHITE_BALANCE_TEMPERATURE = 0x0421060a, CELL_CAMERA_UVC_WHITE_BALANCE_TEMPERATURE_AUTO = 0x04110c0b, - CELL_CAMERA_UVC_WHITE_BALANCE_COMPONENT = 0x0422070c, - CELL_CAMERA_UVC_WHITE_BALANCE_COMPONENT_AUTO = 0x04110d0d, - CELL_CAMERA_UVC_DIGITAL_MULTIPLIER = 0x04210e0e, - CELL_CAMERA_UVC_DIGITAL_MULTIPLIER_LIMIT = 0x04210f0f, - CELL_CAMERA_UVC_ANALOG_VIDEO_STANDARD = 0x04111011, - CELL_CAMERA_UVC_ANALOG_VIDEO_LOCK_STATUS = 0x04111112, + CELL_CAMERA_UVC_WHITE_BALANCE_COMPONENT = 0x0422070c, + CELL_CAMERA_UVC_WHITE_BALANCE_COMPONENT_AUTO = 0x04110d0d, + CELL_CAMERA_UVC_DIGITAL_MULTIPLIER = 0x04210e0e, + CELL_CAMERA_UVC_DIGITAL_MULTIPLIER_LIMIT = 0x04210f0f, + CELL_CAMERA_UVC_ANALOG_VIDEO_STANDARD = 0x04111011, + CELL_CAMERA_UVC_ANALOG_VIDEO_LOCK_STATUS = 0x04111112, }; // UVCREQCODE Request code bits enum { - CELL_CAMERA_RC_CUR = 0x81, - CELL_CAMERA_RC_MIN = 0x82, - CELL_CAMERA_RC_MAX = 0x83, - CELL_CAMERA_RC_RES = 0x84, - CELL_CAMERA_RC_LEN = 0x85, + CELL_CAMERA_RC_CUR = 0x81, + CELL_CAMERA_RC_MIN = 0x82, + CELL_CAMERA_RC_MAX = 0x83, + CELL_CAMERA_RC_RES = 0x84, + CELL_CAMERA_RC_LEN = 0x85, CELL_CAMERA_RC_INFO = 0x86, - CELL_CAMERA_RC_DEF = 0x87, + CELL_CAMERA_RC_DEF = 0x87, }; // Camera types @@ -287,7 +286,7 @@ enum CellCameraAttribute : s32 CELL_CAMERA_AGCHIGH, CELL_CAMERA_DEVICELOCATION, - CELL_CAMERA_FORMATCAP = 100, + CELL_CAMERA_FORMATCAP = 100, CELL_CAMERA_FORMATINDEX, CELL_CAMERA_NUMFRAME, CELL_CAMERA_FRAMEINDEX, @@ -304,7 +303,7 @@ enum CellCameraAttribute : s32 CELL_CAMERA_UVCREQDATA, CELL_CAMERA_DEVICEID2, - CELL_CAMERA_READMODE = 300, + CELL_CAMERA_READMODE = 300, CELL_CAMERA_GAMEPID, CELL_CAMERA_PBUFFER, CELL_CAMERA_READFINISH, @@ -315,14 +314,14 @@ enum CellCameraAttribute : s32 // Request codes enum { - SET_CUR = 0x01, - GET_CUR = 0x81, - GET_MIN = 0x82, - GET_MAX = 0x83, - GET_RES = 0x84, - GET_LEN = 0x85, + SET_CUR = 0x01, + GET_CUR = 0x81, + GET_MIN = 0x82, + GET_MAX = 0x83, + GET_RES = 0x84, + GET_LEN = 0x85, GET_INFO = 0x86, - GET_DEF = 0x87, + GET_DEF = 0x87, }; enum // version @@ -330,10 +329,10 @@ enum // version CELL_CAMERA_INFO_VER_100 = 0x0100, CELL_CAMERA_INFO_VER_101 = 0x0101, CELL_CAMERA_INFO_VER_200 = 0x0200, - CELL_CAMERA_INFO_VER = CELL_CAMERA_INFO_VER_200, + CELL_CAMERA_INFO_VER = CELL_CAMERA_INFO_VER_200, CELL_CAMERA_READ_VER_100 = 0x0100, - CELL_CAMERA_READ_VER = CELL_CAMERA_READ_VER_100, + CELL_CAMERA_READ_VER = CELL_CAMERA_READ_VER_100, }; // Other @@ -361,13 +360,13 @@ struct CellCameraInfo struct CellCameraInfoEx { be_t format; // CellCameraFormat - be_t resolution; // CellCameraResolution + be_t resolution; // CellCameraResolution be_t framerate; vm::bptr buffer; be_t bytesize; - be_t width; // only used if resolution == CELL_CAMERA_SPECIFIED_WIDTH_HEIGHT - be_t height; // likewise + be_t width; // only used if resolution == CELL_CAMERA_SPECIFIED_WIDTH_HEIGHT + be_t height; // likewise be_t dev_num; be_t guid; @@ -432,7 +431,7 @@ public: CellCameraInfoEx info{}; atomic_t pbuf_write_index = 0; - std::array, 2> pbuf_locked = { false, false }; + std::array, 2> pbuf_locked = {false, false}; u32 pbuf_next_index() const; struct attr_t diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellCelp8Enc.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellCelp8Enc.cpp index 83632b12f..af1600070 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellCelp8Enc.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellCelp8Enc.cpp @@ -9,19 +9,19 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellCelp8EncError value) - { - switch (value) { - STR_CASE(CELL_CELP8ENC_ERROR_FAILED); - STR_CASE(CELL_CELP8ENC_ERROR_SEQ); - STR_CASE(CELL_CELP8ENC_ERROR_ARG); - STR_CASE(CELL_CELP8ENC_ERROR_CORE_FAILED); - STR_CASE(CELL_CELP8ENC_ERROR_CORE_SEQ); - STR_CASE(CELL_CELP8ENC_ERROR_CORE_ARG); - } + switch (value) + { + STR_CASE(CELL_CELP8ENC_ERROR_FAILED); + STR_CASE(CELL_CELP8ENC_ERROR_SEQ); + STR_CASE(CELL_CELP8ENC_ERROR_ARG); + STR_CASE(CELL_CELP8ENC_ERROR_CORE_FAILED); + STR_CASE(CELL_CELP8ENC_ERROR_CORE_SEQ); + STR_CASE(CELL_CELP8ENC_ERROR_CORE_ARG); + } - return unknown; - }); + return unknown; + }); } error_code cellCelp8EncQueryAttr(vm::ptr attr) @@ -79,14 +79,14 @@ error_code cellCelp8EncGetAu(vm::ptr handle, vm::ptr outBuffer, vm:: } DECLARE(ppu_module_manager::cellCelp8Enc)("cellCelp8Enc", []() -{ - REG_FUNC(cellCelp8Enc, cellCelp8EncQueryAttr); - REG_FUNC(cellCelp8Enc, cellCelp8EncOpen); - REG_FUNC(cellCelp8Enc, cellCelp8EncOpenEx); - REG_FUNC(cellCelp8Enc, cellCelp8EncClose); - REG_FUNC(cellCelp8Enc, cellCelp8EncStart); - REG_FUNC(cellCelp8Enc, cellCelp8EncEnd); - REG_FUNC(cellCelp8Enc, cellCelp8EncEncodeFrame); - REG_FUNC(cellCelp8Enc, cellCelp8EncWaitForOutput); - REG_FUNC(cellCelp8Enc, cellCelp8EncGetAu); -}); + { + REG_FUNC(cellCelp8Enc, cellCelp8EncQueryAttr); + REG_FUNC(cellCelp8Enc, cellCelp8EncOpen); + REG_FUNC(cellCelp8Enc, cellCelp8EncOpenEx); + REG_FUNC(cellCelp8Enc, cellCelp8EncClose); + REG_FUNC(cellCelp8Enc, cellCelp8EncStart); + REG_FUNC(cellCelp8Enc, cellCelp8EncEnd); + REG_FUNC(cellCelp8Enc, cellCelp8EncEncodeFrame); + REG_FUNC(cellCelp8Enc, cellCelp8EncWaitForOutput); + REG_FUNC(cellCelp8Enc, cellCelp8EncGetAu); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellCelp8Enc.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellCelp8Enc.h index aec4b70a4..eecc6e13b 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellCelp8Enc.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellCelp8Enc.h @@ -9,12 +9,12 @@ struct CellSpurs; // Return Codes enum CellCelp8EncError : u32 { - CELL_CELP8ENC_ERROR_FAILED = 0x806140a1, - CELL_CELP8ENC_ERROR_SEQ = 0x806140a2, - CELL_CELP8ENC_ERROR_ARG = 0x806140a3, + CELL_CELP8ENC_ERROR_FAILED = 0x806140a1, + CELL_CELP8ENC_ERROR_SEQ = 0x806140a2, + CELL_CELP8ENC_ERROR_ARG = 0x806140a3, CELL_CELP8ENC_ERROR_CORE_FAILED = 0x806140b1, - CELL_CELP8ENC_ERROR_CORE_SEQ = 0x806140b2, - CELL_CELP8ENC_ERROR_CORE_ARG = 0x806140b3, + CELL_CELP8ENC_ERROR_CORE_SEQ = 0x806140b2, + CELL_CELP8ENC_ERROR_CORE_ARG = 0x806140b3, }; // Definitions @@ -60,7 +60,7 @@ struct CellCelp8EncResource vm::bptr startAddr; be_t ppuThreadPriority; be_t spuThreadPriority; - be_t ppuThreadStackSize; + be_t ppuThreadStackSize; }; struct CellCelp8EncParam diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellCelpEnc.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellCelpEnc.cpp index 7f41a3fdc..3aafa2f07 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellCelpEnc.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellCelpEnc.cpp @@ -9,19 +9,19 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellCelpEncError value) - { - switch (value) { - STR_CASE(CELL_CELPENC_ERROR_FAILED); - STR_CASE(CELL_CELPENC_ERROR_SEQ); - STR_CASE(CELL_CELPENC_ERROR_ARG); - STR_CASE(CELL_CELPENC_ERROR_CORE_FAILED); - STR_CASE(CELL_CELPENC_ERROR_CORE_SEQ); - STR_CASE(CELL_CELPENC_ERROR_CORE_ARG); - } + switch (value) + { + STR_CASE(CELL_CELPENC_ERROR_FAILED); + STR_CASE(CELL_CELPENC_ERROR_SEQ); + STR_CASE(CELL_CELPENC_ERROR_ARG); + STR_CASE(CELL_CELPENC_ERROR_CORE_FAILED); + STR_CASE(CELL_CELPENC_ERROR_CORE_SEQ); + STR_CASE(CELL_CELPENC_ERROR_CORE_ARG); + } - return unknown; - }); + return unknown; + }); } error_code cellCelpEncQueryAttr(vm::ptr attr) @@ -85,15 +85,15 @@ error_code cellCelpEncGetAu(vm::ptr handle, vm::ptr outBuffer, vm::p } DECLARE(ppu_module_manager::cellCelpEnc)("cellCelpEnc", []() -{ - REG_FUNC(cellCelpEnc, cellCelpEncQueryAttr); - REG_FUNC(cellCelpEnc, cellCelpEncOpen); - REG_FUNC(cellCelpEnc, cellCelpEncOpenEx); - REG_FUNC(cellCelpEnc, cellCelpEncOpenExt); - REG_FUNC(cellCelpEnc, cellCelpEncClose); - REG_FUNC(cellCelpEnc, cellCelpEncStart); - REG_FUNC(cellCelpEnc, cellCelpEncEnd); - REG_FUNC(cellCelpEnc, cellCelpEncEncodeFrame); - REG_FUNC(cellCelpEnc, cellCelpEncWaitForOutput); - REG_FUNC(cellCelpEnc, cellCelpEncGetAu); -}); + { + REG_FUNC(cellCelpEnc, cellCelpEncQueryAttr); + REG_FUNC(cellCelpEnc, cellCelpEncOpen); + REG_FUNC(cellCelpEnc, cellCelpEncOpenEx); + REG_FUNC(cellCelpEnc, cellCelpEncOpenExt); + REG_FUNC(cellCelpEnc, cellCelpEncClose); + REG_FUNC(cellCelpEnc, cellCelpEncStart); + REG_FUNC(cellCelpEnc, cellCelpEncEnd); + REG_FUNC(cellCelpEnc, cellCelpEncEncodeFrame); + REG_FUNC(cellCelpEnc, cellCelpEncWaitForOutput); + REG_FUNC(cellCelpEnc, cellCelpEncGetAu); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellCelpEnc.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellCelpEnc.h index 8c553f411..4d51bbdd4 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellCelpEnc.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellCelpEnc.h @@ -9,12 +9,12 @@ struct CellSpurs; // Return Codes enum CellCelpEncError : u32 { - CELL_CELPENC_ERROR_FAILED = 0x80614001, - CELL_CELPENC_ERROR_SEQ = 0x80614002, - CELL_CELPENC_ERROR_ARG = 0x80614003, + CELL_CELPENC_ERROR_FAILED = 0x80614001, + CELL_CELPENC_ERROR_SEQ = 0x80614002, + CELL_CELPENC_ERROR_ARG = 0x80614003, CELL_CELPENC_ERROR_CORE_FAILED = 0x80614081, - CELL_CELPENC_ERROR_CORE_SEQ = 0x80614082, - CELL_CELPENC_ERROR_CORE_ARG = 0x80614083, + CELL_CELPENC_ERROR_CORE_SEQ = 0x80614082, + CELL_CELPENC_ERROR_CORE_ARG = 0x80614083, }; // Definitions @@ -55,7 +55,7 @@ struct CellCelpEncResource vm::bptr startAddr; be_t ppuThreadPriority; be_t spuThreadPriority; - be_t ppuThreadStackSize; + be_t ppuThreadStackSize; }; struct CellCelpEncParam diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellCrossController.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellCrossController.cpp index 1f28328c7..e7cc0a8fe 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellCrossController.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellCrossController.cpp @@ -7,34 +7,33 @@ #include "cellCrossController.h" #include "cellMsgDialog.h" - LOG_CHANNEL(cellCrossController); template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellCrossControllerError value) - { - switch (value) { - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_CANCEL); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_NETWORK); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_OUT_OF_MEMORY); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_FATAL); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INVALID_PKG_FILENAME); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INVALID_SIG_FILENAME); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INVALID_ICON_FILENAME); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INVALID_VALUE); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_PKG_FILE_OPEN); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_SIG_FILE_OPEN); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_ICON_FILE_OPEN); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INVALID_STATE); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INVALID_PKG_FILE); - STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INTERNAL); - } + switch (value) + { + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_CANCEL); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_NETWORK); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_OUT_OF_MEMORY); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_FATAL); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INVALID_PKG_FILENAME); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INVALID_SIG_FILENAME); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INVALID_ICON_FILENAME); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INVALID_VALUE); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_PKG_FILE_OPEN); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_SIG_FILE_OPEN); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_ICON_FILE_OPEN); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INVALID_STATE); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INVALID_PKG_FILE); + STR_CASE(CELL_CROSS_CONTROLLER_ERROR_INTERNAL); + } - return unknown; - }); + return unknown; + }); } void finish_callback(ppu_thread& ppu, s32 button_type, vm::ptr userdata); // Forward declaration @@ -53,10 +52,10 @@ struct cross_controller close_msg_dialog(); sysutil_register_cb([this, status](ppu_thread& ppu) -> s32 - { - callback(ppu, CELL_CROSS_CONTROLLER_STATUS_FINALIZED, status, vm::null, userdata); - return CELL_OK; - }); + { + callback(ppu, CELL_CROSS_CONTROLLER_STATUS_FINALIZED, status, vm::null, userdata); + return CELL_OK; + }); } void run_thread(vm::cptr pPkgInfo) @@ -75,34 +74,34 @@ struct cross_controller error_code res = open_msg_dialog(false, CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF, vm::make_str(msg), msg_dialog_source::_cellCrossController, msg_dialog_callback, userdata); sysutil_register_cb([this, res](ppu_thread& ppu) -> s32 - { - callback(ppu, CELL_CROSS_CONTROLLER_STATUS_INITIALIZED, res == CELL_OK ? +CELL_OK : +CELL_CROSS_CONTROLLER_ERROR_INTERNAL, vm::null, userdata); - return CELL_OK; - }); + { + callback(ppu, CELL_CROSS_CONTROLLER_STATUS_INITIALIZED, res == CELL_OK ? +CELL_OK : +CELL_CROSS_CONTROLLER_ERROR_INTERNAL, vm::null, userdata); + return CELL_OK; + }); status = CELL_CROSS_CONTROLLER_STATUS_INITIALIZED; connection_thread = std::make_unique>>(fmt::format("Cross-Controller Thread"), [this]() - { - while (thread_ctrl::state() != thread_state::aborting) { - if (Emu.IsPaused()) + while (thread_ctrl::state() != thread_state::aborting) { - thread_ctrl::wait_for(10'000); - continue; + if (Emu.IsPaused()) + { + thread_ctrl::wait_for(10'000); + continue; + } + + // TODO: establish connection to PS Vita + if (false) + { + on_connection_established(CELL_OK); + } + + thread_ctrl::wait_for(1000); } - // TODO: establish connection to PS Vita - if (false) - { - on_connection_established(CELL_OK); - } - - thread_ctrl::wait_for(1000); - } - - status = CELL_CROSS_CONTROLLER_STATUS_FINALIZED; - }); + status = CELL_CROSS_CONTROLLER_STATUS_FINALIZED; + }); } void stop_thread() @@ -172,9 +171,9 @@ error_code cellCrossControllerInitialize(vm::cptr pPar } if (!pPkgInfo->pAppVer || !memchr(pPkgInfo->pAppVer.get_ptr(), '\0', CELL_CROSS_CONTROLLER_PKG_APP_VER_LEN + 1) || - !pPkgInfo->pTitleId || !memchr(pPkgInfo->pTitleId.get_ptr(), '\0', CELL_CROSS_CONTROLLER_PKG_TITLE_ID_LEN + 1) || - !pPkgInfo->pTitle || !memchr(pPkgInfo->pTitle.get_ptr(), '\0', CELL_CROSS_CONTROLLER_PKG_TITLE_LEN + 1) || - !cb) + !pPkgInfo->pTitleId || !memchr(pPkgInfo->pTitleId.get_ptr(), '\0', CELL_CROSS_CONTROLLER_PKG_TITLE_ID_LEN + 1) || + !pPkgInfo->pTitle || !memchr(pPkgInfo->pTitle.get_ptr(), '\0', CELL_CROSS_CONTROLLER_PKG_TITLE_LEN + 1) || + !cb) { return CELL_CROSS_CONTROLLER_ERROR_INVALID_VALUE; } @@ -186,11 +185,10 @@ error_code cellCrossControllerInitialize(vm::cptr pPar return CELL_OK; } - DECLARE(ppu_module_manager::cellCrossController)("cellCrossController", []() -{ - REG_FUNC(cellCrossController, cellCrossControllerInitialize); + { + REG_FUNC(cellCrossController, cellCrossControllerInitialize); - // Helper Function - REG_HIDDEN_FUNC(finish_callback); -}); + // Helper Function + REG_HIDDEN_FUNC(finish_callback); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellCrossController.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellCrossController.h index a1daf5c72..caa0b534b 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellCrossController.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellCrossController.h @@ -2,33 +2,33 @@ enum CellCrossControllerError : u32 { - CELL_CROSS_CONTROLLER_ERROR_CANCEL = 0x8002cd80, - CELL_CROSS_CONTROLLER_ERROR_NETWORK = 0x8002cd81, - CELL_CROSS_CONTROLLER_ERROR_OUT_OF_MEMORY = 0x8002cd90, - CELL_CROSS_CONTROLLER_ERROR_FATAL = 0x8002cd91, - CELL_CROSS_CONTROLLER_ERROR_INVALID_PKG_FILENAME = 0x8002cd92, - CELL_CROSS_CONTROLLER_ERROR_INVALID_SIG_FILENAME = 0x8002cd93, + CELL_CROSS_CONTROLLER_ERROR_CANCEL = 0x8002cd80, + CELL_CROSS_CONTROLLER_ERROR_NETWORK = 0x8002cd81, + CELL_CROSS_CONTROLLER_ERROR_OUT_OF_MEMORY = 0x8002cd90, + CELL_CROSS_CONTROLLER_ERROR_FATAL = 0x8002cd91, + CELL_CROSS_CONTROLLER_ERROR_INVALID_PKG_FILENAME = 0x8002cd92, + CELL_CROSS_CONTROLLER_ERROR_INVALID_SIG_FILENAME = 0x8002cd93, CELL_CROSS_CONTROLLER_ERROR_INVALID_ICON_FILENAME = 0x8002cd94, - CELL_CROSS_CONTROLLER_ERROR_INVALID_VALUE = 0x8002cd95, - CELL_CROSS_CONTROLLER_ERROR_PKG_FILE_OPEN = 0x8002cd96, - CELL_CROSS_CONTROLLER_ERROR_SIG_FILE_OPEN = 0x8002cd97, - CELL_CROSS_CONTROLLER_ERROR_ICON_FILE_OPEN = 0x8002cd98, - CELL_CROSS_CONTROLLER_ERROR_INVALID_STATE = 0x8002cd99, - CELL_CROSS_CONTROLLER_ERROR_INVALID_PKG_FILE = 0x8002cd9a, - CELL_CROSS_CONTROLLER_ERROR_INTERNAL = 0x8002cda0, + CELL_CROSS_CONTROLLER_ERROR_INVALID_VALUE = 0x8002cd95, + CELL_CROSS_CONTROLLER_ERROR_PKG_FILE_OPEN = 0x8002cd96, + CELL_CROSS_CONTROLLER_ERROR_SIG_FILE_OPEN = 0x8002cd97, + CELL_CROSS_CONTROLLER_ERROR_ICON_FILE_OPEN = 0x8002cd98, + CELL_CROSS_CONTROLLER_ERROR_INVALID_STATE = 0x8002cd99, + CELL_CROSS_CONTROLLER_ERROR_INVALID_PKG_FILE = 0x8002cd9a, + CELL_CROSS_CONTROLLER_ERROR_INTERNAL = 0x8002cda0, }; enum { CELL_CROSS_CONTROLLER_STATUS_INITIALIZED = 1, - CELL_CROSS_CONTROLLER_STATUS_FINALIZED = 2 + CELL_CROSS_CONTROLLER_STATUS_FINALIZED = 2 }; enum { - CELL_CROSS_CONTROLLER_PKG_APP_VER_LEN = 6, // e.g. 01.00 + CELL_CROSS_CONTROLLER_PKG_APP_VER_LEN = 6, // e.g. 01.00 CELL_CROSS_CONTROLLER_PKG_TITLE_ID_LEN = 10, // e.g. NEKO12345 - CELL_CROSS_CONTROLLER_PKG_TITLE_LEN = 52, // e.g. Cat Simulator 5 + CELL_CROSS_CONTROLLER_PKG_TITLE_LEN = 52, // e.g. Cat Simulator 5 // Undefined helper value CELL_CROSS_CONTROLLER_PARAM_FILE_NAME_LEN = 255, diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellDaisy.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellDaisy.cpp index e0d2926b9..71c0dc7fb 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellDaisy.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellDaisy.cpp @@ -9,21 +9,21 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellDaisyError value) - { - switch (value) { - STR_CASE(CELL_DAISY_ERROR_NO_BEGIN); - STR_CASE(CELL_DAISY_ERROR_INVALID_PORT_ATTACH); - STR_CASE(CELL_DAISY_ERROR_NOT_IMPLEMENTED); - STR_CASE(CELL_DAISY_ERROR_AGAIN); - STR_CASE(CELL_DAISY_ERROR_INVAL); - STR_CASE(CELL_DAISY_ERROR_PERM); - STR_CASE(CELL_DAISY_ERROR_BUSY); - STR_CASE(CELL_DAISY_ERROR_STAT); - } + switch (value) + { + STR_CASE(CELL_DAISY_ERROR_NO_BEGIN); + STR_CASE(CELL_DAISY_ERROR_INVALID_PORT_ATTACH); + STR_CASE(CELL_DAISY_ERROR_NOT_IMPLEMENTED); + STR_CASE(CELL_DAISY_ERROR_AGAIN); + STR_CASE(CELL_DAISY_ERROR_INVAL); + STR_CASE(CELL_DAISY_ERROR_PERM); + STR_CASE(CELL_DAISY_ERROR_BUSY); + STR_CASE(CELL_DAISY_ERROR_STAT); + } - return unknown; - }); + return unknown; + }); } // Temporarily @@ -168,61 +168,60 @@ void cellDaisyScatterGatherInterlock_proceedSequenceNumber(vm::ptr void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellDmuxError value) - { - switch (value) { - STR_CASE(CELL_DMUX_ERROR_ARG); - STR_CASE(CELL_DMUX_ERROR_SEQ); - STR_CASE(CELL_DMUX_ERROR_BUSY); - STR_CASE(CELL_DMUX_ERROR_EMPTY); - STR_CASE(CELL_DMUX_ERROR_FATAL); - } + switch (value) + { + STR_CASE(CELL_DMUX_ERROR_ARG); + STR_CASE(CELL_DMUX_ERROR_SEQ); + STR_CASE(CELL_DMUX_ERROR_BUSY); + STR_CASE(CELL_DMUX_ERROR_EMPTY); + STR_CASE(CELL_DMUX_ERROR_FATAL); + } - return unknown; - }); + return unknown; + }); } /* Demuxer Thread Classes */ @@ -37,14 +37,14 @@ enum { /* http://dvd.sourceforge.net/dvdinfo/mpeghdrs.html */ - PACKET_START_CODE_MASK = 0xffffff00, + PACKET_START_CODE_MASK = 0xffffff00, PACKET_START_CODE_PREFIX = 0x00000100, - PACK_START_CODE = 0x000001ba, + PACK_START_CODE = 0x000001ba, SYSTEM_HEADER_START_CODE = 0x000001bb, - PRIVATE_STREAM_1 = 0x000001bd, - PADDING_STREAM = 0x000001be, - PRIVATE_STREAM_2 = 0x000001bf, + PRIVATE_STREAM_1 = 0x000001bd, + PADDING_STREAM = 0x000001be, + PRIVATE_STREAM_2 = 0x000001bf, }; struct DemuxerStream @@ -54,10 +54,11 @@ struct DemuxerStream u64 userdata; bool discontinuity; - template + template bool get(T& out) { - if (sizeof(T) > size) return false; + if (sizeof(T) > size) + return false; std::memcpy(&out, vm::base(addr), sizeof(T)); addr += sizeof(T); @@ -66,10 +67,11 @@ struct DemuxerStream return true; } - template + template bool peek(T& out, u32 shift = 0) { - if (sizeof(T) + shift > size) return false; + if (sizeof(T) + shift > size) + return false; std::memcpy(&out, vm::base(addr + shift), sizeof(T)); return true; @@ -88,12 +90,12 @@ struct DemuxerStream u64 get_ts(u8 c) { - u8 v[4]; get(v); - return - ((u64{c} & 0x0e) << 29) | - ((u64{v[0]}) << 21) | - ((u64{v[1]} & 0x7e) << 15) | - ((u64{v[2]}) << 7) | (u64{v[3]} >> 1); + u8 v[4]; + get(v); + return ((u64{c} & 0x0e) << 29) | + ((u64{v[0]}) << 21) | + ((u64{v[1]} & 0x7e) << 15) | + ((u64{v[2]}) << 7) | (u64{v[3]} >> 1); } }; @@ -155,9 +157,9 @@ class ElementaryStream std::mutex m_mutex; squeue_t entries; // AU starting addresses - u32 put_count = 0; // number of AU written - u32 got_count = 0; // number of AU obtained by GetAu(Ex) - u32 released = 0; // number of AU released + u32 put_count = 0; // number of AU written + u32 got_count = 0; // number of AU obtained by GetAu(Ex) + u32 released = 0; // number of AU released u32 put; // AU that is being written now @@ -181,10 +183,10 @@ public: const u32 sup2; const vm::ptr cbFunc; const u32 cbArg; - const u32 spec; //addr + const u32 spec; // addr std::vector raw_data; // demultiplexed data stream (managed by demuxer thread) - usz raw_pos = 0; // should be <= raw_data.size() + usz raw_pos = 0; // should be <= raw_data.size() u64 last_dts = CODEC_TS_INVALID; u64 last_pts = CODEC_TS_INVALID; @@ -215,11 +217,7 @@ public: atomic_t is_working = false; Demuxer(u32 addr, u32 size, vm::ptr func, u32 arg) - : ppu_thread({}, "", 0) - , memAddr(addr) - , memSize(size) - , cbFunc(func) - , cbArg(arg) + : ppu_thread({}, "", 0), memAddr(addr), memSize(size), cbFunc(func), cbArg(arg) { } @@ -229,11 +227,11 @@ public: DemuxerStream stream = {}; ElementaryStream* esALL[96]{}; ElementaryStream** esAVC = &esALL[0]; // AVC (max 16 minus M2V count) - //ElementaryStream** esM2V = &esALL[16]; // M2V (max 16 minus AVC count) - //ElementaryStream** esDATA = &esALL[32]; // user data (max 16) + // ElementaryStream** esM2V = &esALL[16]; // M2V (max 16 minus AVC count) + // ElementaryStream** esDATA = &esALL[32]; // user data (max 16) ElementaryStream** esATX = &esALL[48]; // ATRAC3+ (max 16) - //ElementaryStream** esAC3 = &esALL[64]; // AC3 (max 16) - //ElementaryStream** esPCM = &esALL[80]; // LPCM (max 16) + // ElementaryStream** esAC3 = &esALL[64]; // AC3 (max 16) + // ElementaryStream** esPCM = &esALL[80]; // LPCM (max 16) u32 cb_add = 0; @@ -393,7 +391,8 @@ public: auto const size = es.raw_data.size() - es.raw_pos; // size of available new data auto const data = es.raw_data.data() + es.raw_pos; // pointer to available data - if (size < 8) break; // skip if cannot read ATS header + if (size < 8) + break; // skip if cannot read ATS header if (data[0] != 0x0f || data[1] != 0xd0) { @@ -402,13 +401,15 @@ public: u32 frame_size = (((u32{data[2]} & 0x3) << 8) | u32{data[3]}) * 8 + 8; - if (size < frame_size + 8) break; // skip non-complete AU + if (size < frame_size + 8) + break; // skip non-complete AU - if (es.isfull(frame_size + 8)) break; // skip if cannot push AU + if (es.isfull(frame_size + 8)) + break; // skip if cannot push AU es.push_au(frame_size + 8, es.last_dts, es.last_pts, stream.userdata, false /* TODO: set correct value */, 0); - //cellDmux.notice("ATX AU pushed (ats=0x%llx, frame_size=%d)", *(be_t*)data, frame_size); + // cellDmux.notice("ATX AU pushed (ats=0x%llx, frame_size=%d)", *(be_t*)data, frame_size); auto esMsg = vm::ptr::make(memAddr + (cb_add ^= 16)); esMsg->msgType = CELL_DMUX_ES_MSG_TYPE_AU_FOUND; @@ -425,10 +426,22 @@ public: break; } - case 0x1e0: case 0x1e1: case 0x1e2: case 0x1e3: - case 0x1e4: case 0x1e5: case 0x1e6: case 0x1e7: - case 0x1e8: case 0x1e9: case 0x1ea: case 0x1eb: - case 0x1ec: case 0x1ed: case 0x1ee: case 0x1ef: + case 0x1e0: + case 0x1e1: + case 0x1e2: + case 0x1e3: + case 0x1e4: + case 0x1e5: + case 0x1e6: + case 0x1e7: + case 0x1e8: + case 0x1e9: + case 0x1ea: + case 0x1eb: + case 0x1ec: + case 0x1ed: + case 0x1ee: + case 0x1ef: { // video stream (AVC or M2V) DemuxerStream backup = stream; @@ -541,8 +554,8 @@ public: } stream = task.stream; - //cellDmux.notice("*** stream updated(addr=0x%x, size=0x%x, discont=%d, userdata=0x%llx)", - //stream.addr, stream.size, stream.discontinuity, stream.userdata); + // cellDmux.notice("*** stream updated(addr=0x%x, size=0x%x, discont=%d, userdata=0x%llx)", + // stream.addr, stream.size, stream.discontinuity, stream.userdata); break; } @@ -572,31 +585,31 @@ public: ElementaryStream& es = *task.es.es_ptr; // TODO: uncomment when ready to use - //if ((es.fidMajor & -0x10) == 0xe0 && es.fidMinor == 0 && es.sup1 == 1 && !es.sup2) + // if ((es.fidMajor & -0x10) == 0xe0 && es.fidMinor == 0 && es.sup1 == 1 && !es.sup2) //{ // esAVC[es.fidMajor % 16] = task.es.es_ptr; //} - //else if ((es.fidMajor & -0x10) == 0xe0 && es.fidMinor == 0 && !es.sup1 && !es.sup2) + // else if ((es.fidMajor & -0x10) == 0xe0 && es.fidMinor == 0 && !es.sup1 && !es.sup2) //{ // esM2V[es.fidMajor % 16] = task.es.es_ptr; //} - //else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0 && !es.sup1 && !es.sup2) + // else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0 && !es.sup1 && !es.sup2) //{ // esATX[es.fidMinor % 16] = task.es.es_ptr; //} - //else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0x20 && !es.sup1 && !es.sup2) + // else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0x20 && !es.sup1 && !es.sup2) //{ // esDATA[es.fidMinor % 16] = task.es.es_ptr; //} - //else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0x30 && !es.sup1 && !es.sup2) + // else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0x30 && !es.sup1 && !es.sup2) //{ // esAC3[es.fidMinor % 16] = task.es.es_ptr; //} - //else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0x40 && !es.sup1 && !es.sup2) + // else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0x40 && !es.sup1 && !es.sup2) //{ // esPCM[es.fidMinor % 16] = task.es.es_ptr; //} - //else + // else { fmt::throw_exception("dmuxEnableEs: unknown filter (0x%x, 0x%x, 0x%x, 0x%x)", es.fidMajor, es.fidMinor, es.sup1, es.sup2); } @@ -634,7 +647,8 @@ public: // TODO (it's only for AVC, some ATX data may be lost) while (es.isfull(old_size)) { - if (Emu.IsStopped() || is_closed) break; + if (Emu.IsStopped() || is_closed) + break; std::this_thread::sleep_for(1ms); // hack } @@ -685,13 +699,8 @@ public: } }; - PesHeader::PesHeader(DemuxerStream& stream) - : pts(CODEC_TS_INVALID) - , dts(CODEC_TS_INVALID) - , size(0) - , has_ts(false) - , is_ok(false) + : pts(CODEC_TS_INVALID), dts(CODEC_TS_INVALID), size(0), has_ts(false), is_ok(false) { u16 header; if (!stream.get(header)) @@ -756,17 +765,7 @@ PesHeader::PesHeader(DemuxerStream& stream) } ElementaryStream::ElementaryStream(Demuxer* dmux, u32 addr, u32 size, u32 fidMajor, u32 fidMinor, u32 sup1, u32 sup2, vm::ptr cbFunc, u32 cbArg, u32 spec) - : put(utils::align(addr, 128)) - , dmux(dmux) - , memAddr(utils::align(addr, 128)) - , memSize(size - (addr - memAddr)) - , fidMajor(fidMajor) - , fidMinor(fidMinor) - , sup1(sup1) - , sup2(sup2) - , cbFunc(cbFunc) - , cbArg(cbArg) - , spec(spec) + : put(utils::align(addr, 128)), dmux(dmux), memAddr(utils::align(addr, 128)), memSize(size - (addr - memAddr)), fidMajor(fidMajor), fidMinor(fidMinor), sup1(sup1), sup2(sup2), cbFunc(cbFunc), cbArg(cbArg), spec(spec) { } @@ -1071,7 +1070,7 @@ error_code cellDmuxSetStream(u32 handle, u32 streamAddress, u32 streamSize, b8 d if (dmux->is_running.exchange(true)) { - //std::this_thread::sleep_for(1ms); // hack + // std::this_thread::sleep_for(1ms); // hack return CELL_DMUX_ERROR_BUSY; } @@ -1360,26 +1359,26 @@ error_code cellDmuxFlushEs(u32 esHandle) } DECLARE(ppu_module_manager::cellDmux)("cellDmux", []() -{ - REG_FUNC(cellDmux, cellDmuxQueryAttr); - REG_FUNC(cellDmux, cellDmuxQueryAttr2); - REG_FUNC(cellDmux, cellDmuxOpen); - REG_FUNC(cellDmux, cellDmuxOpenEx); - REG_FUNC(cellDmux, cellDmuxOpenExt); // 0xe075fabc - REG_FUNC(cellDmux, cellDmuxOpen2); - REG_FUNC(cellDmux, cellDmuxClose); - REG_FUNC(cellDmux, cellDmuxSetStream); - REG_FUNC(cellDmux, cellDmuxResetStream); - REG_FUNC(cellDmux, cellDmuxResetStreamAndWaitDone); - REG_FUNC(cellDmux, cellDmuxQueryEsAttr); - REG_FUNC(cellDmux, cellDmuxQueryEsAttr2); - REG_FUNC(cellDmux, cellDmuxEnableEs); - REG_FUNC(cellDmux, cellDmuxDisableEs); - REG_FUNC(cellDmux, cellDmuxResetEs); - REG_FUNC(cellDmux, cellDmuxGetAu); - REG_FUNC(cellDmux, cellDmuxPeekAu); - REG_FUNC(cellDmux, cellDmuxGetAuEx); - REG_FUNC(cellDmux, cellDmuxPeekAuEx); - REG_FUNC(cellDmux, cellDmuxReleaseAu); - REG_FUNC(cellDmux, cellDmuxFlushEs); -}); + { + REG_FUNC(cellDmux, cellDmuxQueryAttr); + REG_FUNC(cellDmux, cellDmuxQueryAttr2); + REG_FUNC(cellDmux, cellDmuxOpen); + REG_FUNC(cellDmux, cellDmuxOpenEx); + REG_FUNC(cellDmux, cellDmuxOpenExt); // 0xe075fabc + REG_FUNC(cellDmux, cellDmuxOpen2); + REG_FUNC(cellDmux, cellDmuxClose); + REG_FUNC(cellDmux, cellDmuxSetStream); + REG_FUNC(cellDmux, cellDmuxResetStream); + REG_FUNC(cellDmux, cellDmuxResetStreamAndWaitDone); + REG_FUNC(cellDmux, cellDmuxQueryEsAttr); + REG_FUNC(cellDmux, cellDmuxQueryEsAttr2); + REG_FUNC(cellDmux, cellDmuxEnableEs); + REG_FUNC(cellDmux, cellDmuxDisableEs); + REG_FUNC(cellDmux, cellDmuxResetEs); + REG_FUNC(cellDmux, cellDmuxGetAu); + REG_FUNC(cellDmux, cellDmuxPeekAu); + REG_FUNC(cellDmux, cellDmuxGetAuEx); + REG_FUNC(cellDmux, cellDmuxPeekAuEx); + REG_FUNC(cellDmux, cellDmuxReleaseAu); + REG_FUNC(cellDmux, cellDmuxFlushEs); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellDmux.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellDmux.h index 176716528..9064188e7 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellDmux.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellDmux.h @@ -4,13 +4,13 @@ #include "cellPamf.h" // Error Codes -enum CellDmuxError :u32 +enum CellDmuxError : u32 { - CELL_DMUX_ERROR_ARG = 0x80610201, - CELL_DMUX_ERROR_SEQ = 0x80610202, - CELL_DMUX_ERROR_BUSY = 0x80610203, - CELL_DMUX_ERROR_EMPTY = 0x80610204, - CELL_DMUX_ERROR_FATAL = 0x80610205, + CELL_DMUX_ERROR_ARG = 0x80610201, + CELL_DMUX_ERROR_SEQ = 0x80610202, + CELL_DMUX_ERROR_BUSY = 0x80610203, + CELL_DMUX_ERROR_EMPTY = 0x80610204, + CELL_DMUX_ERROR_FATAL = 0x80610205, }; enum CellDmuxStreamType : s32 @@ -206,14 +206,14 @@ struct CellDmuxResourceSpurs /* struct CellDmuxResource2Ex { - b8 isResourceEx; //true - CellDmuxResourceEx resourceEx; + b8 isResourceEx; //true + CellDmuxResourceEx resourceEx; }; struct CellDmuxResource2NoEx { - b8 isResourceEx; //false - CellDmuxResource resource; + b8 isResourceEx; //false + CellDmuxResource resource; }; */ diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellDmuxPamf.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellDmuxPamf.cpp index 70162d403..e139047d3 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellDmuxPamf.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellDmuxPamf.cpp @@ -5,7 +5,6 @@ #include "cellDmux.h" #include "cellDmuxPamf.h" - vm::gvar g_cell_dmux_core_ops_pamf; vm::gvar g_cell_dmux_core_ops_raw_es; @@ -132,38 +131,38 @@ static void init_gvar(const vm::gvar& var) } DECLARE(ppu_module_manager::cellDmuxPamf)("cellDmuxPamf", [] -{ - REG_VNID(cellDmuxPamf, 0x28b2b7b2, g_cell_dmux_core_ops_pamf).init = [] { - g_cell_dmux_core_ops_pamf->setStream.set(g_fxo->get().func_addr(FIND_FUNC(_CellDmuxCoreOpSetStream))); - g_cell_dmux_core_ops_pamf->queryEsAttr.set(g_fxo->get().func_addr(FIND_FUNC(_CellDmuxCoreOpQueryEsAttr))); - g_cell_dmux_core_ops_pamf->enableEs.set(g_fxo->get().func_addr(FIND_FUNC(_CellDmuxCoreOpEnableEs))); - init_gvar(g_cell_dmux_core_ops_pamf); - }; + REG_VNID(cellDmuxPamf, 0x28b2b7b2, g_cell_dmux_core_ops_pamf).init = [] + { + g_cell_dmux_core_ops_pamf->setStream.set(g_fxo->get().func_addr(FIND_FUNC(_CellDmuxCoreOpSetStream))); + g_cell_dmux_core_ops_pamf->queryEsAttr.set(g_fxo->get().func_addr(FIND_FUNC(_CellDmuxCoreOpQueryEsAttr))); + g_cell_dmux_core_ops_pamf->enableEs.set(g_fxo->get().func_addr(FIND_FUNC(_CellDmuxCoreOpEnableEs))); + init_gvar(g_cell_dmux_core_ops_pamf); + }; - REG_VNID(cellDmuxPamf, 0x9728a0e9, g_cell_dmux_core_ops_raw_es).init = [] - { - g_cell_dmux_core_ops_raw_es->setStream.set(g_fxo->get().func_addr(FIND_FUNC(_CellDmuxCoreOpSetStream))); - g_cell_dmux_core_ops_raw_es->queryEsAttr.set(g_fxo->get().func_addr(FIND_FUNC(_CellDmuxCoreOpQueryEsAttr))); - g_cell_dmux_core_ops_raw_es->enableEs.set(g_fxo->get().func_addr(FIND_FUNC(_CellDmuxCoreOpEnableEs))); - init_gvar(g_cell_dmux_core_ops_raw_es); - }; + REG_VNID(cellDmuxPamf, 0x9728a0e9, g_cell_dmux_core_ops_raw_es).init = [] + { + g_cell_dmux_core_ops_raw_es->setStream.set(g_fxo->get().func_addr(FIND_FUNC(_CellDmuxCoreOpSetStream))); + g_cell_dmux_core_ops_raw_es->queryEsAttr.set(g_fxo->get().func_addr(FIND_FUNC(_CellDmuxCoreOpQueryEsAttr))); + g_cell_dmux_core_ops_raw_es->enableEs.set(g_fxo->get().func_addr(FIND_FUNC(_CellDmuxCoreOpEnableEs))); + init_gvar(g_cell_dmux_core_ops_raw_es); + }; - REG_HIDDEN_FUNC(_CellDmuxCoreOpQueryAttr); - REG_HIDDEN_FUNC(_CellDmuxCoreOpOpen); - REG_HIDDEN_FUNC(_CellDmuxCoreOpClose); - REG_HIDDEN_FUNC(_CellDmuxCoreOpResetStream); - REG_HIDDEN_FUNC(_CellDmuxCoreOpCreateThread); - REG_HIDDEN_FUNC(_CellDmuxCoreOpJoinThread); - REG_HIDDEN_FUNC(_CellDmuxCoreOpSetStream); - REG_HIDDEN_FUNC(_CellDmuxCoreOpSetStream); - REG_HIDDEN_FUNC(_CellDmuxCoreOpFreeMemory); - REG_HIDDEN_FUNC(_CellDmuxCoreOpQueryEsAttr); - REG_HIDDEN_FUNC(_CellDmuxCoreOpQueryEsAttr); - REG_HIDDEN_FUNC(_CellDmuxCoreOpEnableEs); - REG_HIDDEN_FUNC(_CellDmuxCoreOpEnableEs); - REG_HIDDEN_FUNC(_CellDmuxCoreOpDisableEs); - REG_HIDDEN_FUNC(_CellDmuxCoreOpFlushEs); - REG_HIDDEN_FUNC(_CellDmuxCoreOpResetEs); - REG_HIDDEN_FUNC(_CellDmuxCoreOpResetStreamAndWaitDone); -}); + REG_HIDDEN_FUNC(_CellDmuxCoreOpQueryAttr); + REG_HIDDEN_FUNC(_CellDmuxCoreOpOpen); + REG_HIDDEN_FUNC(_CellDmuxCoreOpClose); + REG_HIDDEN_FUNC(_CellDmuxCoreOpResetStream); + REG_HIDDEN_FUNC(_CellDmuxCoreOpCreateThread); + REG_HIDDEN_FUNC(_CellDmuxCoreOpJoinThread); + REG_HIDDEN_FUNC(_CellDmuxCoreOpSetStream); + REG_HIDDEN_FUNC(_CellDmuxCoreOpSetStream); + REG_HIDDEN_FUNC(_CellDmuxCoreOpFreeMemory); + REG_HIDDEN_FUNC(_CellDmuxCoreOpQueryEsAttr); + REG_HIDDEN_FUNC(_CellDmuxCoreOpQueryEsAttr); + REG_HIDDEN_FUNC(_CellDmuxCoreOpEnableEs); + REG_HIDDEN_FUNC(_CellDmuxCoreOpEnableEs); + REG_HIDDEN_FUNC(_CellDmuxCoreOpDisableEs); + REG_HIDDEN_FUNC(_CellDmuxCoreOpFlushEs); + REG_HIDDEN_FUNC(_CellDmuxCoreOpResetEs); + REG_HIDDEN_FUNC(_CellDmuxCoreOpResetStreamAndWaitDone); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellDtcpIpUtility.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellDtcpIpUtility.cpp index 30bc98f6f..148c225c4 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellDtcpIpUtility.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellDtcpIpUtility.cpp @@ -82,18 +82,18 @@ error_code cellDtcpIpSuspendActivationForDebug() } DECLARE(ppu_module_manager::cellDtcpIpUtility)("cellDtcpIpUtility", []() -{ - REG_FUNC(cellDtcpIpUtility, cellDtcpIpRead); - REG_FUNC(cellDtcpIpUtility, cellDtcpIpFinalize); - REG_FUNC(cellDtcpIpUtility, cellDtcpIpActivate); - REG_FUNC(cellDtcpIpUtility, cellDtcpIpOpen); - REG_FUNC(cellDtcpIpUtility, cellDtcpIpCheckActivation); - REG_FUNC(cellDtcpIpUtility, cellDtcpIpInitialize); - REG_FUNC(cellDtcpIpUtility, cellDtcpIpGetDecryptedData); - REG_FUNC(cellDtcpIpUtility, cellDtcpIpStopSequence); - REG_FUNC(cellDtcpIpUtility, cellDtcpIpSeek); - REG_FUNC(cellDtcpIpUtility, cellDtcpIpStartSequence); - REG_FUNC(cellDtcpIpUtility, cellDtcpIpSetEncryptedData); - REG_FUNC(cellDtcpIpUtility, cellDtcpIpClose); - REG_FUNC(cellDtcpIpUtility, cellDtcpIpSuspendActivationForDebug); -}); + { + REG_FUNC(cellDtcpIpUtility, cellDtcpIpRead); + REG_FUNC(cellDtcpIpUtility, cellDtcpIpFinalize); + REG_FUNC(cellDtcpIpUtility, cellDtcpIpActivate); + REG_FUNC(cellDtcpIpUtility, cellDtcpIpOpen); + REG_FUNC(cellDtcpIpUtility, cellDtcpIpCheckActivation); + REG_FUNC(cellDtcpIpUtility, cellDtcpIpInitialize); + REG_FUNC(cellDtcpIpUtility, cellDtcpIpGetDecryptedData); + REG_FUNC(cellDtcpIpUtility, cellDtcpIpStopSequence); + REG_FUNC(cellDtcpIpUtility, cellDtcpIpSeek); + REG_FUNC(cellDtcpIpUtility, cellDtcpIpStartSequence); + REG_FUNC(cellDtcpIpUtility, cellDtcpIpSetEncryptedData); + REG_FUNC(cellDtcpIpUtility, cellDtcpIpClose); + REG_FUNC(cellDtcpIpUtility, cellDtcpIpSuspendActivationForDebug); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellFiber.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellFiber.cpp index 8a9eab748..c22a8e395 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellFiber.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellFiber.cpp @@ -9,24 +9,24 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellFiberError value) - { - switch (value) { - STR_CASE(CELL_FIBER_ERROR_AGAIN); - STR_CASE(CELL_FIBER_ERROR_INVAL); - STR_CASE(CELL_FIBER_ERROR_NOMEM); - STR_CASE(CELL_FIBER_ERROR_DEADLK); - STR_CASE(CELL_FIBER_ERROR_PERM); - STR_CASE(CELL_FIBER_ERROR_BUSY); - STR_CASE(CELL_FIBER_ERROR_ABORT); - STR_CASE(CELL_FIBER_ERROR_STAT); - STR_CASE(CELL_FIBER_ERROR_ALIGN); - STR_CASE(CELL_FIBER_ERROR_NULL_POINTER); - STR_CASE(CELL_FIBER_ERROR_NOSYSINIT); - } + switch (value) + { + STR_CASE(CELL_FIBER_ERROR_AGAIN); + STR_CASE(CELL_FIBER_ERROR_INVAL); + STR_CASE(CELL_FIBER_ERROR_NOMEM); + STR_CASE(CELL_FIBER_ERROR_DEADLK); + STR_CASE(CELL_FIBER_ERROR_PERM); + STR_CASE(CELL_FIBER_ERROR_BUSY); + STR_CASE(CELL_FIBER_ERROR_ABORT); + STR_CASE(CELL_FIBER_ERROR_STAT); + STR_CASE(CELL_FIBER_ERROR_ALIGN); + STR_CASE(CELL_FIBER_ERROR_NULL_POINTER); + STR_CASE(CELL_FIBER_ERROR_NOSYSINIT); + } - return unknown; - }); + return unknown; + }); } error_code _cellFiberPpuInitialize() @@ -721,58 +721,58 @@ error_code cellFiberPpuUtilWorkerControlInitializeWithAttribute(vm::ptr void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_FONT_ERROR_FATAL); - STR_CASE(CELL_FONT_ERROR_INVALID_PARAMETER); - STR_CASE(CELL_FONT_ERROR_UNINITIALIZED); - STR_CASE(CELL_FONT_ERROR_INITIALIZE_FAILED); - STR_CASE(CELL_FONT_ERROR_INVALID_CACHE_BUFFER); - STR_CASE(CELL_FONT_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_FONT_ERROR_ALLOCATION_FAILED); - STR_CASE(CELL_FONT_ERROR_NO_SUPPORT_FONTSET); - STR_CASE(CELL_FONT_ERROR_OPEN_FAILED); - STR_CASE(CELL_FONT_ERROR_READ_FAILED); - STR_CASE(CELL_FONT_ERROR_FONT_OPEN_FAILED); - STR_CASE(CELL_FONT_ERROR_FONT_NOT_FOUND); - STR_CASE(CELL_FONT_ERROR_FONT_OPEN_MAX); - STR_CASE(CELL_FONT_ERROR_FONT_CLOSE_FAILED); - STR_CASE(CELL_FONT_ERROR_ALREADY_OPENED); - STR_CASE(CELL_FONT_ERROR_NO_SUPPORT_FUNCTION); - STR_CASE(CELL_FONT_ERROR_NO_SUPPORT_CODE); - STR_CASE(CELL_FONT_ERROR_NO_SUPPORT_GLYPH); - STR_CASE(CELL_FONT_ERROR_BUFFER_SIZE_NOT_ENOUGH); - STR_CASE(CELL_FONT_ERROR_RENDERER_ALREADY_BIND); - STR_CASE(CELL_FONT_ERROR_RENDERER_UNBIND); - STR_CASE(CELL_FONT_ERROR_RENDERER_INVALID); - STR_CASE(CELL_FONT_ERROR_RENDERER_ALLOCATION_FAILED); - STR_CASE(CELL_FONT_ERROR_ENOUGH_RENDERING_BUFFER); - STR_CASE(CELL_FONT_ERROR_NO_SUPPORT_SURFACE); - } + switch (error) + { + STR_CASE(CELL_FONT_ERROR_FATAL); + STR_CASE(CELL_FONT_ERROR_INVALID_PARAMETER); + STR_CASE(CELL_FONT_ERROR_UNINITIALIZED); + STR_CASE(CELL_FONT_ERROR_INITIALIZE_FAILED); + STR_CASE(CELL_FONT_ERROR_INVALID_CACHE_BUFFER); + STR_CASE(CELL_FONT_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_FONT_ERROR_ALLOCATION_FAILED); + STR_CASE(CELL_FONT_ERROR_NO_SUPPORT_FONTSET); + STR_CASE(CELL_FONT_ERROR_OPEN_FAILED); + STR_CASE(CELL_FONT_ERROR_READ_FAILED); + STR_CASE(CELL_FONT_ERROR_FONT_OPEN_FAILED); + STR_CASE(CELL_FONT_ERROR_FONT_NOT_FOUND); + STR_CASE(CELL_FONT_ERROR_FONT_OPEN_MAX); + STR_CASE(CELL_FONT_ERROR_FONT_CLOSE_FAILED); + STR_CASE(CELL_FONT_ERROR_ALREADY_OPENED); + STR_CASE(CELL_FONT_ERROR_NO_SUPPORT_FUNCTION); + STR_CASE(CELL_FONT_ERROR_NO_SUPPORT_CODE); + STR_CASE(CELL_FONT_ERROR_NO_SUPPORT_GLYPH); + STR_CASE(CELL_FONT_ERROR_BUFFER_SIZE_NOT_ENOUGH); + STR_CASE(CELL_FONT_ERROR_RENDERER_ALREADY_BIND); + STR_CASE(CELL_FONT_ERROR_RENDERER_UNBIND); + STR_CASE(CELL_FONT_ERROR_RENDERER_INVALID); + STR_CASE(CELL_FONT_ERROR_RENDERER_ALLOCATION_FAILED); + STR_CASE(CELL_FONT_ERROR_ENOUGH_RENDERING_BUFFER); + STR_CASE(CELL_FONT_ERROR_NO_SUPPORT_SURFACE); + } - return unknown; - }); + return unknown; + }); } // Functions @@ -223,22 +223,22 @@ error_code cellFontOpenFontset(vm::ptr library, vm::ptrtype) { - case CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN: file = "/dev_flash/data/font/SCE-PS3-RD-R-LATIN.TTF"; break; - case CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN: file = "/dev_flash/data/font/SCE-PS3-RD-L-LATIN.TTF"; break; - case CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN: file = "/dev_flash/data/font/SCE-PS3-RD-B-LATIN.TTF"; break; - case CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN2: file = "/dev_flash/data/font/SCE-PS3-RD-R-LATIN2.TTF"; break; - case CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN2: file = "/dev_flash/data/font/SCE-PS3-RD-L-LATIN2.TTF"; break; - case CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN2: file = "/dev_flash/data/font/SCE-PS3-RD-B-LATIN2.TTF"; break; - case CELL_FONT_TYPE_MATISSE_SERIF_LATIN: file = "/dev_flash/data/font/SCE-PS3-MT-R-LATIN.TTF"; break; - case CELL_FONT_TYPE_NEWRODIN_GOTHIC_JAPANESE: file = "/dev_flash/data/font/SCE-PS3-NR-R-JPN.TTF"; break; - case CELL_FONT_TYPE_NEWRODIN_GOTHIC_LIGHT_JAPANESE: file = "/dev_flash/data/font/SCE-PS3-NR-L-JPN.TTF"; break; - case CELL_FONT_TYPE_NEWRODIN_GOTHIC_BOLD_JAPANESE: file = "/dev_flash/data/font/SCE-PS3-NR-B-JPN.TTF"; break; - case CELL_FONT_TYPE_YD_GOTHIC_KOREAN: file = "/dev_flash/data/font/SCE-PS3-YG-R-KOR.TTF"; break; - case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN: file = "/dev_flash/data/font/SCE-PS3-SR-R-LATIN.TTF"; break; - case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN2: file = "/dev_flash/data/font/SCE-PS3-SR-R-LATIN2.TTF"; break; - case CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND: file = "/dev_flash/data/font/SCE-PS3-VR-R-LATIN.TTF"; break; - case CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND_LATIN2: file = "/dev_flash/data/font/SCE-PS3-VR-R-LATIN2.TTF"; break; - case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_JAPANESE: file = "/dev_flash/data/font/SCE-PS3-SR-R-JPN.TTF"; break; + case CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN: file = "/dev_flash/data/font/SCE-PS3-RD-R-LATIN.TTF"; break; + case CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN: file = "/dev_flash/data/font/SCE-PS3-RD-L-LATIN.TTF"; break; + case CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN: file = "/dev_flash/data/font/SCE-PS3-RD-B-LATIN.TTF"; break; + case CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN2: file = "/dev_flash/data/font/SCE-PS3-RD-R-LATIN2.TTF"; break; + case CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN2: file = "/dev_flash/data/font/SCE-PS3-RD-L-LATIN2.TTF"; break; + case CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN2: file = "/dev_flash/data/font/SCE-PS3-RD-B-LATIN2.TTF"; break; + case CELL_FONT_TYPE_MATISSE_SERIF_LATIN: file = "/dev_flash/data/font/SCE-PS3-MT-R-LATIN.TTF"; break; + case CELL_FONT_TYPE_NEWRODIN_GOTHIC_JAPANESE: file = "/dev_flash/data/font/SCE-PS3-NR-R-JPN.TTF"; break; + case CELL_FONT_TYPE_NEWRODIN_GOTHIC_LIGHT_JAPANESE: file = "/dev_flash/data/font/SCE-PS3-NR-L-JPN.TTF"; break; + case CELL_FONT_TYPE_NEWRODIN_GOTHIC_BOLD_JAPANESE: file = "/dev_flash/data/font/SCE-PS3-NR-B-JPN.TTF"; break; + case CELL_FONT_TYPE_YD_GOTHIC_KOREAN: file = "/dev_flash/data/font/SCE-PS3-YG-R-KOR.TTF"; break; + case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN: file = "/dev_flash/data/font/SCE-PS3-SR-R-LATIN.TTF"; break; + case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN2: file = "/dev_flash/data/font/SCE-PS3-SR-R-LATIN2.TTF"; break; + case CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND: file = "/dev_flash/data/font/SCE-PS3-VR-R-LATIN.TTF"; break; + case CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND_LATIN2: file = "/dev_flash/data/font/SCE-PS3-VR-R-LATIN2.TTF"; break; + case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_JAPANESE: file = "/dev_flash/data/font/SCE-PS3-SR-R-JPN.TTF"; break; case CELL_FONT_TYPE_NEWRODIN_GOTHIC_JP_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_LATIN_SET: @@ -282,10 +282,10 @@ error_code cellFontOpenFontset(vm::ptr library, vm::ptrtype }; + return {CELL_FONT_ERROR_NO_SUPPORT_FONTSET, fontType->type}; } - error_code ret = cellFontOpenFontFile(library, vm::make_str(file), 0, 0, font); //TODO: Find the correct values of subNum, uniqueId + error_code ret = cellFontOpenFontFile(library, vm::make_str(file), 0, 0, font); // TODO: Find the correct values of subNum, uniqueId font->origin = CELL_FONT_OPEN_FONTSET; return ret; @@ -379,15 +379,15 @@ void cellFontRenderSurfaceInit(vm::ptr surface, vm::ptr> 0x1f; const u32 height = h & ~h >> 0x1f; - surface->buffer = buffer; - surface->widthByte = bufferWidthByte; + surface->buffer = buffer; + surface->widthByte = bufferWidthByte; surface->pixelSizeByte = pixelSizeByte; - surface->width = width; - surface->height = height; - surface->sc_x0 = 0; - surface->sc_y0 = 0; - surface->sc_x1 = width; - surface->sc_y1 = height; + surface->width = width; + surface->height = height; + surface->sc_x0 = 0; + surface->sc_y0 = 0; + surface->sc_x1 = width; + surface->sc_y1 = height; } void cellFontRenderSurfaceSetScissor(vm::ptr surface, s32 x0, s32 y0, u32 w, u32 h) @@ -527,8 +527,8 @@ error_code cellFontSetScalePixel(vm::ptr font, f32 w, f32 h) font->scale_y = h; // TODO: - //font->scalePointH = (h * something) / font->resolutionDpiV; - //font->scalePointW = (w * something) / font->resolutionDpiH; + // font->scalePointH = (h * something) / font->resolutionDpiV; + // font->scalePointW = (w * something) / font->resolutionDpiH; return CELL_OK; } @@ -554,7 +554,7 @@ error_code cellFontGetHorizontalLayout(vm::ptr font, vm::ptrstbfont, &ascent, &descent, &lineGap); layout->baseLineY = ascent * scale; - layout->lineHeight = (ascent-descent+lineGap) * scale; + layout->lineHeight = (ascent - descent + lineGap) * scale; layout->effectHeight = lineGap * scale; return CELL_OK; @@ -575,14 +575,14 @@ error_code cellFontBindRenderer(vm::ptr font, vm::ptrsystemReserved[2] = (void *)font->resolutionDpiH; - //renderer->systemReserved[3] = (void *)font->resolutionDpiV; - //renderer->systemReserved[4] = (void *)font->scalePointW; - //renderer->systemReserved[5] = (void *)font->scalePointH; - //renderer->systemReserved[6] = (void *)font->scalePixelW; - //renderer->systemReserved[7] = (void *)font->scalePixelH; - //renderer->systemReserved[8] = *(void **)&font->font_weight; - //renderer->systemReserved[9] = *(void **)&font->field_0x5c; + // renderer->systemReserved[2] = (void *)font->resolutionDpiH; + // renderer->systemReserved[3] = (void *)font->resolutionDpiV; + // renderer->systemReserved[4] = (void *)font->scalePointW; + // renderer->systemReserved[5] = (void *)font->scalePointH; + // renderer->systemReserved[6] = (void *)font->scalePixelW; + // renderer->systemReserved[7] = (void *)font->scalePixelH; + // renderer->systemReserved[8] = *(void **)&font->font_weight; + // renderer->systemReserved[9] = *(void **)&font->field_0x5c; font->renderer_addr = renderer.addr(); @@ -651,21 +651,21 @@ error_code cellFontSetupRenderScalePixel(vm::ptr font, f32 w, f32 h) // TODO: - //if (w == something) + // if (w == something) //{ // w = font->scalePixelW; - //} + // } - //if (h == something) + // if (h == something) //{ // h = font->scalePixelH; - //} + // } - //font->field_0x14 + 0x10 = (w * something) / font->resolutionDpiH; - //font->field_0x14 + 0x14 = (h * something) / font->resolutionDpiV; - //font->field_0x14 + 0x18 = w; - //font->field_0x14 + 0x1c = h; - //font->field_0x78 = 0; + // font->field_0x14 + 0x10 = (w * something) / font->resolutionDpiH; + // font->field_0x14 + 0x14 = (h * something) / font->resolutionDpiV; + // font->field_0x14 + 0x18 = w; + // font->field_0x14 + 0x1c = h; + // font->field_0x78 = 0; return CELL_OK; } @@ -791,7 +791,7 @@ error_code cellFontGetEffectSlant(vm::ptr font, vm::ptr slantPara error_code cellFontGetFontIdCode(vm::ptr font, u32 code, vm::ptr fontId, vm::ptr fontCode) { cellFont.todo("cellFontGetFontIdCode(font=*0x%x, code=%d, fontId=*0x%x, fontCode=*0x%x)", font, code, fontId, fontCode); - + if (fontId) { *fontId = 0; @@ -891,8 +891,8 @@ error_code cellFontGetCharGlyphMetrics(vm::ptr font, u32 code, vm::ptr stbtt_GetCodepointHMetrics(font->stbfont, code, &advanceWidth, &leftSideBearing); // TODO: Add the rest of the information - metrics->width = (x1-x0) * scale; - metrics->height = (y1-y0) * scale; + metrics->width = (x1 - x0) * scale; + metrics->height = (y1 - y0) * scale; metrics->h_bearingX = leftSideBearing * scale; metrics->h_bearingY = 0.f; metrics->h_advance = advanceWidth * scale; @@ -913,10 +913,10 @@ error_code cellFontGraphicsSetFontRGBA(vm::ptr cont } // TODO - //context->field_0x70 = fontRGBA[0]; - //context->field_0x74 = fontRGBA[1]; - //context->field_0x78 = fontRGBA[2]; - //context->field_0x7c = fontRGBA[3]; + // context->field_0x70 = fontRGBA[0]; + // context->field_0x74 = fontRGBA[1]; + // context->field_0x78 = fontRGBA[2]; + // context->field_0x7c = fontRGBA[3]; return CELL_OK; } @@ -960,10 +960,10 @@ error_code cellFontGraphicsSetScalePixel(vm::ptr co } // TODO - //context->field_0x10 = (w * something) / context->field_0x8; - //context->field_0x14 = (h * something) / context->field_0xc; - //context->field_0x18 = w; - //context->field_0x1c = h; + // context->field_0x10 = (w * something) / context->field_0x8; + // context->field_0x14 = (h * something) / context->field_0xc; + // context->field_0x18 = w; + // context->field_0x1c = h; return CELL_OK; } @@ -1017,10 +1017,10 @@ error_code cellFontGlyphSetupVertexesGlyph(vm::ptr glyph, f32 con { cellFont.todo("cellFontGlyphSetupVertexesGlyph(glyph=*0x%x, controlDistance=%f, mappedBuf=*0x%x, mappedBufSize=0x%x, vGlyph=*0x%x, dataSize=*0x%x)", glyph, controlDistance, mappedBuf, mappedBufSize, vGlyph, dataSize); - //if (in_r8) + // if (in_r8) //{ // *in_r8 = 0; // ??? - //} + // } if (!dataSize) { @@ -1043,7 +1043,7 @@ error_code cellFontGlyphSetupVertexesGlyph(vm::ptr glyph, f32 con error_code cellFontGetVerticalLayout(vm::ptr font, vm::ptr layout) { cellFont.todo("cellFontGetVerticalLayout(font=*0x%x, layout=*0x%x)", font, layout); - + if (!layout) { return CELL_FONT_ERROR_INVALID_PARAMETER; @@ -1095,10 +1095,10 @@ error_code cellFontSetScalePoint(vm::ptr font, f32 w, f32 h) } // TODO - //font->scalePointW = w; - //font->scalePointH = h; - //font->scalePixelW = (w * font->resolutionDpiH) / something; - //font->scalePixelH = (h * font->resolutionDpiV) / something; + // font->scalePointW = w; + // font->scalePointH = h; + // font->scalePixelW = (w * font->resolutionDpiH) / something; + // font->scalePixelH = (h * font->resolutionDpiV) / something; return CELL_OK; } @@ -1123,8 +1123,8 @@ error_code cellFontSetupRenderEffectSlant(vm::ptr font, f32 effectSlan } // TODO: - //font->effectSlant = effectSlant; // TODO: probably clamped - //font->field_0x78 = 0; + // font->effectSlant = effectSlant; // TODO: probably clamped + // font->field_0x78 = 0; return CELL_OK; } @@ -1139,10 +1139,10 @@ error_code cellFontGraphicsSetLineRGBA(vm::ptr cont } // TODO - //context->lineColorR = lineRGBA[0]; - //context->lineColorG = lineRGBA[1]; - //context->lineColorB = lineRGBA[2]; - //context->lineColorA = lineRGBA[3]; + // context->lineColorR = lineRGBA[0]; + // context->lineColorG = lineRGBA[1]; + // context->lineColorB = lineRGBA[2]; + // context->lineColorA = lineRGBA[3]; return CELL_OK; } @@ -1156,7 +1156,7 @@ error_code cellFontGraphicsSetDrawType(vm::ptr cont return CELL_FONT_ERROR_INVALID_PARAMETER; } - //context->field_0x42 = type; // TODO + // context->field_0x42 = type; // TODO return CELL_OK; } @@ -1188,72 +1188,72 @@ error_code cellFontGraphicsSetupDrawContext(vm::cptr graphics, } // TODO - //context->magic = 0xcf50; - //context->field_0x50 = something; - //context->field_0x54 = something; - //context->field_0x58 = something; - //context->field_0x5c = something; - //context->field_0x2 = 0; - //context->field_0x8 = 72; - //context->field_0x42 = 1; - //context->field_0x4c = 0; - //context->field_0x4 = 0; - //context->field_0xc = 72; - //context->field_0x14 = 0; - //context->field_0x10 = 0; - //context->field_0x1c = 0; - //context->field_0x18 = 0; - //context->field_0x20 = 0; - //context->field_0x24 = 0; - //context->field_0x28 = 0; - //context->field_0x2c = 0; - //context->field_0x30 = 0; - //context->field_0x34 = 0; - //context->field_0x38 = 0; - //context->field_0x3c = 0; - //context->field_0x40 = 0; - //context->field_0x44 = 0; - //context->field_0x48 = 0; - //context->field_0x7c = something; - //context->field_0x78 = something; - //context->field_0x74 = something; - //context->field_0x70 = something; - //context->lineColorB = 0.0; - //context->lineColorG = 0.0; - //context->lineColorR = 0.0; - //context->lineColorA = something; - //context->field_0xc0 = 0; - //context->field_0x80 = something; - //context->field_0xbc = something; - //context->field_0xa8 = something; - //context->field_0x94 = something; - //context->field_0xb8 = 0; - //context->field_0xb4 = 0; - //context->field_0xb0 = 0; - //context->field_0xac = 0; - //context->field_0xa4 = 0; - //context->field_0xa0 = 0; - //context->field_0x9c = 0; - //context->field_0x98 = 0; - //context->field_0x90 = 0; - //context->field_0x8c = 0; - //context->field_0x88 = 0; - //context->field_0x84 = 0; - //context->field_0xfc = 0; - //context->field_0xf8 = 0; - //context->field_0xf4 = 0; - //context->field_0xf0 = 0; - //context->field_0xec = 0; - //context->field_0xe8 = 0; - //context->field_0xe4 = 0; - //context->field_0xe0 = 0; - //context->field_0xdc = 0; - //context->field_0xd8 = 0; - //context->field_0xd4 = 0; - //context->field_0xd0 = 0; - //context->field_0xcc = 0; - //context->field_0xc8 = 0; - //context->field_0xc4 = 0; + // context->magic = 0xcf50; + // context->field_0x50 = something; + // context->field_0x54 = something; + // context->field_0x58 = something; + // context->field_0x5c = something; + // context->field_0x2 = 0; + // context->field_0x8 = 72; + // context->field_0x42 = 1; + // context->field_0x4c = 0; + // context->field_0x4 = 0; + // context->field_0xc = 72; + // context->field_0x14 = 0; + // context->field_0x10 = 0; + // context->field_0x1c = 0; + // context->field_0x18 = 0; + // context->field_0x20 = 0; + // context->field_0x24 = 0; + // context->field_0x28 = 0; + // context->field_0x2c = 0; + // context->field_0x30 = 0; + // context->field_0x34 = 0; + // context->field_0x38 = 0; + // context->field_0x3c = 0; + // context->field_0x40 = 0; + // context->field_0x44 = 0; + // context->field_0x48 = 0; + // context->field_0x7c = something; + // context->field_0x78 = something; + // context->field_0x74 = something; + // context->field_0x70 = something; + // context->lineColorB = 0.0; + // context->lineColorG = 0.0; + // context->lineColorR = 0.0; + // context->lineColorA = something; + // context->field_0xc0 = 0; + // context->field_0x80 = something; + // context->field_0xbc = something; + // context->field_0xa8 = something; + // context->field_0x94 = something; + // context->field_0xb8 = 0; + // context->field_0xb4 = 0; + // context->field_0xb0 = 0; + // context->field_0xac = 0; + // context->field_0xa4 = 0; + // context->field_0xa0 = 0; + // context->field_0x9c = 0; + // context->field_0x98 = 0; + // context->field_0x90 = 0; + // context->field_0x8c = 0; + // context->field_0x88 = 0; + // context->field_0x84 = 0; + // context->field_0xfc = 0; + // context->field_0xf8 = 0; + // context->field_0xf4 = 0; + // context->field_0xf0 = 0; + // context->field_0xec = 0; + // context->field_0xe8 = 0; + // context->field_0xe4 = 0; + // context->field_0xe0 = 0; + // context->field_0xdc = 0; + // context->field_0xd8 = 0; + // context->field_0xd4 = 0; + // context->field_0xd0 = 0; + // context->field_0xcc = 0; + // context->field_0xc8 = 0; + // context->field_0xc4 = 0; return CELL_OK; } @@ -1364,20 +1364,20 @@ error_code cellFontDeleteGlyph(vm::ptr font, vm::ptr gl error_code cellFontExtend(u32 a1, u32 a2, u32 a3) { cellFont.todo("cellFontExtend(a1=0x%x, a2=0x%x, a3=0x%x)", a1, a2, a3); - //In a test I did: a1=0xcfe00000, a2=0x0, a3=(pointer to something) + // In a test I did: a1=0xcfe00000, a2=0x0, a3=(pointer to something) if (a1 == 0xcfe00000) { if (a2 != 0 || a3 == 0) { - //Something happens + // Something happens } if (vm::read32(a3) == 0u) { - //Something happens + // Something happens } - //Something happens + // Something happens } - //Something happens? + // Something happens? return CELL_OK; } @@ -1728,21 +1728,21 @@ error_code cellFontSetupRenderScalePoint(vm::ptr font, f32 w, f32 h) // TODO: - //if (w == something) + // if (w == something) //{ // w = font->scalePointW; - //} + // } - //if (h == something) + // if (h == something) //{ // h = font->scalePointH; - //} + // } - //font->field_0x14 + 0x10 = w; - //font->field_0x14 + 0x14 = h; - //font->field_0x14 + 0x18 = (w * font->resolutionDpiH / something; - //font->field_0x14 + 0x1c = (h * font->resolutionDpiV / something; - //font->field_0x78 = 0; + // font->field_0x14 + 0x10 = w; + // font->field_0x14 + 0x14 = h; + // font->field_0x14 + 0x18 = (w * font->resolutionDpiH / something; + // font->field_0x14 + 0x1c = (h * font->resolutionDpiV / something; + // font->field_0x78 = 0; return CELL_OK; } @@ -1763,23 +1763,23 @@ error_code cellFontGlyphGetVerticalShift(vm::ptr glyph, vm::ptrOutline.generateEnv + 0x4c; - //fVar2 = glyph->Outline.generateEnv + 0x48; + // fVar1 = glyph->Outline.generateEnv + 0x4c; + // fVar2 = glyph->Outline.generateEnv + 0x48; - //if (fVar1 == something) + // if (fVar1 == something) //{ // fVar1 = (glyph->Outline.generateEnv + 0x4) / (glyph->Outline.generateEnv + 0x14) * (glyph->Outline.generateEnv + 0x18); - //} + // } - //if (shiftX) + // if (shiftX) //{ // *shiftX = glyph->Outline.generateEnv + 0x38; - //} + // } - //if (shiftY) + // if (shiftY) //{ // *shiftY = -fVar2 + fVar1 + (glyph->Outline.generateEnv + 0x3c); - //} + // } return CELL_OK; } @@ -2016,10 +2016,10 @@ error_code cellFontGraphicsGetFontRGBA(vm::ptr cont } // TODO - //fontRGBA[0] = context->field_0x70; - //fontRGBA[1] = context->field_0x74; - //fontRGBA[2] = context->field_0x78; - //fontRGBA[3] = context->field_0x7c; + // fontRGBA[0] = context->field_0x70; + // fontRGBA[1] = context->field_0x74; + // fontRGBA[2] = context->field_0x78; + // fontRGBA[3] = context->field_0x7c; return CELL_OK; } @@ -2035,7 +2035,7 @@ error_code cellFontGlyphGetOutlineVertexes(vm::ptr glyph, f32 con if (!bbox) { - //bbox = something; // TODO + // bbox = something; // TODO } if (glyph->Outline.contoursCount == 0) @@ -2048,10 +2048,10 @@ error_code cellFontGlyphGetOutlineVertexes(vm::ptr glyph, f32 con vcount[3] = 0; } - //if (in_r7) + // if (in_r7) //{ // *in_r7 = 0; // ??? - //} + // } return CELL_OK; } @@ -2169,7 +2169,6 @@ error_code cellFontGetRenderEffectSlant(vm::ptr font, vm::ptr eff return CELL_OK; } - error_code cellFontGetScalePoint(vm::ptr font, vm::ptr w, vm::ptr h) { cellFont.todo("cellFontGetScalePoint(font=*0x%x, w=*0x%x, h=*0x%x)", font, w, h); @@ -2192,7 +2191,6 @@ error_code cellFontGetScalePoint(vm::ptr font, vm::ptr w, vm::ptr return CELL_OK; } - error_code cellFontGraphicsGetLineRGBA(vm::ptr context, vm::ptr lineRGBA) { cellFont.todo("cellFontGraphicsGetLineRGBA(context=*0x%x, lineRGBA=*0x%x)", context, lineRGBA); @@ -2208,10 +2206,10 @@ error_code cellFontGraphicsGetLineRGBA(vm::ptr cont } // TODO - //lineRGBA[0] = context->lineColorR; - //lineRGBA[1] = context->lineColorG; - //lineRGBA[2] = context->lineColorB; - //lineRGBA[3] = context->lineColorA; + // lineRGBA[0] = context->lineColorR; + // lineRGBA[1] = context->lineColorG; + // lineRGBA[2] = context->lineColorB; + // lineRGBA[3] = context->lineColorA; return CELL_OK; } @@ -2229,90 +2227,89 @@ error_code cellFontStatic() } DECLARE(ppu_module_manager::cellFont)("cellFont", []() -{ - - REG_FUNC(cellFont, cellFontSetFontsetOpenMode); - REG_FUNC(cellFont, cellFontSetFontOpenMode); - REG_FUNC(cellFont, cellFontCreateRenderer); - REG_FUNC(cellFont, cellFontGetHorizontalLayout); - REG_FUNC(cellFont, cellFontDestroyRenderer); - REG_FUNC(cellFont, cellFontSetupRenderScalePixel); - REG_FUNC(cellFont, cellFontOpenFontInstance); - REG_FUNC(cellFont, cellFontSetScalePixel); - REG_FUNC(cellFont, cellFontGetRenderCharGlyphMetrics); - REG_FUNC(cellFont, cellFontEndLibrary); - REG_FUNC(cellFont, cellFontBindRenderer); - REG_FUNC(cellFont, cellFontEnd); - REG_FUNC(cellFont, cellFontSetEffectSlant); - REG_FUNC(cellFont, cellFontGetEffectSlant); - REG_FUNC(cellFont, cellFontRenderCharGlyphImage); - REG_FUNC(cellFont, cellFontRenderSurfaceInit); - REG_FUNC(cellFont, cellFontGetFontIdCode); - REG_FUNC(cellFont, cellFontOpenFontset); - REG_FUNC(cellFont, cellFontCloseFont); - REG_FUNC(cellFont, cellFontRenderSurfaceSetScissor); - REG_FUNC(cellFont, cellFontGetCharGlyphMetrics); - REG_FUNC(cellFont, cellFontInitializeWithRevision); - REG_FUNC(cellFont, cellFontGraphicsSetFontRGBA); - REG_FUNC(cellFont, cellFontOpenFontsetOnMemory); - REG_FUNC(cellFont, cellFontOpenFontFile); - REG_FUNC(cellFont, cellFontGraphicsSetScalePixel); - REG_FUNC(cellFont, cellFontGraphicsGetScalePixel); - REG_FUNC(cellFont, cellFontSetEffectWeight); - REG_FUNC(cellFont, cellFontGlyphSetupVertexesGlyph); - REG_FUNC(cellFont, cellFontGetVerticalLayout); - REG_FUNC(cellFont, cellFontGetRenderCharGlyphMetricsVertical); - REG_FUNC(cellFont, cellFontSetScalePoint); - REG_FUNC(cellFont, cellFontSetupRenderEffectSlant); - REG_FUNC(cellFont, cellFontGraphicsSetLineRGBA); - REG_FUNC(cellFont, cellFontGraphicsSetDrawType); - REG_FUNC(cellFont, cellFontEndGraphics); - REG_FUNC(cellFont, cellFontGraphicsSetupDrawContext); - REG_FUNC(cellFont, cellFontOpenFontMemory); - REG_FUNC(cellFont, cellFontSetupRenderEffectWeight); - REG_FUNC(cellFont, cellFontGlyphGetOutlineControlDistance); - REG_FUNC(cellFont, cellFontGlyphGetVertexesGlyphSize); - REG_FUNC(cellFont, cellFontGenerateCharGlyph); - REG_FUNC(cellFont, cellFontDeleteGlyph); - REG_FUNC(cellFont, cellFontExtend); - REG_FUNC(cellFont, cellFontRenderCharGlyphImageVertical); - REG_FUNC(cellFont, cellFontSetResolutionDpi); - REG_FUNC(cellFont, cellFontGetCharGlyphMetricsVertical); - REG_FUNC(cellFont, cellFontUnbindRenderer); - REG_FUNC(cellFont, cellFontGetRevisionFlags); - REG_FUNC(cellFont, cellFontGetRenderEffectWeight); - REG_FUNC(cellFont, cellFontGraphicsGetDrawType); - REG_FUNC(cellFont, cellFontGetKerning); - REG_FUNC(cellFont, cellFontGetRenderScaledKerning); - REG_FUNC(cellFont, cellFontGetRenderScalePixel); - REG_FUNC(cellFont, cellFontGlyphGetScalePixel); - REG_FUNC(cellFont, cellFontGlyphGetHorizontalShift); - REG_FUNC(cellFont, cellFontRenderCharGlyphImageHorizontal); - REG_FUNC(cellFont, cellFontGetEffectWeight); - REG_FUNC(cellFont, cellFontGetScalePixel); - REG_FUNC(cellFont, cellFontClearFileCache); - REG_FUNC(cellFont, cellFontAdjustFontScaling); - REG_FUNC(cellFont, cellFontSetupRenderScalePoint); - REG_FUNC(cellFont, cellFontGlyphGetVerticalShift); - REG_FUNC(cellFont, cellFontGetGlyphExpandBufferInfo); - REG_FUNC(cellFont, cellFontGetLibrary); - REG_FUNC(cellFont, cellFontVertexesGlyphRelocate); - REG_FUNC(cellFont, cellFontGetInitializedRevisionFlags); - REG_FUNC(cellFont, cellFontGetResolutionDpi); - REG_FUNC(cellFont, cellFontGlyphRenderImageVertical); - REG_FUNC(cellFont, cellFontGlyphRenderImageHorizontal); - REG_FUNC(cellFont, cellFontAdjustGlyphExpandBuffer); - REG_FUNC(cellFont, cellFontGetRenderScalePoint); - REG_FUNC(cellFont, cellFontGraphicsGetFontRGBA); - REG_FUNC(cellFont, cellFontGlyphGetOutlineVertexes); - REG_FUNC(cellFont, cellFontDelete); - REG_FUNC(cellFont, cellFontPatchWorks); - REG_FUNC(cellFont, cellFontGlyphRenderImage); - REG_FUNC(cellFont, cellFontGetBindingRenderer); - REG_FUNC(cellFont, cellFontGenerateCharGlyphVertical); - REG_FUNC(cellFont, cellFontGetRenderEffectSlant); - REG_FUNC(cellFont, cellFontGetScalePoint); - REG_FUNC(cellFont, cellFontGraphicsGetLineRGBA); - REG_FUNC(cellFont, cellFontControl); - REG_FUNC(cellFont, cellFontStatic); -}); + { + REG_FUNC(cellFont, cellFontSetFontsetOpenMode); + REG_FUNC(cellFont, cellFontSetFontOpenMode); + REG_FUNC(cellFont, cellFontCreateRenderer); + REG_FUNC(cellFont, cellFontGetHorizontalLayout); + REG_FUNC(cellFont, cellFontDestroyRenderer); + REG_FUNC(cellFont, cellFontSetupRenderScalePixel); + REG_FUNC(cellFont, cellFontOpenFontInstance); + REG_FUNC(cellFont, cellFontSetScalePixel); + REG_FUNC(cellFont, cellFontGetRenderCharGlyphMetrics); + REG_FUNC(cellFont, cellFontEndLibrary); + REG_FUNC(cellFont, cellFontBindRenderer); + REG_FUNC(cellFont, cellFontEnd); + REG_FUNC(cellFont, cellFontSetEffectSlant); + REG_FUNC(cellFont, cellFontGetEffectSlant); + REG_FUNC(cellFont, cellFontRenderCharGlyphImage); + REG_FUNC(cellFont, cellFontRenderSurfaceInit); + REG_FUNC(cellFont, cellFontGetFontIdCode); + REG_FUNC(cellFont, cellFontOpenFontset); + REG_FUNC(cellFont, cellFontCloseFont); + REG_FUNC(cellFont, cellFontRenderSurfaceSetScissor); + REG_FUNC(cellFont, cellFontGetCharGlyphMetrics); + REG_FUNC(cellFont, cellFontInitializeWithRevision); + REG_FUNC(cellFont, cellFontGraphicsSetFontRGBA); + REG_FUNC(cellFont, cellFontOpenFontsetOnMemory); + REG_FUNC(cellFont, cellFontOpenFontFile); + REG_FUNC(cellFont, cellFontGraphicsSetScalePixel); + REG_FUNC(cellFont, cellFontGraphicsGetScalePixel); + REG_FUNC(cellFont, cellFontSetEffectWeight); + REG_FUNC(cellFont, cellFontGlyphSetupVertexesGlyph); + REG_FUNC(cellFont, cellFontGetVerticalLayout); + REG_FUNC(cellFont, cellFontGetRenderCharGlyphMetricsVertical); + REG_FUNC(cellFont, cellFontSetScalePoint); + REG_FUNC(cellFont, cellFontSetupRenderEffectSlant); + REG_FUNC(cellFont, cellFontGraphicsSetLineRGBA); + REG_FUNC(cellFont, cellFontGraphicsSetDrawType); + REG_FUNC(cellFont, cellFontEndGraphics); + REG_FUNC(cellFont, cellFontGraphicsSetupDrawContext); + REG_FUNC(cellFont, cellFontOpenFontMemory); + REG_FUNC(cellFont, cellFontSetupRenderEffectWeight); + REG_FUNC(cellFont, cellFontGlyphGetOutlineControlDistance); + REG_FUNC(cellFont, cellFontGlyphGetVertexesGlyphSize); + REG_FUNC(cellFont, cellFontGenerateCharGlyph); + REG_FUNC(cellFont, cellFontDeleteGlyph); + REG_FUNC(cellFont, cellFontExtend); + REG_FUNC(cellFont, cellFontRenderCharGlyphImageVertical); + REG_FUNC(cellFont, cellFontSetResolutionDpi); + REG_FUNC(cellFont, cellFontGetCharGlyphMetricsVertical); + REG_FUNC(cellFont, cellFontUnbindRenderer); + REG_FUNC(cellFont, cellFontGetRevisionFlags); + REG_FUNC(cellFont, cellFontGetRenderEffectWeight); + REG_FUNC(cellFont, cellFontGraphicsGetDrawType); + REG_FUNC(cellFont, cellFontGetKerning); + REG_FUNC(cellFont, cellFontGetRenderScaledKerning); + REG_FUNC(cellFont, cellFontGetRenderScalePixel); + REG_FUNC(cellFont, cellFontGlyphGetScalePixel); + REG_FUNC(cellFont, cellFontGlyphGetHorizontalShift); + REG_FUNC(cellFont, cellFontRenderCharGlyphImageHorizontal); + REG_FUNC(cellFont, cellFontGetEffectWeight); + REG_FUNC(cellFont, cellFontGetScalePixel); + REG_FUNC(cellFont, cellFontClearFileCache); + REG_FUNC(cellFont, cellFontAdjustFontScaling); + REG_FUNC(cellFont, cellFontSetupRenderScalePoint); + REG_FUNC(cellFont, cellFontGlyphGetVerticalShift); + REG_FUNC(cellFont, cellFontGetGlyphExpandBufferInfo); + REG_FUNC(cellFont, cellFontGetLibrary); + REG_FUNC(cellFont, cellFontVertexesGlyphRelocate); + REG_FUNC(cellFont, cellFontGetInitializedRevisionFlags); + REG_FUNC(cellFont, cellFontGetResolutionDpi); + REG_FUNC(cellFont, cellFontGlyphRenderImageVertical); + REG_FUNC(cellFont, cellFontGlyphRenderImageHorizontal); + REG_FUNC(cellFont, cellFontAdjustGlyphExpandBuffer); + REG_FUNC(cellFont, cellFontGetRenderScalePoint); + REG_FUNC(cellFont, cellFontGraphicsGetFontRGBA); + REG_FUNC(cellFont, cellFontGlyphGetOutlineVertexes); + REG_FUNC(cellFont, cellFontDelete); + REG_FUNC(cellFont, cellFontPatchWorks); + REG_FUNC(cellFont, cellFontGlyphRenderImage); + REG_FUNC(cellFont, cellFontGetBindingRenderer); + REG_FUNC(cellFont, cellFontGenerateCharGlyphVertical); + REG_FUNC(cellFont, cellFontGetRenderEffectSlant); + REG_FUNC(cellFont, cellFontGetScalePoint); + REG_FUNC(cellFont, cellFontGraphicsGetLineRGBA); + REG_FUNC(cellFont, cellFontControl); + REG_FUNC(cellFont, cellFontStatic); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellFont.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellFont.h index 7b6e2ccf5..c3bf9c41a 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellFont.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellFont.h @@ -5,93 +5,93 @@ // Error codes enum CellFontError : u32 { - CELL_FONT_ERROR_FATAL = 0x80540001, - CELL_FONT_ERROR_INVALID_PARAMETER = 0x80540002, - CELL_FONT_ERROR_UNINITIALIZED = 0x80540003, - CELL_FONT_ERROR_INITIALIZE_FAILED = 0x80540004, - CELL_FONT_ERROR_INVALID_CACHE_BUFFER = 0x80540005, - CELL_FONT_ERROR_ALREADY_INITIALIZED = 0x80540006, - CELL_FONT_ERROR_ALLOCATION_FAILED = 0x80540007, - CELL_FONT_ERROR_NO_SUPPORT_FONTSET = 0x80540008, - CELL_FONT_ERROR_OPEN_FAILED = 0x80540009, - CELL_FONT_ERROR_READ_FAILED = 0x8054000a, - CELL_FONT_ERROR_FONT_OPEN_FAILED = 0x8054000b, - CELL_FONT_ERROR_FONT_NOT_FOUND = 0x8054000c, - CELL_FONT_ERROR_FONT_OPEN_MAX = 0x8054000d, - CELL_FONT_ERROR_FONT_CLOSE_FAILED = 0x8054000e, - CELL_FONT_ERROR_ALREADY_OPENED = 0x8054000f, - CELL_FONT_ERROR_NO_SUPPORT_FUNCTION = 0x80540010, - CELL_FONT_ERROR_NO_SUPPORT_CODE = 0x80540011, - CELL_FONT_ERROR_NO_SUPPORT_GLYPH = 0x80540012, - CELL_FONT_ERROR_BUFFER_SIZE_NOT_ENOUGH = 0x80540016, - CELL_FONT_ERROR_RENDERER_ALREADY_BIND = 0x80540020, - CELL_FONT_ERROR_RENDERER_UNBIND = 0x80540021, - CELL_FONT_ERROR_RENDERER_INVALID = 0x80540022, + CELL_FONT_ERROR_FATAL = 0x80540001, + CELL_FONT_ERROR_INVALID_PARAMETER = 0x80540002, + CELL_FONT_ERROR_UNINITIALIZED = 0x80540003, + CELL_FONT_ERROR_INITIALIZE_FAILED = 0x80540004, + CELL_FONT_ERROR_INVALID_CACHE_BUFFER = 0x80540005, + CELL_FONT_ERROR_ALREADY_INITIALIZED = 0x80540006, + CELL_FONT_ERROR_ALLOCATION_FAILED = 0x80540007, + CELL_FONT_ERROR_NO_SUPPORT_FONTSET = 0x80540008, + CELL_FONT_ERROR_OPEN_FAILED = 0x80540009, + CELL_FONT_ERROR_READ_FAILED = 0x8054000a, + CELL_FONT_ERROR_FONT_OPEN_FAILED = 0x8054000b, + CELL_FONT_ERROR_FONT_NOT_FOUND = 0x8054000c, + CELL_FONT_ERROR_FONT_OPEN_MAX = 0x8054000d, + CELL_FONT_ERROR_FONT_CLOSE_FAILED = 0x8054000e, + CELL_FONT_ERROR_ALREADY_OPENED = 0x8054000f, + CELL_FONT_ERROR_NO_SUPPORT_FUNCTION = 0x80540010, + CELL_FONT_ERROR_NO_SUPPORT_CODE = 0x80540011, + CELL_FONT_ERROR_NO_SUPPORT_GLYPH = 0x80540012, + CELL_FONT_ERROR_BUFFER_SIZE_NOT_ENOUGH = 0x80540016, + CELL_FONT_ERROR_RENDERER_ALREADY_BIND = 0x80540020, + CELL_FONT_ERROR_RENDERER_UNBIND = 0x80540021, + CELL_FONT_ERROR_RENDERER_INVALID = 0x80540022, CELL_FONT_ERROR_RENDERER_ALLOCATION_FAILED = 0x80540023, - CELL_FONT_ERROR_ENOUGH_RENDERING_BUFFER = 0x80540024, - CELL_FONT_ERROR_NO_SUPPORT_SURFACE = 0x80540040, + CELL_FONT_ERROR_ENOUGH_RENDERING_BUFFER = 0x80540024, + CELL_FONT_ERROR_NO_SUPPORT_SURFACE = 0x80540040, }; // Font Set Types enum { - CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN = 0x00000000, - CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN = 0x00000001, - CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN = 0x00000002, - CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN2 = 0x00000018, - CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN2 = 0x00000019, - CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN2 = 0x0000001a, - CELL_FONT_TYPE_MATISSE_SERIF_LATIN = 0x00000020, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_JAPANESE = 0x00000008, + CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN = 0x00000000, + CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN = 0x00000001, + CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN = 0x00000002, + CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN2 = 0x00000018, + CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN2 = 0x00000019, + CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN2 = 0x0000001a, + CELL_FONT_TYPE_MATISSE_SERIF_LATIN = 0x00000020, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_JAPANESE = 0x00000008, CELL_FONT_TYPE_NEWRODIN_GOTHIC_LIGHT_JAPANESE = 0x00000009, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_BOLD_JAPANESE = 0x0000000a, - CELL_FONT_TYPE_YD_GOTHIC_KOREAN = 0x0000000c, - CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN = 0x00000040, - CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN2 = 0x00000041, - CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND = 0x00000043, - CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND_LATIN2 = 0x00000044, - CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_JAPANESE = 0x00000048, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_BOLD_JAPANESE = 0x0000000a, + CELL_FONT_TYPE_YD_GOTHIC_KOREAN = 0x0000000c, + CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN = 0x00000040, + CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN2 = 0x00000041, + CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND = 0x00000043, + CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND_LATIN2 = 0x00000044, + CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_JAPANESE = 0x00000048, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_JP_SET = 0x00000100, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_LATIN_SET = 0x00000101, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_SET = 0x00000104, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_SET = 0x00000204, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_SET = 0x00000201, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_SET = 0x00000108, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_RODIN_SET = 0x00000109, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_RODIN2_SET = 0x00000209, - CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_TCH_SET = 0x0000010a, - CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN_TCH_SET = 0x0000010b, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_JP_SET = 0x00000100, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_LATIN_SET = 0x00000101, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_SET = 0x00000104, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_SET = 0x00000204, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_SET = 0x00000201, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_SET = 0x00000108, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_RODIN_SET = 0x00000109, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_RODIN2_SET = 0x00000209, + CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_TCH_SET = 0x0000010a, + CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN_TCH_SET = 0x0000010b, CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN2_TCH_SET = 0x0000020b, - CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_SCH_SET = 0x0000010c, - CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN_SCH_SET = 0x0000010d, + CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_SCH_SET = 0x0000010c, + CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN_SCH_SET = 0x0000010d, CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN2_SCH_SET = 0x0000020d, - CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_RSANS_SET = 0x00300104, - CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_RSANS_SET = 0x00300105, - CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_JP_SET = 0x00300107, - CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_YG_DFHEI5_RSANS_SET = 0x00300109, - CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS_SET = 0x0030010F, - CELL_FONT_TYPE_VAGR_SEURAT_CAPIE_MARU_GOTHIC_RSANS_SET = 0x00300124, + CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_RSANS_SET = 0x00300104, + CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_RSANS_SET = 0x00300105, + CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_JP_SET = 0x00300107, + CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_YG_DFHEI5_RSANS_SET = 0x00300109, + CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS_SET = 0x0030010F, + CELL_FONT_TYPE_VAGR_SEURAT_CAPIE_MARU_GOTHIC_RSANS_SET = 0x00300124, CELL_FONT_TYPE_VAGR_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS_SET = 0x00300129, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_LIGHT_SET = 0x00040100, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN_LIGHT_SET = 0x00040101, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_LIGHT_SET = 0x00040100, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN_LIGHT_SET = 0x00040101, CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_LIGHT_SET = 0x00040201, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_LIGHT_SET = 0x00040104, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_LIGHT_SET = 0x00040204, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_BOLD_SET = 0x00070100, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN_BOLD_SET = 0x00070101, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_BOLD_SET = 0x00070201, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_BOLD_SET = 0x00070104, - CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_BOLD_SET = 0x00070204, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_LIGHT_SET = 0x00040104, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_LIGHT_SET = 0x00040204, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_BOLD_SET = 0x00070100, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN_BOLD_SET = 0x00070101, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_BOLD_SET = 0x00070201, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_BOLD_SET = 0x00070104, + CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_BOLD_SET = 0x00070204, - CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_RSANS2_SET = 0x00300204, - CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_RSANS2_SET = 0x00300205, - CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET = 0x00300209, + CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_RSANS2_SET = 0x00300204, + CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_RSANS2_SET = 0x00300205, + CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET = 0x00300209, CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET = 0x0030020F, - CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_VAGR2_SET = 0x00300229, - CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_VAGR2_SET = 0x00300224, + CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_VAGR2_SET = 0x00300229, + CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_VAGR2_SET = 0x00300224, }; enum @@ -101,24 +101,24 @@ enum enum { - CELL_FONT_MAP_FONT = 0, + CELL_FONT_MAP_FONT = 0, CELL_FONT_MAP_UNICODE = 1, }; enum { - CELL_FONT_OPEN_MODE_DEFAULT = 0, + CELL_FONT_OPEN_MODE_DEFAULT = 0, CELL_FONT_OPEN_MODE_IGNORE_VERTICAL_METRICS = 1, }; enum { - CELL_FONT_GRAPHICS_DRAW_TYPE_MONO = 0, - CELL_FONT_GRAPHICS_DRAW_TYPE_COLOR = 1, + CELL_FONT_GRAPHICS_DRAW_TYPE_MONO = 0, + CELL_FONT_GRAPHICS_DRAW_TYPE_COLOR = 1, CELL_FONT_GRAPHICS_DRAW_TYPE_COLOR_REVERSE = 2, }; -//Custom enum to determine the origin of a CellFont object +// Custom enum to determine the origin of a CellFont object enum { CELL_FONT_OPEN_FONTSET, @@ -129,7 +129,6 @@ enum constexpr f32 CELL_FONT_GLYPH_OUTLINE_CONTROL_DISTANCE_DEFAULT = 0.125f; - 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); @@ -138,10 +137,10 @@ using CellFontCallocCallback = vm::ptr(vm::ptr arg, u32 num, u32 siz struct CellFontMemoryInterface { vm::bptr arg; - vm::bptr malloc; - vm::bptr free; + vm::bptr malloc; + vm::bptr free; vm::bptr realloc; - vm::bptr calloc; + vm::bptr calloc; }; struct CellFontEntry diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellFontFT.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellFontFT.cpp index 3d50e1073..f1a2a50f1 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellFontFT.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellFontFT.cpp @@ -36,7 +36,7 @@ error_code cellFontInitLibraryFreeType(vm::ptr config, cellFontFT.todo("cellFontInitLibraryFreeType(config=*0x%x, lib=**0x%x)", config, lib); uint64_t revisionFlags = 0LL; - //cellFontFTGetStubRevisionFlags(&revisionFlags); + // cellFontFTGetStubRevisionFlags(&revisionFlags); return cellFontInitLibraryFreeTypeWithRevision(revisionFlags, config, lib); } @@ -304,51 +304,51 @@ error_code FTManager_SetFontOpenMode() } DECLARE(ppu_module_manager::cellFontFT)("cellFontFT", []() -{ - REG_FUNC(cellFontFT, cellFontInitLibraryFreeType); - REG_FUNC(cellFontFT, cellFontInitLibraryFreeTypeWithRevision); - REG_FUNC(cellFontFT, cellFontFTGetRevisionFlags); - REG_FUNC(cellFontFT, cellFontFTGetInitializedRevisionFlags); + { + REG_FUNC(cellFontFT, cellFontInitLibraryFreeType); + REG_FUNC(cellFontFT, cellFontInitLibraryFreeTypeWithRevision); + REG_FUNC(cellFontFT, cellFontFTGetRevisionFlags); + REG_FUNC(cellFontFT, cellFontFTGetInitializedRevisionFlags); - REG_FUNC(cellFontFT, FTCacheStream_CacheEnd); - REG_FUNC(cellFontFT, FTCacheStream_CacheInit); - REG_FUNC(cellFontFT, FTCacheStream_CalcCacheIndexSize); - REG_FUNC(cellFontFT, FTCacheStream_End); - REG_FUNC(cellFontFT, FTCacheStream_Init); + REG_FUNC(cellFontFT, FTCacheStream_CacheEnd); + REG_FUNC(cellFontFT, FTCacheStream_CacheInit); + REG_FUNC(cellFontFT, FTCacheStream_CalcCacheIndexSize); + REG_FUNC(cellFontFT, FTCacheStream_End); + REG_FUNC(cellFontFT, FTCacheStream_Init); - REG_FUNC(cellFontFT, FTFaceH_Close); - REG_FUNC(cellFontFT, FTFaceH_FontFamilyName); - REG_FUNC(cellFontFT, FTFaceH_FontStyleName); - REG_FUNC(cellFontFT, FTFaceH_GetAscender); - REG_FUNC(cellFontFT, FTFaceH_GetBoundingBoxHeight); - REG_FUNC(cellFontFT, FTFaceH_GetBoundingBoxMaxX); - REG_FUNC(cellFontFT, FTFaceH_GetBoundingBoxMaxY); - REG_FUNC(cellFontFT, FTFaceH_GetBoundingBoxMinX); - REG_FUNC(cellFontFT, FTFaceH_GetBoundingBoxMinY); - REG_FUNC(cellFontFT, FTFaceH_GetBoundingBoxWidth); - REG_FUNC(cellFontFT, FTFaceH_GetCompositeCodes); - REG_FUNC(cellFontFT, FTFaceH_GetGlyphImage); - REG_FUNC(cellFontFT, FTFaceH_GetGlyphMetrics); - REG_FUNC(cellFontFT, FTFaceH_GetKerning); - REG_FUNC(cellFontFT, FTFaceH_GetMaxHorizontalAdvance); - REG_FUNC(cellFontFT, FTFaceH_GetMaxVerticalAdvance); - REG_FUNC(cellFontFT, FTFaceH_GetRenderBufferSize); - REG_FUNC(cellFontFT, FTFaceH_GetRenderEffectSlant); - REG_FUNC(cellFontFT, FTFaceH_GetRenderEffectWeight); - REG_FUNC(cellFontFT, FTFaceH_GetRenderScale); - REG_FUNC(cellFontFT, FTFaceH_GetRenderScalePixel); - REG_FUNC(cellFontFT, FTFaceH_GetRenderScalePoint); - REG_FUNC(cellFontFT, FTFaceH_SetCompositeCodes); - REG_FUNC(cellFontFT, FTFaceH_SetRenderEffectSlant); - REG_FUNC(cellFontFT, FTFaceH_SetRenderEffectWeight); - REG_FUNC(cellFontFT, FTFaceH_SetRenderScalePixel); - REG_FUNC(cellFontFT, FTFaceH_SetRenderScalePoint); + REG_FUNC(cellFontFT, FTFaceH_Close); + REG_FUNC(cellFontFT, FTFaceH_FontFamilyName); + REG_FUNC(cellFontFT, FTFaceH_FontStyleName); + REG_FUNC(cellFontFT, FTFaceH_GetAscender); + REG_FUNC(cellFontFT, FTFaceH_GetBoundingBoxHeight); + REG_FUNC(cellFontFT, FTFaceH_GetBoundingBoxMaxX); + REG_FUNC(cellFontFT, FTFaceH_GetBoundingBoxMaxY); + REG_FUNC(cellFontFT, FTFaceH_GetBoundingBoxMinX); + REG_FUNC(cellFontFT, FTFaceH_GetBoundingBoxMinY); + REG_FUNC(cellFontFT, FTFaceH_GetBoundingBoxWidth); + REG_FUNC(cellFontFT, FTFaceH_GetCompositeCodes); + REG_FUNC(cellFontFT, FTFaceH_GetGlyphImage); + REG_FUNC(cellFontFT, FTFaceH_GetGlyphMetrics); + REG_FUNC(cellFontFT, FTFaceH_GetKerning); + REG_FUNC(cellFontFT, FTFaceH_GetMaxHorizontalAdvance); + REG_FUNC(cellFontFT, FTFaceH_GetMaxVerticalAdvance); + REG_FUNC(cellFontFT, FTFaceH_GetRenderBufferSize); + REG_FUNC(cellFontFT, FTFaceH_GetRenderEffectSlant); + REG_FUNC(cellFontFT, FTFaceH_GetRenderEffectWeight); + REG_FUNC(cellFontFT, FTFaceH_GetRenderScale); + REG_FUNC(cellFontFT, FTFaceH_GetRenderScalePixel); + REG_FUNC(cellFontFT, FTFaceH_GetRenderScalePoint); + REG_FUNC(cellFontFT, FTFaceH_SetCompositeCodes); + REG_FUNC(cellFontFT, FTFaceH_SetRenderEffectSlant); + REG_FUNC(cellFontFT, FTFaceH_SetRenderEffectWeight); + REG_FUNC(cellFontFT, FTFaceH_SetRenderScalePixel); + REG_FUNC(cellFontFT, FTFaceH_SetRenderScalePoint); - REG_FUNC(cellFontFT, FTManager_CloseFace); - REG_FUNC(cellFontFT, FTManager_Done_FreeType); - REG_FUNC(cellFontFT, FTManager_Init_FreeType); - REG_FUNC(cellFontFT, FTManager_OpenFileFace); - REG_FUNC(cellFontFT, FTManager_OpenMemFace); - REG_FUNC(cellFontFT, FTManager_OpenStreamFace); - REG_FUNC(cellFontFT, FTManager_SetFontOpenMode); -}); + REG_FUNC(cellFontFT, FTManager_CloseFace); + REG_FUNC(cellFontFT, FTManager_Done_FreeType); + REG_FUNC(cellFontFT, FTManager_Init_FreeType); + REG_FUNC(cellFontFT, FTManager_OpenFileFace); + REG_FUNC(cellFontFT, FTManager_OpenMemFace); + REG_FUNC(cellFontFT, FTManager_OpenStreamFace); + REG_FUNC(cellFontFT, FTManager_SetFontOpenMode); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellFs.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellFs.cpp index bff73f530..ae10550f7 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellFs.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellFs.cpp @@ -430,8 +430,8 @@ error_code cellFsGetDirectoryEntries(ppu_thread& ppu, u32 fd, vm::ptrop = 0xe0000012; op->arg._code = 0; op->arg._size = 0; - op->arg.ptr = entries; - op->arg.max = entries_size / sizeof(CellFsDirectoryEntry); + op->arg.ptr = entries; + op->arg.max = entries_size / sizeof(CellFsDirectoryEntry); const s32 rc = sys_fs_fcntl(ppu, fd, 0xe0000012, op.ptr(&lv2_file_op_dir::arg), 0x10); @@ -451,7 +451,8 @@ error_code cellFsReadWithOffset(ppu_thread& ppu, u32 fd, u64 offset, vm::ptr 252) { - if (nread) *nread = 0; + if (nread) + *nread = 0; return CELL_EBADF; } @@ -487,13 +488,15 @@ error_code cellFsWriteWithOffset(ppu_thread& ppu, u32 fd, u64 offset, vm::cptr 252) { - if (nwrite) *nwrite = 0; + if (nwrite) + *nwrite = 0; return CELL_EBADF; } @@ -637,12 +640,12 @@ error_code cellFsAllocateFileAreaWithoutZeroFill(ppu_thread& ppu, vm::cptr vm::var ctrl; ctrl->size = ctrl.size(); - ctrl->_x4 = 0x10; - ctrl->_x8 = 0x20; + ctrl->_x4 = 0x10; + ctrl->_x8 = 0x20; ctrl->file_path = path; ctrl->file_size = size; - ctrl->out_code = CELL_ENOSYS; + ctrl->out_code = CELL_ENOSYS; // TODO if (s32 rc = sys_fs_fcntl(ppu, -1, 0xe0000017, ctrl, ctrl->size)) @@ -915,11 +918,10 @@ struct fs_aio_thread : ppu_thread } else if (std::lock_guard lock(file->mp->mutex); file->file) { - const auto old_pos = file->file.pos(); file->file.seek(aio->offset); + const auto old_pos = file->file.pos(); + file->file.seek(aio->offset); - result = type == 2 - ? file->op_write(aio->buf, aio->size) - : file->op_read(aio->buf, aio->size); + result = type == 2 ? file->op_write(aio->buf, aio->size) : file->op_read(aio->buf, aio->size); file->file.seek(old_pos); error = CELL_OK; @@ -974,10 +976,9 @@ s32 cellFsAioRead(vm::ptr aio, vm::ptr id, fs_aio_cb_t func) const s32 xid = (*id = ++g_fs_aio_id); - m.thread->cmd_list - ({ - { 1, xid }, - { aio, func }, + m.thread->cmd_list({ + {1, xid}, + {aio, func}, }); return CELL_OK; @@ -998,10 +999,9 @@ s32 cellFsAioWrite(vm::ptr aio, vm::ptr id, fs_aio_cb_t func) const s32 xid = (*id = ++g_fs_aio_id); - m.thread->cmd_list - ({ - { 2, xid }, - { aio, func }, + m.thread->cmd_list({ + {2, xid}, + {aio, func}, }); return CELL_OK; @@ -1035,85 +1035,85 @@ s32 cellFsUnregisterL10nCallbacks() } DECLARE(ppu_module_manager::cellFs)("sys_fs", []() -{ - REG_FUNC(sys_fs, cellFsAccess); - REG_FUNC(sys_fs, cellFsAclRead); - REG_FUNC(sys_fs, cellFsAclWrite); - REG_FUNC(sys_fs, cellFsAioCancel); - REG_FUNC(sys_fs, cellFsAioFinish); - REG_FUNC(sys_fs, cellFsAioInit); - REG_FUNC(sys_fs, cellFsAioRead); - REG_FUNC(sys_fs, cellFsAioWrite); - REG_FUNC(sys_fs, cellFsAllocateFileAreaByFdWithInitialData); - REG_FUNC(sys_fs, cellFsAllocateFileAreaByFdWithoutZeroFill); - REG_FUNC(sys_fs, cellFsAllocateFileAreaWithInitialData); - REG_FUNC(sys_fs, cellFsAllocateFileAreaWithoutZeroFill); - REG_FUNC(sys_fs, cellFsArcadeHddSerialNumber); - REG_FUNC(sys_fs, cellFsChangeFileSizeByFdWithoutAllocation); - REG_FUNC(sys_fs, cellFsChangeFileSizeWithoutAllocation); - REG_FUNC(sys_fs, cellFsChmod); - REG_FUNC(sys_fs, cellFsChown); - REG_FUNC(sys_fs, cellFsClose).flag(MFF_PERFECT); - REG_FUNC(sys_fs, cellFsClosedir).flag(MFF_PERFECT); - REG_FUNC(sys_fs, cellFsFcntl); - REG_FUNC(sys_fs, cellFsFdatasync); - REG_FUNC(sys_fs, cellFsFGetBlockSize).flag(MFF_PERFECT); - REG_FUNC(sys_fs, cellFsFGetBlockSize2); - REG_FUNC(sys_fs, cellFsFstat).flags = MFF_PERFECT; - REG_FUNC(sys_fs, cellFsFsync); - REG_FUNC(sys_fs, cellFsFtruncate).flag(MFF_PERFECT); - REG_FUNC(sys_fs, cellFsGetBlockSize); - REG_FUNC(sys_fs, cellFsGetBlockSize2); - REG_FUNC(sys_fs, cellFsGetDirectoryEntries); - REG_FUNC(sys_fs, cellFsGetFreeSize); - REG_FUNC(sys_fs, cellFsGetPath); - REG_FUNC(sys_fs, cellFsLink); - REG_FUNC(sys_fs, cellFsLseek).flag(MFF_PERFECT); - REG_FUNC(sys_fs, cellFsLsnGetCDA); - REG_FUNC(sys_fs, cellFsLsnGetCDASize); - REG_FUNC(sys_fs, cellFsLsnLock); - REG_FUNC(sys_fs, cellFsLsnRead); - REG_FUNC(sys_fs, cellFsLsnRead2); - REG_FUNC(sys_fs, cellFsLsnUnlock); - REG_FUNC(sys_fs, cellFsMappedAllocate); - REG_FUNC(sys_fs, cellFsMappedFree); - REG_FUNC(sys_fs, cellFsMkdir); - REG_FUNC(sys_fs, cellFsOpen); - REG_FUNC(sys_fs, cellFsOpen2); - REG_FUNC(sys_fs, cellFsOpendir); - REG_FUNC(sys_fs, cellFsRead).flag(MFF_PERFECT); - REG_FUNC(sys_fs, cellFsReaddir).flag(MFF_PERFECT); - REG_FUNC(sys_fs, cellFsReadWithOffset); - REG_FUNC(sys_fs, cellFsRegisterConversionCallback); - REG_FUNC(sys_fs, cellFsRename); - REG_FUNC(sys_fs, cellFsRmdir); - REG_FUNC(sys_fs, cellFsSdataOpen); - REG_FUNC(sys_fs, cellFsSdataOpenByFd); - REG_FUNC(sys_fs, cellFsSdataOpenWithVersion); - REG_FUNC(sys_fs, cellFsSetAttribute); - REG_FUNC(sys_fs, cellFsSetDefaultContainer); - REG_FUNC(sys_fs, cellFsSetDiscReadRetrySetting); - REG_FUNC(sys_fs, cellFsSetIoBuffer); - REG_FUNC(sys_fs, cellFsSetIoBufferFromDefaultContainer); - REG_FUNC(sys_fs, cellFsStat); - REG_FUNC(sys_fs, cellFsStRead); - REG_FUNC(sys_fs, cellFsStReadFinish); - REG_FUNC(sys_fs, cellFsStReadGetCurrentAddr); - REG_FUNC(sys_fs, cellFsStReadGetRegid); - REG_FUNC(sys_fs, cellFsStReadGetRingBuf); - REG_FUNC(sys_fs, cellFsStReadGetStatus); - REG_FUNC(sys_fs, cellFsStReadInit); - REG_FUNC(sys_fs, cellFsStReadPutCurrentAddr); - REG_FUNC(sys_fs, cellFsStReadStart); - REG_FUNC(sys_fs, cellFsStReadStop); - REG_FUNC(sys_fs, cellFsStReadWait); - REG_FUNC(sys_fs, cellFsStReadWaitCallback); - REG_FUNC(sys_fs, cellFsSymbolicLink); - REG_FUNC(sys_fs, cellFsTruncate); - REG_FUNC(sys_fs, cellFsTruncate2); - REG_FUNC(sys_fs, cellFsUnlink); - REG_FUNC(sys_fs, cellFsUnregisterL10nCallbacks); - REG_FUNC(sys_fs, cellFsUtime); - REG_FUNC(sys_fs, cellFsWrite).flag(MFF_PERFECT); - REG_FUNC(sys_fs, cellFsWriteWithOffset); -}); + { + REG_FUNC(sys_fs, cellFsAccess); + REG_FUNC(sys_fs, cellFsAclRead); + REG_FUNC(sys_fs, cellFsAclWrite); + REG_FUNC(sys_fs, cellFsAioCancel); + REG_FUNC(sys_fs, cellFsAioFinish); + REG_FUNC(sys_fs, cellFsAioInit); + REG_FUNC(sys_fs, cellFsAioRead); + REG_FUNC(sys_fs, cellFsAioWrite); + REG_FUNC(sys_fs, cellFsAllocateFileAreaByFdWithInitialData); + REG_FUNC(sys_fs, cellFsAllocateFileAreaByFdWithoutZeroFill); + REG_FUNC(sys_fs, cellFsAllocateFileAreaWithInitialData); + REG_FUNC(sys_fs, cellFsAllocateFileAreaWithoutZeroFill); + REG_FUNC(sys_fs, cellFsArcadeHddSerialNumber); + REG_FUNC(sys_fs, cellFsChangeFileSizeByFdWithoutAllocation); + REG_FUNC(sys_fs, cellFsChangeFileSizeWithoutAllocation); + REG_FUNC(sys_fs, cellFsChmod); + REG_FUNC(sys_fs, cellFsChown); + REG_FUNC(sys_fs, cellFsClose).flag(MFF_PERFECT); + REG_FUNC(sys_fs, cellFsClosedir).flag(MFF_PERFECT); + REG_FUNC(sys_fs, cellFsFcntl); + REG_FUNC(sys_fs, cellFsFdatasync); + REG_FUNC(sys_fs, cellFsFGetBlockSize).flag(MFF_PERFECT); + REG_FUNC(sys_fs, cellFsFGetBlockSize2); + REG_FUNC(sys_fs, cellFsFstat).flags = MFF_PERFECT; + REG_FUNC(sys_fs, cellFsFsync); + REG_FUNC(sys_fs, cellFsFtruncate).flag(MFF_PERFECT); + REG_FUNC(sys_fs, cellFsGetBlockSize); + REG_FUNC(sys_fs, cellFsGetBlockSize2); + REG_FUNC(sys_fs, cellFsGetDirectoryEntries); + REG_FUNC(sys_fs, cellFsGetFreeSize); + REG_FUNC(sys_fs, cellFsGetPath); + REG_FUNC(sys_fs, cellFsLink); + REG_FUNC(sys_fs, cellFsLseek).flag(MFF_PERFECT); + REG_FUNC(sys_fs, cellFsLsnGetCDA); + REG_FUNC(sys_fs, cellFsLsnGetCDASize); + REG_FUNC(sys_fs, cellFsLsnLock); + REG_FUNC(sys_fs, cellFsLsnRead); + REG_FUNC(sys_fs, cellFsLsnRead2); + REG_FUNC(sys_fs, cellFsLsnUnlock); + REG_FUNC(sys_fs, cellFsMappedAllocate); + REG_FUNC(sys_fs, cellFsMappedFree); + REG_FUNC(sys_fs, cellFsMkdir); + REG_FUNC(sys_fs, cellFsOpen); + REG_FUNC(sys_fs, cellFsOpen2); + REG_FUNC(sys_fs, cellFsOpendir); + REG_FUNC(sys_fs, cellFsRead).flag(MFF_PERFECT); + REG_FUNC(sys_fs, cellFsReaddir).flag(MFF_PERFECT); + REG_FUNC(sys_fs, cellFsReadWithOffset); + REG_FUNC(sys_fs, cellFsRegisterConversionCallback); + REG_FUNC(sys_fs, cellFsRename); + REG_FUNC(sys_fs, cellFsRmdir); + REG_FUNC(sys_fs, cellFsSdataOpen); + REG_FUNC(sys_fs, cellFsSdataOpenByFd); + REG_FUNC(sys_fs, cellFsSdataOpenWithVersion); + REG_FUNC(sys_fs, cellFsSetAttribute); + REG_FUNC(sys_fs, cellFsSetDefaultContainer); + REG_FUNC(sys_fs, cellFsSetDiscReadRetrySetting); + REG_FUNC(sys_fs, cellFsSetIoBuffer); + REG_FUNC(sys_fs, cellFsSetIoBufferFromDefaultContainer); + REG_FUNC(sys_fs, cellFsStat); + REG_FUNC(sys_fs, cellFsStRead); + REG_FUNC(sys_fs, cellFsStReadFinish); + REG_FUNC(sys_fs, cellFsStReadGetCurrentAddr); + REG_FUNC(sys_fs, cellFsStReadGetRegid); + REG_FUNC(sys_fs, cellFsStReadGetRingBuf); + REG_FUNC(sys_fs, cellFsStReadGetStatus); + REG_FUNC(sys_fs, cellFsStReadInit); + REG_FUNC(sys_fs, cellFsStReadPutCurrentAddr); + REG_FUNC(sys_fs, cellFsStReadStart); + REG_FUNC(sys_fs, cellFsStReadStop); + REG_FUNC(sys_fs, cellFsStReadWait); + REG_FUNC(sys_fs, cellFsStReadWaitCallback); + REG_FUNC(sys_fs, cellFsSymbolicLink); + REG_FUNC(sys_fs, cellFsTruncate); + REG_FUNC(sys_fs, cellFsTruncate2); + REG_FUNC(sys_fs, cellFsUnlink); + REG_FUNC(sys_fs, cellFsUnregisterL10nCallbacks); + REG_FUNC(sys_fs, cellFsUtime); + REG_FUNC(sys_fs, cellFsWrite).flag(MFF_PERFECT); + REG_FUNC(sys_fs, cellFsWriteWithOffset); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellFs.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellFs.h index 229c48b86..2c025edde 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellFs.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellFs.h @@ -5,7 +5,7 @@ // CellFsRingBuffer.copy enum : s32 { - CELL_FS_ST_COPY = 0, + CELL_FS_ST_COPY = 0, CELL_FS_ST_COPYLESS = 1, }; @@ -20,15 +20,15 @@ struct CellFsRingBuffer // cellFsStReadGetStatus status enum : u64 { - CELL_FS_ST_INITIALIZED = 0x0001, + CELL_FS_ST_INITIALIZED = 0x0001, CELL_FS_ST_NOT_INITIALIZED = 0x0002, - CELL_FS_ST_STOP = 0x0100, - CELL_FS_ST_PROGRESS = 0x0200, + CELL_FS_ST_STOP = 0x0100, + CELL_FS_ST_PROGRESS = 0x0200, }; enum : s32 { - CELL_FS_AIO_MAX_FS = 10, // cellFsAioInit limit + CELL_FS_AIO_MAX_FS = 10, // cellFsAioInit limit CELL_FS_AIO_MAX_REQUEST = 32, // cellFsAioRead request limit per mount point }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellGame.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellGame.cpp index 17e190898..35df14e82 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellGame.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellGame.cpp @@ -33,89 +33,89 @@ stx::init_lock acquire_lock(stx::init_mutex& mtx, ppu_thread* ppu = nullptr); stx::access_lock acquire_access_lock(stx::init_mutex& mtx, ppu_thread* ppu = nullptr); stx::reset_lock acquire_reset_lock(stx::init_mutex& mtx, ppu_thread* ppu = nullptr); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_GAME_ERROR_NOTFOUND); - STR_CASE(CELL_GAME_ERROR_BROKEN); - STR_CASE(CELL_GAME_ERROR_INTERNAL); - STR_CASE(CELL_GAME_ERROR_PARAM); - STR_CASE(CELL_GAME_ERROR_NOAPP); - STR_CASE(CELL_GAME_ERROR_ACCESS_ERROR); - STR_CASE(CELL_GAME_ERROR_NOSPACE); - STR_CASE(CELL_GAME_ERROR_NOTSUPPORTED); - STR_CASE(CELL_GAME_ERROR_FAILURE); - STR_CASE(CELL_GAME_ERROR_BUSY); - STR_CASE(CELL_GAME_ERROR_IN_SHUTDOWN); - STR_CASE(CELL_GAME_ERROR_INVALID_ID); - STR_CASE(CELL_GAME_ERROR_EXIST); - STR_CASE(CELL_GAME_ERROR_NOTPATCH); - STR_CASE(CELL_GAME_ERROR_INVALID_THEME_FILE); - STR_CASE(CELL_GAME_ERROR_BOOTPATH); - } + switch (error) + { + STR_CASE(CELL_GAME_ERROR_NOTFOUND); + STR_CASE(CELL_GAME_ERROR_BROKEN); + STR_CASE(CELL_GAME_ERROR_INTERNAL); + STR_CASE(CELL_GAME_ERROR_PARAM); + STR_CASE(CELL_GAME_ERROR_NOAPP); + STR_CASE(CELL_GAME_ERROR_ACCESS_ERROR); + STR_CASE(CELL_GAME_ERROR_NOSPACE); + STR_CASE(CELL_GAME_ERROR_NOTSUPPORTED); + STR_CASE(CELL_GAME_ERROR_FAILURE); + STR_CASE(CELL_GAME_ERROR_BUSY); + STR_CASE(CELL_GAME_ERROR_IN_SHUTDOWN); + STR_CASE(CELL_GAME_ERROR_INVALID_ID); + STR_CASE(CELL_GAME_ERROR_EXIST); + STR_CASE(CELL_GAME_ERROR_NOTPATCH); + STR_CASE(CELL_GAME_ERROR_INVALID_THEME_FILE); + STR_CASE(CELL_GAME_ERROR_BOOTPATH); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_GAMEDATA_ERROR_CBRESULT); - STR_CASE(CELL_GAMEDATA_ERROR_ACCESS_ERROR); - STR_CASE(CELL_GAMEDATA_ERROR_INTERNAL); - STR_CASE(CELL_GAMEDATA_ERROR_PARAM); - STR_CASE(CELL_GAMEDATA_ERROR_NOSPACE); - STR_CASE(CELL_GAMEDATA_ERROR_BROKEN); - STR_CASE(CELL_GAMEDATA_ERROR_FAILURE); - } + switch (error) + { + STR_CASE(CELL_GAMEDATA_ERROR_CBRESULT); + STR_CASE(CELL_GAMEDATA_ERROR_ACCESS_ERROR); + STR_CASE(CELL_GAMEDATA_ERROR_INTERNAL); + STR_CASE(CELL_GAMEDATA_ERROR_PARAM); + STR_CASE(CELL_GAMEDATA_ERROR_NOSPACE); + STR_CASE(CELL_GAMEDATA_ERROR_BROKEN); + STR_CASE(CELL_GAMEDATA_ERROR_FAILURE); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_DISCGAME_ERROR_INTERNAL); - STR_CASE(CELL_DISCGAME_ERROR_NOT_DISCBOOT); - STR_CASE(CELL_DISCGAME_ERROR_PARAM); - } + switch (error) + { + STR_CASE(CELL_DISCGAME_ERROR_INTERNAL); + STR_CASE(CELL_DISCGAME_ERROR_NOT_DISCBOOT); + STR_CASE(CELL_DISCGAME_ERROR_PARAM); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_HDDGAME_ERROR_CBRESULT); - STR_CASE(CELL_HDDGAME_ERROR_ACCESS_ERROR); - STR_CASE(CELL_HDDGAME_ERROR_INTERNAL); - STR_CASE(CELL_HDDGAME_ERROR_PARAM); - STR_CASE(CELL_HDDGAME_ERROR_NOSPACE); - STR_CASE(CELL_HDDGAME_ERROR_BROKEN); - STR_CASE(CELL_HDDGAME_ERROR_FAILURE); - } + switch (error) + { + STR_CASE(CELL_HDDGAME_ERROR_CBRESULT); + STR_CASE(CELL_HDDGAME_ERROR_ACCESS_ERROR); + STR_CASE(CELL_HDDGAME_ERROR_INTERNAL); + STR_CASE(CELL_HDDGAME_ERROR_PARAM); + STR_CASE(CELL_HDDGAME_ERROR_NOSPACE); + STR_CASE(CELL_HDDGAME_ERROR_BROKEN); + STR_CASE(CELL_HDDGAME_ERROR_FAILURE); + } - return unknown; - }); + return unknown; + }); } // If dir is empty: @@ -186,39 +186,39 @@ struct content_permission final } }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(content_permission::check_mode::not_set); - STR_CASE(content_permission::check_mode::game_data); - STR_CASE(content_permission::check_mode::patch); - STR_CASE(content_permission::check_mode::hdd_game); - STR_CASE(content_permission::check_mode::disc_game); - } + switch (error) + { + STR_CASE(content_permission::check_mode::not_set); + STR_CASE(content_permission::check_mode::game_data); + STR_CASE(content_permission::check_mode::patch); + STR_CASE(content_permission::check_mode::hdd_game); + STR_CASE(content_permission::check_mode::disc_game); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(disc_change_manager::eject_state::unknown); - STR_CASE(disc_change_manager::eject_state::inserted); - STR_CASE(disc_change_manager::eject_state::ejected); - STR_CASE(disc_change_manager::eject_state::busy); - } + switch (error) + { + STR_CASE(disc_change_manager::eject_state::unknown); + STR_CASE(disc_change_manager::eject_state::inserted); + STR_CASE(disc_change_manager::eject_state::ejected); + STR_CASE(disc_change_manager::eject_state::busy); + } - return unknown; - }); + return unknown; + }); } static bool check_system_ver(vm::cptr systemVersion) @@ -234,8 +234,7 @@ static bool check_system_ver(vm::cptr systemVersion) std::isdigit(systemVersion[3]) && std::isdigit(systemVersion[4]) && std::isdigit(systemVersion[5]) && - std::isdigit(systemVersion[6]) - ); + std::isdigit(systemVersion[6])); } disc_change_manager::disc_change_manager() @@ -314,22 +313,22 @@ void disc_change_manager::eject_disc() ensure(eject_callback); sysutil_register_cb([](ppu_thread& cb_ppu) -> s32 - { - auto& dcm = g_fxo->get(); - std::lock_guard lock(dcm.mtx); + { + auto& dcm = g_fxo->get(); + std::lock_guard lock(dcm.mtx); - cellGame.notice("Executing eject_callback..."); - dcm.eject_callback(cb_ppu); + cellGame.notice("Executing eject_callback..."); + dcm.eject_callback(cb_ppu); - ensure(vfs::unmount("/dev_bdvd")); - ensure(vfs::unmount("/dev_ps2disc")); - dcm.state = eject_state::ejected; + ensure(vfs::unmount("/dev_bdvd")); + ensure(vfs::unmount("/dev_ps2disc")); + dcm.state = eject_state::ejected; - // Re-enable disc insertion only if the callback is still registered - Emu.GetCallbacks().enable_disc_insert(!!dcm.insert_callback); + // Re-enable disc insertion only if the callback is still registered + Emu.GetCallbacks().enable_disc_insert(!!dcm.insert_callback); - return CELL_OK; - }); + return CELL_OK; + }); } void disc_change_manager::insert_disc(u32 disc_type, std::string title_id) @@ -352,31 +351,31 @@ void disc_change_manager::insert_disc(u32 disc_type, std::string title_id) is_inserting = true; sysutil_register_cb([disc_type, title_id = std::move(title_id)](ppu_thread& cb_ppu) -> s32 - { - auto& dcm = g_fxo->get(); - std::lock_guard lock(dcm.mtx); - - if (disc_type == CELL_GAME_DISCTYPE_PS3) { - vm::var _title_id = vm::make_str(title_id); - cellGame.notice("Executing insert_callback for title '%s' with disc_type %d...", _title_id.get_ptr(), disc_type); - dcm.insert_callback(cb_ppu, disc_type, _title_id); - } - else - { - cellGame.notice("Executing insert_callback with disc_type %d...", disc_type); - dcm.insert_callback(cb_ppu, disc_type, vm::null); - } + auto& dcm = g_fxo->get(); + std::lock_guard lock(dcm.mtx); - dcm.state = eject_state::inserted; + if (disc_type == CELL_GAME_DISCTYPE_PS3) + { + vm::var _title_id = vm::make_str(title_id); + cellGame.notice("Executing insert_callback for title '%s' with disc_type %d...", _title_id.get_ptr(), disc_type); + dcm.insert_callback(cb_ppu, disc_type, _title_id); + } + else + { + cellGame.notice("Executing insert_callback with disc_type %d...", disc_type); + dcm.insert_callback(cb_ppu, disc_type, vm::null); + } - // Re-enable disc ejection only if the callback is still registered - Emu.GetCallbacks().enable_disc_eject(!!dcm.eject_callback); + dcm.state = eject_state::inserted; - dcm.is_inserting = false; + // Re-enable disc ejection only if the callback is still registered + Emu.GetCallbacks().enable_disc_eject(!!dcm.eject_callback); - return CELL_OK; - }); + dcm.is_inserting = false; + + return CELL_OK; + }); } extern void lv2_sleep(u64 timeout, ppu_thread* ppu = nullptr) @@ -428,7 +427,7 @@ error_code cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr dirName const auto cat = psf::get_string(sfo, "CATEGORY", ""); if (!psf::is_cat_hdd(cat)) { - return { CELL_GAMEDATA_ERROR_BROKEN, "CATEGORY='%s'", cat }; + return {CELL_GAMEDATA_ERROR_BROKEN, "CATEGORY='%s'", cat}; } } @@ -471,13 +470,20 @@ error_code cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr dirName const psf::registry psf = psf::load_object(local_dir + "/PARAM.SFO"); // Some following fields may be zero in old FW 1.00 version PARAM.SFO - if (psf.contains("PARENTAL_LEVEL")) get->getParam.parentalLevel = ::at32(psf, "PARENTAL_LEVEL").as_integer(); - if (psf.contains("ATTRIBUTE")) get->getParam.attribute = ::at32(psf, "ATTRIBUTE").as_integer(); - if (psf.contains("RESOLUTION")) get->getParam.resolution = ::at32(psf, "RESOLUTION").as_integer(); - if (psf.contains("SOUND_FORMAT")) get->getParam.soundFormat = ::at32(psf, "SOUND_FORMAT").as_integer(); - if (psf.contains("TITLE")) strcpy_trunc(get->getParam.title, ::at32(psf, "TITLE").as_string()); - if (psf.contains("APP_VER")) strcpy_trunc(get->getParam.dataVersion, ::at32(psf, "APP_VER").as_string()); - if (psf.contains("TITLE_ID")) strcpy_trunc(get->getParam.titleId, ::at32(psf, "TITLE_ID").as_string()); + if (psf.contains("PARENTAL_LEVEL")) + get->getParam.parentalLevel = ::at32(psf, "PARENTAL_LEVEL").as_integer(); + if (psf.contains("ATTRIBUTE")) + get->getParam.attribute = ::at32(psf, "ATTRIBUTE").as_integer(); + if (psf.contains("RESOLUTION")) + get->getParam.resolution = ::at32(psf, "RESOLUTION").as_integer(); + if (psf.contains("SOUND_FORMAT")) + get->getParam.soundFormat = ::at32(psf, "SOUND_FORMAT").as_integer(); + if (psf.contains("TITLE")) + strcpy_trunc(get->getParam.title, ::at32(psf, "TITLE").as_string()); + if (psf.contains("APP_VER")) + strcpy_trunc(get->getParam.dataVersion, ::at32(psf, "APP_VER").as_string()); + if (psf.contains("TITLE_ID")) + strcpy_trunc(get->getParam.titleId, ::at32(psf, "TITLE_ID").as_string()); for (u32 i = 0; i < CELL_HDDGAME_SYSP_LANGUAGE_NUM; i++) { @@ -886,15 +892,15 @@ error_code cellGameDataCheck(u32 type, vm::cptr dirName, vm::ptr([&](u32 id, lv2_file& file) - { - if (file.mp != &g_mp_sys_dev_hdd0) { - return; - } - - if (real_dir.starts_with(file.real_path)) - { - if (!file.file) + if (file.mp != &g_mp_sys_dev_hdd0) { return; } - if (file.flags & CELL_FS_O_ACCMODE) + if (real_dir.starts_with(file.real_path)) { - // Synchronize outside IDM lock scope - lv2_files.emplace_back(ensure(idm::get_unlocked(id))); + if (!file.file) + { + return; + } + + if (file.flags & CELL_FS_O_ACCMODE) + { + // Synchronize outside IDM lock scope + lv2_files.emplace_back(ensure(idm::get_unlocked(id))); + } } - } - }); + }); for (auto& file : lv2_files) { @@ -1037,7 +1043,7 @@ error_code cellGameDataCheckCreate2(ppu_thread& ppu, u32 version, vm::cptr { cellGame.success("cellGameDataCheckCreate2(version=0x%x, dirName=%s, errDialog=0x%x, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container); - //older sdk. it might not care about game type. + // older sdk. it might not care about game type. if (version != CELL_GAMEDATA_VERSION_CURRENT || !funcStat || !dirName || sysutil_check_name_string(dirName.get_ptr(), 1, CELL_GAME_DIRNAME_SIZE) != 0) { @@ -1272,7 +1278,8 @@ error_code cellGameCreateGameData(vm::ptr init, vm::ptr init, vm::ptrtitleId) }, - { "TITLE", psf::string(CELL_GAME_SYSP_TITLE_SIZE, init->title) }, - { "VERSION", psf::string(CELL_GAME_SYSP_VERSION_SIZE, init->version) }, - }; + { + {"CATEGORY", psf::string(3, "GD")}, + {"TITLE_ID", psf::string(TITLEID_SFO_ENTRY_SIZE, init->titleId)}, + {"TITLE", psf::string(CELL_GAME_SYSP_TITLE_SIZE, init->title)}, + {"VERSION", psf::string(CELL_GAME_SYSP_VERSION_SIZE, init->version)}, + }; return CELL_OK; } @@ -1400,11 +1408,11 @@ error_code cellGameGetParamInt(s32 id, vm::ptr value) std::string key; - switch(id) + switch (id) { - case CELL_GAME_PARAMID_PARENTAL_LEVEL: key = "PARENTAL_LEVEL"; break; - case CELL_GAME_PARAMID_RESOLUTION: key = "RESOLUTION"; break; - case CELL_GAME_PARAMID_SOUND_FORMAT: key = "SOUND_FORMAT"; break; + case CELL_GAME_PARAMID_PARENTAL_LEVEL: key = "PARENTAL_LEVEL"; break; + case CELL_GAME_PARAMID_RESOLUTION: key = "RESOLUTION"; break; + case CELL_GAME_PARAMID_SOUND_FORMAT: key = "SOUND_FORMAT"; break; default: { return CELL_GAME_ERROR_INVALID_ID; @@ -1427,7 +1435,7 @@ enum class strkey_flag : u32 get_game_data, // reading is allowed for game data PARAM.SFO set_game_data, // writing is allowed for game data PARAM.SFO get_other, // reading is allowed for other types of PARAM.SFO - //set_other, // writing is allowed for other types of PARAM.SFO (not possible) + // set_other, // writing is allowed for other types of PARAM.SFO (not possible) __bitset_enum_max }; @@ -1438,7 +1446,8 @@ public: string_key_info() = default; string_key_info(std::string_view _name, u32 _max_size, bs_t _flags) : name(_name), max_size(_max_size), flags(_flags) - {} + { + } std::string_view name; u32 max_size = 0; @@ -1474,33 +1483,33 @@ static string_key_info get_param_string_key(s32 id) { switch (id) { - case CELL_GAME_PARAMID_TITLE: return string_key_info("TITLE", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::get_other + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_DEFAULT: return string_key_info("TITLE", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::get_other + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_JAPANESE: return string_key_info("TITLE_00", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_ENGLISH: return string_key_info("TITLE_01", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_FRENCH: return string_key_info("TITLE_02", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_SPANISH: return string_key_info("TITLE_03", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_GERMAN: return string_key_info("TITLE_04", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_ITALIAN: return string_key_info("TITLE_05", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_DUTCH: return string_key_info("TITLE_06", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_PORTUGUESE: return string_key_info("TITLE_07", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_RUSSIAN: return string_key_info("TITLE_08", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_KOREAN: return string_key_info("TITLE_09", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_CHINESE_T: return string_key_info("TITLE_10", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_CHINESE_S: return string_key_info("TITLE_11", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_FINNISH: return string_key_info("TITLE_12", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_SWEDISH: return string_key_info("TITLE_13", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_DANISH: return string_key_info("TITLE_14", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_NORWEGIAN: return string_key_info("TITLE_15", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_POLISH: return string_key_info("TITLE_16", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_PORTUGUESE_BRAZIL: return string_key_info("TITLE_17", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_ENGLISH_UK: return string_key_info("TITLE_18", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_TURKISH: return string_key_info("TITLE_19", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE: return string_key_info("TITLE", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::get_other + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_DEFAULT: return string_key_info("TITLE", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::get_other + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_JAPANESE: return string_key_info("TITLE_00", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_ENGLISH: return string_key_info("TITLE_01", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_FRENCH: return string_key_info("TITLE_02", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_SPANISH: return string_key_info("TITLE_03", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_GERMAN: return string_key_info("TITLE_04", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_ITALIAN: return string_key_info("TITLE_05", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_DUTCH: return string_key_info("TITLE_06", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_PORTUGUESE: return string_key_info("TITLE_07", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_RUSSIAN: return string_key_info("TITLE_08", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_KOREAN: return string_key_info("TITLE_09", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_CHINESE_T: return string_key_info("TITLE_10", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_CHINESE_S: return string_key_info("TITLE_11", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_FINNISH: return string_key_info("TITLE_12", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_SWEDISH: return string_key_info("TITLE_13", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_DANISH: return string_key_info("TITLE_14", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_NORWEGIAN: return string_key_info("TITLE_15", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_POLISH: return string_key_info("TITLE_16", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_PORTUGUESE_BRAZIL: return string_key_info("TITLE_17", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_ENGLISH_UK: return string_key_info("TITLE_18", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); + case CELL_GAME_PARAMID_TITLE_TURKISH: return string_key_info("TITLE_19", CELL_GAME_SYSP_TITLE_SIZE, strkey_flag::get_game_data + strkey_flag::set_game_data); - case CELL_GAME_PARAMID_TITLE_ID: return string_key_info("TITLE_ID", CELL_GAME_SYSP_TITLEID_SIZE, strkey_flag::get_game_data + strkey_flag::get_other); - case CELL_GAME_PARAMID_VERSION: return string_key_info("VERSION", CELL_GAME_SYSP_VERSION_SIZE, strkey_flag::get_game_data); - case CELL_GAME_PARAMID_PS3_SYSTEM_VER: return string_key_info("PS3_SYSTEM_VER", CELL_GAME_SYSP_PS3_SYSTEM_VER_SIZE, {}); // TODO - case CELL_GAME_PARAMID_APP_VER: return string_key_info("APP_VER", CELL_GAME_SYSP_APP_VER_SIZE, strkey_flag::get_game_data + strkey_flag::get_other); + case CELL_GAME_PARAMID_TITLE_ID: return string_key_info("TITLE_ID", CELL_GAME_SYSP_TITLEID_SIZE, strkey_flag::get_game_data + strkey_flag::get_other); + case CELL_GAME_PARAMID_VERSION: return string_key_info("VERSION", CELL_GAME_SYSP_VERSION_SIZE, strkey_flag::get_game_data); + case CELL_GAME_PARAMID_PS3_SYSTEM_VER: return string_key_info("PS3_SYSTEM_VER", CELL_GAME_SYSP_PS3_SYSTEM_VER_SIZE, {}); // TODO + case CELL_GAME_PARAMID_APP_VER: return string_key_info("APP_VER", CELL_GAME_SYSP_APP_VER_SIZE, strkey_flag::get_game_data + strkey_flag::get_other); } return {}; @@ -1536,7 +1545,7 @@ error_code cellGameGetParamString(s32 id, vm::ptr buf, u32 bufsize) if (!key.is_supported(false, perm.mode)) { // TODO: this error is possibly only returned during debug mode - return { CELL_GAME_ERROR_NOTSUPPORTED, "id %d is not supported in the current check mode: %s", id, perm.mode.load() }; + return {CELL_GAME_ERROR_NOTSUPPORTED, "id %d is not supported in the current check mode: %s", id, perm.mode.load()}; } const auto value = psf::get_string(perm.sfo, key.name); @@ -1892,8 +1901,10 @@ error_code cellDiscGameGetBootDiscInfo(vm::ptr getP const psf::registry psf = psf::load_object(vfs::get(dir + "/PARAM.SFO")); - if (psf.contains("PARENTAL_LEVEL")) getParam->parentalLevel = ::at32(psf, "PARENTAL_LEVEL").as_integer(); - if (psf.contains("TITLE_ID")) strcpy_trunc(getParam->titleId, ::at32(psf, "TITLE_ID").as_string()); + if (psf.contains("PARENTAL_LEVEL")) + getParam->parentalLevel = ::at32(psf, "PARENTAL_LEVEL").as_integer(); + if (psf.contains("TITLE_ID")) + strcpy_trunc(getParam->titleId, ::at32(psf, "TITLE_ID").as_string()); return CELL_OK; } @@ -1949,29 +1960,29 @@ void cellSysutil_GameData_init() } DECLARE(ppu_module_manager::cellGame)("cellGame", []() -{ - REG_FUNC(cellGame, cellGameBootCheck); - REG_FUNC(cellGame, cellGamePatchCheck); - REG_FUNC(cellGame, cellGameDataCheck); - REG_FUNC(cellGame, cellGameContentPermit); + { + REG_FUNC(cellGame, cellGameBootCheck); + REG_FUNC(cellGame, cellGamePatchCheck); + REG_FUNC(cellGame, cellGameDataCheck); + REG_FUNC(cellGame, cellGameContentPermit); - REG_FUNC(cellGame, cellGameCreateGameData); - REG_FUNC(cellGame, cellGameDeleteGameData); + REG_FUNC(cellGame, cellGameCreateGameData); + REG_FUNC(cellGame, cellGameDeleteGameData); - REG_FUNC(cellGame, cellGameGetParamInt); - REG_FUNC(cellGame, cellGameGetParamString); - REG_FUNC(cellGame, cellGameSetParamString); - REG_FUNC(cellGame, cellGameGetSizeKB); - REG_FUNC(cellGame, cellGameGetDiscContentInfoUpdatePath); - REG_FUNC(cellGame, cellGameGetLocalWebContentPath); + REG_FUNC(cellGame, cellGameGetParamInt); + REG_FUNC(cellGame, cellGameGetParamString); + REG_FUNC(cellGame, cellGameSetParamString); + REG_FUNC(cellGame, cellGameGetSizeKB); + REG_FUNC(cellGame, cellGameGetDiscContentInfoUpdatePath); + REG_FUNC(cellGame, cellGameGetLocalWebContentPath); - REG_FUNC(cellGame, cellGameContentErrorDialog); + REG_FUNC(cellGame, cellGameContentErrorDialog); - REG_FUNC(cellGame, cellGameThemeInstall); - REG_FUNC(cellGame, cellGameThemeInstallFromBuffer); + REG_FUNC(cellGame, cellGameThemeInstall); + REG_FUNC(cellGame, cellGameThemeInstallFromBuffer); - REG_VAR(cellGame, g_stat_get).flag(MFF_HIDDEN); - REG_VAR(cellGame, g_stat_set).flag(MFF_HIDDEN); - REG_VAR(cellGame, g_file_param).flag(MFF_HIDDEN); - REG_VAR(cellGame, g_cb_result).flag(MFF_HIDDEN); -}); + REG_VAR(cellGame, g_stat_get).flag(MFF_HIDDEN); + REG_VAR(cellGame, g_stat_set).flag(MFF_HIDDEN); + REG_VAR(cellGame, g_file_param).flag(MFF_HIDDEN); + REG_VAR(cellGame, g_cb_result).flag(MFF_HIDDEN); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellGame.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellGame.h index a0506cef9..fa41e9fa2 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellGame.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellGame.h @@ -5,155 +5,155 @@ // Return Codes enum { - CELL_GAME_RET_OK = 0, - CELL_GAME_RET_CANCEL = 1, - CELL_GAME_RET_NONE = 2, + CELL_GAME_RET_OK = 0, + CELL_GAME_RET_CANCEL = 1, + CELL_GAME_RET_NONE = 2, }; enum CellGameError : u32 { - CELL_GAME_ERROR_NOTFOUND = 0x8002cb04, - CELL_GAME_ERROR_BROKEN = 0x8002cb05, - CELL_GAME_ERROR_INTERNAL = 0x8002cb06, - CELL_GAME_ERROR_PARAM = 0x8002cb07, - CELL_GAME_ERROR_NOAPP = 0x8002cb08, - CELL_GAME_ERROR_ACCESS_ERROR = 0x8002cb09, - CELL_GAME_ERROR_NOSPACE = 0x8002cb20, - CELL_GAME_ERROR_NOTSUPPORTED = 0x8002cb21, - CELL_GAME_ERROR_FAILURE = 0x8002cb22, - CELL_GAME_ERROR_BUSY = 0x8002cb23, - CELL_GAME_ERROR_IN_SHUTDOWN = 0x8002cb24, - CELL_GAME_ERROR_INVALID_ID = 0x8002cb25, - CELL_GAME_ERROR_EXIST = 0x8002cb26, - CELL_GAME_ERROR_NOTPATCH = 0x8002cb27, + CELL_GAME_ERROR_NOTFOUND = 0x8002cb04, + CELL_GAME_ERROR_BROKEN = 0x8002cb05, + CELL_GAME_ERROR_INTERNAL = 0x8002cb06, + CELL_GAME_ERROR_PARAM = 0x8002cb07, + CELL_GAME_ERROR_NOAPP = 0x8002cb08, + CELL_GAME_ERROR_ACCESS_ERROR = 0x8002cb09, + CELL_GAME_ERROR_NOSPACE = 0x8002cb20, + CELL_GAME_ERROR_NOTSUPPORTED = 0x8002cb21, + CELL_GAME_ERROR_FAILURE = 0x8002cb22, + CELL_GAME_ERROR_BUSY = 0x8002cb23, + CELL_GAME_ERROR_IN_SHUTDOWN = 0x8002cb24, + CELL_GAME_ERROR_INVALID_ID = 0x8002cb25, + CELL_GAME_ERROR_EXIST = 0x8002cb26, + CELL_GAME_ERROR_NOTPATCH = 0x8002cb27, CELL_GAME_ERROR_INVALID_THEME_FILE = 0x8002cb28, - CELL_GAME_ERROR_BOOTPATH = 0x8002cb50, + CELL_GAME_ERROR_BOOTPATH = 0x8002cb50, }; enum CellGameDataError : u32 { - CELL_GAMEDATA_ERROR_CBRESULT = 0x8002b601, + CELL_GAMEDATA_ERROR_CBRESULT = 0x8002b601, CELL_GAMEDATA_ERROR_ACCESS_ERROR = 0x8002b602, - CELL_GAMEDATA_ERROR_INTERNAL = 0x8002b603, - CELL_GAMEDATA_ERROR_PARAM = 0x8002b604, - CELL_GAMEDATA_ERROR_NOSPACE = 0x8002b605, - CELL_GAMEDATA_ERROR_BROKEN = 0x8002b606, - CELL_GAMEDATA_ERROR_FAILURE = 0x8002b607, + CELL_GAMEDATA_ERROR_INTERNAL = 0x8002b603, + CELL_GAMEDATA_ERROR_PARAM = 0x8002b604, + CELL_GAMEDATA_ERROR_NOSPACE = 0x8002b605, + CELL_GAMEDATA_ERROR_BROKEN = 0x8002b606, + CELL_GAMEDATA_ERROR_FAILURE = 0x8002b607, }; enum CellDiscGameError : u32 { - CELL_DISCGAME_ERROR_INTERNAL = 0x8002bd01, - CELL_DISCGAME_ERROR_NOT_DISCBOOT = 0x8002bd02, - CELL_DISCGAME_ERROR_PARAM = 0x8002bd03, + CELL_DISCGAME_ERROR_INTERNAL = 0x8002bd01, + CELL_DISCGAME_ERROR_NOT_DISCBOOT = 0x8002bd02, + CELL_DISCGAME_ERROR_PARAM = 0x8002bd03, }; // Definitions enum { - CELL_GAME_PATH_MAX = 128, - CELL_GAME_DIRNAME_SIZE = 32, - CELL_GAME_HDDGAMEPATH_SIZE = 128, + CELL_GAME_PATH_MAX = 128, + CELL_GAME_DIRNAME_SIZE = 32, + CELL_GAME_HDDGAMEPATH_SIZE = 128, CELL_GAME_THEMEFILENAME_SIZE = 48, - CELL_GAME_SYSP_LANGUAGE_NUM = 20, - CELL_GAME_SYSP_TITLE_SIZE = 128, - CELL_GAME_SYSP_TITLEID_SIZE = 10, - CELL_GAME_SYSP_VERSION_SIZE = 6, + CELL_GAME_SYSP_LANGUAGE_NUM = 20, + CELL_GAME_SYSP_TITLE_SIZE = 128, + CELL_GAME_SYSP_TITLEID_SIZE = 10, + CELL_GAME_SYSP_VERSION_SIZE = 6, CELL_GAME_SYSP_PS3_SYSTEM_VER_SIZE = 8, - CELL_GAME_SYSP_APP_VER_SIZE = 6, + CELL_GAME_SYSP_APP_VER_SIZE = 6, - CELL_GAME_GAMETYPE_SYS = 0, - CELL_GAME_GAMETYPE_DISC = 1, - CELL_GAME_GAMETYPE_HDD = 2, + CELL_GAME_GAMETYPE_SYS = 0, + CELL_GAME_GAMETYPE_DISC = 1, + CELL_GAME_GAMETYPE_HDD = 2, CELL_GAME_GAMETYPE_GAMEDATA = 3, - CELL_GAME_GAMETYPE_HOME = 4, + CELL_GAME_GAMETYPE_HOME = 4, CELL_GAME_SIZEKB_NOTCALC = -1, CELL_GAME_THEMEINSTALL_BUFSIZE_MIN = 4096, - CELL_GAME_ATTRIBUTE_PATCH = 0x1, - CELL_GAME_ATTRIBUTE_APP_HOME = 0x2, - CELL_GAME_ATTRIBUTE_DEBUG = 0x4, - CELL_GAME_ATTRIBUTE_XMBBUY = 0x8, - CELL_GAME_ATTRIBUTE_COMMERCE2_BROWSER = 0x10, - CELL_GAME_ATTRIBUTE_INVITE_MESSAGE = 0x20, + CELL_GAME_ATTRIBUTE_PATCH = 0x1, + CELL_GAME_ATTRIBUTE_APP_HOME = 0x2, + CELL_GAME_ATTRIBUTE_DEBUG = 0x4, + CELL_GAME_ATTRIBUTE_XMBBUY = 0x8, + CELL_GAME_ATTRIBUTE_COMMERCE2_BROWSER = 0x10, + CELL_GAME_ATTRIBUTE_INVITE_MESSAGE = 0x20, CELL_GAME_ATTRIBUTE_CUSTOM_DATA_MESSAGE = 0x40, - CELL_GAME_ATTRIBUTE_WEB_BROWSER = 0x100, + CELL_GAME_ATTRIBUTE_WEB_BROWSER = 0x100, - CELL_GAME_THEME_OPTION_NONE = 0x0, + CELL_GAME_THEME_OPTION_NONE = 0x0, CELL_GAME_THEME_OPTION_APPLY = 0x1, CELL_GAME_DISCTYPE_OTHER = 0, - CELL_GAME_DISCTYPE_PS3 = 1, - CELL_GAME_DISCTYPE_PS2 = 2, + CELL_GAME_DISCTYPE_PS3 = 1, + CELL_GAME_DISCTYPE_PS2 = 2, }; -//Parameter IDs of PARAM.SFO +// Parameter IDs of PARAM.SFO enum { - //Integers + // Integers CELL_GAME_PARAMID_PARENTAL_LEVEL = 102, - CELL_GAME_PARAMID_RESOLUTION = 103, - CELL_GAME_PARAMID_SOUND_FORMAT = 104, + CELL_GAME_PARAMID_RESOLUTION = 103, + CELL_GAME_PARAMID_SOUND_FORMAT = 104, - //Strings - CELL_GAME_PARAMID_TITLE = 0, - CELL_GAME_PARAMID_TITLE_DEFAULT = 1, - CELL_GAME_PARAMID_TITLE_JAPANESE = 2, - CELL_GAME_PARAMID_TITLE_ENGLISH = 3, - CELL_GAME_PARAMID_TITLE_FRENCH = 4, - CELL_GAME_PARAMID_TITLE_SPANISH = 5, - CELL_GAME_PARAMID_TITLE_GERMAN = 6, - CELL_GAME_PARAMID_TITLE_ITALIAN = 7, - CELL_GAME_PARAMID_TITLE_DUTCH = 8, - CELL_GAME_PARAMID_TITLE_PORTUGUESE = 9, - CELL_GAME_PARAMID_TITLE_RUSSIAN = 10, - CELL_GAME_PARAMID_TITLE_KOREAN = 11, - CELL_GAME_PARAMID_TITLE_CHINESE_T = 12, - CELL_GAME_PARAMID_TITLE_CHINESE_S = 13, - CELL_GAME_PARAMID_TITLE_FINNISH = 14, - CELL_GAME_PARAMID_TITLE_SWEDISH = 15, - CELL_GAME_PARAMID_TITLE_DANISH = 16, - CELL_GAME_PARAMID_TITLE_NORWEGIAN = 17, - CELL_GAME_PARAMID_TITLE_POLISH = 18, + // Strings + CELL_GAME_PARAMID_TITLE = 0, + CELL_GAME_PARAMID_TITLE_DEFAULT = 1, + CELL_GAME_PARAMID_TITLE_JAPANESE = 2, + CELL_GAME_PARAMID_TITLE_ENGLISH = 3, + CELL_GAME_PARAMID_TITLE_FRENCH = 4, + CELL_GAME_PARAMID_TITLE_SPANISH = 5, + CELL_GAME_PARAMID_TITLE_GERMAN = 6, + CELL_GAME_PARAMID_TITLE_ITALIAN = 7, + CELL_GAME_PARAMID_TITLE_DUTCH = 8, + CELL_GAME_PARAMID_TITLE_PORTUGUESE = 9, + CELL_GAME_PARAMID_TITLE_RUSSIAN = 10, + CELL_GAME_PARAMID_TITLE_KOREAN = 11, + CELL_GAME_PARAMID_TITLE_CHINESE_T = 12, + CELL_GAME_PARAMID_TITLE_CHINESE_S = 13, + CELL_GAME_PARAMID_TITLE_FINNISH = 14, + CELL_GAME_PARAMID_TITLE_SWEDISH = 15, + CELL_GAME_PARAMID_TITLE_DANISH = 16, + CELL_GAME_PARAMID_TITLE_NORWEGIAN = 17, + CELL_GAME_PARAMID_TITLE_POLISH = 18, CELL_GAME_PARAMID_TITLE_PORTUGUESE_BRAZIL = 19, // FW 4.00 - CELL_GAME_PARAMID_TITLE_ENGLISH_UK = 20, // FW 4.00 - CELL_GAME_PARAMID_TITLE_TURKISH = 21, // FW 4.30 - CELL_GAME_PARAMID_TITLE_ID = 100, - CELL_GAME_PARAMID_VERSION = 101, - CELL_GAME_PARAMID_PS3_SYSTEM_VER = 105, - CELL_GAME_PARAMID_APP_VER = 106, + CELL_GAME_PARAMID_TITLE_ENGLISH_UK = 20, // FW 4.00 + CELL_GAME_PARAMID_TITLE_TURKISH = 21, // FW 4.30 + CELL_GAME_PARAMID_TITLE_ID = 100, + CELL_GAME_PARAMID_VERSION = 101, + CELL_GAME_PARAMID_PS3_SYSTEM_VER = 105, + CELL_GAME_PARAMID_APP_VER = 106, }; -//Error dialog types +// Error dialog types enum { - CELL_GAME_ERRDIALOG_BROKEN_GAMEDATA = 0, - CELL_GAME_ERRDIALOG_BROKEN_HDDGAME = 1, - CELL_GAME_ERRDIALOG_NOSPACE = 2, + CELL_GAME_ERRDIALOG_BROKEN_GAMEDATA = 0, + CELL_GAME_ERRDIALOG_BROKEN_HDDGAME = 1, + CELL_GAME_ERRDIALOG_NOSPACE = 2, CELL_GAME_ERRDIALOG_BROKEN_EXIT_GAMEDATA = 100, - CELL_GAME_ERRDIALOG_BROKEN_EXIT_HDDGAME = 101, - CELL_GAME_ERRDIALOG_NOSPACE_EXIT = 102, + CELL_GAME_ERRDIALOG_BROKEN_EXIT_HDDGAME = 101, + CELL_GAME_ERRDIALOG_NOSPACE_EXIT = 102, }; enum // CellGameResolution { - CELL_GAME_RESOLUTION_480 = 0x01, - CELL_GAME_RESOLUTION_576 = 0x02, - CELL_GAME_RESOLUTION_720 = 0x04, - CELL_GAME_RESOLUTION_1080 = 0x08, + CELL_GAME_RESOLUTION_480 = 0x01, + CELL_GAME_RESOLUTION_576 = 0x02, + CELL_GAME_RESOLUTION_720 = 0x04, + CELL_GAME_RESOLUTION_1080 = 0x08, CELL_GAME_RESOLUTION_480SQ = 0x10, CELL_GAME_RESOLUTION_576SQ = 0x20, }; enum // CellGameSoundFormat { - CELL_GAME_SOUNDFORMAT_2LPCM = 0x01, - CELL_GAME_SOUNDFORMAT_51LPCM = 0x04, - CELL_GAME_SOUNDFORMAT_71LPCM = 0x10, - CELL_GAME_SOUNDFORMAT_51DDENC = 0x102, + CELL_GAME_SOUNDFORMAT_2LPCM = 0x01, + CELL_GAME_SOUNDFORMAT_51LPCM = 0x04, + CELL_GAME_SOUNDFORMAT_71LPCM = 0x10, + CELL_GAME_SOUNDFORMAT_51DDENC = 0x102, CELL_GAME_SOUNDFORMAT_51DTSENC = 0x202, }; @@ -183,37 +183,37 @@ struct CellGameDataCBResult enum // old consts { - CELL_GAMEDATA_CBRESULT_OK_CANCEL = 1, - CELL_GAMEDATA_CBRESULT_OK = 0, + CELL_GAMEDATA_CBRESULT_OK_CANCEL = 1, + CELL_GAMEDATA_CBRESULT_OK = 0, CELL_GAMEDATA_CBRESULT_ERR_NOSPACE = -1, - CELL_GAMEDATA_CBRESULT_ERR_BROKEN = -3, - CELL_GAMEDATA_CBRESULT_ERR_NODATA = -4, + CELL_GAMEDATA_CBRESULT_ERR_BROKEN = -3, + CELL_GAMEDATA_CBRESULT_ERR_NODATA = -4, CELL_GAMEDATA_CBRESULT_ERR_INVALID = -5, - CELL_GAMEDATA_RET_OK = 0, + CELL_GAMEDATA_RET_OK = 0, CELL_GAMEDATA_RET_CANCEL = 1, - CELL_GAMEDATA_ATTR_NORMAL = 0, + CELL_GAMEDATA_ATTR_NORMAL = 0, CELL_GAMEDATA_VERSION_CURRENT = 0, CELL_GAMEDATA_INVALIDMSG_MAX = 256, - CELL_GAMEDATA_PATH_MAX = 1055, - CELL_GAMEDATA_DIRNAME_SIZE = 32, + CELL_GAMEDATA_PATH_MAX = 1055, + CELL_GAMEDATA_DIRNAME_SIZE = 32, CELL_GAMEDATA_SIZEKB_NOTCALC = -1, CELL_GAMEDATA_SYSP_LANGUAGE_NUM = 20, - CELL_GAMEDATA_SYSP_TITLE_SIZE = 128, + CELL_GAMEDATA_SYSP_TITLE_SIZE = 128, CELL_GAMEDATA_SYSP_TITLEID_SIZE = 10, CELL_GAMEDATA_SYSP_VERSION_SIZE = 6, - CELL_GAMEDATA_ISNEWDATA_NO = 0, + CELL_GAMEDATA_ISNEWDATA_NO = 0, CELL_GAMEDATA_ISNEWDATA_YES = 1, - CELL_GAMEDATA_ERRDIALOG_NONE = 0, + CELL_GAMEDATA_ERRDIALOG_NONE = 0, CELL_GAMEDATA_ERRDIALOG_ALWAYS = 1, - CELL_DISCGAME_SYSP_TITLEID_SIZE=10, + CELL_DISCGAME_SYSP_TITLEID_SIZE = 10, }; enum @@ -231,7 +231,7 @@ struct CellGameDataSystemFileParam char reserved1[2]; be_t parentalLevel; be_t attribute; - be_t resolution; // cellHddGameCheck member: GD doesn't have this value + be_t resolution; // cellHddGameCheck member: GD doesn't have this value be_t soundFormat; // cellHddGameCheck member: GD doesn't have this value char reserved2[248]; }; @@ -272,46 +272,46 @@ typedef void(CellGameDataStatCallback)(vm::ptr cbResult, v enum CellHddGameError : u32 { - CELL_HDDGAME_ERROR_CBRESULT = 0x8002ba01, + CELL_HDDGAME_ERROR_CBRESULT = 0x8002ba01, CELL_HDDGAME_ERROR_ACCESS_ERROR = 0x8002ba02, - CELL_HDDGAME_ERROR_INTERNAL = 0x8002ba03, - CELL_HDDGAME_ERROR_PARAM = 0x8002ba04, - CELL_HDDGAME_ERROR_NOSPACE = 0x8002ba05, - CELL_HDDGAME_ERROR_BROKEN = 0x8002ba06, - CELL_HDDGAME_ERROR_FAILURE = 0x8002ba07, + CELL_HDDGAME_ERROR_INTERNAL = 0x8002ba03, + CELL_HDDGAME_ERROR_PARAM = 0x8002ba04, + CELL_HDDGAME_ERROR_NOSPACE = 0x8002ba05, + CELL_HDDGAME_ERROR_BROKEN = 0x8002ba06, + CELL_HDDGAME_ERROR_FAILURE = 0x8002ba07, }; enum { // Return Codes - CELL_HDDGAME_RET_OK = 0, + CELL_HDDGAME_RET_OK = 0, CELL_HDDGAME_RET_CANCEL = 1, // Callback Result - CELL_HDDGAME_CBRESULT_OK_CANCEL = 1, - CELL_HDDGAME_CBRESULT_OK = 0, - CELL_HDDGAME_CBRESULT_ERR_NOSPACE = -1, - CELL_HDDGAME_CBRESULT_ERR_BROKEN = -3, - CELL_HDDGAME_CBRESULT_ERR_NODATA = -4, - CELL_HDDGAME_CBRESULT_ERR_INVALID = -5, + CELL_HDDGAME_CBRESULT_OK_CANCEL = 1, + CELL_HDDGAME_CBRESULT_OK = 0, + CELL_HDDGAME_CBRESULT_ERR_NOSPACE = -1, + CELL_HDDGAME_CBRESULT_ERR_BROKEN = -3, + CELL_HDDGAME_CBRESULT_ERR_NODATA = -4, + CELL_HDDGAME_CBRESULT_ERR_INVALID = -5, // Character Strings - CELL_HDDGAME_INVALIDMSG_MAX = 256, - CELL_HDDGAME_PATH_MAX = 1055, - CELL_HDDGAME_SYSP_TITLE_SIZE = 128, - CELL_HDDGAME_SYSP_TITLEID_SIZE = 10, - CELL_HDDGAME_SYSP_VERSION_SIZE = 6, - CELL_HDDGAME_SYSP_SYSTEMVER_SIZE = 8, + CELL_HDDGAME_INVALIDMSG_MAX = 256, + CELL_HDDGAME_PATH_MAX = 1055, + CELL_HDDGAME_SYSP_TITLE_SIZE = 128, + CELL_HDDGAME_SYSP_TITLEID_SIZE = 10, + CELL_HDDGAME_SYSP_VERSION_SIZE = 6, + CELL_HDDGAME_SYSP_SYSTEMVER_SIZE = 8, // HDD Directory exists - CELL_HDDGAME_ISNEWDATA_EXIST = 0, - CELL_HDDGAME_ISNEWDATA_NODIR = 1, + CELL_HDDGAME_ISNEWDATA_EXIST = 0, + CELL_HDDGAME_ISNEWDATA_NODIR = 1, // Languages - CELL_HDDGAME_SYSP_LANGUAGE_NUM = 20, + CELL_HDDGAME_SYSP_LANGUAGE_NUM = 20, // Stat Get - CELL_HDDGAME_SIZEKB_NOTCALC = -1, + CELL_HDDGAME_SIZEKB_NOTCALC = -1, }; using CellHddGameStatGet = CellGameDataStatGet; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellGameExec.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellGameExec.cpp index b5284ce68..cea75846f 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellGameExec.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellGameExec.cpp @@ -134,15 +134,15 @@ error_code cellGameGetList(u32 listBufNum, u32 unk, vm::ptr listNum, vm::pt } DECLARE(ppu_module_manager::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, cellGameExecGame); - REG_FUNC(cellGameExec, cellGameDeleteGame); - REG_FUNC(cellGameExec, cellGameGetBootGameInfo); - REG_FUNC(cellGameExec, cellGameGetExitGameInfo); - REG_FUNC(cellGameExec, cellGameGetList); -}); + { + REG_FUNC(cellGameExec, cellGameSetExitParam); + REG_FUNC(cellGameExec, cellGameGetHomeDataExportPath); + REG_FUNC(cellGameExec, cellGameGetHomePath); + REG_FUNC(cellGameExec, cellGameGetHomeDataImportPath); + REG_FUNC(cellGameExec, cellGameGetHomeLaunchOptionPath); + REG_FUNC(cellGameExec, cellGameExecGame); + REG_FUNC(cellGameExec, cellGameDeleteGame); + REG_FUNC(cellGameExec, cellGameGetBootGameInfo); + REG_FUNC(cellGameExec, cellGameGetExitGameInfo); + REG_FUNC(cellGameExec, cellGameGetList); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp index 426d02595..c8ecfa215 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp @@ -14,23 +14,23 @@ LOG_CHANNEL(cellGcmSys); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_GCM_ERROR_FAILURE); - STR_CASE(CELL_GCM_ERROR_NO_IO_PAGE_TABLE); - STR_CASE(CELL_GCM_ERROR_INVALID_ENUM); - STR_CASE(CELL_GCM_ERROR_INVALID_VALUE); - STR_CASE(CELL_GCM_ERROR_INVALID_ALIGNMENT); - STR_CASE(CELL_GCM_ERROR_ADDRESS_OVERWRAP); - } + switch (error) + { + STR_CASE(CELL_GCM_ERROR_FAILURE); + STR_CASE(CELL_GCM_ERROR_NO_IO_PAGE_TABLE); + STR_CASE(CELL_GCM_ERROR_INVALID_ENUM); + STR_CASE(CELL_GCM_ERROR_INVALID_VALUE); + STR_CASE(CELL_GCM_ERROR_INVALID_ALIGNMENT); + STR_CASE(CELL_GCM_ERROR_ADDRESS_OVERWRAP); + } - return unknown; - }); + return unknown; + }); } namespace rsx @@ -53,7 +53,7 @@ namespace rsx return sizeof(u32); } -} +} // namespace rsx extern s32 cellGcmCallback(ppu_thread& ppu, vm::ptr context, u32 count); @@ -66,8 +66,7 @@ const u32 tiled_pitches[] = { 0x00003400, 0x00003800, 0x00004000, 0x00005000, 0x00006000, 0x00006800, 0x00007000, 0x00008000, 0x0000A000, 0x0000C000, 0x0000D000, 0x0000E000, - 0x00010000 -}; + 0x00010000}; // Auxiliary functions @@ -181,7 +180,8 @@ u32 cellGcmGetNotifyDataAddress(u32 index) // If entry not in use, return NULL u16 entry = g_fxo->get().offsetTable.eaAddress[241]; - if (entry == 0xFFFF) { + if (entry == 0xFFFF) + { return 0; } @@ -205,7 +205,8 @@ u32 cellGcmGetReport(u32 type, u32 index) cellGcmSys.error("cellGcmGetReport: Wrong local index (%d)", index); } - if (type < 1 || type > 5) { + if (type < 1 || type > 5) + { return -1; } @@ -352,8 +353,10 @@ u32 cellGcmGetTiledPitchSize(u32 size) { cellGcmSys.trace("cellGcmGetTiledPitchSize(size=%d)", size); - for (usz i = 0; i < std::size(tiled_pitches) - 1; i++) { - if (tiled_pitches[i] < size && size <= tiled_pitches[i + 1]) { + for (usz i = 0; i < std::size(tiled_pitches) - 1; i++) + { + if (tiled_pitches[i] < size && size <= tiled_pitches[i + 1]) + { return tiled_pitches[i + 1]; } } @@ -387,7 +390,7 @@ error_code _cellGcmInitBody(ppu_thread& ppu, vm::pptr contex gcm_cfg.local_size = 0; gcm_cfg.local_addr = 0; - //if (!gcm_cfg.local_size && !gcm_cfg.local_addr) + // if (!gcm_cfg.local_size && !gcm_cfg.local_addr) { gcm_cfg.local_size = 0xf900000; // TODO: Get sdk_version in _cellGcmFunc15 and pass it to gcmGetLocalMemorySize gcm_cfg.local_addr = rsx::constants::local_mem_base; @@ -423,8 +426,8 @@ error_code _cellGcmInitBody(ppu_thread& ppu, vm::pptr contex gcm_cfg.current_config.ioSize = ioSize; gcm_cfg.current_config.ioAddress = ioAddress; - gcm_cfg.current_config.localSize = gcm_cfg.local_size; - gcm_cfg.current_config.localAddress = gcm_cfg.local_addr; + gcm_cfg.current_config.localSize = gcm_cfg.local_size; + gcm_cfg.current_config.localAddress = gcm_cfg.local_addr; gcm_cfg.current_config.memoryFrequency = 650000000; gcm_cfg.current_config.coreFrequency = 500000000; @@ -436,7 +439,7 @@ error_code _cellGcmInitBody(ppu_thread& ppu, vm::pptr contex gcm_cfg.gcm_info.context_addr = rsx_ctxaddr; gcm_cfg.gcm_info.control_addr = render->dma_address; - gcm_cfg.current_context.begin.set(g_defaultCommandBufferBegin + 4096); // 4 kb reserved at the beginning + gcm_cfg.current_context.begin.set(g_defaultCommandBufferBegin + 4096); // 4 kb reserved at the beginning gcm_cfg.current_context.end.set(g_defaultCommandBufferBegin + 32 * 1024 - 4); // 4b at the end for jump gcm_cfg.current_context.current = gcm_cfg.current_context.begin; gcm_cfg.current_context.callback.set(g_fxo->get().func_addr(FIND_FUNC(cellGcmCallback))); @@ -586,7 +589,7 @@ ret_type gcmSetPrepareFlip(ppu_thread& ppu, vm::ptr ctxt, u3 } } - const u32 cmd_size = rsx::make_command(ctxt->current, GCM_FLIP_COMMAND, { id }); + const u32 cmd_size = rsx::make_command(ctxt->current, GCM_FLIP_COMMAND, {id}); if (!old_api && ctxt.addr() == gcm_cfg.gcm_info.context_addr) { @@ -700,7 +703,7 @@ void cellGcmSetUserCommand(ppu_thread& ppu, vm::ptr ctxt, u3 } } - rsx::make_command(ctxt->current, GCM_SET_USER_COMMAND, { cause }); + rsx::make_command(ctxt->current, GCM_SET_USER_COMMAND, {cause}); } void cellGcmSetVBlankHandler(vm::ptr handler) @@ -726,14 +729,14 @@ void cellGcmSetWaitFlip(ppu_thread& ppu, vm::ptr ctxt) } } - rsx::make_command(ctxt->current, NV406E_SEMAPHORE_OFFSET, { 0x10u, 0 }); + rsx::make_command(ctxt->current, NV406E_SEMAPHORE_OFFSET, {0x10u, 0}); } void cellGcmSetWaitFlipUnsafe(vm::ptr ctxt) { cellGcmSys.trace("cellGcmSetWaitFlipUnsafe(ctxt=*0x%x)", ctxt); - rsx::make_command(ctxt->current, NV406E_SEMAPHORE_OFFSET, { 0x10u, 0 }); + rsx::make_command(ctxt->current, NV406E_SEMAPHORE_OFFSET, {0x10u, 0}); } void cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, u32 zFormat, u32 aaFormat, u32 zCullDir, u32 zCullFormat, u32 sFunc, u32 sRef, u32 sMask) @@ -1085,7 +1088,8 @@ error_code cellGcmMapMainMemory(ppu_thread& ppu, u32 ea, u32 size, vm::ptr { cellGcmSys.warning("cellGcmMapMainMemory(ea=0x%x, size=0x%x, offset=*0x%x)", ea, size, offset); - if (!size || (ea & 0xFFFFF) || (size & 0xFFFFF)) return CELL_GCM_ERROR_FAILURE; + if (!size || (ea & 0xFFFFF) || (size & 0xFFFFF)) + return CELL_GCM_ERROR_FAILURE; auto& gcm_cfg = g_fxo->get(); std::lock_guard lock(gcm_cfg.gcmio_mutex); @@ -1314,7 +1318,7 @@ void _cellGcmSetFlipCommandWithWaitLabel(ppu_thread& ppu, vm::ptrcurrent, NV406E_SEMAPHORE_OFFSET, { label_index * 0x10, label_value }); + rsx::make_command(ctx->current, NV406E_SEMAPHORE_OFFSET, {label_index * 0x10, label_value}); if (auto error = gcmSetPrepareFlip(ppu, ctx, id); error < 0) { @@ -1415,10 +1419,8 @@ error_code cellGcmGpadCaptureSnapshot(u32 num) return CELL_OK; } - //---------------------------------------------------------------------------- - /** * Using current to determine what is the next useable command buffer. * Caller may wait for RSX not to use the command buffer. @@ -1498,123 +1500,123 @@ s32 cellGcmCallback(ppu_thread& ppu, vm::ptr context, u32 co //---------------------------------------------------------------------------- DECLARE(ppu_module_manager::cellGcmSys)("cellGcmSys", []() -{ - // Data Retrieval - REG_FUNC(cellGcmSys, cellGcmGetCurrentField); - REG_FUNC(cellGcmSys, cellGcmGetLabelAddress); - REG_FUNC(cellGcmSys, cellGcmGetNotifyDataAddress); - REG_FUNC(cellGcmSys, _cellGcmFunc12); - REG_FUNC(cellGcmSys, cellGcmGetReport); - REG_FUNC(cellGcmSys, cellGcmGetReportDataAddress); - REG_FUNC(cellGcmSys, cellGcmGetReportDataAddressLocation); - REG_FUNC(cellGcmSys, cellGcmGetReportDataLocation); - REG_FUNC(cellGcmSys, cellGcmGetTimeStamp).flag(MFF_FORCED_HLE); // HLE-ing this allows for optimizations around reports - REG_FUNC(cellGcmSys, cellGcmGetTimeStampLocation); + { + // Data Retrieval + REG_FUNC(cellGcmSys, cellGcmGetCurrentField); + REG_FUNC(cellGcmSys, cellGcmGetLabelAddress); + REG_FUNC(cellGcmSys, cellGcmGetNotifyDataAddress); + REG_FUNC(cellGcmSys, _cellGcmFunc12); + REG_FUNC(cellGcmSys, cellGcmGetReport); + REG_FUNC(cellGcmSys, cellGcmGetReportDataAddress); + REG_FUNC(cellGcmSys, cellGcmGetReportDataAddressLocation); + REG_FUNC(cellGcmSys, cellGcmGetReportDataLocation); + REG_FUNC(cellGcmSys, cellGcmGetTimeStamp).flag(MFF_FORCED_HLE); // HLE-ing this allows for optimizations around reports + REG_FUNC(cellGcmSys, cellGcmGetTimeStampLocation); - // Command Buffer Control - REG_FUNC(cellGcmSys, cellGcmGetControlRegister); - REG_FUNC(cellGcmSys, cellGcmGetDefaultCommandWordSize); - REG_FUNC(cellGcmSys, cellGcmGetDefaultSegmentWordSize); - REG_FUNC(cellGcmSys, cellGcmInitDefaultFifoMode); - REG_FUNC(cellGcmSys, cellGcmSetDefaultFifoSize); + // Command Buffer Control + REG_FUNC(cellGcmSys, cellGcmGetControlRegister); + REG_FUNC(cellGcmSys, cellGcmGetDefaultCommandWordSize); + REG_FUNC(cellGcmSys, cellGcmGetDefaultSegmentWordSize); + REG_FUNC(cellGcmSys, cellGcmInitDefaultFifoMode); + REG_FUNC(cellGcmSys, cellGcmSetDefaultFifoSize); - // Hardware Resource Management - REG_FUNC(cellGcmSys, cellGcmBindTile); - REG_FUNC(cellGcmSys, cellGcmBindZcull); - REG_FUNC(cellGcmSys, cellGcmDumpGraphicsError); - REG_FUNC(cellGcmSys, cellGcmGetConfiguration); - REG_FUNC(cellGcmSys, cellGcmGetDisplayBufferByFlipIndex); - REG_FUNC(cellGcmSys, cellGcmGetFlipStatus); - REG_FUNC(cellGcmSys, cellGcmGetFlipStatus2); - REG_FUNC(cellGcmSys, cellGcmGetLastFlipTime); - REG_FUNC(cellGcmSys, cellGcmGetLastFlipTime2); - REG_FUNC(cellGcmSys, cellGcmGetLastSecondVTime); - REG_FUNC(cellGcmSys, cellGcmGetTiledPitchSize); - REG_FUNC(cellGcmSys, cellGcmGetVBlankCount); - REG_FUNC(cellGcmSys, cellGcmGetVBlankCount2); - REG_FUNC(cellGcmSys, cellGcmSysGetLastVBlankTime); - REG_FUNC(cellGcmSys, _cellGcmFunc1); - REG_FUNC(cellGcmSys, _cellGcmFunc15); - REG_FUNC(cellGcmSys, _cellGcmInitBody); - REG_FUNC(cellGcmSys, cellGcmInitSystemMode); - REG_FUNC(cellGcmSys, cellGcmResetFlipStatus); - REG_FUNC(cellGcmSys, cellGcmResetFlipStatus2); - REG_FUNC(cellGcmSys, cellGcmSetDebugOutputLevel); - REG_FUNC(cellGcmSys, cellGcmSetDisplayBuffer); - REG_FUNC(cellGcmSys, cellGcmSetFlip); // - REG_FUNC(cellGcmSys, cellGcmSetFlipHandler); - REG_FUNC(cellGcmSys, cellGcmSetFlipHandler2); - REG_FUNC(cellGcmSys, cellGcmSetFlipImmediate); - REG_FUNC(cellGcmSys, cellGcmSetFlipImmediate2); - REG_FUNC(cellGcmSys, cellGcmSetFlipMode); - REG_FUNC(cellGcmSys, cellGcmSetFlipMode2); - REG_FUNC(cellGcmSys, cellGcmSetFlipStatus); - REG_FUNC(cellGcmSys, cellGcmSetFlipStatus2); - REG_FUNC(cellGcmSys, cellGcmSetGraphicsHandler); - REG_FUNC(cellGcmSys, cellGcmSetPrepareFlip); - REG_FUNC(cellGcmSys, cellGcmSetQueueHandler); - REG_FUNC(cellGcmSys, cellGcmSetSecondVFrequency); - REG_FUNC(cellGcmSys, cellGcmSetSecondVHandler); - REG_FUNC(cellGcmSys, cellGcmSetTileInfo); - REG_FUNC(cellGcmSys, cellGcmSetUserHandler); - REG_FUNC(cellGcmSys, cellGcmSetUserCommand); // - REG_FUNC(cellGcmSys, cellGcmSetVBlankFrequency); - REG_FUNC(cellGcmSys, cellGcmSetVBlankHandler); - REG_FUNC(cellGcmSys, cellGcmSetWaitFlip); // - REG_FUNC(cellGcmSys, cellGcmSetWaitFlipUnsafe); // - REG_FUNC(cellGcmSys, cellGcmSetZcull); - REG_FUNC(cellGcmSys, cellGcmSortRemapEaIoAddress); - REG_FUNC(cellGcmSys, cellGcmUnbindTile); - REG_FUNC(cellGcmSys, cellGcmUnbindZcull); - REG_FUNC(cellGcmSys, cellGcmGetTileInfo); - REG_FUNC(cellGcmSys, cellGcmGetZcullInfo); - REG_FUNC(cellGcmSys, cellGcmGetDisplayInfo); - REG_FUNC(cellGcmSys, cellGcmGetCurrentDisplayBufferId); - REG_FUNC(cellGcmSys, cellGcmSetInvalidateTile); - REG_FUNC(cellGcmSys, cellGcmTerminate); + // Hardware Resource Management + REG_FUNC(cellGcmSys, cellGcmBindTile); + REG_FUNC(cellGcmSys, cellGcmBindZcull); + REG_FUNC(cellGcmSys, cellGcmDumpGraphicsError); + REG_FUNC(cellGcmSys, cellGcmGetConfiguration); + REG_FUNC(cellGcmSys, cellGcmGetDisplayBufferByFlipIndex); + REG_FUNC(cellGcmSys, cellGcmGetFlipStatus); + REG_FUNC(cellGcmSys, cellGcmGetFlipStatus2); + REG_FUNC(cellGcmSys, cellGcmGetLastFlipTime); + REG_FUNC(cellGcmSys, cellGcmGetLastFlipTime2); + REG_FUNC(cellGcmSys, cellGcmGetLastSecondVTime); + REG_FUNC(cellGcmSys, cellGcmGetTiledPitchSize); + REG_FUNC(cellGcmSys, cellGcmGetVBlankCount); + REG_FUNC(cellGcmSys, cellGcmGetVBlankCount2); + REG_FUNC(cellGcmSys, cellGcmSysGetLastVBlankTime); + REG_FUNC(cellGcmSys, _cellGcmFunc1); + REG_FUNC(cellGcmSys, _cellGcmFunc15); + REG_FUNC(cellGcmSys, _cellGcmInitBody); + REG_FUNC(cellGcmSys, cellGcmInitSystemMode); + REG_FUNC(cellGcmSys, cellGcmResetFlipStatus); + REG_FUNC(cellGcmSys, cellGcmResetFlipStatus2); + REG_FUNC(cellGcmSys, cellGcmSetDebugOutputLevel); + REG_FUNC(cellGcmSys, cellGcmSetDisplayBuffer); + REG_FUNC(cellGcmSys, cellGcmSetFlip); // + REG_FUNC(cellGcmSys, cellGcmSetFlipHandler); + REG_FUNC(cellGcmSys, cellGcmSetFlipHandler2); + REG_FUNC(cellGcmSys, cellGcmSetFlipImmediate); + REG_FUNC(cellGcmSys, cellGcmSetFlipImmediate2); + REG_FUNC(cellGcmSys, cellGcmSetFlipMode); + REG_FUNC(cellGcmSys, cellGcmSetFlipMode2); + REG_FUNC(cellGcmSys, cellGcmSetFlipStatus); + REG_FUNC(cellGcmSys, cellGcmSetFlipStatus2); + REG_FUNC(cellGcmSys, cellGcmSetGraphicsHandler); + REG_FUNC(cellGcmSys, cellGcmSetPrepareFlip); + REG_FUNC(cellGcmSys, cellGcmSetQueueHandler); + REG_FUNC(cellGcmSys, cellGcmSetSecondVFrequency); + REG_FUNC(cellGcmSys, cellGcmSetSecondVHandler); + REG_FUNC(cellGcmSys, cellGcmSetTileInfo); + REG_FUNC(cellGcmSys, cellGcmSetUserHandler); + REG_FUNC(cellGcmSys, cellGcmSetUserCommand); // + REG_FUNC(cellGcmSys, cellGcmSetVBlankFrequency); + REG_FUNC(cellGcmSys, cellGcmSetVBlankHandler); + REG_FUNC(cellGcmSys, cellGcmSetWaitFlip); // + REG_FUNC(cellGcmSys, cellGcmSetWaitFlipUnsafe); // + REG_FUNC(cellGcmSys, cellGcmSetZcull); + REG_FUNC(cellGcmSys, cellGcmSortRemapEaIoAddress); + REG_FUNC(cellGcmSys, cellGcmUnbindTile); + REG_FUNC(cellGcmSys, cellGcmUnbindZcull); + REG_FUNC(cellGcmSys, cellGcmGetTileInfo); + REG_FUNC(cellGcmSys, cellGcmGetZcullInfo); + REG_FUNC(cellGcmSys, cellGcmGetDisplayInfo); + REG_FUNC(cellGcmSys, cellGcmGetCurrentDisplayBufferId); + REG_FUNC(cellGcmSys, cellGcmSetInvalidateTile); + REG_FUNC(cellGcmSys, cellGcmTerminate); - // Memory Mapping - REG_FUNC(cellGcmSys, cellGcmAddressToOffset); - REG_FUNC(cellGcmSys, cellGcmGetMaxIoMapSize); - REG_FUNC(cellGcmSys, cellGcmGetOffsetTable); - REG_FUNC(cellGcmSys, cellGcmIoOffsetToAddress); - REG_FUNC(cellGcmSys, cellGcmMapEaIoAddress); - REG_FUNC(cellGcmSys, cellGcmMapEaIoAddressWithFlags); - REG_FUNC(cellGcmSys, cellGcmMapLocalMemory); - REG_FUNC(cellGcmSys, cellGcmMapMainMemory); - REG_FUNC(cellGcmSys, cellGcmReserveIoMapSize); - REG_FUNC(cellGcmSys, cellGcmUnmapEaIoAddress); - REG_FUNC(cellGcmSys, cellGcmUnmapIoAddress); - REG_FUNC(cellGcmSys, cellGcmUnreserveIoMapSize); + // Memory Mapping + REG_FUNC(cellGcmSys, cellGcmAddressToOffset); + REG_FUNC(cellGcmSys, cellGcmGetMaxIoMapSize); + REG_FUNC(cellGcmSys, cellGcmGetOffsetTable); + REG_FUNC(cellGcmSys, cellGcmIoOffsetToAddress); + REG_FUNC(cellGcmSys, cellGcmMapEaIoAddress); + REG_FUNC(cellGcmSys, cellGcmMapEaIoAddressWithFlags); + REG_FUNC(cellGcmSys, cellGcmMapLocalMemory); + REG_FUNC(cellGcmSys, cellGcmMapMainMemory); + REG_FUNC(cellGcmSys, cellGcmReserveIoMapSize); + REG_FUNC(cellGcmSys, cellGcmUnmapEaIoAddress); + REG_FUNC(cellGcmSys, cellGcmUnmapIoAddress); + REG_FUNC(cellGcmSys, cellGcmUnreserveIoMapSize); - // Cursor - REG_FUNC(cellGcmSys, cellGcmInitCursor); - REG_FUNC(cellGcmSys, cellGcmSetCursorEnable); - REG_FUNC(cellGcmSys, cellGcmSetCursorDisable); - REG_FUNC(cellGcmSys, cellGcmSetCursorImageOffset); - REG_FUNC(cellGcmSys, cellGcmSetCursorPosition); - REG_FUNC(cellGcmSys, cellGcmUpdateCursor); + // Cursor + REG_FUNC(cellGcmSys, cellGcmInitCursor); + REG_FUNC(cellGcmSys, cellGcmSetCursorEnable); + REG_FUNC(cellGcmSys, cellGcmSetCursorDisable); + REG_FUNC(cellGcmSys, cellGcmSetCursorImageOffset); + REG_FUNC(cellGcmSys, cellGcmSetCursorPosition); + REG_FUNC(cellGcmSys, cellGcmUpdateCursor); - // Functions for Maintaining Compatibility - REG_FUNC(cellGcmSys, cellGcmSetDefaultCommandBuffer); - REG_FUNC(cellGcmSys, cellGcmSetDefaultCommandBufferAndSegmentWordSize); + // Functions for Maintaining Compatibility + REG_FUNC(cellGcmSys, cellGcmSetDefaultCommandBuffer); + REG_FUNC(cellGcmSys, cellGcmSetDefaultCommandBufferAndSegmentWordSize); - // Other - REG_FUNC(cellGcmSys, _cellGcmSetFlipCommand); - REG_FUNC(cellGcmSys, _cellGcmSetFlipCommand2); - REG_FUNC(cellGcmSys, _cellGcmSetFlipCommandWithWaitLabel); - REG_FUNC(cellGcmSys, cellGcmSetTile); - REG_FUNC(cellGcmSys, _cellGcmFunc2); - REG_FUNC(cellGcmSys, _cellGcmFunc3); - REG_FUNC(cellGcmSys, _cellGcmFunc4); - REG_FUNC(cellGcmSys, _cellGcmFunc13); - REG_FUNC(cellGcmSys, _cellGcmFunc38); + // Other + REG_FUNC(cellGcmSys, _cellGcmSetFlipCommand); + REG_FUNC(cellGcmSys, _cellGcmSetFlipCommand2); + REG_FUNC(cellGcmSys, _cellGcmSetFlipCommandWithWaitLabel); + REG_FUNC(cellGcmSys, cellGcmSetTile); + REG_FUNC(cellGcmSys, _cellGcmFunc2); + REG_FUNC(cellGcmSys, _cellGcmFunc3); + REG_FUNC(cellGcmSys, _cellGcmFunc4); + REG_FUNC(cellGcmSys, _cellGcmFunc13); + REG_FUNC(cellGcmSys, _cellGcmFunc38); - // GPAD - REG_FUNC(cellGcmSys, cellGcmGpadGetStatus); - REG_FUNC(cellGcmSys, cellGcmGpadNotifyCaptureSurface); - REG_FUNC(cellGcmSys, cellGcmGpadCaptureSnapshot); + // GPAD + REG_FUNC(cellGcmSys, cellGcmGpadGetStatus); + REG_FUNC(cellGcmSys, cellGcmGpadNotifyCaptureSurface); + REG_FUNC(cellGcmSys, cellGcmGpadCaptureSnapshot); - // Special - REG_HIDDEN_FUNC(cellGcmCallback); -}); + // Special + REG_HIDDEN_FUNC(cellGcmCallback); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellGcmSys.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellGcmSys.h index 9a46b0d98..aef2874f2 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellGcmSys.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellGcmSys.h @@ -5,12 +5,12 @@ enum CellGcmError : u32 { - CELL_GCM_ERROR_FAILURE = 0x802100ff, - CELL_GCM_ERROR_NO_IO_PAGE_TABLE = 0x80210001, - CELL_GCM_ERROR_INVALID_ENUM = 0x80210002, - CELL_GCM_ERROR_INVALID_VALUE = 0x80210003, + CELL_GCM_ERROR_FAILURE = 0x802100ff, + CELL_GCM_ERROR_NO_IO_PAGE_TABLE = 0x80210001, + CELL_GCM_ERROR_INVALID_ENUM = 0x80210002, + CELL_GCM_ERROR_INVALID_VALUE = 0x80210003, CELL_GCM_ERROR_INVALID_ALIGNMENT = 0x80210004, - CELL_GCM_ERROR_ADDRESS_OVERWRAP = 0x80210005, + CELL_GCM_ERROR_ADDRESS_OVERWRAP = 0x80210005, }; struct CellGcmOffsetTable diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellGem.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellGem.cpp index f051b6713..2da34a643 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellGem.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellGem.cpp @@ -31,101 +31,101 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](gem_btn value) - { - switch (value) { - case gem_btn::start: return "Start"; - case gem_btn::select: return "Select"; - case gem_btn::triangle: return "Triangle"; - case gem_btn::circle: return "Circle"; - case gem_btn::cross: return "Cross"; - case gem_btn::square: return "Square"; - case gem_btn::move: return "Move"; - case gem_btn::t: return "T"; - case gem_btn::x_axis: return "X-Axis"; - case gem_btn::y_axis: return "Y-Axis"; - case gem_btn::combo: return "Combo"; - case gem_btn::combo_start: return "Combo Start"; - case gem_btn::combo_select: return "Combo Select"; - case gem_btn::combo_triangle: return "Combo Triangle"; - case gem_btn::combo_circle: return "Combo Circle"; - case gem_btn::combo_cross: return "Combo Cross"; - case gem_btn::combo_square: return "Combo Square"; - case gem_btn::combo_move: return "Combo Move"; - case gem_btn::combo_t: return "Combo T"; - case gem_btn::count: return "Count"; - } + switch (value) + { + case gem_btn::start: return "Start"; + case gem_btn::select: return "Select"; + case gem_btn::triangle: return "Triangle"; + case gem_btn::circle: return "Circle"; + case gem_btn::cross: return "Cross"; + case gem_btn::square: return "Square"; + case gem_btn::move: return "Move"; + case gem_btn::t: return "T"; + case gem_btn::x_axis: return "X-Axis"; + case gem_btn::y_axis: return "Y-Axis"; + case gem_btn::combo: return "Combo"; + case gem_btn::combo_start: return "Combo Start"; + case gem_btn::combo_select: return "Combo Select"; + case gem_btn::combo_triangle: return "Combo Triangle"; + case gem_btn::combo_circle: return "Combo Circle"; + case gem_btn::combo_cross: return "Combo Cross"; + case gem_btn::combo_square: return "Combo Square"; + case gem_btn::combo_move: return "Combo Move"; + case gem_btn::combo_t: return "Combo T"; + case gem_btn::count: return "Count"; + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_GEM_ERROR_RESOURCE_ALLOCATION_FAILED); - STR_CASE(CELL_GEM_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_GEM_ERROR_UNINITIALIZED); - STR_CASE(CELL_GEM_ERROR_INVALID_PARAMETER); - STR_CASE(CELL_GEM_ERROR_INVALID_ALIGNMENT); - STR_CASE(CELL_GEM_ERROR_UPDATE_NOT_FINISHED); - STR_CASE(CELL_GEM_ERROR_UPDATE_NOT_STARTED); - STR_CASE(CELL_GEM_ERROR_CONVERT_NOT_FINISHED); - STR_CASE(CELL_GEM_ERROR_CONVERT_NOT_STARTED); - STR_CASE(CELL_GEM_ERROR_WRITE_NOT_FINISHED); - STR_CASE(CELL_GEM_ERROR_NOT_A_HUE); - } + switch (error) + { + STR_CASE(CELL_GEM_ERROR_RESOURCE_ALLOCATION_FAILED); + STR_CASE(CELL_GEM_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_GEM_ERROR_UNINITIALIZED); + STR_CASE(CELL_GEM_ERROR_INVALID_PARAMETER); + STR_CASE(CELL_GEM_ERROR_INVALID_ALIGNMENT); + STR_CASE(CELL_GEM_ERROR_UPDATE_NOT_FINISHED); + STR_CASE(CELL_GEM_ERROR_UPDATE_NOT_STARTED); + STR_CASE(CELL_GEM_ERROR_CONVERT_NOT_FINISHED); + STR_CASE(CELL_GEM_ERROR_CONVERT_NOT_STARTED); + STR_CASE(CELL_GEM_ERROR_WRITE_NOT_FINISHED); + STR_CASE(CELL_GEM_ERROR_NOT_A_HUE); + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_GEM_NOT_CONNECTED); - STR_CASE(CELL_GEM_SPHERE_NOT_CALIBRATED); - STR_CASE(CELL_GEM_SPHERE_CALIBRATING); - STR_CASE(CELL_GEM_COMPUTING_AVAILABLE_COLORS); - STR_CASE(CELL_GEM_HUE_NOT_SET); - STR_CASE(CELL_GEM_NO_VIDEO); - STR_CASE(CELL_GEM_TIME_OUT_OF_RANGE); - STR_CASE(CELL_GEM_NOT_CALIBRATED); - STR_CASE(CELL_GEM_NO_EXTERNAL_PORT_DEVICE); - } + switch (error) + { + STR_CASE(CELL_GEM_NOT_CONNECTED); + STR_CASE(CELL_GEM_SPHERE_NOT_CALIBRATED); + STR_CASE(CELL_GEM_SPHERE_CALIBRATING); + STR_CASE(CELL_GEM_COMPUTING_AVAILABLE_COLORS); + STR_CASE(CELL_GEM_HUE_NOT_SET); + STR_CASE(CELL_GEM_NO_VIDEO); + STR_CASE(CELL_GEM_TIME_OUT_OF_RANGE); + STR_CASE(CELL_GEM_NOT_CALIBRATED); + STR_CASE(CELL_GEM_NO_EXTERNAL_PORT_DEVICE); + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto format) - { - switch (format) { - STR_CASE(CELL_GEM_NO_VIDEO_OUTPUT); - STR_CASE(CELL_GEM_RGBA_640x480); - STR_CASE(CELL_GEM_YUV_640x480); - STR_CASE(CELL_GEM_YUV422_640x480); - STR_CASE(CELL_GEM_YUV411_640x480); - STR_CASE(CELL_GEM_RGBA_320x240); - STR_CASE(CELL_GEM_BAYER_RESTORED); - STR_CASE(CELL_GEM_BAYER_RESTORED_RGGB); - STR_CASE(CELL_GEM_BAYER_RESTORED_RASTERIZED); - } + switch (format) + { + STR_CASE(CELL_GEM_NO_VIDEO_OUTPUT); + STR_CASE(CELL_GEM_RGBA_640x480); + STR_CASE(CELL_GEM_YUV_640x480); + STR_CASE(CELL_GEM_YUV422_640x480); + STR_CASE(CELL_GEM_YUV411_640x480); + STR_CASE(CELL_GEM_RGBA_320x240); + STR_CASE(CELL_GEM_BAYER_RESTORED); + STR_CASE(CELL_GEM_BAYER_RESTORED_RGGB); + STR_CASE(CELL_GEM_BAYER_RESTORED_RASTERIZED); + } - return unknown; - }); + return unknown; + }); } // last 4 out of 7 ports (7,6,5,4). index starts at 1 @@ -250,9 +250,9 @@ public: f32 radius{5.0f}; // Radius of the sphere in camera pixels bool radius_valid = false; // If the radius and distance of the sphere was computed. Also used for visibility. - bool is_calibrating{false}; // Whether or not we are currently calibrating - u64 calibration_start_us{0}; // The start timestamp of the calibration in microseconds - u64 calibration_status_flags = 0; // The calibration status flags + bool is_calibrating{false}; // Whether or not we are currently calibrating + u64 calibration_start_us{0}; // The start timestamp of the calibration in microseconds + u64 calibration_status_flags = 0; // The calibration status flags static constexpr u64 calibration_time_us = 500000; // The calibration supposedly takes 0.5 seconds (500000 microseconds) }; @@ -346,7 +346,8 @@ public: { std::lock_guard lock(pad::g_pad_mutex); const auto handler = pad::get_pad_thread(true); - if (!handler) break; + if (!handler) + break; for (u32 i = 0; i < CELL_GEM_MAX_NUM; i++) { @@ -397,7 +398,8 @@ public: for (u32 gem_num = 0; gem_num < CELL_GEM_MAX_NUM; gem_num++) { gem_controller& controller = controllers[gem_num]; - if (!controller.is_calibrating) continue; + if (!controller.is_calibrating) + continue; bool controller_calibrated = true; @@ -418,7 +420,8 @@ public: } // The calibration takes ~0.5 seconds on real hardware - if ((get_guest_system_time() - controller.calibration_start_us) < gem_controller::calibration_time_us) continue; + if ((get_guest_system_time() - controller.calibration_start_us) < gem_controller::calibration_time_us) + continue; if (!controller_calibrated) { @@ -512,7 +515,7 @@ public: handler.Init(std::min(attribute.max_connect, CELL_GEM_MAX_NUM)); const MouseInfo& info = handler.GetInfo(); - connected_controllers = std::min({ info.now_connect, attribute.max_connect, CELL_GEM_MAX_NUM }); + connected_controllers = std::min({info.now_connect, attribute.max_connect, CELL_GEM_MAX_NUM}); if (gem_num < connected_controllers) { is_connected = true; @@ -647,8 +650,8 @@ static inline s32 cellGemGetVideoConvertSize(s32 output_format) return 640 * 480 + 320 * 480 + 320 * 480; case CELL_GEM_YUV411_640x480: // YUV411 output; 640*480+320*240+320*240-byte output buffer required (contiguous) return 640 * 480 + 320 * 240 + 320 * 240; - case CELL_GEM_BAYER_RESTORED: // Bayer pattern output, 640x480, gamma and white balance applied, output buffer required - case CELL_GEM_BAYER_RESTORED_RGGB: // Restored Bayer output, 2x2 pixels rearranged into 320x240 RG1G2B + case CELL_GEM_BAYER_RESTORED: // Bayer pattern output, 640x480, gamma and white balance applied, output buffer required + case CELL_GEM_BAYER_RESTORED_RGGB: // Restored Bayer output, 2x2 pixels rearranged into 320x240 RG1G2B case CELL_GEM_BAYER_RESTORED_RASTERIZED: // Restored Bayer output, R,G1,G2,B rearranged into 4 contiguous 320x240 1-channel rasters return 640 * 480; case CELL_GEM_NO_VIDEO_OUTPUT: // Disable video output @@ -675,13 +678,14 @@ namespace gem x = m_x; y = m_y; } + private: std::mutex m_mutex; f32 m_x = 0.0f; f32 m_y = 0.0f; }; - std::array positions {}; + std::array positions{}; struct YUV { @@ -690,20 +694,27 @@ namespace gem u8 v = 0; YUV(u8 r, u8 g, u8 b) - : y(Y(r, g, b)) - , u(U(r, g, b)) - , v(V(r, g, b)) + : y(Y(r, g, b)), u(U(r, g, b)), v(V(r, g, b)) { } - static inline u8 Y(u8 r, u8 g, u8 b) { return static_cast(0.299f * r + 0.587f * g + 0.114f * b); } - static inline u8 U(u8 r, u8 g, u8 b) { return static_cast(-0.14713f * r - 0.28886f * g + 0.436f * b); } - static inline u8 V(u8 r, u8 g, u8 b) { return static_cast(0.615f * r - 0.51499f * g - 0.10001f * b); } + static inline u8 Y(u8 r, u8 g, u8 b) + { + return static_cast(0.299f * r + 0.587f * g + 0.114f * b); + } + static inline u8 U(u8 r, u8 g, u8 b) + { + return static_cast(-0.14713f * r - 0.28886f * g + 0.436f * b); + } + static inline u8 V(u8 r, u8 g, u8 b) + { + return static_cast(0.615f * r - 0.51499f * g - 0.10001f * b); + } }; bool convert_image_format(CellCameraFormat input_format, CellGemVideoConvertFormatEnum output_format, - const std::vector& video_data_in, u32 width, u32 height, - u8* video_data_out, u32 video_data_out_size, std::string_view caller) + const std::vector& video_data_in, u32 width, u32 height, + u8* video_data_out, u32 video_data_out_size, std::string_view caller) { if (output_format != CELL_GEM_NO_VIDEO_OUTPUT && !video_data_out) { @@ -751,13 +762,13 @@ namespace gem for (u32 x = 0; x < width - 1; x += 2, src0 += 2, src1 += 2, dst0 += 8, dst1 += 8) { - const u8 b = src0[0]; + const u8 b = src0[0]; const u8 g0 = src0[1]; const u8 g1 = src1[0]; - const u8 r = src1[1]; + const u8 r = src1[1]; - const u8 top[4] = { r, g0, b, 255 }; - const u8 bottom[4] = { r, g1, b, 255 }; + const u8 top[4] = {r, g0, b, 255}; + const u8 bottom[4] = {r, g1, b, 255}; // Top-Left std::memcpy(dst0, top, 4); @@ -831,13 +842,13 @@ namespace gem for (u32 x = 0; x < width - 1; x += 2, src0 += 2, src1 += 2, dst_y0 += 2, dst_y1 += 2, dst_u0 += 2, dst_u1 += 2, dst_v0 += 2, dst_v1 += 2) { - const u8 b = src0[0]; + const u8 b = src0[0]; const u8 g0 = src0[1]; const u8 g1 = src1[0]; - const u8 r = src1[1]; + const u8 r = src1[1]; // Convert RGBA to YUV - const YUV yuv_top = YUV(r, g0, b); + const YUV yuv_top = YUV(r, g0, b); const YUV yuv_bottom = YUV(r, g1, b); dst_y0[0] = dst_y0[1] = yuv_top.y; @@ -916,13 +927,13 @@ namespace gem for (u32 x = 0; x < width - 1; x += 2, src0 += 2, src1 += 2, dst_y0 += 2, dst_y1 += 2) { - const u8 b = src0[0]; + const u8 b = src0[0]; const u8 g0 = src0[1]; const u8 g1 = src1[0]; - const u8 r = src1[1]; + const u8 r = src1[1]; // Convert RGBA to YUV - const YUV yuv_top = YUV(r, g0, b); + const YUV yuv_top = YUV(r, g0, b); const YUV yuv_bottom = YUV(r, g1, b); dst_y0[0] = dst_y0[1] = yuv_top.y; @@ -1006,21 +1017,21 @@ namespace gem for (u32 x = 0; x < width - 3; x += 4, src0 += 4, src1 += 4, dst_y0 += 4, dst_y1 += 4) { - const u8 b_left = src0[0]; - const u8 g0_left = src0[1]; - const u8 b_right = src0[2]; + const u8 b_left = src0[0]; + const u8 g0_left = src0[1]; + const u8 b_right = src0[2]; const u8 g0_right = src0[3]; - const u8 g1_left = src1[0]; - const u8 r_left = src1[1]; + const u8 g1_left = src1[0]; + const u8 r_left = src1[1]; const u8 g1_right = src1[2]; - const u8 r_right = src1[3]; + const u8 r_right = src1[3]; // Convert RGBA to YUV - const YUV yuv_top_left = YUV(r_left, g0_left, b_left); // Re-used for top-right - const u8 y_top_right = YUV::Y(r_right, g0_right, b_right); + const YUV yuv_top_left = YUV(r_left, g0_left, b_left); // Re-used for top-right + const u8 y_top_right = YUV::Y(r_right, g0_right, b_right); const YUV yuv_bottom_left = YUV(r_left, g1_left, b_left); // Re-used for bottom-right - const u8 y_bottom_right = YUV::Y(r_right, g1_right, b_right); + const u8 y_bottom_right = YUV::Y(r_right, g1_right, b_right); dst_y0[0] = dst_y0[1] = yuv_top_left.y; dst_y0[2] = dst_y0[3] = y_top_right; @@ -1104,13 +1115,13 @@ namespace gem for (u32 x = 0; x < width - 1; x += 2, src0 += 2, src1 += 2, dst0 += 4, dst1 += 4) { - const u8 b = src0[0]; + const u8 b = src0[0]; const u8 g0 = src0[1]; const u8 g1 = src1[0]; - const u8 r = src1[1]; + const u8 r = src1[1]; - const u8 top[4] = { r, g0, b, 255 }; - const u8 bottom[4] = { r, g1, b, 255 }; + const u8 top[4] = {r, g0, b, 255}; + const u8 bottom[4] = {r, g1, b, 255}; // Top-Left std::memcpy(dst0, top, 4); @@ -1147,7 +1158,7 @@ namespace gem } break; } - case CELL_GEM_BAYER_RESTORED_RGGB: // Restored Bayer output, 2x2 pixels rearranged into 320x240 RG1G2B + case CELL_GEM_BAYER_RESTORED_RGGB: // Restored Bayer output, 2x2 pixels rearranged into 320x240 RG1G2B case CELL_GEM_BAYER_RESTORED_RASTERIZED: // Restored Bayer output, R,G1,G2,B rearranged into 4 contiguous 320x240 1-channel rasters { cellGem.error("Unimplemented: Converting %s to %s (called from %s)", input_format, output_format, caller); @@ -1168,7 +1179,7 @@ namespace gem return true; } -} +} // namespace gem void gem_config_data::paint_spheres(CellGemVideoConvertFormatEnum output_format, u32 width, u32 height, u8* video_data_out, u32 video_data_out_size) { @@ -1194,7 +1205,8 @@ void gem_config_data::paint_spheres(CellGemVideoConvertFormatEnum output_format, for (u32 gem_num = 0; gem_num < CELL_GEM_MAX_NUM; gem_num++) { const gem_config_data::gem_controller& controller = controllers[gem_num]; - if (!controller.radius_valid || controller.radius <= 0.0f) continue; + if (!controller.radius_valid || controller.radius <= 0.0f) + continue; f32 x, y; ::at32(gem::positions, gem_num).get_position(x, y); @@ -1203,7 +1215,7 @@ void gem_config_data::paint_spheres(CellGemVideoConvertFormatEnum output_format, const u8 g = static_cast(std::clamp(controller.sphere_rgb.g * 255.0f, 0.0f, 255.0f)); const u8 b = static_cast(std::clamp(controller.sphere_rgb.b * 255.0f, 0.0f, 255.0f)); - sphere_info.push_back({ controller.radius, static_cast(x), static_cast(y), r, g, b }); + sphere_info.push_back({controller.radius, static_cast(x), static_cast(y), r, g, b}); } } @@ -1229,7 +1241,8 @@ void gem_config_data::paint_spheres(CellGemVideoConvertFormatEnum output_format, for (s32 x = x_begin; x < x_end; x++, dst += 4) { const f32 distance = static_cast(std::sqrt(std::pow(info.x - x, 2) + std::pow(info.y - y, 2))); - if (distance > info.radius) continue; + if (distance > info.radius) + continue; dst[0] = info.r; dst[1] = info.g; @@ -1241,12 +1254,12 @@ void gem_config_data::paint_spheres(CellGemVideoConvertFormatEnum output_format, break; } - case CELL_GEM_BAYER_RESTORED: // Bayer pattern output, 640x480, gamma and white balance applied, output buffer required - case CELL_GEM_RGBA_320x240: // RGBA output; 320*240*4-byte output buffer required - case CELL_GEM_YUV_640x480: // YUV output; 640*480+640*480+640*480-byte output buffer required (contiguous) - case CELL_GEM_YUV422_640x480: // YUV output; 640*480+320*480+320*480-byte output buffer required (contiguous) - case CELL_GEM_YUV411_640x480: // YUV411 output; 640*480+320*240+320*240-byte output buffer required (contiguous) - case CELL_GEM_BAYER_RESTORED_RGGB: // Restored Bayer output, 2x2 pixels rearranged into 320x240 RG1G2B + case CELL_GEM_BAYER_RESTORED: // Bayer pattern output, 640x480, gamma and white balance applied, output buffer required + case CELL_GEM_RGBA_320x240: // RGBA output; 320*240*4-byte output buffer required + case CELL_GEM_YUV_640x480: // YUV output; 640*480+640*480+640*480-byte output buffer required (contiguous) + case CELL_GEM_YUV422_640x480: // YUV output; 640*480+320*480+320*480-byte output buffer required (contiguous) + case CELL_GEM_YUV411_640x480: // YUV411 output; 640*480+320*240+320*240-byte output buffer required (contiguous) + case CELL_GEM_BAYER_RESTORED_RGGB: // Restored Bayer output, 2x2 pixels rearranged into 320x240 RG1G2B case CELL_GEM_BAYER_RESTORED_RASTERIZED: // Restored Bayer output, R,G1,G2,B rearranged into 4 contiguous 320x240 1-channel rasters { cellGem.trace("Unimplemented: painting spheres for %s", output_format); @@ -1495,12 +1508,14 @@ public: { for (auto& binding : it->second->bindings()) { - if (!binding.device) continue; + if (!binding.device) + continue; // last 4 out of 7 ports (6,5,4,3). index starts at 0 const s32 gem_num = std::abs(binding.device->player_id - CELL_PAD_MAX_PORT_NUM) - 1; - if (gem_num < 0 || gem_num >= CELL_GEM_MAX_NUM) continue; + if (gem_num < 0 || gem_num >= CELL_GEM_MAX_NUM) + continue; binding.device->color_override_active = true; @@ -1599,7 +1614,7 @@ static inline void draw_overlay_cursor(u32 gem_num, const gem_config::gem_contro // Note: We shouldn't use sphere_rgb here. The game will set it to black in many cases. const gem_config_data::gem_color& rgb = gem_config_data::gem_color::get_default_color(gem_num); - const color4f color = { rgb.r, rgb.g, rgb.b, 0.85f }; + const color4f color = {rgb.r, rgb.g, rgb.b, 0.85f}; rsx::overlays::set_cursor(rsx::overlays::cursor_offset::cell_gem + gem_num, x, y, color, 2'000'000, false); } @@ -1608,12 +1623,20 @@ static inline void pos_to_gem_image_state(u32 gem_num, gem_config::gem_controlle { const auto& shared_data = g_fxo->get(); - if (x_max <= 0) x_max = shared_data.width; - if (y_max <= 0) y_max = shared_data.height; + if (x_max <= 0) + x_max = shared_data.width; + if (y_max <= 0) + y_max = shared_data.height; // Move the cursor out of the screen if we're at the screen border (Time Crisis 4 needs this) - if (x_pos <= 0) x_pos -= x_max / 10; else if (x_pos >= x_max) x_pos += x_max / 10; - if (y_pos <= 0) y_pos -= y_max / 10; else if (y_pos >= y_max) y_pos += y_max / 10; + if (x_pos <= 0) + x_pos -= x_max / 10; + else if (x_pos >= x_max) + x_pos += x_max / 10; + if (y_pos <= 0) + y_pos -= y_max / 10; + else if (y_pos >= y_max) + y_pos += y_max / 10; const f32 scaling_width = x_max / static_cast(shared_data.width); const f32 scaling_height = y_max / static_cast(shared_data.height); @@ -1661,12 +1684,20 @@ static inline void pos_to_gem_state(u32 gem_num, gem_config::gem_controller& con { const auto& shared_data = g_fxo->get(); - if (x_max <= 0) x_max = shared_data.width; - if (y_max <= 0) y_max = shared_data.height; + if (x_max <= 0) + x_max = shared_data.width; + if (y_max <= 0) + y_max = shared_data.height; // Move the cursor out of the screen if we're at the screen border (Time Crisis 4 needs this) - if (x_pos <= 0) x_pos -= x_max / 10; else if (x_pos >= x_max) x_pos += x_max / 10; - if (y_pos <= 0) y_pos -= y_max / 10; else if (y_pos >= y_max) y_pos += y_max / 10; + if (x_pos <= 0) + x_pos -= x_max / 10; + else if (x_pos >= x_max) + x_pos += x_max / 10; + if (y_pos <= 0) + y_pos -= y_max / 10; + else if (y_pos >= y_max) + y_pos += y_max / 10; const f32 scaling_width = x_max / static_cast(shared_data.width); const f32 scaling_height = y_max / static_cast(shared_data.height); @@ -1713,7 +1744,7 @@ static inline void pos_to_gem_state(u32 gem_num, gem_config::gem_controller& con const f32 max_angle_per_side_h = g_cfg.io.fake_move_rotation_cone_h / 2.0f; const f32 max_angle_per_side_v = g_cfg.io.fake_move_rotation_cone_v / 2.0f; const f32 roll = -PadHandlerBase::degree_to_rad((image_y - half_height) / half_height * max_angle_per_side_v); // This is actually the pitch - const f32 pitch = -PadHandlerBase::degree_to_rad((image_x - half_width) / half_width * max_angle_per_side_h); // This is actually the yaw + const f32 pitch = -PadHandlerBase::degree_to_rad((image_x - half_width) / half_width * max_angle_per_side_h); // This is actually the yaw const f32 yaw = PadHandlerBase::degree_to_rad(0.0f); const f32 cr = std::cos(roll * 0.5f); const f32 sr = std::sin(roll * 0.5f); @@ -1838,17 +1869,17 @@ static inline void ds3_get_stick_values(u32 gem_num, const std::shared_ptr& const auto& cfg = ::at32(g_cfg_gem_fake.players, gem_num); cfg->handle_input(pad, true, [&](gem_btn btn, pad_button /*pad_btn*/, u16 value, bool pressed, bool& /*abort*/) - { - if (!pressed) - return; - - switch (btn) { - case gem_btn::x_axis: x_pos = value; break; - case gem_btn::y_axis: y_pos = value; break; - default: break; - } - }); + if (!pressed) + return; + + switch (btn) + { + case gem_btn::x_axis: x_pos = value; break; + case gem_btn::y_axis: y_pos = value; break; + default: break; + } + }); } template @@ -2035,88 +2066,88 @@ static bool mouse_input_to_pad(u32 mouse_no, be_t& digital_buttons, be_t combos; static const std::unordered_map btn_map = - { - { gem_btn::start, CELL_GEM_CTRL_START }, - { gem_btn::select, CELL_GEM_CTRL_SELECT }, - { gem_btn::triangle, CELL_GEM_CTRL_TRIANGLE }, - { gem_btn::circle, CELL_GEM_CTRL_CIRCLE }, - { gem_btn::cross, CELL_GEM_CTRL_CROSS }, - { gem_btn::square, CELL_GEM_CTRL_SQUARE }, - { gem_btn::move, CELL_GEM_CTRL_MOVE }, - { gem_btn::t, CELL_GEM_CTRL_T }, - { gem_btn::combo_start, CELL_GEM_CTRL_START }, - { gem_btn::combo_select, CELL_GEM_CTRL_SELECT }, - { gem_btn::combo_triangle, CELL_GEM_CTRL_TRIANGLE }, - { gem_btn::combo_circle, CELL_GEM_CTRL_CIRCLE }, - { gem_btn::combo_cross, CELL_GEM_CTRL_CROSS }, - { gem_btn::combo_square, CELL_GEM_CTRL_SQUARE }, - { gem_btn::combo_move, CELL_GEM_CTRL_MOVE }, - { gem_btn::combo_t, CELL_GEM_CTRL_T }, - }; + { + {gem_btn::start, CELL_GEM_CTRL_START}, + {gem_btn::select, CELL_GEM_CTRL_SELECT}, + {gem_btn::triangle, CELL_GEM_CTRL_TRIANGLE}, + {gem_btn::circle, CELL_GEM_CTRL_CIRCLE}, + {gem_btn::cross, CELL_GEM_CTRL_CROSS}, + {gem_btn::square, CELL_GEM_CTRL_SQUARE}, + {gem_btn::move, CELL_GEM_CTRL_MOVE}, + {gem_btn::t, CELL_GEM_CTRL_T}, + {gem_btn::combo_start, CELL_GEM_CTRL_START}, + {gem_btn::combo_select, CELL_GEM_CTRL_SELECT}, + {gem_btn::combo_triangle, CELL_GEM_CTRL_TRIANGLE}, + {gem_btn::combo_circle, CELL_GEM_CTRL_CIRCLE}, + {gem_btn::combo_cross, CELL_GEM_CTRL_CROSS}, + {gem_btn::combo_square, CELL_GEM_CTRL_SQUARE}, + {gem_btn::combo_move, CELL_GEM_CTRL_MOVE}, + {gem_btn::combo_t, CELL_GEM_CTRL_T}, + }; // Check combo button first cfg->handle_input(mouse_data, [&combo_active](gem_btn btn, pad_button /*pad_btn*/, u16 /*value*/, bool pressed, bool& abort) - { - if (pressed && btn == gem_btn::combo) { - combo_active = true; - abort = true; - } - }); + if (pressed && btn == gem_btn::combo) + { + combo_active = true; + abort = true; + } + }); // Check combos if (combo_active) { cfg->handle_input(mouse_data, [&digital_buttons, &combos](gem_btn btn, pad_button pad_btn, u16 /*value*/, bool pressed, bool& /*abort*/) + { + if (!pressed) + return; + + switch (btn) + { + case gem_btn::combo_start: + case gem_btn::combo_select: + case gem_btn::combo_triangle: + case gem_btn::combo_circle: + case gem_btn::combo_cross: + case gem_btn::combo_square: + case gem_btn::combo_move: + case gem_btn::combo_t: + digital_buttons |= ::at32(btn_map, btn); + combos.insert(pad_btn); + break; + default: + break; + } + }); + } + + // Check normal buttons + cfg->handle_input(mouse_data, [&digital_buttons, &combos](gem_btn btn, pad_button pad_btn, u16 /*value*/, bool pressed, bool& /*abort*/) { if (!pressed) return; switch (btn) { - case gem_btn::combo_start: - case gem_btn::combo_select: - case gem_btn::combo_triangle: - case gem_btn::combo_circle: - case gem_btn::combo_cross: - case gem_btn::combo_square: - case gem_btn::combo_move: - case gem_btn::combo_t: - digital_buttons |= ::at32(btn_map, btn); - combos.insert(pad_btn); + case gem_btn::start: + case gem_btn::select: + case gem_btn::square: + case gem_btn::cross: + case gem_btn::circle: + case gem_btn::triangle: + case gem_btn::move: + case gem_btn::t: + // Ignore this gem_btn if the same pad_button was already used in a combo + if (!combos.contains(pad_btn)) + { + digital_buttons |= ::at32(btn_map, btn); + } break; default: break; } }); - } - - // Check normal buttons - cfg->handle_input(mouse_data, [&digital_buttons, &combos](gem_btn btn, pad_button pad_btn, u16 /*value*/, bool pressed, bool& /*abort*/) - { - if (!pressed) - return; - - switch (btn) - { - case gem_btn::start: - case gem_btn::select: - case gem_btn::square: - case gem_btn::cross: - case gem_btn::circle: - case gem_btn::triangle: - case gem_btn::move: - case gem_btn::t: - // Ignore this gem_btn if the same pad_button was already used in a combo - if (!combos.contains(pad_btn)) - { - digital_buttons |= ::at32(btn_map, btn); - } - break; - default: - break; - } - }); analog_t = (digital_buttons & CELL_GEM_CTRL_T) ? 255 : 0; @@ -2386,7 +2417,7 @@ error_code cellGemEnableMagnetometer(u32 gem_num, u32 enable) auto& controller = gem.controllers[gem_num]; // NOTE: RE doesn't show this check but it is mentioned in the docs, so I'll leave it here for now. - //if (!controller.calibrated_magnetometer) + // if (!controller.calibrated_magnetometer) //{ // return CELL_GEM_NOT_CALIBRATED; //} @@ -2530,7 +2561,7 @@ error_code cellGemForceRGB(u32 gem_num, f32 r, f32 g, f32 b) } // TODO: Adjust brightness - //if (const f32 sum = r + g + b; sum > 2.f) + // if (const f32 sum = r + g + b; sum > 2.f) //{ // color = color * (2.f / sum) //} @@ -2641,7 +2672,7 @@ error_code cellGemGetEnvironmentLightingColor(vm::ptr r, vm::ptr g, vm *b = 128; // NOTE: RE doesn't show this check but it is mentioned in the docs, so I'll leave it here for now. - //if (!gem.controllers[gem_num].calibrated_magnetometer) + // if (!gem.controllers[gem_num].calibrated_magnetometer) //{ // return CELL_GEM_ERROR_LIGHTING_NOT_CALIBRATED; // This error doesn't really seem to be a real thing. //} @@ -2929,15 +2960,15 @@ error_code cellGemGetState(u32 gem_num, u32 flag, u64 time_parameter, vm::ptr hue) if (!controller.enabled_tracking || controller.hue > 359) { - return { CELL_GEM_ERROR_NOT_A_HUE, controller.hue }; + return {CELL_GEM_ERROR_NOT_A_HUE, controller.hue}; } *hue = controller.hue; @@ -3285,7 +3316,7 @@ error_code cellGemPrepareCamera(s32 max_exposure, f32 image_quality) // Set new values for others cellCameraSetAttribute(0, CELL_CAMERA_GREENGAIN, 96, 0); cellCameraSetAttribute(0, CELL_CAMERA_REDBLUEGAIN, 64, 96); - cellCameraSetAttribute(0, CELL_CAMERA_GAIN, 0, 0); // TODO + cellCameraSetAttribute(0, CELL_CAMERA_GAIN, 0, 0); // TODO cellCameraSetAttribute(0, CELL_CAMERA_EXPOSURE, 0, 0); // TODO } @@ -3480,7 +3511,8 @@ error_code cellGemSetRumble(u32 gem_num, u8 rumble) const u32 pad_index = pad_num(gem_num); for (const auto& binding : it->second->bindings()) { - if (!binding.device || binding.device->player_id != pad_index) continue; + if (!binding.device || binding.device->player_id != pad_index) + continue; handler->SetRumble(pad_index, rumble, rumble > 0); break; @@ -3547,7 +3579,7 @@ error_code cellGemTrackHues(vm::cptr req_hues, vm::ptr res_hues) gem.controllers[i].hue = 240; // blue break; case 1: - gem.controllers[i].hue = 0; // red + gem.controllers[i].hue = 0; // red break; case 2: gem.controllers[i].hue = 120; // green @@ -3724,43 +3756,43 @@ error_code cellGemWriteExternalPort(u32 gem_num, vm::ptr r; // size of sphere on screen in pixels be_t projectionx; be_t projectiony; - be_t distance; // Move sphere distance from camera (probably) - u8 visible; // whether the sphere is visible in the current frame - u8 r_valid; // whether `r` contains valid size + be_t distance; // Move sphere distance from camera (probably) + u8 visible; // whether the sphere is visible in the current frame + u8 r_valid; // whether `r` contains valid size }; struct CellGemPadData diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellGifDec.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellGifDec.cpp index 9a49e03ec..f2c397096 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellGifDec.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellGifDec.cpp @@ -20,21 +20,21 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_GIFDEC_ERROR_OPEN_FILE); - STR_CASE(CELL_GIFDEC_ERROR_STREAM_FORMAT); - STR_CASE(CELL_GIFDEC_ERROR_SEQ); - STR_CASE(CELL_GIFDEC_ERROR_ARG); - STR_CASE(CELL_GIFDEC_ERROR_FATAL); - STR_CASE(CELL_GIFDEC_ERROR_SPU_UNSUPPORT); - STR_CASE(CELL_GIFDEC_ERROR_SPU_ERROR); - STR_CASE(CELL_GIFDEC_ERROR_CB_PARAM); - } + switch (error) + { + STR_CASE(CELL_GIFDEC_ERROR_OPEN_FILE); + STR_CASE(CELL_GIFDEC_ERROR_STREAM_FORMAT); + STR_CASE(CELL_GIFDEC_ERROR_SEQ); + STR_CASE(CELL_GIFDEC_ERROR_ARG); + STR_CASE(CELL_GIFDEC_ERROR_FATAL); + STR_CASE(CELL_GIFDEC_ERROR_SPU_UNSUPPORT); + STR_CASE(CELL_GIFDEC_ERROR_SPU_ERROR); + STR_CASE(CELL_GIFDEC_ERROR_CB_PARAM); + } - return unknown; - }); + return unknown; + }); } error_code cellGifDecCreate(vm::ptr mainHandle, vm::cptr threadInParam, vm::ptr threadOutParam) @@ -301,14 +301,14 @@ error_code cellGifDecReadHeader(vm::ptr mainHandle, vm::ptr> 7; - current_info.SColorResolution = ((packedField >> 4) & 7)+1; - current_info.SSortFlag = (packedField >> 3) & 1; - current_info.SSizeOfGlobalColorTable = (packedField & 7)+1; - current_info.SBackGroundColor = buffer[11]; - current_info.SPixelAspectRatio = buffer[12]; + current_info.SWidth = buffer[6] + buffer[7] * 0x100; + current_info.SHeight = buffer[8] + buffer[9] * 0x100; + current_info.SGlobalColorTableFlag = packedField >> 7; + current_info.SColorResolution = ((packedField >> 4) & 7) + 1; + current_info.SSortFlag = (packedField >> 3) & 1; + current_info.SSizeOfGlobalColorTable = (packedField & 7) + 1; + current_info.SBackGroundColor = buffer[11]; + current_info.SPixelAspectRatio = buffer[12]; *info = current_info; @@ -379,9 +379,9 @@ error_code cellGifDecSetParameter(vm::ptr mainHandle, vm::ptrinfo; CellGifDecOutParam& current_outParam = subHandle->outParam; - current_outParam.outputWidthByte = (current_info.SWidth * current_info.SColorResolution * 3) / 8; - current_outParam.outputWidth = current_info.SWidth; - current_outParam.outputHeight = current_info.SHeight; + current_outParam.outputWidthByte = (current_info.SWidth * current_info.SColorResolution * 3) / 8; + current_outParam.outputWidth = current_info.SWidth; + current_outParam.outputHeight = current_info.SHeight; current_outParam.outputColorSpace = inParam->colorSpace; switch (current_outParam.outputColorSpace) { @@ -389,8 +389,8 @@ error_code cellGifDecSetParameter(vm::ptr mainHandle, vm::ptr mainHandle, vm::ptrinfo; CellGifDecOutParam& current_outParam = subHandle->outParam; - current_outParam.outputWidthByte = (current_info.SWidth * current_info.SColorResolution * 3) / 8; - current_outParam.outputWidth = current_info.SWidth; - current_outParam.outputHeight = current_info.SHeight; + current_outParam.outputWidthByte = (current_info.SWidth * current_info.SColorResolution * 3) / 8; + current_outParam.outputWidth = current_info.SWidth; + current_outParam.outputHeight = current_info.SHeight; current_outParam.outputColorSpace = inParam->colorSpace; switch (current_outParam.outputColorSpace) { @@ -439,8 +439,8 @@ error_code cellGifDecExtSetParameter(vm::ptr mainHandle, vm::ptr mainHandle, vm::cptrfileSize; const CellGifDecOutParam& current_outParam = subHandle->outParam; - //Copy the GIF file to a buffer + // Copy the GIF file to a buffer std::unique_ptr gif(new u8[fileSize]); switch (subHandle->src.srcSelect) @@ -506,13 +506,11 @@ error_code cellGifDecDecodeData(vm::ptr mainHandle, vm::cptr - ( - stbi_load_from_memory(gif.get(), ::narrow(fileSize), &width, &height, &actual_components, 4), - &::free - ); + auto image = std::unique_ptr( + stbi_load_from_memory(gif.get(), ::narrow(fileSize), &width, &height, &actual_components, 4), + &::free); if (!image) return CELL_GIFDEC_ERROR_STREAM_FORMAT; @@ -521,7 +519,7 @@ error_code cellGifDecDecodeData(vm::ptr mainHandle, vm::cptr mainHandle, vm::cptr width * nComponents) // Check if we need padding { - //TODO: find out if we can't do padding without an extra copy + // TODO: find out if we can't do padding without an extra copy const int linesize = std::min(bytesPerLine, width * nComponents); const auto output = std::make_unique(linesize); for (int i = 0; i < height; i++) @@ -664,18 +662,18 @@ error_code cellGifDecDestroy(vm::ptr mainHandle) } DECLARE(ppu_module_manager::cellGifDec)("cellGifDec", []() -{ - REG_FUNC(cellGifDec, cellGifDecCreate); - REG_FUNC(cellGifDec, cellGifDecExtCreate); - REG_FUNC(cellGifDec, cellGifDecOpen); - REG_FUNC(cellGifDec, cellGifDecReadHeader); - REG_FUNC(cellGifDec, cellGifDecSetParameter); - REG_FUNC(cellGifDec, cellGifDecDecodeData); - REG_FUNC(cellGifDec, cellGifDecClose); - REG_FUNC(cellGifDec, cellGifDecDestroy); + { + REG_FUNC(cellGifDec, cellGifDecCreate); + REG_FUNC(cellGifDec, cellGifDecExtCreate); + REG_FUNC(cellGifDec, cellGifDecOpen); + REG_FUNC(cellGifDec, cellGifDecReadHeader); + REG_FUNC(cellGifDec, cellGifDecSetParameter); + REG_FUNC(cellGifDec, cellGifDecDecodeData); + REG_FUNC(cellGifDec, cellGifDecClose); + REG_FUNC(cellGifDec, cellGifDecDestroy); - REG_FUNC(cellGifDec, cellGifDecExtOpen); - REG_FUNC(cellGifDec, cellGifDecExtReadHeader); - REG_FUNC(cellGifDec, cellGifDecExtSetParameter); - REG_FUNC(cellGifDec, cellGifDecExtDecodeData); -}); + REG_FUNC(cellGifDec, cellGifDecExtOpen); + REG_FUNC(cellGifDec, cellGifDecExtReadHeader); + REG_FUNC(cellGifDec, cellGifDecExtSetParameter); + REG_FUNC(cellGifDec, cellGifDecExtDecodeData); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellGifDec.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellGifDec.h index 113ebcee9..1bba3adab 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellGifDec.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellGifDec.h @@ -5,33 +5,33 @@ // Return Codes enum CellGifDecError : u32 { - CELL_GIFDEC_ERROR_OPEN_FILE = 0x80611300, + CELL_GIFDEC_ERROR_OPEN_FILE = 0x80611300, CELL_GIFDEC_ERROR_STREAM_FORMAT = 0x80611301, - CELL_GIFDEC_ERROR_SEQ = 0x80611302, - CELL_GIFDEC_ERROR_ARG = 0x80611303, - CELL_GIFDEC_ERROR_FATAL = 0x80611304, + CELL_GIFDEC_ERROR_SEQ = 0x80611302, + CELL_GIFDEC_ERROR_ARG = 0x80611303, + CELL_GIFDEC_ERROR_FATAL = 0x80611304, CELL_GIFDEC_ERROR_SPU_UNSUPPORT = 0x80611305, - CELL_GIFDEC_ERROR_SPU_ERROR = 0x80611306, - CELL_GIFDEC_ERROR_CB_PARAM = 0x80611307, + CELL_GIFDEC_ERROR_SPU_ERROR = 0x80611306, + CELL_GIFDEC_ERROR_CB_PARAM = 0x80611307, }; enum CellGifDecStreamSrcSel : s32 { - CELL_GIFDEC_FILE = 0, // Input from a file + CELL_GIFDEC_FILE = 0, // Input from a file CELL_GIFDEC_BUFFER = 1, // Input from a buffer }; enum CellGifDecSpuThreadEna : s32 { CELL_GIFDEC_SPU_THREAD_DISABLE = 0, // Do not use SPU threads - CELL_GIFDEC_SPU_THREAD_ENABLE = 1, // Use SPU threads + CELL_GIFDEC_SPU_THREAD_ENABLE = 1, // Use SPU threads }; enum CellGifDecRecordType : s32 { CELL_GIFDEC_RECORD_TYPE_IMAGE_DESC = 1, // Image data block - CELL_GIFDEC_RECORD_TYPE_EXTENSION = 2, // Extension block - CELL_GIFDEC_RECORD_TYPE_TERMINATE = 3, // Trailer block + CELL_GIFDEC_RECORD_TYPE_EXTENSION = 2, // Extension block + CELL_GIFDEC_RECORD_TYPE_TERMINATE = 3, // Trailer block }; enum CellGifDecColorSpace : s32 @@ -43,13 +43,13 @@ enum CellGifDecColorSpace : s32 enum CellGifDecCommand : s32 { CELL_GIFDEC_CONTINUE = 0, // Continue decoding - CELL_GIFDEC_STOP = 1, // Force decoding to stop + CELL_GIFDEC_STOP = 1, // Force decoding to stop }; enum CellGifDecDecodeStatus : s32 { CELL_GIFDEC_DEC_STATUS_FINISH = 0, // Decoding finished - CELL_GIFDEC_DEC_STATUS_STOP = 1, // Decoding was stopped + CELL_GIFDEC_DEC_STATUS_STOP = 1, // Decoding was stopped }; enum CellGifDecBufferMode : s32 @@ -59,14 +59,14 @@ enum CellGifDecBufferMode : s32 enum CellGifDecSpuMode : s32 { - CELL_GIFDEC_RECEIVE_EVENT = 0, - CELL_GIFDEC_TRYRECEIVE_EVENT = 1 + CELL_GIFDEC_RECEIVE_EVENT = 0, + CELL_GIFDEC_TRYRECEIVE_EVENT = 1 }; enum CellGifDecInterlaceMode : s32 { - CELL_GIFDEC_NO_INTERLACE = 0, - CELL_GIFDEC_INTERLACE = 1 + CELL_GIFDEC_NO_INTERLACE = 0, + CELL_GIFDEC_INTERLACE = 1 }; // Callbacks for memory management @@ -133,7 +133,7 @@ struct CellGifDecInfo struct CellGifDecInParam { vm::bptr commandPtr; // CellGifDecCommand - be_t colorSpace; // CellGifDecColorSpace + be_t colorSpace; // CellGifDecColorSpace u8 outputColorAlpha1; u8 outputColorAlpha2; u8 reserved[2]; @@ -212,17 +212,17 @@ struct CellGifDecDispParam struct CellGifDecDispInfo { - be_t outputFrameWidthByte; - be_t outputFrameHeight; - be_t outputStartXByte; - be_t outputStartY; - be_t outputWidthByte; - be_t outputHeight; - be_t outputBitDepth; - be_t outputComponents; - be_t scanPassCount; - vm::bptr outputImage; - be_t interlaceFlag; // CellGifDecInterlaceMode + be_t outputFrameWidthByte; + be_t outputFrameHeight; + be_t outputStartXByte; + be_t outputStartY; + be_t outputWidthByte; + be_t outputHeight; + be_t outputBitDepth; + be_t outputComponents; + be_t scanPassCount; + vm::bptr outputImage; + be_t interlaceFlag; // CellGifDecInterlaceMode }; using CellGifDecCbControlDisp = s32(vm::ptr dispInfo, vm::ptr dispParam, vm::ptr cbCtrlDispArg); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellHttp.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellHttp.cpp index 6254315ec..3ad08f4a8 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellHttp.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellHttp.cpp @@ -8,1087 +8,1087 @@ LOG_CHANNEL(cellHttp); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_HTTP_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_HTTP_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_HTTP_ERROR_NO_MEMORY); - STR_CASE(CELL_HTTP_ERROR_NO_BUFFER); - STR_CASE(CELL_HTTP_ERROR_NO_STRING); - STR_CASE(CELL_HTTP_ERROR_INSUFFICIENT); - STR_CASE(CELL_HTTP_ERROR_INVALID_URI); - STR_CASE(CELL_HTTP_ERROR_INVALID_HEADER); - STR_CASE(CELL_HTTP_ERROR_BAD_METHOD); - STR_CASE(CELL_HTTP_ERROR_BAD_CLIENT); - STR_CASE(CELL_HTTP_ERROR_BAD_TRANS); - STR_CASE(CELL_HTTP_ERROR_NO_CONNECTION); - STR_CASE(CELL_HTTP_ERROR_NO_REQUEST_SENT); - STR_CASE(CELL_HTTP_ERROR_ALREADY_BUILT); - STR_CASE(CELL_HTTP_ERROR_ALREADY_SENT); - STR_CASE(CELL_HTTP_ERROR_NO_HEADER); - STR_CASE(CELL_HTTP_ERROR_NO_CONTENT_LENGTH); - STR_CASE(CELL_HTTP_ERROR_TOO_MANY_REDIRECTS); - STR_CASE(CELL_HTTP_ERROR_TOO_MANY_AUTHS); - STR_CASE(CELL_HTTP_ERROR_TRANS_NO_CONNECTION); - STR_CASE(CELL_HTTP_ERROR_CB_FAILED); - STR_CASE(CELL_HTTP_ERROR_NOT_PIPED); - STR_CASE(CELL_HTTP_ERROR_OUT_OF_ORDER_PIPE); - STR_CASE(CELL_HTTP_ERROR_TRANS_ABORTED); - STR_CASE(CELL_HTTP_ERROR_BROKEN_PIPELINE); - STR_CASE(CELL_HTTP_ERROR_UNAVAILABLE); - STR_CASE(CELL_HTTP_ERROR_INVALID_VALUE); - STR_CASE(CELL_HTTP_ERROR_CANNOT_AUTHENTICATE); - STR_CASE(CELL_HTTP_ERROR_COOKIE_NOT_FOUND); - STR_CASE(CELL_HTTP_ERROR_COOKIE_INVALID_DOMAIN); - STR_CASE(CELL_HTTP_ERROR_CACHE_ALREADY_INITIALIZED); - STR_CASE(CELL_HTTP_ERROR_CACHE_NOT_INITIALIZED); - STR_CASE(CELL_HTTP_ERROR_LINE_EXCEEDS_MAX); - STR_CASE(CELL_HTTP_ERROR_REQUIRES_BASIC_AUTH); - STR_CASE(CELL_HTTP_ERROR_UNKNOWN); - STR_CASE(CELL_HTTP_ERROR_INTERNAL); - STR_CASE(CELL_HTTP_ERROR_NONREMOVABLE); - STR_CASE(CELL_HTTP_ERROR_BAD_CONN); - STR_CASE(CELL_HTTP_ERROR_BAD_MAN); - STR_CASE(CELL_HTTP_ERROR_NO_POOL); - STR_CASE(CELL_HTTP_ERROR_NO_REQUEST); - STR_CASE(CELL_HTTP_ERROR_LOCK_FAILED); - STR_CASE(CELL_HTTP_ERROR_INVALID_DATA); - STR_CASE(CELL_HTTP_ERROR_BROKEN_CHUNK); - STR_CASE(CELL_HTTP_ERROR_DECODE_SETUP); - STR_CASE(CELL_HTTP_ERROR_DECODE_STREAM); - STR_CASE(CELL_HTTP_ERROR_BROKEN_DECODE_STREAM); - STR_CASE(CELL_HTTP_ERROR_INVALID_DCACHE_PATH); - STR_CASE(CELL_HTTP_ERROR_DCACHE_ALREADY_INITIALIZED); - STR_CASE(CELL_HTTP_ERROR_DCACHE_NOT_INITIALIZED); - STR_CASE(CELL_HTTP_ERROR_TOO_MANY_DCACHE_ENTRY); - STR_CASE(CELL_HTTP_ERROR_DUP_DCACHE_ENTRY); - STR_CASE(CELL_HTTP_ERROR_WRITE_DCACHE); - STR_CASE(CELL_HTTP_ERROR_READ_DCACHE); - STR_CASE(CELL_HTTP_ERROR_CACHE_TOO_LARGE); - STR_CASE(CELL_HTTP_ERROR_INVALID_DCACHE_VERSION); - STR_CASE(CELL_HTTP_ERROR_DCACHE_FILE_BROKEN); - STR_CASE(CELL_HTTP_ERROR_DCACHE_EXCEEDS_MAX); - STR_CASE(CELL_HTTP_ERROR_DCACHE_BUSY); - STR_CASE(CELL_HTTP_ERROR_DCACHE_INDEX_BROKEN); - STR_CASE(CELL_HTTP_ERROR_INVALID_DCACHE_INDEX_NODE); - STR_CASE(CELL_HTTP_ERROR_DCACHE_FILE_INCONSISTENCY); - STR_CASE(CELL_HTTP_ERROR_DCACHE_URI_TOO_LONG); - STR_CASE(CELL_HTTP_ERROR_READ_DCACHE_EOF); - STR_CASE(CELL_HTTP_ERROR_END_OF_DCACHE_INDEX_NODE); - STR_CASE(CELL_HTTP_ERROR_NO_CACHE_MEMORY); - STR_CASE(CELL_HTTP_ERROR_DCACHE_BROKEN); - STR_CASE(CELL_HTTP_ERROR_DCACHE_TOO_MANY_WRITE); - STR_CASE(CELL_HTTP_ERROR_DCACHE_TOO_MANY_READ); - STR_CASE(CELL_HTTP_ERROR_DCACHE_FATAL); - STR_CASE(CELL_HTTP_ERROR_DCACHE_UNSUPPORTED_FEATURE); - STR_CASE(CELL_HTTP_ERROR_DCACHE_INDEX_IS_ALREADY_OPEN); - STR_CASE(CELL_HTTP_ERROR_DCACHE_INDEX_IS_OPENING); - STR_CASE(CELL_HTTP_ERROR_DCACHE_UNKNOWN); - STR_CASE(CELL_HTTP_ERROR_DCACHE_INDEX_IS_CLOSED); - STR_CASE(CELL_HTTP_ERROR_DCACHE_ABORTED); - STR_CASE(CELL_HTTP_ERROR_DCACHE_INDEX_IS_CLOSING); - STR_CASE(CELL_HTTP_ERROR_DCACHE_UNKNOWN_INDEX_STATE); - STR_CASE(CELL_HTTP_ERROR_NET_FIN); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_TIMEOUT); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_TIMEOUT); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_TIMEOUT); - } + switch (error) + { + STR_CASE(CELL_HTTP_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_HTTP_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_HTTP_ERROR_NO_MEMORY); + STR_CASE(CELL_HTTP_ERROR_NO_BUFFER); + STR_CASE(CELL_HTTP_ERROR_NO_STRING); + STR_CASE(CELL_HTTP_ERROR_INSUFFICIENT); + STR_CASE(CELL_HTTP_ERROR_INVALID_URI); + STR_CASE(CELL_HTTP_ERROR_INVALID_HEADER); + STR_CASE(CELL_HTTP_ERROR_BAD_METHOD); + STR_CASE(CELL_HTTP_ERROR_BAD_CLIENT); + STR_CASE(CELL_HTTP_ERROR_BAD_TRANS); + STR_CASE(CELL_HTTP_ERROR_NO_CONNECTION); + STR_CASE(CELL_HTTP_ERROR_NO_REQUEST_SENT); + STR_CASE(CELL_HTTP_ERROR_ALREADY_BUILT); + STR_CASE(CELL_HTTP_ERROR_ALREADY_SENT); + STR_CASE(CELL_HTTP_ERROR_NO_HEADER); + STR_CASE(CELL_HTTP_ERROR_NO_CONTENT_LENGTH); + STR_CASE(CELL_HTTP_ERROR_TOO_MANY_REDIRECTS); + STR_CASE(CELL_HTTP_ERROR_TOO_MANY_AUTHS); + STR_CASE(CELL_HTTP_ERROR_TRANS_NO_CONNECTION); + STR_CASE(CELL_HTTP_ERROR_CB_FAILED); + STR_CASE(CELL_HTTP_ERROR_NOT_PIPED); + STR_CASE(CELL_HTTP_ERROR_OUT_OF_ORDER_PIPE); + STR_CASE(CELL_HTTP_ERROR_TRANS_ABORTED); + STR_CASE(CELL_HTTP_ERROR_BROKEN_PIPELINE); + STR_CASE(CELL_HTTP_ERROR_UNAVAILABLE); + STR_CASE(CELL_HTTP_ERROR_INVALID_VALUE); + STR_CASE(CELL_HTTP_ERROR_CANNOT_AUTHENTICATE); + STR_CASE(CELL_HTTP_ERROR_COOKIE_NOT_FOUND); + STR_CASE(CELL_HTTP_ERROR_COOKIE_INVALID_DOMAIN); + STR_CASE(CELL_HTTP_ERROR_CACHE_ALREADY_INITIALIZED); + STR_CASE(CELL_HTTP_ERROR_CACHE_NOT_INITIALIZED); + STR_CASE(CELL_HTTP_ERROR_LINE_EXCEEDS_MAX); + STR_CASE(CELL_HTTP_ERROR_REQUIRES_BASIC_AUTH); + STR_CASE(CELL_HTTP_ERROR_UNKNOWN); + STR_CASE(CELL_HTTP_ERROR_INTERNAL); + STR_CASE(CELL_HTTP_ERROR_NONREMOVABLE); + STR_CASE(CELL_HTTP_ERROR_BAD_CONN); + STR_CASE(CELL_HTTP_ERROR_BAD_MAN); + STR_CASE(CELL_HTTP_ERROR_NO_POOL); + STR_CASE(CELL_HTTP_ERROR_NO_REQUEST); + STR_CASE(CELL_HTTP_ERROR_LOCK_FAILED); + STR_CASE(CELL_HTTP_ERROR_INVALID_DATA); + STR_CASE(CELL_HTTP_ERROR_BROKEN_CHUNK); + STR_CASE(CELL_HTTP_ERROR_DECODE_SETUP); + STR_CASE(CELL_HTTP_ERROR_DECODE_STREAM); + STR_CASE(CELL_HTTP_ERROR_BROKEN_DECODE_STREAM); + STR_CASE(CELL_HTTP_ERROR_INVALID_DCACHE_PATH); + STR_CASE(CELL_HTTP_ERROR_DCACHE_ALREADY_INITIALIZED); + STR_CASE(CELL_HTTP_ERROR_DCACHE_NOT_INITIALIZED); + STR_CASE(CELL_HTTP_ERROR_TOO_MANY_DCACHE_ENTRY); + STR_CASE(CELL_HTTP_ERROR_DUP_DCACHE_ENTRY); + STR_CASE(CELL_HTTP_ERROR_WRITE_DCACHE); + STR_CASE(CELL_HTTP_ERROR_READ_DCACHE); + STR_CASE(CELL_HTTP_ERROR_CACHE_TOO_LARGE); + STR_CASE(CELL_HTTP_ERROR_INVALID_DCACHE_VERSION); + STR_CASE(CELL_HTTP_ERROR_DCACHE_FILE_BROKEN); + STR_CASE(CELL_HTTP_ERROR_DCACHE_EXCEEDS_MAX); + STR_CASE(CELL_HTTP_ERROR_DCACHE_BUSY); + STR_CASE(CELL_HTTP_ERROR_DCACHE_INDEX_BROKEN); + STR_CASE(CELL_HTTP_ERROR_INVALID_DCACHE_INDEX_NODE); + STR_CASE(CELL_HTTP_ERROR_DCACHE_FILE_INCONSISTENCY); + STR_CASE(CELL_HTTP_ERROR_DCACHE_URI_TOO_LONG); + STR_CASE(CELL_HTTP_ERROR_READ_DCACHE_EOF); + STR_CASE(CELL_HTTP_ERROR_END_OF_DCACHE_INDEX_NODE); + STR_CASE(CELL_HTTP_ERROR_NO_CACHE_MEMORY); + STR_CASE(CELL_HTTP_ERROR_DCACHE_BROKEN); + STR_CASE(CELL_HTTP_ERROR_DCACHE_TOO_MANY_WRITE); + STR_CASE(CELL_HTTP_ERROR_DCACHE_TOO_MANY_READ); + STR_CASE(CELL_HTTP_ERROR_DCACHE_FATAL); + STR_CASE(CELL_HTTP_ERROR_DCACHE_UNSUPPORTED_FEATURE); + STR_CASE(CELL_HTTP_ERROR_DCACHE_INDEX_IS_ALREADY_OPEN); + STR_CASE(CELL_HTTP_ERROR_DCACHE_INDEX_IS_OPENING); + STR_CASE(CELL_HTTP_ERROR_DCACHE_UNKNOWN); + STR_CASE(CELL_HTTP_ERROR_DCACHE_INDEX_IS_CLOSED); + STR_CASE(CELL_HTTP_ERROR_DCACHE_ABORTED); + STR_CASE(CELL_HTTP_ERROR_DCACHE_INDEX_IS_CLOSING); + STR_CASE(CELL_HTTP_ERROR_DCACHE_UNKNOWN_INDEX_STATE); + STR_CASE(CELL_HTTP_ERROR_NET_FIN); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_TIMEOUT); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_TIMEOUT); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_TIMEOUT); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_HTTPS_ERROR_CERTIFICATE_LOAD); - STR_CASE(CELL_HTTPS_ERROR_BAD_MEMORY); - STR_CASE(CELL_HTTPS_ERROR_CONTEXT_CREATION); - STR_CASE(CELL_HTTPS_ERROR_CONNECTION_CREATION); - STR_CASE(CELL_HTTPS_ERROR_SOCKET_ASSOCIATION); - STR_CASE(CELL_HTTPS_ERROR_HANDSHAKE); - STR_CASE(CELL_HTTPS_ERROR_LOOKUP_CERTIFICATE); - STR_CASE(CELL_HTTPS_ERROR_NO_SSL); - STR_CASE(CELL_HTTPS_ERROR_KEY_LOAD); - STR_CASE(CELL_HTTPS_ERROR_CERT_KEY_MISMATCH); - STR_CASE(CELL_HTTPS_ERROR_KEY_NEEDS_CERT); - STR_CASE(CELL_HTTPS_ERROR_CERT_NEEDS_KEY); - STR_CASE(CELL_HTTPS_ERROR_RETRY_CONNECTION); - STR_CASE(CELL_HTTPS_ERROR_NET_SSL_CONNECT); - STR_CASE(CELL_HTTPS_ERROR_NET_SSL_SEND); - STR_CASE(CELL_HTTPS_ERROR_NET_SSL_RECV); - } + switch (error) + { + STR_CASE(CELL_HTTPS_ERROR_CERTIFICATE_LOAD); + STR_CASE(CELL_HTTPS_ERROR_BAD_MEMORY); + STR_CASE(CELL_HTTPS_ERROR_CONTEXT_CREATION); + STR_CASE(CELL_HTTPS_ERROR_CONNECTION_CREATION); + STR_CASE(CELL_HTTPS_ERROR_SOCKET_ASSOCIATION); + STR_CASE(CELL_HTTPS_ERROR_HANDSHAKE); + STR_CASE(CELL_HTTPS_ERROR_LOOKUP_CERTIFICATE); + STR_CASE(CELL_HTTPS_ERROR_NO_SSL); + STR_CASE(CELL_HTTPS_ERROR_KEY_LOAD); + STR_CASE(CELL_HTTPS_ERROR_CERT_KEY_MISMATCH); + STR_CASE(CELL_HTTPS_ERROR_KEY_NEEDS_CERT); + STR_CASE(CELL_HTTPS_ERROR_CERT_NEEDS_KEY); + STR_CASE(CELL_HTTPS_ERROR_RETRY_CONNECTION); + STR_CASE(CELL_HTTPS_ERROR_NET_SSL_CONNECT); + STR_CASE(CELL_HTTPS_ERROR_NET_SSL_SEND); + STR_CASE(CELL_HTTPS_ERROR_NET_SSL_RECV); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_HTTP_ERROR_NET_RESOLVER_NETDB_INTERNAL); - STR_CASE(CELL_HTTP_ERROR_NET_RESOLVER_HOST_NOT_FOUND); - STR_CASE(CELL_HTTP_ERROR_NET_RESOLVER_TRY_AGAIN); - STR_CASE(CELL_HTTP_ERROR_NET_RESOLVER_NO_RECOVERY); - STR_CASE(CELL_HTTP_ERROR_NET_RESOLVER_NO_DATA); - //STR_CASE(CELL_HTTP_ERROR_NET_RESOLVER_NO_ADDRESS); + switch (error) + { + STR_CASE(CELL_HTTP_ERROR_NET_RESOLVER_NETDB_INTERNAL); + STR_CASE(CELL_HTTP_ERROR_NET_RESOLVER_HOST_NOT_FOUND); + STR_CASE(CELL_HTTP_ERROR_NET_RESOLVER_TRY_AGAIN); + STR_CASE(CELL_HTTP_ERROR_NET_RESOLVER_NO_RECOVERY); + STR_CASE(CELL_HTTP_ERROR_NET_RESOLVER_NO_DATA); + // STR_CASE(CELL_HTTP_ERROR_NET_RESOLVER_NO_ADDRESS); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPERM); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOENT); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ESRCH); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EINTR); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EIO); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENXIO); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_E2BIG); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOEXC); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EBADF); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ECHILD); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EDEADLK); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOMEM); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EACCES); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EFAULT); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTBLK); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EBUSY); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EEXIST); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EXDEV); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENODEV); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTDIR); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EISDIR); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EINVAL); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENFILE); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EMFILE); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTTY); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ETXTBSY); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EFBIG); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOSPC); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ESPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EROFS); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EMLINK); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EDOM); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ERANGE); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EAGAIN); - //STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EWOULDBLOCK); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EINPROGRESS); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EALREADY); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTSOCK); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EDESTADDRREQ); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EMSGSIZE); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPROTOTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOPROTOOPT); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPROTONOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ESOCKTNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EOPNOTSUPP); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EAFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EADDRINUSE); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EADDRNOTAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENETDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENETUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENETRESET); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ECONNABORTED); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ECONNRESET); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOBUFS); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EISCONN); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTCONN); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ESHUTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ETOOMANYREFS); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ETIMEDOUT); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ECONNREFUSED); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ELOOP); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENAMETOOLONG); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EHOSTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EHOSTUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTEMPTY); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPROCLIM); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EUSERS); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EDQUOT); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ESTALE); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EREMOTE); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EBADRPC); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ERPCMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPROGUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPROGMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPROCUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOLCK); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOSYS); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EFTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENEEDAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EIDRM); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOMSG); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EOVERFLOW); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EILSEQ); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTSUP); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ECANCELED); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EBADMSG); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENODATA); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOSR); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOSTR); - STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ETIME); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPERM); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOENT); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ESRCH); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EINTR); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EIO); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENXIO); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_E2BIG); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOEXC); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EBADF); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ECHILD); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EDEADLK); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOMEM); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EACCES); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EFAULT); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTBLK); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EBUSY); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EEXIST); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EXDEV); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENODEV); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTDIR); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EISDIR); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EINVAL); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENFILE); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EMFILE); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTTY); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ETXTBSY); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EFBIG); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOSPC); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ESPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EROFS); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EMLINK); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EDOM); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ERANGE); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EAGAIN); + // STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EWOULDBLOCK); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EINPROGRESS); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EALREADY); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTSOCK); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EDESTADDRREQ); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EMSGSIZE); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPROTOTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOPROTOOPT); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPROTONOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ESOCKTNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EOPNOTSUPP); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EAFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EADDRINUSE); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EADDRNOTAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENETDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENETUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENETRESET); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ECONNABORTED); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ECONNRESET); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOBUFS); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EISCONN); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTCONN); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ESHUTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ETOOMANYREFS); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ETIMEDOUT); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ECONNREFUSED); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ELOOP); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENAMETOOLONG); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EHOSTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EHOSTUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTEMPTY); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPROCLIM); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EUSERS); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EDQUOT); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ESTALE); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EREMOTE); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EBADRPC); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ERPCMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPROGUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPROGMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EPROCUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOLCK); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOSYS); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EFTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENEEDAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EIDRM); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOMSG); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EOVERFLOW); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EILSEQ); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOTSUP); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ECANCELED); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_EBADMSG); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENODATA); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOSR); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ENOSTR); + STR_CASE(CELL_HTTP_ERROR_NET_ABORT_ETIME); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPERM); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOENT); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ESRCH); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EINTR); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EIO); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENXIO); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_E2BIG); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOEXC); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EBADF); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ECHILD); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EDEADLK); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOMEM); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EACCES); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EFAULT); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTBLK); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EBUSY); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EEXIST); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EXDEV); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENODEV); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTDIR); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EISDIR); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EINVAL); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENFILE); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EMFILE); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTTY); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ETXTBSY); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EFBIG); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOSPC); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ESPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EROFS); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EMLINK); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EDOM); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ERANGE); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EAGAIN); - //STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EWOULDBLOCK); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EINPROGRESS); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EALREADY); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTSOCK); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EDESTADDRREQ); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EMSGSIZE); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPROTOTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOPROTOOPT); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPROTONOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ESOCKTNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EOPNOTSUPP); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EAFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EADDRINUSE); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EADDRNOTAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENETDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENETUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENETRESET); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ECONNABORTED); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ECONNRESET); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOBUFS); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EISCONN); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTCONN); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ESHUTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ETOOMANYREFS); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ETIMEDOUT); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ECONNREFUSED); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ELOOP); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENAMETOOLONG); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EHOSTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EHOSTUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTEMPTY); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPROCLIM); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EUSERS); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EDQUOT); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ESTALE); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EREMOTE); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EBADRPC); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ERPCMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPROGUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPROGMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPROCUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOLCK); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOSYS); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EFTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENEEDAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EIDRM); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOMSG); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EOVERFLOW); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EILSEQ); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTSUP); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ECANCELED); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EBADMSG); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENODATA); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOSR); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOSTR); - STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ETIME); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPERM); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOENT); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ESRCH); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EINTR); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EIO); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENXIO); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_E2BIG); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOEXC); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EBADF); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ECHILD); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EDEADLK); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOMEM); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EACCES); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EFAULT); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTBLK); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EBUSY); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EEXIST); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EXDEV); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENODEV); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTDIR); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EISDIR); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EINVAL); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENFILE); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EMFILE); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTTY); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ETXTBSY); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EFBIG); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOSPC); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ESPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EROFS); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EMLINK); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EDOM); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ERANGE); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EAGAIN); + // STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EWOULDBLOCK); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EINPROGRESS); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EALREADY); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTSOCK); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EDESTADDRREQ); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EMSGSIZE); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPROTOTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOPROTOOPT); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPROTONOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ESOCKTNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EOPNOTSUPP); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EAFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EADDRINUSE); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EADDRNOTAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENETDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENETUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENETRESET); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ECONNABORTED); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ECONNRESET); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOBUFS); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EISCONN); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTCONN); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ESHUTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ETOOMANYREFS); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ETIMEDOUT); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ECONNREFUSED); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ELOOP); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENAMETOOLONG); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EHOSTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EHOSTUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTEMPTY); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPROCLIM); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EUSERS); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EDQUOT); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ESTALE); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EREMOTE); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EBADRPC); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ERPCMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPROGUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPROGMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EPROCUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOLCK); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOSYS); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EFTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENEEDAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EIDRM); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOMSG); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EOVERFLOW); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EILSEQ); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOTSUP); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ECANCELED); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_EBADMSG); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENODATA); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOSR); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ENOSTR); + STR_CASE(CELL_HTTP_ERROR_NET_OPTION_ETIME); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPERM); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOENT); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ESRCH); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EINTR); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EIO); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENXIO); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_E2BIG); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOEXC); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EBADF); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ECHILD); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EDEADLK); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOMEM); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EACCES); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EFAULT); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTBLK); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EBUSY); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EEXIST); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EXDEV); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENODEV); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTDIR); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EISDIR); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EINVAL); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENFILE); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EMFILE); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTTY); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ETXTBSY); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EFBIG); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOSPC); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ESPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EROFS); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EMLINK); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EDOM); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ERANGE); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EAGAIN); - //STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EWOULDBLOCK); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EINPROGRESS); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EALREADY); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTSOCK); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EDESTADDRREQ); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EMSGSIZE); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPROTOTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOPROTOOPT); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPROTONOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ESOCKTNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EOPNOTSUPP); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EAFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EADDRINUSE); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EADDRNOTAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENETDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENETUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENETRESET); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ECONNABORTED); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ECONNRESET); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOBUFS); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EISCONN); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTCONN); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ESHUTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ETOOMANYREFS); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ETIMEDOUT); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ECONNREFUSED); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ELOOP); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENAMETOOLONG); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EHOSTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EHOSTUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTEMPTY); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPROCLIM); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EUSERS); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EDQUOT); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ESTALE); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EREMOTE); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EBADRPC); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ERPCMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPROGUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPROGMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPROCUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOLCK); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOSYS); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EFTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENEEDAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EIDRM); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOMSG); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EOVERFLOW); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EILSEQ); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTSUP); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ECANCELED); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EBADMSG); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENODATA); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOSR); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOSTR); - STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ETIME); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPERM); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOENT); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ESRCH); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EINTR); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EIO); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENXIO); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_E2BIG); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOEXC); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EBADF); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ECHILD); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EDEADLK); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOMEM); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EACCES); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EFAULT); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTBLK); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EBUSY); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EEXIST); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EXDEV); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENODEV); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTDIR); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EISDIR); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EINVAL); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENFILE); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EMFILE); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTTY); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ETXTBSY); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EFBIG); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOSPC); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ESPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EROFS); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EMLINK); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EDOM); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ERANGE); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EAGAIN); + // STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EWOULDBLOCK); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EINPROGRESS); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EALREADY); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTSOCK); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EDESTADDRREQ); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EMSGSIZE); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPROTOTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOPROTOOPT); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPROTONOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ESOCKTNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EOPNOTSUPP); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EAFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EADDRINUSE); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EADDRNOTAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENETDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENETUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENETRESET); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ECONNABORTED); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ECONNRESET); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOBUFS); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EISCONN); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTCONN); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ESHUTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ETOOMANYREFS); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ETIMEDOUT); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ECONNREFUSED); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ELOOP); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENAMETOOLONG); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EHOSTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EHOSTUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTEMPTY); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPROCLIM); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EUSERS); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EDQUOT); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ESTALE); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EREMOTE); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EBADRPC); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ERPCMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPROGUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPROGMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EPROCUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOLCK); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOSYS); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EFTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENEEDAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EIDRM); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOMSG); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EOVERFLOW); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EILSEQ); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOTSUP); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ECANCELED); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_EBADMSG); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENODATA); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOSR); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ENOSTR); + STR_CASE(CELL_HTTP_ERROR_NET_SOCKET_ETIME); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPERM); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOENT); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ESRCH); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EINTR); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EIO); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENXIO); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_E2BIG); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOEXC); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EBADF); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ECHILD); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EDEADLK); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOMEM); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EACCES); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EFAULT); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTBLK); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EBUSY); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EEXIST); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EXDEV); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENODEV); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTDIR); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EISDIR); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EINVAL); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENFILE); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EMFILE); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTTY); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ETXTBSY); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EFBIG); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOSPC); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ESPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EROFS); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EMLINK); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EDOM); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ERANGE); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EAGAIN); - //STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EWOULDBLOCK); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EINPROGRESS); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EALREADY); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTSOCK); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EDESTADDRREQ); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EMSGSIZE); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPROTOTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOPROTOOPT); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPROTONOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ESOCKTNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EOPNOTSUPP); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EAFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EADDRINUSE); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EADDRNOTAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENETDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENETUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENETRESET); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ECONNABORTED); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ECONNRESET); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOBUFS); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EISCONN); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTCONN); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ESHUTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ETOOMANYREFS); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ETIMEDOUT); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ECONNREFUSED); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ELOOP); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENAMETOOLONG); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EHOSTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EHOSTUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTEMPTY); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPROCLIM); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EUSERS); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EDQUOT); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ESTALE); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EREMOTE); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EBADRPC); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ERPCMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPROGUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPROGMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPROCUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOLCK); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOSYS); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EFTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENEEDAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EIDRM); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOMSG); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EOVERFLOW); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EILSEQ); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTSUP); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ECANCELED); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EBADMSG); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENODATA); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOSR); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOSTR); - STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ETIME); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPERM); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOENT); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ESRCH); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EINTR); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EIO); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENXIO); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_E2BIG); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOEXC); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EBADF); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ECHILD); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EDEADLK); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOMEM); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EACCES); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EFAULT); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTBLK); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EBUSY); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EEXIST); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EXDEV); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENODEV); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTDIR); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EISDIR); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EINVAL); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENFILE); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EMFILE); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTTY); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ETXTBSY); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EFBIG); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOSPC); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ESPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EROFS); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EMLINK); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EDOM); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ERANGE); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EAGAIN); + // STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EWOULDBLOCK); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EINPROGRESS); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EALREADY); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTSOCK); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EDESTADDRREQ); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EMSGSIZE); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPROTOTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOPROTOOPT); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPROTONOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ESOCKTNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EOPNOTSUPP); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EAFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EADDRINUSE); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EADDRNOTAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENETDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENETUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENETRESET); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ECONNABORTED); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ECONNRESET); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOBUFS); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EISCONN); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTCONN); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ESHUTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ETOOMANYREFS); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ETIMEDOUT); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ECONNREFUSED); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ELOOP); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENAMETOOLONG); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EHOSTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EHOSTUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTEMPTY); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPROCLIM); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EUSERS); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EDQUOT); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ESTALE); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EREMOTE); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EBADRPC); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ERPCMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPROGUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPROGMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EPROCUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOLCK); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOSYS); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EFTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENEEDAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EIDRM); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOMSG); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EOVERFLOW); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EILSEQ); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOTSUP); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ECANCELED); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_EBADMSG); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENODATA); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOSR); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ENOSTR); + STR_CASE(CELL_HTTP_ERROR_NET_CONNECT_ETIME); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPERM); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOENT); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ESRCH); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EINTR); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EIO); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENXIO); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_E2BIG); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOEXC); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EBADF); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ECHILD); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EDEADLK); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOMEM); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EACCES); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EFAULT); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTBLK); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EBUSY); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EEXIST); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EXDEV); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENODEV); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTDIR); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EISDIR); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EINVAL); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENFILE); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EMFILE); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTTY); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ETXTBSY); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EFBIG); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOSPC); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ESPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EROFS); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EMLINK); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EDOM); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ERANGE); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EAGAIN); - //STR_CASE(CELL_HTTP_ERROR_NET_SEND_EWOULDBLOCK); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EINPROGRESS); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EALREADY); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTSOCK); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EDESTADDRREQ); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EMSGSIZE); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPROTOTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOPROTOOPT); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPROTONOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ESOCKTNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EOPNOTSUPP); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EAFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EADDRINUSE); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EADDRNOTAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENETDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENETUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENETRESET); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ECONNABORTED); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ECONNRESET); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOBUFS); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EISCONN); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTCONN); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ESHUTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ETOOMANYREFS); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ETIMEDOUT); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ECONNREFUSED); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ELOOP); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENAMETOOLONG); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EHOSTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EHOSTUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTEMPTY); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPROCLIM); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EUSERS); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EDQUOT); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ESTALE); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EREMOTE); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EBADRPC); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ERPCMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPROGUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPROGMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPROCUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOLCK); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOSYS); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EFTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENEEDAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EIDRM); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOMSG); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EOVERFLOW); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EILSEQ); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTSUP); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ECANCELED); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_EBADMSG); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENODATA); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOSR); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOSTR); - STR_CASE(CELL_HTTP_ERROR_NET_SEND_ETIME); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPERM); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOENT); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ESRCH); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EINTR); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EIO); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENXIO); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_E2BIG); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOEXC); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EBADF); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ECHILD); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EDEADLK); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOMEM); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EACCES); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EFAULT); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTBLK); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EBUSY); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EEXIST); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EXDEV); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENODEV); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTDIR); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EISDIR); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EINVAL); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENFILE); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EMFILE); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTTY); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ETXTBSY); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EFBIG); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOSPC); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ESPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EROFS); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EMLINK); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EDOM); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ERANGE); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EAGAIN); + // STR_CASE(CELL_HTTP_ERROR_NET_SEND_EWOULDBLOCK); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EINPROGRESS); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EALREADY); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTSOCK); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EDESTADDRREQ); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EMSGSIZE); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPROTOTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOPROTOOPT); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPROTONOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ESOCKTNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EOPNOTSUPP); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EAFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EADDRINUSE); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EADDRNOTAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENETDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENETUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENETRESET); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ECONNABORTED); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ECONNRESET); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOBUFS); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EISCONN); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTCONN); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ESHUTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ETOOMANYREFS); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ETIMEDOUT); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ECONNREFUSED); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ELOOP); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENAMETOOLONG); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EHOSTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EHOSTUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTEMPTY); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPROCLIM); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EUSERS); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EDQUOT); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ESTALE); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EREMOTE); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EBADRPC); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ERPCMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPROGUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPROGMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EPROCUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOLCK); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOSYS); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EFTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENEEDAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EIDRM); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOMSG); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EOVERFLOW); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EILSEQ); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOTSUP); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ECANCELED); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_EBADMSG); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENODATA); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOSR); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ENOSTR); + STR_CASE(CELL_HTTP_ERROR_NET_SEND_ETIME); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPERM); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOENT); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ESRCH); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EINTR); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EIO); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENXIO); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_E2BIG); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOEXC); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EBADF); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ECHILD); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EDEADLK); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOMEM); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EACCES); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EFAULT); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTBLK); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EBUSY); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EEXIST); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EXDEV); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENODEV); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTDIR); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EISDIR); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EINVAL); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENFILE); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EMFILE); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTTY); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ETXTBSY); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EFBIG); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOSPC); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ESPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EROFS); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EMLINK); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EDOM); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ERANGE); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EAGAIN); - //STR_CASE(CELL_HTTP_ERROR_NET_RECV_EWOULDBLOCK); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EINPROGRESS); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EALREADY); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTSOCK); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EDESTADDRREQ); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EMSGSIZE); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPROTOTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOPROTOOPT); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPROTONOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ESOCKTNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EOPNOTSUPP); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EAFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EADDRINUSE); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EADDRNOTAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENETDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENETUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENETRESET); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ECONNABORTED); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ECONNRESET); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOBUFS); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EISCONN); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTCONN); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ESHUTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ETOOMANYREFS); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ETIMEDOUT); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ECONNREFUSED); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ELOOP); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENAMETOOLONG); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EHOSTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EHOSTUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTEMPTY); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPROCLIM); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EUSERS); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EDQUOT); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ESTALE); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EREMOTE); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EBADRPC); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ERPCMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPROGUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPROGMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPROCUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOLCK); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOSYS); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EFTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENEEDAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EIDRM); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOMSG); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EOVERFLOW); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EILSEQ); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTSUP); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ECANCELED); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_EBADMSG); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENODATA); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOSR); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOSTR); - STR_CASE(CELL_HTTP_ERROR_NET_RECV_ETIME); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPERM); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOENT); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ESRCH); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EINTR); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EIO); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENXIO); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_E2BIG); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOEXC); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EBADF); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ECHILD); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EDEADLK); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOMEM); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EACCES); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EFAULT); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTBLK); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EBUSY); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EEXIST); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EXDEV); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENODEV); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTDIR); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EISDIR); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EINVAL); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENFILE); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EMFILE); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTTY); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ETXTBSY); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EFBIG); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOSPC); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ESPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EROFS); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EMLINK); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EDOM); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ERANGE); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EAGAIN); + // STR_CASE(CELL_HTTP_ERROR_NET_RECV_EWOULDBLOCK); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EINPROGRESS); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EALREADY); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTSOCK); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EDESTADDRREQ); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EMSGSIZE); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPROTOTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOPROTOOPT); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPROTONOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ESOCKTNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EOPNOTSUPP); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EAFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EADDRINUSE); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EADDRNOTAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENETDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENETUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENETRESET); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ECONNABORTED); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ECONNRESET); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOBUFS); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EISCONN); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTCONN); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ESHUTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ETOOMANYREFS); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ETIMEDOUT); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ECONNREFUSED); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ELOOP); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENAMETOOLONG); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EHOSTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EHOSTUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTEMPTY); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPROCLIM); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EUSERS); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EDQUOT); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ESTALE); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EREMOTE); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EBADRPC); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ERPCMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPROGUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPROGMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EPROCUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOLCK); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOSYS); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EFTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENEEDAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EIDRM); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOMSG); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EOVERFLOW); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EILSEQ); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOTSUP); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ECANCELED); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_EBADMSG); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENODATA); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOSR); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ENOSTR); + STR_CASE(CELL_HTTP_ERROR_NET_RECV_ETIME); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPERM); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOENT); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ESRCH); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EINTR); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EIO); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENXIO); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_E2BIG); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOEXC); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EBADF); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ECHILD); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EDEADLK); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOMEM); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EACCES); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EFAULT); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTBLK); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EBUSY); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EEXIST); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EXDEV); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENODEV); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTDIR); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EISDIR); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EINVAL); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENFILE); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EMFILE); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTTY); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ETXTBSY); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EFBIG); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOSPC); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ESPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EROFS); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EMLINK); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EDOM); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ERANGE); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EAGAIN); - //STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EWOULDBLOCK); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EINPROGRESS); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EALREADY); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTSOCK); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EDESTADDRREQ); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EMSGSIZE); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPROTOTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOPROTOOPT); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPROTONOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ESOCKTNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EOPNOTSUPP); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EAFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EADDRINUSE); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EADDRNOTAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENETDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENETUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENETRESET); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ECONNABORTED); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ECONNRESET); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOBUFS); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EISCONN); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTCONN); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ESHUTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ETOOMANYREFS); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ETIMEDOUT); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ECONNREFUSED); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ELOOP); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENAMETOOLONG); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EHOSTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EHOSTUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTEMPTY); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPROCLIM); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EUSERS); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EDQUOT); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ESTALE); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EREMOTE); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EBADRPC); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ERPCMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPROGUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPROGMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPROCUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOLCK); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOSYS); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EFTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENEEDAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EIDRM); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOMSG); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EOVERFLOW); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EILSEQ); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTSUP); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ECANCELED); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EBADMSG); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENODATA); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOSR); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOSTR); - STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ETIME); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPERM); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOENT); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ESRCH); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EINTR); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EIO); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENXIO); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_E2BIG); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOEXC); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EBADF); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ECHILD); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EDEADLK); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOMEM); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EACCES); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EFAULT); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTBLK); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EBUSY); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EEXIST); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EXDEV); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENODEV); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTDIR); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EISDIR); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EINVAL); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENFILE); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EMFILE); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTTY); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ETXTBSY); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EFBIG); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOSPC); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ESPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EROFS); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EMLINK); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EDOM); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ERANGE); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EAGAIN); + // STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EWOULDBLOCK); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EINPROGRESS); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EALREADY); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTSOCK); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EDESTADDRREQ); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EMSGSIZE); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPROTOTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOPROTOOPT); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPROTONOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ESOCKTNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EOPNOTSUPP); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EAFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EADDRINUSE); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EADDRNOTAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENETDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENETUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENETRESET); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ECONNABORTED); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ECONNRESET); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOBUFS); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EISCONN); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTCONN); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ESHUTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ETOOMANYREFS); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ETIMEDOUT); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ECONNREFUSED); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ELOOP); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENAMETOOLONG); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EHOSTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EHOSTUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTEMPTY); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPROCLIM); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EUSERS); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EDQUOT); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ESTALE); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EREMOTE); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EBADRPC); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ERPCMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPROGUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPROGMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EPROCUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOLCK); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOSYS); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EFTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENEEDAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EIDRM); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOMSG); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EOVERFLOW); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EILSEQ); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOTSUP); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ECANCELED); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_EBADMSG); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENODATA); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOSR); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ENOSTR); + STR_CASE(CELL_HTTP_ERROR_NET_SELECT_ETIME); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPERM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOENT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ESRCH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EINTR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EIO); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENXIO); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_E2BIG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOEXC); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EBADF); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ECHILD); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EDEADLK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOMEM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EACCES); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EFAULT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTBLK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EBUSY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EEXIST); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EXDEV); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENODEV); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTDIR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EISDIR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EINVAL); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENFILE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EMFILE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTTY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ETXTBSY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EFBIG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSPC); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ESPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EROFS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EMLINK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EDOM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ERANGE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EAGAIN); - //STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EWOULDBLOCK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EINPROGRESS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EALREADY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTSOCK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EDESTADDRREQ); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EMSGSIZE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROTOTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOPROTOOPT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROTONOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ESOCKTNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EOPNOTSUPP); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EAFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EADDRINUSE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EADDRNOTAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENETDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENETUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENETRESET); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ECONNABORTED); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ECONNRESET); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOBUFS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EISCONN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTCONN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ESHUTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ETOOMANYREFS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ETIMEDOUT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ECONNREFUSED); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ELOOP); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENAMETOOLONG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EHOSTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EHOSTUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTEMPTY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROCLIM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EUSERS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EDQUOT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ESTALE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EREMOTE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EBADRPC); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ERPCMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROGUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROGMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROCUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOLCK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSYS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EFTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENEEDAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EIDRM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOMSG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EOVERFLOW); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EILSEQ); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTSUP); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ECANCELED); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EBADMSG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENODATA); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSTR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ETIME); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPERM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOENT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ESRCH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EINTR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EIO); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENXIO); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_E2BIG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOEXC); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EBADF); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ECHILD); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EDEADLK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOMEM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EACCES); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EFAULT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTBLK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EBUSY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EEXIST); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EXDEV); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENODEV); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTDIR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EISDIR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EINVAL); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENFILE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EMFILE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTTY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ETXTBSY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EFBIG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSPC); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ESPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EROFS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EMLINK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EDOM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ERANGE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EAGAIN); + // STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EWOULDBLOCK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EINPROGRESS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EALREADY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTSOCK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EDESTADDRREQ); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EMSGSIZE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROTOTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOPROTOOPT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROTONOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ESOCKTNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EOPNOTSUPP); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EAFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EADDRINUSE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EADDRNOTAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENETDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENETUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENETRESET); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ECONNABORTED); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ECONNRESET); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOBUFS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EISCONN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTCONN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ESHUTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ETOOMANYREFS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ETIMEDOUT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ECONNREFUSED); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ELOOP); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENAMETOOLONG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EHOSTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EHOSTUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTEMPTY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROCLIM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EUSERS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EDQUOT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ESTALE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EREMOTE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EBADRPC); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ERPCMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROGUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROGMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROCUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOLCK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSYS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EFTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENEEDAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EIDRM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOMSG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EOVERFLOW); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EILSEQ); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTSUP); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ECANCELED); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_EBADMSG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENODATA); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSTR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_CONNECT_ETIME); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPERM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOENT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ESRCH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EINTR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EIO); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENXIO); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_E2BIG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOEXC); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EBADF); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ECHILD); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EDEADLK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOMEM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EACCES); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EFAULT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTBLK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EBUSY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EEXIST); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EXDEV); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENODEV); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTDIR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EISDIR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EINVAL); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENFILE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EMFILE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTTY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ETXTBSY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EFBIG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOSPC); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ESPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EROFS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EMLINK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EDOM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ERANGE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EAGAIN); - //STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EWOULDBLOCK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EINPROGRESS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EALREADY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTSOCK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EDESTADDRREQ); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EMSGSIZE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPROTOTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOPROTOOPT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPROTONOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ESOCKTNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EOPNOTSUPP); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EAFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EADDRINUSE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EADDRNOTAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENETDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENETUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENETRESET); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ECONNABORTED); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ECONNRESET); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOBUFS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EISCONN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTCONN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ESHUTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ETOOMANYREFS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ETIMEDOUT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ECONNREFUSED); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ELOOP); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENAMETOOLONG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EHOSTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EHOSTUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTEMPTY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPROCLIM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EUSERS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EDQUOT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ESTALE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EREMOTE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EBADRPC); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ERPCMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPROGUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPROGMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPROCUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOLCK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOSYS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EFTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENEEDAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EIDRM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOMSG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EOVERFLOW); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EILSEQ); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTSUP); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ECANCELED); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EBADMSG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENODATA); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOSR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOSTR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ETIME); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPERM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOENT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ESRCH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EINTR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EIO); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENXIO); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_E2BIG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOEXC); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EBADF); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ECHILD); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EDEADLK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOMEM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EACCES); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EFAULT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTBLK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EBUSY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EEXIST); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EXDEV); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENODEV); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTDIR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EISDIR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EINVAL); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENFILE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EMFILE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTTY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ETXTBSY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EFBIG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOSPC); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ESPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EROFS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EMLINK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EDOM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ERANGE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EAGAIN); + // STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EWOULDBLOCK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EINPROGRESS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EALREADY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTSOCK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EDESTADDRREQ); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EMSGSIZE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPROTOTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOPROTOOPT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPROTONOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ESOCKTNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EOPNOTSUPP); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EAFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EADDRINUSE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EADDRNOTAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENETDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENETUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENETRESET); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ECONNABORTED); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ECONNRESET); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOBUFS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EISCONN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTCONN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ESHUTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ETOOMANYREFS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ETIMEDOUT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ECONNREFUSED); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ELOOP); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENAMETOOLONG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EHOSTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EHOSTUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTEMPTY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPROCLIM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EUSERS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EDQUOT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ESTALE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EREMOTE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EBADRPC); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ERPCMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPROGUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPROGMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EPROCUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOLCK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOSYS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EFTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENEEDAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EIDRM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOMSG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EOVERFLOW); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EILSEQ); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOTSUP); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ECANCELED); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_EBADMSG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENODATA); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOSR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ENOSTR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_SEND_ETIME); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPERM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOENT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ESRCH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EINTR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EIO); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENXIO); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_E2BIG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOEXC); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EBADF); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ECHILD); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EDEADLK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOMEM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EACCES); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EFAULT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTBLK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EBUSY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EEXIST); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EXDEV); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENODEV); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTDIR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EISDIR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EINVAL); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENFILE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EMFILE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTTY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ETXTBSY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EFBIG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOSPC); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ESPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EROFS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EMLINK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPIPE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EDOM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ERANGE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EAGAIN); - //STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EWOULDBLOCK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EINPROGRESS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EALREADY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTSOCK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EDESTADDRREQ); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EMSGSIZE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPROTOTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOPROTOOPT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPROTONOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ESOCKTNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EOPNOTSUPP); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EAFNOSUPPORT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EADDRINUSE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EADDRNOTAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENETDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENETUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENETRESET); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ECONNABORTED); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ECONNRESET); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOBUFS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EISCONN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTCONN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ESHUTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ETOOMANYREFS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ETIMEDOUT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ECONNREFUSED); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ELOOP); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENAMETOOLONG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EHOSTDOWN); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EHOSTUNREACH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTEMPTY); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPROCLIM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EUSERS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EDQUOT); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ESTALE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EREMOTE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EBADRPC); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ERPCMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPROGUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPROGMISMATCH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPROCUNAVAIL); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOLCK); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOSYS); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EFTYPE); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENEEDAUTH); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EIDRM); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOMSG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EOVERFLOW); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EILSEQ); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTSUP); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ECANCELED); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EBADMSG); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENODATA); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOSR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOSTR); - STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ETIME); - } + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPERM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOENT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ESRCH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EINTR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EIO); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENXIO); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_E2BIG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOEXC); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EBADF); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ECHILD); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EDEADLK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOMEM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EACCES); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EFAULT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTBLK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EBUSY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EEXIST); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EXDEV); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENODEV); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTDIR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EISDIR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EINVAL); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENFILE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EMFILE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTTY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ETXTBSY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EFBIG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOSPC); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ESPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EROFS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EMLINK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPIPE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EDOM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ERANGE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EAGAIN); + // STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EWOULDBLOCK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EINPROGRESS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EALREADY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTSOCK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EDESTADDRREQ); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EMSGSIZE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPROTOTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOPROTOOPT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPROTONOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ESOCKTNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EOPNOTSUPP); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EAFNOSUPPORT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EADDRINUSE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EADDRNOTAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENETDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENETUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENETRESET); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ECONNABORTED); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ECONNRESET); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOBUFS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EISCONN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTCONN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ESHUTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ETOOMANYREFS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ETIMEDOUT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ECONNREFUSED); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ELOOP); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENAMETOOLONG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EHOSTDOWN); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EHOSTUNREACH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTEMPTY); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPROCLIM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EUSERS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EDQUOT); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ESTALE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EREMOTE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EBADRPC); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ERPCMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPROGUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPROGMISMATCH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EPROCUNAVAIL); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOLCK); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOSYS); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EFTYPE); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENEEDAUTH); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EIDRM); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOMSG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EOVERFLOW); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EILSEQ); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOTSUP); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ECANCELED); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_EBADMSG); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENODATA); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOSR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ENOSTR); + STR_CASE(CELL_HTTP_ERROR_NET_SSL_RECV_ETIME); + } - return unknown; - }); + return unknown; + }); } error_code cellHttpAuthCacheExport(vm::ptr buf, u32 len, vm::ptr outsize) @@ -1339,10 +1339,10 @@ error_code cellHttpGetProxy(vm::ptr proxy, vm::ptr pool, u32 return CELL_HTTP_ERROR_NOT_INITIALIZED; } - //if (todo) + // if (todo) //{ // return cellHttpUtilCopyUri(proxy, some CellHttpUri, pool, poolSize, required); - //} + // } if (required) { @@ -2865,10 +2865,10 @@ error_code cellHttpCreateTransaction(vm::ptr transId, CellHttpC return CELL_HTTP_ERROR_NOT_INITIALIZED; } - //if (error_code error = syscall_sys_memory_get_page_attribute(clientId)) + // if (error_code error = syscall_sys_memory_get_page_attribute(clientId)) //{ // return error; - //} + // } if (!uri || !uri->hostname || !uri->hostname[0]) { @@ -3781,148 +3781,148 @@ error_code cellHttpGetMemoryInfo(vm::ptr heapSize, vm::ptr param_2, vm } DECLARE(ppu_module_manager::cellHttp)("cellHttp", []() -{ - REG_FUNC(cellHttp, cellHttpAuthCacheExport); - REG_FUNC(cellHttp, cellHttpAuthCacheFlush); - REG_FUNC(cellHttp, cellHttpAuthCacheGetEntryMax); - REG_FUNC(cellHttp, cellHttpAuthCacheImport); - REG_FUNC(cellHttp, cellHttpAuthCacheSetEntryMax); - REG_FUNC(cellHttp, cellHttpInit); - REG_FUNC(cellHttp, cellHttpEnd); - REG_FUNC(cellHttp, cellHttpsInit); - REG_FUNC(cellHttp, cellHttpsEnd); - REG_FUNC(cellHttp, cellHttpSetProxy); - REG_FUNC(cellHttp, cellHttpGetCookie); - REG_FUNC(cellHttp, cellHttpGetProxy); + { + REG_FUNC(cellHttp, cellHttpAuthCacheExport); + REG_FUNC(cellHttp, cellHttpAuthCacheFlush); + REG_FUNC(cellHttp, cellHttpAuthCacheGetEntryMax); + REG_FUNC(cellHttp, cellHttpAuthCacheImport); + REG_FUNC(cellHttp, cellHttpAuthCacheSetEntryMax); + REG_FUNC(cellHttp, cellHttpInit); + REG_FUNC(cellHttp, cellHttpEnd); + REG_FUNC(cellHttp, cellHttpsInit); + REG_FUNC(cellHttp, cellHttpsEnd); + REG_FUNC(cellHttp, cellHttpSetProxy); + REG_FUNC(cellHttp, cellHttpGetCookie); + REG_FUNC(cellHttp, cellHttpGetProxy); - REG_FUNC(cellHttp, cellHttpInitCookie); - REG_FUNC(cellHttp, cellHttpEndCookie); - REG_FUNC(cellHttp, cellHttpAddCookieWithClientId); - REG_FUNC(cellHttp, cellHttpSessionCookieFlush); + REG_FUNC(cellHttp, cellHttpInitCookie); + REG_FUNC(cellHttp, cellHttpEndCookie); + REG_FUNC(cellHttp, cellHttpAddCookieWithClientId); + REG_FUNC(cellHttp, cellHttpSessionCookieFlush); - REG_FUNC(cellHttp, cellHttpCookieExport); - REG_FUNC(cellHttp, cellHttpCookieExportWithClientId); - REG_FUNC(cellHttp, cellHttpCookieFlush); - REG_FUNC(cellHttp, cellHttpCookieImport); - REG_FUNC(cellHttp, cellHttpCookieImportWithClientId); + REG_FUNC(cellHttp, cellHttpCookieExport); + REG_FUNC(cellHttp, cellHttpCookieExportWithClientId); + REG_FUNC(cellHttp, cellHttpCookieFlush); + REG_FUNC(cellHttp, cellHttpCookieImport); + REG_FUNC(cellHttp, cellHttpCookieImportWithClientId); - REG_FUNC(cellHttp, cellHttpClientSetCookieSendCallback); - REG_FUNC(cellHttp, cellHttpClientSetCookieRecvCallback); + 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, cellHttpClientSetCacheStatus); + REG_FUNC(cellHttp, cellHttpCreateClient); + REG_FUNC(cellHttp, cellHttpDestroyClient); + REG_FUNC(cellHttp, cellHttpClientSetAuthenticationCallback); + REG_FUNC(cellHttp, cellHttpClientSetTransactionStateCallback); + REG_FUNC(cellHttp, cellHttpClientSetRedirectCallback); + REG_FUNC(cellHttp, cellHttpClientSetCacheStatus); - 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, 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, cellHttpClientCloseAllConnections); + REG_FUNC(cellHttp, cellHttpClientCloseConnections); + REG_FUNC(cellHttp, cellHttpClientPollConnections); - REG_FUNC(cellHttp, cellHttpClientSetConnectionStateCallback); - REG_FUNC(cellHttp, cellHttpClientGetConnectionWaitStatus); - REG_FUNC(cellHttp, cellHttpClientSetConnectionWaitStatus); - REG_FUNC(cellHttp, cellHttpClientGetConnectionWaitTimeout); - REG_FUNC(cellHttp, cellHttpClientSetConnectionWaitTimeout); - 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, cellHttpClientSetConnectionStateCallback); + REG_FUNC(cellHttp, cellHttpClientGetConnectionWaitStatus); + REG_FUNC(cellHttp, cellHttpClientSetConnectionWaitStatus); + REG_FUNC(cellHttp, cellHttpClientGetConnectionWaitTimeout); + REG_FUNC(cellHttp, cellHttpClientSetConnectionWaitTimeout); + 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, 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, cellHttpClientSetSslCallback); + REG_FUNC(cellHttp, cellHttpClientSetSslClientCertificate); - REG_FUNC(cellHttp, cellHttpCreateTransaction); - REG_FUNC(cellHttp, cellHttpDestroyTransaction); - REG_FUNC(cellHttp, cellHttpTransactionGetUri); - REG_FUNC(cellHttp, cellHttpTransactionSetUri); - REG_FUNC(cellHttp, cellHttpTransactionCloseConnection); - REG_FUNC(cellHttp, cellHttpTransactionReleaseConnection); - REG_FUNC(cellHttp, cellHttpTransactionAbortConnection); + REG_FUNC(cellHttp, cellHttpCreateTransaction); + REG_FUNC(cellHttp, cellHttpDestroyTransaction); + REG_FUNC(cellHttp, cellHttpTransactionGetUri); + REG_FUNC(cellHttp, cellHttpTransactionSetUri); + 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, 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, 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, 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, cellHttpClientSetMinSslVersion); - REG_FUNC(cellHttp, cellHttpClientGetMinSslVersion); - REG_FUNC(cellHttp, cellHttpClientSetSslVersion); - REG_FUNC(cellHttp, cellHttpClientGetSslVersion); - REG_FUNC(cellHttp, cellHttpClientSetSslIdDestroyCallback); + REG_FUNC(cellHttp, cellHttpClientSetMinSslVersion); + REG_FUNC(cellHttp, cellHttpClientGetMinSslVersion); + REG_FUNC(cellHttp, cellHttpClientSetSslVersion); + REG_FUNC(cellHttp, cellHttpClientGetSslVersion); + REG_FUNC(cellHttp, cellHttpClientSetSslIdDestroyCallback); - REG_FUNC(cellHttp, cellHttpFlushCache); - REG_FUNC(cellHttp, cellHttpEndCache); - REG_FUNC(cellHttp, cellHttpEndExternalCache); - REG_FUNC(cellHttp, cellHttpInitCache); - REG_FUNC(cellHttp, cellHttpGetCacheInfo); - REG_FUNC(cellHttp, cellHttpGetMemoryInfo); -}); + REG_FUNC(cellHttp, cellHttpFlushCache); + REG_FUNC(cellHttp, cellHttpEndCache); + REG_FUNC(cellHttp, cellHttpEndExternalCache); + REG_FUNC(cellHttp, cellHttpInitCache); + REG_FUNC(cellHttp, cellHttpGetCacheInfo); + REG_FUNC(cellHttp, cellHttpGetMemoryInfo); + }); DECLARE(ppu_module_manager::cellHttps)("cellHttps", []() -{ - // cellHttps doesn't have functions (cellHttpsInit belongs to cellHttp, for example) -}); + { + // cellHttps doesn't have functions (cellHttpsInit belongs to cellHttp, for example) + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellHttp.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellHttp.h index 3840498fd..84990e6fc 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellHttp.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellHttp.h @@ -12,16 +12,16 @@ enum enum { CELL_HTTP_NET_ERROR_TYPE_MASK = 0xffffff00, - CELL_HTTP_NET_ERROR_MASK = 0xff, + CELL_HTTP_NET_ERROR_MASK = 0xff, CELL_HTTP_ERROR_NET_RESOLVER = 0x80710100, - CELL_HTTP_ERROR_NET_ABORT = 0x80710200, - CELL_HTTP_ERROR_NET_OPTION = 0x80710300, - CELL_HTTP_ERROR_NET_SOCKET = 0x80710400, - CELL_HTTP_ERROR_NET_CONNECT = 0x80710500, - CELL_HTTP_ERROR_NET_SEND = 0x80710600, - CELL_HTTP_ERROR_NET_RECV = 0x80710700, - CELL_HTTP_ERROR_NET_SELECT = 0x80710800, + CELL_HTTP_ERROR_NET_ABORT = 0x80710200, + CELL_HTTP_ERROR_NET_OPTION = 0x80710300, + CELL_HTTP_ERROR_NET_SOCKET = 0x80710400, + CELL_HTTP_ERROR_NET_CONNECT = 0x80710500, + CELL_HTTP_ERROR_NET_SEND = 0x80710600, + CELL_HTTP_ERROR_NET_RECV = 0x80710700, + CELL_HTTP_ERROR_NET_SELECT = 0x80710800, // CELL_HTTP_NET_ERROR // CELL_HTTP_IS_NET_RESOLVER_ERROR @@ -30,1172 +30,1172 @@ enum // Error Codes - Http enum CellHttpError { - CELL_HTTP_ERROR_ALREADY_INITIALIZED = 0x80710001, - CELL_HTTP_ERROR_NOT_INITIALIZED = 0x80710002, - CELL_HTTP_ERROR_NO_MEMORY = 0x80710003, - CELL_HTTP_ERROR_NO_BUFFER = 0x80710004, - CELL_HTTP_ERROR_NO_STRING = 0x80710005, - CELL_HTTP_ERROR_INSUFFICIENT = 0x80710006, - CELL_HTTP_ERROR_INVALID_URI = 0x80710007, - CELL_HTTP_ERROR_INVALID_HEADER = 0x80710008, - CELL_HTTP_ERROR_BAD_METHOD = 0x80710009, - CELL_HTTP_ERROR_BAD_CLIENT = 0x80710010, - CELL_HTTP_ERROR_BAD_TRANS = 0x80710011, - CELL_HTTP_ERROR_NO_CONNECTION = 0x80710012, - CELL_HTTP_ERROR_NO_REQUEST_SENT = 0x80710013, - CELL_HTTP_ERROR_ALREADY_BUILT = 0x80710014, - CELL_HTTP_ERROR_ALREADY_SENT = 0x80710015, - CELL_HTTP_ERROR_NO_HEADER = 0x80710016, - CELL_HTTP_ERROR_NO_CONTENT_LENGTH = 0x80710017, - CELL_HTTP_ERROR_TOO_MANY_REDIRECTS = 0x80710018, - CELL_HTTP_ERROR_TOO_MANY_AUTHS = 0x80710019, - CELL_HTTP_ERROR_TRANS_NO_CONNECTION = 0x80710020, - CELL_HTTP_ERROR_CB_FAILED = 0x80710021, - CELL_HTTP_ERROR_NOT_PIPED = 0x80710022, - CELL_HTTP_ERROR_OUT_OF_ORDER_PIPE = 0x80710023, - CELL_HTTP_ERROR_TRANS_ABORTED = 0x80710024, - CELL_HTTP_ERROR_BROKEN_PIPELINE = 0x80710025, - CELL_HTTP_ERROR_UNAVAILABLE = 0x80710026, - CELL_HTTP_ERROR_INVALID_VALUE = 0x80710027, - CELL_HTTP_ERROR_CANNOT_AUTHENTICATE = 0x80710028, - CELL_HTTP_ERROR_COOKIE_NOT_FOUND = 0x80710041, - CELL_HTTP_ERROR_COOKIE_INVALID_DOMAIN = 0x80710042, + CELL_HTTP_ERROR_ALREADY_INITIALIZED = 0x80710001, + CELL_HTTP_ERROR_NOT_INITIALIZED = 0x80710002, + CELL_HTTP_ERROR_NO_MEMORY = 0x80710003, + CELL_HTTP_ERROR_NO_BUFFER = 0x80710004, + CELL_HTTP_ERROR_NO_STRING = 0x80710005, + CELL_HTTP_ERROR_INSUFFICIENT = 0x80710006, + CELL_HTTP_ERROR_INVALID_URI = 0x80710007, + CELL_HTTP_ERROR_INVALID_HEADER = 0x80710008, + CELL_HTTP_ERROR_BAD_METHOD = 0x80710009, + CELL_HTTP_ERROR_BAD_CLIENT = 0x80710010, + CELL_HTTP_ERROR_BAD_TRANS = 0x80710011, + CELL_HTTP_ERROR_NO_CONNECTION = 0x80710012, + CELL_HTTP_ERROR_NO_REQUEST_SENT = 0x80710013, + CELL_HTTP_ERROR_ALREADY_BUILT = 0x80710014, + CELL_HTTP_ERROR_ALREADY_SENT = 0x80710015, + CELL_HTTP_ERROR_NO_HEADER = 0x80710016, + CELL_HTTP_ERROR_NO_CONTENT_LENGTH = 0x80710017, + CELL_HTTP_ERROR_TOO_MANY_REDIRECTS = 0x80710018, + CELL_HTTP_ERROR_TOO_MANY_AUTHS = 0x80710019, + CELL_HTTP_ERROR_TRANS_NO_CONNECTION = 0x80710020, + CELL_HTTP_ERROR_CB_FAILED = 0x80710021, + CELL_HTTP_ERROR_NOT_PIPED = 0x80710022, + CELL_HTTP_ERROR_OUT_OF_ORDER_PIPE = 0x80710023, + CELL_HTTP_ERROR_TRANS_ABORTED = 0x80710024, + CELL_HTTP_ERROR_BROKEN_PIPELINE = 0x80710025, + CELL_HTTP_ERROR_UNAVAILABLE = 0x80710026, + CELL_HTTP_ERROR_INVALID_VALUE = 0x80710027, + CELL_HTTP_ERROR_CANNOT_AUTHENTICATE = 0x80710028, + CELL_HTTP_ERROR_COOKIE_NOT_FOUND = 0x80710041, + CELL_HTTP_ERROR_COOKIE_INVALID_DOMAIN = 0x80710042, CELL_HTTP_ERROR_CACHE_ALREADY_INITIALIZED = 0x80710043, - CELL_HTTP_ERROR_CACHE_NOT_INITIALIZED = 0x80710044, - CELL_HTTP_ERROR_LINE_EXCEEDS_MAX = 0x80710045, - CELL_HTTP_ERROR_REQUIRES_BASIC_AUTH = 0x80710046, + CELL_HTTP_ERROR_CACHE_NOT_INITIALIZED = 0x80710044, + CELL_HTTP_ERROR_LINE_EXCEEDS_MAX = 0x80710045, + CELL_HTTP_ERROR_REQUIRES_BASIC_AUTH = 0x80710046, - CELL_HTTP_ERROR_UNKNOWN = 0x80710051, - CELL_HTTP_ERROR_INTERNAL = 0x80710052, - CELL_HTTP_ERROR_NONREMOVABLE = 0x80710053, - CELL_HTTP_ERROR_BAD_CONN = 0x80710054, - CELL_HTTP_ERROR_BAD_MAN = 0x80710055, - CELL_HTTP_ERROR_NO_POOL = 0x80710056, - CELL_HTTP_ERROR_NO_REQUEST = 0x80710057, - CELL_HTTP_ERROR_LOCK_FAILED = 0x80710058, - CELL_HTTP_ERROR_INVALID_DATA = 0x80710059, - CELL_HTTP_ERROR_BROKEN_CHUNK = 0x8071005a, - CELL_HTTP_ERROR_DECODE_SETUP = 0x8071005b, - CELL_HTTP_ERROR_DECODE_STREAM = 0x8071005c, + CELL_HTTP_ERROR_UNKNOWN = 0x80710051, + CELL_HTTP_ERROR_INTERNAL = 0x80710052, + CELL_HTTP_ERROR_NONREMOVABLE = 0x80710053, + CELL_HTTP_ERROR_BAD_CONN = 0x80710054, + CELL_HTTP_ERROR_BAD_MAN = 0x80710055, + CELL_HTTP_ERROR_NO_POOL = 0x80710056, + CELL_HTTP_ERROR_NO_REQUEST = 0x80710057, + CELL_HTTP_ERROR_LOCK_FAILED = 0x80710058, + CELL_HTTP_ERROR_INVALID_DATA = 0x80710059, + CELL_HTTP_ERROR_BROKEN_CHUNK = 0x8071005a, + CELL_HTTP_ERROR_DECODE_SETUP = 0x8071005b, + CELL_HTTP_ERROR_DECODE_STREAM = 0x8071005c, CELL_HTTP_ERROR_BROKEN_DECODE_STREAM = 0x8071005d, - CELL_HTTP_ERROR_INVALID_DCACHE_PATH = 0x80710060, - CELL_HTTP_ERROR_DCACHE_ALREADY_INITIALIZED = 0x80710061, - CELL_HTTP_ERROR_DCACHE_NOT_INITIALIZED = 0x80710062, - CELL_HTTP_ERROR_TOO_MANY_DCACHE_ENTRY = 0x80710063, - CELL_HTTP_ERROR_DUP_DCACHE_ENTRY = 0x80710064, - CELL_HTTP_ERROR_WRITE_DCACHE = 0x80710065, - CELL_HTTP_ERROR_READ_DCACHE = 0x80710066, - CELL_HTTP_ERROR_CACHE_TOO_LARGE = 0x80710067, - CELL_HTTP_ERROR_INVALID_DCACHE_VERSION = 0x80710068, - CELL_HTTP_ERROR_DCACHE_FILE_BROKEN = 0x80710069, - CELL_HTTP_ERROR_DCACHE_EXCEEDS_MAX = 0x8071006a, - CELL_HTTP_ERROR_DCACHE_BUSY = 0x8071006b, - CELL_HTTP_ERROR_DCACHE_INDEX_BROKEN = 0x8071006c, - CELL_HTTP_ERROR_INVALID_DCACHE_INDEX_NODE = 0x8071006d, - CELL_HTTP_ERROR_DCACHE_FILE_INCONSISTENCY = 0x8071006e, - CELL_HTTP_ERROR_DCACHE_URI_TOO_LONG = 0x8071006f, - CELL_HTTP_ERROR_READ_DCACHE_EOF = 0x80710070, - CELL_HTTP_ERROR_END_OF_DCACHE_INDEX_NODE = 0x80710071, - CELL_HTTP_ERROR_NO_CACHE_MEMORY = 0x80710072, - CELL_HTTP_ERROR_DCACHE_BROKEN = 0x80710073, - CELL_HTTP_ERROR_DCACHE_TOO_MANY_WRITE = 0x80710074, - CELL_HTTP_ERROR_DCACHE_TOO_MANY_READ = 0x80710075, - CELL_HTTP_ERROR_DCACHE_FATAL = 0x80710076, - CELL_HTTP_ERROR_DCACHE_UNSUPPORTED_FEATURE = 0x80710077, + CELL_HTTP_ERROR_INVALID_DCACHE_PATH = 0x80710060, + CELL_HTTP_ERROR_DCACHE_ALREADY_INITIALIZED = 0x80710061, + CELL_HTTP_ERROR_DCACHE_NOT_INITIALIZED = 0x80710062, + CELL_HTTP_ERROR_TOO_MANY_DCACHE_ENTRY = 0x80710063, + CELL_HTTP_ERROR_DUP_DCACHE_ENTRY = 0x80710064, + CELL_HTTP_ERROR_WRITE_DCACHE = 0x80710065, + CELL_HTTP_ERROR_READ_DCACHE = 0x80710066, + CELL_HTTP_ERROR_CACHE_TOO_LARGE = 0x80710067, + CELL_HTTP_ERROR_INVALID_DCACHE_VERSION = 0x80710068, + CELL_HTTP_ERROR_DCACHE_FILE_BROKEN = 0x80710069, + CELL_HTTP_ERROR_DCACHE_EXCEEDS_MAX = 0x8071006a, + CELL_HTTP_ERROR_DCACHE_BUSY = 0x8071006b, + CELL_HTTP_ERROR_DCACHE_INDEX_BROKEN = 0x8071006c, + CELL_HTTP_ERROR_INVALID_DCACHE_INDEX_NODE = 0x8071006d, + CELL_HTTP_ERROR_DCACHE_FILE_INCONSISTENCY = 0x8071006e, + CELL_HTTP_ERROR_DCACHE_URI_TOO_LONG = 0x8071006f, + CELL_HTTP_ERROR_READ_DCACHE_EOF = 0x80710070, + CELL_HTTP_ERROR_END_OF_DCACHE_INDEX_NODE = 0x80710071, + CELL_HTTP_ERROR_NO_CACHE_MEMORY = 0x80710072, + CELL_HTTP_ERROR_DCACHE_BROKEN = 0x80710073, + CELL_HTTP_ERROR_DCACHE_TOO_MANY_WRITE = 0x80710074, + CELL_HTTP_ERROR_DCACHE_TOO_MANY_READ = 0x80710075, + CELL_HTTP_ERROR_DCACHE_FATAL = 0x80710076, + CELL_HTTP_ERROR_DCACHE_UNSUPPORTED_FEATURE = 0x80710077, CELL_HTTP_ERROR_DCACHE_INDEX_IS_ALREADY_OPEN = 0x80710078, - CELL_HTTP_ERROR_DCACHE_INDEX_IS_OPENING = 0x80710079, - CELL_HTTP_ERROR_DCACHE_UNKNOWN = 0x80710080, - CELL_HTTP_ERROR_DCACHE_INDEX_IS_CLOSED = 0x80710081, - CELL_HTTP_ERROR_DCACHE_ABORTED = 0x80710082, - CELL_HTTP_ERROR_DCACHE_INDEX_IS_CLOSING = 0x80710083, - CELL_HTTP_ERROR_DCACHE_UNKNOWN_INDEX_STATE = 0x80710084, + CELL_HTTP_ERROR_DCACHE_INDEX_IS_OPENING = 0x80710079, + CELL_HTTP_ERROR_DCACHE_UNKNOWN = 0x80710080, + CELL_HTTP_ERROR_DCACHE_INDEX_IS_CLOSED = 0x80710081, + CELL_HTTP_ERROR_DCACHE_ABORTED = 0x80710082, + CELL_HTTP_ERROR_DCACHE_INDEX_IS_CLOSING = 0x80710083, + CELL_HTTP_ERROR_DCACHE_UNKNOWN_INDEX_STATE = 0x80710084, - CELL_HTTP_ERROR_NET_FIN = 0x80710091, + CELL_HTTP_ERROR_NET_FIN = 0x80710091, CELL_HTTP_ERROR_NET_CONNECT_TIMEOUT = 0x80710092, - CELL_HTTP_ERROR_NET_SELECT_TIMEOUT = 0x80710093, - CELL_HTTP_ERROR_NET_SEND_TIMEOUT = 0x80710094, + CELL_HTTP_ERROR_NET_SELECT_TIMEOUT = 0x80710093, + CELL_HTTP_ERROR_NET_SEND_TIMEOUT = 0x80710094, }; // Error Codes - Https enum CellHttpsError : u32 { - CELL_HTTPS_ERROR_CERTIFICATE_LOAD = 0x80710a01, - CELL_HTTPS_ERROR_BAD_MEMORY = 0x80710a02, - CELL_HTTPS_ERROR_CONTEXT_CREATION = 0x80710a03, + CELL_HTTPS_ERROR_CERTIFICATE_LOAD = 0x80710a01, + CELL_HTTPS_ERROR_BAD_MEMORY = 0x80710a02, + CELL_HTTPS_ERROR_CONTEXT_CREATION = 0x80710a03, CELL_HTTPS_ERROR_CONNECTION_CREATION = 0x80710a04, - CELL_HTTPS_ERROR_SOCKET_ASSOCIATION = 0x80710a05, - CELL_HTTPS_ERROR_HANDSHAKE = 0x80710a06, - CELL_HTTPS_ERROR_LOOKUP_CERTIFICATE = 0x80710a07, - CELL_HTTPS_ERROR_NO_SSL = 0x80710a08, - CELL_HTTPS_ERROR_KEY_LOAD = 0x80710a09, - CELL_HTTPS_ERROR_CERT_KEY_MISMATCH = 0x80710a0a, - CELL_HTTPS_ERROR_KEY_NEEDS_CERT = 0x80710a0b, - CELL_HTTPS_ERROR_CERT_NEEDS_KEY = 0x80710a0c, - CELL_HTTPS_ERROR_RETRY_CONNECTION = 0x80710a0d, - CELL_HTTPS_ERROR_NET_SSL_CONNECT = 0x80710b00, - CELL_HTTPS_ERROR_NET_SSL_SEND = 0x80710c00, - CELL_HTTPS_ERROR_NET_SSL_RECV = 0x80710d00, + CELL_HTTPS_ERROR_SOCKET_ASSOCIATION = 0x80710a05, + CELL_HTTPS_ERROR_HANDSHAKE = 0x80710a06, + CELL_HTTPS_ERROR_LOOKUP_CERTIFICATE = 0x80710a07, + CELL_HTTPS_ERROR_NO_SSL = 0x80710a08, + CELL_HTTPS_ERROR_KEY_LOAD = 0x80710a09, + CELL_HTTPS_ERROR_CERT_KEY_MISMATCH = 0x80710a0a, + CELL_HTTPS_ERROR_KEY_NEEDS_CERT = 0x80710a0b, + CELL_HTTPS_ERROR_CERT_NEEDS_KEY = 0x80710a0c, + CELL_HTTPS_ERROR_RETRY_CONNECTION = 0x80710a0d, + CELL_HTTPS_ERROR_NET_SSL_CONNECT = 0x80710b00, + CELL_HTTPS_ERROR_NET_SSL_SEND = 0x80710c00, + CELL_HTTPS_ERROR_NET_SSL_RECV = 0x80710d00, }; enum CellHttpErrorNet { CELL_HTTP_ERROR_NET_RESOLVER_NETDB_INTERNAL = 0x807101ff, CELL_HTTP_ERROR_NET_RESOLVER_HOST_NOT_FOUND = 0x80710101, - CELL_HTTP_ERROR_NET_RESOLVER_TRY_AGAIN = 0x80710102, - CELL_HTTP_ERROR_NET_RESOLVER_NO_RECOVERY = 0x80710103, - CELL_HTTP_ERROR_NET_RESOLVER_NO_DATA = 0x80710104, - CELL_HTTP_ERROR_NET_RESOLVER_NO_ADDRESS = 0x80710104, + CELL_HTTP_ERROR_NET_RESOLVER_TRY_AGAIN = 0x80710102, + CELL_HTTP_ERROR_NET_RESOLVER_NO_RECOVERY = 0x80710103, + CELL_HTTP_ERROR_NET_RESOLVER_NO_DATA = 0x80710104, + CELL_HTTP_ERROR_NET_RESOLVER_NO_ADDRESS = 0x80710104, - CELL_HTTP_ERROR_NET_ABORT_EPERM = 0x80710201, - CELL_HTTP_ERROR_NET_ABORT_ENOENT = 0x80710202, - CELL_HTTP_ERROR_NET_ABORT_ESRCH = 0x80710203, - CELL_HTTP_ERROR_NET_ABORT_EINTR = 0x80710204, - CELL_HTTP_ERROR_NET_ABORT_EIO = 0x80710205, - CELL_HTTP_ERROR_NET_ABORT_ENXIO = 0x80710206, - CELL_HTTP_ERROR_NET_ABORT_E2BIG = 0x80710207, - CELL_HTTP_ERROR_NET_ABORT_ENOEXC = 0x80710208, - CELL_HTTP_ERROR_NET_ABORT_EBADF = 0x80710209, - CELL_HTTP_ERROR_NET_ABORT_ECHILD = 0x8071020a, - CELL_HTTP_ERROR_NET_ABORT_EDEADLK = 0x8071020b, - CELL_HTTP_ERROR_NET_ABORT_ENOMEM = 0x8071020c, - CELL_HTTP_ERROR_NET_ABORT_EACCES = 0x8071020d, - CELL_HTTP_ERROR_NET_ABORT_EFAULT = 0x8071020e, - CELL_HTTP_ERROR_NET_ABORT_ENOTBLK = 0x8071020f, - CELL_HTTP_ERROR_NET_ABORT_EBUSY = 0x80710210, - CELL_HTTP_ERROR_NET_ABORT_EEXIST = 0x80710211, - CELL_HTTP_ERROR_NET_ABORT_EXDEV = 0x80710212, - CELL_HTTP_ERROR_NET_ABORT_ENODEV = 0x80710213, - CELL_HTTP_ERROR_NET_ABORT_ENOTDIR = 0x80710214, - CELL_HTTP_ERROR_NET_ABORT_EISDIR = 0x80710215, - CELL_HTTP_ERROR_NET_ABORT_EINVAL = 0x80710216, - CELL_HTTP_ERROR_NET_ABORT_ENFILE = 0x80710217, - CELL_HTTP_ERROR_NET_ABORT_EMFILE = 0x80710218, - CELL_HTTP_ERROR_NET_ABORT_ENOTTY = 0x80710219, - CELL_HTTP_ERROR_NET_ABORT_ETXTBSY = 0x8071021a, - CELL_HTTP_ERROR_NET_ABORT_EFBIG = 0x8071021b, - CELL_HTTP_ERROR_NET_ABORT_ENOSPC = 0x8071021c, - CELL_HTTP_ERROR_NET_ABORT_ESPIPE = 0x8071021d, - CELL_HTTP_ERROR_NET_ABORT_EROFS = 0x8071021e, - CELL_HTTP_ERROR_NET_ABORT_EMLINK = 0x8071021f, - CELL_HTTP_ERROR_NET_ABORT_EPIPE = 0x80710220, - CELL_HTTP_ERROR_NET_ABORT_EDOM = 0x80710221, - CELL_HTTP_ERROR_NET_ABORT_ERANGE = 0x80710222, - CELL_HTTP_ERROR_NET_ABORT_EAGAIN = 0x80710223, - CELL_HTTP_ERROR_NET_ABORT_EWOULDBLOCK = 0x80710223, - CELL_HTTP_ERROR_NET_ABORT_EINPROGRESS = 0x80710224, - CELL_HTTP_ERROR_NET_ABORT_EALREADY = 0x80710225, - CELL_HTTP_ERROR_NET_ABORT_ENOTSOCK = 0x80710226, - CELL_HTTP_ERROR_NET_ABORT_EDESTADDRREQ = 0x80710227, - CELL_HTTP_ERROR_NET_ABORT_EMSGSIZE = 0x80710228, - CELL_HTTP_ERROR_NET_ABORT_EPROTOTYPE = 0x80710229, - CELL_HTTP_ERROR_NET_ABORT_ENOPROTOOPT = 0x8071022a, + CELL_HTTP_ERROR_NET_ABORT_EPERM = 0x80710201, + CELL_HTTP_ERROR_NET_ABORT_ENOENT = 0x80710202, + CELL_HTTP_ERROR_NET_ABORT_ESRCH = 0x80710203, + CELL_HTTP_ERROR_NET_ABORT_EINTR = 0x80710204, + CELL_HTTP_ERROR_NET_ABORT_EIO = 0x80710205, + CELL_HTTP_ERROR_NET_ABORT_ENXIO = 0x80710206, + CELL_HTTP_ERROR_NET_ABORT_E2BIG = 0x80710207, + CELL_HTTP_ERROR_NET_ABORT_ENOEXC = 0x80710208, + CELL_HTTP_ERROR_NET_ABORT_EBADF = 0x80710209, + CELL_HTTP_ERROR_NET_ABORT_ECHILD = 0x8071020a, + CELL_HTTP_ERROR_NET_ABORT_EDEADLK = 0x8071020b, + CELL_HTTP_ERROR_NET_ABORT_ENOMEM = 0x8071020c, + CELL_HTTP_ERROR_NET_ABORT_EACCES = 0x8071020d, + CELL_HTTP_ERROR_NET_ABORT_EFAULT = 0x8071020e, + CELL_HTTP_ERROR_NET_ABORT_ENOTBLK = 0x8071020f, + CELL_HTTP_ERROR_NET_ABORT_EBUSY = 0x80710210, + CELL_HTTP_ERROR_NET_ABORT_EEXIST = 0x80710211, + CELL_HTTP_ERROR_NET_ABORT_EXDEV = 0x80710212, + CELL_HTTP_ERROR_NET_ABORT_ENODEV = 0x80710213, + CELL_HTTP_ERROR_NET_ABORT_ENOTDIR = 0x80710214, + CELL_HTTP_ERROR_NET_ABORT_EISDIR = 0x80710215, + CELL_HTTP_ERROR_NET_ABORT_EINVAL = 0x80710216, + CELL_HTTP_ERROR_NET_ABORT_ENFILE = 0x80710217, + CELL_HTTP_ERROR_NET_ABORT_EMFILE = 0x80710218, + CELL_HTTP_ERROR_NET_ABORT_ENOTTY = 0x80710219, + CELL_HTTP_ERROR_NET_ABORT_ETXTBSY = 0x8071021a, + CELL_HTTP_ERROR_NET_ABORT_EFBIG = 0x8071021b, + CELL_HTTP_ERROR_NET_ABORT_ENOSPC = 0x8071021c, + CELL_HTTP_ERROR_NET_ABORT_ESPIPE = 0x8071021d, + CELL_HTTP_ERROR_NET_ABORT_EROFS = 0x8071021e, + CELL_HTTP_ERROR_NET_ABORT_EMLINK = 0x8071021f, + CELL_HTTP_ERROR_NET_ABORT_EPIPE = 0x80710220, + CELL_HTTP_ERROR_NET_ABORT_EDOM = 0x80710221, + CELL_HTTP_ERROR_NET_ABORT_ERANGE = 0x80710222, + CELL_HTTP_ERROR_NET_ABORT_EAGAIN = 0x80710223, + CELL_HTTP_ERROR_NET_ABORT_EWOULDBLOCK = 0x80710223, + CELL_HTTP_ERROR_NET_ABORT_EINPROGRESS = 0x80710224, + CELL_HTTP_ERROR_NET_ABORT_EALREADY = 0x80710225, + CELL_HTTP_ERROR_NET_ABORT_ENOTSOCK = 0x80710226, + CELL_HTTP_ERROR_NET_ABORT_EDESTADDRREQ = 0x80710227, + CELL_HTTP_ERROR_NET_ABORT_EMSGSIZE = 0x80710228, + CELL_HTTP_ERROR_NET_ABORT_EPROTOTYPE = 0x80710229, + CELL_HTTP_ERROR_NET_ABORT_ENOPROTOOPT = 0x8071022a, CELL_HTTP_ERROR_NET_ABORT_EPROTONOSUPPORT = 0x8071022b, CELL_HTTP_ERROR_NET_ABORT_ESOCKTNOSUPPORT = 0x8071022c, - CELL_HTTP_ERROR_NET_ABORT_EOPNOTSUPP = 0x8071022d, - CELL_HTTP_ERROR_NET_ABORT_EPFNOSUPPORT = 0x8071022e, - CELL_HTTP_ERROR_NET_ABORT_EAFNOSUPPORT = 0x8071022f, - CELL_HTTP_ERROR_NET_ABORT_EADDRINUSE = 0x80710230, - CELL_HTTP_ERROR_NET_ABORT_EADDRNOTAVAIL = 0x80710231, - CELL_HTTP_ERROR_NET_ABORT_ENETDOWN = 0x80710232, - CELL_HTTP_ERROR_NET_ABORT_ENETUNREACH = 0x80710233, - CELL_HTTP_ERROR_NET_ABORT_ENETRESET = 0x80710234, - CELL_HTTP_ERROR_NET_ABORT_ECONNABORTED = 0x80710235, - CELL_HTTP_ERROR_NET_ABORT_ECONNRESET = 0x80710236, - CELL_HTTP_ERROR_NET_ABORT_ENOBUFS = 0x80710237, - CELL_HTTP_ERROR_NET_ABORT_EISCONN = 0x80710238, - CELL_HTTP_ERROR_NET_ABORT_ENOTCONN = 0x80710239, - CELL_HTTP_ERROR_NET_ABORT_ESHUTDOWN = 0x8071023a, - CELL_HTTP_ERROR_NET_ABORT_ETOOMANYREFS = 0x8071023b, - CELL_HTTP_ERROR_NET_ABORT_ETIMEDOUT = 0x8071023c, - CELL_HTTP_ERROR_NET_ABORT_ECONNREFUSED = 0x8071023d, - CELL_HTTP_ERROR_NET_ABORT_ELOOP = 0x8071023e, - CELL_HTTP_ERROR_NET_ABORT_ENAMETOOLONG = 0x8071023f, - CELL_HTTP_ERROR_NET_ABORT_EHOSTDOWN = 0x80710240, - CELL_HTTP_ERROR_NET_ABORT_EHOSTUNREACH = 0x80710241, - CELL_HTTP_ERROR_NET_ABORT_ENOTEMPTY = 0x80710242, - CELL_HTTP_ERROR_NET_ABORT_EPROCLIM = 0x80710243, - CELL_HTTP_ERROR_NET_ABORT_EUSERS = 0x80710244, - CELL_HTTP_ERROR_NET_ABORT_EDQUOT = 0x80710245, - CELL_HTTP_ERROR_NET_ABORT_ESTALE = 0x80710246, - CELL_HTTP_ERROR_NET_ABORT_EREMOTE = 0x80710247, - CELL_HTTP_ERROR_NET_ABORT_EBADRPC = 0x80710248, - CELL_HTTP_ERROR_NET_ABORT_ERPCMISMATCH = 0x80710249, - CELL_HTTP_ERROR_NET_ABORT_EPROGUNAVAIL = 0x8071024a, - CELL_HTTP_ERROR_NET_ABORT_EPROGMISMATCH = 0x8071024b, - CELL_HTTP_ERROR_NET_ABORT_EPROCUNAVAIL = 0x8071024c, - CELL_HTTP_ERROR_NET_ABORT_ENOLCK = 0x8071024d, - CELL_HTTP_ERROR_NET_ABORT_ENOSYS = 0x8071024e, - CELL_HTTP_ERROR_NET_ABORT_EFTYPE = 0x8071024f, - CELL_HTTP_ERROR_NET_ABORT_EAUTH = 0x80710250, - CELL_HTTP_ERROR_NET_ABORT_ENEEDAUTH = 0x80710251, - CELL_HTTP_ERROR_NET_ABORT_EIDRM = 0x80710252, - CELL_HTTP_ERROR_NET_ABORT_ENOMSG = 0x80710253, - CELL_HTTP_ERROR_NET_ABORT_EOVERFLOW = 0x80710254, - CELL_HTTP_ERROR_NET_ABORT_EILSEQ = 0x80710255, - CELL_HTTP_ERROR_NET_ABORT_ENOTSUP = 0x80710256, - CELL_HTTP_ERROR_NET_ABORT_ECANCELED = 0x80710257, - CELL_HTTP_ERROR_NET_ABORT_EBADMSG = 0x80710258, - CELL_HTTP_ERROR_NET_ABORT_ENODATA = 0x80710259, - CELL_HTTP_ERROR_NET_ABORT_ENOSR = 0x8071025a, - CELL_HTTP_ERROR_NET_ABORT_ENOSTR = 0x8071025b, - CELL_HTTP_ERROR_NET_ABORT_ETIME = 0x8071025c, + CELL_HTTP_ERROR_NET_ABORT_EOPNOTSUPP = 0x8071022d, + CELL_HTTP_ERROR_NET_ABORT_EPFNOSUPPORT = 0x8071022e, + CELL_HTTP_ERROR_NET_ABORT_EAFNOSUPPORT = 0x8071022f, + CELL_HTTP_ERROR_NET_ABORT_EADDRINUSE = 0x80710230, + CELL_HTTP_ERROR_NET_ABORT_EADDRNOTAVAIL = 0x80710231, + CELL_HTTP_ERROR_NET_ABORT_ENETDOWN = 0x80710232, + CELL_HTTP_ERROR_NET_ABORT_ENETUNREACH = 0x80710233, + CELL_HTTP_ERROR_NET_ABORT_ENETRESET = 0x80710234, + CELL_HTTP_ERROR_NET_ABORT_ECONNABORTED = 0x80710235, + CELL_HTTP_ERROR_NET_ABORT_ECONNRESET = 0x80710236, + CELL_HTTP_ERROR_NET_ABORT_ENOBUFS = 0x80710237, + CELL_HTTP_ERROR_NET_ABORT_EISCONN = 0x80710238, + CELL_HTTP_ERROR_NET_ABORT_ENOTCONN = 0x80710239, + CELL_HTTP_ERROR_NET_ABORT_ESHUTDOWN = 0x8071023a, + CELL_HTTP_ERROR_NET_ABORT_ETOOMANYREFS = 0x8071023b, + CELL_HTTP_ERROR_NET_ABORT_ETIMEDOUT = 0x8071023c, + CELL_HTTP_ERROR_NET_ABORT_ECONNREFUSED = 0x8071023d, + CELL_HTTP_ERROR_NET_ABORT_ELOOP = 0x8071023e, + CELL_HTTP_ERROR_NET_ABORT_ENAMETOOLONG = 0x8071023f, + CELL_HTTP_ERROR_NET_ABORT_EHOSTDOWN = 0x80710240, + CELL_HTTP_ERROR_NET_ABORT_EHOSTUNREACH = 0x80710241, + CELL_HTTP_ERROR_NET_ABORT_ENOTEMPTY = 0x80710242, + CELL_HTTP_ERROR_NET_ABORT_EPROCLIM = 0x80710243, + CELL_HTTP_ERROR_NET_ABORT_EUSERS = 0x80710244, + CELL_HTTP_ERROR_NET_ABORT_EDQUOT = 0x80710245, + CELL_HTTP_ERROR_NET_ABORT_ESTALE = 0x80710246, + CELL_HTTP_ERROR_NET_ABORT_EREMOTE = 0x80710247, + CELL_HTTP_ERROR_NET_ABORT_EBADRPC = 0x80710248, + CELL_HTTP_ERROR_NET_ABORT_ERPCMISMATCH = 0x80710249, + CELL_HTTP_ERROR_NET_ABORT_EPROGUNAVAIL = 0x8071024a, + CELL_HTTP_ERROR_NET_ABORT_EPROGMISMATCH = 0x8071024b, + CELL_HTTP_ERROR_NET_ABORT_EPROCUNAVAIL = 0x8071024c, + CELL_HTTP_ERROR_NET_ABORT_ENOLCK = 0x8071024d, + CELL_HTTP_ERROR_NET_ABORT_ENOSYS = 0x8071024e, + CELL_HTTP_ERROR_NET_ABORT_EFTYPE = 0x8071024f, + CELL_HTTP_ERROR_NET_ABORT_EAUTH = 0x80710250, + CELL_HTTP_ERROR_NET_ABORT_ENEEDAUTH = 0x80710251, + CELL_HTTP_ERROR_NET_ABORT_EIDRM = 0x80710252, + CELL_HTTP_ERROR_NET_ABORT_ENOMSG = 0x80710253, + CELL_HTTP_ERROR_NET_ABORT_EOVERFLOW = 0x80710254, + CELL_HTTP_ERROR_NET_ABORT_EILSEQ = 0x80710255, + CELL_HTTP_ERROR_NET_ABORT_ENOTSUP = 0x80710256, + CELL_HTTP_ERROR_NET_ABORT_ECANCELED = 0x80710257, + CELL_HTTP_ERROR_NET_ABORT_EBADMSG = 0x80710258, + CELL_HTTP_ERROR_NET_ABORT_ENODATA = 0x80710259, + CELL_HTTP_ERROR_NET_ABORT_ENOSR = 0x8071025a, + CELL_HTTP_ERROR_NET_ABORT_ENOSTR = 0x8071025b, + CELL_HTTP_ERROR_NET_ABORT_ETIME = 0x8071025c, - CELL_HTTP_ERROR_NET_OPTION_EPERM = 0x80710301, - CELL_HTTP_ERROR_NET_OPTION_ENOENT = 0x80710302, - CELL_HTTP_ERROR_NET_OPTION_ESRCH = 0x80710303, - CELL_HTTP_ERROR_NET_OPTION_EINTR = 0x80710304, - CELL_HTTP_ERROR_NET_OPTION_EIO = 0x80710305, - CELL_HTTP_ERROR_NET_OPTION_ENXIO = 0x80710306, - CELL_HTTP_ERROR_NET_OPTION_E2BIG = 0x80710307, - CELL_HTTP_ERROR_NET_OPTION_ENOEXC = 0x80710308, - CELL_HTTP_ERROR_NET_OPTION_EBADF = 0x80710309, - CELL_HTTP_ERROR_NET_OPTION_ECHILD = 0x8071030a, - CELL_HTTP_ERROR_NET_OPTION_EDEADLK = 0x8071030b, - CELL_HTTP_ERROR_NET_OPTION_ENOMEM = 0x8071030c, - CELL_HTTP_ERROR_NET_OPTION_EACCES = 0x8071030d, - CELL_HTTP_ERROR_NET_OPTION_EFAULT = 0x8071030e, - CELL_HTTP_ERROR_NET_OPTION_ENOTBLK = 0x8071030f, - CELL_HTTP_ERROR_NET_OPTION_EBUSY = 0x80710310, - CELL_HTTP_ERROR_NET_OPTION_EEXIST = 0x80710311, - CELL_HTTP_ERROR_NET_OPTION_EXDEV = 0x80710312, - CELL_HTTP_ERROR_NET_OPTION_ENODEV = 0x80710313, - CELL_HTTP_ERROR_NET_OPTION_ENOTDIR = 0x80710314, - CELL_HTTP_ERROR_NET_OPTION_EISDIR = 0x80710315, - CELL_HTTP_ERROR_NET_OPTION_EINVAL = 0x80710316, - CELL_HTTP_ERROR_NET_OPTION_ENFILE = 0x80710317, - CELL_HTTP_ERROR_NET_OPTION_EMFILE = 0x80710318, - CELL_HTTP_ERROR_NET_OPTION_ENOTTY = 0x80710319, - CELL_HTTP_ERROR_NET_OPTION_ETXTBSY = 0x8071031a, - CELL_HTTP_ERROR_NET_OPTION_EFBIG = 0x8071031b, - CELL_HTTP_ERROR_NET_OPTION_ENOSPC = 0x8071031c, - CELL_HTTP_ERROR_NET_OPTION_ESPIPE = 0x8071031d, - CELL_HTTP_ERROR_NET_OPTION_EROFS = 0x8071031e, - CELL_HTTP_ERROR_NET_OPTION_EMLINK = 0x8071031f, - CELL_HTTP_ERROR_NET_OPTION_EPIPE = 0x80710320, - CELL_HTTP_ERROR_NET_OPTION_EDOM = 0x80710321, - CELL_HTTP_ERROR_NET_OPTION_ERANGE = 0x80710322, - CELL_HTTP_ERROR_NET_OPTION_EAGAIN = 0x80710323, - CELL_HTTP_ERROR_NET_OPTION_EWOULDBLOCK = 0x80710323, - CELL_HTTP_ERROR_NET_OPTION_EINPROGRESS = 0x80710324, - CELL_HTTP_ERROR_NET_OPTION_EALREADY = 0x80710325, - CELL_HTTP_ERROR_NET_OPTION_ENOTSOCK = 0x80710326, - CELL_HTTP_ERROR_NET_OPTION_EDESTADDRREQ = 0x80710327, - CELL_HTTP_ERROR_NET_OPTION_EMSGSIZE = 0x80710328, - CELL_HTTP_ERROR_NET_OPTION_EPROTOTYPE = 0x80710329, - CELL_HTTP_ERROR_NET_OPTION_ENOPROTOOPT = 0x8071032a, + CELL_HTTP_ERROR_NET_OPTION_EPERM = 0x80710301, + CELL_HTTP_ERROR_NET_OPTION_ENOENT = 0x80710302, + CELL_HTTP_ERROR_NET_OPTION_ESRCH = 0x80710303, + CELL_HTTP_ERROR_NET_OPTION_EINTR = 0x80710304, + CELL_HTTP_ERROR_NET_OPTION_EIO = 0x80710305, + CELL_HTTP_ERROR_NET_OPTION_ENXIO = 0x80710306, + CELL_HTTP_ERROR_NET_OPTION_E2BIG = 0x80710307, + CELL_HTTP_ERROR_NET_OPTION_ENOEXC = 0x80710308, + CELL_HTTP_ERROR_NET_OPTION_EBADF = 0x80710309, + CELL_HTTP_ERROR_NET_OPTION_ECHILD = 0x8071030a, + CELL_HTTP_ERROR_NET_OPTION_EDEADLK = 0x8071030b, + CELL_HTTP_ERROR_NET_OPTION_ENOMEM = 0x8071030c, + CELL_HTTP_ERROR_NET_OPTION_EACCES = 0x8071030d, + CELL_HTTP_ERROR_NET_OPTION_EFAULT = 0x8071030e, + CELL_HTTP_ERROR_NET_OPTION_ENOTBLK = 0x8071030f, + CELL_HTTP_ERROR_NET_OPTION_EBUSY = 0x80710310, + CELL_HTTP_ERROR_NET_OPTION_EEXIST = 0x80710311, + CELL_HTTP_ERROR_NET_OPTION_EXDEV = 0x80710312, + CELL_HTTP_ERROR_NET_OPTION_ENODEV = 0x80710313, + CELL_HTTP_ERROR_NET_OPTION_ENOTDIR = 0x80710314, + CELL_HTTP_ERROR_NET_OPTION_EISDIR = 0x80710315, + CELL_HTTP_ERROR_NET_OPTION_EINVAL = 0x80710316, + CELL_HTTP_ERROR_NET_OPTION_ENFILE = 0x80710317, + CELL_HTTP_ERROR_NET_OPTION_EMFILE = 0x80710318, + CELL_HTTP_ERROR_NET_OPTION_ENOTTY = 0x80710319, + CELL_HTTP_ERROR_NET_OPTION_ETXTBSY = 0x8071031a, + CELL_HTTP_ERROR_NET_OPTION_EFBIG = 0x8071031b, + CELL_HTTP_ERROR_NET_OPTION_ENOSPC = 0x8071031c, + CELL_HTTP_ERROR_NET_OPTION_ESPIPE = 0x8071031d, + CELL_HTTP_ERROR_NET_OPTION_EROFS = 0x8071031e, + CELL_HTTP_ERROR_NET_OPTION_EMLINK = 0x8071031f, + CELL_HTTP_ERROR_NET_OPTION_EPIPE = 0x80710320, + CELL_HTTP_ERROR_NET_OPTION_EDOM = 0x80710321, + CELL_HTTP_ERROR_NET_OPTION_ERANGE = 0x80710322, + CELL_HTTP_ERROR_NET_OPTION_EAGAIN = 0x80710323, + CELL_HTTP_ERROR_NET_OPTION_EWOULDBLOCK = 0x80710323, + CELL_HTTP_ERROR_NET_OPTION_EINPROGRESS = 0x80710324, + CELL_HTTP_ERROR_NET_OPTION_EALREADY = 0x80710325, + CELL_HTTP_ERROR_NET_OPTION_ENOTSOCK = 0x80710326, + CELL_HTTP_ERROR_NET_OPTION_EDESTADDRREQ = 0x80710327, + CELL_HTTP_ERROR_NET_OPTION_EMSGSIZE = 0x80710328, + CELL_HTTP_ERROR_NET_OPTION_EPROTOTYPE = 0x80710329, + CELL_HTTP_ERROR_NET_OPTION_ENOPROTOOPT = 0x8071032a, CELL_HTTP_ERROR_NET_OPTION_EPROTONOSUPPORT = 0x8071032b, CELL_HTTP_ERROR_NET_OPTION_ESOCKTNOSUPPORT = 0x8071032c, - CELL_HTTP_ERROR_NET_OPTION_EOPNOTSUPP = 0x8071032d, - CELL_HTTP_ERROR_NET_OPTION_EPFNOSUPPORT = 0x8071032e, - CELL_HTTP_ERROR_NET_OPTION_EAFNOSUPPORT = 0x8071032f, - CELL_HTTP_ERROR_NET_OPTION_EADDRINUSE = 0x80710330, - CELL_HTTP_ERROR_NET_OPTION_EADDRNOTAVAIL = 0x80710331, - CELL_HTTP_ERROR_NET_OPTION_ENETDOWN = 0x80710332, - CELL_HTTP_ERROR_NET_OPTION_ENETUNREACH = 0x80710333, - CELL_HTTP_ERROR_NET_OPTION_ENETRESET = 0x80710334, - CELL_HTTP_ERROR_NET_OPTION_ECONNABORTED = 0x80710335, - CELL_HTTP_ERROR_NET_OPTION_ECONNRESET = 0x80710336, - CELL_HTTP_ERROR_NET_OPTION_ENOBUFS = 0x80710337, - CELL_HTTP_ERROR_NET_OPTION_EISCONN = 0x80710338, - CELL_HTTP_ERROR_NET_OPTION_ENOTCONN = 0x80710339, - CELL_HTTP_ERROR_NET_OPTION_ESHUTDOWN = 0x8071033a, - CELL_HTTP_ERROR_NET_OPTION_ETOOMANYREFS = 0x8071033b, - CELL_HTTP_ERROR_NET_OPTION_ETIMEDOUT = 0x8071033c, - CELL_HTTP_ERROR_NET_OPTION_ECONNREFUSED = 0x8071033d, - CELL_HTTP_ERROR_NET_OPTION_ELOOP = 0x8071033e, - CELL_HTTP_ERROR_NET_OPTION_ENAMETOOLONG = 0x8071033f, - CELL_HTTP_ERROR_NET_OPTION_EHOSTDOWN = 0x80710340, - CELL_HTTP_ERROR_NET_OPTION_EHOSTUNREACH = 0x80710341, - CELL_HTTP_ERROR_NET_OPTION_ENOTEMPTY = 0x80710342, - CELL_HTTP_ERROR_NET_OPTION_EPROCLIM = 0x80710343, - CELL_HTTP_ERROR_NET_OPTION_EUSERS = 0x80710344, - CELL_HTTP_ERROR_NET_OPTION_EDQUOT = 0x80710345, - CELL_HTTP_ERROR_NET_OPTION_ESTALE = 0x80710346, - CELL_HTTP_ERROR_NET_OPTION_EREMOTE = 0x80710347, - CELL_HTTP_ERROR_NET_OPTION_EBADRPC = 0x80710348, - CELL_HTTP_ERROR_NET_OPTION_ERPCMISMATCH = 0x80710349, - CELL_HTTP_ERROR_NET_OPTION_EPROGUNAVAIL = 0x8071034a, - CELL_HTTP_ERROR_NET_OPTION_EPROGMISMATCH = 0x8071034b, - CELL_HTTP_ERROR_NET_OPTION_EPROCUNAVAIL = 0x8071034c, - CELL_HTTP_ERROR_NET_OPTION_ENOLCK = 0x8071034d, - CELL_HTTP_ERROR_NET_OPTION_ENOSYS = 0x8071034e, - CELL_HTTP_ERROR_NET_OPTION_EFTYPE = 0x8071034f, - CELL_HTTP_ERROR_NET_OPTION_EAUTH = 0x80710350, - CELL_HTTP_ERROR_NET_OPTION_ENEEDAUTH = 0x80710351, - CELL_HTTP_ERROR_NET_OPTION_EIDRM = 0x80710352, - CELL_HTTP_ERROR_NET_OPTION_ENOMSG = 0x80710353, - CELL_HTTP_ERROR_NET_OPTION_EOVERFLOW = 0x80710354, - CELL_HTTP_ERROR_NET_OPTION_EILSEQ = 0x80710355, - CELL_HTTP_ERROR_NET_OPTION_ENOTSUP = 0x80710356, - CELL_HTTP_ERROR_NET_OPTION_ECANCELED = 0x80710357, - CELL_HTTP_ERROR_NET_OPTION_EBADMSG = 0x80710358, - CELL_HTTP_ERROR_NET_OPTION_ENODATA = 0x80710359, - CELL_HTTP_ERROR_NET_OPTION_ENOSR = 0x8071035a, - CELL_HTTP_ERROR_NET_OPTION_ENOSTR = 0x8071035b, - CELL_HTTP_ERROR_NET_OPTION_ETIME = 0x8071035c, + CELL_HTTP_ERROR_NET_OPTION_EOPNOTSUPP = 0x8071032d, + CELL_HTTP_ERROR_NET_OPTION_EPFNOSUPPORT = 0x8071032e, + CELL_HTTP_ERROR_NET_OPTION_EAFNOSUPPORT = 0x8071032f, + CELL_HTTP_ERROR_NET_OPTION_EADDRINUSE = 0x80710330, + CELL_HTTP_ERROR_NET_OPTION_EADDRNOTAVAIL = 0x80710331, + CELL_HTTP_ERROR_NET_OPTION_ENETDOWN = 0x80710332, + CELL_HTTP_ERROR_NET_OPTION_ENETUNREACH = 0x80710333, + CELL_HTTP_ERROR_NET_OPTION_ENETRESET = 0x80710334, + CELL_HTTP_ERROR_NET_OPTION_ECONNABORTED = 0x80710335, + CELL_HTTP_ERROR_NET_OPTION_ECONNRESET = 0x80710336, + CELL_HTTP_ERROR_NET_OPTION_ENOBUFS = 0x80710337, + CELL_HTTP_ERROR_NET_OPTION_EISCONN = 0x80710338, + CELL_HTTP_ERROR_NET_OPTION_ENOTCONN = 0x80710339, + CELL_HTTP_ERROR_NET_OPTION_ESHUTDOWN = 0x8071033a, + CELL_HTTP_ERROR_NET_OPTION_ETOOMANYREFS = 0x8071033b, + CELL_HTTP_ERROR_NET_OPTION_ETIMEDOUT = 0x8071033c, + CELL_HTTP_ERROR_NET_OPTION_ECONNREFUSED = 0x8071033d, + CELL_HTTP_ERROR_NET_OPTION_ELOOP = 0x8071033e, + CELL_HTTP_ERROR_NET_OPTION_ENAMETOOLONG = 0x8071033f, + CELL_HTTP_ERROR_NET_OPTION_EHOSTDOWN = 0x80710340, + CELL_HTTP_ERROR_NET_OPTION_EHOSTUNREACH = 0x80710341, + CELL_HTTP_ERROR_NET_OPTION_ENOTEMPTY = 0x80710342, + CELL_HTTP_ERROR_NET_OPTION_EPROCLIM = 0x80710343, + CELL_HTTP_ERROR_NET_OPTION_EUSERS = 0x80710344, + CELL_HTTP_ERROR_NET_OPTION_EDQUOT = 0x80710345, + CELL_HTTP_ERROR_NET_OPTION_ESTALE = 0x80710346, + CELL_HTTP_ERROR_NET_OPTION_EREMOTE = 0x80710347, + CELL_HTTP_ERROR_NET_OPTION_EBADRPC = 0x80710348, + CELL_HTTP_ERROR_NET_OPTION_ERPCMISMATCH = 0x80710349, + CELL_HTTP_ERROR_NET_OPTION_EPROGUNAVAIL = 0x8071034a, + CELL_HTTP_ERROR_NET_OPTION_EPROGMISMATCH = 0x8071034b, + CELL_HTTP_ERROR_NET_OPTION_EPROCUNAVAIL = 0x8071034c, + CELL_HTTP_ERROR_NET_OPTION_ENOLCK = 0x8071034d, + CELL_HTTP_ERROR_NET_OPTION_ENOSYS = 0x8071034e, + CELL_HTTP_ERROR_NET_OPTION_EFTYPE = 0x8071034f, + CELL_HTTP_ERROR_NET_OPTION_EAUTH = 0x80710350, + CELL_HTTP_ERROR_NET_OPTION_ENEEDAUTH = 0x80710351, + CELL_HTTP_ERROR_NET_OPTION_EIDRM = 0x80710352, + CELL_HTTP_ERROR_NET_OPTION_ENOMSG = 0x80710353, + CELL_HTTP_ERROR_NET_OPTION_EOVERFLOW = 0x80710354, + CELL_HTTP_ERROR_NET_OPTION_EILSEQ = 0x80710355, + CELL_HTTP_ERROR_NET_OPTION_ENOTSUP = 0x80710356, + CELL_HTTP_ERROR_NET_OPTION_ECANCELED = 0x80710357, + CELL_HTTP_ERROR_NET_OPTION_EBADMSG = 0x80710358, + CELL_HTTP_ERROR_NET_OPTION_ENODATA = 0x80710359, + CELL_HTTP_ERROR_NET_OPTION_ENOSR = 0x8071035a, + CELL_HTTP_ERROR_NET_OPTION_ENOSTR = 0x8071035b, + CELL_HTTP_ERROR_NET_OPTION_ETIME = 0x8071035c, - CELL_HTTP_ERROR_NET_SOCKET_EPERM = 0x80710401, - CELL_HTTP_ERROR_NET_SOCKET_ENOENT = 0x80710402, - CELL_HTTP_ERROR_NET_SOCKET_ESRCH = 0x80710403, - CELL_HTTP_ERROR_NET_SOCKET_EINTR = 0x80710404, - CELL_HTTP_ERROR_NET_SOCKET_EIO = 0x80710405, - CELL_HTTP_ERROR_NET_SOCKET_ENXIO = 0x80710406, - CELL_HTTP_ERROR_NET_SOCKET_E2BIG = 0x80710407, - CELL_HTTP_ERROR_NET_SOCKET_ENOEXC = 0x80710408, - CELL_HTTP_ERROR_NET_SOCKET_EBADF = 0x80710409, - CELL_HTTP_ERROR_NET_SOCKET_ECHILD = 0x8071040a, - CELL_HTTP_ERROR_NET_SOCKET_EDEADLK = 0x8071040b, - CELL_HTTP_ERROR_NET_SOCKET_ENOMEM = 0x8071040c, - CELL_HTTP_ERROR_NET_SOCKET_EACCES = 0x8071040d, - CELL_HTTP_ERROR_NET_SOCKET_EFAULT = 0x8071040e, - CELL_HTTP_ERROR_NET_SOCKET_ENOTBLK = 0x8071040f, - CELL_HTTP_ERROR_NET_SOCKET_EBUSY = 0x80710410, - CELL_HTTP_ERROR_NET_SOCKET_EEXIST = 0x80710411, - CELL_HTTP_ERROR_NET_SOCKET_EXDEV = 0x80710412, - CELL_HTTP_ERROR_NET_SOCKET_ENODEV = 0x80710413, - CELL_HTTP_ERROR_NET_SOCKET_ENOTDIR = 0x80710414, - CELL_HTTP_ERROR_NET_SOCKET_EISDIR = 0x80710415, - CELL_HTTP_ERROR_NET_SOCKET_EINVAL = 0x80710416, - CELL_HTTP_ERROR_NET_SOCKET_ENFILE = 0x80710417, - CELL_HTTP_ERROR_NET_SOCKET_EMFILE = 0x80710418, - CELL_HTTP_ERROR_NET_SOCKET_ENOTTY = 0x80710419, - CELL_HTTP_ERROR_NET_SOCKET_ETXTBSY = 0x8071041a, - CELL_HTTP_ERROR_NET_SOCKET_EFBIG = 0x8071041b, - CELL_HTTP_ERROR_NET_SOCKET_ENOSPC = 0x8071041c, - CELL_HTTP_ERROR_NET_SOCKET_ESPIPE = 0x8071041d, - CELL_HTTP_ERROR_NET_SOCKET_EROFS = 0x8071041e, - CELL_HTTP_ERROR_NET_SOCKET_EMLINK = 0x8071041f, - CELL_HTTP_ERROR_NET_SOCKET_EPIPE = 0x80710420, - CELL_HTTP_ERROR_NET_SOCKET_EDOM = 0x80710421, - CELL_HTTP_ERROR_NET_SOCKET_ERANGE = 0x80710422, - CELL_HTTP_ERROR_NET_SOCKET_EAGAIN = 0x80710423, - CELL_HTTP_ERROR_NET_SOCKET_EWOULDBLOCK = 0x80710423, - CELL_HTTP_ERROR_NET_SOCKET_EINPROGRESS = 0x80710424, - CELL_HTTP_ERROR_NET_SOCKET_EALREADY = 0x80710425, - CELL_HTTP_ERROR_NET_SOCKET_ENOTSOCK = 0x80710426, - CELL_HTTP_ERROR_NET_SOCKET_EDESTADDRREQ = 0x80710427, - CELL_HTTP_ERROR_NET_SOCKET_EMSGSIZE = 0x80710428, - CELL_HTTP_ERROR_NET_SOCKET_EPROTOTYPE = 0x80710429, - CELL_HTTP_ERROR_NET_SOCKET_ENOPROTOOPT = 0x8071042a, + CELL_HTTP_ERROR_NET_SOCKET_EPERM = 0x80710401, + CELL_HTTP_ERROR_NET_SOCKET_ENOENT = 0x80710402, + CELL_HTTP_ERROR_NET_SOCKET_ESRCH = 0x80710403, + CELL_HTTP_ERROR_NET_SOCKET_EINTR = 0x80710404, + CELL_HTTP_ERROR_NET_SOCKET_EIO = 0x80710405, + CELL_HTTP_ERROR_NET_SOCKET_ENXIO = 0x80710406, + CELL_HTTP_ERROR_NET_SOCKET_E2BIG = 0x80710407, + CELL_HTTP_ERROR_NET_SOCKET_ENOEXC = 0x80710408, + CELL_HTTP_ERROR_NET_SOCKET_EBADF = 0x80710409, + CELL_HTTP_ERROR_NET_SOCKET_ECHILD = 0x8071040a, + CELL_HTTP_ERROR_NET_SOCKET_EDEADLK = 0x8071040b, + CELL_HTTP_ERROR_NET_SOCKET_ENOMEM = 0x8071040c, + CELL_HTTP_ERROR_NET_SOCKET_EACCES = 0x8071040d, + CELL_HTTP_ERROR_NET_SOCKET_EFAULT = 0x8071040e, + CELL_HTTP_ERROR_NET_SOCKET_ENOTBLK = 0x8071040f, + CELL_HTTP_ERROR_NET_SOCKET_EBUSY = 0x80710410, + CELL_HTTP_ERROR_NET_SOCKET_EEXIST = 0x80710411, + CELL_HTTP_ERROR_NET_SOCKET_EXDEV = 0x80710412, + CELL_HTTP_ERROR_NET_SOCKET_ENODEV = 0x80710413, + CELL_HTTP_ERROR_NET_SOCKET_ENOTDIR = 0x80710414, + CELL_HTTP_ERROR_NET_SOCKET_EISDIR = 0x80710415, + CELL_HTTP_ERROR_NET_SOCKET_EINVAL = 0x80710416, + CELL_HTTP_ERROR_NET_SOCKET_ENFILE = 0x80710417, + CELL_HTTP_ERROR_NET_SOCKET_EMFILE = 0x80710418, + CELL_HTTP_ERROR_NET_SOCKET_ENOTTY = 0x80710419, + CELL_HTTP_ERROR_NET_SOCKET_ETXTBSY = 0x8071041a, + CELL_HTTP_ERROR_NET_SOCKET_EFBIG = 0x8071041b, + CELL_HTTP_ERROR_NET_SOCKET_ENOSPC = 0x8071041c, + CELL_HTTP_ERROR_NET_SOCKET_ESPIPE = 0x8071041d, + CELL_HTTP_ERROR_NET_SOCKET_EROFS = 0x8071041e, + CELL_HTTP_ERROR_NET_SOCKET_EMLINK = 0x8071041f, + CELL_HTTP_ERROR_NET_SOCKET_EPIPE = 0x80710420, + CELL_HTTP_ERROR_NET_SOCKET_EDOM = 0x80710421, + CELL_HTTP_ERROR_NET_SOCKET_ERANGE = 0x80710422, + CELL_HTTP_ERROR_NET_SOCKET_EAGAIN = 0x80710423, + CELL_HTTP_ERROR_NET_SOCKET_EWOULDBLOCK = 0x80710423, + CELL_HTTP_ERROR_NET_SOCKET_EINPROGRESS = 0x80710424, + CELL_HTTP_ERROR_NET_SOCKET_EALREADY = 0x80710425, + CELL_HTTP_ERROR_NET_SOCKET_ENOTSOCK = 0x80710426, + CELL_HTTP_ERROR_NET_SOCKET_EDESTADDRREQ = 0x80710427, + CELL_HTTP_ERROR_NET_SOCKET_EMSGSIZE = 0x80710428, + CELL_HTTP_ERROR_NET_SOCKET_EPROTOTYPE = 0x80710429, + CELL_HTTP_ERROR_NET_SOCKET_ENOPROTOOPT = 0x8071042a, CELL_HTTP_ERROR_NET_SOCKET_EPROTONOSUPPORT = 0x8071042b, CELL_HTTP_ERROR_NET_SOCKET_ESOCKTNOSUPPORT = 0x8071042c, - CELL_HTTP_ERROR_NET_SOCKET_EOPNOTSUPP = 0x8071042d, - CELL_HTTP_ERROR_NET_SOCKET_EPFNOSUPPORT = 0x8071042e, - CELL_HTTP_ERROR_NET_SOCKET_EAFNOSUPPORT = 0x8071042f, - CELL_HTTP_ERROR_NET_SOCKET_EADDRINUSE = 0x80710430, - CELL_HTTP_ERROR_NET_SOCKET_EADDRNOTAVAIL = 0x80710431, - CELL_HTTP_ERROR_NET_SOCKET_ENETDOWN = 0x80710432, - CELL_HTTP_ERROR_NET_SOCKET_ENETUNREACH = 0x80710433, - CELL_HTTP_ERROR_NET_SOCKET_ENETRESET = 0x80710434, - CELL_HTTP_ERROR_NET_SOCKET_ECONNABORTED = 0x80710435, - CELL_HTTP_ERROR_NET_SOCKET_ECONNRESET = 0x80710436, - CELL_HTTP_ERROR_NET_SOCKET_ENOBUFS = 0x80710437, - CELL_HTTP_ERROR_NET_SOCKET_EISCONN = 0x80710438, - CELL_HTTP_ERROR_NET_SOCKET_ENOTCONN = 0x80710439, - CELL_HTTP_ERROR_NET_SOCKET_ESHUTDOWN = 0x8071043a, - CELL_HTTP_ERROR_NET_SOCKET_ETOOMANYREFS = 0x8071043b, - CELL_HTTP_ERROR_NET_SOCKET_ETIMEDOUT = 0x8071043c, - CELL_HTTP_ERROR_NET_SOCKET_ECONNREFUSED = 0x8071043d, - CELL_HTTP_ERROR_NET_SOCKET_ELOOP = 0x8071043e, - CELL_HTTP_ERROR_NET_SOCKET_ENAMETOOLONG = 0x8071043f, - CELL_HTTP_ERROR_NET_SOCKET_EHOSTDOWN = 0x80710440, - CELL_HTTP_ERROR_NET_SOCKET_EHOSTUNREACH = 0x80710441, - CELL_HTTP_ERROR_NET_SOCKET_ENOTEMPTY = 0x80710442, - CELL_HTTP_ERROR_NET_SOCKET_EPROCLIM = 0x80710443, - CELL_HTTP_ERROR_NET_SOCKET_EUSERS = 0x80710444, - CELL_HTTP_ERROR_NET_SOCKET_EDQUOT = 0x80710445, - CELL_HTTP_ERROR_NET_SOCKET_ESTALE = 0x80710446, - CELL_HTTP_ERROR_NET_SOCKET_EREMOTE = 0x80710447, - CELL_HTTP_ERROR_NET_SOCKET_EBADRPC = 0x80710448, - CELL_HTTP_ERROR_NET_SOCKET_ERPCMISMATCH = 0x80710449, - CELL_HTTP_ERROR_NET_SOCKET_EPROGUNAVAIL = 0x8071044a, - CELL_HTTP_ERROR_NET_SOCKET_EPROGMISMATCH = 0x8071044b, - CELL_HTTP_ERROR_NET_SOCKET_EPROCUNAVAIL = 0x8071044c, - CELL_HTTP_ERROR_NET_SOCKET_ENOLCK = 0x8071044d, - CELL_HTTP_ERROR_NET_SOCKET_ENOSYS = 0x8071044e, - CELL_HTTP_ERROR_NET_SOCKET_EFTYPE = 0x8071044f, - CELL_HTTP_ERROR_NET_SOCKET_EAUTH = 0x80710450, - CELL_HTTP_ERROR_NET_SOCKET_ENEEDAUTH = 0x80710451, - CELL_HTTP_ERROR_NET_SOCKET_EIDRM = 0x80710452, - CELL_HTTP_ERROR_NET_SOCKET_ENOMSG = 0x80710453, - CELL_HTTP_ERROR_NET_SOCKET_EOVERFLOW = 0x80710454, - CELL_HTTP_ERROR_NET_SOCKET_EILSEQ = 0x80710455, - CELL_HTTP_ERROR_NET_SOCKET_ENOTSUP = 0x80710456, - CELL_HTTP_ERROR_NET_SOCKET_ECANCELED = 0x80710457, - CELL_HTTP_ERROR_NET_SOCKET_EBADMSG = 0x80710458, - CELL_HTTP_ERROR_NET_SOCKET_ENODATA = 0x80710459, - CELL_HTTP_ERROR_NET_SOCKET_ENOSR = 0x8071045a, - CELL_HTTP_ERROR_NET_SOCKET_ENOSTR = 0x8071045b, - CELL_HTTP_ERROR_NET_SOCKET_ETIME = 0x8071045c, + CELL_HTTP_ERROR_NET_SOCKET_EOPNOTSUPP = 0x8071042d, + CELL_HTTP_ERROR_NET_SOCKET_EPFNOSUPPORT = 0x8071042e, + CELL_HTTP_ERROR_NET_SOCKET_EAFNOSUPPORT = 0x8071042f, + CELL_HTTP_ERROR_NET_SOCKET_EADDRINUSE = 0x80710430, + CELL_HTTP_ERROR_NET_SOCKET_EADDRNOTAVAIL = 0x80710431, + CELL_HTTP_ERROR_NET_SOCKET_ENETDOWN = 0x80710432, + CELL_HTTP_ERROR_NET_SOCKET_ENETUNREACH = 0x80710433, + CELL_HTTP_ERROR_NET_SOCKET_ENETRESET = 0x80710434, + CELL_HTTP_ERROR_NET_SOCKET_ECONNABORTED = 0x80710435, + CELL_HTTP_ERROR_NET_SOCKET_ECONNRESET = 0x80710436, + CELL_HTTP_ERROR_NET_SOCKET_ENOBUFS = 0x80710437, + CELL_HTTP_ERROR_NET_SOCKET_EISCONN = 0x80710438, + CELL_HTTP_ERROR_NET_SOCKET_ENOTCONN = 0x80710439, + CELL_HTTP_ERROR_NET_SOCKET_ESHUTDOWN = 0x8071043a, + CELL_HTTP_ERROR_NET_SOCKET_ETOOMANYREFS = 0x8071043b, + CELL_HTTP_ERROR_NET_SOCKET_ETIMEDOUT = 0x8071043c, + CELL_HTTP_ERROR_NET_SOCKET_ECONNREFUSED = 0x8071043d, + CELL_HTTP_ERROR_NET_SOCKET_ELOOP = 0x8071043e, + CELL_HTTP_ERROR_NET_SOCKET_ENAMETOOLONG = 0x8071043f, + CELL_HTTP_ERROR_NET_SOCKET_EHOSTDOWN = 0x80710440, + CELL_HTTP_ERROR_NET_SOCKET_EHOSTUNREACH = 0x80710441, + CELL_HTTP_ERROR_NET_SOCKET_ENOTEMPTY = 0x80710442, + CELL_HTTP_ERROR_NET_SOCKET_EPROCLIM = 0x80710443, + CELL_HTTP_ERROR_NET_SOCKET_EUSERS = 0x80710444, + CELL_HTTP_ERROR_NET_SOCKET_EDQUOT = 0x80710445, + CELL_HTTP_ERROR_NET_SOCKET_ESTALE = 0x80710446, + CELL_HTTP_ERROR_NET_SOCKET_EREMOTE = 0x80710447, + CELL_HTTP_ERROR_NET_SOCKET_EBADRPC = 0x80710448, + CELL_HTTP_ERROR_NET_SOCKET_ERPCMISMATCH = 0x80710449, + CELL_HTTP_ERROR_NET_SOCKET_EPROGUNAVAIL = 0x8071044a, + CELL_HTTP_ERROR_NET_SOCKET_EPROGMISMATCH = 0x8071044b, + CELL_HTTP_ERROR_NET_SOCKET_EPROCUNAVAIL = 0x8071044c, + CELL_HTTP_ERROR_NET_SOCKET_ENOLCK = 0x8071044d, + CELL_HTTP_ERROR_NET_SOCKET_ENOSYS = 0x8071044e, + CELL_HTTP_ERROR_NET_SOCKET_EFTYPE = 0x8071044f, + CELL_HTTP_ERROR_NET_SOCKET_EAUTH = 0x80710450, + CELL_HTTP_ERROR_NET_SOCKET_ENEEDAUTH = 0x80710451, + CELL_HTTP_ERROR_NET_SOCKET_EIDRM = 0x80710452, + CELL_HTTP_ERROR_NET_SOCKET_ENOMSG = 0x80710453, + CELL_HTTP_ERROR_NET_SOCKET_EOVERFLOW = 0x80710454, + CELL_HTTP_ERROR_NET_SOCKET_EILSEQ = 0x80710455, + CELL_HTTP_ERROR_NET_SOCKET_ENOTSUP = 0x80710456, + CELL_HTTP_ERROR_NET_SOCKET_ECANCELED = 0x80710457, + CELL_HTTP_ERROR_NET_SOCKET_EBADMSG = 0x80710458, + CELL_HTTP_ERROR_NET_SOCKET_ENODATA = 0x80710459, + CELL_HTTP_ERROR_NET_SOCKET_ENOSR = 0x8071045a, + CELL_HTTP_ERROR_NET_SOCKET_ENOSTR = 0x8071045b, + CELL_HTTP_ERROR_NET_SOCKET_ETIME = 0x8071045c, - CELL_HTTP_ERROR_NET_CONNECT_EPERM = 0x80710501, - CELL_HTTP_ERROR_NET_CONNECT_ENOENT = 0x80710502, - CELL_HTTP_ERROR_NET_CONNECT_ESRCH = 0x80710503, - CELL_HTTP_ERROR_NET_CONNECT_EINTR = 0x80710504, - CELL_HTTP_ERROR_NET_CONNECT_EIO = 0x80710505, - CELL_HTTP_ERROR_NET_CONNECT_ENXIO = 0x80710506, - CELL_HTTP_ERROR_NET_CONNECT_E2BIG = 0x80710507, - CELL_HTTP_ERROR_NET_CONNECT_ENOEXC = 0x80710508, - CELL_HTTP_ERROR_NET_CONNECT_EBADF = 0x80710509, - CELL_HTTP_ERROR_NET_CONNECT_ECHILD = 0x8071050a, - CELL_HTTP_ERROR_NET_CONNECT_EDEADLK = 0x8071050b, - CELL_HTTP_ERROR_NET_CONNECT_ENOMEM = 0x8071050c, - CELL_HTTP_ERROR_NET_CONNECT_EACCES = 0x8071050d, - CELL_HTTP_ERROR_NET_CONNECT_EFAULT = 0x8071050e, - CELL_HTTP_ERROR_NET_CONNECT_ENOTBLK = 0x8071050f, - CELL_HTTP_ERROR_NET_CONNECT_EBUSY = 0x80710510, - CELL_HTTP_ERROR_NET_CONNECT_EEXIST = 0x80710511, - CELL_HTTP_ERROR_NET_CONNECT_EXDEV = 0x80710512, - CELL_HTTP_ERROR_NET_CONNECT_ENODEV = 0x80710513, - CELL_HTTP_ERROR_NET_CONNECT_ENOTDIR = 0x80710514, - CELL_HTTP_ERROR_NET_CONNECT_EISDIR = 0x80710515, - CELL_HTTP_ERROR_NET_CONNECT_EINVAL = 0x80710516, - CELL_HTTP_ERROR_NET_CONNECT_ENFILE = 0x80710517, - CELL_HTTP_ERROR_NET_CONNECT_EMFILE = 0x80710518, - CELL_HTTP_ERROR_NET_CONNECT_ENOTTY = 0x80710519, - CELL_HTTP_ERROR_NET_CONNECT_ETXTBSY = 0x8071051a, - CELL_HTTP_ERROR_NET_CONNECT_EFBIG = 0x8071051b, - CELL_HTTP_ERROR_NET_CONNECT_ENOSPC = 0x8071051c, - CELL_HTTP_ERROR_NET_CONNECT_ESPIPE = 0x8071051d, - CELL_HTTP_ERROR_NET_CONNECT_EROFS = 0x8071051e, - CELL_HTTP_ERROR_NET_CONNECT_EMLINK = 0x8071051f, - CELL_HTTP_ERROR_NET_CONNECT_EPIPE = 0x80710520, - CELL_HTTP_ERROR_NET_CONNECT_EDOM = 0x80710521, - CELL_HTTP_ERROR_NET_CONNECT_ERANGE = 0x80710522, - CELL_HTTP_ERROR_NET_CONNECT_EAGAIN = 0x80710523, - CELL_HTTP_ERROR_NET_CONNECT_EWOULDBLOCK = 0x80710523, - CELL_HTTP_ERROR_NET_CONNECT_EINPROGRESS = 0x80710524, - CELL_HTTP_ERROR_NET_CONNECT_EALREADY = 0x80710525, - CELL_HTTP_ERROR_NET_CONNECT_ENOTSOCK = 0x80710526, - CELL_HTTP_ERROR_NET_CONNECT_EDESTADDRREQ = 0x80710527, - CELL_HTTP_ERROR_NET_CONNECT_EMSGSIZE = 0x80710528, - CELL_HTTP_ERROR_NET_CONNECT_EPROTOTYPE = 0x80710529, - CELL_HTTP_ERROR_NET_CONNECT_ENOPROTOOPT = 0x8071052a, + CELL_HTTP_ERROR_NET_CONNECT_EPERM = 0x80710501, + CELL_HTTP_ERROR_NET_CONNECT_ENOENT = 0x80710502, + CELL_HTTP_ERROR_NET_CONNECT_ESRCH = 0x80710503, + CELL_HTTP_ERROR_NET_CONNECT_EINTR = 0x80710504, + CELL_HTTP_ERROR_NET_CONNECT_EIO = 0x80710505, + CELL_HTTP_ERROR_NET_CONNECT_ENXIO = 0x80710506, + CELL_HTTP_ERROR_NET_CONNECT_E2BIG = 0x80710507, + CELL_HTTP_ERROR_NET_CONNECT_ENOEXC = 0x80710508, + CELL_HTTP_ERROR_NET_CONNECT_EBADF = 0x80710509, + CELL_HTTP_ERROR_NET_CONNECT_ECHILD = 0x8071050a, + CELL_HTTP_ERROR_NET_CONNECT_EDEADLK = 0x8071050b, + CELL_HTTP_ERROR_NET_CONNECT_ENOMEM = 0x8071050c, + CELL_HTTP_ERROR_NET_CONNECT_EACCES = 0x8071050d, + CELL_HTTP_ERROR_NET_CONNECT_EFAULT = 0x8071050e, + CELL_HTTP_ERROR_NET_CONNECT_ENOTBLK = 0x8071050f, + CELL_HTTP_ERROR_NET_CONNECT_EBUSY = 0x80710510, + CELL_HTTP_ERROR_NET_CONNECT_EEXIST = 0x80710511, + CELL_HTTP_ERROR_NET_CONNECT_EXDEV = 0x80710512, + CELL_HTTP_ERROR_NET_CONNECT_ENODEV = 0x80710513, + CELL_HTTP_ERROR_NET_CONNECT_ENOTDIR = 0x80710514, + CELL_HTTP_ERROR_NET_CONNECT_EISDIR = 0x80710515, + CELL_HTTP_ERROR_NET_CONNECT_EINVAL = 0x80710516, + CELL_HTTP_ERROR_NET_CONNECT_ENFILE = 0x80710517, + CELL_HTTP_ERROR_NET_CONNECT_EMFILE = 0x80710518, + CELL_HTTP_ERROR_NET_CONNECT_ENOTTY = 0x80710519, + CELL_HTTP_ERROR_NET_CONNECT_ETXTBSY = 0x8071051a, + CELL_HTTP_ERROR_NET_CONNECT_EFBIG = 0x8071051b, + CELL_HTTP_ERROR_NET_CONNECT_ENOSPC = 0x8071051c, + CELL_HTTP_ERROR_NET_CONNECT_ESPIPE = 0x8071051d, + CELL_HTTP_ERROR_NET_CONNECT_EROFS = 0x8071051e, + CELL_HTTP_ERROR_NET_CONNECT_EMLINK = 0x8071051f, + CELL_HTTP_ERROR_NET_CONNECT_EPIPE = 0x80710520, + CELL_HTTP_ERROR_NET_CONNECT_EDOM = 0x80710521, + CELL_HTTP_ERROR_NET_CONNECT_ERANGE = 0x80710522, + CELL_HTTP_ERROR_NET_CONNECT_EAGAIN = 0x80710523, + CELL_HTTP_ERROR_NET_CONNECT_EWOULDBLOCK = 0x80710523, + CELL_HTTP_ERROR_NET_CONNECT_EINPROGRESS = 0x80710524, + CELL_HTTP_ERROR_NET_CONNECT_EALREADY = 0x80710525, + CELL_HTTP_ERROR_NET_CONNECT_ENOTSOCK = 0x80710526, + CELL_HTTP_ERROR_NET_CONNECT_EDESTADDRREQ = 0x80710527, + CELL_HTTP_ERROR_NET_CONNECT_EMSGSIZE = 0x80710528, + CELL_HTTP_ERROR_NET_CONNECT_EPROTOTYPE = 0x80710529, + CELL_HTTP_ERROR_NET_CONNECT_ENOPROTOOPT = 0x8071052a, CELL_HTTP_ERROR_NET_CONNECT_EPROTONOSUPPORT = 0x8071052b, CELL_HTTP_ERROR_NET_CONNECT_ESOCKTNOSUPPORT = 0x8071052c, - CELL_HTTP_ERROR_NET_CONNECT_EOPNOTSUPP = 0x8071052d, - CELL_HTTP_ERROR_NET_CONNECT_EPFNOSUPPORT = 0x8071052e, - CELL_HTTP_ERROR_NET_CONNECT_EAFNOSUPPORT = 0x8071052f, - CELL_HTTP_ERROR_NET_CONNECT_EADDRINUSE = 0x80710530, - CELL_HTTP_ERROR_NET_CONNECT_EADDRNOTAVAIL = 0x80710531, - CELL_HTTP_ERROR_NET_CONNECT_ENETDOWN = 0x80710532, - CELL_HTTP_ERROR_NET_CONNECT_ENETUNREACH = 0x80710533, - CELL_HTTP_ERROR_NET_CONNECT_ENETRESET = 0x80710534, - CELL_HTTP_ERROR_NET_CONNECT_ECONNABORTED = 0x80710535, - CELL_HTTP_ERROR_NET_CONNECT_ECONNRESET = 0x80710536, - CELL_HTTP_ERROR_NET_CONNECT_ENOBUFS = 0x80710537, - CELL_HTTP_ERROR_NET_CONNECT_EISCONN = 0x80710538, - CELL_HTTP_ERROR_NET_CONNECT_ENOTCONN = 0x80710539, - CELL_HTTP_ERROR_NET_CONNECT_ESHUTDOWN = 0x8071053a, - CELL_HTTP_ERROR_NET_CONNECT_ETOOMANYREFS = 0x8071053b, - CELL_HTTP_ERROR_NET_CONNECT_ETIMEDOUT = 0x8071053c, - CELL_HTTP_ERROR_NET_CONNECT_ECONNREFUSED = 0x8071053d, - CELL_HTTP_ERROR_NET_CONNECT_ELOOP = 0x8071053e, - CELL_HTTP_ERROR_NET_CONNECT_ENAMETOOLONG = 0x8071053f, - CELL_HTTP_ERROR_NET_CONNECT_EHOSTDOWN = 0x80710540, - CELL_HTTP_ERROR_NET_CONNECT_EHOSTUNREACH = 0x80710541, - CELL_HTTP_ERROR_NET_CONNECT_ENOTEMPTY = 0x80710542, - CELL_HTTP_ERROR_NET_CONNECT_EPROCLIM = 0x80710543, - CELL_HTTP_ERROR_NET_CONNECT_EUSERS = 0x80710544, - CELL_HTTP_ERROR_NET_CONNECT_EDQUOT = 0x80710545, - CELL_HTTP_ERROR_NET_CONNECT_ESTALE = 0x80710546, - CELL_HTTP_ERROR_NET_CONNECT_EREMOTE = 0x80710547, - CELL_HTTP_ERROR_NET_CONNECT_EBADRPC = 0x80710548, - CELL_HTTP_ERROR_NET_CONNECT_ERPCMISMATCH = 0x80710549, - CELL_HTTP_ERROR_NET_CONNECT_EPROGUNAVAIL = 0x8071054a, - CELL_HTTP_ERROR_NET_CONNECT_EPROGMISMATCH = 0x8071054b, - CELL_HTTP_ERROR_NET_CONNECT_EPROCUNAVAIL = 0x8071054c, - CELL_HTTP_ERROR_NET_CONNECT_ENOLCK = 0x8071054d, - CELL_HTTP_ERROR_NET_CONNECT_ENOSYS = 0x8071054e, - CELL_HTTP_ERROR_NET_CONNECT_EFTYPE = 0x8071054f, - CELL_HTTP_ERROR_NET_CONNECT_EAUTH = 0x80710550, - CELL_HTTP_ERROR_NET_CONNECT_ENEEDAUTH = 0x80710551, - CELL_HTTP_ERROR_NET_CONNECT_EIDRM = 0x80710552, - CELL_HTTP_ERROR_NET_CONNECT_ENOMSG = 0x80710553, - CELL_HTTP_ERROR_NET_CONNECT_EOVERFLOW = 0x80710554, - CELL_HTTP_ERROR_NET_CONNECT_EILSEQ = 0x80710555, - CELL_HTTP_ERROR_NET_CONNECT_ENOTSUP = 0x80710556, - CELL_HTTP_ERROR_NET_CONNECT_ECANCELED = 0x80710557, - CELL_HTTP_ERROR_NET_CONNECT_EBADMSG = 0x80710558, - CELL_HTTP_ERROR_NET_CONNECT_ENODATA = 0x80710559, - CELL_HTTP_ERROR_NET_CONNECT_ENOSR = 0x8071055a, - CELL_HTTP_ERROR_NET_CONNECT_ENOSTR = 0x8071055b, - CELL_HTTP_ERROR_NET_CONNECT_ETIME = 0x8071055c, + CELL_HTTP_ERROR_NET_CONNECT_EOPNOTSUPP = 0x8071052d, + CELL_HTTP_ERROR_NET_CONNECT_EPFNOSUPPORT = 0x8071052e, + CELL_HTTP_ERROR_NET_CONNECT_EAFNOSUPPORT = 0x8071052f, + CELL_HTTP_ERROR_NET_CONNECT_EADDRINUSE = 0x80710530, + CELL_HTTP_ERROR_NET_CONNECT_EADDRNOTAVAIL = 0x80710531, + CELL_HTTP_ERROR_NET_CONNECT_ENETDOWN = 0x80710532, + CELL_HTTP_ERROR_NET_CONNECT_ENETUNREACH = 0x80710533, + CELL_HTTP_ERROR_NET_CONNECT_ENETRESET = 0x80710534, + CELL_HTTP_ERROR_NET_CONNECT_ECONNABORTED = 0x80710535, + CELL_HTTP_ERROR_NET_CONNECT_ECONNRESET = 0x80710536, + CELL_HTTP_ERROR_NET_CONNECT_ENOBUFS = 0x80710537, + CELL_HTTP_ERROR_NET_CONNECT_EISCONN = 0x80710538, + CELL_HTTP_ERROR_NET_CONNECT_ENOTCONN = 0x80710539, + CELL_HTTP_ERROR_NET_CONNECT_ESHUTDOWN = 0x8071053a, + CELL_HTTP_ERROR_NET_CONNECT_ETOOMANYREFS = 0x8071053b, + CELL_HTTP_ERROR_NET_CONNECT_ETIMEDOUT = 0x8071053c, + CELL_HTTP_ERROR_NET_CONNECT_ECONNREFUSED = 0x8071053d, + CELL_HTTP_ERROR_NET_CONNECT_ELOOP = 0x8071053e, + CELL_HTTP_ERROR_NET_CONNECT_ENAMETOOLONG = 0x8071053f, + CELL_HTTP_ERROR_NET_CONNECT_EHOSTDOWN = 0x80710540, + CELL_HTTP_ERROR_NET_CONNECT_EHOSTUNREACH = 0x80710541, + CELL_HTTP_ERROR_NET_CONNECT_ENOTEMPTY = 0x80710542, + CELL_HTTP_ERROR_NET_CONNECT_EPROCLIM = 0x80710543, + CELL_HTTP_ERROR_NET_CONNECT_EUSERS = 0x80710544, + CELL_HTTP_ERROR_NET_CONNECT_EDQUOT = 0x80710545, + CELL_HTTP_ERROR_NET_CONNECT_ESTALE = 0x80710546, + CELL_HTTP_ERROR_NET_CONNECT_EREMOTE = 0x80710547, + CELL_HTTP_ERROR_NET_CONNECT_EBADRPC = 0x80710548, + CELL_HTTP_ERROR_NET_CONNECT_ERPCMISMATCH = 0x80710549, + CELL_HTTP_ERROR_NET_CONNECT_EPROGUNAVAIL = 0x8071054a, + CELL_HTTP_ERROR_NET_CONNECT_EPROGMISMATCH = 0x8071054b, + CELL_HTTP_ERROR_NET_CONNECT_EPROCUNAVAIL = 0x8071054c, + CELL_HTTP_ERROR_NET_CONNECT_ENOLCK = 0x8071054d, + CELL_HTTP_ERROR_NET_CONNECT_ENOSYS = 0x8071054e, + CELL_HTTP_ERROR_NET_CONNECT_EFTYPE = 0x8071054f, + CELL_HTTP_ERROR_NET_CONNECT_EAUTH = 0x80710550, + CELL_HTTP_ERROR_NET_CONNECT_ENEEDAUTH = 0x80710551, + CELL_HTTP_ERROR_NET_CONNECT_EIDRM = 0x80710552, + CELL_HTTP_ERROR_NET_CONNECT_ENOMSG = 0x80710553, + CELL_HTTP_ERROR_NET_CONNECT_EOVERFLOW = 0x80710554, + CELL_HTTP_ERROR_NET_CONNECT_EILSEQ = 0x80710555, + CELL_HTTP_ERROR_NET_CONNECT_ENOTSUP = 0x80710556, + CELL_HTTP_ERROR_NET_CONNECT_ECANCELED = 0x80710557, + CELL_HTTP_ERROR_NET_CONNECT_EBADMSG = 0x80710558, + CELL_HTTP_ERROR_NET_CONNECT_ENODATA = 0x80710559, + CELL_HTTP_ERROR_NET_CONNECT_ENOSR = 0x8071055a, + CELL_HTTP_ERROR_NET_CONNECT_ENOSTR = 0x8071055b, + CELL_HTTP_ERROR_NET_CONNECT_ETIME = 0x8071055c, - CELL_HTTP_ERROR_NET_SEND_EPERM = 0x80710601, - CELL_HTTP_ERROR_NET_SEND_ENOENT = 0x80710602, - CELL_HTTP_ERROR_NET_SEND_ESRCH = 0x80710603, - CELL_HTTP_ERROR_NET_SEND_EINTR = 0x80710604, - CELL_HTTP_ERROR_NET_SEND_EIO = 0x80710605, - CELL_HTTP_ERROR_NET_SEND_ENXIO = 0x80710606, - CELL_HTTP_ERROR_NET_SEND_E2BIG = 0x80710607, - CELL_HTTP_ERROR_NET_SEND_ENOEXC = 0x80710608, - CELL_HTTP_ERROR_NET_SEND_EBADF = 0x80710609, - CELL_HTTP_ERROR_NET_SEND_ECHILD = 0x8071060a, - CELL_HTTP_ERROR_NET_SEND_EDEADLK = 0x8071060b, - CELL_HTTP_ERROR_NET_SEND_ENOMEM = 0x8071060c, - CELL_HTTP_ERROR_NET_SEND_EACCES = 0x8071060d, - CELL_HTTP_ERROR_NET_SEND_EFAULT = 0x8071060e, - CELL_HTTP_ERROR_NET_SEND_ENOTBLK = 0x8071060f, - CELL_HTTP_ERROR_NET_SEND_EBUSY = 0x80710610, - CELL_HTTP_ERROR_NET_SEND_EEXIST = 0x80710611, - CELL_HTTP_ERROR_NET_SEND_EXDEV = 0x80710612, - CELL_HTTP_ERROR_NET_SEND_ENODEV = 0x80710613, - CELL_HTTP_ERROR_NET_SEND_ENOTDIR = 0x80710614, - CELL_HTTP_ERROR_NET_SEND_EISDIR = 0x80710615, - CELL_HTTP_ERROR_NET_SEND_EINVAL = 0x80710616, - CELL_HTTP_ERROR_NET_SEND_ENFILE = 0x80710617, - CELL_HTTP_ERROR_NET_SEND_EMFILE = 0x80710618, - CELL_HTTP_ERROR_NET_SEND_ENOTTY = 0x80710619, - CELL_HTTP_ERROR_NET_SEND_ETXTBSY = 0x8071061a, - CELL_HTTP_ERROR_NET_SEND_EFBIG = 0x8071061b, - CELL_HTTP_ERROR_NET_SEND_ENOSPC = 0x8071061c, - CELL_HTTP_ERROR_NET_SEND_ESPIPE = 0x8071061d, - CELL_HTTP_ERROR_NET_SEND_EROFS = 0x8071061e, - CELL_HTTP_ERROR_NET_SEND_EMLINK = 0x8071061f, - CELL_HTTP_ERROR_NET_SEND_EPIPE = 0x80710620, - CELL_HTTP_ERROR_NET_SEND_EDOM = 0x80710621, - CELL_HTTP_ERROR_NET_SEND_ERANGE = 0x80710622, - CELL_HTTP_ERROR_NET_SEND_EAGAIN = 0x80710623, - CELL_HTTP_ERROR_NET_SEND_EWOULDBLOCK = 0x80710623, - CELL_HTTP_ERROR_NET_SEND_EINPROGRESS = 0x80710624, - CELL_HTTP_ERROR_NET_SEND_EALREADY = 0x80710625, - CELL_HTTP_ERROR_NET_SEND_ENOTSOCK = 0x80710626, - CELL_HTTP_ERROR_NET_SEND_EDESTADDRREQ = 0x80710627, - CELL_HTTP_ERROR_NET_SEND_EMSGSIZE = 0x80710628, - CELL_HTTP_ERROR_NET_SEND_EPROTOTYPE = 0x80710629, - CELL_HTTP_ERROR_NET_SEND_ENOPROTOOPT = 0x8071062a, + CELL_HTTP_ERROR_NET_SEND_EPERM = 0x80710601, + CELL_HTTP_ERROR_NET_SEND_ENOENT = 0x80710602, + CELL_HTTP_ERROR_NET_SEND_ESRCH = 0x80710603, + CELL_HTTP_ERROR_NET_SEND_EINTR = 0x80710604, + CELL_HTTP_ERROR_NET_SEND_EIO = 0x80710605, + CELL_HTTP_ERROR_NET_SEND_ENXIO = 0x80710606, + CELL_HTTP_ERROR_NET_SEND_E2BIG = 0x80710607, + CELL_HTTP_ERROR_NET_SEND_ENOEXC = 0x80710608, + CELL_HTTP_ERROR_NET_SEND_EBADF = 0x80710609, + CELL_HTTP_ERROR_NET_SEND_ECHILD = 0x8071060a, + CELL_HTTP_ERROR_NET_SEND_EDEADLK = 0x8071060b, + CELL_HTTP_ERROR_NET_SEND_ENOMEM = 0x8071060c, + CELL_HTTP_ERROR_NET_SEND_EACCES = 0x8071060d, + CELL_HTTP_ERROR_NET_SEND_EFAULT = 0x8071060e, + CELL_HTTP_ERROR_NET_SEND_ENOTBLK = 0x8071060f, + CELL_HTTP_ERROR_NET_SEND_EBUSY = 0x80710610, + CELL_HTTP_ERROR_NET_SEND_EEXIST = 0x80710611, + CELL_HTTP_ERROR_NET_SEND_EXDEV = 0x80710612, + CELL_HTTP_ERROR_NET_SEND_ENODEV = 0x80710613, + CELL_HTTP_ERROR_NET_SEND_ENOTDIR = 0x80710614, + CELL_HTTP_ERROR_NET_SEND_EISDIR = 0x80710615, + CELL_HTTP_ERROR_NET_SEND_EINVAL = 0x80710616, + CELL_HTTP_ERROR_NET_SEND_ENFILE = 0x80710617, + CELL_HTTP_ERROR_NET_SEND_EMFILE = 0x80710618, + CELL_HTTP_ERROR_NET_SEND_ENOTTY = 0x80710619, + CELL_HTTP_ERROR_NET_SEND_ETXTBSY = 0x8071061a, + CELL_HTTP_ERROR_NET_SEND_EFBIG = 0x8071061b, + CELL_HTTP_ERROR_NET_SEND_ENOSPC = 0x8071061c, + CELL_HTTP_ERROR_NET_SEND_ESPIPE = 0x8071061d, + CELL_HTTP_ERROR_NET_SEND_EROFS = 0x8071061e, + CELL_HTTP_ERROR_NET_SEND_EMLINK = 0x8071061f, + CELL_HTTP_ERROR_NET_SEND_EPIPE = 0x80710620, + CELL_HTTP_ERROR_NET_SEND_EDOM = 0x80710621, + CELL_HTTP_ERROR_NET_SEND_ERANGE = 0x80710622, + CELL_HTTP_ERROR_NET_SEND_EAGAIN = 0x80710623, + CELL_HTTP_ERROR_NET_SEND_EWOULDBLOCK = 0x80710623, + CELL_HTTP_ERROR_NET_SEND_EINPROGRESS = 0x80710624, + CELL_HTTP_ERROR_NET_SEND_EALREADY = 0x80710625, + CELL_HTTP_ERROR_NET_SEND_ENOTSOCK = 0x80710626, + CELL_HTTP_ERROR_NET_SEND_EDESTADDRREQ = 0x80710627, + CELL_HTTP_ERROR_NET_SEND_EMSGSIZE = 0x80710628, + CELL_HTTP_ERROR_NET_SEND_EPROTOTYPE = 0x80710629, + CELL_HTTP_ERROR_NET_SEND_ENOPROTOOPT = 0x8071062a, CELL_HTTP_ERROR_NET_SEND_EPROTONOSUPPORT = 0x8071062b, CELL_HTTP_ERROR_NET_SEND_ESOCKTNOSUPPORT = 0x8071062c, - CELL_HTTP_ERROR_NET_SEND_EOPNOTSUPP = 0x8071062d, - CELL_HTTP_ERROR_NET_SEND_EPFNOSUPPORT = 0x8071062e, - CELL_HTTP_ERROR_NET_SEND_EAFNOSUPPORT = 0x8071062f, - CELL_HTTP_ERROR_NET_SEND_EADDRINUSE = 0x80710630, - CELL_HTTP_ERROR_NET_SEND_EADDRNOTAVAIL = 0x80710631, - CELL_HTTP_ERROR_NET_SEND_ENETDOWN = 0x80710632, - CELL_HTTP_ERROR_NET_SEND_ENETUNREACH = 0x80710633, - CELL_HTTP_ERROR_NET_SEND_ENETRESET = 0x80710634, - CELL_HTTP_ERROR_NET_SEND_ECONNABORTED = 0x80710635, - CELL_HTTP_ERROR_NET_SEND_ECONNRESET = 0x80710636, - CELL_HTTP_ERROR_NET_SEND_ENOBUFS = 0x80710637, - CELL_HTTP_ERROR_NET_SEND_EISCONN = 0x80710638, - CELL_HTTP_ERROR_NET_SEND_ENOTCONN = 0x80710639, - CELL_HTTP_ERROR_NET_SEND_ESHUTDOWN = 0x8071063a, - CELL_HTTP_ERROR_NET_SEND_ETOOMANYREFS = 0x8071063b, - CELL_HTTP_ERROR_NET_SEND_ETIMEDOUT = 0x8071063c, - CELL_HTTP_ERROR_NET_SEND_ECONNREFUSED = 0x8071063d, - CELL_HTTP_ERROR_NET_SEND_ELOOP = 0x8071063e, - CELL_HTTP_ERROR_NET_SEND_ENAMETOOLONG = 0x8071063f, - CELL_HTTP_ERROR_NET_SEND_EHOSTDOWN = 0x80710640, - CELL_HTTP_ERROR_NET_SEND_EHOSTUNREACH = 0x80710641, - CELL_HTTP_ERROR_NET_SEND_ENOTEMPTY = 0x80710642, - CELL_HTTP_ERROR_NET_SEND_EPROCLIM = 0x80710643, - CELL_HTTP_ERROR_NET_SEND_EUSERS = 0x80710644, - CELL_HTTP_ERROR_NET_SEND_EDQUOT = 0x80710645, - CELL_HTTP_ERROR_NET_SEND_ESTALE = 0x80710646, - CELL_HTTP_ERROR_NET_SEND_EREMOTE = 0x80710647, - CELL_HTTP_ERROR_NET_SEND_EBADRPC = 0x80710648, - CELL_HTTP_ERROR_NET_SEND_ERPCMISMATCH = 0x80710649, - CELL_HTTP_ERROR_NET_SEND_EPROGUNAVAIL = 0x8071064a, - CELL_HTTP_ERROR_NET_SEND_EPROGMISMATCH = 0x8071064b, - CELL_HTTP_ERROR_NET_SEND_EPROCUNAVAIL = 0x8071064c, - CELL_HTTP_ERROR_NET_SEND_ENOLCK = 0x8071064d, - CELL_HTTP_ERROR_NET_SEND_ENOSYS = 0x8071064e, - CELL_HTTP_ERROR_NET_SEND_EFTYPE = 0x8071064f, - CELL_HTTP_ERROR_NET_SEND_EAUTH = 0x80710650, - CELL_HTTP_ERROR_NET_SEND_ENEEDAUTH = 0x80710651, - CELL_HTTP_ERROR_NET_SEND_EIDRM = 0x80710652, - CELL_HTTP_ERROR_NET_SEND_ENOMSG = 0x80710653, - CELL_HTTP_ERROR_NET_SEND_EOVERFLOW = 0x80710654, - CELL_HTTP_ERROR_NET_SEND_EILSEQ = 0x80710655, - CELL_HTTP_ERROR_NET_SEND_ENOTSUP = 0x80710656, - CELL_HTTP_ERROR_NET_SEND_ECANCELED = 0x80710657, - CELL_HTTP_ERROR_NET_SEND_EBADMSG = 0x80710658, - CELL_HTTP_ERROR_NET_SEND_ENODATA = 0x80710659, - CELL_HTTP_ERROR_NET_SEND_ENOSR = 0x8071065a, - CELL_HTTP_ERROR_NET_SEND_ENOSTR = 0x8071065b, - CELL_HTTP_ERROR_NET_SEND_ETIME = 0x8071065c, + CELL_HTTP_ERROR_NET_SEND_EOPNOTSUPP = 0x8071062d, + CELL_HTTP_ERROR_NET_SEND_EPFNOSUPPORT = 0x8071062e, + CELL_HTTP_ERROR_NET_SEND_EAFNOSUPPORT = 0x8071062f, + CELL_HTTP_ERROR_NET_SEND_EADDRINUSE = 0x80710630, + CELL_HTTP_ERROR_NET_SEND_EADDRNOTAVAIL = 0x80710631, + CELL_HTTP_ERROR_NET_SEND_ENETDOWN = 0x80710632, + CELL_HTTP_ERROR_NET_SEND_ENETUNREACH = 0x80710633, + CELL_HTTP_ERROR_NET_SEND_ENETRESET = 0x80710634, + CELL_HTTP_ERROR_NET_SEND_ECONNABORTED = 0x80710635, + CELL_HTTP_ERROR_NET_SEND_ECONNRESET = 0x80710636, + CELL_HTTP_ERROR_NET_SEND_ENOBUFS = 0x80710637, + CELL_HTTP_ERROR_NET_SEND_EISCONN = 0x80710638, + CELL_HTTP_ERROR_NET_SEND_ENOTCONN = 0x80710639, + CELL_HTTP_ERROR_NET_SEND_ESHUTDOWN = 0x8071063a, + CELL_HTTP_ERROR_NET_SEND_ETOOMANYREFS = 0x8071063b, + CELL_HTTP_ERROR_NET_SEND_ETIMEDOUT = 0x8071063c, + CELL_HTTP_ERROR_NET_SEND_ECONNREFUSED = 0x8071063d, + CELL_HTTP_ERROR_NET_SEND_ELOOP = 0x8071063e, + CELL_HTTP_ERROR_NET_SEND_ENAMETOOLONG = 0x8071063f, + CELL_HTTP_ERROR_NET_SEND_EHOSTDOWN = 0x80710640, + CELL_HTTP_ERROR_NET_SEND_EHOSTUNREACH = 0x80710641, + CELL_HTTP_ERROR_NET_SEND_ENOTEMPTY = 0x80710642, + CELL_HTTP_ERROR_NET_SEND_EPROCLIM = 0x80710643, + CELL_HTTP_ERROR_NET_SEND_EUSERS = 0x80710644, + CELL_HTTP_ERROR_NET_SEND_EDQUOT = 0x80710645, + CELL_HTTP_ERROR_NET_SEND_ESTALE = 0x80710646, + CELL_HTTP_ERROR_NET_SEND_EREMOTE = 0x80710647, + CELL_HTTP_ERROR_NET_SEND_EBADRPC = 0x80710648, + CELL_HTTP_ERROR_NET_SEND_ERPCMISMATCH = 0x80710649, + CELL_HTTP_ERROR_NET_SEND_EPROGUNAVAIL = 0x8071064a, + CELL_HTTP_ERROR_NET_SEND_EPROGMISMATCH = 0x8071064b, + CELL_HTTP_ERROR_NET_SEND_EPROCUNAVAIL = 0x8071064c, + CELL_HTTP_ERROR_NET_SEND_ENOLCK = 0x8071064d, + CELL_HTTP_ERROR_NET_SEND_ENOSYS = 0x8071064e, + CELL_HTTP_ERROR_NET_SEND_EFTYPE = 0x8071064f, + CELL_HTTP_ERROR_NET_SEND_EAUTH = 0x80710650, + CELL_HTTP_ERROR_NET_SEND_ENEEDAUTH = 0x80710651, + CELL_HTTP_ERROR_NET_SEND_EIDRM = 0x80710652, + CELL_HTTP_ERROR_NET_SEND_ENOMSG = 0x80710653, + CELL_HTTP_ERROR_NET_SEND_EOVERFLOW = 0x80710654, + CELL_HTTP_ERROR_NET_SEND_EILSEQ = 0x80710655, + CELL_HTTP_ERROR_NET_SEND_ENOTSUP = 0x80710656, + CELL_HTTP_ERROR_NET_SEND_ECANCELED = 0x80710657, + CELL_HTTP_ERROR_NET_SEND_EBADMSG = 0x80710658, + CELL_HTTP_ERROR_NET_SEND_ENODATA = 0x80710659, + CELL_HTTP_ERROR_NET_SEND_ENOSR = 0x8071065a, + CELL_HTTP_ERROR_NET_SEND_ENOSTR = 0x8071065b, + CELL_HTTP_ERROR_NET_SEND_ETIME = 0x8071065c, - CELL_HTTP_ERROR_NET_RECV_EPERM = 0x80710701, - CELL_HTTP_ERROR_NET_RECV_ENOENT = 0x80710702, - CELL_HTTP_ERROR_NET_RECV_ESRCH = 0x80710703, - CELL_HTTP_ERROR_NET_RECV_EINTR = 0x80710704, - CELL_HTTP_ERROR_NET_RECV_EIO = 0x80710705, - CELL_HTTP_ERROR_NET_RECV_ENXIO = 0x80710706, - CELL_HTTP_ERROR_NET_RECV_E2BIG = 0x80710707, - CELL_HTTP_ERROR_NET_RECV_ENOEXC = 0x80710708, - CELL_HTTP_ERROR_NET_RECV_EBADF = 0x80710709, - CELL_HTTP_ERROR_NET_RECV_ECHILD = 0x8071070a, - CELL_HTTP_ERROR_NET_RECV_EDEADLK = 0x8071070b, - CELL_HTTP_ERROR_NET_RECV_ENOMEM = 0x8071070c, - CELL_HTTP_ERROR_NET_RECV_EACCES = 0x8071070d, - CELL_HTTP_ERROR_NET_RECV_EFAULT = 0x8071070e, - CELL_HTTP_ERROR_NET_RECV_ENOTBLK = 0x8071070f, - CELL_HTTP_ERROR_NET_RECV_EBUSY = 0x80710710, - CELL_HTTP_ERROR_NET_RECV_EEXIST = 0x80710711, - CELL_HTTP_ERROR_NET_RECV_EXDEV = 0x80710712, - CELL_HTTP_ERROR_NET_RECV_ENODEV = 0x80710713, - CELL_HTTP_ERROR_NET_RECV_ENOTDIR = 0x80710714, - CELL_HTTP_ERROR_NET_RECV_EISDIR = 0x80710715, - CELL_HTTP_ERROR_NET_RECV_EINVAL = 0x80710716, - CELL_HTTP_ERROR_NET_RECV_ENFILE = 0x80710717, - CELL_HTTP_ERROR_NET_RECV_EMFILE = 0x80710718, - CELL_HTTP_ERROR_NET_RECV_ENOTTY = 0x80710719, - CELL_HTTP_ERROR_NET_RECV_ETXTBSY = 0x8071071a, - CELL_HTTP_ERROR_NET_RECV_EFBIG = 0x8071071b, - CELL_HTTP_ERROR_NET_RECV_ENOSPC = 0x8071071c, - CELL_HTTP_ERROR_NET_RECV_ESPIPE = 0x8071071d, - CELL_HTTP_ERROR_NET_RECV_EROFS = 0x8071071e, - CELL_HTTP_ERROR_NET_RECV_EMLINK = 0x8071071f, - CELL_HTTP_ERROR_NET_RECV_EPIPE = 0x80710720, - CELL_HTTP_ERROR_NET_RECV_EDOM = 0x80710721, - CELL_HTTP_ERROR_NET_RECV_ERANGE = 0x80710722, - CELL_HTTP_ERROR_NET_RECV_EAGAIN = 0x80710723, - CELL_HTTP_ERROR_NET_RECV_EWOULDBLOCK = 0x80710723, - CELL_HTTP_ERROR_NET_RECV_EINPROGRESS = 0x80710724, - CELL_HTTP_ERROR_NET_RECV_EALREADY = 0x80710725, - CELL_HTTP_ERROR_NET_RECV_ENOTSOCK = 0x80710726, - CELL_HTTP_ERROR_NET_RECV_EDESTADDRREQ = 0x80710727, - CELL_HTTP_ERROR_NET_RECV_EMSGSIZE = 0x80710728, - CELL_HTTP_ERROR_NET_RECV_EPROTOTYPE = 0x80710729, - CELL_HTTP_ERROR_NET_RECV_ENOPROTOOPT = 0x8071072a, + CELL_HTTP_ERROR_NET_RECV_EPERM = 0x80710701, + CELL_HTTP_ERROR_NET_RECV_ENOENT = 0x80710702, + CELL_HTTP_ERROR_NET_RECV_ESRCH = 0x80710703, + CELL_HTTP_ERROR_NET_RECV_EINTR = 0x80710704, + CELL_HTTP_ERROR_NET_RECV_EIO = 0x80710705, + CELL_HTTP_ERROR_NET_RECV_ENXIO = 0x80710706, + CELL_HTTP_ERROR_NET_RECV_E2BIG = 0x80710707, + CELL_HTTP_ERROR_NET_RECV_ENOEXC = 0x80710708, + CELL_HTTP_ERROR_NET_RECV_EBADF = 0x80710709, + CELL_HTTP_ERROR_NET_RECV_ECHILD = 0x8071070a, + CELL_HTTP_ERROR_NET_RECV_EDEADLK = 0x8071070b, + CELL_HTTP_ERROR_NET_RECV_ENOMEM = 0x8071070c, + CELL_HTTP_ERROR_NET_RECV_EACCES = 0x8071070d, + CELL_HTTP_ERROR_NET_RECV_EFAULT = 0x8071070e, + CELL_HTTP_ERROR_NET_RECV_ENOTBLK = 0x8071070f, + CELL_HTTP_ERROR_NET_RECV_EBUSY = 0x80710710, + CELL_HTTP_ERROR_NET_RECV_EEXIST = 0x80710711, + CELL_HTTP_ERROR_NET_RECV_EXDEV = 0x80710712, + CELL_HTTP_ERROR_NET_RECV_ENODEV = 0x80710713, + CELL_HTTP_ERROR_NET_RECV_ENOTDIR = 0x80710714, + CELL_HTTP_ERROR_NET_RECV_EISDIR = 0x80710715, + CELL_HTTP_ERROR_NET_RECV_EINVAL = 0x80710716, + CELL_HTTP_ERROR_NET_RECV_ENFILE = 0x80710717, + CELL_HTTP_ERROR_NET_RECV_EMFILE = 0x80710718, + CELL_HTTP_ERROR_NET_RECV_ENOTTY = 0x80710719, + CELL_HTTP_ERROR_NET_RECV_ETXTBSY = 0x8071071a, + CELL_HTTP_ERROR_NET_RECV_EFBIG = 0x8071071b, + CELL_HTTP_ERROR_NET_RECV_ENOSPC = 0x8071071c, + CELL_HTTP_ERROR_NET_RECV_ESPIPE = 0x8071071d, + CELL_HTTP_ERROR_NET_RECV_EROFS = 0x8071071e, + CELL_HTTP_ERROR_NET_RECV_EMLINK = 0x8071071f, + CELL_HTTP_ERROR_NET_RECV_EPIPE = 0x80710720, + CELL_HTTP_ERROR_NET_RECV_EDOM = 0x80710721, + CELL_HTTP_ERROR_NET_RECV_ERANGE = 0x80710722, + CELL_HTTP_ERROR_NET_RECV_EAGAIN = 0x80710723, + CELL_HTTP_ERROR_NET_RECV_EWOULDBLOCK = 0x80710723, + CELL_HTTP_ERROR_NET_RECV_EINPROGRESS = 0x80710724, + CELL_HTTP_ERROR_NET_RECV_EALREADY = 0x80710725, + CELL_HTTP_ERROR_NET_RECV_ENOTSOCK = 0x80710726, + CELL_HTTP_ERROR_NET_RECV_EDESTADDRREQ = 0x80710727, + CELL_HTTP_ERROR_NET_RECV_EMSGSIZE = 0x80710728, + CELL_HTTP_ERROR_NET_RECV_EPROTOTYPE = 0x80710729, + CELL_HTTP_ERROR_NET_RECV_ENOPROTOOPT = 0x8071072a, CELL_HTTP_ERROR_NET_RECV_EPROTONOSUPPORT = 0x8071072b, CELL_HTTP_ERROR_NET_RECV_ESOCKTNOSUPPORT = 0x8071072c, - CELL_HTTP_ERROR_NET_RECV_EOPNOTSUPP = 0x8071072d, - CELL_HTTP_ERROR_NET_RECV_EPFNOSUPPORT = 0x8071072e, - CELL_HTTP_ERROR_NET_RECV_EAFNOSUPPORT = 0x8071072f, - CELL_HTTP_ERROR_NET_RECV_EADDRINUSE = 0x80710730, - CELL_HTTP_ERROR_NET_RECV_EADDRNOTAVAIL = 0x80710731, - CELL_HTTP_ERROR_NET_RECV_ENETDOWN = 0x80710732, - CELL_HTTP_ERROR_NET_RECV_ENETUNREACH = 0x80710733, - CELL_HTTP_ERROR_NET_RECV_ENETRESET = 0x80710734, - CELL_HTTP_ERROR_NET_RECV_ECONNABORTED = 0x80710735, - CELL_HTTP_ERROR_NET_RECV_ECONNRESET = 0x80710736, - CELL_HTTP_ERROR_NET_RECV_ENOBUFS = 0x80710737, - CELL_HTTP_ERROR_NET_RECV_EISCONN = 0x80710738, - CELL_HTTP_ERROR_NET_RECV_ENOTCONN = 0x80710739, - CELL_HTTP_ERROR_NET_RECV_ESHUTDOWN = 0x8071073a, - CELL_HTTP_ERROR_NET_RECV_ETOOMANYREFS = 0x8071073b, - CELL_HTTP_ERROR_NET_RECV_ETIMEDOUT = 0x8071073c, - CELL_HTTP_ERROR_NET_RECV_ECONNREFUSED = 0x8071073d, - CELL_HTTP_ERROR_NET_RECV_ELOOP = 0x8071073e, - CELL_HTTP_ERROR_NET_RECV_ENAMETOOLONG = 0x8071073f, - CELL_HTTP_ERROR_NET_RECV_EHOSTDOWN = 0x80710740, - CELL_HTTP_ERROR_NET_RECV_EHOSTUNREACH = 0x80710741, - CELL_HTTP_ERROR_NET_RECV_ENOTEMPTY = 0x80710742, - CELL_HTTP_ERROR_NET_RECV_EPROCLIM = 0x80710743, - CELL_HTTP_ERROR_NET_RECV_EUSERS = 0x80710744, - CELL_HTTP_ERROR_NET_RECV_EDQUOT = 0x80710745, - CELL_HTTP_ERROR_NET_RECV_ESTALE = 0x80710746, - CELL_HTTP_ERROR_NET_RECV_EREMOTE = 0x80710747, - CELL_HTTP_ERROR_NET_RECV_EBADRPC = 0x80710748, - CELL_HTTP_ERROR_NET_RECV_ERPCMISMATCH = 0x80710749, - CELL_HTTP_ERROR_NET_RECV_EPROGUNAVAIL = 0x8071074a, - CELL_HTTP_ERROR_NET_RECV_EPROGMISMATCH = 0x8071074b, - CELL_HTTP_ERROR_NET_RECV_EPROCUNAVAIL = 0x8071074c, - CELL_HTTP_ERROR_NET_RECV_ENOLCK = 0x8071074d, - CELL_HTTP_ERROR_NET_RECV_ENOSYS = 0x8071074e, - CELL_HTTP_ERROR_NET_RECV_EFTYPE = 0x8071074f, - CELL_HTTP_ERROR_NET_RECV_EAUTH = 0x80710750, - CELL_HTTP_ERROR_NET_RECV_ENEEDAUTH = 0x80710751, - CELL_HTTP_ERROR_NET_RECV_EIDRM = 0x80710752, - CELL_HTTP_ERROR_NET_RECV_ENOMSG = 0x80710753, - CELL_HTTP_ERROR_NET_RECV_EOVERFLOW = 0x80710754, - CELL_HTTP_ERROR_NET_RECV_EILSEQ = 0x80710755, - CELL_HTTP_ERROR_NET_RECV_ENOTSUP = 0x80710756, - CELL_HTTP_ERROR_NET_RECV_ECANCELED = 0x80710757, - CELL_HTTP_ERROR_NET_RECV_EBADMSG = 0x80710758, - CELL_HTTP_ERROR_NET_RECV_ENODATA = 0x80710759, - CELL_HTTP_ERROR_NET_RECV_ENOSR = 0x8071075a, - CELL_HTTP_ERROR_NET_RECV_ENOSTR = 0x8071075b, - CELL_HTTP_ERROR_NET_RECV_ETIME = 0x8071075c, + CELL_HTTP_ERROR_NET_RECV_EOPNOTSUPP = 0x8071072d, + CELL_HTTP_ERROR_NET_RECV_EPFNOSUPPORT = 0x8071072e, + CELL_HTTP_ERROR_NET_RECV_EAFNOSUPPORT = 0x8071072f, + CELL_HTTP_ERROR_NET_RECV_EADDRINUSE = 0x80710730, + CELL_HTTP_ERROR_NET_RECV_EADDRNOTAVAIL = 0x80710731, + CELL_HTTP_ERROR_NET_RECV_ENETDOWN = 0x80710732, + CELL_HTTP_ERROR_NET_RECV_ENETUNREACH = 0x80710733, + CELL_HTTP_ERROR_NET_RECV_ENETRESET = 0x80710734, + CELL_HTTP_ERROR_NET_RECV_ECONNABORTED = 0x80710735, + CELL_HTTP_ERROR_NET_RECV_ECONNRESET = 0x80710736, + CELL_HTTP_ERROR_NET_RECV_ENOBUFS = 0x80710737, + CELL_HTTP_ERROR_NET_RECV_EISCONN = 0x80710738, + CELL_HTTP_ERROR_NET_RECV_ENOTCONN = 0x80710739, + CELL_HTTP_ERROR_NET_RECV_ESHUTDOWN = 0x8071073a, + CELL_HTTP_ERROR_NET_RECV_ETOOMANYREFS = 0x8071073b, + CELL_HTTP_ERROR_NET_RECV_ETIMEDOUT = 0x8071073c, + CELL_HTTP_ERROR_NET_RECV_ECONNREFUSED = 0x8071073d, + CELL_HTTP_ERROR_NET_RECV_ELOOP = 0x8071073e, + CELL_HTTP_ERROR_NET_RECV_ENAMETOOLONG = 0x8071073f, + CELL_HTTP_ERROR_NET_RECV_EHOSTDOWN = 0x80710740, + CELL_HTTP_ERROR_NET_RECV_EHOSTUNREACH = 0x80710741, + CELL_HTTP_ERROR_NET_RECV_ENOTEMPTY = 0x80710742, + CELL_HTTP_ERROR_NET_RECV_EPROCLIM = 0x80710743, + CELL_HTTP_ERROR_NET_RECV_EUSERS = 0x80710744, + CELL_HTTP_ERROR_NET_RECV_EDQUOT = 0x80710745, + CELL_HTTP_ERROR_NET_RECV_ESTALE = 0x80710746, + CELL_HTTP_ERROR_NET_RECV_EREMOTE = 0x80710747, + CELL_HTTP_ERROR_NET_RECV_EBADRPC = 0x80710748, + CELL_HTTP_ERROR_NET_RECV_ERPCMISMATCH = 0x80710749, + CELL_HTTP_ERROR_NET_RECV_EPROGUNAVAIL = 0x8071074a, + CELL_HTTP_ERROR_NET_RECV_EPROGMISMATCH = 0x8071074b, + CELL_HTTP_ERROR_NET_RECV_EPROCUNAVAIL = 0x8071074c, + CELL_HTTP_ERROR_NET_RECV_ENOLCK = 0x8071074d, + CELL_HTTP_ERROR_NET_RECV_ENOSYS = 0x8071074e, + CELL_HTTP_ERROR_NET_RECV_EFTYPE = 0x8071074f, + CELL_HTTP_ERROR_NET_RECV_EAUTH = 0x80710750, + CELL_HTTP_ERROR_NET_RECV_ENEEDAUTH = 0x80710751, + CELL_HTTP_ERROR_NET_RECV_EIDRM = 0x80710752, + CELL_HTTP_ERROR_NET_RECV_ENOMSG = 0x80710753, + CELL_HTTP_ERROR_NET_RECV_EOVERFLOW = 0x80710754, + CELL_HTTP_ERROR_NET_RECV_EILSEQ = 0x80710755, + CELL_HTTP_ERROR_NET_RECV_ENOTSUP = 0x80710756, + CELL_HTTP_ERROR_NET_RECV_ECANCELED = 0x80710757, + CELL_HTTP_ERROR_NET_RECV_EBADMSG = 0x80710758, + CELL_HTTP_ERROR_NET_RECV_ENODATA = 0x80710759, + CELL_HTTP_ERROR_NET_RECV_ENOSR = 0x8071075a, + CELL_HTTP_ERROR_NET_RECV_ENOSTR = 0x8071075b, + CELL_HTTP_ERROR_NET_RECV_ETIME = 0x8071075c, - CELL_HTTP_ERROR_NET_SELECT_EPERM = 0x80710801, - CELL_HTTP_ERROR_NET_SELECT_ENOENT = 0x80710802, - CELL_HTTP_ERROR_NET_SELECT_ESRCH = 0x80710803, - CELL_HTTP_ERROR_NET_SELECT_EINTR = 0x80710804, - CELL_HTTP_ERROR_NET_SELECT_EIO = 0x80710805, - CELL_HTTP_ERROR_NET_SELECT_ENXIO = 0x80710806, - CELL_HTTP_ERROR_NET_SELECT_E2BIG = 0x80710807, - CELL_HTTP_ERROR_NET_SELECT_ENOEXC = 0x80710808, - CELL_HTTP_ERROR_NET_SELECT_EBADF = 0x80710809, - CELL_HTTP_ERROR_NET_SELECT_ECHILD = 0x8071080a, - CELL_HTTP_ERROR_NET_SELECT_EDEADLK = 0x8071080b, - CELL_HTTP_ERROR_NET_SELECT_ENOMEM = 0x8071080c, - CELL_HTTP_ERROR_NET_SELECT_EACCES = 0x8071080d, - CELL_HTTP_ERROR_NET_SELECT_EFAULT = 0x8071080e, - CELL_HTTP_ERROR_NET_SELECT_ENOTBLK = 0x8071080f, - CELL_HTTP_ERROR_NET_SELECT_EBUSY = 0x80710810, - CELL_HTTP_ERROR_NET_SELECT_EEXIST = 0x80710811, - CELL_HTTP_ERROR_NET_SELECT_EXDEV = 0x80710812, - CELL_HTTP_ERROR_NET_SELECT_ENODEV = 0x80710813, - CELL_HTTP_ERROR_NET_SELECT_ENOTDIR = 0x80710814, - CELL_HTTP_ERROR_NET_SELECT_EISDIR = 0x80710815, - CELL_HTTP_ERROR_NET_SELECT_EINVAL = 0x80710816, - CELL_HTTP_ERROR_NET_SELECT_ENFILE = 0x80710817, - CELL_HTTP_ERROR_NET_SELECT_EMFILE = 0x80710818, - CELL_HTTP_ERROR_NET_SELECT_ENOTTY = 0x80710819, - CELL_HTTP_ERROR_NET_SELECT_ETXTBSY = 0x8071081a, - CELL_HTTP_ERROR_NET_SELECT_EFBIG = 0x8071081b, - CELL_HTTP_ERROR_NET_SELECT_ENOSPC = 0x8071081c, - CELL_HTTP_ERROR_NET_SELECT_ESPIPE = 0x8071081d, - CELL_HTTP_ERROR_NET_SELECT_EROFS = 0x8071081e, - CELL_HTTP_ERROR_NET_SELECT_EMLINK = 0x8071081f, - CELL_HTTP_ERROR_NET_SELECT_EPIPE = 0x80710820, - CELL_HTTP_ERROR_NET_SELECT_EDOM = 0x80710821, - CELL_HTTP_ERROR_NET_SELECT_ERANGE = 0x80710822, - CELL_HTTP_ERROR_NET_SELECT_EAGAIN = 0x80710823, - CELL_HTTP_ERROR_NET_SELECT_EWOULDBLOCK = 0x80710823, - CELL_HTTP_ERROR_NET_SELECT_EINPROGRESS = 0x80710824, - CELL_HTTP_ERROR_NET_SELECT_EALREADY = 0x80710825, - CELL_HTTP_ERROR_NET_SELECT_ENOTSOCK = 0x80710826, - CELL_HTTP_ERROR_NET_SELECT_EDESTADDRREQ = 0x80710827, - CELL_HTTP_ERROR_NET_SELECT_EMSGSIZE = 0x80710828, - CELL_HTTP_ERROR_NET_SELECT_EPROTOTYPE = 0x80710829, - CELL_HTTP_ERROR_NET_SELECT_ENOPROTOOPT = 0x8071082a, + CELL_HTTP_ERROR_NET_SELECT_EPERM = 0x80710801, + CELL_HTTP_ERROR_NET_SELECT_ENOENT = 0x80710802, + CELL_HTTP_ERROR_NET_SELECT_ESRCH = 0x80710803, + CELL_HTTP_ERROR_NET_SELECT_EINTR = 0x80710804, + CELL_HTTP_ERROR_NET_SELECT_EIO = 0x80710805, + CELL_HTTP_ERROR_NET_SELECT_ENXIO = 0x80710806, + CELL_HTTP_ERROR_NET_SELECT_E2BIG = 0x80710807, + CELL_HTTP_ERROR_NET_SELECT_ENOEXC = 0x80710808, + CELL_HTTP_ERROR_NET_SELECT_EBADF = 0x80710809, + CELL_HTTP_ERROR_NET_SELECT_ECHILD = 0x8071080a, + CELL_HTTP_ERROR_NET_SELECT_EDEADLK = 0x8071080b, + CELL_HTTP_ERROR_NET_SELECT_ENOMEM = 0x8071080c, + CELL_HTTP_ERROR_NET_SELECT_EACCES = 0x8071080d, + CELL_HTTP_ERROR_NET_SELECT_EFAULT = 0x8071080e, + CELL_HTTP_ERROR_NET_SELECT_ENOTBLK = 0x8071080f, + CELL_HTTP_ERROR_NET_SELECT_EBUSY = 0x80710810, + CELL_HTTP_ERROR_NET_SELECT_EEXIST = 0x80710811, + CELL_HTTP_ERROR_NET_SELECT_EXDEV = 0x80710812, + CELL_HTTP_ERROR_NET_SELECT_ENODEV = 0x80710813, + CELL_HTTP_ERROR_NET_SELECT_ENOTDIR = 0x80710814, + CELL_HTTP_ERROR_NET_SELECT_EISDIR = 0x80710815, + CELL_HTTP_ERROR_NET_SELECT_EINVAL = 0x80710816, + CELL_HTTP_ERROR_NET_SELECT_ENFILE = 0x80710817, + CELL_HTTP_ERROR_NET_SELECT_EMFILE = 0x80710818, + CELL_HTTP_ERROR_NET_SELECT_ENOTTY = 0x80710819, + CELL_HTTP_ERROR_NET_SELECT_ETXTBSY = 0x8071081a, + CELL_HTTP_ERROR_NET_SELECT_EFBIG = 0x8071081b, + CELL_HTTP_ERROR_NET_SELECT_ENOSPC = 0x8071081c, + CELL_HTTP_ERROR_NET_SELECT_ESPIPE = 0x8071081d, + CELL_HTTP_ERROR_NET_SELECT_EROFS = 0x8071081e, + CELL_HTTP_ERROR_NET_SELECT_EMLINK = 0x8071081f, + CELL_HTTP_ERROR_NET_SELECT_EPIPE = 0x80710820, + CELL_HTTP_ERROR_NET_SELECT_EDOM = 0x80710821, + CELL_HTTP_ERROR_NET_SELECT_ERANGE = 0x80710822, + CELL_HTTP_ERROR_NET_SELECT_EAGAIN = 0x80710823, + CELL_HTTP_ERROR_NET_SELECT_EWOULDBLOCK = 0x80710823, + CELL_HTTP_ERROR_NET_SELECT_EINPROGRESS = 0x80710824, + CELL_HTTP_ERROR_NET_SELECT_EALREADY = 0x80710825, + CELL_HTTP_ERROR_NET_SELECT_ENOTSOCK = 0x80710826, + CELL_HTTP_ERROR_NET_SELECT_EDESTADDRREQ = 0x80710827, + CELL_HTTP_ERROR_NET_SELECT_EMSGSIZE = 0x80710828, + CELL_HTTP_ERROR_NET_SELECT_EPROTOTYPE = 0x80710829, + CELL_HTTP_ERROR_NET_SELECT_ENOPROTOOPT = 0x8071082a, CELL_HTTP_ERROR_NET_SELECT_EPROTONOSUPPORT = 0x8071082b, CELL_HTTP_ERROR_NET_SELECT_ESOCKTNOSUPPORT = 0x8071082c, - CELL_HTTP_ERROR_NET_SELECT_EOPNOTSUPP = 0x8071082d, - CELL_HTTP_ERROR_NET_SELECT_EPFNOSUPPORT = 0x8071082e, - CELL_HTTP_ERROR_NET_SELECT_EAFNOSUPPORT = 0x8071082f, - CELL_HTTP_ERROR_NET_SELECT_EADDRINUSE = 0x80710830, - CELL_HTTP_ERROR_NET_SELECT_EADDRNOTAVAIL = 0x80710831, - CELL_HTTP_ERROR_NET_SELECT_ENETDOWN = 0x80710832, - CELL_HTTP_ERROR_NET_SELECT_ENETUNREACH = 0x80710833, - CELL_HTTP_ERROR_NET_SELECT_ENETRESET = 0x80710834, - CELL_HTTP_ERROR_NET_SELECT_ECONNABORTED = 0x80710835, - CELL_HTTP_ERROR_NET_SELECT_ECONNRESET = 0x80710836, - CELL_HTTP_ERROR_NET_SELECT_ENOBUFS = 0x80710837, - CELL_HTTP_ERROR_NET_SELECT_EISCONN = 0x80710838, - CELL_HTTP_ERROR_NET_SELECT_ENOTCONN = 0x80710839, - CELL_HTTP_ERROR_NET_SELECT_ESHUTDOWN = 0x8071083a, - CELL_HTTP_ERROR_NET_SELECT_ETOOMANYREFS = 0x8071083b, - CELL_HTTP_ERROR_NET_SELECT_ETIMEDOUT = 0x8071083c, - CELL_HTTP_ERROR_NET_SELECT_ECONNREFUSED = 0x8071083d, - CELL_HTTP_ERROR_NET_SELECT_ELOOP = 0x8071083e, - CELL_HTTP_ERROR_NET_SELECT_ENAMETOOLONG = 0x8071083f, - CELL_HTTP_ERROR_NET_SELECT_EHOSTDOWN = 0x80710840, - CELL_HTTP_ERROR_NET_SELECT_EHOSTUNREACH = 0x80710841, - CELL_HTTP_ERROR_NET_SELECT_ENOTEMPTY = 0x80710842, - CELL_HTTP_ERROR_NET_SELECT_EPROCLIM = 0x80710843, - CELL_HTTP_ERROR_NET_SELECT_EUSERS = 0x80710844, - CELL_HTTP_ERROR_NET_SELECT_EDQUOT = 0x80710845, - CELL_HTTP_ERROR_NET_SELECT_ESTALE = 0x80710846, - CELL_HTTP_ERROR_NET_SELECT_EREMOTE = 0x80710847, - CELL_HTTP_ERROR_NET_SELECT_EBADRPC = 0x80710848, - CELL_HTTP_ERROR_NET_SELECT_ERPCMISMATCH = 0x80710849, - CELL_HTTP_ERROR_NET_SELECT_EPROGUNAVAIL = 0x8071084a, - CELL_HTTP_ERROR_NET_SELECT_EPROGMISMATCH = 0x8071084b, - CELL_HTTP_ERROR_NET_SELECT_EPROCUNAVAIL = 0x8071084c, - CELL_HTTP_ERROR_NET_SELECT_ENOLCK = 0x8071084d, - CELL_HTTP_ERROR_NET_SELECT_ENOSYS = 0x8071084e, - CELL_HTTP_ERROR_NET_SELECT_EFTYPE = 0x8071084f, - CELL_HTTP_ERROR_NET_SELECT_EAUTH = 0x80710850, - CELL_HTTP_ERROR_NET_SELECT_ENEEDAUTH = 0x80710851, - CELL_HTTP_ERROR_NET_SELECT_EIDRM = 0x80710852, - CELL_HTTP_ERROR_NET_SELECT_ENOMSG = 0x80710853, - CELL_HTTP_ERROR_NET_SELECT_EOVERFLOW = 0x80710854, - CELL_HTTP_ERROR_NET_SELECT_EILSEQ = 0x80710855, - CELL_HTTP_ERROR_NET_SELECT_ENOTSUP = 0x80710856, - CELL_HTTP_ERROR_NET_SELECT_ECANCELED = 0x80710857, - CELL_HTTP_ERROR_NET_SELECT_EBADMSG = 0x80710858, - CELL_HTTP_ERROR_NET_SELECT_ENODATA = 0x80710859, - CELL_HTTP_ERROR_NET_SELECT_ENOSR = 0x8071085a, - CELL_HTTP_ERROR_NET_SELECT_ENOSTR = 0x8071085b, - CELL_HTTP_ERROR_NET_SELECT_ETIME = 0x8071085c, + CELL_HTTP_ERROR_NET_SELECT_EOPNOTSUPP = 0x8071082d, + CELL_HTTP_ERROR_NET_SELECT_EPFNOSUPPORT = 0x8071082e, + CELL_HTTP_ERROR_NET_SELECT_EAFNOSUPPORT = 0x8071082f, + CELL_HTTP_ERROR_NET_SELECT_EADDRINUSE = 0x80710830, + CELL_HTTP_ERROR_NET_SELECT_EADDRNOTAVAIL = 0x80710831, + CELL_HTTP_ERROR_NET_SELECT_ENETDOWN = 0x80710832, + CELL_HTTP_ERROR_NET_SELECT_ENETUNREACH = 0x80710833, + CELL_HTTP_ERROR_NET_SELECT_ENETRESET = 0x80710834, + CELL_HTTP_ERROR_NET_SELECT_ECONNABORTED = 0x80710835, + CELL_HTTP_ERROR_NET_SELECT_ECONNRESET = 0x80710836, + CELL_HTTP_ERROR_NET_SELECT_ENOBUFS = 0x80710837, + CELL_HTTP_ERROR_NET_SELECT_EISCONN = 0x80710838, + CELL_HTTP_ERROR_NET_SELECT_ENOTCONN = 0x80710839, + CELL_HTTP_ERROR_NET_SELECT_ESHUTDOWN = 0x8071083a, + CELL_HTTP_ERROR_NET_SELECT_ETOOMANYREFS = 0x8071083b, + CELL_HTTP_ERROR_NET_SELECT_ETIMEDOUT = 0x8071083c, + CELL_HTTP_ERROR_NET_SELECT_ECONNREFUSED = 0x8071083d, + CELL_HTTP_ERROR_NET_SELECT_ELOOP = 0x8071083e, + CELL_HTTP_ERROR_NET_SELECT_ENAMETOOLONG = 0x8071083f, + CELL_HTTP_ERROR_NET_SELECT_EHOSTDOWN = 0x80710840, + CELL_HTTP_ERROR_NET_SELECT_EHOSTUNREACH = 0x80710841, + CELL_HTTP_ERROR_NET_SELECT_ENOTEMPTY = 0x80710842, + CELL_HTTP_ERROR_NET_SELECT_EPROCLIM = 0x80710843, + CELL_HTTP_ERROR_NET_SELECT_EUSERS = 0x80710844, + CELL_HTTP_ERROR_NET_SELECT_EDQUOT = 0x80710845, + CELL_HTTP_ERROR_NET_SELECT_ESTALE = 0x80710846, + CELL_HTTP_ERROR_NET_SELECT_EREMOTE = 0x80710847, + CELL_HTTP_ERROR_NET_SELECT_EBADRPC = 0x80710848, + CELL_HTTP_ERROR_NET_SELECT_ERPCMISMATCH = 0x80710849, + CELL_HTTP_ERROR_NET_SELECT_EPROGUNAVAIL = 0x8071084a, + CELL_HTTP_ERROR_NET_SELECT_EPROGMISMATCH = 0x8071084b, + CELL_HTTP_ERROR_NET_SELECT_EPROCUNAVAIL = 0x8071084c, + CELL_HTTP_ERROR_NET_SELECT_ENOLCK = 0x8071084d, + CELL_HTTP_ERROR_NET_SELECT_ENOSYS = 0x8071084e, + CELL_HTTP_ERROR_NET_SELECT_EFTYPE = 0x8071084f, + CELL_HTTP_ERROR_NET_SELECT_EAUTH = 0x80710850, + CELL_HTTP_ERROR_NET_SELECT_ENEEDAUTH = 0x80710851, + CELL_HTTP_ERROR_NET_SELECT_EIDRM = 0x80710852, + CELL_HTTP_ERROR_NET_SELECT_ENOMSG = 0x80710853, + CELL_HTTP_ERROR_NET_SELECT_EOVERFLOW = 0x80710854, + CELL_HTTP_ERROR_NET_SELECT_EILSEQ = 0x80710855, + CELL_HTTP_ERROR_NET_SELECT_ENOTSUP = 0x80710856, + CELL_HTTP_ERROR_NET_SELECT_ECANCELED = 0x80710857, + CELL_HTTP_ERROR_NET_SELECT_EBADMSG = 0x80710858, + CELL_HTTP_ERROR_NET_SELECT_ENODATA = 0x80710859, + CELL_HTTP_ERROR_NET_SELECT_ENOSR = 0x8071085a, + CELL_HTTP_ERROR_NET_SELECT_ENOSTR = 0x8071085b, + CELL_HTTP_ERROR_NET_SELECT_ETIME = 0x8071085c, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EPERM = 0x80710b01, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOENT = 0x80710b02, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ESRCH = 0x80710b03, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EINTR = 0x80710b04, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EIO = 0x80710b05, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENXIO = 0x80710b06, - CELL_HTTP_ERROR_NET_SSL_CONNECT_E2BIG = 0x80710b07, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOEXC = 0x80710b08, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EBADF = 0x80710b09, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ECHILD = 0x80710b0a, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EDEADLK = 0x80710b0b, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOMEM = 0x80710b0c, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EACCES = 0x80710b0d, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EFAULT = 0x80710b0e, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTBLK = 0x80710b0f, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EBUSY = 0x80710b10, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EEXIST = 0x80710b11, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EXDEV = 0x80710b12, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENODEV = 0x80710b13, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTDIR = 0x80710b14, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EISDIR = 0x80710b15, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EINVAL = 0x80710b16, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENFILE = 0x80710b17, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EMFILE = 0x80710b18, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTTY = 0x80710b19, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ETXTBSY = 0x80710b1a, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EFBIG = 0x80710b1b, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSPC = 0x80710b1c, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ESPIPE = 0x80710b1d, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EROFS = 0x80710b1e, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EMLINK = 0x80710b1f, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EPIPE = 0x80710b20, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EDOM = 0x80710b21, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ERANGE = 0x80710b22, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EAGAIN = 0x80710b23, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EWOULDBLOCK = 0x80710b23, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EINPROGRESS = 0x80710b24, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EALREADY = 0x80710b25, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTSOCK = 0x80710b26, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EDESTADDRREQ = 0x80710b27, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EMSGSIZE = 0x80710b28, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROTOTYPE = 0x80710b29, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOPROTOOPT = 0x80710b2a, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EPERM = 0x80710b01, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOENT = 0x80710b02, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ESRCH = 0x80710b03, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EINTR = 0x80710b04, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EIO = 0x80710b05, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENXIO = 0x80710b06, + CELL_HTTP_ERROR_NET_SSL_CONNECT_E2BIG = 0x80710b07, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOEXC = 0x80710b08, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EBADF = 0x80710b09, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ECHILD = 0x80710b0a, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EDEADLK = 0x80710b0b, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOMEM = 0x80710b0c, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EACCES = 0x80710b0d, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EFAULT = 0x80710b0e, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTBLK = 0x80710b0f, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EBUSY = 0x80710b10, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EEXIST = 0x80710b11, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EXDEV = 0x80710b12, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENODEV = 0x80710b13, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTDIR = 0x80710b14, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EISDIR = 0x80710b15, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EINVAL = 0x80710b16, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENFILE = 0x80710b17, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EMFILE = 0x80710b18, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTTY = 0x80710b19, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ETXTBSY = 0x80710b1a, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EFBIG = 0x80710b1b, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSPC = 0x80710b1c, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ESPIPE = 0x80710b1d, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EROFS = 0x80710b1e, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EMLINK = 0x80710b1f, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EPIPE = 0x80710b20, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EDOM = 0x80710b21, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ERANGE = 0x80710b22, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EAGAIN = 0x80710b23, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EWOULDBLOCK = 0x80710b23, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EINPROGRESS = 0x80710b24, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EALREADY = 0x80710b25, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTSOCK = 0x80710b26, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EDESTADDRREQ = 0x80710b27, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EMSGSIZE = 0x80710b28, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROTOTYPE = 0x80710b29, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOPROTOOPT = 0x80710b2a, CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROTONOSUPPORT = 0x80710b2b, CELL_HTTP_ERROR_NET_SSL_CONNECT_ESOCKTNOSUPPORT = 0x80710b2c, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EOPNOTSUPP = 0x80710b2d, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EPFNOSUPPORT = 0x80710b2e, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EAFNOSUPPORT = 0x80710b2f, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EADDRINUSE = 0x80710b30, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EADDRNOTAVAIL = 0x80710b31, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENETDOWN = 0x80710b32, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENETUNREACH = 0x80710b33, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENETRESET = 0x80710b34, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ECONNABORTED = 0x80710b35, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ECONNRESET = 0x80710b36, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOBUFS = 0x80710b37, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EISCONN = 0x80710b38, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTCONN = 0x80710b39, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ESHUTDOWN = 0x80710b3a, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ETOOMANYREFS = 0x80710b3b, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ETIMEDOUT = 0x80710b3c, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ECONNREFUSED = 0x80710b3d, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ELOOP = 0x80710b3e, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENAMETOOLONG = 0x80710b3f, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EHOSTDOWN = 0x80710b40, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EHOSTUNREACH = 0x80710b41, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTEMPTY = 0x80710b42, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROCLIM = 0x80710b43, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EUSERS = 0x80710b44, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EDQUOT = 0x80710b45, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ESTALE = 0x80710b46, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EREMOTE = 0x80710b47, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EBADRPC = 0x80710b48, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ERPCMISMATCH = 0x80710b49, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROGUNAVAIL = 0x80710b4a, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROGMISMATCH = 0x80710b4b, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROCUNAVAIL = 0x80710b4c, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOLCK = 0x80710b4d, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSYS = 0x80710b4e, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EFTYPE = 0x80710b4f, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EAUTH = 0x80710b50, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENEEDAUTH = 0x80710b51, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EIDRM = 0x80710b52, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOMSG = 0x80710b53, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EOVERFLOW = 0x80710b54, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EILSEQ = 0x80710b55, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTSUP = 0x80710b56, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ECANCELED = 0x80710b57, - CELL_HTTP_ERROR_NET_SSL_CONNECT_EBADMSG = 0x80710b58, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENODATA = 0x80710b59, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSR = 0x80710b5a, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSTR = 0x80710b5b, - CELL_HTTP_ERROR_NET_SSL_CONNECT_ETIME = 0x80710b5c, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EOPNOTSUPP = 0x80710b2d, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EPFNOSUPPORT = 0x80710b2e, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EAFNOSUPPORT = 0x80710b2f, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EADDRINUSE = 0x80710b30, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EADDRNOTAVAIL = 0x80710b31, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENETDOWN = 0x80710b32, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENETUNREACH = 0x80710b33, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENETRESET = 0x80710b34, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ECONNABORTED = 0x80710b35, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ECONNRESET = 0x80710b36, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOBUFS = 0x80710b37, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EISCONN = 0x80710b38, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTCONN = 0x80710b39, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ESHUTDOWN = 0x80710b3a, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ETOOMANYREFS = 0x80710b3b, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ETIMEDOUT = 0x80710b3c, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ECONNREFUSED = 0x80710b3d, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ELOOP = 0x80710b3e, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENAMETOOLONG = 0x80710b3f, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EHOSTDOWN = 0x80710b40, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EHOSTUNREACH = 0x80710b41, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTEMPTY = 0x80710b42, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROCLIM = 0x80710b43, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EUSERS = 0x80710b44, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EDQUOT = 0x80710b45, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ESTALE = 0x80710b46, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EREMOTE = 0x80710b47, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EBADRPC = 0x80710b48, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ERPCMISMATCH = 0x80710b49, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROGUNAVAIL = 0x80710b4a, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROGMISMATCH = 0x80710b4b, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EPROCUNAVAIL = 0x80710b4c, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOLCK = 0x80710b4d, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSYS = 0x80710b4e, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EFTYPE = 0x80710b4f, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EAUTH = 0x80710b50, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENEEDAUTH = 0x80710b51, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EIDRM = 0x80710b52, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOMSG = 0x80710b53, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EOVERFLOW = 0x80710b54, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EILSEQ = 0x80710b55, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOTSUP = 0x80710b56, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ECANCELED = 0x80710b57, + CELL_HTTP_ERROR_NET_SSL_CONNECT_EBADMSG = 0x80710b58, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENODATA = 0x80710b59, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSR = 0x80710b5a, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ENOSTR = 0x80710b5b, + CELL_HTTP_ERROR_NET_SSL_CONNECT_ETIME = 0x80710b5c, - CELL_HTTP_ERROR_NET_SSL_SEND_EPERM = 0x80710c01, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOENT = 0x80710c02, - CELL_HTTP_ERROR_NET_SSL_SEND_ESRCH = 0x80710c03, - CELL_HTTP_ERROR_NET_SSL_SEND_EINTR = 0x80710c04, - CELL_HTTP_ERROR_NET_SSL_SEND_EIO = 0x80710c05, - CELL_HTTP_ERROR_NET_SSL_SEND_ENXIO = 0x80710c06, - CELL_HTTP_ERROR_NET_SSL_SEND_E2BIG = 0x80710c07, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOEXC = 0x80710c08, - CELL_HTTP_ERROR_NET_SSL_SEND_EBADF = 0x80710c09, - CELL_HTTP_ERROR_NET_SSL_SEND_ECHILD = 0x80710c0a, - CELL_HTTP_ERROR_NET_SSL_SEND_EDEADLK = 0x80710c0b, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOMEM = 0x80710c0c, - CELL_HTTP_ERROR_NET_SSL_SEND_EACCES = 0x80710c0d, - CELL_HTTP_ERROR_NET_SSL_SEND_EFAULT = 0x80710c0e, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOTBLK = 0x80710c0f, - CELL_HTTP_ERROR_NET_SSL_SEND_EBUSY = 0x80710c10, - CELL_HTTP_ERROR_NET_SSL_SEND_EEXIST = 0x80710c11, - CELL_HTTP_ERROR_NET_SSL_SEND_EXDEV = 0x80710c12, - CELL_HTTP_ERROR_NET_SSL_SEND_ENODEV = 0x80710c13, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOTDIR = 0x80710c14, - CELL_HTTP_ERROR_NET_SSL_SEND_EISDIR = 0x80710c15, - CELL_HTTP_ERROR_NET_SSL_SEND_EINVAL = 0x80710c16, - CELL_HTTP_ERROR_NET_SSL_SEND_ENFILE = 0x80710c17, - CELL_HTTP_ERROR_NET_SSL_SEND_EMFILE = 0x80710c18, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOTTY = 0x80710c19, - CELL_HTTP_ERROR_NET_SSL_SEND_ETXTBSY = 0x80710c1a, - CELL_HTTP_ERROR_NET_SSL_SEND_EFBIG = 0x80710c1b, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOSPC = 0x80710c1c, - CELL_HTTP_ERROR_NET_SSL_SEND_ESPIPE = 0x80710c1d, - CELL_HTTP_ERROR_NET_SSL_SEND_EROFS = 0x80710c1e, - CELL_HTTP_ERROR_NET_SSL_SEND_EMLINK = 0x80710c1f, - CELL_HTTP_ERROR_NET_SSL_SEND_EPIPE = 0x80710c20, - CELL_HTTP_ERROR_NET_SSL_SEND_EDOM = 0x80710c21, - CELL_HTTP_ERROR_NET_SSL_SEND_ERANGE = 0x80710c22, - CELL_HTTP_ERROR_NET_SSL_SEND_EAGAIN = 0x80710c23, - CELL_HTTP_ERROR_NET_SSL_SEND_EWOULDBLOCK = 0x80710c23, - CELL_HTTP_ERROR_NET_SSL_SEND_EINPROGRESS = 0x80710c24, - CELL_HTTP_ERROR_NET_SSL_SEND_EALREADY = 0x80710c25, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOTSOCK = 0x80710c26, - CELL_HTTP_ERROR_NET_SSL_SEND_EDESTADDRREQ = 0x80710c27, - CELL_HTTP_ERROR_NET_SSL_SEND_EMSGSIZE = 0x80710c28, - CELL_HTTP_ERROR_NET_SSL_SEND_EPROTOTYPE = 0x80710c29, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOPROTOOPT = 0x80710c2a, + CELL_HTTP_ERROR_NET_SSL_SEND_EPERM = 0x80710c01, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOENT = 0x80710c02, + CELL_HTTP_ERROR_NET_SSL_SEND_ESRCH = 0x80710c03, + CELL_HTTP_ERROR_NET_SSL_SEND_EINTR = 0x80710c04, + CELL_HTTP_ERROR_NET_SSL_SEND_EIO = 0x80710c05, + CELL_HTTP_ERROR_NET_SSL_SEND_ENXIO = 0x80710c06, + CELL_HTTP_ERROR_NET_SSL_SEND_E2BIG = 0x80710c07, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOEXC = 0x80710c08, + CELL_HTTP_ERROR_NET_SSL_SEND_EBADF = 0x80710c09, + CELL_HTTP_ERROR_NET_SSL_SEND_ECHILD = 0x80710c0a, + CELL_HTTP_ERROR_NET_SSL_SEND_EDEADLK = 0x80710c0b, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOMEM = 0x80710c0c, + CELL_HTTP_ERROR_NET_SSL_SEND_EACCES = 0x80710c0d, + CELL_HTTP_ERROR_NET_SSL_SEND_EFAULT = 0x80710c0e, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOTBLK = 0x80710c0f, + CELL_HTTP_ERROR_NET_SSL_SEND_EBUSY = 0x80710c10, + CELL_HTTP_ERROR_NET_SSL_SEND_EEXIST = 0x80710c11, + CELL_HTTP_ERROR_NET_SSL_SEND_EXDEV = 0x80710c12, + CELL_HTTP_ERROR_NET_SSL_SEND_ENODEV = 0x80710c13, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOTDIR = 0x80710c14, + CELL_HTTP_ERROR_NET_SSL_SEND_EISDIR = 0x80710c15, + CELL_HTTP_ERROR_NET_SSL_SEND_EINVAL = 0x80710c16, + CELL_HTTP_ERROR_NET_SSL_SEND_ENFILE = 0x80710c17, + CELL_HTTP_ERROR_NET_SSL_SEND_EMFILE = 0x80710c18, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOTTY = 0x80710c19, + CELL_HTTP_ERROR_NET_SSL_SEND_ETXTBSY = 0x80710c1a, + CELL_HTTP_ERROR_NET_SSL_SEND_EFBIG = 0x80710c1b, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOSPC = 0x80710c1c, + CELL_HTTP_ERROR_NET_SSL_SEND_ESPIPE = 0x80710c1d, + CELL_HTTP_ERROR_NET_SSL_SEND_EROFS = 0x80710c1e, + CELL_HTTP_ERROR_NET_SSL_SEND_EMLINK = 0x80710c1f, + CELL_HTTP_ERROR_NET_SSL_SEND_EPIPE = 0x80710c20, + CELL_HTTP_ERROR_NET_SSL_SEND_EDOM = 0x80710c21, + CELL_HTTP_ERROR_NET_SSL_SEND_ERANGE = 0x80710c22, + CELL_HTTP_ERROR_NET_SSL_SEND_EAGAIN = 0x80710c23, + CELL_HTTP_ERROR_NET_SSL_SEND_EWOULDBLOCK = 0x80710c23, + CELL_HTTP_ERROR_NET_SSL_SEND_EINPROGRESS = 0x80710c24, + CELL_HTTP_ERROR_NET_SSL_SEND_EALREADY = 0x80710c25, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOTSOCK = 0x80710c26, + CELL_HTTP_ERROR_NET_SSL_SEND_EDESTADDRREQ = 0x80710c27, + CELL_HTTP_ERROR_NET_SSL_SEND_EMSGSIZE = 0x80710c28, + CELL_HTTP_ERROR_NET_SSL_SEND_EPROTOTYPE = 0x80710c29, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOPROTOOPT = 0x80710c2a, CELL_HTTP_ERROR_NET_SSL_SEND_EPROTONOSUPPORT = 0x80710c2b, CELL_HTTP_ERROR_NET_SSL_SEND_ESOCKTNOSUPPORT = 0x80710c2c, - CELL_HTTP_ERROR_NET_SSL_SEND_EOPNOTSUPP = 0x80710c2d, - CELL_HTTP_ERROR_NET_SSL_SEND_EPFNOSUPPORT = 0x80710c2e, - CELL_HTTP_ERROR_NET_SSL_SEND_EAFNOSUPPORT = 0x80710c2f, - CELL_HTTP_ERROR_NET_SSL_SEND_EADDRINUSE = 0x80710c30, - CELL_HTTP_ERROR_NET_SSL_SEND_EADDRNOTAVAIL = 0x80710c31, - CELL_HTTP_ERROR_NET_SSL_SEND_ENETDOWN = 0x80710c32, - CELL_HTTP_ERROR_NET_SSL_SEND_ENETUNREACH = 0x80710c33, - CELL_HTTP_ERROR_NET_SSL_SEND_ENETRESET = 0x80710c34, - CELL_HTTP_ERROR_NET_SSL_SEND_ECONNABORTED = 0x80710c35, - CELL_HTTP_ERROR_NET_SSL_SEND_ECONNRESET = 0x80710c36, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOBUFS = 0x80710c37, - CELL_HTTP_ERROR_NET_SSL_SEND_EISCONN = 0x80710c38, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOTCONN = 0x80710c39, - CELL_HTTP_ERROR_NET_SSL_SEND_ESHUTDOWN = 0x80710c3a, - CELL_HTTP_ERROR_NET_SSL_SEND_ETOOMANYREFS = 0x80710c3b, - CELL_HTTP_ERROR_NET_SSL_SEND_ETIMEDOUT = 0x80710c3c, - CELL_HTTP_ERROR_NET_SSL_SEND_ECONNREFUSED = 0x80710c3d, - CELL_HTTP_ERROR_NET_SSL_SEND_ELOOP = 0x80710c3e, - CELL_HTTP_ERROR_NET_SSL_SEND_ENAMETOOLONG = 0x80710c3f, - CELL_HTTP_ERROR_NET_SSL_SEND_EHOSTDOWN = 0x80710c40, - CELL_HTTP_ERROR_NET_SSL_SEND_EHOSTUNREACH = 0x80710c41, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOTEMPTY = 0x80710c42, - CELL_HTTP_ERROR_NET_SSL_SEND_EPROCLIM = 0x80710c43, - CELL_HTTP_ERROR_NET_SSL_SEND_EUSERS = 0x80710c44, - CELL_HTTP_ERROR_NET_SSL_SEND_EDQUOT = 0x80710c45, - CELL_HTTP_ERROR_NET_SSL_SEND_ESTALE = 0x80710c46, - CELL_HTTP_ERROR_NET_SSL_SEND_EREMOTE = 0x80710c47, - CELL_HTTP_ERROR_NET_SSL_SEND_EBADRPC = 0x80710c48, - CELL_HTTP_ERROR_NET_SSL_SEND_ERPCMISMATCH = 0x80710c49, - CELL_HTTP_ERROR_NET_SSL_SEND_EPROGUNAVAIL = 0x80710c4a, - CELL_HTTP_ERROR_NET_SSL_SEND_EPROGMISMATCH = 0x80710c4b, - CELL_HTTP_ERROR_NET_SSL_SEND_EPROCUNAVAIL = 0x80710c4c, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOLCK = 0x80710c4d, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOSYS = 0x80710c4e, - CELL_HTTP_ERROR_NET_SSL_SEND_EFTYPE = 0x80710c4f, - CELL_HTTP_ERROR_NET_SSL_SEND_EAUTH = 0x80710c50, - CELL_HTTP_ERROR_NET_SSL_SEND_ENEEDAUTH = 0x80710c51, - CELL_HTTP_ERROR_NET_SSL_SEND_EIDRM = 0x80710c52, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOMSG = 0x80710c53, - CELL_HTTP_ERROR_NET_SSL_SEND_EOVERFLOW = 0x80710c54, - CELL_HTTP_ERROR_NET_SSL_SEND_EILSEQ = 0x80710c55, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOTSUP = 0x80710c56, - CELL_HTTP_ERROR_NET_SSL_SEND_ECANCELED = 0x80710c57, - CELL_HTTP_ERROR_NET_SSL_SEND_EBADMSG = 0x80710c58, - CELL_HTTP_ERROR_NET_SSL_SEND_ENODATA = 0x80710c59, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOSR = 0x80710c5a, - CELL_HTTP_ERROR_NET_SSL_SEND_ENOSTR = 0x80710c5b, - CELL_HTTP_ERROR_NET_SSL_SEND_ETIME = 0x80710c5c, + CELL_HTTP_ERROR_NET_SSL_SEND_EOPNOTSUPP = 0x80710c2d, + CELL_HTTP_ERROR_NET_SSL_SEND_EPFNOSUPPORT = 0x80710c2e, + CELL_HTTP_ERROR_NET_SSL_SEND_EAFNOSUPPORT = 0x80710c2f, + CELL_HTTP_ERROR_NET_SSL_SEND_EADDRINUSE = 0x80710c30, + CELL_HTTP_ERROR_NET_SSL_SEND_EADDRNOTAVAIL = 0x80710c31, + CELL_HTTP_ERROR_NET_SSL_SEND_ENETDOWN = 0x80710c32, + CELL_HTTP_ERROR_NET_SSL_SEND_ENETUNREACH = 0x80710c33, + CELL_HTTP_ERROR_NET_SSL_SEND_ENETRESET = 0x80710c34, + CELL_HTTP_ERROR_NET_SSL_SEND_ECONNABORTED = 0x80710c35, + CELL_HTTP_ERROR_NET_SSL_SEND_ECONNRESET = 0x80710c36, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOBUFS = 0x80710c37, + CELL_HTTP_ERROR_NET_SSL_SEND_EISCONN = 0x80710c38, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOTCONN = 0x80710c39, + CELL_HTTP_ERROR_NET_SSL_SEND_ESHUTDOWN = 0x80710c3a, + CELL_HTTP_ERROR_NET_SSL_SEND_ETOOMANYREFS = 0x80710c3b, + CELL_HTTP_ERROR_NET_SSL_SEND_ETIMEDOUT = 0x80710c3c, + CELL_HTTP_ERROR_NET_SSL_SEND_ECONNREFUSED = 0x80710c3d, + CELL_HTTP_ERROR_NET_SSL_SEND_ELOOP = 0x80710c3e, + CELL_HTTP_ERROR_NET_SSL_SEND_ENAMETOOLONG = 0x80710c3f, + CELL_HTTP_ERROR_NET_SSL_SEND_EHOSTDOWN = 0x80710c40, + CELL_HTTP_ERROR_NET_SSL_SEND_EHOSTUNREACH = 0x80710c41, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOTEMPTY = 0x80710c42, + CELL_HTTP_ERROR_NET_SSL_SEND_EPROCLIM = 0x80710c43, + CELL_HTTP_ERROR_NET_SSL_SEND_EUSERS = 0x80710c44, + CELL_HTTP_ERROR_NET_SSL_SEND_EDQUOT = 0x80710c45, + CELL_HTTP_ERROR_NET_SSL_SEND_ESTALE = 0x80710c46, + CELL_HTTP_ERROR_NET_SSL_SEND_EREMOTE = 0x80710c47, + CELL_HTTP_ERROR_NET_SSL_SEND_EBADRPC = 0x80710c48, + CELL_HTTP_ERROR_NET_SSL_SEND_ERPCMISMATCH = 0x80710c49, + CELL_HTTP_ERROR_NET_SSL_SEND_EPROGUNAVAIL = 0x80710c4a, + CELL_HTTP_ERROR_NET_SSL_SEND_EPROGMISMATCH = 0x80710c4b, + CELL_HTTP_ERROR_NET_SSL_SEND_EPROCUNAVAIL = 0x80710c4c, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOLCK = 0x80710c4d, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOSYS = 0x80710c4e, + CELL_HTTP_ERROR_NET_SSL_SEND_EFTYPE = 0x80710c4f, + CELL_HTTP_ERROR_NET_SSL_SEND_EAUTH = 0x80710c50, + CELL_HTTP_ERROR_NET_SSL_SEND_ENEEDAUTH = 0x80710c51, + CELL_HTTP_ERROR_NET_SSL_SEND_EIDRM = 0x80710c52, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOMSG = 0x80710c53, + CELL_HTTP_ERROR_NET_SSL_SEND_EOVERFLOW = 0x80710c54, + CELL_HTTP_ERROR_NET_SSL_SEND_EILSEQ = 0x80710c55, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOTSUP = 0x80710c56, + CELL_HTTP_ERROR_NET_SSL_SEND_ECANCELED = 0x80710c57, + CELL_HTTP_ERROR_NET_SSL_SEND_EBADMSG = 0x80710c58, + CELL_HTTP_ERROR_NET_SSL_SEND_ENODATA = 0x80710c59, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOSR = 0x80710c5a, + CELL_HTTP_ERROR_NET_SSL_SEND_ENOSTR = 0x80710c5b, + CELL_HTTP_ERROR_NET_SSL_SEND_ETIME = 0x80710c5c, - CELL_HTTP_ERROR_NET_SSL_RECV_EPERM = 0x80710d01, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOENT = 0x80710d02, - CELL_HTTP_ERROR_NET_SSL_RECV_ESRCH = 0x80710d03, - CELL_HTTP_ERROR_NET_SSL_RECV_EINTR = 0x80710d04, - CELL_HTTP_ERROR_NET_SSL_RECV_EIO = 0x80710d05, - CELL_HTTP_ERROR_NET_SSL_RECV_ENXIO = 0x80710d06, - CELL_HTTP_ERROR_NET_SSL_RECV_E2BIG = 0x80710d07, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOEXC = 0x80710d08, - CELL_HTTP_ERROR_NET_SSL_RECV_EBADF = 0x80710d09, - CELL_HTTP_ERROR_NET_SSL_RECV_ECHILD = 0x80710d0a, - CELL_HTTP_ERROR_NET_SSL_RECV_EDEADLK = 0x80710d0b, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOMEM = 0x80710d0c, - CELL_HTTP_ERROR_NET_SSL_RECV_EACCES = 0x80710d0d, - CELL_HTTP_ERROR_NET_SSL_RECV_EFAULT = 0x80710d0e, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOTBLK = 0x80710d0f, - CELL_HTTP_ERROR_NET_SSL_RECV_EBUSY = 0x80710d10, - CELL_HTTP_ERROR_NET_SSL_RECV_EEXIST = 0x80710d11, - CELL_HTTP_ERROR_NET_SSL_RECV_EXDEV = 0x80710d12, - CELL_HTTP_ERROR_NET_SSL_RECV_ENODEV = 0x80710d13, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOTDIR = 0x80710d14, - CELL_HTTP_ERROR_NET_SSL_RECV_EISDIR = 0x80710d15, - CELL_HTTP_ERROR_NET_SSL_RECV_EINVAL = 0x80710d16, - CELL_HTTP_ERROR_NET_SSL_RECV_ENFILE = 0x80710d17, - CELL_HTTP_ERROR_NET_SSL_RECV_EMFILE = 0x80710d18, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOTTY = 0x80710d19, - CELL_HTTP_ERROR_NET_SSL_RECV_ETXTBSY = 0x80710d1a, - CELL_HTTP_ERROR_NET_SSL_RECV_EFBIG = 0x80710d1b, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOSPC = 0x80710d1c, - CELL_HTTP_ERROR_NET_SSL_RECV_ESPIPE = 0x80710d1d, - CELL_HTTP_ERROR_NET_SSL_RECV_EROFS = 0x80710d1e, - CELL_HTTP_ERROR_NET_SSL_RECV_EMLINK = 0x80710d1f, - CELL_HTTP_ERROR_NET_SSL_RECV_EPIPE = 0x80710d20, - CELL_HTTP_ERROR_NET_SSL_RECV_EDOM = 0x80710d21, - CELL_HTTP_ERROR_NET_SSL_RECV_ERANGE = 0x80710d22, - CELL_HTTP_ERROR_NET_SSL_RECV_EAGAIN = 0x80710d23, - CELL_HTTP_ERROR_NET_SSL_RECV_EWOULDBLOCK = 0x80710d23, - CELL_HTTP_ERROR_NET_SSL_RECV_EINPROGRESS = 0x80710d24, - CELL_HTTP_ERROR_NET_SSL_RECV_EALREADY = 0x80710d25, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOTSOCK = 0x80710d26, - CELL_HTTP_ERROR_NET_SSL_RECV_EDESTADDRREQ = 0x80710d27, - CELL_HTTP_ERROR_NET_SSL_RECV_EMSGSIZE = 0x80710d28, - CELL_HTTP_ERROR_NET_SSL_RECV_EPROTOTYPE = 0x80710d29, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOPROTOOPT = 0x80710d2a, + CELL_HTTP_ERROR_NET_SSL_RECV_EPERM = 0x80710d01, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOENT = 0x80710d02, + CELL_HTTP_ERROR_NET_SSL_RECV_ESRCH = 0x80710d03, + CELL_HTTP_ERROR_NET_SSL_RECV_EINTR = 0x80710d04, + CELL_HTTP_ERROR_NET_SSL_RECV_EIO = 0x80710d05, + CELL_HTTP_ERROR_NET_SSL_RECV_ENXIO = 0x80710d06, + CELL_HTTP_ERROR_NET_SSL_RECV_E2BIG = 0x80710d07, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOEXC = 0x80710d08, + CELL_HTTP_ERROR_NET_SSL_RECV_EBADF = 0x80710d09, + CELL_HTTP_ERROR_NET_SSL_RECV_ECHILD = 0x80710d0a, + CELL_HTTP_ERROR_NET_SSL_RECV_EDEADLK = 0x80710d0b, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOMEM = 0x80710d0c, + CELL_HTTP_ERROR_NET_SSL_RECV_EACCES = 0x80710d0d, + CELL_HTTP_ERROR_NET_SSL_RECV_EFAULT = 0x80710d0e, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOTBLK = 0x80710d0f, + CELL_HTTP_ERROR_NET_SSL_RECV_EBUSY = 0x80710d10, + CELL_HTTP_ERROR_NET_SSL_RECV_EEXIST = 0x80710d11, + CELL_HTTP_ERROR_NET_SSL_RECV_EXDEV = 0x80710d12, + CELL_HTTP_ERROR_NET_SSL_RECV_ENODEV = 0x80710d13, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOTDIR = 0x80710d14, + CELL_HTTP_ERROR_NET_SSL_RECV_EISDIR = 0x80710d15, + CELL_HTTP_ERROR_NET_SSL_RECV_EINVAL = 0x80710d16, + CELL_HTTP_ERROR_NET_SSL_RECV_ENFILE = 0x80710d17, + CELL_HTTP_ERROR_NET_SSL_RECV_EMFILE = 0x80710d18, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOTTY = 0x80710d19, + CELL_HTTP_ERROR_NET_SSL_RECV_ETXTBSY = 0x80710d1a, + CELL_HTTP_ERROR_NET_SSL_RECV_EFBIG = 0x80710d1b, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOSPC = 0x80710d1c, + CELL_HTTP_ERROR_NET_SSL_RECV_ESPIPE = 0x80710d1d, + CELL_HTTP_ERROR_NET_SSL_RECV_EROFS = 0x80710d1e, + CELL_HTTP_ERROR_NET_SSL_RECV_EMLINK = 0x80710d1f, + CELL_HTTP_ERROR_NET_SSL_RECV_EPIPE = 0x80710d20, + CELL_HTTP_ERROR_NET_SSL_RECV_EDOM = 0x80710d21, + CELL_HTTP_ERROR_NET_SSL_RECV_ERANGE = 0x80710d22, + CELL_HTTP_ERROR_NET_SSL_RECV_EAGAIN = 0x80710d23, + CELL_HTTP_ERROR_NET_SSL_RECV_EWOULDBLOCK = 0x80710d23, + CELL_HTTP_ERROR_NET_SSL_RECV_EINPROGRESS = 0x80710d24, + CELL_HTTP_ERROR_NET_SSL_RECV_EALREADY = 0x80710d25, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOTSOCK = 0x80710d26, + CELL_HTTP_ERROR_NET_SSL_RECV_EDESTADDRREQ = 0x80710d27, + CELL_HTTP_ERROR_NET_SSL_RECV_EMSGSIZE = 0x80710d28, + CELL_HTTP_ERROR_NET_SSL_RECV_EPROTOTYPE = 0x80710d29, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOPROTOOPT = 0x80710d2a, CELL_HTTP_ERROR_NET_SSL_RECV_EPROTONOSUPPORT = 0x80710d2b, CELL_HTTP_ERROR_NET_SSL_RECV_ESOCKTNOSUPPORT = 0x80710d2c, - CELL_HTTP_ERROR_NET_SSL_RECV_EOPNOTSUPP = 0x80710d2d, - CELL_HTTP_ERROR_NET_SSL_RECV_EPFNOSUPPORT = 0x80710d2e, - CELL_HTTP_ERROR_NET_SSL_RECV_EAFNOSUPPORT = 0x80710d2f, - CELL_HTTP_ERROR_NET_SSL_RECV_EADDRINUSE = 0x80710d30, - CELL_HTTP_ERROR_NET_SSL_RECV_EADDRNOTAVAIL = 0x80710d31, - CELL_HTTP_ERROR_NET_SSL_RECV_ENETDOWN = 0x80710d32, - CELL_HTTP_ERROR_NET_SSL_RECV_ENETUNREACH = 0x80710d33, - CELL_HTTP_ERROR_NET_SSL_RECV_ENETRESET = 0x80710d34, - CELL_HTTP_ERROR_NET_SSL_RECV_ECONNABORTED = 0x80710d35, - CELL_HTTP_ERROR_NET_SSL_RECV_ECONNRESET = 0x80710d36, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOBUFS = 0x80710d37, - CELL_HTTP_ERROR_NET_SSL_RECV_EISCONN = 0x80710d38, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOTCONN = 0x80710d39, - CELL_HTTP_ERROR_NET_SSL_RECV_ESHUTDOWN = 0x80710d3a, - CELL_HTTP_ERROR_NET_SSL_RECV_ETOOMANYREFS = 0x80710d3b, - CELL_HTTP_ERROR_NET_SSL_RECV_ETIMEDOUT = 0x80710d3c, - CELL_HTTP_ERROR_NET_SSL_RECV_ECONNREFUSED = 0x80710d3d, - CELL_HTTP_ERROR_NET_SSL_RECV_ELOOP = 0x80710d3e, - CELL_HTTP_ERROR_NET_SSL_RECV_ENAMETOOLONG = 0x80710d3f, - CELL_HTTP_ERROR_NET_SSL_RECV_EHOSTDOWN = 0x80710d40, - CELL_HTTP_ERROR_NET_SSL_RECV_EHOSTUNREACH = 0x80710d41, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOTEMPTY = 0x80710d42, - CELL_HTTP_ERROR_NET_SSL_RECV_EPROCLIM = 0x80710d43, - CELL_HTTP_ERROR_NET_SSL_RECV_EUSERS = 0x80710d44, - CELL_HTTP_ERROR_NET_SSL_RECV_EDQUOT = 0x80710d45, - CELL_HTTP_ERROR_NET_SSL_RECV_ESTALE = 0x80710d46, - CELL_HTTP_ERROR_NET_SSL_RECV_EREMOTE = 0x80710d47, - CELL_HTTP_ERROR_NET_SSL_RECV_EBADRPC = 0x80710d48, - CELL_HTTP_ERROR_NET_SSL_RECV_ERPCMISMATCH = 0x80710d49, - CELL_HTTP_ERROR_NET_SSL_RECV_EPROGUNAVAIL = 0x80710d4a, - CELL_HTTP_ERROR_NET_SSL_RECV_EPROGMISMATCH = 0x80710d4b, - CELL_HTTP_ERROR_NET_SSL_RECV_EPROCUNAVAIL = 0x80710d4c, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOLCK = 0x80710d4d, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOSYS = 0x80710d4e, - CELL_HTTP_ERROR_NET_SSL_RECV_EFTYPE = 0x80710d4f, - CELL_HTTP_ERROR_NET_SSL_RECV_EAUTH = 0x80710d50, - CELL_HTTP_ERROR_NET_SSL_RECV_ENEEDAUTH = 0x80710d51, - CELL_HTTP_ERROR_NET_SSL_RECV_EIDRM = 0x80710d52, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOMSG = 0x80710d53, - CELL_HTTP_ERROR_NET_SSL_RECV_EOVERFLOW = 0x80710d54, - CELL_HTTP_ERROR_NET_SSL_RECV_EILSEQ = 0x80710d55, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOTSUP = 0x80710d56, - CELL_HTTP_ERROR_NET_SSL_RECV_ECANCELED = 0x80710d57, - CELL_HTTP_ERROR_NET_SSL_RECV_EBADMSG = 0x80710d58, - CELL_HTTP_ERROR_NET_SSL_RECV_ENODATA = 0x80710d59, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOSR = 0x80710d5a, - CELL_HTTP_ERROR_NET_SSL_RECV_ENOSTR = 0x80710d5b, - CELL_HTTP_ERROR_NET_SSL_RECV_ETIME = 0x80710d5c, + CELL_HTTP_ERROR_NET_SSL_RECV_EOPNOTSUPP = 0x80710d2d, + CELL_HTTP_ERROR_NET_SSL_RECV_EPFNOSUPPORT = 0x80710d2e, + CELL_HTTP_ERROR_NET_SSL_RECV_EAFNOSUPPORT = 0x80710d2f, + CELL_HTTP_ERROR_NET_SSL_RECV_EADDRINUSE = 0x80710d30, + CELL_HTTP_ERROR_NET_SSL_RECV_EADDRNOTAVAIL = 0x80710d31, + CELL_HTTP_ERROR_NET_SSL_RECV_ENETDOWN = 0x80710d32, + CELL_HTTP_ERROR_NET_SSL_RECV_ENETUNREACH = 0x80710d33, + CELL_HTTP_ERROR_NET_SSL_RECV_ENETRESET = 0x80710d34, + CELL_HTTP_ERROR_NET_SSL_RECV_ECONNABORTED = 0x80710d35, + CELL_HTTP_ERROR_NET_SSL_RECV_ECONNRESET = 0x80710d36, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOBUFS = 0x80710d37, + CELL_HTTP_ERROR_NET_SSL_RECV_EISCONN = 0x80710d38, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOTCONN = 0x80710d39, + CELL_HTTP_ERROR_NET_SSL_RECV_ESHUTDOWN = 0x80710d3a, + CELL_HTTP_ERROR_NET_SSL_RECV_ETOOMANYREFS = 0x80710d3b, + CELL_HTTP_ERROR_NET_SSL_RECV_ETIMEDOUT = 0x80710d3c, + CELL_HTTP_ERROR_NET_SSL_RECV_ECONNREFUSED = 0x80710d3d, + CELL_HTTP_ERROR_NET_SSL_RECV_ELOOP = 0x80710d3e, + CELL_HTTP_ERROR_NET_SSL_RECV_ENAMETOOLONG = 0x80710d3f, + CELL_HTTP_ERROR_NET_SSL_RECV_EHOSTDOWN = 0x80710d40, + CELL_HTTP_ERROR_NET_SSL_RECV_EHOSTUNREACH = 0x80710d41, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOTEMPTY = 0x80710d42, + CELL_HTTP_ERROR_NET_SSL_RECV_EPROCLIM = 0x80710d43, + CELL_HTTP_ERROR_NET_SSL_RECV_EUSERS = 0x80710d44, + CELL_HTTP_ERROR_NET_SSL_RECV_EDQUOT = 0x80710d45, + CELL_HTTP_ERROR_NET_SSL_RECV_ESTALE = 0x80710d46, + CELL_HTTP_ERROR_NET_SSL_RECV_EREMOTE = 0x80710d47, + CELL_HTTP_ERROR_NET_SSL_RECV_EBADRPC = 0x80710d48, + CELL_HTTP_ERROR_NET_SSL_RECV_ERPCMISMATCH = 0x80710d49, + CELL_HTTP_ERROR_NET_SSL_RECV_EPROGUNAVAIL = 0x80710d4a, + CELL_HTTP_ERROR_NET_SSL_RECV_EPROGMISMATCH = 0x80710d4b, + CELL_HTTP_ERROR_NET_SSL_RECV_EPROCUNAVAIL = 0x80710d4c, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOLCK = 0x80710d4d, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOSYS = 0x80710d4e, + CELL_HTTP_ERROR_NET_SSL_RECV_EFTYPE = 0x80710d4f, + CELL_HTTP_ERROR_NET_SSL_RECV_EAUTH = 0x80710d50, + CELL_HTTP_ERROR_NET_SSL_RECV_ENEEDAUTH = 0x80710d51, + CELL_HTTP_ERROR_NET_SSL_RECV_EIDRM = 0x80710d52, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOMSG = 0x80710d53, + CELL_HTTP_ERROR_NET_SSL_RECV_EOVERFLOW = 0x80710d54, + CELL_HTTP_ERROR_NET_SSL_RECV_EILSEQ = 0x80710d55, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOTSUP = 0x80710d56, + CELL_HTTP_ERROR_NET_SSL_RECV_ECANCELED = 0x80710d57, + CELL_HTTP_ERROR_NET_SSL_RECV_EBADMSG = 0x80710d58, + CELL_HTTP_ERROR_NET_SSL_RECV_ENODATA = 0x80710d59, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOSR = 0x80710d5a, + CELL_HTTP_ERROR_NET_SSL_RECV_ENOSTR = 0x80710d5b, + CELL_HTTP_ERROR_NET_SSL_RECV_ETIME = 0x80710d5c, }; enum { - CELL_HTTP_TRANSACTION_STATE_GETTING_CONNECTION = 1, - CELL_HTTP_TRANSACTION_STATE_PREPARING_REQUEST = 2, - CELL_HTTP_TRANSACTION_STATE_SENDING_REQUEST = 3, - CELL_HTTP_TRANSACTION_STATE_SENDING_BODY = 4, - CELL_HTTP_TRANSACTION_STATE_WAITING_FOR_REPLY = 5, - CELL_HTTP_TRANSACTION_STATE_READING_REPLY = 6, - CELL_HTTP_TRANSACTION_STATE_SETTING_REDIRECTION = 7, + CELL_HTTP_TRANSACTION_STATE_GETTING_CONNECTION = 1, + CELL_HTTP_TRANSACTION_STATE_PREPARING_REQUEST = 2, + CELL_HTTP_TRANSACTION_STATE_SENDING_REQUEST = 3, + CELL_HTTP_TRANSACTION_STATE_SENDING_BODY = 4, + CELL_HTTP_TRANSACTION_STATE_WAITING_FOR_REPLY = 5, + CELL_HTTP_TRANSACTION_STATE_READING_REPLY = 6, + CELL_HTTP_TRANSACTION_STATE_SETTING_REDIRECTION = 7, CELL_HTTP_TRANSACTION_STATE_SETTING_AUTHENTICATION = 8, }; enum { - CELL_HTTP_STATUS_CODE_Continue = 100, - CELL_HTTP_STATUS_CODE_Switching_Protocols = 101, - CELL_HTTP_STATUS_CODE_Processing = 102, + CELL_HTTP_STATUS_CODE_Continue = 100, + CELL_HTTP_STATUS_CODE_Switching_Protocols = 101, + CELL_HTTP_STATUS_CODE_Processing = 102, // Success codes - CELL_HTTP_STATUS_CODE_OK = 200, - CELL_HTTP_STATUS_CODE_Created = 201, - CELL_HTTP_STATUS_CODE_Accepted = 202, - CELL_HTTP_STATUS_CODE_NonAuthoritive_Information = 203, - CELL_HTTP_STATUS_CODE_No_Content = 204, - CELL_HTTP_STATUS_CODE_Reset_Content = 205, - CELL_HTTP_STATUS_CODE_Partial_Content = 206, - CELL_HTTP_STATUS_CODE_MultiStatus = 207, + CELL_HTTP_STATUS_CODE_OK = 200, + CELL_HTTP_STATUS_CODE_Created = 201, + CELL_HTTP_STATUS_CODE_Accepted = 202, + CELL_HTTP_STATUS_CODE_NonAuthoritive_Information = 203, + CELL_HTTP_STATUS_CODE_No_Content = 204, + CELL_HTTP_STATUS_CODE_Reset_Content = 205, + CELL_HTTP_STATUS_CODE_Partial_Content = 206, + CELL_HTTP_STATUS_CODE_MultiStatus = 207, /* Redirection 3xx */ - CELL_HTTP_STATUS_CODE_Multiple_Choices = 300, - CELL_HTTP_STATUS_CODE_Moved_Permanently = 301, - CELL_HTTP_STATUS_CODE_Moved_Temporarily = 302, - CELL_HTTP_STATUS_CODE_Found = CELL_HTTP_STATUS_CODE_Moved_Temporarily, - CELL_HTTP_STATUS_CODE_See_Other = 303, - CELL_HTTP_STATUS_CODE_Not_Modified = 304, - CELL_HTTP_STATUS_CODE_Use_Proxy = 305, - //CELL_HTTP_STATUS_CODE_UNUSED = 306, - CELL_HTTP_STATUS_CODE_Temporary_Redirect = 307, + CELL_HTTP_STATUS_CODE_Multiple_Choices = 300, + CELL_HTTP_STATUS_CODE_Moved_Permanently = 301, + CELL_HTTP_STATUS_CODE_Moved_Temporarily = 302, + CELL_HTTP_STATUS_CODE_Found = CELL_HTTP_STATUS_CODE_Moved_Temporarily, + CELL_HTTP_STATUS_CODE_See_Other = 303, + CELL_HTTP_STATUS_CODE_Not_Modified = 304, + CELL_HTTP_STATUS_CODE_Use_Proxy = 305, + // CELL_HTTP_STATUS_CODE_UNUSED = 306, + CELL_HTTP_STATUS_CODE_Temporary_Redirect = 307, // Client errors - CELL_HTTP_STATUS_CODE_Bad_Request = 400, - CELL_HTTP_STATUS_CODE_Unauthorized = 401, - CELL_HTTP_STATUS_CODE_Payment_Required = 402, - CELL_HTTP_STATUS_CODE_Forbidden = 403, - CELL_HTTP_STATUS_CODE_Not_Found = 404, - CELL_HTTP_STATUS_CODE_Method_Not_Allowed = 405, - CELL_HTTP_STATUS_CODE_Not_Acceptable = 406, - CELL_HTTP_STATUS_CODE_Proxy_Authentication_Required = 407, - CELL_HTTP_STATUS_CODE_Request_Timeout = 408, - CELL_HTTP_STATUS_CODE_Conflict = 409, - CELL_HTTP_STATUS_CODE_Gone = 410, - CELL_HTTP_STATUS_CODE_Length_Required = 411, - CELL_HTTP_STATUS_CODE_Precondition_Failed = 412, - CELL_HTTP_STATUS_CODE_Request_Entity_Too_Large = 413, - CELL_HTTP_STATUS_CODE_RequestURI_Too_Long = 414, - CELL_HTTP_STATUS_CODE_Unsupported_Media_Type = 415, + CELL_HTTP_STATUS_CODE_Bad_Request = 400, + CELL_HTTP_STATUS_CODE_Unauthorized = 401, + CELL_HTTP_STATUS_CODE_Payment_Required = 402, + CELL_HTTP_STATUS_CODE_Forbidden = 403, + CELL_HTTP_STATUS_CODE_Not_Found = 404, + CELL_HTTP_STATUS_CODE_Method_Not_Allowed = 405, + CELL_HTTP_STATUS_CODE_Not_Acceptable = 406, + CELL_HTTP_STATUS_CODE_Proxy_Authentication_Required = 407, + CELL_HTTP_STATUS_CODE_Request_Timeout = 408, + CELL_HTTP_STATUS_CODE_Conflict = 409, + CELL_HTTP_STATUS_CODE_Gone = 410, + CELL_HTTP_STATUS_CODE_Length_Required = 411, + CELL_HTTP_STATUS_CODE_Precondition_Failed = 412, + CELL_HTTP_STATUS_CODE_Request_Entity_Too_Large = 413, + CELL_HTTP_STATUS_CODE_RequestURI_Too_Long = 414, + CELL_HTTP_STATUS_CODE_Unsupported_Media_Type = 415, CELL_HTTP_STATUS_CODE_Requested_Range_Not_Satisfiable = 416, - CELL_HTTP_STATUS_CODE_Expectation_Failed = 417, - CELL_HTTP_STATUS_CODE_Unprocessable_Entity = 422, - CELL_HTTP_STATUS_CODE_Locked = 423, - CELL_HTTP_STATUS_CODE_Failed_Dependency = 424, - CELL_HTTP_STATUS_CODE_Upgrade_Required = 426, + CELL_HTTP_STATUS_CODE_Expectation_Failed = 417, + CELL_HTTP_STATUS_CODE_Unprocessable_Entity = 422, + CELL_HTTP_STATUS_CODE_Locked = 423, + CELL_HTTP_STATUS_CODE_Failed_Dependency = 424, + CELL_HTTP_STATUS_CODE_Upgrade_Required = 426, // Server error - CELL_HTTP_STATUS_CODE_Internal_Server_Error = 500, - CELL_HTTP_STATUS_CODE_Not_Implemented = 501, - CELL_HTTP_STATUS_CODE_Bad_Gateway = 502, - CELL_HTTP_STATUS_CODE_Service_Unavailable = 503, - CELL_HTTP_STATUS_CODE_Gateway_Timeout = 504, - CELL_HTTP_STATUS_CODE_HTTP_Version_Not_Supported = 505, - CELL_HTTP_STATUS_CODE_Insufficient_Storage = 507, + CELL_HTTP_STATUS_CODE_Internal_Server_Error = 500, + CELL_HTTP_STATUS_CODE_Not_Implemented = 501, + CELL_HTTP_STATUS_CODE_Bad_Gateway = 502, + CELL_HTTP_STATUS_CODE_Service_Unavailable = 503, + CELL_HTTP_STATUS_CODE_Gateway_Timeout = 504, + CELL_HTTP_STATUS_CODE_HTTP_Version_Not_Supported = 505, + CELL_HTTP_STATUS_CODE_Insufficient_Storage = 507, }; enum { - CELL_HTTPS_VERIFY_ERROR_NONE = 0x00000000U, - CELL_HTTPS_VERIFY_ERROR_NO_CERT = 0x00000001U, - CELL_HTTPS_VERIFY_ERROR_BAD_SSL = 0x00000002U, - CELL_HTTPS_VERIFY_ERROR_BAD_CLIENT = 0x00000004U, - CELL_HTTPS_VERIFY_ERROR_UNKNOWN_CA = 0x00000008U, - CELL_HTTPS_VERIFY_ERROR_BAD_CHAIN = 0x00000010U, - CELL_HTTPS_VERIFY_ERROR_NO_MEMORY = 0x00000020U, + CELL_HTTPS_VERIFY_ERROR_NONE = 0x00000000U, + CELL_HTTPS_VERIFY_ERROR_NO_CERT = 0x00000001U, + CELL_HTTPS_VERIFY_ERROR_BAD_SSL = 0x00000002U, + CELL_HTTPS_VERIFY_ERROR_BAD_CLIENT = 0x00000004U, + CELL_HTTPS_VERIFY_ERROR_UNKNOWN_CA = 0x00000008U, + CELL_HTTPS_VERIFY_ERROR_BAD_CHAIN = 0x00000010U, + CELL_HTTPS_VERIFY_ERROR_NO_MEMORY = 0x00000020U, CELL_HTTPS_VERIFY_ERROR_NOT_VERIFIABLE = 0x00000040U, - CELL_HTTPS_VERIFY_ERROR_INVALID_CERT = 0x00000080U, + CELL_HTTPS_VERIFY_ERROR_INVALID_CERT = 0x00000080U, CELL_HTTPS_VERIFY_ERROR_BAD_CONSTRAINT = 0x00000100U, - CELL_HTTPS_VERIFY_ERROR_VERIFY_FAILED = 0x00000200U, - CELL_HTTPS_VERIFY_ERROR_COMMON_NAME = 0x00000400U, - CELL_HTTPS_VERIFY_ERROR_EXPIRED = 0x00000800U, - CELL_HTTPS_VERIFY_ERROR_NOT_YET_VALID = 0x00001000U, + CELL_HTTPS_VERIFY_ERROR_VERIFY_FAILED = 0x00000200U, + CELL_HTTPS_VERIFY_ERROR_COMMON_NAME = 0x00000400U, + CELL_HTTPS_VERIFY_ERROR_EXPIRED = 0x00000800U, + CELL_HTTPS_VERIFY_ERROR_NOT_YET_VALID = 0x00001000U, }; static constexpr const char* CELL_HTTP_METHOD_OPTIONS = "OPTIONS"; -static constexpr const char* CELL_HTTP_METHOD_GET = "GET"; -static constexpr const char* CELL_HTTP_METHOD_HEAD = "HEAD"; -static constexpr const char* CELL_HTTP_METHOD_POST = "POST"; -static constexpr const char* CELL_HTTP_METHOD_PUT = "PUT"; -static constexpr const char* CELL_HTTP_METHOD_DELETE = "DELETE"; -static constexpr const char* CELL_HTTP_METHOD_TRACE = "TRACE"; +static constexpr const char* CELL_HTTP_METHOD_GET = "GET"; +static constexpr const char* CELL_HTTP_METHOD_HEAD = "HEAD"; +static constexpr const char* CELL_HTTP_METHOD_POST = "POST"; +static constexpr const char* CELL_HTTP_METHOD_PUT = "PUT"; +static constexpr const char* CELL_HTTP_METHOD_DELETE = "DELETE"; +static constexpr const char* CELL_HTTP_METHOD_TRACE = "TRACE"; -typedef u32 CellHttpClientId; //typedef struct CellHttpClient* CellHttpClientId; -typedef u32 CellHttpTransId; //typedef struct CellHttpTransaction* CellHttpTransId; +typedef u32 CellHttpClientId; // typedef struct CellHttpClient* CellHttpClientId; +typedef u32 CellHttpTransId; // typedef struct CellHttpTransaction* CellHttpTransId; typedef const void* CellHttpSslId; -using CellHttpAuthenticationCallback = s32(CellHttpTransId transId, vm::cptr realm, vm::cptr uri, vm::ptr username, vm::ptr password, vm::ptr save, vm::ptr userArg); +using CellHttpAuthenticationCallback = s32(CellHttpTransId transId, vm::cptr realm, vm::cptr uri, vm::ptr username, vm::ptr password, vm::ptr save, vm::ptr userArg); using CellHttpTransactionStateCallback = s32(CellHttpTransId transId, s32 state, vm::ptr userArg); -using CellHttpRedirectCallback = s32(CellHttpTransId transId, vm::cptr response, vm::cptr from, vm::cptr to, vm::ptr userArg); -using CellHttpsSslCallback = s32(u32 verifyErr, vm::cpptr sslCerts, s32 certNum, vm::cptr hostname, vm::cptr id, vm::ptr userArg); -using CellHttpCookieSendCallback = s32(CellHttpTransId transId, vm::cptr uri, vm::cptr cookieValue, vm::ptr userArg); -using CellHttpCookieRecvCallback = s32(CellHttpTransId transId, vm::cptr uri, vm::cptr cookieValue, vm::ptr userArg); +using CellHttpRedirectCallback = s32(CellHttpTransId transId, vm::cptr response, vm::cptr from, vm::cptr to, vm::ptr userArg); +using CellHttpsSslCallback = s32(u32 verifyErr, vm::cpptr sslCerts, s32 certNum, vm::cptr hostname, vm::cptr id, vm::ptr userArg); +using CellHttpCookieSendCallback = s32(CellHttpTransId transId, vm::cptr uri, vm::cptr cookieValue, vm::ptr userArg); +using CellHttpCookieRecvCallback = s32(CellHttpTransId transId, vm::cptr uri, vm::cptr cookieValue, vm::ptr userArg); struct CellHttpsData { diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellHttpUtil.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellHttpUtil.cpp index 94b73307a..196b5b6f6 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellHttpUtil.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellHttpUtil.cpp @@ -18,23 +18,23 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_HTTP_UTIL_ERROR_NO_MEMORY); - STR_CASE(CELL_HTTP_UTIL_ERROR_NO_BUFFER); - STR_CASE(CELL_HTTP_UTIL_ERROR_NO_STRING); - STR_CASE(CELL_HTTP_UTIL_ERROR_INSUFFICIENT); - STR_CASE(CELL_HTTP_UTIL_ERROR_INVALID_URI); - STR_CASE(CELL_HTTP_UTIL_ERROR_INVALID_HEADER); - STR_CASE(CELL_HTTP_UTIL_ERROR_INVALID_REQUEST); - STR_CASE(CELL_HTTP_UTIL_ERROR_INVALID_RESPONSE); - STR_CASE(CELL_HTTP_UTIL_ERROR_INVALID_LENGTH); - STR_CASE(CELL_HTTP_UTIL_ERROR_INVALID_CHARACTER); - } + switch (error) + { + STR_CASE(CELL_HTTP_UTIL_ERROR_NO_MEMORY); + STR_CASE(CELL_HTTP_UTIL_ERROR_NO_BUFFER); + STR_CASE(CELL_HTTP_UTIL_ERROR_NO_STRING); + STR_CASE(CELL_HTTP_UTIL_ERROR_INSUFFICIENT); + STR_CASE(CELL_HTTP_UTIL_ERROR_INVALID_URI); + STR_CASE(CELL_HTTP_UTIL_ERROR_INVALID_HEADER); + STR_CASE(CELL_HTTP_UTIL_ERROR_INVALID_REQUEST); + STR_CASE(CELL_HTTP_UTIL_ERROR_INVALID_RESPONSE); + STR_CASE(CELL_HTTP_UTIL_ERROR_INVALID_LENGTH); + STR_CASE(CELL_HTTP_UTIL_ERROR_INVALID_CHARACTER); + } - return unknown; - }); + return unknown; + }); } error_code cellHttpUtilParseUri(vm::ptr uri, vm::cptr str, vm::ptr pool, u32 size, vm::ptr required) @@ -55,7 +55,7 @@ error_code cellHttpUtilParseUri(vm::ptr uri, vm::cptr str, vm } LUrlParser::clParseURL URL = LUrlParser::clParseURL::ParseURL(str.get_ptr()); - if ( URL.IsValid() ) + if (URL.IsValid()) { std::string scheme = URL.m_Scheme; std::string host = URL.m_Host; @@ -70,7 +70,7 @@ error_code cellHttpUtilParseUri(vm::ptr uri, vm::cptr str, vm u32 passwordOffset = usernameOffset + ::size32(username) + 1; u32 totalSize = passwordOffset + ::size32(password) + 1; - //called twice, first to setup pool, then to populate. + // called twice, first to setup pool, then to populate. if (!uri) { *required = totalSize; @@ -105,35 +105,35 @@ error_code cellHttpUtilParseUri(vm::ptr uri, vm::cptr str, vm else { std::string parseError; - switch(URL.m_ErrorCode) + switch (URL.m_ErrorCode) { - case LUrlParser::LUrlParserError_Ok: - parseError = "No error, URL was parsed fine"; - break; - case LUrlParser::LUrlParserError_Uninitialized: - parseError = "Error, LUrlParser is uninitialized"; - break; - case LUrlParser::LUrlParserError_NoUrlCharacter: - parseError = "Error, the URL has invalid characters"; - break; - case LUrlParser::LUrlParserError_InvalidSchemeName: - parseError = "Error, the URL has an invalid scheme"; - break; - case LUrlParser::LUrlParserError_NoDoubleSlash: - parseError = "Error, the URL did not contain a double slash"; - break; - case LUrlParser::LUrlParserError_NoAtSign: - parseError = "Error, the URL did not contain an @ sign"; - break; - case LUrlParser::LUrlParserError_UnexpectedEndOfLine: - parseError = "Error, unexpectedly got the end of the line"; - break; - case LUrlParser::LUrlParserError_NoSlash: - parseError = "Error, URI didn't contain a slash"; - break; - default: - parseError = "Error, unknown error #" + std::to_string(static_cast(URL.m_ErrorCode)); - break; + case LUrlParser::LUrlParserError_Ok: + parseError = "No error, URL was parsed fine"; + break; + case LUrlParser::LUrlParserError_Uninitialized: + parseError = "Error, LUrlParser is uninitialized"; + break; + case LUrlParser::LUrlParserError_NoUrlCharacter: + parseError = "Error, the URL has invalid characters"; + break; + case LUrlParser::LUrlParserError_InvalidSchemeName: + parseError = "Error, the URL has an invalid scheme"; + break; + case LUrlParser::LUrlParserError_NoDoubleSlash: + parseError = "Error, the URL did not contain a double slash"; + break; + case LUrlParser::LUrlParserError_NoAtSign: + parseError = "Error, the URL did not contain an @ sign"; + break; + case LUrlParser::LUrlParserError_UnexpectedEndOfLine: + parseError = "Error, unexpectedly got the end of the line"; + break; + case LUrlParser::LUrlParserError_NoSlash: + parseError = "Error, URI didn't contain a slash"; + break; + default: + parseError = "Error, unknown error #" + std::to_string(static_cast(URL.m_ErrorCode)); + break; } cellHttpUtil.error("%s, while parsing URI, %s.", parseError, str.get_ptr()); return -1; @@ -828,28 +828,28 @@ error_code cellHttpUtilBase64Decoder(vm::ptr output, vm::cptr in, u3 } DECLARE(ppu_module_manager::cellHttpUtil)("cellHttpUtil", []() -{ - REG_FUNC(cellHttpUtil, cellHttpUtilParseUri); - REG_FUNC(cellHttpUtil, cellHttpUtilParseUriPath); - REG_FUNC(cellHttpUtil, cellHttpUtilParseProxy); - REG_FUNC(cellHttpUtil, cellHttpUtilParseStatusLine); - REG_FUNC(cellHttpUtil, cellHttpUtilParseHeader); + { + REG_FUNC(cellHttpUtil, cellHttpUtilParseUri); + REG_FUNC(cellHttpUtil, cellHttpUtilParseUriPath); + REG_FUNC(cellHttpUtil, cellHttpUtilParseProxy); + REG_FUNC(cellHttpUtil, cellHttpUtilParseStatusLine); + REG_FUNC(cellHttpUtil, cellHttpUtilParseHeader); - REG_FUNC(cellHttpUtil, cellHttpUtilBuildRequestLine); - REG_FUNC(cellHttpUtil, cellHttpUtilBuildHeader); - REG_FUNC(cellHttpUtil, cellHttpUtilBuildUri); + REG_FUNC(cellHttpUtil, cellHttpUtilBuildRequestLine); + REG_FUNC(cellHttpUtil, cellHttpUtilBuildHeader); + REG_FUNC(cellHttpUtil, cellHttpUtilBuildUri); - REG_FUNC(cellHttpUtil, cellHttpUtilCopyUri); - REG_FUNC(cellHttpUtil, cellHttpUtilMergeUriPath); - REG_FUNC(cellHttpUtil, cellHttpUtilSweepPath); - REG_FUNC(cellHttpUtil, cellHttpUtilCopyStatusLine); - REG_FUNC(cellHttpUtil, cellHttpUtilCopyHeader); - REG_FUNC(cellHttpUtil, cellHttpUtilAppendHeaderValue); + REG_FUNC(cellHttpUtil, cellHttpUtilCopyUri); + REG_FUNC(cellHttpUtil, cellHttpUtilMergeUriPath); + REG_FUNC(cellHttpUtil, cellHttpUtilSweepPath); + REG_FUNC(cellHttpUtil, cellHttpUtilCopyStatusLine); + REG_FUNC(cellHttpUtil, cellHttpUtilCopyHeader); + REG_FUNC(cellHttpUtil, cellHttpUtilAppendHeaderValue); - REG_FUNC(cellHttpUtil, cellHttpUtilEscapeUri); - REG_FUNC(cellHttpUtil, cellHttpUtilUnescapeUri); - REG_FUNC(cellHttpUtil, cellHttpUtilFormUrlEncode); - REG_FUNC(cellHttpUtil, cellHttpUtilFormUrlDecode); - REG_FUNC(cellHttpUtil, cellHttpUtilBase64Encoder); - REG_FUNC(cellHttpUtil, cellHttpUtilBase64Decoder); -}); + REG_FUNC(cellHttpUtil, cellHttpUtilEscapeUri); + REG_FUNC(cellHttpUtil, cellHttpUtilUnescapeUri); + REG_FUNC(cellHttpUtil, cellHttpUtilFormUrlEncode); + REG_FUNC(cellHttpUtil, cellHttpUtilFormUrlDecode); + REG_FUNC(cellHttpUtil, cellHttpUtilBase64Encoder); + REG_FUNC(cellHttpUtil, cellHttpUtilBase64Decoder); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellHttpUtil.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellHttpUtil.h index 93f94c0d7..3acf708b4 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellHttpUtil.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellHttpUtil.h @@ -7,25 +7,25 @@ // Error Codes enum CellHttpUtilError : u32 { - CELL_HTTP_UTIL_ERROR_NO_MEMORY = 0x80711001, - CELL_HTTP_UTIL_ERROR_NO_BUFFER = 0x80711002, - CELL_HTTP_UTIL_ERROR_NO_STRING = 0x80711003, - CELL_HTTP_UTIL_ERROR_INSUFFICIENT = 0x80711004, - CELL_HTTP_UTIL_ERROR_INVALID_URI = 0x80711005, - CELL_HTTP_UTIL_ERROR_INVALID_HEADER = 0x80711006, - CELL_HTTP_UTIL_ERROR_INVALID_REQUEST = 0x80711007, - CELL_HTTP_UTIL_ERROR_INVALID_RESPONSE = 0x80711008, - CELL_HTTP_UTIL_ERROR_INVALID_LENGTH = 0x80711009, + CELL_HTTP_UTIL_ERROR_NO_MEMORY = 0x80711001, + CELL_HTTP_UTIL_ERROR_NO_BUFFER = 0x80711002, + CELL_HTTP_UTIL_ERROR_NO_STRING = 0x80711003, + CELL_HTTP_UTIL_ERROR_INSUFFICIENT = 0x80711004, + CELL_HTTP_UTIL_ERROR_INVALID_URI = 0x80711005, + CELL_HTTP_UTIL_ERROR_INVALID_HEADER = 0x80711006, + CELL_HTTP_UTIL_ERROR_INVALID_REQUEST = 0x80711007, + CELL_HTTP_UTIL_ERROR_INVALID_RESPONSE = 0x80711008, + CELL_HTTP_UTIL_ERROR_INVALID_LENGTH = 0x80711009, CELL_HTTP_UTIL_ERROR_INVALID_CHARACTER = 0x8071100a, }; enum { - CELL_HTTP_UTIL_URI_FLAG_FULL_URI = 0x00000000, - CELL_HTTP_UTIL_URI_FLAG_NO_SCHEME = 0x00000001, + CELL_HTTP_UTIL_URI_FLAG_FULL_URI = 0x00000000, + CELL_HTTP_UTIL_URI_FLAG_NO_SCHEME = 0x00000001, CELL_HTTP_UTIL_URI_FLAG_NO_CREDENTIALS = 0x00000002, - CELL_HTTP_UTIL_URI_FLAG_NO_PASSWORD = 0x00000004, - CELL_HTTP_UTIL_URI_FLAG_NO_PATH = 0x00000008 + CELL_HTTP_UTIL_URI_FLAG_NO_PASSWORD = 0x00000004, + CELL_HTTP_UTIL_URI_FLAG_NO_PATH = 0x00000008 }; struct CellHttpUri diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellImeJp.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellImeJp.cpp index c191ebb92..60d888964 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellImeJp.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellImeJp.cpp @@ -10,20 +10,20 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_IMEJP_ERROR_ERR); - STR_CASE(CELL_IMEJP_ERROR_CONTEXT); - STR_CASE(CELL_IMEJP_ERROR_ALREADY_OPEN); - STR_CASE(CELL_IMEJP_ERROR_DIC_OPEN); - STR_CASE(CELL_IMEJP_ERROR_PARAM); - STR_CASE(CELL_IMEJP_ERROR_IME_ALREADY_IN_USE); - STR_CASE(CELL_IMEJP_ERROR_OTHER); - } + switch (error) + { + STR_CASE(CELL_IMEJP_ERROR_ERR); + STR_CASE(CELL_IMEJP_ERROR_CONTEXT); + STR_CASE(CELL_IMEJP_ERROR_ALREADY_OPEN); + STR_CASE(CELL_IMEJP_ERROR_DIC_OPEN); + STR_CASE(CELL_IMEJP_ERROR_PARAM); + STR_CASE(CELL_IMEJP_ERROR_IME_ALREADY_IN_USE); + STR_CASE(CELL_IMEJP_ERROR_OTHER); + } - return unknown; - }); + return unknown; + }); } using sys_memory_container_t = u32; @@ -208,8 +208,7 @@ std::vector ime_jp_manager::get_candidate_list() cons // TODO: we just fake this with one candidate for now candidates.push_back(candidate{ .text = get_focus_string(), - .offset = 0 - }); + .offset = 0}); return candidates; } @@ -222,7 +221,6 @@ std::u16string ime_jp_manager::get_focus_string() const return input_string.substr(focus_begin, focus_length); } - static error_code cellImeJpOpen(sys_memory_container_t container_id, vm::ptr hImeJpHandle, vm::cptr addDicPath) { cellImeJp.todo("cellImeJpOpen(container_id=*0x%x, hImeJpHandle=*0x%x, addDicPath=*0x%x)", container_id, hImeJpHandle, addDicPath); @@ -1246,50 +1244,50 @@ static error_code cellImeJpConfirmPrediction(CellImeJpHandle hImeJpHandle, vm::p } DECLARE(ppu_module_manager::cellImeJp)("cellImeJpUtility", []() -{ - REG_FUNC(cellImeJpUtility, cellImeJpOpen); - REG_FUNC(cellImeJpUtility, cellImeJpOpen2); - REG_FUNC(cellImeJpUtility, cellImeJpOpen3); - REG_FUNC(cellImeJpUtility, cellImeJpOpenExt); - REG_FUNC(cellImeJpUtility, cellImeJpClose); + { + REG_FUNC(cellImeJpUtility, cellImeJpOpen); + REG_FUNC(cellImeJpUtility, cellImeJpOpen2); + REG_FUNC(cellImeJpUtility, cellImeJpOpen3); + REG_FUNC(cellImeJpUtility, cellImeJpOpenExt); + REG_FUNC(cellImeJpUtility, cellImeJpClose); - REG_FUNC(cellImeJpUtility, cellImeJpSetKanaInputMode); - REG_FUNC(cellImeJpUtility, cellImeJpSetInputCharType); - REG_FUNC(cellImeJpUtility, cellImeJpSetFixInputMode); - REG_FUNC(cellImeJpUtility, cellImeJpAllowExtensionCharacters); - REG_FUNC(cellImeJpUtility, cellImeJpReset); + REG_FUNC(cellImeJpUtility, cellImeJpSetKanaInputMode); + REG_FUNC(cellImeJpUtility, cellImeJpSetInputCharType); + REG_FUNC(cellImeJpUtility, cellImeJpSetFixInputMode); + REG_FUNC(cellImeJpUtility, cellImeJpAllowExtensionCharacters); + REG_FUNC(cellImeJpUtility, cellImeJpReset); - REG_FUNC(cellImeJpUtility, cellImeJpGetStatus); + REG_FUNC(cellImeJpUtility, cellImeJpGetStatus); - REG_FUNC(cellImeJpUtility, cellImeJpEnterChar); - REG_FUNC(cellImeJpUtility, cellImeJpEnterCharExt); - REG_FUNC(cellImeJpUtility, cellImeJpEnterString); - REG_FUNC(cellImeJpUtility, cellImeJpEnterStringExt); - REG_FUNC(cellImeJpUtility, cellImeJpModeCaretRight); - REG_FUNC(cellImeJpUtility, cellImeJpModeCaretLeft); - REG_FUNC(cellImeJpUtility, cellImeJpBackspaceWord); - REG_FUNC(cellImeJpUtility, cellImeJpDeleteWord); - REG_FUNC(cellImeJpUtility, cellImeJpAllDeleteConvertString); - REG_FUNC(cellImeJpUtility, cellImeJpConvertForward); - REG_FUNC(cellImeJpUtility, cellImeJpConvertBackward); - REG_FUNC(cellImeJpUtility, cellImeJpCurrentPartConfirm); - REG_FUNC(cellImeJpUtility, cellImeJpAllConfirm); - REG_FUNC(cellImeJpUtility, cellImeJpConvertCancel); - REG_FUNC(cellImeJpUtility, cellImeJpAllConvertCancel); - REG_FUNC(cellImeJpUtility, cellImeJpExtendConvertArea); - REG_FUNC(cellImeJpUtility, cellImeJpShortenConvertArea); - REG_FUNC(cellImeJpUtility, cellImeJpTemporalConfirm); - REG_FUNC(cellImeJpUtility, cellImeJpPostConvert); - REG_FUNC(cellImeJpUtility, cellImeJpMoveFocusClause); - REG_FUNC(cellImeJpUtility, cellImeJpGetFocusTop); - REG_FUNC(cellImeJpUtility, cellImeJpGetFocusLength); - REG_FUNC(cellImeJpUtility, cellImeJpGetConfirmYomiString); - REG_FUNC(cellImeJpUtility, cellImeJpGetConfirmString); - REG_FUNC(cellImeJpUtility, cellImeJpGetConvertYomiString); - REG_FUNC(cellImeJpUtility, cellImeJpGetConvertString); - REG_FUNC(cellImeJpUtility, cellImeJpGetCandidateListSize); - REG_FUNC(cellImeJpUtility, cellImeJpGetCandidateList); - REG_FUNC(cellImeJpUtility, cellImeJpGetCandidateSelect); - REG_FUNC(cellImeJpUtility, cellImeJpGetPredictList); - REG_FUNC(cellImeJpUtility, cellImeJpConfirmPrediction); -}); + REG_FUNC(cellImeJpUtility, cellImeJpEnterChar); + REG_FUNC(cellImeJpUtility, cellImeJpEnterCharExt); + REG_FUNC(cellImeJpUtility, cellImeJpEnterString); + REG_FUNC(cellImeJpUtility, cellImeJpEnterStringExt); + REG_FUNC(cellImeJpUtility, cellImeJpModeCaretRight); + REG_FUNC(cellImeJpUtility, cellImeJpModeCaretLeft); + REG_FUNC(cellImeJpUtility, cellImeJpBackspaceWord); + REG_FUNC(cellImeJpUtility, cellImeJpDeleteWord); + REG_FUNC(cellImeJpUtility, cellImeJpAllDeleteConvertString); + REG_FUNC(cellImeJpUtility, cellImeJpConvertForward); + REG_FUNC(cellImeJpUtility, cellImeJpConvertBackward); + REG_FUNC(cellImeJpUtility, cellImeJpCurrentPartConfirm); + REG_FUNC(cellImeJpUtility, cellImeJpAllConfirm); + REG_FUNC(cellImeJpUtility, cellImeJpConvertCancel); + REG_FUNC(cellImeJpUtility, cellImeJpAllConvertCancel); + REG_FUNC(cellImeJpUtility, cellImeJpExtendConvertArea); + REG_FUNC(cellImeJpUtility, cellImeJpShortenConvertArea); + REG_FUNC(cellImeJpUtility, cellImeJpTemporalConfirm); + REG_FUNC(cellImeJpUtility, cellImeJpPostConvert); + REG_FUNC(cellImeJpUtility, cellImeJpMoveFocusClause); + REG_FUNC(cellImeJpUtility, cellImeJpGetFocusTop); + REG_FUNC(cellImeJpUtility, cellImeJpGetFocusLength); + REG_FUNC(cellImeJpUtility, cellImeJpGetConfirmYomiString); + REG_FUNC(cellImeJpUtility, cellImeJpGetConfirmString); + REG_FUNC(cellImeJpUtility, cellImeJpGetConvertYomiString); + REG_FUNC(cellImeJpUtility, cellImeJpGetConvertString); + REG_FUNC(cellImeJpUtility, cellImeJpGetCandidateListSize); + REG_FUNC(cellImeJpUtility, cellImeJpGetCandidateList); + REG_FUNC(cellImeJpUtility, cellImeJpGetCandidateSelect); + REG_FUNC(cellImeJpUtility, cellImeJpGetPredictList); + REG_FUNC(cellImeJpUtility, cellImeJpConfirmPrediction); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellImeJp.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellImeJp.h index 22e92adf2..c4e63c8e8 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellImeJp.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellImeJp.h @@ -7,69 +7,69 @@ typedef vm::ptr CellImeJpHandle; // Return Codes enum CellImeJpError : u32 { - CELL_IMEJP_ERROR_ERR = 0x8002bf01, - CELL_IMEJP_ERROR_CONTEXT = 0x8002bf11, - CELL_IMEJP_ERROR_ALREADY_OPEN = 0x8002bf21, - CELL_IMEJP_ERROR_DIC_OPEN = 0x8002bf31, - CELL_IMEJP_ERROR_PARAM = 0x8002bf41, + CELL_IMEJP_ERROR_ERR = 0x8002bf01, + CELL_IMEJP_ERROR_CONTEXT = 0x8002bf11, + CELL_IMEJP_ERROR_ALREADY_OPEN = 0x8002bf21, + CELL_IMEJP_ERROR_DIC_OPEN = 0x8002bf31, + CELL_IMEJP_ERROR_PARAM = 0x8002bf41, CELL_IMEJP_ERROR_IME_ALREADY_IN_USE = 0x8002bf51, - CELL_IMEJP_ERROR_OTHER = 0x8002bfff, + CELL_IMEJP_ERROR_OTHER = 0x8002bfff, }; // Input state of the ImeJp enum { - CELL_IMEJP_BEFORE_INPUT = 0, - CELL_IMEJP_BEFORE_CONVERT = 1, - CELL_IMEJP_CONVERTING = 2, - CELL_IMEJP_CANDIDATE_EMPTY = 3, + CELL_IMEJP_BEFORE_INPUT = 0, + CELL_IMEJP_BEFORE_CONVERT = 1, + CELL_IMEJP_CONVERTING = 2, + CELL_IMEJP_CANDIDATE_EMPTY = 3, CELL_IMEJP_POSTCONVERT_KANA = 4, CELL_IMEJP_POSTCONVERT_HALF = 5, - CELL_IMEJP_POSTCONVERT_RAW = 6, - CELL_IMEJP_CANDIDATES = 7, - CELL_IMEJP_MOVE_CLAUSE_GAP = 8, + CELL_IMEJP_POSTCONVERT_RAW = 6, + CELL_IMEJP_CANDIDATES = 7, + CELL_IMEJP_MOVE_CLAUSE_GAP = 8, }; // cellImeJpEnterChar, returning values pointed in pOutputStatus. enum { - CELL_IMEJP_RET_NONE = 0, - CELL_IMEJP_RET_THROUGH = 1, + CELL_IMEJP_RET_NONE = 0, + CELL_IMEJP_RET_THROUGH = 1, CELL_IMEJP_RET_CONFIRMED = 2, }; enum { CELL_IMEJP_ROMAN_INPUT = 0, - CELL_IMEJP_KANA_INPUT = 1, + CELL_IMEJP_KANA_INPUT = 1, }; enum { - CELL_IMEJP_DSPCHAR_HIRA = 1, + CELL_IMEJP_DSPCHAR_HIRA = 1, CELL_IMEJP_DSPCHAR_FKANA = 2, - CELL_IMEJP_DSPCHAR_RAW = 3, + CELL_IMEJP_DSPCHAR_RAW = 3, CELL_IMEJP_DSPCHAR_HKANA = 4, - CELL_IMEJP_DSPCHAR_HRAW = 5, + CELL_IMEJP_DSPCHAR_HRAW = 5, }; enum { - CELL_IMEJP_FIXINMODE_OFF = 0, + CELL_IMEJP_FIXINMODE_OFF = 0, CELL_IMEJP_FIXINMODE_HIRA = 1, CELL_IMEJP_FIXINMODE_FKAN = 2, - CELL_IMEJP_FIXINMODE_RAW = 3, + CELL_IMEJP_FIXINMODE_RAW = 3, CELL_IMEJP_FIXINMODE_HKAN = 4, CELL_IMEJP_FIXINMODE_HRAW = 5, }; enum { - CELL_IMEJP_EXTENSIONCH_NONE = 0x0000, - CELL_IMEJP_EXTENSIONCH_HANKANA = 0x0001, + CELL_IMEJP_EXTENSIONCH_NONE = 0x0000, + CELL_IMEJP_EXTENSIONCH_HANKANA = 0x0001, CELL_IMEJP_EXTENSIONCH_UD09TO15 = 0x0004, CELL_IMEJP_EXTENSIONCH_UD85TO94 = 0x0008, - CELL_IMEJP_EXTENSIONCH_OUTJIS = 0x0010, + CELL_IMEJP_EXTENSIONCH_OUTJIS = 0x0010, }; enum @@ -77,15 +77,15 @@ enum CELL_IMEJP_POSTCONV_HIRA = 1, CELL_IMEJP_POSTCONV_KANA = 2, CELL_IMEJP_POSTCONV_HALF = 3, - CELL_IMEJP_POSTCONV_RAW = 4, + CELL_IMEJP_POSTCONV_RAW = 4, }; enum { - CELL_IMEJP_FOCUS_NEXT = 0, + CELL_IMEJP_FOCUS_NEXT = 0, CELL_IMEJP_FOCUS_BEFORE = 1, - CELL_IMEJP_FOCUS_TOP = 2, - CELL_IMEJP_FOCUS_END = 3, + CELL_IMEJP_FOCUS_TOP = 2, + CELL_IMEJP_FOCUS_END = 3, }; enum @@ -111,16 +111,16 @@ struct ime_jp_manager { shared_mutex mutex; - atomic_t is_initialized{ false }; + atomic_t is_initialized{false}; u32 input_state = CELL_IMEJP_BEFORE_INPUT; std::vector dictionary_paths; std::u16string confirmed_string; // Confirmed part of the string (first part of the entire string) std::u16string converted_string; // Converted part of the unconfirmed input string std::u16string input_string; // Unconfirmed part of the string (second part of the entire string) - usz cursor = 0; // The cursor. Can move across the entire input string. - usz focus_begin = 0; // Begin of the focus string - usz focus_length = 0; // Length of the focus string + usz cursor = 0; // The cursor. Can move across the entire input string. + usz focus_begin = 0; // Begin of the focus string + usz focus_length = 0; // Length of the focus string s16 fix_input_mode = CELL_IMEJP_FIXINMODE_OFF; s16 input_char_type = CELL_IMEJP_DSPCHAR_HIRA; s16 kana_input_mode = CELL_IMEJP_ROMAN_INPUT; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgDec.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgDec.cpp index be72ce429..559fcefe1 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgDec.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgDec.cpp @@ -20,22 +20,22 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_JPGDEC_ERROR_HEADER); - STR_CASE(CELL_JPGDEC_ERROR_STREAM_FORMAT); - STR_CASE(CELL_JPGDEC_ERROR_ARG); - STR_CASE(CELL_JPGDEC_ERROR_SEQ); - STR_CASE(CELL_JPGDEC_ERROR_BUSY); - STR_CASE(CELL_JPGDEC_ERROR_FATAL); - STR_CASE(CELL_JPGDEC_ERROR_OPEN_FILE); - STR_CASE(CELL_JPGDEC_ERROR_SPU_UNSUPPORT); - STR_CASE(CELL_JPGDEC_ERROR_CB_PARAM); - } + switch (error) + { + STR_CASE(CELL_JPGDEC_ERROR_HEADER); + STR_CASE(CELL_JPGDEC_ERROR_STREAM_FORMAT); + STR_CASE(CELL_JPGDEC_ERROR_ARG); + STR_CASE(CELL_JPGDEC_ERROR_SEQ); + STR_CASE(CELL_JPGDEC_ERROR_BUSY); + STR_CASE(CELL_JPGDEC_ERROR_FATAL); + STR_CASE(CELL_JPGDEC_ERROR_OPEN_FILE); + STR_CASE(CELL_JPGDEC_ERROR_SPU_UNSUPPORT); + STR_CASE(CELL_JPGDEC_ERROR_CB_PARAM); + } - return unknown; - }); + return unknown; + }); } error_code cellJpgDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam) @@ -76,7 +76,8 @@ error_code cellJpgDecOpen(u32 mainHandle, vm::ptr subHandle, vm::ptrfileName.get_ptr()); fs::file file_s(real_path); - if (!file_s) return CELL_JPGDEC_ERROR_OPEN_FILE; + if (!file_s) + return CELL_JPGDEC_ERROR_OPEN_FILE; current_subHandle.fileSize = file_s.size(); current_subHandle.fd = idm::make(src->fileName.get_ptr(), std::move(file_s), 0, 0, real_path); @@ -149,7 +150,7 @@ error_code cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr>(buffer.get() + 0) != 0xE0FFD8FF || // Error: Not a valid SOI header - read_from_ptr(buffer.get() + 6) != "JFIF"_u32) // Error: Not a valid JFIF string + read_from_ptr(buffer.get() + 6) != "JFIF"_u32) // Error: Not a valid JFIF string { return CELL_JPGDEC_ERROR_HEADER; } @@ -163,24 +164,24 @@ error_code cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr= fileSize || // Check to protect against segmentation faults - buffer[i] != 0xFF) // Check that we are truly at the start of another block + i += block_length; // Increase the file index to get to the next block + if (i >= fileSize || // Check to protect against segmentation faults + buffer[i] != 0xFF) // Check that we are truly at the start of another block { return CELL_JPGDEC_ERROR_HEADER; } if (buffer[i + 1] == 0xC0) - break; // 0xFFC0 is the "Start of frame" marker which contains the file size + break; // 0xFFC0 is the "Start of frame" marker which contains the file size - i += 2; // Skip the block marker - block_length = buffer[i] * 0xFF + buffer[i + 1]; // Go to the next block + i += 2; // Skip the block marker + block_length = buffer[i] * 0xFF + buffer[i + 1]; // Go to the next block } - current_info.imageWidth = buffer[i + 7] * 0x100 + buffer[i + 8]; - current_info.imageHeight = buffer[i + 5] * 0x100 + buffer[i + 6]; + current_info.imageWidth = buffer[i + 7] * 0x100 + buffer[i + 8]; + current_info.imageHeight = buffer[i + 5] * 0x100 + buffer[i + 6]; current_info.numComponents = 3; // Unimplemented - current_info.colorSpace = CELL_JPG_RGB; + current_info.colorSpace = CELL_JPG_RGB; *info = current_info; @@ -210,7 +211,7 @@ error_code cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr data, const u64& fileSize = subHandle_data->fileSize; const CellJpgDecOutParam& current_outParam = subHandle_data->outParam; - //Copy the JPG file to a buffer + // Copy the JPG file to a buffer std::unique_ptr jpg(new u8[fileSize]); switch (subHandle_data->src.srcSelect) @@ -229,13 +230,11 @@ error_code cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr data, default: break; // TODO } - //Decode JPG file. (TODO: Is there any faster alternative? Can we do it without external libraries?) + // Decode JPG file. (TODO: Is there any faster alternative? Can we do it without external libraries?) int width, height, actual_components; - auto image = std::unique_ptr - ( - stbi_load_from_memory(jpg.get(), ::narrow(fileSize), &width, &height, &actual_components, 4), - &::free - ); + auto image = std::unique_ptr( + stbi_load_from_memory(jpg.get(), ::narrow(fileSize), &width, &height, &actual_components, 4), + &::free); if (!image) return CELL_JPGDEC_ERROR_STREAM_FORMAT; @@ -244,14 +243,14 @@ error_code cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr data, const int bytesPerLine = static_cast(dataCtrlParam->outputBytesPerLine); usz image_size = width * height; - switch(current_outParam.outputColorSpace) + switch (current_outParam.outputColorSpace) { case CELL_JPG_RGB: case CELL_JPG_RGBA: { const char nComponents = current_outParam.outputColorSpace == CELL_JPG_RGBA ? 4 : 3; image_size *= nComponents; - if (bytesPerLine > width * nComponents || flip) //check if we need padding + if (bytesPerLine > width * nComponents || flip) // check if we need padding { const int linesize = std::min(bytesPerLine, width * nComponents); for (int i = 0; i < height; i++) @@ -271,9 +270,9 @@ error_code cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr data, { constexpr int nComponents = 4; image_size *= nComponents; - if (bytesPerLine > width * nComponents || flip) //check if we need padding + if (bytesPerLine > width * nComponents || flip) // check if we need padding { - //TODO: Find out if we can't do padding without an extra copy + // TODO: Find out if we can't do padding without an extra copy const int linesize = std::min(bytesPerLine, width * nComponents); const auto output = std::make_unique(linesize); for (int i = 0; i < height; i++) @@ -346,19 +345,19 @@ error_code cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, vm::cptrinfo; CellJpgDecOutParam& current_outParam = subHandle_data->outParam; - current_outParam.outputWidthByte = (current_info.imageWidth * current_info.numComponents); - current_outParam.outputWidth = current_info.imageWidth; - current_outParam.outputHeight = current_info.imageHeight; + current_outParam.outputWidthByte = (current_info.imageWidth * current_info.numComponents); + current_outParam.outputWidth = current_info.imageWidth; + current_outParam.outputHeight = current_info.imageHeight; current_outParam.outputColorSpace = inParam->outputColorSpace; switch (current_outParam.outputColorSpace) { - case CELL_JPG_GRAYSCALE: current_outParam.outputComponents = 1; break; + case CELL_JPG_GRAYSCALE: current_outParam.outputComponents = 1; break; case CELL_JPG_RGB: - case CELL_JPG_YCbCr: current_outParam.outputComponents = 3; break; + case CELL_JPG_YCbCr: current_outParam.outputComponents = 3; break; - case CELL_JPG_UPSAMPLE_ONLY: current_outParam.outputComponents = current_info.numComponents; break; + case CELL_JPG_UPSAMPLE_ONLY: current_outParam.outputComponents = current_info.numComponents; break; case CELL_JPG_RGBA: case CELL_JPG_ARGB: @@ -368,8 +367,8 @@ error_code cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, vm::cptroutputMode; - current_outParam.downScale = inParam->downScale; + current_outParam.outputMode = inParam->outputMode; + current_outParam.downScale = inParam->downScale; current_outParam.useMemorySpace = 0; // Unimplemented *outParam = current_outParam; @@ -383,20 +382,19 @@ error_code cellJpgDecExtSetParameter() return CELL_OK; } - DECLARE(ppu_module_manager::cellJpgDec)("cellJpgDec", []() -{ - REG_FUNC(cellJpgDec, cellJpgDecCreate); - REG_FUNC(cellJpgDec, cellJpgDecExtCreate); - REG_FUNC(cellJpgDec, cellJpgDecOpen); - REG_FUNC(cellJpgDec, cellJpgDecReadHeader); - REG_FUNC(cellJpgDec, cellJpgDecSetParameter); - REG_FUNC(cellJpgDec, cellJpgDecDecodeData); - REG_FUNC(cellJpgDec, cellJpgDecClose); - REG_FUNC(cellJpgDec, cellJpgDecDestroy); + { + REG_FUNC(cellJpgDec, cellJpgDecCreate); + REG_FUNC(cellJpgDec, cellJpgDecExtCreate); + REG_FUNC(cellJpgDec, cellJpgDecOpen); + REG_FUNC(cellJpgDec, cellJpgDecReadHeader); + REG_FUNC(cellJpgDec, cellJpgDecSetParameter); + REG_FUNC(cellJpgDec, cellJpgDecDecodeData); + REG_FUNC(cellJpgDec, cellJpgDecClose); + REG_FUNC(cellJpgDec, cellJpgDecDestroy); - REG_FUNC(cellJpgDec, cellJpgDecExtOpen); - REG_FUNC(cellJpgDec, cellJpgDecExtReadHeader); - REG_FUNC(cellJpgDec, cellJpgDecExtSetParameter); - REG_FUNC(cellJpgDec, cellJpgDecExtDecodeData); -}); + REG_FUNC(cellJpgDec, cellJpgDecExtOpen); + REG_FUNC(cellJpgDec, cellJpgDecExtReadHeader); + REG_FUNC(cellJpgDec, cellJpgDecExtSetParameter); + REG_FUNC(cellJpgDec, cellJpgDecExtDecodeData); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgDec.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgDec.h index d916a38a3..777f8f5ce 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgDec.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgDec.h @@ -1,42 +1,42 @@ #pragma once -//Return Codes +// Return Codes enum CellJpgDecError : u32 { - CELL_JPGDEC_ERROR_HEADER = 0x80611101, + CELL_JPGDEC_ERROR_HEADER = 0x80611101, CELL_JPGDEC_ERROR_STREAM_FORMAT = 0x80611102, - CELL_JPGDEC_ERROR_ARG = 0x80611103, - CELL_JPGDEC_ERROR_SEQ = 0x80611104, - CELL_JPGDEC_ERROR_BUSY = 0x80611105, - CELL_JPGDEC_ERROR_FATAL = 0x80611106, - CELL_JPGDEC_ERROR_OPEN_FILE = 0x80611107, + CELL_JPGDEC_ERROR_ARG = 0x80611103, + CELL_JPGDEC_ERROR_SEQ = 0x80611104, + CELL_JPGDEC_ERROR_BUSY = 0x80611105, + CELL_JPGDEC_ERROR_FATAL = 0x80611106, + CELL_JPGDEC_ERROR_OPEN_FILE = 0x80611107, CELL_JPGDEC_ERROR_SPU_UNSUPPORT = 0x80611108, - CELL_JPGDEC_ERROR_CB_PARAM = 0x80611109, + CELL_JPGDEC_ERROR_CB_PARAM = 0x80611109, }; enum CellJpgDecColorSpace { - CELL_JPG_UNKNOWN = 0, - CELL_JPG_GRAYSCALE = 1, - CELL_JPG_RGB = 2, - CELL_JPG_YCbCr = 3, - CELL_JPG_RGBA = 10, - CELL_JPG_UPSAMPLE_ONLY = 11, - CELL_JPG_ARGB = 20, + CELL_JPG_UNKNOWN = 0, + CELL_JPG_GRAYSCALE = 1, + CELL_JPG_RGB = 2, + CELL_JPG_YCbCr = 3, + CELL_JPG_RGBA = 10, + CELL_JPG_UPSAMPLE_ONLY = 11, + CELL_JPG_ARGB = 20, CELL_JPG_GRAYSCALE_TO_ALPHA_RGBA = 40, CELL_JPG_GRAYSCALE_TO_ALPHA_ARGB = 41, }; enum CellJpgDecStreamSrcSel { - CELL_JPGDEC_FILE = 0, + CELL_JPGDEC_FILE = 0, CELL_JPGDEC_BUFFER = 1, }; enum CellJpgDecDecodeStatus { CELL_JPGDEC_DEC_STATUS_FINISH = 0, // Decoding finished - CELL_JPGDEC_DEC_STATUS_STOP = 1, // Decoding halted + CELL_JPGDEC_DEC_STATUS_STOP = 1, // Decoding halted }; enum CellJpgDecOutputMode @@ -50,14 +50,14 @@ struct CellJpgDecInfo be_t imageWidth; be_t imageHeight; be_t numComponents; - be_t colorSpace; // CellJpgDecColorSpace + be_t colorSpace; // CellJpgDecColorSpace }; struct CellJpgDecSrc { - be_t srcSelect; // CellJpgDecStreamSrcSel + be_t srcSelect; // CellJpgDecStreamSrcSel vm::bcptr fileName; - be_t fileOffset; // int64_t + be_t fileOffset; // int64_t be_t fileSize; be_t streamPtr; be_t streamSize; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgEnc.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgEnc.cpp index 8bcb1ecd0..fd109a899 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgEnc.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgEnc.cpp @@ -9,26 +9,25 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_JPGENC_ERROR_ARG); - STR_CASE(CELL_JPGENC_ERROR_SEQ); - STR_CASE(CELL_JPGENC_ERROR_BUSY); - STR_CASE(CELL_JPGENC_ERROR_EMPTY); - STR_CASE(CELL_JPGENC_ERROR_RESET); - STR_CASE(CELL_JPGENC_ERROR_FATAL); - STR_CASE(CELL_JPGENC_ERROR_STREAM_ABORT); - STR_CASE(CELL_JPGENC_ERROR_STREAM_SKIP); - STR_CASE(CELL_JPGENC_ERROR_STREAM_OVERFLOW); - STR_CASE(CELL_JPGENC_ERROR_STREAM_FILE_OPEN); - } + switch (error) + { + STR_CASE(CELL_JPGENC_ERROR_ARG); + STR_CASE(CELL_JPGENC_ERROR_SEQ); + STR_CASE(CELL_JPGENC_ERROR_BUSY); + STR_CASE(CELL_JPGENC_ERROR_EMPTY); + STR_CASE(CELL_JPGENC_ERROR_RESET); + STR_CASE(CELL_JPGENC_ERROR_FATAL); + STR_CASE(CELL_JPGENC_ERROR_STREAM_ABORT); + STR_CASE(CELL_JPGENC_ERROR_STREAM_SKIP); + STR_CASE(CELL_JPGENC_ERROR_STREAM_OVERFLOW); + STR_CASE(CELL_JPGENC_ERROR_STREAM_FILE_OPEN); + } - return unknown; - }); + return unknown; + }); } - s32 cellJpgEncQueryAttr() { UNIMPLEMENTED_FUNC(cellJpgEnc); @@ -90,15 +89,15 @@ s32 cellJpgEncReset() } DECLARE(ppu_module_manager::cellJpgEnc)("cellJpgEnc", []() -{ - REG_FUNC(cellJpgEnc, cellJpgEncQueryAttr); - REG_FUNC(cellJpgEnc, cellJpgEncOpen); - REG_FUNC(cellJpgEnc, cellJpgEncOpenEx); - REG_FUNC(cellJpgEnc, cellJpgEncClose); - REG_FUNC(cellJpgEnc, cellJpgEncWaitForInput); - REG_FUNC(cellJpgEnc, cellJpgEncEncodePicture); - REG_FUNC(cellJpgEnc, cellJpgEncEncodePicture2); - REG_FUNC(cellJpgEnc, cellJpgEncWaitForOutput); - REG_FUNC(cellJpgEnc, cellJpgEncGetStreamInfo); - REG_FUNC(cellJpgEnc, cellJpgEncReset); -}); + { + REG_FUNC(cellJpgEnc, cellJpgEncQueryAttr); + REG_FUNC(cellJpgEnc, cellJpgEncOpen); + REG_FUNC(cellJpgEnc, cellJpgEncOpenEx); + REG_FUNC(cellJpgEnc, cellJpgEncClose); + REG_FUNC(cellJpgEnc, cellJpgEncWaitForInput); + REG_FUNC(cellJpgEnc, cellJpgEncEncodePicture); + REG_FUNC(cellJpgEnc, cellJpgEncEncodePicture2); + REG_FUNC(cellJpgEnc, cellJpgEncWaitForOutput); + REG_FUNC(cellJpgEnc, cellJpgEncGetStreamInfo); + REG_FUNC(cellJpgEnc, cellJpgEncReset); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgEnc.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgEnc.h index 2021686fa..74a016714 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgEnc.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellJpgEnc.h @@ -1,13 +1,11 @@ #pragma once - - // Error Codes enum CellJpgEncError : u32 { - CELL_JPGENC_ERROR_ARG = 0x80611191, - CELL_JPGENC_ERROR_SEQ = 0x80611192, - CELL_JPGENC_ERROR_BUSY = 0x80611193, + CELL_JPGENC_ERROR_ARG = 0x80611191, + CELL_JPGENC_ERROR_SEQ = 0x80611192, + CELL_JPGENC_ERROR_BUSY = 0x80611193, CELL_JPGENC_ERROR_EMPTY = 0x80611194, CELL_JPGENC_ERROR_RESET = 0x80611195, CELL_JPGENC_ERROR_FATAL = 0x80611196, diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellKb.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellKb.cpp index 0682d32fc..65d500fed 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellKb.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellKb.cpp @@ -13,28 +13,27 @@ extern bool is_input_allowed(); LOG_CHANNEL(cellKb); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_KB_ERROR_FATAL); - STR_CASE(CELL_KB_ERROR_INVALID_PARAMETER); - STR_CASE(CELL_KB_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_KB_ERROR_UNINITIALIZED); - STR_CASE(CELL_KB_ERROR_RESOURCE_ALLOCATION_FAILED); - STR_CASE(CELL_KB_ERROR_READ_FAILED); - STR_CASE(CELL_KB_ERROR_NO_DEVICE); - STR_CASE(CELL_KB_ERROR_SYS_SETTING_FAILED); - } + switch (error) + { + STR_CASE(CELL_KB_ERROR_FATAL); + STR_CASE(CELL_KB_ERROR_INVALID_PARAMETER); + STR_CASE(CELL_KB_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_KB_ERROR_UNINITIALIZED); + STR_CASE(CELL_KB_ERROR_RESOURCE_ALLOCATION_FAILED); + STR_CASE(CELL_KB_ERROR_READ_FAILED); + STR_CASE(CELL_KB_ERROR_NO_DEVICE); + STR_CASE(CELL_KB_ERROR_SYS_SETTING_FAILED); + } - return unknown; - }); + return unknown; + }); } - KeyboardHandlerBase::KeyboardHandlerBase(utils::serial* ar) { if (!ar) @@ -49,11 +48,11 @@ KeyboardHandlerBase::KeyboardHandlerBase(utils::serial* ar) if (max_connect) { Emu.PostponeInitCode([this, max_connect]() - { - std::lock_guard lock(m_mutex); - AddConsumer(keyboard_consumer::identifier::cellKb, max_connect); - auto lk = init.init(); - }); + { + std::lock_guard lock(m_mutex); + AddConsumer(keyboard_consumer::identifier::cellKb, max_connect); + auto lk = init.init(); + }); } } @@ -183,14 +182,21 @@ u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode) if (is_num_lock) { - //if (rawcode == CELL_KEYC_KPAD_NUMLOCK) return 0x00 | CELL_KB_KEYPAD; // 'Num Lock' (unreachable) - if (rawcode == CELL_KEYC_KPAD_SLASH) return 0x2F | CELL_KB_KEYPAD; // '/' - if (rawcode == CELL_KEYC_KPAD_ASTERISK) return 0x2A | CELL_KB_KEYPAD; // '*' - if (rawcode == CELL_KEYC_KPAD_MINUS) return 0x2D | CELL_KB_KEYPAD; // '-' - if (rawcode == CELL_KEYC_KPAD_PLUS) return 0x2B | CELL_KB_KEYPAD; // '+' - if (rawcode == CELL_KEYC_KPAD_ENTER) return 0x0A | CELL_KB_KEYPAD; // '\n' - if (rawcode == CELL_KEYC_KPAD_0) return 0x30 | CELL_KB_KEYPAD; // '0' - if (rawcode >= CELL_KEYC_KPAD_1 && rawcode <= CELL_KEYC_KPAD_9) return (rawcode - 0x28) | CELL_KB_KEYPAD; // '1' - '9' + // if (rawcode == CELL_KEYC_KPAD_NUMLOCK) return 0x00 | CELL_KB_KEYPAD; // 'Num Lock' (unreachable) + if (rawcode == CELL_KEYC_KPAD_SLASH) + return 0x2F | CELL_KB_KEYPAD; // '/' + if (rawcode == CELL_KEYC_KPAD_ASTERISK) + return 0x2A | CELL_KB_KEYPAD; // '*' + if (rawcode == CELL_KEYC_KPAD_MINUS) + return 0x2D | CELL_KB_KEYPAD; // '-' + if (rawcode == CELL_KEYC_KPAD_PLUS) + return 0x2B | CELL_KB_KEYPAD; // '+' + if (rawcode == CELL_KEYC_KPAD_ENTER) + return 0x0A | CELL_KB_KEYPAD; // '\n' + if (rawcode == CELL_KEYC_KPAD_0) + return 0x30 | CELL_KB_KEYPAD; // '0' + if (rawcode >= CELL_KEYC_KPAD_1 && rawcode <= CELL_KEYC_KPAD_9) + return (rawcode - 0x28) | CELL_KB_KEYPAD; // '1' - '9' } // ASCII @@ -211,77 +217,139 @@ u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode) if (arrange == CELL_KB_MAPPING_106) // (Japanese) { - if (rawcode == CELL_KEYC_1) return get_ascii('1', '!'); - if (rawcode == CELL_KEYC_2) return get_ascii('2', '"'); - if (rawcode == CELL_KEYC_3) return get_ascii('3', '#'); - if (rawcode == CELL_KEYC_4) return get_ascii('4', '$'); - if (rawcode == CELL_KEYC_5) return get_ascii('5', '%'); - if (rawcode == CELL_KEYC_6) return get_ascii('6', '&'); - if (rawcode == CELL_KEYC_7) return get_ascii('7', '\''); - if (rawcode == CELL_KEYC_8) return get_ascii('8', '('); - if (rawcode == CELL_KEYC_9) return get_ascii('9', ')'); - if (rawcode == CELL_KEYC_0) return get_ascii('0', '~'); + if (rawcode == CELL_KEYC_1) + return get_ascii('1', '!'); + if (rawcode == CELL_KEYC_2) + return get_ascii('2', '"'); + if (rawcode == CELL_KEYC_3) + return get_ascii('3', '#'); + if (rawcode == CELL_KEYC_4) + return get_ascii('4', '$'); + if (rawcode == CELL_KEYC_5) + return get_ascii('5', '%'); + if (rawcode == CELL_KEYC_6) + return get_ascii('6', '&'); + if (rawcode == CELL_KEYC_7) + return get_ascii('7', '\''); + if (rawcode == CELL_KEYC_8) + return get_ascii('8', '('); + if (rawcode == CELL_KEYC_9) + return get_ascii('9', ')'); + if (rawcode == CELL_KEYC_0) + return get_ascii('0', '~'); - if (rawcode == CELL_KEYC_ACCENT_CIRCONFLEX_106) return get_ascii('^', '~'); - if (rawcode == CELL_KEYC_ATMARK_106) return get_ascii('@', '`'); - if (rawcode == CELL_KEYC_LEFT_BRACKET_106) return get_ascii('[', '{'); - if (rawcode == CELL_KEYC_RIGHT_BRACKET_106) return get_ascii(']', '}'); - if (rawcode == CELL_KEYC_SEMICOLON) return get_ascii(';', '+'); - if (rawcode == CELL_KEYC_COLON_106) return get_ascii(':', '*'); - if (rawcode == CELL_KEYC_COMMA) return get_ascii(',', '<'); - if (rawcode == CELL_KEYC_PERIOD) return get_ascii('.', '>'); - if (rawcode == CELL_KEYC_SLASH) return get_ascii('/', '?'); - if (rawcode == CELL_KEYC_BACKSLASH_106) return get_ascii('\\', '_'); - if (rawcode == CELL_KEYC_YEN_106) return get_ascii(190, '|'); // ¥ + if (rawcode == CELL_KEYC_ACCENT_CIRCONFLEX_106) + return get_ascii('^', '~'); + if (rawcode == CELL_KEYC_ATMARK_106) + return get_ascii('@', '`'); + if (rawcode == CELL_KEYC_LEFT_BRACKET_106) + return get_ascii('[', '{'); + if (rawcode == CELL_KEYC_RIGHT_BRACKET_106) + return get_ascii(']', '}'); + if (rawcode == CELL_KEYC_SEMICOLON) + return get_ascii(';', '+'); + if (rawcode == CELL_KEYC_COLON_106) + return get_ascii(':', '*'); + if (rawcode == CELL_KEYC_COMMA) + return get_ascii(',', '<'); + if (rawcode == CELL_KEYC_PERIOD) + return get_ascii('.', '>'); + if (rawcode == CELL_KEYC_SLASH) + return get_ascii('/', '?'); + if (rawcode == CELL_KEYC_BACKSLASH_106) + return get_ascii('\\', '_'); + if (rawcode == CELL_KEYC_YEN_106) + return get_ascii(190, '|'); // ¥ } else if (arrange == CELL_KB_MAPPING_101) // (US) { - if (rawcode == CELL_KEYC_1) return get_ascii('1', '!'); - if (rawcode == CELL_KEYC_2) return get_ascii('2', '@'); - if (rawcode == CELL_KEYC_3) return get_ascii('3', '#'); - if (rawcode == CELL_KEYC_4) return get_ascii('4', '$'); - if (rawcode == CELL_KEYC_5) return get_ascii('5', '%'); - if (rawcode == CELL_KEYC_6) return get_ascii('6', '^'); - if (rawcode == CELL_KEYC_7) return get_ascii('7', '&'); - if (rawcode == CELL_KEYC_8) return get_ascii('8', '*'); - if (rawcode == CELL_KEYC_9) return get_ascii('9', '('); - if (rawcode == CELL_KEYC_0) return get_ascii('0', ')'); + if (rawcode == CELL_KEYC_1) + return get_ascii('1', '!'); + if (rawcode == CELL_KEYC_2) + return get_ascii('2', '@'); + if (rawcode == CELL_KEYC_3) + return get_ascii('3', '#'); + if (rawcode == CELL_KEYC_4) + return get_ascii('4', '$'); + if (rawcode == CELL_KEYC_5) + return get_ascii('5', '%'); + if (rawcode == CELL_KEYC_6) + return get_ascii('6', '^'); + if (rawcode == CELL_KEYC_7) + return get_ascii('7', '&'); + if (rawcode == CELL_KEYC_8) + return get_ascii('8', '*'); + if (rawcode == CELL_KEYC_9) + return get_ascii('9', '('); + if (rawcode == CELL_KEYC_0) + return get_ascii('0', ')'); - if (rawcode == CELL_KEYC_MINUS) return get_ascii('-', '_'); - if (rawcode == CELL_KEYC_EQUAL_101) return get_ascii('=', '+'); - if (rawcode == CELL_KEYC_LEFT_BRACKET_101) return get_ascii('[', '{'); - if (rawcode == CELL_KEYC_RIGHT_BRACKET_101) return get_ascii(']', '}'); - if (rawcode == CELL_KEYC_BACKSLASH_101) return get_ascii('\\', '|'); - if (rawcode == CELL_KEYC_SEMICOLON) return get_ascii(';', ':'); - if (rawcode == CELL_KEYC_QUOTATION_101) return get_ascii('\'', '"'); - if (rawcode == CELL_KEYC_COMMA) return get_ascii(',', '<'); - if (rawcode == CELL_KEYC_PERIOD) return get_ascii('.', '>'); - if (rawcode == CELL_KEYC_SLASH) return get_ascii('/', '?'); - if (rawcode == CELL_KEYC_BACK_QUOTE) return get_ascii('`', '~'); + if (rawcode == CELL_KEYC_MINUS) + return get_ascii('-', '_'); + if (rawcode == CELL_KEYC_EQUAL_101) + return get_ascii('=', '+'); + if (rawcode == CELL_KEYC_LEFT_BRACKET_101) + return get_ascii('[', '{'); + if (rawcode == CELL_KEYC_RIGHT_BRACKET_101) + return get_ascii(']', '}'); + if (rawcode == CELL_KEYC_BACKSLASH_101) + return get_ascii('\\', '|'); + if (rawcode == CELL_KEYC_SEMICOLON) + return get_ascii(';', ':'); + if (rawcode == CELL_KEYC_QUOTATION_101) + return get_ascii('\'', '"'); + if (rawcode == CELL_KEYC_COMMA) + return get_ascii(',', '<'); + if (rawcode == CELL_KEYC_PERIOD) + return get_ascii('.', '>'); + if (rawcode == CELL_KEYC_SLASH) + return get_ascii('/', '?'); + if (rawcode == CELL_KEYC_BACK_QUOTE) + return get_ascii('`', '~'); } else if (arrange == CELL_KB_MAPPING_GERMAN_GERMANY) { - if (rawcode == CELL_KEYC_1) return get_ascii('1', '!'); - if (rawcode == CELL_KEYC_2) return get_ascii('2', '"'); - if (rawcode == CELL_KEYC_3) return get_ascii('3', 245); // § - if (rawcode == CELL_KEYC_4) return get_ascii('4', '$'); - if (rawcode == CELL_KEYC_5) return get_ascii('5', '%'); - if (rawcode == CELL_KEYC_6) return get_ascii('6', '&'); - if (rawcode == CELL_KEYC_7) return get_ascii('7', '/', '{'); - if (rawcode == CELL_KEYC_8) return get_ascii('8', '(', '['); - if (rawcode == CELL_KEYC_9) return get_ascii('9', ')', ']'); - if (rawcode == CELL_KEYC_0) return get_ascii('0', '=', '}'); + if (rawcode == CELL_KEYC_1) + return get_ascii('1', '!'); + if (rawcode == CELL_KEYC_2) + return get_ascii('2', '"'); + if (rawcode == CELL_KEYC_3) + return get_ascii('3', 245); // § + if (rawcode == CELL_KEYC_4) + return get_ascii('4', '$'); + if (rawcode == CELL_KEYC_5) + return get_ascii('5', '%'); + if (rawcode == CELL_KEYC_6) + return get_ascii('6', '&'); + if (rawcode == CELL_KEYC_7) + return get_ascii('7', '/', '{'); + if (rawcode == CELL_KEYC_8) + return get_ascii('8', '(', '['); + if (rawcode == CELL_KEYC_9) + return get_ascii('9', ')', ']'); + if (rawcode == CELL_KEYC_0) + return get_ascii('0', '=', '}'); - if (rawcode == CELL_KEYC_MINUS) return get_ascii('-', '_'); - if (rawcode == CELL_KEYC_ACCENT_CIRCONFLEX_106) return get_ascii('^', 248); // ° - if (rawcode == CELL_KEYC_COMMA) return get_ascii(',', ';'); - if (rawcode == CELL_KEYC_PERIOD) return get_ascii('.', ':'); - if (rawcode == CELL_KEYC_KPAD_PLUS) return get_ascii('+', '*', '~'); - if (rawcode == CELL_KEYC_LESS) return get_ascii('<', '>', '|'); - if (rawcode == CELL_KEYC_HASHTAG) return get_ascii('#', '\''); - if (rawcode == CELL_KEYC_SSHARP) return get_ascii(225, '?', '\\'); // ß - if (rawcode == CELL_KEYC_BACK_QUOTE) return get_ascii(239, '`'); // ´ - if (rawcode == CELL_KEYC_Q) return get_ascii('q', 'Q', '@'); + if (rawcode == CELL_KEYC_MINUS) + return get_ascii('-', '_'); + if (rawcode == CELL_KEYC_ACCENT_CIRCONFLEX_106) + return get_ascii('^', 248); // ° + if (rawcode == CELL_KEYC_COMMA) + return get_ascii(',', ';'); + if (rawcode == CELL_KEYC_PERIOD) + return get_ascii('.', ':'); + if (rawcode == CELL_KEYC_KPAD_PLUS) + return get_ascii('+', '*', '~'); + if (rawcode == CELL_KEYC_LESS) + return get_ascii('<', '>', '|'); + if (rawcode == CELL_KEYC_HASHTAG) + return get_ascii('#', '\''); + if (rawcode == CELL_KEYC_SSHARP) + return get_ascii(225, '?', '\\'); // ß + if (rawcode == CELL_KEYC_BACK_QUOTE) + return get_ascii(239, '`'); // ´ + if (rawcode == CELL_KEYC_Q) + return get_ascii('q', 'Q', '@'); } if (rawcode >= CELL_KEYC_A && rawcode <= CELL_KEYC_Z) // 'A' - 'Z' @@ -293,13 +361,19 @@ u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode) return rawcode + 0x5D; // Return lowercase if none or both are active. } - if (rawcode >= CELL_KEYC_1 && rawcode <= CELL_KEYC_9) return rawcode + 0x13; // '1' - '9' - if (rawcode == CELL_KEYC_0) return 0x30; // '0' - if (rawcode == CELL_KEYC_ENTER) return 0x0A; // '\n' - //if (rawcode == CELL_KEYC_ESC) return 0x1B; // 'ESC' (unreachable) - if (rawcode == CELL_KEYC_BS) return 0x08; // '\b' - if (rawcode == CELL_KEYC_TAB) return 0x09; // '\t' - if (rawcode == CELL_KEYC_SPACE) return 0x20; // 'space' + if (rawcode >= CELL_KEYC_1 && rawcode <= CELL_KEYC_9) + return rawcode + 0x13; // '1' - '9' + if (rawcode == CELL_KEYC_0) + return 0x30; // '0' + if (rawcode == CELL_KEYC_ENTER) + return 0x0A; // '\n' + // if (rawcode == CELL_KEYC_ESC) return 0x1B; // 'ESC' (unreachable) + if (rawcode == CELL_KEYC_BS) + return 0x08; // '\b' + if (rawcode == CELL_KEYC_TAB) + return 0x09; // '\t' + if (rawcode == CELL_KEYC_SPACE) + return 0x20; // 'space' // TODO: Add more keys and layouts diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellKb.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellKb.h index b2911edfd..a1af349b1 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellKb.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellKb.h @@ -4,21 +4,21 @@ enum CellKbError : u32 { - CELL_KB_ERROR_FATAL = 0x80121001, - CELL_KB_ERROR_INVALID_PARAMETER = 0x80121002, - CELL_KB_ERROR_ALREADY_INITIALIZED = 0x80121003, - CELL_KB_ERROR_UNINITIALIZED = 0x80121004, + CELL_KB_ERROR_FATAL = 0x80121001, + CELL_KB_ERROR_INVALID_PARAMETER = 0x80121002, + CELL_KB_ERROR_ALREADY_INITIALIZED = 0x80121003, + CELL_KB_ERROR_UNINITIALIZED = 0x80121004, CELL_KB_ERROR_RESOURCE_ALLOCATION_FAILED = 0x80121005, - CELL_KB_ERROR_READ_FAILED = 0x80121006, - CELL_KB_ERROR_NO_DEVICE = 0x80121007, - CELL_KB_ERROR_SYS_SETTING_FAILED = 0x80121008, + CELL_KB_ERROR_READ_FAILED = 0x80121006, + CELL_KB_ERROR_NO_DEVICE = 0x80121007, + CELL_KB_ERROR_SYS_SETTING_FAILED = 0x80121008, }; enum CellKbLedMode { CELL_KB_LED_MODE_MANUAL = 0, - CELL_KB_LED_MODE_AUTO1 = 1, - CELL_KB_LED_MODE_AUTO2 = 2, + CELL_KB_LED_MODE_AUTO1 = 1, + CELL_KB_LED_MODE_AUTO2 = 2, }; enum @@ -29,8 +29,8 @@ enum enum { - CELL_KB_ARRANGEMENT_101 = CELL_KB_MAPPING_101, - CELL_KB_ARRANGEMENT_106 = CELL_KB_MAPPING_106, + CELL_KB_ARRANGEMENT_101 = CELL_KB_MAPPING_101, + CELL_KB_ARRANGEMENT_106 = CELL_KB_MAPPING_106, CELL_KB_ARRANGEMENT_106_KANA = CELL_KB_MAPPING_106_KANA, }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellKey2char.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellKey2char.cpp index ba09a702b..d0257bc79 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellKey2char.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellKey2char.cpp @@ -7,19 +7,19 @@ LOG_CHANNEL(cellKey2char); // Return Codes enum CellKey2CharError : u32 { - CELL_K2C_ERROR_FATAL = 0x80121301, - CELL_K2C_ERROR_INVALID_HANDLE = 0x80121302, - CELL_K2C_ERROR_INVALID_PARAMETER = 0x80121303, + CELL_K2C_ERROR_FATAL = 0x80121301, + CELL_K2C_ERROR_INVALID_HANDLE = 0x80121302, + CELL_K2C_ERROR_INVALID_PARAMETER = 0x80121303, CELL_K2C_ERROR_ALREADY_INITIALIZED = 0x80121304, - CELL_K2C_ERROR_UNINITIALIZED = 0x80121305, - CELL_K2C_ERROR_OTHER = 0x80121306, + CELL_K2C_ERROR_UNINITIALIZED = 0x80121305, + CELL_K2C_ERROR_OTHER = 0x80121306, }; // Modes enum { CELL_KEY2CHAR_MODE_ENGLISH = 0, - CELL_KEY2CHAR_MODE_NATIVE = 1, + CELL_KEY2CHAR_MODE_NATIVE = 1, CELL_KEY2CHAR_MODE_NATIVE2 = 2 }; @@ -41,23 +41,23 @@ struct CellKey2CharHandle u8 data[SCE_KEY2CHAR_HANDLE_SIZE]; }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_K2C_ERROR_FATAL); - STR_CASE(CELL_K2C_ERROR_INVALID_HANDLE); - STR_CASE(CELL_K2C_ERROR_INVALID_PARAMETER); - STR_CASE(CELL_K2C_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_K2C_ERROR_UNINITIALIZED); - STR_CASE(CELL_K2C_ERROR_OTHER); - } + switch (error) + { + STR_CASE(CELL_K2C_ERROR_FATAL); + STR_CASE(CELL_K2C_ERROR_INVALID_HANDLE); + STR_CASE(CELL_K2C_ERROR_INVALID_PARAMETER); + STR_CASE(CELL_K2C_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_K2C_ERROR_UNINITIALIZED); + STR_CASE(CELL_K2C_ERROR_OTHER); + } - return unknown; - }); + return unknown; + }); } error_code cellKey2CharOpen(vm::ptr handle) @@ -184,10 +184,10 @@ error_code cellKey2CharSetArrangement(vm::ptr handle, s32 ar } DECLARE(ppu_module_manager::cellKey2char)("cellKey2char", []() -{ - REG_FUNC(cellKey2char, cellKey2CharOpen); - REG_FUNC(cellKey2char, cellKey2CharClose); - REG_FUNC(cellKey2char, cellKey2CharGetChar); - REG_FUNC(cellKey2char, cellKey2CharSetMode); - REG_FUNC(cellKey2char, cellKey2CharSetArrangement); -}); + { + REG_FUNC(cellKey2char, cellKey2CharOpen); + REG_FUNC(cellKey2char, cellKey2CharClose); + REG_FUNC(cellKey2char, cellKey2CharGetChar); + REG_FUNC(cellKey2char, cellKey2CharSetMode); + REG_FUNC(cellKey2char, cellKey2CharSetArrangement); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellL10n.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellL10n.cpp index 6b3ffc444..38e405c0f 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellL10n.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellL10n.cpp @@ -3,7 +3,7 @@ #include "Emu/Memory/vm_ref.h" #ifdef _WIN32 -#include +#include #endif #ifdef _WIN32 @@ -11,7 +11,7 @@ typedef int HostCode; #else #include #include -typedef const char *HostCode; +typedef const char* HostCode; #endif #include "cellL10n.h" @@ -24,125 +24,133 @@ bool _L10nCodeParse(s32 code, HostCode& retCode) { #ifdef _WIN32 retCode = 0; - if ((code >= _L10N_CODE_) || (code < 0)) return false; + if ((code >= _L10N_CODE_) || (code < 0)) + return false; switch (code) { - case L10N_UTF8: retCode = 65001; return false; - case L10N_UTF16: retCode = 1200; return false; // 1200=LE,1201=BE - case L10N_UTF32: retCode = 12000; return false; // 12000=LE,12001=BE - case L10N_UCS2: retCode = 1200; return false; // Not in OEM, but just the same as UTF16 - case L10N_UCS4: retCode = 12000; return false; // Not in OEM, but just the same as UTF32 - //All OEM Code Pages are Multi-Byte, not wchar_t,u16,u32. - case L10N_ISO_8859_1: retCode = 28591; return true; - case L10N_ISO_8859_2: retCode = 28592; return true; - case L10N_ISO_8859_3: retCode = 28593; return true; - case L10N_ISO_8859_4: retCode = 28594; return true; - case L10N_ISO_8859_5: retCode = 28595; return true; - case L10N_ISO_8859_6: retCode = 28596; return true; - case L10N_ISO_8859_7: retCode = 28597; return true; - case L10N_ISO_8859_8: retCode = 28598; return true; - case L10N_ISO_8859_9: retCode = 28599; return true; - case L10N_ISO_8859_10: retCode = 28600; return true; - case L10N_ISO_8859_11: retCode = 28601; return true; - case L10N_ISO_8859_13: retCode = 28603; return true; // No ISO-8859-12 ha ha. - case L10N_ISO_8859_14: retCode = 28604; return true; - case L10N_ISO_8859_15: retCode = 28605; return true; - case L10N_ISO_8859_16: retCode = 28606; return true; - case L10N_CODEPAGE_437: retCode = 437; return true; - case L10N_CODEPAGE_850: retCode = 850; return true; - case L10N_CODEPAGE_863: retCode = 863; return true; - case L10N_CODEPAGE_866: retCode = 866; return true; - case L10N_CODEPAGE_932: retCode = 932; return true; - case L10N_CODEPAGE_936: retCode = 936; return true; // GBK - case L10N_CODEPAGE_949: retCode = 949; return true; // UHC - case L10N_CODEPAGE_950: retCode = 950; return true; - case L10N_CODEPAGE_1251: retCode = 1251; return true; // CYRL - case L10N_CODEPAGE_1252: retCode = 1252; return true; // ANSI - case L10N_EUC_CN: retCode = 51936; return true; // GB2312 - case L10N_EUC_JP: retCode = 51932; return true; - case L10N_EUC_KR: retCode = 51949; return true; - case L10N_ISO_2022_JP: retCode = 50222; return true; + case L10N_UTF8: retCode = 65001; return false; + case L10N_UTF16: retCode = 1200; return false; // 1200=LE,1201=BE + case L10N_UTF32: retCode = 12000; return false; // 12000=LE,12001=BE + case L10N_UCS2: retCode = 1200; return false; // Not in OEM, but just the same as UTF16 + case L10N_UCS4: + retCode = 12000; + return false; // Not in OEM, but just the same as UTF32 + // All OEM Code Pages are Multi-Byte, not wchar_t,u16,u32. + case L10N_ISO_8859_1: retCode = 28591; return true; + case L10N_ISO_8859_2: retCode = 28592; return true; + case L10N_ISO_8859_3: retCode = 28593; return true; + case L10N_ISO_8859_4: retCode = 28594; return true; + case L10N_ISO_8859_5: retCode = 28595; return true; + case L10N_ISO_8859_6: retCode = 28596; return true; + case L10N_ISO_8859_7: retCode = 28597; return true; + case L10N_ISO_8859_8: retCode = 28598; return true; + case L10N_ISO_8859_9: retCode = 28599; return true; + case L10N_ISO_8859_10: retCode = 28600; return true; + case L10N_ISO_8859_11: retCode = 28601; return true; + case L10N_ISO_8859_13: retCode = 28603; return true; // No ISO-8859-12 ha ha. + case L10N_ISO_8859_14: retCode = 28604; return true; + case L10N_ISO_8859_15: retCode = 28605; return true; + case L10N_ISO_8859_16: retCode = 28606; return true; + case L10N_CODEPAGE_437: retCode = 437; return true; + case L10N_CODEPAGE_850: retCode = 850; return true; + case L10N_CODEPAGE_863: retCode = 863; return true; + case L10N_CODEPAGE_866: retCode = 866; return true; + case L10N_CODEPAGE_932: retCode = 932; return true; + case L10N_CODEPAGE_936: retCode = 936; return true; // GBK + case L10N_CODEPAGE_949: retCode = 949; return true; // UHC + case L10N_CODEPAGE_950: retCode = 950; return true; + case L10N_CODEPAGE_1251: retCode = 1251; return true; // CYRL + case L10N_CODEPAGE_1252: retCode = 1252; return true; // ANSI + case L10N_EUC_CN: retCode = 51936; return true; // GB2312 + case L10N_EUC_JP: retCode = 51932; return true; + case L10N_EUC_KR: retCode = 51949; return true; + case L10N_ISO_2022_JP: retCode = 50222; return true; // Maybe 708/720/864/1256/10004/20420/28596/ - case L10N_ARIB: retCode = 20420; return true; // TODO: think that should be ARABIC. - case L10N_HZ: retCode = 52936; return true; - case L10N_GB18030: retCode = 54936; return true; - case L10N_RIS_506: retCode = 932; return true; // MS_KANJI, TODO: Code page + case L10N_ARIB: retCode = 20420; return true; // TODO: think that should be ARABIC. + case L10N_HZ: retCode = 52936; return true; + case L10N_GB18030: retCode = 54936; return true; + case L10N_RIS_506: + retCode = 932; + return true; // MS_KANJI, TODO: Code page // These are only supported with FW 3.10 and above - case L10N_CODEPAGE_852: retCode = 852; return true; - case L10N_CODEPAGE_1250: retCode = 1250; return true; // EE - case L10N_CODEPAGE_737: retCode = 737; return true; - case L10N_CODEPAGE_1253: retCode = 1253; return true; // Greek - case L10N_CODEPAGE_857: retCode = 857; return true; - case L10N_CODEPAGE_1254: retCode = 1254; return true; // Turk - case L10N_CODEPAGE_775: retCode = 775; return true; - case L10N_CODEPAGE_1257: retCode = 1257; return true; // WINBALTRIM - case L10N_CODEPAGE_855: retCode = 855; return true; - case L10N_CODEPAGE_858: retCode = 858; return true; - case L10N_CODEPAGE_860: retCode = 860; return true; - case L10N_CODEPAGE_861: retCode = 861; return true; - case L10N_CODEPAGE_865: retCode = 865; return true; - case L10N_CODEPAGE_869: retCode = 869; return true; - default: return false; + case L10N_CODEPAGE_852: retCode = 852; return true; + case L10N_CODEPAGE_1250: retCode = 1250; return true; // EE + case L10N_CODEPAGE_737: retCode = 737; return true; + case L10N_CODEPAGE_1253: retCode = 1253; return true; // Greek + case L10N_CODEPAGE_857: retCode = 857; return true; + case L10N_CODEPAGE_1254: retCode = 1254; return true; // Turk + case L10N_CODEPAGE_775: retCode = 775; return true; + case L10N_CODEPAGE_1257: retCode = 1257; return true; // WINBALTRIM + case L10N_CODEPAGE_855: retCode = 855; return true; + case L10N_CODEPAGE_858: retCode = 858; return true; + case L10N_CODEPAGE_860: retCode = 860; return true; + case L10N_CODEPAGE_861: retCode = 861; return true; + case L10N_CODEPAGE_865: retCode = 865; return true; + case L10N_CODEPAGE_869: retCode = 869; return true; + default: return false; } #else - if ((code >= _L10N_CODE_) || (code < 0)) return false; + if ((code >= _L10N_CODE_) || (code < 0)) + return false; switch (code) { // I don't know these Unicode Variants is LB or BE. - case L10N_UTF8: retCode = "UTF-8"; return true; - case L10N_UTF16: retCode = "UTF-16"; return true; - case L10N_UTF32: retCode = "UTF-32"; return true; - case L10N_UCS2: retCode = "UCS-2"; return true; - case L10N_UCS4: retCode = "UCS-4"; return true; - case L10N_ISO_8859_1: retCode = "ISO-8859-1"; return true; - case L10N_ISO_8859_2: retCode = "ISO-8859-2"; return true; - case L10N_ISO_8859_3: retCode = "ISO-8859-3"; return true; - case L10N_ISO_8859_4: retCode = "ISO-8859-4"; return true; - case L10N_ISO_8859_5: retCode = "ISO-8859-5"; return true; - case L10N_ISO_8859_6: retCode = "ISO-8859-6"; return true; - case L10N_ISO_8859_7: retCode = "ISO-8859-7"; return true; - case L10N_ISO_8859_8: retCode = "ISO-8859-8"; return true; - case L10N_ISO_8859_9: retCode = "ISO-8859-9"; return true; - case L10N_ISO_8859_10: retCode = "ISO-8859-10"; return true; - case L10N_ISO_8859_11: retCode = "ISO-8859-11"; return true; - case L10N_ISO_8859_13: retCode = "ISO-8859-13"; return true; // No ISO-8859-12 ha ha. - case L10N_ISO_8859_14: retCode = "ISO-8859-14"; return true; - case L10N_ISO_8859_15: retCode = "ISO-8859-15"; return true; - case L10N_ISO_8859_16: retCode = "ISO-8859-16"; return true; - case L10N_CODEPAGE_437: retCode = "CP437"; return true; - case L10N_CODEPAGE_850: retCode = "CP850"; return true; - case L10N_CODEPAGE_863: retCode = "CP863"; return true; - case L10N_CODEPAGE_866: retCode = "CP866"; return true; - case L10N_CODEPAGE_932: retCode = "CP932"; return true; - case L10N_CODEPAGE_936: retCode = "CP936"; return true; - case L10N_CODEPAGE_949: retCode = "CP949"; return true; - case L10N_CODEPAGE_950: retCode = "CP950"; return true; - case L10N_CODEPAGE_1251: retCode = "CP1251"; return true; // CYRL - case L10N_CODEPAGE_1252: retCode = "CP1252"; return true; // ANSI - case L10N_EUC_CN: retCode = "EUC-CN"; return true; // GB2312 - case L10N_EUC_JP: retCode = "EUC-JP"; return true; - case L10N_EUC_KR: retCode = "EUC-KR"; return true; - case L10N_ISO_2022_JP: retCode = "ISO-2022-JP"; return true; - case L10N_ARIB: retCode = "ARABIC"; return true; // TODO: think that should be ARABIC. - case L10N_HZ: retCode = "HZ"; return true; - case L10N_GB18030: retCode = "GB18030"; return true; - case L10N_RIS_506: retCode = "Shift_JIS"; return true; // MS_KANJI + case L10N_UTF8: retCode = "UTF-8"; return true; + case L10N_UTF16: retCode = "UTF-16"; return true; + case L10N_UTF32: retCode = "UTF-32"; return true; + case L10N_UCS2: retCode = "UCS-2"; return true; + case L10N_UCS4: retCode = "UCS-4"; return true; + case L10N_ISO_8859_1: retCode = "ISO-8859-1"; return true; + case L10N_ISO_8859_2: retCode = "ISO-8859-2"; return true; + case L10N_ISO_8859_3: retCode = "ISO-8859-3"; return true; + case L10N_ISO_8859_4: retCode = "ISO-8859-4"; return true; + case L10N_ISO_8859_5: retCode = "ISO-8859-5"; return true; + case L10N_ISO_8859_6: retCode = "ISO-8859-6"; return true; + case L10N_ISO_8859_7: retCode = "ISO-8859-7"; return true; + case L10N_ISO_8859_8: retCode = "ISO-8859-8"; return true; + case L10N_ISO_8859_9: retCode = "ISO-8859-9"; return true; + case L10N_ISO_8859_10: retCode = "ISO-8859-10"; return true; + case L10N_ISO_8859_11: retCode = "ISO-8859-11"; return true; + case L10N_ISO_8859_13: retCode = "ISO-8859-13"; return true; // No ISO-8859-12 ha ha. + case L10N_ISO_8859_14: retCode = "ISO-8859-14"; return true; + case L10N_ISO_8859_15: retCode = "ISO-8859-15"; return true; + case L10N_ISO_8859_16: retCode = "ISO-8859-16"; return true; + case L10N_CODEPAGE_437: retCode = "CP437"; return true; + case L10N_CODEPAGE_850: retCode = "CP850"; return true; + case L10N_CODEPAGE_863: retCode = "CP863"; return true; + case L10N_CODEPAGE_866: retCode = "CP866"; return true; + case L10N_CODEPAGE_932: retCode = "CP932"; return true; + case L10N_CODEPAGE_936: retCode = "CP936"; return true; + case L10N_CODEPAGE_949: retCode = "CP949"; return true; + case L10N_CODEPAGE_950: retCode = "CP950"; return true; + case L10N_CODEPAGE_1251: retCode = "CP1251"; return true; // CYRL + case L10N_CODEPAGE_1252: retCode = "CP1252"; return true; // ANSI + case L10N_EUC_CN: retCode = "EUC-CN"; return true; // GB2312 + case L10N_EUC_JP: retCode = "EUC-JP"; return true; + case L10N_EUC_KR: retCode = "EUC-KR"; return true; + case L10N_ISO_2022_JP: retCode = "ISO-2022-JP"; return true; + case L10N_ARIB: retCode = "ARABIC"; return true; // TODO: think that should be ARABIC. + case L10N_HZ: retCode = "HZ"; return true; + case L10N_GB18030: retCode = "GB18030"; return true; + case L10N_RIS_506: + retCode = "Shift_JIS"; + return true; // MS_KANJI // These are only supported with FW 3.10 and below - case L10N_CODEPAGE_852: retCode = "CP852"; return true; - case L10N_CODEPAGE_1250: retCode = "CP1250"; return true; // EE - case L10N_CODEPAGE_737: retCode = "CP737"; return true; - case L10N_CODEPAGE_1253: retCode = "CP1253"; return true; // Greek - case L10N_CODEPAGE_857: retCode = "CP857"; return true; - case L10N_CODEPAGE_1254: retCode = "CP1254"; return true; // Turk - case L10N_CODEPAGE_775: retCode = "CP775"; return true; - case L10N_CODEPAGE_1257: retCode = "CP1257"; return true; // WINBALTRIM - case L10N_CODEPAGE_855: retCode = "CP855"; return true; - case L10N_CODEPAGE_858: retCode = "CP858"; return true; - case L10N_CODEPAGE_860: retCode = "CP860"; return true; - case L10N_CODEPAGE_861: retCode = "CP861"; return true; - case L10N_CODEPAGE_865: retCode = "CP865"; return true; - case L10N_CODEPAGE_869: retCode = "CP869"; return true; - default: return false; + case L10N_CODEPAGE_852: retCode = "CP852"; return true; + case L10N_CODEPAGE_1250: retCode = "CP1250"; return true; // EE + case L10N_CODEPAGE_737: retCode = "CP737"; return true; + case L10N_CODEPAGE_1253: retCode = "CP1253"; return true; // Greek + case L10N_CODEPAGE_857: retCode = "CP857"; return true; + case L10N_CODEPAGE_1254: retCode = "CP1254"; return true; // Turk + case L10N_CODEPAGE_775: retCode = "CP775"; return true; + case L10N_CODEPAGE_1257: retCode = "CP1257"; return true; // WINBALTRIM + case L10N_CODEPAGE_855: retCode = "CP855"; return true; + case L10N_CODEPAGE_858: retCode = "CP858"; return true; + case L10N_CODEPAGE_860: retCode = "CP860"; return true; + case L10N_CODEPAGE_861: retCode = "CP861"; return true; + case L10N_CODEPAGE_865: retCode = "CP865"; return true; + case L10N_CODEPAGE_869: retCode = "CP869"; return true; + default: return false; } #endif } @@ -165,7 +173,7 @@ s32 _OEM2Wide(HostCode oem_code, std::string_view src, std::wstring& dst) // Use Code page to transform std::wstring to std::string. s32 _Wide2OEM(HostCode oem_code, std::wstring_view src, std::string& dst) { - //Such length returned should include the '\0' character. + // Such length returned should include the '\0' character. const s32 length = WideCharToMultiByte(oem_code, 0, src.data(), -1, nullptr, 0, nullptr, nullptr); std::vector store(length); @@ -187,10 +195,10 @@ std::string _OemToOem(HostCode src_code, HostCode dst_code, std::string_view str #endif -s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void *dst, s32 *dst_len, [[maybe_unused]] bool allowIncomplete) +s32 _ConvertStr(s32 src_code, const void* src, s32 src_len, s32 dst_code, void* dst, s32* dst_len, [[maybe_unused]] bool allowIncomplete) { - HostCode srcCode = 0, dstCode = 0; //OEM code pages - const bool src_page_converted = _L10nCodeParse(src_code, srcCode); //Check if code is in list. + HostCode srcCode = 0, dstCode = 0; // OEM code pages + const bool src_page_converted = _L10nCodeParse(src_code, srcCode); // Check if code is in list. const bool dst_page_converted = _L10nCodeParse(dst_code, dstCode); if (((!src_page_converted) && (srcCode == 0)) || @@ -200,12 +208,13 @@ s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void * } #ifdef _WIN32 - const std::string_view wrapped_source = std::string_view(static_cast(src), src_len); + const std::string_view wrapped_source = std::string_view(static_cast(src), src_len); const std::string target = _OemToOem(srcCode, dstCode, wrapped_source); if (dst) { - if (target.length() > static_cast(*dst_len)) return DSTExhausted; + if (target.length() > static_cast(*dst_len)) + return DSTExhausted; std::memcpy(dst, target.c_str(), target.length()); } *dst_len = ::narrow(target.size()); @@ -223,13 +232,13 @@ s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void * if (ictd == umax) { if (errno == EILSEQ) - retValue = SRCIllegal; //Invalid multi-byte sequence + retValue = SRCIllegal; // Invalid multi-byte sequence else if (errno == E2BIG) - retValue = DSTExhausted;//Not enough space + retValue = DSTExhausted; // Not enough space else if (errno == EINVAL) { if (allowIncomplete) - *dst_len = -1; // TODO: correct value? + *dst_len = -1; // TODO: correct value? else retValue = SRCIllegal; } @@ -241,7 +250,7 @@ s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void * char buf[16]; while (srcLen > 0) { - //char *bufPtr = buf; + // char *bufPtr = buf; usz bufLeft = sizeof(buf); usz ictd = iconv(ict, utils::bless(&src), &srcLen, utils::bless(&dst), &bufLeft); *dst_len += sizeof(buf) - bufLeft; @@ -252,7 +261,7 @@ s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void * else if (errno == EINVAL) { if (allowIncomplete) - *dst_len = -1; // TODO: correct value? + *dst_len = -1; // TODO: correct value? else retValue = SRCIllegal; } @@ -273,7 +282,7 @@ s32 _L10nConvertStr(s32 src_code, vm::cptr src, vm::cptr src_len, s32 return result; } -s32 _L10nConvertChar(s32 src_code, const void *src, u32 src_len, s32 dst_code, vm::ptr dst, vm::ptr dst_len) +s32 _L10nConvertChar(s32 src_code, const void* src, u32 src_len, s32 dst_code, vm::ptr dst, vm::ptr dst_len) { s32 dstLen = 0x7FFFFFFF; s32 result = _ConvertStr(src_code, src, src_len, dst_code, dst.get_ptr(), &dstLen, true); @@ -441,7 +450,7 @@ s32 jstrnchk(vm::cptr src, s32 src_len) cellL10n.warning("jstrnchk: EUCJP (src=*0x%x, src_len=*0x%x)", src, src_len); r |= L10N_STR_EUCJP; } - else if( ((*src >= 0x81 && *src <= 0x9f) || (*src >= 0xe0 && *src <= 0xfc)) || (*src >= 0x40 && *src <= 0xfc && *src != 0x7f) ) + else if (((*src >= 0x81 && *src <= 0x9f) || (*src >= 0xe0 && *src <= 0xfc)) || (*src >= 0x40 && *src <= 0xfc && *src != 0x7f)) { cellL10n.warning("jstrnchk: SJIS (src=*0x%x, src_len=*0x%x)", src, src_len); r |= L10N_STR_SJIS; @@ -2683,172 +2692,171 @@ s32 UTF8stoUCS2s(vm::cptr src, vm::ptr src_len, vm::ptr dst, vm::p return ConversionOK; } - DECLARE(ppu_module_manager::cellL10n)("cellL10n", []() -{ - 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, 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, 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, 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, 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, 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); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellL10n.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellL10n.h index f255f006e..fdefe4fc9 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellL10n.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellL10n.h @@ -1,7 +1,5 @@ #pragma once - - // L10nResult enum { @@ -15,13 +13,13 @@ enum enum { L10N_STR_UNKNOWN = (1 << 0), - L10N_STR_ASCII = (1 << 1), - L10N_STR_JIS = (1 << 2), - L10N_STR_EUCJP = (1 << 3), - L10N_STR_SJIS = (1 << 4), - L10N_STR_UTF8 = (1 << 5), + L10N_STR_ASCII = (1 << 1), + L10N_STR_JIS = (1 << 2), + L10N_STR_EUCJP = (1 << 3), + L10N_STR_SJIS = (1 << 4), + L10N_STR_UTF8 = (1 << 5), L10N_STR_ILLEGAL = (1 << 16), - L10N_STR_ERROR = (1 << 17), + L10N_STR_ERROR = (1 << 17), }; // CodePages @@ -71,7 +69,7 @@ enum L10N_GB18030, L10N_RIS_506, L10N_MUSIC_SHIFT_JIS = L10N_RIS_506, - //FW 3.10 and below + // FW 3.10 and below L10N_CODEPAGE_852, L10N_CODEPAGE_1250, L10N_CODEPAGE_737, @@ -93,7 +91,7 @@ enum { UTF16_SURROGATES_MASK1 = 0xf800, UTF16_SURROGATES_MASK2 = 0xfc00, - UTF16_SURROGATES = 0xd800, - UTF16_HIGH_SURROGATES = 0xd800, - UTF16_LOW_SURROGATES = 0xdc00, + UTF16_SURROGATES = 0xd800, + UTF16_HIGH_SURROGATES = 0xd800, + UTF16_LOW_SURROGATES = 0xdc00, }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellLibprof.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellLibprof.cpp index ebf96ffa9..087461389 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellLibprof.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellLibprof.cpp @@ -28,9 +28,9 @@ error_code cellUserTraceTerminate() } DECLARE(ppu_module_manager::cellLibprof)("cellLibprof", []() -{ - REG_FUNC(cellLibprof, cellUserTraceInit); - REG_FUNC(cellLibprof, cellUserTraceRegister); - REG_FUNC(cellLibprof, cellUserTraceUnregister); - REG_FUNC(cellLibprof, cellUserTraceTerminate); -}); + { + REG_FUNC(cellLibprof, cellUserTraceInit); + REG_FUNC(cellLibprof, cellUserTraceRegister); + REG_FUNC(cellLibprof, cellUserTraceUnregister); + REG_FUNC(cellLibprof, cellUserTraceTerminate); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellMic.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellMic.cpp index ffe0f73c5..2f1064261 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellMic.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellMic.cpp @@ -20,58 +20,58 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_MICIN_ERROR_ALREADY_INIT); - STR_CASE(CELL_MICIN_ERROR_DEVICE); - STR_CASE(CELL_MICIN_ERROR_NOT_INIT); - STR_CASE(CELL_MICIN_ERROR_PARAM); - STR_CASE(CELL_MICIN_ERROR_PORT_FULL); - STR_CASE(CELL_MICIN_ERROR_ALREADY_OPEN); - STR_CASE(CELL_MICIN_ERROR_NOT_OPEN); - STR_CASE(CELL_MICIN_ERROR_NOT_RUN); - STR_CASE(CELL_MICIN_ERROR_TRANS_EVENT); - STR_CASE(CELL_MICIN_ERROR_OPEN); - STR_CASE(CELL_MICIN_ERROR_SHAREDMEMORY); - STR_CASE(CELL_MICIN_ERROR_MUTEX); - STR_CASE(CELL_MICIN_ERROR_EVENT_QUEUE); - STR_CASE(CELL_MICIN_ERROR_DEVICE_NOT_FOUND); - STR_CASE(CELL_MICIN_ERROR_FATAL); - STR_CASE(CELL_MICIN_ERROR_DEVICE_NOT_SUPPORT); - } + switch (error) + { + STR_CASE(CELL_MICIN_ERROR_ALREADY_INIT); + STR_CASE(CELL_MICIN_ERROR_DEVICE); + STR_CASE(CELL_MICIN_ERROR_NOT_INIT); + STR_CASE(CELL_MICIN_ERROR_PARAM); + STR_CASE(CELL_MICIN_ERROR_PORT_FULL); + STR_CASE(CELL_MICIN_ERROR_ALREADY_OPEN); + STR_CASE(CELL_MICIN_ERROR_NOT_OPEN); + STR_CASE(CELL_MICIN_ERROR_NOT_RUN); + STR_CASE(CELL_MICIN_ERROR_TRANS_EVENT); + STR_CASE(CELL_MICIN_ERROR_OPEN); + STR_CASE(CELL_MICIN_ERROR_SHAREDMEMORY); + STR_CASE(CELL_MICIN_ERROR_MUTEX); + STR_CASE(CELL_MICIN_ERROR_EVENT_QUEUE); + STR_CASE(CELL_MICIN_ERROR_DEVICE_NOT_FOUND); + STR_CASE(CELL_MICIN_ERROR_FATAL); + STR_CASE(CELL_MICIN_ERROR_DEVICE_NOT_SUPPORT); + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_MICIN_ERROR_DSP); - STR_CASE(CELL_MICIN_ERROR_DSP_ASSERT); - STR_CASE(CELL_MICIN_ERROR_DSP_PATH); - STR_CASE(CELL_MICIN_ERROR_DSP_FILE); - STR_CASE(CELL_MICIN_ERROR_DSP_PARAM); - STR_CASE(CELL_MICIN_ERROR_DSP_MEMALLOC); - STR_CASE(CELL_MICIN_ERROR_DSP_POINTER); - STR_CASE(CELL_MICIN_ERROR_DSP_FUNC); - STR_CASE(CELL_MICIN_ERROR_DSP_MEM); - STR_CASE(CELL_MICIN_ERROR_DSP_ALIGN16); - STR_CASE(CELL_MICIN_ERROR_DSP_ALIGN128); - STR_CASE(CELL_MICIN_ERROR_DSP_EAALIGN128); - STR_CASE(CELL_MICIN_ERROR_DSP_LIB_HANDLER); - STR_CASE(CELL_MICIN_ERROR_DSP_LIB_INPARAM); - STR_CASE(CELL_MICIN_ERROR_DSP_LIB_NOSPU); - STR_CASE(CELL_MICIN_ERROR_DSP_LIB_SAMPRATE); - } + switch (error) + { + STR_CASE(CELL_MICIN_ERROR_DSP); + STR_CASE(CELL_MICIN_ERROR_DSP_ASSERT); + STR_CASE(CELL_MICIN_ERROR_DSP_PATH); + STR_CASE(CELL_MICIN_ERROR_DSP_FILE); + STR_CASE(CELL_MICIN_ERROR_DSP_PARAM); + STR_CASE(CELL_MICIN_ERROR_DSP_MEMALLOC); + STR_CASE(CELL_MICIN_ERROR_DSP_POINTER); + STR_CASE(CELL_MICIN_ERROR_DSP_FUNC); + STR_CASE(CELL_MICIN_ERROR_DSP_MEM); + STR_CASE(CELL_MICIN_ERROR_DSP_ALIGN16); + STR_CASE(CELL_MICIN_ERROR_DSP_ALIGN128); + STR_CASE(CELL_MICIN_ERROR_DSP_EAALIGN128); + STR_CASE(CELL_MICIN_ERROR_DSP_LIB_HANDLER); + STR_CASE(CELL_MICIN_ERROR_DSP_LIB_INPARAM); + STR_CASE(CELL_MICIN_ERROR_DSP_LIB_NOSPU); + STR_CASE(CELL_MICIN_ERROR_DSP_LIB_SAMPRATE); + } - return unknown; - }); + return unknown; + }); } namespace fmt @@ -81,7 +81,7 @@ namespace fmt ALCdevice* device{}; ALCenum error{}; }; -} +} // namespace fmt template <> void fmt_class_string::format(std::string& out, u64 arg) @@ -90,7 +90,7 @@ void fmt_class_string::format(std::string& out, u64 arg) #ifndef WITHOUT_OPENAL fmt::append(out, "0x%x='%s'", obj.error, alcGetString(obj.device, obj.error)); #else - fmt::append(out, "0x%x", obj.error); + fmt::append(out, "0x%x", obj.error); #endif } @@ -110,7 +110,10 @@ void mic_context::operator()() std::lock_guard lock(mutex); - if (std::none_of(mic_list.begin(), mic_list.end(), [](const microphone_device& dev) { return dev.is_registered(); })) + if (std::none_of(mic_list.begin(), mic_list.end(), [](const microphone_device& dev) + { + return dev.is_registered(); + })) { timeout = umax; continue; @@ -314,16 +317,15 @@ microphone_device::microphone_device(microphone_handler type) void microphone_device::add_device(const std::string& name) { devices.push_back(mic_device{ - .name = name - }); + .name = name}); } error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, const u32 raw_r, const u8 channels) { - signal_types = type; + signal_types = type; dsp_samplingrate = dsp_r; raw_samplingrate = raw_r; - num_channels = channels; + num_channels = channels; #ifndef WITHOUT_OPENAL // Adjust number of channels depending on microphone type @@ -431,12 +433,15 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co const auto fixup_samplingrate = [this](u32& rate) -> bool { // TODO: The used sample rate may vary for Sony's camera devices - const std::array samplingrates = { rate, 48000u, 32000u, 24000u, 16000u, 12000u, 8000u }; + const std::array samplingrates = {rate, 48000u, 32000u, 24000u, 16000u, 12000u, 8000u}; const auto test_samplingrate = [&samplingrates](const u32& rate) { // TODO: actually check if device supports sampling rates - return std::any_of(samplingrates.cbegin() + 1, samplingrates.cend(), [&rate](const u32& r){ return r == rate; }); + return std::any_of(samplingrates.cbegin() + 1, samplingrates.cend(), [&rate](const u32& r) + { + return r == rate; + }); }; for (u32 samplingrate : samplingrates) @@ -724,7 +729,7 @@ void microphone_device::get_data(const u32 num_samples) { const u32 src_index = index / 2; - tmp_ptr[index] = buf_0[src_index]; + tmp_ptr[index] = buf_0[src_index]; tmp_ptr[index + 1] = buf_0[src_index + 1]; tmp_ptr[index + 2] = buf_1[src_index]; tmp_ptr[index + 3] = buf_1[src_index + 1]; @@ -736,7 +741,7 @@ void microphone_device::get_data(const u32 num_samples) { const u32 src_index = index / 2; - tmp_ptr[index] = buf_0[src_index]; + tmp_ptr[index] = buf_0[src_index]; tmp_ptr[index + 1] = buf_0[src_index + 1]; tmp_ptr[index + 2] = 0; tmp_ptr[index + 3] = 0; @@ -1157,7 +1162,7 @@ error_code cellMicGetSignalState(s32 dev_num, CellMicSignalState sig_state, vm:: return CELL_OK; } -error_code cellMicGetFormatEx(s32 dev_num, vm::ptr format, /*CellMicSignalType*/u32 type) +error_code cellMicGetFormatEx(s32 dev_num, vm::ptr format, /*CellMicSignalType*/ u32 type) { cellMic.trace("cellMicGetFormatEx(dev_num=%d, format=*0x%x, type=0x%x)", dev_num, format, type); @@ -1178,11 +1183,11 @@ error_code cellMicGetFormatEx(s32 dev_num, vm::ptr format, // TODO: type - format->subframeSize = device.get_bit_resolution() / 8; // Probably? + format->subframeSize = device.get_bit_resolution() / 8; // Probably? format->bitResolution = device.get_bit_resolution(); - format->sampleRate = device.get_raw_samplingrate(); - format->channelNum = device.get_num_channels(); - format->dataType = device.get_datatype(); + format->sampleRate = device.get_raw_samplingrate(); + format->channelNum = device.get_num_channels(); + format->dataType = device.get_datatype(); return CELL_OK; } @@ -1289,7 +1294,7 @@ error_code cellMicRemoveNotifyEventQueue(u64 key) /// Reading Functions -error_code cell_mic_read(s32 dev_num, vm::ptr data, s32 max_bytes, /*CellMicSignalType*/u32 type) +error_code cell_mic_read(s32 dev_num, vm::ptr data, s32 max_bytes, /*CellMicSignalType*/ u32 type) { auto& mic_thr = g_fxo->get(); const std::lock_guard lock(mic_thr.mutex); @@ -1442,11 +1447,11 @@ error_code cellMicGetStatus(s32 dev_num, vm::ptr status) status->dsp_samprate = device.get_raw_samplingrate(); status->isStart = device.is_started(); status->isOpen = device.is_opened(); - status->dsp_volume = 5; // TODO: 0 - 5 volume + status->dsp_volume = 5; // TODO: 0 - 5 volume status->local_voice = 10; // TODO: 0 - 10 confidence status->remote_voice = 0; // TODO: 0 - 10 confidence - status->mic_energy = 60; // TODO: Db - status->spk_energy = 60; // TODO: Db + status->mic_energy = 60; // TODO: Db + status->spk_energy = 60; // TODO: Db } return CELL_OK; @@ -1507,47 +1512,47 @@ error_code cellMicSysShareEnd() } DECLARE(ppu_module_manager::cellMic)("cellMic", []() -{ - REG_FUNC(cellMic, cellMicInit); - REG_FUNC(cellMic, cellMicEnd); - REG_FUNC(cellMic, cellMicOpen); - REG_FUNC(cellMic, cellMicClose); - REG_FUNC(cellMic, cellMicGetDeviceGUID); - REG_FUNC(cellMic, cellMicGetType); - REG_FUNC(cellMic, cellMicIsAttached); - REG_FUNC(cellMic, cellMicIsOpen); - REG_FUNC(cellMic, cellMicGetDeviceAttr); - REG_FUNC(cellMic, cellMicSetDeviceAttr); - REG_FUNC(cellMic, cellMicGetSignalAttr); - REG_FUNC(cellMic, cellMicSetSignalAttr); - REG_FUNC(cellMic, cellMicGetSignalState); - REG_FUNC(cellMic, cellMicStart); - REG_FUNC(cellMic, cellMicRead); - REG_FUNC(cellMic, cellMicStop); - REG_FUNC(cellMic, cellMicReset); - REG_FUNC(cellMic, cellMicSetNotifyEventQueue); - REG_FUNC(cellMic, cellMicSetNotifyEventQueue2); - REG_FUNC(cellMic, cellMicRemoveNotifyEventQueue); - REG_FUNC(cellMic, cellMicOpenEx); - REG_FUNC(cellMic, cellMicStartEx); - REG_FUNC(cellMic, cellMicGetFormatRaw); - REG_FUNC(cellMic, cellMicGetFormatAux); - REG_FUNC(cellMic, cellMicGetFormatDsp); - REG_FUNC(cellMic, cellMicOpenRaw); - REG_FUNC(cellMic, cellMicReadRaw); - REG_FUNC(cellMic, cellMicReadAux); - REG_FUNC(cellMic, cellMicReadDsp); - REG_FUNC(cellMic, cellMicGetStatus); - REG_FUNC(cellMic, cellMicStopEx); // this function shouldn't exist - REG_FUNC(cellMic, cellMicSysShareClose); - REG_FUNC(cellMic, cellMicGetFormat); - REG_FUNC(cellMic, cellMicSetMultiMicNotifyEventQueue); - REG_FUNC(cellMic, cellMicGetFormatEx); - REG_FUNC(cellMic, cellMicSysShareStop); - REG_FUNC(cellMic, cellMicSysShareOpen); - REG_FUNC(cellMic, cellMicCommand); - REG_FUNC(cellMic, cellMicSysShareStart); - REG_FUNC(cellMic, cellMicSysShareInit); - REG_FUNC(cellMic, cellMicSysShareEnd); - REG_FUNC(cellMic, cellMicGetDeviceIdentifier); -}); + { + REG_FUNC(cellMic, cellMicInit); + REG_FUNC(cellMic, cellMicEnd); + REG_FUNC(cellMic, cellMicOpen); + REG_FUNC(cellMic, cellMicClose); + REG_FUNC(cellMic, cellMicGetDeviceGUID); + REG_FUNC(cellMic, cellMicGetType); + REG_FUNC(cellMic, cellMicIsAttached); + REG_FUNC(cellMic, cellMicIsOpen); + REG_FUNC(cellMic, cellMicGetDeviceAttr); + REG_FUNC(cellMic, cellMicSetDeviceAttr); + REG_FUNC(cellMic, cellMicGetSignalAttr); + REG_FUNC(cellMic, cellMicSetSignalAttr); + REG_FUNC(cellMic, cellMicGetSignalState); + REG_FUNC(cellMic, cellMicStart); + REG_FUNC(cellMic, cellMicRead); + REG_FUNC(cellMic, cellMicStop); + REG_FUNC(cellMic, cellMicReset); + REG_FUNC(cellMic, cellMicSetNotifyEventQueue); + REG_FUNC(cellMic, cellMicSetNotifyEventQueue2); + REG_FUNC(cellMic, cellMicRemoveNotifyEventQueue); + REG_FUNC(cellMic, cellMicOpenEx); + REG_FUNC(cellMic, cellMicStartEx); + REG_FUNC(cellMic, cellMicGetFormatRaw); + REG_FUNC(cellMic, cellMicGetFormatAux); + REG_FUNC(cellMic, cellMicGetFormatDsp); + REG_FUNC(cellMic, cellMicOpenRaw); + REG_FUNC(cellMic, cellMicReadRaw); + REG_FUNC(cellMic, cellMicReadAux); + REG_FUNC(cellMic, cellMicReadDsp); + REG_FUNC(cellMic, cellMicGetStatus); + REG_FUNC(cellMic, cellMicStopEx); // this function shouldn't exist + REG_FUNC(cellMic, cellMicSysShareClose); + REG_FUNC(cellMic, cellMicGetFormat); + REG_FUNC(cellMic, cellMicSetMultiMicNotifyEventQueue); + REG_FUNC(cellMic, cellMicGetFormatEx); + REG_FUNC(cellMic, cellMicSysShareStop); + REG_FUNC(cellMic, cellMicSysShareOpen); + REG_FUNC(cellMic, cellMicCommand); + REG_FUNC(cellMic, cellMicSysShareStart); + REG_FUNC(cellMic, cellMicSysShareInit); + REG_FUNC(cellMic, cellMicSysShareEnd); + REG_FUNC(cellMic, cellMicGetDeviceIdentifier); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellMic.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellMic.h index f17b95427..2b69893e9 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellMic.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellMic.h @@ -7,21 +7,21 @@ // Error Codes enum CellMicInError : u32 { - CELL_MICIN_ERROR_ALREADY_INIT = 0x80140101, - CELL_MICIN_ERROR_DEVICE = 0x80140102, - CELL_MICIN_ERROR_NOT_INIT = 0x80140103, - CELL_MICIN_ERROR_PARAM = 0x80140104, - CELL_MICIN_ERROR_PORT_FULL = 0x80140105, - CELL_MICIN_ERROR_ALREADY_OPEN = 0x80140106, - CELL_MICIN_ERROR_NOT_OPEN = 0x80140107, - CELL_MICIN_ERROR_NOT_RUN = 0x80140108, - CELL_MICIN_ERROR_TRANS_EVENT = 0x80140109, - CELL_MICIN_ERROR_OPEN = 0x8014010a, - CELL_MICIN_ERROR_SHAREDMEMORY = 0x8014010b, - CELL_MICIN_ERROR_MUTEX = 0x8014010c, - CELL_MICIN_ERROR_EVENT_QUEUE = 0x8014010d, - CELL_MICIN_ERROR_DEVICE_NOT_FOUND = 0x8014010e, - CELL_MICIN_ERROR_FATAL = 0x8014010f, + CELL_MICIN_ERROR_ALREADY_INIT = 0x80140101, + CELL_MICIN_ERROR_DEVICE = 0x80140102, + CELL_MICIN_ERROR_NOT_INIT = 0x80140103, + CELL_MICIN_ERROR_PARAM = 0x80140104, + CELL_MICIN_ERROR_PORT_FULL = 0x80140105, + CELL_MICIN_ERROR_ALREADY_OPEN = 0x80140106, + CELL_MICIN_ERROR_NOT_OPEN = 0x80140107, + CELL_MICIN_ERROR_NOT_RUN = 0x80140108, + CELL_MICIN_ERROR_TRANS_EVENT = 0x80140109, + CELL_MICIN_ERROR_OPEN = 0x8014010a, + CELL_MICIN_ERROR_SHAREDMEMORY = 0x8014010b, + CELL_MICIN_ERROR_MUTEX = 0x8014010c, + CELL_MICIN_ERROR_EVENT_QUEUE = 0x8014010d, + CELL_MICIN_ERROR_DEVICE_NOT_FOUND = 0x8014010e, + CELL_MICIN_ERROR_FATAL = 0x8014010f, CELL_MICIN_ERROR_DEVICE_NOT_SUPPORT = 0x80140110, // CELL_MICIN_ERROR_SYSTEM = CELL_MICIN_ERROR_DEVICE, // CELL_MICIN_ERROR_SYSTEM_NOT_FOUND = CELL_MICIN_ERROR_DEVICE_NOT_FOUND, @@ -30,21 +30,21 @@ enum CellMicInError : u32 enum CellMicInErrorDsp : u32 { - CELL_MICIN_ERROR_DSP = 0x80140200, - CELL_MICIN_ERROR_DSP_ASSERT = 0x80140201, - CELL_MICIN_ERROR_DSP_PATH = 0x80140202, - CELL_MICIN_ERROR_DSP_FILE = 0x80140203, - CELL_MICIN_ERROR_DSP_PARAM = 0x80140204, - CELL_MICIN_ERROR_DSP_MEMALLOC = 0x80140205, - CELL_MICIN_ERROR_DSP_POINTER = 0x80140206, - CELL_MICIN_ERROR_DSP_FUNC = 0x80140207, - CELL_MICIN_ERROR_DSP_MEM = 0x80140208, - CELL_MICIN_ERROR_DSP_ALIGN16 = 0x80140209, - CELL_MICIN_ERROR_DSP_ALIGN128 = 0x8014020a, - CELL_MICIN_ERROR_DSP_EAALIGN128 = 0x8014020b, - CELL_MICIN_ERROR_DSP_LIB_HANDLER = 0x80140216, - CELL_MICIN_ERROR_DSP_LIB_INPARAM = 0x80140217, - CELL_MICIN_ERROR_DSP_LIB_NOSPU = 0x80140218, + CELL_MICIN_ERROR_DSP = 0x80140200, + CELL_MICIN_ERROR_DSP_ASSERT = 0x80140201, + CELL_MICIN_ERROR_DSP_PATH = 0x80140202, + CELL_MICIN_ERROR_DSP_FILE = 0x80140203, + CELL_MICIN_ERROR_DSP_PARAM = 0x80140204, + CELL_MICIN_ERROR_DSP_MEMALLOC = 0x80140205, + CELL_MICIN_ERROR_DSP_POINTER = 0x80140206, + CELL_MICIN_ERROR_DSP_FUNC = 0x80140207, + CELL_MICIN_ERROR_DSP_MEM = 0x80140208, + CELL_MICIN_ERROR_DSP_ALIGN16 = 0x80140209, + CELL_MICIN_ERROR_DSP_ALIGN128 = 0x8014020a, + CELL_MICIN_ERROR_DSP_EAALIGN128 = 0x8014020b, + CELL_MICIN_ERROR_DSP_LIB_HANDLER = 0x80140216, + CELL_MICIN_ERROR_DSP_LIB_INPARAM = 0x80140217, + CELL_MICIN_ERROR_DSP_LIB_NOSPU = 0x80140218, CELL_MICIN_ERROR_DSP_LIB_SAMPRATE = 0x80140219, }; @@ -52,10 +52,10 @@ enum CellMicSignalState : u32 { CELLMIC_SIGSTATE_LOCTALK = 0, CELLMIC_SIGSTATE_FARTALK = 1, - CELLMIC_SIGSTATE_NSR = 3, - CELLMIC_SIGSTATE_AGC = 4, - CELLMIC_SIGSTATE_MICENG = 5, - CELLMIC_SIGSTATE_SPKENG = 6, + CELLMIC_SIGSTATE_NSR = 3, + CELLMIC_SIGSTATE_AGC = 4, + CELLMIC_SIGSTATE_MICENG = 5, + CELLMIC_SIGSTATE_SPKENG = 6, }; enum CellMicCommand @@ -83,40 +83,40 @@ enum CellMicCommand enum CellMicDeviceAttr : u32 { - CELLMIC_DEVATTR_LED = 9, - CELLMIC_DEVATTR_GAIN = 10, - CELLMIC_DEVATTR_VOLUME = 201, - CELLMIC_DEVATTR_AGC = 202, + CELLMIC_DEVATTR_LED = 9, + CELLMIC_DEVATTR_GAIN = 10, + CELLMIC_DEVATTR_VOLUME = 201, + CELLMIC_DEVATTR_AGC = 202, CELLMIC_DEVATTR_CHANVOL = 301, CELLMIC_DEVATTR_DSPTYPE = 302, }; enum CellMicSignalAttr : u32 { - CELLMIC_SIGATTR_BKNGAIN = 0, - CELLMIC_SIGATTR_REVERB = 9, - CELLMIC_SIGATTR_AGCLEVEL = 26, - CELLMIC_SIGATTR_VOLUME = 301, + CELLMIC_SIGATTR_BKNGAIN = 0, + CELLMIC_SIGATTR_REVERB = 9, + CELLMIC_SIGATTR_AGCLEVEL = 26, + CELLMIC_SIGATTR_VOLUME = 301, CELLMIC_SIGATTR_PITCHSHIFT = 331 }; enum CellMicSignalType : u8 { CELLMIC_SIGTYPE_NULL = 0, - CELLMIC_SIGTYPE_DSP = 1, - CELLMIC_SIGTYPE_AUX = 2, - CELLMIC_SIGTYPE_RAW = 4, + CELLMIC_SIGTYPE_DSP = 1, + CELLMIC_SIGTYPE_AUX = 2, + CELLMIC_SIGTYPE_RAW = 4, }; enum CellMicType : s32 { - CELLMIC_TYPE_UNDEF = -1, - CELLMIC_TYPE_UNKNOWN = 0, - CELLMIC_TYPE_EYETOY1 = 1, - CELLMIC_TYPE_EYETOY2 = 2, - CELLMIC_TYPE_USBAUDIO = 3, + CELLMIC_TYPE_UNDEF = -1, + CELLMIC_TYPE_UNKNOWN = 0, + CELLMIC_TYPE_EYETOY1 = 1, + CELLMIC_TYPE_EYETOY2 = 2, + CELLMIC_TYPE_USBAUDIO = 3, CELLMIC_TYPE_BLUETOOTH = 4, - CELLMIC_TYPE_A2DP = 5, + CELLMIC_TYPE_A2DP = 5, }; enum @@ -133,9 +133,9 @@ enum enum : u64 { - SYSMICIN_KEYBASE = 0x8000CA7211071000ULL, + SYSMICIN_KEYBASE = 0x8000CA7211071000ULL, EQUEUE_KEY_MICIN_ACCESSPOINT = 0x8000CA7211072abcULL, - LIBMIC_KEYBASE = 0x8000000000000100ULL, + LIBMIC_KEYBASE = 0x8000000000000100ULL, }; struct CellMicInputFormatI @@ -176,10 +176,8 @@ struct CellMicStatus be_t spk_energy; }; - // --- End of cell definitions --- - template class simple_ringbuf { @@ -276,7 +274,10 @@ public: void add_device(const std::string& name); - void set_registered(bool registered) { mic_registered = registered; }; + void set_registered(bool registered) + { + mic_registered = registered; + }; error_code open_microphone(const u8 type, const u32 dsp_r, const u32 raw_r, const u8 channels = 2); error_code close_microphone(); @@ -284,23 +285,47 @@ public: error_code start_microphone(); error_code stop_microphone(); - std::string get_device_name() const { return devices.empty() ? "" : devices.front().name; } + std::string get_device_name() const + { + return devices.empty() ? "" : devices.front().name; + } void update_audio(); bool has_data() const; f32 calculate_energy_level(); - bool is_registered() const { return mic_registered; } - bool is_opened() const { return mic_opened; } - bool is_started() const { return mic_started; } - u8 get_signal_types() const { return signal_types; } - constexpr u8 get_bit_resolution() const { return bit_resolution; } - u32 get_raw_samplingrate() const { return raw_samplingrate; } - u8 get_num_channels() const { return num_channels; } + bool is_registered() const + { + return mic_registered; + } + bool is_opened() const + { + return mic_opened; + } + bool is_started() const + { + return mic_started; + } + u8 get_signal_types() const + { + return signal_types; + } + constexpr u8 get_bit_resolution() const + { + return bit_resolution; + } + u32 get_raw_samplingrate() const + { + return raw_samplingrate; + } + u8 get_num_channels() const + { + return num_channels; + } u8 get_datatype() const { - switch(device_type) + switch (device_type) { case microphone_handler::real_singstar: case microphone_handler::singstar: @@ -310,16 +335,22 @@ public: } } - u32 read_raw(u8* buf, u32 size) { return rbuf_raw.read_bytes(buf, size); } - u32 read_dsp(u8* buf, u32 size) { return rbuf_dsp.read_bytes(buf, size); } + u32 read_raw(u8* buf, u32 size) + { + return rbuf_raw.read_bytes(buf, size); + } + u32 read_dsp(u8* buf, u32 size) + { + return rbuf_dsp.read_bytes(buf, size); + } // Microphone attributes - u32 attr_gain = 3; // 0 to 5. Default is 3. - u32 attr_volume = 145; // 0 to 241. Default is 145. - u32 attr_agc = 0; // 0 to 241. Default is 0. + u32 attr_gain = 3; // 0 to 5. Default is 3. + u32 attr_volume = 145; // 0 to 241. Default is 145. + u32 attr_agc = 0; // 0 to 241. Default is 0. std::array attr_chanvol = {100, 100}; // 0 to 100. Default is ?. - u32 attr_led = 0; - u32 attr_dsptype = 0; + u32 attr_led = 0; + u32 attr_dsptype = 0; private: template @@ -335,7 +366,7 @@ private: microphone_handler device_type = microphone_handler::null; bool mic_registered = false; - bool mic_opened = false; + bool mic_opened = false; bool mic_started = false; struct mic_device @@ -353,7 +384,7 @@ private: u32 raw_samplingrate = 48000; u32 dsp_samplingrate = 48000; u32 aux_samplingrate = 48000; - u8 num_channels = 2; + u8 num_channels = 2; u8 signal_types = CELLMIC_SIGTYPE_NULL; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellMouse.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellMouse.cpp index 8bf550a63..14d2208f2 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellMouse.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellMouse.cpp @@ -13,25 +13,25 @@ extern bool is_input_allowed(); LOG_CHANNEL(cellMouse); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_MOUSE_ERROR_FATAL); - STR_CASE(CELL_MOUSE_ERROR_INVALID_PARAMETER); - STR_CASE(CELL_MOUSE_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_MOUSE_ERROR_UNINITIALIZED); - STR_CASE(CELL_MOUSE_ERROR_RESOURCE_ALLOCATION_FAILED); - STR_CASE(CELL_MOUSE_ERROR_DATA_READ_FAILED); - STR_CASE(CELL_MOUSE_ERROR_NO_DEVICE); - STR_CASE(CELL_MOUSE_ERROR_SYS_SETTING_FAILED); - } + switch (error) + { + STR_CASE(CELL_MOUSE_ERROR_FATAL); + STR_CASE(CELL_MOUSE_ERROR_INVALID_PARAMETER); + STR_CASE(CELL_MOUSE_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_MOUSE_ERROR_UNINITIALIZED); + STR_CASE(CELL_MOUSE_ERROR_RESOURCE_ALLOCATION_FAILED); + STR_CASE(CELL_MOUSE_ERROR_DATA_READ_FAILED); + STR_CASE(CELL_MOUSE_ERROR_NO_DEVICE); + STR_CASE(CELL_MOUSE_ERROR_SYS_SETTING_FAILED); + } - return unknown; - }); + return unknown; + }); } error_code cellMouseInit(ppu_thread& ppu, u32 max_connect) @@ -135,9 +135,9 @@ error_code cellMouseGetInfo(vm::ptr info) for (u32 i = 0; i < CELL_MAX_MICE; i++) { - info->vendor_id[i] = current_info.vendor_id[i]; + info->vendor_id[i] = current_info.vendor_id[i]; info->product_id[i] = current_info.product_id[i]; - info->status[i] = current_info.status[i]; + info->status[i] = current_info.status[i]; } return CELL_OK; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellMouse.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellMouse.h index 253b4eba7..f8fc69bf5 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellMouse.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellMouse.h @@ -2,21 +2,21 @@ enum CellMouseError : u32 { - CELL_MOUSE_ERROR_FATAL = 0x80121201, - CELL_MOUSE_ERROR_INVALID_PARAMETER = 0x80121202, - CELL_MOUSE_ERROR_ALREADY_INITIALIZED = 0x80121203, - CELL_MOUSE_ERROR_UNINITIALIZED = 0x80121204, + CELL_MOUSE_ERROR_FATAL = 0x80121201, + CELL_MOUSE_ERROR_INVALID_PARAMETER = 0x80121202, + CELL_MOUSE_ERROR_ALREADY_INITIALIZED = 0x80121203, + CELL_MOUSE_ERROR_UNINITIALIZED = 0x80121204, CELL_MOUSE_ERROR_RESOURCE_ALLOCATION_FAILED = 0x80121205, - CELL_MOUSE_ERROR_DATA_READ_FAILED = 0x80121206, - CELL_MOUSE_ERROR_NO_DEVICE = 0x80121207, - CELL_MOUSE_ERROR_SYS_SETTING_FAILED = 0x80121208, + CELL_MOUSE_ERROR_DATA_READ_FAILED = 0x80121206, + CELL_MOUSE_ERROR_NO_DEVICE = 0x80121207, + CELL_MOUSE_ERROR_SYS_SETTING_FAILED = 0x80121208, }; enum { CELL_MOUSE_MAX_DATA_LIST_NUM = 8, - CELL_MOUSE_MAX_CODES = 64, - CELL_MAX_MICE = 127, + CELL_MOUSE_MAX_CODES = 64, + CELL_MAX_MICE = 127, }; struct CellMouseInfo diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp index 2b433e999..91ee21025 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellMsgDialog.cpp @@ -18,28 +18,28 @@ LOG_CHANNEL(cellSysutil); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_MSGDIALOG_ERROR_PARAM); - STR_CASE(CELL_MSGDIALOG_ERROR_DIALOG_NOT_OPENED); - } + switch (error) + { + STR_CASE(CELL_MSGDIALOG_ERROR_PARAM); + STR_CASE(CELL_MSGDIALOG_ERROR_DIALOG_NOT_OPENED); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto src) - { - switch (src) { + switch (src) + { case msg_dialog_source::_cellMsgDialog: return "cellMsgDialog"; case msg_dialog_source::_cellSaveData: return "cellSaveData"; case msg_dialog_source::_cellGame: return "cellGame"; @@ -48,10 +48,10 @@ void fmt_class_string::format(std::string& out, u64 arg) case msg_dialog_source::_sceNpTrophy: return "sceNpTrophy"; case msg_dialog_source::sys_progress: return "sys_progress"; case msg_dialog_source::shader_loading: return "shader_loading"; - } + } - return unknown; - }); + return unknown; + }); } MsgDialogBase::~MsgDialogBase() @@ -166,7 +166,7 @@ error_code open_msg_dialog(bool is_blocking, u32 type, vm::cptr msgString, { cellSysutil.notice("open_msg_dialog(is_blocking=%d, type=0x%x, msgString=%s, source=%s, callback=*0x%x, userData=*0x%x, extParam=*0x%x, return_code=*0x%x)", is_blocking, type, msgString, source, callback, userData, extParam, return_code); - const MsgDialogType _type{ type }; + const MsgDialogType _type{type}; if (return_code) { @@ -188,29 +188,29 @@ error_code open_msg_dialog(bool is_blocking, u32 type, vm::cptr msgString, const auto notify = std::make_shared>(0); const auto res = manager->create()->show(is_blocking, msgString.get_ptr(), _type, source, [callback, userData, &return_code, is_blocking, notify](s32 status) - { - if (is_blocking && return_code) { - *return_code = status; - } - - sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0); - - if (callback) - { - sysutil_register_cb([=](ppu_thread& ppu) -> s32 + if (is_blocking && return_code) { - callback(ppu, status, userData); - return CELL_OK; - }); - } + *return_code = status; + } - if (is_blocking && notify) - { - *notify = 1; - notify->notify_one(); - } - }); + sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0); + + if (callback) + { + sysutil_register_cb([=](ppu_thread& ppu) -> s32 + { + callback(ppu, status, userData); + return CELL_OK; + }); + } + + if (is_blocking && notify) + { + *notify = 1; + notify->notify_one(); + } + }); // Wait for on_close while (is_blocking && !Emu.IsStopped() && !*notify) @@ -252,10 +252,10 @@ error_code open_msg_dialog(bool is_blocking, u32 type, vm::cptr msgString, if (callback) { sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - callback(ppu, status, userData); - return CELL_OK; - }); + { + callback(ppu, status, userData); + return CELL_OK; + }); } g_fxo->get().wait_until = 0; @@ -275,10 +275,10 @@ error_code open_msg_dialog(bool is_blocking, u32 type, vm::cptr msgString, // Run asynchronously in GUI thread Emu.CallFromMainThread([&, msg_string = std::move(msg_string)]() - { - dlg->Create(msg_string); - lv2_obj::awake(&ppu); - }); + { + dlg->Create(msg_string); + lv2_obj::awake(&ppu); + }); while (auto state = ppu.state.fetch_sub(cpu_flag::signal)) { @@ -335,7 +335,7 @@ void close_msg_dialog() } } -void exit_game(s32/* buttonType*/, vm::ptr/* userData*/) +void exit_game(s32 /* buttonType*/, vm::ptr /* userData*/) { sysutil_send_system_cmd(CELL_SYSUTIL_REQUEST_EXITGAME, 0); } @@ -351,14 +351,12 @@ error_code open_exit_dialog(const std::string& message, bool is_exit_requested, callback.set(g_fxo->get().func_addr(FIND_FUNC(exit_game))); } - const error_code res = open_msg_dialog - ( + const error_code res = open_msg_dialog( true, CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON, vm::make_str(message), source, - callback - ); + callback); if (res != CELL_OK) { @@ -503,7 +501,7 @@ error_code cellMsgDialogOpenErrorCode(u32 errorCode, vm::ptrget().wait_until = 0; g_fxo->get().remove(); // this shouldn't call on_close - input::SetIntercepted(false); // so we need to reenable the pads here + input::SetIntercepted(false); // so we need to reenable the pads here sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0); return CELL_OK; @@ -624,10 +622,10 @@ error_code cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::cptr m return CELL_MSGDIALOG_ERROR_PARAM; } - Emu.CallFromMainThread([=, msg = std::string{ msgString.get_ptr() }] - { - dlg->ProgressBarSetMsg(progressBarIndex, msg); - }); + Emu.CallFromMainThread([=, msg = std::string{msgString.get_ptr()}] + { + dlg->ProgressBarSetMsg(progressBarIndex, msg); + }); return CELL_OK; } @@ -657,9 +655,9 @@ error_code cellMsgDialogProgressBarReset(u32 progressBarIndex) } Emu.CallFromMainThread([=] - { - dlg->ProgressBarReset(progressBarIndex); - }); + { + dlg->ProgressBarReset(progressBarIndex); + }); return CELL_OK; } @@ -689,9 +687,9 @@ error_code cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta) } Emu.CallFromMainThread([=] - { - dlg->ProgressBarInc(progressBarIndex, delta); - }); + { + dlg->ProgressBarInc(progressBarIndex, delta); + }); return CELL_OK; } diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellMsgDialog.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellMsgDialog.h index 0292c1c62..d24749e05 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellMsgDialog.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellMsgDialog.h @@ -12,57 +12,57 @@ enum { CELL_MSGDIALOG_PROGRESSBAR_STRING_SIZE = 64, - CELL_MSGDIALOG_STRING_SIZE = 512, + CELL_MSGDIALOG_STRING_SIZE = 512, }; enum CellMsgDialogError : u32 { - CELL_MSGDIALOG_ERROR_PARAM = 0x8002b301, + CELL_MSGDIALOG_ERROR_PARAM = 0x8002b301, CELL_MSGDIALOG_ERROR_DIALOG_NOT_OPENED = 0x8002b302, }; enum : u32 { - CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR = 0 << 0, - CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL = 1 << 0, + CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR = 0 << 0, + CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL = 1 << 0, - CELL_MSGDIALOG_TYPE_SE_MUTE_OFF = 0 << 1, - CELL_MSGDIALOG_TYPE_SE_MUTE_ON = 1 << 1, + CELL_MSGDIALOG_TYPE_SE_MUTE_OFF = 0 << 1, + CELL_MSGDIALOG_TYPE_SE_MUTE_ON = 1 << 1, - CELL_MSGDIALOG_TYPE_BG_VISIBLE = 0 << 2, - CELL_MSGDIALOG_TYPE_BG_INVISIBLE = 1 << 2, + CELL_MSGDIALOG_TYPE_BG_VISIBLE = 0 << 2, + CELL_MSGDIALOG_TYPE_BG_INVISIBLE = 1 << 2, - CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE = 0 << 4, - CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO = 1 << 4, - CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK = 2 << 4, + CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE = 0 << 4, + CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO = 1 << 4, + CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK = 2 << 4, - CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF = 0 << 7, - CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON = 1 << 7, + CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF = 0 << 7, + CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON = 1 << 7, CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE = 0 << 8, - CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_YES = 0 << 8, - CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO = 1 << 8, - CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK = 0 << 8, + CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_YES = 0 << 8, + CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO = 1 << 8, + CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK = 0 << 8, - CELL_MSGDIALOG_TYPE_PROGRESSBAR_NONE = 0 << 12, - CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE = 1 << 12, - CELL_MSGDIALOG_TYPE_PROGRESSBAR_DOUBLE = 2 << 12, + CELL_MSGDIALOG_TYPE_PROGRESSBAR_NONE = 0 << 12, + CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE = 1 << 12, + CELL_MSGDIALOG_TYPE_PROGRESSBAR_DOUBLE = 2 << 12, }; // MsgDialog Button Type enum : s32 { - CELL_MSGDIALOG_BUTTON_NONE = -1, + CELL_MSGDIALOG_BUTTON_NONE = -1, CELL_MSGDIALOG_BUTTON_INVALID = 0, - CELL_MSGDIALOG_BUTTON_OK = 1, - CELL_MSGDIALOG_BUTTON_YES = 1, - CELL_MSGDIALOG_BUTTON_NO = 2, - CELL_MSGDIALOG_BUTTON_ESCAPE = 3, + CELL_MSGDIALOG_BUTTON_OK = 1, + CELL_MSGDIALOG_BUTTON_YES = 1, + CELL_MSGDIALOG_BUTTON_NO = 2, + CELL_MSGDIALOG_BUTTON_ESCAPE = 3, }; enum CellMsgDialogProgressBarIndex { - CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE = 0, // the only bar in a single bar dialog + CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE = 0, // the only bar in a single bar dialog CELL_MSGDIALOG_PROGRESSBAR_INDEX_DOUBLE_UPPER = 0, // the upper bar in a double bar dialog CELL_MSGDIALOG_PROGRESSBAR_INDEX_DOUBLE_LOWER = 1, // the lower bar in a double bar dialog }; @@ -112,7 +112,7 @@ protected: s32 taskbar_index = 0; public: - atomic_t state{ MsgDialogState::Close }; + atomic_t state{MsgDialogState::Close}; MsgDialogType type{}; msg_dialog_source source = msg_dialog_source::_cellMsgDialog; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellMusic.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellMusic.cpp index 157cf1906..c48fc8893 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellMusic.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellMusic.cpp @@ -14,54 +14,54 @@ LOG_CHANNEL(cellMusic); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_MUSIC_CANCELED); - STR_CASE(CELL_MUSIC_PLAYBACK_FINISHED); - STR_CASE(CELL_MUSIC_ERROR_PARAM); - STR_CASE(CELL_MUSIC_ERROR_BUSY); - STR_CASE(CELL_MUSIC_ERROR_NO_ACTIVE_CONTENT); - STR_CASE(CELL_MUSIC_ERROR_NO_MATCH_FOUND); - STR_CASE(CELL_MUSIC_ERROR_INVALID_CONTEXT); - STR_CASE(CELL_MUSIC_ERROR_PLAYBACK_FAILURE); - STR_CASE(CELL_MUSIC_ERROR_NO_MORE_CONTENT); - STR_CASE(CELL_MUSIC_DIALOG_OPEN); - STR_CASE(CELL_MUSIC_DIALOG_CLOSE); - STR_CASE(CELL_MUSIC_ERROR_GENERIC); - } + switch (error) + { + STR_CASE(CELL_MUSIC_CANCELED); + STR_CASE(CELL_MUSIC_PLAYBACK_FINISHED); + STR_CASE(CELL_MUSIC_ERROR_PARAM); + STR_CASE(CELL_MUSIC_ERROR_BUSY); + STR_CASE(CELL_MUSIC_ERROR_NO_ACTIVE_CONTENT); + STR_CASE(CELL_MUSIC_ERROR_NO_MATCH_FOUND); + STR_CASE(CELL_MUSIC_ERROR_INVALID_CONTEXT); + STR_CASE(CELL_MUSIC_ERROR_PLAYBACK_FAILURE); + STR_CASE(CELL_MUSIC_ERROR_NO_MORE_CONTENT); + STR_CASE(CELL_MUSIC_DIALOG_OPEN); + STR_CASE(CELL_MUSIC_DIALOG_CLOSE); + STR_CASE(CELL_MUSIC_ERROR_GENERIC); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_MUSIC2_CANCELED); - STR_CASE(CELL_MUSIC2_PLAYBACK_FINISHED); - STR_CASE(CELL_MUSIC2_ERROR_PARAM); - STR_CASE(CELL_MUSIC2_ERROR_BUSY); - STR_CASE(CELL_MUSIC2_ERROR_NO_ACTIVE_CONTENT); - STR_CASE(CELL_MUSIC2_ERROR_NO_MATCH_FOUND); - STR_CASE(CELL_MUSIC2_ERROR_INVALID_CONTEXT); - STR_CASE(CELL_MUSIC2_ERROR_PLAYBACK_FAILURE); - STR_CASE(CELL_MUSIC2_ERROR_NO_MORE_CONTENT); - STR_CASE(CELL_MUSIC2_DIALOG_OPEN); - STR_CASE(CELL_MUSIC2_DIALOG_CLOSE); - STR_CASE(CELL_MUSIC2_ERROR_GENERIC); - } + switch (error) + { + STR_CASE(CELL_MUSIC2_CANCELED); + STR_CASE(CELL_MUSIC2_PLAYBACK_FINISHED); + STR_CASE(CELL_MUSIC2_ERROR_PARAM); + STR_CASE(CELL_MUSIC2_ERROR_BUSY); + STR_CASE(CELL_MUSIC2_ERROR_NO_ACTIVE_CONTENT); + STR_CASE(CELL_MUSIC2_ERROR_NO_MATCH_FOUND); + STR_CASE(CELL_MUSIC2_ERROR_INVALID_CONTEXT); + STR_CASE(CELL_MUSIC2_ERROR_PLAYBACK_FAILURE); + STR_CASE(CELL_MUSIC2_ERROR_NO_MORE_CONTENT); + STR_CASE(CELL_MUSIC2_DIALOG_OPEN); + STR_CASE(CELL_MUSIC2_DIALOG_CLOSE); + STR_CASE(CELL_MUSIC2_ERROR_GENERIC); + } - return unknown; - }); + return unknown; + }); } struct music_state @@ -80,33 +80,33 @@ struct music_state { handler = Emu.GetCallbacks().get_music_handler(); handler->set_status_callback([this](music_handler_base::player_status status) - { - // TODO: disabled until I find a game that uses CELL_MUSIC_EVENT_STATUS_NOTIFICATION - return; - - if (!func) { + // TODO: disabled until I find a game that uses CELL_MUSIC_EVENT_STATUS_NOTIFICATION return; - } - s32 result = CELL_OK; + if (!func) + { + return; + } - switch (status) - { - case music_handler_base::player_status::end_of_media: - result = CELL_MUSIC_PLAYBACK_FINISHED; - break; - default: - return; - } + s32 result = CELL_OK; - sysutil_register_cb([this, &result](ppu_thread& ppu) -> s32 - { - cellMusic.notice("Sending status notification %d", result); - func(ppu, CELL_MUSIC_EVENT_STATUS_NOTIFICATION, vm::addr_t(result), userData); - return CELL_OK; + switch (status) + { + case music_handler_base::player_status::end_of_media: + result = CELL_MUSIC_PLAYBACK_FINISHED; + break; + default: + return; + } + + sysutil_register_cb([this, &result](ppu_thread& ppu) -> s32 + { + cellMusic.notice("Sending status notification %d", result); + func(ppu, CELL_MUSIC_EVENT_STATUS_NOTIFICATION, vm::addr_t(result), userData); + return CELL_OK; + }); }); - }); } music_state(utils::serial& ar) @@ -214,36 +214,36 @@ error_code cell_music_select_contents() [&music](s32 status, utils::media_info info) { sysutil_register_cb([&music, info = std::move(info), status](ppu_thread& ppu) -> s32 - { - std::lock_guard lock(music.mtx); - const u32 result = status >= 0 ? u32{CELL_OK} : u32{CELL_MUSIC_CANCELED}; - if (result == CELL_OK) { - // Let's always choose the whole directory for now - std::string track; - std::string dir = info.path; - if (fs::is_file(info.path)) + std::lock_guard lock(music.mtx); + const u32 result = status >= 0 ? u32{CELL_OK} : u32{CELL_MUSIC_CANCELED}; + if (result == CELL_OK) { - track = std::move(dir); - dir = fs::get_parent_dir(track); - } + // Let's always choose the whole directory for now + std::string track; + std::string dir = info.path; + if (fs::is_file(info.path)) + { + track = std::move(dir); + dir = fs::get_parent_dir(track); + } - music_selection_context context{}; - context.set_playlist(dir); - context.set_track(track); - // TODO: context.repeat_mode = CELL_SEARCH_REPEATMODE_NONE; - // TODO: context.context_option = CELL_SEARCH_CONTEXTOPTION_NONE; - music.current_selection_context = std::move(context); - music.current_selection_context.create_playlist(music_selection_context::get_next_hash()); - cellMusic.success("Media list dialog: selected entry '%s'", music.current_selection_context.playlist.front()); - } - else - { - cellMusic.warning("Media list dialog was canceled"); - } - music.func(ppu, CELL_MUSIC_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(result), music.userData); - return CELL_OK; - }); + music_selection_context context{}; + context.set_playlist(dir); + context.set_track(track); + // TODO: context.repeat_mode = CELL_SEARCH_REPEATMODE_NONE; + // TODO: context.context_option = CELL_SEARCH_CONTEXTOPTION_NONE; + music.current_selection_context = std::move(context); + music.current_selection_context.create_playlist(music_selection_context::get_next_hash()); + cellMusic.success("Media list dialog: selected entry '%s'", music.current_selection_context.playlist.front()); + } + else + { + cellMusic.warning("Media list dialog was canceled"); + } + music.func(ppu, CELL_MUSIC_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(result), music.userData); + return CELL_OK; + }); }); return error; } @@ -282,20 +282,22 @@ error_code cellMusicSetSelectionContext2(vm::ptr cont return CELL_MUSIC2_ERROR_GENERIC; sysutil_register_cb([context = *context, &music](ppu_thread& ppu) -> s32 - { - bool result = false; { - std::lock_guard lock(music.mtx); - result = music.current_selection_context.set(context); - } - const u32 status = result ? u32{CELL_OK} : u32{CELL_MUSIC2_ERROR_INVALID_CONTEXT}; + bool result = false; + { + std::lock_guard lock(music.mtx); + result = music.current_selection_context.set(context); + } + const u32 status = result ? u32{CELL_OK} : u32{CELL_MUSIC2_ERROR_INVALID_CONTEXT}; - if (result) cellMusic.success("cellMusicSetSelectionContext2: new selection context = %s", music.current_selection_context.to_string()); - else cellMusic.todo("cellMusicSetSelectionContext2: failed. context = %s", music_selection_context::context_to_hex(context)); + if (result) + cellMusic.success("cellMusicSetSelectionContext2: new selection context = %s", music.current_selection_context.to_string()); + else + cellMusic.todo("cellMusicSetSelectionContext2: failed. context = %s", music_selection_context::context_to_hex(context)); - music.func(ppu, CELL_MUSIC2_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(status), music.userData); - return CELL_OK; - }); + music.func(ppu, CELL_MUSIC2_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(status), music.userData); + return CELL_OK; + }); return CELL_OK; } @@ -314,10 +316,10 @@ error_code cellMusicSetVolume2(f32 level) music.handler->set_volume(level); sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 - { - music.func(ppu, CELL_MUSIC2_EVENT_SET_VOLUME_RESULT, vm::addr_t(CELL_OK), music.userData); - return CELL_OK; - }); + { + music.func(ppu, CELL_MUSIC2_EVENT_SET_VOLUME_RESULT, vm::addr_t(CELL_OK), music.userData); + return CELL_OK; + }); return CELL_OK; } @@ -354,20 +356,22 @@ error_code cellMusicSetSelectionContext(vm::ptr conte return CELL_MUSIC_ERROR_GENERIC; sysutil_register_cb([context = *context, &music](ppu_thread& ppu) -> s32 - { - bool result = false; { - std::lock_guard lock(music.mtx); - result = music.current_selection_context.set(context); - } - const u32 status = result ? u32{CELL_OK} : u32{CELL_MUSIC_ERROR_INVALID_CONTEXT}; + bool result = false; + { + std::lock_guard lock(music.mtx); + result = music.current_selection_context.set(context); + } + const u32 status = result ? u32{CELL_OK} : u32{CELL_MUSIC_ERROR_INVALID_CONTEXT}; - if (result) cellMusic.success("cellMusicSetSelectionContext: new selection context = %s)", music.current_selection_context.to_string()); - else cellMusic.todo("cellMusicSetSelectionContext: failed. context = %s)", music_selection_context::context_to_hex(context)); + if (result) + cellMusic.success("cellMusicSetSelectionContext: new selection context = %s)", music.current_selection_context.to_string()); + else + cellMusic.todo("cellMusicSetSelectionContext: failed. context = %s)", music_selection_context::context_to_hex(context)); - music.func(ppu, CELL_MUSIC_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(status), music.userData); - return CELL_OK; - }); + music.func(ppu, CELL_MUSIC_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(status), music.userData); + return CELL_OK; + }); return CELL_OK; } @@ -387,10 +391,10 @@ error_code cellMusicInitialize2SystemWorkload(s32 mode, vm::ptr s32 - { - music.func(ppu, CELL_MUSIC2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); - return CELL_OK; - }); + { + music.func(ppu, CELL_MUSIC2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + return CELL_OK; + }); return CELL_OK; } @@ -436,10 +440,10 @@ error_code cellMusicFinalize() if (music.func) { sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 - { - music.func(ppu, CELL_MUSIC_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), music.userData); - return CELL_OK; - }); + { + music.func(ppu, CELL_MUSIC_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), music.userData); + return CELL_OK; + }); } return CELL_OK; @@ -460,10 +464,10 @@ error_code cellMusicInitializeSystemWorkload(s32 mode, u32 container, vm::ptr s32 - { - music.func(ppu, CELL_MUSIC_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); - return CELL_OK; - }); + { + music.func(ppu, CELL_MUSIC_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + return CELL_OK; + }); return CELL_OK; } @@ -483,10 +487,10 @@ error_code cellMusicInitialize(s32 mode, u32 container, s32 spuPriority, vm::ptr music.current_selection_context = {}; sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 - { - music.func(ppu, CELL_MUSIC_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); - return CELL_OK; - }); + { + music.func(ppu, CELL_MUSIC_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + return CELL_OK; + }); return CELL_OK; } @@ -500,10 +504,10 @@ error_code cellMusicFinalize2() if (music.func) { sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 - { - music.func(ppu, CELL_MUSIC2_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), music.userData); - return CELL_OK; - }); + { + music.func(ppu, CELL_MUSIC2_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), music.userData); + return CELL_OK; + }); } return CELL_OK; @@ -566,7 +570,7 @@ error_code cellMusicSetPlaybackCommand2(s32 command, vm::ptr param) auto& music = g_fxo->get(); if (!music.func) - return { CELL_MUSIC2_ERROR_GENERIC, "Not initialized" }; + return {CELL_MUSIC2_ERROR_GENERIC, "Not initialized"}; error_code result = CELL_OK; @@ -576,11 +580,11 @@ error_code cellMusicSetPlaybackCommand2(s32 command, vm::ptr param) } sysutil_register_cb([=, &music, prev_res = result](ppu_thread& ppu) -> s32 - { - const error_code result = prev_res ? prev_res : music.set_playback_command(command); - music.func(ppu, CELL_MUSIC2_EVENT_SET_PLAYBACK_COMMAND_RESULT, vm::addr_t(+result), music.userData); - return CELL_OK; - }); + { + const error_code result = prev_res ? prev_res : music.set_playback_command(command); + music.func(ppu, CELL_MUSIC2_EVENT_SET_PLAYBACK_COMMAND_RESULT, vm::addr_t(+result), music.userData); + return CELL_OK; + }); return result; } @@ -595,7 +599,7 @@ error_code cellMusicSetPlaybackCommand(s32 command, vm::ptr param) auto& music = g_fxo->get(); if (!music.func) - return { CELL_MUSIC_ERROR_GENERIC, "Not initialized" }; + return {CELL_MUSIC_ERROR_GENERIC, "Not initialized"}; error_code result = CELL_OK; @@ -605,11 +609,11 @@ error_code cellMusicSetPlaybackCommand(s32 command, vm::ptr param) } sysutil_register_cb([=, &music, prev_res = result](ppu_thread& ppu) -> s32 - { - const error_code result = prev_res ? prev_res : music.set_playback_command(command); - music.func(ppu, CELL_MUSIC_EVENT_SET_PLAYBACK_COMMAND_RESULT, vm::addr_t(+result), music.userData); - return CELL_OK; - }); + { + const error_code result = prev_res ? prev_res : music.set_playback_command(command); + music.func(ppu, CELL_MUSIC_EVENT_SET_PLAYBACK_COMMAND_RESULT, vm::addr_t(+result), music.userData); + return CELL_OK; + }); return result; } @@ -643,10 +647,10 @@ error_code cellMusicInitialize2(s32 mode, s32 spuPriority, vm::ptr s32 - { - music.func(ppu, CELL_MUSIC2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); - return CELL_OK; - }); + { + music.func(ppu, CELL_MUSIC2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + return CELL_OK; + }); return CELL_OK; } @@ -665,10 +669,10 @@ error_code cellMusicSetVolume(f32 level) music.handler->set_volume(level); sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32 - { - music.func(ppu, CELL_MUSIC_EVENT_SET_VOLUME_RESULT, vm::addr_t(CELL_OK), music.userData); - return CELL_OK; - }); + { + music.func(ppu, CELL_MUSIC_EVENT_SET_VOLUME_RESULT, vm::addr_t(CELL_OK), music.userData); + return CELL_OK; + }); return CELL_OK; } @@ -686,29 +690,28 @@ error_code cellMusicGetVolume2(vm::ptr level) return CELL_OK; } - DECLARE(ppu_module_manager::cellMusic)("cellMusicUtility", []() -{ - REG_FUNC(cellMusicUtility, cellMusicGetSelectionContext); - REG_FUNC(cellMusicUtility, cellMusicSetSelectionContext2); - REG_FUNC(cellMusicUtility, cellMusicSetVolume2); - REG_FUNC(cellMusicUtility, cellMusicGetContentsId); - REG_FUNC(cellMusicUtility, cellMusicSetSelectionContext); - REG_FUNC(cellMusicUtility, cellMusicInitialize2SystemWorkload); - REG_FUNC(cellMusicUtility, cellMusicGetPlaybackStatus2); - REG_FUNC(cellMusicUtility, cellMusicGetContentsId2); - REG_FUNC(cellMusicUtility, cellMusicFinalize); - REG_FUNC(cellMusicUtility, cellMusicInitializeSystemWorkload); - REG_FUNC(cellMusicUtility, cellMusicInitialize); - REG_FUNC(cellMusicUtility, cellMusicFinalize2); - REG_FUNC(cellMusicUtility, cellMusicGetSelectionContext2); - REG_FUNC(cellMusicUtility, cellMusicGetVolume); - REG_FUNC(cellMusicUtility, cellMusicGetPlaybackStatus); - REG_FUNC(cellMusicUtility, cellMusicSetPlaybackCommand2); - REG_FUNC(cellMusicUtility, cellMusicSetPlaybackCommand); - REG_FUNC(cellMusicUtility, cellMusicSelectContents2); - REG_FUNC(cellMusicUtility, cellMusicSelectContents); - REG_FUNC(cellMusicUtility, cellMusicInitialize2); - REG_FUNC(cellMusicUtility, cellMusicSetVolume); - REG_FUNC(cellMusicUtility, cellMusicGetVolume2); -}); + { + REG_FUNC(cellMusicUtility, cellMusicGetSelectionContext); + REG_FUNC(cellMusicUtility, cellMusicSetSelectionContext2); + REG_FUNC(cellMusicUtility, cellMusicSetVolume2); + REG_FUNC(cellMusicUtility, cellMusicGetContentsId); + REG_FUNC(cellMusicUtility, cellMusicSetSelectionContext); + REG_FUNC(cellMusicUtility, cellMusicInitialize2SystemWorkload); + REG_FUNC(cellMusicUtility, cellMusicGetPlaybackStatus2); + REG_FUNC(cellMusicUtility, cellMusicGetContentsId2); + REG_FUNC(cellMusicUtility, cellMusicFinalize); + REG_FUNC(cellMusicUtility, cellMusicInitializeSystemWorkload); + REG_FUNC(cellMusicUtility, cellMusicInitialize); + REG_FUNC(cellMusicUtility, cellMusicFinalize2); + REG_FUNC(cellMusicUtility, cellMusicGetSelectionContext2); + REG_FUNC(cellMusicUtility, cellMusicGetVolume); + REG_FUNC(cellMusicUtility, cellMusicGetPlaybackStatus); + REG_FUNC(cellMusicUtility, cellMusicSetPlaybackCommand2); + REG_FUNC(cellMusicUtility, cellMusicSetPlaybackCommand); + REG_FUNC(cellMusicUtility, cellMusicSelectContents2); + REG_FUNC(cellMusicUtility, cellMusicSelectContents); + REG_FUNC(cellMusicUtility, cellMusicInitialize2); + REG_FUNC(cellMusicUtility, cellMusicSetVolume); + REG_FUNC(cellMusicUtility, cellMusicGetVolume2); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellMusic.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellMusic.h index a98b30501..b7eb376fc 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellMusic.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellMusic.h @@ -7,116 +7,116 @@ // Error Codes enum CellMusicError : u32 { - CELL_MUSIC_CANCELED = 1, - CELL_MUSIC_PLAYBACK_FINISHED = 0x8002c101, - CELL_MUSIC_ERROR_PARAM = 0x8002c102, - CELL_MUSIC_ERROR_BUSY = 0x8002c103, - CELL_MUSIC_ERROR_NO_ACTIVE_CONTENT = 0x8002c104, - CELL_MUSIC_ERROR_NO_MATCH_FOUND = 0x8002c105, - CELL_MUSIC_ERROR_INVALID_CONTEXT = 0x8002c106, - CELL_MUSIC_ERROR_PLAYBACK_FAILURE = 0x8002c107, - CELL_MUSIC_ERROR_NO_MORE_CONTENT = 0x8002c108, - CELL_MUSIC_DIALOG_OPEN = 0x8002c109, - CELL_MUSIC_DIALOG_CLOSE = 0x8002c10a, - CELL_MUSIC_ERROR_GENERIC = 0x8002c1ff, + CELL_MUSIC_CANCELED = 1, + CELL_MUSIC_PLAYBACK_FINISHED = 0x8002c101, + CELL_MUSIC_ERROR_PARAM = 0x8002c102, + CELL_MUSIC_ERROR_BUSY = 0x8002c103, + CELL_MUSIC_ERROR_NO_ACTIVE_CONTENT = 0x8002c104, + CELL_MUSIC_ERROR_NO_MATCH_FOUND = 0x8002c105, + CELL_MUSIC_ERROR_INVALID_CONTEXT = 0x8002c106, + CELL_MUSIC_ERROR_PLAYBACK_FAILURE = 0x8002c107, + CELL_MUSIC_ERROR_NO_MORE_CONTENT = 0x8002c108, + CELL_MUSIC_DIALOG_OPEN = 0x8002c109, + CELL_MUSIC_DIALOG_CLOSE = 0x8002c10a, + CELL_MUSIC_ERROR_GENERIC = 0x8002c1ff, }; enum CellMusic2Error : u32 { - CELL_MUSIC2_CANCELED = 1, - CELL_MUSIC2_PLAYBACK_FINISHED = 0x8002c101, - CELL_MUSIC2_ERROR_PARAM = 0x8002c102, - CELL_MUSIC2_ERROR_BUSY = 0x8002c103, + CELL_MUSIC2_CANCELED = 1, + CELL_MUSIC2_PLAYBACK_FINISHED = 0x8002c101, + CELL_MUSIC2_ERROR_PARAM = 0x8002c102, + CELL_MUSIC2_ERROR_BUSY = 0x8002c103, CELL_MUSIC2_ERROR_NO_ACTIVE_CONTENT = 0x8002c104, - CELL_MUSIC2_ERROR_NO_MATCH_FOUND = 0x8002c105, - CELL_MUSIC2_ERROR_INVALID_CONTEXT = 0x8002c106, - CELL_MUSIC2_ERROR_PLAYBACK_FAILURE = 0x8002c107, - CELL_MUSIC2_ERROR_NO_MORE_CONTENT = 0x8002c108, - CELL_MUSIC2_DIALOG_OPEN = 0x8002c109, - CELL_MUSIC2_DIALOG_CLOSE = 0x8002c10a, - CELL_MUSIC2_ERROR_GENERIC = 0x8002c1ff, + CELL_MUSIC2_ERROR_NO_MATCH_FOUND = 0x8002c105, + CELL_MUSIC2_ERROR_INVALID_CONTEXT = 0x8002c106, + CELL_MUSIC2_ERROR_PLAYBACK_FAILURE = 0x8002c107, + CELL_MUSIC2_ERROR_NO_MORE_CONTENT = 0x8002c108, + CELL_MUSIC2_DIALOG_OPEN = 0x8002c109, + CELL_MUSIC2_DIALOG_CLOSE = 0x8002c10a, + CELL_MUSIC2_ERROR_GENERIC = 0x8002c1ff, }; enum { CELL_SYSUTIL_MUSIC_INITIALIZING_FINISHED = 1, - CELL_SYSUTIL_MUSIC_SHUTDOWN_FINISHED = 4, // Was 3 in 1.03, changed to 4 in 1.1 - CELL_SYSUTIL_MUSIC_LOADING_FINISHED = 5, - CELL_SYSUTIL_MUSIC_UNLOADING_FINISHED = 7, - CELL_SYSUTIL_MUSIC_RELEASED = 9, - CELL_SYSUTIL_MUSIC_GRABBED = 11, + CELL_SYSUTIL_MUSIC_SHUTDOWN_FINISHED = 4, // Was 3 in 1.03, changed to 4 in 1.1 + CELL_SYSUTIL_MUSIC_LOADING_FINISHED = 5, + CELL_SYSUTIL_MUSIC_UNLOADING_FINISHED = 7, + CELL_SYSUTIL_MUSIC_RELEASED = 9, + CELL_SYSUTIL_MUSIC_GRABBED = 11, }; enum { CELL_SYSUTIL_MUSIC2_INITIALIZING_FINISHED = CELL_SYSUTIL_MUSIC_INITIALIZING_FINISHED, - CELL_SYSUTIL_MUSIC2_SHUTDOWN_FINISHED = CELL_SYSUTIL_MUSIC_SHUTDOWN_FINISHED, - CELL_SYSUTIL_MUSIC2_LOADING_FINISHED = CELL_SYSUTIL_MUSIC_LOADING_FINISHED, - CELL_SYSUTIL_MUSIC2_UNLOADING_FINISHED = CELL_SYSUTIL_MUSIC_UNLOADING_FINISHED, - CELL_SYSUTIL_MUSIC2_RELEASED = CELL_SYSUTIL_MUSIC_RELEASED, - CELL_SYSUTIL_MUSIC2_GRABBED = CELL_SYSUTIL_MUSIC_GRABBED, + CELL_SYSUTIL_MUSIC2_SHUTDOWN_FINISHED = CELL_SYSUTIL_MUSIC_SHUTDOWN_FINISHED, + CELL_SYSUTIL_MUSIC2_LOADING_FINISHED = CELL_SYSUTIL_MUSIC_LOADING_FINISHED, + CELL_SYSUTIL_MUSIC2_UNLOADING_FINISHED = CELL_SYSUTIL_MUSIC_UNLOADING_FINISHED, + CELL_SYSUTIL_MUSIC2_RELEASED = CELL_SYSUTIL_MUSIC_RELEASED, + CELL_SYSUTIL_MUSIC2_GRABBED = CELL_SYSUTIL_MUSIC_GRABBED, }; enum { - CELL_MUSIC_EVENT_STATUS_NOTIFICATION = 0, - CELL_MUSIC_EVENT_INITIALIZE_RESULT = 1, - CELL_MUSIC_EVENT_FINALIZE_RESULT = 2, - CELL_MUSIC_EVENT_SELECT_CONTENTS_RESULT = 3, - CELL_MUSIC_EVENT_SET_PLAYBACK_COMMAND_RESULT = 4, - CELL_MUSIC_EVENT_SET_VOLUME_RESULT = 5, + CELL_MUSIC_EVENT_STATUS_NOTIFICATION = 0, + CELL_MUSIC_EVENT_INITIALIZE_RESULT = 1, + CELL_MUSIC_EVENT_FINALIZE_RESULT = 2, + CELL_MUSIC_EVENT_SELECT_CONTENTS_RESULT = 3, + CELL_MUSIC_EVENT_SET_PLAYBACK_COMMAND_RESULT = 4, + CELL_MUSIC_EVENT_SET_VOLUME_RESULT = 5, CELL_MUSIC_EVENT_SET_SELECTION_CONTEXT_RESULT = 6, - CELL_MUSIC_EVENT_UI_NOTIFICATION = 7, + CELL_MUSIC_EVENT_UI_NOTIFICATION = 7, }; enum { - CELL_MUSIC2_EVENT_STATUS_NOTIFICATION = CELL_MUSIC_EVENT_STATUS_NOTIFICATION, - CELL_MUSIC2_EVENT_INITIALIZE_RESULT = CELL_MUSIC_EVENT_INITIALIZE_RESULT, - CELL_MUSIC2_EVENT_FINALIZE_RESULT = CELL_MUSIC_EVENT_FINALIZE_RESULT, - CELL_MUSIC2_EVENT_SELECT_CONTENTS_RESULT = CELL_MUSIC_EVENT_SELECT_CONTENTS_RESULT, - CELL_MUSIC2_EVENT_SET_PLAYBACK_COMMAND_RESULT = CELL_MUSIC_EVENT_SET_PLAYBACK_COMMAND_RESULT, - CELL_MUSIC2_EVENT_SET_VOLUME_RESULT = CELL_MUSIC_EVENT_SET_VOLUME_RESULT, + CELL_MUSIC2_EVENT_STATUS_NOTIFICATION = CELL_MUSIC_EVENT_STATUS_NOTIFICATION, + CELL_MUSIC2_EVENT_INITIALIZE_RESULT = CELL_MUSIC_EVENT_INITIALIZE_RESULT, + CELL_MUSIC2_EVENT_FINALIZE_RESULT = CELL_MUSIC_EVENT_FINALIZE_RESULT, + CELL_MUSIC2_EVENT_SELECT_CONTENTS_RESULT = CELL_MUSIC_EVENT_SELECT_CONTENTS_RESULT, + CELL_MUSIC2_EVENT_SET_PLAYBACK_COMMAND_RESULT = CELL_MUSIC_EVENT_SET_PLAYBACK_COMMAND_RESULT, + CELL_MUSIC2_EVENT_SET_VOLUME_RESULT = CELL_MUSIC_EVENT_SET_VOLUME_RESULT, CELL_MUSIC2_EVENT_SET_SELECTION_CONTEXT_RESULT = CELL_MUSIC_EVENT_SET_SELECTION_CONTEXT_RESULT, - CELL_MUSIC2_EVENT_UI_NOTIFICATION = CELL_MUSIC_EVENT_UI_NOTIFICATION, + CELL_MUSIC2_EVENT_UI_NOTIFICATION = CELL_MUSIC_EVENT_UI_NOTIFICATION, }; enum { - CELL_MUSIC_PB_CMD_STOP = 0, - CELL_MUSIC_PB_CMD_PLAY = 1, - CELL_MUSIC_PB_CMD_PAUSE = 2, - CELL_MUSIC_PB_CMD_NEXT = 3, - CELL_MUSIC_PB_CMD_PREV = 4, + CELL_MUSIC_PB_CMD_STOP = 0, + CELL_MUSIC_PB_CMD_PLAY = 1, + CELL_MUSIC_PB_CMD_PAUSE = 2, + CELL_MUSIC_PB_CMD_NEXT = 3, + CELL_MUSIC_PB_CMD_PREV = 4, CELL_MUSIC_PB_CMD_FASTFORWARD = 5, CELL_MUSIC_PB_CMD_FASTREVERSE = 6, }; enum { - CELL_MUSIC2_PB_CMD_STOP = CELL_MUSIC_PB_CMD_STOP, - CELL_MUSIC2_PB_CMD_PLAY = CELL_MUSIC_PB_CMD_PLAY, - CELL_MUSIC2_PB_CMD_PAUSE = CELL_MUSIC_PB_CMD_PAUSE, - CELL_MUSIC2_PB_CMD_NEXT = CELL_MUSIC_PB_CMD_NEXT, - CELL_MUSIC2_PB_CMD_PREV = CELL_MUSIC_PB_CMD_PREV, + CELL_MUSIC2_PB_CMD_STOP = CELL_MUSIC_PB_CMD_STOP, + CELL_MUSIC2_PB_CMD_PLAY = CELL_MUSIC_PB_CMD_PLAY, + CELL_MUSIC2_PB_CMD_PAUSE = CELL_MUSIC_PB_CMD_PAUSE, + CELL_MUSIC2_PB_CMD_NEXT = CELL_MUSIC_PB_CMD_NEXT, + CELL_MUSIC2_PB_CMD_PREV = CELL_MUSIC_PB_CMD_PREV, CELL_MUSIC2_PB_CMD_FASTFORWARD = CELL_MUSIC_PB_CMD_FASTFORWARD, CELL_MUSIC2_PB_CMD_FASTREVERSE = CELL_MUSIC_PB_CMD_FASTREVERSE, }; enum { - CELL_MUSIC_PB_STATUS_STOP = 0, - CELL_MUSIC_PB_STATUS_PLAY = 1, - CELL_MUSIC_PB_STATUS_PAUSE = 2, + CELL_MUSIC_PB_STATUS_STOP = 0, + CELL_MUSIC_PB_STATUS_PLAY = 1, + CELL_MUSIC_PB_STATUS_PAUSE = 2, CELL_MUSIC_PB_STATUS_FASTFORWARD = 3, CELL_MUSIC_PB_STATUS_FASTREVERSE = 4, }; enum { - CELL_MUSIC2_PB_STATUS_STOP = CELL_MUSIC_PB_STATUS_STOP, - CELL_MUSIC2_PB_STATUS_PLAY = CELL_MUSIC_PB_STATUS_PLAY, - CELL_MUSIC2_PB_STATUS_PAUSE = CELL_MUSIC_PB_STATUS_PAUSE, + CELL_MUSIC2_PB_STATUS_STOP = CELL_MUSIC_PB_STATUS_STOP, + CELL_MUSIC2_PB_STATUS_PLAY = CELL_MUSIC_PB_STATUS_PLAY, + CELL_MUSIC2_PB_STATUS_PAUSE = CELL_MUSIC_PB_STATUS_PAUSE, CELL_MUSIC2_PB_STATUS_FASTFORWARD = CELL_MUSIC_PB_STATUS_FASTFORWARD, CELL_MUSIC2_PB_STATUS_FASTREVERSE = CELL_MUSIC_PB_STATUS_FASTREVERSE, }; @@ -124,9 +124,9 @@ enum enum { CELL_MUSIC_PLAYBACK_MEMORY_CONTAINER_SIZE = 11 * 1024 * 1024, - CELL_MUSIC_PLAYER_MODE_NORMAL = 0, - CELL_MUSIC2_PLAYER_MODE_NORMAL = CELL_MUSIC_PLAYER_MODE_NORMAL, - CELL_MUSIC_SELECTION_CONTEXT_SIZE = 2048, + CELL_MUSIC_PLAYER_MODE_NORMAL = 0, + CELL_MUSIC2_PLAYER_MODE_NORMAL = CELL_MUSIC_PLAYER_MODE_NORMAL, + CELL_MUSIC_SELECTION_CONTEXT_SIZE = 2048, }; using CellMusicCallback = void(u32 event, vm::ptr param, vm::ptr userData); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicDecode.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicDecode.cpp index c938f723b..aa1bd0903 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicDecode.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicDecode.cpp @@ -14,31 +14,31 @@ LOG_CHANNEL(cellMusicDecode); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_MUSIC_DECODE_CANCELED); - STR_CASE(CELL_MUSIC_DECODE_DECODE_FINISHED); - STR_CASE(CELL_MUSIC_DECODE_ERROR_PARAM); - STR_CASE(CELL_MUSIC_DECODE_ERROR_BUSY); - STR_CASE(CELL_MUSIC_DECODE_ERROR_NO_ACTIVE_CONTENT); - STR_CASE(CELL_MUSIC_DECODE_ERROR_NO_MATCH_FOUND); - STR_CASE(CELL_MUSIC_DECODE_ERROR_INVALID_CONTEXT); - STR_CASE(CELL_MUSIC_DECODE_ERROR_DECODE_FAILURE); - STR_CASE(CELL_MUSIC_DECODE_ERROR_NO_MORE_CONTENT); - STR_CASE(CELL_MUSIC_DECODE_DIALOG_OPEN); - STR_CASE(CELL_MUSIC_DECODE_DIALOG_CLOSE); - STR_CASE(CELL_MUSIC_DECODE_ERROR_NO_LPCM_DATA); - STR_CASE(CELL_MUSIC_DECODE_NEXT_CONTENTS_READY); - STR_CASE(CELL_MUSIC_DECODE_ERROR_GENERIC); - } + switch (error) + { + STR_CASE(CELL_MUSIC_DECODE_CANCELED); + STR_CASE(CELL_MUSIC_DECODE_DECODE_FINISHED); + STR_CASE(CELL_MUSIC_DECODE_ERROR_PARAM); + STR_CASE(CELL_MUSIC_DECODE_ERROR_BUSY); + STR_CASE(CELL_MUSIC_DECODE_ERROR_NO_ACTIVE_CONTENT); + STR_CASE(CELL_MUSIC_DECODE_ERROR_NO_MATCH_FOUND); + STR_CASE(CELL_MUSIC_DECODE_ERROR_INVALID_CONTEXT); + STR_CASE(CELL_MUSIC_DECODE_ERROR_DECODE_FAILURE); + STR_CASE(CELL_MUSIC_DECODE_ERROR_NO_MORE_CONTENT); + STR_CASE(CELL_MUSIC_DECODE_DIALOG_OPEN); + STR_CASE(CELL_MUSIC_DECODE_DIALOG_CLOSE); + STR_CASE(CELL_MUSIC_DECODE_ERROR_NO_LPCM_DATA); + STR_CASE(CELL_MUSIC_DECODE_NEXT_CONTENTS_READY); + STR_CASE(CELL_MUSIC_DECODE_ERROR_GENERIC); + } - return unknown; - }); + return unknown; + }); } struct music_decode @@ -138,36 +138,36 @@ error_code cell_music_decode_select_contents() [&dec](s32 status, utils::media_info info) { sysutil_register_cb([&dec, info = std::move(info), status](ppu_thread& ppu) -> s32 - { - std::lock_guard lock(dec.mutex); - const u32 result = status >= 0 ? u32{CELL_OK} : u32{CELL_MUSIC_DECODE_CANCELED}; - if (result == CELL_OK) { - // Let's always choose the whole directory for now - std::string track; - std::string dir = info.path; - if (fs::is_file(info.path)) + std::lock_guard lock(dec.mutex); + const u32 result = status >= 0 ? u32{CELL_OK} : u32{CELL_MUSIC_DECODE_CANCELED}; + if (result == CELL_OK) { - track = std::move(dir); - dir = fs::get_parent_dir(track); - } + // Let's always choose the whole directory for now + std::string track; + std::string dir = info.path; + if (fs::is_file(info.path)) + { + track = std::move(dir); + dir = fs::get_parent_dir(track); + } - music_selection_context context{}; - context.set_playlist(dir); - context.set_track(track); - // TODO: context.repeat_mode = CELL_SEARCH_REPEATMODE_NONE; - // TODO: context.context_option = CELL_SEARCH_CONTEXTOPTION_NONE; - dec.current_selection_context = std::move(context); - dec.current_selection_context.create_playlist(music_selection_context::get_next_hash()); - cellMusicDecode.success("Media list dialog: selected entry '%s'", dec.current_selection_context.playlist.front()); - } - else - { - cellMusicDecode.warning("Media list dialog was canceled"); - } - dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(result), dec.userData); - return CELL_OK; - }); + music_selection_context context{}; + context.set_playlist(dir); + context.set_track(track); + // TODO: context.repeat_mode = CELL_SEARCH_REPEATMODE_NONE; + // TODO: context.context_option = CELL_SEARCH_CONTEXTOPTION_NONE; + dec.current_selection_context = std::move(context); + dec.current_selection_context.create_playlist(music_selection_context::get_next_hash()); + cellMusicDecode.success("Media list dialog: selected entry '%s'", dec.current_selection_context.playlist.front()); + } + else + { + cellMusicDecode.warning("Media list dialog was canceled"); + } + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(result), dec.userData); + return CELL_OK; + }); }); return error; } @@ -299,10 +299,10 @@ error_code cellMusicDecodeInitialize(s32 mode, u32 container, s32 spuPriority, v dec.userData = userData; sysutil_register_cb([&dec](ppu_thread& ppu) -> s32 - { - dec.func(ppu, CELL_MUSIC_DECODE_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), dec.userData); - return CELL_OK; - }); + { + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), dec.userData); + return CELL_OK; + }); return CELL_OK; } @@ -322,10 +322,10 @@ error_code cellMusicDecodeInitializeSystemWorkload(s32 mode, u32 container, vm:: dec.userData = userData; sysutil_register_cb([&dec](ppu_thread& ppu) -> s32 - { - dec.func(ppu, CELL_MUSIC_DECODE_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), dec.userData); - return CELL_OK; - }); + { + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), dec.userData); + return CELL_OK; + }); return CELL_OK; } @@ -341,10 +341,10 @@ error_code cellMusicDecodeFinalize() if (dec.func) { sysutil_register_cb([&dec](ppu_thread& ppu) -> s32 - { - dec.func(ppu, CELL_MUSIC_DECODE_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), dec.userData); - return CELL_OK; - }); + { + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), dec.userData); + return CELL_OK; + }); } return CELL_OK; @@ -379,10 +379,10 @@ error_code cellMusicDecodeSetDecodeCommand(s32 command) } sysutil_register_cb([&dec, result](ppu_thread& ppu) -> s32 - { - dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SET_DECODE_COMMAND_RESULT, vm::addr_t(s32{result}), dec.userData); - return CELL_OK; - }); + { + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SET_DECODE_COMMAND_RESULT, vm::addr_t(s32{result}), dec.userData); + return CELL_OK; + }); return CELL_OK; } @@ -439,15 +439,17 @@ error_code cellMusicDecodeSetSelectionContext(vm::ptr return CELL_MUSIC_DECODE_ERROR_GENERIC; const bool result = dec.current_selection_context.set(*context); - if (result) cellMusicDecode.warning("cellMusicDecodeSetSelectionContext: new selection_context = %s", dec.current_selection_context.to_string()); - else cellMusicDecode.error("cellMusicDecodeSetSelectionContext: failed. context = '%s'", music_selection_context::context_to_hex(*context)); + if (result) + cellMusicDecode.warning("cellMusicDecodeSetSelectionContext: new selection_context = %s", dec.current_selection_context.to_string()); + else + cellMusicDecode.error("cellMusicDecodeSetSelectionContext: failed. context = '%s'", music_selection_context::context_to_hex(*context)); sysutil_register_cb([&dec, result](ppu_thread& ppu) -> s32 - { - const u32 status = result ? u32{CELL_OK} : u32{CELL_MUSIC_DECODE_ERROR_INVALID_CONTEXT}; - dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(status), dec.userData); - return CELL_OK; - }); + { + const u32 status = result ? u32{CELL_OK} : u32{CELL_MUSIC_DECODE_ERROR_INVALID_CONTEXT}; + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(status), dec.userData); + return CELL_OK; + }); return CELL_OK; } @@ -483,10 +485,10 @@ error_code cellMusicDecodeInitialize2(s32 mode, u32 container, s32 spuPriority, dec.speed = speed; sysutil_register_cb([userData, &dec](ppu_thread& ppu) -> s32 - { - dec.func(ppu, CELL_MUSIC_DECODE_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); - return CELL_OK; - }); + { + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData); + return CELL_OK; + }); return CELL_OK; } @@ -507,10 +509,10 @@ error_code cellMusicDecodeInitialize2SystemWorkload(s32 mode, u32 container, vm: dec.userData = userData; sysutil_register_cb([&dec](ppu_thread& ppu) -> s32 - { - dec.func(ppu, CELL_MUSIC_DECODE_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), dec.userData); - return CELL_OK; - }); + { + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), dec.userData); + return CELL_OK; + }); return CELL_OK; } @@ -526,10 +528,10 @@ error_code cellMusicDecodeFinalize2() if (dec.func) { sysutil_register_cb([&dec](ppu_thread& ppu) -> s32 - { - dec.func(ppu, CELL_MUSIC_DECODE_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), dec.userData); - return CELL_OK; - }); + { + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), dec.userData); + return CELL_OK; + }); } return CELL_OK; @@ -564,10 +566,10 @@ error_code cellMusicDecodeSetDecodeCommand2(s32 command) } sysutil_register_cb([&dec, result](ppu_thread& ppu) -> s32 - { - dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SET_DECODE_COMMAND_RESULT, vm::addr_t(s32{result}), dec.userData); - return CELL_OK; - }); + { + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SET_DECODE_COMMAND_RESULT, vm::addr_t(s32{result}), dec.userData); + return CELL_OK; + }); return CELL_OK; } @@ -624,15 +626,17 @@ error_code cellMusicDecodeSetSelectionContext2(vm::ptr s32 - { - const u32 status = result ? u32{CELL_OK} : u32{CELL_MUSIC_DECODE_ERROR_INVALID_CONTEXT}; - dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(status), dec.userData); - return CELL_OK; - }); + { + const u32 status = result ? u32{CELL_OK} : u32{CELL_MUSIC_DECODE_ERROR_INVALID_CONTEXT}; + dec.func(ppu, CELL_MUSIC_DECODE_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(status), dec.userData); + return CELL_OK; + }); return CELL_OK; } @@ -650,28 +654,27 @@ error_code cellMusicDecodeGetContentsId2(vm::ptr contents_i return dec.current_selection_context.find_content_id(contents_id); } - DECLARE(ppu_module_manager::cellMusicDecode)("cellMusicDecodeUtility", []() -{ - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeInitialize); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeInitializeSystemWorkload); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeFinalize); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeSelectContents); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeSetDecodeCommand); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeGetDecodeStatus); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeRead); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeGetSelectionContext); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeSetSelectionContext); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeGetContentsId); + { + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeInitialize); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeInitializeSystemWorkload); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeFinalize); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeSelectContents); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeSetDecodeCommand); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeGetDecodeStatus); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeRead); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeGetSelectionContext); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeSetSelectionContext); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeGetContentsId); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeInitialize2); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeInitialize2SystemWorkload); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeFinalize2); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeSelectContents2); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeSetDecodeCommand2); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeGetDecodeStatus2); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeRead2); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeGetSelectionContext2); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeSetSelectionContext2); - REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeGetContentsId2); -}); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeInitialize2); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeInitialize2SystemWorkload); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeFinalize2); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeSelectContents2); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeSetDecodeCommand2); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeGetDecodeStatus2); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeRead2); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeGetSelectionContext2); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeSetSelectionContext2); + REG_FUNC(cellMusicDecodeUtility, cellMusicDecodeGetContentsId2); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicDecode.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicDecode.h index dace5ddf1..e267cd241 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicDecode.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicDecode.h @@ -3,20 +3,20 @@ // Return Codes (CELL_MUSIC_DECODE2 codes are omitted if they are identical) enum CellMusicDecodeError : u32 { - CELL_MUSIC_DECODE_CANCELED = 1, - CELL_MUSIC_DECODE_DECODE_FINISHED = 0x8002C101, - CELL_MUSIC_DECODE_ERROR_PARAM = 0x8002C102, - CELL_MUSIC_DECODE_ERROR_BUSY = 0x8002C103, + CELL_MUSIC_DECODE_CANCELED = 1, + CELL_MUSIC_DECODE_DECODE_FINISHED = 0x8002C101, + CELL_MUSIC_DECODE_ERROR_PARAM = 0x8002C102, + CELL_MUSIC_DECODE_ERROR_BUSY = 0x8002C103, CELL_MUSIC_DECODE_ERROR_NO_ACTIVE_CONTENT = 0x8002C104, - CELL_MUSIC_DECODE_ERROR_NO_MATCH_FOUND = 0x8002C105, - CELL_MUSIC_DECODE_ERROR_INVALID_CONTEXT = 0x8002C106, - CELL_MUSIC_DECODE_ERROR_DECODE_FAILURE = 0x8002C107, - CELL_MUSIC_DECODE_ERROR_NO_MORE_CONTENT = 0x8002C108, - CELL_MUSIC_DECODE_DIALOG_OPEN = 0x8002C109, - CELL_MUSIC_DECODE_DIALOG_CLOSE = 0x8002C10A, - CELL_MUSIC_DECODE_ERROR_NO_LPCM_DATA = 0x8002C10B, - CELL_MUSIC_DECODE_NEXT_CONTENTS_READY = 0x8002C10C, - CELL_MUSIC_DECODE_ERROR_GENERIC = 0x8002C1FF, + CELL_MUSIC_DECODE_ERROR_NO_MATCH_FOUND = 0x8002C105, + CELL_MUSIC_DECODE_ERROR_INVALID_CONTEXT = 0x8002C106, + CELL_MUSIC_DECODE_ERROR_DECODE_FAILURE = 0x8002C107, + CELL_MUSIC_DECODE_ERROR_NO_MORE_CONTENT = 0x8002C108, + CELL_MUSIC_DECODE_DIALOG_OPEN = 0x8002C109, + CELL_MUSIC_DECODE_DIALOG_CLOSE = 0x8002C10A, + CELL_MUSIC_DECODE_ERROR_NO_LPCM_DATA = 0x8002C10B, + CELL_MUSIC_DECODE_NEXT_CONTENTS_READY = 0x8002C10C, + CELL_MUSIC_DECODE_ERROR_GENERIC = 0x8002C1FF, }; // Constants (CELL_MUSIC_DECODE2 codes are omitted if they are identical) @@ -33,36 +33,36 @@ enum CELL_MUSIC_DECODE_MODE_NORMAL = 0, - CELL_MUSIC_DECODE_CMD_STOP = 0, + CELL_MUSIC_DECODE_CMD_STOP = 0, CELL_MUSIC_DECODE_CMD_START = 1, - CELL_MUSIC_DECODE_CMD_NEXT = 2, - CELL_MUSIC_DECODE_CMD_PREV = 3, + CELL_MUSIC_DECODE_CMD_NEXT = 2, + CELL_MUSIC_DECODE_CMD_PREV = 3, - CELL_MUSIC_DECODE_STATUS_DORMANT = 0, + CELL_MUSIC_DECODE_STATUS_DORMANT = 0, CELL_MUSIC_DECODE_STATUS_DECODING = 1, - CELL_MUSIC_DECODE_POSITION_NONE = 0, - CELL_MUSIC_DECODE_POSITION_START = 1, - CELL_MUSIC_DECODE_POSITION_MID = 2, - CELL_MUSIC_DECODE_POSITION_END = 3, + CELL_MUSIC_DECODE_POSITION_NONE = 0, + CELL_MUSIC_DECODE_POSITION_START = 1, + CELL_MUSIC_DECODE_POSITION_MID = 2, + CELL_MUSIC_DECODE_POSITION_END = 3, CELL_MUSIC_DECODE_POSITION_END_LIST_END = 4, CELL_MUSIC_DECODE2_MODE_NORMAL = 0, CELL_MUSIC_DECODE2_SPEED_MAX = 0, - CELL_MUSIC_DECODE2_SPEED_2 = 2, + CELL_MUSIC_DECODE2_SPEED_2 = 2, CELL_SYSUTIL_MUSIC_DECODE2_INITIALIZING_FINISHED = 1, - CELL_SYSUTIL_MUSIC_DECODE2_SHUTDOWN_FINISHED = 4, // 3(SDK103) -> 4(SDK110) - CELL_SYSUTIL_MUSIC_DECODE2_LOADING_FINISHED = 5, - CELL_SYSUTIL_MUSIC_DECODE2_UNLOADING_FINISHED = 7, - CELL_SYSUTIL_MUSIC_DECODE2_RELEASED = 9, - CELL_SYSUTIL_MUSIC_DECODE2_GRABBED = 11, + CELL_SYSUTIL_MUSIC_DECODE2_SHUTDOWN_FINISHED = 4, // 3(SDK103) -> 4(SDK110) + CELL_SYSUTIL_MUSIC_DECODE2_LOADING_FINISHED = 5, + CELL_SYSUTIL_MUSIC_DECODE2_UNLOADING_FINISHED = 7, + CELL_SYSUTIL_MUSIC_DECODE2_RELEASED = 9, + CELL_SYSUTIL_MUSIC_DECODE2_GRABBED = 11, CELL_MUSIC_DECODE2_MIN_BUFFER_SIZE = 448 * 1024, CELL_MUSIC_DECODE2_MANAGEMENT_SIZE = 64 * 1024, - CELL_MUSIC_DECODE2_PAGESIZE_64K = 64 * 1024, - CELL_MUSIC_DECODE2_PAGESIZE_1M = 1 * 1024 * 1024, + CELL_MUSIC_DECODE2_PAGESIZE_64K = 64 * 1024, + CELL_MUSIC_DECODE2_PAGESIZE_1M = 1 * 1024 * 1024, }; using CellMusicDecodeCallback = void(u32, vm::ptr param, vm::ptr userData); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicExport.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicExport.cpp index c01d4b7a5..f507f2b67 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicExport.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicExport.cpp @@ -9,48 +9,48 @@ LOG_CHANNEL(cellMusicExport); // Return Codes enum CellMusicExportError : u32 { - CELL_MUSIC_EXPORT_UTIL_ERROR_BUSY = 0x8002c601, - CELL_MUSIC_EXPORT_UTIL_ERROR_INTERNAL = 0x8002c602, - CELL_MUSIC_EXPORT_UTIL_ERROR_PARAM = 0x8002c603, + CELL_MUSIC_EXPORT_UTIL_ERROR_BUSY = 0x8002c601, + CELL_MUSIC_EXPORT_UTIL_ERROR_INTERNAL = 0x8002c602, + CELL_MUSIC_EXPORT_UTIL_ERROR_PARAM = 0x8002c603, CELL_MUSIC_EXPORT_UTIL_ERROR_ACCESS_ERROR = 0x8002c604, - CELL_MUSIC_EXPORT_UTIL_ERROR_DB_INTERNAL = 0x8002c605, - CELL_MUSIC_EXPORT_UTIL_ERROR_DB_REGIST = 0x8002c606, - CELL_MUSIC_EXPORT_UTIL_ERROR_SET_META = 0x8002c607, - CELL_MUSIC_EXPORT_UTIL_ERROR_FLUSH_META = 0x8002c608, - CELL_MUSIC_EXPORT_UTIL_ERROR_MOVE = 0x8002c609, - CELL_MUSIC_EXPORT_UTIL_ERROR_INITIALIZE = 0x8002c60a, + CELL_MUSIC_EXPORT_UTIL_ERROR_DB_INTERNAL = 0x8002c605, + CELL_MUSIC_EXPORT_UTIL_ERROR_DB_REGIST = 0x8002c606, + CELL_MUSIC_EXPORT_UTIL_ERROR_SET_META = 0x8002c607, + CELL_MUSIC_EXPORT_UTIL_ERROR_FLUSH_META = 0x8002c608, + CELL_MUSIC_EXPORT_UTIL_ERROR_MOVE = 0x8002c609, + CELL_MUSIC_EXPORT_UTIL_ERROR_INITIALIZE = 0x8002c60a, }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_BUSY); - STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_INTERNAL); - STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_PARAM); - STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_ACCESS_ERROR); - STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_DB_INTERNAL); - STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_DB_REGIST); - STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_SET_META); - STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_FLUSH_META); - STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_MOVE); - STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_INITIALIZE); - } + switch (error) + { + STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_BUSY); + STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_INTERNAL); + STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_PARAM); + STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_ACCESS_ERROR); + STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_DB_INTERNAL); + STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_DB_REGIST); + STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_SET_META); + STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_FLUSH_META); + STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_MOVE); + STR_CASE(CELL_MUSIC_EXPORT_UTIL_ERROR_INITIALIZE); + } - return unknown; - }); + return unknown; + }); } enum { - CELL_MUSIC_EXPORT_UTIL_VERSION_CURRENT = 0, - CELL_MUSIC_EXPORT_UTIL_HDD_PATH_MAX = 1055, + CELL_MUSIC_EXPORT_UTIL_VERSION_CURRENT = 0, + CELL_MUSIC_EXPORT_UTIL_HDD_PATH_MAX = 1055, CELL_MUSIC_EXPORT_UTIL_MUSIC_TITLE_MAX_LENGTH = 64, - CELL_MUSIC_EXPORT_UTIL_GAME_TITLE_MAX_LENGTH = 64, - CELL_MUSIC_EXPORT_UTIL_GAME_COMMENT_MAX_SIZE = 1024, + CELL_MUSIC_EXPORT_UTIL_GAME_TITLE_MAX_LENGTH = 64, + CELL_MUSIC_EXPORT_UTIL_GAME_COMMENT_MAX_SIZE = 1024, }; struct CellMusicExportSetParam @@ -71,7 +71,6 @@ struct music_export atomic_t progress = 0; // 0x0-0xFFFF for 0-100% }; - bool check_music_path(const std::string& file_path) { if (file_path.size() >= CELL_MUSIC_EXPORT_UTIL_HDD_PATH_MAX) @@ -82,10 +81,10 @@ bool check_music_path(const std::string& file_path) for (char c : file_path) { if (!((c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9') || - c == '-' || c == '_' || - c == '/' || c == '.')) + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || + c == '-' || c == '_' || + c == '/' || c == '.')) { return false; } @@ -132,7 +131,6 @@ std::string get_available_music_path(const std::string& filename) return dst_path; } - error_code cellMusicExportInitialize(u32 version, u32 container, vm::ptr funcFinish, vm::ptr userdata) { cellMusicExport.warning("cellMusicExportInitialize(version=0x%x, container=0x%x, funcFinish=*0x%x, userdata=*0x%x)", version, container, funcFinish, userdata); @@ -156,10 +154,10 @@ error_code cellMusicExportInitialize(u32 version, u32 container, vm::ptr s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -179,10 +177,10 @@ error_code cellMusicExportInitialize2(u32 version, vm::ptr s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -197,10 +195,10 @@ error_code cellMusicExportFinalize(vm::ptr fu } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -222,7 +220,7 @@ error_code cellMusicExportFromFile(vm::cptr srcHddDir, vm::cptr srcH if (!check_music_path(file_path)) { - return { CELL_MUSIC_EXPORT_UTIL_ERROR_PARAM, file_path }; + return {CELL_MUSIC_EXPORT_UTIL_ERROR_PARAM, file_path}; } std::string filename; @@ -234,47 +232,47 @@ error_code cellMusicExportFromFile(vm::cptr srcHddDir, vm::cptr srcH if (filename.empty()) { - return { CELL_MUSIC_EXPORT_UTIL_ERROR_PARAM, "filename empty" }; + return {CELL_MUSIC_EXPORT_UTIL_ERROR_PARAM, "filename empty"}; } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - auto& mexp = g_fxo->get(); - mexp.progress = 0; // 0% - - const std::string src_path = vfs::get(file_path); - const std::string dst_path = get_available_music_path(filename); - - cellMusicExport.notice("Copying file from '%s' to '%s'", file_path, dst_path); - - // TODO: We ignore metadata for now - - if (!fs::create_path(fs::get_parent_dir(dst_path)) || !fs::copy_file(src_path, dst_path, false)) { - // TODO: find out which error is used - cellMusicExport.error("Failed to copy file from '%s' to '%s' (%s)", src_path, dst_path, fs::g_tls_error); - funcFinish(ppu, CELL_MUSIC_EXPORT_UTIL_ERROR_MOVE, userdata); - return CELL_OK; - } + auto& mexp = g_fxo->get(); + mexp.progress = 0; // 0% - if (!file_path.starts_with("/dev_bdvd"sv)) - { - cellMusicExport.notice("Removing file '%s'", src_path); + const std::string src_path = vfs::get(file_path); + const std::string dst_path = get_available_music_path(filename); - if (!fs::remove_file(src_path)) + cellMusicExport.notice("Copying file from '%s' to '%s'", file_path, dst_path); + + // TODO: We ignore metadata for now + + if (!fs::create_path(fs::get_parent_dir(dst_path)) || !fs::copy_file(src_path, dst_path, false)) { - // TODO: find out if an error is used here - cellMusicExport.error("Failed to remove file '%s' (%s)", src_path, fs::g_tls_error); + // TODO: find out which error is used + cellMusicExport.error("Failed to copy file from '%s' to '%s' (%s)", src_path, dst_path, fs::g_tls_error); + funcFinish(ppu, CELL_MUSIC_EXPORT_UTIL_ERROR_MOVE, userdata); + return CELL_OK; } - } - // TODO: track progress during file copy + if (!file_path.starts_with("/dev_bdvd"sv)) + { + cellMusicExport.notice("Removing file '%s'", src_path); - mexp.progress = 0xFFFF; // 100% + if (!fs::remove_file(src_path)) + { + // TODO: find out if an error is used here + cellMusicExport.error("Failed to remove file '%s' (%s)", src_path, fs::g_tls_error); + } + } - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + // TODO: track progress during file copy + + mexp.progress = 0xFFFF; // 100% + + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -289,23 +287,23 @@ error_code cellMusicExportProgress(vm::ptr fu } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - // Set the status as 0x0-0xFFFF (0-100%) depending on the copy status. - // Only the copy or move of the movie and metadata files is considered for the progress. - const auto& mexp = g_fxo->get(); + { + // Set the status as 0x0-0xFFFF (0-100%) depending on the copy status. + // Only the copy or move of the movie and metadata files is considered for the progress. + const auto& mexp = g_fxo->get(); - funcFinish(ppu, mexp.progress, userdata); - return CELL_OK; - }); + funcFinish(ppu, mexp.progress, userdata); + return CELL_OK; + }); return CELL_OK; } DECLARE(ppu_module_manager::cellMusicExport)("cellMusicExportUtility", []() -{ - REG_FUNC(cellMusicExportUtility, cellMusicExportInitialize); - REG_FUNC(cellMusicExportUtility, cellMusicExportInitialize2); - REG_FUNC(cellMusicExportUtility, cellMusicExportFinalize); - REG_FUNC(cellMusicExportUtility, cellMusicExportFromFile); - REG_FUNC(cellMusicExportUtility, cellMusicExportProgress); -}); + { + REG_FUNC(cellMusicExportUtility, cellMusicExportInitialize); + REG_FUNC(cellMusicExportUtility, cellMusicExportInitialize2); + REG_FUNC(cellMusicExportUtility, cellMusicExportFinalize); + REG_FUNC(cellMusicExportUtility, cellMusicExportFromFile); + REG_FUNC(cellMusicExportUtility, cellMusicExportProgress); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicSelectionContext.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicSelectionContext.cpp index 8de86380d..66cab35f6 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicSelectionContext.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellMusicSelectionContext.cpp @@ -250,7 +250,8 @@ bool music_selection_context::load_playlist() void music_selection_context::set_track(std::string_view track) { - if (track.empty()) return; + if (track.empty()) + return; if (playlist.empty()) { diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellNetAoi.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellNetAoi.cpp index 8c9fa7c9f..946598954 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellNetAoi.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellNetAoi.cpp @@ -58,14 +58,14 @@ error_code cellNetAoiAddPeer() } DECLARE(ppu_module_manager::cellNetAoi)("cellNetAoi", []() -{ - REG_FUNC(cellNetAoi, cellNetAoiDeletePeer); - REG_FUNC(cellNetAoi, cellNetAoiInit); - REG_FUNC(cellNetAoi, cellNetAoiGetPspTitleId); - REG_FUNC(cellNetAoi, cellNetAoiTerm); - REG_FUNC(cellNetAoi, cellNetAoiStop); - REG_FUNC(cellNetAoi, cellNetAoiGetRemotePeerInfo); - REG_FUNC(cellNetAoi, cellNetAoiStart); - REG_FUNC(cellNetAoi, cellNetAoiGetLocalInfo); - REG_FUNC(cellNetAoi, cellNetAoiAddPeer); -}); + { + REG_FUNC(cellNetAoi, cellNetAoiDeletePeer); + REG_FUNC(cellNetAoi, cellNetAoiInit); + REG_FUNC(cellNetAoi, cellNetAoiGetPspTitleId); + REG_FUNC(cellNetAoi, cellNetAoiTerm); + REG_FUNC(cellNetAoi, cellNetAoiStop); + REG_FUNC(cellNetAoi, cellNetAoiGetRemotePeerInfo); + REG_FUNC(cellNetAoi, cellNetAoiStart); + REG_FUNC(cellNetAoi, cellNetAoiGetLocalInfo); + REG_FUNC(cellNetAoi, cellNetAoiAddPeer); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp index 97375c4e6..e3cf43ac6 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp @@ -18,75 +18,75 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_NET_CTL_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_NET_CTL_ERROR_NOT_TERMINATED); - STR_CASE(CELL_NET_CTL_ERROR_HANDLER_MAX); - STR_CASE(CELL_NET_CTL_ERROR_ID_NOT_FOUND); - STR_CASE(CELL_NET_CTL_ERROR_INVALID_ID); - STR_CASE(CELL_NET_CTL_ERROR_INVALID_CODE); - STR_CASE(CELL_NET_CTL_ERROR_INVALID_ADDR); - STR_CASE(CELL_NET_CTL_ERROR_NOT_CONNECTED); - STR_CASE(CELL_NET_CTL_ERROR_NOT_AVAIL); - STR_CASE(CELL_NET_CTL_ERROR_INVALID_TYPE); - STR_CASE(CELL_NET_CTL_ERROR_INVALID_SIZE); - STR_CASE(CELL_NET_CTL_ERROR_NET_DISABLED); - STR_CASE(CELL_NET_CTL_ERROR_NET_NOT_CONNECTED); - STR_CASE(CELL_NET_CTL_ERROR_NP_NO_ACCOUNT); - STR_CASE(CELL_NET_CTL_ERROR_NP_RESERVED1); - STR_CASE(CELL_NET_CTL_ERROR_NP_RESERVED2); - STR_CASE(CELL_NET_CTL_ERROR_NET_CABLE_NOT_CONNECTED); - STR_CASE(CELL_NET_CTL_ERROR_DIALOG_CANCELED); - STR_CASE(CELL_NET_CTL_ERROR_DIALOG_ABORTED); + switch (error) + { + STR_CASE(CELL_NET_CTL_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_NET_CTL_ERROR_NOT_TERMINATED); + STR_CASE(CELL_NET_CTL_ERROR_HANDLER_MAX); + STR_CASE(CELL_NET_CTL_ERROR_ID_NOT_FOUND); + STR_CASE(CELL_NET_CTL_ERROR_INVALID_ID); + STR_CASE(CELL_NET_CTL_ERROR_INVALID_CODE); + STR_CASE(CELL_NET_CTL_ERROR_INVALID_ADDR); + STR_CASE(CELL_NET_CTL_ERROR_NOT_CONNECTED); + STR_CASE(CELL_NET_CTL_ERROR_NOT_AVAIL); + STR_CASE(CELL_NET_CTL_ERROR_INVALID_TYPE); + STR_CASE(CELL_NET_CTL_ERROR_INVALID_SIZE); + STR_CASE(CELL_NET_CTL_ERROR_NET_DISABLED); + STR_CASE(CELL_NET_CTL_ERROR_NET_NOT_CONNECTED); + STR_CASE(CELL_NET_CTL_ERROR_NP_NO_ACCOUNT); + STR_CASE(CELL_NET_CTL_ERROR_NP_RESERVED1); + STR_CASE(CELL_NET_CTL_ERROR_NP_RESERVED2); + STR_CASE(CELL_NET_CTL_ERROR_NET_CABLE_NOT_CONNECTED); + STR_CASE(CELL_NET_CTL_ERROR_DIALOG_CANCELED); + STR_CASE(CELL_NET_CTL_ERROR_DIALOG_ABORTED); - STR_CASE(CELL_NET_CTL_ERROR_WLAN_DEAUTHED); - STR_CASE(CELL_NET_CTL_ERROR_WLAN_KEYINFO_EXCHNAGE_TIMEOUT); - STR_CASE(CELL_NET_CTL_ERROR_WLAN_ASSOC_FAILED); - STR_CASE(CELL_NET_CTL_ERROR_WLAN_AP_DISAPPEARED); - STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_INIT); - STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_NO_PADO); - STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_NO_PADS); - STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_GET_PADT); - STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_SERVICE_NAME); - STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_AC_SYSTEM); - STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_GENERIC); - STR_CASE(CELL_NET_CTL_ERROR_PPPOE_STATUS_AUTH); - STR_CASE(CELL_NET_CTL_ERROR_PPPOE_STATUS_NETWORK); - STR_CASE(CELL_NET_CTL_ERROR_PPPOE_STATUS_TERMINATE); - STR_CASE(CELL_NET_CTL_ERROR_DHCP_LEASE_TIME); + STR_CASE(CELL_NET_CTL_ERROR_WLAN_DEAUTHED); + STR_CASE(CELL_NET_CTL_ERROR_WLAN_KEYINFO_EXCHNAGE_TIMEOUT); + STR_CASE(CELL_NET_CTL_ERROR_WLAN_ASSOC_FAILED); + STR_CASE(CELL_NET_CTL_ERROR_WLAN_AP_DISAPPEARED); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_INIT); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_NO_PADO); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_NO_PADS); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_GET_PADT); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_SERVICE_NAME); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_AC_SYSTEM); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_GENERIC); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_STATUS_AUTH); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_STATUS_NETWORK); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_STATUS_TERMINATE); + STR_CASE(CELL_NET_CTL_ERROR_DHCP_LEASE_TIME); - STR_CASE(CELL_GAMEUPDATE_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_GAMEUPDATE_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_GAMEUPDATE_ERROR_INVALID_ADDR); - STR_CASE(CELL_GAMEUPDATE_ERROR_INVALID_SIZE); - STR_CASE(CELL_GAMEUPDATE_ERROR_INVALID_MEMORY_CONTAINER); - STR_CASE(CELL_GAMEUPDATE_ERROR_INSUFFICIENT_MEMORY_CONTAINER); - STR_CASE(CELL_GAMEUPDATE_ERROR_BUSY); - STR_CASE(CELL_GAMEUPDATE_ERROR_NOT_START); - STR_CASE(CELL_GAMEUPDATE_ERROR_LOAD_FAILED); - } + STR_CASE(CELL_GAMEUPDATE_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_GAMEUPDATE_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_GAMEUPDATE_ERROR_INVALID_ADDR); + STR_CASE(CELL_GAMEUPDATE_ERROR_INVALID_SIZE); + STR_CASE(CELL_GAMEUPDATE_ERROR_INVALID_MEMORY_CONTAINER); + STR_CASE(CELL_GAMEUPDATE_ERROR_INSUFFICIENT_MEMORY_CONTAINER); + STR_CASE(CELL_GAMEUPDATE_ERROR_BUSY); + STR_CASE(CELL_GAMEUPDATE_ERROR_NOT_START); + STR_CASE(CELL_GAMEUPDATE_ERROR_LOAD_FAILED); + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellNetCtlState value) - { - switch (value) { - case CELL_NET_CTL_STATE_Disconnected: return "Disconnected"; - case CELL_NET_CTL_STATE_Connecting: return "Connecting"; - case CELL_NET_CTL_STATE_IPObtaining: return "Obtaining IP"; - case CELL_NET_CTL_STATE_IPObtained: return "IP Obtained"; - } + switch (value) + { + case CELL_NET_CTL_STATE_Disconnected: return "Disconnected"; + case CELL_NET_CTL_STATE_Connecting: return "Connecting"; + case CELL_NET_CTL_STATE_IPObtaining: return "Obtaining IP"; + case CELL_NET_CTL_STATE_IPObtained: return "IP Obtained"; + } - return unknown; - }); + return unknown; + }); } struct CellGameUpdateResult @@ -228,7 +228,7 @@ error_code cellNetCtlGetInfo(s32 code, vm::ptr info) // case CELL_NET_CTL_INFO_WLAN_SECURITY: break; // case CELL_NET_CTL_INFO_8021X_TYPE: break; // case CELL_NET_CTL_INFO_8021X_AUTH_NAME: break; - case CELL_NET_CTL_INFO_RSSI: info->rssi = 100; break; // wireless: value ranges from 0-100 indicating wireless connection strength + case CELL_NET_CTL_INFO_RSSI: info->rssi = 100; break; // wireless: value ranges from 0-100 indicating wireless connection strength case CELL_NET_CTL_INFO_CHANNEL: info->channel = 1; break; // wireless: channel used to connect to the AP? case CELL_NET_CTL_INFO_IP_CONFIG: info->ip_config = CELL_NET_CTL_IP_STATIC; break; case CELL_NET_CTL_INFO_DHCP_HOSTNAME: strcpy_trunc(info->dhcp_hostname, nph.get_hostname()); break; @@ -428,10 +428,10 @@ error_code cellGameUpdateCheckStartAsync(vm::cptr param, vm { cellNetCtl.todo("cellGameUpdateCheckStartAsync(param=*0x%x, cb_func=*0x%x, userdata=*0x%x)", param, cb_func, userdata); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - cb_func(ppu, CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK, userdata); - return CELL_OK; - }); + { + cb_func(ppu, CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -439,10 +439,10 @@ error_code cellGameUpdateCheckFinishAsync(vm::ptr cb_fun { cellNetCtl.todo("cellGameUpdateCheckFinishAsync(cb_func=*0x%x, userdata=*0x%x)", cb_func, userdata); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - cb_func(ppu, CELL_GAMEUPDATE_RESULT_STATUS_FINISHED, CELL_OK, userdata); - return CELL_OK; - }); + { + cb_func(ppu, CELL_GAMEUPDATE_RESULT_STATUS_FINISHED, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -450,10 +450,10 @@ error_code cellGameUpdateCheckStartWithoutDialogAsync(vm::ptr s32 - { - cb_func(ppu, CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK, userdata); - return CELL_OK; - }); + { + cb_func(ppu, CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -467,10 +467,10 @@ error_code cellGameUpdateCheckStartAsyncEx(vm::cptr param, { cellNetCtl.todo("cellGameUpdateCheckStartAsyncEx(param=*0x%x, cb_func=*0x%x, userdata=*0x%x)", param, cb_func, userdata); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - cb_func(ppu, vm::make_var(CellGameUpdateResult{CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK}), userdata); - return CELL_OK; - }); + { + cb_func(ppu, vm::make_var(CellGameUpdateResult{CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK}), userdata); + return CELL_OK; + }); return CELL_OK; } @@ -478,10 +478,10 @@ error_code cellGameUpdateCheckFinishAsyncEx(vm::ptr cb { cellNetCtl.todo("cellGameUpdateCheckFinishAsyncEx(cb_func=*0x%x, userdata=*0x%x)", cb_func, userdata); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - cb_func(ppu, vm::make_var(CellGameUpdateResult{CELL_GAMEUPDATE_RESULT_STATUS_FINISHED, CELL_OK}), userdata); - return CELL_OK; - }); + { + cb_func(ppu, vm::make_var(CellGameUpdateResult{CELL_GAMEUPDATE_RESULT_STATUS_FINISHED, CELL_OK}), userdata); + return CELL_OK; + }); return CELL_OK; } @@ -489,47 +489,47 @@ error_code cellGameUpdateCheckStartWithoutDialogAsyncEx(vm::ptr s32 - { - cb_func(ppu, vm::make_var(CellGameUpdateResult{CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK}), userdata); - return CELL_OK; - }); + { + cb_func(ppu, vm::make_var(CellGameUpdateResult{CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK}), userdata); + return CELL_OK; + }); return CELL_OK; } DECLARE(ppu_module_manager::cellNetCtl)("cellNetCtl", []() -{ - REG_FUNC(cellNetCtl, cellNetCtlInit); - REG_FUNC(cellNetCtl, cellNetCtlTerm); + { + REG_FUNC(cellNetCtl, cellNetCtlInit); + REG_FUNC(cellNetCtl, cellNetCtlTerm); - REG_FUNC(cellNetCtl, cellNetCtlGetState); - REG_FUNC(cellNetCtl, cellNetCtlAddHandler); - REG_FUNC(cellNetCtl, cellNetCtlDelHandler); + REG_FUNC(cellNetCtl, cellNetCtlGetState); + REG_FUNC(cellNetCtl, cellNetCtlAddHandler); + REG_FUNC(cellNetCtl, cellNetCtlDelHandler); - REG_FUNC(cellNetCtl, cellNetCtlGetInfo); + REG_FUNC(cellNetCtl, cellNetCtlGetInfo); - REG_FUNC(cellNetCtl, cellNetCtlNetStartDialogLoadAsync); - REG_FUNC(cellNetCtl, cellNetCtlNetStartDialogAbortAsync); - REG_FUNC(cellNetCtl, cellNetCtlNetStartDialogUnloadAsync); + REG_FUNC(cellNetCtl, cellNetCtlNetStartDialogLoadAsync); + REG_FUNC(cellNetCtl, cellNetCtlNetStartDialogAbortAsync); + REG_FUNC(cellNetCtl, cellNetCtlNetStartDialogUnloadAsync); - REG_FUNC(cellNetCtl, cellNetCtlGetNatInfo); + REG_FUNC(cellNetCtl, cellNetCtlGetNatInfo); - REG_FUNC(cellNetCtl, cellNetCtlAddHandlerGameInt); - REG_FUNC(cellNetCtl, cellNetCtlConnectGameInt); - REG_FUNC(cellNetCtl, cellNetCtlDelHandlerGameInt); - REG_FUNC(cellNetCtl, cellNetCtlDisconnectGameInt); - REG_FUNC(cellNetCtl, cellNetCtlGetInfoGameInt); - REG_FUNC(cellNetCtl, cellNetCtlGetScanInfoGameInt); - REG_FUNC(cellNetCtl, cellNetCtlGetStateGameInt); - REG_FUNC(cellNetCtl, cellNetCtlScanGameInt); + REG_FUNC(cellNetCtl, cellNetCtlAddHandlerGameInt); + REG_FUNC(cellNetCtl, cellNetCtlConnectGameInt); + REG_FUNC(cellNetCtl, cellNetCtlDelHandlerGameInt); + REG_FUNC(cellNetCtl, cellNetCtlDisconnectGameInt); + REG_FUNC(cellNetCtl, cellNetCtlGetInfoGameInt); + REG_FUNC(cellNetCtl, cellNetCtlGetScanInfoGameInt); + REG_FUNC(cellNetCtl, cellNetCtlGetStateGameInt); + REG_FUNC(cellNetCtl, cellNetCtlScanGameInt); - REG_FUNC(cellNetCtl, cellGameUpdateInit); - REG_FUNC(cellNetCtl, cellGameUpdateTerm); + 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); -}); + 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/rpcs3/Emu/Cell/Modules/cellNetCtl.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellNetCtl.h index b5f031a08..3ea2ee041 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellNetCtl.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellNetCtl.h @@ -5,89 +5,89 @@ // Error Codes enum CellNetCtlError : u32 { - CELL_NET_CTL_ERROR_NOT_INITIALIZED = 0x80130101, - CELL_NET_CTL_ERROR_NOT_TERMINATED = 0x80130102, - CELL_NET_CTL_ERROR_HANDLER_MAX = 0x80130103, - CELL_NET_CTL_ERROR_ID_NOT_FOUND = 0x80130104, - CELL_NET_CTL_ERROR_INVALID_ID = 0x80130105, - CELL_NET_CTL_ERROR_INVALID_CODE = 0x80130106, - CELL_NET_CTL_ERROR_INVALID_ADDR = 0x80130107, - CELL_NET_CTL_ERROR_NOT_CONNECTED = 0x80130108, - CELL_NET_CTL_ERROR_NOT_AVAIL = 0x80130109, - CELL_NET_CTL_ERROR_INVALID_TYPE = 0x8013010a, - CELL_NET_CTL_ERROR_INVALID_SIZE = 0x8013010b, - CELL_NET_CTL_ERROR_NET_DISABLED = 0x80130181, - CELL_NET_CTL_ERROR_NET_NOT_CONNECTED = 0x80130182, - CELL_NET_CTL_ERROR_NP_NO_ACCOUNT = 0x80130183, - CELL_NET_CTL_ERROR_NP_RESERVED1 = 0x80130184, - CELL_NET_CTL_ERROR_NP_RESERVED2 = 0x80130185, + CELL_NET_CTL_ERROR_NOT_INITIALIZED = 0x80130101, + CELL_NET_CTL_ERROR_NOT_TERMINATED = 0x80130102, + CELL_NET_CTL_ERROR_HANDLER_MAX = 0x80130103, + CELL_NET_CTL_ERROR_ID_NOT_FOUND = 0x80130104, + CELL_NET_CTL_ERROR_INVALID_ID = 0x80130105, + CELL_NET_CTL_ERROR_INVALID_CODE = 0x80130106, + CELL_NET_CTL_ERROR_INVALID_ADDR = 0x80130107, + CELL_NET_CTL_ERROR_NOT_CONNECTED = 0x80130108, + CELL_NET_CTL_ERROR_NOT_AVAIL = 0x80130109, + CELL_NET_CTL_ERROR_INVALID_TYPE = 0x8013010a, + CELL_NET_CTL_ERROR_INVALID_SIZE = 0x8013010b, + CELL_NET_CTL_ERROR_NET_DISABLED = 0x80130181, + CELL_NET_CTL_ERROR_NET_NOT_CONNECTED = 0x80130182, + CELL_NET_CTL_ERROR_NP_NO_ACCOUNT = 0x80130183, + CELL_NET_CTL_ERROR_NP_RESERVED1 = 0x80130184, + CELL_NET_CTL_ERROR_NP_RESERVED2 = 0x80130185, CELL_NET_CTL_ERROR_NET_CABLE_NOT_CONNECTED = 0x80130186, - CELL_NET_CTL_ERROR_DIALOG_CANCELED = 0x80130190, - CELL_NET_CTL_ERROR_DIALOG_ABORTED = 0x80130191, + CELL_NET_CTL_ERROR_DIALOG_CANCELED = 0x80130190, + CELL_NET_CTL_ERROR_DIALOG_ABORTED = 0x80130191, - CELL_NET_CTL_ERROR_WLAN_DEAUTHED = 0x80130137, + CELL_NET_CTL_ERROR_WLAN_DEAUTHED = 0x80130137, CELL_NET_CTL_ERROR_WLAN_KEYINFO_EXCHNAGE_TIMEOUT = 0x8013013d, - CELL_NET_CTL_ERROR_WLAN_ASSOC_FAILED = 0x8013013e, - CELL_NET_CTL_ERROR_WLAN_AP_DISAPPEARED = 0x8013013f, - CELL_NET_CTL_ERROR_PPPOE_SESSION_INIT = 0x80130409, - CELL_NET_CTL_ERROR_PPPOE_SESSION_NO_PADO = 0x8013040a, - CELL_NET_CTL_ERROR_PPPOE_SESSION_NO_PADS = 0x8013040b, - CELL_NET_CTL_ERROR_PPPOE_SESSION_GET_PADT = 0x8013040d, - CELL_NET_CTL_ERROR_PPPOE_SESSION_SERVICE_NAME = 0x8013040f, - CELL_NET_CTL_ERROR_PPPOE_SESSION_AC_SYSTEM = 0x80130410, - CELL_NET_CTL_ERROR_PPPOE_SESSION_GENERIC = 0x80130411, - CELL_NET_CTL_ERROR_PPPOE_STATUS_AUTH = 0x80130412, - CELL_NET_CTL_ERROR_PPPOE_STATUS_NETWORK = 0x80130413, - CELL_NET_CTL_ERROR_PPPOE_STATUS_TERMINATE = 0x80130414, - CELL_NET_CTL_ERROR_DHCP_LEASE_TIME = 0x80130504, + CELL_NET_CTL_ERROR_WLAN_ASSOC_FAILED = 0x8013013e, + CELL_NET_CTL_ERROR_WLAN_AP_DISAPPEARED = 0x8013013f, + CELL_NET_CTL_ERROR_PPPOE_SESSION_INIT = 0x80130409, + CELL_NET_CTL_ERROR_PPPOE_SESSION_NO_PADO = 0x8013040a, + CELL_NET_CTL_ERROR_PPPOE_SESSION_NO_PADS = 0x8013040b, + CELL_NET_CTL_ERROR_PPPOE_SESSION_GET_PADT = 0x8013040d, + CELL_NET_CTL_ERROR_PPPOE_SESSION_SERVICE_NAME = 0x8013040f, + CELL_NET_CTL_ERROR_PPPOE_SESSION_AC_SYSTEM = 0x80130410, + CELL_NET_CTL_ERROR_PPPOE_SESSION_GENERIC = 0x80130411, + CELL_NET_CTL_ERROR_PPPOE_STATUS_AUTH = 0x80130412, + CELL_NET_CTL_ERROR_PPPOE_STATUS_NETWORK = 0x80130413, + CELL_NET_CTL_ERROR_PPPOE_STATUS_TERMINATE = 0x80130414, + CELL_NET_CTL_ERROR_DHCP_LEASE_TIME = 0x80130504, - CELL_GAMEUPDATE_ERROR_NOT_INITIALIZED = 0x8002cc01, - CELL_GAMEUPDATE_ERROR_ALREADY_INITIALIZED = 0x8002cc02, - CELL_GAMEUPDATE_ERROR_INVALID_ADDR = 0x8002cc03, - CELL_GAMEUPDATE_ERROR_INVALID_SIZE = 0x8002cc04, - CELL_GAMEUPDATE_ERROR_INVALID_MEMORY_CONTAINER = 0x8002cc05, + CELL_GAMEUPDATE_ERROR_NOT_INITIALIZED = 0x8002cc01, + CELL_GAMEUPDATE_ERROR_ALREADY_INITIALIZED = 0x8002cc02, + CELL_GAMEUPDATE_ERROR_INVALID_ADDR = 0x8002cc03, + CELL_GAMEUPDATE_ERROR_INVALID_SIZE = 0x8002cc04, + CELL_GAMEUPDATE_ERROR_INVALID_MEMORY_CONTAINER = 0x8002cc05, CELL_GAMEUPDATE_ERROR_INSUFFICIENT_MEMORY_CONTAINER = 0x8002cc06, - CELL_GAMEUPDATE_ERROR_BUSY = 0x8002cc07, - CELL_GAMEUPDATE_ERROR_NOT_START = 0x8002cc08, - CELL_GAMEUPDATE_ERROR_LOAD_FAILED = 0x8002cc09, + CELL_GAMEUPDATE_ERROR_BUSY = 0x8002cc07, + CELL_GAMEUPDATE_ERROR_NOT_START = 0x8002cc08, + CELL_GAMEUPDATE_ERROR_LOAD_FAILED = 0x8002cc09, }; // Network connection states enum CellNetCtlState : s32 { CELL_NET_CTL_STATE_Disconnected = 0, - CELL_NET_CTL_STATE_Connecting = 1, - CELL_NET_CTL_STATE_IPObtaining = 2, - CELL_NET_CTL_STATE_IPObtained = 3, + CELL_NET_CTL_STATE_Connecting = 1, + CELL_NET_CTL_STATE_IPObtaining = 2, + CELL_NET_CTL_STATE_IPObtained = 3, }; // Transition connection states enum { - CELL_NET_CTL_EVENT_CONNECT_REQ = 0, - CELL_NET_CTL_EVENT_ESTABLISH = 1, - CELL_NET_CTL_EVENT_GET_IP = 2, - CELL_NET_CTL_EVENT_DISCONNECT_REQ = 3, - CELL_NET_CTL_EVENT_ERROR = 4, + CELL_NET_CTL_EVENT_CONNECT_REQ = 0, + CELL_NET_CTL_EVENT_ESTABLISH = 1, + CELL_NET_CTL_EVENT_GET_IP = 2, + CELL_NET_CTL_EVENT_DISCONNECT_REQ = 3, + CELL_NET_CTL_EVENT_ERROR = 4, CELL_NET_CTL_EVENT_LINK_DISCONNECTED = 5, - CELL_NET_CTL_EVENT_AUTO_RETRY = 6, + CELL_NET_CTL_EVENT_AUTO_RETRY = 6, }; // Network connection devices enum { - CELL_NET_CTL_DEVICE_WIRED = 0, + CELL_NET_CTL_DEVICE_WIRED = 0, CELL_NET_CTL_DEVICE_WIRELESS = 1, }; // Cable connection types enum { - CELL_NET_CTL_LINK_TYPE_AUTO = 0, - CELL_NET_CTL_LINK_TYPE_10BASE_HALF = 1, - CELL_NET_CTL_LINK_TYPE_10BASE_FULL = 2, - CELL_NET_CTL_LINK_TYPE_100BASE_HALF = 3, - CELL_NET_CTL_LINK_TYPE_100BASE_FULL = 4, + CELL_NET_CTL_LINK_TYPE_AUTO = 0, + CELL_NET_CTL_LINK_TYPE_10BASE_HALF = 1, + CELL_NET_CTL_LINK_TYPE_10BASE_FULL = 2, + CELL_NET_CTL_LINK_TYPE_100BASE_HALF = 3, + CELL_NET_CTL_LINK_TYPE_100BASE_FULL = 4, CELL_NET_CTL_LINK_TYPE_1000BASE_HALF = 5, CELL_NET_CTL_LINK_TYPE_1000BASE_FULL = 6, }; @@ -96,94 +96,94 @@ enum enum { CELL_NET_CTL_LINK_DISCONNECTED = 0, - CELL_NET_CTL_LINK_CONNECTED = 1, + CELL_NET_CTL_LINK_CONNECTED = 1, }; // Wireless connection security measures enum { - CELL_NET_CTL_WLAN_SECURITY_NOAUTH = 0, - CELL_NET_CTL_WLAN_SECURITY_WEP = 1, - CELL_NET_CTL_WLAN_SECURITY_WPAPSK_TKIP = 2, - CELL_NET_CTL_WLAN_SECURITY_WPAPSK_AES = 3, - CELL_NET_CTL_WLAN_SECURITY_UNSUPPORTED = 4, - CELL_NET_CTL_WLAN_SECURITY_WPA2PSK_TKIP = 5, - CELL_NET_CTL_WLAN_SECURITY_WPA2PSK_AES = 6, + CELL_NET_CTL_WLAN_SECURITY_NOAUTH = 0, + CELL_NET_CTL_WLAN_SECURITY_WEP = 1, + CELL_NET_CTL_WLAN_SECURITY_WPAPSK_TKIP = 2, + CELL_NET_CTL_WLAN_SECURITY_WPAPSK_AES = 3, + CELL_NET_CTL_WLAN_SECURITY_UNSUPPORTED = 4, + CELL_NET_CTL_WLAN_SECURITY_WPA2PSK_TKIP = 5, + CELL_NET_CTL_WLAN_SECURITY_WPA2PSK_AES = 6, CELL_NET_CTL_WLAN_SECURITY_WPAPSK_WPA2PSK = 7, }; // 802.1X settings enum { - CELL_NET_CTL_8021X_NONE = 0, + CELL_NET_CTL_8021X_NONE = 0, CELL_NET_CTL_8021X_EAP_MD5 = 1, }; // IP settings enum { - CELL_NET_CTL_IP_DHCP = 0, + CELL_NET_CTL_IP_DHCP = 0, CELL_NET_CTL_IP_STATIC = 1, - CELL_NET_CTL_IP_PPPOE = 2, + CELL_NET_CTL_IP_PPPOE = 2, }; // HTTP proxy settings enum { CELL_NET_CTL_HTTP_PROXY_OFF = 0, - CELL_NET_CTL_HTTP_PROXY_ON = 1, + CELL_NET_CTL_HTTP_PROXY_ON = 1, }; // UPnP settings enum { - CELL_NET_CTL_UPNP_ON = 0, + CELL_NET_CTL_UPNP_ON = 0, CELL_NET_CTL_UPNP_OFF = 1, }; // Codes for information enum { - CELL_NET_CTL_INFO_DEVICE = 1, - CELL_NET_CTL_INFO_ETHER_ADDR = 2, - CELL_NET_CTL_INFO_MTU = 3, - CELL_NET_CTL_INFO_LINK = 4, - CELL_NET_CTL_INFO_LINK_TYPE = 5, - CELL_NET_CTL_INFO_BSSID = 6, - CELL_NET_CTL_INFO_SSID = 7, - CELL_NET_CTL_INFO_WLAN_SECURITY = 8, - CELL_NET_CTL_INFO_8021X_TYPE = 9, - CELL_NET_CTL_INFO_8021X_AUTH_NAME = 10, - CELL_NET_CTL_INFO_RSSI = 11, - CELL_NET_CTL_INFO_CHANNEL = 12, - CELL_NET_CTL_INFO_IP_CONFIG = 13, - CELL_NET_CTL_INFO_DHCP_HOSTNAME = 14, - CELL_NET_CTL_INFO_PPPOE_AUTH_NAME = 15, - CELL_NET_CTL_INFO_IP_ADDRESS = 16, - CELL_NET_CTL_INFO_NETMASK = 17, - CELL_NET_CTL_INFO_DEFAULT_ROUTE = 18, - CELL_NET_CTL_INFO_PRIMARY_DNS = 19, - CELL_NET_CTL_INFO_SECONDARY_DNS = 20, + CELL_NET_CTL_INFO_DEVICE = 1, + CELL_NET_CTL_INFO_ETHER_ADDR = 2, + CELL_NET_CTL_INFO_MTU = 3, + CELL_NET_CTL_INFO_LINK = 4, + CELL_NET_CTL_INFO_LINK_TYPE = 5, + CELL_NET_CTL_INFO_BSSID = 6, + CELL_NET_CTL_INFO_SSID = 7, + CELL_NET_CTL_INFO_WLAN_SECURITY = 8, + CELL_NET_CTL_INFO_8021X_TYPE = 9, + CELL_NET_CTL_INFO_8021X_AUTH_NAME = 10, + CELL_NET_CTL_INFO_RSSI = 11, + CELL_NET_CTL_INFO_CHANNEL = 12, + CELL_NET_CTL_INFO_IP_CONFIG = 13, + CELL_NET_CTL_INFO_DHCP_HOSTNAME = 14, + CELL_NET_CTL_INFO_PPPOE_AUTH_NAME = 15, + CELL_NET_CTL_INFO_IP_ADDRESS = 16, + CELL_NET_CTL_INFO_NETMASK = 17, + CELL_NET_CTL_INFO_DEFAULT_ROUTE = 18, + CELL_NET_CTL_INFO_PRIMARY_DNS = 19, + CELL_NET_CTL_INFO_SECONDARY_DNS = 20, CELL_NET_CTL_INFO_HTTP_PROXY_CONFIG = 21, CELL_NET_CTL_INFO_HTTP_PROXY_SERVER = 22, - CELL_NET_CTL_INFO_HTTP_PROXY_PORT = 23, - CELL_NET_CTL_INFO_UPNP_CONFIG = 24, - CELL_NET_CTL_INFO_RESERVED1 = 25, - CELL_NET_CTL_INFO_RESERVED2 = 26, + CELL_NET_CTL_INFO_HTTP_PROXY_PORT = 23, + CELL_NET_CTL_INFO_UPNP_CONFIG = 24, + CELL_NET_CTL_INFO_RESERVED1 = 25, + CELL_NET_CTL_INFO_RESERVED2 = 26, }; // Network start dialogs enum { CELL_NET_CTL_NETSTART_TYPE_NET = 0, - CELL_NET_CTL_NETSTART_TYPE_NP = 1, + CELL_NET_CTL_NETSTART_TYPE_NP = 1, CELL_NET_CTL_NETSTART_TYPE_MAX = 2, }; // Network start dialog statuses enum { - CELL_SYSUTIL_NET_CTL_NETSTART_LOADED = 0x0801, + CELL_SYSUTIL_NET_CTL_NETSTART_LOADED = 0x0801, CELL_SYSUTIL_NET_CTL_NETSTART_FINISHED = 0x0802, CELL_SYSUTIL_NET_CTL_NETSTART_UNLOADED = 0x0803, }; @@ -192,16 +192,16 @@ enum enum { CELL_NET_CTL_NATINFO_UPNP_UNCHECKED = 0, - CELL_NET_CTL_NATINFO_UPNP_NO = 1, - CELL_NET_CTL_NATINFO_UPNP_USED = 2, + CELL_NET_CTL_NATINFO_UPNP_NO = 1, + CELL_NET_CTL_NATINFO_UPNP_USED = 2, }; // STUN NAT statuses enum { CELL_NET_CTL_NATINFO_STUN_UNCHECKED = 0, - CELL_NET_CTL_NATINFO_STUN_FAILED = 1, - CELL_NET_CTL_NATINFO_STUN_OK = 2, + CELL_NET_CTL_NATINFO_STUN_FAILED = 1, + CELL_NET_CTL_NATINFO_STUN_OK = 2, }; // NAT types @@ -214,15 +214,15 @@ enum enum { - CELL_NET_CTL_ETHER_ADDR_LEN = 6, - CELL_NET_CTL_BSSID_LEN = 6, - CELL_NET_CTL_SSID_LEN = 32, + CELL_NET_CTL_ETHER_ADDR_LEN = 6, + CELL_NET_CTL_BSSID_LEN = 6, + CELL_NET_CTL_SSID_LEN = 32, CELL_NET_CTL_WLAN_SECURITY_KEY_LEN = (64 + 1), - CELL_NET_CTL_AUTH_NAME_LEN = (127 + 1), - CELL_NET_CTL_AUTH_KEY_LEN = (127 + 1), - CELL_NET_CTL_DHCP_HOSTNAME_LEN = (254 + 1), - CELL_NET_CTL_HOSTNAME_LEN = (255 + 1), - CELL_NET_CTL_IPV4_ADDR_STR_LEN = 16, + CELL_NET_CTL_AUTH_NAME_LEN = (127 + 1), + CELL_NET_CTL_AUTH_KEY_LEN = (127 + 1), + CELL_NET_CTL_DHCP_HOSTNAME_LEN = (254 + 1), + CELL_NET_CTL_HOSTNAME_LEN = (255 + 1), + CELL_NET_CTL_IPV4_ADDR_STR_LEN = 16, }; struct CellNetCtlEtherAddr @@ -294,42 +294,42 @@ inline const char* InfoCodeToName(s32 code) { switch (code) { - case CELL_NET_CTL_INFO_DEVICE: return "INFO_DEVICE"; - case CELL_NET_CTL_INFO_ETHER_ADDR: return "INFO_ETHER_ADDR"; - case CELL_NET_CTL_INFO_MTU: return "INFO_MTU"; - case CELL_NET_CTL_INFO_LINK: return "INFO_LINK"; - case CELL_NET_CTL_INFO_LINK_TYPE: return "INFO_LINK_TYPE"; - case CELL_NET_CTL_INFO_BSSID: return "INFO_BSSID"; - case CELL_NET_CTL_INFO_SSID: return "INFO_SSID"; - case CELL_NET_CTL_INFO_WLAN_SECURITY: return "INFO_WLAN_SECURITY"; - case CELL_NET_CTL_INFO_8021X_TYPE: return "INFO_8021X_TYPE"; - case CELL_NET_CTL_INFO_8021X_AUTH_NAME: return "INFO_8021X_AUTH_NAME"; - case CELL_NET_CTL_INFO_RSSI: return "INFO_RSSI"; - case CELL_NET_CTL_INFO_CHANNEL: return "INFO_CHANNEL"; - case CELL_NET_CTL_INFO_IP_CONFIG: return "INFO_IP_CONFIG"; - case CELL_NET_CTL_INFO_DHCP_HOSTNAME: return "INFO_DHCP_HOSTNAME"; - case CELL_NET_CTL_INFO_PPPOE_AUTH_NAME: return "INFO_PPPOE_AUTH_NAME"; - case CELL_NET_CTL_INFO_IP_ADDRESS: return "INFO_IP_ADDRESS"; - case CELL_NET_CTL_INFO_NETMASK: return "INFO_NETMASK"; - case CELL_NET_CTL_INFO_DEFAULT_ROUTE: return "INFO_DEFAULT_ROUTE"; - case CELL_NET_CTL_INFO_PRIMARY_DNS: return "INFO_PRIMARY_DNS"; - case CELL_NET_CTL_INFO_SECONDARY_DNS: return "INFO_SECONDARY_DNS"; - case CELL_NET_CTL_INFO_HTTP_PROXY_CONFIG: return "INFO_HTTP_PROXY_CONFIG"; - case CELL_NET_CTL_INFO_HTTP_PROXY_SERVER: return "INFO_HTTP_PROXY_SERVER"; - case CELL_NET_CTL_INFO_HTTP_PROXY_PORT: return "INFO_HTTP_PROXY_PORT"; - case CELL_NET_CTL_INFO_UPNP_CONFIG: return "INFO_UPNP_CONFIG"; + case CELL_NET_CTL_INFO_DEVICE: return "INFO_DEVICE"; + case CELL_NET_CTL_INFO_ETHER_ADDR: return "INFO_ETHER_ADDR"; + case CELL_NET_CTL_INFO_MTU: return "INFO_MTU"; + case CELL_NET_CTL_INFO_LINK: return "INFO_LINK"; + case CELL_NET_CTL_INFO_LINK_TYPE: return "INFO_LINK_TYPE"; + case CELL_NET_CTL_INFO_BSSID: return "INFO_BSSID"; + case CELL_NET_CTL_INFO_SSID: return "INFO_SSID"; + case CELL_NET_CTL_INFO_WLAN_SECURITY: return "INFO_WLAN_SECURITY"; + case CELL_NET_CTL_INFO_8021X_TYPE: return "INFO_8021X_TYPE"; + case CELL_NET_CTL_INFO_8021X_AUTH_NAME: return "INFO_8021X_AUTH_NAME"; + case CELL_NET_CTL_INFO_RSSI: return "INFO_RSSI"; + case CELL_NET_CTL_INFO_CHANNEL: return "INFO_CHANNEL"; + case CELL_NET_CTL_INFO_IP_CONFIG: return "INFO_IP_CONFIG"; + case CELL_NET_CTL_INFO_DHCP_HOSTNAME: return "INFO_DHCP_HOSTNAME"; + case CELL_NET_CTL_INFO_PPPOE_AUTH_NAME: return "INFO_PPPOE_AUTH_NAME"; + case CELL_NET_CTL_INFO_IP_ADDRESS: return "INFO_IP_ADDRESS"; + case CELL_NET_CTL_INFO_NETMASK: return "INFO_NETMASK"; + case CELL_NET_CTL_INFO_DEFAULT_ROUTE: return "INFO_DEFAULT_ROUTE"; + case CELL_NET_CTL_INFO_PRIMARY_DNS: return "INFO_PRIMARY_DNS"; + case CELL_NET_CTL_INFO_SECONDARY_DNS: return "INFO_SECONDARY_DNS"; + case CELL_NET_CTL_INFO_HTTP_PROXY_CONFIG: return "INFO_HTTP_PROXY_CONFIG"; + case CELL_NET_CTL_INFO_HTTP_PROXY_SERVER: return "INFO_HTTP_PROXY_SERVER"; + case CELL_NET_CTL_INFO_HTTP_PROXY_PORT: return "INFO_HTTP_PROXY_PORT"; + case CELL_NET_CTL_INFO_UPNP_CONFIG: return "INFO_UPNP_CONFIG"; default: return "???"; } } enum { - CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE = 0, - CELL_GAMEUPDATE_RESULT_STATUS_UPDATE_FOUND = 1, - CELL_GAMEUPDATE_RESULT_STATUS_MAINTENANCE = 2, - CELL_GAMEUPDATE_RESULT_STATUS_ERROR = 3, - CELL_GAMEUPDATE_RESULT_STATUS_CANCELLED = 4, - CELL_GAMEUPDATE_RESULT_STATUS_FINISHED = 5, - CELL_GAMEUPDATE_RESULT_STATUS_ABORTED = 6, + CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE = 0, + CELL_GAMEUPDATE_RESULT_STATUS_UPDATE_FOUND = 1, + CELL_GAMEUPDATE_RESULT_STATUS_MAINTENANCE = 2, + CELL_GAMEUPDATE_RESULT_STATUS_ERROR = 3, + CELL_GAMEUPDATE_RESULT_STATUS_CANCELLED = 4, + CELL_GAMEUPDATE_RESULT_STATUS_FINISHED = 5, + CELL_GAMEUPDATE_RESULT_STATUS_ABORTED = 6, CELL_GAMEUPDATE_RESULT_STATUS_SYSTEM_UPDATE_NEEDED = 7 }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp index 5b2c45e99..16cdd4807 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp @@ -17,38 +17,38 @@ LOG_CHANNEL(cellOskDialog); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_OSKDIALOG_ERROR_IME_ALREADY_IN_USE); - STR_CASE(CELL_OSKDIALOG_ERROR_GET_SIZE_ERROR); - STR_CASE(CELL_OSKDIALOG_ERROR_UNKNOWN); - STR_CASE(CELL_OSKDIALOG_ERROR_PARAM); - } + switch (error) + { + STR_CASE(CELL_OSKDIALOG_ERROR_IME_ALREADY_IN_USE); + STR_CASE(CELL_OSKDIALOG_ERROR_GET_SIZE_ERROR); + STR_CASE(CELL_OSKDIALOG_ERROR_UNKNOWN); + STR_CASE(CELL_OSKDIALOG_ERROR_PARAM); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto mode) - { - switch (mode) { - STR_CASE(CELL_OSKDIALOG_CONTINUOUS_MODE_NONE); - STR_CASE(CELL_OSKDIALOG_CONTINUOUS_MODE_REMAIN_OPEN); - STR_CASE(CELL_OSKDIALOG_CONTINUOUS_MODE_HIDE); - STR_CASE(CELL_OSKDIALOG_CONTINUOUS_MODE_SHOW); - } + switch (mode) + { + STR_CASE(CELL_OSKDIALOG_CONTINUOUS_MODE_NONE); + STR_CASE(CELL_OSKDIALOG_CONTINUOUS_MODE_REMAIN_OPEN); + STR_CASE(CELL_OSKDIALOG_CONTINUOUS_MODE_HIDE); + STR_CASE(CELL_OSKDIALOG_CONTINUOUS_MODE_SHOW); + } - return unknown; - }); + return unknown; + }); } void osk_info::reset() @@ -71,7 +71,7 @@ void osk_info::reset() half_byte_kana_enabled = false; supported_languages = 0; dimmer_enabled = true; - base_color = OskDialogBase::color{ 0.2f, 0.2f, 0.2f, 1.0f }; + base_color = OskDialogBase::color{0.2f, 0.2f, 0.2f, 1.0f}; pointer_enabled = false; pointer_x = 0.0f; pointer_y = 0.0f; @@ -182,13 +182,13 @@ extern bool close_osk_from_ps_button() bool close_osk = false; sysutil_register_cb([&](ppu_thread& cb_ppu) -> s32 - { - cellOskDialog.notice("osk_force_finish_callback()"); - close_osk = cb(cb_ppu); - cellOskDialog.notice("osk_force_finish_callback returned %d", close_osk); - done = true; - return 0; - }); + { + cellOskDialog.notice("osk_force_finish_callback()"); + close_osk = cb(cb_ppu); + cellOskDialog.notice("osk_force_finish_callback returned %d", close_osk); + done = true; + return 0; + }); // wait for check callback while (!done && !Emu.IsStopped()) @@ -216,7 +216,6 @@ extern bool close_osk_from_ps_button() return true; } - error_code cellOskDialogLoadAsync(u32 container, vm::ptr dialogParam, vm::ptr inputFieldInfo) { cellOskDialog.warning("cellOskDialogLoadAsync(container=0x%x, dialogParam=*0x%x, inputFieldInfo=*0x%x)", container, dialogParam, inputFieldInfo); @@ -305,24 +304,25 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr dia for (i = 0; i < CELL_OSKDIALOG_STRING_SIZE - 1; i++) { string_to_send[i] = osk->osk_text[i]; - if (osk->osk_text[i] == 0) break; + if (osk->osk_text[i] == 0) + break; } sysutil_register_cb([&, length = i, string_to_send = std::move(string_to_send)](ppu_thread& cb_ppu) -> s32 - { - vm::var> string_var(CELL_OSKDIALOG_STRING_SIZE, string_to_send.data()); - - const u32 return_value = ccb(cb_ppu, string_var.begin(), static_cast(length)); - cellOskDialog.warning("osk_confirm_callback return_value=%d", return_value); - - for (u32 i = 0; i < CELL_OSKDIALOG_STRING_SIZE - 1; i++) { - osk->osk_text[i] = string_var.begin()[i]; - } + vm::var> string_var(CELL_OSKDIALOG_STRING_SIZE, string_to_send.data()); - done = true; - return 0; - }); + const u32 return_value = ccb(cb_ppu, string_var.begin(), static_cast(length)); + cellOskDialog.warning("osk_confirm_callback return_value=%d", return_value); + + for (u32 i = 0; i < CELL_OSKDIALOG_STRING_SIZE - 1; i++) + { + osk->osk_text[i] = string_var.begin()[i]; + } + + done = true; + return 0; + }); // wait for check callback while (!done && !Emu.IsStopped()) @@ -501,89 +501,90 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr dia std::array string_to_send{}; sysutil_register_cb([key_message, string_to_send, event_hook_callback](ppu_thread& cb_ppu) -> s32 - { - // Prepare callback variables - vm::var keyMessage(key_message); - vm::var action(CELL_OSKDIALOG_CHANGE_NO_EVENT); - vm::var> pActionInfo(::narrow(string_to_send.size()), string_to_send.data()); - - // Create helpers for logging - std::u16string utf16_string(reinterpret_cast(string_to_send.data()), string_to_send.size()); - std::string utf8_string = utf16_to_ascii8(utf16_string); - - cellOskDialog.notice("osk_hardware_keyboard_event_hook_callback(led=%d, mkey=%d, keycode=%d, action=%d, pActionInfo='%s')", keyMessage->led, keyMessage->mkey, keyMessage->keycode, *action, utf8_string); - - // Call the hook function. The game reads and writes pActionInfo. We need to react based on the returned action. - const bool return_value = event_hook_callback(cb_ppu, keyMessage, action, pActionInfo); - ensure(action); - ensure(pActionInfo); - - // Parse returned text for logging - utf16_string.clear(); - for (u32 i = 0; i < max_size; i++) { - const u16 code = pActionInfo[i]; - if (!code) break; - utf16_string.push_back(code); - } - utf8_string = utf16_to_ascii8(utf16_string); + // Prepare callback variables + vm::var keyMessage(key_message); + vm::var action(CELL_OSKDIALOG_CHANGE_NO_EVENT); + vm::var> pActionInfo(::narrow(string_to_send.size()), string_to_send.data()); - cellOskDialog.notice("osk_hardware_keyboard_event_hook_callback: return_value=%d, action=%d, pActionInfo='%s'", return_value, *action, utf8_string); + // Create helpers for logging + std::u16string utf16_string(reinterpret_cast(string_to_send.data()), string_to_send.size()); + std::string utf8_string = utf16_to_ascii8(utf16_string); - // Check if the hook function was successful - if (return_value) - { - const auto osk = _get_osk_dialog(false); - if (!osk) + cellOskDialog.notice("osk_hardware_keyboard_event_hook_callback(led=%d, mkey=%d, keycode=%d, action=%d, pActionInfo='%s')", keyMessage->led, keyMessage->mkey, keyMessage->keycode, *action, utf8_string); + + // Call the hook function. The game reads and writes pActionInfo. We need to react based on the returned action. + const bool return_value = event_hook_callback(cb_ppu, keyMessage, action, pActionInfo); + ensure(action); + ensure(pActionInfo); + + // Parse returned text for logging + utf16_string.clear(); + for (u32 i = 0; i < max_size; i++) { - cellOskDialog.error("osk_hardware_keyboard_event_hook_callback: osk is null"); - return 0; + const u16 code = pActionInfo[i]; + if (!code) + break; + utf16_string.push_back(code); + } + utf8_string = utf16_to_ascii8(utf16_string); + + cellOskDialog.notice("osk_hardware_keyboard_event_hook_callback: return_value=%d, action=%d, pActionInfo='%s'", return_value, *action, utf8_string); + + // Check if the hook function was successful + if (return_value) + { + const auto osk = _get_osk_dialog(false); + if (!osk) + { + cellOskDialog.error("osk_hardware_keyboard_event_hook_callback: osk is null"); + return 0; + } + + auto& info = g_fxo->get(); + std::lock_guard lock(info.text_mtx); + + switch (*action) + { + case CELL_OSKDIALOG_CHANGE_NO_EVENT: + case CELL_OSKDIALOG_CHANGE_EVENT_CANCEL: + { + // Do nothing + break; + } + case CELL_OSKDIALOG_CHANGE_WORDS_INPUT: + { + // TODO: Replace unconfirmed string. + cellOskDialog.todo("osk_hardware_keyboard_event_hook_callback: replace unconfirmed string with '%s'", utf8_string); + break; + } + case CELL_OSKDIALOG_CHANGE_WORDS_INSERT: + { + // TODO: Remove unconfirmed string + cellOskDialog.todo("osk_hardware_keyboard_event_hook_callback: remove unconfirmed string"); + + // Set confirmed string and reset unconfirmed string + cellOskDialog.notice("osk_hardware_keyboard_event_hook_callback: inserting string '%s'", utf8_string); + osk->Insert(utf16_string); + break; + } + case CELL_OSKDIALOG_CHANGE_WORDS_REPLACE_ALL: + { + // Replace confirmed string and remove unconfirmed string. + cellOskDialog.notice("osk_hardware_keyboard_event_hook_callback: replacing all strings with '%s'", utf8_string); + osk->SetText(utf16_string); + break; + } + default: + { + cellOskDialog.error("osk_hardware_keyboard_event_hook_callback returned invalid action (%d)", *action); + break; + } + } } - auto& info = g_fxo->get(); - std::lock_guard lock(info.text_mtx); - - switch (*action) - { - case CELL_OSKDIALOG_CHANGE_NO_EVENT: - case CELL_OSKDIALOG_CHANGE_EVENT_CANCEL: - { - // Do nothing - break; - } - case CELL_OSKDIALOG_CHANGE_WORDS_INPUT: - { - // TODO: Replace unconfirmed string. - cellOskDialog.todo("osk_hardware_keyboard_event_hook_callback: replace unconfirmed string with '%s'", utf8_string); - break; - } - case CELL_OSKDIALOG_CHANGE_WORDS_INSERT: - { - // TODO: Remove unconfirmed string - cellOskDialog.todo("osk_hardware_keyboard_event_hook_callback: remove unconfirmed string"); - - // Set confirmed string and reset unconfirmed string - cellOskDialog.notice("osk_hardware_keyboard_event_hook_callback: inserting string '%s'", utf8_string); - osk->Insert(utf16_string); - break; - } - case CELL_OSKDIALOG_CHANGE_WORDS_REPLACE_ALL: - { - // Replace confirmed string and remove unconfirmed string. - cellOskDialog.notice("osk_hardware_keyboard_event_hook_callback: replacing all strings with '%s'", utf8_string); - osk->SetText(utf16_string); - break; - } - default: - { - cellOskDialog.error("osk_hardware_keyboard_event_hook_callback returned invalid action (%d)", *action); - break; - } - } - } - - return 0; - }); + return 0; + }); }; // Set device mask and event lock @@ -602,28 +603,28 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr dia cellOskDialog.notice("cellOskDialogLoadAsync: creating OSK dialog ..."); Emu.BlockingCallFromMainThread([=, &info]() - { - osk->Create({ - .title = get_localized_string(localized_string_id::CELL_OSK_DIALOG_TITLE), - .message = message, - .init_text = osk->osk_text.data(), - .charlimit = maxLength, - .prohibit_flags = prohibitFlgs, - .panel_flag = allowOskPanelFlg, - .support_language = info.supported_languages, - .first_view_panel = firstViewPanel, - .layout = info.layout, - .input_layout = info.input_field_layout_info, - .panel_layout = info.input_panel_layout_info, - .input_field_window_width = info.input_field_window_width, - .input_field_background_transparency = info.input_field_background_transparency, - .initial_scale = info.initial_scale, - .base_color = info.base_color, - .dimmer_enabled = info.dimmer_enabled, - .use_separate_windows = info.use_separate_windows, - .intercept_input = false // We handle the interception manually based on the device mask + { + osk->Create({ + .title = get_localized_string(localized_string_id::CELL_OSK_DIALOG_TITLE), + .message = message, + .init_text = osk->osk_text.data(), + .charlimit = maxLength, + .prohibit_flags = prohibitFlgs, + .panel_flag = allowOskPanelFlg, + .support_language = info.supported_languages, + .first_view_panel = firstViewPanel, + .layout = info.layout, + .input_layout = info.input_field_layout_info, + .panel_layout = info.input_panel_layout_info, + .input_field_window_width = info.input_field_window_width, + .input_field_background_transparency = info.input_field_background_transparency, + .initial_scale = info.initial_scale, + .base_color = info.base_color, + .dimmer_enabled = info.dimmer_enabled, + .use_separate_windows = info.use_separate_windows, + .intercept_input = false // We handle the interception manually based on the device mask + }); }); - }); g_fxo->get().last_dialog_state = CELL_SYSUTIL_OSKDIALOG_LOADED; @@ -799,17 +800,17 @@ error_code cellOskDialogAbort() } const error_code result = osk->state.atomic_op([](OskDialogState& state) -> error_code - { - // Check for open dialog. In this case the dialog is "Open" if it was not unloaded before. - if (state == OskDialogState::Unloaded) { - return CELL_MSGDIALOG_ERROR_DIALOG_NOT_OPENED; - } + // Check for open dialog. In this case the dialog is "Open" if it was not unloaded before. + if (state == OskDialogState::Unloaded) + { + return CELL_MSGDIALOG_ERROR_DIALOG_NOT_OPENED; + } - state = OskDialogState::Abort; + state = OskDialogState::Abort; - return CELL_OK; - }); + return CELL_OK; + }); if (result == CELL_OK) { @@ -867,7 +868,7 @@ error_code cellOskDialogSetSeparateWindowOption(vm::ptrget(); osk.use_separate_windows = true; - osk.osk_continuous_mode = static_cast(+windowOption->continuousMode); + osk.osk_continuous_mode = static_cast(+windowOption->continuousMode); osk.device_mask = windowOption->deviceMask; osk.input_field_window_width = windowOption->inputFieldWindowWidth; osk.input_field_background_transparency = std::clamp(windowOption->inputFieldBackgroundTrans, 0.0f, 1.0f); @@ -1101,7 +1102,7 @@ error_code cellOskDialogExtAddOptionDictionary(vm::cpptr path{}; std::memcpy(path.data(), dictionaryInfo[i]->dictionaryPath.get_ptr(), CELL_IMEJP_DIC_PATH_MAXLENGTH); - paths.push_back({ dictionaryInfo[i]->targetLanguage, path.data() }); + paths.push_back({dictionaryInfo[i]->targetLanguage, path.data()}); } std::vector msgs; @@ -1167,7 +1168,7 @@ error_code cellOskDialogExtSetBaseColor(f32 red, f32 green, f32 blue, f32 alpha) } auto& osk = g_fxo->get(); - osk.base_color = OskDialogBase::color{ red, green, blue, alpha }; + osk.base_color = OskDialogBase::color{red, green, blue, alpha}; return CELL_OK; } @@ -1284,7 +1285,6 @@ error_code cellOskDialogExtRegisterForceFinishCallback(vm::ptr on_osk_close; std::function on_osk_key_input_entered; - atomic_t state{ OskDialogState::Unloaded }; - atomic_t continuous_mode{ CELL_OSKDIALOG_CONTINUOUS_MODE_NONE }; - atomic_t input_device{ CELL_OSKDIALOG_INPUT_DEVICE_PAD }; // The current input device. - atomic_t pad_input_enabled{ true }; // Determines if the OSK consumes the device's input. - atomic_t mouse_input_enabled{ true }; // Determines if the OSK consumes the device's input. - atomic_t keyboard_input_enabled{ true }; // Determines if the OSK consumes the device's input. - atomic_t ignore_device_events{ false }; // Determines if the OSK ignores device events. + atomic_t state{OskDialogState::Unloaded}; + atomic_t continuous_mode{CELL_OSKDIALOG_CONTINUOUS_MODE_NONE}; + atomic_t input_device{CELL_OSKDIALOG_INPUT_DEVICE_PAD}; // The current input device. + atomic_t pad_input_enabled{true}; // Determines if the OSK consumes the device's input. + atomic_t mouse_input_enabled{true}; // Determines if the OSK consumes the device's input. + atomic_t keyboard_input_enabled{true}; // Determines if the OSK consumes the device's input. + atomic_t ignore_device_events{false}; // Determines if the OSK ignores device events. - atomic_t osk_input_result{ CellOskDialogInputFieldResult::CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK }; + atomic_t osk_input_result{CellOskDialogInputFieldResult::CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK}; std::array osk_text{}; }; @@ -344,14 +344,14 @@ struct osk_info osk_window_layout input_panel_layout_info{}; atomic_t key_layout_options = CELL_OSKDIALOG_10KEY_PANEL; atomic_t initial_key_layout = CELL_OSKDIALOG_INITIAL_PANEL_LAYOUT_SYSTEM; // TODO: use - atomic_t initial_input_device = CELL_OSKDIALOG_INPUT_DEVICE_PAD; // OSK at first only receives input from the initial device + atomic_t initial_input_device = CELL_OSKDIALOG_INPUT_DEVICE_PAD; // OSK at first only receives input from the initial device atomic_t clipboard_enabled = false; // For copy and paste atomic_t half_byte_kana_enabled = false; atomic_t supported_languages = 0; // Used to enable non-default languages in the OSK atomic_t dimmer_enabled = true; - atomic_t base_color = OskDialogBase::color{ 0.2f, 0.2f, 0.2f, 1.0f }; + atomic_t base_color = OskDialogBase::color{0.2f, 0.2f, 0.2f, 1.0f}; atomic_t pointer_enabled = false; atomic_t pointer_x = 0.0f; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellOvis.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellOvis.cpp index 4a834c924..8047589c0 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellOvis.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellOvis.cpp @@ -2,8 +2,6 @@ #include "Emu/Cell/PPUModule.h" #include "Emu/Cell/lv2/sys_spu.h" - - LOG_CHANNEL(cellOvis); // Return Codes @@ -14,20 +12,20 @@ enum CellOvisError : u32 CELL_OVIS_ERROR_ALIGN = 0x80410410, }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_OVIS_ERROR_INVAL); - STR_CASE(CELL_OVIS_ERROR_ABORT); - STR_CASE(CELL_OVIS_ERROR_ALIGN); - } + switch (error) + { + STR_CASE(CELL_OVIS_ERROR_INVAL); + STR_CASE(CELL_OVIS_ERROR_ABORT); + STR_CASE(CELL_OVIS_ERROR_ALIGN); + } - return unknown; - }); + return unknown; + }); } error_code cellOvisGetOverlayTableSize(vm::cptr elf) @@ -53,9 +51,9 @@ void cellOvisInvalidateOverlappedSegments(vm::ptr segs, vm::ptr } DECLARE(ppu_module_manager::cellOvis)("cellOvis", []() -{ - REG_FUNC(cellOvis, cellOvisGetOverlayTableSize); - REG_FUNC(cellOvis, cellOvisInitializeOverlayTable); - REG_FUNC(cellOvis, cellOvisFixSpuSegments); - REG_FUNC(cellOvis, cellOvisInvalidateOverlappedSegments); -}); + { + REG_FUNC(cellOvis, cellOvisGetOverlayTableSize); + REG_FUNC(cellOvis, cellOvisInitializeOverlayTable); + REG_FUNC(cellOvis, cellOvisFixSpuSegments); + REG_FUNC(cellOvis, cellOvisInvalidateOverlappedSegments); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellPad.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellPad.cpp index f28d96d1c..6c568bf67 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellPad.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellPad.cpp @@ -16,51 +16,49 @@ extern bool is_input_allowed(); LOG_CHANNEL(cellPad); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_PAD_ERROR_FATAL); - STR_CASE(CELL_PAD_ERROR_INVALID_PARAMETER); - STR_CASE(CELL_PAD_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_PAD_ERROR_UNINITIALIZED); - STR_CASE(CELL_PAD_ERROR_RESOURCE_ALLOCATION_FAILED); - STR_CASE(CELL_PAD_ERROR_DATA_READ_FAILED); - STR_CASE(CELL_PAD_ERROR_NO_DEVICE); - STR_CASE(CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD); - STR_CASE(CELL_PAD_ERROR_TOO_MANY_DEVICES); - STR_CASE(CELL_PAD_ERROR_EBUSY); - } + switch (error) + { + STR_CASE(CELL_PAD_ERROR_FATAL); + STR_CASE(CELL_PAD_ERROR_INVALID_PARAMETER); + STR_CASE(CELL_PAD_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_PAD_ERROR_UNINITIALIZED); + STR_CASE(CELL_PAD_ERROR_RESOURCE_ALLOCATION_FAILED); + STR_CASE(CELL_PAD_ERROR_DATA_READ_FAILED); + STR_CASE(CELL_PAD_ERROR_NO_DEVICE); + STR_CASE(CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD); + STR_CASE(CELL_PAD_ERROR_TOO_MANY_DEVICES); + STR_CASE(CELL_PAD_ERROR_EBUSY); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_PADFILTER_ERROR_INVALID_PARAMETER); - } + switch (error) + { + STR_CASE(CELL_PADFILTER_ERROR_INVALID_PARAMETER); + } - return unknown; - }); + return unknown; + }); } extern void sys_io_serialize(utils::serial& ar); pad_info::pad_info(utils::serial& ar) - : max_connect(ar) - , port_setting(ar) - , reported_info(ar) + : max_connect(ar), port_setting(ar), reported_info(ar) { - //reported_info = {}; + // reported_info = {}; sys_io_serialize(ar); } @@ -120,8 +118,7 @@ void show_debug_overlay(const CellPadData& data, const Pad& pad, const pad_info& "> PID: 0x%04x\n" "> VID: 0x%04x\n" "> Device Type: 0x%08x\n" - "> Class Type: 0x%08x\n" - , + "> Class Type: 0x%08x\n", data.len, "on", data.len >= CELL_PAD_LEN_CHANGE_DEFAULT ? "on" : "off", (setting & CELL_PAD_SETTING_PRESS_ON) ? "on" : "off", data.len >= CELL_PAD_LEN_CHANGE_PRESS_ON ? "on" : "off", @@ -156,8 +153,7 @@ void show_debug_overlay(const CellPadData& data, const Pad& pad, const pad_info& pad.m_product_id, pad.m_vendor_id, pad.m_device_type, - pad.m_class_type - ); + pad.m_class_type); rsx::overlays::set_debug_overlay_text(std::move(text)); } @@ -465,18 +461,18 @@ void pad_get_data(u32 port_no, CellPadData* data, bool get_periph_data = false) { switch (button.m_outKeyCode) { - case CELL_PAD_CTRL_PRESS_RIGHT: set_value(pad->m_press_right, button.m_value, true); break; - case CELL_PAD_CTRL_PRESS_LEFT: set_value(pad->m_press_left, button.m_value, true); break; - case CELL_PAD_CTRL_PRESS_UP: set_value(pad->m_press_up, button.m_value, true); break; - case CELL_PAD_CTRL_PRESS_DOWN: set_value(pad->m_press_down, button.m_value, true); break; + case CELL_PAD_CTRL_PRESS_RIGHT: set_value(pad->m_press_right, button.m_value, true); break; + case CELL_PAD_CTRL_PRESS_LEFT: set_value(pad->m_press_left, button.m_value, true); break; + case CELL_PAD_CTRL_PRESS_UP: set_value(pad->m_press_up, button.m_value, true); break; + case CELL_PAD_CTRL_PRESS_DOWN: set_value(pad->m_press_down, button.m_value, true); break; case CELL_PAD_CTRL_PRESS_TRIANGLE: set_value(pad->m_press_triangle, button.m_value, true, 255, 63); break; // Infrared on RIDE Skateboard - case CELL_PAD_CTRL_PRESS_CIRCLE: set_value(pad->m_press_circle, button.m_value, true, 255, 63); break; // Infrared on RIDE Skateboard - case CELL_PAD_CTRL_PRESS_CROSS: set_value(pad->m_press_cross, button.m_value, true, 255, 63); break; // Infrared on RIDE Skateboard - case CELL_PAD_CTRL_PRESS_SQUARE: set_value(pad->m_press_square, button.m_value, true, 255, 63); break; // Infrared on RIDE Skateboard - case CELL_PAD_CTRL_PRESS_L1: set_value(pad->m_press_L1, button.m_value, true); break; - case CELL_PAD_CTRL_PRESS_R1: set_value(pad->m_press_R1, button.m_value, true); break; - case CELL_PAD_CTRL_PRESS_L2: set_value(pad->m_press_L2, button.m_value, true); break; - case CELL_PAD_CTRL_PRESS_R2: set_value(pad->m_press_R2, button.m_value, true); break; + case CELL_PAD_CTRL_PRESS_CIRCLE: set_value(pad->m_press_circle, button.m_value, true, 255, 63); break; // Infrared on RIDE Skateboard + case CELL_PAD_CTRL_PRESS_CROSS: set_value(pad->m_press_cross, button.m_value, true, 255, 63); break; // Infrared on RIDE Skateboard + case CELL_PAD_CTRL_PRESS_SQUARE: set_value(pad->m_press_square, button.m_value, true, 255, 63); break; // Infrared on RIDE Skateboard + case CELL_PAD_CTRL_PRESS_L1: set_value(pad->m_press_L1, button.m_value, true); break; + case CELL_PAD_CTRL_PRESS_R1: set_value(pad->m_press_R1, button.m_value, true); break; + case CELL_PAD_CTRL_PRESS_L2: set_value(pad->m_press_L2, button.m_value, true); break; + case CELL_PAD_CTRL_PRESS_R2: set_value(pad->m_press_R2, button.m_value, true); break; default: break; } break; @@ -523,7 +519,7 @@ void pad_get_data(u32 port_no, CellPadData* data, bool get_periph_data = false) { // report back new data every ~10 ms even if the input doesn't change // this is observed behaviour when using a Dualshock 3 controller - static std::array last_update = { }; + static std::array last_update = {}; const auto now = steady_clock::now(); if (btnChanged || pad->m_buffer_cleared || now - last_update[port_no] >= 10ms) @@ -628,64 +624,64 @@ void pad_get_data(u32 port_no, CellPadData* data, bool get_periph_data = false) } case CELL_PAD_PCLASS_TYPE_GUITAR: { - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_1] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_2] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_3] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_4] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_5] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_STRUM_UP] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_STRUM_DOWN] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_WHAMMYBAR] = 0x80; // 0x80 – 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H1] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H2] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H3] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H4] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H5] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_1] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_2] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_3] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_4] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_5] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_STRUM_UP] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_STRUM_DOWN] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_WHAMMYBAR] = 0x80; // 0x80 – 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H1] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H2] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H3] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H4] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H5] = get_pressure_value(0, 0x0, 0xFF); data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_5WAY_EFFECT] = 0x0019; // One of 5 values: 0x0019, 0x004C, 0x007F (or 0x0096), 0x00B2, 0x00E5 (or 0x00E2) - data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_TILT_SENS] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_TILT_SENS] = get_pressure_value(0, 0x0, 0xFF); break; } case CELL_PAD_PCLASS_TYPE_DRUM: { - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_SNARE] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_TOM] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_TOM2] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_SNARE] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_TOM] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_TOM2] = get_pressure_value(0, 0x0, 0xFF); data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_TOM_FLOOR] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_KICK] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_KICK] = get_pressure_value(0, 0x0, 0xFF); data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_CYM_HiHAT] = get_pressure_value(0, 0x0, 0xFF); data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_CYM_CRASH] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_CYM_RIDE] = get_pressure_value(0, 0x0, 0xFF); - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_KICK2] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_CYM_RIDE] = get_pressure_value(0, 0x0, 0xFF); + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DRUM_KICK2] = get_pressure_value(0, 0x0, 0xFF); break; } case CELL_PAD_PCLASS_TYPE_DJ: { // First deck - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_MIXER_ATTACK] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_MIXER_CROSSFADER] = 0; // 0x0 - 0x3FF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_MIXER_DSP_DIAL] = 0; // 0x0 - 0x3FF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_STREAM1] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_STREAM2] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_STREAM3] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_PLATTER] = 0x80; // 0x0 - 0xFF (neutral: 0x80) + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_MIXER_ATTACK] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_MIXER_CROSSFADER] = 0; // 0x0 - 0x3FF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_MIXER_DSP_DIAL] = 0; // 0x0 - 0x3FF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_STREAM1] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_STREAM2] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_STREAM3] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_PLATTER] = 0x80; // 0x0 - 0xFF (neutral: 0x80) // Second deck - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_STREAM1] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_STREAM2] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_STREAM3] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_PLATTER] = 0x80; // 0x0 - 0xFF (neutral: 0x80) + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_STREAM1] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_STREAM2] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_STREAM3] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_PLATTER] = 0x80; // 0x0 - 0xFF (neutral: 0x80) break; } case CELL_PAD_PCLASS_TYPE_DANCEMAT: { - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_CIRCLE] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_CROSS] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_CIRCLE] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_CROSS] = 0; // 0x0 or 0xFF data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_TRIANGLE] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_SQUARE] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_RIGHT] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_LEFT] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_UP] = 0; // 0x0 or 0xFF - data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_DOWN] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_SQUARE] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_RIGHT] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_LEFT] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_UP] = 0; // 0x0 or 0xFF + data->button[CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_DOWN] = 0; // 0x0 or 0xFF break; } } @@ -1321,10 +1317,10 @@ void cellPad_init() 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, 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); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellPad.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellPad.h index 0fdd4b23a..0971f00bd 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellPad.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellPad.h @@ -7,16 +7,16 @@ enum CellPadError : u32 { - CELL_PAD_ERROR_FATAL = 0x80121101, - CELL_PAD_ERROR_INVALID_PARAMETER = 0x80121102, - CELL_PAD_ERROR_ALREADY_INITIALIZED = 0x80121103, - CELL_PAD_ERROR_UNINITIALIZED = 0x80121104, + CELL_PAD_ERROR_FATAL = 0x80121101, + CELL_PAD_ERROR_INVALID_PARAMETER = 0x80121102, + CELL_PAD_ERROR_ALREADY_INITIALIZED = 0x80121103, + CELL_PAD_ERROR_UNINITIALIZED = 0x80121104, CELL_PAD_ERROR_RESOURCE_ALLOCATION_FAILED = 0x80121105, - CELL_PAD_ERROR_DATA_READ_FAILED = 0x80121106, - CELL_PAD_ERROR_NO_DEVICE = 0x80121107, - CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD = 0x80121108, - CELL_PAD_ERROR_TOO_MANY_DEVICES = 0x80121109, - CELL_PAD_ERROR_EBUSY = 0x8012110a, + CELL_PAD_ERROR_DATA_READ_FAILED = 0x80121106, + CELL_PAD_ERROR_NO_DEVICE = 0x80121107, + CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD = 0x80121108, + CELL_PAD_ERROR_TOO_MANY_DEVICES = 0x80121109, + CELL_PAD_ERROR_EBUSY = 0x8012110a, }; enum CellPadFilterError : u32 @@ -118,7 +118,7 @@ struct CellPadFilterIIRSos struct pad_info { atomic_t max_connect = 0; - std::array port_setting{ 0 }; + std::array port_setting{0}; std::array reported_info{}; SAVESTATE_INIT_POS(11); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellPamf.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellPamf.cpp index d63e7bb3e..84c1558cc 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellPamf.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellPamf.cpp @@ -5,8 +5,14 @@ #include #include "cellPamf.h" -const std::function SQUEUE_ALWAYS_EXIT = []() { return true; }; -const std::function SQUEUE_NEVER_EXIT = []() { return false; }; +const std::function SQUEUE_ALWAYS_EXIT = []() +{ + return true; +}; +const std::function SQUEUE_NEVER_EXIT = []() +{ + return false; +}; bool squeue_test_exit() { @@ -15,25 +21,25 @@ bool squeue_test_exit() LOG_CHANNEL(cellPamf); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_PAMF_ERROR_STREAM_NOT_FOUND); - STR_CASE(CELL_PAMF_ERROR_INVALID_PAMF); - STR_CASE(CELL_PAMF_ERROR_INVALID_ARG); - STR_CASE(CELL_PAMF_ERROR_UNKNOWN_TYPE); - STR_CASE(CELL_PAMF_ERROR_UNSUPPORTED_VERSION); - STR_CASE(CELL_PAMF_ERROR_UNKNOWN_STREAM); - STR_CASE(CELL_PAMF_ERROR_EP_NOT_FOUND); - STR_CASE(CELL_PAMF_ERROR_NOT_AVAILABLE); - } + switch (error) + { + STR_CASE(CELL_PAMF_ERROR_STREAM_NOT_FOUND); + STR_CASE(CELL_PAMF_ERROR_INVALID_PAMF); + STR_CASE(CELL_PAMF_ERROR_INVALID_ARG); + STR_CASE(CELL_PAMF_ERROR_UNKNOWN_TYPE); + STR_CASE(CELL_PAMF_ERROR_UNSUPPORTED_VERSION); + STR_CASE(CELL_PAMF_ERROR_UNKNOWN_STREAM); + STR_CASE(CELL_PAMF_ERROR_EP_NOT_FOUND); + STR_CASE(CELL_PAMF_ERROR_NOT_AVAILABLE); + } - return unknown; - }); + return unknown; + }); } error_code pamfVerifyMagicAndVersion(vm::cptr pAddr, vm::ptr pSelf) @@ -331,8 +337,8 @@ bool pamfIsSameStreamType(u8 type, u8 requested_type) { case CELL_PAMF_STREAM_TYPE_VIDEO: return type == CELL_PAMF_STREAM_TYPE_AVC || type == CELL_PAMF_STREAM_TYPE_M2V; case CELL_PAMF_STREAM_TYPE_AUDIO: return type == CELL_PAMF_STREAM_TYPE_ATRAC3PLUS || type == CELL_PAMF_STREAM_TYPE_AC3 || type == CELL_PAMF_STREAM_TYPE_PAMF_LPCM; - case CELL_PAMF_STREAM_TYPE_UNK: return type == CELL_PAMF_STREAM_TYPE_PAMF_LPCM || type == CELL_PAMF_STREAM_TYPE_PSMF_ATRAC3PLUS; // ??? no idea what this is for - default: return requested_type == type; + case CELL_PAMF_STREAM_TYPE_UNK: return type == CELL_PAMF_STREAM_TYPE_PAMF_LPCM || type == CELL_PAMF_STREAM_TYPE_PSMF_ATRAC3PLUS; // ??? no idea what this is for + default: return requested_type == type; } } @@ -351,7 +357,7 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr pAddr, u64 fileSize, vm::ptrpsmf_marks_offset; @@ -376,19 +382,19 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr(psmf_marks_offset) + psmf_marks_size) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: header_size is less than psmf_marks_offset + psmf_marks_size" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: header_size is less than psmf_marks_offset + psmf_marks_size"}; } } @@ -396,28 +402,27 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr(unk_offset) + unk_size) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: header_size is less than unk_offset + unk_size" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: header_size is less than unk_offset + unk_size"}; } } if (unk_offset < static_cast(psmf_marks_offset) + psmf_marks_size) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: unk_offset is less than psmf_marks_offset + psmf_marks_size" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: unk_offset is less than psmf_marks_offset + psmf_marks_size"}; } - // Sequence Info const u32 seq_info_size = pAddr->seq_info.size; @@ -425,7 +430,7 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr header_size) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid seq_info_size" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid seq_info_size"}; } const u64 start_pts = static_cast(pAddr->seq_info.start_pts_high) << 32 | pAddr->seq_info.start_pts_low; @@ -434,21 +439,20 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr CODEC_TS_INVALID) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid end_pts" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid end_pts"}; } if (start_pts >= end_pts) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid start_pts" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid start_pts"}; } // Grouping period count if (pAddr->seq_info.grouping_period_num != 1) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid grouping_period_num" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid grouping_period_num"}; } - // Grouping Period const u32 grouping_period_size = pAddr->seq_info.grouping_periods.size; @@ -456,7 +460,7 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr header_size) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid grouping_period_size" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid grouping_period_size"}; } const u64 grp_period_start_pts = static_cast(pAddr->seq_info.grouping_periods.start_pts_high) << 32 | pAddr->seq_info.grouping_periods.start_pts_low; @@ -465,26 +469,25 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr CODEC_TS_INVALID) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid grp_period_end_pts" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid grp_period_end_pts"}; } if (grp_period_start_pts >= grp_period_end_pts) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid grp_period_start_pts" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid grp_period_start_pts"}; } if (grp_period_start_pts != start_pts) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: grp_period_start_pts not equal start_pts" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: grp_period_start_pts not equal start_pts"}; } // Group count if (pAddr->seq_info.grouping_periods.group_num != 1) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid group_num" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid group_num"}; } - // Group const u32 group_size = pAddr->seq_info.grouping_periods.groups.size; @@ -492,7 +495,7 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr header_size) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid group_size" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid group_size"}; } const u8 stream_num = pAddr->seq_info.grouping_periods.groups.stream_num; @@ -500,10 +503,9 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptrseq_info.grouping_periods.groups.streams; @@ -527,7 +529,7 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr pAddr, u64 fileSize, vm::ptr header_size) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid ep_num" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid ep_num"}; } } - // Entry points // Skip if there are no entry points or if the minimum header attribute is set @@ -577,7 +578,7 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr pAddr, u64 fileSize, vm::ptr CODEC_TS_INVALID) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid ep pts" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid ep pts"}; } const u64 rpn_offset = eps[ep_idx].rpnOffset * 0x800ull; @@ -596,7 +597,7 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr data_size || rpn_offset < previous_rpn_offset) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid rpn_offset" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: invalid rpn_offset"}; } previous_rpn_offset = rpn_offset; @@ -606,19 +607,17 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr grouping_period_size - offsetof(PamfGroupingPeriod, groups) + sizeof(u32) - || grouping_period_size + 4 > seq_info_size - offsetof(PamfSequenceInfo, grouping_periods) + sizeof(u32)) + if (group_size + 4 > grouping_period_size - offsetof(PamfGroupingPeriod, groups) + sizeof(u32) || grouping_period_size + 4 > seq_info_size - offsetof(PamfSequenceInfo, grouping_periods) + sizeof(u32)) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: size mismatch" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: size mismatch"}; } // Since multiple grouping periods/groups was never implemented, number of streams in SequenceInfo must be equal stream_num in Group if (pAddr->seq_info.total_stream_num != stream_num) { - return { CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: number of streams mismatch" }; + return {CELL_PAMF_ERROR_INVALID_PAMF, "pamfVerify() failed: number of streams mismatch"}; } - // PsmfMarks // This is probably useless since the official PAMF tools don't support PsmfMarks @@ -636,19 +635,19 @@ error_code pamfVerify(vm::cptr pAddr, u64 fileSize, vm::ptr pAddr, u64 fileSize, vm::ptr pSelf if (found > streamIndex) { pSelf->currentStreamIndex = streamIndex; // LLE sets this to the index counting only streams of the requested type instead of the overall index - pSelf->psmf.currentStream = streams; // LLE always sets this to the first stream + pSelf->psmf.currentStream = streams; // LLE always sets this to the first stream return not_an_error(i); } } @@ -1383,8 +1382,7 @@ error_code cellPamfReaderGetEpIteratorWithIndex(vm::ptr pSelf, u pIt->isPamf = !pSelf->isPsmf; pIt->index = epIndex; pIt->num = ep_num; - pIt->pCur.set(pSelf->isPsmf ? pSelf->psmf.header.addr() + pSelf->psmf.currentStream->ep_offset + epIndex * sizeof(PsmfEpHeader) - : pSelf->pamf.header.addr() + pSelf->pamf.currentStream->ep_offset + epIndex * sizeof(PamfEpHeader)); + pIt->pCur.set(pSelf->isPsmf ? pSelf->psmf.header.addr() + pSelf->psmf.currentStream->ep_offset + epIndex * sizeof(PsmfEpHeader) : pSelf->pamf.header.addr() + pSelf->pamf.currentStream->ep_offset + epIndex * sizeof(PamfEpHeader)); return CELL_OK; } @@ -1640,30 +1638,30 @@ error_code cellPamfReaderGetEpWithIndex(vm::ptr pSelf, u32 epInd } DECLARE(ppu_module_manager::cellPamf)("cellPamf", []() -{ - REG_FUNC(cellPamf, cellPamfGetHeaderSize); - REG_FUNC(cellPamf, cellPamfGetHeaderSize2); - REG_FUNC(cellPamf, cellPamfGetStreamOffsetAndSize); - REG_FUNC(cellPamf, cellPamfVerify); - REG_FUNC(cellPamf, cellPamfReaderInitialize); - REG_FUNC(cellPamf, cellPamfReaderGetPresentationStartTime); - REG_FUNC(cellPamf, cellPamfReaderGetPresentationEndTime); - REG_FUNC(cellPamf, cellPamfReaderGetMuxRateBound); - REG_FUNC(cellPamf, cellPamfReaderGetNumberOfStreams); - REG_FUNC(cellPamf, cellPamfReaderGetNumberOfSpecificStreams); - REG_FUNC(cellPamf, cellPamfReaderSetStreamWithIndex); - REG_FUNC(cellPamf, cellPamfReaderSetStreamWithTypeAndChannel); - REG_FUNC(cellPamf, cellPamfReaderSetStreamWithTypeAndIndex); - REG_FUNC(cellPamf, cellPamfStreamTypeToEsFilterId); - REG_FUNC(cellPamf, cellPamfReaderGetStreamIndex); - REG_FUNC(cellPamf, cellPamfReaderGetStreamTypeAndChannel); - REG_FUNC(cellPamf, cellPamfReaderGetEsFilterId); - REG_FUNC(cellPamf, cellPamfReaderGetStreamInfo); - REG_FUNC(cellPamf, cellPamfReaderGetNumberOfEp); - REG_FUNC(cellPamf, cellPamfReaderGetEpIteratorWithIndex); - REG_FUNC(cellPamf, cellPamfReaderGetEpIteratorWithTimeStamp); - REG_FUNC(cellPamf, cellPamfEpIteratorGetEp); - REG_FUNC(cellPamf, cellPamfEpIteratorMove); - REG_FUNC(cellPamf, cellPamfReaderGetEpWithTimeStamp); - REG_FUNC(cellPamf, cellPamfReaderGetEpWithIndex); -}); + { + REG_FUNC(cellPamf, cellPamfGetHeaderSize); + REG_FUNC(cellPamf, cellPamfGetHeaderSize2); + REG_FUNC(cellPamf, cellPamfGetStreamOffsetAndSize); + REG_FUNC(cellPamf, cellPamfVerify); + REG_FUNC(cellPamf, cellPamfReaderInitialize); + REG_FUNC(cellPamf, cellPamfReaderGetPresentationStartTime); + REG_FUNC(cellPamf, cellPamfReaderGetPresentationEndTime); + REG_FUNC(cellPamf, cellPamfReaderGetMuxRateBound); + REG_FUNC(cellPamf, cellPamfReaderGetNumberOfStreams); + REG_FUNC(cellPamf, cellPamfReaderGetNumberOfSpecificStreams); + REG_FUNC(cellPamf, cellPamfReaderSetStreamWithIndex); + REG_FUNC(cellPamf, cellPamfReaderSetStreamWithTypeAndChannel); + REG_FUNC(cellPamf, cellPamfReaderSetStreamWithTypeAndIndex); + REG_FUNC(cellPamf, cellPamfStreamTypeToEsFilterId); + REG_FUNC(cellPamf, cellPamfReaderGetStreamIndex); + REG_FUNC(cellPamf, cellPamfReaderGetStreamTypeAndChannel); + REG_FUNC(cellPamf, cellPamfReaderGetEsFilterId); + REG_FUNC(cellPamf, cellPamfReaderGetStreamInfo); + REG_FUNC(cellPamf, cellPamfReaderGetNumberOfEp); + REG_FUNC(cellPamf, cellPamfReaderGetEpIteratorWithIndex); + REG_FUNC(cellPamf, cellPamfReaderGetEpIteratorWithTimeStamp); + REG_FUNC(cellPamf, cellPamfEpIteratorGetEp); + REG_FUNC(cellPamf, cellPamfEpIteratorMove); + REG_FUNC(cellPamf, cellPamfReaderGetEpWithTimeStamp); + REG_FUNC(cellPamf, cellPamfReaderGetEpWithIndex); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellPamf.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellPamf.h index e42acf60f..3f5bfde82 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellPamf.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellPamf.h @@ -5,14 +5,14 @@ // Error Codes enum CellPamfError : u32 { - CELL_PAMF_ERROR_STREAM_NOT_FOUND = 0x80610501, - CELL_PAMF_ERROR_INVALID_PAMF = 0x80610502, - CELL_PAMF_ERROR_INVALID_ARG = 0x80610503, - CELL_PAMF_ERROR_UNKNOWN_TYPE = 0x80610504, + CELL_PAMF_ERROR_STREAM_NOT_FOUND = 0x80610501, + CELL_PAMF_ERROR_INVALID_PAMF = 0x80610502, + CELL_PAMF_ERROR_INVALID_ARG = 0x80610503, + CELL_PAMF_ERROR_UNKNOWN_TYPE = 0x80610504, CELL_PAMF_ERROR_UNSUPPORTED_VERSION = 0x80610505, - CELL_PAMF_ERROR_UNKNOWN_STREAM = 0x80610506, - CELL_PAMF_ERROR_EP_NOT_FOUND = 0x80610507, - CELL_PAMF_ERROR_NOT_AVAILABLE = 0x80610508, + CELL_PAMF_ERROR_UNKNOWN_STREAM = 0x80610506, + CELL_PAMF_ERROR_EP_NOT_FOUND = 0x80610507, + CELL_PAMF_ERROR_NOT_AVAILABLE = 0x80610508, }; // PamfReaderInitialize Attribute Flags @@ -24,30 +24,30 @@ enum enum CellPamfStreamType { - CELL_PAMF_STREAM_TYPE_AVC = 0, - CELL_PAMF_STREAM_TYPE_M2V = 1, - CELL_PAMF_STREAM_TYPE_ATRAC3PLUS = 2, - CELL_PAMF_STREAM_TYPE_PAMF_LPCM = 3, - CELL_PAMF_STREAM_TYPE_AC3 = 4, - CELL_PAMF_STREAM_TYPE_USER_DATA = 5, - CELL_PAMF_STREAM_TYPE_PSMF_AVC = 6, + CELL_PAMF_STREAM_TYPE_AVC = 0, + CELL_PAMF_STREAM_TYPE_M2V = 1, + CELL_PAMF_STREAM_TYPE_ATRAC3PLUS = 2, + CELL_PAMF_STREAM_TYPE_PAMF_LPCM = 3, + CELL_PAMF_STREAM_TYPE_AC3 = 4, + CELL_PAMF_STREAM_TYPE_USER_DATA = 5, + CELL_PAMF_STREAM_TYPE_PSMF_AVC = 6, CELL_PAMF_STREAM_TYPE_PSMF_ATRAC3PLUS = 7, - CELL_PAMF_STREAM_TYPE_PSMF_LPCM = 8, - CELL_PAMF_STREAM_TYPE_PSMF_USER_DATA = 9, - CELL_PAMF_STREAM_TYPE_VIDEO = 20, - CELL_PAMF_STREAM_TYPE_AUDIO = 21, - CELL_PAMF_STREAM_TYPE_UNK = 22, + CELL_PAMF_STREAM_TYPE_PSMF_LPCM = 8, + CELL_PAMF_STREAM_TYPE_PSMF_USER_DATA = 9, + CELL_PAMF_STREAM_TYPE_VIDEO = 20, + CELL_PAMF_STREAM_TYPE_AUDIO = 21, + CELL_PAMF_STREAM_TYPE_UNK = 22, }; enum PamfStreamCodingType : u8 { - PAMF_STREAM_CODING_TYPE_M2V = 0x02, - PAMF_STREAM_CODING_TYPE_AVC = 0x1b, - PAMF_STREAM_CODING_TYPE_PAMF_LPCM = 0x80, - PAMF_STREAM_CODING_TYPE_AC3 = 0x81, + PAMF_STREAM_CODING_TYPE_M2V = 0x02, + PAMF_STREAM_CODING_TYPE_AVC = 0x1b, + PAMF_STREAM_CODING_TYPE_PAMF_LPCM = 0x80, + PAMF_STREAM_CODING_TYPE_AC3 = 0x81, PAMF_STREAM_CODING_TYPE_ATRAC3PLUS = 0xdc, - PAMF_STREAM_CODING_TYPE_USER_DATA = 0xdd, - PAMF_STREAM_CODING_TYPE_PSMF = 0xff, + PAMF_STREAM_CODING_TYPE_USER_DATA = 0xdd, + PAMF_STREAM_CODING_TYPE_PSMF = 0xff, }; enum @@ -80,77 +80,77 @@ enum enum { CELL_PAMF_AVC_FRC_24000DIV1001 = 0, - CELL_PAMF_AVC_FRC_24 = 1, - CELL_PAMF_AVC_FRC_25 = 2, + CELL_PAMF_AVC_FRC_24 = 1, + CELL_PAMF_AVC_FRC_25 = 2, CELL_PAMF_AVC_FRC_30000DIV1001 = 3, - CELL_PAMF_AVC_FRC_30 = 4, - CELL_PAMF_AVC_FRC_50 = 5, + CELL_PAMF_AVC_FRC_30 = 4, + CELL_PAMF_AVC_FRC_50 = 5, CELL_PAMF_AVC_FRC_60000DIV1001 = 6, }; enum { - CELL_PAMF_M2V_MP_ML = 1, - CELL_PAMF_M2V_MP_H14 = 2, - CELL_PAMF_M2V_MP_HL = 3, + CELL_PAMF_M2V_MP_ML = 1, + CELL_PAMF_M2V_MP_H14 = 2, + CELL_PAMF_M2V_MP_HL = 3, CELL_PAMF_M2V_UNKNOWN = 255, }; enum { CELL_PAMF_M2V_FRC_24000DIV1001 = 1, - CELL_PAMF_M2V_FRC_24 = 2, - CELL_PAMF_M2V_FRC_25 = 3, + CELL_PAMF_M2V_FRC_24 = 2, + CELL_PAMF_M2V_FRC_25 = 3, CELL_PAMF_M2V_FRC_30000DIV1001 = 4, - CELL_PAMF_M2V_FRC_30 = 5, - CELL_PAMF_M2V_FRC_50 = 6, + CELL_PAMF_M2V_FRC_30 = 5, + CELL_PAMF_M2V_FRC_50 = 6, CELL_PAMF_M2V_FRC_60000DIV1001 = 7, }; enum { - CELL_PAMF_ASPECT_RATIO_1_1 = 1, + CELL_PAMF_ASPECT_RATIO_1_1 = 1, CELL_PAMF_ASPECT_RATIO_12_11 = 2, CELL_PAMF_ASPECT_RATIO_10_11 = 3, CELL_PAMF_ASPECT_RATIO_16_11 = 4, CELL_PAMF_ASPECT_RATIO_40_33 = 5, - CELL_PAMF_ASPECT_RATIO_4_3 = 14, + CELL_PAMF_ASPECT_RATIO_4_3 = 14, }; enum { - CELL_PAMF_COLOUR_PRIMARIES_ITR_R_BT_709 = 1, - CELL_PAMF_COLOUR_PRIMARIES_UNSPECIFIED = 2, - CELL_PAMF_COLOUR_PRIMARIES_ITU_R_BT_470_SYS_M = 4, + CELL_PAMF_COLOUR_PRIMARIES_ITR_R_BT_709 = 1, + CELL_PAMF_COLOUR_PRIMARIES_UNSPECIFIED = 2, + CELL_PAMF_COLOUR_PRIMARIES_ITU_R_BT_470_SYS_M = 4, CELL_PAMF_COLOUR_PRIMARIES_ITU_R_BT_470_SYS_BG = 5, - CELL_PAMF_COLOUR_PRIMARIES_SMPTE_170_M = 6, - CELL_PAMF_COLOUR_PRIMARIES_SMPTE_240_M = 7, - CELL_PAMF_COLOUR_PRIMARIES_GENERIC_FILM = 8, + CELL_PAMF_COLOUR_PRIMARIES_SMPTE_170_M = 6, + CELL_PAMF_COLOUR_PRIMARIES_SMPTE_240_M = 7, + CELL_PAMF_COLOUR_PRIMARIES_GENERIC_FILM = 8, }; enum { - CELL_PAMF_TRANSFER_CHARACTERISTICS_ITU_R_BT_709 = 1, - CELL_PAMF_TRANSFER_CHARACTERISTICS_UNSPECIFIED = 2, - CELL_PAMF_TRANSFER_CHARACTERISTICS_ITU_R_BT_470_SYS_M = 4, + CELL_PAMF_TRANSFER_CHARACTERISTICS_ITU_R_BT_709 = 1, + CELL_PAMF_TRANSFER_CHARACTERISTICS_UNSPECIFIED = 2, + CELL_PAMF_TRANSFER_CHARACTERISTICS_ITU_R_BT_470_SYS_M = 4, CELL_PAMF_TRANSFER_CHARACTERISTICS_ITU_R_BT_470_SYS_BG = 5, - CELL_PAMF_TRANSFER_CHARACTERISTICS_SMPTE_170_M = 6, - CELL_PAMF_TRANSFER_CHARACTERISTICS_SMPTE_240_M = 7, - CELL_PAMF_TRANSFER_CHARACTERISTICS_LINEAR = 8, - CELL_PAMF_TRANSFER_CHARACTERISTICS_LOG_100_1 = 9, - CELL_PAMF_TRANSFER_CHARACTERISTICS_LOG_316_1 = 10, + CELL_PAMF_TRANSFER_CHARACTERISTICS_SMPTE_170_M = 6, + CELL_PAMF_TRANSFER_CHARACTERISTICS_SMPTE_240_M = 7, + CELL_PAMF_TRANSFER_CHARACTERISTICS_LINEAR = 8, + CELL_PAMF_TRANSFER_CHARACTERISTICS_LOG_100_1 = 9, + CELL_PAMF_TRANSFER_CHARACTERISTICS_LOG_316_1 = 10, }; enum { - CELL_PAMF_MATRIX_GBR = 0, - CELL_PAMF_MATRIX_ITU_R_BT_709 = 1, - CELL_PAMF_MATRIX_UNSPECIFIED = 2, - CELL_PAMF_MATRIX_FCC = 4, + CELL_PAMF_MATRIX_GBR = 0, + CELL_PAMF_MATRIX_ITU_R_BT_709 = 1, + CELL_PAMF_MATRIX_UNSPECIFIED = 2, + CELL_PAMF_MATRIX_FCC = 4, CELL_PAMF_MATRIX_ITU_R_BT_470_SYS_BG = 5, - CELL_PAMF_MATRIX_SMPTE_170_M = 6, - CELL_PAMF_MATRIX_SMPTE_240_M = 7, - CELL_PAMF_MATRIX_YCGCO = 8, + CELL_PAMF_MATRIX_SMPTE_170_M = 6, + CELL_PAMF_MATRIX_SMPTE_240_M = 7, + CELL_PAMF_MATRIX_YCGCO = 8, }; // Timestamp information (time in increments of 90 kHz) @@ -292,7 +292,7 @@ struct PamfStreamHeader be_t p_std_buffer; // 2 bits: unused ??? "00", 1 bit: P_STD_buffer_scale, 13 bits: P_STD_buffer_size be_t ep_offset; // offset of EP section in header - be_t ep_num; // count of EPs + be_t ep_num; // count of EPs union { @@ -321,8 +321,7 @@ struct PamfStreamHeader u8 matrixCoefficients; u8 x18; // contains entropyCodingModeFlag, deblockingFilterFlag, minNumSlicePerPictureIdc, nfwIdc u8 maxMeanBitrate; - } - AVC; + } AVC; // M2V specific information struct @@ -340,22 +339,20 @@ struct PamfStreamHeader be_t horizontalSizeValue; be_t verticalSizeValue; be_t x10; // not used - u8 x14; // contains videoFormat and videoFullRangeFlag + u8 x14; // contains videoFormat and videoFullRangeFlag u8 colourPrimaries; u8 transferCharacteristics; u8 matrixCoefficients; - } - M2V; + } M2V; // Audio specific information struct { be_t unknown; // 0 - u8 channels; // number of channels (1, 2, 6, 8) - u8 freq; // 1 (always 48000) - u8 bps; // LPCM only - } - audio; + u8 channels; // number of channels (1, 2, 6, 8) + u8 freq; // 1 (always 48000) + u8 bps; // LPCM only + } audio; }; }; @@ -435,8 +432,8 @@ CHECK_SIZE_ALIGN(PamfHeader, 0x50 + sizeof(PamfSequenceInfo), 1); struct PamfEpHeader { - be_t value0; // 2 bits: indexN, 1 bit: unused, 13 bits: nThRefPictureOffset in units of 2048 bytes - be_t pts_high; // always 0, greatest valid pts is UINT32_MAX + be_t value0; // 2 bits: indexN, 1 bit: unused, 13 bits: nThRefPictureOffset in units of 2048 bytes + be_t pts_high; // always 0, greatest valid pts is UINT32_MAX be_t pts_low; be_t rpnOffset; // in units of 2048 bytes }; @@ -453,7 +450,7 @@ struct PsmfStreamHeader be_t p_std_buffer; // 2 bits: unused ??? "00", 1 bit: P_STD_buffer_scale, 13 bits: P_STD_buffer_size be_t ep_offset; // offset of EP section in header - be_t ep_num; // count of EPs + be_t ep_num; // count of EPs union { @@ -462,8 +459,7 @@ struct PsmfStreamHeader { u8 horizontalSize; // in units of 16 pixels u8 verticalSize; // in units of 16 pixels - } - video; + } video; // Audio specific information struct @@ -471,8 +467,7 @@ struct PsmfStreamHeader be_t unknown; // 0 u8 channelConfiguration; // 1 = mono, 2 = stereo u8 samplingFrequency; // 2 = 44.1kHz - } - audio; + } audio; }; }; @@ -547,7 +542,7 @@ CHECK_SIZE_ALIGN(PsmfHeader, 0x50 + sizeof(PsmfSequenceInfo), 1); struct PsmfEpHeader { - be_t value0; // 2 bits: indexN, 2 bits: unused, 11 bits: nThRefPictureOffset in units of 1024 bytes, 1 bit: pts_high + be_t value0; // 2 bits: indexN, 2 bits: unused, 11 bits: nThRefPictureOffset in units of 1024 bytes, 1 bit: pts_high be_t pts_low; be_t rpnOffset; // in units of 2048 bytes }; @@ -574,8 +569,7 @@ struct CellPamfReader vm::bcptr currentGroupingPeriod; vm::bcptr currentGroup; vm::bcptr currentStream; - } - pamf; + } pamf; struct { @@ -584,8 +578,7 @@ struct CellPamfReader vm::bcptr currentGroupingPeriod; vm::bcptr currentGroup; vm::bcptr currentStream; - } - psmf; + } psmf; }; u32 reserved[18]; @@ -604,7 +597,7 @@ extern const std::function SQUEUE_NEVER_EXIT; bool squeue_test_exit(); // TODO: eliminate this boolshit -template +template class squeue_t { struct squeue_sync_var_t @@ -658,23 +651,23 @@ public: u32 pos = 0; while (u32 res = m_sync.atomic_op([&pos](squeue_sync_var_t& sync) -> u32 - { - ensure(sync.count <= sq_size); - ensure(sync.position < sq_size); + { + ensure(sync.count <= sq_size); + ensure(sync.position < sq_size); - if (sync.push_lock) - { - return SQSVR_LOCKED; - } - if (sync.count == sq_size) - { - return SQSVR_FAILED; - } + if (sync.push_lock) + { + return SQSVR_LOCKED; + } + if (sync.count == sq_size) + { + return SQSVR_FAILED; + } - sync.push_lock = 1; - pos = sync.position + sync.count; - return SQSVR_OK; - })) + sync.push_lock = 1; + pos = sync.position + sync.count; + return SQSVR_OK; + })) { if (res == SQSVR_FAILED && (test_exit() || squeue_test_exit())) { @@ -688,13 +681,13 @@ public: m_data[pos >= sq_size ? pos - sq_size : pos] = data; m_sync.atomic_op([](squeue_sync_var_t& sync) - { - ensure(sync.count <= sq_size); - ensure(sync.position < sq_size); - ensure(!!sync.push_lock); - sync.push_lock = 0; - sync.count++; - }); + { + ensure(sync.count <= sq_size); + ensure(sync.position < sq_size); + ensure(!!sync.push_lock); + sync.push_lock = 0; + sync.count++; + }); m_rcv.notify_one(); m_wcv.notify_one(); @@ -703,7 +696,10 @@ public: bool push(const T& data, const volatile bool* do_exit) { - return push(data, [do_exit]() { return do_exit && *do_exit; }); + return push(data, [do_exit]() + { + return do_exit && *do_exit; + }); } bool push(const T& data) @@ -721,23 +717,23 @@ public: u32 pos = 0; while (u32 res = m_sync.atomic_op([&pos](squeue_sync_var_t& sync) -> u32 - { - ensure(sync.count <= sq_size); - ensure(sync.position < sq_size); + { + ensure(sync.count <= sq_size); + ensure(sync.position < sq_size); - if (!sync.count) - { - return SQSVR_FAILED; - } - if (sync.pop_lock) - { - return SQSVR_LOCKED; - } + if (!sync.count) + { + return SQSVR_FAILED; + } + if (sync.pop_lock) + { + return SQSVR_LOCKED; + } - sync.pop_lock = 1; - pos = sync.position; - return SQSVR_OK; - })) + sync.pop_lock = 1; + pos = sync.position; + return SQSVR_OK; + })) { if (res == SQSVR_FAILED && (test_exit() || squeue_test_exit())) { @@ -751,18 +747,18 @@ public: data = m_data[pos]; m_sync.atomic_op([](squeue_sync_var_t& sync) - { - ensure(sync.count <= sq_size); - ensure(sync.position < sq_size); - ensure(!!sync.pop_lock); - sync.pop_lock = 0; - sync.position++; - sync.count--; - if (sync.position == sq_size) { - sync.position = 0; - } - }); + ensure(sync.count <= sq_size); + ensure(sync.position < sq_size); + ensure(!!sync.pop_lock); + sync.pop_lock = 0; + sync.position++; + sync.count--; + if (sync.position == sq_size) + { + sync.position = 0; + } + }); m_rcv.notify_one(); m_wcv.notify_one(); @@ -771,7 +767,10 @@ public: bool pop(T& data, const volatile bool* do_exit) { - return pop(data, [do_exit]() { return do_exit && *do_exit; }); + return pop(data, [do_exit]() + { + return do_exit && *do_exit; + }); } bool pop(T& data) @@ -790,23 +789,23 @@ public: u32 pos = 0; while (u32 res = m_sync.atomic_op([&pos, start_pos](squeue_sync_var_t& sync) -> u32 - { - ensure(sync.count <= sq_size); - ensure(sync.position < sq_size); + { + ensure(sync.count <= sq_size); + ensure(sync.position < sq_size); - if (sync.count <= start_pos) - { - return SQSVR_FAILED; - } - if (sync.pop_lock) - { - return SQSVR_LOCKED; - } + if (sync.count <= start_pos) + { + return SQSVR_FAILED; + } + if (sync.pop_lock) + { + return SQSVR_LOCKED; + } - sync.pop_lock = 1; - pos = sync.position + start_pos; - return SQSVR_OK; - })) + sync.pop_lock = 1; + pos = sync.position + start_pos; + return SQSVR_OK; + })) { if (res == SQSVR_FAILED && (test_exit() || squeue_test_exit())) { @@ -820,12 +819,12 @@ public: data = m_data[pos >= sq_size ? pos - sq_size : pos]; m_sync.atomic_op([](squeue_sync_var_t& sync) - { - ensure(sync.count <= sq_size); - ensure(sync.position < sq_size); - ensure(!!sync.pop_lock); - sync.pop_lock = 0; - }); + { + ensure(sync.count <= sq_size); + ensure(sync.position < sq_size); + ensure(!!sync.pop_lock); + sync.pop_lock = 0; + }); m_rcv.notify_one(); return true; @@ -833,7 +832,10 @@ public: bool peek(T& data, u32 start_pos, const volatile bool* do_exit) { - return peek(data, start_pos, [do_exit]() { return do_exit && *do_exit; }); + return peek(data, start_pos, [do_exit]() + { + return do_exit && *do_exit; + }); } bool peek(T& data, u32 start_pos = 0) @@ -853,14 +855,12 @@ public: const u32 m_count; squeue_data_t(T* data, u32 pos, u32 count) - : m_data(data) - , m_pos(pos) - , m_count(count) + : m_data(data), m_pos(pos), m_count(count) { } public: - T& operator [] (u32 index) + T& operator[](u32 index) { ensure(index < m_count); index += m_pos; @@ -869,26 +869,26 @@ public: } }; - void process(void(*proc)(squeue_data_t data)) + void process(void (*proc)(squeue_data_t data)) { u32 pos, count; while (m_sync.atomic_op([&pos, &count](squeue_sync_var_t& sync) -> u32 - { - ensure(sync.count <= sq_size); - ensure(sync.position < sq_size); - - if (sync.pop_lock || sync.push_lock) { - return SQSVR_LOCKED; - } + ensure(sync.count <= sq_size); + ensure(sync.position < sq_size); - pos = sync.position; - count = sync.count; - sync.pop_lock = 1; - sync.push_lock = 1; - return SQSVR_OK; - })) + if (sync.pop_lock || sync.push_lock) + { + return SQSVR_LOCKED; + } + + pos = sync.position; + count = sync.count; + sync.pop_lock = 1; + sync.push_lock = 1; + return SQSVR_OK; + })) { std::unique_lock rcv_lock(m_rcv_mutex); m_rcv.wait_for(rcv_lock, std::chrono::milliseconds(1)); @@ -897,14 +897,14 @@ public: proc(squeue_data_t(m_data, pos, count)); m_sync.atomic_op([](squeue_sync_var_t& sync) - { - ensure(sync.count <= sq_size); - ensure(sync.position < sq_size); - ensure(!!sync.pop_lock); - ensure(!!sync.push_lock); - sync.pop_lock = 0; - sync.push_lock = 0; - }); + { + ensure(sync.count <= sq_size); + ensure(sync.position < sq_size); + ensure(!!sync.pop_lock); + ensure(!!sync.push_lock); + sync.pop_lock = 0; + sync.push_lock = 0; + }); m_wcv.notify_one(); m_rcv.notify_one(); @@ -913,19 +913,19 @@ public: void clear() { while (m_sync.atomic_op([](squeue_sync_var_t& sync) -> u32 - { - ensure(sync.count <= sq_size); - ensure(sync.position < sq_size); - - if (sync.pop_lock || sync.push_lock) { - return SQSVR_LOCKED; - } + ensure(sync.count <= sq_size); + ensure(sync.position < sq_size); - sync.pop_lock = 1; - sync.push_lock = 1; - return SQSVR_OK; - })) + if (sync.pop_lock || sync.push_lock) + { + return SQSVR_LOCKED; + } + + sync.pop_lock = 1; + sync.push_lock = 1; + return SQSVR_OK; + })) { std::unique_lock rcv_lock(m_rcv_mutex); m_rcv.wait_for(rcv_lock, std::chrono::milliseconds(1)); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellPesmUtility.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellPesmUtility.cpp index b33f25a31..9629dfecb 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellPesmUtility.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellPesmUtility.cpp @@ -94,20 +94,20 @@ error_code cellPesmUnloadAsync() } DECLARE(ppu_module_manager::cellPesmUtility)("cellPesmUtility", []() -{ - REG_FUNC(cellPesmUtility, cellPesmInitialize); - REG_FUNC(cellPesmUtility, cellPesmFinalize); - REG_FUNC(cellPesmUtility, cellPesmLoadAsync); - REG_FUNC(cellPesmUtility, cellPesmOpenDevice); - REG_FUNC(cellPesmUtility, cellPesmEncryptSample); - REG_FUNC(cellPesmUtility, cellPesmUnloadAsync); - REG_FUNC(cellPesmUtility, cellPesmGetSinf); - REG_FUNC(cellPesmUtility, cellPesmStartMovieRec); - REG_FUNC(cellPesmUtility, cellPesmInitEntry); - REG_FUNC(cellPesmUtility, cellPesmEndMovieRec); - REG_FUNC(cellPesmUtility, cellPesmEncryptSample2); - REG_FUNC(cellPesmUtility, cellPesmFinalize2); - REG_FUNC(cellPesmUtility, cellPesmCloseDevice); - REG_FUNC(cellPesmUtility, cellPesmInitEntry2); - REG_FUNC(cellPesmUtility, cellPesmPrepareRec); -}); + { + REG_FUNC(cellPesmUtility, cellPesmInitialize); + REG_FUNC(cellPesmUtility, cellPesmFinalize); + REG_FUNC(cellPesmUtility, cellPesmLoadAsync); + REG_FUNC(cellPesmUtility, cellPesmOpenDevice); + REG_FUNC(cellPesmUtility, cellPesmEncryptSample); + REG_FUNC(cellPesmUtility, cellPesmUnloadAsync); + REG_FUNC(cellPesmUtility, cellPesmGetSinf); + REG_FUNC(cellPesmUtility, cellPesmStartMovieRec); + REG_FUNC(cellPesmUtility, cellPesmInitEntry); + REG_FUNC(cellPesmUtility, cellPesmEndMovieRec); + REG_FUNC(cellPesmUtility, cellPesmEncryptSample2); + REG_FUNC(cellPesmUtility, cellPesmFinalize2); + REG_FUNC(cellPesmUtility, cellPesmCloseDevice); + REG_FUNC(cellPesmUtility, cellPesmInitEntry2); + REG_FUNC(cellPesmUtility, cellPesmPrepareRec); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellPhotoDecode.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellPhotoDecode.cpp index 5cef4ba87..3cd44baff 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellPhotoDecode.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellPhotoDecode.cpp @@ -9,31 +9,31 @@ LOG_CHANNEL(cellPhotoDecode); // Return Codes enum CellPhotoDecodeError : u32 { - CELL_PHOTO_DECODE_ERROR_BUSY = 0x8002c901, - CELL_PHOTO_DECODE_ERROR_INTERNAL = 0x8002c902, - CELL_PHOTO_DECODE_ERROR_PARAM = 0x8002c903, + CELL_PHOTO_DECODE_ERROR_BUSY = 0x8002c901, + CELL_PHOTO_DECODE_ERROR_INTERNAL = 0x8002c902, + CELL_PHOTO_DECODE_ERROR_PARAM = 0x8002c903, CELL_PHOTO_DECODE_ERROR_ACCESS_ERROR = 0x8002c904, - CELL_PHOTO_DECODE_ERROR_INITIALIZE = 0x8002c905, - CELL_PHOTO_DECODE_ERROR_DECODE = 0x8002c906, + CELL_PHOTO_DECODE_ERROR_INITIALIZE = 0x8002c905, + CELL_PHOTO_DECODE_ERROR_DECODE = 0x8002c906, }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_PHOTO_DECODE_ERROR_BUSY); - STR_CASE(CELL_PHOTO_DECODE_ERROR_INTERNAL); - STR_CASE(CELL_PHOTO_DECODE_ERROR_PARAM); - STR_CASE(CELL_PHOTO_DECODE_ERROR_ACCESS_ERROR); - STR_CASE(CELL_PHOTO_DECODE_ERROR_INITIALIZE); - STR_CASE(CELL_PHOTO_DECODE_ERROR_DECODE); - } + switch (error) + { + STR_CASE(CELL_PHOTO_DECODE_ERROR_BUSY); + STR_CASE(CELL_PHOTO_DECODE_ERROR_INTERNAL); + STR_CASE(CELL_PHOTO_DECODE_ERROR_PARAM); + STR_CASE(CELL_PHOTO_DECODE_ERROR_ACCESS_ERROR); + STR_CASE(CELL_PHOTO_DECODE_ERROR_INITIALIZE); + STR_CASE(CELL_PHOTO_DECODE_ERROR_DECODE); + } - return unknown; - }); + return unknown; + }); } enum @@ -80,10 +80,10 @@ error_code cellPhotoDecodeInitialize(u32 version, u32 container1, u32 container2 } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -103,10 +103,10 @@ error_code cellPhotoDecodeInitialize2(u32 version, u32 container2, vm::ptr s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -121,10 +121,10 @@ error_code cellPhotoDecodeFinalize(vm::ptr funcFi } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -173,9 +173,9 @@ error_code cellPhotoDecodeFromFile(vm::cptr srcHddDir, vm::cptr srcH } DECLARE(ppu_module_manager::cellPhotoDecode)("cellPhotoDecodeUtil", []() -{ - REG_FUNC(cellPhotoDecodeUtil, cellPhotoDecodeInitialize); - REG_FUNC(cellPhotoDecodeUtil, cellPhotoDecodeInitialize2); - REG_FUNC(cellPhotoDecodeUtil, cellPhotoDecodeFinalize); - REG_FUNC(cellPhotoDecodeUtil, cellPhotoDecodeFromFile); -}); + { + REG_FUNC(cellPhotoDecodeUtil, cellPhotoDecodeInitialize); + REG_FUNC(cellPhotoDecodeUtil, cellPhotoDecodeInitialize2); + REG_FUNC(cellPhotoDecodeUtil, cellPhotoDecodeFinalize); + REG_FUNC(cellPhotoDecodeUtil, cellPhotoDecodeFromFile); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellPhotoExport.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellPhotoExport.cpp index 8a264bc72..058d0b250 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellPhotoExport.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellPhotoExport.cpp @@ -9,39 +9,39 @@ LOG_CHANNEL(cellPhotoExport); // Return Codes enum CellPhotoExportError : u32 { - CELL_PHOTO_EXPORT_UTIL_ERROR_BUSY = 0x8002c201, - CELL_PHOTO_EXPORT_UTIL_ERROR_INTERNAL = 0x8002c202, - CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM = 0x8002c203, + CELL_PHOTO_EXPORT_UTIL_ERROR_BUSY = 0x8002c201, + CELL_PHOTO_EXPORT_UTIL_ERROR_INTERNAL = 0x8002c202, + CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM = 0x8002c203, CELL_PHOTO_EXPORT_UTIL_ERROR_ACCESS_ERROR = 0x8002c204, - CELL_PHOTO_EXPORT_UTIL_ERROR_DB_INTERNAL = 0x8002c205, - CELL_PHOTO_EXPORT_UTIL_ERROR_DB_REGIST = 0x8002c206, - CELL_PHOTO_EXPORT_UTIL_ERROR_SET_META = 0x8002c207, - CELL_PHOTO_EXPORT_UTIL_ERROR_FLUSH_META = 0x8002c208, - CELL_PHOTO_EXPORT_UTIL_ERROR_MOVE = 0x8002c209, - CELL_PHOTO_EXPORT_UTIL_ERROR_INITIALIZE = 0x8002c20a, + CELL_PHOTO_EXPORT_UTIL_ERROR_DB_INTERNAL = 0x8002c205, + CELL_PHOTO_EXPORT_UTIL_ERROR_DB_REGIST = 0x8002c206, + CELL_PHOTO_EXPORT_UTIL_ERROR_SET_META = 0x8002c207, + CELL_PHOTO_EXPORT_UTIL_ERROR_FLUSH_META = 0x8002c208, + CELL_PHOTO_EXPORT_UTIL_ERROR_MOVE = 0x8002c209, + CELL_PHOTO_EXPORT_UTIL_ERROR_INITIALIZE = 0x8002c20a, }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_BUSY); - STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_INTERNAL); - STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM); - STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_ACCESS_ERROR); - STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_DB_INTERNAL); - STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_DB_REGIST); - STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_SET_META); - STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_FLUSH_META); - STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_MOVE); - STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_INITIALIZE); - } + switch (error) + { + STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_BUSY); + STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_INTERNAL); + STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM); + STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_ACCESS_ERROR); + STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_DB_INTERNAL); + STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_DB_REGIST); + STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_SET_META); + STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_FLUSH_META); + STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_MOVE); + STR_CASE(CELL_PHOTO_EXPORT_UTIL_ERROR_INITIALIZE); + } - return unknown; - }); + return unknown; + }); } enum @@ -51,10 +51,10 @@ enum enum { - CELL_PHOTO_EXPORT_UTIL_HDD_PATH_MAX = 1055, + CELL_PHOTO_EXPORT_UTIL_HDD_PATH_MAX = 1055, CELL_PHOTO_EXPORT_UTIL_PHOTO_TITLE_MAX_LENGTH = 64, - CELL_PHOTO_EXPORT_UTIL_GAME_TITLE_MAX_LENGTH = 64, - CELL_PHOTO_EXPORT_UTIL_GAME_COMMENT_MAX_SIZE = 1024, + CELL_PHOTO_EXPORT_UTIL_GAME_TITLE_MAX_LENGTH = 64, + CELL_PHOTO_EXPORT_UTIL_GAME_COMMENT_MAX_SIZE = 1024, }; struct CellPhotoExportSetParam @@ -72,7 +72,6 @@ struct photo_export atomic_t progress = 0; // 0x0-0xFFFF for 0-100% }; - bool check_photo_path(const std::string& file_path) { if (file_path.size() >= CELL_PHOTO_EXPORT_UTIL_HDD_PATH_MAX) @@ -83,10 +82,10 @@ bool check_photo_path(const std::string& file_path) for (char c : file_path) { if (!((c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9') || - c == '-' || c == '_' || - c == '/' || c == '.')) + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || + c == '-' || c == '_' || + c == '/' || c == '.')) { return false; } @@ -133,7 +132,6 @@ std::string get_available_photo_path(const std::string& filename) return dst_path; } - error_code cellPhotoInitialize(s32 version, u32 container, vm::ptr funcFinish, vm::ptr userdata) { cellPhotoExport.notice("cellPhotoInitialize(version=%d, container=%d, funcFinish=*0x%x, userdata=*0x%x)", version, container, funcFinish, userdata); @@ -154,10 +152,10 @@ error_code cellPhotoInitialize(s32 version, u32 container, vm::ptr s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -172,10 +170,10 @@ error_code cellPhotoFinalize(vm::ptr funcFini } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -193,54 +191,54 @@ error_code cellPhotoRegistFromFile(vm::cptr path, vm::cptr photo_tit if (!check_photo_path(file_path)) { - return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, file_path }; + return {CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, file_path}; } const std::string filename = file_path.substr(file_path.find_last_of('/') + 1); if (filename.empty()) { - return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, "filename empty" }; + return {CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, "filename empty"}; } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - auto& pexp = g_fxo->get(); - pexp.progress = 0; // 0% - - const std::string src_path = vfs::get(file_path); - const std::string dst_path = get_available_photo_path(filename); - - cellPhotoExport.notice("Copying file from '%s' to '%s'", file_path, dst_path); - - // TODO: We ignore metadata for now - - if (!fs::create_path(fs::get_parent_dir(dst_path)) || !fs::copy_file(src_path, dst_path, false)) { - // TODO: find out which error is used - cellPhotoExport.error("Failed to copy file from '%s' to '%s' (%s)", src_path, dst_path, fs::g_tls_error); - funcFinish(ppu, CELL_PHOTO_EXPORT_UTIL_ERROR_MOVE, userdata); - return CELL_OK; - } + auto& pexp = g_fxo->get(); + pexp.progress = 0; // 0% - if (file_path.starts_with("/dev_hdd0"sv)) - { - cellPhotoExport.notice("Removing file '%s'", src_path); + const std::string src_path = vfs::get(file_path); + const std::string dst_path = get_available_photo_path(filename); - if (!fs::remove_file(src_path)) + cellPhotoExport.notice("Copying file from '%s' to '%s'", file_path, dst_path); + + // TODO: We ignore metadata for now + + if (!fs::create_path(fs::get_parent_dir(dst_path)) || !fs::copy_file(src_path, dst_path, false)) { - // TODO: find out if an error is used here - cellPhotoExport.error("Failed to remove file '%s' (%s)", src_path, fs::g_tls_error); + // TODO: find out which error is used + cellPhotoExport.error("Failed to copy file from '%s' to '%s' (%s)", src_path, dst_path, fs::g_tls_error); + funcFinish(ppu, CELL_PHOTO_EXPORT_UTIL_ERROR_MOVE, userdata); + return CELL_OK; } - } - // TODO: track progress during file copy + if (file_path.starts_with("/dev_hdd0"sv)) + { + cellPhotoExport.notice("Removing file '%s'", src_path); - pexp.progress = 0xFFFF; // 100% + if (!fs::remove_file(src_path)) + { + // TODO: find out if an error is used here + cellPhotoExport.error("Failed to remove file '%s' (%s)", src_path, fs::g_tls_error); + } + } - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + // TODO: track progress during file copy + + pexp.progress = 0xFFFF; // 100% + + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -265,10 +263,10 @@ error_code cellPhotoExportInitialize(u32 version, u32 container, vm::ptr s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -288,10 +286,10 @@ error_code cellPhotoExportInitialize2(u32 version, vm::ptr s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -306,10 +304,10 @@ error_code cellPhotoExportFinalize(vm::ptr fu } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -331,7 +329,7 @@ error_code cellPhotoExportFromFile(vm::cptr srcHddDir, vm::cptr srcH if (!check_photo_path(file_path)) { - return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, file_path }; + return {CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, file_path}; } std::string filename; @@ -343,47 +341,47 @@ error_code cellPhotoExportFromFile(vm::cptr srcHddDir, vm::cptr srcH if (filename.empty()) { - return { CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, "filename empty" }; + return {CELL_PHOTO_EXPORT_UTIL_ERROR_PARAM, "filename empty"}; } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - auto& pexp = g_fxo->get(); - pexp.progress = 0; // 0% - - const std::string src_path = vfs::get(file_path); - const std::string dst_path = get_available_photo_path(filename); - - cellPhotoExport.notice("Copying file from '%s' to '%s'", file_path, dst_path); - - // TODO: We ignore metadata for now - - if (!fs::create_path(fs::get_parent_dir(dst_path)) || !fs::copy_file(src_path, dst_path, false)) { - // TODO: find out which error is used - cellPhotoExport.error("Failed to copy file from '%s' to '%s' (%s)", src_path, dst_path, fs::g_tls_error); - funcFinish(ppu, CELL_PHOTO_EXPORT_UTIL_ERROR_MOVE, userdata); - return CELL_OK; - } + auto& pexp = g_fxo->get(); + pexp.progress = 0; // 0% - if (file_path.starts_with("/dev_hdd0"sv)) - { - cellPhotoExport.notice("Removing file '%s'", src_path); + const std::string src_path = vfs::get(file_path); + const std::string dst_path = get_available_photo_path(filename); - if (!fs::remove_file(src_path)) + cellPhotoExport.notice("Copying file from '%s' to '%s'", file_path, dst_path); + + // TODO: We ignore metadata for now + + if (!fs::create_path(fs::get_parent_dir(dst_path)) || !fs::copy_file(src_path, dst_path, false)) { - // TODO: find out if an error is used here - cellPhotoExport.error("Failed to remove file '%s' (%s)", src_path, fs::g_tls_error); + // TODO: find out which error is used + cellPhotoExport.error("Failed to copy file from '%s' to '%s' (%s)", src_path, dst_path, fs::g_tls_error); + funcFinish(ppu, CELL_PHOTO_EXPORT_UTIL_ERROR_MOVE, userdata); + return CELL_OK; } - } - // TODO: track progress during file copy + if (file_path.starts_with("/dev_hdd0"sv)) + { + cellPhotoExport.notice("Removing file '%s'", src_path); - pexp.progress = 0xFFFF; // 100% + if (!fs::remove_file(src_path)) + { + // TODO: find out if an error is used here + cellPhotoExport.error("Failed to remove file '%s' (%s)", src_path, fs::g_tls_error); + } + } - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + // TODO: track progress during file copy + + pexp.progress = 0xFFFF; // 100% + + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -405,7 +403,7 @@ error_code cellPhotoExportFromFileWithCopy(vm::cptr srcHddDir, vm::cptr srcHddDir, vm::cptr s32 - { - auto& pexp = g_fxo->get(); - pexp.progress = 0; // 0% - - const std::string src_path = vfs::get(file_path); - const std::string dst_path = get_available_photo_path(filename); - - cellPhotoExport.notice("Copying file from '%s' to '%s'", file_path, dst_path); - - // TODO: We ignore metadata for now - - if (!fs::create_path(fs::get_parent_dir(dst_path)) || !fs::copy_file(src_path, dst_path, false)) { - // TODO: find out which error is used - cellPhotoExport.error("Failed to copy file from '%s' to '%s' (%s)", src_path, dst_path, fs::g_tls_error); - funcFinish(ppu, CELL_PHOTO_EXPORT_UTIL_ERROR_MOVE, userdata); + auto& pexp = g_fxo->get(); + pexp.progress = 0; // 0% + + const std::string src_path = vfs::get(file_path); + const std::string dst_path = get_available_photo_path(filename); + + cellPhotoExport.notice("Copying file from '%s' to '%s'", file_path, dst_path); + + // TODO: We ignore metadata for now + + if (!fs::create_path(fs::get_parent_dir(dst_path)) || !fs::copy_file(src_path, dst_path, false)) + { + // TODO: find out which error is used + cellPhotoExport.error("Failed to copy file from '%s' to '%s' (%s)", src_path, dst_path, fs::g_tls_error); + funcFinish(ppu, CELL_PHOTO_EXPORT_UTIL_ERROR_MOVE, userdata); + return CELL_OK; + } + + // TODO: track progress during file copy + + pexp.progress = 0xFFFF; // 100% + + funcFinish(ppu, CELL_OK, userdata); return CELL_OK; - } - - // TODO: track progress during file copy - - pexp.progress = 0xFFFF; // 100% - - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + }); return CELL_OK; } @@ -461,27 +459,27 @@ error_code cellPhotoExportProgress(vm::ptr fu } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - // Set the status as 0x0-0xFFFF (0-100%) depending on the copy status. - // Only the copy or move of the movie and metadata files is considered for the progress. - const auto& pexp = g_fxo->get(); + { + // Set the status as 0x0-0xFFFF (0-100%) depending on the copy status. + // Only the copy or move of the movie and metadata files is considered for the progress. + const auto& pexp = g_fxo->get(); - funcFinish(ppu, pexp.progress, userdata); - return CELL_OK; - }); + funcFinish(ppu, pexp.progress, userdata); + return CELL_OK; + }); return CELL_OK; } DECLARE(ppu_module_manager::cellPhotoExport)("cellPhotoUtility", []() -{ - REG_FUNC(cellPhotoUtility, cellPhotoInitialize); - REG_FUNC(cellPhotoUtility, cellPhotoFinalize); - REG_FUNC(cellPhotoUtility, cellPhotoRegistFromFile); - REG_FUNC(cellPhotoUtility, cellPhotoExportInitialize); - REG_FUNC(cellPhotoUtility, cellPhotoExportInitialize2); - REG_FUNC(cellPhotoUtility, cellPhotoExportFinalize); - REG_FUNC(cellPhotoUtility, cellPhotoExportFromFile); - REG_FUNC(cellPhotoUtility, cellPhotoExportFromFileWithCopy); - REG_FUNC(cellPhotoUtility, cellPhotoExportProgress); -}); + { + REG_FUNC(cellPhotoUtility, cellPhotoInitialize); + REG_FUNC(cellPhotoUtility, cellPhotoFinalize); + REG_FUNC(cellPhotoUtility, cellPhotoRegistFromFile); + REG_FUNC(cellPhotoUtility, cellPhotoExportInitialize); + REG_FUNC(cellPhotoUtility, cellPhotoExportInitialize2); + REG_FUNC(cellPhotoUtility, cellPhotoExportFinalize); + REG_FUNC(cellPhotoUtility, cellPhotoExportFromFile); + REG_FUNC(cellPhotoUtility, cellPhotoExportFromFileWithCopy); + REG_FUNC(cellPhotoUtility, cellPhotoExportProgress); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellPhotoImport.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellPhotoImport.cpp index d56db1f06..c6329e0f6 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellPhotoImport.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellPhotoImport.cpp @@ -13,31 +13,31 @@ LOG_CHANNEL(cellPhotoImportUtil, "cellPhotoImport"); // Return Codes enum CellPhotoImportError : u32 { - CELL_PHOTO_IMPORT_ERROR_BUSY = 0x8002c701, - CELL_PHOTO_IMPORT_ERROR_INTERNAL = 0x8002c702, - CELL_PHOTO_IMPORT_ERROR_PARAM = 0x8002c703, + CELL_PHOTO_IMPORT_ERROR_BUSY = 0x8002c701, + CELL_PHOTO_IMPORT_ERROR_INTERNAL = 0x8002c702, + CELL_PHOTO_IMPORT_ERROR_PARAM = 0x8002c703, CELL_PHOTO_IMPORT_ERROR_ACCESS_ERROR = 0x8002c704, - CELL_PHOTO_IMPORT_ERROR_COPY = 0x8002c705, - CELL_PHOTO_IMPORT_ERROR_INITIALIZE = 0x8002c706, + CELL_PHOTO_IMPORT_ERROR_COPY = 0x8002c705, + CELL_PHOTO_IMPORT_ERROR_INITIALIZE = 0x8002c706, }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_PHOTO_IMPORT_ERROR_BUSY); - STR_CASE(CELL_PHOTO_IMPORT_ERROR_INTERNAL); - STR_CASE(CELL_PHOTO_IMPORT_ERROR_PARAM); - STR_CASE(CELL_PHOTO_IMPORT_ERROR_ACCESS_ERROR); - STR_CASE(CELL_PHOTO_IMPORT_ERROR_COPY); - STR_CASE(CELL_PHOTO_IMPORT_ERROR_INITIALIZE); - } + switch (error) + { + STR_CASE(CELL_PHOTO_IMPORT_ERROR_BUSY); + STR_CASE(CELL_PHOTO_IMPORT_ERROR_INTERNAL); + STR_CASE(CELL_PHOTO_IMPORT_ERROR_PARAM); + STR_CASE(CELL_PHOTO_IMPORT_ERROR_ACCESS_ERROR); + STR_CASE(CELL_PHOTO_IMPORT_ERROR_COPY); + STR_CASE(CELL_PHOTO_IMPORT_ERROR_INITIALIZE); + } - return unknown; - }); + return unknown; + }); } enum CellPhotoImportVersion : u32 @@ -47,10 +47,10 @@ enum CellPhotoImportVersion : u32 enum { - CELL_PHOTO_IMPORT_HDD_PATH_MAX = 1055, + CELL_PHOTO_IMPORT_HDD_PATH_MAX = 1055, CELL_PHOTO_IMPORT_PHOTO_TITLE_MAX_LENGTH = 64, - CELL_PHOTO_IMPORT_GAME_TITLE_MAX_SIZE = 128, - CELL_PHOTO_IMPORT_GAME_COMMENT_MAX_SIZE = 1024 + CELL_PHOTO_IMPORT_GAME_TITLE_MAX_SIZE = 128, + CELL_PHOTO_IMPORT_GAME_COMMENT_MAX_SIZE = 1024 }; enum CellPhotoImportFormatType @@ -146,129 +146,129 @@ error_code select_photo(std::string dst_dir) [&pi_manager, dst_dir](s32 status, utils::media_info info) { sysutil_register_cb([&pi_manager, dst_dir, info, status](ppu_thread& ppu) -> s32 - { - *g_filedata_sub = {}; - *g_filedata = {}; - - u32 result = status >= 0 ? u32{CELL_OK} : u32{CELL_CANCEL}; - - if (result == CELL_OK) { - fs::stat_t f_info{}; + *g_filedata_sub = {}; + *g_filedata = {}; - if (!fs::get_stat(info.path, f_info) || f_info.is_directory) - { - cellPhotoImportUtil.error("Path does not belong to a valid file: '%s'", info.path); - result = CELL_PHOTO_IMPORT_ERROR_ACCESS_ERROR; // TODO: is this correct ? - pi_manager.is_busy = false; - pi_manager.func_finish(ppu, result, g_filedata, pi_manager.userdata); - return CELL_OK; - } + u32 result = status >= 0 ? u32{CELL_OK} : u32{CELL_CANCEL}; - if (f_info.size > pi_manager.param.fileSizeMax) + if (result == CELL_OK) { - cellPhotoImportUtil.error("File size is too large: %d (fileSizeMax=%d)", f_info.size, pi_manager.param.fileSizeMax); - result = CELL_PHOTO_IMPORT_ERROR_COPY; // TODO: is this correct ? - pi_manager.is_busy = false; - pi_manager.func_finish(ppu, result, g_filedata, pi_manager.userdata); - return CELL_OK; - } + fs::stat_t f_info{}; - const std::string filename = info.path.substr(info.path.find_last_of(fs::delim) + 1); - const std::string title = info.get_metadata("title", filename); - const std::string dst_path = dst_dir + "/" + filename; - std::string sub_type = info.sub_type; + if (!fs::get_stat(info.path, f_info) || f_info.is_directory) + { + cellPhotoImportUtil.error("Path does not belong to a valid file: '%s'", info.path); + result = CELL_PHOTO_IMPORT_ERROR_ACCESS_ERROR; // TODO: is this correct ? + pi_manager.is_busy = false; + pi_manager.func_finish(ppu, result, g_filedata, pi_manager.userdata); + return CELL_OK; + } - strcpy_trunc(g_filedata->dstFileName, filename); - strcpy_trunc(g_filedata->photo_title, title); - strcpy_trunc(g_filedata->game_title, Emu.GetTitle()); - strcpy_trunc(g_filedata->game_comment, ""); // TODO + if (f_info.size > pi_manager.param.fileSizeMax) + { + cellPhotoImportUtil.error("File size is too large: %d (fileSizeMax=%d)", f_info.size, pi_manager.param.fileSizeMax); + result = CELL_PHOTO_IMPORT_ERROR_COPY; // TODO: is this correct ? + pi_manager.is_busy = false; + pi_manager.func_finish(ppu, result, g_filedata, pi_manager.userdata); + return CELL_OK; + } - g_filedata->data_sub = g_filedata_sub; - g_filedata->data_sub->width = info.width; - g_filedata->data_sub->height = info.height; + const std::string filename = info.path.substr(info.path.find_last_of(fs::delim) + 1); + const std::string title = info.get_metadata("title", filename); + const std::string dst_path = dst_dir + "/" + filename; + std::string sub_type = info.sub_type; - cellPhotoImportUtil.notice("Raw image data: filename='%s', title='%s', game='%s', sub_type='%s', width=%d, height=%d, orientation=%d ", - filename, title, Emu.GetTitle(), sub_type, info.width, info.height, info.orientation); + strcpy_trunc(g_filedata->dstFileName, filename); + strcpy_trunc(g_filedata->photo_title, title); + strcpy_trunc(g_filedata->game_title, Emu.GetTitle()); + strcpy_trunc(g_filedata->game_comment, ""); // TODO - // Fallback to extension if necessary - if (sub_type.empty()) - { - sub_type = get_file_extension(filename); - } + g_filedata->data_sub = g_filedata_sub; + g_filedata->data_sub->width = info.width; + g_filedata->data_sub->height = info.height; - if (!sub_type.empty()) - { - sub_type = fmt::to_lower(sub_type); - } + cellPhotoImportUtil.notice("Raw image data: filename='%s', title='%s', game='%s', sub_type='%s', width=%d, height=%d, orientation=%d ", + filename, title, Emu.GetTitle(), sub_type, info.width, info.height, info.orientation); - if (sub_type == "jpg" || sub_type == "jpeg") - { - g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_JPEG; - } - else if (sub_type == "png") - { - g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_PNG; - } - else if (sub_type == "tif" || sub_type == "tiff") - { - g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_TIFF; - } - else if (sub_type == "bmp") - { - g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_BMP; - } - else if (sub_type == "gif") - { - g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_GIF; - } - else if (sub_type == "mpo") - { - g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_MPO; + // Fallback to extension if necessary + if (sub_type.empty()) + { + sub_type = get_file_extension(filename); + } + + if (!sub_type.empty()) + { + sub_type = fmt::to_lower(sub_type); + } + + if (sub_type == "jpg" || sub_type == "jpeg") + { + g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_JPEG; + } + else if (sub_type == "png") + { + g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_PNG; + } + else if (sub_type == "tif" || sub_type == "tiff") + { + g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_TIFF; + } + else if (sub_type == "bmp") + { + g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_BMP; + } + else if (sub_type == "gif") + { + g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_GIF; + } + else if (sub_type == "mpo") + { + g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_MPO; + } + else + { + g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_UNKNOWN; + } + + switch (info.orientation) + { + default: + case CELL_SEARCH_ORIENTATION_UNKNOWN: + case CELL_SEARCH_ORIENTATION_TOP_LEFT: + g_filedata->data_sub->rotate = CELL_PHOTO_IMPORT_TEX_ROT_0; + break; + case CELL_SEARCH_ORIENTATION_TOP_RIGHT: + g_filedata->data_sub->rotate = CELL_PHOTO_IMPORT_TEX_ROT_90; + break; + case CELL_SEARCH_ORIENTATION_BOTTOM_RIGHT: + g_filedata->data_sub->rotate = CELL_PHOTO_IMPORT_TEX_ROT_180; + break; + case CELL_SEARCH_ORIENTATION_BOTTOM_LEFT: + g_filedata->data_sub->rotate = CELL_PHOTO_IMPORT_TEX_ROT_270; + break; + } + + cellPhotoImportUtil.notice("Media list dialog: Copying '%s' to '%s'...", info.path, dst_path); + + if (!fs::copy_file(info.path, dst_path, false)) + { + cellPhotoImportUtil.error("Failed to copy '%s' to '%s'. Error = '%s'", info.path, dst_path, fs::g_tls_error); + result = CELL_PHOTO_IMPORT_ERROR_COPY; + } + + cellPhotoImportUtil.notice("Cell image data: dstFileName='%s', photo_title='%s', game_title='%s', format=%d, width=%d, height=%d, rotate=%d ", + g_filedata->dstFileName, g_filedata->photo_title, g_filedata->game_title, static_cast(g_filedata->data_sub->format), g_filedata->data_sub->width, g_filedata->data_sub->height, static_cast(g_filedata->data_sub->rotate)); } else { - g_filedata->data_sub->format = CELL_PHOTO_IMPORT_FT_UNKNOWN; + cellPhotoImportUtil.notice("Media list dialog was canceled"); } - switch (info.orientation) - { - default: - case CELL_SEARCH_ORIENTATION_UNKNOWN: - case CELL_SEARCH_ORIENTATION_TOP_LEFT: - g_filedata->data_sub->rotate = CELL_PHOTO_IMPORT_TEX_ROT_0; - break; - case CELL_SEARCH_ORIENTATION_TOP_RIGHT: - g_filedata->data_sub->rotate = CELL_PHOTO_IMPORT_TEX_ROT_90; - break; - case CELL_SEARCH_ORIENTATION_BOTTOM_RIGHT: - g_filedata->data_sub->rotate = CELL_PHOTO_IMPORT_TEX_ROT_180; - break; - case CELL_SEARCH_ORIENTATION_BOTTOM_LEFT: - g_filedata->data_sub->rotate = CELL_PHOTO_IMPORT_TEX_ROT_270; - break; - } - - cellPhotoImportUtil.notice("Media list dialog: Copying '%s' to '%s'...", info.path, dst_path); - - if (!fs::copy_file(info.path, dst_path, false)) - { - cellPhotoImportUtil.error("Failed to copy '%s' to '%s'. Error = '%s'", info.path, dst_path, fs::g_tls_error); - result = CELL_PHOTO_IMPORT_ERROR_COPY; - } - - cellPhotoImportUtil.notice("Cell image data: dstFileName='%s', photo_title='%s', game_title='%s', format=%d, width=%d, height=%d, rotate=%d ", - g_filedata->dstFileName, g_filedata->photo_title, g_filedata->game_title, static_cast(g_filedata->data_sub->format), g_filedata->data_sub->width, g_filedata->data_sub->height, static_cast(g_filedata->data_sub->rotate)); - } - else - { - cellPhotoImportUtil.notice("Media list dialog was canceled"); - } - - pi_manager.is_busy = false; - pi_manager.func_finish(ppu, result, g_filedata, pi_manager.userdata); - return CELL_OK; - }); + pi_manager.is_busy = false; + pi_manager.func_finish(ppu, result, g_filedata, pi_manager.userdata); + return CELL_OK; + }); }); if (error != CELL_OK) @@ -333,10 +333,10 @@ error_code cellPhotoImport2(u32 version, vm::cptr dstHddPath, vm::ptr= 1 && (PNG_LIBPNG_VER_MINOR < 5 \ -|| (PNG_LIBPNG_VER_MINOR == 5 && PNG_LIBPNG_VER_RELEASE < 7)) +#if PNG_LIBPNG_VER_MAJOR >= 1 && (PNG_LIBPNG_VER_MINOR < 5 || (PNG_LIBPNG_VER_MINOR == 5 && PNG_LIBPNG_VER_RELEASE < 7)) #define PNG_ERROR_ACTION_NONE 1 #define PNG_RGB_TO_GRAY_DEFAULT (-1) #endif @@ -30,48 +29,48 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellPngDecError value) - { - switch (value) { - STR_CASE(CELL_PNGDEC_ERROR_HEADER); - STR_CASE(CELL_PNGDEC_ERROR_STREAM_FORMAT); - STR_CASE(CELL_PNGDEC_ERROR_ARG); - STR_CASE(CELL_PNGDEC_ERROR_SEQ); - STR_CASE(CELL_PNGDEC_ERROR_BUSY); - STR_CASE(CELL_PNGDEC_ERROR_FATAL); - STR_CASE(CELL_PNGDEC_ERROR_OPEN_FILE); - STR_CASE(CELL_PNGDEC_ERROR_SPU_UNSUPPORT); - STR_CASE(CELL_PNGDEC_ERROR_SPU_ERROR); - STR_CASE(CELL_PNGDEC_ERROR_CB_PARAM); - } + switch (value) + { + STR_CASE(CELL_PNGDEC_ERROR_HEADER); + STR_CASE(CELL_PNGDEC_ERROR_STREAM_FORMAT); + STR_CASE(CELL_PNGDEC_ERROR_ARG); + STR_CASE(CELL_PNGDEC_ERROR_SEQ); + STR_CASE(CELL_PNGDEC_ERROR_BUSY); + STR_CASE(CELL_PNGDEC_ERROR_FATAL); + STR_CASE(CELL_PNGDEC_ERROR_OPEN_FILE); + STR_CASE(CELL_PNGDEC_ERROR_SPU_UNSUPPORT); + STR_CASE(CELL_PNGDEC_ERROR_SPU_ERROR); + STR_CASE(CELL_PNGDEC_ERROR_CB_PARAM); + } - return unknown; - }); + return unknown; + }); } // cellPngDec aliases to improve readability -using PPHandle = vm::pptr; -using PHandle = vm::ptr; -using PThreadInParam = vm::cptr; -using PThreadOutParam = vm::ptr; -using PExtThreadInParam = vm::cptr; +using PPHandle = vm::pptr; +using PHandle = vm::ptr; +using PThreadInParam = vm::cptr; +using PThreadOutParam = vm::ptr; +using PExtThreadInParam = vm::cptr; using PExtThreadOutParam = vm::ptr; -using PPStream = vm::pptr; -using PStream = vm::ptr; -using PSrc = vm::cptr; -using POpenInfo = vm::ptr; -using POpenParam = vm::cptr; -using PInfo = vm::ptr; -using PExtInfo = vm::ptr; -using PInParam = vm::cptr; -using POutParam = vm::ptr; -using PExtInParam = vm::cptr; -using PExtOutParam = vm::ptr; -using PDataControlParam = vm::cptr; -using PDataOutInfo = vm::ptr; -using PCbControlDisp = vm::cptr; -using PCbControlStream = vm::cptr; -using PDispParam = vm::ptr; +using PPStream = vm::pptr; +using PStream = vm::ptr; +using PSrc = vm::cptr; +using POpenInfo = vm::ptr; +using POpenParam = vm::cptr; +using PInfo = vm::ptr; +using PExtInfo = vm::ptr; +using PInParam = vm::cptr; +using POutParam = vm::ptr; +using PExtInParam = vm::cptr; +using PExtOutParam = vm::ptr; +using PDataControlParam = vm::cptr; +using PDataOutInfo = vm::ptr; +using PCbControlDisp = vm::cptr; +using PCbControlStream = vm::cptr; +using PDispParam = vm::ptr; // Custom read function for libpng, so we could decode images from a buffer void pngDecReadBuffer(png_structp png_ptr, png_bytep out, png_size_t length) @@ -124,14 +123,15 @@ void pngDecRowCallback(png_structp png_ptr, png_bytep new_row, png_uint_32 row_n if (stream->nextRow + stream->outputCounts == row_num) stream->nextRow = row_num; - if (stream->ppuContext && (stream->nextRow == row_num || pass > 0)) + if (stream->ppuContext && (stream->nextRow == row_num || pass > 0)) { - if (pass > 0 ) + if (pass > 0) { stream->cbDispInfo->scanPassCount = pass; stream->cbDispInfo->nextOutputStartY = row_num; } - else { + else + { stream->cbDispInfo->scanPassCount = 0; stream->cbDispInfo->nextOutputStartY = 0; } @@ -621,28 +621,24 @@ error_code pngDecSetParameter(PStream stream, PInParam in_param, POutParam out_p // Handle gray<->rgb colorspace conversions // rgb output - if (in_param->outputColorSpace == CELL_PNGDEC_ARGB - || in_param->outputColorSpace == CELL_PNGDEC_RGBA - || in_param->outputColorSpace == CELL_PNGDEC_RGB) + if (in_param->outputColorSpace == CELL_PNGDEC_ARGB || in_param->outputColorSpace == CELL_PNGDEC_RGBA || in_param->outputColorSpace == CELL_PNGDEC_RGB) { if (stream->info.colorSpace == CELL_PNGDEC_PALETTE) png_set_palette_to_rgb(stream->png_ptr); - if ((stream->info.colorSpace == CELL_PNGDEC_GRAYSCALE || stream->info.colorSpace == CELL_PNGDEC_GRAYSCALE_ALPHA) - && stream->info.bitDepth < 8) + if ((stream->info.colorSpace == CELL_PNGDEC_GRAYSCALE || stream->info.colorSpace == CELL_PNGDEC_GRAYSCALE_ALPHA) && stream->info.bitDepth < 8) png_set_expand_gray_1_2_4_to_8(stream->png_ptr); } // grayscale output else { - if (stream->info.colorSpace == CELL_PNGDEC_ARGB - || stream->info.colorSpace == CELL_PNGDEC_RGBA - || stream->info.colorSpace == CELL_PNGDEC_RGB) + if (stream->info.colorSpace == CELL_PNGDEC_ARGB || stream->info.colorSpace == CELL_PNGDEC_RGBA || stream->info.colorSpace == CELL_PNGDEC_RGB) { png_set_rgb_to_gray(stream->png_ptr, PNG_ERROR_ACTION_NONE, PNG_RGB_TO_GRAY_DEFAULT, PNG_RGB_TO_GRAY_DEFAULT); } - else { + else + { // not sure what to do here cellPngDec.error("Grayscale / Palette to Grayscale / Palette conversion currently unsupported."); } @@ -780,7 +776,7 @@ error_code pngDecodeData(ppu_thread& ppu, PHandle handle, PStream stream, vm::pt for (u32 i = 0; i < stream->out_param.outputHeight; ++i) { const u32 line = flip ? stream->out_param.outputHeight - i - 1 : i; - png_read_row(stream->png_ptr, &data[line*bytes_per_line], nullptr); + png_read_row(stream->png_ptr, &data[line * bytes_per_line], nullptr); } } png_read_end(stream->png_ptr, stream->info_ptr); @@ -1009,34 +1005,34 @@ error_code cellPngDecGetTextChunk(PHandle handle, PStream stream, vm::ptr t } DECLARE(ppu_module_manager::cellPngDec)("cellPngDec", []() -{ - REG_FUNC(cellPngDec, cellPngDecGetUnknownChunks); - REG_FUNC(cellPngDec, cellPngDecClose); - REG_FUNC(cellPngDec, cellPngDecGetpCAL); - REG_FUNC(cellPngDec, cellPngDecGetcHRM); - REG_FUNC(cellPngDec, cellPngDecGetsCAL); - REG_FUNC(cellPngDec, cellPngDecGetpHYs); - REG_FUNC(cellPngDec, cellPngDecGetoFFs); - REG_FUNC(cellPngDec, cellPngDecGetsPLT); - REG_FUNC(cellPngDec, cellPngDecGetbKGD); - REG_FUNC(cellPngDec, cellPngDecGettIME); - REG_FUNC(cellPngDec, cellPngDecGethIST); - REG_FUNC(cellPngDec, cellPngDecGettRNS); - REG_FUNC(cellPngDec, cellPngDecGetsBIT); - REG_FUNC(cellPngDec, cellPngDecGetiCCP); - REG_FUNC(cellPngDec, cellPngDecGetsRGB); - REG_FUNC(cellPngDec, cellPngDecGetgAMA); - REG_FUNC(cellPngDec, cellPngDecGetPLTE); - REG_FUNC(cellPngDec, cellPngDecGetTextChunk); - REG_FUNC(cellPngDec, cellPngDecDestroy); - REG_FUNC(cellPngDec, cellPngDecCreate); - REG_FUNC(cellPngDec, cellPngDecExtCreate); - REG_FUNC(cellPngDec, cellPngDecExtSetParameter); - REG_FUNC(cellPngDec, cellPngDecSetParameter); - REG_FUNC(cellPngDec, cellPngDecExtReadHeader); - REG_FUNC(cellPngDec, cellPngDecReadHeader); - REG_FUNC(cellPngDec, cellPngDecExtOpen); - REG_FUNC(cellPngDec, cellPngDecOpen); - REG_FUNC(cellPngDec, cellPngDecExtDecodeData); - REG_FUNC(cellPngDec, cellPngDecDecodeData); -}); + { + REG_FUNC(cellPngDec, cellPngDecGetUnknownChunks); + REG_FUNC(cellPngDec, cellPngDecClose); + REG_FUNC(cellPngDec, cellPngDecGetpCAL); + REG_FUNC(cellPngDec, cellPngDecGetcHRM); + REG_FUNC(cellPngDec, cellPngDecGetsCAL); + REG_FUNC(cellPngDec, cellPngDecGetpHYs); + REG_FUNC(cellPngDec, cellPngDecGetoFFs); + REG_FUNC(cellPngDec, cellPngDecGetsPLT); + REG_FUNC(cellPngDec, cellPngDecGetbKGD); + REG_FUNC(cellPngDec, cellPngDecGettIME); + REG_FUNC(cellPngDec, cellPngDecGethIST); + REG_FUNC(cellPngDec, cellPngDecGettRNS); + REG_FUNC(cellPngDec, cellPngDecGetsBIT); + REG_FUNC(cellPngDec, cellPngDecGetiCCP); + REG_FUNC(cellPngDec, cellPngDecGetsRGB); + REG_FUNC(cellPngDec, cellPngDecGetgAMA); + REG_FUNC(cellPngDec, cellPngDecGetPLTE); + REG_FUNC(cellPngDec, cellPngDecGetTextChunk); + REG_FUNC(cellPngDec, cellPngDecDestroy); + REG_FUNC(cellPngDec, cellPngDecCreate); + REG_FUNC(cellPngDec, cellPngDecExtCreate); + REG_FUNC(cellPngDec, cellPngDecExtSetParameter); + REG_FUNC(cellPngDec, cellPngDecSetParameter); + REG_FUNC(cellPngDec, cellPngDecExtReadHeader); + REG_FUNC(cellPngDec, cellPngDecReadHeader); + REG_FUNC(cellPngDec, cellPngDecExtOpen); + REG_FUNC(cellPngDec, cellPngDecOpen); + REG_FUNC(cellPngDec, cellPngDecExtDecodeData); + REG_FUNC(cellPngDec, cellPngDecDecodeData); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellPngDec.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellPngDec.h index 92f2b4c2f..5e4d35337 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellPngDec.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellPngDec.h @@ -12,38 +12,38 @@ enum : u32 // Return Codes enum CellPngDecError { - CELL_PNGDEC_ERROR_HEADER = 0x80611201, + CELL_PNGDEC_ERROR_HEADER = 0x80611201, CELL_PNGDEC_ERROR_STREAM_FORMAT = 0x80611202, - CELL_PNGDEC_ERROR_ARG = 0x80611203, - CELL_PNGDEC_ERROR_SEQ = 0x80611204, - CELL_PNGDEC_ERROR_BUSY = 0x80611205, - CELL_PNGDEC_ERROR_FATAL = 0x80611206, - CELL_PNGDEC_ERROR_OPEN_FILE = 0x80611207, + CELL_PNGDEC_ERROR_ARG = 0x80611203, + CELL_PNGDEC_ERROR_SEQ = 0x80611204, + CELL_PNGDEC_ERROR_BUSY = 0x80611205, + CELL_PNGDEC_ERROR_FATAL = 0x80611206, + CELL_PNGDEC_ERROR_OPEN_FILE = 0x80611207, CELL_PNGDEC_ERROR_SPU_UNSUPPORT = 0x80611208, - CELL_PNGDEC_ERROR_SPU_ERROR = 0x80611209, - CELL_PNGDEC_ERROR_CB_PARAM = 0x8061120a, + CELL_PNGDEC_ERROR_SPU_ERROR = 0x80611209, + CELL_PNGDEC_ERROR_CB_PARAM = 0x8061120a, }; // Consts enum CellPngDecColorSpace : s32 { - CELL_PNGDEC_GRAYSCALE = 1, - CELL_PNGDEC_RGB = 2, - CELL_PNGDEC_PALETTE = 4, + CELL_PNGDEC_GRAYSCALE = 1, + CELL_PNGDEC_RGB = 2, + CELL_PNGDEC_PALETTE = 4, CELL_PNGDEC_GRAYSCALE_ALPHA = 9, - CELL_PNGDEC_RGBA = 10, - CELL_PNGDEC_ARGB = 20, + CELL_PNGDEC_RGBA = 10, + CELL_PNGDEC_ARGB = 20, }; enum CellPngDecSpuThreadEna : s32 { CELL_PNGDEC_SPU_THREAD_DISABLE = 0, - CELL_PNGDEC_SPU_THREAD_ENABLE = 1, + CELL_PNGDEC_SPU_THREAD_ENABLE = 1, }; enum CellPngDecStreamSrcSel : s32 { - CELL_PNGDEC_FILE = 0, + CELL_PNGDEC_FILE = 0, CELL_PNGDEC_BUFFER = 1, }; @@ -68,19 +68,19 @@ enum CellPngDecPackFlag : s32 enum CellPngDecAlphaSelect : s32 { CELL_PNGDEC_STREAM_ALPHA = 0, - CELL_PNGDEC_FIX_ALPHA = 1, + CELL_PNGDEC_FIX_ALPHA = 1, }; enum CellPngDecCommand : s32 { CELL_PNGDEC_CONTINUE = 0, - CELL_PNGDEC_STOP = 1, + CELL_PNGDEC_STOP = 1, }; enum CellPngDecDecodeStatus : s32 { CELL_PNGDEC_DEC_STATUS_FINISH = 0, - CELL_PNGDEC_DEC_STATUS_STOP = 1, + CELL_PNGDEC_DEC_STATUS_STOP = 1, }; enum CellPngDecBufferMode : s32 @@ -90,13 +90,13 @@ enum CellPngDecBufferMode : s32 enum CellPngDecSpuMode : s32 { - CELL_PNGDEC_RECEIVE_EVENT = 0, + CELL_PNGDEC_RECEIVE_EVENT = 0, CELL_PNGDEC_TRYRECEIVE_EVENT = 1, }; // Callbacks for memory management using CellPngDecCbControlMalloc = vm::ptr(u32 size, vm::ptr cbCtrlMallocArg); -using CellPngDecCbControlFree = s32(vm::ptr ptr, vm::ptr cbCtrlFreeArg); +using CellPngDecCbControlFree = s32(vm::ptr ptr, vm::ptr cbCtrlFreeArg); // Structs struct CellPngDecThreadInParam @@ -157,10 +157,10 @@ struct CellPngDecInfo struct CellPngDecInParam { vm::bptr commandPtr; // CellPngDecCommand - be_t outputMode; // CellPngDecOutputMode - be_t outputColorSpace; // CellPngDecColorSpace + be_t outputMode; // CellPngDecOutputMode + be_t outputColorSpace; // CellPngDecColorSpace be_t outputBitDepth; - be_t outputPackFlag; // CellPngDecPackFlag + be_t outputPackFlag; // CellPngDecPackFlag be_t outputAlphaSelect; // CellPngDecAlphaSelect be_t outputColorAlpha; }; @@ -172,7 +172,7 @@ struct CellPngDecOutParam be_t outputHeight; be_t outputComponents; be_t outputBitDepth; - be_t outputMode; // CellPngDecOutputMode + be_t outputMode; // CellPngDecOutputMode be_t outputColorSpace; // CellPngDecOutputMode be_t useMemorySpace; }; @@ -247,7 +247,7 @@ struct CellPngDecExtOutParam // Callbacks for decoding partial streams using CellPngDecCbControlStream = s32(vm::ptr strmInfo, vm::ptr strmParam, vm::ptr cbCtrlStrmArg); -using CellPngDecCbControlDisp = s32(vm::ptr dispInfo, vm::ptr dispParam, vm::ptr cbCtrlDispArg); +using CellPngDecCbControlDisp = s32(vm::ptr dispInfo, vm::ptr dispParam, vm::ptr cbCtrlDispArg); struct CellPngDecCbCtrlStrm { @@ -318,10 +318,10 @@ static s32 getPngDecColourType(u8 type) { switch (type) { - case PNG_COLOR_TYPE_RGB: return CELL_PNGDEC_RGB; - case PNG_COLOR_TYPE_RGBA: return CELL_PNGDEC_RGBA; // We can't diffrentiate between ARGB and RGBA. Doesn't seem to be exactly important. - case PNG_COLOR_TYPE_PALETTE: return CELL_PNGDEC_PALETTE; - case PNG_COLOR_TYPE_GRAY: return CELL_PNGDEC_GRAYSCALE; + case PNG_COLOR_TYPE_RGB: return CELL_PNGDEC_RGB; + case PNG_COLOR_TYPE_RGBA: return CELL_PNGDEC_RGBA; // We can't diffrentiate between ARGB and RGBA. Doesn't seem to be exactly important. + case PNG_COLOR_TYPE_PALETTE: return CELL_PNGDEC_PALETTE; + case PNG_COLOR_TYPE_GRAY: return CELL_PNGDEC_GRAYSCALE; case PNG_COLOR_TYPE_GRAY_ALPHA: return CELL_PNGDEC_GRAYSCALE_ALPHA; default: fmt::throw_exception("Unknown colour type: %d", type); } diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellPngEnc.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellPngEnc.cpp index c6da0c4e9..54e26bcf2 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellPngEnc.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellPngEnc.cpp @@ -9,23 +9,23 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellPngEncError value) - { - switch (value) { - STR_CASE(CELL_PNGENC_ERROR_ARG); - STR_CASE(CELL_PNGENC_ERROR_SEQ); - STR_CASE(CELL_PNGENC_ERROR_BUSY); - STR_CASE(CELL_PNGENC_ERROR_EMPTY); - STR_CASE(CELL_PNGENC_ERROR_RESET); - STR_CASE(CELL_PNGENC_ERROR_FATAL); - STR_CASE(CELL_PNGENC_ERROR_STREAM_ABORT); - STR_CASE(CELL_PNGENC_ERROR_STREAM_SKIP); - STR_CASE(CELL_PNGENC_ERROR_STREAM_OVERFLOW); - STR_CASE(CELL_PNGENC_ERROR_STREAM_FILE_OPEN); - } + switch (value) + { + STR_CASE(CELL_PNGENC_ERROR_ARG); + STR_CASE(CELL_PNGENC_ERROR_SEQ); + STR_CASE(CELL_PNGENC_ERROR_BUSY); + STR_CASE(CELL_PNGENC_ERROR_EMPTY); + STR_CASE(CELL_PNGENC_ERROR_RESET); + STR_CASE(CELL_PNGENC_ERROR_FATAL); + STR_CASE(CELL_PNGENC_ERROR_STREAM_ABORT); + STR_CASE(CELL_PNGENC_ERROR_STREAM_SKIP); + STR_CASE(CELL_PNGENC_ERROR_STREAM_OVERFLOW); + STR_CASE(CELL_PNGENC_ERROR_STREAM_FILE_OPEN); + } - return unknown; - }); + return unknown; + }); } struct png_encoder @@ -53,12 +53,9 @@ bool check_config(vm::cptr config) u32 get_mem_size(vm::cptr config) { - return config->addMemSize - + (config->enableSpu ? 0x78200 : 0x47a00) - + (config->maxBitDepth >> 1) * config->maxWidth * 7; + return config->addMemSize + (config->enableSpu ? 0x78200 : 0x47a00) + (config->maxBitDepth >> 1) * config->maxWidth * 7; } - error_code cellPngEncQueryAttr(vm::cptr config, vm::ptr attr) { cellPngEnc.todo("cellPngEncQueryAttr(config=*0x%x, attr=*0x%x)", config, attr); @@ -225,14 +222,14 @@ error_code cellPngEncReset(u32 handle) } DECLARE(ppu_module_manager::cellPngEnc)("cellPngEnc", []() -{ - REG_FUNC(cellPngEnc, cellPngEncQueryAttr); - REG_FUNC(cellPngEnc, cellPngEncOpen); - REG_FUNC(cellPngEnc, cellPngEncOpenEx); - REG_FUNC(cellPngEnc, cellPngEncClose); - REG_FUNC(cellPngEnc, cellPngEncWaitForInput); - REG_FUNC(cellPngEnc, cellPngEncEncodePicture); - REG_FUNC(cellPngEnc, cellPngEncWaitForOutput); - REG_FUNC(cellPngEnc, cellPngEncGetStreamInfo); - REG_FUNC(cellPngEnc, cellPngEncReset); -}); + { + REG_FUNC(cellPngEnc, cellPngEncQueryAttr); + REG_FUNC(cellPngEnc, cellPngEncOpen); + REG_FUNC(cellPngEnc, cellPngEncOpenEx); + REG_FUNC(cellPngEnc, cellPngEncClose); + REG_FUNC(cellPngEnc, cellPngEncWaitForInput); + REG_FUNC(cellPngEnc, cellPngEncEncodePicture); + REG_FUNC(cellPngEnc, cellPngEncWaitForOutput); + REG_FUNC(cellPngEnc, cellPngEncGetStreamInfo); + REG_FUNC(cellPngEnc, cellPngEncReset); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellPngEnc.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellPngEnc.h index 1ab0e87c8..902b75a5b 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellPngEnc.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellPngEnc.h @@ -3,80 +3,80 @@ // Error Codes enum CellPngEncError { - CELL_PNGENC_ERROR_ARG = 0x80611291, - CELL_PNGENC_ERROR_SEQ = 0x80611292, - CELL_PNGENC_ERROR_BUSY = 0x80611293, - CELL_PNGENC_ERROR_EMPTY = 0x80611294, - CELL_PNGENC_ERROR_RESET = 0x80611295, - CELL_PNGENC_ERROR_FATAL = 0x80611296, - CELL_PNGENC_ERROR_STREAM_ABORT = 0x806112A1, - CELL_PNGENC_ERROR_STREAM_SKIP = 0x806112A2, - CELL_PNGENC_ERROR_STREAM_OVERFLOW = 0x806112A3, + CELL_PNGENC_ERROR_ARG = 0x80611291, + CELL_PNGENC_ERROR_SEQ = 0x80611292, + CELL_PNGENC_ERROR_BUSY = 0x80611293, + CELL_PNGENC_ERROR_EMPTY = 0x80611294, + CELL_PNGENC_ERROR_RESET = 0x80611295, + CELL_PNGENC_ERROR_FATAL = 0x80611296, + CELL_PNGENC_ERROR_STREAM_ABORT = 0x806112A1, + CELL_PNGENC_ERROR_STREAM_SKIP = 0x806112A2, + CELL_PNGENC_ERROR_STREAM_OVERFLOW = 0x806112A3, CELL_PNGENC_ERROR_STREAM_FILE_OPEN = 0x806112A4, }; enum CellPngEncColorSpace { - CELL_PNGENC_COLOR_SPACE_GRAYSCALE = 1, - CELL_PNGENC_COLOR_SPACE_RGB = 2, - CELL_PNGENC_COLOR_SPACE_PALETTE = 4, - CELL_PNGENC_COLOR_SPACE_GRAYSCALE_ALPHA = 9, - CELL_PNGENC_COLOR_SPACE_RGBA = 10, - CELL_PNGENC_COLOR_SPACE_ARGB = 20 + CELL_PNGENC_COLOR_SPACE_GRAYSCALE = 1, + CELL_PNGENC_COLOR_SPACE_RGB = 2, + CELL_PNGENC_COLOR_SPACE_PALETTE = 4, + CELL_PNGENC_COLOR_SPACE_GRAYSCALE_ALPHA = 9, + CELL_PNGENC_COLOR_SPACE_RGBA = 10, + CELL_PNGENC_COLOR_SPACE_ARGB = 20 }; enum CellPngEncCompressionLevel { - CELL_PNGENC_COMPR_LEVEL_0, - CELL_PNGENC_COMPR_LEVEL_1, - CELL_PNGENC_COMPR_LEVEL_2, - CELL_PNGENC_COMPR_LEVEL_3, - CELL_PNGENC_COMPR_LEVEL_4, - CELL_PNGENC_COMPR_LEVEL_5, - CELL_PNGENC_COMPR_LEVEL_6, - CELL_PNGENC_COMPR_LEVEL_7, - CELL_PNGENC_COMPR_LEVEL_8, - CELL_PNGENC_COMPR_LEVEL_9 + CELL_PNGENC_COMPR_LEVEL_0, + CELL_PNGENC_COMPR_LEVEL_1, + CELL_PNGENC_COMPR_LEVEL_2, + CELL_PNGENC_COMPR_LEVEL_3, + CELL_PNGENC_COMPR_LEVEL_4, + CELL_PNGENC_COMPR_LEVEL_5, + CELL_PNGENC_COMPR_LEVEL_6, + CELL_PNGENC_COMPR_LEVEL_7, + CELL_PNGENC_COMPR_LEVEL_8, + CELL_PNGENC_COMPR_LEVEL_9 }; enum CellPngEncFilterType { - CELL_PNGENC_FILTER_TYPE_NONE = 0x08, - CELL_PNGENC_FILTER_TYPE_SUB = 0x10, - CELL_PNGENC_FILTER_TYPE_UP = 0x20, - CELL_PNGENC_FILTER_TYPE_AVG = 0x40, - CELL_PNGENC_FILTER_TYPE_PAETH = 0x80, - CELL_PNGENC_FILTER_TYPE_ALL = 0xF8 + CELL_PNGENC_FILTER_TYPE_NONE = 0x08, + CELL_PNGENC_FILTER_TYPE_SUB = 0x10, + CELL_PNGENC_FILTER_TYPE_UP = 0x20, + CELL_PNGENC_FILTER_TYPE_AVG = 0x40, + CELL_PNGENC_FILTER_TYPE_PAETH = 0x80, + CELL_PNGENC_FILTER_TYPE_ALL = 0xF8 }; enum CellPngEncChunkType { - CELL_PNGENC_CHUNK_TYPE_PLTE, - CELL_PNGENC_CHUNK_TYPE_TRNS, - CELL_PNGENC_CHUNK_TYPE_CHRM, - CELL_PNGENC_CHUNK_TYPE_GAMA, - CELL_PNGENC_CHUNK_TYPE_ICCP, - CELL_PNGENC_CHUNK_TYPE_SBIT, - CELL_PNGENC_CHUNK_TYPE_SRGB, - CELL_PNGENC_CHUNK_TYPE_TEXT, - CELL_PNGENC_CHUNK_TYPE_BKGD, - CELL_PNGENC_CHUNK_TYPE_HIST, - CELL_PNGENC_CHUNK_TYPE_PHYS, - CELL_PNGENC_CHUNK_TYPE_SPLT, - CELL_PNGENC_CHUNK_TYPE_TIME, - CELL_PNGENC_CHUNK_TYPE_OFFS, - CELL_PNGENC_CHUNK_TYPE_PCAL, - CELL_PNGENC_CHUNK_TYPE_SCAL, - CELL_PNGENC_CHUNK_TYPE_UNKNOWN + CELL_PNGENC_CHUNK_TYPE_PLTE, + CELL_PNGENC_CHUNK_TYPE_TRNS, + CELL_PNGENC_CHUNK_TYPE_CHRM, + CELL_PNGENC_CHUNK_TYPE_GAMA, + CELL_PNGENC_CHUNK_TYPE_ICCP, + CELL_PNGENC_CHUNK_TYPE_SBIT, + CELL_PNGENC_CHUNK_TYPE_SRGB, + CELL_PNGENC_CHUNK_TYPE_TEXT, + CELL_PNGENC_CHUNK_TYPE_BKGD, + CELL_PNGENC_CHUNK_TYPE_HIST, + CELL_PNGENC_CHUNK_TYPE_PHYS, + CELL_PNGENC_CHUNK_TYPE_SPLT, + CELL_PNGENC_CHUNK_TYPE_TIME, + CELL_PNGENC_CHUNK_TYPE_OFFS, + CELL_PNGENC_CHUNK_TYPE_PCAL, + CELL_PNGENC_CHUNK_TYPE_SCAL, + CELL_PNGENC_CHUNK_TYPE_UNKNOWN }; enum CellPngEncLocation { - CELL_PNGENC_LOCATION_FILE, - CELL_PNGENC_LOCATION_BUFFER + CELL_PNGENC_LOCATION_FILE, + CELL_PNGENC_LOCATION_BUFFER }; -//typedef void *CellPngEncHandle; +// typedef void *CellPngEncHandle; struct CellPngEncExParam // Size 8 { @@ -166,7 +166,7 @@ struct CellPngEncStreamInfo // Size 40 be_t location; // CellPngEncLocation vm::bcptr streamFileName; vm::bptr streamAddr; - be_t limitSize; // usz + be_t limitSize; // usz be_t streamSize; // usz be_t processedLine; be_t userData; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellPrint.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellPrint.cpp index bfe4693cd..7b76d1930 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellPrint.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellPrint.cpp @@ -7,13 +7,13 @@ LOG_CHANNEL(cellPrint); // Error Codes enum { - CELL_PRINT_ERROR_INTERNAL = 0x8002c401, - CELL_PRINT_ERROR_NO_MEMORY = 0x8002c402, - CELL_PRINT_ERROR_PRINTER_NOT_FOUND = 0x8002c403, - CELL_PRINT_ERROR_INVALID_PARAM = 0x8002c404, - CELL_PRINT_ERROR_INVALID_FUNCTION = 0x8002c405, - CELL_PRINT_ERROR_NOT_SUPPORT = 0x8002c406, - CELL_PRINT_ERROR_OCCURRED = 0x8002c407, + CELL_PRINT_ERROR_INTERNAL = 0x8002c401, + CELL_PRINT_ERROR_NO_MEMORY = 0x8002c402, + CELL_PRINT_ERROR_PRINTER_NOT_FOUND = 0x8002c403, + CELL_PRINT_ERROR_INVALID_PARAM = 0x8002c404, + CELL_PRINT_ERROR_INVALID_FUNCTION = 0x8002c405, + CELL_PRINT_ERROR_NOT_SUPPORT = 0x8002c406, + CELL_PRINT_ERROR_OCCURRED = 0x8002c407, CELL_PRINT_ERROR_CANCELED_BY_PRINTER = 0x8002c408, }; @@ -50,10 +50,10 @@ error_code cellPrintLoadAsync(vm::ptr function, vm::ptr cellPrint.todo("cellPrintLoadAsync(function=*0x%x, userdata=*0x%x, param=*0x%x, container=0x%x)", function, userdata, param, container); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - function(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + function(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -63,10 +63,10 @@ error_code cellPrintLoadAsync2(vm::ptr function, vm::ptr s32 - { - function(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + function(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -76,10 +76,10 @@ error_code cellPrintUnloadAsync(vm::ptr function, vm::ptr s32 - { - function(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + function(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -95,10 +95,10 @@ error_code cellPrintOpenConfig(vm::ptr function, vm::ptr s32 - { - function(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + function(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -146,20 +146,20 @@ error_code cellPrintSendBand(vm::cptr buff, s32 buffsize, vm::ptr sends } DECLARE(ppu_module_manager::cellPrint)("cellPrintUtility", []() -{ - REG_FUNC(cellPrintUtility, cellSysutilPrintInit); - REG_FUNC(cellPrintUtility, cellSysutilPrintShutdown); + { + REG_FUNC(cellPrintUtility, cellSysutilPrintInit); + REG_FUNC(cellPrintUtility, cellSysutilPrintShutdown); - REG_FUNC(cellPrintUtility, cellPrintLoadAsync); - REG_FUNC(cellPrintUtility, cellPrintLoadAsync2); - REG_FUNC(cellPrintUtility, cellPrintUnloadAsync); - REG_FUNC(cellPrintUtility, cellPrintGetStatus); - REG_FUNC(cellPrintUtility, cellPrintOpenConfig); - REG_FUNC(cellPrintUtility, cellPrintGetPrintableArea); - REG_FUNC(cellPrintUtility, cellPrintStartJob); - REG_FUNC(cellPrintUtility, cellPrintEndJob); - REG_FUNC(cellPrintUtility, cellPrintCancelJob); - REG_FUNC(cellPrintUtility, cellPrintStartPage); - REG_FUNC(cellPrintUtility, cellPrintEndPage); - REG_FUNC(cellPrintUtility, cellPrintSendBand); -}); + REG_FUNC(cellPrintUtility, cellPrintLoadAsync); + REG_FUNC(cellPrintUtility, cellPrintLoadAsync2); + REG_FUNC(cellPrintUtility, cellPrintUnloadAsync); + REG_FUNC(cellPrintUtility, cellPrintGetStatus); + REG_FUNC(cellPrintUtility, cellPrintOpenConfig); + REG_FUNC(cellPrintUtility, cellPrintGetPrintableArea); + REG_FUNC(cellPrintUtility, cellPrintStartJob); + REG_FUNC(cellPrintUtility, cellPrintEndJob); + REG_FUNC(cellPrintUtility, cellPrintCancelJob); + REG_FUNC(cellPrintUtility, cellPrintStartPage); + REG_FUNC(cellPrintUtility, cellPrintEndPage); + REG_FUNC(cellPrintUtility, cellPrintSendBand); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellRec.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellRec.cpp index 19e3279d1..5b9352d02 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellRec.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellRec.cpp @@ -20,34 +20,34 @@ LOG_CHANNEL(cellRec); extern atomic_t g_recording_mode; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_REC_ERROR_OUT_OF_MEMORY); - STR_CASE(CELL_REC_ERROR_FATAL); - STR_CASE(CELL_REC_ERROR_INVALID_VALUE); - STR_CASE(CELL_REC_ERROR_FILE_OPEN); - STR_CASE(CELL_REC_ERROR_FILE_WRITE); - STR_CASE(CELL_REC_ERROR_INVALID_STATE); - STR_CASE(CELL_REC_ERROR_FILE_NO_DATA); - } + switch (error) + { + STR_CASE(CELL_REC_ERROR_OUT_OF_MEMORY); + STR_CASE(CELL_REC_ERROR_FATAL); + STR_CASE(CELL_REC_ERROR_INVALID_VALUE); + STR_CASE(CELL_REC_ERROR_FILE_OPEN); + STR_CASE(CELL_REC_ERROR_FILE_WRITE); + STR_CASE(CELL_REC_ERROR_INVALID_STATE); + STR_CASE(CELL_REC_ERROR_FILE_NO_DATA); + } - return unknown; - }); + return unknown; + }); } // Helper to distinguish video type enum : s32 { - VIDEO_TYPE_MPEG4 = 0x0000, + VIDEO_TYPE_MPEG4 = 0x0000, VIDEO_TYPE_AVC_MP = 0x1000, VIDEO_TYPE_AVC_BL = 0x2000, - VIDEO_TYPE_MJPEG = 0x3000, - VIDEO_TYPE_M4HD = 0x4000, + VIDEO_TYPE_MJPEG = 0x3000, + VIDEO_TYPE_M4HD = 0x4000, }; // Helper to distinguish video quality @@ -65,7 +65,7 @@ enum : s32 enum class rec_state : u32 { - closed = 0x2710, + closed = 0x2710, stopped = 0x2711, started = 0xBEEF, // I don't know the value of this }; @@ -114,7 +114,8 @@ struct rec_param std::string scene_metadata_tags; for (usz i = 0; i < tags.size(); i++) { - if (i > 0) scene_metadata_tags += ", "; + if (i > 0) + scene_metadata_tags += ", "; fmt::append(scene_metadata_tags, "'%s'", tags[i]); } return fmt::format("{ is_set=%d, type=%d, start_time=%d, end_time=%d, title='%s', tags=[ %s ] }", is_set, type, start_time, end_time, title, scene_metadata_tags); @@ -126,13 +127,14 @@ struct rec_param std::string priority; for (usz i = 0; i < 8; i++) { - if (i > 0) priority += ", "; + if (i > 0) + priority += ", "; fmt::append(priority, "%d", spurs_param.priority[i]); } return fmt::format("ppu_thread_priority=%d, spu_thread_priority=%d, capture_priority=%d, use_system_spu=%d, fit_to_youtube=%d, " - "xmb_bgm=%d, mpeg4_fast_encode=%d, ring_sec=%d, video_input=%d, audio_input=%d, audio_input_mix_vol=%d, reduce_memsize=%d, " - "show_xmb=%d, filename='%s', metadata_filename='%s', spurs_param={ pSpurs=*0x%x, spu_usage_rate=%d, priority=[ %s ], " - "movie_metadata=%s, scene_metadata=%s", + "xmb_bgm=%d, mpeg4_fast_encode=%d, ring_sec=%d, video_input=%d, audio_input=%d, audio_input_mix_vol=%d, reduce_memsize=%d, " + "show_xmb=%d, filename='%s', metadata_filename='%s', spurs_param={ pSpurs=*0x%x, spu_usage_rate=%d, priority=[ %s ], " + "movie_metadata=%s, scene_metadata=%s", ppu_thread_priority, spu_thread_priority, capture_priority, use_system_spu, fit_to_youtube, xmb_bgm, mpeg4_fast_encode, ring_sec, video_input, audio_input, audio_input_mix_vol, reduce_memsize, show_xmb, filename, metadata_filename, spurs_param.pSpurs, spurs_param.spu_usage_rate, priority, movie_metadata.to_string(), scene_metadata.to_string()); @@ -140,14 +142,14 @@ struct rec_param bool use_external_audio() const { - return audio_input != CELL_REC_PARAM_AUDIO_INPUT_DISABLE // != DISABLE means that cellRec will add samples on its own - && audio_input_mix_vol > CELL_REC_PARAM_AUDIO_INPUT_MIX_VOL_MIN; // We need to mix cellRec audio with internal audio + return audio_input != CELL_REC_PARAM_AUDIO_INPUT_DISABLE // != DISABLE means that cellRec will add samples on its own + && audio_input_mix_vol > CELL_REC_PARAM_AUDIO_INPUT_MIX_VOL_MIN; // We need to mix cellRec audio with internal audio } bool use_internal_audio() const { - return audio_input == CELL_REC_PARAM_AUDIO_INPUT_DISABLE // DISABLE means that cellRec won't add samples on its own - || audio_input_mix_vol < CELL_REC_PARAM_AUDIO_INPUT_MIX_VOL_MAX; // We need to mix cellRec audio with internal audio + return audio_input == CELL_REC_PARAM_AUDIO_INPUT_DISABLE // DISABLE means that cellRec won't add samples on its own + || audio_input_mix_vol < CELL_REC_PARAM_AUDIO_INPUT_MIX_VOL_MAX; // We need to mix cellRec audio with internal audio } bool use_internal_video() const @@ -157,7 +159,7 @@ struct rec_param }; static constexpr u32 rec_framerate = 30; // Always 30 fps -static constexpr u32 rec_channels = 2; // Always 2 channels +static constexpr u32 rec_channels = 2; // Always 2 channels class rec_video_sink final : public utils::video_sink { @@ -290,7 +292,7 @@ struct rec_info // Audio parameters u32 sample_rate = 48000; u32 audio_bps = 64000; - s32 audio_codec_id = 86018; // AV_CODEC_ID_AAC + s32 audio_codec_id = 86018; // AV_CODEC_ID_AAC static constexpr u32 channels = rec_channels; // Always 2 channels // Recording duration @@ -392,7 +394,7 @@ void rec_info::set_video_params(s32 video_format) break; case VIDEO_TYPE_AVC_BL: video_codec_id = 27; // AV_CODEC_ID_H264 - max_b_frames = 0; // Apparently baseline H264 does not support B-Frames + max_b_frames = 0; // Apparently baseline H264 does not support B-Frames break; case VIDEO_TYPE_MJPEG: video_codec_id = 7; // AV_CODEC_ID_MJPEG @@ -406,7 +408,7 @@ void rec_info::set_video_params(s32 video_format) const bool wide = g_cfg.video.aspect_ratio == video_aspect::_16_9; bool hd = true; - switch(g_cfg.video.resolution) + switch (g_cfg.video.resolution) { case video_resolution::_1080p: case video_resolution::_1080i: @@ -511,7 +513,7 @@ void rec_info::set_audio_params(s32 audio_format) case CELL_REC_PARAM_AUDIO_FMT_PCM_768K: case CELL_REC_PARAM_AUDIO_FMT_PCM_1536K: audio_codec_id = 65556; // AV_CODEC_ID_PCM_F32BE - //audio_codec_id = 65557; // AV_CODEC_ID_PCM_F32LE // TODO: maybe this one? + // audio_codec_id = 65557; // AV_CODEC_ID_PCM_F32LE // TODO: maybe this one? break; default: audio_codec_id = 86018; // AV_CODEC_ID_AAC @@ -608,209 +610,209 @@ void rec_info::start_video_provider() } video_provider_thread = std::make_unique>>("cellRec video provider", [this]() - { - const bool use_internal_audio = param.use_internal_audio(); - const bool use_external_audio = param.use_external_audio(); - const bool use_external_video = !param.use_internal_video(); - const bool use_ring_buffer = param.ring_sec > 0; - const usz frame_size = input_format.pitch * input_format.height; - audio_block buffer_external{}; // for cellRec input - audio_block buffer_internal{}; // for cellAudio input - s64 last_video_pts = -1; - s64 last_audio_pts = -1; - - cellRec.notice("video_provider_thread: use_ring_buffer=%d, video_ringbuffer_size=%d, audio_ringbuffer_size=%d, ring_sec=%d, frame_size=%d, use_internal_video=%d, use_external_audio=%d, use_internal_audio=%d", use_ring_buffer, video_ringbuffer.size(), audio_ringbuffer.size(), param.ring_sec, frame_size, encoder->use_internal_video, use_external_audio, encoder->use_internal_audio); - - while (thread_ctrl::state() != thread_state::aborting && encoder) { - if (encoder->has_error) - { - cellRec.error("Encoder error. Sending error status."); + const bool use_internal_audio = param.use_internal_audio(); + const bool use_external_audio = param.use_external_audio(); + const bool use_external_video = !param.use_internal_video(); + const bool use_ring_buffer = param.ring_sec > 0; + const usz frame_size = input_format.pitch * input_format.height; + audio_block buffer_external{}; // for cellRec input + audio_block buffer_internal{}; // for cellAudio input + s64 last_video_pts = -1; + s64 last_audio_pts = -1; - sysutil_register_cb([this](ppu_thread& ppu) -> s32 + cellRec.notice("video_provider_thread: use_ring_buffer=%d, video_ringbuffer_size=%d, audio_ringbuffer_size=%d, ring_sec=%d, frame_size=%d, use_internal_video=%d, use_external_audio=%d, use_internal_audio=%d", use_ring_buffer, video_ringbuffer.size(), audio_ringbuffer.size(), param.ring_sec, frame_size, encoder->use_internal_video, use_external_audio, encoder->use_internal_audio); + + while (thread_ctrl::state() != thread_state::aborting && encoder) + { + if (encoder->has_error) { - if (cb) + cellRec.error("Encoder error. Sending error status."); + + sysutil_register_cb([this](ppu_thread& ppu) -> s32 + { + if (cb) + { + cb(ppu, CELL_REC_STATUS_ERR, CELL_REC_ERROR_FILE_WRITE, cbUserData); + } + return CELL_OK; + }); + + return; + } + + if (paused) + { + thread_ctrl::wait_for(10000); + continue; + } + + // We only care for new video frames or audio samples that can be properly encoded, so we check the timestamps and pts. + const usz timestamp_ms = (get_system_time() - recording_time_start - pause_time_total) / 1000; + + ///////////////// + // VIDEO // + ///////////////// + + // TODO: wait for flip before adding a frame + if (use_external_video) + { + // The video frames originate from cellRec instead of our render pipeline. + if (const s64 pts = encoder->get_pts(timestamp_ms); pts > last_video_pts) { - cb(ppu, CELL_REC_STATUS_ERR, CELL_REC_ERROR_FILE_WRITE, cbUserData); + if (video_input_buffer) + { + if (use_ring_buffer) + { + // The video frames originate from cellRec and are stored in a ringbuffer. + utils::video_sink::encoder_frame& frame_data = video_ringbuffer[next_video_ring_pos()]; + frame_data.pts = pts; + frame_data.width = input_format.width; + frame_data.height = input_format.height; + frame_data.av_pixel_format = input_format.av_pixel_format; + frame_data.data.resize(frame_size); + std::memcpy(frame_data.data.data(), video_input_buffer.get_ptr(), frame_data.data.size()); + video_ring_frame_count++; + } + else + { + // The video frames originate from cellRec and are pushed to the encoder immediately. + std::vector frame(frame_size); + std::memcpy(frame.data(), video_input_buffer.get_ptr(), frame.size()); + encoder->add_frame(frame, input_format.pitch, input_format.width, input_format.height, input_format.av_pixel_format, timestamp_ms); + } + } + + last_video_pts = pts; } - return CELL_OK; - }); - - return; - } - - if (paused) - { - thread_ctrl::wait_for(10000); - continue; - } - - // We only care for new video frames or audio samples that can be properly encoded, so we check the timestamps and pts. - const usz timestamp_ms = (get_system_time() - recording_time_start - pause_time_total) / 1000; - - ///////////////// - // VIDEO // - ///////////////// - - // TODO: wait for flip before adding a frame - if (use_external_video) - { - // The video frames originate from cellRec instead of our render pipeline. - if (const s64 pts = encoder->get_pts(timestamp_ms); pts > last_video_pts) + } + else if (sink) { - if (video_input_buffer) + // The video frames originate from our render pipeline. + utils::video_sink::encoder_frame frame = sink->get_frame(); + + if (const s64 pts = encoder->get_pts(frame.timestamp_ms); pts > last_video_pts && !frame.data.empty()) { if (use_ring_buffer) { - // The video frames originate from cellRec and are stored in a ringbuffer. - utils::video_sink::encoder_frame& frame_data = video_ringbuffer[next_video_ring_pos()]; - frame_data.pts = pts; - frame_data.width = input_format.width; - frame_data.height = input_format.height; - frame_data.av_pixel_format = input_format.av_pixel_format; - frame_data.data.resize(frame_size); - std::memcpy(frame_data.data.data(), video_input_buffer.get_ptr(), frame_data.data.size()); + // The video frames originate from our render pipeline and are stored in a ringbuffer. + frame.pts = pts; + video_ringbuffer[next_video_ring_pos()] = std::move(frame); video_ring_frame_count++; } else { - // The video frames originate from cellRec and are pushed to the encoder immediately. - std::vector frame(frame_size); - std::memcpy(frame.data(), video_input_buffer.get_ptr(), frame.size()); - encoder->add_frame(frame, input_format.pitch, input_format.width, input_format.height, input_format.av_pixel_format, timestamp_ms); + // The video frames originate from our render pipeline and are directly encoded by the encoder. + encoder->add_frame(frame.data, frame.pitch, frame.width, frame.height, frame.av_pixel_format, frame.timestamp_ms); } - } - last_video_pts = pts; + last_video_pts = pts; + } } - } - else if (sink) - { - // The video frames originate from our render pipeline. - utils::video_sink::encoder_frame frame = sink->get_frame(); - if (const s64 pts = encoder->get_pts(frame.timestamp_ms); pts > last_video_pts && !frame.data.empty()) + ///////////////// + // AUDIO // + ///////////////// + + const usz timestamp_us = get_system_time() - recording_time_start - pause_time_total; + bool got_new_samples = false; + + if (use_external_audio) { - if (use_ring_buffer) + if (const s64 pts = encoder->get_audio_pts(timestamp_us); pts > last_audio_pts) { - // The video frames originate from our render pipeline and are stored in a ringbuffer. - frame.pts = pts; - video_ringbuffer[next_video_ring_pos()] = std::move(frame); - video_ring_frame_count++; - } - else - { - // The video frames originate from our render pipeline and are directly encoded by the encoder. - encoder->add_frame(frame.data, frame.pitch, frame.width, frame.height, frame.av_pixel_format, frame.timestamp_ms); - } - - last_video_pts = pts; - } - } - - ///////////////// - // AUDIO // - ///////////////// - - const usz timestamp_us = get_system_time() - recording_time_start - pause_time_total; - bool got_new_samples = false; - - if (use_external_audio) - { - if (const s64 pts = encoder->get_audio_pts(timestamp_us); pts > last_audio_pts) - { - if (audio_input_buffer) - { - // The audio samples originate from cellRec instead of our render pipeline. - // TODO: This needs to be synchronized with the game somehow if possible. - std::memcpy(buffer_external.block.data(), audio_input_buffer.get_ptr(), buffer_external.block.size()); - buffer_external.pts = pts; - got_new_samples = true; - } - - last_audio_pts = pts; - } - } - - if (sink && use_internal_audio) - { - // The audio samples originate from cellAudio and are stored in a ringbuffer. - utils::video_sink::encoder_sample sample = sink->get_sample(); - - if (!sample.data.empty() && sample.channels >= channels && sample.sample_count >= CELL_REC_AUDIO_BLOCK_SAMPLES) - { - s64 pts = encoder->get_audio_pts(sample.timestamp_us); - - // Each encoder_sample can have more than one block - for (u32 i = 0; i < sample.sample_count; i += CELL_REC_AUDIO_BLOCK_SAMPLES) - { - if (pts > last_audio_pts) + if (audio_input_buffer) { - const f32* src = reinterpret_cast(&sample.data[i * sample.channels * sizeof(f32)]); - - // Copy the new samples to the internal buffer if we need them for volume mixing below. - // Otherwise copy them directly to the external buffer which is used for output later. - audio_block& dst_buffer = got_new_samples ? buffer_internal : buffer_external; - - if (sample.channels > channels) - { - // Downmix channels - AudioBackend::downmix(CELL_REC_AUDIO_BLOCK_SAMPLES * sample.channels, sample.channels, audio_channel_layout::stereo, src, reinterpret_cast(dst_buffer.block.data())); - } - else - { - std::memcpy(dst_buffer.block.data(), src, audio_block::block_size); - } - - // Mix external and internal audio with param.audio_input_mix_vol if we already got samples from cellRec. - if (got_new_samples) - { - const float volume = std::clamp(param.audio_input_mix_vol / 100.0f, 0.0f, 1.0f); - const f32* src = reinterpret_cast(buffer_internal.block.data()); - f32* dst = reinterpret_cast(buffer_external.block.data()); - - for (u32 sample = 0; sample < (CELL_REC_AUDIO_BLOCK_SAMPLES * channels); sample++) - { - *dst = std::clamp(*dst + (*src++ * volume), -1.0f, 1.0f); - ++dst; - } - } - - last_audio_pts = std::max(pts, last_audio_pts); // The cellAudio pts may be older than the pts from cellRec - buffer_external.pts = last_audio_pts; + // The audio samples originate from cellRec instead of our render pipeline. + // TODO: This needs to be synchronized with the game somehow if possible. + std::memcpy(buffer_external.block.data(), audio_input_buffer.get_ptr(), buffer_external.block.size()); + buffer_external.pts = pts; got_new_samples = true; } - // We only take the first sample for simplicity for now - break; - - // Increase pts for each sample block - //pts++; + last_audio_pts = pts; } } - } - if (got_new_samples) - { - if (use_ring_buffer) + if (sink && use_internal_audio) { - // Copy new sample to ringbuffer - audio_ringbuffer[next_audio_ring_pos()] = buffer_external; - audio_ring_block_count++; + // The audio samples originate from cellAudio and are stored in a ringbuffer. + utils::video_sink::encoder_sample sample = sink->get_sample(); + + if (!sample.data.empty() && sample.channels >= channels && sample.sample_count >= CELL_REC_AUDIO_BLOCK_SAMPLES) + { + s64 pts = encoder->get_audio_pts(sample.timestamp_us); + + // Each encoder_sample can have more than one block + for (u32 i = 0; i < sample.sample_count; i += CELL_REC_AUDIO_BLOCK_SAMPLES) + { + if (pts > last_audio_pts) + { + const f32* src = reinterpret_cast(&sample.data[i * sample.channels * sizeof(f32)]); + + // Copy the new samples to the internal buffer if we need them for volume mixing below. + // Otherwise copy them directly to the external buffer which is used for output later. + audio_block& dst_buffer = got_new_samples ? buffer_internal : buffer_external; + + if (sample.channels > channels) + { + // Downmix channels + AudioBackend::downmix(CELL_REC_AUDIO_BLOCK_SAMPLES * sample.channels, sample.channels, audio_channel_layout::stereo, src, reinterpret_cast(dst_buffer.block.data())); + } + else + { + std::memcpy(dst_buffer.block.data(), src, audio_block::block_size); + } + + // Mix external and internal audio with param.audio_input_mix_vol if we already got samples from cellRec. + if (got_new_samples) + { + const float volume = std::clamp(param.audio_input_mix_vol / 100.0f, 0.0f, 1.0f); + const f32* src = reinterpret_cast(buffer_internal.block.data()); + f32* dst = reinterpret_cast(buffer_external.block.data()); + + for (u32 sample = 0; sample < (CELL_REC_AUDIO_BLOCK_SAMPLES * channels); sample++) + { + *dst = std::clamp(*dst + (*src++ * volume), -1.0f, 1.0f); + ++dst; + } + } + + last_audio_pts = std::max(pts, last_audio_pts); // The cellAudio pts may be older than the pts from cellRec + buffer_external.pts = last_audio_pts; + got_new_samples = true; + } + + // We only take the first sample for simplicity for now + break; + + // Increase pts for each sample block + // pts++; + } + } } - else + + if (got_new_samples) { - // Push new sample to encoder - encoder->add_audio_samples(buffer_external.block.data(), CELL_REC_AUDIO_BLOCK_SAMPLES, channels, timestamp_us); + if (use_ring_buffer) + { + // Copy new sample to ringbuffer + audio_ringbuffer[next_audio_ring_pos()] = buffer_external; + audio_ring_block_count++; + } + else + { + // Push new sample to encoder + encoder->add_audio_samples(buffer_external.block.data(), CELL_REC_AUDIO_BLOCK_SAMPLES, channels, timestamp_us); + } } + + // Update recording time + recording_time_total = encoder->get_timestamp_ms(encoder->last_video_pts()); + + thread_ctrl::wait_for(1); } - - // Update recording time - recording_time_total = encoder->get_timestamp_ms(encoder->last_video_pts()); - - thread_ctrl::wait_for(1); - } - }); + }); } void rec_info::pause_video_provider() @@ -937,7 +939,8 @@ error_code cellRecOpen(vm::cptr pDirName, vm::cptr pFileName, vm::cp for (s32 i = 0; i < pParam->numOfOpt; i++) { - if (i > 0) options += ", "; + if (i > 0) + options += ", "; fmt::append(options, "%d", pParam->pOpt[i].option); } @@ -1237,13 +1240,13 @@ error_code cellRecOpen(vm::cptr pDirName, vm::cptr pFileName, vm::cp return CELL_REC_ERROR_INVALID_VALUE; } - //if (spurs_param) + // if (spurs_param) //{ // if (error_code error = cellSpurs_0xD9A9C592(); // { // return error; // } - //} + // } } if (!cb) @@ -1303,11 +1306,11 @@ error_code cellRecOpen(vm::cptr pDirName, vm::cptr pFileName, vm::cp rec.encoder->set_output_format(rec.output_format); sysutil_register_cb([&rec](ppu_thread& ppu) -> s32 - { - rec.state = rec_state::stopped; - rec.cb(ppu, CELL_REC_STATUS_OPEN, CELL_OK, rec.cbUserData); - return CELL_OK; - }); + { + rec.state = rec_state::stopped; + rec.cb(ppu, CELL_REC_STATUS_OPEN, CELL_OK, rec.cbUserData); + return CELL_OK; + }); return CELL_OK; } @@ -1324,87 +1327,87 @@ error_code cellRecClose(s32 isDiscard) } sysutil_register_cb([=, &rec](ppu_thread& ppu) -> s32 - { - bool is_valid_range = true; - - if (isDiscard) { - // No need to flush the encoder - rec.stop_video_provider(false); - rec.encoder->stop(false); + bool is_valid_range = true; - if (rec.sink) + if (isDiscard) { - rec.sink->stop(true); - } + // No need to flush the encoder + rec.stop_video_provider(false); + rec.encoder->stop(false); - if (fs::is_file(rec.param.filename)) - { - cellRec.warning("cellRecClose: removing discarded recording '%s'", rec.param.filename); - - if (!fs::remove_file(rec.param.filename)) + if (rec.sink) { - cellRec.error("cellRecClose: failed to remove recording '%s'", rec.param.filename); + rec.sink->stop(true); + } + + if (fs::is_file(rec.param.filename)) + { + cellRec.warning("cellRecClose: removing discarded recording '%s'", rec.param.filename); + + if (!fs::remove_file(rec.param.filename)) + { + cellRec.error("cellRecClose: failed to remove recording '%s'", rec.param.filename); + } } } - } - else - { - // Flush to make sure we encode all remaining frames - rec.stop_video_provider(true); - rec.encoder->stop(true); - rec.recording_time_total = rec.encoder->get_timestamp_ms(rec.encoder->last_video_pts()); - - if (rec.sink) + else { - rec.sink->stop(true); + // Flush to make sure we encode all remaining frames + rec.stop_video_provider(true); + rec.encoder->stop(true); + rec.recording_time_total = rec.encoder->get_timestamp_ms(rec.encoder->last_video_pts()); + + if (rec.sink) + { + rec.sink->stop(true); + } + + const s64 start_pts = rec.encoder->get_pts(rec.param.scene_metadata.start_time); + const s64 end_pts = rec.encoder->get_pts(rec.param.scene_metadata.end_time); + const s64 last_pts = rec.encoder->last_video_pts(); + + is_valid_range = start_pts >= 0 && end_pts <= last_pts; } - const s64 start_pts = rec.encoder->get_pts(rec.param.scene_metadata.start_time); - const s64 end_pts = rec.encoder->get_pts(rec.param.scene_metadata.end_time); - const s64 last_pts = rec.encoder->last_video_pts(); + vm::dealloc(rec.video_input_buffer.addr(), vm::main); + vm::dealloc(rec.audio_input_buffer.addr(), vm::main); - is_valid_range = start_pts >= 0 && end_pts <= last_pts; - } - - vm::dealloc(rec.video_input_buffer.addr(), vm::main); - vm::dealloc(rec.audio_input_buffer.addr(), vm::main); - - // Release the video sink if it was used - if (rec.param.use_internal_video() || rec.param.use_internal_audio()) - { - const recording_mode old_mode = g_recording_mode.exchange(recording_mode::stopped); - - if (old_mode == recording_mode::rpcs3) + // Release the video sink if it was used + if (rec.param.use_internal_video() || rec.param.use_internal_audio()) { - cellRec.error("cellRecClose: Unexpected recording mode %s found while stopping video capture.", old_mode); + const recording_mode old_mode = g_recording_mode.exchange(recording_mode::stopped); + + if (old_mode == recording_mode::rpcs3) + { + cellRec.error("cellRecClose: Unexpected recording mode %s found while stopping video capture.", old_mode); + } + + utils::video_provider& video_provider = g_fxo->get(); + + if (!video_provider.set_video_sink(nullptr, recording_mode::cell)) + { + cellRec.error("cellRecClose failed to release video sink"); + } } - utils::video_provider& video_provider = g_fxo->get(); + rec.param = {}; + rec.encoder.reset(); + rec.sink.reset(); + rec.audio_ringbuffer.clear(); + rec.video_ringbuffer.clear(); + rec.state = rec_state::closed; - if (!video_provider.set_video_sink(nullptr, recording_mode::cell)) + if (is_valid_range) { - cellRec.error("cellRecClose failed to release video sink"); + rec.cb(ppu, CELL_REC_STATUS_CLOSE, CELL_OK, rec.cbUserData); } - } - - rec.param = {}; - rec.encoder.reset(); - rec.sink.reset(); - rec.audio_ringbuffer.clear(); - rec.video_ringbuffer.clear(); - rec.state = rec_state::closed; - - if (is_valid_range) - { - rec.cb(ppu, CELL_REC_STATUS_CLOSE, CELL_OK, rec.cbUserData); - } - else - { - rec.cb(ppu, CELL_REC_STATUS_ERR, CELL_REC_ERROR_FILE_NO_DATA, rec.cbUserData); - } - return CELL_OK; - }); + else + { + rec.cb(ppu, CELL_REC_STATUS_ERR, CELL_REC_ERROR_FILE_NO_DATA, rec.cbUserData); + } + return CELL_OK; + }); return CELL_OK; } @@ -1421,24 +1424,24 @@ error_code cellRecStop() } sysutil_register_cb([&rec](ppu_thread& ppu) -> s32 - { - // cellRecStop actually just pauses the recording - rec.pause_video_provider(); - - if (rec.sink) { - rec.sink->pause(true); - } + // cellRecStop actually just pauses the recording + rec.pause_video_provider(); - ensure(!!rec.encoder); - rec.encoder->pause(true); + if (rec.sink) + { + rec.sink->pause(true); + } - rec.recording_time_total = rec.encoder->get_timestamp_ms(rec.encoder->last_video_pts()); - rec.state = rec_state::stopped; + ensure(!!rec.encoder); + rec.encoder->pause(true); - rec.cb(ppu, CELL_REC_STATUS_STOP, CELL_OK, rec.cbUserData); - return CELL_OK; - }); + rec.recording_time_total = rec.encoder->get_timestamp_ms(rec.encoder->last_video_pts()); + rec.state = rec_state::stopped; + + rec.cb(ppu, CELL_REC_STATUS_STOP, CELL_OK, rec.cbUserData); + return CELL_OK; + }); return CELL_OK; } @@ -1455,54 +1458,54 @@ error_code cellRecStart() } sysutil_register_cb([&rec](ppu_thread& ppu) -> s32 - { - // Start/resume the recording - ensure(!!rec.encoder); - - if (rec.param.ring_sec == 0) { - rec.encoder->encode(); - } + // Start/resume the recording + ensure(!!rec.encoder); - // Setup a video sink if it is needed - if (rec.param.use_internal_video() || rec.param.use_internal_audio()) - { - utils::video_provider& video_provider = g_fxo->get(); - - if (rec.sink && !video_provider.set_video_sink(rec.sink, recording_mode::cell)) + if (rec.param.ring_sec == 0) { - cellRec.error("Failed to set video sink"); - rec.cb(ppu, CELL_REC_STATUS_ERR, CELL_REC_ERROR_FATAL, rec.cbUserData); - return CELL_OK; + rec.encoder->encode(); } - // Force rsx recording - g_recording_mode = recording_mode::cell; - } - else - { - // Force stop rsx recording - g_recording_mode = recording_mode::stopped; - } + // Setup a video sink if it is needed + if (rec.param.use_internal_video() || rec.param.use_internal_audio()) + { + utils::video_provider& video_provider = g_fxo->get(); - rec.start_video_provider(); + if (rec.sink && !video_provider.set_video_sink(rec.sink, recording_mode::cell)) + { + cellRec.error("Failed to set video sink"); + rec.cb(ppu, CELL_REC_STATUS_ERR, CELL_REC_ERROR_FATAL, rec.cbUserData); + return CELL_OK; + } - if (rec.sink) - { - rec.sink->resume(); - } + // Force rsx recording + g_recording_mode = recording_mode::cell; + } + else + { + // Force stop rsx recording + g_recording_mode = recording_mode::stopped; + } - if (rec.encoder->has_error) - { - rec.cb(ppu, CELL_REC_STATUS_ERR, CELL_REC_ERROR_FILE_OPEN, rec.cbUserData); - } - else - { - rec.state = rec_state::started; - rec.cb(ppu, CELL_REC_STATUS_START, CELL_OK, rec.cbUserData); - } - return CELL_OK; - }); + rec.start_video_provider(); + + if (rec.sink) + { + rec.sink->resume(); + } + + if (rec.encoder->has_error) + { + rec.cb(ppu, CELL_REC_STATUS_ERR, CELL_REC_ERROR_FILE_OPEN, rec.cbUserData); + } + else + { + rec.state = rec_state::started; + rec.cb(ppu, CELL_REC_STATUS_START, CELL_OK, rec.cbUserData); + } + return CELL_OK; + }); return CELL_OK; } @@ -1726,7 +1729,7 @@ void cellRecGetInfo(s32 info, vm::ptr pValue) if (rec.param.spurs_param.pSpurs) { // TODO - //cellSpurs_0xE279681F(); + // cellSpurs_0xE279681F(); } *pValue = 0xffffffff; break; @@ -1788,7 +1791,7 @@ error_code cellRecSetInfo(s32 setInfo, u64 value) } rec.param.movie_metadata = {}; - rec.param.movie_metadata.game_title = std::string{movie_metadata->gameTitle.get_ptr()}; + rec.param.movie_metadata.game_title = std::string{movie_metadata->gameTitle.get_ptr()}; rec.param.movie_metadata.movie_title = std::string{movie_metadata->movieTitle.get_ptr()}; if (movie_metadata->description) @@ -1858,14 +1861,13 @@ error_code cellRecSetInfo(s32 setInfo, u64 value) return CELL_OK; } - DECLARE(ppu_module_manager::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); -}); + { + 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/rpcs3/Emu/Cell/Modules/cellRec.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellRec.h index 9e8820120..0f80dc1ab 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellRec.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellRec.h @@ -3,22 +3,22 @@ enum CellRecError : u32 { CELL_REC_ERROR_OUT_OF_MEMORY = 0x8002c501, - CELL_REC_ERROR_FATAL = 0x8002c502, + CELL_REC_ERROR_FATAL = 0x8002c502, CELL_REC_ERROR_INVALID_VALUE = 0x8002c503, - CELL_REC_ERROR_FILE_OPEN = 0x8002c504, - CELL_REC_ERROR_FILE_WRITE = 0x8002c505, + CELL_REC_ERROR_FILE_OPEN = 0x8002c504, + CELL_REC_ERROR_FILE_WRITE = 0x8002c505, CELL_REC_ERROR_INVALID_STATE = 0x8002c506, - CELL_REC_ERROR_FILE_NO_DATA = 0x8002c507 + CELL_REC_ERROR_FILE_NO_DATA = 0x8002c507 }; enum { CELL_REC_STATUS_UNLOAD = 0, - CELL_REC_STATUS_OPEN = 1, - CELL_REC_STATUS_START = 2, - CELL_REC_STATUS_STOP = 3, - CELL_REC_STATUS_CLOSE = 4, - CELL_REC_STATUS_ERR = 10 + CELL_REC_STATUS_OPEN = 1, + CELL_REC_STATUS_START = 2, + CELL_REC_STATUS_STOP = 3, + CELL_REC_STATUS_CLOSE = 4, + CELL_REC_STATUS_ERR = 10 }; enum @@ -34,34 +34,34 @@ enum CELL_REC_PARAM_PPU_THREAD_PRIORITY_DEFAULT = 400, CELL_REC_PARAM_SPU_THREAD_PRIORITY_DEFAULT = 60, - CELL_REC_PARAM_CAPTURE_PRIORITY_HIGHEST = 0, + CELL_REC_PARAM_CAPTURE_PRIORITY_HIGHEST = 0, CELL_REC_PARAM_CAPTURE_PRIORITY_EXCEPT_NOTIFICATION = 1, - CELL_REC_PARAM_CAPTURE_PRIORITY_GAME_SCREEN = 2, + CELL_REC_PARAM_CAPTURE_PRIORITY_GAME_SCREEN = 2, CELL_REC_PARAM_USE_SYSTEM_SPU_DISABLE = 0, - CELL_REC_PARAM_USE_SYSTEM_SPU_ENABLE = 1, + CELL_REC_PARAM_USE_SYSTEM_SPU_ENABLE = 1, CELL_REC_PARAM_XMB_BGM_DISABLE = 0, - CELL_REC_PARAM_XMB_BGM_ENABLE = 1, + CELL_REC_PARAM_XMB_BGM_ENABLE = 1, CELL_REC_PARAM_MPEG4_FAST_ENCODE_DISABLE = 0, - CELL_REC_PARAM_MPEG4_FAST_ENCODE_ENABLE = 1, + CELL_REC_PARAM_MPEG4_FAST_ENCODE_ENABLE = 1, - CELL_REC_PARAM_VIDEO_INPUT_DISABLE = 0, - CELL_REC_PARAM_VIDEO_INPUT_ARGB_4_3 = 1, - CELL_REC_PARAM_VIDEO_INPUT_ARGB_16_9 = 2, - CELL_REC_PARAM_VIDEO_INPUT_RGBA_4_3 = 3, - CELL_REC_PARAM_VIDEO_INPUT_RGBA_16_9 = 4, + CELL_REC_PARAM_VIDEO_INPUT_DISABLE = 0, + CELL_REC_PARAM_VIDEO_INPUT_ARGB_4_3 = 1, + CELL_REC_PARAM_VIDEO_INPUT_ARGB_16_9 = 2, + CELL_REC_PARAM_VIDEO_INPUT_RGBA_4_3 = 3, + CELL_REC_PARAM_VIDEO_INPUT_RGBA_16_9 = 4, CELL_REC_PARAM_VIDEO_INPUT_YUV420PLANAR_16_9 = 5, CELL_REC_PARAM_AUDIO_INPUT_DISABLE = 0, - CELL_REC_PARAM_AUDIO_INPUT_ENABLE = 1, + CELL_REC_PARAM_AUDIO_INPUT_ENABLE = 1, CELL_REC_PARAM_AUDIO_INPUT_MIX_VOL_MIN = 0, CELL_REC_PARAM_AUDIO_INPUT_MIX_VOL_MAX = 100, CELL_REC_PARAM_REDUCE_MEMSIZE_DISABLE = 0, - CELL_REC_PARAM_REDUCE_MEMSIZE_ENABLE = 1, + CELL_REC_PARAM_REDUCE_MEMSIZE_ENABLE = 1, // SMALL = 320x240 (4:3) or 368x208 (16:9) // MIDDLE = 368x272 (4:3) or 480x272 (16:9) @@ -71,60 +71,60 @@ enum // PS3 playable format; all // PSP playable format: MPEG4 + SMALL, AVC + SMALL, AVC + MIDDLE - CELL_REC_PARAM_VIDEO_FMT_MPEG4_SMALL_512K_30FPS = 0x0000, - CELL_REC_PARAM_VIDEO_FMT_MPEG4_SMALL_768K_30FPS = 0x0010, + CELL_REC_PARAM_VIDEO_FMT_MPEG4_SMALL_512K_30FPS = 0x0000, + CELL_REC_PARAM_VIDEO_FMT_MPEG4_SMALL_768K_30FPS = 0x0010, CELL_REC_PARAM_VIDEO_FMT_MPEG4_MIDDLE_512K_30FPS = 0x0100, CELL_REC_PARAM_VIDEO_FMT_MPEG4_MIDDLE_768K_30FPS = 0x0110, - CELL_REC_PARAM_VIDEO_FMT_MPEG4_LARGE_512K_30FPS = 0x0200, - CELL_REC_PARAM_VIDEO_FMT_MPEG4_LARGE_768K_30FPS = 0x0210, + CELL_REC_PARAM_VIDEO_FMT_MPEG4_LARGE_512K_30FPS = 0x0200, + CELL_REC_PARAM_VIDEO_FMT_MPEG4_LARGE_768K_30FPS = 0x0210, CELL_REC_PARAM_VIDEO_FMT_MPEG4_LARGE_1024K_30FPS = 0x0220, CELL_REC_PARAM_VIDEO_FMT_MPEG4_LARGE_1536K_30FPS = 0x0230, CELL_REC_PARAM_VIDEO_FMT_MPEG4_LARGE_2048K_30FPS = 0x0240, - CELL_REC_PARAM_VIDEO_FMT_AVC_MP_SMALL_512K_30FPS = 0x1000, - CELL_REC_PARAM_VIDEO_FMT_AVC_MP_SMALL_768K_30FPS = 0x1010, - CELL_REC_PARAM_VIDEO_FMT_AVC_MP_MIDDLE_512K_30FPS = 0x1100, - CELL_REC_PARAM_VIDEO_FMT_AVC_MP_MIDDLE_768K_30FPS = 0x1110, + CELL_REC_PARAM_VIDEO_FMT_AVC_MP_SMALL_512K_30FPS = 0x1000, + CELL_REC_PARAM_VIDEO_FMT_AVC_MP_SMALL_768K_30FPS = 0x1010, + CELL_REC_PARAM_VIDEO_FMT_AVC_MP_MIDDLE_512K_30FPS = 0x1100, + CELL_REC_PARAM_VIDEO_FMT_AVC_MP_MIDDLE_768K_30FPS = 0x1110, CELL_REC_PARAM_VIDEO_FMT_AVC_MP_MIDDLE_1024K_30FPS = 0x1120, CELL_REC_PARAM_VIDEO_FMT_AVC_MP_MIDDLE_1536K_30FPS = 0x1130, - CELL_REC_PARAM_VIDEO_FMT_AVC_BL_SMALL_512K_30FPS = 0x2000, - CELL_REC_PARAM_VIDEO_FMT_AVC_BL_SMALL_768K_30FPS = 0x2010, - CELL_REC_PARAM_VIDEO_FMT_AVC_BL_MIDDLE_512K_30FPS = 0x2100, - CELL_REC_PARAM_VIDEO_FMT_AVC_BL_MIDDLE_768K_30FPS = 0x2110, + CELL_REC_PARAM_VIDEO_FMT_AVC_BL_SMALL_512K_30FPS = 0x2000, + CELL_REC_PARAM_VIDEO_FMT_AVC_BL_SMALL_768K_30FPS = 0x2010, + CELL_REC_PARAM_VIDEO_FMT_AVC_BL_MIDDLE_512K_30FPS = 0x2100, + CELL_REC_PARAM_VIDEO_FMT_AVC_BL_MIDDLE_768K_30FPS = 0x2110, CELL_REC_PARAM_VIDEO_FMT_AVC_BL_MIDDLE_1024K_30FPS = 0x2120, CELL_REC_PARAM_VIDEO_FMT_AVC_BL_MIDDLE_1536K_30FPS = 0x2130, - CELL_REC_PARAM_VIDEO_FMT_MJPEG_SMALL_5000K_30FPS = 0x3060, + CELL_REC_PARAM_VIDEO_FMT_MJPEG_SMALL_5000K_30FPS = 0x3060, CELL_REC_PARAM_VIDEO_FMT_MJPEG_MIDDLE_5000K_30FPS = 0x3160, CELL_REC_PARAM_VIDEO_FMT_MJPEG_LARGE_11000K_30FPS = 0x3270, CELL_REC_PARAM_VIDEO_FMT_MJPEG_HD720_11000K_30FPS = 0x3670, CELL_REC_PARAM_VIDEO_FMT_MJPEG_HD720_20000K_30FPS = 0x3680, CELL_REC_PARAM_VIDEO_FMT_MJPEG_HD720_25000K_30FPS = 0x3690, - CELL_REC_PARAM_VIDEO_FMT_M4HD_SMALL_768K_30FPS = 0x4010, - CELL_REC_PARAM_VIDEO_FMT_M4HD_MIDDLE_768K_30FPS = 0x4110, - CELL_REC_PARAM_VIDEO_FMT_M4HD_LARGE_1536K_30FPS = 0x4230, - CELL_REC_PARAM_VIDEO_FMT_M4HD_LARGE_2048K_30FPS = 0x4240, - CELL_REC_PARAM_VIDEO_FMT_M4HD_HD720_2048K_30FPS = 0x4640, - CELL_REC_PARAM_VIDEO_FMT_M4HD_HD720_5000K_30FPS = 0x4660, + CELL_REC_PARAM_VIDEO_FMT_M4HD_SMALL_768K_30FPS = 0x4010, + CELL_REC_PARAM_VIDEO_FMT_M4HD_MIDDLE_768K_30FPS = 0x4110, + CELL_REC_PARAM_VIDEO_FMT_M4HD_LARGE_1536K_30FPS = 0x4230, + CELL_REC_PARAM_VIDEO_FMT_M4HD_LARGE_2048K_30FPS = 0x4240, + CELL_REC_PARAM_VIDEO_FMT_M4HD_HD720_2048K_30FPS = 0x4640, + CELL_REC_PARAM_VIDEO_FMT_M4HD_HD720_5000K_30FPS = 0x4660, CELL_REC_PARAM_VIDEO_FMT_M4HD_HD720_11000K_30FPS = 0x4670, - CELL_REC_PARAM_AUDIO_FMT_AAC_96K = 0x0000, - CELL_REC_PARAM_AUDIO_FMT_AAC_128K = 0x0001, - CELL_REC_PARAM_AUDIO_FMT_AAC_64K = 0x0002, + CELL_REC_PARAM_AUDIO_FMT_AAC_96K = 0x0000, + CELL_REC_PARAM_AUDIO_FMT_AAC_128K = 0x0001, + CELL_REC_PARAM_AUDIO_FMT_AAC_64K = 0x0002, CELL_REC_PARAM_AUDIO_FMT_ULAW_384K = 0x1007, CELL_REC_PARAM_AUDIO_FMT_ULAW_768K = 0x1008, - CELL_REC_PARAM_AUDIO_FMT_PCM_384K = 0x2007, - CELL_REC_PARAM_AUDIO_FMT_PCM_768K = 0x2008, + CELL_REC_PARAM_AUDIO_FMT_PCM_384K = 0x2007, + CELL_REC_PARAM_AUDIO_FMT_PCM_768K = 0x2008, CELL_REC_PARAM_AUDIO_FMT_PCM_1536K = 0x2009, - CELL_REC_PARAM_VIDEO_FMT_YOUTUBE = 0x0310, + CELL_REC_PARAM_VIDEO_FMT_YOUTUBE = 0x0310, CELL_REC_PARAM_VIDEO_FMT_YOUTUBE_LARGE = CELL_REC_PARAM_VIDEO_FMT_MPEG4_LARGE_2048K_30FPS, CELL_REC_PARAM_VIDEO_FMT_YOUTUBE_HD720 = CELL_REC_PARAM_VIDEO_FMT_M4HD_HD720_5000K_30FPS, - CELL_REC_PARAM_AUDIO_FMT_YOUTUBE = CELL_REC_PARAM_AUDIO_FMT_AAC_64K, + CELL_REC_PARAM_AUDIO_FMT_YOUTUBE = CELL_REC_PARAM_AUDIO_FMT_AAC_64K, CELL_REC_PARAM_VIDEO_FMT_YOUTUBE_MJPEG = CELL_REC_PARAM_VIDEO_FMT_MJPEG_HD720_11000K_30FPS, CELL_REC_PARAM_AUDIO_FMT_YOUTUBE_MJPEG = CELL_REC_PARAM_AUDIO_FMT_PCM_768K, @@ -134,53 +134,53 @@ enum enum { - CELL_REC_INFO_VIDEO_INPUT_ADDR = 0, - CELL_REC_INFO_VIDEO_INPUT_WIDTH = 1, - CELL_REC_INFO_VIDEO_INPUT_PITCH = 2, - CELL_REC_INFO_VIDEO_INPUT_HEIGHT = 3, - CELL_REC_INFO_AUDIO_INPUT_ADDR = 4, - CELL_REC_INFO_MOVIE_TIME_MSEC = 5, + CELL_REC_INFO_VIDEO_INPUT_ADDR = 0, + CELL_REC_INFO_VIDEO_INPUT_WIDTH = 1, + CELL_REC_INFO_VIDEO_INPUT_PITCH = 2, + CELL_REC_INFO_VIDEO_INPUT_HEIGHT = 3, + CELL_REC_INFO_AUDIO_INPUT_ADDR = 4, + CELL_REC_INFO_MOVIE_TIME_MSEC = 5, CELL_REC_INFO_SPURS_SYSTEMWORKLOAD_ID = 6, }; enum { CELL_REC_SETINFO_MOVIE_START_TIME_MSEC = 100, - CELL_REC_SETINFO_MOVIE_END_TIME_MSEC = 101, - CELL_REC_SETINFO_MOVIE_META = 200, - CELL_REC_SETINFO_SCENE_META = 201, + CELL_REC_SETINFO_MOVIE_END_TIME_MSEC = 101, + CELL_REC_SETINFO_MOVIE_META = 200, + CELL_REC_SETINFO_SCENE_META = 201, - CELL_REC_MOVIE_META_GAME_TITLE_LEN = 128, + CELL_REC_MOVIE_META_GAME_TITLE_LEN = 128, CELL_REC_MOVIE_META_MOVIE_TITLE_LEN = 128, CELL_REC_MOVIE_META_DESCRIPTION_LEN = 384, - CELL_REC_MOVIE_META_USERDATA_LEN = 64, + CELL_REC_MOVIE_META_USERDATA_LEN = 64, - CELL_REC_SCENE_META_TYPE_CHAPTER = 0, + CELL_REC_SCENE_META_TYPE_CHAPTER = 0, CELL_REC_SCENE_META_TYPE_CLIP_HIGHLIGHT = 1, - CELL_REC_SCENE_META_TYPE_CLIP_USER = 2, + CELL_REC_SCENE_META_TYPE_CLIP_USER = 2, CELL_REC_SCENE_META_TITLE_LEN = 128, - CELL_REC_SCENE_META_TAG_NUM = 6, - CELL_REC_SCENE_META_TAG_LEN = 64, + CELL_REC_SCENE_META_TAG_NUM = 6, + CELL_REC_SCENE_META_TAG_LEN = 64, }; enum { CELL_REC_OPTION_PPU_THREAD_PRIORITY = 1, CELL_REC_OPTION_SPU_THREAD_PRIORITY = 2, - CELL_REC_OPTION_CAPTURE_PRIORITY = 3, - CELL_REC_OPTION_USE_SYSTEM_SPU = 4, - CELL_REC_OPTION_FIT_TO_YOUTUBE = 5, - CELL_REC_OPTION_XMB_BGM = 6, - CELL_REC_OPTION_RING_SEC = 7, - CELL_REC_OPTION_MPEG4_FAST_ENCODE = 8, - CELL_REC_OPTION_VIDEO_INPUT = 9, - CELL_REC_OPTION_AUDIO_INPUT = 10, + CELL_REC_OPTION_CAPTURE_PRIORITY = 3, + CELL_REC_OPTION_USE_SYSTEM_SPU = 4, + CELL_REC_OPTION_FIT_TO_YOUTUBE = 5, + CELL_REC_OPTION_XMB_BGM = 6, + CELL_REC_OPTION_RING_SEC = 7, + CELL_REC_OPTION_MPEG4_FAST_ENCODE = 8, + CELL_REC_OPTION_VIDEO_INPUT = 9, + CELL_REC_OPTION_AUDIO_INPUT = 10, CELL_REC_OPTION_AUDIO_INPUT_MIX_VOL = 11, - CELL_REC_OPTION_REDUCE_MEMSIZE = 12, - CELL_REC_OPTION_SHOW_XMB = 13, - CELL_REC_OPTION_METADATA_FILENAME = 14, - CELL_REC_OPTION_SPURS = 15, + CELL_REC_OPTION_REDUCE_MEMSIZE = 12, + CELL_REC_OPTION_SHOW_XMB = 13, + CELL_REC_OPTION_METADATA_FILENAME = 14, + CELL_REC_OPTION_SPURS = 15, }; struct CellRecSpursParam @@ -235,7 +235,7 @@ struct CellRecSceneMetadata be_t type; be_t startTime; be_t endTime; - u8 unk[4]; // NOTE: there seems to be undocumented padding + u8 unk[4]; // NOTE: there seems to be undocumented padding vm::bptr title; be_t tagNum; vm::bpptr tag; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellRemotePlay.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellRemotePlay.cpp index d2c8060a8..cf37b192c 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellRemotePlay.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellRemotePlay.cpp @@ -8,14 +8,14 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellRemotePlayError value) - { - switch (value) { - STR_CASE(CELL_REMOTEPLAY_ERROR_INTERNAL); - } + switch (value) + { + STR_CASE(CELL_REMOTEPLAY_ERROR_INTERNAL); + } - return unknown; - }); + return unknown; + }); } error_code cellRemotePlayGetStatus() @@ -72,15 +72,14 @@ error_code cellRemotePlayBreak() return CELL_OK; } - DECLARE(ppu_module_manager::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); -}); + { + 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/rpcs3/Emu/Cell/Modules/cellRemotePlay.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellRemotePlay.h index 1a15d41d8..824d59cc4 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellRemotePlay.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellRemotePlay.h @@ -7,17 +7,17 @@ enum CellRemotePlayError : u32 enum { - CELL_REMOTEPLAY_STATUS_LOADING = 0x00000000, - CELL_REMOTEPLAY_STATUS_WAIT = 0x00000001, - CELL_REMOTEPLAY_STATUS_RUNNING = 0x00000002, - CELL_REMOTEPLAY_STATUS_UNLOADING = 0x00000003, + CELL_REMOTEPLAY_STATUS_LOADING = 0x00000000, + CELL_REMOTEPLAY_STATUS_WAIT = 0x00000001, + CELL_REMOTEPLAY_STATUS_RUNNING = 0x00000002, + CELL_REMOTEPLAY_STATUS_UNLOADING = 0x00000003, CELL_REMOTEPLAY_STATUS_FATALERROR = 0x00000004, - CELL_REMOTEPLAY_STATUS_PREMOEND = 0x00000005, + CELL_REMOTEPLAY_STATUS_PREMOEND = 0x00000005, }; enum { - CELL_REMOTEPLAY_M4V_MEMORY_CONTAINER_SIZE = 8 * 1024 * 1024, - CELL_REMOTEPLAY_AVC_MEMORY_CONTAINER_SIZE = 10 * 1024 * 1024, + CELL_REMOTEPLAY_M4V_MEMORY_CONTAINER_SIZE = 8 * 1024 * 1024, + CELL_REMOTEPLAY_AVC_MEMORY_CONTAINER_SIZE = 10 * 1024 * 1024, CELL_REMOTEPLAY_480P_MEMORY_CONTAINER_SIZE = 10 * 1024 * 1024, }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellResc.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellResc.cpp index 065039b7f..893a11964 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellResc.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellResc.cpp @@ -13,21 +13,21 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellRescError value) - { - switch (value) { - STR_CASE(CELL_RESC_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_RESC_ERROR_REINITIALIZED); - STR_CASE(CELL_RESC_ERROR_BAD_ALIGNMENT); - STR_CASE(CELL_RESC_ERROR_BAD_ARGUMENT); - STR_CASE(CELL_RESC_ERROR_LESS_MEMORY); - STR_CASE(CELL_RESC_ERROR_GCM_FLIP_QUE_FULL); - STR_CASE(CELL_RESC_ERROR_BAD_COMBINATION); - STR_CASE(CELL_RESC_ERROR_x308); - } + switch (value) + { + STR_CASE(CELL_RESC_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_RESC_ERROR_REINITIALIZED); + STR_CASE(CELL_RESC_ERROR_BAD_ALIGNMENT); + STR_CASE(CELL_RESC_ERROR_BAD_ARGUMENT); + STR_CASE(CELL_RESC_ERROR_LESS_MEMORY); + STR_CASE(CELL_RESC_ERROR_GCM_FLIP_QUE_FULL); + STR_CASE(CELL_RESC_ERROR_BAD_COMBINATION); + STR_CASE(CELL_RESC_ERROR_x308); + } - return unknown; - }); + return unknown; + }); } error_code cellRescInit(vm::cptr initConfig) @@ -47,15 +47,14 @@ error_code cellRescInit(vm::cptr initConfig) } resc_manager.config = - { - initConfig->size, - initConfig->resourcePolicy, - initConfig->supportModes, - initConfig->ratioMode, - initConfig->palTemporalMode, - initConfig->interlaceMode, - initConfig->flipMode - }; + { + initConfig->size, + initConfig->resourcePolicy, + initConfig->supportModes, + initConfig->ratioMode, + initConfig->palTemporalMode, + initConfig->interlaceMode, + initConfig->flipMode}; resc_manager.is_initialized = true; return CELL_OK; @@ -118,7 +117,7 @@ error_code cellRescSetDisplayMode(u32 bufferMode) if (bufferMode == CELL_RESC_720x576) { - const u32 pal_mode = resc_manager.config.pal_temporal_mode; + const u32 pal_mode = resc_manager.config.pal_temporal_mode; const u32 flip_mode = resc_manager.config.flip_mode; // Check if palTemporalMode is any INTERPOLATE mode or CELL_RESC_PAL_60_DROP @@ -193,25 +192,25 @@ error_code cellRescGetBufferSize(vm::ptr colorBuffers, vm::ptr vertexA return CELL_RESC_ERROR_NOT_INITIALIZED; } - //if (something) + // if (something) //{ // return CELL_RESC_ERROR_x308; - //} + // } - //if (colorBuffers) + // if (colorBuffers) //{ // colorBuffers = something - //} + // } - //if (vertexArray) + // if (vertexArray) //{ // vertexArray = something - //} + // } - //if (fragmentShader) + // if (fragmentShader) //{ // fragmentShader = something - //} + // } return CELL_OK; } @@ -382,29 +381,28 @@ error_code cellRescCreateInterlaceTable(vm::ptr ea_addr, f32 srcH, CellRes return CELL_OK; } - DECLARE(ppu_module_manager::cellResc)("cellResc", []() -{ - REG_FUNC(cellResc, cellRescSetConvertAndFlip); - REG_FUNC(cellResc, cellRescSetWaitFlip); - REG_FUNC(cellResc, cellRescSetFlipHandler); - REG_FUNC(cellResc, cellRescGcmSurface2RescSrc); - REG_FUNC(cellResc, cellRescGetNumColorBuffers); - REG_FUNC(cellResc, cellRescSetDsts); - REG_FUNC(cellResc, cellRescResetFlipStatus); - REG_FUNC(cellResc, cellRescSetPalInterpolateDropFlexRatio); - REG_FUNC(cellResc, cellRescGetRegisterCount); - REG_FUNC(cellResc, cellRescAdjustAspectRatio); - REG_FUNC(cellResc, cellRescSetDisplayMode); - REG_FUNC(cellResc, cellRescExit); - REG_FUNC(cellResc, cellRescInit); - REG_FUNC(cellResc, cellRescGetBufferSize); - REG_FUNC(cellResc, cellRescGetLastFlipTime); - REG_FUNC(cellResc, cellRescSetSrc); - REG_FUNC(cellResc, cellRescSetRegisterCount); - REG_FUNC(cellResc, cellRescSetBufferAddress); - REG_FUNC(cellResc, cellRescGetFlipStatus); - REG_FUNC(cellResc, cellRescVideoOutResolutionId2RescBufferMode); - REG_FUNC(cellResc, cellRescSetVBlankHandler); - REG_FUNC(cellResc, cellRescCreateInterlaceTable); -}); + { + REG_FUNC(cellResc, cellRescSetConvertAndFlip); + REG_FUNC(cellResc, cellRescSetWaitFlip); + REG_FUNC(cellResc, cellRescSetFlipHandler); + REG_FUNC(cellResc, cellRescGcmSurface2RescSrc); + REG_FUNC(cellResc, cellRescGetNumColorBuffers); + REG_FUNC(cellResc, cellRescSetDsts); + REG_FUNC(cellResc, cellRescResetFlipStatus); + REG_FUNC(cellResc, cellRescSetPalInterpolateDropFlexRatio); + REG_FUNC(cellResc, cellRescGetRegisterCount); + REG_FUNC(cellResc, cellRescAdjustAspectRatio); + REG_FUNC(cellResc, cellRescSetDisplayMode); + REG_FUNC(cellResc, cellRescExit); + REG_FUNC(cellResc, cellRescInit); + REG_FUNC(cellResc, cellRescGetBufferSize); + REG_FUNC(cellResc, cellRescGetLastFlipTime); + REG_FUNC(cellResc, cellRescSetSrc); + REG_FUNC(cellResc, cellRescSetRegisterCount); + REG_FUNC(cellResc, cellRescSetBufferAddress); + REG_FUNC(cellResc, cellRescGetFlipStatus); + REG_FUNC(cellResc, cellRescVideoOutResolutionId2RescBufferMode); + REG_FUNC(cellResc, cellRescSetVBlankHandler); + REG_FUNC(cellResc, cellRescCreateInterlaceTable); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellResc.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellResc.h index b25f3fca5..253ea2308 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellResc.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellResc.h @@ -2,14 +2,14 @@ enum CellRescError : u32 { - CELL_RESC_ERROR_NOT_INITIALIZED = 0x80210301, - CELL_RESC_ERROR_REINITIALIZED = 0x80210302, - CELL_RESC_ERROR_BAD_ALIGNMENT = 0x80210303, - CELL_RESC_ERROR_BAD_ARGUMENT = 0x80210304, - CELL_RESC_ERROR_LESS_MEMORY = 0x80210305, + CELL_RESC_ERROR_NOT_INITIALIZED = 0x80210301, + CELL_RESC_ERROR_REINITIALIZED = 0x80210302, + CELL_RESC_ERROR_BAD_ALIGNMENT = 0x80210303, + CELL_RESC_ERROR_BAD_ARGUMENT = 0x80210304, + CELL_RESC_ERROR_LESS_MEMORY = 0x80210305, CELL_RESC_ERROR_GCM_FLIP_QUE_FULL = 0x80210306, - CELL_RESC_ERROR_BAD_COMBINATION = 0x80210307, - CELL_RESC_ERROR_x308 = 0x80210308, // TODO: find proper name + CELL_RESC_ERROR_BAD_COMBINATION = 0x80210307, + CELL_RESC_ERROR_x308 = 0x80210308, // TODO: find proper name }; enum @@ -26,56 +26,56 @@ enum enum CellRescBufferMode { - CELL_RESC_720x480 = 0x1, - CELL_RESC_720x576 = 0x2, - CELL_RESC_1280x720 = 0x4, + CELL_RESC_720x480 = 0x1, + CELL_RESC_720x576 = 0x2, + CELL_RESC_1280x720 = 0x4, CELL_RESC_1920x1080 = 0x8, }; enum CellRescPalTemporalMode { - CELL_RESC_PAL_50 = 0, - CELL_RESC_PAL_60_DROP = 1, - CELL_RESC_PAL_60_INTERPOLATE = 2, - CELL_RESC_PAL_60_INTERPOLATE_30_DROP = 3, - CELL_RESC_PAL_60_INTERPOLATE_DROP_FLEXIBLE = 4, - CELL_RESC_PAL_60_FOR_HSYNC = 5, + CELL_RESC_PAL_50 = 0, + CELL_RESC_PAL_60_DROP = 1, + CELL_RESC_PAL_60_INTERPOLATE = 2, + CELL_RESC_PAL_60_INTERPOLATE_30_DROP = 3, + CELL_RESC_PAL_60_INTERPOLATE_DROP_FLEXIBLE = 4, + CELL_RESC_PAL_60_FOR_HSYNC = 5, }; enum CellRescRatioConvertMode { - CELL_RESC_FULLSCREEN = 0, - CELL_RESC_LETTERBOX = 1, - CELL_RESC_PANSCAN = 2, + CELL_RESC_FULLSCREEN = 0, + CELL_RESC_LETTERBOX = 1, + CELL_RESC_PANSCAN = 2, }; enum CellRescFlipMode { - CELL_RESC_DISPLAY_VSYNC = 0, - CELL_RESC_DISPLAY_HSYNC = 1, + CELL_RESC_DISPLAY_VSYNC = 0, + CELL_RESC_DISPLAY_HSYNC = 1, }; enum CellRescDstFormat { - CELL_RESC_SURFACE_A8R8G8B8 = 8, // == CELL_GCM_SURFACE_A8R8G8B8 + CELL_RESC_SURFACE_A8R8G8B8 = 8, // == CELL_GCM_SURFACE_A8R8G8B8 CELL_RESC_SURFACE_F_W16Z16Y16X16 = 11, // == CELL_GCM_SURFACE_F_W16Z16Y16X16 }; enum CellRescResourcePolicy { - CELL_RESC_CONSTANT_VRAM = 0x0, - CELL_RESC_MINIMUM_VRAM = 0x1, - CELL_RESC_CONSTANT_GPU_LOAD = 0x0, - CELL_RESC_MINIMUM_GPU_LOAD = 0x2, + CELL_RESC_CONSTANT_VRAM = 0x0, + CELL_RESC_MINIMUM_VRAM = 0x1, + CELL_RESC_CONSTANT_GPU_LOAD = 0x0, + CELL_RESC_MINIMUM_GPU_LOAD = 0x2, }; enum CellRescConvolutionFilterMode { - CELL_RESC_NORMAL_BILINEAR = 0, - CELL_RESC_INTERLACE_FILTER = 1, - CELL_RESC_3X3_GAUSSIAN = 2, - CELL_RESC_2X3_QUINCUNX = 3, - CELL_RESC_2X3_QUINCUNX_ALT = 4, + CELL_RESC_NORMAL_BILINEAR = 0, + CELL_RESC_INTERLACE_FILTER = 1, + CELL_RESC_3X3_GAUSSIAN = 2, + CELL_RESC_2X3_QUINCUNX = 3, + CELL_RESC_2X3_QUINCUNX_ALT = 4, }; struct CellRescDsts diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellRtc.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellRtc.cpp index fb92dd6f2..c34a0e6d7 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellRtc.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellRtc.cpp @@ -13,27 +13,27 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_RTC_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_RTC_ERROR_INVALID_POINTER); - STR_CASE(CELL_RTC_ERROR_INVALID_VALUE); - STR_CASE(CELL_RTC_ERROR_INVALID_ARG); - STR_CASE(CELL_RTC_ERROR_NOT_SUPPORTED); - STR_CASE(CELL_RTC_ERROR_NO_CLOCK); - STR_CASE(CELL_RTC_ERROR_BAD_PARSE); - STR_CASE(CELL_RTC_ERROR_INVALID_YEAR); - STR_CASE(CELL_RTC_ERROR_INVALID_MONTH); - STR_CASE(CELL_RTC_ERROR_INVALID_DAY); - STR_CASE(CELL_RTC_ERROR_INVALID_HOUR); - STR_CASE(CELL_RTC_ERROR_INVALID_MINUTE); - STR_CASE(CELL_RTC_ERROR_INVALID_SECOND); - STR_CASE(CELL_RTC_ERROR_INVALID_MICROSECOND); - } + switch (error) + { + STR_CASE(CELL_RTC_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_RTC_ERROR_INVALID_POINTER); + STR_CASE(CELL_RTC_ERROR_INVALID_VALUE); + STR_CASE(CELL_RTC_ERROR_INVALID_ARG); + STR_CASE(CELL_RTC_ERROR_NOT_SUPPORTED); + STR_CASE(CELL_RTC_ERROR_NO_CLOCK); + STR_CASE(CELL_RTC_ERROR_BAD_PARSE); + STR_CASE(CELL_RTC_ERROR_INVALID_YEAR); + STR_CASE(CELL_RTC_ERROR_INVALID_MONTH); + STR_CASE(CELL_RTC_ERROR_INVALID_DAY); + STR_CASE(CELL_RTC_ERROR_INVALID_HOUR); + STR_CASE(CELL_RTC_ERROR_INVALID_MINUTE); + STR_CASE(CELL_RTC_ERROR_INVALID_SECOND); + STR_CASE(CELL_RTC_ERROR_INVALID_MICROSECOND); + } - return unknown; - }); + return unknown; + }); } static inline char ascii(u8 num) @@ -208,16 +208,16 @@ error_code cellRtcFormatRfc2822(ppu_thread& ppu, vm::ptr pszDateTime, vm:: pszDateTime[7] = ' '; // month name - pszDateTime[8] = std::toupper(MONTH_NAMES[date_time->month - 1][0]); - pszDateTime[9] = MONTH_NAMES[date_time->month - 1][1]; - pszDateTime[10] = MONTH_NAMES[date_time->month - 1][2]; + pszDateTime[8] = std::toupper(MONTH_NAMES[date_time->month - 1][0]); + pszDateTime[9] = MONTH_NAMES[date_time->month - 1][1]; + pszDateTime[10] = MONTH_NAMES[date_time->month - 1][2]; pszDateTime[0xb] = ' '; // year - pszDateTime[0xc] = ascii(date_time->year / 1000); - pszDateTime[0xd] = ascii(date_time->year / 100 % 10); - pszDateTime[0xe] = ascii(date_time->year / 10 % 10); - pszDateTime[0xf] = ascii(date_time->year % 10); + pszDateTime[0xc] = ascii(date_time->year / 1000); + pszDateTime[0xd] = ascii(date_time->year / 100 % 10); + pszDateTime[0xe] = ascii(date_time->year / 10 % 10); + pszDateTime[0xf] = ascii(date_time->year % 10); pszDateTime[0x10] = ' '; // Hours @@ -346,8 +346,8 @@ error_code cellRtcFormatRfc3339(ppu_thread& ppu, vm::ptr pszDateTime, vm:: pszDateTime[0xd] = ':'; // Minutes - 2020-04-13T10:XX:31.35+66:40 - pszDateTime[0xe] = ascii(date_time->minute / 10); - pszDateTime[0xf] = ascii(date_time->minute % 10); + pszDateTime[0xe] = ascii(date_time->minute / 10); + pszDateTime[0xf] = ascii(date_time->minute % 10); pszDateTime[0x10] = ':'; // Seconds - 2020-04-13T10:56:XX.35+66:40 @@ -453,7 +453,7 @@ u16 rtcParseComponent(vm::cptr pszDateTime, u32& pos, char delimiter, cons return ret; } -template +template u8 rtcParseName(vm::cptr pszDateTime, u32& pos, const std::array& names, bool allow_short_name = true) { for (u8 name_idx = 0; name_idx < names.size(); name_idx++) @@ -496,7 +496,7 @@ error_code rtcParseRfc2822(ppu_thread& ppu, vm::ptr pUtc, vm::cptr< // Mandatory space or hyphen if (pszDateTime[pos] != ' ' && pszDateTime[pos] != '-') { - return { CELL_RTC_ERROR_BAD_PARSE, "rtcParseRfc2822(): invalid or missing delimiter after day" }; + return {CELL_RTC_ERROR_BAD_PARSE, "rtcParseRfc2822(): invalid or missing delimiter after day"}; } pos++; @@ -506,13 +506,13 @@ error_code rtcParseRfc2822(ppu_thread& ppu, vm::ptr pUtc, vm::cptr< if (month > MONTH_NAMES.size()) // No match { - return { CELL_RTC_ERROR_BAD_PARSE, "rtcParseRfc2822(): failed to parse month: string at position %d doesn't match any name", pos }; + return {CELL_RTC_ERROR_BAD_PARSE, "rtcParseRfc2822(): failed to parse month: string at position %d doesn't match any name", pos}; } // Mandatory space or hyphen if (pszDateTime[pos] != ' ' && pszDateTime[pos] != '-') { - return { CELL_RTC_ERROR_BAD_PARSE, "rtcParseRfc2822(): invalid or missing delimiter after month" }; + return {CELL_RTC_ERROR_BAD_PARSE, "rtcParseRfc2822(): invalid or missing delimiter after month"}; } pos++; @@ -523,8 +523,8 @@ error_code rtcParseRfc2822(ppu_thread& ppu, vm::ptr pUtc, vm::cptr< if (!std::isdigit(pszDateTime[pos]) || !std::isdigit(pszDateTime[pos + 1])) { - return { CELL_RTC_ERROR_BAD_PARSE, "rtcParseRfc2822(): failed to parse year: one of the first two ASCII values 0x%x, 0x%x at position %d is not a digit", - pszDateTime[pos], pszDateTime[pos + 1], pos }; + return {CELL_RTC_ERROR_BAD_PARSE, "rtcParseRfc2822(): failed to parse year: one of the first two ASCII values 0x%x, 0x%x at position %d is not a digit", + pszDateTime[pos], pszDateTime[pos + 1], pos}; } if (!std::isdigit(pszDateTime[pos + 2]) || @@ -550,7 +550,7 @@ error_code rtcParseRfc2822(ppu_thread& ppu, vm::ptr pUtc, vm::cptr< if (hour > 25) // LLE uses 25 { - return { CELL_RTC_ERROR_BAD_PARSE, "rtcParseRfc2822(): failed to parse hour: hour greater than 25" }; + return {CELL_RTC_ERROR_BAD_PARSE, "rtcParseRfc2822(): failed to parse hour: hour greater than 25"}; } // Minute: ":X" or ":XX" @@ -639,13 +639,13 @@ error_code rtcParseRfc2822(ppu_thread& ppu, vm::ptr pUtc, vm::cptr< } else if (letter != 'Z') { - return { CELL_RTC_ERROR_BAD_PARSE, "rtcParseRfc2822(): failed to parse time zone" }; + return {CELL_RTC_ERROR_BAD_PARSE, "rtcParseRfc2822(): failed to parse time zone"}; } } } } - const vm::var date_time{{ year, month, day, hour, minute, second, 0 }}; + const vm::var date_time{{year, month, day, hour, minute, second, 0}}; cellRtcGetTick(ppu, date_time, pUtc); cellRtcTickAddMinutes(ppu, pUtc, pUtc, -time_zone); // The time zone value needs to be subtracted @@ -687,7 +687,7 @@ error_code cellRtcParseDateTime(ppu_thread& ppu, vm::ptr pUtc, vm:: // Day of the week: at least the first three letters if (rtcParseName(pszDateTime, pos, WEEKDAY_NAMES) == WEEKDAY_NAMES.size()) // No match { - return { CELL_RTC_ERROR_BAD_PARSE, "cellRtcParseDateTime(): failed to parse day of the week: string at position %d doesn't match any name", pos }; + return {CELL_RTC_ERROR_BAD_PARSE, "cellRtcParseDateTime(): failed to parse day of the week: string at position %d doesn't match any name", pos}; } // Optional comma @@ -714,7 +714,7 @@ error_code cellRtcParseDateTime(ppu_thread& ppu, vm::ptr pUtc, vm:: // Mandatory space if (pszDateTime[pos] != ' ') { - return { CELL_RTC_ERROR_BAD_PARSE, "cellRtcParseDateTime(): no space after month" }; + return {CELL_RTC_ERROR_BAD_PARSE, "cellRtcParseDateTime(): no space after month"}; } pos++; @@ -730,7 +730,7 @@ error_code cellRtcParseDateTime(ppu_thread& ppu, vm::ptr pUtc, vm:: // Due to using a signed type instead of unsigned, LLE doesn't check if the char is less than '0' if (pszDateTime[pos] > '9') { - return { CELL_RTC_ERROR_BAD_PARSE, "cellRtcParseDateTime(): failed to parse day: ASCII value 0x%x at position %d is not a digit", pszDateTime[pos], pos }; + return {CELL_RTC_ERROR_BAD_PARSE, "cellRtcParseDateTime(): failed to parse day: ASCII value 0x%x at position %d is not a digit", pszDateTime[pos], pos}; } if (pszDateTime[pos] < '0') @@ -757,7 +757,7 @@ error_code cellRtcParseDateTime(ppu_thread& ppu, vm::ptr pUtc, vm:: } else { - return { CELL_RTC_ERROR_BAD_PARSE, "cellRtcParseDateTime(): failed to parse day: ASCII value 0x%x at position %d is not a digit or space", pszDateTime[pos], pos }; + return {CELL_RTC_ERROR_BAD_PARSE, "cellRtcParseDateTime(): failed to parse day: ASCII value 0x%x at position %d is not a digit or space", pszDateTime[pos], pos}; } // Hour: " X" or " XX" @@ -787,7 +787,7 @@ error_code cellRtcParseDateTime(ppu_thread& ppu, vm::ptr pUtc, vm:: // Mandatory space if (pszDateTime[pos] != ' ') { - return { CELL_RTC_ERROR_BAD_PARSE, "cellRtcParseDateTime(): no space after second" }; + return {CELL_RTC_ERROR_BAD_PARSE, "cellRtcParseDateTime(): no space after second"}; } pos++; @@ -798,13 +798,13 @@ error_code cellRtcParseDateTime(ppu_thread& ppu, vm::ptr pUtc, vm:: !std::isdigit(pszDateTime[pos + 2]) || !std::isdigit(pszDateTime[pos + 3])) { - return { CELL_RTC_ERROR_BAD_PARSE, "cellRtcParseDateTime(): failed to parse year: one of the ASCII values 0x%x, 0x%x, 0x%x, or 0x%x is not a digit", - pszDateTime[pos], pszDateTime[pos + 1], pszDateTime[pos + 2], pszDateTime[pos + 3] }; + return {CELL_RTC_ERROR_BAD_PARSE, "cellRtcParseDateTime(): failed to parse year: one of the ASCII values 0x%x, 0x%x, 0x%x, or 0x%x is not a digit", + pszDateTime[pos], pszDateTime[pos + 1], pszDateTime[pos + 2], pszDateTime[pos + 3]}; } const u16 year = digit(pszDateTime[pos]) * 1000 + digit(pszDateTime[pos + 1]) * 100 + digit(pszDateTime[pos + 2]) * 10 + digit(pszDateTime[pos + 3]); - const vm::var date_time{{ year, month, day, hour, minute, second, 0 }}; + const vm::var date_time{{year, month, day, hour, minute, second, 0}}; cellRtcGetTick(ppu, date_time, pUtc); @@ -1000,20 +1000,15 @@ error_code cellRtcGetTick(ppu_thread& ppu, vm::cptr pTime, vm:: CellRtcDateTime tick_to_date_time(u64 tick) { const u32 microseconds = (tick % 1000000ULL); - const u16 seconds = (tick / (1000000ULL)) % 60; - const u16 minutes = (tick / (60ULL * 1000000ULL)) % 60; - const u16 hours = (tick / (60ULL * 60ULL * 1000000ULL)) % 24; - u32 days_tmp = static_cast(tick / (24ULL * 60ULL * 60ULL * 1000000ULL)); + const u16 seconds = (tick / (1000000ULL)) % 60; + const u16 minutes = (tick / (60ULL * 1000000ULL)) % 60; + const u16 hours = (tick / (60ULL * 60ULL * 1000000ULL)) % 24; + u32 days_tmp = static_cast(tick / (24ULL * 60ULL * 60ULL * 1000000ULL)); const u32 year_400 = days_tmp / DAYS_IN_400_YEARS; days_tmp -= year_400 * DAYS_IN_400_YEARS; - const u32 year_within_400_interval = ( - days_tmp - - days_tmp / (DAYS_IN_4_YEARS - 1) - + days_tmp / DAYS_IN_100_YEARS - - days_tmp / (DAYS_IN_400_YEARS - 1) - ) / 365; + const u32 year_within_400_interval = (days_tmp - days_tmp / (DAYS_IN_4_YEARS - 1) + days_tmp / DAYS_IN_100_YEARS - days_tmp / (DAYS_IN_400_YEARS - 1)) / 365; days_tmp -= year_within_400_interval * 365 + year_within_400_interval / 4 - year_within_400_interval / 100 + year_within_400_interval / 400; @@ -1032,25 +1027,20 @@ CellRtcDateTime tick_to_date_time(u64 tick) days_tmp = days_tmp - month_offset[month_approx]; CellRtcDateTime date_time{ - .year = years, - .month = months, - .day = ::narrow(days_tmp + 1), - .hour = hours, - .minute = minutes, - .second = seconds, - .microsecond = microseconds - }; + .year = years, + .month = months, + .day = ::narrow(days_tmp + 1), + .hour = hours, + .minute = minutes, + .second = seconds, + .microsecond = microseconds}; return date_time; } u64 date_time_to_tick(CellRtcDateTime date_time) { const u32 days_in_previous_years = - date_time.year * 365 - + (date_time.year + 3) / 4 - - (date_time.year + 99) / 100 - + (date_time.year + 399) / 400 - - 366; + date_time.year * 365 + (date_time.year + 3) / 4 - (date_time.year + 99) / 100 + (date_time.year + 399) / 400 - 366; // Not checked on LLE if (date_time.month == 0u) @@ -1068,11 +1058,7 @@ u64 date_time_to_tick(CellRtcDateTime date_time) const u32 days = days_in_previous_years + days_in_previous_months + date_time.day - 1; - u64 tick = date_time.microsecond - + u64{date_time.second} * 1000000ULL - + u64{date_time.minute} * 60ULL * 1000000ULL - + u64{date_time.hour} * 60ULL * 60ULL * 1000000ULL - + days * 24ULL * 60ULL * 60ULL * 1000000ULL; + u64 tick = date_time.microsecond + u64{date_time.second} * 1000000ULL + u64{date_time.minute} * 60ULL * 1000000ULL + u64{date_time.hour} * 60ULL * 60ULL * 1000000ULL + days * 24ULL * 60ULL * 60ULL * 1000000ULL; return tick; } @@ -1442,14 +1428,14 @@ error_code cellRtcGetDosTime(ppu_thread& ppu, vm::cptr pDateTim if (puiDosTime) // Should always evaluate to true, nullptr was already checked above { - s32 year = ((pDateTime->year - 1980) & 0x7F) << 9; - s32 month = ((pDateTime->month) & 0xF) << 5; - s32 hour = ((pDateTime->hour) & 0x1F) << 11; - s32 minute = ((pDateTime->minute) & 0x3F) << 5; - s32 day = (pDateTime->day) & 0x1F; - s32 second = ((pDateTime->second) >> 1) & 0x1F; - s32 ymd = year | month | day; - s32 hms = hour | minute | second; + s32 year = ((pDateTime->year - 1980) & 0x7F) << 9; + s32 month = ((pDateTime->month) & 0xF) << 5; + s32 hour = ((pDateTime->hour) & 0x1F) << 11; + s32 minute = ((pDateTime->minute) & 0x3F) << 5; + s32 day = (pDateTime->day) & 0x1F; + s32 second = ((pDateTime->second) >> 1) & 0x1F; + s32 ymd = year | month | day; + s32 hms = hour | minute | second; *puiDosTime = (ymd << 16) | hms; } @@ -1637,12 +1623,12 @@ error_code cellRtcSetDosTime(ppu_thread& ppu, vm::ptr pDateTime s32 hms = uiDosTime & 0xffff; s32 ymd = uiDosTime >> 16; - pDateTime->year = (ymd >> 9) + 1980; - pDateTime->month = (ymd >> 5) & 0xf; - pDateTime->day = ymd & 0x1f; - pDateTime->hour = (hms >> 11); - pDateTime->minute = (hms >> 5) & 0x3f; - pDateTime->second = (hms << 1) & 0x3e; + pDateTime->year = (ymd >> 9) + 1980; + pDateTime->month = (ymd >> 5) & 0xf; + pDateTime->day = ymd & 0x1f; + pDateTime->hour = (hms >> 11); + pDateTime->minute = (hms >> 5) & 0x3f; + pDateTime->second = (hms << 1) & 0x3e; pDateTime->microsecond = 0; return CELL_OK; @@ -1810,53 +1796,54 @@ s32 cellRtcCompareTick(vm::cptr pTick0, vm::cptr pTick } DECLARE(ppu_module_manager::cellRtc) -("cellRtc", []() { - REG_FUNC(cellRtc, cellRtcGetCurrentTick); - REG_FUNC(cellRtc, cellRtcGetCurrentClock); - REG_FUNC(cellRtc, cellRtcGetCurrentClockLocalTime); +("cellRtc", []() + { + REG_FUNC(cellRtc, cellRtcGetCurrentTick); + REG_FUNC(cellRtc, cellRtcGetCurrentClock); + REG_FUNC(cellRtc, cellRtcGetCurrentClockLocalTime); - REG_FUNC(cellRtc, cellRtcFormatRfc2822); - REG_FUNC(cellRtc, cellRtcFormatRfc2822LocalTime); - REG_FUNC(cellRtc, cellRtcFormatRfc3339); - REG_FUNC(cellRtc, cellRtcFormatRfc3339LocalTime); - REG_FUNC(cellRtc, cellRtcParseDateTime); - REG_FUNC(cellRtc, cellRtcParseRfc3339); + REG_FUNC(cellRtc, cellRtcFormatRfc2822); + REG_FUNC(cellRtc, cellRtcFormatRfc2822LocalTime); + REG_FUNC(cellRtc, cellRtcFormatRfc3339); + REG_FUNC(cellRtc, cellRtcFormatRfc3339LocalTime); + REG_FUNC(cellRtc, cellRtcParseDateTime); + REG_FUNC(cellRtc, cellRtcParseRfc3339); - REG_FUNC(cellRtc, cellRtcGetTick); - REG_FUNC(cellRtc, cellRtcSetTick); + REG_FUNC(cellRtc, cellRtcGetTick); + REG_FUNC(cellRtc, cellRtcSetTick); - REG_FUNC(cellRtc, cellRtcTickAddTicks); - REG_FUNC(cellRtc, cellRtcTickAddMicroseconds); - REG_FUNC(cellRtc, cellRtcTickAddSeconds); - REG_FUNC(cellRtc, cellRtcTickAddMinutes); - REG_FUNC(cellRtc, cellRtcTickAddHours); - REG_FUNC(cellRtc, cellRtcTickAddDays); - REG_FUNC(cellRtc, cellRtcTickAddWeeks); - REG_FUNC(cellRtc, cellRtcTickAddMonths); - REG_FUNC(cellRtc, cellRtcTickAddYears); + REG_FUNC(cellRtc, cellRtcTickAddTicks); + REG_FUNC(cellRtc, cellRtcTickAddMicroseconds); + REG_FUNC(cellRtc, cellRtcTickAddSeconds); + REG_FUNC(cellRtc, cellRtcTickAddMinutes); + REG_FUNC(cellRtc, cellRtcTickAddHours); + REG_FUNC(cellRtc, cellRtcTickAddDays); + REG_FUNC(cellRtc, cellRtcTickAddWeeks); + REG_FUNC(cellRtc, cellRtcTickAddMonths); + REG_FUNC(cellRtc, cellRtcTickAddYears); - REG_FUNC(cellRtc, cellRtcConvertUtcToLocalTime); - REG_FUNC(cellRtc, cellRtcConvertLocalTimeToUtc); + REG_FUNC(cellRtc, cellRtcConvertUtcToLocalTime); + REG_FUNC(cellRtc, cellRtcConvertLocalTimeToUtc); - REG_FUNC(cellRtc, cellRtcGetCurrentSecureTick); - REG_FUNC(cellRtc, cellRtcGetDosTime); - REG_FUNC(cellRtc, cellRtcGetTickResolution); - REG_FUNC(cellRtc, cellRtcGetSystemTime); - REG_FUNC(cellRtc, cellRtcGetTime_t); - REG_FUNC(cellRtc, cellRtcGetWin32FileTime); + REG_FUNC(cellRtc, cellRtcGetCurrentSecureTick); + REG_FUNC(cellRtc, cellRtcGetDosTime); + REG_FUNC(cellRtc, cellRtcGetTickResolution); + REG_FUNC(cellRtc, cellRtcGetSystemTime); + REG_FUNC(cellRtc, cellRtcGetTime_t); + REG_FUNC(cellRtc, cellRtcGetWin32FileTime); - REG_FUNC(cellRtc, cellRtcSetConf); - REG_FUNC(cellRtc, cellRtcSetCurrentSecureTick); - REG_FUNC(cellRtc, cellRtcSetCurrentTick); - REG_FUNC(cellRtc, cellRtcSetDosTime); - REG_FUNC(cellRtc, cellRtcSetTime_t); - REG_FUNC(cellRtc, cellRtcSetSystemTime); - REG_FUNC(cellRtc, cellRtcSetWin32FileTime); + REG_FUNC(cellRtc, cellRtcSetConf); + REG_FUNC(cellRtc, cellRtcSetCurrentSecureTick); + REG_FUNC(cellRtc, cellRtcSetCurrentTick); + REG_FUNC(cellRtc, cellRtcSetDosTime); + REG_FUNC(cellRtc, cellRtcSetTime_t); + REG_FUNC(cellRtc, cellRtcSetSystemTime); + REG_FUNC(cellRtc, cellRtcSetWin32FileTime); - REG_FUNC(cellRtc, cellRtcIsLeapYear); - REG_FUNC(cellRtc, cellRtcGetDaysInMonth); - REG_FUNC(cellRtc, cellRtcGetDayOfWeek); - REG_FUNC(cellRtc, cellRtcCheckValid); + REG_FUNC(cellRtc, cellRtcIsLeapYear); + REG_FUNC(cellRtc, cellRtcGetDaysInMonth); + REG_FUNC(cellRtc, cellRtcGetDayOfWeek); + REG_FUNC(cellRtc, cellRtcCheckValid); - REG_FUNC(cellRtc, cellRtcCompareTick); -}); + REG_FUNC(cellRtc, cellRtcCompareTick); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellRtc.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellRtc.h index 52c89bab1..8afe9580e 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellRtc.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellRtc.h @@ -6,19 +6,19 @@ // Return Codes enum CellRtcError { - CELL_RTC_ERROR_NOT_INITIALIZED = 0x80010601, - CELL_RTC_ERROR_INVALID_POINTER = 0x80010602, - CELL_RTC_ERROR_INVALID_VALUE = 0x80010603, - CELL_RTC_ERROR_INVALID_ARG = 0x80010604, - CELL_RTC_ERROR_NOT_SUPPORTED = 0x80010605, - CELL_RTC_ERROR_NO_CLOCK = 0x80010606, - CELL_RTC_ERROR_BAD_PARSE = 0x80010607, - CELL_RTC_ERROR_INVALID_YEAR = 0x80010621, - CELL_RTC_ERROR_INVALID_MONTH = 0x80010622, - CELL_RTC_ERROR_INVALID_DAY = 0x80010623, - CELL_RTC_ERROR_INVALID_HOUR = 0x80010624, - CELL_RTC_ERROR_INVALID_MINUTE = 0x80010625, - CELL_RTC_ERROR_INVALID_SECOND = 0x80010626, + CELL_RTC_ERROR_NOT_INITIALIZED = 0x80010601, + CELL_RTC_ERROR_INVALID_POINTER = 0x80010602, + CELL_RTC_ERROR_INVALID_VALUE = 0x80010603, + CELL_RTC_ERROR_INVALID_ARG = 0x80010604, + CELL_RTC_ERROR_NOT_SUPPORTED = 0x80010605, + CELL_RTC_ERROR_NO_CLOCK = 0x80010606, + CELL_RTC_ERROR_BAD_PARSE = 0x80010607, + CELL_RTC_ERROR_INVALID_YEAR = 0x80010621, + CELL_RTC_ERROR_INVALID_MONTH = 0x80010622, + CELL_RTC_ERROR_INVALID_DAY = 0x80010623, + CELL_RTC_ERROR_INVALID_HOUR = 0x80010624, + CELL_RTC_ERROR_INVALID_MINUTE = 0x80010625, + CELL_RTC_ERROR_INVALID_SECOND = 0x80010626, CELL_RTC_ERROR_INVALID_MICROSECOND = 0x80010627, }; @@ -38,25 +38,25 @@ struct CellRtcDateTime be_t microsecond; // 0 to 999999 }; -constexpr u64 RTC_MAGIC_OFFSET = 62135596800000000ull; // 1970-01-01 00:00:00.000000 +constexpr u64 RTC_MAGIC_OFFSET = 62135596800000000ull; // 1970-01-01 00:00:00.000000 constexpr u64 RTC_FILETIME_OFFSET = 50491123200000000ull; // 1601-01-01 00:00:00.000000 constexpr u64 RTC_SYSTEM_TIME_MIN = 63082281600000000ull; // 2000-01-01 00:00:00.000000 constexpr u64 RTC_SYSTEM_TIME_MAX = 66238041599999999ull; // 2099-12-31 23:59:59.999999 constexpr u32 DAYS_IN_400_YEARS = 365 * 400 + 97; constexpr u16 DAYS_IN_100_YEARS = 365 * 100 + 24; -constexpr u16 DAYS_IN_4_YEARS = 365 * 4 + 1; +constexpr u16 DAYS_IN_4_YEARS = 365 * 4 + 1; -constexpr std::array DAYS_IN_MONTH = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; -constexpr std::array DAYS_IN_MONTH_LEAP = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; +constexpr std::array DAYS_IN_MONTH = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; +constexpr std::array DAYS_IN_MONTH_LEAP = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; -constexpr std::array MONTH_OFFSET = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, umax }; -constexpr std::array MONTH_OFFSET_LEAP = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, umax }; +constexpr std::array MONTH_OFFSET = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, umax}; +constexpr std::array MONTH_OFFSET_LEAP = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, umax}; -constexpr std::array WEEKDAY_NAMES = { "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" }; -constexpr std::array MONTH_NAMES = { "january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december" }; -constexpr std::array TIME_ZONE_NAMES = { "gmt", "est", "edt", "cst", "cdt", "mst", "mdt", "pst", "pdt", "nzdt", "nzst", "idle", "nzt", "aesst", "acsst", "cadt", "sadt", "aest", "east", "gst", "ligt", "acst", "sast", "cast", "awsst", "jst", "kst", "wdt", "mt", "awst", "cct", "wadt", "wst", "jt", "wast", "it", "bt", "eetdst", "eet", "cetdst", "fwt", "ist", "mest", "metdst", "sst", "bst", "cet", "dnt", "fst", "met", "mewt", "mez", "nor", "set", "swt", "wetdst", "wet", "wat", "ndt", "adt", "nft", "nst", "ast", "ydt", "hdt", "yst", "ahst", "cat", "nt", "idlw" }; -constexpr std::array TIME_ZONE_VALUES = { 0, -10, -8, -12, -10, -14, -12, -16, -14, 26, 24, 24, 24, 22, 21, 21, 21, 20, 20, 20, 20, 19, 19, 19, 18, 18, 18, 18, 17, 16, 16, 16, 16, 15, 14, 7, 6, 6, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, -2, -3, -6, -5, -5, -8, -16, -18, -18, -20, -20, -22, -24 }; // In units of 30 minutes +constexpr std::array WEEKDAY_NAMES = {"sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"}; +constexpr std::array MONTH_NAMES = {"january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"}; +constexpr std::array TIME_ZONE_NAMES = {"gmt", "est", "edt", "cst", "cdt", "mst", "mdt", "pst", "pdt", "nzdt", "nzst", "idle", "nzt", "aesst", "acsst", "cadt", "sadt", "aest", "east", "gst", "ligt", "acst", "sast", "cast", "awsst", "jst", "kst", "wdt", "mt", "awst", "cct", "wadt", "wst", "jt", "wast", "it", "bt", "eetdst", "eet", "cetdst", "fwt", "ist", "mest", "metdst", "sst", "bst", "cet", "dnt", "fst", "met", "mewt", "mez", "nor", "set", "swt", "wetdst", "wet", "wat", "ndt", "adt", "nft", "nst", "ast", "ydt", "hdt", "yst", "ahst", "cat", "nt", "idlw"}; +constexpr std::array TIME_ZONE_VALUES = {0, -10, -8, -12, -10, -14, -12, -16, -14, 26, 24, 24, 24, 22, 21, 21, 21, 20, 20, 20, 20, 19, 19, 19, 18, 18, 18, 18, 17, 16, 16, 16, 16, 15, 14, 7, 6, 6, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, -2, -3, -6, -5, -5, -8, -16, -18, -18, -20, -20, -22, -24}; // In units of 30 minutes error_code cellRtcTickAddMinutes(ppu_thread& ppu, vm::ptr pTick0, vm::cptr pTick1, s64 lAdd); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellRtcAlarm.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellRtcAlarm.cpp index da0841faa..7725d87a5 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellRtcAlarm.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellRtcAlarm.cpp @@ -34,10 +34,10 @@ error_code cellRtcAlarmGetStatus() } DECLARE(ppu_module_manager::cellRtcAlarm)("cellRtcAlarm", []() -{ - REG_FUNC(cellRtcAlarm, cellRtcAlarmRegister); - REG_FUNC(cellRtcAlarm, cellRtcAlarmUnregister); - REG_FUNC(cellRtcAlarm, cellRtcAlarmNotification); - REG_FUNC(cellRtcAlarm, cellRtcAlarmStopRunning); - REG_FUNC(cellRtcAlarm, cellRtcAlarmGetStatus); -}); + { + REG_FUNC(cellRtcAlarm, cellRtcAlarmRegister); + REG_FUNC(cellRtcAlarm, cellRtcAlarmUnregister); + REG_FUNC(cellRtcAlarm, cellRtcAlarmNotification); + REG_FUNC(cellRtcAlarm, cellRtcAlarmStopRunning); + REG_FUNC(cellRtcAlarm, cellRtcAlarmGetStatus); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellRudp.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellRudp.cpp index a4f6f2122..61ebd78d9 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellRudp.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellRudp.cpp @@ -10,51 +10,51 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_RUDP_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_RUDP_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_RUDP_ERROR_INVALID_CONTEXT_ID); - STR_CASE(CELL_RUDP_ERROR_INVALID_ARGUMENT); - STR_CASE(CELL_RUDP_ERROR_INVALID_OPTION); - STR_CASE(CELL_RUDP_ERROR_INVALID_MUXMODE); - STR_CASE(CELL_RUDP_ERROR_MEMORY); - STR_CASE(CELL_RUDP_ERROR_INTERNAL); - STR_CASE(CELL_RUDP_ERROR_CONN_RESET); - STR_CASE(CELL_RUDP_ERROR_CONN_REFUSED); - STR_CASE(CELL_RUDP_ERROR_CONN_TIMEOUT); - STR_CASE(CELL_RUDP_ERROR_CONN_VERSION_MISMATCH); - STR_CASE(CELL_RUDP_ERROR_CONN_TRANSPORT_TYPE_MISMATCH); - STR_CASE(CELL_RUDP_ERROR_QUALITY_LEVEL_MISMATCH); - STR_CASE(CELL_RUDP_ERROR_THREAD); - STR_CASE(CELL_RUDP_ERROR_THREAD_IN_USE); - STR_CASE(CELL_RUDP_ERROR_NOT_ACCEPTABLE); - STR_CASE(CELL_RUDP_ERROR_MSG_TOO_LARGE); - STR_CASE(CELL_RUDP_ERROR_NOT_BOUND); - STR_CASE(CELL_RUDP_ERROR_CANCELLED); - STR_CASE(CELL_RUDP_ERROR_INVALID_VPORT); - STR_CASE(CELL_RUDP_ERROR_WOULDBLOCK); - STR_CASE(CELL_RUDP_ERROR_VPORT_IN_USE); - STR_CASE(CELL_RUDP_ERROR_VPORT_EXHAUSTED); - STR_CASE(CELL_RUDP_ERROR_INVALID_SOCKET); - STR_CASE(CELL_RUDP_ERROR_BUFFER_TOO_SMALL); - STR_CASE(CELL_RUDP_ERROR_MSG_MALFORMED); - STR_CASE(CELL_RUDP_ERROR_ADDR_IN_USE); - STR_CASE(CELL_RUDP_ERROR_ALREADY_BOUND); - STR_CASE(CELL_RUDP_ERROR_ALREADY_EXISTS); - STR_CASE(CELL_RUDP_ERROR_INVALID_POLL_ID); - STR_CASE(CELL_RUDP_ERROR_TOO_MANY_CONTEXTS); - STR_CASE(CELL_RUDP_ERROR_IN_PROGRESS); - STR_CASE(CELL_RUDP_ERROR_NO_EVENT_HANDLER); - STR_CASE(CELL_RUDP_ERROR_PAYLOAD_TOO_LARGE); - STR_CASE(CELL_RUDP_ERROR_END_OF_DATA); - STR_CASE(CELL_RUDP_ERROR_ALREADY_ESTABLISHED); - STR_CASE(CELL_RUDP_ERROR_KEEP_ALIVE_FAILURE); - } + switch (error) + { + STR_CASE(CELL_RUDP_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_RUDP_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_RUDP_ERROR_INVALID_CONTEXT_ID); + STR_CASE(CELL_RUDP_ERROR_INVALID_ARGUMENT); + STR_CASE(CELL_RUDP_ERROR_INVALID_OPTION); + STR_CASE(CELL_RUDP_ERROR_INVALID_MUXMODE); + STR_CASE(CELL_RUDP_ERROR_MEMORY); + STR_CASE(CELL_RUDP_ERROR_INTERNAL); + STR_CASE(CELL_RUDP_ERROR_CONN_RESET); + STR_CASE(CELL_RUDP_ERROR_CONN_REFUSED); + STR_CASE(CELL_RUDP_ERROR_CONN_TIMEOUT); + STR_CASE(CELL_RUDP_ERROR_CONN_VERSION_MISMATCH); + STR_CASE(CELL_RUDP_ERROR_CONN_TRANSPORT_TYPE_MISMATCH); + STR_CASE(CELL_RUDP_ERROR_QUALITY_LEVEL_MISMATCH); + STR_CASE(CELL_RUDP_ERROR_THREAD); + STR_CASE(CELL_RUDP_ERROR_THREAD_IN_USE); + STR_CASE(CELL_RUDP_ERROR_NOT_ACCEPTABLE); + STR_CASE(CELL_RUDP_ERROR_MSG_TOO_LARGE); + STR_CASE(CELL_RUDP_ERROR_NOT_BOUND); + STR_CASE(CELL_RUDP_ERROR_CANCELLED); + STR_CASE(CELL_RUDP_ERROR_INVALID_VPORT); + STR_CASE(CELL_RUDP_ERROR_WOULDBLOCK); + STR_CASE(CELL_RUDP_ERROR_VPORT_IN_USE); + STR_CASE(CELL_RUDP_ERROR_VPORT_EXHAUSTED); + STR_CASE(CELL_RUDP_ERROR_INVALID_SOCKET); + STR_CASE(CELL_RUDP_ERROR_BUFFER_TOO_SMALL); + STR_CASE(CELL_RUDP_ERROR_MSG_MALFORMED); + STR_CASE(CELL_RUDP_ERROR_ADDR_IN_USE); + STR_CASE(CELL_RUDP_ERROR_ALREADY_BOUND); + STR_CASE(CELL_RUDP_ERROR_ALREADY_EXISTS); + STR_CASE(CELL_RUDP_ERROR_INVALID_POLL_ID); + STR_CASE(CELL_RUDP_ERROR_TOO_MANY_CONTEXTS); + STR_CASE(CELL_RUDP_ERROR_IN_PROGRESS); + STR_CASE(CELL_RUDP_ERROR_NO_EVENT_HANDLER); + STR_CASE(CELL_RUDP_ERROR_PAYLOAD_TOO_LARGE); + STR_CASE(CELL_RUDP_ERROR_END_OF_DATA); + STR_CASE(CELL_RUDP_ERROR_ALREADY_ESTABLISHED); + STR_CASE(CELL_RUDP_ERROR_KEEP_ALIVE_FAILURE); + } - return unknown; - }); + return unknown; + }); } struct rudp_info @@ -309,42 +309,42 @@ error_code cellRudpProcessEvents() } DECLARE(ppu_module_manager::cellRudp)("cellRudp", []() -{ - REG_FUNC(cellRudp, cellRudpInit); - REG_FUNC(cellRudp, cellRudpEnd); - REG_FUNC(cellRudp, cellRudpEnableInternalIOThread); - REG_FUNC(cellRudp, cellRudpSetEventHandler); - REG_FUNC(cellRudp, cellRudpSetMaxSegmentSize); - REG_FUNC(cellRudp, cellRudpGetMaxSegmentSize); + { + REG_FUNC(cellRudp, cellRudpInit); + REG_FUNC(cellRudp, cellRudpEnd); + REG_FUNC(cellRudp, cellRudpEnableInternalIOThread); + REG_FUNC(cellRudp, cellRudpSetEventHandler); + REG_FUNC(cellRudp, cellRudpSetMaxSegmentSize); + REG_FUNC(cellRudp, cellRudpGetMaxSegmentSize); - REG_FUNC(cellRudp, cellRudpCreateContext); - REG_FUNC(cellRudp, cellRudpSetOption); - REG_FUNC(cellRudp, cellRudpGetOption); + REG_FUNC(cellRudp, cellRudpCreateContext); + REG_FUNC(cellRudp, cellRudpSetOption); + REG_FUNC(cellRudp, cellRudpGetOption); - REG_FUNC(cellRudp, cellRudpGetContextStatus); - REG_FUNC(cellRudp, cellRudpGetStatus); - REG_FUNC(cellRudp, cellRudpGetLocalInfo); - REG_FUNC(cellRudp, cellRudpGetRemoteInfo); + REG_FUNC(cellRudp, cellRudpGetContextStatus); + REG_FUNC(cellRudp, cellRudpGetStatus); + REG_FUNC(cellRudp, cellRudpGetLocalInfo); + REG_FUNC(cellRudp, cellRudpGetRemoteInfo); - REG_FUNC(cellRudp, cellRudpAccept); - REG_FUNC(cellRudp, cellRudpBind); - REG_FUNC(cellRudp, cellRudpListen); - REG_FUNC(cellRudp, cellRudpInitiate); - REG_FUNC(cellRudp, cellRudpActivate); - REG_FUNC(cellRudp, cellRudpTerminate); + REG_FUNC(cellRudp, cellRudpAccept); + REG_FUNC(cellRudp, cellRudpBind); + REG_FUNC(cellRudp, cellRudpListen); + REG_FUNC(cellRudp, cellRudpInitiate); + REG_FUNC(cellRudp, cellRudpActivate); + REG_FUNC(cellRudp, cellRudpTerminate); - REG_FUNC(cellRudp, cellRudpRead); - REG_FUNC(cellRudp, cellRudpWrite); - REG_FUNC(cellRudp, cellRudpGetSizeReadable); - REG_FUNC(cellRudp, cellRudpGetSizeWritable); - REG_FUNC(cellRudp, cellRudpFlush); + REG_FUNC(cellRudp, cellRudpRead); + REG_FUNC(cellRudp, cellRudpWrite); + REG_FUNC(cellRudp, cellRudpGetSizeReadable); + REG_FUNC(cellRudp, cellRudpGetSizeWritable); + REG_FUNC(cellRudp, cellRudpFlush); - REG_FUNC(cellRudp, cellRudpPollCreate); - REG_FUNC(cellRudp, cellRudpPollDestroy); - REG_FUNC(cellRudp, cellRudpPollControl); - REG_FUNC(cellRudp, cellRudpPollWait); - REG_FUNC(cellRudp, cellRudpPollCancel); + REG_FUNC(cellRudp, cellRudpPollCreate); + REG_FUNC(cellRudp, cellRudpPollDestroy); + REG_FUNC(cellRudp, cellRudpPollControl); + REG_FUNC(cellRudp, cellRudpPollWait); + REG_FUNC(cellRudp, cellRudpPollCancel); - REG_FUNC(cellRudp, cellRudpNetReceived); - REG_FUNC(cellRudp, cellRudpProcessEvents); -}); + REG_FUNC(cellRudp, cellRudpNetReceived); + REG_FUNC(cellRudp, cellRudpProcessEvents); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellRudp.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellRudp.h index 0c05574bc..8727c276b 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellRudp.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellRudp.h @@ -7,72 +7,72 @@ constexpr auto CELL_RUDP_SUCCESS = CELL_OK; enum CellRudpError : u32 { - CELL_RUDP_ERROR_NOT_INITIALIZED = 0x80770001, - CELL_RUDP_ERROR_ALREADY_INITIALIZED = 0x80770002, - CELL_RUDP_ERROR_INVALID_CONTEXT_ID = 0x80770003, - CELL_RUDP_ERROR_INVALID_ARGUMENT = 0x80770004, - CELL_RUDP_ERROR_INVALID_OPTION = 0x80770005, - CELL_RUDP_ERROR_INVALID_MUXMODE = 0x80770006, - CELL_RUDP_ERROR_MEMORY = 0x80770007, - CELL_RUDP_ERROR_INTERNAL = 0x80770008, - CELL_RUDP_ERROR_CONN_RESET = 0x80770009, - CELL_RUDP_ERROR_CONN_REFUSED = 0x8077000a, - CELL_RUDP_ERROR_CONN_TIMEOUT = 0x8077000b, - CELL_RUDP_ERROR_CONN_VERSION_MISMATCH = 0x8077000c, + CELL_RUDP_ERROR_NOT_INITIALIZED = 0x80770001, + CELL_RUDP_ERROR_ALREADY_INITIALIZED = 0x80770002, + CELL_RUDP_ERROR_INVALID_CONTEXT_ID = 0x80770003, + CELL_RUDP_ERROR_INVALID_ARGUMENT = 0x80770004, + CELL_RUDP_ERROR_INVALID_OPTION = 0x80770005, + CELL_RUDP_ERROR_INVALID_MUXMODE = 0x80770006, + CELL_RUDP_ERROR_MEMORY = 0x80770007, + CELL_RUDP_ERROR_INTERNAL = 0x80770008, + CELL_RUDP_ERROR_CONN_RESET = 0x80770009, + CELL_RUDP_ERROR_CONN_REFUSED = 0x8077000a, + CELL_RUDP_ERROR_CONN_TIMEOUT = 0x8077000b, + CELL_RUDP_ERROR_CONN_VERSION_MISMATCH = 0x8077000c, CELL_RUDP_ERROR_CONN_TRANSPORT_TYPE_MISMATCH = 0x8077000d, - CELL_RUDP_ERROR_QUALITY_LEVEL_MISMATCH = 0x8077000e, - CELL_RUDP_ERROR_THREAD = 0x8077000f, - CELL_RUDP_ERROR_THREAD_IN_USE = 0x80770010, - CELL_RUDP_ERROR_NOT_ACCEPTABLE = 0x80770011, - CELL_RUDP_ERROR_MSG_TOO_LARGE = 0x80770012, - CELL_RUDP_ERROR_NOT_BOUND = 0x80770013, - CELL_RUDP_ERROR_CANCELLED = 0x80770014, - CELL_RUDP_ERROR_INVALID_VPORT = 0x80770015, - CELL_RUDP_ERROR_WOULDBLOCK = 0x80770016, - CELL_RUDP_ERROR_VPORT_IN_USE = 0x80770017, - CELL_RUDP_ERROR_VPORT_EXHAUSTED = 0x80770018, - CELL_RUDP_ERROR_INVALID_SOCKET = 0x80770019, - CELL_RUDP_ERROR_BUFFER_TOO_SMALL = 0x8077001a, - CELL_RUDP_ERROR_MSG_MALFORMED = 0x8077001b, - CELL_RUDP_ERROR_ADDR_IN_USE = 0x8077001c, - CELL_RUDP_ERROR_ALREADY_BOUND = 0x8077001d, - CELL_RUDP_ERROR_ALREADY_EXISTS = 0x8077001e, - CELL_RUDP_ERROR_INVALID_POLL_ID = 0x8077001f, - CELL_RUDP_ERROR_TOO_MANY_CONTEXTS = 0x80770020, - CELL_RUDP_ERROR_IN_PROGRESS = 0x80770021, - CELL_RUDP_ERROR_NO_EVENT_HANDLER = 0x80770022, - CELL_RUDP_ERROR_PAYLOAD_TOO_LARGE = 0x80770023, - CELL_RUDP_ERROR_END_OF_DATA = 0x80770024, - CELL_RUDP_ERROR_ALREADY_ESTABLISHED = 0x80770025, - CELL_RUDP_ERROR_KEEP_ALIVE_FAILURE = 0x80770026, + CELL_RUDP_ERROR_QUALITY_LEVEL_MISMATCH = 0x8077000e, + CELL_RUDP_ERROR_THREAD = 0x8077000f, + CELL_RUDP_ERROR_THREAD_IN_USE = 0x80770010, + CELL_RUDP_ERROR_NOT_ACCEPTABLE = 0x80770011, + CELL_RUDP_ERROR_MSG_TOO_LARGE = 0x80770012, + CELL_RUDP_ERROR_NOT_BOUND = 0x80770013, + CELL_RUDP_ERROR_CANCELLED = 0x80770014, + CELL_RUDP_ERROR_INVALID_VPORT = 0x80770015, + CELL_RUDP_ERROR_WOULDBLOCK = 0x80770016, + CELL_RUDP_ERROR_VPORT_IN_USE = 0x80770017, + CELL_RUDP_ERROR_VPORT_EXHAUSTED = 0x80770018, + CELL_RUDP_ERROR_INVALID_SOCKET = 0x80770019, + CELL_RUDP_ERROR_BUFFER_TOO_SMALL = 0x8077001a, + CELL_RUDP_ERROR_MSG_MALFORMED = 0x8077001b, + CELL_RUDP_ERROR_ADDR_IN_USE = 0x8077001c, + CELL_RUDP_ERROR_ALREADY_BOUND = 0x8077001d, + CELL_RUDP_ERROR_ALREADY_EXISTS = 0x8077001e, + CELL_RUDP_ERROR_INVALID_POLL_ID = 0x8077001f, + CELL_RUDP_ERROR_TOO_MANY_CONTEXTS = 0x80770020, + CELL_RUDP_ERROR_IN_PROGRESS = 0x80770021, + CELL_RUDP_ERROR_NO_EVENT_HANDLER = 0x80770022, + CELL_RUDP_ERROR_PAYLOAD_TOO_LARGE = 0x80770023, + CELL_RUDP_ERROR_END_OF_DATA = 0x80770024, + CELL_RUDP_ERROR_ALREADY_ESTABLISHED = 0x80770025, + CELL_RUDP_ERROR_KEEP_ALIVE_FAILURE = 0x80770026, }; // Context options enum { - CELL_RUDP_OPTION_MAX_PAYLOAD = 1, - CELL_RUDP_OPTION_SNDBUF = 2, - CELL_RUDP_OPTION_RCVBUF = 3, - CELL_RUDP_OPTION_NODELAY = 4, - CELL_RUDP_OPTION_DELIVERY_CRITICAL = 5, - CELL_RUDP_OPTION_ORDER_CRITICAL = 6, - CELL_RUDP_OPTION_NONBLOCK = 7, - CELL_RUDP_OPTION_STREAM = 8, - CELL_RUDP_OPTION_CONNECTION_TIMEOUT = 9, - CELL_RUDP_OPTION_CLOSE_WAIT_TIMEOUT = 10, + CELL_RUDP_OPTION_MAX_PAYLOAD = 1, + CELL_RUDP_OPTION_SNDBUF = 2, + CELL_RUDP_OPTION_RCVBUF = 3, + CELL_RUDP_OPTION_NODELAY = 4, + CELL_RUDP_OPTION_DELIVERY_CRITICAL = 5, + CELL_RUDP_OPTION_ORDER_CRITICAL = 6, + CELL_RUDP_OPTION_NONBLOCK = 7, + CELL_RUDP_OPTION_STREAM = 8, + CELL_RUDP_OPTION_CONNECTION_TIMEOUT = 9, + CELL_RUDP_OPTION_CLOSE_WAIT_TIMEOUT = 10, CELL_RUDP_OPTION_AGGREGATION_TIMEOUT = 11, - CELL_RUDP_OPTION_LAST_ERROR = 14, - CELL_RUDP_OPTION_READ_TIMEOUT = 15, - CELL_RUDP_OPTION_WRITE_TIMEOUT = 16, - CELL_RUDP_OPTION_FLUSH_TIMEOUT = 17, + CELL_RUDP_OPTION_LAST_ERROR = 14, + CELL_RUDP_OPTION_READ_TIMEOUT = 15, + CELL_RUDP_OPTION_WRITE_TIMEOUT = 16, + CELL_RUDP_OPTION_FLUSH_TIMEOUT = 17, CELL_RUDP_OPTION_KEEP_ALIVE_INTERVAL = 18, - CELL_RUDP_OPTION_KEEP_ALIVE_TIMEOUT = 19, + CELL_RUDP_OPTION_KEEP_ALIVE_TIMEOUT = 19, }; // Polling event flags enum { - CELL_RUDP_POLL_EV_READ = 0x0001, + CELL_RUDP_POLL_EV_READ = 0x0001, CELL_RUDP_POLL_EV_WRITE = 0x0002, CELL_RUDP_POLL_EV_FLUSH = 0x0004, CELL_RUDP_POLL_EV_ERROR = 0x0008, diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSail.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSail.cpp index 76a6d3c6f..f12c2a6ee 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSail.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSail.cpp @@ -11,25 +11,25 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SAIL_ERROR_INVALID_ARG); - STR_CASE(CELL_SAIL_ERROR_INVALID_STATE); - STR_CASE(CELL_SAIL_ERROR_UNSUPPORTED_STREAM); - STR_CASE(CELL_SAIL_ERROR_INDEX_OUT_OF_RANGE); - STR_CASE(CELL_SAIL_ERROR_EMPTY); - STR_CASE(CELL_SAIL_ERROR_FULLED); - STR_CASE(CELL_SAIL_ERROR_USING); - STR_CASE(CELL_SAIL_ERROR_NOT_AVAILABLE); - STR_CASE(CELL_SAIL_ERROR_CANCEL); - STR_CASE(CELL_SAIL_ERROR_MEMORY); - STR_CASE(CELL_SAIL_ERROR_INVALID_FD); - STR_CASE(CELL_SAIL_ERROR_FATAL); - } + switch (error) + { + STR_CASE(CELL_SAIL_ERROR_INVALID_ARG); + STR_CASE(CELL_SAIL_ERROR_INVALID_STATE); + STR_CASE(CELL_SAIL_ERROR_UNSUPPORTED_STREAM); + STR_CASE(CELL_SAIL_ERROR_INDEX_OUT_OF_RANGE); + STR_CASE(CELL_SAIL_ERROR_EMPTY); + STR_CASE(CELL_SAIL_ERROR_FULLED); + STR_CASE(CELL_SAIL_ERROR_USING); + STR_CASE(CELL_SAIL_ERROR_NOT_AVAILABLE); + STR_CASE(CELL_SAIL_ERROR_CANCEL); + STR_CASE(CELL_SAIL_ERROR_MEMORY); + STR_CASE(CELL_SAIL_ERROR_INVALID_FD); + STR_CASE(CELL_SAIL_ERROR_FATAL); + } - return unknown; - }); + return unknown; + }); } error_code cellSailMemAllocatorInitialize(vm::ptr pSelf, vm::ptr pCallbacks) @@ -126,15 +126,15 @@ error_code cellSailDescriptorCreateDatabase(vm::ptr pSelf, v switch (pSelf->streamType) { - case CELL_SAIL_STREAM_PAMF: - { - u32 addr = pSelf->sp_; - auto ptr = vm::ptr::make(addr); - memcpy(pDatabase.get_ptr(), ptr.get_ptr(), sizeof(CellPamfReader)); - break; - } - default: - cellSail.error("Unhandled stream type: %d", pSelf->streamType); + case CELL_SAIL_STREAM_PAMF: + { + u32 addr = pSelf->sp_; + auto ptr = vm::ptr::make(addr); + memcpy(pDatabase.get_ptr(), ptr.get_ptr(), sizeof(CellPamfReader)); + break; + } + default: + cellSail.error("Unhandled stream type: %d", pSelf->streamType); } return CELL_OK; @@ -734,8 +734,8 @@ error_code cellSailPlayerSetParameter(vm::ptr pSelf, s32 paramet switch (parameterType) { case CELL_SAIL_PARAMETER_GRAPHICS_ADAPTER_BUFFER_RELEASE_DELAY: pSelf->graphics_adapter_buffer_release_delay = static_cast(param1); break; // TODO: Stream index - case CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_STACK_SIZE: pSelf->control_ppu_thread_stack_size = static_cast(param0); break; - case CELL_SAIL_PARAMETER_ENABLE_APOST_SRC: pSelf->enable_apost_src = static_cast(param1); break; // TODO: Stream index + case CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_STACK_SIZE: pSelf->control_ppu_thread_stack_size = static_cast(param0); break; + case CELL_SAIL_PARAMETER_ENABLE_APOST_SRC: pSelf->enable_apost_src = static_cast(param1); break; // TODO: Stream index default: cellSail.todo("cellSailPlayerSetParameter(): unimplemented parameter %s", ParameterCodeToName(parameterType)); } @@ -825,43 +825,43 @@ error_code cellSailPlayerCreateDescriptor(vm::ptr pSelf, s32 str descriptor->streamType = streamType; descriptor->registered = false; - //pSelf->descriptors = 0; + // pSelf->descriptors = 0; pSelf->repeatMode = 0; switch (streamType) { - case CELL_SAIL_STREAM_PAMF: + case CELL_SAIL_STREAM_PAMF: + { + std::string uri = pUri.get_ptr(); + if (uri.starts_with("x-cell-fs://")) { - std::string uri = pUri.get_ptr(); - if (uri.starts_with("x-cell-fs://")) + if (fs::file f{vfs::get(uri.substr(12))}) { - if (fs::file f{ vfs::get(uri.substr(12)) }) - { - u32 size = ::size32(f); - u32 buffer = vm::alloc(size, vm::main); - auto bufPtr = vm::cptr::make(buffer); - PamfHeader *buf = const_cast(bufPtr.get_ptr()); - ensure(f.read(buf, size) == size); - u32 sp_ = vm::alloc(sizeof(CellPamfReader), vm::main); - auto sp = vm::ptr::make(sp_); - [[maybe_unused]] u32 err = cellPamfReaderInitialize(sp, bufPtr, size, 0); + u32 size = ::size32(f); + u32 buffer = vm::alloc(size, vm::main); + auto bufPtr = vm::cptr::make(buffer); + PamfHeader* buf = const_cast(bufPtr.get_ptr()); + ensure(f.read(buf, size) == size); + u32 sp_ = vm::alloc(sizeof(CellPamfReader), vm::main); + auto sp = vm::ptr::make(sp_); + [[maybe_unused]] u32 err = cellPamfReaderInitialize(sp, bufPtr, size, 0); - descriptor->buffer = buffer; - descriptor->sp_ = sp_; - } - else - { - cellSail.warning("Couldn't open PAMF: %s", uri.c_str()); - } + descriptor->buffer = buffer; + descriptor->sp_ = sp_; } else { - cellSail.warning("Unhandled uri: %s", uri.c_str()); + cellSail.warning("Couldn't open PAMF: %s", uri.c_str()); } - break; } - default: - cellSail.error("Unhandled stream type: %d", streamType); + else + { + cellSail.warning("Unhandled uri: %s", uri.c_str()); + } + break; + } + default: + cellSail.error("Unhandled stream type: %d", streamType); } return CELL_OK; @@ -885,7 +885,7 @@ error_code cellSailPlayerRemoveDescriptor(vm::ptr pSelf, vm::ptr { ppDesc = pSelf->registeredDescriptors[pSelf->descriptors]; // TODO: Figure out how properly free a descriptor. Use game specified memory dealloc function? - //delete &pSelf->registeredDescriptors[pSelf->descriptors]; + // delete &pSelf->registeredDescriptors[pSelf->descriptors]; pSelf->descriptors--; } @@ -1062,148 +1062,148 @@ error_code cellSailPlayerUnregisterSource() } DECLARE(ppu_module_manager::cellSail)("cellSail", []() -{ - static ppu_static_module cellSailAvi("cellSailAvi"); - - [[maybe_unused]] vm::ptr> test; - - REG_FUNC(cellSail, cellSailMemAllocatorInitialize); - - REG_FUNC(cellSail, cellSailFutureInitialize); - REG_FUNC(cellSail, cellSailFutureFinalize); - REG_FUNC(cellSail, cellSailFutureReset); - REG_FUNC(cellSail, cellSailFutureSet); - REG_FUNC(cellSail, cellSailFutureGet); - REG_FUNC(cellSail, cellSailFutureIsDone); - - REG_FUNC(cellSail, cellSailDescriptorGetStreamType); - REG_FUNC(cellSail, cellSailDescriptorGetUri); - REG_FUNC(cellSail, cellSailDescriptorGetMediaInfo); - REG_FUNC(cellSail, cellSailDescriptorSetAutoSelection); - REG_FUNC(cellSail, cellSailDescriptorIsAutoSelection); - REG_FUNC(cellSail, cellSailDescriptorCreateDatabase); - REG_FUNC(cellSail, cellSailDescriptorDestroyDatabase); - REG_FUNC(cellSail, cellSailDescriptorOpen); - REG_FUNC(cellSail, cellSailDescriptorClose); - REG_FUNC(cellSail, cellSailDescriptorSetEs); - REG_FUNC(cellSail, cellSailDescriptorClearEs); - REG_FUNC(cellSail, cellSailDescriptorGetCapabilities); - REG_FUNC(cellSail, cellSailDescriptorInquireCapability); - REG_FUNC(cellSail, cellSailDescriptorSetParameter); - - REG_FUNC(cellSail, cellSailSoundAdapterInitialize); - REG_FUNC(cellSail, cellSailSoundAdapterFinalize); - REG_FUNC(cellSail, cellSailSoundAdapterSetPreferredFormat); - REG_FUNC(cellSail, cellSailSoundAdapterGetFrame); - REG_FUNC(cellSail, cellSailSoundAdapterGetFormat); - REG_FUNC(cellSail, cellSailSoundAdapterUpdateAvSync); - REG_FUNC(cellSail, cellSailSoundAdapterPtsToTimePosition); - - REG_FUNC(cellSail, cellSailGraphicsAdapterInitialize); - REG_FUNC(cellSail, cellSailGraphicsAdapterFinalize); - REG_FUNC(cellSail, cellSailGraphicsAdapterSetPreferredFormat); - REG_FUNC(cellSail, cellSailGraphicsAdapterGetFrame); - REG_FUNC(cellSail, cellSailGraphicsAdapterGetFrame2); - REG_FUNC(cellSail, cellSailGraphicsAdapterGetFormat); - REG_FUNC(cellSail, cellSailGraphicsAdapterUpdateAvSync); - REG_FUNC(cellSail, cellSailGraphicsAdapterPtsToTimePosition); - - REG_FUNC(cellSail, cellSailAuReceiverInitialize); - REG_FUNC(cellSail, cellSailAuReceiverFinalize); - REG_FUNC(cellSail, cellSailAuReceiverGet); - - REG_FUNC(cellSail, cellSailRendererAudioInitialize); - REG_FUNC(cellSail, cellSailRendererAudioFinalize); - REG_FUNC(cellSail, cellSailRendererAudioNotifyCallCompleted); - REG_FUNC(cellSail, cellSailRendererAudioNotifyFrameDone); - REG_FUNC(cellSail, cellSailRendererAudioNotifyOutputEos); - - REG_FUNC(cellSail, cellSailRendererVideoInitialize); - REG_FUNC(cellSail, cellSailRendererVideoFinalize); - REG_FUNC(cellSail, cellSailRendererVideoNotifyCallCompleted); - REG_FUNC(cellSail, cellSailRendererVideoNotifyFrameDone); - REG_FUNC(cellSail, cellSailRendererVideoNotifyOutputEos); - - REG_FUNC(cellSail, cellSailSourceInitialize); - REG_FUNC(cellSail, cellSailSourceFinalize); - REG_FUNC(cellSail, cellSailSourceNotifyCallCompleted); - REG_FUNC(cellSail, cellSailSourceNotifyInputEos); - REG_FUNC(cellSail, cellSailSourceNotifyStreamOut); - REG_FUNC(cellSail, cellSailSourceNotifySessionError); - REG_FUNC(cellSail, cellSailSourceNotifyMediaStateChanged); - REG_FUNC(cellSail, cellSailSourceSetDiagHandler); - { - // 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); - } + static ppu_static_module cellSailAvi("cellSailAvi"); - REG_FUNC(cellSail, cellSailMp4MovieGetBrand); - REG_FUNC(cellSail, cellSailMp4MovieIsCompatibleBrand); - REG_FUNC(cellSail, cellSailMp4MovieGetMovieInfo); - REG_FUNC(cellSail, cellSailMp4MovieGetTrackByIndex); - REG_FUNC(cellSail, cellSailMp4MovieGetTrackById); - REG_FUNC(cellSail, cellSailMp4MovieGetTrackByTypeAndIndex); - REG_FUNC(cellSail, cellSailMp4TrackGetTrackInfo); - REG_FUNC(cellSail, cellSailMp4TrackGetTrackReferenceCount); - REG_FUNC(cellSail, cellSailMp4TrackGetTrackReference); + [[maybe_unused]] vm::ptr> test; - REG_FUNC(cellSail, cellSailAviMovieGetMovieInfo); - REG_FUNC(cellSail, cellSailAviMovieGetStreamByIndex); - REG_FUNC(cellSail, cellSailAviMovieGetStreamByTypeAndIndex); - REG_FUNC(cellSail, cellSailAviMovieGetHeader); - REG_FUNC(cellSail, cellSailAviStreamGetMediaType); - REG_FUNC(cellSail, cellSailAviStreamGetHeader); + REG_FUNC(cellSail, cellSailMemAllocatorInitialize); - REG_FUNC(cellSail, cellSailPlayerInitialize); - REG_FUNC(cellSail, cellSailPlayerInitialize2); - REG_FUNC(cellSail, cellSailPlayerFinalize); - REG_FUNC(cellSail, cellSailPlayerRegisterSource); - REG_FUNC(cellSail, cellSailPlayerGetRegisteredProtocols); - REG_FUNC(cellSail, cellSailPlayerSetSoundAdapter); - REG_FUNC(cellSail, cellSailPlayerSetGraphicsAdapter); - REG_FUNC(cellSail, cellSailPlayerSetAuReceiver); - REG_FUNC(cellSail, cellSailPlayerSetRendererAudio); - REG_FUNC(cellSail, cellSailPlayerSetRendererVideo); - REG_FUNC(cellSail, cellSailPlayerSetParameter); - REG_FUNC(cellSail, cellSailPlayerGetParameter); - REG_FUNC(cellSail, cellSailPlayerSubscribeEvent); - REG_FUNC(cellSail, cellSailPlayerUnsubscribeEvent); - REG_FUNC(cellSail, cellSailPlayerReplaceEventHandler); - REG_FUNC(cellSail, cellSailPlayerBoot); - REG_FUNC(cellSail, cellSailPlayerCreateDescriptor); - REG_FUNC(cellSail, cellSailPlayerDestroyDescriptor); - REG_FUNC(cellSail, cellSailPlayerAddDescriptor); - REG_FUNC(cellSail, cellSailPlayerRemoveDescriptor); - REG_FUNC(cellSail, cellSailPlayerGetDescriptorCount); - REG_FUNC(cellSail, cellSailPlayerGetCurrentDescriptor); - REG_FUNC(cellSail, cellSailPlayerOpenStream); - REG_FUNC(cellSail, cellSailPlayerCloseStream); - REG_FUNC(cellSail, cellSailPlayerOpenEsAudio); - REG_FUNC(cellSail, cellSailPlayerOpenEsVideo); - REG_FUNC(cellSail, cellSailPlayerOpenEsUser); - REG_FUNC(cellSail, cellSailPlayerReopenEsAudio); - REG_FUNC(cellSail, cellSailPlayerReopenEsVideo); - REG_FUNC(cellSail, cellSailPlayerReopenEsUser); - REG_FUNC(cellSail, cellSailPlayerCloseEsAudio); - REG_FUNC(cellSail, cellSailPlayerCloseEsVideo); - REG_FUNC(cellSail, cellSailPlayerCloseEsUser); - REG_FUNC(cellSail, cellSailPlayerStart); - REG_FUNC(cellSail, cellSailPlayerStop); - REG_FUNC(cellSail, cellSailPlayerNext); - REG_FUNC(cellSail, cellSailPlayerCancel); - REG_FUNC(cellSail, cellSailPlayerSetPaused); - REG_FUNC(cellSail, cellSailPlayerIsPaused); - REG_FUNC(cellSail, cellSailPlayerSetRepeatMode); - REG_FUNC(cellSail, cellSailPlayerGetRepeatMode); - REG_FUNC(cellSail, cellSailPlayerSetEsAudioMuted); - REG_FUNC(cellSail, cellSailPlayerSetEsVideoMuted); - REG_FUNC(cellSail, cellSailPlayerIsEsAudioMuted); - REG_FUNC(cellSail, cellSailPlayerIsEsVideoMuted); - REG_FUNC(cellSail, cellSailPlayerDumpImage); - REG_FUNC(cellSail, cellSailPlayerUnregisterSource); -}); + REG_FUNC(cellSail, cellSailFutureInitialize); + REG_FUNC(cellSail, cellSailFutureFinalize); + REG_FUNC(cellSail, cellSailFutureReset); + REG_FUNC(cellSail, cellSailFutureSet); + REG_FUNC(cellSail, cellSailFutureGet); + REG_FUNC(cellSail, cellSailFutureIsDone); + + REG_FUNC(cellSail, cellSailDescriptorGetStreamType); + REG_FUNC(cellSail, cellSailDescriptorGetUri); + REG_FUNC(cellSail, cellSailDescriptorGetMediaInfo); + REG_FUNC(cellSail, cellSailDescriptorSetAutoSelection); + REG_FUNC(cellSail, cellSailDescriptorIsAutoSelection); + REG_FUNC(cellSail, cellSailDescriptorCreateDatabase); + REG_FUNC(cellSail, cellSailDescriptorDestroyDatabase); + REG_FUNC(cellSail, cellSailDescriptorOpen); + REG_FUNC(cellSail, cellSailDescriptorClose); + REG_FUNC(cellSail, cellSailDescriptorSetEs); + REG_FUNC(cellSail, cellSailDescriptorClearEs); + REG_FUNC(cellSail, cellSailDescriptorGetCapabilities); + REG_FUNC(cellSail, cellSailDescriptorInquireCapability); + REG_FUNC(cellSail, cellSailDescriptorSetParameter); + + REG_FUNC(cellSail, cellSailSoundAdapterInitialize); + REG_FUNC(cellSail, cellSailSoundAdapterFinalize); + REG_FUNC(cellSail, cellSailSoundAdapterSetPreferredFormat); + REG_FUNC(cellSail, cellSailSoundAdapterGetFrame); + REG_FUNC(cellSail, cellSailSoundAdapterGetFormat); + REG_FUNC(cellSail, cellSailSoundAdapterUpdateAvSync); + REG_FUNC(cellSail, cellSailSoundAdapterPtsToTimePosition); + + REG_FUNC(cellSail, cellSailGraphicsAdapterInitialize); + REG_FUNC(cellSail, cellSailGraphicsAdapterFinalize); + REG_FUNC(cellSail, cellSailGraphicsAdapterSetPreferredFormat); + REG_FUNC(cellSail, cellSailGraphicsAdapterGetFrame); + REG_FUNC(cellSail, cellSailGraphicsAdapterGetFrame2); + REG_FUNC(cellSail, cellSailGraphicsAdapterGetFormat); + REG_FUNC(cellSail, cellSailGraphicsAdapterUpdateAvSync); + REG_FUNC(cellSail, cellSailGraphicsAdapterPtsToTimePosition); + + REG_FUNC(cellSail, cellSailAuReceiverInitialize); + REG_FUNC(cellSail, cellSailAuReceiverFinalize); + REG_FUNC(cellSail, cellSailAuReceiverGet); + + REG_FUNC(cellSail, cellSailRendererAudioInitialize); + REG_FUNC(cellSail, cellSailRendererAudioFinalize); + REG_FUNC(cellSail, cellSailRendererAudioNotifyCallCompleted); + REG_FUNC(cellSail, cellSailRendererAudioNotifyFrameDone); + REG_FUNC(cellSail, cellSailRendererAudioNotifyOutputEos); + + REG_FUNC(cellSail, cellSailRendererVideoInitialize); + REG_FUNC(cellSail, cellSailRendererVideoFinalize); + REG_FUNC(cellSail, cellSailRendererVideoNotifyCallCompleted); + REG_FUNC(cellSail, cellSailRendererVideoNotifyFrameDone); + REG_FUNC(cellSail, cellSailRendererVideoNotifyOutputEos); + + REG_FUNC(cellSail, cellSailSourceInitialize); + REG_FUNC(cellSail, cellSailSourceFinalize); + REG_FUNC(cellSail, cellSailSourceNotifyCallCompleted); + REG_FUNC(cellSail, cellSailSourceNotifyInputEos); + REG_FUNC(cellSail, cellSailSourceNotifyStreamOut); + REG_FUNC(cellSail, cellSailSourceNotifySessionError); + REG_FUNC(cellSail, cellSailSourceNotifyMediaStateChanged); + REG_FUNC(cellSail, cellSailSourceSetDiagHandler); + + { + // 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); + REG_FUNC(cellSail, cellSailMp4MovieGetMovieInfo); + REG_FUNC(cellSail, cellSailMp4MovieGetTrackByIndex); + REG_FUNC(cellSail, cellSailMp4MovieGetTrackById); + REG_FUNC(cellSail, cellSailMp4MovieGetTrackByTypeAndIndex); + REG_FUNC(cellSail, cellSailMp4TrackGetTrackInfo); + REG_FUNC(cellSail, cellSailMp4TrackGetTrackReferenceCount); + REG_FUNC(cellSail, cellSailMp4TrackGetTrackReference); + + REG_FUNC(cellSail, cellSailAviMovieGetMovieInfo); + REG_FUNC(cellSail, cellSailAviMovieGetStreamByIndex); + REG_FUNC(cellSail, cellSailAviMovieGetStreamByTypeAndIndex); + REG_FUNC(cellSail, cellSailAviMovieGetHeader); + REG_FUNC(cellSail, cellSailAviStreamGetMediaType); + REG_FUNC(cellSail, cellSailAviStreamGetHeader); + + REG_FUNC(cellSail, cellSailPlayerInitialize); + REG_FUNC(cellSail, cellSailPlayerInitialize2); + REG_FUNC(cellSail, cellSailPlayerFinalize); + REG_FUNC(cellSail, cellSailPlayerRegisterSource); + REG_FUNC(cellSail, cellSailPlayerGetRegisteredProtocols); + REG_FUNC(cellSail, cellSailPlayerSetSoundAdapter); + REG_FUNC(cellSail, cellSailPlayerSetGraphicsAdapter); + REG_FUNC(cellSail, cellSailPlayerSetAuReceiver); + REG_FUNC(cellSail, cellSailPlayerSetRendererAudio); + REG_FUNC(cellSail, cellSailPlayerSetRendererVideo); + REG_FUNC(cellSail, cellSailPlayerSetParameter); + REG_FUNC(cellSail, cellSailPlayerGetParameter); + REG_FUNC(cellSail, cellSailPlayerSubscribeEvent); + REG_FUNC(cellSail, cellSailPlayerUnsubscribeEvent); + REG_FUNC(cellSail, cellSailPlayerReplaceEventHandler); + REG_FUNC(cellSail, cellSailPlayerBoot); + REG_FUNC(cellSail, cellSailPlayerCreateDescriptor); + REG_FUNC(cellSail, cellSailPlayerDestroyDescriptor); + REG_FUNC(cellSail, cellSailPlayerAddDescriptor); + REG_FUNC(cellSail, cellSailPlayerRemoveDescriptor); + REG_FUNC(cellSail, cellSailPlayerGetDescriptorCount); + REG_FUNC(cellSail, cellSailPlayerGetCurrentDescriptor); + REG_FUNC(cellSail, cellSailPlayerOpenStream); + REG_FUNC(cellSail, cellSailPlayerCloseStream); + REG_FUNC(cellSail, cellSailPlayerOpenEsAudio); + REG_FUNC(cellSail, cellSailPlayerOpenEsVideo); + REG_FUNC(cellSail, cellSailPlayerOpenEsUser); + REG_FUNC(cellSail, cellSailPlayerReopenEsAudio); + REG_FUNC(cellSail, cellSailPlayerReopenEsVideo); + REG_FUNC(cellSail, cellSailPlayerReopenEsUser); + REG_FUNC(cellSail, cellSailPlayerCloseEsAudio); + REG_FUNC(cellSail, cellSailPlayerCloseEsVideo); + REG_FUNC(cellSail, cellSailPlayerCloseEsUser); + REG_FUNC(cellSail, cellSailPlayerStart); + REG_FUNC(cellSail, cellSailPlayerStop); + REG_FUNC(cellSail, cellSailPlayerNext); + REG_FUNC(cellSail, cellSailPlayerCancel); + REG_FUNC(cellSail, cellSailPlayerSetPaused); + REG_FUNC(cellSail, cellSailPlayerIsPaused); + REG_FUNC(cellSail, cellSailPlayerSetRepeatMode); + REG_FUNC(cellSail, cellSailPlayerGetRepeatMode); + REG_FUNC(cellSail, cellSailPlayerSetEsAudioMuted); + REG_FUNC(cellSail, cellSailPlayerSetEsVideoMuted); + REG_FUNC(cellSail, cellSailPlayerIsEsAudioMuted); + REG_FUNC(cellSail, cellSailPlayerIsEsVideoMuted); + REG_FUNC(cellSail, cellSailPlayerDumpImage); + REG_FUNC(cellSail, cellSailPlayerUnregisterSource); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSail.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellSail.h index 91e66dc5f..3cd78a5fd 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSail.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSail.h @@ -6,39 +6,39 @@ // Error Codes enum CellSailError : u32 { - CELL_SAIL_ERROR_INVALID_ARG = 0x80610701, - CELL_SAIL_ERROR_INVALID_STATE = 0x80610702, + CELL_SAIL_ERROR_INVALID_ARG = 0x80610701, + CELL_SAIL_ERROR_INVALID_STATE = 0x80610702, CELL_SAIL_ERROR_UNSUPPORTED_STREAM = 0x80610703, CELL_SAIL_ERROR_INDEX_OUT_OF_RANGE = 0x80610704, - CELL_SAIL_ERROR_EMPTY = 0x80610705, - CELL_SAIL_ERROR_FULLED = 0x80610706, - CELL_SAIL_ERROR_USING = 0x80610707, - CELL_SAIL_ERROR_NOT_AVAILABLE = 0x80610708, - CELL_SAIL_ERROR_CANCEL = 0x80610709, - CELL_SAIL_ERROR_MEMORY = 0x806107F0, - CELL_SAIL_ERROR_INVALID_FD = 0x806107F1, - CELL_SAIL_ERROR_FATAL = 0x806107FF, + CELL_SAIL_ERROR_EMPTY = 0x80610705, + CELL_SAIL_ERROR_FULLED = 0x80610706, + CELL_SAIL_ERROR_USING = 0x80610707, + CELL_SAIL_ERROR_NOT_AVAILABLE = 0x80610708, + CELL_SAIL_ERROR_CANCEL = 0x80610709, + CELL_SAIL_ERROR_MEMORY = 0x806107F0, + CELL_SAIL_ERROR_INVALID_FD = 0x806107F1, + CELL_SAIL_ERROR_FATAL = 0x806107FF, }; // Call types enum { - CELL_SAIL_PLAYER_CALL_NONE = 0, - CELL_SAIL_PLAYER_CALL_BOOT = 1, - CELL_SAIL_PLAYER_CALL_OPEN_STREAM = 2, - CELL_SAIL_PLAYER_CALL_CLOSE_STREAM = 3, - CELL_SAIL_PLAYER_CALL_OPEN_ES_AUDIO = 4, - CELL_SAIL_PLAYER_CALL_OPEN_ES_VIDEO = 5, - CELL_SAIL_PLAYER_CALL_OPEN_ES_USER = 6, - CELL_SAIL_PLAYER_CALL_CLOSE_ES_AUDIO = 7, - CELL_SAIL_PLAYER_CALL_CLOSE_ES_VIDEO = 8, - CELL_SAIL_PLAYER_CALL_CLOSE_ES_USER = 9, - CELL_SAIL_PLAYER_CALL_START = 10, - CELL_SAIL_PLAYER_CALL_STOP = 11, - CELL_SAIL_PLAYER_CALL_NEXT = 12, - CELL_SAIL_PLAYER_CALL_REOPEN_ES_AUDIO = 13, - CELL_SAIL_PLAYER_CALL_REOPEN_ES_VIDEO = 14, - CELL_SAIL_PLAYER_CALL_REOPEN_ES_USER = 15, + CELL_SAIL_PLAYER_CALL_NONE = 0, + CELL_SAIL_PLAYER_CALL_BOOT = 1, + CELL_SAIL_PLAYER_CALL_OPEN_STREAM = 2, + CELL_SAIL_PLAYER_CALL_CLOSE_STREAM = 3, + CELL_SAIL_PLAYER_CALL_OPEN_ES_AUDIO = 4, + CELL_SAIL_PLAYER_CALL_OPEN_ES_VIDEO = 5, + CELL_SAIL_PLAYER_CALL_OPEN_ES_USER = 6, + CELL_SAIL_PLAYER_CALL_CLOSE_ES_AUDIO = 7, + CELL_SAIL_PLAYER_CALL_CLOSE_ES_VIDEO = 8, + CELL_SAIL_PLAYER_CALL_CLOSE_ES_USER = 9, + CELL_SAIL_PLAYER_CALL_START = 10, + CELL_SAIL_PLAYER_CALL_STOP = 11, + CELL_SAIL_PLAYER_CALL_NEXT = 12, + CELL_SAIL_PLAYER_CALL_REOPEN_ES_AUDIO = 13, + CELL_SAIL_PLAYER_CALL_REOPEN_ES_VIDEO = 14, + CELL_SAIL_PLAYER_CALL_REOPEN_ES_USER = 15, _CELL_SAIL_PLAYER_CALL_TYPE_NUM_OF_ELEMENTS = 16, // Never used? }; @@ -46,46 +46,46 @@ enum // State types enum { - CELL_SAIL_PLAYER_STATE_INITIALIZED = 0, - CELL_SAIL_PLAYER_STATE_BOOT_TRANSITION = 1, - CELL_SAIL_PLAYER_STATE_CLOSED = 2, - CELL_SAIL_PLAYER_STATE_OPEN_TRANSITION = 3, - CELL_SAIL_PLAYER_STATE_OPENED = 4, - CELL_SAIL_PLAYER_STATE_START_TRANSITION = 5, - CELL_SAIL_PLAYER_STATE_RUNNING = 6, - CELL_SAIL_PLAYER_STATE_STOP_TRANSITION = 7, - CELL_SAIL_PLAYER_STATE_CLOSE_TRANSITION = 8, - CELL_SAIL_PLAYER_STATE_LOST = 9, + CELL_SAIL_PLAYER_STATE_INITIALIZED = 0, + CELL_SAIL_PLAYER_STATE_BOOT_TRANSITION = 1, + CELL_SAIL_PLAYER_STATE_CLOSED = 2, + CELL_SAIL_PLAYER_STATE_OPEN_TRANSITION = 3, + CELL_SAIL_PLAYER_STATE_OPENED = 4, + CELL_SAIL_PLAYER_STATE_START_TRANSITION = 5, + CELL_SAIL_PLAYER_STATE_RUNNING = 6, + CELL_SAIL_PLAYER_STATE_STOP_TRANSITION = 7, + CELL_SAIL_PLAYER_STATE_CLOSE_TRANSITION = 8, + CELL_SAIL_PLAYER_STATE_LOST = 9, _CELL_SAIL_PLAYER_STATE_TYPE_NUM_OF_ELEMENTS = 10, // Never used? }; // Preset types enum { - CELL_SAIL_PLAYER_PRESET_AV_SYNC = 0, // Deprecated, same as 59_94HZ - CELL_SAIL_PLAYER_PRESET_AS_IS = 1, - CELL_SAIL_PLAYER_PRESET_AV_SYNC_59_94HZ = 2, - CELL_SAIL_PLAYER_PRESET_AV_SYNC_29_97HZ = 3, - CELL_SAIL_PLAYER_PRESET_AV_SYNC_50HZ = 4, - CELL_SAIL_PLAYER_PRESET_AV_SYNC_25HZ = 5, + CELL_SAIL_PLAYER_PRESET_AV_SYNC = 0, // Deprecated, same as 59_94HZ + CELL_SAIL_PLAYER_PRESET_AS_IS = 1, + CELL_SAIL_PLAYER_PRESET_AV_SYNC_59_94HZ = 2, + CELL_SAIL_PLAYER_PRESET_AV_SYNC_29_97HZ = 3, + CELL_SAIL_PLAYER_PRESET_AV_SYNC_50HZ = 4, + CELL_SAIL_PLAYER_PRESET_AV_SYNC_25HZ = 5, CELL_SAIL_PLAYER_PRESET_AV_SYNC_AUTO_DETECT = 6, }; // Event types enum { - CELL_SAIL_EVENT_EMPTY = 0, // NEVER USED - CELL_SAIL_EVENT_ERROR_OCCURED = 1, + CELL_SAIL_EVENT_EMPTY = 0, // NEVER USED + CELL_SAIL_EVENT_ERROR_OCCURED = 1, CELL_SAIL_EVENT_PLAYER_CALL_COMPLETED = 2, - CELL_SAIL_EVENT_PLAYER_STATE_CHANGED = 3, - CELL_SAIL_EVENT_STREAM_OPENED = 4, - CELL_SAIL_EVENT_STREAM_CLOSED = 5, - CELL_SAIL_EVENT_SESSION_STARTED = 6, - CELL_SAIL_EVENT_PAUSE_STATE_CHANGED = 7, - CELL_SAIL_EVENT_SOURCE_EOS = 8, - CELL_SAIL_EVENT_ES_OPENED = 9, - CELL_SAIL_EVENT_ES_CLOSED = 10, - CELL_SAIL_EVENT_MEDIA_STATE_CHANGED = 11, + CELL_SAIL_EVENT_PLAYER_STATE_CHANGED = 3, + CELL_SAIL_EVENT_STREAM_OPENED = 4, + CELL_SAIL_EVENT_STREAM_CLOSED = 5, + CELL_SAIL_EVENT_SESSION_STARTED = 6, + CELL_SAIL_EVENT_PAUSE_STATE_CHANGED = 7, + CELL_SAIL_EVENT_SOURCE_EOS = 8, + CELL_SAIL_EVENT_ES_OPENED = 9, + CELL_SAIL_EVENT_ES_CLOSED = 10, + CELL_SAIL_EVENT_MEDIA_STATE_CHANGED = 11, _CELL_SAIL_EVENT_TYPE_NUM_OF_ELEMENTS = 12, // DO NOT USE }; @@ -93,79 +93,79 @@ enum // Parameter types enum { - CELL_SAIL_PARAMETER_ENABLE_VPOST = 0, + CELL_SAIL_PARAMETER_ENABLE_VPOST = 0, // Player - CELL_SAIL_PARAMETER_CONTROL_QUEUE_DEPTH = 1, - CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_PRIORITY = 2, + CELL_SAIL_PARAMETER_CONTROL_QUEUE_DEPTH = 1, + CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_PRIORITY = 2, // SPURS - CELL_SAIL_PARAMETER_SPURS_NUM_OF_SPUS = 3, - CELL_SAIL_PARAMETER_SPURS_SPU_THREAD_PRIORITY = 4, - CELL_SAIL_PARAMETER_SPURS_PPU_THREAD_PRIORITY = 5, - CELL_SAIL_PARAMETER_SPURS_EXIT_IF_NO_WORK = 6, + CELL_SAIL_PARAMETER_SPURS_NUM_OF_SPUS = 3, + CELL_SAIL_PARAMETER_SPURS_SPU_THREAD_PRIORITY = 4, + CELL_SAIL_PARAMETER_SPURS_PPU_THREAD_PRIORITY = 5, + CELL_SAIL_PARAMETER_SPURS_EXIT_IF_NO_WORK = 6, // Source - CELL_SAIL_PARAMETER_IO_PPU_THREAD_PRIORITY = 7, + CELL_SAIL_PARAMETER_IO_PPU_THREAD_PRIORITY = 7, // Dmux - CELL_SAIL_PARAMETER_DMUX_PPU_THREAD_PRIORITY = 8, - CELL_SAIL_PARAMETER_DMUX_SPU_THREAD_PRIORITY = 9, // Deprecated - CELL_SAIL_PARAMETER_DMUX_NUM_OF_SPUS = 10, - CELL_SAIL_PARAMETER_DMUX_SPURS_TASK_PRIORITIES = 11, + CELL_SAIL_PARAMETER_DMUX_PPU_THREAD_PRIORITY = 8, + CELL_SAIL_PARAMETER_DMUX_SPU_THREAD_PRIORITY = 9, // Deprecated + CELL_SAIL_PARAMETER_DMUX_NUM_OF_SPUS = 10, + CELL_SAIL_PARAMETER_DMUX_SPURS_TASK_PRIORITIES = 11, // Adec - CELL_SAIL_PARAMETER_ADEC_PPU_THREAD_PRIORITY = 12, - CELL_SAIL_PARAMETER_ADEC_SPU_THREAD_PRIORITY = 13, // Deprecated - CELL_SAIL_PARAMETER_ADEC_NUM_OF_SPUS = 14, - CELL_SAIL_PARAMETER_ADEC_SPURS_TASK_PRIORITIES = 15, + CELL_SAIL_PARAMETER_ADEC_PPU_THREAD_PRIORITY = 12, + CELL_SAIL_PARAMETER_ADEC_SPU_THREAD_PRIORITY = 13, // Deprecated + CELL_SAIL_PARAMETER_ADEC_NUM_OF_SPUS = 14, + CELL_SAIL_PARAMETER_ADEC_SPURS_TASK_PRIORITIES = 15, // Vdec - CELL_SAIL_PARAMETER_VDEC_PPU_THREAD_PRIORITY = 16, - CELL_SAIL_PARAMETER_VDEC_SPU_THREAD_PRIORITY = 17, // Deprecated - CELL_SAIL_PARAMETER_VDEC_M2V_NUM_OF_SPUS = 18, - CELL_SAIL_PARAMETER_VDEC_AVC_NUM_OF_SPUS = 19, - CELL_SAIL_PARAMETER_VDEC_SPURS_TASK_PRIORITIES = 20, + CELL_SAIL_PARAMETER_VDEC_PPU_THREAD_PRIORITY = 16, + CELL_SAIL_PARAMETER_VDEC_SPU_THREAD_PRIORITY = 17, // Deprecated + CELL_SAIL_PARAMETER_VDEC_M2V_NUM_OF_SPUS = 18, + CELL_SAIL_PARAMETER_VDEC_AVC_NUM_OF_SPUS = 19, + CELL_SAIL_PARAMETER_VDEC_SPURS_TASK_PRIORITIES = 20, // Vpost */ - CELL_SAIL_PARAMETER_VPOST_PPU_THREAD_PRIORITY = 21, // Deprecated - CELL_SAIL_PARAMETER_VPOST_SPU_THREAD_PRIORITY = 22, // Deprecated - CELL_SAIL_PARAMETER_VPOST_NUM_OF_SPUS = 23, - CELL_SAIL_PARAMETER_VPOST_SPURS_TASK_PRIORITIES = 24, + CELL_SAIL_PARAMETER_VPOST_PPU_THREAD_PRIORITY = 21, // Deprecated + CELL_SAIL_PARAMETER_VPOST_SPU_THREAD_PRIORITY = 22, // Deprecated + CELL_SAIL_PARAMETER_VPOST_NUM_OF_SPUS = 23, + CELL_SAIL_PARAMETER_VPOST_SPURS_TASK_PRIORITIES = 24, // Graphics Adapter CELL_SAIL_PARAMETER_GRAPHICS_ADAPTER_BUFFER_RELEASE_DELAY = 25, // AV Sync - CELL_SAIL_PARAMETER_AV_SYNC_ES_AUDIO = 26, - CELL_SAIL_PARAMETER_AV_SYNC_ES_VIDEO = 27, - CELL_SAIL_PARAMETER_AV_SYNC_ES_USER = 28, // Not available + CELL_SAIL_PARAMETER_AV_SYNC_ES_AUDIO = 26, + CELL_SAIL_PARAMETER_AV_SYNC_ES_VIDEO = 27, + CELL_SAIL_PARAMETER_AV_SYNC_ES_USER = 28, // Not available // Control - CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_STACK_SIZE = 29, - CELL_SAIL_PARAMETER_RESERVED0_ = 30, // Should be never used - CELL_SAIL_PARAMETER_RESERVED1 = 31, // Should be never used + CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_STACK_SIZE = 29, + CELL_SAIL_PARAMETER_RESERVED0_ = 30, // Should be never used + CELL_SAIL_PARAMETER_RESERVED1 = 31, // Should be never used // Apost - CELL_SAIL_PARAMETER_ENABLE_APOST_SRC = 32, + CELL_SAIL_PARAMETER_ENABLE_APOST_SRC = 32, // File I/O Interface - CELL_SAIL_PARAMETER_FS = 33, - CELL_SAIL_PARAMETER_IO_PPU_THREAD_STACK_SIZE = 34, - CELL_SAIL_PARAMETER_VIDEO_PERFORMANCE_POLICY = 35, - _CELL_SAIL_PARAMETER_TYPE_NUM_OF_ELEMENTS = 36, // Should be never used - CELL_SAIL_PARAMETER_SOURCE_PPU_THREAD_PRIORITY = CELL_SAIL_PARAMETER_IO_PPU_THREAD_PRIORITY, - CELL_SAIL_PARAMETER_DMUX_SPURS_TASK_PRIORITY = CELL_SAIL_PARAMETER_DMUX_SPURS_TASK_PRIORITIES, // Deprecated - CELL_SAIL_PARAMETER_VDEC_SPURS_TASK_PRIORITY = CELL_SAIL_PARAMETER_VDEC_SPURS_TASK_PRIORITIES, // Deprecated - CELL_SAIL_PARAMETER_ADEC_SPURS_TASK_PRIORITY = CELL_SAIL_PARAMETER_ADEC_SPURS_TASK_PRIORITIES, // Deprecated - CELL_SAIL_PARAMETER_VPOST_SPURS_TASK_PRIORITY = CELL_SAIL_PARAMETER_VPOST_SPURS_TASK_PRIORITIES, // Deprecated + CELL_SAIL_PARAMETER_FS = 33, + CELL_SAIL_PARAMETER_IO_PPU_THREAD_STACK_SIZE = 34, + CELL_SAIL_PARAMETER_VIDEO_PERFORMANCE_POLICY = 35, + _CELL_SAIL_PARAMETER_TYPE_NUM_OF_ELEMENTS = 36, // Should be never used + CELL_SAIL_PARAMETER_SOURCE_PPU_THREAD_PRIORITY = CELL_SAIL_PARAMETER_IO_PPU_THREAD_PRIORITY, + CELL_SAIL_PARAMETER_DMUX_SPURS_TASK_PRIORITY = CELL_SAIL_PARAMETER_DMUX_SPURS_TASK_PRIORITIES, // Deprecated + CELL_SAIL_PARAMETER_VDEC_SPURS_TASK_PRIORITY = CELL_SAIL_PARAMETER_VDEC_SPURS_TASK_PRIORITIES, // Deprecated + CELL_SAIL_PARAMETER_ADEC_SPURS_TASK_PRIORITY = CELL_SAIL_PARAMETER_ADEC_SPURS_TASK_PRIORITIES, // Deprecated + CELL_SAIL_PARAMETER_VPOST_SPURS_TASK_PRIORITY = CELL_SAIL_PARAMETER_VPOST_SPURS_TASK_PRIORITIES, // Deprecated }; // Media states enum { CELL_SAIL_MEDIA_STATE_FINE = 0, - CELL_SAIL_MEDIA_STATE_BAD = 1, + CELL_SAIL_MEDIA_STATE_BAD = 1, CELL_SAIL_MEDIA_STATE_LOST = 2, }; @@ -173,8 +173,8 @@ enum enum { CELL_SAIL_STREAM_PAMF = 0, - CELL_SAIL_STREAM_MP4 = 1, - CELL_SAIL_STREAM_AVI = 2, + CELL_SAIL_STREAM_MP4 = 1, + CELL_SAIL_STREAM_AVI = 2, CELL_SAIL_STREAM_UNSPECIFIED = -1, }; @@ -183,20 +183,21 @@ enum enum { CELL_SAIL_SYNC_MODE_REPEAT = 1 << 0, - CELL_SAIL_SYNC_MODE_SKIP = 1 << 1, + CELL_SAIL_SYNC_MODE_SKIP = 1 << 1, }; // Flags -enum { - CELL_SAIL_AVISF_DISABLED = 0x00000001, - CELL_SAIL_AVIF_HASINDEX = 0x00000010, - CELL_SAIL_AVIF_MUSTUSEINDEX = 0x00000020, - CELL_SAIL_AVIF_ISINTERLEAVED = 0x00000100, - CELL_SAIL_AVIF_WASCAPTUREFILE = 0x00010000, +enum +{ + CELL_SAIL_AVISF_DISABLED = 0x00000001, + CELL_SAIL_AVIF_HASINDEX = 0x00000010, + CELL_SAIL_AVIF_MUSTUSEINDEX = 0x00000020, + CELL_SAIL_AVIF_ISINTERLEAVED = 0x00000100, + CELL_SAIL_AVIF_WASCAPTUREFILE = 0x00010000, CELL_SAIL_AVISF_VIDEO_PALCHANGES = 0x00010000, - CELL_SAIL_AVIF_COPYRIGHTED = 0x00020000, + CELL_SAIL_AVIF_COPYRIGHTED = 0x00020000, - CELL_SAIL_AVIF_TRUSTCKTYPE = 0x00000800, // Open-DML only + CELL_SAIL_AVIF_TRUSTCKTYPE = 0x00000800, // Open-DML only }; // Wave types @@ -220,31 +221,31 @@ enum // MPEG Modes enum { - CELL_SAIL_ACM_MPEG_STEREO = 0x0001, - CELL_SAIL_ACM_MPEG_JOINTSTEREO = 0x0002, - CELL_SAIL_ACM_MPEG_DUALCHANNEL = 0x0004, + CELL_SAIL_ACM_MPEG_STEREO = 0x0001, + CELL_SAIL_ACM_MPEG_JOINTSTEREO = 0x0002, + CELL_SAIL_ACM_MPEG_DUALCHANNEL = 0x0004, CELL_SAIL_ACM_MPEG_SINGLECHANNEL = 0x0008, }; // MPEG Flags enum { - CELL_SAIL_ACM_MPEG_PRIVATEBIT = 0x0001, - CELL_SAIL_ACM_MPEG_COPYRIGHT = 0x0002, - CELL_SAIL_ACM_MPEG_ORIGINALHOME = 0x0004, + CELL_SAIL_ACM_MPEG_PRIVATEBIT = 0x0001, + CELL_SAIL_ACM_MPEG_COPYRIGHT = 0x0002, + CELL_SAIL_ACM_MPEG_ORIGINALHOME = 0x0004, CELL_SAIL_ACM_MPEG_PROTECTIONBIT = 0x0008, - CELL_SAIL_ACM_MPEG_ID_MPEG1 = 0x0010, + CELL_SAIL_ACM_MPEG_ID_MPEG1 = 0x0010, }; // MPEG Layer 3 Flags enum { - CELL_SAIL_MPEGLAYER3_ID_UNKNOWN = 0, - CELL_SAIL_MPEGLAYER3_ID_MPEG = 1, + CELL_SAIL_MPEGLAYER3_ID_UNKNOWN = 0, + CELL_SAIL_MPEGLAYER3_ID_MPEG = 1, CELL_SAIL_MPEGLAYER3_ID_CONSTANTFRAMESIZE = 2, - CELL_SAIL_MPEGLAYER3_FLAG_PADDING_ISO = 0x00000000, - CELL_SAIL_MPEGLAYER3_FLAG_PADDING_ON = 0x00000001, - CELL_SAIL_MPEGLAYER3_FLAG_PADDING_OFF = 0x00000002, + CELL_SAIL_MPEGLAYER3_FLAG_PADDING_ISO = 0x00000000, + CELL_SAIL_MPEGLAYER3_FLAG_PADDING_ON = 0x00000001, + CELL_SAIL_MPEGLAYER3_FLAG_PADDING_OFF = 0x00000002, }; // ES Types @@ -252,86 +253,86 @@ enum { CELL_SAIL_ES_AUDIO = 0, CELL_SAIL_ES_VIDEO = 1, - CELL_SAIL_ES_USER = 2, + CELL_SAIL_ES_USER = 2, }; // Audio Coding Types enum { - CELL_SAIL_AUDIO_CODING_UNSPECIFIED = -1, + CELL_SAIL_AUDIO_CODING_UNSPECIFIED = -1, CELL_SAIL_AUDIO_CODING_LPCM_FLOAT32 = 1, }; enum { - CELL_SAIL_AUDIO_CHNUM_UNSPECIFIED = -1, - CELL_SAIL_AUDIO_CH_NUM_UNSPECIFIED = -1, - CELL_SAIL_AUDIO_AUSAMPLE_UNSPECIFIED = -1, + CELL_SAIL_AUDIO_CHNUM_UNSPECIFIED = -1, + CELL_SAIL_AUDIO_CH_NUM_UNSPECIFIED = -1, + CELL_SAIL_AUDIO_AUSAMPLE_UNSPECIFIED = -1, CELL_SAIL_AUDIO_SAMPLE_NUM_UNSPECIFIED = -1, }; enum { - CELL_SAIL_AUDIO_FS_32000HZ = 32000, - CELL_SAIL_AUDIO_FS_44100HZ = 44100, - CELL_SAIL_AUDIO_FS_48000HZ = 48000, + CELL_SAIL_AUDIO_FS_32000HZ = 32000, + CELL_SAIL_AUDIO_FS_44100HZ = 44100, + CELL_SAIL_AUDIO_FS_48000HZ = 48000, - CELL_SAIL_AUDIO_FS_96000HZ = 96000, - CELL_SAIL_AUDIO_FS_88200HZ = 88200, - CELL_SAIL_AUDIO_FS_64000HZ = 64000, - //CELL_SAIL_AUDIO_FS_48000HZ = 48000, - //CELL_SAIL_AUDIO_FS_44100HZ = 44100, - //CELL_SAIL_AUDIO_FS_32000HZ = 32000, - CELL_SAIL_AUDIO_FS_24000HZ = 24000, - CELL_SAIL_AUDIO_FS_22050HZ = 22050, - CELL_SAIL_AUDIO_FS_16000HZ = 16000, - CELL_SAIL_AUDIO_FS_12000HZ = 12000, - CELL_SAIL_AUDIO_FS_11025HZ = 11025, - CELL_SAIL_AUDIO_FS_8000HZ = 8000, - CELL_SAIL_AUDIO_FS_7350HZ = 7350, + CELL_SAIL_AUDIO_FS_96000HZ = 96000, + CELL_SAIL_AUDIO_FS_88200HZ = 88200, + CELL_SAIL_AUDIO_FS_64000HZ = 64000, + // CELL_SAIL_AUDIO_FS_48000HZ = 48000, + // CELL_SAIL_AUDIO_FS_44100HZ = 44100, + // CELL_SAIL_AUDIO_FS_32000HZ = 32000, + CELL_SAIL_AUDIO_FS_24000HZ = 24000, + CELL_SAIL_AUDIO_FS_22050HZ = 22050, + CELL_SAIL_AUDIO_FS_16000HZ = 16000, + CELL_SAIL_AUDIO_FS_12000HZ = 12000, + CELL_SAIL_AUDIO_FS_11025HZ = 11025, + CELL_SAIL_AUDIO_FS_8000HZ = 8000, + CELL_SAIL_AUDIO_FS_7350HZ = 7350, - CELL_SAIL_AUDIO_FS_192000HZ = 192000, - //CELL_SAIL_AUDIO_FS_11024HZ = 11025, + CELL_SAIL_AUDIO_FS_192000HZ = 192000, + // CELL_SAIL_AUDIO_FS_11024HZ = 11025, CELL_SAIL_AUDIO_FS_UNSPECIFIED = -1, }; enum { - CELL_SAIL_AUDIO_CH_LAYOUT_UNDEFINED = 0, + CELL_SAIL_AUDIO_CH_LAYOUT_UNDEFINED = 0, // monoral - CELL_SAIL_AUDIO_CH_LAYOUT_1CH = 1, + CELL_SAIL_AUDIO_CH_LAYOUT_1CH = 1, // 1. Front Left // 2. Front Right - CELL_SAIL_AUDIO_CH_LAYOUT_2CH_LR = 2, + CELL_SAIL_AUDIO_CH_LAYOUT_2CH_LR = 2, // 1. Front Left // 2. Front Center // 3. Front Right // for m4aac ac3 - CELL_SAIL_AUDIO_CH_LAYOUT_3CH_LCR = 3, + CELL_SAIL_AUDIO_CH_LAYOUT_3CH_LCR = 3, // 1. Front Left // 2. Front Center // 3. Surround // for m4aac ac3 - CELL_SAIL_AUDIO_CH_LAYOUT_3CH_LRc = 4, + CELL_SAIL_AUDIO_CH_LAYOUT_3CH_LRc = 4, // 1. Front Left // 2. Front Center // 3. Front Right // 4. Surround // for m4aac ac3 - CELL_SAIL_AUDIO_CH_LAYOUT_4CH_LCRc = 5, + CELL_SAIL_AUDIO_CH_LAYOUT_4CH_LCRc = 5, // 1. Front Left // 2. Front Right // 3. Surround Left // 4. Surround Right // for m4aac - CELL_SAIL_AUDIO_CH_LAYOUT_4CH_LRlr = 6, + CELL_SAIL_AUDIO_CH_LAYOUT_4CH_LRlr = 6, // 1. Front Left // 2. Front Center @@ -339,7 +340,7 @@ enum // 4. Surround Left // 5. Surround Right // for m4aac - CELL_SAIL_AUDIO_CH_LAYOUT_5CH_LCRlr = 7, + CELL_SAIL_AUDIO_CH_LAYOUT_5CH_LCRlr = 7, // 1. Front Left // 2. Front Center @@ -348,7 +349,7 @@ enum // 5. Surround Right // 6. LFE // for lpcm ac3 m4aac - CELL_SAIL_AUDIO_CH_LAYOUT_6CH_LCRlrE = 8, + CELL_SAIL_AUDIO_CH_LAYOUT_6CH_LCRlrE = 8, // 1. Front Left // 2. Front Center @@ -357,7 +358,7 @@ enum // 5. Back Right // 6. LFE // for at3plus - CELL_SAIL_AUDIO_CH_LAYOUT_6CH_LCRxyE = 9, + CELL_SAIL_AUDIO_CH_LAYOUT_6CH_LCRxyE = 9, // 1. Front Left // 2. Front Center @@ -367,7 +368,7 @@ enum // 6. Back Center // 7. LFE // (for at3plus) - CELL_SAIL_AUDIO_CH_LAYOUT_7CH_LCRxycE = 10, + CELL_SAIL_AUDIO_CH_LAYOUT_7CH_LCRxycE = 10, // 1. Front Left // 2. Front Center @@ -380,62 +381,62 @@ enum // for lpcm at3plus CELL_SAIL_AUDIO_CH_LAYOUT_8CH_LRCElrxy = 11, - CELL_SAIL_AUDIO_CH_LAYOUT_2CH_DUAL = 12, - CELL_SAIL_AUDIO_CH_LAYOUT_UNSPECIFIED = -1, + CELL_SAIL_AUDIO_CH_LAYOUT_2CH_DUAL = 12, + CELL_SAIL_AUDIO_CH_LAYOUT_UNSPECIFIED = -1, }; // Video Codings enum { - CELL_SAIL_VIDEO_CODING_UNSPECIFIED = -1, - CELL_SAIL_VIDEO_CODING_ARGB_INTERLEAVED = 0, - CELL_SAIL_VIDEO_CODING_RGBA_INTERLEAVED = 1, - CELL_SAIL_VIDEO_CODING_YUV422_U_Y0_V_Y1 = 2, - CELL_SAIL_VIDEO_CODING_YUV420_PLANAR = 3, + CELL_SAIL_VIDEO_CODING_UNSPECIFIED = -1, + CELL_SAIL_VIDEO_CODING_ARGB_INTERLEAVED = 0, + CELL_SAIL_VIDEO_CODING_RGBA_INTERLEAVED = 1, + CELL_SAIL_VIDEO_CODING_YUV422_U_Y0_V_Y1 = 2, + CELL_SAIL_VIDEO_CODING_YUV420_PLANAR = 3, // Suported by cellCamera - CELL_SAIL_VIDEO_CODING_YUV422_Y0_U_Y1_V = 4, - CELL_SAIL_VIDEO_CODING_YUV422_V_Y1_U_Y0 = 9, - CELL_SAIL_VIDEO_CODING_YUV422_Y1_V_Y0_U = 10, - CELL_SAIL_VIDEO_CODING_JPEG = 11, - CELL_SAIL_VIDEO_CODING_RAW8_BAYER_BGGR = 12, - _CELL_SAIL_VIDEO_CODING_TYPE_NUM_OF_ELEMENTS = 13, - CELL_SAIL_VIDEO_CODING_UYVY422_INTERLEAVED = 2, - CELL_SAIL_VIDEO_CODING_YUYV422_INTERLEAVED = 4, + CELL_SAIL_VIDEO_CODING_YUV422_Y0_U_Y1_V = 4, + CELL_SAIL_VIDEO_CODING_YUV422_V_Y1_U_Y0 = 9, + CELL_SAIL_VIDEO_CODING_YUV422_Y1_V_Y0_U = 10, + CELL_SAIL_VIDEO_CODING_JPEG = 11, + CELL_SAIL_VIDEO_CODING_RAW8_BAYER_BGGR = 12, + _CELL_SAIL_VIDEO_CODING_TYPE_NUM_OF_ELEMENTS = 13, + CELL_SAIL_VIDEO_CODING_UYVY422_INTERLEAVED = 2, + CELL_SAIL_VIDEO_CODING_YUYV422_INTERLEAVED = 4, CELL_SAIL_VIDEO_CODING_VYUY422_REVERSE_INTERLEAVED = 9, - CELL_SAIL_VIDEO_CODING_RAW8_BAYER_GRBG = 12, + CELL_SAIL_VIDEO_CODING_RAW8_BAYER_GRBG = 12, }; // Video Color Types enum { - CELL_SAIL_VIDEO_COLOR_MATRIX_UNSPECIFIED = -1, - CELL_SAIL_VIDEO_COLOR_MATRIX_BT601 = 0, - CELL_SAIL_VIDEO_COLOR_MATRIX_BT709 = 1, + CELL_SAIL_VIDEO_COLOR_MATRIX_UNSPECIFIED = -1, + CELL_SAIL_VIDEO_COLOR_MATRIX_BT601 = 0, + CELL_SAIL_VIDEO_COLOR_MATRIX_BT709 = 1, _CELL_SAIL_VIDEO_COLOR_MATRIX_TYPE_NUM_OF_ELEMENTS = 2, }; // Video Scan Types enum { - CELL_SAIL_VIDEO_SCAN_UNSPECIFIED = -1, - CELL_SAIL_VIDEO_SCAN_PROGRESSIVE = 0, - CELL_SAIL_VIDEO_SCAN_INTERLACE = 1, + CELL_SAIL_VIDEO_SCAN_UNSPECIFIED = -1, + CELL_SAIL_VIDEO_SCAN_PROGRESSIVE = 0, + CELL_SAIL_VIDEO_SCAN_INTERLACE = 1, _CELL_SAIL_VIDEO_SCAN_TYPE_NUM_OF_ELEMENTS = 2, }; // Framerates enum { - CELL_SAIL_VIDEO_FRAME_RATE_UNSPECIFIED = -1, - CELL_SAIL_VIDEO_FRAME_RATE_24000_1001HZ = 0, - CELL_SAIL_VIDEO_FRAME_RATE_24HZ = 1, - CELL_SAIL_VIDEO_FRAME_RATE_25HZ = 2, - CELL_SAIL_VIDEO_FRAME_RATE_30000_1001HZ = 3, - CELL_SAIL_VIDEO_FRAME_RATE_30HZ = 4, - CELL_SAIL_VIDEO_FRAME_RATE_50HZ = 5, - CELL_SAIL_VIDEO_FRAME_RATE_60000_1001HZ = 6, - CELL_SAIL_VIDEO_FRAME_RATE_60HZ = 7, + CELL_SAIL_VIDEO_FRAME_RATE_UNSPECIFIED = -1, + CELL_SAIL_VIDEO_FRAME_RATE_24000_1001HZ = 0, + CELL_SAIL_VIDEO_FRAME_RATE_24HZ = 1, + CELL_SAIL_VIDEO_FRAME_RATE_25HZ = 2, + CELL_SAIL_VIDEO_FRAME_RATE_30000_1001HZ = 3, + CELL_SAIL_VIDEO_FRAME_RATE_30HZ = 4, + CELL_SAIL_VIDEO_FRAME_RATE_50HZ = 5, + CELL_SAIL_VIDEO_FRAME_RATE_60000_1001HZ = 6, + CELL_SAIL_VIDEO_FRAME_RATE_60HZ = 7, _CELL_SAIL_VIDEO_FRAME_RATE_TYPE_NUM_OF_ELEMENTS = 8, }; @@ -443,130 +444,128 @@ enum enum { CELL_SAIL_VIDEO_ASPECT_RATIO_UNSPECIFIED = -1, - CELL_SAIL_VIDEO_ASPECT_RATIO_1_1 = 1, // 1920x1080 1280x720 - CELL_SAIL_VIDEO_ASPECT_RATIO_12_11 = 2, // 720x576 normal - CELL_SAIL_VIDEO_ASPECT_RATIO_10_11 = 3, // 720x480 normal - CELL_SAIL_VIDEO_ASPECT_RATIO_16_11 = 4, // 720x576 wide - CELL_SAIL_VIDEO_ASPECT_RATIO_40_33 = 5, // 720x480 wide - CELL_SAIL_VIDEO_ASPECT_RATIO_4_3 = 14, // 1440x1080 + CELL_SAIL_VIDEO_ASPECT_RATIO_1_1 = 1, // 1920x1080 1280x720 + CELL_SAIL_VIDEO_ASPECT_RATIO_12_11 = 2, // 720x576 normal + CELL_SAIL_VIDEO_ASPECT_RATIO_10_11 = 3, // 720x480 normal + CELL_SAIL_VIDEO_ASPECT_RATIO_16_11 = 4, // 720x576 wide + CELL_SAIL_VIDEO_ASPECT_RATIO_40_33 = 5, // 720x480 wide + CELL_SAIL_VIDEO_ASPECT_RATIO_4_3 = 14, // 1440x1080 }; enum { - CELL_SAIL_VIDEO_WIDTH_UNSPECIFIED = -1, - CELL_SAIL_VIDEO_HEIGHT_UNSPECIFIED = -1, - CELL_SAIL_VIDEO_PITCH_UNSPECIFIED = -1, + CELL_SAIL_VIDEO_WIDTH_UNSPECIFIED = -1, + CELL_SAIL_VIDEO_HEIGHT_UNSPECIFIED = -1, + CELL_SAIL_VIDEO_PITCH_UNSPECIFIED = -1, CELL_SAIL_VIDEO_BITS_PER_COLOR_UNSPECIFIED = -1, - CELL_SAIL_VIDEO_ALPHA_UNSPECIFIED = -1, + CELL_SAIL_VIDEO_ALPHA_UNSPECIFIED = -1, }; // Color Ranges enum { CELL_SAIL_VIDEO_COLOR_RANGE_UNSPECIFIED = -1, - CELL_SAIL_VIDEO_COLOR_RANGE_LIMITED = 1, - CELL_SAIL_VIDEO_COLOR_RANGE_FULL = 0, + CELL_SAIL_VIDEO_COLOR_RANGE_LIMITED = 1, + CELL_SAIL_VIDEO_COLOR_RANGE_FULL = 0, }; enum { - CELL_SAIL_START_NOT_SPECIFIED = 0, - CELL_SAIL_START_NORMAL = 1 << 0, //1 - CELL_SAIL_START_TIME_SCALE = 1 << 2, //4 - CELL_SAIL_START_EP_SKIP = 1 << 4, //16 - CELL_SAIL_START_EP_SKIP_REVERSE = 1 << 5, //32 - CELL_SAIL_START_FRAME_STEP = 1 << 6, //64 + CELL_SAIL_START_NOT_SPECIFIED = 0, + CELL_SAIL_START_NORMAL = 1 << 0, // 1 + CELL_SAIL_START_TIME_SCALE = 1 << 2, // 4 + CELL_SAIL_START_EP_SKIP = 1 << 4, // 16 + CELL_SAIL_START_EP_SKIP_REVERSE = 1 << 5, // 32 + CELL_SAIL_START_FRAME_STEP = 1 << 6, // 64 }; // Seek Types enum { - CELL_SAIL_SEEK_NOT_SPECIFIED = 0, + CELL_SAIL_SEEK_NOT_SPECIFIED = 0, CELL_SAIL_SEEK_ABSOLUTE_BYTE_POSITION = 1 << 0, // For PAMF CELL_SAIL_SEEK_RELATIVE_BYTE_POSITION = 1 << 1, // Not implemented CELL_SAIL_SEEK_ABSOLUTE_TIME_POSITION = 1 << 4, // MP4, AVI - CELL_SAIL_SEEK_CURRENT_POSITION = 1 << 6, - CELL_SAIL_SEEK_MP4_SCALE_AND_TIME = 1 << 4, // For MP4, obsolete + CELL_SAIL_SEEK_CURRENT_POSITION = 1 << 6, + CELL_SAIL_SEEK_MP4_SCALE_AND_TIME = 1 << 4, // For MP4, obsolete }; // Terminus Types enum { - CELL_SAIL_TERMINUS_NOT_SPECIFIED = 0, - CELL_SAIL_TERMINUS_EOS = 1 << 0, + CELL_SAIL_TERMINUS_NOT_SPECIFIED = 0, + CELL_SAIL_TERMINUS_EOS = 1 << 0, CELL_SAIL_TERMINUS_ABSOLUTE_BYTE_POSITION = 1 << 1, // For PAMF CELL_SAIL_TERMINUS_RELATIVE_BYTE_POSITION = 1 << 2, // Mot implemented CELL_SAIL_TERMINUS_ABSOLUTE_TIME_POSITION = 1 << 5, // For MP4, AVI - CELL_SAIL_TERMINUS_MP4_SCALE_AND_TIME = 1 << 5, // For MP4, obsolete - CELL_SAIL_TERMINUS_MP4_SCALE_ANT_TIME = 1 << 5, // For MP4, here because of a typo + CELL_SAIL_TERMINUS_MP4_SCALE_AND_TIME = 1 << 5, // For MP4, obsolete + CELL_SAIL_TERMINUS_MP4_SCALE_ANT_TIME = 1 << 5, // For MP4, here because of a typo }; // Start Flag Types enum { - CELL_SAIL_START_FLAG_NOT_SPECIFIED = 0, - CELL_SAIL_START_FLAG_UNFLUSH = 1 << 0, - CELL_SAIL_START_FLAG_PAUSE_BEGIN = 1 << 1, - CELL_SAIL_START_FLAG_PAUSE_END = 1 << 2, + CELL_SAIL_START_FLAG_NOT_SPECIFIED = 0, + CELL_SAIL_START_FLAG_UNFLUSH = 1 << 0, + CELL_SAIL_START_FLAG_PAUSE_BEGIN = 1 << 1, + CELL_SAIL_START_FLAG_PAUSE_END = 1 << 2, CELL_SAIL_START_FLAG_COMPLETE_STREAM = 1 << 3, - CELL_SAIL_START_FLAG_STICKY = 1 << 4, - CELL_SAIL_START_FLAG_PAUSE = 1 << 1, // Obsolete + CELL_SAIL_START_FLAG_STICKY = 1 << 4, + CELL_SAIL_START_FLAG_PAUSE = 1 << 1, // Obsolete }; enum { - _CELL_SAIL_SYNC_SHIFT_NUM = 8, + _CELL_SAIL_SYNC_SHIFT_NUM = 8, // Buffering - CELL_SAIL_SYNC_UNDERFLOW = 1, + CELL_SAIL_SYNC_UNDERFLOW = 1, // = 2, Reserved // Sync Status - CELL_SAIL_SYNC_ON_TIME = 1 << 2, - CELL_SAIL_SYNC_MAYBE_ON_TIME = 2 << 2, - CELL_SAIL_SYNC_EARLY = 3 << 2, - CELL_SAIL_SYNC_LATE = 4 << 2, - CELL_SAIL_SYNC_NO_SYNC = 5 << 2, - CELL_SAIL_SYNC_NO_PTS = 6 << 2, - CELL_SAIL_SYNC_NOT_READY = 7 << 2, - CELL_SAIL_SYNC_DISABLED = 8 << 2, - CELL_SAIL_SYNC_PAUSED = 9 << 2, + CELL_SAIL_SYNC_ON_TIME = 1 << 2, + CELL_SAIL_SYNC_MAYBE_ON_TIME = 2 << 2, + CELL_SAIL_SYNC_EARLY = 3 << 2, + CELL_SAIL_SYNC_LATE = 4 << 2, + CELL_SAIL_SYNC_NO_SYNC = 5 << 2, + CELL_SAIL_SYNC_NO_PTS = 6 << 2, + CELL_SAIL_SYNC_NOT_READY = 7 << 2, + CELL_SAIL_SYNC_DISABLED = 8 << 2, + CELL_SAIL_SYNC_PAUSED = 9 << 2, CELL_SAIL_SYNC_DISABLED_PAUSED = 10 << 2, - CELL_SAIL_SYNC_MUTED = 11 << 2, - CELL_SAIL_SYNC_DONE = 12 << 2, + CELL_SAIL_SYNC_MUTED = 11 << 2, + CELL_SAIL_SYNC_DONE = 12 << 2, // = 13 << 2, Reserved // = 14 << 2, Reserved // = 15 << 2, Reserved - //CELL_SAIL_SYNC_FIRST_FRAME = 64, - //CELL_SAIL_SYNC_LAST_FRAME = 128, - + // CELL_SAIL_SYNC_FIRST_FRAME = 64, + // CELL_SAIL_SYNC_LAST_FRAME = 128, // Frame Status - CELL_SAIL_SYNC_NO_FRAME = 0, - CELL_SAIL_SYNC_REPEATED = 1 << _CELL_SAIL_SYNC_SHIFT_NUM, - CELL_SAIL_SYNC_NEXT = 2 << _CELL_SAIL_SYNC_SHIFT_NUM, - CELL_SAIL_SYNC_SKIPPED_ONE = 3 << _CELL_SAIL_SYNC_SHIFT_NUM, + CELL_SAIL_SYNC_NO_FRAME = 0, + CELL_SAIL_SYNC_REPEATED = 1 << _CELL_SAIL_SYNC_SHIFT_NUM, + CELL_SAIL_SYNC_NEXT = 2 << _CELL_SAIL_SYNC_SHIFT_NUM, + CELL_SAIL_SYNC_SKIPPED_ONE = 3 << _CELL_SAIL_SYNC_SHIFT_NUM, }; enum { CELL_SAIL_EVENT_RECORDER_CALL_COMPLETED = 2, - CELL_SAIL_EVENT_RECORDER_STATE_CHANGED = 3, + CELL_SAIL_EVENT_RECORDER_STATE_CHANGED = 3, }; - enum { - CELL_SAIL_VIDEO_FRAME_RATE_100HZ = 8, + CELL_SAIL_VIDEO_FRAME_RATE_100HZ = 8, CELL_SAIL_VIDEO_FRAME_RATE_120000_1001HZ = 9, - CELL_SAIL_VIDEO_FRAME_RATE_120HZ = 10, + CELL_SAIL_VIDEO_FRAME_RATE_120HZ = 10, }; enum { - CELL_SAIL_GRAPHICS_ADAPTER_FIELD_TOP = 0, - CELL_SAIL_GRAPHICS_ADAPTER_FIELD_BOTTOM = 1, + CELL_SAIL_GRAPHICS_ADAPTER_FIELD_TOP = 0, + CELL_SAIL_GRAPHICS_ADAPTER_FIELD_BOTTOM = 1, CELL_SAIL_GRAPHICS_ADAPTER_FIELD_DONT_CARE = 2, }; @@ -577,11 +576,11 @@ enum enum { - CELL_SAIL_SOURCE_CAPABILITY_NONE = 0, + CELL_SAIL_SOURCE_CAPABILITY_NONE = 0, CELL_SAIL_SOURCE_CAPABILITY_SEEK_ABSOLUTE_BYTE_POSITION = 1 << 0, - CELL_SAIL_SOURCE_CAPABILITY_PAUSE = 1 << 4, - CELL_SAIL_SOURCE_CAPABILITY_GAPLESS = 1 << 5, - CELL_SAIL_SOURCE_CAPABILITY_EOS = 1 << 6, + CELL_SAIL_SOURCE_CAPABILITY_PAUSE = 1 << 4, + CELL_SAIL_SOURCE_CAPABILITY_GAPLESS = 1 << 5, + CELL_SAIL_SOURCE_CAPABILITY_EOS = 1 << 6, CELL_SAIL_SOURCE_CAPABILITY_SEEK_ABSOLUTE_TIME_POSITION = 1 << 7, }; @@ -667,8 +666,7 @@ union CellSailEvent { be_t major; be_t minor; - } - u32x2; + } u32x2; be_t value; }; @@ -885,7 +883,7 @@ struct CellSailRendererVideoFuncs struct CellSailRendererVideoAttribute { be_t thisSize; - CellSailVideoFormat *pPreferredFormat; + CellSailVideoFormat* pPreferredFormat; }; struct CellSailRendererVideo @@ -1033,20 +1031,25 @@ struct CellSailAviMediaType { be_t fccType; be_t fccHandler; - union u { - struct audio { + union u + { + struct audio + { be_t formatTag; be_t reserved; // Specify 0 - union u { - struct mpeg { + union u + { + struct mpeg + { be_t headLayer; // Specify 0 - be_t reserved; // Specify 0 + be_t reserved; // Specify 0 }; }; }; - struct video { + struct video + { be_t compression; - be_t reserved; // Specify 0 + be_t reserved; // Specify 0 }; }; }; @@ -1065,7 +1068,8 @@ struct CellSailAviStreamHeader be_t suggestedBufferSize; be_t quality; be_t sampleSize; - struct frame { + struct frame + { be_t left; be_t top; be_t right; @@ -1205,7 +1209,7 @@ struct CellSailPlayer be_t spurs_num_of_spus; be_t spurs_spu_thread_priority; be_t spurs_ppu_thread_priority; - b8 spurs_exit_if_no_work; + b8 spurs_exit_if_no_work; be_t io_ppu_thread_priority; be_t io_ppu_thread_stack_size; be_t dmux_ppu_thread_priority; @@ -1225,8 +1229,8 @@ struct CellSailPlayer be_t vpost_spurs_task_priorities; be_t graphics_adapter_buffer_release_delay; be_t video_performance_policy; - b8 av_sync_es_audio; - b8 av_sync_es_video; + b8 av_sync_es_audio; + b8 av_sync_es_video; CellSailFsRead fs; }; @@ -1236,43 +1240,43 @@ inline static const char* ParameterCodeToName(s32 code) { switch (code) { - case CELL_SAIL_PARAMETER_ENABLE_VPOST: return "ENABLE_VPOST"; - case CELL_SAIL_PARAMETER_CONTROL_QUEUE_DEPTH: return "CONTROL_QUEUE_DEPTH"; - case CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_PRIORITY: return "CONTROL_PPU_THREAD_PRIORITY"; - case CELL_SAIL_PARAMETER_SPURS_NUM_OF_SPUS: return "SPURS_NUM_OF_SPUS"; - case CELL_SAIL_PARAMETER_SPURS_SPU_THREAD_PRIORITY: return "SPURS_SPU_THREAD_PRIORITY"; - case CELL_SAIL_PARAMETER_SPURS_PPU_THREAD_PRIORITY: return "SPURS_PPU_THREAD_PRIORITY"; - case CELL_SAIL_PARAMETER_SPURS_EXIT_IF_NO_WORK: return "SPURS_EXIT_IF_NO_WORK"; - case CELL_SAIL_PARAMETER_IO_PPU_THREAD_PRIORITY: return "IO_PPU_THREAD_PRIORITY"; - case CELL_SAIL_PARAMETER_DMUX_PPU_THREAD_PRIORITY: return "DMUX_PPU_THREAD_PRIORITY"; - case CELL_SAIL_PARAMETER_DMUX_SPU_THREAD_PRIORITY: return "DMUX_SPU_THREAD_PRIORITY"; - case CELL_SAIL_PARAMETER_DMUX_NUM_OF_SPUS: return "DMUX_NUM_OF_SPUS"; - case CELL_SAIL_PARAMETER_DMUX_SPURS_TASK_PRIORITIES: return "DMUX_SPURS_TASK_PRIORITIES"; - case CELL_SAIL_PARAMETER_ADEC_PPU_THREAD_PRIORITY: return "ADEC_PPU_THREAD_PRIORITY"; - case CELL_SAIL_PARAMETER_ADEC_SPU_THREAD_PRIORITY: return "ADEC_SPU_THREAD_PRIORITY"; - case CELL_SAIL_PARAMETER_ADEC_NUM_OF_SPUS: return "ADEC_NUM_OF_SPUS"; - case CELL_SAIL_PARAMETER_ADEC_SPURS_TASK_PRIORITIES: return "ADEC_SPURS_TASK_PRIORITIES"; - case CELL_SAIL_PARAMETER_VDEC_PPU_THREAD_PRIORITY: return "VDEC_PPU_THREAD_PRIORITY"; - case CELL_SAIL_PARAMETER_VDEC_SPU_THREAD_PRIORITY: return "VDEC_SPU_THREAD_PRIORITY"; - case CELL_SAIL_PARAMETER_VDEC_M2V_NUM_OF_SPUS: return "VDEC_M2V_NUM_OF_SPUS"; - case CELL_SAIL_PARAMETER_VDEC_AVC_NUM_OF_SPUS: return "VDEC_AVC_NUM_OF_SPUS"; - case CELL_SAIL_PARAMETER_VDEC_SPURS_TASK_PRIORITIES: return "VDEC_SPURS_TASK_PRIORITIES"; - case CELL_SAIL_PARAMETER_VPOST_PPU_THREAD_PRIORITY: return "VPOST_PPU_THREAD_PRIORITY"; - case CELL_SAIL_PARAMETER_VPOST_SPU_THREAD_PRIORITY: return "VPOST_SPU_THREAD_PRIORITY"; - case CELL_SAIL_PARAMETER_VPOST_NUM_OF_SPUS: return "VPOST_NUM_OF_SPUS"; - case CELL_SAIL_PARAMETER_VPOST_SPURS_TASK_PRIORITIES: return "VPOST_SPURS_TASK_PRIORITIES"; + case CELL_SAIL_PARAMETER_ENABLE_VPOST: return "ENABLE_VPOST"; + case CELL_SAIL_PARAMETER_CONTROL_QUEUE_DEPTH: return "CONTROL_QUEUE_DEPTH"; + case CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_PRIORITY: return "CONTROL_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_SPURS_NUM_OF_SPUS: return "SPURS_NUM_OF_SPUS"; + case CELL_SAIL_PARAMETER_SPURS_SPU_THREAD_PRIORITY: return "SPURS_SPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_SPURS_PPU_THREAD_PRIORITY: return "SPURS_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_SPURS_EXIT_IF_NO_WORK: return "SPURS_EXIT_IF_NO_WORK"; + case CELL_SAIL_PARAMETER_IO_PPU_THREAD_PRIORITY: return "IO_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_DMUX_PPU_THREAD_PRIORITY: return "DMUX_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_DMUX_SPU_THREAD_PRIORITY: return "DMUX_SPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_DMUX_NUM_OF_SPUS: return "DMUX_NUM_OF_SPUS"; + case CELL_SAIL_PARAMETER_DMUX_SPURS_TASK_PRIORITIES: return "DMUX_SPURS_TASK_PRIORITIES"; + case CELL_SAIL_PARAMETER_ADEC_PPU_THREAD_PRIORITY: return "ADEC_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_ADEC_SPU_THREAD_PRIORITY: return "ADEC_SPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_ADEC_NUM_OF_SPUS: return "ADEC_NUM_OF_SPUS"; + case CELL_SAIL_PARAMETER_ADEC_SPURS_TASK_PRIORITIES: return "ADEC_SPURS_TASK_PRIORITIES"; + case CELL_SAIL_PARAMETER_VDEC_PPU_THREAD_PRIORITY: return "VDEC_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_VDEC_SPU_THREAD_PRIORITY: return "VDEC_SPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_VDEC_M2V_NUM_OF_SPUS: return "VDEC_M2V_NUM_OF_SPUS"; + case CELL_SAIL_PARAMETER_VDEC_AVC_NUM_OF_SPUS: return "VDEC_AVC_NUM_OF_SPUS"; + case CELL_SAIL_PARAMETER_VDEC_SPURS_TASK_PRIORITIES: return "VDEC_SPURS_TASK_PRIORITIES"; + case CELL_SAIL_PARAMETER_VPOST_PPU_THREAD_PRIORITY: return "VPOST_PPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_VPOST_SPU_THREAD_PRIORITY: return "VPOST_SPU_THREAD_PRIORITY"; + case CELL_SAIL_PARAMETER_VPOST_NUM_OF_SPUS: return "VPOST_NUM_OF_SPUS"; + case CELL_SAIL_PARAMETER_VPOST_SPURS_TASK_PRIORITIES: return "VPOST_SPURS_TASK_PRIORITIES"; case CELL_SAIL_PARAMETER_GRAPHICS_ADAPTER_BUFFER_RELEASE_DELAY: return "GRAPHICS_ADAPTER_BUFFER_RELEASE_DELAY"; - case CELL_SAIL_PARAMETER_AV_SYNC_ES_AUDIO: return "AV_SYNC_ES_AUDIO"; - case CELL_SAIL_PARAMETER_AV_SYNC_ES_VIDEO: return "AV_SYNC_ES_VIDEO"; - case CELL_SAIL_PARAMETER_AV_SYNC_ES_USER: return "AV_SYNC_ES_USER"; - case CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_STACK_SIZE: return "CONTROL_PPU_THREAD_STACK_SIZE"; - case CELL_SAIL_PARAMETER_RESERVED0_: return "RESERVED0_"; - case CELL_SAIL_PARAMETER_RESERVED1: return "RESERVED1"; - case CELL_SAIL_PARAMETER_ENABLE_APOST_SRC: return "ENABLE_APOST_SRC"; - case CELL_SAIL_PARAMETER_FS: return "FS"; - case CELL_SAIL_PARAMETER_IO_PPU_THREAD_STACK_SIZE: return "IO_PPU_THREAD_STACK_SIZE"; - case CELL_SAIL_PARAMETER_VIDEO_PERFORMANCE_POLICY: return "VIDEO_PERFORMANCE_POLICY"; - case _CELL_SAIL_PARAMETER_TYPE_NUM_OF_ELEMENTS: return "TYPE_NUM_OF_ELEMENTS"; + case CELL_SAIL_PARAMETER_AV_SYNC_ES_AUDIO: return "AV_SYNC_ES_AUDIO"; + case CELL_SAIL_PARAMETER_AV_SYNC_ES_VIDEO: return "AV_SYNC_ES_VIDEO"; + case CELL_SAIL_PARAMETER_AV_SYNC_ES_USER: return "AV_SYNC_ES_USER"; + case CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_STACK_SIZE: return "CONTROL_PPU_THREAD_STACK_SIZE"; + case CELL_SAIL_PARAMETER_RESERVED0_: return "RESERVED0_"; + case CELL_SAIL_PARAMETER_RESERVED1: return "RESERVED1"; + case CELL_SAIL_PARAMETER_ENABLE_APOST_SRC: return "ENABLE_APOST_SRC"; + case CELL_SAIL_PARAMETER_FS: return "FS"; + case CELL_SAIL_PARAMETER_IO_PPU_THREAD_STACK_SIZE: return "IO_PPU_THREAD_STACK_SIZE"; + case CELL_SAIL_PARAMETER_VIDEO_PERFORMANCE_POLICY: return "VIDEO_PERFORMANCE_POLICY"; + case _CELL_SAIL_PARAMETER_TYPE_NUM_OF_ELEMENTS: return "TYPE_NUM_OF_ELEMENTS"; default: return "???"; } } diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSailRec.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSailRec.cpp index c7a3cba54..9fa6b9ba0 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSailRec.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSailRec.cpp @@ -352,72 +352,72 @@ error_code cellSailComposerNotifySessionError() } DECLARE(ppu_module_manager::cellSailRec)("cellSailRec", []() -{ - static ppu_static_module cellMp4("cellMp4"); - static ppu_static_module cellApostSrcMini("cellApostSrcMini"); + { + static ppu_static_module cellMp4("cellMp4"); + static ppu_static_module cellApostSrcMini("cellApostSrcMini"); - REG_FUNC(cellSailRec, cellSailProfileSetEsAudioParameter); - REG_FUNC(cellSailRec, cellSailProfileSetEsVideoParameter); - REG_FUNC(cellSailRec, cellSailProfileSetStreamParameter); + REG_FUNC(cellSailRec, cellSailProfileSetEsAudioParameter); + REG_FUNC(cellSailRec, cellSailProfileSetEsVideoParameter); + REG_FUNC(cellSailRec, cellSailProfileSetStreamParameter); - REG_FUNC(cellSailRec, cellSailVideoConverterCanProcess); - REG_FUNC(cellSailRec, cellSailVideoConverterProcess); - REG_FUNC(cellSailRec, cellSailVideoConverterCanGetResult); - REG_FUNC(cellSailRec, cellSailVideoConverterGetResult); + REG_FUNC(cellSailRec, cellSailVideoConverterCanProcess); + REG_FUNC(cellSailRec, cellSailVideoConverterProcess); + REG_FUNC(cellSailRec, cellSailVideoConverterCanGetResult); + REG_FUNC(cellSailRec, cellSailVideoConverterGetResult); - REG_FUNC(cellSailRec, cellSailFeederAudioInitialize); - REG_FUNC(cellSailRec, cellSailFeederAudioFinalize); - REG_FUNC(cellSailRec, cellSailFeederAudioNotifyCallCompleted); - REG_FUNC(cellSailRec, cellSailFeederAudioNotifyFrameOut); - REG_FUNC(cellSailRec, cellSailFeederAudioNotifySessionEnd); - REG_FUNC(cellSailRec, cellSailFeederAudioNotifySessionError); + REG_FUNC(cellSailRec, cellSailFeederAudioInitialize); + REG_FUNC(cellSailRec, cellSailFeederAudioFinalize); + REG_FUNC(cellSailRec, cellSailFeederAudioNotifyCallCompleted); + REG_FUNC(cellSailRec, cellSailFeederAudioNotifyFrameOut); + REG_FUNC(cellSailRec, cellSailFeederAudioNotifySessionEnd); + REG_FUNC(cellSailRec, cellSailFeederAudioNotifySessionError); - REG_FUNC(cellSailRec, cellSailFeederVideoInitialize); - REG_FUNC(cellSailRec, cellSailFeederVideoFinalize); - REG_FUNC(cellSailRec, cellSailFeederVideoNotifyCallCompleted); - REG_FUNC(cellSailRec, cellSailFeederVideoNotifyFrameOut); - REG_FUNC(cellSailRec, cellSailFeederVideoNotifySessionEnd); - REG_FUNC(cellSailRec, cellSailFeederVideoNotifySessionError); + REG_FUNC(cellSailRec, cellSailFeederVideoInitialize); + REG_FUNC(cellSailRec, cellSailFeederVideoFinalize); + REG_FUNC(cellSailRec, cellSailFeederVideoNotifyCallCompleted); + REG_FUNC(cellSailRec, cellSailFeederVideoNotifyFrameOut); + REG_FUNC(cellSailRec, cellSailFeederVideoNotifySessionEnd); + REG_FUNC(cellSailRec, cellSailFeederVideoNotifySessionError); - REG_FUNC(cellSailRec, cellSailRecorderInitialize); - REG_FUNC(cellSailRec, cellSailRecorderFinalize); - REG_FUNC(cellSailRec, cellSailRecorderSetFeederAudio); - REG_FUNC(cellSailRec, cellSailRecorderSetFeederVideo); - REG_FUNC(cellSailRec, cellSailRecorderSetParameter); - REG_FUNC(cellSailRec, cellSailRecorderGetParameter); - REG_FUNC(cellSailRec, cellSailRecorderSubscribeEvent); - REG_FUNC(cellSailRec, cellSailRecorderUnsubscribeEvent); - REG_FUNC(cellSailRec, cellSailRecorderReplaceEventHandler); - REG_FUNC(cellSailRec, cellSailRecorderBoot); - REG_FUNC(cellSailRec, cellSailRecorderCreateProfile); - REG_FUNC(cellSailRec, cellSailRecorderDestroyProfile); - REG_FUNC(cellSailRec, cellSailRecorderCreateVideoConverter); - REG_FUNC(cellSailRec, cellSailRecorderDestroyVideoConverter); - REG_FUNC(cellSailRec, cellSailRecorderOpenStream); - REG_FUNC(cellSailRec, cellSailRecorderCloseStream); - REG_FUNC(cellSailRec, cellSailRecorderStart); - REG_FUNC(cellSailRec, cellSailRecorderStop); - REG_FUNC(cellSailRec, cellSailRecorderCancel); - REG_FUNC(cellSailRec, cellSailRecorderRegisterComposer); - REG_FUNC(cellSailRec, cellSailRecorderUnregisterComposer); + REG_FUNC(cellSailRec, cellSailRecorderInitialize); + REG_FUNC(cellSailRec, cellSailRecorderFinalize); + REG_FUNC(cellSailRec, cellSailRecorderSetFeederAudio); + REG_FUNC(cellSailRec, cellSailRecorderSetFeederVideo); + REG_FUNC(cellSailRec, cellSailRecorderSetParameter); + REG_FUNC(cellSailRec, cellSailRecorderGetParameter); + REG_FUNC(cellSailRec, cellSailRecorderSubscribeEvent); + REG_FUNC(cellSailRec, cellSailRecorderUnsubscribeEvent); + REG_FUNC(cellSailRec, cellSailRecorderReplaceEventHandler); + REG_FUNC(cellSailRec, cellSailRecorderBoot); + REG_FUNC(cellSailRec, cellSailRecorderCreateProfile); + REG_FUNC(cellSailRec, cellSailRecorderDestroyProfile); + REG_FUNC(cellSailRec, cellSailRecorderCreateVideoConverter); + REG_FUNC(cellSailRec, cellSailRecorderDestroyVideoConverter); + REG_FUNC(cellSailRec, cellSailRecorderOpenStream); + REG_FUNC(cellSailRec, cellSailRecorderCloseStream); + REG_FUNC(cellSailRec, cellSailRecorderStart); + REG_FUNC(cellSailRec, cellSailRecorderStop); + REG_FUNC(cellSailRec, cellSailRecorderCancel); + REG_FUNC(cellSailRec, cellSailRecorderRegisterComposer); + REG_FUNC(cellSailRec, cellSailRecorderUnregisterComposer); - REG_FUNC(cellSailRec, cellSailRecorderDumpImage); + REG_FUNC(cellSailRec, cellSailRecorderDumpImage); - REG_FUNC(cellSailRec, cellSailComposerInitialize); - REG_FUNC(cellSailRec, cellSailComposerFinalize); - REG_FUNC(cellSailRec, cellSailComposerGetStreamParameter); - REG_FUNC(cellSailRec, cellSailComposerGetEsAudioParameter); - REG_FUNC(cellSailRec, cellSailComposerGetEsUserParameter); - REG_FUNC(cellSailRec, cellSailComposerGetEsVideoParameter); - REG_FUNC(cellSailRec, cellSailComposerGetEsAudioAu); - REG_FUNC(cellSailRec, cellSailComposerGetEsUserAu); - REG_FUNC(cellSailRec, cellSailComposerGetEsVideoAu); - REG_FUNC(cellSailRec, cellSailComposerTryGetEsAudioAu); - REG_FUNC(cellSailRec, cellSailComposerTryGetEsUserAu); - REG_FUNC(cellSailRec, cellSailComposerTryGetEsVideoAu); - REG_FUNC(cellSailRec, cellSailComposerReleaseEsAudioAu); - REG_FUNC(cellSailRec, cellSailComposerReleaseEsUserAu); - REG_FUNC(cellSailRec, cellSailComposerReleaseEsVideoAu); - REG_FUNC(cellSailRec, cellSailComposerNotifyCallCompleted); - REG_FUNC(cellSailRec, cellSailComposerNotifySessionError); -}); + REG_FUNC(cellSailRec, cellSailComposerInitialize); + REG_FUNC(cellSailRec, cellSailComposerFinalize); + REG_FUNC(cellSailRec, cellSailComposerGetStreamParameter); + REG_FUNC(cellSailRec, cellSailComposerGetEsAudioParameter); + REG_FUNC(cellSailRec, cellSailComposerGetEsUserParameter); + REG_FUNC(cellSailRec, cellSailComposerGetEsVideoParameter); + REG_FUNC(cellSailRec, cellSailComposerGetEsAudioAu); + REG_FUNC(cellSailRec, cellSailComposerGetEsUserAu); + REG_FUNC(cellSailRec, cellSailComposerGetEsVideoAu); + REG_FUNC(cellSailRec, cellSailComposerTryGetEsAudioAu); + REG_FUNC(cellSailRec, cellSailComposerTryGetEsUserAu); + REG_FUNC(cellSailRec, cellSailComposerTryGetEsVideoAu); + REG_FUNC(cellSailRec, cellSailComposerReleaseEsAudioAu); + REG_FUNC(cellSailRec, cellSailComposerReleaseEsUserAu); + REG_FUNC(cellSailRec, cellSailComposerReleaseEsVideoAu); + REG_FUNC(cellSailRec, cellSailComposerNotifyCallCompleted); + REG_FUNC(cellSailRec, cellSailComposerNotifySessionError); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index db57195a5..d5f536a37 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -30,29 +30,29 @@ LOG_CHANNEL(cellSaveData); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SAVEDATA_ERROR_CBRESULT); - STR_CASE(CELL_SAVEDATA_ERROR_ACCESS_ERROR); - STR_CASE(CELL_SAVEDATA_ERROR_INTERNAL); - STR_CASE(CELL_SAVEDATA_ERROR_PARAM); - STR_CASE(CELL_SAVEDATA_ERROR_NOSPACE); - STR_CASE(CELL_SAVEDATA_ERROR_BROKEN); - STR_CASE(CELL_SAVEDATA_ERROR_FAILURE); - STR_CASE(CELL_SAVEDATA_ERROR_BUSY); - STR_CASE(CELL_SAVEDATA_ERROR_NOUSER); - STR_CASE(CELL_SAVEDATA_ERROR_SIZEOVER); - STR_CASE(CELL_SAVEDATA_ERROR_NODATA); - STR_CASE(CELL_SAVEDATA_ERROR_NOTSUPPORTED); - } + switch (error) + { + STR_CASE(CELL_SAVEDATA_ERROR_CBRESULT); + STR_CASE(CELL_SAVEDATA_ERROR_ACCESS_ERROR); + STR_CASE(CELL_SAVEDATA_ERROR_INTERNAL); + STR_CASE(CELL_SAVEDATA_ERROR_PARAM); + STR_CASE(CELL_SAVEDATA_ERROR_NOSPACE); + STR_CASE(CELL_SAVEDATA_ERROR_BROKEN); + STR_CASE(CELL_SAVEDATA_ERROR_FAILURE); + STR_CASE(CELL_SAVEDATA_ERROR_BUSY); + STR_CASE(CELL_SAVEDATA_ERROR_NOUSER); + STR_CASE(CELL_SAVEDATA_ERROR_SIZEOVER); + STR_CASE(CELL_SAVEDATA_ERROR_NODATA); + STR_CASE(CELL_SAVEDATA_ERROR_NOTSUPPORTED); + } - return unknown; - }); + return unknown; + }); } SaveDialogBase::~SaveDialogBase() @@ -87,21 +87,21 @@ using PFuncDone = vm::ptr; enum : u32 { - SAVEDATA_OP_AUTO_SAVE = 0, - SAVEDATA_OP_AUTO_LOAD = 1, + SAVEDATA_OP_AUTO_SAVE = 0, + SAVEDATA_OP_AUTO_LOAD = 1, SAVEDATA_OP_LIST_AUTO_SAVE = 2, SAVEDATA_OP_LIST_AUTO_LOAD = 3, - SAVEDATA_OP_LIST_SAVE = 4, - SAVEDATA_OP_LIST_LOAD = 5, - SAVEDATA_OP_FIXED_SAVE = 6, - SAVEDATA_OP_FIXED_LOAD = 7, + SAVEDATA_OP_LIST_SAVE = 4, + SAVEDATA_OP_LIST_LOAD = 5, + SAVEDATA_OP_FIXED_SAVE = 6, + SAVEDATA_OP_FIXED_LOAD = 7, - SAVEDATA_OP_LIST_IMPORT = 9, - SAVEDATA_OP_LIST_EXPORT = 10, - SAVEDATA_OP_FIXED_IMPORT = 11, - SAVEDATA_OP_FIXED_EXPORT = 12, - SAVEDATA_OP_LIST_DELETE = 13, - SAVEDATA_OP_FIXED_DELETE = 14, + SAVEDATA_OP_LIST_IMPORT = 9, + SAVEDATA_OP_LIST_EXPORT = 10, + SAVEDATA_OP_FIXED_IMPORT = 11, + SAVEDATA_OP_FIXED_EXPORT = 12, + SAVEDATA_OP_LIST_DELETE = 13, + SAVEDATA_OP_FIXED_DELETE = 14, }; namespace @@ -109,16 +109,16 @@ namespace struct savedata_context { alignas(16) CellSaveDataCBResult result; - alignas(16) CellSaveDataListGet listGet; - alignas(16) CellSaveDataListSet listSet; + alignas(16) CellSaveDataListGet listGet; + alignas(16) CellSaveDataListSet listSet; alignas(16) CellSaveDataFixedSet fixedSet; - alignas(16) CellSaveDataStatGet statGet; - alignas(16) CellSaveDataStatSet statSet; - alignas(16) CellSaveDataFileGet fileGet; - alignas(16) CellSaveDataFileSet fileSet; - alignas(16) CellSaveDataDoneGet doneGet; + alignas(16) CellSaveDataStatGet statGet; + alignas(16) CellSaveDataStatSet statSet; + alignas(16) CellSaveDataFileGet fileGet; + alignas(16) CellSaveDataFileSet fileSet; + alignas(16) CellSaveDataDoneGet doneGet; }; -} +} // namespace vm::gvar g_savedata_context; @@ -175,9 +175,9 @@ int check_filename(std::string_view file_path, bool disallow_system_files, bool } if (disallow_system_files && ((dotpos >= 5u && std::memcmp(name, "PARAM", 5) == 0) || - (dotpos >= 4u && std::memcmp(name, "ICON", 4) == 0) || - (dotpos >= 3u && std::memcmp(name, "PIC", 3) == 0) || - (dotpos >= 3u && std::memcmp(name, "SND", 3) == 0))) + (dotpos >= 4u && std::memcmp(name, "ICON", 4) == 0) || + (dotpos >= 3u && std::memcmp(name, "PIC", 3) == 0) || + (dotpos >= 3u && std::memcmp(name, "SND", 3) == 0))) { // ****** sysutil savedata parameter error : 70 ****** return 70; @@ -244,12 +244,12 @@ static std::vector get_save_entries(const std::string& base_dir, continue; } - SaveDataEntry save_entry {}; - save_entry.dirName = psf::get_string(psf, "SAVEDATA_DIRECTORY"); + SaveDataEntry save_entry{}; + save_entry.dirName = psf::get_string(psf, "SAVEDATA_DIRECTORY"); save_entry.listParam = psf::get_string(psf, "SAVEDATA_LIST_PARAM"); - save_entry.title = psf::get_string(psf, "TITLE"); - save_entry.subtitle = psf::get_string(psf, "SUB_TITLE"); - save_entry.details = psf::get_string(psf, "DETAIL"); + save_entry.title = psf::get_string(psf, "TITLE"); + save_entry.subtitle = psf::get_string(psf, "SUB_TITLE"); + save_entry.details = psf::get_string(psf, "DETAIL"); for (const auto& entry2 : fs::dir(base_dir + entry.name)) { @@ -297,7 +297,7 @@ static error_code select_and_delete(ppu_thread& ppu) auto save_entries = get_save_entries(base_dir, Emu.GetTitleID()); s32 selected = -1; - s32 focused = -1; + s32 focused = -1; while (true) { @@ -527,8 +527,7 @@ static s32 savedata_check_args(u32 operation, u32 version, vm::cptr dirNam return 15; } - if (!memchr(setList->dirNamePrefix.get_ptr(), '\0', CELL_SAVEDATA_PREFIX_SIZE) - || (g_ps3_process_info.sdk_ver > 0x3FFFFF && !setList->dirNamePrefix[0])) + if (!memchr(setList->dirNamePrefix.get_ptr(), '\0', CELL_SAVEDATA_PREFIX_SIZE) || (g_ps3_process_info.sdk_ver > 0x3FFFFF && !setList->dirNamePrefix[0])) { // ****** sysutil savedata parameter error : 17 ****** return 17; @@ -664,7 +663,8 @@ static s32 savedata_check_args(u32 operation, u32 version, vm::cptr dirNam } if ((operation == SAVEDATA_OP_FIXED_SAVE || operation == SAVEDATA_OP_FIXED_LOAD || - operation == SAVEDATA_OP_LIST_AUTO_LOAD || operation == SAVEDATA_OP_LIST_AUTO_SAVE || operation == SAVEDATA_OP_FIXED_DELETE) && !funcFixed) + operation == SAVEDATA_OP_LIST_AUTO_LOAD || operation == SAVEDATA_OP_LIST_AUTO_SAVE || operation == SAVEDATA_OP_FIXED_DELETE) && + !funcFixed) { // ****** sysutil savedata parameter error : 19 ****** return 19; @@ -707,7 +707,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v cellSaveData.notice("savedata_op(): setBuf = { .dirListMax=%d, .fileListMax=%d, .bufSize=%d }", buf.dirListMax, buf.fileListMax, buf.bufSize); if (const auto ecode = savedata_check_args(operation, version, dirName, errDialog, setList, setBuf, funcList, funcFixed, funcStat, - funcFile, container, unk_op_flags, userdata, userId, funcDone)) + funcFile, container, unk_op_flags, userdata, userId, funcDone)) { return {CELL_SAVEDATA_ERROR_PARAM, " (error %d)", ecode}; } @@ -739,15 +739,15 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v std::memset(g_savedata_context.get_ptr(), 0, g_savedata_context.size()); - vm::ptr result = g_savedata_context.ptr(&savedata_context::result); - vm::ptr listGet = g_savedata_context.ptr(&savedata_context::listGet); - vm::ptr listSet = g_savedata_context.ptr(&savedata_context::listSet); + vm::ptr result = g_savedata_context.ptr(&savedata_context::result); + vm::ptr listGet = g_savedata_context.ptr(&savedata_context::listGet); + vm::ptr listSet = g_savedata_context.ptr(&savedata_context::listSet); vm::ptr fixedSet = g_savedata_context.ptr(&savedata_context::fixedSet); - vm::ptr statGet = g_savedata_context.ptr(&savedata_context::statGet); - vm::ptr statSet = g_savedata_context.ptr(&savedata_context::statSet); - vm::ptr fileGet = g_savedata_context.ptr(&savedata_context::fileGet); - vm::ptr fileSet = g_savedata_context.ptr(&savedata_context::fileSet); - vm::ptr doneGet = g_savedata_context.ptr(&savedata_context::doneGet); + vm::ptr statGet = g_savedata_context.ptr(&savedata_context::statGet); + vm::ptr statSet = g_savedata_context.ptr(&savedata_context::statSet); + vm::ptr fileGet = g_savedata_context.ptr(&savedata_context::fileGet); + vm::ptr fileSet = g_savedata_context.ptr(&savedata_context::fileSet); + vm::ptr doneGet = g_savedata_context.ptr(&savedata_context::doneGet); // userId(0) = CELL_SYSUTIL_USERID_CURRENT; // path of the specified user (00000001 by default) @@ -760,7 +760,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v result->userdata = userdata; // probably should be assigned only once (allows the callback to change it) - SaveDataEntry save_entry {}; + SaveDataEntry save_entry{}; if (setList) { @@ -786,7 +786,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v { cellSaveData.notice("savedata_op(): dirNamePrefix is '*'. Listing all entries starting with '%s'. operation=%d", Emu.GetTitleID(), operation); prefix_list.front() = Emu.GetTitleID(); // TODO: Let's be cautious for now and only list savedata starting with this game's ID - //prefix_list.front().clear(); // List savedata of all the games of this user + // prefix_list.front().clear(); // List savedata of all the games of this user } // get the saves matching the supplied prefix @@ -820,12 +820,12 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v break; } - SaveDataEntry save_entry2 {}; - save_entry2.dirName = psf::get_string(psf, "SAVEDATA_DIRECTORY"); + SaveDataEntry save_entry2{}; + save_entry2.dirName = psf::get_string(psf, "SAVEDATA_DIRECTORY"); save_entry2.listParam = psf::get_string(psf, "SAVEDATA_LIST_PARAM"); - save_entry2.title = psf::get_string(psf, "TITLE"); - save_entry2.subtitle = psf::get_string(psf, "SUB_TITLE"); - save_entry2.details = psf::get_string(psf, "DETAIL"); + save_entry2.title = psf::get_string(psf, "TITLE"); + save_entry2.subtitle = psf::get_string(psf, "SUB_TITLE"); + save_entry2.details = psf::get_string(psf, "DETAIL"); for (const auto& entry2 : fs::dir(base_dir + entry.name)) { @@ -859,26 +859,26 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v const u32 type = setList->sortType; std::sort(save_entries.begin(), save_entries.end(), [=](const SaveDataEntry& entry1, const SaveDataEntry& entry2) - { - if (order == CELL_SAVEDATA_SORTORDER_DESCENT && type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME) { - return entry1.mtime >= entry2.mtime; - } - if (order == CELL_SAVEDATA_SORTORDER_DESCENT && type == CELL_SAVEDATA_SORTTYPE_SUBTITLE) - { - return entry1.subtitle >= entry2.subtitle; - } - if (order == CELL_SAVEDATA_SORTORDER_ASCENT && type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME) - { - return entry1.mtime < entry2.mtime; - } - if (order == CELL_SAVEDATA_SORTORDER_ASCENT && type == CELL_SAVEDATA_SORTTYPE_SUBTITLE) - { - return entry1.subtitle < entry2.subtitle; - } + if (order == CELL_SAVEDATA_SORTORDER_DESCENT && type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME) + { + return entry1.mtime >= entry2.mtime; + } + if (order == CELL_SAVEDATA_SORTORDER_DESCENT && type == CELL_SAVEDATA_SORTTYPE_SUBTITLE) + { + return entry1.subtitle >= entry2.subtitle; + } + if (order == CELL_SAVEDATA_SORTORDER_ASCENT && type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME) + { + return entry1.mtime < entry2.mtime; + } + if (order == CELL_SAVEDATA_SORTORDER_ASCENT && type == CELL_SAVEDATA_SORTTYPE_SUBTITLE) + { + return entry1.subtitle < entry2.subtitle; + } - return true; - }); + return true; + }); } // Fill the listGet->dirList array @@ -964,9 +964,10 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v // Clean save data list save_entries.erase(std::remove_if(save_entries.begin(), save_entries.end(), [&selected_list](const SaveDataEntry& entry) -> bool - { - return selected_list.count(entry.dirName) == 0; - }), save_entries.end()); + { + return selected_list.count(entry.dirName) == 0; + }), + save_entries.end()); if (listSet->newData) { @@ -1126,7 +1127,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v { strcpy_trunc(doneGet->dirName, save_entries[selected].dirName); doneGet->hddFreeSizeKB = 40 * 1024 * 1024 - 256; // Read explanation in cellHddGameCheck - doneGet->excResult = CELL_OK; + doneGet->excResult = CELL_OK; std::memset(doneGet->reserved, 0, sizeof(doneGet->reserved)); const std::string old_path = base_dir + ".backup_" + save_entries[selected].escaped + "/"; @@ -1377,7 +1378,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v lv2_sleep(ppu, 30000); break; - default : + default: // ****** sysutil savedata parameter error : 81 ****** return {CELL_SAVEDATA_ERROR_PARAM, "81 (option=0x%x)", fixedSet->option}; } @@ -1654,8 +1655,8 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v psf::assign(psf, "ACCOUNT_ID", psf::array(16, "0000000000000000")); // ??? psf::assign(psf, "ATTRIBUTE", statSet->setParam->attribute.value()); psf::assign(psf, "CATEGORY", psf::string(4, "SD")); // ??? - psf::assign(psf, "PARAMS", psf::string(1024, {})); // ??? - psf::assign(psf, "PARAMS2", psf::string(12, {})); // ??? + psf::assign(psf, "PARAMS", psf::string(1024, {})); // ??? + psf::assign(psf, "PARAMS2", psf::string(12, {})); // ??? psf::assign(psf, "PARENTAL_LEVEL", statSet->setParam->parental_level.value()); psf::assign(psf, "DETAIL", psf::string(CELL_SAVEDATA_SYSP_DETAIL_SIZE, statSet->setParam->detail)); psf::assign(psf, "SAVEDATA_DIRECTORY", psf::string(CELL_SAVEDATA_DIRNAME_SIZE, save_entry.dirName)); @@ -1674,9 +1675,9 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v { case CELL_SAVEDATA_RECREATE_NO: { - //CELL_SAVEDATA_RECREATE_NO = overwrite and let the user know, not data is corrupt. - //cellSaveData.error("Savedata %s considered broken", save_entry.dirName); - //TODO: if this is a save, and it's not auto, then show a dialog + // CELL_SAVEDATA_RECREATE_NO = overwrite and let the user know, not data is corrupt. + // cellSaveData.error("Savedata %s considered broken", save_entry.dirName); + // TODO: if this is a save, and it's not auto, then show a dialog [[fallthrough]]; } case CELL_SAVEDATA_RECREATE_NO_NOBROKEN: @@ -2258,7 +2259,7 @@ static NEVER_INLINE error_code savedata_get_list_item(vm::cptr dirName, vm if (bind) { - //TODO: Set bind in accordance to any problems + // TODO: Set bind in accordance to any problems *bind = 0; } @@ -2491,7 +2492,6 @@ void cellSaveDataEnableOverlay(s32 enable) manager.enable_overlay = enable != 0; } - // Functions (Extensions) error_code cellSaveDataListDelete(ppu_thread& ppu, PSetList setList, PSetBuf setBuf, PFuncList funcList, PFuncDone funcDone, u32 container, vm::ptr userdata) { @@ -2510,7 +2510,7 @@ error_code cellSaveDataListImport(ppu_thread& ppu, PSetList setList, u32 maxSize cellSaveData.todo("cellSaveDataListImport(setList=*0x%x, maxSizeKB=%d, funcDone=*0x%x, container=0x%x, userdata=*0x%x)", setList, maxSizeKB, funcDone, container, userdata); if (const auto ecode = savedata_check_args(SAVEDATA_OP_LIST_IMPORT, CELL_SAVEDATA_VERSION_OLD, vm::null, CELL_SAVEDATA_ERRDIALOG_NONE, - setList, vm::null, vm::null, vm::null, vm::null, vm::null, container, 0x40, userdata, 0, funcDone)) + setList, vm::null, vm::null, vm::null, vm::null, vm::null, container, 0x40, userdata, 0, funcDone)) { return {CELL_SAVEDATA_ERROR_PARAM, " (error %d)", ecode}; } @@ -2523,9 +2523,9 @@ error_code cellSaveDataListImport(ppu_thread& ppu, PSetList setList, u32 maxSize error_code cellSaveDataListExport(ppu_thread& ppu, PSetList setList, u32 maxSizeKB, PFuncDone funcDone, u32 container, vm::ptr userdata) { cellSaveData.todo("cellSaveDataListExport(setList=*0x%x, maxSizeKB=%d, funcDone=*0x%x, container=0x%x, userdata=*0x%x)", setList, maxSizeKB, funcDone, container, userdata); - + if (const auto ecode = savedata_check_args(SAVEDATA_OP_LIST_EXPORT, CELL_SAVEDATA_VERSION_OLD, vm::null, CELL_SAVEDATA_ERRDIALOG_NONE, - setList, vm::null, vm::null, vm::null, vm::null, vm::null, container, 0x40, userdata, 0, funcDone)) + setList, vm::null, vm::null, vm::null, vm::null, vm::null, container, 0x40, userdata, 0, funcDone)) { return {CELL_SAVEDATA_ERROR_PARAM, " (error %d)", ecode}; } @@ -2540,7 +2540,7 @@ error_code cellSaveDataFixedImport(ppu_thread& ppu, vm::cptr dirName, u32 cellSaveData.todo("cellSaveDataFixedImport(dirName=%s, maxSizeKB=%d, funcDone=*0x%x, container=0x%x, userdata=*0x%x)", dirName, maxSizeKB, funcDone, container, userdata); if (const auto ecode = savedata_check_args(SAVEDATA_OP_FIXED_IMPORT, CELL_SAVEDATA_VERSION_OLD, dirName, CELL_SAVEDATA_ERRDIALOG_NONE, - vm::null, vm::null, vm::null, vm::null, vm::null, vm::null, container, 0x44, userdata, 0, funcDone)) + vm::null, vm::null, vm::null, vm::null, vm::null, vm::null, container, 0x44, userdata, 0, funcDone)) { return {CELL_SAVEDATA_ERROR_PARAM, " (error %d)", ecode}; } @@ -2555,7 +2555,7 @@ error_code cellSaveDataFixedExport(ppu_thread& ppu, vm::cptr dirName, u32 cellSaveData.todo("cellSaveDataFixedExport(dirName=%s, maxSizeKB=%d, funcDone=*0x%x, container=0x%x, userdata=*0x%x)", dirName, maxSizeKB, funcDone, container, userdata); if (const auto ecode = savedata_check_args(SAVEDATA_OP_FIXED_EXPORT, CELL_SAVEDATA_VERSION_OLD, dirName, CELL_SAVEDATA_ERRDIALOG_NONE, - vm::null, vm::null, vm::null, vm::null, vm::null, vm::null, container, 0x44, userdata, 0, funcDone)) + vm::null, vm::null, vm::null, vm::null, vm::null, vm::null, container, 0x44, userdata, 0, funcDone)) { return {CELL_SAVEDATA_ERROR_PARAM, " (error %d)", ecode}; } @@ -2586,7 +2586,7 @@ error_code cellSaveDataUserListImport(ppu_thread& ppu, u32 userId, PSetList setL cellSaveData.todo("cellSaveDataUserListImport(userId=%d, setList=*0x%x, maxSizeKB=%d, funcDone=*0x%x, container=0x%x, userdata=*0x%x)", userId, setList, maxSizeKB, funcDone, container, userdata); if (const auto ecode = savedata_check_args(SAVEDATA_OP_LIST_IMPORT, CELL_SAVEDATA_VERSION_OLD, vm::null, CELL_SAVEDATA_ERRDIALOG_NONE, - setList, vm::null, vm::null, vm::null, vm::null, vm::null, container, 0x44, userdata, userId, funcDone)) + setList, vm::null, vm::null, vm::null, vm::null, vm::null, container, 0x44, userdata, userId, funcDone)) { return {CELL_SAVEDATA_ERROR_PARAM, " (error %d)", ecode}; } @@ -2601,7 +2601,7 @@ error_code cellSaveDataUserListExport(ppu_thread& ppu, u32 userId, PSetList setL cellSaveData.todo("cellSaveDataUserListExport(userId=%d, setList=*0x%x, maxSizeKB=%d, funcDone=*0x%x, container=0x%x, userdata=*0x%x)", userId, setList, maxSizeKB, funcDone, container, userdata); if (const auto ecode = savedata_check_args(SAVEDATA_OP_LIST_EXPORT, CELL_SAVEDATA_VERSION_OLD, vm::null, CELL_SAVEDATA_ERRDIALOG_NONE, - setList, vm::null, vm::null, vm::null, vm::null, vm::null, container, 0x44, userdata, userId, funcDone)) + setList, vm::null, vm::null, vm::null, vm::null, vm::null, container, 0x44, userdata, userId, funcDone)) { return {CELL_SAVEDATA_ERROR_PARAM, " (error %d)", ecode}; } @@ -2616,7 +2616,7 @@ error_code cellSaveDataUserFixedImport(ppu_thread& ppu, u32 userId, vm::cptr cbResult, vm::ptr get, vm::ptr set); using CellSaveDataListCallback = void(vm::ptr cbResult, vm::ptr get, vm::ptr set); @@ -334,7 +333,6 @@ using CellSaveDataStatCallback = void(vm::ptr cbResult, vm using CellSaveDataFileCallback = void(vm::ptr cbResult, vm::ptr get, vm::ptr set); using CellSaveDataDoneCallback = void(vm::ptr cbResult, vm::ptr get); - // Auxiliary Structs struct SaveDataEntry { diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellScreenshot.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellScreenshot.cpp index b899155dd..22c4c7757 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellScreenshot.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellScreenshot.cpp @@ -8,22 +8,22 @@ LOG_CHANNEL(cellScreenshot); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SCREENSHOT_ERROR_INTERNAL); - STR_CASE(CELL_SCREENSHOT_ERROR_PARAM); - STR_CASE(CELL_SCREENSHOT_ERROR_DECODE); - STR_CASE(CELL_SCREENSHOT_ERROR_NOSPACE); - STR_CASE(CELL_SCREENSHOT_ERROR_UNSUPPORTED_COLOR_FORMAT); - } + switch (error) + { + STR_CASE(CELL_SCREENSHOT_ERROR_INTERNAL); + STR_CASE(CELL_SCREENSHOT_ERROR_PARAM); + STR_CASE(CELL_SCREENSHOT_ERROR_DECODE); + STR_CASE(CELL_SCREENSHOT_ERROR_NOSPACE); + STR_CASE(CELL_SCREENSHOT_ERROR_UNSUPPORTED_COLOR_FORMAT); + } - return unknown; - }); + return unknown; + }); } std::string screenshot_info::get_overlay_path() const @@ -66,7 +66,6 @@ std::string screenshot_info::get_screenshot_path(const std::string& date_path) c return path + suffix; } - error_code cellScreenShotSetParameter(vm::cptr param) { cellScreenshot.warning("cellScreenShotSetParameter(param=*0x%x)", param); @@ -159,14 +158,13 @@ error_code cellScreenShotDisable() cellScreenshot.warning("cellScreenShotDisable(): Disabled"); } - return CELL_OK; } DECLARE(ppu_module_manager::cellScreenShot)("cellScreenShotUtility", []() -{ - REG_FUNC(cellScreenShotUtility, cellScreenShotSetParameter); - REG_FUNC(cellScreenShotUtility, cellScreenShotSetOverlayImage); - REG_FUNC(cellScreenShotUtility, cellScreenShotEnable); - REG_FUNC(cellScreenShotUtility, cellScreenShotDisable); -}); + { + REG_FUNC(cellScreenShotUtility, cellScreenShotSetParameter); + REG_FUNC(cellScreenShotUtility, cellScreenShotSetOverlayImage); + REG_FUNC(cellScreenShotUtility, cellScreenShotEnable); + REG_FUNC(cellScreenShotUtility, cellScreenShotDisable); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellScreenshot.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellScreenshot.h index 20a8d41cc..ca963773f 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellScreenshot.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellScreenshot.h @@ -5,18 +5,18 @@ // Return Codes enum CellScreenShotError : u32 { - CELL_SCREENSHOT_ERROR_INTERNAL = 0x8002d101, - CELL_SCREENSHOT_ERROR_PARAM = 0x8002d102, - CELL_SCREENSHOT_ERROR_DECODE = 0x8002d103, - CELL_SCREENSHOT_ERROR_NOSPACE = 0x8002d104, + CELL_SCREENSHOT_ERROR_INTERNAL = 0x8002d101, + CELL_SCREENSHOT_ERROR_PARAM = 0x8002d102, + CELL_SCREENSHOT_ERROR_DECODE = 0x8002d103, + CELL_SCREENSHOT_ERROR_NOSPACE = 0x8002d104, CELL_SCREENSHOT_ERROR_UNSUPPORTED_COLOR_FORMAT = 0x8002d105, }; enum CellScreenShotParamSize { CELL_SCREENSHOT_PHOTO_TITLE_MAX_LENGTH = 64, - CELL_SCREENSHOT_GAME_TITLE_MAX_LENGTH = 64, - CELL_SCREENSHOT_GAME_COMMENT_MAX_SIZE = 1024, + CELL_SCREENSHOT_GAME_TITLE_MAX_LENGTH = 64, + CELL_SCREENSHOT_GAME_COMMENT_MAX_SIZE = 1024, }; struct CellScreenShotSetParam diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSearch.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSearch.cpp index bcc015176..436bd6ea5 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSearch.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSearch.cpp @@ -14,37 +14,37 @@ LOG_CHANNEL(cellSearch); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SEARCH_CANCELED); - STR_CASE(CELL_SEARCH_ERROR_PARAM); - STR_CASE(CELL_SEARCH_ERROR_BUSY); - STR_CASE(CELL_SEARCH_ERROR_NO_MEMORY); - STR_CASE(CELL_SEARCH_ERROR_UNKNOWN_MODE); - STR_CASE(CELL_SEARCH_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_SEARCH_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_SEARCH_ERROR_FINALIZING); - STR_CASE(CELL_SEARCH_ERROR_NOT_SUPPORTED_SEARCH); - STR_CASE(CELL_SEARCH_ERROR_CONTENT_OBSOLETE); - STR_CASE(CELL_SEARCH_ERROR_CONTENT_NOT_FOUND); - STR_CASE(CELL_SEARCH_ERROR_NOT_LIST); - STR_CASE(CELL_SEARCH_ERROR_OUT_OF_RANGE); - STR_CASE(CELL_SEARCH_ERROR_INVALID_SEARCHID); - STR_CASE(CELL_SEARCH_ERROR_ALREADY_GOT_RESULT); - STR_CASE(CELL_SEARCH_ERROR_NOT_SUPPORTED_CONTEXT); - STR_CASE(CELL_SEARCH_ERROR_INVALID_CONTENTTYPE); - STR_CASE(CELL_SEARCH_ERROR_DRM); - STR_CASE(CELL_SEARCH_ERROR_TAG); - STR_CASE(CELL_SEARCH_ERROR_GENERIC); - } + switch (error) + { + STR_CASE(CELL_SEARCH_CANCELED); + STR_CASE(CELL_SEARCH_ERROR_PARAM); + STR_CASE(CELL_SEARCH_ERROR_BUSY); + STR_CASE(CELL_SEARCH_ERROR_NO_MEMORY); + STR_CASE(CELL_SEARCH_ERROR_UNKNOWN_MODE); + STR_CASE(CELL_SEARCH_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_SEARCH_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_SEARCH_ERROR_FINALIZING); + STR_CASE(CELL_SEARCH_ERROR_NOT_SUPPORTED_SEARCH); + STR_CASE(CELL_SEARCH_ERROR_CONTENT_OBSOLETE); + STR_CASE(CELL_SEARCH_ERROR_CONTENT_NOT_FOUND); + STR_CASE(CELL_SEARCH_ERROR_NOT_LIST); + STR_CASE(CELL_SEARCH_ERROR_OUT_OF_RANGE); + STR_CASE(CELL_SEARCH_ERROR_INVALID_SEARCHID); + STR_CASE(CELL_SEARCH_ERROR_ALREADY_GOT_RESULT); + STR_CASE(CELL_SEARCH_ERROR_NOT_SUPPORTED_CONTEXT); + STR_CASE(CELL_SEARCH_ERROR_INVALID_CONTENTTYPE); + STR_CASE(CELL_SEARCH_ERROR_DRM); + STR_CASE(CELL_SEARCH_ERROR_TAG); + STR_CASE(CELL_SEARCH_ERROR_GENERIC); + } - return unknown; - }); + return unknown; + }); } enum class search_state @@ -108,8 +108,8 @@ struct content_id_map struct search_object_t { // TODO: Figured out the correct values to set here - static const u32 id_base = 1; - static const u32 id_step = 1; + static const u32 id_base = 1; + static const u32 id_step = 1; static const u32 id_count = 1024; // TODO SAVESTATE_INIT_POS(36.1); @@ -216,10 +216,10 @@ void populate_music_info(CellSearchMusicInfo& info, const utils::media_info& mi, info.samplingRate = mi.sample_rate; info.bitrate = mi.audio_bitrate_bps; info.quantizationBitrate = mi.audio_bitrate_bps; // TODO: Assumption, verify value - info.playCount = 0; // we do not track this for now - info.lastPlayedDate = -1; // we do not track this for now - info.importedDate = -1; // we do not track this for now - info.drmEncrypted = 0; // TODO: Needs to be 1 if it's encrypted + info.playCount = 0; // we do not track this for now + info.lastPlayedDate = -1; // we do not track this for now + info.importedDate = -1; // we do not track this for now + info.drmEncrypted = 0; // TODO: Needs to be 1 if it's encrypted info.status = CELL_SEARCH_CONTENTSTATUS_AVAILABLE; // Convert AVCodecID to CellSearchCodec @@ -245,17 +245,17 @@ void populate_music_info(CellSearchMusicInfo& info, const utils::media_info& mi, info.codec = CELL_SEARCH_CODEC_AT3P; break; case 88078: // AV_CODEC_ID_ATRAC3AL - //case 88079: // AV_CODEC_ID_ATRAC3PAL TODO: supported ? + // case 88079: // AV_CODEC_ID_ATRAC3PAL TODO: supported ? info.codec = CELL_SEARCH_CODEC_ATALL; break; // TODO: Find out if any of this works - //case 88069: // AV_CODEC_ID_DSD_LSBF - //case 88070: // AV_CODEC_ID_DSD_MSBF - //case 88071: // AV_CODEC_ID_DSD_LSBF_PLANAR - //case 88072: // AV_CODEC_ID_DSD_MSBF_PLANAR + // case 88069: // AV_CODEC_ID_DSD_LSBF + // case 88070: // AV_CODEC_ID_DSD_MSBF + // case 88071: // AV_CODEC_ID_DSD_LSBF_PLANAR + // case 88072: // AV_CODEC_ID_DSD_MSBF_PLANAR // info.codec = CELL_SEARCH_CODEC_DSD; // break; - //case ???: + // case ???: // info.codec = CELL_SEARCH_CODEC_WAV; // break; default: @@ -265,8 +265,8 @@ void populate_music_info(CellSearchMusicInfo& info, const utils::media_info& mi, } cellSearch.notice("CellSearchMusicInfo:, title=%s, albumTitle=%s, artistName=%s, genreName=%s, diskNumber=%s, " - "trackNumber=%d, duration=%d, size=%d, importedDate=%d, lastPlayedDate=%d, releasedYear=%d, bitrate=%d, " - "samplingRate=%d, quantizationBitrate=%d, playCount=%d, drmEncrypted=%d, codec=%d, status=%d", + "trackNumber=%d, duration=%d, size=%d, importedDate=%d, lastPlayedDate=%d, releasedYear=%d, bitrate=%d, " + "samplingRate=%d, quantizationBitrate=%d, playCount=%d, drmEncrypted=%d, codec=%d, status=%d", info.title, info.albumTitle, info.artistName, info.genreName, info.diskNumber, info.trackNumber, info.duration, info.size, info.importedDate, info.lastPlayedDate, info.releasedYear, info.bitrate, info.samplingRate, info.quantizationBitrate, info.playCount, info.drmEncrypted, info.codec, info.status); @@ -281,10 +281,10 @@ void populate_video_info(CellSearchVideoInfo& info, const utils::media_info& mi, info.duration = mi.duration_us / 1000; // we need microseconds info.audioBitrate = mi.audio_bitrate_bps; info.videoBitrate = mi.video_bitrate_bps; - info.playCount = 0; // we do not track this for now + info.playCount = 0; // we do not track this for now info.importedDate = -1; // we do not track this for now - info.takenDate = -1; // we do not track this for now - info.drmEncrypted = 0; // TODO: Needs to be 1 if it's encrypted + info.takenDate = -1; // we do not track this for now + info.drmEncrypted = 0; // TODO: Needs to be 1 if it's encrypted info.status = CELL_SEARCH_CONTENTSTATUS_AVAILABLE; // Convert Video AVCodecID to CellSearchCodec @@ -312,7 +312,7 @@ void populate_video_info(CellSearchVideoInfo& info, const utils::media_info& mi, switch (mi.audio_av_codec_id) { // Let's ignore this due to CELL_SEARCH_CODEC_MPEG1_LAYER3 - //case 86017: // AV_CODEC_ID_MP3 + // case 86017: // AV_CODEC_ID_MP3 // info.audioCodec = CELL_SEARCH_CODEC_MP3; // break; case 86018: // AV_CODEC_ID_AAC @@ -332,17 +332,17 @@ void populate_video_info(CellSearchVideoInfo& info, const utils::media_info& mi, info.audioCodec = CELL_SEARCH_CODEC_AT3P; break; case 88078: // AV_CODEC_ID_ATRAC3AL - //case 88079: // AV_CODEC_ID_ATRAC3PAL TODO: supported ? + // case 88079: // AV_CODEC_ID_ATRAC3PAL TODO: supported ? info.audioCodec = CELL_SEARCH_CODEC_ATALL; break; // TODO: Find out if any of this works - //case 88069: // AV_CODEC_ID_DSD_LSBF - //case 88070: // AV_CODEC_ID_DSD_MSBF - //case 88071: // AV_CODEC_ID_DSD_LSBF_PLANAR - //case 88072: // AV_CODEC_ID_DSD_MSBF_PLANAR + // case 88069: // AV_CODEC_ID_DSD_LSBF + // case 88070: // AV_CODEC_ID_DSD_MSBF + // case 88071: // AV_CODEC_ID_DSD_LSBF_PLANAR + // case 88072: // AV_CODEC_ID_DSD_MSBF_PLANAR // info.audioCodec = CELL_SEARCH_CODEC_DSD; // break; - //case ???: + // case ???: // info.audioCodec = CELL_SEARCH_CODEC_WAV; // break; case 86058: // AV_CODEC_ID_MP1 @@ -354,13 +354,13 @@ void populate_video_info(CellSearchVideoInfo& info, const utils::media_info& mi, case 86017: // AV_CODEC_ID_MP3 info.audioCodec = CELL_SEARCH_CODEC_MPEG1_LAYER3; break; - //case ???: + // case ???: // info.audioCodec = CELL_SEARCH_CODEC_MPEG2_LAYER1; // break; - //case ???: + // case ???: // info.audioCodec = CELL_SEARCH_CODEC_MPEG2_LAYER2; // break; - //case ???: + // case ???: // info.audioCodec = CELL_SEARCH_CODEC_MPEG2_LAYER3; // break; default: @@ -370,7 +370,7 @@ void populate_video_info(CellSearchVideoInfo& info, const utils::media_info& mi, } cellSearch.notice("CellSearchVideoInfo: title='%s', albumTitle='%s', duration=%d, size=%d, importedDate=%d, takenDate=%d, " - "videoBitrate=%d, audioBitrate=%d, playCount=%d, drmEncrypted=%d, videoCodec=%d, audioCodec=%d, status=%d", + "videoBitrate=%d, audioBitrate=%d, playCount=%d, drmEncrypted=%d, videoCodec=%d, audioCodec=%d, status=%d", info.title, info.albumTitle, info.duration, info.size, info.importedDate, info.takenDate, info.videoBitrate, info.audioBitrate, info.playCount, info.drmEncrypted, info.videoCodec, info.audioCodec, info.status); } @@ -448,11 +448,11 @@ error_code cellSearchInitialize(CellSearchMode mode, u32 container, vm::ptr s32 - { - search.state.store(search_state::idle); - func(ppu, CELL_SEARCH_EVENT_INITIALIZE_RESULT, CELL_OK, vm::null, userData); - return CELL_OK; - }); + { + search.state.store(search_state::idle); + func(ppu, CELL_SEARCH_EVENT_INITIALIZE_RESULT, CELL_OK, vm::null, userData); + return CELL_OK; + }); return CELL_OK; } @@ -469,15 +469,15 @@ error_code cellSearchFinalize() } sysutil_register_cb([&search](ppu_thread& ppu) -> s32 - { { - std::lock_guard lock(search.links_mutex); - search.content_links.clear(); - } - search.state.store(search_state::not_initialized); - search.func(ppu, CELL_SEARCH_EVENT_FINALIZE_RESULT, CELL_OK, vm::null, search.userData); - return CELL_OK; - }); + { + std::lock_guard lock(search.links_mutex); + search.content_links.clear(); + } + search.state.store(search_state::not_initialized); + search.func(ppu, CELL_SEARCH_EVENT_FINALIZE_RESULT, CELL_OK, vm::null, search.userData); + return CELL_OK; + }); return CELL_OK; } @@ -538,34 +538,34 @@ error_code cellSearchStartListSearch(CellSearchListSearchType type, CellSearchSo const u32 id = *outSearchId = idm::make(); sysutil_register_cb([=, &content_map = g_fxo->get(), &search](ppu_thread& ppu) -> s32 - { - auto curr_search = idm::get_unlocked(id); - vm::var resultParam; - resultParam->searchId = id; - resultParam->resultNum = 0; // Set again later - - std::function searchInFolder = [&, type](const std::string& vpath) { - // TODO: this is just a workaround. On a real PS3 the playlists seem to be stored in dev_hdd0/mms/db/metadata_db_hdd + auto curr_search = idm::get_unlocked(id); + vm::var resultParam; + resultParam->searchId = id; + resultParam->resultNum = 0; // Set again later - std::vector dirs_sorted; - - for (auto&& entry : fs::dir(vfs::get(vpath))) + std::function searchInFolder = [&, type](const std::string& vpath) { - entry.name = vfs::unescape(entry.name); + // TODO: this is just a workaround. On a real PS3 the playlists seem to be stored in dev_hdd0/mms/db/metadata_db_hdd - if (entry.is_directory) + std::vector dirs_sorted; + + for (auto&& entry : fs::dir(vfs::get(vpath))) { - if (entry.name == "." || entry.name == "..") + entry.name = vfs::unescape(entry.name); + + if (entry.is_directory) { - continue; // these dirs are not included in the dir list + if (entry.name == "." || entry.name == "..") + { + continue; // these dirs are not included in the dir list + } + + dirs_sorted.push_back(entry); } - - dirs_sorted.push_back(entry); } - } - // clang-format off + // clang-format off std::sort(dirs_sorted.begin(), dirs_sorted.end(), [&](const fs::dir_entry& a, const fs::dir_entry& b) -> bool { switch (sortOrder) @@ -582,140 +582,140 @@ error_code cellSearchStartListSearch(CellSearchListSearchType type, CellSearchSo } } }); - // clang-format on + // clang-format on - for (auto&& item : dirs_sorted) - { - item.name = vfs::unescape(item.name); - - if (item.name == "." || item.name == ".." || !item.is_directory) + for (auto&& item : dirs_sorted) { - continue; - } + item.name = vfs::unescape(item.name); - const std::string item_path(vpath + "/" + item.name); - - // Count files - u32 numOfItems = 0; - for (auto&& file : fs::dir(vfs::get(item_path))) - { - file.name = vfs::unescape(file.name); - - if (file.name == "." || file.name == ".." || file.is_directory) + if (item.name == "." || item.name == ".." || !item.is_directory) { continue; } - numOfItems++; + const std::string item_path(vpath + "/" + item.name); + + // Count files + u32 numOfItems = 0; + for (auto&& file : fs::dir(vfs::get(item_path))) + { + file.name = vfs::unescape(file.name); + + if (file.name == "." || file.name == ".." || file.is_directory) + { + continue; + } + + numOfItems++; + } + + const u64 hash = std::hash()(item_path); + auto found = content_map.map.find(hash); + if (found == content_map.map.end()) // content isn't yet being tracked + { + shared_ptr curr_find = make_shared(); + if (item_path.length() > CELL_SEARCH_PATH_LEN_MAX) + { + // TODO: Create mapping which will be resolved to an actual hard link in VFS by cellSearchPrepareFile + cellSearch.warning("cellSearchStartListSearch(): Directory-Path \"%s\" is too long and will be omitted: %i", item_path, item_path.length()); + continue; + // const size_t ext_offset = item.name.find_last_of('.'); + // std::string link = link_base + std::to_string(hash) + item.name.substr(ext_offset); + // strcpy_trunc(curr_find->infoPath.contentPath, link); + + // std::lock_guard lock(search.links_mutex); + // search.content_links.emplace(std::move(link), search_info::link_data{ .path = item_path, .is_dir = true }); + } + else + { + strcpy_trunc(curr_find->infoPath.contentPath, item_path); + } + + if (item.name.size() > CELL_SEARCH_TITLE_LEN_MAX) + { + item.name.resize(CELL_SEARCH_TITLE_LEN_MAX); + } + + switch (type) + { + case CELL_SEARCH_LISTSEARCHTYPE_MUSIC_ALBUM: + case CELL_SEARCH_LISTSEARCHTYPE_MUSIC_GENRE: + case CELL_SEARCH_LISTSEARCHTYPE_MUSIC_ARTIST: + case CELL_SEARCH_LISTSEARCHTYPE_MUSIC_PLAYLIST: + { + curr_find->type = CELL_SEARCH_CONTENTTYPE_MUSICLIST; + CellSearchMusicListInfo& info = curr_find->data.music_list; + info.listType = type; // CellSearchListType matches CellSearchListSearchType + info.numOfItems = numOfItems; + info.duration = 0; + strcpy_trunc(info.title, item.name); + strcpy_trunc(info.artistName, "ARTIST NAME"); + + cellSearch.notice("CellSearchMusicListInfo: title='%s', artistName='%s', listType=%d, numOfItems=%d, duration=%d", + info.title, info.artistName, info.listType, info.numOfItems, info.duration); + break; + } + case CELL_SEARCH_LISTSEARCHTYPE_PHOTO_YEAR: + case CELL_SEARCH_LISTSEARCHTYPE_PHOTO_MONTH: + case CELL_SEARCH_LISTSEARCHTYPE_PHOTO_ALBUM: + case CELL_SEARCH_LISTSEARCHTYPE_PHOTO_PLAYLIST: + { + curr_find->type = CELL_SEARCH_CONTENTTYPE_PHOTOLIST; + CellSearchPhotoListInfo& info = curr_find->data.photo_list; + info.listType = type; // CellSearchListType matches CellSearchListSearchType + info.numOfItems = numOfItems; + strcpy_trunc(info.title, item.name); + + cellSearch.notice("CellSearchPhotoListInfo: title='%s', listType=%d, numOfItems=%d", + info.title, info.listType, info.numOfItems); + break; + } + case CELL_SEARCH_LISTSEARCHTYPE_VIDEO_ALBUM: + { + curr_find->type = CELL_SEARCH_CONTENTTYPE_VIDEOLIST; + CellSearchVideoListInfo& info = curr_find->data.video_list; + info.listType = type; // CellSearchListType matches CellSearchListSearchType + info.numOfItems = numOfItems; + info.duration = 0; + strcpy_trunc(info.title, item.name); + + cellSearch.notice("CellSearchVideoListInfo: title='%s', listType=%d, numOfItems=%d, duration=%d", + info.title, info.listType, info.numOfItems, info.duration); + break; + } + case CELL_SEARCH_LISTSEARCHTYPE_NONE: + default: + { + // Should be unreachable, because it is already handled in the main function + break; + } + } + + content_map.map.emplace(hash, curr_find); + curr_search->content_ids.emplace_back(hash, curr_find); // place this file's "ID" into the list of found types + + cellSearch.notice("cellSearchStartListSearch(): CellSearchId: 0x%x, Content ID: %08X, Path: \"%s\"", id, hash, item_path); + } + else // list is already stored and tracked + { + // TODO + // Perform checks to see if the identified list has been modified since last checked + // In which case, update the stored content's properties + // auto content_found = &content_map->at(content_id); + curr_search->content_ids.emplace_back(found->first, found->second); + + cellSearch.notice("cellSearchStartListSearch(): Already tracked: CellSearchId: 0x%x, Content ID: %08X, Path: \"%s\"", id, hash, item_path); + } } + }; - const u64 hash = std::hash()(item_path); - auto found = content_map.map.find(hash); - if (found == content_map.map.end()) // content isn't yet being tracked - { - shared_ptr curr_find = make_shared(); - if (item_path.length() > CELL_SEARCH_PATH_LEN_MAX) - { - // TODO: Create mapping which will be resolved to an actual hard link in VFS by cellSearchPrepareFile - cellSearch.warning("cellSearchStartListSearch(): Directory-Path \"%s\" is too long and will be omitted: %i", item_path, item_path.length()); - continue; - // const size_t ext_offset = item.name.find_last_of('.'); - // std::string link = link_base + std::to_string(hash) + item.name.substr(ext_offset); - // strcpy_trunc(curr_find->infoPath.contentPath, link); + searchInFolder(fmt::format("/dev_hdd0/%s", media_dir)); + resultParam->resultNum = ::narrow(curr_search->content_ids.size()); - // std::lock_guard lock(search.links_mutex); - // search.content_links.emplace(std::move(link), search_info::link_data{ .path = item_path, .is_dir = true }); - } - else - { - strcpy_trunc(curr_find->infoPath.contentPath, item_path); - } - - if (item.name.size() > CELL_SEARCH_TITLE_LEN_MAX) - { - item.name.resize(CELL_SEARCH_TITLE_LEN_MAX); - } - - switch (type) - { - case CELL_SEARCH_LISTSEARCHTYPE_MUSIC_ALBUM: - case CELL_SEARCH_LISTSEARCHTYPE_MUSIC_GENRE: - case CELL_SEARCH_LISTSEARCHTYPE_MUSIC_ARTIST: - case CELL_SEARCH_LISTSEARCHTYPE_MUSIC_PLAYLIST: - { - curr_find->type = CELL_SEARCH_CONTENTTYPE_MUSICLIST; - CellSearchMusicListInfo& info = curr_find->data.music_list; - info.listType = type; // CellSearchListType matches CellSearchListSearchType - info.numOfItems = numOfItems; - info.duration = 0; - strcpy_trunc(info.title, item.name); - strcpy_trunc(info.artistName, "ARTIST NAME"); - - cellSearch.notice("CellSearchMusicListInfo: title='%s', artistName='%s', listType=%d, numOfItems=%d, duration=%d", - info.title, info.artistName, info.listType, info.numOfItems, info.duration); - break; - } - case CELL_SEARCH_LISTSEARCHTYPE_PHOTO_YEAR: - case CELL_SEARCH_LISTSEARCHTYPE_PHOTO_MONTH: - case CELL_SEARCH_LISTSEARCHTYPE_PHOTO_ALBUM: - case CELL_SEARCH_LISTSEARCHTYPE_PHOTO_PLAYLIST: - { - curr_find->type = CELL_SEARCH_CONTENTTYPE_PHOTOLIST; - CellSearchPhotoListInfo& info = curr_find->data.photo_list; - info.listType = type; // CellSearchListType matches CellSearchListSearchType - info.numOfItems = numOfItems; - strcpy_trunc(info.title, item.name); - - cellSearch.notice("CellSearchPhotoListInfo: title='%s', listType=%d, numOfItems=%d", - info.title, info.listType, info.numOfItems); - break; - } - case CELL_SEARCH_LISTSEARCHTYPE_VIDEO_ALBUM: - { - curr_find->type = CELL_SEARCH_CONTENTTYPE_VIDEOLIST; - CellSearchVideoListInfo& info = curr_find->data.video_list; - info.listType = type; // CellSearchListType matches CellSearchListSearchType - info.numOfItems = numOfItems; - info.duration = 0; - strcpy_trunc(info.title, item.name); - - cellSearch.notice("CellSearchVideoListInfo: title='%s', listType=%d, numOfItems=%d, duration=%d", - info.title, info.listType, info.numOfItems, info.duration); - break; - } - case CELL_SEARCH_LISTSEARCHTYPE_NONE: - default: - { - // Should be unreachable, because it is already handled in the main function - break; - } - } - - content_map.map.emplace(hash, curr_find); - curr_search->content_ids.emplace_back(hash, curr_find); // place this file's "ID" into the list of found types - - cellSearch.notice("cellSearchStartListSearch(): CellSearchId: 0x%x, Content ID: %08X, Path: \"%s\"", id, hash, item_path); - } - else // list is already stored and tracked - { - // TODO - // Perform checks to see if the identified list has been modified since last checked - // In which case, update the stored content's properties - // auto content_found = &content_map->at(content_id); - curr_search->content_ids.emplace_back(found->first, found->second); - - cellSearch.notice("cellSearchStartListSearch(): Already tracked: CellSearchId: 0x%x, Content ID: %08X, Path: \"%s\"", id, hash, item_path); - } - } - }; - - searchInFolder(fmt::format("/dev_hdd0/%s", media_dir)); - resultParam->resultNum = ::narrow(curr_search->content_ids.size()); - - search.state.store(search_state::idle); - search.func(ppu, CELL_SEARCH_EVENT_LISTSEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); - return CELL_OK; - }); + search.state.store(search_state::idle); + search.func(ppu, CELL_SEARCH_EVENT_LISTSEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); + return CELL_OK; + }); return CELL_OK; } @@ -799,29 +799,29 @@ error_code cellSearchStartContentSearchInList(vm::cptr list const u32 id = *outSearchId = idm::make(); sysutil_register_cb([=, list_path = std::string(content_info->infoPath.contentPath), &search, &content_map](ppu_thread& ppu) -> s32 - { - auto curr_search = idm::get_unlocked(id); - vm::var resultParam; - resultParam->searchId = id; - resultParam->resultNum = 0; // Set again later - - std::function searchInFolder = [&, type](const std::string& vpath) { - std::vector files_sorted; + auto curr_search = idm::get_unlocked(id); + vm::var resultParam; + resultParam->searchId = id; + resultParam->resultNum = 0; // Set again later - for (auto&& entry : fs::dir(vfs::get(vpath))) + std::function searchInFolder = [&, type](const std::string& vpath) { - entry.name = vfs::unescape(entry.name); + std::vector files_sorted; - if (entry.is_directory || entry.name == "." || entry.name == "..") + for (auto&& entry : fs::dir(vfs::get(vpath))) { - continue; + entry.name = vfs::unescape(entry.name); + + if (entry.is_directory || entry.name == "." || entry.name == "..") + { + continue; + } + + files_sorted.push_back(entry); } - files_sorted.push_back(entry); - } - - // clang-format off + // clang-format off std::sort(files_sorted.begin(), files_sorted.end(), [&](const fs::dir_entry& a, const fs::dir_entry& b) -> bool { switch (sortOrder) @@ -838,111 +838,111 @@ error_code cellSearchStartContentSearchInList(vm::cptr list } } }); - // clang-format on + // clang-format on - // TODO: Use sortKey (CellSearchSortKey) to allow for sorting by category + // TODO: Use sortKey (CellSearchSortKey) to allow for sorting by category - for (auto&& item : files_sorted) - { - // TODO - // Perform first check that file is of desired type. For example, don't wanna go - // identifying "AlbumArt.jpg" as an MP3. Hrm... Postpone this thought. Do games - // perform their own checks? DIVA ignores anything without the MP3 extension. - - const std::string item_path(vpath + "/" + item.name); - - const u64 hash = std::hash()(item_path); - auto found = content_map.map.find(hash); - if (found == content_map.map.end()) // content isn't yet being tracked - { - shared_ptr curr_find = make_shared(); - if (item_path.length() > CELL_SEARCH_PATH_LEN_MAX) - { - // Create mapping which will be resolved to an actual hard link in VFS by cellSearchPrepareFile - const size_t ext_offset = item.name.find_last_of('.'); - std::string link = link_base + std::to_string(hash) + item.name.substr(ext_offset); - strcpy_trunc(curr_find->infoPath.contentPath, link); - - std::lock_guard lock(search.links_mutex); - search.content_links.emplace(std::move(link), search_info::link_data{ .path = item_path, .is_dir = false }); - } - else - { - strcpy_trunc(curr_find->infoPath.contentPath, item_path); - } - - // TODO - curr_find.infoPath.thumbnailPath - - switch (type) - { - case CELL_SEARCH_CONTENTSEARCHTYPE_MUSIC_ALL: - { - curr_find->type = CELL_SEARCH_CONTENTTYPE_MUSIC; - - const std::string path = vfs::get(item_path); - const auto [success, mi] = utils::get_media_info(path, 1); // AVMEDIA_TYPE_AUDIO - if (!success) - { - continue; - } - - populate_music_info(curr_find->data.music, mi, item); - break; - } - case CELL_SEARCH_CONTENTSEARCHTYPE_PHOTO_ALL: - { - curr_find->type = CELL_SEARCH_CONTENTTYPE_PHOTO; - - populate_photo_info(curr_find->data.photo, {}, item); - break; - } - case CELL_SEARCH_CONTENTSEARCHTYPE_VIDEO_ALL: - { - curr_find->type = CELL_SEARCH_CONTENTTYPE_VIDEO; - - const std::string path = vfs::get(item_path); - const auto [success, mi] = utils::get_media_info(path, 0); // AVMEDIA_TYPE_VIDEO - if (!success) - { - continue; - } - - populate_video_info(curr_find->data.video, mi, item); - break; - } - case CELL_SEARCH_CONTENTSEARCHTYPE_NONE: - default: - { - // Should be unreachable, because it is already handled in the main function - break; - } - } - - content_map.map.emplace(hash, curr_find); - curr_search->content_ids.emplace_back(hash, curr_find); // place this file's "ID" into the list of found types - - cellSearch.notice("cellSearchStartContentSearchInList(): CellSearchId: 0x%x, Content ID: %08X, Path: \"%s\"", id, hash, item_path); - } - else // file is already stored and tracked + for (auto&& item : files_sorted) { // TODO - // Perform checks to see if the identified file has been modified since last checked - // In which case, update the stored content's properties - // auto content_found = &content_map->at(content_id); - curr_search->content_ids.emplace_back(found->first, found->second); + // Perform first check that file is of desired type. For example, don't wanna go + // identifying "AlbumArt.jpg" as an MP3. Hrm... Postpone this thought. Do games + // perform their own checks? DIVA ignores anything without the MP3 extension. - cellSearch.notice("cellSearchStartContentSearchInList(): Already Tracked: CellSearchId: 0x%x, Content ID: %08X, Path: \"%s\"", id, hash, item_path); + const std::string item_path(vpath + "/" + item.name); + + const u64 hash = std::hash()(item_path); + auto found = content_map.map.find(hash); + if (found == content_map.map.end()) // content isn't yet being tracked + { + shared_ptr curr_find = make_shared(); + if (item_path.length() > CELL_SEARCH_PATH_LEN_MAX) + { + // Create mapping which will be resolved to an actual hard link in VFS by cellSearchPrepareFile + const size_t ext_offset = item.name.find_last_of('.'); + std::string link = link_base + std::to_string(hash) + item.name.substr(ext_offset); + strcpy_trunc(curr_find->infoPath.contentPath, link); + + std::lock_guard lock(search.links_mutex); + search.content_links.emplace(std::move(link), search_info::link_data{.path = item_path, .is_dir = false}); + } + else + { + strcpy_trunc(curr_find->infoPath.contentPath, item_path); + } + + // TODO - curr_find.infoPath.thumbnailPath + + switch (type) + { + case CELL_SEARCH_CONTENTSEARCHTYPE_MUSIC_ALL: + { + curr_find->type = CELL_SEARCH_CONTENTTYPE_MUSIC; + + const std::string path = vfs::get(item_path); + const auto [success, mi] = utils::get_media_info(path, 1); // AVMEDIA_TYPE_AUDIO + if (!success) + { + continue; + } + + populate_music_info(curr_find->data.music, mi, item); + break; + } + case CELL_SEARCH_CONTENTSEARCHTYPE_PHOTO_ALL: + { + curr_find->type = CELL_SEARCH_CONTENTTYPE_PHOTO; + + populate_photo_info(curr_find->data.photo, {}, item); + break; + } + case CELL_SEARCH_CONTENTSEARCHTYPE_VIDEO_ALL: + { + curr_find->type = CELL_SEARCH_CONTENTTYPE_VIDEO; + + const std::string path = vfs::get(item_path); + const auto [success, mi] = utils::get_media_info(path, 0); // AVMEDIA_TYPE_VIDEO + if (!success) + { + continue; + } + + populate_video_info(curr_find->data.video, mi, item); + break; + } + case CELL_SEARCH_CONTENTSEARCHTYPE_NONE: + default: + { + // Should be unreachable, because it is already handled in the main function + break; + } + } + + content_map.map.emplace(hash, curr_find); + curr_search->content_ids.emplace_back(hash, curr_find); // place this file's "ID" into the list of found types + + cellSearch.notice("cellSearchStartContentSearchInList(): CellSearchId: 0x%x, Content ID: %08X, Path: \"%s\"", id, hash, item_path); + } + else // file is already stored and tracked + { + // TODO + // Perform checks to see if the identified file has been modified since last checked + // In which case, update the stored content's properties + // auto content_found = &content_map->at(content_id); + curr_search->content_ids.emplace_back(found->first, found->second); + + cellSearch.notice("cellSearchStartContentSearchInList(): Already Tracked: CellSearchId: 0x%x, Content ID: %08X, Path: \"%s\"", id, hash, item_path); + } } - } - }; + }; - searchInFolder(list_path); - resultParam->resultNum = ::narrow(curr_search->content_ids.size()); + searchInFolder(list_path); + resultParam->resultNum = ::narrow(curr_search->content_ids.size()); - search.state.store(search_state::idle); - search.func(ppu, CELL_SEARCH_EVENT_CONTENTSEARCH_INLIST_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); - return CELL_OK; - }); + search.state.store(search_state::idle); + search.func(ppu, CELL_SEARCH_EVENT_CONTENTSEARCH_INLIST_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); + return CELL_OK; + }); return CELL_OK; } @@ -1059,131 +1059,131 @@ error_code cellSearchStartContentSearch(CellSearchContentSearchType type, CellSe const u32 id = *outSearchId = idm::make(); sysutil_register_cb([=, &content_map = g_fxo->get(), &search](ppu_thread& ppu) -> s32 - { - auto curr_search = idm::get_unlocked(id); - vm::var resultParam; - resultParam->searchId = id; - resultParam->resultNum = 0; // Set again later - - std::function searchInFolder = [&, type](const std::string& vpath, const std::string& prev) { - const std::string relative_vpath = (!prev.empty() ? prev + "/" : "") + vpath; + auto curr_search = idm::get_unlocked(id); + vm::var resultParam; + resultParam->searchId = id; + resultParam->resultNum = 0; // Set again later - for (auto&& item : fs::dir(vfs::get(relative_vpath))) + std::function searchInFolder = [&, type](const std::string& vpath, const std::string& prev) { - item.name = vfs::unescape(item.name); + const std::string relative_vpath = (!prev.empty() ? prev + "/" : "") + vpath; - if (item.name == "." || item.name == "..") + for (auto&& item : fs::dir(vfs::get(relative_vpath))) { - continue; - } + item.name = vfs::unescape(item.name); - if (item.is_directory) - { - searchInFolder(item.name, relative_vpath); - continue; - } - - // TODO - // Perform first check that file is of desired type. For example, don't wanna go - // identifying "AlbumArt.jpg" as an MP3. Hrm... Postpone this thought. Do games - // perform their own checks? DIVA ignores anything without the MP3 extension. - - // TODO - Identify sorting method and insert the appropriate values where applicable - const std::string item_path(relative_vpath + "/" + item.name); - - const u64 hash = std::hash()(item_path); - auto found = content_map.map.find(hash); - if (found == content_map.map.end()) // content isn't yet being tracked - { - shared_ptr curr_find = make_shared(); - if (item_path.length() > CELL_SEARCH_PATH_LEN_MAX) + if (item.name == "." || item.name == "..") { - // Create mapping which will be resolved to an actual hard link in VFS by cellSearchPrepareFile - const size_t ext_offset = item.name.find_last_of('.'); - std::string link = link_base + std::to_string(hash) + item.name.substr(ext_offset); - strcpy_trunc(curr_find->infoPath.contentPath, link); - - std::lock_guard lock(search.links_mutex); - search.content_links.emplace(std::move(link), search_info::link_data{ .path = item_path, .is_dir = false }); - } - else - { - strcpy_trunc(curr_find->infoPath.contentPath, item_path); + continue; } - // TODO - curr_find.infoPath.thumbnailPath - - switch (type) + if (item.is_directory) { - case CELL_SEARCH_CONTENTSEARCHTYPE_MUSIC_ALL: - { - curr_find->type = CELL_SEARCH_CONTENTTYPE_MUSIC; - - const std::string path = vfs::get(item_path); - const auto [success, mi] = utils::get_media_info(path, 1); // AVMEDIA_TYPE_AUDIO - if (!success) - { - continue; - } - - populate_music_info(curr_find->data.music, mi, item); - break; - } - case CELL_SEARCH_CONTENTSEARCHTYPE_PHOTO_ALL: - { - curr_find->type = CELL_SEARCH_CONTENTTYPE_PHOTO; - - populate_photo_info(curr_find->data.photo, {}, item); - break; - } - case CELL_SEARCH_CONTENTSEARCHTYPE_VIDEO_ALL: - { - curr_find->type = CELL_SEARCH_CONTENTTYPE_VIDEO; - - const std::string path = vfs::get(item_path); - const auto [success, mi] = utils::get_media_info(path, 0); // AVMEDIA_TYPE_VIDEO - if (!success) - { - continue; - } - - populate_video_info(curr_find->data.video, mi, item); - break; - } - case CELL_SEARCH_CONTENTSEARCHTYPE_NONE: - default: - { - // Should be unreachable, because it is already handled in the main function - break; - } + searchInFolder(item.name, relative_vpath); + continue; } - content_map.map.emplace(hash, curr_find); - curr_search->content_ids.emplace_back(hash, curr_find); // place this file's "ID" into the list of found types - - cellSearch.notice("cellSearchStartContentSearch(): CellSearchId: 0x%x, Content ID: %08X, Path: \"%s\"", id, hash, item_path); - } - else // file is already stored and tracked - { // TODO - // Perform checks to see if the identified file has been modified since last checked - // In which case, update the stored content's properties - // auto content_found = &content_map->at(content_id); - curr_search->content_ids.emplace_back(found->first, found->second); + // Perform first check that file is of desired type. For example, don't wanna go + // identifying "AlbumArt.jpg" as an MP3. Hrm... Postpone this thought. Do games + // perform their own checks? DIVA ignores anything without the MP3 extension. - cellSearch.notice("cellSearchStartContentSearch(): Already Tracked: CellSearchId: 0x%x, Content ID: %08X, Path: \"%s\"", id, hash, item_path); + // TODO - Identify sorting method and insert the appropriate values where applicable + const std::string item_path(relative_vpath + "/" + item.name); + + const u64 hash = std::hash()(item_path); + auto found = content_map.map.find(hash); + if (found == content_map.map.end()) // content isn't yet being tracked + { + shared_ptr curr_find = make_shared(); + if (item_path.length() > CELL_SEARCH_PATH_LEN_MAX) + { + // Create mapping which will be resolved to an actual hard link in VFS by cellSearchPrepareFile + const size_t ext_offset = item.name.find_last_of('.'); + std::string link = link_base + std::to_string(hash) + item.name.substr(ext_offset); + strcpy_trunc(curr_find->infoPath.contentPath, link); + + std::lock_guard lock(search.links_mutex); + search.content_links.emplace(std::move(link), search_info::link_data{.path = item_path, .is_dir = false}); + } + else + { + strcpy_trunc(curr_find->infoPath.contentPath, item_path); + } + + // TODO - curr_find.infoPath.thumbnailPath + + switch (type) + { + case CELL_SEARCH_CONTENTSEARCHTYPE_MUSIC_ALL: + { + curr_find->type = CELL_SEARCH_CONTENTTYPE_MUSIC; + + const std::string path = vfs::get(item_path); + const auto [success, mi] = utils::get_media_info(path, 1); // AVMEDIA_TYPE_AUDIO + if (!success) + { + continue; + } + + populate_music_info(curr_find->data.music, mi, item); + break; + } + case CELL_SEARCH_CONTENTSEARCHTYPE_PHOTO_ALL: + { + curr_find->type = CELL_SEARCH_CONTENTTYPE_PHOTO; + + populate_photo_info(curr_find->data.photo, {}, item); + break; + } + case CELL_SEARCH_CONTENTSEARCHTYPE_VIDEO_ALL: + { + curr_find->type = CELL_SEARCH_CONTENTTYPE_VIDEO; + + const std::string path = vfs::get(item_path); + const auto [success, mi] = utils::get_media_info(path, 0); // AVMEDIA_TYPE_VIDEO + if (!success) + { + continue; + } + + populate_video_info(curr_find->data.video, mi, item); + break; + } + case CELL_SEARCH_CONTENTSEARCHTYPE_NONE: + default: + { + // Should be unreachable, because it is already handled in the main function + break; + } + } + + content_map.map.emplace(hash, curr_find); + curr_search->content_ids.emplace_back(hash, curr_find); // place this file's "ID" into the list of found types + + cellSearch.notice("cellSearchStartContentSearch(): CellSearchId: 0x%x, Content ID: %08X, Path: \"%s\"", id, hash, item_path); + } + else // file is already stored and tracked + { + // TODO + // Perform checks to see if the identified file has been modified since last checked + // In which case, update the stored content's properties + // auto content_found = &content_map->at(content_id); + curr_search->content_ids.emplace_back(found->first, found->second); + + cellSearch.notice("cellSearchStartContentSearch(): Already Tracked: CellSearchId: 0x%x, Content ID: %08X, Path: \"%s\"", id, hash, item_path); + } } - } - }; + }; - searchInFolder(fmt::format("/dev_hdd0/%s", media_dir), ""); - resultParam->resultNum = ::narrow(curr_search->content_ids.size()); + searchInFolder(fmt::format("/dev_hdd0/%s", media_dir), ""); + resultParam->resultNum = ::narrow(curr_search->content_ids.size()); - search.state.store(search_state::idle); - search.func(ppu, CELL_SEARCH_EVENT_CONTENTSEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); - return CELL_OK; - }); + search.state.store(search_state::idle); + search.func(ppu, CELL_SEARCH_EVENT_CONTENTSEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); + return CELL_OK; + }); return CELL_OK; } @@ -1245,15 +1245,15 @@ error_code cellSearchStartSceneSearchInVideo(vm::cptr video const u32 id = *outSearchId = idm::make(); sysutil_register_cb([=, &search](ppu_thread& ppu) -> s32 - { - vm::var resultParam; - resultParam->searchId = id; - resultParam->resultNum = 0; // TODO + { + vm::var resultParam; + resultParam->searchId = id; + resultParam->resultNum = 0; // TODO - search.state.store(search_state::idle); - search.func(ppu, CELL_SEARCH_EVENT_SCENESEARCH_INVIDEO_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); - return CELL_OK; - }); + search.state.store(search_state::idle); + search.func(ppu, CELL_SEARCH_EVENT_SCENESEARCH_INVIDEO_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); + return CELL_OK; + }); return CELL_OK; } @@ -1338,15 +1338,15 @@ error_code cellSearchStartSceneSearch(CellSearchSceneSearchType searchType, vm:: const u32 id = *outSearchId = idm::make(); sysutil_register_cb([=, &search](ppu_thread& ppu) -> s32 - { - vm::var resultParam; - resultParam->searchId = id; - resultParam->resultNum = 0; // TODO + { + vm::var resultParam; + resultParam->searchId = id; + resultParam->resultNum = 0; // TODO - search.state.store(search_state::idle); - search.func(ppu, CELL_SEARCH_EVENT_SCENESEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); - return CELL_OK; - }); + search.state.store(search_state::idle); + search.func(ppu, CELL_SEARCH_EVENT_SCENESEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search.userData); + return CELL_OK; + }); return CELL_OK; } @@ -1397,25 +1397,32 @@ error_code cellSearchGetContentInfoByOffset(CellSearchId searchId, s32 offset, v switch (content_info->type) { case CELL_SEARCH_CONTENTTYPE_MUSIC: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.music, sizeof(content_info->data.music)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.music, sizeof(content_info->data.music)); break; case CELL_SEARCH_CONTENTTYPE_PHOTO: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.photo, sizeof(content_info->data.photo)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.photo, sizeof(content_info->data.photo)); break; case CELL_SEARCH_CONTENTTYPE_VIDEO: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.video, sizeof(content_info->data.photo)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.video, sizeof(content_info->data.photo)); break; case CELL_SEARCH_CONTENTTYPE_MUSICLIST: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.music_list, sizeof(content_info->data.music_list)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.music_list, sizeof(content_info->data.music_list)); break; case CELL_SEARCH_CONTENTTYPE_PHOTOLIST: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.photo_list, sizeof(content_info->data.photo_list)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.photo_list, sizeof(content_info->data.photo_list)); break; case CELL_SEARCH_CONTENTTYPE_VIDEOLIST: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.video_list, sizeof(content_info->data.video_list)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.video_list, sizeof(content_info->data.video_list)); break; case CELL_SEARCH_CONTENTTYPE_SCENE: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.scene, sizeof(content_info->data.scene)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.scene, sizeof(content_info->data.scene)); break; default: return CELL_SEARCH_ERROR_GENERIC; @@ -1470,25 +1477,32 @@ error_code cellSearchGetContentInfoByContentId(vm::cptr con switch (content_info->type) { case CELL_SEARCH_CONTENTTYPE_MUSIC: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.music, sizeof(content_info->data.music)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.music, sizeof(content_info->data.music)); break; case CELL_SEARCH_CONTENTTYPE_PHOTO: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.photo, sizeof(content_info->data.photo)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.photo, sizeof(content_info->data.photo)); break; case CELL_SEARCH_CONTENTTYPE_VIDEO: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.video, sizeof(content_info->data.photo)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.video, sizeof(content_info->data.photo)); break; case CELL_SEARCH_CONTENTTYPE_MUSICLIST: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.music_list, sizeof(content_info->data.music_list)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.music_list, sizeof(content_info->data.music_list)); break; case CELL_SEARCH_CONTENTTYPE_PHOTOLIST: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.photo_list, sizeof(content_info->data.photo_list)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.photo_list, sizeof(content_info->data.photo_list)); break; case CELL_SEARCH_CONTENTTYPE_VIDEOLIST: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.video_list, sizeof(content_info->data.video_list)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.video_list, sizeof(content_info->data.video_list)); break; case CELL_SEARCH_CONTENTTYPE_SCENE: - if (infoBuffer) std::memcpy(infoBuffer.get_ptr(), &content_info->data.scene, sizeof(content_info->data.scene)); + if (infoBuffer) + std::memcpy(infoBuffer.get_ptr(), &content_info->data.scene, sizeof(content_info->data.scene)); break; default: return CELL_SEARCH_ERROR_GENERIC; @@ -1596,7 +1610,6 @@ error_code cellSearchGetContentIdByOffset(CellSearchId searchId, s32 offset, vm: { std::memcpy(outTimeInfo.get_ptr(), &content_id.second->time_info, sizeof(content_id.second->time_info)); } - } else // content ID not found, perform a search first { @@ -1708,19 +1721,22 @@ error_code cellSearchGetMusicSelectionContext(CellSearchId searchId, vm::cptr(contentId->data); - auto content = std::find_if(searchObject->content_ids.begin(), searchObject->content_ids.end(), [&content_hash](const content_id_type& cid){ return cid.first == content_hash; }); + auto content = std::find_if(searchObject->content_ids.begin(), searchObject->content_ids.end(), [&content_hash](const content_id_type& cid) + { + return cid.first == content_hash; + }); if (content != searchObject->content_ids.cend() && content->second) { // Check if the type of the found content is correct if (content->second->type != CELL_SEARCH_CONTENTTYPE_MUSIC) { - return { CELL_SEARCH_ERROR_INVALID_CONTENTTYPE, "Type: %d, Expected: CELL_SEARCH_CONTENTTYPE_MUSIC"}; + return {CELL_SEARCH_ERROR_INVALID_CONTENTTYPE, "Type: %d, Expected: CELL_SEARCH_CONTENTTYPE_MUSIC"}; } // Check if the type of the found content matches our search content type if (content->second->type != first_content->type) { - return { CELL_SEARCH_ERROR_NOT_SUPPORTED_CONTEXT, "Type: %d, Expected: %d", +content->second->type, +first_content->type }; + return {CELL_SEARCH_ERROR_NOT_SUPPORTED_CONTEXT, "Type: %d, Expected: %d", +content->second->type, +first_content->type}; } // Use the found content @@ -1730,7 +1746,7 @@ error_code cellSearchGetMusicSelectionContext(CellSearchId searchId, vm::cptrtype == CELL_SEARCH_CONTENTTYPE_MUSICLIST) { // Abort if we can't find the playlist. - return { CELL_SEARCH_ERROR_CONTENT_NOT_FOUND, "Type: CELL_SEARCH_CONTENTTYPE_MUSICLIST" }; + return {CELL_SEARCH_ERROR_CONTENT_NOT_FOUND, "Type: CELL_SEARCH_CONTENTTYPE_MUSICLIST"}; } else if (option == CELL_SEARCH_CONTEXTOPTION_SHUFFLE) { @@ -1751,7 +1767,7 @@ error_code cellSearchGetMusicSelectionContext(CellSearchId searchId, vm::cptrtype == CELL_SEARCH_CONTENTTYPE_MUSICLIST) { // Abort if we don't have the necessary info to select a playlist. - return { CELL_SEARCH_ERROR_NOT_SUPPORTED_CONTEXT, "Type: CELL_SEARCH_CONTENTTYPE_MUSICLIST" }; + return {CELL_SEARCH_ERROR_NOT_SUPPORTED_CONTEXT, "Type: CELL_SEARCH_CONTENTTYPE_MUSICLIST"}; } else if (option == CELL_SEARCH_CONTEXTOPTION_SHUFFLE) { @@ -2088,29 +2104,29 @@ error_code cellSearchEnd(CellSearchId searchId) } DECLARE(ppu_module_manager::cellSearch)("cellSearchUtility", []() -{ - REG_FUNC(cellSearchUtility, cellSearchInitialize); - REG_FUNC(cellSearchUtility, cellSearchFinalize); - REG_FUNC(cellSearchUtility, cellSearchStartListSearch); - REG_FUNC(cellSearchUtility, cellSearchStartContentSearchInList); - REG_FUNC(cellSearchUtility, cellSearchStartContentSearch); - REG_FUNC(cellSearchUtility, cellSearchStartSceneSearchInVideo); - REG_FUNC(cellSearchUtility, cellSearchStartSceneSearch); - REG_FUNC(cellSearchUtility, cellSearchGetContentInfoByOffset); - REG_FUNC(cellSearchUtility, cellSearchGetContentInfoByContentId); - REG_FUNC(cellSearchUtility, cellSearchGetOffsetByContentId); - REG_FUNC(cellSearchUtility, cellSearchGetContentIdByOffset); - REG_FUNC(cellSearchUtility, cellSearchGetContentInfoGameComment); - REG_FUNC(cellSearchUtility, cellSearchGetMusicSelectionContext); - REG_FUNC(cellSearchUtility, cellSearchGetMusicSelectionContextOfSingleTrack); - REG_FUNC(cellSearchUtility, cellSearchGetContentInfoPath); - REG_FUNC(cellSearchUtility, cellSearchGetContentInfoPathMovieThumb); - REG_FUNC(cellSearchUtility, cellSearchPrepareFile); - REG_FUNC(cellSearchUtility, cellSearchGetContentInfoDeveloperData); - REG_FUNC(cellSearchUtility, cellSearchGetContentInfoSharable); - REG_FUNC(cellSearchUtility, cellSearchCancel); - REG_FUNC(cellSearchUtility, cellSearchEnd); -}); + { + REG_FUNC(cellSearchUtility, cellSearchInitialize); + REG_FUNC(cellSearchUtility, cellSearchFinalize); + REG_FUNC(cellSearchUtility, cellSearchStartListSearch); + REG_FUNC(cellSearchUtility, cellSearchStartContentSearchInList); + REG_FUNC(cellSearchUtility, cellSearchStartContentSearch); + REG_FUNC(cellSearchUtility, cellSearchStartSceneSearchInVideo); + REG_FUNC(cellSearchUtility, cellSearchStartSceneSearch); + REG_FUNC(cellSearchUtility, cellSearchGetContentInfoByOffset); + REG_FUNC(cellSearchUtility, cellSearchGetContentInfoByContentId); + REG_FUNC(cellSearchUtility, cellSearchGetOffsetByContentId); + REG_FUNC(cellSearchUtility, cellSearchGetContentIdByOffset); + REG_FUNC(cellSearchUtility, cellSearchGetContentInfoGameComment); + REG_FUNC(cellSearchUtility, cellSearchGetMusicSelectionContext); + REG_FUNC(cellSearchUtility, cellSearchGetMusicSelectionContextOfSingleTrack); + REG_FUNC(cellSearchUtility, cellSearchGetContentInfoPath); + REG_FUNC(cellSearchUtility, cellSearchGetContentInfoPathMovieThumb); + REG_FUNC(cellSearchUtility, cellSearchPrepareFile); + REG_FUNC(cellSearchUtility, cellSearchGetContentInfoDeveloperData); + REG_FUNC(cellSearchUtility, cellSearchGetContentInfoSharable); + REG_FUNC(cellSearchUtility, cellSearchCancel); + REG_FUNC(cellSearchUtility, cellSearchEnd); + }); // Helper error_code music_selection_context::find_content_id(vm::ptr contents_id) @@ -2199,7 +2215,7 @@ error_code music_selection_context::find_content_id(vm::ptr strcpy_trunc(curr_find->infoPath.contentPath, link); std::lock_guard lock(search.links_mutex); - search.content_links.emplace(std::move(link), search_info::link_data{ .path = dir_path, .is_dir = true }); + search.content_links.emplace(std::move(link), search_info::link_data{.path = dir_path, .is_dir = true}); } else { @@ -2256,7 +2272,7 @@ error_code music_selection_context::find_content_id(vm::ptr strcpy_trunc(curr_find->infoPath.contentPath, link); std::lock_guard lock(search.links_mutex); - search.content_links.emplace(std::move(link), search_info::link_data{ .path = file_path, .is_dir = false }); + search.content_links.emplace(std::move(link), search_info::link_data{.path = file_path, .is_dir = false}); } else { diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSearch.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellSearch.h index e52e94598..2b160e4ff 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSearch.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSearch.h @@ -5,134 +5,134 @@ // Error Codes enum CellSearchError : u32 { - CELL_SEARCH_CANCELED = 1, - CELL_SEARCH_ERROR_PARAM = 0x8002C801, - CELL_SEARCH_ERROR_BUSY = 0x8002C802, - CELL_SEARCH_ERROR_NO_MEMORY = 0x8002C803, - CELL_SEARCH_ERROR_UNKNOWN_MODE = 0x8002C804, - CELL_SEARCH_ERROR_ALREADY_INITIALIZED = 0x8002C805, - CELL_SEARCH_ERROR_NOT_INITIALIZED = 0x8002C806, - CELL_SEARCH_ERROR_FINALIZING = 0x8002C807, - CELL_SEARCH_ERROR_NOT_SUPPORTED_SEARCH = 0x8002C808, - CELL_SEARCH_ERROR_CONTENT_OBSOLETE = 0x8002C809, - CELL_SEARCH_ERROR_CONTENT_NOT_FOUND = 0x8002C80A, - CELL_SEARCH_ERROR_NOT_LIST = 0x8002C80B, - CELL_SEARCH_ERROR_OUT_OF_RANGE = 0x8002C80C, - CELL_SEARCH_ERROR_INVALID_SEARCHID = 0x8002C80D, - CELL_SEARCH_ERROR_ALREADY_GOT_RESULT = 0x8002C80E, + CELL_SEARCH_CANCELED = 1, + CELL_SEARCH_ERROR_PARAM = 0x8002C801, + CELL_SEARCH_ERROR_BUSY = 0x8002C802, + CELL_SEARCH_ERROR_NO_MEMORY = 0x8002C803, + CELL_SEARCH_ERROR_UNKNOWN_MODE = 0x8002C804, + CELL_SEARCH_ERROR_ALREADY_INITIALIZED = 0x8002C805, + CELL_SEARCH_ERROR_NOT_INITIALIZED = 0x8002C806, + CELL_SEARCH_ERROR_FINALIZING = 0x8002C807, + CELL_SEARCH_ERROR_NOT_SUPPORTED_SEARCH = 0x8002C808, + CELL_SEARCH_ERROR_CONTENT_OBSOLETE = 0x8002C809, + CELL_SEARCH_ERROR_CONTENT_NOT_FOUND = 0x8002C80A, + CELL_SEARCH_ERROR_NOT_LIST = 0x8002C80B, + CELL_SEARCH_ERROR_OUT_OF_RANGE = 0x8002C80C, + CELL_SEARCH_ERROR_INVALID_SEARCHID = 0x8002C80D, + CELL_SEARCH_ERROR_ALREADY_GOT_RESULT = 0x8002C80E, CELL_SEARCH_ERROR_NOT_SUPPORTED_CONTEXT = 0x8002C80F, - CELL_SEARCH_ERROR_INVALID_CONTENTTYPE = 0x8002C810, - CELL_SEARCH_ERROR_DRM = 0x8002C811, - CELL_SEARCH_ERROR_TAG = 0x8002C812, - CELL_SEARCH_ERROR_GENERIC = 0x8002C8FF, + CELL_SEARCH_ERROR_INVALID_CONTENTTYPE = 0x8002C810, + CELL_SEARCH_ERROR_DRM = 0x8002C811, + CELL_SEARCH_ERROR_TAG = 0x8002C812, + CELL_SEARCH_ERROR_GENERIC = 0x8002C8FF, }; // Constants enum { - CELL_SEARCH_CONTENT_ID_SIZE = 16, - CELL_SEARCH_TITLE_LEN_MAX = 384, - CELL_SEARCH_TAG_NUM_MAX = 6, - CELL_SEARCH_TAG_LEN_MAX = 63, - CELL_SEARCH_PATH_LEN_MAX = 63, - CELL_SEARCH_MTOPTION_LEN_MAX = 63, - CELL_SEARCH_DEVELOPERDATA_LEN_MAX = 64, - CELL_SEARCH_GAMECOMMENT_SIZE_MAX = 1024, + CELL_SEARCH_CONTENT_ID_SIZE = 16, + CELL_SEARCH_TITLE_LEN_MAX = 384, + CELL_SEARCH_TAG_NUM_MAX = 6, + CELL_SEARCH_TAG_LEN_MAX = 63, + CELL_SEARCH_PATH_LEN_MAX = 63, + CELL_SEARCH_MTOPTION_LEN_MAX = 63, + CELL_SEARCH_DEVELOPERDATA_LEN_MAX = 64, + CELL_SEARCH_GAMECOMMENT_SIZE_MAX = 1024, CELL_SEARCH_CONTENT_BUFFER_SIZE_MAX = 2048, }; // Sort keys enum CellSearchSortKey : s32 { - CELL_SEARCH_SORTKEY_NONE = 0, - CELL_SEARCH_SORTKEY_DEFAULT = 1, - CELL_SEARCH_SORTKEY_TITLE = 2, - CELL_SEARCH_SORTKEY_ALBUMTITLE = 3, - CELL_SEARCH_SORTKEY_GENRENAME = 4, - CELL_SEARCH_SORTKEY_ARTISTNAME = 5, + CELL_SEARCH_SORTKEY_NONE = 0, + CELL_SEARCH_SORTKEY_DEFAULT = 1, + CELL_SEARCH_SORTKEY_TITLE = 2, + CELL_SEARCH_SORTKEY_ALBUMTITLE = 3, + CELL_SEARCH_SORTKEY_GENRENAME = 4, + CELL_SEARCH_SORTKEY_ARTISTNAME = 5, CELL_SEARCH_SORTKEY_IMPORTEDDATE = 6, - CELL_SEARCH_SORTKEY_TRACKNUMBER = 7, - CELL_SEARCH_SORTKEY_TAKENDATE = 8, - CELL_SEARCH_SORTKEY_USERDEFINED = 9, + CELL_SEARCH_SORTKEY_TRACKNUMBER = 7, + CELL_SEARCH_SORTKEY_TAKENDATE = 8, + CELL_SEARCH_SORTKEY_USERDEFINED = 9, CELL_SEARCH_SORTKEY_MODIFIEDDATE = 10, }; // Sort order enum CellSearchSortOrder : s32 { - CELL_SEARCH_SORTORDER_NONE = 0, - CELL_SEARCH_SORTORDER_ASCENDING = 1, + CELL_SEARCH_SORTORDER_NONE = 0, + CELL_SEARCH_SORTORDER_ASCENDING = 1, CELL_SEARCH_SORTORDER_DESCENDING = 2, }; // Content types enum CellSearchContentType : s32 { - CELL_SEARCH_CONTENTTYPE_NONE = 0, - CELL_SEARCH_CONTENTTYPE_MUSIC = 1, + CELL_SEARCH_CONTENTTYPE_NONE = 0, + CELL_SEARCH_CONTENTTYPE_MUSIC = 1, CELL_SEARCH_CONTENTTYPE_MUSICLIST = 2, - CELL_SEARCH_CONTENTTYPE_PHOTO = 3, + CELL_SEARCH_CONTENTTYPE_PHOTO = 3, CELL_SEARCH_CONTENTTYPE_PHOTOLIST = 4, - CELL_SEARCH_CONTENTTYPE_VIDEO = 5, + CELL_SEARCH_CONTENTTYPE_VIDEO = 5, CELL_SEARCH_CONTENTTYPE_VIDEOLIST = 6, - CELL_SEARCH_CONTENTTYPE_SCENE = 7, + CELL_SEARCH_CONTENTTYPE_SCENE = 7, }; // Codecs enum CellSearchCodec : s32 { - CELL_SEARCH_CODEC_UNKNOWN = 0, - CELL_SEARCH_CODEC_MPEG2 = 1, - CELL_SEARCH_CODEC_MPEG4 = 2, - CELL_SEARCH_CODEC_AVC = 3, - CELL_SEARCH_CODEC_MPEG1 = 4, - CELL_SEARCH_CODEC_AT3 = 5, - CELL_SEARCH_CODEC_AT3P = 6, - CELL_SEARCH_CODEC_ATALL = 7, - CELL_SEARCH_CODEC_MP3 = 8, - CELL_SEARCH_CODEC_AAC = 9, - CELL_SEARCH_CODEC_LPCM = 10, - CELL_SEARCH_CODEC_WAV = 11, - CELL_SEARCH_CODEC_WMA = 12, - CELL_SEARCH_CODEC_JPEG = 13, - CELL_SEARCH_CODEC_PNG = 14, - CELL_SEARCH_CODEC_TIFF = 15, - CELL_SEARCH_CODEC_BMP = 16, - CELL_SEARCH_CODEC_GIF = 17, - CELL_SEARCH_CODEC_MPEG2_TS = 18, - CELL_SEARCH_CODEC_DSD = 19, - CELL_SEARCH_CODEC_AC3 = 20, + CELL_SEARCH_CODEC_UNKNOWN = 0, + CELL_SEARCH_CODEC_MPEG2 = 1, + CELL_SEARCH_CODEC_MPEG4 = 2, + CELL_SEARCH_CODEC_AVC = 3, + CELL_SEARCH_CODEC_MPEG1 = 4, + CELL_SEARCH_CODEC_AT3 = 5, + CELL_SEARCH_CODEC_AT3P = 6, + CELL_SEARCH_CODEC_ATALL = 7, + CELL_SEARCH_CODEC_MP3 = 8, + CELL_SEARCH_CODEC_AAC = 9, + CELL_SEARCH_CODEC_LPCM = 10, + CELL_SEARCH_CODEC_WAV = 11, + CELL_SEARCH_CODEC_WMA = 12, + CELL_SEARCH_CODEC_JPEG = 13, + CELL_SEARCH_CODEC_PNG = 14, + CELL_SEARCH_CODEC_TIFF = 15, + CELL_SEARCH_CODEC_BMP = 16, + CELL_SEARCH_CODEC_GIF = 17, + CELL_SEARCH_CODEC_MPEG2_TS = 18, + CELL_SEARCH_CODEC_DSD = 19, + CELL_SEARCH_CODEC_AC3 = 20, CELL_SEARCH_CODEC_MPEG1_LAYER1 = 21, CELL_SEARCH_CODEC_MPEG1_LAYER2 = 22, CELL_SEARCH_CODEC_MPEG1_LAYER3 = 23, CELL_SEARCH_CODEC_MPEG2_LAYER1 = 24, CELL_SEARCH_CODEC_MPEG2_LAYER2 = 25, CELL_SEARCH_CODEC_MPEG2_LAYER3 = 26, - CELL_SEARCH_CODEC_MOTIONJPEG = 27, - CELL_SEARCH_CODEC_MPO = 28, + CELL_SEARCH_CODEC_MOTIONJPEG = 27, + CELL_SEARCH_CODEC_MPO = 28, }; // Scene types enum CellSearchSceneType : s32 { - CELL_SEARCH_SCENETYPE_NONE = 0, - CELL_SEARCH_SCENETYPE_CHAPTER = 1, + CELL_SEARCH_SCENETYPE_NONE = 0, + CELL_SEARCH_SCENETYPE_CHAPTER = 1, CELL_SEARCH_SCENETYPE_CLIP_HIGHLIGHT = 2, - CELL_SEARCH_SCENETYPE_CLIP_USER = 3, + CELL_SEARCH_SCENETYPE_CLIP_USER = 3, }; // List types enum CellSearchListType : s32 { - CELL_SEARCH_LISTTYPE_NONE = 0, - CELL_SEARCH_LISTTYPE_MUSIC_ALBUM = 1, - CELL_SEARCH_LISTTYPE_MUSIC_GENRE = 2, - CELL_SEARCH_LISTTYPE_MUSIC_ARTIST = 3, - CELL_SEARCH_LISTTYPE_PHOTO_YEAR = 4, - CELL_SEARCH_LISTTYPE_PHOTO_MONTH = 5, - CELL_SEARCH_LISTTYPE_PHOTO_ALBUM = 6, + CELL_SEARCH_LISTTYPE_NONE = 0, + CELL_SEARCH_LISTTYPE_MUSIC_ALBUM = 1, + CELL_SEARCH_LISTTYPE_MUSIC_GENRE = 2, + CELL_SEARCH_LISTTYPE_MUSIC_ARTIST = 3, + CELL_SEARCH_LISTTYPE_PHOTO_YEAR = 4, + CELL_SEARCH_LISTTYPE_PHOTO_MONTH = 5, + CELL_SEARCH_LISTTYPE_PHOTO_ALBUM = 6, CELL_SEARCH_LISTTYPE_PHOTO_PLAYLIST = 7, - CELL_SEARCH_LISTTYPE_VIDEO_ALBUM = 8, + CELL_SEARCH_LISTTYPE_VIDEO_ALBUM = 8, CELL_SEARCH_LISTTYPE_MUSIC_PLAYLIST = 9, }; @@ -281,7 +281,7 @@ struct CellSearchMusicInfo be_t quantizationBitrate; be_t playCount; be_t drmEncrypted; - be_t codec; // CellSearchCodec + be_t codec; // CellSearchCodec be_t status; // CellSearchContentStatus char diskNumber[8]; char title[CELL_SEARCH_TITLE_LEN_MAX + 1]; @@ -302,8 +302,8 @@ struct CellSearchPhotoInfo be_t width; be_t height; be_t orientation; // CellSearchOrientation - be_t codec; // CellSearchCodec - be_t status; // CellSearchContentStatus + be_t codec; // CellSearchCodec + be_t status; // CellSearchContentStatus char title[CELL_SEARCH_TITLE_LEN_MAX + 1]; char reserved[3]; char albumTitle[CELL_SEARCH_TITLE_LEN_MAX + 1]; @@ -322,7 +322,7 @@ struct CellSearchVideoInfo be_t drmEncrypted; be_t videoCodec; // CellSearchCodec be_t audioCodec; // CellSearchCodec - be_t status; // CellSearchContentStatus + be_t status; // CellSearchContentStatus char title[CELL_SEARCH_TITLE_LEN_MAX + 1]; char reserved[3]; char albumTitle[CELL_SEARCH_TITLE_LEN_MAX + 1]; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSheap.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSheap.cpp index 781a064d7..749a63b7a 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSheap.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSheap.cpp @@ -6,9 +6,9 @@ LOG_CHANNEL(cellSheap); // Return Codes enum CellSheapError : u32 { - CELL_SHEAP_ERROR_INVAL = 0x80410302, - CELL_SHEAP_ERROR_BUSY = 0x8041030A, - CELL_SHEAP_ERROR_ALIGN = 0x80410310, + CELL_SHEAP_ERROR_INVAL = 0x80410302, + CELL_SHEAP_ERROR_BUSY = 0x8041030A, + CELL_SHEAP_ERROR_ALIGN = 0x80410310, CELL_SHEAP_ERROR_SHORTAGE = 0x80410312, }; @@ -16,17 +16,17 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SHEAP_ERROR_INVAL); - STR_CASE(CELL_SHEAP_ERROR_BUSY); - STR_CASE(CELL_SHEAP_ERROR_ALIGN); - STR_CASE(CELL_SHEAP_ERROR_SHORTAGE); - } + switch (error) + { + STR_CASE(CELL_SHEAP_ERROR_INVAL); + STR_CASE(CELL_SHEAP_ERROR_BUSY); + STR_CASE(CELL_SHEAP_ERROR_ALIGN); + STR_CASE(CELL_SHEAP_ERROR_SHORTAGE); + } - return unknown; - }); + return unknown; + }); } error_code cellSheapInitialize() @@ -138,25 +138,25 @@ error_code cellKeySheapQueueDelete() } DECLARE(ppu_module_manager::cellSheap)("cellSheap", []() -{ - REG_FUNC(cellSheap, cellSheapInitialize); - REG_FUNC(cellSheap, cellSheapAllocate); - REG_FUNC(cellSheap, cellSheapFree); - REG_FUNC(cellSheap, cellSheapQueryMax); - REG_FUNC(cellSheap, cellSheapQueryFree); + { + REG_FUNC(cellSheap, cellSheapInitialize); + REG_FUNC(cellSheap, cellSheapAllocate); + REG_FUNC(cellSheap, cellSheapFree); + REG_FUNC(cellSheap, cellSheapQueryMax); + REG_FUNC(cellSheap, cellSheapQueryFree); - REG_FUNC(cellSheap, cellKeySheapInitialize); - REG_FUNC(cellSheap, cellKeySheapBufferNew); - REG_FUNC(cellSheap, cellKeySheapBufferDelete); + REG_FUNC(cellSheap, cellKeySheapInitialize); + REG_FUNC(cellSheap, cellKeySheapBufferNew); + REG_FUNC(cellSheap, cellKeySheapBufferDelete); - REG_FUNC(cellSheap, cellKeySheapMutexNew); - REG_FUNC(cellSheap, cellKeySheapMutexDelete); - REG_FUNC(cellSheap, cellKeySheapBarrierNew); - REG_FUNC(cellSheap, cellKeySheapBarrierDelete); - REG_FUNC(cellSheap, cellKeySheapSemaphoreNew); - REG_FUNC(cellSheap, cellKeySheapSemaphoreDelete); - REG_FUNC(cellSheap, cellKeySheapRwmNew); - REG_FUNC(cellSheap, cellKeySheapRwmDelete); - REG_FUNC(cellSheap, cellKeySheapQueueNew); - REG_FUNC(cellSheap, cellKeySheapQueueDelete); -}); + REG_FUNC(cellSheap, cellKeySheapMutexNew); + REG_FUNC(cellSheap, cellKeySheapMutexDelete); + REG_FUNC(cellSheap, cellKeySheapBarrierNew); + REG_FUNC(cellSheap, cellKeySheapBarrierDelete); + REG_FUNC(cellSheap, cellKeySheapSemaphoreNew); + REG_FUNC(cellSheap, cellKeySheapSemaphoreDelete); + REG_FUNC(cellSheap, cellKeySheapRwmNew); + REG_FUNC(cellSheap, cellKeySheapRwmDelete); + REG_FUNC(cellSheap, cellKeySheapQueueNew); + REG_FUNC(cellSheap, cellKeySheapQueueDelete); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSpudll.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSpudll.cpp index d2d8b12ae..b461569f5 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSpudll.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSpudll.cpp @@ -3,28 +3,26 @@ #include "cellSpudll.h" - - LOG_CHANNEL(cellSpudll); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SPUDLL_ERROR_INVAL); - STR_CASE(CELL_SPUDLL_ERROR_STAT); - STR_CASE(CELL_SPUDLL_ERROR_ALIGN); - STR_CASE(CELL_SPUDLL_ERROR_NULL_POINTER); - STR_CASE(CELL_SPUDLL_ERROR_SRCH); - STR_CASE(CELL_SPUDLL_ERROR_UNDEF); - STR_CASE(CELL_SPUDLL_ERROR_FATAL); - } + switch (error) + { + STR_CASE(CELL_SPUDLL_ERROR_INVAL); + STR_CASE(CELL_SPUDLL_ERROR_STAT); + STR_CASE(CELL_SPUDLL_ERROR_ALIGN); + STR_CASE(CELL_SPUDLL_ERROR_NULL_POINTER); + STR_CASE(CELL_SPUDLL_ERROR_SRCH); + STR_CASE(CELL_SPUDLL_ERROR_UNDEF); + STR_CASE(CELL_SPUDLL_ERROR_FATAL); + } - return unknown; - }); + return unknown; + }); } error_code cellSpudllGetImageSize(vm::ptr psize, vm::cptr so_elf, vm::cptr config) @@ -64,7 +62,7 @@ error_code cellSpudllHandleConfigSetDefaultValues(vm::ptr void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SPURS_CORE_ERROR_AGAIN); - STR_CASE(CELL_SPURS_CORE_ERROR_INVAL); - STR_CASE(CELL_SPURS_CORE_ERROR_NOMEM); - STR_CASE(CELL_SPURS_CORE_ERROR_SRCH); - STR_CASE(CELL_SPURS_CORE_ERROR_PERM); - STR_CASE(CELL_SPURS_CORE_ERROR_BUSY); - STR_CASE(CELL_SPURS_CORE_ERROR_STAT); - STR_CASE(CELL_SPURS_CORE_ERROR_ALIGN); - STR_CASE(CELL_SPURS_CORE_ERROR_NULL_POINTER); - } + switch (error) + { + STR_CASE(CELL_SPURS_CORE_ERROR_AGAIN); + STR_CASE(CELL_SPURS_CORE_ERROR_INVAL); + STR_CASE(CELL_SPURS_CORE_ERROR_NOMEM); + STR_CASE(CELL_SPURS_CORE_ERROR_SRCH); + STR_CASE(CELL_SPURS_CORE_ERROR_PERM); + STR_CASE(CELL_SPURS_CORE_ERROR_BUSY); + STR_CASE(CELL_SPURS_CORE_ERROR_STAT); + STR_CASE(CELL_SPURS_CORE_ERROR_ALIGN); + STR_CASE(CELL_SPURS_CORE_ERROR_NULL_POINTER); + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_AGAIN); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_INVAL); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_NOSYS); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_NOMEM); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_SRCH); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_NOENT); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_NOEXEC); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_DEADLK); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_PERM); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_BUSY); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_ABORT); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_FAULT); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_CHILD); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_STAT); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_ALIGN); - STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER); - } + switch (error) + { + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_AGAIN); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_INVAL); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_NOSYS); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_NOMEM); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_SRCH); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_NOENT); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_NOEXEC); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_DEADLK); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_PERM); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_BUSY); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_ABORT); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_FAULT); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_CHILD); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_STAT); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_ALIGN); + STR_CASE(CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER); + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SPURS_TASK_ERROR_AGAIN); - STR_CASE(CELL_SPURS_TASK_ERROR_INVAL); - STR_CASE(CELL_SPURS_TASK_ERROR_NOSYS); - STR_CASE(CELL_SPURS_TASK_ERROR_NOMEM); - STR_CASE(CELL_SPURS_TASK_ERROR_SRCH); - STR_CASE(CELL_SPURS_TASK_ERROR_NOEXEC); - STR_CASE(CELL_SPURS_TASK_ERROR_PERM); - STR_CASE(CELL_SPURS_TASK_ERROR_BUSY); - STR_CASE(CELL_SPURS_TASK_ERROR_FAULT); - STR_CASE(CELL_SPURS_TASK_ERROR_ALIGN); - STR_CASE(CELL_SPURS_TASK_ERROR_STAT); - STR_CASE(CELL_SPURS_TASK_ERROR_NULL_POINTER); - STR_CASE(CELL_SPURS_TASK_ERROR_FATAL); - STR_CASE(CELL_SPURS_TASK_ERROR_SHUTDOWN); - } + switch (error) + { + STR_CASE(CELL_SPURS_TASK_ERROR_AGAIN); + STR_CASE(CELL_SPURS_TASK_ERROR_INVAL); + STR_CASE(CELL_SPURS_TASK_ERROR_NOSYS); + STR_CASE(CELL_SPURS_TASK_ERROR_NOMEM); + STR_CASE(CELL_SPURS_TASK_ERROR_SRCH); + STR_CASE(CELL_SPURS_TASK_ERROR_NOEXEC); + STR_CASE(CELL_SPURS_TASK_ERROR_PERM); + STR_CASE(CELL_SPURS_TASK_ERROR_BUSY); + STR_CASE(CELL_SPURS_TASK_ERROR_FAULT); + STR_CASE(CELL_SPURS_TASK_ERROR_ALIGN); + STR_CASE(CELL_SPURS_TASK_ERROR_STAT); + STR_CASE(CELL_SPURS_TASK_ERROR_NULL_POINTER); + STR_CASE(CELL_SPURS_TASK_ERROR_FATAL); + STR_CASE(CELL_SPURS_TASK_ERROR_SHUTDOWN); + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SPURS_JOB_ERROR_AGAIN); - STR_CASE(CELL_SPURS_JOB_ERROR_INVAL); - STR_CASE(CELL_SPURS_JOB_ERROR_NOSYS); - STR_CASE(CELL_SPURS_JOB_ERROR_NOMEM); - STR_CASE(CELL_SPURS_JOB_ERROR_SRCH); - STR_CASE(CELL_SPURS_JOB_ERROR_NOENT); - STR_CASE(CELL_SPURS_JOB_ERROR_NOEXEC); - STR_CASE(CELL_SPURS_JOB_ERROR_DEADLK); - STR_CASE(CELL_SPURS_JOB_ERROR_PERM); - STR_CASE(CELL_SPURS_JOB_ERROR_BUSY); - STR_CASE(CELL_SPURS_JOB_ERROR_JOB_DESCRIPTOR); - STR_CASE(CELL_SPURS_JOB_ERROR_JOB_DESCRIPTOR_SIZE); - STR_CASE(CELL_SPURS_JOB_ERROR_FAULT); - STR_CASE(CELL_SPURS_JOB_ERROR_CHILD); - STR_CASE(CELL_SPURS_JOB_ERROR_STAT); - STR_CASE(CELL_SPURS_JOB_ERROR_ALIGN); - STR_CASE(CELL_SPURS_JOB_ERROR_NULL_POINTER); - STR_CASE(CELL_SPURS_JOB_ERROR_MEMORY_CORRUPTED); - STR_CASE(CELL_SPURS_JOB_ERROR_MEMORY_SIZE); - STR_CASE(CELL_SPURS_JOB_ERROR_UNKNOWN_COMMAND); - STR_CASE(CELL_SPURS_JOB_ERROR_JOBLIST_ALIGNMENT); - STR_CASE(CELL_SPURS_JOB_ERROR_JOB_ALIGNMENT); - STR_CASE(CELL_SPURS_JOB_ERROR_CALL_OVERFLOW); - STR_CASE(CELL_SPURS_JOB_ERROR_ABORT); - STR_CASE(CELL_SPURS_JOB_ERROR_DMALIST_ELEMENT); - STR_CASE(CELL_SPURS_JOB_ERROR_NUM_CACHE); - STR_CASE(CELL_SPURS_JOB_ERROR_INVALID_BINARY); - } + switch (error) + { + STR_CASE(CELL_SPURS_JOB_ERROR_AGAIN); + STR_CASE(CELL_SPURS_JOB_ERROR_INVAL); + STR_CASE(CELL_SPURS_JOB_ERROR_NOSYS); + STR_CASE(CELL_SPURS_JOB_ERROR_NOMEM); + STR_CASE(CELL_SPURS_JOB_ERROR_SRCH); + STR_CASE(CELL_SPURS_JOB_ERROR_NOENT); + STR_CASE(CELL_SPURS_JOB_ERROR_NOEXEC); + STR_CASE(CELL_SPURS_JOB_ERROR_DEADLK); + STR_CASE(CELL_SPURS_JOB_ERROR_PERM); + STR_CASE(CELL_SPURS_JOB_ERROR_BUSY); + STR_CASE(CELL_SPURS_JOB_ERROR_JOB_DESCRIPTOR); + STR_CASE(CELL_SPURS_JOB_ERROR_JOB_DESCRIPTOR_SIZE); + STR_CASE(CELL_SPURS_JOB_ERROR_FAULT); + STR_CASE(CELL_SPURS_JOB_ERROR_CHILD); + STR_CASE(CELL_SPURS_JOB_ERROR_STAT); + STR_CASE(CELL_SPURS_JOB_ERROR_ALIGN); + STR_CASE(CELL_SPURS_JOB_ERROR_NULL_POINTER); + STR_CASE(CELL_SPURS_JOB_ERROR_MEMORY_CORRUPTED); + STR_CASE(CELL_SPURS_JOB_ERROR_MEMORY_SIZE); + STR_CASE(CELL_SPURS_JOB_ERROR_UNKNOWN_COMMAND); + STR_CASE(CELL_SPURS_JOB_ERROR_JOBLIST_ALIGNMENT); + STR_CASE(CELL_SPURS_JOB_ERROR_JOB_ALIGNMENT); + STR_CASE(CELL_SPURS_JOB_ERROR_CALL_OVERFLOW); + STR_CASE(CELL_SPURS_JOB_ERROR_ABORT); + STR_CASE(CELL_SPURS_JOB_ERROR_DMALIST_ELEMENT); + STR_CASE(CELL_SPURS_JOB_ERROR_NUM_CACHE); + STR_CASE(CELL_SPURS_JOB_ERROR_INVALID_BINARY); + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - case SPURS_WKL_STATE_NON_EXISTENT: return "Non-existent"; - case SPURS_WKL_STATE_PREPARING: return "Preparing"; - case SPURS_WKL_STATE_RUNNABLE: return "Runnable"; - case SPURS_WKL_STATE_SHUTTING_DOWN: return "In-shutdown"; - case SPURS_WKL_STATE_REMOVABLE: return "Removable"; - case SPURS_WKL_STATE_INVALID: break; - } + switch (error) + { + case SPURS_WKL_STATE_NON_EXISTENT: return "Non-existent"; + case SPURS_WKL_STATE_PREPARING: return "Preparing"; + case SPURS_WKL_STATE_RUNNABLE: return "Runnable"; + case SPURS_WKL_STATE_SHUTTING_DOWN: return "In-shutdown"; + case SPURS_WKL_STATE_REMOVABLE: return "Removable"; + case SPURS_WKL_STATE_INVALID: break; + } - return unknown; - }); + return unknown; + }); } error_code sys_spu_image_close(ppu_thread&, vm::ptr img); @@ -230,43 +230,43 @@ namespace _spurs // Initialise SPURS s32 initialize(ppu_thread& 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); -} +} // namespace _spurs // // SPURS Core Functions // -//s32 cellSpursInitialize(ppu_thread& ppu, vm::ptr spurs, s32 nSpus, s32 spuPriority, s32 ppuPriority, b8 exitIfNoWork); -//s32 cellSpursInitializeWithAttribute(ppu_thread& ppu, vm::ptr spurs, vm::cptr attr); -//s32 cellSpursInitializeWithAttribute2(ppu_thread& ppu, vm::ptr spurs, vm::cptr attr); -//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 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 cellSpursAttachLv2EventQueue(ppu_thread& ppu, vm::ptr spurs, u32 queue, vm::ptr port, s32 isDynamic); -//s32 cellSpursDetachLv2EventQueue(vm::ptr spurs, u8 port); +// s32 cellSpursInitialize(ppu_thread& ppu, vm::ptr spurs, s32 nSpus, s32 spuPriority, s32 ppuPriority, b8 exitIfNoWork); +// s32 cellSpursInitializeWithAttribute(ppu_thread& ppu, vm::ptr spurs, vm::cptr attr); +// s32 cellSpursInitializeWithAttribute2(ppu_thread& ppu, vm::ptr spurs, vm::cptr attr); +// 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 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 cellSpursAttachLv2EventQueue(ppu_thread& ppu, vm::ptr spurs, u32 queue, vm::ptr port, s32 isDynamic); +// s32 cellSpursDetachLv2EventQueue(vm::ptr spurs, u8 port); // Enable the SPU exception event handler s32 cellSpursEnableExceptionEventHandler(ppu_thread& ppu, 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); +// s32 cellSpursSetGlobalExceptionEventHandler(vm::ptr spurs, vm::ptr eaHandler, vm::ptr arg); +// s32 cellSpursUnsetGlobalExceptionEventHandler(vm::ptr spurs); +// s32 cellSpursGetInfo(vm::ptr spurs, vm::ptr info); // // SPURS SPU GUID functions // -//s32 cellSpursGetSpuGuid(); +// s32 cellSpursGetSpuGuid(); // // SPURS trace functions @@ -285,12 +285,12 @@ namespace _spurs // Stop SPURS trace s32 trace_stop(ppu_thread& ppu, vm::ptr spurs, u32 updateStatus); -} +} // namespace _spurs -//s32 cellSpursTraceInitialize(ppu_thread& ppu, vm::ptr spurs, vm::ptr buffer, u32 size, u32 mode); -//s32 cellSpursTraceFinalize(ppu_thread& ppu, vm::ptr spurs); -//s32 cellSpursTraceStart(ppu_thread& ppu, vm::ptr spurs); -//s32 cellSpursTraceStop(ppu_thread& ppu, vm::ptr spurs); +// s32 cellSpursTraceInitialize(ppu_thread& ppu, vm::ptr spurs, vm::ptr buffer, u32 size, u32 mode); +// s32 cellSpursTraceFinalize(ppu_thread& ppu, vm::ptr spurs); +// s32 cellSpursTraceStart(ppu_thread& ppu, vm::ptr spurs); +// s32 cellSpursTraceStop(ppu_thread& ppu, vm::ptr spurs); // // SPURS policy module functions @@ -299,34 +299,34 @@ namespace _spurs namespace _spurs { // Add workload - s32 add_workload(ppu_thread& ppu, vm::ptr spurs, vm::ptr wid, vm::cptr pm, u32 size, u64 data, const u8(&priorityTable)[8], u32 minContention, u32 maxContention, vm::cptr nameClass, vm::cptr nameInstance, vm::ptr hook, vm::ptr hookArg); -} + s32 add_workload(ppu_thread& ppu, vm::ptr spurs, vm::ptr wid, vm::cptr pm, u32 size, u64 data, const u8 (&priorityTable)[8], u32 minContention, u32 maxContention, vm::cptr nameClass, vm::cptr nameInstance, vm::ptr hook, vm::ptr hookArg); +} // namespace _spurs -//s32 _cellSpursWorkloadAttributeInitialize(vm::ptr attr, u32 revision, u32 sdkVersion, vm::cptr pm, u32 size, u64 data, vm::cptr priority, u32 minCnt, u32 maxCnt); -//s32 cellSpursWorkloadAttributeSetName(vm::ptr attr, vm::cptr nameClass, vm::cptr nameInstance); -//s32 cellSpursWorkloadAttributeSetShutdownCompletionEventHook(vm::ptr attr, vm::ptr hook, vm::ptr arg); -//s32 cellSpursAddWorkload(vm::ptr spurs, vm::ptr wid, vm::cptr pm, u32 size, u64 data, vm::cptr priority, u32 minCnt, u32 maxCnt); -//s32 cellSpursAddWorkloadWithAttribute(vm::ptr spurs, vm::ptr wid, vm::cptr attr); -//s32 cellSpursShutdownWorkload(); -//s32 cellSpursWaitForWorkloadShutdown(); -//s32 cellSpursRemoveWorkload(); +// s32 _cellSpursWorkloadAttributeInitialize(vm::ptr attr, u32 revision, u32 sdkVersion, vm::cptr pm, u32 size, u64 data, vm::cptr priority, u32 minCnt, u32 maxCnt); +// s32 cellSpursWorkloadAttributeSetName(vm::ptr attr, vm::cptr nameClass, vm::cptr nameInstance); +// s32 cellSpursWorkloadAttributeSetShutdownCompletionEventHook(vm::ptr attr, vm::ptr hook, vm::ptr arg); +// s32 cellSpursAddWorkload(vm::ptr spurs, vm::ptr wid, vm::cptr pm, u32 size, u64 data, vm::cptr priority, u32 minCnt, u32 maxCnt); +// s32 cellSpursAddWorkloadWithAttribute(vm::ptr spurs, vm::ptr wid, vm::cptr attr); +// s32 cellSpursShutdownWorkload(); +// s32 cellSpursWaitForWorkloadShutdown(); +// s32 cellSpursRemoveWorkload(); // Activate the SPURS kernel s32 cellSpursWakeUp(ppu_thread& ppu, vm::ptr spurs); s32 cellSpursSendWorkloadSignal(ppu_thread& ppu, vm::ptr spurs, u32 wid); -//s32 cellSpursGetWorkloadFlag(vm::ptr spurs, vm::pptr flag); +// s32 cellSpursGetWorkloadFlag(vm::ptr spurs, vm::pptr flag); s32 cellSpursReadyCountStore(ppu_thread& ppu, vm::ptr spurs, u32 wid, u32 value); s32 cellSpursReadyCountSwap(ppu_thread& ppu, vm::ptr spurs, u32 wid, vm::ptr old, u32 swap); s32 cellSpursReadyCountCompareAndSwap(ppu_thread& ppu, vm::ptr spurs, u32 wid, vm::ptr old, u32 compare, u32 swap); s32 cellSpursReadyCountAdd(ppu_thread& ppu, vm::ptr spurs, u32 wid, vm::ptr old, s32 value); -//s32 cellSpursGetWorkloadData(vm::ptr spurs, vm::ptr data, u32 wid); -//s32 cellSpursGetWorkloadInfo(); -//s32 cellSpursSetExceptionEventHandler(); -//s32 cellSpursUnsetExceptionEventHandler(); +// s32 cellSpursGetWorkloadData(vm::ptr spurs, vm::ptr data, u32 wid); +// s32 cellSpursGetWorkloadInfo(); +// s32 cellSpursSetExceptionEventHandler(); +// s32 cellSpursUnsetExceptionEventHandler(); s32 _cellSpursWorkloadFlagReceiver(ppu_thread& ppu, vm::ptr spurs, u32 wid, u32 is_set); -//s32 _cellSpursWorkloadFlagReceiver2(); -//error_code cellSpursRequestIdleSpu(); +// s32 _cellSpursWorkloadFlagReceiver2(); +// error_code cellSpursRequestIdleSpu(); // // SPURS taskset functions @@ -336,28 +336,28 @@ namespace _spurs { // Create taskset s32 create_taskset(ppu_thread& ppu, vm::ptr spurs, vm::ptr taskset, u64 args, vm::cptr priority, u32 max_contention, vm::cptr name, u32 size, s32 enable_clear_ls); -} +} // namespace _spurs -//s32 cellSpursCreateTasksetWithAttribute(ppu_thread& ppu, vm::ptr spurs, vm::ptr taskset, vm::ptr attr); -//s32 cellSpursCreateTaskset(ppu_thread& ppu, vm::ptr spurs, vm::ptr taskset, u64 args, vm::cptr priority, u32 maxContention); -//s32 cellSpursJoinTaskset(vm::ptr taskset); -//s32 cellSpursGetTasksetId(vm::ptr taskset, vm::ptr wid); -//s32 cellSpursShutdownTaskset(vm::ptr taskset); -//s32 cellSpursTasksetAttributeSetName(vm::ptr attr, vm::cptr name); -//s32 cellSpursTasksetAttributeSetTasksetSize(vm::ptr attr, u32 size); -//s32 cellSpursTasksetAttributeEnableClearLS(vm::ptr attr, s32 enable); -//s32 _cellSpursTasksetAttribute2Initialize(vm::ptr attribute, u32 revision); -//s32 cellSpursCreateTaskset2(ppu_thread& ppu, vm::ptr spurs, vm::ptr taskset, vm::ptr attr); -//s32 cellSpursDestroyTaskset2(); -//s32 cellSpursTasksetSetExceptionEventHandler(vm::ptr taskset, vm::ptr handler, vm::ptr arg); -//s32 cellSpursTasksetUnsetExceptionEventHandler(vm::ptr taskset); +// s32 cellSpursCreateTasksetWithAttribute(ppu_thread& ppu, vm::ptr spurs, vm::ptr taskset, vm::ptr attr); +// s32 cellSpursCreateTaskset(ppu_thread& ppu, vm::ptr spurs, vm::ptr taskset, u64 args, vm::cptr priority, u32 maxContention); +// s32 cellSpursJoinTaskset(vm::ptr taskset); +// s32 cellSpursGetTasksetId(vm::ptr taskset, vm::ptr wid); +// s32 cellSpursShutdownTaskset(vm::ptr taskset); +// s32 cellSpursTasksetAttributeSetName(vm::ptr attr, vm::cptr name); +// s32 cellSpursTasksetAttributeSetTasksetSize(vm::ptr attr, u32 size); +// s32 cellSpursTasksetAttributeEnableClearLS(vm::ptr attr, s32 enable); +// s32 _cellSpursTasksetAttribute2Initialize(vm::ptr attribute, u32 revision); +// s32 cellSpursCreateTaskset2(ppu_thread& ppu, vm::ptr spurs, vm::ptr taskset, vm::ptr attr); +// s32 cellSpursDestroyTaskset2(); +// s32 cellSpursTasksetSetExceptionEventHandler(vm::ptr taskset, vm::ptr handler, vm::ptr arg); +// s32 cellSpursTasksetUnsetExceptionEventHandler(vm::ptr taskset); // Get taskset instance from the workload ID s32 cellSpursLookUpTasksetAddress(ppu_thread& ppu, vm::ptr spurs, vm::pptr taskset, u32 id); -//s32 cellSpursTasksetGetSpursAddress(vm::cptr taskset, vm::ptr spurs); -//s32 cellSpursGetTasksetInfo(); -//s32 _cellSpursTasksetAttributeInitialize(vm::ptr attribute, u32 revision, u32 sdk_version, u64 args, vm::cptr priority, u32 max_contention); +// s32 cellSpursTasksetGetSpursAddress(vm::cptr taskset, vm::ptr spurs); +// s32 cellSpursGetTasksetInfo(); +// s32 _cellSpursTasksetAttributeInitialize(vm::ptr attribute, u32 revision, u32 sdk_version, u64 args, vm::cptr priority, u32 max_contention); // // SPURS task functions @@ -370,28 +370,28 @@ namespace _spurs // Start task s32 task_start(ppu_thread& ppu, vm::ptr taskset, u32 taskId); -} +} // namespace _spurs -//s32 cellSpursCreateTask(ppu_thread& ppu, vm::ptr taskset, vm::ptr taskId, vm::cptr elf, vm::cptr context, u32 size, vm::ptr lsPattern, vm::ptr argument); +// s32 cellSpursCreateTask(ppu_thread& ppu, vm::ptr taskset, vm::ptr taskId, vm::cptr elf, vm::cptr context, u32 size, vm::ptr lsPattern, vm::ptr argument); // Sends a signal to the task s32 _cellSpursSendSignal(ppu_thread& ppu, vm::ptr taskset, u32 taskId); -//s32 cellSpursCreateTaskWithAttribute(); -//s32 cellSpursTaskExitCodeGet(); -//s32 cellSpursTaskExitCodeInitialize(); -//s32 cellSpursTaskExitCodeTryGet(); -//s32 cellSpursTaskGetLoadableSegmentPattern(); -//s32 cellSpursTaskGetReadOnlyAreaPattern(); -//s32 cellSpursTaskGenerateLsPattern(); -//s32 _cellSpursTaskAttributeInitialize(); -//s32 cellSpursTaskAttributeSetExitCodeContainer(); -//s32 _cellSpursTaskAttribute2Initialize(vm::ptr attribute, u32 revision); -//s32 cellSpursTaskGetContextSaveAreaSize(); -//s32 cellSpursCreateTask2(); -//s32 cellSpursJoinTask2(); -//s32 cellSpursTryJoinTask2(); -//s32 cellSpursCreateTask2WithBinInfo(); +// s32 cellSpursCreateTaskWithAttribute(); +// s32 cellSpursTaskExitCodeGet(); +// s32 cellSpursTaskExitCodeInitialize(); +// s32 cellSpursTaskExitCodeTryGet(); +// s32 cellSpursTaskGetLoadableSegmentPattern(); +// s32 cellSpursTaskGetReadOnlyAreaPattern(); +// s32 cellSpursTaskGenerateLsPattern(); +// s32 _cellSpursTaskAttributeInitialize(); +// s32 cellSpursTaskAttributeSetExitCodeContainer(); +// s32 _cellSpursTaskAttribute2Initialize(vm::ptr attribute, u32 revision); +// s32 cellSpursTaskGetContextSaveAreaSize(); +// s32 cellSpursCreateTask2(); +// s32 cellSpursJoinTask2(); +// s32 cellSpursTryJoinTask2(); +// s32 cellSpursCreateTask2WithBinInfo(); // // SPURS event flag functions @@ -401,59 +401,59 @@ namespace _spurs { // Wait for SPURS event flag s32 event_flag_wait(ppu_thread& ppu, vm::ptr eventFlag, vm::ptr mask, u32 mode, u32 block); -} +} // namespace _spurs -//s32 _cellSpursEventFlagInitialize(vm::ptr spurs, vm::ptr taskset, vm::ptr eventFlag, u32 flagClearMode, u32 flagDirection); -//s32 cellSpursEventFlagClear(vm::ptr eventFlag, u16 bits); -//s32 cellSpursEventFlagSet(ppu_thread& ppu, vm::ptr eventFlag, u16 bits); -//s32 cellSpursEventFlagWait(ppu_thread& ppu, vm::ptr eventFlag, vm::ptr mask, u32 mode); -//s32 cellSpursEventFlagTryWait(ppu_thread& ppu, vm::ptr eventFlag, vm::ptr mask, u32 mode); -//s32 cellSpursEventFlagAttachLv2EventQueue(ppu_thread& ppu, vm::ptr eventFlag); -//s32 cellSpursEventFlagDetachLv2EventQueue(ppu_thread& ppu, vm::ptr eventFlag); -//s32 cellSpursEventFlagGetDirection(vm::ptr eventFlag, vm::ptr direction); -//s32 cellSpursEventFlagGetClearMode(vm::ptr eventFlag, vm::ptr clear_mode); -//s32 cellSpursEventFlagGetTasksetAddress(vm::ptr eventFlag, vm::pptr taskset); +// s32 _cellSpursEventFlagInitialize(vm::ptr spurs, vm::ptr taskset, vm::ptr eventFlag, u32 flagClearMode, u32 flagDirection); +// s32 cellSpursEventFlagClear(vm::ptr eventFlag, u16 bits); +// s32 cellSpursEventFlagSet(ppu_thread& ppu, vm::ptr eventFlag, u16 bits); +// s32 cellSpursEventFlagWait(ppu_thread& ppu, vm::ptr eventFlag, vm::ptr mask, u32 mode); +// s32 cellSpursEventFlagTryWait(ppu_thread& ppu, vm::ptr eventFlag, vm::ptr mask, u32 mode); +// s32 cellSpursEventFlagAttachLv2EventQueue(ppu_thread& ppu, vm::ptr eventFlag); +// s32 cellSpursEventFlagDetachLv2EventQueue(ppu_thread& ppu, vm::ptr eventFlag); +// s32 cellSpursEventFlagGetDirection(vm::ptr eventFlag, vm::ptr direction); +// s32 cellSpursEventFlagGetClearMode(vm::ptr eventFlag, vm::ptr clear_mode); +// s32 cellSpursEventFlagGetTasksetAddress(vm::ptr eventFlag, vm::pptr taskset); // // SPURS lock free queue functions // -//s32 _cellSpursLFQueueInitialize(vm::ptr pTasksetOrSpurs, vm::ptr pQueue, vm::cptr buffer, u32 size, u32 depth, u32 direction); -//s32 _cellSpursLFQueuePushBody(); -//s32 cellSpursLFQueueAttachLv2EventQueue(vm::ptr queue); -//s32 cellSpursLFQueueDetachLv2EventQueue(vm::ptr queue); -//s32 _cellSpursLFQueuePopBody(); -//s32 cellSpursLFQueueGetTasksetAddress(); +// s32 _cellSpursLFQueueInitialize(vm::ptr pTasksetOrSpurs, vm::ptr pQueue, vm::cptr buffer, u32 size, u32 depth, u32 direction); +// s32 _cellSpursLFQueuePushBody(); +// s32 cellSpursLFQueueAttachLv2EventQueue(vm::ptr queue); +// s32 cellSpursLFQueueDetachLv2EventQueue(vm::ptr queue); +// s32 _cellSpursLFQueuePopBody(); +// s32 cellSpursLFQueueGetTasksetAddress(); // // SPURS queue functions // -//s32 _cellSpursQueueInitialize(); -//s32 cellSpursQueuePopBody(); -//s32 cellSpursQueuePushBody(); -//s32 cellSpursQueueAttachLv2EventQueue(); -//s32 cellSpursQueueDetachLv2EventQueue(); -//s32 cellSpursQueueGetTasksetAddress(); -//s32 cellSpursQueueClear(); -//s32 cellSpursQueueDepth(); -//s32 cellSpursQueueGetEntrySize(); -//s32 cellSpursQueueSize(); -//s32 cellSpursQueueGetDirection(); +// s32 _cellSpursQueueInitialize(); +// s32 cellSpursQueuePopBody(); +// s32 cellSpursQueuePushBody(); +// s32 cellSpursQueueAttachLv2EventQueue(); +// s32 cellSpursQueueDetachLv2EventQueue(); +// s32 cellSpursQueueGetTasksetAddress(); +// s32 cellSpursQueueClear(); +// s32 cellSpursQueueDepth(); +// s32 cellSpursQueueGetEntrySize(); +// s32 cellSpursQueueSize(); +// s32 cellSpursQueueGetDirection(); // // SPURS barrier functions // -//s32 cellSpursBarrierInitialize(); -//s32 cellSpursBarrierGetTasksetAddress(); +// s32 cellSpursBarrierInitialize(); +// s32 cellSpursBarrierGetTasksetAddress(); // // SPURS semaphore functions // -//s32 _cellSpursSemaphoreInitialize(); -//s32 cellSpursSemaphoreGetTasksetAddress(); +// s32 _cellSpursSemaphoreInitialize(); +// s32 cellSpursSemaphoreGetTasksetAddress(); // // SPURS job chain functions @@ -461,40 +461,36 @@ namespace _spurs namespace _spurs { - s32 check_job_chain_attribute(u32 sdkVer, vm::cptr jcEntry, u16 sizeJobDescr, u16 maxGrabbedJob - , u64 priorities, u32 maxContention, u8 autoSpuCount, u32 tag1, u32 tag2 - , u8 isFixedMemAlloc, u32 maxSizeJob, u32 initSpuCount); + s32 check_job_chain_attribute(u32 sdkVer, vm::cptr jcEntry, u16 sizeJobDescr, u16 maxGrabbedJob, u64 priorities, u32 maxContention, u8 autoSpuCount, u32 tag1, u32 tag2, u8 isFixedMemAlloc, u32 maxSizeJob, u32 initSpuCount); - s32 create_job_chain(ppu_thread& ppu, vm::ptr spurs, vm::ptr jobChain, vm::cptr jobChainEntry, u16 sizeJob - , u16 maxGrabbedJob, vm::cptr prio, u32 maxContention, b8 autoReadyCount - , u32 tag1, u32 tag2, u32 HaltOnError, vm::cptr name, u32 param_13, u32 param_14); + s32 create_job_chain(ppu_thread& ppu, vm::ptr spurs, vm::ptr jobChain, vm::cptr jobChainEntry, u16 sizeJob, u16 maxGrabbedJob, vm::cptr prio, u32 maxContention, b8 autoReadyCount, u32 tag1, u32 tag2, u32 HaltOnError, vm::cptr name, u32 param_13, u32 param_14); -} +} // namespace _spurs -//s32 cellSpursCreateJobChainWithAttribute(); -//s32 cellSpursCreateJobChain(); -//s32 cellSpursJoinJobChain(); +// s32 cellSpursCreateJobChainWithAttribute(); +// s32 cellSpursCreateJobChain(); +// s32 cellSpursJoinJobChain(); s32 cellSpursKickJobChain(ppu_thread& ppu, vm::ptr jobChain, u8 numReadyCount); -//s32 _cellSpursJobChainAttributeInitialize(); -//s32 cellSpursGetJobChainId(); -//s32 cellSpursJobChainSetExceptionEventHandler(); -//s32 cellSpursJobChainUnsetExceptionEventHandler(); -//s32 cellSpursGetJobChainInfo(); -//s32 cellSpursJobChainGetSpursAddress(); -//s32 cellSpursJobGuardInitialize(); -//s32 cellSpursJobChainAttributeSetName(); -//s32 cellSpursShutdownJobChain(); -//s32 cellSpursJobChainAttributeSetHaltOnError(); -//s32 cellSpursJobChainAttributeSetJobTypeMemoryCheck(); -//s32 cellSpursJobGuardNotify(); -//s32 cellSpursJobGuardReset(); +// s32 _cellSpursJobChainAttributeInitialize(); +// s32 cellSpursGetJobChainId(); +// s32 cellSpursJobChainSetExceptionEventHandler(); +// s32 cellSpursJobChainUnsetExceptionEventHandler(); +// s32 cellSpursGetJobChainInfo(); +// s32 cellSpursJobChainGetSpursAddress(); +// s32 cellSpursJobGuardInitialize(); +// s32 cellSpursJobChainAttributeSetName(); +// s32 cellSpursShutdownJobChain(); +// s32 cellSpursJobChainAttributeSetHaltOnError(); +// s32 cellSpursJobChainAttributeSetJobTypeMemoryCheck(); +// s32 cellSpursJobGuardNotify(); +// s32 cellSpursJobGuardReset(); s32 cellSpursRunJobChain(ppu_thread& ppu, vm::ptr jobChain); -//s32 cellSpursJobChainGetError(); -//s32 cellSpursGetJobPipelineInfo(); -//s32 cellSpursJobSetMaxGrab(); -//s32 cellSpursJobHeaderSetJobbin2Param(); -//s32 cellSpursAddUrgentCommand(); -//s32 cellSpursAddUrgentCall(); +// s32 cellSpursJobChainGetError(); +// s32 cellSpursGetJobPipelineInfo(); +// s32 cellSpursJobSetMaxGrab(); +// s32 cellSpursJobHeaderSetJobbin2Param(); +// s32 cellSpursAddUrgentCommand(); +// s32 cellSpursAddUrgentCall(); //---------------------------------------------------------------------------- // SPURS utility functions @@ -549,7 +545,7 @@ s32 _spurs::attach_lv2_eq(ppu_thread& ppu, vm::ptr spurs, u32 queue, return CELL_SPURS_CORE_ERROR_STAT; } - u8 _port = 0x3f; + u8 _port = 0x3f; u64 portMask = 0; if (isDynamic == 0) @@ -678,7 +674,8 @@ void _spurs::handler_wait_ready(ppu_thread& ppu, vm::ptr spurs) } } - if (foundRunnableWorkload) { + if (foundRunnableWorkload) + { break; } } @@ -746,7 +743,7 @@ s32 _spurs::create_handler(vm::ptr spurs, u32 ppuPriority) void non_task() { - //BIND_FUNC(_spurs::handler_entry)(*this); + // BIND_FUNC(_spurs::handler_entry)(*this); } }; @@ -800,7 +797,7 @@ s32 _spurs::wakeup_shutdown_completion_waiter(ppu_thread& ppu, vm::ptrwklF1[wid] : &spurs->wklF2[wid & 0x0F]; + const auto wklF = wid < CELL_SPURS_MAX_WORKLOAD ? &spurs->wklF1[wid] : &spurs->wklF2[wid & 0x0F]; const auto wklEvent = &spurs->wklEvent(wid); if (wklF->hook) @@ -834,7 +831,7 @@ void _spurs::event_helper_entry(ppu_thread& ppu, vm::ptr spurs) ensure(sys_event_queue_receive(ppu, spurs->eventQueue, vm::null, 0) == 0); static_cast(ppu.test_stopped()); - const u64 event_src = ppu.gpr[4]; + const u64 event_src = ppu.gpr[4]; const u64 event_data1 = ppu.gpr[5]; const u64 event_data2 = ppu.gpr[6]; const u64 event_data3 = ppu.gpr[7]; @@ -946,13 +943,13 @@ s32 _spurs::create_event_helper(ppu_thread& ppu, vm::ptr spurs, u32 p void non_task() { - //BIND_FUNC(_spurs::event_helper_entry)(*this); + // BIND_FUNC(_spurs::event_helper_entry)(*this); } }; - //auto eht = idm::make_ptr(std::string(spurs->prefix, spurs->prefixSize) + "SpursHdlr1", ppuPriority, 0x8000); + // auto eht = idm::make_ptr(std::string(spurs->prefix, spurs->prefixSize) + "SpursHdlr1", ppuPriority, 0x8000); - //if (!eht) + // if (!eht) { sys_event_port_disconnect(ppu, spurs->eventPort); sys_event_port_destroy(ppu, spurs->eventPort); @@ -976,9 +973,9 @@ s32 _spurs::create_event_helper(ppu_thread& ppu, vm::ptr spurs, u32 p void _spurs::init_event_port_mux(vm::ptr eventPortMux, u8 spuPort, u32 eventPort, u32 unknown) { memset(eventPortMux.get_ptr(), 0, sizeof(CellSpurs::EventPortMux)); - eventPortMux->spuPort = spuPort; + eventPortMux->spuPort = spuPort; eventPortMux->eventPort = eventPort; - eventPortMux->x08 = unknown; + eventPortMux->x08 = unknown; } s32 _spurs::add_default_syswkl(vm::ptr spurs, vm::cptr swlPriority, u32 swlMaxSpu, u32 swlIsPreem) @@ -1072,13 +1069,13 @@ s32 _spurs::join_handler_thread(ppu_thread& ppu, vm::ptr spurs) s32 _spurs::initialize(ppu_thread& 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) { - vm::var sem; - vm::var semAttr; - vm::var spuTgName(128); + vm::var sem; + vm::var semAttr; + vm::var spuTgName(128); vm::var spuTgAttr; - vm::var spuThArgs; - vm::var spuThAttr; - vm::var spuThName(128); + vm::var spuThArgs; + vm::var spuThAttr; + vm::var spuThName(128); if (!spurs) { @@ -1128,11 +1125,11 @@ s32 _spurs::initialize(ppu_thread& ppu, vm::ptr spurs, u32 revision, }; std::memset(spurs.get_ptr(), 0, isSecond ? CELL_SPURS_SIZE2 : CELL_SPURS_SIZE); - spurs->revision = revision; + spurs->revision = revision; spurs->sdkVersion = sdkVersion; - spurs->ppu0 = 0xffffffffull; - spurs->ppu1 = 0xffffffffull; - spurs->flags = flags; + spurs->ppu0 = 0xffffffffull; + spurs->ppu1 = 0xffffffffull; + spurs->flags = flags; spurs->prefixSize = static_cast(prefixSize); std::memcpy(spurs->prefix, prefix.get_ptr(), prefixSize); @@ -1152,14 +1149,14 @@ s32 _spurs::initialize(ppu_thread& ppu, vm::ptr spurs, u32 revision, // Import default system workload spurs->wklInfoSysSrv.addr.set(SPURS_IMG_ADDR_SYS_SRV_WORKLOAD); spurs->wklInfoSysSrv.size = 0x2200; - spurs->wklInfoSysSrv.arg = 0; + spurs->wklInfoSysSrv.arg = 0; spurs->wklInfoSysSrv.uniqueId = 0xff; // Create semaphores for each workload semAttr->protocol = SYS_SYNC_PRIORITY; - semAttr->pshared = SYS_SYNC_NOT_PROCESS_SHARED; - semAttr->ipc_key = 0; - semAttr->flags = 0; + semAttr->pshared = SYS_SYNC_NOT_PROCESS_SHARED; + semAttr->ipc_key = 0; + semAttr->flags = 0; semAttr->name_u64 = "_spuWkl\0"_u64; for (u32 i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++) @@ -1189,27 +1186,27 @@ s32 _spurs::initialize(ppu_thread& ppu, vm::ptr spurs, u32 revision, return rollback(), rc; } - spurs->semPrv = *sem; + spurs->semPrv = *sem; - spurs->unk11 = -1; - spurs->unk12 = -1; - spurs->unk13 = 0; - spurs->nSpus = nSpus; + spurs->unk11 = -1; + spurs->unk12 = -1; + spurs->unk13 = 0; + spurs->nSpus = nSpus; spurs->spuPriority = spuPriority; // Import SPURS kernel - spurs->spuImg.type = SYS_SPU_IMAGE_TYPE_USER; - spurs->spuImg.segs = vm::null; + spurs->spuImg.type = SYS_SPU_IMAGE_TYPE_USER; + spurs->spuImg.segs = vm::null; spurs->spuImg.entry_point = isSecond ? CELL_SPURS_KERNEL2_ENTRY_ADDR : CELL_SPURS_KERNEL1_ENTRY_ADDR; - spurs->spuImg.nsegs = 0; + spurs->spuImg.nsegs = 0; // Create a thread group for this SPURS context std::memcpy(spuTgName.get_ptr(), spurs->prefix, spurs->prefixSize); std::memcpy(spuTgName.get_ptr() + spurs->prefixSize, "CellSpursKernelGroup", 21); - spuTgAttr->name = spuTgName; + spuTgAttr->name = spuTgName; spuTgAttr->nsize = static_cast(std::strlen(spuTgAttr->name.get_ptr())) + 1; - spuTgAttr->type = SYS_SPU_THREAD_GROUP_TYPE_NORMAL; + spuTgAttr->type = SYS_SPU_THREAD_GROUP_TYPE_NORMAL; if (spurs->flags & SAF_UNKNOWN_FLAG_0) { @@ -1227,13 +1224,17 @@ s32 _spurs::initialize(ppu_thread& ppu, vm::ptr spurs, u32 revision, if (spurs->flags & SAF_SPU_MEMORY_CONTAINER_SET) { spuTgAttr->type |= SYS_SPU_THREAD_GROUP_TYPE_MEMORY_FROM_CONTAINER; - spuTgAttr->ct = container; + spuTgAttr->ct = container; } - if (flags & SAF_UNKNOWN_FLAG_7) spuTgAttr->type |= 0x0100 | SYS_SPU_THREAD_GROUP_TYPE_SYSTEM; - if (flags & SAF_UNKNOWN_FLAG_8) spuTgAttr->type |= 0x0C00 | SYS_SPU_THREAD_GROUP_TYPE_SYSTEM; - if (flags & SAF_UNKNOWN_FLAG_9) spuTgAttr->type |= 0x0800; - if (flags & SAF_SYSTEM_WORKLOAD_ENABLED) spuTgAttr->type |= SYS_SPU_THREAD_GROUP_TYPE_COOPERATE_WITH_SYSTEM; + if (flags & SAF_UNKNOWN_FLAG_7) + spuTgAttr->type |= 0x0100 | SYS_SPU_THREAD_GROUP_TYPE_SYSTEM; + if (flags & SAF_UNKNOWN_FLAG_8) + spuTgAttr->type |= 0x0C00 | SYS_SPU_THREAD_GROUP_TYPE_SYSTEM; + if (flags & SAF_UNKNOWN_FLAG_9) + spuTgAttr->type |= 0x0800; + if (flags & SAF_SYSTEM_WORKLOAD_ENABLED) + spuTgAttr->type |= SYS_SPU_THREAD_GROUP_TYPE_COOPERATE_WITH_SYSTEM; if (s32 rc = sys_spu_thread_group_create(ppu, spurs.ptr(&CellSpurs::spuTG), nSpus, spuPriority, spuTgAttr)) { @@ -1245,16 +1246,16 @@ s32 _spurs::initialize(ppu_thread& ppu, vm::ptr spurs, u32 revision, std::memcpy(spuThName.get_ptr(), spurs->prefix, spurs->prefixSize); std::memcpy(spuThName.get_ptr() + spurs->prefixSize, "CellSpursKernel", 16); - spuThAttr->name = spuThName; - spuThAttr->name_len = static_cast(std::strlen(spuThName.get_ptr())) + 2; - spuThAttr->option = SYS_SPU_THREAD_OPTION_DEC_SYNC_TB_ENABLE; + spuThAttr->name = spuThName; + spuThAttr->name_len = static_cast(std::strlen(spuThName.get_ptr())) + 2; + spuThAttr->option = SYS_SPU_THREAD_OPTION_DEC_SYNC_TB_ENABLE; spuThName[spuThAttr->name_len - 1] = '\0'; for (s32 num = 0; num < nSpus; num++) { spuThName[spuThAttr->name_len - 2] = '0' + num; - spuThArgs->arg1 = static_cast(num) << 32; - spuThArgs->arg2 = spurs.addr(); + spuThArgs->arg1 = static_cast(num) << 32; + spuThArgs->arg2 = spurs.addr(); if (s32 rc = sys_spu_thread_initialize(ppu, spurs.ptr(&CellSpurs::spus, num), spurs->spuTG, num, spurs.ptr(&CellSpurs::spuImg), spuThAttr, spuThArgs)) { @@ -1264,10 +1265,10 @@ s32 _spurs::initialize(ppu_thread& ppu, vm::ptr spurs, u32 revision, } // entry point cannot be initialized immediately because SPU LS will be rewritten by sys_spu_thread_group_start() - //idm::get_unlocked>(spurs->spus[num])->custom_task = [entry = spurs->spuImg.entry_point](spu_thread& spu) + // idm::get_unlocked>(spurs->spus[num])->custom_task = [entry = spurs->spuImg.entry_point](spu_thread& spu) { // Disabled - //spu.RegisterHleFunction(entry, spursKernelEntry); + // spu.RegisterHleFunction(entry, spursKernelEntry); }; } @@ -1283,7 +1284,7 @@ s32 _spurs::initialize(ppu_thread& ppu, vm::ptr spurs, u32 revision, } const auto lwMutex = spurs.ptr(&CellSpurs::mutex); - const auto lwCond = spurs.ptr(&CellSpurs::cond); + const auto lwCond = spurs.ptr(&CellSpurs::cond); // Create a mutex to protect access to SPURS handler thread data if (vm::var attr({SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, {"_spuPrv\0"_u64}}); @@ -1460,11 +1461,11 @@ s32 _cellSpursAttributeInitialize(vm::ptr attr, u32 revision } memset(attr.get_ptr(), 0, sizeof(CellSpursAttribute)); - attr->revision = revision; - attr->sdkVersion = sdkVersion; - attr->nSpus = nSpus; - attr->spuPriority = spuPriority; - attr->ppuPriority = ppuPriority; + attr->revision = revision; + attr->sdkVersion = sdkVersion; + attr->nSpus = nSpus; + attr->spuPriority = spuPriority; + attr->ppuPriority = ppuPriority; attr->exitIfNoWork = exitIfNoWork; return CELL_OK; } @@ -1489,8 +1490,8 @@ s32 cellSpursAttributeSetMemoryContainerForSpuThread(vm::ptr return CELL_SPURS_CORE_ERROR_STAT; } - attr->container = container; - attr->flags |= SAF_SPU_MEMORY_CONTAINER_SET; + attr->container = container; + attr->flags |= SAF_SPU_MEMORY_CONTAINER_SET; return CELL_OK; } @@ -1626,7 +1627,7 @@ s32 cellSpursAttributeEnableSystemWorkload(vm::ptr attr, vm: } } - attr->swlMaxSpu = maxSpu; // write max spu for system workload + attr->swlMaxSpu = maxSpu; // write max spu for system workload attr->swlIsPreem = isPreem; // write isPreemptible mask return CELL_OK; } @@ -1770,10 +1771,10 @@ s32 cellSpursSetMaxContention(vm::ptr spurs, u32 wid, u32 maxContenti } vm::atomic_op(spurs->wklMaxContention[wid % CELL_SPURS_MAX_WORKLOAD], [&](u8& value) - { - value &= wid < CELL_SPURS_MAX_WORKLOAD ? 0xF0 : 0x0F; - value |= wid < CELL_SPURS_MAX_WORKLOAD ? maxContention : maxContention << 4; - }); + { + value &= wid < CELL_SPURS_MAX_WORKLOAD ? 0xF0 : 0x0F; + value |= wid < CELL_SPURS_MAX_WORKLOAD ? maxContention : maxContention << 4; + }); return CELL_OK; } @@ -1821,9 +1822,18 @@ s32 cellSpursSetPriorities(vm::ptr spurs, u32 wid, vm::cptr pr return CELL_SPURS_CORE_ERROR_INVAL; } - vm::light_op(spurs->wklInfo(wid).prio64, [&](atomic_t& v){ v.release(prio); }); - vm::light_op(spurs->sysSrvMsgUpdateWorkload, [](atomic_t& v){ v.release(0xff); }); - vm::light_op(spurs->sysSrvMessage, [](atomic_t& v){ v.release(0xff); }); + vm::light_op(spurs->wklInfo(wid).prio64, [&](atomic_t& v) + { + v.release(prio); + }); + vm::light_op(spurs->sysSrvMsgUpdateWorkload, [](atomic_t& v) + { + v.release(0xff); + }); + vm::light_op(spurs->sysSrvMessage, [](atomic_t& v) + { + v.release(0xff); + }); return CELL_OK; } @@ -1850,9 +1860,18 @@ s32 cellSpursSetPriority(vm::ptr spurs, u32 wid, u32 spuId, u32 prior if (spurs->exception) return CELL_SPURS_CORE_ERROR_STAT; - vm::light_op(spurs->wklInfo(wid).priority[spuId], [&](u8& v){ atomic_storage::release(v, priority); }); - vm::light_op(spurs->sysSrvMsgUpdateWorkload, [&](atomic_t& v){ v.bit_test_set(spuId); }); - vm::light_op(spurs->sysSrvMessage, [&](atomic_t& v){ v.bit_test_set(spuId); }); + vm::light_op(spurs->wklInfo(wid).priority[spuId], [&](u8& v) + { + atomic_storage::release(v, priority); + }); + vm::light_op(spurs->sysSrvMsgUpdateWorkload, [&](atomic_t& v) + { + v.bit_test_set(spuId); + }); + vm::light_op(spurs->sysSrvMessage, [&](atomic_t& v) + { + v.bit_test_set(spuId); + }); return CELL_OK; } @@ -1893,7 +1912,7 @@ s32 cellSpursEnableExceptionEventHandler(ppu_thread& ppu, vm::ptr spu return CELL_SPURS_CORE_ERROR_ALIGN; } - s32 rc = CELL_OK; + s32 rc = CELL_OK; auto oldEnableEH = spurs->enableEH.exchange(flag ? 1u : 0u); if (flag) { @@ -1944,7 +1963,6 @@ s32 cellSpursSetGlobalExceptionEventHandler(vm::ptr spurs, vm::ptr spurs) { @@ -2029,17 +2047,20 @@ void _spurs::trace_status_update(ppu_thread& ppu, vm::ptr spurs) u8 init; vm::atomic_op(spurs->sysSrvTrace, [spurs, &init](CellSpurs::SrvTraceSyncVar& data) - { - if ((init = data.sysSrvTraceInitialised)) { - data.sysSrvNotifyUpdateTraceComplete = 1; - data.sysSrvMsgUpdateTrace = (1 << spurs->nSpus) - 1; - } - }); + if ((init = data.sysSrvTraceInitialised)) + { + data.sysSrvNotifyUpdateTraceComplete = 1; + data.sysSrvMsgUpdateTrace = (1 << spurs->nSpus) - 1; + } + }); if (init) { - vm::light_op(spurs->sysSrvMessage, [&](atomic_t& v){ v.release(0xff); }); + vm::light_op(spurs->sysSrvMessage, [&](atomic_t& v) + { + v.release(0xff); + }); ensure(sys_semaphore_wait(ppu, static_cast(spurs->semPrv), 0) == 0); static_cast(ppu.test_stopped()); } @@ -2071,13 +2092,13 @@ s32 _spurs::trace_initialize(ppu_thread& ppu, vm::ptr spurs, vm::ptr< for (u32 i = 0; i < 8; i++) { buffer->spuThread[i] = spurs->spus[i]; - buffer->count[i] = 0; + buffer->count[i] = 0; } buffer->spuThreadGroup = spurs->spuTG; - buffer->numSpus = spurs->nSpus; + buffer->numSpus = spurs->nSpus; spurs->traceBuffer.set(buffer.addr() | (mode & CELL_SPURS_TRACE_MODE_FLAG_WRAP_BUFFER ? 1 : 0)); - spurs->traceMode = mode; + spurs->traceMode = mode; u32 spuTraceDataCount = ::narrow((spurs->traceDataSize / sizeof(CellSpursTracePacket)) / spurs->nSpus); for (u32 i = 0, j = 8; i < 6; i++) @@ -2129,8 +2150,8 @@ s32 cellSpursTraceFinalize(ppu_thread& ppu, vm::ptr spurs) } spurs->sysSrvTraceControl = 0; - spurs->traceMode = 0; - spurs->traceBuffer = vm::null; + spurs->traceMode = 0; + spurs->traceBuffer = vm::null; _spurs::trace_status_update(ppu, spurs); @@ -2316,7 +2337,7 @@ s32 cellSpursWorkloadAttributeSetShutdownCompletionEventHook(vm::ptr spurs, vm::ptr wid, vm::cptr pm, u32 size, u64 data, const u8(&priorityTable)[8], u32 minContention, u32 maxContention, vm::cptr nameClass, vm::cptr nameInstance, vm::ptr hook, vm::ptr hookArg) +s32 _spurs::add_workload(ppu_thread& ppu, vm::ptr spurs, vm::ptr wid, vm::cptr pm, u32 size, u64 data, const u8 (&priorityTable)[8], u32 minContention, u32 maxContention, vm::cptr nameClass, vm::cptr nameInstance, vm::ptr hook, vm::ptr hookArg) { if (!spurs || !wid || !pm) { @@ -2342,14 +2363,14 @@ s32 _spurs::add_workload(ppu_thread& ppu, vm::ptr spurs, vm::ptr const u32 wmax = spurs->flags1 & SF1_32_WORKLOADS ? CELL_SPURS_MAX_WORKLOAD2 : CELL_SPURS_MAX_WORKLOAD; // TODO: check if can be changed vm::fetch_op(spurs->wklEnabled, [&](be_t& value) - { - wnum = std::countl_one(value); // found empty position - - if (wnum < wmax) { - value |= (0x80000000 >> wnum); // set workload bit - } - }); + wnum = std::countl_one(value); // found empty position + + if (wnum < wmax) + { + value |= (0x80000000 >> wnum); // set workload bit + } + }); *wid = wnum; // store workload id if (wnum >= wmax) @@ -2361,29 +2382,31 @@ s32 _spurs::add_workload(ppu_thread& ppu, vm::ptr spurs, vm::ptr auto& spurs_res2 = vm::reservation_acquire(spurs.addr() + 0x80); if (!spurs_res2.fetch_op([&](u64& r) - { - if (r & vm::rsrv_unique_lock) - { - return false; - } + { + if (r & vm::rsrv_unique_lock) + { + return false; + } - r += 1; - return true; - }).second) + r += 1; + return true; + }) + .second) { vm::reservation_shared_lock_internal(spurs_res2); } if (!spurs_res.fetch_op([&](u64& r) - { - if (r & vm::rsrv_unique_lock) - { - return false; - } + { + if (r & vm::rsrv_unique_lock) + { + return false; + } - r += 1; - return true; - }).second) + r += 1; + return true; + }) + .second) { vm::reservation_shared_lock_internal(spurs_res); } @@ -2457,15 +2480,15 @@ s32 _spurs::add_workload(ppu_thread& ppu, vm::ptr spurs, vm::ptr } spurs->wklMaxContention[index].atomic_op([&](u8& v) - { - v &= (wnum <= 15 ? 0xf0 : 0x0f); - v |= (maxContention > 8 ? 8 : maxContention) << (wnum < CELL_SPURS_MAX_WORKLOAD ? 0 : 4); - }); + { + v &= (wnum <= 15 ? 0xf0 : 0x0f); + v |= (maxContention > 8 ? 8 : maxContention) << (wnum < CELL_SPURS_MAX_WORKLOAD ? 0 : 4); + }); (wnum <= 15 ? spurs->wklSignal1 : spurs->wklSignal2).atomic_op([&](be_t& data) - { - data &= ~(0x8000 >> index); - }); + { + data &= ~(0x8000 >> index); + }); // Attempt to avoid CAS if (spurs->wklFlagReceiver == wnum && spurs->wklFlagReceiver.compare_and_swap(wnum, 0xff)) @@ -2482,37 +2505,43 @@ s32 _spurs::add_workload(ppu_thread& ppu, vm::ptr spurs, vm::ptr u32 res_wkl; const auto wkl = &spurs->wklInfo(wnum); vm::reservation_op(ppu, vm::unsafe_ptr_cast(spurs.ptr(&CellSpurs::wklState1)), [&](spurs_wkl_state_op& op) - { - const u32 mask = op.wklMskB & ~(0x80000000u >> wnum); - res_wkl = 0; - - for (u32 i = 0, m = 0x80000000, k = 0; i < 32; i++, m >>= 1) { - if (mask & m) + const u32 mask = op.wklMskB & ~(0x80000000u >> wnum); + res_wkl = 0; + + for (u32 i = 0, m = 0x80000000, k = 0; i < 32; i++, m >>= 1) { - const auto current = &spurs->wklInfo(i); - if (current->addr == wkl->addr) + if (mask & m) { - // if a workload with identical policy module found - res_wkl = current->uniqueId; - break; - } - else - { - k |= 0x80000000 >> current->uniqueId; - res_wkl = std::countl_one(k); + const auto current = &spurs->wklInfo(i); + if (current->addr == wkl->addr) + { + // if a workload with identical policy module found + res_wkl = current->uniqueId; + break; + } + else + { + k |= 0x80000000 >> current->uniqueId; + res_wkl = std::countl_one(k); + } } } - } - wkl->uniqueId.release(static_cast(res_wkl)); - op.wklMskB = mask | (0x80000000u >> wnum); - (wnum < CELL_SPURS_MAX_WORKLOAD ? op.wklState1[wnum] : op.wklState2[wnum % 16]) = SPURS_WKL_STATE_RUNNABLE; - }); + wkl->uniqueId.release(static_cast(res_wkl)); + op.wklMskB = mask | (0x80000000u >> wnum); + (wnum < CELL_SPURS_MAX_WORKLOAD ? op.wklState1[wnum] : op.wklState2[wnum % 16]) = SPURS_WKL_STATE_RUNNABLE; + }); ensure((res_wkl <= 31)); - vm::light_op(spurs->sysSrvMsgUpdateWorkload, [](atomic_t& v){ v.release(0xff); }); - vm::light_op(spurs->sysSrvMessage, [](atomic_t& v){ v.release(0xff); }); + vm::light_op(spurs->sysSrvMsgUpdateWorkload, [](atomic_t& v) + { + v.release(0xff); + }); + vm::light_op(spurs->sysSrvMessage, [](atomic_t& v) + { + v.release(0xff); + }); return CELL_OK; } @@ -2568,45 +2597,48 @@ s32 cellSpursShutdownWorkload(ppu_thread& ppu, vm::ptr spurs, u32 wid bool send_event; s32 rc, old_state; if (!vm::reservation_op(ppu, vm::unsafe_ptr_cast(spurs.ptr(&CellSpurs::wklState1)), [&](spurs_wkl_state_op& op) - { - auto& state = wid < CELL_SPURS_MAX_WORKLOAD ? op.wklState1[wid] : op.wklState2[wid % 16]; + { + auto& state = wid < CELL_SPURS_MAX_WORKLOAD ? op.wklState1[wid] : op.wklState2[wid % 16]; - if (state <= SPURS_WKL_STATE_PREPARING) - { - rc = CELL_SPURS_POLICY_MODULE_ERROR_STAT; - return false; - } + if (state <= SPURS_WKL_STATE_PREPARING) + { + rc = CELL_SPURS_POLICY_MODULE_ERROR_STAT; + return false; + } - if (state == SPURS_WKL_STATE_SHUTTING_DOWN || state == SPURS_WKL_STATE_REMOVABLE) - { - rc = CELL_OK; - return false; - } + if (state == SPURS_WKL_STATE_SHUTTING_DOWN || state == SPURS_WKL_STATE_REMOVABLE) + { + rc = CELL_OK; + return false; + } - auto& status = wid < CELL_SPURS_MAX_WORKLOAD ? op.wklStatus1[wid] : op.wklStatus2[wid % 16]; + auto& status = wid < CELL_SPURS_MAX_WORKLOAD ? op.wklStatus1[wid] : op.wklStatus2[wid % 16]; - old_state = state = status ? SPURS_WKL_STATE_SHUTTING_DOWN : SPURS_WKL_STATE_REMOVABLE; + old_state = state = status ? SPURS_WKL_STATE_SHUTTING_DOWN : SPURS_WKL_STATE_REMOVABLE; - if (state == SPURS_WKL_STATE_SHUTTING_DOWN) - { - op.sysSrvMsgUpdateWorkload = -1; - rc = CELL_OK; - return true; - } + if (state == SPURS_WKL_STATE_SHUTTING_DOWN) + { + op.sysSrvMsgUpdateWorkload = -1; + rc = CELL_OK; + return true; + } - auto& event = wid < CELL_SPURS_MAX_WORKLOAD ? op.wklEvent1[wid] : op.wklEvent2[wid % 16]; - send_event = event & 0x12 && !(event & 1); - event |= 1; - rc = CELL_OK; - return true; - })) + auto& event = wid < CELL_SPURS_MAX_WORKLOAD ? op.wklEvent1[wid] : op.wklEvent2[wid % 16]; + send_event = event & 0x12 && !(event & 1); + event |= 1; + rc = CELL_OK; + return true; + })) { return rc; } if (old_state == SPURS_WKL_STATE_SHUTTING_DOWN) { - vm::light_op(spurs->sysSrvMessage, [&](atomic_t& v){ v.release(0xff); }); + vm::light_op(spurs->sysSrvMessage, [&](atomic_t& v) + { + v.release(0xff); + }); return CELL_OK; } @@ -2641,15 +2673,15 @@ s32 cellSpursWaitForWorkloadShutdown(ppu_thread& ppu, vm::ptr spurs, auto& info = spurs->wklSyncInfo(wid); const auto [_old0, ok] = vm::fetch_op(info.x28, [](be_t& val) - { - if (val) { - return false; - } + if (val) + { + return false; + } - val = 2; - return true; - }); + val = 2; + return true; + }); if (!ok) { @@ -2657,15 +2689,15 @@ s32 cellSpursWaitForWorkloadShutdown(ppu_thread& ppu, vm::ptr spurs, } const auto [_old1, wait_sema] = vm::fetch_op(spurs->wklEvent(wid), [](u8& event) - { - if ((event & 1) == 0 || (event & 0x22) == 0x2) { - event |= 0x10; - return true; - } + if ((event & 1) == 0 || (event & 0x22) == 0x2) + { + event |= 0x10; + return true; + } - return false; - }); + return false; + }); if (wait_sema) { @@ -2719,24 +2751,24 @@ s32 cellSpursRemoveWorkload(ppu_thread& ppu, vm::ptr spurs, u32 wid) s32 rc; vm::reservation_op(ppu, vm::unsafe_ptr_cast(spurs.ptr(&CellSpurs::wklState1)), [&](spurs_wkl_state_op& op) - { - auto& state = wid < CELL_SPURS_MAX_WORKLOAD ? op.wklState1[wid] : op.wklState2[wid % 16]; - - // Re-verification, does not exist on realfw - switch (state) { - case SPURS_WKL_STATE_SHUTTING_DOWN: rc = CELL_SPURS_POLICY_MODULE_ERROR_BUSY; return false; - case SPURS_WKL_STATE_REMOVABLE: break; - default: rc = CELL_SPURS_POLICY_MODULE_ERROR_STAT; return false; - } + auto& state = wid < CELL_SPURS_MAX_WORKLOAD ? op.wklState1[wid] : op.wklState2[wid % 16]; - state = SPURS_WKL_STATE_NON_EXISTENT; + // Re-verification, does not exist on realfw + switch (state) + { + case SPURS_WKL_STATE_SHUTTING_DOWN: rc = CELL_SPURS_POLICY_MODULE_ERROR_BUSY; return false; + case SPURS_WKL_STATE_REMOVABLE: break; + default: rc = CELL_SPURS_POLICY_MODULE_ERROR_STAT; return false; + } - op.wklEnabled &= ~(0x80000000u >> wid); - op.wklMskB &= ~(0x80000000u >> wid); - rc = CELL_OK; - return true; - }); + state = SPURS_WKL_STATE_NON_EXISTENT; + + op.wklEnabled &= ~(0x80000000u >> wid); + op.wklMskB &= ~(0x80000000u >> wid); + rc = CELL_OK; + return true; + }); return rc; } @@ -2806,9 +2838,9 @@ s32 cellSpursSendWorkloadSignal(ppu_thread& ppu, vm::ptr spurs, u32 w } vm::light_op(wid < CELL_SPURS_MAX_WORKLOAD ? spurs->wklSignal1 : spurs->wklSignal2, [&](atomic_be_t& sig) - { - sig |= 0x8000 >> (wid % 16); - }); + { + sig |= 0x8000 >> (wid % 16); + }); return CELL_OK; } @@ -2863,9 +2895,9 @@ s32 cellSpursReadyCountStore(ppu_thread& ppu, vm::ptr spurs, u32 wid, } vm::light_op(spurs->readyCount(wid), [&](atomic_t& v) - { - v.release(static_cast(value)); - }); + { + v.release(static_cast(value)); + }); return CELL_OK; } @@ -2901,9 +2933,9 @@ s32 cellSpursReadyCountSwap(ppu_thread& ppu, vm::ptr spurs, u32 wid, } *old = vm::light_op(spurs->readyCount(wid), [&](atomic_t& v) - { - return v.exchange(static_cast(swap)); - }); + { + return v.exchange(static_cast(swap)); + }); return CELL_OK; } @@ -2941,9 +2973,9 @@ s32 cellSpursReadyCountCompareAndSwap(ppu_thread& ppu, vm::ptr spurs, u8 temp = static_cast(compare); vm::light_op(spurs->readyCount(wid), [&](atomic_t& v) - { - v.compare_exchange(temp, static_cast(swap)); - }); + { + v.compare_exchange(temp, static_cast(swap)); + }); *old = temp; return CELL_OK; @@ -2980,9 +3012,9 @@ s32 cellSpursReadyCountAdd(ppu_thread& ppu, vm::ptr spurs, u32 wid, v } *old = vm::fetch_op(spurs->readyCount(wid), [&](u8& val) - { - val = static_cast(std::clamp(val + static_cast(value), 0, 255)); - }); + { + val = static_cast(std::clamp(val + static_cast(value), 0, 255)); + }); return CELL_OK; } @@ -3093,43 +3125,43 @@ s32 _cellSpursWorkloadFlagReceiver(ppu_thread& ppu, vm::ptr spurs, u3 s32 res = CELL_OK; vm::reservation_op(ppu, vm::unsafe_ptr_cast(spurs), [&](wklFlagOp& val) - { - if (is_set) { - if (val.FlagReceiver != 0xff) + if (is_set) { - res = CELL_SPURS_POLICY_MODULE_ERROR_BUSY; - return; + if (val.FlagReceiver != 0xff) + { + res = CELL_SPURS_POLICY_MODULE_ERROR_BUSY; + return; + } } - } - else - { - if (val.FlagReceiver != wid) + else { - res = CELL_SPURS_POLICY_MODULE_ERROR_PERM; - return; + if (val.FlagReceiver != wid) + { + res = CELL_SPURS_POLICY_MODULE_ERROR_PERM; + return; + } } - } - val.Flag = -1; + val.Flag = -1; - if (is_set) - { - if (val.FlagReceiver == 0xff) + if (is_set) { - val.FlagReceiver = static_cast(wid); + if (val.FlagReceiver == 0xff) + { + val.FlagReceiver = static_cast(wid); + } } - } - else - { - if (val.FlagReceiver == wid) + else { - val.FlagReceiver = 0xff; + if (val.FlagReceiver == wid) + { + val.FlagReceiver = 0xff; + } } - } - res = CELL_OK; - }); + res = CELL_OK; + }); return res; } @@ -3169,41 +3201,41 @@ s32 _cellSpursWorkloadFlagReceiver2(ppu_thread& ppu, vm::ptr spurs, u s32 res = CELL_OK; vm::atomic_op(spurs->wklFlagReceiver, [&](u8& FlagReceiver) - { - if (is_set) { - if (FlagReceiver != 0xff) + if (is_set) { - res = CELL_SPURS_POLICY_MODULE_ERROR_BUSY; - return; + if (FlagReceiver != 0xff) + { + res = CELL_SPURS_POLICY_MODULE_ERROR_BUSY; + return; + } } - } - else - { - if (FlagReceiver != wid) + else { - res = CELL_SPURS_POLICY_MODULE_ERROR_PERM; - return; + if (FlagReceiver != wid) + { + res = CELL_SPURS_POLICY_MODULE_ERROR_PERM; + return; + } } - } - if (is_set) - { - if (FlagReceiver == 0xff) + if (is_set) { - FlagReceiver = static_cast(wid); + if (FlagReceiver == 0xff) + { + FlagReceiver = static_cast(wid); + } } - } - else - { - if (FlagReceiver == wid) + else { - FlagReceiver = 0xff; + if (FlagReceiver == wid) + { + FlagReceiver = 0xff; + } } - } - res = CELL_OK; - }); + res = CELL_OK; + }); return res; } @@ -3280,7 +3312,7 @@ s32 _cellSpursEventFlagInitialize(vm::ptr spurs, vm::ptrdirection = flagDirection; eventFlag->clearMode = flagClearMode; - eventFlag->spuPort = CELL_SPURS_EVENT_FLAG_INVALID_SPU_PORT; + eventFlag->spuPort = CELL_SPURS_EVENT_FLAG_INVALID_SPU_PORT; if (taskset) { @@ -3289,7 +3321,7 @@ s32 _cellSpursEventFlagInitialize(vm::ptr spurs, vm::ptrisIwl = 1; - eventFlag->addr = spurs.addr(); + eventFlag->addr = spurs.addr(); } return CELL_OK; @@ -3335,75 +3367,75 @@ s32 cellSpursEventFlagSet(ppu_thread& ppu, vm::ptr eventFlag } bool send; - u8 ppuWaitSlot; - u16 ppuEvents; - u16 pendingRecv; - u16 pendingRecvTaskEvents[16]; + u8 ppuWaitSlot; + u16 ppuEvents; + u16 pendingRecv; + u16 pendingRecvTaskEvents[16]; vm::reservation_op(ppu, vm::unsafe_ptr_cast(eventFlag), [bits, &send, &ppuWaitSlot, &ppuEvents, &pendingRecv, &pendingRecvTaskEvents](CellSpursEventFlag_x00& eventFlag) - { - send = false; - ppuWaitSlot = 0; - ppuEvents = 0; - pendingRecv = 0; - - u16 eventsToClear = 0; - - auto& ctrl = eventFlag.ctrl; - if (eventFlag.direction == CELL_SPURS_EVENT_FLAG_ANY2ANY && ctrl.ppuWaitMask) { - u16 ppuRelevantEvents = (ctrl.events | bits) & ctrl.ppuWaitMask; + send = false; + ppuWaitSlot = 0; + ppuEvents = 0; + pendingRecv = 0; - // Unblock the waiting PPU thread if either all the bits being waited by the thread have been set or - // if the wait mode of the thread is OR and atleast one bit the thread is waiting on has been set - if ((ctrl.ppuWaitMask & ~ppuRelevantEvents) == 0 || - ((ctrl.ppuWaitSlotAndMode & 0x0F) == CELL_SPURS_EVENT_FLAG_OR && ppuRelevantEvents != 0)) + u16 eventsToClear = 0; + + auto& ctrl = eventFlag.ctrl; + if (eventFlag.direction == CELL_SPURS_EVENT_FLAG_ANY2ANY && ctrl.ppuWaitMask) { - ctrl.ppuPendingRecv = 1; - ctrl.ppuWaitMask = 0; - ppuEvents = ppuRelevantEvents; - eventsToClear = ppuRelevantEvents; - ppuWaitSlot = ctrl.ppuWaitSlotAndMode >> 4; - send = true; - } - } + u16 ppuRelevantEvents = (ctrl.events | bits) & ctrl.ppuWaitMask; - s32 i = CELL_SPURS_EVENT_FLAG_MAX_WAIT_SLOTS - 1; - s32 j = 0; - u16 relevantWaitSlots = eventFlag.spuTaskUsedWaitSlots & ~ctrl.spuTaskPendingRecv; - while (relevantWaitSlots) - { - if (relevantWaitSlots & 0x0001) - { - u16 spuTaskRelevantEvents = (ctrl.events | bits) & eventFlag.spuTaskWaitMask[i]; - - // Unblock the waiting SPU task if either all the bits being waited by the task have been set or - // if the wait mode of the task is OR and atleast one bit the thread is waiting on has been set - if ((eventFlag.spuTaskWaitMask[i] & ~spuTaskRelevantEvents) == 0 || - (((eventFlag.spuTaskWaitMode >> j) & 0x0001) == CELL_SPURS_EVENT_FLAG_OR && spuTaskRelevantEvents != 0)) + // Unblock the waiting PPU thread if either all the bits being waited by the thread have been set or + // if the wait mode of the thread is OR and atleast one bit the thread is waiting on has been set + if ((ctrl.ppuWaitMask & ~ppuRelevantEvents) == 0 || + ((ctrl.ppuWaitSlotAndMode & 0x0F) == CELL_SPURS_EVENT_FLAG_OR && ppuRelevantEvents != 0)) { - eventsToClear |= spuTaskRelevantEvents; - pendingRecv |= 1 << j; - pendingRecvTaskEvents[j] = spuTaskRelevantEvents; + ctrl.ppuPendingRecv = 1; + ctrl.ppuWaitMask = 0; + ppuEvents = ppuRelevantEvents; + eventsToClear = ppuRelevantEvents; + ppuWaitSlot = ctrl.ppuWaitSlotAndMode >> 4; + send = true; } } - relevantWaitSlots >>= 1; - i--; - j++; - } + s32 i = CELL_SPURS_EVENT_FLAG_MAX_WAIT_SLOTS - 1; + s32 j = 0; + u16 relevantWaitSlots = eventFlag.spuTaskUsedWaitSlots & ~ctrl.spuTaskPendingRecv; + while (relevantWaitSlots) + { + if (relevantWaitSlots & 0x0001) + { + u16 spuTaskRelevantEvents = (ctrl.events | bits) & eventFlag.spuTaskWaitMask[i]; - ctrl.events |= bits; - ctrl.spuTaskPendingRecv |= pendingRecv; + // Unblock the waiting SPU task if either all the bits being waited by the task have been set or + // if the wait mode of the task is OR and atleast one bit the thread is waiting on has been set + if ((eventFlag.spuTaskWaitMask[i] & ~spuTaskRelevantEvents) == 0 || + (((eventFlag.spuTaskWaitMode >> j) & 0x0001) == CELL_SPURS_EVENT_FLAG_OR && spuTaskRelevantEvents != 0)) + { + eventsToClear |= spuTaskRelevantEvents; + pendingRecv |= 1 << j; + pendingRecvTaskEvents[j] = spuTaskRelevantEvents; + } + } - // If the clear flag is AUTO then clear the bits comnsumed by all tasks marked to be unblocked - if (eventFlag.clearMode == CELL_SPURS_EVENT_FLAG_CLEAR_AUTO) - { - ctrl.events &= ~eventsToClear; - } + relevantWaitSlots >>= 1; + i--; + j++; + } - //eventFlagControl = ((u64)events << 48) | ((u64)spuTaskPendingRecv << 32) | ((u64)ppuWaitMask << 16) | ((u64)ppuWaitSlotAndMode << 8) | (u64)ppuPendingRecv; - }); + ctrl.events |= bits; + ctrl.spuTaskPendingRecv |= pendingRecv; + + // If the clear flag is AUTO then clear the bits comnsumed by all tasks marked to be unblocked + if (eventFlag.clearMode == CELL_SPURS_EVENT_FLAG_CLEAR_AUTO) + { + ctrl.events &= ~eventsToClear; + } + + // eventFlagControl = ((u64)events << 48) | ((u64)spuTaskPendingRecv << 32) | ((u64)ppuWaitMask << 16) | ((u64)ppuWaitSlotAndMode << 8) | (u64)ppuPendingRecv; + }); if (send) { @@ -3479,102 +3511,102 @@ s32 _spurs::event_flag_wait(ppu_thread& ppu, vm::ptr eventFl } bool recv; - s32 rc; - u16 receivedEvents; + s32 rc; + u16 receivedEvents; vm::atomic_op(eventFlag->ctrl, [eventFlag, mask, mode, block, &recv, &rc, &receivedEvents](CellSpursEventFlag::ControlSyncVar& ctrl) - { - u16 relevantEvents = ctrl.events & *mask; - if (eventFlag->direction == CELL_SPURS_EVENT_FLAG_ANY2ANY) { - // Make sure the wait mask and mode specified does not conflict with that of the already waiting tasks. - // Conflict scenarios: - // OR vs OR - A conflict never occurs - // OR vs AND - A conflict occurs if the masks for the two tasks overlap - // AND vs AND - A conflict occurs if the masks for the two tasks are not the same - - // Determine the set of all already waiting tasks whose wait mode/mask can possibly conflict with the specified wait mode/mask. - // This set is equal to 'set of all tasks waiting' - 'set of all tasks whose wait conditions have been met'. - // If the wait mode is OR, we prune the set of all tasks that are waiting in OR mode from the set since a conflict cannot occur - // with an already waiting task in OR mode. - u16 relevantWaitSlots = eventFlag->spuTaskUsedWaitSlots & ~ctrl.spuTaskPendingRecv; - if (mode == CELL_SPURS_EVENT_FLAG_OR) - { - relevantWaitSlots &= eventFlag->spuTaskWaitMode; - } - - s32 i = CELL_SPURS_EVENT_FLAG_MAX_WAIT_SLOTS - 1; - while (relevantWaitSlots) - { - if (relevantWaitSlots & 0x0001) - { - if (eventFlag->spuTaskWaitMask[i] & *mask && eventFlag->spuTaskWaitMask[i] != *mask) - { - rc = CELL_SPURS_TASK_ERROR_AGAIN; - return; - } - } - - relevantWaitSlots >>= 1; - i--; - } - } - - // There is no need to block if all bits required by the wait operation have already been set or - // if the wait mode is OR and atleast one of the bits required by the wait operation has been set. - if ((*mask & ~relevantEvents) == 0 || (mode == CELL_SPURS_EVENT_FLAG_OR && relevantEvents)) - { - // If the clear flag is AUTO then clear the bits comnsumed by this thread - if (eventFlag->clearMode == CELL_SPURS_EVENT_FLAG_CLEAR_AUTO) - { - ctrl.events &= ~relevantEvents; - } - - recv = false; - receivedEvents = relevantEvents; - } - else - { - // If we reach here it means that the conditions for this thread have not been met. - // If this is a try wait operation then do not block but return an error code. - if (block == 0) - { - rc = CELL_SPURS_TASK_ERROR_BUSY; - return; - } - - ctrl.ppuWaitSlotAndMode = 0; + u16 relevantEvents = ctrl.events & *mask; if (eventFlag->direction == CELL_SPURS_EVENT_FLAG_ANY2ANY) { - // Find an unsed wait slot - s32 i = 0; - u16 spuTaskUsedWaitSlots = eventFlag->spuTaskUsedWaitSlots; - while (spuTaskUsedWaitSlots & 0x0001) + // Make sure the wait mask and mode specified does not conflict with that of the already waiting tasks. + // Conflict scenarios: + // OR vs OR - A conflict never occurs + // OR vs AND - A conflict occurs if the masks for the two tasks overlap + // AND vs AND - A conflict occurs if the masks for the two tasks are not the same + + // Determine the set of all already waiting tasks whose wait mode/mask can possibly conflict with the specified wait mode/mask. + // This set is equal to 'set of all tasks waiting' - 'set of all tasks whose wait conditions have been met'. + // If the wait mode is OR, we prune the set of all tasks that are waiting in OR mode from the set since a conflict cannot occur + // with an already waiting task in OR mode. + u16 relevantWaitSlots = eventFlag->spuTaskUsedWaitSlots & ~ctrl.spuTaskPendingRecv; + if (mode == CELL_SPURS_EVENT_FLAG_OR) { - spuTaskUsedWaitSlots >>= 1; - i++; + relevantWaitSlots &= eventFlag->spuTaskWaitMode; } - if (i == CELL_SPURS_EVENT_FLAG_MAX_WAIT_SLOTS) + s32 i = CELL_SPURS_EVENT_FLAG_MAX_WAIT_SLOTS - 1; + while (relevantWaitSlots) + { + if (relevantWaitSlots & 0x0001) + { + if (eventFlag->spuTaskWaitMask[i] & *mask && eventFlag->spuTaskWaitMask[i] != *mask) + { + rc = CELL_SPURS_TASK_ERROR_AGAIN; + return; + } + } + + relevantWaitSlots >>= 1; + i--; + } + } + + // There is no need to block if all bits required by the wait operation have already been set or + // if the wait mode is OR and atleast one of the bits required by the wait operation has been set. + if ((*mask & ~relevantEvents) == 0 || (mode == CELL_SPURS_EVENT_FLAG_OR && relevantEvents)) + { + // If the clear flag is AUTO then clear the bits comnsumed by this thread + if (eventFlag->clearMode == CELL_SPURS_EVENT_FLAG_CLEAR_AUTO) + { + ctrl.events &= ~relevantEvents; + } + + recv = false; + receivedEvents = relevantEvents; + } + else + { + // If we reach here it means that the conditions for this thread have not been met. + // If this is a try wait operation then do not block but return an error code. + if (block == 0) { - // Event flag has no empty wait slots rc = CELL_SPURS_TASK_ERROR_BUSY; return; } - // Mark the found wait slot as used by this thread - ctrl.ppuWaitSlotAndMode = (CELL_SPURS_EVENT_FLAG_MAX_WAIT_SLOTS - 1 - i) << 4; + ctrl.ppuWaitSlotAndMode = 0; + if (eventFlag->direction == CELL_SPURS_EVENT_FLAG_ANY2ANY) + { + // Find an unsed wait slot + s32 i = 0; + u16 spuTaskUsedWaitSlots = eventFlag->spuTaskUsedWaitSlots; + while (spuTaskUsedWaitSlots & 0x0001) + { + spuTaskUsedWaitSlots >>= 1; + i++; + } + + if (i == CELL_SPURS_EVENT_FLAG_MAX_WAIT_SLOTS) + { + // Event flag has no empty wait slots + rc = CELL_SPURS_TASK_ERROR_BUSY; + return; + } + + // Mark the found wait slot as used by this thread + ctrl.ppuWaitSlotAndMode = (CELL_SPURS_EVENT_FLAG_MAX_WAIT_SLOTS - 1 - i) << 4; + } + + // Save the wait mask and mode for this thread + ctrl.ppuWaitSlotAndMode |= mode; + ctrl.ppuWaitMask = *mask; + + recv = true; } - // Save the wait mask and mode for this thread - ctrl.ppuWaitSlotAndMode |= mode; - ctrl.ppuWaitMask = *mask; - - recv = true; - } - - //eventFlagControl = ((u64)events << 48) | ((u64)spuTaskPendingRecv << 32) | ((u64)ppuWaitMask << 16) | ((u64)ppuWaitSlotAndMode << 8) | (u64)ppuPendingRecv; - rc = CELL_OK; - }); + // eventFlagControl = ((u64)events << 48) | ((u64)spuTaskPendingRecv << 32) | ((u64)ppuWaitMask << 16) | ((u64)ppuWaitSlotAndMode << 8) | (u64)ppuPendingRecv; + rc = CELL_OK; + }); if (rc != CELL_OK) { @@ -3594,7 +3626,10 @@ s32 _spurs::event_flag_wait(ppu_thread& ppu, vm::ptr eventFl } *mask = eventFlag->pendingRecvTaskEvents[i]; - vm::atomic_op(eventFlag->ctrl, [](CellSpursEventFlag::ControlSyncVar& ctrl) { ctrl.ppuPendingRecv = 0; }); + vm::atomic_op(eventFlag->ctrl, [](CellSpursEventFlag::ControlSyncVar& ctrl) + { + ctrl.ppuPendingRecv = 0; + }); } *mask = receivedEvents; @@ -3654,7 +3689,7 @@ s32 cellSpursEventFlagAttachLv2EventQueue(ppu_thread& ppu, vm::ptr eventQueueId; - vm::var port; + vm::var port; auto failure = [](s32 rc) -> s32 { @@ -3670,7 +3705,7 @@ s32 cellSpursEventFlagAttachLv2EventQueue(ppu_thread& ppu, vm::ptreventQueueId = *eventQueueId; - eventFlag->spuPort = *port; + eventFlag->spuPort = *port; }; if (eventFlag->direction == CELL_SPURS_EVENT_FLAG_ANY2ANY) @@ -3962,7 +3997,7 @@ s32 _spurs::create_taskset(ppu_thread& ppu, vm::ptr spurs, vm::ptrwkl_flag_wait_task = 0x80; - taskset->wid = *wid; + taskset->wid = *wid; // TODO: cellSpursSetExceptionEventHandler(spurs, wid, hook, taskset); // TODO: Check return code @@ -4063,7 +4098,7 @@ s32 cellSpursShutdownTaskset(ppu_thread& ppu, vm::ptr taskset) else if (shutdown_error == CELL_SPURS_POLICY_MODULE_ERROR_ALIGN || shutdown_error == CELL_SPURS_POLICY_MODULE_ERROR_SRCH) { // printf is used on fw in this case - cellSpurs.error("cellSpursShutdownTaskset(taskset=*0x%x): Failed with %s (spurs=0x%x, wid=%d)", CellError{ shutdown_error }, spurs, wid); + cellSpurs.error("cellSpursShutdownTaskset(taskset=*0x%x): Failed with %s (spurs=0x%x, wid=%d)", CellError{shutdown_error}, spurs, wid); } return shutdown_error; @@ -4135,33 +4170,33 @@ s32 _spurs::create_task(vm::ptr taskset, vm::ptr task_id, u32 tmp_task_id; vm::light_op(vm::_ref>(taskset.ptr(&CellSpursTaskset::enabled).addr()), [&](atomic_be_t& ptr) - { - // NOTE: Realfw processes this using 4 32-bits atomic loops - // But here its processed within a single 128-bit atomic op - ptr.fetch_op([&](be_t& value) { - auto value0 = value.value(); + // NOTE: Realfw processes this using 4 32-bits atomic loops + // But here its processed within a single 128-bit atomic op + ptr.fetch_op([&](be_t& value) + { + auto value0 = value.value(); - if (auto pos = std::countl_one(+value0._u64[0]); pos != 64) - { - tmp_task_id = pos; - value0._u64[0] |= (1ull << 63) >> pos; - value = value0; - return true; - } + if (auto pos = std::countl_one(+value0._u64[0]); pos != 64) + { + tmp_task_id = pos; + value0._u64[0] |= (1ull << 63) >> pos; + value = value0; + return true; + } - if (auto pos = std::countl_one(+value0._u64[1]); pos != 64) - { - tmp_task_id = pos + 64; - value0._u64[1] |= (1ull << 63) >> pos; - value = value0; - return true; - } + if (auto pos = std::countl_one(+value0._u64[1]); pos != 64) + { + tmp_task_id = pos + 64; + value0._u64[1] |= (1ull << 63) >> pos; + value = value0; + return true; + } - tmp_task_id = CELL_SPURS_MAX_TASK; - return false; + tmp_task_id = CELL_SPURS_MAX_TASK; + return false; + }); }); - }); if (tmp_task_id >= CELL_SPURS_MAX_TASK) { @@ -4170,7 +4205,7 @@ s32 _spurs::create_task(vm::ptr taskset, vm::ptr task_id, taskset->task_info[tmp_task_id].elf = elf; taskset->task_info[tmp_task_id].context_save_storage_and_alloc_ls_blocks = (context.addr() | alloc_ls_blocks); - taskset->task_info[tmp_task_id].args = *arg; + taskset->task_info[tmp_task_id].args = *arg; if (ls_pattern) { taskset->task_info[tmp_task_id].ls_pattern = *ls_pattern; @@ -4183,9 +4218,9 @@ s32 _spurs::create_task(vm::ptr taskset, vm::ptr task_id, s32 _spurs::task_start(ppu_thread& ppu, vm::ptr taskset, u32 taskId) { vm::light_op(taskset->pending_ready, [&](CellSpursTaskset::atomic_tasks_bitset& v) - { - v.values[taskId / 32] |= (1u << 31) >> (taskId % 32); - }); + { + v.values[taskId / 32] |= (1u << 31) >> (taskId % 32); + }); auto spurs = +taskset->spurs; ppu_execute<&cellSpursSendWorkloadSignal>(ppu, spurs, +taskset->wid); @@ -4256,32 +4291,32 @@ s32 _cellSpursSendSignal(ppu_thread& ppu, vm::ptr taskset, u32 int signal; vm::reservation_op(ppu, vm::unsafe_ptr_cast(taskset), [&](spurs_taskset_signal_op& op) - { - const u32 signalled = op.signalled[taskId / 32]; - const u32 running = op.running[taskId / 32]; - const u32 ready = op.ready[taskId / 32]; - const u32 waiting = op.waiting[taskId / 32]; - const u32 enabled = op.enabled[taskId / 32]; - const u32 pready = op.pending_ready[taskId / 32]; - - const u32 mask = (1u << 31) >> (taskId % 32); - - if ((running & waiting) || (ready & pready) || - ((signalled | waiting | pready | running | ready) & ~enabled) || !(enabled & mask)) { - // Error conditions: - // 1) Cannot have a waiting bit and running bit set at the same time - // 2) Cannot have a read bit and pending_ready bit at the same time - // 3) Any disabled bit in enabled mask must be not set - // 4) Specified task must be enabled - signal = -1; - return false; - } + const u32 signalled = op.signalled[taskId / 32]; + const u32 running = op.running[taskId / 32]; + const u32 ready = op.ready[taskId / 32]; + const u32 waiting = op.waiting[taskId / 32]; + const u32 enabled = op.enabled[taskId / 32]; + const u32 pready = op.pending_ready[taskId / 32]; - signal = !!(~signalled & waiting & mask); - op.signalled[taskId / 32] = signalled | mask; - return true; - }); + const u32 mask = (1u << 31) >> (taskId % 32); + + if ((running & waiting) || (ready & pready) || + ((signalled | waiting | pready | running | ready) & ~enabled) || !(enabled & mask)) + { + // Error conditions: + // 1) Cannot have a waiting bit and running bit set at the same time + // 2) Cannot have a read bit and pending_ready bit at the same time + // 3) Any disabled bit in enabled mask must be not set + // 4) Specified task must be enabled + signal = -1; + return false; + } + + signal = !!(~signalled & waiting & mask); + op.signalled[taskId / 32] = signalled | mask; + return true; + }); switch (signal) { @@ -4648,14 +4683,12 @@ s32 _cellSpursTasksetAttributeInitialize(vm::ptr attr attribute->sdk_version = sdk_version; attribute->args = args; std::memcpy(attribute->priority, priority.get_ptr(), 8); - attribute->taskset_size = 6400/*CellSpursTaskset::size*/; + attribute->taskset_size = 6400 /*CellSpursTaskset::size*/; attribute->max_contention = max_contention; return CELL_OK; } -s32 _spurs::check_job_chain_attribute(u32 sdkVer, vm::cptr jcEntry, u16 sizeJobDescr, u16 maxGrabbedJob - , u64 priorities, u32 maxContention, u8 autoSpuCount, u32 tag1, u32 tag2 - , u8 isFixedMemAlloc, u32 maxSizeJob, u32 initSpuCount) +s32 _spurs::check_job_chain_attribute(u32 sdkVer, vm::cptr jcEntry, u16 sizeJobDescr, u16 maxGrabbedJob, u64 priorities, u32 maxContention, u8 autoSpuCount, u32 tag1, u32 tag2, u8 isFixedMemAlloc, u32 maxSizeJob, u32 initSpuCount) { if (!jcEntry) return CELL_SPURS_JOB_ERROR_NULL_POINTER; @@ -4686,9 +4719,7 @@ s32 _spurs::check_job_chain_attribute(u32 sdkVer, vm::cptr jcEntry, u16 siz return CELL_OK; } -s32 _spurs::create_job_chain(ppu_thread& ppu, vm::ptr spurs, vm::ptr jobChain, vm::cptr jobChainEntry, u16 sizeJob - , u16 maxGrabbedJob, vm::cptr prio, u32 maxContention, b8 autoReadyCount - , u32 tag1, u32 tag2, u32 HaltOnError, vm::cptr name, u32 param_13, u32 param_14) +s32 _spurs::create_job_chain(ppu_thread& ppu, vm::ptr spurs, vm::ptr jobChain, vm::cptr jobChainEntry, u16 sizeJob, u16 maxGrabbedJob, vm::cptr prio, u32 maxContention, b8 autoReadyCount, u32 tag1, u32 tag2, u32 HaltOnError, vm::cptr name, u32 param_13, u32 param_14) { const s32 sdkVer = _spurs::get_sdk_version(); jobChain->spurs = spurs; @@ -4747,8 +4778,7 @@ s32 cellSpursCreateJobChainWithAttribute(ppu_thread& ppu, vm::ptr spu const u64 prio = std::bit_cast(attr->priorities); - if (auto err = _spurs::check_job_chain_attribute(attr->sdkVer, attr->jobChainEntry, attr->sizeJobDescriptor, attr->maxGrabbedJob, prio, attr->maxContention - , attr->autoSpuCount, attr->tag1, attr->tag2, attr->isFixedMemAlloc, attr->maxSizeJobDescriptor, attr->initSpuCount)) + if (auto err = _spurs::check_job_chain_attribute(attr->sdkVer, attr->jobChainEntry, attr->sizeJobDescriptor, attr->maxGrabbedJob, prio, attr->maxContention, attr->autoSpuCount, attr->tag1, attr->tag2, attr->isFixedMemAlloc, attr->maxSizeJobDescriptor, attr->initSpuCount)) { return err; } @@ -4769,9 +4799,7 @@ s32 cellSpursCreateJobChainWithAttribute(ppu_thread& ppu, vm::ptr spu jobChain->val2C = +attr->isFixedMemAlloc << 7 | (((attr->maxSizeJobDescriptor - 0x100) / 128 & 7) << 4); - if (auto err = _spurs::create_job_chain(ppu, spurs, jobChain, attr->jobChainEntry, attr->sizeJobDescriptor - , attr->maxGrabbedJob, attr.ptr(&CellSpursJobChainAttribute::priorities), attr->maxContention, attr->autoSpuCount - , attr->tag1, attr->tag2, attr->haltOnError, attr->name, 0, 0)) + if (auto err = _spurs::create_job_chain(ppu, spurs, jobChain, attr->jobChainEntry, attr->sizeJobDescriptor, attr->maxGrabbedJob, attr.ptr(&CellSpursJobChainAttribute::priorities), attr->maxContention, attr->autoSpuCount, attr->tag1, attr->tag2, attr->haltOnError, attr->name, 0, 0)) { return err; } @@ -4783,12 +4811,11 @@ s32 cellSpursCreateJobChainWithAttribute(ppu_thread& ppu, vm::ptr spu return CELL_OK; } -s32 cellSpursCreateJobChain(ppu_thread& ppu, vm::ptr spurs, vm::ptr jobChain, vm::cptr jobChainEntry, u16 sizeJobDescriptor - , u16 maxGrabbedJob, vm::cptr priorities, u32 maxContention, b8 autoReadyCount, u32 tag1, u32 tag2) +s32 cellSpursCreateJobChain(ppu_thread& ppu, vm::ptr spurs, vm::ptr jobChain, vm::cptr jobChainEntry, u16 sizeJobDescriptor, u16 maxGrabbedJob, vm::cptr priorities, u32 maxContention, b8 autoReadyCount, u32 tag1, u32 tag2) { cellSpurs.warning("cellSpursCreateJobChain(spurs=*0x%x, jobChain=*0x%x, jobChainEntry=*0x%x, sizeJobDescriptor=0x%x" - ", maxGrabbedJob=0x%x, priorities=*0x%x, maxContention=%u, autoReadyCount=%s, tag1=%u, %u)", spurs, jobChain, jobChainEntry, sizeJobDescriptor - , maxGrabbedJob, priorities, maxContention, autoReadyCount, tag1, tag2); + ", maxGrabbedJob=0x%x, priorities=*0x%x, maxContention=%u, autoReadyCount=%s, tag1=%u, %u)", + spurs, jobChain, jobChainEntry, sizeJobDescriptor, maxGrabbedJob, priorities, maxContention, autoReadyCount, tag1, tag2); const u64 prio = std::bit_cast(*priorities); @@ -4799,8 +4826,7 @@ s32 cellSpursCreateJobChain(ppu_thread& ppu, vm::ptr spurs, vm::ptr jobChain, return err; } -s32 _cellSpursJobChainAttributeInitialize(u32 jmRevsion, u32 sdkRevision, vm::ptr attr, vm::cptr jobChainEntry, u16 sizeJobDescriptor, u16 maxGrabbedJob - , vm::cptr priorityTable, u32 maxContention, b8 autoRequestSpuCount, u32 tag1, u32 tag2, b8 isFixedMemAlloc, u32 maxSizeJobDescriptor, u32 initialRequestSpuCount) +s32 _cellSpursJobChainAttributeInitialize(u32 jmRevsion, u32 sdkRevision, vm::ptr attr, vm::cptr jobChainEntry, u16 sizeJobDescriptor, u16 maxGrabbedJob, vm::cptr priorityTable, u32 maxContention, b8 autoRequestSpuCount, u32 tag1, u32 tag2, b8 isFixedMemAlloc, u32 maxSizeJobDescriptor, u32 initialRequestSpuCount) { cellSpurs.trace("_cellSpursJobChainAttributeInitialize(jmRevsion=0x%x, sdkRevision=0x%x, attr=*0x%x, jobChainEntry=*0x%x, sizeJobDescriptor=0x%x, maxGrabbedJob=0x%x, priorityTable=*0x%x" - ", maxContention=%u, autoRequestSpuCount=%s, tag1=0x%x, tag2=0x%x, isFixedMemAlloc=%s, maxSizeJobDescriptor=0x%x, initialRequestSpuCount=%u)", + ", maxContention=%u, autoRequestSpuCount=%s, tag1=0x%x, tag2=0x%x, isFixedMemAlloc=%s, maxSizeJobDescriptor=0x%x, initialRequestSpuCount=%u)", jmRevsion, sdkRevision, attr, jobChainEntry, sizeJobDescriptor, maxGrabbedJob, priorityTable, maxContention, autoRequestSpuCount, tag1, tag2, isFixedMemAlloc, maxSizeJobDescriptor, initialRequestSpuCount); if (!attr) @@ -4896,8 +4921,7 @@ s32 _cellSpursJobChainAttributeInitialize(u32 jmRevsion, u32 sdkRevision, vm::pt const u64 prio = std::bit_cast(*priorityTable); - if (auto err = _spurs::check_job_chain_attribute(sdkRevision, jobChainEntry, sizeJobDescriptor, maxGrabbedJob, prio, maxContention - , autoRequestSpuCount, tag1, tag2, isFixedMemAlloc, maxSizeJobDescriptor, initialRequestSpuCount)) + if (auto err = _spurs::check_job_chain_attribute(sdkRevision, jobChainEntry, sizeJobDescriptor, maxGrabbedJob, prio, maxContention, autoRequestSpuCount, tag1, tag2, isFixedMemAlloc, maxSizeJobDescriptor, initialRequestSpuCount)) { return err; } @@ -5004,9 +5028,9 @@ s32 cellSpursGetJobChainInfo(ppu_thread& ppu, vm::ptr jobChai // Read the commands queue atomically CellSpursJobChain data; vm::peek_op(ppu, vm::unsafe_ptr_cast(jobChain), [&](const CellSpursJobChain_x00& jch) - { - std::memcpy(&data, &jch, sizeof(jch)); - }); + { + std::memcpy(&data, &jch, sizeof(jch)); + }); info->linkRegister[0] = +data.linkRegister[0]; info->linkRegister[1] = +data.linkRegister[1]; @@ -5042,8 +5066,7 @@ s32 cellSpursJobChainGetSpursAddress(vm::ptr jobChain, vm::pp s32 cellSpursJobGuardInitialize(vm::ptr jobChain, vm::ptr jobGuard, u32 notifyCount, u8 requestSpuCount, u8 autoReset) { - cellSpurs.trace("cellSpursJobGuardInitialize(jobChain=*0x%x, jobGuard=*0x%x, notifyCount=0x%x, requestSpuCount=0x%x, autoReset=0x%x)" - , jobChain, jobGuard, notifyCount, requestSpuCount, autoReset); + cellSpurs.trace("cellSpursJobGuardInitialize(jobChain=*0x%x, jobGuard=*0x%x, notifyCount=0x%x, requestSpuCount=0x%x, autoReset=0x%x)", jobChain, jobGuard, notifyCount, requestSpuCount, autoReset); if (!jobChain || !jobGuard) return CELL_SPURS_JOB_ERROR_NULL_POINTER; @@ -5078,7 +5101,7 @@ s32 cellSpursJobChainAttributeSetName(vm::ptr attr, return CELL_OK; } -s32 cellSpursShutdownJobChain(ppu_thread& ppu,vm::ptr jobChain) +s32 cellSpursShutdownJobChain(ppu_thread& ppu, vm::ptr jobChain) { cellSpurs.trace("cellSpursShutdownJobChain(jobChain=*0x%x)", jobChain); @@ -5145,18 +5168,18 @@ s32 cellSpursJobGuardNotify(ppu_thread& ppu, vm::ptr jobGuard u32 old = 0; const bool ok = vm::reservation_op(ppu, vm::unsafe_ptr_cast(jobGuard), [&](CellSpursJobGuard_x00& jg) - { - allow_jobchain_run = jg.zero; - old = jg.ncount0; - - if (!jg.ncount0) { - return false; - } + allow_jobchain_run = jg.zero; + old = jg.ncount0; - jg.ncount0--; - return true; - }); + if (!jg.ncount0) + { + return false; + } + + jg.ncount0--; + return true; + }); if (!ok) { @@ -5193,9 +5216,9 @@ s32 cellSpursJobGuardReset(vm::ptr jobGuard) return CELL_SPURS_JOB_ERROR_ALIGN; vm::light_op(jobGuard->ncount0, [&](atomic_be_t& ncount0) - { - ncount0 = jobGuard->ncount1; - }); + { + ncount0 = jobGuard->ncount1; + }); return CELL_OK; } @@ -5280,9 +5303,9 @@ s32 cellSpursJobSetMaxGrab(vm::ptr jobChain, u32 maxGrabbedJo return CELL_SPURS_JOB_ERROR_STAT; vm::light_op(jobChain->maxGrabbedJob, [&](atomic_be_t& v) - { - v.release(static_cast(maxGrabbedJob)); - }); + { + v.release(static_cast(maxGrabbedJob)); + }); return CELL_OK; } @@ -5309,20 +5332,20 @@ s32 cellSpursAddUrgentCommand(ppu_thread& ppu, vm::ptr jobCha s32 result = CELL_OK; vm::reservation_op(ppu, vm::unsafe_ptr_cast(jobChain), [&](CellSpursJobChain_x00& jch) - { - for (auto& cmd : jch.urgentCmds) { - if (!cmd) + for (auto& cmd : jch.urgentCmds) { - cmd = newCmd; - return true; + if (!cmd) + { + cmd = newCmd; + return true; + } } - } - // Considered unlikely so unoptimized - result = CELL_SPURS_JOB_ERROR_BUSY; - return false; - }); + // Considered unlikely so unoptimized + result = CELL_SPURS_JOB_ERROR_BUSY; + return false; + }); return result; } @@ -5390,181 +5413,181 @@ s32 cellSpursSemaphoreGetTasksetAddress() } DECLARE(ppu_module_manager::cellSpurs)("cellSpurs", [](ppu_static_module* _this) -{ - // Core - REG_FUNC(cellSpurs, cellSpursInitialize); - REG_FUNC(cellSpurs, cellSpursInitializeWithAttribute); - REG_FUNC(cellSpurs, cellSpursInitializeWithAttribute2); - REG_FUNC(cellSpurs, cellSpursFinalize); - REG_FUNC(cellSpurs, _cellSpursAttributeInitialize); - REG_FUNC(cellSpurs, cellSpursAttributeSetMemoryContainerForSpuThread); - REG_FUNC(cellSpurs, cellSpursAttributeSetNamePrefix); - REG_FUNC(cellSpurs, cellSpursAttributeEnableSpuPrintfIfAvailable); - REG_FUNC(cellSpurs, cellSpursAttributeSetSpuThreadGroupType); - REG_FUNC(cellSpurs, cellSpursAttributeEnableSystemWorkload); - REG_FUNC(cellSpurs, cellSpursGetSpuThreadGroupId); - REG_FUNC(cellSpurs, cellSpursGetNumSpuThread); - REG_FUNC(cellSpurs, cellSpursGetSpuThreadId); - 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); - REG_FUNC(cellSpurs, cellSpursEnableExceptionEventHandler); - REG_FUNC(cellSpurs, cellSpursSetGlobalExceptionEventHandler); - REG_FUNC(cellSpurs, cellSpursUnsetGlobalExceptionEventHandler); - REG_FUNC(cellSpurs, cellSpursSetExceptionEventHandler); - REG_FUNC(cellSpurs, cellSpursUnsetExceptionEventHandler); - - // Event flag - REG_FUNC(cellSpurs, _cellSpursEventFlagInitialize); - REG_FUNC(cellSpurs, cellSpursEventFlagAttachLv2EventQueue); - REG_FUNC(cellSpurs, cellSpursEventFlagDetachLv2EventQueue); - REG_FUNC(cellSpurs, cellSpursEventFlagWait); - REG_FUNC(cellSpurs, cellSpursEventFlagClear); - REG_FUNC(cellSpurs, cellSpursEventFlagSet); - REG_FUNC(cellSpurs, cellSpursEventFlagTryWait); - REG_FUNC(cellSpurs, cellSpursEventFlagGetDirection); - REG_FUNC(cellSpurs, cellSpursEventFlagGetClearMode); - REG_FUNC(cellSpurs, cellSpursEventFlagGetTasksetAddress); - - // Taskset - REG_FUNC(cellSpurs, cellSpursCreateTaskset); - REG_FUNC(cellSpurs, cellSpursCreateTasksetWithAttribute); - REG_FUNC(cellSpurs, _cellSpursTasksetAttributeInitialize); - REG_FUNC(cellSpurs, _cellSpursTasksetAttribute2Initialize); - REG_FUNC(cellSpurs, cellSpursTasksetAttributeSetName); - REG_FUNC(cellSpurs, cellSpursTasksetAttributeSetTasksetSize); - REG_FUNC(cellSpurs, cellSpursTasksetAttributeEnableClearLS); - REG_FUNC(cellSpurs, cellSpursJoinTaskset); - REG_FUNC(cellSpurs, cellSpursGetTasksetId); - REG_FUNC(cellSpurs, cellSpursShutdownTaskset); - REG_FUNC(cellSpurs, cellSpursCreateTask); - REG_FUNC(cellSpurs, cellSpursCreateTaskWithAttribute); - REG_FUNC(cellSpurs, _cellSpursTaskAttributeInitialize); - REG_FUNC(cellSpurs, _cellSpursTaskAttribute2Initialize); - REG_FUNC(cellSpurs, cellSpursTaskAttributeSetExitCodeContainer); - REG_FUNC(cellSpurs, cellSpursTaskExitCodeGet); - REG_FUNC(cellSpurs, cellSpursTaskExitCodeInitialize); - REG_FUNC(cellSpurs, cellSpursTaskExitCodeTryGet); - REG_FUNC(cellSpurs, cellSpursTaskGetLoadableSegmentPattern); - REG_FUNC(cellSpurs, cellSpursTaskGetReadOnlyAreaPattern); - REG_FUNC(cellSpurs, cellSpursTaskGenerateLsPattern); - REG_FUNC(cellSpurs, cellSpursTaskGetContextSaveAreaSize); - REG_FUNC(cellSpurs, _cellSpursSendSignal); - REG_FUNC(cellSpurs, cellSpursCreateTaskset2); - REG_FUNC(cellSpurs, cellSpursCreateTask2); - REG_FUNC(cellSpurs, cellSpursJoinTask2); - REG_FUNC(cellSpurs, cellSpursTryJoinTask2); - REG_FUNC(cellSpurs, cellSpursDestroyTaskset2); - REG_FUNC(cellSpurs, cellSpursCreateTask2WithBinInfo); - REG_FUNC(cellSpurs, cellSpursLookUpTasksetAddress); - REG_FUNC(cellSpurs, cellSpursTasksetGetSpursAddress); - REG_FUNC(cellSpurs, cellSpursGetTasksetInfo); - REG_FUNC(cellSpurs, cellSpursTasksetSetExceptionEventHandler); - REG_FUNC(cellSpurs, cellSpursTasksetUnsetExceptionEventHandler); - - // Job Chain - REG_FUNC(cellSpurs, cellSpursCreateJobChain); - REG_FUNC(cellSpurs, cellSpursCreateJobChainWithAttribute); - REG_FUNC(cellSpurs, cellSpursShutdownJobChain); - REG_FUNC(cellSpurs, cellSpursJoinJobChain); - REG_FUNC(cellSpurs, cellSpursKickJobChain); - REG_FUNC(cellSpurs, cellSpursRunJobChain); - REG_FUNC(cellSpurs, cellSpursJobChainGetError); - REG_FUNC(cellSpurs, _cellSpursJobChainAttributeInitialize); - REG_FUNC(cellSpurs, cellSpursJobChainAttributeSetName); - REG_FUNC(cellSpurs, cellSpursJobChainAttributeSetHaltOnError); - REG_FUNC(cellSpurs, cellSpursJobChainAttributeSetJobTypeMemoryCheck); - REG_FUNC(cellSpurs, cellSpursGetJobChainId); - REG_FUNC(cellSpurs, cellSpursJobChainSetExceptionEventHandler); - REG_FUNC(cellSpurs, cellSpursJobChainUnsetExceptionEventHandler); - REG_FUNC(cellSpurs, cellSpursGetJobChainInfo); - REG_FUNC(cellSpurs, cellSpursJobChainGetSpursAddress); - - // Job Guard - REG_FUNC(cellSpurs, cellSpursJobGuardInitialize); - REG_FUNC(cellSpurs, cellSpursJobGuardNotify); - REG_FUNC(cellSpurs, cellSpursJobGuardReset); - - // LFQueue - REG_FUNC(cellSpurs, _cellSpursLFQueueInitialize); - REG_FUNC(cellSpurs, _cellSpursLFQueuePushBody); - REG_FUNC(cellSpurs, cellSpursLFQueueAttachLv2EventQueue); - REG_FUNC(cellSpurs, cellSpursLFQueueDetachLv2EventQueue); - REG_FUNC(cellSpurs, _cellSpursLFQueuePopBody); - REG_FUNC(cellSpurs, cellSpursLFQueueGetTasksetAddress); - - // Queue - REG_FUNC(cellSpurs, _cellSpursQueueInitialize); - REG_FUNC(cellSpurs, cellSpursQueuePopBody); - REG_FUNC(cellSpurs, cellSpursQueuePushBody); - REG_FUNC(cellSpurs, cellSpursQueueAttachLv2EventQueue); - REG_FUNC(cellSpurs, cellSpursQueueDetachLv2EventQueue); - REG_FUNC(cellSpurs, cellSpursQueueGetTasksetAddress); - REG_FUNC(cellSpurs, cellSpursQueueClear); - REG_FUNC(cellSpurs, cellSpursQueueDepth); - REG_FUNC(cellSpurs, cellSpursQueueGetEntrySize); - REG_FUNC(cellSpurs, cellSpursQueueSize); - REG_FUNC(cellSpurs, cellSpursQueueGetDirection); - - // Workload - REG_FUNC(cellSpurs, cellSpursWorkloadAttributeSetName); - REG_FUNC(cellSpurs, cellSpursWorkloadAttributeSetShutdownCompletionEventHook); - REG_FUNC(cellSpurs, cellSpursAddWorkloadWithAttribute); - REG_FUNC(cellSpurs, cellSpursAddWorkload); - REG_FUNC(cellSpurs, cellSpursShutdownWorkload); - REG_FUNC(cellSpurs, cellSpursWaitForWorkloadShutdown); - REG_FUNC(cellSpurs, cellSpursRemoveSystemWorkloadForUtility); - REG_FUNC(cellSpurs, cellSpursRemoveWorkload); - REG_FUNC(cellSpurs, cellSpursReadyCountStore); - REG_FUNC(cellSpurs, cellSpursGetWorkloadFlag); - REG_FUNC(cellSpurs, _cellSpursWorkloadFlagReceiver); - REG_FUNC(cellSpurs, _cellSpursWorkloadAttributeInitialize); - REG_FUNC(cellSpurs, cellSpursSendWorkloadSignal); - REG_FUNC(cellSpurs, cellSpursGetWorkloadData); - REG_FUNC(cellSpurs, cellSpursReadyCountAdd); - REG_FUNC(cellSpurs, cellSpursReadyCountCompareAndSwap); - REG_FUNC(cellSpurs, cellSpursReadyCountSwap); - REG_FUNC(cellSpurs, cellSpursRequestIdleSpu); - REG_FUNC(cellSpurs, cellSpursGetWorkloadInfo); - REG_FUNC(cellSpurs, cellSpursGetSpuGuid); - REG_FUNC(cellSpurs, _cellSpursWorkloadFlagReceiver2); - REG_FUNC(cellSpurs, cellSpursGetJobPipelineInfo); - REG_FUNC(cellSpurs, cellSpursJobSetMaxGrab); - REG_FUNC(cellSpurs, cellSpursJobHeaderSetJobbin2Param); - - REG_FUNC(cellSpurs, cellSpursWakeUp); - REG_FUNC(cellSpurs, cellSpursAddUrgentCommand); - REG_FUNC(cellSpurs, cellSpursAddUrgentCall); - - REG_FUNC(cellSpurs, cellSpursBarrierInitialize); - REG_FUNC(cellSpurs, cellSpursBarrierGetTasksetAddress); - - REG_FUNC(cellSpurs, _cellSpursSemaphoreInitialize); - REG_FUNC(cellSpurs, cellSpursSemaphoreGetTasksetAddress); - - // Trace - REG_FUNC(cellSpurs, cellSpursTraceInitialize); - REG_FUNC(cellSpurs, cellSpursTraceStart); - REG_FUNC(cellSpurs, cellSpursTraceStop); - REG_FUNC(cellSpurs, cellSpursTraceFinalize); - - _this->add_init_func([](ppu_static_module*) { - const auto val = g_cfg.core.spu_accurate_reservations ? MFF_PERFECT : MFF_FORCED_HLE; + // Core + REG_FUNC(cellSpurs, cellSpursInitialize); + REG_FUNC(cellSpurs, cellSpursInitializeWithAttribute); + REG_FUNC(cellSpurs, cellSpursInitializeWithAttribute2); + REG_FUNC(cellSpurs, cellSpursFinalize); + REG_FUNC(cellSpurs, _cellSpursAttributeInitialize); + REG_FUNC(cellSpurs, cellSpursAttributeSetMemoryContainerForSpuThread); + REG_FUNC(cellSpurs, cellSpursAttributeSetNamePrefix); + REG_FUNC(cellSpurs, cellSpursAttributeEnableSpuPrintfIfAvailable); + REG_FUNC(cellSpurs, cellSpursAttributeSetSpuThreadGroupType); + REG_FUNC(cellSpurs, cellSpursAttributeEnableSystemWorkload); + REG_FUNC(cellSpurs, cellSpursGetSpuThreadGroupId); + REG_FUNC(cellSpurs, cellSpursGetNumSpuThread); + REG_FUNC(cellSpurs, cellSpursGetSpuThreadId); + 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); + REG_FUNC(cellSpurs, cellSpursEnableExceptionEventHandler); + REG_FUNC(cellSpurs, cellSpursSetGlobalExceptionEventHandler); + REG_FUNC(cellSpurs, cellSpursUnsetGlobalExceptionEventHandler); + REG_FUNC(cellSpurs, cellSpursSetExceptionEventHandler); + REG_FUNC(cellSpurs, cellSpursUnsetExceptionEventHandler); - REINIT_FUNC(cellSpursSetPriorities).flag(val); - REINIT_FUNC(cellSpursAddWorkload).flag(val); - REINIT_FUNC(cellSpursAddWorkloadWithAttribute).flag(val); - REINIT_FUNC(cellSpursShutdownWorkload).flag(val); - REINIT_FUNC(cellSpursReadyCountStore).flag(val); - REINIT_FUNC(cellSpursSetPriority).flag(val); - REINIT_FUNC(cellSpursTraceInitialize).flag(val); - REINIT_FUNC(cellSpursWaitForWorkloadShutdown).flag(val); - REINIT_FUNC(cellSpursRequestIdleSpu).flag(val); - REINIT_FUNC(cellSpursRemoveWorkload).flag(val); + // Event flag + REG_FUNC(cellSpurs, _cellSpursEventFlagInitialize); + REG_FUNC(cellSpurs, cellSpursEventFlagAttachLv2EventQueue); + REG_FUNC(cellSpurs, cellSpursEventFlagDetachLv2EventQueue); + REG_FUNC(cellSpurs, cellSpursEventFlagWait); + REG_FUNC(cellSpurs, cellSpursEventFlagClear); + REG_FUNC(cellSpurs, cellSpursEventFlagSet); + REG_FUNC(cellSpurs, cellSpursEventFlagTryWait); + REG_FUNC(cellSpurs, cellSpursEventFlagGetDirection); + REG_FUNC(cellSpurs, cellSpursEventFlagGetClearMode); + REG_FUNC(cellSpurs, cellSpursEventFlagGetTasksetAddress); + + // Taskset + REG_FUNC(cellSpurs, cellSpursCreateTaskset); + REG_FUNC(cellSpurs, cellSpursCreateTasksetWithAttribute); + REG_FUNC(cellSpurs, _cellSpursTasksetAttributeInitialize); + REG_FUNC(cellSpurs, _cellSpursTasksetAttribute2Initialize); + REG_FUNC(cellSpurs, cellSpursTasksetAttributeSetName); + REG_FUNC(cellSpurs, cellSpursTasksetAttributeSetTasksetSize); + REG_FUNC(cellSpurs, cellSpursTasksetAttributeEnableClearLS); + REG_FUNC(cellSpurs, cellSpursJoinTaskset); + REG_FUNC(cellSpurs, cellSpursGetTasksetId); + REG_FUNC(cellSpurs, cellSpursShutdownTaskset); + REG_FUNC(cellSpurs, cellSpursCreateTask); + REG_FUNC(cellSpurs, cellSpursCreateTaskWithAttribute); + REG_FUNC(cellSpurs, _cellSpursTaskAttributeInitialize); + REG_FUNC(cellSpurs, _cellSpursTaskAttribute2Initialize); + REG_FUNC(cellSpurs, cellSpursTaskAttributeSetExitCodeContainer); + REG_FUNC(cellSpurs, cellSpursTaskExitCodeGet); + REG_FUNC(cellSpurs, cellSpursTaskExitCodeInitialize); + REG_FUNC(cellSpurs, cellSpursTaskExitCodeTryGet); + REG_FUNC(cellSpurs, cellSpursTaskGetLoadableSegmentPattern); + REG_FUNC(cellSpurs, cellSpursTaskGetReadOnlyAreaPattern); + REG_FUNC(cellSpurs, cellSpursTaskGenerateLsPattern); + REG_FUNC(cellSpurs, cellSpursTaskGetContextSaveAreaSize); + REG_FUNC(cellSpurs, _cellSpursSendSignal); + REG_FUNC(cellSpurs, cellSpursCreateTaskset2); + REG_FUNC(cellSpurs, cellSpursCreateTask2); + REG_FUNC(cellSpurs, cellSpursJoinTask2); + REG_FUNC(cellSpurs, cellSpursTryJoinTask2); + REG_FUNC(cellSpurs, cellSpursDestroyTaskset2); + REG_FUNC(cellSpurs, cellSpursCreateTask2WithBinInfo); + REG_FUNC(cellSpurs, cellSpursLookUpTasksetAddress); + REG_FUNC(cellSpurs, cellSpursTasksetGetSpursAddress); + REG_FUNC(cellSpurs, cellSpursGetTasksetInfo); + REG_FUNC(cellSpurs, cellSpursTasksetSetExceptionEventHandler); + REG_FUNC(cellSpurs, cellSpursTasksetUnsetExceptionEventHandler); + + // Job Chain + REG_FUNC(cellSpurs, cellSpursCreateJobChain); + REG_FUNC(cellSpurs, cellSpursCreateJobChainWithAttribute); + REG_FUNC(cellSpurs, cellSpursShutdownJobChain); + REG_FUNC(cellSpurs, cellSpursJoinJobChain); + REG_FUNC(cellSpurs, cellSpursKickJobChain); + REG_FUNC(cellSpurs, cellSpursRunJobChain); + REG_FUNC(cellSpurs, cellSpursJobChainGetError); + REG_FUNC(cellSpurs, _cellSpursJobChainAttributeInitialize); + REG_FUNC(cellSpurs, cellSpursJobChainAttributeSetName); + REG_FUNC(cellSpurs, cellSpursJobChainAttributeSetHaltOnError); + REG_FUNC(cellSpurs, cellSpursJobChainAttributeSetJobTypeMemoryCheck); + REG_FUNC(cellSpurs, cellSpursGetJobChainId); + REG_FUNC(cellSpurs, cellSpursJobChainSetExceptionEventHandler); + REG_FUNC(cellSpurs, cellSpursJobChainUnsetExceptionEventHandler); + REG_FUNC(cellSpurs, cellSpursGetJobChainInfo); + REG_FUNC(cellSpurs, cellSpursJobChainGetSpursAddress); + + // Job Guard + REG_FUNC(cellSpurs, cellSpursJobGuardInitialize); + REG_FUNC(cellSpurs, cellSpursJobGuardNotify); + REG_FUNC(cellSpurs, cellSpursJobGuardReset); + + // LFQueue + REG_FUNC(cellSpurs, _cellSpursLFQueueInitialize); + REG_FUNC(cellSpurs, _cellSpursLFQueuePushBody); + REG_FUNC(cellSpurs, cellSpursLFQueueAttachLv2EventQueue); + REG_FUNC(cellSpurs, cellSpursLFQueueDetachLv2EventQueue); + REG_FUNC(cellSpurs, _cellSpursLFQueuePopBody); + REG_FUNC(cellSpurs, cellSpursLFQueueGetTasksetAddress); + + // Queue + REG_FUNC(cellSpurs, _cellSpursQueueInitialize); + REG_FUNC(cellSpurs, cellSpursQueuePopBody); + REG_FUNC(cellSpurs, cellSpursQueuePushBody); + REG_FUNC(cellSpurs, cellSpursQueueAttachLv2EventQueue); + REG_FUNC(cellSpurs, cellSpursQueueDetachLv2EventQueue); + REG_FUNC(cellSpurs, cellSpursQueueGetTasksetAddress); + REG_FUNC(cellSpurs, cellSpursQueueClear); + REG_FUNC(cellSpurs, cellSpursQueueDepth); + REG_FUNC(cellSpurs, cellSpursQueueGetEntrySize); + REG_FUNC(cellSpurs, cellSpursQueueSize); + REG_FUNC(cellSpurs, cellSpursQueueGetDirection); + + // Workload + REG_FUNC(cellSpurs, cellSpursWorkloadAttributeSetName); + REG_FUNC(cellSpurs, cellSpursWorkloadAttributeSetShutdownCompletionEventHook); + REG_FUNC(cellSpurs, cellSpursAddWorkloadWithAttribute); + REG_FUNC(cellSpurs, cellSpursAddWorkload); + REG_FUNC(cellSpurs, cellSpursShutdownWorkload); + REG_FUNC(cellSpurs, cellSpursWaitForWorkloadShutdown); + REG_FUNC(cellSpurs, cellSpursRemoveSystemWorkloadForUtility); + REG_FUNC(cellSpurs, cellSpursRemoveWorkload); + REG_FUNC(cellSpurs, cellSpursReadyCountStore); + REG_FUNC(cellSpurs, cellSpursGetWorkloadFlag); + REG_FUNC(cellSpurs, _cellSpursWorkloadFlagReceiver); + REG_FUNC(cellSpurs, _cellSpursWorkloadAttributeInitialize); + REG_FUNC(cellSpurs, cellSpursSendWorkloadSignal); + REG_FUNC(cellSpurs, cellSpursGetWorkloadData); + REG_FUNC(cellSpurs, cellSpursReadyCountAdd); + REG_FUNC(cellSpurs, cellSpursReadyCountCompareAndSwap); + REG_FUNC(cellSpurs, cellSpursReadyCountSwap); + REG_FUNC(cellSpurs, cellSpursRequestIdleSpu); + REG_FUNC(cellSpurs, cellSpursGetWorkloadInfo); + REG_FUNC(cellSpurs, cellSpursGetSpuGuid); + REG_FUNC(cellSpurs, _cellSpursWorkloadFlagReceiver2); + REG_FUNC(cellSpurs, cellSpursGetJobPipelineInfo); + REG_FUNC(cellSpurs, cellSpursJobSetMaxGrab); + REG_FUNC(cellSpurs, cellSpursJobHeaderSetJobbin2Param); + + REG_FUNC(cellSpurs, cellSpursWakeUp); + REG_FUNC(cellSpurs, cellSpursAddUrgentCommand); + REG_FUNC(cellSpurs, cellSpursAddUrgentCall); + + REG_FUNC(cellSpurs, cellSpursBarrierInitialize); + REG_FUNC(cellSpurs, cellSpursBarrierGetTasksetAddress); + + REG_FUNC(cellSpurs, _cellSpursSemaphoreInitialize); + REG_FUNC(cellSpurs, cellSpursSemaphoreGetTasksetAddress); + + // Trace + REG_FUNC(cellSpurs, cellSpursTraceInitialize); + REG_FUNC(cellSpurs, cellSpursTraceStart); + REG_FUNC(cellSpurs, cellSpursTraceStop); + REG_FUNC(cellSpurs, cellSpursTraceFinalize); + + _this->add_init_func([](ppu_static_module*) + { + const auto val = g_cfg.core.spu_accurate_reservations ? MFF_PERFECT : MFF_FORCED_HLE; + + REINIT_FUNC(cellSpursSetPriorities).flag(val); + REINIT_FUNC(cellSpursAddWorkload).flag(val); + REINIT_FUNC(cellSpursAddWorkloadWithAttribute).flag(val); + REINIT_FUNC(cellSpursShutdownWorkload).flag(val); + REINIT_FUNC(cellSpursReadyCountStore).flag(val); + REINIT_FUNC(cellSpursSetPriority).flag(val); + REINIT_FUNC(cellSpursTraceInitialize).flag(val); + REINIT_FUNC(cellSpursWaitForWorkloadShutdown).flag(val); + REINIT_FUNC(cellSpursRequestIdleSpu).flag(val); + REINIT_FUNC(cellSpursRemoveWorkload).flag(val); + }); }); -}); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSpurs.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellSpurs.h index f4be6d84d..f843a2f9b 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSpurs.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSpurs.h @@ -14,242 +14,242 @@ struct CellSpursTaskset; // Core return codes. enum CellSpursCoreError : u32 { - CELL_SPURS_CORE_ERROR_AGAIN = 0x80410701, - CELL_SPURS_CORE_ERROR_INVAL = 0x80410702, - CELL_SPURS_CORE_ERROR_NOMEM = 0x80410704, - CELL_SPURS_CORE_ERROR_SRCH = 0x80410705, - CELL_SPURS_CORE_ERROR_PERM = 0x80410709, - CELL_SPURS_CORE_ERROR_BUSY = 0x8041070A, - CELL_SPURS_CORE_ERROR_STAT = 0x8041070F, - CELL_SPURS_CORE_ERROR_ALIGN = 0x80410710, + CELL_SPURS_CORE_ERROR_AGAIN = 0x80410701, + CELL_SPURS_CORE_ERROR_INVAL = 0x80410702, + CELL_SPURS_CORE_ERROR_NOMEM = 0x80410704, + CELL_SPURS_CORE_ERROR_SRCH = 0x80410705, + CELL_SPURS_CORE_ERROR_PERM = 0x80410709, + CELL_SPURS_CORE_ERROR_BUSY = 0x8041070A, + CELL_SPURS_CORE_ERROR_STAT = 0x8041070F, + CELL_SPURS_CORE_ERROR_ALIGN = 0x80410710, CELL_SPURS_CORE_ERROR_NULL_POINTER = 0x80410711, }; // enum CellSpursPolicyModuleError : u32 { - CELL_SPURS_POLICY_MODULE_ERROR_AGAIN = 0x80410801, - CELL_SPURS_POLICY_MODULE_ERROR_INVAL = 0x80410802, - CELL_SPURS_POLICY_MODULE_ERROR_NOSYS = 0x80410803, - CELL_SPURS_POLICY_MODULE_ERROR_NOMEM = 0x80410804, - CELL_SPURS_POLICY_MODULE_ERROR_SRCH = 0x80410805, - CELL_SPURS_POLICY_MODULE_ERROR_NOENT = 0x80410806, - CELL_SPURS_POLICY_MODULE_ERROR_NOEXEC = 0x80410807, - CELL_SPURS_POLICY_MODULE_ERROR_DEADLK = 0x80410808, - CELL_SPURS_POLICY_MODULE_ERROR_PERM = 0x80410809, - CELL_SPURS_POLICY_MODULE_ERROR_BUSY = 0x8041080A, - CELL_SPURS_POLICY_MODULE_ERROR_ABORT = 0x8041080C, - CELL_SPURS_POLICY_MODULE_ERROR_FAULT = 0x8041080D, - CELL_SPURS_POLICY_MODULE_ERROR_CHILD = 0x8041080E, - CELL_SPURS_POLICY_MODULE_ERROR_STAT = 0x8041080F, - CELL_SPURS_POLICY_MODULE_ERROR_ALIGN = 0x80410810, + CELL_SPURS_POLICY_MODULE_ERROR_AGAIN = 0x80410801, + CELL_SPURS_POLICY_MODULE_ERROR_INVAL = 0x80410802, + CELL_SPURS_POLICY_MODULE_ERROR_NOSYS = 0x80410803, + CELL_SPURS_POLICY_MODULE_ERROR_NOMEM = 0x80410804, + CELL_SPURS_POLICY_MODULE_ERROR_SRCH = 0x80410805, + CELL_SPURS_POLICY_MODULE_ERROR_NOENT = 0x80410806, + CELL_SPURS_POLICY_MODULE_ERROR_NOEXEC = 0x80410807, + CELL_SPURS_POLICY_MODULE_ERROR_DEADLK = 0x80410808, + CELL_SPURS_POLICY_MODULE_ERROR_PERM = 0x80410809, + CELL_SPURS_POLICY_MODULE_ERROR_BUSY = 0x8041080A, + CELL_SPURS_POLICY_MODULE_ERROR_ABORT = 0x8041080C, + CELL_SPURS_POLICY_MODULE_ERROR_FAULT = 0x8041080D, + CELL_SPURS_POLICY_MODULE_ERROR_CHILD = 0x8041080E, + CELL_SPURS_POLICY_MODULE_ERROR_STAT = 0x8041080F, + CELL_SPURS_POLICY_MODULE_ERROR_ALIGN = 0x80410810, CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER = 0x80410811, }; // Task return codes. enum CellSpursTaskError : u32 { - CELL_SPURS_TASK_ERROR_AGAIN = 0x80410901, - CELL_SPURS_TASK_ERROR_INVAL = 0x80410902, - CELL_SPURS_TASK_ERROR_NOSYS = 0x80410903, - CELL_SPURS_TASK_ERROR_NOMEM = 0x80410904, - CELL_SPURS_TASK_ERROR_SRCH = 0x80410905, - CELL_SPURS_TASK_ERROR_NOEXEC = 0x80410907, - CELL_SPURS_TASK_ERROR_PERM = 0x80410909, - CELL_SPURS_TASK_ERROR_BUSY = 0x8041090A, - CELL_SPURS_TASK_ERROR_FAULT = 0x8041090D, - CELL_SPURS_TASK_ERROR_ALIGN = 0x80410910, - CELL_SPURS_TASK_ERROR_STAT = 0x8041090F, + CELL_SPURS_TASK_ERROR_AGAIN = 0x80410901, + CELL_SPURS_TASK_ERROR_INVAL = 0x80410902, + CELL_SPURS_TASK_ERROR_NOSYS = 0x80410903, + CELL_SPURS_TASK_ERROR_NOMEM = 0x80410904, + CELL_SPURS_TASK_ERROR_SRCH = 0x80410905, + CELL_SPURS_TASK_ERROR_NOEXEC = 0x80410907, + CELL_SPURS_TASK_ERROR_PERM = 0x80410909, + CELL_SPURS_TASK_ERROR_BUSY = 0x8041090A, + CELL_SPURS_TASK_ERROR_FAULT = 0x8041090D, + CELL_SPURS_TASK_ERROR_ALIGN = 0x80410910, + CELL_SPURS_TASK_ERROR_STAT = 0x8041090F, CELL_SPURS_TASK_ERROR_NULL_POINTER = 0x80410911, - CELL_SPURS_TASK_ERROR_FATAL = 0x80410914, - CELL_SPURS_TASK_ERROR_SHUTDOWN = 0x80410920, + CELL_SPURS_TASK_ERROR_FATAL = 0x80410914, + CELL_SPURS_TASK_ERROR_SHUTDOWN = 0x80410920, }; enum CellSpursJobError : u32 { - CELL_SPURS_JOB_ERROR_AGAIN = 0x80410A01, - CELL_SPURS_JOB_ERROR_INVAL = 0x80410A02, - CELL_SPURS_JOB_ERROR_NOSYS = 0x80410A03, - CELL_SPURS_JOB_ERROR_NOMEM = 0x80410A04, - CELL_SPURS_JOB_ERROR_SRCH = 0x80410A05, - CELL_SPURS_JOB_ERROR_NOENT = 0x80410A06, - CELL_SPURS_JOB_ERROR_NOEXEC = 0x80410A07, - CELL_SPURS_JOB_ERROR_DEADLK = 0x80410A08, - CELL_SPURS_JOB_ERROR_PERM = 0x80410A09, - CELL_SPURS_JOB_ERROR_BUSY = 0x80410A0A, - CELL_SPURS_JOB_ERROR_JOB_DESCRIPTOR = 0x80410A0B, + CELL_SPURS_JOB_ERROR_AGAIN = 0x80410A01, + CELL_SPURS_JOB_ERROR_INVAL = 0x80410A02, + CELL_SPURS_JOB_ERROR_NOSYS = 0x80410A03, + CELL_SPURS_JOB_ERROR_NOMEM = 0x80410A04, + CELL_SPURS_JOB_ERROR_SRCH = 0x80410A05, + CELL_SPURS_JOB_ERROR_NOENT = 0x80410A06, + CELL_SPURS_JOB_ERROR_NOEXEC = 0x80410A07, + CELL_SPURS_JOB_ERROR_DEADLK = 0x80410A08, + CELL_SPURS_JOB_ERROR_PERM = 0x80410A09, + CELL_SPURS_JOB_ERROR_BUSY = 0x80410A0A, + CELL_SPURS_JOB_ERROR_JOB_DESCRIPTOR = 0x80410A0B, CELL_SPURS_JOB_ERROR_JOB_DESCRIPTOR_SIZE = 0x80410A0C, - CELL_SPURS_JOB_ERROR_FAULT = 0x80410A0D, - CELL_SPURS_JOB_ERROR_CHILD = 0x80410A0E, - CELL_SPURS_JOB_ERROR_STAT = 0x80410A0F, - CELL_SPURS_JOB_ERROR_ALIGN = 0x80410A10, - CELL_SPURS_JOB_ERROR_NULL_POINTER = 0x80410A11, - CELL_SPURS_JOB_ERROR_MEMORY_CORRUPTED = 0x80410A12, + CELL_SPURS_JOB_ERROR_FAULT = 0x80410A0D, + CELL_SPURS_JOB_ERROR_CHILD = 0x80410A0E, + CELL_SPURS_JOB_ERROR_STAT = 0x80410A0F, + CELL_SPURS_JOB_ERROR_ALIGN = 0x80410A10, + CELL_SPURS_JOB_ERROR_NULL_POINTER = 0x80410A11, + CELL_SPURS_JOB_ERROR_MEMORY_CORRUPTED = 0x80410A12, - CELL_SPURS_JOB_ERROR_MEMORY_SIZE = 0x80410A17, - CELL_SPURS_JOB_ERROR_UNKNOWN_COMMAND = 0x80410A18, - CELL_SPURS_JOB_ERROR_JOBLIST_ALIGNMENT = 0x80410A19, - CELL_SPURS_JOB_ERROR_JOB_ALIGNMENT = 0x80410A1a, - CELL_SPURS_JOB_ERROR_CALL_OVERFLOW = 0x80410A1b, - CELL_SPURS_JOB_ERROR_ABORT = 0x80410A1c, - CELL_SPURS_JOB_ERROR_DMALIST_ELEMENT = 0x80410A1d, - CELL_SPURS_JOB_ERROR_NUM_CACHE = 0x80410A1e, - CELL_SPURS_JOB_ERROR_INVALID_BINARY = 0x80410A1f, + CELL_SPURS_JOB_ERROR_MEMORY_SIZE = 0x80410A17, + CELL_SPURS_JOB_ERROR_UNKNOWN_COMMAND = 0x80410A18, + CELL_SPURS_JOB_ERROR_JOBLIST_ALIGNMENT = 0x80410A19, + CELL_SPURS_JOB_ERROR_JOB_ALIGNMENT = 0x80410A1a, + CELL_SPURS_JOB_ERROR_CALL_OVERFLOW = 0x80410A1b, + CELL_SPURS_JOB_ERROR_ABORT = 0x80410A1c, + CELL_SPURS_JOB_ERROR_DMALIST_ELEMENT = 0x80410A1d, + CELL_SPURS_JOB_ERROR_NUM_CACHE = 0x80410A1e, + CELL_SPURS_JOB_ERROR_INVALID_BINARY = 0x80410A1f, }; // SPURS defines. enum SPURSKernelInterfaces : u32 { - CELL_SPURS_MAX_SPU = 8, - CELL_SPURS_MAX_WORKLOAD = 16, - CELL_SPURS_MAX_WORKLOAD2 = 32, - CELL_SPURS_SYS_SERVICE_WORKLOAD_ID = 32, - CELL_SPURS_MAX_PRIORITY = 16, - CELL_SPURS_NAME_MAX_LENGTH = 15, - CELL_SPURS_SIZE = 4096, - CELL_SPURS_SIZE2 = 8192, - CELL_SPURS_INTERRUPT_VECTOR = 0x0, - CELL_SPURS_LOCK_LINE = 0x80, - CELL_SPURS_KERNEL_DMA_TAG_ID = 31, - CELL_SPURS_KERNEL1_ENTRY_ADDR = 0x818, - CELL_SPURS_KERNEL2_ENTRY_ADDR = 0x848, - CELL_SPURS_KERNEL1_EXIT_ADDR = 0x808, - CELL_SPURS_KERNEL2_EXIT_ADDR = 0x838, + CELL_SPURS_MAX_SPU = 8, + CELL_SPURS_MAX_WORKLOAD = 16, + CELL_SPURS_MAX_WORKLOAD2 = 32, + CELL_SPURS_SYS_SERVICE_WORKLOAD_ID = 32, + CELL_SPURS_MAX_PRIORITY = 16, + CELL_SPURS_NAME_MAX_LENGTH = 15, + CELL_SPURS_SIZE = 4096, + CELL_SPURS_SIZE2 = 8192, + CELL_SPURS_INTERRUPT_VECTOR = 0x0, + CELL_SPURS_LOCK_LINE = 0x80, + CELL_SPURS_KERNEL_DMA_TAG_ID = 31, + CELL_SPURS_KERNEL1_ENTRY_ADDR = 0x818, + CELL_SPURS_KERNEL2_ENTRY_ADDR = 0x848, + CELL_SPURS_KERNEL1_EXIT_ADDR = 0x808, + CELL_SPURS_KERNEL2_EXIT_ADDR = 0x838, CELL_SPURS_KERNEL1_SELECT_WORKLOAD_ADDR = 0x290, CELL_SPURS_KERNEL2_SELECT_WORKLOAD_ADDR = 0x290, }; enum RangeofEventQueuePortNumbers { - CELL_SPURS_STATIC_PORT_RANGE_BOTTOM = 15, - CELL_SPURS_DYNAMIC_PORT_RANGE_TOP = 16, + CELL_SPURS_STATIC_PORT_RANGE_BOTTOM = 15, + CELL_SPURS_DYNAMIC_PORT_RANGE_TOP = 16, CELL_SPURS_DYNAMIC_PORT_RANGE_BOTTOM = 63, }; enum SpursAttrFlags : u32 { - SAF_NONE = 0x00000000, - SAF_EXIT_IF_NO_WORK = 0x00000001, - SAF_UNKNOWN_FLAG_30 = 0x00000002, - SAF_SECOND_VERSION = 0x00000004, - SAF_UNKNOWN_FLAG_9 = 0x00400000, - SAF_UNKNOWN_FLAG_8 = 0x00800000, - SAF_UNKNOWN_FLAG_7 = 0x01000000, - SAF_SYSTEM_WORKLOAD_ENABLED = 0x02000000, - SAF_SPU_PRINTF_ENABLED = 0x10000000, + SAF_NONE = 0x00000000, + SAF_EXIT_IF_NO_WORK = 0x00000001, + SAF_UNKNOWN_FLAG_30 = 0x00000002, + SAF_SECOND_VERSION = 0x00000004, + SAF_UNKNOWN_FLAG_9 = 0x00400000, + SAF_UNKNOWN_FLAG_8 = 0x00800000, + SAF_UNKNOWN_FLAG_7 = 0x01000000, + SAF_SYSTEM_WORKLOAD_ENABLED = 0x02000000, + SAF_SPU_PRINTF_ENABLED = 0x10000000, SAF_SPU_TGT_EXCLUSIVE_NON_CONTEXT = 0x20000000, - SAF_SPU_MEMORY_CONTAINER_SET = 0x40000000, - SAF_UNKNOWN_FLAG_0 = 0x80000000, + SAF_SPU_MEMORY_CONTAINER_SET = 0x40000000, + SAF_UNKNOWN_FLAG_0 = 0x80000000, }; enum SpursFlags1 : u8 { - SF1_NONE = 0x00, - SF1_32_WORKLOADS = 0x40, + SF1_NONE = 0x00, + SF1_32_WORKLOADS = 0x40, SF1_EXIT_IF_NO_WORK = 0x80, }; enum SpursWorkloadState : u8 { // Workload states - SPURS_WKL_STATE_NON_EXISTENT = 0, - SPURS_WKL_STATE_PREPARING = 1, - SPURS_WKL_STATE_RUNNABLE = 2, - SPURS_WKL_STATE_SHUTTING_DOWN = 3, - SPURS_WKL_STATE_REMOVABLE = 4, - SPURS_WKL_STATE_INVALID = 5, + SPURS_WKL_STATE_NON_EXISTENT = 0, + SPURS_WKL_STATE_PREPARING = 1, + SPURS_WKL_STATE_RUNNABLE = 2, + SPURS_WKL_STATE_SHUTTING_DOWN = 3, + SPURS_WKL_STATE_REMOVABLE = 4, + SPURS_WKL_STATE_INVALID = 5, }; enum SpursImgAddrConstants : u32 { // Image addresses SPURS_IMG_ADDR_SYS_SRV_WORKLOAD = 0x100, - SPURS_IMG_ADDR_TASKSET_PM = 0x200, + SPURS_IMG_ADDR_TASKSET_PM = 0x200, }; enum SpursWorkloadGUIDs : u64 { // GUID - SPURS_GUID_SYS_WKL = 0x1BB841BF38F89D33ull, + SPURS_GUID_SYS_WKL = 0x1BB841BF38F89D33ull, SPURS_GUID_TASKSET_PM = 0x836E915B2E654143ull, }; enum CellSpursModulePollStatus { - CELL_SPURS_MODULE_POLL_STATUS_READYCOUNT = 1, - CELL_SPURS_MODULE_POLL_STATUS_SIGNAL = 2, - CELL_SPURS_MODULE_POLL_STATUS_FLAG = 4 + CELL_SPURS_MODULE_POLL_STATUS_READYCOUNT = 1, + CELL_SPURS_MODULE_POLL_STATUS_SIGNAL = 2, + CELL_SPURS_MODULE_POLL_STATUS_FLAG = 4 }; enum SpursTraceConstants { // Trace tag types - CELL_SPURS_TRACE_TAG_KERNEL = 0x20, - CELL_SPURS_TRACE_TAG_SERVICE = 0x21, - CELL_SPURS_TRACE_TAG_TASK = 0x22, - CELL_SPURS_TRACE_TAG_JOB = 0x23, - CELL_SPURS_TRACE_TAG_OVIS = 0x24, - CELL_SPURS_TRACE_TAG_LOAD = 0x2a, - CELL_SPURS_TRACE_TAG_MAP = 0x2b, - CELL_SPURS_TRACE_TAG_START = 0x2c, - CELL_SPURS_TRACE_TAG_STOP = 0x2d, - CELL_SPURS_TRACE_TAG_USER = 0x2e, - CELL_SPURS_TRACE_TAG_GUID = 0x2f, + CELL_SPURS_TRACE_TAG_KERNEL = 0x20, + CELL_SPURS_TRACE_TAG_SERVICE = 0x21, + CELL_SPURS_TRACE_TAG_TASK = 0x22, + CELL_SPURS_TRACE_TAG_JOB = 0x23, + CELL_SPURS_TRACE_TAG_OVIS = 0x24, + CELL_SPURS_TRACE_TAG_LOAD = 0x2a, + CELL_SPURS_TRACE_TAG_MAP = 0x2b, + CELL_SPURS_TRACE_TAG_START = 0x2c, + CELL_SPURS_TRACE_TAG_STOP = 0x2d, + CELL_SPURS_TRACE_TAG_USER = 0x2e, + CELL_SPURS_TRACE_TAG_GUID = 0x2f, // Service incident - CELL_SPURS_TRACE_SERVICE_INIT = 0x01, - CELL_SPURS_TRACE_SERVICE_WAIT = 0x02, - CELL_SPURS_TRACE_SERVICE_EXIT = 0x03, + CELL_SPURS_TRACE_SERVICE_INIT = 0x01, + CELL_SPURS_TRACE_SERVICE_WAIT = 0x02, + CELL_SPURS_TRACE_SERVICE_EXIT = 0x03, // Task incident - CELL_SPURS_TRACE_TASK_DISPATCH = 0x01, - CELL_SPURS_TRACE_TASK_YIELD = 0x03, - CELL_SPURS_TRACE_TASK_WAIT = 0x04, - CELL_SPURS_TRACE_TASK_EXIT = 0x05, + CELL_SPURS_TRACE_TASK_DISPATCH = 0x01, + CELL_SPURS_TRACE_TASK_YIELD = 0x03, + CELL_SPURS_TRACE_TASK_WAIT = 0x04, + CELL_SPURS_TRACE_TASK_EXIT = 0x05, // Trace mode flags - CELL_SPURS_TRACE_MODE_FLAG_WRAP_BUFFER = 0x1, - CELL_SPURS_TRACE_MODE_FLAG_SYNCHRONOUS_START_STOP = 0x2, - CELL_SPURS_TRACE_MODE_FLAG_MASK = 0x3, + CELL_SPURS_TRACE_MODE_FLAG_WRAP_BUFFER = 0x1, + CELL_SPURS_TRACE_MODE_FLAG_SYNCHRONOUS_START_STOP = 0x2, + CELL_SPURS_TRACE_MODE_FLAG_MASK = 0x3, }; // SPURS task constants enum SpursTaskConstants { - CELL_SPURS_MAX_TASK = 128, - CELL_SPURS_TASK_TOP = 0x3000, - CELL_SPURS_TASK_BOTTOM = 0x40000, - CELL_SPURS_MAX_TASK_NAME_LENGTH = 32, - CELL_SPURS_TASK_ATTRIBUTE_REVISION = 1, - CELL_SPURS_TASKSET_ATTRIBUTE_REVISION = 1, - CELL_SPURS_TASK_EXECUTION_CONTEXT_SIZE = 1024, - CELL_SPURS_TASKSET_PM_ENTRY_ADDR = 0xA00, - CELL_SPURS_TASKSET_PM_SYSCALL_ADDR = 0xA70, + CELL_SPURS_MAX_TASK = 128, + CELL_SPURS_TASK_TOP = 0x3000, + CELL_SPURS_TASK_BOTTOM = 0x40000, + CELL_SPURS_MAX_TASK_NAME_LENGTH = 32, + CELL_SPURS_TASK_ATTRIBUTE_REVISION = 1, + CELL_SPURS_TASKSET_ATTRIBUTE_REVISION = 1, + CELL_SPURS_TASK_EXECUTION_CONTEXT_SIZE = 1024, + CELL_SPURS_TASKSET_PM_ENTRY_ADDR = 0xA00, + CELL_SPURS_TASKSET_PM_SYSCALL_ADDR = 0xA70, // Task syscall numbers - CELL_SPURS_TASK_SYSCALL_EXIT = 0, - CELL_SPURS_TASK_SYSCALL_YIELD = 1, - CELL_SPURS_TASK_SYSCALL_WAIT_SIGNAL = 2, - CELL_SPURS_TASK_SYSCALL_POLL = 3, - CELL_SPURS_TASK_SYSCALL_RECV_WKL_FLAG = 4, + CELL_SPURS_TASK_SYSCALL_EXIT = 0, + CELL_SPURS_TASK_SYSCALL_YIELD = 1, + CELL_SPURS_TASK_SYSCALL_WAIT_SIGNAL = 2, + CELL_SPURS_TASK_SYSCALL_POLL = 3, + CELL_SPURS_TASK_SYSCALL_RECV_WKL_FLAG = 4, // Task poll status - CELL_SPURS_TASK_POLL_FOUND_TASK = 1, - CELL_SPURS_TASK_POLL_FOUND_WORKLOAD = 2, + CELL_SPURS_TASK_POLL_FOUND_TASK = 1, + CELL_SPURS_TASK_POLL_FOUND_WORKLOAD = 2, }; enum CellSpursEventFlagWaitMode { - CELL_SPURS_EVENT_FLAG_OR = 0, - CELL_SPURS_EVENT_FLAG_AND = 1, + CELL_SPURS_EVENT_FLAG_OR = 0, + CELL_SPURS_EVENT_FLAG_AND = 1, CELL_SPURS_EVENT_FLAG_WAIT_MODE_LAST = CELL_SPURS_EVENT_FLAG_AND, }; enum CellSpursEventFlagClearMode { - CELL_SPURS_EVENT_FLAG_CLEAR_AUTO = 0, + CELL_SPURS_EVENT_FLAG_CLEAR_AUTO = 0, CELL_SPURS_EVENT_FLAG_CLEAR_MANUAL = 1, - CELL_SPURS_EVENT_FLAG_CLEAR_LAST = CELL_SPURS_EVENT_FLAG_CLEAR_MANUAL, + CELL_SPURS_EVENT_FLAG_CLEAR_LAST = CELL_SPURS_EVENT_FLAG_CLEAR_MANUAL, }; enum CellSpursEventFlagDirection @@ -263,22 +263,22 @@ enum CellSpursEventFlagDirection enum CellSpursJobOpcode : u64 { - CELL_SPURS_JOB_OPCODE_NOP = 0, - CELL_SPURS_JOB_OPCODE_RESET_PC = 1, - CELL_SPURS_JOB_OPCODE_SYNC = 2 | (0 << 3), - CELL_SPURS_JOB_OPCODE_LWSYNC = 2 | (2 << 3), - CELL_SPURS_JOB_OPCODE_SYNC_LABEL = 2 | (1 << 3), + CELL_SPURS_JOB_OPCODE_NOP = 0, + CELL_SPURS_JOB_OPCODE_RESET_PC = 1, + CELL_SPURS_JOB_OPCODE_SYNC = 2 | (0 << 3), + CELL_SPURS_JOB_OPCODE_LWSYNC = 2 | (2 << 3), + CELL_SPURS_JOB_OPCODE_SYNC_LABEL = 2 | (1 << 3), CELL_SPURS_JOB_OPCODE_LWSYNC_LABEL = 2 | (3 << 3), - CELL_SPURS_JOB_OPCODE_NEXT = 3, - CELL_SPURS_JOB_OPCODE_CALL = 4, - CELL_SPURS_JOB_OPCODE_FLUSH = 5, - CELL_SPURS_JOB_OPCODE_JOBLIST = 6, - CELL_SPURS_JOB_OPCODE_ABORT = 7 | (0 << 3), - CELL_SPURS_JOB_OPCODE_GUARD = 7 | (1 << 3), - CELL_SPURS_JOB_OPCODE_SET_LABEL = 7 | (2 << 3), - CELL_SPURS_JOB_OPCODE_RET = 7 | (14 << 3), - CELL_SPURS_JOB_OPCODE_END = 7 | (15 << 3), - CELL_SPURS_JOB_OPCODE_JTS = 0x800000000ull | CELL_SPURS_JOB_OPCODE_LWSYNC, + CELL_SPURS_JOB_OPCODE_NEXT = 3, + CELL_SPURS_JOB_OPCODE_CALL = 4, + CELL_SPURS_JOB_OPCODE_FLUSH = 5, + CELL_SPURS_JOB_OPCODE_JOBLIST = 6, + CELL_SPURS_JOB_OPCODE_ABORT = 7 | (0 << 3), + CELL_SPURS_JOB_OPCODE_GUARD = 7 | (1 << 3), + CELL_SPURS_JOB_OPCODE_SET_LABEL = 7 | (2 << 3), + CELL_SPURS_JOB_OPCODE_RET = 7 | (14 << 3), + CELL_SPURS_JOB_OPCODE_END = 7 | (15 << 3), + CELL_SPURS_JOB_OPCODE_JTS = 0x800000000ull | CELL_SPURS_JOB_OPCODE_LWSYNC, }; enum CellSpursJobChainRevision : u32 @@ -292,7 +292,7 @@ enum CellSpursJobChainRevision : u32 // Event flag constants enum SpursEventFlagConstants { - CELL_SPURS_EVENT_FLAG_MAX_WAIT_SLOTS = 16, + CELL_SPURS_EVENT_FLAG_MAX_WAIT_SLOTS = 16, CELL_SPURS_EVENT_FLAG_INVALID_SPU_PORT = 0xFF, }; @@ -356,10 +356,10 @@ using CellSpursShutdownCompletionEventHook = void(vm::ptr spurs, u32 struct alignas(16) CellSpursTraceInfo { - be_t spuThread[8]; // 0x00 - be_t count[8]; // 0x20 - be_t spuThreadGroup; // 0x40 - be_t numSpus; // 0x44 + be_t spuThread[8]; // 0x00 + be_t count[8]; // 0x20 + be_t spuThreadGroup; // 0x40 + be_t numSpus; // 0x44 u8 padding[56]; }; @@ -439,8 +439,7 @@ struct alignas(16) CellSpursTracePacket be_t user; be_t guid; be_t raw; - } - data; + } data; }; CHECK_SIZE_ALIGN(CellSpursTracePacket, 16, 16); @@ -448,8 +447,7 @@ CHECK_SIZE_ALIGN(CellSpursTracePacket, 16, 16); struct CellSpursJobChain; struct CellSpursExceptionInfo; -using CellSpursJobChainExceptionEventHandler = void(vm::ptr spurs, vm::ptr jobChain, vm::cptr info - , vm::cptr eaJobBinary, u32 lsAddrJobBinary, vm::ptr arg); +using CellSpursJobChainExceptionEventHandler = void(vm::ptr spurs, vm::ptr jobChain, vm::cptr info, vm::cptr eaJobBinary, u32 lsAddrJobBinary, vm::ptr arg); struct alignas(128) CellSpursJobChain { @@ -486,68 +484,68 @@ struct alignas(128) CellSpursJobChain struct alignas(128) CellSpursJobChain_x00 { - vm::bcptr pc; // 0x00 - vm::bcptr linkRegister[3]; // 0x08 - u8 unk0[0x3]; // 0x20 - b8 isHalted; // 0x23 - b8 autoReadyCount; // 0x24 - u8 unk1[0x3]; // 0x25 - u8 initSpuCount; // 0x28 - u8 unk5; // 0x29 - u8 tag1; // 0x2A - u8 tag2; // 0x2B - u8 val2C; // 0x2C - u8 jmVer; // 0x2D - u8 val2E; // 0x2E - u8 val2F; // 0x2F - be_t urgentCmds[4]; // 0x30 - u8 unk2[0x20]; // 0x50 - be_t maxGrabbedJob; // 0x70 - be_t sizeJobDescriptor; // 0x72 - be_t workloadId; // 0x74 - vm::bptr spurs; // 0x78 + vm::bcptr pc; // 0x00 + vm::bcptr linkRegister[3]; // 0x08 + u8 unk0[0x3]; // 0x20 + b8 isHalted; // 0x23 + b8 autoReadyCount; // 0x24 + u8 unk1[0x3]; // 0x25 + u8 initSpuCount; // 0x28 + u8 unk5; // 0x29 + u8 tag1; // 0x2A + u8 tag2; // 0x2B + u8 val2C; // 0x2C + u8 jmVer; // 0x2D + u8 val2E; // 0x2E + u8 val2F; // 0x2F + be_t urgentCmds[4]; // 0x30 + u8 unk2[0x20]; // 0x50 + be_t maxGrabbedJob; // 0x70 + be_t sizeJobDescriptor; // 0x72 + be_t workloadId; // 0x74 + vm::bptr spurs; // 0x78 }; struct CellSpursJobChainInfo { - be_t urgentCommandSlot[4]; // 0x00 - vm::bcptr programCounter; // 0x20 - vm::bcptr linkRegister[3]; // 0x24 - vm::bcptr cause; // 0x30 - be_t statusCode; // 0x34 - be_t maxSizeJobDescriptor; // 0x38 - be_t idWorkload; // 0x3C - b8 autoReadyCount; // 0x40 - b8 isHalted; // 0x41 - b8 isFixedMemAlloc; // 0x42 - u8 padding8; // 0x43 - u16 maxGrabbedJob; // 0x44 - u16 padding16; // 0x46 - vm::bcptr name; // 0x48 - vm::bptr exceptionEventHandler; // 0x4C - vm::bptr exceptionEventHandlerArgument; // 0x50 + be_t urgentCommandSlot[4]; // 0x00 + vm::bcptr programCounter; // 0x20 + vm::bcptr linkRegister[3]; // 0x24 + vm::bcptr cause; // 0x30 + be_t statusCode; // 0x34 + be_t maxSizeJobDescriptor; // 0x38 + be_t idWorkload; // 0x3C + b8 autoReadyCount; // 0x40 + b8 isHalted; // 0x41 + b8 isFixedMemAlloc; // 0x42 + u8 padding8; // 0x43 + u16 maxGrabbedJob; // 0x44 + u16 padding16; // 0x46 + vm::bcptr name; // 0x48 + vm::bptr exceptionEventHandler; // 0x4C + vm::bptr exceptionEventHandlerArgument; // 0x50 }; struct alignas(8) CellSpursJobChainAttribute { - be_t jmVer; // 0x00 - be_t sdkVer; // 0x04 - vm::bcptr jobChainEntry; // 0x08 - be_t sizeJobDescriptor; // 0x0C - be_t maxGrabbedJob; // 0x0E - u8 priorities[8]; // 0x10 - be_t maxContention; // 0x18 - b8 autoSpuCount; // 0x1C - u8 padding[3]; // 0x1D - be_t tag1; // 0x20 - be_t tag2; // 0x24 - b8 isFixedMemAlloc; // 0x28 - u8 padding1[3]; // 0x29 - be_t maxSizeJobDescriptor; // 0x2C - be_t initSpuCount; // 0x30 - be_t haltOnError; // 0x34 - vm::bcptr name; // 0x38 - b8 jobMemoryCheck; // 0x3C + be_t jmVer; // 0x00 + be_t sdkVer; // 0x04 + vm::bcptr jobChainEntry; // 0x08 + be_t sizeJobDescriptor; // 0x0C + be_t maxGrabbedJob; // 0x0E + u8 priorities[8]; // 0x10 + be_t maxContention; // 0x18 + b8 autoSpuCount; // 0x1C + u8 padding[3]; // 0x1D + be_t tag1; // 0x20 + be_t tag2; // 0x24 + b8 isFixedMemAlloc; // 0x28 + u8 padding1[3]; // 0x29 + be_t maxSizeJobDescriptor; // 0x2C + be_t initSpuCount; // 0x30 + be_t haltOnError; // 0x34 + vm::bcptr name; // 0x38 + b8 jobMemoryCheck; // 0x3C }; struct CellSpursWorkloadInfo @@ -575,11 +573,11 @@ struct alignas(128) CellSpursJobGuard be_t ncount1; // 0x04 vm::bptr jobChain; // 0x0C be_t unk0; - be_t requestSpuCount; // 0x10 + be_t requestSpuCount; // 0x10 be_t unk1[3]; - be_t autoReset; // 0x20 + be_t autoReset; // 0x20 be_t unk2[3]; - be_t zero; // 0x30 + be_t zero; // 0x30 u8 unk3[0x80 - 0x34]; }; @@ -591,11 +589,11 @@ struct alignas(128) CellSpursJobGuard_x00 be_t ncount1; // 0x04 vm::bptr jobChain; // 0x0C be_t unk0; - be_t requestSpuCount; // 0x10 + be_t requestSpuCount; // 0x10 be_t unk1[3]; - be_t autoReset; // 0x20 + be_t autoReset; // 0x20 be_t unk2[3]; - be_t zero; // 0x30 + be_t zero; // 0x30 u8 unk3[0x80 - 0x34]; }; @@ -606,12 +604,12 @@ struct alignas(128) CellSpurs { struct _sub_str1 { - u8 unk0[0x20]; // 0x00 - SPU exception handler 0x08 - SPU exception handler args - be_t sem; // 0x20 - atomic_be_t x28; // 0x28 - be_t x2C; // 0x2C + u8 unk0[0x20]; // 0x00 - SPU exception handler 0x08 - SPU exception handler args + be_t sem; // 0x20 + atomic_be_t x28; // 0x28 + be_t x2C; // 0x2C vm::bptr hook; // 0x30 - vm::bptr hookArg; // 0x38 + vm::bptr hookArg; // 0x38 u8 unk2[0x40]; }; @@ -630,29 +628,29 @@ struct alignas(128) CellSpurs struct EventPortMux { - atomic_be_t reqPending; // 0x00 - be_t spuPort; // 0x04 - be_t x08; // 0x08 - be_t x0C; // 0x0C - be_t eventPort; // 0x10 + atomic_be_t reqPending; // 0x00 + be_t spuPort; // 0x04 + be_t x08; // 0x08 + be_t x0C; // 0x0C + be_t eventPort; // 0x10 atomic_t> handlerList; // 0x18 - u8 x20[0x80 - 0x20]; // 0x20 + u8 x20[0x80 - 0x20]; // 0x20 }; CHECK_SIZE(EventPortMux, 128); struct WorkloadInfo { - vm::bcptr addr; // 0x00 Address of the executable - be_t arg; // 0x08 Argument - be_t size; // 0x10 Size of the executable - atomic_t uniqueId; // 0x14 Unique id of the workload. It is the same for all workloads with the same addr. + vm::bcptr addr; // 0x00 Address of the executable + be_t arg; // 0x08 Argument + be_t size; // 0x10 Size of the executable + atomic_t uniqueId; // 0x14 Unique id of the workload. It is the same for all workloads with the same addr. u8 pad[3]; union { atomic_t prio64; - u8 priority[8]; // 0x18 Priority of the workload on each SPU + u8 priority[8]; // 0x18 Priority of the workload on each SPU }; }; @@ -664,99 +662,99 @@ struct alignas(128) CellSpurs vm::bcptr nameInstance; }; - atomic_t wklReadyCount1[0x10]; // 0x00 Number of SPUs requested by each workload (0..15 wids). - atomic_t wklIdleSpuCountOrReadyCount2[0x10]; // 0x10 SPURS1: Number of idle SPUs requested by each workload (0..15 wids). SPURS2: Number of SPUs requested by each workload (16..31 wids). - u8 wklCurrentContention[0x10]; // 0x20 Number of SPUs used by each workload. SPURS1: index = wid. SPURS2: packed 4-bit data, index = wid % 16, internal index = wid / 16. - u8 wklPendingContention[0x10]; // 0x30 Number of SPUs that are pending to context switch to the workload. SPURS1: index = wid. SPURS2: packed 4-bit data, index = wid % 16, internal index = wid / 16. - u8 wklMinContention[0x10]; // 0x40 Min SPUs required for each workload. SPURS1: index = wid. SPURS2: Unused. - atomic_t wklMaxContention[0x10]; // 0x50 Max SPUs that may be allocated to each workload. SPURS1: index = wid. SPURS2: packed 4-bit data, index = wid % 16, internal index = wid / 16. - CellSpursWorkloadFlag wklFlag; // 0x60 - atomic_be_t wklSignal1; // 0x70 Bitset for 0..15 wids - atomic_t sysSrvMessage; // 0x72 - u8 spuIdling; // 0x73 - u8 flags1; // 0x74 Type is SpursFlags1 - u8 sysSrvTraceControl; // 0x75 - u8 nSpus; // 0x76 - atomic_t wklFlagReceiver; // 0x77 - atomic_be_t wklSignal2; // 0x78 Bitset for 16..32 wids - u8 x7A[6]; // 0x7A - atomic_t wklState1[0x10]; // 0x80 - u8 wklStatus1[0x10]; // 0x90 - atomic_t wklEvent1[0x10]; // 0xA0 - atomic_be_t wklEnabled; // 0xB0 - atomic_be_t wklMskB; // 0xB4 - System service - Available module id - u32 xB8; // 0xB8 - u8 sysSrvExitBarrier; // 0xBC - atomic_t sysSrvMsgUpdateWorkload; // 0xBD - u8 xBE; // 0xBE - u8 sysSrvMsgTerminate; // 0xBF - u8 sysSrvPreemptWklId[8]; // 0xC0 Id of the workload that was preempted by the system workload on each SPU - u8 sysSrvOnSpu; // 0xC8 - u8 spuPort; // 0xC9 - u8 xCA; // 0xCA - u8 xCB; // 0xCB + atomic_t wklReadyCount1[0x10]; // 0x00 Number of SPUs requested by each workload (0..15 wids). + atomic_t wklIdleSpuCountOrReadyCount2[0x10]; // 0x10 SPURS1: Number of idle SPUs requested by each workload (0..15 wids). SPURS2: Number of SPUs requested by each workload (16..31 wids). + u8 wklCurrentContention[0x10]; // 0x20 Number of SPUs used by each workload. SPURS1: index = wid. SPURS2: packed 4-bit data, index = wid % 16, internal index = wid / 16. + u8 wklPendingContention[0x10]; // 0x30 Number of SPUs that are pending to context switch to the workload. SPURS1: index = wid. SPURS2: packed 4-bit data, index = wid % 16, internal index = wid / 16. + u8 wklMinContention[0x10]; // 0x40 Min SPUs required for each workload. SPURS1: index = wid. SPURS2: Unused. + atomic_t wklMaxContention[0x10]; // 0x50 Max SPUs that may be allocated to each workload. SPURS1: index = wid. SPURS2: packed 4-bit data, index = wid % 16, internal index = wid / 16. + CellSpursWorkloadFlag wklFlag; // 0x60 + atomic_be_t wklSignal1; // 0x70 Bitset for 0..15 wids + atomic_t sysSrvMessage; // 0x72 + u8 spuIdling; // 0x73 + u8 flags1; // 0x74 Type is SpursFlags1 + u8 sysSrvTraceControl; // 0x75 + u8 nSpus; // 0x76 + atomic_t wklFlagReceiver; // 0x77 + atomic_be_t wklSignal2; // 0x78 Bitset for 16..32 wids + u8 x7A[6]; // 0x7A + atomic_t wklState1[0x10]; // 0x80 + u8 wklStatus1[0x10]; // 0x90 + atomic_t wklEvent1[0x10]; // 0xA0 + atomic_be_t wklEnabled; // 0xB0 + atomic_be_t wklMskB; // 0xB4 - System service - Available module id + u32 xB8; // 0xB8 + u8 sysSrvExitBarrier; // 0xBC + atomic_t sysSrvMsgUpdateWorkload; // 0xBD + u8 xBE; // 0xBE + u8 sysSrvMsgTerminate; // 0xBF + u8 sysSrvPreemptWklId[8]; // 0xC0 Id of the workload that was preempted by the system workload on each SPU + u8 sysSrvOnSpu; // 0xC8 + u8 spuPort; // 0xC9 + u8 xCA; // 0xCA + u8 xCB; // 0xCB struct SrvTraceSyncVar { - u8 sysSrvTraceInitialised; // 0xCC - u8 sysSrvNotifyUpdateTraceComplete; // 0xCD - u8 sysSrvMsgUpdateTrace; // 0xCE + u8 sysSrvTraceInitialised; // 0xCC + u8 sysSrvNotifyUpdateTraceComplete; // 0xCD + u8 sysSrvMsgUpdateTrace; // 0xCE u8 xCF; }; - atomic_t sysSrvTrace; // 0xCC + atomic_t sysSrvTrace; // 0xCC - atomic_t wklState2[0x10]; // 0xD0 - u8 wklStatus2[0x10]; // 0xE0 - atomic_t wklEvent2[0x10]; // 0xF0 - _sub_str1 wklF1[0x10]; // 0x100 - vm::bptr traceBuffer; // 0x900 - be_t traceStartIndex[6]; // 0x908 - u8 unknown7[0x948 - 0x920]; // 0x920 - be_t traceDataSize; // 0x948 - be_t traceMode; // 0x950 - u8 unknown8[0x980 - 0x954]; // 0x954 - be_t semPrv; // 0x980 - be_t unk11; // 0x988 - be_t unk12; // 0x98C - be_t unk13; // 0x990 + atomic_t wklState2[0x10]; // 0xD0 + u8 wklStatus2[0x10]; // 0xE0 + atomic_t wklEvent2[0x10]; // 0xF0 + _sub_str1 wklF1[0x10]; // 0x100 + vm::bptr traceBuffer; // 0x900 + be_t traceStartIndex[6]; // 0x908 + u8 unknown7[0x948 - 0x920]; // 0x920 + be_t traceDataSize; // 0x948 + be_t traceMode; // 0x950 + u8 unknown8[0x980 - 0x954]; // 0x954 + be_t semPrv; // 0x980 + be_t unk11; // 0x988 + be_t unk12; // 0x98C + be_t unk13; // 0x990 u8 unknown4[0xB00 - 0x998]; - WorkloadInfo wklInfo1[0x10]; // 0xB00 - WorkloadInfo wklInfoSysSrv; // 0xD00 - be_t ppu0; // 0xD20 Handler thread - be_t ppu1; // 0xD28 - be_t spuTG; // 0xD30 SPU thread group - be_t spus[8]; // 0xD34 + WorkloadInfo wklInfo1[0x10]; // 0xB00 + WorkloadInfo wklInfoSysSrv; // 0xD00 + be_t ppu0; // 0xD20 Handler thread + be_t ppu1; // 0xD28 + be_t spuTG; // 0xD30 SPU thread group + be_t spus[8]; // 0xD34 u8 unknown3[0xD5C - 0xD54]; - be_t eventQueue; // 0xD5C - be_t eventPort; // 0xD60 - atomic_t handlerDirty; // 0xD64 - atomic_t handlerWaiting; // 0xD65 - atomic_t handlerExiting; // 0xD66 - u8 xD67; // 0xD67 - atomic_be_t enableEH; // 0xD68 - be_t exception; // 0xD6C - sys_spu_image spuImg; // 0xD70 - be_t flags; // 0xD80 - be_t spuPriority; // 0xD84 - be_t ppuPriority; // 0xD88 - char prefix[0x0f]; // 0xD8C - u8 prefixSize; // 0xD9B - be_t unk5; // 0xD9C - be_t revision; // 0xDA0 - be_t sdkVersion; // 0xDA4 - atomic_be_t spuPortBits; // 0xDA8 - sys_lwmutex_t mutex; // 0xDB0 - sys_lwcond_t cond; // 0xDC8 + be_t eventQueue; // 0xD5C + be_t eventPort; // 0xD60 + atomic_t handlerDirty; // 0xD64 + atomic_t handlerWaiting; // 0xD65 + atomic_t handlerExiting; // 0xD66 + u8 xD67; // 0xD67 + atomic_be_t enableEH; // 0xD68 + be_t exception; // 0xD6C + sys_spu_image spuImg; // 0xD70 + be_t flags; // 0xD80 + be_t spuPriority; // 0xD84 + be_t ppuPriority; // 0xD88 + char prefix[0x0f]; // 0xD8C + u8 prefixSize; // 0xD9B + be_t unk5; // 0xD9C + be_t revision; // 0xDA0 + be_t sdkVersion; // 0xDA4 + atomic_be_t spuPortBits; // 0xDA8 + sys_lwmutex_t mutex; // 0xDB0 + sys_lwcond_t cond; // 0xDC8 u8 unknown9[0xE00 - 0xDD0]; - _sub_str4 wklH1[0x10]; // 0xE00 - EventPortMux eventPortMux; // 0xF00 - atomic_be_t globalSpuExceptionHandler; // 0xF80 - be_t globalSpuExceptionHandlerArgs; // 0xF88 + _sub_str4 wklH1[0x10]; // 0xE00 + EventPortMux eventPortMux; // 0xF00 + atomic_be_t globalSpuExceptionHandler; // 0xF80 + be_t globalSpuExceptionHandlerArgs; // 0xF88 u8 unknown6[0x1000 - 0xF90]; - WorkloadInfo wklInfo2[0x10]; // 0x1000 - _sub_str1 wklF2[0x10]; // 0x1200 - _sub_str4 wklH2[0x10]; // 0x1A00 + WorkloadInfo wklInfo2[0x10]; // 0x1000 + _sub_str1 wklF2[0x10]; // 0x1200 + _sub_str4 wklH2[0x10]; // 0x1A00 u8 unknown_[0x2000 - 0x1B00]; u32 max_workloads() const @@ -887,17 +885,17 @@ struct alignas(128) CellSpursEventFlag { struct ControlSyncVar { - be_t events; // 0x00 Event bits - be_t spuTaskPendingRecv; // 0x02 A bit is set to 1 when the condition of the SPU task using the slot are met and back to 0 when the SPU task unblocks - be_t ppuWaitMask; // 0x04 Wait mask for blocked PPU thread - u8 ppuWaitSlotAndMode; // 0x06 Top 4 bits: Wait slot number of the blocked PPU threads, Bottom 4 bits: Wait mode of the blocked PPU thread - u8 ppuPendingRecv; // 0x07 Set to 1 when the blocked PPU thread's conditions are met and back to 0 when the PPU thread is unblocked + be_t events; // 0x00 Event bits + be_t spuTaskPendingRecv; // 0x02 A bit is set to 1 when the condition of the SPU task using the slot are met and back to 0 when the SPU task unblocks + be_t ppuWaitMask; // 0x04 Wait mask for blocked PPU thread + u8 ppuWaitSlotAndMode; // 0x06 Top 4 bits: Wait slot number of the blocked PPU threads, Bottom 4 bits: Wait mode of the blocked PPU thread + u8 ppuPendingRecv; // 0x07 Set to 1 when the blocked PPU thread's conditions are met and back to 0 when the PPU thread is unblocked }; union { - atomic_t ctrl; // 0x00 - atomic_be_t events; // 0x00 + atomic_t ctrl; // 0x00 + atomic_be_t events; // 0x00 }; be_t spuTaskUsedWaitSlots; // 0x08 A bit is set to 1 if the wait slot corresponding to the bit is used by an SPU task and 0 otherwise @@ -921,11 +919,11 @@ struct alignas(128) CellSpursEventFlag_x00 { struct alignas(8) ControlSyncVar { - be_t events; // 0x00 Event bits - be_t spuTaskPendingRecv; // 0x02 A bit is set to 1 when the condition of the SPU task using the slot are met and back to 0 when the SPU task unblocks - be_t ppuWaitMask; // 0x04 Wait mask for blocked PPU thread - u8 ppuWaitSlotAndMode; // 0x06 Top 4 bits: Wait slot number of the blocked PPU threads, Bottom 4 bits: Wait mode of the blocked PPU thread - u8 ppuPendingRecv; // 0x07 Set to 1 when the blocked PPU thread's conditions are met and back to 0 when the PPU thread is unblocked + be_t events; // 0x00 Event bits + be_t spuTaskPendingRecv; // 0x02 A bit is set to 1 when the condition of the SPU task using the slot are met and back to 0 when the SPU task unblocks + be_t ppuWaitMask; // 0x04 Wait mask for blocked PPU thread + u8 ppuWaitSlotAndMode; // 0x06 Top 4 bits: Wait slot number of the blocked PPU threads, Bottom 4 bits: Wait mode of the blocked PPU thread + u8 ppuPendingRecv; // 0x07 Set to 1 when the blocked PPU thread's conditions are met and back to 0 when the PPU thread is unblocked }; ControlSyncVar ctrl; // 0x00 @@ -1022,14 +1020,14 @@ CHECK_SIZE(CellSpursTasksetInfo, 9360); struct alignas(8) CellSpursTasksetAttribute { - be_t revision; // 0x00 - be_t sdk_version; // 0x04 - be_t args; // 0x08 - u8 priority[8]; // 0x10 - be_t max_contention; // 0x18 - vm::bcptr name; // 0x1C - be_t taskset_size; // 0x20 - be_t enable_clear_ls; // 0x24 + be_t revision; // 0x00 + be_t sdk_version; // 0x04 + be_t args; // 0x08 + u8 priority[8]; // 0x10 + be_t max_contention; // 0x18 + vm::bcptr name; // 0x1C + be_t taskset_size; // 0x20 + be_t enable_clear_ls; // 0x24 u8 reserved[472]; }; @@ -1057,48 +1055,48 @@ struct alignas(128) CellSpursTaskset } }; - atomic_tasks_bitset running; // 0x00 - atomic_tasks_bitset ready; // 0x10 - atomic_tasks_bitset pending_ready; // 0x20 - atomic_tasks_bitset enabled; // 0x30 - atomic_tasks_bitset signalled; // 0x40 - atomic_tasks_bitset waiting; // 0x50 - vm::bptr spurs; // 0x60 - be_t args; // 0x68 - u8 enable_clear_ls; // 0x70 - u8 x71; // 0x71 - u8 wkl_flag_wait_task; // 0x72 - u8 last_scheduled_task; // 0x73 - be_t wid; // 0x74 - be_t x78; // 0x78 - TaskInfo task_info[128]; // 0x80 + atomic_tasks_bitset running; // 0x00 + atomic_tasks_bitset ready; // 0x10 + atomic_tasks_bitset pending_ready; // 0x20 + atomic_tasks_bitset enabled; // 0x30 + atomic_tasks_bitset signalled; // 0x40 + atomic_tasks_bitset waiting; // 0x50 + vm::bptr spurs; // 0x60 + be_t args; // 0x68 + u8 enable_clear_ls; // 0x70 + u8 x71; // 0x71 + u8 wkl_flag_wait_task; // 0x72 + u8 last_scheduled_task; // 0x73 + be_t wid; // 0x74 + be_t x78; // 0x78 + TaskInfo task_info[128]; // 0x80 vm::bptr exception_handler; // 0x1880 - vm::bptr exception_handler_arg; // 0x1888 - be_t size; // 0x1890 - u32 unk2; // 0x1894 - u32 event_flag_id1; // 0x1898 - u32 event_flag_id2; // 0x189C - u8 unk3[0x60]; // 0x18A0 + vm::bptr exception_handler_arg; // 0x1888 + be_t size; // 0x1890 + u32 unk2; // 0x1894 + u32 event_flag_id1; // 0x1898 + u32 event_flag_id2; // 0x189C + u8 unk3[0x60]; // 0x18A0 }; CHECK_SIZE_ALIGN(CellSpursTaskset, 128 * 50, 128); struct alignas(128) spurs_taskset_signal_op { - be_t running[4]; // 0x00 - be_t ready[4]; // 0x10 - be_t pending_ready[4]; // 0x20 - be_t enabled[4]; // 0x30 - be_t signalled[4]; // 0x40 - be_t waiting[4]; // 0x50 - vm::bptr spurs; // 0x60 - be_t args; // 0x68 - u8 enable_clear_ls; // 0x70 - u8 x71; // 0x71 - u8 wkl_flag_wait_task; // 0x72 - u8 last_scheduled_task; // 0x73 - be_t wid; // 0x74 - be_t x78; // 0x78 + be_t running[4]; // 0x00 + be_t ready[4]; // 0x10 + be_t pending_ready[4]; // 0x20 + be_t enabled[4]; // 0x30 + be_t signalled[4]; // 0x40 + be_t waiting[4]; // 0x50 + vm::bptr spurs; // 0x60 + be_t args; // 0x68 + u8 enable_clear_ls; // 0x70 + u8 x71; // 0x71 + u8 wkl_flag_wait_task; // 0x72 + u8 last_scheduled_task; // 0x73 + be_t wid; // 0x74 + be_t x78; // 0x78 }; struct alignas(128) spurs_wkl_state_op @@ -1128,30 +1126,30 @@ struct alignas(128) CellSpursTaskset2 CHECK_SIZE(TaskInfo, 48); - be_t running_set[4]; // 0x00 - be_t ready_set[4]; // 0x10 - be_t ready2_set[4]; // 0x20 - TODO: Find out what this is - be_t enabled_set[4]; // 0x30 - be_t signal_received_set[4]; // 0x40 - be_t waiting_set[4]; // 0x50 - vm::bptr spurs; // 0x60 - be_t args; // 0x68 - u8 enable_clear_ls; // 0x70 - u8 x71; // 0x71 - u8 x72; // 0x72 - u8 last_scheduled_task; // 0x73 - be_t wid; // 0x74 - be_t x78; // 0x78 - TaskInfo task_info[128]; // 0x80 - vm::bptr exception_handler; // 0x1880 - vm::bptr exception_handler_arg; // 0x1888 - be_t size; // 0x1890 - u32 unk2; // 0x1894 - u32 event_flag_id1; // 0x1898 - u32 event_flag_id2; // 0x189C - u8 unk3[0x1980 - 0x18A0]; // 0x18A0 - be_t task_exit_code[128]; // 0x1980 - u8 unk4[0x2900 - 0x2180]; // 0x2180 + be_t running_set[4]; // 0x00 + be_t ready_set[4]; // 0x10 + be_t ready2_set[4]; // 0x20 - TODO: Find out what this is + be_t enabled_set[4]; // 0x30 + be_t signal_received_set[4]; // 0x40 + be_t waiting_set[4]; // 0x50 + vm::bptr spurs; // 0x60 + be_t args; // 0x68 + u8 enable_clear_ls; // 0x70 + u8 x71; // 0x71 + u8 x72; // 0x72 + u8 last_scheduled_task; // 0x73 + be_t wid; // 0x74 + be_t x78; // 0x78 + TaskInfo task_info[128]; // 0x80 + vm::bptr exception_handler; // 0x1880 + vm::bptr exception_handler_arg; // 0x1888 + be_t size; // 0x1890 + u32 unk2; // 0x1894 + u32 event_flag_id1; // 0x1898 + u32 event_flag_id2; // 0x189C + u8 unk3[0x1980 - 0x18A0]; // 0x18A0 + be_t task_exit_code[128]; // 0x1980 + u8 unk4[0x2900 - 0x2180]; // 0x2180 }; CHECK_SIZE_ALIGN(CellSpursTaskset2, 128 * 82, 128); @@ -1185,8 +1183,8 @@ struct alignas(16) CellSpursTaskBinInfo struct alignas(128) CellSpursBarrier { - be_t zero; // 0x00 - be_t remained; // 0x04 + be_t zero; // 0x00 + be_t remained; // 0x04 u8 unk0[0x34 - 0x8]; vm::bptr taskset; // 0x34 u8 unk1[0x80 - 0x38]; @@ -1197,38 +1195,38 @@ CHECK_SIZE_ALIGN(CellSpursBarrier, 128, 128); // The SPURS kernel context. This resides at 0x100 of the LS. struct SpursKernelContext { - u8 tempArea[0x80]; // 0x100 - u8 wklLocContention[0x10]; // 0x180 - u8 wklLocPendingContention[0x10]; // 0x190 - u8 priority[0x10]; // 0x1A0 - u8 x1B0[0x10]; // 0x1B0 - vm::bptr spurs; // 0x1C0 - be_t spuNum; // 0x1C8 - be_t dmaTagId; // 0x1CC - vm::bcptr wklCurrentAddr; // 0x1D0 - be_t wklCurrentUniqueId; // 0x1D8 - be_t wklCurrentId; // 0x1DC - be_t exitToKernelAddr; // 0x1E0 - be_t selectWorkloadAddr; // 0x1E4 - u8 moduleId[2]; // 0x1E8 - u8 sysSrvInitialised; // 0x1EA - u8 spuIdling; // 0x1EB - be_t wklRunnable1; // 0x1EC - be_t wklRunnable2; // 0x1EE - be_t x1F0; // 0x1F0 - be_t x1F4; // 0x1F4 - be_t x1F8; // 0x1F8 - be_t x1FC; // 0x1FC - be_t x200; // 0x200 - be_t x204; // 0x204 - be_t x208; // 0x208 - be_t x20C; // 0x20C - be_t traceBuffer; // 0x210 - be_t traceMsgCount; // 0x218 - be_t traceMaxCount; // 0x21C - u8 wklUniqueId[0x10]; // 0x220 - u8 x230[0x280 - 0x230]; // 0x230 - be_t guid[4]; // 0x280 + u8 tempArea[0x80]; // 0x100 + u8 wklLocContention[0x10]; // 0x180 + u8 wklLocPendingContention[0x10]; // 0x190 + u8 priority[0x10]; // 0x1A0 + u8 x1B0[0x10]; // 0x1B0 + vm::bptr spurs; // 0x1C0 + be_t spuNum; // 0x1C8 + be_t dmaTagId; // 0x1CC + vm::bcptr wklCurrentAddr; // 0x1D0 + be_t wklCurrentUniqueId; // 0x1D8 + be_t wklCurrentId; // 0x1DC + be_t exitToKernelAddr; // 0x1E0 + be_t selectWorkloadAddr; // 0x1E4 + u8 moduleId[2]; // 0x1E8 + u8 sysSrvInitialised; // 0x1EA + u8 spuIdling; // 0x1EB + be_t wklRunnable1; // 0x1EC + be_t wklRunnable2; // 0x1EE + be_t x1F0; // 0x1F0 + be_t x1F4; // 0x1F4 + be_t x1F8; // 0x1F8 + be_t x1FC; // 0x1FC + be_t x200; // 0x200 + be_t x204; // 0x204 + be_t x208; // 0x208 + be_t x20C; // 0x20C + be_t traceBuffer; // 0x210 + be_t traceMsgCount; // 0x218 + be_t traceMaxCount; // 0x21C + u8 wklUniqueId[0x10]; // 0x220 + u8 x230[0x280 - 0x230]; // 0x230 + be_t guid[4]; // 0x280 }; CHECK_SIZE(SpursKernelContext, 0x190); @@ -1236,43 +1234,43 @@ CHECK_SIZE(SpursKernelContext, 0x190); // The SPURS taskset policy module context. This resides at 0x2700 of the LS. struct SpursTasksetContext { - u8 tempAreaTaskset[0x80]; // 0x2700 - u8 tempAreaTaskInfo[0x30]; // 0x2780 - be_t x27B0; // 0x27B0 - vm::bptr taskset; // 0x27B8 - be_t kernelMgmtAddr; // 0x27C0 - be_t syscallAddr; // 0x27C4 - be_t x27C8; // 0x27C8 - be_t spuNum; // 0x27CC - be_t dmaTagId; // 0x27D0 - be_t taskId; // 0x27D4 - u8 x27D8[0x2840 - 0x27D8]; // 0x27D8 - u8 moduleId[16]; // 0x2840 - u8 stackArea[0x2C80 - 0x2850]; // 0x2850 - be_t savedContextLr; // 0x2C80 - be_t savedContextSp; // 0x2C90 - be_t savedContextR80ToR127[48]; // 0x2CA0 - be_t savedContextFpscr; // 0x2FA0 - be_t savedWriteTagGroupQueryMask; // 0x2FB0 - be_t savedSpuWriteEventMask; // 0x2FB4 - be_t tasksetMgmtAddr; // 0x2FB8 - be_t guidAddr; // 0x2FBC - be_t x2FC0; // 0x2FC0 - be_t x2FC8; // 0x2FC8 - be_t taskExitCode; // 0x2FD0 - be_t x2FD4; // 0x2FD4 - u8 x2FD8[0x3000 - 0x2FD8]; // 0x2FD8 + u8 tempAreaTaskset[0x80]; // 0x2700 + u8 tempAreaTaskInfo[0x30]; // 0x2780 + be_t x27B0; // 0x27B0 + vm::bptr taskset; // 0x27B8 + be_t kernelMgmtAddr; // 0x27C0 + be_t syscallAddr; // 0x27C4 + be_t x27C8; // 0x27C8 + be_t spuNum; // 0x27CC + be_t dmaTagId; // 0x27D0 + be_t taskId; // 0x27D4 + u8 x27D8[0x2840 - 0x27D8]; // 0x27D8 + u8 moduleId[16]; // 0x2840 + u8 stackArea[0x2C80 - 0x2850]; // 0x2850 + be_t savedContextLr; // 0x2C80 + be_t savedContextSp; // 0x2C90 + be_t savedContextR80ToR127[48]; // 0x2CA0 + be_t savedContextFpscr; // 0x2FA0 + be_t savedWriteTagGroupQueryMask; // 0x2FB0 + be_t savedSpuWriteEventMask; // 0x2FB4 + be_t tasksetMgmtAddr; // 0x2FB8 + be_t guidAddr; // 0x2FBC + be_t x2FC0; // 0x2FC0 + be_t x2FC8; // 0x2FC8 + be_t taskExitCode; // 0x2FD0 + be_t x2FD4; // 0x2FD4 + u8 x2FD8[0x3000 - 0x2FD8]; // 0x2FD8 }; CHECK_SIZE(SpursTasksetContext, 0x900); struct SpursJobChainContext { - u8 tempAreaJobChain[0x80]; // 0x4A00 - u8 unk0[3]; // 0x4A80 - b8 unkFlag0; // 0x4A83 - u8 unk1[0x10]; // 0x4A84 - vm::bptr jobChain; // 0x4A94 + u8 tempAreaJobChain[0x80]; // 0x4A00 + u8 unk0[3]; // 0x4A80 + b8 unkFlag0; // 0x4A83 + u8 unk1[0x10]; // 0x4A84 + vm::bptr jobChain; // 0x4A94 // TODO }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSpursJq.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSpursJq.cpp index b2cb3e486..1fa79720d 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSpursJq.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSpursJq.cpp @@ -382,68 +382,68 @@ error_code cellSpursJobQueueUnsetExceptionEventHandler() } DECLARE(ppu_module_manager::cellSpursJq)("cellSpursJq", []() -{ - REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeInitialize); - REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetMaxGrab); - REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetSubmitWithEntryLock); - REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetDoBusyWaiting); - REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetIsHaltOnError); - REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetIsJobTypeMemoryCheck); - REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetMaxSizeJobDescriptor); - REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetGrabParameters); - REG_FUNC(cellSpursJq, cellSpursJobQueueSetWaitingMode); - REG_FUNC(cellSpursJq, cellSpursShutdownJobQueue); - REG_FUNC(cellSpursJq, _cellSpursCreateJobQueueWithJobDescriptorPool); - REG_FUNC(cellSpursJq, _cellSpursCreateJobQueue); - REG_FUNC(cellSpursJq, cellSpursJoinJobQueue); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePushJobListBody); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePushJobBody2); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePushJob2Body); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePushAndReleaseJobBody); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePushJobBody); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePushBody); - REG_FUNC(cellSpursJq, _cellSpursJobQueueAllocateJobDescriptorBody); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePushSync); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePushFlush); - REG_FUNC(cellSpursJq, cellSpursJobQueueGetSpurs); - REG_FUNC(cellSpursJq, cellSpursJobQueueGetHandleCount); - REG_FUNC(cellSpursJq, cellSpursJobQueueGetError); - REG_FUNC(cellSpursJq, cellSpursJobQueueGetMaxSizeJobDescriptor); - REG_FUNC(cellSpursJq, cellSpursGetJobQueueId); - REG_FUNC(cellSpursJq, cellSpursJobQueueGetSuspendedJobSize); - REG_FUNC(cellSpursJq, cellSpursJobQueueClose); - REG_FUNC(cellSpursJq, cellSpursJobQueueOpen); - REG_FUNC(cellSpursJq, cellSpursJobQueueSemaphoreTryAcquire); - REG_FUNC(cellSpursJq, cellSpursJobQueueSemaphoreAcquire); - REG_FUNC(cellSpursJq, cellSpursJobQueueSemaphoreInitialize); - REG_FUNC(cellSpursJq, cellSpursJobQueueSendSignal); - REG_FUNC(cellSpursJq, cellSpursJobQueuePortGetJobQueue); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushSync); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushFlush); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushJobListBody); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushJobBody); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushJobBody2); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushBody); - REG_FUNC(cellSpursJq, cellSpursJobQueuePortTrySync); - REG_FUNC(cellSpursJq, cellSpursJobQueuePortSync); - REG_FUNC(cellSpursJq, cellSpursJobQueuePortInitialize); - REG_FUNC(cellSpursJq, cellSpursJobQueuePortInitializeWithDescriptorBuffer); - REG_FUNC(cellSpursJq, cellSpursJobQueuePortFinalize); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePortCopyPushJobBody); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePortCopyPushJobBody2); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePortCopyPushBody); - REG_FUNC(cellSpursJq, cellSpursJobQueuePort2GetJobQueue); - REG_FUNC(cellSpursJq, cellSpursJobQueuePort2PushSync); - REG_FUNC(cellSpursJq, cellSpursJobQueuePort2PushFlush); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2PushJobListBody); - REG_FUNC(cellSpursJq, cellSpursJobQueuePort2Sync); - REG_FUNC(cellSpursJq, cellSpursJobQueuePort2Create); - REG_FUNC(cellSpursJq, cellSpursJobQueuePort2Destroy); - REG_FUNC(cellSpursJq, cellSpursJobQueuePort2AllocateJobDescriptor); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2PushAndReleaseJobBody); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2CopyPushJobBody); - REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2PushJobBody); - REG_FUNC(cellSpursJq, cellSpursJobQueueSetExceptionEventHandler); - REG_FUNC(cellSpursJq, cellSpursJobQueueSetExceptionEventHandler2); - REG_FUNC(cellSpursJq, cellSpursJobQueueUnsetExceptionEventHandler); -}); + { + REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeInitialize); + REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetMaxGrab); + REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetSubmitWithEntryLock); + REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetDoBusyWaiting); + REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetIsHaltOnError); + REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetIsJobTypeMemoryCheck); + REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetMaxSizeJobDescriptor); + REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetGrabParameters); + REG_FUNC(cellSpursJq, cellSpursJobQueueSetWaitingMode); + REG_FUNC(cellSpursJq, cellSpursShutdownJobQueue); + REG_FUNC(cellSpursJq, _cellSpursCreateJobQueueWithJobDescriptorPool); + REG_FUNC(cellSpursJq, _cellSpursCreateJobQueue); + REG_FUNC(cellSpursJq, cellSpursJoinJobQueue); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePushJobListBody); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePushJobBody2); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePushJob2Body); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePushAndReleaseJobBody); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePushJobBody); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePushBody); + REG_FUNC(cellSpursJq, _cellSpursJobQueueAllocateJobDescriptorBody); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePushSync); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePushFlush); + REG_FUNC(cellSpursJq, cellSpursJobQueueGetSpurs); + REG_FUNC(cellSpursJq, cellSpursJobQueueGetHandleCount); + REG_FUNC(cellSpursJq, cellSpursJobQueueGetError); + REG_FUNC(cellSpursJq, cellSpursJobQueueGetMaxSizeJobDescriptor); + REG_FUNC(cellSpursJq, cellSpursGetJobQueueId); + REG_FUNC(cellSpursJq, cellSpursJobQueueGetSuspendedJobSize); + REG_FUNC(cellSpursJq, cellSpursJobQueueClose); + REG_FUNC(cellSpursJq, cellSpursJobQueueOpen); + REG_FUNC(cellSpursJq, cellSpursJobQueueSemaphoreTryAcquire); + REG_FUNC(cellSpursJq, cellSpursJobQueueSemaphoreAcquire); + REG_FUNC(cellSpursJq, cellSpursJobQueueSemaphoreInitialize); + REG_FUNC(cellSpursJq, cellSpursJobQueueSendSignal); + REG_FUNC(cellSpursJq, cellSpursJobQueuePortGetJobQueue); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushSync); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushFlush); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushJobListBody); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushJobBody); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushJobBody2); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushBody); + REG_FUNC(cellSpursJq, cellSpursJobQueuePortTrySync); + REG_FUNC(cellSpursJq, cellSpursJobQueuePortSync); + REG_FUNC(cellSpursJq, cellSpursJobQueuePortInitialize); + REG_FUNC(cellSpursJq, cellSpursJobQueuePortInitializeWithDescriptorBuffer); + REG_FUNC(cellSpursJq, cellSpursJobQueuePortFinalize); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePortCopyPushJobBody); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePortCopyPushJobBody2); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePortCopyPushBody); + REG_FUNC(cellSpursJq, cellSpursJobQueuePort2GetJobQueue); + REG_FUNC(cellSpursJq, cellSpursJobQueuePort2PushSync); + REG_FUNC(cellSpursJq, cellSpursJobQueuePort2PushFlush); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2PushJobListBody); + REG_FUNC(cellSpursJq, cellSpursJobQueuePort2Sync); + REG_FUNC(cellSpursJq, cellSpursJobQueuePort2Create); + REG_FUNC(cellSpursJq, cellSpursJobQueuePort2Destroy); + REG_FUNC(cellSpursJq, cellSpursJobQueuePort2AllocateJobDescriptor); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2PushAndReleaseJobBody); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2CopyPushJobBody); + REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2PushJobBody); + REG_FUNC(cellSpursJq, cellSpursJobQueueSetExceptionEventHandler); + REG_FUNC(cellSpursJq, cellSpursJobQueueSetExceptionEventHandler2); + REG_FUNC(cellSpursJq, cellSpursJobQueueUnsetExceptionEventHandler); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp index 43b3e04c8..3bfa3d749 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp @@ -126,7 +126,7 @@ void cellSpursModuleExit(spu_thread& spu) spu.pc = ctxt->exitToKernelAddr; // TODO: use g_escape for actual long jump - //throw SpursModuleExit(); + // throw SpursModuleExit(); } // Execute a DMA operation @@ -179,7 +179,8 @@ void sys_spu_thread_exit(spu_thread& spu, s32 status) { // Cancel any pending status update requests spu.set_ch_value(MFC_WrTagUpdate, 0); - while (spu.get_ch_count(MFC_RdTagStat) != 1); + while (spu.get_ch_count(MFC_RdTagStat) != 1) + ; spu.get_ch_value(MFC_RdTagStat); // Wait for all pending DMA operations to complete @@ -195,7 +196,8 @@ void sys_spu_thread_group_exit(spu_thread& spu, s32 status) { // Cancel any pending status update requests spu.set_ch_value(MFC_WrTagUpdate, 0); - while (spu.get_ch_count(MFC_RdTagStat) != 1); + while (spu.get_ch_count(MFC_RdTagStat) != 1) + ; spu.get_ch_value(MFC_RdTagStat); // Wait for all pending DMA operations to complete @@ -235,7 +237,8 @@ s32 sys_spu_thread_switch_system_module(spu_thread& spu, u32 status) // Cancel any pending status update requests spu.set_ch_value(MFC_WrTagUpdate, 0); - while (spu.get_ch_count(MFC_RdTagStat) != 1); + while (spu.get_ch_count(MFC_RdTagStat) != 1) + ; spu.get_ch_value(MFC_RdTagStat); // Wait for all pending DMA operations to complete @@ -248,8 +251,7 @@ s32 sys_spu_thread_switch_system_module(spu_thread& spu, u32 status) spu.set_ch_value(SPU_WrOutMbox, status); spu.stop_and_signal(0x120); result = static_cast(spu.get_ch_value(SPU_RdInMbox)); - } - while (result == CELL_EBUSY); + } while (result == CELL_EBUSY); return result; } @@ -271,7 +273,7 @@ bool spursKernel1SelectWorkload(spu_thread& spu) u32 wklSelectedId; u32 pollStatus; - //vm::reservation_op(vm::cast(ctxt->spurs.addr()), 128, [&]() + // vm::reservation_op(vm::cast(ctxt->spurs.addr()), 128, [&]() { // lock the first 0x80 bytes of spurs auto spurs = ctxt->spurs.get_ptr(); @@ -317,10 +319,10 @@ bool spursKernel1SelectWorkload(spu_thread& spu) { u16 runnable = ctxt->wklRunnable1 & (0x8000 >> i); u16 wklSignal = spurs->wklSignal1.load() & (0x8000 >> i); - u8 wklFlag = spurs->wklFlag.flag.load() == 0u ? spurs->wklFlagReceiver == i ? 1 : 0 : 0; - u8 readyCount = spurs->wklReadyCount1[i] > CELL_SPURS_MAX_SPU ? CELL_SPURS_MAX_SPU : spurs->wklReadyCount1[i].load(); - u8 idleSpuCount = spurs->wklIdleSpuCountOrReadyCount2[i] > CELL_SPURS_MAX_SPU ? CELL_SPURS_MAX_SPU : spurs->wklIdleSpuCountOrReadyCount2[i].load(); - u8 requestCount = readyCount + idleSpuCount; + u8 wklFlag = spurs->wklFlag.flag.load() == 0u ? spurs->wklFlagReceiver == i ? 1 : 0 : 0; + u8 readyCount = spurs->wklReadyCount1[i] > CELL_SPURS_MAX_SPU ? CELL_SPURS_MAX_SPU : spurs->wklReadyCount1[i].load(); + u8 idleSpuCount = spurs->wklIdleSpuCountOrReadyCount2[i] > CELL_SPURS_MAX_SPU ? CELL_SPURS_MAX_SPU : spurs->wklIdleSpuCountOrReadyCount2[i].load(); + u8 requestCount = readyCount + idleSpuCount; // For a workload to be considered for scheduling: // 1. Its priority must not be 0 @@ -434,7 +436,7 @@ bool spursKernel1SelectWorkload(spu_thread& spu) } std::memcpy(ctxt, spurs, 128); - }//); + } //); u64 result = u64{wklSelectedId} << 32; result |= pollStatus; @@ -455,7 +457,7 @@ bool spursKernel2SelectWorkload(spu_thread& spu) u32 wklSelectedId; u32 pollStatus; - //vm::reservation_op(vm::cast(ctxt->spurs.addr()), 128, [&]() + // vm::reservation_op(vm::cast(ctxt->spurs.addr()), 128, [&]() { // lock the first 0x80 bytes of spurs auto spurs = ctxt->spurs.get_ptr(); @@ -504,11 +506,11 @@ bool spursKernel2SelectWorkload(spu_thread& spu) { u32 j = i & 0x0f; u16 runnable = i < CELL_SPURS_MAX_WORKLOAD ? ctxt->wklRunnable1 & (0x8000 >> j) : ctxt->wklRunnable2 & (0x8000 >> j); - u8 priority = i < CELL_SPURS_MAX_WORKLOAD ? ctxt->priority[j] & 0x0F : ctxt->priority[j] >> 4; - u8 maxContention = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklMaxContention[j] & 0x0F : spurs->wklMaxContention[j] >> 4; + u8 priority = i < CELL_SPURS_MAX_WORKLOAD ? ctxt->priority[j] & 0x0F : ctxt->priority[j] >> 4; + u8 maxContention = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklMaxContention[j] & 0x0F : spurs->wklMaxContention[j] >> 4; u16 wklSignal = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklSignal1.load() & (0x8000 >> j) : spurs->wklSignal2.load() & (0x8000 >> j); - u8 wklFlag = spurs->wklFlag.flag.load() == 0u ? spurs->wklFlagReceiver == i ? 1 : 0 : 0; - u8 readyCount = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklReadyCount1[j] : spurs->wklIdleSpuCountOrReadyCount2[j]; + u8 wklFlag = spurs->wklFlag.flag.load() == 0u ? spurs->wklFlagReceiver == i ? 1 : 0 : 0; + u8 readyCount = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklReadyCount1[j] : spurs->wklIdleSpuCountOrReadyCount2[j]; // For a workload to be considered for scheduling: // 1. Its priority must be greater than 0 @@ -576,7 +578,8 @@ bool spursKernel2SelectWorkload(spu_thread& spu) ctxt->wklLocPendingContention[i] = 0; } - ctxt->wklLocContention[wklSelectedId & 0x0F] = wklSelectedId < CELL_SPURS_MAX_WORKLOAD ? 0x01 : wklSelectedId < CELL_SPURS_MAX_WORKLOAD2 ? 0x10 : 0; + ctxt->wklLocContention[wklSelectedId & 0x0F] = wklSelectedId < CELL_SPURS_MAX_WORKLOAD ? 0x01 : wklSelectedId < CELL_SPURS_MAX_WORKLOAD2 ? 0x10 : + 0; ctxt->wklCurrentId = wklSelectedId; } else if (wklSelectedId != ctxt->wklCurrentId) @@ -594,7 +597,8 @@ bool spursKernel2SelectWorkload(spu_thread& spu) ctxt->wklLocPendingContention[i] = 0; } - ctxt->wklLocPendingContention[wklSelectedId & 0x0F] = wklSelectedId < CELL_SPURS_MAX_WORKLOAD ? 0x01 : wklSelectedId < CELL_SPURS_MAX_WORKLOAD2 ? 0x10 : 0; + ctxt->wklLocPendingContention[wklSelectedId & 0x0F] = wklSelectedId < CELL_SPURS_MAX_WORKLOAD ? 0x01 : wklSelectedId < CELL_SPURS_MAX_WORKLOAD2 ? 0x10 : + 0; } else { @@ -607,7 +611,7 @@ bool spursKernel2SelectWorkload(spu_thread& spu) } std::memcpy(ctxt, spurs, 128); - }//); + } //); u64 result = u64{wklSelectedId} << 32; result |= pollStatus; @@ -625,9 +629,9 @@ void spursKernelDispatchWorkload(spu_thread& spu, u64 widAndPollStatus) auto wid = static_cast(widAndPollStatus >> 32); // DMA in the workload info for the selected workload - auto wklInfoOffset = wid < CELL_SPURS_MAX_WORKLOAD ? &ctxt->spurs->wklInfo1[wid] : - wid < CELL_SPURS_MAX_WORKLOAD2 && isKernel2 ? &ctxt->spurs->wklInfo2[wid & 0xf] : - &ctxt->spurs->wklInfoSysSrv; + auto wklInfoOffset = wid < CELL_SPURS_MAX_WORKLOAD ? &ctxt->spurs->wklInfo1[wid] : + wid < CELL_SPURS_MAX_WORKLOAD2 && isKernel2 ? &ctxt->spurs->wklInfo2[wid & 0xf] : + &ctxt->spurs->wklInfoSysSrv; const auto wklInfo = spu._ptr(0x3FFE0); std::memcpy(wklInfo, wklInfoOffset, 0x20); @@ -638,10 +642,10 @@ void spursKernelDispatchWorkload(spu_thread& spu, u64 widAndPollStatus) switch (wklInfo->addr.addr()) { case SPURS_IMG_ADDR_SYS_SRV_WORKLOAD: - //spu.RegisterHleFunction(0xA00, spursSysServiceEntry); + // spu.RegisterHleFunction(0xA00, spursSysServiceEntry); break; case SPURS_IMG_ADDR_TASKSET_PM: - //spu.RegisterHleFunction(0xA00, spursTasksetEntry); + // spu.RegisterHleFunction(0xA00, spursTasksetEntry); break; default: std::memcpy(spu._ptr(0xA00), wklInfo->addr.get_ptr(), wklInfo->size); @@ -724,10 +728,10 @@ bool spursKernelEntry(spu_thread& spu) } // Register SPURS kernel HLE functions - //spu.UnregisterHleFunctions(0, 0x40000/*LS_BOTTOM*/); - //spu.RegisterHleFunction(isKernel2 ? CELL_SPURS_KERNEL2_ENTRY_ADDR : CELL_SPURS_KERNEL1_ENTRY_ADDR, spursKernelEntry); - //spu.RegisterHleFunction(ctxt->exitToKernelAddr, spursKernelWorkloadExit); - //spu.RegisterHleFunction(ctxt->selectWorkloadAddr, isKernel2 ? spursKernel2SelectWorkload : spursKernel1SelectWorkload); + // spu.UnregisterHleFunctions(0, 0x40000/*LS_BOTTOM*/); + // spu.RegisterHleFunction(isKernel2 ? CELL_SPURS_KERNEL2_ENTRY_ADDR : CELL_SPURS_KERNEL1_ENTRY_ADDR, spursKernelEntry); + // spu.RegisterHleFunction(ctxt->exitToKernelAddr, spursKernelWorkloadExit); + // spu.RegisterHleFunction(ctxt->selectWorkloadAddr, isKernel2 ? spursKernel2SelectWorkload : spursKernel1SelectWorkload); // Start the system service spursKernelDispatchWorkload(spu, u64{CELL_SPURS_SYS_SERVICE_WORKLOAD_ID} << 32); @@ -742,7 +746,7 @@ bool spursKernelEntry(spu_thread& spu) bool spursSysServiceEntry(spu_thread& spu) { const auto ctxt = spu._ptr(spu.gpr[3]._u32[3]); - //auto arg = spu.gpr[4]._u64[1]; + // auto arg = spu.gpr[4]._u64[1]; auto pollStatus = spu.gpr[5]._u32[3]; { @@ -770,7 +774,7 @@ void spursSysServiceIdleHandler(spu_thread& spu, SpursKernelContext* ctxt) while (true) { const auto spurs = spu._ptr(0x100); - //vm::reservation_acquire(ctxt->spurs.addr()); + // vm::reservation_acquire(ctxt->spurs.addr()); // Find the number of SPUs that are idling in this SPURS instance u32 nIdlingSpus = 0; @@ -858,7 +862,7 @@ void spursSysServiceIdleHandler(spu_thread& spu, SpursKernelContext* ctxt) continue; } - //if (vm::reservation_update(vm::cast(ctxt->spurs.addr()), spu._ptr(0x100), 128) && (shouldExit || foundReadyWorkload)) + // if (vm::reservation_update(vm::cast(ctxt->spurs.addr()), spu._ptr(0x100), 128) && (shouldExit || foundReadyWorkload)) { break; } @@ -886,9 +890,9 @@ void spursSysServiceMain(spu_thread& spu, u32 pollStatus) { ctxt->sysSrvInitialised = 1; - //vm::reservation_acquire(ctxt->spurs.addr()); + // vm::reservation_acquire(ctxt->spurs.addr()); - //vm::reservation_op(ctxt->spurs.ptr(&CellSpurs::wklState1).addr(), [&]() + // vm::reservation_op(ctxt->spurs.ptr(&CellSpurs::wklState1).addr(), [&]() { auto spurs = ctxt->spurs.get_ptr(); @@ -902,7 +906,7 @@ void spursSysServiceMain(spu_thread& spu, u32 pollStatus) spurs->sysSrvOnSpu |= 1 << ctxt->spuNum; std::memcpy(spu._ptr(0x2D80), spurs->wklState1, 128); - }//); + } //); ctxt->traceBuffer = 0; ctxt->traceMsgCount = -1; @@ -944,7 +948,7 @@ void spursSysServiceMain(spu_thread& spu, u32 pollStatus) pkt.data.stop = SPURS_GUID_SYS_WKL; cellSpursModulePutTrace(&pkt, ctxt->dmaTagId); - //spursDmaWaitForCompletion(spu, 1 << ctxt->dmaTagId); + // spursDmaWaitForCompletion(spu, 1 << ctxt->dmaTagId); break; } @@ -978,7 +982,7 @@ void spursSysServiceProcessRequests(spu_thread& spu, SpursKernelContext* ctxt) bool updateWorkload = false; bool terminate = false; - //vm::reservation_op(vm::cast(ctxt->spurs.addr() + OFFSET_32(CellSpurs, wklState1)), 128, [&]() + // vm::reservation_op(vm::cast(ctxt->spurs.addr() + OFFSET_32(CellSpurs, wklState1)), 128, [&]() { auto spurs = ctxt->spurs.get_ptr(); @@ -1003,7 +1007,7 @@ void spursSysServiceProcessRequests(spu_thread& spu, SpursKernelContext* ctxt) } std::memcpy(spu._ptr(0x2D80), spurs->wklState1, 128); - }//); + } //); // Process update workload message if (updateWorkload) @@ -1057,7 +1061,7 @@ void spursSysServiceActivateWorkload(spu_thread& spu, SpursKernelContext* ctxt) } } - //vm::reservation_op(ctxt->spurs.ptr(&CellSpurs::wklState1).addr(), 128, [&]() + // vm::reservation_op(ctxt->spurs.ptr(&CellSpurs::wklState1).addr(), 128, [&]() { auto spurs = ctxt->spurs.get_ptr(); @@ -1114,7 +1118,7 @@ void spursSysServiceActivateWorkload(spu_thread& spu, SpursKernelContext* ctxt) } std::memcpy(spu._ptr(0x2D80), spurs->wklState1, 128); - }//); + } //); if (wklShutdownBitSet) { @@ -1129,7 +1133,7 @@ void spursSysServiceUpdateShutdownCompletionEvents(spu_thread& spu, SpursKernelC // workloads that have a shutdown completion hook registered u32 wklNotifyBitSet; [[maybe_unused]] u8 spuPort; - //vm::reservation_op(ctxt->spurs.ptr(&CellSpurs::wklState1).addr(), 128, [&]() + // vm::reservation_op(ctxt->spurs.ptr(&CellSpurs::wklState1).addr(), 128, [&]() { auto spurs = ctxt->spurs.get_ptr(); @@ -1157,7 +1161,7 @@ void spursSysServiceUpdateShutdownCompletionEvents(spu_thread& spu, SpursKernelC } std::memcpy(spu._ptr(0x2D80), spurs->wklState1, 128); - }//); + } //); if (wklNotifyBitSet) { @@ -1181,7 +1185,7 @@ void spursSysServiceTraceUpdate(spu_thread& spu, SpursKernelContext* ctxt, u32 a bool notify; u8 sysSrvMsgUpdateTrace; - //vm::reservation_op(ctxt->spurs.ptr(&CellSpurs::wklState1).addr(), 128, [&]() + // vm::reservation_op(ctxt->spurs.ptr(&CellSpurs::wklState1).addr(), 128, [&]() { auto spurs = ctxt->spurs.get_ptr(); auto& trace = spurs->sysSrvTrace.raw(); @@ -1205,12 +1209,12 @@ void spursSysServiceTraceUpdate(spu_thread& spu, SpursKernelContext* ctxt, u32 a } std::memcpy(spu._ptr(0x2D80), spurs->wklState1, 128); - }//); + } //); // Get trace parameters from CellSpurs and store them in the LS if (((sysSrvMsgUpdateTrace & (1 << ctxt->spuNum)) != 0) || (arg3 != 0)) { - //vm::reservation_acquire(ctxt->spurs.ptr(&CellSpurs::traceBuffer).addr()); + // vm::reservation_acquire(ctxt->spurs.ptr(&CellSpurs::traceBuffer).addr()); auto spurs = spu._ptr(0x80 - offset32(&CellSpurs::traceBuffer)); if (ctxt->traceMsgCount != 0xffu || spurs->traceBuffer.addr() == 0u) @@ -1246,7 +1250,7 @@ void spursSysServiceCleanupAfterSystemWorkload(spu_thread& spu, SpursKernelConte bool do_return = false; - //vm::reservation_op(ctxt->spurs.ptr(&CellSpurs::wklState1).addr(), 128, [&]() + // vm::reservation_op(ctxt->spurs.ptr(&CellSpurs::wklState1).addr(), 128, [&]() { auto spurs = ctxt->spurs.get_ptr(); @@ -1260,13 +1264,14 @@ void spursSysServiceCleanupAfterSystemWorkload(spu_thread& spu, SpursKernelConte spurs->sysSrvPreemptWklId[ctxt->spuNum] = 0xFF; std::memcpy(spu._ptr(0x2D80), spurs->wklState1, 128); - }//); + } //); - if (do_return) return; + if (do_return) + return; spursSysServiceActivateWorkload(spu, ctxt); - //vm::reservation_op(vm::cast(ctxt->spurs.addr()), 128, [&]() + // vm::reservation_op(vm::cast(ctxt->spurs.addr()), 128, [&]() { auto spurs = ctxt->spurs.get_ptr(); @@ -1282,7 +1287,7 @@ void spursSysServiceCleanupAfterSystemWorkload(spu_thread& spu, SpursKernelConte } std::memcpy(spu._ptr(0x100), spurs, 128); - }//); + } //); // Set the current workload id to the id of the pre-empted workload since cellSpursModulePutTrace // uses the current worload id to determine the workload to which the trace belongs @@ -1334,9 +1339,9 @@ bool spursTasksetEntry(spu_thread& spu) ctxt->taskId = 0xFFFFFFFF; // Register SPURS takset policy module HLE functions - //spu.UnregisterHleFunctions(CELL_SPURS_TASKSET_PM_ENTRY_ADDR, 0x40000/*LS_BOTTOM*/); - //spu.RegisterHleFunction(CELL_SPURS_TASKSET_PM_ENTRY_ADDR, spursTasksetEntry); - //spu.RegisterHleFunction(ctxt->syscallAddr, spursTasksetSyscallEntry); + // spu.UnregisterHleFunctions(CELL_SPURS_TASKSET_PM_ENTRY_ADDR, 0x40000/*LS_BOTTOM*/); + // spu.RegisterHleFunction(CELL_SPURS_TASKSET_PM_ENTRY_ADDR, spursTasksetEntry); + // spu.RegisterHleFunction(ctxt->syscallAddr, spursTasksetSyscallEntry); { // Initialise the taskset policy module @@ -1368,9 +1373,9 @@ bool spursTasksetSyscallEntry(spu_thread& spu) // Resume the previously executing task if the syscall did not cause a context switch fmt::throw_exception("Broken (TODO)"); - //if (spu.m_is_branch == false) { - // spursTasksetResumeTask(spu); - //} + // if (spu.m_is_branch == false) { + // spursTasksetResumeTask(spu); + // } } return false; @@ -1419,7 +1424,7 @@ s32 spursTasksetProcessRequest(spu_thread& spu, s32 request, u32* taskId, u32* i s32 rc = CELL_OK; s32 numNewlyReadyTasks = 0; - //vm::reservation_op(vm::cast(ctxt->taskset.addr()), 128, [&]() + // vm::reservation_op(vm::cast(ctxt->taskset.addr()), 128, [&]() { auto taskset = ctxt->taskset; v128 waiting = vm::_ref(ctxt->taskset.addr() + ::offset32(&CellSpursTaskset::waiting)); @@ -1445,7 +1450,7 @@ s32 spursTasksetProcessRequest(spu_thread& spu, s32 request, u32* taskId, u32* i } v128 readyButNotRunning; - u8 selectedTaskId; + u8 selectedTaskId; v128 signalled0 = (signalled & (ready | pready)); v128 ready0 = (signalled | ready | pready); @@ -1602,7 +1607,7 @@ s32 spursTasksetProcessRequest(spu_thread& spu, s32 request, u32* taskId, u32* i vm::_ref(ctxt->taskset.addr() + ::offset32(&CellSpursTaskset::signalled)) = signalled; std::memcpy(spu._ptr(0x2700), spu._ptr(0x100), 128); // Copy data - }//); + } //); // Increment the ready count of the workload by the number of tasks that have become ready if (numNewlyReadyTasks) @@ -1610,13 +1615,13 @@ s32 spursTasksetProcessRequest(spu_thread& spu, s32 request, u32* taskId, u32* i auto spurs = kernelCtxt->spurs; vm::light_op(spurs->readyCount(kernelCtxt->wklCurrentId), [&](atomic_t& val) - { - val.fetch_op([&](u8& val) { - const s32 _new = val + numNewlyReadyTasks; - val = static_cast(std::clamp(_new, 0, 0xFF)); + val.fetch_op([&](u8& val) + { + const s32 _new = val + numNewlyReadyTasks; + val = static_cast(std::clamp(_new, 0, 0xFF)); + }); }); - }); } return rc; @@ -1686,7 +1691,7 @@ s32 spursTasketSaveTaskContext(spu_thread& spu) auto ctxt = spu._ptr(0x2700); auto taskInfo = spu._ptr(0x2780); - //spursDmaWaitForCompletion(spu, 0xFFFFFFFF); + // spursDmaWaitForCompletion(spu, 0xFFFFFFFF); if (taskInfo->context_save_storage_and_alloc_ls_blocks == 0u) { @@ -1733,7 +1738,7 @@ s32 spursTasketSaveTaskContext(spu_thread& spu) } } - //spursDmaWaitForCompletion(spu, 1 << ctxt->dmaTagId); + // spursDmaWaitForCompletion(spu, 1 << ctxt->dmaTagId); return CELL_OK; } @@ -1781,7 +1786,7 @@ void spursTasksetDispatch(spu_thread& spu) spursHalt(spu); } - //spursDmaWaitForCompletion(spu, 1 << ctxt->dmaTagId); + // spursDmaWaitForCompletion(spu, 1 << ctxt->dmaTagId); ctxt->savedContextLr = v128::from32r(entryPoint); ctxt->guidAddr = lowestLoadAddr; @@ -1841,7 +1846,7 @@ void spursTasksetDispatch(spu_thread& spu) } } - //spursDmaWaitForCompletion(spu, 1 << ctxt->dmaTagId); + // spursDmaWaitForCompletion(spu, 1 << ctxt->dmaTagId); // Restore saved registers spu.fpscr.Write(ctxt->savedContextFpscr.value()); @@ -1876,7 +1881,7 @@ s32 spursTasksetProcessSyscall(spu_thread& spu, u32 syscallNum, u32 args) // for DMA completion if ((syscallNum & 0x10) == 0) { - //spursDmaWaitForCompletion(spu, 0xFFFFFFFF); + // spursDmaWaitForCompletion(spu, 0xFFFFFFFF); } s32 rc = 0; @@ -1932,7 +1937,7 @@ s32 spursTasksetProcessSyscall(spu_thread& spu, u32 syscallNum, u32 args) if (args == 0) { // TODO: Figure this out spu_log.error("args == 0"); - //spursHalt(spu); + // spursHalt(spu); } if (spursTasksetPollStatus(spu) || spursTasksetProcessRequest(spu, SPURS_TASKSET_REQUEST_WAIT_WKL_FLAG, nullptr, nullptr) != 1) @@ -2019,7 +2024,7 @@ s32 spursTasksetLoadElf(spu_thread& spu, u32* entryPoint, u32* lowestLoadAddr, u if (prog.p_type == 1u /* PT_LOAD */) { - if (skipWriteableSegments == false || (prog.p_flags & 2u /*PF_W*/ ) == 0u) + if (skipWriteableSegments == false || (prog.p_flags & 2u /*PF_W*/) == 0u) { if (prog.p_vaddr < CELL_SPURS_TASK_TOP || prog.p_vaddr + prog.p_memsz > CELL_SPURS_TASK_BOTTOM) { @@ -2048,7 +2053,8 @@ s32 spursTasksetLoadElf(spu_thread& spu, u32* entryPoint, u32* lowestLoadAddr, u } *entryPoint = obj.header.e_entry; - if (lowestLoadAddr) *lowestLoadAddr = _lowestLoadAddr; + if (lowestLoadAddr) + *lowestLoadAddr = _lowestLoadAddr; return CELL_OK; } @@ -2058,11 +2064,11 @@ s32 spursTasksetLoadElf(spu_thread& spu, u32* entryPoint, u32* lowestLoadAddr, u //---------------------------------------------------------------------------- bool spursJobChainEntry(spu_thread& spu) { - //const auto ctxt = spu._ptr(0x4a00); - //auto kernelCtxt = spu._ptr(spu.gpr[3]._u32[3]); + // const auto ctxt = spu._ptr(0x4a00); + // auto kernelCtxt = spu._ptr(spu.gpr[3]._u32[3]); - //auto arg = spu.gpr[4]._u64[1]; - //auto pollStatus = spu.gpr[5]._u32[3]; + // auto arg = spu.gpr[4]._u64[1]; + // auto pollStatus = spu.gpr[5]._u32[3]; // TODO return false; @@ -2075,31 +2081,34 @@ void spursJobchainPopUrgentCommand(spu_thread& spu) const bool alterQueue = ctxt->unkFlag0; vm::reservation_op(spu, jc, [&](CellSpursJobChain_x00& op) - { - const auto ls = reinterpret_cast(ctxt->tempAreaJobChain); - - struct alignas(16) { v128 first, second; } data; - std::memcpy(&data, &op.urgentCmds, sizeof(op.urgentCmds)); - - if (!alterQueue) { - // Read the queue, do not modify it - } - else - { - // Move FIFO queue contents one command up - data.first._u64[0] = data.first._u64[1]; - data.first._u64[1] = data.second._u64[0]; - data.second._u64[0] = data.second._u64[1]; - data.second._u64[1] = 0; - } + const auto ls = reinterpret_cast(ctxt->tempAreaJobChain); - // Writeback - std::memcpy(&ls->urgentCmds, &data, sizeof(op.urgentCmds)); + struct alignas(16) + { + v128 first, second; + } data; + std::memcpy(&data, &op.urgentCmds, sizeof(op.urgentCmds)); - std::memcpy(&ls->isHalted, &op.unk0[0], 1); // Maybe intended to set it to false - ls->unk5 = 0; - ls->sizeJobDescriptor = op.maxGrabbedJob; - std::memcpy(&op, ls, 128); - }); + if (!alterQueue) + { + // Read the queue, do not modify it + } + else + { + // Move FIFO queue contents one command up + data.first._u64[0] = data.first._u64[1]; + data.first._u64[1] = data.second._u64[0]; + data.second._u64[0] = data.second._u64[1]; + data.second._u64[1] = 0; + } + + // Writeback + std::memcpy(&ls->urgentCmds, &data, sizeof(op.urgentCmds)); + + std::memcpy(&ls->isHalted, &op.unk0[0], 1); // Maybe intended to set it to false + ls->unk5 = 0; + ls->sizeJobDescriptor = op.maxGrabbedJob; + std::memcpy(&op, ls, 128); + }); } diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSsl.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSsl.cpp index d7f32a563..d5a9fb8a0 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSsl.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSsl.cpp @@ -13,32 +13,32 @@ LOG_CHANNEL(cellSsl); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SSL_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_SSL_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_SSL_ERROR_INITIALIZATION_FAILED); - STR_CASE(CELL_SSL_ERROR_NO_BUFFER); - STR_CASE(CELL_SSL_ERROR_INVALID_CERTIFICATE); - STR_CASE(CELL_SSL_ERROR_UNRETRIEVABLE); - STR_CASE(CELL_SSL_ERROR_INVALID_FORMAT); - STR_CASE(CELL_SSL_ERROR_NOT_FOUND); - STR_CASE(CELL_SSL_ERROR_INVALID_TIME); - STR_CASE(CELL_SSL_ERROR_INAVLID_NEGATIVE_TIME); - STR_CASE(CELL_SSL_ERROR_INCORRECT_TIME); - STR_CASE(CELL_SSL_ERROR_UNDEFINED_TIME_TYPE); - STR_CASE(CELL_SSL_ERROR_NO_MEMORY); - STR_CASE(CELL_SSL_ERROR_NO_STRING); - STR_CASE(CELL_SSL_ERROR_UNKNOWN_LOAD_CERT); - } + switch (error) + { + STR_CASE(CELL_SSL_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_SSL_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_SSL_ERROR_INITIALIZATION_FAILED); + STR_CASE(CELL_SSL_ERROR_NO_BUFFER); + STR_CASE(CELL_SSL_ERROR_INVALID_CERTIFICATE); + STR_CASE(CELL_SSL_ERROR_UNRETRIEVABLE); + STR_CASE(CELL_SSL_ERROR_INVALID_FORMAT); + STR_CASE(CELL_SSL_ERROR_NOT_FOUND); + STR_CASE(CELL_SSL_ERROR_INVALID_TIME); + STR_CASE(CELL_SSL_ERROR_INAVLID_NEGATIVE_TIME); + STR_CASE(CELL_SSL_ERROR_INCORRECT_TIME); + STR_CASE(CELL_SSL_ERROR_UNDEFINED_TIME_TYPE); + STR_CASE(CELL_SSL_ERROR_NO_MEMORY); + STR_CASE(CELL_SSL_ERROR_NO_STRING); + STR_CASE(CELL_SSL_ERROR_UNKNOWN_LOAD_CERT); + } - return unknown; - }); + return unknown; + }); } error_code cellSslInit(vm::ptr pool, u32 poolSize) @@ -114,10 +114,10 @@ error_code cellSslCertificateLoader(u64 flag, vm::ptr buffer, u32 size, vm *required = 0; for (uint i = 1; i <= flagBits.size(); i++) { - if (!flagBits[i-1]) + if (!flagBits[i - 1]) continue; // If we're loading cert 6 (the baltimore cert), then we need set that we're loading the 'normal' set of certs. - *required += ::size32(getCert(certPath, i, flagBits[BaltimoreCert-1])); + *required += ::size32(getCert(certPath, i, flagBits[BaltimoreCert - 1])); } } else @@ -125,10 +125,10 @@ error_code cellSslCertificateLoader(u64 flag, vm::ptr buffer, u32 size, vm std::string final; for (uint i = 1; i <= flagBits.size(); i++) { - if (!flagBits[i-1]) + if (!flagBits[i - 1]) continue; // If we're loading cert 6 (the baltimore cert), then we need set that we're loading the 'normal' set of certs. - final.append(getCert(certPath, i, flagBits[BaltimoreCert-1])); + final.append(getCert(certPath, i, flagBits[BaltimoreCert - 1])); } memset(buffer.get_ptr(), '\0', size - 1); @@ -590,7 +590,7 @@ error_code SSL_clear() return CELL_OK; } -error_code SSL_do_handshake() +error_code SSL_do_handshake() { UNIMPLEMENTED_FUNC(cellSsl); return CELL_OK; @@ -819,123 +819,123 @@ error_code TLSv1_client_method() } DECLARE(ppu_module_manager::cellSsl)("cellSsl", []() -{ - REG_FUNC(cellSsl, cellSslInit); - REG_FUNC(cellSsl, cellSslEnd); - REG_FUNC(cellSsl, cellSslGetMemoryInfo); + { + REG_FUNC(cellSsl, cellSslInit); + REG_FUNC(cellSsl, cellSslEnd); + REG_FUNC(cellSsl, cellSslGetMemoryInfo); - REG_FUNC(cellSsl, cellSslCertificateLoader); + REG_FUNC(cellSsl, cellSslCertificateLoader); - REG_FUNC(cellSsl, cellSslCertGetSerialNumber); - REG_FUNC(cellSsl, cellSslCertGetPublicKey); - REG_FUNC(cellSsl, cellSslCertGetRsaPublicKeyModulus); - REG_FUNC(cellSsl, cellSslCertGetRsaPublicKeyExponent); - REG_FUNC(cellSsl, cellSslCertGetNotBefore); - REG_FUNC(cellSsl, cellSslCertGetNotAfter); - REG_FUNC(cellSsl, cellSslCertGetSubjectName); - REG_FUNC(cellSsl, cellSslCertGetIssuerName); - REG_FUNC(cellSsl, cellSslCertGetNameEntryCount); - REG_FUNC(cellSsl, cellSslCertGetNameEntryInfo); - REG_FUNC(cellSsl, cellSslCertGetMd5Fingerprint); + REG_FUNC(cellSsl, cellSslCertGetSerialNumber); + REG_FUNC(cellSsl, cellSslCertGetPublicKey); + REG_FUNC(cellSsl, cellSslCertGetRsaPublicKeyModulus); + REG_FUNC(cellSsl, cellSslCertGetRsaPublicKeyExponent); + REG_FUNC(cellSsl, cellSslCertGetNotBefore); + REG_FUNC(cellSsl, cellSslCertGetNotAfter); + REG_FUNC(cellSsl, cellSslCertGetSubjectName); + REG_FUNC(cellSsl, cellSslCertGetIssuerName); + REG_FUNC(cellSsl, cellSslCertGetNameEntryCount); + REG_FUNC(cellSsl, cellSslCertGetNameEntryInfo); + REG_FUNC(cellSsl, cellSslCertGetMd5Fingerprint); - REG_FUNC(cellSsl, _cellSslConvertCipherId); - REG_FUNC(cellSsl, _cellSslConvertSslVersion); - REG_FUNC(cellSsl, _cellSslIsInitd); - REG_FUNC(cellSsl, _cellSslPemReadPrivateKey); - REG_FUNC(cellSsl, _cellSslPemReadX509); + REG_FUNC(cellSsl, _cellSslConvertCipherId); + REG_FUNC(cellSsl, _cellSslConvertSslVersion); + REG_FUNC(cellSsl, _cellSslIsInitd); + REG_FUNC(cellSsl, _cellSslPemReadPrivateKey); + REG_FUNC(cellSsl, _cellSslPemReadX509); - REG_FUNC(cellSsl, BER_read_item); + REG_FUNC(cellSsl, BER_read_item); - REG_FUNC(cellSsl, BIO_ctrl); - REG_FUNC(cellSsl, BIO_dump); - REG_FUNC(cellSsl, BIO_free); - REG_FUNC(cellSsl, BIO_get_cb_arg); - REG_FUNC(cellSsl, BIO_get_retry_reason); - REG_FUNC(cellSsl, BIO_new_mem); - REG_FUNC(cellSsl, BIO_new_socket); - REG_FUNC(cellSsl, BIO_printf); - REG_FUNC(cellSsl, BIO_ptr_ctrl); - REG_FUNC(cellSsl, BIO_set_cb_arg); + REG_FUNC(cellSsl, BIO_ctrl); + REG_FUNC(cellSsl, BIO_dump); + REG_FUNC(cellSsl, BIO_free); + REG_FUNC(cellSsl, BIO_get_cb_arg); + REG_FUNC(cellSsl, BIO_get_retry_reason); + REG_FUNC(cellSsl, BIO_new_mem); + REG_FUNC(cellSsl, BIO_new_socket); + REG_FUNC(cellSsl, BIO_printf); + REG_FUNC(cellSsl, BIO_ptr_ctrl); + REG_FUNC(cellSsl, BIO_set_cb_arg); - REG_FUNC(cellSsl, ERR_clear_error); - REG_FUNC(cellSsl, ERR_get_error); - REG_FUNC(cellSsl, ERR_error_string); - REG_FUNC(cellSsl, ERR_func_error_string); - REG_FUNC(cellSsl, ERR_peek_error); + REG_FUNC(cellSsl, ERR_clear_error); + REG_FUNC(cellSsl, ERR_get_error); + REG_FUNC(cellSsl, ERR_error_string); + REG_FUNC(cellSsl, ERR_func_error_string); + REG_FUNC(cellSsl, ERR_peek_error); - REG_FUNC(cellSsl, EVP_PKEY_free); + REG_FUNC(cellSsl, EVP_PKEY_free); - REG_FUNC(cellSsl, R_time); - REG_FUNC(cellSsl, R_time_cmp); - REG_FUNC(cellSsl, R_time_export); - REG_FUNC(cellSsl, R_time_free); - REG_FUNC(cellSsl, R_time_import); - REG_FUNC(cellSsl, R_time_new); + REG_FUNC(cellSsl, R_time); + REG_FUNC(cellSsl, R_time_cmp); + REG_FUNC(cellSsl, R_time_export); + REG_FUNC(cellSsl, R_time_free); + REG_FUNC(cellSsl, R_time_import); + REG_FUNC(cellSsl, R_time_new); - REG_FUNC(cellSsl, SSL_CIPHER_description); - REG_FUNC(cellSsl, SSL_CIPHER_get_bits); - REG_FUNC(cellSsl, SSL_CIPHER_get_id); - REG_FUNC(cellSsl, SSL_CIPHER_get_name); - REG_FUNC(cellSsl, SSL_CIPHER_get_version); + REG_FUNC(cellSsl, SSL_CIPHER_description); + REG_FUNC(cellSsl, SSL_CIPHER_get_bits); + REG_FUNC(cellSsl, SSL_CIPHER_get_id); + REG_FUNC(cellSsl, SSL_CIPHER_get_name); + REG_FUNC(cellSsl, SSL_CIPHER_get_version); - REG_FUNC(cellSsl, SSL_CTX_ctrl); - REG_FUNC(cellSsl, SSL_CTX_free); - REG_FUNC(cellSsl, SSL_CTX_new); - REG_FUNC(cellSsl, SSL_CTX_set_app_verify_cb); - REG_FUNC(cellSsl, SSL_CTX_set_info_cb); - REG_FUNC(cellSsl, SSL_CTX_set_options); - REG_FUNC(cellSsl, SSL_CTX_set_verify_mode); - REG_FUNC(cellSsl, SSL_CTX_use_certificate); - REG_FUNC(cellSsl, SSL_CTX_use_PrivateKey); + REG_FUNC(cellSsl, SSL_CTX_ctrl); + REG_FUNC(cellSsl, SSL_CTX_free); + REG_FUNC(cellSsl, SSL_CTX_new); + REG_FUNC(cellSsl, SSL_CTX_set_app_verify_cb); + REG_FUNC(cellSsl, SSL_CTX_set_info_cb); + REG_FUNC(cellSsl, SSL_CTX_set_options); + REG_FUNC(cellSsl, SSL_CTX_set_verify_mode); + REG_FUNC(cellSsl, SSL_CTX_use_certificate); + REG_FUNC(cellSsl, SSL_CTX_use_PrivateKey); - REG_FUNC(cellSsl, SSL_SESSION_free); + REG_FUNC(cellSsl, SSL_SESSION_free); - REG_FUNC(cellSsl, SSL_alert_desc_string_long); - REG_FUNC(cellSsl, SSL_alert_type_string_long); - REG_FUNC(cellSsl, SSL_clear); - REG_FUNC(cellSsl, SSL_do_handshake); - REG_FUNC(cellSsl, SSL_free); - REG_FUNC(cellSsl, SSL_get_current_cipher); - REG_FUNC(cellSsl, SSL_get_error); - REG_FUNC(cellSsl, SSL_get_rbio); - REG_FUNC(cellSsl, SSL_get_version); - REG_FUNC(cellSsl, SSL_new); - REG_FUNC(cellSsl, SSL_peek); - REG_FUNC(cellSsl, SSL_read); - REG_FUNC(cellSsl, SSL_set_bio); - REG_FUNC(cellSsl, SSL_set_connect_state); - REG_FUNC(cellSsl, SSL_set_session); - REG_FUNC(cellSsl, SSL_set_ssl_method); - REG_FUNC(cellSsl, SSL_shutdown); - REG_FUNC(cellSsl, SSL_state); - REG_FUNC(cellSsl, SSL_state_string_long); - REG_FUNC(cellSsl, SSL_version); - REG_FUNC(cellSsl, SSL_want); - REG_FUNC(cellSsl, SSL_write); + REG_FUNC(cellSsl, SSL_alert_desc_string_long); + REG_FUNC(cellSsl, SSL_alert_type_string_long); + REG_FUNC(cellSsl, SSL_clear); + REG_FUNC(cellSsl, SSL_do_handshake); + REG_FUNC(cellSsl, SSL_free); + REG_FUNC(cellSsl, SSL_get_current_cipher); + REG_FUNC(cellSsl, SSL_get_error); + REG_FUNC(cellSsl, SSL_get_rbio); + REG_FUNC(cellSsl, SSL_get_version); + REG_FUNC(cellSsl, SSL_new); + REG_FUNC(cellSsl, SSL_peek); + REG_FUNC(cellSsl, SSL_read); + REG_FUNC(cellSsl, SSL_set_bio); + REG_FUNC(cellSsl, SSL_set_connect_state); + REG_FUNC(cellSsl, SSL_set_session); + REG_FUNC(cellSsl, SSL_set_ssl_method); + REG_FUNC(cellSsl, SSL_shutdown); + REG_FUNC(cellSsl, SSL_state); + REG_FUNC(cellSsl, SSL_state_string_long); + REG_FUNC(cellSsl, SSL_version); + REG_FUNC(cellSsl, SSL_want); + REG_FUNC(cellSsl, SSL_write); - REG_FUNC(cellSsl, SSLCERT_free); - REG_FUNC(cellSsl, SSLCERT_from_binary); + REG_FUNC(cellSsl, SSLCERT_free); + REG_FUNC(cellSsl, SSLCERT_from_binary); - REG_FUNC(cellSsl, SSLCERT_check_private_key); - REG_FUNC(cellSsl, SSLCERT_get_basic_constraints_int); - REG_FUNC(cellSsl, SSLCERT_get_extension); - REG_FUNC(cellSsl, SSLCERT_get_issuer_name); - REG_FUNC(cellSsl, SSLCERT_get_notAfter); - REG_FUNC(cellSsl, SSLCERT_get_notBefore); - REG_FUNC(cellSsl, SSLCERT_get_pubkey); - REG_FUNC(cellSsl, SSLCERT_get_subject_name); + REG_FUNC(cellSsl, SSLCERT_check_private_key); + REG_FUNC(cellSsl, SSLCERT_get_basic_constraints_int); + REG_FUNC(cellSsl, SSLCERT_get_extension); + REG_FUNC(cellSsl, SSLCERT_get_issuer_name); + REG_FUNC(cellSsl, SSLCERT_get_notAfter); + REG_FUNC(cellSsl, SSLCERT_get_notBefore); + REG_FUNC(cellSsl, SSLCERT_get_pubkey); + REG_FUNC(cellSsl, SSLCERT_get_subject_name); - REG_FUNC(cellSsl, SSLCERT_NAME_cmp); - REG_FUNC(cellSsl, SSLCERT_NAME_ENTRY_get_info); - REG_FUNC(cellSsl, SSLCERT_NAME_get_entry); - REG_FUNC(cellSsl, SSLCERT_NAME_get_entry_count); - REG_FUNC(cellSsl, SSLCERT_NAME_oneline); + REG_FUNC(cellSsl, SSLCERT_NAME_cmp); + REG_FUNC(cellSsl, SSLCERT_NAME_ENTRY_get_info); + REG_FUNC(cellSsl, SSLCERT_NAME_get_entry); + REG_FUNC(cellSsl, SSLCERT_NAME_get_entry_count); + REG_FUNC(cellSsl, SSLCERT_NAME_oneline); - REG_FUNC(cellSsl, SSLCERT_OID_to_string); + REG_FUNC(cellSsl, SSLCERT_OID_to_string); - REG_FUNC(cellSsl, SSLCERT_verify); + REG_FUNC(cellSsl, SSLCERT_verify); - REG_FUNC(cellSsl, SSLv3_client_method); + REG_FUNC(cellSsl, SSLv3_client_method); - REG_FUNC(cellSsl, TLSv1_client_method); -}); + REG_FUNC(cellSsl, TLSv1_client_method); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSsl.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellSsl.h index a1f96aec7..835175354 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSsl.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSsl.h @@ -2,187 +2,175 @@ enum CellSslError : u32 { - CELL_SSL_ERROR_NOT_INITIALIZED = 0x80740001, - CELL_SSL_ERROR_ALREADY_INITIALIZED = 0x80740002, + CELL_SSL_ERROR_NOT_INITIALIZED = 0x80740001, + CELL_SSL_ERROR_ALREADY_INITIALIZED = 0x80740002, CELL_SSL_ERROR_INITIALIZATION_FAILED = 0x80740003, - CELL_SSL_ERROR_NO_BUFFER = 0x80740004, - CELL_SSL_ERROR_INVALID_CERTIFICATE = 0x80740005, - CELL_SSL_ERROR_UNRETRIEVABLE = 0x80740006, - CELL_SSL_ERROR_INVALID_FORMAT = 0x80740007, - CELL_SSL_ERROR_NOT_FOUND = 0x80740008, - CELL_SSL_ERROR_INVALID_TIME = 0x80740031, + CELL_SSL_ERROR_NO_BUFFER = 0x80740004, + CELL_SSL_ERROR_INVALID_CERTIFICATE = 0x80740005, + CELL_SSL_ERROR_UNRETRIEVABLE = 0x80740006, + CELL_SSL_ERROR_INVALID_FORMAT = 0x80740007, + CELL_SSL_ERROR_NOT_FOUND = 0x80740008, + CELL_SSL_ERROR_INVALID_TIME = 0x80740031, CELL_SSL_ERROR_INAVLID_NEGATIVE_TIME = 0x80740032, - CELL_SSL_ERROR_INCORRECT_TIME = 0x80740033, - CELL_SSL_ERROR_UNDEFINED_TIME_TYPE = 0x80740034, - CELL_SSL_ERROR_NO_MEMORY = 0x80740035, - CELL_SSL_ERROR_NO_STRING = 0x80740036, - CELL_SSL_ERROR_UNKNOWN_LOAD_CERT = 0x80740037 + CELL_SSL_ERROR_INCORRECT_TIME = 0x80740033, + CELL_SSL_ERROR_UNDEFINED_TIME_TYPE = 0x80740034, + CELL_SSL_ERROR_NO_MEMORY = 0x80740035, + CELL_SSL_ERROR_NO_STRING = 0x80740036, + CELL_SSL_ERROR_UNKNOWN_LOAD_CERT = 0x80740037 }; // Certificate load flags enum : u64 { - CELL_SSL_LOAD_CERT_SCE01 = 0x0000000000000001ULL, - CELL_SSL_LOAD_CERT_SCE02 = 0x0000000000000002ULL, - CELL_SSL_LOAD_CERT_SCE03 = 0x0000000000000004ULL, - CELL_SSL_LOAD_CERT_SCE04 = 0x0000000000000008ULL, - CELL_SSL_LOAD_CERT_SCE05 = 0x0000000000000010ULL, - CELL_SSL_LOAD_CERT_BALTIMORE_CT = 0x0000000000000020ULL, - CELL_SSL_LOAD_CERT_CLASS1_PCA_G2_V2 = 0x0000000000000040ULL, - CELL_SSL_LOAD_CERT_CLASS1_PCA_G3_V2 = 0x0000000000000080ULL, - CELL_SSL_LOAD_CERT_CLASS1_PCA_SS_V4 = 0x0000000000000100ULL, - CELL_SSL_LOAD_CERT_CLASS2_PCA_G2_V2 = 0x0000000000000200ULL, - CELL_SSL_LOAD_CERT_CLASS2_PCA_G3_V2 = 0x0000000000000400ULL, - CELL_SSL_LOAD_CERT_CLASS2_PCA_SS_V4 = 0x0000000000000800ULL, - CELL_SSL_LOAD_CERT_CLASS3_PCA_G2_V2 = 0x0000000000001000ULL, - CELL_SSL_LOAD_CERT_CLASS3_PCA_G3_V2 = 0x0000000000002000ULL, - CELL_SSL_LOAD_CERT_CLASS3_PCA_SS_V4 = 0x0000000000004000ULL, - CELL_SSL_LOAD_CERT_CLASS4_PCA_G2_V2 = 0x0000000000008000ULL, - CELL_SSL_LOAD_CERT_CLASS4_PCA_G3_V2 = 0x0000000000010000ULL, - CELL_SSL_LOAD_CERT_ENTRUST_NET_SS_CA = 0x0000000000020000ULL, - CELL_SSL_LOAD_CERT_EQUIFAX_SEC_CA = 0x0000000000040000ULL, - CELL_SSL_LOAD_CERT_EQUIFAX_SEC_EBUS1 = 0x0000000000080000ULL, - CELL_SSL_LOAD_CERT_GEOTRUST_GCA = 0x0000000000100000ULL, - CELL_SSL_LOAD_CERT_GLOBALSIGN_RCA = 0x0000000000200000ULL, - CELL_SSL_LOAD_CERT_GTE_CT_G_RCA = 0x0000000000400000ULL, - CELL_SSL_LOAD_CERT_GTE_CT_ROOT = 0x0000000000800000ULL, - CELL_SSL_LOAD_CERT_RSA1024_V1 = 0x0000000001000000ULL, - CELL_SSL_LOAD_CERT_RSA2048_V3 = 0x0000000002000000ULL, - CELL_SSL_LOAD_CERT_RSA_SECURE_SERVER = 0x0000000004000000ULL, - CELL_SSL_LOAD_CERT_THAWTE_PREM_SCA = 0x0000000008000000ULL, - CELL_SSL_LOAD_CERT_THAWTE_SCA = 0x0000000010000000ULL, - CELL_SSL_LOAD_CERT_VALICERT_CLASS2 = 0x0000000020000000ULL, - CELL_SSL_LOAD_CERT_VERISIGN_TSA_CA = 0x0000000040000000ULL, - CELL_SSL_LOAD_CERT_AAA_CERT_SERVICES = 0x0000000080000000ULL, - CELL_SSL_LOAD_CERT_ADDTRUST_EXT_CA = 0x0000000100000000ULL, - CELL_SSL_LOAD_CERT_UTN_USERFIRST_HW = 0x0000000200000000ULL, + CELL_SSL_LOAD_CERT_SCE01 = 0x0000000000000001ULL, + CELL_SSL_LOAD_CERT_SCE02 = 0x0000000000000002ULL, + CELL_SSL_LOAD_CERT_SCE03 = 0x0000000000000004ULL, + CELL_SSL_LOAD_CERT_SCE04 = 0x0000000000000008ULL, + CELL_SSL_LOAD_CERT_SCE05 = 0x0000000000000010ULL, + CELL_SSL_LOAD_CERT_BALTIMORE_CT = 0x0000000000000020ULL, + CELL_SSL_LOAD_CERT_CLASS1_PCA_G2_V2 = 0x0000000000000040ULL, + CELL_SSL_LOAD_CERT_CLASS1_PCA_G3_V2 = 0x0000000000000080ULL, + CELL_SSL_LOAD_CERT_CLASS1_PCA_SS_V4 = 0x0000000000000100ULL, + CELL_SSL_LOAD_CERT_CLASS2_PCA_G2_V2 = 0x0000000000000200ULL, + CELL_SSL_LOAD_CERT_CLASS2_PCA_G3_V2 = 0x0000000000000400ULL, + CELL_SSL_LOAD_CERT_CLASS2_PCA_SS_V4 = 0x0000000000000800ULL, + CELL_SSL_LOAD_CERT_CLASS3_PCA_G2_V2 = 0x0000000000001000ULL, + CELL_SSL_LOAD_CERT_CLASS3_PCA_G3_V2 = 0x0000000000002000ULL, + CELL_SSL_LOAD_CERT_CLASS3_PCA_SS_V4 = 0x0000000000004000ULL, + CELL_SSL_LOAD_CERT_CLASS4_PCA_G2_V2 = 0x0000000000008000ULL, + CELL_SSL_LOAD_CERT_CLASS4_PCA_G3_V2 = 0x0000000000010000ULL, + CELL_SSL_LOAD_CERT_ENTRUST_NET_SS_CA = 0x0000000000020000ULL, + CELL_SSL_LOAD_CERT_EQUIFAX_SEC_CA = 0x0000000000040000ULL, + CELL_SSL_LOAD_CERT_EQUIFAX_SEC_EBUS1 = 0x0000000000080000ULL, + CELL_SSL_LOAD_CERT_GEOTRUST_GCA = 0x0000000000100000ULL, + CELL_SSL_LOAD_CERT_GLOBALSIGN_RCA = 0x0000000000200000ULL, + CELL_SSL_LOAD_CERT_GTE_CT_G_RCA = 0x0000000000400000ULL, + CELL_SSL_LOAD_CERT_GTE_CT_ROOT = 0x0000000000800000ULL, + CELL_SSL_LOAD_CERT_RSA1024_V1 = 0x0000000001000000ULL, + CELL_SSL_LOAD_CERT_RSA2048_V3 = 0x0000000002000000ULL, + CELL_SSL_LOAD_CERT_RSA_SECURE_SERVER = 0x0000000004000000ULL, + CELL_SSL_LOAD_CERT_THAWTE_PREM_SCA = 0x0000000008000000ULL, + CELL_SSL_LOAD_CERT_THAWTE_SCA = 0x0000000010000000ULL, + CELL_SSL_LOAD_CERT_VALICERT_CLASS2 = 0x0000000020000000ULL, + CELL_SSL_LOAD_CERT_VERISIGN_TSA_CA = 0x0000000040000000ULL, + CELL_SSL_LOAD_CERT_AAA_CERT_SERVICES = 0x0000000080000000ULL, + CELL_SSL_LOAD_CERT_ADDTRUST_EXT_CA = 0x0000000100000000ULL, + CELL_SSL_LOAD_CERT_UTN_USERFIRST_HW = 0x0000000200000000ULL, CELL_SSL_LOAD_CERT_EQUIFAX_SEC_G_EBUS1 = 0x0000000400000000ULL, - CELL_SSL_LOAD_CERT_CLASS3_PCA_G5 = 0x0000000800000000ULL, - CELL_SSL_LOAD_CERT_DIGICERT_HA_EV_RCA = 0x0000001000000000ULL, - CELL_SSL_LOAD_CERT_DIGICERT_A_ID_RCA = 0x0000002000000000ULL, + CELL_SSL_LOAD_CERT_CLASS3_PCA_G5 = 0x0000000800000000ULL, + CELL_SSL_LOAD_CERT_DIGICERT_HA_EV_RCA = 0x0000001000000000ULL, + CELL_SSL_LOAD_CERT_DIGICERT_A_ID_RCA = 0x0000002000000000ULL, CELL_SSL_LOAD_CERT_DIGICERT_GLOBAL_RCA = 0x0000004000000000ULL, - CELL_SSL_LOAD_CERT_CT_G_ROOT = 0x0000008000000000ULL, - CELL_SSL_LOAD_CERT_ENTRUST_CA2048 = 0x0000010000000000ULL, - CELL_SSL_LOAD_CERT_ENTRUST_RCA = 0x0000020000000000ULL, - CELL_SSL_LOAD_CERT_GLOBALSIGN_RCA_R2 = 0x0000040000000000ULL, - CELL_SSL_LOAD_CERT_GODADDY_CLASS2_CA = 0x0000080000000000ULL, + CELL_SSL_LOAD_CERT_CT_G_ROOT = 0x0000008000000000ULL, + CELL_SSL_LOAD_CERT_ENTRUST_CA2048 = 0x0000010000000000ULL, + CELL_SSL_LOAD_CERT_ENTRUST_RCA = 0x0000020000000000ULL, + CELL_SSL_LOAD_CERT_GLOBALSIGN_RCA_R2 = 0x0000040000000000ULL, + CELL_SSL_LOAD_CERT_GODADDY_CLASS2_CA = 0x0000080000000000ULL, CELL_SSL_LOAD_CERT_STARFIELD_CLASS2_CA = 0x0000100000000000ULL, - CELL_SSL_LOAD_CERT_STARFIELD_S_RC = 0x0000200000000000ULL, - CELL_SSL_LOAD_CERT_THATE_PRIMARY_RCA = 0x0000400000000000ULL, - CELL_SSL_LOAD_CERT_VALICERT_CLASS1_VA = 0x0000800000000000ULL, - CELL_SSL_LOAD_CERT_SECOM_RCA1 = 0x0001000000000000ULL, - CELL_SSL_LOAD_CERT_SECURE_TRUST_CA = 0x0002000000000000ULL, - CELL_SSL_LOAD_CERT_ENTRUST_RCA_G2 = 0x0004000000000000ULL, - CELL_SSL_LOAD_CERT_VERISIGN_U_RCA = 0x0008000000000000ULL, - CELL_SSL_LOAD_CERT_GODADDY_C2_CA_G2 = 0x0010000000000000ULL, - CELL_SSL_LOAD_CERT_STARFIELD_C2_CA_G2 = 0x0020000000000000ULL, - CELL_SSL_LOAD_CERT_STARFIELD_S_RC_G2 = 0x0040000000000000ULL, - CELL_SSL_LOAD_CERT_STARTCOM_CA = 0x0080000000000000ULL, - CELL_SSL_LOAD_CERT_STARTCOM_CA_G2 = 0x0100000000000000ULL, - CELL_SSL_LOAD_CERT_SECOM_RCA2 = 0x0200000000000000ULL, + CELL_SSL_LOAD_CERT_STARFIELD_S_RC = 0x0000200000000000ULL, + CELL_SSL_LOAD_CERT_THATE_PRIMARY_RCA = 0x0000400000000000ULL, + CELL_SSL_LOAD_CERT_VALICERT_CLASS1_VA = 0x0000800000000000ULL, + CELL_SSL_LOAD_CERT_SECOM_RCA1 = 0x0001000000000000ULL, + CELL_SSL_LOAD_CERT_SECURE_TRUST_CA = 0x0002000000000000ULL, + CELL_SSL_LOAD_CERT_ENTRUST_RCA_G2 = 0x0004000000000000ULL, + CELL_SSL_LOAD_CERT_VERISIGN_U_RCA = 0x0008000000000000ULL, + CELL_SSL_LOAD_CERT_GODADDY_C2_CA_G2 = 0x0010000000000000ULL, + CELL_SSL_LOAD_CERT_STARFIELD_C2_CA_G2 = 0x0020000000000000ULL, + CELL_SSL_LOAD_CERT_STARFIELD_S_RC_G2 = 0x0040000000000000ULL, + CELL_SSL_LOAD_CERT_STARTCOM_CA = 0x0080000000000000ULL, + CELL_SSL_LOAD_CERT_STARTCOM_CA_G2 = 0x0100000000000000ULL, + CELL_SSL_LOAD_CERT_SECOM_RCA2 = 0x0200000000000000ULL, // Composite Flags CELL_SSL_LOAD_CERT_SCE = - ( - CELL_SSL_LOAD_CERT_SCE01 | - CELL_SSL_LOAD_CERT_SCE02 | - CELL_SSL_LOAD_CERT_SCE03 | - CELL_SSL_LOAD_CERT_SCE04 | - CELL_SSL_LOAD_CERT_SCE05 - ), + (CELL_SSL_LOAD_CERT_SCE01 | + CELL_SSL_LOAD_CERT_SCE02 | + CELL_SSL_LOAD_CERT_SCE03 | + CELL_SSL_LOAD_CERT_SCE04 | + CELL_SSL_LOAD_CERT_SCE05), CELL_SSL_LOAD_CERT_SHA256 = - ( - CELL_SSL_LOAD_CERT_GLOBALSIGN_RCA_R2 | - CELL_SSL_LOAD_CERT_ENTRUST_RCA_G2 | - CELL_SSL_LOAD_CERT_VERISIGN_U_RCA | - CELL_SSL_LOAD_CERT_GODADDY_C2_CA_G2 | - CELL_SSL_LOAD_CERT_STARFIELD_C2_CA_G2 | - CELL_SSL_LOAD_CERT_STARFIELD_S_RC_G2 | - CELL_SSL_LOAD_CERT_STARTCOM_CA | - CELL_SSL_LOAD_CERT_STARTCOM_CA_G2 | - CELL_SSL_LOAD_CERT_SECOM_RCA2 - ), + (CELL_SSL_LOAD_CERT_GLOBALSIGN_RCA_R2 | + CELL_SSL_LOAD_CERT_ENTRUST_RCA_G2 | + CELL_SSL_LOAD_CERT_VERISIGN_U_RCA | + CELL_SSL_LOAD_CERT_GODADDY_C2_CA_G2 | + CELL_SSL_LOAD_CERT_STARFIELD_C2_CA_G2 | + CELL_SSL_LOAD_CERT_STARFIELD_S_RC_G2 | + CELL_SSL_LOAD_CERT_STARTCOM_CA | + CELL_SSL_LOAD_CERT_STARTCOM_CA_G2 | + CELL_SSL_LOAD_CERT_SECOM_RCA2), CELL_SSL_LOAD_CERT_NORMAL = - ( - CELL_SSL_LOAD_CERT_BALTIMORE_CT | - CELL_SSL_LOAD_CERT_CLASS3_PCA_G2_V2 | - CELL_SSL_LOAD_CERT_CLASS3_PCA_G3_V2 | - CELL_SSL_LOAD_CERT_CLASS3_PCA_SS_V4 | - CELL_SSL_LOAD_CERT_ENTRUST_NET_SS_CA | - CELL_SSL_LOAD_CERT_EQUIFAX_SEC_CA | - CELL_SSL_LOAD_CERT_EQUIFAX_SEC_EBUS1 | - CELL_SSL_LOAD_CERT_GEOTRUST_GCA | - CELL_SSL_LOAD_CERT_GLOBALSIGN_RCA | - CELL_SSL_LOAD_CERT_GTE_CT_G_RCA | - CELL_SSL_LOAD_CERT_RSA1024_V1 | - CELL_SSL_LOAD_CERT_RSA2048_V3 | - CELL_SSL_LOAD_CERT_THAWTE_PREM_SCA | - CELL_SSL_LOAD_CERT_THAWTE_SCA | - CELL_SSL_LOAD_CERT_VALICERT_CLASS2 | - CELL_SSL_LOAD_CERT_AAA_CERT_SERVICES | - CELL_SSL_LOAD_CERT_ADDTRUST_EXT_CA | - CELL_SSL_LOAD_CERT_UTN_USERFIRST_HW | - CELL_SSL_LOAD_CERT_EQUIFAX_SEC_G_EBUS1 | - CELL_SSL_LOAD_CERT_CLASS3_PCA_G5 | - CELL_SSL_LOAD_CERT_DIGICERT_HA_EV_RCA | - CELL_SSL_LOAD_CERT_DIGICERT_A_ID_RCA | - CELL_SSL_LOAD_CERT_DIGICERT_GLOBAL_RCA | - CELL_SSL_LOAD_CERT_CT_G_ROOT | - CELL_SSL_LOAD_CERT_ENTRUST_CA2048 | - CELL_SSL_LOAD_CERT_ENTRUST_RCA | - CELL_SSL_LOAD_CERT_GODADDY_CLASS2_CA | - CELL_SSL_LOAD_CERT_STARFIELD_CLASS2_CA | - CELL_SSL_LOAD_CERT_STARFIELD_S_RC | - CELL_SSL_LOAD_CERT_THATE_PRIMARY_RCA | - CELL_SSL_LOAD_CERT_VALICERT_CLASS1_VA | - CELL_SSL_LOAD_CERT_SECOM_RCA1 | - CELL_SSL_LOAD_CERT_SECURE_TRUST_CA | - CELL_SSL_LOAD_CERT_SHA256 - ), + (CELL_SSL_LOAD_CERT_BALTIMORE_CT | + CELL_SSL_LOAD_CERT_CLASS3_PCA_G2_V2 | + CELL_SSL_LOAD_CERT_CLASS3_PCA_G3_V2 | + CELL_SSL_LOAD_CERT_CLASS3_PCA_SS_V4 | + CELL_SSL_LOAD_CERT_ENTRUST_NET_SS_CA | + CELL_SSL_LOAD_CERT_EQUIFAX_SEC_CA | + CELL_SSL_LOAD_CERT_EQUIFAX_SEC_EBUS1 | + CELL_SSL_LOAD_CERT_GEOTRUST_GCA | + CELL_SSL_LOAD_CERT_GLOBALSIGN_RCA | + CELL_SSL_LOAD_CERT_GTE_CT_G_RCA | + CELL_SSL_LOAD_CERT_RSA1024_V1 | + CELL_SSL_LOAD_CERT_RSA2048_V3 | + CELL_SSL_LOAD_CERT_THAWTE_PREM_SCA | + CELL_SSL_LOAD_CERT_THAWTE_SCA | + CELL_SSL_LOAD_CERT_VALICERT_CLASS2 | + CELL_SSL_LOAD_CERT_AAA_CERT_SERVICES | + CELL_SSL_LOAD_CERT_ADDTRUST_EXT_CA | + CELL_SSL_LOAD_CERT_UTN_USERFIRST_HW | + CELL_SSL_LOAD_CERT_EQUIFAX_SEC_G_EBUS1 | + CELL_SSL_LOAD_CERT_CLASS3_PCA_G5 | + CELL_SSL_LOAD_CERT_DIGICERT_HA_EV_RCA | + CELL_SSL_LOAD_CERT_DIGICERT_A_ID_RCA | + CELL_SSL_LOAD_CERT_DIGICERT_GLOBAL_RCA | + CELL_SSL_LOAD_CERT_CT_G_ROOT | + CELL_SSL_LOAD_CERT_ENTRUST_CA2048 | + CELL_SSL_LOAD_CERT_ENTRUST_RCA | + CELL_SSL_LOAD_CERT_GODADDY_CLASS2_CA | + CELL_SSL_LOAD_CERT_STARFIELD_CLASS2_CA | + CELL_SSL_LOAD_CERT_STARFIELD_S_RC | + CELL_SSL_LOAD_CERT_THATE_PRIMARY_RCA | + CELL_SSL_LOAD_CERT_VALICERT_CLASS1_VA | + CELL_SSL_LOAD_CERT_SECOM_RCA1 | + CELL_SSL_LOAD_CERT_SECURE_TRUST_CA | + CELL_SSL_LOAD_CERT_SHA256), CELL_SSL_LOAD_CERT_ALL = - ( - CELL_SSL_LOAD_CERT_SCE | - CELL_SSL_LOAD_CERT_NORMAL - ), + (CELL_SSL_LOAD_CERT_SCE | + CELL_SSL_LOAD_CERT_NORMAL), CELL_SSL_LOAD_CERT_OBSOLETE = - ( - CELL_SSL_LOAD_CERT_RSA_SECURE_SERVER | - CELL_SSL_LOAD_CERT_VERISIGN_TSA_CA | - CELL_SSL_LOAD_CERT_GTE_CT_ROOT - ), + (CELL_SSL_LOAD_CERT_RSA_SECURE_SERVER | + CELL_SSL_LOAD_CERT_VERISIGN_TSA_CA | + CELL_SSL_LOAD_CERT_GTE_CT_ROOT), CELL_SSL_LOAD_CERT_NOT_FOR_SERVER = - ( - CELL_SSL_LOAD_CERT_CLASS1_PCA_G2_V2 | - CELL_SSL_LOAD_CERT_CLASS1_PCA_G3_V2 | - CELL_SSL_LOAD_CERT_CLASS1_PCA_SS_V4 | - CELL_SSL_LOAD_CERT_CLASS2_PCA_G2_V2 | - CELL_SSL_LOAD_CERT_CLASS2_PCA_G3_V2 | - CELL_SSL_LOAD_CERT_CLASS2_PCA_SS_V4 | - CELL_SSL_LOAD_CERT_CLASS4_PCA_G2_V2 | - CELL_SSL_LOAD_CERT_CLASS4_PCA_G3_V2 - ), + (CELL_SSL_LOAD_CERT_CLASS1_PCA_G2_V2 | + CELL_SSL_LOAD_CERT_CLASS1_PCA_G3_V2 | + CELL_SSL_LOAD_CERT_CLASS1_PCA_SS_V4 | + CELL_SSL_LOAD_CERT_CLASS2_PCA_G2_V2 | + CELL_SSL_LOAD_CERT_CLASS2_PCA_G3_V2 | + CELL_SSL_LOAD_CERT_CLASS2_PCA_SS_V4 | + CELL_SSL_LOAD_CERT_CLASS4_PCA_G2_V2 | + CELL_SSL_LOAD_CERT_CLASS4_PCA_G3_V2), }; enum // Cipher { - CELL_SSL_CIPHER_UNKNOWN = -1, - CELL_SSL_CIPHER_RSA_WITH_3DES_EDE_CBC_SHA = 0, - CELL_SSL_CIPHER_RSA_WITH_RC4_128_SHA = 1, - CELL_SSL_CIPHER_RSA_WITH_RC4_128_MD5 = 2, - CELL_SSL_CIPHER_RSA_WITH_DES_CBC_SHA = 3, + CELL_SSL_CIPHER_UNKNOWN = -1, + CELL_SSL_CIPHER_RSA_WITH_3DES_EDE_CBC_SHA = 0, + CELL_SSL_CIPHER_RSA_WITH_RC4_128_SHA = 1, + CELL_SSL_CIPHER_RSA_WITH_RC4_128_MD5 = 2, + CELL_SSL_CIPHER_RSA_WITH_DES_CBC_SHA = 3, CELL_SSL_CIPHER_RSA_EXPORT1024_WITH_DES_CBC_SHA = 4, - CELL_SSL_CIPHER_RSA_EXPORT1024_WITH_RC4_56_SHA = 5, - CELL_SSL_CIPHER_RSA_EXPORT_WITH_DES40_CBC_SHA = 6, - CELL_SSL_CIPHER_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = 7, - CELL_SSL_CIPHER_RSA_EXPORT_WITH_RC4_40_MD5 = 8 + CELL_SSL_CIPHER_RSA_EXPORT1024_WITH_RC4_56_SHA = 5, + CELL_SSL_CIPHER_RSA_EXPORT_WITH_DES40_CBC_SHA = 6, + CELL_SSL_CIPHER_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = 7, + CELL_SSL_CIPHER_RSA_EXPORT_WITH_RC4_40_MD5 = 8 }; enum // Version { CELL_SSL_VERSION_UNKNOWN = -1, - CELL_SSL_VERSION_TLS1 = 0, - CELL_SSL_VERSION_SSL3 = 1 + CELL_SSL_VERSION_TLS1 = 0, + CELL_SSL_VERSION_SSL3 = 1 }; enum // Other Constants @@ -192,16 +180,16 @@ enum // Other Constants enum SpecialCerts { - BaltimoreCert = 6, - Class3G2V2Cert = 13, - ClassSSV4Cert = 15, - EntrustNetCert = 18, + BaltimoreCert = 6, + Class3G2V2Cert = 13, + ClassSSV4Cert = 15, + EntrustNetCert = 18, GTECyberTrustGlobalCert = 23 }; struct ssl_manager { - atomic_t is_init{ false }; + atomic_t is_init{false}; }; b8 _cellSslIsInitd(); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellStorage.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellStorage.cpp index 6c66699c7..b569d853f 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellStorage.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellStorage.cpp @@ -9,18 +9,18 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_STORAGEDATA_ERROR_ACCESS_ERROR); - STR_CASE(CELL_STORAGEDATA_ERROR_INTERNAL); - STR_CASE(CELL_STORAGEDATA_ERROR_PARAM); - STR_CASE(CELL_STORAGEDATA_ERROR_FAILURE); - STR_CASE(CELL_STORAGEDATA_ERROR_BUSY); - } + switch (error) + { + STR_CASE(CELL_STORAGEDATA_ERROR_ACCESS_ERROR); + STR_CASE(CELL_STORAGEDATA_ERROR_INTERNAL); + STR_CASE(CELL_STORAGEDATA_ERROR_PARAM); + STR_CASE(CELL_STORAGEDATA_ERROR_FAILURE); + STR_CASE(CELL_STORAGEDATA_ERROR_BUSY); + } - return unknown; - }); + return unknown; + }); } error_code cellStorageDataImportMove(u32 version, vm::ptr srcMediaFile, vm::ptr dstHddDir, vm::ptr param, vm::ptr funcFinish, u32 container, vm::ptr userdata) @@ -28,10 +28,10 @@ error_code cellStorageDataImportMove(u32 version, vm::ptr srcMediaFile, vm cellSysutil.todo("cellStorageDataImportMove(version=0x%x, srcMediaFile=%s, dstHddDir=%s, param=*0x%x, funcFinish=*0x%x, container=0x%x, userdata=*0x%x)", version, srcMediaFile, dstHddDir, param, funcFinish, container, userdata); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -41,10 +41,10 @@ error_code cellStorageDataImport(u32 version, vm::ptr srcMediaFile, vm::pt cellSysutil.todo("cellStorageDataImport(version=0x%x, srcMediaFile=%s, dstHddDir=%s, param=*0x%x, funcFinish=*0x%x, container=0x%x, userdata=*0x%x)", version, srcMediaFile, dstHddDir, param, funcFinish, container, userdata); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -54,10 +54,10 @@ error_code cellStorageDataExport(u32 version, vm::ptr srcHddFile, vm::ptr< cellSysutil.todo("cellStorageDataExport(version=0x%x, srcHddFile=%s, dstMediaDir=%s, param=*0x%x, funcFinish=*0x%x, container=0x%x, userdata=*0x%x)", version, srcHddFile, dstMediaDir, param, funcFinish, container, userdata); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellStorage.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellStorage.h index 71e937dea..7676abdd9 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellStorage.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellStorage.h @@ -2,26 +2,26 @@ enum CellStorageError : u32 { - CELL_STORAGEDATA_ERROR_BUSY = 0x8002be01, - CELL_STORAGEDATA_ERROR_INTERNAL = 0x8002be02, - CELL_STORAGEDATA_ERROR_PARAM = 0x8002be03, + CELL_STORAGEDATA_ERROR_BUSY = 0x8002be01, + CELL_STORAGEDATA_ERROR_INTERNAL = 0x8002be02, + CELL_STORAGEDATA_ERROR_PARAM = 0x8002be03, CELL_STORAGEDATA_ERROR_ACCESS_ERROR = 0x8002be04, - CELL_STORAGEDATA_ERROR_FAILURE = 0x8002be05 + CELL_STORAGEDATA_ERROR_FAILURE = 0x8002be05 }; enum CellStorageDataVersion { - CELL_STORAGEDATA_VERSION_CURRENT = 0, + CELL_STORAGEDATA_VERSION_CURRENT = 0, CELL_STORAGEDATA_VERSION_DST_FILENAME = 1, }; enum CellStorageDataParamSize { - CELL_STORAGEDATA_HDD_PATH_MAX = 1055, + CELL_STORAGEDATA_HDD_PATH_MAX = 1055, CELL_STORAGEDATA_MEDIA_PATH_MAX = 1024, - CELL_STORAGEDATA_FILENAME_MAX = 64, - CELL_STORAGEDATA_FILESIZE_MAX = 1024 * 1024 * 1024, - CELL_STORAGEDATA_TITLE_MAX = 256 + CELL_STORAGEDATA_FILENAME_MAX = 64, + CELL_STORAGEDATA_FILESIZE_MAX = 1024 * 1024 * 1024, + CELL_STORAGEDATA_TITLE_MAX = 256 }; inline const char* CELL_STORAGEDATA_IMPORT_FILENAME = "IMPORT.BIN"; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSubDisplay.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSubDisplay.cpp index 2a19d2e66..6e7f0b54e 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSubDisplay.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSubDisplay.cpp @@ -6,26 +6,26 @@ LOG_CHANNEL(cellSubDisplay); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SUBDISPLAY_ERROR_OUT_OF_MEMORY); - STR_CASE(CELL_SUBDISPLAY_ERROR_FATAL); - STR_CASE(CELL_SUBDISPLAY_ERROR_NOT_FOUND); - STR_CASE(CELL_SUBDISPLAY_ERROR_INVALID_VALUE); - STR_CASE(CELL_SUBDISPLAY_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_SUBDISPLAY_ERROR_NOT_SUPPORTED); - STR_CASE(CELL_SUBDISPLAY_ERROR_SET_SAMPLE); - STR_CASE(CELL_SUBDISPLAY_ERROR_AUDIOOUT_IS_BUSY); - STR_CASE(CELL_SUBDISPLAY_ERROR_ZERO_REGISTERED); - } + switch (error) + { + STR_CASE(CELL_SUBDISPLAY_ERROR_OUT_OF_MEMORY); + STR_CASE(CELL_SUBDISPLAY_ERROR_FATAL); + STR_CASE(CELL_SUBDISPLAY_ERROR_NOT_FOUND); + STR_CASE(CELL_SUBDISPLAY_ERROR_INVALID_VALUE); + STR_CASE(CELL_SUBDISPLAY_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_SUBDISPLAY_ERROR_NOT_SUPPORTED); + STR_CASE(CELL_SUBDISPLAY_ERROR_SET_SAMPLE); + STR_CASE(CELL_SUBDISPLAY_ERROR_AUDIOOUT_IS_BUSY); + STR_CASE(CELL_SUBDISPLAY_ERROR_ZERO_REGISTERED); + } - return unknown; - }); + return unknown; + }); } enum class sub_display_status : u32 @@ -54,7 +54,6 @@ struct sub_display_manager std::array touch_info{}; }; - error_code check_param(CellSubDisplayParam* param) { if (!param || @@ -183,10 +182,10 @@ error_code cellSubDisplayGetRequiredMemory(vm::ptr pParam) switch (pParam->version) { - case CELL_SUBDISPLAY_VERSION_0001: return not_an_error(CELL_SUBDISPLAY_0001_MEMORY_CONTAINER_SIZE); - case CELL_SUBDISPLAY_VERSION_0002: return not_an_error(CELL_SUBDISPLAY_0002_MEMORY_CONTAINER_SIZE); - case CELL_SUBDISPLAY_VERSION_0003: return not_an_error(CELL_SUBDISPLAY_0003_MEMORY_CONTAINER_SIZE); - default: break; + case CELL_SUBDISPLAY_VERSION_0001: return not_an_error(CELL_SUBDISPLAY_0001_MEMORY_CONTAINER_SIZE); + case CELL_SUBDISPLAY_VERSION_0002: return not_an_error(CELL_SUBDISPLAY_0002_MEMORY_CONTAINER_SIZE); + case CELL_SUBDISPLAY_VERSION_0003: return not_an_error(CELL_SUBDISPLAY_0003_MEMORY_CONTAINER_SIZE); + default: break; } return CELL_SUBDISPLAY_ERROR_INVALID_VALUE; @@ -392,23 +391,23 @@ error_code cellSubDisplayGetTouchInfo(s32 groupId, vm::ptr +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SYNC_ERROR_AGAIN); - STR_CASE(CELL_SYNC_ERROR_INVAL); - STR_CASE(CELL_SYNC_ERROR_NOSYS); - STR_CASE(CELL_SYNC_ERROR_NOMEM); - STR_CASE(CELL_SYNC_ERROR_SRCH); - STR_CASE(CELL_SYNC_ERROR_NOENT); - STR_CASE(CELL_SYNC_ERROR_NOEXEC); - STR_CASE(CELL_SYNC_ERROR_DEADLK); - STR_CASE(CELL_SYNC_ERROR_PERM); - STR_CASE(CELL_SYNC_ERROR_BUSY); - STR_CASE(CELL_SYNC_ERROR_ABORT); - STR_CASE(CELL_SYNC_ERROR_FAULT); - STR_CASE(CELL_SYNC_ERROR_CHILD); - STR_CASE(CELL_SYNC_ERROR_STAT); - STR_CASE(CELL_SYNC_ERROR_ALIGN); - STR_CASE(CELL_SYNC_ERROR_NULL_POINTER); - STR_CASE(CELL_SYNC_ERROR_NOT_SUPPORTED_THREAD); - STR_CASE(CELL_SYNC_ERROR_NO_NOTIFIER); - STR_CASE(CELL_SYNC_ERROR_NO_SPU_CONTEXT_STORAGE); - } + switch (error) + { + STR_CASE(CELL_SYNC_ERROR_AGAIN); + STR_CASE(CELL_SYNC_ERROR_INVAL); + STR_CASE(CELL_SYNC_ERROR_NOSYS); + STR_CASE(CELL_SYNC_ERROR_NOMEM); + STR_CASE(CELL_SYNC_ERROR_SRCH); + STR_CASE(CELL_SYNC_ERROR_NOENT); + STR_CASE(CELL_SYNC_ERROR_NOEXEC); + STR_CASE(CELL_SYNC_ERROR_DEADLK); + STR_CASE(CELL_SYNC_ERROR_PERM); + STR_CASE(CELL_SYNC_ERROR_BUSY); + STR_CASE(CELL_SYNC_ERROR_ABORT); + STR_CASE(CELL_SYNC_ERROR_FAULT); + STR_CASE(CELL_SYNC_ERROR_CHILD); + STR_CASE(CELL_SYNC_ERROR_STAT); + STR_CASE(CELL_SYNC_ERROR_ALIGN); + STR_CASE(CELL_SYNC_ERROR_NULL_POINTER); + STR_CASE(CELL_SYNC_ERROR_NOT_SUPPORTED_THREAD); + STR_CASE(CELL_SYNC_ERROR_NO_NOTIFIER); + STR_CASE(CELL_SYNC_ERROR_NO_SPU_CONTEXT_STORAGE); + } - return unknown; - }); + return unknown; + }); } error_code cellSyncMutexInitialize(vm::ptr mutex) @@ -273,7 +273,7 @@ error_code cellSyncRwmInitialize(vm::ptr rwm, vm::ptr buffer, } // clear readers and writers, write buffer_size, buffer addr and sync - rwm->ctrl.store({ 0, 0 }); + rwm->ctrl.store({0, 0}); rwm->size = buffer_size; rwm->buffer = buffer; @@ -385,7 +385,7 @@ error_code cellSyncRwmWrite(ppu_thread& ppu, vm::ptr rwm, vm::cptr< std::memcpy(rwm->buffer.get_ptr(), buffer.get_ptr(), rwm->size); // sync and clear `readers` and `writers` - rwm->ctrl.exchange({ 0, 0 }); + rwm->ctrl.exchange({0, 0}); return CELL_OK; } @@ -405,7 +405,7 @@ error_code cellSyncRwmTryWrite(vm::ptr rwm, vm::cptr buffer) } // set `writers` to 1 if `readers` and `writers` are zero - if (!rwm->ctrl.compare_and_swap_test({ 0, 0 }, { 0, 1 })) + if (!rwm->ctrl.compare_and_swap_test({0, 0}, {0, 1})) { return not_an_error(CELL_SYNC_ERROR_BUSY); } @@ -414,7 +414,7 @@ error_code cellSyncRwmTryWrite(vm::ptr rwm, vm::cptr buffer) std::memcpy(rwm->buffer.get_ptr(), buffer.get_ptr(), rwm->size); // sync and clear `readers` and `writers` - rwm->ctrl.exchange({ 0, 0 }); + rwm->ctrl.exchange({0, 0}); return CELL_OK; } @@ -473,9 +473,9 @@ error_code cellSyncQueuePush(ppu_thread& ppu, vm::ptr queue, vm:: u32 position; while (!queue->ctrl.atomic_op([&](CellSyncQueue::ctrl_t& ctrl) - { - return CellSyncQueue::try_push_begin(ctrl, depth, &position); - })) + { + return CellSyncQueue::try_push_begin(ctrl, depth, &position); + })) { if (ppu.test_stopped()) { @@ -510,9 +510,9 @@ error_code cellSyncQueueTryPush(vm::ptr queue, vm::cptr buf u32 position; while (!queue->ctrl.atomic_op([&](CellSyncQueue::ctrl_t& ctrl) - { - return CellSyncQueue::try_push_begin(ctrl, depth, &position); - })) + { + return CellSyncQueue::try_push_begin(ctrl, depth, &position); + })) { return not_an_error(CELL_SYNC_ERROR_BUSY); } @@ -544,9 +544,9 @@ error_code cellSyncQueuePop(ppu_thread& ppu, vm::ptr queue, vm::p u32 position; while (!queue->ctrl.atomic_op([&](CellSyncQueue::ctrl_t& ctrl) - { - return CellSyncQueue::try_pop_begin(ctrl, depth, &position); - })) + { + return CellSyncQueue::try_pop_begin(ctrl, depth, &position); + })) { if (ppu.test_stopped()) { @@ -581,9 +581,9 @@ error_code cellSyncQueueTryPop(vm::ptr queue, vm::ptr buffe u32 position; while (!queue->ctrl.atomic_op([&](CellSyncQueue::ctrl_t& ctrl) - { - return CellSyncQueue::try_pop_begin(ctrl, depth, &position); - })) + { + return CellSyncQueue::try_pop_begin(ctrl, depth, &position); + })) { return not_an_error(CELL_SYNC_ERROR_BUSY); } @@ -615,9 +615,9 @@ error_code cellSyncQueuePeek(ppu_thread& ppu, vm::ptr queue, vm:: u32 position; while (!queue->ctrl.atomic_op([&](CellSyncQueue::ctrl_t& ctrl) - { - return CellSyncQueue::try_peek_begin(ctrl, depth, &position); - })) + { + return CellSyncQueue::try_peek_begin(ctrl, depth, &position); + })) { if (ppu.test_stopped()) { @@ -652,9 +652,9 @@ error_code cellSyncQueueTryPeek(vm::ptr queue, vm::ptr buff u32 position; while (!queue->ctrl.atomic_op([&](CellSyncQueue::ctrl_t& ctrl) - { - return CellSyncQueue::try_peek_begin(ctrl, depth, &position); - })) + { + return CellSyncQueue::try_peek_begin(ctrl, depth, &position); + })) { return not_an_error(CELL_SYNC_ERROR_BUSY); } @@ -741,16 +741,16 @@ void syncLFQueueInitialize(vm::ptr queue, vm::cptr buffer queue->m_buffer.set(queue->m_buffer.addr() | 1); queue->m_bs[0] = -1; queue->m_bs[1] = -1; - //m_bs[2] - //m_bs[3] + // m_bs[2] + // m_bs[3] queue->m_v1 = -1; - queue->push2.store({ 0xffff }); - queue->pop2.store({ 0xffff }); + queue->push2.store({0xffff}); + queue->pop2.store({0xffff}); } else { - queue->pop1.store({ 0, 0, queue->pop1.load().m_h3, 0}); - queue->push1.store({ 0, 0, queue->push1.load().m_h7, 0 }); + queue->pop1.store({0, 0, queue->pop1.load().m_h3, 0}); + queue->push1.store({0, 0, queue->push1.load().m_h7, 0}); queue->m_bs[0] = -1; // written as u32 queue->m_bs[1] = -1; queue->m_bs[2] = -1; @@ -843,7 +843,8 @@ error_code cellSyncLFQueueInitialize(vm::ptr queue, vm::cptrinit.compare_and_swap_test(old, init)) break; + if (queue->init.compare_and_swap_test(old, init)) + break; } if (old_value == 2) @@ -1145,7 +1146,8 @@ error_code _cellSyncLFQueuePushBody(ppu_thread& ppu, vm::ptr qu if (!isBlocking || res + 0u != CELL_SYNC_ERROR_AGAIN) { - if (res) return not_an_error(res); + if (res) + return not_an_error(res); break; } @@ -1445,7 +1447,8 @@ error_code _cellSyncLFQueuePopBody(ppu_thread& ppu, vm::ptr que if (!isBlocking || res + 0u != CELL_SYNC_ERROR_AGAIN) { - if (res) return not_an_error(res); + if (res) + return not_an_error(res); break; } @@ -1518,7 +1521,8 @@ error_code cellSyncLFQueueClear(vm::ptr queue) pop.m_h3 = push.m_h7; pop.m_h4 = push.m_h8; - if (queue->pop1.compare_and_swap_test(old, pop)) break; + if (queue->pop1.compare_and_swap_test(old, pop)) + break; } return CELL_OK; @@ -1653,51 +1657,51 @@ error_code _cellSyncLFQueueDetachLv2EventQueue(vm::ptr spus, u32 num, vm::p } DECLARE(ppu_module_manager::cellSync)("cellSync", []() -{ - REG_FUNC(cellSync, cellSyncMutexInitialize); - REG_FUNC(cellSync, cellSyncMutexLock); - REG_FUNC(cellSync, cellSyncMutexTryLock); - REG_FUNC(cellSync, cellSyncMutexUnlock); + { + REG_FUNC(cellSync, cellSyncMutexInitialize); + REG_FUNC(cellSync, cellSyncMutexLock); + REG_FUNC(cellSync, cellSyncMutexTryLock); + REG_FUNC(cellSync, cellSyncMutexUnlock); - REG_FUNC(cellSync, cellSyncBarrierInitialize); - REG_FUNC(cellSync, cellSyncBarrierNotify); - REG_FUNC(cellSync, cellSyncBarrierTryNotify); - REG_FUNC(cellSync, cellSyncBarrierWait); - REG_FUNC(cellSync, cellSyncBarrierTryWait); + REG_FUNC(cellSync, cellSyncBarrierInitialize); + REG_FUNC(cellSync, cellSyncBarrierNotify); + REG_FUNC(cellSync, cellSyncBarrierTryNotify); + REG_FUNC(cellSync, cellSyncBarrierWait); + REG_FUNC(cellSync, cellSyncBarrierTryWait); - REG_FUNC(cellSync, cellSyncRwmInitialize); - REG_FUNC(cellSync, cellSyncRwmRead); - REG_FUNC(cellSync, cellSyncRwmTryRead); - REG_FUNC(cellSync, cellSyncRwmWrite); - REG_FUNC(cellSync, cellSyncRwmTryWrite); + REG_FUNC(cellSync, cellSyncRwmInitialize); + REG_FUNC(cellSync, cellSyncRwmRead); + REG_FUNC(cellSync, cellSyncRwmTryRead); + REG_FUNC(cellSync, cellSyncRwmWrite); + REG_FUNC(cellSync, cellSyncRwmTryWrite); - REG_FUNC(cellSync, cellSyncQueueInitialize); - REG_FUNC(cellSync, cellSyncQueuePush); - REG_FUNC(cellSync, cellSyncQueueTryPush); - REG_FUNC(cellSync, cellSyncQueuePop); - REG_FUNC(cellSync, cellSyncQueueTryPop); - REG_FUNC(cellSync, cellSyncQueuePeek); - REG_FUNC(cellSync, cellSyncQueueTryPeek); - REG_FUNC(cellSync, cellSyncQueueSize); - REG_FUNC(cellSync, cellSyncQueueClear); + REG_FUNC(cellSync, cellSyncQueueInitialize); + REG_FUNC(cellSync, cellSyncQueuePush); + REG_FUNC(cellSync, cellSyncQueueTryPush); + REG_FUNC(cellSync, cellSyncQueuePop); + REG_FUNC(cellSync, cellSyncQueueTryPop); + REG_FUNC(cellSync, cellSyncQueuePeek); + REG_FUNC(cellSync, cellSyncQueueTryPeek); + REG_FUNC(cellSync, cellSyncQueueSize); + REG_FUNC(cellSync, cellSyncQueueClear); - REG_FUNC(cellSync, cellSyncLFQueueGetEntrySize); - REG_FUNC(cellSync, cellSyncLFQueueSize); - REG_FUNC(cellSync, cellSyncLFQueueClear); - REG_FUNC(cellSync, _cellSyncLFQueueCompletePushPointer2); - REG_FUNC(cellSync, _cellSyncLFQueueGetPopPointer2); - REG_FUNC(cellSync, _cellSyncLFQueueCompletePushPointer); - REG_FUNC(cellSync, _cellSyncLFQueueAttachLv2EventQueue); - REG_FUNC(cellSync, _cellSyncLFQueueGetPushPointer2); - REG_FUNC(cellSync, _cellSyncLFQueueGetPopPointer); - REG_FUNC(cellSync, _cellSyncLFQueueCompletePopPointer2); - REG_FUNC(cellSync, _cellSyncLFQueueDetachLv2EventQueue); - REG_FUNC(cellSync, cellSyncLFQueueInitialize); - REG_FUNC(cellSync, _cellSyncLFQueueGetSignalAddress); - REG_FUNC(cellSync, _cellSyncLFQueuePushBody); - REG_FUNC(cellSync, cellSyncLFQueueGetDirection); - REG_FUNC(cellSync, cellSyncLFQueueDepth); - REG_FUNC(cellSync, _cellSyncLFQueuePopBody); - REG_FUNC(cellSync, _cellSyncLFQueueGetPushPointer); - REG_FUNC(cellSync, _cellSyncLFQueueCompletePopPointer); -}); + REG_FUNC(cellSync, cellSyncLFQueueGetEntrySize); + REG_FUNC(cellSync, cellSyncLFQueueSize); + REG_FUNC(cellSync, cellSyncLFQueueClear); + REG_FUNC(cellSync, _cellSyncLFQueueCompletePushPointer2); + REG_FUNC(cellSync, _cellSyncLFQueueGetPopPointer2); + REG_FUNC(cellSync, _cellSyncLFQueueCompletePushPointer); + REG_FUNC(cellSync, _cellSyncLFQueueAttachLv2EventQueue); + REG_FUNC(cellSync, _cellSyncLFQueueGetPushPointer2); + REG_FUNC(cellSync, _cellSyncLFQueueGetPopPointer); + REG_FUNC(cellSync, _cellSyncLFQueueCompletePopPointer2); + REG_FUNC(cellSync, _cellSyncLFQueueDetachLv2EventQueue); + REG_FUNC(cellSync, cellSyncLFQueueInitialize); + REG_FUNC(cellSync, _cellSyncLFQueueGetSignalAddress); + REG_FUNC(cellSync, _cellSyncLFQueuePushBody); + REG_FUNC(cellSync, cellSyncLFQueueGetDirection); + REG_FUNC(cellSync, cellSyncLFQueueDepth); + REG_FUNC(cellSync, _cellSyncLFQueuePopBody); + REG_FUNC(cellSync, _cellSyncLFQueueGetPushPointer); + REG_FUNC(cellSync, _cellSyncLFQueueCompletePopPointer); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSync.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellSync.h index 920d82d64..c4f0c6915 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSync.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSync.h @@ -9,31 +9,31 @@ // Return Codes enum CellSyncError : u32 { - CELL_SYNC_ERROR_AGAIN = 0x80410101, - CELL_SYNC_ERROR_INVAL = 0x80410102, - CELL_SYNC_ERROR_NOSYS = 0x80410103, - CELL_SYNC_ERROR_NOMEM = 0x80410104, - CELL_SYNC_ERROR_SRCH = 0x80410105, - CELL_SYNC_ERROR_NOENT = 0x80410106, - CELL_SYNC_ERROR_NOEXEC = 0x80410107, - CELL_SYNC_ERROR_DEADLK = 0x80410108, - CELL_SYNC_ERROR_PERM = 0x80410109, - CELL_SYNC_ERROR_BUSY = 0x8041010A, - CELL_SYNC_ERROR_ABORT = 0x8041010C, - CELL_SYNC_ERROR_FAULT = 0x8041010D, - CELL_SYNC_ERROR_CHILD = 0x8041010E, - CELL_SYNC_ERROR_STAT = 0x8041010F, - CELL_SYNC_ERROR_ALIGN = 0x80410110, - CELL_SYNC_ERROR_NULL_POINTER = 0x80410111, - CELL_SYNC_ERROR_NOT_SUPPORTED_THREAD = 0x80410112, - CELL_SYNC_ERROR_NO_NOTIFIER = 0x80410113, + CELL_SYNC_ERROR_AGAIN = 0x80410101, + CELL_SYNC_ERROR_INVAL = 0x80410102, + CELL_SYNC_ERROR_NOSYS = 0x80410103, + CELL_SYNC_ERROR_NOMEM = 0x80410104, + CELL_SYNC_ERROR_SRCH = 0x80410105, + CELL_SYNC_ERROR_NOENT = 0x80410106, + CELL_SYNC_ERROR_NOEXEC = 0x80410107, + CELL_SYNC_ERROR_DEADLK = 0x80410108, + CELL_SYNC_ERROR_PERM = 0x80410109, + CELL_SYNC_ERROR_BUSY = 0x8041010A, + CELL_SYNC_ERROR_ABORT = 0x8041010C, + CELL_SYNC_ERROR_FAULT = 0x8041010D, + CELL_SYNC_ERROR_CHILD = 0x8041010E, + CELL_SYNC_ERROR_STAT = 0x8041010F, + CELL_SYNC_ERROR_ALIGN = 0x80410110, + CELL_SYNC_ERROR_NULL_POINTER = 0x80410111, + CELL_SYNC_ERROR_NOT_SUPPORTED_THREAD = 0x80410112, + CELL_SYNC_ERROR_NO_NOTIFIER = 0x80410113, CELL_SYNC_ERROR_NO_SPU_CONTEXT_STORAGE = 0x80410114, }; enum CellSyncError1 : u32 { - CELL_SYNC_ERROR_SHOTAGE = 0x80410112, - CELL_SYNC_ERROR_UNKNOWNKEY = 0x80410113, + CELL_SYNC_ERROR_SHOTAGE = 0x80410112, + CELL_SYNC_ERROR_UNKNOWNKEY = 0x80410113, }; struct CellSyncMutex @@ -342,20 +342,20 @@ struct alignas(128) CellSyncLFQueue atomic_t push3; }; - be_t m_size; // 0x10 - be_t m_depth; // 0x14 - vm::bcptr m_buffer; // 0x18 - u8 m_bs[4]; // 0x20 - be_t m_direction; // 0x24 CellSyncQueueDirection - be_t m_v1; // 0x28 - atomic_be_t init; // 0x2C - atomic_t push2; // 0x30 - be_t m_hs1[15]; // 0x32 - atomic_t pop2; // 0x50 - be_t m_hs2[15]; // 0x52 + be_t m_size; // 0x10 + be_t m_depth; // 0x14 + vm::bcptr m_buffer; // 0x18 + u8 m_bs[4]; // 0x20 + be_t m_direction; // 0x24 CellSyncQueueDirection + be_t m_v1; // 0x28 + atomic_be_t init; // 0x2C + atomic_t push2; // 0x30 + be_t m_hs1[15]; // 0x32 + atomic_t pop2; // 0x50 + be_t m_hs2[15]; // 0x52 vm::bptr m_eaSignal; // 0x70 - be_t m_v2; // 0x78 - be_t m_eq_id; // 0x7C + be_t m_v2; // 0x78 + be_t m_eq_id; // 0x7C }; CHECK_SIZE_ALIGN(CellSyncLFQueue, 128, 128); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSync2.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSync2.cpp index 71158912e..63ff75c0c 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSync2.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSync2.cpp @@ -14,29 +14,29 @@ vm::gvar gCellSync2NotifierPpuFiber; vm::gvar gCellSync2NotifierSpursTask; vm::gvar gCellSync2NotifierSpursJobQueueJob; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SYNC2_ERROR_AGAIN); - STR_CASE(CELL_SYNC2_ERROR_INVAL); - STR_CASE(CELL_SYNC2_ERROR_NOMEM); - STR_CASE(CELL_SYNC2_ERROR_DEADLK); - STR_CASE(CELL_SYNC2_ERROR_PERM); - STR_CASE(CELL_SYNC2_ERROR_BUSY); - STR_CASE(CELL_SYNC2_ERROR_STAT); - STR_CASE(CELL_SYNC2_ERROR_ALIGN); - STR_CASE(CELL_SYNC2_ERROR_NULL_POINTER); - STR_CASE(CELL_SYNC2_ERROR_NOT_SUPPORTED_THREAD); - STR_CASE(CELL_SYNC2_ERROR_NO_NOTIFIER); - STR_CASE(CELL_SYNC2_ERROR_NO_SPU_CONTEXT_STORAGE); - } + switch (error) + { + STR_CASE(CELL_SYNC2_ERROR_AGAIN); + STR_CASE(CELL_SYNC2_ERROR_INVAL); + STR_CASE(CELL_SYNC2_ERROR_NOMEM); + STR_CASE(CELL_SYNC2_ERROR_DEADLK); + STR_CASE(CELL_SYNC2_ERROR_PERM); + STR_CASE(CELL_SYNC2_ERROR_BUSY); + STR_CASE(CELL_SYNC2_ERROR_STAT); + STR_CASE(CELL_SYNC2_ERROR_ALIGN); + STR_CASE(CELL_SYNC2_ERROR_NULL_POINTER); + STR_CASE(CELL_SYNC2_ERROR_NOT_SUPPORTED_THREAD); + STR_CASE(CELL_SYNC2_ERROR_NO_NOTIFIER); + STR_CASE(CELL_SYNC2_ERROR_NO_SPU_CONTEXT_STORAGE); + } - return unknown; - }); + return unknown; + }); } error_code _cellSync2MutexAttributeInitialize(vm::ptr attr, u32 sdkVersion) @@ -48,8 +48,8 @@ error_code _cellSync2MutexAttributeInitialize(vm::ptr a attr->sdkVersion = sdkVersion; attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER | - CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB | - CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB; + CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB | + CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB; attr->maxWaiters = 15; attr->recursive = false; strcpy_trunc(attr->name, "CellSync2Mutex"); @@ -215,8 +215,8 @@ error_code _cellSync2SemaphoreAttributeInitialize(vm::ptrsdkVersion = sdkVersion; attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER | - CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB | - CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB; + CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB | + CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB; attr->maxWaiters = 1; strcpy_trunc(attr->name, "CellSync2Semaphore"); @@ -317,8 +317,8 @@ error_code _cellSync2QueueAttributeInitialize(vm::ptr a attr->sdkVersion = sdkVersion; attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER | - CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB | - CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB; + CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB | + CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB; attr->elementSize = 16; attr->depth = 1024; attr->maxPushWaiters = 15; @@ -427,47 +427,47 @@ error_code cellSync2QueueGetDepth(vm::ptr queue, vm::ptr de } DECLARE(ppu_module_manager::cellSync2)("cellSync2", []() -{ - REG_VAR(cellSync2, gCellSync2CallerThreadTypePpuThread); - REG_VAR(cellSync2, gCellSync2NotifierPpuThread); - REG_VAR(cellSync2, gCellSync2CallerThreadTypePpuFiber); - REG_VAR(cellSync2, gCellSync2NotifierPpuFiber); - REG_VAR(cellSync2, gCellSync2NotifierSpursTask); - REG_VAR(cellSync2, gCellSync2NotifierSpursJobQueueJob); + { + REG_VAR(cellSync2, gCellSync2CallerThreadTypePpuThread); + REG_VAR(cellSync2, gCellSync2NotifierPpuThread); + REG_VAR(cellSync2, gCellSync2CallerThreadTypePpuFiber); + REG_VAR(cellSync2, gCellSync2NotifierPpuFiber); + REG_VAR(cellSync2, gCellSync2NotifierSpursTask); + REG_VAR(cellSync2, gCellSync2NotifierSpursJobQueueJob); - REG_FUNC(cellSync2, _cellSync2MutexAttributeInitialize); - REG_FUNC(cellSync2, cellSync2MutexEstimateBufferSize); - REG_FUNC(cellSync2, cellSync2MutexInitialize); - REG_FUNC(cellSync2, cellSync2MutexFinalize); - REG_FUNC(cellSync2, cellSync2MutexLock); - REG_FUNC(cellSync2, cellSync2MutexTryLock); - REG_FUNC(cellSync2, cellSync2MutexUnlock); + REG_FUNC(cellSync2, _cellSync2MutexAttributeInitialize); + REG_FUNC(cellSync2, cellSync2MutexEstimateBufferSize); + REG_FUNC(cellSync2, cellSync2MutexInitialize); + REG_FUNC(cellSync2, cellSync2MutexFinalize); + REG_FUNC(cellSync2, cellSync2MutexLock); + REG_FUNC(cellSync2, cellSync2MutexTryLock); + REG_FUNC(cellSync2, cellSync2MutexUnlock); - REG_FUNC(cellSync2, _cellSync2CondAttributeInitialize); - REG_FUNC(cellSync2, cellSync2CondEstimateBufferSize); - REG_FUNC(cellSync2, cellSync2CondInitialize); - REG_FUNC(cellSync2, cellSync2CondFinalize); - REG_FUNC(cellSync2, cellSync2CondWait); - REG_FUNC(cellSync2, cellSync2CondSignal); - REG_FUNC(cellSync2, cellSync2CondSignalAll); + REG_FUNC(cellSync2, _cellSync2CondAttributeInitialize); + REG_FUNC(cellSync2, cellSync2CondEstimateBufferSize); + REG_FUNC(cellSync2, cellSync2CondInitialize); + REG_FUNC(cellSync2, cellSync2CondFinalize); + REG_FUNC(cellSync2, cellSync2CondWait); + REG_FUNC(cellSync2, cellSync2CondSignal); + REG_FUNC(cellSync2, cellSync2CondSignalAll); - REG_FUNC(cellSync2, _cellSync2SemaphoreAttributeInitialize); - REG_FUNC(cellSync2, cellSync2SemaphoreEstimateBufferSize); - REG_FUNC(cellSync2, cellSync2SemaphoreInitialize); - REG_FUNC(cellSync2, cellSync2SemaphoreFinalize); - REG_FUNC(cellSync2, cellSync2SemaphoreAcquire); - REG_FUNC(cellSync2, cellSync2SemaphoreTryAcquire); - REG_FUNC(cellSync2, cellSync2SemaphoreRelease); - REG_FUNC(cellSync2, cellSync2SemaphoreGetCount); + REG_FUNC(cellSync2, _cellSync2SemaphoreAttributeInitialize); + REG_FUNC(cellSync2, cellSync2SemaphoreEstimateBufferSize); + REG_FUNC(cellSync2, cellSync2SemaphoreInitialize); + REG_FUNC(cellSync2, cellSync2SemaphoreFinalize); + REG_FUNC(cellSync2, cellSync2SemaphoreAcquire); + REG_FUNC(cellSync2, cellSync2SemaphoreTryAcquire); + REG_FUNC(cellSync2, cellSync2SemaphoreRelease); + REG_FUNC(cellSync2, cellSync2SemaphoreGetCount); - REG_FUNC(cellSync2, _cellSync2QueueAttributeInitialize); - REG_FUNC(cellSync2, cellSync2QueueEstimateBufferSize); - REG_FUNC(cellSync2, cellSync2QueueInitialize); - REG_FUNC(cellSync2, cellSync2QueueFinalize); - REG_FUNC(cellSync2, cellSync2QueuePush); - REG_FUNC(cellSync2, cellSync2QueueTryPush); - REG_FUNC(cellSync2, cellSync2QueuePop); - REG_FUNC(cellSync2, cellSync2QueueTryPop); - REG_FUNC(cellSync2, cellSync2QueueGetSize); - REG_FUNC(cellSync2, cellSync2QueueGetDepth); -}); + REG_FUNC(cellSync2, _cellSync2QueueAttributeInitialize); + REG_FUNC(cellSync2, cellSync2QueueEstimateBufferSize); + REG_FUNC(cellSync2, cellSync2QueueInitialize); + REG_FUNC(cellSync2, cellSync2QueueFinalize); + REG_FUNC(cellSync2, cellSync2QueuePush); + REG_FUNC(cellSync2, cellSync2QueueTryPush); + REG_FUNC(cellSync2, cellSync2QueuePop); + REG_FUNC(cellSync2, cellSync2QueueTryPop); + REG_FUNC(cellSync2, cellSync2QueueGetSize); + REG_FUNC(cellSync2, cellSync2QueueGetDepth); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysCache.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysCache.cpp index 6f0a30922..05321adc6 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysCache.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysCache.cpp @@ -12,21 +12,21 @@ LOG_CHANNEL(cellSysutil); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SYSCACHE_ERROR_ACCESS_ERROR); - STR_CASE(CELL_SYSCACHE_ERROR_INTERNAL); - STR_CASE(CELL_SYSCACHE_ERROR_NOTMOUNTED); - STR_CASE(CELL_SYSCACHE_ERROR_PARAM); - } + switch (error) + { + STR_CASE(CELL_SYSCACHE_ERROR_ACCESS_ERROR); + STR_CASE(CELL_SYSCACHE_ERROR_INTERNAL); + STR_CASE(CELL_SYSCACHE_ERROR_NOTMOUNTED); + STR_CASE(CELL_SYSCACHE_ERROR_PARAM); + } - return unknown; - }); + return unknown; + }); } extern lv2_fs_mount_point g_mp_sys_dev_hdd1; @@ -100,12 +100,12 @@ struct syscache_info if (remove_root) { idm::select([](u32 /*id*/, lv2_file& file) - { - if (file.file && file.mp->flags & lv2_mp_flag::cache) { - file.lock = 2; - } - }); + if (file.file && file.mp->flags & lv2_mp_flag::cache) + { + file.lock = 2; + } + }); } } @@ -123,12 +123,12 @@ struct syscache_info } idm::select([](u32 /*id*/, lv2_file& file) - { - if (file.file && file.mp->flags & lv2_mp_flag::cache && file.flags & CELL_FS_O_ACCMODE) { - file.file.sync(); - } - }); + if (file.file && file.mp->flags & lv2_mp_flag::cache && file.flags & CELL_FS_O_ACCMODE) + { + file.file.sync(); + } + }); fs::remove_file(get_syscache_state_corruption_indicator_file_path(cache_root + cache_id)); } @@ -205,9 +205,7 @@ error_code cellSysCacheMount(vm::ptr param) strcpy_trunc(param->getCachePath, "/dev_hdd1"); // Lock pseudo-mutex - const auto lock = cache.init.init_always([&] - { - }); + const auto lock = cache.init.init_always([&] {}); std::lock_guard lock0(g_mp_sys_dev_hdd1.mutex); @@ -260,7 +258,6 @@ error_code cellSysCacheMount(vm::ptr param) return not_an_error(CELL_SYSCACHE_RET_OK_CLEARED); } - extern void cellSysutil_SysCache_init() { REG_FUNC(cellSysutil, cellSysCacheMount); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysconf.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysconf.cpp index c36027a2a..41a44619e 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysconf.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysconf.cpp @@ -6,18 +6,18 @@ LOG_CHANNEL(cellSysconf); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SYSCONF_ERROR_PARAM); - } + switch (error) + { + STR_CASE(CELL_SYSCONF_ERROR_PARAM); + } - return unknown; - }); + return unknown; + }); } error_code cellSysconfAbort() @@ -31,10 +31,10 @@ error_code cellSysconfOpen(u32 type, vm::ptr func, vm::ptr< cellSysconf.todo("cellSysconfOpen(type=%d, func=*0x%x, userdata=*0x%x, extparam=*0x%x, id=%d)", type, func, userdata, extparam, id); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - func(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + func(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -58,6 +58,6 @@ void cellSysutil_Sysconf_init() } DECLARE(ppu_module_manager::cellSysconf)("cellSysconfExtUtility", []() -{ - REG_FUNC(cellSysconfExtUtility, cellSysconfBtGetDeviceList); -}); + { + REG_FUNC(cellSysconfExtUtility, cellSysconfBtGetDeviceList); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysconf.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysconf.h index 11dc4f9a5..15d3a8154 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysconf.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysconf.h @@ -21,13 +21,13 @@ struct CellSysconfBtDeviceList enum CellSysconfBtDeviceType : s32 { CELL_SYSCONF_BT_DEVICE_TYPE_AUDIO = 0x00000001, - CELL_SYSCONF_BT_DEVICE_TYPE_HID = 0x00000002, + CELL_SYSCONF_BT_DEVICE_TYPE_HID = 0x00000002, }; enum CellSysconfBtDeviceState : s32 { CELL_SYSCONF_BT_DEVICE_STATE_UNAVAILABLE = 0, - CELL_SYSCONF_BT_DEVICE_STATE_AVAILABLE = 1, + CELL_SYSCONF_BT_DEVICE_STATE_AVAILABLE = 1, }; enum CellSysConfError : u32 diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysmodule.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysmodule.cpp index 5548a1bbb..007a72890 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysmodule.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysmodule.cpp @@ -7,29 +7,29 @@ constexpr auto CELL_SYSMODULE_LOADED = CELL_OK; enum CellSysmoduleError : u32 { - CELL_SYSMODULE_ERROR_DUPLICATED = 0x80012001, - CELL_SYSMODULE_ERROR_UNKNOWN = 0x80012002, - CELL_SYSMODULE_ERROR_UNLOADED = 0x80012003, + CELL_SYSMODULE_ERROR_DUPLICATED = 0x80012001, + CELL_SYSMODULE_ERROR_UNKNOWN = 0x80012002, + CELL_SYSMODULE_ERROR_UNLOADED = 0x80012003, CELL_SYSMODULE_ERROR_INVALID_MEMCONTAINER = 0x80012004, - CELL_SYSMODULE_ERROR_FATAL = 0x800120ff, + CELL_SYSMODULE_ERROR_FATAL = 0x800120ff, }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SYSMODULE_ERROR_DUPLICATED); - STR_CASE(CELL_SYSMODULE_ERROR_UNKNOWN); - STR_CASE(CELL_SYSMODULE_ERROR_UNLOADED); - STR_CASE(CELL_SYSMODULE_ERROR_INVALID_MEMCONTAINER); - STR_CASE(CELL_SYSMODULE_ERROR_FATAL); - } + switch (error) + { + STR_CASE(CELL_SYSMODULE_ERROR_DUPLICATED); + STR_CASE(CELL_SYSMODULE_ERROR_UNKNOWN); + STR_CASE(CELL_SYSMODULE_ERROR_UNLOADED); + STR_CASE(CELL_SYSMODULE_ERROR_INVALID_MEMCONTAINER); + STR_CASE(CELL_SYSMODULE_ERROR_FATAL); + } - return unknown; - }); + return unknown; + }); } static const char* get_module_name(u16 id) @@ -307,11 +307,11 @@ error_code cellSysmoduleLoadModule(u16 id) return CELL_SYSMODULE_ERROR_UNKNOWN; } - //if (Module<>* m = Emu.GetModuleManager().GetModuleById(id)) + // if (Module<>* m = Emu.GetModuleManager().GetModuleById(id)) //{ // // CELL_SYSMODULE_ERROR_DUPLICATED shouldn't be returned // m->Load(); - //} + // } return CELL_OK; } @@ -327,7 +327,7 @@ error_code cellSysmoduleUnloadModule(u16 id) return CELL_SYSMODULE_ERROR_UNKNOWN; } - //if (Module<>* m = Emu.GetModuleManager().GetModuleById(id)) + // if (Module<>* m = Emu.GetModuleManager().GetModuleById(id)) //{ // if (!m->IsLoaded()) // { @@ -352,14 +352,14 @@ error_code cellSysmoduleIsLoaded(u16 id) return CELL_SYSMODULE_ERROR_UNKNOWN; } - //if (Module<>* m = Emu.GetModuleManager().GetModuleById(id)) + // if (Module<>* m = Emu.GetModuleManager().GetModuleById(id)) //{ // if (!m->IsLoaded()) // { // cellSysmodule.warning("cellSysmoduleIsLoaded(): module not loaded (id=0x%04x)", id); // return CELL_SYSMODULE_ERROR_UNLOADED; // } - //} + // } return CELL_SYSMODULE_LOADED; } @@ -407,18 +407,18 @@ error_code cellSysmoduleIsLoadedEx() } DECLARE(ppu_module_manager::cellSysmodule)("cellSysmodule", []() -{ - REG_FUNC(cellSysmodule, cellSysmoduleInitialize); - REG_FUNC(cellSysmodule, cellSysmoduleFinalize); - REG_FUNC(cellSysmodule, cellSysmoduleSetMemcontainer); - REG_FUNC(cellSysmodule, cellSysmoduleLoadModule); - REG_FUNC(cellSysmodule, cellSysmoduleUnloadModule); - REG_FUNC(cellSysmodule, cellSysmoduleIsLoaded); - REG_FUNC(cellSysmodule, cellSysmoduleGetImagesize); - REG_FUNC(cellSysmodule, cellSysmoduleFetchImage); - REG_FUNC(cellSysmodule, cellSysmoduleUnloadModuleInternal); - REG_FUNC(cellSysmodule, cellSysmoduleLoadModuleInternal); - REG_FUNC(cellSysmodule, cellSysmoduleUnloadModuleEx); - REG_FUNC(cellSysmodule, cellSysmoduleLoadModuleEx); - REG_FUNC(cellSysmodule, cellSysmoduleIsLoadedEx); -}); + { + REG_FUNC(cellSysmodule, cellSysmoduleInitialize); + REG_FUNC(cellSysmodule, cellSysmoduleFinalize); + REG_FUNC(cellSysmodule, cellSysmoduleSetMemcontainer); + REG_FUNC(cellSysmodule, cellSysmoduleLoadModule); + REG_FUNC(cellSysmodule, cellSysmoduleUnloadModule); + REG_FUNC(cellSysmodule, cellSysmoduleIsLoaded); + REG_FUNC(cellSysmodule, cellSysmoduleGetImagesize); + REG_FUNC(cellSysmodule, cellSysmoduleFetchImage); + REG_FUNC(cellSysmodule, cellSysmoduleUnloadModuleInternal); + REG_FUNC(cellSysmodule, cellSysmoduleLoadModuleInternal); + REG_FUNC(cellSysmodule, cellSysmoduleUnloadModuleEx); + REG_FUNC(cellSysmodule, cellSysmoduleLoadModuleEx); + REG_FUNC(cellSysmodule, cellSysmoduleIsLoadedEx); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutil.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutil.cpp index a23639859..e2ebb317a 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutil.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutil.cpp @@ -18,45 +18,45 @@ LOG_CHANNEL(cellSysutil); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SYSUTIL_ERROR_TYPE); - STR_CASE(CELL_SYSUTIL_ERROR_VALUE); - STR_CASE(CELL_SYSUTIL_ERROR_SIZE); - STR_CASE(CELL_SYSUTIL_ERROR_NUM); - STR_CASE(CELL_SYSUTIL_ERROR_BUSY); - STR_CASE(CELL_SYSUTIL_ERROR_STATUS); - STR_CASE(CELL_SYSUTIL_ERROR_MEMORY); - STR_CASE(CELL_SYSUTIL_ERROR_3D_SUPPORT); - } + switch (error) + { + STR_CASE(CELL_SYSUTIL_ERROR_TYPE); + STR_CASE(CELL_SYSUTIL_ERROR_VALUE); + STR_CASE(CELL_SYSUTIL_ERROR_SIZE); + STR_CASE(CELL_SYSUTIL_ERROR_NUM); + STR_CASE(CELL_SYSUTIL_ERROR_BUSY); + STR_CASE(CELL_SYSUTIL_ERROR_STATUS); + STR_CASE(CELL_SYSUTIL_ERROR_MEMORY); + STR_CASE(CELL_SYSUTIL_ERROR_3D_SUPPORT); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_ERROR_PARAM); - STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_ERROR_BUSY); - STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_ERROR_GENERIC); - STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_PARAM); - STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_ALREADY_SETPARAM); - STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_DISABLE_SETPARAM); - STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_GENERIC); - } + switch (error) + { + STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_ERROR_PARAM); + STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_ERROR_BUSY); + STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_ERROR_GENERIC); + STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_PARAM); + STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_ALREADY_SETPARAM); + STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_DISABLE_SETPARAM); + STR_CASE(CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_GENERIC); + } - return unknown; - }); + return unknown; + }); } atomic_t g_sysutil_callback_id_assigner = 0; @@ -92,7 +92,7 @@ struct sysutil_cb_manager // Do resize for deque (cheap container which can store all non-movable value types) std::deque>>> result; - for (usz i = 0 ; i < g_sysutil_callback_id_assigner; i++) + for (usz i = 0; i < g_sysutil_callback_id_assigner; i++) { result.emplace_back(); } @@ -189,11 +189,11 @@ extern s32 sysutil_send_system_cmd(u64 status, u64 param) if (cb.callback) { cbm->registered.push(sysutil_cb_manager::dispatcher_cb{[=](ppu_thread& ppu) -> s32 - { - // TODO: check it and find the source of the return value (void isn't equal to CELL_OK) - cb.callback(ppu, status, param, cb.user_data); - return CELL_OK; - }}); + { + // TODO: check it and find the source of the return value (void isn't equal to CELL_OK) + cb.callback(ppu, status, param, cb.user_data); + return CELL_OK; + }}); count++; } @@ -255,89 +255,89 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellSysutilLang value) - { - switch (value) { - case CELL_SYSUTIL_LANG_JAPANESE: return "Japanese"; - case CELL_SYSUTIL_LANG_ENGLISH_US: return "English (US)"; - case CELL_SYSUTIL_LANG_FRENCH: return "French"; - case CELL_SYSUTIL_LANG_SPANISH: return "Spanish"; - case CELL_SYSUTIL_LANG_GERMAN: return "German"; - case CELL_SYSUTIL_LANG_ITALIAN: return "Italian"; - case CELL_SYSUTIL_LANG_DUTCH: return "Dutch"; - case CELL_SYSUTIL_LANG_PORTUGUESE_PT: return "Portuguese (Portugal)"; - case CELL_SYSUTIL_LANG_RUSSIAN: return "Russian"; - case CELL_SYSUTIL_LANG_KOREAN: return "Korean"; - case CELL_SYSUTIL_LANG_CHINESE_T: return "Chinese (Traditional)"; - case CELL_SYSUTIL_LANG_CHINESE_S: return "Chinese (Simplified)"; - case CELL_SYSUTIL_LANG_FINNISH: return "Finnish"; - case CELL_SYSUTIL_LANG_SWEDISH: return "Swedish"; - case CELL_SYSUTIL_LANG_DANISH: return "Danish"; - case CELL_SYSUTIL_LANG_NORWEGIAN: return "Norwegian"; - case CELL_SYSUTIL_LANG_POLISH: return "Polish"; - case CELL_SYSUTIL_LANG_ENGLISH_GB: return "English (UK)"; - case CELL_SYSUTIL_LANG_PORTUGUESE_BR: return "Portuguese (Brazil)"; - case CELL_SYSUTIL_LANG_TURKISH: return "Turkish"; - } + switch (value) + { + case CELL_SYSUTIL_LANG_JAPANESE: return "Japanese"; + case CELL_SYSUTIL_LANG_ENGLISH_US: return "English (US)"; + case CELL_SYSUTIL_LANG_FRENCH: return "French"; + case CELL_SYSUTIL_LANG_SPANISH: return "Spanish"; + case CELL_SYSUTIL_LANG_GERMAN: return "German"; + case CELL_SYSUTIL_LANG_ITALIAN: return "Italian"; + case CELL_SYSUTIL_LANG_DUTCH: return "Dutch"; + case CELL_SYSUTIL_LANG_PORTUGUESE_PT: return "Portuguese (Portugal)"; + case CELL_SYSUTIL_LANG_RUSSIAN: return "Russian"; + case CELL_SYSUTIL_LANG_KOREAN: return "Korean"; + case CELL_SYSUTIL_LANG_CHINESE_T: return "Chinese (Traditional)"; + case CELL_SYSUTIL_LANG_CHINESE_S: return "Chinese (Simplified)"; + case CELL_SYSUTIL_LANG_FINNISH: return "Finnish"; + case CELL_SYSUTIL_LANG_SWEDISH: return "Swedish"; + case CELL_SYSUTIL_LANG_DANISH: return "Danish"; + case CELL_SYSUTIL_LANG_NORWEGIAN: return "Norwegian"; + case CELL_SYSUTIL_LANG_POLISH: return "Polish"; + case CELL_SYSUTIL_LANG_ENGLISH_GB: return "English (UK)"; + case CELL_SYSUTIL_LANG_PORTUGUESE_BR: return "Portuguese (Brazil)"; + case CELL_SYSUTIL_LANG_TURKISH: return "Turkish"; + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellSysutilLicenseArea value) - { - switch (value) { - case CELL_SYSUTIL_LICENSE_AREA_J: return "SCEJ"; - case CELL_SYSUTIL_LICENSE_AREA_A: return "SCEA"; - case CELL_SYSUTIL_LICENSE_AREA_E: return "SCEE"; - case CELL_SYSUTIL_LICENSE_AREA_H: return "SCEH"; - case CELL_SYSUTIL_LICENSE_AREA_K: return "SCEK"; - case CELL_SYSUTIL_LICENSE_AREA_C: return "SCH"; - case CELL_SYSUTIL_LICENSE_AREA_OTHER: return "Other"; - } + switch (value) + { + case CELL_SYSUTIL_LICENSE_AREA_J: return "SCEJ"; + case CELL_SYSUTIL_LICENSE_AREA_A: return "SCEA"; + case CELL_SYSUTIL_LICENSE_AREA_E: return "SCEE"; + case CELL_SYSUTIL_LICENSE_AREA_H: return "SCEH"; + case CELL_SYSUTIL_LICENSE_AREA_K: return "SCEK"; + case CELL_SYSUTIL_LICENSE_AREA_C: return "SCH"; + case CELL_SYSUTIL_LICENSE_AREA_OTHER: return "Other"; + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto value) - { - switch (value) { - case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG: return "ID_LANG"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN: return "ID_ENTER_BUTTON_ASSIGN"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT: return "ID_DATE_FORMAT"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT: return "ID_TIME_FORMAT"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE: return "ID_TIMEZONE"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME: return "ID_SUMMERTIME"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL: return "ID_GAME_PARENTAL_LEVEL"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_LICENSE_AREA: return "ID_LICENSE_AREA"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT: return "ID_GAME_PARENTAL_LEVEL0_RESTRICT"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT: return "ID_CURRENT_USER_HAS_NP_ACCOUNT"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ: return "ID_CAMERA_PLFREQ"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE: return "ID_PAD_RUMBLE"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE: return "ID_KEYBOARD_TYPE"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD: return "ID_JAPANESE_KEYBOARD_ENTRY_METHOD"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD: return "ID_CHINESE_KEYBOARD_ENTRY_METHOD"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF: return "ID_PAD_AUTOOFF"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_MAGNETOMETER: return "ID_MAGNETOMETER"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME: return "ID_NICKNAME"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME: return "ID_CURRENT_USERNAME"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_x1008: return "ID_x1008"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_x1011: return "ID_x1011"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_x1012: return "ID_x1012"; - case CELL_SYSUTIL_SYSTEMPARAM_ID_x1024: return "ID_x1024"; - } + switch (value) + { + case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG: return "ID_LANG"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN: return "ID_ENTER_BUTTON_ASSIGN"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT: return "ID_DATE_FORMAT"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT: return "ID_TIME_FORMAT"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE: return "ID_TIMEZONE"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME: return "ID_SUMMERTIME"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL: return "ID_GAME_PARENTAL_LEVEL"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_LICENSE_AREA: return "ID_LICENSE_AREA"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT: return "ID_GAME_PARENTAL_LEVEL0_RESTRICT"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT: return "ID_CURRENT_USER_HAS_NP_ACCOUNT"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ: return "ID_CAMERA_PLFREQ"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE: return "ID_PAD_RUMBLE"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE: return "ID_KEYBOARD_TYPE"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD: return "ID_JAPANESE_KEYBOARD_ENTRY_METHOD"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD: return "ID_CHINESE_KEYBOARD_ENTRY_METHOD"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF: return "ID_PAD_AUTOOFF"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_MAGNETOMETER: return "ID_MAGNETOMETER"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME: return "ID_NICKNAME"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME: return "ID_CURRENT_USERNAME"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_x1008: return "ID_x1008"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_x1011: return "ID_x1011"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_x1012: return "ID_x1012"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_x1024: return "ID_x1024"; + } - return unknown; - }); + return unknown; + }); } // Common string checks used in libsysutil functions @@ -544,9 +544,18 @@ error_code cellSysutilGetSystemParamString(CellSysutilParamId id, vm::ptr } case CELL_SYSUTIL_SYSTEMPARAM_ID_x1011: // Same as x1012 - case CELL_SYSUTIL_SYSTEMPARAM_ID_x1012: copy_size = 0x400; report_use = true; break; - case CELL_SYSUTIL_SYSTEMPARAM_ID_x1024: copy_size = 0x100; report_use = true; break; - case CELL_SYSUTIL_SYSTEMPARAM_ID_x1008: copy_size = 0x4; report_use = true; break; + case CELL_SYSUTIL_SYSTEMPARAM_ID_x1012: + copy_size = 0x400; + report_use = true; + break; + case CELL_SYSUTIL_SYSTEMPARAM_ID_x1024: + copy_size = 0x100; + report_use = true; + break; + case CELL_SYSUTIL_SYSTEMPARAM_ID_x1008: + copy_size = 0x4; + report_use = true; + break; default: { return CELL_SYSUTIL_ERROR_VALUE; @@ -797,15 +806,15 @@ error_code cellSysutilRegisterCallbackDispatcher(u32 event_code, u32 func_addr) for (u32 i = 0; i < cbm.dispatchers.size(); i++) { if (cbm.dispatchers[i].atomic_op([&](sysutil_cb_manager::registered_dispatcher& dispatcher) - { - if (dispatcher.event_code == 0) - { - dispatcher.event_code = event_code; - dispatcher.func_addr = func_addr; - return true; - } - return false; - })) + { + if (dispatcher.event_code == 0) + { + dispatcher.event_code = event_code; + dispatcher.func_addr = func_addr; + return true; + } + return false; + })) { return CELL_OK; } @@ -823,15 +832,15 @@ error_code cellSysutilUnregisterCallbackDispatcher(u32 event_code) for (u32 i = 0; i < cbm.dispatchers.size(); i++) { if (cbm.dispatchers[i].atomic_op([&](sysutil_cb_manager::registered_dispatcher& dispatcher) - { - if (dispatcher.event_code == event_code) - { - dispatcher.event_code = 0; - dispatcher.func_addr = 0; - return true; - } - return false; - })) + { + if (dispatcher.event_code == event_code) + { + dispatcher.event_code = 0; + dispatcher.func_addr = 0; + return true; + } + return false; + })) { return CELL_OK; } @@ -1124,88 +1133,88 @@ extern void cellSysutil_VideoOut_init(); extern void cellSysutil_SysCache_init(); DECLARE(ppu_module_manager::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 - cellSysutil_SysCache_init(); // cellSysCache functions + { + 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 + cellSysutil_SysCache_init(); // cellSysCache functions - REG_FUNC(cellSysutil, _cellSysutilGetSystemParamInt); - REG_FUNC(cellSysutil, cellSysutilGetSystemParamInt); - REG_FUNC(cellSysutil, cellSysutilGetSystemParamString); + REG_FUNC(cellSysutil, _cellSysutilGetSystemParamInt); + REG_FUNC(cellSysutil, cellSysutilGetSystemParamInt); + REG_FUNC(cellSysutil, cellSysutilGetSystemParamString); - REG_FUNC(cellSysutil, cellSysutilCheckCallback); - REG_FUNC(cellSysutil, cellSysutilRegisterCallback); - REG_FUNC(cellSysutil, cellSysutilUnregisterCallback); + REG_FUNC(cellSysutil, cellSysutilCheckCallback); + REG_FUNC(cellSysutil, cellSysutilRegisterCallback); + REG_FUNC(cellSysutil, cellSysutilUnregisterCallback); - 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, 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, cellSysutilRegisterCallbackDispatcher); - REG_FUNC(cellSysutil, cellSysutilUnregisterCallbackDispatcher); - REG_FUNC(cellSysutil, cellSysutilPacketRead); - REG_FUNC(cellSysutil, cellSysutilPacketWrite); - REG_FUNC(cellSysutil, cellSysutilPacketBegin); - REG_FUNC(cellSysutil, cellSysutilPacketEnd); + REG_FUNC(cellSysutil, cellSysutilRegisterCallbackDispatcher); + REG_FUNC(cellSysutil, cellSysutilUnregisterCallbackDispatcher); + REG_FUNC(cellSysutil, cellSysutilPacketRead); + REG_FUNC(cellSysutil, cellSysutilPacketWrite); + REG_FUNC(cellSysutil, cellSysutilPacketBegin); + REG_FUNC(cellSysutil, cellSysutilPacketEnd); - REG_FUNC(cellSysutil, cellSysutilGameDataAssignVmc); - REG_FUNC(cellSysutil, cellSysutilGameDataExit); - REG_FUNC(cellSysutil, cellSysutilGameExit_I); - REG_FUNC(cellSysutil, cellSysutilGamePowerOff_I); - REG_FUNC(cellSysutil, cellSysutilGameReboot_I); + REG_FUNC(cellSysutil, cellSysutilGameDataAssignVmc); + REG_FUNC(cellSysutil, cellSysutilGameDataExit); + REG_FUNC(cellSysutil, cellSysutilGameExit_I); + REG_FUNC(cellSysutil, cellSysutilGamePowerOff_I); + REG_FUNC(cellSysutil, cellSysutilGameReboot_I); - REG_FUNC(cellSysutil, cellSysutilSharedMemoryAlloc); - REG_FUNC(cellSysutil, cellSysutilSharedMemoryFree); + REG_FUNC(cellSysutil, cellSysutilSharedMemoryAlloc); + REG_FUNC(cellSysutil, cellSysutilSharedMemoryFree); - REG_FUNC(cellSysutil, cellSysutilNotification); + REG_FUNC(cellSysutil, cellSysutilNotification); - REG_FUNC(cellSysutil, _ZN4cxml7Element11AppendChildERS0_); + REG_FUNC(cellSysutil, _ZN4cxml7Element11AppendChildERS0_); - REG_FUNC(cellSysutil, _ZN4cxml8DocumentC1Ev); - REG_FUNC(cellSysutil, _ZN4cxml8DocumentD1Ev); - REG_FUNC(cellSysutil, _ZN4cxml8Document5ClearEv); - REG_FUNC(cellSysutil, _ZN4cxml8Document5WriteEPFiPKvjPvES3_); - REG_FUNC(cellSysutil, _ZN4cxml8Document12RegisterFileEPKvjPNS_4FileE); - REG_FUNC(cellSysutil, _ZN4cxml8Document13CreateElementEPKciPNS_7ElementE); - REG_FUNC(cellSysutil, _ZN4cxml8Document14SetHeaderMagicEPKc); - REG_FUNC(cellSysutil, _ZN4cxml8Document16CreateFromBufferEPKvjb); - REG_FUNC(cellSysutil, _ZN4cxml8Document18GetDocumentElementEv); + REG_FUNC(cellSysutil, _ZN4cxml8DocumentC1Ev); + REG_FUNC(cellSysutil, _ZN4cxml8DocumentD1Ev); + REG_FUNC(cellSysutil, _ZN4cxml8Document5ClearEv); + REG_FUNC(cellSysutil, _ZN4cxml8Document5WriteEPFiPKvjPvES3_); + REG_FUNC(cellSysutil, _ZN4cxml8Document12RegisterFileEPKvjPNS_4FileE); + REG_FUNC(cellSysutil, _ZN4cxml8Document13CreateElementEPKciPNS_7ElementE); + REG_FUNC(cellSysutil, _ZN4cxml8Document14SetHeaderMagicEPKc); + REG_FUNC(cellSysutil, _ZN4cxml8Document16CreateFromBufferEPKvjb); + REG_FUNC(cellSysutil, _ZN4cxml8Document18GetDocumentElementEv); - REG_FUNC(cellSysutil, _ZNK4cxml4File7GetAddrEv); - REG_FUNC(cellSysutil, _ZNK4cxml7Element12GetAttributeEPKcPNS_9AttributeE); - REG_FUNC(cellSysutil, _ZNK4cxml7Element13GetFirstChildEv); - REG_FUNC(cellSysutil, _ZNK4cxml7Element14GetNextSiblingEv); - REG_FUNC(cellSysutil, _ZNK4cxml9Attribute6GetIntEPi); - REG_FUNC(cellSysutil, _ZNK4cxml9Attribute7GetFileEPNS_4FileE); + REG_FUNC(cellSysutil, _ZNK4cxml4File7GetAddrEv); + REG_FUNC(cellSysutil, _ZNK4cxml7Element12GetAttributeEPKcPNS_9AttributeE); + REG_FUNC(cellSysutil, _ZNK4cxml7Element13GetFirstChildEv); + REG_FUNC(cellSysutil, _ZNK4cxml7Element14GetNextSiblingEv); + REG_FUNC(cellSysutil, _ZNK4cxml9Attribute6GetIntEPi); + REG_FUNC(cellSysutil, _ZNK4cxml9Attribute7GetFileEPNS_4FileE); - REG_FUNC(cellSysutil, _ZN8cxmlutil6SetIntERKN4cxml7ElementEPKci); - REG_FUNC(cellSysutil, _ZN8cxmlutil6GetIntERKN4cxml7ElementEPKcPi); - REG_FUNC(cellSysutil, _ZN8cxmlutil7SetFileERKN4cxml7ElementEPKcRKNS0_4FileE); - REG_FUNC(cellSysutil, _ZN8cxmlutil8GetFloatERKN4cxml7ElementEPKcPf); - REG_FUNC(cellSysutil, _ZN8cxmlutil8SetFloatERKN4cxml7ElementEPKcf); - REG_FUNC(cellSysutil, _ZN8cxmlutil9GetStringERKN4cxml7ElementEPKcPS5_Pj); - REG_FUNC(cellSysutil, _ZN8cxmlutil9SetStringERKN4cxml7ElementEPKcS5_); - REG_FUNC(cellSysutil, _ZN8cxmlutil16CheckElementNameERKN4cxml7ElementEPKc); - REG_FUNC(cellSysutil, _ZN8cxmlutil16FindChildElementERKN4cxml7ElementEPKcS5_S5_); - REG_FUNC(cellSysutil, _ZN8cxmlutil7GetFileERKN4cxml7ElementEPKcPNS0_4FileE); + REG_FUNC(cellSysutil, _ZN8cxmlutil6SetIntERKN4cxml7ElementEPKci); + REG_FUNC(cellSysutil, _ZN8cxmlutil6GetIntERKN4cxml7ElementEPKcPi); + REG_FUNC(cellSysutil, _ZN8cxmlutil7SetFileERKN4cxml7ElementEPKcRKNS0_4FileE); + REG_FUNC(cellSysutil, _ZN8cxmlutil8GetFloatERKN4cxml7ElementEPKcPf); + REG_FUNC(cellSysutil, _ZN8cxmlutil8SetFloatERKN4cxml7ElementEPKcf); + REG_FUNC(cellSysutil, _ZN8cxmlutil9GetStringERKN4cxml7ElementEPKcPS5_Pj); + REG_FUNC(cellSysutil, _ZN8cxmlutil9SetStringERKN4cxml7ElementEPKcS5_); + REG_FUNC(cellSysutil, _ZN8cxmlutil16CheckElementNameERKN4cxml7ElementEPKc); + REG_FUNC(cellSysutil, _ZN8cxmlutil16FindChildElementERKN4cxml7ElementEPKcS5_S5_); + REG_FUNC(cellSysutil, _ZN8cxmlutil7GetFileERKN4cxml7ElementEPKcPNS0_4FileE); - REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil11FixedMemory3EndEi); - REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil11FixedMemory5BeginEi); - REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil11FixedMemory8AllocateEN4cxml14AllocationTypeEPvS3_jPS3_Pj); - REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil12PacketWriter5WriteEPKvjPv); - REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil12PacketWriterC1EiiRN4cxml8DocumentE); + REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil11FixedMemory3EndEi); + REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil11FixedMemory5BeginEi); + REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil11FixedMemory8AllocateEN4cxml14AllocationTypeEPvS3_jPS3_Pj); + REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil12PacketWriter5WriteEPKvjPv); + REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil12PacketWriterC1EiiRN4cxml8DocumentE); - REG_FNID(cellSysutil, 0xE1EC7B6A, cellSysutil_E1EC7B6A); -}); + REG_FNID(cellSysutil, 0xE1EC7B6A, cellSysutil_E1EC7B6A); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutil.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutil.h index 6ab8fadb5..2456881a8 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutil.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutil.h @@ -6,112 +6,112 @@ using CellSysutilUserId = u32; enum { - CELL_SYSUTIL_ERROR_BASE_INTERNAL = 0x8002b000, - CELL_SYSUTIL_ERROR_BASE_COMMON = 0x8002b100, - CELL_SYSUTIL_ERROR_BASE_SYSTEMPARAM = 0x8002b200, - CELL_SYSUTIL_ERROR_BASE_MSGDIALOG = 0x8002b300, - CELL_SYSUTIL_ERROR_BASE_SAVEDATA = 0x8002b400, - CELL_SYSUTIL_ERROR_BASE_OSKDIALOG = 0x8002b500, - CELL_SYSUTIL_ERROR_BASE_GAMEDATA = 0x8002b600, - CELL_SYSUTIL_ERROR_BASE_AVC = 0x8002b700, - CELL_SYSUTIL_ERROR_BASE_NETCTL = 0x8002b800, - CELL_SYSUTIL_ERROR_BASE_WEBBROWSER = 0x8002b900, - CELL_SYSUTIL_ERROR_BASE_HDDGAME = 0x8002ba00, - CELL_SYSUTIL_ERROR_BASE_SYSCONF = 0x8002bb00, - CELL_SYSUTIL_ERROR_BASE_SYSCACHE = 0x8002bc00, - CELL_SYSUTIL_ERROR_BASE_DISCGAME = 0x8002bd00, - CELL_SYSUTIL_ERROR_BASE_STORAGEDATA = 0x8002be00, - CELL_SYSUTIL_ERROR_BASE_IMEJP = 0x8002bf00, - CELL_SYSUTIL_ERROR_BASE_FILE_SELECT = 0x8002c000, - CELL_SYSUTIL_ERROR_BASE_MUSIC = 0x8002c100, - CELL_SYSUTIL_ERROR_BASE_PHOTO_EXPORT_UTIL = 0x8002c200, - CELL_SYSUTIL_ERROR_BASE_USERINFO = 0x8002c300, - CELL_SYSUTIL_ERROR_BASE_PRINT = 0x8002c400, - CELL_SYSUTIL_ERROR_BASE_REC = 0x8002c500, - CELL_SYSUTIL_ERROR_BASE_MUSIC_EXPORT_UTIL = 0x8002c600, - CELL_SYSUTIL_ERROR_BASE_PHOTO_IMPORT = 0x8002c700, - CELL_SYSUTIL_ERROR_BASE_SEARCH = 0x8002c800, - CELL_SYSUTIL_ERROR_BASE_PHOTO_DECODE = 0x8002c900, - CELL_SYSUTIL_ERROR_BASE_VIDEO_EXPORT_UTIL = 0x8002ca00, - CELL_SYSUTIL_ERROR_BASE_GAME = 0x8002cb00, - CELL_SYSUTIL_ERROR_BASE_GAMEUPDATE = 0x8002cc00, - CELL_SYSUTIL_ERROR_BASE_AP = 0x8002cd00, - CELL_SYSUTIL_ERROR_BASE_COMBOPLAY = 0x8002cd80, - CELL_SYSUTIL_ERROR_BASE_BGDL = 0x8002ce00, - CELL_SYSUTIL_ERROR_BASE_VIDEO_UPLOAD_UTIL = 0x8002d000, - CELL_SYSUTIL_ERROR_BASE_SCREENSHOT = 0x8002d100, - CELL_SYSUTIL_ERROR_BASE_AUTHDIALOG = 0x8002d200, - CELL_SYSUTIL_ERROR_BASE_BGMPLAYBACK_EX = 0x8002d300, - CELL_SYSUTIL_ERROR_BASE_SYSTEM_CHAT = 0x8002d400, + CELL_SYSUTIL_ERROR_BASE_INTERNAL = 0x8002b000, + CELL_SYSUTIL_ERROR_BASE_COMMON = 0x8002b100, + CELL_SYSUTIL_ERROR_BASE_SYSTEMPARAM = 0x8002b200, + CELL_SYSUTIL_ERROR_BASE_MSGDIALOG = 0x8002b300, + CELL_SYSUTIL_ERROR_BASE_SAVEDATA = 0x8002b400, + CELL_SYSUTIL_ERROR_BASE_OSKDIALOG = 0x8002b500, + CELL_SYSUTIL_ERROR_BASE_GAMEDATA = 0x8002b600, + CELL_SYSUTIL_ERROR_BASE_AVC = 0x8002b700, + CELL_SYSUTIL_ERROR_BASE_NETCTL = 0x8002b800, + CELL_SYSUTIL_ERROR_BASE_WEBBROWSER = 0x8002b900, + CELL_SYSUTIL_ERROR_BASE_HDDGAME = 0x8002ba00, + CELL_SYSUTIL_ERROR_BASE_SYSCONF = 0x8002bb00, + CELL_SYSUTIL_ERROR_BASE_SYSCACHE = 0x8002bc00, + CELL_SYSUTIL_ERROR_BASE_DISCGAME = 0x8002bd00, + CELL_SYSUTIL_ERROR_BASE_STORAGEDATA = 0x8002be00, + CELL_SYSUTIL_ERROR_BASE_IMEJP = 0x8002bf00, + CELL_SYSUTIL_ERROR_BASE_FILE_SELECT = 0x8002c000, + CELL_SYSUTIL_ERROR_BASE_MUSIC = 0x8002c100, + CELL_SYSUTIL_ERROR_BASE_PHOTO_EXPORT_UTIL = 0x8002c200, + CELL_SYSUTIL_ERROR_BASE_USERINFO = 0x8002c300, + CELL_SYSUTIL_ERROR_BASE_PRINT = 0x8002c400, + CELL_SYSUTIL_ERROR_BASE_REC = 0x8002c500, + CELL_SYSUTIL_ERROR_BASE_MUSIC_EXPORT_UTIL = 0x8002c600, + CELL_SYSUTIL_ERROR_BASE_PHOTO_IMPORT = 0x8002c700, + CELL_SYSUTIL_ERROR_BASE_SEARCH = 0x8002c800, + CELL_SYSUTIL_ERROR_BASE_PHOTO_DECODE = 0x8002c900, + CELL_SYSUTIL_ERROR_BASE_VIDEO_EXPORT_UTIL = 0x8002ca00, + CELL_SYSUTIL_ERROR_BASE_GAME = 0x8002cb00, + CELL_SYSUTIL_ERROR_BASE_GAMEUPDATE = 0x8002cc00, + CELL_SYSUTIL_ERROR_BASE_AP = 0x8002cd00, + CELL_SYSUTIL_ERROR_BASE_COMBOPLAY = 0x8002cd80, + CELL_SYSUTIL_ERROR_BASE_BGDL = 0x8002ce00, + CELL_SYSUTIL_ERROR_BASE_VIDEO_UPLOAD_UTIL = 0x8002d000, + CELL_SYSUTIL_ERROR_BASE_SCREENSHOT = 0x8002d100, + CELL_SYSUTIL_ERROR_BASE_AUTHDIALOG = 0x8002d200, + CELL_SYSUTIL_ERROR_BASE_BGMPLAYBACK_EX = 0x8002d300, + CELL_SYSUTIL_ERROR_BASE_SYSTEM_CHAT = 0x8002d400, CELL_SYSUTIL_ERROR_BASE_PHOTO_NETWORK_SHARING = 0x8002d500, }; enum CellSysutilError : u32 { - CELL_SYSUTIL_ERROR_TYPE = 0x8002b101, - CELL_SYSUTIL_ERROR_VALUE = 0x8002b102, - CELL_SYSUTIL_ERROR_SIZE = 0x8002b103, - CELL_SYSUTIL_ERROR_NUM = 0x8002b104, - CELL_SYSUTIL_ERROR_BUSY = 0x8002b105, - CELL_SYSUTIL_ERROR_STATUS = 0x8002b106, - CELL_SYSUTIL_ERROR_MEMORY = 0x8002b107, + CELL_SYSUTIL_ERROR_TYPE = 0x8002b101, + CELL_SYSUTIL_ERROR_VALUE = 0x8002b102, + CELL_SYSUTIL_ERROR_SIZE = 0x8002b103, + CELL_SYSUTIL_ERROR_NUM = 0x8002b104, + CELL_SYSUTIL_ERROR_BUSY = 0x8002b105, + CELL_SYSUTIL_ERROR_STATUS = 0x8002b106, + CELL_SYSUTIL_ERROR_MEMORY = 0x8002b107, CELL_SYSUTIL_ERROR_3D_SUPPORT = 0x8002b108, }; // Parameter IDs -enum CellSysutilParamId: s32 +enum CellSysutilParamId : s32 { // Integers - CELL_SYSUTIL_SYSTEMPARAM_ID_LANG = 0x0111, - CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN = 0x0112, - CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT = 0x0114, - CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT = 0x0115, - CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE = 0x0116, - CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME = 0x0117, - CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL = 0x0121, - CELL_SYSUTIL_SYSTEMPARAM_ID_LICENSE_AREA = 0x0122, - CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT = 0x0123, - CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT = 0x0141, - CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ = 0x0151, - CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE = 0x0152, - CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE = 0x0153, - CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD = 0x0154, - CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD = 0x0155, - CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF = 0x0156, - CELL_SYSUTIL_SYSTEMPARAM_ID_MAGNETOMETER = 0x0157, + CELL_SYSUTIL_SYSTEMPARAM_ID_LANG = 0x0111, + CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN = 0x0112, + CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT = 0x0114, + CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT = 0x0115, + CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE = 0x0116, + CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME = 0x0117, + CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL = 0x0121, + CELL_SYSUTIL_SYSTEMPARAM_ID_LICENSE_AREA = 0x0122, + CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT = 0x0123, + CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT = 0x0141, + CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ = 0x0151, + CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE = 0x0152, + CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE = 0x0153, + CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD = 0x0154, + CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD = 0x0155, + CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF = 0x0156, + CELL_SYSUTIL_SYSTEMPARAM_ID_MAGNETOMETER = 0x0157, // Strings - CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME = 0x0113, - CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME = 0x0131, + CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME = 0x0113, + CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME = 0x0131, // Unknown strings - CELL_SYSUTIL_SYSTEMPARAM_ID_x1008 = 0x1008, - CELL_SYSUTIL_SYSTEMPARAM_ID_x1011 = 0x1011, - CELL_SYSUTIL_SYSTEMPARAM_ID_x1012 = 0x1012, // Equal meaning to x1011 - CELL_SYSUTIL_SYSTEMPARAM_ID_x1024 = 0x1024, + CELL_SYSUTIL_SYSTEMPARAM_ID_x1008 = 0x1008, + CELL_SYSUTIL_SYSTEMPARAM_ID_x1011 = 0x1011, + CELL_SYSUTIL_SYSTEMPARAM_ID_x1012 = 0x1012, // Equal meaning to x1011 + CELL_SYSUTIL_SYSTEMPARAM_ID_x1024 = 0x1024, }; enum CellSysutilLang : s32 { - CELL_SYSUTIL_LANG_JAPANESE = 0, - CELL_SYSUTIL_LANG_ENGLISH_US = 1, - CELL_SYSUTIL_LANG_FRENCH = 2, - CELL_SYSUTIL_LANG_SPANISH = 3, - CELL_SYSUTIL_LANG_GERMAN = 4, - CELL_SYSUTIL_LANG_ITALIAN = 5, - CELL_SYSUTIL_LANG_DUTCH = 6, - CELL_SYSUTIL_LANG_PORTUGUESE_PT = 7, - CELL_SYSUTIL_LANG_RUSSIAN = 8, - CELL_SYSUTIL_LANG_KOREAN = 9, - CELL_SYSUTIL_LANG_CHINESE_T = 10, - CELL_SYSUTIL_LANG_CHINESE_S = 11, - CELL_SYSUTIL_LANG_FINNISH = 12, - CELL_SYSUTIL_LANG_SWEDISH = 13, - CELL_SYSUTIL_LANG_DANISH = 14, - CELL_SYSUTIL_LANG_NORWEGIAN = 15, - CELL_SYSUTIL_LANG_POLISH = 16, - CELL_SYSUTIL_LANG_PORTUGUESE_BR = 17, // FW 4.00 - CELL_SYSUTIL_LANG_ENGLISH_GB = 18, // FW 4.00 - CELL_SYSUTIL_LANG_TURKISH = 19, // FW 4.30 + CELL_SYSUTIL_LANG_JAPANESE = 0, + CELL_SYSUTIL_LANG_ENGLISH_US = 1, + CELL_SYSUTIL_LANG_FRENCH = 2, + CELL_SYSUTIL_LANG_SPANISH = 3, + CELL_SYSUTIL_LANG_GERMAN = 4, + CELL_SYSUTIL_LANG_ITALIAN = 5, + CELL_SYSUTIL_LANG_DUTCH = 6, + CELL_SYSUTIL_LANG_PORTUGUESE_PT = 7, + CELL_SYSUTIL_LANG_RUSSIAN = 8, + CELL_SYSUTIL_LANG_KOREAN = 9, + CELL_SYSUTIL_LANG_CHINESE_T = 10, + CELL_SYSUTIL_LANG_CHINESE_S = 11, + CELL_SYSUTIL_LANG_FINNISH = 12, + CELL_SYSUTIL_LANG_SWEDISH = 13, + CELL_SYSUTIL_LANG_DANISH = 14, + CELL_SYSUTIL_LANG_NORWEGIAN = 15, + CELL_SYSUTIL_LANG_POLISH = 16, + CELL_SYSUTIL_LANG_PORTUGUESE_BR = 17, // FW 4.00 + CELL_SYSUTIL_LANG_ENGLISH_GB = 18, // FW 4.00 + CELL_SYSUTIL_LANG_TURKISH = 19, // FW 4.30 }; enum @@ -122,34 +122,34 @@ enum enum { - CELL_SYSUTIL_KEYBOARD_ENTRY_METHOD_ROMAJI_INPUT = 0, - CELL_SYSUTIL_KEYBOARD_ENTRY_METHOD_KANA_INPUT = 1, + CELL_SYSUTIL_KEYBOARD_ENTRY_METHOD_ROMAJI_INPUT = 0, + CELL_SYSUTIL_KEYBOARD_ENTRY_METHOD_KANA_INPUT = 1, }; enum { - CELL_SYSUTIL_KEYBOARD_ENTRY_METHOD_ZHUYIN_INPUT = 0, - CELL_SYSUTIL_KEYBOARD_ENTRY_METHOD_PINYIN_INPUT = 1, + CELL_SYSUTIL_KEYBOARD_ENTRY_METHOD_ZHUYIN_INPUT = 0, + CELL_SYSUTIL_KEYBOARD_ENTRY_METHOD_PINYIN_INPUT = 1, CELL_SYSUTIL_KEYBOARD_ENTRY_METHOD_CANGJIE_INPUT = 2, }; enum { - CELL_SYSUTIL_REQUEST_EXITGAME = 0x0101, - CELL_SYSUTIL_DRAWING_BEGIN = 0x0121, - CELL_SYSUTIL_DRAWING_END = 0x0122, - CELL_SYSUTIL_SYSTEM_MENU_OPEN = 0x0131, + CELL_SYSUTIL_REQUEST_EXITGAME = 0x0101, + CELL_SYSUTIL_DRAWING_BEGIN = 0x0121, + CELL_SYSUTIL_DRAWING_END = 0x0122, + CELL_SYSUTIL_SYSTEM_MENU_OPEN = 0x0131, CELL_SYSUTIL_SYSTEM_MENU_CLOSE = 0x0132, - CELL_SYSUTIL_BGMPLAYBACK_PLAY = 0x0141, - CELL_SYSUTIL_BGMPLAYBACK_STOP = 0x0142, + CELL_SYSUTIL_BGMPLAYBACK_PLAY = 0x0141, + CELL_SYSUTIL_BGMPLAYBACK_STOP = 0x0142, - CELL_SYSUTIL_NP_INVITATION_SELECTED = 0x0151, + CELL_SYSUTIL_NP_INVITATION_SELECTED = 0x0151, CELL_SYSUTIL_NP_DATA_MESSAGE_SELECTED = 0x0152, - CELL_SYSUTIL_SYSCHAT_START = 0x0161, - CELL_SYSUTIL_SYSCHAT_STOP = 0x0162, + CELL_SYSUTIL_SYSCHAT_START = 0x0161, + CELL_SYSUTIL_SYSCHAT_STOP = 0x0162, CELL_SYSUTIL_SYSCHAT_VOICE_STREAMING_RESUMED = 0x0163, - CELL_SYSUTIL_SYSCHAT_VOICE_STREAMING_PAUSED = 0x0164, + CELL_SYSUTIL_SYSCHAT_VOICE_STREAMING_PAUSED = 0x0164, }; using CellSysutilCallback = void(u64 status, u64 param, vm::ptr userdata); @@ -157,7 +157,7 @@ using CellSysutilCallback = void(u64 status, u64 param, vm::ptr userdata); enum { CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CIRCLE = 0, - CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS = 1, + CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS = 1, }; enum @@ -175,38 +175,38 @@ enum enum { - CELL_SYSUTIL_GAME_PARENTAL_OFF = 0, - CELL_SYSUTIL_GAME_PARENTAL_LEVEL01 = 1, - CELL_SYSUTIL_GAME_PARENTAL_LEVEL02 = 2, - CELL_SYSUTIL_GAME_PARENTAL_LEVEL03 = 3, - CELL_SYSUTIL_GAME_PARENTAL_LEVEL04 = 4, - CELL_SYSUTIL_GAME_PARENTAL_LEVEL05 = 5, - CELL_SYSUTIL_GAME_PARENTAL_LEVEL06 = 6, - CELL_SYSUTIL_GAME_PARENTAL_LEVEL07 = 7, - CELL_SYSUTIL_GAME_PARENTAL_LEVEL08 = 8, - CELL_SYSUTIL_GAME_PARENTAL_LEVEL09 = 9, - CELL_SYSUTIL_GAME_PARENTAL_LEVEL10 = 10, - CELL_SYSUTIL_GAME_PARENTAL_LEVEL11 = 11, + CELL_SYSUTIL_GAME_PARENTAL_OFF = 0, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL01 = 1, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL02 = 2, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL03 = 3, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL04 = 4, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL05 = 5, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL06 = 6, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL07 = 7, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL08 = 8, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL09 = 9, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL10 = 10, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL11 = 11, }; enum { - CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF = 0, - CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_ON = 1, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF = 0, + CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_ON = 1, }; enum { - CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED = 0, - CELL_SYSUTIL_CAMERA_PLFREQ_50HZ = 1, - CELL_SYSUTIL_CAMERA_PLFREQ_60HZ = 2, - CELL_SYSUTIL_CAMERA_PLFREQ_DEVCIE_DEPEND = 4, + CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED = 0, + CELL_SYSUTIL_CAMERA_PLFREQ_50HZ = 1, + CELL_SYSUTIL_CAMERA_PLFREQ_60HZ = 2, + CELL_SYSUTIL_CAMERA_PLFREQ_DEVCIE_DEPEND = 4, }; enum { - CELL_SYSUTIL_PAD_RUMBLE_OFF = 0, - CELL_SYSUTIL_PAD_RUMBLE_ON = 1, + CELL_SYSUTIL_PAD_RUMBLE_OFF = 0, + CELL_SYSUTIL_PAD_RUMBLE_ON = 1, }; // License areas @@ -224,49 +224,49 @@ enum CellSysutilLicenseArea : s32 // Made up name enum { CELL_SYSUTIL_PAD_AUTOOFF_OFF = 0, - CELL_SYSUTIL_PAD_AUTOOFF_ON = 1, + CELL_SYSUTIL_PAD_AUTOOFF_ON = 1, }; enum { CELL_SYSUTIL_MAGNETOMETER_OFF = 0, - CELL_SYSUTIL_MAGNETOMETER_ON = 1, + CELL_SYSUTIL_MAGNETOMETER_ON = 1, }; enum { CELL_SYSUTIL_INTERNET_BROWSER_START_RESTRICT_OFF = 0, - CELL_SYSUTIL_INTERNET_BROWSER_START_RESTRICT_ON = 1, + CELL_SYSUTIL_INTERNET_BROWSER_START_RESTRICT_ON = 1, }; enum { - CELL_SYSCACHE_RET_OK_CLEARED = 0, - CELL_SYSCACHE_RET_OK_RELAYED = 1, + CELL_SYSCACHE_RET_OK_CLEARED = 0, + CELL_SYSCACHE_RET_OK_RELAYED = 1, - CELL_SYSCACHE_ID_SIZE = 32, - CELL_SYSCACHE_PATH_MAX = 1055, + CELL_SYSCACHE_ID_SIZE = 32, + CELL_SYSCACHE_PATH_MAX = 1055, }; enum CellSysCacheError : u32 { - CELL_SYSCACHE_ERROR_ACCESS_ERROR = 0x8002bc01, // I don't think we need this - CELL_SYSCACHE_ERROR_INTERNAL = 0x8002bc02, // Not really useful, if we run out of HDD space sys_fs should handle that + CELL_SYSCACHE_ERROR_ACCESS_ERROR = 0x8002bc01, // I don't think we need this + CELL_SYSCACHE_ERROR_INTERNAL = 0x8002bc02, // Not really useful, if we run out of HDD space sys_fs should handle that - CELL_SYSCACHE_ERROR_PARAM = 0x8002bc03, - CELL_SYSCACHE_ERROR_NOTMOUNTED = 0x8002bc04, // We don't really need to simulate the mounting, so this is probably useless + CELL_SYSCACHE_ERROR_PARAM = 0x8002bc03, + CELL_SYSCACHE_ERROR_NOTMOUNTED = 0x8002bc04, // We don't really need to simulate the mounting, so this is probably useless }; enum CellBgmplaybackError : u32 { - CELL_SYSUTIL_BGMPLAYBACK_ERROR_PARAM = 0x8002b101, - CELL_SYSUTIL_BGMPLAYBACK_ERROR_BUSY = 0x8002b102, - CELL_SYSUTIL_BGMPLAYBACK_ERROR_GENERIC = 0x8002b1FF, + CELL_SYSUTIL_BGMPLAYBACK_ERROR_PARAM = 0x8002b101, + CELL_SYSUTIL_BGMPLAYBACK_ERROR_BUSY = 0x8002b102, + CELL_SYSUTIL_BGMPLAYBACK_ERROR_GENERIC = 0x8002b1FF, - CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_PARAM = 0x8002d301, + CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_PARAM = 0x8002d301, CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_ALREADY_SETPARAM = 0x8002d302, CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_DISABLE_SETPARAM = 0x8002d303, - CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_GENERIC = 0x8002d3FF, + CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_GENERIC = 0x8002d3FF, }; enum CellSysutilBgmPlaybackStatusState @@ -290,7 +290,7 @@ struct CellSysutilBgmPlaybackStatus { u8 playerState; u8 enableState; - char contentId[16]; // CellSearchContentId + char contentId[16]; // CellSearchContentId u8 currentFadeRatio; // current volume ratio (0=0%, 255=100%) char reserved[13]; }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAp.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAp.cpp index bb9d4e562..46afed8bf 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAp.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAp.cpp @@ -1,49 +1,47 @@ #include "stdafx.h" #include "Emu/Cell/PPUModule.h" - - LOG_CHANNEL(cellSysutilAp); // Return Codes enum CellSysutilApError : u32 { - CELL_SYSUTIL_AP_ERROR_OUT_OF_MEMORY = 0x8002cd00, - CELL_SYSUTIL_AP_ERROR_FATAL = 0x8002cd01, - CELL_SYSUTIL_AP_ERROR_INVALID_VALUE = 0x8002cd02, - CELL_SYSUTIL_AP_ERROR_NOT_INITIALIZED = 0x8002cd03, - CELL_SYSUTIL_AP_ERROR_ZERO_REGISTERED = 0x8002cd13, - CELL_SYSUTIL_AP_ERROR_NETIF_DISABLED = 0x8002cd14, - CELL_SYSUTIL_AP_ERROR_NETIF_NO_CABLE = 0x8002cd15, + CELL_SYSUTIL_AP_ERROR_OUT_OF_MEMORY = 0x8002cd00, + CELL_SYSUTIL_AP_ERROR_FATAL = 0x8002cd01, + CELL_SYSUTIL_AP_ERROR_INVALID_VALUE = 0x8002cd02, + CELL_SYSUTIL_AP_ERROR_NOT_INITIALIZED = 0x8002cd03, + CELL_SYSUTIL_AP_ERROR_ZERO_REGISTERED = 0x8002cd13, + CELL_SYSUTIL_AP_ERROR_NETIF_DISABLED = 0x8002cd14, + CELL_SYSUTIL_AP_ERROR_NETIF_NO_CABLE = 0x8002cd15, CELL_SYSUTIL_AP_ERROR_NETIF_CANNOT_CONNECT = 0x8002cd16, }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SYSUTIL_AP_ERROR_OUT_OF_MEMORY); - STR_CASE(CELL_SYSUTIL_AP_ERROR_FATAL); - STR_CASE(CELL_SYSUTIL_AP_ERROR_INVALID_VALUE); - STR_CASE(CELL_SYSUTIL_AP_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_SYSUTIL_AP_ERROR_ZERO_REGISTERED); - STR_CASE(CELL_SYSUTIL_AP_ERROR_NETIF_DISABLED); - STR_CASE(CELL_SYSUTIL_AP_ERROR_NETIF_NO_CABLE); - STR_CASE(CELL_SYSUTIL_AP_ERROR_NETIF_CANNOT_CONNECT); - } + switch (error) + { + STR_CASE(CELL_SYSUTIL_AP_ERROR_OUT_OF_MEMORY); + STR_CASE(CELL_SYSUTIL_AP_ERROR_FATAL); + STR_CASE(CELL_SYSUTIL_AP_ERROR_INVALID_VALUE); + STR_CASE(CELL_SYSUTIL_AP_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_SYSUTIL_AP_ERROR_ZERO_REGISTERED); + STR_CASE(CELL_SYSUTIL_AP_ERROR_NETIF_DISABLED); + STR_CASE(CELL_SYSUTIL_AP_ERROR_NETIF_NO_CABLE); + STR_CASE(CELL_SYSUTIL_AP_ERROR_NETIF_CANNOT_CONNECT); + } - return unknown; - }); + return unknown; + }); } enum { CELL_SYSUTIL_AP_TITLE_ID_LEN = 9, - CELL_SYSUTIL_AP_SSID_LEN = 32, - CELL_SYSUTIL_AP_WPA_KEY_LEN = 64 + CELL_SYSUTIL_AP_SSID_LEN = 32, + CELL_SYSUTIL_AP_WPA_KEY_LEN = 64 }; struct CellSysutilApTitleId @@ -76,7 +74,7 @@ struct CellSysutilApParam s32 cellSysutilApGetRequiredMemSize() { cellSysutilAp.trace("cellSysutilApGetRequiredMemSize()"); - return 1024*1024; // Return 1 MB as required size + return 1024 * 1024; // Return 1 MB as required size } error_code cellSysutilApOn(vm::ptr pParam, u32 container) @@ -92,8 +90,8 @@ error_code cellSysutilApOff() } DECLARE(ppu_module_manager::cellSysutilAp)("cellSysutilAp", []() -{ - REG_FUNC(cellSysutilAp, cellSysutilApGetRequiredMemSize); - REG_FUNC(cellSysutilAp, cellSysutilApOn); - REG_FUNC(cellSysutilAp, cellSysutilApOff); -}); + { + REG_FUNC(cellSysutilAp, cellSysutilApGetRequiredMemSize); + REG_FUNC(cellSysutilAp, cellSysutilApOn); + REG_FUNC(cellSysutilAp, cellSysutilApOff); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc.cpp index c336f0804..e1375087d 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc.cpp @@ -6,33 +6,35 @@ LOG_CHANNEL(cellSysutil); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_AVC_ERROR_UNKNOWN); - STR_CASE(CELL_AVC_ERROR_NOT_SUPPORTED); - STR_CASE(CELL_AVC_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_AVC_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_AVC_ERROR_INVALID_ARGUMENT); - STR_CASE(CELL_AVC_ERROR_OUT_OF_MEMORY); - STR_CASE(CELL_AVC_ERROR_BAD_ID); - STR_CASE(CELL_AVC_ERROR_INVALID_STATUS); - STR_CASE(CELL_AVC_ERROR_TIMEOUT); - STR_CASE(CELL_AVC_ERROR_NO_SESSION); - STR_CASE(CELL_AVC_ERROR_INCOMPATIBLE_PROTOCOL); - STR_CASE(CELL_AVC_ERROR_PEER_UNREACHABLE); - } + switch (error) + { + STR_CASE(CELL_AVC_ERROR_UNKNOWN); + STR_CASE(CELL_AVC_ERROR_NOT_SUPPORTED); + STR_CASE(CELL_AVC_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_AVC_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_AVC_ERROR_INVALID_ARGUMENT); + STR_CASE(CELL_AVC_ERROR_OUT_OF_MEMORY); + STR_CASE(CELL_AVC_ERROR_BAD_ID); + STR_CASE(CELL_AVC_ERROR_INVALID_STATUS); + STR_CASE(CELL_AVC_ERROR_TIMEOUT); + STR_CASE(CELL_AVC_ERROR_NO_SESSION); + STR_CASE(CELL_AVC_ERROR_INCOMPATIBLE_PROTOCOL); + STR_CASE(CELL_AVC_ERROR_PEER_UNREACHABLE); + } - return unknown; - }); + return unknown; + }); } // Callback handle tag type -struct avc_cb_handle_t{}; +struct avc_cb_handle_t +{ +}; struct avc_settings { @@ -246,7 +248,7 @@ error_code cellSysutilAvcLoadAsync(vm::ptr func, vm::ptr cellSysutil.todo("cellSysutilAvcLoadAsync(func=*0x%x, userdata=*0x%x, container=0x%x, media=0x%x, videoQuality=0x%x, voiceQuality=0x%x, request_id=*0x%x)", func, userdata, container, +media, +videoQuality, +voiceQuality, request_id); - //if (sys_memory_container_get_size(.., container) != CELL_OK) + // if (sys_memory_container_get_size(.., container) != CELL_OK) // return CELL_AVC_ERROR_INVALID_ARGUMENT; switch (media) diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc.h index e5b2005f0..fdd742188 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc.h @@ -4,102 +4,102 @@ enum CellAvcError : u32 { - CELL_AVC_ERROR_UNKNOWN = 0x8002b701, - CELL_AVC_ERROR_NOT_SUPPORTED = 0x8002b702, - CELL_AVC_ERROR_NOT_INITIALIZED = 0x8002b703, - CELL_AVC_ERROR_ALREADY_INITIALIZED = 0x8002b704, - CELL_AVC_ERROR_INVALID_ARGUMENT = 0x8002b705, - CELL_AVC_ERROR_OUT_OF_MEMORY = 0x8002b706, - CELL_AVC_ERROR_BAD_ID = 0x8002b707, - CELL_AVC_ERROR_INVALID_STATUS = 0x8002b70a, - CELL_AVC_ERROR_TIMEOUT = 0x8002b70b, - CELL_AVC_ERROR_NO_SESSION = 0x8002b70d, + CELL_AVC_ERROR_UNKNOWN = 0x8002b701, + CELL_AVC_ERROR_NOT_SUPPORTED = 0x8002b702, + CELL_AVC_ERROR_NOT_INITIALIZED = 0x8002b703, + CELL_AVC_ERROR_ALREADY_INITIALIZED = 0x8002b704, + CELL_AVC_ERROR_INVALID_ARGUMENT = 0x8002b705, + CELL_AVC_ERROR_OUT_OF_MEMORY = 0x8002b706, + CELL_AVC_ERROR_BAD_ID = 0x8002b707, + CELL_AVC_ERROR_INVALID_STATUS = 0x8002b70a, + CELL_AVC_ERROR_TIMEOUT = 0x8002b70b, + CELL_AVC_ERROR_NO_SESSION = 0x8002b70d, CELL_AVC_ERROR_INCOMPATIBLE_PROTOCOL = 0x8002b70e, - CELL_AVC_ERROR_PEER_UNREACHABLE = 0x8002b710, + CELL_AVC_ERROR_PEER_UNREACHABLE = 0x8002b710, }; enum CellSysutilAvcTransitionType : u32 { - CELL_SYSUTIL_AVC_TRANSITION_LINEAR = 0x00000000, + CELL_SYSUTIL_AVC_TRANSITION_LINEAR = 0x00000000, CELL_SYSUTIL_AVC_TRANSITION_SLOWDOWN = 0x00000001, - CELL_SYSUTIL_AVC_TRANSITION_FASTUP = 0x00000002, - CELL_SYSUTIL_AVC_TRANSITION_ANGULAR = 0x00000003, + CELL_SYSUTIL_AVC_TRANSITION_FASTUP = 0x00000002, + CELL_SYSUTIL_AVC_TRANSITION_ANGULAR = 0x00000003, CELL_SYSUTIL_AVC_TRANSITION_EXPONENT = 0x00000004, - CELL_SYSUTIL_AVC_TRANSITION_NONE = 0xffffffff + CELL_SYSUTIL_AVC_TRANSITION_NONE = 0xffffffff }; enum CellSysutilAvcWindowZorderMode : u32 { CELL_SYSUTIL_AVC_ZORDER_FORWARD_MOST = 0x00000002, - CELL_SYSUTIL_AVC_ZORDER_BEHIND_MOST = 0x00000003, + CELL_SYSUTIL_AVC_ZORDER_BEHIND_MOST = 0x00000003, }; enum : u32 { CELL_AVC_REQUEST_ID_SYSTEM_EVENT = 0x00000000, - CELL_SYSUTIL_AVC_VIDEO_MEMORY_SIZE = 26 * 1024 * 1024, - CELL_SYSUTIL_AVC_VOICE_MEMORY_SIZE = 8 * 1024 * 1024, - CELL_SYSUTIL_AVC_EXTRA_MEMORY_SIZE_FOR_SHARING_VIDEO_BUFFER = 2 * 1024 * 1024, + CELL_SYSUTIL_AVC_VIDEO_MEMORY_SIZE = 26 * 1024 * 1024, + CELL_SYSUTIL_AVC_VOICE_MEMORY_SIZE = 8 * 1024 * 1024, + CELL_SYSUTIL_AVC_EXTRA_MEMORY_SIZE_FOR_SHARING_VIDEO_BUFFER = 2 * 1024 * 1024, CELL_SYSUTIL_AVC_OPTION_PARAM_VERSION = 100, }; enum CellSysutilAvcEvent : u32 { - CELL_AVC_EVENT_LOAD_SUCCEEDED = 0x00000001, - CELL_AVC_EVENT_LOAD_FAILED = 0x00000002, + CELL_AVC_EVENT_LOAD_SUCCEEDED = 0x00000001, + CELL_AVC_EVENT_LOAD_FAILED = 0x00000002, CELL_AVC_EVENT_UNLOAD_SUCCEEDED = 0x00000003, - CELL_AVC_EVENT_UNLOAD_FAILED = 0x00000004, - CELL_AVC_EVENT_JOIN_SUCCEEDED = 0x00000005, - CELL_AVC_EVENT_JOIN_FAILED = 0x00000006, - CELL_AVC_EVENT_BYE_SUCCEEDED = 0x00000007, - CELL_AVC_EVENT_BYE_FAILED = 0x00000008, + CELL_AVC_EVENT_UNLOAD_FAILED = 0x00000004, + CELL_AVC_EVENT_JOIN_SUCCEEDED = 0x00000005, + CELL_AVC_EVENT_JOIN_FAILED = 0x00000006, + CELL_AVC_EVENT_BYE_SUCCEEDED = 0x00000007, + CELL_AVC_EVENT_BYE_FAILED = 0x00000008, - CELL_AVC_EVENT_SYSTEM_NEW_MEMBER_JOINED = 0x10000001, - CELL_AVC_EVENT_SYSTEM_MEMBER_LEFT = 0x10000002, - CELL_AVC_EVENT_SYSTEM_SESSION_ESTABLISHED = 0x10000003, + CELL_AVC_EVENT_SYSTEM_NEW_MEMBER_JOINED = 0x10000001, + CELL_AVC_EVENT_SYSTEM_MEMBER_LEFT = 0x10000002, + CELL_AVC_EVENT_SYSTEM_SESSION_ESTABLISHED = 0x10000003, CELL_AVC_EVENT_SYSTEM_SESSION_CANNOT_ESTABLISHED = 0x10000004, - CELL_AVC_EVENT_SYSTEM_SESSION_DISCONNECTED = 0x10000005, - CELL_AVC_EVENT_SYSTEM_VOICE_DETECTED = 0x10000006, - CELL_AVC_EVENT_SYSTEM_MIC_DETECTED = 0x10000007, - CELL_AVC_EVENT_SYSTEM_CAMERA_DETECTED = 0x10000008, + CELL_AVC_EVENT_SYSTEM_SESSION_DISCONNECTED = 0x10000005, + CELL_AVC_EVENT_SYSTEM_VOICE_DETECTED = 0x10000006, + CELL_AVC_EVENT_SYSTEM_MIC_DETECTED = 0x10000007, + CELL_AVC_EVENT_SYSTEM_CAMERA_DETECTED = 0x10000008, }; enum CellSysUtilAvcEventParam : u64 { - CELL_AVC_EVENT_PARAM_ERROR_UNKNOWN = 0x00000001, - CELL_AVC_EVENT_PARAM_ERROR_NOT_SUPPORTED = 0x00000002, - CELL_AVC_EVENT_PARAM_ERROR_INVALID_ARGUMENT = 0x00000003, - CELL_AVC_EVENT_PARAM_ERROR_OUT_OF_MEMORY = 0x00000004, - CELL_AVC_EVENT_PARAM_ERROR_INVALID_STATUS = 0x00000005, - CELL_AVC_EVENT_PARAM_ERROR_TIMEOUT = 0x00000006, + CELL_AVC_EVENT_PARAM_ERROR_UNKNOWN = 0x00000001, + CELL_AVC_EVENT_PARAM_ERROR_NOT_SUPPORTED = 0x00000002, + CELL_AVC_EVENT_PARAM_ERROR_INVALID_ARGUMENT = 0x00000003, + CELL_AVC_EVENT_PARAM_ERROR_OUT_OF_MEMORY = 0x00000004, + CELL_AVC_EVENT_PARAM_ERROR_INVALID_STATUS = 0x00000005, + CELL_AVC_EVENT_PARAM_ERROR_TIMEOUT = 0x00000006, CELL_AVC_EVENT_PARAM_ERROR_CONTEXT_DOES_NOT_EXIST = 0x00000007, - CELL_AVC_EVENT_PARAM_ERROR_ROOM_DOES_NOT_EXIST = 0x00000008, - CELL_AVC_EVENT_PARAM_ERROR_MEDIA_MISMATCHED = 0x00000009, - CELL_AVC_EVENT_PARAM_ERROR_MEMBER_EXCEEDED = 0x0000000A, - CELL_AVC_EVENT_PARAM_ERROR_MASTER_LEFT = 0x0000000B, - CELL_AVC_EVENT_PARAM_ERROR_NETWORK_ERROR = 0x0000000C, - CELL_AVC_EVENT_PARAM_ERROR_INCOMPATIBLE_PROTOCOL = 0x0000000D, + CELL_AVC_EVENT_PARAM_ERROR_ROOM_DOES_NOT_EXIST = 0x00000008, + CELL_AVC_EVENT_PARAM_ERROR_MEDIA_MISMATCHED = 0x00000009, + CELL_AVC_EVENT_PARAM_ERROR_MEMBER_EXCEEDED = 0x0000000A, + CELL_AVC_EVENT_PARAM_ERROR_MASTER_LEFT = 0x0000000B, + CELL_AVC_EVENT_PARAM_ERROR_NETWORK_ERROR = 0x0000000C, + CELL_AVC_EVENT_PARAM_ERROR_INCOMPATIBLE_PROTOCOL = 0x0000000D, }; enum CellSysUtilAvcAttribute : u32 { - CELL_SYSUTIL_AVC_ATTRIBUTE_DEFAULT_TRANSITION_TYPE = 0x00000001, + CELL_SYSUTIL_AVC_ATTRIBUTE_DEFAULT_TRANSITION_TYPE = 0x00000001, CELL_SYSUTIL_AVC_ATTRIBUTE_DEFAULT_TRANSITION_DURATION = 0x00000002, CELL_SYSUTIL_AVC_ATTRIBUTE_DEFAULT_INITIAL_SHOW_STATUS = 0x00000003, - CELL_SYSUTIL_AVC_ATTRIBUTE_VOICE_DETECT_EVENT_TYPE = 0x00000004, - CELL_SYSUTIL_AVC_ATTRIBUTE_VOICE_DETECT_INTERVAL_TIME = 0x00000005, - CELL_SYSUTIL_AVC_ATTRIBUTE_VOICE_DETECT_SIGNAL_LEVEL = 0x00000006, - CELL_SYSUTIL_AVC_ATTRIBUTE_ROOM_PRIVILEGE_TYPE = 0x00000007, - CELL_SYSUTIL_AVC_ATTRIBUTE_VIDEO_MAX_BITRATE = 0x00000008, + CELL_SYSUTIL_AVC_ATTRIBUTE_VOICE_DETECT_EVENT_TYPE = 0x00000004, + CELL_SYSUTIL_AVC_ATTRIBUTE_VOICE_DETECT_INTERVAL_TIME = 0x00000005, + CELL_SYSUTIL_AVC_ATTRIBUTE_VOICE_DETECT_SIGNAL_LEVEL = 0x00000006, + CELL_SYSUTIL_AVC_ATTRIBUTE_ROOM_PRIVILEGE_TYPE = 0x00000007, + CELL_SYSUTIL_AVC_ATTRIBUTE_VIDEO_MAX_BITRATE = 0x00000008, }; enum CellSysutilAvcLayoutMode : u32 { - CELL_SYSUTIL_AVC_LAYOUT_LEFT = 0x00000000, - CELL_SYSUTIL_AVC_LAYOUT_RIGHT = 0x00000001, - CELL_SYSUTIL_AVC_LAYOUT_TOP = 0x00000002, + CELL_SYSUTIL_AVC_LAYOUT_LEFT = 0x00000000, + CELL_SYSUTIL_AVC_LAYOUT_RIGHT = 0x00000001, + CELL_SYSUTIL_AVC_LAYOUT_TOP = 0x00000002, CELL_SYSUTIL_AVC_LAYOUT_BOTTOM = 0x00000003, }; @@ -112,7 +112,7 @@ enum CellSysUtilAvcMediaType : u32 enum CellSysutilAvcRoomPrivilegeType : u32 { CELL_SYSUTIL_AVC_ROOM_PRIVILEGE_TYPE_NO_AUTO_GRANT = 0x00000000, - CELL_SYSUTIL_AVC_ROOM_PRIVILEGE_TYPE_AUTO_GRANT = 0x00000001 + CELL_SYSUTIL_AVC_ROOM_PRIVILEGE_TYPE_AUTO_GRANT = 0x00000001 }; enum CellSysUtilAvcVideoQuality : u32 @@ -123,12 +123,12 @@ enum CellSysUtilAvcVideoQuality : u32 enum CellSysutilAvcVoiceDetectEventType : u32 { CELL_SYSUTIL_AVC_VOICE_DETECT_EVENT_TYPE_SIGNAL = 0x00000001, - CELL_SYSUTIL_AVC_VOICE_DETECT_EVENT_TYPE_SPEAK = 0x00000002 + CELL_SYSUTIL_AVC_VOICE_DETECT_EVENT_TYPE_SPEAK = 0x00000002 }; enum CellSysutilAvcVoiceDetectSpeakData : u32 { - CELL_SYSUTIL_AVC_VOICE_DETECT_DATA_SPEAK_STOP = 0x00000000, + CELL_SYSUTIL_AVC_VOICE_DETECT_DATA_SPEAK_STOP = 0x00000000, CELL_SYSUTIL_AVC_VOICE_DETECT_DATA_SPEAK_START = 0x00000001 }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.cpp index 57be7f545..5e7af74a5 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.cpp @@ -10,59 +10,61 @@ LOG_CHANNEL(cellSysutilAvc2); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_AVC2_ERROR_UNKNOWN); - STR_CASE(CELL_AVC2_ERROR_NOT_SUPPORTED); - STR_CASE(CELL_AVC2_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_AVC2_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_AVC2_ERROR_INVALID_ARGUMENT); - STR_CASE(CELL_AVC2_ERROR_OUT_OF_MEMORY); - STR_CASE(CELL_AVC2_ERROR_ERROR_BAD_ID); - STR_CASE(CELL_AVC2_ERROR_INVALID_STATUS); - STR_CASE(CELL_AVC2_ERROR_TIMEOUT); - STR_CASE(CELL_AVC2_ERROR_NO_SESSION); - STR_CASE(CELL_AVC2_ERROR_WINDOW_ALREADY_EXISTS); - STR_CASE(CELL_AVC2_ERROR_TOO_MANY_WINDOWS); - STR_CASE(CELL_AVC2_ERROR_TOO_MANY_PEER_WINDOWS); - STR_CASE(CELL_AVC2_ERROR_WINDOW_NOT_FOUND); - } + switch (error) + { + STR_CASE(CELL_AVC2_ERROR_UNKNOWN); + STR_CASE(CELL_AVC2_ERROR_NOT_SUPPORTED); + STR_CASE(CELL_AVC2_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_AVC2_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_AVC2_ERROR_INVALID_ARGUMENT); + STR_CASE(CELL_AVC2_ERROR_OUT_OF_MEMORY); + STR_CASE(CELL_AVC2_ERROR_ERROR_BAD_ID); + STR_CASE(CELL_AVC2_ERROR_INVALID_STATUS); + STR_CASE(CELL_AVC2_ERROR_TIMEOUT); + STR_CASE(CELL_AVC2_ERROR_NO_SESSION); + STR_CASE(CELL_AVC2_ERROR_WINDOW_ALREADY_EXISTS); + STR_CASE(CELL_AVC2_ERROR_TOO_MANY_WINDOWS); + STR_CASE(CELL_AVC2_ERROR_TOO_MANY_PEER_WINDOWS); + STR_CASE(CELL_AVC2_ERROR_WINDOW_NOT_FOUND); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellSysutilAvc2AttributeId value) - { - switch (value) { - STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DETECT_EVENT_TYPE); - STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DETECT_INTERVAL_TIME); - STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DETECT_SIGNAL_LEVEL); - STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_MAX_BITRATE); - STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DATA_FEC); - STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_PACKET_CONTENTION); - STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DTX_MODE); - STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_MIC_STATUS_DETECTION); - STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_MIC_SETTING_NOTIFICATION); - STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_MUTING_NOTIFICATION); - STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_CAMERA_STATUS_DETECTION); - } + switch (value) + { + STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DETECT_EVENT_TYPE); + STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DETECT_INTERVAL_TIME); + STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DETECT_SIGNAL_LEVEL); + STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_MAX_BITRATE); + STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DATA_FEC); + STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_PACKET_CONTENTION); + STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DTX_MODE); + STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_MIC_STATUS_DETECTION); + STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_MIC_SETTING_NOTIFICATION); + STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_MUTING_NOTIFICATION); + STR_CASE(CELL_SYSUTIL_AVC2_ATTRIBUTE_CAMERA_STATUS_DETECTION); + } - return unknown; - }); + return unknown; + }); } // Callback handle tag type -struct avc2_cb_handle_t{}; +struct avc2_cb_handle_t +{ +}; struct avc2_settings { @@ -368,8 +370,8 @@ error_code cellSysutilAvc2EstimateMemoryContainerSize(vm::cptrmedia_type == CELL_SYSUTIL_AVC2_VIDEO_CHAT) { u32 estimated_size = 0x40e666; - u32 max_windows = initparam->video_param.max_video_windows; - s32 window_count = max_windows; + u32 max_windows = initparam->video_param.max_video_windows; + s32 window_count = max_windows; if (initparam->video_param.video_stream_sharing == CELL_SYSUTIL_AVC2_VIDEO_SHARING_MODE_2) { @@ -800,12 +802,11 @@ error_code cellSysutilAvc2SetSpeakerMuting(u8 muting) error_code cellSysutilAvc2Load_shared(SceNpMatching2ContextId /*ctx_id*/, u32 /*container*/, vm::ptr callback_func, vm::ptr user_data, vm::cptr init_param) { if (!init_param || !init_param->avc_init_param_version || - !(init_param->avc_init_param_version == 100 || - init_param->avc_init_param_version == 110 || - init_param->avc_init_param_version == 120 || - init_param->avc_init_param_version == 130 || - init_param->avc_init_param_version == 140) - ) + !(init_param->avc_init_param_version == 100 || + init_param->avc_init_param_version == 110 || + init_param->avc_init_param_version == 120 || + init_param->avc_init_param_version == 130 || + init_param->avc_init_param_version == 140)) { return CELL_AVC2_ERROR_INVALID_ARGUMENT; } @@ -817,12 +818,11 @@ error_code cellSysutilAvc2Load_shared(SceNpMatching2ContextId /*ctx_id*/, u32 /* case CELL_SYSUTIL_AVC2_VOICE_CHAT: { if (init_param->max_players < 2 || - init_param->max_players > 64 || - init_param->spu_load_average > 100 || - init_param->voice_param.voice_quality != CELL_SYSUTIL_AVC2_VOICE_QUALITY_NORMAL || - init_param->voice_param.max_speakers == 0 || - init_param->voice_param.max_speakers > 16 - ) + init_param->max_players > 64 || + init_param->spu_load_average > 100 || + init_param->voice_param.voice_quality != CELL_SYSUTIL_AVC2_VOICE_QUALITY_NORMAL || + init_param->voice_param.max_speakers == 0 || + init_param->voice_param.max_speakers > 16) { return CELL_AVC2_ERROR_INVALID_ARGUMENT; } @@ -1135,61 +1135,60 @@ error_code cellSysutilAvc2GetWindowPosition(SceNpMatching2RoomMemberId member_id return CELL_OK; } - DECLARE(ppu_module_manager::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); -}); + { + 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/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.h index c82232302..de14c4626 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.h @@ -7,20 +7,20 @@ // Error codes enum CellSysutilAvc2Error : u32 { - CELL_AVC2_ERROR_UNKNOWN = 0x8002b701, - CELL_AVC2_ERROR_NOT_SUPPORTED = 0x8002b702, - CELL_AVC2_ERROR_NOT_INITIALIZED = 0x8002b703, - CELL_AVC2_ERROR_ALREADY_INITIALIZED = 0x8002b704, - CELL_AVC2_ERROR_INVALID_ARGUMENT = 0x8002b705, - CELL_AVC2_ERROR_OUT_OF_MEMORY = 0x8002b706, - CELL_AVC2_ERROR_ERROR_BAD_ID = 0x8002b707, - CELL_AVC2_ERROR_INVALID_STATUS = 0x8002b70a, - CELL_AVC2_ERROR_TIMEOUT = 0x8002b70b, - CELL_AVC2_ERROR_NO_SESSION = 0x8002b70d, + CELL_AVC2_ERROR_UNKNOWN = 0x8002b701, + CELL_AVC2_ERROR_NOT_SUPPORTED = 0x8002b702, + CELL_AVC2_ERROR_NOT_INITIALIZED = 0x8002b703, + CELL_AVC2_ERROR_ALREADY_INITIALIZED = 0x8002b704, + CELL_AVC2_ERROR_INVALID_ARGUMENT = 0x8002b705, + CELL_AVC2_ERROR_OUT_OF_MEMORY = 0x8002b706, + CELL_AVC2_ERROR_ERROR_BAD_ID = 0x8002b707, + CELL_AVC2_ERROR_INVALID_STATUS = 0x8002b70a, + CELL_AVC2_ERROR_TIMEOUT = 0x8002b70b, + CELL_AVC2_ERROR_NO_SESSION = 0x8002b70d, CELL_AVC2_ERROR_WINDOW_ALREADY_EXISTS = 0x8002b70f, - CELL_AVC2_ERROR_TOO_MANY_WINDOWS = 0x8002b710, + CELL_AVC2_ERROR_TOO_MANY_WINDOWS = 0x8002b710, CELL_AVC2_ERROR_TOO_MANY_PEER_WINDOWS = 0x8002b711, - CELL_AVC2_ERROR_WINDOW_NOT_FOUND = 0x8002b712, + CELL_AVC2_ERROR_WINDOW_NOT_FOUND = 0x8002b712, }; enum CellSysutilAvc2MediaType : u32 @@ -41,91 +41,91 @@ enum CellSysutilAvc2VideoQuality : u32 enum CellSysutilAvc2FrameMode : u32 { - CELL_SYSUTIL_AVC2_FRAME_MODE_NORMAL = 0x00000001, + CELL_SYSUTIL_AVC2_FRAME_MODE_NORMAL = 0x00000001, CELL_SYSUTIL_AVC2_FRAME_MODE_INTRA_ONLY = 0x00000002, }; enum CellSysutilAvc2CoordinatesForm : u32 { - CELL_SYSUTIL_AVC2_VIRTUAL_COORDINATES = 0x00000001, + CELL_SYSUTIL_AVC2_VIRTUAL_COORDINATES = 0x00000001, CELL_SYSUTIL_AVC2_ABSOLUTE_COORDINATES = 0x00000002, }; enum CellSysutilAvc2VideoResolution : u32 { CELL_SYSUTIL_AVC2_VIDEO_RESOLUTION_QQVGA = 0x00000001, - CELL_SYSUTIL_AVC2_VIDEO_RESOLUTION_QVGA = 0x00000002, + CELL_SYSUTIL_AVC2_VIDEO_RESOLUTION_QVGA = 0x00000002, }; enum CellSysutilAvc2ChatTargetMode : u32 { - CELL_SYSUTIL_AVC2_CHAT_TARGET_MODE_ROOM = 0x00000100, - CELL_SYSUTIL_AVC2_CHAT_TARGET_MODE_TEAM = 0x00000200, + CELL_SYSUTIL_AVC2_CHAT_TARGET_MODE_ROOM = 0x00000100, + CELL_SYSUTIL_AVC2_CHAT_TARGET_MODE_TEAM = 0x00000200, CELL_SYSUTIL_AVC2_CHAT_TARGET_MODE_PRIVATE = 0x00000300, - CELL_SYSUTIL_AVC2_CHAT_TARGET_MODE_DIRECT = 0x00001000, + CELL_SYSUTIL_AVC2_CHAT_TARGET_MODE_DIRECT = 0x00001000, }; enum CellSysutilAvc2AttributeId : u32 { - CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DETECT_EVENT_TYPE = 0x00001001, + CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DETECT_EVENT_TYPE = 0x00001001, CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DETECT_INTERVAL_TIME = 0x00001002, - CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DETECT_SIGNAL_LEVEL = 0x00001003, - CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_MAX_BITRATE = 0x00001004, - CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DATA_FEC = 0x00001005, - CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_PACKET_CONTENTION = 0x00001006, - CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DTX_MODE = 0x00001007, - CELL_SYSUTIL_AVC2_ATTRIBUTE_MIC_STATUS_DETECTION = 0x00001008, - CELL_SYSUTIL_AVC2_ATTRIBUTE_MIC_SETTING_NOTIFICATION = 0x00001009, - CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_MUTING_NOTIFICATION = 0x0000100A, - CELL_SYSUTIL_AVC2_ATTRIBUTE_CAMERA_STATUS_DETECTION = 0x0000100B, + CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DETECT_SIGNAL_LEVEL = 0x00001003, + CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_MAX_BITRATE = 0x00001004, + CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DATA_FEC = 0x00001005, + CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_PACKET_CONTENTION = 0x00001006, + CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_DTX_MODE = 0x00001007, + CELL_SYSUTIL_AVC2_ATTRIBUTE_MIC_STATUS_DETECTION = 0x00001008, + CELL_SYSUTIL_AVC2_ATTRIBUTE_MIC_SETTING_NOTIFICATION = 0x00001009, + CELL_SYSUTIL_AVC2_ATTRIBUTE_VOICE_MUTING_NOTIFICATION = 0x0000100A, + CELL_SYSUTIL_AVC2_ATTRIBUTE_CAMERA_STATUS_DETECTION = 0x0000100B, }; enum CellSysutilAvc2WindowAttributeId : u32 { - CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_ALPHA = 0x00002001, - CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_TRANSITION_TYPE = 0x00002002, + CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_ALPHA = 0x00002001, + CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_TRANSITION_TYPE = 0x00002002, CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_TRANSITION_DURATION = 0x00002003, - CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_STRING_VISIBLE = 0x00002004, - CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_ROTATION = 0x00002005, - CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_ZORDER = 0x00002006, - CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_SURFACE = 0x00002007, + CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_STRING_VISIBLE = 0x00002004, + CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_ROTATION = 0x00002005, + CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_ZORDER = 0x00002006, + CELL_SYSUTIL_AVC2_WINDOW_ATTRIBUTE_SURFACE = 0x00002007, }; enum CellSysutilAvc2TransitionType : u32 { - CELL_SYSUTIL_AVC2_TRANSITION_NONE = 0xffffffff, - CELL_SYSUTIL_AVC2_TRANSITION_LINEAR = 0x00000000, + CELL_SYSUTIL_AVC2_TRANSITION_NONE = 0xffffffff, + CELL_SYSUTIL_AVC2_TRANSITION_LINEAR = 0x00000000, CELL_SYSUTIL_AVC2_TRANSITION_SLOWDOWN = 0x00000001, - CELL_SYSUTIL_AVC2_TRANSITION_FASTUP = 0x00000002, - CELL_SYSUTIL_AVC2_TRANSITION_ANGULAR = 0x00000003, + CELL_SYSUTIL_AVC2_TRANSITION_FASTUP = 0x00000002, + CELL_SYSUTIL_AVC2_TRANSITION_ANGULAR = 0x00000003, CELL_SYSUTIL_AVC2_TRANSITION_EXPONENT = 0x00000004, }; enum CellSysutilAvc2WindowZorderMode : u32 { CELL_SYSUTIL_AVC2_ZORDER_FORWARD_MOST = 0x00000001, - CELL_SYSUTIL_AVC2_ZORDER_BEHIND_MOST = 0x00000002, + CELL_SYSUTIL_AVC2_ZORDER_BEHIND_MOST = 0x00000002, }; enum { - CELL_AVC2_CAMERA_STATUS_DETACHED = 0, + CELL_AVC2_CAMERA_STATUS_DETACHED = 0, CELL_AVC2_CAMERA_STATUS_ATTACHED_OFF = 1, - CELL_AVC2_CAMERA_STATUS_ATTACHED_ON = 2, - CELL_AVC2_CAMERA_STATUS_UNKNOWN = 3, + CELL_AVC2_CAMERA_STATUS_ATTACHED_ON = 2, + CELL_AVC2_CAMERA_STATUS_UNKNOWN = 3, }; enum { - CELL_AVC2_MIC_STATUS_DETACHED = 0, + CELL_AVC2_MIC_STATUS_DETACHED = 0, CELL_AVC2_MIC_STATUS_ATTACHED_OFF = 1, - CELL_AVC2_MIC_STATUS_ATTACHED_ON = 2, - CELL_AVC2_MIC_STATUS_UNKNOWN = 3, + CELL_AVC2_MIC_STATUS_ATTACHED_ON = 2, + CELL_AVC2_MIC_STATUS_UNKNOWN = 3, }; enum { - CELL_SYSUTIL_AVC2_STREAMING_MODE_NORMAL = 0, + CELL_SYSUTIL_AVC2_STREAMING_MODE_NORMAL = 0, CELL_SYSUTIL_AVC2_STREAMING_MODE_DIRECT_WAN = 1, CELL_SYSUTIL_AVC2_STREAMING_MODE_DIRECT_LAN = 2, }; @@ -133,45 +133,45 @@ enum enum { CELL_SYSUTIL_AVC2_VIDEO_SHARING_MODE_DISABLE = 0, - CELL_SYSUTIL_AVC2_VIDEO_SHARING_MODE_1 = 1, - CELL_SYSUTIL_AVC2_VIDEO_SHARING_MODE_2 = 2, - CELL_SYSUTIL_AVC2_VIDEO_SHARING_MODE_3 = 3, + CELL_SYSUTIL_AVC2_VIDEO_SHARING_MODE_1 = 1, + CELL_SYSUTIL_AVC2_VIDEO_SHARING_MODE_2 = 2, + CELL_SYSUTIL_AVC2_VIDEO_SHARING_MODE_3 = 3, }; enum { - CELL_AVC2_EVENT_LOAD_SUCCEEDED = 0x00000001, - CELL_AVC2_EVENT_LOAD_FAILED = 0x00000002, + CELL_AVC2_EVENT_LOAD_SUCCEEDED = 0x00000001, + CELL_AVC2_EVENT_LOAD_FAILED = 0x00000002, CELL_AVC2_EVENT_UNLOAD_SUCCEEDED = 0x00000003, - CELL_AVC2_EVENT_UNLOAD_FAILED = 0x00000004, - CELL_AVC2_EVENT_JOIN_SUCCEEDED = 0x00000005, - CELL_AVC2_EVENT_JOIN_FAILED = 0x00000006, - CELL_AVC2_EVENT_LEAVE_SUCCEEDED = 0x00000007, - CELL_AVC2_EVENT_LEAVE_FAILED = 0x00000008, + CELL_AVC2_EVENT_UNLOAD_FAILED = 0x00000004, + CELL_AVC2_EVENT_JOIN_SUCCEEDED = 0x00000005, + CELL_AVC2_EVENT_JOIN_FAILED = 0x00000006, + CELL_AVC2_EVENT_LEAVE_SUCCEEDED = 0x00000007, + CELL_AVC2_EVENT_LEAVE_FAILED = 0x00000008, }; enum { - CELL_AVC2_EVENT_SYSTEM_NEW_MEMBER_JOINED = 0x10000001, - CELL_AVC2_EVENT_SYSTEM_MEMBER_LEFT = 0x10000002, - CELL_AVC2_EVENT_SYSTEM_SESSION_ESTABLISHED = 0x10000003, + CELL_AVC2_EVENT_SYSTEM_NEW_MEMBER_JOINED = 0x10000001, + CELL_AVC2_EVENT_SYSTEM_MEMBER_LEFT = 0x10000002, + CELL_AVC2_EVENT_SYSTEM_SESSION_ESTABLISHED = 0x10000003, CELL_AVC2_EVENT_SYSTEM_SESSION_CANNOT_ESTABLISHED = 0x10000004, - CELL_AVC2_EVENT_SYSTEM_SESSION_DISCONNECTED = 0x10000005, - CELL_AVC2_EVENT_SYSTEM_VOICE_DETECTED = 0x10000006, - CELL_AVC2_EVENT_SYSTEM_MIC_DETECTED = 0x10000007, - CELL_AVC2_EVENT_SYSTEM_CAMERA_DETECTED = 0x10000008, + CELL_AVC2_EVENT_SYSTEM_SESSION_DISCONNECTED = 0x10000005, + CELL_AVC2_EVENT_SYSTEM_VOICE_DETECTED = 0x10000006, + CELL_AVC2_EVENT_SYSTEM_MIC_DETECTED = 0x10000007, + CELL_AVC2_EVENT_SYSTEM_CAMERA_DETECTED = 0x10000008, }; enum { - CELL_AVC2_EVENT_PARAM_ERROR_UNKNOWN = 0x0000000000000001, - CELL_AVC2_EVENT_PARAM_ERROR_NOT_SUPPORTED = 0x0000000000000002, - CELL_AVC2_EVENT_PARAM_ERROR_INVALID_ARGUMENT = 0x0000000000000003, - CELL_AVC2_EVENT_PARAM_ERROR_OUT_OF_MEMORY = 0x0000000000000004, - CELL_AVC2_EVENT_PARAM_ERROR_INVALID_STATUS = 0x0000000000000005, + CELL_AVC2_EVENT_PARAM_ERROR_UNKNOWN = 0x0000000000000001, + CELL_AVC2_EVENT_PARAM_ERROR_NOT_SUPPORTED = 0x0000000000000002, + CELL_AVC2_EVENT_PARAM_ERROR_INVALID_ARGUMENT = 0x0000000000000003, + CELL_AVC2_EVENT_PARAM_ERROR_OUT_OF_MEMORY = 0x0000000000000004, + CELL_AVC2_EVENT_PARAM_ERROR_INVALID_STATUS = 0x0000000000000005, CELL_AVC2_EVENT_PARAM_ERROR_CONTEXT_DOES_NOT_EXIST = 0x0000000000000006, - CELL_AVC2_EVENT_PARAM_ERROR_ROOM_DOES_NOT_EXIST = 0x0000000000000007, - CELL_AVC2_EVENT_PARAM_ERROR_NETWORK_ERROR = 0x0000000000000008, + CELL_AVC2_EVENT_PARAM_ERROR_ROOM_DOES_NOT_EXIST = 0x0000000000000007, + CELL_AVC2_EVENT_PARAM_ERROR_NETWORK_ERROR = 0x0000000000000008, }; enum diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvcExt.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvcExt.cpp index 0e88c9647..cbafb3068 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvcExt.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilAvcExt.cpp @@ -133,14 +133,14 @@ error_code cellSysutilAvcExtLoadAsyncEx(vm::ptr func, vm if (option->sharingVideoBuffer && media == CELL_SYSUTIL_AVC_VOICE_CHAT) return CELL_AVC_ERROR_INVALID_ARGUMENT; - //cellSysutilAvcSetAttribute(0x10000100, &option->sharingVideoBuffer); + // cellSysutilAvcSetAttribute(0x10000100, &option->sharingVideoBuffer); break; case 180: if (option->sharingVideoBuffer && media == CELL_SYSUTIL_AVC_VOICE_CHAT) return CELL_AVC_ERROR_INVALID_ARGUMENT; - //cellSysutilAvcSetAttribute(0x10000100, &option->sharingVideoBuffer); - //cellSysutilAvcSetAttribute(0x10000102, &option->maxPlayers); + // cellSysutilAvcSetAttribute(0x10000100, &option->sharingVideoBuffer); + // cellSysutilAvcSetAttribute(0x10000102, &option->maxPlayers); break; default: return CELL_AVC_ERROR_UNKNOWN; @@ -275,7 +275,7 @@ error_code cellSysutilAvcExtInitOptionParam(s32 avcOptionParamVersion, vm::ptr player_id, u32 zorder) +error_code cellSysutilAvcExtSetWindowZorder(vm::ptr player_id, u32 zorder) { cellSysutilAvcExt.todo("cellSysutilAvcExtSetWindowZorder(player_id=*0x%x, zorder=0x%x)", player_id, zorder); @@ -286,35 +286,35 @@ error_code cellSysutilAvcExtSetWindowZorder(vm::ptr player_id, u32 zord } DECLARE(ppu_module_manager::cellSysutilAvcExt)("cellSysutilAvcExt", []() -{ - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtIsMicAttached); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtStopCameraDetection); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetWindowRotation); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetWindowPosition); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetHideNamePlate); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetWindowPosition); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetWindowSize); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtStartCameraDetection); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetWindowShowStatus); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetChatMode); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetNamePlateShowStatus); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetWindowAlpha); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetWindowSize); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtShowPanelEx); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtLoadAsyncEx); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetShowNamePlate); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtStopVoiceDetection); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtShowWindow); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtIsCameraAttached); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtHidePanelEx); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtHideWindow); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetChatGroup); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetWindowRotation); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtStartMicDetection); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetWindowAlpha); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtStartVoiceDetection); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetSurfacePointer); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtStopMicDetection); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtInitOptionParam); - REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetWindowZorder); -}); + { + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtIsMicAttached); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtStopCameraDetection); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetWindowRotation); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetWindowPosition); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetHideNamePlate); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetWindowPosition); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetWindowSize); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtStartCameraDetection); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetWindowShowStatus); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetChatMode); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetNamePlateShowStatus); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetWindowAlpha); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetWindowSize); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtShowPanelEx); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtLoadAsyncEx); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetShowNamePlate); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtStopVoiceDetection); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtShowWindow); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtIsCameraAttached); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtHidePanelEx); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtHideWindow); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetChatGroup); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetWindowRotation); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtStartMicDetection); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetWindowAlpha); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtStartVoiceDetection); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtGetSurfacePointer); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtStopMicDetection); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtInitOptionParam); + REG_FUNC(cellSysutilAvcExt, cellSysutilAvcExtSetWindowZorder); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilMisc.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilMisc.cpp index 3caa034aa..abb5b029c 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilMisc.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilMisc.cpp @@ -15,6 +15,6 @@ s32 cellSysutilGetLicenseArea() } DECLARE(ppu_module_manager::cellSysutilMisc)("cellSysutilMisc", []() -{ - REG_FUNC(cellSysutilMisc, cellSysutilGetLicenseArea); -}); + { + REG_FUNC(cellSysutilMisc, cellSysutilGetLicenseArea); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilNpEula.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilNpEula.cpp index 1676ef7cf..39f41821f 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilNpEula.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellSysutilNpEula.cpp @@ -8,12 +8,12 @@ LOG_CHANNEL(cellSysutilNpEula); enum SceNpEulaStatus { - SCE_NP_EULA_UNKNOWN = 0, - SCE_NP_EULA_ACCEPTED = 1, + SCE_NP_EULA_UNKNOWN = 0, + SCE_NP_EULA_ACCEPTED = 1, SCE_NP_EULA_ALREADY_ACCEPTED = 2, - SCE_NP_EULA_REJECTED = 3, - SCE_NP_EULA_ABORTED = 4, - SCE_NP_EULA_ERROR = 5, + SCE_NP_EULA_REJECTED = 3, + SCE_NP_EULA_ABORTED = 4, + SCE_NP_EULA_ERROR = 5, }; using SceNpEulaVersion = u32; @@ -46,12 +46,12 @@ error_code sceNpEulaCheckEulaStatus(vm::cptr communication cb_infos.status = SCE_NP_EULA_ALREADY_ACCEPTED; sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 - { - auto& cb_infos = g_fxo->get(); - cbFunc(cb_ppu, cb_infos.status, CELL_OK, 1, cbFuncArg); - cb_infos.sceNpEulaCheckEulaStatus_callback_registered = false; - return 0; - }); + { + auto& cb_infos = g_fxo->get(); + cbFunc(cb_ppu, cb_infos.status, CELL_OK, 1, cbFuncArg); + cb_infos.sceNpEulaCheckEulaStatus_callback_registered = false; + return 0; + }); return CELL_OK; } @@ -96,8 +96,8 @@ error_code sceNpEulaShowCurrentEula(vm::cptr communication } DECLARE(ppu_module_manager::cellSysutilNpEula)("cellSysutilNpEula", []() -{ - REG_FUNC(cellSysutilNpEula, sceNpEulaCheckEulaStatus); - REG_FUNC(cellSysutilNpEula, sceNpEulaAbort); - REG_FUNC(cellSysutilNpEula, sceNpEulaShowCurrentEula); -}); + { + REG_FUNC(cellSysutilNpEula, sceNpEulaCheckEulaStatus); + REG_FUNC(cellSysutilNpEula, sceNpEulaAbort); + REG_FUNC(cellSysutilNpEula, sceNpEulaShowCurrentEula); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellUsbd.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellUsbd.cpp index 04213a2e2..6f15601f9 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellUsbd.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellUsbd.cpp @@ -4,35 +4,35 @@ LOG_CHANNEL(cellUsbd); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_USBD_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_USBD_ERROR_ALREADY_INITIALIZED); - STR_CASE(CELL_USBD_ERROR_NO_MEMORY); - STR_CASE(CELL_USBD_ERROR_INVALID_PARAM); - STR_CASE(CELL_USBD_ERROR_INVALID_TRANSFER_TYPE); - STR_CASE(CELL_USBD_ERROR_LDD_ALREADY_REGISTERED); - STR_CASE(CELL_USBD_ERROR_LDD_NOT_ALLOCATED); - STR_CASE(CELL_USBD_ERROR_LDD_NOT_RELEASED); - STR_CASE(CELL_USBD_ERROR_LDD_NOT_FOUND); - STR_CASE(CELL_USBD_ERROR_DEVICE_NOT_FOUND); - STR_CASE(CELL_USBD_ERROR_PIPE_NOT_ALLOCATED); - STR_CASE(CELL_USBD_ERROR_PIPE_NOT_RELEASED); - STR_CASE(CELL_USBD_ERROR_PIPE_NOT_FOUND); - STR_CASE(CELL_USBD_ERROR_IOREQ_NOT_ALLOCATED); - STR_CASE(CELL_USBD_ERROR_IOREQ_NOT_RELEASED); - STR_CASE(CELL_USBD_ERROR_IOREQ_NOT_FOUND); - STR_CASE(CELL_USBD_ERROR_CANNOT_GET_DESCRIPTOR); - STR_CASE(CELL_USBD_ERROR_FATAL); - } + switch (error) + { + STR_CASE(CELL_USBD_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_USBD_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_USBD_ERROR_NO_MEMORY); + STR_CASE(CELL_USBD_ERROR_INVALID_PARAM); + STR_CASE(CELL_USBD_ERROR_INVALID_TRANSFER_TYPE); + STR_CASE(CELL_USBD_ERROR_LDD_ALREADY_REGISTERED); + STR_CASE(CELL_USBD_ERROR_LDD_NOT_ALLOCATED); + STR_CASE(CELL_USBD_ERROR_LDD_NOT_RELEASED); + STR_CASE(CELL_USBD_ERROR_LDD_NOT_FOUND); + STR_CASE(CELL_USBD_ERROR_DEVICE_NOT_FOUND); + STR_CASE(CELL_USBD_ERROR_PIPE_NOT_ALLOCATED); + STR_CASE(CELL_USBD_ERROR_PIPE_NOT_RELEASED); + STR_CASE(CELL_USBD_ERROR_PIPE_NOT_FOUND); + STR_CASE(CELL_USBD_ERROR_IOREQ_NOT_ALLOCATED); + STR_CASE(CELL_USBD_ERROR_IOREQ_NOT_RELEASED); + STR_CASE(CELL_USBD_ERROR_IOREQ_NOT_FOUND); + STR_CASE(CELL_USBD_ERROR_CANNOT_GET_DESCRIPTOR); + STR_CASE(CELL_USBD_ERROR_FATAL); + } - return unknown; - }); + return unknown; + }); } error_code cellUsbdInit() @@ -211,44 +211,43 @@ error_code cellUsbdResetDevice() return CELL_OK; } - DECLARE(ppu_module_manager::cellUsbd)("cellUsbd", []() -{ - REG_FUNC(cellUsbd, cellUsbdInit); - REG_FUNC(cellUsbd, cellUsbdEnd); + { + REG_FUNC(cellUsbd, cellUsbdInit); + REG_FUNC(cellUsbd, cellUsbdEnd); - REG_FUNC(cellUsbd, cellUsbdSetThreadPriority); - REG_FUNC(cellUsbd, cellUsbdSetThreadPriority2); - REG_FUNC(cellUsbd, cellUsbdGetThreadPriority); + REG_FUNC(cellUsbd, cellUsbdSetThreadPriority); + REG_FUNC(cellUsbd, cellUsbdSetThreadPriority2); + REG_FUNC(cellUsbd, cellUsbdGetThreadPriority); - REG_FUNC(cellUsbd, cellUsbdRegisterLdd); - REG_FUNC(cellUsbd, cellUsbdRegisterCompositeLdd); - REG_FUNC(cellUsbd, cellUsbdRegisterExtraLdd); - REG_FUNC(cellUsbd, cellUsbdRegisterExtraLdd2); - REG_FUNC(cellUsbd, cellUsbdUnregisterLdd); - REG_FUNC(cellUsbd, cellUsbdUnregisterCompositeLdd); - REG_FUNC(cellUsbd, cellUsbdUnregisterExtraLdd); + REG_FUNC(cellUsbd, cellUsbdRegisterLdd); + REG_FUNC(cellUsbd, cellUsbdRegisterCompositeLdd); + REG_FUNC(cellUsbd, cellUsbdRegisterExtraLdd); + REG_FUNC(cellUsbd, cellUsbdRegisterExtraLdd2); + REG_FUNC(cellUsbd, cellUsbdUnregisterLdd); + REG_FUNC(cellUsbd, cellUsbdUnregisterCompositeLdd); + REG_FUNC(cellUsbd, cellUsbdUnregisterExtraLdd); - REG_FUNC(cellUsbd, cellUsbdOpenPipe); - REG_FUNC(cellUsbd, cellUsbdClosePipe); + REG_FUNC(cellUsbd, cellUsbdOpenPipe); + REG_FUNC(cellUsbd, cellUsbdClosePipe); - REG_FUNC(cellUsbd, cellUsbdControlTransfer); - REG_FUNC(cellUsbd, cellUsbdBulkTransfer); - REG_FUNC(cellUsbd, cellUsbdInterruptTransfer); - REG_FUNC(cellUsbd, cellUsbdIsochronousTransfer); - REG_FUNC(cellUsbd, cellUsbdHSIsochronousTransfer); + REG_FUNC(cellUsbd, cellUsbdControlTransfer); + REG_FUNC(cellUsbd, cellUsbdBulkTransfer); + REG_FUNC(cellUsbd, cellUsbdInterruptTransfer); + REG_FUNC(cellUsbd, cellUsbdIsochronousTransfer); + REG_FUNC(cellUsbd, cellUsbdHSIsochronousTransfer); - REG_FUNC(cellUsbd, cellUsbdScanStaticDescriptor); - REG_FUNC(cellUsbd, cellUsbdGetDeviceSpeed); - REG_FUNC(cellUsbd, cellUsbdGetDeviceLocation); + REG_FUNC(cellUsbd, cellUsbdScanStaticDescriptor); + REG_FUNC(cellUsbd, cellUsbdGetDeviceSpeed); + REG_FUNC(cellUsbd, cellUsbdGetDeviceLocation); - REG_FUNC(cellUsbd, cellUsbdSetPrivateData); - REG_FUNC(cellUsbd, cellUsbdGetPrivateData); + REG_FUNC(cellUsbd, cellUsbdSetPrivateData); + REG_FUNC(cellUsbd, cellUsbdGetPrivateData); - REG_FUNC(cellUsbd, cellUsbdAllocateMemory); - REG_FUNC(cellUsbd, cellUsbdAllocateMemoryFromContainer); - REG_FUNC(cellUsbd, cellUsbdAllocateSharedMemory); - REG_FUNC(cellUsbd, cellUsbdFreeMemory); + REG_FUNC(cellUsbd, cellUsbdAllocateMemory); + REG_FUNC(cellUsbd, cellUsbdAllocateMemoryFromContainer); + REG_FUNC(cellUsbd, cellUsbdAllocateSharedMemory); + REG_FUNC(cellUsbd, cellUsbdFreeMemory); - REG_FUNC(cellUsbd, cellUsbdResetDevice); -}); + REG_FUNC(cellUsbd, cellUsbdResetDevice); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellUsbd.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellUsbd.h index 017aca2ef..6a6645800 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellUsbd.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellUsbd.h @@ -1,43 +1,41 @@ #pragma once - - // Return Codes enum CellUsbdError : u32 { - CELL_USBD_ERROR_NOT_INITIALIZED = 0x80110001, - CELL_USBD_ERROR_ALREADY_INITIALIZED = 0x80110002, - CELL_USBD_ERROR_NO_MEMORY = 0x80110003, - CELL_USBD_ERROR_INVALID_PARAM = 0x80110004, - CELL_USBD_ERROR_INVALID_TRANSFER_TYPE = 0x80110005, + CELL_USBD_ERROR_NOT_INITIALIZED = 0x80110001, + CELL_USBD_ERROR_ALREADY_INITIALIZED = 0x80110002, + CELL_USBD_ERROR_NO_MEMORY = 0x80110003, + CELL_USBD_ERROR_INVALID_PARAM = 0x80110004, + CELL_USBD_ERROR_INVALID_TRANSFER_TYPE = 0x80110005, CELL_USBD_ERROR_LDD_ALREADY_REGISTERED = 0x80110006, - CELL_USBD_ERROR_LDD_NOT_ALLOCATED = 0x80110007, - CELL_USBD_ERROR_LDD_NOT_RELEASED = 0x80110008, - CELL_USBD_ERROR_LDD_NOT_FOUND = 0x80110009, - CELL_USBD_ERROR_DEVICE_NOT_FOUND = 0x8011000a, - CELL_USBD_ERROR_PIPE_NOT_ALLOCATED = 0x8011000b, - CELL_USBD_ERROR_PIPE_NOT_RELEASED = 0x8011000c, - CELL_USBD_ERROR_PIPE_NOT_FOUND = 0x8011000d, - CELL_USBD_ERROR_IOREQ_NOT_ALLOCATED = 0x8011000e, - CELL_USBD_ERROR_IOREQ_NOT_RELEASED = 0x8011000f, - CELL_USBD_ERROR_IOREQ_NOT_FOUND = 0x80110010, - CELL_USBD_ERROR_CANNOT_GET_DESCRIPTOR = 0x80110011, - CELL_USBD_ERROR_FATAL = 0x801100ff, + CELL_USBD_ERROR_LDD_NOT_ALLOCATED = 0x80110007, + CELL_USBD_ERROR_LDD_NOT_RELEASED = 0x80110008, + CELL_USBD_ERROR_LDD_NOT_FOUND = 0x80110009, + CELL_USBD_ERROR_DEVICE_NOT_FOUND = 0x8011000a, + CELL_USBD_ERROR_PIPE_NOT_ALLOCATED = 0x8011000b, + CELL_USBD_ERROR_PIPE_NOT_RELEASED = 0x8011000c, + CELL_USBD_ERROR_PIPE_NOT_FOUND = 0x8011000d, + CELL_USBD_ERROR_IOREQ_NOT_ALLOCATED = 0x8011000e, + CELL_USBD_ERROR_IOREQ_NOT_RELEASED = 0x8011000f, + CELL_USBD_ERROR_IOREQ_NOT_FOUND = 0x80110010, + CELL_USBD_ERROR_CANNOT_GET_DESCRIPTOR = 0x80110011, + CELL_USBD_ERROR_FATAL = 0x801100ff, }; // TCC (Transfer Completion Codes) enum { - HC_CC_NOERR = 0x0, - EHCI_CC_MISSMF = 0x10, - EHCI_CC_XACT = 0x20, - EHCI_CC_BABBLE = 0x30, + HC_CC_NOERR = 0x0, + EHCI_CC_MISSMF = 0x10, + EHCI_CC_XACT = 0x20, + EHCI_CC_BABBLE = 0x30, EHCI_CC_DATABUF = 0x40, - EHCI_CC_HALTED = 0x50, + EHCI_CC_HALTED = 0x50, - USBD_HC_CC_NOERR = 0x0, - USBD_HC_CC_MISSMF = 0x1, - USBD_HC_CC_XACT = 0x2, - USBD_HC_CC_BABBLE = 0x4, + USBD_HC_CC_NOERR = 0x0, + USBD_HC_CC_MISSMF = 0x1, + USBD_HC_CC_XACT = 0x2, + USBD_HC_CC_BABBLE = 0x4, USBD_HC_CC_DATABUF = 0x8, }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellUsbpspcm.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellUsbpspcm.cpp index 851af771b..fb19e77e9 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellUsbpspcm.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellUsbpspcm.cpp @@ -7,42 +7,42 @@ LOG_CHANNEL(cellUsbPspcm); enum CellUsbpspcmError : u32 { CELL_USBPSPCM_ERROR_NOT_INITIALIZED = 0x80110401, - CELL_USBPSPCM_ERROR_ALREADY = 0x80110402, - CELL_USBPSPCM_ERROR_INVALID = 0x80110403, - CELL_USBPSPCM_ERROR_NO_MEMORY = 0x80110404, - CELL_USBPSPCM_ERROR_BUSY = 0x80110405, - CELL_USBPSPCM_ERROR_INPROGRESS = 0x80110406, - CELL_USBPSPCM_ERROR_NO_SPACE = 0x80110407, - CELL_USBPSPCM_ERROR_CANCELED = 0x80110408, - CELL_USBPSPCM_ERROR_RESETTING = 0x80110409, - CELL_USBPSPCM_ERROR_RESET_END = 0x8011040A, - CELL_USBPSPCM_ERROR_CLOSED = 0x8011040B, - CELL_USBPSPCM_ERROR_NO_DATA = 0x8011040C, + CELL_USBPSPCM_ERROR_ALREADY = 0x80110402, + CELL_USBPSPCM_ERROR_INVALID = 0x80110403, + CELL_USBPSPCM_ERROR_NO_MEMORY = 0x80110404, + CELL_USBPSPCM_ERROR_BUSY = 0x80110405, + CELL_USBPSPCM_ERROR_INPROGRESS = 0x80110406, + CELL_USBPSPCM_ERROR_NO_SPACE = 0x80110407, + CELL_USBPSPCM_ERROR_CANCELED = 0x80110408, + CELL_USBPSPCM_ERROR_RESETTING = 0x80110409, + CELL_USBPSPCM_ERROR_RESET_END = 0x8011040A, + CELL_USBPSPCM_ERROR_CLOSED = 0x8011040B, + CELL_USBPSPCM_ERROR_NO_DATA = 0x8011040C, }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_USBPSPCM_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_USBPSPCM_ERROR_ALREADY); - STR_CASE(CELL_USBPSPCM_ERROR_INVALID); - STR_CASE(CELL_USBPSPCM_ERROR_NO_MEMORY); - STR_CASE(CELL_USBPSPCM_ERROR_BUSY); - STR_CASE(CELL_USBPSPCM_ERROR_INPROGRESS); - STR_CASE(CELL_USBPSPCM_ERROR_NO_SPACE); - STR_CASE(CELL_USBPSPCM_ERROR_CANCELED); - STR_CASE(CELL_USBPSPCM_ERROR_RESETTING); - STR_CASE(CELL_USBPSPCM_ERROR_RESET_END); - STR_CASE(CELL_USBPSPCM_ERROR_CLOSED); - STR_CASE(CELL_USBPSPCM_ERROR_NO_DATA); - } + switch (error) + { + STR_CASE(CELL_USBPSPCM_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_USBPSPCM_ERROR_ALREADY); + STR_CASE(CELL_USBPSPCM_ERROR_INVALID); + STR_CASE(CELL_USBPSPCM_ERROR_NO_MEMORY); + STR_CASE(CELL_USBPSPCM_ERROR_BUSY); + STR_CASE(CELL_USBPSPCM_ERROR_INPROGRESS); + STR_CASE(CELL_USBPSPCM_ERROR_NO_SPACE); + STR_CASE(CELL_USBPSPCM_ERROR_CANCELED); + STR_CASE(CELL_USBPSPCM_ERROR_RESETTING); + STR_CASE(CELL_USBPSPCM_ERROR_RESET_END); + STR_CASE(CELL_USBPSPCM_ERROR_CLOSED); + STR_CASE(CELL_USBPSPCM_ERROR_NO_DATA); + } - return unknown; - }); + return unknown; + }); } error_code cellUsbPspcmInit() @@ -208,32 +208,32 @@ error_code cellUsbPspcmCancelWaitData() } DECLARE(ppu_module_manager::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); -}); + { + 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/rpcs3/Emu/Cell/Modules/cellUserInfo.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellUserInfo.cpp index 1f5e9ad53..0ea97d98e 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellUserInfo.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellUserInfo.cpp @@ -34,36 +34,36 @@ std::string get_username(const u32 user_id) return username; } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_USERINFO_ERROR_BUSY); - STR_CASE(CELL_USERINFO_ERROR_INTERNAL); - STR_CASE(CELL_USERINFO_ERROR_PARAM); - STR_CASE(CELL_USERINFO_ERROR_NOUSER); - } + switch (error) + { + STR_CASE(CELL_USERINFO_ERROR_BUSY); + STR_CASE(CELL_USERINFO_ERROR_INTERNAL); + STR_CASE(CELL_USERINFO_ERROR_PARAM); + STR_CASE(CELL_USERINFO_ERROR_NOUSER); + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_USERINFO_RET_OK); - STR_CASE(CELL_USERINFO_RET_CANCEL); - } + switch (error) + { + STR_CASE(CELL_USERINFO_RET_OK); + STR_CASE(CELL_USERINFO_RET_CANCEL); + } - return unknown; - }); + return unknown; + }); } error_code cellUserInfoGetStat(u32 id, vm::ptr stat) @@ -172,36 +172,36 @@ error_code cellUserInfoSelectUser_ListType(vm::ptr listType const bool enable_overlay = g_fxo->get().enable_overlay; const error_code result = manager->create()->show(title, focused, user_ids, enable_overlay, [funcSelect, userdata](s32 status) - { - s32 callback_result = CELL_USERINFO_RET_CANCEL; - u32 selected_user_id = 0; - std::string selected_username; - - if (status >= 0) { - callback_result = CELL_USERINFO_RET_OK; - selected_user_id = static_cast(status); - selected_username = get_username(selected_user_id); - } + s32 callback_result = CELL_USERINFO_RET_CANCEL; + u32 selected_user_id = 0; + std::string selected_username; - cellUserInfo.warning("cellUserInfoSelectUser_ListType: callback_result=%s, selected_user_id=%d, selected_username='%s'", callback_result, selected_user_id, selected_username); - - g_fxo->get().dialog_opened = false; - - sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0); - - sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - vm::var selectUser; if (status >= 0) { - selectUser->id = selected_user_id; - strcpy_trunc(selectUser->name, selected_username); + callback_result = CELL_USERINFO_RET_OK; + selected_user_id = static_cast(status); + selected_username = get_username(selected_user_id); } - funcSelect(ppu, callback_result, selectUser, userdata); - return CELL_OK; + + cellUserInfo.warning("cellUserInfoSelectUser_ListType: callback_result=%s, selected_user_id=%d, selected_username='%s'", callback_result, selected_user_id, selected_username); + + g_fxo->get().dialog_opened = false; + + sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0); + + sysutil_register_cb([=](ppu_thread& ppu) -> s32 + { + vm::var selectUser; + if (status >= 0) + { + selectUser->id = selected_user_id; + strcpy_trunc(selectUser->name, selected_username); + } + funcSelect(ppu, callback_result, selectUser, userdata); + return CELL_OK; + }); }); - }); return result; } @@ -209,13 +209,13 @@ error_code cellUserInfoSelectUser_ListType(vm::ptr listType cellUserInfo.error("User selection is only possible when the native user interface is enabled in the settings. The currently active user will be selected as a fallback."); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - vm::var selectUser; - selectUser->id = Emu.GetUsrId(); - strcpy_trunc(selectUser->name, get_username(Emu.GetUsrId())); - funcSelect(ppu, CELL_USERINFO_RET_OK, selectUser, userdata); - return CELL_OK; - }); + { + vm::var selectUser; + selectUser->id = Emu.GetUsrId(); + strcpy_trunc(selectUser->name, get_username(Emu.GetUsrId())); + funcSelect(ppu, CELL_USERINFO_RET_OK, selectUser, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -250,11 +250,11 @@ error_code cellUserInfoSelectUser_SetList(vm::ptr setList, cellUserInfo.error("cellUserInfoSelectUser_SetList: callback_result=%s", CELL_USERINFO_ERROR_NOUSER); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - vm::var selectUser; - funcSelect(ppu, CELL_USERINFO_ERROR_NOUSER, selectUser, userdata); - return CELL_OK; - }); + { + vm::var selectUser; + funcSelect(ppu, CELL_USERINFO_ERROR_NOUSER, selectUser, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -281,36 +281,36 @@ error_code cellUserInfoSelectUser_SetList(vm::ptr setList, const bool enable_overlay = g_fxo->get().enable_overlay; const error_code result = manager->create()->show(title, focused, user_ids, enable_overlay, [funcSelect, userdata](s32 status) - { - s32 callback_result = CELL_USERINFO_RET_CANCEL; - u32 selected_user_id = 0; - std::string selected_username; - - if (status >= 0) { - callback_result = CELL_USERINFO_RET_OK; - selected_user_id = static_cast(status); - selected_username = get_username(selected_user_id); - } + s32 callback_result = CELL_USERINFO_RET_CANCEL; + u32 selected_user_id = 0; + std::string selected_username; - cellUserInfo.warning("cellUserInfoSelectUser_SetList: callback_result=%s, selected_user_id=%d, selected_username='%s'", callback_result, selected_user_id, selected_username); - - g_fxo->get().dialog_opened = false; - - sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0); - - sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - vm::var selectUser; if (status >= 0) { - selectUser->id = selected_user_id; - strcpy_trunc(selectUser->name, selected_username); + callback_result = CELL_USERINFO_RET_OK; + selected_user_id = static_cast(status); + selected_username = get_username(selected_user_id); } - funcSelect(ppu, callback_result, selectUser, userdata); - return CELL_OK; + + cellUserInfo.warning("cellUserInfoSelectUser_SetList: callback_result=%s, selected_user_id=%d, selected_username='%s'", callback_result, selected_user_id, selected_username); + + g_fxo->get().dialog_opened = false; + + sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0); + + sysutil_register_cb([=](ppu_thread& ppu) -> s32 + { + vm::var selectUser; + if (status >= 0) + { + selectUser->id = selected_user_id; + strcpy_trunc(selectUser->name, selected_username); + } + funcSelect(ppu, callback_result, selectUser, userdata); + return CELL_OK; + }); }); - }); return result; } @@ -318,13 +318,13 @@ error_code cellUserInfoSelectUser_SetList(vm::ptr setList, cellUserInfo.error("User selection is only possible when the native user interface is enabled in the settings. The currently active user will be selected as a fallback."); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - vm::var selectUser; - selectUser->id = Emu.GetUsrId(); - strcpy_trunc(selectUser->name, get_username(Emu.GetUsrId())); - funcSelect(ppu, CELL_USERINFO_RET_OK, selectUser, userdata); - return CELL_OK; - }); + { + vm::var selectUser; + selectUser->id = Emu.GetUsrId(); + strcpy_trunc(selectUser->name, get_username(Emu.GetUsrId())); + funcSelect(ppu, CELL_USERINFO_RET_OK, selectUser, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -413,10 +413,10 @@ error_code cellUserInfoGetList(vm::ptr listNum, vm::ptr title; be_t focus; // id - be_t type; // CellUserInfoListType + be_t type; // CellUserInfoListType vm::bptr reserved; }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellVdec.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellVdec.cpp index 4574d99d5..7a5f6f086 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellVdec.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellVdec.cpp @@ -43,24 +43,24 @@ std::mutex g_mutex_avcodec_open2; LOG_CHANNEL(cellVdec); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_VDEC_ERROR_ARG); - STR_CASE(CELL_VDEC_ERROR_SEQ); - STR_CASE(CELL_VDEC_ERROR_BUSY); - STR_CASE(CELL_VDEC_ERROR_EMPTY); - STR_CASE(CELL_VDEC_ERROR_AU); - STR_CASE(CELL_VDEC_ERROR_PIC); - STR_CASE(CELL_VDEC_ERROR_FATAL); - } + switch (error) + { + STR_CASE(CELL_VDEC_ERROR_ARG); + STR_CASE(CELL_VDEC_ERROR_SEQ); + STR_CASE(CELL_VDEC_ERROR_BUSY); + STR_CASE(CELL_VDEC_ERROR_EMPTY); + STR_CASE(CELL_VDEC_ERROR_AU); + STR_CASE(CELL_VDEC_ERROR_PIC); + STR_CASE(CELL_VDEC_ERROR_FATAL); + } - return unknown; - }); + return unknown; + }); } // The general sequence control flow has these possible transitions: @@ -74,31 +74,31 @@ void fmt_class_string::format(std::string& out, u64 arg) // resetting -> ready enum class sequence_state : u32 { - closed = 0, // Also called non-existent. Needs to be opened before anything can be done with it. - dormant = 1, // Waiting for the next sequence. The last picture and pic-item can be aqcuired in this state. - ready = 2, // Ready for decoding. Can also restart sequences in this state. - ending = 3, // Ending a sequence. Goes to dormant afterwards. + closed = 0, // Also called non-existent. Needs to be opened before anything can be done with it. + dormant = 1, // Waiting for the next sequence. The last picture and pic-item can be aqcuired in this state. + ready = 2, // Ready for decoding. Can also restart sequences in this state. + ending = 3, // Ending a sequence. Goes to dormant afterwards. resetting = 4, // Stops the current sequence and starts a new one. The pictures of the old sequence are flushed - invalid = 5, // Any other value is invalid + invalid = 5, // Any other value is invalid }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(sequence_state::closed); - STR_CASE(sequence_state::dormant); - STR_CASE(sequence_state::ready); - STR_CASE(sequence_state::ending); - STR_CASE(sequence_state::resetting); - STR_CASE(sequence_state::invalid); - } + switch (error) + { + STR_CASE(sequence_state::closed); + STR_CASE(sequence_state::dormant); + STR_CASE(sequence_state::ready); + STR_CASE(sequence_state::ending); + STR_CASE(sequence_state::resetting); + STR_CASE(sequence_state::invalid); + } - return unknown; - }); + return unknown; + }); } vm::gvar _cell_vdec_prx_ver; // TODO: this should probably specify the VDEC module that was loaded. E.g. CELL_SYSMODULE_VDEC_MPEG2 @@ -163,7 +163,7 @@ struct vdec_frame bool pic_item_received = false; CellVdecPicAttr attr = CELL_VDEC_PICITEM_ATTR_NORMAL; - AVFrame* operator ->() const + AVFrame* operator->() const { return avf.get(); } @@ -213,11 +213,7 @@ struct vdec_context final AVRational log_time_base{}; // Used to reduce log spam vdec_context(s32 type, u32 /*profile*/, u32 addr, u32 size, vm::ptr func, u32 arg) - : type(type) - , mem_addr(addr) - , mem_size(size) - , cb_func(func) - , cb_arg(arg) + : type(type), mem_addr(addr), mem_size(size), cb_func(func), cb_arg(arg) { switch (type) { @@ -299,20 +295,20 @@ struct vdec_context final ppu_tid.release(ppu.id); for (auto slice = in_cmd.pop_all(); thread_ctrl::state() != thread_state::aborting; [&] - { - if (slice) { - slice.pop_front(); - } + if (slice) + { + slice.pop_front(); + } - if (slice || thread_ctrl::state() == thread_state::aborting) - { - return; - } + if (slice || thread_ctrl::state() == thread_state::aborting) + { + return; + } - thread_ctrl::wait_on(in_cmd); - slice = in_cmd.pop_all(); // Pop new command list - }()) + thread_ctrl::wait_on(in_cmd); + slice = in_cmd.pop_all(); // Pop new command list + }()) { // pcmd can be nullptr auto* cmd = slice.get(); @@ -397,7 +393,8 @@ struct vdec_context final ctx->skip_frame = au_mode == CELL_VDEC_DEC_MODE_NORMAL ? AVDISCARD_DEFAULT : - au_mode == CELL_VDEC_DEC_MODE_B_SKIP ? AVDISCARD_NONREF : AVDISCARD_NONINTRA; + au_mode == CELL_VDEC_DEC_MODE_B_SKIP ? AVDISCARD_NONREF : + AVDISCARD_NONINTRA; std::deque decoded_frames; @@ -650,9 +647,9 @@ extern bool check_if_vdec_contexts_exist() bool context_exists = false; idm::select([&](u32, vdec_context&) - { - context_exists = true; - }); + { + context_exists = true; + }); return context_exists; } @@ -680,18 +677,18 @@ static error_code vdecQueryAttr(s32 type, u32 profile, u32 spec_addr /* may be 0 { cellVdec.warning("cellVdecQueryAttr: AVC (profile=%d)", profile); - //const vm::ptr sinfo = vm::cast(spec_addr); + // const vm::ptr sinfo = vm::cast(spec_addr); // TODO: sinfo switch (profile) { - case CELL_VDEC_AVC_LEVEL_1P0: memSize = new_sdk ? 0x70167D : 0xA014FD ; break; - case CELL_VDEC_AVC_LEVEL_1P1: memSize = new_sdk ? 0x86CB7D : 0xB6C9FD ; break; - case CELL_VDEC_AVC_LEVEL_1P2: memSize = new_sdk ? 0x9E307D : 0xCE2D7D ; break; - case CELL_VDEC_AVC_LEVEL_1P3: memSize = new_sdk ? 0xA057FD : 0xD054FD ; break; - case CELL_VDEC_AVC_LEVEL_2P0: memSize = new_sdk ? 0xA057FD : 0xD054FD ; break; - case CELL_VDEC_AVC_LEVEL_2P1: memSize = new_sdk ? 0xE90DFD : 0x1190AFD; break; + case CELL_VDEC_AVC_LEVEL_1P0: memSize = new_sdk ? 0x70167D : 0xA014FD; break; + case CELL_VDEC_AVC_LEVEL_1P1: memSize = new_sdk ? 0x86CB7D : 0xB6C9FD; break; + case CELL_VDEC_AVC_LEVEL_1P2: memSize = new_sdk ? 0x9E307D : 0xCE2D7D; break; + case CELL_VDEC_AVC_LEVEL_1P3: memSize = new_sdk ? 0xA057FD : 0xD054FD; break; + case CELL_VDEC_AVC_LEVEL_2P0: memSize = new_sdk ? 0xA057FD : 0xD054FD; break; + case CELL_VDEC_AVC_LEVEL_2P1: memSize = new_sdk ? 0xE90DFD : 0x1190AFD; break; case CELL_VDEC_AVC_LEVEL_2P2: memSize = new_sdk ? 0x14E49FD : 0x17E46FD; break; case CELL_VDEC_AVC_LEVEL_3P0: memSize = new_sdk ? 0x155B5FD : 0x185B17D; break; case CELL_VDEC_AVC_LEVEL_3P1: memSize = new_sdk ? 0x1CD327D : 0x1FD2AFD; break; @@ -788,9 +785,9 @@ static error_code vdecQueryAttr(s32 type, u32 profile, u32 spec_addr /* may be 0 // TODO: sinfo - //const u32 maxDecH = sinfo ? +sinfo->maxDecodedFrameHeight : 0; - //const u32 maxDecW = sinfo ? +sinfo->maxDecodedFrameWidth : 0; - u32 nrOfBuf = sinfo ? +sinfo->numberOfDecodedFrameBuffer : 0; + // const u32 maxDecH = sinfo ? +sinfo->maxDecodedFrameHeight : 0; + // const u32 maxDecW = sinfo ? +sinfo->maxDecodedFrameWidth : 0; + u32 nrOfBuf = sinfo ? +sinfo->numberOfDecodedFrameBuffer : 0; if (nrOfBuf == 0) { @@ -812,11 +809,11 @@ static error_code vdecQueryAttr(s32 type, u32 profile, u32 spec_addr /* may be 0 switch (profile) { - case CELL_VDEC_DIVX_QMOBILE : memSize = new_sdk ? 0x11B720 : 0x1DEF30; break; - case CELL_VDEC_DIVX_MOBILE : memSize = new_sdk ? 0x19A740 : 0x26DED0; break; + case CELL_VDEC_DIVX_QMOBILE: memSize = new_sdk ? 0x11B720 : 0x1DEF30; break; + case CELL_VDEC_DIVX_MOBILE: memSize = new_sdk ? 0x19A740 : 0x26DED0; break; case CELL_VDEC_DIVX_HOME_THEATER: memSize = new_sdk ? 0x386A60 : 0x498060; break; - case CELL_VDEC_DIVX_HD_720 : memSize = new_sdk ? 0x692070 : 0x805690; break; - case CELL_VDEC_DIVX_HD_1080 : memSize = new_sdk ? 0xD78100 : 0xFC9870; break; + case CELL_VDEC_DIVX_HD_720: memSize = new_sdk ? 0x692070 : 0x805690; break; + case CELL_VDEC_DIVX_HD_1080: memSize = new_sdk ? 0xD78100 : 0xFC9870; break; default: return CELL_VDEC_ERROR_ARG; } @@ -865,8 +862,7 @@ static error_code vdecOpen(ppu_thread& ppu, T type, U res, vm::cptr return CELL_VDEC_ERROR_ARG; } - if (!res->memAddr || res->ppuThreadPriority + 0u >= 3072 || res->spuThreadPriority + 0u >= 256 || res->ppuThreadStackSize < 4096 - || type->codecType + 0u >= 0xe) + if (!res->memAddr || res->ppuThreadPriority + 0u >= 3072 || res->spuThreadPriority + 0u >= 256 || res->ppuThreadStackSize < 4096 || type->codecType + 0u >= 0xe) { return CELL_VDEC_ERROR_ARG; } @@ -911,10 +907,10 @@ static error_code vdecOpen(ppu_thread& ppu, T type, U res, vm::cptr const auto thrd = idm::get_unlocked>(static_cast(*_tid)); - thrd->cmd_list - ({ - { ppu_cmd::set_args, 1 }, u64{vid}, - { ppu_cmd::hle_call, FIND_FUNC(vdecEntry) }, + thrd->cmd_list({ + {ppu_cmd::set_args, 1}, + u64{vid}, + {ppu_cmd::hle_call, FIND_FUNC(vdecEntry)}, }); thrd->state -= cpu_flag::stop; @@ -961,7 +957,7 @@ error_code cellVdecClose(ppu_thread& ppu, u32 handle) if (vdec->seq_state == sequence_state::closed) { - return { CELL_VDEC_ERROR_SEQ, vdec->seq_state.load() }; + return {CELL_VDEC_ERROR_SEQ, vdec->seq_state.load()}; } } @@ -1018,7 +1014,7 @@ error_code cellVdecStartSeq(ppu_thread& ppu, u32 handle) if (old_state != sequence_state::dormant && old_state != sequence_state::ready) { - return { CELL_VDEC_ERROR_SEQ, old_state }; + return {CELL_VDEC_ERROR_SEQ, old_state}; } if (old_state == sequence_state::ready) @@ -1067,7 +1063,7 @@ error_code cellVdecEndSeq(ppu_thread& ppu, u32 handle) if (vdec->seq_state != sequence_state::ready) { - return { CELL_VDEC_ERROR_SEQ, vdec->seq_state.load() }; + return {CELL_VDEC_ERROR_SEQ, vdec->seq_state.load()}; } vdec->seq_state = sequence_state::ending; @@ -1092,7 +1088,7 @@ error_code cellVdecDecodeAu(ppu_thread& ppu, u32 handle, CellVdecDecodeMode mode if (!vdec || !auInfo || !auInfo->size || !auInfo->startAddr) { - return { CELL_VDEC_ERROR_ARG, "vdec=%d, auInfo=%d, size=%d, startAddr=0x%x", !!vdec, !!auInfo, auInfo ? auInfo->size.value() : 0, auInfo ? auInfo->startAddr.value() : 0 }; + return {CELL_VDEC_ERROR_ARG, "vdec=%d, auInfo=%d, size=%d, startAddr=0x%x", !!vdec, !!auInfo, auInfo ? auInfo->size.value() : 0, auInfo ? auInfo->startAddr.value() : 0}; } { @@ -1100,20 +1096,20 @@ error_code cellVdecDecodeAu(ppu_thread& ppu, u32 handle, CellVdecDecodeMode mode if (vdec->seq_state != sequence_state::ready) { - return { CELL_VDEC_ERROR_SEQ, vdec->seq_state.load() }; + return {CELL_VDEC_ERROR_SEQ, vdec->seq_state.load()}; } } if (mode < 0 || mode > (CELL_VDEC_DEC_MODE_B_SKIP | CELL_VDEC_DEC_MODE_PB_SKIP)) { - return { CELL_VDEC_ERROR_ARG, "mode=%d", +mode }; + return {CELL_VDEC_ERROR_ARG, "mode=%d", +mode}; } // TODO: what does the 3 stand for ? if ((mode == (CELL_VDEC_DEC_MODE_B_SKIP | CELL_VDEC_DEC_MODE_PB_SKIP) && vdec->type != 3) || (mode == CELL_VDEC_DEC_MODE_PB_SKIP && vdec->type != CELL_VDEC_CODEC_TYPE_AVC)) { - return { CELL_VDEC_ERROR_ARG, "mode=%d, type=%d", +mode, vdec->type }; + return {CELL_VDEC_ERROR_ARG, "mode=%d, type=%d", +mode, vdec->type}; } if (!vdec->au_count.try_inc(4)) @@ -1140,7 +1136,7 @@ error_code cellVdecDecodeAuEx2(ppu_thread& ppu, u32 handle, CellVdecDecodeMode m if (!vdec || !auInfo || !auInfo->size || !auInfo->startAddr) { - return { CELL_VDEC_ERROR_ARG, "vdec=%d, auInfo=%d, size=%d, startAddr=0x%x", !!vdec, !!auInfo, auInfo ? auInfo->size.value() : 0, auInfo ? auInfo->startAddr.value() : 0 }; + return {CELL_VDEC_ERROR_ARG, "vdec=%d, auInfo=%d, size=%d, startAddr=0x%x", !!vdec, !!auInfo, auInfo ? auInfo->size.value() : 0, auInfo ? auInfo->startAddr.value() : 0}; } { @@ -1148,20 +1144,20 @@ error_code cellVdecDecodeAuEx2(ppu_thread& ppu, u32 handle, CellVdecDecodeMode m if (vdec->seq_state != sequence_state::ready) { - return { CELL_VDEC_ERROR_SEQ, vdec->seq_state.load() }; + return {CELL_VDEC_ERROR_SEQ, vdec->seq_state.load()}; } } if (mode < 0 || mode > (CELL_VDEC_DEC_MODE_B_SKIP | CELL_VDEC_DEC_MODE_PB_SKIP)) { - return { CELL_VDEC_ERROR_ARG, "mode=%d", +mode }; + return {CELL_VDEC_ERROR_ARG, "mode=%d", +mode}; } // TODO: what does the 3 stand for ? if ((mode == (CELL_VDEC_DEC_MODE_B_SKIP | CELL_VDEC_DEC_MODE_PB_SKIP) && vdec->type != 3) || (mode == CELL_VDEC_DEC_MODE_PB_SKIP && vdec->type != CELL_VDEC_CODEC_TYPE_AVC)) { - return { CELL_VDEC_ERROR_ARG, "mode=%d, type=%d", +mode, vdec->type }; + return {CELL_VDEC_ERROR_ARG, "mode=%d, type=%d", +mode, vdec->type}; } if (!vdec->au_count.try_inc(4)) @@ -1204,7 +1200,7 @@ error_code cellVdecGetPictureExt(ppu_thread& ppu, u32 handle, vm::cptrseq_state == sequence_state::closed || vdec->seq_state > sequence_state::ending) { - return { CELL_VDEC_ERROR_SEQ, vdec->seq_state.load() }; + return {CELL_VDEC_ERROR_SEQ, vdec->seq_state.load()}; } } @@ -1246,12 +1242,13 @@ error_code cellVdecGetPictureExt(ppu_thread& ppu, u32 handle, vm::cptr>(vdec->ppu_tid); - if (vdec_ppu) thread_ctrl::notify(*vdec_ppu); + if (vdec_ppu) + thread_ctrl::notify(*vdec_ppu); } if (sequence_id != frame.seq_id) { - return { CELL_VDEC_ERROR_EMPTY, "sequence_id=%d, seq_id=%d", sequence_id, frame.seq_id }; + return {CELL_VDEC_ERROR_EMPTY, "sequence_id=%d, seq_id=%d", sequence_id, frame.seq_id}; } if (outBuff) @@ -1265,8 +1262,14 @@ error_code cellVdecGetPictureExt(ppu_thread& ppu, u32 handle, vm::cptrformatType) { - case CELL_VDEC_PICFMT_ARGB32_ILV: out_f = AV_PIX_FMT_ARGB; alpha_plane.reset(new u8[w * h]); break; - case CELL_VDEC_PICFMT_RGBA32_ILV: out_f = AV_PIX_FMT_RGBA; alpha_plane.reset(new u8[w * h]); break; + case CELL_VDEC_PICFMT_ARGB32_ILV: + out_f = AV_PIX_FMT_ARGB; + alpha_plane.reset(new u8[w * h]); + break; + case CELL_VDEC_PICFMT_RGBA32_ILV: + out_f = AV_PIX_FMT_RGBA; + alpha_plane.reset(new u8[w * h]); + break; case CELL_VDEC_PICFMT_UYVY422_ILV: out_f = AV_PIX_FMT_UYVY422; break; case CELL_VDEC_PICFMT_YUV420_PLANAR: out_f = AV_PIX_FMT_YUV420P; break; default: @@ -1300,10 +1303,10 @@ error_code cellVdecGetPictureExt(ppu_thread& ppu, u32 handle, vm::cptrsws = sws_getCachedContext(vdec->sws, w, h, in_f, w, h, out_f, SWS_POINT, nullptr, nullptr, nullptr); - u8* in_data[4] = { frame->data[0], frame->data[1], frame->data[2], alpha_plane.get() }; - int in_line[4] = { frame->linesize[0], frame->linesize[1], frame->linesize[2], w * 1 }; - u8* out_data[4] = { outBuff.get_ptr() }; - int out_line[4] = { w * 4 }; // RGBA32 or ARGB32 + u8* in_data[4] = {frame->data[0], frame->data[1], frame->data[2], alpha_plane.get()}; + int in_line[4] = {frame->linesize[0], frame->linesize[1], frame->linesize[2], w * 1}; + u8* out_data[4] = {outBuff.get_ptr()}; + int out_line[4] = {w * 4}; // RGBA32 or ARGB32 // TODO: // It's possible that we need to align the pitch to 128 here. @@ -1368,7 +1371,7 @@ error_code cellVdecGetPicItem(ppu_thread& ppu, u32 handle, vm::pptrseq_state == sequence_state::closed || vdec->seq_state > sequence_state::ending) { - return { CELL_VDEC_ERROR_SEQ, vdec->seq_state.load() }; + return {CELL_VDEC_ERROR_SEQ, vdec->seq_state.load()}; } sequence_id = vdec->seq_id; @@ -1424,7 +1427,7 @@ error_code cellVdecGetPicItem(ppu_thread& ppu, u32 handle, vm::pptrcodecType = vdec->type; @@ -1469,19 +1472,19 @@ error_code cellVdecGetPicItem(ppu_thread& ppu, u32 handle, vm::pptrpictureType[1] = CELL_VDEC_AVC_PCT_UNKNOWN; // ??? - avc->idrPictureFlag = false; // ??? + avc->pictureType[1] = CELL_VDEC_AVC_PCT_UNKNOWN; // ??? + avc->idrPictureFlag = false; // ??? avc->aspect_ratio_idc = CELL_VDEC_AVC_ARI_SAR_UNSPECIFIED; // ??? avc->sar_height = 0; avc->sar_width = 0; avc->pic_struct = CELL_VDEC_AVC_PSTR_FRAME; // ??? - avc->picOrderCount[0] = 0; // ??? + avc->picOrderCount[0] = 0; // ??? avc->picOrderCount[1] = 0; - avc->vui_parameters_present_flag = true; // ??? - avc->frame_mbs_only_flag = true; // ??? progressive - avc->video_signal_type_present_flag = true; // ??? + avc->vui_parameters_present_flag = true; // ??? + avc->frame_mbs_only_flag = true; // ??? progressive + avc->video_signal_type_present_flag = true; // ??? avc->video_format = CELL_VDEC_AVC_VF_COMPONENT; // ??? - avc->video_full_range_flag = false; // ??? + avc->video_full_range_flag = false; // ??? avc->colour_description_present_flag = true; avc->colour_primaries = CELL_VDEC_AVC_CP_ITU_R_BT_709_5; // ??? avc->transfer_characteristics = CELL_VDEC_AVC_TC_ITU_R_BT_709_5; @@ -1502,9 +1505,9 @@ error_code cellVdecGetPicItem(ppu_thread& ppu, u32 handle, vm::pptrfixed_frame_rate_flag = true; - avc->low_delay_hrd_flag = true; // ??? + avc->low_delay_hrd_flag = true; // ??? avc->entropy_coding_mode_flag = true; // ??? - avc->nalUnitPresentFlags = 0; // ??? + avc->nalUnitPresentFlags = 0; // ??? avc->ccDataLength[0] = 0; avc->ccDataLength[1] = 0; avc->reserved[0] = 0; @@ -1527,11 +1530,11 @@ error_code cellVdecGetPicItem(ppu_thread& ppu, u32 handle, vm::pptrpixelAspectRatio = CELL_VDEC_DIVX_ARI_PAR_1_1; // ??? dvx->parHeight = 0; dvx->parWidth = 0; - dvx->colourDescription = false; // ??? - dvx->colourPrimaries = CELL_VDEC_DIVX_CP_ITU_R_BT_709; // ??? + dvx->colourDescription = false; // ??? + dvx->colourPrimaries = CELL_VDEC_DIVX_CP_ITU_R_BT_709; // ??? dvx->transferCharacteristics = CELL_VDEC_DIVX_TC_ITU_R_BT_709; // ??? - dvx->matrixCoefficients = CELL_VDEC_DIVX_MXC_ITU_R_BT_709; // ??? - dvx->pictureStruct = CELL_VDEC_DIVX_PSTR_FRAME; // ??? + dvx->matrixCoefficients = CELL_VDEC_DIVX_MXC_ITU_R_BT_709; // ??? + dvx->pictureStruct = CELL_VDEC_DIVX_PSTR_FRAME; // ??? switch (frc) { @@ -1568,10 +1571,10 @@ error_code cellVdecGetPicItem(ppu_thread& ppu, u32 handle, vm::pptrprogressive_sequence = true; // ??? - mp2->low_delay = true; // ??? + mp2->progressive_sequence = true; // ??? + mp2->low_delay = true; // ??? mp2->video_format = CELL_VDEC_MPEG2_VF_UNSPECIFIED; // ??? - mp2->colour_description = false; // ??? + mp2->colour_description = false; // ??? switch (s32 pct = frame->pict_type) { @@ -1608,7 +1611,7 @@ error_code cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frameRateCode) if (vdec->seq_state == sequence_state::closed || vdec->seq_state >= sequence_state::invalid) { - return { CELL_VDEC_ERROR_SEQ, vdec->seq_state.load() }; + return {CELL_VDEC_ERROR_SEQ, vdec->seq_state.load()}; } const u64 seq_id = vdec->seq_id; @@ -1685,49 +1688,49 @@ error_code cellVdecSetPts(u32 handle, vm::ptr unk) if (vdec->seq_state == sequence_state::closed || vdec->seq_state >= sequence_state::invalid) { - return { CELL_VDEC_ERROR_SEQ, vdec->seq_state.load() }; + return {CELL_VDEC_ERROR_SEQ, vdec->seq_state.load()}; } return CELL_OK; } DECLARE(ppu_module_manager::cellVdec)("libvdec", []() -{ + { #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 10, 100) - avcodec_register_all(); + avcodec_register_all(); #endif - static ppu_static_module libavcdec("libavcdec"); - static ppu_static_module libdivx311dec("libdivx311dec"); - static ppu_static_module libdivxdec("libdivxdec"); - static ppu_static_module libmvcdec("libmvcdec"); - static ppu_static_module libsjvtd("libsjvtd"); - static ppu_static_module libsmvd2("libsmvd2"); - static ppu_static_module libsmvd4("libsmvd4"); - static ppu_static_module libsvc1d("libsvc1d"); + static ppu_static_module libavcdec("libavcdec"); + static ppu_static_module libdivx311dec("libdivx311dec"); + static ppu_static_module libdivxdec("libdivxdec"); + static ppu_static_module libmvcdec("libmvcdec"); + static ppu_static_module libsjvtd("libsjvtd"); + static ppu_static_module libsmvd2("libsmvd2"); + static ppu_static_module libsmvd4("libsmvd4"); + static ppu_static_module libsvc1d("libsvc1d"); - REG_VAR(libvdec, _cell_vdec_prx_ver); // 0x085a7ecb + REG_VAR(libvdec, _cell_vdec_prx_ver); // 0x085a7ecb - REG_FUNC(libvdec, cellVdecQueryAttr); - REG_FUNC(libvdec, cellVdecQueryAttrEx); - REG_FUNC(libvdec, cellVdecOpen); - REG_FUNC(libvdec, cellVdecOpenEx); - REG_FUNC(libvdec, cellVdecOpenExt); // 0xef4d8ad7 - REG_FUNC(libvdec, cellVdecClose); - REG_FUNC(libvdec, cellVdecStartSeq); - REG_FUNC(libvdec, cellVdecStartSeqExt); // 0xebb8e70a - REG_FUNC(libvdec, cellVdecEndSeq); - REG_FUNC(libvdec, cellVdecDecodeAu); - REG_FUNC(libvdec, cellVdecDecodeAuEx2); - REG_FUNC(libvdec, cellVdecGetInputStatus); - REG_FUNC(libvdec, cellVdecGetPicture); - REG_FUNC(libvdec, cellVdecGetPictureExt); // 0xa21aa896 - REG_FUNC(libvdec, cellVdecGetPicItem); - REG_FUNC(libvdec, cellVdecGetPicItemEx); - REG_FUNC(libvdec, cellVdecGetPicItemExt); // 0x2cbd9806 - REG_FUNC(libvdec, cellVdecSetFrameRate); - REG_FUNC(libvdec, cellVdecSetFrameRateExt); // 0xcffc42a5 - REG_FUNC(libvdec, cellVdecSetPts); // 0x3ce2e4f8 + REG_FUNC(libvdec, cellVdecQueryAttr); + REG_FUNC(libvdec, cellVdecQueryAttrEx); + REG_FUNC(libvdec, cellVdecOpen); + REG_FUNC(libvdec, cellVdecOpenEx); + REG_FUNC(libvdec, cellVdecOpenExt); // 0xef4d8ad7 + REG_FUNC(libvdec, cellVdecClose); + REG_FUNC(libvdec, cellVdecStartSeq); + REG_FUNC(libvdec, cellVdecStartSeqExt); // 0xebb8e70a + REG_FUNC(libvdec, cellVdecEndSeq); + REG_FUNC(libvdec, cellVdecDecodeAu); + REG_FUNC(libvdec, cellVdecDecodeAuEx2); + REG_FUNC(libvdec, cellVdecGetInputStatus); + REG_FUNC(libvdec, cellVdecGetPicture); + REG_FUNC(libvdec, cellVdecGetPictureExt); // 0xa21aa896 + REG_FUNC(libvdec, cellVdecGetPicItem); + REG_FUNC(libvdec, cellVdecGetPicItemEx); + REG_FUNC(libvdec, cellVdecGetPicItemExt); // 0x2cbd9806 + REG_FUNC(libvdec, cellVdecSetFrameRate); + REG_FUNC(libvdec, cellVdecSetFrameRateExt); // 0xcffc42a5 + REG_FUNC(libvdec, cellVdecSetPts); // 0x3ce2e4f8 - REG_HIDDEN_FUNC(vdecEntry); -}); + REG_HIDDEN_FUNC(vdecEntry); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellVdec.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellVdec.h index 9f30b7d1b..8b235f197 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellVdec.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellVdec.h @@ -3,30 +3,30 @@ // Error Codes enum CellVdecError : u32 { - CELL_VDEC_ERROR_ARG = 0x80610101, - CELL_VDEC_ERROR_SEQ = 0x80610102, - CELL_VDEC_ERROR_BUSY = 0x80610103, + CELL_VDEC_ERROR_ARG = 0x80610101, + CELL_VDEC_ERROR_SEQ = 0x80610102, + CELL_VDEC_ERROR_BUSY = 0x80610103, CELL_VDEC_ERROR_EMPTY = 0x80610104, - CELL_VDEC_ERROR_AU = 0x80610105, - CELL_VDEC_ERROR_PIC = 0x80610106, + CELL_VDEC_ERROR_AU = 0x80610105, + CELL_VDEC_ERROR_PIC = 0x80610106, CELL_VDEC_ERROR_FATAL = 0x80610180, }; enum CellVdecCodecType : s32 { CELL_VDEC_CODEC_TYPE_MPEG2 = 0, - CELL_VDEC_CODEC_TYPE_AVC = 1, - CELL_VDEC_CODEC_TYPE_DIVX = 5, + CELL_VDEC_CODEC_TYPE_AVC = 1, + CELL_VDEC_CODEC_TYPE_DIVX = 5, CELL_VDEC_CODEC_TYPE_MAX }; // Callback Messages enum CellVdecMsgType : s32 { - CELL_VDEC_MSG_TYPE_AUDONE = 0, // decoding finished - CELL_VDEC_MSG_TYPE_PICOUT = 1, // picture done + CELL_VDEC_MSG_TYPE_AUDONE = 0, // decoding finished + CELL_VDEC_MSG_TYPE_PICOUT = 1, // picture done CELL_VDEC_MSG_TYPE_SEQDONE = 2, // finishing done - CELL_VDEC_MSG_TYPE_ERROR = 3, // fatal error + CELL_VDEC_MSG_TYPE_ERROR = 3, // fatal error }; // Decoder Operation Mode @@ -63,13 +63,13 @@ enum CellVdecPicAttr : s32 enum CellVdecFrameRate : s32 { CELL_VDEC_FRC_24000DIV1001 = 0x80, - CELL_VDEC_FRC_24 = 0x81, - CELL_VDEC_FRC_25 = 0x82, + CELL_VDEC_FRC_24 = 0x81, + CELL_VDEC_FRC_25 = 0x82, CELL_VDEC_FRC_30000DIV1001 = 0x83, - CELL_VDEC_FRC_30 = 0x84, - CELL_VDEC_FRC_50 = 0x85, + CELL_VDEC_FRC_30 = 0x84, + CELL_VDEC_FRC_50 = 0x85, CELL_VDEC_FRC_60000DIV1001 = 0x86, - CELL_VDEC_FRC_60 = 0x87, + CELL_VDEC_FRC_60 = 0x87, }; enum @@ -97,7 +97,7 @@ struct CellVdecTypeEx struct CellVdecAttr { be_t memSize; // required memory - u8 cmdDepth; // command queue depth + u8 cmdDepth; // command queue depth be_t decoderVerUpper; be_t decoderVerLower; }; @@ -185,14 +185,14 @@ struct CellVdecPicItem // Output Picture Format struct CellVdecPicFormat { - be_t formatType; // CellVdecPicFormatType + be_t formatType; // CellVdecPicFormatType be_t colorMatrixType; // CellVdecColorMatrixType u8 alpha; }; struct CellVdecPicFormat2 { - be_t formatType; // CellVdecPicFormatType + be_t formatType; // CellVdecPicFormatType be_t colorMatrixType; // CellVdecColorMatrixType be_t unk0; u8 alpha; @@ -216,19 +216,19 @@ enum enum AVC_level : u8 { - CELL_VDEC_AVC_LEVEL_1P0 = 10, - CELL_VDEC_AVC_LEVEL_1P1 = 11, - CELL_VDEC_AVC_LEVEL_1P2 = 12, - CELL_VDEC_AVC_LEVEL_1P3 = 13, - CELL_VDEC_AVC_LEVEL_2P0 = 20, - CELL_VDEC_AVC_LEVEL_2P1 = 21, - CELL_VDEC_AVC_LEVEL_2P2 = 22, - CELL_VDEC_AVC_LEVEL_3P0 = 30, - CELL_VDEC_AVC_LEVEL_3P1 = 31, - CELL_VDEC_AVC_LEVEL_3P2 = 32, - CELL_VDEC_AVC_LEVEL_4P0 = 40, - CELL_VDEC_AVC_LEVEL_4P1 = 41, - CELL_VDEC_AVC_LEVEL_4P2 = 42, + CELL_VDEC_AVC_LEVEL_1P0 = 10, + CELL_VDEC_AVC_LEVEL_1P1 = 11, + CELL_VDEC_AVC_LEVEL_1P2 = 12, + CELL_VDEC_AVC_LEVEL_1P3 = 13, + CELL_VDEC_AVC_LEVEL_2P0 = 20, + CELL_VDEC_AVC_LEVEL_2P1 = 21, + CELL_VDEC_AVC_LEVEL_2P2 = 22, + CELL_VDEC_AVC_LEVEL_3P0 = 30, + CELL_VDEC_AVC_LEVEL_3P1 = 31, + CELL_VDEC_AVC_LEVEL_3P2 = 32, + CELL_VDEC_AVC_LEVEL_4P0 = 40, + CELL_VDEC_AVC_LEVEL_4P1 = 41, + CELL_VDEC_AVC_LEVEL_4P2 = 42, }; struct CellVdecAvcSpecificInfo @@ -242,116 +242,116 @@ struct CellVdecAvcSpecificInfo enum AVC_video_format : u8 { - CELL_VDEC_AVC_VF_COMPONENT = 0x00, - CELL_VDEC_AVC_VF_PAL = 0x01, - CELL_VDEC_AVC_VF_NTSC = 0x02, - CELL_VDEC_AVC_VF_SECAM = 0x03, - CELL_VDEC_AVC_VF_MAC = 0x04, - CELL_VDEC_AVC_VF_UNSPECIFIED = 0x05, + CELL_VDEC_AVC_VF_COMPONENT = 0x00, + CELL_VDEC_AVC_VF_PAL = 0x01, + CELL_VDEC_AVC_VF_NTSC = 0x02, + CELL_VDEC_AVC_VF_SECAM = 0x03, + CELL_VDEC_AVC_VF_MAC = 0x04, + CELL_VDEC_AVC_VF_UNSPECIFIED = 0x05, }; enum AVC_colour_primaries : u8 { - CELL_VDEC_AVC_CP_ITU_R_BT_709_5 = 0x01, - CELL_VDEC_AVC_CP_UNSPECIFIED = 0x02, - CELL_VDEC_AVC_CP_ITU_R_BT_470_6_SYS_M = 0x04, - CELL_VDEC_AVC_CP_ITU_R_BT_470_6_SYS_BG = 0x05, - CELL_VDEC_AVC_CP_SMPTE_170_M = 0x06, - CELL_VDEC_AVC_CP_SMPTE_240_M = 0x07, - CELL_VDEC_AVC_CP_GENERIC_FILM = 0x08, + CELL_VDEC_AVC_CP_ITU_R_BT_709_5 = 0x01, + CELL_VDEC_AVC_CP_UNSPECIFIED = 0x02, + CELL_VDEC_AVC_CP_ITU_R_BT_470_6_SYS_M = 0x04, + CELL_VDEC_AVC_CP_ITU_R_BT_470_6_SYS_BG = 0x05, + CELL_VDEC_AVC_CP_SMPTE_170_M = 0x06, + CELL_VDEC_AVC_CP_SMPTE_240_M = 0x07, + CELL_VDEC_AVC_CP_GENERIC_FILM = 0x08, }; enum AVC_transfer_characteristics : u8 { - CELL_VDEC_AVC_TC_ITU_R_BT_709_5 = 0x01, - CELL_VDEC_AVC_TC_UNSPECIFIED = 0x02, - CELL_VDEC_AVC_TC_ITU_R_BT_470_6_SYS_M = 0x04, - CELL_VDEC_AVC_TC_ITU_R_BT_470_6_SYS_BG = 0x05, - CELL_VDEC_AVC_TC_SMPTE_170_M = 0x06, - CELL_VDEC_AVC_TC_SMPTE_240_M = 0x07, - CELL_VDEC_AVC_TC_LINEAR = 0x08, - CELL_VDEC_AVC_TC_LOG_100_1 = 0x09, - CELL_VDEC_AVC_TC_LOG_316_1 = 0x0a, + CELL_VDEC_AVC_TC_ITU_R_BT_709_5 = 0x01, + CELL_VDEC_AVC_TC_UNSPECIFIED = 0x02, + CELL_VDEC_AVC_TC_ITU_R_BT_470_6_SYS_M = 0x04, + CELL_VDEC_AVC_TC_ITU_R_BT_470_6_SYS_BG = 0x05, + CELL_VDEC_AVC_TC_SMPTE_170_M = 0x06, + CELL_VDEC_AVC_TC_SMPTE_240_M = 0x07, + CELL_VDEC_AVC_TC_LINEAR = 0x08, + CELL_VDEC_AVC_TC_LOG_100_1 = 0x09, + CELL_VDEC_AVC_TC_LOG_316_1 = 0x0a, }; enum AVC_matrix_coefficients : u8 { - CELL_VDEC_AVC_MXC_GBR = 0x00, - CELL_VDEC_AVC_MXC_ITU_R_BT_709_5 = 0x01, - CELL_VDEC_AVC_MXC_UNSPECIFIED = 0x02, - CELL_VDEC_AVC_MXC_FCC = 0x04, - CELL_VDEC_AVC_MXC_ITU_R_BT_470_6_SYS_BG = 0x05, - CELL_VDEC_AVC_MXC_SMPTE_170_M = 0x06, - CELL_VDEC_AVC_MXC_SMPTE_240_M = 0x07, - CELL_VDEC_AVC_MXC_YCGCO = 0x08, + CELL_VDEC_AVC_MXC_GBR = 0x00, + CELL_VDEC_AVC_MXC_ITU_R_BT_709_5 = 0x01, + CELL_VDEC_AVC_MXC_UNSPECIFIED = 0x02, + CELL_VDEC_AVC_MXC_FCC = 0x04, + CELL_VDEC_AVC_MXC_ITU_R_BT_470_6_SYS_BG = 0x05, + CELL_VDEC_AVC_MXC_SMPTE_170_M = 0x06, + CELL_VDEC_AVC_MXC_SMPTE_240_M = 0x07, + CELL_VDEC_AVC_MXC_YCGCO = 0x08, }; enum AVC_FrameRateCode : u8 { - CELL_VDEC_AVC_FRC_24000DIV1001 = 0x00, - CELL_VDEC_AVC_FRC_24 = 0x01, - CELL_VDEC_AVC_FRC_25 = 0x02, - CELL_VDEC_AVC_FRC_30000DIV1001 = 0x03, - CELL_VDEC_AVC_FRC_30 = 0x04, - CELL_VDEC_AVC_FRC_50 = 0x05, - CELL_VDEC_AVC_FRC_60000DIV1001 = 0x06, - CELL_VDEC_AVC_FRC_60 = 0x07, + CELL_VDEC_AVC_FRC_24000DIV1001 = 0x00, + CELL_VDEC_AVC_FRC_24 = 0x01, + CELL_VDEC_AVC_FRC_25 = 0x02, + CELL_VDEC_AVC_FRC_30000DIV1001 = 0x03, + CELL_VDEC_AVC_FRC_30 = 0x04, + CELL_VDEC_AVC_FRC_50 = 0x05, + CELL_VDEC_AVC_FRC_60000DIV1001 = 0x06, + CELL_VDEC_AVC_FRC_60 = 0x07, }; enum AVC_NulUnitPresentFlags : u16 { - CELL_VDEC_AVC_FLG_SPS = 0x0001, - CELL_VDEC_AVC_FLG_PPS = 0x0002, - CELL_VDEC_AVC_FLG_AUD = 0x0004, - CELL_VDEC_AVC_FLG_EO_SEQ = 0x0008, - CELL_VDEC_AVC_FLG_EO_STREAM = 0x0100, - CELL_VDEC_AVC_FLG_FILLER_DATA = 0x0200, - CELL_VDEC_AVC_FLG_PIC_TIMING_SEI = 0x0400, - CELL_VDEC_AVC_FLG_BUFF_PERIOD_SEI = 0x0800, - CELL_VDEC_AVC_FLG_USER_DATA_UNREG_SEI = 0x1000, + CELL_VDEC_AVC_FLG_SPS = 0x0001, + CELL_VDEC_AVC_FLG_PPS = 0x0002, + CELL_VDEC_AVC_FLG_AUD = 0x0004, + CELL_VDEC_AVC_FLG_EO_SEQ = 0x0008, + CELL_VDEC_AVC_FLG_EO_STREAM = 0x0100, + CELL_VDEC_AVC_FLG_FILLER_DATA = 0x0200, + CELL_VDEC_AVC_FLG_PIC_TIMING_SEI = 0x0400, + CELL_VDEC_AVC_FLG_BUFF_PERIOD_SEI = 0x0800, + CELL_VDEC_AVC_FLG_USER_DATA_UNREG_SEI = 0x1000, }; enum AVC_aspect_ratio_idc : u8 { - CELL_VDEC_AVC_ARI_SAR_UNSPECIFIED = 0x00, - CELL_VDEC_AVC_ARI_SAR_1_1 = 0x01, - CELL_VDEC_AVC_ARI_SAR_12_11 = 0x02, - CELL_VDEC_AVC_ARI_SAR_10_11 = 0x03, - CELL_VDEC_AVC_ARI_SAR_16_11 = 0x04, - CELL_VDEC_AVC_ARI_SAR_40_33 = 0x05, - CELL_VDEC_AVC_ARI_SAR_24_11 = 0x06, - CELL_VDEC_AVC_ARI_SAR_20_11 = 0x07, - CELL_VDEC_AVC_ARI_SAR_32_11 = 0x08, - CELL_VDEC_AVC_ARI_SAR_80_33 = 0x09, - CELL_VDEC_AVC_ARI_SAR_18_11 = 0x0a, - CELL_VDEC_AVC_ARI_SAR_15_11 = 0x0b, - CELL_VDEC_AVC_ARI_SAR_64_33 = 0x0c, - CELL_VDEC_AVC_ARI_SAR_160_99 = 0x0d, - CELL_VDEC_AVC_ARI_SAR_4_3 = 0x0e, - CELL_VDEC_AVC_ARI_SAR_3_2 = 0x0f, - CELL_VDEC_AVC_ARI_SAR_2_1 = 0x10, - CELL_VDEC_AVC_ARI_SAR_EXTENDED_SAR = 0xff, + CELL_VDEC_AVC_ARI_SAR_UNSPECIFIED = 0x00, + CELL_VDEC_AVC_ARI_SAR_1_1 = 0x01, + CELL_VDEC_AVC_ARI_SAR_12_11 = 0x02, + CELL_VDEC_AVC_ARI_SAR_10_11 = 0x03, + CELL_VDEC_AVC_ARI_SAR_16_11 = 0x04, + CELL_VDEC_AVC_ARI_SAR_40_33 = 0x05, + CELL_VDEC_AVC_ARI_SAR_24_11 = 0x06, + CELL_VDEC_AVC_ARI_SAR_20_11 = 0x07, + CELL_VDEC_AVC_ARI_SAR_32_11 = 0x08, + CELL_VDEC_AVC_ARI_SAR_80_33 = 0x09, + CELL_VDEC_AVC_ARI_SAR_18_11 = 0x0a, + CELL_VDEC_AVC_ARI_SAR_15_11 = 0x0b, + CELL_VDEC_AVC_ARI_SAR_64_33 = 0x0c, + CELL_VDEC_AVC_ARI_SAR_160_99 = 0x0d, + CELL_VDEC_AVC_ARI_SAR_4_3 = 0x0e, + CELL_VDEC_AVC_ARI_SAR_3_2 = 0x0f, + CELL_VDEC_AVC_ARI_SAR_2_1 = 0x10, + CELL_VDEC_AVC_ARI_SAR_EXTENDED_SAR = 0xff, }; enum AVC_PictureType : u8 { - CELL_VDEC_AVC_PCT_I = 0x00, - CELL_VDEC_AVC_PCT_P = 0x01, - CELL_VDEC_AVC_PCT_B = 0x02, - CELL_VDEC_AVC_PCT_UNKNOWN = 0x03, + CELL_VDEC_AVC_PCT_I = 0x00, + CELL_VDEC_AVC_PCT_P = 0x01, + CELL_VDEC_AVC_PCT_B = 0x02, + CELL_VDEC_AVC_PCT_UNKNOWN = 0x03, }; enum AVC_pic_struct : u8 { - CELL_VDEC_AVC_PSTR_FRAME = 0x00, - CELL_VDEC_AVC_PSTR_FIELD_TOP = 0x01, - CELL_VDEC_AVC_PSTR_FIELD_BTM = 0x02, - CELL_VDEC_AVC_PSTR_FIELD_TOP_BTM = 0x03, - CELL_VDEC_AVC_PSTR_FIELD_BTM_TOP = 0x04, - CELL_VDEC_AVC_PSTR_FIELD_TOP_BTM_TOP = 0x05, - CELL_VDEC_AVC_PSTR_FIELD_BTM_TOP_BTM = 0x06, - CELL_VDEC_AVC_PSTR_FRAME_DOUBLING = 0x07, - CELL_VDEC_AVC_PSTR_FRAME_TRIPLING = 0x08, + CELL_VDEC_AVC_PSTR_FRAME = 0x00, + CELL_VDEC_AVC_PSTR_FIELD_TOP = 0x01, + CELL_VDEC_AVC_PSTR_FIELD_BTM = 0x02, + CELL_VDEC_AVC_PSTR_FIELD_TOP_BTM = 0x03, + CELL_VDEC_AVC_PSTR_FIELD_BTM_TOP = 0x04, + CELL_VDEC_AVC_PSTR_FIELD_TOP_BTM_TOP = 0x05, + CELL_VDEC_AVC_PSTR_FIELD_BTM_TOP_BTM = 0x06, + CELL_VDEC_AVC_PSTR_FRAME_DOUBLING = 0x07, + CELL_VDEC_AVC_PSTR_FRAME_TRIPLING = 0x08, }; struct CellVdecAvcInfo @@ -388,11 +388,11 @@ struct CellVdecAvcInfo // DIVX Profile enum DIVX_level : u8 { - CELL_VDEC_DIVX_QMOBILE = 10, - CELL_VDEC_DIVX_MOBILE = 11, - CELL_VDEC_DIVX_HOME_THEATER = 12, - CELL_VDEC_DIVX_HD_720 = 13, - CELL_VDEC_DIVX_HD_1080 = 14, + CELL_VDEC_DIVX_QMOBILE = 10, + CELL_VDEC_DIVX_MOBILE = 11, + CELL_VDEC_DIVX_HOME_THEATER = 12, + CELL_VDEC_DIVX_HD_720 = 13, + CELL_VDEC_DIVX_HD_1080 = 14, }; struct CellVdecDivxSpecificInfo @@ -412,74 +412,74 @@ struct CellVdecDivxSpecificInfo2 enum DIVX_frameRateCode : u16 { - CELL_VDEC_DIVX_FRC_UNDEFINED = 0x00, - CELL_VDEC_DIVX_FRC_24000DIV1001 = 0x01, - CELL_VDEC_DIVX_FRC_24 = 0x02, - CELL_VDEC_DIVX_FRC_25 = 0x03, - CELL_VDEC_DIVX_FRC_30000DIV1001 = 0x04, - CELL_VDEC_DIVX_FRC_30 = 0x05, - CELL_VDEC_DIVX_FRC_50 = 0x06, - CELL_VDEC_DIVX_FRC_60000DIV1001 = 0x07, - CELL_VDEC_DIVX_FRC_60 = 0x08, + CELL_VDEC_DIVX_FRC_UNDEFINED = 0x00, + CELL_VDEC_DIVX_FRC_24000DIV1001 = 0x01, + CELL_VDEC_DIVX_FRC_24 = 0x02, + CELL_VDEC_DIVX_FRC_25 = 0x03, + CELL_VDEC_DIVX_FRC_30000DIV1001 = 0x04, + CELL_VDEC_DIVX_FRC_30 = 0x05, + CELL_VDEC_DIVX_FRC_50 = 0x06, + CELL_VDEC_DIVX_FRC_60000DIV1001 = 0x07, + CELL_VDEC_DIVX_FRC_60 = 0x08, }; enum DIVX_pixelAspectRatio : u8 { - CELL_VDEC_DIVX_ARI_PAR_1_1 = 0x1, - CELL_VDEC_DIVX_ARI_PAR_12_11 = 0x2, - CELL_VDEC_DIVX_ARI_PAR_10_11 = 0x3, - CELL_VDEC_DIVX_ARI_PAR_16_11 = 0x4, - CELL_VDEC_DIVX_ARI_PAR_40_33 = 0x5, - CELL_VDEC_DIVX_ARI_PAR_EXTENDED_PAR = 0xF, + CELL_VDEC_DIVX_ARI_PAR_1_1 = 0x1, + CELL_VDEC_DIVX_ARI_PAR_12_11 = 0x2, + CELL_VDEC_DIVX_ARI_PAR_10_11 = 0x3, + CELL_VDEC_DIVX_ARI_PAR_16_11 = 0x4, + CELL_VDEC_DIVX_ARI_PAR_40_33 = 0x5, + CELL_VDEC_DIVX_ARI_PAR_EXTENDED_PAR = 0xF, }; enum DIVX_pictureType : u8 { - CELL_VDEC_DIVX_VCT_I = 0x0, - CELL_VDEC_DIVX_VCT_P = 0x1, - CELL_VDEC_DIVX_VCT_B = 0x2, + CELL_VDEC_DIVX_VCT_I = 0x0, + CELL_VDEC_DIVX_VCT_P = 0x1, + CELL_VDEC_DIVX_VCT_B = 0x2, }; enum DIVX_pictureStruct : u8 { - CELL_VDEC_DIVX_PSTR_FRAME = 0x0, - CELL_VDEC_DIVX_PSTR_TOP_BTM = 0x1, - CELL_VDEC_DIVX_PSTR_BTM_TOP = 0x2, + CELL_VDEC_DIVX_PSTR_FRAME = 0x0, + CELL_VDEC_DIVX_PSTR_TOP_BTM = 0x1, + CELL_VDEC_DIVX_PSTR_BTM_TOP = 0x2, }; enum DIVX_colourPrimaries : u8 { - CELL_VDEC_DIVX_CP_ITU_R_BT_709 = 0x01, - CELL_VDEC_DIVX_CP_UNSPECIFIED = 0x02, - CELL_VDEC_DIVX_CP_ITU_R_BT_470_SYS_M = 0x04, - CELL_VDEC_DIVX_CP_ITU_R_BT_470_SYS_BG = 0x05, - CELL_VDEC_DIVX_CP_SMPTE_170_M = 0x06, - CELL_VDEC_DIVX_CP_SMPTE_240_M = 0x07, - CELL_VDEC_DIVX_CP_GENERIC_FILM = 0x08, + CELL_VDEC_DIVX_CP_ITU_R_BT_709 = 0x01, + CELL_VDEC_DIVX_CP_UNSPECIFIED = 0x02, + CELL_VDEC_DIVX_CP_ITU_R_BT_470_SYS_M = 0x04, + CELL_VDEC_DIVX_CP_ITU_R_BT_470_SYS_BG = 0x05, + CELL_VDEC_DIVX_CP_SMPTE_170_M = 0x06, + CELL_VDEC_DIVX_CP_SMPTE_240_M = 0x07, + CELL_VDEC_DIVX_CP_GENERIC_FILM = 0x08, }; enum DIVX_transferCharacteristics : u8 { - CELL_VDEC_DIVX_TC_ITU_R_BT_709 = 0x01, - CELL_VDEC_DIVX_TC_UNSPECIFIED = 0x02, - CELL_VDEC_DIVX_TC_ITU_R_BT_470_SYS_M = 0x04, - CELL_VDEC_DIVX_TC_ITU_R_BT_470_SYS_BG = 0x05, - CELL_VDEC_DIVX_TC_SMPTE_170_M = 0x06, - CELL_VDEC_DIVX_TC_SMPTE_240_M = 0x07, - CELL_VDEC_DIVX_TC_LINEAR = 0x08, - CELL_VDEC_DIVX_TC_LOG_100_1 = 0x09, - CELL_VDEC_DIVX_TC_LOG_316_1 = 0x0a, + CELL_VDEC_DIVX_TC_ITU_R_BT_709 = 0x01, + CELL_VDEC_DIVX_TC_UNSPECIFIED = 0x02, + CELL_VDEC_DIVX_TC_ITU_R_BT_470_SYS_M = 0x04, + CELL_VDEC_DIVX_TC_ITU_R_BT_470_SYS_BG = 0x05, + CELL_VDEC_DIVX_TC_SMPTE_170_M = 0x06, + CELL_VDEC_DIVX_TC_SMPTE_240_M = 0x07, + CELL_VDEC_DIVX_TC_LINEAR = 0x08, + CELL_VDEC_DIVX_TC_LOG_100_1 = 0x09, + CELL_VDEC_DIVX_TC_LOG_316_1 = 0x0a, }; enum DIVX_matrixCoefficients : u8 { - CELL_VDEC_DIVX_MXC_ITU_R_BT_709 = 0x01, - CELL_VDEC_DIVX_MXC_UNSPECIFIED = 0x02, - CELL_VDEC_DIVX_MXC_FCC = 0x04, - CELL_VDEC_DIVX_MXC_ITU_R_BT_470_SYS_BG = 0x05, - CELL_VDEC_DIVX_MXC_SMPTE_170_M = 0x06, - CELL_VDEC_DIVX_MXC_SMPTE_240_M = 0x07, - CELL_VDEC_DIVX_MXC_YCGCO = 0x08, + CELL_VDEC_DIVX_MXC_ITU_R_BT_709 = 0x01, + CELL_VDEC_DIVX_MXC_UNSPECIFIED = 0x02, + CELL_VDEC_DIVX_MXC_FCC = 0x04, + CELL_VDEC_DIVX_MXC_ITU_R_BT_470_SYS_BG = 0x05, + CELL_VDEC_DIVX_MXC_SMPTE_170_M = 0x06, + CELL_VDEC_DIVX_MXC_SMPTE_240_M = 0x07, + CELL_VDEC_DIVX_MXC_YCGCO = 0x08, }; struct CellVdecDivxInfo @@ -515,122 +515,122 @@ struct CellVdecMpeg2SpecificInfo enum MPEG2_headerFlags : u32 { - CELL_VDEC_MPEG2_FLG_SEQ_HDR = 0x00000001, - CELL_VDEC_MPEG2_FLG_SEQ_EXT = 0x00000002, - CELL_VDEC_MPEG2_FLG_SEQ_DSP_EXT = 0x00000004, - CELL_VDEC_MPEG2_FLG_SEQ_USR_DAT = 0x00000008, - CELL_VDEC_MPEG2_FLG_SEQ_END = 0x00000010, - CELL_VDEC_MPEG2_FLG_GOP_HDR = 0x00000020, - CELL_VDEC_MPEG2_FLG_GOP_USR_DAT = 0x00000040, - CELL_VDEC_MPEG2_FLG_PIC_HDR_1 = 0x00000100, - CELL_VDEC_MPEG2_FLG_PIC_EXT_1 = 0x00000200, + CELL_VDEC_MPEG2_FLG_SEQ_HDR = 0x00000001, + CELL_VDEC_MPEG2_FLG_SEQ_EXT = 0x00000002, + CELL_VDEC_MPEG2_FLG_SEQ_DSP_EXT = 0x00000004, + CELL_VDEC_MPEG2_FLG_SEQ_USR_DAT = 0x00000008, + CELL_VDEC_MPEG2_FLG_SEQ_END = 0x00000010, + CELL_VDEC_MPEG2_FLG_GOP_HDR = 0x00000020, + CELL_VDEC_MPEG2_FLG_GOP_USR_DAT = 0x00000040, + CELL_VDEC_MPEG2_FLG_PIC_HDR_1 = 0x00000100, + CELL_VDEC_MPEG2_FLG_PIC_EXT_1 = 0x00000200, CELL_VDEC_MPEG2_FLG_PIC_DSP_EXT_1 = 0x00000400, CELL_VDEC_MPEG2_FLG_PIC_USR_DAT_1 = 0x00000800, - CELL_VDEC_MPEG2_FLG_PIC_HDR_2 = 0x00001000, - CELL_VDEC_MPEG2_FLG_PIC_EXT_2 = 0x00002000, + CELL_VDEC_MPEG2_FLG_PIC_HDR_2 = 0x00001000, + CELL_VDEC_MPEG2_FLG_PIC_EXT_2 = 0x00002000, CELL_VDEC_MPEG2_FLG_PIC_DSP_EXT_2 = 0x00004000, CELL_VDEC_MPEG2_FLG_PIC_USR_DAT_2 = 0x00008000, }; enum MPEG2_aspectRatio : u8 { - CELL_VDEC_MPEG2_ARI_SAR_1_1 = 0x01, - CELL_VDEC_MPEG2_ARI_DAR_4_3 = 0x02, - CELL_VDEC_MPEG2_ARI_DAR_16_9 = 0x03, - CELL_VDEC_MPEG2_ARI_DAR_2P21_1 = 0x04, + CELL_VDEC_MPEG2_ARI_SAR_1_1 = 0x01, + CELL_VDEC_MPEG2_ARI_DAR_4_3 = 0x02, + CELL_VDEC_MPEG2_ARI_DAR_16_9 = 0x03, + CELL_VDEC_MPEG2_ARI_DAR_2P21_1 = 0x04, }; enum MPEG1_aspectRatio : u8 { - CELL_VDEC_MPEG1_ARI_SAR_1P0 = 0x01, - CELL_VDEC_MPEG1_ARI_SAR_0P6735 = 0x02, - CELL_VDEC_MPEG1_ARI_SAR_0P7031 = 0x03, - CELL_VDEC_MPEG1_ARI_SAR_0P7615 = 0x04, - CELL_VDEC_MPEG1_ARI_SAR_0P8055 = 0x05, - CELL_VDEC_MPEG1_ARI_SAR_0P8437 = 0x06, - CELL_VDEC_MPEG1_ARI_SAR_0P8935 = 0x07, - CELL_VDEC_MPEG1_ARI_SAR_0P9157 = 0x08, - CELL_VDEC_MPEG1_ARI_SAR_0P9815 = 0x09, - CELL_VDEC_MPEG1_ARI_SAR_1P0255 = 0x0a, - CELL_VDEC_MPEG1_ARI_SAR_1P0695 = 0x0b, - CELL_VDEC_MPEG1_ARI_SAR_1P0950 = 0x0c, - CELL_VDEC_MPEG1_ARI_SAR_1P1575 = 0x0d, - CELL_VDEC_MPEG1_ARI_SAR_1P2015 = 0x0e, + CELL_VDEC_MPEG1_ARI_SAR_1P0 = 0x01, + CELL_VDEC_MPEG1_ARI_SAR_0P6735 = 0x02, + CELL_VDEC_MPEG1_ARI_SAR_0P7031 = 0x03, + CELL_VDEC_MPEG1_ARI_SAR_0P7615 = 0x04, + CELL_VDEC_MPEG1_ARI_SAR_0P8055 = 0x05, + CELL_VDEC_MPEG1_ARI_SAR_0P8437 = 0x06, + CELL_VDEC_MPEG1_ARI_SAR_0P8935 = 0x07, + CELL_VDEC_MPEG1_ARI_SAR_0P9157 = 0x08, + CELL_VDEC_MPEG1_ARI_SAR_0P9815 = 0x09, + CELL_VDEC_MPEG1_ARI_SAR_1P0255 = 0x0a, + CELL_VDEC_MPEG1_ARI_SAR_1P0695 = 0x0b, + CELL_VDEC_MPEG1_ARI_SAR_1P0950 = 0x0c, + CELL_VDEC_MPEG1_ARI_SAR_1P1575 = 0x0d, + CELL_VDEC_MPEG1_ARI_SAR_1P2015 = 0x0e, }; enum MPEG2_frameRate : u8 { - CELL_VDEC_MPEG2_FRC_FORBIDDEN = 0x00, - CELL_VDEC_MPEG2_FRC_24000DIV1001 = 0x01, - CELL_VDEC_MPEG2_FRC_24 = 0x02, - CELL_VDEC_MPEG2_FRC_25 = 0x03, - CELL_VDEC_MPEG2_FRC_30000DIV1001 = 0x04, - CELL_VDEC_MPEG2_FRC_30 = 0x05, - CELL_VDEC_MPEG2_FRC_50 = 0x06, - CELL_VDEC_MPEG2_FRC_60000DIV1001 = 0x07, - CELL_VDEC_MPEG2_FRC_60 = 0x08, + CELL_VDEC_MPEG2_FRC_FORBIDDEN = 0x00, + CELL_VDEC_MPEG2_FRC_24000DIV1001 = 0x01, + CELL_VDEC_MPEG2_FRC_24 = 0x02, + CELL_VDEC_MPEG2_FRC_25 = 0x03, + CELL_VDEC_MPEG2_FRC_30000DIV1001 = 0x04, + CELL_VDEC_MPEG2_FRC_30 = 0x05, + CELL_VDEC_MPEG2_FRC_50 = 0x06, + CELL_VDEC_MPEG2_FRC_60000DIV1001 = 0x07, + CELL_VDEC_MPEG2_FRC_60 = 0x08, }; enum MPEG2_videoFormat : u8 { - CELL_VDEC_MPEG2_VF_COMPONENT = 0x00, - CELL_VDEC_MPEG2_VF_PAL = 0x01, - CELL_VDEC_MPEG2_VF_NTSC = 0x02, - CELL_VDEC_MPEG2_VF_SECAM = 0x03, - CELL_VDEC_MPEG2_VF_MAC = 0x04, - CELL_VDEC_MPEG2_VF_UNSPECIFIED = 0x05, + CELL_VDEC_MPEG2_VF_COMPONENT = 0x00, + CELL_VDEC_MPEG2_VF_PAL = 0x01, + CELL_VDEC_MPEG2_VF_NTSC = 0x02, + CELL_VDEC_MPEG2_VF_SECAM = 0x03, + CELL_VDEC_MPEG2_VF_MAC = 0x04, + CELL_VDEC_MPEG2_VF_UNSPECIFIED = 0x05, }; enum MPEG2_colourPrimaries : u8 { - CELL_VDEC_MPEG2_CP_FORBIDDEN = 0x00, - CELL_VDEC_MPEG2_CP_ITU_R_BT_709 = 0x01, - CELL_VDEC_MPEG2_CP_UNSPECIFIED = 0x02, - CELL_VDEC_MPEG2_CP_ITU_R_BT_470_2_SYS_M = 0x04, - CELL_VDEC_MPEG2_CP_ITU_R_BT_470_2_SYS_BG = 0x05, - CELL_VDEC_MPEG2_CP_SMPTE_170_M = 0x06, - CELL_VDEC_MPEG2_CP_SMPTE_240_M = 0x07, + CELL_VDEC_MPEG2_CP_FORBIDDEN = 0x00, + CELL_VDEC_MPEG2_CP_ITU_R_BT_709 = 0x01, + CELL_VDEC_MPEG2_CP_UNSPECIFIED = 0x02, + CELL_VDEC_MPEG2_CP_ITU_R_BT_470_2_SYS_M = 0x04, + CELL_VDEC_MPEG2_CP_ITU_R_BT_470_2_SYS_BG = 0x05, + CELL_VDEC_MPEG2_CP_SMPTE_170_M = 0x06, + CELL_VDEC_MPEG2_CP_SMPTE_240_M = 0x07, }; enum MPEG2_transferCharacteristics : u8 { - CELL_VDEC_MPEG2_TC_FORBIDDEN = 0x00, - CELL_VDEC_MPEG2_TC_ITU_R_BT_709 = 0x01, - CELL_VDEC_MPEG2_TC_UNSPECIFIED = 0x02, - CELL_VDEC_MPEG2_TC_ITU_R_BT_470_2_SYS_M = 0x04, - CELL_VDEC_MPEG2_TC_ITU_R_BT_470_2_SYS_BG = 0x05, - CELL_VDEC_MPEG2_TC_SMPTE_170_M = 0x06, - CELL_VDEC_MPEG2_TC_SMPTE_240_M = 0x07, - CELL_VDEC_MPEG2_TC_LINEAR = 0x08, - CELL_VDEC_MPEG2_TC_LOG_100_1 = 0x09, - CELL_VDEC_MPEG2_TC_LOG_316_1 = 0x0a, + CELL_VDEC_MPEG2_TC_FORBIDDEN = 0x00, + CELL_VDEC_MPEG2_TC_ITU_R_BT_709 = 0x01, + CELL_VDEC_MPEG2_TC_UNSPECIFIED = 0x02, + CELL_VDEC_MPEG2_TC_ITU_R_BT_470_2_SYS_M = 0x04, + CELL_VDEC_MPEG2_TC_ITU_R_BT_470_2_SYS_BG = 0x05, + CELL_VDEC_MPEG2_TC_SMPTE_170_M = 0x06, + CELL_VDEC_MPEG2_TC_SMPTE_240_M = 0x07, + CELL_VDEC_MPEG2_TC_LINEAR = 0x08, + CELL_VDEC_MPEG2_TC_LOG_100_1 = 0x09, + CELL_VDEC_MPEG2_TC_LOG_316_1 = 0x0a, }; enum MPEG2_matrixCoefficients : u8 { - CELL_VDEC_MPEG2_MXC_FORBIDDEN = 0x00, - CELL_VDEC_MPEG2_MXC_ITU_R_BT_709 = 0x01, - CELL_VDEC_MPEG2_MXC_UNSPECIFIED = 0x02, - CELL_VDEC_MPEG2_MXC_FCC = 0x04, - CELL_VDEC_MPEG2_MXC_ITU_R_BT_470_2_SYS_BG = 0x05, - CELL_VDEC_MPEG2_MXC_SMPTE_170_M = 0x06, - CELL_VDEC_MPEG2_MXC_SMPTE_240_M = 0x07, + CELL_VDEC_MPEG2_MXC_FORBIDDEN = 0x00, + CELL_VDEC_MPEG2_MXC_ITU_R_BT_709 = 0x01, + CELL_VDEC_MPEG2_MXC_UNSPECIFIED = 0x02, + CELL_VDEC_MPEG2_MXC_FCC = 0x04, + CELL_VDEC_MPEG2_MXC_ITU_R_BT_470_2_SYS_BG = 0x05, + CELL_VDEC_MPEG2_MXC_SMPTE_170_M = 0x06, + CELL_VDEC_MPEG2_MXC_SMPTE_240_M = 0x07, }; enum MPEG2_pictureCodingType : u8 { - CELL_VDEC_MPEG2_PCT_FORBIDDEN = 0x00, - CELL_VDEC_MPEG2_PCT_I = 0x01, - CELL_VDEC_MPEG2_PCT_P = 0x02, - CELL_VDEC_MPEG2_PCT_B = 0x03, - CELL_VDEC_MPEG2_PCT_D = 0x04, + CELL_VDEC_MPEG2_PCT_FORBIDDEN = 0x00, + CELL_VDEC_MPEG2_PCT_I = 0x01, + CELL_VDEC_MPEG2_PCT_P = 0x02, + CELL_VDEC_MPEG2_PCT_B = 0x03, + CELL_VDEC_MPEG2_PCT_D = 0x04, }; enum MPEG2_pictureStructure : u8 { - CELL_VDEC_MPEG2_PSTR_TOP_FIELD = 0x01, - CELL_VDEC_MPEG2_PSTR_BOTTOM_FIELD = 0x02, - CELL_VDEC_MPEG2_PSTR_FRAME = 0x03, + CELL_VDEC_MPEG2_PSTR_TOP_FIELD = 0x01, + CELL_VDEC_MPEG2_PSTR_BOTTOM_FIELD = 0x02, + CELL_VDEC_MPEG2_PSTR_FRAME = 0x03, }; struct CellVdecMpeg2Info @@ -662,10 +662,10 @@ struct CellVdecMpeg2Info be_t vbv_delay[2]; be_t display_horizontal_size; be_t display_vertical_size; - u8 number_of_frame_centre_offsets[2]; + u8 number_of_frame_centre_offsets[2]; be_t frame_centre_horizontal_offset[2][3]; be_t frame_centre_vertical_offset[2][3]; - be_t headerPresentFlags; // MPEG2_headerFlags + be_t headerPresentFlags; // MPEG2_headerFlags be_t headerRetentionFlags; // MPEG2_headerFlags b8 mpeg1Flag; u8 ccDataLength[2]; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoExport.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoExport.cpp index 8c0ed9377..c0ff00a6e 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoExport.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoExport.cpp @@ -8,54 +8,54 @@ LOG_CHANNEL(cellVideoExport); enum CellVideoExportUtilError : u32 { - CELL_VIDEO_EXPORT_UTIL_ERROR_BUSY = 0x8002ca01, - CELL_VIDEO_EXPORT_UTIL_ERROR_INTERNAL = 0x8002ca02, - CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM = 0x8002ca03, + CELL_VIDEO_EXPORT_UTIL_ERROR_BUSY = 0x8002ca01, + CELL_VIDEO_EXPORT_UTIL_ERROR_INTERNAL = 0x8002ca02, + CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM = 0x8002ca03, CELL_VIDEO_EXPORT_UTIL_ERROR_ACCESS_ERROR = 0x8002ca04, - CELL_VIDEO_EXPORT_UTIL_ERROR_DB_INTERNAL = 0x8002ca05, - CELL_VIDEO_EXPORT_UTIL_ERROR_DB_REGIST = 0x8002ca06, - CELL_VIDEO_EXPORT_UTIL_ERROR_SET_META = 0x8002ca07, - CELL_VIDEO_EXPORT_UTIL_ERROR_FLUSH_META = 0x8002ca08, - CELL_VIDEO_EXPORT_UTIL_ERROR_MOVE = 0x8002ca09, - CELL_VIDEO_EXPORT_UTIL_ERROR_INITIALIZE = 0x8002ca0a, + CELL_VIDEO_EXPORT_UTIL_ERROR_DB_INTERNAL = 0x8002ca05, + CELL_VIDEO_EXPORT_UTIL_ERROR_DB_REGIST = 0x8002ca06, + CELL_VIDEO_EXPORT_UTIL_ERROR_SET_META = 0x8002ca07, + CELL_VIDEO_EXPORT_UTIL_ERROR_FLUSH_META = 0x8002ca08, + CELL_VIDEO_EXPORT_UTIL_ERROR_MOVE = 0x8002ca09, + CELL_VIDEO_EXPORT_UTIL_ERROR_INITIALIZE = 0x8002ca0a, }; enum { - CELL_VIDEO_EXPORT_UTIL_RET_OK = 0, + CELL_VIDEO_EXPORT_UTIL_RET_OK = 0, CELL_VIDEO_EXPORT_UTIL_RET_CANCEL = 1, }; enum { - CELL_VIDEO_EXPORT_UTIL_VERSION_CURRENT = 0, - CELL_VIDEO_EXPORT_UTIL_HDD_PATH_MAX = 1055, + CELL_VIDEO_EXPORT_UTIL_VERSION_CURRENT = 0, + CELL_VIDEO_EXPORT_UTIL_HDD_PATH_MAX = 1055, CELL_VIDEO_EXPORT_UTIL_VIDEO_TITLE_MAX_LENGTH = 64, - CELL_VIDEO_EXPORT_UTIL_GAME_TITLE_MAX_LENGTH = 64, - CELL_VIDEO_EXPORT_UTIL_GAME_COMMENT_MAX_SIZE = 1024, + CELL_VIDEO_EXPORT_UTIL_GAME_TITLE_MAX_LENGTH = 64, + CELL_VIDEO_EXPORT_UTIL_GAME_COMMENT_MAX_SIZE = 1024, }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_BUSY); - STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_INTERNAL); - STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM); - STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_ACCESS_ERROR); - STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_DB_INTERNAL); - STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_DB_REGIST); - STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_SET_META); - STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_FLUSH_META); - STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_MOVE); - STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_INITIALIZE); - } + switch (error) + { + STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_BUSY); + STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_INTERNAL); + STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM); + STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_ACCESS_ERROR); + STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_DB_INTERNAL); + STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_DB_REGIST); + STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_SET_META); + STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_FLUSH_META); + STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_MOVE); + STR_CASE(CELL_VIDEO_EXPORT_UTIL_ERROR_INITIALIZE); + } - return unknown; - }); + return unknown; + }); } struct CellVideoExportSetParam @@ -69,13 +69,11 @@ struct CellVideoExportSetParam using CellVideoExportUtilFinishCallback = void(s32 result, vm::ptr userdata); - struct video_export { atomic_t progress = 0; // 0x0-0xFFFF for 0-100% }; - bool check_movie_path(const std::string& file_path) { if (file_path.size() >= CELL_VIDEO_EXPORT_UTIL_HDD_PATH_MAX) @@ -86,10 +84,10 @@ bool check_movie_path(const std::string& file_path) for (char c : file_path) { if (!((c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9') || - c == '-' || c == '_' || - c == '/' || c == '.')) + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || + c == '-' || c == '_' || + c == '/' || c == '.')) { return false; } @@ -138,7 +136,6 @@ std::string get_available_movie_path(const std::string& filename) return dst_path; } - error_code cellVideoExportInitialize2(u32 version, vm::ptr funcFinish, vm::ptr userdata) { cellVideoExport.notice("cellVideoExportInitialize2(version=0x%x, funcFinish=*0x%x, userdata=*0x%x)", version, funcFinish, userdata); @@ -154,10 +151,10 @@ error_code cellVideoExportInitialize2(u32 version, vm::ptr s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -186,10 +183,10 @@ error_code cellVideoExportInitialize(u32 version, u32 container, vm::ptr s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -204,14 +201,14 @@ error_code cellVideoExportProgress(vm::ptr fu } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - // Set the status as 0x0-0xFFFF (0-100%) depending on the copy status. - // Only the copy or move of the movie and metadata files is considered for the progress. - const auto& vexp = g_fxo->get(); + { + // Set the status as 0x0-0xFFFF (0-100%) depending on the copy status. + // Only the copy or move of the movie and metadata files is considered for the progress. + const auto& vexp = g_fxo->get(); - funcFinish(ppu, vexp.progress, userdata); - return CELL_OK; - }); + funcFinish(ppu, vexp.progress, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -233,7 +230,7 @@ error_code cellVideoExportFromFileWithCopy(vm::cptr srcHddDir, vm::cptr srcHddDir, vm::cptr s32 - { - auto& vexp = g_fxo->get(); - vexp.progress = 0; // 0% - - const std::string src_path = vfs::get(file_path); - const std::string dst_path = get_available_movie_path(filename); - - cellVideoExport.notice("Copying file from '%s' to '%s'", file_path, dst_path); - - if (!fs::create_path(fs::get_parent_dir(dst_path)) || !fs::copy_file(src_path, dst_path, false)) { - // TODO: find out which error is used - cellVideoExport.error("Failed to copy file from '%s' to '%s' (%s)", src_path, dst_path, fs::g_tls_error); - funcFinish(ppu, CELL_VIDEO_EXPORT_UTIL_ERROR_MOVE, userdata); + auto& vexp = g_fxo->get(); + vexp.progress = 0; // 0% + + const std::string src_path = vfs::get(file_path); + const std::string dst_path = get_available_movie_path(filename); + + cellVideoExport.notice("Copying file from '%s' to '%s'", file_path, dst_path); + + if (!fs::create_path(fs::get_parent_dir(dst_path)) || !fs::copy_file(src_path, dst_path, false)) + { + // TODO: find out which error is used + cellVideoExport.error("Failed to copy file from '%s' to '%s' (%s)", src_path, dst_path, fs::g_tls_error); + funcFinish(ppu, CELL_VIDEO_EXPORT_UTIL_ERROR_MOVE, userdata); + return CELL_OK; + } + + // TODO: write metadata file sometime in the far future + // const std::string metadata_file = dst_path + ".vmd"; + + // TODO: track progress during file copy + + vexp.progress = 0xFFFF; // 100% + + funcFinish(ppu, CELL_OK, userdata); return CELL_OK; - } - - // TODO: write metadata file sometime in the far future - // const std::string metadata_file = dst_path + ".vmd"; - - // TODO: track progress during file copy - - vexp.progress = 0xFFFF; // 100% - - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + }); return CELL_OK; } @@ -297,7 +294,7 @@ error_code cellVideoExportFromFile(vm::cptr srcHddDir, vm::cptr srcH if (!check_movie_path(file_path)) { - return { CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM, file_path }; + return {CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM, file_path}; } std::string filename; @@ -309,48 +306,48 @@ error_code cellVideoExportFromFile(vm::cptr srcHddDir, vm::cptr srcH if (filename.empty()) { - return { CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM, "filename empty" }; + return {CELL_VIDEO_EXPORT_UTIL_ERROR_PARAM, "filename empty"}; } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - auto& vexp = g_fxo->get(); - vexp.progress = 0; // 0% - - const std::string src_path = vfs::get(file_path); - const std::string dst_path = get_available_movie_path(filename); - - cellVideoExport.notice("Copying file from '%s' to '%s'", file_path, dst_path); - - if (!fs::create_path(fs::get_parent_dir(dst_path)) || !fs::copy_file(src_path, dst_path, false)) { - // TODO: find out which error is used - cellVideoExport.error("Failed to copy file from '%s' to '%s' (%s)", src_path, dst_path, fs::g_tls_error); - funcFinish(ppu, CELL_VIDEO_EXPORT_UTIL_ERROR_MOVE, userdata); - return CELL_OK; - } + auto& vexp = g_fxo->get(); + vexp.progress = 0; // 0% - if (!file_path.starts_with("/dev_bdvd"sv)) - { - cellVideoExport.notice("Removing file '%s'", src_path); + const std::string src_path = vfs::get(file_path); + const std::string dst_path = get_available_movie_path(filename); - if (!fs::remove_file(src_path)) + cellVideoExport.notice("Copying file from '%s' to '%s'", file_path, dst_path); + + if (!fs::create_path(fs::get_parent_dir(dst_path)) || !fs::copy_file(src_path, dst_path, false)) { - // TODO: find out if an error is used here - cellVideoExport.error("Failed to remove file '%s' (%s)", src_path, fs::g_tls_error); + // TODO: find out which error is used + cellVideoExport.error("Failed to copy file from '%s' to '%s' (%s)", src_path, dst_path, fs::g_tls_error); + funcFinish(ppu, CELL_VIDEO_EXPORT_UTIL_ERROR_MOVE, userdata); + return CELL_OK; } - } - // TODO: write metadata file sometime in the far future - // const std::string metadata_file = dst_path + ".vmd"; + if (!file_path.starts_with("/dev_bdvd"sv)) + { + cellVideoExport.notice("Removing file '%s'", src_path); - // TODO: track progress during file copy + if (!fs::remove_file(src_path)) + { + // TODO: find out if an error is used here + cellVideoExport.error("Failed to remove file '%s' (%s)", src_path, fs::g_tls_error); + } + } - vexp.progress = 0xFFFF; // 100% + // TODO: write metadata file sometime in the far future + // const std::string metadata_file = dst_path + ".vmd"; - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + // TODO: track progress during file copy + + vexp.progress = 0xFFFF; // 100% + + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } @@ -365,21 +362,20 @@ error_code cellVideoExportFinalize(vm::ptr fu } sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - funcFinish(ppu, CELL_OK, userdata); - return CELL_OK; - }); + { + funcFinish(ppu, CELL_OK, userdata); + return CELL_OK; + }); return CELL_OK; } - DECLARE(ppu_module_manager::cellVideoExport)("cellVideoExportUtility", []() -{ - REG_FUNC(cellVideoExportUtility, cellVideoExportProgress); - REG_FUNC(cellVideoExportUtility, cellVideoExportInitialize2); - REG_FUNC(cellVideoExportUtility, cellVideoExportInitialize); - REG_FUNC(cellVideoExportUtility, cellVideoExportFromFileWithCopy); - REG_FUNC(cellVideoExportUtility, cellVideoExportFromFile); - REG_FUNC(cellVideoExportUtility, cellVideoExportFinalize); -}); + { + REG_FUNC(cellVideoExportUtility, cellVideoExportProgress); + REG_FUNC(cellVideoExportUtility, cellVideoExportInitialize2); + REG_FUNC(cellVideoExportUtility, cellVideoExportInitialize); + REG_FUNC(cellVideoExportUtility, cellVideoExportFromFileWithCopy); + REG_FUNC(cellVideoExportUtility, cellVideoExportFromFile); + REG_FUNC(cellVideoExportUtility, cellVideoExportFinalize); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoOut.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoOut.cpp index 001d72588..6912bd8df 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoOut.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoOut.cpp @@ -11,77 +11,73 @@ LOG_CHANNEL(cellSysutil); // NOTE: Unused in this module, but used by gs_frame to determine window size -const extern std::unordered_map, value_hash> g_video_out_resolution_map -{ - { video_resolution::_1080p, { 1920, 1080 } }, - { video_resolution::_1080i, { 1920, 1080 } }, - { video_resolution::_720p, { 1280, 720 } }, - { video_resolution::_480p, { 720, 480 } }, - { video_resolution::_480i, { 720, 480 } }, - { video_resolution::_576p, { 720, 576 } }, - { video_resolution::_576i, { 720, 576 } }, - { video_resolution::_1600x1080p, { 1600, 1080 } }, - { video_resolution::_1440x1080p, { 1440, 1080 } }, - { video_resolution::_1280x1080p, { 1280, 1080 } }, - { video_resolution::_960x1080p, { 960, 1080 } }, +const extern std::unordered_map, value_hash> g_video_out_resolution_map{ + {video_resolution::_1080p, {1920, 1080}}, + {video_resolution::_1080i, {1920, 1080}}, + {video_resolution::_720p, {1280, 720}}, + {video_resolution::_480p, {720, 480}}, + {video_resolution::_480i, {720, 480}}, + {video_resolution::_576p, {720, 576}}, + {video_resolution::_576i, {720, 576}}, + {video_resolution::_1600x1080p, {1600, 1080}}, + {video_resolution::_1440x1080p, {1440, 1080}}, + {video_resolution::_1280x1080p, {1280, 1080}}, + {video_resolution::_960x1080p, {960, 1080}}, }; -const extern std::unordered_map> g_video_out_resolution_id -{ - { video_resolution::_1080p, CELL_VIDEO_OUT_RESOLUTION_1080 }, - { video_resolution::_1080i, CELL_VIDEO_OUT_RESOLUTION_1080 }, - { video_resolution::_720p, CELL_VIDEO_OUT_RESOLUTION_720 }, - { video_resolution::_480p, CELL_VIDEO_OUT_RESOLUTION_480 }, - { video_resolution::_480i, CELL_VIDEO_OUT_RESOLUTION_480 }, - { video_resolution::_576p, CELL_VIDEO_OUT_RESOLUTION_576 }, - { video_resolution::_576i, CELL_VIDEO_OUT_RESOLUTION_576 }, - { video_resolution::_1600x1080p, CELL_VIDEO_OUT_RESOLUTION_1600x1080 }, - { video_resolution::_1440x1080p, CELL_VIDEO_OUT_RESOLUTION_1440x1080 }, - { video_resolution::_1280x1080p, CELL_VIDEO_OUT_RESOLUTION_1280x1080 }, - { video_resolution::_960x1080p, CELL_VIDEO_OUT_RESOLUTION_960x1080 }, +const extern std::unordered_map> g_video_out_resolution_id{ + {video_resolution::_1080p, CELL_VIDEO_OUT_RESOLUTION_1080}, + {video_resolution::_1080i, CELL_VIDEO_OUT_RESOLUTION_1080}, + {video_resolution::_720p, CELL_VIDEO_OUT_RESOLUTION_720}, + {video_resolution::_480p, CELL_VIDEO_OUT_RESOLUTION_480}, + {video_resolution::_480i, CELL_VIDEO_OUT_RESOLUTION_480}, + {video_resolution::_576p, CELL_VIDEO_OUT_RESOLUTION_576}, + {video_resolution::_576i, CELL_VIDEO_OUT_RESOLUTION_576}, + {video_resolution::_1600x1080p, CELL_VIDEO_OUT_RESOLUTION_1600x1080}, + {video_resolution::_1440x1080p, CELL_VIDEO_OUT_RESOLUTION_1440x1080}, + {video_resolution::_1280x1080p, CELL_VIDEO_OUT_RESOLUTION_1280x1080}, + {video_resolution::_960x1080p, CELL_VIDEO_OUT_RESOLUTION_960x1080}, }; -const extern std::unordered_map> g_video_out_scan_mode -{ - { video_resolution::_1080p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE }, - { video_resolution::_1080i, CELL_VIDEO_OUT_SCAN_MODE_INTERLACE }, - { video_resolution::_720p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE }, - { video_resolution::_480p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE }, - { video_resolution::_480i, CELL_VIDEO_OUT_SCAN_MODE_INTERLACE }, - { video_resolution::_576p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE }, - { video_resolution::_576i, CELL_VIDEO_OUT_SCAN_MODE_INTERLACE }, - { video_resolution::_1600x1080p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE }, - { video_resolution::_1440x1080p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE }, - { video_resolution::_1280x1080p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE }, - { video_resolution::_960x1080p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE }, +const extern std::unordered_map> g_video_out_scan_mode{ + {video_resolution::_1080p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE}, + {video_resolution::_1080i, CELL_VIDEO_OUT_SCAN_MODE_INTERLACE}, + {video_resolution::_720p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE}, + {video_resolution::_480p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE}, + {video_resolution::_480i, CELL_VIDEO_OUT_SCAN_MODE_INTERLACE}, + {video_resolution::_576p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE}, + {video_resolution::_576i, CELL_VIDEO_OUT_SCAN_MODE_INTERLACE}, + {video_resolution::_1600x1080p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE}, + {video_resolution::_1440x1080p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE}, + {video_resolution::_1280x1080p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE}, + {video_resolution::_960x1080p, CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE}, }; -const extern std::unordered_map> g_video_out_aspect_id -{ - { video_aspect::_16_9, CELL_VIDEO_OUT_ASPECT_16_9 }, - { video_aspect::_4_3, CELL_VIDEO_OUT_ASPECT_4_3 }, +const extern std::unordered_map> g_video_out_aspect_id{ + {video_aspect::_16_9, CELL_VIDEO_OUT_ASPECT_16_9}, + {video_aspect::_4_3, CELL_VIDEO_OUT_ASPECT_4_3}, }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_VIDEO_OUT_ERROR_NOT_IMPLEMENTED); - STR_CASE(CELL_VIDEO_OUT_ERROR_ILLEGAL_CONFIGURATION); - STR_CASE(CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER); - STR_CASE(CELL_VIDEO_OUT_ERROR_PARAMETER_OUT_OF_RANGE); - STR_CASE(CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND); - STR_CASE(CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT); - STR_CASE(CELL_VIDEO_OUT_ERROR_UNSUPPORTED_DISPLAY_MODE); - STR_CASE(CELL_VIDEO_OUT_ERROR_CONDITION_BUSY); - STR_CASE(CELL_VIDEO_OUT_ERROR_VALUE_IS_NOT_SET); - } + switch (error) + { + STR_CASE(CELL_VIDEO_OUT_ERROR_NOT_IMPLEMENTED); + STR_CASE(CELL_VIDEO_OUT_ERROR_ILLEGAL_CONFIGURATION); + STR_CASE(CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER); + STR_CASE(CELL_VIDEO_OUT_ERROR_PARAMETER_OUT_OF_RANGE); + STR_CASE(CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND); + STR_CASE(CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT); + STR_CASE(CELL_VIDEO_OUT_ERROR_UNSUPPORTED_DISPLAY_MODE); + STR_CASE(CELL_VIDEO_OUT_ERROR_CONDITION_BUSY); + STR_CASE(CELL_VIDEO_OUT_ERROR_VALUE_IS_NOT_SET); + } - return unknown; - }); + return unknown; + }); } error_code cellVideoOutGetNumberOfDevice(u32 videoOut); @@ -91,29 +87,29 @@ error_code _IntGetResolutionInfo(u8 resolution_id, CellVideoOutResolution* resol // NOTE: Some resolution IDs that return values on hw have unknown resolution enumerants switch (resolution_id) { - case CELL_VIDEO_OUT_RESOLUTION_1080: *resolution = { 0x780, 0x438 }; break; - case CELL_VIDEO_OUT_RESOLUTION_720: *resolution = { 0x500, 0x2d0 }; break; - case CELL_VIDEO_OUT_RESOLUTION_480: *resolution = { 0x2d0, 0x1e0 }; break; - case CELL_VIDEO_OUT_RESOLUTION_576: *resolution = { 0x2d0, 0x240 }; break; - case CELL_VIDEO_OUT_RESOLUTION_1600x1080: *resolution = { 0x640, 0x438 }; break; - case CELL_VIDEO_OUT_RESOLUTION_1440x1080: *resolution = { 0x5a0, 0x438 }; break; - case CELL_VIDEO_OUT_RESOLUTION_1280x1080: *resolution = { 0x500, 0x438 }; break; - case CELL_VIDEO_OUT_RESOLUTION_960x1080: *resolution = { 0x3c0, 0x438 }; break; - case 0x64: *resolution = { 0x550, 0x300 }; break; - case CELL_VIDEO_OUT_RESOLUTION_720_3D_FRAME_PACKING: *resolution = { 0x500, 0x5be }; break; - case 0x82: *resolution = { 0x780, 0x438 }; break; - case 0x83: *resolution = { 0x780, 0x89d }; break; - case CELL_VIDEO_OUT_RESOLUTION_640x720_3D_FRAME_PACKING: *resolution = { 0x280, 0x5be }; break; - case CELL_VIDEO_OUT_RESOLUTION_800x720_3D_FRAME_PACKING: *resolution = { 0x320, 0x5be }; break; - case CELL_VIDEO_OUT_RESOLUTION_960x720_3D_FRAME_PACKING: *resolution = { 0x3c0, 0x5be }; break; - case CELL_VIDEO_OUT_RESOLUTION_1024x720_3D_FRAME_PACKING: *resolution = { 0x400, 0x5be }; break; - case CELL_VIDEO_OUT_RESOLUTION_720_DUALVIEW_FRAME_PACKING: *resolution = { 0x500, 0x5be }; break; - case 0x92: *resolution = { 0x780, 0x438 }; break; - case CELL_VIDEO_OUT_RESOLUTION_640x720_DUALVIEW_FRAME_PACKING: *resolution = { 0x280, 0x5be }; break; - case CELL_VIDEO_OUT_RESOLUTION_800x720_DUALVIEW_FRAME_PACKING: *resolution = { 0x320, 0x5be }; break; - case CELL_VIDEO_OUT_RESOLUTION_960x720_DUALVIEW_FRAME_PACKING: *resolution = { 0x3c0, 0x5be }; break; - case CELL_VIDEO_OUT_RESOLUTION_1024x720_DUALVIEW_FRAME_PACKING: *resolution = { 0x400, 0x5be }; break; - case 0xa1: *resolution = { 0x780, 0x438 }; break; + case CELL_VIDEO_OUT_RESOLUTION_1080: *resolution = {0x780, 0x438}; break; + case CELL_VIDEO_OUT_RESOLUTION_720: *resolution = {0x500, 0x2d0}; break; + case CELL_VIDEO_OUT_RESOLUTION_480: *resolution = {0x2d0, 0x1e0}; break; + case CELL_VIDEO_OUT_RESOLUTION_576: *resolution = {0x2d0, 0x240}; break; + case CELL_VIDEO_OUT_RESOLUTION_1600x1080: *resolution = {0x640, 0x438}; break; + case CELL_VIDEO_OUT_RESOLUTION_1440x1080: *resolution = {0x5a0, 0x438}; break; + case CELL_VIDEO_OUT_RESOLUTION_1280x1080: *resolution = {0x500, 0x438}; break; + case CELL_VIDEO_OUT_RESOLUTION_960x1080: *resolution = {0x3c0, 0x438}; break; + case 0x64: *resolution = {0x550, 0x300}; break; + case CELL_VIDEO_OUT_RESOLUTION_720_3D_FRAME_PACKING: *resolution = {0x500, 0x5be}; break; + case 0x82: *resolution = {0x780, 0x438}; break; + case 0x83: *resolution = {0x780, 0x89d}; break; + case CELL_VIDEO_OUT_RESOLUTION_640x720_3D_FRAME_PACKING: *resolution = {0x280, 0x5be}; break; + case CELL_VIDEO_OUT_RESOLUTION_800x720_3D_FRAME_PACKING: *resolution = {0x320, 0x5be}; break; + case CELL_VIDEO_OUT_RESOLUTION_960x720_3D_FRAME_PACKING: *resolution = {0x3c0, 0x5be}; break; + case CELL_VIDEO_OUT_RESOLUTION_1024x720_3D_FRAME_PACKING: *resolution = {0x400, 0x5be}; break; + case CELL_VIDEO_OUT_RESOLUTION_720_DUALVIEW_FRAME_PACKING: *resolution = {0x500, 0x5be}; break; + case 0x92: *resolution = {0x780, 0x438}; break; + case CELL_VIDEO_OUT_RESOLUTION_640x720_DUALVIEW_FRAME_PACKING: *resolution = {0x280, 0x5be}; break; + case CELL_VIDEO_OUT_RESOLUTION_800x720_DUALVIEW_FRAME_PACKING: *resolution = {0x320, 0x5be}; break; + case CELL_VIDEO_OUT_RESOLUTION_960x720_DUALVIEW_FRAME_PACKING: *resolution = {0x3c0, 0x5be}; break; + case CELL_VIDEO_OUT_RESOLUTION_1024x720_DUALVIEW_FRAME_PACKING: *resolution = {0x400, 0x5be}; break; + case 0xa1: *resolution = {0x780, 0x438}; break; default: return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER; } @@ -154,7 +150,7 @@ error_code cellVideoOutGetState(u32 videoOut, u32 deviceIndex, vm::ptr count; }; enum CellVideoOutDisplayConversion : s32 { - CELL_VIDEO_OUT_DISPLAY_CONVERSION_NONE = 0x00, - CELL_VIDEO_OUT_DISPLAY_CONVERSION_TO_WXGA = 0x01, - CELL_VIDEO_OUT_DISPLAY_CONVERSION_TO_SXGA = 0x02, - CELL_VIDEO_OUT_DISPLAY_CONVERSION_TO_WUXGA = 0x03, - CELL_VIDEO_OUT_DISPLAY_CONVERSION_TO_1080 = 0x05, + CELL_VIDEO_OUT_DISPLAY_CONVERSION_NONE = 0x00, + CELL_VIDEO_OUT_DISPLAY_CONVERSION_TO_WXGA = 0x01, + CELL_VIDEO_OUT_DISPLAY_CONVERSION_TO_SXGA = 0x02, + CELL_VIDEO_OUT_DISPLAY_CONVERSION_TO_WUXGA = 0x03, + CELL_VIDEO_OUT_DISPLAY_CONVERSION_TO_1080 = 0x05, CELL_VIDEO_OUT_DISPLAY_CONVERSION_TO_REMOTEPLAY = 0x10, CELL_VIDEO_OUT_DISPLAY_CONVERSION_TO_720_3D_FRAME_PACKING = 0x80, }; @@ -219,23 +219,23 @@ struct CellVideoOutOption enum CellVideoOutEvent : s32 { - CELL_VIDEO_OUT_EVENT_DEVICE_CHANGED = 0, - CELL_VIDEO_OUT_EVENT_OUTPUT_DISABLED = 1, + CELL_VIDEO_OUT_EVENT_DEVICE_CHANGED = 0, + CELL_VIDEO_OUT_EVENT_OUTPUT_DISABLED = 1, CELL_VIDEO_OUT_EVENT_DEVICE_AUTHENTICATED = 2, - CELL_VIDEO_OUT_EVENT_OUTPUT_ENABLED = 3, + CELL_VIDEO_OUT_EVENT_OUTPUT_ENABLED = 3, }; enum CellVideoOutCopyControl : s32 { - CELL_VIDEO_OUT_COPY_CONTROL_COPY_FREE = 0, - CELL_VIDEO_OUT_COPY_CONTROL_COPY_ONCE = 1, + CELL_VIDEO_OUT_COPY_CONTROL_COPY_FREE = 0, + CELL_VIDEO_OUT_COPY_CONTROL_COPY_ONCE = 1, CELL_VIDEO_OUT_COPY_CONTROL_COPY_NEVER = 2, }; enum CellVideoOutRGBOutputRange : s32 { CELL_VIDEO_OUT_RGB_OUTPUT_RANGE_LIMITED = 0, - CELL_VIDEO_OUT_RGB_OUTPUT_RANGE_FULL = 1, + CELL_VIDEO_OUT_RGB_OUTPUT_RANGE_FULL = 1, }; using CellVideoOutCallback = s32(u32 slot, u32 videoOut, u32 deviceIndex, u32 event, vm::ptr info, vm::ptr userData); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoPlayerUtility.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoPlayerUtility.cpp index 62f4a0576..b1a728088 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoPlayerUtility.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoPlayerUtility.cpp @@ -106,22 +106,22 @@ error_code cellVideoPlayerPlaybackControl() } DECLARE(ppu_module_manager::cellVideoPlayerUtility)("cellVideoPlayerUtility", []() -{ - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerInitialize); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerSetStartPosition); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerGetVolume); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerFinalize); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerSetStopPosition); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerClose); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerGetTransferPictureInfo); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerSetDownloadPosition); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerStartThumbnail); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerEndThumbnail); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerOpen); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerSetVolume); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerGetOutputStereoPicture); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerGetPlaybackStatus); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerSetTransferComplete); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerGetOutputPicture); - REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerPlaybackControl); -}); + { + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerInitialize); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerSetStartPosition); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerGetVolume); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerFinalize); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerSetStopPosition); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerClose); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerGetTransferPictureInfo); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerSetDownloadPosition); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerStartThumbnail); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerEndThumbnail); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerOpen); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerSetVolume); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerGetOutputStereoPicture); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerGetPlaybackStatus); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerSetTransferComplete); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerGetOutputPicture); + REG_FUNC(cellVideoPlayerUtility, cellVideoPlayerPlaybackControl); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoUpload.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoUpload.cpp index c7c0166ab..9998a60cf 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoUpload.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoUpload.cpp @@ -6,29 +6,29 @@ LOG_CHANNEL(cellVideoUpload); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_VIDEO_UPLOAD_ERROR_CANCEL); - STR_CASE(CELL_VIDEO_UPLOAD_ERROR_NETWORK); - STR_CASE(CELL_VIDEO_UPLOAD_ERROR_SERVICE_STOP); - STR_CASE(CELL_VIDEO_UPLOAD_ERROR_SERVICE_BUSY); - STR_CASE(CELL_VIDEO_UPLOAD_ERROR_SERVICE_UNAVAILABLE); - STR_CASE(CELL_VIDEO_UPLOAD_ERROR_SERVICE_QUOTA); - STR_CASE(CELL_VIDEO_UPLOAD_ERROR_ACCOUNT_STOP); - STR_CASE(CELL_VIDEO_UPLOAD_ERROR_OUT_OF_MEMORY); - STR_CASE(CELL_VIDEO_UPLOAD_ERROR_FATAL); - STR_CASE(CELL_VIDEO_UPLOAD_ERROR_INVALID_VALUE); - STR_CASE(CELL_VIDEO_UPLOAD_ERROR_FILE_OPEN); - STR_CASE(CELL_VIDEO_UPLOAD_ERROR_INVALID_STATE); - } + switch (error) + { + STR_CASE(CELL_VIDEO_UPLOAD_ERROR_CANCEL); + STR_CASE(CELL_VIDEO_UPLOAD_ERROR_NETWORK); + STR_CASE(CELL_VIDEO_UPLOAD_ERROR_SERVICE_STOP); + STR_CASE(CELL_VIDEO_UPLOAD_ERROR_SERVICE_BUSY); + STR_CASE(CELL_VIDEO_UPLOAD_ERROR_SERVICE_UNAVAILABLE); + STR_CASE(CELL_VIDEO_UPLOAD_ERROR_SERVICE_QUOTA); + STR_CASE(CELL_VIDEO_UPLOAD_ERROR_ACCOUNT_STOP); + STR_CASE(CELL_VIDEO_UPLOAD_ERROR_OUT_OF_MEMORY); + STR_CASE(CELL_VIDEO_UPLOAD_ERROR_FATAL); + STR_CASE(CELL_VIDEO_UPLOAD_ERROR_INVALID_VALUE); + STR_CASE(CELL_VIDEO_UPLOAD_ERROR_FILE_OPEN); + STR_CASE(CELL_VIDEO_UPLOAD_ERROR_INVALID_STATE); + } - return unknown; - }); + return unknown; + }); } error_code cellVideoUploadInitialize(vm::cptr pParam, vm::ptr cb, vm::ptr userdata) @@ -36,19 +36,19 @@ error_code cellVideoUploadInitialize(vm::cptr pParam, vm:: cellVideoUpload.todo("cellVideoUploadInitialize(pParam=*0x%x, cb=*0x%x, userdata=*0x%x)", pParam, cb, userdata); sysutil_register_cb([=](ppu_thread& ppu) -> s32 - { - vm::var pResultURL(128); + { + vm::var pResultURL(128); - cb(ppu, CELL_VIDEO_UPLOAD_STATUS_INITIALIZED, CELL_OK, pResultURL, userdata); - cb(ppu, CELL_VIDEO_UPLOAD_STATUS_FINALIZED, CELL_OK, pResultURL, userdata); + cb(ppu, CELL_VIDEO_UPLOAD_STATUS_INITIALIZED, CELL_OK, pResultURL, userdata); + cb(ppu, CELL_VIDEO_UPLOAD_STATUS_FINALIZED, CELL_OK, pResultURL, userdata); - return CELL_OK; - }); + return CELL_OK; + }); return CELL_OK; } DECLARE(ppu_module_manager::cellVideoUpload)("cellVideoUpload", []() -{ - REG_FUNC(cellVideoUpload, cellVideoUploadInitialize); -}); + { + REG_FUNC(cellVideoUpload, cellVideoUploadInitialize); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoUpload.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoUpload.h index 11efd0c9b..32fe83133 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoUpload.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellVideoUpload.h @@ -35,29 +35,29 @@ using CellVideoUploadCallback = void(s32 status, s32 errorCode, vm::cptr p enum { - CELL_VIDEO_UPLOAD_MAX_FILE_PATH_LEN = 1023, - CELL_VIDEO_UPLOAD_MAX_YOUTUBE_CLIENT_ID_LEN = 64, + CELL_VIDEO_UPLOAD_MAX_FILE_PATH_LEN = 1023, + CELL_VIDEO_UPLOAD_MAX_YOUTUBE_CLIENT_ID_LEN = 64, CELL_VIDEO_UPLOAD_MAX_YOUTUBE_DEVELOPER_KEY_LEN = 128, - CELL_VIDEO_UPLOAD_MAX_YOUTUBE_TITLE_LEN = 61, - CELL_VIDEO_UPLOAD_MAX_YOUTUBE_DESCRIPTION_LEN = 1024, - CELL_VIDEO_UPLOAD_MAX_YOUTUBE_KEYWORD_LEN = 25 + CELL_VIDEO_UPLOAD_MAX_YOUTUBE_TITLE_LEN = 61, + CELL_VIDEO_UPLOAD_MAX_YOUTUBE_DESCRIPTION_LEN = 1024, + CELL_VIDEO_UPLOAD_MAX_YOUTUBE_KEYWORD_LEN = 25 }; // Return Codes enum CellVideoUploadError : u32 { - CELL_VIDEO_UPLOAD_ERROR_CANCEL = 0x8002d000, - CELL_VIDEO_UPLOAD_ERROR_NETWORK = 0x8002d001, - CELL_VIDEO_UPLOAD_ERROR_SERVICE_STOP = 0x8002d002, - CELL_VIDEO_UPLOAD_ERROR_SERVICE_BUSY = 0x8002d003, + CELL_VIDEO_UPLOAD_ERROR_CANCEL = 0x8002d000, + CELL_VIDEO_UPLOAD_ERROR_NETWORK = 0x8002d001, + CELL_VIDEO_UPLOAD_ERROR_SERVICE_STOP = 0x8002d002, + CELL_VIDEO_UPLOAD_ERROR_SERVICE_BUSY = 0x8002d003, CELL_VIDEO_UPLOAD_ERROR_SERVICE_UNAVAILABLE = 0x8002d004, - CELL_VIDEO_UPLOAD_ERROR_SERVICE_QUOTA = 0x8002d005, - CELL_VIDEO_UPLOAD_ERROR_ACCOUNT_STOP = 0x8002d006, - CELL_VIDEO_UPLOAD_ERROR_OUT_OF_MEMORY = 0x8002d020, - CELL_VIDEO_UPLOAD_ERROR_FATAL = 0x8002d021, - CELL_VIDEO_UPLOAD_ERROR_INVALID_VALUE = 0x8002d022, - CELL_VIDEO_UPLOAD_ERROR_FILE_OPEN = 0x8002d023, - CELL_VIDEO_UPLOAD_ERROR_INVALID_STATE = 0x8002d024 + CELL_VIDEO_UPLOAD_ERROR_SERVICE_QUOTA = 0x8002d005, + CELL_VIDEO_UPLOAD_ERROR_ACCOUNT_STOP = 0x8002d006, + CELL_VIDEO_UPLOAD_ERROR_OUT_OF_MEMORY = 0x8002d020, + CELL_VIDEO_UPLOAD_ERROR_FATAL = 0x8002d021, + CELL_VIDEO_UPLOAD_ERROR_INVALID_VALUE = 0x8002d022, + CELL_VIDEO_UPLOAD_ERROR_FILE_OPEN = 0x8002d023, + CELL_VIDEO_UPLOAD_ERROR_INVALID_STATE = 0x8002d024 }; enum diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellVoice.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellVoice.cpp index 7c507a26a..f7642f3e7 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellVoice.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellVoice.cpp @@ -7,35 +7,35 @@ LOG_CHANNEL(cellVoice); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_VOICE_ERROR_ADDRESS_INVALID); - STR_CASE(CELL_VOICE_ERROR_ARGUMENT_INVALID); - STR_CASE(CELL_VOICE_ERROR_CONTAINER_INVALID); - STR_CASE(CELL_VOICE_ERROR_DEVICE_NOT_PRESENT); - STR_CASE(CELL_VOICE_ERROR_EVENT_DISPATCH); - STR_CASE(CELL_VOICE_ERROR_EVENT_QUEUE); - STR_CASE(CELL_VOICE_ERROR_GENERAL); - STR_CASE(CELL_VOICE_ERROR_LIBVOICE_INITIALIZED); - STR_CASE(CELL_VOICE_ERROR_LIBVOICE_NOT_INIT); - STR_CASE(CELL_VOICE_ERROR_NOT_IMPLEMENTED); - STR_CASE(CELL_VOICE_ERROR_PORT_INVALID); - STR_CASE(CELL_VOICE_ERROR_RESOURCE_INSUFFICIENT); - STR_CASE(CELL_VOICE_ERROR_SERVICE_ATTACHED); - STR_CASE(CELL_VOICE_ERROR_SERVICE_DETACHED); - STR_CASE(CELL_VOICE_ERROR_SERVICE_HANDLE); - STR_CASE(CELL_VOICE_ERROR_SERVICE_NOT_FOUND); - STR_CASE(CELL_VOICE_ERROR_SHAREDMEMORY); - STR_CASE(CELL_VOICE_ERROR_TOPOLOGY); - } + switch (error) + { + STR_CASE(CELL_VOICE_ERROR_ADDRESS_INVALID); + STR_CASE(CELL_VOICE_ERROR_ARGUMENT_INVALID); + STR_CASE(CELL_VOICE_ERROR_CONTAINER_INVALID); + STR_CASE(CELL_VOICE_ERROR_DEVICE_NOT_PRESENT); + STR_CASE(CELL_VOICE_ERROR_EVENT_DISPATCH); + STR_CASE(CELL_VOICE_ERROR_EVENT_QUEUE); + STR_CASE(CELL_VOICE_ERROR_GENERAL); + STR_CASE(CELL_VOICE_ERROR_LIBVOICE_INITIALIZED); + STR_CASE(CELL_VOICE_ERROR_LIBVOICE_NOT_INIT); + STR_CASE(CELL_VOICE_ERROR_NOT_IMPLEMENTED); + STR_CASE(CELL_VOICE_ERROR_PORT_INVALID); + STR_CASE(CELL_VOICE_ERROR_RESOURCE_INSUFFICIENT); + STR_CASE(CELL_VOICE_ERROR_SERVICE_ATTACHED); + STR_CASE(CELL_VOICE_ERROR_SERVICE_DETACHED); + STR_CASE(CELL_VOICE_ERROR_SERVICE_HANDLE); + STR_CASE(CELL_VOICE_ERROR_SERVICE_NOT_FOUND); + STR_CASE(CELL_VOICE_ERROR_SHAREDMEMORY); + STR_CASE(CELL_VOICE_ERROR_TOPOLOGY); + } - return unknown; - }); + return unknown; + }); } void voice_manager::reset() @@ -173,7 +173,8 @@ error_code cellVoiceCreatePort(vm::ptr portId, vm::cptr // Id: bits [8,15] seem to contain a "random" value // bits [0,7] are based on creation counter modulo 0xa0 // The rest are set to zero and ignored. - manager.id_ctr++; manager.id_ctr %= 0xa0; + manager.id_ctr++; + manager.id_ctr %= 0xa0; // It isn't known whether bits[8,15] are guaranteed to be non-zero constexpr u32 min_value = 1; @@ -884,40 +885,40 @@ error_code cellVoiceDebugTopology() } DECLARE(ppu_module_manager::cellVoice)("cellVoice", []() -{ - REG_FUNC(cellVoice, cellVoiceConnectIPortToOPort); - REG_FUNC(cellVoice, cellVoiceCreateNotifyEventQueue); - REG_FUNC(cellVoice, cellVoiceCreatePort); - REG_FUNC(cellVoice, cellVoiceDeletePort); - REG_FUNC(cellVoice, cellVoiceDisconnectIPortFromOPort); - REG_FUNC(cellVoice, cellVoiceEnd); - REG_FUNC(cellVoice, cellVoiceGetBitRate); - REG_FUNC(cellVoice, cellVoiceGetMuteFlag); - REG_FUNC(cellVoice, cellVoiceGetPortAttr); - REG_FUNC(cellVoice, cellVoiceGetPortInfo); - REG_FUNC(cellVoice, cellVoiceGetSignalState); - REG_FUNC(cellVoice, cellVoiceGetVolume); - REG_FUNC(cellVoice, cellVoiceInit); - REG_FUNC(cellVoice, cellVoiceInitEx); - REG_FUNC(cellVoice, cellVoicePausePort); - REG_FUNC(cellVoice, cellVoicePausePortAll); - REG_FUNC(cellVoice, cellVoiceRemoveNotifyEventQueue); - REG_FUNC(cellVoice, cellVoiceResetPort); - REG_FUNC(cellVoice, cellVoiceResumePort); - REG_FUNC(cellVoice, cellVoiceResumePortAll); - REG_FUNC(cellVoice, cellVoiceSetBitRate); - REG_FUNC(cellVoice, cellVoiceSetMuteFlag); - REG_FUNC(cellVoice, cellVoiceSetMuteFlagAll); - REG_FUNC(cellVoice, cellVoiceSetNotifyEventQueue); - REG_FUNC(cellVoice, cellVoiceSetPortAttr); - REG_FUNC(cellVoice, cellVoiceSetVolume); - REG_FUNC(cellVoice, cellVoiceStart); - REG_FUNC(cellVoice, cellVoiceStartEx); - REG_FUNC(cellVoice, cellVoiceStop); - REG_FUNC(cellVoice, cellVoiceUpdatePort); - REG_FUNC(cellVoice, cellVoiceWriteToIPort); - REG_FUNC(cellVoice, cellVoiceWriteToIPortEx); - REG_FUNC(cellVoice, cellVoiceWriteToIPortEx2); - REG_FUNC(cellVoice, cellVoiceReadFromOPort); - REG_FUNC(cellVoice, cellVoiceDebugTopology); -}); + { + REG_FUNC(cellVoice, cellVoiceConnectIPortToOPort); + REG_FUNC(cellVoice, cellVoiceCreateNotifyEventQueue); + REG_FUNC(cellVoice, cellVoiceCreatePort); + REG_FUNC(cellVoice, cellVoiceDeletePort); + REG_FUNC(cellVoice, cellVoiceDisconnectIPortFromOPort); + REG_FUNC(cellVoice, cellVoiceEnd); + REG_FUNC(cellVoice, cellVoiceGetBitRate); + REG_FUNC(cellVoice, cellVoiceGetMuteFlag); + REG_FUNC(cellVoice, cellVoiceGetPortAttr); + REG_FUNC(cellVoice, cellVoiceGetPortInfo); + REG_FUNC(cellVoice, cellVoiceGetSignalState); + REG_FUNC(cellVoice, cellVoiceGetVolume); + REG_FUNC(cellVoice, cellVoiceInit); + REG_FUNC(cellVoice, cellVoiceInitEx); + REG_FUNC(cellVoice, cellVoicePausePort); + REG_FUNC(cellVoice, cellVoicePausePortAll); + REG_FUNC(cellVoice, cellVoiceRemoveNotifyEventQueue); + REG_FUNC(cellVoice, cellVoiceResetPort); + REG_FUNC(cellVoice, cellVoiceResumePort); + REG_FUNC(cellVoice, cellVoiceResumePortAll); + REG_FUNC(cellVoice, cellVoiceSetBitRate); + REG_FUNC(cellVoice, cellVoiceSetMuteFlag); + REG_FUNC(cellVoice, cellVoiceSetMuteFlagAll); + REG_FUNC(cellVoice, cellVoiceSetNotifyEventQueue); + REG_FUNC(cellVoice, cellVoiceSetPortAttr); + REG_FUNC(cellVoice, cellVoiceSetVolume); + REG_FUNC(cellVoice, cellVoiceStart); + REG_FUNC(cellVoice, cellVoiceStartEx); + REG_FUNC(cellVoice, cellVoiceStop); + 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/rpcs3/Emu/Cell/Modules/cellVoice.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellVoice.h index 2b269f50c..e565d49b5 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellVoice.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellVoice.h @@ -6,24 +6,24 @@ // Error Codes enum CellVoiceError : u32 { - CELL_VOICE_ERROR_ADDRESS_INVALID = 0x8031080a, - CELL_VOICE_ERROR_ARGUMENT_INVALID = 0x80310805, - CELL_VOICE_ERROR_CONTAINER_INVALID = 0x80310806, - CELL_VOICE_ERROR_DEVICE_NOT_PRESENT = 0x80310812, - CELL_VOICE_ERROR_EVENT_DISPATCH = 0x80310811, - CELL_VOICE_ERROR_EVENT_QUEUE = 0x8031080f, - CELL_VOICE_ERROR_GENERAL = 0x80310803, - CELL_VOICE_ERROR_LIBVOICE_INITIALIZED = 0x80310802, - CELL_VOICE_ERROR_LIBVOICE_NOT_INIT = 0x80310801, - CELL_VOICE_ERROR_NOT_IMPLEMENTED = 0x80310809, - CELL_VOICE_ERROR_PORT_INVALID = 0x80310804, + CELL_VOICE_ERROR_ADDRESS_INVALID = 0x8031080a, + CELL_VOICE_ERROR_ARGUMENT_INVALID = 0x80310805, + CELL_VOICE_ERROR_CONTAINER_INVALID = 0x80310806, + CELL_VOICE_ERROR_DEVICE_NOT_PRESENT = 0x80310812, + CELL_VOICE_ERROR_EVENT_DISPATCH = 0x80310811, + CELL_VOICE_ERROR_EVENT_QUEUE = 0x8031080f, + CELL_VOICE_ERROR_GENERAL = 0x80310803, + CELL_VOICE_ERROR_LIBVOICE_INITIALIZED = 0x80310802, + CELL_VOICE_ERROR_LIBVOICE_NOT_INIT = 0x80310801, + CELL_VOICE_ERROR_NOT_IMPLEMENTED = 0x80310809, + CELL_VOICE_ERROR_PORT_INVALID = 0x80310804, CELL_VOICE_ERROR_RESOURCE_INSUFFICIENT = 0x80310808, - CELL_VOICE_ERROR_SERVICE_ATTACHED = 0x8031080c, - CELL_VOICE_ERROR_SERVICE_DETACHED = 0x8031080b, - CELL_VOICE_ERROR_SERVICE_HANDLE = 0x80310810, - CELL_VOICE_ERROR_SERVICE_NOT_FOUND = 0x8031080d, - CELL_VOICE_ERROR_SHAREDMEMORY = 0x8031080e, - CELL_VOICE_ERROR_TOPOLOGY = 0x80310807, + CELL_VOICE_ERROR_SERVICE_ATTACHED = 0x8031080c, + CELL_VOICE_ERROR_SERVICE_DETACHED = 0x8031080b, + CELL_VOICE_ERROR_SERVICE_HANDLE = 0x80310810, + CELL_VOICE_ERROR_SERVICE_NOT_FOUND = 0x8031080d, + CELL_VOICE_ERROR_SHAREDMEMORY = 0x8031080e, + CELL_VOICE_ERROR_TOPOLOGY = 0x80310807, }; enum CellVoiceAppType : u32 @@ -33,11 +33,11 @@ enum CellVoiceAppType : u32 enum CellVoiceBitRate : u32 { - CELLVOICE_BITRATE_NULL = ~0u, - CELLVOICE_BITRATE_3850 = 3850, - CELLVOICE_BITRATE_4650 = 4650, - CELLVOICE_BITRATE_5700 = 5700, - CELLVOICE_BITRATE_7300 = 7300, + CELLVOICE_BITRATE_NULL = ~0u, + CELLVOICE_BITRATE_3850 = 3850, + CELLVOICE_BITRATE_4650 = 4650, + CELLVOICE_BITRATE_5700 = 5700, + CELLVOICE_BITRATE_7300 = 7300, CELLVOICE_BITRATE_14400 = 14400, CELLVOICE_BITRATE_16000 = 16000, CELLVOICE_BITRATE_22533 = 22533, @@ -45,59 +45,59 @@ enum CellVoiceBitRate : u32 enum CellVoiceEventType : u32 { - CELLVOICE_EVENT_DATA_ERROR = 1 << 0, - CELLVOICE_EVENT_PORT_ATTACHED = 1 << 1, - CELLVOICE_EVENT_PORT_DETACHED = 1 << 2, - CELLVOICE_EVENT_SERVICE_ATTACHED = 1 << 3, - CELLVOICE_EVENT_SERVICE_DETACHED = 1 << 4, + CELLVOICE_EVENT_DATA_ERROR = 1 << 0, + CELLVOICE_EVENT_PORT_ATTACHED = 1 << 1, + CELLVOICE_EVENT_PORT_DETACHED = 1 << 2, + CELLVOICE_EVENT_SERVICE_ATTACHED = 1 << 3, + CELLVOICE_EVENT_SERVICE_DETACHED = 1 << 4, CELLVOICE_EVENT_PORT_WEAK_ATTACHED = 1 << 5, CELLVOICE_EVENT_PORT_WEAK_DETACHED = 1 << 6, }; enum CellVoicePcmDataType : u32 { - CELLVOICE_PCM_NULL = ~0u, - CELLVOICE_PCM_FLOAT = 0, - CELLVOICE_PCM_FLOAT_LITTLE_ENDIAN = 1, - CELLVOICE_PCM_SHORT = 2, - CELLVOICE_PCM_SHORT_LITTLE_ENDIAN = 3, - CELLVOICE_PCM_INTEGER = 4, + CELLVOICE_PCM_NULL = ~0u, + CELLVOICE_PCM_FLOAT = 0, + CELLVOICE_PCM_FLOAT_LITTLE_ENDIAN = 1, + CELLVOICE_PCM_SHORT = 2, + CELLVOICE_PCM_SHORT_LITTLE_ENDIAN = 3, + CELLVOICE_PCM_INTEGER = 4, CELLVOICE_PCM_INTEGER_LITTLE_ENDIAN = 5, }; enum CellVoicePortAttr : u32 { - CELLVOICE_ATTR_ENERGY_LEVEL = 1000, - CELLVOICE_ATTR_VAD = 1001, - CELLVOICE_ATTR_DTX = 1002, - CELLVOICE_ATTR_AUTO_RESAMPLE = 1003, - CELLVOICE_ATTR_LATENCY = 1004, + CELLVOICE_ATTR_ENERGY_LEVEL = 1000, + CELLVOICE_ATTR_VAD = 1001, + CELLVOICE_ATTR_DTX = 1002, + CELLVOICE_ATTR_AUTO_RESAMPLE = 1003, + CELLVOICE_ATTR_LATENCY = 1004, CELLVOICE_ATTR_SILENCE_THRESHOLD = 1005, }; enum CellVoicePortState : u32 { - CELLVOICE_PORTSTATE_NULL = ~0u, - CELLVOICE_PORTSTATE_IDLE = 0, - CELLVOICE_PORTSTATE_READY = 1, + CELLVOICE_PORTSTATE_NULL = ~0u, + CELLVOICE_PORTSTATE_IDLE = 0, + CELLVOICE_PORTSTATE_READY = 1, CELLVOICE_PORTSTATE_BUFFERING = 2, - CELLVOICE_PORTSTATE_RUNNING = 3, + CELLVOICE_PORTSTATE_RUNNING = 3, }; enum CellVoicePortType : u32 { - CELLVOICE_PORTTYPE_NULL = ~0u, - CELLVOICE_PORTTYPE_IN_MIC = 0, - CELLVOICE_PORTTYPE_IN_PCMAUDIO = 1, - CELLVOICE_PORTTYPE_IN_VOICE = 2, - CELLVOICE_PORTTYPE_OUT_PCMAUDIO = 3, - CELLVOICE_PORTTYPE_OUT_VOICE = 4, + CELLVOICE_PORTTYPE_NULL = ~0u, + CELLVOICE_PORTTYPE_IN_MIC = 0, + CELLVOICE_PORTTYPE_IN_PCMAUDIO = 1, + CELLVOICE_PORTTYPE_IN_VOICE = 2, + CELLVOICE_PORTTYPE_OUT_PCMAUDIO = 3, + CELLVOICE_PORTTYPE_OUT_VOICE = 4, CELLVOICE_PORTTYPE_OUT_SECONDARY = 5, }; enum CellVoiceSamplingRate : u32 { - CELLVOICE_SAMPLINGRATE_NULL = ~0u, + CELLVOICE_SAMPLINGRATE_NULL = ~0u, CELLVOICE_SAMPLINGRATE_16000 = 16000, }; @@ -109,12 +109,12 @@ enum CellVoiceVersionCheck : u32 // Definitions enum { - CELLVOICE_MAX_IN_VOICE_PORT = 32, - CELLVOICE_MAX_OUT_VOICE_PORT = 4, - CELLVOICE_GAME_1MB_MAX_IN_VOICE_PORT = 8, + CELLVOICE_MAX_IN_VOICE_PORT = 32, + CELLVOICE_MAX_OUT_VOICE_PORT = 4, + CELLVOICE_GAME_1MB_MAX_IN_VOICE_PORT = 8, CELLVOICE_GAME_1MB_MAX_OUT_VOICE_PORT = 2, - CELLVOICE_MAX_PORT = 128, - CELLVOICE_INVALID_PORT_ID = 0xff, + CELLVOICE_MAX_PORT = 128, + CELLVOICE_INVALID_PORT_ID = 0xff, }; struct CellVoiceBasePortInfo // aligned(64) @@ -208,11 +208,14 @@ struct voice_manager void reset(); shared_mutex mtx; - atomic_t is_init{ false }; + atomic_t is_init{false}; SAVESTATE_INIT_POS(17); voice_manager() = default; - voice_manager(utils::serial& ar) { save(ar); } + voice_manager(utils::serial& ar) + { + save(ar); + } void save(utils::serial& ar); }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellVpost.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellVpost.cpp index 773bb9678..06dee841b 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellVpost.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellVpost.cpp @@ -24,149 +24,149 @@ extern "C" LOG_CHANNEL(cellVpost); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_VPOST_ERROR_Q_ARG_CFG_NULL); - STR_CASE(CELL_VPOST_ERROR_Q_ARG_CFG_INVALID); - STR_CASE(CELL_VPOST_ERROR_Q_ARG_ATTR_NULL); - STR_CASE(CELL_VPOST_ERROR_O_ARG_CFG_NULL); - STR_CASE(CELL_VPOST_ERROR_O_ARG_CFG_INVALID); - STR_CASE(CELL_VPOST_ERROR_O_ARG_RSRC_NULL); - STR_CASE(CELL_VPOST_ERROR_O_ARG_RSRC_INVALID); - STR_CASE(CELL_VPOST_ERROR_O_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_ERROR_O_FATAL_QUERY_FAIL); - STR_CASE(CELL_VPOST_ERROR_O_FATAL_CREATEMON_FAIL); - STR_CASE(CELL_VPOST_ERROR_O_FATAL_INITSPURS_FAIL); - STR_CASE(CELL_VPOST_ERROR_C_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_ERROR_C_ARG_HDL_INVALID); - STR_CASE(CELL_VPOST_ERROR_C_FATAL_LOCKMON_FAIL); - STR_CASE(CELL_VPOST_ERROR_C_FATAL_UNLOCKMON_FAIL); - STR_CASE(CELL_VPOST_ERROR_C_FATAL_DESTROYMON_FAIL); - STR_CASE(CELL_VPOST_ERROR_C_FATAL_FINSPURS_FAIL); - STR_CASE(CELL_VPOST_ERROR_E_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_ERROR_E_ARG_HDL_INVALID); - STR_CASE(CELL_VPOST_ERROR_E_ARG_INPICBUF_NULL); - STR_CASE(CELL_VPOST_ERROR_E_ARG_INPICBUF_INVALID); - STR_CASE(CELL_VPOST_ERROR_E_ARG_CTRL_NULL); - STR_CASE(CELL_VPOST_ERROR_E_ARG_CTRL_INVALID); - STR_CASE(CELL_VPOST_ERROR_E_ARG_OUTPICBUF_NULL); - STR_CASE(CELL_VPOST_ERROR_E_ARG_OUTPICBUF_INVALID); - STR_CASE(CELL_VPOST_ERROR_E_ARG_PICINFO_NULL); - STR_CASE(CELL_VPOST_ERROR_E_FATAL_LOCKMON_FAIL); - STR_CASE(CELL_VPOST_ERROR_E_FATAL_UNLOCKMON_FAIL); - STR_CASE(CELL_VPOST_ENT_ERROR_Q_ARG_ATTR_NULL); - STR_CASE(CELL_VPOST_ENT_ERROR_O_ARG_RSRC_NULL); - STR_CASE(CELL_VPOST_ENT_ERROR_O_ARG_RSRC_INVALID); - STR_CASE(CELL_VPOST_ENT_ERROR_O_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_ENT_ERROR_O_FATAL_QUERY_FAIL); - STR_CASE(CELL_VPOST_ENT_ERROR_O_FATAL_CSPUCORE_FAIL); - STR_CASE(CELL_VPOST_ENT_ERROR_C_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_ENT_ERROR_C_ARG_HDL_INVALID); - STR_CASE(CELL_VPOST_ENT_ERROR_C_FATAL_SNDCMD_FAIL); - STR_CASE(CELL_VPOST_ENT_ERROR_C_FATAL_RCVRES_FAIL); - STR_CASE(CELL_VPOST_ENT_ERROR_C_FATAL_DSPUCORE_FAIL); - STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_HDL_INVALID); - STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_INPICBUF_NULL); - STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_INPICBUF_INVALID); - STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_INPICINFO_NULL); - STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_INPICINFO_INVALID); - STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_CTRL_NULL); - STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_CTRL_INVALID); - STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_COMB_INVALID); - STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_OUTPICBUF_NULL); - STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_OUTPICBUF_INVALID); - STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_OUTPICINFO_NULL); - STR_CASE(CELL_VPOST_ENT_ERROR_E_FATAL_SNDCMD_FAIL); - STR_CASE(CELL_VPOST_ENT_ERROR_E_FATAL_RCVRES_FAIL); - STR_CASE(CELL_VPOST_ENT_ERROR_E_FATAL_SPUCORE_FAIL); - STR_CASE(CELL_VPOST_IPC_ERROR_Q_ARG_ATTR_NULL); - STR_CASE(CELL_VPOST_IPC_ERROR_O_ARG_RSRC_NULL); - STR_CASE(CELL_VPOST_IPC_ERROR_O_ARG_RSRC_INVALID); - STR_CASE(CELL_VPOST_IPC_ERROR_O_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_IPC_ERROR_O_FATAL_QUERY_FAIL); - STR_CASE(CELL_VPOST_IPC_ERROR_O_FATAL_CSPUCORE_FAIL); - STR_CASE(CELL_VPOST_IPC_ERROR_C_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_IPC_ERROR_C_ARG_HDL_INVALID); - STR_CASE(CELL_VPOST_IPC_ERROR_C_FATAL_SNDCMD_FAIL); - STR_CASE(CELL_VPOST_IPC_ERROR_C_FATAL_RCVRES_FAIL); - STR_CASE(CELL_VPOST_IPC_ERROR_C_FATAL_DSPUCORE_FAIL); - STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_HDL_INVALID); - STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_INPICBUF_NULL); - STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_INPICBUF_INVALID); - STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_INPICINFO_NULL); - STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_INPICINFO_INVALID); - STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_CTRL_NULL); - STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_CTRL_INVALID); - STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_COMB_INVALID); - STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_OUTPICBUF_NULL); - STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_OUTPICBUF_INVALID); - STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_OUTPICINFO_NULL); - STR_CASE(CELL_VPOST_IPC_ERROR_E_FATAL_SNDCMD_FAIL); - STR_CASE(CELL_VPOST_IPC_ERROR_E_FATAL_RCVRES_FAIL); - STR_CASE(CELL_VPOST_IPC_ERROR_E_FATAL_SPUCORE_FAIL); - STR_CASE(CELL_VPOST_VSC_ERROR_Q_ARG_ATTR_NULL); - STR_CASE(CELL_VPOST_VSC_ERROR_O_ARG_RSRC_NULL); - STR_CASE(CELL_VPOST_VSC_ERROR_O_ARG_RSRC_INVALID); - STR_CASE(CELL_VPOST_VSC_ERROR_O_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_VSC_ERROR_O_FATAL_QUERY_FAIL); - STR_CASE(CELL_VPOST_VSC_ERROR_O_FATAL_CSPUCORE_FAIL); - STR_CASE(CELL_VPOST_VSC_ERROR_C_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_VSC_ERROR_C_ARG_HDL_INVALID); - STR_CASE(CELL_VPOST_VSC_ERROR_C_FATAL_SNDCMD_FAIL); - STR_CASE(CELL_VPOST_VSC_ERROR_C_FATAL_RCVRES_FAIL); - STR_CASE(CELL_VPOST_VSC_ERROR_C_FATAL_DSPUCORE_FAIL); - STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_HDL_INVALID); - STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_INPICBUF_NULL); - STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_INPICBUF_INVALID); - STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_INPICINFO_NULL); - STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_INPICINFO_INVALID); - STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_CTRL_NULL); - STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_CTRL_INVALID); - STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_COMB_INVALID); - STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_OUTPICBUF_NULL); - STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_OUTPICBUF_INVALID); - STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_OUTPICINFO_NULL); - STR_CASE(CELL_VPOST_VSC_ERROR_E_FATAL_SNDCMD_FAIL); - STR_CASE(CELL_VPOST_VSC_ERROR_E_FATAL_RCVRES_FAIL); - STR_CASE(CELL_VPOST_VSC_ERROR_E_FATAL_SPUCORE_FAIL); - STR_CASE(CELL_VPOST_CSC_ERROR_Q_ARG_ATTR_NULL); - STR_CASE(CELL_VPOST_CSC_ERROR_O_ARG_RSRC_NULL); - STR_CASE(CELL_VPOST_CSC_ERROR_O_ARG_RSRC_INVALID); - STR_CASE(CELL_VPOST_CSC_ERROR_O_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_CSC_ERROR_O_FATAL_QUERY_FAIL); - STR_CASE(CELL_VPOST_CSC_ERROR_O_FATAL_CSPUCORE_FAIL); - STR_CASE(CELL_VPOST_CSC_ERROR_C_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_CSC_ERROR_C_ARG_HDL_INVALID); - STR_CASE(CELL_VPOST_CSC_ERROR_C_FATAL_SNDCMD_FAIL); - STR_CASE(CELL_VPOST_CSC_ERROR_C_FATAL_RCVRES_FAIL); - STR_CASE(CELL_VPOST_CSC_ERROR_C_FATAL_DSPUCORE_FAIL); - STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_HDL_NULL); - STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_HDL_INVALID); - STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_INPICBUF_NULL); - STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_INPICBUF_INVALID); - STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_INPICINFO_NULL); - STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_INPICINFO_INVALID); - STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_CTRL_NULL); - STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_CTRL_INVALID); - STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_COMB_INVALID); - STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_OUTPICBUF_NULL); - STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_OUTPICBUF_INVALID); - STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_OUTPICINFO_NULL); - STR_CASE(CELL_VPOST_CSC_ERROR_E_FATAL_SNDCMD_FAIL); - STR_CASE(CELL_VPOST_CSC_ERROR_E_FATAL_RCVRES_FAIL); - STR_CASE(CELL_VPOST_CSC_ERROR_E_FATAL_SPUCORE_FAIL); - } + switch (error) + { + STR_CASE(CELL_VPOST_ERROR_Q_ARG_CFG_NULL); + STR_CASE(CELL_VPOST_ERROR_Q_ARG_CFG_INVALID); + STR_CASE(CELL_VPOST_ERROR_Q_ARG_ATTR_NULL); + STR_CASE(CELL_VPOST_ERROR_O_ARG_CFG_NULL); + STR_CASE(CELL_VPOST_ERROR_O_ARG_CFG_INVALID); + STR_CASE(CELL_VPOST_ERROR_O_ARG_RSRC_NULL); + STR_CASE(CELL_VPOST_ERROR_O_ARG_RSRC_INVALID); + STR_CASE(CELL_VPOST_ERROR_O_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_ERROR_O_FATAL_QUERY_FAIL); + STR_CASE(CELL_VPOST_ERROR_O_FATAL_CREATEMON_FAIL); + STR_CASE(CELL_VPOST_ERROR_O_FATAL_INITSPURS_FAIL); + STR_CASE(CELL_VPOST_ERROR_C_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_ERROR_C_ARG_HDL_INVALID); + STR_CASE(CELL_VPOST_ERROR_C_FATAL_LOCKMON_FAIL); + STR_CASE(CELL_VPOST_ERROR_C_FATAL_UNLOCKMON_FAIL); + STR_CASE(CELL_VPOST_ERROR_C_FATAL_DESTROYMON_FAIL); + STR_CASE(CELL_VPOST_ERROR_C_FATAL_FINSPURS_FAIL); + STR_CASE(CELL_VPOST_ERROR_E_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_ERROR_E_ARG_HDL_INVALID); + STR_CASE(CELL_VPOST_ERROR_E_ARG_INPICBUF_NULL); + STR_CASE(CELL_VPOST_ERROR_E_ARG_INPICBUF_INVALID); + STR_CASE(CELL_VPOST_ERROR_E_ARG_CTRL_NULL); + STR_CASE(CELL_VPOST_ERROR_E_ARG_CTRL_INVALID); + STR_CASE(CELL_VPOST_ERROR_E_ARG_OUTPICBUF_NULL); + STR_CASE(CELL_VPOST_ERROR_E_ARG_OUTPICBUF_INVALID); + STR_CASE(CELL_VPOST_ERROR_E_ARG_PICINFO_NULL); + STR_CASE(CELL_VPOST_ERROR_E_FATAL_LOCKMON_FAIL); + STR_CASE(CELL_VPOST_ERROR_E_FATAL_UNLOCKMON_FAIL); + STR_CASE(CELL_VPOST_ENT_ERROR_Q_ARG_ATTR_NULL); + STR_CASE(CELL_VPOST_ENT_ERROR_O_ARG_RSRC_NULL); + STR_CASE(CELL_VPOST_ENT_ERROR_O_ARG_RSRC_INVALID); + STR_CASE(CELL_VPOST_ENT_ERROR_O_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_ENT_ERROR_O_FATAL_QUERY_FAIL); + STR_CASE(CELL_VPOST_ENT_ERROR_O_FATAL_CSPUCORE_FAIL); + STR_CASE(CELL_VPOST_ENT_ERROR_C_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_ENT_ERROR_C_ARG_HDL_INVALID); + STR_CASE(CELL_VPOST_ENT_ERROR_C_FATAL_SNDCMD_FAIL); + STR_CASE(CELL_VPOST_ENT_ERROR_C_FATAL_RCVRES_FAIL); + STR_CASE(CELL_VPOST_ENT_ERROR_C_FATAL_DSPUCORE_FAIL); + STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_HDL_INVALID); + STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_INPICBUF_NULL); + STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_INPICBUF_INVALID); + STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_INPICINFO_NULL); + STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_INPICINFO_INVALID); + STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_CTRL_NULL); + STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_CTRL_INVALID); + STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_COMB_INVALID); + STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_OUTPICBUF_NULL); + STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_OUTPICBUF_INVALID); + STR_CASE(CELL_VPOST_ENT_ERROR_E_ARG_OUTPICINFO_NULL); + STR_CASE(CELL_VPOST_ENT_ERROR_E_FATAL_SNDCMD_FAIL); + STR_CASE(CELL_VPOST_ENT_ERROR_E_FATAL_RCVRES_FAIL); + STR_CASE(CELL_VPOST_ENT_ERROR_E_FATAL_SPUCORE_FAIL); + STR_CASE(CELL_VPOST_IPC_ERROR_Q_ARG_ATTR_NULL); + STR_CASE(CELL_VPOST_IPC_ERROR_O_ARG_RSRC_NULL); + STR_CASE(CELL_VPOST_IPC_ERROR_O_ARG_RSRC_INVALID); + STR_CASE(CELL_VPOST_IPC_ERROR_O_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_IPC_ERROR_O_FATAL_QUERY_FAIL); + STR_CASE(CELL_VPOST_IPC_ERROR_O_FATAL_CSPUCORE_FAIL); + STR_CASE(CELL_VPOST_IPC_ERROR_C_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_IPC_ERROR_C_ARG_HDL_INVALID); + STR_CASE(CELL_VPOST_IPC_ERROR_C_FATAL_SNDCMD_FAIL); + STR_CASE(CELL_VPOST_IPC_ERROR_C_FATAL_RCVRES_FAIL); + STR_CASE(CELL_VPOST_IPC_ERROR_C_FATAL_DSPUCORE_FAIL); + STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_HDL_INVALID); + STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_INPICBUF_NULL); + STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_INPICBUF_INVALID); + STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_INPICINFO_NULL); + STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_INPICINFO_INVALID); + STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_CTRL_NULL); + STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_CTRL_INVALID); + STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_COMB_INVALID); + STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_OUTPICBUF_NULL); + STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_OUTPICBUF_INVALID); + STR_CASE(CELL_VPOST_IPC_ERROR_E_ARG_OUTPICINFO_NULL); + STR_CASE(CELL_VPOST_IPC_ERROR_E_FATAL_SNDCMD_FAIL); + STR_CASE(CELL_VPOST_IPC_ERROR_E_FATAL_RCVRES_FAIL); + STR_CASE(CELL_VPOST_IPC_ERROR_E_FATAL_SPUCORE_FAIL); + STR_CASE(CELL_VPOST_VSC_ERROR_Q_ARG_ATTR_NULL); + STR_CASE(CELL_VPOST_VSC_ERROR_O_ARG_RSRC_NULL); + STR_CASE(CELL_VPOST_VSC_ERROR_O_ARG_RSRC_INVALID); + STR_CASE(CELL_VPOST_VSC_ERROR_O_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_VSC_ERROR_O_FATAL_QUERY_FAIL); + STR_CASE(CELL_VPOST_VSC_ERROR_O_FATAL_CSPUCORE_FAIL); + STR_CASE(CELL_VPOST_VSC_ERROR_C_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_VSC_ERROR_C_ARG_HDL_INVALID); + STR_CASE(CELL_VPOST_VSC_ERROR_C_FATAL_SNDCMD_FAIL); + STR_CASE(CELL_VPOST_VSC_ERROR_C_FATAL_RCVRES_FAIL); + STR_CASE(CELL_VPOST_VSC_ERROR_C_FATAL_DSPUCORE_FAIL); + STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_HDL_INVALID); + STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_INPICBUF_NULL); + STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_INPICBUF_INVALID); + STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_INPICINFO_NULL); + STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_INPICINFO_INVALID); + STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_CTRL_NULL); + STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_CTRL_INVALID); + STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_COMB_INVALID); + STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_OUTPICBUF_NULL); + STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_OUTPICBUF_INVALID); + STR_CASE(CELL_VPOST_VSC_ERROR_E_ARG_OUTPICINFO_NULL); + STR_CASE(CELL_VPOST_VSC_ERROR_E_FATAL_SNDCMD_FAIL); + STR_CASE(CELL_VPOST_VSC_ERROR_E_FATAL_RCVRES_FAIL); + STR_CASE(CELL_VPOST_VSC_ERROR_E_FATAL_SPUCORE_FAIL); + STR_CASE(CELL_VPOST_CSC_ERROR_Q_ARG_ATTR_NULL); + STR_CASE(CELL_VPOST_CSC_ERROR_O_ARG_RSRC_NULL); + STR_CASE(CELL_VPOST_CSC_ERROR_O_ARG_RSRC_INVALID); + STR_CASE(CELL_VPOST_CSC_ERROR_O_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_CSC_ERROR_O_FATAL_QUERY_FAIL); + STR_CASE(CELL_VPOST_CSC_ERROR_O_FATAL_CSPUCORE_FAIL); + STR_CASE(CELL_VPOST_CSC_ERROR_C_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_CSC_ERROR_C_ARG_HDL_INVALID); + STR_CASE(CELL_VPOST_CSC_ERROR_C_FATAL_SNDCMD_FAIL); + STR_CASE(CELL_VPOST_CSC_ERROR_C_FATAL_RCVRES_FAIL); + STR_CASE(CELL_VPOST_CSC_ERROR_C_FATAL_DSPUCORE_FAIL); + STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_HDL_NULL); + STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_HDL_INVALID); + STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_INPICBUF_NULL); + STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_INPICBUF_INVALID); + STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_INPICINFO_NULL); + STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_INPICINFO_INVALID); + STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_CTRL_NULL); + STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_CTRL_INVALID); + STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_COMB_INVALID); + STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_OUTPICBUF_NULL); + STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_OUTPICBUF_INVALID); + STR_CASE(CELL_VPOST_CSC_ERROR_E_ARG_OUTPICINFO_NULL); + STR_CASE(CELL_VPOST_CSC_ERROR_E_FATAL_SNDCMD_FAIL); + STR_CASE(CELL_VPOST_CSC_ERROR_E_FATAL_RCVRES_FAIL); + STR_CASE(CELL_VPOST_CSC_ERROR_E_FATAL_SPUCORE_FAIL); + } - return unknown; - }); + return unknown; + }); } error_code cellVpostQueryAttr(vm::cptr cfgParam, vm::ptr attr) @@ -177,7 +177,7 @@ error_code cellVpostQueryAttr(vm::cptr cfgParam, vm::ptrdelay = 0; attr->memSize = 4 * 1024 * 1024; // 4 MB - attr->vpostVerLower = 0x280000; // from dmux + attr->vpostVerLower = 0x280000; // from dmux attr->vpostVerUpper = 0x260000; return CELL_OK; @@ -232,74 +232,82 @@ error_code cellVpostExec(u32 handle, vm::cptr inPicBuff, vm::cptroutWidth; u32 oh = ctrlParam->outHeight; - //ctrlParam->inWindow; // ignored - if (ctrlParam->inWindow.x) cellVpost.notice("*** inWindow.x = %d", ctrlParam->inWindow.x); - if (ctrlParam->inWindow.y) cellVpost.notice("*** inWindow.y = %d", ctrlParam->inWindow.y); - if (ctrlParam->inWindow.width != w) cellVpost.notice("*** inWindow.width = %d", ctrlParam->inWindow.width); - if (ctrlParam->inWindow.height != h) cellVpost.notice("*** inWindow.height = %d", ctrlParam->inWindow.height); - //ctrlParam->outWindow; // ignored - if (ctrlParam->outWindow.x) cellVpost.notice("*** outWindow.x = %d", ctrlParam->outWindow.x); - if (ctrlParam->outWindow.y) cellVpost.notice("*** outWindow.y = %d", ctrlParam->outWindow.y); - if (ctrlParam->outWindow.width != ow) cellVpost.notice("*** outWindow.width = %d", ctrlParam->outWindow.width); - if (ctrlParam->outWindow.height != oh) cellVpost.notice("*** outWindow.height = %d", ctrlParam->outWindow.height); - //ctrlParam->execType; // ignored - //ctrlParam->scalerType; // ignored - //ctrlParam->ipcType; // ignored + // ctrlParam->inWindow; // ignored + if (ctrlParam->inWindow.x) + cellVpost.notice("*** inWindow.x = %d", ctrlParam->inWindow.x); + if (ctrlParam->inWindow.y) + cellVpost.notice("*** inWindow.y = %d", ctrlParam->inWindow.y); + if (ctrlParam->inWindow.width != w) + cellVpost.notice("*** inWindow.width = %d", ctrlParam->inWindow.width); + if (ctrlParam->inWindow.height != h) + cellVpost.notice("*** inWindow.height = %d", ctrlParam->inWindow.height); + // ctrlParam->outWindow; // ignored + if (ctrlParam->outWindow.x) + cellVpost.notice("*** outWindow.x = %d", ctrlParam->outWindow.x); + if (ctrlParam->outWindow.y) + cellVpost.notice("*** outWindow.y = %d", ctrlParam->outWindow.y); + if (ctrlParam->outWindow.width != ow) + cellVpost.notice("*** outWindow.width = %d", ctrlParam->outWindow.width); + if (ctrlParam->outWindow.height != oh) + cellVpost.notice("*** outWindow.height = %d", ctrlParam->outWindow.height); + // ctrlParam->execType; // ignored + // ctrlParam->scalerType; // ignored + // ctrlParam->ipcType; // ignored - picInfo->inWidth = w; // copy - picInfo->inHeight = h; // copy - picInfo->inDepth = CELL_VPOST_PIC_DEPTH_8; // fixed - picInfo->inScanType = CELL_VPOST_SCAN_TYPE_P; // TODO + picInfo->inWidth = w; // copy + picInfo->inHeight = h; // copy + picInfo->inDepth = CELL_VPOST_PIC_DEPTH_8; // fixed + picInfo->inScanType = CELL_VPOST_SCAN_TYPE_P; // TODO picInfo->inPicFmt = CELL_VPOST_PIC_FMT_IN_YUV420_PLANAR; // fixed - picInfo->inChromaPosType = ctrlParam->inChromaPosType; // copy - picInfo->inPicStruct = CELL_VPOST_PIC_STRUCT_PFRM; // TODO - picInfo->inQuantRange = ctrlParam->inQuantRange; // copy - picInfo->inColorMatrix = ctrlParam->inColorMatrix; // copy + picInfo->inChromaPosType = ctrlParam->inChromaPosType; // copy + picInfo->inPicStruct = CELL_VPOST_PIC_STRUCT_PFRM; // TODO + picInfo->inQuantRange = ctrlParam->inQuantRange; // copy + picInfo->inColorMatrix = ctrlParam->inColorMatrix; // copy - picInfo->outWidth = ow; // copy - picInfo->outHeight = oh; // copy - picInfo->outDepth = CELL_VPOST_PIC_DEPTH_8; // fixed - picInfo->outScanType = CELL_VPOST_SCAN_TYPE_P; // TODO - picInfo->outPicFmt = CELL_VPOST_PIC_FMT_OUT_RGBA_ILV; // TODO + picInfo->outWidth = ow; // copy + picInfo->outHeight = oh; // copy + picInfo->outDepth = CELL_VPOST_PIC_DEPTH_8; // fixed + picInfo->outScanType = CELL_VPOST_SCAN_TYPE_P; // TODO + picInfo->outPicFmt = CELL_VPOST_PIC_FMT_OUT_RGBA_ILV; // TODO picInfo->outChromaPosType = ctrlParam->inChromaPosType; // ignored - picInfo->outPicStruct = picInfo->inPicStruct; // ignored - picInfo->outQuantRange = ctrlParam->inQuantRange; // ignored - picInfo->outColorMatrix = ctrlParam->inColorMatrix; // ignored + picInfo->outPicStruct = picInfo->inPicStruct; // ignored + picInfo->outQuantRange = ctrlParam->inQuantRange; // ignored + picInfo->outColorMatrix = ctrlParam->inColorMatrix; // ignored picInfo->userData = ctrlParam->userData; // copy picInfo->reserved1 = 0; picInfo->reserved2 = 0; - //u64 stamp0 = get_guest_system_time(); - std::unique_ptr pA(new u8[w*h]); + // u64 stamp0 = get_guest_system_time(); + std::unique_ptr pA(new u8[w * h]); - memset(pA.get(), ctrlParam->outAlpha, w*h); + memset(pA.get(), ctrlParam->outAlpha, w * h); - //u64 stamp1 = get_guest_system_time(); + // u64 stamp1 = get_guest_system_time(); vpost->sws = sws_getCachedContext(vpost->sws, w, h, AV_PIX_FMT_YUVA420P, ow, oh, AV_PIX_FMT_RGBA, SWS_BILINEAR, nullptr, nullptr, nullptr); - //u64 stamp2 = get_guest_system_time(); + // u64 stamp2 = get_guest_system_time(); - const u8* in_data[4] = { &inPicBuff[0], &inPicBuff[w * h], &inPicBuff[w * h * 5 / 4], pA.get() }; + const u8* in_data[4] = {&inPicBuff[0], &inPicBuff[w * h], &inPicBuff[w * h * 5 / 4], pA.get()}; int ws = w; - int in_line[4] = { ws, ws/2, ws/2, ws }; - u8* out_data[4] = { outPicBuff.get_ptr(), nullptr, nullptr, nullptr }; - int out_line[4] = { static_cast(ow * 4), 0, 0, 0 }; + int in_line[4] = {ws, ws / 2, ws / 2, ws}; + u8* out_data[4] = {outPicBuff.get_ptr(), nullptr, nullptr, nullptr}; + int out_line[4] = {static_cast(ow * 4), 0, 0, 0}; sws_scale(vpost->sws, in_data, in_line, 0, h, out_data, out_line); - //ConLog.Write("cellVpostExec() perf (access=%d, getContext=%d, scale=%d, finalize=%d)", - //stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2, get_guest_system_time() - stamp3); + // ConLog.Write("cellVpostExec() perf (access=%d, getContext=%d, scale=%d, finalize=%d)", + // stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2, get_guest_system_time() - stamp3); return CELL_OK; } DECLARE(ppu_module_manager::cellVpost)("cellVpost", []() -{ - REG_FUNC(cellVpost, cellVpostQueryAttr); - REG_FUNC(cellVpost, cellVpostOpen); - REG_FUNC(cellVpost, cellVpostOpenEx); - //REG_FUNC(cellVpost, cellVpostOpenExt); // 0x9f1795df - REG_FUNC(cellVpost, cellVpostClose); - REG_FUNC(cellVpost, cellVpostExec); -}); + { + REG_FUNC(cellVpost, cellVpostQueryAttr); + REG_FUNC(cellVpost, cellVpostOpen); + REG_FUNC(cellVpost, cellVpostOpenEx); + // REG_FUNC(cellVpost, cellVpostOpenExt); // 0x9f1795df + REG_FUNC(cellVpost, cellVpostClose); + REG_FUNC(cellVpost, cellVpostExec); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellVpost.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellVpost.h index 6e7919158..dbfda8894 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellVpost.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellVpost.h @@ -21,138 +21,138 @@ extern "C" // Error Codes enum CellVpostError : u32 { - CELL_VPOST_ERROR_Q_ARG_CFG_NULL = 0x80610410, - CELL_VPOST_ERROR_Q_ARG_CFG_INVALID = 0x80610411, - CELL_VPOST_ERROR_Q_ARG_ATTR_NULL = 0x80610412, - CELL_VPOST_ERROR_O_ARG_CFG_NULL = 0x80610440, - CELL_VPOST_ERROR_O_ARG_CFG_INVALID = 0x80610441, - CELL_VPOST_ERROR_O_ARG_RSRC_NULL = 0x80610442, - CELL_VPOST_ERROR_O_ARG_RSRC_INVALID = 0x80610443, - CELL_VPOST_ERROR_O_ARG_HDL_NULL = 0x80610444, - CELL_VPOST_ERROR_O_FATAL_QUERY_FAIL = 0x80610460, - CELL_VPOST_ERROR_O_FATAL_CREATEMON_FAIL = 0x80610461, - CELL_VPOST_ERROR_O_FATAL_INITSPURS_FAIL = 0x80610462, - CELL_VPOST_ERROR_C_ARG_HDL_NULL = 0x80610470, - CELL_VPOST_ERROR_C_ARG_HDL_INVALID = 0x80610471, - CELL_VPOST_ERROR_C_FATAL_LOCKMON_FAIL = 0x80610490, - CELL_VPOST_ERROR_C_FATAL_UNLOCKMON_FAIL = 0x80610491, - CELL_VPOST_ERROR_C_FATAL_DESTROYMON_FAIL = 0x80610492, - CELL_VPOST_ERROR_C_FATAL_FINSPURS_FAIL = 0x80610463, - CELL_VPOST_ERROR_E_ARG_HDL_NULL = 0x806104a0, - CELL_VPOST_ERROR_E_ARG_HDL_INVALID = 0x806104a1, - CELL_VPOST_ERROR_E_ARG_INPICBUF_NULL = 0x806104a2, - CELL_VPOST_ERROR_E_ARG_INPICBUF_INVALID = 0x806104a3, - CELL_VPOST_ERROR_E_ARG_CTRL_NULL = 0x806104a4, - CELL_VPOST_ERROR_E_ARG_CTRL_INVALID = 0x806104a5, - CELL_VPOST_ERROR_E_ARG_OUTPICBUF_NULL = 0x806104a6, - CELL_VPOST_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806104a7, - CELL_VPOST_ERROR_E_ARG_PICINFO_NULL = 0x806104a8, - CELL_VPOST_ERROR_E_FATAL_LOCKMON_FAIL = 0x806104c0, - CELL_VPOST_ERROR_E_FATAL_UNLOCKMON_FAIL = 0x806104c1, - CELL_VPOST_ENT_ERROR_Q_ARG_ATTR_NULL = 0x80618110, - CELL_VPOST_ENT_ERROR_O_ARG_RSRC_NULL = 0x80618140, - CELL_VPOST_ENT_ERROR_O_ARG_RSRC_INVALID = 0x80618141, - CELL_VPOST_ENT_ERROR_O_ARG_HDL_NULL = 0x80618142, - CELL_VPOST_ENT_ERROR_O_FATAL_QUERY_FAIL = 0x80618160, - CELL_VPOST_ENT_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618161, - CELL_VPOST_ENT_ERROR_C_ARG_HDL_NULL = 0x80618170, - CELL_VPOST_ENT_ERROR_C_ARG_HDL_INVALID = 0x80618171, - CELL_VPOST_ENT_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618190, - CELL_VPOST_ENT_ERROR_C_FATAL_RCVRES_FAIL = 0x80618191, - CELL_VPOST_ENT_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618192, - CELL_VPOST_ENT_ERROR_E_ARG_HDL_NULL = 0x806181a0, - CELL_VPOST_ENT_ERROR_E_ARG_HDL_INVALID = 0x806181a1, - CELL_VPOST_ENT_ERROR_E_ARG_INPICBUF_NULL = 0x806181a2, - CELL_VPOST_ENT_ERROR_E_ARG_INPICBUF_INVALID = 0x806181a3, - CELL_VPOST_ENT_ERROR_E_ARG_INPICINFO_NULL = 0x806181a4, + CELL_VPOST_ERROR_Q_ARG_CFG_NULL = 0x80610410, + CELL_VPOST_ERROR_Q_ARG_CFG_INVALID = 0x80610411, + CELL_VPOST_ERROR_Q_ARG_ATTR_NULL = 0x80610412, + CELL_VPOST_ERROR_O_ARG_CFG_NULL = 0x80610440, + CELL_VPOST_ERROR_O_ARG_CFG_INVALID = 0x80610441, + CELL_VPOST_ERROR_O_ARG_RSRC_NULL = 0x80610442, + CELL_VPOST_ERROR_O_ARG_RSRC_INVALID = 0x80610443, + CELL_VPOST_ERROR_O_ARG_HDL_NULL = 0x80610444, + CELL_VPOST_ERROR_O_FATAL_QUERY_FAIL = 0x80610460, + CELL_VPOST_ERROR_O_FATAL_CREATEMON_FAIL = 0x80610461, + CELL_VPOST_ERROR_O_FATAL_INITSPURS_FAIL = 0x80610462, + CELL_VPOST_ERROR_C_ARG_HDL_NULL = 0x80610470, + CELL_VPOST_ERROR_C_ARG_HDL_INVALID = 0x80610471, + CELL_VPOST_ERROR_C_FATAL_LOCKMON_FAIL = 0x80610490, + CELL_VPOST_ERROR_C_FATAL_UNLOCKMON_FAIL = 0x80610491, + CELL_VPOST_ERROR_C_FATAL_DESTROYMON_FAIL = 0x80610492, + CELL_VPOST_ERROR_C_FATAL_FINSPURS_FAIL = 0x80610463, + CELL_VPOST_ERROR_E_ARG_HDL_NULL = 0x806104a0, + CELL_VPOST_ERROR_E_ARG_HDL_INVALID = 0x806104a1, + CELL_VPOST_ERROR_E_ARG_INPICBUF_NULL = 0x806104a2, + CELL_VPOST_ERROR_E_ARG_INPICBUF_INVALID = 0x806104a3, + CELL_VPOST_ERROR_E_ARG_CTRL_NULL = 0x806104a4, + CELL_VPOST_ERROR_E_ARG_CTRL_INVALID = 0x806104a5, + CELL_VPOST_ERROR_E_ARG_OUTPICBUF_NULL = 0x806104a6, + CELL_VPOST_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806104a7, + CELL_VPOST_ERROR_E_ARG_PICINFO_NULL = 0x806104a8, + CELL_VPOST_ERROR_E_FATAL_LOCKMON_FAIL = 0x806104c0, + CELL_VPOST_ERROR_E_FATAL_UNLOCKMON_FAIL = 0x806104c1, + CELL_VPOST_ENT_ERROR_Q_ARG_ATTR_NULL = 0x80618110, + CELL_VPOST_ENT_ERROR_O_ARG_RSRC_NULL = 0x80618140, + CELL_VPOST_ENT_ERROR_O_ARG_RSRC_INVALID = 0x80618141, + CELL_VPOST_ENT_ERROR_O_ARG_HDL_NULL = 0x80618142, + CELL_VPOST_ENT_ERROR_O_FATAL_QUERY_FAIL = 0x80618160, + CELL_VPOST_ENT_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618161, + CELL_VPOST_ENT_ERROR_C_ARG_HDL_NULL = 0x80618170, + CELL_VPOST_ENT_ERROR_C_ARG_HDL_INVALID = 0x80618171, + CELL_VPOST_ENT_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618190, + CELL_VPOST_ENT_ERROR_C_FATAL_RCVRES_FAIL = 0x80618191, + CELL_VPOST_ENT_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618192, + CELL_VPOST_ENT_ERROR_E_ARG_HDL_NULL = 0x806181a0, + CELL_VPOST_ENT_ERROR_E_ARG_HDL_INVALID = 0x806181a1, + CELL_VPOST_ENT_ERROR_E_ARG_INPICBUF_NULL = 0x806181a2, + CELL_VPOST_ENT_ERROR_E_ARG_INPICBUF_INVALID = 0x806181a3, + CELL_VPOST_ENT_ERROR_E_ARG_INPICINFO_NULL = 0x806181a4, CELL_VPOST_ENT_ERROR_E_ARG_INPICINFO_INVALID = 0x806181a5, - CELL_VPOST_ENT_ERROR_E_ARG_CTRL_NULL = 0x806181a6, - CELL_VPOST_ENT_ERROR_E_ARG_CTRL_INVALID = 0x806181a7, - CELL_VPOST_ENT_ERROR_E_ARG_COMB_INVALID = 0x806181a8, - CELL_VPOST_ENT_ERROR_E_ARG_OUTPICBUF_NULL = 0x806181a9, + CELL_VPOST_ENT_ERROR_E_ARG_CTRL_NULL = 0x806181a6, + CELL_VPOST_ENT_ERROR_E_ARG_CTRL_INVALID = 0x806181a7, + CELL_VPOST_ENT_ERROR_E_ARG_COMB_INVALID = 0x806181a8, + CELL_VPOST_ENT_ERROR_E_ARG_OUTPICBUF_NULL = 0x806181a9, CELL_VPOST_ENT_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806181aa, - CELL_VPOST_ENT_ERROR_E_ARG_OUTPICINFO_NULL = 0x806181ab, - CELL_VPOST_ENT_ERROR_E_FATAL_SNDCMD_FAIL = 0x806181c0, - CELL_VPOST_ENT_ERROR_E_FATAL_RCVRES_FAIL = 0x806181c1, - CELL_VPOST_ENT_ERROR_E_FATAL_SPUCORE_FAIL = 0x806181c2, - CELL_VPOST_IPC_ERROR_Q_ARG_ATTR_NULL = 0x80618210, - CELL_VPOST_IPC_ERROR_O_ARG_RSRC_NULL = 0x80618240, - CELL_VPOST_IPC_ERROR_O_ARG_RSRC_INVALID = 0x80618241, - CELL_VPOST_IPC_ERROR_O_ARG_HDL_NULL = 0x80618242, - CELL_VPOST_IPC_ERROR_O_FATAL_QUERY_FAIL = 0x80618260, - CELL_VPOST_IPC_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618261, - CELL_VPOST_IPC_ERROR_C_ARG_HDL_NULL = 0x80618270, - CELL_VPOST_IPC_ERROR_C_ARG_HDL_INVALID = 0x80618271, - CELL_VPOST_IPC_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618290, - CELL_VPOST_IPC_ERROR_C_FATAL_RCVRES_FAIL = 0x80618291, - CELL_VPOST_IPC_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618292, - CELL_VPOST_IPC_ERROR_E_ARG_HDL_NULL = 0x806182a0, - CELL_VPOST_IPC_ERROR_E_ARG_HDL_INVALID = 0x806182a1, - CELL_VPOST_IPC_ERROR_E_ARG_INPICBUF_NULL = 0x806182a2, - CELL_VPOST_IPC_ERROR_E_ARG_INPICBUF_INVALID = 0x806182a3, - CELL_VPOST_IPC_ERROR_E_ARG_INPICINFO_NULL = 0x806182a4, + CELL_VPOST_ENT_ERROR_E_ARG_OUTPICINFO_NULL = 0x806181ab, + CELL_VPOST_ENT_ERROR_E_FATAL_SNDCMD_FAIL = 0x806181c0, + CELL_VPOST_ENT_ERROR_E_FATAL_RCVRES_FAIL = 0x806181c1, + CELL_VPOST_ENT_ERROR_E_FATAL_SPUCORE_FAIL = 0x806181c2, + CELL_VPOST_IPC_ERROR_Q_ARG_ATTR_NULL = 0x80618210, + CELL_VPOST_IPC_ERROR_O_ARG_RSRC_NULL = 0x80618240, + CELL_VPOST_IPC_ERROR_O_ARG_RSRC_INVALID = 0x80618241, + CELL_VPOST_IPC_ERROR_O_ARG_HDL_NULL = 0x80618242, + CELL_VPOST_IPC_ERROR_O_FATAL_QUERY_FAIL = 0x80618260, + CELL_VPOST_IPC_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618261, + CELL_VPOST_IPC_ERROR_C_ARG_HDL_NULL = 0x80618270, + CELL_VPOST_IPC_ERROR_C_ARG_HDL_INVALID = 0x80618271, + CELL_VPOST_IPC_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618290, + CELL_VPOST_IPC_ERROR_C_FATAL_RCVRES_FAIL = 0x80618291, + CELL_VPOST_IPC_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618292, + CELL_VPOST_IPC_ERROR_E_ARG_HDL_NULL = 0x806182a0, + CELL_VPOST_IPC_ERROR_E_ARG_HDL_INVALID = 0x806182a1, + CELL_VPOST_IPC_ERROR_E_ARG_INPICBUF_NULL = 0x806182a2, + CELL_VPOST_IPC_ERROR_E_ARG_INPICBUF_INVALID = 0x806182a3, + CELL_VPOST_IPC_ERROR_E_ARG_INPICINFO_NULL = 0x806182a4, CELL_VPOST_IPC_ERROR_E_ARG_INPICINFO_INVALID = 0x806182a5, - CELL_VPOST_IPC_ERROR_E_ARG_CTRL_NULL = 0x806182a6, - CELL_VPOST_IPC_ERROR_E_ARG_CTRL_INVALID = 0x806182a7, - CELL_VPOST_IPC_ERROR_E_ARG_COMB_INVALID = 0x806182a8, - CELL_VPOST_IPC_ERROR_E_ARG_OUTPICBUF_NULL = 0x806182a9, + CELL_VPOST_IPC_ERROR_E_ARG_CTRL_NULL = 0x806182a6, + CELL_VPOST_IPC_ERROR_E_ARG_CTRL_INVALID = 0x806182a7, + CELL_VPOST_IPC_ERROR_E_ARG_COMB_INVALID = 0x806182a8, + CELL_VPOST_IPC_ERROR_E_ARG_OUTPICBUF_NULL = 0x806182a9, CELL_VPOST_IPC_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806182aa, - CELL_VPOST_IPC_ERROR_E_ARG_OUTPICINFO_NULL = 0x806182ab, - CELL_VPOST_IPC_ERROR_E_FATAL_SNDCMD_FAIL = 0x806182c0, - CELL_VPOST_IPC_ERROR_E_FATAL_RCVRES_FAIL = 0x806182c1, - CELL_VPOST_IPC_ERROR_E_FATAL_SPUCORE_FAIL = 0x806182c2, - CELL_VPOST_VSC_ERROR_Q_ARG_ATTR_NULL = 0x80618310, - CELL_VPOST_VSC_ERROR_O_ARG_RSRC_NULL = 0x80618340, - CELL_VPOST_VSC_ERROR_O_ARG_RSRC_INVALID = 0x80618341, - CELL_VPOST_VSC_ERROR_O_ARG_HDL_NULL = 0x80618342, - CELL_VPOST_VSC_ERROR_O_FATAL_QUERY_FAIL = 0x80618360, - CELL_VPOST_VSC_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618361, - CELL_VPOST_VSC_ERROR_C_ARG_HDL_NULL = 0x80618370, - CELL_VPOST_VSC_ERROR_C_ARG_HDL_INVALID = 0x80618371, - CELL_VPOST_VSC_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618390, - CELL_VPOST_VSC_ERROR_C_FATAL_RCVRES_FAIL = 0x80618391, - CELL_VPOST_VSC_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618392, - CELL_VPOST_VSC_ERROR_E_ARG_HDL_NULL = 0x806183a0, - CELL_VPOST_VSC_ERROR_E_ARG_HDL_INVALID = 0x806183a1, - CELL_VPOST_VSC_ERROR_E_ARG_INPICBUF_NULL = 0x806183a2, - CELL_VPOST_VSC_ERROR_E_ARG_INPICBUF_INVALID = 0x806183a3, - CELL_VPOST_VSC_ERROR_E_ARG_INPICINFO_NULL = 0x806183a4, + CELL_VPOST_IPC_ERROR_E_ARG_OUTPICINFO_NULL = 0x806182ab, + CELL_VPOST_IPC_ERROR_E_FATAL_SNDCMD_FAIL = 0x806182c0, + CELL_VPOST_IPC_ERROR_E_FATAL_RCVRES_FAIL = 0x806182c1, + CELL_VPOST_IPC_ERROR_E_FATAL_SPUCORE_FAIL = 0x806182c2, + CELL_VPOST_VSC_ERROR_Q_ARG_ATTR_NULL = 0x80618310, + CELL_VPOST_VSC_ERROR_O_ARG_RSRC_NULL = 0x80618340, + CELL_VPOST_VSC_ERROR_O_ARG_RSRC_INVALID = 0x80618341, + CELL_VPOST_VSC_ERROR_O_ARG_HDL_NULL = 0x80618342, + CELL_VPOST_VSC_ERROR_O_FATAL_QUERY_FAIL = 0x80618360, + CELL_VPOST_VSC_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618361, + CELL_VPOST_VSC_ERROR_C_ARG_HDL_NULL = 0x80618370, + CELL_VPOST_VSC_ERROR_C_ARG_HDL_INVALID = 0x80618371, + CELL_VPOST_VSC_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618390, + CELL_VPOST_VSC_ERROR_C_FATAL_RCVRES_FAIL = 0x80618391, + CELL_VPOST_VSC_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618392, + CELL_VPOST_VSC_ERROR_E_ARG_HDL_NULL = 0x806183a0, + CELL_VPOST_VSC_ERROR_E_ARG_HDL_INVALID = 0x806183a1, + CELL_VPOST_VSC_ERROR_E_ARG_INPICBUF_NULL = 0x806183a2, + CELL_VPOST_VSC_ERROR_E_ARG_INPICBUF_INVALID = 0x806183a3, + CELL_VPOST_VSC_ERROR_E_ARG_INPICINFO_NULL = 0x806183a4, CELL_VPOST_VSC_ERROR_E_ARG_INPICINFO_INVALID = 0x806183a5, - CELL_VPOST_VSC_ERROR_E_ARG_CTRL_NULL = 0x806183a6, - CELL_VPOST_VSC_ERROR_E_ARG_CTRL_INVALID = 0x806183a7, - CELL_VPOST_VSC_ERROR_E_ARG_COMB_INVALID = 0x806183a8, - CELL_VPOST_VSC_ERROR_E_ARG_OUTPICBUF_NULL = 0x806183a9, + CELL_VPOST_VSC_ERROR_E_ARG_CTRL_NULL = 0x806183a6, + CELL_VPOST_VSC_ERROR_E_ARG_CTRL_INVALID = 0x806183a7, + CELL_VPOST_VSC_ERROR_E_ARG_COMB_INVALID = 0x806183a8, + CELL_VPOST_VSC_ERROR_E_ARG_OUTPICBUF_NULL = 0x806183a9, CELL_VPOST_VSC_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806183aa, - CELL_VPOST_VSC_ERROR_E_ARG_OUTPICINFO_NULL = 0x806183ab, - CELL_VPOST_VSC_ERROR_E_FATAL_SNDCMD_FAIL = 0x806183c0, - CELL_VPOST_VSC_ERROR_E_FATAL_RCVRES_FAIL = 0x806183c1, - CELL_VPOST_VSC_ERROR_E_FATAL_SPUCORE_FAIL = 0x806183c2, - CELL_VPOST_CSC_ERROR_Q_ARG_ATTR_NULL = 0x80618410, - CELL_VPOST_CSC_ERROR_O_ARG_RSRC_NULL = 0x80618440, - CELL_VPOST_CSC_ERROR_O_ARG_RSRC_INVALID = 0x80618441, - CELL_VPOST_CSC_ERROR_O_ARG_HDL_NULL = 0x80618442, - CELL_VPOST_CSC_ERROR_O_FATAL_QUERY_FAIL = 0x80618460, - CELL_VPOST_CSC_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618461, - CELL_VPOST_CSC_ERROR_C_ARG_HDL_NULL = 0x80618470, - CELL_VPOST_CSC_ERROR_C_ARG_HDL_INVALID = 0x80618471, - CELL_VPOST_CSC_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618490, - CELL_VPOST_CSC_ERROR_C_FATAL_RCVRES_FAIL = 0x80618491, - CELL_VPOST_CSC_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618492, - CELL_VPOST_CSC_ERROR_E_ARG_HDL_NULL = 0x806184a0, - CELL_VPOST_CSC_ERROR_E_ARG_HDL_INVALID = 0x806184a1, - CELL_VPOST_CSC_ERROR_E_ARG_INPICBUF_NULL = 0x806184a2, - CELL_VPOST_CSC_ERROR_E_ARG_INPICBUF_INVALID = 0x806184a3, - CELL_VPOST_CSC_ERROR_E_ARG_INPICINFO_NULL = 0x806184a4, + CELL_VPOST_VSC_ERROR_E_ARG_OUTPICINFO_NULL = 0x806183ab, + CELL_VPOST_VSC_ERROR_E_FATAL_SNDCMD_FAIL = 0x806183c0, + CELL_VPOST_VSC_ERROR_E_FATAL_RCVRES_FAIL = 0x806183c1, + CELL_VPOST_VSC_ERROR_E_FATAL_SPUCORE_FAIL = 0x806183c2, + CELL_VPOST_CSC_ERROR_Q_ARG_ATTR_NULL = 0x80618410, + CELL_VPOST_CSC_ERROR_O_ARG_RSRC_NULL = 0x80618440, + CELL_VPOST_CSC_ERROR_O_ARG_RSRC_INVALID = 0x80618441, + CELL_VPOST_CSC_ERROR_O_ARG_HDL_NULL = 0x80618442, + CELL_VPOST_CSC_ERROR_O_FATAL_QUERY_FAIL = 0x80618460, + CELL_VPOST_CSC_ERROR_O_FATAL_CSPUCORE_FAIL = 0x80618461, + CELL_VPOST_CSC_ERROR_C_ARG_HDL_NULL = 0x80618470, + CELL_VPOST_CSC_ERROR_C_ARG_HDL_INVALID = 0x80618471, + CELL_VPOST_CSC_ERROR_C_FATAL_SNDCMD_FAIL = 0x80618490, + CELL_VPOST_CSC_ERROR_C_FATAL_RCVRES_FAIL = 0x80618491, + CELL_VPOST_CSC_ERROR_C_FATAL_DSPUCORE_FAIL = 0x80618492, + CELL_VPOST_CSC_ERROR_E_ARG_HDL_NULL = 0x806184a0, + CELL_VPOST_CSC_ERROR_E_ARG_HDL_INVALID = 0x806184a1, + CELL_VPOST_CSC_ERROR_E_ARG_INPICBUF_NULL = 0x806184a2, + CELL_VPOST_CSC_ERROR_E_ARG_INPICBUF_INVALID = 0x806184a3, + CELL_VPOST_CSC_ERROR_E_ARG_INPICINFO_NULL = 0x806184a4, CELL_VPOST_CSC_ERROR_E_ARG_INPICINFO_INVALID = 0x806184a5, - CELL_VPOST_CSC_ERROR_E_ARG_CTRL_NULL = 0x806184a6, - CELL_VPOST_CSC_ERROR_E_ARG_CTRL_INVALID = 0x806184a7, - CELL_VPOST_CSC_ERROR_E_ARG_COMB_INVALID = 0x806184a8, - CELL_VPOST_CSC_ERROR_E_ARG_OUTPICBUF_NULL = 0x806184a9, + CELL_VPOST_CSC_ERROR_E_ARG_CTRL_NULL = 0x806184a6, + CELL_VPOST_CSC_ERROR_E_ARG_CTRL_INVALID = 0x806184a7, + CELL_VPOST_CSC_ERROR_E_ARG_COMB_INVALID = 0x806184a8, + CELL_VPOST_CSC_ERROR_E_ARG_OUTPICBUF_NULL = 0x806184a9, CELL_VPOST_CSC_ERROR_E_ARG_OUTPICBUF_INVALID = 0x806184aa, - CELL_VPOST_CSC_ERROR_E_ARG_OUTPICINFO_NULL = 0x806184ab, - CELL_VPOST_CSC_ERROR_E_FATAL_SNDCMD_FAIL = 0x806184c0, - CELL_VPOST_CSC_ERROR_E_FATAL_RCVRES_FAIL = 0x806184c1, - CELL_VPOST_CSC_ERROR_E_FATAL_SPUCORE_FAIL = 0x806184c2, + CELL_VPOST_CSC_ERROR_E_ARG_OUTPICINFO_NULL = 0x806184ab, + CELL_VPOST_CSC_ERROR_E_FATAL_SNDCMD_FAIL = 0x806184c0, + CELL_VPOST_CSC_ERROR_E_FATAL_RCVRES_FAIL = 0x806184c1, + CELL_VPOST_CSC_ERROR_E_FATAL_SPUCORE_FAIL = 0x806184c2, }; enum CellVpostPictureDepth : s32 @@ -234,12 +234,12 @@ struct CellVpostCfgParam { be_t inMaxWidth; be_t inMaxHeight; - be_t inDepth; // CellVpostPictureDepth + be_t inDepth; // CellVpostPictureDepth be_t inPicFmt; // CellVpostPictureFormatIn be_t outMaxWidth; be_t outMaxHeight; - be_t outDepth; // CellVpostPictureDepth + be_t outDepth; // CellVpostPictureDepth be_t outPicFmt; // CellVpostPictureFormatOut be_t reserved1; @@ -286,13 +286,13 @@ struct CellVpostCtrlParam be_t execType; // CellVpostExecType be_t scalerType; // CellVpostScalerType - be_t ipcType; // CellVpostIpcType + be_t ipcType; // CellVpostIpcType be_t inWidth; be_t inHeight; be_t inChromaPosType; // CellVpostChromaPositionType - be_t inQuantRange; // CellVpostQuantRange - be_t inColorMatrix; // CellVpostColorMatrix + be_t inQuantRange; // CellVpostQuantRange + be_t inColorMatrix; // CellVpostColorMatrix CellVpostWindow inWindow; be_t outWidth; @@ -310,23 +310,23 @@ struct CellVpostPictureInfo { be_t inWidth; be_t inHeight; - be_t inDepth; // CellVpostPictureDepth - be_t inScanType; // CellVpostScanType - be_t inPicFmt; // CellVpostPictureFormatIn + be_t inDepth; // CellVpostPictureDepth + be_t inScanType; // CellVpostScanType + be_t inPicFmt; // CellVpostPictureFormatIn be_t inChromaPosType; // CellVpostChromaPositionType - be_t inPicStruct; // CellVpostPictureStructure - be_t inQuantRange; // CellVpostQuantRange - be_t inColorMatrix; // CellVpostColorMatrix + be_t inPicStruct; // CellVpostPictureStructure + be_t inQuantRange; // CellVpostQuantRange + be_t inColorMatrix; // CellVpostColorMatrix be_t outWidth; be_t outHeight; - be_t outDepth; // CellVpostPictureDepth - be_t outScanType; // CellVpostScanType - be_t outPicFmt; // CellVpostPictureFormatOut + be_t outDepth; // CellVpostPictureDepth + be_t outScanType; // CellVpostScanType + be_t outPicFmt; // CellVpostPictureFormatOut be_t outChromaPosType; // CellVpostChromaPositionType - be_t outPicStruct; // CellVpostPictureStructure - be_t outQuantRange; // CellVpostQuantRange - be_t outColorMatrix; // CellVpostColorMatrix + be_t outPicStruct; // CellVpostPictureStructure + be_t outQuantRange; // CellVpostQuantRange + be_t outColorMatrix; // CellVpostColorMatrix be_t userData; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellWebBrowser.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cellWebBrowser.cpp index 7f560c9ca..02b90441c 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellWebBrowser.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellWebBrowser.cpp @@ -250,10 +250,10 @@ error_code cellWebBrowserInitialize(vm::ptr system browser.system_cb = system_cb; sysutil_register_cb([=, &browser](ppu_thread& ppu) -> s32 - { - system_cb(ppu, CELL_SYSUTIL_WEBBROWSER_INITIALIZING_FINISHED, browser.userData); - return CELL_OK; - }); + { + system_cb(ppu, CELL_SYSUTIL_WEBBROWSER_INITIALIZING_FINISHED, browser.userData); + return CELL_OK; + }); return CELL_OK; } @@ -283,10 +283,10 @@ void cellWebBrowserShutdown() auto& browser = g_fxo->get(); sysutil_register_cb([=, &browser](ppu_thread& ppu) -> s32 - { - browser.system_cb(ppu, CELL_SYSUTIL_WEBBROWSER_SHUTDOWN_FINISHED, browser.userData); - return CELL_OK; - }); + { + browser.system_cb(ppu, CELL_SYSUTIL_WEBBROWSER_SHUTDOWN_FINISHED, browser.userData); + return CELL_OK; + }); } error_code cellWebBrowserUpdatePointerDisplayPos2() @@ -319,7 +319,6 @@ error_code cellWebComponentDestroy() return CELL_OK; } - void cellSysutil_WebBrowser_init() { REG_FUNC(cellSysutil, cellWebBrowserActivate); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cellWebBrowser.h b/rpcs3/rpcs3/Emu/Cell/Modules/cellWebBrowser.h index 6c46c581b..9b9c18ca9 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cellWebBrowser.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cellWebBrowser.h @@ -2,15 +2,15 @@ #include "Emu/Memory/vm_ptr.h" -//events +// events enum CellWebBrowserEvent : s32 { - CELL_SYSUTIL_WEBBROWSER_INITIALIZING_FINISHED = 1, - CELL_SYSUTIL_WEBBROWSER_SHUTDOWN_FINISHED = 4, - CELL_SYSUTIL_WEBBROWSER_LOADING_FINISHED = 5, - CELL_SYSUTIL_WEBBROWSER_UNLOADING_FINISHED = 7, - CELL_SYSUTIL_WEBBROWSER_RELEASED = 9, - CELL_SYSUTIL_WEBBROWSER_GRABBED = 11, + CELL_SYSUTIL_WEBBROWSER_INITIALIZING_FINISHED = 1, + CELL_SYSUTIL_WEBBROWSER_SHUTDOWN_FINISHED = 4, + CELL_SYSUTIL_WEBBROWSER_LOADING_FINISHED = 5, + CELL_SYSUTIL_WEBBROWSER_UNLOADING_FINISHED = 7, + CELL_SYSUTIL_WEBBROWSER_RELEASED = 9, + CELL_SYSUTIL_WEBBROWSER_GRABBED = 11, }; using CellWebBrowserCallback = void(s32 cb_type, vm::ptr client_session, vm::ptr usrdata); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/cell_FreeType2.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/cell_FreeType2.cpp index ae6493e55..e3a7342b7 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/cell_FreeType2.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/cell_FreeType2.cpp @@ -934,163 +934,162 @@ error_code FT_Vector_Unit() return CELL_OK; } - DECLARE(ppu_module_manager::cell_FreeType2)("cell_FreeType2", []() -{ - REG_FUNC(cell_FreeType2, cellFreeType2Ex); + { + REG_FUNC(cell_FreeType2, cellFreeType2Ex); - REG_FUNC(cell_FreeType2, FT_Activate_Size); - REG_FUNC(cell_FreeType2, FT_Add_Default_Modules); - REG_FUNC(cell_FreeType2, FT_Add_Module); - REG_FUNC(cell_FreeType2, FT_Alloc); - REG_FUNC(cell_FreeType2, FT_Angle_Diff); - REG_FUNC(cell_FreeType2, FT_Atan2); - REG_FUNC(cell_FreeType2, FT_Attach_File); - REG_FUNC(cell_FreeType2, FT_Attach_Stream); - REG_FUNC(cell_FreeType2, FT_Bitmap_Convert); - REG_FUNC(cell_FreeType2, FT_Bitmap_Copy); - REG_FUNC(cell_FreeType2, FT_Bitmap_Done); - REG_FUNC(cell_FreeType2, FT_Bitmap_Embolden); - REG_FUNC(cell_FreeType2, FT_Bitmap_New); - REG_FUNC(cell_FreeType2, FTC_CMapCache_Lookup); - REG_FUNC(cell_FreeType2, FTC_CMapCache_New); - REG_FUNC(cell_FreeType2, FT_CeilFix); - REG_FUNC(cell_FreeType2, FTC_ImageCache_Lookup); - REG_FUNC(cell_FreeType2, FTC_ImageCache_New); - REG_FUNC(cell_FreeType2, FTC_Manager_Done); - REG_FUNC(cell_FreeType2, FTC_Manager_LookupFace); - REG_FUNC(cell_FreeType2, FTC_Manager_LookupSize); - REG_FUNC(cell_FreeType2, FTC_Manager_New); - REG_FUNC(cell_FreeType2, FTC_Manager_RemoveFaceID); - REG_FUNC(cell_FreeType2, FTC_Node_Unref); - REG_FUNC(cell_FreeType2, FT_Cos); - REG_FUNC(cell_FreeType2, FTC_SBitCache_Lookup); - REG_FUNC(cell_FreeType2, FTC_SBitCache_New); - REG_FUNC(cell_FreeType2, FT_DivFix); - REG_FUNC(cell_FreeType2, FT_Done_Face); - REG_FUNC(cell_FreeType2, FT_Done_FreeType); - REG_FUNC(cell_FreeType2, FT_Done_Glyph); - REG_FUNC(cell_FreeType2, FT_Done_Library); - REG_FUNC(cell_FreeType2, FT_Done_Size); - REG_FUNC(cell_FreeType2, FT_FloorFix); - REG_FUNC(cell_FreeType2, FT_Free); - REG_FUNC(cell_FreeType2, FT_Get_BDF_Charset_ID); - REG_FUNC(cell_FreeType2, FT_Get_BDF_Property); - REG_FUNC(cell_FreeType2, FT_Get_Char_Index); - REG_FUNC(cell_FreeType2, FT_Get_Charmap_Index); - REG_FUNC(cell_FreeType2, FT_Get_CMap_Language_ID); - REG_FUNC(cell_FreeType2, FT_Get_First_Char); - REG_FUNC(cell_FreeType2, FT_Get_Glyph); - REG_FUNC(cell_FreeType2, FT_Get_Glyph_Name); - REG_FUNC(cell_FreeType2, FT_Get_Kerning); - REG_FUNC(cell_FreeType2, FT_Get_MM_Var); - REG_FUNC(cell_FreeType2, FT_Get_Module); - REG_FUNC(cell_FreeType2, FT_Get_Multi_Master); - REG_FUNC(cell_FreeType2, FT_Get_Name_Index); - REG_FUNC(cell_FreeType2, FT_Get_Next_Char); - REG_FUNC(cell_FreeType2, FT_Get_PFR_Advance); - REG_FUNC(cell_FreeType2, FT_Get_PFR_Kerning); - REG_FUNC(cell_FreeType2, FT_Get_PFR_Metrics); - REG_FUNC(cell_FreeType2, FT_Get_Postscript_Name); - REG_FUNC(cell_FreeType2, FT_Get_PS_Font_Info); - REG_FUNC(cell_FreeType2, FT_Get_PS_Font_Private); - REG_FUNC(cell_FreeType2, FT_Get_Renderer); - REG_FUNC(cell_FreeType2, FT_Get_Sfnt_Name); - REG_FUNC(cell_FreeType2, FT_Get_Sfnt_Name_Count); - REG_FUNC(cell_FreeType2, FT_Get_Sfnt_Table); - REG_FUNC(cell_FreeType2, FT_Get_SubGlyph_Info); - REG_FUNC(cell_FreeType2, FT_Get_Track_Kerning); - REG_FUNC(cell_FreeType2, FT_Get_TrueType_Engine_Type); - REG_FUNC(cell_FreeType2, FT_Get_WinFNT_Header); - REG_FUNC(cell_FreeType2, FT_Get_X11_Font_Format); - REG_FUNC(cell_FreeType2, FT_Glyph_Copy); - REG_FUNC(cell_FreeType2, FT_Glyph_Get_CBox); - REG_FUNC(cell_FreeType2, FT_GlyphSlot_Own_Bitmap); - REG_FUNC(cell_FreeType2, FT_Glyph_Stroke); - REG_FUNC(cell_FreeType2, FT_Glyph_StrokeBorder); - REG_FUNC(cell_FreeType2, FT_Glyph_To_Bitmap); - REG_FUNC(cell_FreeType2, FT_Glyph_Transform); - REG_FUNC(cell_FreeType2, FT_Has_PS_Glyph_Names); - REG_FUNC(cell_FreeType2, FT_Init_FreeType); - REG_FUNC(cell_FreeType2, FT_Library_Version); - REG_FUNC(cell_FreeType2, FT_List_Add); - REG_FUNC(cell_FreeType2, FT_List_Finalize); - REG_FUNC(cell_FreeType2, FT_List_Find); - REG_FUNC(cell_FreeType2, FT_List_Insert); - REG_FUNC(cell_FreeType2, FT_List_Iterate); - REG_FUNC(cell_FreeType2, FT_List_Remove); - REG_FUNC(cell_FreeType2, FT_List_Up); - REG_FUNC(cell_FreeType2, FT_Load_Char); - REG_FUNC(cell_FreeType2, FT_Load_Glyph); - REG_FUNC(cell_FreeType2, FT_Load_Sfnt_Table); - REG_FUNC(cell_FreeType2, FT_Matrix_Invert); - REG_FUNC(cell_FreeType2, FT_Matrix_Multiply); - REG_FUNC(cell_FreeType2, FT_MulDiv); - REG_FUNC(cell_FreeType2, FT_MulFix); - REG_FUNC(cell_FreeType2, FT_New_Face); - REG_FUNC(cell_FreeType2, FT_New_Library); - REG_FUNC(cell_FreeType2, FT_New_Memory); - REG_FUNC(cell_FreeType2, FT_New_Memory_Face); - REG_FUNC(cell_FreeType2, FT_New_Size); - REG_FUNC(cell_FreeType2, FT_Open_Face); - REG_FUNC(cell_FreeType2, FT_OpenType_Free); - REG_FUNC(cell_FreeType2, FT_OpenType_Validate); - REG_FUNC(cell_FreeType2, FT_Outline_Check); - REG_FUNC(cell_FreeType2, FT_Outline_Copy); - REG_FUNC(cell_FreeType2, FT_Outline_Decompose); - REG_FUNC(cell_FreeType2, FT_Outline_Done); - REG_FUNC(cell_FreeType2, FT_Outline_Embolden); - REG_FUNC(cell_FreeType2, FT_Outline_Get_BBox); - REG_FUNC(cell_FreeType2, FT_Outline_Get_Bitmap); - REG_FUNC(cell_FreeType2, FT_Outline_Get_CBox); - REG_FUNC(cell_FreeType2, FT_Outline_GetInsideBorder); - REG_FUNC(cell_FreeType2, FT_Outline_Get_Orientation); - REG_FUNC(cell_FreeType2, FT_Outline_GetOutsideBorder); - REG_FUNC(cell_FreeType2, FT_Outline_New); - REG_FUNC(cell_FreeType2, FT_Outline_Render); - REG_FUNC(cell_FreeType2, FT_Outline_Reverse); - REG_FUNC(cell_FreeType2, FT_Outline_Transform); - REG_FUNC(cell_FreeType2, FT_Outline_Translate); - REG_FUNC(cell_FreeType2, FT_Realloc); - REG_FUNC(cell_FreeType2, FT_Remove_Module); - REG_FUNC(cell_FreeType2, FT_Render_Glyph); - REG_FUNC(cell_FreeType2, FT_Request_Size); - REG_FUNC(cell_FreeType2, FT_RoundFix); - REG_FUNC(cell_FreeType2, FT_Select_Charmap); - REG_FUNC(cell_FreeType2, FT_Select_Size); - REG_FUNC(cell_FreeType2, FT_Set_Charmap); - REG_FUNC(cell_FreeType2, FT_Set_Char_Size); - REG_FUNC(cell_FreeType2, FT_Set_Debug_Hook); - REG_FUNC(cell_FreeType2, FT_Set_MM_Blend_Coordinates); - REG_FUNC(cell_FreeType2, FT_Set_MM_Design_Coordinates); - REG_FUNC(cell_FreeType2, FT_Set_Pixel_Sizes); - REG_FUNC(cell_FreeType2, FT_Set_Renderer); - REG_FUNC(cell_FreeType2, FT_Set_Transform); - REG_FUNC(cell_FreeType2, FT_Set_Var_Blend_Coordinates); - REG_FUNC(cell_FreeType2, FT_Set_Var_Design_Coordinates); - REG_FUNC(cell_FreeType2, FT_Sfnt_Table_Info); - REG_FUNC(cell_FreeType2, FT_Sin); - REG_FUNC(cell_FreeType2, FT_Stream_OpenGzip); - REG_FUNC(cell_FreeType2, FT_Stream_OpenLZW); - REG_FUNC(cell_FreeType2, FT_Stroker_BeginSubPath); - REG_FUNC(cell_FreeType2, FT_Stroker_ConicTo); - REG_FUNC(cell_FreeType2, FT_Stroker_CubicTo); - REG_FUNC(cell_FreeType2, FT_Stroker_Done); - REG_FUNC(cell_FreeType2, FT_Stroker_EndSubPath); - REG_FUNC(cell_FreeType2, FT_Stroker_Export); - REG_FUNC(cell_FreeType2, FT_Stroker_ExportBorder); - REG_FUNC(cell_FreeType2, FT_Stroker_GetBorderCounts); - REG_FUNC(cell_FreeType2, FT_Stroker_GetCounts); - REG_FUNC(cell_FreeType2, FT_Stroker_LineTo); - REG_FUNC(cell_FreeType2, FT_Stroker_New); - REG_FUNC(cell_FreeType2, FT_Stroker_ParseOutline); - REG_FUNC(cell_FreeType2, FT_Stroker_Rewind); - REG_FUNC(cell_FreeType2, FT_Stroker_Set); - REG_FUNC(cell_FreeType2, FT_Tan); - REG_FUNC(cell_FreeType2, FT_Vector_From_Polar); - REG_FUNC(cell_FreeType2, FT_Vector_Length); - REG_FUNC(cell_FreeType2, FT_Vector_Polarize); - REG_FUNC(cell_FreeType2, FT_Vector_Rotate); - REG_FUNC(cell_FreeType2, FT_Vector_Transform); - REG_FUNC(cell_FreeType2, FT_Vector_Unit); -}); + REG_FUNC(cell_FreeType2, FT_Activate_Size); + REG_FUNC(cell_FreeType2, FT_Add_Default_Modules); + REG_FUNC(cell_FreeType2, FT_Add_Module); + REG_FUNC(cell_FreeType2, FT_Alloc); + REG_FUNC(cell_FreeType2, FT_Angle_Diff); + REG_FUNC(cell_FreeType2, FT_Atan2); + REG_FUNC(cell_FreeType2, FT_Attach_File); + REG_FUNC(cell_FreeType2, FT_Attach_Stream); + REG_FUNC(cell_FreeType2, FT_Bitmap_Convert); + REG_FUNC(cell_FreeType2, FT_Bitmap_Copy); + REG_FUNC(cell_FreeType2, FT_Bitmap_Done); + REG_FUNC(cell_FreeType2, FT_Bitmap_Embolden); + REG_FUNC(cell_FreeType2, FT_Bitmap_New); + REG_FUNC(cell_FreeType2, FTC_CMapCache_Lookup); + REG_FUNC(cell_FreeType2, FTC_CMapCache_New); + REG_FUNC(cell_FreeType2, FT_CeilFix); + REG_FUNC(cell_FreeType2, FTC_ImageCache_Lookup); + REG_FUNC(cell_FreeType2, FTC_ImageCache_New); + REG_FUNC(cell_FreeType2, FTC_Manager_Done); + REG_FUNC(cell_FreeType2, FTC_Manager_LookupFace); + REG_FUNC(cell_FreeType2, FTC_Manager_LookupSize); + REG_FUNC(cell_FreeType2, FTC_Manager_New); + REG_FUNC(cell_FreeType2, FTC_Manager_RemoveFaceID); + REG_FUNC(cell_FreeType2, FTC_Node_Unref); + REG_FUNC(cell_FreeType2, FT_Cos); + REG_FUNC(cell_FreeType2, FTC_SBitCache_Lookup); + REG_FUNC(cell_FreeType2, FTC_SBitCache_New); + REG_FUNC(cell_FreeType2, FT_DivFix); + REG_FUNC(cell_FreeType2, FT_Done_Face); + REG_FUNC(cell_FreeType2, FT_Done_FreeType); + REG_FUNC(cell_FreeType2, FT_Done_Glyph); + REG_FUNC(cell_FreeType2, FT_Done_Library); + REG_FUNC(cell_FreeType2, FT_Done_Size); + REG_FUNC(cell_FreeType2, FT_FloorFix); + REG_FUNC(cell_FreeType2, FT_Free); + REG_FUNC(cell_FreeType2, FT_Get_BDF_Charset_ID); + REG_FUNC(cell_FreeType2, FT_Get_BDF_Property); + REG_FUNC(cell_FreeType2, FT_Get_Char_Index); + REG_FUNC(cell_FreeType2, FT_Get_Charmap_Index); + REG_FUNC(cell_FreeType2, FT_Get_CMap_Language_ID); + REG_FUNC(cell_FreeType2, FT_Get_First_Char); + REG_FUNC(cell_FreeType2, FT_Get_Glyph); + REG_FUNC(cell_FreeType2, FT_Get_Glyph_Name); + REG_FUNC(cell_FreeType2, FT_Get_Kerning); + REG_FUNC(cell_FreeType2, FT_Get_MM_Var); + REG_FUNC(cell_FreeType2, FT_Get_Module); + REG_FUNC(cell_FreeType2, FT_Get_Multi_Master); + REG_FUNC(cell_FreeType2, FT_Get_Name_Index); + REG_FUNC(cell_FreeType2, FT_Get_Next_Char); + REG_FUNC(cell_FreeType2, FT_Get_PFR_Advance); + REG_FUNC(cell_FreeType2, FT_Get_PFR_Kerning); + REG_FUNC(cell_FreeType2, FT_Get_PFR_Metrics); + REG_FUNC(cell_FreeType2, FT_Get_Postscript_Name); + REG_FUNC(cell_FreeType2, FT_Get_PS_Font_Info); + REG_FUNC(cell_FreeType2, FT_Get_PS_Font_Private); + REG_FUNC(cell_FreeType2, FT_Get_Renderer); + REG_FUNC(cell_FreeType2, FT_Get_Sfnt_Name); + REG_FUNC(cell_FreeType2, FT_Get_Sfnt_Name_Count); + REG_FUNC(cell_FreeType2, FT_Get_Sfnt_Table); + REG_FUNC(cell_FreeType2, FT_Get_SubGlyph_Info); + REG_FUNC(cell_FreeType2, FT_Get_Track_Kerning); + REG_FUNC(cell_FreeType2, FT_Get_TrueType_Engine_Type); + REG_FUNC(cell_FreeType2, FT_Get_WinFNT_Header); + REG_FUNC(cell_FreeType2, FT_Get_X11_Font_Format); + REG_FUNC(cell_FreeType2, FT_Glyph_Copy); + REG_FUNC(cell_FreeType2, FT_Glyph_Get_CBox); + REG_FUNC(cell_FreeType2, FT_GlyphSlot_Own_Bitmap); + REG_FUNC(cell_FreeType2, FT_Glyph_Stroke); + REG_FUNC(cell_FreeType2, FT_Glyph_StrokeBorder); + REG_FUNC(cell_FreeType2, FT_Glyph_To_Bitmap); + REG_FUNC(cell_FreeType2, FT_Glyph_Transform); + REG_FUNC(cell_FreeType2, FT_Has_PS_Glyph_Names); + REG_FUNC(cell_FreeType2, FT_Init_FreeType); + REG_FUNC(cell_FreeType2, FT_Library_Version); + REG_FUNC(cell_FreeType2, FT_List_Add); + REG_FUNC(cell_FreeType2, FT_List_Finalize); + REG_FUNC(cell_FreeType2, FT_List_Find); + REG_FUNC(cell_FreeType2, FT_List_Insert); + REG_FUNC(cell_FreeType2, FT_List_Iterate); + REG_FUNC(cell_FreeType2, FT_List_Remove); + REG_FUNC(cell_FreeType2, FT_List_Up); + REG_FUNC(cell_FreeType2, FT_Load_Char); + REG_FUNC(cell_FreeType2, FT_Load_Glyph); + REG_FUNC(cell_FreeType2, FT_Load_Sfnt_Table); + REG_FUNC(cell_FreeType2, FT_Matrix_Invert); + REG_FUNC(cell_FreeType2, FT_Matrix_Multiply); + REG_FUNC(cell_FreeType2, FT_MulDiv); + REG_FUNC(cell_FreeType2, FT_MulFix); + REG_FUNC(cell_FreeType2, FT_New_Face); + REG_FUNC(cell_FreeType2, FT_New_Library); + REG_FUNC(cell_FreeType2, FT_New_Memory); + REG_FUNC(cell_FreeType2, FT_New_Memory_Face); + REG_FUNC(cell_FreeType2, FT_New_Size); + REG_FUNC(cell_FreeType2, FT_Open_Face); + REG_FUNC(cell_FreeType2, FT_OpenType_Free); + REG_FUNC(cell_FreeType2, FT_OpenType_Validate); + REG_FUNC(cell_FreeType2, FT_Outline_Check); + REG_FUNC(cell_FreeType2, FT_Outline_Copy); + REG_FUNC(cell_FreeType2, FT_Outline_Decompose); + REG_FUNC(cell_FreeType2, FT_Outline_Done); + REG_FUNC(cell_FreeType2, FT_Outline_Embolden); + REG_FUNC(cell_FreeType2, FT_Outline_Get_BBox); + REG_FUNC(cell_FreeType2, FT_Outline_Get_Bitmap); + REG_FUNC(cell_FreeType2, FT_Outline_Get_CBox); + REG_FUNC(cell_FreeType2, FT_Outline_GetInsideBorder); + REG_FUNC(cell_FreeType2, FT_Outline_Get_Orientation); + REG_FUNC(cell_FreeType2, FT_Outline_GetOutsideBorder); + REG_FUNC(cell_FreeType2, FT_Outline_New); + REG_FUNC(cell_FreeType2, FT_Outline_Render); + REG_FUNC(cell_FreeType2, FT_Outline_Reverse); + REG_FUNC(cell_FreeType2, FT_Outline_Transform); + REG_FUNC(cell_FreeType2, FT_Outline_Translate); + REG_FUNC(cell_FreeType2, FT_Realloc); + REG_FUNC(cell_FreeType2, FT_Remove_Module); + REG_FUNC(cell_FreeType2, FT_Render_Glyph); + REG_FUNC(cell_FreeType2, FT_Request_Size); + REG_FUNC(cell_FreeType2, FT_RoundFix); + REG_FUNC(cell_FreeType2, FT_Select_Charmap); + REG_FUNC(cell_FreeType2, FT_Select_Size); + REG_FUNC(cell_FreeType2, FT_Set_Charmap); + REG_FUNC(cell_FreeType2, FT_Set_Char_Size); + REG_FUNC(cell_FreeType2, FT_Set_Debug_Hook); + REG_FUNC(cell_FreeType2, FT_Set_MM_Blend_Coordinates); + REG_FUNC(cell_FreeType2, FT_Set_MM_Design_Coordinates); + REG_FUNC(cell_FreeType2, FT_Set_Pixel_Sizes); + REG_FUNC(cell_FreeType2, FT_Set_Renderer); + REG_FUNC(cell_FreeType2, FT_Set_Transform); + REG_FUNC(cell_FreeType2, FT_Set_Var_Blend_Coordinates); + REG_FUNC(cell_FreeType2, FT_Set_Var_Design_Coordinates); + REG_FUNC(cell_FreeType2, FT_Sfnt_Table_Info); + REG_FUNC(cell_FreeType2, FT_Sin); + REG_FUNC(cell_FreeType2, FT_Stream_OpenGzip); + REG_FUNC(cell_FreeType2, FT_Stream_OpenLZW); + REG_FUNC(cell_FreeType2, FT_Stroker_BeginSubPath); + REG_FUNC(cell_FreeType2, FT_Stroker_ConicTo); + REG_FUNC(cell_FreeType2, FT_Stroker_CubicTo); + REG_FUNC(cell_FreeType2, FT_Stroker_Done); + REG_FUNC(cell_FreeType2, FT_Stroker_EndSubPath); + REG_FUNC(cell_FreeType2, FT_Stroker_Export); + REG_FUNC(cell_FreeType2, FT_Stroker_ExportBorder); + REG_FUNC(cell_FreeType2, FT_Stroker_GetBorderCounts); + REG_FUNC(cell_FreeType2, FT_Stroker_GetCounts); + REG_FUNC(cell_FreeType2, FT_Stroker_LineTo); + REG_FUNC(cell_FreeType2, FT_Stroker_New); + REG_FUNC(cell_FreeType2, FT_Stroker_ParseOutline); + REG_FUNC(cell_FreeType2, FT_Stroker_Rewind); + REG_FUNC(cell_FreeType2, FT_Stroker_Set); + REG_FUNC(cell_FreeType2, FT_Tan); + REG_FUNC(cell_FreeType2, FT_Vector_From_Polar); + REG_FUNC(cell_FreeType2, FT_Vector_Length); + REG_FUNC(cell_FreeType2, FT_Vector_Polarize); + REG_FUNC(cell_FreeType2, FT_Vector_Rotate); + REG_FUNC(cell_FreeType2, FT_Vector_Transform); + REG_FUNC(cell_FreeType2, FT_Vector_Unit); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/libad_async.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/libad_async.cpp index 78ed823aa..c323b029b 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/libad_async.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/libad_async.cpp @@ -40,11 +40,11 @@ error_code sceAdAsyncCloseContext() } DECLARE(ppu_module_manager::libad_async)("libad_async", []() -{ - REG_FUNC(libad_async, sceAdAsyncOpenContext); - REG_FUNC(libad_async, sceAdAsyncConnectContext); - REG_FUNC(libad_async, sceAdAsyncSpaceOpen); - REG_FUNC(libad_async, sceAdAsyncFlushReports); - REG_FUNC(libad_async, sceAdAsyncSpaceClose); - REG_FUNC(libad_async, sceAdAsyncCloseContext); -}); + { + REG_FUNC(libad_async, sceAdAsyncOpenContext); + REG_FUNC(libad_async, sceAdAsyncConnectContext); + REG_FUNC(libad_async, sceAdAsyncSpaceOpen); + REG_FUNC(libad_async, sceAdAsyncFlushReports); + REG_FUNC(libad_async, sceAdAsyncSpaceClose); + REG_FUNC(libad_async, sceAdAsyncCloseContext); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/libad_core.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/libad_core.cpp index 4d0e54e7a..bd204b7a8 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/libad_core.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/libad_core.cpp @@ -46,12 +46,12 @@ error_code sceAdConnectContext() } DECLARE(ppu_module_manager::libad_core)("libad_core", []() -{ - REG_FUNC(libad_core, sceAdOpenContext); - REG_FUNC(libad_core, sceAdFlushReports); - REG_FUNC(libad_core, sceAdGetAssetInfo); - REG_FUNC(libad_core, sceAdCloseContext); - REG_FUNC(libad_core, sceAdGetSpaceInfo); - REG_FUNC(libad_core, sceAdGetConnectionInfo); - REG_FUNC(libad_core, sceAdConnectContext); -}); + { + REG_FUNC(libad_core, sceAdOpenContext); + REG_FUNC(libad_core, sceAdFlushReports); + REG_FUNC(libad_core, sceAdGetAssetInfo); + REG_FUNC(libad_core, sceAdCloseContext); + REG_FUNC(libad_core, sceAdGetSpaceInfo); + REG_FUNC(libad_core, sceAdGetConnectionInfo); + REG_FUNC(libad_core, sceAdConnectContext); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/libfs_utility_init.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/libfs_utility_init.cpp index cd7346c3d..f65723cbd 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/libfs_utility_init.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/libfs_utility_init.cpp @@ -1,7 +1,6 @@ #include "stdafx.h" #include "Emu/Cell/PPUModule.h" - LOG_CHANNEL(libfs_utility_init); error_code fs_utility_init_1F3CD9F1() @@ -48,7 +47,6 @@ error_code fs_utility_init_6B5896B0(vm::ptr dest) return CELL_OK; } - error_code fs_utility_init_A9B04535(u32 arg1) { libfs_utility_init.todo("fs_utility_init_A9B04535(0x%0x)", arg1); @@ -58,14 +56,12 @@ error_code fs_utility_init_A9B04535(u32 arg1) return CELL_OK; } - error_code fs_utility_init_E7563CE6() { libfs_utility_init.todo("fs_utility_init_E7563CE6()"); return CELL_OK; } - error_code fs_utility_init_F691D443() { libfs_utility_init.todo("fs_utility_init_F691D443()"); @@ -73,13 +69,13 @@ error_code fs_utility_init_F691D443() } DECLARE(ppu_module_manager::libfs_utility_init)("fs_utility_init", []() -{ - REG_FNID(fs_utility_init, 0x1F3CD9F1, fs_utility_init_1F3CD9F1); - REG_FNID(fs_utility_init, 0x263172B8, fs_utility_init_263172B8); - REG_FNID(fs_utility_init, 0x4E949DA4, fs_utility_init_4E949DA4); - REG_FNID(fs_utility_init, 0x665DF255, fs_utility_init_665DF255); - REG_FNID(fs_utility_init, 0x6B5896B0, fs_utility_init_6B5896B0); - REG_FNID(fs_utility_init, 0xA9B04535, fs_utility_init_A9B04535); - REG_FNID(fs_utility_init, 0xE7563CE6, fs_utility_init_E7563CE6); - REG_FNID(fs_utility_init, 0xF691D443, fs_utility_init_F691D443); -}); + { + REG_FNID(fs_utility_init, 0x1F3CD9F1, fs_utility_init_1F3CD9F1); + REG_FNID(fs_utility_init, 0x263172B8, fs_utility_init_263172B8); + REG_FNID(fs_utility_init, 0x4E949DA4, fs_utility_init_4E949DA4); + REG_FNID(fs_utility_init, 0x665DF255, fs_utility_init_665DF255); + REG_FNID(fs_utility_init, 0x6B5896B0, fs_utility_init_6B5896B0); + REG_FNID(fs_utility_init, 0xA9B04535, fs_utility_init_A9B04535); + REG_FNID(fs_utility_init, 0xE7563CE6, fs_utility_init_E7563CE6); + REG_FNID(fs_utility_init, 0xF691D443, fs_utility_init_F691D443); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/libmedi.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/libmedi.cpp index 6ddda8577..9e71ba8b7 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/libmedi.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/libmedi.cpp @@ -63,17 +63,16 @@ error_code cellMediatorSign() return CELL_OK; } - DECLARE(ppu_module_manager::libmedi)("libmedi", []() -{ - REG_FUNC(libmedi, cellMediatorCloseContext); - REG_FUNC(libmedi, cellMediatorCreateContext); - REG_FUNC(libmedi, cellMediatorFlushCache); - REG_FUNC(libmedi, cellMediatorGetProviderUrl); - REG_FUNC(libmedi, cellMediatorGetSignatureLength); - REG_FUNC(libmedi, cellMediatorGetStatus); - REG_FUNC(libmedi, cellMediatorGetUserInfo); - REG_FUNC(libmedi, cellMediatorPostReports); - REG_FUNC(libmedi, cellMediatorReliablePostReports); - REG_FUNC(libmedi, cellMediatorSign); -}); + { + REG_FUNC(libmedi, cellMediatorCloseContext); + REG_FUNC(libmedi, cellMediatorCreateContext); + REG_FUNC(libmedi, cellMediatorFlushCache); + REG_FUNC(libmedi, cellMediatorGetProviderUrl); + REG_FUNC(libmedi, cellMediatorGetSignatureLength); + REG_FUNC(libmedi, cellMediatorGetStatus); + REG_FUNC(libmedi, cellMediatorGetUserInfo); + REG_FUNC(libmedi, cellMediatorPostReports); + REG_FUNC(libmedi, cellMediatorReliablePostReports); + REG_FUNC(libmedi, cellMediatorSign); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/libmixer.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/libmixer.cpp index e92b5c6cf..f60cb193b 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/libmixer.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/libmixer.cpp @@ -10,25 +10,25 @@ LOG_CHANNEL(libmixer); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_LIBMIXER_ERROR_NOT_INITIALIZED); - STR_CASE(CELL_LIBMIXER_ERROR_INVALID_PARAMATER); - STR_CASE(CELL_LIBMIXER_ERROR_NO_MEMORY); - STR_CASE(CELL_LIBMIXER_ERROR_ALREADY_EXIST); - STR_CASE(CELL_LIBMIXER_ERROR_FULL); - STR_CASE(CELL_LIBMIXER_ERROR_NOT_EXIST); - STR_CASE(CELL_LIBMIXER_ERROR_TYPE_MISMATCH); - STR_CASE(CELL_LIBMIXER_ERROR_NOT_FOUND); - } + switch (error) + { + STR_CASE(CELL_LIBMIXER_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_LIBMIXER_ERROR_INVALID_PARAMATER); + STR_CASE(CELL_LIBMIXER_ERROR_NO_MEMORY); + STR_CASE(CELL_LIBMIXER_ERROR_ALREADY_EXIST); + STR_CASE(CELL_LIBMIXER_ERROR_FULL); + STR_CASE(CELL_LIBMIXER_ERROR_NOT_EXIST); + STR_CASE(CELL_LIBMIXER_ERROR_TYPE_MISMATCH); + STR_CASE(CELL_LIBMIXER_ERROR_NOT_FOUND); + } - return unknown; - }); + return unknown; + }); } struct SurMixerConfig @@ -51,10 +51,10 @@ struct SurMixerConfig struct SSPlayer { - bool m_created; // SSPlayerCreate/Remove + bool m_created; // SSPlayerCreate/Remove bool m_connected; // AANConnect/Disconnect - bool m_active; // SSPlayerPlay/Stop - u32 m_channels; // 1 or 2 + bool m_active; // SSPlayerPlay/Stop + u32 m_channels; // 1 or 2 u32 m_addr; u32 m_samples; u32 m_loop_start; @@ -82,19 +82,24 @@ s32 cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, vm::ptr addr switch (type) { case CELL_SURMIXER_CHSTRIP_TYPE1A: - if (port >= g_surmx.ch_strips_1) type = 0; + if (port >= g_surmx.ch_strips_1) + type = 0; break; case CELL_SURMIXER_CHSTRIP_TYPE2A: - if (port >= g_surmx.ch_strips_2) type = 0; + if (port >= g_surmx.ch_strips_2) + type = 0; break; case CELL_SURMIXER_CHSTRIP_TYPE6A: - if (port >= g_surmx.ch_strips_6) type = 0; + if (port >= g_surmx.ch_strips_6) + type = 0; break; case CELL_SURMIXER_CHSTRIP_TYPE8A: - if (port >= g_surmx.ch_strips_8) type = 0; + if (port >= g_surmx.ch_strips_8) + type = 0; break; default: - type = 0; break; + type = 0; + break; } if (aan_handle != 0x11111111 || samples != 256 || !type || offset != 0) @@ -364,7 +369,7 @@ struct surmixer_thread : ppu_thread if (port.state == audio_port_state::started) { - //u64 stamp0 = get_guest_system_time(); + // u64 stamp0 = get_guest_system_time(); memset(g_surmx.mixdata, 0, sizeof(g_surmx.mixdata)); if (g_surmx.cb) @@ -373,86 +378,88 @@ struct surmixer_thread : ppu_thread lv2_obj::sleep(*this); } - //u64 stamp1 = get_guest_system_time(); + // u64 stamp1 = get_guest_system_time(); { std::lock_guard lock(g_surmx.mutex); - 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; - float right = 0.0f; - float speed = std::fabs(p.m_speed); - float fpos = 0.0f; - for (s32 i = 0; i < 256; i++) if (p.m_active) + for (auto& p : g_ssp) + if (p.m_active && p.m_created) { - u32 pos = p.m_position; - s32 pos_inc = 0; - if (p.m_speed > 0.0f) // select direction - { - pos_inc = 1; - } - else if (p.m_speed < 0.0f) - { - pos_inc = -1; - } - s32 shift = i - static_cast(fpos); // change playback speed (simple and rough) - if (shift > 0) - { - // slow playback - pos_inc = 0; // duplicate one sample at this time - fpos += 1.0f; - fpos += speed; - } - else if (shift < 0) - { - // fast playback - i--; // mix two sample into one at this time - fpos -= 1.0f; - } - else - { - fpos += speed; - } - p.m_position += pos_inc; - if (p.m_channels == 1) // get mono data - { - left = right = v[pos] / 32768.f * p.m_level; - } - else if (p.m_channels == 2) // get stereo data - { - left = v[pos * 2 + 0] / 32768.f * p.m_level; - right = v[pos * 2 + 1] / 32768.f * p.m_level; - } - if (p.m_connected) // mix - { - // TODO: m_x, m_y, m_z ignored - 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 == umax && p.m_speed < 0.0f)) // loop or stop - { - if (p.m_loop_mode == CELL_SSPLAYER_LOOP_ON) + auto v = vm::ptrl::make(p.m_addr); // 16-bit LE audio data + float left = 0.0f; + float right = 0.0f; + float speed = std::fabs(p.m_speed); + float fpos = 0.0f; + for (s32 i = 0; i < 256; i++) + if (p.m_active) { - p.m_position = p.m_loop_start; + u32 pos = p.m_position; + s32 pos_inc = 0; + if (p.m_speed > 0.0f) // select direction + { + pos_inc = 1; + } + else if (p.m_speed < 0.0f) + { + pos_inc = -1; + } + s32 shift = i - static_cast(fpos); // change playback speed (simple and rough) + if (shift > 0) + { + // slow playback + pos_inc = 0; // duplicate one sample at this time + fpos += 1.0f; + fpos += speed; + } + else if (shift < 0) + { + // fast playback + i--; // mix two sample into one at this time + fpos -= 1.0f; + } + else + { + fpos += speed; + } + p.m_position += pos_inc; + if (p.m_channels == 1) // get mono data + { + left = right = v[pos] / 32768.f * p.m_level; + } + else if (p.m_channels == 2) // get stereo data + { + left = v[pos * 2 + 0] / 32768.f * p.m_level; + right = v[pos * 2 + 1] / 32768.f * p.m_level; + } + if (p.m_connected) // mix + { + // TODO: m_x, m_y, m_z ignored + 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 == umax && p.m_speed < 0.0f)) // loop or stop + { + if (p.m_loop_mode == CELL_SSPLAYER_LOOP_ON) + { + p.m_position = p.m_loop_start; + } + else if (p.m_loop_mode == CELL_SSPLAYER_ONESHOT_CONT) + { + p.m_position -= pos_inc; // restore position + } + else // oneshot + { + p.m_active = false; + p.m_position = p.m_loop_start; // TODO: check value + } + } } - else if (p.m_loop_mode == CELL_SSPLAYER_ONESHOT_CONT) - { - p.m_position -= pos_inc; // restore position - } - else // oneshot - { - p.m_active = false; - p.m_position = p.m_loop_start; // TODO: check value - } - } } - } } - //u64 stamp2 = get_guest_system_time(); + // u64 stamp2 = get_guest_system_time(); auto buf = vm::_ptr(port.addr.addr() + (g_surmx.mixcount % port.num_blocks) * port.num_channels * AUDIO_BUFFER_SAMPLES * sizeof(float)); @@ -462,9 +469,9 @@ struct surmixer_thread : ppu_thread *buf++ = mixdata; } - //u64 stamp3 = get_guest_system_time(); + // u64 stamp3 = get_guest_system_time(); - //ConLog.Write("Libmixer perf: start=%lld (cb=%lld, ssp=%lld, finalize=%lld)", stamp0 - m_config.start_time, stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2); + // ConLog.Write("Libmixer perf: start=%lld (cb=%lld, ssp=%lld, finalize=%lld)", stamp0 - m_config.start_time, stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2); } g_surmx.mixcount++; @@ -499,7 +506,7 @@ s32 cellSurMixerCreate(vm::cptr config) port->attr = 0; port->size = port->num_channels * port->num_blocks * AUDIO_BUFFER_SAMPLES * sizeof(float); port->level = 1.0f; - port->level_set.store({ 1.0f, 0.0f }); + port->level_set.store({1.0f, 0.0f}); libmixer.warning("*** audio port opened (port=%d)", g_surmx.audio_port); @@ -510,7 +517,7 @@ s32 cellSurMixerCreate(vm::cptr config) libmixer.warning("*** surMixer created (ch1=%d, ch2=%d, ch6=%d, ch8=%d)", config->chStrips1, config->chStrips2, config->chStrips6, config->chStrips8); - //auto thread = idm::make_ptr>("Surmixer Thread"); + // auto thread = idm::make_ptr>("Surmixer Thread"); return CELL_OK; } @@ -685,35 +692,35 @@ f32 cellSurMixerUtilNoteToRatio(u8 refNote, u8 note) } DECLARE(ppu_module_manager::libmixer)("libmixer", []() -{ - REG_FUNC(libmixer, cellAANAddData); - REG_FUNC(libmixer, cellAANConnect); - REG_FUNC(libmixer, cellAANDisconnect); + { + REG_FUNC(libmixer, cellAANAddData); + REG_FUNC(libmixer, cellAANConnect); + REG_FUNC(libmixer, cellAANDisconnect); - REG_FUNC(libmixer, cellSurMixerCreate); - REG_FUNC(libmixer, cellSurMixerGetAANHandle); - REG_FUNC(libmixer, cellSurMixerChStripGetAANPortNo); - REG_FUNC(libmixer, cellSurMixerSetNotifyCallback); - REG_FUNC(libmixer, cellSurMixerRemoveNotifyCallback); - REG_FUNC(libmixer, cellSurMixerStart); - REG_FUNC(libmixer, cellSurMixerSetParameter); - REG_FUNC(libmixer, cellSurMixerFinalize); - REG_FUNC(libmixer, cellSurMixerSurBusAddData); - REG_FUNC(libmixer, cellSurMixerChStripSetParameter); - REG_FUNC(libmixer, cellSurMixerPause); - REG_FUNC(libmixer, cellSurMixerGetCurrentBlockTag); - REG_FUNC(libmixer, cellSurMixerGetTimestamp); - REG_FUNC(libmixer, cellSurMixerBeep); + REG_FUNC(libmixer, cellSurMixerCreate); + REG_FUNC(libmixer, cellSurMixerGetAANHandle); + REG_FUNC(libmixer, cellSurMixerChStripGetAANPortNo); + REG_FUNC(libmixer, cellSurMixerSetNotifyCallback); + REG_FUNC(libmixer, cellSurMixerRemoveNotifyCallback); + REG_FUNC(libmixer, cellSurMixerStart); + REG_FUNC(libmixer, cellSurMixerSetParameter); + REG_FUNC(libmixer, cellSurMixerFinalize); + REG_FUNC(libmixer, cellSurMixerSurBusAddData); + REG_FUNC(libmixer, cellSurMixerChStripSetParameter); + REG_FUNC(libmixer, cellSurMixerPause); + REG_FUNC(libmixer, cellSurMixerGetCurrentBlockTag); + REG_FUNC(libmixer, cellSurMixerGetTimestamp); + REG_FUNC(libmixer, cellSurMixerBeep); - REG_FUNC(libmixer, cellSSPlayerCreate); - REG_FUNC(libmixer, cellSSPlayerRemove); - REG_FUNC(libmixer, cellSSPlayerSetWave); - REG_FUNC(libmixer, cellSSPlayerPlay); - REG_FUNC(libmixer, cellSSPlayerStop); - REG_FUNC(libmixer, cellSSPlayerSetParam); - REG_FUNC(libmixer, cellSSPlayerGetState); + REG_FUNC(libmixer, cellSSPlayerCreate); + REG_FUNC(libmixer, cellSSPlayerRemove); + REG_FUNC(libmixer, cellSSPlayerSetWave); + REG_FUNC(libmixer, cellSSPlayerPlay); + REG_FUNC(libmixer, cellSSPlayerStop); + REG_FUNC(libmixer, cellSSPlayerSetParam); + REG_FUNC(libmixer, cellSSPlayerGetState); - REG_FUNC(libmixer, cellSurMixerUtilGetLevelFromDB); - REG_FUNC(libmixer, cellSurMixerUtilGetLevelFromDBIndex); - REG_FUNC(libmixer, cellSurMixerUtilNoteToRatio); -}); + REG_FUNC(libmixer, cellSurMixerUtilGetLevelFromDB); + REG_FUNC(libmixer, cellSurMixerUtilGetLevelFromDBIndex); + REG_FUNC(libmixer, cellSurMixerUtilNoteToRatio); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/libmixer.h b/rpcs3/rpcs3/Emu/Cell/Modules/libmixer.h index 724ca121f..6056f14cb 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/libmixer.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/libmixer.h @@ -5,14 +5,14 @@ // Error Codes enum CellLibmixerError : u32 { - CELL_LIBMIXER_ERROR_NOT_INITIALIZED = 0x80310002, + CELL_LIBMIXER_ERROR_NOT_INITIALIZED = 0x80310002, CELL_LIBMIXER_ERROR_INVALID_PARAMATER = 0x80310003, - CELL_LIBMIXER_ERROR_NO_MEMORY = 0x80310005, - CELL_LIBMIXER_ERROR_ALREADY_EXIST = 0x80310006, - CELL_LIBMIXER_ERROR_FULL = 0x80310007, - CELL_LIBMIXER_ERROR_NOT_EXIST = 0x80310008, - CELL_LIBMIXER_ERROR_TYPE_MISMATCH = 0x80310009, - CELL_LIBMIXER_ERROR_NOT_FOUND = 0x8031000a, + CELL_LIBMIXER_ERROR_NO_MEMORY = 0x80310005, + CELL_LIBMIXER_ERROR_ALREADY_EXIST = 0x80310006, + CELL_LIBMIXER_ERROR_FULL = 0x80310007, + CELL_LIBMIXER_ERROR_NOT_EXIST = 0x80310008, + CELL_LIBMIXER_ERROR_TYPE_MISMATCH = 0x80310009, + CELL_LIBMIXER_ERROR_NOT_FOUND = 0x8031000a, }; enum @@ -37,7 +37,7 @@ enum CELL_SURMIXER_PARAM_REVERBLEVEL_LINEAR = 9, CELL_SURMIXER_PARAM_TOTALMUTE = 12, - CELL_SURMIXER_PARAM_TOTALLEVEL = 40, // in dB + CELL_SURMIXER_PARAM_TOTALLEVEL = 40, // in dB CELL_SURMIXER_PARAM_REVERBLEVEL = 41, // in dB }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/libsnd3.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/libsnd3.cpp index 0263f92ff..706d97dae 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/libsnd3.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/libsnd3.cpp @@ -5,33 +5,33 @@ LOG_CHANNEL(libsnd3); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SND3_ERROR_PARAM); - STR_CASE(CELL_SND3_ERROR_CREATE_MUTEX); - STR_CASE(CELL_SND3_ERROR_SYNTH); - STR_CASE(CELL_SND3_ERROR_ALREADY); - STR_CASE(CELL_SND3_ERROR_NOTINIT); - STR_CASE(CELL_SND3_ERROR_SMFFULL); - STR_CASE(CELL_SND3_ERROR_HD3ID); - STR_CASE(CELL_SND3_ERROR_SMF); - STR_CASE(CELL_SND3_ERROR_SMFCTX); - STR_CASE(CELL_SND3_ERROR_FORMAT); - STR_CASE(CELL_SND3_ERROR_SMFID); - STR_CASE(CELL_SND3_ERROR_SOUNDDATAFULL); - STR_CASE(CELL_SND3_ERROR_VOICENUM); - STR_CASE(CELL_SND3_ERROR_RESERVEDVOICE); - STR_CASE(CELL_SND3_ERROR_REQUESTQUEFULL); - STR_CASE(CELL_SND3_ERROR_OUTPUTMODE); - } + switch (error) + { + STR_CASE(CELL_SND3_ERROR_PARAM); + STR_CASE(CELL_SND3_ERROR_CREATE_MUTEX); + STR_CASE(CELL_SND3_ERROR_SYNTH); + STR_CASE(CELL_SND3_ERROR_ALREADY); + STR_CASE(CELL_SND3_ERROR_NOTINIT); + STR_CASE(CELL_SND3_ERROR_SMFFULL); + STR_CASE(CELL_SND3_ERROR_HD3ID); + STR_CASE(CELL_SND3_ERROR_SMF); + STR_CASE(CELL_SND3_ERROR_SMFCTX); + STR_CASE(CELL_SND3_ERROR_FORMAT); + STR_CASE(CELL_SND3_ERROR_SMFID); + STR_CASE(CELL_SND3_ERROR_SOUNDDATAFULL); + STR_CASE(CELL_SND3_ERROR_VOICENUM); + STR_CASE(CELL_SND3_ERROR_RESERVEDVOICE); + STR_CASE(CELL_SND3_ERROR_REQUESTQUEFULL); + STR_CASE(CELL_SND3_ERROR_OUTPUTMODE); + } - return unknown; - }); + return unknown; + }); } // Temporarily @@ -339,57 +339,56 @@ error_code cellSnd3SMFGetKeyOnID(u32 smfID, u32 midiChannel, vm::ptr keyOnI return CELL_OK; } - DECLARE(ppu_module_manager::libsnd3)("libsnd3", []() -{ - REG_FUNC(libsnd3, cellSnd3Init); - REG_FUNC(libsnd3, cellSnd3Exit); - REG_FUNC(libsnd3, cellSnd3Note2Pitch); - REG_FUNC(libsnd3, cellSnd3Pitch2Note); - REG_FUNC(libsnd3, cellSnd3SetOutputMode); - REG_FUNC(libsnd3, cellSnd3Synthesis); - REG_FUNC(libsnd3, cellSnd3SynthesisEx); - REG_FUNC(libsnd3, cellSnd3BindSoundData); - REG_FUNC(libsnd3, cellSnd3UnbindSoundData); - REG_FUNC(libsnd3, cellSnd3NoteOnByTone); - REG_FUNC(libsnd3, cellSnd3KeyOnByTone); - REG_FUNC(libsnd3, cellSnd3VoiceNoteOnByTone); - REG_FUNC(libsnd3, cellSnd3VoiceKeyOnByTone); - REG_FUNC(libsnd3, cellSnd3VoiceSetReserveMode); - REG_FUNC(libsnd3, cellSnd3VoiceSetSustainHold); - REG_FUNC(libsnd3, cellSnd3VoiceKeyOff); - REG_FUNC(libsnd3, cellSnd3VoiceSetPitch); - REG_FUNC(libsnd3, cellSnd3VoiceSetVelocity); - REG_FUNC(libsnd3, cellSnd3VoiceSetPanpot); - REG_FUNC(libsnd3, cellSnd3VoiceSetPanpotEx); - REG_FUNC(libsnd3, cellSnd3VoiceSetPitchBend); - REG_FUNC(libsnd3, cellSnd3VoiceAllKeyOff); - REG_FUNC(libsnd3, cellSnd3VoiceGetEnvelope); - REG_FUNC(libsnd3, cellSnd3VoiceGetStatus); - REG_FUNC(libsnd3, cellSnd3KeyOffByID); - REG_FUNC(libsnd3, cellSnd3GetVoice); - REG_FUNC(libsnd3, cellSnd3GetVoiceByID); - REG_FUNC(libsnd3, cellSnd3NoteOn); - REG_FUNC(libsnd3, cellSnd3NoteOff); - REG_FUNC(libsnd3, cellSnd3SetSustainHold); - REG_FUNC(libsnd3, cellSnd3SetEffectType); - REG_FUNC(libsnd3, cellSnd3SMFBind); - REG_FUNC(libsnd3, cellSnd3SMFUnbind); - REG_FUNC(libsnd3, cellSnd3SMFPlay); - REG_FUNC(libsnd3, cellSnd3SMFPlayEx); - REG_FUNC(libsnd3, cellSnd3SMFPause); - REG_FUNC(libsnd3, cellSnd3SMFResume); - REG_FUNC(libsnd3, cellSnd3SMFStop); - REG_FUNC(libsnd3, cellSnd3SMFAddTempo); - REG_FUNC(libsnd3, cellSnd3SMFGetTempo); - REG_FUNC(libsnd3, cellSnd3SMFSetPlayVelocity); - REG_FUNC(libsnd3, cellSnd3SMFGetPlayVelocity); - REG_FUNC(libsnd3, cellSnd3SMFSetPlayPanpot); - REG_FUNC(libsnd3, cellSnd3SMFSetPlayPanpotEx); - REG_FUNC(libsnd3, cellSnd3SMFGetPlayPanpot); - REG_FUNC(libsnd3, cellSnd3SMFGetPlayPanpotEx); - REG_FUNC(libsnd3, cellSnd3SMFGetPlayStatus); - REG_FUNC(libsnd3, cellSnd3SMFSetPlayChannel); - REG_FUNC(libsnd3, cellSnd3SMFGetPlayChannel); - REG_FUNC(libsnd3, cellSnd3SMFGetKeyOnID); -}); + { + REG_FUNC(libsnd3, cellSnd3Init); + REG_FUNC(libsnd3, cellSnd3Exit); + REG_FUNC(libsnd3, cellSnd3Note2Pitch); + REG_FUNC(libsnd3, cellSnd3Pitch2Note); + REG_FUNC(libsnd3, cellSnd3SetOutputMode); + REG_FUNC(libsnd3, cellSnd3Synthesis); + REG_FUNC(libsnd3, cellSnd3SynthesisEx); + REG_FUNC(libsnd3, cellSnd3BindSoundData); + REG_FUNC(libsnd3, cellSnd3UnbindSoundData); + REG_FUNC(libsnd3, cellSnd3NoteOnByTone); + REG_FUNC(libsnd3, cellSnd3KeyOnByTone); + REG_FUNC(libsnd3, cellSnd3VoiceNoteOnByTone); + REG_FUNC(libsnd3, cellSnd3VoiceKeyOnByTone); + REG_FUNC(libsnd3, cellSnd3VoiceSetReserveMode); + REG_FUNC(libsnd3, cellSnd3VoiceSetSustainHold); + REG_FUNC(libsnd3, cellSnd3VoiceKeyOff); + REG_FUNC(libsnd3, cellSnd3VoiceSetPitch); + REG_FUNC(libsnd3, cellSnd3VoiceSetVelocity); + REG_FUNC(libsnd3, cellSnd3VoiceSetPanpot); + REG_FUNC(libsnd3, cellSnd3VoiceSetPanpotEx); + REG_FUNC(libsnd3, cellSnd3VoiceSetPitchBend); + REG_FUNC(libsnd3, cellSnd3VoiceAllKeyOff); + REG_FUNC(libsnd3, cellSnd3VoiceGetEnvelope); + REG_FUNC(libsnd3, cellSnd3VoiceGetStatus); + REG_FUNC(libsnd3, cellSnd3KeyOffByID); + REG_FUNC(libsnd3, cellSnd3GetVoice); + REG_FUNC(libsnd3, cellSnd3GetVoiceByID); + REG_FUNC(libsnd3, cellSnd3NoteOn); + REG_FUNC(libsnd3, cellSnd3NoteOff); + REG_FUNC(libsnd3, cellSnd3SetSustainHold); + REG_FUNC(libsnd3, cellSnd3SetEffectType); + REG_FUNC(libsnd3, cellSnd3SMFBind); + REG_FUNC(libsnd3, cellSnd3SMFUnbind); + REG_FUNC(libsnd3, cellSnd3SMFPlay); + REG_FUNC(libsnd3, cellSnd3SMFPlayEx); + REG_FUNC(libsnd3, cellSnd3SMFPause); + REG_FUNC(libsnd3, cellSnd3SMFResume); + REG_FUNC(libsnd3, cellSnd3SMFStop); + REG_FUNC(libsnd3, cellSnd3SMFAddTempo); + REG_FUNC(libsnd3, cellSnd3SMFGetTempo); + REG_FUNC(libsnd3, cellSnd3SMFSetPlayVelocity); + REG_FUNC(libsnd3, cellSnd3SMFGetPlayVelocity); + REG_FUNC(libsnd3, cellSnd3SMFSetPlayPanpot); + REG_FUNC(libsnd3, cellSnd3SMFSetPlayPanpotEx); + REG_FUNC(libsnd3, cellSnd3SMFGetPlayPanpot); + REG_FUNC(libsnd3, cellSnd3SMFGetPlayPanpotEx); + REG_FUNC(libsnd3, cellSnd3SMFGetPlayStatus); + REG_FUNC(libsnd3, cellSnd3SMFSetPlayChannel); + REG_FUNC(libsnd3, cellSnd3SMFGetPlayChannel); + REG_FUNC(libsnd3, cellSnd3SMFGetKeyOnID); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/libsnd3.h b/rpcs3/rpcs3/Emu/Cell/Modules/libsnd3.h index 8e171d642..03d2760b2 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/libsnd3.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/libsnd3.h @@ -5,22 +5,22 @@ // Error Codes enum CellSnd3Error : u32 { - CELL_SND3_ERROR_PARAM = 0x80310301, - CELL_SND3_ERROR_CREATE_MUTEX = 0x80310302, - CELL_SND3_ERROR_SYNTH = 0x80310303, - CELL_SND3_ERROR_ALREADY = 0x80310304, - CELL_SND3_ERROR_NOTINIT = 0x80310305, - CELL_SND3_ERROR_SMFFULL = 0x80310306, - CELL_SND3_ERROR_HD3ID = 0x80310307, - CELL_SND3_ERROR_SMF = 0x80310308, - CELL_SND3_ERROR_SMFCTX = 0x80310309, - CELL_SND3_ERROR_FORMAT = 0x8031030a, - CELL_SND3_ERROR_SMFID = 0x8031030b, - CELL_SND3_ERROR_SOUNDDATAFULL = 0x8031030c, - CELL_SND3_ERROR_VOICENUM = 0x8031030d, - CELL_SND3_ERROR_RESERVEDVOICE = 0x8031030e, + CELL_SND3_ERROR_PARAM = 0x80310301, + CELL_SND3_ERROR_CREATE_MUTEX = 0x80310302, + CELL_SND3_ERROR_SYNTH = 0x80310303, + CELL_SND3_ERROR_ALREADY = 0x80310304, + CELL_SND3_ERROR_NOTINIT = 0x80310305, + CELL_SND3_ERROR_SMFFULL = 0x80310306, + CELL_SND3_ERROR_HD3ID = 0x80310307, + CELL_SND3_ERROR_SMF = 0x80310308, + CELL_SND3_ERROR_SMFCTX = 0x80310309, + CELL_SND3_ERROR_FORMAT = 0x8031030a, + CELL_SND3_ERROR_SMFID = 0x8031030b, + CELL_SND3_ERROR_SOUNDDATAFULL = 0x8031030c, + CELL_SND3_ERROR_VOICENUM = 0x8031030d, + CELL_SND3_ERROR_RESERVEDVOICE = 0x8031030e, CELL_SND3_ERROR_REQUESTQUEFULL = 0x8031030f, - CELL_SND3_ERROR_OUTPUTMODE = 0x80310310, + CELL_SND3_ERROR_OUTPUTMODE = 0x80310310, }; struct CellSnd3KeyOnParam diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/libsynth2.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/libsynth2.cpp index 390d42bab..2c21f364e 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/libsynth2.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/libsynth2.cpp @@ -3,24 +3,22 @@ #include "libsynth2.h" - - LOG_CHANNEL(libsynth2); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_SOUND_SYNTH2_ERROR_FATAL); - STR_CASE(CELL_SOUND_SYNTH2_ERROR_INVALID_PARAMETER); - STR_CASE(CELL_SOUND_SYNTH2_ERROR_ALREADY_INITIALIZED); - } + switch (error) + { + STR_CASE(CELL_SOUND_SYNTH2_ERROR_FATAL); + STR_CASE(CELL_SOUND_SYNTH2_ERROR_INVALID_PARAMETER); + STR_CASE(CELL_SOUND_SYNTH2_ERROR_ALREADY_INITIALIZED); + } - return unknown; - }); + return unknown; + }); } error_code cellSoundSynth2Config(s16 param, s32 value) @@ -122,24 +120,23 @@ u16 cellSoundSynth2Pitch2Note(u16 center_note, u16 center_fine, u16 pitch) return 0; } - DECLARE(ppu_module_manager::libsynth2)("libsynth2", []() -{ - REG_FUNC(libsynth2, cellSoundSynth2Config); - REG_FUNC(libsynth2, cellSoundSynth2Init); - REG_FUNC(libsynth2, cellSoundSynth2Exit); - REG_FUNC(libsynth2, cellSoundSynth2SetParam); - REG_FUNC(libsynth2, cellSoundSynth2GetParam); - REG_FUNC(libsynth2, cellSoundSynth2SetSwitch); - REG_FUNC(libsynth2, cellSoundSynth2GetSwitch); - REG_FUNC(libsynth2, cellSoundSynth2SetAddr); - REG_FUNC(libsynth2, cellSoundSynth2GetAddr); - REG_FUNC(libsynth2, cellSoundSynth2SetEffectAttr); - REG_FUNC(libsynth2, cellSoundSynth2SetEffectMode); - REG_FUNC(libsynth2, cellSoundSynth2SetCoreAttr); - REG_FUNC(libsynth2, cellSoundSynth2Generate); - REG_FUNC(libsynth2, cellSoundSynth2VoiceTrans); - REG_FUNC(libsynth2, cellSoundSynth2VoiceTransStatus); - REG_FUNC(libsynth2, cellSoundSynth2Note2Pitch); - REG_FUNC(libsynth2, cellSoundSynth2Pitch2Note); -}); + { + REG_FUNC(libsynth2, cellSoundSynth2Config); + REG_FUNC(libsynth2, cellSoundSynth2Init); + REG_FUNC(libsynth2, cellSoundSynth2Exit); + REG_FUNC(libsynth2, cellSoundSynth2SetParam); + REG_FUNC(libsynth2, cellSoundSynth2GetParam); + REG_FUNC(libsynth2, cellSoundSynth2SetSwitch); + REG_FUNC(libsynth2, cellSoundSynth2GetSwitch); + REG_FUNC(libsynth2, cellSoundSynth2SetAddr); + REG_FUNC(libsynth2, cellSoundSynth2GetAddr); + REG_FUNC(libsynth2, cellSoundSynth2SetEffectAttr); + REG_FUNC(libsynth2, cellSoundSynth2SetEffectMode); + REG_FUNC(libsynth2, cellSoundSynth2SetCoreAttr); + REG_FUNC(libsynth2, cellSoundSynth2Generate); + REG_FUNC(libsynth2, cellSoundSynth2VoiceTrans); + REG_FUNC(libsynth2, cellSoundSynth2VoiceTransStatus); + REG_FUNC(libsynth2, cellSoundSynth2Note2Pitch); + REG_FUNC(libsynth2, cellSoundSynth2Pitch2Note); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sceNp.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sceNp.cpp index 9a8e0dba6..9294d295c 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sceNp.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sceNp.cpp @@ -40,536 +40,536 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(GAME_ERR_NOT_XMBBUY_CONTENT); - STR_CASE(SCE_NP_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_ERROR_ID_NO_SPACE); - STR_CASE(SCE_NP_ERROR_ID_NOT_FOUND); - STR_CASE(SCE_NP_ERROR_SESSION_RUNNING); - STR_CASE(SCE_NP_ERROR_LOGINID_ALREADY_EXISTS); - STR_CASE(SCE_NP_ERROR_INVALID_TICKET_SIZE); - STR_CASE(SCE_NP_ERROR_INVALID_STATE); - STR_CASE(SCE_NP_ERROR_ABORTED); - STR_CASE(SCE_NP_ERROR_OFFLINE); - STR_CASE(SCE_NP_ERROR_VARIANT_ACCOUNT_ID); - STR_CASE(SCE_NP_ERROR_GET_CLOCK); - STR_CASE(SCE_NP_ERROR_INSUFFICIENT_BUFFER); - STR_CASE(SCE_NP_ERROR_EXPIRED_TICKET); - STR_CASE(SCE_NP_ERROR_TICKET_PARAM_NOT_FOUND); - STR_CASE(SCE_NP_ERROR_UNSUPPORTED_TICKET_VERSION); - STR_CASE(SCE_NP_ERROR_TICKET_STATUS_CODE_INVALID); - STR_CASE(SCE_NP_ERROR_INVALID_TICKET_VERSION); - STR_CASE(SCE_NP_ERROR_ALREADY_USED); - STR_CASE(SCE_NP_ERROR_DIFFERENT_USER); - STR_CASE(SCE_NP_ERROR_ALREADY_DONE); - STR_CASE(SCE_NP_BASIC_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_BASIC_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_BASIC_ERROR_NOT_SUPPORTED); - STR_CASE(SCE_NP_BASIC_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_BASIC_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_BASIC_ERROR_BAD_ID); - STR_CASE(SCE_NP_BASIC_ERROR_IDS_DIFFER); - STR_CASE(SCE_NP_BASIC_ERROR_PARSER_FAILED); - STR_CASE(SCE_NP_BASIC_ERROR_TIMEOUT); - STR_CASE(SCE_NP_BASIC_ERROR_NO_EVENT); - STR_CASE(SCE_NP_BASIC_ERROR_EXCEEDS_MAX); - STR_CASE(SCE_NP_BASIC_ERROR_INSUFFICIENT); - STR_CASE(SCE_NP_BASIC_ERROR_NOT_REGISTERED); - STR_CASE(SCE_NP_BASIC_ERROR_DATA_LOST); - STR_CASE(SCE_NP_BASIC_ERROR_BUSY); - STR_CASE(SCE_NP_BASIC_ERROR_STATUS); - STR_CASE(SCE_NP_BASIC_ERROR_CANCEL); - STR_CASE(SCE_NP_BASIC_ERROR_INVALID_MEMORY_CONTAINER); - STR_CASE(SCE_NP_BASIC_ERROR_INVALID_DATA_ID); - STR_CASE(SCE_NP_BASIC_ERROR_BROKEN_DATA); - STR_CASE(SCE_NP_BASIC_ERROR_BLOCKLIST_ADD_FAILED); - STR_CASE(SCE_NP_BASIC_ERROR_BLOCKLIST_IS_FULL); - STR_CASE(SCE_NP_BASIC_ERROR_SEND_FAILED); - STR_CASE(SCE_NP_BASIC_ERROR_NOT_CONNECTED); - STR_CASE(SCE_NP_BASIC_ERROR_INSUFFICIENT_DISK_SPACE); - STR_CASE(SCE_NP_BASIC_ERROR_INTERNAL_FAILURE); - STR_CASE(SCE_NP_BASIC_ERROR_DOES_NOT_EXIST); - STR_CASE(SCE_NP_BASIC_ERROR_INVALID); - STR_CASE(SCE_NP_BASIC_ERROR_UNKNOWN); - STR_CASE(SCE_NP_EXT_ERROR_CONTEXT_DOES_NOT_EXIST); - STR_CASE(SCE_NP_EXT_ERROR_CONTEXT_ALREADY_EXISTS); - STR_CASE(SCE_NP_EXT_ERROR_NO_CONTEXT); - STR_CASE(SCE_NP_EXT_ERROR_NO_ORIGIN); - STR_CASE(SCE_NP_UTIL_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_UTIL_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_UTIL_ERROR_INSUFFICIENT); - STR_CASE(SCE_NP_UTIL_ERROR_PARSER_FAILED); - STR_CASE(SCE_NP_UTIL_ERROR_INVALID_PROTOCOL_ID); - STR_CASE(SCE_NP_UTIL_ERROR_INVALID_NP_ID); - STR_CASE(SCE_NP_UTIL_ERROR_INVALID_NP_LOBBY_ID); - STR_CASE(SCE_NP_UTIL_ERROR_INVALID_NP_ROOM_ID); - STR_CASE(SCE_NP_UTIL_ERROR_INVALID_NP_ENV); - STR_CASE(SCE_NP_UTIL_ERROR_INVALID_TITLEID); - STR_CASE(SCE_NP_UTIL_ERROR_INVALID_CHARACTER); - STR_CASE(SCE_NP_UTIL_ERROR_INVALID_ESCAPE_STRING); - STR_CASE(SCE_NP_UTIL_ERROR_UNKNOWN_TYPE); - STR_CASE(SCE_NP_UTIL_ERROR_UNKNOWN); - STR_CASE(SCE_NP_UTIL_ERROR_NOT_MATCH); - STR_CASE(SCE_NP_UTIL_ERROR_UNKNOWN_PLATFORM_TYPE); - STR_CASE(SCE_NP_FRIENDLIST_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_FRIENDLIST_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_FRIENDLIST_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_FRIENDLIST_ERROR_INVALID_MEMORY_CONTAINER); - STR_CASE(SCE_NP_FRIENDLIST_ERROR_INSUFFICIENT); - STR_CASE(SCE_NP_FRIENDLIST_ERROR_CANCEL); - STR_CASE(SCE_NP_FRIENDLIST_ERROR_STATUS); - STR_CASE(SCE_NP_FRIENDLIST_ERROR_BUSY); - STR_CASE(SCE_NP_FRIENDLIST_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_PROFILE_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_PROFILE_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_PROFILE_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_PROFILE_ERROR_NOT_SUPPORTED); - STR_CASE(SCE_NP_PROFILE_ERROR_INSUFFICIENT); - STR_CASE(SCE_NP_PROFILE_ERROR_CANCEL); - STR_CASE(SCE_NP_PROFILE_ERROR_STATUS); - STR_CASE(SCE_NP_PROFILE_ERROR_BUSY); - STR_CASE(SCE_NP_PROFILE_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_PROFILE_ERROR_ABORT); - STR_CASE(SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_COMMUNITY_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_COMMUNITY_ERROR_NO_TITLE_SET); - STR_CASE(SCE_NP_COMMUNITY_ERROR_NO_LOGIN); - STR_CASE(SCE_NP_COMMUNITY_ERROR_TOO_MANY_OBJECTS); - STR_CASE(SCE_NP_COMMUNITY_ERROR_TRANSACTION_STILL_REFERENCED); - STR_CASE(SCE_NP_COMMUNITY_ERROR_ABORTED); - STR_CASE(SCE_NP_COMMUNITY_ERROR_NO_RESOURCE); - STR_CASE(SCE_NP_COMMUNITY_ERROR_BAD_RESPONSE); - STR_CASE(SCE_NP_COMMUNITY_ERROR_BODY_TOO_LARGE); - STR_CASE(SCE_NP_COMMUNITY_ERROR_HTTP_SERVER); - STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_SIGNATURE); - STR_CASE(SCE_NP_COMMUNITY_ERROR_TIMEOUT); - STR_CASE(SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_ARGUMENT); - STR_CASE(SCE_NP_COMMUNITY_ERROR_UNKNOWN_TYPE); - STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_ID); - STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID); - STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_TICKET); - STR_CASE(SCE_NP_COMMUNITY_ERROR_CLIENT_HANDLE_ALREADY_EXISTS); - STR_CASE(SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_BUFFER); - STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_TYPE); - STR_CASE(SCE_NP_COMMUNITY_ERROR_TRANSACTION_ALREADY_END); - STR_CASE(SCE_NP_COMMUNITY_ERROR_TRANSACTION_BEFORE_END); - STR_CASE(SCE_NP_COMMUNITY_ERROR_BUSY_BY_ANOTEHR_TRANSACTION); - STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_ALIGNMENT); - STR_CASE(SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID); - STR_CASE(SCE_NP_COMMUNITY_ERROR_TOO_LARGE_RANGE); - STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_PARTITION); - STR_CASE(SCE_NP_COMMUNITY_ERROR_TOO_MANY_SLOTID); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_BAD_REQUEST); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_TICKET); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_SIGNATURE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_EXPIRED_TICKET); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_NPID); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_FORBIDDEN); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INTERNAL_SERVER_ERROR); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_VERSION_NOT_SUPPORTED); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_SERVICE_UNAVAILABLE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_PLAYER_BANNED); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_RECORD_FORBIDDEN); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_USER_PROFILE_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_UPLOADER_DATA_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_QUOTA_MASTER_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_TITLE_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_BLACKLISTED_USER_ID); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_GAME_RANKING_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_STORE_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_NOT_BEST_SCORE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_LATEST_UPDATE_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_BOARD_MASTER_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_GAME_DATA_MASTER_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ANTICHEAT_DATA); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_TOO_LARGE_DATA); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_USER_NPID); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ENVIRONMENT); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ONLINE_NAME_CHARACTER); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ONLINE_NAME_LENGTH); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ABOUT_ME_CHARACTER); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ABOUT_ME_LENGTH); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_SCORE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_OVER_THE_RANKING_LIMIT); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_FAIL_TO_CREATE_SIGNATURE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_MASTER_INFO_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_OVER_THE_GAME_DATA_LIMIT); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_SELF_DATA_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_USER_NOT_ASSIGNED); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_GAME_DATA_ALREADY_EXISTS); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_TOO_MANY_RESULTS); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_NOT_RECORDABLE_VERSION); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_USER_STORAGE_TITLE_MASTER_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_VIRTUAL_USER); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_USER_STORAGE_DATA_NOT_FOUND); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_CONDITIONS_NOT_SATISFIED); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_MATCHING_BEFORE_SERVICE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_MATCHING_END_OF_SERVICE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_MATCHING_MAINTENANCE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_BEFORE_SERVICE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_END_OF_SERVICE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_MAINTENANCE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_TITLE_USER_STORAGE_BEFORE_SERVICE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_TITLE_USER_STORAGE_END_OF_SERVICE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_TITLE_USER_STORAGE_MAINTENANCE); - STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_UNSPECIFIED); - STR_CASE(SCE_NP_COMMERCE_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_COMMERCE_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_COMMERCE_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_COMMERCE_ERROR_UNSUPPORTED_VERSION); - STR_CASE(SCE_NP_COMMERCE_ERROR_CTX_MAX); - STR_CASE(SCE_NP_COMMERCE_ERROR_CTX_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE_ERROR_CTXID_NOT_AVAILABLE); - STR_CASE(SCE_NP_COMMERCE_ERROR_REQ_MAX); - STR_CASE(SCE_NP_COMMERCE_ERROR_REQ_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE_ERROR_REQID_NOT_AVAILABLE); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_CATEGORY_ID); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_LANG_CODE); - STR_CASE(SCE_NP_COMMERCE_ERROR_REQ_BUSY); - STR_CASE(SCE_NP_COMMERCE_ERROR_INSUFFICIENT_BUFFER); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_REQ_STATE); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_CTX_STATE); - STR_CASE(SCE_NP_COMMERCE_ERROR_UNKNOWN); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_REQ_TYPE); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_MEMORY_CONTAINER); - STR_CASE(SCE_NP_COMMERCE_ERROR_INSUFFICIENT_MEMORY_CONTAINER); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_TYPE); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_STATE); - STR_CASE(SCE_NP_COMMERCE_ERROR_DATA_FLAG_NUM_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE_ERROR_DATA_FLAG_INFO_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_PROVIDER_ID); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_NUM); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_SKU_ID); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_ID); - STR_CASE(SCE_NP_COMMERCE_ERROR_GPC_SEND_REQUEST); - STR_CASE(SCE_NP_COMMERCE_ERROR_GDF_SEND_REQUEST); - STR_CASE(SCE_NP_COMMERCE_ERROR_SDF_SEND_REQUEST); - STR_CASE(SCE_NP_COMMERCE_ERROR_PARSE_PRODUCT_CATEGORY); - STR_CASE(SCE_NP_COMMERCE_ERROR_CURRENCY_INFO_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE_ERROR_CATEGORY_INFO_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE_ERROR_CHILD_CATEGORY_COUNT_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE_ERROR_CHILD_CATEGORY_INFO_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE_ERROR_SKU_COUNT_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE_ERROR_SKU_INFO_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE_ERROR_PLUGIN_LOAD_FAILURE); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_SKU_NUM); - STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_GPC_PROTOCOL_VERSION); - STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_UNEXPECTED); - STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_OUT_OF_SERVICE); - STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_INVALID_SKU); - STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_SERVER_BUSY); - STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_MAINTENANCE); - STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_ACCOUNT_SUSPENDED); - STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_OVER_SPENDING_LIMIT); - STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_NOT_ENOUGH_MONEY); - STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_UNKNOWN); - STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_UNKNOWN); - STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_INVALID_CREDENTIALS); - STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_INVALID_CATEGORY_ID); - STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_SERVICE_END); - STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_SERVICE_STOP); - STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_SERVICE_BUSY); - STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_UNSUPPORTED_VERSION); - STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_INTERNAL_SERVER); - STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_UNKNOWN); - STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_INVALID_CREDENTIALS); - STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_INVALID_FLAGLIST); - STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_SERVICE_END); - STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_SERVICE_STOP); - STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_SERVICE_BUSY); - STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_UNSUPPORTED_VERSION); - STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_UNKNOWN); - STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_INVALID_CREDENTIALS); - STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_INVALID_FLAGLIST); - STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_SERVICE_END); - STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_SERVICE_STOP); - STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_SERVICE_BUSY); - STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_UNSUPPORTED_VERSION); - STR_CASE(SCE_NP_DRM_ERROR_LICENSE_NOT_FOUND); - STR_CASE(SCE_NP_DRM_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_DRM_ERROR_INVALID_PARAM); - STR_CASE(SCE_NP_DRM_ERROR_SERVER_RESPONSE); - STR_CASE(SCE_NP_DRM_ERROR_NO_ENTITLEMENT); - STR_CASE(SCE_NP_DRM_ERROR_BAD_ACT); - STR_CASE(SCE_NP_DRM_ERROR_BAD_FORMAT); - STR_CASE(SCE_NP_DRM_ERROR_NO_LOGIN); - STR_CASE(SCE_NP_DRM_ERROR_INTERNAL); - STR_CASE(SCE_NP_DRM_ERROR_BAD_PERM); - STR_CASE(SCE_NP_DRM_ERROR_UNKNOWN_VERSION); - STR_CASE(SCE_NP_DRM_ERROR_TIME_LIMIT); - STR_CASE(SCE_NP_DRM_ERROR_DIFFERENT_ACCOUNT_ID); - STR_CASE(SCE_NP_DRM_ERROR_DIFFERENT_DRM_TYPE); - STR_CASE(SCE_NP_DRM_ERROR_SERVICE_NOT_STARTED); - STR_CASE(SCE_NP_DRM_ERROR_BUSY); - STR_CASE(SCE_NP_DRM_ERROR_IO); - STR_CASE(SCE_NP_DRM_ERROR_FORMAT); - STR_CASE(SCE_NP_DRM_ERROR_FILENAME); - STR_CASE(SCE_NP_DRM_ERROR_K_LICENSEE); - STR_CASE(SCE_NP_AUTH_EINVAL); - STR_CASE(SCE_NP_AUTH_ENOMEM); - STR_CASE(SCE_NP_AUTH_ESRCH); - STR_CASE(SCE_NP_AUTH_EBUSY); - STR_CASE(SCE_NP_AUTH_EABORT); - STR_CASE(SCE_NP_AUTH_EEXIST); - STR_CASE(SCE_NP_AUTH_EINVALID_ARGUMENT); - STR_CASE(SCE_NP_AUTH_ERROR_SERVICE_END); - STR_CASE(SCE_NP_AUTH_ERROR_SERVICE_DOWN); - STR_CASE(SCE_NP_AUTH_ERROR_SERVICE_BUSY); - STR_CASE(SCE_NP_AUTH_ERROR_SERVER_MAINTENANCE); - STR_CASE(SCE_NP_AUTH_ERROR_INVALID_DATA_LENGTH); - STR_CASE(SCE_NP_AUTH_ERROR_INVALID_USER_AGENT); - STR_CASE(SCE_NP_AUTH_ERROR_INVALID_VERSION); - STR_CASE(SCE_NP_AUTH_ERROR_INVALID_SERVICE_ID); - STR_CASE(SCE_NP_AUTH_ERROR_INVALID_CREDENTIAL); - STR_CASE(SCE_NP_AUTH_ERROR_INVALID_ENTITLEMENT_ID); - STR_CASE(SCE_NP_AUTH_ERROR_INVALID_CONSUMED_COUNT); - STR_CASE(SCE_NP_AUTH_ERROR_INVALID_CONSOLE_ID); - STR_CASE(SCE_NP_AUTH_ERROR_CONSOLE_ID_SUSPENDED); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_CLOSED); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_SUSPENDED); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_EULA); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT1); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT2); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT3); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT4); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT5); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT6); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT7); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT8); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT9); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT10); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT11); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT12); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT13); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT14); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT15); - STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT16); - STR_CASE(SCE_NP_AUTH_ERROR_UNKNOWN); - STR_CASE(SCE_NP_CORE_UTIL_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_CORE_UTIL_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_CORE_UTIL_ERROR_INSUFFICIENT); - STR_CASE(SCE_NP_CORE_UTIL_ERROR_PARSER_FAILED); - STR_CASE(SCE_NP_CORE_UTIL_ERROR_INVALID_PROTOCOL_ID); - STR_CASE(SCE_NP_CORE_UTIL_ERROR_INVALID_EXTENSION); - STR_CASE(SCE_NP_CORE_UTIL_ERROR_INVALID_TEXT); - STR_CASE(SCE_NP_CORE_UTIL_ERROR_UNKNOWN_TYPE); - STR_CASE(SCE_NP_CORE_UTIL_ERROR_UNKNOWN); - STR_CASE(SCE_NP_CORE_PARSER_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_CORE_PARSER_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_CORE_PARSER_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_CORE_PARSER_ERROR_INSUFFICIENT); - STR_CASE(SCE_NP_CORE_PARSER_ERROR_INVALID_FORMAT); - STR_CASE(SCE_NP_CORE_PARSER_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_CORE_PARSER_ERROR_INVALID_HANDLE); - STR_CASE(SCE_NP_CORE_PARSER_ERROR_INVALID_ICON); - STR_CASE(SCE_NP_CORE_PARSER_ERROR_UNKNOWN); - STR_CASE(SCE_NP_CORE_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_CORE_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_CORE_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_CORE_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_CORE_ERROR_ID_NOT_AVAILABLE); - STR_CASE(SCE_NP_CORE_ERROR_USER_OFFLINE); - STR_CASE(SCE_NP_CORE_ERROR_SESSION_RUNNING); - STR_CASE(SCE_NP_CORE_ERROR_SESSION_NOT_ESTABLISHED); - STR_CASE(SCE_NP_CORE_ERROR_SESSION_INVALID_STATE); - STR_CASE(SCE_NP_CORE_ERROR_SESSION_ID_TOO_LONG); - STR_CASE(SCE_NP_CORE_ERROR_SESSION_INVALID_NAMESPACE); - STR_CASE(SCE_NP_CORE_ERROR_CONNECTION_TIMEOUT); - STR_CASE(SCE_NP_CORE_ERROR_GETSOCKOPT); - STR_CASE(SCE_NP_CORE_ERROR_SSL_NOT_INITIALIZED); - STR_CASE(SCE_NP_CORE_ERROR_SSL_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_CORE_ERROR_SSL_NO_CERT); - STR_CASE(SCE_NP_CORE_ERROR_SSL_NO_TRUSTWORTHY_CA); - STR_CASE(SCE_NP_CORE_ERROR_SSL_INVALID_CERT); - STR_CASE(SCE_NP_CORE_ERROR_SSL_CERT_VERIFY); - STR_CASE(SCE_NP_CORE_ERROR_SSL_CN_CHECK); - STR_CASE(SCE_NP_CORE_ERROR_SSL_HANDSHAKE_FAILED); - STR_CASE(SCE_NP_CORE_ERROR_SSL_SEND); - STR_CASE(SCE_NP_CORE_ERROR_SSL_RECV); - STR_CASE(SCE_NP_CORE_ERROR_SSL_CREATE_CTX); - STR_CASE(SCE_NP_CORE_ERROR_PARSE_PEM); - STR_CASE(SCE_NP_CORE_ERROR_INVALID_INITIATE_STREAM); - STR_CASE(SCE_NP_CORE_ERROR_SASL_NOT_SUPPORTED); - STR_CASE(SCE_NP_CORE_ERROR_NAMESPACE_ALREADY_EXISTS); - STR_CASE(SCE_NP_CORE_ERROR_FROM_ALREADY_EXISTS); - STR_CASE(SCE_NP_CORE_ERROR_MODULE_NOT_REGISTERED); - STR_CASE(SCE_NP_CORE_ERROR_MODULE_FROM_NOT_FOUND); - STR_CASE(SCE_NP_CORE_ERROR_UNKNOWN_NAMESPACE); - STR_CASE(SCE_NP_CORE_ERROR_INVALID_VERSION); - STR_CASE(SCE_NP_CORE_ERROR_LOGIN_TIMEOUT); - STR_CASE(SCE_NP_CORE_ERROR_TOO_MANY_SESSIONS); - STR_CASE(SCE_NP_CORE_ERROR_SENDLIST_NOT_FOUND); - STR_CASE(SCE_NP_CORE_ERROR_NO_ID); - STR_CASE(SCE_NP_CORE_ERROR_LOAD_CERTS); - STR_CASE(SCE_NP_CORE_ERROR_NET_SELECT); - STR_CASE(SCE_NP_CORE_ERROR_DISCONNECTED); - STR_CASE(SCE_NP_CORE_ERROR_TICKET_TOO_SMALL); - STR_CASE(SCE_NP_CORE_ERROR_INVALID_TICKET); - STR_CASE(SCE_NP_CORE_ERROR_INVALID_ONLINEID); - STR_CASE(SCE_NP_CORE_ERROR_GETHOSTBYNAME); - STR_CASE(SCE_NP_CORE_ERROR_UNDEFINED_STREAM_ERROR); - STR_CASE(SCE_NP_CORE_ERROR_INTERNAL); - STR_CASE(SCE_NP_CORE_ERROR_DNS_HOST_NOT_FOUND); - STR_CASE(SCE_NP_CORE_ERROR_DNS_TRY_AGAIN); - STR_CASE(SCE_NP_CORE_ERROR_DNS_NO_RECOVERY); - STR_CASE(SCE_NP_CORE_ERROR_DNS_NO_DATA); - STR_CASE(SCE_NP_CORE_ERROR_DNS_NO_ADDRESS); - STR_CASE(SCE_NP_CORE_SERVER_ERROR_CONFLICT); - STR_CASE(SCE_NP_CORE_SERVER_ERROR_NOT_AUTHORIZED); - STR_CASE(SCE_NP_CORE_SERVER_ERROR_REMOTE_CONNECTION_FAILED); - STR_CASE(SCE_NP_CORE_SERVER_ERROR_RESOURCE_CONSTRAINT); - STR_CASE(SCE_NP_CORE_SERVER_ERROR_SYSTEM_SHUTDOWN); - STR_CASE(SCE_NP_CORE_SERVER_ERROR_UNSUPPORTED_CLIENT_VERSION); - STR_CASE(SCE_NP_DRM_INSTALL_ERROR_FORMAT); - STR_CASE(SCE_NP_DRM_INSTALL_ERROR_CHECK); - STR_CASE(SCE_NP_DRM_INSTALL_ERROR_UNSUPPORTED); - STR_CASE(SCE_NP_DRM_SERVER_ERROR_SERVICE_IS_END); - STR_CASE(SCE_NP_DRM_SERVER_ERROR_SERVICE_STOP_TEMPORARILY); - STR_CASE(SCE_NP_DRM_SERVER_ERROR_SERVICE_IS_BUSY); - STR_CASE(SCE_NP_DRM_SERVER_ERROR_INVALID_USER_CREDENTIAL); - STR_CASE(SCE_NP_DRM_SERVER_ERROR_INVALID_PRODUCT_ID); - STR_CASE(SCE_NP_DRM_SERVER_ERROR_ACCOUNT_IS_CLOSED); - STR_CASE(SCE_NP_DRM_SERVER_ERROR_ACCOUNT_IS_SUSPENDED); - STR_CASE(SCE_NP_DRM_SERVER_ERROR_ACTIVATED_CONSOLE_IS_FULL); - STR_CASE(SCE_NP_DRM_SERVER_ERROR_CONSOLE_NOT_ACTIVATED); - STR_CASE(SCE_NP_DRM_SERVER_ERROR_PRIMARY_CONSOLE_CANNOT_CHANGED); - STR_CASE(SCE_NP_DRM_SERVER_ERROR_UNKNOWN); - STR_CASE(SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_SIGNALING_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_SIGNALING_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_SIGNALING_ERROR_CTXID_NOT_AVAILABLE); - STR_CASE(SCE_NP_SIGNALING_ERROR_CTX_NOT_FOUND); - STR_CASE(SCE_NP_SIGNALING_ERROR_REQID_NOT_AVAILABLE); - STR_CASE(SCE_NP_SIGNALING_ERROR_REQ_NOT_FOUND); - STR_CASE(SCE_NP_SIGNALING_ERROR_PARSER_CREATE_FAILED); - STR_CASE(SCE_NP_SIGNALING_ERROR_PARSER_FAILED); - STR_CASE(SCE_NP_SIGNALING_ERROR_INVALID_NAMESPACE); - STR_CASE(SCE_NP_SIGNALING_ERROR_NETINFO_NOT_AVAILABLE); - STR_CASE(SCE_NP_SIGNALING_ERROR_PEER_NOT_RESPONDING); - STR_CASE(SCE_NP_SIGNALING_ERROR_CONNID_NOT_AVAILABLE); - STR_CASE(SCE_NP_SIGNALING_ERROR_CONN_NOT_FOUND); - STR_CASE(SCE_NP_SIGNALING_ERROR_PEER_UNREACHABLE); - STR_CASE(SCE_NP_SIGNALING_ERROR_TERMINATED_BY_PEER); - STR_CASE(SCE_NP_SIGNALING_ERROR_TIMEOUT); - STR_CASE(SCE_NP_SIGNALING_ERROR_CTX_MAX); - STR_CASE(SCE_NP_SIGNALING_ERROR_RESULT_NOT_FOUND); - STR_CASE(SCE_NP_SIGNALING_ERROR_CONN_IN_PROGRESS); - STR_CASE(SCE_NP_SIGNALING_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_SIGNALING_ERROR_OWN_NP_ID); - STR_CASE(SCE_NP_SIGNALING_ERROR_TOO_MANY_CONN); - STR_CASE(SCE_NP_SIGNALING_ERROR_TERMINATED_BY_MYSELF); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_NOT_SUPPORTED); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_INSUFFICIENT); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_CANCEL); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_STATUS); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_BUSY); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_ABORT); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_NOT_REGISTERED); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_EXCEEDS_MAX); - STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_INVALID_CHARACTER); - STR_CASE(SCE_NP_EULA_ERROR_UNKNOWN); - STR_CASE(SCE_NP_EULA_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_EULA_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_EULA_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_EULA_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_EULA_ERROR_BUSY); - STR_CASE(SCE_NP_EULA_ERROR_EULA_NOT_FOUND); - STR_CASE(SCE_NP_EULA_ERROR_NET_OUT_OF_MEMORY); - STR_CASE(SCE_NP_EULA_ERROR_CONF_FORMAT); - STR_CASE(SCE_NP_EULA_ERROR_CONF_INVALID_FILENAME); - STR_CASE(SCE_NP_EULA_ERROR_CONF_TOO_MANY_EULA_FILES); - STR_CASE(SCE_NP_EULA_ERROR_CONF_INVALID_LANGUAGE); - STR_CASE(SCE_NP_EULA_ERROR_CONF_INVALID_COUNTRY); - STR_CASE(SCE_NP_EULA_ERROR_CONF_INVALID_NPCOMMID); - STR_CASE(SCE_NP_EULA_ERROR_CONF_INVALID_EULA_VERSION); - STR_CASE(SCE_NP_MATCHING_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_MATCHING_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_ARG); - STR_CASE(SCE_NP_MATCHING_ERROR_TERMINATED); - STR_CASE(SCE_NP_MATCHING_ERROR_TIMEOUT); - STR_CASE(SCE_NP_MATCHING_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_MATCHING_ERROR_CTXID_NOT_AVAIL); - STR_CASE(SCE_NP_MATCHING_ERROR_CTX_ALREADY_EXIST); - STR_CASE(SCE_NP_MATCHING_ERROR_CTX_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING_ERROR_LOBBY_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING_ERROR_ROOM_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING_ERROR_MEMBER_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING_ERROR_TOO_BIG_VALUE); - STR_CASE(SCE_NP_MATCHING_ERROR_IVALID_ATTR_TYPE); - STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_ATTR_ID); - STR_CASE(SCE_NP_MATCHING_ERROR_ALREADY_REQUESTED); - STR_CASE(SCE_NP_MATCHING_ERROR_LIMITTED_SEATING); - STR_CASE(SCE_NP_MATCHING_ERROR_LOCKED); - STR_CASE(SCE_NP_MATCHING_ERROR_CTX_STILL_RUNNING); - STR_CASE(SCE_NP_MATCHING_ERROR_INSUFFICIENT_BUFFER); - STR_CASE(SCE_NP_MATCHING_ERROR_REQUEST_NOT_ALLOWED); - STR_CASE(SCE_NP_MATCHING_ERROR_CTX_MAX); - STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_REQ_ID); - STR_CASE(SCE_NP_MATCHING_ERROR_RESULT_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING_ERROR_BUSY); - STR_CASE(SCE_NP_MATCHING_ERROR_ALREADY_JOINED_ROOM); - STR_CASE(SCE_NP_MATCHING_ERROR_ROOM_MAX); - STR_CASE(SCE_NP_MATCHING_ERROR_QUICK_MATCH_PLAYER_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING_ERROR_COND_MAX); - STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_COND); - STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_ATTR); - STR_CASE(SCE_NP_MATCHING_ERROR_COMP_OP_INEQUALITY_MAX); - STR_CASE(SCE_NP_MATCHING_ERROR_RESULT_OVERFLOWED); - STR_CASE(SCE_NP_MATCHING_ERROR_HTTPXML_TIMEOUT); - STR_CASE(SCE_NP_MATCHING_ERROR_CANCELED); - STR_CASE(SCE_NP_MATCHING_ERROR_SEARCH_JOIN_ROOM_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_COMP_OP); - STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_COMP_TYPE); - STR_CASE(SCE_NP_MATCHING_ERROR_REQUEST_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING_ERROR_INTERNAL_ERROR); - STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_PROTOCOL_ID); - STR_CASE(SCE_NP_MATCHING_ERROR_ATTR_NOT_SPECIFIED); - STR_CASE(SCE_NP_MATCHING_ERROR_SYSUTIL_INVALID_RESULT); - STR_CASE(SCE_NP_MATCHING_ERROR_PLUGIN_LOAD_FAILURE); - STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_ATTR_VALUE); - STR_CASE(SCE_NP_MATCHING_ERROR_DUPLICATE); - STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_MEMORY_CONTAINER); - STR_CASE(SCE_NP_MATCHING_ERROR_SHUTDOWN); - STR_CASE(SCE_NP_MATCHING_ERROR_SYSUTIL_SERVER_BUSY); - STR_CASE(SCE_NP_MATCHING_ERROR_SEND_INVITATION_PARTIALLY_FAILED); - STR_CASE(SCE_NP_MATCHING_ERROR_UTILITY_UNAVAILABLE); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_OUT_OF_SERVICE); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_MAINTENANCE); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_SERVER_BUSY); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_ACCESS_FORBIDDEN); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_SERVER); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_LOBBY); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_ROOM); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_USER); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_NOT_ALLOWED); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_UNKNOWN); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_BAD_REQUEST_STANZA); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_REQUEST_FORBIDDEN); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_INTERNAL_ERROR); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_ROOM_OVER); - STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_ROOM_CLOSED); - } + switch (error) + { + STR_CASE(GAME_ERR_NOT_XMBBUY_CONTENT); + STR_CASE(SCE_NP_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_ERROR_ID_NO_SPACE); + STR_CASE(SCE_NP_ERROR_ID_NOT_FOUND); + STR_CASE(SCE_NP_ERROR_SESSION_RUNNING); + STR_CASE(SCE_NP_ERROR_LOGINID_ALREADY_EXISTS); + STR_CASE(SCE_NP_ERROR_INVALID_TICKET_SIZE); + STR_CASE(SCE_NP_ERROR_INVALID_STATE); + STR_CASE(SCE_NP_ERROR_ABORTED); + STR_CASE(SCE_NP_ERROR_OFFLINE); + STR_CASE(SCE_NP_ERROR_VARIANT_ACCOUNT_ID); + STR_CASE(SCE_NP_ERROR_GET_CLOCK); + STR_CASE(SCE_NP_ERROR_INSUFFICIENT_BUFFER); + STR_CASE(SCE_NP_ERROR_EXPIRED_TICKET); + STR_CASE(SCE_NP_ERROR_TICKET_PARAM_NOT_FOUND); + STR_CASE(SCE_NP_ERROR_UNSUPPORTED_TICKET_VERSION); + STR_CASE(SCE_NP_ERROR_TICKET_STATUS_CODE_INVALID); + STR_CASE(SCE_NP_ERROR_INVALID_TICKET_VERSION); + STR_CASE(SCE_NP_ERROR_ALREADY_USED); + STR_CASE(SCE_NP_ERROR_DIFFERENT_USER); + STR_CASE(SCE_NP_ERROR_ALREADY_DONE); + STR_CASE(SCE_NP_BASIC_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_BASIC_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_BASIC_ERROR_NOT_SUPPORTED); + STR_CASE(SCE_NP_BASIC_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_BASIC_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_BASIC_ERROR_BAD_ID); + STR_CASE(SCE_NP_BASIC_ERROR_IDS_DIFFER); + STR_CASE(SCE_NP_BASIC_ERROR_PARSER_FAILED); + STR_CASE(SCE_NP_BASIC_ERROR_TIMEOUT); + STR_CASE(SCE_NP_BASIC_ERROR_NO_EVENT); + STR_CASE(SCE_NP_BASIC_ERROR_EXCEEDS_MAX); + STR_CASE(SCE_NP_BASIC_ERROR_INSUFFICIENT); + STR_CASE(SCE_NP_BASIC_ERROR_NOT_REGISTERED); + STR_CASE(SCE_NP_BASIC_ERROR_DATA_LOST); + STR_CASE(SCE_NP_BASIC_ERROR_BUSY); + STR_CASE(SCE_NP_BASIC_ERROR_STATUS); + STR_CASE(SCE_NP_BASIC_ERROR_CANCEL); + STR_CASE(SCE_NP_BASIC_ERROR_INVALID_MEMORY_CONTAINER); + STR_CASE(SCE_NP_BASIC_ERROR_INVALID_DATA_ID); + STR_CASE(SCE_NP_BASIC_ERROR_BROKEN_DATA); + STR_CASE(SCE_NP_BASIC_ERROR_BLOCKLIST_ADD_FAILED); + STR_CASE(SCE_NP_BASIC_ERROR_BLOCKLIST_IS_FULL); + STR_CASE(SCE_NP_BASIC_ERROR_SEND_FAILED); + STR_CASE(SCE_NP_BASIC_ERROR_NOT_CONNECTED); + STR_CASE(SCE_NP_BASIC_ERROR_INSUFFICIENT_DISK_SPACE); + STR_CASE(SCE_NP_BASIC_ERROR_INTERNAL_FAILURE); + STR_CASE(SCE_NP_BASIC_ERROR_DOES_NOT_EXIST); + STR_CASE(SCE_NP_BASIC_ERROR_INVALID); + STR_CASE(SCE_NP_BASIC_ERROR_UNKNOWN); + STR_CASE(SCE_NP_EXT_ERROR_CONTEXT_DOES_NOT_EXIST); + STR_CASE(SCE_NP_EXT_ERROR_CONTEXT_ALREADY_EXISTS); + STR_CASE(SCE_NP_EXT_ERROR_NO_CONTEXT); + STR_CASE(SCE_NP_EXT_ERROR_NO_ORIGIN); + STR_CASE(SCE_NP_UTIL_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_UTIL_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_UTIL_ERROR_INSUFFICIENT); + STR_CASE(SCE_NP_UTIL_ERROR_PARSER_FAILED); + STR_CASE(SCE_NP_UTIL_ERROR_INVALID_PROTOCOL_ID); + STR_CASE(SCE_NP_UTIL_ERROR_INVALID_NP_ID); + STR_CASE(SCE_NP_UTIL_ERROR_INVALID_NP_LOBBY_ID); + STR_CASE(SCE_NP_UTIL_ERROR_INVALID_NP_ROOM_ID); + STR_CASE(SCE_NP_UTIL_ERROR_INVALID_NP_ENV); + STR_CASE(SCE_NP_UTIL_ERROR_INVALID_TITLEID); + STR_CASE(SCE_NP_UTIL_ERROR_INVALID_CHARACTER); + STR_CASE(SCE_NP_UTIL_ERROR_INVALID_ESCAPE_STRING); + STR_CASE(SCE_NP_UTIL_ERROR_UNKNOWN_TYPE); + STR_CASE(SCE_NP_UTIL_ERROR_UNKNOWN); + STR_CASE(SCE_NP_UTIL_ERROR_NOT_MATCH); + STR_CASE(SCE_NP_UTIL_ERROR_UNKNOWN_PLATFORM_TYPE); + STR_CASE(SCE_NP_FRIENDLIST_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_FRIENDLIST_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_FRIENDLIST_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_FRIENDLIST_ERROR_INVALID_MEMORY_CONTAINER); + STR_CASE(SCE_NP_FRIENDLIST_ERROR_INSUFFICIENT); + STR_CASE(SCE_NP_FRIENDLIST_ERROR_CANCEL); + STR_CASE(SCE_NP_FRIENDLIST_ERROR_STATUS); + STR_CASE(SCE_NP_FRIENDLIST_ERROR_BUSY); + STR_CASE(SCE_NP_FRIENDLIST_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_PROFILE_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_PROFILE_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_PROFILE_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_PROFILE_ERROR_NOT_SUPPORTED); + STR_CASE(SCE_NP_PROFILE_ERROR_INSUFFICIENT); + STR_CASE(SCE_NP_PROFILE_ERROR_CANCEL); + STR_CASE(SCE_NP_PROFILE_ERROR_STATUS); + STR_CASE(SCE_NP_PROFILE_ERROR_BUSY); + STR_CASE(SCE_NP_PROFILE_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_PROFILE_ERROR_ABORT); + STR_CASE(SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_COMMUNITY_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_COMMUNITY_ERROR_NO_TITLE_SET); + STR_CASE(SCE_NP_COMMUNITY_ERROR_NO_LOGIN); + STR_CASE(SCE_NP_COMMUNITY_ERROR_TOO_MANY_OBJECTS); + STR_CASE(SCE_NP_COMMUNITY_ERROR_TRANSACTION_STILL_REFERENCED); + STR_CASE(SCE_NP_COMMUNITY_ERROR_ABORTED); + STR_CASE(SCE_NP_COMMUNITY_ERROR_NO_RESOURCE); + STR_CASE(SCE_NP_COMMUNITY_ERROR_BAD_RESPONSE); + STR_CASE(SCE_NP_COMMUNITY_ERROR_BODY_TOO_LARGE); + STR_CASE(SCE_NP_COMMUNITY_ERROR_HTTP_SERVER); + STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_SIGNATURE); + STR_CASE(SCE_NP_COMMUNITY_ERROR_TIMEOUT); + STR_CASE(SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_ARGUMENT); + STR_CASE(SCE_NP_COMMUNITY_ERROR_UNKNOWN_TYPE); + STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_ID); + STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID); + STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_TICKET); + STR_CASE(SCE_NP_COMMUNITY_ERROR_CLIENT_HANDLE_ALREADY_EXISTS); + STR_CASE(SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_BUFFER); + STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_TYPE); + STR_CASE(SCE_NP_COMMUNITY_ERROR_TRANSACTION_ALREADY_END); + STR_CASE(SCE_NP_COMMUNITY_ERROR_TRANSACTION_BEFORE_END); + STR_CASE(SCE_NP_COMMUNITY_ERROR_BUSY_BY_ANOTEHR_TRANSACTION); + STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_ALIGNMENT); + STR_CASE(SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID); + STR_CASE(SCE_NP_COMMUNITY_ERROR_TOO_LARGE_RANGE); + STR_CASE(SCE_NP_COMMUNITY_ERROR_INVALID_PARTITION); + STR_CASE(SCE_NP_COMMUNITY_ERROR_TOO_MANY_SLOTID); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_BAD_REQUEST); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_TICKET); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_SIGNATURE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_EXPIRED_TICKET); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_NPID); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_FORBIDDEN); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INTERNAL_SERVER_ERROR); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_VERSION_NOT_SUPPORTED); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_SERVICE_UNAVAILABLE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_PLAYER_BANNED); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_RECORD_FORBIDDEN); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_USER_PROFILE_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_UPLOADER_DATA_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_QUOTA_MASTER_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_TITLE_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_BLACKLISTED_USER_ID); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_GAME_RANKING_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_STORE_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_NOT_BEST_SCORE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_LATEST_UPDATE_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_BOARD_MASTER_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_GAME_DATA_MASTER_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ANTICHEAT_DATA); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_TOO_LARGE_DATA); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_USER_NPID); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ENVIRONMENT); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ONLINE_NAME_CHARACTER); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ONLINE_NAME_LENGTH); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ABOUT_ME_CHARACTER); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ABOUT_ME_LENGTH); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_SCORE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_OVER_THE_RANKING_LIMIT); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_FAIL_TO_CREATE_SIGNATURE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_MASTER_INFO_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_OVER_THE_GAME_DATA_LIMIT); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_SELF_DATA_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_USER_NOT_ASSIGNED); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_GAME_DATA_ALREADY_EXISTS); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_TOO_MANY_RESULTS); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_NOT_RECORDABLE_VERSION); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_USER_STORAGE_TITLE_MASTER_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_VIRTUAL_USER); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_USER_STORAGE_DATA_NOT_FOUND); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_CONDITIONS_NOT_SATISFIED); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_MATCHING_BEFORE_SERVICE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_MATCHING_END_OF_SERVICE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_MATCHING_MAINTENANCE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_BEFORE_SERVICE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_END_OF_SERVICE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_MAINTENANCE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_TITLE_USER_STORAGE_BEFORE_SERVICE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_TITLE_USER_STORAGE_END_OF_SERVICE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_TITLE_USER_STORAGE_MAINTENANCE); + STR_CASE(SCE_NP_COMMUNITY_SERVER_ERROR_UNSPECIFIED); + STR_CASE(SCE_NP_COMMERCE_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_COMMERCE_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_COMMERCE_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_COMMERCE_ERROR_UNSUPPORTED_VERSION); + STR_CASE(SCE_NP_COMMERCE_ERROR_CTX_MAX); + STR_CASE(SCE_NP_COMMERCE_ERROR_CTX_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE_ERROR_CTXID_NOT_AVAILABLE); + STR_CASE(SCE_NP_COMMERCE_ERROR_REQ_MAX); + STR_CASE(SCE_NP_COMMERCE_ERROR_REQ_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE_ERROR_REQID_NOT_AVAILABLE); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_CATEGORY_ID); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_LANG_CODE); + STR_CASE(SCE_NP_COMMERCE_ERROR_REQ_BUSY); + STR_CASE(SCE_NP_COMMERCE_ERROR_INSUFFICIENT_BUFFER); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_REQ_STATE); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_CTX_STATE); + STR_CASE(SCE_NP_COMMERCE_ERROR_UNKNOWN); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_REQ_TYPE); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_MEMORY_CONTAINER); + STR_CASE(SCE_NP_COMMERCE_ERROR_INSUFFICIENT_MEMORY_CONTAINER); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_TYPE); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_STATE); + STR_CASE(SCE_NP_COMMERCE_ERROR_DATA_FLAG_NUM_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE_ERROR_DATA_FLAG_INFO_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_PROVIDER_ID); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_NUM); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_SKU_ID); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_ID); + STR_CASE(SCE_NP_COMMERCE_ERROR_GPC_SEND_REQUEST); + STR_CASE(SCE_NP_COMMERCE_ERROR_GDF_SEND_REQUEST); + STR_CASE(SCE_NP_COMMERCE_ERROR_SDF_SEND_REQUEST); + STR_CASE(SCE_NP_COMMERCE_ERROR_PARSE_PRODUCT_CATEGORY); + STR_CASE(SCE_NP_COMMERCE_ERROR_CURRENCY_INFO_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE_ERROR_CATEGORY_INFO_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE_ERROR_CHILD_CATEGORY_COUNT_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE_ERROR_CHILD_CATEGORY_INFO_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE_ERROR_SKU_COUNT_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE_ERROR_SKU_INFO_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE_ERROR_PLUGIN_LOAD_FAILURE); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_SKU_NUM); + STR_CASE(SCE_NP_COMMERCE_ERROR_INVALID_GPC_PROTOCOL_VERSION); + STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_UNEXPECTED); + STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_OUT_OF_SERVICE); + STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_INVALID_SKU); + STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_SERVER_BUSY); + STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_MAINTENANCE); + STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_ACCOUNT_SUSPENDED); + STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_OVER_SPENDING_LIMIT); + STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_NOT_ENOUGH_MONEY); + STR_CASE(SCE_NP_COMMERCE_ERROR_CHECKOUT_UNKNOWN); + STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_UNKNOWN); + STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_INVALID_CREDENTIALS); + STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_INVALID_CATEGORY_ID); + STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_SERVICE_END); + STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_SERVICE_STOP); + STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_SERVICE_BUSY); + STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_UNSUPPORTED_VERSION); + STR_CASE(SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_INTERNAL_SERVER); + STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_UNKNOWN); + STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_INVALID_CREDENTIALS); + STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_INVALID_FLAGLIST); + STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_SERVICE_END); + STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_SERVICE_STOP); + STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_SERVICE_BUSY); + STR_CASE(SCE_NP_COMMERCE_GDF_SERVER_ERROR_UNSUPPORTED_VERSION); + STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_UNKNOWN); + STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_INVALID_CREDENTIALS); + STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_INVALID_FLAGLIST); + STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_SERVICE_END); + STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_SERVICE_STOP); + STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_SERVICE_BUSY); + STR_CASE(SCE_NP_COMMERCE_SDF_SERVER_ERROR_UNSUPPORTED_VERSION); + STR_CASE(SCE_NP_DRM_ERROR_LICENSE_NOT_FOUND); + STR_CASE(SCE_NP_DRM_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_DRM_ERROR_INVALID_PARAM); + STR_CASE(SCE_NP_DRM_ERROR_SERVER_RESPONSE); + STR_CASE(SCE_NP_DRM_ERROR_NO_ENTITLEMENT); + STR_CASE(SCE_NP_DRM_ERROR_BAD_ACT); + STR_CASE(SCE_NP_DRM_ERROR_BAD_FORMAT); + STR_CASE(SCE_NP_DRM_ERROR_NO_LOGIN); + STR_CASE(SCE_NP_DRM_ERROR_INTERNAL); + STR_CASE(SCE_NP_DRM_ERROR_BAD_PERM); + STR_CASE(SCE_NP_DRM_ERROR_UNKNOWN_VERSION); + STR_CASE(SCE_NP_DRM_ERROR_TIME_LIMIT); + STR_CASE(SCE_NP_DRM_ERROR_DIFFERENT_ACCOUNT_ID); + STR_CASE(SCE_NP_DRM_ERROR_DIFFERENT_DRM_TYPE); + STR_CASE(SCE_NP_DRM_ERROR_SERVICE_NOT_STARTED); + STR_CASE(SCE_NP_DRM_ERROR_BUSY); + STR_CASE(SCE_NP_DRM_ERROR_IO); + STR_CASE(SCE_NP_DRM_ERROR_FORMAT); + STR_CASE(SCE_NP_DRM_ERROR_FILENAME); + STR_CASE(SCE_NP_DRM_ERROR_K_LICENSEE); + STR_CASE(SCE_NP_AUTH_EINVAL); + STR_CASE(SCE_NP_AUTH_ENOMEM); + STR_CASE(SCE_NP_AUTH_ESRCH); + STR_CASE(SCE_NP_AUTH_EBUSY); + STR_CASE(SCE_NP_AUTH_EABORT); + STR_CASE(SCE_NP_AUTH_EEXIST); + STR_CASE(SCE_NP_AUTH_EINVALID_ARGUMENT); + STR_CASE(SCE_NP_AUTH_ERROR_SERVICE_END); + STR_CASE(SCE_NP_AUTH_ERROR_SERVICE_DOWN); + STR_CASE(SCE_NP_AUTH_ERROR_SERVICE_BUSY); + STR_CASE(SCE_NP_AUTH_ERROR_SERVER_MAINTENANCE); + STR_CASE(SCE_NP_AUTH_ERROR_INVALID_DATA_LENGTH); + STR_CASE(SCE_NP_AUTH_ERROR_INVALID_USER_AGENT); + STR_CASE(SCE_NP_AUTH_ERROR_INVALID_VERSION); + STR_CASE(SCE_NP_AUTH_ERROR_INVALID_SERVICE_ID); + STR_CASE(SCE_NP_AUTH_ERROR_INVALID_CREDENTIAL); + STR_CASE(SCE_NP_AUTH_ERROR_INVALID_ENTITLEMENT_ID); + STR_CASE(SCE_NP_AUTH_ERROR_INVALID_CONSUMED_COUNT); + STR_CASE(SCE_NP_AUTH_ERROR_INVALID_CONSOLE_ID); + STR_CASE(SCE_NP_AUTH_ERROR_CONSOLE_ID_SUSPENDED); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_CLOSED); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_SUSPENDED); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_EULA); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT1); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT2); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT3); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT4); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT5); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT6); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT7); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT8); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT9); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT10); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT11); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT12); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT13); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT14); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT15); + STR_CASE(SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT16); + STR_CASE(SCE_NP_AUTH_ERROR_UNKNOWN); + STR_CASE(SCE_NP_CORE_UTIL_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_CORE_UTIL_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_CORE_UTIL_ERROR_INSUFFICIENT); + STR_CASE(SCE_NP_CORE_UTIL_ERROR_PARSER_FAILED); + STR_CASE(SCE_NP_CORE_UTIL_ERROR_INVALID_PROTOCOL_ID); + STR_CASE(SCE_NP_CORE_UTIL_ERROR_INVALID_EXTENSION); + STR_CASE(SCE_NP_CORE_UTIL_ERROR_INVALID_TEXT); + STR_CASE(SCE_NP_CORE_UTIL_ERROR_UNKNOWN_TYPE); + STR_CASE(SCE_NP_CORE_UTIL_ERROR_UNKNOWN); + STR_CASE(SCE_NP_CORE_PARSER_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_CORE_PARSER_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_CORE_PARSER_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_CORE_PARSER_ERROR_INSUFFICIENT); + STR_CASE(SCE_NP_CORE_PARSER_ERROR_INVALID_FORMAT); + STR_CASE(SCE_NP_CORE_PARSER_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_CORE_PARSER_ERROR_INVALID_HANDLE); + STR_CASE(SCE_NP_CORE_PARSER_ERROR_INVALID_ICON); + STR_CASE(SCE_NP_CORE_PARSER_ERROR_UNKNOWN); + STR_CASE(SCE_NP_CORE_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_CORE_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_CORE_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_CORE_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_CORE_ERROR_ID_NOT_AVAILABLE); + STR_CASE(SCE_NP_CORE_ERROR_USER_OFFLINE); + STR_CASE(SCE_NP_CORE_ERROR_SESSION_RUNNING); + STR_CASE(SCE_NP_CORE_ERROR_SESSION_NOT_ESTABLISHED); + STR_CASE(SCE_NP_CORE_ERROR_SESSION_INVALID_STATE); + STR_CASE(SCE_NP_CORE_ERROR_SESSION_ID_TOO_LONG); + STR_CASE(SCE_NP_CORE_ERROR_SESSION_INVALID_NAMESPACE); + STR_CASE(SCE_NP_CORE_ERROR_CONNECTION_TIMEOUT); + STR_CASE(SCE_NP_CORE_ERROR_GETSOCKOPT); + STR_CASE(SCE_NP_CORE_ERROR_SSL_NOT_INITIALIZED); + STR_CASE(SCE_NP_CORE_ERROR_SSL_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_CORE_ERROR_SSL_NO_CERT); + STR_CASE(SCE_NP_CORE_ERROR_SSL_NO_TRUSTWORTHY_CA); + STR_CASE(SCE_NP_CORE_ERROR_SSL_INVALID_CERT); + STR_CASE(SCE_NP_CORE_ERROR_SSL_CERT_VERIFY); + STR_CASE(SCE_NP_CORE_ERROR_SSL_CN_CHECK); + STR_CASE(SCE_NP_CORE_ERROR_SSL_HANDSHAKE_FAILED); + STR_CASE(SCE_NP_CORE_ERROR_SSL_SEND); + STR_CASE(SCE_NP_CORE_ERROR_SSL_RECV); + STR_CASE(SCE_NP_CORE_ERROR_SSL_CREATE_CTX); + STR_CASE(SCE_NP_CORE_ERROR_PARSE_PEM); + STR_CASE(SCE_NP_CORE_ERROR_INVALID_INITIATE_STREAM); + STR_CASE(SCE_NP_CORE_ERROR_SASL_NOT_SUPPORTED); + STR_CASE(SCE_NP_CORE_ERROR_NAMESPACE_ALREADY_EXISTS); + STR_CASE(SCE_NP_CORE_ERROR_FROM_ALREADY_EXISTS); + STR_CASE(SCE_NP_CORE_ERROR_MODULE_NOT_REGISTERED); + STR_CASE(SCE_NP_CORE_ERROR_MODULE_FROM_NOT_FOUND); + STR_CASE(SCE_NP_CORE_ERROR_UNKNOWN_NAMESPACE); + STR_CASE(SCE_NP_CORE_ERROR_INVALID_VERSION); + STR_CASE(SCE_NP_CORE_ERROR_LOGIN_TIMEOUT); + STR_CASE(SCE_NP_CORE_ERROR_TOO_MANY_SESSIONS); + STR_CASE(SCE_NP_CORE_ERROR_SENDLIST_NOT_FOUND); + STR_CASE(SCE_NP_CORE_ERROR_NO_ID); + STR_CASE(SCE_NP_CORE_ERROR_LOAD_CERTS); + STR_CASE(SCE_NP_CORE_ERROR_NET_SELECT); + STR_CASE(SCE_NP_CORE_ERROR_DISCONNECTED); + STR_CASE(SCE_NP_CORE_ERROR_TICKET_TOO_SMALL); + STR_CASE(SCE_NP_CORE_ERROR_INVALID_TICKET); + STR_CASE(SCE_NP_CORE_ERROR_INVALID_ONLINEID); + STR_CASE(SCE_NP_CORE_ERROR_GETHOSTBYNAME); + STR_CASE(SCE_NP_CORE_ERROR_UNDEFINED_STREAM_ERROR); + STR_CASE(SCE_NP_CORE_ERROR_INTERNAL); + STR_CASE(SCE_NP_CORE_ERROR_DNS_HOST_NOT_FOUND); + STR_CASE(SCE_NP_CORE_ERROR_DNS_TRY_AGAIN); + STR_CASE(SCE_NP_CORE_ERROR_DNS_NO_RECOVERY); + STR_CASE(SCE_NP_CORE_ERROR_DNS_NO_DATA); + STR_CASE(SCE_NP_CORE_ERROR_DNS_NO_ADDRESS); + STR_CASE(SCE_NP_CORE_SERVER_ERROR_CONFLICT); + STR_CASE(SCE_NP_CORE_SERVER_ERROR_NOT_AUTHORIZED); + STR_CASE(SCE_NP_CORE_SERVER_ERROR_REMOTE_CONNECTION_FAILED); + STR_CASE(SCE_NP_CORE_SERVER_ERROR_RESOURCE_CONSTRAINT); + STR_CASE(SCE_NP_CORE_SERVER_ERROR_SYSTEM_SHUTDOWN); + STR_CASE(SCE_NP_CORE_SERVER_ERROR_UNSUPPORTED_CLIENT_VERSION); + STR_CASE(SCE_NP_DRM_INSTALL_ERROR_FORMAT); + STR_CASE(SCE_NP_DRM_INSTALL_ERROR_CHECK); + STR_CASE(SCE_NP_DRM_INSTALL_ERROR_UNSUPPORTED); + STR_CASE(SCE_NP_DRM_SERVER_ERROR_SERVICE_IS_END); + STR_CASE(SCE_NP_DRM_SERVER_ERROR_SERVICE_STOP_TEMPORARILY); + STR_CASE(SCE_NP_DRM_SERVER_ERROR_SERVICE_IS_BUSY); + STR_CASE(SCE_NP_DRM_SERVER_ERROR_INVALID_USER_CREDENTIAL); + STR_CASE(SCE_NP_DRM_SERVER_ERROR_INVALID_PRODUCT_ID); + STR_CASE(SCE_NP_DRM_SERVER_ERROR_ACCOUNT_IS_CLOSED); + STR_CASE(SCE_NP_DRM_SERVER_ERROR_ACCOUNT_IS_SUSPENDED); + STR_CASE(SCE_NP_DRM_SERVER_ERROR_ACTIVATED_CONSOLE_IS_FULL); + STR_CASE(SCE_NP_DRM_SERVER_ERROR_CONSOLE_NOT_ACTIVATED); + STR_CASE(SCE_NP_DRM_SERVER_ERROR_PRIMARY_CONSOLE_CANNOT_CHANGED); + STR_CASE(SCE_NP_DRM_SERVER_ERROR_UNKNOWN); + STR_CASE(SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_SIGNALING_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_SIGNALING_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_SIGNALING_ERROR_CTXID_NOT_AVAILABLE); + STR_CASE(SCE_NP_SIGNALING_ERROR_CTX_NOT_FOUND); + STR_CASE(SCE_NP_SIGNALING_ERROR_REQID_NOT_AVAILABLE); + STR_CASE(SCE_NP_SIGNALING_ERROR_REQ_NOT_FOUND); + STR_CASE(SCE_NP_SIGNALING_ERROR_PARSER_CREATE_FAILED); + STR_CASE(SCE_NP_SIGNALING_ERROR_PARSER_FAILED); + STR_CASE(SCE_NP_SIGNALING_ERROR_INVALID_NAMESPACE); + STR_CASE(SCE_NP_SIGNALING_ERROR_NETINFO_NOT_AVAILABLE); + STR_CASE(SCE_NP_SIGNALING_ERROR_PEER_NOT_RESPONDING); + STR_CASE(SCE_NP_SIGNALING_ERROR_CONNID_NOT_AVAILABLE); + STR_CASE(SCE_NP_SIGNALING_ERROR_CONN_NOT_FOUND); + STR_CASE(SCE_NP_SIGNALING_ERROR_PEER_UNREACHABLE); + STR_CASE(SCE_NP_SIGNALING_ERROR_TERMINATED_BY_PEER); + STR_CASE(SCE_NP_SIGNALING_ERROR_TIMEOUT); + STR_CASE(SCE_NP_SIGNALING_ERROR_CTX_MAX); + STR_CASE(SCE_NP_SIGNALING_ERROR_RESULT_NOT_FOUND); + STR_CASE(SCE_NP_SIGNALING_ERROR_CONN_IN_PROGRESS); + STR_CASE(SCE_NP_SIGNALING_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_SIGNALING_ERROR_OWN_NP_ID); + STR_CASE(SCE_NP_SIGNALING_ERROR_TOO_MANY_CONN); + STR_CASE(SCE_NP_SIGNALING_ERROR_TERMINATED_BY_MYSELF); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_NOT_SUPPORTED); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_INSUFFICIENT); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_CANCEL); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_STATUS); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_BUSY); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_ABORT); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_NOT_REGISTERED); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_EXCEEDS_MAX); + STR_CASE(SCE_NP_CUSTOM_MENU_ERROR_INVALID_CHARACTER); + STR_CASE(SCE_NP_EULA_ERROR_UNKNOWN); + STR_CASE(SCE_NP_EULA_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_EULA_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_EULA_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_EULA_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_EULA_ERROR_BUSY); + STR_CASE(SCE_NP_EULA_ERROR_EULA_NOT_FOUND); + STR_CASE(SCE_NP_EULA_ERROR_NET_OUT_OF_MEMORY); + STR_CASE(SCE_NP_EULA_ERROR_CONF_FORMAT); + STR_CASE(SCE_NP_EULA_ERROR_CONF_INVALID_FILENAME); + STR_CASE(SCE_NP_EULA_ERROR_CONF_TOO_MANY_EULA_FILES); + STR_CASE(SCE_NP_EULA_ERROR_CONF_INVALID_LANGUAGE); + STR_CASE(SCE_NP_EULA_ERROR_CONF_INVALID_COUNTRY); + STR_CASE(SCE_NP_EULA_ERROR_CONF_INVALID_NPCOMMID); + STR_CASE(SCE_NP_EULA_ERROR_CONF_INVALID_EULA_VERSION); + STR_CASE(SCE_NP_MATCHING_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_MATCHING_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_ARG); + STR_CASE(SCE_NP_MATCHING_ERROR_TERMINATED); + STR_CASE(SCE_NP_MATCHING_ERROR_TIMEOUT); + STR_CASE(SCE_NP_MATCHING_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_MATCHING_ERROR_CTXID_NOT_AVAIL); + STR_CASE(SCE_NP_MATCHING_ERROR_CTX_ALREADY_EXIST); + STR_CASE(SCE_NP_MATCHING_ERROR_CTX_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING_ERROR_LOBBY_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING_ERROR_ROOM_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING_ERROR_MEMBER_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING_ERROR_TOO_BIG_VALUE); + STR_CASE(SCE_NP_MATCHING_ERROR_IVALID_ATTR_TYPE); + STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_ATTR_ID); + STR_CASE(SCE_NP_MATCHING_ERROR_ALREADY_REQUESTED); + STR_CASE(SCE_NP_MATCHING_ERROR_LIMITTED_SEATING); + STR_CASE(SCE_NP_MATCHING_ERROR_LOCKED); + STR_CASE(SCE_NP_MATCHING_ERROR_CTX_STILL_RUNNING); + STR_CASE(SCE_NP_MATCHING_ERROR_INSUFFICIENT_BUFFER); + STR_CASE(SCE_NP_MATCHING_ERROR_REQUEST_NOT_ALLOWED); + STR_CASE(SCE_NP_MATCHING_ERROR_CTX_MAX); + STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_REQ_ID); + STR_CASE(SCE_NP_MATCHING_ERROR_RESULT_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING_ERROR_BUSY); + STR_CASE(SCE_NP_MATCHING_ERROR_ALREADY_JOINED_ROOM); + STR_CASE(SCE_NP_MATCHING_ERROR_ROOM_MAX); + STR_CASE(SCE_NP_MATCHING_ERROR_QUICK_MATCH_PLAYER_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING_ERROR_COND_MAX); + STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_COND); + STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_ATTR); + STR_CASE(SCE_NP_MATCHING_ERROR_COMP_OP_INEQUALITY_MAX); + STR_CASE(SCE_NP_MATCHING_ERROR_RESULT_OVERFLOWED); + STR_CASE(SCE_NP_MATCHING_ERROR_HTTPXML_TIMEOUT); + STR_CASE(SCE_NP_MATCHING_ERROR_CANCELED); + STR_CASE(SCE_NP_MATCHING_ERROR_SEARCH_JOIN_ROOM_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_COMP_OP); + STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_COMP_TYPE); + STR_CASE(SCE_NP_MATCHING_ERROR_REQUEST_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING_ERROR_INTERNAL_ERROR); + STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_PROTOCOL_ID); + STR_CASE(SCE_NP_MATCHING_ERROR_ATTR_NOT_SPECIFIED); + STR_CASE(SCE_NP_MATCHING_ERROR_SYSUTIL_INVALID_RESULT); + STR_CASE(SCE_NP_MATCHING_ERROR_PLUGIN_LOAD_FAILURE); + STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_ATTR_VALUE); + STR_CASE(SCE_NP_MATCHING_ERROR_DUPLICATE); + STR_CASE(SCE_NP_MATCHING_ERROR_INVALID_MEMORY_CONTAINER); + STR_CASE(SCE_NP_MATCHING_ERROR_SHUTDOWN); + STR_CASE(SCE_NP_MATCHING_ERROR_SYSUTIL_SERVER_BUSY); + STR_CASE(SCE_NP_MATCHING_ERROR_SEND_INVITATION_PARTIALLY_FAILED); + STR_CASE(SCE_NP_MATCHING_ERROR_UTILITY_UNAVAILABLE); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_OUT_OF_SERVICE); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_MAINTENANCE); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_SERVER_BUSY); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_ACCESS_FORBIDDEN); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_SERVER); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_LOBBY); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_ROOM); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_USER); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_NOT_ALLOWED); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_UNKNOWN); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_BAD_REQUEST_STANZA); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_REQUEST_FORBIDDEN); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_INTERNAL_ERROR); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_ROOM_OVER); + STR_CASE(SCE_NP_MATCHING_SERVER_ERROR_ROOM_CLOSED); + } - return unknown; - }); + return unknown; + }); } void message_data::print() const { - sceNp.notice("commId: %s, msgId: %d, mainType: %d, subType: %d, subject: %s, body: %s, data_size: %d", static_cast(commId.data), msgId, mainType, subType, subject, body, data.size()); + sceNp.notice("commId: %s, msgId: %d, mainType: %d, subType: %d, subject: %s, body: %s, data_size: %d", static_cast(commId.data), msgId, mainType, subType, subject, body, data.size()); } extern void lv2_sleep(u64 timeout, ppu_thread* ppu = nullptr); @@ -764,7 +764,7 @@ error_code sceNpDrmIsAvailable2(ppu_thread& ppu, vm::cptr k_licensee_addr, v const auto ret = npDrmIsAvailable(k_licensee_addr, drm_path); // TODO: Accurate sleep time - //lv2_sleep(20000, &ppu); + // lv2_sleep(20000, &ppu); return ret; } @@ -1378,16 +1378,16 @@ error_code sceNpBasicSendMessageGui(ppu_thread& ppu, vm::cptrExec(msg_data, npids); - }); + { + auto send_dlg = Emu.GetCallbacks().get_sendmessage_dialog(); + result = send_dlg->Exec(msg_data, npids); + }); input::SetIntercepted(false); } s32 callback_result = result == CELL_OK ? 0 : -1; - s32 event = 0; + s32 event = 0; switch (msg->mainType) { @@ -1562,10 +1562,10 @@ error_code recv_message_gui(ppu_thread& ppu, u16 mainType, u32 recvOptions) input::SetIntercepted(true); Emu.BlockingCallFromMainThread([=, &result, &recv_result, &chosen_msg_id]() - { - auto recv_dlg = Emu.GetCallbacks().get_recvmessage_dialog(); - result = recv_dlg->Exec(static_cast(mainType), static_cast(recvOptions), recv_result, chosen_msg_id); - }); + { + auto recv_dlg = Emu.GetCallbacks().get_recvmessage_dialog(); + result = recv_dlg->Exec(static_cast(mainType), static_cast(recvOptions), recv_result, chosen_msg_id); + }); input::SetIntercepted(false); } @@ -1584,7 +1584,7 @@ error_code recv_message_gui(ppu_thread& ppu, u16 mainType, u32 recvOptions) } const auto msg_pair = opt_msg.value(); - const auto& msg = msg_pair->second; + const auto& msg = msg_pair->second; u32 event_to_send; SceNpBasicAttachmentData data{}; @@ -1625,11 +1625,11 @@ error_code recv_message_gui(ppu_thread& ppu, u16 mainType, u32 recvOptions) { to_add.data.resize(sizeof(SceNpBasicExtendedAttachmentData)); SceNpBasicExtendedAttachmentData* att_data = reinterpret_cast(to_add.data.data()); - att_data->flags = 0; // ? - att_data->msgId = chosen_msg_id; - att_data->data = data; - att_data->userAction = recv_result; - att_data->markedAsUsed = (recvOptions & SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_PRESERVE) ? 0 : 1; + att_data->flags = 0; // ? + att_data->msgId = chosen_msg_id; + att_data->data = data; + att_data->userAction = recv_result; + att_data->markedAsUsed = (recvOptions & SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_PRESERVE) ? 0 : 1; extra_nps::print_SceNpBasicExtendedAttachmentData(att_data); } @@ -1661,10 +1661,10 @@ error_code sceNpBasicMarkMessageAsUsed(SceNpBasicMessageId msgId) return SCE_NP_BASIC_ERROR_NOT_REGISTERED; } - //if (!msgId > ?) + // if (!msgId > ?) //{ // return SCE_NP_BASIC_ERROR_INVALID_ARGUMENT; - //} + // } return CELL_OK; } @@ -2503,8 +2503,8 @@ error_code sceNpCommerceInitProductCategory(vm::ptr pc info->pc = pc; // TODO - //info->data = pc->data + 16; - //pc->data + 0x307 = 0; - //pc->data + 0x47 = 0; - //pc->data + 0x107 = 0; - //pc->data + 0x287 = 0; + // info->data = pc->data + 16; + // pc->data + 0x307 = 0; + // pc->data + 0x47 = 0; + // pc->data + 0x107 = 0; + // pc->data + 0x287 = 0; } return CELL_OK; @@ -2663,7 +2663,7 @@ vm::cptr sceNpCommerceGetCategoryName(vm::ptr i vm::cptr sceNpCommerceGetCurrencyCode(vm::ptr info) { sceNp.todo("sceNpCommerceGetCurrencyCode(info=*0x%x)", info); - //if (info) return info->data; + // if (info) return info->data; return vm::null; } @@ -2673,10 +2673,10 @@ u32 sceNpCommerceGetCurrencyDecimals(vm::ptr info) if (info) { - //return (info->data + 7) | - // (info->data + 6) << 8 | - // (info->data + 5) << 0x10 | - // (info->data + 4) << 0x18; + // return (info->data + 7) | + // (info->data + 6) << 8 | + // (info->data + 5) << 0x10 | + // (info->data + 4) << 0x18; } return 0; @@ -2694,8 +2694,8 @@ error_code sceNpCommerceGetCurrencyInfo(vm::ptr pc info->pc = pc; // TODO - //info->data = pc->data + 8; - //pc->data + 0xb = 0; + // info->data = pc->data + 8; + // pc->data + 0xb = 0; } return CELL_OK; @@ -2708,7 +2708,7 @@ error_code sceNpCommerceGetNumOfChildCategory(vm::ptrdataSize < 780) return SCE_NP_COMMERCE_ERROR_CHILD_CATEGORY_COUNT_NOT_FOUND; - //if (num) *num = pc->data + 0x308; + // if (num) *num = pc->data + 0x308; return CELL_OK; } @@ -2720,7 +2720,7 @@ error_code sceNpCommerceGetNumOfChildProductSku(vm::ptrdataSize < 780) // TODO: some other check return SCE_NP_COMMERCE_ERROR_SKU_COUNT_NOT_FOUND; - //if (num) *num = something; + // if (num) *num = something; return CELL_OK; } @@ -2728,28 +2728,28 @@ error_code sceNpCommerceGetNumOfChildProductSku(vm::ptr sceNpCommerceGetSkuDescription(vm::ptr info) { sceNp.todo("sceNpCommerceGetSkuDescription(info=*0x%x)", info); - //if (info) return info->data + 0x168; + // if (info) return info->data + 0x168; return vm::null; } vm::cptr sceNpCommerceGetSkuId(vm::ptr info) { sceNp.todo("sceNpCommerceGetSkuId(info=*0x%x)", info); - //if (info) return info->data; + // if (info) return info->data; return vm::null; } vm::cptr sceNpCommerceGetSkuImageURL(vm::ptr info) { sceNp.todo("sceNpCommerceGetSkuImageURL(info=*0x%x)", info); - //if (info) return info->data + 0x2e8; + // if (info) return info->data + 0x2e8; return vm::null; } vm::cptr sceNpCommerceGetSkuName(vm::ptr info) { sceNp.todo("sceNpCommerceGetSkuName(info=*0x%x)", info); - //if (info) return info->data + 0x128; + // if (info) return info->data + 0x128; return vm::null; } @@ -2763,20 +2763,20 @@ void sceNpCommerceGetSkuPrice(vm::ptr info, vm::ptr if (info && info->pc && info->pc->dval) { // TODO - //price->integer = something / info->pc->dval; - //price->fractional = something - static_cast(price->integer) * info->pc->dval; + // price->integer = something / info->pc->dval; + // price->fractional = something - static_cast(price->integer) * info->pc->dval; return; } // TODO - //price->integer = something; + // price->integer = something; price->fractional = 0; } vm::cptr sceNpCommerceGetSkuUserData(vm::ptr info) { sceNp.todo("sceNpCommerceGetSkuUserData(info=*0x%x)", info); - //if (info) return info->data + 0x368; + // if (info) return info->data + 0x368; return vm::null; } @@ -2858,7 +2858,7 @@ error_code sceNpCommerceGetDataFlagAbort() error_code sceNpCommerceGetChildCategoryInfo(vm::ptr pc, u32 child_index, vm::ptr info) { sceNp.todo("sceNpCommerceGetChildCategoryInfo(pc=*0x%x, child_index=%d, info=*0x%x)", pc, child_index, info); - + if (!pc || !info) // Not really checked I think return SCE_NP_COMMERCE_ERROR_CHILD_CATEGORY_INFO_NOT_FOUND; @@ -2868,13 +2868,13 @@ error_code sceNpCommerceGetChildCategoryInfo(vm::ptrdata + offset + 780; - //info->pc = pc; - //info->data = child + 780; - //child + 0x603 = 0; - //child + 0x343 = 0; - //child + 0x403 = 0; - //child + 0x583 = 0; + // auto child = pc->data + offset + 780; + // info->pc = pc; + // info->data = child + 780; + // child + 0x603 = 0; + // child + 0x343 = 0; + // child + 0x403 = 0; + // child + 0x583 = 0; return CELL_OK; } @@ -2882,7 +2882,7 @@ error_code sceNpCommerceGetChildCategoryInfo(vm::ptr pc, u32 child_index, vm::ptr info) { sceNp.todo("sceNpCommerceGetChildProductSkuInfo(pc=*0x%x, child_index=%d, info=*0x%x)", pc, child_index, info); - + if (!pc || !info) // Not really checked I think return SCE_NP_COMMERCE_ERROR_SKU_INFO_NOT_FOUND; @@ -2890,22 +2890,22 @@ error_code sceNpCommerceGetChildProductSkuInfo(vm::ptrdata + 776) * 760 + offset; + // const u32 child_offset = child_index * 1004; + // const u32 offset = (pc->data + 776) * 760 + offset; - //if (offset + 788 > pc->dataSize) + // if (offset + 788 > pc->dataSize) // return SCE_NP_COMMERCE_ERROR_SKU_INFO_NOT_FOUND; - //auto child = pc->data + offset; - //info->pc = pc; - //info->data = child + 784; - //child + 0x6f7 = 0; - //child + 0x347 = 0; - //child + 0x377 = 0; - //child + 0x437 = 0; - //child + 0x477 = 0; - //child + 0x5f7 = 0; - //child + 0x677 = 0; + // auto child = pc->data + offset; + // info->pc = pc; + // info->data = child + 784; + // child + 0x6f7 = 0; + // child + 0x347 = 0; + // child + 0x377 = 0; + // child + 0x437 = 0; + // child + 0x477 = 0; + // child + 0x5f7 = 0; + // child + 0x677 = 0; return CELL_OK; } @@ -2990,7 +2990,7 @@ error_code sceNpCustomMenuRegisterActions(vm::cptr menu, vm::pt } np::np_handler::custom_menu_action action{}; - action.id = static_cast(actions.size()); + action.id = static_cast(actions.size()); action.mask = menu->actions[i].mask; action.name = menu->actions[i].name.get_ptr(); @@ -3400,10 +3400,10 @@ error_code sceNpLookupNpIdAsync(s32 transId, vm::cptr onlineId, v } error_code sceNpLookupUserProfile(s32 transId, vm::cptr npId, vm::ptr userInfo, vm::ptr aboutMe, vm::ptr languages, - vm::ptr countryCode, vm::ptr avatarImage, vm::ptr option) + vm::ptr countryCode, vm::ptr avatarImage, vm::ptr option) { sceNp.todo("sceNpLookupUserProfile(transId=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImage=*0x%x, option=*0x%x)", transId, npId, userInfo, aboutMe, - languages, countryCode, avatarImage, option); + languages, countryCode, avatarImage, option); auto& nph = g_fxo->get>(); @@ -3431,10 +3431,10 @@ error_code sceNpLookupUserProfile(s32 transId, vm::cptr npId, vm::ptr npId, vm::ptr userInfo, vm::ptr aboutMe, vm::ptr languages, - vm::ptr countryCode, vm::ptr avatarImage, s32 prio, vm::ptr option) + vm::ptr countryCode, vm::ptr avatarImage, s32 prio, vm::ptr option) { sceNp.todo("sceNpLookupUserProfile(transId=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImage=*0x%x, prio=%d, option=*0x%x)", transId, npId, userInfo, - aboutMe, languages, countryCode, avatarImage, prio, option); + aboutMe, languages, countryCode, avatarImage, prio, option); auto& nph = g_fxo->get>(); @@ -3462,11 +3462,11 @@ error_code sceNpLookupUserProfileAsync(s32 transId, vm::cptr npId, vm:: } error_code sceNpLookupUserProfileWithAvatarSize(s32 transId, s32 avatarSizeType, vm::cptr npId, vm::ptr userInfo, vm::ptr aboutMe, - vm::ptr languages, vm::ptr countryCode, vm::ptr avatarImageData, u32 avatarImageDataMaxSize, vm::ptr avatarImageDataSize, vm::ptr option) + vm::ptr languages, vm::ptr countryCode, vm::ptr avatarImageData, u32 avatarImageDataMaxSize, vm::ptr avatarImageDataSize, vm::ptr option) { sceNp.todo("sceNpLookupUserProfileWithAvatarSize(transId=%d, avatarSizeType=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImageData=*0x%x, " - "avatarImageDataMaxSize=%d, avatarImageDataSize=*0x%x, option=*0x%x)", - transId, avatarSizeType, npId, userInfo, aboutMe, languages, countryCode, avatarImageData, avatarImageDataMaxSize, avatarImageDataSize, option); + "avatarImageDataMaxSize=%d, avatarImageDataSize=*0x%x, option=*0x%x)", + transId, avatarSizeType, npId, userInfo, aboutMe, languages, countryCode, avatarImageData, avatarImageDataMaxSize, avatarImageDataSize, option); auto& nph = g_fxo->get>(); @@ -3494,12 +3494,12 @@ error_code sceNpLookupUserProfileWithAvatarSize(s32 transId, s32 avatarSizeType, } error_code sceNpLookupUserProfileWithAvatarSizeAsync(s32 transId, s32 avatarSizeType, vm::cptr npId, vm::ptr userInfo, vm::ptr aboutMe, - vm::ptr languages, vm::ptr countryCode, vm::ptr avatarImageData, u32 avatarImageDataMaxSize, vm::ptr avatarImageDataSize, s32 prio, - vm::ptr option) + vm::ptr languages, vm::ptr countryCode, vm::ptr avatarImageData, u32 avatarImageDataMaxSize, vm::ptr avatarImageDataSize, s32 prio, + vm::ptr option) { sceNp.todo("sceNpLookupUserProfileWithAvatarSizeAsync(transId=%d, avatarSizeType=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImageData=*0x%x, " - "avatarImageDataMaxSize=%d, avatarImageDataSize=*0x%x, prio=%d, option=*0x%x)", - transId, avatarSizeType, npId, userInfo, aboutMe, languages, countryCode, avatarImageData, avatarImageDataMaxSize, avatarImageDataSize, prio, option); + "avatarImageDataMaxSize=%d, avatarImageDataSize=*0x%x, prio=%d, option=*0x%x)", + transId, avatarSizeType, npId, userInfo, aboutMe, languages, countryCode, avatarImageData, avatarImageDataMaxSize, avatarImageDataSize, prio, option); auto& nph = g_fxo->get>(); @@ -3633,10 +3633,10 @@ error_code sceNpLookupTitleSmallStorage(s32 transId, vm::ptr data, u32 max return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - //if (something > maxSize) + // if (something > maxSize) //{ // return SCE_NP_COMMUNITY_ERROR_BODY_TOO_LARGE; - //} + // } if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { @@ -3667,10 +3667,10 @@ error_code sceNpLookupTitleSmallStorageAsync(s32 transId, vm::ptr data, u3 return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - //if (something > maxSize) + // if (something > maxSize) //{ // return SCE_NP_COMMUNITY_ERROR_BODY_TOO_LARGE; - //} + // } if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { @@ -4032,7 +4032,7 @@ error_code sceNpManagerGetContentRatingFlag(vm::ptr isRestricted, vm::ptr npId, vm::cptr cookie, u32 cookieSize, vm::cptr entitlementId, u32 consumedCount) { sceNp.warning("sceNpManagerRequestTicket2(npId=*0x%x, version=*0x%x, serviceId=%s, cookie=*0x%x, cookieSize=%d, entitlementId=%s, consumedCount=%d)", npId, version, serviceId, cookie, cookieSize, - entitlementId, consumedCount); + entitlementId, consumedCount); auto& nph = g_fxo->get>(); @@ -4271,7 +4271,7 @@ error_code sceNpManagerGetEntitlementById(vm::cptr entId, vm::ptr signInId) { sceNp.todo("sceNpManagerGetSigninId(signInId==*0x%x)", signInId); - + auto& nph = g_fxo->get>(); if (!nph.is_NP_init) @@ -4335,7 +4335,8 @@ error_code sceNpManagerSubSignout(vm::ptr npId) error_code check_attr_id(vm::cptr attr) { ensure(!!attr); - if (!attr) return SCE_NP_MATCHING_ERROR_INVALID_ATTR_ID; // Satisfy compiler + if (!attr) + return SCE_NP_MATCHING_ERROR_INVALID_ATTR_ID; // Satisfy compiler switch (attr->type) { @@ -4653,7 +4654,7 @@ error_code sceNpMatchingSetRoomSearchFlag(u32 ctx_id, vm::ptr lobb if (!nph.is_NP_init) return SCE_NP_MATCHING_ERROR_NOT_INITIALIZED; - if (!lobby_id || !room_id || !req_id || (flag < SCE_NP_MATCHING_ROOM_SEARCH_FLAG_OPEN || flag > SCE_NP_MATCHING_ROOM_SEARCH_FLAG_STEALTH)) + if (!lobby_id || !room_id || !req_id || (flag < SCE_NP_MATCHING_ROOM_SEARCH_FLAG_OPEN || flag > SCE_NP_MATCHING_ROOM_SEARCH_FLAG_STEALTH)) return SCE_NP_MATCHING_ERROR_INVALID_ARG; auto res = nph.set_room_search_flag_gui(ctx_id, lobby_id, room_id, flag); @@ -4714,7 +4715,7 @@ error_code sceNpMatchingGetRoomMemberListLocal(u32 ctx_id, vm::ptr // FUN_00014bdc error_code check_room_list_params([[maybe_unused]] u32 ctx_id, vm::ptr communicationId, vm::ptr range, vm::ptr cond, - vm::ptr attribute, vm::ptr handler, int param_7, int param_8) + vm::ptr attribute, vm::ptr handler, int param_7, int param_8) { if (!communicationId || !range || !handler) return SCE_NP_MATCHING_ERROR_INVALID_ARG; @@ -4800,7 +4801,7 @@ error_code matching_get_room_list(u32 ctx_id, vm::ptr comm } error_code sceNpMatchingGetRoomListLimitGUI(u32 ctx_id, vm::ptr communicationId, vm::ptr range, vm::ptr cond, - vm::ptr attr, vm::ptr handler, vm::ptr arg) + vm::ptr attr, vm::ptr handler, vm::ptr arg) { sceNp.warning("sceNpMatchingGetRoomListLimitGUI(ctx_id=%d, communicationId=*0x%x, range=*0x%x, cond=*0x%x, attr=*0x%x, handler=*0x%x, arg=*0x%x)", ctx_id, communicationId, range, cond, attr, handler, arg); @@ -4859,10 +4860,10 @@ error_code sceNpMatchingKickRoomMemberWithOpt(u32 ctx_id, vm::cptr } error_code sceNpMatchingQuickMatchGUI(u32 ctx_id, vm::cptr communicationId, vm::cptr cond, s32 available_num, s32 timeout, - vm::ptr handler, vm::ptr arg) + vm::ptr handler, vm::ptr arg) { sceNp.warning("sceNpMatchingQuickMatchGUI(ctx_id=%d, communicationId=*0x%x, cond=*0x%x, available_num=%d, timeout=%d, handler=*0x%x, arg=*0x%x)", ctx_id, communicationId, cond, available_num, timeout, - handler, arg); + handler, arg); auto& nph = g_fxo->get>(); @@ -4910,10 +4911,10 @@ error_code sceNpMatchingQuickMatchGUI(u32 ctx_id, vm::cptr } error_code sceNpMatchingSendInvitationGUI(u32 ctx_id, vm::cptr room_id, vm::cptr communicationId, vm::cptr dsts, s32 num, s32 slot_type, - vm::cptr subject, vm::cptr body, sys_memory_container_t container, vm::ptr handler, vm::ptr arg) + vm::cptr subject, vm::cptr body, sys_memory_container_t container, vm::ptr handler, vm::ptr arg) { sceNp.todo("sceNpMatchingSendInvitationGUI(ctx_id=%d, room_id=*0x%x, communicationId=*0x%x, dsts=*0x%x, num=%d, slot_type=%d, subject=%s, body=%s, container=%d, handler=*0x%x, arg=*0x%x)", ctx_id, - room_id, communicationId, dsts, num, slot_type, subject, body, container, handler, arg); + room_id, communicationId, dsts, num, slot_type, subject, body, container, handler, arg); auto& nph = g_fxo->get>(); @@ -5000,7 +5001,7 @@ error_code check_attr_create_room(vm::cptr attribute) if (attr->value.num > 1 && (attr->id == SCE_NP_MATCHING_ROOM_ATTR_ID_PRIVILEGE_TYPE || - attr->id == SCE_NP_MATCHING_ROOM_ATTR_ID_ROOM_SEARCH_FLAG)) + attr->id == SCE_NP_MATCHING_ROOM_ATTR_ID_ROOM_SEARCH_FLAG)) return SCE_NP_MATCHING_ERROR_INVALID_ATTR_VALUE; } else if (attr->type == SCE_NP_MATCHING_ATTR_TYPE_GAME_BIN) @@ -5122,7 +5123,7 @@ error_code sceNpMatchingLeaveRoom(u32 ctx_id, vm::cptr room_id, vm: } error_code sceNpMatchingSearchJoinRoomGUI(u32 ctx_id, vm::cptr communicationId, vm::cptr cond, vm::cptr attr, - vm::ptr handler, vm::ptr arg) + vm::ptr handler, vm::ptr arg) { sceNp.warning("sceNpMatchingSearchJoinRoomGUI(ctx_id=%d, communicationId=*0x%x, cond=*0x%x, attr=*0x%x, handler=*0x%x, arg=*0x%x)", ctx_id, communicationId, cond, attr, handler, arg); @@ -5517,7 +5518,7 @@ std::pair, shared_ptr> get_scor { if (trans_ctx->thread.joinable()) trans_ctx->thread.join(); - + trans_ctx->result = {}; trans_ctx->tdata = {}; } @@ -5579,7 +5580,7 @@ error_code sceNpScoreGetBoardInfoAsync(s32 transId, SceNpScoreBoardId boardId, v } error_code scenp_score_record_score(s32 transId, SceNpScoreBoardId boardId, SceNpScoreValue score, vm::cptr scoreComment, vm::cptr gameInfo, - vm::ptr tmpRank, vm::ptr option, bool async) + vm::ptr tmpRank, vm::ptr option, bool async) { auto& nph = g_fxo->get>(); @@ -5635,7 +5636,7 @@ error_code scenp_score_record_score(s32 transId, SceNpScoreBoardId boardId, SceN } error_code sceNpScoreRecordScore(s32 transId, SceNpScoreBoardId boardId, SceNpScoreValue score, vm::cptr scoreComment, vm::cptr gameInfo, - vm::ptr tmpRank, vm::ptr option) + vm::ptr tmpRank, vm::ptr option) { sceNp.warning("sceNpScoreRecordScore(transId=%d, boardId=%d, score=%d, scoreComment=*0x%x, gameInfo=*0x%x, tmpRank=*0x%x, option=*0x%x)", transId, boardId, score, scoreComment, gameInfo, tmpRank, option); @@ -5643,10 +5644,10 @@ error_code sceNpScoreRecordScore(s32 transId, SceNpScoreBoardId boardId, SceNpSc } error_code sceNpScoreRecordScoreAsync(s32 transId, SceNpScoreBoardId boardId, SceNpScoreValue score, vm::cptr scoreComment, vm::cptr gameInfo, - vm::ptr tmpRank, s32 prio, vm::ptr option) + vm::ptr tmpRank, s32 prio, vm::ptr option) { sceNp.warning("sceNpScoreRecordScoreAsync(transId=%d, boardId=%d, score=%d, scoreComment=*0x%x, gameInfo=*0x%x, tmpRank=*0x%x, prio=%d, option=*0x%x)", transId, boardId, score, scoreComment, gameInfo, - tmpRank, prio, option); + tmpRank, prio, option); return scenp_score_record_score(transId, boardId, score, scoreComment, gameInfo, tmpRank, option, true); } @@ -5807,7 +5808,7 @@ error_code scenp_score_get_ranking_by_npid(s32 transId, SceNpScoreBoardId boardI std::vector> npid_vec; - static constexpr bool is_npid = std::is_same_v>; + static constexpr bool is_npid = std::is_same_v>; static constexpr bool is_npidpcid = std::is_same_v>; static_assert(is_npid || is_npidpcid, "T should be vm::cptr or vm::cptr"); @@ -5847,32 +5848,32 @@ error_code scenp_score_get_ranking_by_npid(s32 transId, SceNpScoreBoardId boardI } error_code sceNpScoreGetRankingByNpId(s32 transId, SceNpScoreBoardId boardId, vm::cptr npIdArray, u32 npIdArraySize, vm::ptr rankArray, u32 rankArraySize, - vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, - vm::ptr totalRecord, vm::ptr option) + vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, vm::ptr option) { sceNp.warning("sceNpScoreGetRankingByNpId(transId=%d, boardId=%d, npIdArray=*0x%x, npIdArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, " - "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, boardId, npIdArray, npIdArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); + "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, boardId, npIdArray, npIdArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); return scenp_score_get_ranking_by_npid(transId, boardId, npIdArray, npIdArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option, false); } error_code sceNpScoreGetRankingByNpIdAsync(s32 transId, SceNpScoreBoardId boardId, vm::cptr npIdArray, u32 npIdArraySize, vm::ptr rankArray, u32 rankArraySize, - vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, - vm::ptr totalRecord, s32 prio, vm::ptr option) + vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, s32 prio, vm::ptr option) { sceNp.warning("sceNpScoreGetRankingByNpIdAsync(transId=%d, boardId=%d, npIdArray=*0x%x, npIdArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, " - "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, boardId, npIdArray, npIdArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); + "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, boardId, npIdArray, npIdArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); return scenp_score_get_ranking_by_npid(transId, boardId, npIdArray, npIdArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option, true); } error_code scenp_score_get_ranking_by_range(s32 transId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, u32 rankArraySize, - vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, - vm::ptr totalRecord, vm::ptr option, bool async) + vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, vm::ptr option, bool async) { auto& nph = g_fxo->get>(); @@ -5951,31 +5952,31 @@ error_code scenp_score_get_ranking_by_range(s32 transId, SceNpScoreBoardId board } error_code sceNpScoreGetRankingByRange(s32 transId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, u32 rankArraySize, - vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, - vm::ptr totalRecord, vm::ptr option) + vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, vm::ptr option) { sceNp.warning("sceNpScoreGetRankingByRange(transId=%d, boardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, " - "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); + "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); return scenp_score_get_ranking_by_range(transId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option, false); } error_code sceNpScoreGetRankingByRangeAsync(s32 transId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, u32 rankArraySize, - vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, - vm::ptr totalRecord, s32 prio, vm::ptr option) + vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, s32 prio, vm::ptr option) { sceNp.warning("sceNpScoreGetRankingByRangeAsync(transId=%d, boardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, " - "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); + "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); return scenp_score_get_ranking_by_range(transId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option, true); } error_code scenp_score_get_friends_ranking(s32 transId, SceNpScoreBoardId boardId, s32 includeSelf, vm::ptr rankArray, u32 rankArraySize, vm::ptr commentArray, - u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option, + u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option, bool async) { auto& nph = g_fxo->get>(); @@ -6033,23 +6034,23 @@ error_code scenp_score_get_friends_ranking(s32 transId, SceNpScoreBoardId boardI } error_code sceNpScoreGetFriendsRanking(s32 transId, SceNpScoreBoardId boardId, s32 includeSelf, vm::ptr rankArray, u32 rankArraySize, vm::ptr commentArray, - u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) + u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) { sceNp.warning("sceNpScoreGetFriendsRanking(transId=%d, boardId=%d, includeSelf=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, " - "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, boardId, includeSelf, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); + "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, boardId, includeSelf, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); return scenp_score_get_friends_ranking(transId, boardId, includeSelf, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option, false); } error_code sceNpScoreGetFriendsRankingAsync(s32 transId, SceNpScoreBoardId boardId, s32 includeSelf, vm::ptr rankArray, u32 rankArraySize, vm::ptr commentArray, - u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, - vm::ptr option) + u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, + vm::ptr option) { sceNp.warning("sceNpScoreGetFriendsRankingAsync(transId=%d, boardId=%d, includeSelf=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, " - "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, boardId, includeSelf, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); + "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, boardId, includeSelf, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); return scenp_score_get_friends_ranking(transId, boardId, includeSelf, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option, true); @@ -6166,24 +6167,24 @@ error_code sceNpScoreSanitizeCommentAsync(s32 transId, vm::cptr comment, v } error_code sceNpScoreGetRankingByNpIdPcId(s32 transId, SceNpScoreBoardId boardId, vm::cptr idArray, u32 idArraySize, vm::ptr rankArray, u32 rankArraySize, - vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, - vm::ptr totalRecord, vm::ptr option) + vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, vm::ptr option) { sceNp.warning("sceNpScoreGetRankingByNpIdPcId(transId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, " - "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); + "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); return scenp_score_get_ranking_by_npid(transId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option, false); } error_code sceNpScoreGetRankingByNpIdPcIdAsync(s32 transId, SceNpScoreBoardId boardId, vm::cptr idArray, u32 idArraySize, vm::ptr rankArray, - u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, - vm::ptr totalRecord, s32 prio, vm::ptr option) + u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, u32 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, s32 prio, vm::ptr option) { sceNp.warning("sceNpScoreGetRankingByNpIdPcIdAsync(transId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, " - "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); + "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); return scenp_score_get_ranking_by_npid(transId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option, true); @@ -6212,13 +6213,13 @@ error_code sceNpScoreAbortTransaction(s32 transId) } error_code sceNpScoreGetClansMembersRankingByNpId(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, vm::cptr idArray, u32 idArraySize, vm::ptr rankArray, - u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, vm::ptr descriptArray, - u32 descriptArraySize, u32 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) + u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, vm::ptr descriptArray, + u32 descriptArraySize, u32 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) { sceNp.todo("sceNpScoreGetClansMembersRankingByNpId(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " - "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, - lastSortDate, totalRecord, option); + "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, + lastSortDate, totalRecord, option); auto& nph = g_fxo->get>(); @@ -6251,14 +6252,14 @@ error_code sceNpScoreGetClansMembersRankingByNpId(s32 transId, SceNpClanId clanI } error_code sceNpScoreGetClansMembersRankingByNpIdAsync(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, vm::cptr idArray, u32 idArraySize, - vm::ptr rankArray, u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, - vm::ptr descriptArray, u32 descriptArraySize, u32 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, - vm::ptr totalRecord, s32 prio, vm::ptr option) + vm::ptr rankArray, u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, + vm::ptr descriptArray, u32 descriptArraySize, u32 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, + vm::ptr totalRecord, s32 prio, vm::ptr option) { sceNp.todo("sceNpScoreGetClansMembersRankingByNpIdAsync(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " - "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, - lastSortDate, totalRecord, prio, option); + "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, + lastSortDate, totalRecord, prio, option); auto& nph = g_fxo->get>(); @@ -6281,14 +6282,14 @@ error_code sceNpScoreGetClansMembersRankingByNpIdAsync(s32 transId, SceNpClanId } error_code sceNpScoreGetClansMembersRankingByNpIdPcId(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, vm::cptr idArray, u32 idArraySize, - vm::ptr rankArray, u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, - vm::ptr descriptArray, u32 descriptArraySize, u32 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, - vm::ptr totalRecord, vm::ptr option) + vm::ptr rankArray, u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, + vm::ptr descriptArray, u32 descriptArraySize, u32 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, + vm::ptr totalRecord, vm::ptr option) { sceNp.todo("sceNpScoreGetClansMembersRankingByNpIdPcId(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " - "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, - lastSortDate, totalRecord, option); + "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, + lastSortDate, totalRecord, option); auto& nph = g_fxo->get>(); @@ -6321,15 +6322,15 @@ error_code sceNpScoreGetClansMembersRankingByNpIdPcId(s32 transId, SceNpClanId c } error_code sceNpScoreGetClansMembersRankingByNpIdPcIdAsync(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, vm::cptr idArray, u32 idArraySize, - vm::ptr rankArray, u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, - vm::ptr descriptArray, u32 descriptArraySize, u32 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, - vm::ptr totalRecord, s32 prio, vm::ptr option) + vm::ptr rankArray, u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, + vm::ptr descriptArray, u32 descriptArraySize, u32 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, + vm::ptr totalRecord, s32 prio, vm::ptr option) { sceNp.todo( - "sceNpScoreGetClansMembersRankingByNpIdPcIdAsync(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " - "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, - lastSortDate, totalRecord, prio, option); + "sceNpScoreGetClansMembersRankingByNpIdPcIdAsync(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " + "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, + lastSortDate, totalRecord, prio, option); auto& nph = g_fxo->get>(); @@ -6352,12 +6353,12 @@ error_code sceNpScoreGetClansMembersRankingByNpIdPcIdAsync(s32 transId, SceNpCla } error_code sceNpScoreGetClansRankingByRange(s32 transId, SceNpScoreClansBoardId clanBoardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, u32 rankArraySize, - vm::ptr reserved1, u32 reservedSize1, vm::ptr reserved2, u32 reservedSize2, u32 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, - vm::ptr option) + vm::ptr reserved1, u32 reservedSize1, vm::ptr reserved2, u32 reservedSize2, u32 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, + vm::ptr option) { sceNp.todo("sceNpScoreGetClansRankingByRange(transId=%d, clanBoardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, reserved1=*0x%x, reservedSize1=%d, reserved2=*0x%x, reservedSize2=%d, " - "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, clanBoardId, startSerialRank, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, option); + "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, clanBoardId, startSerialRank, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, option); auto& nph = g_fxo->get>(); @@ -6390,12 +6391,12 @@ error_code sceNpScoreGetClansRankingByRange(s32 transId, SceNpScoreClansBoardId } error_code sceNpScoreGetClansRankingByRangeAsync(s32 transId, SceNpScoreClansBoardId clanBoardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, u32 rankArraySize, - vm::ptr reserved1, u32 reservedSize1, vm::ptr reserved2, u32 reservedSize2, u32 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, - vm::ptr option) + vm::ptr reserved1, u32 reservedSize1, vm::ptr reserved2, u32 reservedSize2, u32 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, + vm::ptr option) { sceNp.todo("sceNpScoreGetClansRankingByRangeAsync(transId=%d, clanBoardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, reserved1=*0x%x, reservedSize1=%d, reserved2=*0x%x, " - "reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, clanBoardId, startSerialRank, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, prio, option); + "reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, clanBoardId, startSerialRank, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, prio, option); auto& nph = g_fxo->get>(); @@ -6418,10 +6419,10 @@ error_code sceNpScoreGetClansRankingByRangeAsync(s32 transId, SceNpScoreClansBoa } error_code sceNpScoreGetClanMemberGameData( - s32 transId, SceNpScoreBoardId boardId, SceNpClanId clanId, vm::cptr npId, vm::ptr totalSize, u32 recvSize, vm::ptr data, vm::ptr option) + s32 transId, SceNpScoreBoardId boardId, SceNpClanId clanId, vm::cptr npId, vm::ptr totalSize, u32 recvSize, vm::ptr data, vm::ptr option) { sceNp.todo("sceNpScoreGetClanMemberGameData(transId=%d, boardId=%d, clanId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, option=*0x%x)", transId, boardId, clanId, npId, totalSize, - recvSize, data, option); + recvSize, data, option); auto& nph = g_fxo->get>(); @@ -6449,10 +6450,10 @@ error_code sceNpScoreGetClanMemberGameData( } error_code sceNpScoreGetClanMemberGameDataAsync( - s32 transId, SceNpScoreBoardId boardId, SceNpClanId clanId, vm::cptr npId, vm::ptr totalSize, u32 recvSize, vm::ptr data, s32 prio, vm::ptr option) + s32 transId, SceNpScoreBoardId boardId, SceNpClanId clanId, vm::cptr npId, vm::ptr totalSize, u32 recvSize, vm::ptr data, s32 prio, vm::ptr option) { sceNp.todo("sceNpScoreGetClanMemberGameDataAsync(transId=%d, boardId=%d, clanId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, prio=%d, option=*0x%x)", transId, boardId, clanId, npId, - totalSize, recvSize, data, prio, option); + totalSize, recvSize, data, prio, option); auto& nph = g_fxo->get>(); @@ -6470,12 +6471,12 @@ error_code sceNpScoreGetClanMemberGameDataAsync( } error_code sceNpScoreGetClansRankingByClanId(s32 transId, SceNpScoreClansBoardId clanBoardId, vm::cptr clanIdArray, u32 clanIdArraySize, vm::ptr rankArray, - u32 rankArraySize, vm::ptr reserved1, u32 reservedSize1, vm::ptr reserved2, u32 reservedSize2, u32 arrayNum, vm::ptr lastSortDate, - vm::ptr totalRecord, vm::ptr option) + u32 rankArraySize, vm::ptr reserved1, u32 reservedSize1, vm::ptr reserved2, u32 reservedSize2, u32 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, vm::ptr option) { sceNp.todo("sceNpScoreGetClansRankingByClanId(transId=%d, clanBoardId=%d, clanIdArray=*0x%x, clanIdArraySize=%d, rankArray=*0x%x, rankArraySize=%d, reserved1=*0x%x, reservedSize1=%d, " - "reserved2=*0x%x, reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, clanBoardId, clanIdArray, clanIdArraySize, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, option); + "reserved2=*0x%x, reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, clanBoardId, clanIdArray, clanIdArraySize, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, option); auto& nph = g_fxo->get>(); @@ -6508,12 +6509,12 @@ error_code sceNpScoreGetClansRankingByClanId(s32 transId, SceNpScoreClansBoardId } error_code sceNpScoreGetClansRankingByClanIdAsync(s32 transId, SceNpScoreClansBoardId clanBoardId, vm::cptr clanIdArray, u32 clanIdArraySize, vm::ptr rankArray, - u32 rankArraySize, vm::ptr reserved1, u32 reservedSize1, vm::ptr reserved2, u32 reservedSize2, u32 arrayNum, vm::ptr lastSortDate, - vm::ptr totalRecord, s32 prio, vm::ptr option) + u32 rankArraySize, vm::ptr reserved1, u32 reservedSize1, vm::ptr reserved2, u32 reservedSize2, u32 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, s32 prio, vm::ptr option) { sceNp.todo("sceNpScoreGetClansRankingByRangeAsync(transId=%d, clanBoardId=%d, clanIdArray=*0x%x, clanIdArraySize=%d, rankArray=*0x%x, rankArraySize=%d, reserved1=*0x%x, reservedSize1=%d, " - "reserved2=*0x%x, reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, clanBoardId, clanIdArray, clanIdArraySize, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, prio, option); + "reserved2=*0x%x, reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, clanBoardId, clanIdArray, clanIdArraySize, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, prio, option); auto& nph = g_fxo->get>(); @@ -6536,13 +6537,13 @@ error_code sceNpScoreGetClansRankingByClanIdAsync(s32 transId, SceNpScoreClansBo } error_code sceNpScoreGetClansMembersRankingByRange(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, - u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, vm::ptr descriptArray, - u32 descriptArraySize, u32 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) + u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, vm::ptr descriptArray, + u32 descriptArraySize, u32 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) { sceNp.todo("sceNpScoreGetClansMembersRankingByRange(transId=%d, clanId=%d, boardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " - "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, clanId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, - totalRecord, option); + "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, clanId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, + totalRecord, option); auto& nph = g_fxo->get>(); @@ -6575,13 +6576,13 @@ error_code sceNpScoreGetClansMembersRankingByRange(s32 transId, SceNpClanId clan } error_code sceNpScoreGetClansMembersRankingByRangeAsync(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, - u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, vm::ptr descriptArray, - u32 descriptArraySize, u32 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, vm::ptr option) + u32 rankArraySize, vm::ptr commentArray, u32 commentArraySize, vm::ptr infoArray, u32 infoArraySize, vm::ptr descriptArray, + u32 descriptArraySize, u32 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, vm::ptr option) { sceNp.todo("sceNpScoreGetClansMembersRankingByRangeAsync(transId=%d, clanId=%d, boardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " - "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, clanId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, - totalRecord, prio, option); + "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, clanId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, + totalRecord, prio, option); auto& nph = g_fxo->get>(); @@ -6858,42 +6859,42 @@ error_code sceNpSignalingGetConnectionInfo(u32 ctx_id, u32 conn_id, s32 code, vm switch (code) { - case SCE_NP_SIGNALING_CONN_INFO_RTT: - { - info->rtt = si->rtt; - break; - } - case SCE_NP_SIGNALING_CONN_INFO_BANDWIDTH: - { - info->bandwidth = 100'000'000; // 100 MBPS HACK - break; - } - case SCE_NP_SIGNALING_CONN_INFO_PEER_NPID: - { - info->npId = si->npid; - break; - } - case SCE_NP_SIGNALING_CONN_INFO_PEER_ADDRESS: - { - info->address.port = std::bit_cast>(si->port); - info->address.addr.np_s_addr = si->addr; - break; - } - case SCE_NP_SIGNALING_CONN_INFO_MAPPED_ADDRESS: - { - info->address.port = std::bit_cast>(si->mapped_port); - info->address.addr.np_s_addr = si->mapped_addr; - break; - } - case SCE_NP_SIGNALING_CONN_INFO_PACKET_LOSS: - { - info->packet_loss = 0; // HACK - break; - } - default: - { - return SCE_NP_SIGNALING_ERROR_INVALID_ARGUMENT; - } + case SCE_NP_SIGNALING_CONN_INFO_RTT: + { + info->rtt = si->rtt; + break; + } + case SCE_NP_SIGNALING_CONN_INFO_BANDWIDTH: + { + info->bandwidth = 100'000'000; // 100 MBPS HACK + break; + } + case SCE_NP_SIGNALING_CONN_INFO_PEER_NPID: + { + info->npId = si->npid; + break; + } + case SCE_NP_SIGNALING_CONN_INFO_PEER_ADDRESS: + { + info->address.port = std::bit_cast>(si->port); + info->address.addr.np_s_addr = si->addr; + break; + } + case SCE_NP_SIGNALING_CONN_INFO_MAPPED_ADDRESS: + { + info->address.port = std::bit_cast>(si->mapped_port); + info->address.addr.np_s_addr = si->mapped_addr; + break; + } + case SCE_NP_SIGNALING_CONN_INFO_PACKET_LOSS: + { + info->packet_loss = 0; // HACK + break; + } + default: + { + return SCE_NP_SIGNALING_ERROR_INVALID_ARGUMENT; + } } return CELL_OK; @@ -6978,14 +6979,14 @@ error_code sceNpSignalingGetLocalNetInfo(u32 ctx_id, vm::ptrlocal_addr = nph.get_local_ip_addr(); + info->local_addr = nph.get_local_ip_addr(); info->mapped_addr = nph.get_public_ip_addr(); // Pure speculation below - info->nat_status = SCE_NP_SIGNALING_NETINFO_NAT_STATUS_TYPE2; - info->upnp_status = nph.get_upnp_status(); + info->nat_status = SCE_NP_SIGNALING_NETINFO_NAT_STATUS_TYPE2; + info->upnp_status = nph.get_upnp_status(); info->npport_status = SCE_NP_SIGNALING_NETINFO_NPPORT_STATUS_OPEN; - info->npport = SCE_NP_PORT; + info->npport = SCE_NP_PORT; return CELL_OK; } @@ -7051,13 +7052,13 @@ error_code sceNpUtilCanonicalizeNpIdForPs3(vm::ptr npId) return SCE_NP_UTIL_ERROR_INVALID_ARGUMENT; // TODO: These checks are commented out for compatibility with RPCN for now - //if (npId->reserved[0] != 1) + // if (npId->reserved[0] != 1) // return SCE_NP_UTIL_ERROR_INVALID_NP_ID; - //if (!npId->unk1[1]) + // if (!npId->unk1[1]) //{ // npId->unk1[1] = "ps3\0"_u32; - //} + // } return CELL_OK; } @@ -7070,13 +7071,13 @@ error_code sceNpUtilCanonicalizeNpIdForPsp(vm::ptr npId) return SCE_NP_UTIL_ERROR_INVALID_ARGUMENT; // TODO: These checks are commented out for compatibility with RPCN for now - //if (npId->reserved[0] != 1) + // if (npId->reserved[0] != 1) // return SCE_NP_UTIL_ERROR_INVALID_NP_ID; - //if (!npId->unk1[1]) + // if (!npId->unk1[1]) //{ // npId->unk1[1] = "psp\0"_u32; // TODO: confirm - //} + // } return CELL_OK; } @@ -7203,13 +7204,17 @@ error_code sceNpUtilSetPlatformType(vm::ptr npId, SceNpPlatformType pla switch (platformType) { case SCE_NP_PLATFORM_TYPE_PS4: - npId->unk1[1] = "ps4\0"_u32; break; + npId->unk1[1] = "ps4\0"_u32; + break; case SCE_NP_PLATFORM_TYPE_VITA: - npId->unk1[1] = "psp2"_u32; break; + npId->unk1[1] = "psp2"_u32; + break; case SCE_NP_PLATFORM_TYPE_PS3: - npId->unk1[1] = "ps3\0"_u32; break; + npId->unk1[1] = "ps3\0"_u32; + break; case SCE_NP_PLATFORM_TYPE_NONE: - npId->unk1[1] = 0; break; + npId->unk1[1] = 0; + break; default: return SCE_NP_UTIL_ERROR_UNKNOWN_PLATFORM_TYPE; } @@ -7284,244 +7289,245 @@ s32 _Z32_sce_np_sysutil_cxml_prepare_docPN16sysutil_cxmlutil11FixedMemoryERN4cxm } DECLARE(ppu_module_manager::sceNp) -("sceNp", []() { - REG_FUNC(sceNp, sceNpInit); - REG_FUNC(sceNp, sceNpTerm); - REG_FUNC(sceNp, sceNpDrmIsAvailable); - REG_FUNC(sceNp, sceNpDrmIsAvailable2); - REG_FUNC(sceNp, sceNpDrmVerifyUpgradeLicense); - REG_FUNC(sceNp, sceNpDrmVerifyUpgradeLicense2); - REG_FUNC(sceNp, sceNpDrmExecuteGamePurchase); - REG_FUNC(sceNp, sceNpDrmGetTimelimit); - REG_FUNC(sceNp, sceNpDrmProcessExitSpawn); - REG_FUNC(sceNp, sceNpDrmProcessExitSpawn2); - REG_FUNC(sceNp, sceNpBasicRegisterHandler); - REG_FUNC(sceNp, sceNpBasicRegisterContextSensitiveHandler); - REG_FUNC(sceNp, sceNpBasicUnregisterHandler); - REG_FUNC(sceNp, sceNpBasicSetPresence); - REG_FUNC(sceNp, sceNpBasicSetPresenceDetails); - REG_FUNC(sceNp, sceNpBasicSetPresenceDetails2); - REG_FUNC(sceNp, sceNpBasicSendMessage); - REG_FUNC(sceNp, sceNpBasicSendMessageGui); - REG_FUNC(sceNp, sceNpBasicSendMessageAttachment); - REG_FUNC(sceNp, sceNpBasicRecvMessageAttachment); - REG_FUNC(sceNp, sceNpBasicRecvMessageAttachmentLoad); - REG_FUNC(sceNp, sceNpBasicRecvMessageCustom); - REG_FUNC(sceNp, sceNpBasicMarkMessageAsUsed); - REG_FUNC(sceNp, sceNpBasicAbortGui); - REG_FUNC(sceNp, sceNpBasicAddFriend); - REG_FUNC(sceNp, sceNpBasicGetFriendListEntryCount); - REG_FUNC(sceNp, sceNpBasicGetFriendListEntry); - REG_FUNC(sceNp, sceNpBasicGetFriendPresenceByIndex); - REG_FUNC(sceNp, sceNpBasicGetFriendPresenceByIndex2); - REG_FUNC(sceNp, sceNpBasicGetFriendPresenceByNpId); - REG_FUNC(sceNp, sceNpBasicGetFriendPresenceByNpId2); - REG_FUNC(sceNp, sceNpBasicAddPlayersHistory); - REG_FUNC(sceNp, sceNpBasicAddPlayersHistoryAsync); - REG_FUNC(sceNp, sceNpBasicGetPlayersHistoryEntryCount); - REG_FUNC(sceNp, sceNpBasicGetPlayersHistoryEntry); - REG_FUNC(sceNp, sceNpBasicAddBlockListEntry); - REG_FUNC(sceNp, sceNpBasicGetBlockListEntryCount); - REG_FUNC(sceNp, sceNpBasicGetBlockListEntry); - REG_FUNC(sceNp, sceNpBasicGetMessageAttachmentEntryCount); - REG_FUNC(sceNp, sceNpBasicGetMessageAttachmentEntry); - REG_FUNC(sceNp, sceNpBasicGetCustomInvitationEntryCount); - REG_FUNC(sceNp, sceNpBasicGetCustomInvitationEntry); - REG_FUNC(sceNp, sceNpBasicGetMatchingInvitationEntryCount); - REG_FUNC(sceNp, sceNpBasicGetMatchingInvitationEntry); - REG_FUNC(sceNp, sceNpBasicGetClanMessageEntryCount); - REG_FUNC(sceNp, sceNpBasicGetClanMessageEntry); - REG_FUNC(sceNp, sceNpBasicGetMessageEntryCount); - REG_FUNC(sceNp, sceNpBasicGetMessageEntry); - REG_FUNC(sceNp, sceNpBasicGetEvent); - REG_FUNC(sceNp, sceNpCommerceCreateCtx); - REG_FUNC(sceNp, sceNpCommerceDestroyCtx); - REG_FUNC(sceNp, sceNpCommerceInitProductCategory); - REG_FUNC(sceNp, sceNpCommerceDestroyProductCategory); - REG_FUNC(sceNp, sceNpCommerceGetProductCategoryStart); - REG_FUNC(sceNp, sceNpCommerceGetProductCategoryFinish); - REG_FUNC(sceNp, sceNpCommerceGetProductCategoryResult); - REG_FUNC(sceNp, sceNpCommerceGetProductCategoryAbort); - REG_FUNC(sceNp, sceNpCommerceGetProductId); - REG_FUNC(sceNp, sceNpCommerceGetProductName); - REG_FUNC(sceNp, sceNpCommerceGetCategoryDescription); - REG_FUNC(sceNp, sceNpCommerceGetCategoryId); - REG_FUNC(sceNp, sceNpCommerceGetCategoryImageURL); - REG_FUNC(sceNp, sceNpCommerceGetCategoryInfo); - REG_FUNC(sceNp, sceNpCommerceGetCategoryName); - REG_FUNC(sceNp, sceNpCommerceGetCurrencyCode); - REG_FUNC(sceNp, sceNpCommerceGetCurrencyDecimals); - REG_FUNC(sceNp, sceNpCommerceGetCurrencyInfo); - REG_FUNC(sceNp, sceNpCommerceGetNumOfChildCategory); - REG_FUNC(sceNp, sceNpCommerceGetNumOfChildProductSku); - REG_FUNC(sceNp, sceNpCommerceGetSkuDescription); - REG_FUNC(sceNp, sceNpCommerceGetSkuId); - REG_FUNC(sceNp, sceNpCommerceGetSkuImageURL); - REG_FUNC(sceNp, sceNpCommerceGetSkuName); - REG_FUNC(sceNp, sceNpCommerceGetSkuPrice); - REG_FUNC(sceNp, sceNpCommerceGetSkuUserData); - REG_FUNC(sceNp, sceNpCommerceSetDataFlagStart); - REG_FUNC(sceNp, sceNpCommerceGetDataFlagStart); - REG_FUNC(sceNp, sceNpCommerceSetDataFlagFinish); - REG_FUNC(sceNp, sceNpCommerceGetDataFlagFinish); - REG_FUNC(sceNp, sceNpCommerceGetDataFlagState); - REG_FUNC(sceNp, sceNpCommerceGetDataFlagAbort); - REG_FUNC(sceNp, sceNpCommerceGetChildCategoryInfo); - REG_FUNC(sceNp, sceNpCommerceGetChildProductSkuInfo); - REG_FUNC(sceNp, sceNpCommerceDoCheckoutStartAsync); - REG_FUNC(sceNp, sceNpCommerceDoCheckoutFinishAsync); - REG_FUNC(sceNp, sceNpCustomMenuRegisterActions); - REG_FUNC(sceNp, sceNpCustomMenuActionSetActivation); - REG_FUNC(sceNp, sceNpCustomMenuRegisterExceptionList); - REG_FUNC(sceNp, sceNpFriendlist); - REG_FUNC(sceNp, sceNpFriendlistCustom); - REG_FUNC(sceNp, sceNpFriendlistAbortGui); - REG_FUNC(sceNp, sceNpLookupInit); - REG_FUNC(sceNp, sceNpLookupTerm); - REG_FUNC(sceNp, sceNpLookupCreateTitleCtx); - REG_FUNC(sceNp, sceNpLookupDestroyTitleCtx); - REG_FUNC(sceNp, sceNpLookupCreateTransactionCtx); - REG_FUNC(sceNp, sceNpLookupDestroyTransactionCtx); - REG_FUNC(sceNp, sceNpLookupSetTimeout); - REG_FUNC(sceNp, sceNpLookupAbortTransaction); - REG_FUNC(sceNp, sceNpLookupWaitAsync); - REG_FUNC(sceNp, sceNpLookupPollAsync); - REG_FUNC(sceNp, sceNpLookupNpId); - REG_FUNC(sceNp, sceNpLookupNpIdAsync); - REG_FUNC(sceNp, sceNpLookupUserProfile); - REG_FUNC(sceNp, sceNpLookupUserProfileAsync); - REG_FUNC(sceNp, sceNpLookupUserProfileWithAvatarSize); - REG_FUNC(sceNp, sceNpLookupUserProfileWithAvatarSizeAsync); - REG_FUNC(sceNp, sceNpLookupAvatarImage); - REG_FUNC(sceNp, sceNpLookupAvatarImageAsync); - REG_FUNC(sceNp, sceNpLookupTitleStorage); - REG_FUNC(sceNp, sceNpLookupTitleStorageAsync); - REG_FUNC(sceNp, sceNpLookupTitleSmallStorage); - REG_FUNC(sceNp, sceNpLookupTitleSmallStorageAsync); - REG_FUNC(sceNp, sceNpManagerRegisterCallback); - REG_FUNC(sceNp, sceNpManagerUnregisterCallback); - REG_FUNC(sceNp, sceNpManagerGetStatus); - REG_FUNC(sceNp, sceNpManagerGetNetworkTime); - REG_FUNC(sceNp, sceNpManagerGetOnlineId); - REG_FUNC(sceNp, sceNpManagerGetNpId); - REG_FUNC(sceNp, sceNpManagerGetOnlineName); - REG_FUNC(sceNp, sceNpManagerGetAvatarUrl); - REG_FUNC(sceNp, sceNpManagerGetMyLanguages); - REG_FUNC(sceNp, sceNpManagerGetAccountRegion); - REG_FUNC(sceNp, sceNpManagerGetAccountAge); - REG_FUNC(sceNp, sceNpManagerGetContentRatingFlag); - REG_FUNC(sceNp, sceNpManagerGetChatRestrictionFlag); - REG_FUNC(sceNp, sceNpManagerGetCachedInfo); - REG_FUNC(sceNp, sceNpManagerGetPsHandle); - REG_FUNC(sceNp, sceNpManagerRequestTicket); - REG_FUNC(sceNp, sceNpManagerRequestTicket2); - REG_FUNC(sceNp, sceNpManagerGetTicket); - REG_FUNC(sceNp, sceNpManagerGetTicketParam); - REG_FUNC(sceNp, sceNpManagerGetEntitlementIdList); - REG_FUNC(sceNp, sceNpManagerGetEntitlementById); - REG_FUNC(sceNp, sceNpManagerGetSigninId); - REG_FUNC(sceNp, sceNpManagerSubSignin); - REG_FUNC(sceNp, sceNpManagerSubSigninAbortGui); - REG_FUNC(sceNp, sceNpManagerSubSignout); - REG_FUNC(sceNp, sceNpMatchingCreateCtx); - REG_FUNC(sceNp, sceNpMatchingDestroyCtx); - REG_FUNC(sceNp, sceNpMatchingGetResult); - REG_FUNC(sceNp, sceNpMatchingGetResultGUI); - REG_FUNC(sceNp, sceNpMatchingSetRoomInfo); - REG_FUNC(sceNp, sceNpMatchingSetRoomInfoNoLimit); - REG_FUNC(sceNp, sceNpMatchingGetRoomInfo); - REG_FUNC(sceNp, sceNpMatchingGetRoomInfoNoLimit); - REG_FUNC(sceNp, sceNpMatchingSetRoomSearchFlag); - REG_FUNC(sceNp, sceNpMatchingGetRoomSearchFlag); - REG_FUNC(sceNp, sceNpMatchingGetRoomMemberListLocal); - REG_FUNC(sceNp, sceNpMatchingGetRoomListLimitGUI); - REG_FUNC(sceNp, sceNpMatchingKickRoomMember); - REG_FUNC(sceNp, sceNpMatchingKickRoomMemberWithOpt); - REG_FUNC(sceNp, sceNpMatchingQuickMatchGUI); - REG_FUNC(sceNp, sceNpMatchingSendInvitationGUI); - REG_FUNC(sceNp, sceNpMatchingAcceptInvitationGUI); - REG_FUNC(sceNp, sceNpMatchingCreateRoomGUI); - REG_FUNC(sceNp, sceNpMatchingJoinRoomGUI); - REG_FUNC(sceNp, sceNpMatchingLeaveRoom); - REG_FUNC(sceNp, sceNpMatchingSearchJoinRoomGUI); - REG_FUNC(sceNp, sceNpMatchingGrantOwnership); - REG_FUNC(sceNp, sceNpProfileCallGui); - REG_FUNC(sceNp, sceNpProfileAbortGui); - REG_FUNC(sceNp, sceNpScoreInit); - REG_FUNC(sceNp, sceNpScoreTerm); - REG_FUNC(sceNp, sceNpScoreCreateTitleCtx); - REG_FUNC(sceNp, sceNpScoreDestroyTitleCtx); - REG_FUNC(sceNp, sceNpScoreCreateTransactionCtx); - REG_FUNC(sceNp, sceNpScoreDestroyTransactionCtx); - REG_FUNC(sceNp, sceNpScoreSetTimeout); - REG_FUNC(sceNp, sceNpScoreSetPlayerCharacterId); - REG_FUNC(sceNp, sceNpScoreWaitAsync); - REG_FUNC(sceNp, sceNpScorePollAsync); - REG_FUNC(sceNp, sceNpScoreGetBoardInfo); - REG_FUNC(sceNp, sceNpScoreGetBoardInfoAsync); - REG_FUNC(sceNp, sceNpScoreRecordScore); - REG_FUNC(sceNp, sceNpScoreRecordScoreAsync); - REG_FUNC(sceNp, sceNpScoreRecordGameData); - REG_FUNC(sceNp, sceNpScoreRecordGameDataAsync); - REG_FUNC(sceNp, sceNpScoreGetGameData); - REG_FUNC(sceNp, sceNpScoreGetGameDataAsync); - REG_FUNC(sceNp, sceNpScoreGetRankingByNpId); - REG_FUNC(sceNp, sceNpScoreGetRankingByNpIdAsync); - REG_FUNC(sceNp, sceNpScoreGetRankingByRange); - REG_FUNC(sceNp, sceNpScoreGetRankingByRangeAsync); - REG_FUNC(sceNp, sceNpScoreGetFriendsRanking); - REG_FUNC(sceNp, sceNpScoreGetFriendsRankingAsync); - REG_FUNC(sceNp, sceNpScoreCensorComment); - REG_FUNC(sceNp, sceNpScoreCensorCommentAsync); - REG_FUNC(sceNp, sceNpScoreSanitizeComment); - REG_FUNC(sceNp, sceNpScoreSanitizeCommentAsync); - REG_FUNC(sceNp, sceNpScoreGetRankingByNpIdPcId); - REG_FUNC(sceNp, sceNpScoreGetRankingByNpIdPcIdAsync); - REG_FUNC(sceNp, sceNpScoreAbortTransaction); - REG_FUNC(sceNp, sceNpScoreGetClansMembersRankingByNpId); - REG_FUNC(sceNp, sceNpScoreGetClansMembersRankingByNpIdAsync); - REG_FUNC(sceNp, sceNpScoreGetClansMembersRankingByNpIdPcId); - REG_FUNC(sceNp, sceNpScoreGetClansMembersRankingByNpIdPcIdAsync); - REG_FUNC(sceNp, sceNpScoreGetClansMembersRankingByRange); - REG_FUNC(sceNp, sceNpScoreGetClansMembersRankingByRangeAsync); - REG_FUNC(sceNp, sceNpScoreGetClanMemberGameData); - REG_FUNC(sceNp, sceNpScoreGetClanMemberGameDataAsync); - REG_FUNC(sceNp, sceNpScoreGetClansRankingByClanId); - REG_FUNC(sceNp, sceNpScoreGetClansRankingByClanIdAsync); - REG_FUNC(sceNp, sceNpScoreGetClansRankingByRange); - REG_FUNC(sceNp, sceNpScoreGetClansRankingByRangeAsync); - REG_FUNC(sceNp, sceNpSignalingCreateCtx); - REG_FUNC(sceNp, sceNpSignalingDestroyCtx); - REG_FUNC(sceNp, sceNpSignalingAddExtendedHandler); - REG_FUNC(sceNp, sceNpSignalingSetCtxOpt); - REG_FUNC(sceNp, sceNpSignalingGetCtxOpt); - REG_FUNC(sceNp, sceNpSignalingActivateConnection); - REG_FUNC(sceNp, sceNpSignalingDeactivateConnection); - REG_FUNC(sceNp, sceNpSignalingTerminateConnection); - REG_FUNC(sceNp, sceNpSignalingGetConnectionStatus); - REG_FUNC(sceNp, sceNpSignalingGetConnectionInfo); - REG_FUNC(sceNp, sceNpSignalingGetConnectionFromNpId); - REG_FUNC(sceNp, sceNpSignalingGetConnectionFromPeerAddress); - REG_FUNC(sceNp, sceNpSignalingGetLocalNetInfo); - REG_FUNC(sceNp, sceNpSignalingGetPeerNetInfo); - REG_FUNC(sceNp, sceNpSignalingCancelPeerNetInfo); - REG_FUNC(sceNp, sceNpSignalingGetPeerNetInfoResult); - REG_FUNC(sceNp, sceNpUtilCanonicalizeNpIdForPs3); - REG_FUNC(sceNp, sceNpUtilCanonicalizeNpIdForPsp); - REG_FUNC(sceNp, sceNpUtilCmpNpId); - REG_FUNC(sceNp, sceNpUtilCmpNpIdInOrder); - REG_FUNC(sceNp, sceNpUtilCmpOnlineId); - REG_FUNC(sceNp, sceNpUtilGetPlatformType); - REG_FUNC(sceNp, sceNpUtilSetPlatformType); - 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); -}); +("sceNp", []() + { + REG_FUNC(sceNp, sceNpInit); + REG_FUNC(sceNp, sceNpTerm); + REG_FUNC(sceNp, sceNpDrmIsAvailable); + REG_FUNC(sceNp, sceNpDrmIsAvailable2); + REG_FUNC(sceNp, sceNpDrmVerifyUpgradeLicense); + REG_FUNC(sceNp, sceNpDrmVerifyUpgradeLicense2); + REG_FUNC(sceNp, sceNpDrmExecuteGamePurchase); + REG_FUNC(sceNp, sceNpDrmGetTimelimit); + REG_FUNC(sceNp, sceNpDrmProcessExitSpawn); + REG_FUNC(sceNp, sceNpDrmProcessExitSpawn2); + REG_FUNC(sceNp, sceNpBasicRegisterHandler); + REG_FUNC(sceNp, sceNpBasicRegisterContextSensitiveHandler); + REG_FUNC(sceNp, sceNpBasicUnregisterHandler); + REG_FUNC(sceNp, sceNpBasicSetPresence); + REG_FUNC(sceNp, sceNpBasicSetPresenceDetails); + REG_FUNC(sceNp, sceNpBasicSetPresenceDetails2); + REG_FUNC(sceNp, sceNpBasicSendMessage); + REG_FUNC(sceNp, sceNpBasicSendMessageGui); + REG_FUNC(sceNp, sceNpBasicSendMessageAttachment); + REG_FUNC(sceNp, sceNpBasicRecvMessageAttachment); + REG_FUNC(sceNp, sceNpBasicRecvMessageAttachmentLoad); + REG_FUNC(sceNp, sceNpBasicRecvMessageCustom); + REG_FUNC(sceNp, sceNpBasicMarkMessageAsUsed); + REG_FUNC(sceNp, sceNpBasicAbortGui); + REG_FUNC(sceNp, sceNpBasicAddFriend); + REG_FUNC(sceNp, sceNpBasicGetFriendListEntryCount); + REG_FUNC(sceNp, sceNpBasicGetFriendListEntry); + REG_FUNC(sceNp, sceNpBasicGetFriendPresenceByIndex); + REG_FUNC(sceNp, sceNpBasicGetFriendPresenceByIndex2); + REG_FUNC(sceNp, sceNpBasicGetFriendPresenceByNpId); + REG_FUNC(sceNp, sceNpBasicGetFriendPresenceByNpId2); + REG_FUNC(sceNp, sceNpBasicAddPlayersHistory); + REG_FUNC(sceNp, sceNpBasicAddPlayersHistoryAsync); + REG_FUNC(sceNp, sceNpBasicGetPlayersHistoryEntryCount); + REG_FUNC(sceNp, sceNpBasicGetPlayersHistoryEntry); + REG_FUNC(sceNp, sceNpBasicAddBlockListEntry); + REG_FUNC(sceNp, sceNpBasicGetBlockListEntryCount); + REG_FUNC(sceNp, sceNpBasicGetBlockListEntry); + REG_FUNC(sceNp, sceNpBasicGetMessageAttachmentEntryCount); + REG_FUNC(sceNp, sceNpBasicGetMessageAttachmentEntry); + REG_FUNC(sceNp, sceNpBasicGetCustomInvitationEntryCount); + REG_FUNC(sceNp, sceNpBasicGetCustomInvitationEntry); + REG_FUNC(sceNp, sceNpBasicGetMatchingInvitationEntryCount); + REG_FUNC(sceNp, sceNpBasicGetMatchingInvitationEntry); + REG_FUNC(sceNp, sceNpBasicGetClanMessageEntryCount); + REG_FUNC(sceNp, sceNpBasicGetClanMessageEntry); + REG_FUNC(sceNp, sceNpBasicGetMessageEntryCount); + REG_FUNC(sceNp, sceNpBasicGetMessageEntry); + REG_FUNC(sceNp, sceNpBasicGetEvent); + REG_FUNC(sceNp, sceNpCommerceCreateCtx); + REG_FUNC(sceNp, sceNpCommerceDestroyCtx); + REG_FUNC(sceNp, sceNpCommerceInitProductCategory); + REG_FUNC(sceNp, sceNpCommerceDestroyProductCategory); + REG_FUNC(sceNp, sceNpCommerceGetProductCategoryStart); + REG_FUNC(sceNp, sceNpCommerceGetProductCategoryFinish); + REG_FUNC(sceNp, sceNpCommerceGetProductCategoryResult); + REG_FUNC(sceNp, sceNpCommerceGetProductCategoryAbort); + REG_FUNC(sceNp, sceNpCommerceGetProductId); + REG_FUNC(sceNp, sceNpCommerceGetProductName); + REG_FUNC(sceNp, sceNpCommerceGetCategoryDescription); + REG_FUNC(sceNp, sceNpCommerceGetCategoryId); + REG_FUNC(sceNp, sceNpCommerceGetCategoryImageURL); + REG_FUNC(sceNp, sceNpCommerceGetCategoryInfo); + REG_FUNC(sceNp, sceNpCommerceGetCategoryName); + REG_FUNC(sceNp, sceNpCommerceGetCurrencyCode); + REG_FUNC(sceNp, sceNpCommerceGetCurrencyDecimals); + REG_FUNC(sceNp, sceNpCommerceGetCurrencyInfo); + REG_FUNC(sceNp, sceNpCommerceGetNumOfChildCategory); + REG_FUNC(sceNp, sceNpCommerceGetNumOfChildProductSku); + REG_FUNC(sceNp, sceNpCommerceGetSkuDescription); + REG_FUNC(sceNp, sceNpCommerceGetSkuId); + REG_FUNC(sceNp, sceNpCommerceGetSkuImageURL); + REG_FUNC(sceNp, sceNpCommerceGetSkuName); + REG_FUNC(sceNp, sceNpCommerceGetSkuPrice); + REG_FUNC(sceNp, sceNpCommerceGetSkuUserData); + REG_FUNC(sceNp, sceNpCommerceSetDataFlagStart); + REG_FUNC(sceNp, sceNpCommerceGetDataFlagStart); + REG_FUNC(sceNp, sceNpCommerceSetDataFlagFinish); + REG_FUNC(sceNp, sceNpCommerceGetDataFlagFinish); + REG_FUNC(sceNp, sceNpCommerceGetDataFlagState); + REG_FUNC(sceNp, sceNpCommerceGetDataFlagAbort); + REG_FUNC(sceNp, sceNpCommerceGetChildCategoryInfo); + REG_FUNC(sceNp, sceNpCommerceGetChildProductSkuInfo); + REG_FUNC(sceNp, sceNpCommerceDoCheckoutStartAsync); + REG_FUNC(sceNp, sceNpCommerceDoCheckoutFinishAsync); + REG_FUNC(sceNp, sceNpCustomMenuRegisterActions); + REG_FUNC(sceNp, sceNpCustomMenuActionSetActivation); + REG_FUNC(sceNp, sceNpCustomMenuRegisterExceptionList); + REG_FUNC(sceNp, sceNpFriendlist); + REG_FUNC(sceNp, sceNpFriendlistCustom); + REG_FUNC(sceNp, sceNpFriendlistAbortGui); + REG_FUNC(sceNp, sceNpLookupInit); + REG_FUNC(sceNp, sceNpLookupTerm); + REG_FUNC(sceNp, sceNpLookupCreateTitleCtx); + REG_FUNC(sceNp, sceNpLookupDestroyTitleCtx); + REG_FUNC(sceNp, sceNpLookupCreateTransactionCtx); + REG_FUNC(sceNp, sceNpLookupDestroyTransactionCtx); + REG_FUNC(sceNp, sceNpLookupSetTimeout); + REG_FUNC(sceNp, sceNpLookupAbortTransaction); + REG_FUNC(sceNp, sceNpLookupWaitAsync); + REG_FUNC(sceNp, sceNpLookupPollAsync); + REG_FUNC(sceNp, sceNpLookupNpId); + REG_FUNC(sceNp, sceNpLookupNpIdAsync); + REG_FUNC(sceNp, sceNpLookupUserProfile); + REG_FUNC(sceNp, sceNpLookupUserProfileAsync); + REG_FUNC(sceNp, sceNpLookupUserProfileWithAvatarSize); + REG_FUNC(sceNp, sceNpLookupUserProfileWithAvatarSizeAsync); + REG_FUNC(sceNp, sceNpLookupAvatarImage); + REG_FUNC(sceNp, sceNpLookupAvatarImageAsync); + REG_FUNC(sceNp, sceNpLookupTitleStorage); + REG_FUNC(sceNp, sceNpLookupTitleStorageAsync); + REG_FUNC(sceNp, sceNpLookupTitleSmallStorage); + REG_FUNC(sceNp, sceNpLookupTitleSmallStorageAsync); + REG_FUNC(sceNp, sceNpManagerRegisterCallback); + REG_FUNC(sceNp, sceNpManagerUnregisterCallback); + REG_FUNC(sceNp, sceNpManagerGetStatus); + REG_FUNC(sceNp, sceNpManagerGetNetworkTime); + REG_FUNC(sceNp, sceNpManagerGetOnlineId); + REG_FUNC(sceNp, sceNpManagerGetNpId); + REG_FUNC(sceNp, sceNpManagerGetOnlineName); + REG_FUNC(sceNp, sceNpManagerGetAvatarUrl); + REG_FUNC(sceNp, sceNpManagerGetMyLanguages); + REG_FUNC(sceNp, sceNpManagerGetAccountRegion); + REG_FUNC(sceNp, sceNpManagerGetAccountAge); + REG_FUNC(sceNp, sceNpManagerGetContentRatingFlag); + REG_FUNC(sceNp, sceNpManagerGetChatRestrictionFlag); + REG_FUNC(sceNp, sceNpManagerGetCachedInfo); + REG_FUNC(sceNp, sceNpManagerGetPsHandle); + REG_FUNC(sceNp, sceNpManagerRequestTicket); + REG_FUNC(sceNp, sceNpManagerRequestTicket2); + REG_FUNC(sceNp, sceNpManagerGetTicket); + REG_FUNC(sceNp, sceNpManagerGetTicketParam); + REG_FUNC(sceNp, sceNpManagerGetEntitlementIdList); + REG_FUNC(sceNp, sceNpManagerGetEntitlementById); + REG_FUNC(sceNp, sceNpManagerGetSigninId); + REG_FUNC(sceNp, sceNpManagerSubSignin); + REG_FUNC(sceNp, sceNpManagerSubSigninAbortGui); + REG_FUNC(sceNp, sceNpManagerSubSignout); + REG_FUNC(sceNp, sceNpMatchingCreateCtx); + REG_FUNC(sceNp, sceNpMatchingDestroyCtx); + REG_FUNC(sceNp, sceNpMatchingGetResult); + REG_FUNC(sceNp, sceNpMatchingGetResultGUI); + REG_FUNC(sceNp, sceNpMatchingSetRoomInfo); + REG_FUNC(sceNp, sceNpMatchingSetRoomInfoNoLimit); + REG_FUNC(sceNp, sceNpMatchingGetRoomInfo); + REG_FUNC(sceNp, sceNpMatchingGetRoomInfoNoLimit); + REG_FUNC(sceNp, sceNpMatchingSetRoomSearchFlag); + REG_FUNC(sceNp, sceNpMatchingGetRoomSearchFlag); + REG_FUNC(sceNp, sceNpMatchingGetRoomMemberListLocal); + REG_FUNC(sceNp, sceNpMatchingGetRoomListLimitGUI); + REG_FUNC(sceNp, sceNpMatchingKickRoomMember); + REG_FUNC(sceNp, sceNpMatchingKickRoomMemberWithOpt); + REG_FUNC(sceNp, sceNpMatchingQuickMatchGUI); + REG_FUNC(sceNp, sceNpMatchingSendInvitationGUI); + REG_FUNC(sceNp, sceNpMatchingAcceptInvitationGUI); + REG_FUNC(sceNp, sceNpMatchingCreateRoomGUI); + REG_FUNC(sceNp, sceNpMatchingJoinRoomGUI); + REG_FUNC(sceNp, sceNpMatchingLeaveRoom); + REG_FUNC(sceNp, sceNpMatchingSearchJoinRoomGUI); + REG_FUNC(sceNp, sceNpMatchingGrantOwnership); + REG_FUNC(sceNp, sceNpProfileCallGui); + REG_FUNC(sceNp, sceNpProfileAbortGui); + REG_FUNC(sceNp, sceNpScoreInit); + REG_FUNC(sceNp, sceNpScoreTerm); + REG_FUNC(sceNp, sceNpScoreCreateTitleCtx); + REG_FUNC(sceNp, sceNpScoreDestroyTitleCtx); + REG_FUNC(sceNp, sceNpScoreCreateTransactionCtx); + REG_FUNC(sceNp, sceNpScoreDestroyTransactionCtx); + REG_FUNC(sceNp, sceNpScoreSetTimeout); + REG_FUNC(sceNp, sceNpScoreSetPlayerCharacterId); + REG_FUNC(sceNp, sceNpScoreWaitAsync); + REG_FUNC(sceNp, sceNpScorePollAsync); + REG_FUNC(sceNp, sceNpScoreGetBoardInfo); + REG_FUNC(sceNp, sceNpScoreGetBoardInfoAsync); + REG_FUNC(sceNp, sceNpScoreRecordScore); + REG_FUNC(sceNp, sceNpScoreRecordScoreAsync); + REG_FUNC(sceNp, sceNpScoreRecordGameData); + REG_FUNC(sceNp, sceNpScoreRecordGameDataAsync); + REG_FUNC(sceNp, sceNpScoreGetGameData); + REG_FUNC(sceNp, sceNpScoreGetGameDataAsync); + REG_FUNC(sceNp, sceNpScoreGetRankingByNpId); + REG_FUNC(sceNp, sceNpScoreGetRankingByNpIdAsync); + REG_FUNC(sceNp, sceNpScoreGetRankingByRange); + REG_FUNC(sceNp, sceNpScoreGetRankingByRangeAsync); + REG_FUNC(sceNp, sceNpScoreGetFriendsRanking); + REG_FUNC(sceNp, sceNpScoreGetFriendsRankingAsync); + REG_FUNC(sceNp, sceNpScoreCensorComment); + REG_FUNC(sceNp, sceNpScoreCensorCommentAsync); + REG_FUNC(sceNp, sceNpScoreSanitizeComment); + REG_FUNC(sceNp, sceNpScoreSanitizeCommentAsync); + REG_FUNC(sceNp, sceNpScoreGetRankingByNpIdPcId); + REG_FUNC(sceNp, sceNpScoreGetRankingByNpIdPcIdAsync); + REG_FUNC(sceNp, sceNpScoreAbortTransaction); + REG_FUNC(sceNp, sceNpScoreGetClansMembersRankingByNpId); + REG_FUNC(sceNp, sceNpScoreGetClansMembersRankingByNpIdAsync); + REG_FUNC(sceNp, sceNpScoreGetClansMembersRankingByNpIdPcId); + REG_FUNC(sceNp, sceNpScoreGetClansMembersRankingByNpIdPcIdAsync); + REG_FUNC(sceNp, sceNpScoreGetClansMembersRankingByRange); + REG_FUNC(sceNp, sceNpScoreGetClansMembersRankingByRangeAsync); + REG_FUNC(sceNp, sceNpScoreGetClanMemberGameData); + REG_FUNC(sceNp, sceNpScoreGetClanMemberGameDataAsync); + REG_FUNC(sceNp, sceNpScoreGetClansRankingByClanId); + REG_FUNC(sceNp, sceNpScoreGetClansRankingByClanIdAsync); + REG_FUNC(sceNp, sceNpScoreGetClansRankingByRange); + REG_FUNC(sceNp, sceNpScoreGetClansRankingByRangeAsync); + REG_FUNC(sceNp, sceNpSignalingCreateCtx); + REG_FUNC(sceNp, sceNpSignalingDestroyCtx); + REG_FUNC(sceNp, sceNpSignalingAddExtendedHandler); + REG_FUNC(sceNp, sceNpSignalingSetCtxOpt); + REG_FUNC(sceNp, sceNpSignalingGetCtxOpt); + REG_FUNC(sceNp, sceNpSignalingActivateConnection); + REG_FUNC(sceNp, sceNpSignalingDeactivateConnection); + REG_FUNC(sceNp, sceNpSignalingTerminateConnection); + REG_FUNC(sceNp, sceNpSignalingGetConnectionStatus); + REG_FUNC(sceNp, sceNpSignalingGetConnectionInfo); + REG_FUNC(sceNp, sceNpSignalingGetConnectionFromNpId); + REG_FUNC(sceNp, sceNpSignalingGetConnectionFromPeerAddress); + REG_FUNC(sceNp, sceNpSignalingGetLocalNetInfo); + REG_FUNC(sceNp, sceNpSignalingGetPeerNetInfo); + REG_FUNC(sceNp, sceNpSignalingCancelPeerNetInfo); + REG_FUNC(sceNp, sceNpSignalingGetPeerNetInfoResult); + REG_FUNC(sceNp, sceNpUtilCanonicalizeNpIdForPs3); + REG_FUNC(sceNp, sceNpUtilCanonicalizeNpIdForPsp); + REG_FUNC(sceNp, sceNpUtilCmpNpId); + REG_FUNC(sceNp, sceNpUtilCmpNpIdInOrder); + REG_FUNC(sceNp, sceNpUtilCmpOnlineId); + REG_FUNC(sceNp, sceNpUtilGetPlatformType); + REG_FUNC(sceNp, sceNpUtilSetPlatformType); + 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/rpcs3/Emu/Cell/Modules/sceNp.h b/rpcs3/rpcs3/Emu/Cell/Modules/sceNp.h index bc2ab7c6e..e700ce1a7 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sceNp.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sceNp.h @@ -10,10 +10,10 @@ error_code sceNpInit(u32 poolsize, vm::ptr poolptr); error_code sceNpTerm(); -using np_in_addr_t = u32; -using np_in_port_t = u16; +using np_in_addr_t = u32; +using np_in_port_t = u16; using np_sa_family_t = u8; -using np_socklen_t = u32; +using np_socklen_t = u32; struct np_in_addr { @@ -53,354 +53,354 @@ using SceNpTime = s64; enum SceNpError : u32 { // NP Manager Utility - SCE_NP_ERROR_NOT_INITIALIZED = 0x8002aa01, - SCE_NP_ERROR_ALREADY_INITIALIZED = 0x8002aa02, - SCE_NP_ERROR_INVALID_ARGUMENT = 0x8002aa03, - SCE_NP_ERROR_OUT_OF_MEMORY = 0x8002aa04, - SCE_NP_ERROR_ID_NO_SPACE = 0x8002aa05, - SCE_NP_ERROR_ID_NOT_FOUND = 0x8002aa06, - SCE_NP_ERROR_SESSION_RUNNING = 0x8002aa07, - SCE_NP_ERROR_LOGINID_ALREADY_EXISTS = 0x8002aa08, - SCE_NP_ERROR_INVALID_TICKET_SIZE = 0x8002aa09, - SCE_NP_ERROR_INVALID_STATE = 0x8002aa0a, - SCE_NP_ERROR_ABORTED = 0x8002aa0b, - SCE_NP_ERROR_OFFLINE = 0x8002aa0c, - SCE_NP_ERROR_VARIANT_ACCOUNT_ID = 0x8002aa0d, - SCE_NP_ERROR_GET_CLOCK = 0x8002aa0e, - SCE_NP_ERROR_INSUFFICIENT_BUFFER = 0x8002aa0f, - SCE_NP_ERROR_EXPIRED_TICKET = 0x8002aa10, - SCE_NP_ERROR_TICKET_PARAM_NOT_FOUND = 0x8002aa11, + SCE_NP_ERROR_NOT_INITIALIZED = 0x8002aa01, + SCE_NP_ERROR_ALREADY_INITIALIZED = 0x8002aa02, + SCE_NP_ERROR_INVALID_ARGUMENT = 0x8002aa03, + SCE_NP_ERROR_OUT_OF_MEMORY = 0x8002aa04, + SCE_NP_ERROR_ID_NO_SPACE = 0x8002aa05, + SCE_NP_ERROR_ID_NOT_FOUND = 0x8002aa06, + SCE_NP_ERROR_SESSION_RUNNING = 0x8002aa07, + SCE_NP_ERROR_LOGINID_ALREADY_EXISTS = 0x8002aa08, + SCE_NP_ERROR_INVALID_TICKET_SIZE = 0x8002aa09, + SCE_NP_ERROR_INVALID_STATE = 0x8002aa0a, + SCE_NP_ERROR_ABORTED = 0x8002aa0b, + SCE_NP_ERROR_OFFLINE = 0x8002aa0c, + SCE_NP_ERROR_VARIANT_ACCOUNT_ID = 0x8002aa0d, + SCE_NP_ERROR_GET_CLOCK = 0x8002aa0e, + SCE_NP_ERROR_INSUFFICIENT_BUFFER = 0x8002aa0f, + SCE_NP_ERROR_EXPIRED_TICKET = 0x8002aa10, + SCE_NP_ERROR_TICKET_PARAM_NOT_FOUND = 0x8002aa11, SCE_NP_ERROR_UNSUPPORTED_TICKET_VERSION = 0x8002aa12, SCE_NP_ERROR_TICKET_STATUS_CODE_INVALID = 0x8002aa13, - SCE_NP_ERROR_INVALID_TICKET_VERSION = 0x8002aa14, - SCE_NP_ERROR_ALREADY_USED = 0x8002aa15, - SCE_NP_ERROR_DIFFERENT_USER = 0x8002aa16, - SCE_NP_ERROR_ALREADY_DONE = 0x8002aa17, + SCE_NP_ERROR_INVALID_TICKET_VERSION = 0x8002aa14, + SCE_NP_ERROR_ALREADY_USED = 0x8002aa15, + SCE_NP_ERROR_DIFFERENT_USER = 0x8002aa16, + SCE_NP_ERROR_ALREADY_DONE = 0x8002aa17, // NP Basic Utility - SCE_NP_BASIC_ERROR_ALREADY_INITIALIZED = 0x8002a661, - SCE_NP_BASIC_ERROR_NOT_INITIALIZED = 0x8002a662, - SCE_NP_BASIC_ERROR_NOT_SUPPORTED = 0x8002a663, - SCE_NP_BASIC_ERROR_OUT_OF_MEMORY = 0x8002a664, - SCE_NP_BASIC_ERROR_INVALID_ARGUMENT = 0x8002a665, - SCE_NP_BASIC_ERROR_BAD_ID = 0x8002a666, - SCE_NP_BASIC_ERROR_IDS_DIFFER = 0x8002a667, - SCE_NP_BASIC_ERROR_PARSER_FAILED = 0x8002a668, - SCE_NP_BASIC_ERROR_TIMEOUT = 0x8002a669, - SCE_NP_BASIC_ERROR_NO_EVENT = 0x8002a66a, - SCE_NP_BASIC_ERROR_EXCEEDS_MAX = 0x8002a66b, - SCE_NP_BASIC_ERROR_INSUFFICIENT = 0x8002a66c, - SCE_NP_BASIC_ERROR_NOT_REGISTERED = 0x8002a66d, - SCE_NP_BASIC_ERROR_DATA_LOST = 0x8002a66e, - SCE_NP_BASIC_ERROR_BUSY = 0x8002a66f, - SCE_NP_BASIC_ERROR_STATUS = 0x8002a670, - SCE_NP_BASIC_ERROR_CANCEL = 0x8002a671, + SCE_NP_BASIC_ERROR_ALREADY_INITIALIZED = 0x8002a661, + SCE_NP_BASIC_ERROR_NOT_INITIALIZED = 0x8002a662, + SCE_NP_BASIC_ERROR_NOT_SUPPORTED = 0x8002a663, + SCE_NP_BASIC_ERROR_OUT_OF_MEMORY = 0x8002a664, + SCE_NP_BASIC_ERROR_INVALID_ARGUMENT = 0x8002a665, + SCE_NP_BASIC_ERROR_BAD_ID = 0x8002a666, + SCE_NP_BASIC_ERROR_IDS_DIFFER = 0x8002a667, + SCE_NP_BASIC_ERROR_PARSER_FAILED = 0x8002a668, + SCE_NP_BASIC_ERROR_TIMEOUT = 0x8002a669, + SCE_NP_BASIC_ERROR_NO_EVENT = 0x8002a66a, + SCE_NP_BASIC_ERROR_EXCEEDS_MAX = 0x8002a66b, + SCE_NP_BASIC_ERROR_INSUFFICIENT = 0x8002a66c, + SCE_NP_BASIC_ERROR_NOT_REGISTERED = 0x8002a66d, + SCE_NP_BASIC_ERROR_DATA_LOST = 0x8002a66e, + SCE_NP_BASIC_ERROR_BUSY = 0x8002a66f, + SCE_NP_BASIC_ERROR_STATUS = 0x8002a670, + SCE_NP_BASIC_ERROR_CANCEL = 0x8002a671, SCE_NP_BASIC_ERROR_INVALID_MEMORY_CONTAINER = 0x8002a672, - SCE_NP_BASIC_ERROR_INVALID_DATA_ID = 0x8002a673, - SCE_NP_BASIC_ERROR_BROKEN_DATA = 0x8002a674, - SCE_NP_BASIC_ERROR_BLOCKLIST_ADD_FAILED = 0x8002a675, - SCE_NP_BASIC_ERROR_BLOCKLIST_IS_FULL = 0x8002a676, - SCE_NP_BASIC_ERROR_SEND_FAILED = 0x8002a677, - SCE_NP_BASIC_ERROR_NOT_CONNECTED = 0x8002a678, - SCE_NP_BASIC_ERROR_INSUFFICIENT_DISK_SPACE = 0x8002a679, - SCE_NP_BASIC_ERROR_INTERNAL_FAILURE = 0x8002a67a, - SCE_NP_BASIC_ERROR_DOES_NOT_EXIST = 0x8002a67b, - SCE_NP_BASIC_ERROR_INVALID = 0x8002a67c, - SCE_NP_BASIC_ERROR_UNKNOWN = 0x8002a6bf, - SCE_NP_EXT_ERROR_CONTEXT_DOES_NOT_EXIST = 0x8002a6a1, - SCE_NP_EXT_ERROR_CONTEXT_ALREADY_EXISTS = 0x8002a6a2, - SCE_NP_EXT_ERROR_NO_CONTEXT = 0x8002a6a3, - SCE_NP_EXT_ERROR_NO_ORIGIN = 0x8002a6a4, + SCE_NP_BASIC_ERROR_INVALID_DATA_ID = 0x8002a673, + SCE_NP_BASIC_ERROR_BROKEN_DATA = 0x8002a674, + SCE_NP_BASIC_ERROR_BLOCKLIST_ADD_FAILED = 0x8002a675, + SCE_NP_BASIC_ERROR_BLOCKLIST_IS_FULL = 0x8002a676, + SCE_NP_BASIC_ERROR_SEND_FAILED = 0x8002a677, + SCE_NP_BASIC_ERROR_NOT_CONNECTED = 0x8002a678, + SCE_NP_BASIC_ERROR_INSUFFICIENT_DISK_SPACE = 0x8002a679, + SCE_NP_BASIC_ERROR_INTERNAL_FAILURE = 0x8002a67a, + SCE_NP_BASIC_ERROR_DOES_NOT_EXIST = 0x8002a67b, + SCE_NP_BASIC_ERROR_INVALID = 0x8002a67c, + SCE_NP_BASIC_ERROR_UNKNOWN = 0x8002a6bf, + SCE_NP_EXT_ERROR_CONTEXT_DOES_NOT_EXIST = 0x8002a6a1, + SCE_NP_EXT_ERROR_CONTEXT_ALREADY_EXISTS = 0x8002a6a2, + SCE_NP_EXT_ERROR_NO_CONTEXT = 0x8002a6a3, + SCE_NP_EXT_ERROR_NO_ORIGIN = 0x8002a6a4, // NP Common Utility - SCE_NP_UTIL_ERROR_INVALID_ARGUMENT = 0x8002ab01, - SCE_NP_UTIL_ERROR_OUT_OF_MEMORY = 0x8002ab02, - SCE_NP_UTIL_ERROR_INSUFFICIENT = 0x8002ab03, - SCE_NP_UTIL_ERROR_PARSER_FAILED = 0x8002ab04, - SCE_NP_UTIL_ERROR_INVALID_PROTOCOL_ID = 0x8002ab05, - SCE_NP_UTIL_ERROR_INVALID_NP_ID = 0x8002ab06, - SCE_NP_UTIL_ERROR_INVALID_NP_LOBBY_ID = 0x8002ab07, - SCE_NP_UTIL_ERROR_INVALID_NP_ROOM_ID = 0x8002ab08, - SCE_NP_UTIL_ERROR_INVALID_NP_ENV = 0x8002ab09, - SCE_NP_UTIL_ERROR_INVALID_TITLEID = 0x8002ab0a, - SCE_NP_UTIL_ERROR_INVALID_CHARACTER = 0x8002ab0b, + SCE_NP_UTIL_ERROR_INVALID_ARGUMENT = 0x8002ab01, + SCE_NP_UTIL_ERROR_OUT_OF_MEMORY = 0x8002ab02, + SCE_NP_UTIL_ERROR_INSUFFICIENT = 0x8002ab03, + SCE_NP_UTIL_ERROR_PARSER_FAILED = 0x8002ab04, + SCE_NP_UTIL_ERROR_INVALID_PROTOCOL_ID = 0x8002ab05, + SCE_NP_UTIL_ERROR_INVALID_NP_ID = 0x8002ab06, + SCE_NP_UTIL_ERROR_INVALID_NP_LOBBY_ID = 0x8002ab07, + SCE_NP_UTIL_ERROR_INVALID_NP_ROOM_ID = 0x8002ab08, + SCE_NP_UTIL_ERROR_INVALID_NP_ENV = 0x8002ab09, + SCE_NP_UTIL_ERROR_INVALID_TITLEID = 0x8002ab0a, + SCE_NP_UTIL_ERROR_INVALID_CHARACTER = 0x8002ab0b, SCE_NP_UTIL_ERROR_INVALID_ESCAPE_STRING = 0x8002ab0c, - SCE_NP_UTIL_ERROR_UNKNOWN_TYPE = 0x8002ab0d, - SCE_NP_UTIL_ERROR_UNKNOWN = 0x8002ab0e, - SCE_NP_UTIL_ERROR_NOT_MATCH = 0x8002ab0f, + SCE_NP_UTIL_ERROR_UNKNOWN_TYPE = 0x8002ab0d, + SCE_NP_UTIL_ERROR_UNKNOWN = 0x8002ab0e, + SCE_NP_UTIL_ERROR_NOT_MATCH = 0x8002ab0f, SCE_NP_UTIL_ERROR_UNKNOWN_PLATFORM_TYPE = 0x8002ab10, // NP Friendlist Utility - SCE_NP_FRIENDLIST_ERROR_ALREADY_INITIALIZED = 0x8002ab20, - SCE_NP_FRIENDLIST_ERROR_NOT_INITIALIZED = 0x8002ab21, - SCE_NP_FRIENDLIST_ERROR_OUT_OF_MEMORY = 0x8002ab22, + SCE_NP_FRIENDLIST_ERROR_ALREADY_INITIALIZED = 0x8002ab20, + SCE_NP_FRIENDLIST_ERROR_NOT_INITIALIZED = 0x8002ab21, + SCE_NP_FRIENDLIST_ERROR_OUT_OF_MEMORY = 0x8002ab22, SCE_NP_FRIENDLIST_ERROR_INVALID_MEMORY_CONTAINER = 0x8002ab23, - SCE_NP_FRIENDLIST_ERROR_INSUFFICIENT = 0x8002ab24, - SCE_NP_FRIENDLIST_ERROR_CANCEL = 0x8002ab25, - SCE_NP_FRIENDLIST_ERROR_STATUS = 0x8002ab26, - SCE_NP_FRIENDLIST_ERROR_BUSY = 0x8002ab27, - SCE_NP_FRIENDLIST_ERROR_INVALID_ARGUMENT = 0x8002ab28, + SCE_NP_FRIENDLIST_ERROR_INSUFFICIENT = 0x8002ab24, + SCE_NP_FRIENDLIST_ERROR_CANCEL = 0x8002ab25, + SCE_NP_FRIENDLIST_ERROR_STATUS = 0x8002ab26, + SCE_NP_FRIENDLIST_ERROR_BUSY = 0x8002ab27, + SCE_NP_FRIENDLIST_ERROR_INVALID_ARGUMENT = 0x8002ab28, // NP Profile Utility SCE_NP_PROFILE_ERROR_ALREADY_INITIALIZED = 0x8002ab40, - SCE_NP_PROFILE_ERROR_NOT_INITIALIZED = 0x8002ab41, - SCE_NP_PROFILE_ERROR_OUT_OF_MEMORY = 0x8002ab42, - SCE_NP_PROFILE_ERROR_NOT_SUPPORTED = 0x8002ab43, - SCE_NP_PROFILE_ERROR_INSUFFICIENT = 0x8002ab44, - SCE_NP_PROFILE_ERROR_CANCEL = 0x8002ab45, - SCE_NP_PROFILE_ERROR_STATUS = 0x8002ab46, - SCE_NP_PROFILE_ERROR_BUSY = 0x8002ab47, - SCE_NP_PROFILE_ERROR_INVALID_ARGUMENT = 0x8002ab48, - SCE_NP_PROFILE_ERROR_ABORT = 0x8002ab49, + SCE_NP_PROFILE_ERROR_NOT_INITIALIZED = 0x8002ab41, + SCE_NP_PROFILE_ERROR_OUT_OF_MEMORY = 0x8002ab42, + SCE_NP_PROFILE_ERROR_NOT_SUPPORTED = 0x8002ab43, + SCE_NP_PROFILE_ERROR_INSUFFICIENT = 0x8002ab44, + SCE_NP_PROFILE_ERROR_CANCEL = 0x8002ab45, + SCE_NP_PROFILE_ERROR_STATUS = 0x8002ab46, + SCE_NP_PROFILE_ERROR_BUSY = 0x8002ab47, + SCE_NP_PROFILE_ERROR_INVALID_ARGUMENT = 0x8002ab48, + SCE_NP_PROFILE_ERROR_ABORT = 0x8002ab49, // NP Community Utility - SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED = 0x8002a101, - SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED = 0x8002a102, - SCE_NP_COMMUNITY_ERROR_OUT_OF_MEMORY = 0x8002a103, - SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT = 0x8002a104, - SCE_NP_COMMUNITY_ERROR_NO_TITLE_SET = 0x8002a105, - SCE_NP_COMMUNITY_ERROR_NO_LOGIN = 0x8002a106, - SCE_NP_COMMUNITY_ERROR_TOO_MANY_OBJECTS = 0x8002a107, + SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED = 0x8002a101, + SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED = 0x8002a102, + SCE_NP_COMMUNITY_ERROR_OUT_OF_MEMORY = 0x8002a103, + SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT = 0x8002a104, + SCE_NP_COMMUNITY_ERROR_NO_TITLE_SET = 0x8002a105, + SCE_NP_COMMUNITY_ERROR_NO_LOGIN = 0x8002a106, + SCE_NP_COMMUNITY_ERROR_TOO_MANY_OBJECTS = 0x8002a107, SCE_NP_COMMUNITY_ERROR_TRANSACTION_STILL_REFERENCED = 0x8002a108, - SCE_NP_COMMUNITY_ERROR_ABORTED = 0x8002a109, - SCE_NP_COMMUNITY_ERROR_NO_RESOURCE = 0x8002a10a, - SCE_NP_COMMUNITY_ERROR_BAD_RESPONSE = 0x8002a10b, - SCE_NP_COMMUNITY_ERROR_BODY_TOO_LARGE = 0x8002a10c, - SCE_NP_COMMUNITY_ERROR_HTTP_SERVER = 0x8002a10d, - SCE_NP_COMMUNITY_ERROR_INVALID_SIGNATURE = 0x8002a10e, - SCE_NP_COMMUNITY_ERROR_TIMEOUT = 0x8002a10f, - SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_ARGUMENT = 0x8002a1a1, - SCE_NP_COMMUNITY_ERROR_UNKNOWN_TYPE = 0x8002a1a2, - SCE_NP_COMMUNITY_ERROR_INVALID_ID = 0x8002a1a3, - SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID = 0x8002a1a4, - SCE_NP_COMMUNITY_ERROR_INVALID_TICKET = 0x8002a1a5, + SCE_NP_COMMUNITY_ERROR_ABORTED = 0x8002a109, + SCE_NP_COMMUNITY_ERROR_NO_RESOURCE = 0x8002a10a, + SCE_NP_COMMUNITY_ERROR_BAD_RESPONSE = 0x8002a10b, + SCE_NP_COMMUNITY_ERROR_BODY_TOO_LARGE = 0x8002a10c, + SCE_NP_COMMUNITY_ERROR_HTTP_SERVER = 0x8002a10d, + SCE_NP_COMMUNITY_ERROR_INVALID_SIGNATURE = 0x8002a10e, + SCE_NP_COMMUNITY_ERROR_TIMEOUT = 0x8002a10f, + SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_ARGUMENT = 0x8002a1a1, + SCE_NP_COMMUNITY_ERROR_UNKNOWN_TYPE = 0x8002a1a2, + SCE_NP_COMMUNITY_ERROR_INVALID_ID = 0x8002a1a3, + SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID = 0x8002a1a4, + SCE_NP_COMMUNITY_ERROR_INVALID_TICKET = 0x8002a1a5, SCE_NP_COMMUNITY_ERROR_CLIENT_HANDLE_ALREADY_EXISTS = 0x8002a1a6, - SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_BUFFER = 0x8002a1a7, - SCE_NP_COMMUNITY_ERROR_INVALID_TYPE = 0x8002a1a8, - SCE_NP_COMMUNITY_ERROR_TRANSACTION_ALREADY_END = 0x8002a1a9, - SCE_NP_COMMUNITY_ERROR_TRANSACTION_BEFORE_END = 0x8002a1aa, - SCE_NP_COMMUNITY_ERROR_BUSY_BY_ANOTEHR_TRANSACTION = 0x8002a1ab, - SCE_NP_COMMUNITY_ERROR_INVALID_ALIGNMENT = 0x8002a1ac, - SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID = 0x8002a1ad, - SCE_NP_COMMUNITY_ERROR_TOO_LARGE_RANGE = 0x8002a1ae, - SCE_NP_COMMUNITY_ERROR_INVALID_PARTITION = 0x8002a1af, - SCE_NP_COMMUNITY_ERROR_TOO_MANY_SLOTID = 0x8002a1b1, + SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_BUFFER = 0x8002a1a7, + SCE_NP_COMMUNITY_ERROR_INVALID_TYPE = 0x8002a1a8, + SCE_NP_COMMUNITY_ERROR_TRANSACTION_ALREADY_END = 0x8002a1a9, + SCE_NP_COMMUNITY_ERROR_TRANSACTION_BEFORE_END = 0x8002a1aa, + SCE_NP_COMMUNITY_ERROR_BUSY_BY_ANOTEHR_TRANSACTION = 0x8002a1ab, + SCE_NP_COMMUNITY_ERROR_INVALID_ALIGNMENT = 0x8002a1ac, + SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID = 0x8002a1ad, + SCE_NP_COMMUNITY_ERROR_TOO_LARGE_RANGE = 0x8002a1ae, + SCE_NP_COMMUNITY_ERROR_INVALID_PARTITION = 0x8002a1af, + SCE_NP_COMMUNITY_ERROR_TOO_MANY_SLOTID = 0x8002a1b1, // NP Community Server - SCE_NP_COMMUNITY_SERVER_ERROR_BAD_REQUEST = 0x8002a401, - SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_TICKET = 0x8002a402, - SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_SIGNATURE = 0x8002a403, - SCE_NP_COMMUNITY_SERVER_ERROR_EXPIRED_TICKET = 0x8002a404, - SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_NPID = 0x8002a405, - SCE_NP_COMMUNITY_SERVER_ERROR_FORBIDDEN = 0x8002a406, - SCE_NP_COMMUNITY_SERVER_ERROR_INTERNAL_SERVER_ERROR = 0x8002a407, - SCE_NP_COMMUNITY_SERVER_ERROR_VERSION_NOT_SUPPORTED = 0x8002a408, - SCE_NP_COMMUNITY_SERVER_ERROR_SERVICE_UNAVAILABLE = 0x8002a409, - SCE_NP_COMMUNITY_SERVER_ERROR_PLAYER_BANNED = 0x8002a40a, - SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED = 0x8002a40b, - SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_RECORD_FORBIDDEN = 0x8002a40c, - SCE_NP_COMMUNITY_SERVER_ERROR_USER_PROFILE_NOT_FOUND = 0x8002a40d, - SCE_NP_COMMUNITY_SERVER_ERROR_UPLOADER_DATA_NOT_FOUND = 0x8002a40e, - SCE_NP_COMMUNITY_SERVER_ERROR_QUOTA_MASTER_NOT_FOUND = 0x8002a40f, - SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_TITLE_NOT_FOUND = 0x8002a410, - SCE_NP_COMMUNITY_SERVER_ERROR_BLACKLISTED_USER_ID = 0x8002a411, - SCE_NP_COMMUNITY_SERVER_ERROR_GAME_RANKING_NOT_FOUND = 0x8002a412, - SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_STORE_NOT_FOUND = 0x8002a414, - SCE_NP_COMMUNITY_SERVER_ERROR_NOT_BEST_SCORE = 0x8002a415, - SCE_NP_COMMUNITY_SERVER_ERROR_LATEST_UPDATE_NOT_FOUND = 0x8002a416, - SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_BOARD_MASTER_NOT_FOUND = 0x8002a417, - SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_GAME_DATA_MASTER_NOT_FOUND = 0x8002a418, - SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ANTICHEAT_DATA = 0x8002a419, - SCE_NP_COMMUNITY_SERVER_ERROR_TOO_LARGE_DATA = 0x8002a41a, - SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_USER_NPID = 0x8002a41b, - SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ENVIRONMENT = 0x8002a41d, - SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ONLINE_NAME_CHARACTER = 0x8002a41f, - SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ONLINE_NAME_LENGTH = 0x8002a420, - SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ABOUT_ME_CHARACTER = 0x8002a421, - SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ABOUT_ME_LENGTH = 0x8002a422, - SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_SCORE = 0x8002a423, - SCE_NP_COMMUNITY_SERVER_ERROR_OVER_THE_RANKING_LIMIT = 0x8002a424, - SCE_NP_COMMUNITY_SERVER_ERROR_FAIL_TO_CREATE_SIGNATURE = 0x8002a426, - SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_MASTER_INFO_NOT_FOUND = 0x8002a427, - SCE_NP_COMMUNITY_SERVER_ERROR_OVER_THE_GAME_DATA_LIMIT = 0x8002a428, - SCE_NP_COMMUNITY_SERVER_ERROR_SELF_DATA_NOT_FOUND = 0x8002a42a, - SCE_NP_COMMUNITY_SERVER_ERROR_USER_NOT_ASSIGNED = 0x8002a42b, - SCE_NP_COMMUNITY_SERVER_ERROR_GAME_DATA_ALREADY_EXISTS = 0x8002a42c, - SCE_NP_COMMUNITY_SERVER_ERROR_TOO_MANY_RESULTS = 0x8002a42d, - SCE_NP_COMMUNITY_SERVER_ERROR_NOT_RECORDABLE_VERSION = 0x8002a42e, + SCE_NP_COMMUNITY_SERVER_ERROR_BAD_REQUEST = 0x8002a401, + SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_TICKET = 0x8002a402, + SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_SIGNATURE = 0x8002a403, + SCE_NP_COMMUNITY_SERVER_ERROR_EXPIRED_TICKET = 0x8002a404, + SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_NPID = 0x8002a405, + SCE_NP_COMMUNITY_SERVER_ERROR_FORBIDDEN = 0x8002a406, + SCE_NP_COMMUNITY_SERVER_ERROR_INTERNAL_SERVER_ERROR = 0x8002a407, + SCE_NP_COMMUNITY_SERVER_ERROR_VERSION_NOT_SUPPORTED = 0x8002a408, + SCE_NP_COMMUNITY_SERVER_ERROR_SERVICE_UNAVAILABLE = 0x8002a409, + SCE_NP_COMMUNITY_SERVER_ERROR_PLAYER_BANNED = 0x8002a40a, + SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED = 0x8002a40b, + SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_RECORD_FORBIDDEN = 0x8002a40c, + SCE_NP_COMMUNITY_SERVER_ERROR_USER_PROFILE_NOT_FOUND = 0x8002a40d, + SCE_NP_COMMUNITY_SERVER_ERROR_UPLOADER_DATA_NOT_FOUND = 0x8002a40e, + SCE_NP_COMMUNITY_SERVER_ERROR_QUOTA_MASTER_NOT_FOUND = 0x8002a40f, + SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_TITLE_NOT_FOUND = 0x8002a410, + SCE_NP_COMMUNITY_SERVER_ERROR_BLACKLISTED_USER_ID = 0x8002a411, + SCE_NP_COMMUNITY_SERVER_ERROR_GAME_RANKING_NOT_FOUND = 0x8002a412, + SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_STORE_NOT_FOUND = 0x8002a414, + SCE_NP_COMMUNITY_SERVER_ERROR_NOT_BEST_SCORE = 0x8002a415, + SCE_NP_COMMUNITY_SERVER_ERROR_LATEST_UPDATE_NOT_FOUND = 0x8002a416, + SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_BOARD_MASTER_NOT_FOUND = 0x8002a417, + SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_GAME_DATA_MASTER_NOT_FOUND = 0x8002a418, + SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ANTICHEAT_DATA = 0x8002a419, + SCE_NP_COMMUNITY_SERVER_ERROR_TOO_LARGE_DATA = 0x8002a41a, + SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_USER_NPID = 0x8002a41b, + SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ENVIRONMENT = 0x8002a41d, + SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ONLINE_NAME_CHARACTER = 0x8002a41f, + SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ONLINE_NAME_LENGTH = 0x8002a420, + SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ABOUT_ME_CHARACTER = 0x8002a421, + SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_ABOUT_ME_LENGTH = 0x8002a422, + SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_SCORE = 0x8002a423, + SCE_NP_COMMUNITY_SERVER_ERROR_OVER_THE_RANKING_LIMIT = 0x8002a424, + SCE_NP_COMMUNITY_SERVER_ERROR_FAIL_TO_CREATE_SIGNATURE = 0x8002a426, + SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_MASTER_INFO_NOT_FOUND = 0x8002a427, + SCE_NP_COMMUNITY_SERVER_ERROR_OVER_THE_GAME_DATA_LIMIT = 0x8002a428, + SCE_NP_COMMUNITY_SERVER_ERROR_SELF_DATA_NOT_FOUND = 0x8002a42a, + SCE_NP_COMMUNITY_SERVER_ERROR_USER_NOT_ASSIGNED = 0x8002a42b, + SCE_NP_COMMUNITY_SERVER_ERROR_GAME_DATA_ALREADY_EXISTS = 0x8002a42c, + SCE_NP_COMMUNITY_SERVER_ERROR_TOO_MANY_RESULTS = 0x8002a42d, + SCE_NP_COMMUNITY_SERVER_ERROR_NOT_RECORDABLE_VERSION = 0x8002a42e, SCE_NP_COMMUNITY_SERVER_ERROR_USER_STORAGE_TITLE_MASTER_NOT_FOUND = 0x8002a448, - SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_VIRTUAL_USER = 0x8002a449, - SCE_NP_COMMUNITY_SERVER_ERROR_USER_STORAGE_DATA_NOT_FOUND = 0x8002a44a, - SCE_NP_COMMUNITY_SERVER_ERROR_CONDITIONS_NOT_SATISFIED = 0x8002a473, - SCE_NP_COMMUNITY_SERVER_ERROR_MATCHING_BEFORE_SERVICE = 0x8002a4a0, - SCE_NP_COMMUNITY_SERVER_ERROR_MATCHING_END_OF_SERVICE = 0x8002a4a1, - SCE_NP_COMMUNITY_SERVER_ERROR_MATCHING_MAINTENANCE = 0x8002a4a2, - SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_BEFORE_SERVICE = 0x8002a4a3, - SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_END_OF_SERVICE = 0x8002a4a4, - SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_MAINTENANCE = 0x8002a4a5, - SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE = 0x8002a4a6, - SCE_NP_COMMUNITY_SERVER_ERROR_TITLE_USER_STORAGE_BEFORE_SERVICE = 0x8002a4aa, - SCE_NP_COMMUNITY_SERVER_ERROR_TITLE_USER_STORAGE_END_OF_SERVICE = 0x8002a4ab, - SCE_NP_COMMUNITY_SERVER_ERROR_TITLE_USER_STORAGE_MAINTENANCE = 0x8002a4ac, - SCE_NP_COMMUNITY_SERVER_ERROR_UNSPECIFIED = 0x8002a4ff, + SCE_NP_COMMUNITY_SERVER_ERROR_INVALID_VIRTUAL_USER = 0x8002a449, + SCE_NP_COMMUNITY_SERVER_ERROR_USER_STORAGE_DATA_NOT_FOUND = 0x8002a44a, + SCE_NP_COMMUNITY_SERVER_ERROR_CONDITIONS_NOT_SATISFIED = 0x8002a473, + SCE_NP_COMMUNITY_SERVER_ERROR_MATCHING_BEFORE_SERVICE = 0x8002a4a0, + SCE_NP_COMMUNITY_SERVER_ERROR_MATCHING_END_OF_SERVICE = 0x8002a4a1, + SCE_NP_COMMUNITY_SERVER_ERROR_MATCHING_MAINTENANCE = 0x8002a4a2, + SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_BEFORE_SERVICE = 0x8002a4a3, + SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_END_OF_SERVICE = 0x8002a4a4, + SCE_NP_COMMUNITY_SERVER_ERROR_RANKING_MAINTENANCE = 0x8002a4a5, + SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE = 0x8002a4a6, + SCE_NP_COMMUNITY_SERVER_ERROR_TITLE_USER_STORAGE_BEFORE_SERVICE = 0x8002a4aa, + SCE_NP_COMMUNITY_SERVER_ERROR_TITLE_USER_STORAGE_END_OF_SERVICE = 0x8002a4ab, + SCE_NP_COMMUNITY_SERVER_ERROR_TITLE_USER_STORAGE_MAINTENANCE = 0x8002a4ac, + SCE_NP_COMMUNITY_SERVER_ERROR_UNSPECIFIED = 0x8002a4ff, // COMMERCE - SCE_NP_COMMERCE_ERROR_NOT_INITIALIZED = 0x80029401, - SCE_NP_COMMERCE_ERROR_ALREADY_INITIALIZED = 0x80029402, - SCE_NP_COMMERCE_ERROR_OUT_OF_MEMORY = 0x80029403, - SCE_NP_COMMERCE_ERROR_UNSUPPORTED_VERSION = 0x80029404, - SCE_NP_COMMERCE_ERROR_CTX_MAX = 0x80029405, - SCE_NP_COMMERCE_ERROR_CTX_NOT_FOUND = 0x80029406, - SCE_NP_COMMERCE_ERROR_CTXID_NOT_AVAILABLE = 0x80029407, - SCE_NP_COMMERCE_ERROR_REQ_MAX = 0x80029408, - SCE_NP_COMMERCE_ERROR_REQ_NOT_FOUND = 0x80029409, - SCE_NP_COMMERCE_ERROR_REQID_NOT_AVAILABLE = 0x8002940a, - SCE_NP_COMMERCE_ERROR_INVALID_CATEGORY_ID = 0x8002940b, - SCE_NP_COMMERCE_ERROR_INVALID_LANG_CODE = 0x8002940c, - SCE_NP_COMMERCE_ERROR_REQ_BUSY = 0x8002940d, - SCE_NP_COMMERCE_ERROR_INSUFFICIENT_BUFFER = 0x8002940e, - SCE_NP_COMMERCE_ERROR_INVALID_REQ_STATE = 0x8002940f, - SCE_NP_COMMERCE_ERROR_INVALID_CTX_STATE = 0x80029410, - SCE_NP_COMMERCE_ERROR_UNKNOWN = 0x80029411, - SCE_NP_COMMERCE_ERROR_INVALID_REQ_TYPE = 0x80029412, - SCE_NP_COMMERCE_ERROR_INVALID_MEMORY_CONTAINER = 0x80029413, - SCE_NP_COMMERCE_ERROR_INSUFFICIENT_MEMORY_CONTAINER = 0x80029414, - SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_TYPE = 0x80029415, - SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_STATE = 0x80029416, - SCE_NP_COMMERCE_ERROR_DATA_FLAG_NUM_NOT_FOUND = 0x80029417, - SCE_NP_COMMERCE_ERROR_DATA_FLAG_INFO_NOT_FOUND = 0x80029418, - SCE_NP_COMMERCE_ERROR_INVALID_PROVIDER_ID = 0x80029419, - SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_NUM = 0x8002941a, - SCE_NP_COMMERCE_ERROR_INVALID_SKU_ID = 0x8002941b, - SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_ID = 0x8002941c, - SCE_NP_COMMERCE_ERROR_GPC_SEND_REQUEST = 0x8002941d, - SCE_NP_COMMERCE_ERROR_GDF_SEND_REQUEST = 0x8002941e, - SCE_NP_COMMERCE_ERROR_SDF_SEND_REQUEST = 0x8002941f, + SCE_NP_COMMERCE_ERROR_NOT_INITIALIZED = 0x80029401, + SCE_NP_COMMERCE_ERROR_ALREADY_INITIALIZED = 0x80029402, + SCE_NP_COMMERCE_ERROR_OUT_OF_MEMORY = 0x80029403, + SCE_NP_COMMERCE_ERROR_UNSUPPORTED_VERSION = 0x80029404, + SCE_NP_COMMERCE_ERROR_CTX_MAX = 0x80029405, + SCE_NP_COMMERCE_ERROR_CTX_NOT_FOUND = 0x80029406, + SCE_NP_COMMERCE_ERROR_CTXID_NOT_AVAILABLE = 0x80029407, + SCE_NP_COMMERCE_ERROR_REQ_MAX = 0x80029408, + SCE_NP_COMMERCE_ERROR_REQ_NOT_FOUND = 0x80029409, + SCE_NP_COMMERCE_ERROR_REQID_NOT_AVAILABLE = 0x8002940a, + SCE_NP_COMMERCE_ERROR_INVALID_CATEGORY_ID = 0x8002940b, + SCE_NP_COMMERCE_ERROR_INVALID_LANG_CODE = 0x8002940c, + SCE_NP_COMMERCE_ERROR_REQ_BUSY = 0x8002940d, + SCE_NP_COMMERCE_ERROR_INSUFFICIENT_BUFFER = 0x8002940e, + SCE_NP_COMMERCE_ERROR_INVALID_REQ_STATE = 0x8002940f, + SCE_NP_COMMERCE_ERROR_INVALID_CTX_STATE = 0x80029410, + SCE_NP_COMMERCE_ERROR_UNKNOWN = 0x80029411, + SCE_NP_COMMERCE_ERROR_INVALID_REQ_TYPE = 0x80029412, + SCE_NP_COMMERCE_ERROR_INVALID_MEMORY_CONTAINER = 0x80029413, + SCE_NP_COMMERCE_ERROR_INSUFFICIENT_MEMORY_CONTAINER = 0x80029414, + SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_TYPE = 0x80029415, + SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_STATE = 0x80029416, + SCE_NP_COMMERCE_ERROR_DATA_FLAG_NUM_NOT_FOUND = 0x80029417, + SCE_NP_COMMERCE_ERROR_DATA_FLAG_INFO_NOT_FOUND = 0x80029418, + SCE_NP_COMMERCE_ERROR_INVALID_PROVIDER_ID = 0x80029419, + SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_NUM = 0x8002941a, + SCE_NP_COMMERCE_ERROR_INVALID_SKU_ID = 0x8002941b, + SCE_NP_COMMERCE_ERROR_INVALID_DATA_FLAG_ID = 0x8002941c, + SCE_NP_COMMERCE_ERROR_GPC_SEND_REQUEST = 0x8002941d, + SCE_NP_COMMERCE_ERROR_GDF_SEND_REQUEST = 0x8002941e, + SCE_NP_COMMERCE_ERROR_SDF_SEND_REQUEST = 0x8002941f, - SCE_NP_COMMERCE_ERROR_PARSE_PRODUCT_CATEGORY = 0x80029421, - SCE_NP_COMMERCE_ERROR_CURRENCY_INFO_NOT_FOUND = 0x80029422, - SCE_NP_COMMERCE_ERROR_CATEGORY_INFO_NOT_FOUND = 0x80029423, - SCE_NP_COMMERCE_ERROR_CHILD_CATEGORY_COUNT_NOT_FOUND = 0x80029424, - SCE_NP_COMMERCE_ERROR_CHILD_CATEGORY_INFO_NOT_FOUND = 0x80029425, - SCE_NP_COMMERCE_ERROR_SKU_COUNT_NOT_FOUND = 0x80029426, - SCE_NP_COMMERCE_ERROR_SKU_INFO_NOT_FOUND = 0x80029427, - SCE_NP_COMMERCE_ERROR_PLUGIN_LOAD_FAILURE = 0x80029428, - SCE_NP_COMMERCE_ERROR_INVALID_SKU_NUM = 0x80029429, - SCE_NP_COMMERCE_ERROR_INVALID_GPC_PROTOCOL_VERSION = 0x8002942a, + SCE_NP_COMMERCE_ERROR_PARSE_PRODUCT_CATEGORY = 0x80029421, + SCE_NP_COMMERCE_ERROR_CURRENCY_INFO_NOT_FOUND = 0x80029422, + SCE_NP_COMMERCE_ERROR_CATEGORY_INFO_NOT_FOUND = 0x80029423, + SCE_NP_COMMERCE_ERROR_CHILD_CATEGORY_COUNT_NOT_FOUND = 0x80029424, + SCE_NP_COMMERCE_ERROR_CHILD_CATEGORY_INFO_NOT_FOUND = 0x80029425, + SCE_NP_COMMERCE_ERROR_SKU_COUNT_NOT_FOUND = 0x80029426, + SCE_NP_COMMERCE_ERROR_SKU_INFO_NOT_FOUND = 0x80029427, + SCE_NP_COMMERCE_ERROR_PLUGIN_LOAD_FAILURE = 0x80029428, + SCE_NP_COMMERCE_ERROR_INVALID_SKU_NUM = 0x80029429, + SCE_NP_COMMERCE_ERROR_INVALID_GPC_PROTOCOL_VERSION = 0x8002942a, - SCE_NP_COMMERCE_ERROR_CHECKOUT_UNEXPECTED = 0x80029430, - SCE_NP_COMMERCE_ERROR_CHECKOUT_OUT_OF_SERVICE = 0x80029431, - SCE_NP_COMMERCE_ERROR_CHECKOUT_INVALID_SKU = 0x80029432, - SCE_NP_COMMERCE_ERROR_CHECKOUT_SERVER_BUSY = 0x80029433, - SCE_NP_COMMERCE_ERROR_CHECKOUT_MAINTENANCE = 0x80029434, - SCE_NP_COMMERCE_ERROR_CHECKOUT_ACCOUNT_SUSPENDED = 0x80029435, - SCE_NP_COMMERCE_ERROR_CHECKOUT_OVER_SPENDING_LIMIT = 0x80029436, - SCE_NP_COMMERCE_ERROR_CHECKOUT_NOT_ENOUGH_MONEY = 0x80029437, - SCE_NP_COMMERCE_ERROR_CHECKOUT_UNKNOWN = 0x80029438, + SCE_NP_COMMERCE_ERROR_CHECKOUT_UNEXPECTED = 0x80029430, + SCE_NP_COMMERCE_ERROR_CHECKOUT_OUT_OF_SERVICE = 0x80029431, + SCE_NP_COMMERCE_ERROR_CHECKOUT_INVALID_SKU = 0x80029432, + SCE_NP_COMMERCE_ERROR_CHECKOUT_SERVER_BUSY = 0x80029433, + SCE_NP_COMMERCE_ERROR_CHECKOUT_MAINTENANCE = 0x80029434, + SCE_NP_COMMERCE_ERROR_CHECKOUT_ACCOUNT_SUSPENDED = 0x80029435, + SCE_NP_COMMERCE_ERROR_CHECKOUT_OVER_SPENDING_LIMIT = 0x80029436, + SCE_NP_COMMERCE_ERROR_CHECKOUT_NOT_ENOUGH_MONEY = 0x80029437, + SCE_NP_COMMERCE_ERROR_CHECKOUT_UNKNOWN = 0x80029438, - SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_UNKNOWN = 0x80029600, + SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_UNKNOWN = 0x80029600, SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_INVALID_CREDENTIALS = 0x80029601, SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_INVALID_CATEGORY_ID = 0x80029602, - SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_SERVICE_END = 0x80029603, - SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_SERVICE_STOP = 0x80029604, - SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_SERVICE_BUSY = 0x80029605, + SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_SERVICE_END = 0x80029603, + SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_SERVICE_STOP = 0x80029604, + SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_SERVICE_BUSY = 0x80029605, SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_UNSUPPORTED_VERSION = 0x80029606, - SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_INTERNAL_SERVER = 0x80029680, + SCE_NP_COMMERCE_BROWSE_SERVER_ERROR_INTERNAL_SERVER = 0x80029680, - SCE_NP_COMMERCE_GDF_SERVER_ERROR_UNKNOWN = 0x80029d00, - SCE_NP_COMMERCE_GDF_SERVER_ERROR_INVALID_CREDENTIALS = 0x80029d01, - SCE_NP_COMMERCE_GDF_SERVER_ERROR_INVALID_FLAGLIST = 0x80029d02, - SCE_NP_COMMERCE_GDF_SERVER_ERROR_SERVICE_END = 0x80029d03, - SCE_NP_COMMERCE_GDF_SERVER_ERROR_SERVICE_STOP = 0x80029d04, - SCE_NP_COMMERCE_GDF_SERVER_ERROR_SERVICE_BUSY = 0x80029d05, - SCE_NP_COMMERCE_GDF_SERVER_ERROR_UNSUPPORTED_VERSION = 0x80029d06, + SCE_NP_COMMERCE_GDF_SERVER_ERROR_UNKNOWN = 0x80029d00, + SCE_NP_COMMERCE_GDF_SERVER_ERROR_INVALID_CREDENTIALS = 0x80029d01, + SCE_NP_COMMERCE_GDF_SERVER_ERROR_INVALID_FLAGLIST = 0x80029d02, + SCE_NP_COMMERCE_GDF_SERVER_ERROR_SERVICE_END = 0x80029d03, + SCE_NP_COMMERCE_GDF_SERVER_ERROR_SERVICE_STOP = 0x80029d04, + SCE_NP_COMMERCE_GDF_SERVER_ERROR_SERVICE_BUSY = 0x80029d05, + SCE_NP_COMMERCE_GDF_SERVER_ERROR_UNSUPPORTED_VERSION = 0x80029d06, - SCE_NP_COMMERCE_SDF_SERVER_ERROR_UNKNOWN = 0x80029e00, - SCE_NP_COMMERCE_SDF_SERVER_ERROR_INVALID_CREDENTIALS = 0x80029e01, - SCE_NP_COMMERCE_SDF_SERVER_ERROR_INVALID_FLAGLIST = 0x80029e02, - SCE_NP_COMMERCE_SDF_SERVER_ERROR_SERVICE_END = 0x80029e03, - SCE_NP_COMMERCE_SDF_SERVER_ERROR_SERVICE_STOP = 0x80029e04, - SCE_NP_COMMERCE_SDF_SERVER_ERROR_SERVICE_BUSY = 0x80029e05, - SCE_NP_COMMERCE_SDF_SERVER_ERROR_UNSUPPORTED_VERSION = 0x80029e06, + SCE_NP_COMMERCE_SDF_SERVER_ERROR_UNKNOWN = 0x80029e00, + SCE_NP_COMMERCE_SDF_SERVER_ERROR_INVALID_CREDENTIALS = 0x80029e01, + SCE_NP_COMMERCE_SDF_SERVER_ERROR_INVALID_FLAGLIST = 0x80029e02, + SCE_NP_COMMERCE_SDF_SERVER_ERROR_SERVICE_END = 0x80029e03, + SCE_NP_COMMERCE_SDF_SERVER_ERROR_SERVICE_STOP = 0x80029e04, + SCE_NP_COMMERCE_SDF_SERVER_ERROR_SERVICE_BUSY = 0x80029e05, + SCE_NP_COMMERCE_SDF_SERVER_ERROR_UNSUPPORTED_VERSION = 0x80029e06, // DRM - SCE_NP_DRM_ERROR_OUT_OF_MEMORY = 0x80029501, - SCE_NP_DRM_ERROR_INVALID_PARAM = 0x80029502, - SCE_NP_DRM_ERROR_SERVER_RESPONSE = 0x80029509, - SCE_NP_DRM_ERROR_NO_ENTITLEMENT = 0x80029513, - SCE_NP_DRM_ERROR_BAD_ACT = 0x80029514, - SCE_NP_DRM_ERROR_BAD_FORMAT = 0x80029515, - SCE_NP_DRM_ERROR_NO_LOGIN = 0x80029516, - SCE_NP_DRM_ERROR_INTERNAL = 0x80029517, - SCE_NP_DRM_ERROR_BAD_PERM = 0x80029519, - SCE_NP_DRM_ERROR_UNKNOWN_VERSION = 0x8002951a, - SCE_NP_DRM_ERROR_TIME_LIMIT = 0x8002951b, + SCE_NP_DRM_ERROR_OUT_OF_MEMORY = 0x80029501, + SCE_NP_DRM_ERROR_INVALID_PARAM = 0x80029502, + SCE_NP_DRM_ERROR_SERVER_RESPONSE = 0x80029509, + SCE_NP_DRM_ERROR_NO_ENTITLEMENT = 0x80029513, + SCE_NP_DRM_ERROR_BAD_ACT = 0x80029514, + SCE_NP_DRM_ERROR_BAD_FORMAT = 0x80029515, + SCE_NP_DRM_ERROR_NO_LOGIN = 0x80029516, + SCE_NP_DRM_ERROR_INTERNAL = 0x80029517, + SCE_NP_DRM_ERROR_BAD_PERM = 0x80029519, + SCE_NP_DRM_ERROR_UNKNOWN_VERSION = 0x8002951a, + SCE_NP_DRM_ERROR_TIME_LIMIT = 0x8002951b, SCE_NP_DRM_ERROR_DIFFERENT_ACCOUNT_ID = 0x8002951c, - SCE_NP_DRM_ERROR_DIFFERENT_DRM_TYPE = 0x8002951d, - SCE_NP_DRM_ERROR_SERVICE_NOT_STARTED = 0x8002951e, - SCE_NP_DRM_ERROR_BUSY = 0x80029520, - SCE_NP_DRM_ERROR_LICENSE_NOT_FOUND = 0x80029521, - SCE_NP_DRM_ERROR_IO = 0x80029525, - SCE_NP_DRM_ERROR_FORMAT = 0x80029530, - SCE_NP_DRM_ERROR_FILENAME = 0x80029533, - SCE_NP_DRM_ERROR_K_LICENSEE = 0x80029534, + SCE_NP_DRM_ERROR_DIFFERENT_DRM_TYPE = 0x8002951d, + SCE_NP_DRM_ERROR_SERVICE_NOT_STARTED = 0x8002951e, + SCE_NP_DRM_ERROR_BUSY = 0x80029520, + SCE_NP_DRM_ERROR_LICENSE_NOT_FOUND = 0x80029521, + SCE_NP_DRM_ERROR_IO = 0x80029525, + SCE_NP_DRM_ERROR_FORMAT = 0x80029530, + SCE_NP_DRM_ERROR_FILENAME = 0x80029533, + SCE_NP_DRM_ERROR_K_LICENSEE = 0x80029534, // DRM Server - SCE_NP_DRM_SERVER_ERROR_SERVICE_IS_END = 0x80029700, - SCE_NP_DRM_SERVER_ERROR_SERVICE_STOP_TEMPORARILY = 0x80029701, - SCE_NP_DRM_SERVER_ERROR_SERVICE_IS_BUSY = 0x80029702, - SCE_NP_DRM_SERVER_ERROR_INVALID_USER_CREDENTIAL = 0x80029721, - SCE_NP_DRM_SERVER_ERROR_INVALID_PRODUCT_ID = 0x80029722, - SCE_NP_DRM_SERVER_ERROR_ACCOUNT_IS_CLOSED = 0x80029730, - SCE_NP_DRM_SERVER_ERROR_ACCOUNT_IS_SUSPENDED = 0x80029731, - SCE_NP_DRM_SERVER_ERROR_ACTIVATED_CONSOLE_IS_FULL = 0x80029750, - SCE_NP_DRM_SERVER_ERROR_CONSOLE_NOT_ACTIVATED = 0x80029751, + SCE_NP_DRM_SERVER_ERROR_SERVICE_IS_END = 0x80029700, + SCE_NP_DRM_SERVER_ERROR_SERVICE_STOP_TEMPORARILY = 0x80029701, + SCE_NP_DRM_SERVER_ERROR_SERVICE_IS_BUSY = 0x80029702, + SCE_NP_DRM_SERVER_ERROR_INVALID_USER_CREDENTIAL = 0x80029721, + SCE_NP_DRM_SERVER_ERROR_INVALID_PRODUCT_ID = 0x80029722, + SCE_NP_DRM_SERVER_ERROR_ACCOUNT_IS_CLOSED = 0x80029730, + SCE_NP_DRM_SERVER_ERROR_ACCOUNT_IS_SUSPENDED = 0x80029731, + SCE_NP_DRM_SERVER_ERROR_ACTIVATED_CONSOLE_IS_FULL = 0x80029750, + SCE_NP_DRM_SERVER_ERROR_CONSOLE_NOT_ACTIVATED = 0x80029751, SCE_NP_DRM_SERVER_ERROR_PRIMARY_CONSOLE_CANNOT_CHANGED = 0x80029752, - SCE_NP_DRM_SERVER_ERROR_UNKNOWN = 0x80029780, + SCE_NP_DRM_SERVER_ERROR_UNKNOWN = 0x80029780, // DRM Install - SCE_NP_DRM_INSTALL_ERROR_FORMAT = 0x80029563, - SCE_NP_DRM_INSTALL_ERROR_CHECK = 0x80029564, + SCE_NP_DRM_INSTALL_ERROR_FORMAT = 0x80029563, + SCE_NP_DRM_INSTALL_ERROR_CHECK = 0x80029564, SCE_NP_DRM_INSTALL_ERROR_UNSUPPORTED = 0x80029566, // Game purchase processing GAME_ERR_NOT_XMBBUY_CONTENT = 0x80028F81, // Auth - SCE_NP_AUTH_EINVAL = 0x8002a002, - SCE_NP_AUTH_ENOMEM = 0x8002a004, - SCE_NP_AUTH_ESRCH = 0x8002a005, - SCE_NP_AUTH_EBUSY = 0x8002a00a, - SCE_NP_AUTH_EABORT = 0x8002a00c, - SCE_NP_AUTH_EEXIST = 0x8002a014, + SCE_NP_AUTH_EINVAL = 0x8002a002, + SCE_NP_AUTH_ENOMEM = 0x8002a004, + SCE_NP_AUTH_ESRCH = 0x8002a005, + SCE_NP_AUTH_EBUSY = 0x8002a00a, + SCE_NP_AUTH_EABORT = 0x8002a00c, + SCE_NP_AUTH_EEXIST = 0x8002a014, SCE_NP_AUTH_EINVALID_ARGUMENT = 0x8002a015, // Auth extended - SCE_NP_AUTH_ERROR_SERVICE_END = 0x8002a200, - SCE_NP_AUTH_ERROR_SERVICE_DOWN = 0x8002a201, - SCE_NP_AUTH_ERROR_SERVICE_BUSY = 0x8002a202, - SCE_NP_AUTH_ERROR_SERVER_MAINTENANCE = 0x8002a203, - SCE_NP_AUTH_ERROR_INVALID_DATA_LENGTH = 0x8002a210, - SCE_NP_AUTH_ERROR_INVALID_USER_AGENT = 0x8002a211, - SCE_NP_AUTH_ERROR_INVALID_VERSION = 0x8002a212, - SCE_NP_AUTH_ERROR_INVALID_SERVICE_ID = 0x8002a220, - SCE_NP_AUTH_ERROR_INVALID_CREDENTIAL = 0x8002a221, - SCE_NP_AUTH_ERROR_INVALID_ENTITLEMENT_ID = 0x8002a222, - SCE_NP_AUTH_ERROR_INVALID_CONSUMED_COUNT = 0x8002a223, - SCE_NP_AUTH_ERROR_INVALID_CONSOLE_ID = 0x8002a224, - SCE_NP_AUTH_ERROR_CONSOLE_ID_SUSPENDED = 0x8002a227, - SCE_NP_AUTH_ERROR_ACCOUNT_CLOSED = 0x8002a230, - SCE_NP_AUTH_ERROR_ACCOUNT_SUSPENDED = 0x8002a231, - SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_EULA = 0x8002a232, - SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT1 = 0x8002a240, - SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT2 = 0x8002a241, - SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT3 = 0x8002a242, - SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT4 = 0x8002a243, - SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT5 = 0x8002a244, - SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT6 = 0x8002a245, - SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT7 = 0x8002a246, - SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT8 = 0x8002a247, - SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT9 = 0x8002a248, + SCE_NP_AUTH_ERROR_SERVICE_END = 0x8002a200, + SCE_NP_AUTH_ERROR_SERVICE_DOWN = 0x8002a201, + SCE_NP_AUTH_ERROR_SERVICE_BUSY = 0x8002a202, + SCE_NP_AUTH_ERROR_SERVER_MAINTENANCE = 0x8002a203, + SCE_NP_AUTH_ERROR_INVALID_DATA_LENGTH = 0x8002a210, + SCE_NP_AUTH_ERROR_INVALID_USER_AGENT = 0x8002a211, + SCE_NP_AUTH_ERROR_INVALID_VERSION = 0x8002a212, + SCE_NP_AUTH_ERROR_INVALID_SERVICE_ID = 0x8002a220, + SCE_NP_AUTH_ERROR_INVALID_CREDENTIAL = 0x8002a221, + SCE_NP_AUTH_ERROR_INVALID_ENTITLEMENT_ID = 0x8002a222, + SCE_NP_AUTH_ERROR_INVALID_CONSUMED_COUNT = 0x8002a223, + SCE_NP_AUTH_ERROR_INVALID_CONSOLE_ID = 0x8002a224, + SCE_NP_AUTH_ERROR_CONSOLE_ID_SUSPENDED = 0x8002a227, + SCE_NP_AUTH_ERROR_ACCOUNT_CLOSED = 0x8002a230, + SCE_NP_AUTH_ERROR_ACCOUNT_SUSPENDED = 0x8002a231, + SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_EULA = 0x8002a232, + SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT1 = 0x8002a240, + SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT2 = 0x8002a241, + SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT3 = 0x8002a242, + SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT4 = 0x8002a243, + SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT5 = 0x8002a244, + SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT6 = 0x8002a245, + SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT7 = 0x8002a246, + SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT8 = 0x8002a247, + SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT9 = 0x8002a248, SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT10 = 0x8002a249, SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT11 = 0x8002a24a, SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT12 = 0x8002a24b, @@ -408,219 +408,219 @@ enum SceNpError : u32 SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT14 = 0x8002a24d, SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT15 = 0x8002a24e, SCE_NP_AUTH_ERROR_ACCOUNT_RENEW_ACCOUNT16 = 0x8002a24f, - SCE_NP_AUTH_ERROR_UNKNOWN = 0x8002a280, + SCE_NP_AUTH_ERROR_UNKNOWN = 0x8002a280, // Core Utility - SCE_NP_CORE_UTIL_ERROR_INVALID_ARGUMENT = 0x8002a501, - SCE_NP_CORE_UTIL_ERROR_OUT_OF_MEMORY = 0x8002a502, - SCE_NP_CORE_UTIL_ERROR_INSUFFICIENT = 0x8002a503, - SCE_NP_CORE_UTIL_ERROR_PARSER_FAILED = 0x8002a504, + SCE_NP_CORE_UTIL_ERROR_INVALID_ARGUMENT = 0x8002a501, + SCE_NP_CORE_UTIL_ERROR_OUT_OF_MEMORY = 0x8002a502, + SCE_NP_CORE_UTIL_ERROR_INSUFFICIENT = 0x8002a503, + SCE_NP_CORE_UTIL_ERROR_PARSER_FAILED = 0x8002a504, SCE_NP_CORE_UTIL_ERROR_INVALID_PROTOCOL_ID = 0x8002a505, - SCE_NP_CORE_UTIL_ERROR_INVALID_EXTENSION = 0x8002a506, - SCE_NP_CORE_UTIL_ERROR_INVALID_TEXT = 0x8002a507, - SCE_NP_CORE_UTIL_ERROR_UNKNOWN_TYPE = 0x8002a508, - SCE_NP_CORE_UTIL_ERROR_UNKNOWN = 0x8002a509, + SCE_NP_CORE_UTIL_ERROR_INVALID_EXTENSION = 0x8002a506, + SCE_NP_CORE_UTIL_ERROR_INVALID_TEXT = 0x8002a507, + SCE_NP_CORE_UTIL_ERROR_UNKNOWN_TYPE = 0x8002a508, + SCE_NP_CORE_UTIL_ERROR_UNKNOWN = 0x8002a509, // Core Parser - SCE_NP_CORE_PARSER_ERROR_NOT_INITIALIZED = 0x8002a511, + SCE_NP_CORE_PARSER_ERROR_NOT_INITIALIZED = 0x8002a511, SCE_NP_CORE_PARSER_ERROR_ALREADY_INITIALIZED = 0x8002a512, - SCE_NP_CORE_PARSER_ERROR_OUT_OF_MEMORY = 0x8002a513, - SCE_NP_CORE_PARSER_ERROR_INSUFFICIENT = 0x8002a514, - SCE_NP_CORE_PARSER_ERROR_INVALID_FORMAT = 0x8002a515, - SCE_NP_CORE_PARSER_ERROR_INVALID_ARGUMENT = 0x8002a516, - SCE_NP_CORE_PARSER_ERROR_INVALID_HANDLE = 0x8002a517, - SCE_NP_CORE_PARSER_ERROR_INVALID_ICON = 0x8002a518, - SCE_NP_CORE_PARSER_ERROR_UNKNOWN = 0x8002a519, + SCE_NP_CORE_PARSER_ERROR_OUT_OF_MEMORY = 0x8002a513, + SCE_NP_CORE_PARSER_ERROR_INSUFFICIENT = 0x8002a514, + SCE_NP_CORE_PARSER_ERROR_INVALID_FORMAT = 0x8002a515, + SCE_NP_CORE_PARSER_ERROR_INVALID_ARGUMENT = 0x8002a516, + SCE_NP_CORE_PARSER_ERROR_INVALID_HANDLE = 0x8002a517, + SCE_NP_CORE_PARSER_ERROR_INVALID_ICON = 0x8002a518, + SCE_NP_CORE_PARSER_ERROR_UNKNOWN = 0x8002a519, // Core Errors - SCE_NP_CORE_ERROR_ALREADY_INITIALIZED = 0x8002a521, - SCE_NP_CORE_ERROR_NOT_INITIALIZED = 0x8002a522, - SCE_NP_CORE_ERROR_INVALID_ARGUMENT = 0x8002a523, - SCE_NP_CORE_ERROR_OUT_OF_MEMORY = 0x8002a524, - SCE_NP_CORE_ERROR_ID_NOT_AVAILABLE = 0x8002a525, - SCE_NP_CORE_ERROR_USER_OFFLINE = 0x8002a526, - SCE_NP_CORE_ERROR_SESSION_RUNNING = 0x8002a527, - SCE_NP_CORE_ERROR_SESSION_NOT_ESTABLISHED = 0x8002a528, - SCE_NP_CORE_ERROR_SESSION_INVALID_STATE = 0x8002a529, - SCE_NP_CORE_ERROR_SESSION_ID_TOO_LONG = 0x8002a52a, + SCE_NP_CORE_ERROR_ALREADY_INITIALIZED = 0x8002a521, + SCE_NP_CORE_ERROR_NOT_INITIALIZED = 0x8002a522, + SCE_NP_CORE_ERROR_INVALID_ARGUMENT = 0x8002a523, + SCE_NP_CORE_ERROR_OUT_OF_MEMORY = 0x8002a524, + SCE_NP_CORE_ERROR_ID_NOT_AVAILABLE = 0x8002a525, + SCE_NP_CORE_ERROR_USER_OFFLINE = 0x8002a526, + SCE_NP_CORE_ERROR_SESSION_RUNNING = 0x8002a527, + SCE_NP_CORE_ERROR_SESSION_NOT_ESTABLISHED = 0x8002a528, + SCE_NP_CORE_ERROR_SESSION_INVALID_STATE = 0x8002a529, + SCE_NP_CORE_ERROR_SESSION_ID_TOO_LONG = 0x8002a52a, SCE_NP_CORE_ERROR_SESSION_INVALID_NAMESPACE = 0x8002a52b, - SCE_NP_CORE_ERROR_CONNECTION_TIMEOUT = 0x8002a52c, - SCE_NP_CORE_ERROR_GETSOCKOPT = 0x8002a52d, - SCE_NP_CORE_ERROR_SSL_NOT_INITIALIZED = 0x8002a52e, - SCE_NP_CORE_ERROR_SSL_ALREADY_INITIALIZED = 0x8002a52f, - SCE_NP_CORE_ERROR_SSL_NO_CERT = 0x8002a530, - SCE_NP_CORE_ERROR_SSL_NO_TRUSTWORTHY_CA = 0x8002a531, - SCE_NP_CORE_ERROR_SSL_INVALID_CERT = 0x8002a532, - SCE_NP_CORE_ERROR_SSL_CERT_VERIFY = 0x8002a533, - SCE_NP_CORE_ERROR_SSL_CN_CHECK = 0x8002a534, - SCE_NP_CORE_ERROR_SSL_HANDSHAKE_FAILED = 0x8002a535, - SCE_NP_CORE_ERROR_SSL_SEND = 0x8002a536, - SCE_NP_CORE_ERROR_SSL_RECV = 0x8002a537, - SCE_NP_CORE_ERROR_SSL_CREATE_CTX = 0x8002a538, - SCE_NP_CORE_ERROR_PARSE_PEM = 0x8002a539, - SCE_NP_CORE_ERROR_INVALID_INITIATE_STREAM = 0x8002a53a, - SCE_NP_CORE_ERROR_SASL_NOT_SUPPORTED = 0x8002a53b, - SCE_NP_CORE_ERROR_NAMESPACE_ALREADY_EXISTS = 0x8002a53c, - SCE_NP_CORE_ERROR_FROM_ALREADY_EXISTS = 0x8002a53d, - SCE_NP_CORE_ERROR_MODULE_NOT_REGISTERED = 0x8002a53e, - SCE_NP_CORE_ERROR_MODULE_FROM_NOT_FOUND = 0x8002a53f, - SCE_NP_CORE_ERROR_UNKNOWN_NAMESPACE = 0x8002a540, - SCE_NP_CORE_ERROR_INVALID_VERSION = 0x8002a541, - SCE_NP_CORE_ERROR_LOGIN_TIMEOUT = 0x8002a542, - SCE_NP_CORE_ERROR_TOO_MANY_SESSIONS = 0x8002a543, - SCE_NP_CORE_ERROR_SENDLIST_NOT_FOUND = 0x8002a544, - SCE_NP_CORE_ERROR_NO_ID = 0x8002a545, - SCE_NP_CORE_ERROR_LOAD_CERTS = 0x8002a546, - SCE_NP_CORE_ERROR_NET_SELECT = 0x8002a547, - SCE_NP_CORE_ERROR_DISCONNECTED = 0x8002a548, - SCE_NP_CORE_ERROR_TICKET_TOO_SMALL = 0x8002a549, - SCE_NP_CORE_ERROR_INVALID_TICKET = 0x8002a54a, - SCE_NP_CORE_ERROR_INVALID_ONLINEID = 0x8002a54b, - SCE_NP_CORE_ERROR_GETHOSTBYNAME = 0x8002a54c, - SCE_NP_CORE_ERROR_UNDEFINED_STREAM_ERROR = 0x8002a54d, - SCE_NP_CORE_ERROR_INTERNAL = 0x8002a5ff, + SCE_NP_CORE_ERROR_CONNECTION_TIMEOUT = 0x8002a52c, + SCE_NP_CORE_ERROR_GETSOCKOPT = 0x8002a52d, + SCE_NP_CORE_ERROR_SSL_NOT_INITIALIZED = 0x8002a52e, + SCE_NP_CORE_ERROR_SSL_ALREADY_INITIALIZED = 0x8002a52f, + SCE_NP_CORE_ERROR_SSL_NO_CERT = 0x8002a530, + SCE_NP_CORE_ERROR_SSL_NO_TRUSTWORTHY_CA = 0x8002a531, + SCE_NP_CORE_ERROR_SSL_INVALID_CERT = 0x8002a532, + SCE_NP_CORE_ERROR_SSL_CERT_VERIFY = 0x8002a533, + SCE_NP_CORE_ERROR_SSL_CN_CHECK = 0x8002a534, + SCE_NP_CORE_ERROR_SSL_HANDSHAKE_FAILED = 0x8002a535, + SCE_NP_CORE_ERROR_SSL_SEND = 0x8002a536, + SCE_NP_CORE_ERROR_SSL_RECV = 0x8002a537, + SCE_NP_CORE_ERROR_SSL_CREATE_CTX = 0x8002a538, + SCE_NP_CORE_ERROR_PARSE_PEM = 0x8002a539, + SCE_NP_CORE_ERROR_INVALID_INITIATE_STREAM = 0x8002a53a, + SCE_NP_CORE_ERROR_SASL_NOT_SUPPORTED = 0x8002a53b, + SCE_NP_CORE_ERROR_NAMESPACE_ALREADY_EXISTS = 0x8002a53c, + SCE_NP_CORE_ERROR_FROM_ALREADY_EXISTS = 0x8002a53d, + SCE_NP_CORE_ERROR_MODULE_NOT_REGISTERED = 0x8002a53e, + SCE_NP_CORE_ERROR_MODULE_FROM_NOT_FOUND = 0x8002a53f, + SCE_NP_CORE_ERROR_UNKNOWN_NAMESPACE = 0x8002a540, + SCE_NP_CORE_ERROR_INVALID_VERSION = 0x8002a541, + SCE_NP_CORE_ERROR_LOGIN_TIMEOUT = 0x8002a542, + SCE_NP_CORE_ERROR_TOO_MANY_SESSIONS = 0x8002a543, + SCE_NP_CORE_ERROR_SENDLIST_NOT_FOUND = 0x8002a544, + SCE_NP_CORE_ERROR_NO_ID = 0x8002a545, + SCE_NP_CORE_ERROR_LOAD_CERTS = 0x8002a546, + SCE_NP_CORE_ERROR_NET_SELECT = 0x8002a547, + SCE_NP_CORE_ERROR_DISCONNECTED = 0x8002a548, + SCE_NP_CORE_ERROR_TICKET_TOO_SMALL = 0x8002a549, + SCE_NP_CORE_ERROR_INVALID_TICKET = 0x8002a54a, + SCE_NP_CORE_ERROR_INVALID_ONLINEID = 0x8002a54b, + SCE_NP_CORE_ERROR_GETHOSTBYNAME = 0x8002a54c, + SCE_NP_CORE_ERROR_UNDEFINED_STREAM_ERROR = 0x8002a54d, + SCE_NP_CORE_ERROR_INTERNAL = 0x8002a5ff, // Core DNS SCE_NP_CORE_ERROR_DNS_HOST_NOT_FOUND = 0x8002af01, - SCE_NP_CORE_ERROR_DNS_TRY_AGAIN = 0x8002af02, - SCE_NP_CORE_ERROR_DNS_NO_RECOVERY = 0x8002af03, - SCE_NP_CORE_ERROR_DNS_NO_DATA = 0x8002af04, - SCE_NP_CORE_ERROR_DNS_NO_ADDRESS = 0x8002afff, + SCE_NP_CORE_ERROR_DNS_TRY_AGAIN = 0x8002af02, + SCE_NP_CORE_ERROR_DNS_NO_RECOVERY = 0x8002af03, + SCE_NP_CORE_ERROR_DNS_NO_DATA = 0x8002af04, + SCE_NP_CORE_ERROR_DNS_NO_ADDRESS = 0x8002afff, // Core Server - SCE_NP_CORE_SERVER_ERROR_CONFLICT = 0x8002a303, - SCE_NP_CORE_SERVER_ERROR_NOT_AUTHORIZED = 0x8002a30d, - SCE_NP_CORE_SERVER_ERROR_REMOTE_CONNECTION_FAILED = 0x8002a30f, - SCE_NP_CORE_SERVER_ERROR_RESOURCE_CONSTRAINT = 0x8002a310, - SCE_NP_CORE_SERVER_ERROR_SYSTEM_SHUTDOWN = 0x8002a313, + SCE_NP_CORE_SERVER_ERROR_CONFLICT = 0x8002a303, + SCE_NP_CORE_SERVER_ERROR_NOT_AUTHORIZED = 0x8002a30d, + SCE_NP_CORE_SERVER_ERROR_REMOTE_CONNECTION_FAILED = 0x8002a30f, + SCE_NP_CORE_SERVER_ERROR_RESOURCE_CONSTRAINT = 0x8002a310, + SCE_NP_CORE_SERVER_ERROR_SYSTEM_SHUTDOWN = 0x8002a313, SCE_NP_CORE_SERVER_ERROR_UNSUPPORTED_CLIENT_VERSION = 0x8002a319, // Signaling - SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED = 0x8002a801, - SCE_NP_SIGNALING_ERROR_ALREADY_INITIALIZED = 0x8002a802, - SCE_NP_SIGNALING_ERROR_OUT_OF_MEMORY = 0x8002a803, - SCE_NP_SIGNALING_ERROR_CTXID_NOT_AVAILABLE = 0x8002a804, - SCE_NP_SIGNALING_ERROR_CTX_NOT_FOUND = 0x8002a805, - SCE_NP_SIGNALING_ERROR_REQID_NOT_AVAILABLE = 0x8002a806, - SCE_NP_SIGNALING_ERROR_REQ_NOT_FOUND = 0x8002a807, - SCE_NP_SIGNALING_ERROR_PARSER_CREATE_FAILED = 0x8002a808, - SCE_NP_SIGNALING_ERROR_PARSER_FAILED = 0x8002a809, - SCE_NP_SIGNALING_ERROR_INVALID_NAMESPACE = 0x8002a80a, + SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED = 0x8002a801, + SCE_NP_SIGNALING_ERROR_ALREADY_INITIALIZED = 0x8002a802, + SCE_NP_SIGNALING_ERROR_OUT_OF_MEMORY = 0x8002a803, + SCE_NP_SIGNALING_ERROR_CTXID_NOT_AVAILABLE = 0x8002a804, + SCE_NP_SIGNALING_ERROR_CTX_NOT_FOUND = 0x8002a805, + SCE_NP_SIGNALING_ERROR_REQID_NOT_AVAILABLE = 0x8002a806, + SCE_NP_SIGNALING_ERROR_REQ_NOT_FOUND = 0x8002a807, + SCE_NP_SIGNALING_ERROR_PARSER_CREATE_FAILED = 0x8002a808, + SCE_NP_SIGNALING_ERROR_PARSER_FAILED = 0x8002a809, + SCE_NP_SIGNALING_ERROR_INVALID_NAMESPACE = 0x8002a80a, SCE_NP_SIGNALING_ERROR_NETINFO_NOT_AVAILABLE = 0x8002a80b, - SCE_NP_SIGNALING_ERROR_PEER_NOT_RESPONDING = 0x8002a80c, - SCE_NP_SIGNALING_ERROR_CONNID_NOT_AVAILABLE = 0x8002a80d, - SCE_NP_SIGNALING_ERROR_CONN_NOT_FOUND = 0x8002a80e, - SCE_NP_SIGNALING_ERROR_PEER_UNREACHABLE = 0x8002a80f, - SCE_NP_SIGNALING_ERROR_TERMINATED_BY_PEER = 0x8002a810, - SCE_NP_SIGNALING_ERROR_TIMEOUT = 0x8002a811, - SCE_NP_SIGNALING_ERROR_CTX_MAX = 0x8002a812, - SCE_NP_SIGNALING_ERROR_RESULT_NOT_FOUND = 0x8002a813, - SCE_NP_SIGNALING_ERROR_CONN_IN_PROGRESS = 0x8002a814, - SCE_NP_SIGNALING_ERROR_INVALID_ARGUMENT = 0x8002a815, - SCE_NP_SIGNALING_ERROR_OWN_NP_ID = 0x8002a816, - SCE_NP_SIGNALING_ERROR_TOO_MANY_CONN = 0x8002a817, - SCE_NP_SIGNALING_ERROR_TERMINATED_BY_MYSELF = 0x8002a818, + SCE_NP_SIGNALING_ERROR_PEER_NOT_RESPONDING = 0x8002a80c, + SCE_NP_SIGNALING_ERROR_CONNID_NOT_AVAILABLE = 0x8002a80d, + SCE_NP_SIGNALING_ERROR_CONN_NOT_FOUND = 0x8002a80e, + SCE_NP_SIGNALING_ERROR_PEER_UNREACHABLE = 0x8002a80f, + SCE_NP_SIGNALING_ERROR_TERMINATED_BY_PEER = 0x8002a810, + SCE_NP_SIGNALING_ERROR_TIMEOUT = 0x8002a811, + SCE_NP_SIGNALING_ERROR_CTX_MAX = 0x8002a812, + SCE_NP_SIGNALING_ERROR_RESULT_NOT_FOUND = 0x8002a813, + SCE_NP_SIGNALING_ERROR_CONN_IN_PROGRESS = 0x8002a814, + SCE_NP_SIGNALING_ERROR_INVALID_ARGUMENT = 0x8002a815, + SCE_NP_SIGNALING_ERROR_OWN_NP_ID = 0x8002a816, + SCE_NP_SIGNALING_ERROR_TOO_MANY_CONN = 0x8002a817, + SCE_NP_SIGNALING_ERROR_TERMINATED_BY_MYSELF = 0x8002a818, // Custom Menu SCE_NP_CUSTOM_MENU_ERROR_ALREADY_INITIALIZED = 0x80023b01, - SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED = 0x80023b02, - SCE_NP_CUSTOM_MENU_ERROR_OUT_OF_MEMORY = 0x80023b03, - SCE_NP_CUSTOM_MENU_ERROR_NOT_SUPPORTED = 0x80023b04, - SCE_NP_CUSTOM_MENU_ERROR_INSUFFICIENT = 0x80023b05, - SCE_NP_CUSTOM_MENU_ERROR_CANCEL = 0x80023b06, - SCE_NP_CUSTOM_MENU_ERROR_STATUS = 0x80023b07, - SCE_NP_CUSTOM_MENU_ERROR_BUSY = 0x80023b08, - SCE_NP_CUSTOM_MENU_ERROR_INVALID_ARGUMENT = 0x80023b09, - SCE_NP_CUSTOM_MENU_ERROR_ABORT = 0x80023b0a, - SCE_NP_CUSTOM_MENU_ERROR_NOT_REGISTERED = 0x80023b0b, - SCE_NP_CUSTOM_MENU_ERROR_EXCEEDS_MAX = 0x80023b0c, - SCE_NP_CUSTOM_MENU_ERROR_INVALID_CHARACTER = 0x80023b0d, + SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED = 0x80023b02, + SCE_NP_CUSTOM_MENU_ERROR_OUT_OF_MEMORY = 0x80023b03, + SCE_NP_CUSTOM_MENU_ERROR_NOT_SUPPORTED = 0x80023b04, + SCE_NP_CUSTOM_MENU_ERROR_INSUFFICIENT = 0x80023b05, + SCE_NP_CUSTOM_MENU_ERROR_CANCEL = 0x80023b06, + SCE_NP_CUSTOM_MENU_ERROR_STATUS = 0x80023b07, + SCE_NP_CUSTOM_MENU_ERROR_BUSY = 0x80023b08, + SCE_NP_CUSTOM_MENU_ERROR_INVALID_ARGUMENT = 0x80023b09, + SCE_NP_CUSTOM_MENU_ERROR_ABORT = 0x80023b0a, + SCE_NP_CUSTOM_MENU_ERROR_NOT_REGISTERED = 0x80023b0b, + SCE_NP_CUSTOM_MENU_ERROR_EXCEEDS_MAX = 0x80023b0c, + SCE_NP_CUSTOM_MENU_ERROR_INVALID_CHARACTER = 0x80023b0d, // EULA - SCE_NP_EULA_ERROR_UNKNOWN = 0x8002e500, - SCE_NP_EULA_ERROR_INVALID_ARGUMENT = 0x8002e501, - SCE_NP_EULA_ERROR_NOT_INITIALIZED = 0x8002e502, - SCE_NP_EULA_ERROR_ALREADY_INITIALIZED = 0x8002e503, - SCE_NP_EULA_ERROR_OUT_OF_MEMORY = 0x8002e504, - SCE_NP_EULA_ERROR_BUSY = 0x8002e505, - SCE_NP_EULA_ERROR_EULA_NOT_FOUND = 0x8002e5a0, - SCE_NP_EULA_ERROR_NET_OUT_OF_MEMORY = 0x8002e5a1, - SCE_NP_EULA_ERROR_CONF_FORMAT = 0x8002e5b0, - SCE_NP_EULA_ERROR_CONF_INVALID_FILENAME = 0x8002e5b1, - SCE_NP_EULA_ERROR_CONF_TOO_MANY_EULA_FILES = 0x8002e5b2, - SCE_NP_EULA_ERROR_CONF_INVALID_LANGUAGE = 0x8002e5b3, - SCE_NP_EULA_ERROR_CONF_INVALID_COUNTRY = 0x8002e5b4, - SCE_NP_EULA_ERROR_CONF_INVALID_NPCOMMID = 0x8002e5b5, + SCE_NP_EULA_ERROR_UNKNOWN = 0x8002e500, + SCE_NP_EULA_ERROR_INVALID_ARGUMENT = 0x8002e501, + SCE_NP_EULA_ERROR_NOT_INITIALIZED = 0x8002e502, + SCE_NP_EULA_ERROR_ALREADY_INITIALIZED = 0x8002e503, + SCE_NP_EULA_ERROR_OUT_OF_MEMORY = 0x8002e504, + SCE_NP_EULA_ERROR_BUSY = 0x8002e505, + SCE_NP_EULA_ERROR_EULA_NOT_FOUND = 0x8002e5a0, + SCE_NP_EULA_ERROR_NET_OUT_OF_MEMORY = 0x8002e5a1, + SCE_NP_EULA_ERROR_CONF_FORMAT = 0x8002e5b0, + SCE_NP_EULA_ERROR_CONF_INVALID_FILENAME = 0x8002e5b1, + SCE_NP_EULA_ERROR_CONF_TOO_MANY_EULA_FILES = 0x8002e5b2, + SCE_NP_EULA_ERROR_CONF_INVALID_LANGUAGE = 0x8002e5b3, + SCE_NP_EULA_ERROR_CONF_INVALID_COUNTRY = 0x8002e5b4, + SCE_NP_EULA_ERROR_CONF_INVALID_NPCOMMID = 0x8002e5b5, SCE_NP_EULA_ERROR_CONF_INVALID_EULA_VERSION = 0x8002e5b6, // Matching - SCE_NP_MATCHING_ERROR_NOT_INITIALIZED = 0x8002a701, - SCE_NP_MATCHING_ERROR_ALREADY_INITIALIZED = 0x8002a702, - SCE_NP_MATCHING_ERROR_INVALID_ARG = 0x8002a703, - SCE_NP_MATCHING_ERROR_TERMINATED = 0x8002a704, - SCE_NP_MATCHING_ERROR_TIMEOUT = 0x8002a705, - SCE_NP_MATCHING_ERROR_OUT_OF_MEMORY = 0x8002a706, - SCE_NP_MATCHING_ERROR_CTXID_NOT_AVAIL = 0x8002a707, - SCE_NP_MATCHING_ERROR_CTX_ALREADY_EXIST = 0x8002a708, - SCE_NP_MATCHING_ERROR_CTX_NOT_FOUND = 0x8002a709, - SCE_NP_MATCHING_ERROR_LOBBY_NOT_FOUND = 0x8002a70a, - SCE_NP_MATCHING_ERROR_ROOM_NOT_FOUND = 0x8002a70b, - SCE_NP_MATCHING_ERROR_MEMBER_NOT_FOUND = 0x8002a70c, - SCE_NP_MATCHING_ERROR_TOO_BIG_VALUE = 0x8002a70d, - SCE_NP_MATCHING_ERROR_IVALID_ATTR_TYPE = 0x8002a70e, - SCE_NP_MATCHING_ERROR_INVALID_ATTR_ID = 0x8002a70f, - SCE_NP_MATCHING_ERROR_ALREADY_REQUESTED = 0x8002a710, - SCE_NP_MATCHING_ERROR_LIMITTED_SEATING = 0x8002a711, - SCE_NP_MATCHING_ERROR_LOCKED = 0x8002a712, - SCE_NP_MATCHING_ERROR_CTX_STILL_RUNNING = 0x8002a713, - SCE_NP_MATCHING_ERROR_INSUFFICIENT_BUFFER = 0x8002a714, - SCE_NP_MATCHING_ERROR_REQUEST_NOT_ALLOWED = 0x8002a715, - SCE_NP_MATCHING_ERROR_CTX_MAX = 0x8002a716, - SCE_NP_MATCHING_ERROR_INVALID_REQ_ID = 0x8002a717, - SCE_NP_MATCHING_ERROR_RESULT_NOT_FOUND = 0x8002a718, - SCE_NP_MATCHING_ERROR_BUSY = 0x8002a719, - SCE_NP_MATCHING_ERROR_ALREADY_JOINED_ROOM = 0x8002a71a, - SCE_NP_MATCHING_ERROR_ROOM_MAX = 0x8002a71b, - SCE_NP_MATCHING_ERROR_QUICK_MATCH_PLAYER_NOT_FOUND = 0x8002a71c, - SCE_NP_MATCHING_ERROR_COND_MAX = 0x8002a71d, - SCE_NP_MATCHING_ERROR_INVALID_COND = 0x8002a71e, - SCE_NP_MATCHING_ERROR_INVALID_ATTR = 0x8002a71f, - SCE_NP_MATCHING_ERROR_COMP_OP_INEQUALITY_MAX = 0x8002a720, - SCE_NP_MATCHING_ERROR_RESULT_OVERFLOWED = 0x8002a721, - SCE_NP_MATCHING_ERROR_HTTPXML_TIMEOUT = 0x8002a722, - SCE_NP_MATCHING_ERROR_CANCELED = 0x8002a723, - SCE_NP_MATCHING_ERROR_SEARCH_JOIN_ROOM_NOT_FOUND = 0x8002a724, - SCE_NP_MATCHING_ERROR_INVALID_COMP_OP = 0x8002a725, - SCE_NP_MATCHING_ERROR_INVALID_COMP_TYPE = 0x8002a726, - SCE_NP_MATCHING_ERROR_REQUEST_NOT_FOUND = 0x8002a727, - SCE_NP_MATCHING_ERROR_INTERNAL_ERROR = 0x8002a728, - SCE_NP_MATCHING_ERROR_INVALID_PROTOCOL_ID = 0x8002a729, - SCE_NP_MATCHING_ERROR_ATTR_NOT_SPECIFIED = 0x8002a72a, - SCE_NP_MATCHING_ERROR_SYSUTIL_INVALID_RESULT = 0x8002a72b, - SCE_NP_MATCHING_ERROR_PLUGIN_LOAD_FAILURE = 0x8002a72c, - SCE_NP_MATCHING_ERROR_INVALID_ATTR_VALUE = 0x8002a72d, - SCE_NP_MATCHING_ERROR_DUPLICATE = 0x8002a72e, - SCE_NP_MATCHING_ERROR_INVALID_MEMORY_CONTAINER = 0x8002a72f, - SCE_NP_MATCHING_ERROR_SHUTDOWN = 0x8002a730, - SCE_NP_MATCHING_ERROR_SYSUTIL_SERVER_BUSY = 0x8002a731, + SCE_NP_MATCHING_ERROR_NOT_INITIALIZED = 0x8002a701, + SCE_NP_MATCHING_ERROR_ALREADY_INITIALIZED = 0x8002a702, + SCE_NP_MATCHING_ERROR_INVALID_ARG = 0x8002a703, + SCE_NP_MATCHING_ERROR_TERMINATED = 0x8002a704, + SCE_NP_MATCHING_ERROR_TIMEOUT = 0x8002a705, + SCE_NP_MATCHING_ERROR_OUT_OF_MEMORY = 0x8002a706, + SCE_NP_MATCHING_ERROR_CTXID_NOT_AVAIL = 0x8002a707, + SCE_NP_MATCHING_ERROR_CTX_ALREADY_EXIST = 0x8002a708, + SCE_NP_MATCHING_ERROR_CTX_NOT_FOUND = 0x8002a709, + SCE_NP_MATCHING_ERROR_LOBBY_NOT_FOUND = 0x8002a70a, + SCE_NP_MATCHING_ERROR_ROOM_NOT_FOUND = 0x8002a70b, + SCE_NP_MATCHING_ERROR_MEMBER_NOT_FOUND = 0x8002a70c, + SCE_NP_MATCHING_ERROR_TOO_BIG_VALUE = 0x8002a70d, + SCE_NP_MATCHING_ERROR_IVALID_ATTR_TYPE = 0x8002a70e, + SCE_NP_MATCHING_ERROR_INVALID_ATTR_ID = 0x8002a70f, + SCE_NP_MATCHING_ERROR_ALREADY_REQUESTED = 0x8002a710, + SCE_NP_MATCHING_ERROR_LIMITTED_SEATING = 0x8002a711, + SCE_NP_MATCHING_ERROR_LOCKED = 0x8002a712, + SCE_NP_MATCHING_ERROR_CTX_STILL_RUNNING = 0x8002a713, + SCE_NP_MATCHING_ERROR_INSUFFICIENT_BUFFER = 0x8002a714, + SCE_NP_MATCHING_ERROR_REQUEST_NOT_ALLOWED = 0x8002a715, + SCE_NP_MATCHING_ERROR_CTX_MAX = 0x8002a716, + SCE_NP_MATCHING_ERROR_INVALID_REQ_ID = 0x8002a717, + SCE_NP_MATCHING_ERROR_RESULT_NOT_FOUND = 0x8002a718, + SCE_NP_MATCHING_ERROR_BUSY = 0x8002a719, + SCE_NP_MATCHING_ERROR_ALREADY_JOINED_ROOM = 0x8002a71a, + SCE_NP_MATCHING_ERROR_ROOM_MAX = 0x8002a71b, + SCE_NP_MATCHING_ERROR_QUICK_MATCH_PLAYER_NOT_FOUND = 0x8002a71c, + SCE_NP_MATCHING_ERROR_COND_MAX = 0x8002a71d, + SCE_NP_MATCHING_ERROR_INVALID_COND = 0x8002a71e, + SCE_NP_MATCHING_ERROR_INVALID_ATTR = 0x8002a71f, + SCE_NP_MATCHING_ERROR_COMP_OP_INEQUALITY_MAX = 0x8002a720, + SCE_NP_MATCHING_ERROR_RESULT_OVERFLOWED = 0x8002a721, + SCE_NP_MATCHING_ERROR_HTTPXML_TIMEOUT = 0x8002a722, + SCE_NP_MATCHING_ERROR_CANCELED = 0x8002a723, + SCE_NP_MATCHING_ERROR_SEARCH_JOIN_ROOM_NOT_FOUND = 0x8002a724, + SCE_NP_MATCHING_ERROR_INVALID_COMP_OP = 0x8002a725, + SCE_NP_MATCHING_ERROR_INVALID_COMP_TYPE = 0x8002a726, + SCE_NP_MATCHING_ERROR_REQUEST_NOT_FOUND = 0x8002a727, + SCE_NP_MATCHING_ERROR_INTERNAL_ERROR = 0x8002a728, + SCE_NP_MATCHING_ERROR_INVALID_PROTOCOL_ID = 0x8002a729, + SCE_NP_MATCHING_ERROR_ATTR_NOT_SPECIFIED = 0x8002a72a, + SCE_NP_MATCHING_ERROR_SYSUTIL_INVALID_RESULT = 0x8002a72b, + SCE_NP_MATCHING_ERROR_PLUGIN_LOAD_FAILURE = 0x8002a72c, + SCE_NP_MATCHING_ERROR_INVALID_ATTR_VALUE = 0x8002a72d, + SCE_NP_MATCHING_ERROR_DUPLICATE = 0x8002a72e, + SCE_NP_MATCHING_ERROR_INVALID_MEMORY_CONTAINER = 0x8002a72f, + SCE_NP_MATCHING_ERROR_SHUTDOWN = 0x8002a730, + SCE_NP_MATCHING_ERROR_SYSUTIL_SERVER_BUSY = 0x8002a731, SCE_NP_MATCHING_ERROR_SEND_INVITATION_PARTIALLY_FAILED = 0x8002a732, - SCE_NP_MATCHING_ERROR_UTILITY_UNAVAILABLE = 0x8002a733, + SCE_NP_MATCHING_ERROR_UTILITY_UNAVAILABLE = 0x8002a733, - SCE_NP_MATCHING_SERVER_ERROR_OUT_OF_SERVICE = 0x8002a740, - SCE_NP_MATCHING_SERVER_ERROR_MAINTENANCE = 0x8002a741, - SCE_NP_MATCHING_SERVER_ERROR_SERVER_BUSY = 0x8002a742, - SCE_NP_MATCHING_SERVER_ERROR_ACCESS_FORBIDDEN = 0x8002a743, - SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_SERVER = 0x8002a744, - SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_LOBBY = 0x8002a745, - SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_ROOM = 0x8002a746, - SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_USER = 0x8002a747, - SCE_NP_MATCHING_SERVER_ERROR_NOT_ALLOWED = 0x8002a748, - SCE_NP_MATCHING_SERVER_ERROR_UNKNOWN = 0x8002a749, - SCE_NP_MATCHING_SERVER_ERROR_BAD_REQUEST_STANZA = 0x8002a74a, - SCE_NP_MATCHING_SERVER_ERROR_REQUEST_FORBIDDEN = 0x8002a74b, - SCE_NP_MATCHING_SERVER_ERROR_INTERNAL_ERROR = 0x8002a74c, - SCE_NP_MATCHING_SERVER_ERROR_ROOM_OVER = 0x8002a74d, - SCE_NP_MATCHING_SERVER_ERROR_ROOM_CLOSED = 0x8002a74e, + SCE_NP_MATCHING_SERVER_ERROR_OUT_OF_SERVICE = 0x8002a740, + SCE_NP_MATCHING_SERVER_ERROR_MAINTENANCE = 0x8002a741, + SCE_NP_MATCHING_SERVER_ERROR_SERVER_BUSY = 0x8002a742, + SCE_NP_MATCHING_SERVER_ERROR_ACCESS_FORBIDDEN = 0x8002a743, + SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_SERVER = 0x8002a744, + SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_LOBBY = 0x8002a745, + SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_ROOM = 0x8002a746, + SCE_NP_MATCHING_SERVER_ERROR_NO_SUCH_USER = 0x8002a747, + SCE_NP_MATCHING_SERVER_ERROR_NOT_ALLOWED = 0x8002a748, + SCE_NP_MATCHING_SERVER_ERROR_UNKNOWN = 0x8002a749, + SCE_NP_MATCHING_SERVER_ERROR_BAD_REQUEST_STANZA = 0x8002a74a, + SCE_NP_MATCHING_SERVER_ERROR_REQUEST_FORBIDDEN = 0x8002a74b, + SCE_NP_MATCHING_SERVER_ERROR_INTERNAL_ERROR = 0x8002a74c, + SCE_NP_MATCHING_SERVER_ERROR_ROOM_OVER = 0x8002a74d, + SCE_NP_MATCHING_SERVER_ERROR_ROOM_CLOSED = 0x8002a74e, }; enum @@ -681,13 +681,13 @@ enum enum { - SCE_NP_MATCHING_ATTR_ID_MIN = 1, - SCE_NP_MATCHING_ATTR_ID_MAX = 16, - SCE_NP_MATCHING_ATTR_ID_FOR_SEARCH_CONDITION_MAX = 8, + SCE_NP_MATCHING_ATTR_ID_MIN = 1, + SCE_NP_MATCHING_ATTR_ID_MAX = 16, + SCE_NP_MATCHING_ATTR_ID_FOR_SEARCH_CONDITION_MAX = 8, SCE_NP_MATCHING_ATTR_ID_FOR_GRLGLIMIT_SRCH_COND_MAX = 8, - SCE_NP_MATCHING_ATTR_BIN_BIG_SIZE_ID_MAX = 2, - SCE_NP_MATCHING_ATTR_BIN_MAX_SIZE_SMALL = 64, - SCE_NP_MATCHING_ATTR_BIN_MAX_SIZE_BIG = 256, + SCE_NP_MATCHING_ATTR_BIN_BIG_SIZE_ID_MAX = 2, + SCE_NP_MATCHING_ATTR_BIN_MAX_SIZE_SMALL = 64, + SCE_NP_MATCHING_ATTR_BIN_MAX_SIZE_BIG = 256, }; enum @@ -722,8 +722,8 @@ enum enum { - SCE_NP_MATCHING_COND_MAX = 9, - SCE_NP_MATCHING_GRLG_LIMIT_COND_MAX = 9, + SCE_NP_MATCHING_COND_MAX = 9, + SCE_NP_MATCHING_GRLG_LIMIT_COND_MAX = 9, SCE_NP_MATCHING_COMP_OP_INEQUALITY_MAX = 9, }; @@ -757,37 +757,37 @@ enum enum { - SCE_NP_MATCHING_SEND_INVITATION_MEMSIZE = 16 * 1024 * 1024, + SCE_NP_MATCHING_SEND_INVITATION_MEMSIZE = 16 * 1024 * 1024, SCE_NP_MATCHING_ACCEPT_INVITATION_MEMSIZE = 16 * 1024 * 1024, }; // Basic presence options enum { - SCE_NP_BASIC_PRESENCE_OPTIONS_SET_DATA = 0x00000001, - SCE_NP_BASIC_PRESENCE_OPTIONS_SET_STATUS = 0x00000002, + SCE_NP_BASIC_PRESENCE_OPTIONS_SET_DATA = 0x00000001, + SCE_NP_BASIC_PRESENCE_OPTIONS_SET_STATUS = 0x00000002, SCE_NP_BASIC_PRESENCE_OPTIONS_ALL_OPTIONS = 0x00000003, // sum of all other options }; // Basic presence states enum { - SCE_NP_BASIC_PRESENCE_STATE_OFFLINE = 0, + SCE_NP_BASIC_PRESENCE_STATE_OFFLINE = 0, SCE_NP_BASIC_PRESENCE_STATE_OUT_OF_CONTEXT = 1, - SCE_NP_BASIC_PRESENCE_STATE_IN_CONTEXT = 2 + SCE_NP_BASIC_PRESENCE_STATE_IN_CONTEXT = 2 }; // Basic player options enum { SCE_NP_BASIC_PLAYERS_HISTORY_OPTIONS_BY_NP_COMM_ID = 0, - SCE_NP_BASIC_PLAYERS_HISTORY_OPTIONS_ALL = 1 + SCE_NP_BASIC_PLAYERS_HISTORY_OPTIONS_ALL = 1 }; // Custom menu selection types enum : SceNpCustomMenuSelectedType { - SCE_NP_CUSTOM_MENU_SELECTED_TYPE_ME = 1, + SCE_NP_CUSTOM_MENU_SELECTED_TYPE_ME = 1, SCE_NP_CUSTOM_MENU_SELECTED_TYPE_FRIEND = 2, SCE_NP_CUSTOM_MENU_SELECTED_TYPE_PLAYER = 3, }; @@ -795,32 +795,32 @@ enum : SceNpCustomMenuSelectedType // Custom menu action masks enum SceNpCustomMenuActionMask : u32 { - SCE_NP_CUSTOM_MENU_ACTION_MASK_ME = 0x00000001, + SCE_NP_CUSTOM_MENU_ACTION_MASK_ME = 0x00000001, SCE_NP_CUSTOM_MENU_ACTION_MASK_FRIEND = 0x00000002, SCE_NP_CUSTOM_MENU_ACTION_MASK_PLAYER = 0x00000004, - SCE_NP_CUSTOM_MENU_ACTION_MASK_ALL = 0x00000007 // sum of all other masks + SCE_NP_CUSTOM_MENU_ACTION_MASK_ALL = 0x00000007 // sum of all other masks }; // Custom menu index mask enum { - SCE_NP_CUSTOM_MENU_INDEX_BITS = (sizeof(SceNpCustomMenuIndexMask) * 8), - SCE_NP_CUSTOM_MENU_INDEX_BITS_ALL = (static_cast(-1)), + SCE_NP_CUSTOM_MENU_INDEX_BITS = (sizeof(SceNpCustomMenuIndexMask) * 8), + SCE_NP_CUSTOM_MENU_INDEX_BITS_ALL = (static_cast(-1)), SCE_NP_CUSTOM_MENU_INDEX_BITS_SHIFT = 5, - SCE_NP_CUSTOM_MENU_INDEX_BITS_MASK = (SCE_NP_CUSTOM_MENU_INDEX_BITS - 1), - SCE_NP_CUSTOM_MENU_INDEX_BITS_MAX = 127, - SCE_NP_CUSTOM_MENU_INDEX_SETSIZE = 128, + SCE_NP_CUSTOM_MENU_INDEX_BITS_MASK = (SCE_NP_CUSTOM_MENU_INDEX_BITS - 1), + SCE_NP_CUSTOM_MENU_INDEX_BITS_MAX = 127, + SCE_NP_CUSTOM_MENU_INDEX_SETSIZE = 128, }; #define SCE_NP_CUSTOM_MENU_INDEX_SET(n, p) ((p)->index_bits[(n) >> SCE_NP_CUSTOM_MENU_INDEX_BITS_SHIFT] |= (1 << ((n) & SCE_NP_CUSTOM_MENU_INDEX_BITS_MASK))) #define SCE_NP_CUSTOM_MENU_INDEX_CLR(n, p) ((p)->index_bits[(n) >> SCE_NP_CUSTOM_MENU_INDEX_BITS_SHIFT] &= ~(1 << ((n) & SCE_NP_CUSTOM_MENU_INDEX_BITS_MASK))) #define SCE_NP_CUSTOM_MENU_INDEX_ISSET(n, p) ((p)->index_bits[(n) >> SCE_NP_CUSTOM_MENU_INDEX_BITS_SHIFT] & (1 << ((n) & SCE_NP_CUSTOM_MENU_INDEX_BITS_MASK))) -#define SCE_NP_CUSTOM_MENU_INDEX_ZERO(p) ( for (u32 i = 0; i < (SCE_NP_CUSTOM_MENU_INDEX_SETSIZE >> SCE_NP_CUSTOM_MENU_INDEX_BITS_SHIFT); i++) p->index_bits[i] = 0; ) -#define SCE_NP_CUSTOM_MENU_INDEX_SET_ALL(p) ( for (u32 i = 0; i < (SCE_NP_CUSTOM_MENU_INDEX_SETSIZE >> SCE_NP_CUSTOM_MENU_INDEX_BITS_SHIFT); i++) p->index_bits[i] = SCE_NP_CUSTOM_MENU_INDEX_BITS_ALL; ) +#define SCE_NP_CUSTOM_MENU_INDEX_ZERO(p) (for (u32 i = 0; i < (SCE_NP_CUSTOM_MENU_INDEX_SETSIZE >> SCE_NP_CUSTOM_MENU_INDEX_BITS_SHIFT); i++) p->index_bits[i] = 0;) +#define SCE_NP_CUSTOM_MENU_INDEX_SET_ALL(p) (for (u32 i = 0; i < (SCE_NP_CUSTOM_MENU_INDEX_SETSIZE >> SCE_NP_CUSTOM_MENU_INDEX_BITS_SHIFT); i++) p->index_bits[i] = SCE_NP_CUSTOM_MENU_INDEX_BITS_ALL;) enum { - SCE_NP_PORT = 3658, + SCE_NP_PORT = 3658, SCE_NP_MIN_POOL_SIZE = 128 * 1024 }; @@ -832,7 +832,7 @@ enum enum : u64 { SCE_NP_DRM_EXITSPAWN2_EXIT_WO_FINI = 0x4000000000000000ULL, - SCE_NP_DRM_TIME_INFO_ENDLESS = 0x7FFFFFFFFFFFFFFFULL + SCE_NP_DRM_TIME_INFO_ENDLESS = 0x7FFFFFFFFFFFFFFFULL }; enum @@ -842,18 +842,18 @@ enum enum { - SCE_NP_MANAGER_SUB_SIGNIN_RESULT_OK = 0, + SCE_NP_MANAGER_SUB_SIGNIN_RESULT_OK = 0, SCE_NP_MANAGER_SUB_SIGNIN_RESULT_CANCEL = 1, }; // NP Manager Utility statuses enum { - SCE_NP_MANAGER_STATUS_OFFLINE = -1, - SCE_NP_MANAGER_STATUS_GETTING_TICKET = 0, + SCE_NP_MANAGER_STATUS_OFFLINE = -1, + SCE_NP_MANAGER_STATUS_GETTING_TICKET = 0, SCE_NP_MANAGER_STATUS_GETTING_PROFILE = 1, - SCE_NP_MANAGER_STATUS_LOGGING_IN = 2, - SCE_NP_MANAGER_STATUS_ONLINE = 3, + SCE_NP_MANAGER_STATUS_LOGGING_IN = 2, + SCE_NP_MANAGER_STATUS_ONLINE = 3, }; enum @@ -864,32 +864,32 @@ enum // Event types enum { - SCE_NP_BASIC_EVENT_UNKNOWN = -1, - SCE_NP_BASIC_EVENT_OFFLINE = 0, - SCE_NP_BASIC_EVENT_PRESENCE = 1, - SCE_NP_BASIC_EVENT_MESSAGE = 2, - SCE_NP_BASIC_EVENT_ADD_FRIEND_RESULT = 3, - SCE_NP_BASIC_EVENT_INCOMING_ATTACHMENT = 4, - SCE_NP_BASIC_EVENT_INCOMING_INVITATION = 5, - SCE_NP_BASIC_EVENT_END_OF_INITIAL_PRESENCE = 6, - SCE_NP_BASIC_EVENT_SEND_ATTACHMENT_RESULT = 7, - SCE_NP_BASIC_EVENT_RECV_ATTACHMENT_RESULT = 8, - SCE_NP_BASIC_EVENT_OUT_OF_CONTEXT = 9, - SCE_NP_BASIC_EVENT_FRIEND_REMOVED = 10, - SCE_NP_BASIC_EVENT_ADD_BLOCKLIST_RESULT = 11, - SCE_NP_BASIC_EVENT_SEND_MESSAGE_RESULT = 12, - SCE_NP_BASIC_EVENT_SEND_INVITATION_RESULT = 13, - SCE_NP_BASIC_EVENT_RECV_INVITATION_RESULT = 14, - SCE_NP_BASIC_EVENT_MESSAGE_MARKED_AS_USED_RESULT = 15, - SCE_NP_BASIC_EVENT_INCOMING_CUSTOM_INVITATION = 16, - SCE_NP_BASIC_EVENT_INCOMING_CLAN_MESSAGE = 17, - SCE_NP_BASIC_EVENT_ADD_PLAYERS_HISTORY_RESULT = 18, - SCE_NP_BASIC_EVENT_SEND_CUSTOM_DATA_RESULT = 19, - SCE_NP_BASIC_EVENT_RECV_CUSTOM_DATA_RESULT = 20, - SCE_NP_BASIC_EVENT_INCOMING_CUSTOM_DATA_MESSAGE = 21, - SCE_NP_BASIC_EVENT_SEND_URL_ATTACHMENT_RESULT = 22, - SCE_NP_BASIC_EVENT_INCOMING_BOOTABLE_INVITATION = 23, - SCE_NP_BASIC_EVENT_BLOCKLIST_UPDATE = 24, + SCE_NP_BASIC_EVENT_UNKNOWN = -1, + SCE_NP_BASIC_EVENT_OFFLINE = 0, + SCE_NP_BASIC_EVENT_PRESENCE = 1, + SCE_NP_BASIC_EVENT_MESSAGE = 2, + SCE_NP_BASIC_EVENT_ADD_FRIEND_RESULT = 3, + SCE_NP_BASIC_EVENT_INCOMING_ATTACHMENT = 4, + SCE_NP_BASIC_EVENT_INCOMING_INVITATION = 5, + SCE_NP_BASIC_EVENT_END_OF_INITIAL_PRESENCE = 6, + SCE_NP_BASIC_EVENT_SEND_ATTACHMENT_RESULT = 7, + SCE_NP_BASIC_EVENT_RECV_ATTACHMENT_RESULT = 8, + SCE_NP_BASIC_EVENT_OUT_OF_CONTEXT = 9, + SCE_NP_BASIC_EVENT_FRIEND_REMOVED = 10, + SCE_NP_BASIC_EVENT_ADD_BLOCKLIST_RESULT = 11, + SCE_NP_BASIC_EVENT_SEND_MESSAGE_RESULT = 12, + SCE_NP_BASIC_EVENT_SEND_INVITATION_RESULT = 13, + SCE_NP_BASIC_EVENT_RECV_INVITATION_RESULT = 14, + SCE_NP_BASIC_EVENT_MESSAGE_MARKED_AS_USED_RESULT = 15, + SCE_NP_BASIC_EVENT_INCOMING_CUSTOM_INVITATION = 16, + SCE_NP_BASIC_EVENT_INCOMING_CLAN_MESSAGE = 17, + SCE_NP_BASIC_EVENT_ADD_PLAYERS_HISTORY_RESULT = 18, + SCE_NP_BASIC_EVENT_SEND_CUSTOM_DATA_RESULT = 19, + SCE_NP_BASIC_EVENT_RECV_CUSTOM_DATA_RESULT = 20, + SCE_NP_BASIC_EVENT_INCOMING_CUSTOM_DATA_MESSAGE = 21, + SCE_NP_BASIC_EVENT_SEND_URL_ATTACHMENT_RESULT = 22, + SCE_NP_BASIC_EVENT_INCOMING_BOOTABLE_INVITATION = 23, + SCE_NP_BASIC_EVENT_BLOCKLIST_UPDATE = 24, SCE_NP_BASIC_EVENT_INCOMING_BOOTABLE_CUSTOM_DATA_MESSAGE = 25, }; @@ -897,41 +897,41 @@ enum enum : SceNpBasicAttachmentDataId { SCE_NP_BASIC_INVALID_ATTACHMENT_DATA_ID = 0, - SCE_NP_BASIC_INVALID_MESSAGE_ID = 0, - SCE_NP_BASIC_SELECTED_INVITATION_DATA = 1, - SCE_NP_BASIC_SELECTED_MESSAGE_DATA = 2, + SCE_NP_BASIC_INVALID_MESSAGE_ID = 0, + SCE_NP_BASIC_SELECTED_INVITATION_DATA = 1, + SCE_NP_BASIC_SELECTED_MESSAGE_DATA = 2, }; // Actions made in system GUI enum { SCE_NP_BASIC_MESSAGE_ACTION_UNKNOWN = 0, - SCE_NP_BASIC_MESSAGE_ACTION_USE = 1, - SCE_NP_BASIC_MESSAGE_ACTION_ACCEPT = 2, - SCE_NP_BASIC_MESSAGE_ACTION_DENY = 3, + SCE_NP_BASIC_MESSAGE_ACTION_USE = 1, + SCE_NP_BASIC_MESSAGE_ACTION_ACCEPT = 2, + SCE_NP_BASIC_MESSAGE_ACTION_DENY = 3, }; // Main types of messages enum SceNpBasicMessageMainType : u16 { SCE_NP_BASIC_MESSAGE_MAIN_TYPE_DATA_ATTACHMENT = 0, - SCE_NP_BASIC_MESSAGE_MAIN_TYPE_GENERAL = 1, - SCE_NP_BASIC_MESSAGE_MAIN_TYPE_ADD_FRIEND = 2, - SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE = 3, - SCE_NP_BASIC_MESSAGE_MAIN_TYPE_CUSTOM_DATA = 4, - SCE_NP_BASIC_MESSAGE_MAIN_TYPE_URL_ATTACHMENT = 5, + SCE_NP_BASIC_MESSAGE_MAIN_TYPE_GENERAL = 1, + SCE_NP_BASIC_MESSAGE_MAIN_TYPE_ADD_FRIEND = 2, + SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE = 3, + SCE_NP_BASIC_MESSAGE_MAIN_TYPE_CUSTOM_DATA = 4, + SCE_NP_BASIC_MESSAGE_MAIN_TYPE_URL_ATTACHMENT = 5, }; // Sub types of messages enum SceNpBasicMessageSubType : u16 { SCE_NP_BASIC_MESSAGE_DATA_ATTACHMENT_SUBTYPE_ACTION_USE = 0, - SCE_NP_BASIC_MESSAGE_GENERAL_SUBTYPE_NONE = 0, - SCE_NP_BASIC_MESSAGE_ADD_FRIEND_SUBTYPE_NONE = 0, - SCE_NP_BASIC_MESSAGE_INVITE_SUBTYPE_ACTION_ACCEPT_DENY = 0, - SCE_NP_BASIC_MESSAGE_CUSTOM_DATA_SUBTYPE_ACTION_USE = 0, - SCE_NP_BASIC_MESSAGE_URL_ATTACHMENT_SUBTYPE_ACTION_USE = 0, - SCE_NP_BASIC_MESSAGE_INVITE_SUBTYPE_ACTION_ACCEPT = 1, + SCE_NP_BASIC_MESSAGE_GENERAL_SUBTYPE_NONE = 0, + SCE_NP_BASIC_MESSAGE_ADD_FRIEND_SUBTYPE_NONE = 0, + SCE_NP_BASIC_MESSAGE_INVITE_SUBTYPE_ACTION_ACCEPT_DENY = 0, + SCE_NP_BASIC_MESSAGE_CUSTOM_DATA_SUBTYPE_ACTION_USE = 0, + SCE_NP_BASIC_MESSAGE_URL_ATTACHMENT_SUBTYPE_ACTION_USE = 0, + SCE_NP_BASIC_MESSAGE_INVITE_SUBTYPE_ACTION_ACCEPT = 1, }; // Applicable features of messages @@ -939,9 +939,9 @@ enum SceNpBasicMessageSubType : u16 enum SceNpBasicMessageFeatures : u32 { SCE_NP_BASIC_MESSAGE_FEATURES_MULTI_RECEIPIENTS = 0x00000001, - SCE_NP_BASIC_MESSAGE_FEATURES_BOOTABLE = 0x00000002, - SCE_NP_BASIC_MESSAGE_FEATURES_ASSUME_SEND = 0x00000004, - SCE_NP_BASIC_MESSAGE_FEATURES_ALL_FEATURES = + SCE_NP_BASIC_MESSAGE_FEATURES_BOOTABLE = 0x00000002, + SCE_NP_BASIC_MESSAGE_FEATURES_ASSUME_SEND = 0x00000004, + SCE_NP_BASIC_MESSAGE_FEATURES_ALL_FEATURES = SCE_NP_BASIC_MESSAGE_FEATURES_MULTI_RECEIPIENTS | SCE_NP_BASIC_MESSAGE_FEATURES_BOOTABLE | SCE_NP_BASIC_MESSAGE_FEATURES_ASSUME_SEND | @@ -951,12 +951,12 @@ enum SceNpBasicMessageFeatures : u32 // Types of messages enum SceNpBasicMessageInfoType : u32 { - SCE_NP_BASIC_MESSAGE_INFO_TYPE_MESSAGE_ATTACHMENT = 0, - SCE_NP_BASIC_MESSAGE_INFO_TYPE_MATCHING_INVITATION = 1, - SCE_NP_BASIC_MESSAGE_INFO_TYPE_CLAN_MESSAGE = 3, - SCE_NP_BASIC_MESSAGE_INFO_TYPE_CUSTOM_DATA_MESSAGE = 4, - SCE_NP_BASIC_MESSAGE_INFO_TYPE_ANY_UNREAD_MESSAGE = 5, - SCE_NP_BASIC_MESSAGE_INFO_TYPE_BOOTABLE_INVITATION = 6, + SCE_NP_BASIC_MESSAGE_INFO_TYPE_MESSAGE_ATTACHMENT = 0, + SCE_NP_BASIC_MESSAGE_INFO_TYPE_MATCHING_INVITATION = 1, + SCE_NP_BASIC_MESSAGE_INFO_TYPE_CLAN_MESSAGE = 3, + SCE_NP_BASIC_MESSAGE_INFO_TYPE_CUSTOM_DATA_MESSAGE = 4, + SCE_NP_BASIC_MESSAGE_INFO_TYPE_ANY_UNREAD_MESSAGE = 5, + SCE_NP_BASIC_MESSAGE_INFO_TYPE_BOOTABLE_INVITATION = 6, SCE_NP_BASIC_MESSAGE_INFO_TYPE_BOOTABLE_CUSTOM_DATA_MESSAGE = 7, }; @@ -964,18 +964,18 @@ enum SceNpBasicMessageInfoType : u32 enum { SCE_NP_SIGNALING_CTX_OPT_BANDWIDTH_PROBE_DISABLE = 0, - SCE_NP_SIGNALING_CTX_OPT_BANDWIDTH_PROBE_ENABLE = 1, - SCE_NP_SIGNALING_CTX_OPT_BANDWIDTH_PROBE = 1, + SCE_NP_SIGNALING_CTX_OPT_BANDWIDTH_PROBE_ENABLE = 1, + SCE_NP_SIGNALING_CTX_OPT_BANDWIDTH_PROBE = 1, }; // Event types (including extended ones) enum { - SCE_NP_SIGNALING_EVENT_DEAD = 0, - SCE_NP_SIGNALING_EVENT_ESTABLISHED = 1, - SCE_NP_SIGNALING_EVENT_NETINFO_ERROR = 2, - SCE_NP_SIGNALING_EVENT_NETINFO_RESULT = 3, - SCE_NP_SIGNALING_EVENT_EXT_PEER_ACTIVATED = 10, + SCE_NP_SIGNALING_EVENT_DEAD = 0, + SCE_NP_SIGNALING_EVENT_ESTABLISHED = 1, + SCE_NP_SIGNALING_EVENT_NETINFO_ERROR = 2, + SCE_NP_SIGNALING_EVENT_NETINFO_RESULT = 3, + SCE_NP_SIGNALING_EVENT_EXT_PEER_ACTIVATED = 10, SCE_NP_SIGNALING_EVENT_EXT_PEER_DEACTIVATED = 11, SCE_NP_SIGNALING_EVENT_EXT_MUTUAL_ACTIVATED = 12, }; @@ -984,28 +984,28 @@ enum enum { SCE_NP_SIGNALING_CONN_STATUS_INACTIVE = 0, - SCE_NP_SIGNALING_CONN_STATUS_PENDING = 1, - SCE_NP_SIGNALING_CONN_STATUS_ACTIVE = 2, + SCE_NP_SIGNALING_CONN_STATUS_PENDING = 1, + SCE_NP_SIGNALING_CONN_STATUS_ACTIVE = 2, }; // Connection information to obtain enum { - SCE_NP_SIGNALING_CONN_INFO_RTT = 1, - SCE_NP_SIGNALING_CONN_INFO_BANDWIDTH = 2, - SCE_NP_SIGNALING_CONN_INFO_PEER_NPID = 3, - SCE_NP_SIGNALING_CONN_INFO_PEER_ADDRESS = 4, + SCE_NP_SIGNALING_CONN_INFO_RTT = 1, + SCE_NP_SIGNALING_CONN_INFO_BANDWIDTH = 2, + SCE_NP_SIGNALING_CONN_INFO_PEER_NPID = 3, + SCE_NP_SIGNALING_CONN_INFO_PEER_ADDRESS = 4, SCE_NP_SIGNALING_CONN_INFO_MAPPED_ADDRESS = 5, - SCE_NP_SIGNALING_CONN_INFO_PACKET_LOSS = 6, + SCE_NP_SIGNALING_CONN_INFO_PACKET_LOSS = 6, }; // NAT status type enum { SCE_NP_SIGNALING_NETINFO_NAT_STATUS_UNKNOWN = 0, - SCE_NP_SIGNALING_NETINFO_NAT_STATUS_TYPE1 = 1, - SCE_NP_SIGNALING_NETINFO_NAT_STATUS_TYPE2 = 2, - SCE_NP_SIGNALING_NETINFO_NAT_STATUS_TYPE3 = 3, + SCE_NP_SIGNALING_NETINFO_NAT_STATUS_TYPE1 = 1, + SCE_NP_SIGNALING_NETINFO_NAT_STATUS_TYPE2 = 2, + SCE_NP_SIGNALING_NETINFO_NAT_STATUS_TYPE3 = 3, }; // UPnP status @@ -1013,82 +1013,82 @@ enum { SCE_NP_SIGNALING_NETINFO_UPNP_STATUS_UNKNOWN = 0, SCE_NP_SIGNALING_NETINFO_UPNP_STATUS_INVALID = 1, - SCE_NP_SIGNALING_NETINFO_UPNP_STATUS_VALID = 2, + SCE_NP_SIGNALING_NETINFO_UPNP_STATUS_VALID = 2, }; // NP port status enum { SCE_NP_SIGNALING_NETINFO_NPPORT_STATUS_CLOSED = 0, - SCE_NP_SIGNALING_NETINFO_NPPORT_STATUS_OPEN = 1, + SCE_NP_SIGNALING_NETINFO_NPPORT_STATUS_OPEN = 1, }; // NP Receive message options enum SceNpBasicMessageRecvOptions : u32 { - SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_PRESERVE = 0x00000001, + SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_PRESERVE = 0x00000001, SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE = 0x00000002, - SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_ASSUME_LATEST = 0x00000004, - SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_ALL_OPTIONS = 0x00000007 // sum of all other options + SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_ASSUME_LATEST = 0x00000004, + SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_ALL_OPTIONS = 0x00000007 // sum of all other options }; // Constants for common NP functions and structures enum { - SCE_NET_NP_AVATAR_IMAGE_MAX_SIZE = 204800, // 200 * 1024 - SCE_NET_NP_AVATAR_IMAGE_MAX_SIZE_LARGE = 204800, // 200 * 1024 - SCE_NET_NP_AVATAR_IMAGE_MAX_SIZE_MIDDLE = 102400, // 100 * 1024 - SCE_NET_NP_AVATAR_IMAGE_MAX_SIZE_SMALL = 10240, // 10 * 1024 - SCE_NET_NP_AVATAR_URL_MAX_LENGTH = 127, - SCE_NET_NP_ONLINEID_MIN_LENGTH = 3, - SCE_NET_NP_ONLINEID_MAX_LENGTH = 16, - SCE_NET_NP_ONLINENAME_MAX_LENGTH = 48, - SCE_NET_NP_ABOUT_ME_MAX_LENGTH = 63, - SCE_NP_TSS_MAX_SIZE = 65536, // 64 * 1024 - SCE_NET_NP_TSS_MAX_SIZE = SCE_NP_TSS_MAX_SIZE, - SCE_NP_TSS_EXTRA_SLOT_MAX_SIZE = 4194304, // 4 * 1024 * 1024 - SCE_NP_FRIEND_MAX_NUM = 100, + SCE_NET_NP_AVATAR_IMAGE_MAX_SIZE = 204800, // 200 * 1024 + SCE_NET_NP_AVATAR_IMAGE_MAX_SIZE_LARGE = 204800, // 200 * 1024 + SCE_NET_NP_AVATAR_IMAGE_MAX_SIZE_MIDDLE = 102400, // 100 * 1024 + SCE_NET_NP_AVATAR_IMAGE_MAX_SIZE_SMALL = 10240, // 10 * 1024 + SCE_NET_NP_AVATAR_URL_MAX_LENGTH = 127, + SCE_NET_NP_ONLINEID_MIN_LENGTH = 3, + SCE_NET_NP_ONLINEID_MAX_LENGTH = 16, + SCE_NET_NP_ONLINENAME_MAX_LENGTH = 48, + SCE_NET_NP_ABOUT_ME_MAX_LENGTH = 63, + SCE_NP_TSS_MAX_SIZE = 65536, // 64 * 1024 + SCE_NET_NP_TSS_MAX_SIZE = SCE_NP_TSS_MAX_SIZE, + SCE_NP_TSS_EXTRA_SLOT_MAX_SIZE = 4194304, // 4 * 1024 * 1024 + SCE_NP_FRIEND_MAX_NUM = 100, SCE_NET_NP_COMMUNICATION_PASSPHRASE_SIZE = 128, - SCE_NP_COMMUNICATION_SIGNATURE_SIZE = 160, - SCE_NP_COMMUNICATION_PASSPHRASE_SIZE = SCE_NET_NP_COMMUNICATION_PASSPHRASE_SIZE, - SCE_NET_NP_PSHANDLE_MIN_LENGTH = SCE_NET_NP_ONLINEID_MIN_LENGTH, - SCE_NET_NP_PSHANDLE_MAX_LENGTH = SCE_NET_NP_ONLINEID_MAX_LENGTH, - SCE_NET_NP_SUBHANDLE_MAX_LENGTH = SCE_NET_NP_ONLINENAME_MAX_LENGTH, - SCE_NET_NP_ICON_URL_MAX_LENGTH = SCE_NET_NP_AVATAR_URL_MAX_LENGTH, - SCE_NP_UTIL_NPID_VERSION = 1, - SCE_NP_UTIL_NPLOBBYID_VERSION = 1, - SCE_NP_UTIL_NPROOMID_VERSION = 1, - SCE_NP_COMMERCE_VERSION = 1, + SCE_NP_COMMUNICATION_SIGNATURE_SIZE = 160, + SCE_NP_COMMUNICATION_PASSPHRASE_SIZE = SCE_NET_NP_COMMUNICATION_PASSPHRASE_SIZE, + SCE_NET_NP_PSHANDLE_MIN_LENGTH = SCE_NET_NP_ONLINEID_MIN_LENGTH, + SCE_NET_NP_PSHANDLE_MAX_LENGTH = SCE_NET_NP_ONLINEID_MAX_LENGTH, + SCE_NET_NP_SUBHANDLE_MAX_LENGTH = SCE_NET_NP_ONLINENAME_MAX_LENGTH, + SCE_NET_NP_ICON_URL_MAX_LENGTH = SCE_NET_NP_AVATAR_URL_MAX_LENGTH, + SCE_NP_UTIL_NPID_VERSION = 1, + SCE_NP_UTIL_NPLOBBYID_VERSION = 1, + SCE_NP_UTIL_NPROOMID_VERSION = 1, + SCE_NP_COMMERCE_VERSION = 1, }; // Languages enum { - SCE_NP_LANG_JAPANESE = 0, - SCE_NP_LANG_ENGLISH = 1, - SCE_NP_LANG_ENGLISH_US = 1, - SCE_NP_LANG_FRENCH = 2, - SCE_NP_LANG_SPANISH = 3, - SCE_NP_LANG_GERMAN = 4, - SCE_NP_LANG_ITALIAN = 5, - SCE_NP_LANG_DUTCH = 6, - SCE_NP_LANG_PORTUGUESE = 7, + SCE_NP_LANG_JAPANESE = 0, + SCE_NP_LANG_ENGLISH = 1, + SCE_NP_LANG_ENGLISH_US = 1, + SCE_NP_LANG_FRENCH = 2, + SCE_NP_LANG_SPANISH = 3, + SCE_NP_LANG_GERMAN = 4, + SCE_NP_LANG_ITALIAN = 5, + SCE_NP_LANG_DUTCH = 6, + SCE_NP_LANG_PORTUGUESE = 7, SCE_NP_LANG_PORTUGUESE_PT = 7, - SCE_NP_LANG_RUSSIAN = 8, - SCE_NP_LANG_KOREAN = 9, - SCE_NP_LANG_CHINESE_T = 10, - SCE_NP_LANG_CHINESE_S = 11, - SCE_NP_LANG_FINNISH = 12, - SCE_NP_LANG_SWEDISH = 13, - SCE_NP_LANG_DANISH = 14, - SCE_NP_LANG_NORWEGIAN = 15, - SCE_NP_LANG_POLISH = 16, + SCE_NP_LANG_RUSSIAN = 8, + SCE_NP_LANG_KOREAN = 9, + SCE_NP_LANG_CHINESE_T = 10, + SCE_NP_LANG_CHINESE_S = 11, + SCE_NP_LANG_FINNISH = 12, + SCE_NP_LANG_SWEDISH = 13, + SCE_NP_LANG_DANISH = 14, + SCE_NP_LANG_NORWEGIAN = 15, + SCE_NP_LANG_POLISH = 16, SCE_NP_LANG_PORTUGUESE_BR = 17, - SCE_NP_LANG_ENGLISH_GB = 18, - SCE_NP_LANG_TURKISH = 19, - SCE_NP_LANG_SPANISH_LA = 20, - SCE_NP_LANG_ARABIC = 21, - SCE_NP_LANG_FRENCH_CA = 22, + SCE_NP_LANG_ENGLISH_GB = 18, + SCE_NP_LANG_TURKISH = 19, + SCE_NP_LANG_SPANISH_LA = 20, + SCE_NP_LANG_ARABIC = 21, + SCE_NP_LANG_FRENCH_CA = 22, }; enum SceNpAvatarSizeType @@ -1101,70 +1101,70 @@ enum SceNpAvatarSizeType // Constants for basic NP functions and structures enum { - SCE_NP_BASIC_MAX_MESSAGE_SIZE = 512, - SCE_NP_BASIC_MAX_PRESENCE_SIZE = 128, - SCE_NP_BASIC_MAX_MESSAGE_ATTACHMENT_SIZE = 1048576, - SCE_NP_BASIC_SUBJECT_CHARACTER_MAX = 18, - SCE_NP_BASIC_BODY_CHARACTER_MAX = 512, - SCE_NP_BASIC_DESCRIPTION_CHARACTER_MAX = 341, - SCE_NP_BASIC_SEND_MESSAGE_MAX_RECIPIENTS = 12, - SCE_NP_BASIC_PRESENCE_TITLE_SIZE_MAX = 128, - SCE_NP_BASIC_PRESENCE_STATUS_SIZE_MAX = 64, - SCE_NP_BASIC_PRESENCE_STATUS_CHARACTER_MAX = 21, - SCE_NP_BASIC_PRESENCE_EXTENDED_STATUS_SIZE_MAX = 192, + SCE_NP_BASIC_MAX_MESSAGE_SIZE = 512, + SCE_NP_BASIC_MAX_PRESENCE_SIZE = 128, + SCE_NP_BASIC_MAX_MESSAGE_ATTACHMENT_SIZE = 1048576, + SCE_NP_BASIC_SUBJECT_CHARACTER_MAX = 18, + SCE_NP_BASIC_BODY_CHARACTER_MAX = 512, + SCE_NP_BASIC_DESCRIPTION_CHARACTER_MAX = 341, + SCE_NP_BASIC_SEND_MESSAGE_MAX_RECIPIENTS = 12, + SCE_NP_BASIC_PRESENCE_TITLE_SIZE_MAX = 128, + SCE_NP_BASIC_PRESENCE_STATUS_SIZE_MAX = 64, + SCE_NP_BASIC_PRESENCE_STATUS_CHARACTER_MAX = 21, + SCE_NP_BASIC_PRESENCE_EXTENDED_STATUS_SIZE_MAX = 192, SCE_NP_BASIC_PRESENCE_EXTENDED_STATUS_CHARACTER_MAX = 63, - SCE_NP_BASIC_PRESENCE_COMMENT_SIZE_MAX = 64, - SCE_NP_BASIC_MAX_INVITATION_DATA_SIZE = 1024, - SCE_NP_BASIC_MAX_URL_ATTACHMENT_SIZE = 2048, - SCE_NP_BASIC_PLAYER_HISTORY_MAX_PLAYERS = 8, + SCE_NP_BASIC_PRESENCE_COMMENT_SIZE_MAX = 64, + SCE_NP_BASIC_MAX_INVITATION_DATA_SIZE = 1024, + SCE_NP_BASIC_MAX_URL_ATTACHMENT_SIZE = 2048, + SCE_NP_BASIC_PLAYER_HISTORY_MAX_PLAYERS = 8, }; // Common constants of sceNpClans enum { - SCE_NP_CLANS_CLAN_NAME_MAX_LENGTH = 64, - SCE_NP_CLANS_CLAN_TAG_MAX_LENGTH = 8, + SCE_NP_CLANS_CLAN_NAME_MAX_LENGTH = 64, + SCE_NP_CLANS_CLAN_TAG_MAX_LENGTH = 8, SCE_NP_CLANS_CLAN_DESCRIPTION_MAX_LENGTH = 255, }; // Constants for custom menu functions and structures enum { - SCE_NP_CUSTOM_MENU_ACTION_CHARACTER_MAX = 21, - SCE_NP_CUSTOM_MENU_ACTION_ITEMS_MAX = 7, + SCE_NP_CUSTOM_MENU_ACTION_CHARACTER_MAX = 21, + SCE_NP_CUSTOM_MENU_ACTION_ITEMS_MAX = 7, SCE_NP_CUSTOM_MENU_ACTION_ITEMS_TOTAL_MAX = 16, - SCE_NP_CUSTOM_MENU_EXCEPTION_ITEMS_MAX = 256, + SCE_NP_CUSTOM_MENU_EXCEPTION_ITEMS_MAX = 256, }; // Constants for manager functions and structures enum { - SCE_NP_COOKIE_MAX_SIZE = 1024, - SCE_NP_TICKET_MAX_SIZE = 65536, + SCE_NP_COOKIE_MAX_SIZE = 1024, + SCE_NP_TICKET_MAX_SIZE = 65536, SCE_NP_TICKET_PARAM_DATA_LEN = 256, - SCE_NP_ENTITLEMENT_ID_SIZE = 32, + SCE_NP_ENTITLEMENT_ID_SIZE = 32, }; enum { - SCE_NP_ENTITLEMENT_TYPE_NON_CONSUMABLE = 0, - SCE_NP_ENTITLEMENT_TYPE_CONSUMABLE = 1 + SCE_NP_ENTITLEMENT_TYPE_NON_CONSUMABLE = 0, + SCE_NP_ENTITLEMENT_TYPE_CONSUMABLE = 1 }; // Constants for ranking (score) functions and structures enum { - SCE_NP_SCORE_MAX_CTX_NUM = 32, - SCE_NP_SCORE_COMMENT_MAXLEN = 63, - SCE_NP_SCORE_GAMEDATA_ID_LEN = 63, - SCE_NP_SCORE_GAMEINFO_SIZE = 64, - SCE_NP_SCORE_PASSPHRASE_SIZE = 128, - SCE_NP_SCORE_CENSOR_COMMENT_MAXLEN = 255, - SCE_NP_SCORE_SANITIZE_COMMENT_MAXLEN = 255, - SCE_NP_SCORE_MAX_RANGE_NUM_PER_TRANS = 100, - SCE_NP_SCORE_MAX_NPID_NUM_PER_TRANS = 101, - SCE_NP_SCORE_MAX_CLAN_NUM_PER_TRANS = 101, - SCE_NP_SCORE_MAX_SELECTED_FRIENDS_NUM = 100, + SCE_NP_SCORE_MAX_CTX_NUM = 32, + SCE_NP_SCORE_COMMENT_MAXLEN = 63, + SCE_NP_SCORE_GAMEDATA_ID_LEN = 63, + SCE_NP_SCORE_GAMEINFO_SIZE = 64, + SCE_NP_SCORE_PASSPHRASE_SIZE = 128, + SCE_NP_SCORE_CENSOR_COMMENT_MAXLEN = 255, + SCE_NP_SCORE_SANITIZE_COMMENT_MAXLEN = 255, + SCE_NP_SCORE_MAX_RANGE_NUM_PER_TRANS = 100, + SCE_NP_SCORE_MAX_NPID_NUM_PER_TRANS = 101, + SCE_NP_SCORE_MAX_CLAN_NUM_PER_TRANS = 101, + SCE_NP_SCORE_MAX_SELECTED_FRIENDS_NUM = 100, SCE_NP_SCORE_VARIABLE_SIZE_GAMEINFO_MAXSIZE = 189, }; @@ -1189,48 +1189,48 @@ enum enum : SceNpPlatformType { SCE_NP_PLATFORM_TYPE_NONE = 0, - SCE_NP_PLATFORM_TYPE_PS3 = 1, + SCE_NP_PLATFORM_TYPE_PS3 = 1, SCE_NP_PLATFORM_TYPE_VITA = 2, SCE_NP_PLATFORM_TYPE_PS4 = 3, // Note: unknown on which fw versions it appears, but sdk version is unchecked }; enum { - SCE_NP_MATCHING_GUI_EVENT_CREATE_ROOM = 0x0001, - SCE_NP_MATCHING_GUI_EVENT_JOIN_ROOM = 0x0002, - SCE_NP_MATCHING_GUI_EVENT_RESERVED2 = 0x0003, - SCE_NP_MATCHING_GUI_EVENT_SEARCH_JOIN = 0x0004, - SCE_NP_MATCHING_GUI_EVENT_QUICK_MATCH = 0x0005, - SCE_NP_MATCHING_GUI_EVENT_SEND_INVITATION = 0x0006, - SCE_NP_MATCHING_GUI_EVENT_ACCEPT_INVITATION = 0x0007, - SCE_NP_MATCHING_GUI_EVENT_COMMON_LOAD = 0x0008, - SCE_NP_MATCHING_GUI_EVENT_COMMON_UNLOAD = 0x0009, - SCE_NP_MATCHING_GUI_EVENT_GET_ROOM_LIST = 0x000a, + SCE_NP_MATCHING_GUI_EVENT_CREATE_ROOM = 0x0001, + SCE_NP_MATCHING_GUI_EVENT_JOIN_ROOM = 0x0002, + SCE_NP_MATCHING_GUI_EVENT_RESERVED2 = 0x0003, + SCE_NP_MATCHING_GUI_EVENT_SEARCH_JOIN = 0x0004, + SCE_NP_MATCHING_GUI_EVENT_QUICK_MATCH = 0x0005, + SCE_NP_MATCHING_GUI_EVENT_SEND_INVITATION = 0x0006, + SCE_NP_MATCHING_GUI_EVENT_ACCEPT_INVITATION = 0x0007, + SCE_NP_MATCHING_GUI_EVENT_COMMON_LOAD = 0x0008, + SCE_NP_MATCHING_GUI_EVENT_COMMON_UNLOAD = 0x0009, + SCE_NP_MATCHING_GUI_EVENT_GET_ROOM_LIST = 0x000a, SCE_NP_MATCHING_GUI_EVENT_GET_ROOM_LIST_LIMIT = 0x000b }; enum { - SCE_NP_TICKET_PARAM_SERIAL_ID = 0, - SCE_NP_TICKET_PARAM_ISSUER_ID = 1, - SCE_NP_TICKET_PARAM_ISSUED_DATE = 2, - SCE_NP_TICKET_PARAM_EXPIRE_DATE = 3, + SCE_NP_TICKET_PARAM_SERIAL_ID = 0, + SCE_NP_TICKET_PARAM_ISSUER_ID = 1, + SCE_NP_TICKET_PARAM_ISSUED_DATE = 2, + SCE_NP_TICKET_PARAM_EXPIRE_DATE = 3, SCE_NP_TICKET_PARAM_SUBJECT_ACCOUNT_ID = 4, - SCE_NP_TICKET_PARAM_SUBJECT_ONLINE_ID = 5, - SCE_NP_TICKET_PARAM_SUBJECT_REGION = 6, - SCE_NP_TICKET_PARAM_SUBJECT_DOMAIN = 7, - SCE_NP_TICKET_PARAM_SERVICE_ID = 8, - SCE_NP_TICKET_PARAM_SUBJECT_STATUS = 9, - SCE_NP_TICKET_PARAM_STATUS_DURATION = 10, - SCE_NP_TICKET_PARAM_SUBJECT_DOB = 11, + SCE_NP_TICKET_PARAM_SUBJECT_ONLINE_ID = 5, + SCE_NP_TICKET_PARAM_SUBJECT_REGION = 6, + SCE_NP_TICKET_PARAM_SUBJECT_DOMAIN = 7, + SCE_NP_TICKET_PARAM_SERVICE_ID = 8, + SCE_NP_TICKET_PARAM_SUBJECT_STATUS = 9, + SCE_NP_TICKET_PARAM_STATUS_DURATION = 10, + SCE_NP_TICKET_PARAM_SUBJECT_DOB = 11, }; enum { SCE_NP_TICKET_SERIAL_ID_SIZE = 20, - SCE_NP_SUBJECT_REGION_SIZE = 4, - SCE_NP_SUBJECT_DOMAIN_SIZE = 4, - SCE_NP_SERVICE_ID_SIZE = 24, + SCE_NP_SUBJECT_REGION_SIZE = 4, + SCE_NP_SUBJECT_DOMAIN_SIZE = 4, + SCE_NP_SERVICE_ID_SIZE = 24, }; enum @@ -1566,7 +1566,7 @@ union SceNpSignalingConnectionInfo SceNpId npId; struct { - np_in_addr addr; // in_addr + np_in_addr addr; // in_addr np_in_port_t port; // in_port_t } address; be_t packet_loss; @@ -1576,7 +1576,7 @@ union SceNpSignalingConnectionInfo struct SceNpSignalingNetInfo { be_t size; - be_t local_addr; // in_addr + be_t local_addr; // in_addr be_t mapped_addr; // in_addr be_t nat_status; be_t upnp_status; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sceNp2.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sceNp2.cpp index ed4655ccd..c9df408a6 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sceNp2.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sceNp2.cpp @@ -15,165 +15,167 @@ LOG_CHANNEL(sceNp2); template <> void fmt_class_string::format(std::string& out, u64 arg) { - format_enum(out, arg, [](auto error) { - switch (error) + format_enum(out, arg, [](auto error) { - STR_CASE(SCE_NP_MATCHING2_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_MATCHING2_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); - STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_ALREADY_EXISTS); - STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_ALREADY_STARTED); - STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED); - STR_CASE(SCE_NP_MATCHING2_ERROR_SERVER_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_SERVER_ID); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_WORLD_ID); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_LOBBY_ID); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_ROOM_ID); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_MEMBER_ID); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_ATTRIBUTE_ID); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_CASTTYPE); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_SORT_METHOD); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_MAX_SLOT); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_MATCHING_SPACE); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_BLOCK_KICK_FLAG); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_MESSAGE_TARGET); - STR_CASE(SCE_NP_MATCHING2_ERROR_RANGE_FILTER_MAX); - STR_CASE(SCE_NP_MATCHING2_ERROR_INSUFFICIENT_BUFFER); - STR_CASE(SCE_NP_MATCHING2_ERROR_DESTINATION_DISAPPEARED); - STR_CASE(SCE_NP_MATCHING2_ERROR_REQUEST_TIMEOUT); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_ALIGNMENT); - STR_CASE(SCE_NP_MATCHING2_ERROR_REQUEST_CB_QUEUE_OVERFLOW); - STR_CASE(SCE_NP_MATCHING2_ERROR_EVENT_CB_QUEUE_OVERFLOW); - STR_CASE(SCE_NP_MATCHING2_ERROR_MSG_CB_QUEUE_OVERFLOW); - STR_CASE(SCE_NP_MATCHING2_ERROR_CONNECTION_CLOSED_BY_SERVER); - STR_CASE(SCE_NP_MATCHING2_ERROR_SSL_VERIFY_FAILED); - STR_CASE(SCE_NP_MATCHING2_ERROR_SSL_HANDSHAKE); - STR_CASE(SCE_NP_MATCHING2_ERROR_SSL_SEND); - STR_CASE(SCE_NP_MATCHING2_ERROR_SSL_RECV); - STR_CASE(SCE_NP_MATCHING2_ERROR_JOINED_SESSION_MAX); - STR_CASE(SCE_NP_MATCHING2_ERROR_ALREADY_JOINED); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_SESSION_TYPE); - STR_CASE(SCE_NP_MATCHING2_ERROR_CLAN_LOBBY_NOT_EXIST); - STR_CASE(SCE_NP_MATCHING2_ERROR_NP_SIGNED_OUT); - STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE); - STR_CASE(SCE_NP_MATCHING2_ERROR_SERVER_NOT_AVAILABLE); - STR_CASE(SCE_NP_MATCHING2_ERROR_NOT_ALLOWED); - STR_CASE(SCE_NP_MATCHING2_ERROR_ABORTED); - STR_CASE(SCE_NP_MATCHING2_ERROR_REQUEST_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING2_ERROR_SESSION_DESTROYED); - STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_STOPPED); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_REQUEST_PARAMETER); - STR_CASE(SCE_NP_MATCHING2_ERROR_NOT_NP_SIGN_IN); - STR_CASE(SCE_NP_MATCHING2_ERROR_ROOM_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING2_ERROR_ROOM_MEMBER_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING2_ERROR_LOBBY_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING2_ERROR_LOBBY_MEMBER_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING2_ERROR_EVENT_DATA_NOT_FOUND); - STR_CASE(SCE_NP_MATCHING2_ERROR_KEEPALIVE_TIMEOUT); - STR_CASE(SCE_NP_MATCHING2_ERROR_TIMEOUT_TOO_SHORT); - STR_CASE(SCE_NP_MATCHING2_ERROR_TIMEDOUT); - STR_CASE(SCE_NP_MATCHING2_ERROR_CREATE_HEAP); - STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_ATTRIBUTE_SIZE); - STR_CASE(SCE_NP_MATCHING2_ERROR_CANNOT_ABORT); - STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_NO_DNS_SERVER); - STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_INVALID_PACKET); - STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_TIMEOUT); - STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_NO_RECORD); - STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_RES_PACKET_FORMAT); - STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_RES_SERVER_FAILURE); - STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_NO_HOST); - STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_RES_NOT_IMPLEMENTED); - STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_RES_SERVER_REFUSED); - STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_RESP_TRUNCATED); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_BAD_REQUEST); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_SERVICE_UNAVAILABLE); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_BUSY); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_END_OF_SERVICE); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_INTERNAL_SERVER_ERROR); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_PLAYER_BANNED); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_FORBIDDEN); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_BLOCKED); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_UNSUPPORTED_NP_ENV); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_INVALID_TICKET); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_INVALID_SIGNATURE); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_EXPIRED_TICKET); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_ENTITLEMENT_REQUIRED); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_CONTEXT); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_CLOSED); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_TITLE); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_WORLD); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_LOBBY); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_ROOM); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_LOBBY_INSTANCE); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_ROOM_INSTANCE); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_PASSWORD_MISMATCH); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_LOBBY_FULL); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_ROOM_FULL); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_GROUP_FULL); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_USER); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_TITLE_PASSPHRASE_MISMATCH); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_DUPLICATE_LOBBY); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_DUPLICATE_ROOM); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_JOIN_GROUP_LABEL); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_GROUP); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_PASSWORD); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_MAX_OVER_SLOT_GROUP); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_MAX_OVER_PASSWORD_MASK); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_DUPLICATE_GROUP_LABEL); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_REQUEST_OVERFLOW); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_ALREADY_JOINED); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH); - STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_ROOM_INCONSISTENCY); - // STR_CASE(SCE_NP_MATCHING2_NET_ERRNO_BASE); - // STR_CASE(SCE_NP_MATCHING2_NET_H_ERRNO_BASE); - } + switch (error) + { + STR_CASE(SCE_NP_MATCHING2_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_MATCHING2_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); + STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_ALREADY_EXISTS); + STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_ALREADY_STARTED); + STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED); + STR_CASE(SCE_NP_MATCHING2_ERROR_SERVER_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_SERVER_ID); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_WORLD_ID); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_LOBBY_ID); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_ROOM_ID); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_MEMBER_ID); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_ATTRIBUTE_ID); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_CASTTYPE); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_SORT_METHOD); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_MAX_SLOT); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_MATCHING_SPACE); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_BLOCK_KICK_FLAG); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_MESSAGE_TARGET); + STR_CASE(SCE_NP_MATCHING2_ERROR_RANGE_FILTER_MAX); + STR_CASE(SCE_NP_MATCHING2_ERROR_INSUFFICIENT_BUFFER); + STR_CASE(SCE_NP_MATCHING2_ERROR_DESTINATION_DISAPPEARED); + STR_CASE(SCE_NP_MATCHING2_ERROR_REQUEST_TIMEOUT); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_ALIGNMENT); + STR_CASE(SCE_NP_MATCHING2_ERROR_REQUEST_CB_QUEUE_OVERFLOW); + STR_CASE(SCE_NP_MATCHING2_ERROR_EVENT_CB_QUEUE_OVERFLOW); + STR_CASE(SCE_NP_MATCHING2_ERROR_MSG_CB_QUEUE_OVERFLOW); + STR_CASE(SCE_NP_MATCHING2_ERROR_CONNECTION_CLOSED_BY_SERVER); + STR_CASE(SCE_NP_MATCHING2_ERROR_SSL_VERIFY_FAILED); + STR_CASE(SCE_NP_MATCHING2_ERROR_SSL_HANDSHAKE); + STR_CASE(SCE_NP_MATCHING2_ERROR_SSL_SEND); + STR_CASE(SCE_NP_MATCHING2_ERROR_SSL_RECV); + STR_CASE(SCE_NP_MATCHING2_ERROR_JOINED_SESSION_MAX); + STR_CASE(SCE_NP_MATCHING2_ERROR_ALREADY_JOINED); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_SESSION_TYPE); + STR_CASE(SCE_NP_MATCHING2_ERROR_CLAN_LOBBY_NOT_EXIST); + STR_CASE(SCE_NP_MATCHING2_ERROR_NP_SIGNED_OUT); + STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE); + STR_CASE(SCE_NP_MATCHING2_ERROR_SERVER_NOT_AVAILABLE); + STR_CASE(SCE_NP_MATCHING2_ERROR_NOT_ALLOWED); + STR_CASE(SCE_NP_MATCHING2_ERROR_ABORTED); + STR_CASE(SCE_NP_MATCHING2_ERROR_REQUEST_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING2_ERROR_SESSION_DESTROYED); + STR_CASE(SCE_NP_MATCHING2_ERROR_CONTEXT_STOPPED); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_REQUEST_PARAMETER); + STR_CASE(SCE_NP_MATCHING2_ERROR_NOT_NP_SIGN_IN); + STR_CASE(SCE_NP_MATCHING2_ERROR_ROOM_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING2_ERROR_ROOM_MEMBER_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING2_ERROR_LOBBY_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING2_ERROR_LOBBY_MEMBER_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING2_ERROR_EVENT_DATA_NOT_FOUND); + STR_CASE(SCE_NP_MATCHING2_ERROR_KEEPALIVE_TIMEOUT); + STR_CASE(SCE_NP_MATCHING2_ERROR_TIMEOUT_TOO_SHORT); + STR_CASE(SCE_NP_MATCHING2_ERROR_TIMEDOUT); + STR_CASE(SCE_NP_MATCHING2_ERROR_CREATE_HEAP); + STR_CASE(SCE_NP_MATCHING2_ERROR_INVALID_ATTRIBUTE_SIZE); + STR_CASE(SCE_NP_MATCHING2_ERROR_CANNOT_ABORT); + STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_NO_DNS_SERVER); + STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_INVALID_PACKET); + STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_TIMEOUT); + STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_NO_RECORD); + STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_RES_PACKET_FORMAT); + STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_RES_SERVER_FAILURE); + STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_NO_HOST); + STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_RES_NOT_IMPLEMENTED); + STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_RES_SERVER_REFUSED); + STR_CASE(SCE_NP_MATCHING2_RESOLVER_ERROR_RESP_TRUNCATED); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_BAD_REQUEST); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_SERVICE_UNAVAILABLE); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_BUSY); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_END_OF_SERVICE); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_INTERNAL_SERVER_ERROR); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_PLAYER_BANNED); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_FORBIDDEN); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_BLOCKED); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_UNSUPPORTED_NP_ENV); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_INVALID_TICKET); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_INVALID_SIGNATURE); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_EXPIRED_TICKET); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_ENTITLEMENT_REQUIRED); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_CONTEXT); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_CLOSED); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_TITLE); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_WORLD); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_LOBBY); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_ROOM); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_LOBBY_INSTANCE); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_ROOM_INSTANCE); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_PASSWORD_MISMATCH); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_LOBBY_FULL); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_ROOM_FULL); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_GROUP_FULL); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_USER); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_TITLE_PASSPHRASE_MISMATCH); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_DUPLICATE_LOBBY); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_DUPLICATE_ROOM); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_JOIN_GROUP_LABEL); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_GROUP); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NO_PASSWORD); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_MAX_OVER_SLOT_GROUP); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_MAX_OVER_PASSWORD_MASK); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_DUPLICATE_GROUP_LABEL); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_REQUEST_OVERFLOW); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_ALREADY_JOINED); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH); + STR_CASE(SCE_NP_MATCHING2_SERVER_ERROR_ROOM_INCONSISTENCY); + // STR_CASE(SCE_NP_MATCHING2_NET_ERRNO_BASE); + // STR_CASE(SCE_NP_MATCHING2_NET_H_ERRNO_BASE); + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { - format_enum(out, arg, [](auto error) { - switch (error) + format_enum(out, arg, [](auto error) { - STR_CASE(SCE_NP_OAUTH_ERROR_UNKNOWN); - STR_CASE(SCE_NP_OAUTH_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_OAUTH_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_OAUTH_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_OAUTH_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_OAUTH_ERROR_OUT_OF_BUFFER); - STR_CASE(SCE_NP_OAUTH_ERROR_BAD_RESPONSE); - STR_CASE(SCE_NP_OAUTH_ERROR_ABORTED); - STR_CASE(SCE_NP_OAUTH_ERROR_SIGNED_OUT); - STR_CASE(SCE_NP_OAUTH_ERROR_REQUEST_NOT_FOUND); - STR_CASE(SCE_NP_OAUTH_ERROR_SSL_ERR_CN_CHECK); - STR_CASE(SCE_NP_OAUTH_ERROR_SSL_ERR_UNKNOWN_CA); - STR_CASE(SCE_NP_OAUTH_ERROR_SSL_ERR_NOT_AFTER_CHECK); - STR_CASE(SCE_NP_OAUTH_ERROR_SSL_ERR_NOT_BEFORE_CHECK); - STR_CASE(SCE_NP_OAUTH_ERROR_SSL_ERR_INVALID_CERT); - STR_CASE(SCE_NP_OAUTH_ERROR_SSL_ERR_INTERNAL); - STR_CASE(SCE_NP_OAUTH_ERROR_REQUEST_MAX); - STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_BANNED_CONSOLE); - STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_INVALID_LOGIN); - STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_INACTIVE_ACCOUNT); - STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_SUSPENDED_ACCOUNT); - STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_SUSPENDED_DEVICE); - STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_PASSWORD_EXPIRED); - STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_TOSUA_MUST_BE_RE_ACCEPTED); - STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_TOSUA_MUST_BE_RE_ACCEPTED_FOR_SUBACCOUNT); - STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_BANNED_ACCOUNT); - STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_SERVICE_END); - STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_SERVICE_UNAVAILABLE); - } + switch (error) + { + STR_CASE(SCE_NP_OAUTH_ERROR_UNKNOWN); + STR_CASE(SCE_NP_OAUTH_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_OAUTH_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_OAUTH_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_OAUTH_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_OAUTH_ERROR_OUT_OF_BUFFER); + STR_CASE(SCE_NP_OAUTH_ERROR_BAD_RESPONSE); + STR_CASE(SCE_NP_OAUTH_ERROR_ABORTED); + STR_CASE(SCE_NP_OAUTH_ERROR_SIGNED_OUT); + STR_CASE(SCE_NP_OAUTH_ERROR_REQUEST_NOT_FOUND); + STR_CASE(SCE_NP_OAUTH_ERROR_SSL_ERR_CN_CHECK); + STR_CASE(SCE_NP_OAUTH_ERROR_SSL_ERR_UNKNOWN_CA); + STR_CASE(SCE_NP_OAUTH_ERROR_SSL_ERR_NOT_AFTER_CHECK); + STR_CASE(SCE_NP_OAUTH_ERROR_SSL_ERR_NOT_BEFORE_CHECK); + STR_CASE(SCE_NP_OAUTH_ERROR_SSL_ERR_INVALID_CERT); + STR_CASE(SCE_NP_OAUTH_ERROR_SSL_ERR_INTERNAL); + STR_CASE(SCE_NP_OAUTH_ERROR_REQUEST_MAX); + STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_BANNED_CONSOLE); + STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_INVALID_LOGIN); + STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_INACTIVE_ACCOUNT); + STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_SUSPENDED_ACCOUNT); + STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_SUSPENDED_DEVICE); + STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_PASSWORD_EXPIRED); + STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_TOSUA_MUST_BE_RE_ACCEPTED); + STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_TOSUA_MUST_BE_RE_ACCEPTED_FOR_SUBACCOUNT); + STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_BANNED_ACCOUNT); + STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_SERVICE_END); + STR_CASE(SCE_NP_OAUTH_SERVER_ERROR_SERVICE_UNAVAILABLE); + } - return unknown; - }); + return unknown; + }); } error_code sceNpMatching2Init2(u32 stackSize, s32 priority, vm::ptr param); @@ -343,7 +345,7 @@ error_code sceNpMatching2DestroyContext(SceNpMatching2ContextId ctxId) } error_code sceNpMatching2LeaveLobby( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2LeaveLobby(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -371,7 +373,7 @@ error_code sceNpMatching2RegisterLobbyMessageCallback(SceNpMatching2ContextId ct } error_code sceNpMatching2GetWorldInfoList( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2GetWorldInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -411,7 +413,7 @@ error_code sceNpMatching2RegisterLobbyEventCallback(SceNpMatching2ContextId ctxI } error_code sceNpMatching2GetLobbyMemberDataInternalList(SceNpMatching2ContextId ctxId, vm::cptr reqParam, - vm::cptr optParam, vm::ptr assignedReqId) + vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetLobbyMemberDataInternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -425,7 +427,7 @@ error_code sceNpMatching2GetLobbyMemberDataInternalList(SceNpMatching2ContextId } error_code sceNpMatching2SearchRoom( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2SearchRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -446,7 +448,7 @@ error_code sceNpMatching2SearchRoom( } error_code sceNpMatching2SignalingGetConnectionStatus( - SceNpMatching2ContextId ctxId, SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId memberId, vm::ptr connStatus, vm::ptr peerAddr, vm::ptr peerPort) + SceNpMatching2ContextId ctxId, SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId memberId, vm::ptr connStatus, vm::ptr peerAddr, vm::ptr peerPort) { sceNp2.warning("sceNpMatching2SignalingGetConnectionStatus(ctxId=%d, roomId=%d, memberId=%d, connStatus=*0x%x, peerAddr=*0x%x, peerPort=*0x%x)", ctxId, roomId, memberId, connStatus, peerAddr, peerPort); @@ -509,7 +511,7 @@ error_code sceNpMatching2SignalingGetConnectionStatus( } error_code sceNpMatching2SetUserInfo( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2SetUserInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -544,7 +546,7 @@ error_code sceNpMatching2GetClanLobbyId(SceNpMatching2ContextId ctxId, SceNpClan } error_code sceNpMatching2GetLobbyMemberDataInternal( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetLobbyMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -578,17 +580,17 @@ error_code sceNpMatching2ContextStart(SceNpMatching2ContextId ctxId) if (ctx->context_callback) { sysutil_register_cb([=, context_callback = ctx->context_callback, context_callback_param = ctx->context_callback_param](ppu_thread& cb_ppu) -> s32 - { - context_callback(cb_ppu, ctxId, SCE_NP_MATCHING2_CONTEXT_EVENT_Start, SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ACTION, 0, context_callback_param); - return 0; - }); + { + context_callback(cb_ppu, ctxId, SCE_NP_MATCHING2_CONTEXT_EVENT_Start, SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ACTION, 0, context_callback_param); + return 0; + }); } return CELL_OK; } error_code sceNpMatching2CreateServerContext( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2CreateServerContext(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -628,7 +630,7 @@ error_code sceNpMatching2GetMemoryInfo(vm::ptr memInfo } error_code sceNpMatching2LeaveRoom( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2LeaveRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -649,7 +651,7 @@ error_code sceNpMatching2LeaveRoom( } error_code sceNpMatching2SetRoomDataExternal( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2SetRoomDataExternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -670,7 +672,7 @@ error_code sceNpMatching2SetRoomDataExternal( } error_code sceNpMatching2SignalingGetConnectionInfo( - SceNpMatching2ContextId ctxId, SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId memberId, s32 code, vm::ptr connInfo) + SceNpMatching2ContextId ctxId, SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId memberId, s32 code, vm::ptr connInfo) { sceNp2.warning("sceNpMatching2SignalingGetConnectionInfo(ctxId=%d, roomId=%d, memberId=%d, code=%d, connInfo=*0x%x)", ctxId, roomId, memberId, code, connInfo); @@ -707,50 +709,50 @@ error_code sceNpMatching2SignalingGetConnectionInfo( switch (code) { - case SCE_NP_SIGNALING_CONN_INFO_RTT: - { - connInfo->rtt = si->rtt; - sceNp2.warning("Returning a RTT of %d microseconds", connInfo->rtt); - break; - } - case SCE_NP_SIGNALING_CONN_INFO_BANDWIDTH: - { - connInfo->bandwidth = 100'000'000; // 100 MBPS HACK - break; - } - case SCE_NP_SIGNALING_CONN_INFO_PEER_NPID: - { - connInfo->npId = si->npid; - break; - } - case SCE_NP_SIGNALING_CONN_INFO_PEER_ADDRESS: - { - connInfo->address.port = std::bit_cast>(si->port); - connInfo->address.addr.np_s_addr = si->addr; - break; - } - case SCE_NP_SIGNALING_CONN_INFO_MAPPED_ADDRESS: - { - connInfo->address.port = std::bit_cast>(si->mapped_port); - connInfo->address.addr.np_s_addr = si->mapped_addr; - break; - } - case SCE_NP_SIGNALING_CONN_INFO_PACKET_LOSS: - { - connInfo->packet_loss = 0; // HACK - break; - } - default: - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; - } + case SCE_NP_SIGNALING_CONN_INFO_RTT: + { + connInfo->rtt = si->rtt; + sceNp2.warning("Returning a RTT of %d microseconds", connInfo->rtt); + break; + } + case SCE_NP_SIGNALING_CONN_INFO_BANDWIDTH: + { + connInfo->bandwidth = 100'000'000; // 100 MBPS HACK + break; + } + case SCE_NP_SIGNALING_CONN_INFO_PEER_NPID: + { + connInfo->npId = si->npid; + break; + } + case SCE_NP_SIGNALING_CONN_INFO_PEER_ADDRESS: + { + connInfo->address.port = std::bit_cast>(si->port); + connInfo->address.addr.np_s_addr = si->addr; + break; + } + case SCE_NP_SIGNALING_CONN_INFO_MAPPED_ADDRESS: + { + connInfo->address.port = std::bit_cast>(si->mapped_port); + connInfo->address.addr.np_s_addr = si->mapped_addr; + break; + } + case SCE_NP_SIGNALING_CONN_INFO_PACKET_LOSS: + { + connInfo->packet_loss = 0; // HACK + break; + } + default: + { + return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + } } return CELL_OK; } error_code sceNpMatching2SendRoomMessage( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2SendRoomMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -771,7 +773,7 @@ error_code sceNpMatching2SendRoomMessage( } error_code sceNpMatching2JoinLobby( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2JoinLobby(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -785,7 +787,7 @@ error_code sceNpMatching2JoinLobby( } error_code sceNpMatching2GetRoomMemberDataExternalList(SceNpMatching2ContextId ctxId, vm::cptr reqParam, - vm::cptr optParam, vm::ptr assignedReqId) + vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetRoomMemberDataExternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -826,7 +828,7 @@ error_code sceNpMatching2AbortRequest(SceNpMatching2ContextId ctxId, SceNpMatchi } error_code sceNpMatching2GetServerInfo( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2GetServerInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -909,7 +911,7 @@ error_code sceNpMatching2GetRoomSlotInfoLocal(SceNpMatching2ContextId ctxId, con } error_code sceNpMatching2SendLobbyChatMessage( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SendLobbyChatMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -988,7 +990,7 @@ error_code sceNpMatching2GetRoomMemberIdListLocal(SceNpMatching2ContextId ctxId, } error_code sceNpMatching2JoinRoom( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2JoinRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1069,7 +1071,7 @@ error_code sceNpMatching2GetCbQueueInfo(SceNpMatching2ContextId ctxId, vm::ptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2KickoutRoomMember(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1108,17 +1110,17 @@ error_code sceNpMatching2ContextStartAsync(SceNpMatching2ContextId ctxId, u32 ti if (ctx->context_callback) { sysutil_register_cb([=, context_callback = ctx->context_callback, context_callback_param = ctx->context_callback_param](ppu_thread& cb_ppu) -> s32 - { - context_callback(cb_ppu, ctxId, SCE_NP_MATCHING2_CONTEXT_EVENT_Start, SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ACTION, 0, ctx->context_callback_param); - return 0; - }); + { + context_callback(cb_ppu, ctxId, SCE_NP_MATCHING2_CONTEXT_EVENT_Start, SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ACTION, 0, ctx->context_callback_param); + return 0; + }); } return CELL_OK; } error_code sceNpMatching2SetSignalingOptParam( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SetSignalingOptParam(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1158,7 +1160,7 @@ error_code sceNpMatching2RegisterContextCallback(SceNpMatching2ContextId ctxId, } error_code sceNpMatching2SendRoomChatMessage( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SendRoomChatMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1172,7 +1174,7 @@ error_code sceNpMatching2SendRoomChatMessage( } error_code sceNpMatching2SetRoomDataInternal( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2SetRoomDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1193,7 +1195,7 @@ error_code sceNpMatching2SetRoomDataInternal( } error_code sceNpMatching2GetRoomDataInternal( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2GetRoomDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1214,7 +1216,7 @@ error_code sceNpMatching2GetRoomDataInternal( } error_code sceNpMatching2SignalingGetPingInfo( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2SignalingGetPingInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1275,16 +1277,16 @@ error_code sceNpUtilBuildCdnUrl(vm::cptr url, vm::ptr buf, u32 bufSi return SCE_NP_UTIL_ERROR_INVALID_ARGUMENT; } - //if (offline) + // if (offline) //{ // return SCE_NP_ERROR_OFFLINE; - //} + // } return CELL_OK; } error_code sceNpMatching2GrantRoomOwner( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GrantRoomOwner(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1298,7 +1300,7 @@ error_code sceNpMatching2GrantRoomOwner( } error_code sceNpMatching2CreateContext( - vm::cptr npId, vm::cptr commId, vm::cptr passPhrase, vm::ptr ctxId, s32 option) + vm::cptr npId, vm::cptr commId, vm::cptr passPhrase, vm::ptr ctxId, s32 option) { sceNp2.warning("sceNpMatching2CreateContext(npId=*0x%x, commId=*0x%x(%s), passPhrase=*0x%x, ctxId=*0x%x, option=%d)", npId, commId, commId ? commId->data : "", passPhrase, ctxId, option); @@ -1381,7 +1383,7 @@ error_code sceNpMatching2ClearEventData(SceNpMatching2ContextId ctxId, SceNpMatc } error_code sceNpMatching2GetUserInfoList( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetUserInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1395,7 +1397,7 @@ error_code sceNpMatching2GetUserInfoList( } error_code sceNpMatching2GetRoomMemberDataInternal( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2GetRoomMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1416,7 +1418,7 @@ error_code sceNpMatching2GetRoomMemberDataInternal( } error_code sceNpMatching2SetRoomMemberDataInternal( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2SetRoomMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1437,7 +1439,7 @@ error_code sceNpMatching2SetRoomMemberDataInternal( } error_code sceNpMatching2JoinProhibitiveRoom( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2JoinProhibitiveRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1473,7 +1475,7 @@ error_code sceNpMatching2SignalingSetCtxOpt(SceNpMatching2ContextId ctxId, s32 o } error_code sceNpMatching2DeleteServerContext( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2DeleteServerContext(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1534,7 +1536,7 @@ error_code sceNpMatching2RegisterRoomEventCallback(SceNpMatching2ContextId ctxId return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - nph.room_event_cb = cbFunc; + nph.room_event_cb = cbFunc; nph.room_event_cb_ctx = ctxId; nph.room_event_cb_arg = cbFuncArg; @@ -1576,7 +1578,8 @@ error_code sceNpMatching2GetRoomPasswordLocal(SceNpMatching2ContextId ctxId, Sce if (password) { - if (withPassword) *withPassword = true; + if (withPassword) + *withPassword = true; if (roomPassword) { std::memcpy(roomPassword.get_ptr(), &*password, sizeof(SceNpMatching2SessionPassword)); @@ -1584,14 +1587,15 @@ error_code sceNpMatching2GetRoomPasswordLocal(SceNpMatching2ContextId ctxId, Sce } else { - if (withPassword) *withPassword = false; + if (withPassword) + *withPassword = false; } return CELL_OK; } error_code sceNpMatching2GetRoomDataExternalList( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2GetRoomDataExternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1612,7 +1616,7 @@ error_code sceNpMatching2GetRoomDataExternalList( } error_code sceNpMatching2CreateJoinRoom( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.warning("sceNpMatching2CreateJoinRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1647,7 +1651,7 @@ error_code sceNpMatching2SignalingGetCtxOpt(SceNpMatching2ContextId ctxId, s32 o } error_code sceNpMatching2GetLobbyInfoList( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetLobbyInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1668,7 +1672,7 @@ error_code sceNpMatching2GetLobbyInfoList( } error_code sceNpMatching2GetLobbyMemberIdListLocal( - SceNpMatching2ContextId ctxId, SceNpMatching2LobbyId lobbyId, vm::ptr memberId, u32 memberIdNum, vm::ptr me) + SceNpMatching2ContextId ctxId, SceNpMatching2LobbyId lobbyId, vm::ptr memberId, u32 memberIdNum, vm::ptr me) { sceNp2.todo("sceNpMatching2GetLobbyMemberIdListLocal(ctxId=%d, lobbyId=%d, memberId=*0x%x, memberIdNum=%d, me=*0x%x)", ctxId, lobbyId, memberId, memberIdNum, me); @@ -1683,7 +1687,7 @@ error_code sceNpMatching2GetLobbyMemberIdListLocal( } error_code sceNpMatching2SendLobbyInvitation( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SendLobbyInvitation(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1714,21 +1718,21 @@ error_code sceNpMatching2ContextStop(SceNpMatching2ContextId ctxId) if (!ctx->started.compare_and_swap_test(1, 0)) return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED; - + if (ctx->context_callback) { sysutil_register_cb([=, context_callback = ctx->context_callback, context_callback_param = ctx->context_callback_param](ppu_thread& cb_ppu) -> s32 - { - context_callback(cb_ppu, ctxId, SCE_NP_MATCHING2_CONTEXT_EVENT_Stop, SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ACTION, 0, context_callback_param); - return 0; - }); + { + context_callback(cb_ppu, ctxId, SCE_NP_MATCHING2_CONTEXT_EVENT_Stop, SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ACTION, 0, context_callback_param); + return 0; + }); } return CELL_OK; } error_code sceNpMatching2SetLobbyMemberDataInternal( - SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SetLobbyMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); @@ -1752,7 +1756,7 @@ error_code sceNpMatching2RegisterRoomMessageCallback(SceNpMatching2ContextId ctx return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - nph.room_msg_cb = cbFunc; + nph.room_msg_cb = cbFunc; nph.room_msg_cb_ctx = ctxId; nph.room_msg_cb_arg = cbFuncArg; @@ -1789,7 +1793,7 @@ error_code sceNpMatching2SignalingGetLocalNetInfo(vm::ptrlocalAddr = nph.get_local_ip_addr(); + netinfo->localAddr = nph.get_local_ip_addr(); netinfo->mappedAddr = nph.get_public_ip_addr(); // Pure speculation below @@ -1927,86 +1931,87 @@ error_code sceNpAuthGetAuthorizationCode2() } DECLARE(ppu_module_manager::sceNp2) -("sceNp2", []() { - 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); - 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); - REG_FUNC(sceNp2, sceNpMatching2SignalingCancelPeerNetInfo); - REG_FUNC(sceNp2, sceNpMatching2SignalingGetLocalNetInfo); - REG_FUNC(sceNp2, sceNpMatching2SignalingGetPeerNetInfo); - REG_FUNC(sceNp2, sceNpMatching2SignalingGetPeerNetInfoResult); +("sceNp2", []() + { + 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); + 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); + REG_FUNC(sceNp2, sceNpMatching2SignalingCancelPeerNetInfo); + REG_FUNC(sceNp2, sceNpMatching2SignalingGetLocalNetInfo); + REG_FUNC(sceNp2, sceNpMatching2SignalingGetPeerNetInfo); + REG_FUNC(sceNp2, sceNpMatching2SignalingGetPeerNetInfoResult); - REG_FUNC(sceNp2, sceNpAuthOAuthInit); - REG_FUNC(sceNp2, sceNpAuthOAuthTerm); - REG_FUNC(sceNp2, sceNpAuthCreateOAuthRequest); - REG_FUNC(sceNp2, sceNpAuthDeleteOAuthRequest); - REG_FUNC(sceNp2, sceNpAuthAbortOAuthRequest); - REG_FUNC(sceNp2, sceNpAuthGetAuthorizationCode); - REG_FUNC(sceNp2, sceNpAuthGetAuthorizationCode2); -}); + REG_FUNC(sceNp2, sceNpAuthOAuthInit); + REG_FUNC(sceNp2, sceNpAuthOAuthTerm); + REG_FUNC(sceNp2, sceNpAuthCreateOAuthRequest); + REG_FUNC(sceNp2, sceNpAuthDeleteOAuthRequest); + REG_FUNC(sceNp2, sceNpAuthAbortOAuthRequest); + REG_FUNC(sceNp2, sceNpAuthGetAuthorizationCode); + REG_FUNC(sceNp2, sceNpAuthGetAuthorizationCode2); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sceNp2.h b/rpcs3/rpcs3/Emu/Cell/Modules/sceNp2.h index 9c83eab60..b513d9000 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sceNp2.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sceNp2.h @@ -8,118 +8,118 @@ enum SceNpMatching2Error : u32 { // NP Matching 2 Utility - SCE_NP_MATCHING2_ERROR_OUT_OF_MEMORY = 0x80022301, - SCE_NP_MATCHING2_ERROR_ALREADY_INITIALIZED = 0x80022302, - SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED = 0x80022303, - SCE_NP_MATCHING2_ERROR_CONTEXT_MAX = 0x80022304, - SCE_NP_MATCHING2_ERROR_CONTEXT_ALREADY_EXISTS = 0x80022305, - SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND = 0x80022306, - SCE_NP_MATCHING2_ERROR_CONTEXT_ALREADY_STARTED = 0x80022307, - SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED = 0x80022308, - SCE_NP_MATCHING2_ERROR_SERVER_NOT_FOUND = 0x80022309, - SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT = 0x8002230a, - SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID = 0x8002230b, - SCE_NP_MATCHING2_ERROR_INVALID_SERVER_ID = 0x8002230c, - SCE_NP_MATCHING2_ERROR_INVALID_WORLD_ID = 0x8002230d, - SCE_NP_MATCHING2_ERROR_INVALID_LOBBY_ID = 0x8002230e, - SCE_NP_MATCHING2_ERROR_INVALID_ROOM_ID = 0x8002230f, - SCE_NP_MATCHING2_ERROR_INVALID_MEMBER_ID = 0x80022310, - SCE_NP_MATCHING2_ERROR_INVALID_ATTRIBUTE_ID = 0x80022311, - SCE_NP_MATCHING2_ERROR_INVALID_CASTTYPE = 0x80022312, - SCE_NP_MATCHING2_ERROR_INVALID_SORT_METHOD = 0x80022313, - SCE_NP_MATCHING2_ERROR_INVALID_MAX_SLOT = 0x80022314, - SCE_NP_MATCHING2_ERROR_INVALID_MATCHING_SPACE = 0x80022316, - SCE_NP_MATCHING2_ERROR_INVALID_BLOCK_KICK_FLAG = 0x80022318, - SCE_NP_MATCHING2_ERROR_INVALID_MESSAGE_TARGET = 0x80022319, - SCE_NP_MATCHING2_ERROR_RANGE_FILTER_MAX = 0x8002231a, - SCE_NP_MATCHING2_ERROR_INSUFFICIENT_BUFFER = 0x8002231b, - SCE_NP_MATCHING2_ERROR_DESTINATION_DISAPPEARED = 0x8002231c, - SCE_NP_MATCHING2_ERROR_REQUEST_TIMEOUT = 0x8002231d, - SCE_NP_MATCHING2_ERROR_INVALID_ALIGNMENT = 0x8002231e, - SCE_NP_MATCHING2_ERROR_REQUEST_CB_QUEUE_OVERFLOW = 0x8002231f, - SCE_NP_MATCHING2_ERROR_EVENT_CB_QUEUE_OVERFLOW = 0x80022320, - SCE_NP_MATCHING2_ERROR_MSG_CB_QUEUE_OVERFLOW = 0x80022321, + SCE_NP_MATCHING2_ERROR_OUT_OF_MEMORY = 0x80022301, + SCE_NP_MATCHING2_ERROR_ALREADY_INITIALIZED = 0x80022302, + SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED = 0x80022303, + SCE_NP_MATCHING2_ERROR_CONTEXT_MAX = 0x80022304, + SCE_NP_MATCHING2_ERROR_CONTEXT_ALREADY_EXISTS = 0x80022305, + SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND = 0x80022306, + SCE_NP_MATCHING2_ERROR_CONTEXT_ALREADY_STARTED = 0x80022307, + SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED = 0x80022308, + SCE_NP_MATCHING2_ERROR_SERVER_NOT_FOUND = 0x80022309, + SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT = 0x8002230a, + SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID = 0x8002230b, + SCE_NP_MATCHING2_ERROR_INVALID_SERVER_ID = 0x8002230c, + SCE_NP_MATCHING2_ERROR_INVALID_WORLD_ID = 0x8002230d, + SCE_NP_MATCHING2_ERROR_INVALID_LOBBY_ID = 0x8002230e, + SCE_NP_MATCHING2_ERROR_INVALID_ROOM_ID = 0x8002230f, + SCE_NP_MATCHING2_ERROR_INVALID_MEMBER_ID = 0x80022310, + SCE_NP_MATCHING2_ERROR_INVALID_ATTRIBUTE_ID = 0x80022311, + SCE_NP_MATCHING2_ERROR_INVALID_CASTTYPE = 0x80022312, + SCE_NP_MATCHING2_ERROR_INVALID_SORT_METHOD = 0x80022313, + SCE_NP_MATCHING2_ERROR_INVALID_MAX_SLOT = 0x80022314, + SCE_NP_MATCHING2_ERROR_INVALID_MATCHING_SPACE = 0x80022316, + SCE_NP_MATCHING2_ERROR_INVALID_BLOCK_KICK_FLAG = 0x80022318, + SCE_NP_MATCHING2_ERROR_INVALID_MESSAGE_TARGET = 0x80022319, + SCE_NP_MATCHING2_ERROR_RANGE_FILTER_MAX = 0x8002231a, + SCE_NP_MATCHING2_ERROR_INSUFFICIENT_BUFFER = 0x8002231b, + SCE_NP_MATCHING2_ERROR_DESTINATION_DISAPPEARED = 0x8002231c, + SCE_NP_MATCHING2_ERROR_REQUEST_TIMEOUT = 0x8002231d, + SCE_NP_MATCHING2_ERROR_INVALID_ALIGNMENT = 0x8002231e, + SCE_NP_MATCHING2_ERROR_REQUEST_CB_QUEUE_OVERFLOW = 0x8002231f, + SCE_NP_MATCHING2_ERROR_EVENT_CB_QUEUE_OVERFLOW = 0x80022320, + SCE_NP_MATCHING2_ERROR_MSG_CB_QUEUE_OVERFLOW = 0x80022321, SCE_NP_MATCHING2_ERROR_CONNECTION_CLOSED_BY_SERVER = 0x80022322, - SCE_NP_MATCHING2_ERROR_SSL_VERIFY_FAILED = 0x80022323, - SCE_NP_MATCHING2_ERROR_SSL_HANDSHAKE = 0x80022324, - SCE_NP_MATCHING2_ERROR_SSL_SEND = 0x80022325, - SCE_NP_MATCHING2_ERROR_SSL_RECV = 0x80022326, - SCE_NP_MATCHING2_ERROR_JOINED_SESSION_MAX = 0x80022327, - SCE_NP_MATCHING2_ERROR_ALREADY_JOINED = 0x80022328, - SCE_NP_MATCHING2_ERROR_INVALID_SESSION_TYPE = 0x80022329, - SCE_NP_MATCHING2_ERROR_CLAN_LOBBY_NOT_EXIST = 0x8002232a, - SCE_NP_MATCHING2_ERROR_NP_SIGNED_OUT = 0x8002232b, - SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE = 0x8002232c, - SCE_NP_MATCHING2_ERROR_SERVER_NOT_AVAILABLE = 0x8002232d, - SCE_NP_MATCHING2_ERROR_NOT_ALLOWED = 0x8002232e, - SCE_NP_MATCHING2_ERROR_ABORTED = 0x8002232f, - SCE_NP_MATCHING2_ERROR_REQUEST_NOT_FOUND = 0x80022330, - SCE_NP_MATCHING2_ERROR_SESSION_DESTROYED = 0x80022331, - SCE_NP_MATCHING2_ERROR_CONTEXT_STOPPED = 0x80022332, - SCE_NP_MATCHING2_ERROR_INVALID_REQUEST_PARAMETER = 0x80022333, - SCE_NP_MATCHING2_ERROR_NOT_NP_SIGN_IN = 0x80022334, - SCE_NP_MATCHING2_ERROR_ROOM_NOT_FOUND = 0x80022335, - SCE_NP_MATCHING2_ERROR_ROOM_MEMBER_NOT_FOUND = 0x80022336, - SCE_NP_MATCHING2_ERROR_LOBBY_NOT_FOUND = 0x80022337, - SCE_NP_MATCHING2_ERROR_LOBBY_MEMBER_NOT_FOUND = 0x80022338, - SCE_NP_MATCHING2_ERROR_EVENT_DATA_NOT_FOUND = 0x80022339, - SCE_NP_MATCHING2_ERROR_KEEPALIVE_TIMEOUT = 0x8002233a, - SCE_NP_MATCHING2_ERROR_TIMEOUT_TOO_SHORT = 0x8002233b, - SCE_NP_MATCHING2_ERROR_TIMEDOUT = 0x8002233c, - SCE_NP_MATCHING2_ERROR_CREATE_HEAP = 0x8002233d, - SCE_NP_MATCHING2_ERROR_INVALID_ATTRIBUTE_SIZE = 0x8002233e, - SCE_NP_MATCHING2_ERROR_CANNOT_ABORT = 0x8002233f, + SCE_NP_MATCHING2_ERROR_SSL_VERIFY_FAILED = 0x80022323, + SCE_NP_MATCHING2_ERROR_SSL_HANDSHAKE = 0x80022324, + SCE_NP_MATCHING2_ERROR_SSL_SEND = 0x80022325, + SCE_NP_MATCHING2_ERROR_SSL_RECV = 0x80022326, + SCE_NP_MATCHING2_ERROR_JOINED_SESSION_MAX = 0x80022327, + SCE_NP_MATCHING2_ERROR_ALREADY_JOINED = 0x80022328, + SCE_NP_MATCHING2_ERROR_INVALID_SESSION_TYPE = 0x80022329, + SCE_NP_MATCHING2_ERROR_CLAN_LOBBY_NOT_EXIST = 0x8002232a, + SCE_NP_MATCHING2_ERROR_NP_SIGNED_OUT = 0x8002232b, + SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE = 0x8002232c, + SCE_NP_MATCHING2_ERROR_SERVER_NOT_AVAILABLE = 0x8002232d, + SCE_NP_MATCHING2_ERROR_NOT_ALLOWED = 0x8002232e, + SCE_NP_MATCHING2_ERROR_ABORTED = 0x8002232f, + SCE_NP_MATCHING2_ERROR_REQUEST_NOT_FOUND = 0x80022330, + SCE_NP_MATCHING2_ERROR_SESSION_DESTROYED = 0x80022331, + SCE_NP_MATCHING2_ERROR_CONTEXT_STOPPED = 0x80022332, + SCE_NP_MATCHING2_ERROR_INVALID_REQUEST_PARAMETER = 0x80022333, + SCE_NP_MATCHING2_ERROR_NOT_NP_SIGN_IN = 0x80022334, + SCE_NP_MATCHING2_ERROR_ROOM_NOT_FOUND = 0x80022335, + SCE_NP_MATCHING2_ERROR_ROOM_MEMBER_NOT_FOUND = 0x80022336, + SCE_NP_MATCHING2_ERROR_LOBBY_NOT_FOUND = 0x80022337, + SCE_NP_MATCHING2_ERROR_LOBBY_MEMBER_NOT_FOUND = 0x80022338, + SCE_NP_MATCHING2_ERROR_EVENT_DATA_NOT_FOUND = 0x80022339, + SCE_NP_MATCHING2_ERROR_KEEPALIVE_TIMEOUT = 0x8002233a, + SCE_NP_MATCHING2_ERROR_TIMEOUT_TOO_SHORT = 0x8002233b, + SCE_NP_MATCHING2_ERROR_TIMEDOUT = 0x8002233c, + SCE_NP_MATCHING2_ERROR_CREATE_HEAP = 0x8002233d, + SCE_NP_MATCHING2_ERROR_INVALID_ATTRIBUTE_SIZE = 0x8002233e, + SCE_NP_MATCHING2_ERROR_CANNOT_ABORT = 0x8002233f, - SCE_NP_MATCHING2_RESOLVER_ERROR_NO_DNS_SERVER = 0x800223a2, - SCE_NP_MATCHING2_RESOLVER_ERROR_INVALID_PACKET = 0x800223ad, - SCE_NP_MATCHING2_RESOLVER_ERROR_TIMEOUT = 0x800223b0, - SCE_NP_MATCHING2_RESOLVER_ERROR_NO_RECORD = 0x800223b1, - SCE_NP_MATCHING2_RESOLVER_ERROR_RES_PACKET_FORMAT = 0x800223b2, - SCE_NP_MATCHING2_RESOLVER_ERROR_RES_SERVER_FAILURE = 0x800223b3, - SCE_NP_MATCHING2_RESOLVER_ERROR_NO_HOST = 0x800223b4, + SCE_NP_MATCHING2_RESOLVER_ERROR_NO_DNS_SERVER = 0x800223a2, + SCE_NP_MATCHING2_RESOLVER_ERROR_INVALID_PACKET = 0x800223ad, + SCE_NP_MATCHING2_RESOLVER_ERROR_TIMEOUT = 0x800223b0, + SCE_NP_MATCHING2_RESOLVER_ERROR_NO_RECORD = 0x800223b1, + SCE_NP_MATCHING2_RESOLVER_ERROR_RES_PACKET_FORMAT = 0x800223b2, + SCE_NP_MATCHING2_RESOLVER_ERROR_RES_SERVER_FAILURE = 0x800223b3, + SCE_NP_MATCHING2_RESOLVER_ERROR_NO_HOST = 0x800223b4, SCE_NP_MATCHING2_RESOLVER_ERROR_RES_NOT_IMPLEMENTED = 0x800223b5, - SCE_NP_MATCHING2_RESOLVER_ERROR_RES_SERVER_REFUSED = 0x800223b6, - SCE_NP_MATCHING2_RESOLVER_ERROR_RESP_TRUNCATED = 0x800223bc, + SCE_NP_MATCHING2_RESOLVER_ERROR_RES_SERVER_REFUSED = 0x800223b6, + SCE_NP_MATCHING2_RESOLVER_ERROR_RESP_TRUNCATED = 0x800223bc, - SCE_NP_MATCHING2_SERVER_ERROR_BAD_REQUEST = 0x80022b01, - SCE_NP_MATCHING2_SERVER_ERROR_SERVICE_UNAVAILABLE = 0x80022b02, - SCE_NP_MATCHING2_SERVER_ERROR_BUSY = 0x80022b03, - SCE_NP_MATCHING2_SERVER_ERROR_END_OF_SERVICE = 0x80022b04, - SCE_NP_MATCHING2_SERVER_ERROR_INTERNAL_SERVER_ERROR = 0x80022b05, - SCE_NP_MATCHING2_SERVER_ERROR_PLAYER_BANNED = 0x80022b06, - SCE_NP_MATCHING2_SERVER_ERROR_FORBIDDEN = 0x80022b07, - SCE_NP_MATCHING2_SERVER_ERROR_BLOCKED = 0x80022b08, - SCE_NP_MATCHING2_SERVER_ERROR_UNSUPPORTED_NP_ENV = 0x80022b09, - SCE_NP_MATCHING2_SERVER_ERROR_INVALID_TICKET = 0x80022b0a, - SCE_NP_MATCHING2_SERVER_ERROR_INVALID_SIGNATURE = 0x80022b0b, - SCE_NP_MATCHING2_SERVER_ERROR_EXPIRED_TICKET = 0x80022b0c, - SCE_NP_MATCHING2_SERVER_ERROR_ENTITLEMENT_REQUIRED = 0x80022b0d, - SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_CONTEXT = 0x80022b0e, - SCE_NP_MATCHING2_SERVER_ERROR_CLOSED = 0x80022b0f, - SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_TITLE = 0x80022b10, - SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_WORLD = 0x80022b11, - SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_LOBBY = 0x80022b12, - SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_ROOM = 0x80022b13, - SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_LOBBY_INSTANCE = 0x80022b14, - SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_ROOM_INSTANCE = 0x80022b15, - SCE_NP_MATCHING2_SERVER_ERROR_PASSWORD_MISMATCH = 0x80022b17, - SCE_NP_MATCHING2_SERVER_ERROR_LOBBY_FULL = 0x80022b18, - SCE_NP_MATCHING2_SERVER_ERROR_ROOM_FULL = 0x80022b19, - SCE_NP_MATCHING2_SERVER_ERROR_GROUP_FULL = 0x80022b1b, - SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_USER = 0x80022b1c, + SCE_NP_MATCHING2_SERVER_ERROR_BAD_REQUEST = 0x80022b01, + SCE_NP_MATCHING2_SERVER_ERROR_SERVICE_UNAVAILABLE = 0x80022b02, + SCE_NP_MATCHING2_SERVER_ERROR_BUSY = 0x80022b03, + SCE_NP_MATCHING2_SERVER_ERROR_END_OF_SERVICE = 0x80022b04, + SCE_NP_MATCHING2_SERVER_ERROR_INTERNAL_SERVER_ERROR = 0x80022b05, + SCE_NP_MATCHING2_SERVER_ERROR_PLAYER_BANNED = 0x80022b06, + SCE_NP_MATCHING2_SERVER_ERROR_FORBIDDEN = 0x80022b07, + SCE_NP_MATCHING2_SERVER_ERROR_BLOCKED = 0x80022b08, + SCE_NP_MATCHING2_SERVER_ERROR_UNSUPPORTED_NP_ENV = 0x80022b09, + SCE_NP_MATCHING2_SERVER_ERROR_INVALID_TICKET = 0x80022b0a, + SCE_NP_MATCHING2_SERVER_ERROR_INVALID_SIGNATURE = 0x80022b0b, + SCE_NP_MATCHING2_SERVER_ERROR_EXPIRED_TICKET = 0x80022b0c, + SCE_NP_MATCHING2_SERVER_ERROR_ENTITLEMENT_REQUIRED = 0x80022b0d, + SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_CONTEXT = 0x80022b0e, + SCE_NP_MATCHING2_SERVER_ERROR_CLOSED = 0x80022b0f, + SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_TITLE = 0x80022b10, + SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_WORLD = 0x80022b11, + SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_LOBBY = 0x80022b12, + SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_ROOM = 0x80022b13, + SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_LOBBY_INSTANCE = 0x80022b14, + SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_ROOM_INSTANCE = 0x80022b15, + SCE_NP_MATCHING2_SERVER_ERROR_PASSWORD_MISMATCH = 0x80022b17, + SCE_NP_MATCHING2_SERVER_ERROR_LOBBY_FULL = 0x80022b18, + SCE_NP_MATCHING2_SERVER_ERROR_ROOM_FULL = 0x80022b19, + SCE_NP_MATCHING2_SERVER_ERROR_GROUP_FULL = 0x80022b1b, + SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_USER = 0x80022b1c, SCE_NP_MATCHING2_SERVER_ERROR_TITLE_PASSPHRASE_MISMATCH = 0x80022b1e, - SCE_NP_MATCHING2_SERVER_ERROR_DUPLICATE_LOBBY = 0x80022b25, - SCE_NP_MATCHING2_SERVER_ERROR_DUPLICATE_ROOM = 0x80022b26, - SCE_NP_MATCHING2_SERVER_ERROR_NO_JOIN_GROUP_LABEL = 0x80022b29, - SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_GROUP = 0x80022b2a, - SCE_NP_MATCHING2_SERVER_ERROR_NO_PASSWORD = 0x80022b2b, - SCE_NP_MATCHING2_SERVER_ERROR_MAX_OVER_SLOT_GROUP = 0x80022b2c, - SCE_NP_MATCHING2_SERVER_ERROR_MAX_OVER_PASSWORD_MASK = 0x80022b2d, - SCE_NP_MATCHING2_SERVER_ERROR_DUPLICATE_GROUP_LABEL = 0x80022b2e, - SCE_NP_MATCHING2_SERVER_ERROR_REQUEST_OVERFLOW = 0x80022b2f, - SCE_NP_MATCHING2_SERVER_ERROR_ALREADY_JOINED = 0x80022b30, - SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH = 0x80022b31, - SCE_NP_MATCHING2_SERVER_ERROR_ROOM_INCONSISTENCY = 0x80022b32, + SCE_NP_MATCHING2_SERVER_ERROR_DUPLICATE_LOBBY = 0x80022b25, + SCE_NP_MATCHING2_SERVER_ERROR_DUPLICATE_ROOM = 0x80022b26, + SCE_NP_MATCHING2_SERVER_ERROR_NO_JOIN_GROUP_LABEL = 0x80022b29, + SCE_NP_MATCHING2_SERVER_ERROR_NO_SUCH_GROUP = 0x80022b2a, + SCE_NP_MATCHING2_SERVER_ERROR_NO_PASSWORD = 0x80022b2b, + SCE_NP_MATCHING2_SERVER_ERROR_MAX_OVER_SLOT_GROUP = 0x80022b2c, + SCE_NP_MATCHING2_SERVER_ERROR_MAX_OVER_PASSWORD_MASK = 0x80022b2d, + SCE_NP_MATCHING2_SERVER_ERROR_DUPLICATE_GROUP_LABEL = 0x80022b2e, + SCE_NP_MATCHING2_SERVER_ERROR_REQUEST_OVERFLOW = 0x80022b2f, + SCE_NP_MATCHING2_SERVER_ERROR_ALREADY_JOINED = 0x80022b30, + SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH = 0x80022b31, + SCE_NP_MATCHING2_SERVER_ERROR_ROOM_INCONSISTENCY = 0x80022b32, // SCE_NP_MATCHING2_NET_ERRNO_BASE = 0x800224XX, // SCE_NP_MATCHING2_NET_H_ERRNO_BASE = 0x800225XX, }; @@ -127,76 +127,76 @@ enum SceNpMatching2Error : u32 // Constants for matching functions and structures enum { - SCE_NP_MATCHING2_ALLOWED_USER_MAX = 100, - SCE_NP_MATCHING2_BLOCKED_USER_MAX = 100, - SCE_NP_MATCHING2_CHAT_MSG_MAX_SIZE = 1024, - SCE_NP_MATCHING2_BIN_MSG_MAX_SIZE = 1024, - SCE_NP_MATCHING2_GROUP_LABEL_SIZE = 8, - SCE_NP_MATCHING2_INVITATION_OPTION_DATA_MAX_SIZE = 32, - SCE_NP_MATCHING2_INVITATION_TARGET_SESSION_MAX = 2, - SCE_NP_MATCHING2_LOBBY_MEMBER_DATA_INTERNAL_LIST_MAX = 256, - SCE_NP_MATCHING2_LOBBY_MEMBER_DATA_INTERNAL_EXTENDED_DATA_LIST_MAX = 64, - SCE_NP_MATCHING2_LOBBY_BIN_ATTR_INTERNAL_NUM = 2, - SCE_NP_MATCHING2_LOBBYMEMBER_BIN_ATTR_INTERNAL_NUM = 1, - SCE_NP_MATCHING2_LOBBYMEMBER_BIN_ATTR_INTERNAL_MAX_SIZE = 64, - SCE_NP_MATCHING2_LOBBY_MAX_SLOT = 256, - SCE_NP_MATCHING2_PRESENCE_OPTION_DATA_SIZE = 16, - SCE_NP_MATCHING2_RANGE_FILTER_START_INDEX_MIN = 1, - SCE_NP_MATCHING2_RANGE_FILTER_MAX = 20, - SCE_NP_MATCHING2_ROOM_MAX_SLOT = 64, - SCE_NP_MATCHING2_ROOM_GROUP_ID_MAX = 15, - SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_NUM = 2, - SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_MAX_SIZE = 256, - SCE_NP_MATCHING2_ROOM_BIN_ATTR_INTERNAL_NUM = 2, - SCE_NP_MATCHING2_ROOM_BIN_ATTR_INTERNAL_MAX_SIZE = 256, - SCE_NP_MATCHING2_ROOM_SEARCHABLE_INT_ATTR_EXTERNAL_NUM = 8, - SCE_NP_MATCHING2_ROOM_SEARCHABLE_BIN_ATTR_EXTERNAL_NUM = 1, - SCE_NP_MATCHING2_ROOM_SEARCHABLE_BIN_ATTR_EXTERNAL_MAX_SIZE = 64, - SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_NUM = 1, - SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_MAX_SIZE = 64, - SCE_NP_MATCHING2_SESSION_PASSWORD_SIZE = 8, - SCE_NP_MATCHING2_USER_BIN_ATTR_NUM = 1, - SCE_NP_MATCHING2_USER_BIN_ATTR_MAX_SIZE = 128, - SCE_NP_MATCHING2_GET_USER_INFO_LIST_NPID_NUM_MAX = 25, - SCE_NP_MATCHING2_GET_ROOM_DATA_EXTERNAL_LIST_ROOM_NUM_MAX = 20, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetServerInfo = 4, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetWorldInfoList = 3848, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetRoomMemberDataExternalList = 15624, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetRoomDataExternalList = 25768, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetLobbyInfoList = 1296, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetUserInfoList = 17604, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_CreateJoinRoom = 25224, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_JoinRoom = 25224, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_SearchRoom = 25776, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_SendRoomChatMessage = 1, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetRoomDataInternal = 25224, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetRoomMemberDataInternal = 372, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_JoinLobby = 1124, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_SendLobbyChatMessage = 1, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetLobbyMemberDataInternal = 672, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetLobbyMemberDataInternalList = 42760, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_SignalingGetPingInfo = 40, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMemberUpdateInfo = 396, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomUpdateInfo = 28, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomOwnerUpdateInfo = 40, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomDataInternalUpdateInfo = 26208, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMemberDataInternalUpdateInfo = 493, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_SignalingOptParamUpdateInfo = 8, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMessageInfo = 1407, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_LobbyMemberUpdateInfo = 696, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_LobbyUpdateInfo = 8, + SCE_NP_MATCHING2_ALLOWED_USER_MAX = 100, + SCE_NP_MATCHING2_BLOCKED_USER_MAX = 100, + SCE_NP_MATCHING2_CHAT_MSG_MAX_SIZE = 1024, + SCE_NP_MATCHING2_BIN_MSG_MAX_SIZE = 1024, + SCE_NP_MATCHING2_GROUP_LABEL_SIZE = 8, + SCE_NP_MATCHING2_INVITATION_OPTION_DATA_MAX_SIZE = 32, + SCE_NP_MATCHING2_INVITATION_TARGET_SESSION_MAX = 2, + SCE_NP_MATCHING2_LOBBY_MEMBER_DATA_INTERNAL_LIST_MAX = 256, + SCE_NP_MATCHING2_LOBBY_MEMBER_DATA_INTERNAL_EXTENDED_DATA_LIST_MAX = 64, + SCE_NP_MATCHING2_LOBBY_BIN_ATTR_INTERNAL_NUM = 2, + SCE_NP_MATCHING2_LOBBYMEMBER_BIN_ATTR_INTERNAL_NUM = 1, + SCE_NP_MATCHING2_LOBBYMEMBER_BIN_ATTR_INTERNAL_MAX_SIZE = 64, + SCE_NP_MATCHING2_LOBBY_MAX_SLOT = 256, + SCE_NP_MATCHING2_PRESENCE_OPTION_DATA_SIZE = 16, + SCE_NP_MATCHING2_RANGE_FILTER_START_INDEX_MIN = 1, + SCE_NP_MATCHING2_RANGE_FILTER_MAX = 20, + SCE_NP_MATCHING2_ROOM_MAX_SLOT = 64, + SCE_NP_MATCHING2_ROOM_GROUP_ID_MAX = 15, + SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_NUM = 2, + SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_MAX_SIZE = 256, + SCE_NP_MATCHING2_ROOM_BIN_ATTR_INTERNAL_NUM = 2, + SCE_NP_MATCHING2_ROOM_BIN_ATTR_INTERNAL_MAX_SIZE = 256, + SCE_NP_MATCHING2_ROOM_SEARCHABLE_INT_ATTR_EXTERNAL_NUM = 8, + SCE_NP_MATCHING2_ROOM_SEARCHABLE_BIN_ATTR_EXTERNAL_NUM = 1, + SCE_NP_MATCHING2_ROOM_SEARCHABLE_BIN_ATTR_EXTERNAL_MAX_SIZE = 64, + SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_NUM = 1, + SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_MAX_SIZE = 64, + SCE_NP_MATCHING2_SESSION_PASSWORD_SIZE = 8, + SCE_NP_MATCHING2_USER_BIN_ATTR_NUM = 1, + SCE_NP_MATCHING2_USER_BIN_ATTR_MAX_SIZE = 128, + SCE_NP_MATCHING2_GET_USER_INFO_LIST_NPID_NUM_MAX = 25, + SCE_NP_MATCHING2_GET_ROOM_DATA_EXTERNAL_LIST_ROOM_NUM_MAX = 20, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetServerInfo = 4, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetWorldInfoList = 3848, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetRoomMemberDataExternalList = 15624, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetRoomDataExternalList = 25768, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetLobbyInfoList = 1296, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetUserInfoList = 17604, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_CreateJoinRoom = 25224, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_JoinRoom = 25224, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_SearchRoom = 25776, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_SendRoomChatMessage = 1, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetRoomDataInternal = 25224, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetRoomMemberDataInternal = 372, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_JoinLobby = 1124, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_SendLobbyChatMessage = 1, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetLobbyMemberDataInternal = 672, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_GetLobbyMemberDataInternalList = 42760, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_SignalingGetPingInfo = 40, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMemberUpdateInfo = 396, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomUpdateInfo = 28, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomOwnerUpdateInfo = 40, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomDataInternalUpdateInfo = 26208, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMemberDataInternalUpdateInfo = 493, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_SignalingOptParamUpdateInfo = 8, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMessageInfo = 1407, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_LobbyMemberUpdateInfo = 696, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_LobbyUpdateInfo = 8, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_LobbyMemberDataInternalUpdateInfo = 472, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_LobbyMessageInfo = 1790, - SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_LobbyInvitationInfo = 870, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_LobbyMessageInfo = 1790, + SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_LobbyInvitationInfo = 870, }; enum { - SCE_NP_MATCHING2_MAX_SIZE_RoomDataExternal = 1288, - SCE_NP_MATCHING2_MAX_SIZE_RoomMemberDataInternal = 368, - SCE_NP_MATCHING2_MAX_SIZE_LobbyMemberDataInternal = 668, + SCE_NP_MATCHING2_MAX_SIZE_RoomDataExternal = 1288, + SCE_NP_MATCHING2_MAX_SIZE_RoomMemberDataInternal = 368, + SCE_NP_MATCHING2_MAX_SIZE_LobbyMemberDataInternal = 668, SCE_NP_MATCHING2_MAX_SIZE_LobbyMemberDataInternal_NoExtendedData = 80, - SCE_NP_MATCHING2_MAX_SIZE_UserInfo = 704, + SCE_NP_MATCHING2_MAX_SIZE_UserInfo = 704, }; enum @@ -218,9 +218,9 @@ enum // Message cast type enum { - SCE_NP_MATCHING2_CASTTYPE_BROADCAST = 1, - SCE_NP_MATCHING2_CASTTYPE_UNICAST = 2, - SCE_NP_MATCHING2_CASTTYPE_MULTICAST = 3, + SCE_NP_MATCHING2_CASTTYPE_BROADCAST = 1, + SCE_NP_MATCHING2_CASTTYPE_UNICAST = 2, + SCE_NP_MATCHING2_CASTTYPE_MULTICAST = 3, SCE_NP_MATCHING2_CASTTYPE_MULTICAST_TEAM = 4, }; @@ -228,7 +228,7 @@ enum enum { SCE_NP_MATCHING2_SESSION_TYPE_LOBBY = 1, - SCE_NP_MATCHING2_SESSION_TYPE_ROOM = 2, + SCE_NP_MATCHING2_SESSION_TYPE_ROOM = 2, }; // Signaling type @@ -247,25 +247,25 @@ enum // Event cause enum { - SCE_NP_MATCHING2_EVENT_CAUSE_LEAVE_ACTION = 1, - SCE_NP_MATCHING2_EVENT_CAUSE_KICKOUT_ACTION = 2, + SCE_NP_MATCHING2_EVENT_CAUSE_LEAVE_ACTION = 1, + SCE_NP_MATCHING2_EVENT_CAUSE_KICKOUT_ACTION = 2, SCE_NP_MATCHING2_EVENT_CAUSE_GRANT_OWNER_ACTION = 3, - SCE_NP_MATCHING2_EVENT_CAUSE_SERVER_OPERATION = 4, + SCE_NP_MATCHING2_EVENT_CAUSE_SERVER_OPERATION = 4, SCE_NP_MATCHING2_EVENT_CAUSE_MEMBER_DISAPPEARED = 5, - SCE_NP_MATCHING2_EVENT_CAUSE_SERVER_INTERNAL = 6, - SCE_NP_MATCHING2_EVENT_CAUSE_CONNECTION_ERROR = 7, - SCE_NP_MATCHING2_EVENT_CAUSE_NP_SIGNED_OUT = 8, - SCE_NP_MATCHING2_EVENT_CAUSE_SYSTEM_ERROR = 9, - SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ERROR = 10, - SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ACTION = 11, + SCE_NP_MATCHING2_EVENT_CAUSE_SERVER_INTERNAL = 6, + SCE_NP_MATCHING2_EVENT_CAUSE_CONNECTION_ERROR = 7, + SCE_NP_MATCHING2_EVENT_CAUSE_NP_SIGNED_OUT = 8, + SCE_NP_MATCHING2_EVENT_CAUSE_SYSTEM_ERROR = 9, + SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ERROR = 10, + SCE_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ACTION = 11, }; // Server status enum { - SCE_NP_MATCHING2_SERVER_STATUS_AVAILABLE = 1, + SCE_NP_MATCHING2_SERVER_STATUS_AVAILABLE = 1, SCE_NP_MATCHING2_SERVER_STATUS_UNAVAILABLE = 2, - SCE_NP_MATCHING2_SERVER_STATUS_BUSY = 3, + SCE_NP_MATCHING2_SERVER_STATUS_BUSY = 3, SCE_NP_MATCHING2_SERVER_STATUS_MAINTENANCE = 4, }; @@ -273,7 +273,7 @@ enum enum { SCE_NP_MATCHING2_ROLE_MEMBER = 1, - SCE_NP_MATCHING2_ROLE_OWNER = 2, + SCE_NP_MATCHING2_ROLE_OWNER = 2, }; // Status of kicked-out member with regards to rejoining @@ -286,7 +286,7 @@ enum // Sort method enum { - SCE_NP_MATCHING2_SORT_METHOD_JOIN_DATE = 0, + SCE_NP_MATCHING2_SORT_METHOD_JOIN_DATE = 0, SCE_NP_MATCHING2_SORT_METHOD_SLOT_NUMBER = 1, }; @@ -294,32 +294,32 @@ enum enum { SCE_NP_MATCHING2_CONTEXT_OPTION_USE_ONLINENAME = 0x01, - SCE_NP_MATCHING2_CONTEXT_OPTION_USE_AVATARURL = 0x02, + SCE_NP_MATCHING2_CONTEXT_OPTION_USE_AVATARURL = 0x02, }; // User information acquisition option enum { SCE_NP_MATCHING2_GET_USER_INFO_LIST_OPTION_WITH_ONLINENAME = 0x01, - SCE_NP_MATCHING2_GET_USER_INFO_LIST_OPTION_WITH_AVATARURL = 0x02, + SCE_NP_MATCHING2_GET_USER_INFO_LIST_OPTION_WITH_AVATARURL = 0x02, }; // Room search options enum { - SCE_NP_MATCHING2_SEARCH_ROOM_OPTION_WITH_NPID = 0x01, + SCE_NP_MATCHING2_SEARCH_ROOM_OPTION_WITH_NPID = 0x01, SCE_NP_MATCHING2_SEARCH_ROOM_OPTION_WITH_ONLINENAME = 0x02, - SCE_NP_MATCHING2_SEARCH_ROOM_OPTION_WITH_AVATARURL = 0x04, + SCE_NP_MATCHING2_SEARCH_ROOM_OPTION_WITH_AVATARURL = 0x04, SCE_NP_MATCHING2_SEARCH_ROOM_OPTION_NAT_TYPE_FILTER = 0x08, - SCE_NP_MATCHING2_SEARCH_ROOM_OPTION_RANDOM = 0x10, + SCE_NP_MATCHING2_SEARCH_ROOM_OPTION_RANDOM = 0x10, }; // Send options enum { - SCE_NP_MATCHING2_SEND_MSG_OPTION_WITH_NPID = 0x01, + SCE_NP_MATCHING2_SEND_MSG_OPTION_WITH_NPID = 0x01, SCE_NP_MATCHING2_SEND_MSG_OPTION_WITH_ONLINENAME = 0x02, - SCE_NP_MATCHING2_SEND_MSG_OPTION_WITH_AVATARURL = 0x04, + SCE_NP_MATCHING2_SEND_MSG_OPTION_WITH_AVATARURL = 0x04, }; enum @@ -331,8 +331,8 @@ enum // Flag-type lobby attribute enum { - SCE_NP_MATCHING2_LOBBY_FLAG_ATTR_PERMANENT = 0x80000000, - SCE_NP_MATCHING2_LOBBY_FLAG_ATTR_CLAN = 0x40000000, + SCE_NP_MATCHING2_LOBBY_FLAG_ATTR_PERMANENT = 0x80000000, + SCE_NP_MATCHING2_LOBBY_FLAG_ATTR_CLAN = 0x40000000, SCE_NP_MATCHING2_LOBBY_FLAG_ATTR_MEMBER_NOTIFICATION = 0x20000000, }; @@ -345,19 +345,19 @@ enum // Flag-type room attribute enum { - SCE_NP_MATCHING2_ROOM_FLAG_ATTR_OWNER_AUTO_GRANT = 0x80000000, - SCE_NP_MATCHING2_ROOM_FLAG_ATTR_CLOSED = 0x40000000, - SCE_NP_MATCHING2_ROOM_FLAG_ATTR_FULL = 0x20000000, - SCE_NP_MATCHING2_ROOM_FLAG_ATTR_HIDDEN = 0x10000000, + SCE_NP_MATCHING2_ROOM_FLAG_ATTR_OWNER_AUTO_GRANT = 0x80000000, + SCE_NP_MATCHING2_ROOM_FLAG_ATTR_CLOSED = 0x40000000, + SCE_NP_MATCHING2_ROOM_FLAG_ATTR_FULL = 0x20000000, + SCE_NP_MATCHING2_ROOM_FLAG_ATTR_HIDDEN = 0x10000000, SCE_NP_MATCHING2_ROOM_FLAG_ATTR_NAT_TYPE_RESTRICTION = 0x04000000, - SCE_NP_MATCHING2_ROOM_FLAG_ATTR_PROHIBITIVE_MODE = 0x02000000, + SCE_NP_MATCHING2_ROOM_FLAG_ATTR_PROHIBITIVE_MODE = 0x02000000, }; // Flah-type room member attribute enum { SCE_NP_MATCHING2_LOBBYMEMBER_FLAG_ATTR_OWNER = 0x80000000, - SCE_NP_MATCHING2_ROOMMEMBER_FLAG_ATTR_OWNER = 0x80000000, + SCE_NP_MATCHING2_ROOMMEMBER_FLAG_ATTR_OWNER = 0x80000000, }; // ID of external room search integer attribute @@ -415,65 +415,65 @@ enum // Event of request functions enum { - SCE_NP_MATCHING2_REQUEST_EVENT_GetServerInfo = 0x0001, - SCE_NP_MATCHING2_REQUEST_EVENT_GetWorldInfoList = 0x0002, - SCE_NP_MATCHING2_REQUEST_EVENT_GetRoomMemberDataExternalList = 0x0003, - SCE_NP_MATCHING2_REQUEST_EVENT_SetRoomDataExternal = 0x0004, - SCE_NP_MATCHING2_REQUEST_EVENT_GetRoomDataExternalList = 0x0005, - SCE_NP_MATCHING2_REQUEST_EVENT_GetLobbyInfoList = 0x0006, - SCE_NP_MATCHING2_REQUEST_EVENT_SetUserInfo = 0x0007, - SCE_NP_MATCHING2_REQUEST_EVENT_GetUserInfoList = 0x0008, - SCE_NP_MATCHING2_REQUEST_EVENT_CreateServerContext = 0x0009, - SCE_NP_MATCHING2_REQUEST_EVENT_DeleteServerContext = 0x000a, - SCE_NP_MATCHING2_REQUEST_EVENT_CreateJoinRoom = 0x0101, - SCE_NP_MATCHING2_REQUEST_EVENT_JoinRoom = 0x0102, - SCE_NP_MATCHING2_REQUEST_EVENT_LeaveRoom = 0x0103, - SCE_NP_MATCHING2_REQUEST_EVENT_GrantRoomOwner = 0x0104, - SCE_NP_MATCHING2_REQUEST_EVENT_KickoutRoomMember = 0x0105, - SCE_NP_MATCHING2_REQUEST_EVENT_SearchRoom = 0x0106, - SCE_NP_MATCHING2_REQUEST_EVENT_SendRoomChatMessage = 0x0107, - SCE_NP_MATCHING2_REQUEST_EVENT_SendRoomMessage = 0x0108, - SCE_NP_MATCHING2_REQUEST_EVENT_SetRoomDataInternal = 0x0109, - SCE_NP_MATCHING2_REQUEST_EVENT_GetRoomDataInternal = 0x010a, - SCE_NP_MATCHING2_REQUEST_EVENT_SetRoomMemberDataInternal = 0x010b, - SCE_NP_MATCHING2_REQUEST_EVENT_GetRoomMemberDataInternal = 0x010c, - SCE_NP_MATCHING2_REQUEST_EVENT_SetSignalingOptParam = 0x010d, - SCE_NP_MATCHING2_REQUEST_EVENT_JoinLobby = 0x0201, - SCE_NP_MATCHING2_REQUEST_EVENT_LeaveLobby = 0x0202, - SCE_NP_MATCHING2_REQUEST_EVENT_SendLobbyChatMessage = 0x0203, - SCE_NP_MATCHING2_REQUEST_EVENT_SendLobbyInvitation = 0x0204, - SCE_NP_MATCHING2_REQUEST_EVENT_SetLobbyMemberDataInternal = 0x0205, - SCE_NP_MATCHING2_REQUEST_EVENT_GetLobbyMemberDataInternal = 0x0206, + SCE_NP_MATCHING2_REQUEST_EVENT_GetServerInfo = 0x0001, + SCE_NP_MATCHING2_REQUEST_EVENT_GetWorldInfoList = 0x0002, + SCE_NP_MATCHING2_REQUEST_EVENT_GetRoomMemberDataExternalList = 0x0003, + SCE_NP_MATCHING2_REQUEST_EVENT_SetRoomDataExternal = 0x0004, + SCE_NP_MATCHING2_REQUEST_EVENT_GetRoomDataExternalList = 0x0005, + SCE_NP_MATCHING2_REQUEST_EVENT_GetLobbyInfoList = 0x0006, + SCE_NP_MATCHING2_REQUEST_EVENT_SetUserInfo = 0x0007, + SCE_NP_MATCHING2_REQUEST_EVENT_GetUserInfoList = 0x0008, + SCE_NP_MATCHING2_REQUEST_EVENT_CreateServerContext = 0x0009, + SCE_NP_MATCHING2_REQUEST_EVENT_DeleteServerContext = 0x000a, + SCE_NP_MATCHING2_REQUEST_EVENT_CreateJoinRoom = 0x0101, + SCE_NP_MATCHING2_REQUEST_EVENT_JoinRoom = 0x0102, + SCE_NP_MATCHING2_REQUEST_EVENT_LeaveRoom = 0x0103, + SCE_NP_MATCHING2_REQUEST_EVENT_GrantRoomOwner = 0x0104, + SCE_NP_MATCHING2_REQUEST_EVENT_KickoutRoomMember = 0x0105, + SCE_NP_MATCHING2_REQUEST_EVENT_SearchRoom = 0x0106, + SCE_NP_MATCHING2_REQUEST_EVENT_SendRoomChatMessage = 0x0107, + SCE_NP_MATCHING2_REQUEST_EVENT_SendRoomMessage = 0x0108, + SCE_NP_MATCHING2_REQUEST_EVENT_SetRoomDataInternal = 0x0109, + SCE_NP_MATCHING2_REQUEST_EVENT_GetRoomDataInternal = 0x010a, + SCE_NP_MATCHING2_REQUEST_EVENT_SetRoomMemberDataInternal = 0x010b, + SCE_NP_MATCHING2_REQUEST_EVENT_GetRoomMemberDataInternal = 0x010c, + SCE_NP_MATCHING2_REQUEST_EVENT_SetSignalingOptParam = 0x010d, + SCE_NP_MATCHING2_REQUEST_EVENT_JoinLobby = 0x0201, + SCE_NP_MATCHING2_REQUEST_EVENT_LeaveLobby = 0x0202, + SCE_NP_MATCHING2_REQUEST_EVENT_SendLobbyChatMessage = 0x0203, + SCE_NP_MATCHING2_REQUEST_EVENT_SendLobbyInvitation = 0x0204, + SCE_NP_MATCHING2_REQUEST_EVENT_SetLobbyMemberDataInternal = 0x0205, + SCE_NP_MATCHING2_REQUEST_EVENT_GetLobbyMemberDataInternal = 0x0206, SCE_NP_MATCHING2_REQUEST_EVENT_GetLobbyMemberDataInternalList = 0x0207, - SCE_NP_MATCHING2_REQUEST_EVENT_SignalingGetPingInfo = 0x0e01, + SCE_NP_MATCHING2_REQUEST_EVENT_SignalingGetPingInfo = 0x0e01, }; // Room event enum { - SCE_NP_MATCHING2_ROOM_EVENT_MemberJoined = 0x1101, - SCE_NP_MATCHING2_ROOM_EVENT_MemberLeft = 0x1102, - SCE_NP_MATCHING2_ROOM_EVENT_Kickedout = 0x1103, - SCE_NP_MATCHING2_ROOM_EVENT_RoomDestroyed = 0x1104, - SCE_NP_MATCHING2_ROOM_EVENT_RoomOwnerChanged = 0x1105, - SCE_NP_MATCHING2_ROOM_EVENT_UpdatedRoomDataInternal = 0x1106, + SCE_NP_MATCHING2_ROOM_EVENT_MemberJoined = 0x1101, + SCE_NP_MATCHING2_ROOM_EVENT_MemberLeft = 0x1102, + SCE_NP_MATCHING2_ROOM_EVENT_Kickedout = 0x1103, + SCE_NP_MATCHING2_ROOM_EVENT_RoomDestroyed = 0x1104, + SCE_NP_MATCHING2_ROOM_EVENT_RoomOwnerChanged = 0x1105, + SCE_NP_MATCHING2_ROOM_EVENT_UpdatedRoomDataInternal = 0x1106, SCE_NP_MATCHING2_ROOM_EVENT_UpdatedRoomMemberDataInternal = 0x1107, - SCE_NP_MATCHING2_ROOM_EVENT_UpdatedSignalingOptParam = 0x1108, + SCE_NP_MATCHING2_ROOM_EVENT_UpdatedSignalingOptParam = 0x1108, }; // Room message event enum { SCE_NP_MATCHING2_ROOM_MSG_EVENT_ChatMessage = 0x2101, - SCE_NP_MATCHING2_ROOM_MSG_EVENT_Message = 0x2102, + SCE_NP_MATCHING2_ROOM_MSG_EVENT_Message = 0x2102, }; // Lobby event enum { - SCE_NP_MATCHING2_LOBBY_EVENT_MemberJoined = 0x3201, - SCE_NP_MATCHING2_LOBBY_EVENT_MemberLeft = 0x3202, - SCE_NP_MATCHING2_LOBBY_EVENT_LobbyDestroyed = 0x3203, + SCE_NP_MATCHING2_LOBBY_EVENT_MemberJoined = 0x3201, + SCE_NP_MATCHING2_LOBBY_EVENT_MemberLeft = 0x3202, + SCE_NP_MATCHING2_LOBBY_EVENT_LobbyDestroyed = 0x3203, SCE_NP_MATCHING2_LOBBY_EVENT_UpdatedLobbyMemberDataInternal = 0x3204, }; @@ -481,14 +481,14 @@ enum enum { SCE_NP_MATCHING2_LOBBY_MSG_EVENT_ChatMessage = 0x4201, - SCE_NP_MATCHING2_LOBBY_MSG_EVENT_Invitation = 0x4202, + SCE_NP_MATCHING2_LOBBY_MSG_EVENT_Invitation = 0x4202, }; // Signaling event enum { - SCE_NP_MATCHING2_SIGNALING_EVENT_Dead = 0x5101, - SCE_NP_MATCHING2_SIGNALING_EVENT_Established = 0x5102, + SCE_NP_MATCHING2_SIGNALING_EVENT_Dead = 0x5101, + SCE_NP_MATCHING2_SIGNALING_EVENT_Established = 0x5102, SCE_NP_MATCHING2_SIGNALING_EVENT_NetInfoResult = 0x5103, }; @@ -496,16 +496,16 @@ enum enum { SCE_NP_MATCHING2_CONTEXT_EVENT_StartOver = 0x6f01, - SCE_NP_MATCHING2_CONTEXT_EVENT_Start = 0x6f02, - SCE_NP_MATCHING2_CONTEXT_EVENT_Stop = 0x6f03, + SCE_NP_MATCHING2_CONTEXT_EVENT_Start = 0x6f02, + SCE_NP_MATCHING2_CONTEXT_EVENT_Stop = 0x6f03, }; enum { SCE_NP_MATCHING2_SIGNALING_NETINFO_NAT_STATUS_UNKNOWN = 0, - SCE_NP_MATCHING2_SIGNALING_NETINFO_NAT_STATUS_TYPE = 1, - SCE_NP_MATCHING2_SIGNALING_NETINFO_NAT_STATUS_TYPE2 = 2, - SCE_NP_MATCHING2_SIGNALING_NETINFO_NAT_STATUS_TYPE3 = 3, + SCE_NP_MATCHING2_SIGNALING_NETINFO_NAT_STATUS_TYPE = 1, + SCE_NP_MATCHING2_SIGNALING_NETINFO_NAT_STATUS_TYPE2 = 2, + SCE_NP_MATCHING2_SIGNALING_NETINFO_NAT_STATUS_TYPE3 = 3, }; typedef u16 SceNpMatching2ServerId; @@ -542,17 +542,17 @@ typedef SceNpCommunicationPassphrase SceNpMatching2TitlePassphrase; // Request callback function using SceNpMatching2RequestCallback = void(SceNpMatching2ContextId ctxId, SceNpMatching2RequestId reqId, SceNpMatching2Event event, SceNpMatching2EventKey eventKey, - s32 errorCode, u32 dataSize, vm::ptr arg); + s32 errorCode, u32 dataSize, vm::ptr arg); using SceNpMatching2RoomEventCallback = void(SceNpMatching2ContextId ctxId, SceNpMatching2RoomId roomId, SceNpMatching2Event event, SceNpMatching2EventKey eventKey, - s32 errorCode, u32 dataSize, vm::ptr arg); + s32 errorCode, u32 dataSize, vm::ptr arg); using SceNpMatching2RoomMessageCallback = void(SceNpMatching2ContextId ctxId, SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId srcMemberId, SceNpMatching2Event event, - SceNpMatching2EventKey eventKey, s32 errorCode, u32 dataSize, vm::ptr arg); + SceNpMatching2EventKey eventKey, s32 errorCode, u32 dataSize, vm::ptr arg); using SceNpMatching2LobbyEventCallback = void(SceNpMatching2ContextId ctxId, SceNpMatching2LobbyId lobbyId, SceNpMatching2Event event, SceNpMatching2EventKey eventKey, - s32 errorCode, u32 dataSize, vm::ptr arg); + s32 errorCode, u32 dataSize, vm::ptr arg); using SceNpMatching2LobbyMessageCallback = void(SceNpMatching2ContextId ctxId, SceNpMatching2LobbyId lobbyId, SceNpMatching2LobbyMemberId srcMemberId, SceNpMatching2Event event, - SceNpMatching2EventKey eventKey, s32 errorCode, u32 dataSize, vm::ptr arg); + SceNpMatching2EventKey eventKey, s32 errorCode, u32 dataSize, vm::ptr arg); using SceNpMatching2SignalingCallback = void(SceNpMatching2ContextId ctxId, SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId peerMemberId, SceNpMatching2Event event, - s32 errorCode, vm::ptr arg); + s32 errorCode, vm::ptr arg); using SceNpMatching2ContextCallback = void(SceNpMatching2ContextId ctxId, SceNpMatching2Event event, SceNpMatching2EventCause eventCause, s32 errorCode, vm::ptr arg); // Session password @@ -710,7 +710,7 @@ struct SceNpMatching2LobbyDataExternal u8 padding1[2]; be_t worldId; u8 padding2[4]; - be_t lobbyId; + be_t lobbyId; be_t maxSlot; be_t curMemberNum; be_t flagAttr; @@ -1566,35 +1566,35 @@ struct SceNpMatching2SignalingNetInfo // NP OAuth Errors enum SceNpOauthError : u32 { - SCE_NP_OAUTH_ERROR_UNKNOWN = 0x80025f01, - SCE_NP_OAUTH_ERROR_ALREADY_INITIALIZED = 0x80025f02, - SCE_NP_OAUTH_ERROR_NOT_INITIALIZED = 0x80025f03, - SCE_NP_OAUTH_ERROR_INVALID_ARGUMENT = 0x80025f04, - SCE_NP_OAUTH_ERROR_OUT_OF_MEMORY = 0x80025f05, - SCE_NP_OAUTH_ERROR_OUT_OF_BUFFER = 0x80025f06, - SCE_NP_OAUTH_ERROR_BAD_RESPONSE = 0x80025f07, - SCE_NP_OAUTH_ERROR_ABORTED = 0x80025f08, - SCE_NP_OAUTH_ERROR_SIGNED_OUT = 0x80025f09, - SCE_NP_OAUTH_ERROR_REQUEST_NOT_FOUND = 0x80025f0a, - SCE_NP_OAUTH_ERROR_SSL_ERR_CN_CHECK = 0x80025f0b, - SCE_NP_OAUTH_ERROR_SSL_ERR_UNKNOWN_CA = 0x80025f0c, - SCE_NP_OAUTH_ERROR_SSL_ERR_NOT_AFTER_CHECK = 0x80025f0d, - SCE_NP_OAUTH_ERROR_SSL_ERR_NOT_BEFORE_CHECK = 0x80025f0e, - SCE_NP_OAUTH_ERROR_SSL_ERR_INVALID_CERT = 0x80025f0f, - SCE_NP_OAUTH_ERROR_SSL_ERR_INTERNAL = 0x80025f10, - SCE_NP_OAUTH_ERROR_REQUEST_MAX = 0x80025f11, + SCE_NP_OAUTH_ERROR_UNKNOWN = 0x80025f01, + SCE_NP_OAUTH_ERROR_ALREADY_INITIALIZED = 0x80025f02, + SCE_NP_OAUTH_ERROR_NOT_INITIALIZED = 0x80025f03, + SCE_NP_OAUTH_ERROR_INVALID_ARGUMENT = 0x80025f04, + SCE_NP_OAUTH_ERROR_OUT_OF_MEMORY = 0x80025f05, + SCE_NP_OAUTH_ERROR_OUT_OF_BUFFER = 0x80025f06, + SCE_NP_OAUTH_ERROR_BAD_RESPONSE = 0x80025f07, + SCE_NP_OAUTH_ERROR_ABORTED = 0x80025f08, + SCE_NP_OAUTH_ERROR_SIGNED_OUT = 0x80025f09, + SCE_NP_OAUTH_ERROR_REQUEST_NOT_FOUND = 0x80025f0a, + SCE_NP_OAUTH_ERROR_SSL_ERR_CN_CHECK = 0x80025f0b, + SCE_NP_OAUTH_ERROR_SSL_ERR_UNKNOWN_CA = 0x80025f0c, + SCE_NP_OAUTH_ERROR_SSL_ERR_NOT_AFTER_CHECK = 0x80025f0d, + SCE_NP_OAUTH_ERROR_SSL_ERR_NOT_BEFORE_CHECK = 0x80025f0e, + SCE_NP_OAUTH_ERROR_SSL_ERR_INVALID_CERT = 0x80025f0f, + SCE_NP_OAUTH_ERROR_SSL_ERR_INTERNAL = 0x80025f10, + SCE_NP_OAUTH_ERROR_REQUEST_MAX = 0x80025f11, - SCE_NP_OAUTH_SERVER_ERROR_BANNED_CONSOLE = 0x80025d14, - SCE_NP_OAUTH_SERVER_ERROR_INVALID_LOGIN = 0x82e00014, - SCE_NP_OAUTH_SERVER_ERROR_INACTIVE_ACCOUNT = 0x82e0001b, - SCE_NP_OAUTH_SERVER_ERROR_SUSPENDED_ACCOUNT = 0x82e0001c, - SCE_NP_OAUTH_SERVER_ERROR_SUSPENDED_DEVICE = 0x82e0001d, - SCE_NP_OAUTH_SERVER_ERROR_PASSWORD_EXPIRED = 0x82e00064, - SCE_NP_OAUTH_SERVER_ERROR_TOSUA_MUST_BE_RE_ACCEPTED = 0x82e00067, + SCE_NP_OAUTH_SERVER_ERROR_BANNED_CONSOLE = 0x80025d14, + SCE_NP_OAUTH_SERVER_ERROR_INVALID_LOGIN = 0x82e00014, + SCE_NP_OAUTH_SERVER_ERROR_INACTIVE_ACCOUNT = 0x82e0001b, + SCE_NP_OAUTH_SERVER_ERROR_SUSPENDED_ACCOUNT = 0x82e0001c, + SCE_NP_OAUTH_SERVER_ERROR_SUSPENDED_DEVICE = 0x82e0001d, + SCE_NP_OAUTH_SERVER_ERROR_PASSWORD_EXPIRED = 0x82e00064, + SCE_NP_OAUTH_SERVER_ERROR_TOSUA_MUST_BE_RE_ACCEPTED = 0x82e00067, SCE_NP_OAUTH_SERVER_ERROR_TOSUA_MUST_BE_RE_ACCEPTED_FOR_SUBACCOUNT = 0x82e01042, - SCE_NP_OAUTH_SERVER_ERROR_BANNED_ACCOUNT = 0x82e01050, - SCE_NP_OAUTH_SERVER_ERROR_SERVICE_END = 0x82e1019a, - SCE_NP_OAUTH_SERVER_ERROR_SERVICE_UNAVAILABLE = 0x82e101f7, + SCE_NP_OAUTH_SERVER_ERROR_BANNED_ACCOUNT = 0x82e01050, + SCE_NP_OAUTH_SERVER_ERROR_SERVICE_END = 0x82e1019a, + SCE_NP_OAUTH_SERVER_ERROR_SERVICE_UNAVAILABLE = 0x82e101f7, }; typedef s32 SceNpAuthOAuthRequestId; @@ -1602,7 +1602,7 @@ typedef s32 SceNpAuthOAuthRequestId; enum { SCE_NP_AUTHORIZATION_CODE_MAX_LEN = 128, - SCE_NP_CLIENT_ID_MAX_LEN = 128, + SCE_NP_CLIENT_ID_MAX_LEN = 128, }; struct SceNpClientId diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpClans.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpClans.cpp index 91d22079f..5ff2dd3ca 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpClans.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpClans.cpp @@ -7,70 +7,70 @@ LOG_CHANNEL(sceNpClans); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(SCE_NP_CLANS_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_CLANS_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_CLANS_ERROR_NOT_SUPPORTED); - STR_CASE(SCE_NP_CLANS_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_CLANS_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_CLANS_ERROR_EXCEEDS_MAX); - STR_CASE(SCE_NP_CLANS_ERROR_BAD_RESPONSE); - STR_CASE(SCE_NP_CLANS_ERROR_BAD_DATA); - STR_CASE(SCE_NP_CLANS_ERROR_BAD_REQUEST); - STR_CASE(SCE_NP_CLANS_ERROR_INVALID_SIGNATURE); - STR_CASE(SCE_NP_CLANS_ERROR_INSUFFICIENT); - STR_CASE(SCE_NP_CLANS_ERROR_INTERNAL_BUFFER); - STR_CASE(SCE_NP_CLANS_ERROR_SERVER_MAINTENANCE); - STR_CASE(SCE_NP_CLANS_ERROR_SERVER_END_OF_SERVICE); - STR_CASE(SCE_NP_CLANS_ERROR_SERVER_BEFORE_START_OF_SERVICE); - STR_CASE(SCE_NP_CLANS_ERROR_ABORTED); - STR_CASE(SCE_NP_CLANS_ERROR_SERVICE_UNAVAILABLE); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_BAD_REQUEST); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INVALID_TICKET); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INVALID_SIGNATURE); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_TICKET_EXPIRED); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INVALID_NPID); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_FORBIDDEN); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INTERNAL_SERVER_ERROR); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_BANNED); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_BLACKLISTED); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INVALID_ENVIRONMENT); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN_SERVICE); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN_MEMBER); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_BEFORE_HOURS); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLOSED_SERVICE); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_PERMISSION_DENIED); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_LIMIT_REACHED); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_LEADER_LIMIT_REACHED); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_MEMBER_LIMIT_REACHED); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_JOINED_LIMIT_REACHED); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_MEMBER_STATUS_INVALID); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_DUPLICATED_CLAN_NAME); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_LEADER_CANNOT_LEAVE); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INVALID_ROLE_PRIORITY); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_ANNOUNCEMENT_LIMIT_REACHED); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_CONFIG_MASTER_NOT_FOUND); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_DUPLICATED_CLAN_TAG); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_EXCEEDS_CREATE_CLAN_FREQUENCY); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_PASSPHRASE_INCORRECT); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CANNOT_RECORD_BLACKLIST_ENTRY); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN_ANNOUNCEMENT); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_VULGAR_WORDS_POSTED); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_BLACKLIST_LIMIT_REACHED); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_BLACKLIST_ENTRY); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INVALID_NP_MESSAGE_FORMAT); - STR_CASE(SCE_NP_CLANS_SERVER_ERROR_FAILED_TO_SEND_NP_MESSAGE); - } + switch (error) + { + STR_CASE(SCE_NP_CLANS_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_CLANS_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_CLANS_ERROR_NOT_SUPPORTED); + STR_CASE(SCE_NP_CLANS_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_CLANS_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_CLANS_ERROR_EXCEEDS_MAX); + STR_CASE(SCE_NP_CLANS_ERROR_BAD_RESPONSE); + STR_CASE(SCE_NP_CLANS_ERROR_BAD_DATA); + STR_CASE(SCE_NP_CLANS_ERROR_BAD_REQUEST); + STR_CASE(SCE_NP_CLANS_ERROR_INVALID_SIGNATURE); + STR_CASE(SCE_NP_CLANS_ERROR_INSUFFICIENT); + STR_CASE(SCE_NP_CLANS_ERROR_INTERNAL_BUFFER); + STR_CASE(SCE_NP_CLANS_ERROR_SERVER_MAINTENANCE); + STR_CASE(SCE_NP_CLANS_ERROR_SERVER_END_OF_SERVICE); + STR_CASE(SCE_NP_CLANS_ERROR_SERVER_BEFORE_START_OF_SERVICE); + STR_CASE(SCE_NP_CLANS_ERROR_ABORTED); + STR_CASE(SCE_NP_CLANS_ERROR_SERVICE_UNAVAILABLE); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_BAD_REQUEST); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INVALID_TICKET); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INVALID_SIGNATURE); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_TICKET_EXPIRED); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INVALID_NPID); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_FORBIDDEN); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INTERNAL_SERVER_ERROR); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_BANNED); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_BLACKLISTED); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INVALID_ENVIRONMENT); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN_SERVICE); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN_MEMBER); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_BEFORE_HOURS); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLOSED_SERVICE); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_PERMISSION_DENIED); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_LIMIT_REACHED); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_LEADER_LIMIT_REACHED); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_MEMBER_LIMIT_REACHED); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_JOINED_LIMIT_REACHED); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_MEMBER_STATUS_INVALID); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_DUPLICATED_CLAN_NAME); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_LEADER_CANNOT_LEAVE); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INVALID_ROLE_PRIORITY); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_ANNOUNCEMENT_LIMIT_REACHED); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_CONFIG_MASTER_NOT_FOUND); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_DUPLICATED_CLAN_TAG); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_EXCEEDS_CREATE_CLAN_FREQUENCY); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CLAN_PASSPHRASE_INCORRECT); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_CANNOT_RECORD_BLACKLIST_ENTRY); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN_ANNOUNCEMENT); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_VULGAR_WORDS_POSTED); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_BLACKLIST_LIMIT_REACHED); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_BLACKLIST_ENTRY); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_INVALID_NP_MESSAGE_FORMAT); + STR_CASE(SCE_NP_CLANS_SERVER_ERROR_FAILED_TO_SEND_NP_MESSAGE); + } - return unknown; - }); + return unknown; + }); } error_code sceNpClansInit(vm::cptr commId, vm::cptr passphrase, vm::ptr pool, vm::ptr poolSize, u32 flags) @@ -328,10 +328,10 @@ error_code sceNpClansUpdateClanInfo(vm::ptr handle, Sce return SCE_NP_CLANS_ERROR_INVALID_ARGUMENT; } - //if (info->something > X) + // if (info->something > X) //{ // return SCE_NP_CLANS_ERROR_EXCEEDS_MAX; - //} + // } return CELL_OK; } @@ -393,10 +393,10 @@ error_code sceNpClansUpdateMemberInfo(vm::ptr handle, S return SCE_NP_CLANS_ERROR_INVALID_ARGUMENT; } - //if (info->something > X) + // if (info->something > X) //{ // return SCE_NP_CLANS_ERROR_EXCEEDS_MAX; - //} + // } return CELL_OK; } @@ -765,7 +765,7 @@ error_code sceNpClansPostChallenge(vm::ptr handle, SceN return CELL_OK; } -error_code sceNpClansRetrievePostedChallenges(vm::ptr handle, SceNpClanId clanId, SceNpClanId targetClan, vm::cptr paging, vm::ptr mList, vm::ptr pageResult) +error_code sceNpClansRetrievePostedChallenges(vm::ptr handle, SceNpClanId clanId, SceNpClanId targetClan, vm::cptr paging, vm::ptr mList, vm::ptr pageResult) { sceNpClans.todo("sceNpClansRetrievePostedChallenges(handle=*0x%x, clanId=%d, targetClan=%d, paging=*0x%x, mList=*0x%x, pageResult=*0x%x)", handle, clanId, targetClan, paging, mList, pageResult); @@ -840,44 +840,44 @@ error_code sceNpClansRemoveChallenge(SceNpClansRequestHandle handle, SceNpClanId } DECLARE(ppu_module_manager::sceNpClans)("sceNpClans", []() -{ - REG_FUNC(sceNpClans, sceNpClansInit); - REG_FUNC(sceNpClans, sceNpClansTerm); - REG_FUNC(sceNpClans, sceNpClansCreateRequest); - REG_FUNC(sceNpClans, sceNpClansDestroyRequest); - REG_FUNC(sceNpClans, sceNpClansAbortRequest); - REG_FUNC(sceNpClans, sceNpClansCreateClan); - REG_FUNC(sceNpClans, sceNpClansDisbandClan); - REG_FUNC(sceNpClans, sceNpClansGetClanList); - REG_FUNC(sceNpClans, sceNpClansGetClanListByNpId); - REG_FUNC(sceNpClans, sceNpClansSearchByProfile); - REG_FUNC(sceNpClans, sceNpClansSearchByName); - REG_FUNC(sceNpClans, sceNpClansGetClanInfo); - REG_FUNC(sceNpClans, sceNpClansUpdateClanInfo); - REG_FUNC(sceNpClans, sceNpClansGetMemberList); - REG_FUNC(sceNpClans, sceNpClansGetMemberInfo); - REG_FUNC(sceNpClans, sceNpClansUpdateMemberInfo); - REG_FUNC(sceNpClans, sceNpClansChangeMemberRole); - REG_FUNC(sceNpClans, sceNpClansGetAutoAcceptStatus); - REG_FUNC(sceNpClans, sceNpClansUpdateAutoAcceptStatus); - REG_FUNC(sceNpClans, sceNpClansJoinClan); - REG_FUNC(sceNpClans, sceNpClansLeaveClan); - REG_FUNC(sceNpClans, sceNpClansKickMember); - REG_FUNC(sceNpClans, sceNpClansSendInvitation); - REG_FUNC(sceNpClans, sceNpClansCancelInvitation); - REG_FUNC(sceNpClans, sceNpClansSendInvitationResponse); - REG_FUNC(sceNpClans, sceNpClansSendMembershipRequest); - REG_FUNC(sceNpClans, sceNpClansCancelMembershipRequest); - REG_FUNC(sceNpClans, sceNpClansSendMembershipResponse); - REG_FUNC(sceNpClans, sceNpClansGetBlacklist); - REG_FUNC(sceNpClans, sceNpClansAddBlacklistEntry); - REG_FUNC(sceNpClans, sceNpClansRemoveBlacklistEntry); - REG_FUNC(sceNpClans, sceNpClansRetrieveAnnouncements); - REG_FUNC(sceNpClans, sceNpClansPostAnnouncement); - REG_FUNC(sceNpClans, sceNpClansRemoveAnnouncement); - REG_FUNC(sceNpClans, sceNpClansPostChallenge); - REG_FUNC(sceNpClans, sceNpClansRetrievePostedChallenges); - REG_FUNC(sceNpClans, sceNpClansRemovePostedChallenge); - REG_FUNC(sceNpClans, sceNpClansRetrieveChallenges); - REG_FUNC(sceNpClans, sceNpClansRemoveChallenge); -}); + { + REG_FUNC(sceNpClans, sceNpClansInit); + REG_FUNC(sceNpClans, sceNpClansTerm); + REG_FUNC(sceNpClans, sceNpClansCreateRequest); + REG_FUNC(sceNpClans, sceNpClansDestroyRequest); + REG_FUNC(sceNpClans, sceNpClansAbortRequest); + REG_FUNC(sceNpClans, sceNpClansCreateClan); + REG_FUNC(sceNpClans, sceNpClansDisbandClan); + REG_FUNC(sceNpClans, sceNpClansGetClanList); + REG_FUNC(sceNpClans, sceNpClansGetClanListByNpId); + REG_FUNC(sceNpClans, sceNpClansSearchByProfile); + REG_FUNC(sceNpClans, sceNpClansSearchByName); + REG_FUNC(sceNpClans, sceNpClansGetClanInfo); + REG_FUNC(sceNpClans, sceNpClansUpdateClanInfo); + REG_FUNC(sceNpClans, sceNpClansGetMemberList); + REG_FUNC(sceNpClans, sceNpClansGetMemberInfo); + REG_FUNC(sceNpClans, sceNpClansUpdateMemberInfo); + REG_FUNC(sceNpClans, sceNpClansChangeMemberRole); + REG_FUNC(sceNpClans, sceNpClansGetAutoAcceptStatus); + REG_FUNC(sceNpClans, sceNpClansUpdateAutoAcceptStatus); + REG_FUNC(sceNpClans, sceNpClansJoinClan); + REG_FUNC(sceNpClans, sceNpClansLeaveClan); + REG_FUNC(sceNpClans, sceNpClansKickMember); + REG_FUNC(sceNpClans, sceNpClansSendInvitation); + REG_FUNC(sceNpClans, sceNpClansCancelInvitation); + REG_FUNC(sceNpClans, sceNpClansSendInvitationResponse); + REG_FUNC(sceNpClans, sceNpClansSendMembershipRequest); + REG_FUNC(sceNpClans, sceNpClansCancelMembershipRequest); + REG_FUNC(sceNpClans, sceNpClansSendMembershipResponse); + REG_FUNC(sceNpClans, sceNpClansGetBlacklist); + REG_FUNC(sceNpClans, sceNpClansAddBlacklistEntry); + REG_FUNC(sceNpClans, sceNpClansRemoveBlacklistEntry); + REG_FUNC(sceNpClans, sceNpClansRetrieveAnnouncements); + REG_FUNC(sceNpClans, sceNpClansPostAnnouncement); + REG_FUNC(sceNpClans, sceNpClansRemoveAnnouncement); + REG_FUNC(sceNpClans, sceNpClansPostChallenge); + REG_FUNC(sceNpClans, sceNpClansRetrievePostedChallenges); + REG_FUNC(sceNpClans, sceNpClansRemovePostedChallenge); + REG_FUNC(sceNpClans, sceNpClansRetrieveChallenges); + REG_FUNC(sceNpClans, sceNpClansRemoveChallenge); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpClans.h b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpClans.h index f0d1d5463..9fc016703 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpClans.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpClans.h @@ -5,76 +5,76 @@ // Return codes enum SceNpClansError : u32 { - SCE_NP_CLANS_ERROR_ALREADY_INITIALIZED = 0x80022701, - SCE_NP_CLANS_ERROR_NOT_INITIALIZED = 0x80022702, - SCE_NP_CLANS_ERROR_NOT_SUPPORTED = 0x80022703, - SCE_NP_CLANS_ERROR_OUT_OF_MEMORY = 0x80022704, - SCE_NP_CLANS_ERROR_INVALID_ARGUMENT = 0x80022705, - SCE_NP_CLANS_ERROR_EXCEEDS_MAX = 0x80022706, - SCE_NP_CLANS_ERROR_BAD_RESPONSE = 0x80022707, - SCE_NP_CLANS_ERROR_BAD_DATA = 0x80022708, - SCE_NP_CLANS_ERROR_BAD_REQUEST = 0x80022709, - SCE_NP_CLANS_ERROR_INVALID_SIGNATURE = 0x8002270a, - SCE_NP_CLANS_ERROR_INSUFFICIENT = 0x8002270b, - SCE_NP_CLANS_ERROR_INTERNAL_BUFFER = 0x8002270c, - SCE_NP_CLANS_ERROR_SERVER_MAINTENANCE = 0x8002270d, - SCE_NP_CLANS_ERROR_SERVER_END_OF_SERVICE = 0x8002270e, - SCE_NP_CLANS_ERROR_SERVER_BEFORE_START_OF_SERVICE = 0x8002270f, - SCE_NP_CLANS_ERROR_ABORTED = 0x80022710, - SCE_NP_CLANS_ERROR_SERVICE_UNAVAILABLE = 0x80022711, - SCE_NP_CLANS_SERVER_ERROR_BAD_REQUEST = 0x80022801, - SCE_NP_CLANS_SERVER_ERROR_INVALID_TICKET = 0x80022802, - SCE_NP_CLANS_SERVER_ERROR_INVALID_SIGNATURE = 0x80022803, - SCE_NP_CLANS_SERVER_ERROR_TICKET_EXPIRED = 0x80022804, - SCE_NP_CLANS_SERVER_ERROR_INVALID_NPID = 0x80022805, - SCE_NP_CLANS_SERVER_ERROR_FORBIDDEN = 0x80022806, - SCE_NP_CLANS_SERVER_ERROR_INTERNAL_SERVER_ERROR = 0x80022807, - SCE_NP_CLANS_SERVER_ERROR_BANNED = 0x8002280a, - SCE_NP_CLANS_SERVER_ERROR_BLACKLISTED = 0x80022811, - SCE_NP_CLANS_SERVER_ERROR_INVALID_ENVIRONMENT = 0x8002281d, - SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN_SERVICE = 0x8002282f, - SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN = 0x80022830, - SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN_MEMBER = 0x80022831, - SCE_NP_CLANS_SERVER_ERROR_BEFORE_HOURS = 0x80022832, - SCE_NP_CLANS_SERVER_ERROR_CLOSED_SERVICE = 0x80022833, - SCE_NP_CLANS_SERVER_ERROR_PERMISSION_DENIED = 0x80022834, - SCE_NP_CLANS_SERVER_ERROR_CLAN_LIMIT_REACHED = 0x80022835, - SCE_NP_CLANS_SERVER_ERROR_CLAN_LEADER_LIMIT_REACHED = 0x80022836, - SCE_NP_CLANS_SERVER_ERROR_CLAN_MEMBER_LIMIT_REACHED = 0x80022837, - SCE_NP_CLANS_SERVER_ERROR_CLAN_JOINED_LIMIT_REACHED = 0x80022838, - SCE_NP_CLANS_SERVER_ERROR_MEMBER_STATUS_INVALID = 0x80022839, - SCE_NP_CLANS_SERVER_ERROR_DUPLICATED_CLAN_NAME = 0x8002283a, - SCE_NP_CLANS_SERVER_ERROR_CLAN_LEADER_CANNOT_LEAVE = 0x8002283b, - SCE_NP_CLANS_SERVER_ERROR_INVALID_ROLE_PRIORITY = 0x8002283c, - SCE_NP_CLANS_SERVER_ERROR_ANNOUNCEMENT_LIMIT_REACHED = 0x8002283d, - SCE_NP_CLANS_SERVER_ERROR_CLAN_CONFIG_MASTER_NOT_FOUND = 0x8002283e, - SCE_NP_CLANS_SERVER_ERROR_DUPLICATED_CLAN_TAG = 0x8002283f, + SCE_NP_CLANS_ERROR_ALREADY_INITIALIZED = 0x80022701, + SCE_NP_CLANS_ERROR_NOT_INITIALIZED = 0x80022702, + SCE_NP_CLANS_ERROR_NOT_SUPPORTED = 0x80022703, + SCE_NP_CLANS_ERROR_OUT_OF_MEMORY = 0x80022704, + SCE_NP_CLANS_ERROR_INVALID_ARGUMENT = 0x80022705, + SCE_NP_CLANS_ERROR_EXCEEDS_MAX = 0x80022706, + SCE_NP_CLANS_ERROR_BAD_RESPONSE = 0x80022707, + SCE_NP_CLANS_ERROR_BAD_DATA = 0x80022708, + SCE_NP_CLANS_ERROR_BAD_REQUEST = 0x80022709, + SCE_NP_CLANS_ERROR_INVALID_SIGNATURE = 0x8002270a, + SCE_NP_CLANS_ERROR_INSUFFICIENT = 0x8002270b, + SCE_NP_CLANS_ERROR_INTERNAL_BUFFER = 0x8002270c, + SCE_NP_CLANS_ERROR_SERVER_MAINTENANCE = 0x8002270d, + SCE_NP_CLANS_ERROR_SERVER_END_OF_SERVICE = 0x8002270e, + SCE_NP_CLANS_ERROR_SERVER_BEFORE_START_OF_SERVICE = 0x8002270f, + SCE_NP_CLANS_ERROR_ABORTED = 0x80022710, + SCE_NP_CLANS_ERROR_SERVICE_UNAVAILABLE = 0x80022711, + SCE_NP_CLANS_SERVER_ERROR_BAD_REQUEST = 0x80022801, + SCE_NP_CLANS_SERVER_ERROR_INVALID_TICKET = 0x80022802, + SCE_NP_CLANS_SERVER_ERROR_INVALID_SIGNATURE = 0x80022803, + SCE_NP_CLANS_SERVER_ERROR_TICKET_EXPIRED = 0x80022804, + SCE_NP_CLANS_SERVER_ERROR_INVALID_NPID = 0x80022805, + SCE_NP_CLANS_SERVER_ERROR_FORBIDDEN = 0x80022806, + SCE_NP_CLANS_SERVER_ERROR_INTERNAL_SERVER_ERROR = 0x80022807, + SCE_NP_CLANS_SERVER_ERROR_BANNED = 0x8002280a, + SCE_NP_CLANS_SERVER_ERROR_BLACKLISTED = 0x80022811, + SCE_NP_CLANS_SERVER_ERROR_INVALID_ENVIRONMENT = 0x8002281d, + SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN_SERVICE = 0x8002282f, + SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN = 0x80022830, + SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN_MEMBER = 0x80022831, + SCE_NP_CLANS_SERVER_ERROR_BEFORE_HOURS = 0x80022832, + SCE_NP_CLANS_SERVER_ERROR_CLOSED_SERVICE = 0x80022833, + SCE_NP_CLANS_SERVER_ERROR_PERMISSION_DENIED = 0x80022834, + SCE_NP_CLANS_SERVER_ERROR_CLAN_LIMIT_REACHED = 0x80022835, + SCE_NP_CLANS_SERVER_ERROR_CLAN_LEADER_LIMIT_REACHED = 0x80022836, + SCE_NP_CLANS_SERVER_ERROR_CLAN_MEMBER_LIMIT_REACHED = 0x80022837, + SCE_NP_CLANS_SERVER_ERROR_CLAN_JOINED_LIMIT_REACHED = 0x80022838, + SCE_NP_CLANS_SERVER_ERROR_MEMBER_STATUS_INVALID = 0x80022839, + SCE_NP_CLANS_SERVER_ERROR_DUPLICATED_CLAN_NAME = 0x8002283a, + SCE_NP_CLANS_SERVER_ERROR_CLAN_LEADER_CANNOT_LEAVE = 0x8002283b, + SCE_NP_CLANS_SERVER_ERROR_INVALID_ROLE_PRIORITY = 0x8002283c, + SCE_NP_CLANS_SERVER_ERROR_ANNOUNCEMENT_LIMIT_REACHED = 0x8002283d, + SCE_NP_CLANS_SERVER_ERROR_CLAN_CONFIG_MASTER_NOT_FOUND = 0x8002283e, + SCE_NP_CLANS_SERVER_ERROR_DUPLICATED_CLAN_TAG = 0x8002283f, SCE_NP_CLANS_SERVER_ERROR_EXCEEDS_CREATE_CLAN_FREQUENCY = 0x80022840, - SCE_NP_CLANS_SERVER_ERROR_CLAN_PASSPHRASE_INCORRECT = 0x80022841, + SCE_NP_CLANS_SERVER_ERROR_CLAN_PASSPHRASE_INCORRECT = 0x80022841, SCE_NP_CLANS_SERVER_ERROR_CANNOT_RECORD_BLACKLIST_ENTRY = 0x80022842, - SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN_ANNOUNCEMENT = 0x80022843, - SCE_NP_CLANS_SERVER_ERROR_VULGAR_WORDS_POSTED = 0x80022844, - SCE_NP_CLANS_SERVER_ERROR_BLACKLIST_LIMIT_REACHED = 0x80022845, - SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_BLACKLIST_ENTRY = 0x80022846, - SCE_NP_CLANS_SERVER_ERROR_INVALID_NP_MESSAGE_FORMAT = 0x8002284b, - SCE_NP_CLANS_SERVER_ERROR_FAILED_TO_SEND_NP_MESSAGE = 0x8002284c, + SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_CLAN_ANNOUNCEMENT = 0x80022843, + SCE_NP_CLANS_SERVER_ERROR_VULGAR_WORDS_POSTED = 0x80022844, + SCE_NP_CLANS_SERVER_ERROR_BLACKLIST_LIMIT_REACHED = 0x80022845, + SCE_NP_CLANS_SERVER_ERROR_NO_SUCH_BLACKLIST_ENTRY = 0x80022846, + SCE_NP_CLANS_SERVER_ERROR_INVALID_NP_MESSAGE_FORMAT = 0x8002284b, + SCE_NP_CLANS_SERVER_ERROR_FAILED_TO_SEND_NP_MESSAGE = 0x8002284c, }; // Clan roles enum { - SCE_NP_CLANS_ROLE_UNKNOWN = 0, + SCE_NP_CLANS_ROLE_UNKNOWN = 0, SCE_NP_CLANS_ROLE_NON_MEMBER = 1, - SCE_NP_CLANS_ROLE_MEMBER = 2, + SCE_NP_CLANS_ROLE_MEMBER = 2, SCE_NP_CLANS_ROLE_SUB_LEADER = 3, - SCE_NP_CLANS_ROLE_LEADER = 4, + SCE_NP_CLANS_ROLE_LEADER = 4, }; // Clan member status enum { SCE_NP_CLANS_MEMBER_STATUS_UNKNOWN = 0, - SCE_NP_CLANS_MEMBER_STATUS_NORMAL = 1, + SCE_NP_CLANS_MEMBER_STATUS_NORMAL = 1, SCE_NP_CLANS_MEMBER_STATUS_INVITED = 2, SCE_NP_CLANS_MEMBER_STATUS_PENDING = 3, }; @@ -82,44 +82,44 @@ enum // Clan search operators enum { - SCE_NP_CLANS_SEARCH_OPERATOR_EQUAL_TO = 0, - SCE_NP_CLANS_SEARCH_OPERATOR_NOT_EQUAL_TO = 1, - SCE_NP_CLANS_SEARCH_OPERATOR_GREATER_THAN = 2, + SCE_NP_CLANS_SEARCH_OPERATOR_EQUAL_TO = 0, + SCE_NP_CLANS_SEARCH_OPERATOR_NOT_EQUAL_TO = 1, + SCE_NP_CLANS_SEARCH_OPERATOR_GREATER_THAN = 2, SCE_NP_CLANS_SEARCH_OPERATOR_GREATER_THAN_OR_EQUAL_TO = 3, - SCE_NP_CLANS_SEARCH_OPERATOR_LESS_THAN = 4, - SCE_NP_CLANS_SEARCH_OPERATOR_LESS_THAN_OR_EQUAL_TO = 5, - SCE_NP_CLANS_SEARCH_OPERATOR_SIMILAR_TO = 6, + SCE_NP_CLANS_SEARCH_OPERATOR_LESS_THAN = 4, + SCE_NP_CLANS_SEARCH_OPERATOR_LESS_THAN_OR_EQUAL_TO = 5, + SCE_NP_CLANS_SEARCH_OPERATOR_SIMILAR_TO = 6, }; // Constants for clan functions and structures enum { SCE_NP_CLANS_ANNOUNCEMENT_MESSAGE_BODY_MAX_LENGTH = 1536, - SCE_NP_CLANS_CLAN_BINARY_ATTRIBUTE1_MAX_SIZE = 190, - SCE_NP_CLANS_CLAN_BINARY_DATA_MAX_SIZE = 10240, - SCE_NP_CLANS_MEMBER_BINARY_ATTRIBUTE1_MAX_SIZE = 16, - SCE_NP_CLANS_MEMBER_DESCRIPTION_MAX_LENGTH = 255, - SCE_NP_CLANS_MEMBER_BINARY_DATA_MAX_SIZE = 1024, - SCE_NP_CLANS_MESSAGE_BODY_MAX_LENGTH = 1536, - SCE_NP_CLANS_MESSAGE_SUBJECT_MAX_LENGTH = 54, - SCE_NP_CLANS_MESSAGE_BODY_CHARACTER_MAX = 512, - SCE_NP_CLANS_MESSAGE_SUBJECT_CHARACTER_MAX = 18, - SCE_NP_CLANS_MESSAGE_BINARY_DATA_MAX_SIZE = 1024, - SCE_NP_CLANS_PAGING_REQUEST_START_POSITION_MAX = 1000000, - SCE_NP_CLANS_PAGING_REQUEST_PAGE_MAX = 100, + SCE_NP_CLANS_CLAN_BINARY_ATTRIBUTE1_MAX_SIZE = 190, + SCE_NP_CLANS_CLAN_BINARY_DATA_MAX_SIZE = 10240, + SCE_NP_CLANS_MEMBER_BINARY_ATTRIBUTE1_MAX_SIZE = 16, + SCE_NP_CLANS_MEMBER_DESCRIPTION_MAX_LENGTH = 255, + SCE_NP_CLANS_MEMBER_BINARY_DATA_MAX_SIZE = 1024, + SCE_NP_CLANS_MESSAGE_BODY_MAX_LENGTH = 1536, + SCE_NP_CLANS_MESSAGE_SUBJECT_MAX_LENGTH = 54, + SCE_NP_CLANS_MESSAGE_BODY_CHARACTER_MAX = 512, + SCE_NP_CLANS_MESSAGE_SUBJECT_CHARACTER_MAX = 18, + SCE_NP_CLANS_MESSAGE_BINARY_DATA_MAX_SIZE = 1024, + SCE_NP_CLANS_PAGING_REQUEST_START_POSITION_MAX = 1000000, + SCE_NP_CLANS_PAGING_REQUEST_PAGE_MAX = 100, }; enum { - SCE_NP_CLANS_FIELDS_SEARCHABLE_ATTR_INT_ATTR1 = 0x00000001, - SCE_NP_CLANS_FIELDS_SEARCHABLE_ATTR_INT_ATTR2 = 0x00000002, - SCE_NP_CLANS_FIELDS_SEARCHABLE_ATTR_INT_ATTR3 = 0x00000004, - SCE_NP_CLANS_FIELDS_SEARCHABLE_ATTR_BIN_ATTR1 = 0x00000008, - SCE_NP_CLANS_FIELDS_SEARCHABLE_PROFILE_TAG = 0x00000010, - SCE_NP_CLANS_FIELDS_SEARCHABLE_PROFILE_NUM_MEMBERS = 0x00000020, - SCE_NP_CLANS_FIELDS_UPDATABLE_CLAN_INFO_DESCR = 0x00000040, - SCE_NP_CLANS_FIELDS_UPDATABLE_CLAN_INFO_BIN_DATA1 = 0x00000080, - SCE_NP_CLANS_FIELDS_UPDATABLE_MEMBER_INFO_DESCR = 0x00000100, + SCE_NP_CLANS_FIELDS_SEARCHABLE_ATTR_INT_ATTR1 = 0x00000001, + SCE_NP_CLANS_FIELDS_SEARCHABLE_ATTR_INT_ATTR2 = 0x00000002, + SCE_NP_CLANS_FIELDS_SEARCHABLE_ATTR_INT_ATTR3 = 0x00000004, + SCE_NP_CLANS_FIELDS_SEARCHABLE_ATTR_BIN_ATTR1 = 0x00000008, + SCE_NP_CLANS_FIELDS_SEARCHABLE_PROFILE_TAG = 0x00000010, + SCE_NP_CLANS_FIELDS_SEARCHABLE_PROFILE_NUM_MEMBERS = 0x00000020, + SCE_NP_CLANS_FIELDS_UPDATABLE_CLAN_INFO_DESCR = 0x00000040, + SCE_NP_CLANS_FIELDS_UPDATABLE_CLAN_INFO_BIN_DATA1 = 0x00000080, + SCE_NP_CLANS_FIELDS_UPDATABLE_MEMBER_INFO_DESCR = 0x00000100, SCE_NP_CLANS_FIELDS_UPDATABLE_MEMBER_INFO_BIN_ATTR1 = 0x00000200, SCE_NP_CLANS_FIELDS_UPDATABLE_MEMBER_INFO_BIN_DATA1 = 0x00000400, SCE_NP_CLANS_FIELDS_UPDATABLE_MEMBER_INFO_ALLOW_MSG = 0x00000800, @@ -127,13 +127,13 @@ enum enum { - SCE_NP_CLANS_MESSAGE_OPTIONS_NONE = 0x00000000, + SCE_NP_CLANS_MESSAGE_OPTIONS_NONE = 0x00000000, SCE_NP_CLANS_MESSAGE_OPTIONS_CENSOR = 0x00000001, }; enum { - SCE_NP_CLANS_INVALID_ID = 0, + SCE_NP_CLANS_INVALID_ID = 0, SCE_NP_CLANS_INVALID_REQUEST_HANDLE = 0, }; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpCommerce2.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpCommerce2.cpp index d5f3f94f4..799f4d242 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpCommerce2.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpCommerce2.cpp @@ -17,56 +17,56 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](SceNpCommerce2Error value) - { - switch (value) { - STR_CASE(SCE_NP_COMMERCE2_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_COMMERCE2_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_COMMERCE2_ERROR_UNSUPPORTED_VERSION); - STR_CASE(SCE_NP_COMMERCE2_ERROR_CTX_MAX); - STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_INDEX); - STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_SKUID); - STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_SKU_NUM); - STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_MEMORY_CONTAINER); - STR_CASE(SCE_NP_COMMERCE2_ERROR_INSUFFICIENT_MEMORY_CONTAINER); - STR_CASE(SCE_NP_COMMERCE2_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_COMMERCE2_ERROR_CTX_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE2_ERROR_CTXID_NOT_AVAILABLE); - STR_CASE(SCE_NP_COMMERCE2_ERROR_REQ_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE2_ERROR_REQID_NOT_AVAILABLE); - STR_CASE(SCE_NP_COMMERCE2_ERROR_ABORTED); - STR_CASE(SCE_NP_COMMERCE2_ERROR_RESPONSE_BUF_TOO_SMALL); - STR_CASE(SCE_NP_COMMERCE2_ERROR_COULD_NOT_RECV_WHOLE_RESPONSE_DATA); - STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_RESULT_DATA); - STR_CASE(SCE_NP_COMMERCE2_ERROR_UNKNOWN); - STR_CASE(SCE_NP_COMMERCE2_ERROR_SERVER_MAINTENANCE); - STR_CASE(SCE_NP_COMMERCE2_ERROR_SERVER_UNKNOWN); - STR_CASE(SCE_NP_COMMERCE2_ERROR_INSUFFICIENT_BUF_SIZE); - STR_CASE(SCE_NP_COMMERCE2_ERROR_REQ_MAX); - STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_TARGET_TYPE); - STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_TARGET_ID); - STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_SIZE); - STR_CASE(SCE_NP_COMMERCE2_ERROR_DATA_NOT_FOUND); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_BAD_REQUEST); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_UNKNOWN_ERROR); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_SESSION_EXPIRED); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_ACCESS_PERMISSION_DENIED); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_NO_SUCH_CATEGORY); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_NO_SUCH_PRODUCT); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_NOT_ELIGIBILITY); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_INVALID_SKU); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_ACCOUNT_SUSPENDED1); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_ACCOUNT_SUSPENDED2); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_OVER_SPENDING_LIMIT); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_INVALID_VOUCHER); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_VOUCHER_ALREADY_CONSUMED); - STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_EXCEEDS_AGE_LIMIT_IN_BROWSING); - STR_CASE(SCE_NP_COMMERCE2_SYSTEM_UTIL_ERROR_INVALID_VOUCHER); - } + switch (value) + { + STR_CASE(SCE_NP_COMMERCE2_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_COMMERCE2_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_COMMERCE2_ERROR_UNSUPPORTED_VERSION); + STR_CASE(SCE_NP_COMMERCE2_ERROR_CTX_MAX); + STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_INDEX); + STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_SKUID); + STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_SKU_NUM); + STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_MEMORY_CONTAINER); + STR_CASE(SCE_NP_COMMERCE2_ERROR_INSUFFICIENT_MEMORY_CONTAINER); + STR_CASE(SCE_NP_COMMERCE2_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_COMMERCE2_ERROR_CTX_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE2_ERROR_CTXID_NOT_AVAILABLE); + STR_CASE(SCE_NP_COMMERCE2_ERROR_REQ_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE2_ERROR_REQID_NOT_AVAILABLE); + STR_CASE(SCE_NP_COMMERCE2_ERROR_ABORTED); + STR_CASE(SCE_NP_COMMERCE2_ERROR_RESPONSE_BUF_TOO_SMALL); + STR_CASE(SCE_NP_COMMERCE2_ERROR_COULD_NOT_RECV_WHOLE_RESPONSE_DATA); + STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_RESULT_DATA); + STR_CASE(SCE_NP_COMMERCE2_ERROR_UNKNOWN); + STR_CASE(SCE_NP_COMMERCE2_ERROR_SERVER_MAINTENANCE); + STR_CASE(SCE_NP_COMMERCE2_ERROR_SERVER_UNKNOWN); + STR_CASE(SCE_NP_COMMERCE2_ERROR_INSUFFICIENT_BUF_SIZE); + STR_CASE(SCE_NP_COMMERCE2_ERROR_REQ_MAX); + STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_TARGET_TYPE); + STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_TARGET_ID); + STR_CASE(SCE_NP_COMMERCE2_ERROR_INVALID_SIZE); + STR_CASE(SCE_NP_COMMERCE2_ERROR_DATA_NOT_FOUND); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_BAD_REQUEST); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_UNKNOWN_ERROR); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_SESSION_EXPIRED); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_ACCESS_PERMISSION_DENIED); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_NO_SUCH_CATEGORY); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_NO_SUCH_PRODUCT); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_NOT_ELIGIBILITY); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_INVALID_SKU); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_ACCOUNT_SUSPENDED1); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_ACCOUNT_SUSPENDED2); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_OVER_SPENDING_LIMIT); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_INVALID_VOUCHER); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_VOUCHER_ALREADY_CONSUMED); + STR_CASE(SCE_NP_COMMERCE2_SERVER_ERROR_EXCEEDS_AGE_LIMIT_IN_BROWSING); + STR_CASE(SCE_NP_COMMERCE2_SYSTEM_UTIL_ERROR_INVALID_VOUCHER); + } - return unknown; - }); + return unknown; + }); } void initialize_common_data(SceNpCommerce2CommonData* common_data, vm::ptr data, u32 internal_data_addr, u32 internal_data_size) @@ -221,10 +221,10 @@ error_code sceNpCommerce2EmptyStoreCheckStart(u32 ctx_id, s32 store_check_type, if (ctx->context_callback) { sysutil_register_cb([=, context_callback = ctx->context_callback, context_callback_param = ctx->context_callback_param](ppu_thread& cb_ppu) -> s32 - { - context_callback(cb_ppu, ctx_id, 0, SCE_NP_COMMERCE2_EVENT_EMPTY_STORE_CHECK_DONE, 0, context_callback_param); - return 0; - }); + { + context_callback(cb_ppu, ctx_id, 0, SCE_NP_COMMERCE2_EVENT_EMPTY_STORE_CHECK_DONE, 0, context_callback_param); + return 0; + }); } return CELL_OK; @@ -277,10 +277,10 @@ error_code sceNpCommerce2CreateSessionStart(u32 ctx_id) if (ctx->context_callback) { sysutil_register_cb([=, context_callback = ctx->context_callback, context_callback_param = ctx->context_callback_param](ppu_thread& cb_ppu) -> s32 - { - context_callback(cb_ppu, ctx_id, 0, SCE_NP_COMMERCE2_EVENT_CREATE_SESSION_DONE, 0, context_callback_param); - return 0; - }); + { + context_callback(cb_ppu, ctx_id, 0, SCE_NP_COMMERCE2_EVENT_CREATE_SESSION_DONE, 0, context_callback_param); + return 0; + }); } return CELL_OK; @@ -294,7 +294,7 @@ error_code sceNpCommerce2CreateSessionAbort(u32 ctx_id) if (!nph.is_NP_Com2_init) return SCE_NP_COMMERCE2_ERROR_NOT_INITIALIZED; - + const auto ctx = get_commerce2_context(ctx_id); if (!ctx) return SCE_NP_COMMERCE2_ERROR_CTX_NOT_FOUND; @@ -387,7 +387,7 @@ error_code sceNpCommerce2GetCategoryContentsStart(u32 req_id, vm::cptr cat error_code get_result(u32 /* req_id */, vm::ptr buf, u32 buf_size, vm::ptr fill_size) { - if (!buf || !buf_size || ! fill_size) + if (!buf || !buf_size || !fill_size) return SCE_NP_COMMERCE2_ERROR_INVALID_ARGUMENT; // TODO @@ -1068,58 +1068,58 @@ error_code sceNpCommerce2DoServiceListFinishAsync(u32 ctx_id) } DECLARE(ppu_module_manager::sceNpCommerce2)("sceNpCommerce2", []() -{ - 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); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetCategoryContentsCreateReq); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetCategoryContentsStart); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetCategoryContentsGetResult); - REG_FUNC(sceNpCommerce2, sceNpCommerce2InitGetCategoryContentsResult); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetCategoryInfo); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetContentInfo); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetCategoryInfoFromContentInfo); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetGameProductInfoFromContentInfo); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DestroyGetCategoryContentsResult); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetProductInfoCreateReq); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetProductInfoStart); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetProductInfoGetResult); - REG_FUNC(sceNpCommerce2, sceNpCommerce2InitGetProductInfoResult); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetGameProductInfo); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DestroyGetProductInfoResult); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetProductInfoListCreateReq); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetProductInfoListStart); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetProductInfoListGetResult); - REG_FUNC(sceNpCommerce2, sceNpCommerce2InitGetProductInfoListResult); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetGameProductInfoFromGetProductInfoListResult); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DestroyGetProductInfoListResult); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetContentRatingInfoFromGameProductInfo); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetContentRatingInfoFromCategoryInfo); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetContentRatingDescriptor); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetGameSkuInfoFromGameProductInfo); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetPrice); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DoCheckoutStartAsync); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DoCheckoutFinishAsync); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DoProductBrowseStartAsync); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DoProductBrowseFinishAsync); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DoDlListStartAsync); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DoDlListFinishAsync); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DoProductCodeStartAsync); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DoProductCodeFinishAsync); - REG_FUNC(sceNpCommerce2, sceNpCommerce2GetBGDLAvailability); - REG_FUNC(sceNpCommerce2, sceNpCommerce2SetBGDLAvailability); - REG_FUNC(sceNpCommerce2, sceNpCommerce2AbortReq); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DestroyReq); + { + 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); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetCategoryContentsCreateReq); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetCategoryContentsStart); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetCategoryContentsGetResult); + REG_FUNC(sceNpCommerce2, sceNpCommerce2InitGetCategoryContentsResult); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetCategoryInfo); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetContentInfo); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetCategoryInfoFromContentInfo); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetGameProductInfoFromContentInfo); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DestroyGetCategoryContentsResult); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetProductInfoCreateReq); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetProductInfoStart); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetProductInfoGetResult); + REG_FUNC(sceNpCommerce2, sceNpCommerce2InitGetProductInfoResult); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetGameProductInfo); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DestroyGetProductInfoResult); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetProductInfoListCreateReq); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetProductInfoListStart); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetProductInfoListGetResult); + REG_FUNC(sceNpCommerce2, sceNpCommerce2InitGetProductInfoListResult); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetGameProductInfoFromGetProductInfoListResult); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DestroyGetProductInfoListResult); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetContentRatingInfoFromGameProductInfo); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetContentRatingInfoFromCategoryInfo); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetContentRatingDescriptor); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetGameSkuInfoFromGameProductInfo); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetPrice); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DoCheckoutStartAsync); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DoCheckoutFinishAsync); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DoProductBrowseStartAsync); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DoProductBrowseFinishAsync); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DoDlListStartAsync); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DoDlListFinishAsync); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DoProductCodeStartAsync); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DoProductCodeFinishAsync); + REG_FUNC(sceNpCommerce2, sceNpCommerce2GetBGDLAvailability); + REG_FUNC(sceNpCommerce2, sceNpCommerce2SetBGDLAvailability); + REG_FUNC(sceNpCommerce2, sceNpCommerce2AbortReq); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DestroyReq); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DoServiceListStartAsync); - REG_FUNC(sceNpCommerce2, sceNpCommerce2DoServiceListFinishAsync); -}); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DoServiceListStartAsync); + REG_FUNC(sceNpCommerce2, sceNpCommerce2DoServiceListFinishAsync); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpCommerce2.h b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpCommerce2.h index c6600e9cc..ee5ff1000 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpCommerce2.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpCommerce2.h @@ -5,79 +5,79 @@ // Return codes enum SceNpCommerce2Error { - SCE_NP_COMMERCE2_ERROR_NOT_INITIALIZED = 0x80023001, - SCE_NP_COMMERCE2_ERROR_ALREADY_INITIALIZED = 0x80023002, - SCE_NP_COMMERCE2_ERROR_INVALID_ARGUMENT = 0x80023003, - SCE_NP_COMMERCE2_ERROR_UNSUPPORTED_VERSION = 0x80023004, - SCE_NP_COMMERCE2_ERROR_CTX_MAX = 0x80023005, - SCE_NP_COMMERCE2_ERROR_INVALID_INDEX = 0x80023006, - SCE_NP_COMMERCE2_ERROR_INVALID_SKUID = 0x80023007, - SCE_NP_COMMERCE2_ERROR_INVALID_SKU_NUM = 0x80023008, - SCE_NP_COMMERCE2_ERROR_INVALID_MEMORY_CONTAINER = 0x80023009, - SCE_NP_COMMERCE2_ERROR_INSUFFICIENT_MEMORY_CONTAINER = 0x8002300a, - SCE_NP_COMMERCE2_ERROR_OUT_OF_MEMORY = 0x8002300b, - SCE_NP_COMMERCE2_ERROR_CTX_NOT_FOUND = 0x8002300c, - SCE_NP_COMMERCE2_ERROR_CTXID_NOT_AVAILABLE = 0x8002300d, - SCE_NP_COMMERCE2_ERROR_REQ_NOT_FOUND = 0x8002300e, - SCE_NP_COMMERCE2_ERROR_REQID_NOT_AVAILABLE = 0x8002300f, - SCE_NP_COMMERCE2_ERROR_ABORTED = 0x80023010, - SCE_NP_COMMERCE2_ERROR_RESPONSE_BUF_TOO_SMALL = 0x80023012, - SCE_NP_COMMERCE2_ERROR_COULD_NOT_RECV_WHOLE_RESPONSE_DATA = 0x80023013, - SCE_NP_COMMERCE2_ERROR_INVALID_RESULT_DATA = 0x80023014, - SCE_NP_COMMERCE2_ERROR_UNKNOWN = 0x80023015, - SCE_NP_COMMERCE2_ERROR_SERVER_MAINTENANCE = 0x80023016, - SCE_NP_COMMERCE2_ERROR_SERVER_UNKNOWN = 0x80023017, - SCE_NP_COMMERCE2_ERROR_INSUFFICIENT_BUF_SIZE = 0x80023018, - SCE_NP_COMMERCE2_ERROR_REQ_MAX = 0x80023019, - SCE_NP_COMMERCE2_ERROR_INVALID_TARGET_TYPE = 0x8002301a, - SCE_NP_COMMERCE2_ERROR_INVALID_TARGET_ID = 0x8002301b, - SCE_NP_COMMERCE2_ERROR_INVALID_SIZE = 0x8002301c, - SCE_NP_COMMERCE2_ERROR_DATA_NOT_FOUND = 0x80023087, - SCE_NP_COMMERCE2_SERVER_ERROR_BAD_REQUEST = 0x80023101, - SCE_NP_COMMERCE2_SERVER_ERROR_UNKNOWN_ERROR = 0x80023102, - SCE_NP_COMMERCE2_SERVER_ERROR_SESSION_EXPIRED = 0x80023105, - SCE_NP_COMMERCE2_SERVER_ERROR_ACCESS_PERMISSION_DENIED = 0x80023107, - SCE_NP_COMMERCE2_SERVER_ERROR_NO_SUCH_CATEGORY = 0x80023110, - SCE_NP_COMMERCE2_SERVER_ERROR_NO_SUCH_PRODUCT = 0x80023111, - SCE_NP_COMMERCE2_SERVER_ERROR_NOT_ELIGIBILITY = 0x80023113, - SCE_NP_COMMERCE2_SERVER_ERROR_INVALID_SKU = 0x8002311a, - SCE_NP_COMMERCE2_SERVER_ERROR_ACCOUNT_SUSPENDED1 = 0x8002311b, - SCE_NP_COMMERCE2_SERVER_ERROR_ACCOUNT_SUSPENDED2 = 0x8002311c, - SCE_NP_COMMERCE2_SERVER_ERROR_OVER_SPENDING_LIMIT = 0x80023120, - SCE_NP_COMMERCE2_SERVER_ERROR_INVALID_VOUCHER = 0x8002312f, - SCE_NP_COMMERCE2_SERVER_ERROR_VOUCHER_ALREADY_CONSUMED = 0x80023130, + SCE_NP_COMMERCE2_ERROR_NOT_INITIALIZED = 0x80023001, + SCE_NP_COMMERCE2_ERROR_ALREADY_INITIALIZED = 0x80023002, + SCE_NP_COMMERCE2_ERROR_INVALID_ARGUMENT = 0x80023003, + SCE_NP_COMMERCE2_ERROR_UNSUPPORTED_VERSION = 0x80023004, + SCE_NP_COMMERCE2_ERROR_CTX_MAX = 0x80023005, + SCE_NP_COMMERCE2_ERROR_INVALID_INDEX = 0x80023006, + SCE_NP_COMMERCE2_ERROR_INVALID_SKUID = 0x80023007, + SCE_NP_COMMERCE2_ERROR_INVALID_SKU_NUM = 0x80023008, + SCE_NP_COMMERCE2_ERROR_INVALID_MEMORY_CONTAINER = 0x80023009, + SCE_NP_COMMERCE2_ERROR_INSUFFICIENT_MEMORY_CONTAINER = 0x8002300a, + SCE_NP_COMMERCE2_ERROR_OUT_OF_MEMORY = 0x8002300b, + SCE_NP_COMMERCE2_ERROR_CTX_NOT_FOUND = 0x8002300c, + SCE_NP_COMMERCE2_ERROR_CTXID_NOT_AVAILABLE = 0x8002300d, + SCE_NP_COMMERCE2_ERROR_REQ_NOT_FOUND = 0x8002300e, + SCE_NP_COMMERCE2_ERROR_REQID_NOT_AVAILABLE = 0x8002300f, + SCE_NP_COMMERCE2_ERROR_ABORTED = 0x80023010, + SCE_NP_COMMERCE2_ERROR_RESPONSE_BUF_TOO_SMALL = 0x80023012, + SCE_NP_COMMERCE2_ERROR_COULD_NOT_RECV_WHOLE_RESPONSE_DATA = 0x80023013, + SCE_NP_COMMERCE2_ERROR_INVALID_RESULT_DATA = 0x80023014, + SCE_NP_COMMERCE2_ERROR_UNKNOWN = 0x80023015, + SCE_NP_COMMERCE2_ERROR_SERVER_MAINTENANCE = 0x80023016, + SCE_NP_COMMERCE2_ERROR_SERVER_UNKNOWN = 0x80023017, + SCE_NP_COMMERCE2_ERROR_INSUFFICIENT_BUF_SIZE = 0x80023018, + SCE_NP_COMMERCE2_ERROR_REQ_MAX = 0x80023019, + SCE_NP_COMMERCE2_ERROR_INVALID_TARGET_TYPE = 0x8002301a, + SCE_NP_COMMERCE2_ERROR_INVALID_TARGET_ID = 0x8002301b, + SCE_NP_COMMERCE2_ERROR_INVALID_SIZE = 0x8002301c, + SCE_NP_COMMERCE2_ERROR_DATA_NOT_FOUND = 0x80023087, + SCE_NP_COMMERCE2_SERVER_ERROR_BAD_REQUEST = 0x80023101, + SCE_NP_COMMERCE2_SERVER_ERROR_UNKNOWN_ERROR = 0x80023102, + SCE_NP_COMMERCE2_SERVER_ERROR_SESSION_EXPIRED = 0x80023105, + SCE_NP_COMMERCE2_SERVER_ERROR_ACCESS_PERMISSION_DENIED = 0x80023107, + SCE_NP_COMMERCE2_SERVER_ERROR_NO_SUCH_CATEGORY = 0x80023110, + SCE_NP_COMMERCE2_SERVER_ERROR_NO_SUCH_PRODUCT = 0x80023111, + SCE_NP_COMMERCE2_SERVER_ERROR_NOT_ELIGIBILITY = 0x80023113, + SCE_NP_COMMERCE2_SERVER_ERROR_INVALID_SKU = 0x8002311a, + SCE_NP_COMMERCE2_SERVER_ERROR_ACCOUNT_SUSPENDED1 = 0x8002311b, + SCE_NP_COMMERCE2_SERVER_ERROR_ACCOUNT_SUSPENDED2 = 0x8002311c, + SCE_NP_COMMERCE2_SERVER_ERROR_OVER_SPENDING_LIMIT = 0x80023120, + SCE_NP_COMMERCE2_SERVER_ERROR_INVALID_VOUCHER = 0x8002312f, + SCE_NP_COMMERCE2_SERVER_ERROR_VOUCHER_ALREADY_CONSUMED = 0x80023130, SCE_NP_COMMERCE2_SERVER_ERROR_EXCEEDS_AGE_LIMIT_IN_BROWSING = 0x80023139, - SCE_NP_COMMERCE2_SYSTEM_UTIL_ERROR_INVALID_VOUCHER = 0x80024002, + SCE_NP_COMMERCE2_SYSTEM_UTIL_ERROR_INVALID_VOUCHER = 0x80024002, }; // Event types enum { - SCE_NP_COMMERCE2_EVENT_REQUEST_ERROR = 0x0001, - SCE_NP_COMMERCE2_EVENT_CREATE_SESSION_DONE = 0x0011, - SCE_NP_COMMERCE2_EVENT_CREATE_SESSION_ABORT = 0x0012, - SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_STARTED = 0x0021, - SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_SUCCESS = 0x0022, - SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_BACK = 0x0023, - SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_FINISHED = 0x0024, - SCE_NP_COMMERCE2_EVENT_DO_DL_LIST_STARTED = 0x0031, - SCE_NP_COMMERCE2_EVENT_DO_DL_LIST_SUCCESS = 0x0032, - SCE_NP_COMMERCE2_EVENT_DO_DL_LIST_FINISHED = 0x0034, - SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_STARTED = 0x0041, - SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_SUCCESS = 0x0042, - SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_BACK = 0x0043, - SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_FINISHED = 0x0044, - SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_OPENED = 0x0045, - SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_STARTED = 0x0051, - SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_SUCCESS = 0x0052, - SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_BACK = 0x0053, + SCE_NP_COMMERCE2_EVENT_REQUEST_ERROR = 0x0001, + SCE_NP_COMMERCE2_EVENT_CREATE_SESSION_DONE = 0x0011, + SCE_NP_COMMERCE2_EVENT_CREATE_SESSION_ABORT = 0x0012, + SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_STARTED = 0x0021, + SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_SUCCESS = 0x0022, + SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_BACK = 0x0023, + SCE_NP_COMMERCE2_EVENT_DO_CHECKOUT_FINISHED = 0x0024, + SCE_NP_COMMERCE2_EVENT_DO_DL_LIST_STARTED = 0x0031, + SCE_NP_COMMERCE2_EVENT_DO_DL_LIST_SUCCESS = 0x0032, + SCE_NP_COMMERCE2_EVENT_DO_DL_LIST_FINISHED = 0x0034, + SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_STARTED = 0x0041, + SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_SUCCESS = 0x0042, + SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_BACK = 0x0043, + SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_FINISHED = 0x0044, + SCE_NP_COMMERCE2_EVENT_DO_PROD_BROWSE_OPENED = 0x0045, + SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_STARTED = 0x0051, + SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_SUCCESS = 0x0052, + SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_BACK = 0x0053, SCE_NP_COMMERCE2_EVENT_DO_PRODUCT_CODE_FINISHED = 0x0054, - SCE_NP_COMMERCE2_EVENT_EMPTY_STORE_CHECK_DONE = 0x0061, - SCE_NP_COMMERCE2_EVENT_EMPTY_STORE_CHECK_ABORT = 0x0062, - SCE_NP_COMMERCE2_EVENT_RESERVED01_STARTED = 0x0071, - SCE_NP_COMMERCE2_EVENT_RESERVED01_SUCCESS = 0x0072, - SCE_NP_COMMERCE2_EVENT_RESERVED01_BACK = 0x0073, - SCE_NP_COMMERCE2_EVENT_RESERVED01_FINISHED = 0x0074, + SCE_NP_COMMERCE2_EVENT_EMPTY_STORE_CHECK_DONE = 0x0061, + SCE_NP_COMMERCE2_EVENT_EMPTY_STORE_CHECK_ABORT = 0x0062, + SCE_NP_COMMERCE2_EVENT_RESERVED01_STARTED = 0x0071, + SCE_NP_COMMERCE2_EVENT_RESERVED01_SUCCESS = 0x0072, + SCE_NP_COMMERCE2_EVENT_RESERVED01_BACK = 0x0073, + SCE_NP_COMMERCE2_EVENT_RESERVED01_FINISHED = 0x0074, }; // Category data type @@ -112,8 +112,8 @@ enum SCE_NP_COMMERCE2_STORE_CHECK_TYPE_CATEGORY = 1, - SCE_NP_COMMERCE2_STORE_BROWSE_TYPE_CATEGORY = 1, - SCE_NP_COMMERCE2_STORE_BROWSE_TYPE_PRODUCT = 2, + SCE_NP_COMMERCE2_STORE_BROWSE_TYPE_CATEGORY = 1, + SCE_NP_COMMERCE2_STORE_BROWSE_TYPE_PRODUCT = 2, SCE_NP_COMMERCE2_STORE_BROWSE_TYPE_PRODUCT_CODE = 3, }; @@ -121,7 +121,7 @@ enum enum { SCE_NP_COMMERCE2_CONTENT_TYPE_CATEGORY = 1, - SCE_NP_COMMERCE2_CONTENT_TYPE_PRODUCT = 2, + SCE_NP_COMMERCE2_CONTENT_TYPE_PRODUCT = 2, SCE_NP_COMMERCE2_CONTENT_RATING_DESC_TYPE_ICON = 1, SCE_NP_COMMERCE2_CONTENT_RATING_DESC_TYPE_TEXT = 2, @@ -131,54 +131,54 @@ enum enum { SCE_NP_COMMERCE2_SKU_CHECKOUT_MAX = 16, - SCE_NP_COMMERCE2_SKU_DL_LIST_MAX = 16, + SCE_NP_COMMERCE2_SKU_DL_LIST_MAX = 16, - SCE_NP_COMMERCE2_SKU_PURCHASABILITY_FLAG_ON = 1, + SCE_NP_COMMERCE2_SKU_PURCHASABILITY_FLAG_ON = 1, SCE_NP_COMMERCE2_SKU_PURCHASABILITY_FLAG_OFF = 0, SCE_NP_COMMERCE2_SKU_ANN_PURCHASED_CANNOT_PURCHASE_AGAIN = 0x80000000, - SCE_NP_COMMERCE2_SKU_ANN_PURCHASED_CAN_PURCHASE_AGAIN = 0x40000000, - SCE_NP_COMMERCE2_SKU_ANN_IN_THE_CART = 0x20000000, - SCE_NP_COMMERCE2_SKU_ANN_CONTENTLINK_SKU = 0x10000000, - SCE_NP_COMMERCE2_SKU_ANN_CREDIT_CARD_REQUIRED = 0x08000000, - SCE_NP_COMMERCE2_SKU_ANN_CHARGE_IMMEDIATELY = 0x04000000, + SCE_NP_COMMERCE2_SKU_ANN_PURCHASED_CAN_PURCHASE_AGAIN = 0x40000000, + SCE_NP_COMMERCE2_SKU_ANN_IN_THE_CART = 0x20000000, + SCE_NP_COMMERCE2_SKU_ANN_CONTENTLINK_SKU = 0x10000000, + SCE_NP_COMMERCE2_SKU_ANN_CREDIT_CARD_REQUIRED = 0x08000000, + SCE_NP_COMMERCE2_SKU_ANN_CHARGE_IMMEDIATELY = 0x04000000, }; // Constants for commerce functions and structures enum { - SCE_NP_COMMERCE2_VERSION = 2, - SCE_NP_COMMERCE2_CTX_MAX = 1, - SCE_NP_COMMERCE2_REQ_MAX = 1, - SCE_NP_COMMERCE2_CURRENCY_CODE_LEN = 3, - SCE_NP_COMMERCE2_CURRENCY_SYMBOL_LEN = 3, - SCE_NP_COMMERCE2_THOUSAND_SEPARATOR_LEN = 4, - SCE_NP_COMMERCE2_DECIMAL_LETTER_LEN = 4, - SCE_NP_COMMERCE2_SP_NAME_LEN = 256, - SCE_NP_COMMERCE2_CATEGORY_ID_LEN = 56, - SCE_NP_COMMERCE2_CATEGORY_NAME_LEN = 256, - SCE_NP_COMMERCE2_CATEGORY_DESCRIPTION_LEN = 1024, - SCE_NP_COMMERCE2_PRODUCT_ID_LEN = 48, - SCE_NP_COMMERCE2_PRODUCT_NAME_LEN = 256, - SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN = 1024, - SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN = 4000, - SCE_NP_COMMERCE2_SKU_ID_LEN = 56, - SCE_NP_COMMERCE2_SKU_NAME_LEN = 180, - SCE_NP_COMMERCE2_URL_LEN = 256, - SCE_NP_COMMERCE2_RATING_SYSTEM_ID_LEN = 16, - SCE_NP_COMMERCE2_RATING_DESCRIPTION_LEN = 60, - SCE_NP_COMMERCE2_RECV_BUF_SIZE = 262144, - SCE_NP_COMMERCE2_PRODUCT_CODE_BLOCK_LEN = 4, - SCE_NP_COMMERCE2_PRODUCT_CODE_INPUT_MODE_USER_INPUT = 0, + SCE_NP_COMMERCE2_VERSION = 2, + SCE_NP_COMMERCE2_CTX_MAX = 1, + SCE_NP_COMMERCE2_REQ_MAX = 1, + SCE_NP_COMMERCE2_CURRENCY_CODE_LEN = 3, + SCE_NP_COMMERCE2_CURRENCY_SYMBOL_LEN = 3, + SCE_NP_COMMERCE2_THOUSAND_SEPARATOR_LEN = 4, + SCE_NP_COMMERCE2_DECIMAL_LETTER_LEN = 4, + SCE_NP_COMMERCE2_SP_NAME_LEN = 256, + SCE_NP_COMMERCE2_CATEGORY_ID_LEN = 56, + SCE_NP_COMMERCE2_CATEGORY_NAME_LEN = 256, + SCE_NP_COMMERCE2_CATEGORY_DESCRIPTION_LEN = 1024, + SCE_NP_COMMERCE2_PRODUCT_ID_LEN = 48, + SCE_NP_COMMERCE2_PRODUCT_NAME_LEN = 256, + SCE_NP_COMMERCE2_PRODUCT_SHORT_DESCRIPTION_LEN = 1024, + SCE_NP_COMMERCE2_PRODUCT_LONG_DESCRIPTION_LEN = 4000, + SCE_NP_COMMERCE2_SKU_ID_LEN = 56, + SCE_NP_COMMERCE2_SKU_NAME_LEN = 180, + SCE_NP_COMMERCE2_URL_LEN = 256, + SCE_NP_COMMERCE2_RATING_SYSTEM_ID_LEN = 16, + SCE_NP_COMMERCE2_RATING_DESCRIPTION_LEN = 60, + SCE_NP_COMMERCE2_RECV_BUF_SIZE = 262144, + SCE_NP_COMMERCE2_PRODUCT_CODE_BLOCK_LEN = 4, + SCE_NP_COMMERCE2_PRODUCT_CODE_INPUT_MODE_USER_INPUT = 0, SCE_NP_COMMERCE2_PRODUCT_CODE_INPUT_MODE_CODE_SPECIFIED = 1, - SCE_NP_COMMERCE2_GETCAT_MAX_COUNT = 60, - SCE_NP_COMMERCE2_GETPRODLIST_MAX_COUNT = 60, - SCE_NP_COMMERCE2_DO_CHECKOUT_MEMORY_CONTAINER_SIZE = 10485760, - SCE_NP_COMMERCE2_DO_PROD_BROWSE_MEMORY_CONTAINER_SIZE = 16777216, - SCE_NP_COMMERCE2_DO_DL_LIST_MEMORY_CONTAINER_SIZE = 10485760, - SCE_NP_COMMERCE2_DO_PRODUCT_CODE_MEMORY_CONTAINER_SIZE = 16777216, - SCE_NP_COMMERCE2_SYM_POS_PRE = 0, - SCE_NP_COMMERCE2_SYM_POS_POST = 1, + SCE_NP_COMMERCE2_GETCAT_MAX_COUNT = 60, + SCE_NP_COMMERCE2_GETPRODLIST_MAX_COUNT = 60, + SCE_NP_COMMERCE2_DO_CHECKOUT_MEMORY_CONTAINER_SIZE = 10485760, + SCE_NP_COMMERCE2_DO_PROD_BROWSE_MEMORY_CONTAINER_SIZE = 16777216, + SCE_NP_COMMERCE2_DO_DL_LIST_MEMORY_CONTAINER_SIZE = 10485760, + SCE_NP_COMMERCE2_DO_PRODUCT_CODE_MEMORY_CONTAINER_SIZE = 16777216, + SCE_NP_COMMERCE2_SYM_POS_PRE = 0, + SCE_NP_COMMERCE2_SYM_POS_POST = 1, }; // Common structure used when receiving data diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpMatchingInt.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpMatchingInt.cpp index d21f6f7fc..56738a719 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpMatchingInt.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpMatchingInt.cpp @@ -82,19 +82,19 @@ error_code sceNpMatchingCreateRoomWithoutGUI(u32 ctx_id, vm::cptr +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(SCE_NP_SNS_ERROR_UNKNOWN); - STR_CASE(SCE_NP_SNS_ERROR_NOT_SIGN_IN); - STR_CASE(SCE_NP_SNS_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_SNS_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_SNS_ERROR_SHUTDOWN); - STR_CASE(SCE_NP_SNS_ERROR_BUSY); - STR_CASE(SCE_NP_SNS_FB_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_SNS_FB_ERROR_EXCEEDS_MAX); - STR_CASE(SCE_NP_SNS_FB_ERROR_UNKNOWN_HANDLE); - STR_CASE(SCE_NP_SNS_FB_ERROR_ABORTED); - STR_CASE(SCE_NP_SNS_FB_ERROR_ALREADY_ABORTED); - STR_CASE(SCE_NP_SNS_FB_ERROR_CONFIG_DISABLED); - STR_CASE(SCE_NP_SNS_FB_ERROR_FBSERVER_ERROR_RESPONSE); - STR_CASE(SCE_NP_SNS_FB_ERROR_THROTTLE_CLOSED); - STR_CASE(SCE_NP_SNS_FB_ERROR_OPERATION_INTERVAL_VIOLATION); - STR_CASE(SCE_NP_SNS_FB_ERROR_UNLOADED_THROTTLE); - STR_CASE(SCE_NP_SNS_FB_ERROR_ACCESS_NOT_ALLOWED); - } + switch (error) + { + STR_CASE(SCE_NP_SNS_ERROR_UNKNOWN); + STR_CASE(SCE_NP_SNS_ERROR_NOT_SIGN_IN); + STR_CASE(SCE_NP_SNS_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_SNS_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_SNS_ERROR_SHUTDOWN); + STR_CASE(SCE_NP_SNS_ERROR_BUSY); + STR_CASE(SCE_NP_SNS_FB_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_SNS_FB_ERROR_EXCEEDS_MAX); + STR_CASE(SCE_NP_SNS_FB_ERROR_UNKNOWN_HANDLE); + STR_CASE(SCE_NP_SNS_FB_ERROR_ABORTED); + STR_CASE(SCE_NP_SNS_FB_ERROR_ALREADY_ABORTED); + STR_CASE(SCE_NP_SNS_FB_ERROR_CONFIG_DISABLED); + STR_CASE(SCE_NP_SNS_FB_ERROR_FBSERVER_ERROR_RESPONSE); + STR_CASE(SCE_NP_SNS_FB_ERROR_THROTTLE_CLOSED); + STR_CASE(SCE_NP_SNS_FB_ERROR_OPERATION_INTERVAL_VIOLATION); + STR_CASE(SCE_NP_SNS_FB_ERROR_UNLOADED_THROTTLE); + STR_CASE(SCE_NP_SNS_FB_ERROR_ACCESS_NOT_ALLOWED); + } - return unknown; - }); + return unknown; + }); } error_code sceNpSnsFbInit(vm::cptr params) @@ -207,15 +207,15 @@ s32 sceNpSnsFbStreamPublish(u32 handle) // add more arguments return SCE_NP_SNS_FB_ERROR_UNKNOWN_HANDLE; } - //if (canceled) + // if (canceled) //{ // return CELL_ECANCELED; - //} + // } - //if (aborted) + // if (aborted) //{ // return SCE_NP_SNS_FB_ERROR_ABORTED; - //} + // } return CELL_OK; } @@ -265,15 +265,15 @@ s32 sceNpSnsFbLoadThrottle(u32 handle) return SCE_NP_SNS_FB_ERROR_UNKNOWN_HANDLE; } - //if (canceled) + // if (canceled) //{ // return CELL_ECANCELED; - //} + // } - //if (aborted) + // if (aborted) //{ // return SCE_NP_SNS_FB_ERROR_ABORTED; - //} + // } return CELL_OK; } @@ -316,18 +316,17 @@ error_code sceNpSnsFbGetLongAccessToken(u32 handle, vm::cptr +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED); - STR_CASE(SCE_NP_TROPHY_ERROR_NOT_INITIALIZED); - STR_CASE(SCE_NP_TROPHY_ERROR_NOT_SUPPORTED); - STR_CASE(SCE_NP_TROPHY_ERROR_CONTEXT_NOT_REGISTERED); - STR_CASE(SCE_NP_TROPHY_ERROR_OUT_OF_MEMORY); - STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT); - STR_CASE(SCE_NP_TROPHY_ERROR_EXCEEDS_MAX); - STR_CASE(SCE_NP_TROPHY_ERROR_INSUFFICIENT); - STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT); - STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_FORMAT); - STR_CASE(SCE_NP_TROPHY_ERROR_BAD_RESPONSE); - STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_GRADE); - STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_CONTEXT); - STR_CASE(SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED); - STR_CASE(SCE_NP_TROPHY_ERROR_ABORT); - STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE); - STR_CASE(SCE_NP_TROPHY_ERROR_LOCKED); - STR_CASE(SCE_NP_TROPHY_ERROR_HIDDEN); - STR_CASE(SCE_NP_TROPHY_ERROR_CANNOT_UNLOCK_PLATINUM); - STR_CASE(SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED); - STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_TYPE); - STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_HANDLE); - STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_NP_COMM_ID); - STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_NP_COMM_ID); - STR_CASE(SCE_NP_TROPHY_ERROR_DISC_IO); - STR_CASE(SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST); - STR_CASE(SCE_NP_TROPHY_ERROR_UNSUPPORTED_FORMAT); - STR_CASE(SCE_NP_TROPHY_ERROR_ALREADY_INSTALLED); - STR_CASE(SCE_NP_TROPHY_ERROR_BROKEN_DATA); - STR_CASE(SCE_NP_TROPHY_ERROR_VERIFICATION_FAILURE); - STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID); - STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_TROPHY_ID); - STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_TITLE); - STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_FILE); - STR_CASE(SCE_NP_TROPHY_ERROR_DISC_NOT_MOUNTED); - STR_CASE(SCE_NP_TROPHY_ERROR_SHUTDOWN); - STR_CASE(SCE_NP_TROPHY_ERROR_TITLE_ICON_NOT_FOUND); - STR_CASE(SCE_NP_TROPHY_ERROR_TROPHY_ICON_NOT_FOUND); - STR_CASE(SCE_NP_TROPHY_ERROR_INSUFFICIENT_DISK_SPACE); - STR_CASE(SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE); - STR_CASE(SCE_NP_TROPHY_ERROR_SAVEDATA_USER_DOES_NOT_MATCH); - STR_CASE(SCE_NP_TROPHY_ERROR_TROPHY_ID_DOES_NOT_EXIST); - STR_CASE(SCE_NP_TROPHY_ERROR_SERVICE_UNAVAILABLE); - STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN); - } + switch (error) + { + STR_CASE(SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_TROPHY_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_TROPHY_ERROR_NOT_SUPPORTED); + STR_CASE(SCE_NP_TROPHY_ERROR_CONTEXT_NOT_REGISTERED); + STR_CASE(SCE_NP_TROPHY_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_TROPHY_ERROR_EXCEEDS_MAX); + STR_CASE(SCE_NP_TROPHY_ERROR_INSUFFICIENT); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_FORMAT); + STR_CASE(SCE_NP_TROPHY_ERROR_BAD_RESPONSE); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_GRADE); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_CONTEXT); + STR_CASE(SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED); + STR_CASE(SCE_NP_TROPHY_ERROR_ABORT); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE); + STR_CASE(SCE_NP_TROPHY_ERROR_LOCKED); + STR_CASE(SCE_NP_TROPHY_ERROR_HIDDEN); + STR_CASE(SCE_NP_TROPHY_ERROR_CANNOT_UNLOCK_PLATINUM); + STR_CASE(SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_TYPE); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_HANDLE); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_NP_COMM_ID); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_NP_COMM_ID); + STR_CASE(SCE_NP_TROPHY_ERROR_DISC_IO); + STR_CASE(SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST); + STR_CASE(SCE_NP_TROPHY_ERROR_UNSUPPORTED_FORMAT); + STR_CASE(SCE_NP_TROPHY_ERROR_ALREADY_INSTALLED); + STR_CASE(SCE_NP_TROPHY_ERROR_BROKEN_DATA); + STR_CASE(SCE_NP_TROPHY_ERROR_VERIFICATION_FAILURE); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_TROPHY_ID); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_TITLE); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_FILE); + STR_CASE(SCE_NP_TROPHY_ERROR_DISC_NOT_MOUNTED); + STR_CASE(SCE_NP_TROPHY_ERROR_SHUTDOWN); + STR_CASE(SCE_NP_TROPHY_ERROR_TITLE_ICON_NOT_FOUND); + STR_CASE(SCE_NP_TROPHY_ERROR_TROPHY_ICON_NOT_FOUND); + STR_CASE(SCE_NP_TROPHY_ERROR_INSUFFICIENT_DISK_SPACE); + STR_CASE(SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE); + STR_CASE(SCE_NP_TROPHY_ERROR_SAVEDATA_USER_DOES_NOT_MATCH); + STR_CASE(SCE_NP_TROPHY_ERROR_TROPHY_ID_DOES_NOT_EXIST); + STR_CASE(SCE_NP_TROPHY_ERROR_SERVICE_UNAVAILABLE); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN); + } - return unknown; - }); + return unknown; + }); } template <> @@ -365,7 +365,7 @@ error_code sceNpTrophyDestroyHandle(u32 handle) std::scoped_lock lock(trophy_manager.mtx); // TODO: find out if this is checked - //if (!trophy_manager.is_initialized) + // if (!trophy_manager.is_initialized) //{ // return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; //} @@ -399,7 +399,7 @@ error_code sceNpTrophyAbortHandle(u32 handle) std::scoped_lock lock(trophy_manager.mtx); // TODO: find out if this is checked - //if (!trophy_manager.is_initialized) + // if (!trophy_manager.is_initialized) //{ // return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; //} @@ -532,7 +532,7 @@ error_code sceNpTrophyDestroyContext(u32 context) return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; } - if (context < trophy_context_t::id_base || + if (context < trophy_context_t::id_base || context >= trophy_context_t::id_base + trophy_context_t::id_count) { return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT; @@ -711,12 +711,11 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle, // This emulates vsh sending the events and ensures that not 2 events are processed at once const std::pair statuses[] = - { - { SCE_NP_TROPHY_STATUS_PROCESSING_SETUP, 3 }, - { SCE_NP_TROPHY_STATUS_PROCESSING_PROGRESS, ::narrow(tropusr->GetTrophiesCount()) - 1 }, - { SCE_NP_TROPHY_STATUS_PROCESSING_FINALIZE, 4 }, - { SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE, 0 } - }; + { + {SCE_NP_TROPHY_STATUS_PROCESSING_SETUP, 3}, + {SCE_NP_TROPHY_STATUS_PROCESSING_PROGRESS, ::narrow(tropusr->GetTrophiesCount()) - 1}, + {SCE_NP_TROPHY_STATUS_PROCESSING_FINALIZE, 4}, + {SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE, 0}}; lock2.unlock(); @@ -732,17 +731,17 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle, for (s32 completed = 0; completed <= status.second; completed++) { sysutil_register_cb([statusCb, status, context, completed, arg, queued](ppu_thread& cb_ppu) -> s32 - { - // TODO: it is possible that we need to check the return value here as well. - statusCb(cb_ppu, context, status.first, completed, status.second, arg); - - if (queued && (*queued)-- == 1) { - queued->notify_one(); - } + // TODO: it is possible that we need to check the return value here as well. + statusCb(cb_ppu, context, status.first, completed, status.second, arg); - return 0; - }); + if (queued && (*queued)-- == 1) + { + queued->notify_one(); + } + + return 0; + }); } u64 current = get_system_time(); @@ -907,7 +906,7 @@ error_code sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptrnumTrophies++; switch (n->GetAttribute("ttype")[0]) { - case 'B': details->numBronze++; break; - case 'S': details->numSilver++; break; - case 'G': details->numGold++; break; + case 'B': details->numBronze++; break; + case 'S': details->numSilver++; break; + case 'G': details->numGold++; break; case 'P': details->numPlatinum++; break; } } @@ -973,9 +972,9 @@ error_code sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptrunlockedTrophies++; switch (n->GetAttribute("ttype")[0]) { - case 'B': data->unlockedBronze++; break; - case 'S': data->unlockedSilver++; break; - case 'G': data->unlockedGold++; break; + case 'B': data->unlockedBronze++; break; + case 'S': data->unlockedSilver++; break; + case 'G': data->unlockedGold++; break; case 'P': data->unlockedPlatinum++; break; default: break; } @@ -1190,7 +1189,7 @@ static error_code NpTrophyGetTrophyInfo(const trophy_context_t* ctxt, s32 trophy if (!config) { - return { SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST, config_path }; + return {SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST, config_path}; } SceNpTrophyDetails tmp_details{}; @@ -1233,9 +1232,9 @@ static error_code NpTrophyGetTrophyInfo(const trophy_context_t* ctxt, s32 trophy switch (n->GetAttribute("ttype")[0]) { - case 'B': tmp_details.trophyGrade = SCE_NP_TROPHY_GRADE_BRONZE; break; - case 'S': tmp_details.trophyGrade = SCE_NP_TROPHY_GRADE_SILVER; break; - case 'G': tmp_details.trophyGrade = SCE_NP_TROPHY_GRADE_GOLD; break; + case 'B': tmp_details.trophyGrade = SCE_NP_TROPHY_GRADE_BRONZE; break; + case 'S': tmp_details.trophyGrade = SCE_NP_TROPHY_GRADE_SILVER; break; + case 'G': tmp_details.trophyGrade = SCE_NP_TROPHY_GRADE_GOLD; break; case 'P': tmp_details.trophyGrade = SCE_NP_TROPHY_GRADE_PLATINUM; break; default: break; } @@ -1502,28 +1501,27 @@ error_code sceNpTrophyGetTrophyIcon(u32 context, u32 handle, s32 trophyId, vm::p return CELL_OK; } - DECLARE(ppu_module_manager::sceNpTrophy)("sceNpTrophy", []() -{ - REG_FUNC(sceNpTrophy, sceNpTrophyGetGameProgress); - REG_FUNC(sceNpTrophy, sceNpTrophyRegisterContext); - REG_FUNC(sceNpTrophy, sceNpTrophyCreateHandle); - REG_FUNC(sceNpTrophy, sceNpTrophySetSoundLevel); - REG_FUNC(sceNpTrophy, sceNpTrophyGetRequiredDiskSpace); - REG_FUNC(sceNpTrophy, sceNpTrophyDestroyContext); - REG_FUNC(sceNpTrophy, sceNpTrophyInit); - REG_FUNC(sceNpTrophy, sceNpTrophyAbortHandle); - REG_FUNC(sceNpTrophy, sceNpTrophyGetGameInfo); - REG_FUNC(sceNpTrophy, sceNpTrophyDestroyHandle); - REG_FUNC(sceNpTrophy, sceNpTrophyGetGameDetails); - REG_FUNC(sceNpTrophy, sceNpTrophyUnlockTrophy); - REG_FUNC(sceNpTrophy, sceNpTrophyGetLatestTrophies); - REG_FUNC(sceNpTrophy, sceNpTrophyTerm); - REG_FUNC(sceNpTrophy, sceNpTrophyGetTrophyUnlockState); - REG_FUNC(sceNpTrophy, sceNpTrophyGetUserInfo); - REG_FUNC(sceNpTrophy, sceNpTrophyGetTrophyIcon); - REG_FUNC(sceNpTrophy, sceNpTrophyCreateContext); - REG_FUNC(sceNpTrophy, sceNpTrophyGetTrophyDetails); - REG_FUNC(sceNpTrophy, sceNpTrophyGetTrophyInfo); - REG_FUNC(sceNpTrophy, sceNpTrophyGetGameIcon); -}); + { + REG_FUNC(sceNpTrophy, sceNpTrophyGetGameProgress); + REG_FUNC(sceNpTrophy, sceNpTrophyRegisterContext); + REG_FUNC(sceNpTrophy, sceNpTrophyCreateHandle); + REG_FUNC(sceNpTrophy, sceNpTrophySetSoundLevel); + REG_FUNC(sceNpTrophy, sceNpTrophyGetRequiredDiskSpace); + REG_FUNC(sceNpTrophy, sceNpTrophyDestroyContext); + REG_FUNC(sceNpTrophy, sceNpTrophyInit); + REG_FUNC(sceNpTrophy, sceNpTrophyAbortHandle); + REG_FUNC(sceNpTrophy, sceNpTrophyGetGameInfo); + REG_FUNC(sceNpTrophy, sceNpTrophyDestroyHandle); + REG_FUNC(sceNpTrophy, sceNpTrophyGetGameDetails); + REG_FUNC(sceNpTrophy, sceNpTrophyUnlockTrophy); + REG_FUNC(sceNpTrophy, sceNpTrophyGetLatestTrophies); + REG_FUNC(sceNpTrophy, sceNpTrophyTerm); + REG_FUNC(sceNpTrophy, sceNpTrophyGetTrophyUnlockState); + REG_FUNC(sceNpTrophy, sceNpTrophyGetUserInfo); + REG_FUNC(sceNpTrophy, sceNpTrophyGetTrophyIcon); + REG_FUNC(sceNpTrophy, sceNpTrophyCreateContext); + REG_FUNC(sceNpTrophy, sceNpTrophyGetTrophyDetails); + REG_FUNC(sceNpTrophy, sceNpTrophyGetTrophyInfo); + REG_FUNC(sceNpTrophy, sceNpTrophyGetGameIcon); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpTrophy.h b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpTrophy.h index 941727648..278826df3 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpTrophy.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpTrophy.h @@ -10,78 +10,78 @@ // Error codes enum SceNpTrophyError : u32 { - SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED = 0x80022901, - SCE_NP_TROPHY_ERROR_NOT_INITIALIZED = 0x80022902, - SCE_NP_TROPHY_ERROR_NOT_SUPPORTED = 0x80022903, - SCE_NP_TROPHY_ERROR_CONTEXT_NOT_REGISTERED = 0x80022904, - SCE_NP_TROPHY_ERROR_OUT_OF_MEMORY = 0x80022905, - SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT = 0x80022906, - SCE_NP_TROPHY_ERROR_EXCEEDS_MAX = 0x80022907, - SCE_NP_TROPHY_ERROR_INSUFFICIENT = 0x80022909, - SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT = 0x8002290a, - SCE_NP_TROPHY_ERROR_INVALID_FORMAT = 0x8002290b, - SCE_NP_TROPHY_ERROR_BAD_RESPONSE = 0x8002290c, - SCE_NP_TROPHY_ERROR_INVALID_GRADE = 0x8002290d, - SCE_NP_TROPHY_ERROR_INVALID_CONTEXT = 0x8002290e, - SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED = 0x8002290f, - SCE_NP_TROPHY_ERROR_ABORT = 0x80022910, - SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE = 0x80022911, - SCE_NP_TROPHY_ERROR_LOCKED = 0x80022912, - SCE_NP_TROPHY_ERROR_HIDDEN = 0x80022913, - SCE_NP_TROPHY_ERROR_CANNOT_UNLOCK_PLATINUM = 0x80022914, - SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED = 0x80022915, - SCE_NP_TROPHY_ERROR_INVALID_TYPE = 0x80022916, - SCE_NP_TROPHY_ERROR_INVALID_HANDLE = 0x80022917, - SCE_NP_TROPHY_ERROR_INVALID_NP_COMM_ID = 0x80022918, - SCE_NP_TROPHY_ERROR_UNKNOWN_NP_COMM_ID = 0x80022919, - SCE_NP_TROPHY_ERROR_DISC_IO = 0x8002291a, - SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST = 0x8002291b, - SCE_NP_TROPHY_ERROR_UNSUPPORTED_FORMAT = 0x8002291c, - SCE_NP_TROPHY_ERROR_ALREADY_INSTALLED = 0x8002291d, - SCE_NP_TROPHY_ERROR_BROKEN_DATA = 0x8002291e, - SCE_NP_TROPHY_ERROR_VERIFICATION_FAILURE = 0x8002291f, - SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID = 0x80022920, - SCE_NP_TROPHY_ERROR_UNKNOWN_TROPHY_ID = 0x80022921, - SCE_NP_TROPHY_ERROR_UNKNOWN_TITLE = 0x80022922, - SCE_NP_TROPHY_ERROR_UNKNOWN_FILE = 0x80022923, - SCE_NP_TROPHY_ERROR_DISC_NOT_MOUNTED = 0x80022924, - SCE_NP_TROPHY_ERROR_SHUTDOWN = 0x80022925, - SCE_NP_TROPHY_ERROR_TITLE_ICON_NOT_FOUND = 0x80022926, - SCE_NP_TROPHY_ERROR_TROPHY_ICON_NOT_FOUND = 0x80022927, - SCE_NP_TROPHY_ERROR_INSUFFICIENT_DISK_SPACE = 0x80022928, - SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE = 0x8002292a, + SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED = 0x80022901, + SCE_NP_TROPHY_ERROR_NOT_INITIALIZED = 0x80022902, + SCE_NP_TROPHY_ERROR_NOT_SUPPORTED = 0x80022903, + SCE_NP_TROPHY_ERROR_CONTEXT_NOT_REGISTERED = 0x80022904, + SCE_NP_TROPHY_ERROR_OUT_OF_MEMORY = 0x80022905, + SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT = 0x80022906, + SCE_NP_TROPHY_ERROR_EXCEEDS_MAX = 0x80022907, + SCE_NP_TROPHY_ERROR_INSUFFICIENT = 0x80022909, + SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT = 0x8002290a, + SCE_NP_TROPHY_ERROR_INVALID_FORMAT = 0x8002290b, + SCE_NP_TROPHY_ERROR_BAD_RESPONSE = 0x8002290c, + SCE_NP_TROPHY_ERROR_INVALID_GRADE = 0x8002290d, + SCE_NP_TROPHY_ERROR_INVALID_CONTEXT = 0x8002290e, + SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED = 0x8002290f, + SCE_NP_TROPHY_ERROR_ABORT = 0x80022910, + SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE = 0x80022911, + SCE_NP_TROPHY_ERROR_LOCKED = 0x80022912, + SCE_NP_TROPHY_ERROR_HIDDEN = 0x80022913, + SCE_NP_TROPHY_ERROR_CANNOT_UNLOCK_PLATINUM = 0x80022914, + SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED = 0x80022915, + SCE_NP_TROPHY_ERROR_INVALID_TYPE = 0x80022916, + SCE_NP_TROPHY_ERROR_INVALID_HANDLE = 0x80022917, + SCE_NP_TROPHY_ERROR_INVALID_NP_COMM_ID = 0x80022918, + SCE_NP_TROPHY_ERROR_UNKNOWN_NP_COMM_ID = 0x80022919, + SCE_NP_TROPHY_ERROR_DISC_IO = 0x8002291a, + SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST = 0x8002291b, + SCE_NP_TROPHY_ERROR_UNSUPPORTED_FORMAT = 0x8002291c, + SCE_NP_TROPHY_ERROR_ALREADY_INSTALLED = 0x8002291d, + SCE_NP_TROPHY_ERROR_BROKEN_DATA = 0x8002291e, + SCE_NP_TROPHY_ERROR_VERIFICATION_FAILURE = 0x8002291f, + SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID = 0x80022920, + SCE_NP_TROPHY_ERROR_UNKNOWN_TROPHY_ID = 0x80022921, + SCE_NP_TROPHY_ERROR_UNKNOWN_TITLE = 0x80022922, + SCE_NP_TROPHY_ERROR_UNKNOWN_FILE = 0x80022923, + SCE_NP_TROPHY_ERROR_DISC_NOT_MOUNTED = 0x80022924, + SCE_NP_TROPHY_ERROR_SHUTDOWN = 0x80022925, + SCE_NP_TROPHY_ERROR_TITLE_ICON_NOT_FOUND = 0x80022926, + SCE_NP_TROPHY_ERROR_TROPHY_ICON_NOT_FOUND = 0x80022927, + SCE_NP_TROPHY_ERROR_INSUFFICIENT_DISK_SPACE = 0x80022928, + SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE = 0x8002292a, SCE_NP_TROPHY_ERROR_SAVEDATA_USER_DOES_NOT_MATCH = 0x8002292b, - SCE_NP_TROPHY_ERROR_TROPHY_ID_DOES_NOT_EXIST = 0x8002292c, - SCE_NP_TROPHY_ERROR_SERVICE_UNAVAILABLE = 0x8002292d, - SCE_NP_TROPHY_ERROR_UNKNOWN = 0x800229ff, + SCE_NP_TROPHY_ERROR_TROPHY_ID_DOES_NOT_EXIST = 0x8002292c, + SCE_NP_TROPHY_ERROR_SERVICE_UNAVAILABLE = 0x8002292d, + SCE_NP_TROPHY_ERROR_UNKNOWN = 0x800229ff, }; enum { - SCE_NP_TROPHY_TITLE_MAX_SIZE = 128, - SCE_NP_TROPHY_GAME_DESCR_MAX_SIZE = 1024, - SCE_NP_TROPHY_NAME_MAX_SIZE = 128, - SCE_NP_TROPHY_DESCR_MAX_SIZE = 1024, + SCE_NP_TROPHY_TITLE_MAX_SIZE = 128, + SCE_NP_TROPHY_GAME_DESCR_MAX_SIZE = 1024, + SCE_NP_TROPHY_NAME_MAX_SIZE = 128, + SCE_NP_TROPHY_DESCR_MAX_SIZE = 1024, - SCE_NP_TROPHY_FLAG_SETSIZE = 128, - SCE_NP_TROPHY_FLAG_BITS_SHIFT = 5, + SCE_NP_TROPHY_FLAG_SETSIZE = 128, + SCE_NP_TROPHY_FLAG_BITS_SHIFT = 5, - SCE_NP_TROPHY_INVALID_CONTEXT = 0, - SCE_NP_TROPHY_INVALID_HANDLE = 0, + SCE_NP_TROPHY_INVALID_CONTEXT = 0, + SCE_NP_TROPHY_INVALID_HANDLE = 0, }; enum : u32 { - SCE_NP_TROPHY_INVALID_TROPHY_ID = 0xffffffff, + SCE_NP_TROPHY_INVALID_TROPHY_ID = 0xffffffff, }; enum SceNpTrophyGrade { - SCE_NP_TROPHY_GRADE_UNKNOWN = 0, - SCE_NP_TROPHY_GRADE_PLATINUM = 1, - SCE_NP_TROPHY_GRADE_GOLD = 2, - SCE_NP_TROPHY_GRADE_SILVER = 3, - SCE_NP_TROPHY_GRADE_BRONZE = 4, + SCE_NP_TROPHY_GRADE_UNKNOWN = 0, + SCE_NP_TROPHY_GRADE_PLATINUM = 1, + SCE_NP_TROPHY_GRADE_GOLD = 2, + SCE_NP_TROPHY_GRADE_SILVER = 3, + SCE_NP_TROPHY_GRADE_BRONZE = 4, }; enum @@ -114,8 +114,8 @@ struct SceNpTrophyGameData struct SceNpTrophyDetails { - be_t trophyId; // SceNpTrophyId - be_t trophyGrade; // SceNpTrophyGrade + be_t trophyId; // SceNpTrophyId + be_t trophyGrade; // SceNpTrophyGrade char name[SCE_NP_TROPHY_NAME_MAX_SIZE]; char description[SCE_NP_TROPHY_DESCR_MAX_SIZE]; b8 hidden; @@ -124,8 +124,8 @@ struct SceNpTrophyDetails struct SceNpTrophyData { - be_t timestamp; // CellRtcTick - be_t trophyId; // SceNpTrophyId + be_t timestamp; // CellRtcTick + be_t trophyId; // SceNpTrophyId b8 unlocked; u8 reserved[3]; }; @@ -137,19 +137,19 @@ struct SceNpTrophyFlagArray enum { - SCE_NP_TROPHY_STATUS_UNKNOWN = 0, - SCE_NP_TROPHY_STATUS_NOT_INSTALLED = 1, - SCE_NP_TROPHY_STATUS_DATA_CORRUPT = 2, - SCE_NP_TROPHY_STATUS_INSTALLED = 3, - SCE_NP_TROPHY_STATUS_REQUIRES_UPDATE = 4, + SCE_NP_TROPHY_STATUS_UNKNOWN = 0, + SCE_NP_TROPHY_STATUS_NOT_INSTALLED = 1, + SCE_NP_TROPHY_STATUS_DATA_CORRUPT = 2, + SCE_NP_TROPHY_STATUS_INSTALLED = 3, + SCE_NP_TROPHY_STATUS_REQUIRES_UPDATE = 4, - SCE_NP_TROPHY_STATUS_PROCESSING_SETUP = 5, + SCE_NP_TROPHY_STATUS_PROCESSING_SETUP = 5, SCE_NP_TROPHY_STATUS_PROCESSING_PROGRESS = 6, SCE_NP_TROPHY_STATUS_PROCESSING_FINALIZE = 7, SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE = 8, - SCE_NP_TROPHY_STATUS_CHANGES_DETECTED = 9, + SCE_NP_TROPHY_STATUS_CHANGES_DETECTED = 9, }; enum : u32 diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpTus.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpTus.cpp index ee82e1093..ae789eaa7 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpTus.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpTus.cpp @@ -273,7 +273,7 @@ error_code sceNpTusPollAsync(s32 transId, vm::ptr result) return CELL_OK; } -template +template error_code scenp_tus_set_multislot_variable(s32 transId, T targetNpId, vm::cptr slotIdArray, vm::cptr variableArray, s32 arrayNum, vm::ptr option, bool vuser, bool async) { if (!slotIdArray || !variableArray) @@ -355,7 +355,7 @@ error_code sceNpTusSetMultiSlotVariableVUserAsync(s32 transId, vm::cptr +template error_code scenp_tus_get_multislot_variable(s32 transId, T targetNpId, vm::cptr slotIdArray, vm::ptr variableArray, u32 variableArraySize, s32 arrayNum, vm::ptr option, bool vuser, bool async) { if (!slotIdArray || !variableArray) @@ -442,7 +442,7 @@ error_code sceNpTusGetMultiSlotVariableVUserAsync(s32 transId, vm::cptr +template error_code scenp_tus_get_multiuser_variable(s32 transId, T targetNpIdArray, SceNpTusSlotId slotId, vm::ptr variableArray, u32 variableArraySize, s32 arrayNum, vm::ptr option, bool vuser, bool async) { if (!variableArray) @@ -616,7 +616,7 @@ error_code sceNpTusGetFriendsVariableAsync(s32 transId, SceNpTusSlotId slotId, s return scenp_tus_get_friends_variable(transId, slotId, includeSelf, sortType, variableArray, variableArraySize, arrayNum, option, true); } -template +template error_code scenp_tus_add_and_get_variable(s32 transId, T targetNpId, SceNpTusSlotId slotId, s64 inVariable, vm::ptr outVariable, u32 outVariableSize, vm::ptr option, bool vuser, bool async) { auto& nph = g_fxo->get>(); @@ -688,7 +688,7 @@ error_code sceNpTusAddAndGetVariableVUserAsync(s32 transId, vm::cptr +template error_code scenp_tus_try_and_set_variable(s32 transId, T targetNpId, SceNpTusSlotId slotId, s32 opeType, s64 variable, vm::ptr resultVariable, u32 resultVariableSize, vm::ptr option, bool vuser, bool async) { auto& nph = g_fxo->get>(); @@ -765,7 +765,7 @@ error_code sceNpTusTryAndSetVariableVUserAsync(s32 transId, vm::cptr +template error_code scenp_tus_delete_multislot_variable(s32 transId, T targetNpId, vm::cptr slotIdArray, s32 arrayNum, vm::ptr option, bool vuser, bool async) { if (!slotIdArray) @@ -842,7 +842,7 @@ error_code sceNpTusDeleteMultiSlotVariableVUserAsync(s32 transId, vm::cptr +template error_code scenp_tus_set_data(s32 transId, T targetNpId, SceNpTusSlotId slotId, u32 totalSize, u32 sendSize, vm::cptr data, vm::cptr info, u32 infoStructSize, vm::ptr option, bool vuser, bool async) { if (slotId < 0 || !data || !totalSize) @@ -914,7 +914,7 @@ error_code sceNpTusSetDataVUserAsync(s32 transId, vm::cptr +template error_code scenp_tus_get_data(s32 transId, T targetNpId, SceNpTusSlotId slotId, vm::ptr dataStatus, u32 dataStatusSize, vm::ptr data, u32 recvSize, vm::ptr option, bool vuser, bool async) { if (!targetNpId) @@ -986,7 +986,7 @@ error_code sceNpTusGetDataVUserAsync(s32 transId, vm::cptr +template error_code scenp_tus_get_multislot_data_status(s32 transId, T targetNpId, vm::cptr slotIdArray, vm::ptr statusArray, u32 statusArraySize, s32 arrayNum, vm::ptr option, bool vuser, bool async) { if (!slotIdArray || !statusArray) @@ -1073,7 +1073,7 @@ error_code sceNpTusGetMultiSlotDataStatusVUserAsync(s32 transId, vm::cptr +template error_code scenp_tus_get_multiuser_data_status(s32 transId, T targetNpIdArray, SceNpTusSlotId slotId, vm::ptr statusArray, u32 statusArraySize, s32 arrayNum, vm::ptr option, bool vuser, bool async) { if (!statusArray) @@ -1247,7 +1247,7 @@ error_code sceNpTusGetFriendsDataStatusAsync(s32 transId, SceNpTusSlotId slotId, return scenp_tus_get_friends_data_status(transId, slotId, includeSelf, sortType, statusArray, statusArraySize, arrayNum, option, true); } -template +template error_code scenp_tus_delete_multislot_data(s32 transId, T targetNpId, vm::cptr slotIdArray, s32 arrayNum, vm::ptr option, bool vuser, bool async) { if (!slotIdArray) @@ -1300,7 +1300,6 @@ error_code scenp_tus_delete_multislot_data(s32 transId, T targetNpId, vm::cptrresult; } - error_code sceNpTusDeleteMultiSlotData(s32 transId, vm::cptr targetNpId, vm::cptr slotIdArray, s32 arrayNum, vm::ptr option) { sceNpTus.warning("sceNpTusDeleteMultiSlotData(transId=%d, targetNpId=*0x%x, slotIdArray=*0x%x, arrayNum=%d, option=*0x%x)", transId, targetNpId, slotIdArray, arrayNum, option); @@ -1410,69 +1409,68 @@ error_code sceNpTssGetDataNoLimitAsync() return CELL_OK; } - DECLARE(ppu_module_manager::sceNpTus)("sceNpTus", []() -{ - REG_FUNC(sceNpTus, sceNpTusInit); - REG_FUNC(sceNpTus, sceNpTusTerm); - REG_FUNC(sceNpTus, sceNpTusCreateTitleCtx); - REG_FUNC(sceNpTus, sceNpTusDestroyTitleCtx); - REG_FUNC(sceNpTus, sceNpTusCreateTransactionCtx); - REG_FUNC(sceNpTus, sceNpTusDestroyTransactionCtx); - REG_FUNC(sceNpTus, sceNpTusSetTimeout); - REG_FUNC(sceNpTus, sceNpTusAbortTransaction); - REG_FUNC(sceNpTus, sceNpTusWaitAsync); - REG_FUNC(sceNpTus, sceNpTusPollAsync); - REG_FUNC(sceNpTus, sceNpTusSetMultiSlotVariable); - REG_FUNC(sceNpTus, sceNpTusSetMultiSlotVariableVUser); - REG_FUNC(sceNpTus, sceNpTusSetMultiSlotVariableAsync); - REG_FUNC(sceNpTus, sceNpTusSetMultiSlotVariableVUserAsync); - REG_FUNC(sceNpTus, sceNpTusGetMultiSlotVariable); - REG_FUNC(sceNpTus, sceNpTusGetMultiSlotVariableVUser); - REG_FUNC(sceNpTus, sceNpTusGetMultiSlotVariableAsync); - REG_FUNC(sceNpTus, sceNpTusGetMultiSlotVariableVUserAsync); - REG_FUNC(sceNpTus, sceNpTusGetMultiUserVariable); - REG_FUNC(sceNpTus, sceNpTusGetMultiUserVariableVUser); - REG_FUNC(sceNpTus, sceNpTusGetMultiUserVariableAsync); - REG_FUNC(sceNpTus, sceNpTusGetMultiUserVariableVUserAsync); - REG_FUNC(sceNpTus, sceNpTusGetFriendsVariable); - REG_FUNC(sceNpTus, sceNpTusGetFriendsVariableAsync); - REG_FUNC(sceNpTus, sceNpTusAddAndGetVariable); - REG_FUNC(sceNpTus, sceNpTusAddAndGetVariableVUser); - REG_FUNC(sceNpTus, sceNpTusAddAndGetVariableAsync); - REG_FUNC(sceNpTus, sceNpTusAddAndGetVariableVUserAsync); - REG_FUNC(sceNpTus, sceNpTusTryAndSetVariable); - REG_FUNC(sceNpTus, sceNpTusTryAndSetVariableVUser); - REG_FUNC(sceNpTus, sceNpTusTryAndSetVariableAsync); - REG_FUNC(sceNpTus, sceNpTusTryAndSetVariableVUserAsync); - REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotVariable); - REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotVariableVUser); - REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotVariableAsync); - REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotVariableVUserAsync); - REG_FUNC(sceNpTus, sceNpTusSetData); - REG_FUNC(sceNpTus, sceNpTusSetDataVUser); - REG_FUNC(sceNpTus, sceNpTusSetDataAsync); - REG_FUNC(sceNpTus, sceNpTusSetDataVUserAsync); - REG_FUNC(sceNpTus, sceNpTusGetData); - REG_FUNC(sceNpTus, sceNpTusGetDataVUser); - REG_FUNC(sceNpTus, sceNpTusGetDataAsync); - REG_FUNC(sceNpTus, sceNpTusGetDataVUserAsync); - REG_FUNC(sceNpTus, sceNpTusGetMultiSlotDataStatus); - REG_FUNC(sceNpTus, sceNpTusGetMultiSlotDataStatusVUser); - REG_FUNC(sceNpTus, sceNpTusGetMultiSlotDataStatusAsync); - REG_FUNC(sceNpTus, sceNpTusGetMultiSlotDataStatusVUserAsync); - REG_FUNC(sceNpTus, sceNpTusGetMultiUserDataStatus); - REG_FUNC(sceNpTus, sceNpTusGetMultiUserDataStatusVUser); - REG_FUNC(sceNpTus, sceNpTusGetMultiUserDataStatusAsync); - REG_FUNC(sceNpTus, sceNpTusGetMultiUserDataStatusVUserAsync); - REG_FUNC(sceNpTus, sceNpTusGetFriendsDataStatus); - REG_FUNC(sceNpTus, sceNpTusGetFriendsDataStatusAsync); - REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotData); - REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotDataVUser); - REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotDataAsync); - REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotDataVUserAsync); - REG_FUNC(sceNpTus, sceNpTssGetData); - REG_FUNC(sceNpTus, sceNpTssGetDataAsync); - REG_FUNC(sceNpTus, sceNpTssGetDataNoLimit); - REG_FUNC(sceNpTus, sceNpTssGetDataNoLimitAsync); -}); + { + REG_FUNC(sceNpTus, sceNpTusInit); + REG_FUNC(sceNpTus, sceNpTusTerm); + REG_FUNC(sceNpTus, sceNpTusCreateTitleCtx); + REG_FUNC(sceNpTus, sceNpTusDestroyTitleCtx); + REG_FUNC(sceNpTus, sceNpTusCreateTransactionCtx); + REG_FUNC(sceNpTus, sceNpTusDestroyTransactionCtx); + REG_FUNC(sceNpTus, sceNpTusSetTimeout); + REG_FUNC(sceNpTus, sceNpTusAbortTransaction); + REG_FUNC(sceNpTus, sceNpTusWaitAsync); + REG_FUNC(sceNpTus, sceNpTusPollAsync); + REG_FUNC(sceNpTus, sceNpTusSetMultiSlotVariable); + REG_FUNC(sceNpTus, sceNpTusSetMultiSlotVariableVUser); + REG_FUNC(sceNpTus, sceNpTusSetMultiSlotVariableAsync); + REG_FUNC(sceNpTus, sceNpTusSetMultiSlotVariableVUserAsync); + REG_FUNC(sceNpTus, sceNpTusGetMultiSlotVariable); + REG_FUNC(sceNpTus, sceNpTusGetMultiSlotVariableVUser); + REG_FUNC(sceNpTus, sceNpTusGetMultiSlotVariableAsync); + REG_FUNC(sceNpTus, sceNpTusGetMultiSlotVariableVUserAsync); + REG_FUNC(sceNpTus, sceNpTusGetMultiUserVariable); + REG_FUNC(sceNpTus, sceNpTusGetMultiUserVariableVUser); + REG_FUNC(sceNpTus, sceNpTusGetMultiUserVariableAsync); + REG_FUNC(sceNpTus, sceNpTusGetMultiUserVariableVUserAsync); + REG_FUNC(sceNpTus, sceNpTusGetFriendsVariable); + REG_FUNC(sceNpTus, sceNpTusGetFriendsVariableAsync); + REG_FUNC(sceNpTus, sceNpTusAddAndGetVariable); + REG_FUNC(sceNpTus, sceNpTusAddAndGetVariableVUser); + REG_FUNC(sceNpTus, sceNpTusAddAndGetVariableAsync); + REG_FUNC(sceNpTus, sceNpTusAddAndGetVariableVUserAsync); + REG_FUNC(sceNpTus, sceNpTusTryAndSetVariable); + REG_FUNC(sceNpTus, sceNpTusTryAndSetVariableVUser); + REG_FUNC(sceNpTus, sceNpTusTryAndSetVariableAsync); + REG_FUNC(sceNpTus, sceNpTusTryAndSetVariableVUserAsync); + REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotVariable); + REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotVariableVUser); + REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotVariableAsync); + REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotVariableVUserAsync); + REG_FUNC(sceNpTus, sceNpTusSetData); + REG_FUNC(sceNpTus, sceNpTusSetDataVUser); + REG_FUNC(sceNpTus, sceNpTusSetDataAsync); + REG_FUNC(sceNpTus, sceNpTusSetDataVUserAsync); + REG_FUNC(sceNpTus, sceNpTusGetData); + REG_FUNC(sceNpTus, sceNpTusGetDataVUser); + REG_FUNC(sceNpTus, sceNpTusGetDataAsync); + REG_FUNC(sceNpTus, sceNpTusGetDataVUserAsync); + REG_FUNC(sceNpTus, sceNpTusGetMultiSlotDataStatus); + REG_FUNC(sceNpTus, sceNpTusGetMultiSlotDataStatusVUser); + REG_FUNC(sceNpTus, sceNpTusGetMultiSlotDataStatusAsync); + REG_FUNC(sceNpTus, sceNpTusGetMultiSlotDataStatusVUserAsync); + REG_FUNC(sceNpTus, sceNpTusGetMultiUserDataStatus); + REG_FUNC(sceNpTus, sceNpTusGetMultiUserDataStatusVUser); + REG_FUNC(sceNpTus, sceNpTusGetMultiUserDataStatusAsync); + REG_FUNC(sceNpTus, sceNpTusGetMultiUserDataStatusVUserAsync); + REG_FUNC(sceNpTus, sceNpTusGetFriendsDataStatus); + REG_FUNC(sceNpTus, sceNpTusGetFriendsDataStatusAsync); + REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotData); + REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotDataVUser); + REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotDataAsync); + REG_FUNC(sceNpTus, sceNpTusDeleteMultiSlotDataVUserAsync); + REG_FUNC(sceNpTus, sceNpTssGetData); + REG_FUNC(sceNpTus, sceNpTssGetDataAsync); + REG_FUNC(sceNpTus, sceNpTssGetDataNoLimit); + REG_FUNC(sceNpTus, sceNpTssGetDataNoLimitAsync); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpUtil.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpUtil.cpp index b26d604a2..5fbc40aee 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sceNpUtil.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sceNpUtil.cpp @@ -150,9 +150,9 @@ error_code sceNpUtilBandwidthTestAbort() } DECLARE(ppu_module_manager::sceNpUtil)("sceNpUtil", []() -{ - REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestInitStart); - REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestShutdown); - REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestGetStatus); - REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestAbort); -}); + { + REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestInitStart); + REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestShutdown); + REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestGetStatus); + REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestAbort); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sysPrxForUser.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sysPrxForUser.cpp index 483fcfe1e..313801bc4 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sysPrxForUser.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sysPrxForUser.cpp @@ -83,7 +83,9 @@ error_code sys_get_random_number(vm::ptr addr, u64 size) case 0x80010501: return CELL_ENOMEM; case 0x80010503: return CELL_EAGAIN; case 0x80010509: return CELL_EINVAL; - default: if (rs) return CELL_EABORT; + default: + if (rs) + return CELL_EABORT; } return CELL_OK; @@ -182,69 +184,69 @@ extern void sysPrxForUser_sys_libc_init(); extern void sysPrxForUser_sys_rsxaudio_init(); DECLARE(ppu_module_manager::sysPrxForUser)("sysPrxForUser", [](ppu_static_module* _this) -{ - static ppu_static_module cellGamePs1Emu("cellGamePs1Emu", []() { - REG_FNID(cellGamePs1Emu, 0x61CE2BCD, cellGamePs1Emu_61CE2BCD); + static ppu_static_module cellGamePs1Emu("cellGamePs1Emu", []() + { + REG_FNID(cellGamePs1Emu, 0x61CE2BCD, cellGamePs1Emu_61CE2BCD); + }); + + static ppu_static_module cellSysconfPs1emu("cellSysconfPs1emu", []() + { + REG_FNID(cellSysconfPs1emu, 0x639ABBDE, cellSysconfPs1emu_639ABBDE); + REG_FNID(cellSysconfPs1emu, 0x6A12D11F, cellSysconfPs1emu_6A12D11F); + REG_FNID(cellSysconfPs1emu, 0x83E79A23, cellSysconfPs1emu_83E79A23); + REG_FNID(cellSysconfPs1emu, 0xEFDDAF6C, cellSysconfPs1emu_EFDDAF6C); + }); + + static ppu_static_module sys_lv2coredump("sys_lv2coredump", []() + { + REG_FNID(sys_lv2coredump, 0xD725F320, sys_lv2coredump_D725F320); + }); + + static ppu_static_module sysBdMediaId("sysBdMediaId", []() + { + REG_FUNC(sysBdMediaId, sys_get_bd_media_id); + }); + + static ppu_static_module sysConsoleId("sysConsoleId", []() + { + REG_FUNC(sysConsoleId, sys_get_console_id); + }); + + static ppu_static_module sysPs2Disc("sysPs2Disc", []() + { + REG_FNID(sysPs2Disc, 0xA84FD3C3, sysPs2Disc_A84FD3C3); + REG_FNID(sysPs2Disc, 0xBB7CD1AE, sysPs2Disc_BB7CD1AE); + }); + + sysPrxForUser_sys_lwmutex_init(_this); + sysPrxForUser_sys_lwcond_init(_this); + 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(); + sysPrxForUser_sys_rsxaudio_init(); + + REG_VAR(sysPrxForUser, sys_prx_version); // 0x7df066cf + REG_VAR(sysPrxForUser, g_ppu_atexitspawn).flag(MFF_HIDDEN); + REG_VAR(sysPrxForUser, g_ppu_at_Exitspawn).flag(MFF_HIDDEN); + + REG_FUNC(sysPrxForUser, sys_time_get_system_time); + + 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_get_random_number); + + REG_FUNC(sysPrxForUser, console_getc); + REG_FUNC(sysPrxForUser, console_putc); + REG_FUNC(sysPrxForUser, console_write); }); - - static ppu_static_module cellSysconfPs1emu("cellSysconfPs1emu", []() - { - REG_FNID(cellSysconfPs1emu, 0x639ABBDE, cellSysconfPs1emu_639ABBDE); - REG_FNID(cellSysconfPs1emu, 0x6A12D11F, cellSysconfPs1emu_6A12D11F); - REG_FNID(cellSysconfPs1emu, 0x83E79A23, cellSysconfPs1emu_83E79A23); - REG_FNID(cellSysconfPs1emu, 0xEFDDAF6C, cellSysconfPs1emu_EFDDAF6C); - }); - - static ppu_static_module sys_lv2coredump("sys_lv2coredump", []() - { - REG_FNID(sys_lv2coredump, 0xD725F320, sys_lv2coredump_D725F320); - }); - - static ppu_static_module sysBdMediaId("sysBdMediaId", []() - { - REG_FUNC(sysBdMediaId, sys_get_bd_media_id); - }); - - static ppu_static_module sysConsoleId("sysConsoleId", []() - { - REG_FUNC(sysConsoleId, sys_get_console_id); - }); - - static ppu_static_module sysPs2Disc("sysPs2Disc", []() - { - REG_FNID(sysPs2Disc, 0xA84FD3C3, sysPs2Disc_A84FD3C3); - REG_FNID(sysPs2Disc, 0xBB7CD1AE, sysPs2Disc_BB7CD1AE); - }); - - sysPrxForUser_sys_lwmutex_init(_this); - sysPrxForUser_sys_lwcond_init(_this); - 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(); - sysPrxForUser_sys_rsxaudio_init(); - - REG_VAR(sysPrxForUser, sys_prx_version); // 0x7df066cf - REG_VAR(sysPrxForUser, g_ppu_atexitspawn).flag(MFF_HIDDEN); - REG_VAR(sysPrxForUser, g_ppu_at_Exitspawn).flag(MFF_HIDDEN); - - REG_FUNC(sysPrxForUser, sys_time_get_system_time); - - 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_get_random_number); - - REG_FUNC(sysPrxForUser, console_getc); - REG_FUNC(sysPrxForUser, console_putc); - REG_FUNC(sysPrxForUser, console_write); -}); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sysPrxForUser.h b/rpcs3/rpcs3/Emu/Cell/Modules/sysPrxForUser.h index 8870277d5..5207e462e 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sysPrxForUser.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sysPrxForUser.h @@ -36,8 +36,7 @@ struct sys_lwmutex_locker vm::ptr mutex; sys_lwmutex_locker(ppu_thread& ppu, vm::ptr mutex) - : ppu(ppu) - , mutex(mutex) + : ppu(ppu), mutex(mutex) { ensure(sys_lwmutex_lock(ppu, mutex, 0) == CELL_OK); } @@ -48,7 +47,6 @@ struct sys_lwmutex_locker } }; - struct sys_lwcond_t; struct sys_lwcond_attribute_t; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_crashdump.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sys_crashdump.cpp index ddf0680f5..37ff2b156 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_crashdump.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_crashdump.cpp @@ -28,8 +28,8 @@ error_code sys_crash_dump_set_user_log_area(u8 index, vm::ptr> g_ppu_at_Exitspawn; static u32 get_string_array_size(vm::cpptr list, u32& out_count) { - //out_count = 0; + // out_count = 0; u32 result = 8; for (u32 i = 0; list; i++) @@ -114,12 +114,12 @@ static void exitspawn(ppu_thread& ppu, vm::cptr path, vm::cpptr argv } vm::ptr arg = vm::cast(alloc_addr); - arg->x0 = 0x85; + arg->x0 = 0x85; arg->this_size = 0x30; arg->next_size = alloc_size - 0x30; - arg->prio = prio; - arg->flags = _flags; - arg->args = vm::cast(alloc_addr + 0x30); + arg->prio = prio; + arg->flags = _flags; + arg->args = vm::cast(alloc_addr + 0x30); if ((_flags >> 62) == 0 && *g_ppu_atexitspawn) { @@ -199,7 +199,6 @@ error_code sys_game_watchdog_stop() return CELL_OK; } - void sysPrxForUser_sys_game_init() { REG_FUNC(sysPrxForUser, sys_game_process_exitspawn2); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_io_.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sys_io_.cpp index 5f767ebae..103b768f5 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_io_.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_io_.cpp @@ -232,21 +232,20 @@ error_code sys_config_unregister_service() return CELL_OK; } - DECLARE(ppu_module_manager::sys_io)("sys_io", []() -{ - cellPad_init(); - cellKb_init(); - cellMouse_init(); + { + 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_io_error_handler); - REG_FUNC(sys_io, sys_config_register_service); - REG_FUNC(sys_io, sys_config_unregister_io_error_handler); - REG_FUNC(sys_io, sys_config_unregister_service); + 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_io_error_handler); + REG_FUNC(sys_io, sys_config_register_service); + REG_FUNC(sys_io, sys_config_unregister_io_error_handler); + REG_FUNC(sys_io, sys_config_unregister_service); - REG_HIDDEN_FUNC(config_event_entry); -}); + REG_HIDDEN_FUNC(config_event_entry); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_libc.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sys_libc.cpp index 7ebf4565f..a69216638 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_libc.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_libc.cpp @@ -34,9 +34,10 @@ u32 sys_libc_memcmp(vm::ptr buf1, vm::ptr buf2, u32 size) } DECLARE(ppu_module_manager::sys_libc)("sys_libc", []() -{ - REG_FNID(sys_libc, "memcpy", sys_libc_memcpy)/*.flag(MFF_FORCED_HLE)*/; - REG_FNID(sys_libc, "memset", sys_libc_memset); - REG_FNID(sys_libc, "memmove", sys_libc_memmove); - REG_FNID(sys_libc, "memcmp", sys_libc_memcmp); -}); + { + REG_FNID(sys_libc, "memcpy", sys_libc_memcpy) + /*.flag(MFF_FORCED_HLE)*/; + REG_FNID(sys_libc, "memset", sys_libc_memset); + REG_FNID(sys_libc, "memmove", sys_libc_memmove); + REG_FNID(sys_libc, "memcmp", sys_libc_memcmp); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_libc_.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sys_libc_.cpp index c5647dc0b..7a5fd57c9 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_libc_.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_libc_.cpp @@ -43,14 +43,14 @@ struct ps3_fmt_src return 0; } - static constexpr usz size_char = 1; + static constexpr usz size_char = 1; static constexpr usz size_short = 2; - static constexpr usz size_int = 4; - static constexpr usz size_long = 4; + static constexpr usz size_int = 4; + static constexpr usz size_long = 4; static constexpr usz size_llong = 8; - static constexpr usz size_size = 4; - static constexpr usz size_max = 8; - static constexpr usz size_diff = 4; + static constexpr usz size_size = 4; + static constexpr usz size_max = 8; + static constexpr usz size_diff = 4; }; template <> @@ -68,22 +68,136 @@ static std::string ps3_fmt(ppu_thread& context, vm::cptr fmt, u32 g_count) return result; } -static const std::array s_ctype_table -{ +static const std::array s_ctype_table{ 0, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x408, - 8, 8, 8, 8, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x408, + 8, + 8, + 8, + 8, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, 0x18, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 0x10, 0x10, 0x10, 0x10, 0x20, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x41, + 0x41, + 0x41, + 0x41, + 0x41, + 0x41, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x42, + 0x42, + 0x42, + 0x42, + 0x42, + 0x42, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 0x10, + 0x10, + 0x10, + 0x10, + 0x20, }; s16 __sys_look_ctype_table(s32 ch) @@ -458,9 +572,9 @@ void _sys_qsort(vm::ptr base, u32 nelem, u32 size, vm::ptr cmp) g_tls_cmp = cmp; std::qsort(base.get_ptr(), nelem, size, [](const void* a, const void* b) -> s32 - { - return g_tls_cmp(static_cast(*get_current_cpu_thread()), vm::get_addr(a), vm::get_addr(b)); - }); + { + return g_tls_cmp(static_cast(*get_current_cpu_thread()), vm::get_addr(a), vm::get_addr(b)); + }); } void sysPrxForUser_sys_libc_init() diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_lv2dbg.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sys_lv2dbg.cpp index 2e13cf798..f8306f7aa 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_lv2dbg.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_lv2dbg.cpp @@ -9,60 +9,60 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellLv2DbgError value) - { - switch (value) { - STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDPROCESSID); - STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDTHREADID); - STR_CASE(CELL_LV2DBG_ERROR_DEILLEGALREGISTERTYPE); - STR_CASE(CELL_LV2DBG_ERROR_DEILLEGALREGISTERNUMBER); - STR_CASE(CELL_LV2DBG_ERROR_DEILLEGALTHREADSTATE); - STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDEFFECTIVEADDRESS); - STR_CASE(CELL_LV2DBG_ERROR_DENOTFOUNDPROCESSID); - STR_CASE(CELL_LV2DBG_ERROR_DENOMEM); - STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDARGUMENTS); - STR_CASE(CELL_LV2DBG_ERROR_DENOTFOUNDFILE); - STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDFILETYPE); - STR_CASE(CELL_LV2DBG_ERROR_DENOTFOUNDTHREADID); - STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDTHREADSTATUS); - STR_CASE(CELL_LV2DBG_ERROR_DENOAVAILABLEPROCESSID); - STR_CASE(CELL_LV2DBG_ERROR_DENOTFOUNDEVENTHANDLER); - STR_CASE(CELL_LV2DBG_ERROR_DESPNOROOM); - STR_CASE(CELL_LV2DBG_ERROR_DESPNOTFOUND); - STR_CASE(CELL_LV2DBG_ERROR_DESPINPROCESS); - STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDPRIMARYSPUTHREADID); - STR_CASE(CELL_LV2DBG_ERROR_DETHREADSTATEISNOTSTOPPED); - STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDTHREADTYPE); - STR_CASE(CELL_LV2DBG_ERROR_DECONTINUEFAILED); - STR_CASE(CELL_LV2DBG_ERROR_DESTOPFAILED); - STR_CASE(CELL_LV2DBG_ERROR_DENOEXCEPTION); - STR_CASE(CELL_LV2DBG_ERROR_DENOMOREEVENTQUE); - STR_CASE(CELL_LV2DBG_ERROR_DEEVENTQUENOTCREATED); - STR_CASE(CELL_LV2DBG_ERROR_DEEVENTQUEOVERFLOWED); - STR_CASE(CELL_LV2DBG_ERROR_DENOTIMPLEMENTED); - STR_CASE(CELL_LV2DBG_ERROR_DEQUENOTREGISTERED); - STR_CASE(CELL_LV2DBG_ERROR_DENOMOREEVENTPROCESS); - STR_CASE(CELL_LV2DBG_ERROR_DEPROCESSNOTREGISTERED); - STR_CASE(CELL_LV2DBG_ERROR_DEEVENTDISCARDED); - STR_CASE(CELL_LV2DBG_ERROR_DENOMORESYNCID); - STR_CASE(CELL_LV2DBG_ERROR_DESYNCIDALREADYADDED); - STR_CASE(CELL_LV2DBG_ERROR_DESYNCIDNOTFOUND); - STR_CASE(CELL_LV2DBG_ERROR_DESYNCIDNOTACQUIRED); - STR_CASE(CELL_LV2DBG_ERROR_DEPROCESSALREADYREGISTERED); - STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDLSADDRESS); - STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDOPERATION); - STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDMODULEID); - STR_CASE(CELL_LV2DBG_ERROR_DEHANDLERALREADYREGISTERED); - STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDHANDLER); - STR_CASE(CELL_LV2DBG_ERROR_DEHANDLENOTREGISTERED); - STR_CASE(CELL_LV2DBG_ERROR_DEOPERATIONDENIED); - STR_CASE(CELL_LV2DBG_ERROR_DEHANDLERNOTINITIALIZED); - STR_CASE(CELL_LV2DBG_ERROR_DEHANDLERALREADYINITIALIZED); - STR_CASE(CELL_LV2DBG_ERROR_DEILLEGALCOREDUMPPARAMETER); - } + switch (value) + { + STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDPROCESSID); + STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDTHREADID); + STR_CASE(CELL_LV2DBG_ERROR_DEILLEGALREGISTERTYPE); + STR_CASE(CELL_LV2DBG_ERROR_DEILLEGALREGISTERNUMBER); + STR_CASE(CELL_LV2DBG_ERROR_DEILLEGALTHREADSTATE); + STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDEFFECTIVEADDRESS); + STR_CASE(CELL_LV2DBG_ERROR_DENOTFOUNDPROCESSID); + STR_CASE(CELL_LV2DBG_ERROR_DENOMEM); + STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDARGUMENTS); + STR_CASE(CELL_LV2DBG_ERROR_DENOTFOUNDFILE); + STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDFILETYPE); + STR_CASE(CELL_LV2DBG_ERROR_DENOTFOUNDTHREADID); + STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDTHREADSTATUS); + STR_CASE(CELL_LV2DBG_ERROR_DENOAVAILABLEPROCESSID); + STR_CASE(CELL_LV2DBG_ERROR_DENOTFOUNDEVENTHANDLER); + STR_CASE(CELL_LV2DBG_ERROR_DESPNOROOM); + STR_CASE(CELL_LV2DBG_ERROR_DESPNOTFOUND); + STR_CASE(CELL_LV2DBG_ERROR_DESPINPROCESS); + STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDPRIMARYSPUTHREADID); + STR_CASE(CELL_LV2DBG_ERROR_DETHREADSTATEISNOTSTOPPED); + STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDTHREADTYPE); + STR_CASE(CELL_LV2DBG_ERROR_DECONTINUEFAILED); + STR_CASE(CELL_LV2DBG_ERROR_DESTOPFAILED); + STR_CASE(CELL_LV2DBG_ERROR_DENOEXCEPTION); + STR_CASE(CELL_LV2DBG_ERROR_DENOMOREEVENTQUE); + STR_CASE(CELL_LV2DBG_ERROR_DEEVENTQUENOTCREATED); + STR_CASE(CELL_LV2DBG_ERROR_DEEVENTQUEOVERFLOWED); + STR_CASE(CELL_LV2DBG_ERROR_DENOTIMPLEMENTED); + STR_CASE(CELL_LV2DBG_ERROR_DEQUENOTREGISTERED); + STR_CASE(CELL_LV2DBG_ERROR_DENOMOREEVENTPROCESS); + STR_CASE(CELL_LV2DBG_ERROR_DEPROCESSNOTREGISTERED); + STR_CASE(CELL_LV2DBG_ERROR_DEEVENTDISCARDED); + STR_CASE(CELL_LV2DBG_ERROR_DENOMORESYNCID); + STR_CASE(CELL_LV2DBG_ERROR_DESYNCIDALREADYADDED); + STR_CASE(CELL_LV2DBG_ERROR_DESYNCIDNOTFOUND); + STR_CASE(CELL_LV2DBG_ERROR_DESYNCIDNOTACQUIRED); + STR_CASE(CELL_LV2DBG_ERROR_DEPROCESSALREADYREGISTERED); + STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDLSADDRESS); + STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDOPERATION); + STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDMODULEID); + STR_CASE(CELL_LV2DBG_ERROR_DEHANDLERALREADYREGISTERED); + STR_CASE(CELL_LV2DBG_ERROR_DEINVALIDHANDLER); + STR_CASE(CELL_LV2DBG_ERROR_DEHANDLENOTREGISTERED); + STR_CASE(CELL_LV2DBG_ERROR_DEOPERATIONDENIED); + STR_CASE(CELL_LV2DBG_ERROR_DEHANDLERNOTINITIALIZED); + STR_CASE(CELL_LV2DBG_ERROR_DEHANDLERALREADYINITIALIZED); + STR_CASE(CELL_LV2DBG_ERROR_DEILLEGALCOREDUMPPARAMETER); + } - return unknown; - }); + return unknown; + }); } // Temporarily @@ -208,7 +208,6 @@ error_code sys_dbg_get_spu_thread_group_name(u32 id, vm::ptr name) return CELL_OK; } - error_code sys_dbg_get_ppu_thread_status(u64 id, vm::ptr status) { sys_lv2dbg.todo("sys_dbg_get_ppu_thread_status()"); @@ -221,7 +220,6 @@ error_code sys_dbg_get_spu_thread_group_status(u32 id, vm::ptr status) return CELL_OK; } - error_code sys_dbg_enable_floating_point_enabled_exception(u64 id, u64 flags, u64 opt1, u64 opt2) { sys_lv2dbg.todo("sys_dbg_enable_floating_point_enabled_exception()"); @@ -234,14 +232,12 @@ error_code sys_dbg_disable_floating_point_enabled_exception(u64 id, u64 flags, u return CELL_OK; } - error_code sys_dbg_vm_get_page_information(u32 addr, u32 num, vm::ptr pageinfo) { sys_lv2dbg.todo("sys_dbg_vm_get_page_information()"); return CELL_OK; } - error_code sys_dbg_set_address_to_dabr(u64 addr, u64 ctrl_flag) { sys_lv2dbg.todo("sys_dbg_set_address_to_dabr()"); @@ -254,14 +250,12 @@ error_code sys_dbg_get_address_from_dabr(vm::ptr addr, vm::ptr ctrl_fl return CELL_OK; } - error_code sys_dbg_signal_to_coredump_handler(u64 data1, u64 data2, u64 data3) { sys_lv2dbg.todo("sys_dbg_signal_to_coredump_handler()"); return CELL_OK; } - error_code sys_dbg_mat_set_condition(u32 addr, u64 cond) { sys_lv2dbg.todo("sys_dbg_mat_set_condition()"); @@ -274,7 +268,6 @@ error_code sys_dbg_mat_get_condition(u32 addr, vm::ptr condp) return CELL_OK; } - error_code sys_dbg_get_coredump_params(vm::ptr param) { sys_lv2dbg.todo("sys_dbg_get_coredump_params()"); @@ -288,40 +281,40 @@ error_code sys_dbg_set_mask_to_ppu_exception_handler(u64 mask, u64 flags) } DECLARE(ppu_module_manager::sys_lv2dbg)("sys_lv2dbg", [] -{ - REG_FUNC(sys_lv2dbg, sys_dbg_read_ppu_thread_context); - REG_FUNC(sys_lv2dbg, sys_dbg_read_spu_thread_context); - REG_FUNC(sys_lv2dbg, sys_dbg_read_spu_thread_context2); - REG_FUNC(sys_lv2dbg, sys_dbg_set_stacksize_ppu_exception_handler); - REG_FUNC(sys_lv2dbg, sys_dbg_initialize_ppu_exception_handler); - REG_FUNC(sys_lv2dbg, sys_dbg_finalize_ppu_exception_handler); - REG_FUNC(sys_lv2dbg, sys_dbg_register_ppu_exception_handler); - REG_FUNC(sys_lv2dbg, sys_dbg_unregister_ppu_exception_handler); - REG_FUNC(sys_lv2dbg, sys_dbg_signal_to_ppu_exception_handler); - REG_FUNC(sys_lv2dbg, sys_dbg_get_mutex_information); - REG_FUNC(sys_lv2dbg, sys_dbg_get_cond_information); - REG_FUNC(sys_lv2dbg, sys_dbg_get_rwlock_information); - REG_FUNC(sys_lv2dbg, sys_dbg_get_event_queue_information); - REG_FUNC(sys_lv2dbg, sys_dbg_get_semaphore_information); - REG_FUNC(sys_lv2dbg, sys_dbg_get_lwmutex_information); - REG_FUNC(sys_lv2dbg, sys_dbg_get_lwcond_information); - REG_FUNC(sys_lv2dbg, sys_dbg_get_event_flag_information); - REG_FUNC(sys_lv2dbg, sys_dbg_get_ppu_thread_ids); - REG_FUNC(sys_lv2dbg, sys_dbg_get_spu_thread_group_ids); - REG_FUNC(sys_lv2dbg, sys_dbg_get_spu_thread_ids); - REG_FUNC(sys_lv2dbg, sys_dbg_get_ppu_thread_name); - REG_FUNC(sys_lv2dbg, sys_dbg_get_spu_thread_name); - REG_FUNC(sys_lv2dbg, sys_dbg_get_spu_thread_group_name); - REG_FUNC(sys_lv2dbg, sys_dbg_get_ppu_thread_status); - REG_FUNC(sys_lv2dbg, sys_dbg_get_spu_thread_group_status); - REG_FUNC(sys_lv2dbg, sys_dbg_enable_floating_point_enabled_exception); - REG_FUNC(sys_lv2dbg, sys_dbg_disable_floating_point_enabled_exception); - REG_FUNC(sys_lv2dbg, sys_dbg_vm_get_page_information); - REG_FUNC(sys_lv2dbg, sys_dbg_set_address_to_dabr); - REG_FUNC(sys_lv2dbg, sys_dbg_get_address_from_dabr); - REG_FUNC(sys_lv2dbg, sys_dbg_signal_to_coredump_handler); - REG_FUNC(sys_lv2dbg, sys_dbg_mat_set_condition); - REG_FUNC(sys_lv2dbg, sys_dbg_mat_get_condition); - REG_FUNC(sys_lv2dbg, sys_dbg_get_coredump_params); - REG_FUNC(sys_lv2dbg, sys_dbg_set_mask_to_ppu_exception_handler); -}); + { + REG_FUNC(sys_lv2dbg, sys_dbg_read_ppu_thread_context); + REG_FUNC(sys_lv2dbg, sys_dbg_read_spu_thread_context); + REG_FUNC(sys_lv2dbg, sys_dbg_read_spu_thread_context2); + REG_FUNC(sys_lv2dbg, sys_dbg_set_stacksize_ppu_exception_handler); + REG_FUNC(sys_lv2dbg, sys_dbg_initialize_ppu_exception_handler); + REG_FUNC(sys_lv2dbg, sys_dbg_finalize_ppu_exception_handler); + REG_FUNC(sys_lv2dbg, sys_dbg_register_ppu_exception_handler); + REG_FUNC(sys_lv2dbg, sys_dbg_unregister_ppu_exception_handler); + REG_FUNC(sys_lv2dbg, sys_dbg_signal_to_ppu_exception_handler); + REG_FUNC(sys_lv2dbg, sys_dbg_get_mutex_information); + REG_FUNC(sys_lv2dbg, sys_dbg_get_cond_information); + REG_FUNC(sys_lv2dbg, sys_dbg_get_rwlock_information); + REG_FUNC(sys_lv2dbg, sys_dbg_get_event_queue_information); + REG_FUNC(sys_lv2dbg, sys_dbg_get_semaphore_information); + REG_FUNC(sys_lv2dbg, sys_dbg_get_lwmutex_information); + REG_FUNC(sys_lv2dbg, sys_dbg_get_lwcond_information); + REG_FUNC(sys_lv2dbg, sys_dbg_get_event_flag_information); + REG_FUNC(sys_lv2dbg, sys_dbg_get_ppu_thread_ids); + REG_FUNC(sys_lv2dbg, sys_dbg_get_spu_thread_group_ids); + REG_FUNC(sys_lv2dbg, sys_dbg_get_spu_thread_ids); + REG_FUNC(sys_lv2dbg, sys_dbg_get_ppu_thread_name); + REG_FUNC(sys_lv2dbg, sys_dbg_get_spu_thread_name); + REG_FUNC(sys_lv2dbg, sys_dbg_get_spu_thread_group_name); + REG_FUNC(sys_lv2dbg, sys_dbg_get_ppu_thread_status); + REG_FUNC(sys_lv2dbg, sys_dbg_get_spu_thread_group_status); + REG_FUNC(sys_lv2dbg, sys_dbg_enable_floating_point_enabled_exception); + REG_FUNC(sys_lv2dbg, sys_dbg_disable_floating_point_enabled_exception); + REG_FUNC(sys_lv2dbg, sys_dbg_vm_get_page_information); + REG_FUNC(sys_lv2dbg, sys_dbg_set_address_to_dabr); + REG_FUNC(sys_lv2dbg, sys_dbg_get_address_from_dabr); + REG_FUNC(sys_lv2dbg, sys_dbg_signal_to_coredump_handler); + REG_FUNC(sys_lv2dbg, sys_dbg_mat_set_condition); + REG_FUNC(sys_lv2dbg, sys_dbg_mat_get_condition); + REG_FUNC(sys_lv2dbg, sys_dbg_get_coredump_params); + REG_FUNC(sys_lv2dbg, sys_dbg_set_mask_to_ppu_exception_handler); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_lv2dbg.h b/rpcs3/rpcs3/Emu/Cell/Modules/sys_lv2dbg.h index 1a5884488..1e61def4f 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_lv2dbg.h +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_lv2dbg.h @@ -11,8 +11,6 @@ #include "Emu/Memory/vm_ptr.h" - - // Error Codes enum CellLv2DbgError : u32 { @@ -152,7 +150,7 @@ struct sys_dbg_spu_thread_context2_t { sys_dbg_spu_gpr_t gpr[128]; be_t npc; - sys_dbg_spu_fpscr_t fpscr; + sys_dbg_spu_fpscr_t fpscr; be_t srr0; be_t spu_status; be_t spu_cfg; @@ -198,7 +196,7 @@ struct sys_dbg_rwlock_information_t struct sys_dbg_event_queue_information_t { - sys_event_queue_attribute_t attr; + sys_event_queue_attribute_t attr; be_t event_queue_key; be_t queue_size; vm::bptr wait_id_list; @@ -221,7 +219,7 @@ struct sys_dbg_semaphore_information_t struct sys_dbg_lwmutex_information_t { - sys_lwmutex_attribute_t attr; + sys_lwmutex_attribute_t attr; be_t owner; be_t lock_counter; vm::bptr wait_id_list; diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_lwcond_.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sys_lwcond_.cpp index 0745216bf..2b329f15c 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_lwcond_.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_lwcond_.cpp @@ -14,7 +14,7 @@ error_code sys_lwcond_create(ppu_thread& ppu, vm::ptr lwcond, vm:: vm::var out_id; vm::var attrs; - attrs->pshared = SYS_SYNC_NOT_PROCESS_SHARED; + attrs->pshared = SYS_SYNC_NOT_PROCESS_SHARED; attrs->name_u64 = attr->name_u64; if (auto res = g_cfg.core.hle_lwmutex ? sys_cond_create(ppu, out_id, lwmutex->sleep_queue, attrs) : _sys_lwcond_create(ppu, out_id, lwmutex->sleep_queue, lwcond, std::bit_cast>(attr->name_u64))) @@ -22,7 +22,7 @@ error_code sys_lwcond_create(ppu_thread& ppu, vm::ptr lwcond, vm:: return res; } - lwcond->lwmutex = lwmutex; + lwcond->lwmutex = lwmutex; lwcond->lwcond_queue = *out_id; return CELL_OK; } @@ -97,10 +97,10 @@ error_code sys_lwcond_signal(ppu_thread& ppu, vm::ptr lwcond) // if locking succeeded lwmutex->lock_var.atomic_op([](sys_lwmutex_t::sync_var_t& var) - { - var.waiter++; - var.owner = lwmutex_reserved; - }); + { + var.waiter++; + var.owner = lwmutex_reserved; + }); // call the syscall if (error_code res = _sys_lwcond_signal(ppu, lwcond->lwcond_queue, lwmutex->sleep_queue, u32{umax}, 3)) @@ -108,10 +108,10 @@ error_code sys_lwcond_signal(ppu_thread& ppu, vm::ptr lwcond) static_cast(ppu.test_stopped()); lwmutex->lock_var.atomic_op([&](sys_lwmutex_t::sync_var_t& var) - { - var.waiter--; - var.owner = ppu.id; - }); + { + var.waiter--; + var.owner = ppu.id; + }); // unlock the lightweight mutex sys_lwmutex_unlock(ppu, lwmutex); @@ -243,10 +243,10 @@ error_code sys_lwcond_signal_to(ppu_thread& ppu, vm::ptr lwcond, u // if locking succeeded lwmutex->lock_var.atomic_op([](sys_lwmutex_t::sync_var_t& var) - { - var.waiter++; - var.owner = lwmutex_reserved; - }); + { + var.waiter++; + var.owner = lwmutex_reserved; + }); // call the syscall if (error_code res = _sys_lwcond_signal(ppu, lwcond->lwcond_queue, lwmutex->sleep_queue, ppu_thread_id, 3)) @@ -254,10 +254,10 @@ error_code sys_lwcond_signal_to(ppu_thread& ppu, vm::ptr lwcond, u static_cast(ppu.test_stopped()); lwmutex->lock_var.atomic_op([&](sys_lwmutex_t::sync_var_t& var) - { - var.waiter--; - var.owner = ppu.id; - }); + { + var.waiter--; + var.owner = ppu.id; + }); // unlock the lightweight mutex sys_lwmutex_unlock(ppu, lwmutex); @@ -380,12 +380,12 @@ void sysPrxForUser_sys_lwcond_init(ppu_static_module* _this) REG_FUNC(sysPrxForUser, sys_lwcond_wait); _this->add_init_func([](ppu_static_module*) - { - REINIT_FUNC(sys_lwcond_create).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); - REINIT_FUNC(sys_lwcond_destroy).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); - REINIT_FUNC(sys_lwcond_signal).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); - REINIT_FUNC(sys_lwcond_signal_all).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); - REINIT_FUNC(sys_lwcond_signal_to).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); - REINIT_FUNC(sys_lwcond_wait).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); - }); + { + REINIT_FUNC(sys_lwcond_create).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); + REINIT_FUNC(sys_lwcond_destroy).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); + REINIT_FUNC(sys_lwcond_signal).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); + REINIT_FUNC(sys_lwcond_signal_all).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); + REINIT_FUNC(sys_lwcond_signal_to).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); + REINIT_FUNC(sys_lwcond_wait).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); + }); } diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_lwmutex_.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sys_lwmutex_.cpp index 098761b25..07458dbd3 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_lwmutex_.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_lwmutex_.cpp @@ -35,20 +35,20 @@ error_code sys_lwmutex_create(ppu_thread& ppu, vm::ptr lwmutex, v vm::var out_id; vm::var attrs; - attrs->protocol = protocol == SYS_SYNC_FIFO ? SYS_SYNC_FIFO : SYS_SYNC_PRIORITY; + attrs->protocol = protocol == SYS_SYNC_FIFO ? SYS_SYNC_FIFO : SYS_SYNC_PRIORITY; attrs->recursive = attr->recursive; - attrs->pshared = SYS_SYNC_NOT_PROCESS_SHARED; - attrs->adaptive = SYS_SYNC_NOT_ADAPTIVE; - attrs->ipc_key = 0; - attrs->flags = 0; - attrs->name_u64 = attr->name_u64; + attrs->pshared = SYS_SYNC_NOT_PROCESS_SHARED; + attrs->adaptive = SYS_SYNC_NOT_ADAPTIVE; + attrs->ipc_key = 0; + attrs->flags = 0; + attrs->name_u64 = attr->name_u64; if (error_code res = g_cfg.core.hle_lwmutex ? sys_mutex_create(ppu, out_id, attrs) : _sys_lwmutex_create(ppu, out_id, protocol, lwmutex, 0x80000001, std::bit_cast>(attr->name_u64))) { return res; } - lwmutex->lock_var.store({ lwmutex_free, 0 }); + lwmutex->lock_var.store({lwmutex_free, 0}); lwmutex->attribute = attr->recursive | attr->protocol; lwmutex->recursive_count = 0; lwmutex->sleep_queue = *out_id; @@ -369,7 +369,7 @@ error_code sys_lwmutex_unlock(ppu_thread& ppu, vm::ptr lwmutex) } // ensure that waiter is zero - if (lwmutex->lock_var.compare_and_swap_test({ tid, 0 }, { lwmutex_free, 0 })) + if (lwmutex->lock_var.compare_and_swap_test({tid, 0}, {lwmutex_free, 0})) { // unlocking succeeded return CELL_OK; @@ -409,11 +409,11 @@ void sysPrxForUser_sys_lwmutex_init(ppu_static_module* _this) REG_FUNC(sysPrxForUser, sys_lwmutex_unlock); _this->add_init_func([](ppu_static_module*) - { - REINIT_FUNC(sys_lwmutex_create).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); - REINIT_FUNC(sys_lwmutex_destroy).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); - REINIT_FUNC(sys_lwmutex_lock).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); - REINIT_FUNC(sys_lwmutex_trylock).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); - REINIT_FUNC(sys_lwmutex_unlock).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); - }); + { + REINIT_FUNC(sys_lwmutex_create).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); + REINIT_FUNC(sys_lwmutex_destroy).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); + REINIT_FUNC(sys_lwmutex_lock).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); + REINIT_FUNC(sys_lwmutex_trylock).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); + REINIT_FUNC(sys_lwmutex_unlock).flag(g_cfg.core.hle_lwmutex ? MFF_FORCED_HLE : MFF_PERFECT); + }); } diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_mempool.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sys_mempool.cpp index 2446619d3..a3fd13e73 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_mempool.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_mempool.cpp @@ -81,7 +81,7 @@ error_code sys_mempool_create(ppu_thread& ppu, vm::ptr mempool, v attr->pshared = SYS_SYNC_NOT_PROCESS_SHARED; attr->adaptive = SYS_SYNC_NOT_ADAPTIVE; attr->ipc_key = 0; // No idea what this is - attr->flags = 0; // Also no idea what this is. + attr->flags = 0; // Also no idea what this is. strcpy_trunc(attr->name, "mp_m" + std::to_string(*mempool)); error_code ret = sys_mutex_create(ppu, mutexid, attr); @@ -94,13 +94,13 @@ error_code sys_mempool_create(ppu_thread& ppu, vm::ptr mempool, v vm::var condid; vm::var condAttr; condAttr->pshared = SYS_SYNC_NOT_PROCESS_SHARED; - condAttr->flags = 0; // No idea what this is + condAttr->flags = 0; // No idea what this is condAttr->ipc_key = 0; // Also no idea what this is strcpy_trunc(condAttr->name, "mp_c" + std::to_string(*mempool)); ret = sys_cond_create(ppu, condid, *mutexid, condAttr); if (ret != CELL_OK) - { // TODO: Better exception handling. + { // TODO: Better exception handling. fmt::throw_exception("mempool %x failed to create condition variable", mempool); } memory_pool->condid = *condid; @@ -175,7 +175,7 @@ vm::ptr sys_mempool_allocate_block(ppu_thread& ppu, sys_mempool_t mempool) auto memory_pool = idm::get_unlocked(mempool); if (!memory_pool) - { // if the memory pool gets deleted-- is null, clearly it's impossible to allocate memory. + { // if the memory pool gets deleted-- is null, clearly it's impossible to allocate memory. return vm::null; } sys_mutex_lock(ppu, memory_pool->mutexid, 0); @@ -184,8 +184,8 @@ vm::ptr sys_mempool_allocate_block(ppu_thread& ppu, sys_mempool_t mempool) { sys_cond_wait(ppu, memory_pool->condid, 0); memory_pool = idm::get_unlocked(mempool); - if (!memory_pool) // in case spurious wake up was from delete, don't die by accessing a freed pool. - { // No need to unlock as if the pool is freed, the lock was freed as well. + if (!memory_pool) // in case spurious wake up was from delete, don't die by accessing a freed pool. + { // No need to unlock as if the pool is freed, the lock was freed as well. return vm::null; } } diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_net_.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sys_net_.cpp index 9e487aa8e..ca228e362 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_net_.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_net_.cpp @@ -604,108 +604,108 @@ s32 _sce_net_set_name_server() } DECLARE(ppu_module_manager::sys_net)("sys_net", []() -{ - REG_FNID(sys_net, "accept", sys_net_accept); - REG_FNID(sys_net, "bind", sys_net_bind); - REG_FNID(sys_net, "connect", sys_net_connect); - REG_FNID(sys_net, "gethostbyaddr", sys_net_gethostbyaddr); - REG_FNID(sys_net, "gethostbyname", sys_net_gethostbyname); - REG_FNID(sys_net, "getpeername", sys_net_getpeername); - REG_FNID(sys_net, "getsockname", sys_net_getsockname); - REG_FNID(sys_net, "getsockopt", sys_net_getsockopt); - REG_FNID(sys_net, "inet_addr", sys_net_inet_addr); - REG_FNID(sys_net, "inet_aton", sys_net_inet_aton); - REG_FNID(sys_net, "inet_lnaof", sys_net_inet_lnaof); - REG_FNID(sys_net, "inet_makeaddr", sys_net_inet_makeaddr); - REG_FNID(sys_net, "inet_netof", sys_net_inet_netof); - REG_FNID(sys_net, "inet_network", sys_net_inet_network); - REG_FNID(sys_net, "inet_ntoa", sys_net_inet_ntoa); - REG_FNID(sys_net, "inet_ntop", sys_net_inet_ntop); - REG_FNID(sys_net, "inet_pton", sys_net_inet_pton); - REG_FNID(sys_net, "listen", sys_net_listen); - REG_FNID(sys_net, "recv", sys_net_recv); - REG_FNID(sys_net, "recvfrom", sys_net_recvfrom); - REG_FNID(sys_net, "recvmsg", sys_net_recvmsg); - REG_FNID(sys_net, "send", sys_net_send); - REG_FNID(sys_net, "sendmsg", sys_net_sendmsg); - REG_FNID(sys_net, "sendto", sys_net_sendto); - REG_FNID(sys_net, "setsockopt", sys_net_setsockopt); - REG_FNID(sys_net, "shutdown", sys_net_shutdown); - REG_FNID(sys_net, "socket", sys_net_socket); - REG_FNID(sys_net, "socketclose", sys_net_socketclose); - REG_FNID(sys_net, "socketpoll", sys_net_socketpoll); - REG_FNID(sys_net, "socketselect", sys_net_socketselect); + { + REG_FNID(sys_net, "accept", sys_net_accept); + REG_FNID(sys_net, "bind", sys_net_bind); + REG_FNID(sys_net, "connect", sys_net_connect); + REG_FNID(sys_net, "gethostbyaddr", sys_net_gethostbyaddr); + REG_FNID(sys_net, "gethostbyname", sys_net_gethostbyname); + REG_FNID(sys_net, "getpeername", sys_net_getpeername); + REG_FNID(sys_net, "getsockname", sys_net_getsockname); + REG_FNID(sys_net, "getsockopt", sys_net_getsockopt); + REG_FNID(sys_net, "inet_addr", sys_net_inet_addr); + REG_FNID(sys_net, "inet_aton", sys_net_inet_aton); + REG_FNID(sys_net, "inet_lnaof", sys_net_inet_lnaof); + REG_FNID(sys_net, "inet_makeaddr", sys_net_inet_makeaddr); + REG_FNID(sys_net, "inet_netof", sys_net_inet_netof); + REG_FNID(sys_net, "inet_network", sys_net_inet_network); + REG_FNID(sys_net, "inet_ntoa", sys_net_inet_ntoa); + REG_FNID(sys_net, "inet_ntop", sys_net_inet_ntop); + REG_FNID(sys_net, "inet_pton", sys_net_inet_pton); + REG_FNID(sys_net, "listen", sys_net_listen); + REG_FNID(sys_net, "recv", sys_net_recv); + REG_FNID(sys_net, "recvfrom", sys_net_recvfrom); + REG_FNID(sys_net, "recvmsg", sys_net_recvmsg); + REG_FNID(sys_net, "send", sys_net_send); + REG_FNID(sys_net, "sendmsg", sys_net_sendmsg); + REG_FNID(sys_net, "sendto", sys_net_sendto); + REG_FNID(sys_net, "setsockopt", sys_net_setsockopt); + REG_FNID(sys_net, "shutdown", sys_net_shutdown); + REG_FNID(sys_net, "socket", sys_net_socket); + REG_FNID(sys_net, "socketclose", sys_net_socketclose); + REG_FNID(sys_net, "socketpoll", sys_net_socketpoll); + REG_FNID(sys_net, "socketselect", sys_net_socketselect); - REG_FUNC(sys_net, sys_net_initialize_network_ex); - REG_FUNC(sys_net, sys_net_get_udpp2p_test_param); - REG_FUNC(sys_net, sys_net_set_udpp2p_test_param); - REG_FUNC(sys_net, sys_net_get_lib_name_server); - REG_FUNC(sys_net, sys_net_if_ctl); - REG_FUNC(sys_net, sys_net_get_if_list); - REG_FUNC(sys_net, sys_net_get_name_server); - REG_FUNC(sys_net, sys_net_get_netemu_test_param); - REG_FUNC(sys_net, sys_net_get_routing_table_af); - REG_FUNC(sys_net, sys_net_get_sockinfo); - REG_FUNC(sys_net, sys_net_close_dump); - REG_FUNC(sys_net, sys_net_set_test_param); - REG_FUNC(sys_net, sys_net_show_nameserver); - REG_FUNC(sys_net, _sys_net_errno_loc); - REG_FUNC(sys_net, sys_net_set_resolver_configurations); - REG_FUNC(sys_net, sys_net_show_route); - REG_FUNC(sys_net, sys_net_read_dump); - REG_FUNC(sys_net, sys_net_abort_resolver); - REG_FUNC(sys_net, sys_net_abort_socket); - REG_FUNC(sys_net, sys_net_set_lib_name_server); - REG_FUNC(sys_net, sys_net_get_test_param); - REG_FUNC(sys_net, sys_net_get_sockinfo_ex); - REG_FUNC(sys_net, sys_net_open_dump); - REG_FUNC(sys_net, sys_net_show_ifconfig); - REG_FUNC(sys_net, sys_net_finalize_network); - REG_FUNC(sys_net, _sys_net_h_errno_loc); - REG_FUNC(sys_net, sys_net_set_netemu_test_param); - REG_FUNC(sys_net, sys_net_free_thread_context); + REG_FUNC(sys_net, sys_net_initialize_network_ex); + REG_FUNC(sys_net, sys_net_get_udpp2p_test_param); + REG_FUNC(sys_net, sys_net_set_udpp2p_test_param); + REG_FUNC(sys_net, sys_net_get_lib_name_server); + REG_FUNC(sys_net, sys_net_if_ctl); + REG_FUNC(sys_net, sys_net_get_if_list); + REG_FUNC(sys_net, sys_net_get_name_server); + REG_FUNC(sys_net, sys_net_get_netemu_test_param); + REG_FUNC(sys_net, sys_net_get_routing_table_af); + REG_FUNC(sys_net, sys_net_get_sockinfo); + REG_FUNC(sys_net, sys_net_close_dump); + REG_FUNC(sys_net, sys_net_set_test_param); + REG_FUNC(sys_net, sys_net_show_nameserver); + REG_FUNC(sys_net, _sys_net_errno_loc); + REG_FUNC(sys_net, sys_net_set_resolver_configurations); + REG_FUNC(sys_net, sys_net_show_route); + REG_FUNC(sys_net, sys_net_read_dump); + REG_FUNC(sys_net, sys_net_abort_resolver); + REG_FUNC(sys_net, sys_net_abort_socket); + REG_FUNC(sys_net, sys_net_set_lib_name_server); + REG_FUNC(sys_net, sys_net_get_test_param); + REG_FUNC(sys_net, sys_net_get_sockinfo_ex); + REG_FUNC(sys_net, sys_net_open_dump); + REG_FUNC(sys_net, sys_net_show_ifconfig); + REG_FUNC(sys_net, sys_net_finalize_network); + REG_FUNC(sys_net, _sys_net_h_errno_loc); + REG_FUNC(sys_net, sys_net_set_netemu_test_param); + REG_FUNC(sys_net, sys_net_free_thread_context); - REG_FUNC(sys_net, _sys_net_lib_abort); - REG_FUNC(sys_net, _sys_net_lib_bnet_control); - REG_FUNC(sys_net, __sys_net_lib_calloc); - REG_FUNC(sys_net, _sys_net_lib_free); - REG_FUNC(sys_net, _sys_net_lib_get_system_time); - REG_FUNC(sys_net, _sys_net_lib_if_nametoindex); - REG_FUNC(sys_net, _sys_net_lib_ioctl); - REG_FUNC(sys_net, __sys_net_lib_malloc); - REG_FUNC(sys_net, _sys_net_lib_rand); - REG_FUNC(sys_net, __sys_net_lib_realloc); - REG_FUNC(sys_net, _sys_net_lib_reset_libnetctl_queue); - REG_FUNC(sys_net, _sys_net_lib_set_libnetctl_queue); + REG_FUNC(sys_net, _sys_net_lib_abort); + REG_FUNC(sys_net, _sys_net_lib_bnet_control); + REG_FUNC(sys_net, __sys_net_lib_calloc); + REG_FUNC(sys_net, _sys_net_lib_free); + REG_FUNC(sys_net, _sys_net_lib_get_system_time); + REG_FUNC(sys_net, _sys_net_lib_if_nametoindex); + REG_FUNC(sys_net, _sys_net_lib_ioctl); + REG_FUNC(sys_net, __sys_net_lib_malloc); + REG_FUNC(sys_net, _sys_net_lib_rand); + REG_FUNC(sys_net, __sys_net_lib_realloc); + REG_FUNC(sys_net, _sys_net_lib_reset_libnetctl_queue); + REG_FUNC(sys_net, _sys_net_lib_set_libnetctl_queue); - REG_FUNC(sys_net, _sys_net_lib_thread_create); - REG_FUNC(sys_net, _sys_net_lib_thread_exit); - REG_FUNC(sys_net, _sys_net_lib_thread_join); + REG_FUNC(sys_net, _sys_net_lib_thread_create); + REG_FUNC(sys_net, _sys_net_lib_thread_exit); + REG_FUNC(sys_net, _sys_net_lib_thread_join); - REG_FUNC(sys_net, _sys_net_lib_sync_clear); - REG_FUNC(sys_net, _sys_net_lib_sync_create); - REG_FUNC(sys_net, _sys_net_lib_sync_destroy); - REG_FUNC(sys_net, _sys_net_lib_sync_signal); - REG_FUNC(sys_net, _sys_net_lib_sync_wait); + REG_FUNC(sys_net, _sys_net_lib_sync_clear); + REG_FUNC(sys_net, _sys_net_lib_sync_create); + REG_FUNC(sys_net, _sys_net_lib_sync_destroy); + REG_FUNC(sys_net, _sys_net_lib_sync_signal); + REG_FUNC(sys_net, _sys_net_lib_sync_wait); - REG_FUNC(sys_net, _sys_net_lib_sysctl); - REG_FUNC(sys_net, _sys_net_lib_usleep); + REG_FUNC(sys_net, _sys_net_lib_sysctl); + REG_FUNC(sys_net, _sys_net_lib_usleep); - REG_FUNC(sys_net, sys_netset_abort); - REG_FUNC(sys_net, sys_netset_close); - REG_FUNC(sys_net, sys_netset_get_if_id); - REG_FUNC(sys_net, sys_netset_get_key_value); - REG_FUNC(sys_net, sys_netset_get_status); - REG_FUNC(sys_net, sys_netset_if_down); - REG_FUNC(sys_net, sys_netset_if_up); - REG_FUNC(sys_net, sys_netset_open); + REG_FUNC(sys_net, sys_netset_abort); + REG_FUNC(sys_net, sys_netset_close); + REG_FUNC(sys_net, sys_netset_get_if_id); + REG_FUNC(sys_net, sys_netset_get_key_value); + REG_FUNC(sys_net, sys_netset_get_status); + REG_FUNC(sys_net, sys_netset_if_down); + REG_FUNC(sys_net, sys_netset_if_up); + REG_FUNC(sys_net, sys_netset_open); - REG_FUNC(sys_net, _sce_net_add_name_server); - REG_FUNC(sys_net, _sce_net_add_name_server_with_char); - REG_FUNC(sys_net, _sce_net_flush_route); + REG_FUNC(sys_net, _sce_net_add_name_server); + REG_FUNC(sys_net, _sce_net_add_name_server_with_char); + REG_FUNC(sys_net, _sce_net_flush_route); - REG_FUNC(sys_net, _sce_net_get_name_server); - REG_FUNC(sys_net, _sce_net_set_default_gateway); - REG_FUNC(sys_net, _sce_net_set_ip_and_mask); - REG_FUNC(sys_net, _sce_net_set_name_server); -}); + REG_FUNC(sys_net, _sce_net_get_name_server); + REG_FUNC(sys_net, _sce_net_set_default_gateway); + REG_FUNC(sys_net, _sce_net_set_ip_and_mask); + REG_FUNC(sys_net, _sce_net_set_name_server); + }); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_ppu_thread_.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sys_ppu_thread_.cpp index 033242e87..16362f9f2 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_ppu_thread_.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_ppu_thread_.cpp @@ -14,12 +14,12 @@ vm::gvar g_ppu_exit_mutex; // sys_process_exit2 mutex vm::gvar g_ppu_once_mutex; vm::gvar g_ppu_prx_lwm; -static u32 s_tls_addr = 0; // TLS image address -static u32 s_tls_file = 0; // TLS image size -static u32 s_tls_zero = 0; // TLS zeroed area size (TLS mem size - TLS image size) -static u32 s_tls_size = 0; // Size of TLS area per thread -static u32 s_tls_area = 0; // Start of TLS memory area -static u32 s_tls_max = 0; // Max number of threads +static u32 s_tls_addr = 0; // TLS image address +static u32 s_tls_file = 0; // TLS image size +static u32 s_tls_zero = 0; // TLS zeroed area size (TLS mem size - TLS image size) +static u32 s_tls_size = 0; // Size of TLS area per thread +static u32 s_tls_area = 0; // Start of TLS memory area +static u32 s_tls_max = 0; // Max number of threads static std::unique_ptr[]> s_tls_map; // I'd like to make it std::vector but it won't work static u32 ppu_alloc_tls() @@ -42,9 +42,9 @@ static u32 ppu_alloc_tls() addr = vm::alloc(s_tls_size, vm::main); } - std::memset(vm::base(addr), 0, 0x30); // Clear system area (TODO) + std::memset(vm::base(addr), 0, 0x30); // Clear system area (TODO) std::memcpy(vm::base(addr + 0x30), vm::base(s_tls_addr), s_tls_file); // Copy TLS image - std::memset(vm::base(addr + 0x30 + s_tls_file), 0, s_tls_zero); // Clear the rest + std::memset(vm::base(addr + 0x30 + s_tls_file), 0, s_tls_zero); // Clear the rest return addr; } @@ -72,7 +72,8 @@ void sys_initialize_tls(ppu_thread& ppu, u64 main_thread_id, u32 tls_seg_addr, u sysPrxForUser.notice("sys_initialize_tls(thread_id=0x%llx, addr=*0x%x, size=0x%x, mem_size=0x%x)", main_thread_id, tls_seg_addr, tls_seg_size, tls_mem_size); // Uninitialized TLS expected. - if (ppu.gpr[13] != 0) return; + if (ppu.gpr[13] != 0) + return; // Initialize TLS memory s_tls_addr = tls_seg_addr; @@ -80,8 +81,8 @@ void sys_initialize_tls(ppu_thread& ppu, u64 main_thread_id, u32 tls_seg_addr, u s_tls_zero = tls_mem_size - tls_seg_size; s_tls_size = tls_mem_size + 0x30; // 0x30 is system area size s_tls_area = vm::alloc(0x40000, vm::main) + 0x30; - s_tls_max = (0x40000 - 0x30) / s_tls_size; - s_tls_map = std::make_unique[]>(s_tls_max); + s_tls_max = (0x40000 - 0x30) / s_tls_size; + s_tls_map = std::make_unique[]>(s_tls_max); // Allocate TLS for main thread ppu.gpr[13] = ppu_alloc_tls() + 0x7000 + 0x30; @@ -95,28 +96,28 @@ void sys_initialize_tls(ppu_thread& ppu, u64 main_thread_id, u32 tls_seg_addr, u g_spu_printf_dtcb = vm::null; vm::var lwa; - lwa->protocol = SYS_SYNC_PRIORITY; - lwa->recursive = SYS_SYNC_RECURSIVE; - lwa->name_u64 = "atexit!\0"_u64; + lwa->protocol = SYS_SYNC_PRIORITY; + lwa->recursive = SYS_SYNC_RECURSIVE; + lwa->name_u64 = "atexit!\0"_u64; sys_lwmutex_create(ppu, g_ppu_atexit_lwm, lwa); vm::var attr; - attr->protocol = SYS_SYNC_PRIORITY; + attr->protocol = SYS_SYNC_PRIORITY; attr->recursive = SYS_SYNC_NOT_RECURSIVE; - attr->pshared = SYS_SYNC_NOT_PROCESS_SHARED; - attr->adaptive = SYS_SYNC_NOT_ADAPTIVE; - attr->ipc_key = 0; - attr->flags = 0; - attr->name_u64 = "_lv2ppu\0"_u64; + attr->pshared = SYS_SYNC_NOT_PROCESS_SHARED; + attr->adaptive = SYS_SYNC_NOT_ADAPTIVE; + attr->ipc_key = 0; + attr->flags = 0; + attr->name_u64 = "_lv2ppu\0"_u64; sys_mutex_create(ppu, g_ppu_once_mutex, attr); attr->recursive = SYS_SYNC_RECURSIVE; - attr->name_u64 = "_lv2tls\0"_u64; + attr->name_u64 = "_lv2tls\0"_u64; sys_mutex_create(ppu, g_ppu_exit_mutex, attr); - lwa->protocol = SYS_SYNC_PRIORITY; - lwa->recursive = SYS_SYNC_RECURSIVE; - lwa->name_u64 = "_lv2prx\0"_u64; + lwa->protocol = SYS_SYNC_PRIORITY; + lwa->recursive = SYS_SYNC_RECURSIVE; + lwa->name_u64 = "_lv2prx\0"_u64; sys_lwmutex_create(ppu, g_ppu_prx_lwm, lwa); // TODO: missing prx initialization } @@ -137,7 +138,7 @@ error_code sys_ppu_thread_create(ppu_thread& ppu, vm::ptr thread_id, u32 en } // Call the syscall - if (error_code res = _sys_ppu_thread_create(ppu, thread_id, vm::make_var(ppu_thread_param_t{ vm::cast(entry), tls_addr + 0x7030 }), arg, 0, prio, stacksize, flags, threadname)) + if (error_code res = _sys_ppu_thread_create(ppu, thread_id, vm::make_var(ppu_thread_param_t{vm::cast(entry), tls_addr + 0x7030}), arg, 0, prio, stacksize, flags, threadname)) { return res; } diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_prx_.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sys_prx_.cpp index 8529f408b..a43d6b536 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_prx_.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_prx_.cpp @@ -100,7 +100,7 @@ error_code sys_prx_start_module(ppu_thread& ppu, u32 id, u32 args, vm::ptr vm::var opt; opt->size = opt.size(); - opt->cmd = 1; + opt->cmd = 1; opt->entry2.set(-1); const error_code res = _sys_prx_start_module(ppu, id, flags, opt); @@ -133,7 +133,7 @@ error_code sys_prx_stop_module(ppu_thread& ppu, u32 id, u32 args, vm::ptr vm::var opt; opt->size = opt.size(); - opt->cmd = 1; + opt->cmd = 1; opt->entry2.set(-1); const error_code res = _sys_prx_stop_module(ppu, id, flags, opt); @@ -191,16 +191,16 @@ error_code sys_prx_get_module_list(ppu_thread& ppu, u64 flags, vm::ptr opt; - opt->size = opt.size(); - opt->max = info->max; - opt->count = 0; + opt->size = opt.size(); + opt->max = info->max; + opt->count = 0; opt->idlist = info->idlist; - opt->unk = 0; + opt->unk = 0; // Call the syscall const s32 res = _sys_prx_get_module_list(ppu, 2, opt); - info->max = opt->max; + info->max = opt->max; info->count = opt->count; return not_an_error(res); diff --git a/rpcs3/rpcs3/Emu/Cell/Modules/sys_spu_.cpp b/rpcs3/rpcs3/Emu/Cell/Modules/sys_spu_.cpp index 2bbbaee4a..bfe90c141 100644 --- a/rpcs3/rpcs3/Emu/Cell/Modules/sys_spu_.cpp +++ b/rpcs3/rpcs3/Emu/Cell/Modules/sys_spu_.cpp @@ -32,19 +32,19 @@ struct spu_elf_ldr { vm::ptr> ehdr = vm::cast(src.addr() + ehdr_off); std::memcpy(out.get_ptr(), ehdr.get_ptr(), 0x10); // Not needed? - out->e_type = ehdr->e_type; - out->e_machine = ehdr->e_machine; - out->e_version = ehdr->e_version; - out->e_entry = ehdr->e_entry; - out->e_phoff = ehdr->e_phoff; - out->e_shoff = ehdr->e_shoff; - out->e_flags = ehdr->e_flags; - out->e_ehsize = ehdr->e_ehsize; + out->e_type = ehdr->e_type; + out->e_machine = ehdr->e_machine; + out->e_version = ehdr->e_version; + out->e_entry = ehdr->e_entry; + out->e_phoff = ehdr->e_phoff; + out->e_shoff = ehdr->e_shoff; + out->e_flags = ehdr->e_flags; + out->e_ehsize = ehdr->e_ehsize; out->e_phentsize = ehdr->e_phentsize; - out->e_phnum = ehdr->e_phnum; + out->e_phnum = ehdr->e_phnum; out->e_shentsize = ehdr->e_shentsize; - out->e_shnum = ehdr->e_shnum; - out->e_shstrndx = ehdr->e_shstrndx; + out->e_shnum = ehdr->e_shnum; + out->e_shstrndx = ehdr->e_shstrndx; } else { @@ -69,14 +69,14 @@ struct spu_elf_ldr for (; count; count--, phdr++, out++) { - out->p_type = phdr->p_type; - out->p_flags = phdr->p_flags; + out->p_type = phdr->p_type; + out->p_flags = phdr->p_flags; out->p_offset = phdr->p_offset; - out->p_vaddr = phdr->p_vaddr; - out->p_paddr = phdr->p_paddr; + out->p_vaddr = phdr->p_vaddr; + out->p_paddr = phdr->p_paddr; out->p_filesz = phdr->p_filesz; - out->p_memsz = phdr->p_memsz; - out->p_align = phdr->p_align; + out->p_memsz = phdr->p_memsz; + out->p_align = phdr->p_align; } } else @@ -167,11 +167,11 @@ struct spu_elf_info return CELL_ENOEXEC; } - e_class = ehdr->e_class; - ldr = vm::get_addr(&_overlay); - ldr->_vtable = vm::cast(u32{e_class}); // TODO - ldr->src = vm::static_ptr_cast(src); - ldr->x8 = arg2; + e_class = ehdr->e_class; + ldr = vm::get_addr(&_overlay); + ldr->_vtable = vm::cast(u32{e_class}); // TODO + ldr->src = vm::static_ptr_cast(src); + ldr->x8 = arg2; ldr->ehdr_off = ehdr_off; ldr->phdr_off = phdr_off; @@ -221,7 +221,7 @@ error_code sys_spu_elf_get_information(u32 elf_img, vm::ptr entry, vm::ptr< } *entry = static_cast(ehdr->e_entry); - *nseg = num_segs; + *nseg = num_segs; return CELL_OK; } @@ -331,7 +331,7 @@ error_code sys_spu_image_import(ppu_thread& ppu, vm::ptr img, u32 return CELL_ENOEXEC; } - img->nsegs = num_segs; + img->nsegs = num_segs; img->entry_point = static_cast(ehdr->e_entry); vm::ptr segs = vm::cast(vm::alloc(num_segs * sizeof(sys_spu_segment), vm::main)); diff --git a/rpcs3/rpcs3/Emu/Cell/PPCDisAsm.h b/rpcs3/rpcs3/Emu/Cell/PPCDisAsm.h index 4a5c747ba..661584219 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPCDisAsm.h +++ b/rpcs3/rpcs3/Emu/Cell/PPCDisAsm.h @@ -110,7 +110,7 @@ protected: } void DisAsm_F1_R2(std::string_view op, u32 f0, u32 r0, u32 r1) { - if(m_mode == cpu_disasm_mode::compiler_elf) + if (m_mode == cpu_disasm_mode::compiler_elf) { fmt::append(last_opcode, "%-*s f%d,r%d,r%d", PadOp(), op, f0, r0, r1); return; @@ -120,7 +120,7 @@ protected: } void DisAsm_F1_IMM_R1_RC(std::string_view op, u32 f0, s32 imm0, u32 r0, u32 rc) { - if(m_mode == cpu_disasm_mode::compiler_elf) + if (m_mode == cpu_disasm_mode::compiler_elf) { fmt::append(last_opcode, "%-*s f%d,r%d,%s", PadOp(op, rc ? 1 : 0), op, f0, r0, SignedHex(imm0)); insert_char_if(op, !!rc); @@ -208,7 +208,7 @@ protected: } void DisAsm_R2_IMM(std::string_view op, u32 r0, u32 r1, s32 imm0) { - if(m_mode == cpu_disasm_mode::compiler_elf) + if (m_mode == cpu_disasm_mode::compiler_elf) { fmt::append(last_opcode, "%-*s r%d,r%d,%s", PadOp(), op, r0, r1, SignedHex(imm0)); return; diff --git a/rpcs3/rpcs3/Emu/Cell/PPUAnalyser.cpp b/rpcs3/rpcs3/Emu/Cell/PPUAnalyser.cpp index 808c31f8a..c53622397 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUAnalyser.cpp +++ b/rpcs3/rpcs3/Emu/Cell/PPUAnalyser.cpp @@ -14,25 +14,25 @@ LOG_CHANNEL(ppu_validator); extern const ppu_decoder g_ppu_itype; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](ppu_attr value) - { - switch (value) { - case ppu_attr::known_size: return "known_size"; - case ppu_attr::no_return: return "no_return"; - case ppu_attr::no_size: return "no_size"; - case ppu_attr::has_mfvscr: return "has_mfvscr"; - case ppu_attr::__bitset_enum_max: break; - } + switch (value) + { + case ppu_attr::known_size: return "known_size"; + case ppu_attr::no_return: return "no_return"; + case ppu_attr::no_size: return "no_size"; + case ppu_attr::has_mfvscr: return "has_mfvscr"; + case ppu_attr::__bitset_enum_max: break; + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string>::format(std::string& out, u64 arg) { format_bitset(out, arg, "[", ",", "]", &fmt_class_string::format); @@ -162,177 +162,173 @@ namespace ppu_patterns { using namespace ppu_instructions; - const ppu_pattern abort1[] - { - { STDU(r1, r1, -0xc0) }, - { MFLR(r0) }, - { STD(r26, r1, 0x90) }, - { STD(r27, r1, 0x98) }, - { STD(r28, r1, 0xa0) }, - { STD(r29, r1, 0xa8) }, - { STD(r30, r1, 0xb0) }, - { STD(r31, r1, 0xb8) }, - { STD(r0, r1, 0xd0) }, - { LI(r3, 4) }, - { LI(r4, 0) }, - { LI(r11, 0x3dc) }, - { SC(0) }, - { MR(r29, r1) }, - { CLRLDI(r29, r29, 32) }, - { LWZ(r4, r2, 0), 0xffff }, - { ADDI(r31, r1, 0x70) }, - { LI(r3, 1) }, - { LI(r5, 0x19) }, - { MR(r6, r31) }, - { LWZ(r28, r29, 4) }, - { LI(r11, 0x193) }, - { SC(0) }, - { ADDI(r26, r1, 0x78) }, - { LD(r3, r28, 0x10) }, - { MR(r4, r26) }, - { B(0, false, true), 0x3fffffc }, // .hex2str - { LI(r5, 0x10) }, - { CLRLDI(r4, r3, 32) }, - { MR(r6, r31) }, - { LI(r3, 1) }, - { LI(r11, 0x193) }, - { SC(0) }, - { LWZ(r27, r2, 0), 0xffff }, - { LI(r3, 1) }, - { LI(r5, 1) }, - { MR(r4, r27) }, - { MR(r6, r31) }, - { LI(r11, 0x193) }, - { SC(0) }, - { LD(r28, r28, 0) }, - { CMPDI(cr7, r28, 0) }, - { BEQ(cr7, +0x6c) }, - { LWZ(r30, r2, 0), 0xffff }, - { LI(r3, 1) }, - { MR(r4, r30) }, - { LI(r5, 0x19) }, - { MR(r6, r31) }, - { LI(r11, 0x193) }, - { SC(0) }, - { CLRLDI(r29, r28, 32) }, - { CLRLDI(r4, r26, 32) }, - { LD(r3, r29, 0x10) }, - { 0, 0xffffffff }, // .hex2str - { LI(r5, 0x10) }, - { CLRLDI(r4, r3, 32) }, - { MR(r6, r31) }, - { LI(r3, 1) }, - { LI(r11, 0x193) }, - { SC(0) }, - { LI(r3, 1) }, - { MR(r4, r27) }, - { LI(r5, 1) }, - { MR(r6, r31) }, - { LI(r11, 0x193) }, - { SC(0) }, - { LD(r28, r29, 0) }, - { CMPDI(cr7, r28, 0) }, - { BNE(cr7, -0x60) }, - { LWZ(r4, r2, 0), 0xffff }, - { MR(r6, r31) }, - { LI(r3, 1) }, - { LI(r5, 0x27) }, - { LI(r11, 0x193) }, - { SC(0) }, - { LI(r3, 1) }, - { B(0, false, true), 0x3fffffc }, // .sys_process_exit - { LD(r2, r1, 0x28) }, - { LI(r3, 1) }, - { B(0, false, true), 0x3fffffc }, // .exit + const ppu_pattern abort1[]{ + {STDU(r1, r1, -0xc0)}, + {MFLR(r0)}, + {STD(r26, r1, 0x90)}, + {STD(r27, r1, 0x98)}, + {STD(r28, r1, 0xa0)}, + {STD(r29, r1, 0xa8)}, + {STD(r30, r1, 0xb0)}, + {STD(r31, r1, 0xb8)}, + {STD(r0, r1, 0xd0)}, + {LI(r3, 4)}, + {LI(r4, 0)}, + {LI(r11, 0x3dc)}, + {SC(0)}, + {MR(r29, r1)}, + {CLRLDI(r29, r29, 32)}, + {LWZ(r4, r2, 0), 0xffff}, + {ADDI(r31, r1, 0x70)}, + {LI(r3, 1)}, + {LI(r5, 0x19)}, + {MR(r6, r31)}, + {LWZ(r28, r29, 4)}, + {LI(r11, 0x193)}, + {SC(0)}, + {ADDI(r26, r1, 0x78)}, + {LD(r3, r28, 0x10)}, + {MR(r4, r26)}, + {B(0, false, true), 0x3fffffc}, // .hex2str + {LI(r5, 0x10)}, + {CLRLDI(r4, r3, 32)}, + {MR(r6, r31)}, + {LI(r3, 1)}, + {LI(r11, 0x193)}, + {SC(0)}, + {LWZ(r27, r2, 0), 0xffff}, + {LI(r3, 1)}, + {LI(r5, 1)}, + {MR(r4, r27)}, + {MR(r6, r31)}, + {LI(r11, 0x193)}, + {SC(0)}, + {LD(r28, r28, 0)}, + {CMPDI(cr7, r28, 0)}, + {BEQ(cr7, +0x6c)}, + {LWZ(r30, r2, 0), 0xffff}, + {LI(r3, 1)}, + {MR(r4, r30)}, + {LI(r5, 0x19)}, + {MR(r6, r31)}, + {LI(r11, 0x193)}, + {SC(0)}, + {CLRLDI(r29, r28, 32)}, + {CLRLDI(r4, r26, 32)}, + {LD(r3, r29, 0x10)}, + {0, 0xffffffff}, // .hex2str + {LI(r5, 0x10)}, + {CLRLDI(r4, r3, 32)}, + {MR(r6, r31)}, + {LI(r3, 1)}, + {LI(r11, 0x193)}, + {SC(0)}, + {LI(r3, 1)}, + {MR(r4, r27)}, + {LI(r5, 1)}, + {MR(r6, r31)}, + {LI(r11, 0x193)}, + {SC(0)}, + {LD(r28, r29, 0)}, + {CMPDI(cr7, r28, 0)}, + {BNE(cr7, -0x60)}, + {LWZ(r4, r2, 0), 0xffff}, + {MR(r6, r31)}, + {LI(r3, 1)}, + {LI(r5, 0x27)}, + {LI(r11, 0x193)}, + {SC(0)}, + {LI(r3, 1)}, + {B(0, false, true), 0x3fffffc}, // .sys_process_exit + {LD(r2, r1, 0x28)}, + {LI(r3, 1)}, + {B(0, false, true), 0x3fffffc}, // .exit }; - const ppu_pattern abort2[] - { - { STDU(r1, r1, -0xc0) }, - { MFLR(r0) }, - { STD(r27, r1, 0x98) }, - { STD(r28, r1, 0xa0) }, - { STD(r29, r1, 0xa8) }, - { STD(r30, r1, 0xb0) }, - { STD(r31, r1, 0xb8) }, - { STD(r0, r1, 0xd0) }, - { MR(r9, r1) }, - { CLRLDI(r9, r9, 32) }, - { LWZ(r4, r2, 0), 0xffff }, - { ADDI(r31, r1, 0x70) }, - { LI(r3, 1) }, - { LI(r5, 0x19) }, - { MR(r6, r31) }, - { LWZ(r29, r9, 4) }, - { LI(r11, 0x193) }, - { SC(0) }, - { ADDI(r27, r1, 0x78) }, - { LD(r3, r29, 0x10) }, - { MR(r4, r27) }, - { B(0, false, true), 0x3fffffc }, // .hex2str - { LI(r5, 0x10) }, - { CLRLDI(r4, r3, 32) }, - { MR(r6, r31) }, - { LI(r3, 1) }, - { LI(r11, 0x193) }, - { SC(0) }, - { LWZ(r28, r2, 0), 0xffff }, - { LI(r3, 1) }, - { LI(r5, 1) }, - { MR(r4, r28) }, - { MR(r6, r31) }, - { LI(r11, 0x193) }, - { SC(0) }, - { LD(r29, r29, 0) }, - { CMPDI(cr7, r29, 0) }, - { BEQ(cr7, +0x6c) }, - { LWZ(r30, r2, 0), 0xffff }, - { LI(r3, 1) }, - { MR(r4, r30) }, - { LI(r5, 0x19) }, - { MR(r6, r31) }, - { LI(r11, 0x193) }, - { SC(0) }, - { CLRLDI(r29, r29, 32) }, - { CLRLDI(r4, r27, 32) }, - { LD(r3, r29, 0x10) }, - { 0, 0xffffffff }, // .hex2str - { LI(r5, 0x10) }, - { CLRLDI(r4, r3, 32) }, - { MR(r6, r31) }, - { LI(r3, 1) }, - { LI(r11, 0x193) }, - { SC(0) }, - { LI(r3, 1) }, - { MR(r4, r28) }, - { LI(r5, 1) }, - { MR(r6, r31) }, - { LI(r11, 0x193) }, - { SC(0) }, - { LD(r29, r29, 0) }, - { CMPDI(cr7, r29, 0) }, - { BNE(cr7, -0x60) }, - { LWZ(r4, r2, 0), 0xffff }, - { MR(r6, r31) }, - { LI(r3, 1) }, - { LI(r5, 0x27) }, - { LI(r11, 0x193) }, - { SC(0) }, - { LI(r3, 1) }, - { B(0, false, true), 0x3fffffc }, // .sys_process_exit - { LD(r2, r1, 0x28) }, - { LI(r3, 1) }, - { B(0, false, true), 0x3fffffc }, // .exit + const ppu_pattern abort2[]{ + {STDU(r1, r1, -0xc0)}, + {MFLR(r0)}, + {STD(r27, r1, 0x98)}, + {STD(r28, r1, 0xa0)}, + {STD(r29, r1, 0xa8)}, + {STD(r30, r1, 0xb0)}, + {STD(r31, r1, 0xb8)}, + {STD(r0, r1, 0xd0)}, + {MR(r9, r1)}, + {CLRLDI(r9, r9, 32)}, + {LWZ(r4, r2, 0), 0xffff}, + {ADDI(r31, r1, 0x70)}, + {LI(r3, 1)}, + {LI(r5, 0x19)}, + {MR(r6, r31)}, + {LWZ(r29, r9, 4)}, + {LI(r11, 0x193)}, + {SC(0)}, + {ADDI(r27, r1, 0x78)}, + {LD(r3, r29, 0x10)}, + {MR(r4, r27)}, + {B(0, false, true), 0x3fffffc}, // .hex2str + {LI(r5, 0x10)}, + {CLRLDI(r4, r3, 32)}, + {MR(r6, r31)}, + {LI(r3, 1)}, + {LI(r11, 0x193)}, + {SC(0)}, + {LWZ(r28, r2, 0), 0xffff}, + {LI(r3, 1)}, + {LI(r5, 1)}, + {MR(r4, r28)}, + {MR(r6, r31)}, + {LI(r11, 0x193)}, + {SC(0)}, + {LD(r29, r29, 0)}, + {CMPDI(cr7, r29, 0)}, + {BEQ(cr7, +0x6c)}, + {LWZ(r30, r2, 0), 0xffff}, + {LI(r3, 1)}, + {MR(r4, r30)}, + {LI(r5, 0x19)}, + {MR(r6, r31)}, + {LI(r11, 0x193)}, + {SC(0)}, + {CLRLDI(r29, r29, 32)}, + {CLRLDI(r4, r27, 32)}, + {LD(r3, r29, 0x10)}, + {0, 0xffffffff}, // .hex2str + {LI(r5, 0x10)}, + {CLRLDI(r4, r3, 32)}, + {MR(r6, r31)}, + {LI(r3, 1)}, + {LI(r11, 0x193)}, + {SC(0)}, + {LI(r3, 1)}, + {MR(r4, r28)}, + {LI(r5, 1)}, + {MR(r6, r31)}, + {LI(r11, 0x193)}, + {SC(0)}, + {LD(r29, r29, 0)}, + {CMPDI(cr7, r29, 0)}, + {BNE(cr7, -0x60)}, + {LWZ(r4, r2, 0), 0xffff}, + {MR(r6, r31)}, + {LI(r3, 1)}, + {LI(r5, 0x27)}, + {LI(r11, 0x193)}, + {SC(0)}, + {LI(r3, 1)}, + {B(0, false, true), 0x3fffffc}, // .sys_process_exit + {LD(r2, r1, 0x28)}, + {LI(r3, 1)}, + {B(0, false, true), 0x3fffffc}, // .exit }; - const ppu_pattern_array abort[] - { + const ppu_pattern_array abort[]{ abort1, abort2, }; - const ppu_pattern get_context[] - { + const ppu_pattern get_context[]{ ADDI(r3, r3, 0xf), CLRRDI(r3, r3, 4), STD(r1, r3, 0), @@ -407,8 +403,7 @@ namespace ppu_patterns BLR(), }; - const ppu_pattern set_context[] - { + const ppu_pattern set_context[]{ ADDI(r3, r3, 0xf), CLRRDI(r3, r3, 4), LD(r1, r3, 0), @@ -461,7 +456,7 @@ namespace ppu_patterns LFD(f30, r3, 0x138), LFD(f31, r3, 0x140), LD(r0, r3, 0x148), - 0x7c0043A6, //mtspr vrsave, r0 + 0x7c0043A6, // mtspr vrsave, r0 ADDI(r5, r3, 0x150), ADDI(r6, r3, 0x160), ADDI(r7, r3, 0x170), @@ -492,8 +487,7 @@ namespace ppu_patterns BLR(), }; - const ppu_pattern x26c[] - { + const ppu_pattern x26c[]{ LI(r9, 0), STD(r9, r6, 0), MR(r1, r6), @@ -508,8 +502,7 @@ namespace ppu_patterns BCTRL(), }; - const ppu_pattern x2a0[] - { + const ppu_pattern x2a0[]{ MR(r8, r1), 0x7d212850, // subf r9, r1, r5 0x7c21496a, // stdux r1, r1, r9 @@ -529,14 +522,26 @@ namespace ppu_patterns MR(r1, r9), BLR(), }; -} +} // namespace ppu_patterns -static constexpr struct const_tag{} is_const; -static constexpr struct range_tag{} is_range; -static constexpr struct min_value_tag{} minv; -static constexpr struct max_value_tag{} maxv; -static constexpr struct sign_bit_tag{} sign_bitv; -static constexpr struct load_addr_tag{} load_addrv; +static constexpr struct const_tag +{ +} is_const; +static constexpr struct range_tag +{ +} is_range; +static constexpr struct min_value_tag +{ +} minv; +static constexpr struct max_value_tag +{ +} maxv; +static constexpr struct sign_bit_tag +{ +} sign_bitv; +static constexpr struct load_addr_tag +{ +} load_addrv; struct reg_state_t { @@ -619,7 +624,7 @@ struct reg_state_t } // Clear bits using mask - // May fail if ge_than(+)value_range is modified by the operation + // May fail if ge_than(+)value_range is modified by the operation bool clear_mask(u64 bit_mask, u32& reg_tag_allocator) { if (bit_mask == umax) @@ -817,7 +822,7 @@ struct reg_state_t } }; -static constexpr reg_state_t s_reg_const_0{ 0, 1 }; +static constexpr reg_state_t s_reg_const_0{0, 1}; template <> bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::vector& applied, const std::vector& exported_funcs, std::function check_aborted) @@ -849,7 +854,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con struct ppu_function_ext : ppu_function { - //u32 stack_frame = 0; + // u32 stack_frame = 0; u32 single_target = 0; u32 trampoline = 0; bs_t attr{}; @@ -883,7 +888,10 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con } // Check if the storage address exists within relocations - constexpr auto compare = [](const ppu_reloc& a, u32 addr) { return a.addr < addr; }; + constexpr auto compare = [](const ppu_reloc& a, u32 addr) + { + return a.addr < addr; + }; auto it = std::lower_bound(this->relocs.begin(), this->relocs.end(), (addr & -8), compare); auto end = std::lower_bound(it, this->relocs.end(), (addr & -8) + 8, compare); @@ -1026,7 +1034,8 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con // Grope for OPD section (TODO: optimization, better constraints) for (const auto& seg : segs) { - if (seg.size < 8) continue; + if (seg.size < 8) + continue; const vm::cptr seg_end = vm::cast(seg.addr + seg.size - 8); vm::cptr _ptr = vm::cast(seg.addr); @@ -1060,7 +1069,8 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con // For seg0, must be valid code for (const auto& seg : segs) { - if (seg.size < 4) continue; + if (seg.size < 4) + continue; vm::cptr _ptr = vm::cast(seg.addr); const vm::cptr seg_end = vm::cast(seg.addr + seg.size - 4); @@ -1077,11 +1087,12 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con for (const auto& _seg : segs) { - if (!_seg.size) continue; + if (!_seg.size) + continue; if (value >= start && value < end) { - if (is_valid_code({ ptr, ptr + (end - value) }, !is_relocatable, _ptr.addr())) + if (is_valid_code({ptr, ptr + (end - value)}, !is_relocatable, _ptr.addr())) { continue; } @@ -1125,7 +1136,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con // Rough Table of Contents borders const u32 toc_begin = _toc - 0x8000; - //const u32 toc_end = _toc + 0x7ffc; + // const u32 toc_end = _toc + 0x7ffc; // TODO: improve TOC constraints if (toc_begin % 4 || !get_ptr(toc_begin) || toc_begin >= 0x40000000 || (toc_begin >= start && toc_begin < end)) @@ -1141,7 +1152,8 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con } } - if (sec_end) ppu_log.notice("Reading OPD section at 0x%x...", sec.addr); + if (sec_end) + ppu_log.notice("Reading OPD section at 0x%x...", sec.addr); // Mine for (vm::cptr _ptr = vm::cast(sec.addr); _ptr < sec_end; _ptr += 2) @@ -1149,7 +1161,8 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con auto ptr = get_ptr(_ptr); // Special case: see "Probe" - if (!ptr[0]) advance(_ptr, ptr, 4); + if (!ptr[0]) + advance(_ptr, ptr, 4); // Add function and TOC const u32 addr = ptr[0]; @@ -1232,7 +1245,8 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con _ptr = vm::cast(_ptr.addr() + size); } - if (sec_end && sec.size > 4) ppu_log.notice("Reading .eh_frame section at 0x%x...", sec.addr); + if (sec_end && sec.size > 4) + ppu_log.notice("Reading .eh_frame section at 0x%x...", sec.addr); // Mine for (vm::cptr _ptr = vm::cast(sec.addr); _ptr < sec_end; _ptr = vm::cast(_ptr.addr() + *get_ptr(_ptr) + 4)) @@ -1290,14 +1304,15 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con // TODO: invalid offsets, zero offsets (removed functions?) if (addr % 4 || size % 4 || size > (end - start) || addr < start || addr + size > end) { - if (addr) ppu_log.error(".eh_frame: Invalid function 0x%x", addr); + if (addr) + ppu_log.error(".eh_frame: Invalid function 0x%x", addr); continue; } - //auto& func = add_func(addr, 0, 0); - //func.attr += ppu_attr::known_size; - //func.size = size; - //known_functions.emplace(func); + // auto& func = add_func(addr, 0, 0); + // func.attr += ppu_attr::known_size; + // func.size = size; + // known_functions.emplace(func); } } } @@ -1351,7 +1366,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con if (target >= start && target < end && target != iaddr && target != iaddr + 4) { - if (is_valid_code({ get_ptr(target), get_ptr(end - 4) }, !is_relocatable, target)) + if (is_valid_code({get_ptr(target), get_ptr(end - 4)}, !is_relocatable, target)) { ppu_log.trace("Enqueued PPU function 0x%x using a caller at 0x%x", target, iaddr); add_func(target, 0, 0); @@ -1592,13 +1607,13 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con auto p2 = get_ptr(_p2); while (_p2 + 0x7 <= fend && - p2[0] == STD(r2, r1, 0x28) && - (p2[1] & 0xffff0000) == ADDIS(r12, r2, {}) && - (p2[2] & 0xffff0000) == LWZ(r11, r12, {}) && - (p2[3] & 0xffff0000) == ADDIS(r2, r2, {}) && - (p2[4] & 0xffff0000) == ADDI(r2, r2, {}) && - p2[5] == MTCTR(r11) && - p2[6] == BCTR()) + p2[0] == STD(r2, r1, 0x28) && + (p2[1] & 0xffff0000) == ADDIS(r12, r2, {}) && + (p2[2] & 0xffff0000) == LWZ(r11, r12, {}) && + (p2[3] & 0xffff0000) == ADDIS(r2, r2, {}) && + (p2[4] & 0xffff0000) == ADDI(r2, r2, {}) && + p2[5] == MTCTR(r11) && + p2[6] == BCTR()) { auto& next = add_func(_p2.addr(), -1, func.addr); next.size = 0x1C; @@ -1640,11 +1655,11 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con add_toc(toc); add_func(func.addr, toc, 0); } - //else if (new_func.toc - func.toc != toc_add) + // else if (new_func.toc - func.toc != toc_add) //{ // func.toc = -1; // new_func.toc = -1; - //} + // } if (new_func.blocks.empty()) { @@ -1687,11 +1702,11 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con add_toc(toc); add_func(func.addr, toc, 0); } - //else if (new_func.toc - func.toc != toc_add) + // else if (new_func.toc - func.toc != toc_add) //{ // func.toc = -1; // new_func.toc = -1; - //} + // } if (new_func.blocks.empty()) { @@ -1730,14 +1745,14 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con auto p2 = get_ptr(_p2); while (_p2 + 8 <= fend && - (p2[0] & 0xffff0000) == LI(r12, 0) && - (p2[1] & 0xffff0000) == ORIS(r12, r12, 0) && - (p2[2] & 0xffff0000) == LWZ(r12, r12, 0) && - p2[3] == STD(r2, r1, 0x28) && - p2[4] == LWZ(r0, r12, 0) && - p2[5] == LWZ(r2, r12, 4) && - p2[6] == MTCTR(r0) && - p2[7] == BCTR()) + (p2[0] & 0xffff0000) == LI(r12, 0) && + (p2[1] & 0xffff0000) == ORIS(r12, r12, 0) && + (p2[2] & 0xffff0000) == LWZ(r12, r12, 0) && + p2[3] == STD(r2, r1, 0x28) && + p2[4] == LWZ(r0, r12, 0) && + p2[5] == LWZ(r2, r12, 4) && + p2[6] == MTCTR(r0) && + p2[7] == BCTR()) { auto& next = add_func(_p2.addr(), -1, func.addr); next.size = 0x20; @@ -1758,7 +1773,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con // Weird function (illegal instruction) func.size = 0xc; func.blocks.emplace(func.addr, func.size); - //func.attr += ppu_attr::no_return; + // func.attr += ppu_attr::no_return; continue; } @@ -1805,7 +1820,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con { auto& block = block_queue.emplace_back(block_local_info_t{addr}); block.parent_block_idx = parent_block; - + if (parent_block != umax) { // Inherit loaded registers mask (lazily) @@ -1845,22 +1860,25 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con const u32 func_end2 = _next == fmap.end() ? func_end : std::min(_next->first, func_end); // Set more block entries - std::for_each(addr_heap.lower_bound(func.addr), addr_heap.lower_bound(func_end2), [&](auto a) { add_block(a.first, umax); }); + std::for_each(addr_heap.lower_bound(func.addr), addr_heap.lower_bound(func_end2), [&](auto a) + { + add_block(a.first, umax); + }); } bool postpone_analysis = false; // Block loop (block_queue may grow, may be aborted via clearing) for (u32 j = 0; !postpone_analysis && j < block_queue.size(); [&]() - { - if (u32 size = block_queue[j].size) { - // Update size - func.blocks[block_queue[j].addr] = size; - } + if (u32 size = block_queue[j].size) + { + // Update size + func.blocks[block_queue[j].addr] = size; + } - j++; - }()) + j++; + }()) { block_local_info_t* block = &block_queue[j]; @@ -1895,8 +1913,8 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con // Try searching for register origin if (block->mapped_registers_mask.mask & reg_mask) - { - for (u32 i = block->parent_block_idx; i != umax; i = block_queue[i].parent_block_idx) + { + for (u32 i = block->parent_block_idx; i != umax; i = block_queue[i].parent_block_idx) { if (~block_queue[i].moved_registers_mask.mask & reg_mask) { @@ -2033,7 +2051,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con if (value(is_const)) { - it->second.emplace_back(ppua_reg_mask_t{ 1u << 3 }, value(minv) ); + it->second.emplace_back(ppua_reg_mask_t{1u << 3}, value(minv)); } } } @@ -2060,9 +2078,18 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con { switch (op.bi % 4) { - case 0x0: gt = true; eq = true; break; - case 0x1: lt = true; eq = true; break; - case 0x2: gt = true; lt = true; break; + case 0x0: + gt = true; + eq = true; + break; + case 0x1: + lt = true; + eq = true; + break; + case 0x2: + gt = true; + lt = true; + break; case 0x3: nso = true; break; default: fmt::throw_exception("Unreachable"); } @@ -2174,7 +2201,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con return; } - if (addr % 4 || addr < func.addr || addr >= func_end || !is_valid_code({ get_ptr(addr), code_end }, !is_relocatable, addr)) + if (addr % 4 || addr < func.addr || addr >= func_end || !is_valid_code({get_ptr(addr), code_end}, !is_relocatable, addr)) { return; } @@ -2243,7 +2270,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con { found_jt = true; - for (be_t addr : std::span>{ jumpatble_ptr_begin , jumpatble_ptr }) + for (be_t addr : std::span>{jumpatble_ptr_begin, jumpatble_ptr}) { if (addr == _ptr.addr()) { @@ -2369,7 +2396,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con } case 0x008: // MTLR { - //store_block_reg(j, c_reg_lr, get_reg(op.rs)); + // store_block_reg(j, c_reg_lr, get_reg(op.rs)); break; } case 0x009: // MTCTR @@ -2416,17 +2443,13 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con const bool is_negative = const_offs(sign_bitv) == 1u; - const bool is_offset_test_ok = is_negative - ? (0 - const_offs(minv) <= off_ra(minv) && off_ra(minv) + const_offs(minv) < segs_end) - : (off_ra(minv) < segs_end && const_offs(minv) < segs_end - off_ra(minv)); + const bool is_offset_test_ok = is_negative ? (0 - const_offs(minv) <= off_ra(minv) && off_ra(minv) + const_offs(minv) < segs_end) : (off_ra(minv) < segs_end && const_offs(minv) < segs_end - off_ra(minv)); if (off_ra(minv) < off_ra(maxv) && is_offset_test_ok) { rd.ge_than += off_ra(minv); - const bool is_range_end_test_ok = is_negative - ? (off_ra(maxv) + const_offs(minv) <= segs_end) - : (off_ra(maxv) - 1 < segs_end - 1 && const_offs(minv) <= segs_end - off_ra(maxv)); + const bool is_range_end_test_ok = is_negative ? (off_ra(maxv) + const_offs(minv) <= segs_end) : (off_ra(maxv) - 1 < segs_end - 1 && const_offs(minv) <= segs_end - off_ra(maxv)); if (is_range_end_test_ok) { @@ -2494,7 +2517,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con } case ppu_itype::RLWINM: { - //const u64 mask = ppu_rotate_mask(32 + op.mb32, 32 + op.me32); + // const u64 mask = ppu_rotate_mask(32 + op.mb32, 32 + op.me32); if (!is_reg_mapped(op.rs) && !is_reg_mapped(op.ra)) { @@ -2527,7 +2550,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con { const u32 sh = op.sh64; const u32 me = op.mbe64; - //const u64 mask = ~0ull << (63 - me); + // const u64 mask = ~0ull << (63 - me); if (sh == 63 - me) { @@ -2722,7 +2745,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con if (func.addr + func.size > next) { ppu_log.trace("Function overlap: [0x%x] 0x%x -> 0x%x", func.addr, func.size, next - func.addr); - continue; //func.size = next - func.addr; + continue; // func.size = next - func.addr; // Also invalidate blocks for (auto& block : func.blocks) @@ -2855,7 +2878,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con auto& block = fmap[addr]; block.addr = addr; block.size = 4; - block.toc = func.toc; + block.toc = func.toc; block.attr = ppu_attr::no_size; } @@ -2881,7 +2904,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con block.addr = addr; block.size = size; - block.toc = func.toc; + block.toc = func.toc; ppu_log.trace("Block __0x%x added (func=0x%x, size=0x%x, toc=0x%x)", block.addr, it->first, block.size, block.toc); if (!entry && !sec_end) @@ -2902,7 +2925,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con for (auto& rel : this->relocs) { // Disabled (TODO) - //if (!vm::check_addr<4>(rel.addr)) + // if (!vm::check_addr<4>(rel.addr)) { continue; } @@ -3256,7 +3279,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, con auto& i = funcs.emplace_back(); i.addr = addr; i.size = 4; - i.toc = block.toc; + i.toc = block.toc; } per_instruction_bytes += block.size; diff --git a/rpcs3/rpcs3/Emu/Cell/PPUAnalyser.h b/rpcs3/rpcs3/Emu/Cell/PPUAnalyser.h index 693ad8c7e..e7c9f4e59 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUAnalyser.h +++ b/rpcs3/rpcs3/Emu/Cell/PPUAnalyser.h @@ -84,12 +84,12 @@ struct ppu_reloc u64 data; // Operator for sorting - bool operator <(const ppu_reloc& rhs) const + bool operator<(const ppu_reloc& rhs) const { return addr < rhs.addr; } - bool operator <(u32 rhs) const + bool operator<(u32 rhs) const { return addr < rhs; } @@ -127,25 +127,25 @@ struct ppu_module : public Type ppu_module& operator=(ppu_module&&) noexcept = default; - uchar sha1[20]{}; // Hash - std::string name{}; // Filename - std::string path{}; // Filepath - s64 offset = 0; // Offset of file - mutable bs_t attr{}; // Shared module attributes - std::string cache{}; // Cache file path - std::vector relocs{}; // Relocations - std::vector segs{}; // Segments - std::vector secs{}; // Segment sections - std::vector funcs{}; // Function list - std::vector applied_patches; // Patch addresses - std::deque> allocations; // Segment memory allocations - std::map addr_to_seg_index; // address->segment ordered translator map - ppu_module* parent = nullptr; // For compilation: refers to original structure (is whole, not partitioned) - std::pair local_bounds{0, u32{umax}}; // Module addresses range - std::shared_ptr> jit_bounds; // JIT instance modules addresses range - std::unordered_map imports; // Imports information for release upon unload (TODO: OVL implementation!) + uchar sha1[20]{}; // Hash + std::string name{}; // Filename + std::string path{}; // Filepath + s64 offset = 0; // Offset of file + mutable bs_t attr{}; // Shared module attributes + std::string cache{}; // Cache file path + std::vector relocs{}; // Relocations + std::vector segs{}; // Segments + std::vector secs{}; // Segment sections + std::vector funcs{}; // Function list + std::vector applied_patches; // Patch addresses + std::deque> allocations; // Segment memory allocations + std::map addr_to_seg_index; // address->segment ordered translator map + ppu_module* parent = nullptr; // For compilation: refers to original structure (is whole, not partitioned) + std::pair local_bounds{0, u32{umax}}; // Module addresses range + std::shared_ptr> jit_bounds; // JIT instance modules addresses range + std::unordered_map imports; // Imports information for release upon unload (TODO: OVL implementation!) std::map>> stub_addr_to_constant_state_of_registers; // Tells possible constant states of registers of functions - bool is_relocatable = false; // Is code relocatable(?) + bool is_relocatable = false; // Is code relocatable(?) template auto as_span(T&& arg, bool bound_local, bool bound_jit) const @@ -157,10 +157,13 @@ struct ppu_module : public Type { // Return span bound to specified bounds const auto [min_addr, max_addr] = bound_jit ? *jit_bounds : local_bounds; - constexpr auto compare = [](const type& a, u32 addr) { return a.addr < addr; }; + constexpr auto compare = [](const type& a, u32 addr) + { + return a.addr < addr; + }; const auto end = arg.data() + arg.size(); const auto start = std::lower_bound(arg.data(), end, min_addr, compare); - return std::span{ start, std::lower_bound(start, end, max_addr, compare) }; + return std::span{start, std::lower_bound(start, end, max_addr, compare)}; } return std::span(arg.data(), arg.size()); @@ -230,7 +233,8 @@ struct ppu_module : public Type return get_ptr(addr, u32{size_element}); } - template requires requires (const U& obj) { obj.get_ptr(); } + template + requires requires(const U& obj) { obj.get_ptr(); } to_be_t* get_ptr(U&& addr) const { constexpr usz size_element = std::is_void_v ? 0 : sizeof(std::conditional_t, char, T>); @@ -250,7 +254,8 @@ struct ppu_module : public Type return *std::add_pointer_t>{}; } - template requires requires (const U& obj) { obj.get_ptr(); } + template + requires requires(const U& obj) { obj.get_ptr(); } to_be_t& get_ref(U&& addr, u32 index = 0, std::source_location src_loc = std::source_location::current()) const { constexpr usz size_element = std::is_void_v ? 0 : sizeof(std::conditional_t, char, T>); @@ -284,14 +289,12 @@ struct ppu_pattern ppu_pattern() = default; ppu_pattern(u32 op) - : opcode(op) - , mask(0xffffffff) + : opcode(op), mask(0xffffffff) { } ppu_pattern(u32 op, u32 ign) - : opcode(op & ~ign) - , mask(~ign) + : opcode(op & ~ign), mask(~ign) { } }; @@ -302,9 +305,8 @@ struct ppu_pattern_array usz count; template - constexpr ppu_pattern_array(const ppu_pattern(&array)[N]) - : ptr(array) - , count(N) + constexpr ppu_pattern_array(const ppu_pattern (&array)[N]) + : ptr(array), count(N) { } @@ -325,9 +327,8 @@ struct ppu_pattern_matrix usz count; template - constexpr ppu_pattern_matrix(const ppu_pattern_array(&array)[N]) - : ptr(array) - , count(N) + constexpr ppu_pattern_matrix(const ppu_pattern_array (&array)[N]) + : ptr(array), count(N) { } @@ -345,11 +346,21 @@ struct ppu_pattern_matrix // PPU Instruction Type struct ppu_itype { - static constexpr struct branch_tag{} branch{}; // Branch Instructions - static constexpr struct trap_tag{} trap{}; // Trap Instructions - static constexpr struct store_tag{} store{}; // Memory store Instructions - static constexpr struct load_tag{} load{}; // Memory load Instructions (TODO: Fill it) - static constexpr struct memory_tag{} memory{}; // Memory Instructions + static constexpr struct branch_tag + { + } branch{}; // Branch Instructions + static constexpr struct trap_tag + { + } trap{}; // Trap Instructions + static constexpr struct store_tag + { + } store{}; // Memory store Instructions + static constexpr struct load_tag + { + } load{}; // Memory load Instructions (TODO: Fill it) + static constexpr struct memory_tag + { + } memory{}; // Memory Instructions enum class type { @@ -879,22 +890,22 @@ struct ppu_itype using enum type; // Enable address-of operator for ppu_decoder<> - friend constexpr type operator &(type value) + friend constexpr type operator&(type value) { return value; } - friend constexpr bool operator &(type value, branch_tag) + friend constexpr bool operator&(type value, branch_tag) { return value >= B && value <= BCCTR; } - friend constexpr bool operator &(type value, trap_tag) + friend constexpr bool operator&(type value, trap_tag) { return value >= TD && value <= TWI; } - friend constexpr bool operator &(type value, store_tag) + friend constexpr bool operator&(type value, store_tag) { return value >= STMW && value <= DSTST; } diff --git a/rpcs3/rpcs3/Emu/Cell/PPUCallback.h b/rpcs3/rpcs3/Emu/Cell/PPUCallback.h index f9254e29e..4b81f614b 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUCallback.h +++ b/rpcs3/rpcs3/Emu/Cell/PPUCallback.h @@ -23,7 +23,7 @@ namespace ppu_cb_detail // It's possible to calculate suitable stack frame size in template, but too complicated. static const auto FIXED_STACK_FRAME_SIZE = 0x90; - template + template struct _func_arg { static_assert(type == ARG_GENERAL, "Unknown callback argument type"); @@ -37,7 +37,7 @@ namespace ppu_cb_detail } }; - template + template struct _func_arg { static_assert(sizeof(T) <= 8, "Invalid callback argument type for ARG_FLOAT"); @@ -48,7 +48,7 @@ namespace ppu_cb_detail } }; - template + template struct _func_arg { static_assert(std::is_same_v, v128>, "Invalid callback argument type for ARG_VECTOR"); @@ -59,7 +59,7 @@ namespace ppu_cb_detail } }; - template + template struct _func_arg { static_assert(alignof(T) <= 16, "Unsupported callback argument type alignment for ARG_STACK"); @@ -72,7 +72,7 @@ namespace ppu_cb_detail } }; - template + template struct _func_arg { static_assert(std::is_same_v, ppu_thread>, "Invalid callback argument type for ARG_CONTEXT"); @@ -82,14 +82,14 @@ namespace ppu_cb_detail } }; - template + template FORCE_INLINE static bool _bind_func_args(ppu_thread&) { // terminator return false; } - template + template FORCE_INLINE static bool _bind_func_args(ppu_thread& CPU, T1 arg1, T... args) { constexpr bool is_float = std::is_floating_point_v; @@ -99,12 +99,13 @@ namespace ppu_cb_detail constexpr _func_arg_type t = is_general ? (g_count >= 8 ? ARG_STACK : ARG_GENERAL) : - is_float ? (f_count >= 13 ? ARG_STACK : ARG_FLOAT) : - is_vector ? (v_count >= 12 ? ARG_STACK : ARG_VECTOR) : + is_float ? (f_count >= 13 ? ARG_STACK : ARG_FLOAT) : + is_vector ? (v_count >= 12 ? ARG_STACK : ARG_VECTOR) : is_context ? ARG_CONTEXT : - ARG_UNKNOWN; + ARG_UNKNOWN; - constexpr u32 g = g_count + (is_general || is_float ? 1 : is_vector ? (g_count & 1) + 2 : 0); + constexpr u32 g = g_count + (is_general || is_float ? 1 : is_vector ? (g_count & 1) + 2 : + 0); constexpr u32 f = f_count + is_float; constexpr u32 v = v_count + is_vector; @@ -114,7 +115,7 @@ namespace ppu_cb_detail return _bind_func_args(CPU, args...) || (t == ARG_STACK); } - template + template struct _func_res { static_assert(type == ARG_GENERAL, "Unknown callback result type"); @@ -126,7 +127,7 @@ namespace ppu_cb_detail } }; - template + template struct _func_res { static_assert(sizeof(T) <= 8, "Invalid callback result type for ARG_FLOAT"); @@ -137,7 +138,7 @@ namespace ppu_cb_detail } }; - template + template struct _func_res { static_assert(std::is_same_v, v128>, "Invalid callback result type for ARG_VECTOR"); @@ -148,7 +149,7 @@ namespace ppu_cb_detail } }; - template + template struct _func_caller { FORCE_INLINE static RT call(ppu_thread& CPU, u32 pc, u32 rtoc, T... args) @@ -165,7 +166,7 @@ namespace ppu_cb_detail } }; - template + template struct _func_caller { FORCE_INLINE static void call(ppu_thread& CPU, u32 pc, u32 rtoc, T... args) @@ -178,11 +179,11 @@ namespace ppu_cb_detail CPU.gpr[1] = old_r1; } }; -} +} // namespace ppu_cb_detail namespace vm { - template + template FORCE_INLINE RT _ptr_base::operator()(ppu_thread& CPU, T... args) const { const auto data = vm::_ptr(vm::cast(m_addr)); @@ -192,14 +193,15 @@ namespace vm return ppu_cb_detail::_func_caller::call(CPU, pc, rtoc, args...); } - template + template FORCE_INLINE const ppu_func_opd_t& _ptr_base::opd() const { return vm::_ref(vm::cast(m_addr)); } -} +} // namespace vm -template inline RT cb_call(ppu_thread& CPU, u32 pc, u32 rtoc, T... args) +template +inline RT cb_call(ppu_thread& CPU, u32 pc, u32 rtoc, T... args) { return ppu_cb_detail::_func_caller::call(CPU, pc, rtoc, args...); } diff --git a/rpcs3/rpcs3/Emu/Cell/PPUDisAsm.cpp b/rpcs3/rpcs3/Emu/Cell/PPUDisAsm.cpp index 569b60b61..78bf17e02 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUDisAsm.cpp +++ b/rpcs3/rpcs3/Emu/Cell/PPUDisAsm.cpp @@ -39,7 +39,7 @@ u32 PPUDisAsm::disasm(u32 pc) std::memcpy(&op, m_offset + pc, 4); m_op = op; - (this->*(s_ppu_disasm.decode(m_op)))({ m_op }); + (this->*(s_ppu_disasm.decode(m_op)))({m_op}); if (m_offset != vm::g_sudo_addr) { @@ -102,7 +102,7 @@ std::pair PPUDisAsm::try_get_const_op_gpr_value(u32 re for (u32 i = pc; i >= m_start_pc && (m_offset != vm::g_sudo_addr || vm::check_addr(i, vm::page_executable));) { const u32 opcode = *reinterpret_cast*>(m_offset + i); - const ppu_opcode_t op{ opcode }; + const ppu_opcode_t op{opcode}; const auto type = s_ppu_itype.decode(opcode); @@ -112,22 +112,23 @@ std::pair PPUDisAsm::try_get_const_op_gpr_value(u32 re return {}; } - // Get constant register value - #define GET_CONST_OP_REG(var, reg, op) \ - {\ - /* Search for the constant value of the register*/\ - const auto [const_op, value] = try_get_const_op_gpr_value(reg, i - 4, TTL - 1);\ - \ - if (const_op != const_op::op)\ - {\ - /* Cannot compute constant value if register/operation is not constant*/\ - return {};\ - }\ - \ - var = value;\ - } void() /*<- Require a semicolon*/ +// Get constant register value +#define GET_CONST_OP_REG(var, reg, op) \ + { \ + /* Search for the constant value of the register*/ \ + const auto [const_op, value] = try_get_const_op_gpr_value(reg, i - 4, TTL - 1); \ + \ + if (const_op != const_op::op) \ + { \ + /* Cannot compute constant value if register/operation is not constant*/ \ + return {}; \ + } \ + \ + var = value; \ + } \ + void() /*<- Require a semicolon*/ - #define GET_CONST_REG(var, reg) GET_CONST_OP_REG(var, reg, form) +#define GET_CONST_REG(var, reg) GET_CONST_OP_REG(var, reg, form) switch (type) { @@ -147,7 +148,7 @@ std::pair PPUDisAsm::try_get_const_op_gpr_value(u32 re GET_CONST_REG(reg_ra, op.ra); } - return { form, reg_ra + (type == ppu_itype::ADDIS ? op.simm16 * 65536 : op.simm16) }; + return {form, reg_ra + (type == ppu_itype::ADDIS ? op.simm16 * 65536 : op.simm16)}; } case ppu_itype::ORI: { @@ -167,7 +168,7 @@ std::pair PPUDisAsm::try_get_const_op_gpr_value(u32 re GET_CONST_REG(reg_rs, op.rs); - return { form, reg_rs | op.uimm16 }; + return {form, reg_rs | op.uimm16}; } case ppu_itype::ORIS: { @@ -186,7 +187,7 @@ std::pair PPUDisAsm::try_get_const_op_gpr_value(u32 re GET_CONST_REG(reg_rs, op.rs); - return { form, reg_rs | (u64{op.uimm16} << 16)}; + return {form, reg_rs | (u64{op.uimm16} << 16)}; } case ppu_itype::XORIS: { @@ -199,7 +200,7 @@ std::pair PPUDisAsm::try_get_const_op_gpr_value(u32 re if (const_op == none) { - return { xor_mask, (u64{op.uimm16} << 16) }; + return {xor_mask, (u64{op.uimm16} << 16)}; } if (const_op != form) @@ -208,7 +209,7 @@ std::pair PPUDisAsm::try_get_const_op_gpr_value(u32 re return {}; } - return { form, reg_rs ^ (u64{op.uimm16} << 16)}; + return {form, reg_rs ^ (u64{op.uimm16} << 16)}; } case ppu_itype::RLDICR: { @@ -221,7 +222,7 @@ std::pair PPUDisAsm::try_get_const_op_gpr_value(u32 re GET_CONST_REG(reg_rs, op.rs); - return { form, utils::rol64(reg_rs, op.sh64) & (~0ull << (op.mbe64 ^ 63)) }; + return {form, utils::rol64(reg_rs, op.sh64) & (~0ull << (op.mbe64 ^ 63))}; } case ppu_itype::OR: { @@ -246,7 +247,7 @@ std::pair PPUDisAsm::try_get_const_op_gpr_value(u32 re GET_CONST_REG(reg_rb, op.rb); } - return { form, reg_rs | reg_rb }; + return {form, reg_rs | reg_rb}; } case ppu_itype::XOR: { @@ -257,7 +258,7 @@ std::pair PPUDisAsm::try_get_const_op_gpr_value(u32 re if (op.rs == op.rb) { - return { form, 0 }; + return {form, 0}; } const auto [const_op_rs, reg_rs] = try_get_const_op_gpr_value(op.rs, i - 4, TTL - 1); @@ -266,16 +267,16 @@ std::pair PPUDisAsm::try_get_const_op_gpr_value(u32 re if (const_op_rs == form && const_op_rb == form) { // Normally it is not the case - return { form, reg_rs ^ reg_rb }; + return {form, reg_rs ^ reg_rb}; } if (const_op_rs == form && const_op_rb == none) { - return { xor_mask, reg_rs }; + return {xor_mask, reg_rs}; } else if (const_op_rb == form && const_op_rs == none) { - return { xor_mask, reg_rb }; + return {xor_mask, reg_rb}; } return {}; @@ -362,46 +363,56 @@ constexpr std::pair get_BC_info(u32 bo, u32 bi) case 0b00000: case 0b00001: { - info = {"bdnzf", 'f'}; break; + info = {"bdnzf", 'f'}; + break; } case 0b00010: case 0b00011: { - info = {"bdzf", 'f'}; break; + info = {"bdzf", 'f'}; + break; } case 0b01000: case 0b01001: { - info = {"bdnzt", 't'}; break; + info = {"bdnzt", 't'}; + break; } case 0b01010: case 0b01011: { - info = {"bdzt", 't'}; break; + info = {"bdzt", 't'}; + break; } case 0b10010: { - info.first = "bdz"; break; + info.first = "bdz"; + break; } case 0b11010: { - info = {"bdz", '-'}; break; + info = {"bdz", '-'}; + break; } case 0b11011: { - info = {"bdz", '+'}; break; + info = {"bdz", '+'}; + break; } case 0b10000: { - info.first = "bdnz"; break; + info.first = "bdnz"; + break; } case 0b11000: { - info = {"bdnz", '-'}; break; + info = {"bdnz", '-'}; + break; } case 0b11001: { - info = {"bdnz", '+'}; break; + info = {"bdnz", '+'}; + break; } case 0b00100: { @@ -479,10 +490,10 @@ constexpr std::pair get_BC_info(u32 bo, u32 bi) } break; } - //case 0b10100: + // case 0b10100: //{ // info.first = "b"; break; - //} + // } default: break; } @@ -1338,9 +1349,12 @@ void PPUDisAsm::BC(ppu_opcode_t op) } std::string final = inst; - if (lk) final += 'l'; - if (aa) final += 'a'; - if (sign) final += sign; + if (lk) + final += 'l'; + if (aa) + final += 'a'; + if (sign) + final += sign; // Check if need to display full BI value if (sign == 't' || sign == 'f') @@ -1428,16 +1442,16 @@ void PPUDisAsm::B(ppu_opcode_t op) case 0: switch (aa) { - case 0: DisAsm_BRANCH("b", li); break; - case 1: DisAsm_BRANCH_A("ba", li); break; + case 0: DisAsm_BRANCH("b", li); break; + case 1: DisAsm_BRANCH_A("ba", li); break; } break; case 1: switch (aa) { - case 0: DisAsm_BRANCH("bl", li); break; - case 1: DisAsm_BRANCH_A("bla", li); break; + case 0: DisAsm_BRANCH("bl", li); break; + case 1: DisAsm_BRANCH_A("bla", li); break; } break; } @@ -1470,7 +1484,8 @@ void PPUDisAsm::BCLR(ppu_opcode_t op) } std::string final = std::string(inst) + (lk ? "lrl" : "lr"); - if (sign) final += sign; + if (sign) + final += sign; // Check if need to display full BI value if (sign == 't' || sign == 'f') @@ -1575,7 +1590,8 @@ void PPUDisAsm::BCCTR(ppu_opcode_t op) std::string final = inst; final += lk ? "ctrl"sv : "ctr"sv; - if (sign) final += sign; + if (sign) + final += sign; DisAsm_CR_BRANCH_HINT(final, bi / 4, bh); } @@ -1608,8 +1624,13 @@ void PPUDisAsm::RLWNM(ppu_opcode_t op) void PPUDisAsm::ORI(ppu_opcode_t op) { - if (op.rs == 0 && op.ra == 0 && op.uimm16 == 0) { last_opcode += "nop"; return; } - if (op.uimm16 == 0) return DisAsm_R2("mr", op.ra, op.rs); + if (op.rs == 0 && op.ra == 0 && op.uimm16 == 0) + { + last_opcode += "nop"; + return; + } + if (op.uimm16 == 0) + return DisAsm_R2("mr", op.ra, op.rs); DisAsm_R2_IMM("ori", op.ra, op.rs, op.uimm16); if (auto [is_const, value] = try_get_const_gpr_value(op.rs); is_const) @@ -1621,7 +1642,11 @@ void PPUDisAsm::ORI(ppu_opcode_t op) void PPUDisAsm::ORIS(ppu_opcode_t op) { - if (op.rs == 0 && op.ra == 0 && op.uimm16 == 0) { last_opcode += "nop"; return; } + if (op.rs == 0 && op.ra == 0 && op.uimm16 == 0) + { + last_opcode += "nop"; + return; + } DisAsm_R2_IMM("oris", op.ra, op.rs, op.uimm16); if (auto [is_const, value] = try_get_const_gpr_value(op.rs); is_const) diff --git a/rpcs3/rpcs3/Emu/Cell/PPUDisAsm.h b/rpcs3/rpcs3/Emu/Cell/PPUDisAsm.h index fd04737b1..c02b0b4dc 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUDisAsm.h +++ b/rpcs3/rpcs3/Emu/Cell/PPUDisAsm.h @@ -262,7 +262,7 @@ private: void DisAsm_BI3(std::string_view op, const int i0, const int i1, const int i2) { fmt::append(last_opcode, "%-*s cr%d[%s],cr%d[%s],cr%d[%s]", PadOp(), op, - i0 / 4, get_partial_BI_field(i0), i1 / 4, get_partial_BI_field(i1), i2 / 4, get_partial_BI_field(i2)); + i0 / 4, get_partial_BI_field(i0), i1 / 4, get_partial_BI_field(i1), i2 / 4, get_partial_BI_field(i2)); } void DisAsm_INT3(std::string_view op, const int i0, const int i1, const int i2) { @@ -309,7 +309,7 @@ public: enum class const_op { none, - form, // Cosntant formation + form, // Cosntant formation xor_mask, // Constant XOR mask applied (used with CMPI/CMPLI instructions, covers their limit of 16-bit immediates) }; @@ -351,31 +351,70 @@ public: void VCFSX(ppu_opcode_t op); void VCFUX(ppu_opcode_t op); void VCMPBFP(ppu_opcode_t op); - void VCMPBFP_(ppu_opcode_t op) { return VCMPBFP(op); } + void VCMPBFP_(ppu_opcode_t op) + { + return VCMPBFP(op); + } void VCMPEQFP(ppu_opcode_t op); - void VCMPEQFP_(ppu_opcode_t op) { return VCMPEQFP(op); } + void VCMPEQFP_(ppu_opcode_t op) + { + return VCMPEQFP(op); + } void VCMPEQUB(ppu_opcode_t op); - void VCMPEQUB_(ppu_opcode_t op) { return VCMPEQUB(op); } + void VCMPEQUB_(ppu_opcode_t op) + { + return VCMPEQUB(op); + } void VCMPEQUH(ppu_opcode_t op); - void VCMPEQUH_(ppu_opcode_t op) { return VCMPEQUH(op); } + void VCMPEQUH_(ppu_opcode_t op) + { + return VCMPEQUH(op); + } void VCMPEQUW(ppu_opcode_t op); - void VCMPEQUW_(ppu_opcode_t op) { return VCMPEQUW(op); } + void VCMPEQUW_(ppu_opcode_t op) + { + return VCMPEQUW(op); + } void VCMPGEFP(ppu_opcode_t op); - void VCMPGEFP_(ppu_opcode_t op) { return VCMPGEFP(op); } + void VCMPGEFP_(ppu_opcode_t op) + { + return VCMPGEFP(op); + } void VCMPGTFP(ppu_opcode_t op); - void VCMPGTFP_(ppu_opcode_t op) { return VCMPGTFP(op); } + void VCMPGTFP_(ppu_opcode_t op) + { + return VCMPGTFP(op); + } void VCMPGTSB(ppu_opcode_t op); - void VCMPGTSB_(ppu_opcode_t op) { return VCMPGTSB(op); } + void VCMPGTSB_(ppu_opcode_t op) + { + return VCMPGTSB(op); + } void VCMPGTSH(ppu_opcode_t op); - void VCMPGTSH_(ppu_opcode_t op) { return VCMPGTSH(op); } + void VCMPGTSH_(ppu_opcode_t op) + { + return VCMPGTSH(op); + } void VCMPGTSW(ppu_opcode_t op); - void VCMPGTSW_(ppu_opcode_t op) { return VCMPGTSW(op); } + void VCMPGTSW_(ppu_opcode_t op) + { + return VCMPGTSW(op); + } void VCMPGTUB(ppu_opcode_t op); - void VCMPGTUB_(ppu_opcode_t op) { return VCMPGTUB(op); } + void VCMPGTUB_(ppu_opcode_t op) + { + return VCMPGTUB(op); + } void VCMPGTUH(ppu_opcode_t op); - void VCMPGTUH_(ppu_opcode_t op) { return VCMPGTUH(op); } + void VCMPGTUH_(ppu_opcode_t op) + { + return VCMPGTUH(op); + } void VCMPGTUW(ppu_opcode_t op); - void VCMPGTUW_(ppu_opcode_t op) { return VCMPGTUW(op); } + void VCMPGTUW_(ppu_opcode_t op) + { + return VCMPGTUW(op); + } void VCTSXS(ppu_opcode_t op); void VCTUXS(ppu_opcode_t op); void VEXPTEFP(ppu_opcode_t op); @@ -722,127 +761,490 @@ public: void UNK(ppu_opcode_t op); - void SUBFCO(ppu_opcode_t op) { return SUBFC(op); } - void ADDCO(ppu_opcode_t op) { return ADDC(op); } - void SUBFO(ppu_opcode_t op) { return SUBF(op); } - void NEGO(ppu_opcode_t op) { return NEG(op); } - void SUBFEO(ppu_opcode_t op) { return SUBFE(op); } - void ADDEO(ppu_opcode_t op) { return ADDE(op); } - void SUBFZEO(ppu_opcode_t op) { return SUBFZE(op); } - void ADDZEO(ppu_opcode_t op) { return ADDZE(op); } - void SUBFMEO(ppu_opcode_t op) { return SUBFME(op); } - void MULLDO(ppu_opcode_t op) { return MULLD(op); } - void ADDMEO(ppu_opcode_t op) { return ADDME(op); } - void MULLWO(ppu_opcode_t op) { return MULLW(op); } - void ADDO(ppu_opcode_t op) { return ADD(op); } - void DIVDUO(ppu_opcode_t op) { return DIVDU(op); } - void DIVWUO(ppu_opcode_t op) { return DIVWU(op); } - void DIVDO(ppu_opcode_t op) { return DIVD(op); } - void DIVWO(ppu_opcode_t op) { return DIVW(op); } + void SUBFCO(ppu_opcode_t op) + { + return SUBFC(op); + } + void ADDCO(ppu_opcode_t op) + { + return ADDC(op); + } + void SUBFO(ppu_opcode_t op) + { + return SUBF(op); + } + void NEGO(ppu_opcode_t op) + { + return NEG(op); + } + void SUBFEO(ppu_opcode_t op) + { + return SUBFE(op); + } + void ADDEO(ppu_opcode_t op) + { + return ADDE(op); + } + void SUBFZEO(ppu_opcode_t op) + { + return SUBFZE(op); + } + void ADDZEO(ppu_opcode_t op) + { + return ADDZE(op); + } + void SUBFMEO(ppu_opcode_t op) + { + return SUBFME(op); + } + void MULLDO(ppu_opcode_t op) + { + return MULLD(op); + } + void ADDMEO(ppu_opcode_t op) + { + return ADDME(op); + } + void MULLWO(ppu_opcode_t op) + { + return MULLW(op); + } + void ADDO(ppu_opcode_t op) + { + return ADD(op); + } + void DIVDUO(ppu_opcode_t op) + { + return DIVDU(op); + } + void DIVWUO(ppu_opcode_t op) + { + return DIVWU(op); + } + void DIVDO(ppu_opcode_t op) + { + return DIVD(op); + } + void DIVWO(ppu_opcode_t op) + { + return DIVW(op); + } - void SUBFCO_(ppu_opcode_t op) { return SUBFC(op); } - void ADDCO_(ppu_opcode_t op) { return ADDC(op); } - void SUBFO_(ppu_opcode_t op) { return SUBF(op); } - void NEGO_(ppu_opcode_t op) { return NEG(op); } - void SUBFEO_(ppu_opcode_t op) { return SUBFE(op); } - void ADDEO_(ppu_opcode_t op) { return ADDE(op); } - void SUBFZEO_(ppu_opcode_t op) { return SUBFZE(op); } - void ADDZEO_(ppu_opcode_t op) { return ADDZE(op); } - void SUBFMEO_(ppu_opcode_t op) { return SUBFME(op); } - void MULLDO_(ppu_opcode_t op) { return MULLD(op); } - void ADDMEO_(ppu_opcode_t op) { return ADDME(op); } - void MULLWO_(ppu_opcode_t op) { return MULLW(op); } - void ADDO_(ppu_opcode_t op) { return ADD(op); } - void DIVDUO_(ppu_opcode_t op) { return DIVDU(op); } - void DIVWUO_(ppu_opcode_t op) { return DIVWU(op); } - void DIVDO_(ppu_opcode_t op) { return DIVD(op); } - void DIVWO_(ppu_opcode_t op) { return DIVW(op); } + void SUBFCO_(ppu_opcode_t op) + { + return SUBFC(op); + } + void ADDCO_(ppu_opcode_t op) + { + return ADDC(op); + } + void SUBFO_(ppu_opcode_t op) + { + return SUBF(op); + } + void NEGO_(ppu_opcode_t op) + { + return NEG(op); + } + void SUBFEO_(ppu_opcode_t op) + { + return SUBFE(op); + } + void ADDEO_(ppu_opcode_t op) + { + return ADDE(op); + } + void SUBFZEO_(ppu_opcode_t op) + { + return SUBFZE(op); + } + void ADDZEO_(ppu_opcode_t op) + { + return ADDZE(op); + } + void SUBFMEO_(ppu_opcode_t op) + { + return SUBFME(op); + } + void MULLDO_(ppu_opcode_t op) + { + return MULLD(op); + } + void ADDMEO_(ppu_opcode_t op) + { + return ADDME(op); + } + void MULLWO_(ppu_opcode_t op) + { + return MULLW(op); + } + void ADDO_(ppu_opcode_t op) + { + return ADD(op); + } + void DIVDUO_(ppu_opcode_t op) + { + return DIVDU(op); + } + void DIVWUO_(ppu_opcode_t op) + { + return DIVWU(op); + } + void DIVDO_(ppu_opcode_t op) + { + return DIVD(op); + } + void DIVWO_(ppu_opcode_t op) + { + return DIVW(op); + } - void RLWIMI_(ppu_opcode_t op) { return RLWIMI(op); } - void RLWINM_(ppu_opcode_t op) { return RLWINM(op); } - void RLWNM_(ppu_opcode_t op) { return RLWNM(op); } - void RLDICL_(ppu_opcode_t op) { return RLDICL(op); } - void RLDICR_(ppu_opcode_t op) { return RLDICR(op); } - void RLDIC_(ppu_opcode_t op) { return RLDIC(op); } - void RLDIMI_(ppu_opcode_t op) { return RLDIMI(op); } - void RLDCL_(ppu_opcode_t op) { return RLDCL(op); } - void RLDCR_(ppu_opcode_t op) { return RLDCR(op); } - void SUBFC_(ppu_opcode_t op) { return SUBFC(op); } - void MULHDU_(ppu_opcode_t op) { return MULHDU(op); } - void ADDC_(ppu_opcode_t op) { return ADDC(op); } - void MULHWU_(ppu_opcode_t op) { return MULHWU(op); } - void SLW_(ppu_opcode_t op) { return SLW(op); } - void CNTLZW_(ppu_opcode_t op) { return CNTLZW(op); } - void SLD_(ppu_opcode_t op) { return SLD(op); } - void AND_(ppu_opcode_t op) { return AND(op); } - void SUBF_(ppu_opcode_t op) { return SUBF(op); } - void CNTLZD_(ppu_opcode_t op) { return CNTLZD(op); } - void ANDC_(ppu_opcode_t op) { return ANDC(op); } - void MULHD_(ppu_opcode_t op) { return MULHD(op); } - void MULHW_(ppu_opcode_t op) { return MULHW(op); } - void NEG_(ppu_opcode_t op) { return NEG(op); } - void NOR_(ppu_opcode_t op) { return NOR(op); } - void SUBFE_(ppu_opcode_t op) { return SUBFE(op); } - void ADDE_(ppu_opcode_t op) { return ADDE(op); } - void SUBFZE_(ppu_opcode_t op) { return SUBFZE(op); } - void ADDZE_(ppu_opcode_t op) { return ADDZE(op); } - void MULLD_(ppu_opcode_t op) { return MULLD(op); } - void SUBFME_(ppu_opcode_t op) { return SUBFME(op); } - void ADDME_(ppu_opcode_t op) { return ADDME(op); } - void MULLW_(ppu_opcode_t op) { return MULLW(op); } - void ADD_(ppu_opcode_t op) { return ADD(op); } - void EQV_(ppu_opcode_t op) { return EQV(op); } - void XOR_(ppu_opcode_t op) { return XOR(op); } - void ORC_(ppu_opcode_t op) { return ORC(op); } - void OR_(ppu_opcode_t op) { return OR(op); } - void DIVDU_(ppu_opcode_t op) { return DIVDU(op); } - void DIVWU_(ppu_opcode_t op) { return DIVWU(op); } - void NAND_(ppu_opcode_t op) { return NAND(op); } - void DIVD_(ppu_opcode_t op) { return DIVD(op); } - void DIVW_(ppu_opcode_t op) { return DIVW(op); } - void SRW_(ppu_opcode_t op) { return SRW(op); } - void SRD_(ppu_opcode_t op) { return SRD(op); } - void SRAW_(ppu_opcode_t op) { return SRAW(op); } - void SRAD_(ppu_opcode_t op) { return SRAD(op); } - void SRAWI_(ppu_opcode_t op) { return SRAWI(op); } - void SRADI_(ppu_opcode_t op) { return SRADI(op); } - void EXTSH_(ppu_opcode_t op) { return EXTSH(op); } - void EXTSB_(ppu_opcode_t op) { return EXTSB(op); } - void EXTSW_(ppu_opcode_t op) { return EXTSW(op); } - void FDIVS_(ppu_opcode_t op) { return FDIVS(op); } - void FSUBS_(ppu_opcode_t op) { return FSUBS(op); } - void FADDS_(ppu_opcode_t op) { return FADDS(op); } - void FSQRTS_(ppu_opcode_t op) { return FSQRTS(op); } - void FRES_(ppu_opcode_t op) { return FRES(op); } - void FMULS_(ppu_opcode_t op) { return FMULS(op); } - void FMADDS_(ppu_opcode_t op) { return FMADDS(op); } - void FMSUBS_(ppu_opcode_t op) { return FMSUBS(op); } - void FNMSUBS_(ppu_opcode_t op) { return FNMSUBS(op); } - void FNMADDS_(ppu_opcode_t op) { return FNMADDS(op); } - void MTFSB1_(ppu_opcode_t op) { return MTFSB1(op); } - void MTFSB0_(ppu_opcode_t op) { return MTFSB0(op); } - void MTFSFI_(ppu_opcode_t op) { return MTFSFI(op); } - void MFFS_(ppu_opcode_t op) { return MFFS(op); } - void MTFSF_(ppu_opcode_t op) { return MTFSF(op); } - void FRSP_(ppu_opcode_t op) { return FRSP(op); } - void FCTIW_(ppu_opcode_t op) { return FCTIW(op); } - void FCTIWZ_(ppu_opcode_t op) { return FCTIWZ(op); } - void FDIV_(ppu_opcode_t op) { return FDIV(op); } - void FSUB_(ppu_opcode_t op) { return FSUB(op); } - void FADD_(ppu_opcode_t op) { return FADD(op); } - void FSQRT_(ppu_opcode_t op) { return FSQRT(op); } - void FSEL_(ppu_opcode_t op) { return FSEL(op); } - void FMUL_(ppu_opcode_t op) { return FMUL(op); } - void FRSQRTE_(ppu_opcode_t op) { return FRSQRTE(op); } - void FMSUB_(ppu_opcode_t op) { return FMSUB(op); } - void FMADD_(ppu_opcode_t op) { return FMADD(op); } - void FNMSUB_(ppu_opcode_t op) { return FNMSUB(op); } - void FNMADD_(ppu_opcode_t op) { return FNMADD(op); } - void FNEG_(ppu_opcode_t op) { return FNEG(op); } - void FMR_(ppu_opcode_t op) { return FMR(op); } - void FNABS_(ppu_opcode_t op) { return FNABS(op); } - void FABS_(ppu_opcode_t op) { return FABS(op); } - void FCTID_(ppu_opcode_t op) { return FCTID(op); } - void FCTIDZ_(ppu_opcode_t op) { return FCTIDZ(op); } - void FCFID_(ppu_opcode_t op) { return FCFID(op); } + void RLWIMI_(ppu_opcode_t op) + { + return RLWIMI(op); + } + void RLWINM_(ppu_opcode_t op) + { + return RLWINM(op); + } + void RLWNM_(ppu_opcode_t op) + { + return RLWNM(op); + } + void RLDICL_(ppu_opcode_t op) + { + return RLDICL(op); + } + void RLDICR_(ppu_opcode_t op) + { + return RLDICR(op); + } + void RLDIC_(ppu_opcode_t op) + { + return RLDIC(op); + } + void RLDIMI_(ppu_opcode_t op) + { + return RLDIMI(op); + } + void RLDCL_(ppu_opcode_t op) + { + return RLDCL(op); + } + void RLDCR_(ppu_opcode_t op) + { + return RLDCR(op); + } + void SUBFC_(ppu_opcode_t op) + { + return SUBFC(op); + } + void MULHDU_(ppu_opcode_t op) + { + return MULHDU(op); + } + void ADDC_(ppu_opcode_t op) + { + return ADDC(op); + } + void MULHWU_(ppu_opcode_t op) + { + return MULHWU(op); + } + void SLW_(ppu_opcode_t op) + { + return SLW(op); + } + void CNTLZW_(ppu_opcode_t op) + { + return CNTLZW(op); + } + void SLD_(ppu_opcode_t op) + { + return SLD(op); + } + void AND_(ppu_opcode_t op) + { + return AND(op); + } + void SUBF_(ppu_opcode_t op) + { + return SUBF(op); + } + void CNTLZD_(ppu_opcode_t op) + { + return CNTLZD(op); + } + void ANDC_(ppu_opcode_t op) + { + return ANDC(op); + } + void MULHD_(ppu_opcode_t op) + { + return MULHD(op); + } + void MULHW_(ppu_opcode_t op) + { + return MULHW(op); + } + void NEG_(ppu_opcode_t op) + { + return NEG(op); + } + void NOR_(ppu_opcode_t op) + { + return NOR(op); + } + void SUBFE_(ppu_opcode_t op) + { + return SUBFE(op); + } + void ADDE_(ppu_opcode_t op) + { + return ADDE(op); + } + void SUBFZE_(ppu_opcode_t op) + { + return SUBFZE(op); + } + void ADDZE_(ppu_opcode_t op) + { + return ADDZE(op); + } + void MULLD_(ppu_opcode_t op) + { + return MULLD(op); + } + void SUBFME_(ppu_opcode_t op) + { + return SUBFME(op); + } + void ADDME_(ppu_opcode_t op) + { + return ADDME(op); + } + void MULLW_(ppu_opcode_t op) + { + return MULLW(op); + } + void ADD_(ppu_opcode_t op) + { + return ADD(op); + } + void EQV_(ppu_opcode_t op) + { + return EQV(op); + } + void XOR_(ppu_opcode_t op) + { + return XOR(op); + } + void ORC_(ppu_opcode_t op) + { + return ORC(op); + } + void OR_(ppu_opcode_t op) + { + return OR(op); + } + void DIVDU_(ppu_opcode_t op) + { + return DIVDU(op); + } + void DIVWU_(ppu_opcode_t op) + { + return DIVWU(op); + } + void NAND_(ppu_opcode_t op) + { + return NAND(op); + } + void DIVD_(ppu_opcode_t op) + { + return DIVD(op); + } + void DIVW_(ppu_opcode_t op) + { + return DIVW(op); + } + void SRW_(ppu_opcode_t op) + { + return SRW(op); + } + void SRD_(ppu_opcode_t op) + { + return SRD(op); + } + void SRAW_(ppu_opcode_t op) + { + return SRAW(op); + } + void SRAD_(ppu_opcode_t op) + { + return SRAD(op); + } + void SRAWI_(ppu_opcode_t op) + { + return SRAWI(op); + } + void SRADI_(ppu_opcode_t op) + { + return SRADI(op); + } + void EXTSH_(ppu_opcode_t op) + { + return EXTSH(op); + } + void EXTSB_(ppu_opcode_t op) + { + return EXTSB(op); + } + void EXTSW_(ppu_opcode_t op) + { + return EXTSW(op); + } + void FDIVS_(ppu_opcode_t op) + { + return FDIVS(op); + } + void FSUBS_(ppu_opcode_t op) + { + return FSUBS(op); + } + void FADDS_(ppu_opcode_t op) + { + return FADDS(op); + } + void FSQRTS_(ppu_opcode_t op) + { + return FSQRTS(op); + } + void FRES_(ppu_opcode_t op) + { + return FRES(op); + } + void FMULS_(ppu_opcode_t op) + { + return FMULS(op); + } + void FMADDS_(ppu_opcode_t op) + { + return FMADDS(op); + } + void FMSUBS_(ppu_opcode_t op) + { + return FMSUBS(op); + } + void FNMSUBS_(ppu_opcode_t op) + { + return FNMSUBS(op); + } + void FNMADDS_(ppu_opcode_t op) + { + return FNMADDS(op); + } + void MTFSB1_(ppu_opcode_t op) + { + return MTFSB1(op); + } + void MTFSB0_(ppu_opcode_t op) + { + return MTFSB0(op); + } + void MTFSFI_(ppu_opcode_t op) + { + return MTFSFI(op); + } + void MFFS_(ppu_opcode_t op) + { + return MFFS(op); + } + void MTFSF_(ppu_opcode_t op) + { + return MTFSF(op); + } + void FRSP_(ppu_opcode_t op) + { + return FRSP(op); + } + void FCTIW_(ppu_opcode_t op) + { + return FCTIW(op); + } + void FCTIWZ_(ppu_opcode_t op) + { + return FCTIWZ(op); + } + void FDIV_(ppu_opcode_t op) + { + return FDIV(op); + } + void FSUB_(ppu_opcode_t op) + { + return FSUB(op); + } + void FADD_(ppu_opcode_t op) + { + return FADD(op); + } + void FSQRT_(ppu_opcode_t op) + { + return FSQRT(op); + } + void FSEL_(ppu_opcode_t op) + { + return FSEL(op); + } + void FMUL_(ppu_opcode_t op) + { + return FMUL(op); + } + void FRSQRTE_(ppu_opcode_t op) + { + return FRSQRTE(op); + } + void FMSUB_(ppu_opcode_t op) + { + return FMSUB(op); + } + void FMADD_(ppu_opcode_t op) + { + return FMADD(op); + } + void FNMSUB_(ppu_opcode_t op) + { + return FNMSUB(op); + } + void FNMADD_(ppu_opcode_t op) + { + return FNMADD(op); + } + void FNEG_(ppu_opcode_t op) + { + return FNEG(op); + } + void FMR_(ppu_opcode_t op) + { + return FMR(op); + } + void FNABS_(ppu_opcode_t op) + { + return FNABS(op); + } + void FABS_(ppu_opcode_t op) + { + return FABS(op); + } + void FCTID_(ppu_opcode_t op) + { + return FCTID(op); + } + void FCTIDZ_(ppu_opcode_t op) + { + return FCTIDZ(op); + } + void FCFID_(ppu_opcode_t op) + { + return FCFID(op); + } }; diff --git a/rpcs3/rpcs3/Emu/Cell/PPUFunction.cpp b/rpcs3/rpcs3/Emu/Cell/PPUFunction.cpp index 5ac681d6a..45cac3b40 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUFunction.cpp +++ b/rpcs3/rpcs3/Emu/Cell/PPUFunction.cpp @@ -9,1784 +9,1788 @@ // Get function name by FNID extern std::string ppu_get_function_name(const std::string& _module, u32 fnid) { - if (_module.empty()) switch (fnid) - { - case 0x0d10fd3f: return "module_prologue"; - case 0x330f7005: return "module_epilogue"; - case 0x3ab9a95e: return "module_exit"; - case 0xbc9a0086: return "module_start"; - case 0xab779874: return "module_stop"; - } + if (_module.empty()) + switch (fnid) + { + case 0x0d10fd3f: return "module_prologue"; + case 0x330f7005: return "module_epilogue"; + case 0x3ab9a95e: return "module_exit"; + case 0xbc9a0086: return "module_start"; + case 0xab779874: return "module_stop"; + } // Check known FNIDs - if (_module == "sys_libc" || _module == "sys_libm") switch (fnid) - { - case 0x00acf0e5: return "spu_printf_finalize"; - case 0x00fb4a6b: return "spu_thread_sprintf"; - case 0x0125b2ca: return "_rand_int32_TT800"; - case 0x01508f24: return "raw_spu_write_float"; - case 0x0264f468: return "_Wctomb"; - case 0x02f4d325: return "spu_thread_read_double"; - case 0x02f52a3c: return "_filep_close_it"; - case 0x03becf3c: return "_Defloc"; - case 0x04a183fc: return "strcpy"; - case 0x04a1f19d: return "raw_spu_write_short"; - case 0x05d821c4: return "_Stoullx"; - case 0x077cdb23: return "btowc"; - case 0x07c7971d: return "_Stoldx"; - case 0x0871ffb0: return "mspace_malloc_usable_size"; - case 0x0891a3fa: return "_Tlsfree"; - case 0x09cbee1e: return "strxfrm"; - case 0x0a1d4b00: return "spu_thread_read_uint"; - case 0x0a4e2541: return "spu_thread_read_ldouble"; - case 0x0ae275a4: return "_Stolx"; - case 0x0b0d272f: return "_malloc_finalize"; - case 0x0b9d04d0: return "_Getnloc"; - case 0x0b9ecb98: return "toupper_ascii"; - case 0x0cae547f: return "raw_spu_write_double"; - case 0x0d2a593b: return "srand"; - case 0x0d8a2de0: return "_CStrxfrm"; - case 0x0df8809f: return "__call_functions_registered_with_atexit"; - case 0x0f60eb63: return "vfwscanf"; - case 0x0ff4722c: return "raw_spu_read_ushort"; - case 0x1096f8f1: return "ispunct_ascii"; - case 0x1098a99d: return "localeconv"; - case 0x112ea8ea: return "strspn"; - case 0x115e2f70: return "spu_thread_snprintf"; - case 0x116cda13: return "wcstol"; - case 0x118712ea: return "islower"; - case 0x11d270d2: return "exitspawn"; - case 0x126656b7: return "_Btowc"; - case 0x128b334f: return "raw_spu_read_mem"; - case 0x12a55fb7: return "mbrtowc"; - case 0x130d20a5: return "towlower"; - case 0x1365b52a: return "fcntl"; - case 0x13808972: return "wcstok"; - case 0x14052ae0: return "absi4"; - case 0x14348b57: return "divi4"; - case 0x145853cd: return "mspace_destroy"; - case 0x15362bc9: return "spu_thread_read_long"; - case 0x153b364a: return "mkdir"; - case 0x15bdcc00: return "rand"; - case 0x15c2e29d: return "isgraph_ascii"; - case 0x17752bab: return "wcsftime"; - case 0x17bc0136: return "_Lrv2d"; - case 0x17c031d7: return "spu_thread_read_ulong"; - case 0x1855b9b1: return "setlocale"; - case 0x1895908d: return "mspace_realloc"; - case 0x18e48b5d: return "wscanf"; - case 0x18f7b77d: return "_Dnorm"; - case 0x1970cd7e: return "getpid"; - case 0x19ccbb81: return "mktime"; - case 0x1ab01ea8: return "truncate"; - case 0x1abd0985: return "div"; - case 0x1ae06860: return "wcstoumax"; - case 0x1b4c3ff0: return "atexit"; - case 0x1c0e8ab6: return "vswscanf"; - case 0x1c2ef212: return "getwc"; - case 0x1cf4d80a: return "iswalpha"; - case 0x1dcd8609: return "_Strxfrmx"; - case 0x1dd0d4c5: return "spu_printf_attach_group"; - case 0x1df4732e: return "_Getptolower"; - case 0x1e9d2b4f: return "spu_thread_read_int"; - case 0x1ecae195: return "_Vacopy"; - case 0x1f913e8d: return "chmod"; - case 0x1f925c41: return "_allocate_mapped_pages"; - case 0x206612c4: return "spu_thread_read_ptr"; - case 0x216984ed: return "spu_thread_write_long"; - case 0x216fcd2a: return "_Atrealloc"; - case 0x21807b8e: return "towctrans"; - case 0x225702e1: return "_fs_initialize"; - case 0x22b0e566: return "_Stollx"; - case 0x23d3bca7: return "_Eadd"; - case 0x242c603e: return "_Frprep"; - case 0x243b52d8: return "_Mbtowcx"; - case 0x24802244: return "iswcntrl"; - case 0x24c9e021: return "abs"; - case 0x24e230d2: return "_Wctob"; - case 0x24f6cbdd: return "clock"; - case 0x253b7210: return "_rand_real2_TT800"; - case 0x25beee5a: return "__raw_spu_printf"; - case 0x25da8fbb: return "iscntrl"; - case 0x266311a0: return "localtime"; - case 0x2677568c: return "putchar"; - case 0x26f023d5: return "ftell"; - case 0x273b9711: return "sprintf"; - case 0x28b92ebf: return "raw_spu_read_uchar"; - case 0x296bc72f: return "_FDunscale"; - case 0x2b45cb34: return "wcsrtombs"; - case 0x2b7ba4ca: return "_Tlsset"; - case 0x2b81fb7f: return "readdir"; - case 0x2bc9dee6: return "raw_spu_read_short"; - case 0x2caea755: return "_Once"; - case 0x2d067448: return "ftruncate64"; - case 0x2d17ca7f: return "_Puttxt"; - case 0x2eea9f25: return "_Esub"; - case 0x2f45d39c: return "strlen"; - case 0x2fecec13: return "getwchar"; - case 0x30fb2899: return "_Getmem"; - case 0x312be3b3: return "_malloc_init_lv2"; - case 0x313f04ab: return "raw_spu_read_char"; - case 0x329a4540: return "_WPrintf"; - case 0x32e4a30a: return "_Mtxdst"; - case 0x336b4191: return "_Getint"; - case 0x33d6ae54: return "ferror"; - case 0x344eca7e: return "_WGetstr"; - case 0x34dd6650: return "_Getcloc"; - case 0x34e7c97e: return "_Unlocksyslock"; - case 0x3512ad38: return "tmpnam"; - case 0x355fd1fd: return "mbtowc"; - case 0x3574d37d: return "_Wcsxfrmx"; - case 0x36c067c1: return "_Stoll"; - case 0x36f2b4ed: return "strtoull"; - case 0x36feb965: return "raw_spu_write_llong"; - case 0x3704840e: return "_fs_finalize"; - case 0x38426d25: return "_Wctombx"; - case 0x3902363a: return "malloc_footprint"; - case 0x39bf419c: return "valloc"; - case 0x3a210c93: return "swscanf"; - case 0x3a840ae3: return "snprintf"; - case 0x3b22e88a: return "isxdigit"; - case 0x3b8097ac: return "_WScanf"; - case 0x3bce073b: return "putc"; - case 0x3bd9ce0a: return "fsync"; - case 0x3ca81c76: return "_Iswctype"; - case 0x3d1460e9: return "_Strerror"; - case 0x3d541975: return "atoi"; - case 0x3d5fdea7: return "vfwprintf"; - case 0x3d85d6f8: return "strcmp"; - case 0x3dbc3bee: return "opendir"; - case 0x3e57dfac: return "_Genld"; - case 0x3ec99a66: return "_Getptimes"; - case 0x3ee29d0b: return "_Stof"; - case 0x3f125e2e: return "spu_thread_write_short"; - case 0x3f4ccdc7: return "isdigit"; - case 0x3f650700: return "mspace_is_heap_empty"; - case 0x40a2599a: return "atol"; - case 0x40d04e4e: return "fwide"; - case 0x40e0ff25: return "_WGenld"; - case 0x41283333: return "isdigit_ascii"; - case 0x418bdfe1: return "_get_fd"; - case 0x4217b4cf: return "difftime"; - case 0x433fe2a9: return "fwscanf"; - case 0x44115dd0: return "_Geterrno"; - case 0x44796e5c: return "strerror"; - case 0x449317ed: return "_Fopen"; - case 0x44d7cae8: return "raw_spu_read_float"; - case 0x4544c2de: return "spu_thread_write_mem"; - case 0x4569518c: return "malloc_stats"; - case 0x459072c3: return "_init_TT800"; - case 0x4595c42b: return "wcsxfrm"; - case 0x468b45dc: return "mspace_calloc"; - case 0x4911ff9c: return "rand_int31_TT800"; - case 0x498a5036: return "raw_spu_write_mem"; - case 0x4a0049c6: return "_Getpctype"; - case 0x4ab5fbe2: return "_Printf"; - case 0x4b36c0e0: return "vfscanf"; - case 0x4b6a4010: return "vswprintf"; - case 0x4bb8e2b2: return "raw_spu_write_ushort"; - case 0x4c3f5f29: return "_Getgloballocale"; - case 0x4c7dc863: return "iswupper"; - case 0x4d348427: return "fputs"; - case 0x4e4be299: return "longjmp"; - case 0x4e72f810: return "wmemchr"; - case 0x4ffba189: return "feof"; - case 0x508196b4: return "raw_spu_printf"; - case 0x508e00c6: return "_Getloc"; - case 0x51b28904: return "_Stodx"; - case 0x526a496a: return "write"; - case 0x532b03be: return "raw_spu_read_uint"; - case 0x53eb43a1: return "_Getpmbstate"; - case 0x54b383bc: return "_Locvar"; - case 0x54c2844e: return "spu_raw_snprintf"; - case 0x54f57626: return "rewind"; - case 0x5516bbbf: return "iswctype"; - case 0x55d4866e: return "fgetws"; - case 0x5751acf9: return "_LDscale"; - case 0x575fb268: return "wctrans"; - case 0x57ff7dd7: return "_WStod"; - case 0x58320830: return "_WLitob"; - case 0x589b5314: return "strncat"; - case 0x5909e3c4: return "memset"; - case 0x59640bc6: return "raw_spu_read_ullong"; - case 0x59c1bb1f: return "_Getpwcstate"; - case 0x59e8dd58: return "strtoll"; - case 0x5a74f774: return "spu_thread_read_float"; - case 0x5b162b7f: return "memmove"; - case 0x5b4b6d6d: return "wcspbrk"; - case 0x5cc71eee: return "raw_spu_write_ldouble"; - case 0x5d43c1a3: return "_Mbtowc"; - case 0x5dbceee3: return "rand_int32_TT800"; - case 0x5e06c3fe: return "__getpid"; - case 0x5e7888f0: return "bsearch"; - case 0x5eb95641: return "_Stold"; - case 0x5f922a30: return "_Dscale"; - case 0x5f9a65c7: return "_WStold"; - case 0x5fa1e497: return "_Unlockfilelock"; - case 0x60627fb3: return "_LDunscale"; - case 0x6075a3c6: return "_Ld2rv"; - case 0x609080ec: return "isspace_ascii"; - case 0x6137d196: return "memalign"; - case 0x6287ac6a: return "iswdigit"; - case 0x62bf1d6c: return "swprintf"; - case 0x64aaf016: return "raw_spu_read_ldouble"; - case 0x6514dbe5: return "wcstold"; - case 0x6539ff6d: return "_Gentime"; - case 0x6545b7de: return "fgetpos"; - case 0x65e8d4d0: return "wcslen"; - case 0x6660fc8d: return "TlsGetValue"; - case 0x6687fba4: return "_Fgpos"; - case 0x66b71b17: return "wcsspn"; - case 0x67582370: return "spu_thread_write_double"; - case 0x676e3e7a: return "raw_spu_write_ptr"; - case 0x67d6334b: return "strtof"; - case 0x6823c180: return "iswprint"; - case 0x69106fd2: return "_init_by_array_TT800"; - case 0x692b497f: return "perror"; - case 0x6995f5e8: return "_Ldtob"; - case 0x69c27c12: return "fopen"; - case 0x69ff1b9b: return "fseek"; - case 0x6ba10474: return "_Tlsalloc"; - case 0x6cf78f3e: return "_Mtxunlock"; - case 0x6d5115b0: return "wcsncmp"; - case 0x6e988e5f: return "_rand_int31_TT800"; - case 0x7028dea9: return "_Locksyslock"; - case 0x703ec767: return "setvbuf"; - case 0x70b0e833: return "mblen"; - case 0x714c9618: return "__raw_spu_putfld"; - case 0x717b2502: return "stat"; - case 0x72236cbc: return "raw_spu_write_ullong"; - case 0x72b84004: return "spu_printf_attach_thread"; - case 0x73096858: return "wctob"; - case 0x7345b4be: return "_WStoll"; - case 0x73eae03d: return "strrchr"; - case 0x744d2505: return "ispunct"; - case 0x74fe4a7b: return "iswgraph"; - case 0x759e0635: return "malloc"; - case 0x75d4485c: return "rename"; - case 0x75f98579: return "wcscoll"; - case 0x76da0c84: return "ftruncate"; - case 0x76ed4243: return "_Wcsftime"; - case 0x770bfaee: return "wctype"; - case 0x77a602dd: return "free"; - case 0x77c15441: return "_WGetfloat"; - case 0x77e241bc: return "_Skip"; - case 0x7817edf0: return "raw_spu_write_uint"; - case 0x783636d1: return "spu_thread_read_char"; - case 0x78429d81: return "putwchar"; - case 0x79819dbf: return "fputc"; - case 0x7994c28d: return "_FDtentox"; - case 0x79eadf05: return "malloc_usable_size"; - case 0x7aaab95c: return "iswblank"; - case 0x7ae82e0f: return "vsprintf"; - case 0x7aee5acd: return "_Lockfilelock"; - case 0x7b5aac20: return "spu_thread_write_ptr"; - case 0x7b7a687a: return "_WPutfld"; - case 0x7b9c592e: return "spu_thread_read_ullong"; - case 0x7c1bcf37: return "isalnum_ascii"; - case 0x7c370679: return "_Foprep"; - case 0x7cec7b39: return "_Putfld"; - case 0x7d894764: return "_Readloc"; - case 0x7e7017b1: return "rmdir"; - case 0x7ea8d860: return "spu_printf_detach_group"; - case 0x7efd420a: return "_Daysto"; - case 0x7fd325c4: return "mspace_malloc_stats"; - case 0x7fdcf73e: return "wcscat"; - case 0x806fd281: return "isblank_ascii"; - case 0x809a143f: return "kill"; - case 0x813a9666: return "ungetwc"; - case 0x814d8cb0: return "fflush"; - case 0x81a0a858: return "_memset_int"; - case 0x82a3cc30: return "wcschr"; - case 0x82a4561a: return "_put_fd"; - case 0x831d70a5: return "memcpy"; - case 0x8342b757: return "utime"; - case 0x84378ddc: return "wcsncpy"; - case 0x86532174: return "imaxdiv"; - case 0x867275d7: return "_Stoul"; - case 0x86b4c669: return "tolower_ascii"; - case 0x8713c859: return "link"; - case 0x8725a1a7: return "_memset_vmx"; - case 0x87e8f748: return "memset_vmx"; - case 0x8809cdfd: return "_Getpwctytab"; - case 0x882689f2: return "_Makeloc"; - case 0x882e7760: return "raw_spu_write_uchar"; - case 0x889d5804: return "_Dunscale"; - case 0x88e009f5: return "vwprintf"; - case 0x896e1bfd: return "spu_thread_write_uchar"; - case 0x89b62f56: return "_Etentox"; - case 0x89f6f026: return "time"; - case 0x8a6830e7: return "abort"; - case 0x8a71132c: return "remove"; - case 0x8a847b51: return "tmpfile"; - case 0x8ab0abc6: return "strncpy"; - case 0x8b439438: return "clearerr"; - case 0x8b9d8dd2: return "iswpunct"; - case 0x8cb6bfdc: return "_Locsum"; - case 0x8d7ffaf1: return "_WStopfx"; - case 0x8e2484f1: return "_Emul"; - case 0x8ed71e8b: return "_WGetfld"; - case 0x8ef85e47: return "_WPuttxt"; - case 0x8f5dd179: return "_Nnl"; - case 0x90010029: return "gets"; - case 0x9027fd99: return "_WStoldx"; - case 0x90457fe3: return "raw_spu_read_long"; - case 0x90b27880: return "strtoumax"; - case 0x9234f738: return "raw_spu_read_int"; - case 0x93427cb9: return "setbuf"; - case 0x938bfcf7: return "spu_thread_write_char"; - case 0x93a3e3ac: return "tolower"; - case 0x9439e4cd: return "wcsncat"; - case 0x96b6baa6: return "spu_thread_read_mem"; - case 0x96e6303b: return "_WStoxflt"; - case 0x96ea4de6: return "wctomb"; - case 0x97896359: return "isspace"; - case 0x9800573c: return "_WLdtob"; - case 0x980d3ea7: return "_Getfld"; - case 0x9886810c: return "_FDnorm"; - case 0x98f0eeab: return "raw_spu_write_ulong"; - case 0x99782342: return "strncasecmp_ascii"; - case 0x99a72146: return "vsnprintf"; - case 0x99b38ce7: return "wmemmove"; - case 0x9a87bb3a: return "_Getmbcurmax"; - case 0x9abe8c74: return "wprintf"; - case 0x9c7028a5: return "spu_thread_write_uint"; - case 0x9c9d7b0d: return "strtold"; - case 0x9cab08d1: return "spu_thread_write_int"; - case 0x9d140351: return "_Destroytls"; - case 0x9eb25e00: return "strcoll"; - case 0x9eee5387: return "truncate64"; - case 0x9ff08d57: return "_Clearlocks"; - case 0xa0ab76d5: return "_absi4"; - case 0xa0bc0efb: return "mallinfo"; - case 0xa0ddba8e: return "_Stoulx"; - case 0xa1dbb466: return "_Gettime"; - case 0xa2945229: return "_WGetint"; - case 0xa30d4797: return "wcstoll"; - case 0xa3440924: return "closedir"; - case 0xa3da58f6: return "rand_real1_TT800"; - case 0xa45a0313: return "mspace_create"; - case 0xa483d50d: return "_rv2d"; - case 0xa53800c2: return "_malloc_finalize_lv2"; - case 0xa568db82: return "spu_thread_read_ushort"; - case 0xa57cc615: return "iswspace"; - case 0xa5bc0e19: return "getchar"; - case 0xa6463518: return "__rename"; - case 0xa650df19: return "toupper"; - case 0xa65886b8: return "_Findloc"; - case 0xa72a7595: return "calloc"; - case 0xa797790f: return "wcsstr"; - case 0xa82d70da: return "_Tlsget"; - case 0xa835be11: return "__cxa_atexit"; - case 0xa874036a: return "wcstof"; - case 0xa8a6f615: return "TlsSetValue"; - case 0xa8b07f1b: return "wmemcpy"; - case 0xa9f68eff: return "qsort"; - case 0xaa1e687d: return "isgraph"; - case 0xaa266d35: return "_malloc_init"; - case 0xaa9635d7: return "strcat"; - case 0xab4c7ca1: return "_CWcsxfrm"; - case 0xab77019f: return "fstat"; - case 0xabc27420: return "wcstoul"; - case 0xac758d20: return "wmemcmp"; - case 0xac893127: return "fgetc"; - case 0xace90be4: return "_Dtentox"; - case 0xad62a342: return "ldiv"; - case 0xad8e9ad0: return "_Initlocks"; - case 0xaec7c970: return "lseek"; - case 0xaf002043: return "independent_comalloc"; - case 0xaf44a615: return "fgets"; - case 0xaf6bdcb0: return "_Nonfatal_Assert"; - case 0xaf89fdbd: return "_Assert"; - case 0xafa39179: return "_WPutstr"; - case 0xb120f6ca: return "close"; - case 0xb17b79d0: return "isalpha"; - case 0xb18cc115: return "freopen"; - case 0xb1cc43e3: return "_CStrftime"; - case 0xb1f4779d: return "spu_thread_printf"; - case 0xb24cb8d6: return "_Locterm"; - case 0xb2702e15: return "wcrtomb"; - case 0xb2748a9f: return "_Freeloc"; - case 0xb30042ce: return "lldiv"; - case 0xb37982ea: return "_Getstr"; - case 0xb3c495bd: return "imaxabs"; - case 0xb3d98d59: return "_rand_real1_TT800"; - case 0xb400f226: return "isupper_ascii"; - case 0xb4225825: return "mbsinit"; - case 0xb43c25c7: return "wcstoull"; - case 0xb49eea74: return "_init_malloc_lock0"; - case 0xb4a54446: return "_Stofx"; - case 0xb4fc7078: return "_close_all_FILE"; - case 0xb529d259: return "isalnum"; - case 0xb569849d: return "reallocalign"; - case 0xb57bdf7b: return "iswxdigit"; - case 0xb5d353e8: return "_LDtentox"; - case 0xb6002508: return "_Putstr"; - case 0xb6257e3d: return "strncasecmp"; - case 0xb680e240: return "wcstombs"; - case 0xb6af290e: return "_WFrprep"; - case 0xb6d92ac3: return "strcasecmp"; - case 0xb738027a: return "strtok_r"; - case 0xb794631e: return "_WStofx"; - case 0xb7ab5127: return "wcsrchr"; - case 0xb7b793ed: return "get_state_TT800"; - case 0xb7ba4aeb: return "_WStoul"; - case 0xb7d3427f: return "iscntrl_ascii"; - case 0xb81cd66a: return "mbrlen"; - case 0xb9ed25d4: return "raw_spu_read_ulong"; - case 0xba62681f: return "mspace_memalign"; - case 0xbb605c96: return "pvalloc"; - case 0xbbd4582f: return "_Setloc"; - case 0xbc1d69c5: return "atoll"; - case 0xbc374779: return "_Getlname"; - case 0xbc5af0b5: return "fgetwc"; - case 0xbc7b4b8e: return "ctime"; - case 0xbe11beaa: return "_wremove"; - case 0xbe251a29: return "islower_ascii"; - case 0xbe6e5c58: return "spu_thread_read_uchar"; - case 0xbec43f86: return "raw_spu_read_ptr"; - case 0xbf5bf5ea: return "lseek64"; - case 0xbfcd1b3b: return "_Getdst"; - case 0xc01d9f97: return "printf"; - case 0xc08cc41d: return "wcstod"; - case 0xc0e27b2c: return "_Makestab"; - case 0xc155a73f: return "_WStoull"; - case 0xc15e657e: return "spu_raw_sprintf"; - case 0xc1a71972: return "_d2rv"; - case 0xc1b4bbb9: return "raw_spu_write_char"; - case 0xc1c8737c: return "_Getptoupper"; - case 0xc291e698: return "exit"; - case 0xc3c598e2: return "spu_printf_initialize"; - case 0xc3e14cbe: return "memcmp"; - case 0xc4178000: return "_rand_real3_TT800"; - case 0xc41c6e5d: return "_Scanf"; - case 0xc57337f8: return "_Fofind"; - case 0xc5c09834: return "strstr"; - case 0xc63c354f: return "_Exit"; - case 0xc69b2427: return "labs"; - case 0xc78df618: return "rand_real3_TT800"; - case 0xc7b62ab8: return "spu_thread_write_ullong"; - case 0xc9471fac: return "_Mtxinit"; - case 0xc94b27e3: return "_WStof"; - case 0xc95b20d3: return "fputwc"; - case 0xc9607d35: return "_Stopfx"; - case 0xc97a17d7: return "vsscanf"; - case 0xcab654bf: return "_Once_ctor"; - case 0xcb85ac70: return "mspace_malloc"; - case 0xcb9c535b: return "strftime"; - case 0xcbac7ad7: return "memchr"; - case 0xcbdc3a6d: return "raw_spu_write_int"; - case 0xcc5e0c72: return "_divi4"; - case 0xcca68e9c: return "putwc"; - case 0xce7a9e76: return "isprint_ascii"; - case 0xcecbcdc4: return "_Frv2d"; - case 0xcf863219: return "_Fwprep"; - case 0xcfbfb7a7: return "spu_printf_detach_thread"; - case 0xd14ece90: return "strtol"; - case 0xd1d69cb8: return "_Stod"; - case 0xd20f6601: return "independent_calloc"; - case 0xd2a99b1e: return "isprint"; - case 0xd2ac48d7: return "iswalnum"; - case 0xd360dcb4: return "fileno"; - case 0xd3964a09: return "__spu_thread_putfld"; - case 0xd40723d6: return "fread"; - case 0xd417eeb5: return "_Stoull"; - case 0xd4912ee3: return "_FDscale"; - case 0xd5c8cb55: return "spu_thread_write_ushort"; - case 0xd69c513d: return "_Wcscollx"; - case 0xd784459d: return "isupper"; - case 0xd7dc3a8f: return "strtod"; - case 0xd8b4eb20: return "__spu_thread_puttxt"; - case 0xd9674905: return "mspace_reallocalign"; - case 0xd9a4f812: return "atoff"; - case 0xda5a7eb8: return "strtoul"; - case 0xdaeada07: return "mallopt"; - case 0xddbac025: return "strcasecmp_ascii"; - case 0xddc71a75: return "_SCE_Assert"; - case 0xde1bb092: return "init_by_array_TT800"; - case 0xde32a334: return "_Exitspawn"; - case 0xde7aff7a: return "memcpy16"; - case 0xdebee2af: return "strchr"; - case 0xdef86a83: return "isxdigit_ascii"; - case 0xdfb52083: return "_Stoxflt"; - case 0xe03c7ab1: return "_Fspos"; - case 0xe1858899: return "_Getpwctrtab"; - case 0xe1bd3587: return "fclose"; - case 0xe1e83c65: return "strncmp"; - case 0xe2c5274a: return "_WStoflt"; - case 0xe3812672: return "fdopen"; - case 0xe3cc73f3: return "puts"; - case 0xe3d91db3: return "raw_spu_read_double"; - case 0xe40ba755: return "strtok"; - case 0xe44bf0bf: return "atof"; - case 0xe469fb20: return "_Atexit"; - case 0xe48348e9: return "vprintf"; - case 0xe4c51d4c: return "wcstoimax"; - case 0xe5ea9e2b: return "_Isdst"; - case 0xe5f09c80: return "llabs"; - case 0xe60ee9e5: return "fputws"; - case 0xe6a7de0a: return "ungetc"; - case 0xe7def231: return "_Getfloat"; - case 0xe89071ad: return "isalpha_ascii"; - case 0xe9137453: return "fwprintf"; - case 0xe9a2cc40: return "raw_spu_write_long"; - case 0xe9b560a5: return "sscanf"; - case 0xeb26298c: return "gmtime"; - case 0xeb40c9ec: return "rand_real2_TT800"; - case 0xeb8abe73: return "vwscanf"; - case 0xec9e7cb9: return "spu_thread_read_llong"; - case 0xecddba69: return "_WStodx"; - case 0xed6ec979: return "fsetpos"; - case 0xeda48c80: return "malloc_trim"; - case 0xeddcee2c: return "init_TT800"; - case 0xedec777d: return "_Ttotm"; - case 0xeeeb4f3e: return "_get_state_TT800"; - case 0xeeffc9a6: return "_wrename"; - case 0xef110b6b: return "unlink"; - case 0xf06eed36: return "wmemset"; - case 0xf0776a44: return "wcscmp"; - case 0xf0e022c6: return "getc"; - case 0xf2bbbee9: return "_Litob"; - case 0xf2fca4b2: return "spu_thread_write_llong"; - case 0xf356418c: return "open"; - case 0xf3ef3678: return "wcscspn"; - case 0xf41355f9: return "wcscpy"; - case 0xf418ee84: return "_WFwprep"; - case 0xf4207734: return "spu_thread_write_ulong"; - case 0xf5a32994: return "_Getpcostate"; - case 0xf5ef229c: return "_Getpwcostate"; - case 0xf5f7dda8: return "towupper"; - case 0xf68e2ac9: return "_init_malloc_lock"; - case 0xf7583d67: return "vscanf"; - case 0xf7908e27: return "strcspn"; - case 0xf7a14a22: return "realloc"; - case 0xf7d51596: return "scanf"; - case 0xf7ddb471: return "_Setgloballocale"; - case 0xf88f26c4: return "fwrite"; - case 0xf8935fe3: return "spu_thread_write_float"; - case 0xf89dc648: return "strpbrk"; - case 0xf9dae72c: return "setjmp"; - case 0xf9dba140: return "_Mtxlock"; - case 0xf9e26b72: return "_Once_dtor"; - case 0xfa00d211: return "read"; - case 0xfae4b063: return "_Strcollx"; - case 0xfaec8c60: return "fprintf"; - case 0xfb0f0018: return "_Makewct"; - case 0xfb2081fd: return "vfprintf"; - case 0xfb81426d: return "iswlower"; - case 0xfb8ea4d2: return "_Fd2rv"; - case 0xfc0428a6: return "strdup"; - case 0xfc60575c: return "__spu_thread_printf"; - case 0xfc606237: return "mbsrtowcs"; - case 0xfcac2e8e: return "mbstowcs"; - case 0xfd0cb96d: return "spu_thread_read_short"; - case 0xfd461e85: return "spu_thread_write_ldouble"; - case 0xfd6a1ddb: return "raw_spu_read_llong"; - case 0xfd81f6ca: return "_Stoflt"; - case 0xfe0261aa: return "mspace_free"; - case 0xfe630fd9: return "isblank"; - case 0xfe88e97e: return "fscanf"; - case 0xff689124: return "strtoimax"; - case 0xffbae95e: return "asctime"; - case 0xffbd876b: return "__raw_spu_puttxt"; - case 0x003395d9: return "_Feraise"; - case 0x00367be0: return "fminl"; - case 0x007854f4: return "_FDclass"; - case 0x00fde072: return "f_powf"; - case 0x010818fc: return "asinf4"; - case 0x012d0a91: return "_fminf4"; - case 0x016556df: return "_sinf4"; - case 0x01b84b27: return "llround"; - case 0x01ecef7d: return "_FCbuild"; - case 0x02e68d44: return "_f_fmodf"; - case 0x032cc709: return "csin"; - case 0x03593d2c: return "_f_expf"; - case 0x03aea906: return "divf4"; - case 0x0522d1af: return "_recipf4"; - case 0x054aae63: return "_fdimf4"; - case 0x05cb1718: return "f_fdimf"; - case 0x05e27a13: return "log10f4fast"; - case 0x05efc660: return "asin"; - case 0x05f1dc9e: return "_FExp"; - case 0x07274304: return "csinh"; - case 0x07daed62: return "log2f4"; - case 0x07f400e3: return "_LCbuild"; - case 0x080414bd: return "conjl"; - case 0x08139bd2: return "_fmaxf4"; - case 0x0829a21d: return "asinhl"; - case 0x0a242ed5: return "sinf4"; - case 0x0b3f4e90: return "catanhf"; - case 0x0bb036a6: return "_cosf4"; - case 0x0c14cfcc: return "fesetenv"; - case 0x0c9b8305: return "hypotf4"; - case 0x0cbdae68: return "sinf"; - case 0x0cf9b8bd: return "_Erfc"; - case 0x0d86295d: return "_LCaddcr"; - case 0x0e53319f: return "_asinf4"; - case 0x0e8573dc: return "expm1l"; - case 0x0f02f882: return "llrintl"; - case 0x0f428f0f: return "rint"; - case 0x0f721a9d: return "_LCsubcc"; - case 0x10627248: return "f_fmodf"; - case 0x11c51388: return "tgamma"; - case 0x1225dd31: return "casinf"; - case 0x12de4e46: return "_powf4"; - case 0x12e04cd7: return "cimagl"; - case 0x1313a420: return "acos"; - case 0x137f7e77: return "expf4"; - case 0x14208b00: return "_asinf4fast"; - case 0x1498a072: return "_Cmulcr"; - case 0x16bf208a: return "log10f"; - case 0x17316bee: return "log2"; - case 0x178d98dd: return "atanf4fast"; - case 0x17cd5d87: return "_recipf4fast"; - case 0x182cd542: return "tgammal"; - case 0x18668ce3: return "exp"; - case 0x18b26998: return "remainderl"; - case 0x18ec6099: return "rintl"; - case 0x1988732d: return "clog10"; - case 0x1a1adede: return "rsqrtf4fast"; - case 0x1acb2b16: return "acosf4"; - case 0x1bbdcd9f: return "expm1f4"; - case 0x1bcdeb47: return "_LSinh"; - case 0x1be996cc: return "_LCdivcc"; - case 0x1c11885d: return "_floorf4"; - case 0x1d35bfe4: return "_LLog"; - case 0x1d5bf5d0: return "_modff4"; - case 0x1e623f95: return "truncf4"; - case 0x1e85ef02: return "f_atanf"; - case 0x1e9fd6ba: return "_sinf4fast"; - case 0x2033eeb7: return "csqrt"; - case 0x2118fe46: return "cexpl"; - case 0x21a37b3e: return "log1pf"; - case 0x21e6d304: return "ceil"; - case 0x22c3e308: return "_exp2f4"; - case 0x238af59b: return "fegetenv"; - case 0x23b985f7: return "floorf"; - case 0x241f9337: return "_FCmulcr"; - case 0x24497c52: return "cosf"; - case 0x246ea8d0: return "f_sqrtf"; - case 0x2627d6b2: return "erfc"; - case 0x266d2473: return "_Caddcr"; - case 0x26deed0b: return "cosl"; - case 0x26ef50ed: return "asinh"; - case 0x28faaa5a: return "ilogbf4"; - case 0x29685118: return "_negatef4"; - case 0x2a138d2b: return "truncf"; - case 0x2a4dcbad: return "cacosl"; - case 0x2a89ce33: return "llrintf"; - case 0x2af4b73b: return "fmax"; - case 0x2b282ebb: return "sqrtl"; - case 0x2bb0f2c9: return "logb"; - case 0x2c45fe6a: return "fmaxl"; - case 0x2c601f3b: return "csinl"; - case 0x2cbb6f53: return "f_hypotf"; - case 0x2dcab6a4: return "nanl"; - case 0x2df339bc: return "_f_floorf"; - case 0x2e69bb2a: return "_FCosh"; - case 0x2ec867b4: return "exp2f4fast"; - case 0x30bc7a53: return "logf4"; - case 0x315673f6: return "_Csubcc"; - case 0x31be25c3: return "scalblnf"; - case 0x31db8c89: return "atan2"; - case 0x321c55de: return "nexttowardl"; - case 0x3261de11: return "fesetexceptflag"; - case 0x329ec019: return "rsqrtf4"; - case 0x32f994a1: return "cosf4fast"; - case 0x33e5929b: return "_LDsign"; - case 0x33f27f25: return "_FCdivcr"; - case 0x3436f008: return "csinhf"; - case 0x3459748b: return "log10f4"; - case 0x347c1ee1: return "atanf4"; - case 0x34c0371e: return "powl"; - case 0x358d7f93: return "_f_lrintf"; - case 0x3593a445: return "clog"; - case 0x35b6e70a: return "lrintl"; - case 0x35d3f688: return "creal"; - case 0x36778d1b: return "coshf"; - case 0x373054d1: return "cpow"; - case 0x37345541: return "log1pl"; - case 0x376fb27f: return "sinhl"; - case 0x3792b12d: return "lroundl"; - case 0x38ba5590: return "ccosl"; - case 0x38e69f09: return "pow"; - case 0x398483aa: return "_expm1f4fast"; - case 0x39ef81c9: return "f_fmaxf"; - case 0x3ad203fa: return "lrint"; - case 0x3adc01d7: return "f_frexpf"; - case 0x3b802524: return "ldexpf4"; - case 0x3c057fbd: return "atanf"; - case 0x3c616743: return "_LDtest"; - case 0x3cb818fa: return "_f_fdimf"; - case 0x3d4efafb: return "atan2l"; - case 0x3d549f2a: return "ctanhl"; - case 0x3d901a10: return "_ceilf4"; - case 0x3da55602: return "fabsf"; - case 0x3dfa060f: return "scalbnl"; - case 0x3e7eb58f: return "frexpf4"; - case 0x3e919cba: return "scalbnf"; - case 0x3ec9de23: return "_cbrtf4"; - case 0x3eeedb0e: return "_Dclass"; - case 0x3f6262b3: return "f_fminf"; - case 0x3f701e78: return "_Poly"; - case 0x4020f5ef: return "cbrt"; - case 0x405f9727: return "_log1pf4fast"; - case 0x40a2e212: return "_fabsf4"; - case 0x4111b546: return "_LExp"; - case 0x411434bb: return "asinf"; - case 0x414c5ecc: return "_f_hypotf"; - case 0x4152669c: return "scalbln"; - case 0x417851ce: return "feholdexcept"; - case 0x418036e3: return "_FTgamma"; - case 0x4189a367: return "remquo"; - case 0x41d1b236: return "_f_rintf"; - case 0x430309a1: return "ldexpf"; - case 0x434881a0: return "cacosf"; - case 0x43d522f4: return "cabsl"; - case 0x44cd6308: return "remainder"; - case 0x44cf744b: return "tanhl"; - case 0x45034943: return "nan"; - case 0x452ac4bb: return "floorf4"; - case 0x453f9e91: return "cbrtf"; - case 0x46b66f76: return "csqrtl"; - case 0x46cf72d9: return "fdimf"; - case 0x47433144: return "expm1f4fast"; - case 0x475d855b: return "trunc"; - case 0x476b5591: return "fmaf"; - case 0x48157605: return "_f_llrintf"; - case 0x4826db61: return "fma"; - case 0x4875601d: return "_exp2f4fast"; - case 0x487bbd1c: return "tanf4"; - case 0x488df791: return "cexp"; - case 0x48d462a9: return "_FDint"; - case 0x4930ac11: return "logbl"; - case 0x4a5ae27d: return "f_exp2f"; - case 0x4a6ca9a6: return "powf4"; - case 0x4ab22a63: return "_Caddcc"; - case 0x4add664c: return "feclearexcept"; - case 0x4ae52dd3: return "exp2"; - case 0x4b03d5b2: return "f_rintf"; - case 0x4b584841: return "f_asinf"; - case 0x4cb5fa99: return "nexttoward"; - case 0x4d878773: return "remainderf4"; - case 0x4ddb926b: return "powf"; - case 0x4e010403: return "copysign"; - case 0x4eb5eb51: return "sin"; - case 0x4fa4f5ec: return "nexttowardf"; - case 0x501c412f: return "cargf"; - case 0x519ebb77: return "floor"; - case 0x547fb4a7: return "sinf4fast"; - case 0x54d2fb8c: return "rintf"; - case 0x5516d621: return "acosl"; - case 0x55c8a549: return "truncl"; - case 0x56c573a8: return "log1p"; - case 0x575e9b6e: return "asinl"; - case 0x58eb9e57: return "fabs"; - case 0x596ab55c: return "atanh"; - case 0x5b18eded: return "clogl"; - case 0x5b474c22: return "casinhl"; - case 0x5bfd37be: return "_FCaddcc"; - case 0x5e48dede: return "exp2f4"; - case 0x5ee10a95: return "catanh"; - case 0x5ee37927: return "_LErfc"; - case 0x60e9ff3c: return "_expm1f4"; - case 0x61250988: return "catanl"; - case 0x6261c0b5: return "_log10f4"; - case 0x63bbdfa6: return "_FCmulcc"; - case 0x642e3d18: return "_frexpf4"; - case 0x642f7d6b: return "f_copysignf"; - case 0x645557bd: return "copysignl"; - case 0x64abdb4d: return "csinhl"; - case 0x657d0e83: return "divf4fast"; - case 0x65935877: return "ilogbf"; - case 0x659e011e: return "sqrt"; - case 0x6636c4a5: return "frexpf"; - case 0x664e04b9: return "negatef4"; - case 0x6764c707: return "f_log2f"; - case 0x683cacb3: return "sinh"; - case 0x68a8957f: return "casinhf"; - case 0x68f72416: return "nextafterl"; - case 0x69040b9b: return "logbf4"; - case 0x69725dce: return "lgamma"; - case 0x6ad1c42b: return "_sincosf4"; - case 0x6b660894: return "_acosf4fast"; - case 0x6b6ab2a9: return "_LDclass"; - case 0x6c009c56: return "f_log10f"; - case 0x6c6285c6: return "acoshf"; - case 0x6cc4bd13: return "casinh"; - case 0x6ddd31b2: return "hypot"; - case 0x6df35518: return "floorl"; - case 0x6e9eb0dc: return "sincosf4fast"; - case 0x6ef6b083: return "_FCsubcr"; - case 0x6f5dd7d2: return "cexpf"; - case 0x6f639afb: return "f_llroundf"; - case 0x6fcc1e27: return "_FPoly"; - case 0x70357b12: return "_atanf4fast"; - case 0x7048396e: return "carg"; - case 0x705d9e24: return "f_acosf"; - case 0x70f71871: return "_FCdivcc"; - case 0x71293b71: return "_FLog"; - case 0x714adce1: return "log"; - case 0x71f2bc56: return "_divf4fast"; - case 0x728149e5: return "f_ldexpf"; - case 0x729b7269: return "cproj"; - case 0x72a3ed28: return "fesettrapenable"; - case 0x72f1f64b: return "_logbf4"; - case 0x734ca589: return "_f_cosf"; - case 0x742f12b4: return "_Sin"; - case 0x74902d4b: return "expf4fast"; - case 0x749440f9: return "lgammal"; - case 0x752fa85e: return "fmaxf4"; - case 0x758f33dc: return "nearbyint"; - case 0x75e3e2e9: return "nearbyintl"; - case 0x76afaf04: return "_sqrtf4"; - case 0x76e639ec: return "_atanf4"; - case 0x772f1e4d: return "lround"; - case 0x7793a86b: return "ctanf"; - case 0x7831a2e0: return "hypotl"; - case 0x78e4590a: return "acosh"; - case 0x790c53bd: return "_Fpcomp"; - case 0x7919f414: return "_f_nearbyintf"; - case 0x79ba9b5c: return "expl"; - case 0x7a893af1: return "_rsqrtf4"; - case 0x7ab679da: return "f_cosf"; - case 0x7c2eaeb5: return "fminf"; - case 0x7d02a5ca: return "sqrtf4fast"; - case 0x7d6191d0: return "_Cosh"; - case 0x7f381837: return "frexp"; - case 0x7f579e03: return "atan"; - case 0x7f91cd41: return "tanf4fast"; - case 0x812ed488: return "cabsf"; - case 0x81daf880: return "_LCsubcr"; - case 0x8217e783: return "cosh"; - case 0x833e6b0e: return "cimag"; - case 0x834f5917: return "ccosh"; - case 0x842cb14d: return "_log1pf4"; - case 0x8451edf0: return "sqrtf"; - case 0x889cccb0: return "llroundl"; - case 0x88fb4a66: return "recipf4fast"; - case 0x892f2590: return "fegetround"; - case 0x895cdb49: return "fmaxf"; - case 0x89b507b3: return "catanhl"; - case 0x89d1d168: return "_LAtan"; - case 0x8b168769: return "fdiml"; - case 0x8bd1deb2: return "_LTgamma"; - case 0x8bd67efc: return "erf"; - case 0x8c85369b: return "_f_fminf"; - case 0x8d5858db: return "_f_exp2f"; - case 0x8e01379e: return "cacoshf"; - case 0x8e258fa0: return "cacos"; - case 0x8ecae294: return "nextafter"; - case 0x8f2bcdb5: return "_logf4"; - case 0x8f96319e: return "log10l"; - case 0x8fb7bac7: return "_sqrtf4fast"; - case 0x904e646b: return "cargl"; - case 0x90f0242f: return "_f_sinf"; - case 0x9110708a: return "modfl"; - case 0x91cdfdb0: return "asinf4fast"; - case 0x9232baea: return "_FDtest"; - case 0x9245e01b: return "_divf4"; - case 0x9379e36e: return "tanf"; - case 0x938fb946: return "_tanf4fast"; - case 0x947ae18e: return "_LHypot"; - case 0x9558ed08: return "lrintf"; - case 0x95dfecb1: return "_FCsubcc"; - case 0x961688d1: return "f_nearbyintf"; - case 0x9616e336: return "_FHypot"; - case 0x964ac044: return "creall"; - case 0x96d1b95e: return "log2f4fast"; - case 0x9700d9cd: return "clogf"; - case 0x970a3432: return "cacosh"; - case 0x99a6c261: return "catanf"; - case 0x99c228fc: return "roundl"; - case 0x9a81e583: return "fmodf"; - case 0x9af30eaf: return "casin"; - case 0x9e289062: return "_f_ceilf"; - case 0x9e3ada21: return "logl"; - case 0x9e8130b6: return "ccos"; - case 0x9f03dd3e: return "lgammaf"; - case 0x9f0efc6e: return "exp2l"; - case 0x9f46f5a4: return "tgammaf"; - case 0x9f65bd34: return "fdimf4"; - case 0x9f78f052: return "cos"; - case 0x9fded78a: return "_acosf4"; - case 0xa0160c30: return "_copysignf4"; - case 0xa20827a8: return "ctanl"; - case 0xa2c81938: return "_LSin"; - case 0xa4578433: return "fmin"; - case 0xa46a70a1: return "atanhl"; - case 0xa4ca5cf2: return "llroundf"; - case 0xa56557b6: return "catan"; - case 0xa5d0b260: return "acoshl"; - case 0xa713f8cf: return "modf"; - case 0xa7658186: return "log1pf4"; - case 0xa823836b: return "ilogb"; - case 0xa8c16038: return "_FDsign"; - case 0xa8d180e8: return "_Cbuild"; - case 0xa92bcc85: return "cabs"; - case 0xa9e039c4: return "erfcf"; - case 0xaaa270dc: return "_LCdivcr"; - case 0xab377381: return "log2f"; - case 0xabdccc7a: return "f_atan2f"; - case 0xacca2f83: return "copysignf"; - case 0xad17e787: return "_Dint"; - case 0xad3a093d: return "_LCosh"; - case 0xad5d3e57: return "_FLgamma"; - case 0xaddce673: return "erfcl"; - case 0xafa13040: return "f_llrintf"; - case 0xafcfdad7: return "_Lgamma"; - case 0xafd9a625: return "cimagf"; - case 0xb0fa1592: return "clog10l"; - case 0xb24bd2f8: return "logbf"; - case 0xb348c5c2: return "_LLgamma"; - case 0xb412a8dc: return "_LDint"; - case 0xb4ef29d5: return "f_floorf"; - case 0xb4f4513e: return "_Tgamma"; - case 0xb54cc9a1: return "f_sinf"; - case 0xb5961d4e: return "_sincosf4fast"; - case 0xb598a495: return "fmodl"; - case 0xb5e28191: return "_FSin"; - case 0xb7696143: return "nextafterf"; - case 0xb79012ba: return "modff"; - case 0xb89863bc: return "_rsqrtf4fast"; - case 0xb8aa984e: return "_expf4"; - case 0xb94b9d13: return "_Dtest"; - case 0xb9d2ad22: return "remquol"; - case 0xba136594: return "csinf"; - case 0xba84eab5: return "coshl"; - case 0xbaf11866: return "ceilf"; - case 0xbb165807: return "expm1f"; - case 0xbb208b20: return "cbrtf4fast"; - case 0xbb761c89: return "remquof"; - case 0xbbaa300b: return "f_log1pf"; - case 0xbbf7354e: return "fegetexceptflag"; - case 0xbd7410d9: return "recipf4"; - case 0xbd8bb75c: return "asinhf"; - case 0xbf23f2e7: return "cprojl"; - case 0xbfda6837: return "_f_log10f"; - case 0xc0609820: return "nearbyintf"; - case 0xc0bcf25e: return "_logf4fast"; - case 0xc357b33a: return "frexpl"; - case 0xc406dd09: return "cbrtf4"; - case 0xc41f01db: return "fminf4"; - case 0xc477c0f6: return "f_lroundf"; - case 0xc4cccd1f: return "modff4"; - case 0xc7369fce: return "_Atan"; - case 0xc78ac9d0: return "scalbn"; - case 0xc7b45a19: return "_LFpcomp"; - case 0xc7f1d407: return "fmal"; - case 0xc7fb73d6: return "f_lrintf"; - case 0xc8910002: return "ilogbl"; - case 0xc8dd9279: return "expm1"; - case 0xc90f4bbc: return "_atan2f4"; - case 0xc9481758: return "_tanf4"; - case 0xc94fcc63: return "cbrtl"; - case 0xc977e1ea: return "fetestexcept"; - case 0xc984bf53: return "roundf"; - case 0xc9c536ce: return "_ldexpf4"; - case 0xca239640: return "fmodf4"; - case 0xca463458: return "_Log"; - case 0xcaaf7ae7: return "cprojf"; - case 0xcac167a5: return "_Cmulcc"; - case 0xcb6599c0: return "exp2f"; - case 0xcb6a147e: return "_cosf4fast"; - case 0xcbdf9afb: return "_log10f4fast"; - case 0xccc66f11: return "_FSinh"; - case 0xce91ff18: return "nanf"; - case 0xcfee82d8: return "_remainderf4"; - case 0xd0fd3ca8: return "_hypotf4"; - case 0xd125b89e: return "conjf"; - case 0xd1a3574c: return "clog10f"; - case 0xd231e30a: return "ldexpl"; - case 0xd28ef6dd: return "_Hypot"; - case 0xd2a666c9: return "ctanh"; - case 0xd3a346a8: return "tanl"; - case 0xd40f3f2c: return "erff"; - case 0xd42904b7: return "fabsl"; - case 0xd477852d: return "logf"; - case 0xd48eaae1: return "scalblnl"; - case 0xd4f37b9d: return "tanhf"; - case 0xd50277ad: return "tan"; - case 0xd54039cb: return "fegettrapenable"; - case 0xd5adc4b2: return "cpowl"; - case 0xd5d38552: return "_LCaddcc"; - case 0xd612fa16: return "_Sinh"; - case 0xd70df92a: return "_FCaddcr"; - case 0xd7653782: return "sinhf"; - case 0xd76a16da: return "_fmaf4"; - case 0xd8270894: return "fdim"; - case 0xd8c4096d: return "atan2f4"; - case 0xd8d157f5: return "f_expf"; - case 0xd8f79f4c: return "log10"; - case 0xd97852b7: return "sinl"; - case 0xd97ce5d4: return "fesetround"; - case 0xda217d1f: return "atanl"; - case 0xda31fc5d: return "_FFpcomp"; - case 0xdc14974c: return "fmaf4"; - case 0xdc151707: return "_f_log2f"; - case 0xdd8660d2: return "atan2f4fast"; - case 0xdd92118e: return "ceill"; - case 0xdddabb32: return "remainderf"; - case 0xde7833f2: return "_log2f4fast"; - case 0xdece76a6: return "acosf"; - case 0xdfd41734: return "_Exp"; - case 0xdffb4e3c: return "casinl"; - case 0xe1288c47: return "atanhf"; - case 0xe1c71b05: return "ccoshl"; - case 0xe2b596ec: return "ccosf"; - case 0xe2de89e6: return "csqrtf"; - case 0xe2f1d4b2: return "tanh"; - case 0xe31cc0d3: return "_ilogbf4"; - case 0xe3e379b8: return "_expf4fast"; - case 0xe584836c: return "_LPoly"; - case 0xe58fc9b5: return "erfl"; - case 0xe5a0be9f: return "_powf4fast"; - case 0xe5d2293f: return "_Force_raise"; - case 0xe5ea65e8: return "feraiseexcept"; - case 0xe6c1ff41: return "llrint"; - case 0xe769e5cf: return "fmod"; - case 0xe8fcf1f8: return "acosf4fast"; - case 0xe913a166: return "logf4fast"; - case 0xe92f3fb8: return "_f_fmaf"; - case 0xe93abfca: return "ctan"; - case 0xe9ac8223: return "_LCmulcr"; - case 0xe9f501df: return "crealf"; - case 0xea1e83e3: return "f_logf"; - case 0xeac62795: return "_Cdivcc"; - case 0xeac7ca2c: return "ceilf4"; - case 0xebb4e08a: return "hypotf"; - case 0xec43b983: return "_f_sqrtf"; - case 0xec7da0c8: return "_atan2f4fast"; - case 0xed05c265: return "sqrtf4"; - case 0xed9d1ac5: return "f_tanf"; - case 0xeda86c48: return "copysignf4"; - case 0xee0db701: return "_Csubcr"; - case 0xee204ac6: return "f_ceilf"; - case 0xee303936: return "_Dsign"; - case 0xeed82401: return "_f_logf"; - case 0xf0947035: return "ctanhf"; - case 0xf0ab77c1: return "ccoshf"; - case 0xf16568af: return "_FAtan"; - case 0xf19c5e94: return "sincosf4"; - case 0xf1aaa2f8: return "conj"; - case 0xf3bd7d08: return "_cbrtf4fast"; - case 0xf3ec0258: return "round"; - case 0xf4ad6ea8: return "ldexp"; - case 0xf537d837: return "_truncf4"; - case 0xf5cd1e19: return "cosf4"; - case 0xf7844153: return "_f_fmaxf"; - case 0xf83a372f: return "f_fmaf"; - case 0xf95b7769: return "powf4fast"; - case 0xf99da2fc: return "fabsf4"; - case 0xfa28434b: return "log2l"; - case 0xfa765d42: return "_Cdivcr"; - case 0xfa97afbf: return "feupdateenv"; - case 0xfae9e727: return "_f_copysignf"; - case 0xfb6e6213: return "log1pf4fast"; - case 0xfb932a56: return "atan2f"; - case 0xfbb4047a: return "lroundf"; - case 0xfbe88922: return "_FErfc"; - case 0xfcedabc3: return "_fmodf4"; - case 0xfcf08193: return "expf"; - case 0xfdec16e1: return "cacoshl"; - case 0xfe23dbe9: return "_log2f4"; - case 0xff036800: return "cpowf"; - case 0xfffe79bf: return "_LCmulcc"; - } + if (_module == "sys_libc" || _module == "sys_libm") + switch (fnid) + { + case 0x00acf0e5: return "spu_printf_finalize"; + case 0x00fb4a6b: return "spu_thread_sprintf"; + case 0x0125b2ca: return "_rand_int32_TT800"; + case 0x01508f24: return "raw_spu_write_float"; + case 0x0264f468: return "_Wctomb"; + case 0x02f4d325: return "spu_thread_read_double"; + case 0x02f52a3c: return "_filep_close_it"; + case 0x03becf3c: return "_Defloc"; + case 0x04a183fc: return "strcpy"; + case 0x04a1f19d: return "raw_spu_write_short"; + case 0x05d821c4: return "_Stoullx"; + case 0x077cdb23: return "btowc"; + case 0x07c7971d: return "_Stoldx"; + case 0x0871ffb0: return "mspace_malloc_usable_size"; + case 0x0891a3fa: return "_Tlsfree"; + case 0x09cbee1e: return "strxfrm"; + case 0x0a1d4b00: return "spu_thread_read_uint"; + case 0x0a4e2541: return "spu_thread_read_ldouble"; + case 0x0ae275a4: return "_Stolx"; + case 0x0b0d272f: return "_malloc_finalize"; + case 0x0b9d04d0: return "_Getnloc"; + case 0x0b9ecb98: return "toupper_ascii"; + case 0x0cae547f: return "raw_spu_write_double"; + case 0x0d2a593b: return "srand"; + case 0x0d8a2de0: return "_CStrxfrm"; + case 0x0df8809f: return "__call_functions_registered_with_atexit"; + case 0x0f60eb63: return "vfwscanf"; + case 0x0ff4722c: return "raw_spu_read_ushort"; + case 0x1096f8f1: return "ispunct_ascii"; + case 0x1098a99d: return "localeconv"; + case 0x112ea8ea: return "strspn"; + case 0x115e2f70: return "spu_thread_snprintf"; + case 0x116cda13: return "wcstol"; + case 0x118712ea: return "islower"; + case 0x11d270d2: return "exitspawn"; + case 0x126656b7: return "_Btowc"; + case 0x128b334f: return "raw_spu_read_mem"; + case 0x12a55fb7: return "mbrtowc"; + case 0x130d20a5: return "towlower"; + case 0x1365b52a: return "fcntl"; + case 0x13808972: return "wcstok"; + case 0x14052ae0: return "absi4"; + case 0x14348b57: return "divi4"; + case 0x145853cd: return "mspace_destroy"; + case 0x15362bc9: return "spu_thread_read_long"; + case 0x153b364a: return "mkdir"; + case 0x15bdcc00: return "rand"; + case 0x15c2e29d: return "isgraph_ascii"; + case 0x17752bab: return "wcsftime"; + case 0x17bc0136: return "_Lrv2d"; + case 0x17c031d7: return "spu_thread_read_ulong"; + case 0x1855b9b1: return "setlocale"; + case 0x1895908d: return "mspace_realloc"; + case 0x18e48b5d: return "wscanf"; + case 0x18f7b77d: return "_Dnorm"; + case 0x1970cd7e: return "getpid"; + case 0x19ccbb81: return "mktime"; + case 0x1ab01ea8: return "truncate"; + case 0x1abd0985: return "div"; + case 0x1ae06860: return "wcstoumax"; + case 0x1b4c3ff0: return "atexit"; + case 0x1c0e8ab6: return "vswscanf"; + case 0x1c2ef212: return "getwc"; + case 0x1cf4d80a: return "iswalpha"; + case 0x1dcd8609: return "_Strxfrmx"; + case 0x1dd0d4c5: return "spu_printf_attach_group"; + case 0x1df4732e: return "_Getptolower"; + case 0x1e9d2b4f: return "spu_thread_read_int"; + case 0x1ecae195: return "_Vacopy"; + case 0x1f913e8d: return "chmod"; + case 0x1f925c41: return "_allocate_mapped_pages"; + case 0x206612c4: return "spu_thread_read_ptr"; + case 0x216984ed: return "spu_thread_write_long"; + case 0x216fcd2a: return "_Atrealloc"; + case 0x21807b8e: return "towctrans"; + case 0x225702e1: return "_fs_initialize"; + case 0x22b0e566: return "_Stollx"; + case 0x23d3bca7: return "_Eadd"; + case 0x242c603e: return "_Frprep"; + case 0x243b52d8: return "_Mbtowcx"; + case 0x24802244: return "iswcntrl"; + case 0x24c9e021: return "abs"; + case 0x24e230d2: return "_Wctob"; + case 0x24f6cbdd: return "clock"; + case 0x253b7210: return "_rand_real2_TT800"; + case 0x25beee5a: return "__raw_spu_printf"; + case 0x25da8fbb: return "iscntrl"; + case 0x266311a0: return "localtime"; + case 0x2677568c: return "putchar"; + case 0x26f023d5: return "ftell"; + case 0x273b9711: return "sprintf"; + case 0x28b92ebf: return "raw_spu_read_uchar"; + case 0x296bc72f: return "_FDunscale"; + case 0x2b45cb34: return "wcsrtombs"; + case 0x2b7ba4ca: return "_Tlsset"; + case 0x2b81fb7f: return "readdir"; + case 0x2bc9dee6: return "raw_spu_read_short"; + case 0x2caea755: return "_Once"; + case 0x2d067448: return "ftruncate64"; + case 0x2d17ca7f: return "_Puttxt"; + case 0x2eea9f25: return "_Esub"; + case 0x2f45d39c: return "strlen"; + case 0x2fecec13: return "getwchar"; + case 0x30fb2899: return "_Getmem"; + case 0x312be3b3: return "_malloc_init_lv2"; + case 0x313f04ab: return "raw_spu_read_char"; + case 0x329a4540: return "_WPrintf"; + case 0x32e4a30a: return "_Mtxdst"; + case 0x336b4191: return "_Getint"; + case 0x33d6ae54: return "ferror"; + case 0x344eca7e: return "_WGetstr"; + case 0x34dd6650: return "_Getcloc"; + case 0x34e7c97e: return "_Unlocksyslock"; + case 0x3512ad38: return "tmpnam"; + case 0x355fd1fd: return "mbtowc"; + case 0x3574d37d: return "_Wcsxfrmx"; + case 0x36c067c1: return "_Stoll"; + case 0x36f2b4ed: return "strtoull"; + case 0x36feb965: return "raw_spu_write_llong"; + case 0x3704840e: return "_fs_finalize"; + case 0x38426d25: return "_Wctombx"; + case 0x3902363a: return "malloc_footprint"; + case 0x39bf419c: return "valloc"; + case 0x3a210c93: return "swscanf"; + case 0x3a840ae3: return "snprintf"; + case 0x3b22e88a: return "isxdigit"; + case 0x3b8097ac: return "_WScanf"; + case 0x3bce073b: return "putc"; + case 0x3bd9ce0a: return "fsync"; + case 0x3ca81c76: return "_Iswctype"; + case 0x3d1460e9: return "_Strerror"; + case 0x3d541975: return "atoi"; + case 0x3d5fdea7: return "vfwprintf"; + case 0x3d85d6f8: return "strcmp"; + case 0x3dbc3bee: return "opendir"; + case 0x3e57dfac: return "_Genld"; + case 0x3ec99a66: return "_Getptimes"; + case 0x3ee29d0b: return "_Stof"; + case 0x3f125e2e: return "spu_thread_write_short"; + case 0x3f4ccdc7: return "isdigit"; + case 0x3f650700: return "mspace_is_heap_empty"; + case 0x40a2599a: return "atol"; + case 0x40d04e4e: return "fwide"; + case 0x40e0ff25: return "_WGenld"; + case 0x41283333: return "isdigit_ascii"; + case 0x418bdfe1: return "_get_fd"; + case 0x4217b4cf: return "difftime"; + case 0x433fe2a9: return "fwscanf"; + case 0x44115dd0: return "_Geterrno"; + case 0x44796e5c: return "strerror"; + case 0x449317ed: return "_Fopen"; + case 0x44d7cae8: return "raw_spu_read_float"; + case 0x4544c2de: return "spu_thread_write_mem"; + case 0x4569518c: return "malloc_stats"; + case 0x459072c3: return "_init_TT800"; + case 0x4595c42b: return "wcsxfrm"; + case 0x468b45dc: return "mspace_calloc"; + case 0x4911ff9c: return "rand_int31_TT800"; + case 0x498a5036: return "raw_spu_write_mem"; + case 0x4a0049c6: return "_Getpctype"; + case 0x4ab5fbe2: return "_Printf"; + case 0x4b36c0e0: return "vfscanf"; + case 0x4b6a4010: return "vswprintf"; + case 0x4bb8e2b2: return "raw_spu_write_ushort"; + case 0x4c3f5f29: return "_Getgloballocale"; + case 0x4c7dc863: return "iswupper"; + case 0x4d348427: return "fputs"; + case 0x4e4be299: return "longjmp"; + case 0x4e72f810: return "wmemchr"; + case 0x4ffba189: return "feof"; + case 0x508196b4: return "raw_spu_printf"; + case 0x508e00c6: return "_Getloc"; + case 0x51b28904: return "_Stodx"; + case 0x526a496a: return "write"; + case 0x532b03be: return "raw_spu_read_uint"; + case 0x53eb43a1: return "_Getpmbstate"; + case 0x54b383bc: return "_Locvar"; + case 0x54c2844e: return "spu_raw_snprintf"; + case 0x54f57626: return "rewind"; + case 0x5516bbbf: return "iswctype"; + case 0x55d4866e: return "fgetws"; + case 0x5751acf9: return "_LDscale"; + case 0x575fb268: return "wctrans"; + case 0x57ff7dd7: return "_WStod"; + case 0x58320830: return "_WLitob"; + case 0x589b5314: return "strncat"; + case 0x5909e3c4: return "memset"; + case 0x59640bc6: return "raw_spu_read_ullong"; + case 0x59c1bb1f: return "_Getpwcstate"; + case 0x59e8dd58: return "strtoll"; + case 0x5a74f774: return "spu_thread_read_float"; + case 0x5b162b7f: return "memmove"; + case 0x5b4b6d6d: return "wcspbrk"; + case 0x5cc71eee: return "raw_spu_write_ldouble"; + case 0x5d43c1a3: return "_Mbtowc"; + case 0x5dbceee3: return "rand_int32_TT800"; + case 0x5e06c3fe: return "__getpid"; + case 0x5e7888f0: return "bsearch"; + case 0x5eb95641: return "_Stold"; + case 0x5f922a30: return "_Dscale"; + case 0x5f9a65c7: return "_WStold"; + case 0x5fa1e497: return "_Unlockfilelock"; + case 0x60627fb3: return "_LDunscale"; + case 0x6075a3c6: return "_Ld2rv"; + case 0x609080ec: return "isspace_ascii"; + case 0x6137d196: return "memalign"; + case 0x6287ac6a: return "iswdigit"; + case 0x62bf1d6c: return "swprintf"; + case 0x64aaf016: return "raw_spu_read_ldouble"; + case 0x6514dbe5: return "wcstold"; + case 0x6539ff6d: return "_Gentime"; + case 0x6545b7de: return "fgetpos"; + case 0x65e8d4d0: return "wcslen"; + case 0x6660fc8d: return "TlsGetValue"; + case 0x6687fba4: return "_Fgpos"; + case 0x66b71b17: return "wcsspn"; + case 0x67582370: return "spu_thread_write_double"; + case 0x676e3e7a: return "raw_spu_write_ptr"; + case 0x67d6334b: return "strtof"; + case 0x6823c180: return "iswprint"; + case 0x69106fd2: return "_init_by_array_TT800"; + case 0x692b497f: return "perror"; + case 0x6995f5e8: return "_Ldtob"; + case 0x69c27c12: return "fopen"; + case 0x69ff1b9b: return "fseek"; + case 0x6ba10474: return "_Tlsalloc"; + case 0x6cf78f3e: return "_Mtxunlock"; + case 0x6d5115b0: return "wcsncmp"; + case 0x6e988e5f: return "_rand_int31_TT800"; + case 0x7028dea9: return "_Locksyslock"; + case 0x703ec767: return "setvbuf"; + case 0x70b0e833: return "mblen"; + case 0x714c9618: return "__raw_spu_putfld"; + case 0x717b2502: return "stat"; + case 0x72236cbc: return "raw_spu_write_ullong"; + case 0x72b84004: return "spu_printf_attach_thread"; + case 0x73096858: return "wctob"; + case 0x7345b4be: return "_WStoll"; + case 0x73eae03d: return "strrchr"; + case 0x744d2505: return "ispunct"; + case 0x74fe4a7b: return "iswgraph"; + case 0x759e0635: return "malloc"; + case 0x75d4485c: return "rename"; + case 0x75f98579: return "wcscoll"; + case 0x76da0c84: return "ftruncate"; + case 0x76ed4243: return "_Wcsftime"; + case 0x770bfaee: return "wctype"; + case 0x77a602dd: return "free"; + case 0x77c15441: return "_WGetfloat"; + case 0x77e241bc: return "_Skip"; + case 0x7817edf0: return "raw_spu_write_uint"; + case 0x783636d1: return "spu_thread_read_char"; + case 0x78429d81: return "putwchar"; + case 0x79819dbf: return "fputc"; + case 0x7994c28d: return "_FDtentox"; + case 0x79eadf05: return "malloc_usable_size"; + case 0x7aaab95c: return "iswblank"; + case 0x7ae82e0f: return "vsprintf"; + case 0x7aee5acd: return "_Lockfilelock"; + case 0x7b5aac20: return "spu_thread_write_ptr"; + case 0x7b7a687a: return "_WPutfld"; + case 0x7b9c592e: return "spu_thread_read_ullong"; + case 0x7c1bcf37: return "isalnum_ascii"; + case 0x7c370679: return "_Foprep"; + case 0x7cec7b39: return "_Putfld"; + case 0x7d894764: return "_Readloc"; + case 0x7e7017b1: return "rmdir"; + case 0x7ea8d860: return "spu_printf_detach_group"; + case 0x7efd420a: return "_Daysto"; + case 0x7fd325c4: return "mspace_malloc_stats"; + case 0x7fdcf73e: return "wcscat"; + case 0x806fd281: return "isblank_ascii"; + case 0x809a143f: return "kill"; + case 0x813a9666: return "ungetwc"; + case 0x814d8cb0: return "fflush"; + case 0x81a0a858: return "_memset_int"; + case 0x82a3cc30: return "wcschr"; + case 0x82a4561a: return "_put_fd"; + case 0x831d70a5: return "memcpy"; + case 0x8342b757: return "utime"; + case 0x84378ddc: return "wcsncpy"; + case 0x86532174: return "imaxdiv"; + case 0x867275d7: return "_Stoul"; + case 0x86b4c669: return "tolower_ascii"; + case 0x8713c859: return "link"; + case 0x8725a1a7: return "_memset_vmx"; + case 0x87e8f748: return "memset_vmx"; + case 0x8809cdfd: return "_Getpwctytab"; + case 0x882689f2: return "_Makeloc"; + case 0x882e7760: return "raw_spu_write_uchar"; + case 0x889d5804: return "_Dunscale"; + case 0x88e009f5: return "vwprintf"; + case 0x896e1bfd: return "spu_thread_write_uchar"; + case 0x89b62f56: return "_Etentox"; + case 0x89f6f026: return "time"; + case 0x8a6830e7: return "abort"; + case 0x8a71132c: return "remove"; + case 0x8a847b51: return "tmpfile"; + case 0x8ab0abc6: return "strncpy"; + case 0x8b439438: return "clearerr"; + case 0x8b9d8dd2: return "iswpunct"; + case 0x8cb6bfdc: return "_Locsum"; + case 0x8d7ffaf1: return "_WStopfx"; + case 0x8e2484f1: return "_Emul"; + case 0x8ed71e8b: return "_WGetfld"; + case 0x8ef85e47: return "_WPuttxt"; + case 0x8f5dd179: return "_Nnl"; + case 0x90010029: return "gets"; + case 0x9027fd99: return "_WStoldx"; + case 0x90457fe3: return "raw_spu_read_long"; + case 0x90b27880: return "strtoumax"; + case 0x9234f738: return "raw_spu_read_int"; + case 0x93427cb9: return "setbuf"; + case 0x938bfcf7: return "spu_thread_write_char"; + case 0x93a3e3ac: return "tolower"; + case 0x9439e4cd: return "wcsncat"; + case 0x96b6baa6: return "spu_thread_read_mem"; + case 0x96e6303b: return "_WStoxflt"; + case 0x96ea4de6: return "wctomb"; + case 0x97896359: return "isspace"; + case 0x9800573c: return "_WLdtob"; + case 0x980d3ea7: return "_Getfld"; + case 0x9886810c: return "_FDnorm"; + case 0x98f0eeab: return "raw_spu_write_ulong"; + case 0x99782342: return "strncasecmp_ascii"; + case 0x99a72146: return "vsnprintf"; + case 0x99b38ce7: return "wmemmove"; + case 0x9a87bb3a: return "_Getmbcurmax"; + case 0x9abe8c74: return "wprintf"; + case 0x9c7028a5: return "spu_thread_write_uint"; + case 0x9c9d7b0d: return "strtold"; + case 0x9cab08d1: return "spu_thread_write_int"; + case 0x9d140351: return "_Destroytls"; + case 0x9eb25e00: return "strcoll"; + case 0x9eee5387: return "truncate64"; + case 0x9ff08d57: return "_Clearlocks"; + case 0xa0ab76d5: return "_absi4"; + case 0xa0bc0efb: return "mallinfo"; + case 0xa0ddba8e: return "_Stoulx"; + case 0xa1dbb466: return "_Gettime"; + case 0xa2945229: return "_WGetint"; + case 0xa30d4797: return "wcstoll"; + case 0xa3440924: return "closedir"; + case 0xa3da58f6: return "rand_real1_TT800"; + case 0xa45a0313: return "mspace_create"; + case 0xa483d50d: return "_rv2d"; + case 0xa53800c2: return "_malloc_finalize_lv2"; + case 0xa568db82: return "spu_thread_read_ushort"; + case 0xa57cc615: return "iswspace"; + case 0xa5bc0e19: return "getchar"; + case 0xa6463518: return "__rename"; + case 0xa650df19: return "toupper"; + case 0xa65886b8: return "_Findloc"; + case 0xa72a7595: return "calloc"; + case 0xa797790f: return "wcsstr"; + case 0xa82d70da: return "_Tlsget"; + case 0xa835be11: return "__cxa_atexit"; + case 0xa874036a: return "wcstof"; + case 0xa8a6f615: return "TlsSetValue"; + case 0xa8b07f1b: return "wmemcpy"; + case 0xa9f68eff: return "qsort"; + case 0xaa1e687d: return "isgraph"; + case 0xaa266d35: return "_malloc_init"; + case 0xaa9635d7: return "strcat"; + case 0xab4c7ca1: return "_CWcsxfrm"; + case 0xab77019f: return "fstat"; + case 0xabc27420: return "wcstoul"; + case 0xac758d20: return "wmemcmp"; + case 0xac893127: return "fgetc"; + case 0xace90be4: return "_Dtentox"; + case 0xad62a342: return "ldiv"; + case 0xad8e9ad0: return "_Initlocks"; + case 0xaec7c970: return "lseek"; + case 0xaf002043: return "independent_comalloc"; + case 0xaf44a615: return "fgets"; + case 0xaf6bdcb0: return "_Nonfatal_Assert"; + case 0xaf89fdbd: return "_Assert"; + case 0xafa39179: return "_WPutstr"; + case 0xb120f6ca: return "close"; + case 0xb17b79d0: return "isalpha"; + case 0xb18cc115: return "freopen"; + case 0xb1cc43e3: return "_CStrftime"; + case 0xb1f4779d: return "spu_thread_printf"; + case 0xb24cb8d6: return "_Locterm"; + case 0xb2702e15: return "wcrtomb"; + case 0xb2748a9f: return "_Freeloc"; + case 0xb30042ce: return "lldiv"; + case 0xb37982ea: return "_Getstr"; + case 0xb3c495bd: return "imaxabs"; + case 0xb3d98d59: return "_rand_real1_TT800"; + case 0xb400f226: return "isupper_ascii"; + case 0xb4225825: return "mbsinit"; + case 0xb43c25c7: return "wcstoull"; + case 0xb49eea74: return "_init_malloc_lock0"; + case 0xb4a54446: return "_Stofx"; + case 0xb4fc7078: return "_close_all_FILE"; + case 0xb529d259: return "isalnum"; + case 0xb569849d: return "reallocalign"; + case 0xb57bdf7b: return "iswxdigit"; + case 0xb5d353e8: return "_LDtentox"; + case 0xb6002508: return "_Putstr"; + case 0xb6257e3d: return "strncasecmp"; + case 0xb680e240: return "wcstombs"; + case 0xb6af290e: return "_WFrprep"; + case 0xb6d92ac3: return "strcasecmp"; + case 0xb738027a: return "strtok_r"; + case 0xb794631e: return "_WStofx"; + case 0xb7ab5127: return "wcsrchr"; + case 0xb7b793ed: return "get_state_TT800"; + case 0xb7ba4aeb: return "_WStoul"; + case 0xb7d3427f: return "iscntrl_ascii"; + case 0xb81cd66a: return "mbrlen"; + case 0xb9ed25d4: return "raw_spu_read_ulong"; + case 0xba62681f: return "mspace_memalign"; + case 0xbb605c96: return "pvalloc"; + case 0xbbd4582f: return "_Setloc"; + case 0xbc1d69c5: return "atoll"; + case 0xbc374779: return "_Getlname"; + case 0xbc5af0b5: return "fgetwc"; + case 0xbc7b4b8e: return "ctime"; + case 0xbe11beaa: return "_wremove"; + case 0xbe251a29: return "islower_ascii"; + case 0xbe6e5c58: return "spu_thread_read_uchar"; + case 0xbec43f86: return "raw_spu_read_ptr"; + case 0xbf5bf5ea: return "lseek64"; + case 0xbfcd1b3b: return "_Getdst"; + case 0xc01d9f97: return "printf"; + case 0xc08cc41d: return "wcstod"; + case 0xc0e27b2c: return "_Makestab"; + case 0xc155a73f: return "_WStoull"; + case 0xc15e657e: return "spu_raw_sprintf"; + case 0xc1a71972: return "_d2rv"; + case 0xc1b4bbb9: return "raw_spu_write_char"; + case 0xc1c8737c: return "_Getptoupper"; + case 0xc291e698: return "exit"; + case 0xc3c598e2: return "spu_printf_initialize"; + case 0xc3e14cbe: return "memcmp"; + case 0xc4178000: return "_rand_real3_TT800"; + case 0xc41c6e5d: return "_Scanf"; + case 0xc57337f8: return "_Fofind"; + case 0xc5c09834: return "strstr"; + case 0xc63c354f: return "_Exit"; + case 0xc69b2427: return "labs"; + case 0xc78df618: return "rand_real3_TT800"; + case 0xc7b62ab8: return "spu_thread_write_ullong"; + case 0xc9471fac: return "_Mtxinit"; + case 0xc94b27e3: return "_WStof"; + case 0xc95b20d3: return "fputwc"; + case 0xc9607d35: return "_Stopfx"; + case 0xc97a17d7: return "vsscanf"; + case 0xcab654bf: return "_Once_ctor"; + case 0xcb85ac70: return "mspace_malloc"; + case 0xcb9c535b: return "strftime"; + case 0xcbac7ad7: return "memchr"; + case 0xcbdc3a6d: return "raw_spu_write_int"; + case 0xcc5e0c72: return "_divi4"; + case 0xcca68e9c: return "putwc"; + case 0xce7a9e76: return "isprint_ascii"; + case 0xcecbcdc4: return "_Frv2d"; + case 0xcf863219: return "_Fwprep"; + case 0xcfbfb7a7: return "spu_printf_detach_thread"; + case 0xd14ece90: return "strtol"; + case 0xd1d69cb8: return "_Stod"; + case 0xd20f6601: return "independent_calloc"; + case 0xd2a99b1e: return "isprint"; + case 0xd2ac48d7: return "iswalnum"; + case 0xd360dcb4: return "fileno"; + case 0xd3964a09: return "__spu_thread_putfld"; + case 0xd40723d6: return "fread"; + case 0xd417eeb5: return "_Stoull"; + case 0xd4912ee3: return "_FDscale"; + case 0xd5c8cb55: return "spu_thread_write_ushort"; + case 0xd69c513d: return "_Wcscollx"; + case 0xd784459d: return "isupper"; + case 0xd7dc3a8f: return "strtod"; + case 0xd8b4eb20: return "__spu_thread_puttxt"; + case 0xd9674905: return "mspace_reallocalign"; + case 0xd9a4f812: return "atoff"; + case 0xda5a7eb8: return "strtoul"; + case 0xdaeada07: return "mallopt"; + case 0xddbac025: return "strcasecmp_ascii"; + case 0xddc71a75: return "_SCE_Assert"; + case 0xde1bb092: return "init_by_array_TT800"; + case 0xde32a334: return "_Exitspawn"; + case 0xde7aff7a: return "memcpy16"; + case 0xdebee2af: return "strchr"; + case 0xdef86a83: return "isxdigit_ascii"; + case 0xdfb52083: return "_Stoxflt"; + case 0xe03c7ab1: return "_Fspos"; + case 0xe1858899: return "_Getpwctrtab"; + case 0xe1bd3587: return "fclose"; + case 0xe1e83c65: return "strncmp"; + case 0xe2c5274a: return "_WStoflt"; + case 0xe3812672: return "fdopen"; + case 0xe3cc73f3: return "puts"; + case 0xe3d91db3: return "raw_spu_read_double"; + case 0xe40ba755: return "strtok"; + case 0xe44bf0bf: return "atof"; + case 0xe469fb20: return "_Atexit"; + case 0xe48348e9: return "vprintf"; + case 0xe4c51d4c: return "wcstoimax"; + case 0xe5ea9e2b: return "_Isdst"; + case 0xe5f09c80: return "llabs"; + case 0xe60ee9e5: return "fputws"; + case 0xe6a7de0a: return "ungetc"; + case 0xe7def231: return "_Getfloat"; + case 0xe89071ad: return "isalpha_ascii"; + case 0xe9137453: return "fwprintf"; + case 0xe9a2cc40: return "raw_spu_write_long"; + case 0xe9b560a5: return "sscanf"; + case 0xeb26298c: return "gmtime"; + case 0xeb40c9ec: return "rand_real2_TT800"; + case 0xeb8abe73: return "vwscanf"; + case 0xec9e7cb9: return "spu_thread_read_llong"; + case 0xecddba69: return "_WStodx"; + case 0xed6ec979: return "fsetpos"; + case 0xeda48c80: return "malloc_trim"; + case 0xeddcee2c: return "init_TT800"; + case 0xedec777d: return "_Ttotm"; + case 0xeeeb4f3e: return "_get_state_TT800"; + case 0xeeffc9a6: return "_wrename"; + case 0xef110b6b: return "unlink"; + case 0xf06eed36: return "wmemset"; + case 0xf0776a44: return "wcscmp"; + case 0xf0e022c6: return "getc"; + case 0xf2bbbee9: return "_Litob"; + case 0xf2fca4b2: return "spu_thread_write_llong"; + case 0xf356418c: return "open"; + case 0xf3ef3678: return "wcscspn"; + case 0xf41355f9: return "wcscpy"; + case 0xf418ee84: return "_WFwprep"; + case 0xf4207734: return "spu_thread_write_ulong"; + case 0xf5a32994: return "_Getpcostate"; + case 0xf5ef229c: return "_Getpwcostate"; + case 0xf5f7dda8: return "towupper"; + case 0xf68e2ac9: return "_init_malloc_lock"; + case 0xf7583d67: return "vscanf"; + case 0xf7908e27: return "strcspn"; + case 0xf7a14a22: return "realloc"; + case 0xf7d51596: return "scanf"; + case 0xf7ddb471: return "_Setgloballocale"; + case 0xf88f26c4: return "fwrite"; + case 0xf8935fe3: return "spu_thread_write_float"; + case 0xf89dc648: return "strpbrk"; + case 0xf9dae72c: return "setjmp"; + case 0xf9dba140: return "_Mtxlock"; + case 0xf9e26b72: return "_Once_dtor"; + case 0xfa00d211: return "read"; + case 0xfae4b063: return "_Strcollx"; + case 0xfaec8c60: return "fprintf"; + case 0xfb0f0018: return "_Makewct"; + case 0xfb2081fd: return "vfprintf"; + case 0xfb81426d: return "iswlower"; + case 0xfb8ea4d2: return "_Fd2rv"; + case 0xfc0428a6: return "strdup"; + case 0xfc60575c: return "__spu_thread_printf"; + case 0xfc606237: return "mbsrtowcs"; + case 0xfcac2e8e: return "mbstowcs"; + case 0xfd0cb96d: return "spu_thread_read_short"; + case 0xfd461e85: return "spu_thread_write_ldouble"; + case 0xfd6a1ddb: return "raw_spu_read_llong"; + case 0xfd81f6ca: return "_Stoflt"; + case 0xfe0261aa: return "mspace_free"; + case 0xfe630fd9: return "isblank"; + case 0xfe88e97e: return "fscanf"; + case 0xff689124: return "strtoimax"; + case 0xffbae95e: return "asctime"; + case 0xffbd876b: return "__raw_spu_puttxt"; + case 0x003395d9: return "_Feraise"; + case 0x00367be0: return "fminl"; + case 0x007854f4: return "_FDclass"; + case 0x00fde072: return "f_powf"; + case 0x010818fc: return "asinf4"; + case 0x012d0a91: return "_fminf4"; + case 0x016556df: return "_sinf4"; + case 0x01b84b27: return "llround"; + case 0x01ecef7d: return "_FCbuild"; + case 0x02e68d44: return "_f_fmodf"; + case 0x032cc709: return "csin"; + case 0x03593d2c: return "_f_expf"; + case 0x03aea906: return "divf4"; + case 0x0522d1af: return "_recipf4"; + case 0x054aae63: return "_fdimf4"; + case 0x05cb1718: return "f_fdimf"; + case 0x05e27a13: return "log10f4fast"; + case 0x05efc660: return "asin"; + case 0x05f1dc9e: return "_FExp"; + case 0x07274304: return "csinh"; + case 0x07daed62: return "log2f4"; + case 0x07f400e3: return "_LCbuild"; + case 0x080414bd: return "conjl"; + case 0x08139bd2: return "_fmaxf4"; + case 0x0829a21d: return "asinhl"; + case 0x0a242ed5: return "sinf4"; + case 0x0b3f4e90: return "catanhf"; + case 0x0bb036a6: return "_cosf4"; + case 0x0c14cfcc: return "fesetenv"; + case 0x0c9b8305: return "hypotf4"; + case 0x0cbdae68: return "sinf"; + case 0x0cf9b8bd: return "_Erfc"; + case 0x0d86295d: return "_LCaddcr"; + case 0x0e53319f: return "_asinf4"; + case 0x0e8573dc: return "expm1l"; + case 0x0f02f882: return "llrintl"; + case 0x0f428f0f: return "rint"; + case 0x0f721a9d: return "_LCsubcc"; + case 0x10627248: return "f_fmodf"; + case 0x11c51388: return "tgamma"; + case 0x1225dd31: return "casinf"; + case 0x12de4e46: return "_powf4"; + case 0x12e04cd7: return "cimagl"; + case 0x1313a420: return "acos"; + case 0x137f7e77: return "expf4"; + case 0x14208b00: return "_asinf4fast"; + case 0x1498a072: return "_Cmulcr"; + case 0x16bf208a: return "log10f"; + case 0x17316bee: return "log2"; + case 0x178d98dd: return "atanf4fast"; + case 0x17cd5d87: return "_recipf4fast"; + case 0x182cd542: return "tgammal"; + case 0x18668ce3: return "exp"; + case 0x18b26998: return "remainderl"; + case 0x18ec6099: return "rintl"; + case 0x1988732d: return "clog10"; + case 0x1a1adede: return "rsqrtf4fast"; + case 0x1acb2b16: return "acosf4"; + case 0x1bbdcd9f: return "expm1f4"; + case 0x1bcdeb47: return "_LSinh"; + case 0x1be996cc: return "_LCdivcc"; + case 0x1c11885d: return "_floorf4"; + case 0x1d35bfe4: return "_LLog"; + case 0x1d5bf5d0: return "_modff4"; + case 0x1e623f95: return "truncf4"; + case 0x1e85ef02: return "f_atanf"; + case 0x1e9fd6ba: return "_sinf4fast"; + case 0x2033eeb7: return "csqrt"; + case 0x2118fe46: return "cexpl"; + case 0x21a37b3e: return "log1pf"; + case 0x21e6d304: return "ceil"; + case 0x22c3e308: return "_exp2f4"; + case 0x238af59b: return "fegetenv"; + case 0x23b985f7: return "floorf"; + case 0x241f9337: return "_FCmulcr"; + case 0x24497c52: return "cosf"; + case 0x246ea8d0: return "f_sqrtf"; + case 0x2627d6b2: return "erfc"; + case 0x266d2473: return "_Caddcr"; + case 0x26deed0b: return "cosl"; + case 0x26ef50ed: return "asinh"; + case 0x28faaa5a: return "ilogbf4"; + case 0x29685118: return "_negatef4"; + case 0x2a138d2b: return "truncf"; + case 0x2a4dcbad: return "cacosl"; + case 0x2a89ce33: return "llrintf"; + case 0x2af4b73b: return "fmax"; + case 0x2b282ebb: return "sqrtl"; + case 0x2bb0f2c9: return "logb"; + case 0x2c45fe6a: return "fmaxl"; + case 0x2c601f3b: return "csinl"; + case 0x2cbb6f53: return "f_hypotf"; + case 0x2dcab6a4: return "nanl"; + case 0x2df339bc: return "_f_floorf"; + case 0x2e69bb2a: return "_FCosh"; + case 0x2ec867b4: return "exp2f4fast"; + case 0x30bc7a53: return "logf4"; + case 0x315673f6: return "_Csubcc"; + case 0x31be25c3: return "scalblnf"; + case 0x31db8c89: return "atan2"; + case 0x321c55de: return "nexttowardl"; + case 0x3261de11: return "fesetexceptflag"; + case 0x329ec019: return "rsqrtf4"; + case 0x32f994a1: return "cosf4fast"; + case 0x33e5929b: return "_LDsign"; + case 0x33f27f25: return "_FCdivcr"; + case 0x3436f008: return "csinhf"; + case 0x3459748b: return "log10f4"; + case 0x347c1ee1: return "atanf4"; + case 0x34c0371e: return "powl"; + case 0x358d7f93: return "_f_lrintf"; + case 0x3593a445: return "clog"; + case 0x35b6e70a: return "lrintl"; + case 0x35d3f688: return "creal"; + case 0x36778d1b: return "coshf"; + case 0x373054d1: return "cpow"; + case 0x37345541: return "log1pl"; + case 0x376fb27f: return "sinhl"; + case 0x3792b12d: return "lroundl"; + case 0x38ba5590: return "ccosl"; + case 0x38e69f09: return "pow"; + case 0x398483aa: return "_expm1f4fast"; + case 0x39ef81c9: return "f_fmaxf"; + case 0x3ad203fa: return "lrint"; + case 0x3adc01d7: return "f_frexpf"; + case 0x3b802524: return "ldexpf4"; + case 0x3c057fbd: return "atanf"; + case 0x3c616743: return "_LDtest"; + case 0x3cb818fa: return "_f_fdimf"; + case 0x3d4efafb: return "atan2l"; + case 0x3d549f2a: return "ctanhl"; + case 0x3d901a10: return "_ceilf4"; + case 0x3da55602: return "fabsf"; + case 0x3dfa060f: return "scalbnl"; + case 0x3e7eb58f: return "frexpf4"; + case 0x3e919cba: return "scalbnf"; + case 0x3ec9de23: return "_cbrtf4"; + case 0x3eeedb0e: return "_Dclass"; + case 0x3f6262b3: return "f_fminf"; + case 0x3f701e78: return "_Poly"; + case 0x4020f5ef: return "cbrt"; + case 0x405f9727: return "_log1pf4fast"; + case 0x40a2e212: return "_fabsf4"; + case 0x4111b546: return "_LExp"; + case 0x411434bb: return "asinf"; + case 0x414c5ecc: return "_f_hypotf"; + case 0x4152669c: return "scalbln"; + case 0x417851ce: return "feholdexcept"; + case 0x418036e3: return "_FTgamma"; + case 0x4189a367: return "remquo"; + case 0x41d1b236: return "_f_rintf"; + case 0x430309a1: return "ldexpf"; + case 0x434881a0: return "cacosf"; + case 0x43d522f4: return "cabsl"; + case 0x44cd6308: return "remainder"; + case 0x44cf744b: return "tanhl"; + case 0x45034943: return "nan"; + case 0x452ac4bb: return "floorf4"; + case 0x453f9e91: return "cbrtf"; + case 0x46b66f76: return "csqrtl"; + case 0x46cf72d9: return "fdimf"; + case 0x47433144: return "expm1f4fast"; + case 0x475d855b: return "trunc"; + case 0x476b5591: return "fmaf"; + case 0x48157605: return "_f_llrintf"; + case 0x4826db61: return "fma"; + case 0x4875601d: return "_exp2f4fast"; + case 0x487bbd1c: return "tanf4"; + case 0x488df791: return "cexp"; + case 0x48d462a9: return "_FDint"; + case 0x4930ac11: return "logbl"; + case 0x4a5ae27d: return "f_exp2f"; + case 0x4a6ca9a6: return "powf4"; + case 0x4ab22a63: return "_Caddcc"; + case 0x4add664c: return "feclearexcept"; + case 0x4ae52dd3: return "exp2"; + case 0x4b03d5b2: return "f_rintf"; + case 0x4b584841: return "f_asinf"; + case 0x4cb5fa99: return "nexttoward"; + case 0x4d878773: return "remainderf4"; + case 0x4ddb926b: return "powf"; + case 0x4e010403: return "copysign"; + case 0x4eb5eb51: return "sin"; + case 0x4fa4f5ec: return "nexttowardf"; + case 0x501c412f: return "cargf"; + case 0x519ebb77: return "floor"; + case 0x547fb4a7: return "sinf4fast"; + case 0x54d2fb8c: return "rintf"; + case 0x5516d621: return "acosl"; + case 0x55c8a549: return "truncl"; + case 0x56c573a8: return "log1p"; + case 0x575e9b6e: return "asinl"; + case 0x58eb9e57: return "fabs"; + case 0x596ab55c: return "atanh"; + case 0x5b18eded: return "clogl"; + case 0x5b474c22: return "casinhl"; + case 0x5bfd37be: return "_FCaddcc"; + case 0x5e48dede: return "exp2f4"; + case 0x5ee10a95: return "catanh"; + case 0x5ee37927: return "_LErfc"; + case 0x60e9ff3c: return "_expm1f4"; + case 0x61250988: return "catanl"; + case 0x6261c0b5: return "_log10f4"; + case 0x63bbdfa6: return "_FCmulcc"; + case 0x642e3d18: return "_frexpf4"; + case 0x642f7d6b: return "f_copysignf"; + case 0x645557bd: return "copysignl"; + case 0x64abdb4d: return "csinhl"; + case 0x657d0e83: return "divf4fast"; + case 0x65935877: return "ilogbf"; + case 0x659e011e: return "sqrt"; + case 0x6636c4a5: return "frexpf"; + case 0x664e04b9: return "negatef4"; + case 0x6764c707: return "f_log2f"; + case 0x683cacb3: return "sinh"; + case 0x68a8957f: return "casinhf"; + case 0x68f72416: return "nextafterl"; + case 0x69040b9b: return "logbf4"; + case 0x69725dce: return "lgamma"; + case 0x6ad1c42b: return "_sincosf4"; + case 0x6b660894: return "_acosf4fast"; + case 0x6b6ab2a9: return "_LDclass"; + case 0x6c009c56: return "f_log10f"; + case 0x6c6285c6: return "acoshf"; + case 0x6cc4bd13: return "casinh"; + case 0x6ddd31b2: return "hypot"; + case 0x6df35518: return "floorl"; + case 0x6e9eb0dc: return "sincosf4fast"; + case 0x6ef6b083: return "_FCsubcr"; + case 0x6f5dd7d2: return "cexpf"; + case 0x6f639afb: return "f_llroundf"; + case 0x6fcc1e27: return "_FPoly"; + case 0x70357b12: return "_atanf4fast"; + case 0x7048396e: return "carg"; + case 0x705d9e24: return "f_acosf"; + case 0x70f71871: return "_FCdivcc"; + case 0x71293b71: return "_FLog"; + case 0x714adce1: return "log"; + case 0x71f2bc56: return "_divf4fast"; + case 0x728149e5: return "f_ldexpf"; + case 0x729b7269: return "cproj"; + case 0x72a3ed28: return "fesettrapenable"; + case 0x72f1f64b: return "_logbf4"; + case 0x734ca589: return "_f_cosf"; + case 0x742f12b4: return "_Sin"; + case 0x74902d4b: return "expf4fast"; + case 0x749440f9: return "lgammal"; + case 0x752fa85e: return "fmaxf4"; + case 0x758f33dc: return "nearbyint"; + case 0x75e3e2e9: return "nearbyintl"; + case 0x76afaf04: return "_sqrtf4"; + case 0x76e639ec: return "_atanf4"; + case 0x772f1e4d: return "lround"; + case 0x7793a86b: return "ctanf"; + case 0x7831a2e0: return "hypotl"; + case 0x78e4590a: return "acosh"; + case 0x790c53bd: return "_Fpcomp"; + case 0x7919f414: return "_f_nearbyintf"; + case 0x79ba9b5c: return "expl"; + case 0x7a893af1: return "_rsqrtf4"; + case 0x7ab679da: return "f_cosf"; + case 0x7c2eaeb5: return "fminf"; + case 0x7d02a5ca: return "sqrtf4fast"; + case 0x7d6191d0: return "_Cosh"; + case 0x7f381837: return "frexp"; + case 0x7f579e03: return "atan"; + case 0x7f91cd41: return "tanf4fast"; + case 0x812ed488: return "cabsf"; + case 0x81daf880: return "_LCsubcr"; + case 0x8217e783: return "cosh"; + case 0x833e6b0e: return "cimag"; + case 0x834f5917: return "ccosh"; + case 0x842cb14d: return "_log1pf4"; + case 0x8451edf0: return "sqrtf"; + case 0x889cccb0: return "llroundl"; + case 0x88fb4a66: return "recipf4fast"; + case 0x892f2590: return "fegetround"; + case 0x895cdb49: return "fmaxf"; + case 0x89b507b3: return "catanhl"; + case 0x89d1d168: return "_LAtan"; + case 0x8b168769: return "fdiml"; + case 0x8bd1deb2: return "_LTgamma"; + case 0x8bd67efc: return "erf"; + case 0x8c85369b: return "_f_fminf"; + case 0x8d5858db: return "_f_exp2f"; + case 0x8e01379e: return "cacoshf"; + case 0x8e258fa0: return "cacos"; + case 0x8ecae294: return "nextafter"; + case 0x8f2bcdb5: return "_logf4"; + case 0x8f96319e: return "log10l"; + case 0x8fb7bac7: return "_sqrtf4fast"; + case 0x904e646b: return "cargl"; + case 0x90f0242f: return "_f_sinf"; + case 0x9110708a: return "modfl"; + case 0x91cdfdb0: return "asinf4fast"; + case 0x9232baea: return "_FDtest"; + case 0x9245e01b: return "_divf4"; + case 0x9379e36e: return "tanf"; + case 0x938fb946: return "_tanf4fast"; + case 0x947ae18e: return "_LHypot"; + case 0x9558ed08: return "lrintf"; + case 0x95dfecb1: return "_FCsubcc"; + case 0x961688d1: return "f_nearbyintf"; + case 0x9616e336: return "_FHypot"; + case 0x964ac044: return "creall"; + case 0x96d1b95e: return "log2f4fast"; + case 0x9700d9cd: return "clogf"; + case 0x970a3432: return "cacosh"; + case 0x99a6c261: return "catanf"; + case 0x99c228fc: return "roundl"; + case 0x9a81e583: return "fmodf"; + case 0x9af30eaf: return "casin"; + case 0x9e289062: return "_f_ceilf"; + case 0x9e3ada21: return "logl"; + case 0x9e8130b6: return "ccos"; + case 0x9f03dd3e: return "lgammaf"; + case 0x9f0efc6e: return "exp2l"; + case 0x9f46f5a4: return "tgammaf"; + case 0x9f65bd34: return "fdimf4"; + case 0x9f78f052: return "cos"; + case 0x9fded78a: return "_acosf4"; + case 0xa0160c30: return "_copysignf4"; + case 0xa20827a8: return "ctanl"; + case 0xa2c81938: return "_LSin"; + case 0xa4578433: return "fmin"; + case 0xa46a70a1: return "atanhl"; + case 0xa4ca5cf2: return "llroundf"; + case 0xa56557b6: return "catan"; + case 0xa5d0b260: return "acoshl"; + case 0xa713f8cf: return "modf"; + case 0xa7658186: return "log1pf4"; + case 0xa823836b: return "ilogb"; + case 0xa8c16038: return "_FDsign"; + case 0xa8d180e8: return "_Cbuild"; + case 0xa92bcc85: return "cabs"; + case 0xa9e039c4: return "erfcf"; + case 0xaaa270dc: return "_LCdivcr"; + case 0xab377381: return "log2f"; + case 0xabdccc7a: return "f_atan2f"; + case 0xacca2f83: return "copysignf"; + case 0xad17e787: return "_Dint"; + case 0xad3a093d: return "_LCosh"; + case 0xad5d3e57: return "_FLgamma"; + case 0xaddce673: return "erfcl"; + case 0xafa13040: return "f_llrintf"; + case 0xafcfdad7: return "_Lgamma"; + case 0xafd9a625: return "cimagf"; + case 0xb0fa1592: return "clog10l"; + case 0xb24bd2f8: return "logbf"; + case 0xb348c5c2: return "_LLgamma"; + case 0xb412a8dc: return "_LDint"; + case 0xb4ef29d5: return "f_floorf"; + case 0xb4f4513e: return "_Tgamma"; + case 0xb54cc9a1: return "f_sinf"; + case 0xb5961d4e: return "_sincosf4fast"; + case 0xb598a495: return "fmodl"; + case 0xb5e28191: return "_FSin"; + case 0xb7696143: return "nextafterf"; + case 0xb79012ba: return "modff"; + case 0xb89863bc: return "_rsqrtf4fast"; + case 0xb8aa984e: return "_expf4"; + case 0xb94b9d13: return "_Dtest"; + case 0xb9d2ad22: return "remquol"; + case 0xba136594: return "csinf"; + case 0xba84eab5: return "coshl"; + case 0xbaf11866: return "ceilf"; + case 0xbb165807: return "expm1f"; + case 0xbb208b20: return "cbrtf4fast"; + case 0xbb761c89: return "remquof"; + case 0xbbaa300b: return "f_log1pf"; + case 0xbbf7354e: return "fegetexceptflag"; + case 0xbd7410d9: return "recipf4"; + case 0xbd8bb75c: return "asinhf"; + case 0xbf23f2e7: return "cprojl"; + case 0xbfda6837: return "_f_log10f"; + case 0xc0609820: return "nearbyintf"; + case 0xc0bcf25e: return "_logf4fast"; + case 0xc357b33a: return "frexpl"; + case 0xc406dd09: return "cbrtf4"; + case 0xc41f01db: return "fminf4"; + case 0xc477c0f6: return "f_lroundf"; + case 0xc4cccd1f: return "modff4"; + case 0xc7369fce: return "_Atan"; + case 0xc78ac9d0: return "scalbn"; + case 0xc7b45a19: return "_LFpcomp"; + case 0xc7f1d407: return "fmal"; + case 0xc7fb73d6: return "f_lrintf"; + case 0xc8910002: return "ilogbl"; + case 0xc8dd9279: return "expm1"; + case 0xc90f4bbc: return "_atan2f4"; + case 0xc9481758: return "_tanf4"; + case 0xc94fcc63: return "cbrtl"; + case 0xc977e1ea: return "fetestexcept"; + case 0xc984bf53: return "roundf"; + case 0xc9c536ce: return "_ldexpf4"; + case 0xca239640: return "fmodf4"; + case 0xca463458: return "_Log"; + case 0xcaaf7ae7: return "cprojf"; + case 0xcac167a5: return "_Cmulcc"; + case 0xcb6599c0: return "exp2f"; + case 0xcb6a147e: return "_cosf4fast"; + case 0xcbdf9afb: return "_log10f4fast"; + case 0xccc66f11: return "_FSinh"; + case 0xce91ff18: return "nanf"; + case 0xcfee82d8: return "_remainderf4"; + case 0xd0fd3ca8: return "_hypotf4"; + case 0xd125b89e: return "conjf"; + case 0xd1a3574c: return "clog10f"; + case 0xd231e30a: return "ldexpl"; + case 0xd28ef6dd: return "_Hypot"; + case 0xd2a666c9: return "ctanh"; + case 0xd3a346a8: return "tanl"; + case 0xd40f3f2c: return "erff"; + case 0xd42904b7: return "fabsl"; + case 0xd477852d: return "logf"; + case 0xd48eaae1: return "scalblnl"; + case 0xd4f37b9d: return "tanhf"; + case 0xd50277ad: return "tan"; + case 0xd54039cb: return "fegettrapenable"; + case 0xd5adc4b2: return "cpowl"; + case 0xd5d38552: return "_LCaddcc"; + case 0xd612fa16: return "_Sinh"; + case 0xd70df92a: return "_FCaddcr"; + case 0xd7653782: return "sinhf"; + case 0xd76a16da: return "_fmaf4"; + case 0xd8270894: return "fdim"; + case 0xd8c4096d: return "atan2f4"; + case 0xd8d157f5: return "f_expf"; + case 0xd8f79f4c: return "log10"; + case 0xd97852b7: return "sinl"; + case 0xd97ce5d4: return "fesetround"; + case 0xda217d1f: return "atanl"; + case 0xda31fc5d: return "_FFpcomp"; + case 0xdc14974c: return "fmaf4"; + case 0xdc151707: return "_f_log2f"; + case 0xdd8660d2: return "atan2f4fast"; + case 0xdd92118e: return "ceill"; + case 0xdddabb32: return "remainderf"; + case 0xde7833f2: return "_log2f4fast"; + case 0xdece76a6: return "acosf"; + case 0xdfd41734: return "_Exp"; + case 0xdffb4e3c: return "casinl"; + case 0xe1288c47: return "atanhf"; + case 0xe1c71b05: return "ccoshl"; + case 0xe2b596ec: return "ccosf"; + case 0xe2de89e6: return "csqrtf"; + case 0xe2f1d4b2: return "tanh"; + case 0xe31cc0d3: return "_ilogbf4"; + case 0xe3e379b8: return "_expf4fast"; + case 0xe584836c: return "_LPoly"; + case 0xe58fc9b5: return "erfl"; + case 0xe5a0be9f: return "_powf4fast"; + case 0xe5d2293f: return "_Force_raise"; + case 0xe5ea65e8: return "feraiseexcept"; + case 0xe6c1ff41: return "llrint"; + case 0xe769e5cf: return "fmod"; + case 0xe8fcf1f8: return "acosf4fast"; + case 0xe913a166: return "logf4fast"; + case 0xe92f3fb8: return "_f_fmaf"; + case 0xe93abfca: return "ctan"; + case 0xe9ac8223: return "_LCmulcr"; + case 0xe9f501df: return "crealf"; + case 0xea1e83e3: return "f_logf"; + case 0xeac62795: return "_Cdivcc"; + case 0xeac7ca2c: return "ceilf4"; + case 0xebb4e08a: return "hypotf"; + case 0xec43b983: return "_f_sqrtf"; + case 0xec7da0c8: return "_atan2f4fast"; + case 0xed05c265: return "sqrtf4"; + case 0xed9d1ac5: return "f_tanf"; + case 0xeda86c48: return "copysignf4"; + case 0xee0db701: return "_Csubcr"; + case 0xee204ac6: return "f_ceilf"; + case 0xee303936: return "_Dsign"; + case 0xeed82401: return "_f_logf"; + case 0xf0947035: return "ctanhf"; + case 0xf0ab77c1: return "ccoshf"; + case 0xf16568af: return "_FAtan"; + case 0xf19c5e94: return "sincosf4"; + case 0xf1aaa2f8: return "conj"; + case 0xf3bd7d08: return "_cbrtf4fast"; + case 0xf3ec0258: return "round"; + case 0xf4ad6ea8: return "ldexp"; + case 0xf537d837: return "_truncf4"; + case 0xf5cd1e19: return "cosf4"; + case 0xf7844153: return "_f_fmaxf"; + case 0xf83a372f: return "f_fmaf"; + case 0xf95b7769: return "powf4fast"; + case 0xf99da2fc: return "fabsf4"; + case 0xfa28434b: return "log2l"; + case 0xfa765d42: return "_Cdivcr"; + case 0xfa97afbf: return "feupdateenv"; + case 0xfae9e727: return "_f_copysignf"; + case 0xfb6e6213: return "log1pf4fast"; + case 0xfb932a56: return "atan2f"; + case 0xfbb4047a: return "lroundf"; + case 0xfbe88922: return "_FErfc"; + case 0xfcedabc3: return "_fmodf4"; + case 0xfcf08193: return "expf"; + case 0xfdec16e1: return "cacoshl"; + case 0xfe23dbe9: return "_log2f4"; + case 0xff036800: return "cpowf"; + case 0xfffe79bf: return "_LCmulcc"; + } - if (_module == "sys_libstdcxx") switch (fnid) - { - case 0x002c338b: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE16do_get_monthnameES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; - case 0x002e18d8: return "_ZNSt6locale7_LocimpD0Ev"; - case 0x0091a3fd: return "_ZNKSt6locale9_GetfacetEj"; - case 0x00c3975e: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE5_LockEv"; - case 0x00cf44f7: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecl"; - case 0x01409785: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE7_GetintERS3_S5_iiRi"; - case 0x01aa0cef: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERx"; - case 0x01c4ef01: return "_ZNSt6localeC2ERKS_S1_i"; - case 0x01d9b3f5: return "_ZNSt6localeC1EPKci"; - case 0x01f81190: return "_ZNSt12codecvt_baseD1Ev"; - case 0x020b22f3: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewPKv"; - case 0x02e40598: return "_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE5_InitERKSt8_Locinfo"; - case 0x03217f6f: return "_ZNSt19istreambuf_iteratorIcSt11char_traitsIcEE5_PeekEv"; - case 0x0339259c: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecPKv"; - case 0x033c18f4: return "_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEED1Ev"; - case 0x03cca12f: return "_ZNSt6localeC1ERKS_PKci"; - case 0x040c18ff: return "_ZNKSt7_MpunctIwE16do_decimal_pointEv"; - case 0x045e124a: return "_ZdaPv"; - case 0x0490855d: return "_ZNSt8numpunctIwE7_GetcatEPPKNSt6locale5facetE"; - case 0x055c1462: return "_ZNSt15basic_streambufIcSt11char_traitsIcEED1Ev"; - case 0x05903101: return "_ZNKSt7collateIcE7do_hashEPKcS2_"; - case 0x05a9cef6: return "_ZNSt7_MpunctIcE5_InitERKSt8_Locinfo"; - case 0x05ec37c8: return "_ZSt10_MaklocstrIwEPT_PKcS1_RKSt7_Cvtvec"; - case 0x06bc5b51: return "_ZNKSt7_MpunctIwE16do_positive_signEv"; - case 0x07a3bd16: return "_ZNSt6locale7_LocimpD1Ev"; - case 0x07b6c924: return "_ZTv0_n12_NSt13basic_ostreamIwSt11char_traitsIwEED1Ev"; - case 0x085bff4f: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE5_LockEv"; - case 0x08e1865c: return "_ZNKSt8numpunctIwE16do_thousands_sepEv"; - case 0x09e73a2a: return "_ZNKSt7codecvtIwcSt9_MbstatetE11do_encodingEv"; - case 0x0ba5483c: return "_ZNKSt12codecvt_base11do_encodingEv"; - case 0x0bc08c57: return "_ZNKSt7collateIwE7do_hashEPKwS2_"; - case 0x0bcc1910: return "_ZNSt10ostrstreamD2Ev"; - case 0x0d4290d2: return "_ZNSt12length_errorD0Ev"; - case 0x0d644dca: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE11do_get_dateES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; - case 0x0e147a9d: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE9pbackfailEi"; - case 0x0e744ef5: return "_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEED1Ev"; - case 0x0e9698af: return "_ZNSt7codecvtIwcSt9_MbstatetED1Ev"; - case 0x0e9a5554: return "_ZNSt13basic_istreamIwSt11char_traitsIwEED0Ev"; - case 0x0f930fdd: return "_ZNSt13messages_baseD2Ev"; - case 0x0ff264b9: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE4syncEv"; - case 0x10231873: return "_ZNSt13runtime_errorD1Ev"; - case 0x10dc3f6c: return "_ZNSbIwSt11char_traitsIwESaIwEE6appendEjw"; - case 0x113a515f: return "_ZNKSt8messagesIcE7do_openERKSsRKSt6locale"; - case 0x114e9178: return "_ZNSt11logic_errorD0Ev"; - case 0x128cd621: return "_ZNKSt5ctypeIwE10do_scan_isEsPKwS2_"; - case 0x12de5772: return "_ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_bRSt8ios_baseRNSt5_IosbIiE8_IostateERSs"; - case 0x1374b8c8: return "_ZNSt10moneypunctIcLb0EED1Ev"; - case 0x143048bf: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE7seekoffElNSt5_IosbIiE8_SeekdirENS4_9_OpenmodeE"; - case 0x1474ac53: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERt"; - case 0x14e3faa5: return "_ZNKSt5ctypeIwE9do_narrowEwc"; - case 0x1527fe95: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE4syncEv"; - case 0x1692ae0c: return "_ZNSt6localeD1Ev"; - case 0x16df5ecb: return "_ZNKSt12codecvt_base16do_always_noconvEv"; - case 0x17dd0a4e: return "_ZNKSt7_MpunctIwE16do_negative_signEv"; - case 0x18628537: return "_ZNKSt8numpunctIcE16do_decimal_pointEv"; - case 0x186bcc94: return "_ZNSt8ios_base4InitD1Ev"; - case 0x18a38254: return "_ZNSt10ctype_baseD1Ev"; - case 0x197fc348: return "_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev"; - case 0x1989f59c: return "_ZNSt8ios_base17register_callbackEPFvNS_5eventERS_iEi"; - case 0x19c901ce: return "_ZTv0_n12_NSt9strstreamD0Ev"; - case 0x1a00f889: return "_ZNSt9exceptionD2Ev"; - case 0x1a4f2fa6: return "_ZNSt8ios_base7failureD0Ev"; - case 0x1a7f963c: return "_ZNKSt8numpunctIcE11do_truenameEv"; - case 0x1b266c3d: return "_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE7_GetcatEPPKNSt6locale5facetE"; - case 0x1b6a7482: return "_ZNKSt7_MpunctIwE13do_neg_formatEv"; - case 0x1b6ad260: return "_ZSt13resetiosflagsNSt5_IosbIiE9_FmtflagsE"; - case 0x1b9b3b5c: return "_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEED0Ev"; - case 0x1bccd2ca: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE7_GetintERS3_S5_iiRi"; - case 0x1c3f1c4f: return "_ZNSt6_MutexD1Ev"; - case 0x1c8083c5: return "_ZNSt12strstreambufD0Ev"; - case 0x1c8405dc: return "_ZNSt7_MpunctIcEC2Ejb"; - case 0x1cf6785d: return "_ZSt9use_facetISt5ctypeIwEERKT_RKSt6locale"; - case 0x1d43fb44: return "_ZSt9use_facetISt8numpunctIwEERKT_RKSt6locale"; - case 0x1ee13e83: return "_ZNSt6locale5facetD0Ev"; - case 0x1f2e9f4e: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE9underflowEv"; - case 0x1f3a9ada: return "_ZNSt12strstreambuf7seekposESt4fposISt9_MbstatetENSt5_IosbIiE9_OpenmodeE"; - case 0x2070a73d: return "_ZNSt6locale7_LocimpC1ERKS0_"; - case 0x207b56fa: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE8_GetffldEPcRS3_S6_RKSt6locale"; - case 0x20a02b6d: return "_ZNSt6locale2idcvjEv"; - case 0x20f7e066: return "_ZNSt10moneypunctIwLb0EED0Ev"; - case 0x21659e45: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE5_FputES3_RSt8ios_basecPKcjjjj"; - case 0x22777290: return "_ZNSs7replaceEjjPKcj"; - case 0x229a0963: return "_ZNKSt5ctypeIwE5do_isEsw"; - case 0x2354ec0a: return "_ZNKSt7codecvtIwcSt9_MbstatetE10do_unshiftERS0_PcS3_RS3_"; - case 0x2356ef16: return "_ZnajRKSt9nothrow_t"; - case 0x23a87483: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE11do_get_timeES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; - case 0x23ef7642: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE8_GetifldEPcRS3_S6_NSt5_IosbIiE9_FmtflagsERKSt6locale"; - case 0x258359df: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basece"; - case 0x2670b433: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE8_GetffldEPcRS3_S6_RKSt6locale"; - case 0x268c3ea5: return "_ZNKSt7_MpunctIwE13do_pos_formatEv"; - case 0x26e8e1cf: return "_ZNKSt5ctypeIwE5do_isEPKwS2_Ps"; - case 0x273be056: return "_ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE8_PutmfldES3_bRSt8ios_basecbSs"; - case 0x281f9107: return "_ZTv0_n12_NSiD1Ev"; - case 0x294779fb: return "_ZNSt8ios_base4InitD2Ev"; - case 0x2954d64d: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE9underflowEv"; - case 0x29c11f46: return "_ZNKSt7codecvtIccSt9_MbstatetE9do_lengthERKS0_PKcS5_j"; - case 0x29c90b94: return "_ZNKSt8numpunctIcE16do_thousands_sepEv"; - case 0x2a16469d: return "_ZNSt8ios_base5imbueERKSt6locale"; - case 0x2ac890f4: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERb"; - case 0x2adccb1a: return "_ZNKSt7_MpunctIcE14do_frac_digitsEv"; - case 0x2af79bd6: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE5_IputES3_RSt8ios_basecPcj"; - case 0x2b05b95a: return "_ZNKSt7_MpunctIcE11do_groupingEv"; - case 0x2b88f26e: return "_ZNSt15basic_streambufIwSt11char_traitsIwEED0Ev"; - case 0x2c241d13: return "_ZnajjRKSt9nothrow_t"; - case 0x2c6ce396: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERd"; - case 0x2cf8ea50: return "_ZNKSt7codecvtIwcSt9_MbstatetE16do_always_noconvEv"; - case 0x2d489b47: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE9underflowEv"; - case 0x2d50650f: return "_ZSt9use_facetISt10moneypunctIcLb1EEERKT_RKSt6locale"; - case 0x2d8be7e8: return "_ZNKSt9exception6_RaiseEv"; - case 0x2daa5a42: return "_ZTv0_n12_NSt9strstreamD1Ev"; - case 0x2e2b80c8: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERPv"; - case 0x2e84ebb3: return "_ZNSt8_LocinfoC1EiPKc"; - case 0x2eb5c13a: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE4syncEv"; - case 0x2f29da90: return "_ZNSt12strstreambuf5_TidyEv"; - case 0x2ff8d101: return "_ZNSt6localeC1ERKS_S1_i"; - case 0x30195cf5: return "_ZNKSt8numpunctIcE11do_groupingEv"; - case 0x30ce43d4: return "_ZNSt8numpunctIcED0Ev"; - case 0x30e297ea: return "_ZNSt7_MpunctIcEC2ERKSt8_Locinfojb"; - case 0x316b7a34: return "_ZNSt9exceptionD1Ev"; - case 0x31a81476: return "_ZdlPvj"; - case 0x31b3e5cc: return "_ZNSs5_TidyEbj"; - case 0x3286b855: return "_ZNSt8time_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetE"; - case 0x332f8409: return "_ZNSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE7_GetcatEPPKNSt6locale5facetE"; - case 0x336e904e: return "_ZNSdD0Ev"; - case 0x33e04d8e: return "_ZNKSt7collateIwE12do_transformEPKwS2_"; - case 0x34b63588: return "_ZNKSt5ctypeIwE9_DonarrowEwc"; - case 0x34edd72b: return "_ZNSt10moneypunctIwLb0EED1Ev"; - case 0x360f8a4f: return "_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEED1Ev"; - case 0x3697bbd3: return "_ZNSt8ios_base5_InitEv"; - case 0x36e7826a: return "_ZNSt7collateIcED1Ev"; - case 0x3783acfa: return "_ZTv0_n12_NSt13basic_istreamIwSt11char_traitsIwEED1Ev"; - case 0x38783beb: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE11do_get_yearES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; - case 0x3933645f: return "_ZNKSt7_MpunctIwE14do_frac_digitsEv"; - case 0x3937f2f8: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecm"; - case 0x39775ce9: return "_ZNSt11logic_errorD2Ev"; - case 0x3ad12959: return "_ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_Eb"; - case 0x3bac19dc: return "_ZThn8_NSdD0Ev"; - case 0x3bda45a7: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecy"; - case 0x3d32a7f4: return "_ZNSt6localeC2EPKci"; - case 0x3da21a90: return "_ZNSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEED1Ev"; - case 0x3e18602a: return "_ZNKSt12codecvt_base13do_max_lengthEv"; - case 0x3eeb7167: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE7_UnlockEv"; - case 0x3f6a6e68: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE9_EndwriteEv"; - case 0x3f9cb259: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERl"; - case 0x3fc2324d: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecd"; - case 0x409409af: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE6setbufEPci"; - case 0x411b923e: return "_ZSt9use_facetISt8numpunctIcEERKT_RKSt6locale"; - case 0x4148e091: return "_ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE8_GetmfldERS3_S5_bRSt8ios_base"; - case 0x417f47af: return "_ZSt9use_facetISt10moneypunctIcLb0EEERKT_RKSt6locale"; - case 0x42c40b2f: return "_ZNSt12out_of_rangeD0Ev"; - case 0x45010630: return "_ZNSt10moneypunctIcLb1EED0Ev"; - case 0x4520d6a2: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE5_LockEv"; - case 0x46034d2e: return "_ZNSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEED0Ev"; - case 0x460e5cb7: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE7seekposESt4fposISt9_MbstatetENSt5_IosbIiE9_OpenmodeE"; - case 0x4761783a: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE5imbueERKSt6locale"; - case 0x47aab531: return "_ZNSt7_MpunctIcED0Ev"; - case 0x47e5c318: return "_ZNSt8_LocinfoD2Ev"; - case 0x4827e6be: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERe"; - case 0x48d101ef: return "_ZNKSt8ios_base7failure8_DoraiseEv"; - case 0x493212da: return "_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEED0Ev"; - case 0x4952490e: return "_ZNSt8ios_base5clearENSt5_IosbIiE8_IostateEb"; - case 0x496c6f50: return "_Getctyptab"; - case 0x49d9ddaf: return "_ZNKSt8numpunctIwE12do_falsenameEv"; - case 0x49da8c5f: return "_ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_bRSt8ios_baseRNSt5_IosbIiE8_IostateERe"; - case 0x49f7d434: return "_ZNSt8numpunctIwED0Ev"; - case 0x4a40969d: return "_Fac_tidy"; - case 0x4a799510: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERl"; - case 0x4aec14d5: return "_ZNSt12length_errorD1Ev"; - case 0x4aff73cc: return "_ZSt14_Debug_messagePKcS0_"; - case 0x4b1ad744: return "_ZdaPvjRKSt9nothrow_t"; - case 0x4b5a8abc: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE6setbufEPwi"; - case 0x4bc193c7: return "_ZNSt10ostrstreamC2EPciNSt5_IosbIiE9_OpenmodeE"; - case 0x4bda379a: return "_ZNSt8ios_base4InitC1Ev"; - case 0x4bee7ba9: return "_ZNSt8ios_base7failureD1Ev"; - case 0x4cb35e7d: return "_ZNSt9time_baseD1Ev"; - case 0x4cdab0ba: return "_ZNSt7_MpunctIwED0Ev"; - case 0x4daf3fcf: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE6xsgetnEPci"; - case 0x4e34cf83: return "_ZNSbIwSt11char_traitsIwESaIwEE5_GrowEjb"; - case 0x4e5cd916: return "_ZNKSt8numpunctIwE11do_groupingEv"; - case 0x4ec89bf8: return "_ZNSt7collateIcE7_GetcatEPPKNSt6locale5facetE"; - case 0x4ef0eb8e: return "_ZNSt12strstreambuf7seekoffElNSt5_IosbIiE8_SeekdirENS1_9_OpenmodeE"; - case 0x4fde96de: return "_ZNSt15basic_streambufIwSt11char_traitsIwEED1Ev"; - case 0x5015b8d3: return "_ZSt7_FiopenPKwNSt5_IosbIiE9_OpenmodeEi"; - case 0x50b34c09: return "_ZNKSt9exception4whatEv"; - case 0x5102ac61: return "_ZNKSt7_MpunctIwE14do_curr_symbolEv"; - case 0x5119680b: return "_ZNSt8_LocinfoD1Ev"; - case 0x5127dcd1: return "_ZNSsC1Ev"; - case 0x522b0457: return "_ZNSt10istrstreamD0Ev"; - case 0x52330fbd: return "_ZNSt13runtime_errorD0Ev"; - case 0x5298ef8e: return "_ZdaPvRKSt9nothrow_t"; - case 0x5333bdc9: return "_ZNKSt13runtime_error4whatEv"; - case 0x53693d40: return "_ZSt11setiosflagsNSt5_IosbIiE9_FmtflagsE"; - case 0x5438d7d8: return "_ZdaPvS_"; - case 0x550255f7: return "_ZNKSt7codecvtIccSt9_MbstatetE10do_unshiftERS0_PcS3_RS3_"; - case 0x55481e6f: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE9showmanycEv"; - case 0x5560c79e: return "_ZNSdD1Ev"; - case 0x55b3ebf2: return "_ZNSt9strstreamC2EPciNSt5_IosbIiE9_OpenmodeE"; - case 0x563fd2be: return "_ZNSt6localeC2ERKS_PKci"; - case 0x5656ccff: return "_ZNKSt7collateIcE10do_compareEPKcS2_S2_S2_"; - case 0x56d3d4f0: return "_ZNSt9bad_allocD1Ev"; - case 0x56fac416: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERe"; - case 0x577c2695: return "_ZNSt6_Mutex5_LockEv"; - case 0x57ef52f0: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE7_UnlockEv"; - case 0x581fc95b: return "_ZNSt5ctypeIcED0Ev"; - case 0x58fad1c1: return "_ZNSt5ctypeIwE7_GetcatEPPKNSt6locale5facetE"; - case 0x5949408e: return "_ZNSt8ios_base5_TidyEv"; - case 0x59c77266: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERd"; - case 0x5a3ad4bd: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERf"; - case 0x5a5a9107: return "_ZNSt6localeC2Ev"; - case 0x5a6e4e50: return "_ZNSt6locale7_Locimp9_MakewlocERKSt8_LocinfoiPS0_PKS_"; - case 0x5a898327: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE7seekoffElNSt5_IosbIiE8_SeekdirENS4_9_OpenmodeE"; - case 0x5adf9060: return "_ZNKSt5ctypeIcE8do_widenEPKcS2_Pc"; - case 0x5b71b85d: return "_ZNSt19istreambuf_iteratorIwSt11char_traitsIwEE4_IncEv"; - case 0x5c15972f: return "_ZNSt13basic_ostreamIwSt11char_traitsIwEED1Ev"; - case 0x5ca98e4a: return "_ZNSt13basic_filebufIcSt11char_traitsIcEED0Ev"; - case 0x5e1f2d37: return "_ZNKSt9exception8_DoraiseEv"; - case 0x5e55ab8c: return "_ZSt10_GetloctxtIwSt19istreambuf_iteratorIwSt11char_traitsIwEEEiRT0_S5_jPKT_"; - case 0x5ed4fb7a: return "_ZTv0_n12_NSt13basic_istreamIwSt11char_traitsIwEED0Ev"; - case 0x604fec95: return "_ZNSt12out_of_rangeD1Ev"; - case 0x605131d5: return "_ZNSt8_LocinfoC1EPKc"; - case 0x6051c802: return "_ZNSt7codecvtIccSt9_MbstatetED0Ev"; - case 0x608abbb5: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE5uflowEv"; - case 0x61119152: return "_ZNSt6locale5_InitEv"; - case 0x61248c80: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE13do_date_orderEv"; - case 0x61a23009: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE5_FputES3_RSt8ios_basewPKcjjjj"; - case 0x61f55c30: return "_ZNKSt5ctypeIcE8do_widenEc"; - case 0x629b8531: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE5_IputES3_RSt8ios_basewPcj"; - case 0x62d6bf82: return "_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEED1Ev"; - case 0x62f52bb0: return "_ZNSt7_MpunctIwEC2ERKSt8_Locinfojb"; - case 0x635166c3: return "_ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_bRSt8ios_basewe"; - case 0x63a2b2cc: return "_ZNKSt8messagesIcE8do_closeEi"; - case 0x643235cf: return "_ZNSt9strstreamD1Ev"; - case 0x6437a975: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERt"; - case 0x643e67f4: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERPv"; - case 0x6463d9ea: return "_ZNKSt8messagesIwE6do_getEiiiRKSbIwSt11char_traitsIwESaIwEE"; - case 0x64ce0374: return "_ZNSbIwSt11char_traitsIwESaIwEE7replaceEjjPKwj"; - case 0x64ed868e: return "_ZSt9terminatev"; - case 0x6500d2d5: return "_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetE"; - case 0x65f19631: return "_ZTv0_n12_NSiD0Ev"; - case 0x660882e8: return "_ZNSt6localeC1Ev"; - case 0x667d741b: return "_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev"; - case 0x668b31c6: return "_ZNSs5_GrowEjb"; - case 0x66f39adb: return "_ZNSt8numpunctIwED1Ev"; - case 0x66fcc6f4: return "_ZNSt8messagesIwE7_GetcatEPPKNSt6locale5facetE"; - case 0x67948307: return "_ZNKSt7codecvtIwcSt9_MbstatetE9do_lengthERKS0_PKcS5_j"; - case 0x67c09257: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERx"; - case 0x67edde2f: return "_ZdlPvjRKSt9nothrow_t"; - case 0x67fbabf0: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14do_get_weekdayES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; - case 0x683ca70a: return "_ZNKSt12_String_base5_XlenEv"; - case 0x6863452e: return "_ZNSt6locale5facetD1Ev"; - case 0x6929318d: return "_ZNSs6assignERKSsjj"; - case 0x696b47f2: return "_ZNKSt7_MpunctIcE13do_neg_formatEv"; - case 0x6a6b90c9: return "_ZSt15set_new_handlerPFvvE"; - case 0x6adc320a: return "_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEED0Ev"; - case 0x6b493669: return "_ZSt7setbasei"; - case 0x6b913d53: return "_ZNSs6insertEjjc"; - case 0x6c19db26: return "_ZNKSt7_MpunctIcE16do_thousands_sepEv"; - case 0x6c386f54: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE7seekposESt4fposISt9_MbstatetENSt5_IosbIiE9_OpenmodeE"; - case 0x6c8dc459: return "_ZNKSt8bad_cast4whatEv"; - case 0x6cb1a335: return "_ZNSt6locale5facet7_DecrefEv"; - case 0x6d483b7a: return "_ZNSt12strstreambuf9pbackfailEi"; - case 0x6daed882: return "_ZNSt8ios_baseD0Ev"; - case 0x6dbbb9de: return "_ZNKSt5ctypeIcE10do_toupperEc"; - case 0x6e0bf85d: return "_ZTv0_n12_NSt10istrstreamD1Ev"; - case 0x6e4a84c1: return "_ZNSt5ctypeIcED1Ev"; - case 0x6e61426d: return "_ZNSt13basic_filebufIwSt11char_traitsIwEED1Ev"; - case 0x6f1945fc: return "_ZNSoD1Ev"; - case 0x6fe060a0: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE7seekposESt4fposISt9_MbstatetENSt5_IosbIiE9_OpenmodeE"; - case 0x7008e209: return "_ZNKSt5ctypeIwE10do_toupperEw"; - case 0x708cf940: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE11do_get_dateES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; - case 0x709ab035: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE6setbufEPci"; - case 0x7142ad20: return "_ZNKSt7_MpunctIcE16do_decimal_pointEv"; - case 0x718977c5: return "_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetE"; - case 0x736c5f22: return "_ZNSoD0Ev"; - case 0x74a39b4f: return "_ZThn8_NSt9strstreamD1Ev"; - case 0x753c71db: return "_ZNKSt7_MpunctIcE13do_pos_formatEv"; - case 0x75824de0: return "_ZNSt6_MutexC1Ev"; - case 0x75975eb4: return "_ZNSsC1EPKc"; - case 0x75a0617c: return "_ZNKSt7_MpunctIwE11do_groupingEv"; - case 0x764ceaa4: return "_ZNSt10ostrstreamD0Ev"; - case 0x767a4e70: return "_ZNSt6_WinitC2Ev"; - case 0x76db6974: return "_ZNSt7codecvtIwcSt9_MbstatetED0Ev"; - case 0x76de9b0f: return "_ZNSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEED1Ev"; - case 0x76e846b2: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE6xsputnEPKwi"; - case 0x77c1d3a9: return "_ZNKSt13runtime_error8_DoraiseEv"; - case 0x7882e64e: return "_ZNSt7collateIwED0Ev"; - case 0x78a142d0: return "_ZSt7_FiopenPKcNSt5_IosbIiE9_OpenmodeEi"; - case 0x79a415f8: return "_ZNSbIwSt11char_traitsIwESaIwEE6insertEjjw"; - case 0x79ad3575: return "_ZTv0_n12_NSoD1Ev"; - case 0x7a180518: return "_ZNSt10money_baseD0Ev"; - case 0x7b1db41e: return "_ZNSt6locale7_AddfacEPNS_5facetEjj"; - case 0x7b5fce95: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE6setbufEPwi"; - case 0x7c391411: return "_ZNSt10moneypunctIcLb0EED0Ev"; - case 0x7cdbda48: return "_ZNSt7collateIcED0Ev"; - case 0x7d23aa12: return "_ZNSt10moneypunctIwLb0EE7_GetcatEPPKNSt6locale5facetE"; - case 0x7da7fdb1: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewy"; - case 0x7e7ac30e: return "_ZNSt6locale5emptyEv"; - case 0x7ebad3f0: return "_ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE8_PutmfldES3_bRSt8ios_basewbSbIwS2_SaIwEE"; - case 0x7fe08910: return "_ZNSt10moneypunctIcLb0EE7_GetcatEPPKNSt6locale5facetE"; - case 0x7ff35597: return "_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE7_GetcatEPPKNSt6locale5facetE"; - case 0x8006c4ec: return "_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev"; - case 0x8044f596: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE5_LockEv"; - case 0x81027e75: return "_ZNSt7_MpunctIwE5_InitERKSt8_Locinfo"; - case 0x816aebc3: return "_ZNSt9bad_allocD0Ev"; - case 0x823759d3: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewl"; - case 0x8341b529: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE8overflowEi"; - case 0x83b2cc6f: return "_Znwj"; - case 0x83bca135: return "_ZNKSt11logic_error4whatEv"; - case 0x83cba890: return "_ZNSt6locale5facetD2Ev"; - case 0x84023c03: return "_ZSt12setprecisioni"; - case 0x854bc7c7: return "_ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEED0Ev"; - case 0x85b3c6da: return "_ZNKSt8_Locinfo7_GetcvtEv"; - case 0x85ba062f: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE7_UnlockEv"; - case 0x867956a4: return "_ZNSt9basic_iosIcSt11char_traitsIcEED1Ev"; - case 0x868531a3: return "_ZdaPvj"; - case 0x86c66cfc: return "_ZNSsD1Ev"; - case 0x871506ea: return "_ZNSbIwSt11char_traitsIwESaIwEE6assignERKS2_jj"; - case 0x8729f617: return "_ZNSt10ostrstreamC1EPciNSt5_IosbIiE9_OpenmodeE"; - case 0x87b1f5eb: return "_ZNSt9exceptionD0Ev"; - case 0x88052736: return "_ZTv0_n12_NSt10ostrstreamD0Ev"; - case 0x883e1f16: return "_ZNKSt11logic_error8_DoraiseEv"; - case 0x884b021b: return "_ZNKSt5ctypeIwE8_DowidenEc"; - case 0x8a665143: return "_ZNSt8_Locinfo8_AddcatsEiPKc"; - case 0x8a85d688: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewx"; - case 0x8bfd4395: return "_ZNSt9basic_iosIwSt11char_traitsIwEE4initEPSt15basic_streambufIwS1_Eb"; - case 0x8c2e6d06: return "_ZNKSt8messagesIwE7do_openERKSsRKSt6locale"; - case 0x8c3afd4c: return "_ZSt10unexpectedv"; - case 0x8c6b8d39: return "_ZNSt13basic_filebufIcSt11char_traitsIcEED1Ev"; - case 0x8cda1f3b: return "_ZSt10_GetloctxtIcSt19istreambuf_iteratorIcSt11char_traitsIcEEEiRT0_S5_jPKT_"; - case 0x8d4e266b: return "_ZNKSt8_Locinfo9_GetctypeEv"; - case 0x8fa764f3: return "_ZNSt6_WinitC1Ev"; - case 0x900d1fa4: return "_ZNSt8time_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev"; - case 0x903afa37: return "_ZTv0_n12_NSt13basic_ostreamIwSt11char_traitsIwEED0Ev"; - case 0x904dbd32: return "_ZNSt6locale7_LocimpC1Eb"; - case 0x9111ec36: return "_ZNSt13messages_baseD0Ev"; - case 0x91959ed6: return "_ZNKSt5ctypeIcE9do_narrowEcc"; - case 0x91b0e37e: return "_ZSt14set_unexpectedPFvvE"; - case 0x9268d6e7: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERj"; - case 0x928fbe36: return "_ZTv0_n12_NSdD1Ev"; - case 0x93c638e9: return "_ZNSt19istreambuf_iteratorIwSt11char_traitsIwEE5_PeekEv"; - case 0x94c49383: return "_ZdlPvS_"; - case 0x94fa1f5b: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE5uflowEv"; - case 0x95082493: return "_ZNKSt8messagesIcE6do_getEiiiRKSs"; - case 0x95b43c9d: return "_ZNSt6locale7_LocimpD2Ev"; - case 0x96634e42: return "_ZNKSt9bad_alloc4whatEv"; - case 0x96bc2578: return "_Znajj"; - case 0x97911f5f: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE5uflowEv"; - case 0x984ce3d7: return "_ZNSt8numpunctIcED1Ev"; - case 0x9891bf45: return "_ZNKSt7_MpunctIwE16do_thousands_sepEv"; - case 0x9a194306: return "_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE5_InitERKSt8_Locinfo"; - case 0x9a449047: return "_ZNSt7_MpunctIwEC2Ejb"; - case 0x9aa7a8b3: return "_ZNSt10istrstreamD2Ev"; - case 0x9afa5d71: return "_ZNSt10money_baseD2Ev"; - case 0x9b5358f9: return "_ZNKSt7_MpunctIcE16do_positive_signEv"; - case 0x9c40d1f9: return "_ZNKSt8numpunctIwE16do_decimal_pointEv"; - case 0x9c486668: return "_ZNSt6locale7_Locimp9_MakexlocERKSt8_LocinfoiPS0_PKS_"; - case 0x9cb73ee0: return "_ZSt6_ThrowRKSt9exception"; - case 0x9cfc0eaf: return "_ZNSiD1Ev"; - case 0x9d6a8167: return "_ZNSbIwSt11char_traitsIwESaIwEE5eraseEjj"; - case 0x9dbbe07d: return "_ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE8_GetmfldERS3_S5_bRSt8ios_base"; - case 0x9dc040e4: return "_Deletegloballocale"; - case 0x9dcb4bcb: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14do_get_weekdayES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; - case 0x9e741d47: return "_ZNSsC1ERKSs"; - case 0x9ec88ae6: return "_ZNKSt5ctypeIwE10do_tolowerEPwPKw"; - case 0x9ef60bf3: return "_ZNKSt5ctypeIwE10do_tolowerEw"; - case 0x9f528cd3: return "_ZNKSt7codecvtIccSt9_MbstatetE6do_outERS0_PKcS4_RS4_PcS6_RS6_"; - case 0x9f959451: return "_ZNSt13basic_istreamIwSt11char_traitsIwEED1Ev"; - case 0x9facb533: return "_ZNSt13messages_baseD1Ev"; - case 0x9fd2eea9: return "_ZNSt8_LocinfoC2EiPKc"; - case 0xa1c6fc55: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE7_UnlockEv"; - case 0xa1de25c2: return "_ZTv0_n12_NSt10ostrstreamD1Ev"; - case 0xa22d5dda: return "_ZNSt8messagesIcED0Ev"; - case 0xa2fd0ec5: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE9pbackfailEi"; - case 0xa35033e8: return "_ZNKSt5ctypeIwE8do_widenEPKcS2_Pw"; - case 0xa37c3e51: return "_ZNKSt5ctypeIwE8do_widenEc"; - case 0xa3f5c3b2: return "_ZNSt9strstreamD2Ev"; - case 0xa433147a: return "_ZNSt8messagesIcE7_GetcatEPPKNSt6locale5facetE"; - case 0xa464c70a: return "_ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_bRSt8ios_basewRKSbIwS2_SaIwEE"; - case 0xa4f6a919: return "_ZThn8_NSdD1Ev"; - case 0xa5306edb: return "_ZNSt10moneypunctIwLb1EED1Ev"; - case 0xa562099c: return "_ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEED1Ev"; - case 0xa700bc7d: return "_ZNKSt7codecvtIwcSt9_MbstatetE6do_outERS0_PKwS4_RS4_PcS6_RS6_"; - case 0xa74e5a27: return "_ZNKSt6localeeqERKS_"; - case 0xa79c4516: return "_ZNSt15basic_streambufIcSt11char_traitsIcEED0Ev"; - case 0xa8ece2e0: return "_ZSt9use_facetISt10moneypunctIwLb0EEERKT_RKSt6locale"; - case 0xa8f64fdb: return "_ZNKSt5ctypeIcE10do_tolowerEPcPKc"; - case 0xa90c4ff2: return "_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE7_GetcatEPPKNSt6locale5facetE"; - case 0xa9116516: return "_ZNSs6appendEjc"; - case 0xa94be0fa: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE9_EndwriteEv"; - case 0xa957adcc: return "_ZNKSt5ctypeIcE9do_narrowEPKcS2_cPc"; - case 0xa9e5bb16: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERm"; - case 0xaa520d9f: return "_ZNSt6locale7_Locimp7_AddfacEPNS_5facetEj"; - case 0xaae64804: return "_ZNSt8ios_base8_FindarrEi"; - case 0xab211d97: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecb"; - case 0xab5832fd: return "_ZNSt10money_baseD1Ev"; - case 0xabd92bcc: return "_ZNSt7collateIwE7_GetcatEPPKNSt6locale5facetE"; - case 0xabdc2b49: return "_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetE"; - case 0xac6c23c0: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERy"; - case 0xad3777a2: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE8overflowEi"; - case 0xad382a99: return "_ZdlPvRKSt9nothrow_t"; - case 0xad6d839f: return "_ZNSt12codecvt_baseD0Ev"; - case 0xad6dbac2: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERm"; - case 0xadc2263b: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE6xsputnEPKci"; - case 0xae7d042f: return "_ZNSt7codecvtIwcSt9_MbstatetE7_GetcatEPPKNSt6locale5facetE"; - case 0xaea59ceb: return "_ZNSt10ctype_baseD0Ev"; - case 0xb0c185b7: return "_ZNSt10moneypunctIcLb1EE7_GetcatEPPKNSt6locale5facetE"; - case 0xb0e7c2f3: return "_ZNSiD0Ev"; - case 0xb1550b3c: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecx"; - case 0xb1ac1fa3: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE6xsgetnEPwi"; - case 0xb1d696f7: return "_ZNKSt8numpunctIcE12do_falsenameEv"; - case 0xb326f699: return "_ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_bRSt8ios_basece"; - case 0xb33ef042: return "_ZNSt8bad_castD0Ev"; - case 0xb3f05af3: return "_ZNKSt7collateIcE12do_transformEPKcS2_"; - case 0xb4352488: return "_ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_bRSt8ios_basecRKSs"; - case 0xb4a8791f: return "_ZNSt8time_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev"; - case 0xb509ab64: return "_ZNSt10moneypunctIcLb1EED1Ev"; - case 0xb53fa02e: return "_ZnwjjRKSt9nothrow_t"; - case 0xb6a4d760: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE7seekposESt4fposISt9_MbstatetENSt5_IosbIiE9_OpenmodeE"; - case 0xb6a7ba7a: return "_ZNSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEED0Ev"; - case 0xb74f7b8f: return "_ZNSt6locale7_LocimpC2ERKS0_"; - case 0xb7dcbfdd: return "__Setgloballocale"; - case 0xb80ca215: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE5imbueERKSt6locale"; - case 0xb87c4b43: return "_ZNSt12strstreambuf6freezeEb"; - case 0xb8836b50: return "_ZNSt9exception18_Set_raise_handlerEPFvRKS_E"; - case 0xb8ec13a5: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewb"; - case 0xb9a2282d: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE8overflowEi"; - case 0xba0b6300: return "_ZNSt9basic_iosIwSt11char_traitsIwEED1Ev"; - case 0xba85ce08: return "_ZNSt12strstreambufD2Ev"; - case 0xbaa15803: return "_ZSt4setwi"; - case 0xbb4599c5: return "_ZNSt11logic_errorD1Ev"; - case 0xbb712718: return "_ZnwjRKSt9nothrow_t"; - case 0xbc5ad91c: return "_ZNKSt7collateIwE10do_compareEPKwS2_S2_S2_"; - case 0xbd140e12: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE11do_get_timeES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; - case 0xbd316983: return "_ZNSt8numpunctIcE5_InitERKSt8_Locinfo"; - case 0xbd35830b: return "_ZdaPvjS_"; - case 0xbd58ea5a: return "_ZNSt19ostreambuf_iteratorIwSt11char_traitsIwEEaSEw"; - case 0xbda26024: return "_ZNSt9strstreamD0Ev"; - case 0xbf9c3609: return "_ZNKSt5ctypeIwE10do_toupperEPwPKw"; - case 0xc013acd8: return "_ZNSt8ios_base8_CallfnsENS_5eventE"; - case 0xc06a4cd8: return "_ZNSt7_MpunctIwED1Ev"; - case 0xc22cebd8: return "_ZNSt8messagesIwED1Ev"; - case 0xc3d24eb3: return "_ZNSt9basic_iosIwSt11char_traitsIwEED0Ev"; - case 0xc41d676d: return "_ZNSt9time_baseD2Ev"; - case 0xc4c7993b: return "_ZNSbIwSt11char_traitsIwESaIwEE5_TidyEbj"; - case 0xc53ab1c0: return "_ZNSt8numpunctIwE5_InitERKSt8_Locinfo"; - case 0xc5977986: return "_ZNSt8ios_base7_AddstdEv"; - case 0xc612a38e: return "_ZNSt6_WinitD1Ev"; - case 0xc6e09225: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE5_InitEPSt6_FiletNS2_7_InitflE"; - case 0xc6ea0fd0: return "_ZNSt6locale7classicEv"; - case 0xc6f18e84: return "_ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_bRSt8ios_baseRNSt5_IosbIiE8_IostateERSbIwS2_SaIwEE"; - case 0xc79278ec: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE5imbueERKSt6locale"; - case 0xc7931798: return "_ZNKSt12_String_base5_XranEv"; - case 0xc7d0ee0c: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE16do_get_monthnameES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; - case 0xc862f7c8: return "_ZNSt12strstreambuf8overflowEi"; - case 0xcac83a05: return "_ZNSt6locale7_LocimpC2Eb"; - case 0xcb7d00a4: return "_ZNSt6_WinitD2Ev"; - case 0xcb82e0dc: return "_ZSt13set_terminatePFvvE"; - case 0xcbe74ad3: return "_ZNKSt8messagesIwE8do_closeEi"; - case 0xcc79f55d: return "_ZNKSt7_MpunctIcE16do_negative_signEv"; - case 0xccf14bd5: return "_ZNSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetE"; - case 0xcd33ed4f: return "_ZNSbIwSt11char_traitsIwESaIwEEC1Ev"; - case 0xcdafdf19: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE9showmanycEv"; - case 0xce653b6c: return "_ZNSt6_MutexC2Ev"; - case 0xce6705c3: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE8_GetifldEPcRS3_S6_NSt5_IosbIiE9_FmtflagsERKSt6locale"; - case 0xce8c6abc: return "_ZNSt8ios_base4InitC2Ev"; - case 0xcf9b4d80: return "_ZNSt10moneypunctIwLb1EED0Ev"; - case 0xd05ea37c: return "_ZNKSt19istreambuf_iteratorIwSt11char_traitsIwEEdeEv"; - case 0xd1b043b7: return "_ZSt10_MaklocchrIwET_cPS0_RKSt7_Cvtvec"; - case 0xd1ee6195: return "_ZNKSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecPKSt2tmcc"; - case 0xd2f9d93d: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewe"; - case 0xd356aefd: return "_ZNSt6_Mutex7_UnlockEv"; - case 0xd38f4018: return "_ZSt11_MaklocbyteIwEcT_RKSt7_Cvtvec"; - case 0xd4838fbd: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewm"; - case 0xd4ba5b31: return "_ZNSt8_LocinfoC2EPKc"; - case 0xd5244a29: return "_ZNSt10moneypunctIwLb1EE7_GetcatEPPKNSt6locale5facetE"; - case 0xd5c5ee3d: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERj"; - case 0xd6ee1090: return "_ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_bRSt8ios_baseRNSt5_IosbIiE8_IostateERe"; - case 0xd73321ed: return "_ZNSt10ostrstreamD1Ev"; - case 0xd76b2e07: return "_ZNKSt7codecvtIwcSt9_MbstatetE13do_max_lengthEv"; - case 0xd78efcc3: return "_ZNSt12strstreambuf9underflowEv"; - case 0xd7bc220d: return "_ZNSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEED1Ev"; - case 0xd7d92e51: return "_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEED0Ev"; - case 0xd830252c: return "_ZNSt12strstreambuf5_InitEiPcS0_i"; - case 0xd84b3689: return "_ZdlPv"; - case 0xd8aeb94a: return "_ZNSt8messagesIcED1Ev"; - case 0xd8b23008: return "_ZNSt8ios_baseD2Ev"; - case 0xd93d52b1: return "_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev"; - case 0xd9a12c5e: return "_ZNKSt5ctypeIcE10do_toupperEPcPKc"; - case 0xd9d8af82: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE8overflowEi"; - case 0xda1088ce: return "_ZNSt6locale5facet7_IncrefEv"; - case 0xda1b159a: return "_ZNSt6_MutexD2Ev"; - case 0xda5469b3: return "_ZNSt9time_baseD0Ev"; - case 0xdab0a910: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE9pbackfailEi"; - case 0xdaf3996f: return "_ZNSt6locale6globalERKS_"; - case 0xdb5eae26: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE5_InitEPSt6_FiletNS2_7_InitflE"; - case 0xdc0c889c: return "_ZNSt8ios_base7copyfmtERKS_"; - case 0xdc4d7540: return "_ZNSt5ctypeIwED1Ev"; - case 0xdc65ab00: return "_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEED1Ev"; - case 0xdc981b5f: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE9underflowEv"; - case 0xdd8b1d47: return "_ZNSs5eraseEjj"; - case 0xdefe3230: return "_ZNSt8ios_baseD1Ev"; - case 0xdf1e09e1: return "_ZNKSt5ctypeIwE9do_narrowEPKwS2_cPc"; - case 0xdf7edb4d: return "_ZSt9use_facetISt10moneypunctIwLb1EEERKT_RKSt6locale"; - case 0xe177fd02: return "_ZNSt7_MpunctIcED2Ev"; - case 0xe196beab: return "_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEED0Ev"; - case 0xe206c08f: return "_ZNSt13basic_filebufIwSt11char_traitsIwEED0Ev"; - case 0xe2b2ac5a: return "_ZNSt6locale5facet9_RegisterEv"; - case 0xe3edd790: return "_ZNSt8bad_castD1Ev"; - case 0xe528a368: return "_ZNKSt7_MpunctIcE14do_curr_symbolEv"; - case 0xe54f1fe0: return "_ZNKSt9bad_alloc8_DoraiseEv"; - case 0xe5e1dcbc: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE5imbueERKSt6locale"; - case 0xe6547e35: return "_ZNSt8messagesIwED0Ev"; - case 0xe667985a: return "_ZNSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEED0Ev"; - case 0xe75f6e21: return "_ZNKSt12length_error8_DoraiseEv"; - case 0xe7d8449e: return "_ZdlPvjS_"; - case 0xe82a422d: return "_ZNKSt8numpunctIwE11do_truenameEv"; - case 0xe8691be5: return "_ZNSt5ctypeIwED0Ev"; - case 0xe8c15f8a: return "_ZNSt7_MpunctIwED2Ev"; - case 0xe9d7a4ae: return "_ZNKSt8time_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewPKSt2tmcc"; - case 0xeb76301c: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE9pbackfailEi"; - case 0xebd4b51d: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE11do_get_yearES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; - case 0xece969c0: return "_ZTv0_n12_NSt10istrstreamD0Ev"; - case 0xed3da02b: return "_Znwjj"; - case 0xee853baf: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE4syncEv"; - case 0xef62751c: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE13do_date_orderEv"; - case 0xef6f90d8: return "_ZNKSt5ctypeIwE11do_scan_notEsPKwS2_"; - case 0xef959a6d: return "_ZThn8_NSt9strstreamD0Ev"; - case 0xf001a741: return "_ZNSt12strstreambufD1Ev"; - case 0xf00401d2: return "_ZNSt9basic_iosIcSt11char_traitsIcEED0Ev"; - case 0xf01deff8: return "_ZNKSt7codecvtIwcSt9_MbstatetE5do_inERS0_PKcS4_RS4_PwS6_RS6_"; - case 0xf05df017: return "_ZNSt5ctypeIcE7_GetcatEPPKNSt6locale5facetE"; - case 0xf127e816: return "_ZNSt10istrstreamD1Ev"; - case 0xf1543f02: return "_ZNKSt8_Locinfo8_GetcollEv"; - case 0xf1c86c92: return "_ZNKSt12out_of_range8_DoraiseEv"; - case 0xf1cff87d: return "_ZNSt10ctype_baseD2Ev"; - case 0xf2b9ab86: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERf"; - case 0xf30d3407: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewd"; - case 0xf51dc289: return "_ZNSt7codecvtIccSt9_MbstatetED1Ev"; - case 0xf53021e0: return "_ZNSt8bad_castC1Ev"; - case 0xf5825c7d: return "_ZNSt7collateIwED1Ev"; - case 0xf584de56: return "_ZNSt6locale7_Locimp8_MakelocERKSt8_LocinfoiPS0_PKS_"; - case 0xf58e83a5: return "_Znaj"; - case 0xf67a7e17: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE5uflowEv"; - case 0xf73f6afc: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE7seekoffElNSt5_IosbIiE8_SeekdirENS4_9_OpenmodeE"; - case 0xf7845d1c: return "_ZNSt7_MpunctIcED1Ev"; - case 0xf7ba51fd: return "_ZNSt13basic_ostreamIwSt11char_traitsIwEED0Ev"; - case 0xf83e8d95: return "_ZNKSt5ctypeIcE10do_tolowerEc"; - case 0xf9ff46a1: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE7seekoffElNSt5_IosbIiE8_SeekdirENS4_9_OpenmodeE"; - case 0xfb36c588: return "_ZNSt9strstreamC1EPciNSt5_IosbIiE9_OpenmodeE"; - case 0xfc563813: return "_ZNKSt7codecvtIccSt9_MbstatetE5do_inERS0_PKcS4_RS4_PcS6_RS6_"; - case 0xfc825dda: return "_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetE"; - case 0xfe468b7a: return "_ZTv0_n12_NSdD0Ev"; - case 0xfeb4107c: return "_ZNSt12codecvt_baseD2Ev"; - case 0xfefd7d3a: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERy"; - case 0xffaf3218: return "_ZTv0_n12_NSoD0Ev"; - case 0xfff6ef55: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERb"; - } + if (_module == "sys_libstdcxx") + switch (fnid) + { + case 0x002c338b: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE16do_get_monthnameES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; + case 0x002e18d8: return "_ZNSt6locale7_LocimpD0Ev"; + case 0x0091a3fd: return "_ZNKSt6locale9_GetfacetEj"; + case 0x00c3975e: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE5_LockEv"; + case 0x00cf44f7: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecl"; + case 0x01409785: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE7_GetintERS3_S5_iiRi"; + case 0x01aa0cef: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERx"; + case 0x01c4ef01: return "_ZNSt6localeC2ERKS_S1_i"; + case 0x01d9b3f5: return "_ZNSt6localeC1EPKci"; + case 0x01f81190: return "_ZNSt12codecvt_baseD1Ev"; + case 0x020b22f3: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewPKv"; + case 0x02e40598: return "_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE5_InitERKSt8_Locinfo"; + case 0x03217f6f: return "_ZNSt19istreambuf_iteratorIcSt11char_traitsIcEE5_PeekEv"; + case 0x0339259c: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecPKv"; + case 0x033c18f4: return "_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEED1Ev"; + case 0x03cca12f: return "_ZNSt6localeC1ERKS_PKci"; + case 0x040c18ff: return "_ZNKSt7_MpunctIwE16do_decimal_pointEv"; + case 0x045e124a: return "_ZdaPv"; + case 0x0490855d: return "_ZNSt8numpunctIwE7_GetcatEPPKNSt6locale5facetE"; + case 0x055c1462: return "_ZNSt15basic_streambufIcSt11char_traitsIcEED1Ev"; + case 0x05903101: return "_ZNKSt7collateIcE7do_hashEPKcS2_"; + case 0x05a9cef6: return "_ZNSt7_MpunctIcE5_InitERKSt8_Locinfo"; + case 0x05ec37c8: return "_ZSt10_MaklocstrIwEPT_PKcS1_RKSt7_Cvtvec"; + case 0x06bc5b51: return "_ZNKSt7_MpunctIwE16do_positive_signEv"; + case 0x07a3bd16: return "_ZNSt6locale7_LocimpD1Ev"; + case 0x07b6c924: return "_ZTv0_n12_NSt13basic_ostreamIwSt11char_traitsIwEED1Ev"; + case 0x085bff4f: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE5_LockEv"; + case 0x08e1865c: return "_ZNKSt8numpunctIwE16do_thousands_sepEv"; + case 0x09e73a2a: return "_ZNKSt7codecvtIwcSt9_MbstatetE11do_encodingEv"; + case 0x0ba5483c: return "_ZNKSt12codecvt_base11do_encodingEv"; + case 0x0bc08c57: return "_ZNKSt7collateIwE7do_hashEPKwS2_"; + case 0x0bcc1910: return "_ZNSt10ostrstreamD2Ev"; + case 0x0d4290d2: return "_ZNSt12length_errorD0Ev"; + case 0x0d644dca: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE11do_get_dateES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; + case 0x0e147a9d: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE9pbackfailEi"; + case 0x0e744ef5: return "_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEED1Ev"; + case 0x0e9698af: return "_ZNSt7codecvtIwcSt9_MbstatetED1Ev"; + case 0x0e9a5554: return "_ZNSt13basic_istreamIwSt11char_traitsIwEED0Ev"; + case 0x0f930fdd: return "_ZNSt13messages_baseD2Ev"; + case 0x0ff264b9: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE4syncEv"; + case 0x10231873: return "_ZNSt13runtime_errorD1Ev"; + case 0x10dc3f6c: return "_ZNSbIwSt11char_traitsIwESaIwEE6appendEjw"; + case 0x113a515f: return "_ZNKSt8messagesIcE7do_openERKSsRKSt6locale"; + case 0x114e9178: return "_ZNSt11logic_errorD0Ev"; + case 0x128cd621: return "_ZNKSt5ctypeIwE10do_scan_isEsPKwS2_"; + case 0x12de5772: return "_ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_bRSt8ios_baseRNSt5_IosbIiE8_IostateERSs"; + case 0x1374b8c8: return "_ZNSt10moneypunctIcLb0EED1Ev"; + case 0x143048bf: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE7seekoffElNSt5_IosbIiE8_SeekdirENS4_9_OpenmodeE"; + case 0x1474ac53: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERt"; + case 0x14e3faa5: return "_ZNKSt5ctypeIwE9do_narrowEwc"; + case 0x1527fe95: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE4syncEv"; + case 0x1692ae0c: return "_ZNSt6localeD1Ev"; + case 0x16df5ecb: return "_ZNKSt12codecvt_base16do_always_noconvEv"; + case 0x17dd0a4e: return "_ZNKSt7_MpunctIwE16do_negative_signEv"; + case 0x18628537: return "_ZNKSt8numpunctIcE16do_decimal_pointEv"; + case 0x186bcc94: return "_ZNSt8ios_base4InitD1Ev"; + case 0x18a38254: return "_ZNSt10ctype_baseD1Ev"; + case 0x197fc348: return "_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev"; + case 0x1989f59c: return "_ZNSt8ios_base17register_callbackEPFvNS_5eventERS_iEi"; + case 0x19c901ce: return "_ZTv0_n12_NSt9strstreamD0Ev"; + case 0x1a00f889: return "_ZNSt9exceptionD2Ev"; + case 0x1a4f2fa6: return "_ZNSt8ios_base7failureD0Ev"; + case 0x1a7f963c: return "_ZNKSt8numpunctIcE11do_truenameEv"; + case 0x1b266c3d: return "_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE7_GetcatEPPKNSt6locale5facetE"; + case 0x1b6a7482: return "_ZNKSt7_MpunctIwE13do_neg_formatEv"; + case 0x1b6ad260: return "_ZSt13resetiosflagsNSt5_IosbIiE9_FmtflagsE"; + case 0x1b9b3b5c: return "_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEED0Ev"; + case 0x1bccd2ca: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE7_GetintERS3_S5_iiRi"; + case 0x1c3f1c4f: return "_ZNSt6_MutexD1Ev"; + case 0x1c8083c5: return "_ZNSt12strstreambufD0Ev"; + case 0x1c8405dc: return "_ZNSt7_MpunctIcEC2Ejb"; + case 0x1cf6785d: return "_ZSt9use_facetISt5ctypeIwEERKT_RKSt6locale"; + case 0x1d43fb44: return "_ZSt9use_facetISt8numpunctIwEERKT_RKSt6locale"; + case 0x1ee13e83: return "_ZNSt6locale5facetD0Ev"; + case 0x1f2e9f4e: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE9underflowEv"; + case 0x1f3a9ada: return "_ZNSt12strstreambuf7seekposESt4fposISt9_MbstatetENSt5_IosbIiE9_OpenmodeE"; + case 0x2070a73d: return "_ZNSt6locale7_LocimpC1ERKS0_"; + case 0x207b56fa: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE8_GetffldEPcRS3_S6_RKSt6locale"; + case 0x20a02b6d: return "_ZNSt6locale2idcvjEv"; + case 0x20f7e066: return "_ZNSt10moneypunctIwLb0EED0Ev"; + case 0x21659e45: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE5_FputES3_RSt8ios_basecPKcjjjj"; + case 0x22777290: return "_ZNSs7replaceEjjPKcj"; + case 0x229a0963: return "_ZNKSt5ctypeIwE5do_isEsw"; + case 0x2354ec0a: return "_ZNKSt7codecvtIwcSt9_MbstatetE10do_unshiftERS0_PcS3_RS3_"; + case 0x2356ef16: return "_ZnajRKSt9nothrow_t"; + case 0x23a87483: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE11do_get_timeES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; + case 0x23ef7642: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE8_GetifldEPcRS3_S6_NSt5_IosbIiE9_FmtflagsERKSt6locale"; + case 0x258359df: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basece"; + case 0x2670b433: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE8_GetffldEPcRS3_S6_RKSt6locale"; + case 0x268c3ea5: return "_ZNKSt7_MpunctIwE13do_pos_formatEv"; + case 0x26e8e1cf: return "_ZNKSt5ctypeIwE5do_isEPKwS2_Ps"; + case 0x273be056: return "_ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE8_PutmfldES3_bRSt8ios_basecbSs"; + case 0x281f9107: return "_ZTv0_n12_NSiD1Ev"; + case 0x294779fb: return "_ZNSt8ios_base4InitD2Ev"; + case 0x2954d64d: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE9underflowEv"; + case 0x29c11f46: return "_ZNKSt7codecvtIccSt9_MbstatetE9do_lengthERKS0_PKcS5_j"; + case 0x29c90b94: return "_ZNKSt8numpunctIcE16do_thousands_sepEv"; + case 0x2a16469d: return "_ZNSt8ios_base5imbueERKSt6locale"; + case 0x2ac890f4: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERb"; + case 0x2adccb1a: return "_ZNKSt7_MpunctIcE14do_frac_digitsEv"; + case 0x2af79bd6: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE5_IputES3_RSt8ios_basecPcj"; + case 0x2b05b95a: return "_ZNKSt7_MpunctIcE11do_groupingEv"; + case 0x2b88f26e: return "_ZNSt15basic_streambufIwSt11char_traitsIwEED0Ev"; + case 0x2c241d13: return "_ZnajjRKSt9nothrow_t"; + case 0x2c6ce396: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERd"; + case 0x2cf8ea50: return "_ZNKSt7codecvtIwcSt9_MbstatetE16do_always_noconvEv"; + case 0x2d489b47: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE9underflowEv"; + case 0x2d50650f: return "_ZSt9use_facetISt10moneypunctIcLb1EEERKT_RKSt6locale"; + case 0x2d8be7e8: return "_ZNKSt9exception6_RaiseEv"; + case 0x2daa5a42: return "_ZTv0_n12_NSt9strstreamD1Ev"; + case 0x2e2b80c8: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERPv"; + case 0x2e84ebb3: return "_ZNSt8_LocinfoC1EiPKc"; + case 0x2eb5c13a: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE4syncEv"; + case 0x2f29da90: return "_ZNSt12strstreambuf5_TidyEv"; + case 0x2ff8d101: return "_ZNSt6localeC1ERKS_S1_i"; + case 0x30195cf5: return "_ZNKSt8numpunctIcE11do_groupingEv"; + case 0x30ce43d4: return "_ZNSt8numpunctIcED0Ev"; + case 0x30e297ea: return "_ZNSt7_MpunctIcEC2ERKSt8_Locinfojb"; + case 0x316b7a34: return "_ZNSt9exceptionD1Ev"; + case 0x31a81476: return "_ZdlPvj"; + case 0x31b3e5cc: return "_ZNSs5_TidyEbj"; + case 0x3286b855: return "_ZNSt8time_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetE"; + case 0x332f8409: return "_ZNSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE7_GetcatEPPKNSt6locale5facetE"; + case 0x336e904e: return "_ZNSdD0Ev"; + case 0x33e04d8e: return "_ZNKSt7collateIwE12do_transformEPKwS2_"; + case 0x34b63588: return "_ZNKSt5ctypeIwE9_DonarrowEwc"; + case 0x34edd72b: return "_ZNSt10moneypunctIwLb0EED1Ev"; + case 0x360f8a4f: return "_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEED1Ev"; + case 0x3697bbd3: return "_ZNSt8ios_base5_InitEv"; + case 0x36e7826a: return "_ZNSt7collateIcED1Ev"; + case 0x3783acfa: return "_ZTv0_n12_NSt13basic_istreamIwSt11char_traitsIwEED1Ev"; + case 0x38783beb: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE11do_get_yearES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; + case 0x3933645f: return "_ZNKSt7_MpunctIwE14do_frac_digitsEv"; + case 0x3937f2f8: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecm"; + case 0x39775ce9: return "_ZNSt11logic_errorD2Ev"; + case 0x3ad12959: return "_ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_Eb"; + case 0x3bac19dc: return "_ZThn8_NSdD0Ev"; + case 0x3bda45a7: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecy"; + case 0x3d32a7f4: return "_ZNSt6localeC2EPKci"; + case 0x3da21a90: return "_ZNSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEED1Ev"; + case 0x3e18602a: return "_ZNKSt12codecvt_base13do_max_lengthEv"; + case 0x3eeb7167: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE7_UnlockEv"; + case 0x3f6a6e68: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE9_EndwriteEv"; + case 0x3f9cb259: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERl"; + case 0x3fc2324d: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecd"; + case 0x409409af: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE6setbufEPci"; + case 0x411b923e: return "_ZSt9use_facetISt8numpunctIcEERKT_RKSt6locale"; + case 0x4148e091: return "_ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE8_GetmfldERS3_S5_bRSt8ios_base"; + case 0x417f47af: return "_ZSt9use_facetISt10moneypunctIcLb0EEERKT_RKSt6locale"; + case 0x42c40b2f: return "_ZNSt12out_of_rangeD0Ev"; + case 0x45010630: return "_ZNSt10moneypunctIcLb1EED0Ev"; + case 0x4520d6a2: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE5_LockEv"; + case 0x46034d2e: return "_ZNSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEED0Ev"; + case 0x460e5cb7: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE7seekposESt4fposISt9_MbstatetENSt5_IosbIiE9_OpenmodeE"; + case 0x4761783a: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE5imbueERKSt6locale"; + case 0x47aab531: return "_ZNSt7_MpunctIcED0Ev"; + case 0x47e5c318: return "_ZNSt8_LocinfoD2Ev"; + case 0x4827e6be: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERe"; + case 0x48d101ef: return "_ZNKSt8ios_base7failure8_DoraiseEv"; + case 0x493212da: return "_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEED0Ev"; + case 0x4952490e: return "_ZNSt8ios_base5clearENSt5_IosbIiE8_IostateEb"; + case 0x496c6f50: return "_Getctyptab"; + case 0x49d9ddaf: return "_ZNKSt8numpunctIwE12do_falsenameEv"; + case 0x49da8c5f: return "_ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_bRSt8ios_baseRNSt5_IosbIiE8_IostateERe"; + case 0x49f7d434: return "_ZNSt8numpunctIwED0Ev"; + case 0x4a40969d: return "_Fac_tidy"; + case 0x4a799510: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERl"; + case 0x4aec14d5: return "_ZNSt12length_errorD1Ev"; + case 0x4aff73cc: return "_ZSt14_Debug_messagePKcS0_"; + case 0x4b1ad744: return "_ZdaPvjRKSt9nothrow_t"; + case 0x4b5a8abc: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE6setbufEPwi"; + case 0x4bc193c7: return "_ZNSt10ostrstreamC2EPciNSt5_IosbIiE9_OpenmodeE"; + case 0x4bda379a: return "_ZNSt8ios_base4InitC1Ev"; + case 0x4bee7ba9: return "_ZNSt8ios_base7failureD1Ev"; + case 0x4cb35e7d: return "_ZNSt9time_baseD1Ev"; + case 0x4cdab0ba: return "_ZNSt7_MpunctIwED0Ev"; + case 0x4daf3fcf: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE6xsgetnEPci"; + case 0x4e34cf83: return "_ZNSbIwSt11char_traitsIwESaIwEE5_GrowEjb"; + case 0x4e5cd916: return "_ZNKSt8numpunctIwE11do_groupingEv"; + case 0x4ec89bf8: return "_ZNSt7collateIcE7_GetcatEPPKNSt6locale5facetE"; + case 0x4ef0eb8e: return "_ZNSt12strstreambuf7seekoffElNSt5_IosbIiE8_SeekdirENS1_9_OpenmodeE"; + case 0x4fde96de: return "_ZNSt15basic_streambufIwSt11char_traitsIwEED1Ev"; + case 0x5015b8d3: return "_ZSt7_FiopenPKwNSt5_IosbIiE9_OpenmodeEi"; + case 0x50b34c09: return "_ZNKSt9exception4whatEv"; + case 0x5102ac61: return "_ZNKSt7_MpunctIwE14do_curr_symbolEv"; + case 0x5119680b: return "_ZNSt8_LocinfoD1Ev"; + case 0x5127dcd1: return "_ZNSsC1Ev"; + case 0x522b0457: return "_ZNSt10istrstreamD0Ev"; + case 0x52330fbd: return "_ZNSt13runtime_errorD0Ev"; + case 0x5298ef8e: return "_ZdaPvRKSt9nothrow_t"; + case 0x5333bdc9: return "_ZNKSt13runtime_error4whatEv"; + case 0x53693d40: return "_ZSt11setiosflagsNSt5_IosbIiE9_FmtflagsE"; + case 0x5438d7d8: return "_ZdaPvS_"; + case 0x550255f7: return "_ZNKSt7codecvtIccSt9_MbstatetE10do_unshiftERS0_PcS3_RS3_"; + case 0x55481e6f: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE9showmanycEv"; + case 0x5560c79e: return "_ZNSdD1Ev"; + case 0x55b3ebf2: return "_ZNSt9strstreamC2EPciNSt5_IosbIiE9_OpenmodeE"; + case 0x563fd2be: return "_ZNSt6localeC2ERKS_PKci"; + case 0x5656ccff: return "_ZNKSt7collateIcE10do_compareEPKcS2_S2_S2_"; + case 0x56d3d4f0: return "_ZNSt9bad_allocD1Ev"; + case 0x56fac416: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERe"; + case 0x577c2695: return "_ZNSt6_Mutex5_LockEv"; + case 0x57ef52f0: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE7_UnlockEv"; + case 0x581fc95b: return "_ZNSt5ctypeIcED0Ev"; + case 0x58fad1c1: return "_ZNSt5ctypeIwE7_GetcatEPPKNSt6locale5facetE"; + case 0x5949408e: return "_ZNSt8ios_base5_TidyEv"; + case 0x59c77266: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERd"; + case 0x5a3ad4bd: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERf"; + case 0x5a5a9107: return "_ZNSt6localeC2Ev"; + case 0x5a6e4e50: return "_ZNSt6locale7_Locimp9_MakewlocERKSt8_LocinfoiPS0_PKS_"; + case 0x5a898327: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE7seekoffElNSt5_IosbIiE8_SeekdirENS4_9_OpenmodeE"; + case 0x5adf9060: return "_ZNKSt5ctypeIcE8do_widenEPKcS2_Pc"; + case 0x5b71b85d: return "_ZNSt19istreambuf_iteratorIwSt11char_traitsIwEE4_IncEv"; + case 0x5c15972f: return "_ZNSt13basic_ostreamIwSt11char_traitsIwEED1Ev"; + case 0x5ca98e4a: return "_ZNSt13basic_filebufIcSt11char_traitsIcEED0Ev"; + case 0x5e1f2d37: return "_ZNKSt9exception8_DoraiseEv"; + case 0x5e55ab8c: return "_ZSt10_GetloctxtIwSt19istreambuf_iteratorIwSt11char_traitsIwEEEiRT0_S5_jPKT_"; + case 0x5ed4fb7a: return "_ZTv0_n12_NSt13basic_istreamIwSt11char_traitsIwEED0Ev"; + case 0x604fec95: return "_ZNSt12out_of_rangeD1Ev"; + case 0x605131d5: return "_ZNSt8_LocinfoC1EPKc"; + case 0x6051c802: return "_ZNSt7codecvtIccSt9_MbstatetED0Ev"; + case 0x608abbb5: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE5uflowEv"; + case 0x61119152: return "_ZNSt6locale5_InitEv"; + case 0x61248c80: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE13do_date_orderEv"; + case 0x61a23009: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE5_FputES3_RSt8ios_basewPKcjjjj"; + case 0x61f55c30: return "_ZNKSt5ctypeIcE8do_widenEc"; + case 0x629b8531: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE5_IputES3_RSt8ios_basewPcj"; + case 0x62d6bf82: return "_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEED1Ev"; + case 0x62f52bb0: return "_ZNSt7_MpunctIwEC2ERKSt8_Locinfojb"; + case 0x635166c3: return "_ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_bRSt8ios_basewe"; + case 0x63a2b2cc: return "_ZNKSt8messagesIcE8do_closeEi"; + case 0x643235cf: return "_ZNSt9strstreamD1Ev"; + case 0x6437a975: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERt"; + case 0x643e67f4: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERPv"; + case 0x6463d9ea: return "_ZNKSt8messagesIwE6do_getEiiiRKSbIwSt11char_traitsIwESaIwEE"; + case 0x64ce0374: return "_ZNSbIwSt11char_traitsIwESaIwEE7replaceEjjPKwj"; + case 0x64ed868e: return "_ZSt9terminatev"; + case 0x6500d2d5: return "_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetE"; + case 0x65f19631: return "_ZTv0_n12_NSiD0Ev"; + case 0x660882e8: return "_ZNSt6localeC1Ev"; + case 0x667d741b: return "_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev"; + case 0x668b31c6: return "_ZNSs5_GrowEjb"; + case 0x66f39adb: return "_ZNSt8numpunctIwED1Ev"; + case 0x66fcc6f4: return "_ZNSt8messagesIwE7_GetcatEPPKNSt6locale5facetE"; + case 0x67948307: return "_ZNKSt7codecvtIwcSt9_MbstatetE9do_lengthERKS0_PKcS5_j"; + case 0x67c09257: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERx"; + case 0x67edde2f: return "_ZdlPvjRKSt9nothrow_t"; + case 0x67fbabf0: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14do_get_weekdayES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; + case 0x683ca70a: return "_ZNKSt12_String_base5_XlenEv"; + case 0x6863452e: return "_ZNSt6locale5facetD1Ev"; + case 0x6929318d: return "_ZNSs6assignERKSsjj"; + case 0x696b47f2: return "_ZNKSt7_MpunctIcE13do_neg_formatEv"; + case 0x6a6b90c9: return "_ZSt15set_new_handlerPFvvE"; + case 0x6adc320a: return "_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEED0Ev"; + case 0x6b493669: return "_ZSt7setbasei"; + case 0x6b913d53: return "_ZNSs6insertEjjc"; + case 0x6c19db26: return "_ZNKSt7_MpunctIcE16do_thousands_sepEv"; + case 0x6c386f54: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE7seekposESt4fposISt9_MbstatetENSt5_IosbIiE9_OpenmodeE"; + case 0x6c8dc459: return "_ZNKSt8bad_cast4whatEv"; + case 0x6cb1a335: return "_ZNSt6locale5facet7_DecrefEv"; + case 0x6d483b7a: return "_ZNSt12strstreambuf9pbackfailEi"; + case 0x6daed882: return "_ZNSt8ios_baseD0Ev"; + case 0x6dbbb9de: return "_ZNKSt5ctypeIcE10do_toupperEc"; + case 0x6e0bf85d: return "_ZTv0_n12_NSt10istrstreamD1Ev"; + case 0x6e4a84c1: return "_ZNSt5ctypeIcED1Ev"; + case 0x6e61426d: return "_ZNSt13basic_filebufIwSt11char_traitsIwEED1Ev"; + case 0x6f1945fc: return "_ZNSoD1Ev"; + case 0x6fe060a0: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE7seekposESt4fposISt9_MbstatetENSt5_IosbIiE9_OpenmodeE"; + case 0x7008e209: return "_ZNKSt5ctypeIwE10do_toupperEw"; + case 0x708cf940: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE11do_get_dateES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; + case 0x709ab035: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE6setbufEPci"; + case 0x7142ad20: return "_ZNKSt7_MpunctIcE16do_decimal_pointEv"; + case 0x718977c5: return "_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetE"; + case 0x736c5f22: return "_ZNSoD0Ev"; + case 0x74a39b4f: return "_ZThn8_NSt9strstreamD1Ev"; + case 0x753c71db: return "_ZNKSt7_MpunctIcE13do_pos_formatEv"; + case 0x75824de0: return "_ZNSt6_MutexC1Ev"; + case 0x75975eb4: return "_ZNSsC1EPKc"; + case 0x75a0617c: return "_ZNKSt7_MpunctIwE11do_groupingEv"; + case 0x764ceaa4: return "_ZNSt10ostrstreamD0Ev"; + case 0x767a4e70: return "_ZNSt6_WinitC2Ev"; + case 0x76db6974: return "_ZNSt7codecvtIwcSt9_MbstatetED0Ev"; + case 0x76de9b0f: return "_ZNSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEED1Ev"; + case 0x76e846b2: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE6xsputnEPKwi"; + case 0x77c1d3a9: return "_ZNKSt13runtime_error8_DoraiseEv"; + case 0x7882e64e: return "_ZNSt7collateIwED0Ev"; + case 0x78a142d0: return "_ZSt7_FiopenPKcNSt5_IosbIiE9_OpenmodeEi"; + case 0x79a415f8: return "_ZNSbIwSt11char_traitsIwESaIwEE6insertEjjw"; + case 0x79ad3575: return "_ZTv0_n12_NSoD1Ev"; + case 0x7a180518: return "_ZNSt10money_baseD0Ev"; + case 0x7b1db41e: return "_ZNSt6locale7_AddfacEPNS_5facetEjj"; + case 0x7b5fce95: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE6setbufEPwi"; + case 0x7c391411: return "_ZNSt10moneypunctIcLb0EED0Ev"; + case 0x7cdbda48: return "_ZNSt7collateIcED0Ev"; + case 0x7d23aa12: return "_ZNSt10moneypunctIwLb0EE7_GetcatEPPKNSt6locale5facetE"; + case 0x7da7fdb1: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewy"; + case 0x7e7ac30e: return "_ZNSt6locale5emptyEv"; + case 0x7ebad3f0: return "_ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE8_PutmfldES3_bRSt8ios_basewbSbIwS2_SaIwEE"; + case 0x7fe08910: return "_ZNSt10moneypunctIcLb0EE7_GetcatEPPKNSt6locale5facetE"; + case 0x7ff35597: return "_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE7_GetcatEPPKNSt6locale5facetE"; + case 0x8006c4ec: return "_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev"; + case 0x8044f596: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE5_LockEv"; + case 0x81027e75: return "_ZNSt7_MpunctIwE5_InitERKSt8_Locinfo"; + case 0x816aebc3: return "_ZNSt9bad_allocD0Ev"; + case 0x823759d3: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewl"; + case 0x8341b529: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE8overflowEi"; + case 0x83b2cc6f: return "_Znwj"; + case 0x83bca135: return "_ZNKSt11logic_error4whatEv"; + case 0x83cba890: return "_ZNSt6locale5facetD2Ev"; + case 0x84023c03: return "_ZSt12setprecisioni"; + case 0x854bc7c7: return "_ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEED0Ev"; + case 0x85b3c6da: return "_ZNKSt8_Locinfo7_GetcvtEv"; + case 0x85ba062f: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE7_UnlockEv"; + case 0x867956a4: return "_ZNSt9basic_iosIcSt11char_traitsIcEED1Ev"; + case 0x868531a3: return "_ZdaPvj"; + case 0x86c66cfc: return "_ZNSsD1Ev"; + case 0x871506ea: return "_ZNSbIwSt11char_traitsIwESaIwEE6assignERKS2_jj"; + case 0x8729f617: return "_ZNSt10ostrstreamC1EPciNSt5_IosbIiE9_OpenmodeE"; + case 0x87b1f5eb: return "_ZNSt9exceptionD0Ev"; + case 0x88052736: return "_ZTv0_n12_NSt10ostrstreamD0Ev"; + case 0x883e1f16: return "_ZNKSt11logic_error8_DoraiseEv"; + case 0x884b021b: return "_ZNKSt5ctypeIwE8_DowidenEc"; + case 0x8a665143: return "_ZNSt8_Locinfo8_AddcatsEiPKc"; + case 0x8a85d688: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewx"; + case 0x8bfd4395: return "_ZNSt9basic_iosIwSt11char_traitsIwEE4initEPSt15basic_streambufIwS1_Eb"; + case 0x8c2e6d06: return "_ZNKSt8messagesIwE7do_openERKSsRKSt6locale"; + case 0x8c3afd4c: return "_ZSt10unexpectedv"; + case 0x8c6b8d39: return "_ZNSt13basic_filebufIcSt11char_traitsIcEED1Ev"; + case 0x8cda1f3b: return "_ZSt10_GetloctxtIcSt19istreambuf_iteratorIcSt11char_traitsIcEEEiRT0_S5_jPKT_"; + case 0x8d4e266b: return "_ZNKSt8_Locinfo9_GetctypeEv"; + case 0x8fa764f3: return "_ZNSt6_WinitC1Ev"; + case 0x900d1fa4: return "_ZNSt8time_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev"; + case 0x903afa37: return "_ZTv0_n12_NSt13basic_ostreamIwSt11char_traitsIwEED0Ev"; + case 0x904dbd32: return "_ZNSt6locale7_LocimpC1Eb"; + case 0x9111ec36: return "_ZNSt13messages_baseD0Ev"; + case 0x91959ed6: return "_ZNKSt5ctypeIcE9do_narrowEcc"; + case 0x91b0e37e: return "_ZSt14set_unexpectedPFvvE"; + case 0x9268d6e7: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERj"; + case 0x928fbe36: return "_ZTv0_n12_NSdD1Ev"; + case 0x93c638e9: return "_ZNSt19istreambuf_iteratorIwSt11char_traitsIwEE5_PeekEv"; + case 0x94c49383: return "_ZdlPvS_"; + case 0x94fa1f5b: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE5uflowEv"; + case 0x95082493: return "_ZNKSt8messagesIcE6do_getEiiiRKSs"; + case 0x95b43c9d: return "_ZNSt6locale7_LocimpD2Ev"; + case 0x96634e42: return "_ZNKSt9bad_alloc4whatEv"; + case 0x96bc2578: return "_Znajj"; + case 0x97911f5f: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE5uflowEv"; + case 0x984ce3d7: return "_ZNSt8numpunctIcED1Ev"; + case 0x9891bf45: return "_ZNKSt7_MpunctIwE16do_thousands_sepEv"; + case 0x9a194306: return "_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE5_InitERKSt8_Locinfo"; + case 0x9a449047: return "_ZNSt7_MpunctIwEC2Ejb"; + case 0x9aa7a8b3: return "_ZNSt10istrstreamD2Ev"; + case 0x9afa5d71: return "_ZNSt10money_baseD2Ev"; + case 0x9b5358f9: return "_ZNKSt7_MpunctIcE16do_positive_signEv"; + case 0x9c40d1f9: return "_ZNKSt8numpunctIwE16do_decimal_pointEv"; + case 0x9c486668: return "_ZNSt6locale7_Locimp9_MakexlocERKSt8_LocinfoiPS0_PKS_"; + case 0x9cb73ee0: return "_ZSt6_ThrowRKSt9exception"; + case 0x9cfc0eaf: return "_ZNSiD1Ev"; + case 0x9d6a8167: return "_ZNSbIwSt11char_traitsIwESaIwEE5eraseEjj"; + case 0x9dbbe07d: return "_ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE8_GetmfldERS3_S5_bRSt8ios_base"; + case 0x9dc040e4: return "_Deletegloballocale"; + case 0x9dcb4bcb: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14do_get_weekdayES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; + case 0x9e741d47: return "_ZNSsC1ERKSs"; + case 0x9ec88ae6: return "_ZNKSt5ctypeIwE10do_tolowerEPwPKw"; + case 0x9ef60bf3: return "_ZNKSt5ctypeIwE10do_tolowerEw"; + case 0x9f528cd3: return "_ZNKSt7codecvtIccSt9_MbstatetE6do_outERS0_PKcS4_RS4_PcS6_RS6_"; + case 0x9f959451: return "_ZNSt13basic_istreamIwSt11char_traitsIwEED1Ev"; + case 0x9facb533: return "_ZNSt13messages_baseD1Ev"; + case 0x9fd2eea9: return "_ZNSt8_LocinfoC2EiPKc"; + case 0xa1c6fc55: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE7_UnlockEv"; + case 0xa1de25c2: return "_ZTv0_n12_NSt10ostrstreamD1Ev"; + case 0xa22d5dda: return "_ZNSt8messagesIcED0Ev"; + case 0xa2fd0ec5: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE9pbackfailEi"; + case 0xa35033e8: return "_ZNKSt5ctypeIwE8do_widenEPKcS2_Pw"; + case 0xa37c3e51: return "_ZNKSt5ctypeIwE8do_widenEc"; + case 0xa3f5c3b2: return "_ZNSt9strstreamD2Ev"; + case 0xa433147a: return "_ZNSt8messagesIcE7_GetcatEPPKNSt6locale5facetE"; + case 0xa464c70a: return "_ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_bRSt8ios_basewRKSbIwS2_SaIwEE"; + case 0xa4f6a919: return "_ZThn8_NSdD1Ev"; + case 0xa5306edb: return "_ZNSt10moneypunctIwLb1EED1Ev"; + case 0xa562099c: return "_ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEED1Ev"; + case 0xa700bc7d: return "_ZNKSt7codecvtIwcSt9_MbstatetE6do_outERS0_PKwS4_RS4_PcS6_RS6_"; + case 0xa74e5a27: return "_ZNKSt6localeeqERKS_"; + case 0xa79c4516: return "_ZNSt15basic_streambufIcSt11char_traitsIcEED0Ev"; + case 0xa8ece2e0: return "_ZSt9use_facetISt10moneypunctIwLb0EEERKT_RKSt6locale"; + case 0xa8f64fdb: return "_ZNKSt5ctypeIcE10do_tolowerEPcPKc"; + case 0xa90c4ff2: return "_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE7_GetcatEPPKNSt6locale5facetE"; + case 0xa9116516: return "_ZNSs6appendEjc"; + case 0xa94be0fa: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE9_EndwriteEv"; + case 0xa957adcc: return "_ZNKSt5ctypeIcE9do_narrowEPKcS2_cPc"; + case 0xa9e5bb16: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERm"; + case 0xaa520d9f: return "_ZNSt6locale7_Locimp7_AddfacEPNS_5facetEj"; + case 0xaae64804: return "_ZNSt8ios_base8_FindarrEi"; + case 0xab211d97: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecb"; + case 0xab5832fd: return "_ZNSt10money_baseD1Ev"; + case 0xabd92bcc: return "_ZNSt7collateIwE7_GetcatEPPKNSt6locale5facetE"; + case 0xabdc2b49: return "_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetE"; + case 0xac6c23c0: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERy"; + case 0xad3777a2: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE8overflowEi"; + case 0xad382a99: return "_ZdlPvRKSt9nothrow_t"; + case 0xad6d839f: return "_ZNSt12codecvt_baseD0Ev"; + case 0xad6dbac2: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERm"; + case 0xadc2263b: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE6xsputnEPKci"; + case 0xae7d042f: return "_ZNSt7codecvtIwcSt9_MbstatetE7_GetcatEPPKNSt6locale5facetE"; + case 0xaea59ceb: return "_ZNSt10ctype_baseD0Ev"; + case 0xb0c185b7: return "_ZNSt10moneypunctIcLb1EE7_GetcatEPPKNSt6locale5facetE"; + case 0xb0e7c2f3: return "_ZNSiD0Ev"; + case 0xb1550b3c: return "_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecx"; + case 0xb1ac1fa3: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE6xsgetnEPwi"; + case 0xb1d696f7: return "_ZNKSt8numpunctIcE12do_falsenameEv"; + case 0xb326f699: return "_ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_bRSt8ios_basece"; + case 0xb33ef042: return "_ZNSt8bad_castD0Ev"; + case 0xb3f05af3: return "_ZNKSt7collateIcE12do_transformEPKcS2_"; + case 0xb4352488: return "_ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_bRSt8ios_basecRKSs"; + case 0xb4a8791f: return "_ZNSt8time_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev"; + case 0xb509ab64: return "_ZNSt10moneypunctIcLb1EED1Ev"; + case 0xb53fa02e: return "_ZnwjjRKSt9nothrow_t"; + case 0xb6a4d760: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE7seekposESt4fposISt9_MbstatetENSt5_IosbIiE9_OpenmodeE"; + case 0xb6a7ba7a: return "_ZNSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEED0Ev"; + case 0xb74f7b8f: return "_ZNSt6locale7_LocimpC2ERKS0_"; + case 0xb7dcbfdd: return "__Setgloballocale"; + case 0xb80ca215: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE5imbueERKSt6locale"; + case 0xb87c4b43: return "_ZNSt12strstreambuf6freezeEb"; + case 0xb8836b50: return "_ZNSt9exception18_Set_raise_handlerEPFvRKS_E"; + case 0xb8ec13a5: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewb"; + case 0xb9a2282d: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE8overflowEi"; + case 0xba0b6300: return "_ZNSt9basic_iosIwSt11char_traitsIwEED1Ev"; + case 0xba85ce08: return "_ZNSt12strstreambufD2Ev"; + case 0xbaa15803: return "_ZSt4setwi"; + case 0xbb4599c5: return "_ZNSt11logic_errorD1Ev"; + case 0xbb712718: return "_ZnwjRKSt9nothrow_t"; + case 0xbc5ad91c: return "_ZNKSt7collateIwE10do_compareEPKwS2_S2_S2_"; + case 0xbd140e12: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE11do_get_timeES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; + case 0xbd316983: return "_ZNSt8numpunctIcE5_InitERKSt8_Locinfo"; + case 0xbd35830b: return "_ZdaPvjS_"; + case 0xbd58ea5a: return "_ZNSt19ostreambuf_iteratorIwSt11char_traitsIwEEaSEw"; + case 0xbda26024: return "_ZNSt9strstreamD0Ev"; + case 0xbf9c3609: return "_ZNKSt5ctypeIwE10do_toupperEPwPKw"; + case 0xc013acd8: return "_ZNSt8ios_base8_CallfnsENS_5eventE"; + case 0xc06a4cd8: return "_ZNSt7_MpunctIwED1Ev"; + case 0xc22cebd8: return "_ZNSt8messagesIwED1Ev"; + case 0xc3d24eb3: return "_ZNSt9basic_iosIwSt11char_traitsIwEED0Ev"; + case 0xc41d676d: return "_ZNSt9time_baseD2Ev"; + case 0xc4c7993b: return "_ZNSbIwSt11char_traitsIwESaIwEE5_TidyEbj"; + case 0xc53ab1c0: return "_ZNSt8numpunctIwE5_InitERKSt8_Locinfo"; + case 0xc5977986: return "_ZNSt8ios_base7_AddstdEv"; + case 0xc612a38e: return "_ZNSt6_WinitD1Ev"; + case 0xc6e09225: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE5_InitEPSt6_FiletNS2_7_InitflE"; + case 0xc6ea0fd0: return "_ZNSt6locale7classicEv"; + case 0xc6f18e84: return "_ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_bRSt8ios_baseRNSt5_IosbIiE8_IostateERSbIwS2_SaIwEE"; + case 0xc79278ec: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE5imbueERKSt6locale"; + case 0xc7931798: return "_ZNKSt12_String_base5_XranEv"; + case 0xc7d0ee0c: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE16do_get_monthnameES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; + case 0xc862f7c8: return "_ZNSt12strstreambuf8overflowEi"; + case 0xcac83a05: return "_ZNSt6locale7_LocimpC2Eb"; + case 0xcb7d00a4: return "_ZNSt6_WinitD2Ev"; + case 0xcb82e0dc: return "_ZSt13set_terminatePFvvE"; + case 0xcbe74ad3: return "_ZNKSt8messagesIwE8do_closeEi"; + case 0xcc79f55d: return "_ZNKSt7_MpunctIcE16do_negative_signEv"; + case 0xccf14bd5: return "_ZNSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetE"; + case 0xcd33ed4f: return "_ZNSbIwSt11char_traitsIwESaIwEEC1Ev"; + case 0xcdafdf19: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE9showmanycEv"; + case 0xce653b6c: return "_ZNSt6_MutexC2Ev"; + case 0xce6705c3: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE8_GetifldEPcRS3_S6_NSt5_IosbIiE9_FmtflagsERKSt6locale"; + case 0xce8c6abc: return "_ZNSt8ios_base4InitC2Ev"; + case 0xcf9b4d80: return "_ZNSt10moneypunctIwLb1EED0Ev"; + case 0xd05ea37c: return "_ZNKSt19istreambuf_iteratorIwSt11char_traitsIwEEdeEv"; + case 0xd1b043b7: return "_ZSt10_MaklocchrIwET_cPS0_RKSt7_Cvtvec"; + case 0xd1ee6195: return "_ZNKSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecPKSt2tmcc"; + case 0xd2f9d93d: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewe"; + case 0xd356aefd: return "_ZNSt6_Mutex7_UnlockEv"; + case 0xd38f4018: return "_ZSt11_MaklocbyteIwEcT_RKSt7_Cvtvec"; + case 0xd4838fbd: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewm"; + case 0xd4ba5b31: return "_ZNSt8_LocinfoC2EPKc"; + case 0xd5244a29: return "_ZNSt10moneypunctIwLb1EE7_GetcatEPPKNSt6locale5facetE"; + case 0xd5c5ee3d: return "_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERj"; + case 0xd6ee1090: return "_ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_bRSt8ios_baseRNSt5_IosbIiE8_IostateERe"; + case 0xd73321ed: return "_ZNSt10ostrstreamD1Ev"; + case 0xd76b2e07: return "_ZNKSt7codecvtIwcSt9_MbstatetE13do_max_lengthEv"; + case 0xd78efcc3: return "_ZNSt12strstreambuf9underflowEv"; + case 0xd7bc220d: return "_ZNSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEED1Ev"; + case 0xd7d92e51: return "_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEED0Ev"; + case 0xd830252c: return "_ZNSt12strstreambuf5_InitEiPcS0_i"; + case 0xd84b3689: return "_ZdlPv"; + case 0xd8aeb94a: return "_ZNSt8messagesIcED1Ev"; + case 0xd8b23008: return "_ZNSt8ios_baseD2Ev"; + case 0xd93d52b1: return "_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev"; + case 0xd9a12c5e: return "_ZNKSt5ctypeIcE10do_toupperEPcPKc"; + case 0xd9d8af82: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE8overflowEi"; + case 0xda1088ce: return "_ZNSt6locale5facet7_IncrefEv"; + case 0xda1b159a: return "_ZNSt6_MutexD2Ev"; + case 0xda5469b3: return "_ZNSt9time_baseD0Ev"; + case 0xdab0a910: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE9pbackfailEi"; + case 0xdaf3996f: return "_ZNSt6locale6globalERKS_"; + case 0xdb5eae26: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE5_InitEPSt6_FiletNS2_7_InitflE"; + case 0xdc0c889c: return "_ZNSt8ios_base7copyfmtERKS_"; + case 0xdc4d7540: return "_ZNSt5ctypeIwED1Ev"; + case 0xdc65ab00: return "_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEED1Ev"; + case 0xdc981b5f: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE9underflowEv"; + case 0xdd8b1d47: return "_ZNSs5eraseEjj"; + case 0xdefe3230: return "_ZNSt8ios_baseD1Ev"; + case 0xdf1e09e1: return "_ZNKSt5ctypeIwE9do_narrowEPKwS2_cPc"; + case 0xdf7edb4d: return "_ZSt9use_facetISt10moneypunctIwLb1EEERKT_RKSt6locale"; + case 0xe177fd02: return "_ZNSt7_MpunctIcED2Ev"; + case 0xe196beab: return "_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEED0Ev"; + case 0xe206c08f: return "_ZNSt13basic_filebufIwSt11char_traitsIwEED0Ev"; + case 0xe2b2ac5a: return "_ZNSt6locale5facet9_RegisterEv"; + case 0xe3edd790: return "_ZNSt8bad_castD1Ev"; + case 0xe528a368: return "_ZNKSt7_MpunctIcE14do_curr_symbolEv"; + case 0xe54f1fe0: return "_ZNKSt9bad_alloc8_DoraiseEv"; + case 0xe5e1dcbc: return "_ZNSt15basic_streambufIwSt11char_traitsIwEE5imbueERKSt6locale"; + case 0xe6547e35: return "_ZNSt8messagesIwED0Ev"; + case 0xe667985a: return "_ZNSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEED0Ev"; + case 0xe75f6e21: return "_ZNKSt12length_error8_DoraiseEv"; + case 0xe7d8449e: return "_ZdlPvjS_"; + case 0xe82a422d: return "_ZNKSt8numpunctIwE11do_truenameEv"; + case 0xe8691be5: return "_ZNSt5ctypeIwED0Ev"; + case 0xe8c15f8a: return "_ZNSt7_MpunctIwED2Ev"; + case 0xe9d7a4ae: return "_ZNKSt8time_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewPKSt2tmcc"; + case 0xeb76301c: return "_ZNSt15basic_streambufIcSt11char_traitsIcEE9pbackfailEi"; + case 0xebd4b51d: return "_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE11do_get_yearES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEPSt2tm"; + case 0xece969c0: return "_ZTv0_n12_NSt10istrstreamD0Ev"; + case 0xed3da02b: return "_Znwjj"; + case 0xee853baf: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE4syncEv"; + case 0xef62751c: return "_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE13do_date_orderEv"; + case 0xef6f90d8: return "_ZNKSt5ctypeIwE11do_scan_notEsPKwS2_"; + case 0xef959a6d: return "_ZThn8_NSt9strstreamD0Ev"; + case 0xf001a741: return "_ZNSt12strstreambufD1Ev"; + case 0xf00401d2: return "_ZNSt9basic_iosIcSt11char_traitsIcEED0Ev"; + case 0xf01deff8: return "_ZNKSt7codecvtIwcSt9_MbstatetE5do_inERS0_PKcS4_RS4_PwS6_RS6_"; + case 0xf05df017: return "_ZNSt5ctypeIcE7_GetcatEPPKNSt6locale5facetE"; + case 0xf127e816: return "_ZNSt10istrstreamD1Ev"; + case 0xf1543f02: return "_ZNKSt8_Locinfo8_GetcollEv"; + case 0xf1c86c92: return "_ZNKSt12out_of_range8_DoraiseEv"; + case 0xf1cff87d: return "_ZNSt10ctype_baseD2Ev"; + case 0xf2b9ab86: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERf"; + case 0xf30d3407: return "_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewd"; + case 0xf51dc289: return "_ZNSt7codecvtIccSt9_MbstatetED1Ev"; + case 0xf53021e0: return "_ZNSt8bad_castC1Ev"; + case 0xf5825c7d: return "_ZNSt7collateIwED1Ev"; + case 0xf584de56: return "_ZNSt6locale7_Locimp8_MakelocERKSt8_LocinfoiPS0_PKS_"; + case 0xf58e83a5: return "_Znaj"; + case 0xf67a7e17: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE5uflowEv"; + case 0xf73f6afc: return "_ZNSt13basic_filebufIcSt11char_traitsIcEE7seekoffElNSt5_IosbIiE8_SeekdirENS4_9_OpenmodeE"; + case 0xf7845d1c: return "_ZNSt7_MpunctIcED1Ev"; + case 0xf7ba51fd: return "_ZNSt13basic_ostreamIwSt11char_traitsIwEED0Ev"; + case 0xf83e8d95: return "_ZNKSt5ctypeIcE10do_tolowerEc"; + case 0xf9ff46a1: return "_ZNSt13basic_filebufIwSt11char_traitsIwEE7seekoffElNSt5_IosbIiE8_SeekdirENS4_9_OpenmodeE"; + case 0xfb36c588: return "_ZNSt9strstreamC1EPciNSt5_IosbIiE9_OpenmodeE"; + case 0xfc563813: return "_ZNKSt7codecvtIccSt9_MbstatetE5do_inERS0_PKcS4_RS4_PcS6_RS6_"; + case 0xfc825dda: return "_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetE"; + case 0xfe468b7a: return "_ZTv0_n12_NSdD0Ev"; + case 0xfeb4107c: return "_ZNSt12codecvt_baseD2Ev"; + case 0xfefd7d3a: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERy"; + case 0xffaf3218: return "_ZTv0_n12_NSoD0Ev"; + case 0xfff6ef55: return "_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE6do_getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateERb"; + } - if (_module == "sysPrxForUser") switch (fnid) - { - case 0x02e20ec1: return "__sys_printf_basename"; - case 0x0341bb97: return "sys_prx_get_module_id_by_address"; - case 0x04e83d2c: return "_sys_strncmp"; - case 0x052d29a6: return "_sys_strcat"; - case 0x05c65656: return "sys_mempool_try_allocate_block"; - case 0x0618936b: return "_sys_vsnprintf"; - case 0x06574237: return "_sys_snprintf"; - case 0x1573dc3f: return "sys_lwmutex_lock"; - case 0x191f0c4a: return "_sys_strrchr"; - case 0x1ae10b92: return "_sys_spu_printf_attach_thread"; - case 0x1bc200f4: return "sys_lwmutex_unlock"; - case 0x1c9a942c: return "sys_lwcond_destroy"; - case 0x1ca525a2: return "_sys_strncasecmp"; - case 0x1ed454ce: return "sys_spu_elf_get_information"; - case 0x24a1ea07: return "sys_ppu_thread_create"; - case 0x25596f51: return "sys_mempool_get_count"; - case 0x26090058: return "sys_prx_load_module"; - case 0x27427742: return "_sys_memmove"; - case 0x2a6d9d51: return "sys_lwcond_wait"; - case 0x2c847572: return "_sys_process_atexitspawn"; - case 0x2d36462b: return "_sys_strlen"; - case 0x2f85c0ef: return "sys_lwmutex_create"; - case 0x3172759d: return "sys_game_get_temperature"; - case 0x318f17e1: return "_sys_memalign"; - case 0x350d454e: return "sys_ppu_thread_get_id"; - case 0x35168520: return "_sys_heap_malloc"; - case 0x3bd53c7b: return "_sys_memchr"; - case 0x3dd4a957: return "sys_ppu_thread_register_atexit"; - case 0x3ef17f8c: return "__sys_look_ctype_table"; - case 0x409ad939: return "sys_mmapper_free_memory"; - case 0x4232b0db: return "_sys_panic"; - case 0x42b23552: return "sys_prx_register_library"; - case 0x44265c08: return "_sys_heap_memalign"; - case 0x459b4393: return "_sys_strcmp"; - case 0x45fe2fce: return "_sys_spu_printf_initialize"; - case 0x4643ba6e: return "sys_mmapper_unmap_memory"; - case 0x4a071d98: return "sys_interrupt_thread_disestablish"; - case 0x4b2f301a: return "_sys_tolower"; - case 0x4bbf59d0: return "_sys_net_eurus_post_command"; - case 0x4f7172c9: return "sys_process_is_stack"; - case 0x5267cb35: return "sys_spinlock_unlock"; - case 0x52aadadf: return "sys_lwcond_signal_to"; - case 0x5fdfb2fe: return "_sys_spu_printf_detach_group"; - case 0x608212fc: return "sys_mempool_free_block"; - case 0x620e35a7: return "sys_game_get_system_sw_version"; - case 0x637bdaae: return "_proc_spawn"; - case 0x67f9fedb: return "sys_game_process_exitspawn2"; - case 0x68b9b011: return "_sys_memset"; - case 0x6bf66ea7: return "_sys_memcpy"; - case 0x6e05231d: return "sys_game_watchdog_stop"; - case 0x70258515: return "sys_mmapper_allocate_memory_from_container"; - case 0x71a8472a: return "sys_get_random_number"; - case 0x722a0254: return "sys_spinlock_trylock"; - case 0x74311398: return "sys_prx_get_my_module_id"; - case 0x744680a2: return "sys_initialize_tls"; - case 0x7498887b: return "_sys_strchr"; - case 0x791b9219: return "_sys_vsprintf"; - case 0x80fb0c19: return "sys_prx_stop_module"; - case 0x8461e528: return "sys_time_get_system_time"; - case 0x84bb6774: return "sys_prx_get_module_info"; - case 0x893305fa: return "sys_raw_spu_load"; - case 0x8985b5b6: return "_sys_heap_stats"; - case 0x8a2f159b: return "console_getc"; - case 0x8a561d92: return "_sys_heap_free"; - case 0x8bb03ab8: return "sys_game_board_storage_write"; - case 0x8c2bb498: return "sys_spinlock_initialize"; - case 0x8cfef376: return "__tls_get_addr"; - case 0x96328741: return "_sys_process_at_Exitspawn"; - case 0x996f7cf8: return "_sys_strncat"; - case 0x99c88692: return "_sys_strcpy"; - case 0x9d2ec4ff: return "sys_process_spawn"; - case 0x9d3c0f81: return "sys_mempool_destroy"; - case 0x9e0623b5: return "sys_game_watchdog_start"; - case 0x9f04f7af: return "_sys_printf"; - case 0x9f18429d: return "sys_prx_start_module"; - case 0x9f950780: return "sys_game_get_rtc_status"; - case 0xa146a143: return "sys_mempool_allocate_block"; - case 0xa1f9eafe: return "_sys_sprintf"; - case 0xa285139d: return "sys_spinlock_lock"; - case 0xa2c7ba64: return "sys_prx_exitspawn_with_level"; - case 0xa330ad84: return "sys_prx_load_module_on_memcontainer_by_fd"; - case 0xa3e3be68: return "sys_ppu_thread_once"; - case 0xa5d06bf0: return "sys_prx_get_module_list"; - case 0xaa6d9bff: return "sys_prx_load_module_on_memcontainer"; - case 0xac6fc404: return "sys_ppu_thread_unregister_atexit"; - case 0xacad8fb6: return "sys_game_watchdog_clear"; - case 0xaeb78725: return "sys_lwmutex_trylock"; - case 0xaede4b03: return "_sys_heap_delete_heap"; - case 0xaff080a4: return "sys_ppu_thread_exit"; - case 0xb257540b: return "sys_mmapper_allocate_memory"; - case 0xb27c8ae7: return "sys_prx_load_module_list"; - case 0xb2fcf2c8: return "_sys_heap_create_heap"; - case 0xb3bbcf2a: return "_sys_spu_printf_detach_thread"; - case 0xb6369393: return "_sys_heap_get_total_free_size"; - case 0xb995662e: return "sys_raw_spu_image_load"; - case 0xb9bf1078: return "_sys_heap_alloc_heap_memory"; - case 0xbab62b99: return "_sys_process_wait_for_game_process"; - case 0xbdb18f83: return "_sys_malloc"; - case 0xbf8ee5bb: return "sys_process_spawn_with_memory_budget"; - case 0xc3476d0c: return "sys_lwmutex_destroy"; - case 0xc4fd6121: return "_sys_qsort"; - case 0xca9a60bf: return "sys_mempool_create"; - case 0xd0ea47a7: return "sys_prx_unregister_library"; - case 0xd1ad4570: return "_sys_heap_get_mallinfo"; - case 0xd3039d4d: return "_sys_strncpy"; - case 0xda0eb71a: return "sys_lwcond_create"; - case 0xdb6b3250: return "sys_spu_elf_get_segments"; - case 0xdc578057: return "sys_mmapper_map_memory"; - case 0xdd0c1e09: return "_sys_spu_printf_attach_group"; - case 0xdd3b27ac: return "_sys_spu_printf_finalize"; - case 0xde2f9c85: return "sys_process_atexit"; - case 0xe0998dbf: return "sys_prx_get_module_id_by_name"; - case 0xe0da8efd: return "sys_spu_image_close"; - case 0xe66bac36: return "console_putc"; - case 0xe6f2c1e7: return "sys_process_exit"; - case 0xe76964f5: return "sys_game_board_storage_read"; - case 0xe7ef3a80: return "sys_prx_load_module_list_on_memcontainer"; - case 0xe95ffa0a: return "sys_process_wait_for_game_process"; - case 0xe9a1bd84: return "sys_lwcond_signal_all"; - case 0xebe5f72f: return "sys_spu_image_import"; - case 0xeef75113: return "_sys_toupper"; - case 0xef68c17c: return "sys_prx_load_module_by_fd"; - case 0xef87a695: return "sys_lwcond_signal"; - case 0xf0aece0d: return "sys_prx_unload_module"; - case 0xf57e1d6f: return "console_write"; - case 0xf7f7fb20: return "_sys_free"; - case 0xfa7f693d: return "_sys_vprintf"; - case 0xfb5db080: return "_sys_memcmp"; - case 0xfc52a7a9: return "sys_game_process_exitspawn"; - case 0xfecc05b6: return "__sys_time"; - } + if (_module == "sysPrxForUser") + switch (fnid) + { + case 0x02e20ec1: return "__sys_printf_basename"; + case 0x0341bb97: return "sys_prx_get_module_id_by_address"; + case 0x04e83d2c: return "_sys_strncmp"; + case 0x052d29a6: return "_sys_strcat"; + case 0x05c65656: return "sys_mempool_try_allocate_block"; + case 0x0618936b: return "_sys_vsnprintf"; + case 0x06574237: return "_sys_snprintf"; + case 0x1573dc3f: return "sys_lwmutex_lock"; + case 0x191f0c4a: return "_sys_strrchr"; + case 0x1ae10b92: return "_sys_spu_printf_attach_thread"; + case 0x1bc200f4: return "sys_lwmutex_unlock"; + case 0x1c9a942c: return "sys_lwcond_destroy"; + case 0x1ca525a2: return "_sys_strncasecmp"; + case 0x1ed454ce: return "sys_spu_elf_get_information"; + case 0x24a1ea07: return "sys_ppu_thread_create"; + case 0x25596f51: return "sys_mempool_get_count"; + case 0x26090058: return "sys_prx_load_module"; + case 0x27427742: return "_sys_memmove"; + case 0x2a6d9d51: return "sys_lwcond_wait"; + case 0x2c847572: return "_sys_process_atexitspawn"; + case 0x2d36462b: return "_sys_strlen"; + case 0x2f85c0ef: return "sys_lwmutex_create"; + case 0x3172759d: return "sys_game_get_temperature"; + case 0x318f17e1: return "_sys_memalign"; + case 0x350d454e: return "sys_ppu_thread_get_id"; + case 0x35168520: return "_sys_heap_malloc"; + case 0x3bd53c7b: return "_sys_memchr"; + case 0x3dd4a957: return "sys_ppu_thread_register_atexit"; + case 0x3ef17f8c: return "__sys_look_ctype_table"; + case 0x409ad939: return "sys_mmapper_free_memory"; + case 0x4232b0db: return "_sys_panic"; + case 0x42b23552: return "sys_prx_register_library"; + case 0x44265c08: return "_sys_heap_memalign"; + case 0x459b4393: return "_sys_strcmp"; + case 0x45fe2fce: return "_sys_spu_printf_initialize"; + case 0x4643ba6e: return "sys_mmapper_unmap_memory"; + case 0x4a071d98: return "sys_interrupt_thread_disestablish"; + case 0x4b2f301a: return "_sys_tolower"; + case 0x4bbf59d0: return "_sys_net_eurus_post_command"; + case 0x4f7172c9: return "sys_process_is_stack"; + case 0x5267cb35: return "sys_spinlock_unlock"; + case 0x52aadadf: return "sys_lwcond_signal_to"; + case 0x5fdfb2fe: return "_sys_spu_printf_detach_group"; + case 0x608212fc: return "sys_mempool_free_block"; + case 0x620e35a7: return "sys_game_get_system_sw_version"; + case 0x637bdaae: return "_proc_spawn"; + case 0x67f9fedb: return "sys_game_process_exitspawn2"; + case 0x68b9b011: return "_sys_memset"; + case 0x6bf66ea7: return "_sys_memcpy"; + case 0x6e05231d: return "sys_game_watchdog_stop"; + case 0x70258515: return "sys_mmapper_allocate_memory_from_container"; + case 0x71a8472a: return "sys_get_random_number"; + case 0x722a0254: return "sys_spinlock_trylock"; + case 0x74311398: return "sys_prx_get_my_module_id"; + case 0x744680a2: return "sys_initialize_tls"; + case 0x7498887b: return "_sys_strchr"; + case 0x791b9219: return "_sys_vsprintf"; + case 0x80fb0c19: return "sys_prx_stop_module"; + case 0x8461e528: return "sys_time_get_system_time"; + case 0x84bb6774: return "sys_prx_get_module_info"; + case 0x893305fa: return "sys_raw_spu_load"; + case 0x8985b5b6: return "_sys_heap_stats"; + case 0x8a2f159b: return "console_getc"; + case 0x8a561d92: return "_sys_heap_free"; + case 0x8bb03ab8: return "sys_game_board_storage_write"; + case 0x8c2bb498: return "sys_spinlock_initialize"; + case 0x8cfef376: return "__tls_get_addr"; + case 0x96328741: return "_sys_process_at_Exitspawn"; + case 0x996f7cf8: return "_sys_strncat"; + case 0x99c88692: return "_sys_strcpy"; + case 0x9d2ec4ff: return "sys_process_spawn"; + case 0x9d3c0f81: return "sys_mempool_destroy"; + case 0x9e0623b5: return "sys_game_watchdog_start"; + case 0x9f04f7af: return "_sys_printf"; + case 0x9f18429d: return "sys_prx_start_module"; + case 0x9f950780: return "sys_game_get_rtc_status"; + case 0xa146a143: return "sys_mempool_allocate_block"; + case 0xa1f9eafe: return "_sys_sprintf"; + case 0xa285139d: return "sys_spinlock_lock"; + case 0xa2c7ba64: return "sys_prx_exitspawn_with_level"; + case 0xa330ad84: return "sys_prx_load_module_on_memcontainer_by_fd"; + case 0xa3e3be68: return "sys_ppu_thread_once"; + case 0xa5d06bf0: return "sys_prx_get_module_list"; + case 0xaa6d9bff: return "sys_prx_load_module_on_memcontainer"; + case 0xac6fc404: return "sys_ppu_thread_unregister_atexit"; + case 0xacad8fb6: return "sys_game_watchdog_clear"; + case 0xaeb78725: return "sys_lwmutex_trylock"; + case 0xaede4b03: return "_sys_heap_delete_heap"; + case 0xaff080a4: return "sys_ppu_thread_exit"; + case 0xb257540b: return "sys_mmapper_allocate_memory"; + case 0xb27c8ae7: return "sys_prx_load_module_list"; + case 0xb2fcf2c8: return "_sys_heap_create_heap"; + case 0xb3bbcf2a: return "_sys_spu_printf_detach_thread"; + case 0xb6369393: return "_sys_heap_get_total_free_size"; + case 0xb995662e: return "sys_raw_spu_image_load"; + case 0xb9bf1078: return "_sys_heap_alloc_heap_memory"; + case 0xbab62b99: return "_sys_process_wait_for_game_process"; + case 0xbdb18f83: return "_sys_malloc"; + case 0xbf8ee5bb: return "sys_process_spawn_with_memory_budget"; + case 0xc3476d0c: return "sys_lwmutex_destroy"; + case 0xc4fd6121: return "_sys_qsort"; + case 0xca9a60bf: return "sys_mempool_create"; + case 0xd0ea47a7: return "sys_prx_unregister_library"; + case 0xd1ad4570: return "_sys_heap_get_mallinfo"; + case 0xd3039d4d: return "_sys_strncpy"; + case 0xda0eb71a: return "sys_lwcond_create"; + case 0xdb6b3250: return "sys_spu_elf_get_segments"; + case 0xdc578057: return "sys_mmapper_map_memory"; + case 0xdd0c1e09: return "_sys_spu_printf_attach_group"; + case 0xdd3b27ac: return "_sys_spu_printf_finalize"; + case 0xde2f9c85: return "sys_process_atexit"; + case 0xe0998dbf: return "sys_prx_get_module_id_by_name"; + case 0xe0da8efd: return "sys_spu_image_close"; + case 0xe66bac36: return "console_putc"; + case 0xe6f2c1e7: return "sys_process_exit"; + case 0xe76964f5: return "sys_game_board_storage_read"; + case 0xe7ef3a80: return "sys_prx_load_module_list_on_memcontainer"; + case 0xe95ffa0a: return "sys_process_wait_for_game_process"; + case 0xe9a1bd84: return "sys_lwcond_signal_all"; + case 0xebe5f72f: return "sys_spu_image_import"; + case 0xeef75113: return "_sys_toupper"; + case 0xef68c17c: return "sys_prx_load_module_by_fd"; + case 0xef87a695: return "sys_lwcond_signal"; + case 0xf0aece0d: return "sys_prx_unload_module"; + case 0xf57e1d6f: return "console_write"; + case 0xf7f7fb20: return "_sys_free"; + case 0xfa7f693d: return "_sys_vprintf"; + case 0xfb5db080: return "_sys_memcmp"; + case 0xfc52a7a9: return "sys_game_process_exitspawn"; + case 0xfecc05b6: return "__sys_time"; + } // Check registered functions if (const auto sm = ppu_module_manager::get_module(_module)) @@ -1805,77 +1809,80 @@ extern std::string ppu_get_function_name(const std::string& _module, u32 fnid) // Get variable name by VNID extern std::string ppu_get_variable_name(const std::string& _module, u32 vnid) { - if (_module.empty()) switch (vnid) - { - // these arent the actual hash, but its close enough - case 0xd7f43016: return "module_info"; - } + if (_module.empty()) + switch (vnid) + { + // these arent the actual hash, but its close enough + case 0xd7f43016: return "module_info"; + } // Check known FNIDs - if (_module == "sys_libc") switch (vnid) - { - case 0x071928b0: return "_LNan"; - case 0x0a331920: return "_Clocale"; - case 0x0b2e15ed: return "_malloc_limit"; - case 0x0fbc732d: return "_Zero"; - case 0x17667744: return "_LInf"; - case 0x210b2f6e: return "_FNan"; - case 0x2418f6c0: return "__TT800"; - case 0x2470d3bc: return "_Hugeval"; - case 0x26a34f81: return "_Flt"; - case 0x277a84bb: return "_Mutex_attr"; - case 0x29e76a6d: return "_LXbig"; - case 0x2cf8b5d1: return "_Wctrans"; - case 0x32e56b1a: return "_Stdin"; - case 0x3916a06a: return "_FILE_P_Head"; - case 0x45ec2df6: return "_LEps"; - case 0x529d4301: return "_Denorm"; - case 0x57dbcf27: return "_Inf"; - case 0x5ff11eb4: return "_FZero"; - case 0x620967c9: return "_Mbcurmax"; - case 0x6524499e: return "_FInf"; - case 0x67d1406b: return "__ctype_ptr"; - case 0x6a09df41: return "_LRteps"; - case 0x73898db8: return "environ"; - case 0x76628efb: return "_FSnan"; - case 0x790b0082: return "_Xbig"; - case 0x7aff3242: return "_Snan"; - case 0x7bc88211: return "_Tolotab"; - case 0x7f456af2: return "_Rteps"; - case 0x81acf7c1: return "_LZero"; - case 0x8f87ed0c: return "_Times"; - case 0x92c43f6d: return "_Eps"; - case 0x96e1e748: return "tls_mutex_attr"; - case 0x985fc057: return "_Dbl"; - case 0x9c8454c9: return "_LSnan"; - case 0xaa860d4c: return "_Wctype"; - case 0xb5b84f80: return "_LDenorm"; - case 0xb5d2f53b: return "_Touptab"; - case 0xb6f5f98c: return "_FRteps"; - case 0xd59c193c: return "_Nan"; - case 0xd698385d: return "_Ldbl"; - case 0xd97b0687: return "_Ctype"; - case 0xe0bc8d86: return "_Loctab"; - case 0xeace53d6: return "_FDenorm"; - case 0xeca056df: return "_Locale"; - case 0xef25075b: return "_FXbig"; - case 0xfb2bd688: return "_Stdout"; - case 0xfefbe065: return "_Stderr"; - case 0xff2f0cc7: return "_FEps"; - } + if (_module == "sys_libc") + switch (vnid) + { + case 0x071928b0: return "_LNan"; + case 0x0a331920: return "_Clocale"; + case 0x0b2e15ed: return "_malloc_limit"; + case 0x0fbc732d: return "_Zero"; + case 0x17667744: return "_LInf"; + case 0x210b2f6e: return "_FNan"; + case 0x2418f6c0: return "__TT800"; + case 0x2470d3bc: return "_Hugeval"; + case 0x26a34f81: return "_Flt"; + case 0x277a84bb: return "_Mutex_attr"; + case 0x29e76a6d: return "_LXbig"; + case 0x2cf8b5d1: return "_Wctrans"; + case 0x32e56b1a: return "_Stdin"; + case 0x3916a06a: return "_FILE_P_Head"; + case 0x45ec2df6: return "_LEps"; + case 0x529d4301: return "_Denorm"; + case 0x57dbcf27: return "_Inf"; + case 0x5ff11eb4: return "_FZero"; + case 0x620967c9: return "_Mbcurmax"; + case 0x6524499e: return "_FInf"; + case 0x67d1406b: return "__ctype_ptr"; + case 0x6a09df41: return "_LRteps"; + case 0x73898db8: return "environ"; + case 0x76628efb: return "_FSnan"; + case 0x790b0082: return "_Xbig"; + case 0x7aff3242: return "_Snan"; + case 0x7bc88211: return "_Tolotab"; + case 0x7f456af2: return "_Rteps"; + case 0x81acf7c1: return "_LZero"; + case 0x8f87ed0c: return "_Times"; + case 0x92c43f6d: return "_Eps"; + case 0x96e1e748: return "tls_mutex_attr"; + case 0x985fc057: return "_Dbl"; + case 0x9c8454c9: return "_LSnan"; + case 0xaa860d4c: return "_Wctype"; + case 0xb5b84f80: return "_LDenorm"; + case 0xb5d2f53b: return "_Touptab"; + case 0xb6f5f98c: return "_FRteps"; + case 0xd59c193c: return "_Nan"; + case 0xd698385d: return "_Ldbl"; + case 0xd97b0687: return "_Ctype"; + case 0xe0bc8d86: return "_Loctab"; + case 0xeace53d6: return "_FDenorm"; + case 0xeca056df: return "_Locale"; + case 0xef25075b: return "_FXbig"; + case 0xfb2bd688: return "_Stdout"; + case 0xfefbe065: return "_Stderr"; + case 0xff2f0cc7: return "_FEps"; + } - if (_module == "sys_libm") switch (vnid) - { - case 0x1cf745bc: return "_LErf_one"; - case 0x2259ef96: return "_LGamma_big"; - case 0x3acad7f1: return "_Erf_small"; - case 0x3fb8629d: return "_FErf_one"; - case 0x42eb9508: return "_Fenv0"; - case 0x4af28f31: return "_FErf_small"; - case 0xa8d907ff: return "_LErf_small"; - case 0xad443e79: return "_Erf_one"; - case 0xe9892674: return "_FGamma_big"; - case 0xf39005fc: return "_Gamma_big"; - } + if (_module == "sys_libm") + switch (vnid) + { + case 0x1cf745bc: return "_LErf_one"; + case 0x2259ef96: return "_LGamma_big"; + case 0x3acad7f1: return "_Erf_small"; + case 0x3fb8629d: return "_FErf_one"; + case 0x42eb9508: return "_Fenv0"; + case 0x4af28f31: return "_FErf_small"; + case 0xa8d907ff: return "_LErf_small"; + case 0xad443e79: return "_Erf_one"; + case 0xe9892674: return "_FGamma_big"; + case 0xf39005fc: return "_Gamma_big"; + } // Check registered variables if (const auto sm = ppu_module_manager::get_module(_module)) @@ -1895,7 +1902,7 @@ extern std::string ppu_get_variable_name(const std::string& _module, u32 vnid) auto gen_ghc_cpp_trampoline(ppu_intrp_func_t fn_target) { - return [fn_target] (native_asm& c, auto& args) + return [fn_target](native_asm& c, auto& args) { using namespace asmjit; @@ -1911,7 +1918,7 @@ auto gen_ghc_cpp_trampoline(ppu_intrp_func_t fn_target) auto gen_ghc_cpp_trampoline(ppu_intrp_func_t fn_target) { - return [fn_target] (native_asm& c, auto& args) + return [fn_target](native_asm& c, auto& args) { using namespace asmjit; @@ -1957,8 +1964,7 @@ void ppu_function_manager::save(utils::serial& ar) std::vector& ppu_function_manager::access(bool ghc) { - static std::vector list - { + static std::vector list{ [](ppu_thread& ppu, ppu_opcode_t, be_t* this_op, ppu_intrp_func*) { ppu.cia = vm::get_addr(this_op); @@ -1973,8 +1979,7 @@ std::vector& ppu_function_manager::access(bool ghc) }, }; - static std::vector list_ghc - { + static std::vector list_ghc{ build_function_asm("ppu_unregistered", gen_ghc_cpp_trampoline(list[0])), build_function_asm("ppu_return", gen_ghc_cpp_trampoline(list[1])), }; diff --git a/rpcs3/rpcs3/Emu/Cell/PPUFunction.h b/rpcs3/rpcs3/Emu/Cell/PPUFunction.h index a42ae12d6..72556c9e6 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUFunction.h +++ b/rpcs3/rpcs3/Emu/Cell/PPUFunction.h @@ -6,22 +6,24 @@ #include "util/v128.hpp" // BIND_FUNC macro "converts" any appropriate HLE function to ppu_intrp_func_t, binding it to PPU thread context. -#define BIND_FUNC(func, ...) (static_cast([](ppu_thread& ppu, ppu_opcode_t, be_t* this_op, ppu_intrp_func*) {\ - const auto old_f = ppu.current_function;\ - if (!old_f) ppu.last_function = #func;\ - ppu.current_function = #func;\ - ppu.cia = vm::get_addr(this_op); \ - std::memcpy(ppu.syscall_args, ppu.gpr + 3, sizeof(ppu.syscall_args)); \ - ppu_func_detail::do_call(ppu, func);\ - static_cast(ppu.test_stopped());\ - auto& history = ppu.syscall_history.data[ppu.syscall_history.index++ % ppu.syscall_history.data.size()];\ - history.cia = ppu.cia;\ - history.func_name = ppu.current_function;\ - history.error = ppu.gpr[3];\ - if (ppu.syscall_history.count_debug_arguments) std::copy_n(ppu.syscall_args, std::size(history.args), history.args.data());\ - ppu.current_function = old_f;\ - ppu.cia += 4;\ - __VA_ARGS__;\ +#define BIND_FUNC(func, ...) (static_cast([](ppu_thread& ppu, ppu_opcode_t, be_t* this_op, ppu_intrp_func*) { \ + const auto old_f = ppu.current_function; \ + if (!old_f) \ + ppu.last_function = #func; \ + ppu.current_function = #func; \ + ppu.cia = vm::get_addr(this_op); \ + std::memcpy(ppu.syscall_args, ppu.gpr + 3, sizeof(ppu.syscall_args)); \ + ppu_func_detail::do_call(ppu, func); \ + static_cast(ppu.test_stopped()); \ + auto& history = ppu.syscall_history.data[ppu.syscall_history.index++ % ppu.syscall_history.data.size()]; \ + history.cia = ppu.cia; \ + history.func_name = ppu.current_function; \ + history.error = ppu.gpr[3]; \ + if (ppu.syscall_history.count_debug_arguments) \ + std::copy_n(ppu.syscall_args, std::size(history.args), history.args.data()); \ + ppu.current_function = old_f; \ + ppu.cia += 4; \ + __VA_ARGS__; \ })) struct ppu_va_args_t @@ -34,16 +36,16 @@ namespace ppu_func_detail // argument type classification enum arg_class : u32 { - ARG_GENERAL, // argument stored in gpr (from r3 to r10) - ARG_FLOAT, // argument stored in fpr (from f1 to f13) - ARG_VECTOR, // argument stored in vr (from v2 to v13) - ARG_STACK, // argument stored on the stack - ARG_CONTEXT, // ppu_thread& passed, doesn't affect g/f/v_count + ARG_GENERAL, // argument stored in gpr (from r3 to r10) + ARG_FLOAT, // argument stored in fpr (from f1 to f13) + ARG_VECTOR, // argument stored in vr (from v2 to v13) + ARG_STACK, // argument stored on the stack + ARG_CONTEXT, // ppu_thread& passed, doesn't affect g/f/v_count ARG_VARIADIC, // argument count at specific position, doesn't affect g/f/v_count ARG_UNKNOWN, }; - template + template struct bind_arg { static_assert(type == ARG_GENERAL, "Unknown function argument type"); @@ -57,7 +59,7 @@ namespace ppu_func_detail } }; - template + template struct bind_arg { static_assert(sizeof(T) <= 8, "Invalid function argument type for ARG_FLOAT"); @@ -68,7 +70,7 @@ namespace ppu_func_detail } }; - template + template struct bind_arg { static_assert(std::is_same_v, v128>, "Invalid function argument type for ARG_VECTOR"); @@ -79,7 +81,7 @@ namespace ppu_func_detail } }; - template + template struct bind_arg { static_assert(alignof(T) <= 16, "Unsupported type alignment for ARG_STACK"); @@ -90,7 +92,7 @@ namespace ppu_func_detail } }; - template + template struct bind_arg { static_assert(std::is_base_of_v, ppu_thread>, "Invalid function argument type for ARG_CONTEXT"); @@ -101,7 +103,7 @@ namespace ppu_func_detail } }; - template + template struct bind_arg { static_assert(std::is_same_v, ppu_va_args_t>, "Invalid function argument type for ARG_VARIADIC"); @@ -112,7 +114,7 @@ namespace ppu_func_detail } }; - template + template struct bind_result { static_assert(type == ARG_GENERAL, "Unknown function result type"); @@ -120,55 +122,63 @@ namespace ppu_func_detail static FORCE_INLINE void put_result(ppu_thread& ppu, const T& result) { - if (ppu.state & cpu_flag::again) return; + if (ppu.state & cpu_flag::again) + return; ppu.gpr[3] = ppu_gpr_cast(result); } }; - template + template struct bind_result { static_assert(sizeof(T) <= 8, "Invalid function result type for ARG_FLOAT"); static FORCE_INLINE void put_result(ppu_thread& ppu, const T& result) { - if (ppu.state & cpu_flag::again) return; + if (ppu.state & cpu_flag::again) + return; ppu.fpr[1] = static_cast(result); } }; - template + template struct bind_result { static_assert(std::is_same_v, v128>, "Invalid function result type for ARG_VECTOR"); static FORCE_INLINE void put_result(ppu_thread& ppu, const T& result) { - if (ppu.state & cpu_flag::again) return; + if (ppu.state & cpu_flag::again) + return; ppu.vr[2] = result; } }; // wrapper for variadic argument info list, each value contains packed argument type and counts of GENERAL, FLOAT and VECTOR arguments - template struct arg_info_pack_t; + template + struct arg_info_pack_t; - template struct arg_info_pack_t + template + struct arg_info_pack_t { static const u32 last_value = arg_info_pack_t::last_value; }; - template struct arg_info_pack_t + template + struct arg_info_pack_t { static const u32 last_value = First; }; - template<> struct arg_info_pack_t<> + template <> + struct arg_info_pack_t<> { static const u32 last_value = 0; }; // argument type + g/f/v_count unpacker - template struct bind_arg_packed + template + struct bind_arg_packed { static FORCE_INLINE T get_arg(ppu_thread& ppu) { @@ -176,15 +186,15 @@ namespace ppu_func_detail } }; - template - FORCE_INLINE RT call(ppu_thread& ppu, RT(*func)(Args...), arg_info_pack_t) + template + FORCE_INLINE RT call(ppu_thread& ppu, RT (*func)(Args...), arg_info_pack_t) { // do the actual function call when all arguments are prepared (simultaneous unpacking of Args... and Info...) return func(bind_arg_packed::get_arg(ppu)...); } - template - FORCE_INLINE RT call(ppu_thread& ppu, RT(*func)(Args...), arg_info_pack_t info) + template + FORCE_INLINE RT call(ppu_thread& ppu, RT (*func)(Args...), arg_info_pack_t info) { // unpack previous type counts (0/0/0 for the first time) const u32 g_count = (info.last_value >> 8) & 0xff; @@ -199,21 +209,22 @@ namespace ppu_func_detail constexpr bool is_general = !is_float && !is_vector && !is_context && !is_variadic; constexpr arg_class t = - is_general ? (g_count >= 8 ? ARG_STACK : ARG_GENERAL) : - is_float ? (f_count >= 13 ? ARG_STACK : ARG_FLOAT) : - is_vector ? (v_count >= 12 ? ARG_STACK : ARG_VECTOR) : - is_context ? ARG_CONTEXT : + is_general ? (g_count >= 8 ? ARG_STACK : ARG_GENERAL) : + is_float ? (f_count >= 13 ? ARG_STACK : ARG_FLOAT) : + is_vector ? (v_count >= 12 ? ARG_STACK : ARG_VECTOR) : + is_context ? ARG_CONTEXT : is_variadic ? ARG_VARIADIC : - ARG_UNKNOWN; + ARG_UNKNOWN; - constexpr u32 g = g_count + (is_general || is_float ? 1 : is_vector ? (g_count & 1) + 2 : 0); + constexpr u32 g = g_count + (is_general || is_float ? 1 : is_vector ? (g_count & 1) + 2 : + 0); constexpr u32 f = f_count + is_float; constexpr u32 v = v_count + is_vector; return call(ppu, func, arg_info_pack_t{}); } - template + template struct result_type { static_assert(!std::is_pointer_v, "Invalid function result type (pointer)"); @@ -223,12 +234,13 @@ namespace ppu_func_detail static constexpr arg_class value = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL); }; - template struct func_binder; + template + struct func_binder; - template + template struct func_binder { - using func_t = void(*)(T...); + using func_t = void (*)(T...); static FORCE_INLINE void do_call(ppu_thread& ppu, func_t func) { @@ -236,10 +248,10 @@ namespace ppu_func_detail } }; - template + template struct func_binder { - using func_t = RT(*)(T...); + using func_t = RT (*)(T...); static FORCE_INLINE void do_call(ppu_thread& ppu, func_t func) { @@ -247,17 +259,17 @@ namespace ppu_func_detail } }; - template - FORCE_INLINE void do_call(ppu_thread& ppu, RT(*func)(T...)) + template + FORCE_INLINE void do_call(ppu_thread& ppu, RT (*func)(T...)) { func_binder::do_call(ppu, func); } -} +} // namespace ppu_func_detail class ppu_function_manager { // Global variable for each registered function - template + template struct registered { static u32 index; @@ -276,14 +288,14 @@ public: ppu_function_manager& operator=(const ppu_function_manager&) = delete; // Register function (shall only be called during global initialization) - template + template static inline u32 register_function(ppu_intrp_func_t func) { return registered::index = add_function(func); } // Get function index - template + template static inline u32 get_index() { return registered::index; @@ -322,7 +334,7 @@ public: ppu_function_manager(utils::serial& ar); }; -template +template u32 ppu_function_manager::registered::index = 0; #define FIND_FUNC(func) ppu_function_manager::get_index() diff --git a/rpcs3/rpcs3/Emu/Cell/PPUInterpreter.cpp b/rpcs3/rpcs3/Emu/Cell/PPUInterpreter.cpp index 4f75cd634..c3f301f4f 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUInterpreter.cpp +++ b/rpcs3/rpcs3/Emu/Cell/PPUInterpreter.cpp @@ -116,40 +116,44 @@ struct ppu_exec_select // Switch between inlined interpreter invocation (exec) and builder function #if defined(ARCH_X64) -#define RETURN(...) \ - if constexpr (Build == 0) { \ - static_cast(exec); \ +#define RETURN(...) \ + if constexpr (Build == 0) \ + { \ + static_cast(exec); \ static const ppu_intrp_func_t f = build_function_asm("ppu_"s + __func__, [&](asmjit::ppu_builder& c, native_args&) { \ - static ppu_opcode_t op{}; \ - static ppu_abstract_t ppu; \ - exec(__VA_ARGS__); \ - c.ppu_ret(); \ - return !c.fail_flag; \ - }); \ - if (f) return f; \ - ppu_log.error("Can't build instruction %s", __func__); \ - RETURN_(__VA_ARGS__); \ + static ppu_opcode_t op{}; \ + static ppu_abstract_t ppu; \ + exec(__VA_ARGS__); \ + c.ppu_ret(); \ + return !c.fail_flag; \ + }); \ + if (f) \ + return f; \ + ppu_log.error("Can't build instruction %s", __func__); \ + RETURN_(__VA_ARGS__); \ } #else #define RETURN RETURN_ #endif -#define RETURN_(...) \ - if constexpr (Build == 0) { \ - static_cast(exec); \ - if (is_debugger_present()) return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) { \ - exec(__VA_ARGS__); \ - const auto next_op = this_op + 1; \ - const auto fn = atomic_storage::load(next_fn->fn); \ - ppu.cia = vm::get_addr(next_op); \ - return fn(ppu, {*next_op}, next_op, next_fn + 1); \ - }; \ - return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) { \ - exec(__VA_ARGS__); \ - const auto next_op = this_op + 1; \ - const auto fn = atomic_storage::observe(next_fn->fn); \ - return fn(ppu, {*next_op}, next_op, next_fn + 1); \ - }; \ +#define RETURN_(...) \ + if constexpr (Build == 0) \ + { \ + static_cast(exec); \ + if (is_debugger_present()) \ + return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) { \ + exec(__VA_ARGS__); \ + const auto next_op = this_op + 1; \ + const auto fn = atomic_storage::load(next_fn->fn); \ + ppu.cia = vm::get_addr(next_op); \ + return fn(ppu, {*next_op}, next_op, next_fn + 1); \ + }; \ + return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) { \ + exec(__VA_ARGS__); \ + const auto next_op = this_op + 1; \ + const auto fn = atomic_storage::observe(next_fn->fn); \ + return fn(ppu, {*next_op}, next_op, next_fn + 1); \ + }; \ } #ifdef ARCH_X64 @@ -281,7 +285,7 @@ namespace asmjit { }; #endif -} +} // namespace asmjit struct ppu_abstract_t { @@ -295,9 +299,9 @@ struct ppu_abstract_t if (is_lv && !this->isReg()) { Operand::operator=(g_vc->vec_alloc()); - #if defined(ARCH_X64) +#if defined(ARCH_X64) g_vc->emit(asmjit::x86::Inst::kIdMovaps, *this, static_cast(g_vc)->ppu_vr(bf_t{}, false)); - #endif +#endif } if (!is_lv) @@ -308,9 +312,9 @@ struct ppu_abstract_t } else { - #if defined(ARCH_X64) +#if defined(ARCH_X64) Operand::operator=(static_cast(g_vc)->ppu_vr(bf_t{}, false)); - #endif +#endif } } @@ -334,9 +338,9 @@ struct ppu_abstract_t struct abstract_sat : asmjit::mem_type { abstract_sat() - #if defined(ARCH_X64) +#if defined(ARCH_X64) : asmjit::mem_type(static_cast(g_vc)->ppu_sat()) - #endif +#endif { } @@ -350,7 +354,10 @@ struct ppu_abstract_t extern void do_cell_atomic_128_store(u32 addr, const void* to_write); -inline u64 dup32(u32 x) { return x | static_cast(x) << 32; } +inline u64 dup32(u32 x) +{ + return x | static_cast(x) << 32; +} // Write values to CR field inline void ppu_cr_set(ppu_thread& ppu, u32 field, bool le, bool gt, bool eq, bool so) @@ -367,10 +374,10 @@ inline void ppu_cr_set(ppu_thread& ppu, u32 field, bool le, bool gt, bool eq, bo } // Write comparison results to CR field -template +template inline void ppu_cr_set(ppu_thread& ppu, u32 field, const T& a, const T& b) { - ppu_cr_set(ppu, field, a < b, a > b, a == b, ppu.xer.so); + ppu_cr_set(ppu, field, a b, a == b, ppu.xer.so); } // TODO @@ -406,12 +413,8 @@ void ppu_set_fpcc(ppu_thread& ppu, f64 a, f64 b, u64 cr_field = 1) bool fpcc[4]; #if defined(ARCH_X64) && !defined(_M_X64) __asm__("comisd %[b], %[a]\n" - : "=@ccb" (fpcc[0]) - , "=@cca" (fpcc[1]) - , "=@ccz" (fpcc[2]) - , "=@ccp" (fpcc[3]) - : [a] "x" (a) - , [b] "x" (b) + : "=@ccb"(fpcc[0]), "=@cca"(fpcc[1]), "=@ccz"(fpcc[2]), "=@ccp"(fpcc[3]) + : [a] "x"(a), [b] "x"(b) : "cc"); if (fpcc[3]) [[unlikely]] { @@ -550,7 +553,7 @@ u32 ppu_record_call(ppu_thread& ppu, u32 new_cia, ppu_opcode_t op, bool indirect return new_cia; } -template +template struct add_flags_result_t { T result; @@ -560,8 +563,7 @@ struct add_flags_result_t // Straighforward ADD with flags add_flags_result_t(T a, T b) - : result(a + b) - , carry(result < a) + : result(a + b), carry(result < a) { } @@ -577,12 +579,12 @@ struct add_flags_result_t static add_flags_result_t add64_flags(u64 a, u64 b) { - return{ a, b }; + return {a, b}; } static add_flags_result_t add64_flags(u64 a, u64 b, bool c) { - return{ a, b, c }; + return {a, b, c}; } extern void ppu_execute_syscall(ppu_thread& ppu, u64 code); @@ -1974,26 +1976,26 @@ auto VPERM() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); -#if defined (ARCH_X64) +#if defined(ARCH_X64) if constexpr (Build == 0) { static const ppu_intrp_func_t f = build_function_asm("ppu_VPERM", [&](asmjit::ppu_builder& c, native_args&) - { - const auto [v0, v1, v2, v3] = c.vec_alloc<4>(); - c.movdqa(v0, c.ppu_vr(s_op.vc)); - c.pandn(v0, c.get_const(v128::from8p(0x1f))); - c.movdqa(v1, v0); - c.pcmpgtb(v1, c.get_const(v128::from8p(0xf))); - c.movdqa(v2, c.ppu_vr(s_op.va)); - c.movdqa(v3, c.ppu_vr(s_op.vb)); - c.pshufb(v2, v0); - c.pshufb(v3, v0); - c.pand(v2, v1); - c.pandn(v1, v3); - c.por(v1, v2); - c.movdqa(c.ppu_vr(s_op.vd), v1); - c.ppu_ret(); - }); + { + const auto [v0, v1, v2, v3] = c.vec_alloc<4>(); + c.movdqa(v0, c.ppu_vr(s_op.vc)); + c.pandn(v0, c.get_const(v128::from8p(0x1f))); + c.movdqa(v1, v0); + c.pcmpgtb(v1, c.get_const(v128::from8p(0xf))); + c.movdqa(v2, c.ppu_vr(s_op.va)); + c.movdqa(v3, c.ppu_vr(s_op.vb)); + c.pshufb(v2, v0); + c.pshufb(v3, v0); + c.pand(v2, v1); + c.pandn(v1, v3); + c.por(v1, v2); + c.movdqa(c.ppu_vr(s_op.vd), v1); + c.ppu_ret(); + }); if (utils::has_ssse3()) { @@ -2004,12 +2006,12 @@ auto VPERM() static const auto exec = [](auto&& d, auto&& a, auto&& b, auto&& c) { - #if defined(ARCH_ARM64) +#if defined(ARCH_ARM64) uint8x16x2_t ab; ab.val[0] = b; ab.val[1] = a; d = vqtbl2q_u8(ab, vbicq_u8(vdupq_n_u8(0x1f), c)); - #else +#else u8 ab[32]; std::memcpy(ab + 0, &b, 16); std::memcpy(ab + 16, &a, 16); @@ -2018,7 +2020,7 @@ auto VPERM() { d._u8[i] = ab[~c._u8[i] & 0x1f]; } - #endif +#endif }; RETURN_(ppu.vr[op.vd], ppu.vr[op.va], ppu.vr[op.vb], ppu.vr[op.vc]); @@ -2367,7 +2369,6 @@ struct VSLDOI } }; - template auto VSLH() { @@ -2870,8 +2871,10 @@ auto VSUM2SWS() y._s64[0] = s64{a._s32[0]} + a._s32[1] + b._s32[0]; y._s64[1] = s64{a._s32[2]} + a._s32[3] + b._s32[2]; v128 r{}; - r._u64[0] = y._s64[0] > INT32_MAX ? INT32_MAX : y._s64[0] < INT32_MIN ? u32(INT32_MIN) : static_cast(y._s64[0]); - r._u64[1] = y._s64[1] > INT32_MAX ? INT32_MAX : y._s64[1] < INT32_MIN ? u32(INT32_MIN) : static_cast(y._s64[1]); + r._u64[0] = y._s64[0] > INT32_MAX ? INT32_MAX : y._s64[0] < INT32_MIN ? u32(INT32_MIN) : + static_cast(y._s64[0]); + r._u64[1] = y._s64[1] > INT32_MAX ? INT32_MAX : y._s64[1] < INT32_MIN ? u32(INT32_MIN) : + static_cast(y._s64[1]); #endif if constexpr (((Flags == set_sat) || ...)) sat = gv_or32(gv_shr64(gv_add64(y, gv_bcst64(0x80000000u)), 32), std::move(sat)); @@ -3041,23 +3044,23 @@ auto TDI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - if constexpr (Build == 0) return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) - { - const s64 a = ppu.gpr[op.ra], b = op.simm16; - const u64 a_ = a, b_ = b; + if constexpr (Build == 0) + return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) + { + const s64 a = ppu.gpr[op.ra], b = op.simm16; + const u64 a_ = a, b_ = b; - if (((op.bo & 0x10) && a < b) || - ((op.bo & 0x8) && a > b) || - ((op.bo & 0x4) && a == b) || - ((op.bo & 0x2) && a_ < b_) || - ((op.bo & 0x1) && a_ > b_)) - { - [[unlikely]] - ppu_trap(ppu, vm::get_addr(this_op)); - return; - } - return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); - }; + if (((op.bo & 0x10) && a < b) || + ((op.bo & 0x8) && a > b) || + ((op.bo & 0x4) && a == b) || + ((op.bo & 0x2) && a_ < b_) || + ((op.bo & 0x1) && a_ > b_)) + { + [[unlikely]] ppu_trap(ppu, vm::get_addr(this_op)); + return; + } + return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); + }; } template @@ -3066,23 +3069,23 @@ auto TWI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - if constexpr (Build == 0) return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) - { - const s32 a = static_cast(ppu.gpr[op.ra]), b = op.simm16; - const u32 a_ = a, b_ = b; + if constexpr (Build == 0) + return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) + { + const s32 a = static_cast(ppu.gpr[op.ra]), b = op.simm16; + const u32 a_ = a, b_ = b; - if (((op.bo & 0x10) && a < b) || - ((op.bo & 0x8) && a > b) || - ((op.bo & 0x4) && a == b) || - ((op.bo & 0x2) && a_ < b_) || - ((op.bo & 0x1) && a_ > b_)) - { - [[unlikely]] - ppu_trap(ppu, vm::get_addr(this_op)); - return; - } - return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); - }; + if (((op.bo & 0x10) && a < b) || + ((op.bo & 0x8) && a > b) || + ((op.bo & 0x4) && a == b) || + ((op.bo & 0x2) && a_ < b_) || + ((op.bo & 0x1) && a_ > b_)) + { + [[unlikely]] ppu_trap(ppu, vm::get_addr(this_op)); + return; + } + return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); + }; } template @@ -3091,8 +3094,9 @@ auto MULLI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.rd] = static_cast(ppu.gpr[op.ra]) * op.simm16; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.rd] = static_cast(ppu.gpr[op.ra]) * op.simm16; }; RETURN_(ppu, op); } @@ -3103,12 +3107,13 @@ auto SUBFIC() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 a = ppu.gpr[op.ra]; - const s64 i = op.simm16; - const auto r = add64_flags(~a, i, 1); - ppu.gpr[op.rd] = r.result; - ppu.xer.ca = r.carry; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 a = ppu.gpr[op.ra]; + const s64 i = op.simm16; + const auto r = add64_flags(~a, i, 1); + ppu.gpr[op.rd] = r.result; + ppu.xer.ca = r.carry; }; RETURN_(ppu, op); } @@ -3119,15 +3124,16 @@ auto CMPLI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if (op.l10) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu_cr_set(ppu, op.crfd, ppu.gpr[op.ra], op.uimm16); - } - else - { - ppu_cr_set(ppu, op.crfd, static_cast(ppu.gpr[op.ra]), op.uimm16); - } + if (op.l10) + { + ppu_cr_set(ppu, op.crfd, ppu.gpr[op.ra], op.uimm16); + } + else + { + ppu_cr_set(ppu, op.crfd, static_cast(ppu.gpr[op.ra]), op.uimm16); + } }; RETURN_(ppu, op); } @@ -3138,15 +3144,16 @@ auto CMPI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if (op.l10) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu_cr_set(ppu, op.crfd, ppu.gpr[op.ra], op.simm16); - } - else - { - ppu_cr_set(ppu, op.crfd, static_cast(ppu.gpr[op.ra]), op.simm16); - } + if (op.l10) + { + ppu_cr_set(ppu, op.crfd, ppu.gpr[op.ra], op.simm16); + } + else + { + ppu_cr_set(ppu, op.crfd, static_cast(ppu.gpr[op.ra]), op.simm16); + } }; RETURN_(ppu, op); } @@ -3157,13 +3164,15 @@ auto ADDIC() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const s64 a = ppu.gpr[op.ra]; - const s64 i = op.simm16; - const auto r = add64_flags(a, i); - ppu.gpr[op.rd] = r.result; - ppu.xer.ca = r.carry; - if (op.main & 1) [[unlikely]] ppu_cr_set(ppu, 0, r.result, 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const s64 a = ppu.gpr[op.ra]; + const s64 i = op.simm16; + const auto r = add64_flags(a, i); + ppu.gpr[op.rd] = r.result; + ppu.xer.ca = r.carry; + if (op.main & 1) [[unlikely]] + ppu_cr_set(ppu, 0, r.result, 0); }; RETURN_(ppu, op); } @@ -3174,8 +3183,9 @@ auto ADDI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.rd] = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.rd] = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16; }; RETURN_(ppu, op); } @@ -3186,8 +3196,9 @@ auto ADDIS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.rd] = op.ra ? ppu.gpr[op.ra] + (op.simm16 * 65536) : (op.simm16 * 65536); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.rd] = op.ra ? ppu.gpr[op.ra] + (op.simm16 * 65536) : (op.simm16 * 65536); }; RETURN_(ppu, op); } @@ -3198,42 +3209,44 @@ auto BC() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - if constexpr (Build == 0) return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) - { - const bool bo0 = (op.bo & 0x10) != 0; - const bool bo1 = (op.bo & 0x08) != 0; - const bool bo2 = (op.bo & 0x04) != 0; - const bool bo3 = (op.bo & 0x02) != 0; + if constexpr (Build == 0) + return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) + { + const bool bo0 = (op.bo & 0x10) != 0; + const bool bo1 = (op.bo & 0x08) != 0; + const bool bo2 = (op.bo & 0x04) != 0; + const bool bo3 = (op.bo & 0x02) != 0; - ppu.ctr -= (bo2 ^ true); - const u32 link = vm::get_addr(this_op) + 4; - if (op.lk) ppu.lr = link; + ppu.ctr -= (bo2 ^ true); + const u32 link = vm::get_addr(this_op) + 4; + if (op.lk) + ppu.lr = link; - const bool ctr_ok = bo2 | ((ppu.ctr != 0) ^ bo3); - const bool cond_ok = bo0 | (!!(ppu.cr[op.bi]) ^ (bo1 ^ true)); + const bool ctr_ok = bo2 | ((ppu.ctr != 0) ^ bo3); + const bool cond_ok = bo0 | (!!(ppu.cr[op.bi]) ^ (bo1 ^ true)); - const u32 old_cia = ppu.cia; + const u32 old_cia = ppu.cia; - if (ctr_ok && cond_ok) - { - ppu.cia = vm::get_addr(this_op); - // Provide additional information by using the origin of the call - // Because this is a fixed target branch there's no abiguity about it - ppu_record_call(ppu, ppu.cia, op); + if (ctr_ok && cond_ok) + { + ppu.cia = vm::get_addr(this_op); + // Provide additional information by using the origin of the call + // Because this is a fixed target branch there's no abiguity about it + ppu_record_call(ppu, ppu.cia, op); - ppu.cia = (op.aa ? 0 : ppu.cia) + op.bt14; - } - else if (!ppu.state) [[likely]] - { - return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); - } - else - { - ppu.cia = link; - } + ppu.cia = (op.aa ? 0 : ppu.cia) + op.bt14; + } + else if (!ppu.state) [[likely]] + { + return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); + } + else + { + ppu.cia = link; + } - ppu.exec_bytes += link - old_cia; - }; + ppu.exec_bytes += link - old_cia; + }; } template @@ -3265,18 +3278,20 @@ auto B() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - if constexpr (Build == 0) return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func*) - { - const u32 old_cia = ppu.cia; - const u32 link = (ppu.cia = vm::get_addr(this_op)) + 4; - // Provide additional information by using the origin of the call - // Because this is a fixed target branch there's no abiguity about it - ppu_record_call(ppu, ppu.cia, op); + if constexpr (Build == 0) + return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func*) + { + const u32 old_cia = ppu.cia; + const u32 link = (ppu.cia = vm::get_addr(this_op)) + 4; + // Provide additional information by using the origin of the call + // Because this is a fixed target branch there's no abiguity about it + ppu_record_call(ppu, ppu.cia, op); - ppu.cia = (op.aa ? 0 : ppu.cia) + op.bt24; - if (op.lk) ppu.lr = link; - ppu.exec_bytes += link - old_cia; - }; + ppu.cia = (op.aa ? 0 : ppu.cia) + op.bt24; + if (op.lk) + ppu.lr = link; + ppu.exec_bytes += link - old_cia; + }; } template @@ -3285,9 +3300,10 @@ auto MCRF() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - CHECK_SIZE(ppu_thread::cr, 32); - ppu.cr.fields[op.crfd] = ppu.cr.fields[op.crfs]; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + CHECK_SIZE(ppu_thread::cr, 32); + ppu.cr.fields[op.crfd] = ppu.cr.fields[op.crfs]; }; RETURN_(ppu, op); } @@ -3298,40 +3314,42 @@ auto BCLR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - if constexpr (Build == 0) return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) - { - const bool bo0 = (op.bo & 0x10) != 0; - const bool bo1 = (op.bo & 0x08) != 0; - const bool bo2 = (op.bo & 0x04) != 0; - const bool bo3 = (op.bo & 0x02) != 0; + if constexpr (Build == 0) + return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) + { + const bool bo0 = (op.bo & 0x10) != 0; + const bool bo1 = (op.bo & 0x08) != 0; + const bool bo2 = (op.bo & 0x04) != 0; + const bool bo3 = (op.bo & 0x02) != 0; - ppu.ctr -= (bo2 ^ true); + ppu.ctr -= (bo2 ^ true); - const bool ctr_ok = bo2 | ((ppu.ctr != 0) ^ bo3); - const bool cond_ok = bo0 | (!!(ppu.cr[op.bi]) ^ (bo1 ^ true)); + const bool ctr_ok = bo2 | ((ppu.ctr != 0) ^ bo3); + const bool cond_ok = bo0 | (!!(ppu.cr[op.bi]) ^ (bo1 ^ true)); - const u32 target = static_cast(ppu.lr) & ~3; - const u32 link = vm::get_addr(this_op) + 4; - if (op.lk) ppu.lr = link; + const u32 target = static_cast(ppu.lr) & ~3; + const u32 link = vm::get_addr(this_op) + 4; + if (op.lk) + ppu.lr = link; - const u32 old_cia = ppu.cia; + const u32 old_cia = ppu.cia; - if (ctr_ok && cond_ok) - { - ppu_record_call(ppu, target, op, true); - ppu.cia = target; - } - else if (!ppu.state) [[likely]] - { - return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); - } - else - { - ppu.cia = link; - } + if (ctr_ok && cond_ok) + { + ppu_record_call(ppu, target, op, true); + ppu.cia = target; + } + else if (!ppu.state) [[likely]] + { + return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); + } + else + { + ppu.cia = link; + } - ppu.exec_bytes += link - old_cia; - }; + ppu.exec_bytes += link - old_cia; + }; } template @@ -3340,8 +3358,9 @@ auto CRNOR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.cr[op.crbd] = (ppu.cr[op.crba] | ppu.cr[op.crbb]) ^ true; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.cr[op.crbd] = (ppu.cr[op.crba] | ppu.cr[op.crbb]) ^ true; }; RETURN_(ppu, op); } @@ -3352,8 +3371,9 @@ auto CRANDC() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.cr[op.crbd] = ppu.cr[op.crba] & (ppu.cr[op.crbb] ^ true); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.cr[op.crbd] = ppu.cr[op.crba] & (ppu.cr[op.crbb] ^ true); }; RETURN_(ppu, op); } @@ -3364,8 +3384,9 @@ auto ISYNC() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - atomic_fence_acquire(); + static const auto exec = [](auto&&, auto) + { + atomic_fence_acquire(); }; RETURN_(ppu, op); } @@ -3376,8 +3397,9 @@ auto CRXOR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.cr[op.crbd] = ppu.cr[op.crba] ^ ppu.cr[op.crbb]; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.cr[op.crbd] = ppu.cr[op.crba] ^ ppu.cr[op.crbb]; }; RETURN_(ppu, op); } @@ -3388,8 +3410,9 @@ auto CRNAND() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.cr[op.crbd] = (ppu.cr[op.crba] & ppu.cr[op.crbb]) ^ true; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.cr[op.crbd] = (ppu.cr[op.crba] & ppu.cr[op.crbb]) ^ true; }; RETURN_(ppu, op); } @@ -3400,8 +3423,9 @@ auto CRAND() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.cr[op.crbd] = ppu.cr[op.crba] & ppu.cr[op.crbb]; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.cr[op.crbd] = ppu.cr[op.crba] & ppu.cr[op.crbb]; }; RETURN_(ppu, op); } @@ -3412,8 +3436,9 @@ auto CREQV() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.cr[op.crbd] = (ppu.cr[op.crba] ^ ppu.cr[op.crbb]) ^ true; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.cr[op.crbd] = (ppu.cr[op.crba] ^ ppu.cr[op.crbb]) ^ true; }; RETURN_(ppu, op); } @@ -3424,8 +3449,9 @@ auto CRORC() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.cr[op.crbd] = ppu.cr[op.crba] | (ppu.cr[op.crbb] ^ true); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.cr[op.crbd] = ppu.cr[op.crba] | (ppu.cr[op.crbb] ^ true); }; RETURN_(ppu, op); } @@ -3436,8 +3462,9 @@ auto CROR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.cr[op.crbd] = ppu.cr[op.crba] | ppu.cr[op.crbb]; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.cr[op.crbd] = ppu.cr[op.crba] | ppu.cr[op.crbb]; }; RETURN_(ppu, op); } @@ -3448,29 +3475,31 @@ auto BCCTR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - if constexpr (Build == 0) return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) - { - const u32 link = vm::get_addr(this_op) + 4; - if (op.lk) ppu.lr = link; - const u32 old_cia = ppu.cia; + if constexpr (Build == 0) + return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) + { + const u32 link = vm::get_addr(this_op) + 4; + if (op.lk) + ppu.lr = link; + const u32 old_cia = ppu.cia; - if (op.bo & 0x10 || ppu.cr[op.bi] == ((op.bo & 0x8) != 0)) - { - const u32 target = static_cast(ppu.ctr) & ~3; - ppu_record_call(ppu, target, op, true); - ppu.cia = target; - } - else if (!ppu.state) [[likely]] - { - return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); - } - else - { - ppu.cia = link; - } + if (op.bo & 0x10 || ppu.cr[op.bi] == ((op.bo & 0x8) != 0)) + { + const u32 target = static_cast(ppu.ctr) & ~3; + ppu_record_call(ppu, target, op, true); + ppu.cia = target; + } + else if (!ppu.state) [[likely]] + { + return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); + } + else + { + ppu.cia = link; + } - ppu.exec_bytes += link - old_cia; - }; + ppu.exec_bytes += link - old_cia; + }; } template @@ -3479,11 +3508,12 @@ auto RLWIMI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 mask = ppu_rotate_mask(32 + op.mb32, 32 + op.me32); - ppu.gpr[op.ra] = (ppu.gpr[op.ra] & ~mask) | (dup32(utils::rol32(static_cast(ppu.gpr[op.rs]), op.sh32)) & mask); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 mask = ppu_rotate_mask(32 + op.mb32, 32 + op.me32); + ppu.gpr[op.ra] = (ppu.gpr[op.ra] & ~mask) | (dup32(utils::rol32(static_cast(ppu.gpr[op.rs]), op.sh32)) & mask); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3494,10 +3524,11 @@ auto RLWINM() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = dup32(utils::rol32(static_cast(ppu.gpr[op.rs]), op.sh32)) & ppu_rotate_mask(32 + op.mb32, 32 + op.me32); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = dup32(utils::rol32(static_cast(ppu.gpr[op.rs]), op.sh32)) & ppu_rotate_mask(32 + op.mb32, 32 + op.me32); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3508,10 +3539,11 @@ auto RLWNM() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = dup32(utils::rol32(static_cast(ppu.gpr[op.rs]), ppu.gpr[op.rb] & 0x1f)) & ppu_rotate_mask(32 + op.mb32, 32 + op.me32); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = dup32(utils::rol32(static_cast(ppu.gpr[op.rs]), ppu.gpr[op.rb] & 0x1f)) & ppu_rotate_mask(32 + op.mb32, 32 + op.me32); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3522,8 +3554,9 @@ auto ORI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ppu.gpr[op.rs] | op.uimm16; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ppu.gpr[op.rs] | op.uimm16; }; RETURN_(ppu, op); } @@ -3534,8 +3567,9 @@ auto ORIS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ppu.gpr[op.rs] | (u64{op.uimm16} << 16); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ppu.gpr[op.rs] | (u64{op.uimm16} << 16); }; RETURN_(ppu, op); } @@ -3546,8 +3580,9 @@ auto XORI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ppu.gpr[op.rs] ^ op.uimm16; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ppu.gpr[op.rs] ^ op.uimm16; }; RETURN_(ppu, op); } @@ -3558,8 +3593,9 @@ auto XORIS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ppu.gpr[op.rs] ^ (u64{op.uimm16} << 16); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ppu.gpr[op.rs] ^ (u64{op.uimm16} << 16); }; RETURN_(ppu, op); } @@ -3570,9 +3606,10 @@ auto ANDI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ppu.gpr[op.rs] & op.uimm16; - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ppu.gpr[op.rs] & op.uimm16; + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3583,9 +3620,10 @@ auto ANDIS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ppu.gpr[op.rs] & (u64{op.uimm16} << 16); - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ppu.gpr[op.rs] & (u64{op.uimm16} << 16); + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3596,10 +3634,11 @@ auto RLDICL() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = utils::rol64(ppu.gpr[op.rs], op.sh64) & (~0ull >> op.mbe64); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = utils::rol64(ppu.gpr[op.rs], op.sh64) & (~0ull >> op.mbe64); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3610,10 +3649,11 @@ auto RLDICR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = utils::rol64(ppu.gpr[op.rs], op.sh64) & (~0ull << (op.mbe64 ^ 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = utils::rol64(ppu.gpr[op.rs], op.sh64) & (~0ull << (op.mbe64 ^ 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3624,10 +3664,11 @@ auto RLDIC() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = utils::rol64(ppu.gpr[op.rs], op.sh64) & ppu_rotate_mask(op.mbe64, op.sh64 ^ 63); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = utils::rol64(ppu.gpr[op.rs], op.sh64) & ppu_rotate_mask(op.mbe64, op.sh64 ^ 63); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3638,11 +3679,12 @@ auto RLDIMI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 mask = ppu_rotate_mask(op.mbe64, op.sh64 ^ 63); - ppu.gpr[op.ra] = (ppu.gpr[op.ra] & ~mask) | (utils::rol64(ppu.gpr[op.rs], op.sh64) & mask); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 mask = ppu_rotate_mask(op.mbe64, op.sh64 ^ 63); + ppu.gpr[op.ra] = (ppu.gpr[op.ra] & ~mask) | (utils::rol64(ppu.gpr[op.rs], op.sh64) & mask); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3653,10 +3695,11 @@ auto RLDCL() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = utils::rol64(ppu.gpr[op.rs], ppu.gpr[op.rb] & 0x3f) & (~0ull >> op.mbe64); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = utils::rol64(ppu.gpr[op.rs], ppu.gpr[op.rb] & 0x3f) & (~0ull >> op.mbe64); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3667,10 +3710,11 @@ auto RLDCR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = utils::rol64(ppu.gpr[op.rs], ppu.gpr[op.rb] & 0x3f) & (~0ull << (op.mbe64 ^ 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = utils::rol64(ppu.gpr[op.rs], ppu.gpr[op.rb] & 0x3f) & (~0ull << (op.mbe64 ^ 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3681,15 +3725,16 @@ auto CMP() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if (op.l10) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu_cr_set(ppu, op.crfd, ppu.gpr[op.ra], ppu.gpr[op.rb]); - } - else - { - ppu_cr_set(ppu, op.crfd, static_cast(ppu.gpr[op.ra]), static_cast(ppu.gpr[op.rb])); - } + if (op.l10) + { + ppu_cr_set(ppu, op.crfd, ppu.gpr[op.ra], ppu.gpr[op.rb]); + } + else + { + ppu_cr_set(ppu, op.crfd, static_cast(ppu.gpr[op.ra]), static_cast(ppu.gpr[op.rb])); + } }; RETURN_(ppu, op); } @@ -3700,45 +3745,45 @@ auto TW() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - if constexpr (Build == 0) return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) - { - s32 a = static_cast(ppu.gpr[op.ra]); - s32 b = static_cast(ppu.gpr[op.rb]); + if constexpr (Build == 0) + return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) + { + s32 a = static_cast(ppu.gpr[op.ra]); + s32 b = static_cast(ppu.gpr[op.rb]); - if ((a < b && (op.bo & 0x10)) || - (a > b && (op.bo & 0x8)) || - (a == b && (op.bo & 0x4)) || - (static_cast(a) < static_cast(b) && (op.bo & 0x2)) || - (static_cast(a) > static_cast(b) && (op.bo & 0x1))) - { - [[unlikely]] - ppu_trap(ppu, vm::get_addr(this_op)); - return; - } - return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); - }; + if ((a < b && (op.bo & 0x10)) || + (a > b && (op.bo & 0x8)) || + (a == b && (op.bo & 0x4)) || + (static_cast(a) < static_cast(b) && (op.bo & 0x2)) || + (static_cast(a) > static_cast(b) && (op.bo & 0x1))) + { + [[unlikely]] ppu_trap(ppu, vm::get_addr(this_op)); + return; + } + return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); + }; } const v128 s_lvsl_base = v128::from64r(0x0001020304050607, 0x08090a0b0c0d0e0f); const v128 s_lvsl_consts[16] = -{ - gv_add8(s_lvsl_base, gv_bcst8(0)), - gv_add8(s_lvsl_base, gv_bcst8(1)), - gv_add8(s_lvsl_base, gv_bcst8(2)), - gv_add8(s_lvsl_base, gv_bcst8(3)), - gv_add8(s_lvsl_base, gv_bcst8(4)), - gv_add8(s_lvsl_base, gv_bcst8(5)), - gv_add8(s_lvsl_base, gv_bcst8(6)), - gv_add8(s_lvsl_base, gv_bcst8(7)), - gv_add8(s_lvsl_base, gv_bcst8(8)), - gv_add8(s_lvsl_base, gv_bcst8(9)), - gv_add8(s_lvsl_base, gv_bcst8(10)), - gv_add8(s_lvsl_base, gv_bcst8(11)), - gv_add8(s_lvsl_base, gv_bcst8(12)), - gv_add8(s_lvsl_base, gv_bcst8(13)), - gv_add8(s_lvsl_base, gv_bcst8(14)), - gv_add8(s_lvsl_base, gv_bcst8(15)), + { + gv_add8(s_lvsl_base, gv_bcst8(0)), + gv_add8(s_lvsl_base, gv_bcst8(1)), + gv_add8(s_lvsl_base, gv_bcst8(2)), + gv_add8(s_lvsl_base, gv_bcst8(3)), + gv_add8(s_lvsl_base, gv_bcst8(4)), + gv_add8(s_lvsl_base, gv_bcst8(5)), + gv_add8(s_lvsl_base, gv_bcst8(6)), + gv_add8(s_lvsl_base, gv_bcst8(7)), + gv_add8(s_lvsl_base, gv_bcst8(8)), + gv_add8(s_lvsl_base, gv_bcst8(9)), + gv_add8(s_lvsl_base, gv_bcst8(10)), + gv_add8(s_lvsl_base, gv_bcst8(11)), + gv_add8(s_lvsl_base, gv_bcst8(12)), + gv_add8(s_lvsl_base, gv_bcst8(13)), + gv_add8(s_lvsl_base, gv_bcst8(14)), + gv_add8(s_lvsl_base, gv_bcst8(15)), }; template @@ -3762,9 +3807,10 @@ auto LVEBX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; - ppu.vr[op.vd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; + ppu.vr[op.vd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -3775,16 +3821,17 @@ auto SUBFC() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 RA = ppu.gpr[op.ra]; - const u64 RB = ppu.gpr[op.rb]; - const auto r = add64_flags(~RA, RB, 1); - ppu.gpr[op.rd] = r.result; - ppu.xer.ca = r.carry; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, (~RA >> 63 == RB >> 63) && (~RA >> 63 != ppu.gpr[op.rd] >> 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, r.result, 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 RA = ppu.gpr[op.ra]; + const u64 RB = ppu.gpr[op.rb]; + const auto r = add64_flags(~RA, RB, 1); + ppu.gpr[op.rd] = r.result; + ppu.xer.ca = r.carry; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, (~RA >> 63 == RB >> 63) && (~RA >> 63 != ppu.gpr[op.rd] >> 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, r.result, 0); }; RETURN_(ppu, op); } @@ -3795,10 +3842,11 @@ auto MULHDU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.rd] = utils::umulh64(ppu.gpr[op.ra], ppu.gpr[op.rb]); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.rd] = utils::umulh64(ppu.gpr[op.ra], ppu.gpr[op.rb]); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -3809,16 +3857,17 @@ auto ADDC() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 RA = ppu.gpr[op.ra]; - const u64 RB = ppu.gpr[op.rb]; - const auto r = add64_flags(RA, RB); - ppu.gpr[op.rd] = r.result; - ppu.xer.ca = r.carry; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, (RA >> 63 == RB >> 63) && (RA >> 63 != ppu.gpr[op.rd] >> 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, r.result, 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 RA = ppu.gpr[op.ra]; + const u64 RB = ppu.gpr[op.rb]; + const auto r = add64_flags(RA, RB); + ppu.gpr[op.rd] = r.result; + ppu.xer.ca = r.carry; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, (RA >> 63 == RB >> 63) && (RA >> 63 != ppu.gpr[op.rd] >> 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, r.result, 0); }; RETURN_(ppu, op); } @@ -3829,12 +3878,13 @@ auto MULHWU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - u32 a = static_cast(ppu.gpr[op.ra]); - u32 b = static_cast(ppu.gpr[op.rb]); - ppu.gpr[op.rd] = (u64{a} * b) >> 32; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + u32 a = static_cast(ppu.gpr[op.ra]); + u32 b = static_cast(ppu.gpr[op.rb]); + ppu.gpr[op.rd] = (u64{a} * b) >> 32; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -3893,9 +3943,10 @@ auto LWARX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_lwarx(ppu, vm::cast(addr)); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_lwarx(ppu, vm::cast(addr)); }; RETURN_(ppu, op); } @@ -3906,9 +3957,10 @@ auto LDX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -3919,9 +3971,10 @@ auto LWZX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -3932,10 +3985,11 @@ auto SLW() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = static_cast(ppu.gpr[op.rs] << (ppu.gpr[op.rb] & 0x3f)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = static_cast(ppu.gpr[op.rs] << (ppu.gpr[op.rb] & 0x3f)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3946,10 +4000,11 @@ auto CNTLZW() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = std::countl_zero(static_cast(ppu.gpr[op.rs])); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = std::countl_zero(static_cast(ppu.gpr[op.rs])); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3960,11 +4015,12 @@ auto SLD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u32 n = ppu.gpr[op.rb] & 0x7f; - ppu.gpr[op.ra] = n & 0x40 ? 0 : ppu.gpr[op.rs] << n; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u32 n = ppu.gpr[op.rb] & 0x7f; + ppu.gpr[op.ra] = n & 0x40 ? 0 : ppu.gpr[op.rs] << n; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3975,10 +4031,11 @@ auto AND() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ppu.gpr[op.rs] & ppu.gpr[op.rb]; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ppu.gpr[op.rs] & ppu.gpr[op.rb]; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -3989,37 +4046,38 @@ auto CMPL() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if (op.l10) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu_cr_set(ppu, op.crfd, ppu.gpr[op.ra], ppu.gpr[op.rb]); - } - else - { - ppu_cr_set(ppu, op.crfd, static_cast(ppu.gpr[op.ra]), static_cast(ppu.gpr[op.rb])); - } + if (op.l10) + { + ppu_cr_set(ppu, op.crfd, ppu.gpr[op.ra], ppu.gpr[op.rb]); + } + else + { + ppu_cr_set(ppu, op.crfd, static_cast(ppu.gpr[op.ra]), static_cast(ppu.gpr[op.rb])); + } }; RETURN_(ppu, op); } const v128 s_lvsr_consts[16] = -{ - gv_add8(s_lvsl_base, gv_bcst8(16)), - gv_add8(s_lvsl_base, gv_bcst8(15)), - gv_add8(s_lvsl_base, gv_bcst8(14)), - gv_add8(s_lvsl_base, gv_bcst8(13)), - gv_add8(s_lvsl_base, gv_bcst8(12)), - gv_add8(s_lvsl_base, gv_bcst8(11)), - gv_add8(s_lvsl_base, gv_bcst8(10)), - gv_add8(s_lvsl_base, gv_bcst8(9)), - gv_add8(s_lvsl_base, gv_bcst8(8)), - gv_add8(s_lvsl_base, gv_bcst8(7)), - gv_add8(s_lvsl_base, gv_bcst8(6)), - gv_add8(s_lvsl_base, gv_bcst8(5)), - gv_add8(s_lvsl_base, gv_bcst8(4)), - gv_add8(s_lvsl_base, gv_bcst8(3)), - gv_add8(s_lvsl_base, gv_bcst8(2)), - gv_add8(s_lvsl_base, gv_bcst8(1)), + { + gv_add8(s_lvsl_base, gv_bcst8(16)), + gv_add8(s_lvsl_base, gv_bcst8(15)), + gv_add8(s_lvsl_base, gv_bcst8(14)), + gv_add8(s_lvsl_base, gv_bcst8(13)), + gv_add8(s_lvsl_base, gv_bcst8(12)), + gv_add8(s_lvsl_base, gv_bcst8(11)), + gv_add8(s_lvsl_base, gv_bcst8(10)), + gv_add8(s_lvsl_base, gv_bcst8(9)), + gv_add8(s_lvsl_base, gv_bcst8(8)), + gv_add8(s_lvsl_base, gv_bcst8(7)), + gv_add8(s_lvsl_base, gv_bcst8(6)), + gv_add8(s_lvsl_base, gv_bcst8(5)), + gv_add8(s_lvsl_base, gv_bcst8(4)), + gv_add8(s_lvsl_base, gv_bcst8(3)), + gv_add8(s_lvsl_base, gv_bcst8(2)), + gv_add8(s_lvsl_base, gv_bcst8(1)), }; template @@ -4043,9 +4101,10 @@ auto LVEHX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; - ppu.vr[op.vd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; + ppu.vr[op.vd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -4056,14 +4115,15 @@ auto SUBF() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 RA = ppu.gpr[op.ra]; - const u64 RB = ppu.gpr[op.rb]; - ppu.gpr[op.rd] = RB - RA; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, (~RA >> 63 == RB >> 63) && (~RA >> 63 != ppu.gpr[op.rd] >> 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 RA = ppu.gpr[op.ra]; + const u64 RB = ppu.gpr[op.rb]; + ppu.gpr[op.rd] = RB - RA; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, (~RA >> 63 == RB >> 63) && (~RA >> 63 != ppu.gpr[op.rd] >> 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -4074,10 +4134,11 @@ auto LDUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -4088,8 +4149,7 @@ auto DCBST() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - }; + static const auto exec = [](auto&&, auto) {}; RETURN_(ppu, op); } @@ -4099,10 +4159,11 @@ auto LWZUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -4113,10 +4174,11 @@ auto CNTLZD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = std::countl_zero(ppu.gpr[op.rs]); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = std::countl_zero(ppu.gpr[op.rs]); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -4127,10 +4189,11 @@ auto ANDC() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ppu.gpr[op.rs] & ~ppu.gpr[op.rb]; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ppu.gpr[op.rs] & ~ppu.gpr[op.rb]; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -4141,23 +4204,23 @@ auto TD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - if constexpr (Build == 0) return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) - { - const s64 a = ppu.gpr[op.ra], b = ppu.gpr[op.rb]; - const u64 a_ = a, b_ = b; + if constexpr (Build == 0) + return +[](ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) + { + const s64 a = ppu.gpr[op.ra], b = ppu.gpr[op.rb]; + const u64 a_ = a, b_ = b; - if (((op.bo & 0x10) && a < b) || - ((op.bo & 0x8) && a > b) || - ((op.bo & 0x4) && a == b) || - ((op.bo & 0x2) && a_ < b_) || - ((op.bo & 0x1) && a_ > b_)) - { - [[unlikely]] - ppu_trap(ppu, vm::get_addr(this_op)); - return; - } - return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); - }; + if (((op.bo & 0x10) && a < b) || + ((op.bo & 0x8) && a > b) || + ((op.bo & 0x4) && a == b) || + ((op.bo & 0x2) && a_ < b_) || + ((op.bo & 0x1) && a_ > b_)) + { + [[unlikely]] ppu_trap(ppu, vm::get_addr(this_op)); + return; + } + return next_fn->fn(ppu, {this_op[1]}, this_op + 1, next_fn + 1); + }; } template @@ -4166,9 +4229,10 @@ auto LVEWX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; - ppu.vr[op.vd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; + ppu.vr[op.vd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -4179,10 +4243,11 @@ auto MULHD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.rd] = utils::mulh64(ppu.gpr[op.ra], ppu.gpr[op.rb]); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.rd] = utils::mulh64(ppu.gpr[op.ra], ppu.gpr[op.rb]); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -4193,12 +4258,13 @@ auto MULHW() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - s32 a = static_cast(ppu.gpr[op.ra]); - s32 b = static_cast(ppu.gpr[op.rb]); - ppu.gpr[op.rd] = (s64{a} * b) >> 32; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + s32 a = static_cast(ppu.gpr[op.ra]); + s32 b = static_cast(ppu.gpr[op.rb]); + ppu.gpr[op.rd] = (s64{a} * b) >> 32; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -4209,9 +4275,10 @@ auto LDARX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_ldarx(ppu, vm::cast(addr)); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_ldarx(ppu, vm::cast(addr)); }; RETURN_(ppu, op); } @@ -4222,8 +4289,7 @@ auto DCBF() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - }; + static const auto exec = [](auto&&, auto) {}; RETURN_(ppu, op); } @@ -4233,9 +4299,10 @@ auto LBZX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -4246,9 +4313,10 @@ auto LVX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; - ppu.vr[op.vd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; + ppu.vr[op.vd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -4259,13 +4327,14 @@ auto NEG() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 RA = ppu.gpr[op.ra]; - ppu.gpr[op.rd] = 0 - RA; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, RA == (1ull << 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 RA = ppu.gpr[op.ra]; + ppu.gpr[op.rd] = 0 - RA; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, RA == (1ull << 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -4276,10 +4345,11 @@ auto LBZUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -4290,10 +4360,11 @@ auto NOR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ~(ppu.gpr[op.rs] | ppu.gpr[op.rb]); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ~(ppu.gpr[op.rs] | ppu.gpr[op.rb]); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -4304,10 +4375,11 @@ auto STVEBX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - const u8 eb = addr & 0xf; - PPU_WRITE_8(vm::cast(addr), ppu.vr[op.vs]._u8[15 - eb]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + const u8 eb = addr & 0xf; + PPU_WRITE_8(vm::cast(addr), ppu.vr[op.vs]._u8[15 - eb]); }; RETURN_(ppu, op); } @@ -4318,16 +4390,17 @@ auto SUBFE() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 RA = ppu.gpr[op.ra]; - const u64 RB = ppu.gpr[op.rb]; - const auto r = add64_flags(~RA, RB, ppu.xer.ca); - ppu.gpr[op.rd] = r.result; - ppu.xer.ca = r.carry; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, (~RA >> 63 == RB >> 63) && (~RA >> 63 != ppu.gpr[op.rd] >> 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, r.result, 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 RA = ppu.gpr[op.ra]; + const u64 RB = ppu.gpr[op.rb]; + const auto r = add64_flags(~RA, RB, ppu.xer.ca); + ppu.gpr[op.rd] = r.result; + ppu.xer.ca = r.carry; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, (~RA >> 63 == RB >> 63) && (~RA >> 63 != ppu.gpr[op.rd] >> 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, r.result, 0); }; RETURN_(ppu, op); } @@ -4338,16 +4411,17 @@ auto ADDE() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 RA = ppu.gpr[op.ra]; - const u64 RB = ppu.gpr[op.rb]; - const auto r = add64_flags(RA, RB, ppu.xer.ca); - ppu.gpr[op.rd] = r.result; - ppu.xer.ca = r.carry; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, (RA >> 63 == RB >> 63) && (RA >> 63 != ppu.gpr[op.rd] >> 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, r.result, 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 RA = ppu.gpr[op.ra]; + const u64 RB = ppu.gpr[op.rb]; + const auto r = add64_flags(RA, RB, ppu.xer.ca); + ppu.gpr[op.rd] = r.result; + ppu.xer.ca = r.carry; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, (RA >> 63 == RB >> 63) && (RA >> 63 != ppu.gpr[op.rd] >> 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, r.result, 0); }; RETURN_(ppu, op); } @@ -4358,50 +4432,50 @@ auto MTOCRF() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - alignas(4) static const u8 s_table[16][4] + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - {0, 0, 0, 0}, - {0, 0, 0, 1}, - {0, 0, 1, 0}, - {0, 0, 1, 1}, - {0, 1, 0, 0}, - {0, 1, 0, 1}, - {0, 1, 1, 0}, - {0, 1, 1, 1}, - {1, 0, 0, 0}, - {1, 0, 0, 1}, - {1, 0, 1, 0}, - {1, 0, 1, 1}, - {1, 1, 0, 0}, - {1, 1, 0, 1}, - {1, 1, 1, 0}, - {1, 1, 1, 1}, - }; + alignas(4) static const u8 s_table[16][4]{ + {0, 0, 0, 0}, + {0, 0, 0, 1}, + {0, 0, 1, 0}, + {0, 0, 1, 1}, + {0, 1, 0, 0}, + {0, 1, 0, 1}, + {0, 1, 1, 0}, + {0, 1, 1, 1}, + {1, 0, 0, 0}, + {1, 0, 0, 1}, + {1, 0, 1, 0}, + {1, 0, 1, 1}, + {1, 1, 0, 0}, + {1, 1, 0, 1}, + {1, 1, 1, 0}, + {1, 1, 1, 1}, + }; - const u64 s = ppu.gpr[op.rs]; + const u64 s = ppu.gpr[op.rs]; - if (op.l11) - { - // MTOCRF - - const u32 n = std::countl_zero(op.crm) & 7; - const u64 v = (s >> ((n * 4) ^ 0x1c)) & 0xf; - ppu.cr.fields[n] = *reinterpret_cast(s_table + v); - } - else - { - // MTCRF - - for (u32 i = 0; i < 8; i++) + if (op.l11) { - if (op.crm & (128 >> i)) + // MTOCRF + + const u32 n = std::countl_zero(op.crm) & 7; + const u64 v = (s >> ((n * 4) ^ 0x1c)) & 0xf; + ppu.cr.fields[n] = *reinterpret_cast(s_table + v); + } + else + { + // MTCRF + + for (u32 i = 0; i < 8; i++) { - const u64 v = (s >> ((i * 4) ^ 0x1c)) & 0xf; - ppu.cr.fields[i] = *reinterpret_cast(s_table + v); + if (op.crm & (128 >> i)) + { + const u64 v = (s >> ((i * 4) ^ 0x1c)) & 0xf; + ppu.cr.fields[i] = *reinterpret_cast(s_table + v); + } } } - } }; RETURN_(ppu, op); } @@ -4412,9 +4486,10 @@ auto STDX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - PPU_WRITE_64(vm::cast(addr), ppu.gpr[op.rs]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + PPU_WRITE_64(vm::cast(addr), ppu.gpr[op.rs]); }; RETURN_(ppu, op); } @@ -4425,9 +4500,10 @@ auto STWCX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu_cr_set(ppu, 0, false, false, ppu_stwcx(ppu, vm::cast(addr), static_cast(ppu.gpr[op.rs])), ppu.xer.so); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu_cr_set(ppu, 0, false, false, ppu_stwcx(ppu, vm::cast(addr), static_cast(ppu.gpr[op.rs])), ppu.xer.so); }; RETURN_(ppu, op); } @@ -4438,9 +4514,10 @@ auto STWX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - PPU_WRITE_32(vm::cast(addr), static_cast(ppu.gpr[op.rs])); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + PPU_WRITE_32(vm::cast(addr), static_cast(ppu.gpr[op.rs])); }; RETURN_(ppu, op); } @@ -4451,10 +4528,11 @@ auto STVEHX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~1ULL; - const u8 eb = (addr & 0xf) >> 1; - PPU_WRITE_16(vm::cast(addr), ppu.vr[op.vs]._u16[7 - eb]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~1ULL; + const u8 eb = (addr & 0xf) >> 1; + PPU_WRITE_16(vm::cast(addr), ppu.vr[op.vs]._u16[7 - eb]); }; RETURN_(ppu, op); } @@ -4465,10 +4543,11 @@ auto STDUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; - PPU_WRITE_64(vm::cast(addr), ppu.gpr[op.rs]); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; + PPU_WRITE_64(vm::cast(addr), ppu.gpr[op.rs]); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -4479,10 +4558,11 @@ auto STWUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; - PPU_WRITE_32(vm::cast(addr), static_cast(ppu.gpr[op.rs])); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; + PPU_WRITE_32(vm::cast(addr), static_cast(ppu.gpr[op.rs])); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -4493,10 +4573,11 @@ auto STVEWX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~3ULL; - const u8 eb = (addr & 0xf) >> 2; - PPU_WRITE_32(vm::cast(addr), ppu.vr[op.vs]._u32[3 - eb]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~3ULL; + const u8 eb = (addr & 0xf) >> 2; + PPU_WRITE_32(vm::cast(addr), ppu.vr[op.vs]._u32[3 - eb]); }; RETURN_(ppu, op); } @@ -4507,15 +4588,16 @@ auto SUBFZE() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 RA = ppu.gpr[op.ra]; - const auto r = add64_flags(~RA, 0, ppu.xer.ca); - ppu.gpr[op.rd] = r.result; - ppu.xer.ca = r.carry; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, (~RA >> 63 == 0) && (~RA >> 63 != ppu.gpr[op.rd] >> 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, r.result, 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 RA = ppu.gpr[op.ra]; + const auto r = add64_flags(~RA, 0, ppu.xer.ca); + ppu.gpr[op.rd] = r.result; + ppu.xer.ca = r.carry; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, (~RA >> 63 == 0) && (~RA >> 63 != ppu.gpr[op.rd] >> 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, r.result, 0); }; RETURN_(ppu, op); } @@ -4526,15 +4608,16 @@ auto ADDZE() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 RA = ppu.gpr[op.ra]; - const auto r = add64_flags(RA, 0, ppu.xer.ca); - ppu.gpr[op.rd] = r.result; - ppu.xer.ca = r.carry; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, (RA >> 63 == 0) && (RA >> 63 != ppu.gpr[op.rd] >> 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, r.result, 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 RA = ppu.gpr[op.ra]; + const auto r = add64_flags(RA, 0, ppu.xer.ca); + ppu.gpr[op.rd] = r.result; + ppu.xer.ca = r.carry; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, (RA >> 63 == 0) && (RA >> 63 != ppu.gpr[op.rd] >> 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, r.result, 0); }; RETURN_(ppu, op); } @@ -4545,9 +4628,10 @@ auto STDCX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu_cr_set(ppu, 0, false, false, ppu_stdcx(ppu, vm::cast(addr), ppu.gpr[op.rs]), ppu.xer.so); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu_cr_set(ppu, 0, false, false, ppu_stdcx(ppu, vm::cast(addr), ppu.gpr[op.rs]), ppu.xer.so); }; RETURN_(ppu, op); } @@ -4558,9 +4642,10 @@ auto STBX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - PPU_WRITE_8(vm::cast(addr), static_cast(ppu.gpr[op.rs])); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + PPU_WRITE_8(vm::cast(addr), static_cast(ppu.gpr[op.rs])); }; RETURN_(ppu, op); } @@ -4571,9 +4656,10 @@ auto STVX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; - vm::_ref(vm::cast(addr)) = ppu.vr[op.vs]; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; + vm::_ref(vm::cast(addr)) = ppu.vr[op.vs]; }; RETURN_(ppu, op); } @@ -4584,17 +4670,18 @@ auto MULLD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const s64 RA = ppu.gpr[op.ra]; - const s64 RB = ppu.gpr[op.rb]; - ppu.gpr[op.rd] = RA * RB; - if (op.oe) [[unlikely]] + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const s64 high = utils::mulh64(RA, RB); - ppu_ov_set(ppu, high != s64(ppu.gpr[op.rd]) >> 63); - } - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + const s64 RA = ppu.gpr[op.ra]; + const s64 RB = ppu.gpr[op.rb]; + ppu.gpr[op.rd] = RA * RB; + if (op.oe) [[unlikely]] + { + const s64 high = utils::mulh64(RA, RB); + ppu_ov_set(ppu, high != s64(ppu.gpr[op.rd]) >> 63); + } + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -4605,15 +4692,16 @@ auto SUBFME() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 RA = ppu.gpr[op.ra]; - const auto r = add64_flags(~RA, ~0ull, ppu.xer.ca); - ppu.gpr[op.rd] = r.result; - ppu.xer.ca = r.carry; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, (~RA >> 63 == 1) && (~RA >> 63 != ppu.gpr[op.rd] >> 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, r.result, 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 RA = ppu.gpr[op.ra]; + const auto r = add64_flags(~RA, ~0ull, ppu.xer.ca); + ppu.gpr[op.rd] = r.result; + ppu.xer.ca = r.carry; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, (~RA >> 63 == 1) && (~RA >> 63 != ppu.gpr[op.rd] >> 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, r.result, 0); }; RETURN_(ppu, op); } @@ -4624,15 +4712,16 @@ auto ADDME() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const s64 RA = ppu.gpr[op.ra]; - const auto r = add64_flags(RA, ~0ull, ppu.xer.ca); - ppu.gpr[op.rd] = r.result; - ppu.xer.ca = r.carry; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, (u64(RA) >> 63 == 1) && (u64(RA) >> 63 != ppu.gpr[op.rd] >> 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, r.result, 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const s64 RA = ppu.gpr[op.ra]; + const auto r = add64_flags(RA, ~0ull, ppu.xer.ca); + ppu.gpr[op.rd] = r.result; + ppu.xer.ca = r.carry; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, (u64(RA) >> 63 == 1) && (u64(RA) >> 63 != ppu.gpr[op.rd] >> 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, r.result, 0); }; RETURN_(ppu, op); } @@ -4643,12 +4732,13 @@ auto MULLW() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.rd] = s64{static_cast(ppu.gpr[op.ra])} * static_cast(ppu.gpr[op.rb]); - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, s64(ppu.gpr[op.rd]) < INT32_MIN || s64(ppu.gpr[op.rd]) > INT32_MAX); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.rd] = s64{static_cast(ppu.gpr[op.ra])} * static_cast(ppu.gpr[op.rb]); + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, s64(ppu.gpr[op.rd]) < INT32_MIN || s64(ppu.gpr[op.rd]) > INT32_MAX); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -4659,8 +4749,7 @@ auto DCBTST() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - }; + static const auto exec = [](auto&&, auto) {}; RETURN_(ppu, op); } @@ -4670,10 +4759,11 @@ auto STBUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; - PPU_WRITE_8(vm::cast(addr), static_cast(ppu.gpr[op.rs])); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; + PPU_WRITE_8(vm::cast(addr), static_cast(ppu.gpr[op.rs])); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -4684,14 +4774,15 @@ auto ADD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 RA = ppu.gpr[op.ra]; - const u64 RB = ppu.gpr[op.rb]; - ppu.gpr[op.rd] = RA + RB; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, (RA >> 63 == RB >> 63) && (RA >> 63 != ppu.gpr[op.rd] >> 63)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 RA = ppu.gpr[op.ra]; + const u64 RB = ppu.gpr[op.rb]; + ppu.gpr[op.rd] = RA + RB; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, (RA >> 63 == RB >> 63) && (RA >> 63 != ppu.gpr[op.rd] >> 63)); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -4702,8 +4793,7 @@ auto DCBT() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - }; + static const auto exec = [](auto&&, auto) {}; RETURN_(ppu, op); } @@ -4713,9 +4803,10 @@ auto LHZX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -4726,10 +4817,11 @@ auto EQV() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ~(ppu.gpr[op.rs] ^ ppu.gpr[op.rb]); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ~(ppu.gpr[op.rs] ^ ppu.gpr[op.rb]); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -4740,8 +4832,9 @@ auto ECIWX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - fmt::throw_exception("ECIWX"); + static const auto exec = [](auto&&, auto) + { + fmt::throw_exception("ECIWX"); }; RETURN_(ppu, op); } @@ -4752,10 +4845,11 @@ auto LHZUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -4766,10 +4860,11 @@ auto XOR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ppu.gpr[op.rs] ^ ppu.gpr[op.rb]; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ppu.gpr[op.rs] ^ ppu.gpr[op.rb]; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -4780,21 +4875,21 @@ auto MFSPR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u32 n = (op.spr >> 5) | ((op.spr & 0x1f) << 5); - - switch (n) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - case 0x001: ppu.gpr[op.rd] = u32{ppu.xer.so} << 31 | ppu.xer.ov << 30 | ppu.xer.ca << 29 | ppu.xer.cnt; break; - case 0x008: ppu.gpr[op.rd] = ppu.lr; break; - case 0x009: ppu.gpr[op.rd] = ppu.ctr; break; - case 0x100: ppu.gpr[op.rd] = ppu.vrsave; break; + const u32 n = (op.spr >> 5) | ((op.spr & 0x1f) << 5); - case 0x10C: ppu.gpr[op.rd] = get_timebased_time(); break; - case 0x10D: ppu.gpr[op.rd] = get_timebased_time() >> 32; break; - default: fmt::throw_exception("MFSPR 0x%x", n); - } + switch (n) + { + case 0x001: ppu.gpr[op.rd] = u32{ppu.xer.so} << 31 | ppu.xer.ov << 30 | ppu.xer.ca << 29 | ppu.xer.cnt; break; + case 0x008: ppu.gpr[op.rd] = ppu.lr; break; + case 0x009: ppu.gpr[op.rd] = ppu.ctr; break; + case 0x100: ppu.gpr[op.rd] = ppu.vrsave; break; + case 0x10C: ppu.gpr[op.rd] = get_timebased_time(); break; + case 0x10D: ppu.gpr[op.rd] = get_timebased_time() >> 32; break; + default: fmt::throw_exception("MFSPR 0x%x", n); + } }; RETURN_(ppu, op); } @@ -4805,9 +4900,10 @@ auto LWAX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -4818,8 +4914,7 @@ auto DST() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - }; + static const auto exec = [](auto&&, auto) {}; RETURN_(ppu, op); } @@ -4829,9 +4924,10 @@ auto LHAX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -4842,9 +4938,10 @@ auto LVXL() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; - ppu.vr[op.vd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; + ppu.vr[op.vd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -4855,16 +4952,16 @@ auto MFTB() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u32 n = (op.spr >> 5) | ((op.spr & 0x1f) << 5); - - switch (n) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - case 0x10C: ppu.gpr[op.rd] = get_timebased_time(); break; - case 0x10D: ppu.gpr[op.rd] = get_timebased_time() >> 32; break; - default: fmt::throw_exception("MFTB 0x%x", n); - } + const u32 n = (op.spr >> 5) | ((op.spr & 0x1f) << 5); + switch (n) + { + case 0x10C: ppu.gpr[op.rd] = get_timebased_time(); break; + case 0x10D: ppu.gpr[op.rd] = get_timebased_time() >> 32; break; + default: fmt::throw_exception("MFTB 0x%x", n); + } }; RETURN_(ppu, op); } @@ -4875,10 +4972,11 @@ auto LWAUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -4889,8 +4987,7 @@ auto DSTST() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - }; + static const auto exec = [](auto&&, auto) {}; RETURN_(ppu, op); } @@ -4900,10 +4997,11 @@ auto LHAUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -4914,9 +5012,10 @@ auto STHX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - PPU_WRITE_16(vm::cast(addr), static_cast(ppu.gpr[op.rs])); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + PPU_WRITE_16(vm::cast(addr), static_cast(ppu.gpr[op.rs])); }; RETURN_(ppu, op); } @@ -4927,10 +5026,11 @@ auto ORC() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ppu.gpr[op.rs] | ~ppu.gpr[op.rb]; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ppu.gpr[op.rs] | ~ppu.gpr[op.rb]; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -4941,8 +5041,9 @@ auto ECOWX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - fmt::throw_exception("ECOWX"); + static const auto exec = [](auto&&, auto) + { + fmt::throw_exception("ECOWX"); }; RETURN_(ppu, op); } @@ -4953,10 +5054,11 @@ auto STHUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; - PPU_WRITE_16(vm::cast(addr), static_cast(ppu.gpr[op.rs])); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; + PPU_WRITE_16(vm::cast(addr), static_cast(ppu.gpr[op.rs])); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -4967,10 +5069,11 @@ auto OR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ppu.gpr[op.rs] | ppu.gpr[op.rb]; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ppu.gpr[op.rs] | ppu.gpr[op.rb]; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -4981,14 +5084,15 @@ auto DIVDU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 RA = ppu.gpr[op.ra]; - const u64 RB = ppu.gpr[op.rb]; - ppu.gpr[op.rd] = RB == 0 ? 0 : RA / RB; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, RB == 0); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 RA = ppu.gpr[op.ra]; + const u64 RB = ppu.gpr[op.rb]; + ppu.gpr[op.rd] = RB == 0 ? 0 : RA / RB; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, RB == 0); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -4999,14 +5103,15 @@ auto DIVWU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u32 RA = static_cast(ppu.gpr[op.ra]); - const u32 RB = static_cast(ppu.gpr[op.rb]); - ppu.gpr[op.rd] = RB == 0 ? 0 : RA / RB; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, RB == 0); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u32 RA = static_cast(ppu.gpr[op.ra]); + const u32 RB = static_cast(ppu.gpr[op.rb]); + ppu.gpr[op.rd] = RB == 0 ? 0 : RA / RB; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, RB == 0); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -5017,26 +5122,26 @@ auto MTSPR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u32 n = (op.spr >> 5) | ((op.spr & 0x1f) << 5); - - switch (n) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - case 0x001: - { - const u64 value = ppu.gpr[op.rs]; - ppu.xer.so = (value & 0x80000000) != 0; - ppu.xer.ov = (value & 0x40000000) != 0; - ppu.xer.ca = (value & 0x20000000) != 0; - ppu.xer.cnt = value & 0x7f; - break; - } - case 0x008: ppu.lr = ppu.gpr[op.rs]; break; - case 0x009: ppu.ctr = ppu.gpr[op.rs]; break; - case 0x100: ppu.vrsave = static_cast(ppu.gpr[op.rs]); break; - default: fmt::throw_exception("MTSPR 0x%x", n); - } + const u32 n = (op.spr >> 5) | ((op.spr & 0x1f) << 5); + switch (n) + { + case 0x001: + { + const u64 value = ppu.gpr[op.rs]; + ppu.xer.so = (value & 0x80000000) != 0; + ppu.xer.ov = (value & 0x40000000) != 0; + ppu.xer.ca = (value & 0x20000000) != 0; + ppu.xer.cnt = value & 0x7f; + break; + } + case 0x008: ppu.lr = ppu.gpr[op.rs]; break; + case 0x009: ppu.ctr = ppu.gpr[op.rs]; break; + case 0x100: ppu.vrsave = static_cast(ppu.gpr[op.rs]); break; + default: fmt::throw_exception("MTSPR 0x%x", n); + } }; RETURN_(ppu, op); } @@ -5047,8 +5152,7 @@ auto DCBI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - }; + static const auto exec = [](auto&&, auto) {}; RETURN_(ppu, op); } @@ -5058,10 +5162,11 @@ auto NAND() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = ~(ppu.gpr[op.rs] & ppu.gpr[op.rb]); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = ~(ppu.gpr[op.rs] & ppu.gpr[op.rb]); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -5072,9 +5177,10 @@ auto STVXL() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; - vm::_ref(vm::cast(addr)) = ppu.vr[op.vs]; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull; + vm::_ref(vm::cast(addr)) = ppu.vr[op.vs]; }; RETURN_(ppu, op); } @@ -5085,15 +5191,16 @@ auto DIVD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const s64 RA = ppu.gpr[op.ra]; - const s64 RB = ppu.gpr[op.rb]; - const bool o = RB == 0 || (RA == INT64_MIN && RB == -1); - ppu.gpr[op.rd] = o ? 0 : RA / RB; - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, o); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const s64 RA = ppu.gpr[op.ra]; + const s64 RB = ppu.gpr[op.rb]; + const bool o = RB == 0 || (RA == INT64_MIN && RB == -1); + ppu.gpr[op.rd] = o ? 0 : RA / RB; + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, o); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -5104,15 +5211,16 @@ auto DIVW() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const s32 RA = static_cast(ppu.gpr[op.ra]); - const s32 RB = static_cast(ppu.gpr[op.rb]); - const bool o = RB == 0 || (RA == INT32_MIN && RB == -1); - ppu.gpr[op.rd] = o ? 0 : static_cast(RA / RB); - if constexpr (((Flags == has_oe) || ...)) - ppu_ov_set(ppu, o); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const s32 RA = static_cast(ppu.gpr[op.ra]); + const s32 RB = static_cast(ppu.gpr[op.rb]); + const bool o = RB == 0 || (RA == INT32_MIN && RB == -1); + ppu.gpr[op.rd] = o ? 0 : static_cast(RA / RB); + if constexpr (((Flags == has_oe) || ...)) + ppu_ov_set(ppu, o); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.rd], 0); }; RETURN_(ppu, op); } @@ -5139,9 +5247,10 @@ auto LDBRX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data, Flags...>(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data, Flags...>(ppu, addr); }; RETURN_(ppu, op); } @@ -5152,23 +5261,24 @@ auto LSWX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - u32 count = ppu.xer.cnt & 0x7f; - for (; count >= 4; count -= 4, addr += 4, op.rd = (op.rd + 1) & 31) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); - } - if (count) - { - u32 value = 0; - for (u32 byte = 0; byte < count; byte++) + u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + u32 count = ppu.xer.cnt & 0x7f; + for (; count >= 4; count -= 4, addr += 4, op.rd = (op.rd + 1) & 31) { - u32 byte_value = ppu_feed_data(ppu, addr + byte); - value |= byte_value << ((3 ^ byte) * 8); + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + } + if (count) + { + u32 value = 0; + for (u32 byte = 0; byte < count; byte++) + { + u32 byte_value = ppu_feed_data(ppu, addr + byte); + value |= byte_value << ((3 ^ byte) * 8); + } + ppu.gpr[op.rd] = value; } - ppu.gpr[op.rd] = value; - } }; RETURN_(ppu, op); } @@ -5179,9 +5289,10 @@ auto LWBRX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data, Flags...>(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data, Flags...>(ppu, addr); }; RETURN_(ppu, op); } @@ -5192,9 +5303,10 @@ auto LFSX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -5205,10 +5317,11 @@ auto SRW() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = (ppu.gpr[op.rs] & 0xffffffff) >> (ppu.gpr[op.rb] & 0x3f); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = (ppu.gpr[op.rs] & 0xffffffff) >> (ppu.gpr[op.rb] & 0x3f); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -5219,11 +5332,12 @@ auto SRD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u32 n = ppu.gpr[op.rb] & 0x7f; - ppu.gpr[op.ra] = n & 0x40 ? 0 : ppu.gpr[op.rs] >> n; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u32 n = ppu.gpr[op.rb] & 0x7f; + ppu.gpr[op.ra] = n & 0x40 ? 0 : ppu.gpr[op.rs] >> n; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -5252,34 +5366,35 @@ auto LSWI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - u64 addr = op.ra ? ppu.gpr[op.ra] : 0; - u64 N = op.rb ? op.rb : 32; - u8 reg = op.rd; - - while (N > 0) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if (N > 3) + u64 addr = op.ra ? ppu.gpr[op.ra] : 0; + u64 N = op.rb ? op.rb : 32; + u8 reg = op.rd; + + while (N > 0) { - ppu.gpr[reg] = ppu_feed_data(ppu, addr); - addr += 4; - N -= 4; - } - else - { - u32 buf = 0; - u32 i = 3; - while (N > 0) + if (N > 3) { - N = N - 1; - buf |= ppu_feed_data(ppu, addr) << (i * 8); - addr++; - i--; + ppu.gpr[reg] = ppu_feed_data(ppu, addr); + addr += 4; + N -= 4; } - ppu.gpr[reg] = buf; + else + { + u32 buf = 0; + u32 i = 3; + while (N > 0) + { + N = N - 1; + buf |= ppu_feed_data(ppu, addr) << (i * 8); + addr++; + i--; + } + ppu.gpr[reg] = buf; + } + reg = (reg + 1) % 32; } - reg = (reg + 1) % 32; - } }; RETURN_(ppu, op); } @@ -5290,10 +5405,11 @@ auto LFSUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; - ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; + ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -5304,8 +5420,9 @@ auto SYNC() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - atomic_fence_seq_cst(); + static const auto exec = [](auto&&, auto) + { + atomic_fence_seq_cst(); }; RETURN_(ppu, op); } @@ -5316,9 +5433,10 @@ auto LFDX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -5329,10 +5447,11 @@ auto LFDUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; - ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; + ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -5361,9 +5480,10 @@ auto STDBRX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - vm::_ref>(vm::cast(addr)) = ppu.gpr[op.rs]; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + vm::_ref>(vm::cast(addr)) = ppu.gpr[op.rs]; }; RETURN_(ppu, op); } @@ -5374,22 +5494,23 @@ auto STSWX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - u32 count = ppu.xer.cnt & 0x7F; - for (; count >= 4; count -= 4, addr += 4, op.rs = (op.rs + 1) & 31) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - PPU_WRITE_32(vm::cast(addr), static_cast(ppu.gpr[op.rs])); - } - if (count) - { - u32 value = static_cast(ppu.gpr[op.rs]); - for (u32 byte = 0; byte < count; byte++) + u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + u32 count = ppu.xer.cnt & 0x7F; + for (; count >= 4; count -= 4, addr += 4, op.rs = (op.rs + 1) & 31) { - u8 byte_value = static_cast(value >> ((3 ^ byte) * 8)); - PPU_WRITE_8(vm::cast(addr + byte), byte_value); + PPU_WRITE_32(vm::cast(addr), static_cast(ppu.gpr[op.rs])); + } + if (count) + { + u32 value = static_cast(ppu.gpr[op.rs]); + for (u32 byte = 0; byte < count; byte++) + { + u8 byte_value = static_cast(value >> ((3 ^ byte) * 8)); + PPU_WRITE_8(vm::cast(addr + byte), byte_value); + } } - } }; RETURN_(ppu, op); } @@ -5400,9 +5521,10 @@ auto STWBRX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - vm::_ref>(vm::cast(addr)) = static_cast(ppu.gpr[op.rs]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + vm::_ref>(vm::cast(addr)) = static_cast(ppu.gpr[op.rs]); }; RETURN_(ppu, op); } @@ -5413,9 +5535,10 @@ auto STFSX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - vm::_ref(vm::cast(addr)) = static_cast(ppu.fpr[op.frs]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + vm::_ref(vm::cast(addr)) = static_cast(ppu.fpr[op.frs]); }; RETURN_(ppu, op); } @@ -5444,10 +5567,11 @@ auto STFSUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; - vm::_ref(vm::cast(addr)) = static_cast(ppu.fpr[op.frs]); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; + vm::_ref(vm::cast(addr)) = static_cast(ppu.fpr[op.frs]); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -5458,32 +5582,33 @@ auto STSWI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - u64 addr = op.ra ? ppu.gpr[op.ra] : 0; - u64 N = op.rb ? op.rb : 32; - u8 reg = op.rd; - - while (N > 0) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if (N > 3) + u64 addr = op.ra ? ppu.gpr[op.ra] : 0; + u64 N = op.rb ? op.rb : 32; + u8 reg = op.rd; + + while (N > 0) { - PPU_WRITE_32(vm::cast(addr), static_cast(ppu.gpr[reg])); - addr += 4; - N -= 4; - } - else - { - u32 buf = static_cast(ppu.gpr[reg]); - while (N > 0) + if (N > 3) { - N = N - 1; - PPU_WRITE_8(vm::cast(addr), (0xFF000000 & buf) >> 24); - buf <<= 8; - addr++; + PPU_WRITE_32(vm::cast(addr), static_cast(ppu.gpr[reg])); + addr += 4; + N -= 4; } + else + { + u32 buf = static_cast(ppu.gpr[reg]); + while (N > 0) + { + N = N - 1; + PPU_WRITE_8(vm::cast(addr), (0xFF000000 & buf) >> 24); + buf <<= 8; + addr++; + } + } + reg = (reg + 1) % 32; } - reg = (reg + 1) % 32; - } }; RETURN_(ppu, op); } @@ -5494,9 +5619,10 @@ auto STFDX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - vm::_ref(vm::cast(addr)) = ppu.fpr[op.frs]; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + vm::_ref(vm::cast(addr)) = ppu.fpr[op.frs]; }; RETURN_(ppu, op); } @@ -5507,10 +5633,11 @@ auto STFDUX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; - vm::_ref(vm::cast(addr)) = ppu.fpr[op.frs]; - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb]; + vm::_ref(vm::cast(addr)) = ppu.fpr[op.frs]; + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -5527,9 +5654,10 @@ auto LHBRX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - ppu.gpr[op.rd] = ppu_feed_data, Flags...>(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + ppu.gpr[op.rd] = ppu_feed_data, Flags...>(ppu, addr); }; RETURN_(ppu, op); } @@ -5540,22 +5668,23 @@ auto SRAW() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - s32 RS = static_cast(ppu.gpr[op.rs]); - u8 shift = ppu.gpr[op.rb] & 63; - if (shift > 31) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = 0 - (RS < 0); - ppu.xer.ca = (RS < 0); - } - else - { - ppu.gpr[op.ra] = RS >> shift; - ppu.xer.ca = (RS < 0) && ((ppu.gpr[op.ra] << shift) != static_cast(RS)); - } + s32 RS = static_cast(ppu.gpr[op.rs]); + u8 shift = ppu.gpr[op.rb] & 63; + if (shift > 31) + { + ppu.gpr[op.ra] = 0 - (RS < 0); + ppu.xer.ca = (RS < 0); + } + else + { + ppu.gpr[op.ra] = RS >> shift; + ppu.xer.ca = (RS < 0) && ((ppu.gpr[op.ra] << shift) != static_cast(RS)); + } - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -5566,22 +5695,23 @@ auto SRAD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - s64 RS = ppu.gpr[op.rs]; - u8 shift = ppu.gpr[op.rb] & 127; - if (shift > 63) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = 0 - (RS < 0); - ppu.xer.ca = (RS < 0); - } - else - { - ppu.gpr[op.ra] = RS >> shift; - ppu.xer.ca = (RS < 0) && ((ppu.gpr[op.ra] << shift) != static_cast(RS)); - } + s64 RS = ppu.gpr[op.rs]; + u8 shift = ppu.gpr[op.rb] & 127; + if (shift > 63) + { + ppu.gpr[op.ra] = 0 - (RS < 0); + ppu.xer.ca = (RS < 0); + } + else + { + ppu.gpr[op.ra] = RS >> shift; + ppu.xer.ca = (RS < 0) && ((ppu.gpr[op.ra] << shift) != static_cast(RS)); + } - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -5598,8 +5728,7 @@ auto DSS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - }; + static const auto exec = [](auto&&, auto) {}; RETURN_(ppu, op); } @@ -5609,13 +5738,14 @@ auto SRAWI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - s32 RS = static_cast(ppu.gpr[op.rs]); - ppu.gpr[op.ra] = RS >> op.sh32; - ppu.xer.ca = (RS < 0) && (static_cast(ppu.gpr[op.ra] << op.sh32) != static_cast(RS)); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + s32 RS = static_cast(ppu.gpr[op.rs]); + ppu.gpr[op.ra] = RS >> op.sh32; + ppu.xer.ca = (RS < 0) && (static_cast(ppu.gpr[op.ra] << op.sh32) != static_cast(RS)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -5626,14 +5756,15 @@ auto SRADI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - auto sh = op.sh64; - s64 RS = ppu.gpr[op.rs]; - ppu.gpr[op.ra] = RS >> sh; - ppu.xer.ca = (RS < 0) && ((ppu.gpr[op.ra] << sh) != static_cast(RS)); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + auto sh = op.sh64; + s64 RS = ppu.gpr[op.rs]; + ppu.gpr[op.ra] = RS >> sh; + ppu.xer.ca = (RS < 0) && ((ppu.gpr[op.ra] << sh) != static_cast(RS)); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -5644,8 +5775,9 @@ auto EIEIO() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - atomic_fence_seq_cst(); + static const auto exec = [](auto&&, auto) + { + atomic_fence_seq_cst(); }; RETURN_(ppu, op); } @@ -5662,9 +5794,10 @@ auto STHBRX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - vm::_ref>(vm::cast(addr)) = static_cast(ppu.gpr[op.rs]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + vm::_ref>(vm::cast(addr)) = static_cast(ppu.gpr[op.rs]); }; RETURN_(ppu, op); } @@ -5675,10 +5808,11 @@ auto EXTSH() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = static_cast(ppu.gpr[op.rs]); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = static_cast(ppu.gpr[op.rs]); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -5695,10 +5829,11 @@ auto EXTSB() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = static_cast(ppu.gpr[op.rs]); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = static_cast(ppu.gpr[op.rs]); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -5709,9 +5844,10 @@ auto STFIWX() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - PPU_WRITE_32(vm::cast(addr), static_cast(std::bit_cast(ppu.fpr[op.frs]))); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + PPU_WRITE_32(vm::cast(addr), static_cast(std::bit_cast(ppu.fpr[op.frs]))); }; RETURN_(ppu, op); } @@ -5722,10 +5858,11 @@ auto EXTSW() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[op.ra] = static_cast(ppu.gpr[op.rs]); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.gpr[op.ra] = static_cast(ppu.gpr[op.rs]); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 0, ppu.gpr[op.ra], 0); }; RETURN_(ppu, op); } @@ -5736,8 +5873,7 @@ auto ICBI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&&, auto) { - }; + static const auto exec = [](auto&&, auto) {}; RETURN_(ppu, op); } @@ -5747,18 +5883,19 @@ auto DCBZ() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; - const u32 addr0 = vm::cast(addr) & ~127; - - if (g_cfg.core.accurate_cache_line_stores) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - alignas(64) static constexpr u8 zero_buf[128]{}; - do_cell_atomic_128_store(addr0, zero_buf); - return; - } + const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]; + const u32 addr0 = vm::cast(addr) & ~127; - std::memset(vm::base(addr0), 0, 128); + if (g_cfg.core.accurate_cache_line_stores) + { + alignas(64) static constexpr u8 zero_buf[128]{}; + do_cell_atomic_128_store(addr0, zero_buf); + return; + } + + std::memset(vm::base(addr0), 0, 128); }; RETURN_(ppu, op); } @@ -5769,9 +5906,10 @@ auto LWZ() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -5782,10 +5920,11 @@ auto LWZU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + op.simm16; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + op.simm16; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -5796,9 +5935,10 @@ auto LBZ() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -5809,10 +5949,11 @@ auto LBZU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + op.simm16; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + op.simm16; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -5823,17 +5964,17 @@ auto STW() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - const u32 value = static_cast(ppu.gpr[op.rs]); - PPU_WRITE_32(vm::cast(addr), value); - - //Insomniac engine v3 & v4 (newer R&C, Fuse, Resitance 3) - if (value == 0xAAAAAAAA) [[unlikely]] + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - vm::reservation_update(vm::cast(addr)); - } + const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + const u32 value = static_cast(ppu.gpr[op.rs]); + PPU_WRITE_32(vm::cast(addr), value); + // Insomniac engine v3 & v4 (newer R&C, Fuse, Resitance 3) + if (value == 0xAAAAAAAA) [[unlikely]] + { + vm::reservation_update(vm::cast(addr)); + } }; RETURN_(ppu, op); } @@ -5844,10 +5985,11 @@ auto STWU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + op.simm16; - PPU_WRITE_32(vm::cast(addr), static_cast(ppu.gpr[op.rs])); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + op.simm16; + PPU_WRITE_32(vm::cast(addr), static_cast(ppu.gpr[op.rs])); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -5858,9 +6000,10 @@ auto STB() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - PPU_WRITE_8(vm::cast(addr), static_cast(ppu.gpr[op.rs])); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + PPU_WRITE_8(vm::cast(addr), static_cast(ppu.gpr[op.rs])); }; RETURN_(ppu, op); } @@ -5871,10 +6014,11 @@ auto STBU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + op.simm16; - PPU_WRITE_8(vm::cast(addr), static_cast(ppu.gpr[op.rs])); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + op.simm16; + PPU_WRITE_8(vm::cast(addr), static_cast(ppu.gpr[op.rs])); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -5885,9 +6029,10 @@ auto LHZ() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -5898,10 +6043,11 @@ auto LHZU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + op.simm16; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + op.simm16; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -5912,9 +6058,10 @@ auto LHA() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -5925,10 +6072,11 @@ auto LHAU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + op.simm16; - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + op.simm16; + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -5939,9 +6087,10 @@ auto STH() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - PPU_WRITE_16(vm::cast(addr), static_cast(ppu.gpr[op.rs])); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + PPU_WRITE_16(vm::cast(addr), static_cast(ppu.gpr[op.rs])); }; RETURN_(ppu, op); } @@ -5952,10 +6101,11 @@ auto STHU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + op.simm16; - PPU_WRITE_16(vm::cast(addr), static_cast(ppu.gpr[op.rs])); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + op.simm16; + PPU_WRITE_16(vm::cast(addr), static_cast(ppu.gpr[op.rs])); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -5966,12 +6116,13 @@ auto LMW() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - u64 addr = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - for (u32 i = op.rd; i<32; ++i, addr += 4) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.gpr[i] = ppu_feed_data(ppu, addr); - } + u64 addr = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + for (u32 i = op.rd; i < 32; ++i, addr += 4) + { + ppu.gpr[i] = ppu_feed_data(ppu, addr); + } }; RETURN_(ppu, op); } @@ -5982,12 +6133,13 @@ auto STMW() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - u64 addr = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - for (u32 i = op.rs; i<32; ++i, addr += 4) + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - PPU_WRITE_32(vm::cast(addr), static_cast(ppu.gpr[i])); - } + u64 addr = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + for (u32 i = op.rs; i < 32; ++i, addr += 4) + { + PPU_WRITE_32(vm::cast(addr), static_cast(ppu.gpr[i])); + } }; RETURN_(ppu, op); } @@ -5998,9 +6150,10 @@ auto LFS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -6011,10 +6164,11 @@ auto LFSU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + op.simm16; - ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + op.simm16; + ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -6025,9 +6179,10 @@ auto LFD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -6038,10 +6193,11 @@ auto LFDU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + op.simm16; - ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + op.simm16; + ppu.fpr[op.frd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -6052,9 +6208,10 @@ auto STFS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - vm::_ref(vm::cast(addr)) = static_cast(ppu.fpr[op.frs]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + vm::_ref(vm::cast(addr)) = static_cast(ppu.fpr[op.frs]); }; RETURN_(ppu, op); } @@ -6065,10 +6222,11 @@ auto STFSU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + op.simm16; - vm::_ref(vm::cast(addr)) = static_cast(ppu.fpr[op.frs]); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + op.simm16; + vm::_ref(vm::cast(addr)) = static_cast(ppu.fpr[op.frs]); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -6079,9 +6237,10 @@ auto STFD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; - vm::_ref(vm::cast(addr)) = ppu.fpr[op.frs]; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = op.ra || 1 ? ppu.gpr[op.ra] + op.simm16 : op.simm16; + vm::_ref(vm::cast(addr)) = ppu.fpr[op.frs]; }; RETURN_(ppu, op); } @@ -6092,10 +6251,11 @@ auto STFDU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + op.simm16; - vm::_ref(vm::cast(addr)) = ppu.fpr[op.frs]; - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + op.simm16; + vm::_ref(vm::cast(addr)) = ppu.fpr[op.frs]; + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -6106,9 +6266,10 @@ auto LD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = (op.simm16 & ~3) + (op.ra ? ppu.gpr[op.ra] : 0); - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = (op.simm16 & ~3) + (op.ra ? ppu.gpr[op.ra] : 0); + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -6119,10 +6280,11 @@ auto LDU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + (op.simm16 & ~3); - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + (op.simm16 & ~3); + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -6133,9 +6295,10 @@ auto LWA() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = (op.simm16 & ~3) + (op.ra ? ppu.gpr[op.ra] : 0); - ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = (op.simm16 & ~3) + (op.ra ? ppu.gpr[op.ra] : 0); + ppu.gpr[op.rd] = ppu_feed_data(ppu, addr); }; RETURN_(ppu, op); } @@ -6146,9 +6309,10 @@ auto STD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = (op.simm16 & ~3) + (op.ra ? ppu.gpr[op.ra] : 0); - PPU_WRITE_64(vm::cast(addr), ppu.gpr[op.rs]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = (op.simm16 & ~3) + (op.ra ? ppu.gpr[op.ra] : 0); + PPU_WRITE_64(vm::cast(addr), ppu.gpr[op.rs]); }; RETURN_(ppu, op); } @@ -6159,10 +6323,11 @@ auto STDU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u64 addr = ppu.gpr[op.ra] + (op.simm16 & ~3); - PPU_WRITE_64(vm::cast(addr), ppu.gpr[op.rs]); - ppu.gpr[op.ra] = addr; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u64 addr = ppu.gpr[op.ra] + (op.simm16 & ~3); + PPU_WRITE_64(vm::cast(addr), ppu.gpr[op.rs]); + ppu.gpr[op.ra] = addr; }; RETURN_(ppu, op); } @@ -6173,9 +6338,10 @@ auto FDIVS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] / ppu.fpr[op.frb]); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] / ppu.fpr[op.frb]); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6186,9 +6352,10 @@ auto FSUBS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] - ppu.fpr[op.frb]); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] - ppu.fpr[op.frb]); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6199,9 +6366,10 @@ auto FADDS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] + ppu.fpr[op.frb]); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] + ppu.fpr[op.frb]); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6212,9 +6380,10 @@ auto FSQRTS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = f32(std::sqrt(ppu.fpr[op.frb])); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = f32(std::sqrt(ppu.fpr[op.frb])); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6230,7 +6399,7 @@ auto FRES() const f64 a = ppu.fpr[op.frb]; const u64 b = std::bit_cast(a); const u64 e = (b >> 52) & 0x7ff; // double exp - const u64 i = (b >> 45) & 0x7f; // mantissa LUT index + const u64 i = (b >> 45) & 0x7f; // mantissa LUT index const u64 r = e >= (0x3ff + 0x80) ? 0 : (0x7ff - 2 - e) << 52 | u64{ppu_fres_mantissas[i]} << (32 - 3); ppu.fpr[op.frd] = f32(std::bit_cast(a == a ? (b & 0x8000'0000'0000'0000) | r : (0x8'0000'0000'0000 | b))); @@ -6245,9 +6414,10 @@ auto FMULS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] * ppu.fpr[op.frc]); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] * ppu.fpr[op.frc]); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6258,13 +6428,14 @@ auto FMADDS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if constexpr (((Flags == use_dfma) || ...)) - ppu.fpr[op.frd] = f32(std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], ppu.fpr[op.frb])); - else - ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] * ppu.fpr[op.frc] + ppu.fpr[op.frb]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + if constexpr (((Flags == use_dfma) || ...)) + ppu.fpr[op.frd] = f32(std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], ppu.fpr[op.frb])); + else + ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] * ppu.fpr[op.frc] + ppu.fpr[op.frb]); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6275,13 +6446,14 @@ auto FMSUBS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if constexpr (((Flags == use_dfma) || ...)) - ppu.fpr[op.frd] = f32(std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], -ppu.fpr[op.frb])); - else - ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] * ppu.fpr[op.frc] - ppu.fpr[op.frb]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + if constexpr (((Flags == use_dfma) || ...)) + ppu.fpr[op.frd] = f32(std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], -ppu.fpr[op.frb])); + else + ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] * ppu.fpr[op.frc] - ppu.fpr[op.frb]); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6292,13 +6464,14 @@ auto FNMSUBS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if constexpr (((Flags == use_dfma) || ...)) - ppu.fpr[op.frd] = f32(-std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], -ppu.fpr[op.frb])); - else - ppu.fpr[op.frd] = f32(-(ppu.fpr[op.fra] * ppu.fpr[op.frc] - ppu.fpr[op.frb])); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + if constexpr (((Flags == use_dfma) || ...)) + ppu.fpr[op.frd] = f32(-std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], -ppu.fpr[op.frb])); + else + ppu.fpr[op.frd] = f32(-(ppu.fpr[op.fra] * ppu.fpr[op.frc] - ppu.fpr[op.frb])); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6309,13 +6482,14 @@ auto FNMADDS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if constexpr (((Flags == use_dfma) || ...)) - ppu.fpr[op.frd] = f32(-std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], ppu.fpr[op.frb])); - else - ppu.fpr[op.frd] = f32(-(ppu.fpr[op.fra] * ppu.fpr[op.frc] + ppu.fpr[op.frb])); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + if constexpr (((Flags == use_dfma) || ...)) + ppu.fpr[op.frd] = f32(-std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], ppu.fpr[op.frb])); + else + ppu.fpr[op.frd] = f32(-(ppu.fpr[op.fra] * ppu.fpr[op.frc] + ppu.fpr[op.frb])); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6326,12 +6500,14 @@ auto MTFSB1() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u32 bit = op.crbd; - if (bit < 16 || bit > 19) ppu_log.warning("MTFSB1(%d)", bit); - ppu.fpscr.bits[bit] = 1; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u32 bit = op.crbd; + if (bit < 16 || bit > 19) + ppu_log.warning("MTFSB1(%d)", bit); + ppu.fpscr.bits[bit] = 1; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); }; RETURN_(ppu, op); } @@ -6342,9 +6518,11 @@ auto MCRFS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if (op.crfs != 4) ppu_log.warning("MCRFS(%d)", op.crfs); - ppu.cr.fields[op.crfd] = ppu.fpscr.fields[op.crfs]; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + if (op.crfs != 4) + ppu_log.warning("MCRFS(%d)", op.crfs); + ppu.cr.fields[op.crfd] = ppu.fpscr.fields[op.crfs]; }; RETURN_(ppu, op); } @@ -6355,12 +6533,14 @@ auto MTFSB0() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u32 bit = op.crbd; - if (bit < 16 || bit > 19) ppu_log.warning("MTFSB0(%d)", bit); - ppu.fpscr.bits[bit] = 0; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u32 bit = op.crbd; + if (bit < 16 || bit > 19) + ppu_log.warning("MTFSB0(%d)", bit); + ppu.fpscr.bits[bit] = 0; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); }; RETURN_(ppu, op); } @@ -6371,38 +6551,42 @@ auto MTFSFI() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const u32 bf = op.crfd; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const u32 bf = op.crfd; - if (bf != 4) - { - // Do nothing on non-FPCC field (TODO) - ppu_log.warning("MTFSFI(%d)", op.crfd); - } - else - { - static constexpr std::array all_values = []() -> std::array + if (bf != 4) { - std::array values{}; - - for (u32 i = 0; i < values.size(); i++) + // Do nothing on non-FPCC field (TODO) + ppu_log.warning("MTFSFI(%d)", op.crfd); + } + else + { + static constexpr std::array all_values = []() -> std::array { - u32 value = 0, im = i; - value |= (im & 1) << (8 * 3); im >>= 1; - value |= (im & 1) << (8 * 2); im >>= 1; - value |= (im & 1) << (8 * 1); im >>= 1; - value |= (im & 1) << (8 * 0); - values[i] = value; - } + std::array values{}; - return values; - }(); + for (u32 i = 0; i < values.size(); i++) + { + u32 value = 0, im = i; + value |= (im & 1) << (8 * 3); + im >>= 1; + value |= (im & 1) << (8 * 2); + im >>= 1; + value |= (im & 1) << (8 * 1); + im >>= 1; + value |= (im & 1) << (8 * 0); + values[i] = value; + } - ppu.fpscr.fields[bf] = all_values[op.i]; - } + return values; + }(); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); + ppu.fpscr.fields[bf] = all_values[op.i]; + } + + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); }; RETURN_(ppu, op); } @@ -6413,11 +6597,12 @@ auto MFFS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu_log.warning("MFFS"); - ppu.fpr[op.frd] = std::bit_cast(u64{ppu.fpscr.fl} << 15 | u64{ppu.fpscr.fg} << 14 | u64{ppu.fpscr.fe} << 13 | u64{ppu.fpscr.fu} << 12); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu_log.warning("MFFS"); + ppu.fpr[op.frd] = std::bit_cast(u64{ppu.fpscr.fl} << 15 | u64{ppu.fpscr.fg} << 14 | u64{ppu.fpscr.fe} << 13 | u64{ppu.fpscr.fu} << 12); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); }; RETURN_(ppu, op); } @@ -6428,10 +6613,11 @@ auto MTFSF() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](auto&& ppu, auto) { - ppu_log.warning("MTFSF"); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); + static const auto exec = [](auto&& ppu, auto) + { + ppu_log.warning("MTFSF"); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); }; RETURN_(ppu, op); } @@ -6442,10 +6628,11 @@ auto FCMPU() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - const f64 a = ppu.fpr[op.fra]; - const f64 b = ppu.fpr[op.frb]; - ppu_set_fpcc(ppu, a, b, op.crfd); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + const f64 a = ppu.fpr[op.fra]; + const f64 b = ppu.fpr[op.frb]; + ppu_set_fpcc(ppu, a, b, op.crfd); }; RETURN_(ppu, op); } @@ -6458,13 +6645,13 @@ auto FCTIW() static const auto exec = [](ppu_thread& ppu, auto&& d, auto&& b) { - #if defined(ARCH_X64) +#if defined(ARCH_X64) const auto val = _mm_set_sd(b); const auto res = _mm_xor_si128(_mm_cvtpd_epi32(val), _mm_castpd_si128(_mm_cmpge_pd(val, _mm_set1_pd(0x80000000)))); d = std::bit_cast(_mm_cvtsi128_si32(res)); - #elif defined(ARCH_ARM64) +#elif defined(ARCH_ARM64) d = std::bit_cast(!(b == b) ? INT32_MIN : vqmovnd_s64(std::bit_cast(vrndi_f64(std::bit_cast(b))))); - #endif +#endif ppu_set_fpcc(ppu, 0., 0.); // undefined (TODO) }; @@ -6479,13 +6666,13 @@ auto FCTIWZ() static const auto exec = [](ppu_thread& ppu, auto&& d, auto&& b) { - #if defined(ARCH_X64) +#if defined(ARCH_X64) const auto val = _mm_set_sd(b); const auto res = _mm_xor_si128(_mm_cvttpd_epi32(val), _mm_castpd_si128(_mm_cmpge_pd(val, _mm_set1_pd(0x80000000)))); d = std::bit_cast(_mm_cvtsi128_si32(res)); - #elif defined(ARCH_ARM64) +#elif defined(ARCH_ARM64) d = std::bit_cast(!(b == b) ? INT32_MIN : vqmovnd_s64(std::bit_cast(vcvt_s64_f64(std::bit_cast(b))))); - #endif +#endif ppu_set_fpcc(ppu, 0., 0.); // undefined (TODO) }; @@ -6498,9 +6685,10 @@ auto FRSP() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = f32(ppu.fpr[op.frb]); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = f32(ppu.fpr[op.frb]); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6511,9 +6699,10 @@ auto FDIV() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = ppu.fpr[op.fra] / ppu.fpr[op.frb]; - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = ppu.fpr[op.fra] / ppu.fpr[op.frb]; + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6524,9 +6713,10 @@ auto FSUB() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = ppu.fpr[op.fra] - ppu.fpr[op.frb]; - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = ppu.fpr[op.fra] - ppu.fpr[op.frb]; + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6537,9 +6727,10 @@ auto FADD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = ppu.fpr[op.fra] + ppu.fpr[op.frb]; - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = ppu.fpr[op.fra] + ppu.fpr[op.frb]; + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6550,9 +6741,10 @@ auto FSQRT() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = std::sqrt(ppu.fpr[op.frb]); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = std::sqrt(ppu.fpr[op.frb]); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6563,10 +6755,11 @@ auto FSEL() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = ppu.fpr[op.fra] >= 0.0 ? ppu.fpr[op.frc] : ppu.fpr[op.frb]; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = ppu.fpr[op.fra] >= 0.0 ? ppu.fpr[op.frc] : ppu.fpr[op.frb]; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); }; RETURN_(ppu, op); } @@ -6577,9 +6770,10 @@ auto FMUL() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = ppu.fpr[op.fra] * ppu.fpr[op.frc]; - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = ppu.fpr[op.fra] * ppu.fpr[op.frc]; + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6606,13 +6800,14 @@ auto FMSUB() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if constexpr (((Flags == use_dfma) || ...)) - ppu.fpr[op.frd] = std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], -ppu.fpr[op.frb]); - else - ppu.fpr[op.frd] = ppu.fpr[op.fra] * ppu.fpr[op.frc] - ppu.fpr[op.frb]; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + if constexpr (((Flags == use_dfma) || ...)) + ppu.fpr[op.frd] = std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], -ppu.fpr[op.frb]); + else + ppu.fpr[op.frd] = ppu.fpr[op.fra] * ppu.fpr[op.frc] - ppu.fpr[op.frb]; - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6623,13 +6818,14 @@ auto FMADD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if constexpr (((Flags == use_dfma) || ...)) - ppu.fpr[op.frd] = std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], ppu.fpr[op.frb]); - else - ppu.fpr[op.frd] = ppu.fpr[op.fra] * ppu.fpr[op.frc] + ppu.fpr[op.frb]; + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + if constexpr (((Flags == use_dfma) || ...)) + ppu.fpr[op.frd] = std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], ppu.fpr[op.frb]); + else + ppu.fpr[op.frd] = ppu.fpr[op.fra] * ppu.fpr[op.frc] + ppu.fpr[op.frb]; - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6640,13 +6836,14 @@ auto FNMSUB() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if constexpr (((Flags == use_dfma) || ...)) - ppu.fpr[op.frd] = -std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], -ppu.fpr[op.frb]); - else - ppu.fpr[op.frd] = -(ppu.fpr[op.fra] * ppu.fpr[op.frc] - ppu.fpr[op.frb]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + if constexpr (((Flags == use_dfma) || ...)) + ppu.fpr[op.frd] = -std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], -ppu.fpr[op.frb]); + else + ppu.fpr[op.frd] = -(ppu.fpr[op.fra] * ppu.fpr[op.frc] - ppu.fpr[op.frb]); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6657,13 +6854,14 @@ auto FNMADD() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - if constexpr (((Flags == use_dfma) || ...)) - ppu.fpr[op.frd] = -std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], ppu.fpr[op.frb]); - else - ppu.fpr[op.frd] = -(ppu.fpr[op.fra] * ppu.fpr[op.frc] + ppu.fpr[op.frb]); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + if constexpr (((Flags == use_dfma) || ...)) + ppu.fpr[op.frd] = -std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], ppu.fpr[op.frb]); + else + ppu.fpr[op.frd] = -(ppu.fpr[op.fra] * ppu.fpr[op.frc] + ppu.fpr[op.frb]); - ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); + ppu_set_fpcc(ppu, ppu.fpr[op.frd], 0.); }; RETURN_(ppu, op); } @@ -6680,10 +6878,11 @@ auto FNEG() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = -ppu.fpr[op.frb]; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = -ppu.fpr[op.frb]; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); }; RETURN_(ppu, op); } @@ -6694,10 +6893,11 @@ auto FMR() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = ppu.fpr[op.frb]; - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = ppu.fpr[op.frb]; + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); }; RETURN_(ppu, op); } @@ -6708,10 +6908,11 @@ auto FNABS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = -std::fabs(ppu.fpr[op.frb]); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = -std::fabs(ppu.fpr[op.frb]); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); }; RETURN_(ppu, op); } @@ -6722,10 +6923,11 @@ auto FABS() if constexpr (Build == 0xf1a6) return ppu_exec_select::template select<>(); - static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) { - ppu.fpr[op.frd] = std::fabs(ppu.fpr[op.frb]); - if constexpr (((Flags == has_rc) || ...)) - ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); + static const auto exec = [](ppu_thread& ppu, ppu_opcode_t op) + { + ppu.fpr[op.frd] = std::fabs(ppu.fpr[op.frb]); + if constexpr (((Flags == has_rc) || ...)) + ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu); }; RETURN_(ppu, op); } @@ -6738,13 +6940,13 @@ auto FCTID() static const auto exec = [](ppu_thread& ppu, auto&& d, auto&& b) { - #if defined(ARCH_X64) +#if defined(ARCH_X64) const auto val = _mm_set_sd(b); const auto res = _mm_xor_si128(_mm_set1_epi64x(_mm_cvtsd_si64(val)), _mm_castpd_si128(_mm_cmpge_pd(val, _mm_set1_pd(f64(1ull << 63))))); d = std::bit_cast(_mm_cvtsi128_si64(res)); - #elif defined(ARCH_ARM64) +#elif defined(ARCH_ARM64) d = std::bit_cast(!(b == b) ? f64{INT64_MIN} : std::bit_cast(vrndi_f64(std::bit_cast(b)))); - #endif +#endif ppu_set_fpcc(ppu, 0., 0.); // undefined (TODO) }; @@ -6759,13 +6961,13 @@ auto FCTIDZ() static const auto exec = [](ppu_thread& ppu, auto&& d, auto&& b) { - #if defined(ARCH_X64) +#if defined(ARCH_X64) const auto val = _mm_set_sd(b); const auto res = _mm_xor_si128(_mm_set1_epi64x(_mm_cvttsd_si64(val)), _mm_castpd_si128(_mm_cmpge_pd(val, _mm_set1_pd(f64(1ull << 63))))); d = std::bit_cast(_mm_cvtsi128_si64(res)); - #elif defined(ARCH_ARM64) +#elif defined(ARCH_ARM64) d = std::bit_cast(!(b == b) ? int64x1_t{INT64_MIN} : vcvt_s64_f64(std::bit_cast(b))); - #endif +#endif ppu_set_fpcc(ppu, 0., 0.); // undefined (TODO) }; @@ -7386,55 +7588,55 @@ ppu_interpreter_rt_base::ppu_interpreter_rt_base() noexcept #ifndef __INTELLISENSE__ -#define INIT_VCMP(name) \ +#define INIT_VCMP(name) \ ptrs->name = ::name<0>(); \ - ptrs->name##_ = ::name<0, has_oe>(); \ + ptrs->name##_ = ::name<0, has_oe>(); -#define INIT_OV(name) \ +#define INIT_OV(name) \ ptrs->name = ::name<0>(); \ - ptrs->name##O = ::name<0, has_oe>(); \ + ptrs->name##O = ::name<0, has_oe>(); -#define INIT_RC(name) \ - ptrs->name = ::name<0xf1a6>()(selected, []() { \ - return ::name<0, Flags...>(); \ - }); \ - ptrs->name##_ = ::name<0xf1a6, set_fpcc>()(selected, []() { \ +#define INIT_RC(name) \ + ptrs->name = ::name<0xf1a6>()(selected, []() { \ + return ::name<0, Flags...>(); \ + }); \ + ptrs->name##_ = ::name<0xf1a6, set_fpcc>()(selected, []() { \ /* Minor optimization: has_rc implies set_fpcc so don't compile has_rc alone */ \ - return ::name<0, has_rc, Flags...>(); \ - }); \ + return ::name<0, has_rc, Flags...>(); \ + }); -#define INIT_RC_OV(name) \ - ptrs->name = ::name<0>(); \ +#define INIT_RC_OV(name) \ + ptrs->name = ::name<0>(); \ ptrs->name##O = ::name<0, has_oe>(); \ ptrs->name##_ = ::name<0, has_rc>(); \ - ptrs->name##O_ = ::name<0, has_oe, has_rc>(); \ + ptrs->name##O_ = ::name<0, has_oe, has_rc>(); // Initialize instructions with their own sets of supported flags (except INIT_VCMP, INIT_OV, INIT_RC_OV) -#define INIT(name) \ +#define INIT(name) \ ptrs->name = ::name<0xf1a6>()(selected, []() { \ - return ::name<0, Flags...>(); \ - }); \ + return ::name<0, Flags...>(); \ + }); -#define INIT_ONE(name, bits) \ +#define INIT_ONE(name, bits) \ ptrs->name##_[0b##bits] = ::name<0b##bits>::select(selected, []() { \ - return ::name<0b##bits>::impl<0, Flags...>(); \ - }); \ + return ::name<0b##bits>::impl<0, Flags...>(); \ + }); #define INIT_PACK2(name, bits) \ - INIT_ONE(name, bits##0) \ - INIT_ONE(name, bits##1) \ + INIT_ONE(name, bits##0) \ + INIT_ONE(name, bits##1) #define INIT_PACK4(name, bits) \ - INIT_PACK2(name, bits##0) \ - INIT_PACK2(name, bits##1) \ + INIT_PACK2(name, bits##0) \ + INIT_PACK2(name, bits##1) #define INIT_PACK8(name, bits) \ - INIT_PACK4(name, bits##0) \ - INIT_PACK4(name, bits##1) \ + INIT_PACK4(name, bits##0) \ + INIT_PACK4(name, bits##1) #define INIT_PACK16(name, bits) \ - INIT_PACK8(name, bits##0) \ - INIT_PACK8(name, bits##1) \ + INIT_PACK8(name, bits##0) \ + INIT_PACK8(name, bits##1) INIT(MFVSCR); INIT(MTVSCR); @@ -7539,7 +7741,7 @@ ppu_interpreter_rt_base::ppu_interpreter_rt_base() noexcept INIT(VSEL); INIT(VSL); INIT(VSLB); - INIT_PACK16(VSLDOI,); + INIT_PACK16(VSLDOI, ); INIT(VSLH); INIT(VSLO); INIT(VSLW); @@ -7627,7 +7829,7 @@ ppu_interpreter_rt_base::ppu_interpreter_rt_base() noexcept INIT_RC_OV(ADDC); INIT_RC(MULHDU); INIT_RC(MULHWU); - INIT_PACK8(MFOCRF,); + INIT_PACK8(MFOCRF, ); INIT(MFCR); //+ INIT(LWARX); INIT(LDX); @@ -7825,8 +8027,7 @@ ppu_interpreter_rt_base::~ppu_interpreter_rt_base() } ppu_interpreter_rt::ppu_interpreter_rt() noexcept - : ppu_interpreter_rt_base() - , table(*ptrs) + : ppu_interpreter_rt_base(), table(*ptrs) { } diff --git a/rpcs3/rpcs3/Emu/Cell/PPUInterpreter.h b/rpcs3/rpcs3/Emu/Cell/PPUInterpreter.h index 5b8f1037f..ca8d03db5 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUInterpreter.h +++ b/rpcs3/rpcs3/Emu/Cell/PPUInterpreter.h @@ -4,7 +4,7 @@ class ppu_thread; -using ppu_intrp_func_t = void(*)(ppu_thread& ppu_, ppu_opcode_t op, be_t* this_op, struct ppu_intrp_func* next_fn); +using ppu_intrp_func_t = void (*)(ppu_thread& ppu_, ppu_opcode_t op, be_t* this_op, struct ppu_intrp_func* next_fn); struct ppu_intrp_func { diff --git a/rpcs3/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/rpcs3/Emu/Cell/PPUModule.cpp index 123bc1e75..6f5055db8 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/rpcs3/Emu/Cell/PPUModule.cpp @@ -74,12 +74,12 @@ extern u32 ppu_generate_id(std::string_view name) static void select_from_nids_scenpdrm_addrs(std::map>>& result, const std::unordered_map& fnid_to_use_addr) { static const u32 fnids_list[] = - { - ppu_generate_id("sceNpDrmProcessExitSpawn"), - ppu_generate_id("sceNpDrmProcessExitSpawn2"), - ppu_generate_id("sceNpDrmIsAvailable"), - ppu_generate_id("sceNpDrmIsAvailable2"), - }; + { + ppu_generate_id("sceNpDrmProcessExitSpawn"), + ppu_generate_id("sceNpDrmProcessExitSpawn2"), + ppu_generate_id("sceNpDrmIsAvailable"), + ppu_generate_id("sceNpDrmIsAvailable2"), + }; for (const auto& [nid, use] : fnid_to_use_addr) { @@ -96,7 +96,7 @@ ppu_static_module::ppu_static_module(const char* name) ppu_module_manager::register_module(this); } -void ppu_static_module::add_init_func(void(*func)(ppu_static_module*)) +void ppu_static_module::add_init_func(void (*func)(ppu_static_module*)) { m_on_init.emplace_back(func); } @@ -195,8 +195,7 @@ static void ppu_initialize_modules(ppu_linkage_info* link, utils::serial* ar = n ppu_module_manager::initialize_modules(); - const std::initializer_list registered - { + const std::initializer_list registered{ &ppu_module_manager::cellAdec, &ppu_module_manager::cellAtrac, &ppu_module_manager::cellAtrac3dec, @@ -390,7 +389,7 @@ static void ppu_initialize_modules(ppu_linkage_info* link, utils::serial* ar = n hle_vars_save(const hle_vars_save&) = delete; - hle_vars_save& operator =(const hle_vars_save&) = delete; + hle_vars_save& operator=(const hle_vars_save&) = delete; hle_vars_save(utils::serial& ar) { @@ -604,7 +603,8 @@ static void ppu_patch_refs(const ppu_module& _module, std::vector(fref); ref->type; fref += sizeof(ref_t), ref = &_module.get_ref(fref)) { - if (ref->addend) ppu_loader.warning("**** REF(%u): Addend value(0x%x, 0x%x)", ref->type, ref->addr, ref->addend); + if (ref->addend) + ppu_loader.warning("**** REF(%u): Addend value(0x%x, 0x%x)", ref->type, ref->addr, ref->addend); const u32 raddr = ref->addr; const u32 rtype = ref->type; @@ -873,7 +873,7 @@ static auto ppu_load_exports(const ppu_module& _module, ppu_linkage_inf { ppu_loader.notice("Already linked function '%s' in module '%s'", ppu_get_function_name(module_name, fnid), module_name); } - //else + // else { // Static function const auto _sf = _sm && _sm->functions.count(fnid) ? &::at32(_sm->functions, fnid) : nullptr; @@ -900,7 +900,7 @@ static auto ppu_load_exports(const ppu_module& _module, ppu_linkage_inf for (const u32 addr : flink.imports) { _module.get_ref(addr) = faddr; - //ppu_loader.warning("Exported function '%s' in module '%s'", ppu_get_function_name(module_name, fnid), module_name); + // ppu_loader.warning("Exported function '%s' in module '%s'", ppu_get_function_name(module_name, fnid), module_name); } for (const u32 fref : flink.frefss) @@ -938,7 +938,7 @@ static auto ppu_load_exports(const ppu_module& _module, ppu_linkage_inf { ppu_loader.error("Already linked variable '%s' in module '%s'", ppu_get_variable_name(module_name, vnid), module_name); } - //else + // else { // Set exported variable vlink.export_addr = vaddr; @@ -947,7 +947,7 @@ static auto ppu_load_exports(const ppu_module& _module, ppu_linkage_inf for (const auto vref : vlink.imports) { ppu_patch_refs(_module, nullptr, vref, vaddr); - //ppu_loader.warning("Exported variable '%s' in module '%s'", ppu_get_variable_name(module_name, vnid), module_name); + // ppu_loader.warning("Exported variable '%s' in module '%s'", ppu_get_variable_name(module_name, vnid), module_name); } } } @@ -979,7 +979,7 @@ static import_result_t ppu_load_imports(const ppu_module& _module, std: } // Static module - //const auto _sm = ppu_module_manager::get_module(module_name); + // const auto _sm = ppu_module_manager::get_module(module_name); // Module linkage auto& mlink = link->modules[module_name]; @@ -1022,7 +1022,7 @@ static import_result_t ppu_load_imports(const ppu_module& _module, std: ppu_patch_refs(_module, &relocs, frefs, link_addr); } - //ppu_loader.warning("Imported function '%s' in module '%s' (0x%x)", ppu_get_function_name(module_name, fnid), module_name, faddr); + // ppu_loader.warning("Imported function '%s' in module '%s' (0x%x)", ppu_get_function_name(module_name, fnid), module_name, faddr); } const auto vnids = +lib.vnids; @@ -1044,7 +1044,7 @@ static import_result_t ppu_load_imports(const ppu_module& _module, std: // Link if available ppu_patch_refs(_module, &relocs, vref, vlink.export_addr); - //ppu_loader.warning("Imported variable '%s' in module '%s' (0x%x)", ppu_get_variable_name(module_name, vnid), module_name, vlink.first); + // ppu_loader.warning("Imported variable '%s' in module '%s' (0x%x)", ppu_get_variable_name(module_name, vnid), module_name, vlink.first); } addr += lib.size ? lib.size : sizeof(ppu_prx_module_info); @@ -1433,12 +1433,20 @@ static void ppu_check_patch_spu_images(const ppu_module& mod, const ppu } // Apply the patch - g_fxo->get().apply(applied, hash, [&](u32 addr, u32 /*size*/) { return addr + elf_header + prog.p_offset; }, prog.p_filesz, prog.p_vaddr); + g_fxo->get().apply(applied, hash, [&](u32 addr, u32 /*size*/) + { + return addr + elf_header + prog.p_offset; + }, + prog.p_filesz, prog.p_vaddr); if (!Emu.GetTitleID().empty()) { // Alternative patch - g_fxo->get().apply(applied, Emu.GetTitleID() + '-' + hash, [&](u32 addr, u32 /*size*/) { return addr + elf_header + prog.p_offset; }, prog.p_filesz, prog.p_vaddr); + g_fxo->get().apply(applied, Emu.GetTitleID() + '-' + hash, [&](u32 addr, u32 /*size*/) + { + return addr + elf_header + prog.p_offset; + }, + prog.p_filesz, prog.p_vaddr); } } @@ -1461,8 +1469,7 @@ void try_spawn_ppu_if_exclusive_program(const ppu_module& m) // If only PRX/OVL has been loaded at Emu.BootGame(), launch a single PPU thread so its memory can be viewed if (Emu.IsReady() && g_fxo->get>().segs.empty() && !Emu.DeserialManager()) { - ppu_thread_params p - { + ppu_thread_params p{ .stack_addr = vm::cast(vm::alloc(SYS_PROCESS_PARAM_STACK_SIZE_MAX, vm::stack, 4096)), .stack_size = SYS_PROCESS_PARAM_STACK_SIZE_MAX, }; @@ -1487,9 +1494,9 @@ struct prx_names_table prx_names_table() noexcept { idm::select([this](u32, lv2_prx& prx) - { - install(prx.name, prx); - }); + { + install(prx.name, prx); + }); } void install(std::string_view name, lv2_prx& prx) @@ -1596,7 +1603,7 @@ shared_ptr ppu_load_prx(const ppu_prx_object& elf, bool virtual_load, c { const u32 mem_size = ::narrow(prog.p_memsz); const u32 file_size = ::narrow(prog.p_filesz); - //const u32 init_addr = ::narrow(prog.p_vaddr); + // const u32 init_addr = ::narrow(prog.p_vaddr); // Alloc segment memory // Or use saved address @@ -1635,7 +1642,8 @@ shared_ptr ppu_load_prx(const ppu_prx_object& elf, bool virtual_load, c prx->addr_to_seg_index.emplace(addr, ::size32(prx->segs) - 1); // Copy segment data - if (!ar) std::memcpy(ensure(prx->get_ptr(addr)), prog.bin.data(), file_size); + if (!ar) + std::memcpy(ensure(prx->get_ptr(addr)), prog.bin.data(), file_size); ppu_loader.warning("**** Loaded to 0x%x...0x%x (size=0x%x)", addr, addr + mem_size - 1, mem_size); // Hash segment @@ -1663,7 +1671,8 @@ shared_ptr ppu_load_prx(const ppu_prx_object& elf, bool virtual_load, c { ppu_loader.notice("** Section: sh_type=0x%x, addr=0x%llx, size=0x%llx, flags=0x%x", std::bit_cast(s.sh_type), s.sh_addr, s.sh_size, s._sh_flags); - if (s.sh_type != sec_type::sht_progbits) continue; + if (s.sh_type != sec_type::sht_progbits) + continue; const u32 addr = vm::cast(s.sh_addr); const u32 size = vm::cast(s.sh_size); @@ -1748,56 +1757,56 @@ shared_ptr ppu_load_prx(const ppu_prx_object& elf, bool virtual_load, c break; } - case 4: //R_PPC64_ADDR16_LO + case 4: // R_PPC64_ADDR16_LO { const u16 value = *ensure(prx->get_ptr(raddr)) = static_cast(rdata); ppu_loader.trace("**** RELOCATION(4): 0x%x <- 0x%04x (0x%llx)", raddr, value, rdata); break; } - case 5: //R_PPC64_ADDR16_HI + case 5: // R_PPC64_ADDR16_HI { const u16 value = *ensure(prx->get_ptr(raddr)) = static_cast(rdata >> 16); ppu_loader.trace("**** RELOCATION(5): 0x%x <- 0x%04x (0x%llx)", raddr, value, rdata); break; } - case 6: //R_PPC64_ADDR16_HA + case 6: // R_PPC64_ADDR16_HA { const u16 value = *ensure(prx->get_ptr(raddr)) = static_cast(rdata >> 16) + (rdata & 0x8000 ? 1 : 0); ppu_loader.trace("**** RELOCATION(6): 0x%x <- 0x%04x (0x%llx)", raddr, value, rdata); break; } - case 10: //R_PPC64_REL24 + case 10: // R_PPC64_REL24 { const u32 value = *ensure(prx->get_ptr, 6, 24>>(raddr)) = static_cast(rdata - raddr) >> 2; ppu_loader.warning("**** RELOCATION(10): 0x%x <- 0x%06x (0x%llx)", raddr, value, rdata); break; } - case 11: //R_PPC64_REL14 + case 11: // R_PPC64_REL14 { const u32 value = *ensure(prx->get_ptr, 16, 14>>(raddr)) = static_cast(rdata - raddr) >> 2; ppu_loader.warning("**** RELOCATION(11): 0x%x <- 0x%06x (0x%llx)", raddr, value, rdata); break; } - case 38: //R_PPC64_ADDR64 + case 38: // R_PPC64_ADDR64 { const u64 value = *ensure(prx->get_ptr(raddr)) = rdata; ppu_loader.trace("**** RELOCATION(38): 0x%x <- 0x%016llx (0x%llx)", raddr, value, rdata); break; } - case 44: //R_PPC64_REL64 + case 44: // R_PPC64_REL64 { const u64 value = *ensure(prx->get_ptr(raddr)) = rdata - raddr; ppu_loader.trace("**** RELOCATION(44): 0x%x <- 0x%016llx (0x%llx)", raddr, value, rdata); break; } - case 57: //R_PPC64_ADDR16_LO_DS + case 57: // R_PPC64_ADDR16_LO_DS { const u16 value = *ensure(prx->get_ptr, 0, 14>>(raddr)) = static_cast(rdata) >> 2; ppu_loader.trace("**** RELOCATION(57): 0x%x <- 0x%04x (0x%llx)", raddr, value, rdata); @@ -1815,7 +1824,7 @@ shared_ptr ppu_load_prx(const ppu_prx_object& elf, bool virtual_load, c break; } - default : break; + default: break; } } @@ -1915,22 +1924,35 @@ shared_ptr ppu_load_prx(const ppu_prx_object& elf, bool virtual_load, c { const auto& seg = prx->segs[i]; - if (!seg.size) continue; + if (!seg.size) + continue; const std::string hash_seg = fmt::format("%s-%u", hash, i); // Apply the patch std::vector _applied; - g_fxo->get().apply(_applied, hash_seg, [&](u32 addr, u32 size) { return prx->get_ptr(addr + seg.addr, size); }, seg.size); + g_fxo->get().apply(_applied, hash_seg, [&](u32 addr, u32 size) + { + return prx->get_ptr(addr + seg.addr, size); + }, + seg.size); if (!Emu.GetTitleID().empty()) { // Alternative patch - g_fxo->get().apply(_applied, Emu.GetTitleID() + '-' + hash_seg, [&](u32 addr, u32 size) { return prx->get_ptr(addr + seg.addr, size); }, seg.size); + g_fxo->get().apply(_applied, Emu.GetTitleID() + '-' + hash_seg, [&](u32 addr, u32 size) + { + return prx->get_ptr(addr + seg.addr, size); + }, + seg.size); } // Rebase patch offsets - std::for_each(_applied.begin(), _applied.end(), [&](u32& res) { if (res != umax) res += seg.addr; }); + std::for_each(_applied.begin(), _applied.end(), [&](u32& res) + { + if (res != umax) + res += seg.addr; + }); applied.insert(applied.end(), _applied.begin(), _applied.end()); @@ -2015,7 +2037,7 @@ void ppu_unload_prx(const lv2_prx& prx) pinfo->imports.erase(imp.first); } - //for (auto& exp : prx.exports) + // for (auto& exp : prx.exports) //{ // auto pinfo = static_cast(exp.second); // if (pinfo->static_func) @@ -2030,7 +2052,7 @@ void ppu_unload_prx(const lv2_prx& prx) // { // pinfo->export_addr = 0; // } - //} + // } if (lock) { @@ -2048,7 +2070,8 @@ void ppu_unload_prx(const lv2_prx& prx) for (auto& seg : prx.segs) { - if (!seg.size) continue; + if (!seg.size) + continue; vm::dealloc(seg.addr, vm::main); @@ -2154,7 +2177,7 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str const u32 size = _seg.size = ::narrow(prog.p_memsz); const u32 type = _seg.type = prog.p_type; - _seg.flags = prog.p_flags; + _seg.flags = prog.p_flags; _seg.filesz = ::narrow(prog.p_filesz); // Hash big-endian values @@ -2187,26 +2210,26 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str { } else if (![&]() -> bool - { - // 1M pages if it is RSX shared - const u32 area_flags = (_seg.flags >> 28) ? vm::page_size_1m : vm::page_size_64k; - const u32 alloc_at = std::max(addr & -0x10000000, 0x10000); - - const auto area = vm::reserve_map(vm::any, std::max(addr & -0x10000000, 0x10000), 0x10000000, area_flags); - - if (!area) { - return false; - } + // 1M pages if it is RSX shared + const u32 area_flags = (_seg.flags >> 28) ? vm::page_size_1m : vm::page_size_64k; + const u32 alloc_at = std::max(addr & -0x10000000, 0x10000); - if (area->addr != alloc_at || (area->flags & 0xf00) != area_flags) - { - ppu_loader.error("Failed to allocate memory at 0x%x - conflicting memory area exists: area->addr=0x%x, area->flags=0x%x", addr, area->addr, area->flags); - return false; - } + const auto area = vm::reserve_map(vm::any, std::max(addr & -0x10000000, 0x10000), 0x10000000, area_flags); - return area->falloc(addr, size); - }()) + if (!area) + { + return false; + } + + if (area->addr != alloc_at || (area->flags & 0xf00) != area_flags) + { + ppu_loader.error("Failed to allocate memory at 0x%x - conflicting memory area exists: area->addr=0x%x, area->flags=0x%x", addr, area->addr, area->flags); + return false; + } + + return area->falloc(addr, size); + }()) { ppu_loader.error("ppu_load_exec(): vm::falloc() failed (addr=0x%x, memsz=0x%x)", addr, size); return false; @@ -2246,7 +2269,8 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str { ppu_loader.notice("** Section: sh_type=0x%x, addr=0x%llx, size=0x%llx, flags=0x%x", std::bit_cast(s.sh_type), s.sh_addr, s.sh_size, s._sh_flags); - if (s.sh_type != sec_type::sht_progbits) continue; + if (s.sh_type != sec_type::sht_progbits) + continue; ppu_segment _sec; const u32 addr = _sec.addr = vm::cast(s.sh_addr); @@ -2282,12 +2306,18 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str // Apply the patch std::vector applied; - g_fxo->get().apply(applied, !ar ? hash : std::string{}, [&](u32 addr, u32 size) { return _main.get_ptr(addr, size); }); + g_fxo->get().apply(applied, !ar ? hash : std::string{}, [&](u32 addr, u32 size) + { + return _main.get_ptr(addr, size); + }); if (!ar && !Emu.GetTitleID().empty()) { // Alternative patch - g_fxo->get().apply(applied, Emu.GetTitleID() + '-' + hash, [&](u32 addr, u32 size) { return _main.get_ptr(addr, size); }); + g_fxo->get().apply(applied, Emu.GetTitleID() + '-' + hash, [&](u32 addr, u32 size) + { + return _main.get_ptr(addr, size); + }); } if (!applied.empty() || ar) @@ -2412,7 +2442,7 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str be_t primary_stacksize; be_t malloc_pagesize; be_t ppc_seg; - //be_t crash_dump_param_addr; + // be_t crash_dump_param_addr; }; const auto& info = *ensure(_main.get_ptr(vm::cast(prog.p_vaddr))); @@ -2430,8 +2460,7 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str { sdk_version = info.sdk_version; - if (s32 prio = info.primary_prio; prio < 3072 - && (prio >= (g_ps3_process_info.debug_or_root() ? 0 : -512))) + if (s32 prio = info.primary_prio; prio < 3072 && (prio >= (g_ps3_process_info.debug_or_root() ? 0 : -512))) { primary_prio = prio; } @@ -2445,7 +2474,7 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str ppu_loader.notice("*** primary stacksize: 0x%x", info.primary_stacksize); ppu_loader.notice("*** malloc pagesize: 0x%x", info.malloc_pagesize); ppu_loader.notice("*** ppc seg: 0x%x", info.ppc_seg); - //ppu_loader.notice("*** crash dump param addr: 0x%x", info.crash_dump_param_addr); + // ppu_loader.notice("*** crash dump param addr: 0x%x", info.crash_dump_param_addr); } } break; @@ -2568,8 +2597,8 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str if (!fs::is_file(lle_dir + "liblv2.sprx")) { ppu_loader.error("PS3 firmware is not installed or the installed firmware is invalid." - "\nYou should install the PS3 Firmware (Menu: File -> Install Firmware)." - "\nVisit https://rpcs3.net/ for Quickstart Guide and more information."); + "\nYou should install the PS3 Firmware (Menu: File -> Install Firmware)." + "\nVisit https://rpcs3.net/ for Quickstart Guide and more information."); } // Program entry @@ -2607,7 +2636,7 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str ensure(g_fxo->init(mem_size)); } - void init_fxo_for_exec(utils::serial* ar, bool full); + void init_fxo_for_exec(utils::serial * ar, bool full); init_fxo_for_exec(ar, false); liblv2_begin = 0; @@ -2644,7 +2673,7 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str if (name == "liblv2.sprx") { - // Run liblv2.sprx entry point (TODO) + // Run liblv2.sprx entry point (TODO) entry = prx->start.addr(); } else @@ -2682,13 +2711,13 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str // Fix primary stack size switch (u32 sz = primary_stacksize) { - case SYS_PROCESS_PRIMARY_STACK_SIZE_32K: primary_stacksize = 32 * 1024; break; - case SYS_PROCESS_PRIMARY_STACK_SIZE_64K: primary_stacksize = 64 * 1024; break; - case SYS_PROCESS_PRIMARY_STACK_SIZE_96K: primary_stacksize = 96 * 1024; break; - case SYS_PROCESS_PRIMARY_STACK_SIZE_128K: primary_stacksize = 128 * 1024; break; - case SYS_PROCESS_PRIMARY_STACK_SIZE_256K: primary_stacksize = 256 * 1024; break; - case SYS_PROCESS_PRIMARY_STACK_SIZE_512K: primary_stacksize = 512 * 1024; break; - case SYS_PROCESS_PRIMARY_STACK_SIZE_1M: primary_stacksize = 1024 * 1024; break; + case SYS_PROCESS_PRIMARY_STACK_SIZE_32K: primary_stacksize = 32 * 1024; break; + case SYS_PROCESS_PRIMARY_STACK_SIZE_64K: primary_stacksize = 64 * 1024; break; + case SYS_PROCESS_PRIMARY_STACK_SIZE_96K: primary_stacksize = 96 * 1024; break; + case SYS_PROCESS_PRIMARY_STACK_SIZE_128K: primary_stacksize = 128 * 1024; break; + case SYS_PROCESS_PRIMARY_STACK_SIZE_256K: primary_stacksize = 256 * 1024; break; + case SYS_PROCESS_PRIMARY_STACK_SIZE_512K: primary_stacksize = 512 * 1024; break; + case SYS_PROCESS_PRIMARY_STACK_SIZE_1M: primary_stacksize = 1024 * 1024; break; default: { // According to elad335, the min value seems to be 64KB instead of the expected 4KB (SYS_PROCESS_PARAM_STACK_SIZE_MIN) @@ -2772,10 +2801,13 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str if (entry == static_cast(elf.header.e_entry) && !Emu.IsVsh()) { // Set TLS args, call sys_initialize_tls - ppu->cmd_list - ({ - { ppu_cmd::set_args, 4 }, u64{ppu->id}, u64{tls_vaddr}, u64{tls_fsize}, u64{tls_vsize}, - { ppu_cmd::hle_call, FIND_FUNC(sys_initialize_tls) }, + ppu->cmd_list({ + {ppu_cmd::set_args, 4}, + u64{ppu->id}, + u64{tls_vaddr}, + u64{tls_fsize}, + u64{tls_vsize}, + {ppu_cmd::hle_call, FIND_FUNC(sys_initialize_tls)}, }); } @@ -2788,20 +2820,30 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str } // Reset arguments, run module entry point function - ppu->cmd_list - ({ - { ppu_cmd::set_args, 2 }, u64{0}, u64{0}, - { ppu_cmd::lle_call, prx->start.addr() }, + ppu->cmd_list({ + {ppu_cmd::set_args, 2}, + u64{0}, + u64{0}, + {ppu_cmd::lle_call, prx->start.addr()}, }); } // Set command line arguments, run entry function - ppu->cmd_list - ({ - { ppu_cmd::set_args, 8 }, u64{Emu.argv.size()}, u64{argv.addr()}, u64{envp.addr()}, u64{Emu.envp.size()}, u64{ppu->id}, u64{tls_vaddr}, u64{tls_fsize}, u64{tls_vsize}, - { ppu_cmd::set_gpr, 11 }, u64{elf.header.e_entry}, - { ppu_cmd::set_gpr, 12 }, u64{malloc_pagesize}, - { ppu_cmd::entry_call, 0 }, + ppu->cmd_list({ + {ppu_cmd::set_args, 8}, + u64{Emu.argv.size()}, + u64{argv.addr()}, + u64{envp.addr()}, + u64{Emu.envp.size()}, + u64{ppu->id}, + u64{tls_vaddr}, + u64{tls_fsize}, + u64{tls_vsize}, + {ppu_cmd::set_gpr, 11}, + u64{elf.header.e_entry}, + {ppu_cmd::set_gpr, 12}, + u64{malloc_pagesize}, + {ppu_cmd::entry_call, 0}, }); // Set actual memory protection (experimental) @@ -2924,7 +2966,8 @@ std::pair, CellError> ppu_load_overlay(const ppu_exec_ob ovlm->addr_to_seg_index.emplace(addr, ::size32(ovlm->segs) - 1); // Copy segment data, hash it - if (!already_loaded) std::memcpy(ensure(ovlm->get_ptr(addr)), prog.bin.data(), prog.bin.size()); + if (!already_loaded) + std::memcpy(ensure(ovlm->get_ptr(addr)), prog.bin.data(), prog.bin.size()); sha1_update(&sha, reinterpret_cast(&prog.p_vaddr), sizeof(prog.p_vaddr)); sha1_update(&sha, reinterpret_cast(&prog.p_memsz), sizeof(prog.p_memsz)); sha1_update(&sha, prog.bin.data(), prog.bin.size()); @@ -2942,7 +2985,8 @@ std::pair, CellError> ppu_load_overlay(const ppu_exec_ob { ppu_loader.notice("** Section: sh_type=0x%x, addr=0x%llx, size=0x%llx, flags=0x%x", std::bit_cast(s.sh_type), s.sh_addr, s.sh_size, s._sh_flags); - if (s.sh_type != sec_type::sht_progbits) continue; + if (s.sh_type != sec_type::sht_progbits) + continue; ppu_segment _sec; const u32 addr = _sec.addr = vm::cast(s.sh_addr); @@ -2976,12 +3020,18 @@ std::pair, CellError> ppu_load_overlay(const ppu_exec_ob // Apply the patch std::vector applied; - g_fxo->get().apply(applied, !Emu.DeserialManager() ? hash : std::string{}, [ovlm](u32 addr, u32 size) { return ovlm->get_ptr(addr, size); }); + g_fxo->get().apply(applied, !Emu.DeserialManager() ? hash : std::string{}, [ovlm](u32 addr, u32 size) + { + return ovlm->get_ptr(addr, size); + }); if (!Emu.DeserialManager() && !Emu.GetTitleID().empty()) { // Alternative patch - g_fxo->get().apply(applied, Emu.GetTitleID() + '-' + hash, [ovlm](u32 addr, u32 size) { return ovlm->get_ptr(addr, size); }); + g_fxo->get().apply(applied, Emu.GetTitleID() + '-' + hash, [ovlm](u32 addr, u32 size) + { + return ovlm->get_ptr(addr, size); + }); } if (!applied.empty() || ar) @@ -3039,12 +3089,12 @@ std::pair, CellError> ppu_load_overlay(const ppu_exec_ob { struct process_param_t { - be_t size; //0x60 - be_t magic; //string OVLM - be_t version; //0x17000 - be_t sdk_version; //seems to be correct - //string "stage_ovlm" - //and a lot of zeros. + be_t size; // 0x60 + be_t magic; // string OVLM + be_t version; // 0x17000 + be_t sdk_version; // seems to be correct + // string "stage_ovlm" + // and a lot of zeros. }; const auto& info = *ensure(ovlm->get_ptr(vm::cast(prog.p_vaddr))); @@ -3054,7 +3104,7 @@ std::pair, CellError> ppu_load_overlay(const ppu_exec_ob ppu_loader.warning("Bad process_param size! [0x%x : 0x%x]", info.size, u32{sizeof(process_param_t)}); } - if (info.magic != 0x4f564c4du) //string "OVLM" + if (info.magic != 0x4f564c4du) // string "OVLM" { ppu_loader.error("Bad process_param magic! [0x%x]", info.magic); } @@ -3104,7 +3154,6 @@ std::pair, CellError> ppu_load_overlay(const ppu_exec_ob std::tie(std::ignore, nid_to_use_addr) = ppu_load_imports(*ovlm, ovlm->relocs, virtual_load ? &dummy : &link, proc_prx_param.libstub_start, proc_prx_param.libstub_end); select_from_nids_scenpdrm_addrs(ovlm->stub_addr_to_constant_state_of_registers, nid_to_use_addr); - } break; } @@ -3131,9 +3180,9 @@ std::pair, CellError> ppu_load_overlay(const ppu_exec_ob // Analyse executable (TODO) if (!ovlm->analyse(0, ovlm->entry, end, ovlm->applied_patches, std::vector{}, !cpu ? std::function() : [cpu]() - { - return !!(cpu->state & cpu_flag::exit); - })) + { + return !!(cpu->state & cpu_flag::exit); + })) { return {null_ptr, CellError{CELL_CANCEL + 0u}}; } @@ -3204,10 +3253,10 @@ bool ppu_load_rel_exec(const ppu_rel_object& elf) } std::stable_sort(shdrs.begin(), shdrs.end(), [](auto& a, auto& b) -> bool - { - const bs_t flags_a_has = a->sh_flags() - b->sh_flags(); - return flags_a_has.all_of(sh_flag::shf_execinstr); - }); + { + const bs_t flags_a_has = a->sh_flags() - b->sh_flags(); + return flags_a_has.all_of(sh_flag::shf_execinstr); + }); // Load sections for (auto ptr : shdrs) diff --git a/rpcs3/rpcs3/Emu/Cell/PPUModule.h b/rpcs3/rpcs3/Emu/Cell/PPUModule.h index fdcd736f3..3a893a006 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUModule.h +++ b/rpcs3/rpcs3/Emu/Cell/PPUModule.h @@ -30,8 +30,8 @@ constexpr u32 ppu_generate_id(u32 id) enum ppu_static_module_flags : u32 { MFF_FORCED_HLE = (1 << 0), // Always call HLE function - MFF_PERFECT = (1 << 1), // Indicates complete implementation and LLE interchangeability - MFF_HIDDEN = (1 << 2), // Invisible variable for internal use (TODO) + MFF_PERFECT = (1 << 1), // Indicates complete implementation and LLE interchangeability + MFF_HIDDEN = (1 << 2), // Invisible variable for internal use (TODO) }; // HLE function information @@ -54,8 +54,8 @@ struct ppu_static_function struct ppu_static_variable { const char* name; - u32* var; // Pointer to variable address storage - void(*init)(); // Variable initialization function + u32* var; // Pointer to variable address storage + void (*init)(); // Variable initialization function u32 size; u32 align; u32 flags; @@ -72,7 +72,7 @@ struct ppu_static_variable // HLE module information class ppu_static_module final { - std::vector m_on_init; + std::vector m_on_init; public: const std::string name; @@ -83,19 +83,19 @@ public: ppu_static_module(const char* name); public: - ppu_static_module(const char* name, void(*init)()) + ppu_static_module(const char* name, void (*init)()) : ppu_static_module(name) { init(); } - ppu_static_module(const char* name, void(*init)(ppu_static_module* _this)) + ppu_static_module(const char* name, void (*init)(ppu_static_module* _this)) : ppu_static_module(name) { init(this); } - void add_init_func(void(*func)(ppu_static_module*)); + void add_init_func(void (*func)(ppu_static_module*)); void initialize(); }; @@ -127,7 +127,7 @@ public: { auto& info = access_static_function(_module, fnid); - info.name = name; + info.name = name; info.index = ppu_function_manager::register_function(func); info.flags = 0; @@ -151,13 +151,13 @@ public: auto& info = access_static_variable(_module, vnid); - info.name = name; - info.var = &Var->raw(); - info.init = [] {}; - info.size = gvar::alloc_size; + info.name = name; + info.var = &Var->raw(); + info.init = [] {}; + info.size = gvar::alloc_size; info.align = gvar::alloc_align; info.flags = 0; - info.addr = 0; + info.addr = 0; return info; } diff --git a/rpcs3/rpcs3/Emu/Cell/PPUOpcodes.h b/rpcs3/rpcs3/Emu/Cell/PPUOpcodes.h index de517014b..8fbbcdcb0 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUOpcodes.h +++ b/rpcs3/rpcs3/Emu/Cell/PPUOpcodes.h @@ -2,61 +2,62 @@ #include "Utilities/BitField.h" -template using ppu_bf_t = bf_t; +template +using ppu_bf_t = bf_t; union ppu_opcode_t { u32 opcode; - ppu_bf_t main; // 0..5 - cf_t, ppu_bf_t> sh64; // 30 + 16..20 + ppu_bf_t main; // 0..5 + cf_t, ppu_bf_t> sh64; // 30 + 16..20 cf_t, ppu_bf_t> mbe64; // 26 + 21..25 - ppu_bf_t vuimm; // 11..15 - ppu_bf_t vs; // 6..10 - ppu_bf_t vsh; // 22..25 - ppu_bf_t oe; // 21 - ppu_bf_t spr; // 11..20 - ppu_bf_t vc; // 21..25 - ppu_bf_t vb; // 16..20 - ppu_bf_t va; // 11..15 - ppu_bf_t vd; // 6..10 - ppu_bf_t lk; // 31 - ppu_bf_t aa; // 30 - ppu_bf_t rb; // 16..20 - ppu_bf_t ra; // 11..15 - ppu_bf_t rd; // 6..10 - ppu_bf_t uimm16; // 16..31 - ppu_bf_t l11; // 11 - ppu_bf_t rs; // 6..10 - ppu_bf_t simm16; // 16..31, signed - ppu_bf_t ds; // 16..29, signed - ppu_bf_t vsimm; // 11..15, signed - ppu_bf_t ll; // 6..31, signed - ppu_bf_t li; // 6..29, signed - ppu_bf_t lev; // 20..26 - ppu_bf_t i; // 16..19 - ppu_bf_t crfs; // 11..13 - ppu_bf_t l10; // 10 - ppu_bf_t crfd; // 6..8 - ppu_bf_t crbb; // 16..20 - ppu_bf_t crba; // 11..15 - ppu_bf_t crbd; // 6..10 - ppu_bf_t rc; // 31 - ppu_bf_t me32; // 26..30 - ppu_bf_t mb32; // 21..25 - ppu_bf_t sh32; // 16..20 - ppu_bf_t bi; // 11..15 - ppu_bf_t bo; // 6..10 - ppu_bf_t bh; // 19..20 - ppu_bf_t frc; // 21..25 - ppu_bf_t frb; // 16..20 - ppu_bf_t fra; // 11..15 - ppu_bf_t frd; // 6..10 - ppu_bf_t crm; // 12..19 - ppu_bf_t frs; // 6..10 - ppu_bf_t flm; // 7..14 - ppu_bf_t l6; // 6 - ppu_bf_t l15; // 15 + ppu_bf_t vuimm; // 11..15 + ppu_bf_t vs; // 6..10 + ppu_bf_t vsh; // 22..25 + ppu_bf_t oe; // 21 + ppu_bf_t spr; // 11..20 + ppu_bf_t vc; // 21..25 + ppu_bf_t vb; // 16..20 + ppu_bf_t va; // 11..15 + ppu_bf_t vd; // 6..10 + ppu_bf_t lk; // 31 + ppu_bf_t aa; // 30 + ppu_bf_t rb; // 16..20 + ppu_bf_t ra; // 11..15 + ppu_bf_t rd; // 6..10 + ppu_bf_t uimm16; // 16..31 + ppu_bf_t l11; // 11 + ppu_bf_t rs; // 6..10 + ppu_bf_t simm16; // 16..31, signed + ppu_bf_t ds; // 16..29, signed + ppu_bf_t vsimm; // 11..15, signed + ppu_bf_t ll; // 6..31, signed + ppu_bf_t li; // 6..29, signed + ppu_bf_t lev; // 20..26 + ppu_bf_t i; // 16..19 + ppu_bf_t crfs; // 11..13 + ppu_bf_t l10; // 10 + ppu_bf_t crfd; // 6..8 + ppu_bf_t crbb; // 16..20 + ppu_bf_t crba; // 11..15 + ppu_bf_t crbd; // 6..10 + ppu_bf_t rc; // 31 + ppu_bf_t me32; // 26..30 + ppu_bf_t mb32; // 21..25 + ppu_bf_t sh32; // 16..20 + ppu_bf_t bi; // 11..15 + ppu_bf_t bo; // 6..10 + ppu_bf_t bh; // 19..20 + ppu_bf_t frc; // 21..25 + ppu_bf_t frb; // 16..20 + ppu_bf_t fra; // 11..15 + ppu_bf_t frd; // 6..10 + ppu_bf_t crm; // 12..19 + ppu_bf_t frs; // 6..10 + ppu_bf_t flm; // 7..14 + ppu_bf_t l6; // 6 + ppu_bf_t l15; // 15 cf_t, ff_t> bt14; cf_t, ff_t> bt24; }; @@ -89,18 +90,12 @@ class ppu_decoder u32 magn; // Non-zero for "columns" (effectively, number of most significant bits "eaten") constexpr instruction_info(u32 v, T p, T p_rc, u32 m = 0) - : value(v) - , ptr0(p) - , ptr_rc(p_rc) - , magn(m) + : value(v), ptr0(p), ptr_rc(p_rc), magn(m) { } constexpr instruction_info(u32 v, const T* p, const T* p_rc, u32 m = 0) - : value(v) - , ptr0(*p) - , ptr_rc(*p_rc) - , magn(m) + : value(v), ptr0(*p), ptr_rc(*p_rc), magn(m) { } }; @@ -146,7 +141,12 @@ public: ppu_decoder(const Args&... args) noexcept { // If an object is passed to the constructor, assign values from that object -#define GET_(name) [&]{ if constexpr (sizeof...(Args) > 0) return _first(args...).name; else return &D::name; }() +#define GET_(name) [&] { \ + if constexpr (sizeof...(Args) > 0) \ + return _first(args...).name; \ + else \ + return &D::name; \ +}() #define GET(name) GET_(name), GET_(name) #define GETRC(name) GET_(name), GET_(name##_) @@ -159,469 +159,469 @@ public: // Main opcodes (field 0..5) fill_table(0x00, 6, -1, - { - { 0x02, GET(TDI) }, - { 0x03, GET(TWI) }, - { 0x07, GET(MULLI) }, - { 0x08, GET(SUBFIC) }, - { 0x0a, GET(CMPLI) }, - { 0x0b, GET(CMPI) }, - { 0x0c, GET(ADDIC) }, - { 0x0d, GET(ADDIC) }, - { 0x0e, GET(ADDI) }, - { 0x0f, GET(ADDIS) }, - { 0x10, GET(BC) }, - { 0x11, GET(SC) }, - { 0x12, GET(B) }, - { 0x14, GETRC(RLWIMI) }, - { 0x15, GETRC(RLWINM) }, - { 0x17, GETRC(RLWNM) }, - { 0x18, GET(ORI) }, - { 0x19, GET(ORIS) }, - { 0x1a, GET(XORI) }, - { 0x1b, GET(XORIS) }, - { 0x1c, GET(ANDI) }, - { 0x1d, GET(ANDIS) }, - { 0x20, GET(LWZ) }, - { 0x21, GET(LWZU) }, - { 0x22, GET(LBZ) }, - { 0x23, GET(LBZU) }, - { 0x24, GET(STW) }, - { 0x25, GET(STWU) }, - { 0x26, GET(STB) }, - { 0x27, GET(STBU) }, - { 0x28, GET(LHZ) }, - { 0x29, GET(LHZU) }, - { 0x2a, GET(LHA) }, - { 0x2b, GET(LHAU) }, - { 0x2c, GET(STH) }, - { 0x2d, GET(STHU) }, - { 0x2e, GET(LMW) }, - { 0x2f, GET(STMW) }, - { 0x30, GET(LFS) }, - { 0x31, GET(LFSU) }, - { 0x32, GET(LFD) }, - { 0x33, GET(LFDU) }, - { 0x34, GET(STFS) }, - { 0x35, GET(STFSU) }, - { 0x36, GET(STFD) }, - { 0x37, GET(STFDU) }, - }); + { + {0x02, GET(TDI)}, + {0x03, GET(TWI)}, + {0x07, GET(MULLI)}, + {0x08, GET(SUBFIC)}, + {0x0a, GET(CMPLI)}, + {0x0b, GET(CMPI)}, + {0x0c, GET(ADDIC)}, + {0x0d, GET(ADDIC)}, + {0x0e, GET(ADDI)}, + {0x0f, GET(ADDIS)}, + {0x10, GET(BC)}, + {0x11, GET(SC)}, + {0x12, GET(B)}, + {0x14, GETRC(RLWIMI)}, + {0x15, GETRC(RLWINM)}, + {0x17, GETRC(RLWNM)}, + {0x18, GET(ORI)}, + {0x19, GET(ORIS)}, + {0x1a, GET(XORI)}, + {0x1b, GET(XORIS)}, + {0x1c, GET(ANDI)}, + {0x1d, GET(ANDIS)}, + {0x20, GET(LWZ)}, + {0x21, GET(LWZU)}, + {0x22, GET(LBZ)}, + {0x23, GET(LBZU)}, + {0x24, GET(STW)}, + {0x25, GET(STWU)}, + {0x26, GET(STB)}, + {0x27, GET(STBU)}, + {0x28, GET(LHZ)}, + {0x29, GET(LHZU)}, + {0x2a, GET(LHA)}, + {0x2b, GET(LHAU)}, + {0x2c, GET(STH)}, + {0x2d, GET(STHU)}, + {0x2e, GET(LMW)}, + {0x2f, GET(STMW)}, + {0x30, GET(LFS)}, + {0x31, GET(LFSU)}, + {0x32, GET(LFD)}, + {0x33, GET(LFDU)}, + {0x34, GET(STFS)}, + {0x35, GET(STFSU)}, + {0x36, GET(STFD)}, + {0x37, GET(STFDU)}, + }); // Group 0x04 opcodes (field 21..31) fill_table(0x04, 11, 0, - { - { 0x0, GET(VADDUBM) }, - { 0x2, GET(VMAXUB) }, - { 0x4, GET(VRLB) }, - { 0x006, GET(VCMPEQUB) }, - { 0x406, GET(VCMPEQUB_) }, - { 0x8, GET(VMULOUB) }, - { 0xa, GET(VADDFP) }, - { 0xc, GET(VMRGHB) }, - { 0xe, GET(VPKUHUM) }, + { + {0x0, GET(VADDUBM)}, + {0x2, GET(VMAXUB)}, + {0x4, GET(VRLB)}, + {0x006, GET(VCMPEQUB)}, + {0x406, GET(VCMPEQUB_)}, + {0x8, GET(VMULOUB)}, + {0xa, GET(VADDFP)}, + {0xc, GET(VMRGHB)}, + {0xe, GET(VPKUHUM)}, - { 0x20, GET(VMHADDSHS), 5 }, - { 0x21, GET(VMHRADDSHS), 5 }, - { 0x22, GET(VMLADDUHM), 5 }, - { 0x24, GET(VMSUMUBM), 5 }, - { 0x25, GET(VMSUMMBM), 5 }, - { 0x26, GET(VMSUMUHM), 5 }, - { 0x27, GET(VMSUMUHS), 5 }, - { 0x28, GET(VMSUMSHM), 5 }, - { 0x29, GET(VMSUMSHS), 5 }, - { 0x2a, GET(VSEL), 5 }, - { 0x2b, GET(VPERM), 5 }, - { 0x2c, GET(VSLDOI), 5 }, - { 0x2e, GET(VMADDFP), 5 }, - { 0x2f, GET(VNMSUBFP), 5 }, + {0x20, GET(VMHADDSHS), 5}, + {0x21, GET(VMHRADDSHS), 5}, + {0x22, GET(VMLADDUHM), 5}, + {0x24, GET(VMSUMUBM), 5}, + {0x25, GET(VMSUMMBM), 5}, + {0x26, GET(VMSUMUHM), 5}, + {0x27, GET(VMSUMUHS), 5}, + {0x28, GET(VMSUMSHM), 5}, + {0x29, GET(VMSUMSHS), 5}, + {0x2a, GET(VSEL), 5}, + {0x2b, GET(VPERM), 5}, + {0x2c, GET(VSLDOI), 5}, + {0x2e, GET(VMADDFP), 5}, + {0x2f, GET(VNMSUBFP), 5}, - { 0x40, GET(VADDUHM) }, - { 0x42, GET(VMAXUH) }, - { 0x44, GET(VRLH) }, - { 0x046, GET(VCMPEQUH) }, - { 0x446, GET(VCMPEQUH_) }, - { 0x48, GET(VMULOUH) }, - { 0x4a, GET(VSUBFP) }, - { 0x4c, GET(VMRGHH) }, - { 0x4e, GET(VPKUWUM) }, - { 0x80, GET(VADDUWM) }, - { 0x82, GET(VMAXUW) }, - { 0x84, GET(VRLW) }, - { 0x086, GET(VCMPEQUW) }, - { 0x486, GET(VCMPEQUW_) }, - { 0x8c, GET(VMRGHW) }, - { 0x8e, GET(VPKUHUS) }, - { 0x0c6, GET(VCMPEQFP) }, - { 0x4c6, GET(VCMPEQFP_) }, - { 0xce, GET(VPKUWUS) }, + {0x40, GET(VADDUHM)}, + {0x42, GET(VMAXUH)}, + {0x44, GET(VRLH)}, + {0x046, GET(VCMPEQUH)}, + {0x446, GET(VCMPEQUH_)}, + {0x48, GET(VMULOUH)}, + {0x4a, GET(VSUBFP)}, + {0x4c, GET(VMRGHH)}, + {0x4e, GET(VPKUWUM)}, + {0x80, GET(VADDUWM)}, + {0x82, GET(VMAXUW)}, + {0x84, GET(VRLW)}, + {0x086, GET(VCMPEQUW)}, + {0x486, GET(VCMPEQUW_)}, + {0x8c, GET(VMRGHW)}, + {0x8e, GET(VPKUHUS)}, + {0x0c6, GET(VCMPEQFP)}, + {0x4c6, GET(VCMPEQFP_)}, + {0xce, GET(VPKUWUS)}, - { 0x102, GET(VMAXSB) }, - { 0x104, GET(VSLB) }, - { 0x108, GET(VMULOSB) }, - { 0x10a, GET(VREFP) }, - { 0x10c, GET(VMRGLB) }, - { 0x10e, GET(VPKSHUS) }, - { 0x142, GET(VMAXSH) }, - { 0x144, GET(VSLH) }, - { 0x148, GET(VMULOSH) }, - { 0x14a, GET(VRSQRTEFP) }, - { 0x14c, GET(VMRGLH) }, - { 0x14e, GET(VPKSWUS) }, - { 0x180, GET(VADDCUW) }, - { 0x182, GET(VMAXSW) }, - { 0x184, GET(VSLW) }, - { 0x18a, GET(VEXPTEFP) }, - { 0x18c, GET(VMRGLW) }, - { 0x18e, GET(VPKSHSS) }, - { 0x1c4, GET(VSL) }, - { 0x1c6, GET(VCMPGEFP) }, - { 0x5c6, GET(VCMPGEFP_) }, - { 0x1ca, GET(VLOGEFP) }, - { 0x1ce, GET(VPKSWSS) }, - { 0x200, GET(VADDUBS) }, - { 0x202, GET(VMINUB) }, - { 0x204, GET(VSRB) }, - { 0x206, GET(VCMPGTUB) }, - { 0x606, GET(VCMPGTUB_) }, - { 0x208, GET(VMULEUB) }, - { 0x20a, GET(VRFIN) }, - { 0x20c, GET(VSPLTB) }, - { 0x20e, GET(VUPKHSB) }, - { 0x240, GET(VADDUHS) }, - { 0x242, GET(VMINUH) }, - { 0x244, GET(VSRH) }, - { 0x246, GET(VCMPGTUH) }, - { 0x646, GET(VCMPGTUH_) }, - { 0x248, GET(VMULEUH) }, - { 0x24a, GET(VRFIZ) }, - { 0x24c, GET(VSPLTH) }, - { 0x24e, GET(VUPKHSH) }, - { 0x280, GET(VADDUWS) }, - { 0x282, GET(VMINUW) }, - { 0x284, GET(VSRW) }, - { 0x286, GET(VCMPGTUW) }, - { 0x686, GET(VCMPGTUW_) }, - { 0x28a, GET(VRFIP) }, - { 0x28c, GET(VSPLTW) }, - { 0x28e, GET(VUPKLSB) }, - { 0x2c4, GET(VSR) }, - { 0x2c6, GET(VCMPGTFP) }, - { 0x6c6, GET(VCMPGTFP_) }, - { 0x2ca, GET(VRFIM) }, - { 0x2ce, GET(VUPKLSH) }, - { 0x300, GET(VADDSBS) }, - { 0x302, GET(VMINSB) }, - { 0x304, GET(VSRAB) }, - { 0x306, GET(VCMPGTSB) }, - { 0x706, GET(VCMPGTSB_) }, - { 0x308, GET(VMULESB) }, - { 0x30a, GET(VCFUX) }, - { 0x30c, GET(VSPLTISB) }, - { 0x30e, GET(VPKPX) }, - { 0x340, GET(VADDSHS) }, - { 0x342, GET(VMINSH) }, - { 0x344, GET(VSRAH) }, - { 0x346, GET(VCMPGTSH) }, - { 0x746, GET(VCMPGTSH_) }, - { 0x348, GET(VMULESH) }, - { 0x34a, GET(VCFSX) }, - { 0x34c, GET(VSPLTISH) }, - { 0x34e, GET(VUPKHPX) }, - { 0x380, GET(VADDSWS) }, - { 0x382, GET(VMINSW) }, - { 0x384, GET(VSRAW) }, - { 0x386, GET(VCMPGTSW) }, - { 0x786, GET(VCMPGTSW_) }, - { 0x38a, GET(VCTUXS) }, - { 0x38c, GET(VSPLTISW) }, - { 0x3c6, GET(VCMPBFP) }, - { 0x7c6, GET(VCMPBFP_) }, - { 0x3ca, GET(VCTSXS) }, - { 0x3ce, GET(VUPKLPX) }, - { 0x400, GET(VSUBUBM) }, - { 0x402, GET(VAVGUB) }, - { 0x404, GET(VAND) }, - { 0x40a, GET(VMAXFP) }, - { 0x40c, GET(VSLO) }, - { 0x440, GET(VSUBUHM) }, - { 0x442, GET(VAVGUH) }, - { 0x444, GET(VANDC) }, - { 0x44a, GET(VMINFP) }, - { 0x44c, GET(VSRO) }, - { 0x480, GET(VSUBUWM) }, - { 0x482, GET(VAVGUW) }, - { 0x484, GET(VOR) }, - { 0x4c4, GET(VXOR) }, - { 0x502, GET(VAVGSB) }, - { 0x504, GET(VNOR) }, - { 0x542, GET(VAVGSH) }, - { 0x580, GET(VSUBCUW) }, - { 0x582, GET(VAVGSW) }, - { 0x600, GET(VSUBUBS) }, - { 0x604, GET(MFVSCR) }, - { 0x608, GET(VSUM4UBS) }, - { 0x640, GET(VSUBUHS) }, - { 0x644, GET(MTVSCR) }, - { 0x648, GET(VSUM4SHS) }, - { 0x680, GET(VSUBUWS) }, - { 0x688, GET(VSUM2SWS) }, - { 0x700, GET(VSUBSBS) }, - { 0x708, GET(VSUM4SBS) }, - { 0x740, GET(VSUBSHS) }, - { 0x780, GET(VSUBSWS) }, - { 0x788, GET(VSUMSWS) }, - }); + {0x102, GET(VMAXSB)}, + {0x104, GET(VSLB)}, + {0x108, GET(VMULOSB)}, + {0x10a, GET(VREFP)}, + {0x10c, GET(VMRGLB)}, + {0x10e, GET(VPKSHUS)}, + {0x142, GET(VMAXSH)}, + {0x144, GET(VSLH)}, + {0x148, GET(VMULOSH)}, + {0x14a, GET(VRSQRTEFP)}, + {0x14c, GET(VMRGLH)}, + {0x14e, GET(VPKSWUS)}, + {0x180, GET(VADDCUW)}, + {0x182, GET(VMAXSW)}, + {0x184, GET(VSLW)}, + {0x18a, GET(VEXPTEFP)}, + {0x18c, GET(VMRGLW)}, + {0x18e, GET(VPKSHSS)}, + {0x1c4, GET(VSL)}, + {0x1c6, GET(VCMPGEFP)}, + {0x5c6, GET(VCMPGEFP_)}, + {0x1ca, GET(VLOGEFP)}, + {0x1ce, GET(VPKSWSS)}, + {0x200, GET(VADDUBS)}, + {0x202, GET(VMINUB)}, + {0x204, GET(VSRB)}, + {0x206, GET(VCMPGTUB)}, + {0x606, GET(VCMPGTUB_)}, + {0x208, GET(VMULEUB)}, + {0x20a, GET(VRFIN)}, + {0x20c, GET(VSPLTB)}, + {0x20e, GET(VUPKHSB)}, + {0x240, GET(VADDUHS)}, + {0x242, GET(VMINUH)}, + {0x244, GET(VSRH)}, + {0x246, GET(VCMPGTUH)}, + {0x646, GET(VCMPGTUH_)}, + {0x248, GET(VMULEUH)}, + {0x24a, GET(VRFIZ)}, + {0x24c, GET(VSPLTH)}, + {0x24e, GET(VUPKHSH)}, + {0x280, GET(VADDUWS)}, + {0x282, GET(VMINUW)}, + {0x284, GET(VSRW)}, + {0x286, GET(VCMPGTUW)}, + {0x686, GET(VCMPGTUW_)}, + {0x28a, GET(VRFIP)}, + {0x28c, GET(VSPLTW)}, + {0x28e, GET(VUPKLSB)}, + {0x2c4, GET(VSR)}, + {0x2c6, GET(VCMPGTFP)}, + {0x6c6, GET(VCMPGTFP_)}, + {0x2ca, GET(VRFIM)}, + {0x2ce, GET(VUPKLSH)}, + {0x300, GET(VADDSBS)}, + {0x302, GET(VMINSB)}, + {0x304, GET(VSRAB)}, + {0x306, GET(VCMPGTSB)}, + {0x706, GET(VCMPGTSB_)}, + {0x308, GET(VMULESB)}, + {0x30a, GET(VCFUX)}, + {0x30c, GET(VSPLTISB)}, + {0x30e, GET(VPKPX)}, + {0x340, GET(VADDSHS)}, + {0x342, GET(VMINSH)}, + {0x344, GET(VSRAH)}, + {0x346, GET(VCMPGTSH)}, + {0x746, GET(VCMPGTSH_)}, + {0x348, GET(VMULESH)}, + {0x34a, GET(VCFSX)}, + {0x34c, GET(VSPLTISH)}, + {0x34e, GET(VUPKHPX)}, + {0x380, GET(VADDSWS)}, + {0x382, GET(VMINSW)}, + {0x384, GET(VSRAW)}, + {0x386, GET(VCMPGTSW)}, + {0x786, GET(VCMPGTSW_)}, + {0x38a, GET(VCTUXS)}, + {0x38c, GET(VSPLTISW)}, + {0x3c6, GET(VCMPBFP)}, + {0x7c6, GET(VCMPBFP_)}, + {0x3ca, GET(VCTSXS)}, + {0x3ce, GET(VUPKLPX)}, + {0x400, GET(VSUBUBM)}, + {0x402, GET(VAVGUB)}, + {0x404, GET(VAND)}, + {0x40a, GET(VMAXFP)}, + {0x40c, GET(VSLO)}, + {0x440, GET(VSUBUHM)}, + {0x442, GET(VAVGUH)}, + {0x444, GET(VANDC)}, + {0x44a, GET(VMINFP)}, + {0x44c, GET(VSRO)}, + {0x480, GET(VSUBUWM)}, + {0x482, GET(VAVGUW)}, + {0x484, GET(VOR)}, + {0x4c4, GET(VXOR)}, + {0x502, GET(VAVGSB)}, + {0x504, GET(VNOR)}, + {0x542, GET(VAVGSH)}, + {0x580, GET(VSUBCUW)}, + {0x582, GET(VAVGSW)}, + {0x600, GET(VSUBUBS)}, + {0x604, GET(MFVSCR)}, + {0x608, GET(VSUM4UBS)}, + {0x640, GET(VSUBUHS)}, + {0x644, GET(MTVSCR)}, + {0x648, GET(VSUM4SHS)}, + {0x680, GET(VSUBUWS)}, + {0x688, GET(VSUM2SWS)}, + {0x700, GET(VSUBSBS)}, + {0x708, GET(VSUM4SBS)}, + {0x740, GET(VSUBSHS)}, + {0x780, GET(VSUBSWS)}, + {0x788, GET(VSUMSWS)}, + }); // Group 0x13 opcodes (field 21..30) fill_table(0x13, 10, 1, - { - { 0x000, GET(MCRF) }, - { 0x010, GET(BCLR) }, - { 0x021, GET(CRNOR) }, - { 0x081, GET(CRANDC) }, - { 0x096, GET(ISYNC) }, - { 0x0c1, GET(CRXOR) }, - { 0x0e1, GET(CRNAND) }, - { 0x101, GET(CRAND) }, - { 0x121, GET(CREQV) }, - { 0x1a1, GET(CRORC) }, - { 0x1c1, GET(CROR) }, - { 0x210, GET(BCCTR) }, - }); + { + {0x000, GET(MCRF)}, + {0x010, GET(BCLR)}, + {0x021, GET(CRNOR)}, + {0x081, GET(CRANDC)}, + {0x096, GET(ISYNC)}, + {0x0c1, GET(CRXOR)}, + {0x0e1, GET(CRNAND)}, + {0x101, GET(CRAND)}, + {0x121, GET(CREQV)}, + {0x1a1, GET(CRORC)}, + {0x1c1, GET(CROR)}, + {0x210, GET(BCCTR)}, + }); // Group 0x1e opcodes (field 27..30) fill_table(0x1e, 4, 1, - { - { 0x0, GETRC(RLDICL) }, - { 0x1, GETRC(RLDICL) }, - { 0x2, GETRC(RLDICR) }, - { 0x3, GETRC(RLDICR) }, - { 0x4, GETRC(RLDIC) }, - { 0x5, GETRC(RLDIC) }, - { 0x6, GETRC(RLDIMI) }, - { 0x7, GETRC(RLDIMI) }, - { 0x8, GETRC(RLDCL) }, - { 0x9, GETRC(RLDCR) }, - }); + { + {0x0, GETRC(RLDICL)}, + {0x1, GETRC(RLDICL)}, + {0x2, GETRC(RLDICR)}, + {0x3, GETRC(RLDICR)}, + {0x4, GETRC(RLDIC)}, + {0x5, GETRC(RLDIC)}, + {0x6, GETRC(RLDIMI)}, + {0x7, GETRC(RLDIMI)}, + {0x8, GETRC(RLDCL)}, + {0x9, GETRC(RLDCR)}, + }); // Group 0x1f opcodes (field 21..30) fill_table(0x1f, 10, 1, - { - { 0x000, GET(CMP) }, - { 0x004, GET(TW) }, - { 0x006, GET(LVSL) }, - { 0x007, GET(LVEBX) }, - { 0x008, GETRC(SUBFC) }, - { 0x208, GETRC(SUBFCO) }, - { 0x009, GETRC(MULHDU) }, - { 0x00a, GETRC(ADDC) }, - { 0x20a, GETRC(ADDCO) }, - { 0x00b, GETRC(MULHWU) }, - { 0x013, GET(MFOCRF) }, - { 0x014, GET(LWARX) }, - { 0x015, GET(LDX) }, - { 0x017, GET(LWZX) }, - { 0x018, GETRC(SLW) }, - { 0x01a, GETRC(CNTLZW) }, - { 0x01b, GETRC(SLD) }, - { 0x01c, GETRC(AND) }, - { 0x020, GET(CMPL) }, - { 0x026, GET(LVSR) }, - { 0x027, GET(LVEHX) }, - { 0x028, GETRC(SUBF) }, - { 0x228, GETRC(SUBFO) }, - { 0x035, GET(LDUX) }, - { 0x036, GET(DCBST) }, - { 0x037, GET(LWZUX) }, - { 0x03a, GETRC(CNTLZD) }, - { 0x03c, GETRC(ANDC) }, - { 0x044, GET(TD) }, - { 0x047, GET(LVEWX) }, - { 0x049, GETRC(MULHD) }, - { 0x04b, GETRC(MULHW) }, - { 0x054, GET(LDARX) }, - { 0x056, GET(DCBF) }, - { 0x057, GET(LBZX) }, - { 0x067, GET(LVX) }, - { 0x068, GETRC(NEG) }, - { 0x268, GETRC(NEGO) }, - { 0x077, GET(LBZUX) }, - { 0x07c, GETRC(NOR) }, - { 0x087, GET(STVEBX) }, - { 0x088, GETRC(SUBFE) }, - { 0x288, GETRC(SUBFEO) }, - { 0x08a, GETRC(ADDE) }, - { 0x28a, GETRC(ADDEO) }, - { 0x090, GET(MTOCRF) }, - { 0x095, GET(STDX) }, - { 0x096, GET(STWCX) }, - { 0x097, GET(STWX) }, - { 0x0a7, GET(STVEHX) }, - { 0x0b5, GET(STDUX) }, - { 0x0b7, GET(STWUX) }, - { 0x0c7, GET(STVEWX) }, - { 0x0c8, GETRC(SUBFZE) }, - { 0x2c8, GETRC(SUBFZEO) }, - { 0x0ca, GETRC(ADDZE) }, - { 0x2ca, GETRC(ADDZEO) }, - { 0x0d6, GET(STDCX) }, - { 0x0d7, GET(STBX) }, - { 0x0e7, GET(STVX) }, - { 0x0e8, GETRC(SUBFME) }, - { 0x2e8, GETRC(SUBFMEO) }, - { 0x0e9, GETRC(MULLD) }, - { 0x2e9, GETRC(MULLDO) }, - { 0x0ea, GETRC(ADDME) }, - { 0x2ea, GETRC(ADDMEO) }, - { 0x0eb, GETRC(MULLW) }, - { 0x2eb, GETRC(MULLWO) }, - { 0x0f6, GET(DCBTST) }, - { 0x0f7, GET(STBUX) }, - { 0x10a, GETRC(ADD) }, - { 0x30a, GETRC(ADDO) }, - { 0x116, GET(DCBT) }, - { 0x117, GET(LHZX) }, - { 0x11c, GETRC(EQV) }, - { 0x136, GET(ECIWX) }, - { 0x137, GET(LHZUX) }, - { 0x13c, GETRC(XOR) }, - { 0x153, GET(MFSPR) }, - { 0x155, GET(LWAX) }, - { 0x156, GET(DST) }, - { 0x157, GET(LHAX) }, - { 0x167, GET(LVXL) }, - { 0x173, GET(MFTB) }, - { 0x175, GET(LWAUX) }, - { 0x176, GET(DSTST) }, - { 0x177, GET(LHAUX) }, - { 0x197, GET(STHX) }, - { 0x19c, GETRC(ORC) }, - { 0x1b6, GET(ECOWX) }, - { 0x1b7, GET(STHUX) }, - { 0x1bc, GETRC(OR) }, - { 0x1c9, GETRC(DIVDU) }, - { 0x3c9, GETRC(DIVDUO) }, - { 0x1cb, GETRC(DIVWU) }, - { 0x3cb, GETRC(DIVWUO) }, - { 0x1d3, GET(MTSPR) }, - { 0x1d6, GET(DCBI) }, - { 0x1dc, GETRC(NAND) }, - { 0x1e7, GET(STVXL) }, - { 0x1e9, GETRC(DIVD) }, - { 0x3e9, GETRC(DIVDO) }, - { 0x1eb, GETRC(DIVW) }, - { 0x3eb, GETRC(DIVWO) }, - { 0x207, GET(LVLX) }, - { 0x214, GET(LDBRX) }, - { 0x215, GET(LSWX) }, - { 0x216, GET(LWBRX) }, - { 0x217, GET(LFSX) }, - { 0x218, GETRC(SRW) }, - { 0x21b, GETRC(SRD) }, - { 0x227, GET(LVRX) }, - { 0x237, GET(LFSUX) }, - { 0x255, GET(LSWI) }, - { 0x256, GET(SYNC) }, - { 0x257, GET(LFDX) }, - { 0x277, GET(LFDUX) }, - { 0x287, GET(STVLX) }, - { 0x294, GET(STDBRX) }, - { 0x295, GET(STSWX) }, - { 0x296, GET(STWBRX) }, - { 0x297, GET(STFSX) }, - { 0x2a7, GET(STVRX) }, - { 0x2b7, GET(STFSUX) }, - { 0x2d5, GET(STSWI) }, - { 0x2d7, GET(STFDX) }, - { 0x2f7, GET(STFDUX) }, - { 0x307, GET(LVLXL) }, - { 0x316, GET(LHBRX) }, - { 0x318, GETRC(SRAW) }, - { 0x31a, GETRC(SRAD) }, - { 0x327, GET(LVRXL) }, - { 0x336, GET(DSS) }, - { 0x338, GETRC(SRAWI) }, - { 0x33a, GETRC(SRADI) }, - { 0x33b, GETRC(SRADI) }, - { 0x356, GET(EIEIO) }, - { 0x387, GET(STVLXL) }, - { 0x396, GET(STHBRX) }, - { 0x39a, GETRC(EXTSH) }, - { 0x3a7, GET(STVRXL) }, - { 0x3ba, GETRC(EXTSB) }, - { 0x3d7, GET(STFIWX) }, - { 0x3da, GETRC(EXTSW) }, - { 0x3d6, GET(ICBI) }, - { 0x3f6, GET(DCBZ) }, - }); + { + {0x000, GET(CMP)}, + {0x004, GET(TW)}, + {0x006, GET(LVSL)}, + {0x007, GET(LVEBX)}, + {0x008, GETRC(SUBFC)}, + {0x208, GETRC(SUBFCO)}, + {0x009, GETRC(MULHDU)}, + {0x00a, GETRC(ADDC)}, + {0x20a, GETRC(ADDCO)}, + {0x00b, GETRC(MULHWU)}, + {0x013, GET(MFOCRF)}, + {0x014, GET(LWARX)}, + {0x015, GET(LDX)}, + {0x017, GET(LWZX)}, + {0x018, GETRC(SLW)}, + {0x01a, GETRC(CNTLZW)}, + {0x01b, GETRC(SLD)}, + {0x01c, GETRC(AND)}, + {0x020, GET(CMPL)}, + {0x026, GET(LVSR)}, + {0x027, GET(LVEHX)}, + {0x028, GETRC(SUBF)}, + {0x228, GETRC(SUBFO)}, + {0x035, GET(LDUX)}, + {0x036, GET(DCBST)}, + {0x037, GET(LWZUX)}, + {0x03a, GETRC(CNTLZD)}, + {0x03c, GETRC(ANDC)}, + {0x044, GET(TD)}, + {0x047, GET(LVEWX)}, + {0x049, GETRC(MULHD)}, + {0x04b, GETRC(MULHW)}, + {0x054, GET(LDARX)}, + {0x056, GET(DCBF)}, + {0x057, GET(LBZX)}, + {0x067, GET(LVX)}, + {0x068, GETRC(NEG)}, + {0x268, GETRC(NEGO)}, + {0x077, GET(LBZUX)}, + {0x07c, GETRC(NOR)}, + {0x087, GET(STVEBX)}, + {0x088, GETRC(SUBFE)}, + {0x288, GETRC(SUBFEO)}, + {0x08a, GETRC(ADDE)}, + {0x28a, GETRC(ADDEO)}, + {0x090, GET(MTOCRF)}, + {0x095, GET(STDX)}, + {0x096, GET(STWCX)}, + {0x097, GET(STWX)}, + {0x0a7, GET(STVEHX)}, + {0x0b5, GET(STDUX)}, + {0x0b7, GET(STWUX)}, + {0x0c7, GET(STVEWX)}, + {0x0c8, GETRC(SUBFZE)}, + {0x2c8, GETRC(SUBFZEO)}, + {0x0ca, GETRC(ADDZE)}, + {0x2ca, GETRC(ADDZEO)}, + {0x0d6, GET(STDCX)}, + {0x0d7, GET(STBX)}, + {0x0e7, GET(STVX)}, + {0x0e8, GETRC(SUBFME)}, + {0x2e8, GETRC(SUBFMEO)}, + {0x0e9, GETRC(MULLD)}, + {0x2e9, GETRC(MULLDO)}, + {0x0ea, GETRC(ADDME)}, + {0x2ea, GETRC(ADDMEO)}, + {0x0eb, GETRC(MULLW)}, + {0x2eb, GETRC(MULLWO)}, + {0x0f6, GET(DCBTST)}, + {0x0f7, GET(STBUX)}, + {0x10a, GETRC(ADD)}, + {0x30a, GETRC(ADDO)}, + {0x116, GET(DCBT)}, + {0x117, GET(LHZX)}, + {0x11c, GETRC(EQV)}, + {0x136, GET(ECIWX)}, + {0x137, GET(LHZUX)}, + {0x13c, GETRC(XOR)}, + {0x153, GET(MFSPR)}, + {0x155, GET(LWAX)}, + {0x156, GET(DST)}, + {0x157, GET(LHAX)}, + {0x167, GET(LVXL)}, + {0x173, GET(MFTB)}, + {0x175, GET(LWAUX)}, + {0x176, GET(DSTST)}, + {0x177, GET(LHAUX)}, + {0x197, GET(STHX)}, + {0x19c, GETRC(ORC)}, + {0x1b6, GET(ECOWX)}, + {0x1b7, GET(STHUX)}, + {0x1bc, GETRC(OR)}, + {0x1c9, GETRC(DIVDU)}, + {0x3c9, GETRC(DIVDUO)}, + {0x1cb, GETRC(DIVWU)}, + {0x3cb, GETRC(DIVWUO)}, + {0x1d3, GET(MTSPR)}, + {0x1d6, GET(DCBI)}, + {0x1dc, GETRC(NAND)}, + {0x1e7, GET(STVXL)}, + {0x1e9, GETRC(DIVD)}, + {0x3e9, GETRC(DIVDO)}, + {0x1eb, GETRC(DIVW)}, + {0x3eb, GETRC(DIVWO)}, + {0x207, GET(LVLX)}, + {0x214, GET(LDBRX)}, + {0x215, GET(LSWX)}, + {0x216, GET(LWBRX)}, + {0x217, GET(LFSX)}, + {0x218, GETRC(SRW)}, + {0x21b, GETRC(SRD)}, + {0x227, GET(LVRX)}, + {0x237, GET(LFSUX)}, + {0x255, GET(LSWI)}, + {0x256, GET(SYNC)}, + {0x257, GET(LFDX)}, + {0x277, GET(LFDUX)}, + {0x287, GET(STVLX)}, + {0x294, GET(STDBRX)}, + {0x295, GET(STSWX)}, + {0x296, GET(STWBRX)}, + {0x297, GET(STFSX)}, + {0x2a7, GET(STVRX)}, + {0x2b7, GET(STFSUX)}, + {0x2d5, GET(STSWI)}, + {0x2d7, GET(STFDX)}, + {0x2f7, GET(STFDUX)}, + {0x307, GET(LVLXL)}, + {0x316, GET(LHBRX)}, + {0x318, GETRC(SRAW)}, + {0x31a, GETRC(SRAD)}, + {0x327, GET(LVRXL)}, + {0x336, GET(DSS)}, + {0x338, GETRC(SRAWI)}, + {0x33a, GETRC(SRADI)}, + {0x33b, GETRC(SRADI)}, + {0x356, GET(EIEIO)}, + {0x387, GET(STVLXL)}, + {0x396, GET(STHBRX)}, + {0x39a, GETRC(EXTSH)}, + {0x3a7, GET(STVRXL)}, + {0x3ba, GETRC(EXTSB)}, + {0x3d7, GET(STFIWX)}, + {0x3da, GETRC(EXTSW)}, + {0x3d6, GET(ICBI)}, + {0x3f6, GET(DCBZ)}, + }); // Group 0x3a opcodes (field 30..31) fill_table(0x3a, 2, 0, - { - { 0x0, GET(LD) }, - { 0x1, GET(LDU) }, - { 0x2, GET(LWA) }, - }); + { + {0x0, GET(LD)}, + {0x1, GET(LDU)}, + {0x2, GET(LWA)}, + }); // Group 0x3b opcodes (field 21..30) fill_table(0x3b, 10, 1, - { - { 0x12, GETRC(FDIVS), 5 }, - { 0x14, GETRC(FSUBS), 5 }, - { 0x15, GETRC(FADDS), 5 }, - { 0x16, GETRC(FSQRTS), 5 }, - { 0x18, GETRC(FRES), 5 }, - { 0x19, GETRC(FMULS), 5 }, - { 0x1c, GETRC(FMSUBS), 5 }, - { 0x1d, GETRC(FMADDS), 5 }, - { 0x1e, GETRC(FNMSUBS), 5 }, - { 0x1f, GETRC(FNMADDS), 5 }, - }); + { + {0x12, GETRC(FDIVS), 5}, + {0x14, GETRC(FSUBS), 5}, + {0x15, GETRC(FADDS), 5}, + {0x16, GETRC(FSQRTS), 5}, + {0x18, GETRC(FRES), 5}, + {0x19, GETRC(FMULS), 5}, + {0x1c, GETRC(FMSUBS), 5}, + {0x1d, GETRC(FMADDS), 5}, + {0x1e, GETRC(FNMSUBS), 5}, + {0x1f, GETRC(FNMADDS), 5}, + }); // Group 0x3e opcodes (field 30..31) fill_table(0x3e, 2, 0, - { - { 0x0, GET(STD) }, - { 0x1, GET(STDU) }, - }); + { + {0x0, GET(STD)}, + {0x1, GET(STDU)}, + }); // Group 0x3f opcodes (field 21..30) fill_table(0x3f, 10, 1, - { - { 0x026, GETRC(MTFSB1) }, - { 0x040, GET(MCRFS) }, - { 0x046, GETRC(MTFSB0) }, - { 0x086, GETRC(MTFSFI) }, - { 0x247, GETRC(MFFS) }, - { 0x2c7, GETRC(MTFSF) }, + { + {0x026, GETRC(MTFSB1)}, + {0x040, GET(MCRFS)}, + {0x046, GETRC(MTFSB0)}, + {0x086, GETRC(MTFSFI)}, + {0x247, GETRC(MFFS)}, + {0x2c7, GETRC(MTFSF)}, - { 0x000, GET(FCMPU) }, - { 0x00c, GETRC(FRSP) }, - { 0x00e, GETRC(FCTIW) }, - { 0x00f, GETRC(FCTIWZ) }, + {0x000, GET(FCMPU)}, + {0x00c, GETRC(FRSP)}, + {0x00e, GETRC(FCTIW)}, + {0x00f, GETRC(FCTIWZ)}, - { 0x012, GETRC(FDIV), 5 }, - { 0x014, GETRC(FSUB), 5 }, - { 0x015, GETRC(FADD), 5 }, - { 0x016, GETRC(FSQRT), 5 }, - { 0x017, GETRC(FSEL), 5 }, - { 0x019, GETRC(FMUL), 5 }, - { 0x01a, GETRC(FRSQRTE), 5 }, - { 0x01c, GETRC(FMSUB), 5 }, - { 0x01d, GETRC(FMADD), 5 }, - { 0x01e, GETRC(FNMSUB), 5 }, - { 0x01f, GETRC(FNMADD), 5 }, + {0x012, GETRC(FDIV), 5}, + {0x014, GETRC(FSUB), 5}, + {0x015, GETRC(FADD), 5}, + {0x016, GETRC(FSQRT), 5}, + {0x017, GETRC(FSEL), 5}, + {0x019, GETRC(FMUL), 5}, + {0x01a, GETRC(FRSQRTE), 5}, + {0x01c, GETRC(FMSUB), 5}, + {0x01d, GETRC(FMADD), 5}, + {0x01e, GETRC(FNMSUB), 5}, + {0x01f, GETRC(FNMADD), 5}, - { 0x020, GET(FCMPO) }, - { 0x028, GETRC(FNEG) }, - { 0x048, GETRC(FMR) }, - { 0x088, GETRC(FNABS) }, - { 0x108, GETRC(FABS) }, - { 0x32e, GETRC(FCTID) }, - { 0x32f, GETRC(FCTIDZ) }, - { 0x34e, GETRC(FCFID) }, - }); + {0x020, GET(FCMPO)}, + {0x028, GETRC(FNEG)}, + {0x048, GETRC(FMR)}, + {0x088, GETRC(FNABS)}, + {0x108, GETRC(FABS)}, + {0x32e, GETRC(FCTID)}, + {0x32f, GETRC(FCTIDZ)}, + {0x34e, GETRC(FCFID)}, + }); } const std::array& get_table() const noexcept @@ -645,100 +645,477 @@ namespace ppu_instructions { enum { - r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, - r12, r13, r14, r15, r16, r17, r18, r19, r20, r21, - r22, r23, r24, r25, r26, r27, r28, r29, r30, r31, + r0, + r1, + r2, + r3, + r4, + r5, + r6, + r7, + r8, + r9, + r10, + r11, + r12, + r13, + r14, + r15, + r16, + r17, + r18, + r19, + r20, + r21, + r22, + r23, + r24, + r25, + r26, + r27, + r28, + r29, + r30, + r31, }; enum { - f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, - f12, f13, f14, f15, F16, f17, f18, f19, f20, f21, - f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, + f0, + f1, + f2, + f3, + f4, + f5, + f6, + f7, + f8, + f9, + f10, + f11, + f12, + f13, + f14, + f15, + F16, + f17, + f18, + f19, + f20, + f21, + f22, + f23, + f24, + f25, + f26, + f27, + f28, + f29, + f30, + f31, }; enum { - v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, - v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, - v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, + v0, + v1, + v2, + v3, + v4, + v5, + v6, + v7, + v8, + v9, + v10, + v11, + v12, + v13, + v14, + v15, + v16, + v17, + v18, + v19, + v20, + v21, + v22, + v23, + v24, + v25, + v26, + v27, + v28, + v29, + v30, + v31, }; enum { - cr0, cr1, cr2, cr3, cr4, cr5, cr6, cr7, + cr0, + cr1, + cr2, + cr3, + cr4, + cr5, + cr6, + cr7, }; - } + } // namespace fields using namespace fields; - inline u32 ADDI(u32 rt, u32 ra, s32 si) { ppu_opcode_t op{ 0x0eu << 26 }; op.rd = rt; op.ra = ra; op.simm16 = si; return op.opcode; } - inline u32 ADDIS(u32 rt, u32 ra, s32 si) { ppu_opcode_t op{ 0x0fu << 26 }; op.rd = rt; op.ra = ra; op.simm16 = si; return op.opcode; } - inline u32 XORIS(u32 rt, u32 ra, s32 si) { ppu_opcode_t op{ 0x1bu << 26 }; op.rd = rt; op.ra = ra; op.simm16 = si; return op.opcode; } - inline u32 ORI(u32 rt, u32 ra, u32 ui) { ppu_opcode_t op{ 0x18u << 26 }; op.rd = rt; op.ra = ra; op.uimm16 = ui; return op.opcode; } - inline u32 ORIS(u32 rt, u32 ra, u32 ui) { ppu_opcode_t op{ 0x19u << 26 }; op.rd = rt; op.ra = ra; op.uimm16 = ui; return op.opcode; } - inline u32 OR(u32 ra, u32 rs, u32 rb, bool rc = false) { ppu_opcode_t op{ 0x1fu << 26 | 0x1bcu << 1 }; op.rs = rs; op.ra = ra; op.rb = rb; op.rc = rc; return op.opcode; } - inline u32 SC(u32 lev) { ppu_opcode_t op{ 0x11u << 26 | 1 << 1 }; op.lev = lev; return op.opcode; } - inline u32 B(s32 li, bool aa = false, bool lk = false) { ppu_opcode_t op{0x12u << 26}; op.ll = li; op.aa = aa; op.lk = lk; return op.opcode; } - inline u32 BC(u32 bo, u32 bi, s32 bd, bool aa = false, bool lk = false) { ppu_opcode_t op{ 0x10u << 26 }; op.bo = bo; op.bi = bi; op.ds = bd / 4; op.aa = aa; op.lk = lk; return op.opcode; } - inline u32 BCLR(u32 bo, u32 bi, u32 bh, bool lk = false) { ppu_opcode_t op{ 0x13u << 26 | 0x10u << 1 }; op.bo = bo; op.bi = bi; op.bh = bh; op.lk = lk; return op.opcode; } - inline u32 BCCTR(u32 bo, u32 bi, u32 bh, bool lk = false) { ppu_opcode_t op{ 0x13u << 26 | 0x210u << 1 }; op.bo = bo; op.bi = bi; op.bh = bh; op.lk = lk; return op.opcode; } - inline u32 MFSPR(u32 rt, u32 spr) { ppu_opcode_t op{ 0x1fu << 26 | 0x153u << 1 }; op.rd = rt; op.spr = spr; return op.opcode; } - inline u32 MTSPR(u32 spr, u32 rs) { ppu_opcode_t op{ 0x1fu << 26 | 0x1d3u << 1 }; op.rs = rs; op.spr = spr; return op.opcode; } - inline u32 LWZ(u32 rt, u32 ra, s32 si) { ppu_opcode_t op{ 0x20u << 26 }; op.rd = rt; op.ra = ra; op.simm16 = si; return op.opcode; } - inline u32 STW(u32 rt, u32 ra, s32 si) { ppu_opcode_t op{ 0x24u << 26 }; op.rd = rt; op.ra = ra; op.simm16 = si; return op.opcode; } - inline u32 STD(u32 rs, u32 ra, s32 si) { ppu_opcode_t op{ 0x3eu << 26 }; op.rs = rs; op.ra = ra; op.ds = si / 4; return op.opcode; } - inline u32 STDU(u32 rs, u32 ra, s32 si) { ppu_opcode_t op{ 0x3eu << 26 | 1 }; op.rs = rs; op.ra = ra; op.ds = si / 4; return op.opcode; } - inline u32 LD(u32 rt, u32 ra, s32 si) { ppu_opcode_t op{ 0x3au << 26 }; op.rd = rt; op.ra = ra; op.ds = si / 4; return op.opcode; } - inline u32 LDU(u32 rt, u32 ra, s32 si) { ppu_opcode_t op{ 0x3au << 26 | 1 }; op.rd = rt; op.ra = ra; op.ds = si / 4; return op.opcode; } - inline u32 CMPI(u32 bf, u32 l, u32 ra, u32 ui) { ppu_opcode_t op{ 0xbu << 26 }; op.crfd = bf; op.l10 = l; op.ra = ra; op.uimm16 = ui; return op.opcode; } - inline u32 CMPLI(u32 bf, u32 l, u32 ra, u32 ui) { ppu_opcode_t op{ 0xau << 26 }; op.crfd = bf; op.l10 = l; op.ra = ra; op.uimm16 = ui; return op.opcode; } - inline u32 RLDICL(u32 ra, u32 rs, u32 sh, u32 mb, bool rc = false) { ppu_opcode_t op{ 30 << 26 }; op.ra = ra; op.rs = rs; op.sh64 = sh; op.mbe64 = mb; op.rc = rc; return op.opcode; } - inline u32 RLDICR(u32 ra, u32 rs, u32 sh, u32 mb, bool rc = false) { return RLDICL(ra, rs, sh, mb, rc) | 1 << 2; } - inline u32 STFD(u32 frs, u32 ra, s32 si) { ppu_opcode_t op{ 54u << 26 }; op.frs = frs; op.ra = ra; op.simm16 = si; return op.opcode; } - inline u32 STVX(u32 vs, u32 ra, u32 rb) { ppu_opcode_t op{ 31 << 26 | 231 << 1 }; op.vs = vs; op.ra = ra; op.rb = rb; return op.opcode; } - inline u32 LFD(u32 frd, u32 ra, s32 si) { ppu_opcode_t op{ 50u << 26 }; op.frd = frd; op.ra = ra; op.simm16 = si; return op.opcode; } - inline u32 LVX(u32 vd, u32 ra, u32 rb) { ppu_opcode_t op{ 31 << 26 | 103 << 1 }; op.vd = vd; op.ra = ra; op.rb = rb; return op.opcode; } - inline constexpr u32 EIEIO() { return 0x7c0006ac; } + inline u32 ADDI(u32 rt, u32 ra, s32 si) + { + ppu_opcode_t op{0x0eu << 26}; + op.rd = rt; + op.ra = ra; + op.simm16 = si; + return op.opcode; + } + inline u32 ADDIS(u32 rt, u32 ra, s32 si) + { + ppu_opcode_t op{0x0fu << 26}; + op.rd = rt; + op.ra = ra; + op.simm16 = si; + return op.opcode; + } + inline u32 XORIS(u32 rt, u32 ra, s32 si) + { + ppu_opcode_t op{0x1bu << 26}; + op.rd = rt; + op.ra = ra; + op.simm16 = si; + return op.opcode; + } + inline u32 ORI(u32 rt, u32 ra, u32 ui) + { + ppu_opcode_t op{0x18u << 26}; + op.rd = rt; + op.ra = ra; + op.uimm16 = ui; + return op.opcode; + } + inline u32 ORIS(u32 rt, u32 ra, u32 ui) + { + ppu_opcode_t op{0x19u << 26}; + op.rd = rt; + op.ra = ra; + op.uimm16 = ui; + return op.opcode; + } + inline u32 OR(u32 ra, u32 rs, u32 rb, bool rc = false) + { + ppu_opcode_t op{0x1fu << 26 | 0x1bcu << 1}; + op.rs = rs; + op.ra = ra; + op.rb = rb; + op.rc = rc; + return op.opcode; + } + inline u32 SC(u32 lev) + { + ppu_opcode_t op{0x11u << 26 | 1 << 1}; + op.lev = lev; + return op.opcode; + } + inline u32 B(s32 li, bool aa = false, bool lk = false) + { + ppu_opcode_t op{0x12u << 26}; + op.ll = li; + op.aa = aa; + op.lk = lk; + return op.opcode; + } + inline u32 BC(u32 bo, u32 bi, s32 bd, bool aa = false, bool lk = false) + { + ppu_opcode_t op{0x10u << 26}; + op.bo = bo; + op.bi = bi; + op.ds = bd / 4; + op.aa = aa; + op.lk = lk; + return op.opcode; + } + inline u32 BCLR(u32 bo, u32 bi, u32 bh, bool lk = false) + { + ppu_opcode_t op{0x13u << 26 | 0x10u << 1}; + op.bo = bo; + op.bi = bi; + op.bh = bh; + op.lk = lk; + return op.opcode; + } + inline u32 BCCTR(u32 bo, u32 bi, u32 bh, bool lk = false) + { + ppu_opcode_t op{0x13u << 26 | 0x210u << 1}; + op.bo = bo; + op.bi = bi; + op.bh = bh; + op.lk = lk; + return op.opcode; + } + inline u32 MFSPR(u32 rt, u32 spr) + { + ppu_opcode_t op{0x1fu << 26 | 0x153u << 1}; + op.rd = rt; + op.spr = spr; + return op.opcode; + } + inline u32 MTSPR(u32 spr, u32 rs) + { + ppu_opcode_t op{0x1fu << 26 | 0x1d3u << 1}; + op.rs = rs; + op.spr = spr; + return op.opcode; + } + inline u32 LWZ(u32 rt, u32 ra, s32 si) + { + ppu_opcode_t op{0x20u << 26}; + op.rd = rt; + op.ra = ra; + op.simm16 = si; + return op.opcode; + } + inline u32 STW(u32 rt, u32 ra, s32 si) + { + ppu_opcode_t op{0x24u << 26}; + op.rd = rt; + op.ra = ra; + op.simm16 = si; + return op.opcode; + } + inline u32 STD(u32 rs, u32 ra, s32 si) + { + ppu_opcode_t op{0x3eu << 26}; + op.rs = rs; + op.ra = ra; + op.ds = si / 4; + return op.opcode; + } + inline u32 STDU(u32 rs, u32 ra, s32 si) + { + ppu_opcode_t op{0x3eu << 26 | 1}; + op.rs = rs; + op.ra = ra; + op.ds = si / 4; + return op.opcode; + } + inline u32 LD(u32 rt, u32 ra, s32 si) + { + ppu_opcode_t op{0x3au << 26}; + op.rd = rt; + op.ra = ra; + op.ds = si / 4; + return op.opcode; + } + inline u32 LDU(u32 rt, u32 ra, s32 si) + { + ppu_opcode_t op{0x3au << 26 | 1}; + op.rd = rt; + op.ra = ra; + op.ds = si / 4; + return op.opcode; + } + inline u32 CMPI(u32 bf, u32 l, u32 ra, u32 ui) + { + ppu_opcode_t op{0xbu << 26}; + op.crfd = bf; + op.l10 = l; + op.ra = ra; + op.uimm16 = ui; + return op.opcode; + } + inline u32 CMPLI(u32 bf, u32 l, u32 ra, u32 ui) + { + ppu_opcode_t op{0xau << 26}; + op.crfd = bf; + op.l10 = l; + op.ra = ra; + op.uimm16 = ui; + return op.opcode; + } + inline u32 RLDICL(u32 ra, u32 rs, u32 sh, u32 mb, bool rc = false) + { + ppu_opcode_t op{30 << 26}; + op.ra = ra; + op.rs = rs; + op.sh64 = sh; + op.mbe64 = mb; + op.rc = rc; + return op.opcode; + } + inline u32 RLDICR(u32 ra, u32 rs, u32 sh, u32 mb, bool rc = false) + { + return RLDICL(ra, rs, sh, mb, rc) | 1 << 2; + } + inline u32 STFD(u32 frs, u32 ra, s32 si) + { + ppu_opcode_t op{54u << 26}; + op.frs = frs; + op.ra = ra; + op.simm16 = si; + return op.opcode; + } + inline u32 STVX(u32 vs, u32 ra, u32 rb) + { + ppu_opcode_t op{31 << 26 | 231 << 1}; + op.vs = vs; + op.ra = ra; + op.rb = rb; + return op.opcode; + } + inline u32 LFD(u32 frd, u32 ra, s32 si) + { + ppu_opcode_t op{50u << 26}; + op.frd = frd; + op.ra = ra; + op.simm16 = si; + return op.opcode; + } + inline u32 LVX(u32 vd, u32 ra, u32 rb) + { + ppu_opcode_t op{31 << 26 | 103 << 1}; + op.vd = vd; + op.ra = ra; + op.rb = rb; + return op.opcode; + } + inline constexpr u32 EIEIO() + { + return 0x7c0006ac; + } namespace implicts { - inline u32 NOP() { return ORI(r0, r0, 0); } - inline u32 MR(u32 rt, u32 ra) { return OR(rt, ra, ra, false); } - inline u32 LI(u32 rt, u32 imm) { return ADDI(rt, r0, imm); } - inline u32 LIS(u32 rt, u32 imm) { return ADDIS(rt, r0, imm); } + inline u32 NOP() + { + return ORI(r0, r0, 0); + } + inline u32 MR(u32 rt, u32 ra) + { + return OR(rt, ra, ra, false); + } + inline u32 LI(u32 rt, u32 imm) + { + return ADDI(rt, r0, imm); + } + inline u32 LIS(u32 rt, u32 imm) + { + return ADDIS(rt, r0, imm); + } - inline u32 BLR() { return BCLR(0x10 | 0x04, 0, 0); } - inline u32 BCTR() { return BCCTR(0x10 | 0x04, 0, 0); } - inline u32 BCTRL() { return BCCTR(0x10 | 0x04, 0, 0, true); } - inline u32 MFCTR(u32 reg) { return MFSPR(reg, 9 << 5); } - inline u32 MTCTR(u32 reg) { return MTSPR(9 << 5, reg); } - inline u32 MFLR(u32 reg) { return MFSPR(reg, 8 << 5); } - inline u32 MTLR(u32 reg) { return MTSPR(8 << 5, reg); } + inline u32 BLR() + { + return BCLR(0x10 | 0x04, 0, 0); + } + inline u32 BCTR() + { + return BCCTR(0x10 | 0x04, 0, 0); + } + inline u32 BCTRL() + { + return BCCTR(0x10 | 0x04, 0, 0, true); + } + inline u32 MFCTR(u32 reg) + { + return MFSPR(reg, 9 << 5); + } + inline u32 MTCTR(u32 reg) + { + return MTSPR(9 << 5, reg); + } + inline u32 MFLR(u32 reg) + { + return MFSPR(reg, 8 << 5); + } + inline u32 MTLR(u32 reg) + { + return MTSPR(8 << 5, reg); + } - inline u32 BNE(u32 cr, s32 imm) { return BC(4, 2 | cr << 2, imm); } - inline u32 BEQ(u32 cr, s32 imm) { return BC(12, 2 | cr << 2, imm); } - inline u32 BGT(u32 cr, s32 imm) { return BC(12, 1 | cr << 2, imm); } - inline u32 BNE(s32 imm) { return BNE(cr0, imm); } - inline u32 BEQ(s32 imm) { return BEQ(cr0, imm); } - inline u32 BGT(s32 imm) { return BGT(cr0, imm); } + inline u32 BNE(u32 cr, s32 imm) + { + return BC(4, 2 | cr << 2, imm); + } + inline u32 BEQ(u32 cr, s32 imm) + { + return BC(12, 2 | cr << 2, imm); + } + inline u32 BGT(u32 cr, s32 imm) + { + return BC(12, 1 | cr << 2, imm); + } + inline u32 BNE(s32 imm) + { + return BNE(cr0, imm); + } + inline u32 BEQ(s32 imm) + { + return BEQ(cr0, imm); + } + inline u32 BGT(s32 imm) + { + return BGT(cr0, imm); + } - inline u32 CMPDI(u32 cr, u32 reg, u32 imm) { return CMPI(cr, 1, reg, imm); } - inline u32 CMPDI(u32 reg, u32 imm) { return CMPDI(cr0, reg, imm); } - inline u32 CMPWI(u32 cr, u32 reg, u32 imm) { return CMPI(cr, 0, reg, imm); } - inline u32 CMPWI(u32 reg, u32 imm) { return CMPWI(cr0, reg, imm); } - inline u32 CMPLDI(u32 cr, u32 reg, u32 imm) { return CMPLI(cr, 1, reg, imm); } - inline u32 CMPLDI(u32 reg, u32 imm) { return CMPLDI(cr0, reg, imm); } - inline u32 CMPLWI(u32 cr, u32 reg, u32 imm) { return CMPLI(cr, 0, reg, imm); } - inline u32 CMPLWI(u32 reg, u32 imm) { return CMPLWI(cr0, reg, imm); } + inline u32 CMPDI(u32 cr, u32 reg, u32 imm) + { + return CMPI(cr, 1, reg, imm); + } + inline u32 CMPDI(u32 reg, u32 imm) + { + return CMPDI(cr0, reg, imm); + } + inline u32 CMPWI(u32 cr, u32 reg, u32 imm) + { + return CMPI(cr, 0, reg, imm); + } + inline u32 CMPWI(u32 reg, u32 imm) + { + return CMPWI(cr0, reg, imm); + } + inline u32 CMPLDI(u32 cr, u32 reg, u32 imm) + { + return CMPLI(cr, 1, reg, imm); + } + inline u32 CMPLDI(u32 reg, u32 imm) + { + return CMPLDI(cr0, reg, imm); + } + inline u32 CMPLWI(u32 cr, u32 reg, u32 imm) + { + return CMPLI(cr, 0, reg, imm); + } + inline u32 CMPLWI(u32 reg, u32 imm) + { + return CMPLWI(cr0, reg, imm); + } - inline u32 EXTRDI(u32 x, u32 y, u32 n, u32 b) { return RLDICL(x, y, b + n, 64 - b, false); } - inline u32 SRDI(u32 x, u32 y, u32 n) { return RLDICL(x, y, 64 - n, n, false); } - inline u32 CLRLDI(u32 x, u32 y, u32 n) { return RLDICL(x, y, 0, n, false); } - inline u32 CLRRDI(u32 x, u32 y, u32 n) { return RLDICR(x, y, 0, 63 - n, false); } + inline u32 EXTRDI(u32 x, u32 y, u32 n, u32 b) + { + return RLDICL(x, y, b + n, 64 - b, false); + } + inline u32 SRDI(u32 x, u32 y, u32 n) + { + return RLDICL(x, y, 64 - n, n, false); + } + inline u32 CLRLDI(u32 x, u32 y, u32 n) + { + return RLDICL(x, y, 0, n, false); + } + inline u32 CLRRDI(u32 x, u32 y, u32 n) + { + return RLDICR(x, y, 0, 63 - n, false); + } - inline constexpr u32 TRAP() { return 0x7FE00008; } // tw 31,r0,r0 - } + inline constexpr u32 TRAP() + { + return 0x7FE00008; + } // tw 31,r0,r0 + } // namespace implicts using namespace implicts; -} +} // namespace ppu_instructions diff --git a/rpcs3/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/rpcs3/Emu/Cell/PPUThread.cpp index 24d1caac5..9286823d5 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/rpcs3/Emu/Cell/PPUThread.cpp @@ -87,39 +87,39 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](ppu_join_status js) - { - switch (js) { - case ppu_join_status::joinable: return "none"; - case ppu_join_status::detached: return "detached"; - case ppu_join_status::zombie: return "zombie"; - case ppu_join_status::exited: return "exited"; - case ppu_join_status::max: break; - } + switch (js) + { + case ppu_join_status::joinable: return "none"; + case ppu_join_status::detached: return "detached"; + case ppu_join_status::zombie: return "zombie"; + case ppu_join_status::exited: return "exited"; + case ppu_join_status::max: break; + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](ppu_thread_status s) - { - switch (s) { - case PPU_THREAD_STATUS_IDLE: return "IDLE"; - case PPU_THREAD_STATUS_RUNNABLE: return "RUN"; - case PPU_THREAD_STATUS_ONPROC: return "ONPROC"; - case PPU_THREAD_STATUS_SLEEP: return "SLEEP"; - case PPU_THREAD_STATUS_STOP: return "STOP"; - case PPU_THREAD_STATUS_ZOMBIE: return "Zombie"; - case PPU_THREAD_STATUS_DELETED: return "Deleted"; - case PPU_THREAD_STATUS_UNKNOWN: break; - } + switch (s) + { + case PPU_THREAD_STATUS_IDLE: return "IDLE"; + case PPU_THREAD_STATUS_RUNNABLE: return "RUN"; + case PPU_THREAD_STATUS_ONPROC: return "ONPROC"; + case PPU_THREAD_STATUS_SLEEP: return "SLEEP"; + case PPU_THREAD_STATUS_STOP: return "STOP"; + case PPU_THREAD_STATUS_ZOMBIE: return "Zombie"; + case PPU_THREAD_STATUS_DELETED: return "Deleted"; + case PPU_THREAD_STATUS_UNKNOWN: break; + } - return unknown; - }); + return unknown; + }); } template <> @@ -177,13 +177,13 @@ class concurent_memory_limit public: class [[nodiscard]] user { - concurent_memory_limit *m_limit = nullptr; - u32 m_used = 0; + concurent_memory_limit* m_limit = nullptr; + u32 m_used = 0; public: - user(concurent_memory_limit *limit, u32 used) : m_limit(limit), m_used(used) {} + user(concurent_memory_limit* limit, u32 used) : m_limit(limit), m_used(used) {} user() = default; - user(user &&other) + user(user&& other) { *this = std::move(other); } @@ -196,40 +196,43 @@ public: } } - user &operator=(user &&other) + user& operator=(user&& other) { std::swap(other.m_limit, m_limit); std::swap(other.m_used, m_used); return *this; } - explicit operator bool() const { return m_limit != nullptr; } + explicit operator bool() const + { + return m_limit != nullptr; + } }; concurent_memory_limit(u64 total) : m_total(u32(std::min(total / k_block_size, std::numeric_limits::max()))), m_free(m_total) {} - user acquire(u64 amount) { amount = utils::aligned_div(amount, k_block_size); u32 allocated = 0; while (!m_free.fetch_op([&, this](u32& value) - { - if (value >= amount || value == m_total) - { - // Allow at least allocation, make 0 the "memory unavailable" sign value for atomic waiting efficiency - const u32 new_val = static_cast(utils::sub_saturate(value, amount)); - allocated = value - new_val; - value = new_val; - return true; - } + { + if (value >= amount || value == m_total) + { + // Allow at least allocation, make 0 the "memory unavailable" sign value for atomic waiting efficiency + const u32 new_val = static_cast(utils::sub_saturate(value, amount)); + allocated = value - new_val; + value = new_val; + return true; + } - // Resort to waiting - allocated = 0; - return Emu.IsStopped(); - }).second) + // Resort to waiting + allocated = 0; + return Emu.IsStopped(); + }) + .second) { // Wait until not 0 m_free.wait(0); @@ -243,11 +246,13 @@ public: return user(this, allocated); } - std::size_t free_memory() const { + std::size_t free_memory() const + { return m_free.load() * k_block_size; } - std::uint64_t total_memory() const { + std::uint64_t total_memory() const + { return m_total * k_block_size; } @@ -264,7 +269,7 @@ private: extern void ppu_initialize(); extern void ppu_finalize(const ppu_module& info, bool force_mem_release = false); extern bool ppu_initialize(const ppu_module& info, bool check_only = false, u64 file_size = 0); -extern bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size, concurent_memory_limit &memory_limit); +extern bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size, concurent_memory_limit& memory_limit); static void ppu_initialize2(class jit_compiler& jit, const ppu_module& module_part, const std::string& cache_path, const std::string& obj_name); extern bool ppu_load_exec(const ppu_exec_object&, bool virtual_load, const std::string&, utils::serial* = nullptr); extern std::pair, CellError> ppu_load_overlay(const ppu_exec_object&, bool virtual_load, const std::string& path, s64 file_offset, utils::serial* = nullptr); @@ -275,291 +280,291 @@ static void ppu_break(ppu_thread&, ppu_opcode_t, be_t*, ppu_intrp_func*); extern void do_cell_atomic_128_store(u32 addr, const void* to_write); -const auto ppu_gateway = build_function_asm("ppu_gateway", [](native_asm& c, auto& args) -{ - // Gateway for PPU, converts from native to GHC calling convention, also saves RSP value for escape - using namespace asmjit; +const auto ppu_gateway = build_function_asm("ppu_gateway", [](native_asm& c, auto& args) + { + // Gateway for PPU, converts from native to GHC calling convention, also saves RSP value for escape + using namespace asmjit; #if defined(ARCH_X64) #ifdef _WIN32 - c.push(x86::r15); - c.push(x86::r14); - c.push(x86::r13); - c.push(x86::r12); - c.push(x86::rsi); - c.push(x86::rdi); - c.push(x86::rbp); - c.push(x86::rbx); - c.sub(x86::rsp, 0xa8); - c.movaps(x86::oword_ptr(x86::rsp, 0x90), x86::xmm15); - c.movaps(x86::oword_ptr(x86::rsp, 0x80), x86::xmm14); - c.movaps(x86::oword_ptr(x86::rsp, 0x70), x86::xmm13); - c.movaps(x86::oword_ptr(x86::rsp, 0x60), x86::xmm12); - c.movaps(x86::oword_ptr(x86::rsp, 0x50), x86::xmm11); - c.movaps(x86::oword_ptr(x86::rsp, 0x40), x86::xmm10); - c.movaps(x86::oword_ptr(x86::rsp, 0x30), x86::xmm9); - c.movaps(x86::oword_ptr(x86::rsp, 0x20), x86::xmm8); - c.movaps(x86::oword_ptr(x86::rsp, 0x10), x86::xmm7); - c.movaps(x86::oword_ptr(x86::rsp, 0), x86::xmm6); + c.push(x86::r15); + c.push(x86::r14); + c.push(x86::r13); + c.push(x86::r12); + c.push(x86::rsi); + c.push(x86::rdi); + c.push(x86::rbp); + c.push(x86::rbx); + c.sub(x86::rsp, 0xa8); + c.movaps(x86::oword_ptr(x86::rsp, 0x90), x86::xmm15); + c.movaps(x86::oword_ptr(x86::rsp, 0x80), x86::xmm14); + c.movaps(x86::oword_ptr(x86::rsp, 0x70), x86::xmm13); + c.movaps(x86::oword_ptr(x86::rsp, 0x60), x86::xmm12); + c.movaps(x86::oword_ptr(x86::rsp, 0x50), x86::xmm11); + c.movaps(x86::oword_ptr(x86::rsp, 0x40), x86::xmm10); + c.movaps(x86::oword_ptr(x86::rsp, 0x30), x86::xmm9); + c.movaps(x86::oword_ptr(x86::rsp, 0x20), x86::xmm8); + c.movaps(x86::oword_ptr(x86::rsp, 0x10), x86::xmm7); + c.movaps(x86::oword_ptr(x86::rsp, 0), x86::xmm6); #else - c.push(x86::rbp); - c.push(x86::r15); - c.push(x86::r14); - c.push(x86::r13); - c.push(x86::r12); - c.push(x86::rbx); - c.push(x86::rax); + c.push(x86::rbp); + c.push(x86::r15); + c.push(x86::r14); + c.push(x86::r13); + c.push(x86::r12); + c.push(x86::rbx); + c.push(x86::rax); #endif - // Save native stack pointer for longjmp emulation - c.mov(x86::qword_ptr(args[0], ::offset32(&ppu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs)), x86::rsp); + // Save native stack pointer for longjmp emulation + c.mov(x86::qword_ptr(args[0], ::offset32(&ppu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs)), x86::rsp); - // Initialize args - c.mov(x86::r13, x86::qword_ptr(reinterpret_cast(&vm::g_exec_addr))); - c.mov(x86::rbp, args[0]); - c.mov(x86::edx, x86::dword_ptr(x86::rbp, ::offset32(&ppu_thread::cia))); // Load PC + // Initialize args + c.mov(x86::r13, x86::qword_ptr(reinterpret_cast(&vm::g_exec_addr))); + c.mov(x86::rbp, args[0]); + c.mov(x86::edx, x86::dword_ptr(x86::rbp, ::offset32(&ppu_thread::cia))); // Load PC - c.mov(x86::rax, x86::qword_ptr(x86::r13, x86::edx, 1, 0)); // Load call target - c.mov(x86::rdx, x86::rax); - c.shl(x86::rax, 16); - c.shr(x86::rax, 16); - c.shr(x86::rdx, 48); - c.shl(x86::edx, 13); - c.mov(x86::r12d, x86::edx); // Load relocation base + c.mov(x86::rax, x86::qword_ptr(x86::r13, x86::edx, 1, 0)); // Load call target + c.mov(x86::rdx, x86::rax); + c.shl(x86::rax, 16); + c.shr(x86::rax, 16); + c.shr(x86::rdx, 48); + c.shl(x86::edx, 13); + c.mov(x86::r12d, x86::edx); // Load relocation base - c.mov(x86::rbx, x86::qword_ptr(reinterpret_cast(&vm::g_base_addr))); - c.mov(x86::r14, x86::qword_ptr(x86::rbp, ::offset32(&ppu_thread::gpr, 0))); // Load some registers - c.mov(x86::rsi, x86::qword_ptr(x86::rbp, ::offset32(&ppu_thread::gpr, 1))); - c.mov(x86::rdi, x86::qword_ptr(x86::rbp, ::offset32(&ppu_thread::gpr, 2))); + c.mov(x86::rbx, x86::qword_ptr(reinterpret_cast(&vm::g_base_addr))); + c.mov(x86::r14, x86::qword_ptr(x86::rbp, ::offset32(&ppu_thread::gpr, 0))); // Load some registers + c.mov(x86::rsi, x86::qword_ptr(x86::rbp, ::offset32(&ppu_thread::gpr, 1))); + c.mov(x86::rdi, x86::qword_ptr(x86::rbp, ::offset32(&ppu_thread::gpr, 2))); - if (utils::has_avx()) - { - c.vzeroupper(); - } + if (utils::has_avx()) + { + c.vzeroupper(); + } - c.call(x86::rax); + c.call(x86::rax); - if (utils::has_avx()) - { - c.vzeroupper(); - } + if (utils::has_avx()) + { + c.vzeroupper(); + } #ifdef _WIN32 - c.movaps(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); - c.movaps(x86::xmm7, x86::oword_ptr(x86::rsp, 0x10)); - c.movaps(x86::xmm8, x86::oword_ptr(x86::rsp, 0x20)); - c.movaps(x86::xmm9, x86::oword_ptr(x86::rsp, 0x30)); - c.movaps(x86::xmm10, x86::oword_ptr(x86::rsp, 0x40)); - c.movaps(x86::xmm11, x86::oword_ptr(x86::rsp, 0x50)); - c.movaps(x86::xmm12, x86::oword_ptr(x86::rsp, 0x60)); - c.movaps(x86::xmm13, x86::oword_ptr(x86::rsp, 0x70)); - c.movaps(x86::xmm14, x86::oword_ptr(x86::rsp, 0x80)); - c.movaps(x86::xmm15, x86::oword_ptr(x86::rsp, 0x90)); - c.add(x86::rsp, 0xa8); - c.pop(x86::rbx); - c.pop(x86::rbp); - c.pop(x86::rdi); - c.pop(x86::rsi); - c.pop(x86::r12); - c.pop(x86::r13); - c.pop(x86::r14); - c.pop(x86::r15); + c.movaps(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); + c.movaps(x86::xmm7, x86::oword_ptr(x86::rsp, 0x10)); + c.movaps(x86::xmm8, x86::oword_ptr(x86::rsp, 0x20)); + c.movaps(x86::xmm9, x86::oword_ptr(x86::rsp, 0x30)); + c.movaps(x86::xmm10, x86::oword_ptr(x86::rsp, 0x40)); + c.movaps(x86::xmm11, x86::oword_ptr(x86::rsp, 0x50)); + c.movaps(x86::xmm12, x86::oword_ptr(x86::rsp, 0x60)); + c.movaps(x86::xmm13, x86::oword_ptr(x86::rsp, 0x70)); + c.movaps(x86::xmm14, x86::oword_ptr(x86::rsp, 0x80)); + c.movaps(x86::xmm15, x86::oword_ptr(x86::rsp, 0x90)); + c.add(x86::rsp, 0xa8); + c.pop(x86::rbx); + c.pop(x86::rbp); + c.pop(x86::rdi); + c.pop(x86::rsi); + c.pop(x86::r12); + c.pop(x86::r13); + c.pop(x86::r14); + c.pop(x86::r15); #else - c.add(x86::rsp, +8); - c.pop(x86::rbx); - c.pop(x86::r12); - c.pop(x86::r13); - c.pop(x86::r14); - c.pop(x86::r15); - c.pop(x86::rbp); + c.add(x86::rsp, +8); + c.pop(x86::rbx); + c.pop(x86::r12); + c.pop(x86::r13); + c.pop(x86::r14); + c.pop(x86::r15); + c.pop(x86::rbp); #endif - c.ret(); + c.ret(); #else - // See https://github.com/ghc/ghc/blob/master/rts/include/stg/MachRegs.h - // for GHC calling convention definitions on Aarch64 - // and https://developer.arm.com/documentation/den0024/a/The-ABI-for-ARM-64-bit-Architecture/Register-use-in-the-AArch64-Procedure-Call-Standard/Parameters-in-general-purpose-registers - // for AArch64 calling convention + // See https://github.com/ghc/ghc/blob/master/rts/include/stg/MachRegs.h + // for GHC calling convention definitions on Aarch64 + // and https://developer.arm.com/documentation/den0024/a/The-ABI-for-ARM-64-bit-Architecture/Register-use-in-the-AArch64-Procedure-Call-Standard/Parameters-in-general-purpose-registers + // for AArch64 calling convention - // PPU function argument layout: - // x19 = m_exec - // x20 = m_thread, - // x21 = seg0 - // x22 = m_base - // x23 - x25 = gpr[0] - gpr[3] + // PPU function argument layout: + // x19 = m_exec + // x20 = m_thread, + // x21 = seg0 + // x22 = m_base + // x23 - x25 = gpr[0] - gpr[3] - // Push callee saved registers to the hv context - // Assume our LLVM compiled code is unsafe and can clobber our stack. GHC on aarch64 treats stack as scratch. - // We also want to store the register context at a fixed place so we can read the hypervisor state from any lcoation. - // We need to save x18-x30 = 13 x 8B each + 8 bytes for 16B alignment = 112B + // Push callee saved registers to the hv context + // Assume our LLVM compiled code is unsafe and can clobber our stack. GHC on aarch64 treats stack as scratch. + // We also want to store the register context at a fixed place so we can read the hypervisor state from any lcoation. + // We need to save x18-x30 = 13 x 8B each + 8 bytes for 16B alignment = 112B - // Pre-context save - // Layout: - // pc, sp - // x18, x19...x30 - // NOTE: Do not touch x19..x30 before saving the registers! - const u64 hv_register_array_offset = ::offset32(&ppu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs); - Label hv_ctx_pc = c.newLabel(); // Used to hold the far jump return address + // Pre-context save + // Layout: + // pc, sp + // x18, x19...x30 + // NOTE: Do not touch x19..x30 before saving the registers! + const u64 hv_register_array_offset = ::offset32(&ppu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs); + Label hv_ctx_pc = c.newLabel(); // Used to hold the far jump return address - // Sanity - ensure(hv_register_array_offset < 4096); // Imm10 + // Sanity + ensure(hv_register_array_offset < 4096); // Imm10 - c.mov(a64::x15, args[0]); - c.add(a64::x14, a64::x15, Imm(hv_register_array_offset)); // Per-thread context save + c.mov(a64::x15, args[0]); + c.add(a64::x14, a64::x15, Imm(hv_register_array_offset)); // Per-thread context save - c.adr(a64::x15, hv_ctx_pc); // x15 = pc - c.mov(a64::x13, a64::sp); // x16 = sp + c.adr(a64::x15, hv_ctx_pc); // x15 = pc + c.mov(a64::x13, a64::sp); // x16 = sp - c.stp(a64::x15, a64::x13, arm::Mem(a64::x14)); - c.stp(a64::x18, a64::x19, arm::Mem(a64::x14, 16)); - c.stp(a64::x20, a64::x21, arm::Mem(a64::x14, 32)); - c.stp(a64::x22, a64::x23, arm::Mem(a64::x14, 48)); - c.stp(a64::x24, a64::x25, arm::Mem(a64::x14, 64)); - c.stp(a64::x26, a64::x27, arm::Mem(a64::x14, 80)); - c.stp(a64::x28, a64::x29, arm::Mem(a64::x14, 96)); - c.str(a64::x30, arm::Mem(a64::x14, 112)); + c.stp(a64::x15, a64::x13, arm::Mem(a64::x14)); + c.stp(a64::x18, a64::x19, arm::Mem(a64::x14, 16)); + c.stp(a64::x20, a64::x21, arm::Mem(a64::x14, 32)); + c.stp(a64::x22, a64::x23, arm::Mem(a64::x14, 48)); + c.stp(a64::x24, a64::x25, arm::Mem(a64::x14, 64)); + c.stp(a64::x26, a64::x27, arm::Mem(a64::x14, 80)); + c.stp(a64::x28, a64::x29, arm::Mem(a64::x14, 96)); + c.str(a64::x30, arm::Mem(a64::x14, 112)); - // Load REG_Base - use absolute jump target to bypass rel jmp range limits - c.mov(a64::x19, Imm(reinterpret_cast(&vm::g_exec_addr))); - c.ldr(a64::x19, arm::Mem(a64::x19)); - // Load PPUThread struct base -> REG_Sp - const arm::GpX ppu_t_base = a64::x20; - c.mov(ppu_t_base, args[0]); - // Load PC - const arm::GpX pc = a64::x15; - const arm::GpX cia_addr_reg = a64::x11; - // Load offset value - c.mov(cia_addr_reg, Imm(static_cast(::offset32(&ppu_thread::cia)))); - // Load cia - c.ldr(pc.w(), arm::Mem(ppu_t_base, cia_addr_reg)); + // Load REG_Base - use absolute jump target to bypass rel jmp range limits + c.mov(a64::x19, Imm(reinterpret_cast(&vm::g_exec_addr))); + c.ldr(a64::x19, arm::Mem(a64::x19)); + // Load PPUThread struct base -> REG_Sp + const arm::GpX ppu_t_base = a64::x20; + c.mov(ppu_t_base, args[0]); + // Load PC + const arm::GpX pc = a64::x15; + const arm::GpX cia_addr_reg = a64::x11; + // Load offset value + c.mov(cia_addr_reg, Imm(static_cast(::offset32(&ppu_thread::cia)))); + // Load cia + c.ldr(pc.w(), arm::Mem(ppu_t_base, cia_addr_reg)); - // Multiply by 2 to index into ptr table - c.add(pc, pc, pc); + // Multiply by 2 to index into ptr table + c.add(pc, pc, pc); - // Load call target - const arm::GpX call_target = a64::x13; - c.ldr(call_target, arm::Mem(a64::x19, pc)); - // Compute REG_Hp - const arm::GpX reg_hp = a64::x21; - c.mov(reg_hp, call_target); - c.lsr(reg_hp, reg_hp, 48); - c.lsl(reg_hp.w(), reg_hp.w(), 13); + // Load call target + const arm::GpX call_target = a64::x13; + c.ldr(call_target, arm::Mem(a64::x19, pc)); + // Compute REG_Hp + const arm::GpX reg_hp = a64::x21; + c.mov(reg_hp, call_target); + c.lsr(reg_hp, reg_hp, 48); + c.lsl(reg_hp.w(), reg_hp.w(), 13); - // Zero top 16 bits of call target - c.lsl(call_target, call_target, Imm(16)); - c.lsr(call_target, call_target, Imm(16)); + // Zero top 16 bits of call target + c.lsl(call_target, call_target, Imm(16)); + c.lsr(call_target, call_target, Imm(16)); - // Load registers - c.mov(a64::x22, Imm(reinterpret_cast(&vm::g_base_addr))); - c.ldr(a64::x22, arm::Mem(a64::x22)); + // Load registers + c.mov(a64::x22, Imm(reinterpret_cast(&vm::g_base_addr))); + c.ldr(a64::x22, arm::Mem(a64::x22)); - const arm::GpX gpr_addr_reg = a64::x9; - c.mov(gpr_addr_reg, Imm(static_cast(::offset32(&ppu_thread::gpr)))); - c.add(gpr_addr_reg, gpr_addr_reg, ppu_t_base); - c.ldr(a64::x23, arm::Mem(gpr_addr_reg)); - c.ldr(a64::x24, arm::Mem(gpr_addr_reg, 8)); - c.ldr(a64::x25, arm::Mem(gpr_addr_reg, 16)); + const arm::GpX gpr_addr_reg = a64::x9; + c.mov(gpr_addr_reg, Imm(static_cast(::offset32(&ppu_thread::gpr)))); + c.add(gpr_addr_reg, gpr_addr_reg, ppu_t_base); + c.ldr(a64::x23, arm::Mem(gpr_addr_reg)); + c.ldr(a64::x24, arm::Mem(gpr_addr_reg, 8)); + c.ldr(a64::x25, arm::Mem(gpr_addr_reg, 16)); - // Thread context save. This is needed for PPU because different functions can switch between x19 and x20 for the base register. - // We need a different solution to ensure that no matter which version, we get the right vaue on far return. - c.mov(a64::x26, ppu_t_base); + // Thread context save. This is needed for PPU because different functions can switch between x19 and x20 for the base register. + // We need a different solution to ensure that no matter which version, we get the right vaue on far return. + c.mov(a64::x26, ppu_t_base); - // Save thread pointer to stack. SP is the only register preserved across GHC calls. - c.sub(a64::sp, a64::sp, Imm(16)); - c.str(a64::x20, arm::Mem(a64::sp)); + // Save thread pointer to stack. SP is the only register preserved across GHC calls. + c.sub(a64::sp, a64::sp, Imm(16)); + c.str(a64::x20, arm::Mem(a64::sp)); - // GHC scratchpad mem. If managed correctly (i.e no returns ever), GHC functions should never require a stack frame. - // We allocate a slab to use for all functions as they tail-call into each other. - c.sub(a64::sp, a64::sp, Imm(8192)); + // GHC scratchpad mem. If managed correctly (i.e no returns ever), GHC functions should never require a stack frame. + // We allocate a slab to use for all functions as they tail-call into each other. + c.sub(a64::sp, a64::sp, Imm(8192)); - // Execute LLE call - c.blr(call_target); + // Execute LLE call + c.blr(call_target); - // Return address after far jump. Reset sp and start unwinding... - c.bind(hv_ctx_pc); + // Return address after far jump. Reset sp and start unwinding... + c.bind(hv_ctx_pc); - // Clear scratchpad allocation - c.add(a64::sp, a64::sp, Imm(8192)); + // Clear scratchpad allocation + c.add(a64::sp, a64::sp, Imm(8192)); - c.ldr(a64::x20, arm::Mem(a64::sp)); - c.add(a64::sp, a64::sp, Imm(16)); + c.ldr(a64::x20, arm::Mem(a64::sp)); + c.add(a64::sp, a64::sp, Imm(16)); - // We either got here through normal "ret" which keeps our x20 intact, or we jumped here and the escape reset our x20 reg - // Either way, x26 contains our thread base and we forcefully reset the stack pointer - c.add(a64::x14, a64::x20, Imm(hv_register_array_offset)); // Per-thread context save + // We either got here through normal "ret" which keeps our x20 intact, or we jumped here and the escape reset our x20 reg + // Either way, x26 contains our thread base and we forcefully reset the stack pointer + c.add(a64::x14, a64::x20, Imm(hv_register_array_offset)); // Per-thread context save - c.ldr(a64::x15, arm::Mem(a64::x14, 8)); - c.ldp(a64::x18, a64::x19, arm::Mem(a64::x14, 16)); - c.ldp(a64::x20, a64::x21, arm::Mem(a64::x14, 32)); - c.ldp(a64::x22, a64::x23, arm::Mem(a64::x14, 48)); - c.ldp(a64::x24, a64::x25, arm::Mem(a64::x14, 64)); - c.ldp(a64::x26, a64::x27, arm::Mem(a64::x14, 80)); - c.ldp(a64::x28, a64::x29, arm::Mem(a64::x14, 96)); - c.ldr(a64::x30, arm::Mem(a64::x14, 112)); + c.ldr(a64::x15, arm::Mem(a64::x14, 8)); + c.ldp(a64::x18, a64::x19, arm::Mem(a64::x14, 16)); + c.ldp(a64::x20, a64::x21, arm::Mem(a64::x14, 32)); + c.ldp(a64::x22, a64::x23, arm::Mem(a64::x14, 48)); + c.ldp(a64::x24, a64::x25, arm::Mem(a64::x14, 64)); + c.ldp(a64::x26, a64::x27, arm::Mem(a64::x14, 80)); + c.ldp(a64::x28, a64::x29, arm::Mem(a64::x14, 96)); + c.ldr(a64::x30, arm::Mem(a64::x14, 112)); - // Return - c.mov(a64::sp, a64::x15); - c.ret(a64::x30); + // Return + c.mov(a64::sp, a64::x15); + c.ret(a64::x30); #endif -}); + }); -const extern auto ppu_escape = build_function_asm("ppu_escape", [](native_asm& c, auto& args) -{ - using namespace asmjit; +const extern auto ppu_escape = build_function_asm("ppu_escape", [](native_asm& c, auto& args) + { + using namespace asmjit; #if defined(ARCH_X64) - // Restore native stack pointer (longjmp emulation) - c.mov(x86::rsp, x86::qword_ptr(args[0], ::offset32(&ppu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs))); + // Restore native stack pointer (longjmp emulation) + c.mov(x86::rsp, x86::qword_ptr(args[0], ::offset32(&ppu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs))); - // Return to the return location - c.sub(x86::rsp, 8); - c.ret(); + // Return to the return location + c.sub(x86::rsp, 8); + c.ret(); #else - // We really shouldn't be using this, but an implementation shoudln't hurt - // Far jump return. Only clobbers x30. - const arm::GpX ppu_t_base = a64::x20; - const u64 hv_register_array_offset = ::offset32(&ppu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs); - c.mov(ppu_t_base, args[0]); - c.mov(a64::x30, Imm(hv_register_array_offset)); - c.ldr(a64::x30, arm::Mem(ppu_t_base, a64::x30)); - c.ret(a64::x30); + // We really shouldn't be using this, but an implementation shoudln't hurt + // Far jump return. Only clobbers x30. + const arm::GpX ppu_t_base = a64::x20; + const u64 hv_register_array_offset = ::offset32(&ppu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs); + c.mov(ppu_t_base, args[0]); + c.mov(a64::x30, Imm(hv_register_array_offset)); + c.ldr(a64::x30, arm::Mem(ppu_t_base, a64::x30)); + c.ret(a64::x30); #endif -}); + }); void ppu_recompiler_fallback(ppu_thread& ppu); #if defined(ARCH_X64) -const auto ppu_recompiler_fallback_ghc = build_function_asm("", [](native_asm& c, auto& args) -{ - using namespace asmjit; +const auto ppu_recompiler_fallback_ghc = build_function_asm("", [](native_asm& c, auto& args) + { + using namespace asmjit; - c.mov(args[0], x86::rbp); - c.jmp(ppu_recompiler_fallback); -}); + c.mov(args[0], x86::rbp); + c.jmp(ppu_recompiler_fallback); + }); #elif defined(ARCH_ARM64) -const auto ppu_recompiler_fallback_ghc = build_function_asm("", [](native_asm& c, auto& args) -{ - using namespace asmjit; +const auto ppu_recompiler_fallback_ghc = build_function_asm("", [](native_asm& c, auto& args) + { + using namespace asmjit; - Label fallback_fn = c.newLabel(); - Label escape_fn = c.newLabel(); + Label fallback_fn = c.newLabel(); + Label escape_fn = c.newLabel(); - // This is called as GHC so the first arg is in x20. - // Fix up the arg registers and call the real function. - c.mov(args[0], a64::x20); - c.ldr(a64::x13, arm::ptr(fallback_fn)); - c.blr(a64::x13); + // This is called as GHC so the first arg is in x20. + // Fix up the arg registers and call the real function. + c.mov(args[0], a64::x20); + c.ldr(a64::x13, arm::ptr(fallback_fn)); + c.blr(a64::x13); - // There is no call-stack to return to in arm64 GHC. Escape to host. - c.mov(a64::x0, a64::x20); - c.ldr(a64::x13, arm::ptr(escape_fn)); - c.br(a64::x13); + // There is no call-stack to return to in arm64 GHC. Escape to host. + c.mov(a64::x0, a64::x20); + c.ldr(a64::x13, arm::ptr(escape_fn)); + c.br(a64::x13); - c.bind(fallback_fn); - c.embedUInt64(reinterpret_cast(ppu_recompiler_fallback)); - c.bind(escape_fn); - c.embedUInt64(reinterpret_cast(ppu_escape)); -}); + c.bind(fallback_fn); + c.embedUInt64(reinterpret_cast(ppu_recompiler_fallback)); + c.bind(escape_fn); + c.embedUInt64(reinterpret_cast(ppu_escape)); + }); #endif // Get pointer to executable cache @@ -585,11 +590,11 @@ static ppu_intrp_func_t ppu_cache(u32 addr) } static ppu_intrp_func ppu_ret = {[](ppu_thread& ppu, ppu_opcode_t, be_t* this_op, ppu_intrp_func*) -{ - // Fix PC and return (step execution) - ppu.cia = vm::get_addr(this_op); - return; -}}; + { + // Fix PC and return (step execution) + ppu.cia = vm::get_addr(this_op); + return; + }}; static void ppu_fallback(ppu_thread& ppu, ppu_opcode_t op, be_t* this_op, ppu_intrp_func* next_fn) { @@ -729,7 +734,7 @@ extern bool ppu_test_address_may_be_mmio(std::span> insts) // RawSPU MMIO base // 0xe00000000 is a common constant so try to find an ORIS 0x10 or ADDIS 0x10 nearby (for multiplying SPU ID by it) - if (op_imm16 == ppu_instructions::ADDIS({}, {}, -0x2000) || op_imm16 == ppu_instructions::ORIS({}, {}, 0xe000) || op_imm16 == ppu_instructions::XORIS({}, {}, 0xe000)) + if (op_imm16 == ppu_instructions::ADDIS({}, {}, -0x2000) || op_imm16 == ppu_instructions::ORIS({}, {}, 0xe000) || op_imm16 == ppu_instructions::XORIS({}, {}, 0xe000)) { found_raw_spu_base = true; @@ -791,8 +796,8 @@ extern bool ppu_test_address_may_be_mmio(std::span> insts) } // Try to detect a function that receives RawSPU problem state base pointer as an argument else if ((op_imm16 & ~0xffff) == ppu_instructions::LWZ({}, {}, 0) || - (op_imm16 & ~0xffff) == ppu_instructions::STW({}, {}, 0) || - (op_imm16 & ~0xffff) == ppu_instructions::ADDI({}, {}, 0)) + (op_imm16 & ~0xffff) == ppu_instructions::STW({}, {}, 0) || + (op_imm16 & ~0xffff) == ppu_instructions::ADDI({}, {}, 0)) { const bool is_load = (op_imm16 & ~0xffff) == ppu_instructions::LWZ({}, {}, 0); const bool is_store = (op_imm16 & ~0xffff) == ppu_instructions::STW({}, {}, 0); @@ -1087,29 +1092,30 @@ struct ppu_far_jumps_t if (!it->second.func) { it->second.func = build_function_asm("", [&](native_asm& c, auto& args) - { - using namespace asmjit; + { + using namespace asmjit; #ifdef ARCH_X64 - c.mov(args[0], x86::rbp); - c.mov(x86::dword_ptr(args[0], ::offset32(&ppu_thread::cia)), pc); - c.jmp(ppu_far_jump); + c.mov(args[0], x86::rbp); + c.mov(x86::dword_ptr(args[0], ::offset32(&ppu_thread::cia)), pc); + c.jmp(ppu_far_jump); #else - Label jmp_address = c.newLabel(); - Label imm_address = c.newLabel(); + Label jmp_address = c.newLabel(); + Label imm_address = c.newLabel(); - c.ldr(args[1].w(), arm::ptr(imm_address)); - c.str(args[1].w(), arm::Mem(args[0], ::offset32(&ppu_thread::cia))); - c.ldr(args[1], arm::ptr(jmp_address)); - c.br(args[1]); + c.ldr(args[1].w(), arm::ptr(imm_address)); + c.str(args[1].w(), arm::Mem(args[0], ::offset32(&ppu_thread::cia))); + c.ldr(args[1], arm::ptr(jmp_address)); + c.br(args[1]); - c.align(AlignMode::kCode, 16); - c.bind(jmp_address); - c.embedUInt64(reinterpret_cast(ppu_far_jump)); - c.bind(imm_address); - c.embedUInt32(pc); + c.align(AlignMode::kCode, 16); + c.bind(jmp_address); + c.embedUInt64(reinterpret_cast(ppu_far_jump)); + c.bind(imm_address); + c.embedUInt32(pc); #endif - }, &rt); + }, + &rt); } return it->second.func; @@ -1160,7 +1166,7 @@ bool ppu_form_branch_to_code(u32 entry, u32 target, bool link, bool with_toc, st } // For now allow situations where OPD is changed later by patches or by the program itself - //cia_target = opd.addr; + // cia_target = opd.addr; // So force a valid target (executable, yet not equal to entry) cia_target = entry ^ 8; @@ -1253,15 +1259,20 @@ static void ppu_break(ppu_thread& ppu, ppu_opcode_t, be_t* this_op, ppu_int // Pause ppu.state.atomic_op([&](bs_t& state) - { - if (pause_all) state += cpu_flag::dbg_global_pause; - if (pause_all || !(state & cpu_flag::dbg_step)) state += cpu_flag::dbg_pause; - }); + { + if (pause_all) + state += cpu_flag::dbg_global_pause; + if (pause_all || !(state & cpu_flag::dbg_step)) + state += cpu_flag::dbg_pause; + }); if (pause_all) { // Pause all other threads - Emu.CallFromMainThread([]() { Emu.Pause(); }); + Emu.CallFromMainThread([]() + { + Emu.Pause(); + }); } if (ppu.check_state() || old_cia != atomic_storage::load(ppu.cia)) @@ -1430,7 +1441,8 @@ void ppu_thread::dump_regs(std::string& ret, std::any& custom_data) const auto reg = gpr[i]; // Fixup for syscall arguments - if (current_function && i >= 3 && i <= 10) reg = syscall_args[i - 3]; + if (current_function && i >= 3 && i <= 10) + reg = syscall_args[i - 3]; auto [is_const, const_value] = dis_asm.try_get_const_gpr_value(i, cia); @@ -1528,7 +1540,10 @@ void ppu_thread::dump_regs(std::string& ret, std::any& custom_data) const // NTS: size of 3 and above is required // If ends with a newline, only one character is required else if ((sv.size() == buf_tmp.size() || (sv.size() >= (buf_tmp[sv.size()] == '\n' ? 1 : 3))) && - std::all_of(sv.begin(), sv.end(), [](u8 c){ return std::isprint(c); })) + std::all_of(sv.begin(), sv.end(), [](u8 c) + { + return std::isprint(c); + })) { fmt::append(ret, " -> \"%s\"", sv); } @@ -1551,13 +1566,13 @@ void ppu_thread::dump_regs(std::string& ret, std::any& custom_data) const const u32 cr_packed = cr.pack(); for (u32 addr : - { - current_cia, - current_cia + 4, - current_cia + 8, - current_cia - 4, - current_cia + 12, - }) + { + current_cia, + current_cia + 4, + current_cia + 8, + current_cia - 4, + current_cia + 12, + }) { dis_asm.disasm(addr); @@ -1662,8 +1677,7 @@ void ppu_thread::dump_regs(std::string& ret, std::any& custom_data) const { for (usz i = 0; i < std::size(data); i += 4) { - fmt::append(ret, "[0x%02x] %08x %08x %08x %08x\n", i * sizeof(data[0]) - , data[i + 0], data[i + 1], data[i + 2], data[i + 3]); + fmt::append(ret, "[0x%02x] %08x %08x %08x %08x\n", i * sizeof(data[0]), data[i + 0], data[i + 1], data[i + 2], data[i + 3]); } if (addr) @@ -1691,7 +1705,7 @@ std::string ppu_thread::dump_callstack() const std::vector> ppu_thread::dump_callstack_list() const { - //std::shared_lock rlock(vm::g_mutex); // Needs optimizations + // std::shared_lock rlock(vm::g_mutex); // Needs optimizations // Determine stack range const u64 r1 = gpr[1]; @@ -1734,8 +1748,7 @@ std::vector> ppu_thread::dump_callstack_list() const for ( u64 sp = r1; sp % 0x10 == 0u && sp >= stack_min && sp <= stack_max - ppu_stack_start_offset; - is_first = false - ) + is_first = false) { auto is_invalid = [](u64 addr) { @@ -1827,12 +1840,12 @@ std::vector> ppu_thread::dump_callstack_list() const struct context_t { u32 start_point; - bool maybe_leaf = false; // True if the function is leaf or at the very end/start of non-leaf - bool non_leaf = false; // Absolutely not a leaf - bool about_to_push_frame = false; // STDU incoming - bool about_to_store_lr = false; // Link is about to be stored on stack - bool about_to_pop_frame = false; // ADDI R1 is about to be issued - bool about_to_load_link = false; // MTLR is about to be issued + bool maybe_leaf = false; // True if the function is leaf or at the very end/start of non-leaf + bool non_leaf = false; // Absolutely not a leaf + bool about_to_push_frame = false; // STDU incoming + bool about_to_store_lr = false; // Link is about to be stored on stack + bool about_to_pop_frame = false; // ADDI R1 is about to be issued + bool about_to_load_link = false; // MTLR is about to be issued bool maybe_use_reg0_instead_of_lr = false; // Use R0 at the end of a non-leaf function if ADDI has been issued before MTLR }; @@ -2170,7 +2183,7 @@ void ppu_thread::dump_all(std::string& ret) const } } -extern thread_local std::string(*g_tls_log_prefix)(); +extern thread_local std::string (*g_tls_log_prefix)(); void ppu_thread::cpu_task() { @@ -2311,18 +2324,18 @@ void ppu_thread::cpu_task() // Run SPUs waiting on a syscall (savestates related) idm::select>([&](u32, named_thread& spu) - { - if (spu.group && spu.index == spu.group->waiter_spu_index) { - if (std::exchange(spu.stop_flag_removal_protection, false)) + if (spu.group && spu.index == spu.group->waiter_spu_index) { - return; - } + if (std::exchange(spu.stop_flag_removal_protection, false)) + { + return; + } - ensure(spu.state.test_and_reset(cpu_flag::stop)); - spu.state.notify_one(); - } - }); + ensure(spu.state.test_and_reset(cpu_flag::stop)); + spu.state.notify_one(); + } + }); // Check if this is the only PPU left to initialize (savestates related) if (lv2_obj::is_scheduler_ready()) @@ -2475,14 +2488,7 @@ ppu_thread::~ppu_thread() } ppu_thread::ppu_thread(const ppu_thread_params& param, std::string_view name, u32 _prio, int detached) - : cpu_thread(idm::last_id()) - , stack_size(param.stack_size) - , stack_addr(param.stack_addr) - , joiner(detached != 0 ? ppu_join_status::detached : ppu_join_status::joinable) - , entry_func(param.entry) - , start_time(get_guest_system_time()) - , is_interrupt_thread(detached < 0) - , ppu_tname(make_single(name)) + : cpu_thread(idm::last_id()), stack_size(param.stack_size), stack_addr(param.stack_addr), joiner(detached != 0 ? ppu_join_status::detached : ppu_join_status::joinable), entry_func(param.entry), start_time(get_guest_system_time()), is_interrupt_thread(detached < 0), ppu_tname(make_single(name)) { prio.raw().prio = _prio; @@ -2578,11 +2584,8 @@ struct save_lv2_tag ppu_thread::ppu_thread(utils::serial& ar) : cpu_thread(idm::last_id()) // last_id() is showed to constructor on serialization - , stack_size(ar) - , stack_addr(ar) - , joiner(ar.pop()) - , entry_func(std::bit_cast(ar)) - , is_interrupt_thread(ar) + , + stack_size(ar), stack_addr(ar), joiner(ar.pop()), entry_func(std::bit_cast(ar)), is_interrupt_thread(ar) { [[maybe_unused]] const s32 version = GET_SERIALIZATION_VERSION(ppu); @@ -2620,11 +2623,8 @@ ppu_thread::ppu_thread(utils::serial& ar) { void ppu_interrupt_thread_entry(ppu_thread&, ppu_opcode_t, be_t*, struct ppu_intrp_func*); - cmd_list - ({ - { ppu_cmd::ptr_call, 0 }, - std::bit_cast(&ppu_interrupt_thread_entry) - }); + cmd_list({{ppu_cmd::ptr_call, 0}, + std::bit_cast(&ppu_interrupt_thread_entry)}); } }; @@ -2656,18 +2656,18 @@ ppu_thread::ppu_thread(utils::serial& ar) if (!std::exchange(g_fxo->get().pushed, true)) { Emu.PostponeInitCode([this]() - { - u32 prev = umax; - - for (auto ppu : g_fxo->get().awake_ppus) { - ensure(prev + 1 == ppu.first); - prev = ppu.first; - lv2_obj::awake(ppu.second); - } + u32 prev = umax; - g_fxo->get().awake_ppus.clear(); - }); + for (auto ppu : g_fxo->get().awake_ppus) + { + ensure(prev + 1 == ppu.first); + prev = ppu.first; + lv2_obj::awake(ppu.second); + } + + g_fxo->get().awake_ppus.clear(); + }); } } else @@ -2681,17 +2681,14 @@ ppu_thread::ppu_thread(utils::serial& ar) { if (std::exchange(g_fxo->get().pushed, true)) { - cmd_list - ({ - {ppu_cmd::ptr_call, 0}, +[](ppu_thread&) -> bool + cmd_list({{ppu_cmd::ptr_call, 0}, +[](ppu_thread&) -> bool { while (!Emu.IsStopped() && !g_fxo->get().inited) { thread_ctrl::wait_on(g_fxo->get().inited, 0); } return false; - } - }); + }}); } else { @@ -2699,23 +2696,18 @@ ppu_thread::ppu_thread(utils::serial& ar) g_fxo->get().disable = true; cmd_push({ppu_cmd::initialize, 0}); - cmd_list - ({ - {ppu_cmd::ptr_call, 0}, +[](ppu_thread&) -> bool + cmd_list({{ppu_cmd::ptr_call, 0}, +[](ppu_thread&) -> bool { auto& inited = g_fxo->get().inited; inited = 1; inited.notify_all(); return true; - } - }); + }}); } if (status == PPU_THREAD_STATUS_SLEEP) { - cmd_list - ({ - {ppu_cmd::ptr_call, 0}, + cmd_list({{ppu_cmd::ptr_call, 0}, +[](ppu_thread& ppu) -> bool { @@ -2729,8 +2721,7 @@ ppu_thread::ppu_thread(utils::serial& ar) ppu.optional_savestate_state->clear(); // Reset to writing state ppu.loaded_from_savestate = false; return true; - } - }); + }}); lv2_obj::set_future_sleep(this); } @@ -2901,7 +2892,8 @@ cmd64 ppu_thread::cmd_wait() be_t* ppu_thread::get_stack_arg(s32 i, u64 align) { - if (align != 1 && align != 2 && align != 4 && align != 8 && align != 16) fmt::throw_exception("Unsupported alignment: 0x%llx", align); + if (align != 1 && align != 2 && align != 4 && align != 8 && align != 16) + fmt::throw_exception("Unsupported alignment: 0x%llx", align); return vm::_ptr(vm::cast((gpr[1] + 0x30 + 0x8 * (i - 1)) & (0 - align))); } @@ -2933,12 +2925,12 @@ void ppu_thread::fast_call(u32 addr, u64 rtoc, bool is_thread_entry) if (!_this->ppu_tname.is_equal(name_cache)) [[unlikely]] { _this->ppu_tname.peek_op([&](const shared_ptr& ptr) - { - if (ptr != name_cache) { - name_cache = ptr; - } - }); + if (ptr != name_cache) + { + name_cache = ptr; + } + }); } const auto cia = _this->cia; @@ -3009,7 +3001,7 @@ std::pair ppu_thread::stack_push(u32 size, u32 align_v) ppu_thread& context = static_cast(*cpu); const u32 old_pos = vm::cast(context.gpr[1]); - context.gpr[1] -= size; // room minimal possible size + context.gpr[1] -= size; // room minimal possible size context.gpr[1] &= ~(u64{align_v} - 1); // fix stack alignment auto is_stack = [&](u64 addr) @@ -3242,215 +3234,215 @@ extern u64 ppu_ldarx(ppu_thread& ppu, u32 addr) return ppu_load_acquire_reservation(ppu, addr); } -const auto ppu_stcx_accurate_tx = build_function_asm("ppu_stcx_accurate_tx", [](native_asm& c, auto& args) -{ - using namespace asmjit; +const auto ppu_stcx_accurate_tx = build_function_asm("ppu_stcx_accurate_tx", [](native_asm& c, auto& args) + { + using namespace asmjit; #if defined(ARCH_X64) - Label fall = c.newLabel(); - Label fail = c.newLabel(); - Label _ret = c.newLabel(); - Label load = c.newLabel(); + Label fall = c.newLabel(); + Label fail = c.newLabel(); + Label _ret = c.newLabel(); + Label load = c.newLabel(); - //if (utils::has_avx() && !s_tsx_avx) - //{ - // c.vzeroupper(); - //} + // if (utils::has_avx() && !s_tsx_avx) + //{ + // c.vzeroupper(); + // } - // Create stack frame if necessary (Windows ABI has only 6 volatile vector registers) - c.push(x86::rbp); - c.push(x86::r14); - c.sub(x86::rsp, 40); + // Create stack frame if necessary (Windows ABI has only 6 volatile vector registers) + c.push(x86::rbp); + c.push(x86::r14); + c.sub(x86::rsp, 40); #ifdef _WIN32 - if (!s_tsx_avx) - { - c.movups(x86::oword_ptr(x86::rsp, 0), x86::xmm6); - c.movups(x86::oword_ptr(x86::rsp, 16), x86::xmm7); - } + if (!s_tsx_avx) + { + c.movups(x86::oword_ptr(x86::rsp, 0), x86::xmm6); + c.movups(x86::oword_ptr(x86::rsp, 16), x86::xmm7); + } #endif - // Prepare registers - build_swap_rdx_with(c, args, x86::r10); - c.mov(x86::rbp, x86::qword_ptr(reinterpret_cast(&vm::g_sudo_addr))); - c.lea(x86::rbp, x86::qword_ptr(x86::rbp, args[0])); - c.and_(x86::rbp, -128); - c.prefetchw(x86::byte_ptr(x86::rbp, 0)); - c.prefetchw(x86::byte_ptr(x86::rbp, 64)); - c.movzx(args[0].r32(), args[0].r16()); - c.shr(args[0].r32(), 1); - c.lea(x86::r11, x86::qword_ptr(reinterpret_cast(+vm::g_reservations), args[0])); - c.and_(x86::r11, -128 / 2); - c.and_(args[0].r32(), 63); + // Prepare registers + build_swap_rdx_with(c, args, x86::r10); + c.mov(x86::rbp, x86::qword_ptr(reinterpret_cast(&vm::g_sudo_addr))); + c.lea(x86::rbp, x86::qword_ptr(x86::rbp, args[0])); + c.and_(x86::rbp, -128); + c.prefetchw(x86::byte_ptr(x86::rbp, 0)); + c.prefetchw(x86::byte_ptr(x86::rbp, 64)); + c.movzx(args[0].r32(), args[0].r16()); + c.shr(args[0].r32(), 1); + c.lea(x86::r11, x86::qword_ptr(reinterpret_cast(+vm::g_reservations), args[0])); + c.and_(x86::r11, -128 / 2); + c.and_(args[0].r32(), 63); - // Prepare data - if (s_tsx_avx) - { - c.vmovups(x86::ymm0, x86::ymmword_ptr(args[2], 0)); - c.vmovups(x86::ymm1, x86::ymmword_ptr(args[2], 32)); - c.vmovups(x86::ymm2, x86::ymmword_ptr(args[2], 64)); - c.vmovups(x86::ymm3, x86::ymmword_ptr(args[2], 96)); - } - else - { - c.movaps(x86::xmm0, x86::oword_ptr(args[2], 0)); - c.movaps(x86::xmm1, x86::oword_ptr(args[2], 16)); - c.movaps(x86::xmm2, x86::oword_ptr(args[2], 32)); - c.movaps(x86::xmm3, x86::oword_ptr(args[2], 48)); - c.movaps(x86::xmm4, x86::oword_ptr(args[2], 64)); - c.movaps(x86::xmm5, x86::oword_ptr(args[2], 80)); - c.movaps(x86::xmm6, x86::oword_ptr(args[2], 96)); - c.movaps(x86::xmm7, x86::oword_ptr(args[2], 112)); - } + // Prepare data + if (s_tsx_avx) + { + c.vmovups(x86::ymm0, x86::ymmword_ptr(args[2], 0)); + c.vmovups(x86::ymm1, x86::ymmword_ptr(args[2], 32)); + c.vmovups(x86::ymm2, x86::ymmword_ptr(args[2], 64)); + c.vmovups(x86::ymm3, x86::ymmword_ptr(args[2], 96)); + } + else + { + c.movaps(x86::xmm0, x86::oword_ptr(args[2], 0)); + c.movaps(x86::xmm1, x86::oword_ptr(args[2], 16)); + c.movaps(x86::xmm2, x86::oword_ptr(args[2], 32)); + c.movaps(x86::xmm3, x86::oword_ptr(args[2], 48)); + c.movaps(x86::xmm4, x86::oword_ptr(args[2], 64)); + c.movaps(x86::xmm5, x86::oword_ptr(args[2], 80)); + c.movaps(x86::xmm6, x86::oword_ptr(args[2], 96)); + c.movaps(x86::xmm7, x86::oword_ptr(args[2], 112)); + } - // Alloc r14 to stamp0 - const auto stamp0 = x86::r14; - build_get_tsc(c, stamp0); + // Alloc r14 to stamp0 + const auto stamp0 = x86::r14; + build_get_tsc(c, stamp0); - Label fail2 = c.newLabel(); + Label fail2 = c.newLabel(); - Label tx1 = build_transaction_enter(c, fall, [&]() - { + Label tx1 = build_transaction_enter(c, fall, [&]() + { + build_get_tsc(c); + c.sub(x86::rax, stamp0); + c.cmp(x86::rax, x86::qword_ptr(reinterpret_cast(&g_rtm_tx_limit2))); + c.jae(fall); + }); + + // Check pause flag + c.bt(x86::dword_ptr(args[2], ::offset32(&ppu_thread::state) - ::offset32(&ppu_thread::rdata)), static_cast(cpu_flag::pause)); + c.jc(fall); + c.xbegin(tx1); + + if (s_tsx_avx) + { + c.vxorps(x86::ymm0, x86::ymm0, x86::ymmword_ptr(x86::rbp, 0)); + c.vxorps(x86::ymm1, x86::ymm1, x86::ymmword_ptr(x86::rbp, 32)); + c.vxorps(x86::ymm2, x86::ymm2, x86::ymmword_ptr(x86::rbp, 64)); + c.vxorps(x86::ymm3, x86::ymm3, x86::ymmword_ptr(x86::rbp, 96)); + c.vorps(x86::ymm0, x86::ymm0, x86::ymm1); + c.vorps(x86::ymm1, x86::ymm2, x86::ymm3); + c.vorps(x86::ymm0, x86::ymm1, x86::ymm0); + c.vptest(x86::ymm0, x86::ymm0); + } + else + { + c.xorps(x86::xmm0, x86::oword_ptr(x86::rbp, 0)); + c.xorps(x86::xmm1, x86::oword_ptr(x86::rbp, 16)); + c.xorps(x86::xmm2, x86::oword_ptr(x86::rbp, 32)); + c.xorps(x86::xmm3, x86::oword_ptr(x86::rbp, 48)); + c.xorps(x86::xmm4, x86::oword_ptr(x86::rbp, 64)); + c.xorps(x86::xmm5, x86::oword_ptr(x86::rbp, 80)); + c.xorps(x86::xmm6, x86::oword_ptr(x86::rbp, 96)); + c.xorps(x86::xmm7, x86::oword_ptr(x86::rbp, 112)); + c.orps(x86::xmm0, x86::xmm1); + c.orps(x86::xmm2, x86::xmm3); + c.orps(x86::xmm4, x86::xmm5); + c.orps(x86::xmm6, x86::xmm7); + c.orps(x86::xmm0, x86::xmm2); + c.orps(x86::xmm4, x86::xmm6); + c.orps(x86::xmm0, x86::xmm4); + c.ptest(x86::xmm0, x86::xmm0); + } + + c.jnz(fail); + + // Store 8 bytes + c.mov(x86::qword_ptr(x86::rbp, args[0], 1, 0), args[3]); + + c.xend(); + c.lock().add(x86::qword_ptr(x86::r11), 64); build_get_tsc(c); c.sub(x86::rax, stamp0); - c.cmp(x86::rax, x86::qword_ptr(reinterpret_cast(&g_rtm_tx_limit2))); - c.jae(fall); - }); + c.jmp(_ret); - // Check pause flag - c.bt(x86::dword_ptr(args[2], ::offset32(&ppu_thread::state) - ::offset32(&ppu_thread::rdata)), static_cast(cpu_flag::pause)); - c.jc(fall); - c.xbegin(tx1); + // XABORT is expensive so try to finish with xend instead + c.bind(fail); - if (s_tsx_avx) - { - c.vxorps(x86::ymm0, x86::ymm0, x86::ymmword_ptr(x86::rbp, 0)); - c.vxorps(x86::ymm1, x86::ymm1, x86::ymmword_ptr(x86::rbp, 32)); - c.vxorps(x86::ymm2, x86::ymm2, x86::ymmword_ptr(x86::rbp, 64)); - c.vxorps(x86::ymm3, x86::ymm3, x86::ymmword_ptr(x86::rbp, 96)); - c.vorps(x86::ymm0, x86::ymm0, x86::ymm1); - c.vorps(x86::ymm1, x86::ymm2, x86::ymm3); - c.vorps(x86::ymm0, x86::ymm1, x86::ymm0); - c.vptest(x86::ymm0, x86::ymm0); - } - else - { - c.xorps(x86::xmm0, x86::oword_ptr(x86::rbp, 0)); - c.xorps(x86::xmm1, x86::oword_ptr(x86::rbp, 16)); - c.xorps(x86::xmm2, x86::oword_ptr(x86::rbp, 32)); - c.xorps(x86::xmm3, x86::oword_ptr(x86::rbp, 48)); - c.xorps(x86::xmm4, x86::oword_ptr(x86::rbp, 64)); - c.xorps(x86::xmm5, x86::oword_ptr(x86::rbp, 80)); - c.xorps(x86::xmm6, x86::oword_ptr(x86::rbp, 96)); - c.xorps(x86::xmm7, x86::oword_ptr(x86::rbp, 112)); - c.orps(x86::xmm0, x86::xmm1); - c.orps(x86::xmm2, x86::xmm3); - c.orps(x86::xmm4, x86::xmm5); - c.orps(x86::xmm6, x86::xmm7); - c.orps(x86::xmm0, x86::xmm2); - c.orps(x86::xmm4, x86::xmm6); - c.orps(x86::xmm0, x86::xmm4); - c.ptest(x86::xmm0, x86::xmm0); - } + // Load old data to store back in rdata + if (s_tsx_avx) + { + c.vmovaps(x86::ymm0, x86::ymmword_ptr(x86::rbp, 0)); + c.vmovaps(x86::ymm1, x86::ymmword_ptr(x86::rbp, 32)); + c.vmovaps(x86::ymm2, x86::ymmword_ptr(x86::rbp, 64)); + c.vmovaps(x86::ymm3, x86::ymmword_ptr(x86::rbp, 96)); + } + else + { + c.movaps(x86::xmm0, x86::oword_ptr(x86::rbp, 0)); + c.movaps(x86::xmm1, x86::oword_ptr(x86::rbp, 16)); + c.movaps(x86::xmm2, x86::oword_ptr(x86::rbp, 32)); + c.movaps(x86::xmm3, x86::oword_ptr(x86::rbp, 48)); + c.movaps(x86::xmm4, x86::oword_ptr(x86::rbp, 64)); + c.movaps(x86::xmm5, x86::oword_ptr(x86::rbp, 80)); + c.movaps(x86::xmm6, x86::oword_ptr(x86::rbp, 96)); + c.movaps(x86::xmm7, x86::oword_ptr(x86::rbp, 112)); + } - c.jnz(fail); + c.xend(); + c.jmp(fail2); - // Store 8 bytes - c.mov(x86::qword_ptr(x86::rbp, args[0], 1, 0), args[3]); + c.bind(fall); + c.mov(x86::rax, -1); + c.jmp(_ret); - c.xend(); - c.lock().add(x86::qword_ptr(x86::r11), 64); - build_get_tsc(c); - c.sub(x86::rax, stamp0); - c.jmp(_ret); + c.bind(fail2); + c.lock().sub(x86::qword_ptr(x86::r11), 64); + c.bind(load); - // XABORT is expensive so try to finish with xend instead - c.bind(fail); + // Store previous data back to rdata + if (s_tsx_avx) + { + c.vmovaps(x86::ymmword_ptr(args[2], 0), x86::ymm0); + c.vmovaps(x86::ymmword_ptr(args[2], 32), x86::ymm1); + c.vmovaps(x86::ymmword_ptr(args[2], 64), x86::ymm2); + c.vmovaps(x86::ymmword_ptr(args[2], 96), x86::ymm3); + } + else + { + c.movaps(x86::oword_ptr(args[2], 0), x86::xmm0); + c.movaps(x86::oword_ptr(args[2], 16), x86::xmm1); + c.movaps(x86::oword_ptr(args[2], 32), x86::xmm2); + c.movaps(x86::oword_ptr(args[2], 48), x86::xmm3); + c.movaps(x86::oword_ptr(args[2], 64), x86::xmm4); + c.movaps(x86::oword_ptr(args[2], 80), x86::xmm5); + c.movaps(x86::oword_ptr(args[2], 96), x86::xmm6); + c.movaps(x86::oword_ptr(args[2], 112), x86::xmm7); + } - // Load old data to store back in rdata - if (s_tsx_avx) - { - c.vmovaps(x86::ymm0, x86::ymmword_ptr(x86::rbp, 0)); - c.vmovaps(x86::ymm1, x86::ymmword_ptr(x86::rbp, 32)); - c.vmovaps(x86::ymm2, x86::ymmword_ptr(x86::rbp, 64)); - c.vmovaps(x86::ymm3, x86::ymmword_ptr(x86::rbp, 96)); - } - else - { - c.movaps(x86::xmm0, x86::oword_ptr(x86::rbp, 0)); - c.movaps(x86::xmm1, x86::oword_ptr(x86::rbp, 16)); - c.movaps(x86::xmm2, x86::oword_ptr(x86::rbp, 32)); - c.movaps(x86::xmm3, x86::oword_ptr(x86::rbp, 48)); - c.movaps(x86::xmm4, x86::oword_ptr(x86::rbp, 64)); - c.movaps(x86::xmm5, x86::oword_ptr(x86::rbp, 80)); - c.movaps(x86::xmm6, x86::oword_ptr(x86::rbp, 96)); - c.movaps(x86::xmm7, x86::oword_ptr(x86::rbp, 112)); - } + c.mov(x86::rax, -1); + c.mov(x86::qword_ptr(args[2], ::offset32(&ppu_thread::last_ftime) - ::offset32(&ppu_thread::rdata)), x86::rax); + c.xor_(x86::eax, x86::eax); + // c.jmp(_ret); - c.xend(); - c.jmp(fail2); - - c.bind(fall); - c.mov(x86::rax, -1); - c.jmp(_ret); - - c.bind(fail2); - c.lock().sub(x86::qword_ptr(x86::r11), 64); - c.bind(load); - - // Store previous data back to rdata - if (s_tsx_avx) - { - c.vmovaps(x86::ymmword_ptr(args[2], 0), x86::ymm0); - c.vmovaps(x86::ymmword_ptr(args[2], 32), x86::ymm1); - c.vmovaps(x86::ymmword_ptr(args[2], 64), x86::ymm2); - c.vmovaps(x86::ymmword_ptr(args[2], 96), x86::ymm3); - } - else - { - c.movaps(x86::oword_ptr(args[2], 0), x86::xmm0); - c.movaps(x86::oword_ptr(args[2], 16), x86::xmm1); - c.movaps(x86::oword_ptr(args[2], 32), x86::xmm2); - c.movaps(x86::oword_ptr(args[2], 48), x86::xmm3); - c.movaps(x86::oword_ptr(args[2], 64), x86::xmm4); - c.movaps(x86::oword_ptr(args[2], 80), x86::xmm5); - c.movaps(x86::oword_ptr(args[2], 96), x86::xmm6); - c.movaps(x86::oword_ptr(args[2], 112), x86::xmm7); - } - - c.mov(x86::rax, -1); - c.mov(x86::qword_ptr(args[2], ::offset32(&ppu_thread::last_ftime) - ::offset32(&ppu_thread::rdata)), x86::rax); - c.xor_(x86::eax, x86::eax); - //c.jmp(_ret); - - c.bind(_ret); + c.bind(_ret); #ifdef _WIN32 - if (!s_tsx_avx) - { - c.vmovups(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); - c.vmovups(x86::xmm7, x86::oword_ptr(x86::rsp, 16)); - } + if (!s_tsx_avx) + { + c.vmovups(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); + c.vmovups(x86::xmm7, x86::oword_ptr(x86::rsp, 16)); + } #endif - if (s_tsx_avx) - { - c.vzeroupper(); - } + if (s_tsx_avx) + { + c.vzeroupper(); + } - c.add(x86::rsp, 40); - c.pop(x86::r14); - c.pop(x86::rbp); + c.add(x86::rsp, 40); + c.pop(x86::r14); + c.pop(x86::rbp); - maybe_flush_lbr(c); - c.ret(); + maybe_flush_lbr(c); + c.ret(); #else - UNUSED(args); + UNUSED(args); - // Unimplemented should fail. - c.brk(Imm(0x42)); - c.ret(a64::x30); + // Unimplemented should fail. + c.brk(Imm(0x42)); + c.ret(a64::x30); #endif -}); + }); template static bool ppu_store_reservation(ppu_thread& ppu, u32 addr, u64 reg_value) @@ -3509,187 +3501,187 @@ static bool ppu_store_reservation(ppu_thread& ppu, u32 addr, u64 reg_value) } if ([&]() - { - if (ppu.use_full_rdata) [[unlikely]] { - auto [_oldd, _ok] = res.fetch_op([&](u64& r) + if (ppu.use_full_rdata) [[unlikely]] { - if ((r & -128) != rtime || (r & 127)) + auto [_oldd, _ok] = res.fetch_op([&](u64& r) + { + if ((r & -128) != rtime || (r & 127)) + { + return false; + } + + r += vm::rsrv_unique_lock; + return true; + }); + + if (!_ok) { + // Already locked or updated: give up return false; } - r += vm::rsrv_unique_lock; - return true; - }); - - if (!_ok) - { - // Already locked or updated: give up - return false; - } - - if (g_use_rtm) [[likely]] - { - switch (u64 count = ppu_stcx_accurate_tx(addr & -8, rtime, ppu.rdata, std::bit_cast(new_data))) + if (g_use_rtm) [[likely]] { - case umax: - { - auto& all_data = *vm::get_super_ptr(addr & -128); - auto& sdata = *vm::get_super_ptr>(addr & -8); - - const bool ok = cpu_thread::suspend_all<+3>(&ppu, {all_data, all_data + 64, &res}, [&] + switch (u64 count = ppu_stcx_accurate_tx(addr & -8, rtime, ppu.rdata, std::bit_cast(new_data))) { - if ((res & -128) == rtime && cmp_rdata(ppu.rdata, all_data)) + case umax: + { + auto& all_data = *vm::get_super_ptr(addr & -128); + auto& sdata = *vm::get_super_ptr>(addr & -8); + + const bool ok = cpu_thread::suspend_all<+3>(&ppu, {all_data, all_data + 64, &res}, [&] + { + if ((res & -128) == rtime && cmp_rdata(ppu.rdata, all_data)) + { + sdata.release(new_data); + res += 64; + return true; + } + + mov_rdata_nt(ppu.rdata, all_data); + res -= 64; + return false; + }); + + if (ok) { - sdata.release(new_data); + break; + } + + ppu.last_ftime = -1; + [[fallthrough]]; + } + case 0: + { + if (ppu.last_faddr == addr) + { + ppu.last_fail++; + } + + if (ppu.last_ftime != umax) + { + ppu.last_faddr = 0; + return false; + } + + utils::prefetch_read(ppu.rdata); + utils::prefetch_read(ppu.rdata + 64); + ppu.last_faddr = addr; + ppu.last_ftime = res.load() & -128; + ppu.last_ftsc = utils::get_tsc(); + return false; + } + default: + { + if (count > 20000 && g_cfg.core.perf_report) [[unlikely]] + { + perf_log.warning("STCX: took too long: %.3fus (%u c)", count / (utils::get_tsc_freq() / 1000'000.), count); + } + + break; + } + } + + if (ppu.last_faddr == addr) + { + ppu.last_succ++; + } + + ppu.last_faddr = 0; + return true; + } + + // Align address: we do not need the lower 7 bits anymore + addr &= -128; + + // Cache line data + // auto& cline_data = vm::_ref(addr); + + data += 0; + auto range_lock = vm::alloc_range_lock(); + bool success = false; + { + rsx::reservation_lock rsx_lock(addr, 128); + + auto& super_data = *vm::get_super_ptr(addr); + success = [&]() + { + // Full lock (heavyweight) + // TODO: vm::check_addr + vm::writer_lock lock(addr, range_lock); + + if (cmp_rdata(ppu.rdata, super_data)) + { + data.release(new_data); res += 64; return true; } - mov_rdata_nt(ppu.rdata, all_data); res -= 64; return false; - }); - - if (ok) - { - break; - } - - ppu.last_ftime = -1; - [[fallthrough]]; + }(); } - case 0: - { - if (ppu.last_faddr == addr) - { - ppu.last_fail++; - } + vm::free_range_lock(range_lock); - if (ppu.last_ftime != umax) + return success; + } + + if (new_data == old_data) + { + ppu.last_faddr = 0; + return res.compare_and_swap_test(rtime, rtime + 128); + } + + // Aligned 8-byte reservations will be used here + addr &= -8; + + const u64 lock_bits = vm::rsrv_unique_lock; + + auto [_oldd, _ok] = res.fetch_op([&](u64& r) + { + if ((r & -128) != rtime || (r & 127)) { - ppu.last_faddr = 0; return false; } - utils::prefetch_read(ppu.rdata); - utils::prefetch_read(ppu.rdata + 64); - ppu.last_faddr = addr; - ppu.last_ftime = res.load() & -128; - ppu.last_ftsc = utils::get_tsc(); - return false; - } - default: - { - if (count > 20000 && g_cfg.core.perf_report) [[unlikely]] - { - perf_log.warning("STCX: took too long: %.3fus (%u c)", count / (utils::get_tsc_freq() / 1000'000.), count); - } - - break; - } - } - - if (ppu.last_faddr == addr) - { - ppu.last_succ++; - } + r += lock_bits; + return true; + }); + // Give up if reservation has been locked or updated + if (!_ok) + { ppu.last_faddr = 0; - return true; - } - - // Align address: we do not need the lower 7 bits anymore - addr &= -128; - - // Cache line data - //auto& cline_data = vm::_ref(addr); - - data += 0; - auto range_lock = vm::alloc_range_lock(); - bool success = false; - { - rsx::reservation_lock rsx_lock(addr, 128); - - auto& super_data = *vm::get_super_ptr(addr); - success = [&]() - { - // Full lock (heavyweight) - // TODO: vm::check_addr - vm::writer_lock lock(addr, range_lock); - - if (cmp_rdata(ppu.rdata, super_data)) - { - data.release(new_data); - res += 64; - return true; - } - - res -= 64; - return false; - }(); - } - vm::free_range_lock(range_lock); - - return success; - } - - if (new_data == old_data) - { - ppu.last_faddr = 0; - return res.compare_and_swap_test(rtime, rtime + 128); - } - - // Aligned 8-byte reservations will be used here - addr &= -8; - - const u64 lock_bits = vm::rsrv_unique_lock; - - auto [_oldd, _ok] = res.fetch_op([&](u64& r) - { - if ((r & -128) != rtime || (r & 127)) - { return false; } - r += lock_bits; - return true; - }); - - // Give up if reservation has been locked or updated - if (!_ok) - { - ppu.last_faddr = 0; - return false; - } - - // Store previous value in old_data on failure - if (data.compare_exchange(old_data, new_data)) - { - res += 128 - lock_bits; - return true; - } - - const u64 old_rtime = res.fetch_sub(lock_bits); - - // TODO: disabled with this setting on, since it's dangerous to mix - if (!g_cfg.core.ppu_128_reservations_loop_max_length) - { - // Store old_data on failure - if (ppu.last_faddr == addr) + // Store previous value in old_data on failure + if (data.compare_exchange(old_data, new_data)) { - ppu.last_fail++; + res += 128 - lock_bits; + return true; } - ppu.last_faddr = addr; - ppu.last_ftime = old_rtime & -128; - ppu.last_ftsc = utils::get_tsc(); - std::memcpy(&ppu.rdata[addr & 0x78], &old_data, 8); - } + const u64 old_rtime = res.fetch_sub(lock_bits); - return false; - }()) + // TODO: disabled with this setting on, since it's dangerous to mix + if (!g_cfg.core.ppu_128_reservations_loop_max_length) + { + // Store old_data on failure + if (ppu.last_faddr == addr) + { + ppu.last_fail++; + } + + ppu.last_faddr = addr; + ppu.last_ftime = old_rtime & -128; + ppu.last_ftsc = utils::get_tsc(); + std::memcpy(&ppu.rdata[addr & 0x78], &old_data, 8); + } + + return false; + }()) { extern atomic_t liblv2_begin, liblv2_end; @@ -3819,7 +3811,7 @@ namespace // Compiled PPU module info struct jit_module { - std::vector symbol_resolvers; + std::vector symbol_resolvers; std::vector> pjit; bool init = false; }; @@ -3895,7 +3887,7 @@ namespace return *this; } }; -} +} // namespace #endif namespace @@ -3910,20 +3902,12 @@ namespace u64 m_pos; explicit file_view(const fs::file& _file, u64 offset, u64 max_size) noexcept - : m_storage(fs::file()) - , m_file(_file) - , m_off(offset) - , m_max_size(max_size) - , m_pos(0) + : m_storage(fs::file()), m_file(_file), m_off(offset), m_max_size(max_size), m_pos(0) { } explicit file_view(fs::file&& _file, u64 offset, u64 max_size) noexcept - : m_storage(std::move(_file)) - , m_file(m_storage) - , m_off(offset) - , m_max_size(max_size) - , m_pos(0) + : m_storage(std::move(_file)), m_file(m_storage), m_off(offset), m_max_size(max_size), m_pos(0) { } @@ -3966,7 +3950,8 @@ namespace const s64 new_pos = whence == fs::seek_set ? offset : whence == fs::seek_cur ? offset + m_pos : - whence == fs::seek_end ? offset + size() : -1; + whence == fs::seek_end ? offset + size() : + -1; if (new_pos < 0) { @@ -3983,7 +3968,7 @@ namespace return std::min(utils::sub_saturate(m_file.size(), m_off), m_max_size); } }; -} +} // namespace extern fs::file make_file_view(const fs::file& _file, u64 offset, u64 max_size = umax) { @@ -4083,9 +4068,7 @@ extern void ppu_precompile(std::vector& dir_queue, std::vector& dir_queue, std::vectorbegin(), loaded_modules->end(), [&](ppu_module* obj) - { - return obj->name == entry.name; - })) + { + return obj->name == entry.name; + })) { return true; } @@ -4318,296 +4301,299 @@ extern void ppu_precompile(std::vector& dir_queue, std::vector(software_thread_limit, cpu_thread_limit), [&] - { -#ifdef __APPLE__ - pthread_jit_write_protect_np(false); -#endif - // Set low priority - thread_ctrl::scoped_priority low_prio(-1); - u32 inc_fdone = 1; - - for (usz func_i = fnext++; func_i < file_queue.size(); func_i = fnext++, g_progr_fdone += std::exchange(inc_fdone, 1)) { - if (Emu.IsStopped()) +#ifdef __APPLE__ + pthread_jit_write_protect_np(false); +#endif + // Set low priority + thread_ctrl::scoped_priority low_prio(-1); + u32 inc_fdone = 1; + + for (usz func_i = fnext++; func_i < file_queue.size(); func_i = fnext++, g_progr_fdone += std::exchange(inc_fdone, 1)) { - continue; - } - - auto& [path, offset, file_size] = file_queue[func_i]; - - ppu_log.notice("Trying to load: %s", path); - - auto file_allocation = memory_limit.acquire(file_size * 2); - - // Load MSELF, SPRX or SELF - fs::file src{path}; - - if (!src) - { - ppu_log.error("Failed to open '%s' (%s)", path, fs::g_tls_error); - continue; - } - - if (u64 off = offset) - { - // Adjust offset for MSELF - src = make_file_view(std::move(src), offset, file_size); - - // Adjust path for MSELF too - fmt::append(path, "_x%x", off); - } - - for (usz i = 0;; i++) - { - if (i > decrypt_klics.size()) + if (Emu.IsStopped()) { - src.close(); - break; - } - - // Some files may fail to decrypt due to the lack of klic - u128 key = i == decrypt_klics.size() ? u128{} : decrypt_klics[i]; - - if (auto result = decrypt_self(src, i == decrypt_klics.size() ? nullptr : reinterpret_cast(&key))) - { - src = std::move(result); - break; - } - } - - if (!src && !Emu.klic.empty() && src.open(path)) - { - src = decrypt_self(src, reinterpret_cast(&Emu.klic[0])); - - if (src) - { - ppu_log.error("Possible missed KLIC for precompilation of '%s', please report to developers.", path); - - // Ignore executables larger than 500KB to prevent a long pause on exitspawn - if (src.size() >= 500000) - { - g_progr_ftotal_bits -= file_size; - - continue; - } - } - } - - if (!src) - { - ppu_log.notice("Failed to decrypt '%s'", path); - - g_progr_ftotal_bits -= file_size; - - continue; - } - - elf_error prx_err{}, ovl_err{}; - - if (ppu_prx_object obj = src; (prx_err = obj, obj == elf_error::ok)) - { - if (auto prx = ppu_load_prx(obj, true, path, offset)) - { - obj.clear(), src.close(); // Clear decrypted file and elf object memory - file_allocation = {}; // release used file memory - ppu_initialize(*prx, false, file_size, memory_limit); - ppu_finalize(*prx, true); continue; } - // Log error - prx_err = elf_error::header_type; - } + auto& [path, offset, file_size] = file_queue[func_i]; - if (ppu_exec_object obj = src; (ovl_err = obj, obj == elf_error::ok)) - { - while (ovl_err == elf_error::ok) + ppu_log.notice("Trying to load: %s", path); + + auto file_allocation = memory_limit.acquire(file_size * 2); + + // Load MSELF, SPRX or SELF + fs::file src{path}; + + if (!src) { - if (Emu.IsStopped()) + ppu_log.error("Failed to open '%s' (%s)", path, fs::g_tls_error); + continue; + } + + if (u64 off = offset) + { + // Adjust offset for MSELF + src = make_file_view(std::move(src), offset, file_size); + + // Adjust path for MSELF too + fmt::append(path, "_x%x", off); + } + + for (usz i = 0;; i++) + { + if (i > decrypt_klics.size()) { + src.close(); break; } - const auto [ovlm, error] = ppu_load_overlay(obj, true, path, offset); + // Some files may fail to decrypt due to the lack of klic + u128 key = i == decrypt_klics.size() ? u128{} : decrypt_klics[i]; - if (error) + if (auto result = decrypt_self(src, i == decrypt_klics.size() ? nullptr : reinterpret_cast(&key))) { - if (error == CELL_CANCEL + 0u) + src = std::move(result); + break; + } + } + + if (!src && !Emu.klic.empty() && src.open(path)) + { + src = decrypt_self(src, reinterpret_cast(&Emu.klic[0])); + + if (src) + { + ppu_log.error("Possible missed KLIC for precompilation of '%s', please report to developers.", path); + + // Ignore executables larger than 500KB to prevent a long pause on exitspawn + if (src.size() >= 500000) + { + g_progr_ftotal_bits -= file_size; + + continue; + } + } + } + + if (!src) + { + ppu_log.notice("Failed to decrypt '%s'", path); + + g_progr_ftotal_bits -= file_size; + + continue; + } + + elf_error prx_err{}, ovl_err{}; + + if (ppu_prx_object obj = src; (prx_err = obj, obj == elf_error::ok)) + { + if (auto prx = ppu_load_prx(obj, true, path, offset)) + { + obj.clear(), src.close(); // Clear decrypted file and elf object memory + file_allocation = {}; // release used file memory + ppu_initialize(*prx, false, file_size, memory_limit); + ppu_finalize(*prx, true); + continue; + } + + // Log error + prx_err = elf_error::header_type; + } + + if (ppu_exec_object obj = src; (ovl_err = obj, obj == elf_error::ok)) + { + while (ovl_err == elf_error::ok) + { + if (Emu.IsStopped()) + { + break; + } + + const auto [ovlm, error] = ppu_load_overlay(obj, true, path, offset); + + if (error) + { + if (error == CELL_CANCEL + 0u) + { + // Emulation stopped + break; + } + + // Abort + ovl_err = elf_error::header_type; + break; + } + + obj.clear(), src.close(); // Clear decrypted file and elf object memory + file_allocation = {}; // release used file memory + + // Participate in thread execution limitation (takes a long time) + if (std::lock_guard lock(g_fxo->get().sem); !ovlm->analyse(0, ovlm->entry, ovlm->seg0_code_end, ovlm->applied_patches, std::vector{}, []() + { + return Emu.IsStopped(); + })) { // Emulation stopped break; } - // Abort - ovl_err = elf_error::header_type; + ppu_initialize(*ovlm, false, file_size, memory_limit); + ppu_finalize(*ovlm, true); break; } - obj.clear(), src.close(); // Clear decrypted file and elf object memory - file_allocation = {}; // release used file memory - - // Participate in thread execution limitation (takes a long time) - if (std::lock_guard lock(g_fxo->get().sem); !ovlm->analyse(0, ovlm->entry, ovlm->seg0_code_end, ovlm->applied_patches, std::vector{}, []() + if (ovl_err == elf_error::ok) { - return Emu.IsStopped(); - })) - { - // Emulation stopped - break; + continue; } - - ppu_initialize(*ovlm, false, file_size, memory_limit); - ppu_finalize(*ovlm, true); - break; } - if (ovl_err == elf_error::ok) - { - continue; - } + ppu_log.notice("Failed to precompile '%s' (prx: %s, ovl: %s): Attempting compilation as executable file", path, prx_err, ovl_err); + possible_exec_file_paths.push(path, offset, file_size); + inc_fdone = 0; } - - ppu_log.notice("Failed to precompile '%s' (prx: %s, ovl: %s): Attempting compilation as executable file", path, prx_err, ovl_err); - possible_exec_file_paths.push(path, offset, file_size); - inc_fdone = 0; - } - }); + }); // Join every thread workers.join(); named_thread exec_worker("PPU Exec Worker", [&] - { - if (!possible_exec_file_paths) { - return; - } + if (!possible_exec_file_paths) + { + return; + } #ifdef __APPLE__ - pthread_jit_write_protect_np(false); + pthread_jit_write_protect_np(false); #endif - // Set low priority - thread_ctrl::scoped_priority low_prio(-1); + // Set low priority + thread_ctrl::scoped_priority low_prio(-1); - auto slice = possible_exec_file_paths.pop_all(); + auto slice = possible_exec_file_paths.pop_all(); - auto main_module = std::move(g_fxo->get>()); + auto main_module = std::move(g_fxo->get>()); - for (; slice; slice.pop_front(), g_progr_fdone++) - { - if (Emu.IsStopped()) + for (; slice; slice.pop_front(), g_progr_fdone++) { - continue; - } - - const auto& [path, _, file_size] = *slice; - - ppu_log.notice("Trying to load as executable: %s", path); - - // Load SELF - fs::file src{path}; - - if (!src) - { - ppu_log.error("Failed to open '%s' (%s)", path, fs::g_tls_error); - continue; - } - - auto file_allocation = memory_limit.acquire(file_size * 2); - - for (usz i = 0;; i++) - { - if (i > decrypt_klics.size()) - { - src.close(); - break; - } - - // Some files may fail to decrypt due to the lack of klic - u128 key = i == decrypt_klics.size() ? u128{} : decrypt_klics[i]; - - if (auto result = decrypt_self(src, i == decrypt_klics.size() ? nullptr : reinterpret_cast(&key))) - { - src = std::move(result); - break; - } - } - - if (!src && !Emu.klic.empty() && src.open(path)) - { - src = decrypt_self(src, reinterpret_cast(&Emu.klic[0])); - - if (src) - { - ppu_log.error("Possible missed KLIC for precompilation of '%s', please report to developers.", path); - } - } - - if (!src) - { - ppu_log.notice("Failed to decrypt '%s'", path); - - g_progr_ftotal_bits -= file_size; - - continue; - } - - elf_error exec_err{}; - - if (ppu_exec_object obj = src; (exec_err = obj, obj == elf_error::ok)) - { - while (exec_err == elf_error::ok) - { - main_ppu_module& _main = g_fxo->get>(); - _main = {}; - - auto current_cache = std::move(g_fxo->get()); - - if (!ppu_load_exec(obj, true, path)) - { - // Abort - exec_err = elf_error::header_type; - break; - } - - if (std::memcmp(main_module.sha1, _main.sha1, sizeof(_main.sha1)) == 0) - { - g_fxo->get() = std::move(current_cache); - break; - } - - if (!_main.analyse(0, _main.elf_entry, _main.seg0_code_end, _main.applied_patches, std::vector{}, [](){ return Emu.IsStopped(); })) - { - g_fxo->get() = std::move(current_cache); - break; - } - - obj.clear(), src.close(); // Clear decrypted file and elf object memory - file_allocation = {}; - - _main.name = ' '; // Make ppu_finalize work - Emu.ConfigurePPUCache(); - ppu_initialize(_main, false, file_size, memory_limit); - spu_cache::initialize(false); - ppu_finalize(_main, true); - _main = {}; - g_fxo->get() = std::move(current_cache); - break; - } - - if (exec_err == elf_error::ok) + if (Emu.IsStopped()) { continue; } + + const auto& [path, _, file_size] = *slice; + + ppu_log.notice("Trying to load as executable: %s", path); + + // Load SELF + fs::file src{path}; + + if (!src) + { + ppu_log.error("Failed to open '%s' (%s)", path, fs::g_tls_error); + continue; + } + + auto file_allocation = memory_limit.acquire(file_size * 2); + + for (usz i = 0;; i++) + { + if (i > decrypt_klics.size()) + { + src.close(); + break; + } + + // Some files may fail to decrypt due to the lack of klic + u128 key = i == decrypt_klics.size() ? u128{} : decrypt_klics[i]; + + if (auto result = decrypt_self(src, i == decrypt_klics.size() ? nullptr : reinterpret_cast(&key))) + { + src = std::move(result); + break; + } + } + + if (!src && !Emu.klic.empty() && src.open(path)) + { + src = decrypt_self(src, reinterpret_cast(&Emu.klic[0])); + + if (src) + { + ppu_log.error("Possible missed KLIC for precompilation of '%s', please report to developers.", path); + } + } + + if (!src) + { + ppu_log.notice("Failed to decrypt '%s'", path); + + g_progr_ftotal_bits -= file_size; + + continue; + } + + elf_error exec_err{}; + + if (ppu_exec_object obj = src; (exec_err = obj, obj == elf_error::ok)) + { + while (exec_err == elf_error::ok) + { + main_ppu_module& _main = g_fxo->get>(); + _main = {}; + + auto current_cache = std::move(g_fxo->get()); + + if (!ppu_load_exec(obj, true, path)) + { + // Abort + exec_err = elf_error::header_type; + break; + } + + if (std::memcmp(main_module.sha1, _main.sha1, sizeof(_main.sha1)) == 0) + { + g_fxo->get() = std::move(current_cache); + break; + } + + if (!_main.analyse(0, _main.elf_entry, _main.seg0_code_end, _main.applied_patches, std::vector{}, []() + { + return Emu.IsStopped(); + })) + { + g_fxo->get() = std::move(current_cache); + break; + } + + obj.clear(), src.close(); // Clear decrypted file and elf object memory + file_allocation = {}; + + _main.name = ' '; // Make ppu_finalize work + Emu.ConfigurePPUCache(); + ppu_initialize(_main, false, file_size, memory_limit); + spu_cache::initialize(false); + ppu_finalize(_main, true); + _main = {}; + g_fxo->get() = std::move(current_cache); + break; + } + + if (exec_err == elf_error::ok) + { + continue; + } + } + + ppu_log.notice("Failed to precompile '%s' as executable (%s)", path, exec_err); } - ppu_log.notice("Failed to precompile '%s' as executable (%s)", path, exec_err); - } - - g_fxo->get>() = std::move(main_module); - g_fxo->get().collect_funcs_to_precompile = true; - Emu.ConfigurePPUCache(); - }); + g_fxo->get>() = std::move(main_module); + g_fxo->get().collect_funcs_to_precompile = true; + Emu.ConfigurePPUCache(); + }); exec_worker(); } @@ -4629,7 +4615,10 @@ extern void ppu_initialize() std::optional progress_dialog(std::in_place, get_localized_string(localized_string_id::PROGRESS_DIALOG_ANALYZING_PPU_EXECUTABLE)); // Analyse executable - if (!_main.analyse(0, _main.elf_entry, _main.seg0_code_end, _main.applied_patches, std::vector{}, [](){ return Emu.IsStopped(); })) + if (!_main.analyse(0, _main.elf_entry, _main.seg0_code_end, _main.applied_patches, std::vector{}, []() + { + return Emu.IsStopped(); + })) { return; } @@ -4656,25 +4645,25 @@ extern void ppu_initialize() bool compile_fw = !Emu.IsVsh(); idm::select([&](u32, lv2_prx& _module) - { - if (_module.get_funcs().empty()) { - return; - } + if (_module.get_funcs().empty()) + { + return; + } - if (_module.path.starts_with(firmware_sprx_path)) - { - // Postpone testing - compile_fw = false; - } + if (_module.path.starts_with(firmware_sprx_path)) + { + // Postpone testing + compile_fw = false; + } - module_list.emplace_back(&_module); - }); + module_list.emplace_back(&_module); + }); idm::select([&](u32, lv2_overlay& _module) - { - module_list.emplace_back(&_module); - }); + { + module_list.emplace_back(&_module); + }); // Check preloaded libraries cache if (!compile_fw) @@ -4753,7 +4742,7 @@ extern void ppu_initialize() } } -bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size, concurent_memory_limit &memory_limit) +bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size, concurent_memory_limit& memory_limit) { if (g_cfg.core.ppu_decoder != ppu_decoder_type::llvm) { @@ -4804,25 +4793,28 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s // Link table static const std::unordered_map s_link_table = []() { - std::unordered_map link_table - { - { "sys_game_set_system_sw_version", reinterpret_cast(ppu_execute_syscall) }, - { "__trap", reinterpret_cast(&ppu_trap) }, - { "__error", reinterpret_cast(&ppu_error) }, - { "__check", reinterpret_cast(&ppu_check) }, - { "__trace", reinterpret_cast(&ppu_trace) }, - { "__syscall", reinterpret_cast(ppu_execute_syscall) }, - { "__get_tb", reinterpret_cast(get_timebased_time) }, - { "__lwarx", reinterpret_cast(ppu_lwarx) }, - { "__ldarx", reinterpret_cast(ppu_ldarx) }, - { "__stwcx", reinterpret_cast(ppu_stwcx) }, - { "__stdcx", reinterpret_cast(ppu_stdcx) }, - { "__dcbz", reinterpret_cast(+[](u32 addr){ alignas(64) static constexpr u8 z[128]{}; do_cell_atomic_128_store(addr, z); }) }, - { "__resupdate", reinterpret_cast(vm::reservation_update) }, - { "__resinterp", reinterpret_cast(ppu_reservation_fallback) }, - { "__escape", reinterpret_cast(+ppu_escape) }, - { "__read_maybe_mmio32", reinterpret_cast(+ppu_read_mmio_aware_u32) }, - { "__write_maybe_mmio32", reinterpret_cast(+ppu_write_mmio_aware_u32) }, + std::unordered_map link_table{ + {"sys_game_set_system_sw_version", reinterpret_cast(ppu_execute_syscall)}, + {"__trap", reinterpret_cast(&ppu_trap)}, + {"__error", reinterpret_cast(&ppu_error)}, + {"__check", reinterpret_cast(&ppu_check)}, + {"__trace", reinterpret_cast(&ppu_trace)}, + {"__syscall", reinterpret_cast(ppu_execute_syscall)}, + {"__get_tb", reinterpret_cast(get_timebased_time)}, + {"__lwarx", reinterpret_cast(ppu_lwarx)}, + {"__ldarx", reinterpret_cast(ppu_ldarx)}, + {"__stwcx", reinterpret_cast(ppu_stwcx)}, + {"__stdcx", reinterpret_cast(ppu_stdcx)}, + {"__dcbz", reinterpret_cast(+[](u32 addr) + { + alignas(64) static constexpr u8 z[128]{}; + do_cell_atomic_128_store(addr, z); + })}, + {"__resupdate", reinterpret_cast(vm::reservation_update)}, + {"__resinterp", reinterpret_cast(ppu_reservation_fallback)}, + {"__escape", reinterpret_cast(+ppu_escape)}, + {"__read_maybe_mmio32", reinterpret_cast(+ppu_read_mmio_aware_u32)}, + {"__write_maybe_mmio32", reinterpret_cast(+ppu_write_mmio_aware_u32)}, }; for (u64 index = 0; index < 1024; index++) @@ -4990,7 +4982,10 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s return +code_ptr; } - [[maybe_unused]] constexpr auto abs_diff = [](u64 a, u64 b) { return a <= b ? b - a : a - b; }; + [[maybe_unused]] constexpr auto abs_diff = [](u64 a, u64 b) + { + return a <= b ? b - a : a - b; + }; [[maybe_unused]] auto write_le = [](u8*& code, auto value) { @@ -5099,75 +5094,76 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s usz code_size_until_jump = umax; - auto func = build_function_asm(name, [&](native_asm& c, auto& /*args*/) - { + auto func = build_function_asm(name, [&](native_asm& c, auto& /*args*/) + { #if defined(ARCH_X64) - c.mov(x86::edx, func_addr - seg0); // Load PC + c.mov(x86::edx, func_addr - seg0); // Load PC - const auto buf_start = reinterpret_cast(c.bufferData()); - const auto buf_end = reinterpret_cast(c.bufferPtr()); + const auto buf_start = reinterpret_cast(c.bufferData()); + const auto buf_end = reinterpret_cast(c.bufferPtr()); - code_size_until_jump = buf_end - buf_start; + code_size_until_jump = buf_end - buf_start; - c.add(x86::edx, seg0); - c.mov(x86::rax, x86::qword_ptr(reinterpret_cast(&vm::g_exec_addr))); - c.mov(x86::dword_ptr(x86::rbp, ::offset32(&ppu_thread::cia)), x86::edx); + c.add(x86::edx, seg0); + c.mov(x86::rax, x86::qword_ptr(reinterpret_cast(&vm::g_exec_addr))); + c.mov(x86::dword_ptr(x86::rbp, ::offset32(&ppu_thread::cia)), x86::edx); - c.mov(x86::rax, x86::qword_ptr(x86::rax, x86::rdx, 1, 0)); // Load call target - c.mov(x86::rdx, x86::rax); - c.shl(x86::rax, 16); - c.shr(x86::rax, 16); - c.shr(x86::rdx, 48); - c.shl(x86::edx, 13); - c.mov(x86::r12d, x86::edx); // Load relocation base - c.jmp(x86::rax); + c.mov(x86::rax, x86::qword_ptr(x86::rax, x86::rdx, 1, 0)); // Load call target + c.mov(x86::rdx, x86::rax); + c.shl(x86::rax, 16); + c.shr(x86::rax, 16); + c.shr(x86::rdx, 48); + c.shl(x86::edx, 13); + c.mov(x86::r12d, x86::edx); // Load relocation base + c.jmp(x86::rax); #else - // Load REG_Base - use absolute jump target to bypass rel jmp range limits - // X19 contains vm::g_exec_addr - const arm::GpX exec_addr = a64::x19; + // Load REG_Base - use absolute jump target to bypass rel jmp range limits + // X19 contains vm::g_exec_addr + const arm::GpX exec_addr = a64::x19; - // X20 contains ppu_thread* - const arm::GpX ppu_t_base = a64::x20; + // X20 contains ppu_thread* + const arm::GpX ppu_t_base = a64::x20; - // Load PC - const arm::GpX pc = a64::x15; - const arm::GpX cia_addr_reg = a64::x11; + // Load PC + const arm::GpX pc = a64::x15; + const arm::GpX cia_addr_reg = a64::x11; - // Load CIA - c.mov(pc.w(), func_addr); + // Load CIA + c.mov(pc.w(), func_addr); - const auto buf_start = reinterpret_cast(c.bufferData()); - const auto buf_end = reinterpret_cast(c.bufferPtr()); + const auto buf_start = reinterpret_cast(c.bufferData()); + const auto buf_end = reinterpret_cast(c.bufferPtr()); - code_size_until_jump = buf_end - buf_start; + code_size_until_jump = buf_end - buf_start; - // Load offset value - c.mov(cia_addr_reg, static_cast(::offset32(&ppu_thread::cia))); + // Load offset value + c.mov(cia_addr_reg, static_cast(::offset32(&ppu_thread::cia))); - // Update CIA - c.str(pc.w(), arm::Mem(ppu_t_base, cia_addr_reg)); + // Update CIA + c.str(pc.w(), arm::Mem(ppu_t_base, cia_addr_reg)); - // Multiply by 2 to index into ptr table - c.add(pc, pc, pc); + // Multiply by 2 to index into ptr table + c.add(pc, pc, pc); - // Load call target - const arm::GpX call_target = a64::x13; - c.ldr(call_target, arm::Mem(exec_addr, pc)); + // Load call target + const arm::GpX call_target = a64::x13; + c.ldr(call_target, arm::Mem(exec_addr, pc)); - // Compute REG_Hp - const arm::GpX reg_hp = a64::x21; - c.mov(reg_hp, call_target); - c.lsr(reg_hp, reg_hp, 48); - c.lsl(reg_hp.w(), reg_hp.w(), 13); + // Compute REG_Hp + const arm::GpX reg_hp = a64::x21; + c.mov(reg_hp, call_target); + c.lsr(reg_hp, reg_hp, 48); + c.lsl(reg_hp.w(), reg_hp.w(), 13); - // Zero top 16 bits of call target - c.lsl(call_target, call_target, 16); - c.lsr(call_target, call_target, 16); + // Zero top 16 bits of call target + c.lsl(call_target, call_target, 16); + c.lsr(call_target, call_target, 16); - // Execute LLE call - c.br(call_target); + // Execute LLE call + c.br(call_target); #endif - }, runtime.get(), true); + }, + runtime.get(), true); // Full sample may exist already, but is very far away // So in this case, a new sample is written @@ -5347,11 +5343,14 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s std::vector> addrs; - constexpr auto compare = [](const ppu_function& a, u32 addr) { return a.addr < addr; }; + constexpr auto compare = [](const ppu_function& a, u32 addr) + { + return a.addr < addr; + }; const auto start = std::lower_bound(info.funcs.begin(), info.funcs.end(), local_jit_bounds->first, compare); - std::span span_range{ start, std::lower_bound(start, info.funcs.end(), local_jit_bounds->second, compare) }; + std::span span_range{start, std::lower_bound(start, info.funcs.end(), local_jit_bounds->second, compare)}; for (const ppu_function& func : span_range) { @@ -5371,7 +5370,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s sha1_update(&ctx, reinterpret_cast(addrs.data()), addrs.size() * sizeof(be_t)); } - part.jit_bounds = std::move(local_jit_bounds); + part.jit_bounds = std::move(local_jit_bounds); local_jit_bounds = std::make_shared>(u32{umax}, 0); } @@ -5500,7 +5499,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s struct thread_op { - concurent_memory_limit &memory_limit; + concurent_memory_limit& memory_limit; atomic_t& work_cv; std::vector>>& workload; const ppu_module& main_module; @@ -5509,27 +5508,16 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s std::unique_lock core_lock; - thread_op(concurent_memory_limit &memory_limit, atomic_t& work_cv, std::vector>>& workload - , const cpu_thread* cpu, const ppu_module& main_module, const std::string& cache_path, decltype(jit_core_allocator::sem)& sem) noexcept + thread_op(concurent_memory_limit& memory_limit, atomic_t& work_cv, std::vector>>& workload, const cpu_thread* cpu, const ppu_module& main_module, const std::string& cache_path, decltype(jit_core_allocator::sem)& sem) noexcept - : memory_limit(memory_limit) - , work_cv(work_cv) - , workload(workload) - , main_module(main_module) - , cache_path(cache_path) - , cpu(cpu) + : memory_limit(memory_limit), work_cv(work_cv), workload(workload), main_module(main_module), cache_path(cache_path), cpu(cpu) { // Save mutex core_lock = std::unique_lock{sem, std::defer_lock}; } thread_op(const thread_op& other) noexcept - : memory_limit(other.memory_limit) - , work_cv(other.work_cv) - , workload(other.workload) - , main_module(other.main_module) - , cache_path(other.cache_path) - , cpu(other.cpu) + : memory_limit(other.memory_limit), work_cv(other.work_cv), workload(other.workload), main_module(other.main_module), cache_path(other.cache_path), cpu(other.cpu) { if (auto mtx = other.core_lock.mutex()) { @@ -5545,9 +5533,9 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s // Set low priority thread_ctrl::scoped_priority low_prio(-1); - #ifdef __APPLE__ +#ifdef __APPLE__ pthread_jit_write_protect_np(false); - #endif +#endif for (u32 i = work_cv++; i < workload.size(); i = work_cv++, g_progr_pdone++) { if (cpu ? cpu->state.all_of(cpu_flag::exit) : Emu.IsStopped()) @@ -5558,9 +5546,8 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s // Keep allocating workload const auto& [obj_name, part] = std::as_const(workload)[i]; - std::size_t total_fn_size = 0; - for (auto &fn : part.get_funcs()) + for (auto& fn : part.get_funcs()) { total_fn_size += fn.size; } @@ -5599,16 +5586,14 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s // Prevent watchdog thread from terminating g_watchdog_hold_ctr++; - named_thread_group threads(fmt::format("PPUW.%u.", ++g_fxo->get().index), thread_count - , thread_op(memory_limit, work_cv, workload, cpu, info, cache_path, g_fxo->get().sem) - , [&](u32 /*thread_index*/, thread_op& op) - { - // Allocate "core" - op.core_lock.lock(); + named_thread_group threads(fmt::format("PPUW.%u.", ++g_fxo->get().index), thread_count, thread_op(memory_limit, work_cv, workload, cpu, info, cache_path, g_fxo->get().sem), [&](u32 /*thread_index*/, thread_op& op) + { + // Allocate "core" + op.core_lock.lock(); - // Second check before creating another thread - return work_cv < workload.size() && (cpu ? !cpu->state.all_of(cpu_flag::exit) : !Emu.IsStopped()); - }); + // Second check before creating another thread + return work_cv < workload.size() && (cpu ? !cpu->state.all_of(cpu_flag::exit) : !Emu.IsStopped()); + }); threads.join(); @@ -5725,7 +5710,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s { index++; - sim = ensure(!is_first ? sim : reinterpret_cast(jits[index]->get("__resolve_symbols"))); + sim = ensure(!is_first ? sim : reinterpret_cast(jits[index]->get("__resolve_symbols"))); sim(vm::g_exec_addr, info.segs[0].addr); } } @@ -5798,14 +5783,15 @@ static void ppu_initialize2(jit_compiler& jit, const ppu_module& module // Define some types const auto _func = FunctionType::get(translator.get_type(), { - translator.get_type(), // Exec base - translator.GetContextType()->getPointerTo(), // PPU context - translator.get_type(), // Segment address (for PRX) - translator.get_type(), // Memory base - translator.get_type(), // r0 - translator.get_type(), // r1 - translator.get_type(), // r2 - }, false); + translator.get_type(), // Exec base + translator.GetContextType()->getPointerTo(), // PPU context + translator.get_type(), // Segment address (for PRX) + translator.get_type(), // Memory base + translator.get_type(), // r0 + translator.get_type(), // r1 + translator.get_type(), // r2 + }, + false); // Difference between function name and current location const u32 reloc = module_part.is_relocatable ? ::at32(module_part.segs, 0).addr : 0; @@ -5879,7 +5865,7 @@ static void ppu_initialize2(jit_compiler& jit, const ppu_module& module if ([[maybe_unused]] const auto func = translator.Translate(mod_func)) { #ifdef ARCH_X64 // TODO - // Run optimization passes + // Run optimization passes fpm.run(*func, fam); #endif // ARCH_X64 } @@ -5897,7 +5883,7 @@ static void ppu_initialize2(jit_compiler& jit, const ppu_module& module if ([[maybe_unused]] const auto func = translator.GetSymbolResolver(module_part)) { #ifdef ARCH_X64 // TODO - // Run optimization passes + // Run optimization passes fpm.run(*func, fam); #endif // ARCH_X64 } @@ -5908,13 +5894,13 @@ static void ppu_initialize2(jit_compiler& jit, const ppu_module& module } } - //legacy::PassManager mpm; + // legacy::PassManager mpm; // Remove unused functions, structs, global variables, etc - //mpm.add(createStripDeadPrototypesPass()); - //mpm.add(createFunctionInliningPass()); - //mpm.add(createDeadInstEliminationPass()); - //mpm.run(*module); + // mpm.add(createStripDeadPrototypesPass()); + // mpm.add(createFunctionInliningPass()); + // mpm.add(createDeadInstEliminationPass()); + // mpm.run(*module); #ifndef ANDROID std::string result; raw_string_ostream out(result); @@ -5930,7 +5916,10 @@ static void ppu_initialize2(jit_compiler& jit, const ppu_module& module { out.flush(); ppu_log.error("LLVM: Verification failed for %s:\n%s", obj_name, result); - Emu.CallFromMainThread([]{ Emu.GracefulShutdown(false, true); }); + Emu.CallFromMainThread([] + { + Emu.GracefulShutdown(false, true); + }); return; } #endif diff --git a/rpcs3/rpcs3/Emu/Cell/PPUThread.h b/rpcs3/rpcs3/Emu/Cell/PPUThread.h index 322cc13eb..bd4928c82 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUThread.h +++ b/rpcs3/rpcs3/Emu/Cell/PPUThread.h @@ -15,14 +15,14 @@ enum class ppu_cmd : u32 { null, - opcode, // Execute PPU instruction from arg - set_gpr, // Set gpr[arg] (+1 cmd) - set_args, // Set general-purpose args (+arg cmd) - lle_call, // Load addr and rtoc at *arg or *gpr[arg] and execute - hle_call, // Execute function by index (arg) - ptr_call, // Execute function by pointer - opd_call, // Execute function by provided rtoc and address (unlike lle_call, does not read memory) - cia_call, // Execute from current CIA, mo GPR modification applied + opcode, // Execute PPU instruction from arg + set_gpr, // Set gpr[arg] (+1 cmd) + set_args, // Set general-purpose args (+arg cmd) + lle_call, // Load addr and rtoc at *arg or *gpr[arg] and execute + hle_call, // Execute function by index (arg) + ptr_call, // Execute function by pointer + opd_call, // Execute function by provided rtoc and address (unlike lle_call, does not read memory) + cia_call, // Execute from current CIA, mo GPR modification applied entry_call, // Load addr and rtoc from entry_func initialize, // ppu_initialize() sleep, @@ -174,7 +174,7 @@ public: u8 bits[32]; u32 fields[8]; - u8& operator [](usz i) + u8& operator[](usz i) { return bits[i]; } @@ -222,13 +222,12 @@ public: u32 fields[8]; cr_bits bits; - } - fpscr{}; + } fpscr{}; - u64 lr{}; // Link Register - u64 ctr{}; // Counter Register + u64 lr{}; // Link Register + u64 ctr{}; // Counter Register u32 vrsave{0xffffffff}; // VR Save Register - u32 cia{}; // Current Instruction Address + u32 cia{}; // Current Instruction Address // Fixed-Point Exception Register (abstract representation) struct @@ -239,18 +238,17 @@ public: bool ov{}; // Overflow bool ca{}; // Carry u8 cnt{}; // 0..6 - } - xer; + } xer; /* - Non-Java. A mode control bit that determines whether vector floating-point operations will be performed - in a Java-IEEE-C9X-compliant mode or a possibly faster non-Java/non-IEEE mode. - 0 The Java-IEEE-C9X-compliant mode is selected. Denormalized values are handled as specified - by Java, IEEE, and C9X standard. - 1 The non-Java/non-IEEE-compliant mode is selected. If an element in a source vector register - contains a denormalized value, the value '0' is used instead. If an instruction causes an underflow - exception, the corresponding element in the target vr is cleared to '0'. In both cases, the '0' - has the same sign as the denormalized or underflowing value. + Non-Java. A mode control bit that determines whether vector floating-point operations will be performed + in a Java-IEEE-C9X-compliant mode or a possibly faster non-Java/non-IEEE mode. + 0 The Java-IEEE-C9X-compliant mode is selected. Denormalized values are handled as specified + by Java, IEEE, and C9X standard. + 1 The non-Java/non-IEEE-compliant mode is selected. If an element in a source vector register + contains a denormalized value, the value '0' is used instead. If an instruction causes an underflow + exception, the corresponding element in the target vr is cleared to '0'. In both cases, the '0' + has the same sign as the denormalized or underflowing value. */ bool nj = true; @@ -271,8 +269,8 @@ public: union ppu_prio_t { u64 all; - bf_t prio; // Thread priority (0..3071) (firs 12-bits) - bf_t order; // Thread enqueue order (last 52-bits) + bf_t prio; // Thread priority (0..3071) (firs 12-bits) + bf_t order; // Thread enqueue order (last 52-bits) bf_t preserve_bit; // Preserve value for savestates }; @@ -281,7 +279,7 @@ public: const u32 stack_addr; // Stack address atomic_t joiner; // Joining thread or status - u32 hw_sleep_time = 0; // Very specific delay for hardware threads switching, see lv2_obj::awake_unlocked for more details + u32 hw_sleep_time = 0; // Very specific delay for hardware threads switching, see lv2_obj::awake_unlocked for more details lf_fifo, 127> cmd_queue; // Command queue for asynchronous operations. @@ -289,17 +287,20 @@ public: void cmd_list(std::initializer_list); void cmd_pop(u32 = 0); cmd64 cmd_wait(); // Empty command means caller must return, like true from cpu_thread::check_status(). - cmd64 cmd_get(u32 index) { return cmd_queue[cmd_queue.peek() + index].load(); } + cmd64 cmd_get(u32 index) + { + return cmd_queue[cmd_queue.peek() + index].load(); + } atomic_t cmd_notify = 0; alignas(64) const ppu_func_opd_t entry_func; - u64 start_time{0}; // Sleep start timepoint - u64 end_time{umax}; // Sleep end timepoint - s32 cancel_sleep{0}; // Flag to cancel the next lv2_obj::sleep call (when equals 2) - u64 syscall_args[8]{0}; // Last syscall arguments stored + u64 start_time{0}; // Sleep start timepoint + u64 end_time{umax}; // Sleep end timepoint + s32 cancel_sleep{0}; // Flag to cancel the next lv2_obj::sleep call (when equals 2) + u64 syscall_args[8]{0}; // Last syscall arguments stored const char* current_function{}; // Current function name for diagnosis, optimized for speed. - const char* last_function{}; // Sticky copy of current_function, is not cleared on function return - const char* current_module{}; // Current module name, for savestates. + const char* last_function{}; // Sticky copy of current_function, is not cleared on function return + const char* current_module{}; // Current module name, for savestates. const bool is_interrupt_thread; // True for interrupts-handler threads @@ -361,11 +362,11 @@ public: const ppu_thread* _this; operator std::string() const; - } thread_name{ this }; + } thread_name{this}; // For savestates bool stop_flag_removal_protection = false; // If set, Emulator::Run won't remove stop flag - bool loaded_from_savestate = false; // Indicates the thread had just started straight from savestate load + bool loaded_from_savestate = false; // Indicates the thread had just started straight from savestate load std::shared_ptr optional_savestate_state; bool interrupt_thread_executing = false; @@ -463,7 +464,7 @@ struct ppu_gpr_cast_impl } }; -template +template inline To ppu_gpr_cast(const From& value) { return ppu_gpr_cast_impl::from(ppu_gpr_cast_impl::to(value)); diff --git a/rpcs3/rpcs3/Emu/Cell/PPUTranslator.cpp b/rpcs3/rpcs3/Emu/Cell/PPUTranslator.cpp index 8962cc284..18620d477 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUTranslator.cpp +++ b/rpcs3/rpcs3/Emu/Cell/PPUTranslator.cpp @@ -29,9 +29,7 @@ extern const ppu_decoder g_ppu_itype; extern const ppu_decoder g_ppu_iname; PPUTranslator::PPUTranslator(LLVMContext& context, Module* _module, const ppu_module& info, ExecutionEngine& engine) - : cpu_translator(_module, false) - , m_info(info) - , m_pure_attr() + : cpu_translator(_module, false), m_info(info), m_pure_attr() { // Bind context cpu_translator::initialize(context, engine); @@ -44,10 +42,10 @@ PPUTranslator::PPUTranslator(LLVMContext& context, Module* _module, const ppu_mo // Base reg table definition // Assume all functions named __0x... are PPU functions and take the m_exec as the first arg std::vector> base_reg_lookup = { - { "__0x", aarch64::x20 }, // PPU blocks - { "__indirect", aarch64::x20 }, // Indirect jumps - { "ppu_", aarch64::x19 }, // Fixed JIT helpers (e.g ppu_gateway) - { "__", aarch64::x19 } // Probably link table entries + {"__0x", aarch64::x20}, // PPU blocks + {"__indirect", aarch64::x20}, // Indirect jumps + {"ppu_", aarch64::x19}, // Fixed JIT helpers (e.g ppu_gateway) + {"__", aarch64::x19} // Probably link table entries }; // Build list of imposter functions built by the patch manager. @@ -59,14 +57,13 @@ PPUTranslator::PPUTranslator(LLVMContext& context, Module* _module, const ppu_mo } aarch64::GHC_frame_preservation_pass::config_t config = - { - .debug_info = false, // Set to "true" to insert debug frames on x27 - .use_stack_frames = false, // We don't need this since the PPU GW allocates global scratch on the stack - .hypervisor_context_offset = ::offset32(&ppu_thread::hv_ctx), - .exclusion_callback = {}, // Unused, we don't have special exclusion functions on PPU - .base_register_lookup = base_reg_lookup, - .faux_function_list = std::move(faux_functions_list) - }; + { + .debug_info = false, // Set to "true" to insert debug frames on x27 + .use_stack_frames = false, // We don't need this since the PPU GW allocates global scratch on the stack + .hypervisor_context_offset = ::offset32(&ppu_thread::hv_ctx), + .exclusion_callback = {}, // Unused, we don't have special exclusion functions on PPU + .base_register_lookup = base_reg_lookup, + .faux_function_list = std::move(faux_functions_list)}; // Create transform pass std::unique_ptr ghc_fixup_pass = std::make_unique(config); @@ -85,19 +82,19 @@ PPUTranslator::PPUTranslator(LLVMContext& context, Module* _module, const ppu_mo thread_struct.emplace_back(ArrayType::get(GetType(), off0)); thread_struct.emplace_back(GetType()); // state thread_struct.emplace_back(ArrayType::get(GetType(), off1 - off0 - 4)); - thread_struct.insert(thread_struct.end(), 32, GetType()); // gpr[0..31] - thread_struct.insert(thread_struct.end(), 32, GetType()); // fpr[0..31] + thread_struct.insert(thread_struct.end(), 32, GetType()); // gpr[0..31] + thread_struct.insert(thread_struct.end(), 32, GetType()); // fpr[0..31] thread_struct.insert(thread_struct.end(), 32, GetType()); // vr[0..31] - thread_struct.insert(thread_struct.end(), 32, GetType()); // cr[0..31] - thread_struct.insert(thread_struct.end(), 32, GetType()); // fpscr - thread_struct.insert(thread_struct.end(), 2, GetType()); // lr, ctr - thread_struct.insert(thread_struct.end(), 2, GetType()); // vrsave, cia - thread_struct.insert(thread_struct.end(), 3, GetType()); // so, ov, ca - thread_struct.insert(thread_struct.end(), 1, GetType()); // cnt - thread_struct.insert(thread_struct.end(), 1, GetType()); // nj - thread_struct.emplace_back(ArrayType::get(GetType(), 3)); // Padding - thread_struct.insert(thread_struct.end(), 1, GetType()); // sat - thread_struct.insert(thread_struct.end(), 1, GetType()); // jm_mask + thread_struct.insert(thread_struct.end(), 32, GetType()); // cr[0..31] + thread_struct.insert(thread_struct.end(), 32, GetType()); // fpscr + thread_struct.insert(thread_struct.end(), 2, GetType()); // lr, ctr + thread_struct.insert(thread_struct.end(), 2, GetType()); // vrsave, cia + thread_struct.insert(thread_struct.end(), 3, GetType()); // so, ov, ca + thread_struct.insert(thread_struct.end(), 1, GetType()); // cnt + thread_struct.insert(thread_struct.end(), 1, GetType()); // nj + thread_struct.emplace_back(ArrayType::get(GetType(), 3)); // Padding + thread_struct.insert(thread_struct.end(), 1, GetType()); // sat + thread_struct.insert(thread_struct.end(), 1, GetType()); // jm_mask m_thread_type = StructType::create(m_context, thread_struct, "context_t"); @@ -125,14 +122,14 @@ PPUTranslator::PPUTranslator(LLVMContext& context, Module* _module, const ppu_mo // Comment out types we haven't confirmed as used and working case 10: case 11: - // case 12: - // case 13: - // case 26: - // case 28: - { - ppu_log.notice("Ignoring relative relocation at 0x%x (%u)", rel.addr, rel.type); - continue; - } + // case 12: + // case 13: + // case 26: + // case 28: + { + ppu_log.notice("Ignoring relative relocation at 0x%x (%u)", rel.addr, rel.type); + continue; + } // Ignore 64-bit relocations case 20: @@ -240,7 +237,7 @@ Function* PPUTranslator::Translate(const ppu_function& info) const auto body = BasicBlock::Create(m_context, "__body", m_function); - //Call(GetType(), "__trace", GetAddr()); + // Call(GetType(), "__trace", GetAddr()); if (need_check) { // Check status register in the entry block @@ -327,7 +324,7 @@ Function* PPUTranslator::GetSymbolResolver(const ppu_module& info) ensure(m_module->getFunction("__resolve_symbols") == nullptr); ensure(info.jit_bounds); - m_function = cast(m_module->getOrInsertFunction("__resolve_symbols", FunctionType::get(get_type(), { get_type(), get_type() }, false)).getCallee()); + m_function = cast(m_module->getOrInsertFunction("__resolve_symbols", FunctionType::get(get_type(), {get_type(), get_type()}, false)).getCallee()); IRBuilder<> irb(BasicBlock::Create(m_context, "__entry", m_function)); m_ir = &irb; @@ -339,14 +336,15 @@ Function* PPUTranslator::GetSymbolResolver(const ppu_module& info) m_seg0 = m_function->getArg(1); const auto ftype = FunctionType::get(get_type(), { - get_type(), // Exec base - GetContextType()->getPointerTo(), // PPU context - get_type(), // Segment address (for PRX) - get_type(), // Memory base - get_type(), // r0 - get_type(), // r1 - get_type(), // r2 - }, false); + get_type(), // Exec base + GetContextType()->getPointerTo(), // PPU context + get_type(), // Segment address (for PRX) + get_type(), // Memory base + get_type(), // r0 + get_type(), // r1 + get_type(), // r2 + }, + false); // Store function addresses in PPU jumptable using internal resolving instead of patching it externally. // Because, LLVM processed it extremely slow. (regression) @@ -750,7 +748,8 @@ Value* PPUTranslator::Shuffle(Value* left, Value* right, std::initializer_list data; data.reserve(indices.size()); + std::vector data; + data.reserve(indices.size()); const u32 mask = cast(type)->getNumElements() - 1; @@ -763,7 +762,7 @@ Value* PPUTranslator::Shuffle(Value* left, Value* right, std::initializer_listCreateShuffleVector(left, right, ConstantDataVector::get(m_context, data)); } - return m_ir->CreateShuffleVector(left, right, ConstantDataVector::get(m_context, { indices.begin(), indices.end() })); + return m_ir->CreateShuffleVector(left, right, ConstantDataVector::get(m_context, {indices.begin(), indices.end()})); } Value* PPUTranslator::SExt(Value* value, Type* type) @@ -945,7 +944,6 @@ void PPUTranslator::CompilationError(const std::string& error) ppu_log.error("LLVM: [0x%08x] Error: %s", m_addr + (m_reloc ? m_reloc->addr : 0), error); } - void PPUTranslator::MFVSCR(ppu_opcode_t op) { const auto vsat = g_cfg.core.ppu_set_sat_bit ? ZExt(IsNotZero(RegLoad(m_sat)), GetType()) : m_ir->getInt32(0); @@ -1109,7 +1107,8 @@ void PPUTranslator::VCMPBFP(ppu_opcode_t op) const auto nge = sext(fcmp_uno(a < -b)) & 0x4000'0000; const auto r = eval(nle | nge); set_vr(op.vd, r); - if (op.oe) SetCrField(6, m_ir->getFalse(), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, m_ir->getFalse(), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCMPEQFP(ppu_opcode_t op) @@ -1117,7 +1116,8 @@ void PPUTranslator::VCMPEQFP(ppu_opcode_t op) const auto [a, b] = get_vrs(op.va, op.vb); const auto r = eval(sext(fcmp_ord(a == b))); set_vr(op.vd, r); - if (op.oe) SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCMPEQUB(ppu_opcode_t op) @@ -1125,7 +1125,8 @@ void PPUTranslator::VCMPEQUB(ppu_opcode_t op) const auto [a, b] = get_vrs(op.va, op.vb); const auto r = eval(sext(a == b)); set_vr(op.vd, r); - if (op.oe) SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCMPEQUH(ppu_opcode_t op) @@ -1133,7 +1134,8 @@ void PPUTranslator::VCMPEQUH(ppu_opcode_t op) const auto [a, b] = get_vrs(op.va, op.vb); const auto r = eval(sext(a == b)); set_vr(op.vd, r); - if (op.oe) SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCMPEQUW(ppu_opcode_t op) @@ -1141,7 +1143,8 @@ void PPUTranslator::VCMPEQUW(ppu_opcode_t op) const auto [a, b] = get_vrs(op.va, op.vb); const auto r = eval(sext(a == b)); set_vr(op.vd, r); - if (op.oe) SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCMPGEFP(ppu_opcode_t op) @@ -1149,7 +1152,8 @@ void PPUTranslator::VCMPGEFP(ppu_opcode_t op) const auto [a, b] = get_vrs(op.va, op.vb); const auto r = eval(sext(fcmp_ord(a >= b))); set_vr(op.vd, r); - if (op.oe) SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCMPGTFP(ppu_opcode_t op) @@ -1157,7 +1161,8 @@ void PPUTranslator::VCMPGTFP(ppu_opcode_t op) const auto [a, b] = get_vrs(op.va, op.vb); const auto r = eval(sext(fcmp_ord(a > b))); set_vr(op.vd, r); - if (op.oe) SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCMPGTSB(ppu_opcode_t op) @@ -1165,7 +1170,8 @@ void PPUTranslator::VCMPGTSB(ppu_opcode_t op) const auto [a, b] = get_vrs(op.va, op.vb); const auto r = eval(sext(a > b)); set_vr(op.vd, r); - if (op.oe) SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCMPGTSH(ppu_opcode_t op) @@ -1173,7 +1179,8 @@ void PPUTranslator::VCMPGTSH(ppu_opcode_t op) const auto [a, b] = get_vrs(op.va, op.vb); const auto r = eval(sext(a > b)); set_vr(op.vd, r); - if (op.oe) SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCMPGTSW(ppu_opcode_t op) @@ -1181,7 +1188,8 @@ void PPUTranslator::VCMPGTSW(ppu_opcode_t op) const auto [a, b] = get_vrs(op.va, op.vb); const auto r = eval(sext(a > b)); set_vr(op.vd, r); - if (op.oe) SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCMPGTUB(ppu_opcode_t op) @@ -1189,7 +1197,8 @@ void PPUTranslator::VCMPGTUB(ppu_opcode_t op) const auto [a, b] = get_vrs(op.va, op.vb); const auto r = eval(sext(a > b)); set_vr(op.vd, r); - if (op.oe) SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCMPGTUH(ppu_opcode_t op) @@ -1197,7 +1206,8 @@ void PPUTranslator::VCMPGTUH(ppu_opcode_t op) const auto [a, b] = get_vrs(op.va, op.vb); const auto r = eval(sext(a > b)); set_vr(op.vd, r); - if (op.oe) SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCMPGTUW(ppu_opcode_t op) @@ -1205,7 +1215,8 @@ void PPUTranslator::VCMPGTUW(ppu_opcode_t op) const auto [a, b] = get_vrs(op.va, op.vb); const auto r = eval(sext(a > b)); set_vr(op.vd, r); - if (op.oe) SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); + if (op.oe) + SetCrField(6, IsOnes(r.value), m_ir->getFalse(), IsZero(r.value), m_ir->getFalse()); } void PPUTranslator::VCTSXS(ppu_opcode_t op) @@ -1218,7 +1229,7 @@ void PPUTranslator::VCTSXS(ppu_opcode_t op) const auto sat_h = fcmp_ord(scaled >= fsplat(std::pow(2, 31))); value_t converted = eval(fpcast(select(sat_l, const1, scaled))); if (g_cfg.core.ppu_fix_vnan) - converted = eval(select(is_nan, splat(0), converted)); // NaN -> 0 + converted = eval(select(is_nan, splat(0), converted)); // NaN -> 0 set_vr(op.vd, select(sat_h, splat(0x7fff'ffff), converted)); set_sat(sext(sat_l) | sext(sat_h)); } @@ -1785,7 +1796,6 @@ void PPUTranslator::VSEL(ppu_opcode_t op) return; } - bool sel_8 = true; for (u32 i = 0; i < 16; i++) { @@ -1798,7 +1808,7 @@ void PPUTranslator::VSEL(ppu_opcode_t op) if (sel_8) { - set_vr(op.vd, select(bitcast(c) != 0,get_vr(op.vb), get_vr(op.va))); + set_vr(op.vd, select(bitcast(c) != 0, get_vr(op.vb), get_vr(op.va))); return; } } @@ -2189,7 +2199,8 @@ void PPUTranslator::ADDIC(ppu_opcode_t op) const auto result = m_ir->CreateAdd(a, imm); SetGpr(op.rd, result); SetCarry(m_ir->CreateICmpULT(result, imm)); - if (op.main & 1) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.main & 1) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::ADDI(ppu_opcode_t op) @@ -2257,14 +2268,14 @@ void PPUTranslator::SC(ppu_opcode_t op) if (index < 1024) { Call(GetType(), fmt::format("%s", ppu_syscall_code(index)), m_thread); - //Call(GetType(), "__escape", m_thread)->setTailCall(); + // Call(GetType(), "__escape", m_thread)->setTailCall(); m_ir->CreateRetVoid(); return; } } Call(GetType(), op.lev ? "__lv1call" : "__syscall", m_thread, num); - //Call(GetType(), "__escape", m_thread)->setTailCall(); + // Call(GetType(), "__escape", m_thread)->setTailCall(); m_ir->CreateRetVoid(); } @@ -2424,7 +2435,8 @@ void PPUTranslator::RLWIMI(ppu_opcode_t op) } SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::RLWINM(ppu_opcode_t op) @@ -2475,7 +2487,8 @@ void PPUTranslator::RLWINM(ppu_opcode_t op) } SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::RLWNM(ppu_opcode_t op) @@ -2506,7 +2519,8 @@ void PPUTranslator::RLWNM(ppu_opcode_t op) } SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::ORI(ppu_opcode_t op) @@ -2583,7 +2597,8 @@ void PPUTranslator::RLDICL(ppu_opcode_t op) } SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::RLDICR(ppu_opcode_t op) @@ -2610,7 +2625,8 @@ void PPUTranslator::RLDICR(ppu_opcode_t op) } SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::RLDIC(ppu_opcode_t op) @@ -2636,7 +2652,8 @@ void PPUTranslator::RLDIC(ppu_opcode_t op) } SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::RLDIMI(ppu_opcode_t op) @@ -2668,7 +2685,8 @@ void PPUTranslator::RLDIMI(ppu_opcode_t op) } SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::RLDCL(ppu_opcode_t op) @@ -2678,7 +2696,8 @@ void PPUTranslator::RLDCL(ppu_opcode_t op) const auto result = m_ir->CreateAnd(RotateLeft(GetGpr(op.rs), GetGpr(op.rb)), mask); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::RLDCR(ppu_opcode_t op) @@ -2688,7 +2707,8 @@ void PPUTranslator::RLDCR(ppu_opcode_t op) const auto result = m_ir->CreateAnd(RotateLeft(GetGpr(op.rs), GetGpr(op.rb)), mask); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::CMP(ppu_opcode_t op) @@ -2728,8 +2748,10 @@ void PPUTranslator::SUBFC(ppu_opcode_t op) const auto result = m_ir->CreateSub(b, a); SetGpr(op.rd, result); SetCarry(m_ir->CreateICmpULE(result, b)); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); - if (op.oe) UNK(op); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.oe) + UNK(op); } void PPUTranslator::ADDC(ppu_opcode_t op) @@ -2739,12 +2761,13 @@ void PPUTranslator::ADDC(ppu_opcode_t op) const auto result = m_ir->CreateAdd(a, b); SetGpr(op.rd, result); SetCarry(m_ir->CreateICmpULT(result, b)); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); if (op.oe) { - //const auto s = m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::sadd_with_overflow), {a, b}); - //SetOverflow(m_ir->CreateExtractValue(s, {1})); + // const auto s = m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::sadd_with_overflow), {a, b}); + // SetOverflow(m_ir->CreateExtractValue(s, {1})); SetOverflow(m_ir->CreateICmpSLT(m_ir->CreateAnd(m_ir->CreateXor(a, m_ir->CreateNot(b)), m_ir->CreateXor(a, result)), m_ir->getInt64(0))); } } @@ -2755,7 +2778,8 @@ void PPUTranslator::MULHDU(ppu_opcode_t op) const auto b = ZExt(GetGpr(op.rb)); const auto result = Trunc(m_ir->CreateLShr(m_ir->CreateMul(a, b), 64)); SetGpr(op.rd, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::MULHWU(ppu_opcode_t op) @@ -2763,7 +2787,8 @@ void PPUTranslator::MULHWU(ppu_opcode_t op) const auto a = ZExt(GetGpr(op.ra, 32)); const auto b = ZExt(GetGpr(op.rb, 32)); SetGpr(op.rd, m_ir->CreateLShr(m_ir->CreateMul(a, b), 32)); - if (op.rc) SetCrFieldSignedCmp(0, GetGpr(op.rd), m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, GetGpr(op.rd), m_ir->getInt64(0)); } void PPUTranslator::MFOCRF(ppu_opcode_t op) @@ -2779,7 +2804,10 @@ void PPUTranslator::MFOCRF(ppu_opcode_t op) return; } } - else if (std::none_of(m_cr + 0, m_cr + 32, [](auto* p) { return p; })) + else if (std::none_of(m_cr + 0, m_cr + 32, [](auto* p) + { + return p; + })) { // MFCR (optimized) Value* ln0 = m_ir->CreateIntToPtr(m_ir->CreatePtrToInt(m_ir->CreateStructGEP(m_thread_type, m_thread, 99), GetType()), GetType()->getPointerTo()); @@ -2822,7 +2850,7 @@ void PPUTranslator::LWARX(ppu_opcode_t op) RegStore(Trunc(GetAddr()), m_cia); FlushRegisters(); Call(GetType(), "__resinterp", m_thread); - //Call(GetType(), "__escape", m_thread)->setTailCall(); + // Call(GetType(), "__escape", m_thread)->setTailCall(); m_ir->CreateRetVoid(); return; } @@ -2847,14 +2875,16 @@ void PPUTranslator::SLW(ppu_opcode_t op) const auto shift_res = m_ir->CreateShl(GetGpr(op.rs), shift_num); const auto result = m_ir->CreateAnd(shift_res, 0xffffffff); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::CNTLZW(ppu_opcode_t op) { const auto result = Call(GetType(), "llvm.ctlz.i32", GetGpr(op.rs, 32), m_ir->getFalse()); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt32(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt32(0)); } void PPUTranslator::SLD(ppu_opcode_t op) @@ -2863,14 +2893,16 @@ void PPUTranslator::SLD(ppu_opcode_t op) const auto shift_arg = GetGpr(op.rs); const auto result = Trunc(m_ir->CreateShl(ZExt(shift_arg), ZExt(shift_num))); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::AND(ppu_opcode_t op) { const auto result = op.rs == op.rb ? GetGpr(op.rs) : m_ir->CreateAnd(GetGpr(op.rs), GetGpr(op.rb)); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::CMPL(ppu_opcode_t op) @@ -2895,12 +2927,13 @@ void PPUTranslator::SUBF(ppu_opcode_t op) const auto b = GetGpr(op.rb); const auto result = m_ir->CreateSub(b, a); SetGpr(op.rd, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); if (op.oe) { - //const auto s = m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::ssub_with_overflow), {b, m_ir->CreateNot(a)}); - //SetOverflow(m_ir->CreateExtractValue(s, {1})); + // const auto s = m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::ssub_with_overflow), {b, m_ir->CreateNot(a)}); + // SetOverflow(m_ir->CreateExtractValue(s, {1})); SetOverflow(m_ir->CreateICmpSLT(m_ir->CreateAnd(m_ir->CreateXor(a, b), m_ir->CreateXor(m_ir->CreateNot(a), result)), m_ir->getInt64(0))); } } @@ -2929,14 +2962,16 @@ void PPUTranslator::CNTLZD(ppu_opcode_t op) { const auto result = Call(GetType(), "llvm.ctlz.i64", GetGpr(op.rs), m_ir->getFalse()); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::ANDC(ppu_opcode_t op) { const auto result = m_ir->CreateAnd(GetGpr(op.rs), m_ir->CreateNot(GetGpr(op.rb))); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::TD(ppu_opcode_t op) @@ -2956,7 +2991,8 @@ void PPUTranslator::MULHD(ppu_opcode_t op) const auto b = SExt(GetGpr(op.rb)); const auto result = Trunc(m_ir->CreateLShr(m_ir->CreateMul(a, b), 64)); SetGpr(op.rd, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::MULHW(ppu_opcode_t op) @@ -2964,7 +3000,8 @@ void PPUTranslator::MULHW(ppu_opcode_t op) const auto a = SExt(GetGpr(op.ra, 32)); const auto b = SExt(GetGpr(op.rb, 32)); SetGpr(op.rd, m_ir->CreateAShr(m_ir->CreateMul(a, b), 32)); - if (op.rc) SetCrFieldSignedCmp(0, GetGpr(op.rd), m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, GetGpr(op.rd), m_ir->getInt64(0)); } void PPUTranslator::LDARX(ppu_opcode_t op) @@ -2974,7 +3011,7 @@ void PPUTranslator::LDARX(ppu_opcode_t op) RegStore(Trunc(GetAddr()), m_cia); FlushRegisters(); Call(GetType(), "__resinterp", m_thread); - //Call(GetType(), "__escape", m_thread)->setTailCall(); + // Call(GetType(), "__escape", m_thread)->setTailCall(); m_ir->CreateRetVoid(); return; } @@ -2995,7 +3032,7 @@ void PPUTranslator::LVX(ppu_opcode_t op) { const auto addr = m_ir->CreateAnd(op.ra ? m_ir->CreateAdd(GetGpr(op.ra), GetGpr(op.rb)) : GetGpr(op.rb), ~0xfull); const auto data = ReadMemory(addr, GetType(), m_is_be, 16); - SetVr(op.vd, m_is_be ? data : Shuffle(data, nullptr, { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 })); + SetVr(op.vd, m_is_be ? data : Shuffle(data, nullptr, {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0})); } void PPUTranslator::NEG(ppu_opcode_t op) @@ -3003,8 +3040,10 @@ void PPUTranslator::NEG(ppu_opcode_t op) const auto reg = GetGpr(op.ra); const auto result = m_ir->CreateNeg(reg); SetGpr(op.rd, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); - if (op.oe) SetOverflow(m_ir->CreateICmpEQ(result, m_ir->getInt64(1ull << 63))); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.oe) + SetOverflow(m_ir->CreateICmpEQ(result, m_ir->getInt64(1ull << 63))); } void PPUTranslator::LBZUX(ppu_opcode_t op) @@ -3018,7 +3057,8 @@ void PPUTranslator::NOR(ppu_opcode_t op) { const auto result = m_ir->CreateNot(op.rs == op.rb ? GetGpr(op.rs) : m_ir->CreateOr(GetGpr(op.rs), GetGpr(op.rb))); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::STVEBX(ppu_opcode_t op) @@ -3036,8 +3076,10 @@ void PPUTranslator::SUBFE(ppu_opcode_t op) const auto r2 = m_ir->CreateAdd(r1, ZExt(c, GetType())); SetGpr(op.rd, r2); SetCarry(m_ir->CreateOr(m_ir->CreateICmpULT(r1, a), m_ir->CreateICmpULT(r2, r1))); - if (op.rc) SetCrFieldSignedCmp(0, r2, m_ir->getInt64(0)); - if (op.oe) UNK(op); + if (op.rc) + SetCrFieldSignedCmp(0, r2, m_ir->getInt64(0)); + if (op.oe) + UNK(op); } void PPUTranslator::ADDE(ppu_opcode_t op) @@ -3049,8 +3091,10 @@ void PPUTranslator::ADDE(ppu_opcode_t op) const auto r2 = m_ir->CreateAdd(r1, ZExt(c, GetType())); SetGpr(op.rd, r2); SetCarry(m_ir->CreateOr(m_ir->CreateICmpULT(r1, a), m_ir->CreateICmpULT(r2, r1))); - if (op.rc) SetCrFieldSignedCmp(0, r2, m_ir->getInt64(0)); - if (op.oe) UNK(op); + if (op.rc) + SetCrFieldSignedCmp(0, r2, m_ir->getInt64(0)); + if (op.oe) + UNK(op); } void PPUTranslator::MTOCRF(ppu_opcode_t op) @@ -3070,24 +3114,71 @@ void PPUTranslator::MTOCRF(ppu_opcode_t op) // MTCRF } - static u8 s_table[64] - { - 0, 0, 0, 0, - 0, 0, 0, 1, - 0, 0, 1, 0, - 0, 0, 1, 1, - 0, 1, 0, 0, - 0, 1, 0, 1, - 0, 1, 1, 0, - 0, 1, 1, 1, - 1, 0, 0, 0, - 1, 0, 0, 1, - 1, 0, 1, 0, - 1, 0, 1, 1, - 1, 1, 0, 0, - 1, 1, 0, 1, - 1, 1, 1, 0, - 1, 1, 1, 1, + static u8 s_table[64]{ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, }; if (!m_mtocr_table) @@ -3164,8 +3255,10 @@ void PPUTranslator::ADDZE(ppu_opcode_t op) const auto result = m_ir->CreateAdd(a, ZExt(c, GetType())); SetGpr(op.rd, result); SetCarry(m_ir->CreateICmpULT(result, a)); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); - if (op.oe) UNK(op); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.oe) + UNK(op); } void PPUTranslator::SUBFZE(ppu_opcode_t op) @@ -3175,8 +3268,10 @@ void PPUTranslator::SUBFZE(ppu_opcode_t op) const auto result = m_ir->CreateAdd(a, ZExt(c, GetType())); SetGpr(op.rd, result); SetCarry(m_ir->CreateICmpULT(result, a)); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); - if (op.oe) UNK(op); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.oe) + UNK(op); } void PPUTranslator::STDCX(ppu_opcode_t op) @@ -3193,7 +3288,7 @@ void PPUTranslator::STBX(ppu_opcode_t op) void PPUTranslator::STVX(ppu_opcode_t op) { const auto value = GetVr(op.vs, VrType::vi8); - const auto data = m_is_be ? value : Shuffle(value, nullptr, { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }); + const auto data = m_is_be ? value : Shuffle(value, nullptr, {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}); WriteMemory(m_ir->CreateAnd(op.ra ? m_ir->CreateAdd(GetGpr(op.ra), GetGpr(op.rb)) : GetGpr(op.rb), -16), data, m_is_be, 16); } @@ -3204,8 +3299,10 @@ void PPUTranslator::SUBFME(ppu_opcode_t op) const auto result = m_ir->CreateSub(a, ZExt(m_ir->CreateNot(c), GetType())); SetGpr(op.rd, result); SetCarry(m_ir->CreateOr(c, IsNotZero(a))); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); - if (op.oe) UNK(op); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.oe) + UNK(op); } void PPUTranslator::MULLD(ppu_opcode_t op) @@ -3214,8 +3311,10 @@ void PPUTranslator::MULLD(ppu_opcode_t op) const auto b = GetGpr(op.rb); const auto result = m_ir->CreateMul(a, b); SetGpr(op.rd, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); - if (op.oe) UNK(op); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.oe) + UNK(op); } void PPUTranslator::ADDME(ppu_opcode_t op) @@ -3225,8 +3324,10 @@ void PPUTranslator::ADDME(ppu_opcode_t op) const auto result = m_ir->CreateSub(a, ZExt(m_ir->CreateNot(c), GetType())); SetGpr(op.rd, result); SetCarry(m_ir->CreateOr(c, IsNotZero(a))); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); - if (op.oe) UNK(op); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.oe) + UNK(op); } void PPUTranslator::MULLW(ppu_opcode_t op) @@ -3235,8 +3336,10 @@ void PPUTranslator::MULLW(ppu_opcode_t op) const auto b = SExt(GetGpr(op.rb, 32)); const auto result = m_ir->CreateMul(a, b); SetGpr(op.rd, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); - if (op.oe) UNK(op); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.oe) + UNK(op); } void PPUTranslator::DCBTST(ppu_opcode_t) @@ -3259,12 +3362,13 @@ void PPUTranslator::ADD(ppu_opcode_t op) if (op.oe) { - //const auto s = m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::sadd_with_overflow), {a, b}); - //SetOverflow(m_ir->CreateExtractValue(s, {1})); + // const auto s = m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::sadd_with_overflow), {a, b}); + // SetOverflow(m_ir->CreateExtractValue(s, {1})); SetOverflow(m_ir->CreateICmpSLT(m_ir->CreateAnd(m_ir->CreateXor(a, m_ir->CreateNot(b)), m_ir->CreateXor(a, result)), m_ir->getInt64(0))); } - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::DCBT(ppu_opcode_t) @@ -3280,7 +3384,8 @@ void PPUTranslator::EQV(ppu_opcode_t op) { const auto result = m_ir->CreateNot(m_ir->CreateXor(GetGpr(op.rs), GetGpr(op.rb))); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::ECIWX(ppu_opcode_t op) @@ -3299,7 +3404,8 @@ void PPUTranslator::XOR(ppu_opcode_t op) { const auto result = op.rs == op.rb ? static_cast(m_ir->getInt64(0)) : m_ir->CreateXor(GetGpr(op.rs), GetGpr(op.rb)); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::MFSPR(ppu_opcode_t op) @@ -3401,7 +3507,8 @@ void PPUTranslator::ORC(ppu_opcode_t op) { const auto result = op.rs == op.rb ? static_cast(m_ir->getInt64(-1)) : m_ir->CreateOr(GetGpr(op.rs), m_ir->CreateNot(GetGpr(op.rb))); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::ECOWX(ppu_opcode_t op) @@ -3420,7 +3527,8 @@ void PPUTranslator::OR(ppu_opcode_t op) { const auto result = op.rs == op.rb ? GetGpr(op.rs) : m_ir->CreateOr(GetGpr(op.rs), GetGpr(op.rb)); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::DIVDU(ppu_opcode_t op) @@ -3430,8 +3538,10 @@ void PPUTranslator::DIVDU(ppu_opcode_t op) const auto o = IsZero(b); const auto result = m_ir->CreateUDiv(a, m_ir->CreateSelect(o, m_ir->getInt64(-1), b)); SetGpr(op.rd, m_ir->CreateSelect(o, m_ir->getInt64(0), result)); - if (op.rc) SetCrFieldSignedCmp(0, GetGpr(op.rd), m_ir->getInt64(0)); - if (op.oe) SetOverflow(o); + if (op.rc) + SetCrFieldSignedCmp(0, GetGpr(op.rd), m_ir->getInt64(0)); + if (op.oe) + SetOverflow(o); } void PPUTranslator::DIVWU(ppu_opcode_t op) @@ -3441,8 +3551,10 @@ void PPUTranslator::DIVWU(ppu_opcode_t op) const auto o = IsZero(b); const auto result = m_ir->CreateUDiv(a, m_ir->CreateSelect(o, m_ir->getInt32(0xffffffff), b)); SetGpr(op.rd, m_ir->CreateSelect(o, m_ir->getInt32(0), result)); - if (op.rc) SetCrFieldSignedCmp(0, GetGpr(op.rd), m_ir->getInt64(0)); - if (op.oe) SetOverflow(o); + if (op.rc) + SetCrFieldSignedCmp(0, GetGpr(op.rd), m_ir->getInt64(0)); + if (op.oe) + SetOverflow(o); } void PPUTranslator::MTSPR(ppu_opcode_t op) @@ -3476,7 +3588,8 @@ void PPUTranslator::NAND(ppu_opcode_t op) { const auto result = m_ir->CreateNot(op.rs == op.rb ? GetGpr(op.rs) : m_ir->CreateAnd(GetGpr(op.rs), GetGpr(op.rb))); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::STVXL(ppu_opcode_t op) @@ -3491,8 +3604,10 @@ void PPUTranslator::DIVD(ppu_opcode_t op) const auto o = m_ir->CreateOr(IsZero(b), m_ir->CreateAnd(m_ir->CreateICmpEQ(a, m_ir->getInt64(1ull << 63)), IsOnes(b))); const auto result = m_ir->CreateSDiv(a, m_ir->CreateSelect(o, m_ir->getInt64(1ull << 63), b)); SetGpr(op.rd, m_ir->CreateSelect(o, m_ir->getInt64(0), result)); - if (op.rc) SetCrFieldSignedCmp(0, GetGpr(op.rd), m_ir->getInt64(0)); - if (op.oe) SetOverflow(o); + if (op.rc) + SetCrFieldSignedCmp(0, GetGpr(op.rd), m_ir->getInt64(0)); + if (op.oe) + SetOverflow(o); } void PPUTranslator::DIVW(ppu_opcode_t op) @@ -3502,8 +3617,10 @@ void PPUTranslator::DIVW(ppu_opcode_t op) const auto o = m_ir->CreateOr(IsZero(b), m_ir->CreateAnd(m_ir->CreateICmpEQ(a, m_ir->getInt32(s32{smin})), IsOnes(b))); const auto result = m_ir->CreateSDiv(a, m_ir->CreateSelect(o, m_ir->getInt32(s32{smin}), b)); SetGpr(op.rd, m_ir->CreateSelect(o, m_ir->getInt32(0), result)); - if (op.rc) SetCrFieldSignedCmp(0, GetGpr(op.rd), m_ir->getInt64(0)); - if (op.oe) SetOverflow(o); + if (op.rc) + SetCrFieldSignedCmp(0, GetGpr(op.rd), m_ir->getInt64(0)); + if (op.oe) + SetOverflow(o); } void PPUTranslator::LVLX(ppu_opcode_t op) @@ -3540,7 +3657,8 @@ void PPUTranslator::SRW(ppu_opcode_t op) const auto shift_arg = m_ir->CreateAnd(GetGpr(op.rs), 0xffffffff); const auto result = m_ir->CreateLShr(shift_arg, shift_num); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::SRD(ppu_opcode_t op) @@ -3549,7 +3667,8 @@ void PPUTranslator::SRD(ppu_opcode_t op) const auto shift_arg = GetGpr(op.rs); const auto result = Trunc(m_ir->CreateLShr(ZExt(shift_arg), ZExt(shift_num))); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::LVRX(ppu_opcode_t op) @@ -3744,19 +3863,21 @@ void PPUTranslator::SRAW(ppu_opcode_t op) const auto result = m_ir->CreateAShr(arg_ext, shift_num); SetGpr(op.ra, result); SetCarry(m_ir->CreateAnd(m_ir->CreateICmpSLT(shift_arg, m_ir->getInt32(0)), m_ir->CreateICmpNE(arg_ext, m_ir->CreateShl(result, shift_num)))); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::SRAD(ppu_opcode_t op) { const auto shift_num = ZExt(m_ir->CreateAnd(GetGpr(op.rb), 0x7f)); // i128 const auto shift_arg = GetGpr(op.rs); - const auto arg_ext = SExt(shift_arg); // i128 + const auto arg_ext = SExt(shift_arg); // i128 const auto res_128 = m_ir->CreateAShr(arg_ext, shift_num); // i128 const auto result = Trunc(res_128); SetGpr(op.ra, result); SetCarry(m_ir->CreateAnd(m_ir->CreateICmpSLT(shift_arg, m_ir->getInt64(0)), m_ir->CreateICmpNE(arg_ext, m_ir->CreateShl(res_128, shift_num)))); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::LVRXL(ppu_opcode_t op) @@ -3775,7 +3896,8 @@ void PPUTranslator::SRAWI(ppu_opcode_t op) const auto result = SExt(res_32); SetGpr(op.ra, result); SetCarry(m_ir->CreateAnd(m_ir->CreateICmpSLT(shift_arg, m_ir->getInt32(0)), m_ir->CreateICmpNE(shift_arg, m_ir->CreateShl(res_32, op.sh32)))); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::SRADI(ppu_opcode_t op) @@ -3784,7 +3906,8 @@ void PPUTranslator::SRADI(ppu_opcode_t op) const auto result = m_ir->CreateAShr(shift_arg, op.sh64); SetGpr(op.ra, result); SetCarry(m_ir->CreateAnd(m_ir->CreateICmpSLT(shift_arg, m_ir->getInt64(0)), m_ir->CreateICmpNE(shift_arg, m_ir->CreateShl(result, op.sh64)))); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::EIEIO(ppu_opcode_t) @@ -3807,7 +3930,8 @@ void PPUTranslator::EXTSH(ppu_opcode_t op) { const auto result = SExt(GetGpr(op.rs, 16), GetType()); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::STVRXL(ppu_opcode_t op) @@ -3819,7 +3943,8 @@ void PPUTranslator::EXTSB(ppu_opcode_t op) { const auto result = SExt(GetGpr(op.rs, 8), GetType()); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::STFIWX(ppu_opcode_t op) @@ -3831,7 +3956,8 @@ void PPUTranslator::EXTSW(ppu_opcode_t op) { const auto result = SExt(GetGpr(op.rs, 32)); SetGpr(op.ra, result); - if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); + if (op.rc) + SetCrFieldSignedCmp(0, result, m_ir->getInt64(0)); } void PPUTranslator::ICBI(ppu_opcode_t) @@ -3862,7 +3988,7 @@ void PPUTranslator::LWZ(ppu_opcode_t op) m_rel = nullptr; } - m_may_be_mmio &= (op.ra != 1u && op.ra != 13u); // Stack register and TLS address register are unlikely to be used in MMIO address calculation + m_may_be_mmio &= (op.ra != 1u && op.ra != 13u); // Stack register and TLS address register are unlikely to be used in MMIO address calculation m_may_be_mmio &= op.simm16 == 0 || spu_thread::test_is_problem_state_register_offset(op.uimm16, true, false); // Either exact MMIO address or MMIO base with completing s16 address offset if (m_may_be_mmio) @@ -3919,7 +4045,7 @@ void PPUTranslator::LWZU(ppu_opcode_t op) m_rel = nullptr; } - m_may_be_mmio &= (op.ra != 1u && op.ra != 13u); // Stack register and TLS address register are unlikely to be used in MMIO address calculation + m_may_be_mmio &= (op.ra != 1u && op.ra != 13u); // Stack register and TLS address register are unlikely to be used in MMIO address calculation m_may_be_mmio &= op.simm16 == 0 || spu_thread::test_is_problem_state_register_offset(op.uimm16, true, false); // Either exact MMIO address or MMIO base with completing s16 address offset const auto addr = m_ir->CreateAdd(GetGpr(op.ra), imm); @@ -3965,7 +4091,7 @@ void PPUTranslator::STW(ppu_opcode_t op) m_rel = nullptr; } - m_may_be_mmio &= (op.ra != 1u && op.ra != 13u); // Stack register and TLS address register are unlikely to be used in MMIO address calculation + m_may_be_mmio &= (op.ra != 1u && op.ra != 13u); // Stack register and TLS address register are unlikely to be used in MMIO address calculation m_may_be_mmio &= op.simm16 == 0 || spu_thread::test_is_problem_state_register_offset(op.uimm16, false, true); // Either exact MMIO address or MMIO base with completing s16 address offset if (m_may_be_mmio) @@ -4013,7 +4139,7 @@ void PPUTranslator::STW(ppu_opcode_t op) const auto addr = op.ra ? m_ir->CreateAdd(GetGpr(op.ra), imm) : imm; WriteMemory(addr, value); - //Insomniac engine v3 & v4 (newer R&C, Fuse, Resitance 3) + // Insomniac engine v3 & v4 (newer R&C, Fuse, Resitance 3) if (auto ci = llvm::dyn_cast(value)) { if (ci->getZExtValue() == 0xAAAAAAAA) @@ -4033,7 +4159,7 @@ void PPUTranslator::STWU(ppu_opcode_t op) m_rel = nullptr; } - m_may_be_mmio &= (op.ra != 1u && op.ra != 13u);// Stack register and TLS address register are unlikely to be used in MMIO address calculatio + m_may_be_mmio &= (op.ra != 1u && op.ra != 13u); // Stack register and TLS address register are unlikely to be used in MMIO address calculatio m_may_be_mmio &= op.simm16 == 0 || spu_thread::test_is_problem_state_register_offset(op.uimm16, false, true); // Either exact MMIO address or MMIO base with completing s16 address offset const auto addr = m_ir->CreateAdd(GetGpr(op.ra), imm); @@ -4183,7 +4309,7 @@ void PPUTranslator::LFS(ppu_opcode_t op) m_rel = nullptr; } - m_may_be_mmio &= (op.ra != 1u && op.ra != 13u); // Stack register and TLS address register are unlikely to be used in MMIO address calculatio + m_may_be_mmio &= (op.ra != 1u && op.ra != 13u); // Stack register and TLS address register are unlikely to be used in MMIO address calculatio m_may_be_mmio &= op.simm16 == 0 || spu_thread::test_is_problem_state_register_offset(op.uimm16, true, false); // Either exact MMIO address or MMIO base with completing s16 address offset SetFpr(op.frd, ReadMemory(op.ra ? m_ir->CreateAdd(GetGpr(op.ra), imm) : imm, GetType())); @@ -4199,7 +4325,7 @@ void PPUTranslator::LFSU(ppu_opcode_t op) m_rel = nullptr; } - m_may_be_mmio &= (op.ra != 1u && op.ra != 13u); // Stack register and TLS address register are unlikely to be used in MMIO address calculatio + m_may_be_mmio &= (op.ra != 1u && op.ra != 13u); // Stack register and TLS address register are unlikely to be used in MMIO address calculatio m_may_be_mmio &= op.simm16 == 0 || spu_thread::test_is_problem_state_register_offset(op.uimm16, true, false); // Either exact MMIO address or MMIO base with completing s16 address offset const auto addr = m_ir->CreateAdd(GetGpr(op.ra), imm); @@ -4378,14 +4504,14 @@ void PPUTranslator::FDIVS(ppu_opcode_t op) const auto result = m_ir->CreateFPTrunc(m_ir->CreateFDiv(a, b), GetType()); SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fdivs_get_fr", a, b)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fdivs_get_fi", a, b)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fdivs_get_ox", a, b)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fdivs_get_ux", a, b)); - //SetFPSCRException(m_fpscr_zx, Call(GetType(), m_pure_attr, "__fdivs_get_zx", a, b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fdivs_get_vxsnan", a, b)); - //SetFPSCRException(m_fpscr_vxidi, Call(GetType(), m_pure_attr, "__fdivs_get_vxidi", a, b)); - //SetFPSCRException(m_fpscr_vxzdz, Call(GetType(), m_pure_attr, "__fdivs_get_vxzdz", a, b)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fdivs_get_fr", a, b)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fdivs_get_fi", a, b)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fdivs_get_ox", a, b)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fdivs_get_ux", a, b)); + // SetFPSCRException(m_fpscr_zx, Call(GetType(), m_pure_attr, "__fdivs_get_zx", a, b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fdivs_get_vxsnan", a, b)); + // SetFPSCRException(m_fpscr_vxidi, Call(GetType(), m_pure_attr, "__fdivs_get_vxidi", a, b)); + // SetFPSCRException(m_fpscr_vxzdz, Call(GetType(), m_pure_attr, "__fdivs_get_vxzdz", a, b)); SetFPRF(result, op.rc != 0); } @@ -4396,12 +4522,12 @@ void PPUTranslator::FSUBS(ppu_opcode_t op) const auto result = m_ir->CreateFPTrunc(m_ir->CreateFSub(a, b), GetType()); SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fsubs_get_fr", a, b)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fsubs_get_fi", a, b)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fsubs_get_ox", a, b)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fsubs_get_ux", a, b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fsubs_get_vxsnan", a, b)); - //SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fsubs_get_vxisi", a, b)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fsubs_get_fr", a, b)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fsubs_get_fi", a, b)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fsubs_get_ox", a, b)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fsubs_get_ux", a, b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fsubs_get_vxsnan", a, b)); + // SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fsubs_get_vxisi", a, b)); SetFPRF(result, op.rc != 0); } @@ -4412,12 +4538,12 @@ void PPUTranslator::FADDS(ppu_opcode_t op) const auto result = m_ir->CreateFPTrunc(m_ir->CreateFAdd(a, b), GetType()); SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fadds_get_fr", a, b)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fadds_get_fi", a, b)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fadds_get_ox", a, b)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fadds_get_ux", a, b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fadds_get_vxsnan", a, b)); - //SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fadds_get_vxisi", a, b)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fadds_get_fr", a, b)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fadds_get_fi", a, b)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fadds_get_ox", a, b)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fadds_get_ux", a, b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fadds_get_vxsnan", a, b)); + // SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fadds_get_vxisi", a, b)); SetFPRF(result, op.rc != 0); } @@ -4427,12 +4553,12 @@ void PPUTranslator::FSQRTS(ppu_opcode_t op) const auto result = m_ir->CreateFPTrunc(Call(GetType(), "llvm.sqrt.f64", b), GetType()); SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fsqrts_get_fr", b)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fsqrts_get_fi", b)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fsqrts_get_ox", b)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fsqrts_get_ux", b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fsqrts_get_vxsnan", b)); - //SetFPSCRException(m_fpscr_vxsqrt, Call(GetType(), m_pure_attr, "__fsqrts_get_vxsqrt", b)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fsqrts_get_fr", b)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fsqrts_get_fi", b)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fsqrts_get_ox", b)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fsqrts_get_ux", b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fsqrts_get_vxsnan", b)); + // SetFPSCRException(m_fpscr_vxsqrt, Call(GetType(), m_pure_attr, "__fsqrts_get_vxsqrt", b)); SetFPRF(result, op.rc != 0); } @@ -4445,9 +4571,9 @@ void PPUTranslator::FRES(ppu_opcode_t op) const auto a = GetFpr(op.frb); const auto b = bitcast(a); - const auto n = m_ir->CreateFCmpUNO(a, a); // test for NaN + const auto n = m_ir->CreateFCmpUNO(a, a); // test for NaN const auto e = m_ir->CreateAnd(m_ir->CreateLShr(b, 52), 0x7ff); // double exp - const auto i = m_ir->CreateAnd(m_ir->CreateLShr(b, 45), 0x7f); // mantissa LUT index + const auto i = m_ir->CreateAnd(m_ir->CreateLShr(b, 45), 0x7f); // mantissa LUT index const auto ptr = dyn_cast(m_ir->CreateGEP(m_fres_table->getValueType(), m_fres_table, {m_ir->getInt64(0), i})); assert(ptr->getResultElementType() == get_type()); const auto m = m_ir->CreateShl(ZExt(m_ir->CreateLoad(ptr->getResultElementType(), ptr)), 29); @@ -4457,13 +4583,13 @@ void PPUTranslator::FRES(ppu_opcode_t op) const auto r = bitcast(m_ir->CreateSelect(n, m_ir->CreateOr(b, 0x8'0000'0000'0000), m_ir->CreateOr(s, m_ir->CreateAnd(b, 0x8000'0000'0000'0000)))); SetFpr(op.frd, m_ir->CreateFPTrunc(r, GetType())); - //m_ir->CreateStore(GetUndef(), m_fpscr_fr); - //m_ir->CreateStore(GetUndef(), m_fpscr_fi); - //m_ir->CreateStore(GetUndef(), m_fpscr_xx); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fres_get_ox", b)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fres_get_ux", b)); - //SetFPSCRException(m_fpscr_zx, Call(GetType(), m_pure_attr, "__fres_get_zx", b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fres_get_vxsnan", b)); + // m_ir->CreateStore(GetUndef(), m_fpscr_fr); + // m_ir->CreateStore(GetUndef(), m_fpscr_fi); + // m_ir->CreateStore(GetUndef(), m_fpscr_xx); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fres_get_ox", b)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fres_get_ux", b)); + // SetFPSCRException(m_fpscr_zx, Call(GetType(), m_pure_attr, "__fres_get_zx", b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fres_get_vxsnan", b)); SetFPRF(r, op.rc != 0); } @@ -4474,12 +4600,12 @@ void PPUTranslator::FMULS(ppu_opcode_t op) const auto result = m_ir->CreateFPTrunc(m_ir->CreateFMul(a, c), GetType()); SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmuls_get_fr", a, c)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmuls_get_fi", a, c)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmuls_get_ox", a, c)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmuls_get_ux", a, c)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmuls_get_vxsnan", a, c)); - //SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmuls_get_vximz", a, c)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmuls_get_fr", a, c)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmuls_get_fi", a, c)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmuls_get_ox", a, c)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmuls_get_ux", a, c)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmuls_get_vxsnan", a, c)); + // SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmuls_get_vximz", a, c)); SetFPRF(result, op.rc != 0); } @@ -4501,13 +4627,13 @@ void PPUTranslator::FMADDS(ppu_opcode_t op) SetFpr(op.frd, m_ir->CreateFPTrunc(result, GetType())); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadds_get_fr", a, b, c)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadds_get_fi", a, b, c)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadds_get_ox", a, b, c)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadds_get_ux", a, b, c)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadds_get_vxsnan", a, b, c)); - //SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadds_get_vxisi", a, b, c)); - //SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadds_get_vximz", a, b, c)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadds_get_fr", a, b, c)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadds_get_fi", a, b, c)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadds_get_ox", a, b, c)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadds_get_ux", a, b, c)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadds_get_vxsnan", a, b, c)); + // SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadds_get_vxisi", a, b, c)); + // SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadds_get_vximz", a, b, c)); SetFPRF(result, op.rc != 0); } @@ -4529,13 +4655,13 @@ void PPUTranslator::FMSUBS(ppu_opcode_t op) SetFpr(op.frd, m_ir->CreateFPTrunc(result, GetType())); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadds_get_fr", a, b, c)); // TODO ??? - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadds_get_fi", a, b, c)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadds_get_ox", a, b, c)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadds_get_ux", a, b, c)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadds_get_vxsnan", a, b, c)); - //SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadds_get_vxisi", a, b, c)); - //SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadds_get_vximz", a, b, c)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadds_get_fr", a, b, c)); // TODO ??? + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadds_get_fi", a, b, c)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadds_get_ox", a, b, c)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadds_get_ux", a, b, c)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadds_get_vxsnan", a, b, c)); + // SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadds_get_vxisi", a, b, c)); + // SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadds_get_vximz", a, b, c)); SetFPRF(result, op.rc != 0); } @@ -4557,13 +4683,13 @@ void PPUTranslator::FNMSUBS(ppu_opcode_t op) SetFpr(op.frd, m_ir->CreateFPTrunc(m_ir->CreateFNeg(result), GetType())); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadds_get_fr", a, b, c)); // TODO ??? - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadds_get_fi", a, b, c)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadds_get_ox", a, b, c)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadds_get_ux", a, b, c)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadds_get_vxsnan", a, b, c)); - //SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadds_get_vxisi", a, b, c)); - //SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadds_get_vximz", a, b, c)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadds_get_fr", a, b, c)); // TODO ??? + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadds_get_fi", a, b, c)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadds_get_ox", a, b, c)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadds_get_ux", a, b, c)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadds_get_vxsnan", a, b, c)); + // SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadds_get_vxisi", a, b, c)); + // SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadds_get_vximz", a, b, c)); SetFPRF(result, op.rc != 0); } @@ -4585,13 +4711,13 @@ void PPUTranslator::FNMADDS(ppu_opcode_t op) SetFpr(op.frd, m_ir->CreateFPTrunc(m_ir->CreateFNeg(result), GetType())); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadds_get_fr", a, b, c)); // TODO ??? - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadds_get_fi", a, b, c)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadds_get_ox", a, b, c)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadds_get_ux", a, b, c)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadds_get_vxsnan", a, b, c)); - //SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadds_get_vxisi", a, b, c)); - //SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadds_get_vximz", a, b, c)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadds_get_fr", a, b, c)); // TODO ??? + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadds_get_fi", a, b, c)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadds_get_ox", a, b, c)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadds_get_ux", a, b, c)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadds_get_vxsnan", a, b, c)); + // SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadds_get_vxisi", a, b, c)); + // SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadds_get_vximz", a, b, c)); SetFPRF(result, op.rc != 0); } @@ -4599,7 +4725,8 @@ void PPUTranslator::MTFSB1(ppu_opcode_t op) { SetFPSCRBit(op.crbd, m_ir->getTrue(), true); - if (op.rc) SetCrFieldFPCC(1); + if (op.rc) + SetCrFieldFPCC(1); } void PPUTranslator::MCRFS(ppu_opcode_t op) @@ -4615,7 +4742,8 @@ void PPUTranslator::MTFSB0(ppu_opcode_t op) { SetFPSCRBit(op.crbd, m_ir->getFalse(), false); - if (op.rc) SetCrFieldFPCC(1); + if (op.rc) + SetCrFieldFPCC(1); } void PPUTranslator::MTFSFI(ppu_opcode_t op) @@ -4630,7 +4758,8 @@ void PPUTranslator::MTFSFI(ppu_opcode_t op) SetFPSCRBit(op.crfd * 4 + 3, m_ir->getInt1((op.i & 1) != 0), false); - if (op.rc) SetCrFieldFPCC(1); + if (op.rc) + SetCrFieldFPCC(1); } void PPUTranslator::MFFS(ppu_opcode_t op) @@ -4644,7 +4773,8 @@ void PPUTranslator::MFFS(ppu_opcode_t op) SetFpr(op.frd, result); - if (op.rc) SetCrFieldFPCC(1); + if (op.rc) + SetCrFieldFPCC(1); } void PPUTranslator::MTFSF(ppu_opcode_t op) @@ -4659,7 +4789,8 @@ void PPUTranslator::MTFSF(ppu_opcode_t op) } } - if (op.rc) SetCrFieldFPCC(1); + if (op.rc) + SetCrFieldFPCC(1); } void PPUTranslator::FCMPU(ppu_opcode_t op) @@ -4672,7 +4803,7 @@ void PPUTranslator::FCMPU(ppu_opcode_t op) const auto un = m_ir->CreateFCmpUNO(a, b); SetCrField(op.crfd, lt, gt, eq, un); SetFPCC(lt, gt, eq, un); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fcmpu_get_vxsnan", a, b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fcmpu_get_vxsnan", a, b)); } void PPUTranslator::FRSP(ppu_opcode_t op) @@ -4681,11 +4812,11 @@ void PPUTranslator::FRSP(ppu_opcode_t op) const auto result = m_ir->CreateFPTrunc(b, GetType()); SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__frsp_get_fr", b)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__frsp_get_fi", b)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__frsp_get_ox", b)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__frsp_get_ux", b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__frsp_get_vxsnan", b)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__frsp_get_fr", b)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__frsp_get_fi", b)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__frsp_get_ox", b)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__frsp_get_ux", b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__frsp_get_vxsnan", b)); SetFPRF(result, op.rc != 0); } @@ -4701,12 +4832,12 @@ void PPUTranslator::FCTIW(ppu_opcode_t op) SetFpr(op.frd, m_ir->CreateXor(xormask, Call(GetType(), "llvm.aarch64.neon.fcvtns.i32.f64", b))); #endif - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fctiw_get_fr", b)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fctiw_get_fi", b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fctiw_get_vxsnan", b)); - //SetFPSCRException(m_fpscr_vxcvi, m_ir->CreateOr(sat_l, sat_h)); - //m_ir->CreateStore(GetUndef(), m_fpscr_c); - //SetFPCC(GetUndef(), GetUndef(), GetUndef(), GetUndef(), op.rc != 0); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fctiw_get_fr", b)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fctiw_get_fi", b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fctiw_get_vxsnan", b)); + // SetFPSCRException(m_fpscr_vxcvi, m_ir->CreateOr(sat_l, sat_h)); + // m_ir->CreateStore(GetUndef(), m_fpscr_c); + // SetFPCC(GetUndef(), GetUndef(), GetUndef(), GetUndef(), op.rc != 0); } void PPUTranslator::FCTIWZ(ppu_opcode_t op) @@ -4729,14 +4860,14 @@ void PPUTranslator::FDIV(ppu_opcode_t op) const auto result = m_ir->CreateFDiv(a, b); SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fdiv_get_fr", a, b)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fdiv_get_fi", a, b)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fdiv_get_ox", a, b)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fdiv_get_ux", a, b)); - //SetFPSCRException(m_fpscr_zx, Call(GetType(), m_pure_attr, "__fdiv_get_zx", a, b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fdiv_get_vxsnan", a, b)); - //SetFPSCRException(m_fpscr_vxidi, Call(GetType(), m_pure_attr, "__fdiv_get_vxidi", a, b)); - //SetFPSCRException(m_fpscr_vxzdz, Call(GetType(), m_pure_attr, "__fdiv_get_vxzdz", a, b)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fdiv_get_fr", a, b)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fdiv_get_fi", a, b)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fdiv_get_ox", a, b)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fdiv_get_ux", a, b)); + // SetFPSCRException(m_fpscr_zx, Call(GetType(), m_pure_attr, "__fdiv_get_zx", a, b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fdiv_get_vxsnan", a, b)); + // SetFPSCRException(m_fpscr_vxidi, Call(GetType(), m_pure_attr, "__fdiv_get_vxidi", a, b)); + // SetFPSCRException(m_fpscr_vxzdz, Call(GetType(), m_pure_attr, "__fdiv_get_vxzdz", a, b)); SetFPRF(result, op.rc != 0); } @@ -4747,12 +4878,12 @@ void PPUTranslator::FSUB(ppu_opcode_t op) const auto result = m_ir->CreateFSub(a, b); SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fsub_get_fr", a, b)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fsub_get_fi", a, b)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fsub_get_ox", a, b)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fsub_get_ux", a, b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fsub_get_vxsnan", a, b)); - //SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fsub_get_vxisi", a, b)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fsub_get_fr", a, b)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fsub_get_fi", a, b)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fsub_get_ox", a, b)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fsub_get_ux", a, b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fsub_get_vxsnan", a, b)); + // SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fsub_get_vxisi", a, b)); SetFPRF(result, op.rc != 0); } @@ -4763,12 +4894,12 @@ void PPUTranslator::FADD(ppu_opcode_t op) const auto result = m_ir->CreateFAdd(a, b); SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fadd_get_fr", a, b)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fadd_get_fi", a, b)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fadd_get_ox", a, b)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fadd_get_ux", a, b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fadd_get_vxsnan", a, b)); - //SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fadd_get_vxisi", a, b)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fadd_get_fr", a, b)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fadd_get_fi", a, b)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fadd_get_ox", a, b)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fadd_get_ux", a, b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fadd_get_vxsnan", a, b)); + // SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fadd_get_vxisi", a, b)); SetFPRF(result, op.rc != 0); } @@ -4778,12 +4909,12 @@ void PPUTranslator::FSQRT(ppu_opcode_t op) const auto result = Call(GetType(), "llvm.sqrt.f64", b); SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fsqrt_get_fr", b)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fsqrt_get_fi", b)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fsqrt_get_ox", b)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fsqrt_get_ux", b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fsqrt_get_vxsnan", b)); - //SetFPSCRException(m_fpscr_vxsqrt, Call(GetType(), m_pure_attr, "__fsqrt_get_vxsqrt", b)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fsqrt_get_fr", b)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fsqrt_get_fi", b)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fsqrt_get_ox", b)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fsqrt_get_ux", b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fsqrt_get_vxsnan", b)); + // SetFPSCRException(m_fpscr_vxsqrt, Call(GetType(), m_pure_attr, "__fsqrt_get_vxsqrt", b)); SetFPRF(result, op.rc != 0); } @@ -4794,7 +4925,8 @@ void PPUTranslator::FSEL(ppu_opcode_t op) const auto c = GetFpr(op.frc); SetFpr(op.frd, m_ir->CreateSelect(m_ir->CreateFCmpOGE(a, ConstantFP::get(GetType(), 0.0)), c, b)); - if (op.rc) SetCrFieldFPCC(1); + if (op.rc) + SetCrFieldFPCC(1); } void PPUTranslator::FMUL(ppu_opcode_t op) @@ -4804,12 +4936,12 @@ void PPUTranslator::FMUL(ppu_opcode_t op) const auto result = m_ir->CreateFMul(a, c); SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmul_get_fr", a, c)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmul_get_fi", a, c)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmul_get_ox", a, c)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmul_get_ux", a, c)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmul_get_vxsnan", a, c)); - //SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmul_get_vximz", a, c)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmul_get_fr", a, c)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmul_get_fi", a, c)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmul_get_ox", a, c)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmul_get_ux", a, c)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmul_get_vxsnan", a, c)); + // SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmul_get_vximz", a, c)); SetFPRF(result, op.rc != 0); } @@ -4827,12 +4959,12 @@ void PPUTranslator::FRSQRTE(ppu_opcode_t op) const auto result = m_ir->CreateBitCast(m_ir->CreateShl(ZExt(v), 32), GetType()); SetFpr(op.frd, result); - //m_ir->CreateStore(GetUndef(), m_fpscr_fr); - //m_ir->CreateStore(GetUndef(), m_fpscr_fi); - //m_ir->CreateStore(GetUndef(), m_fpscr_xx); - //SetFPSCRException(m_fpscr_zx, Call(GetType(), m_pure_attr, "__frsqrte_get_zx", b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__frsqrte_get_vxsnan", b)); - //SetFPSCRException(m_fpscr_vxsqrt, Call(GetType(), m_pure_attr, "__frsqrte_get_vxsqrt", b)); + // m_ir->CreateStore(GetUndef(), m_fpscr_fr); + // m_ir->CreateStore(GetUndef(), m_fpscr_fi); + // m_ir->CreateStore(GetUndef(), m_fpscr_xx); + // SetFPSCRException(m_fpscr_zx, Call(GetType(), m_pure_attr, "__frsqrte_get_zx", b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__frsqrte_get_vxsnan", b)); + // SetFPSCRException(m_fpscr_vxsqrt, Call(GetType(), m_pure_attr, "__frsqrte_get_vxsqrt", b)); SetFPRF(result, op.rc != 0); } @@ -4854,13 +4986,13 @@ void PPUTranslator::FMSUB(ppu_opcode_t op) SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadd_get_fr", a, b, c)); // TODO ??? - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadd_get_fi", a, b, c)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadd_get_ox", a, b, c)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadd_get_ux", a, b, c)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadd_get_vxsnan", a, b, c)); - //SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadd_get_vxisi", a, b, c)); - //SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadd_get_vximz", a, b, c)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadd_get_fr", a, b, c)); // TODO ??? + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadd_get_fi", a, b, c)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadd_get_ox", a, b, c)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadd_get_ux", a, b, c)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadd_get_vxsnan", a, b, c)); + // SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadd_get_vxisi", a, b, c)); + // SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadd_get_vximz", a, b, c)); SetFPRF(result, op.rc != 0); } @@ -4873,7 +5005,7 @@ void PPUTranslator::FMADD(ppu_opcode_t op) llvm::Value* result; if (g_cfg.core.use_accurate_dfma) { - result = m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::fma), { a, c, b }); + result = m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::fma), {a, c, b}); } else { @@ -4882,13 +5014,13 @@ void PPUTranslator::FMADD(ppu_opcode_t op) SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadd_get_fr", a, b, c)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadd_get_fi", a, b, c)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadd_get_ox", a, b, c)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadd_get_ux", a, b, c)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadd_get_vxsnan", a, b, c)); - //SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadd_get_vxisi", a, b, c)); - //SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadd_get_vximz", a, b, c)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadd_get_fr", a, b, c)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadd_get_fi", a, b, c)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadd_get_ox", a, b, c)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadd_get_ux", a, b, c)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadd_get_vxsnan", a, b, c)); + // SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadd_get_vxisi", a, b, c)); + // SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadd_get_vximz", a, b, c)); SetFPRF(result, op.rc != 0); } @@ -4910,13 +5042,13 @@ void PPUTranslator::FNMSUB(ppu_opcode_t op) SetFpr(op.frd, m_ir->CreateFNeg(result)); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadd_get_fr", a, b, c)); // TODO ??? - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadd_get_fi", a, b, c)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadd_get_ox", a, b, c)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadd_get_ux", a, b, c)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadd_get_vxsnan", a, b, c)); - //SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadd_get_vxisi", a, b, c)); - //SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadd_get_vximz", a, b, c)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadd_get_fr", a, b, c)); // TODO ??? + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadd_get_fi", a, b, c)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadd_get_ox", a, b, c)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadd_get_ux", a, b, c)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadd_get_vxsnan", a, b, c)); + // SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadd_get_vxisi", a, b, c)); + // SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadd_get_vximz", a, b, c)); SetFPRF(result, op.rc != 0); } @@ -4938,13 +5070,13 @@ void PPUTranslator::FNMADD(ppu_opcode_t op) SetFpr(op.frd, m_ir->CreateFNeg(result)); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadd_get_fr", a, b, c)); // TODO ??? - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadd_get_fi", a, b, c)); - //SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadd_get_ox", a, b, c)); - //SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadd_get_ux", a, b, c)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadd_get_vxsnan", a, b, c)); - //SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadd_get_vxisi", a, b, c)); - //SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadd_get_vximz", a, b, c)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fmadd_get_fr", a, b, c)); // TODO ??? + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fmadd_get_fi", a, b, c)); + // SetFPSCRException(m_fpscr_ox, Call(GetType(), m_pure_attr, "__fmadd_get_ox", a, b, c)); + // SetFPSCRException(m_fpscr_ux, Call(GetType(), m_pure_attr, "__fmadd_get_ux", a, b, c)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fmadd_get_vxsnan", a, b, c)); + // SetFPSCRException(m_fpscr_vxisi, Call(GetType(), m_pure_attr, "__fmadd_get_vxisi", a, b, c)); + // SetFPSCRException(m_fpscr_vximz, Call(GetType(), m_pure_attr, "__fmadd_get_vximz", a, b, c)); SetFPRF(result, op.rc != 0); } @@ -4958,8 +5090,8 @@ void PPUTranslator::FCMPO(ppu_opcode_t op) const auto un = m_ir->CreateFCmpUNO(a, b); SetCrField(op.crfd, lt, gt, eq, un); SetFPCC(lt, gt, eq, un); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fcmpo_get_vxsnan", a, b)); - //SetFPSCRException(m_fpscr_vxvc, Call(GetType(), m_pure_attr, "__fcmpo_get_vxvc", a, b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fcmpo_get_vxsnan", a, b)); + // SetFPSCRException(m_fpscr_vxvc, Call(GetType(), m_pure_attr, "__fcmpo_get_vxvc", a, b)); } void PPUTranslator::FNEG(ppu_opcode_t op) @@ -4967,28 +5099,32 @@ void PPUTranslator::FNEG(ppu_opcode_t op) const auto b = GetFpr(op.frb); SetFpr(op.frd, m_ir->CreateFNeg(b)); - if (op.rc) SetCrFieldFPCC(1); + if (op.rc) + SetCrFieldFPCC(1); } void PPUTranslator::FMR(ppu_opcode_t op) { SetFpr(op.frd, GetFpr(op.frb)); - if (op.rc) SetCrFieldFPCC(1); + if (op.rc) + SetCrFieldFPCC(1); } void PPUTranslator::FNABS(ppu_opcode_t op) { SetFpr(op.frd, m_ir->CreateFNeg(Call(GetType(), "llvm.fabs.f64", GetFpr(op.frb)))); - if (op.rc) SetCrFieldFPCC(1); + if (op.rc) + SetCrFieldFPCC(1); } void PPUTranslator::FABS(ppu_opcode_t op) { SetFpr(op.frd, Call(GetType(), "llvm.fabs.f64", GetFpr(op.frb))); - if (op.rc) SetCrFieldFPCC(1); + if (op.rc) + SetCrFieldFPCC(1); } void PPUTranslator::FCTID(ppu_opcode_t op) @@ -5003,13 +5139,12 @@ void PPUTranslator::FCTID(ppu_opcode_t op) SetFpr(op.frd, m_ir->CreateXor(xormask, Call(GetType(), "llvm.aarch64.neon.fcvtns.i64.f64", b))); #endif - - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fctid_get_fr", b)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fctid_get_fi", b)); - //SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fctid_get_vxsnan", b)); - //SetFPSCRException(m_fpscr_vxcvi, m_ir->CreateOr(sat_l, sat_h)); - //m_ir->CreateStore(GetUndef(), m_fpscr_c); - //SetFPCC(GetUndef(), GetUndef(), GetUndef(), GetUndef(), op.rc != 0); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fctid_get_fr", b)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fctid_get_fi", b)); + // SetFPSCRException(m_fpscr_vxsnan, Call(GetType(), m_pure_attr, "__fctid_get_vxsnan", b)); + // SetFPSCRException(m_fpscr_vxcvi, m_ir->CreateOr(sat_l, sat_h)); + // m_ir->CreateStore(GetUndef(), m_fpscr_c); + // SetFPCC(GetUndef(), GetUndef(), GetUndef(), GetUndef(), op.rc != 0); } void PPUTranslator::FCTIDZ(ppu_opcode_t op) @@ -5031,8 +5166,8 @@ void PPUTranslator::FCFID(ppu_opcode_t op) const auto result = m_ir->CreateSIToFP(b, GetType()); SetFpr(op.frd, result); - //SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fcfid_get_fr", b)); - //SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fcfid_get_fi", b)); + // SetFPSCR_FR(Call(GetType(), m_pure_attr, "__fcfid_get_fr", b)); + // SetFPSCR_FI(Call(GetType(), m_pure_attr, "__fcfid_get_fi", b)); SetFPRF(result, op.rc != 0); } @@ -5040,11 +5175,10 @@ void PPUTranslator::UNK(ppu_opcode_t op) { FlushRegisters(); Call(GetType(), "__error", m_thread, GetAddr(), m_ir->getInt32(op.opcode)); - //Call(GetType(), "__escape", m_thread)->setTailCall(); + // Call(GetType(), "__escape", m_thread)->setTailCall(); m_ir->CreateRetVoid(); } - Value* PPUTranslator::GetGpr(u32 r, u32 num_bits) { return Trunc(RegLoad(m_gpr[r]), m_ir->getIntNTy(num_bits)); @@ -5078,7 +5212,8 @@ void PPUTranslator::SetFpr(u32 r, Value* val) const auto f64_val = val->getType() == GetType() ? bitcast(SExt(val), GetType()) : val->getType() == GetType() ? bitcast(val, GetType()) : - val->getType() == GetType() ? m_ir->CreateFPExt(val, GetType()) : val; + val->getType() == GetType() ? m_ir->CreateFPExt(val, GetType()) : + val; RegStore(f64_val, m_fpr[r]); } @@ -5092,9 +5227,9 @@ Value* PPUTranslator::GetVr(u32 vr, VrType type) switch (type) { case VrType::vi32: _type = GetType(); break; - case VrType::vi8 : _type = GetType(); break; + case VrType::vi8: _type = GetType(); break; case VrType::vi16: _type = GetType(); break; - case VrType::vf : _type = GetType(); break; + case VrType::vf: _type = GetType(); break; case VrType::i128: _type = GetType(); break; default: ensure(false); } @@ -5170,65 +5305,67 @@ void PPUTranslator::SetFPCC(Value* lt, Value* gt, Value* eq, Value* un, bool set SetFPSCRBit(17, gt, false); SetFPSCRBit(18, eq, false); SetFPSCRBit(19, un, false); - if (set_cr) SetCrField(1, lt, gt, eq, un); + if (set_cr) + SetCrField(1, lt, gt, eq, un); } void PPUTranslator::SetFPRF(Value* value, bool /*set_cr*/) { - //const bool is32 = - value->getType()->isFloatTy() ? true : - value->getType()->isDoubleTy() ? false : ensure(false); + // const bool is32 = + value->getType()->isFloatTy() ? true : + value->getType()->isDoubleTy() ? false : + ensure(false); - //const auto zero = ConstantFP::get(value->getType(), 0.0); - //const auto is_nan = m_ir->CreateFCmpUNO(value, zero); - //const auto is_inf = Call(GetType(), m_pure_attr, is32 ? "__is_inf32" : "__is_inf", value); // TODO - //const auto is_denorm = Call(GetType(), m_pure_attr, is32 ? "__is_denorm32" : "__is_denorm", value); // TODO - //const auto is_neg_zero = Call(GetType(), m_pure_attr, is32 ? "__is_neg_zero32" : "__is_neg_zero", value); // TODO + // const auto zero = ConstantFP::get(value->getType(), 0.0); + // const auto is_nan = m_ir->CreateFCmpUNO(value, zero); + // const auto is_inf = Call(GetType(), m_pure_attr, is32 ? "__is_inf32" : "__is_inf", value); // TODO + // const auto is_denorm = Call(GetType(), m_pure_attr, is32 ? "__is_denorm32" : "__is_denorm", value); // TODO + // const auto is_neg_zero = Call(GetType(), m_pure_attr, is32 ? "__is_neg_zero32" : "__is_neg_zero", value); // TODO - //const auto cc = m_ir->CreateOr(is_nan, m_ir->CreateOr(is_denorm, is_neg_zero)); - //const auto lt = m_ir->CreateFCmpOLT(value, zero); - //const auto gt = m_ir->CreateFCmpOGT(value, zero); - //const auto eq = m_ir->CreateFCmpOEQ(value, zero); - //const auto un = m_ir->CreateOr(is_nan, is_inf); - //m_ir->CreateStore(cc, m_fpscr_c); - //SetFPCC(lt, gt, eq, un, set_cr); + // const auto cc = m_ir->CreateOr(is_nan, m_ir->CreateOr(is_denorm, is_neg_zero)); + // const auto lt = m_ir->CreateFCmpOLT(value, zero); + // const auto gt = m_ir->CreateFCmpOGT(value, zero); + // const auto eq = m_ir->CreateFCmpOEQ(value, zero); + // const auto un = m_ir->CreateOr(is_nan, is_inf); + // m_ir->CreateStore(cc, m_fpscr_c); + // SetFPCC(lt, gt, eq, un, set_cr); } void PPUTranslator::SetFPSCR_FR(Value* /*value*/) { - //m_ir->CreateStore(value, m_fpscr_fr); + // m_ir->CreateStore(value, m_fpscr_fr); } void PPUTranslator::SetFPSCR_FI(Value* /*value*/) { - //m_ir->CreateStore(value, m_fpscr_fi); - //SetFPSCRException(m_fpscr_xx, value); + // m_ir->CreateStore(value, m_fpscr_fi); + // SetFPSCRException(m_fpscr_xx, value); } void PPUTranslator::SetFPSCRException(Value* /*ptr*/, Value* /*value*/) { - //m_ir->CreateStore(m_ir->CreateOr(m_ir->CreateLoad(ptr), value), ptr); - //m_ir->CreateStore(m_ir->CreateOr(m_ir->CreateLoad(m_fpscr_fx), value), m_fpscr_fx); + // m_ir->CreateStore(m_ir->CreateOr(m_ir->CreateLoad(ptr), value), ptr); + // m_ir->CreateStore(m_ir->CreateOr(m_ir->CreateLoad(m_fpscr_fx), value), m_fpscr_fx); } Value* PPUTranslator::GetFPSCRBit(u32 n) { - //if (n == 1 && m_fpscr[24]) + // if (n == 1 && m_fpscr[24]) //{ // // Floating-Point Enabled Exception Summary (FEX) 24-29 // Value* value = m_ir->CreateLoad(m_fpscr[24]); // for (u32 i = 25; i <= 29; i++) value = m_ir->CreateOr(value, m_ir->CreateLoad(m_fpscr[i])); // return value; - //} + // } - //if (n == 2 && m_fpscr[7]) + // if (n == 2 && m_fpscr[7]) //{ // // Floating-Point Invalid Operation Exception Summary (VX) 7-12, 21-23 // Value* value = m_ir->CreateLoad(m_fpscr[7]); // for (u32 i = 8; i <= 12; i++) value = m_ir->CreateOr(value, m_ir->CreateLoad(m_fpscr[i])); // for (u32 i = 21; i <= 23; i++) value = m_ir->CreateOr(value, m_ir->CreateLoad(m_fpscr[i])); // return value; - //} + // } if (n < 16 || n > 19) { @@ -5238,11 +5375,11 @@ Value* PPUTranslator::GetFPSCRBit(u32 n) // Get bit const auto value = RegLoad(m_fc[n]); - //if (n == 0 || (n >= 3 && n <= 12) || (n >= 21 && n <= 23)) + // if (n == 0 || (n >= 3 && n <= 12) || (n >= 21 && n <= 23)) //{ // // Clear FX or exception bits // m_ir->CreateStore(m_ir->getFalse(), m_fpscr[n]); - //} + // } return value; } @@ -5251,22 +5388,22 @@ void PPUTranslator::SetFPSCRBit(u32 n, Value* value, bool /*update_fx*/) { if (n < 16 || n > 19) { - //CompilationError("SetFPSCRBit(): inaccessible bit " + std::to_string(n)); + // CompilationError("SetFPSCRBit(): inaccessible bit " + std::to_string(n)); return; // ??? } - //if (update_fx) + // if (update_fx) //{ // if ((n >= 3 && n <= 12) || (n >= 21 && n <= 23)) // { // // Update FX bit if necessary // m_ir->CreateStore(m_ir->CreateOr(m_ir->CreateLoad(m_fpscr_fx), value), m_fpscr_fx); // } - //} + // } - //if (n >= 24 && n <= 28) CompilationError("SetFPSCRBit: exception enable bit " + std::to_string(n)); - //if (n == 29) CompilationError("SetFPSCRBit: NI bit"); - //if (n >= 30) CompilationError("SetFPSCRBit: RN bit"); + // if (n >= 24 && n <= 28) CompilationError("SetFPSCRBit: exception enable bit " + std::to_string(n)); + // if (n == 29) CompilationError("SetFPSCRBit: NI bit"); + // if (n >= 30) CompilationError("SetFPSCRBit: RN bit"); // Store the bit RegStore(value, m_fc[n]); @@ -5309,11 +5446,16 @@ Value* PPUTranslator::CheckTrapCondition(u32 to, Value* left, Value* right) trap_condition = m_ir->CreateOr(trap_condition, cond); }; - if (to & 0x10) add_condition(m_ir->CreateICmpSLT(left, right)); - if (to & 0x8) add_condition(m_ir->CreateICmpSGT(left, right)); - if (to & 0x4) add_condition(m_ir->CreateICmpEQ(left, right)); - if (to & 0x2) add_condition(m_ir->CreateICmpULT(left, right)); - if (to & 0x1) add_condition(m_ir->CreateICmpUGT(left, right)); + if (to & 0x10) + add_condition(m_ir->CreateICmpSLT(left, right)); + if (to & 0x8) + add_condition(m_ir->CreateICmpSGT(left, right)); + if (to & 0x4) + add_condition(m_ir->CreateICmpEQ(left, right)); + if (to & 0x2) + add_condition(m_ir->CreateICmpULT(left, right)); + if (to & 0x1) + add_condition(m_ir->CreateICmpUGT(left, right)); return trap_condition ? trap_condition : m_ir->getFalse(); } @@ -5321,7 +5463,7 @@ Value* PPUTranslator::CheckTrapCondition(u32 to, Value* left, Value* right) void PPUTranslator::Trap() { Call(GetType(), "__trap", m_thread, GetAddr()); - //Call(GetType(), "__escape", m_thread)->setTailCall(); + // Call(GetType(), "__escape", m_thread)->setTailCall(); m_ir->CreateRetVoid(); } @@ -5336,13 +5478,15 @@ Value* PPUTranslator::CheckBranchCondition(u32 bo, u32 bi) const auto ctr = bo2 ? nullptr : m_ir->CreateSub(RegLoad(m_ctr), m_ir->getInt64(1)); // Store counter if necessary - if (ctr) RegStore(ctr, m_ctr); + if (ctr) + RegStore(ctr, m_ctr); // Generate counter condition const auto use_ctr = bo2 ? nullptr : m_ir->CreateICmp(bo3 ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE, ctr, m_ir->getInt64(0)); // Generate condition bit access - const auto use_cond = bo0 ? nullptr : bo1 ? GetCrb(bi) : m_ir->CreateNot(GetCrb(bi)); + const auto use_cond = bo0 ? nullptr : bo1 ? GetCrb(bi) : + m_ir->CreateNot(GetCrb(bi)); if (use_ctr && use_cond) { @@ -5371,22 +5515,23 @@ MDNode* PPUTranslator::CheckBranchProbability(u32 bo) void PPUTranslator::build_interpreter() { -#define BUILD_VEC_INST(i) { \ +#define BUILD_VEC_INST(i) \ + { \ m_function = llvm::cast(m_module->getOrInsertFunction("op_" #i, get_type(), m_thread_type->getPointerTo()).getCallee()); \ - std::fill(std::begin(m_globals), std::end(m_globals), nullptr); \ - std::fill(std::begin(m_locals), std::end(m_locals), nullptr); \ - IRBuilder<> irb(BasicBlock::Create(m_context, "__entry", m_function)); \ - m_ir = &irb; \ - m_thread = m_function->getArg(0); \ - ppu_opcode_t op{}; \ - op.vd = 0; \ - op.va = 1; \ - op.vb = 2; \ - op.vc = 3; \ - this->i(op); \ - FlushRegisters(); \ - m_ir->CreateRetVoid(); \ - run_transforms(*m_function); \ + std::fill(std::begin(m_globals), std::end(m_globals), nullptr); \ + std::fill(std::begin(m_locals), std::end(m_locals), nullptr); \ + IRBuilder<> irb(BasicBlock::Create(m_context, "__entry", m_function)); \ + m_ir = &irb; \ + m_thread = m_function->getArg(0); \ + ppu_opcode_t op{}; \ + op.vd = 0; \ + op.va = 1; \ + op.vb = 2; \ + op.vc = 3; \ + this->i(op); \ + FlushRegisters(); \ + m_ir->CreateRetVoid(); \ + run_transforms(*m_function); \ } BUILD_VEC_INST(VADDCUW); @@ -5545,8 +5690,6 @@ void PPUTranslator::build_interpreter() BUILD_VEC_INST(VUPKLSH); BUILD_VEC_INST(VXOR); #undef BUILD_VEC_INST - - } #endif diff --git a/rpcs3/rpcs3/Emu/Cell/PPUTranslator.h b/rpcs3/rpcs3/Emu/Cell/PPUTranslator.h index 010945656..bb0c54d19 100644 --- a/rpcs3/rpcs3/Emu/Cell/PPUTranslator.h +++ b/rpcs3/rpcs3/Emu/Cell/PPUTranslator.h @@ -75,25 +75,24 @@ class PPUTranslator final : public cpu_translator llvm::Value* nan_vec4; bool m_may_be_mmio = false; -#define DEF_VALUE(loc, glb, pos)\ - llvm::Value*& loc = m_locals[pos];\ +#define DEF_VALUE(loc, glb, pos) \ + llvm::Value*& loc = m_locals[pos]; \ llvm::Value*& glb = m_globals[pos]; - DEF_VALUE(m_lr, m_g_lr, 163) // LR, Link Register + DEF_VALUE(m_lr, m_g_lr, 163) // LR, Link Register DEF_VALUE(m_ctr, m_g_ctr, 164) // CTR, Counter Register DEF_VALUE(m_vrsave, m_g_vrsave, 165) DEF_VALUE(m_cia, m_g_cia, 166) - DEF_VALUE(m_so, m_g_so, 167) // XER.SO bit, summary overflow - DEF_VALUE(m_ov, m_g_ov, 168) // XER.OV bit, overflow flag - DEF_VALUE(m_ca, m_g_ca, 169) // XER.CA bit, carry flag - DEF_VALUE(m_cnt, m_g_cnt, 170) // XER.CNT - DEF_VALUE(m_nj, m_g_nj, 171) // VSCR.NJ bit, non-Java mode - DEF_VALUE(m_sat, m_g_sat, 173) // VSCR.SAT bit, sticky saturation flag + DEF_VALUE(m_so, m_g_so, 167) // XER.SO bit, summary overflow + DEF_VALUE(m_ov, m_g_ov, 168) // XER.OV bit, overflow flag + DEF_VALUE(m_ca, m_g_ca, 169) // XER.CA bit, carry flag + DEF_VALUE(m_cnt, m_g_cnt, 170) // XER.CNT + DEF_VALUE(m_nj, m_g_nj, 171) // VSCR.NJ bit, non-Java mode + DEF_VALUE(m_sat, m_g_sat, 173) // VSCR.SAT bit, sticky saturation flag DEF_VALUE(m_jm_mask, m_g_jm_mask, 174) // Java-Mode helper mask #undef DEF_VALUE public: - template value_t get_vr(u32 vr) { @@ -185,10 +184,10 @@ public: // Vector register type enum class VrType { - vi8, // i8 vector + vi8, // i8 vector vi16, // i16 vector vi32, // i32 vector - vf, // f32 vector + vf, // f32 vector i128, // Solid 128-bit integer }; @@ -202,10 +201,12 @@ public: llvm::Value* Solid(llvm::Value*); // Compare value with zero constant of appropriate size - llvm::Value* IsZero(llvm::Value*); llvm::Value* IsNotZero(llvm::Value*); + llvm::Value* IsZero(llvm::Value*); + llvm::Value* IsNotZero(llvm::Value*); // Compare value with all-ones constant of appropriate size - llvm::Value* IsOnes(llvm::Value*); llvm::Value* IsNotOnes(llvm::Value*); + llvm::Value* IsOnes(llvm::Value*); + llvm::Value* IsNotOnes(llvm::Value*); // Broadcast specified value llvm::Value* Broadcast(llvm::Value* value, u32 count); @@ -216,20 +217,22 @@ public: // Create sign extension (with double size if type is nullptr) llvm::Value* SExt(llvm::Value* value, llvm::Type* = nullptr); - template + template std::array SExt(std::array values, llvm::Type* type = nullptr) { - for (usz i = 0; i < N; i++) values[i] = SExt(values[i], type); + for (usz i = 0; i < N; i++) + values[i] = SExt(values[i], type); return values; } // Create zero extension (with double size if type is nullptr) llvm::Value* ZExt(llvm::Value*, llvm::Type* = nullptr); - template + template std::array ZExt(std::array values, llvm::Type* type = nullptr) { - for (usz i = 0; i < N; i++) values[i] = ZExt(values[i], type); + for (usz i = 0; i < N; i++) + values[i] = ZExt(values[i], type); return values; } @@ -312,14 +315,14 @@ public: void WriteMemory(llvm::Value* addr, llvm::Value* value, bool is_be = true, u32 align = 1); // Get an undefined value with specified type - template + template llvm::Value* GetUndef() { return llvm::UndefValue::get(GetType()); } // Call a function with attribute list - template + template llvm::CallInst* Call(llvm::Type* ret, llvm::AttributeList attr, llvm::StringRef name, Args... args) { // Call the function @@ -327,7 +330,7 @@ public: } // Call a function - template + template llvm::CallInst* Call(llvm::Type* ret, llvm::StringRef name, Args... args) { return Call(ret, llvm::AttributeList{}, name, args...); @@ -370,31 +373,70 @@ public: void VCFSX(ppu_opcode_t op); void VCFUX(ppu_opcode_t op); void VCMPBFP(ppu_opcode_t op); - void VCMPBFP_(ppu_opcode_t op) { return VCMPBFP(op); } + void VCMPBFP_(ppu_opcode_t op) + { + return VCMPBFP(op); + } void VCMPEQFP(ppu_opcode_t op); - void VCMPEQFP_(ppu_opcode_t op) { return VCMPEQFP(op); } + void VCMPEQFP_(ppu_opcode_t op) + { + return VCMPEQFP(op); + } void VCMPEQUB(ppu_opcode_t op); - void VCMPEQUB_(ppu_opcode_t op) { return VCMPEQUB(op); } + void VCMPEQUB_(ppu_opcode_t op) + { + return VCMPEQUB(op); + } void VCMPEQUH(ppu_opcode_t op); - void VCMPEQUH_(ppu_opcode_t op) { return VCMPEQUH(op); } + void VCMPEQUH_(ppu_opcode_t op) + { + return VCMPEQUH(op); + } void VCMPEQUW(ppu_opcode_t op); - void VCMPEQUW_(ppu_opcode_t op) { return VCMPEQUW(op); } + void VCMPEQUW_(ppu_opcode_t op) + { + return VCMPEQUW(op); + } void VCMPGEFP(ppu_opcode_t op); - void VCMPGEFP_(ppu_opcode_t op) { return VCMPGEFP(op); } + void VCMPGEFP_(ppu_opcode_t op) + { + return VCMPGEFP(op); + } void VCMPGTFP(ppu_opcode_t op); - void VCMPGTFP_(ppu_opcode_t op) { return VCMPGTFP(op); } + void VCMPGTFP_(ppu_opcode_t op) + { + return VCMPGTFP(op); + } void VCMPGTSB(ppu_opcode_t op); - void VCMPGTSB_(ppu_opcode_t op) { return VCMPGTSB(op); } + void VCMPGTSB_(ppu_opcode_t op) + { + return VCMPGTSB(op); + } void VCMPGTSH(ppu_opcode_t op); - void VCMPGTSH_(ppu_opcode_t op) { return VCMPGTSH(op); } + void VCMPGTSH_(ppu_opcode_t op) + { + return VCMPGTSH(op); + } void VCMPGTSW(ppu_opcode_t op); - void VCMPGTSW_(ppu_opcode_t op) { return VCMPGTSW(op); } + void VCMPGTSW_(ppu_opcode_t op) + { + return VCMPGTSW(op); + } void VCMPGTUB(ppu_opcode_t op); - void VCMPGTUB_(ppu_opcode_t op) { return VCMPGTUB(op); } + void VCMPGTUB_(ppu_opcode_t op) + { + return VCMPGTUB(op); + } void VCMPGTUH(ppu_opcode_t op); - void VCMPGTUH_(ppu_opcode_t op) { return VCMPGTUH(op); } + void VCMPGTUH_(ppu_opcode_t op) + { + return VCMPGTUH(op); + } void VCMPGTUW(ppu_opcode_t op); - void VCMPGTUW_(ppu_opcode_t op) { return VCMPGTUW(op); } + void VCMPGTUW_(ppu_opcode_t op) + { + return VCMPGTUW(op); + } void VCTSXS(ppu_opcode_t op); void VCTUXS(ppu_opcode_t op); void VEXPTEFP(ppu_opcode_t op); @@ -743,129 +785,492 @@ public: void UNK(ppu_opcode_t op); - void SUBFCO(ppu_opcode_t op) { return SUBFC(op); } - void ADDCO(ppu_opcode_t op) { return ADDC(op); } - void SUBFO(ppu_opcode_t op) { return SUBF(op); } - void NEGO(ppu_opcode_t op) { return NEG(op); } - void SUBFEO(ppu_opcode_t op) { return SUBFE(op); } - void ADDEO(ppu_opcode_t op) { return ADDE(op); } - void SUBFZEO(ppu_opcode_t op) { return SUBFZE(op); } - void ADDZEO(ppu_opcode_t op) { return ADDZE(op); } - void SUBFMEO(ppu_opcode_t op) { return SUBFME(op); } - void MULLDO(ppu_opcode_t op) { return MULLD(op); } - void ADDMEO(ppu_opcode_t op) { return ADDME(op); } - void MULLWO(ppu_opcode_t op) { return MULLW(op); } - void ADDO(ppu_opcode_t op) { return ADD(op); } - void DIVDUO(ppu_opcode_t op) { return DIVDU(op); } - void DIVWUO(ppu_opcode_t op) { return DIVWU(op); } - void DIVDO(ppu_opcode_t op) { return DIVD(op); } - void DIVWO(ppu_opcode_t op) { return DIVW(op); } + void SUBFCO(ppu_opcode_t op) + { + return SUBFC(op); + } + void ADDCO(ppu_opcode_t op) + { + return ADDC(op); + } + void SUBFO(ppu_opcode_t op) + { + return SUBF(op); + } + void NEGO(ppu_opcode_t op) + { + return NEG(op); + } + void SUBFEO(ppu_opcode_t op) + { + return SUBFE(op); + } + void ADDEO(ppu_opcode_t op) + { + return ADDE(op); + } + void SUBFZEO(ppu_opcode_t op) + { + return SUBFZE(op); + } + void ADDZEO(ppu_opcode_t op) + { + return ADDZE(op); + } + void SUBFMEO(ppu_opcode_t op) + { + return SUBFME(op); + } + void MULLDO(ppu_opcode_t op) + { + return MULLD(op); + } + void ADDMEO(ppu_opcode_t op) + { + return ADDME(op); + } + void MULLWO(ppu_opcode_t op) + { + return MULLW(op); + } + void ADDO(ppu_opcode_t op) + { + return ADD(op); + } + void DIVDUO(ppu_opcode_t op) + { + return DIVDU(op); + } + void DIVWUO(ppu_opcode_t op) + { + return DIVWU(op); + } + void DIVDO(ppu_opcode_t op) + { + return DIVD(op); + } + void DIVWO(ppu_opcode_t op) + { + return DIVW(op); + } - void SUBFCO_(ppu_opcode_t op) { return SUBFC(op); } - void ADDCO_(ppu_opcode_t op) { return ADDC(op); } - void SUBFO_(ppu_opcode_t op) { return SUBF(op); } - void NEGO_(ppu_opcode_t op) { return NEG(op); } - void SUBFEO_(ppu_opcode_t op) { return SUBFE(op); } - void ADDEO_(ppu_opcode_t op) { return ADDE(op); } - void SUBFZEO_(ppu_opcode_t op) { return SUBFZE(op); } - void ADDZEO_(ppu_opcode_t op) { return ADDZE(op); } - void SUBFMEO_(ppu_opcode_t op) { return SUBFME(op); } - void MULLDO_(ppu_opcode_t op) { return MULLD(op); } - void ADDMEO_(ppu_opcode_t op) { return ADDME(op); } - void MULLWO_(ppu_opcode_t op) { return MULLW(op); } - void ADDO_(ppu_opcode_t op) { return ADD(op); } - void DIVDUO_(ppu_opcode_t op) { return DIVDU(op); } - void DIVWUO_(ppu_opcode_t op) { return DIVWU(op); } - void DIVDO_(ppu_opcode_t op) { return DIVD(op); } - void DIVWO_(ppu_opcode_t op) { return DIVW(op); } + void SUBFCO_(ppu_opcode_t op) + { + return SUBFC(op); + } + void ADDCO_(ppu_opcode_t op) + { + return ADDC(op); + } + void SUBFO_(ppu_opcode_t op) + { + return SUBF(op); + } + void NEGO_(ppu_opcode_t op) + { + return NEG(op); + } + void SUBFEO_(ppu_opcode_t op) + { + return SUBFE(op); + } + void ADDEO_(ppu_opcode_t op) + { + return ADDE(op); + } + void SUBFZEO_(ppu_opcode_t op) + { + return SUBFZE(op); + } + void ADDZEO_(ppu_opcode_t op) + { + return ADDZE(op); + } + void SUBFMEO_(ppu_opcode_t op) + { + return SUBFME(op); + } + void MULLDO_(ppu_opcode_t op) + { + return MULLD(op); + } + void ADDMEO_(ppu_opcode_t op) + { + return ADDME(op); + } + void MULLWO_(ppu_opcode_t op) + { + return MULLW(op); + } + void ADDO_(ppu_opcode_t op) + { + return ADD(op); + } + void DIVDUO_(ppu_opcode_t op) + { + return DIVDU(op); + } + void DIVWUO_(ppu_opcode_t op) + { + return DIVWU(op); + } + void DIVDO_(ppu_opcode_t op) + { + return DIVD(op); + } + void DIVWO_(ppu_opcode_t op) + { + return DIVW(op); + } - void RLWIMI_(ppu_opcode_t op) { return RLWIMI(op); } - void RLWINM_(ppu_opcode_t op) { return RLWINM(op); } - void RLWNM_(ppu_opcode_t op) { return RLWNM(op); } - void RLDICL_(ppu_opcode_t op) { return RLDICL(op); } - void RLDICR_(ppu_opcode_t op) { return RLDICR(op); } - void RLDIC_(ppu_opcode_t op) { return RLDIC(op); } - void RLDIMI_(ppu_opcode_t op) { return RLDIMI(op); } - void RLDCL_(ppu_opcode_t op) { return RLDCL(op); } - void RLDCR_(ppu_opcode_t op) { return RLDCR(op); } - void SUBFC_(ppu_opcode_t op) { return SUBFC(op); } - void MULHDU_(ppu_opcode_t op) { return MULHDU(op); } - void ADDC_(ppu_opcode_t op) { return ADDC(op); } - void MULHWU_(ppu_opcode_t op) { return MULHWU(op); } - void SLW_(ppu_opcode_t op) { return SLW(op); } - void CNTLZW_(ppu_opcode_t op) { return CNTLZW(op); } - void SLD_(ppu_opcode_t op) { return SLD(op); } - void AND_(ppu_opcode_t op) { return AND(op); } - void SUBF_(ppu_opcode_t op) { return SUBF(op); } - void CNTLZD_(ppu_opcode_t op) { return CNTLZD(op); } - void ANDC_(ppu_opcode_t op) { return ANDC(op); } - void MULHD_(ppu_opcode_t op) { return MULHD(op); } - void MULHW_(ppu_opcode_t op) { return MULHW(op); } - void NEG_(ppu_opcode_t op) { return NEG(op); } - void NOR_(ppu_opcode_t op) { return NOR(op); } - void SUBFE_(ppu_opcode_t op) { return SUBFE(op); } - void ADDE_(ppu_opcode_t op) { return ADDE(op); } - void SUBFZE_(ppu_opcode_t op) { return SUBFZE(op); } - void ADDZE_(ppu_opcode_t op) { return ADDZE(op); } - void MULLD_(ppu_opcode_t op) { return MULLD(op); } - void SUBFME_(ppu_opcode_t op) { return SUBFME(op); } - void ADDME_(ppu_opcode_t op) { return ADDME(op); } - void MULLW_(ppu_opcode_t op) { return MULLW(op); } - void ADD_(ppu_opcode_t op) { return ADD(op); } - void EQV_(ppu_opcode_t op) { return EQV(op); } - void XOR_(ppu_opcode_t op) { return XOR(op); } - void ORC_(ppu_opcode_t op) { return ORC(op); } - void OR_(ppu_opcode_t op) { return OR(op); } - void DIVDU_(ppu_opcode_t op) { return DIVDU(op); } - void DIVWU_(ppu_opcode_t op) { return DIVWU(op); } - void NAND_(ppu_opcode_t op) { return NAND(op); } - void DIVD_(ppu_opcode_t op) { return DIVD(op); } - void DIVW_(ppu_opcode_t op) { return DIVW(op); } - void SRW_(ppu_opcode_t op) { return SRW(op); } - void SRD_(ppu_opcode_t op) { return SRD(op); } - void SRAW_(ppu_opcode_t op) { return SRAW(op); } - void SRAD_(ppu_opcode_t op) { return SRAD(op); } - void SRAWI_(ppu_opcode_t op) { return SRAWI(op); } - void SRADI_(ppu_opcode_t op) { return SRADI(op); } - void EXTSH_(ppu_opcode_t op) { return EXTSH(op); } - void EXTSB_(ppu_opcode_t op) { return EXTSB(op); } - void EXTSW_(ppu_opcode_t op) { return EXTSW(op); } - void FDIVS_(ppu_opcode_t op) { return FDIVS(op); } - void FSUBS_(ppu_opcode_t op) { return FSUBS(op); } - void FADDS_(ppu_opcode_t op) { return FADDS(op); } - void FSQRTS_(ppu_opcode_t op) { return FSQRTS(op); } - void FRES_(ppu_opcode_t op) { return FRES(op); } - void FMULS_(ppu_opcode_t op) { return FMULS(op); } - void FMADDS_(ppu_opcode_t op) { return FMADDS(op); } - void FMSUBS_(ppu_opcode_t op) { return FMSUBS(op); } - void FNMSUBS_(ppu_opcode_t op) { return FNMSUBS(op); } - void FNMADDS_(ppu_opcode_t op) { return FNMADDS(op); } - void MTFSB1_(ppu_opcode_t op) { return MTFSB1(op); } - void MTFSB0_(ppu_opcode_t op) { return MTFSB0(op); } - void MTFSFI_(ppu_opcode_t op) { return MTFSFI(op); } - void MFFS_(ppu_opcode_t op) { return MFFS(op); } - void MTFSF_(ppu_opcode_t op) { return MTFSF(op); } - void FRSP_(ppu_opcode_t op) { return FRSP(op); } - void FCTIW_(ppu_opcode_t op) { return FCTIW(op); } - void FCTIWZ_(ppu_opcode_t op) { return FCTIWZ(op); } - void FDIV_(ppu_opcode_t op) { return FDIV(op); } - void FSUB_(ppu_opcode_t op) { return FSUB(op); } - void FADD_(ppu_opcode_t op) { return FADD(op); } - void FSQRT_(ppu_opcode_t op) { return FSQRT(op); } - void FSEL_(ppu_opcode_t op) { return FSEL(op); } - void FMUL_(ppu_opcode_t op) { return FMUL(op); } - void FRSQRTE_(ppu_opcode_t op) { return FRSQRTE(op); } - void FMSUB_(ppu_opcode_t op) { return FMSUB(op); } - void FMADD_(ppu_opcode_t op) { return FMADD(op); } - void FNMSUB_(ppu_opcode_t op) { return FNMSUB(op); } - void FNMADD_(ppu_opcode_t op) { return FNMADD(op); } - void FNEG_(ppu_opcode_t op) { return FNEG(op); } - void FMR_(ppu_opcode_t op) { return FMR(op); } - void FNABS_(ppu_opcode_t op) { return FNABS(op); } - void FABS_(ppu_opcode_t op) { return FABS(op); } - void FCTID_(ppu_opcode_t op) { return FCTID(op); } - void FCTIDZ_(ppu_opcode_t op) { return FCTIDZ(op); } - void FCFID_(ppu_opcode_t op) { return FCFID(op); } + void RLWIMI_(ppu_opcode_t op) + { + return RLWIMI(op); + } + void RLWINM_(ppu_opcode_t op) + { + return RLWINM(op); + } + void RLWNM_(ppu_opcode_t op) + { + return RLWNM(op); + } + void RLDICL_(ppu_opcode_t op) + { + return RLDICL(op); + } + void RLDICR_(ppu_opcode_t op) + { + return RLDICR(op); + } + void RLDIC_(ppu_opcode_t op) + { + return RLDIC(op); + } + void RLDIMI_(ppu_opcode_t op) + { + return RLDIMI(op); + } + void RLDCL_(ppu_opcode_t op) + { + return RLDCL(op); + } + void RLDCR_(ppu_opcode_t op) + { + return RLDCR(op); + } + void SUBFC_(ppu_opcode_t op) + { + return SUBFC(op); + } + void MULHDU_(ppu_opcode_t op) + { + return MULHDU(op); + } + void ADDC_(ppu_opcode_t op) + { + return ADDC(op); + } + void MULHWU_(ppu_opcode_t op) + { + return MULHWU(op); + } + void SLW_(ppu_opcode_t op) + { + return SLW(op); + } + void CNTLZW_(ppu_opcode_t op) + { + return CNTLZW(op); + } + void SLD_(ppu_opcode_t op) + { + return SLD(op); + } + void AND_(ppu_opcode_t op) + { + return AND(op); + } + void SUBF_(ppu_opcode_t op) + { + return SUBF(op); + } + void CNTLZD_(ppu_opcode_t op) + { + return CNTLZD(op); + } + void ANDC_(ppu_opcode_t op) + { + return ANDC(op); + } + void MULHD_(ppu_opcode_t op) + { + return MULHD(op); + } + void MULHW_(ppu_opcode_t op) + { + return MULHW(op); + } + void NEG_(ppu_opcode_t op) + { + return NEG(op); + } + void NOR_(ppu_opcode_t op) + { + return NOR(op); + } + void SUBFE_(ppu_opcode_t op) + { + return SUBFE(op); + } + void ADDE_(ppu_opcode_t op) + { + return ADDE(op); + } + void SUBFZE_(ppu_opcode_t op) + { + return SUBFZE(op); + } + void ADDZE_(ppu_opcode_t op) + { + return ADDZE(op); + } + void MULLD_(ppu_opcode_t op) + { + return MULLD(op); + } + void SUBFME_(ppu_opcode_t op) + { + return SUBFME(op); + } + void ADDME_(ppu_opcode_t op) + { + return ADDME(op); + } + void MULLW_(ppu_opcode_t op) + { + return MULLW(op); + } + void ADD_(ppu_opcode_t op) + { + return ADD(op); + } + void EQV_(ppu_opcode_t op) + { + return EQV(op); + } + void XOR_(ppu_opcode_t op) + { + return XOR(op); + } + void ORC_(ppu_opcode_t op) + { + return ORC(op); + } + void OR_(ppu_opcode_t op) + { + return OR(op); + } + void DIVDU_(ppu_opcode_t op) + { + return DIVDU(op); + } + void DIVWU_(ppu_opcode_t op) + { + return DIVWU(op); + } + void NAND_(ppu_opcode_t op) + { + return NAND(op); + } + void DIVD_(ppu_opcode_t op) + { + return DIVD(op); + } + void DIVW_(ppu_opcode_t op) + { + return DIVW(op); + } + void SRW_(ppu_opcode_t op) + { + return SRW(op); + } + void SRD_(ppu_opcode_t op) + { + return SRD(op); + } + void SRAW_(ppu_opcode_t op) + { + return SRAW(op); + } + void SRAD_(ppu_opcode_t op) + { + return SRAD(op); + } + void SRAWI_(ppu_opcode_t op) + { + return SRAWI(op); + } + void SRADI_(ppu_opcode_t op) + { + return SRADI(op); + } + void EXTSH_(ppu_opcode_t op) + { + return EXTSH(op); + } + void EXTSB_(ppu_opcode_t op) + { + return EXTSB(op); + } + void EXTSW_(ppu_opcode_t op) + { + return EXTSW(op); + } + void FDIVS_(ppu_opcode_t op) + { + return FDIVS(op); + } + void FSUBS_(ppu_opcode_t op) + { + return FSUBS(op); + } + void FADDS_(ppu_opcode_t op) + { + return FADDS(op); + } + void FSQRTS_(ppu_opcode_t op) + { + return FSQRTS(op); + } + void FRES_(ppu_opcode_t op) + { + return FRES(op); + } + void FMULS_(ppu_opcode_t op) + { + return FMULS(op); + } + void FMADDS_(ppu_opcode_t op) + { + return FMADDS(op); + } + void FMSUBS_(ppu_opcode_t op) + { + return FMSUBS(op); + } + void FNMSUBS_(ppu_opcode_t op) + { + return FNMSUBS(op); + } + void FNMADDS_(ppu_opcode_t op) + { + return FNMADDS(op); + } + void MTFSB1_(ppu_opcode_t op) + { + return MTFSB1(op); + } + void MTFSB0_(ppu_opcode_t op) + { + return MTFSB0(op); + } + void MTFSFI_(ppu_opcode_t op) + { + return MTFSFI(op); + } + void MFFS_(ppu_opcode_t op) + { + return MFFS(op); + } + void MTFSF_(ppu_opcode_t op) + { + return MTFSF(op); + } + void FRSP_(ppu_opcode_t op) + { + return FRSP(op); + } + void FCTIW_(ppu_opcode_t op) + { + return FCTIW(op); + } + void FCTIWZ_(ppu_opcode_t op) + { + return FCTIWZ(op); + } + void FDIV_(ppu_opcode_t op) + { + return FDIV(op); + } + void FSUB_(ppu_opcode_t op) + { + return FSUB(op); + } + void FADD_(ppu_opcode_t op) + { + return FADD(op); + } + void FSQRT_(ppu_opcode_t op) + { + return FSQRT(op); + } + void FSEL_(ppu_opcode_t op) + { + return FSEL(op); + } + void FMUL_(ppu_opcode_t op) + { + return FMUL(op); + } + void FRSQRTE_(ppu_opcode_t op) + { + return FRSQRTE(op); + } + void FMSUB_(ppu_opcode_t op) + { + return FMSUB(op); + } + void FMADD_(ppu_opcode_t op) + { + return FMADD(op); + } + void FNMSUB_(ppu_opcode_t op) + { + return FNMSUB(op); + } + void FNMADD_(ppu_opcode_t op) + { + return FNMADD(op); + } + void FNEG_(ppu_opcode_t op) + { + return FNEG(op); + } + void FMR_(ppu_opcode_t op) + { + return FMR(op); + } + void FNABS_(ppu_opcode_t op) + { + return FNABS(op); + } + void FABS_(ppu_opcode_t op) + { + return FABS(op); + } + void FCTID_(ppu_opcode_t op) + { + return FCTID(op); + } + void FCTIDZ_(ppu_opcode_t op) + { + return FCTIDZ(op); + } + void FCFID_(ppu_opcode_t op) + { + return FCFID(op); + } void build_interpreter(); }; diff --git a/rpcs3/rpcs3/Emu/Cell/RawSPUThread.cpp b/rpcs3/rpcs3/Emu/Cell/RawSPUThread.cpp index 01041555e..be8d49782 100644 --- a/rpcs3/rpcs3/Emu/Cell/RawSPUThread.cpp +++ b/rpcs3/rpcs3/Emu/Cell/RawSPUThread.cpp @@ -14,15 +14,16 @@ inline void try_start(spu_thread& spu) reader_lock lock(spu.run_ctrl_mtx); if (spu.status_npc.fetch_op([](spu_thread::status_npc_sync_var& value) - { - if (value.status & SPU_STATUS_RUNNING) - { - return false; - } + { + if (value.status & SPU_STATUS_RUNNING) + { + return false; + } - value.status = SPU_STATUS_RUNNING | (value.status & SPU_STATUS_IS_ISOLATED); - return true; - }).second) + value.status = SPU_STATUS_RUNNING | (value.status & SPU_STATUS_IS_ISOLATED); + return true; + }) + .second) { spu.state -= cpu_flag::stop; notify = true; @@ -305,15 +306,15 @@ bool spu_thread::write_reg(const u32 addr, const u32 value) case SPU_NPC_offs: { status_npc.fetch_op([value = value & 0x3fffd](status_npc_sync_var& state) - { - if (!(state.status & SPU_STATUS_RUNNING)) { - state.npc = value; - return true; - } + if (!(state.status & SPU_STATUS_RUNNING)) + { + state.npc = value; + return true; + } - return false; - }); + return false; + }); return true; } @@ -400,7 +401,7 @@ void spu_load_exec(const spu_exec_object& elf) spu->status_npc = {SPU_STATUS_RUNNING, elf.header.e_entry}; atomic_storage::release(spu->pc, elf.header.e_entry); - const auto funcs = spu->discover_functions(0, { spu->ls , SPU_LS_SIZE }, true, umax); + const auto funcs = spu->discover_functions(0, {spu->ls, SPU_LS_SIZE}, true, umax); if (spu_log.notice && !funcs.empty()) { diff --git a/rpcs3/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp b/rpcs3/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp index 3eb75082a..94397eb76 100644 --- a/rpcs3/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp +++ b/rpcs3/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp @@ -133,8 +133,7 @@ spu_function_t spu_recompiler::compile(spu_program&& _func) this->qw1 = &x86::rcx; #endif - const std::array vec_vars - { + const std::array vec_vars{ &x86::xmm0, &x86::xmm1, &x86::xmm2, @@ -195,9 +194,9 @@ spu_function_t spu_recompiler::compile(spu_program&& _func) if (utils::has_avx()) { // How to check dirty AVX state - //c->pxor(x86::xmm0, x86::xmm0); - //c->vptest(x86::ymm0, x86::ymm0); - //c->jnz(label_stop); + // c->pxor(x86::xmm0, x86::xmm0); + // c->vptest(x86::ymm0, x86::ymm0); + // c->jnz(label_stop); } // Get bit mask of valid code words for a given range (up to 128 bytes) @@ -323,10 +322,10 @@ spu_function_t spu_recompiler::compile(spu_program&& _func) c->kmovw(x86::k7, x86::word_ptr(label)); consts.emplace_back([=, this] - { - c->bind(label); - c->dq(cmask); - }); + { + c->bind(label); + c->dq(cmask); + }); c->setExtraReg(x86::k7); c->z().vmovdqa32(x86::zmm0, x86::zmmword_ptr(*qw1, j - ls_off)); @@ -405,7 +404,8 @@ spu_function_t spu_recompiler::compile(spu_program&& _func) for (u32 i = starta; i < starta + 32; i += 4) { - words.push_back(i >= start ? func.data[(i - start) / 4] : i + 32 < end ? func.data[(i + 32 - start) / 4] : 0); + words.push_back(i >= start ? func.data[(i - start) / 4] : i + 32 < end ? func.data[(i + 32 - start) / 4] : + 0); } } else @@ -527,7 +527,8 @@ spu_function_t spu_recompiler::compile(spu_program&& _func) for (u32 i = starta; i < starta + 32; i += 4) { - words.push_back(i >= start ? func.data[(i - start) / 4] : i + 32 < end ? func.data[(i + 32 - start) / 4] : 0); + words.push_back(i >= start ? func.data[(i - start) / 4] : i + 32 < end ? func.data[(i + 32 - start) / 4] : + 0); } } else @@ -679,9 +680,8 @@ spu_function_t spu_recompiler::compile(spu_program&& _func) words.push_back(w3); // PSHUFD immediate table for all possible hole mask values, holes repeat highest valid word - static constexpr s32 s_pshufd_imm[16] - { - -1, // invalid index + static constexpr s32 s_pshufd_imm[16]{ + -1, // invalid index 0b00000000, // copy 0 0b01010101, // copy 1 0b01010100, // copy 1 @@ -771,7 +771,7 @@ spu_function_t spu_recompiler::compile(spu_program&& _func) for (u32 i = 0; i < func.data.size(); i++) { const u32 pos = start + i * 4; - const u32 op = std::bit_cast>(func.data[i]); + const u32 op = std::bit_cast>(func.data[i]); if (!op) { @@ -809,7 +809,7 @@ spu_function_t spu_recompiler::compile(spu_program&& _func) } // Tracing - //c->lea(x86::r14, get_pc(m_pos)); + // c->lea(x86::r14, get_pc(m_pos)); // Execute recompiler function (this->*s_spu_decoder.decode(op))({op}); @@ -932,7 +932,8 @@ spu_recompiler::XmmLink spu_recompiler::XmmAlloc() // get empty xmm register { for (auto& v : vec) { - if (v) return{ v }; + if (v) + return {v}; } fmt::throw_exception("Out of Xmm Vars"); @@ -963,12 +964,12 @@ inline asmjit::x86::Mem spu_recompiler::XmmConst(const v128& data) xmm_label = c->newLabel(); consts.emplace_back([=, this] - { - c->align(asmjit::AlignMode::kData, 16); - c->bind(xmm_label); - c->dq(data._u64[0]); - c->dq(data._u64[1]); - }); + { + c->align(asmjit::AlignMode::kData, 16); + c->bind(xmm_label); + c->dq(data._u64[0]); + c->dq(data._u64[1]); + }); } return asmjit::x86::oword_ptr(xmm_label); @@ -1189,24 +1190,24 @@ void spu_recompiler::branch_set_link(u32 target) c->mov(x86::dword_ptr(*qw1, 12), pc0->r32()); after.emplace_back([=, this, target = local->second] - { - // Clear return info after use - c->align(AlignMode::kCode, 16); - c->bind(ret); - c->mov(qw1->r32(), SPU_OFF_32(gpr, 1, &v128::_u32, 3)); - c->and_(qw1->r32(), 0x3fff0); - c->pcmpeqd(x86::xmm0, x86::xmm0); - c->movdqa(x86::dqword_ptr(*cpu, *qw1, 0, ::offset32(&spu_thread::stack_mirror)), x86::xmm0); - - // Set block hash for profiling (if enabled) - if (g_cfg.core.spu_prof) { - c->mov(x86::rax, m_hash_start | 0xffff); - c->mov(SPU_OFF_64(block_hash), x86::rax); - } + // Clear return info after use + c->align(AlignMode::kCode, 16); + c->bind(ret); + c->mov(qw1->r32(), SPU_OFF_32(gpr, 1, &v128::_u32, 3)); + c->and_(qw1->r32(), 0x3fff0); + c->pcmpeqd(x86::xmm0, x86::xmm0); + c->movdqa(x86::dqword_ptr(*cpu, *qw1, 0, ::offset32(&spu_thread::stack_mirror)), x86::xmm0); - c->jmp(target); - }); + // Set block hash for profiling (if enabled) + if (g_cfg.core.spu_prof) + { + c->mov(x86::rax, m_hash_start | 0xffff); + c->mov(SPU_OFF_64(block_hash), x86::rax); + } + + c->jmp(target); + }); } } } @@ -1356,16 +1357,16 @@ void spu_recompiler::RDCH(spu_opcode_t op) c->jnc(wait); after.emplace_back([=, this, pos = m_pos] - { - c->bind(wait); - c->lea(addr->r64(), get_pc(pos)); - c->and_(*addr, 0x3fffc); - c->mov(SPU_OFF_32(pc), *addr); - c->mov(arg1->r32(), +op.ra); - c->mov(*arg0, *cpu); - c->call(spu_rdch); - c->jmp(ret); - }); + { + c->bind(wait); + c->lea(addr->r64(), get_pc(pos)); + c->and_(*addr, 0x3fffc); + c->mov(SPU_OFF_32(pc), *addr); + c->mov(arg1->r32(), +op.ra); + c->mov(*arg0, *cpu); + c->call(spu_rdch); + c->jmp(ret); + }); if (sync) { @@ -1534,13 +1535,13 @@ void spu_recompiler::RCHCNT(spu_opcode_t op) switch (op.ra) { - case SPU_WrOutMbox: return ch_cnt(SPU_OFF_64(ch_out_mbox), true); - case SPU_WrOutIntrMbox: return ch_cnt(SPU_OFF_64(ch_out_intr_mbox), true); - case MFC_RdTagStat: return ch_cnt(SPU_OFF_64(ch_tag_stat)); + case SPU_WrOutMbox: return ch_cnt(SPU_OFF_64(ch_out_mbox), true); + case SPU_WrOutIntrMbox: return ch_cnt(SPU_OFF_64(ch_out_intr_mbox), true); + case MFC_RdTagStat: return ch_cnt(SPU_OFF_64(ch_tag_stat)); case MFC_RdListStallStat: return ch_cnt(SPU_OFF_64(ch_stall_stat)); - case SPU_RdSigNotify1: return ch_cnt(SPU_OFF_64(ch_snr1)); - case SPU_RdSigNotify2: return ch_cnt(SPU_OFF_64(ch_snr2)); - case MFC_RdAtomicStat: return ch_cnt(SPU_OFF_64(ch_atomic_stat)); + case SPU_RdSigNotify1: return ch_cnt(SPU_OFF_64(ch_snr1)); + case SPU_RdSigNotify2: return ch_cnt(SPU_OFF_64(ch_snr2)); + case MFC_RdAtomicStat: return ch_cnt(SPU_OFF_64(ch_atomic_stat)); case MFC_WrTagUpdate: { @@ -1861,7 +1862,7 @@ void spu_recompiler::SHL(spu_opcode_t op) } } -void spu_recompiler::ROTH(spu_opcode_t op) //nf +void spu_recompiler::ROTH(spu_opcode_t op) // nf { if (utils::has_avx512()) { @@ -1926,7 +1927,7 @@ void spu_recompiler::ROTHM(spu_opcode_t op) c->movdqa(vt, XmmConst(v128::from32p(0xffff0000))); // mask: select high words c->vpsrld(v4, vb, 16); c->vpsubusw(v5, vb, vt); // clear high words (using saturation sub for throughput) - c->vpandn(vb, vt, va); // clear high words + c->vpandn(vb, vt, va); // clear high words c->vpsrlvd(va, va, v4); c->vpsrlvd(vb, vb, v5); c->vpblendw(vt, vb, va, 0xaa); // can use vpblendvb with 0xffff0000 mask (vt) @@ -2045,7 +2046,7 @@ void spu_recompiler::SHLH(spu_opcode_t op) c->movdqa(vt, XmmConst(v128::from32p(0xffff0000))); // mask: select high words c->vpsrld(v4, vb, 16); c->vpsubusw(v5, vb, vt); // clear high words (using saturation sub for throughput) - c->vpand(vb, vt, va); // clear low words + c->vpand(vb, vt, va); // clear low words c->vpsllvd(va, va, v5); c->vpsllvd(vb, vb, v4); c->vpblendw(vt, vb, va, 0x55); @@ -2307,16 +2308,16 @@ void spu_recompiler::WRCH(spu_opcode_t op) c->jc(wait); after.emplace_back([=, this, pos = m_pos] - { - c->bind(wait); - c->lea(addr->r64(), get_pc(pos)); - c->and_(*addr, 0x3fffc); - c->mov(SPU_OFF_32(pc), *addr); - c->mov(arg1->r32(), +op.ra); - c->mov(*arg0, *cpu); - c->call(spu_wrch); - c->jmp(ret); - }); + { + c->bind(wait); + c->lea(addr->r64(), get_pc(pos)); + c->and_(*addr, 0x3fffc); + c->mov(SPU_OFF_32(pc), *addr); + c->mov(arg1->r32(), +op.ra); + c->mov(*arg0, *cpu); + c->call(spu_wrch); + c->jmp(ret); + }); c->bts(*qw0, spu_channel::off_count); c->lock().cmpxchg(SPU_OFF_64(ch_out_mbox), *qw0); @@ -2334,16 +2335,16 @@ void spu_recompiler::WRCH(spu_opcode_t op) c->jnz(upd); after.emplace_back([=, this, pos = m_pos] - { - c->bind(upd); - c->lea(addr->r64(), get_pc(pos)); - c->and_(*addr, 0x3fffc); - c->mov(SPU_OFF_32(pc), *addr); - c->mov(arg1->r32(), MFC_WrTagMask); - c->mov(*arg0, *cpu); - c->call(spu_wrch); - c->jmp(ret); - }); + { + c->bind(upd); + c->lea(addr->r64(), get_pc(pos)); + c->and_(*addr, 0x3fffc); + c->mov(SPU_OFF_32(pc), *addr); + c->mov(arg1->r32(), MFC_WrTagMask); + c->mov(*arg0, *cpu); + c->call(spu_wrch); + c->jmp(ret); + }); c->bind(ret); return; @@ -2358,20 +2359,20 @@ void spu_recompiler::WRCH(spu_opcode_t op) c->ja(fail); after.emplace_back([=, this, pos = m_pos] - { - c->bind(fail); - c->lea(addr->r64(), get_pc(pos)); - c->and_(*addr, 0x3fffc); - c->mov(SPU_OFF_32(pc), *addr); - c->mov(arg1->r32(), +op.ra); - c->mov(*arg0, *cpu); - c->call(spu_wrch); - c->jmp(ret); + { + c->bind(fail); + c->lea(addr->r64(), get_pc(pos)); + c->and_(*addr, 0x3fffc); + c->mov(SPU_OFF_32(pc), *addr); + c->mov(arg1->r32(), +op.ra); + c->mov(*arg0, *cpu); + c->call(spu_wrch); + c->jmp(ret); - c->bind(zero); - c->mov(SPU_OFF_32(ch_tag_upd), qw0->r32()); - c->jmp(ret); - }); + c->bind(zero); + c->mov(SPU_OFF_32(ch_tag_upd), qw0->r32()); + c->jmp(ret); + }); // addr = completed mask, will be compared with qw1 c->mov(*addr, SPU_OFF_32(mfc_fence)); @@ -2510,13 +2511,13 @@ void spu_recompiler::BIZ(spu_opcode_t op) c->je(branch_label); after.emplace_back([=, this, jt = m_targets[m_pos].size() > 1] - { - c->align(asmjit::AlignMode::kCode, 16); - c->bind(branch_label); - c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); - c->and_(*addr, 0x3fffc); - branch_indirect(op, jt); - }); + { + c->align(asmjit::AlignMode::kCode, 16); + c->bind(branch_label); + c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); + c->and_(*addr, 0x3fffc); + branch_indirect(op, jt); + }); } void spu_recompiler::BINZ(spu_opcode_t op) @@ -2526,13 +2527,13 @@ void spu_recompiler::BINZ(spu_opcode_t op) c->jne(branch_label); after.emplace_back([=, this, jt = m_targets[m_pos].size() > 1] - { - c->align(asmjit::AlignMode::kCode, 16); - c->bind(branch_label); - c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); - c->and_(*addr, 0x3fffc); - branch_indirect(op, jt); - }); + { + c->align(asmjit::AlignMode::kCode, 16); + c->bind(branch_label); + c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); + c->and_(*addr, 0x3fffc); + branch_indirect(op, jt); + }); } void spu_recompiler::BIHZ(spu_opcode_t op) @@ -2542,13 +2543,13 @@ void spu_recompiler::BIHZ(spu_opcode_t op) c->je(branch_label); after.emplace_back([=, this, jt = m_targets[m_pos].size() > 1] - { - c->align(asmjit::AlignMode::kCode, 16); - c->bind(branch_label); - c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); - c->and_(*addr, 0x3fffc); - branch_indirect(op, jt); - }); + { + c->align(asmjit::AlignMode::kCode, 16); + c->bind(branch_label); + c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); + c->and_(*addr, 0x3fffc); + branch_indirect(op, jt); + }); } void spu_recompiler::BIHNZ(spu_opcode_t op) @@ -2558,13 +2559,13 @@ void spu_recompiler::BIHNZ(spu_opcode_t op) c->jne(branch_label); after.emplace_back([=, this, jt = m_targets[m_pos].size() > 1] - { - c->align(asmjit::AlignMode::kCode, 16); - c->bind(branch_label); - c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); - c->and_(*addr, 0x3fffc); - branch_indirect(op, jt); - }); + { + c->align(asmjit::AlignMode::kCode, 16); + c->bind(branch_label); + c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); + c->and_(*addr, 0x3fffc); + branch_indirect(op, jt); + }); } void spu_recompiler::STOPD(spu_opcode_t) @@ -2662,12 +2663,12 @@ void spu_recompiler::BISLED(spu_opcode_t op) c->jne(branch_label); after.emplace_back([=, this]() - { - c->align(asmjit::AlignMode::kCode, 16); - c->bind(branch_label); - c->and_(*addr, 0x3fffc); - branch_indirect(op, true, false); - }); + { + c->align(asmjit::AlignMode::kCode, 16); + c->bind(branch_label); + c->and_(*addr, 0x3fffc); + branch_indirect(op, true, false); + }); } void spu_recompiler::HBR([[maybe_unused]] spu_opcode_t op) @@ -3065,7 +3066,7 @@ void spu_recompiler::ORX(spu_opcode_t op) void spu_recompiler::CBD(spu_opcode_t op) { - //if (op.ra == 1) + // if (op.ra == 1) //{ // // assuming that SP % 16 is always zero // const XmmLink& vr = XmmAlloc(); @@ -3074,10 +3075,11 @@ void spu_recompiler::CBD(spu_opcode_t op) // c->movdqa(vr, XmmConst(value)); // c->movdqa(SPU_OFF_128(gpr, op.rt), vr); // return; - //} + // } c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); - if (op.i7) c->add(*addr, +op.i7); + if (op.i7) + c->add(*addr, +op.i7); c->not_(*addr); c->and_(*addr, 0xf); @@ -3089,7 +3091,7 @@ void spu_recompiler::CBD(spu_opcode_t op) void spu_recompiler::CHD(spu_opcode_t op) { - //if (op.ra == 1) + // if (op.ra == 1) //{ // // assuming that SP % 16 is always zero // const XmmLink& vr = XmmAlloc(); @@ -3098,10 +3100,11 @@ void spu_recompiler::CHD(spu_opcode_t op) // c->movdqa(vr, XmmConst(value)); // c->movdqa(SPU_OFF_128(gpr, op.rt), vr); // return; - //} + // } c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); - if (op.i7) c->add(*addr, +op.i7); + if (op.i7) + c->add(*addr, +op.i7); c->not_(*addr); c->and_(*addr, 0xe); @@ -3113,7 +3116,7 @@ void spu_recompiler::CHD(spu_opcode_t op) void spu_recompiler::CWD(spu_opcode_t op) { - //if (op.ra == 1) + // if (op.ra == 1) //{ // // assuming that SP % 16 is always zero // const XmmLink& vr = XmmAlloc(); @@ -3122,10 +3125,11 @@ void spu_recompiler::CWD(spu_opcode_t op) // c->movdqa(vr, XmmConst(value)); // c->movdqa(SPU_OFF_128(gpr, op.rt), vr); // return; - //} + // } c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); - if (op.i7) c->add(*addr, +op.i7); + if (op.i7) + c->add(*addr, +op.i7); c->not_(*addr); c->and_(*addr, 0xc); @@ -3137,7 +3141,7 @@ void spu_recompiler::CWD(spu_opcode_t op) void spu_recompiler::CDD(spu_opcode_t op) { - //if (op.ra == 1) + // if (op.ra == 1) //{ // // assuming that SP % 16 is always zero // const XmmLink& vr = XmmAlloc(); @@ -3146,10 +3150,11 @@ void spu_recompiler::CDD(spu_opcode_t op) // c->movdqa(vr, XmmConst(value)); // c->movdqa(SPU_OFF_128(gpr, op.rt), vr); // return; - //} + // } c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); - if (op.i7) c->add(*addr, +op.i7); + if (op.i7) + c->add(*addr, +op.i7); c->not_(*addr); c->and_(*addr, 0x8); @@ -3324,15 +3329,15 @@ void spu_recompiler::HGT(spu_opcode_t op) c->jg(label); after.emplace_back([=, this, pos = m_pos] - { - c->bind(label); - c->lea(addr->r64(), get_pc(pos)); - c->and_(*addr, 0x3fffc); - c->mov(SPU_OFF_32(pc), *addr); - c->mov(addr->r64(), reinterpret_cast(vm::base(0xffdead00))); - c->mov(asmjit::x86::dword_ptr(addr->r64()), "HALT"_u32); - c->jmp(ret); - }); + { + c->bind(label); + c->lea(addr->r64(), get_pc(pos)); + c->and_(*addr, 0x3fffc); + c->mov(SPU_OFF_32(pc), *addr); + c->mov(addr->r64(), reinterpret_cast(vm::base(0xffdead00))); + c->mov(asmjit::x86::dword_ptr(addr->r64()), "HALT"_u32); + c->jmp(ret); + }); } void spu_recompiler::CLZ(spu_opcode_t op) @@ -3439,28 +3444,28 @@ void spu_recompiler::FCGT(spu_opcode_t op) c->pxor(tmp0, tmp0); c->pxor(tmp1, tmp1); - c->cmpps(tmp0, SPU_OFF_128(gpr, op.ra), 3); //tmp0 is true if a is extended (nan/inf) - c->cmpps(tmp1, SPU_OFF_128(gpr, op.rb), 3); //tmp1 is true if b is extended (nan/inf) + c->cmpps(tmp0, SPU_OFF_128(gpr, op.ra), 3); // tmp0 is true if a is extended (nan/inf) + c->cmpps(tmp1, SPU_OFF_128(gpr, op.rb), 3); // tmp1 is true if b is extended (nan/inf) - //compute lower a and b + // compute lower a and b c->movaps(tmp2, last_exp_bit); c->movaps(tmp3, last_exp_bit); - c->pandn(tmp2, SPU_OFF_128(gpr, op.ra)); //tmp2 = lowered_a - c->pandn(tmp3, SPU_OFF_128(gpr, op.rb)); //tmp3 = lowered_b + c->pandn(tmp2, SPU_OFF_128(gpr, op.ra)); // tmp2 = lowered_a + c->pandn(tmp3, SPU_OFF_128(gpr, op.rb)); // tmp3 = lowered_b - //lower a if extended + // lower a if extended c->movaps(tmpv, tmp0); c->pand(tmpv, tmp2); c->pandn(tmp0, SPU_OFF_128(gpr, op.ra)); c->orps(tmp0, tmpv); - //lower b if extended + // lower b if extended c->movaps(tmpv, tmp1); c->pand(tmpv, tmp3); c->pandn(tmp1, SPU_OFF_128(gpr, op.rb)); c->orps(tmp1, tmpv); - //flush to 0 if denormalized + // flush to 0 if denormalized c->pxor(tmpv, tmpv); c->movaps(tmp2, SPU_OFF_128(gpr, op.ra)); c->movaps(tmp3, SPU_OFF_128(gpr, op.rb)); @@ -3506,7 +3511,7 @@ void spu_recompiler::FM(spu_opcode_t op) const XmmLink& tmp4 = XmmGet(op.ra, XmmType::Float); const XmmLink& tmp5 = XmmGet(op.rb, XmmType::Float); - //check denormals + // check denormals c->pxor(tmp0, tmp0); c->movaps(tmp1, all_exp_bits); c->movaps(tmp2, all_exp_bits); @@ -3514,32 +3519,32 @@ void spu_recompiler::FM(spu_opcode_t op) c->andps(tmp2, tmp5); c->cmpps(tmp1, tmp0, 0); c->cmpps(tmp2, tmp0, 0); - c->orps(tmp1, tmp2); //denormal operand mask + c->orps(tmp1, tmp2); // denormal operand mask - //compute result with flushed denormal inputs + // compute result with flushed denormal inputs c->movaps(tmp2, tmp4); - c->mulps(tmp2, tmp5); //primary result + c->mulps(tmp2, tmp5); // primary result c->movaps(tmp3, tmp2); c->andps(tmp3, all_exp_bits); - c->cmpps(tmp3, tmp0, 0); //denom mask from result + c->cmpps(tmp3, tmp0, 0); // denom mask from result c->orps(tmp3, tmp1); - c->andnps(tmp3, tmp2); //flushed result + c->andnps(tmp3, tmp2); // flushed result - //compute results for the extended path + // compute results for the extended path c->andps(tmp2, all_exp_bits); - c->cmpps(tmp2, all_exp_bits, 0); //extended mask + c->cmpps(tmp2, all_exp_bits, 0); // extended mask c->movaps(tmp4, sign_bits); c->movaps(tmp5, sign_bits); c->movaps(tmp0, sign_bits); c->andps(tmp4, SPU_OFF_128(gpr, op.ra)); c->andps(tmp5, SPU_OFF_128(gpr, op.rb)); - c->xorps(tmp4, tmp5); //sign mask + c->xorps(tmp4, tmp5); // sign mask c->pandn(tmp0, tmp2); - c->orps(tmp4, tmp0); //add result sign back to original extended value - c->movaps(tmp5, tmp1); //denormal mask (operands) - c->andnps(tmp5, tmp4); //max_float with sign bit (nan/-nan) where not denormal or zero + c->orps(tmp4, tmp0); // add result sign back to original extended value + c->movaps(tmp5, tmp1); // denormal mask (operands) + c->andnps(tmp5, tmp4); // max_float with sign bit (nan/-nan) where not denormal or zero - //select result + // select result c->movaps(tmp0, tmp2); c->andnps(tmp0, tmp3); c->andps(tmp2, tmp5); @@ -3591,10 +3596,10 @@ void spu_recompiler::FCMGT(spu_opcode_t op) c->pxor(tmp0, tmp0); c->pxor(tmp1, tmp1); - c->cmpps(tmp0, SPU_OFF_128(gpr, op.ra), 3); //tmp0 is true if a is extended (nan/inf) - c->cmpps(tmp1, SPU_OFF_128(gpr, op.rb), 3); //tmp1 is true if b is extended (nan/inf) + c->cmpps(tmp0, SPU_OFF_128(gpr, op.ra), 3); // tmp0 is true if a is extended (nan/inf) + c->cmpps(tmp1, SPU_OFF_128(gpr, op.rb), 3); // tmp1 is true if b is extended (nan/inf) - //flush to 0 if denormalized + // flush to 0 if denormalized c->pxor(tmpv, tmpv); c->movaps(tmp2, SPU_OFF_128(gpr, op.ra)); c->movaps(tmp3, SPU_OFF_128(gpr, op.rb)); @@ -3605,15 +3610,15 @@ void spu_recompiler::FCMGT(spu_opcode_t op) c->pandn(tmp2, SPU_OFF_128(gpr, op.ra)); c->pandn(tmp3, SPU_OFF_128(gpr, op.rb)); - //Set tmp1 to true where a is extended but b is not extended - //This is a simplification since absolute values remove necessity of lowering - c->xorps(tmp0, tmp1); //tmp0 is true when either a or b is extended - c->pandn(tmp1, tmp0); //tmp1 is true if b is not extended and a is extended + // Set tmp1 to true where a is extended but b is not extended + // This is a simplification since absolute values remove necessity of lowering + c->xorps(tmp0, tmp1); // tmp0 is true when either a or b is extended + c->pandn(tmp1, tmp0); // tmp1 is true if b is not extended and a is extended c->andps(tmp2, remove_sign_bits); c->andps(tmp3, remove_sign_bits); c->cmpps(tmp3, tmp2, 1); - c->orps(tmp3, tmp1); //Force result to all true if a is extended but b is not + c->orps(tmp3, tmp1); // Force result to all true if a is extended but b is not c->movaps(SPU_OFF_128(gpr, op.rt), tmp3); } @@ -3665,15 +3670,15 @@ void spu_recompiler::HLGT(spu_opcode_t op) c->ja(label); after.emplace_back([=, this, pos = m_pos] - { - c->bind(label); - c->lea(addr->r64(), get_pc(pos)); - c->and_(*addr, 0x3fffc); - c->mov(SPU_OFF_32(pc), *addr); - c->mov(addr->r64(), reinterpret_cast(vm::base(0xffdead00))); - c->mov(asmjit::x86::dword_ptr(addr->r64()), "HALT"_u32); - c->jmp(ret); - }); + { + c->bind(label); + c->lea(addr->r64(), get_pc(pos)); + c->and_(*addr, 0x3fffc); + c->mov(SPU_OFF_32(pc), *addr); + c->mov(addr->r64(), reinterpret_cast(vm::base(0xffdead00))); + c->mov(asmjit::x86::dword_ptr(addr->r64()), "HALT"_u32); + c->jmp(ret); + }); } void spu_recompiler::DFMA(spu_opcode_t op) @@ -3753,7 +3758,7 @@ void spu_recompiler::SFX(spu_opcode_t op) c->movdqa(SPU_OFF_128(gpr, op.rt), vb); } -void spu_recompiler::CGX(spu_opcode_t op) //nf +void spu_recompiler::CGX(spu_opcode_t op) // nf { const XmmLink& vt = XmmGet(op.rt, XmmType::Int); const XmmLink& va = XmmGet(op.ra, XmmType::Int); @@ -3786,7 +3791,7 @@ void spu_recompiler::CGX(spu_opcode_t op) //nf c->movdqa(SPU_OFF_128(gpr, op.rt), res); } -void spu_recompiler::BGX(spu_opcode_t op) //nf +void spu_recompiler::BGX(spu_opcode_t op) // nf { const XmmLink& vt = XmmGet(op.rt, XmmType::Int); const XmmLink& va = XmmGet(op.ra, XmmType::Int); @@ -4010,7 +4015,7 @@ void spu_recompiler::FI(spu_opcode_t op) c->movdqa(temp_reg2, temp_reg); c->pand(temp_reg2, vb_base); - c->psrld(temp_reg2, 8); // only shift right by 8 if exponent is adjusted + c->psrld(temp_reg2, 8); // only shift right by 8 if exponent is adjusted c->xorps(vb_base, XmmConst(v128::from32p(0xFFFFFFFF))); // Invert the mask c->pand(temp_reg, vb_base); c->psrld(temp_reg, 9); // shift right by 9 if not adjusted @@ -4036,26 +4041,27 @@ void spu_recompiler::HEQ(spu_opcode_t op) c->je(label); after.emplace_back([=, this, pos = m_pos] - { - c->bind(label); - c->lea(addr->r64(), get_pc(pos)); - c->and_(*addr, 0x3fffc); - c->mov(SPU_OFF_32(pc), *addr); - c->mov(addr->r64(), reinterpret_cast(vm::base(0xffdead00))); - c->mov(asmjit::x86::dword_ptr(addr->r64()), "HALT"_u32); - c->jmp(ret); - }); + { + c->bind(label); + c->lea(addr->r64(), get_pc(pos)); + c->and_(*addr, 0x3fffc); + c->mov(SPU_OFF_32(pc), *addr); + c->mov(addr->r64(), reinterpret_cast(vm::base(0xffdead00))); + c->mov(asmjit::x86::dword_ptr(addr->r64()), "HALT"_u32); + c->jmp(ret); + }); } void spu_recompiler::CFLTS(spu_opcode_t op) { const XmmLink& va = XmmGet(op.ra, XmmType::Float); const XmmLink& vi = XmmAlloc(); - if (op.i8 != 173) c->mulps(va, XmmConst(v128::fromf32p(std::exp2(static_cast(static_cast(173 - op.i8)))))); // scale + if (op.i8 != 173) + c->mulps(va, XmmConst(v128::fromf32p(std::exp2(static_cast(static_cast(173 - op.i8)))))); // scale c->movaps(vi, XmmConst(v128::fromf32p(std::exp2(31.f)))); c->cmpps(vi, va, 2); c->cvttps2dq(va, va); // convert to ints with truncation - c->pxor(va, vi); // fix result saturation (0x80000000 -> 0x7fffffff) + c->pxor(va, vi); // fix result saturation (0x80000000 -> 0x7fffffff) c->movdqa(SPU_OFF_128(gpr, op.rt), va); } @@ -4065,7 +4071,8 @@ void spu_recompiler::CFLTU(spu_opcode_t op) const XmmLink& vs = XmmAlloc(); const XmmLink& vs2 = XmmAlloc(); const XmmLink& vs3 = XmmAlloc(); - if (op.i8 != 173) c->mulps(va, XmmConst(v128::fromf32p(std::exp2(static_cast(static_cast(173 - op.i8)))))); // scale + if (op.i8 != 173) + c->mulps(va, XmmConst(v128::fromf32p(std::exp2(static_cast(static_cast(173 - op.i8)))))); // scale if (utils::has_avx512()) { @@ -4097,7 +4104,8 @@ void spu_recompiler::CSFLT(spu_opcode_t op) { const XmmLink& va = XmmGet(op.ra, XmmType::Int); c->cvtdq2ps(va, va); // convert to floats - if (op.i8 != 155) c->mulps(va, XmmConst(v128::fromf32p(std::exp2(static_cast(static_cast(op.i8 - 155)))))); // scale + if (op.i8 != 155) + c->mulps(va, XmmConst(v128::fromf32p(std::exp2(static_cast(static_cast(op.i8 - 155)))))); // scale c->movaps(SPU_OFF_128(gpr, op.rt), va); } @@ -4114,13 +4122,14 @@ void spu_recompiler::CUFLT(spu_opcode_t op) { c->movdqa(v1, va); c->pand(va, XmmConst(v128::from32p(0x7fffffff))); - c->cvtdq2ps(va, va); // convert to floats - c->psrad(v1, 31); // generate mask from sign bit + c->cvtdq2ps(va, va); // convert to floats + c->psrad(v1, 31); // generate mask from sign bit c->andps(v1, XmmConst(v128::fromf32p(std::exp2(31.f)))); // generate correction component - c->addps(va, v1); // add correction component + c->addps(va, v1); // add correction component } - if (op.i8 != 155) c->mulps(va, XmmConst(v128::fromf32p(std::exp2(static_cast(static_cast(op.i8 - 155)))))); // scale + if (op.i8 != 155) + c->mulps(va, XmmConst(v128::fromf32p(std::exp2(static_cast(static_cast(op.i8 - 155)))))); // scale c->movaps(SPU_OFF_128(gpr, op.rt), va); } @@ -4138,11 +4147,11 @@ void spu_recompiler::BRZ(spu_opcode_t op) c->je(branch_label); after.emplace_back([=, this]() - { - c->align(asmjit::AlignMode::kCode, 16); - c->bind(branch_label); - branch_fixed(target); - }); + { + c->align(asmjit::AlignMode::kCode, 16); + c->bind(branch_label); + branch_fixed(target); + }); } void spu_recompiler::STQA(spu_opcode_t op) @@ -4178,11 +4187,11 @@ void spu_recompiler::BRNZ(spu_opcode_t op) c->jne(branch_label); after.emplace_back([=, this]() - { - c->align(asmjit::AlignMode::kCode, 16); - c->bind(branch_label); - branch_fixed(target); - }); + { + c->align(asmjit::AlignMode::kCode, 16); + c->bind(branch_label); + branch_fixed(target); + }); } void spu_recompiler::BRHZ(spu_opcode_t op) @@ -4199,11 +4208,11 @@ void spu_recompiler::BRHZ(spu_opcode_t op) c->je(branch_label); after.emplace_back([=, this]() - { - c->align(asmjit::AlignMode::kCode, 16); - c->bind(branch_label); - branch_fixed(target); - }); + { + c->align(asmjit::AlignMode::kCode, 16); + c->bind(branch_label); + branch_fixed(target); + }); } void spu_recompiler::BRHNZ(spu_opcode_t op) @@ -4220,11 +4229,11 @@ void spu_recompiler::BRHNZ(spu_opcode_t op) c->jne(branch_label); after.emplace_back([=, this]() - { - c->align(asmjit::AlignMode::kCode, 16); - c->bind(branch_label); - branch_fixed(target); - }); + { + c->align(asmjit::AlignMode::kCode, 16); + c->bind(branch_label); + branch_fixed(target); + }); } void spu_recompiler::STQR(spu_opcode_t op) @@ -4388,7 +4397,8 @@ void spu_recompiler::IOHL(spu_opcode_t op) void spu_recompiler::ORI(spu_opcode_t op) { const XmmLink& va = XmmGet(op.ra, XmmType::Int); - if (op.si10) c->por(va, XmmConst(v128::from32p(op.si10))); + if (op.si10) + c->por(va, XmmConst(v128::from32p(op.si10))); c->movdqa(SPU_OFF_128(gpr, op.rt), va); } @@ -4462,7 +4472,8 @@ void spu_recompiler::AHI(spu_opcode_t op) void spu_recompiler::STQD(spu_opcode_t op) { c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); - if (op.si10) c->add(*addr, op.si10 * 16); + if (op.si10) + c->add(*addr, op.si10 * 16); c->and_(*addr, 0x3fff0); if (utils::has_ssse3()) @@ -4485,7 +4496,8 @@ void spu_recompiler::STQD(spu_opcode_t op) void spu_recompiler::LQD(spu_opcode_t op) { c->mov(*addr, SPU_OFF_32(gpr, op.ra, &v128::_u32, 3)); - if (op.si10) c->add(*addr, op.si10 * 16); + if (op.si10) + c->add(*addr, op.si10 * 16); c->and_(*addr, 0x3fff0); if (utils::has_ssse3()) @@ -4557,15 +4569,15 @@ void spu_recompiler::HGTI(spu_opcode_t op) c->jg(label); after.emplace_back([=, this, pos = m_pos] - { - c->bind(label); - c->lea(addr->r64(), get_pc(pos)); - c->and_(*addr, 0x3fffc); - c->mov(SPU_OFF_32(pc), *addr); - c->mov(addr->r64(), reinterpret_cast(vm::base(0xffdead00))); - c->mov(asmjit::x86::dword_ptr(addr->r64()), "HALT"_u32); - c->jmp(ret); - }); + { + c->bind(label); + c->lea(addr->r64(), get_pc(pos)); + c->and_(*addr, 0x3fffc); + c->mov(SPU_OFF_32(pc), *addr); + c->mov(addr->r64(), reinterpret_cast(vm::base(0xffdead00))); + c->mov(asmjit::x86::dword_ptr(addr->r64()), "HALT"_u32); + c->jmp(ret); + }); } void spu_recompiler::CLGTI(spu_opcode_t op) @@ -4601,15 +4613,15 @@ void spu_recompiler::HLGTI(spu_opcode_t op) c->ja(label); after.emplace_back([=, this, pos = m_pos] - { - c->bind(label); - c->lea(addr->r64(), get_pc(pos)); - c->and_(*addr, 0x3fffc); - c->mov(SPU_OFF_32(pc), *addr); - c->mov(addr->r64(), reinterpret_cast(vm::base(0xffdead00))); - c->mov(asmjit::x86::dword_ptr(addr->r64()), "HALT"_u32); - c->jmp(ret); - }); + { + c->bind(label); + c->lea(addr->r64(), get_pc(pos)); + c->and_(*addr, 0x3fffc); + c->mov(SPU_OFF_32(pc), *addr); + c->mov(addr->r64(), reinterpret_cast(vm::base(0xffdead00))); + c->mov(asmjit::x86::dword_ptr(addr->r64()), "HALT"_u32); + c->jmp(ret); + }); } void spu_recompiler::MPYI(spu_opcode_t op) @@ -4663,15 +4675,15 @@ void spu_recompiler::HEQI(spu_opcode_t op) c->je(label); after.emplace_back([=, this, pos = m_pos] - { - c->bind(label); - c->lea(addr->r64(), get_pc(pos)); - c->and_(*addr, 0x3fffc); - c->mov(SPU_OFF_32(pc), *addr); - c->mov(addr->r64(), reinterpret_cast(vm::base(0xffdead00))); - c->mov(asmjit::x86::dword_ptr(addr->r64()), "HALT"_u32); - c->jmp(ret); - }); + { + c->bind(label); + c->lea(addr->r64(), get_pc(pos)); + c->and_(*addr, 0x3fffc); + c->mov(SPU_OFF_32(pc), *addr); + c->mov(addr->r64(), reinterpret_cast(vm::base(0xffdead00))); + c->mov(asmjit::x86::dword_ptr(addr->r64()), "HALT"_u32); + c->jmp(ret); + }); } void spu_recompiler::HBRA([[maybe_unused]] spu_opcode_t op) @@ -4783,7 +4795,7 @@ void spu_recompiler::SHUFB(spu_opcode_t op) c->pcmpgtb(vc, vm); c->pand(va, vc); c->pandn(vc, vb); - c->por(vc, va); // Select result value from va or vb + c->por(vc, va); // Select result value from va or vb c->pavgb(vt, v5); // Generate result constant: AVG(0xff, 0x00) == 0x80 c->por(vt, vc); } @@ -4818,8 +4830,8 @@ void spu_recompiler::FNMS(spu_opcode_t op) c->andps(vb, mask); c->cmpps(va, mask, 4); // va = ra == extended c->cmpps(vb, mask, 4); // vb = rb == extended - c->andps(va, v1); // va = ra & ~ra_extended - c->andps(vb, v2); // vb = rb & ~rb_extended + c->andps(va, v1); // va = ra & ~ra_extended + c->andps(vb, v2); // vb = rb & ~rb_extended c->mulps(va, vb); c->movaps(vb, SPU_OFF_128(gpr, op.rc)); @@ -4841,8 +4853,8 @@ void spu_recompiler::FMA(spu_opcode_t op) c->andps(vb, mask); c->cmpps(va, mask, 4); // va = ra == extended c->cmpps(vb, mask, 4); // vb = rb == extended - c->andps(va, v1); // va = ra & ~ra_extended - c->andps(vb, v2); // vb = rb & ~rb_extended + c->andps(va, v1); // va = ra & ~ra_extended + c->andps(vb, v2); // vb = rb & ~rb_extended c->mulps(va, vb); c->addps(va, SPU_OFF_128(gpr, op.rc)); @@ -4863,8 +4875,8 @@ void spu_recompiler::FMS(spu_opcode_t op) c->andps(vb, mask); c->cmpps(va, mask, 4); // va = ra == extended c->cmpps(vb, mask, 4); // vb = rb == extended - c->andps(va, v1); // va = ra & ~ra_extended - c->andps(vb, v2); // vb = rb & ~rb_extended + c->andps(va, v1); // va = ra & ~ra_extended + c->andps(vb, v2); // vb = rb & ~rb_extended c->mulps(va, vb); c->subps(va, SPU_OFF_128(gpr, op.rc)); diff --git a/rpcs3/rpcs3/Emu/Cell/SPUAnalyser.h b/rpcs3/rpcs3/Emu/Cell/SPUAnalyser.h index 103c655a9..58ea8d28f 100644 --- a/rpcs3/rpcs3/Emu/Cell/SPUAnalyser.h +++ b/rpcs3/rpcs3/Emu/Cell/SPUAnalyser.h @@ -3,16 +3,36 @@ // SPU Instruction Type struct spu_itype { - static constexpr struct memory_tag{} memory{}; // Memory Load/Store Instructions - static constexpr struct constant_tag{} constant{}; // Constant Formation Instructions - static constexpr struct integer_tag{} integer{}; // Integer and Logical Instructions - static constexpr struct shiftrot_tag{} shiftrot{}; // Shift and Rotate Instructions - static constexpr struct compare_tag{} compare{}; // Compare Instructions - static constexpr struct branch_tag{} branch{}; // Branch Instructions - static constexpr struct floating_tag{} floating{}; // Floating-Point Instructions - static constexpr struct quadrop_tag{} _quadrop{}; // 4-op Instructions - static constexpr struct xfloat_tag{} xfloat{}; // Instructions producing xfloat values - static constexpr struct zregmod_tag{} zregmod{}; // Instructions not modifying any GPR + static constexpr struct memory_tag + { + } memory{}; // Memory Load/Store Instructions + static constexpr struct constant_tag + { + } constant{}; // Constant Formation Instructions + static constexpr struct integer_tag + { + } integer{}; // Integer and Logical Instructions + static constexpr struct shiftrot_tag + { + } shiftrot{}; // Shift and Rotate Instructions + static constexpr struct compare_tag + { + } compare{}; // Compare Instructions + static constexpr struct branch_tag + { + } branch{}; // Branch Instructions + static constexpr struct floating_tag + { + } floating{}; // Floating-Point Instructions + static constexpr struct quadrop_tag + { + } _quadrop{}; // 4-op Instructions + static constexpr struct xfloat_tag + { + } xfloat{}; // Instructions producing xfloat values + static constexpr struct zregmod_tag + { + } zregmod{}; // Instructions not modifying any GPR enum class type : unsigned char { @@ -237,67 +257,67 @@ struct spu_itype using enum type; // Enable address-of operator for spu_decoder<> - friend constexpr type operator &(type value) + friend constexpr type operator&(type value) { return value; } // Test for branch instruction - friend constexpr bool operator &(type value, branch_tag) + friend constexpr bool operator&(type value, branch_tag) { return value >= BR && value <= BIHNZ; } // Test for floating point instruction - friend constexpr bool operator &(type value, floating_tag) + friend constexpr bool operator&(type value, floating_tag) { return value >= FMA && value <= DFTSV; } // Test for 4-op instruction - friend constexpr bool operator &(type value, quadrop_tag) + friend constexpr bool operator&(type value, quadrop_tag) { return value >= MPYA && value <= FMS; } // Test for xfloat instruction - friend constexpr bool operator &(type value, xfloat_tag) + friend constexpr bool operator&(type value, xfloat_tag) { return value >= FMA && value <= FRDS; } // Test for memory instruction - friend constexpr bool operator &(type value, memory_tag) + friend constexpr bool operator&(type value, memory_tag) { return value >= STQD && value <= LQR; } // Test for compare instruction - friend constexpr bool operator &(type value, compare_tag) + friend constexpr bool operator&(type value, compare_tag) { return value >= CEQB && value <= CLGTI; } // Test for integer instruction - friend constexpr bool operator &(type value, integer_tag) + friend constexpr bool operator&(type value, integer_tag) { return value >= AH && value <= SHUFB; } // Test for shift or rotate instruction - friend constexpr bool operator &(type value, shiftrot_tag) + friend constexpr bool operator&(type value, shiftrot_tag) { return value >= SHLH && value <= ROTMAI; } // Test for constant loading instruction - friend constexpr bool operator &(type value, constant_tag) + friend constexpr bool operator&(type value, constant_tag) { return value >= ILH && value <= FSMBI; } // Test for non register-modifying instruction - friend constexpr bool operator &(type value, zregmod_tag) + friend constexpr bool operator&(type value, zregmod_tag) { return value >= HEQ && value <= STQR; } @@ -522,7 +542,7 @@ struct spu_iflag }; // Enable address-of operator for spu_decoder<> - friend constexpr flag operator &(flag value) + friend constexpr flag operator&(flag value) { return value; } diff --git a/rpcs3/rpcs3/Emu/Cell/SPUCommonRecompiler.cpp b/rpcs3/rpcs3/Emu/Cell/SPUCommonRecompiler.cpp index e11cc7a81..c9c2a297a 100644 --- a/rpcs3/rpcs3/Emu/Cell/SPUCommonRecompiler.cpp +++ b/rpcs3/rpcs3/Emu/Cell/SPUCommonRecompiler.cpp @@ -35,7 +35,7 @@ const extern spu_decoder g_spu_iflag; constexpr u32 s_reg_max = spu_recompiler_base::s_reg_max; -template +template struct span_less { static int compare(const std::span& lhs, const std::span& rhs) noexcept @@ -256,11 +256,11 @@ DECLARE(spu_runtime::tr_all) = [] UNUSED(args); // Inputs: - // x19 = m_thread a.k.a arg[0] - // x20 = ls_base - // x21 - x22 = args[2 - 3] - //ensure(::offset32(&spu_thread::pc) <= 32760); - //ensure(::offset32(&spu_thread::block_hash) <= 32760); + // x19 = m_thread a.k.a arg[0] + // x20 = ls_base + // x21 - x22 = args[2 - 3] + // ensure(::offset32(&spu_thread::pc) <= 32760); + // ensure(::offset32(&spu_thread::block_hash) <= 32760); // Load PC c.ldr(a64::w1, arm::Mem(a64::x19, ::offset32(&spu_thread::pc))); // REG_Base + offset(spu_thread::pc) @@ -291,244 +291,244 @@ DECLARE(spu_runtime::tr_all) = [] }(); DECLARE(spu_runtime::g_gateway) = build_function_asm("spu_gateway", [](native_asm& c, auto& args) -{ - // Gateway for SPU dispatcher, converts from native to GHC calling convention, also saves RSP value for spu_escape - using namespace asmjit; + { + // Gateway for SPU dispatcher, converts from native to GHC calling convention, also saves RSP value for spu_escape + using namespace asmjit; #if defined(ARCH_X64) #ifdef _WIN32 - c.push(x86::r15); - c.push(x86::r14); - c.push(x86::r13); - c.push(x86::r12); - c.push(x86::rsi); - c.push(x86::rdi); - c.push(x86::rbp); - c.push(x86::rbx); - c.sub(x86::rsp, 0xa8); - c.movaps(x86::oword_ptr(x86::rsp, 0x90), x86::xmm15); - c.movaps(x86::oword_ptr(x86::rsp, 0x80), x86::xmm14); - c.movaps(x86::oword_ptr(x86::rsp, 0x70), x86::xmm13); - c.movaps(x86::oword_ptr(x86::rsp, 0x60), x86::xmm12); - c.movaps(x86::oword_ptr(x86::rsp, 0x50), x86::xmm11); - c.movaps(x86::oword_ptr(x86::rsp, 0x40), x86::xmm10); - c.movaps(x86::oword_ptr(x86::rsp, 0x30), x86::xmm9); - c.movaps(x86::oword_ptr(x86::rsp, 0x20), x86::xmm8); - c.movaps(x86::oword_ptr(x86::rsp, 0x10), x86::xmm7); - c.movaps(x86::oword_ptr(x86::rsp, 0), x86::xmm6); + c.push(x86::r15); + c.push(x86::r14); + c.push(x86::r13); + c.push(x86::r12); + c.push(x86::rsi); + c.push(x86::rdi); + c.push(x86::rbp); + c.push(x86::rbx); + c.sub(x86::rsp, 0xa8); + c.movaps(x86::oword_ptr(x86::rsp, 0x90), x86::xmm15); + c.movaps(x86::oword_ptr(x86::rsp, 0x80), x86::xmm14); + c.movaps(x86::oword_ptr(x86::rsp, 0x70), x86::xmm13); + c.movaps(x86::oword_ptr(x86::rsp, 0x60), x86::xmm12); + c.movaps(x86::oword_ptr(x86::rsp, 0x50), x86::xmm11); + c.movaps(x86::oword_ptr(x86::rsp, 0x40), x86::xmm10); + c.movaps(x86::oword_ptr(x86::rsp, 0x30), x86::xmm9); + c.movaps(x86::oword_ptr(x86::rsp, 0x20), x86::xmm8); + c.movaps(x86::oword_ptr(x86::rsp, 0x10), x86::xmm7); + c.movaps(x86::oword_ptr(x86::rsp, 0), x86::xmm6); #else - c.push(x86::rbp); - c.push(x86::r15); - c.push(x86::r14); - c.push(x86::r13); - c.push(x86::r12); - c.push(x86::rbx); - c.push(x86::rax); + c.push(x86::rbp); + c.push(x86::r15); + c.push(x86::r14); + c.push(x86::r13); + c.push(x86::r12); + c.push(x86::rbx); + c.push(x86::rax); #endif - // Save native stack pointer for longjmp emulation - c.mov(x86::qword_ptr(args[0], ::offset32(&spu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs)), x86::rsp); + // Save native stack pointer for longjmp emulation + c.mov(x86::qword_ptr(args[0], ::offset32(&spu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs)), x86::rsp); - // Move 4 args (despite spu_function_t def) - c.mov(x86::r13, args[0]); - c.mov(x86::rbp, args[1]); - c.mov(x86::r12, args[2]); - c.mov(x86::rbx, args[3]); + // Move 4 args (despite spu_function_t def) + c.mov(x86::r13, args[0]); + c.mov(x86::rbp, args[1]); + c.mov(x86::r12, args[2]); + c.mov(x86::rbx, args[3]); - if (utils::has_avx()) - { - c.vzeroupper(); - } + if (utils::has_avx()) + { + c.vzeroupper(); + } - c.call(spu_runtime::tr_all); + c.call(spu_runtime::tr_all); - if (utils::has_avx()) - { - c.vzeroupper(); - } + if (utils::has_avx()) + { + c.vzeroupper(); + } #ifdef _WIN32 - c.movaps(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); - c.movaps(x86::xmm7, x86::oword_ptr(x86::rsp, 0x10)); - c.movaps(x86::xmm8, x86::oword_ptr(x86::rsp, 0x20)); - c.movaps(x86::xmm9, x86::oword_ptr(x86::rsp, 0x30)); - c.movaps(x86::xmm10, x86::oword_ptr(x86::rsp, 0x40)); - c.movaps(x86::xmm11, x86::oword_ptr(x86::rsp, 0x50)); - c.movaps(x86::xmm12, x86::oword_ptr(x86::rsp, 0x60)); - c.movaps(x86::xmm13, x86::oword_ptr(x86::rsp, 0x70)); - c.movaps(x86::xmm14, x86::oword_ptr(x86::rsp, 0x80)); - c.movaps(x86::xmm15, x86::oword_ptr(x86::rsp, 0x90)); - c.add(x86::rsp, 0xa8); - c.pop(x86::rbx); - c.pop(x86::rbp); - c.pop(x86::rdi); - c.pop(x86::rsi); - c.pop(x86::r12); - c.pop(x86::r13); - c.pop(x86::r14); - c.pop(x86::r15); + c.movaps(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); + c.movaps(x86::xmm7, x86::oword_ptr(x86::rsp, 0x10)); + c.movaps(x86::xmm8, x86::oword_ptr(x86::rsp, 0x20)); + c.movaps(x86::xmm9, x86::oword_ptr(x86::rsp, 0x30)); + c.movaps(x86::xmm10, x86::oword_ptr(x86::rsp, 0x40)); + c.movaps(x86::xmm11, x86::oword_ptr(x86::rsp, 0x50)); + c.movaps(x86::xmm12, x86::oword_ptr(x86::rsp, 0x60)); + c.movaps(x86::xmm13, x86::oword_ptr(x86::rsp, 0x70)); + c.movaps(x86::xmm14, x86::oword_ptr(x86::rsp, 0x80)); + c.movaps(x86::xmm15, x86::oword_ptr(x86::rsp, 0x90)); + c.add(x86::rsp, 0xa8); + c.pop(x86::rbx); + c.pop(x86::rbp); + c.pop(x86::rdi); + c.pop(x86::rsi); + c.pop(x86::r12); + c.pop(x86::r13); + c.pop(x86::r14); + c.pop(x86::r15); #else - c.add(x86::rsp, +8); - c.pop(x86::rbx); - c.pop(x86::r12); - c.pop(x86::r13); - c.pop(x86::r14); - c.pop(x86::r15); - c.pop(x86::rbp); + c.add(x86::rsp, +8); + c.pop(x86::rbx); + c.pop(x86::r12); + c.pop(x86::r13); + c.pop(x86::r14); + c.pop(x86::r15); + c.pop(x86::rbp); #endif - c.ret(); + c.ret(); #elif defined(ARCH_ARM64) - // Save non-volatile regs. We do this within the thread context instead of normal stack - const u32 hv_regs_base = ::offset32(&spu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs); - // NOTE: A64 gp-gp-imm add only takes immediates of upto 4095. Larger numbers can work, but need to be multiples of 2 for lowering to replace the instruction correctly - // Unfortunately asmjit fails silently on these patterns which can generate incorrect code - c.mov(a64::x15, args[0]); - c.mov(a64::x14, Imm(hv_regs_base)); - c.add(a64::x14, a64::x14, a64::x15); // Reg context offset + // Save non-volatile regs. We do this within the thread context instead of normal stack + const u32 hv_regs_base = ::offset32(&spu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs); + // NOTE: A64 gp-gp-imm add only takes immediates of upto 4095. Larger numbers can work, but need to be multiples of 2 for lowering to replace the instruction correctly + // Unfortunately asmjit fails silently on these patterns which can generate incorrect code + c.mov(a64::x15, args[0]); + c.mov(a64::x14, Imm(hv_regs_base)); + c.add(a64::x14, a64::x14, a64::x15); // Reg context offset - // Return address of escape should jump to the restore block - auto epilogue_addr = c.newLabel(); - c.adr(a64::x15, epilogue_addr); - c.mov(a64::x16, a64::sp); + // Return address of escape should jump to the restore block + auto epilogue_addr = c.newLabel(); + c.adr(a64::x15, epilogue_addr); + c.mov(a64::x16, a64::sp); - c.stp(a64::x15, a64::x16, arm::Mem(a64::x14)); - c.stp(a64::x18, a64::x19, arm::Mem(a64::x14, 16)); - c.stp(a64::x20, a64::x21, arm::Mem(a64::x14, 32)); - c.stp(a64::x22, a64::x23, arm::Mem(a64::x14, 48)); - c.stp(a64::x24, a64::x25, arm::Mem(a64::x14, 64)); - c.stp(a64::x26, a64::x27, arm::Mem(a64::x14, 80)); - c.stp(a64::x28, a64::x29, arm::Mem(a64::x14, 96)); - c.str(a64::x30, arm::Mem(a64::x14, 112)); + c.stp(a64::x15, a64::x16, arm::Mem(a64::x14)); + c.stp(a64::x18, a64::x19, arm::Mem(a64::x14, 16)); + c.stp(a64::x20, a64::x21, arm::Mem(a64::x14, 32)); + c.stp(a64::x22, a64::x23, arm::Mem(a64::x14, 48)); + c.stp(a64::x24, a64::x25, arm::Mem(a64::x14, 64)); + c.stp(a64::x26, a64::x27, arm::Mem(a64::x14, 80)); + c.stp(a64::x28, a64::x29, arm::Mem(a64::x14, 96)); + c.str(a64::x30, arm::Mem(a64::x14, 112)); - // Move 4 args (despite spu_function_t def) - c.mov(a64::x19, args[0]); - c.mov(a64::x20, args[1]); - c.mov(a64::x21, args[2]); - c.mov(a64::x22, args[3]); + // Move 4 args (despite spu_function_t def) + c.mov(a64::x19, args[0]); + c.mov(a64::x20, args[1]); + c.mov(a64::x21, args[2]); + c.mov(a64::x22, args[3]); - // Inject stack frame for scratchpad. Alternatively use per-function frames but that adds some overhead - c.sub(a64::sp, a64::sp, Imm(8192)); + // Inject stack frame for scratchpad. Alternatively use per-function frames but that adds some overhead + c.sub(a64::sp, a64::sp, Imm(8192)); - c.mov(a64::x0, Imm(reinterpret_cast(spu_runtime::tr_all))); - c.blr(a64::x0); + c.mov(a64::x0, Imm(reinterpret_cast(spu_runtime::tr_all))); + c.blr(a64::x0); - // This is the return point for the far ret. Never jump back into host code without coming through this exit - c.bind(epilogue_addr); + // This is the return point for the far ret. Never jump back into host code without coming through this exit + c.bind(epilogue_addr); - // Cleanup scratchpad (not needed, we'll reload sp shortly) - // c.add(a64::sp, a64::sp, Imm(8192)); + // Cleanup scratchpad (not needed, we'll reload sp shortly) + // c.add(a64::sp, a64::sp, Imm(8192)); - // Restore thread context - c.mov(a64::x14, Imm(hv_regs_base)); - c.add(a64::x14, a64::x14, a64::x19); + // Restore thread context + c.mov(a64::x14, Imm(hv_regs_base)); + c.add(a64::x14, a64::x14, a64::x19); - c.ldr(a64::x16, arm::Mem(a64::x14, 8)); - c.ldp(a64::x18, a64::x19, arm::Mem(a64::x14, 16)); - c.ldp(a64::x20, a64::x21, arm::Mem(a64::x14, 32)); - c.ldp(a64::x22, a64::x23, arm::Mem(a64::x14, 48)); - c.ldp(a64::x24, a64::x25, arm::Mem(a64::x14, 64)); - c.ldp(a64::x26, a64::x27, arm::Mem(a64::x14, 80)); - c.ldp(a64::x28, a64::x29, arm::Mem(a64::x14, 96)); - c.ldr(a64::x30, arm::Mem(a64::x14, 112)); + c.ldr(a64::x16, arm::Mem(a64::x14, 8)); + c.ldp(a64::x18, a64::x19, arm::Mem(a64::x14, 16)); + c.ldp(a64::x20, a64::x21, arm::Mem(a64::x14, 32)); + c.ldp(a64::x22, a64::x23, arm::Mem(a64::x14, 48)); + c.ldp(a64::x24, a64::x25, arm::Mem(a64::x14, 64)); + c.ldp(a64::x26, a64::x27, arm::Mem(a64::x14, 80)); + c.ldp(a64::x28, a64::x29, arm::Mem(a64::x14, 96)); + c.ldr(a64::x30, arm::Mem(a64::x14, 112)); - // Return - c.mov(a64::sp, a64::x16); - c.ret(a64::x30); + // Return + c.mov(a64::sp, a64::x16); + c.ret(a64::x30); #else #error "Unimplemented" #endif -}); + }); -DECLARE(spu_runtime::g_escape) = build_function_asm("spu_escape", [](native_asm& c, auto& args) -{ - using namespace asmjit; +DECLARE(spu_runtime::g_escape) = build_function_asm("spu_escape", [](native_asm& c, auto& args) + { + using namespace asmjit; #if defined(ARCH_X64) - // Restore native stack pointer (longjmp emulation) - c.mov(x86::rsp, x86::qword_ptr(args[0], ::offset32(&spu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs))); + // Restore native stack pointer (longjmp emulation) + c.mov(x86::rsp, x86::qword_ptr(args[0], ::offset32(&spu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs))); - // Return to the return location - c.sub(x86::rsp, 8); - c.ret(); + // Return to the return location + c.sub(x86::rsp, 8); + c.ret(); #elif defined(ARCH_ARM64) - // Far ret, jumps to gateway epilogue - const u32 reg_base = ::offset32(&spu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs); - c.mov(a64::x19, args[0]); - c.mov(a64::x15, Imm(reg_base)); - c.add(a64::x15, a64::x15, args[0]); - c.ldr(a64::x30, arm::Mem(a64::x15)); - c.ret(a64::x30); + // Far ret, jumps to gateway epilogue + const u32 reg_base = ::offset32(&spu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs); + c.mov(a64::x19, args[0]); + c.mov(a64::x15, Imm(reg_base)); + c.add(a64::x15, a64::x15, args[0]); + c.ldr(a64::x30, arm::Mem(a64::x15)); + c.ret(a64::x30); #else #error "Unimplemented" #endif -}); + }); -DECLARE(spu_runtime::g_tail_escape) = build_function_asm("spu_tail_escape", [](native_asm& c, auto& args) -{ - using namespace asmjit; +DECLARE(spu_runtime::g_tail_escape) = build_function_asm("spu_tail_escape", [](native_asm& c, auto& args) + { + using namespace asmjit; #if defined(ARCH_X64) - // Restore native stack pointer (longjmp emulation) - c.mov(x86::rsp, x86::qword_ptr(args[0], ::offset32(&spu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs))); + // Restore native stack pointer (longjmp emulation) + c.mov(x86::rsp, x86::qword_ptr(args[0], ::offset32(&spu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs))); - // Adjust stack for initial call instruction in the gateway - c.sub(x86::rsp, 16); + // Adjust stack for initial call instruction in the gateway + c.sub(x86::rsp, 16); - // Tail call, GHC CC (second arg) - c.mov(x86::r13, args[0]); - c.mov(x86::rbp, x86::qword_ptr(args[0], ::offset32(&spu_thread::ls))); - c.mov(x86::r12, args[2]); - c.xor_(x86::ebx, x86::ebx); - c.mov(x86::qword_ptr(x86::rsp), args[1]); - c.ret(); + // Tail call, GHC CC (second arg) + c.mov(x86::r13, args[0]); + c.mov(x86::rbp, x86::qword_ptr(args[0], ::offset32(&spu_thread::ls))); + c.mov(x86::r12, args[2]); + c.xor_(x86::ebx, x86::ebx); + c.mov(x86::qword_ptr(x86::rsp), args[1]); + c.ret(); #elif defined(ARCH_ARM64) - // HV pointer - const u32 reg_base = ::offset32(&spu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs); + // HV pointer + const u32 reg_base = ::offset32(&spu_thread::hv_ctx, &rpcs3::hypervisor_context_t::regs); - // Tail call, GHC CC - c.mov(a64::x19, args[0]); // REG_Base - c.mov(a64::x15, Imm(::offset32(&spu_thread::ls))); // SPU::ls offset cannot be correctly encoded for ldr as it is too large - c.ldr(a64::x20, arm::Mem(a64::x19, a64::x15)); // REG_Sp - c.mov(a64::x21, args[2]); // REG_Hp - c.mov(a64::x22, a64::xzr); // REG_R1 + // Tail call, GHC CC + c.mov(a64::x19, args[0]); // REG_Base + c.mov(a64::x15, Imm(::offset32(&spu_thread::ls))); // SPU::ls offset cannot be correctly encoded for ldr as it is too large + c.ldr(a64::x20, arm::Mem(a64::x19, a64::x15)); // REG_Sp + c.mov(a64::x21, args[2]); // REG_Hp + c.mov(a64::x22, a64::xzr); // REG_R1 - // Reset sp to patch leaks. Calls to tail escape may leave their stack "dirty" due to optimizations. - c.mov(a64::x14, Imm(reg_base + 8)); - c.ldr(a64::x15, arm::Mem(a64::x19, a64::x14)); - c.mov(a64::sp, a64::x15); + // Reset sp to patch leaks. Calls to tail escape may leave their stack "dirty" due to optimizations. + c.mov(a64::x14, Imm(reg_base + 8)); + c.ldr(a64::x15, arm::Mem(a64::x19, a64::x14)); + c.mov(a64::sp, a64::x15); - // Push context. This gateway can be returned to normally through a ret chain. - // FIXME: Push the current PC and "this" as part of the pseudo-frame and return here directly. - c.sub(a64::sp, a64::sp, Imm(16)); - c.str(args[0], arm::Mem(a64::sp)); + // Push context. This gateway can be returned to normally through a ret chain. + // FIXME: Push the current PC and "this" as part of the pseudo-frame and return here directly. + c.sub(a64::sp, a64::sp, Imm(16)); + c.str(args[0], arm::Mem(a64::sp)); - // Allocate scratchpad. Not needed if using per-function frames, or if we just don't care about returning to C++ (jump to gw exit instead) - c.sub(a64::sp, a64::sp, Imm(8192)); + // Allocate scratchpad. Not needed if using per-function frames, or if we just don't care about returning to C++ (jump to gw exit instead) + c.sub(a64::sp, a64::sp, Imm(8192)); - // Make the far jump - c.mov(a64::x15, args[1]); - c.blr(a64::x15); + // Make the far jump + c.mov(a64::x15, args[1]); + c.blr(a64::x15); - // Clear scratch allocation - c.add(a64::sp, a64::sp, Imm(8192)); + // Clear scratch allocation + c.add(a64::sp, a64::sp, Imm(8192)); - // Restore context. Escape point expects the current thread pointer at x19 - c.ldr(a64::x19, arm::Mem(a64::sp)); - c.add(a64::sp, a64::sp, Imm(16)); + // Restore context. Escape point expects the current thread pointer at x19 + c.ldr(a64::x19, arm::Mem(a64::sp)); + c.add(a64::sp, a64::sp, Imm(16)); - // We could technically just emit a return here, but we may not want to for now until support is more mature. - // Should we attempt a normal return after this point, we'd be going back to C++ code which we really don't want. - // We can't guarantee stack sanity for the C++ code and it's cookies since we're basically treating stack as a scratch playground since we entered the main gateway. - // Instead, just fall back to hypervisor here. It also makes debugging easier. - c.mov(a64::x15, Imm(reg_base)); - c.ldr(a64::x30, arm::Mem(a64::x19, a64::x15)); - c.ret(a64::x30); + // We could technically just emit a return here, but we may not want to for now until support is more mature. + // Should we attempt a normal return after this point, we'd be going back to C++ code which we really don't want. + // We can't guarantee stack sanity for the C++ code and it's cookies since we're basically treating stack as a scratch playground since we entered the main gateway. + // Instead, just fall back to hypervisor here. It also makes debugging easier. + c.mov(a64::x15, Imm(reg_base)); + c.ldr(a64::x30, arm::Mem(a64::x19, a64::x15)); + c.ret(a64::x30); #else #error "Unimplemented" #endif -}); + }); DECLARE(spu_runtime::g_interpreter_table) = {}; @@ -574,7 +574,7 @@ extern void utilize_spu_data_segment(u32 vaddr, const void* ls_data_vaddr, u32 s spu_cache::precompile_data_t obj{vaddr, std::move(data)}; - obj.funcs = spu_thread::discover_functions(vaddr, { reinterpret_cast(ls_data_vaddr), size }, vaddr != 0, umax); + obj.funcs = spu_thread::discover_functions(vaddr, {reinterpret_cast(ls_data_vaddr), size}, vaddr != 0, umax); if (obj.funcs.empty()) { @@ -706,12 +706,10 @@ void spu_cache::add(const spu_program& func) // Add CRC (forced non-zero) size |= std::max(calculate_crc16(reinterpret_cast(func.data.data()), size * 4), 1) << 16; - const fs::iovec_clone gather[3] - { + const fs::iovec_clone gather[3]{ {&size, sizeof(size)}, {&addr, sizeof(addr)}, - {func.data.data(), func.data.size() * 4} - }; + {func.data.data(), func.data.size() * 4}}; // Append data m_file.write_gather(gather, 3); @@ -832,313 +830,312 @@ void spu_cache::initialize(bool build_existing_cache) } named_thread_group workers("SPU Worker ", worker_count, [&]() -> uint - { + { #ifdef __APPLE__ - pthread_jit_write_protect_np(false); + pthread_jit_write_protect_np(false); #endif - // Set low priority - thread_ctrl::scoped_priority low_prio(-1); + // Set low priority + thread_ctrl::scoped_priority low_prio(-1); - // Initialize compiler instances for parallel compilation - std::unique_ptr compiler; + // Initialize compiler instances for parallel compilation + std::unique_ptr compiler; - if (g_cfg.core.spu_decoder == spu_decoder_type::asmjit) - { - compiler = spu_recompiler_base::make_asmjit_recompiler(); - } - else if (g_cfg.core.spu_decoder == spu_decoder_type::llvm) - { - compiler = spu_recompiler_base::make_llvm_recompiler(); - } - - compiler->init(); - - // Counter for error reporting - u32 logged_error = 0; - - // How much every thread compiled - uint result = 0; - - // Fake LS - std::vector> ls(0x10000); - - usz func_i = fnext++; - - // Ensure some actions are performed on a single thread - const bool is_first_thread = func_i == 0; - - // Build functions - for (; func_i < func_list.size(); func_i = fnext++, (showing_progress ? g_progr_pdone : pending_progress) += build_existing_cache ? 1 : 0) - { - const spu_program& func = std::as_const(func_list)[func_i]; - - if (Emu.IsStopped() || fail_flag) + if (g_cfg.core.spu_decoder == spu_decoder_type::asmjit) { - continue; + compiler = spu_recompiler_base::make_asmjit_recompiler(); + } + else if (g_cfg.core.spu_decoder == spu_decoder_type::llvm) + { + compiler = spu_recompiler_base::make_llvm_recompiler(); } - // Get data start - const u32 start = func.lower_bound; - const u32 size0 = ::size32(func.data); + compiler->init(); - be_t hash_start; + // Counter for error reporting + u32 logged_error = 0; + + // How much every thread compiled + uint result = 0; + + // Fake LS + std::vector> ls(0x10000); + + usz func_i = fnext++; + + // Ensure some actions are performed on a single thread + const bool is_first_thread = func_i == 0; + + // Build functions + for (; func_i < func_list.size(); func_i = fnext++, (showing_progress ? g_progr_pdone : pending_progress) += build_existing_cache ? 1 : 0) { - sha1_context ctx; - u8 output[20]; + const spu_program& func = std::as_const(func_list)[func_i]; - sha1_starts(&ctx); - sha1_update(&ctx, reinterpret_cast(func.data.data()), func.data.size() * 4); - sha1_finish(&ctx, output); - std::memcpy(&hash_start, output, sizeof(hash_start)); - } - - // Check hash against allowed bounds - const bool inverse_bounds = g_cfg.core.spu_llvm_lower_bound > g_cfg.core.spu_llvm_upper_bound; - - if ((!inverse_bounds && (hash_start < g_cfg.core.spu_llvm_lower_bound || hash_start > g_cfg.core.spu_llvm_upper_bound)) || - (inverse_bounds && (hash_start < g_cfg.core.spu_llvm_lower_bound && hash_start > g_cfg.core.spu_llvm_upper_bound))) - { - spu_log.error("[Debug] Skipped function %s", fmt::base57(hash_start)); - result++; - continue; - } - - // Initialize LS with function data only - for (u32 i = 0, pos = start; i < size0; i++, pos += 4) - { - ls[pos / 4] = std::bit_cast>(func.data[i]); - } - - // Call analyser - spu_program func2 = compiler->analyse(ls.data(), func.entry_point); - - if (func2 != func) - { - spu_log.error("[0x%05x] SPU Analyser failed, %u vs %u", func2.entry_point, func2.data.size(), size0); - - if (logged_error < 2) + if (Emu.IsStopped() || fail_flag) { - std::string log; - compiler->dump(func, log); - spu_log.notice("[0x%05x] Function: %s", func.entry_point, log); - logged_error++; - } - } - else if (!compiler->compile(std::move(func2))) - { - // Likely, out of JIT memory. Signal to prevent further building. - fail_flag |= 1; - continue; - } - - // Clear fake LS - std::memset(ls.data() + start / 4, 0, 4 * (size0 - 1)); - - result++; - - if (is_first_thread && !showing_progress) - { - if (!g_progr_text && !g_progr_ptotal && !g_progr_ftotal) - { - showing_progress = true; - g_progr_pdone += pending_progress.exchange(0); - g_progr_ptotal += total_funcs; - progress_dialog.emplace(get_localized_string(localized_string_id::PROGRESS_DIALOG_BUILDING_SPU_CACHE)); - } - } - else if (showing_progress && pending_progress) - { - // Cover missing progress due to a race - g_progr_pdone += pending_progress.exchange(0); - } - } - - u32 last_sec_idx = umax; - - for (func_i = data_indexer++;; func_i = data_indexer++, (showing_progress ? g_progr_pdone : pending_progress) += build_existing_cache ? 1 : 0) - { - usz passed_count = 0; - u32 func_addr = 0; - u32 next_func = 0; - u32 sec_addr = umax; - u32 sec_idx = 0; - std::span inst_data; - - // Try to get the data this index points to - for (auto& sec : data_list) - { - if (func_i < passed_count + sec.funcs.size()) - { - const usz func_idx = func_i - passed_count; - sec_addr = sec.vaddr; - func_addr = ::at32(sec.funcs, func_idx); - inst_data = { sec.inst_data.data(), sec.inst_data.size() }; - next_func = sec.funcs.size() >= func_idx ? ::narrow(sec_addr + inst_data.size() * 4) : sec.funcs[func_idx]; - break; + continue; } - passed_count += sec.funcs.size(); - sec_idx++; - } + // Get data start + const u32 start = func.lower_bound; + const u32 size0 = ::size32(func.data); - if (sec_addr == umax) - { - // End of compilation for thread - break; - } - - if (Emu.IsStopped() || fail_flag) - { - continue; - } - - if (last_sec_idx != sec_idx) - { - if (last_sec_idx != umax) + be_t hash_start; { - // Clear fake LS of previous section - auto& sec = data_list[last_sec_idx]; - std::memset(ls.data() + sec.vaddr / 4, 0, sec.inst_data.size() * 4); + sha1_context ctx; + u8 output[20]; + + sha1_starts(&ctx); + sha1_update(&ctx, reinterpret_cast(func.data.data()), func.data.size() * 4); + sha1_finish(&ctx, output); + std::memcpy(&hash_start, output, sizeof(hash_start)); } - // Initialize LS with the entire section data - for (u32 i = 0, pos = sec_addr; i < inst_data.size(); i++, pos += 4) + // Check hash against allowed bounds + const bool inverse_bounds = g_cfg.core.spu_llvm_lower_bound > g_cfg.core.spu_llvm_upper_bound; + + if ((!inverse_bounds && (hash_start < g_cfg.core.spu_llvm_lower_bound || hash_start > g_cfg.core.spu_llvm_upper_bound)) || + (inverse_bounds && (hash_start < g_cfg.core.spu_llvm_lower_bound && hash_start > g_cfg.core.spu_llvm_upper_bound))) { - ls[pos / 4] = std::bit_cast>(inst_data[i]); + spu_log.error("[Debug] Skipped function %s", fmt::base57(hash_start)); + result++; + continue; } - last_sec_idx = sec_idx; - } + // Initialize LS with function data only + for (u32 i = 0, pos = start; i < size0; i++, pos += 4) + { + ls[pos / 4] = std::bit_cast>(func.data[i]); + } - u32 block_addr = func_addr; + // Call analyser + spu_program func2 = compiler->analyse(ls.data(), func.entry_point); - std::map> targets; + if (func2 != func) + { + spu_log.error("[0x%05x] SPU Analyser failed, %u vs %u", func2.entry_point, func2.data.size(), size0); - // Call analyser - spu_program func2 = compiler->analyse(ls.data(), block_addr, &targets); - - while (!func2.data.empty()) - { - const u32 last_inst = std::bit_cast>(func2.data.back()); - const u32 prog_size = ::size32(func2.data); - - if (!compiler->compile(std::move(func2))) + if (logged_error < 2) + { + std::string log; + compiler->dump(func, log); + spu_log.notice("[0x%05x] Function: %s", func.entry_point, log); + logged_error++; + } + } + else if (!compiler->compile(std::move(func2))) { // Likely, out of JIT memory. Signal to prevent further building. fail_flag |= 1; - break; + continue; } + // Clear fake LS + std::memset(ls.data() + start / 4, 0, 4 * (size0 - 1)); + result++; - const u32 start_new = block_addr + prog_size * 4; - - if (start_new >= next_func || (start_new == next_func - 4 && ls[start_new / 4] == 0x200000u)) + if (is_first_thread && !showing_progress) { - // Completed + if (!g_progr_text && !g_progr_ptotal && !g_progr_ftotal) + { + showing_progress = true; + g_progr_pdone += pending_progress.exchange(0); + g_progr_ptotal += total_funcs; + progress_dialog.emplace(get_localized_string(localized_string_id::PROGRESS_DIALOG_BUILDING_SPU_CACHE)); + } + } + else if (showing_progress && pending_progress) + { + // Cover missing progress due to a race + g_progr_pdone += pending_progress.exchange(0); + } + } + + u32 last_sec_idx = umax; + + for (func_i = data_indexer++;; func_i = data_indexer++, (showing_progress ? g_progr_pdone : pending_progress) += build_existing_cache ? 1 : 0) + { + usz passed_count = 0; + u32 func_addr = 0; + u32 next_func = 0; + u32 sec_addr = umax; + u32 sec_idx = 0; + std::span inst_data; + + // Try to get the data this index points to + for (auto& sec : data_list) + { + if (func_i < passed_count + sec.funcs.size()) + { + const usz func_idx = func_i - passed_count; + sec_addr = sec.vaddr; + func_addr = ::at32(sec.funcs, func_idx); + inst_data = {sec.inst_data.data(), sec.inst_data.size()}; + next_func = sec.funcs.size() >= func_idx ? ::narrow(sec_addr + inst_data.size() * 4) : sec.funcs[func_idx]; + break; + } + + passed_count += sec.funcs.size(); + sec_idx++; + } + + if (sec_addr == umax) + { + // End of compilation for thread break; } - if (auto type = g_spu_itype.decode(last_inst); - type == spu_itype::BRSL || type == spu_itype::BRASL || type == spu_itype::BISL || type == spu_itype::SYNC) + if (Emu.IsStopped() || fail_flag) { - if (ls[start_new / 4] && g_spu_itype.decode(ls[start_new / 4]) != spu_itype::UNK) + continue; + } + + if (last_sec_idx != sec_idx) + { + if (last_sec_idx != umax) { - spu_log.notice("Precompiling fallthrough to 0x%05x", start_new); - func2 = compiler->analyse(ls.data(), start_new, &targets); - block_addr = start_new; - continue; - } - } - - if (targets.empty()) - { - break; - } - - const auto upper = targets.upper_bound(func_addr); - - if (upper == targets.begin()) - { - break; - } - - u32 new_entry = umax; - - // Find the lowest target in the space in-between - for (auto it = std::prev(upper); it != targets.end() && it->first < start_new && new_entry > start_new; it++) - { - for (u32 target : it->second) - { - if (target >= start_new && target < next_func) - { - if (target < new_entry) - { - new_entry = target; - - if (new_entry == start_new) - { - // Cannot go lower - break; - } - } - } - } - } - - if (new_entry != umax && !spu_thread::is_exec_code(new_entry, { reinterpret_cast(ls.data()), SPU_LS_SIZE }, 0, true)) - { - new_entry = umax; - } - - if (new_entry == umax) - { - new_entry = start_new; - - while (new_entry < next_func && (ls[start_new / 4] < 0x3fffc || !spu_thread::is_exec_code(new_entry, { reinterpret_cast(ls.data()), SPU_LS_SIZE }, 0, true))) - { - new_entry += 4; + // Clear fake LS of previous section + auto& sec = data_list[last_sec_idx]; + std::memset(ls.data() + sec.vaddr / 4, 0, sec.inst_data.size() * 4); } - if (new_entry >= next_func || (new_entry == next_func - 4 && ls[new_entry / 4] == 0x200000u)) + // Initialize LS with the entire section data + for (u32 i = 0, pos = sec_addr; i < inst_data.size(); i++, pos += 4) + { + ls[pos / 4] = std::bit_cast>(inst_data[i]); + } + + last_sec_idx = sec_idx; + } + + u32 block_addr = func_addr; + + std::map> targets; + + // Call analyser + spu_program func2 = compiler->analyse(ls.data(), block_addr, &targets); + + while (!func2.data.empty()) + { + const u32 last_inst = std::bit_cast>(func2.data.back()); + const u32 prog_size = ::size32(func2.data); + + if (!compiler->compile(std::move(func2))) + { + // Likely, out of JIT memory. Signal to prevent further building. + fail_flag |= 1; + break; + } + + result++; + + const u32 start_new = block_addr + prog_size * 4; + + if (start_new >= next_func || (start_new == next_func - 4 && ls[start_new / 4] == 0x200000u)) { // Completed break; } + + if (auto type = g_spu_itype.decode(last_inst); + type == spu_itype::BRSL || type == spu_itype::BRASL || type == spu_itype::BISL || type == spu_itype::SYNC) + { + if (ls[start_new / 4] && g_spu_itype.decode(ls[start_new / 4]) != spu_itype::UNK) + { + spu_log.notice("Precompiling fallthrough to 0x%05x", start_new); + func2 = compiler->analyse(ls.data(), start_new, &targets); + block_addr = start_new; + continue; + } + } + + if (targets.empty()) + { + break; + } + + const auto upper = targets.upper_bound(func_addr); + + if (upper == targets.begin()) + { + break; + } + + u32 new_entry = umax; + + // Find the lowest target in the space in-between + for (auto it = std::prev(upper); it != targets.end() && it->first < start_new && new_entry > start_new; it++) + { + for (u32 target : it->second) + { + if (target >= start_new && target < next_func) + { + if (target < new_entry) + { + new_entry = target; + + if (new_entry == start_new) + { + // Cannot go lower + break; + } + } + } + } + } + + if (new_entry != umax && !spu_thread::is_exec_code(new_entry, {reinterpret_cast(ls.data()), SPU_LS_SIZE}, 0, true)) + { + new_entry = umax; + } + + if (new_entry == umax) + { + new_entry = start_new; + + while (new_entry < next_func && (ls[start_new / 4] < 0x3fffc || !spu_thread::is_exec_code(new_entry, {reinterpret_cast(ls.data()), SPU_LS_SIZE}, 0, true))) + { + new_entry += 4; + } + + if (new_entry >= next_func || (new_entry == next_func - 4 && ls[new_entry / 4] == 0x200000u)) + { + // Completed + break; + } + } + + spu_log.notice("Precompiling filler space at 0x%05x (next=0x%05x)", new_entry, next_func); + func2 = compiler->analyse(ls.data(), new_entry, &targets); + block_addr = new_entry; } - - spu_log.notice("Precompiling filler space at 0x%05x (next=0x%05x)", new_entry, next_func); - func2 = compiler->analyse(ls.data(), new_entry, &targets); - block_addr = new_entry; - } - - if (is_first_thread && !showing_progress) - { - if (!g_progr_text && !g_progr_ptotal && !g_progr_ftotal) + if (is_first_thread && !showing_progress) { - showing_progress = true; - g_progr_pdone += pending_progress.exchange(0); - g_progr_ptotal += total_funcs; + if (!g_progr_text && !g_progr_ptotal && !g_progr_ftotal) + { + showing_progress = true; + g_progr_pdone += pending_progress.exchange(0); + g_progr_ptotal += total_funcs; - progress_dialog.emplace(get_localized_string(localized_string_id::PROGRESS_DIALOG_BUILDING_SPU_CACHE)); + progress_dialog.emplace(get_localized_string(localized_string_id::PROGRESS_DIALOG_BUILDING_SPU_CACHE)); + } + } + else if (showing_progress && pending_progress) + { + // Cover missing progress due to a race + g_progr_pdone += pending_progress.exchange(0); } } - else if (showing_progress && pending_progress) + + if (showing_progress && pending_progress) { // Cover missing progress due to a race g_progr_pdone += pending_progress.exchange(0); } - } - if (showing_progress && pending_progress) - { - // Cover missing progress due to a race - g_progr_pdone += pending_progress.exchange(0); - } - - return result; - }); + return result; + }); u32 built_total = 0; @@ -1346,17 +1343,18 @@ spu_item* spu_runtime::add_empty(spu_program&& data) // Store previous item if already added spu_item* prev = nullptr; - //Try to add item that doesn't exist yet + // Try to add item that doesn't exist yet const auto ret = m_stuff[data.data[0] >> 12].push_if([&](spu_item& _new, spu_item& _old) - { - if (_new.data == _old.data) { - prev = &_old; - return false; - } + if (_new.data == _old.data) + { + prev = &_old; + return false; + } - return true; - }, std::move(data)); + return true; + }, + std::move(data)); if (ret) { @@ -1548,12 +1546,12 @@ spu_function_t spu_runtime::rebuild_ubertrampoline(u32 id_inst) workload.clear(); workload.reserve(size0); workload.emplace_back(); - workload.back().size = size0; + workload.back().size = size0; workload.back().level = 0; - workload.back().from = -1; + workload.back().from = -1; workload.back().rel32 = nullptr; - workload.back().beg = beg; - workload.back().end = _end; + workload.back().beg = beg; + workload.back().end = _end; // LS address starting from PC is already loaded into rcx (see spu_runtime::tr_all) @@ -1589,15 +1587,15 @@ spu_function_t spu_runtime::rebuild_ubertrampoline(u32 id_inst) // Resort subrange starting from the new level std::stable_sort(w.beg, w.end, [&](const auto& a, const auto& b) - { - std::span lhs = a.first; - std::span rhs = b.first; + { + std::span lhs = a.first; + std::span rhs = b.first; - lhs = lhs.subspan(w.level); - rhs = rhs.subspan(w.level); + lhs = lhs.subspan(w.level); + rhs = rhs.subspan(w.level); - return s_span_less(lhs, rhs); - }); + return s_span_less(lhs, rhs); + }); continue; } @@ -1799,10 +1797,10 @@ spu_function_t spu_runtime::rebuild_ubertrampoline(u32 id_inst) #error "Unimplemented" #endif auto& to = workload.emplace_back(w); - to.end = it; - to.size = size1; + to.end = it; + to.size = size1; to.rel32 = raw; - to.from = w.level; + to.from = w.level; } // Second subrange target @@ -1852,10 +1850,10 @@ spu_function_t spu_runtime::rebuild_ubertrampoline(u32 id_inst) #error "Unimplemented" #endif auto& to = workload.emplace_back(w); - to.beg = it2; - to.size = size2; + to.beg = it2; + to.size = size2; to.rel32 = raw; - to.from = w.level; + to.from = w.level; } const u32 size3 = w.size - size1 - size2; @@ -1881,11 +1879,11 @@ spu_function_t spu_runtime::rebuild_ubertrampoline(u32 id_inst) #error "Unimplemented" #endif auto& to = workload.emplace_back(w); - to.beg = it; - to.end = it2; - to.size = size3; + to.beg = it; + to.end = it2; + to.size = size3; to.rel32 = raw; - to.from = w.level; + to.from = w.level; } } else @@ -1898,10 +1896,10 @@ spu_function_t spu_runtime::rebuild_ubertrampoline(u32 id_inst) #error "Unimplemented" #endif auto& to = workload.emplace_back(w); - to.beg = it; - to.size = w.size - size1; + to.beg = it; + to.size = w.size - size1; to.rel32 = raw; - to.from = w.level; + to.from = w.level; } } } @@ -1945,8 +1943,7 @@ spu_function_t spu_runtime::rebuild_ubertrampoline(u32 id_inst) return result; } } - } - while (!insert_to.compare_exchange(_old, result)); + } while (!insert_to.compare_exchange(_old, result)); return result; } @@ -2346,16 +2343,18 @@ std::vector spu_thread::discover_functions(u32 base_addr, std::span addrs; @@ -2512,7 +2511,7 @@ std::vector spu_thread::discover_functions(u32 base_addr, std::span create(u32 pc) noexcept { - auto ptr = new block_reg_info{ pc, reg_state_t::make_unknown(pc) }; + auto ptr = new block_reg_info{pc, reg_state_t::make_unknown(pc)}; for (reg_state_t& f : ptr->local_state) { @@ -2861,7 +2859,7 @@ struct block_reg_info // In a manner in which no duplicate paths are formed static void create_node(u32 pc_rhs, u32 parent_pc, std::map>& map) { - //ensure(parent_node != pc_rhs); + // ensure(parent_node != pc_rhs); ensure(map[parent_pc]); if (!map[pc_rhs]) @@ -3073,7 +3071,8 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s { const u32 target = spu_branch_target(av); - spu_log.warning("[0x%x] At 0x%x: indirect branch to 0x%x%s", entry_point, pos, target, op.d ? " (D)" : op.e ? " (E)" : ""); + spu_log.warning("[0x%x] At 0x%x: indirect branch to 0x%x%s", entry_point, pos, target, op.d ? " (D)" : op.e ? " (E)" : + ""); if (type == spu_itype::BI && target == pos + 4 && op.d) { @@ -3221,16 +3220,16 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s } } else if (start + 12 * 4 < limit && - ls[start / 4 + 0] == 0x1ce00408u && - ls[start / 4 + 1] == 0x24000389u && - ls[start / 4 + 2] == 0x24004809u && - ls[start / 4 + 3] == 0x24008809u && - ls[start / 4 + 4] == 0x2400c809u && - ls[start / 4 + 5] == 0x24010809u && - ls[start / 4 + 6] == 0x24014809u && - ls[start / 4 + 7] == 0x24018809u && - ls[start / 4 + 8] == 0x1c200807u && - ls[start / 4 + 9] == 0x2401c809u) + ls[start / 4 + 0] == 0x1ce00408u && + ls[start / 4 + 1] == 0x24000389u && + ls[start / 4 + 2] == 0x24004809u && + ls[start / 4 + 3] == 0x24008809u && + ls[start / 4 + 4] == 0x2400c809u && + ls[start / 4 + 5] == 0x24010809u && + ls[start / 4 + 6] == 0x24014809u && + ls[start / 4 + 7] == 0x24018809u && + ls[start / 4 + 8] == 0x1c200807u && + ls[start / 4 + 9] == 0x2401c809u) { spu_log.warning("[0x%x] Pattern 1 detected (hbr=0x%x:0x%x)", pos, hbr_loc, hbr_tg); @@ -3436,21 +3435,21 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s case spu_itype::HBR: { hbr_loc = spu_branch_target(pos, op.roh << 7 | op.rt); - hbr_tg = vflags[op.ra] & vf::is_const && !op.c ? values[op.ra] & 0x3fffc : -1; + hbr_tg = vflags[op.ra] & vf::is_const && !op.c ? values[op.ra] & 0x3fffc : -1; break; } case spu_itype::HBRA: { hbr_loc = spu_branch_target(pos, op.r0h << 7 | op.rt); - hbr_tg = spu_branch_target(0x0, op.i16); + hbr_tg = spu_branch_target(0x0, op.i16); break; } case spu_itype::HBRR: { hbr_loc = spu_branch_target(pos, op.r0h << 7 | op.rt); - hbr_tg = spu_branch_target(pos, op.i16); + hbr_tg = spu_branch_target(pos, op.i16); break; } @@ -3701,7 +3700,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s { if (result.data[i] == 0) { - const u32 pos = lsa + i * 4; + const u32 pos = lsa + i * 4; const u32 data = ls[pos / 4]; // Allow only NOP or LNOP instructions in holes @@ -3760,9 +3759,9 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s // Erase impossible predecessors const auto new_end = std::remove_if(it->second.begin(), it->second.end(), [&](u32 addr) - { - return addr < lsa || addr >= limit; - }); + { + return addr < lsa || addr >= limit; + }); it->second.erase(new_end, it->second.end()); @@ -3820,12 +3819,12 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s } } - nnop = 0; + nnop = 0; vsize = i + 1; } else { - const u32 pos = lsa + i * 4; + const u32 pos = lsa + i * 4; const u32 data = ls[pos / 4]; if (data == 0x200000 || (data & 0xffffff80) == 0x40200000) @@ -3863,8 +3862,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s reg_save = op.rt; } - for (auto _use : std::initializer_list>{{op.ra, m_use_ra.test(ia / 4)} - , {op.rb, m_use_rb.test(ia / 4)}, {op.rc, m_use_rc.test(ia / 4)}}) + for (auto _use : std::initializer_list>{{op.ra, m_use_ra.test(ia / 4)}, {op.rb, m_use_rb.test(ia / 4)}, {op.rc, m_use_rc.test(ia / 4)}}) { if (_use.second) { @@ -4840,25 +4838,25 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s struct atomic16_t { - bool active = false; // GETLLAR happened - u32 lsa_pc = SPU_LS_SIZE; // PC of first LSA write - u32 lsa_last_pc = SPU_LS_SIZE; // PC of first LSA write - u32 get_pc = SPU_LS_SIZE; // PC of GETLLAR - u32 put_pc = SPU_LS_SIZE; // PC of PUTLLC - reg_state_t ls{}; // state of LS load/store address register + bool active = false; // GETLLAR happened + u32 lsa_pc = SPU_LS_SIZE; // PC of first LSA write + u32 lsa_last_pc = SPU_LS_SIZE; // PC of first LSA write + u32 get_pc = SPU_LS_SIZE; // PC of GETLLAR + u32 put_pc = SPU_LS_SIZE; // PC of PUTLLC + reg_state_t ls{}; // state of LS load/store address register reg_state_t ls_offs = reg_state_t::from_value(0); // Added value to ls - reg_state_t lsa{}; // state of LSA register on GETLLAR - reg_state_t ls_reg[8]{}; // stores/loads using register bundles with offset - reg_state_t ls_abs[8]{}; // stores/loads using absolute address - u32 reg = s_reg_max; // Source of address register of LS load/store - u32 reg2 = s_reg_max; // Source 2 of address register of LS load/store (STQX/LQX) - //u32 ls_offs[8]{}; // LS offset from register (0 if const) - bool ls_pc_rel = false; // For STQR/LQR - bool ls_access = false; // LS accessed - bool ls_write = false; // LS written + reg_state_t lsa{}; // state of LSA register on GETLLAR + reg_state_t ls_reg[8]{}; // stores/loads using register bundles with offset + reg_state_t ls_abs[8]{}; // stores/loads using absolute address + u32 reg = s_reg_max; // Source of address register of LS load/store + u32 reg2 = s_reg_max; // Source 2 of address register of LS load/store (STQX/LQX) + // u32 ls_offs[8]{}; // LS offset from register (0 if const) + bool ls_pc_rel = false; // For STQR/LQR + bool ls_access = false; // LS accessed + bool ls_write = false; // LS written bool ls_invalid = false; // From this point and on, any store will cancel the optimization bool select_16_or_0_at_runtime = false; - bool put_active = false; // PUTLLC happened + bool put_active = false; // PUTLLC happened bool get_rdatomic = false; // True if MFC_RdAtomicStat was read after GETLLAR u32 mem_count = 0; @@ -4894,16 +4892,16 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s struct rchcnt_loop_t { - bool active = false; // RDCH/RCHCNT happened - bool failed = false; // needc this flag to distinguish start of the pattern vs failed pattern (they begin and end of the same address) + bool active = false; // RDCH/RCHCNT happened + bool failed = false; // needc this flag to distinguish start of the pattern vs failed pattern (they begin and end of the same address) bool conditioned = false; // needc this flag to distinguish start of the pattern vs failed pattern (they begin and end of the same address) u32 channel = 128; - u32 read_pc = SPU_LS_SIZE; // PC of RDCH or RCHCNT (that encloses the loop) - reg_state_t ch_state{+vf::is_null}; // Channel stat, example: RCNCNT ch_state, MFC_Cmd + u32 read_pc = SPU_LS_SIZE; // PC of RDCH or RCHCNT (that encloses the loop) + reg_state_t ch_state{+vf::is_null}; // Channel stat, example: RCNCNT ch_state, MFC_Cmd reg_state_t ch_product{+vf::is_null}; // Optional comparison state for channl state, example: CEQI ch_product, ch_state, 1 - bool product_test_negate = false; // Compare the opposite way, such as: CEQI ch_product, ch_state, 0 which turns 0 t -1 and 1 to 0 + bool product_test_negate = false; // Compare the opposite way, such as: CEQI ch_product, ch_state, 0 which turns 0 t -1 and 1 to 0 std::vector origins; - u32 branch_pc = SPU_LS_SIZE; // Where the loop branch is located + u32 branch_pc = SPU_LS_SIZE; // Where the loop branch is located u32 branch_target = SPU_LS_SIZE; // The target of the loop branch // Return old state for error reporting @@ -4938,18 +4936,16 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s rchcnt_loop_t rchcnt_loop{}; block_reg_state_iterator(u32 _pc, usz _parent_iterator_index = umax, usz _parent_target_index = 0) noexcept - : pc(_pc) - , parent_iterator_index(_parent_iterator_index) - , parent_target_index(_parent_target_index) + : pc(_pc), parent_iterator_index(_parent_iterator_index), parent_target_index(_parent_target_index) { } }; std::vector reg_state_it; - std::map atomic16_all; // RdAtomicStat location -> atomic loop optimization state + std::map atomic16_all; // RdAtomicStat location -> atomic loop optimization state std::map rchcnt_loop_all; // RDCH/RCHCNT location -> channel read loop optimization state - std::map getllar_starts; // True for failed loops + std::map getllar_starts; // True for failed loops std::map run_on_block; std::map logged_block; @@ -4996,9 +4992,9 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s enum spu_addr_mask_t : u32 { SPU_LS_MASK_128 = (SPU_LS_SIZE - 1) & -128, - SPU_LS_MASK_16 = (SPU_LS_SIZE - 1) & -16, - SPU_LS_MASK_4 = (SPU_LS_SIZE - 1) & -4, - SPU_LS_MASK_1 = (SPU_LS_SIZE - 1), + SPU_LS_MASK_16 = (SPU_LS_SIZE - 1) & -16, + SPU_LS_MASK_4 = (SPU_LS_SIZE - 1) & -4, + SPU_LS_MASK_1 = (SPU_LS_SIZE - 1), }; u32 iterator_id_alloc = 0; @@ -5033,7 +5029,8 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s for (auto& [pc, _] : infos) { - if (!_) continue; + if (!_) + continue; fmt::append(out, " [0x%x]", pc); } @@ -5498,7 +5495,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s else { // Should not be reachable at the moment - //ensure(false); + // ensure(false); spu_log.error("Failed to clean block analyis steps at block_id %d", reg_state_it[it].iterator_id); } } @@ -5552,7 +5549,8 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s if (!infos.empty()) { - reg_state_it.emplace_back(::at32(infos, entry_point)->pc).iterator_id = iterator_id_alloc++;; + reg_state_it.emplace_back(::at32(infos, entry_point)->pc).iterator_id = iterator_id_alloc++; + ; } } } @@ -5718,8 +5716,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s std::string consts; - for (auto _use : std::initializer_list>{{op.ra, m_use_ra.test(pos / 4)} - , {op.rb, m_use_rb.test(pos / 4)}, {op.rc, m_use_rc.test(pos / 4)}}) + for (auto _use : std::initializer_list>{{op.ra, m_use_ra.test(pos / 4)}, {op.rb, m_use_rb.test(pos / 4)}, {op.rc, m_use_rc.test(pos / 4)}}) { if (!_use.second) { @@ -6066,7 +6063,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s else if (atomic16->ls_offs.compare_with_mask_indifference(atomic16->lsa, SPU_LS_MASK_128) && atomic16->ls.is_less_than(128 - (atomic16->ls_offs.value & 127))) { // Relative memory access with offset less than 128 bytes - // Common around SPU utilities which have less strict restrictions about memory alignment + // Common around SPU utilities which have less strict restrictions about memory alignment ok = true; } } @@ -6132,7 +6129,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s case SPU_PM_Start_Ev: case SPU_PM_Stop_Ev: case MFC_WrTagMask: - //case MFC_WrTagUpdate: // Technically correct to ignore but risky + // case MFC_WrTagUpdate: // Technically correct to ignore but risky break; default: { @@ -6281,43 +6278,43 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s case SPU_RdSigNotify1: case SPU_RdSigNotify2: case SPU_RdInMbox: - //case SPU_RdEventStat: - { - if (is_read) + // case SPU_RdEventStat: { - break_putllc16(28, atomic16->discard()); - } - else - { - break_putllc16(29, atomic16->discard()); - } - - if (!is_pattern_match || is_read) - { - // - } - else if (!rchcnt_loop->active && it == rchcnt_loop_all.end()) - { - rchcnt_loop->read_pc = pos; - rchcnt_loop->channel = op.ra; - rchcnt_loop->active = true; - unconst(op.rt, pos); - rchcnt_loop->ch_state = vregs[op.rt]; - invalidate = false; - } - else if (rchcnt_loop->active) - { - // Success - rchcnt_loop->active = false; - - if (it == rchcnt_loop_all.end()) + if (is_read) { - rchcnt_loop_all.emplace(pos, *rchcnt_loop); + break_putllc16(28, atomic16->discard()); + } + else + { + break_putllc16(29, atomic16->discard()); } - } - break; - } + if (!is_pattern_match || is_read) + { + // + } + else if (!rchcnt_loop->active && it == rchcnt_loop_all.end()) + { + rchcnt_loop->read_pc = pos; + rchcnt_loop->channel = op.ra; + rchcnt_loop->active = true; + unconst(op.rt, pos); + rchcnt_loop->ch_state = vregs[op.rt]; + invalidate = false; + } + else if (rchcnt_loop->active) + { + // Success + rchcnt_loop->active = false; + + if (it == rchcnt_loop_all.end()) + { + rchcnt_loop_all.emplace(pos, *rchcnt_loop); + } + } + + break; + } default: { break; @@ -6340,29 +6337,29 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s { atomic16->mem_count++; - // Do not clear lower 16 bytes addressing because the program can move on 4-byte basis + // Do not clear lower 16 bytes addressing because the program can move on 4-byte basis const u32 offs = spu_branch_target(pos - result.lower_bound, op.si16); if (atomic16->lsa.is_const() && [&]() - { - bool hack = false; - - if (offs % 16 == 0 && (pos - result.lower_bound + op.si16 * 4) == offs) { - const u32 reservation_bound = (atomic16->lsa.value | 127); - const u32 min_offs = offs; + bool hack = false; - // Hack: assume there is no overflow in relative instruction offset - // Thus, use instruction position + offset as a lower bound for reservation access - if (min_offs > reservation_bound) + if (offs % 16 == 0 && (pos - result.lower_bound + op.si16 * 4) == offs) { - spu_log.success("STQR/LQR Atomic Loop Hack: abs_pos=0x%x, abs=0x%x, i16*4=0x%x, ls_bound=0x%x", offs, pos + op.si16 * 4, op.si16 * 4, reservation_bound); - hack = true; - } - } + const u32 reservation_bound = (atomic16->lsa.value | 127); + const u32 min_offs = offs; - return hack; - }()) + // Hack: assume there is no overflow in relative instruction offset + // Thus, use instruction position + offset as a lower bound for reservation access + if (min_offs > reservation_bound) + { + spu_log.success("STQR/LQR Atomic Loop Hack: abs_pos=0x%x, abs=0x%x, i16*4=0x%x, ls_bound=0x%x", offs, pos + op.si16 * 4, op.si16 * 4, reservation_bound); + hack = true; + } + } + + return hack; + }()) { // Ignore memory access in this case } @@ -6478,8 +6475,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s if ((_lsa.unequal_with_mask_indifference(state, SPU_LS_MASK_128) && offs == 0) || (_lsa.compare_with_mask_indifference(state, SPU_LS_MASK_1) && abs_diff >= 128u) || - (_lsa.compare_with_mask_indifference(state, SPU_LS_MASK_128) && abs_diff >= 256u) - ) + (_lsa.compare_with_mask_indifference(state, SPU_LS_MASK_128) && abs_diff >= 256u)) { // We already know it's an unrelated load/store // The reason for SPU_LS_SIZE - 128 check is that in case LSA is not aligned, it detects the possible wraparound @@ -6650,8 +6646,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s if ((_lsa.unequal_with_mask_indifference(ra, SPU_LS_MASK_128) && offs == 0) || (_lsa.compare_with_mask_indifference(ra, SPU_LS_MASK_1) && abs_diff >= 128u) || - (_lsa.compare_with_mask_indifference(ra, SPU_LS_MASK_128) && abs_diff >= 256u) - ) + (_lsa.compare_with_mask_indifference(ra, SPU_LS_MASK_128) && abs_diff >= 256u)) { // We already know it's an unrelated load/store // The reason for SPU_LS_SIZE - 128 check is that in case LSA is not aligned, it detects the possible wraparound @@ -6716,21 +6711,21 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s { hbr_loc = spu_branch_target(pos, op.roh << 7 | op.rt); const auto [af, av, at, ao, az, apc, ainst] = get_reg(op.ra); - hbr_tg = af & vf::is_const && !op.c ? av & 0x3fffc : -1; + hbr_tg = af & vf::is_const && !op.c ? av & 0x3fffc : -1; break; } case spu_itype::HBRA: { hbr_loc = spu_branch_target(pos, op.r0h << 7 | op.rt); - hbr_tg = spu_branch_target(0x0, op.i16); + hbr_tg = spu_branch_target(0x0, op.i16); break; } case spu_itype::HBRR: { hbr_loc = spu_branch_target(pos, op.r0h << 7 | op.rt); - hbr_tg = spu_branch_target(pos, op.i16); + hbr_tg = spu_branch_target(pos, op.i16); break; } @@ -6925,9 +6920,9 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s const u32 mask = (op.i16 >> 12); const u32 value = (mask & 1 ? 0xff : 0) | - (mask & 2 ? 0xff00 : 0) | - (mask & 4 ? 0xff0000 : 0) | - (mask & 8 ? 0xff000000u : 0); + (mask & 2 ? 0xff00 : 0) | + (mask & 4 ? 0xff0000 : 0) | + (mask & 8 ? 0xff000000u : 0); set_const_value(op.rt, value); break; @@ -7206,8 +7201,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s add_pattern(false, inst_attr::putllc16, pattern.put_pc - result.entry_point, value.data); - spu_log.success("PUTLLC16 Pattern Detected! (mem_count=%d, put_pc=0x%x, pc_rel=%d, offset=0x%x, const=%u, two_regs=%d, reg=%u, runtime=%d, 0x%x-%s) (putllc0=%d, putllc16+0=%d, all=%d)" - , pattern.mem_count, pattern.put_pc, value.type == v_relative, value.off18, value.type == v_const, value.type == v_reg2, value.reg, value.runtime16_select, entry_point, func_hash, +stats.nowrite, ++stats.single, +stats.all); + spu_log.success("PUTLLC16 Pattern Detected! (mem_count=%d, put_pc=0x%x, pc_rel=%d, offset=0x%x, const=%u, two_regs=%d, reg=%u, runtime=%d, 0x%x-%s) (putllc0=%d, putllc16+0=%d, all=%d)", pattern.mem_count, pattern.put_pc, value.type == v_relative, value.off18, value.type == v_const, value.type == v_reg2, value.reg, value.runtime16_select, entry_point, func_hash, +stats.nowrite, ++stats.single, +stats.all); } for (const auto& [read_pc, pattern] : rchcnt_loop_all) @@ -7342,26 +7336,26 @@ struct spu_llvm_worker bool set_relax_flag = false; for (auto slice = registered.pop_all();; [&] - { - if (slice) { - slice.pop_front(); - } + if (slice) + { + slice.pop_front(); + } - if (slice || thread_ctrl::state() == thread_state::aborting) - { - return; - } + if (slice || thread_ctrl::state() == thread_state::aborting) + { + return; + } - if (set_relax_flag) - { - spu_thread::g_spu_work_count--; - set_relax_flag = false; - } + if (set_relax_flag) + { + spu_thread::g_spu_work_count--; + set_relax_flag = false; + } - thread_ctrl::wait_on(utils::bless>(®istered)[1], 0); - slice = registered.pop_all(); - }()) + thread_ctrl::wait_on(utils::bless>(®istered)[1], 0); + slice = registered.pop_all(); + }()) { auto* prog = slice.get(); @@ -7492,41 +7486,41 @@ struct spu_llvm stx::init_mutex prof_mutex; named_thread profiler("SPU LLVM Profiler"sv, [&]() - { - while (thread_ctrl::state() != thread_state::aborting) { + while (thread_ctrl::state() != thread_state::aborting) { - // Lock if enabled - const auto lock = prof_mutex.access(); - - if (!lock) { - // Wait when the profiler is disabled - prof_mutex.wait_for_initialized(); - continue; + // Lock if enabled + const auto lock = prof_mutex.access(); + + if (!lock) + { + // Wait when the profiler is disabled + prof_mutex.wait_for_initialized(); + continue; + } + + // Collect profiling samples + idm::select>([&](u32 /*id*/, spu_thread& spu) + { + const u64 name = atomic_storage::load(spu.block_hash); + + if (auto state = +spu.state; !::is_paused(state) && !::is_stopped(state) && cpu_flag::wait - state) + { + const auto found = std::as_const(samples).find(name); + + if (found != std::as_const(samples).end()) + { + const_cast&>(found->second)++; + } + } + }); } - // Collect profiling samples - idm::select>([&](u32 /*id*/, spu_thread& spu) - { - const u64 name = atomic_storage::load(spu.block_hash); - - if (auto state = +spu.state; !::is_paused(state) && !::is_stopped(state) && cpu_flag::wait - state) - { - const auto found = std::as_const(samples).find(name); - - if (found != std::as_const(samples).end()) - { - const_cast&>(found->second)++; - } - } - }); + // Sleep for a short period if enabled + thread_ctrl::wait_for(20, false); } - - // Sleep for a short period if enabled - thread_ctrl::wait_for(20, false); - } - }); + }); u32 worker_count = 1; @@ -7555,7 +7549,7 @@ struct spu_llvm enqueued.emplace(pair); // Interrupt and kick profiler thread - const auto lock = prof_mutex.init_always([&]{}); + const auto lock = prof_mutex.init_always([&] {}); // Register new blocks to collect samples samples.emplace(pair.first, 0); @@ -7586,7 +7580,7 @@ struct spu_llvm // Find the most used enqueued item u64 sample_max = 0; - auto found_it = enqueued.begin(); + auto found_it = enqueued.begin(); for (auto it = enqueued.begin(), end = enqueued.end(); it != end; ++it) { @@ -7646,7 +7640,10 @@ struct spu_llvm worker_index++; } - static_cast(prof_mutex.init_always([&]{ samples.clear(); })); + static_cast(prof_mutex.init_always([&] + { + samples.clear(); + })); m_workers.reset(); @@ -8142,7 +8139,7 @@ std::array& block_reg_info::evaluate_start_state(const s // Check if the node is resolved if (!node->has_true_state) { - // Assume this block cannot be resolved at the moment + // Assume this block cannot be resolved at the moment is_all_resolved = false; break; } diff --git a/rpcs3/rpcs3/Emu/Cell/SPUDisAsm.cpp b/rpcs3/rpcs3/Emu/Cell/SPUDisAsm.cpp index 645a79969..f9cf1b9f0 100644 --- a/rpcs3/rpcs3/Emu/Cell/SPUDisAsm.cpp +++ b/rpcs3/rpcs3/Emu/Cell/SPUDisAsm.cpp @@ -24,7 +24,7 @@ u32 SPUDisAsm::disasm(u32 pc) be_t op; std::memcpy(&op, m_offset + pc, 4); m_op = op; - (this->*(s_spu_disasm.decode(m_op)))({ m_op }); + (this->*(s_spu_disasm.decode(m_op)))({m_op}); format_by_mode(); return 4; @@ -67,7 +67,7 @@ std::pair SPUDisAsm::try_get_const_value(u32 reg, u32 pc, u32 TTL) c for (s32 i = static_cast(pc); i >= static_cast(m_start_pc); i -= 4) { const u32 opcode = *reinterpret_cast*>(m_offset + i); - const spu_opcode_t op0{ opcode }; + const spu_opcode_t op0{opcode}; const auto type = g_spu_itype.decode(opcode); @@ -87,22 +87,23 @@ std::pair SPUDisAsm::try_get_const_value(u32 reg, u32 pc, u32 TTL) c continue; } - // Get constant register value - #define GET_CONST_REG(var, reg) \ - {\ - /* Search for the constant value of the register*/\ - const auto [is_const, value] = try_get_const_value(reg, i - 4, TTL - 1);\ - \ - if (!is_const)\ - {\ - /* Cannot compute constant value if register is not constant*/\ - return {};\ - }\ - \ - var = value;\ - } void() /*<- Require a semicolon*/ +// Get constant register value +#define GET_CONST_REG(var, reg) \ + { \ + /* Search for the constant value of the register*/ \ + const auto [is_const, value] = try_get_const_value(reg, i - 4, TTL - 1); \ + \ + if (!is_const) \ + { \ + /* Cannot compute constant value if register is not constant*/ \ + return {}; \ + } \ + \ + var = value; \ + } \ + void() /*<- Require a semicolon*/ - //const auto flag = g_spu_iflag.decode(opcode); + // const auto flag = g_spu_iflag.decode(opcode); if (u32 dst = type & spu_itype::_quadrop ? +op0.rt4 : +op0.rt; dst == reg && !(type & spu_itype::zregmod)) { @@ -111,19 +112,19 @@ std::pair SPUDisAsm::try_get_const_value(u32 reg, u32 pc, u32 TTL) c { case spu_itype::IL: { - return { true, v128::from32p(op0.si16) }; + return {true, v128::from32p(op0.si16)}; } case spu_itype::ILA: { - return { true, v128::from32p(op0.i18) }; + return {true, v128::from32p(op0.i18)}; } case spu_itype::ILHU: { - return { true, v128::from32p(op0.i16 << 16) }; + return {true, v128::from32p(op0.i16 << 16)}; } case spu_itype::ILH: { - return { true, v128::from16p(op0.i16) }; + return {true, v128::from16p(op0.i16)}; } case spu_itype::CBD: case spu_itype::CHD: @@ -149,7 +150,7 @@ std::pair SPUDisAsm::try_get_const_value(u32 reg, u32 pc, u32 TTL) c switch (size) { - case 1: res._u8[index] = 0x03; break; + case 1: res._u8[index] = 0x03; break; case 2: res._u16[index] = 0x0203; break; case 4: res._u32[index] = 0x00010203; break; case 8: res._u64[index] = 0x0001020304050607ull; break; @@ -170,7 +171,7 @@ std::pair SPUDisAsm::try_get_const_value(u32 reg, u32 pc, u32 TTL) c res._u8[i] = (op0.i16 & (1 << i)) ? 0xFF : 0x00; } - return { true, res }; + return {true, res}; } case spu_itype::IOHL: { @@ -180,7 +181,7 @@ std::pair SPUDisAsm::try_get_const_value(u32 reg, u32 pc, u32 TTL) c // But don't limit to it GET_CONST_REG(reg_val, op0.rt); - return { true, reg_val | v128::from32p(op0.i16) }; + return {true, reg_val | v128::from32p(op0.i16)}; } case spu_itype::SHLQBYI: { @@ -194,14 +195,14 @@ std::pair SPUDisAsm::try_get_const_value(u32 reg, u32 pc, u32 TTL) c v128 reg_val{}; GET_CONST_REG(reg_val, op0.ra); - return { true, reg_val }; + return {true, reg_val}; } case spu_itype::ORI: { v128 reg_val{}; GET_CONST_REG(reg_val, op0.ra); - return { true, reg_val | v128::from32p(op0.si10) }; + return {true, reg_val | v128::from32p(op0.si10)}; } default: return {}; } diff --git a/rpcs3/rpcs3/Emu/Cell/SPUDisAsm.h b/rpcs3/rpcs3/Emu/Cell/SPUDisAsm.h index 0d5862025..f5302617d 100644 --- a/rpcs3/rpcs3/Emu/Cell/SPUDisAsm.h +++ b/rpcs3/rpcs3/Emu/Cell/SPUDisAsm.h @@ -7,66 +7,399 @@ enum spu_stop_syscall : u32; static constexpr const char* spu_reg_name[128] = -{ - "lr", "sp", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", - "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", - "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39", - "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47", - "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55", - "r56", "r57", "r58", "r59", "r60", "r61", "r62", "r63", - "r64", "r65", "r66", "r67", "r68", "r69", "r70", "r71", - "r72", "r73", "r74", "r75", "r76", "r77", "r78", "r79", - "r80", "r81", "r82", "r83", "r84", "r85", "r86", "r87", - "r88", "r89", "r90", "r91", "r92", "r93", "r94", "r95", - "r96", "r97", "r98", "r99", "r100", "r101", "r102", "r103", - "r104", "r105", "r106", "r107", "r108", "r109", "r110", "r111", - "r112", "r113", "r114", "r115", "r116", "r117", "r118", "r119", - "r120", "r121", "r122", "r123", "r124", "r125", "r126", "r127", + { + "lr", + "sp", + "r2", + "r3", + "r4", + "r5", + "r6", + "r7", + "r8", + "r9", + "r10", + "r11", + "r12", + "r13", + "r14", + "r15", + "r16", + "r17", + "r18", + "r19", + "r20", + "r21", + "r22", + "r23", + "r24", + "r25", + "r26", + "r27", + "r28", + "r29", + "r30", + "r31", + "r32", + "r33", + "r34", + "r35", + "r36", + "r37", + "r38", + "r39", + "r40", + "r41", + "r42", + "r43", + "r44", + "r45", + "r46", + "r47", + "r48", + "r49", + "r50", + "r51", + "r52", + "r53", + "r54", + "r55", + "r56", + "r57", + "r58", + "r59", + "r60", + "r61", + "r62", + "r63", + "r64", + "r65", + "r66", + "r67", + "r68", + "r69", + "r70", + "r71", + "r72", + "r73", + "r74", + "r75", + "r76", + "r77", + "r78", + "r79", + "r80", + "r81", + "r82", + "r83", + "r84", + "r85", + "r86", + "r87", + "r88", + "r89", + "r90", + "r91", + "r92", + "r93", + "r94", + "r95", + "r96", + "r97", + "r98", + "r99", + "r100", + "r101", + "r102", + "r103", + "r104", + "r105", + "r106", + "r107", + "r108", + "r109", + "r110", + "r111", + "r112", + "r113", + "r114", + "r115", + "r116", + "r117", + "r118", + "r119", + "r120", + "r121", + "r122", + "r123", + "r124", + "r125", + "r126", + "r127", }; static constexpr const char* spu_spreg_name[128] = -{ - "spr0", "spr1", "spr2", "spr3", "spr4", "spr5", "spr6", "spr7", - "spr8", "spr9", "spr10", "spr11", "spr12", "spr13", "spr14", "spr15", - "spr16", "spr17", "spr18", "spr19", "spr20", "spr21", "spr22", "spr23", - "spr24", "spr25", "spr26", "spr27", "spr28", "spr29", "spr30", "spr31", - "spr32", "spr33", "spr34", "spr35", "spr36", "spr37", "spr38", "spr39", - "spr40", "spr41", "spr42", "spr43", "spr44", "spr45", "spr46", "spr47", - "spr48", "spr49", "spr50", "spr51", "spr52", "spr53", "spr54", "spr55", - "spr56", "spr57", "spr58", "spr59", "spr60", "spr61", "spr62", "spr63", - "spr64", "spr65", "spr66", "spr67", "spr68", "spr69", "spr70", "spr71", - "spr72", "spr73", "spr74", "spr75", "spr76", "spr77", "spr78", "spr79", - "spr80", "spr81", "spr82", "spr83", "spr84", "spr85", "spr86", "spr87", - "spr88", "spr89", "spr90", "spr91", "spr92", "spr93", "spr94", "spr95", - "spr96", "spr97", "spr98", "spr99", "spr100", "spr101", "spr102", "spr103", - "spr104", "spr105", "spr106", "spr107", "spr108", "spr109", "spr110", "spr111", - "spr112", "spr113", "spr114", "spr115", "spr116", "spr117", "spr118", "spr119", - "spr120", "spr121", "spr122", "spr123", "spr124", "spr125", "spr126", "spr127", + { + "spr0", + "spr1", + "spr2", + "spr3", + "spr4", + "spr5", + "spr6", + "spr7", + "spr8", + "spr9", + "spr10", + "spr11", + "spr12", + "spr13", + "spr14", + "spr15", + "spr16", + "spr17", + "spr18", + "spr19", + "spr20", + "spr21", + "spr22", + "spr23", + "spr24", + "spr25", + "spr26", + "spr27", + "spr28", + "spr29", + "spr30", + "spr31", + "spr32", + "spr33", + "spr34", + "spr35", + "spr36", + "spr37", + "spr38", + "spr39", + "spr40", + "spr41", + "spr42", + "spr43", + "spr44", + "spr45", + "spr46", + "spr47", + "spr48", + "spr49", + "spr50", + "spr51", + "spr52", + "spr53", + "spr54", + "spr55", + "spr56", + "spr57", + "spr58", + "spr59", + "spr60", + "spr61", + "spr62", + "spr63", + "spr64", + "spr65", + "spr66", + "spr67", + "spr68", + "spr69", + "spr70", + "spr71", + "spr72", + "spr73", + "spr74", + "spr75", + "spr76", + "spr77", + "spr78", + "spr79", + "spr80", + "spr81", + "spr82", + "spr83", + "spr84", + "spr85", + "spr86", + "spr87", + "spr88", + "spr89", + "spr90", + "spr91", + "spr92", + "spr93", + "spr94", + "spr95", + "spr96", + "spr97", + "spr98", + "spr99", + "spr100", + "spr101", + "spr102", + "spr103", + "spr104", + "spr105", + "spr106", + "spr107", + "spr108", + "spr109", + "spr110", + "spr111", + "spr112", + "spr113", + "spr114", + "spr115", + "spr116", + "spr117", + "spr118", + "spr119", + "spr120", + "spr121", + "spr122", + "spr123", + "spr124", + "spr125", + "spr126", + "spr127", }; static constexpr const char* spu_ch_name[128] = -{ - "SPU_RdEventStat", "SPU_WrEventMask", "SPU_WrEventAck", "SPU_RdSigNotify1", - "SPU_RdSigNotify2", "ch5", "ch6", "SPU_WrDec", "SPU_RdDec", - "MFC_WrMSSyncReq", "ch10", "SPU_RdEventMask", "MFC_RdTagMask", "SPU_RdMachStat", - "SPU_WrSRR0", "SPU_RdSRR0", "MFC_LSA", "MFC_EAH", "MFC_EAL", "MFC_Size", - "MFC_TagID", "MFC_Cmd", "MFC_WrTagMask", "MFC_WrTagUpdate", "MFC_RdTagStat", - "MFC_RdListStallStat", "MFC_WrListStallAck", "MFC_RdAtomicStat", - "SPU_WrOutMbox", "SPU_RdInMbox", "SPU_WrOutIntrMbox", "ch31", "ch32", - "ch33", "ch34", "ch35", "ch36", "ch37", "ch38", "ch39", "ch40", - "ch41", "ch42", "ch43", "ch44", "ch45", "ch46", "ch47", "ch48", - "ch49", "ch50", "ch51", "ch52", "ch53", "ch54", "ch55", "ch56", - "ch57", "ch58", "ch59", "ch60", "ch61", "ch62", "ch63", "ch64", - "ch65", "ch66", "ch67", "ch68", "SPU_Set_Bkmk_Tag", "SPU_PM_Start_Ev", "SPU_PM_Stop_Ev", "ch72", - "ch73", "ch74", "ch75", "ch76", "ch77", "ch78", "ch79", "ch80", - "ch81", "ch82", "ch83", "ch84", "ch85", "ch86", "ch87", "ch88", - "ch89", "ch90", "ch91", "ch92", "ch93", "ch94", "ch95", "ch96", - "ch97", "ch98", "ch99", "ch100", "ch101", "ch102", "ch103", "ch104", - "ch105", "ch106", "ch107", "ch108", "ch109", "ch110", "ch111", "ch112", - "ch113", "ch114", "ch115", "ch116", "ch117", "ch118", "ch119", "ch120", - "ch121", "ch122", "ch123", "ch124", "ch125", "ch126", "ch127", + { + "SPU_RdEventStat", + "SPU_WrEventMask", + "SPU_WrEventAck", + "SPU_RdSigNotify1", + "SPU_RdSigNotify2", + "ch5", + "ch6", + "SPU_WrDec", + "SPU_RdDec", + "MFC_WrMSSyncReq", + "ch10", + "SPU_RdEventMask", + "MFC_RdTagMask", + "SPU_RdMachStat", + "SPU_WrSRR0", + "SPU_RdSRR0", + "MFC_LSA", + "MFC_EAH", + "MFC_EAL", + "MFC_Size", + "MFC_TagID", + "MFC_Cmd", + "MFC_WrTagMask", + "MFC_WrTagUpdate", + "MFC_RdTagStat", + "MFC_RdListStallStat", + "MFC_WrListStallAck", + "MFC_RdAtomicStat", + "SPU_WrOutMbox", + "SPU_RdInMbox", + "SPU_WrOutIntrMbox", + "ch31", + "ch32", + "ch33", + "ch34", + "ch35", + "ch36", + "ch37", + "ch38", + "ch39", + "ch40", + "ch41", + "ch42", + "ch43", + "ch44", + "ch45", + "ch46", + "ch47", + "ch48", + "ch49", + "ch50", + "ch51", + "ch52", + "ch53", + "ch54", + "ch55", + "ch56", + "ch57", + "ch58", + "ch59", + "ch60", + "ch61", + "ch62", + "ch63", + "ch64", + "ch65", + "ch66", + "ch67", + "ch68", + "SPU_Set_Bkmk_Tag", + "SPU_PM_Start_Ev", + "SPU_PM_Stop_Ev", + "ch72", + "ch73", + "ch74", + "ch75", + "ch76", + "ch77", + "ch78", + "ch79", + "ch80", + "ch81", + "ch82", + "ch83", + "ch84", + "ch85", + "ch86", + "ch87", + "ch88", + "ch89", + "ch90", + "ch91", + "ch92", + "ch93", + "ch94", + "ch95", + "ch96", + "ch97", + "ch98", + "ch99", + "ch100", + "ch101", + "ch102", + "ch103", + "ch104", + "ch105", + "ch106", + "ch107", + "ch108", + "ch109", + "ch110", + "ch111", + "ch112", + "ch113", + "ch114", + "ch115", + "ch116", + "ch117", + "ch118", + "ch119", + "ch120", + "ch121", + "ch122", + "ch123", + "ch124", + "ch125", + "ch126", + "ch127", }; namespace utils @@ -79,6 +412,7 @@ void comment_constant(std::string& last_opocde, u64 value, bool print_float = tr class SPUDisAsm final : public PPCDisAsm { std::shared_ptr m_shm; + public: SPUDisAsm(cpu_disasm_mode mode, const u8* offset, u32 start_pc = 0) : PPCDisAsm(mode, offset, start_pc) { @@ -189,7 +523,8 @@ public: std::pair try_get_const_value(u32 reg, u32 pc = -1, u32 TTL = 10) const; // Get constant value if the original array is made of only repetitions of the same value - template requires (sizeof(T) < sizeof(v128) && !(sizeof(v128) % sizeof(T))) + template + requires(sizeof(T) < sizeof(v128) && !(sizeof(v128) % sizeof(T))) std::pair try_get_const_equal_value_array(u32 reg, u32 pc = -1, u32 TTL = 10) const { auto [ok, res] = try_get_const_value(reg, pc, TTL); @@ -226,7 +561,7 @@ public: static insert_mask_info try_get_insert_mask_info(const v128& mask); - //0 - 10 + // 0 - 10 void STOP(spu_opcode_t op) { op.rb ? UNK(op) : DisAsm("stop", fmt::format("0x%x #%s", op.opcode & 0x3fff, spu_stop_syscall{op.opcode & 0x3fff}).c_str()); @@ -794,7 +1129,7 @@ public: DisAsm("heq", spu_reg_name[op.rt], spu_reg_name[op.ra], spu_reg_name[op.rb]); } - //0 - 9 + // 0 - 9 void CFLTS(spu_opcode_t op) { DisAsm("cflts", spu_reg_name[op.rt], spu_reg_name[op.ra], op.i8); @@ -812,7 +1147,7 @@ public: DisAsm("cuflt", spu_reg_name[op.rt], spu_reg_name[op.ra], op.i8); } - //0 - 8 + // 0 - 8 void BRZ(spu_opcode_t op) { DisAsm("brz", spu_reg_name[op.rt], DisAsmBranchTarget(op.i16)); @@ -889,7 +1224,7 @@ public: void IOHL(spu_opcode_t op); - //0 - 7 + // 0 - 7 void ORI(spu_opcode_t op) { if (!op.si10) @@ -1032,7 +1367,7 @@ public: DisAsm("heqi", spu_reg_name[op.rt], spu_reg_name[op.ra], op.si10); } - //0 - 6 + // 0 - 6 void HBRA(spu_opcode_t op) { DisAsm("hbra", DisAsmBranchTarget((op.r0h << 7) | op.rt), DisAsmBranchTarget(op.i16 - dump_pc / 4)); @@ -1046,7 +1381,7 @@ public: DisAsm("ila", spu_reg_name[op.rt], op.i18); } - //0 - 3 + // 0 - 3 void SELB(spu_opcode_t op) { DisAsm("selb", spu_reg_name[op.rt4], spu_reg_name[op.ra], spu_reg_name[op.rb], spu_reg_name[op.rc]); diff --git a/rpcs3/rpcs3/Emu/Cell/SPUInterpreter.cpp b/rpcs3/rpcs3/Emu/Cell/SPUInterpreter.cpp index a781da5e8..1f242a75d 100644 --- a/rpcs3/rpcs3/Emu/Cell/SPUInterpreter.cpp +++ b/rpcs3/rpcs3/Emu/Cell/SPUInterpreter.cpp @@ -122,7 +122,7 @@ namespace asmjit { build_spu_gpr_load(c, x, bf_t{}, store); } -} +} // namespace asmjit template bool UNK(spu_thread&, spu_opcode_t op) @@ -131,7 +131,6 @@ bool UNK(spu_thread&, spu_opcode_t op) return false; } - void spu_interpreter::set_interrupt_status(spu_thread& spu, spu_opcode_t op) { if (op.e) @@ -154,7 +153,6 @@ void spu_interpreter::set_interrupt_status(spu_thread& spu, spu_opcode_t op) } } - template bool STOP(spu_thread& spu, spu_opcode_t op) { @@ -405,14 +403,14 @@ bool ROTI(spu_thread& spu, spu_opcode_t op) template bool ROTMI(spu_thread& spu, spu_opcode_t op) { - spu.gpr[op.rt] = _mm_srli_epi32(spu.gpr[op.ra], (0-op.i7) & 0x3f); + spu.gpr[op.rt] = _mm_srli_epi32(spu.gpr[op.ra], (0 - op.i7) & 0x3f); return true; } template bool ROTMAI(spu_thread& spu, spu_opcode_t op) { - spu.gpr[op.rt] = _mm_srai_epi32(spu.gpr[op.ra], (0-op.i7) & 0x3f); + spu.gpr[op.rt] = _mm_srai_epi32(spu.gpr[op.ra], (0 - op.i7) & 0x3f); return true; } @@ -435,14 +433,14 @@ bool ROTHI(spu_thread& spu, spu_opcode_t op) template bool ROTHMI(spu_thread& spu, spu_opcode_t op) { - spu.gpr[op.rt] = _mm_srli_epi16(spu.gpr[op.ra], (0-op.i7) & 0x1f); + spu.gpr[op.rt] = _mm_srli_epi16(spu.gpr[op.ra], (0 - op.i7) & 0x1f); return true; } template bool ROTMAHI(spu_thread& spu, spu_opcode_t op) { - spu.gpr[op.rt] = _mm_srai_epi16(spu.gpr[op.ra], (0-op.i7) & 0x1f); + spu.gpr[op.rt] = _mm_srai_epi16(spu.gpr[op.ra], (0 - op.i7) & 0x1f); return true; } @@ -954,7 +952,7 @@ template bool ROTQMBII(spu_thread& spu, spu_opcode_t op) { const auto a = spu.gpr[op.ra]; - const s32 n = (0-op.i7) & 0x7; + const s32 n = (0 - op.i7) & 0x7; spu.gpr[op.rt] = _mm_or_si128(_mm_srli_epi64(a, n), _mm_slli_epi64(_mm_srli_si128(a, 8), 64 - n)); return true; } @@ -1137,20 +1135,20 @@ bool FCGT(spu_thread& spu, spu_opcode_t op) // branching simulated using bitwise ops and_not+or const auto zero = _mm_set1_ps(0.f); - const auto nan_check_a = _mm_cmpunord_ps(spu.gpr[op.ra], zero); //mask true where a is extended - const auto nan_check_b = _mm_cmpunord_ps(spu.gpr[op.rb], zero); //mask true where b is extended + const auto nan_check_a = _mm_cmpunord_ps(spu.gpr[op.ra], zero); // mask true where a is extended + const auto nan_check_b = _mm_cmpunord_ps(spu.gpr[op.rb], zero); // mask true where b is extended - //calculate lowered a and b. The mantissa bits are left untouched for now unless its proven they should be flushed + // calculate lowered a and b. The mantissa bits are left untouched for now unless its proven they should be flushed const auto last_exp_bit = _mm_castsi128_ps(_mm_set1_epi32(0x00800000)); - const auto lowered_a =_mm_andnot_ps(last_exp_bit, spu.gpr[op.ra]); //a is lowered to largest unextended value with sign - const auto lowered_b = _mm_andnot_ps(last_exp_bit, spu.gpr[op.rb]); //b is lowered to largest unextended value with sign + const auto lowered_a = _mm_andnot_ps(last_exp_bit, spu.gpr[op.ra]); // a is lowered to largest unextended value with sign + const auto lowered_b = _mm_andnot_ps(last_exp_bit, spu.gpr[op.rb]); // b is lowered to largest unextended value with sign - //check if a and b are denormalized + // check if a and b are denormalized const auto all_exp_bits = _mm_castsi128_ps(_mm_set1_epi32(0x7f800000)); const auto denorm_check_a = _mm_cmpeq_ps(zero, _mm_and_ps(all_exp_bits, spu.gpr[op.ra])); const auto denorm_check_b = _mm_cmpeq_ps(zero, _mm_and_ps(all_exp_bits, spu.gpr[op.rb])); - //set a and b to their lowered values if they are extended + // set a and b to their lowered values if they are extended const auto a_values_lowered = _mm_and_ps(nan_check_a, lowered_a); const auto original_a_masked = _mm_andnot_ps(nan_check_a, spu.gpr[op.ra]); const auto a_final1 = _mm_or_ps(a_values_lowered, original_a_masked); @@ -1159,7 +1157,7 @@ bool FCGT(spu_thread& spu, spu_opcode_t op) const auto original_b_masked = _mm_andnot_ps(nan_check_b, spu.gpr[op.rb]); const auto b_final1 = _mm_or_ps(b_values_lowered, original_b_masked); - //Flush denormals to zero + // Flush denormals to zero const auto final_a = _mm_andnot_ps(denorm_check_a, a_final1); const auto final_b = _mm_andnot_ps(denorm_check_b, b_final1); @@ -1195,23 +1193,23 @@ bool FM(spu_thread& spu, spu_opcode_t op) const auto sign_bits = _mm_castsi128_ps(_mm_set1_epi32(0x80000000)); const auto all_exp_bits = _mm_castsi128_ps(_mm_set1_epi32(0x7f800000)); - //check denormals + // check denormals const auto denorm_check_a = _mm_cmpeq_ps(zero, _mm_and_ps(all_exp_bits, spu.gpr[op.ra])); const auto denorm_check_b = _mm_cmpeq_ps(zero, _mm_and_ps(all_exp_bits, spu.gpr[op.rb])); const auto denorm_operand_mask = _mm_or_ps(denorm_check_a, denorm_check_b); - //compute result with flushed denormal inputs + // compute result with flushed denormal inputs const auto primary_result = _mm_mul_ps(spu.gpr[op.ra], spu.gpr[op.rb]); const auto denom_result_mask = _mm_cmpeq_ps(zero, _mm_and_ps(all_exp_bits, primary_result)); const auto flushed_result = _mm_andnot_ps(_mm_or_ps(denom_result_mask, denorm_operand_mask), primary_result); - //check for extended + // check for extended const auto nan_check = _mm_cmpeq_ps(_mm_and_ps(primary_result, all_exp_bits), all_exp_bits); const auto sign_mask = _mm_xor_ps(_mm_and_ps(sign_bits, spu.gpr[op.ra]), _mm_and_ps(sign_bits, spu.gpr[op.rb])); const auto extended_result = _mm_or_ps(sign_mask, _mm_andnot_ps(sign_bits, primary_result)); const auto final_extended = _mm_andnot_ps(denorm_operand_mask, extended_result); - //if nan, result = ext, else result = flushed + // if nan, result = ext, else result = flushed const auto set1 = _mm_andnot_ps(nan_check, flushed_result); const auto set2 = _mm_and_ps(nan_check, final_extended); @@ -1236,22 +1234,22 @@ bool ORC(spu_thread& spu, spu_opcode_t op) template bool FCMGT(spu_thread& spu, spu_opcode_t op) { - //IMPL NOTES: See FCGT + // IMPL NOTES: See FCGT const auto zero = _mm_set1_ps(0.f); - const auto nan_check_a = _mm_cmpunord_ps(spu.gpr[op.ra], zero); //mask true where a is extended - const auto nan_check_b = _mm_cmpunord_ps(spu.gpr[op.rb], zero); //mask true where b is extended + const auto nan_check_a = _mm_cmpunord_ps(spu.gpr[op.ra], zero); // mask true where a is extended + const auto nan_check_b = _mm_cmpunord_ps(spu.gpr[op.rb], zero); // mask true where b is extended - //check if a and b are denormalized + // check if a and b are denormalized const auto all_exp_bits = _mm_castsi128_ps(_mm_set1_epi32(0x7f800000)); const auto denorm_check_a = _mm_cmpeq_ps(zero, _mm_and_ps(all_exp_bits, spu.gpr[op.ra])); const auto denorm_check_b = _mm_cmpeq_ps(zero, _mm_and_ps(all_exp_bits, spu.gpr[op.rb])); - //Flush denormals to zero + // Flush denormals to zero const auto final_a = _mm_andnot_ps(denorm_check_a, spu.gpr[op.ra]); const auto final_b = _mm_andnot_ps(denorm_check_b, spu.gpr[op.rb]); - //Mask to make a > b if a is extended but b is not (is this necessary on x86?) + // Mask to make a > b if a is extended but b is not (is this necessary on x86?) const auto nan_mask = _mm_andnot_ps(nan_check_b, _mm_xor_ps(nan_check_a, nan_check_b)); const auto sign_mask = _mm_castsi128_ps(_mm_set1_epi32(0x7fffffff)); @@ -1525,8 +1523,8 @@ bool FI(spu_thread& spu, spu_opcode_t op) // TODO const auto mask_se = _mm_castsi128_ps(_mm_set1_epi32(0xff800000)); // sign and exponent mask const auto mask_bf = _mm_castsi128_ps(_mm_set1_epi32(0x007ffc00)); // base fraction mask - const auto mask_sf = _mm_set1_epi32(0x000003ff); // step fraction mask - const auto mask_yf = _mm_set1_epi32(0x0007ffff); // Y fraction mask (bits 13..31) + const auto mask_sf = _mm_set1_epi32(0x000003ff); // step fraction mask + const auto mask_yf = _mm_set1_epi32(0x0007ffff); // Y fraction mask (bits 13..31) const auto base = _mm_or_ps(_mm_and_ps(spu.gpr[op.rb], mask_bf), _mm_castsi128_ps(_mm_set1_epi32(0x3f800000))); const auto step = _mm_mul_ps(_mm_cvtepi32_ps(_mm_and_si128(spu.gpr[op.rb], mask_sf)), _mm_set1_ps(std::exp2(-13.f))); const auto y = _mm_mul_ps(_mm_cvtepi32_ps(_mm_and_si128(spu.gpr[op.ra], mask_yf)), _mm_set1_ps(std::exp2(-19.f))); @@ -1544,7 +1542,6 @@ bool HEQ(spu_thread& spu, spu_opcode_t op) return true; } - template bool CFLTS(spu_thread& spu, spu_opcode_t op) { @@ -1578,7 +1575,6 @@ bool CUFLT(spu_thread& spu, spu_opcode_t op) return true; } - template bool BRZ(spu_thread& spu, spu_opcode_t op) { @@ -1721,7 +1717,6 @@ bool IOHL(spu_thread& spu, spu_opcode_t op) return true; } - template bool ORI(spu_thread& spu, spu_opcode_t op) { @@ -1936,7 +1931,6 @@ bool HEQI(spu_thread& spu, spu_opcode_t op) return true; } - template bool HBRA(spu_thread&, spu_opcode_t) { @@ -1956,7 +1950,6 @@ bool ILA(spu_thread& spu, spu_opcode_t op) return true; } - template bool SELB(spu_thread& spu, spu_opcode_t op) { @@ -1990,76 +1983,76 @@ bool SHUFB(spu_thread& spu, spu_opcode_t op) #if defined(ARCH_X64) const spu_intrp_func_t optimized_shufb = build_function_asm("spu_shufb", [](asmjit::x86::Assembler& c, auto& /*args*/) -{ - using namespace asmjit; - - const auto& va = x86::xmm0; - const auto& vb = x86::xmm1; - const auto& vc = x86::xmm2; - const auto& vt = x86::xmm3; - const auto& vm = x86::xmm4; - const auto& v5 = x86::xmm5; - - Label xc0 = c.newLabel(); - Label xe0 = c.newLabel(); - Label x0f = c.newLabel(); - - build_spu_gpr_load(c, va, s_op.ra); - build_spu_gpr_load(c, vb, s_op.rb); - build_spu_gpr_load(c, vc, s_op.rc); - - if (utils::has_avx()) { - c.vpand(v5, vc, x86::oword_ptr(xe0)); - c.vpxor(vc, vc, x86::oword_ptr(x0f)); - c.vpshufb(va, va, vc); - c.vpslld(vt, vc, 3); - c.vmovdqa(vm, x86::oword_ptr(xc0)); - c.vpcmpeqb(v5, v5, vm); - c.vpshufb(vb, vb, vc); - c.vpand(vc, vc, vm); - c.vpblendvb(vb, va, vb, vt); - c.vpcmpeqb(vt, vc, vm); - c.vpavgb(vt, vt, v5); - c.vpor(vt, vt, vb); - } - else - { - c.movdqa(v5, vc); - c.pand(v5, x86::oword_ptr(xe0)); - c.movdqa(vt, vc); - c.movdqa(vm, x86::oword_ptr(xc0)); - c.pand(vt, vm); - c.pxor(vc, x86::oword_ptr(x0f)); - c.pshufb(va, vc); - c.pshufb(vb, vc); - c.pslld(vc, 3); - c.pcmpeqb(v5, vm); - c.pcmpeqb(vt, vm); - c.pcmpeqb(vm, vm); - c.pcmpgtb(vc, vm); - c.pand(va, vc); - c.pandn(vc, vb); - c.por(vc, va); - c.pavgb(vt, v5); - c.por(vt, vc); - } + using namespace asmjit; - build_spu_gpr_store(c, vt, s_op.rt4); - c.mov(x86::eax, 1); - c.ret(); + const auto& va = x86::xmm0; + const auto& vb = x86::xmm1; + const auto& vc = x86::xmm2; + const auto& vt = x86::xmm3; + const auto& vm = x86::xmm4; + const auto& v5 = x86::xmm5; - c.align(AlignMode::kData, 16); - c.bind(xc0); - c.dq(0xc0c0c0c0c0c0c0c0); - c.dq(0xc0c0c0c0c0c0c0c0); - c.bind(xe0); - c.dq(0xe0e0e0e0e0e0e0e0); - c.dq(0xe0e0e0e0e0e0e0e0); - c.bind(x0f); - c.dq(0x0f0f0f0f0f0f0f0f); - c.dq(0x0f0f0f0f0f0f0f0f); -}); + Label xc0 = c.newLabel(); + Label xe0 = c.newLabel(); + Label x0f = c.newLabel(); + + build_spu_gpr_load(c, va, s_op.ra); + build_spu_gpr_load(c, vb, s_op.rb); + build_spu_gpr_load(c, vc, s_op.rc); + + if (utils::has_avx()) + { + c.vpand(v5, vc, x86::oword_ptr(xe0)); + c.vpxor(vc, vc, x86::oword_ptr(x0f)); + c.vpshufb(va, va, vc); + c.vpslld(vt, vc, 3); + c.vmovdqa(vm, x86::oword_ptr(xc0)); + c.vpcmpeqb(v5, v5, vm); + c.vpshufb(vb, vb, vc); + c.vpand(vc, vc, vm); + c.vpblendvb(vb, va, vb, vt); + c.vpcmpeqb(vt, vc, vm); + c.vpavgb(vt, vt, v5); + c.vpor(vt, vt, vb); + } + else + { + c.movdqa(v5, vc); + c.pand(v5, x86::oword_ptr(xe0)); + c.movdqa(vt, vc); + c.movdqa(vm, x86::oword_ptr(xc0)); + c.pand(vt, vm); + c.pxor(vc, x86::oword_ptr(x0f)); + c.pshufb(va, vc); + c.pshufb(vb, vc); + c.pslld(vc, 3); + c.pcmpeqb(v5, vm); + c.pcmpeqb(vt, vm); + c.pcmpeqb(vm, vm); + c.pcmpgtb(vc, vm); + c.pand(va, vc); + c.pandn(vc, vb); + c.por(vc, va); + c.pavgb(vt, v5); + c.por(vt, vc); + } + + build_spu_gpr_store(c, vt, s_op.rt4); + c.mov(x86::eax, 1); + c.ret(); + + c.align(AlignMode::kData, 16); + c.bind(xc0); + c.dq(0xc0c0c0c0c0c0c0c0); + c.dq(0xc0c0c0c0c0c0c0c0); + c.bind(xe0); + c.dq(0xe0e0e0e0e0e0e0e0); + c.dq(0xe0e0e0e0e0e0e0e0); + c.bind(x0f); + c.dq(0x0f0f0f0f0f0f0f0f); + c.dq(0x0f0f0f0f0f0f0f0f); + }); #endif template @@ -3145,8 +3138,10 @@ spu_interpreter_rt_base::spu_interpreter_rt_base() noexcept ptrs = std::make_unique(); // Initialize instructions with their own sets of supported flags -#define INIT(name, ...) \ - ptrs->name = spu_exec_select<>::select<__VA_ARGS__>(selected, [](){ return &::name; }); \ +#define INIT(name, ...) \ + ptrs->name = spu_exec_select<>::select<__VA_ARGS__>(selected, []() { \ + return &::name; \ + }); using enum spu_exec_bit; @@ -3357,7 +3352,6 @@ spu_interpreter_rt_base::~spu_interpreter_rt_base() } spu_interpreter_rt::spu_interpreter_rt() noexcept - : spu_interpreter_rt_base() - , table(*ptrs) + : spu_interpreter_rt_base(), table(*ptrs) { } diff --git a/rpcs3/rpcs3/Emu/Cell/SPUInterpreter.h b/rpcs3/rpcs3/Emu/Cell/SPUInterpreter.h index c6073ba57..7943011b1 100644 --- a/rpcs3/rpcs3/Emu/Cell/SPUInterpreter.h +++ b/rpcs3/rpcs3/Emu/Cell/SPUInterpreter.h @@ -4,7 +4,7 @@ class spu_thread; -using spu_intrp_func_t = bool(*)(spu_thread& spu, spu_opcode_t op); +using spu_intrp_func_t = bool (*)(spu_thread& spu, spu_opcode_t op); template struct spu_interpreter_t; diff --git a/rpcs3/rpcs3/Emu/Cell/SPULLVMRecompiler.cpp b/rpcs3/rpcs3/Emu/Cell/SPULLVMRecompiler.cpp index 0df3e3a85..26cd703fa 100644 --- a/rpcs3/rpcs3/Emu/Cell/SPULLVMRecompiler.cpp +++ b/rpcs3/rpcs3/Emu/Cell/SPULLVMRecompiler.cpp @@ -157,10 +157,10 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator std::array store{}; // Store reordering/elimination protection - std::array store_context_last_id = fill_array(0); // Protects against illegal forward ordering + std::array store_context_last_id = fill_array(0); // Protects against illegal forward ordering std::array store_context_first_id = fill_array(usz{umax}); // Protects against illegal past store elimination (backwards ordering is not implemented) - std::array store_context_ctr = fill_array(1); // Store barrier counter - bool has_gpr_memory_barriers = false; // Summarizes whether GPR barriers exist this block (as if checking all store_context_ctr entries) + std::array store_context_ctr = fill_array(1); // Store barrier counter + bool has_gpr_memory_barriers = false; // Summarizes whether GPR barriers exist this block (as if checking all store_context_ctr entries) bool does_gpr_barrier_proceed_last_store(u32 i) const noexcept { @@ -423,7 +423,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator if (i >= s_reg_80 && i <= s_reg_127) { // TODO - //m_finfo->load[i] = llvm::UndefValue::get(get_reg_type(i)); + // m_finfo->load[i] = llvm::UndefValue::get(get_reg_type(i)); } m_finfo->load[i] = m_ir->CreateLoad(get_reg_type(i), init_reg_fixed(i)); @@ -813,7 +813,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator template bool match_vr(const bf_t& index, F&& pred) { - return (( match_vr(index) ? pred(match_vr(index), match()) : false ) || ...); + return ((match_vr(index) ? pred(match_vr(index), match()) : false) || ...); } template @@ -1187,73 +1187,73 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator if (g_cfg.core.rsx_accurate_res_access) { const auto success = call("spu_putllc16_rsx_res", +[](spu_thread* _spu, u32 ls_dst, u32 lsa, u32 eal, u32 notify) -> bool - { - const u32 raddr = eal; - - const v128 rdata = read_from_ptr(_spu->rdata, ls_dst % 0x80); - const v128 to_write = _spu->_ref>(ls_dst); - - const auto dest = raddr | (ls_dst & 127); - const auto _dest = vm::get_super_ptr>>(dest); - - if (rdata == to_write || ((lsa ^ ls_dst) & (SPU_LS_SIZE - 128))) { - vm::reservation_update(raddr); - _spu->ch_atomic_stat.set_value(MFC_PUTLLC_SUCCESS); - _spu->raddr = 0; - return true; - } + const u32 raddr = eal; - auto& res = vm::reservation_acquire(eal); + const v128 rdata = read_from_ptr(_spu->rdata, ls_dst % 0x80); + const v128 to_write = _spu->_ref>(ls_dst); - if (res % 128) - { - return false; - } + const auto dest = raddr | (ls_dst & 127); + const auto _dest = vm::get_super_ptr>>(dest); - { - rsx::reservation_lock rsx_lock(raddr, 128); - - // Touch memory - utils::trigger_write_page_fault(vm::base(dest ^ (4096 / 2))); - - auto [old_res, ok] = res.fetch_op([&](u64& rval) + if (rdata == to_write || ((lsa ^ ls_dst) & (SPU_LS_SIZE - 128))) { - if (rval % 128) + vm::reservation_update(raddr); + _spu->ch_atomic_stat.set_value(MFC_PUTLLC_SUCCESS); + _spu->raddr = 0; + return true; + } + + auto& res = vm::reservation_acquire(eal); + + if (res % 128) + { + return false; + } + + { + rsx::reservation_lock rsx_lock(raddr, 128); + + // Touch memory + utils::trigger_write_page_fault(vm::base(dest ^ (4096 / 2))); + + auto [old_res, ok] = res.fetch_op([&](u64& rval) + { + if (rval % 128) + { + return false; + } + + rval |= 127; + return true; + }); + + if (!ok) { return false; } - rval |= 127; - return true; - }); + if (!_dest->compare_and_swap_test(rdata, to_write)) + { + res.release(old_res); + return false; + } - if (!ok) - { - return false; + // Success + res.release(old_res + 128); } - if (!_dest->compare_and_swap_test(rdata, to_write)) + _spu->ch_atomic_stat.set_value(MFC_PUTLLC_SUCCESS); + _spu->raddr = 0; + + if (notify) { - res.release(old_res); - return false; + res.notify_all(); } - // Success - res.release(old_res + 128); - } - - _spu->ch_atomic_stat.set_value(MFC_PUTLLC_SUCCESS); - _spu->raddr = 0; - - if (notify) - { - res.notify_all(); - } - - return true; - }, m_thread, dest, _lsa, _eal, m_ir->getInt32(!info.no_notify)); - + return true; + }, + m_thread, dest, _lsa, _eal, m_ir->getInt32(!info.no_notify)); m_ir->CreateCondBr(success, _final, _fail); @@ -1316,9 +1316,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator const auto sudo_ptr = _ptr(m_ir->CreateLoad(get_type(), spu_ptr(&spu_thread::memory_sudo_addr)), _eal); m_ir->CreateCondBr( - m_ir->CreateExtractValue(m_ir->CreateAtomicCmpXchg(_ptr(sudo_ptr, diff), _rdata, _new, llvm::MaybeAlign{16}, llvm::AtomicOrdering::SequentiallyConsistent, llvm::AtomicOrdering::SequentiallyConsistent), 1) - , _success_and_unlock - , _fail_and_unlock); + m_ir->CreateExtractValue(m_ir->CreateAtomicCmpXchg(_ptr(sudo_ptr, diff), _rdata, _new, llvm::MaybeAlign{16}, llvm::AtomicOrdering::SequentiallyConsistent, llvm::AtomicOrdering::SequentiallyConsistent), 1), _success_and_unlock, _fail_and_unlock); // Unlock and notify m_ir->SetInsertPoint(_success_and_unlock); @@ -1326,7 +1324,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator if (!info.no_notify) { - call("atomic_wait_engine::notify_all", static_cast(atomic_wait_engine::notify_all), rptr); + call("atomic_wait_engine::notify_all", static_cast(atomic_wait_engine::notify_all), rptr); } m_ir->CreateBr(_success); @@ -1421,12 +1419,10 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator const auto rptr = _ptr(m_ir->CreateLoad(get_type(), spu_ptr(&spu_thread::reserv_base_addr)), ((eal_val & 0xff80) >> 1).eval(m_ir)); const auto rval = m_ir->CreateLoad(get_type(), spu_ptr(&spu_thread::rtime)); m_ir->CreateCondBr( - m_ir->CreateExtractValue(m_ir->CreateAtomicCmpXchg(rptr, rval, m_ir->CreateAdd(rval, m_ir->getInt64(128)), llvm::MaybeAlign{16}, llvm::AtomicOrdering::SequentiallyConsistent, llvm::AtomicOrdering::SequentiallyConsistent), 1) - , _next0 - , g_cfg.core.spu_accurate_reservations ? _fail : _next0); // Succeed unconditionally + m_ir->CreateExtractValue(m_ir->CreateAtomicCmpXchg(rptr, rval, m_ir->CreateAdd(rval, m_ir->getInt64(128)), llvm::MaybeAlign{16}, llvm::AtomicOrdering::SequentiallyConsistent, llvm::AtomicOrdering::SequentiallyConsistent), 1), _next0, g_cfg.core.spu_accurate_reservations ? _fail : _next0); // Succeed unconditionally m_ir->SetInsertPoint(_next0); - //call("atomic_wait_engine::notify_all", static_cast(atomic_wait_engine::notify_all), rptr); + // call("atomic_wait_engine::notify_all", static_cast(atomic_wait_engine::notify_all), rptr); m_ir->CreateStore(m_ir->getInt64(spu_channel::bit_count | MFC_PUTLLC_SUCCESS), spu_ptr(&spu_thread::ch_atomic_stat)); m_ir->CreateBr(_final); @@ -1441,9 +1437,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator public: spu_llvm_recompiler(u8 interp_magn = 0) - : spu_recompiler_base() - , cpu_translator(nullptr, false) - , m_interp_magn(interp_magn) + : spu_recompiler_base(), cpu_translator(nullptr, false), m_interp_magn(interp_magn) { } @@ -1473,13 +1467,13 @@ public: }; aarch64::GHC_frame_preservation_pass::config_t config = - { - .debug_info = false, // Set to "true" to insert debug frames on x27 - .use_stack_frames = false, // We don't need this since the SPU GW allocates global scratch on the stack - .hypervisor_context_offset = ::offset32(&spu_thread::hv_ctx), - .exclusion_callback = should_exclude_function, - .base_register_lookup = {} // Unused, always x19 on SPU - }; + { + .debug_info = false, // Set to "true" to insert debug frames on x27 + .use_stack_frames = false, // We don't need this since the SPU GW allocates global scratch on the stack + .hypervisor_context_offset = ::offset32(&spu_thread::hv_ctx), + .exclusion_callback = should_exclude_function, + .base_register_lookup = {} // Unused, always x19 on SPU + }; // Create transform pass std::unique_ptr ghc_fixup_pass = std::make_unique(config); @@ -1721,12 +1715,12 @@ public: if (k < start || k >= end || !func.data[(k - start) / 4]) { indices[i] = 16; - holes = true; + holes = true; } else { indices[i] = i; - data = true; + data = true; } } @@ -1760,7 +1754,7 @@ public: check_iterations++; } - llvm::Value* acc = (acc0 && acc1) ? m_ir->CreateAdd(acc0, acc1): (acc0 ? acc0 : acc1); + llvm::Value* acc = (acc0 && acc1) ? m_ir->CreateAdd(acc0, acc1) : (acc0 ? acc0 : acc1); // Create the checksum u32 checksum[16] = {0}; @@ -1808,12 +1802,12 @@ public: if (k < start || k >= end || !func.data[(k - start) / 4]) { indices[i] = elements; - holes = true; + holes = true; } else { indices[i] = i; - data = true; + data = true; } } @@ -1855,7 +1849,7 @@ public: } vls = m_ir->CreateXor(vls, ConstantDataVector::get(m_context, llvm::ArrayRef(words, elements))); - + // Interleave accumulators for more performance if (toggle) { @@ -1868,7 +1862,7 @@ public: toggle = !toggle; check_iterations++; } - llvm::Value* acc = (acc0 && acc1) ? m_ir->CreateAdd(acc0, acc1): (acc0 ? acc0 : acc1); + llvm::Value* acc = (acc0 && acc1) ? m_ir->CreateAdd(acc0, acc1) : (acc0 ? acc0 : acc1); // Pattern for PTEST if (m_use_avx512) @@ -2301,7 +2295,10 @@ public: llvm::SetVector work_list; std::unordered_map worked_on; - if (!common_pdom || std::none_of(killers.begin(), killers.end(), [common_pdom](const llvm::BasicBlock* block){ return block == common_pdom;})) + if (!common_pdom || std::none_of(killers.begin(), killers.end(), [common_pdom](const llvm::BasicBlock* block) + { + return block == common_pdom; + })) { if (common_pdom) { @@ -2326,7 +2323,10 @@ public: for (usz wi = 0; wi < work_list.size(); wi++) { auto* cur = work_list[wi]; - if (std::any_of(killers.begin(), killers.end(), [cur](const llvm::BasicBlock* block){ return block == cur; })) + if (std::any_of(killers.begin(), killers.end(), [cur](const llvm::BasicBlock* block) + { + return block == cur; + })) { work2_list.emplace_back(cur, bb_to_info[cur] && bb_to_info[cur]->does_gpr_barrier_preceed_first_store(i)); continue; @@ -2398,8 +2398,12 @@ public: worked_on[p] = true; work2_list.push_back(std::make_pair(p, found_user)); } - // Enqueue a second iteration for found_user=true if only found with found_user=false - else if (found_user && !std::find_if(work2_list.rbegin(), work2_list.rend(), [&](auto& it){ return it.first == p; })->second) + // Enqueue a second iteration for found_user=true if only found with found_user=false + else if (found_user && !std::find_if(work2_list.rbegin(), work2_list.rend(), [&](auto& it) + { + return it.first == p; + }) + ->second) { work2_list.push_back(std::make_pair(p, true)); } @@ -2543,8 +2547,12 @@ public: worked_on[target] = true; work_list.emplace_back(target, found_barrier); } - // Enqueue a second iteration for found_barrier=true if only found with found_barrier=false - else if (found_barrier && !std::find_if(work_list.rbegin(), work_list.rend(), [&](auto& it){ return it.first == target; })->second) + // Enqueue a second iteration for found_barrier=true if only found with found_barrier=false + else if (found_barrier && !std::find_if(work_list.rbegin(), work_list.rend(), [&](auto& it) + { + return it.first == target; + }) + ->second) { work_list.emplace_back(target, true); } @@ -2579,7 +2587,10 @@ public: b2->store_context_last_id[i] = 0; b2->store_context_first_id[i] = b2->store_context_ctr[i] + 1; - if (std::none_of(block_q.begin() + bi, block_q.end(), [b_info = b2](auto&& a) { return a.second == b_info; })) + if (std::none_of(block_q.begin() + bi, block_q.end(), [b_info = b2](auto&& a) + { + return a.second == b_info; + })) { // Sunk store can be checked again block_q.emplace_back(a2, b2); @@ -2998,7 +3009,7 @@ public: f->setCallingConv(CallingConv::GHC); m_function = f; - m_lsptr = f->getArg(0); + m_lsptr = f->getArg(0); m_thread = f->getArg(1); m_interp_pc = f->getArg(2); m_interp_op = f->getArg(3); @@ -3133,7 +3144,7 @@ public: itype == spu_itype::DFCEQ || itype == spu_itype::DFTSV) { - m_interp_7f0 = m_ir->getInt32(0x7f0); + m_interp_7f0 = m_ir->getInt32(0x7f0); m_interp_regs = _ptr(m_thread, get_reg_offset(0)); fret = ret_func; } @@ -3169,7 +3180,7 @@ public: itype == spu_itype::STOP || itype == spu_itype::STOPD) { - m_interp_7f0 = m_ir->getInt32(0x7f0); + m_interp_7f0 = m_ir->getInt32(0x7f0); m_interp_regs = _ptr(m_thread, get_reg_offset(0)); } @@ -3888,12 +3899,12 @@ public: { if (true) { - const auto tag_mask = m_ir->CreateLoad(get_type(), spu_ptr(&spu_thread::ch_tag_mask)); + const auto tag_mask = m_ir->CreateLoad(get_type(), spu_ptr(&spu_thread::ch_tag_mask)); const auto mfc_fence = m_ir->CreateLoad(get_type(), spu_ptr(&spu_thread::mfc_fence)); const auto completed = m_ir->CreateAnd(tag_mask, m_ir->CreateNot(mfc_fence)); - const auto upd_ptr = spu_ptr(&spu_thread::ch_tag_upd); - const auto stat_ptr = spu_ptr(&spu_thread::ch_tag_stat); - const auto stat_val = m_ir->CreateOr(m_ir->CreateZExt(completed, get_type()), s64{smin}); + const auto upd_ptr = spu_ptr(&spu_thread::ch_tag_upd); + const auto stat_ptr = spu_ptr(&spu_thread::ch_tag_stat); + const auto stat_val = m_ir->CreateOr(m_ir->CreateZExt(completed, get_type()), s64{smin}); const auto next = llvm::BasicBlock::Create(m_context, "", m_function); const auto next0 = llvm::BasicBlock::Create(m_context, "", m_function); @@ -3917,8 +3928,7 @@ public: m_ir->CreateBr(next); m_ir->SetInsertPoint(any); - const auto cond = m_ir->CreateSelect(m_ir->CreateICmpEQ(val.value, m_ir->getInt32(MFC_TAG_UPDATE_ANY)) - , m_ir->CreateICmpNE(completed, m_ir->getInt32(0)), m_ir->CreateICmpEQ(completed, tag_mask)); + const auto cond = m_ir->CreateSelect(m_ir->CreateICmpEQ(val.value, m_ir->getInt32(MFC_TAG_UPDATE_ANY)), m_ir->CreateICmpNE(completed, m_ir->getInt32(0)), m_ir->CreateICmpEQ(completed, tag_mask)); m_ir->CreateStore(m_ir->CreateSelect(cond, m_ir->getInt32(MFC_TAG_UPDATE_IMMEDIATE), val.value), upd_ptr); m_ir->CreateCondBr(cond, update, next, m_md_likely); @@ -3945,7 +3955,7 @@ public: } spu_log.warning("[0x%x] MFC_EAH: $%u is not a zero constant", m_pos, +op.rt); - //m_ir->CreateStore(val.value, spu_ptr(&spu_thread::ch_mfc_cmd, &spu_mfc_cmd::eah)); + // m_ir->CreateStore(val.value, spu_ptr(&spu_thread::ch_mfc_cmd, &spu_mfc_cmd::eah)); return; } case MFC_EAL: @@ -4637,19 +4647,19 @@ public: void AND(spu_opcode_t op) { if (match_vr(op.ra, [&](auto a, auto /*MP1*/) - { - if (auto b = match_vr_as(a, op.rb)) - { - set_vr(op.rt, a & b); - return true; - } + { + if (auto b = match_vr_as(a, op.rb)) + { + set_vr(op.rt, a & b); + return true; + } - return match_vr(op.rb, [&](auto /*b*/, auto /*MP2*/) - { - set_vr(op.rt, a & get_vr_as(a, op.rb)); - return true; - }); - })) + return match_vr(op.rb, [&](auto /*b*/, auto /*MP2*/) + { + set_vr(op.rt, a & get_vr_as(a, op.rb)); + return true; + }); + })) { return; } @@ -4732,17 +4742,17 @@ public: { // FSM following a comparison instruction if (match_vr(op.ra, [&](auto c, auto MP) - { - using VT = typename decltype(MP)::type; + { + using VT = typename decltype(MP)::type; - if (auto [ok, x] = match_expr(c, sext(match]>())); ok) - { - set_vr(op.rt, (splat_scalar(c))); - return true; - } + if (auto [ok, x] = match_expr(c, sext(match]>())); ok) + { + set_vr(op.rt, (splat_scalar(c))); + return true; + } - return false; - })) + return false; + })) { return; } @@ -4781,33 +4791,33 @@ public: void ROTQBYBI(spu_opcode_t op) { register_intrinsic("spu_rotqbybi", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - const auto b = value(ci->getOperand(1)); - - // Data with swapped endian from a load instruction - if (auto [ok, as] = match_expr(a, byteswap(match())); ok) { - const auto sc = build(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); - const auto sh = sc + (splat_scalar(b) >> 3); + const auto a = value(ci->getOperand(0)); + const auto b = value(ci->getOperand(1)); + + // Data with swapped endian from a load instruction + if (auto [ok, as] = match_expr(a, byteswap(match())); ok) + { + const auto sc = build(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); + const auto sh = sc + (splat_scalar(b) >> 3); + + if (m_use_avx512_icl) + { + return eval(vpermb(as, sh)); + } + + return eval(pshufb(as, (sh & 0xf))); + } + const auto sc = build(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + const auto sh = sc - (splat_scalar(b) >> 3); if (m_use_avx512_icl) { - return eval(vpermb(as, sh)); + return eval(vpermb(a, sh)); } - return eval(pshufb(as, (sh & 0xf))); - } - const auto sc = build(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - const auto sh = sc - (splat_scalar(b) >> 3); - - if (m_use_avx512_icl) - { - return eval(vpermb(a, sh)); - } - - return eval(pshufb(a, (sh & 0xf))); - }); + return eval(pshufb(a, (sh & 0xf))); + }); set_vr(op.rt, rotqbybi(get_vr(op.ra), get_vr(op.rb))); } @@ -4974,7 +4984,7 @@ public: { minusb = eval(x); } - + const auto bx = splat_scalar(minusb) & 0x7; set_vr(op.rt, fshr(zshuffle(a, 1, 2, 3, 4), a, bx)); } @@ -5095,12 +5105,12 @@ public: void ORX(spu_opcode_t op) { register_intrinsic("spu_orx", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - const auto x = zshuffle(a, 2, 3, 0, 1) | a; - const auto y = zshuffle(x, 1, 0, 3, 2) | x; - return zshuffle(y, 4, 4, 4, 3); - }); + { + const auto a = value(ci->getOperand(0)); + const auto x = zshuffle(a, 2, 3, 0, 1) | a; + const auto y = zshuffle(x, 1, 0, 3, 2) | x; + return zshuffle(y, 4, 4, 4, 3); + }); set_vr(op.rt, orx(get_vr(op.ra))); } @@ -5196,7 +5206,8 @@ public: void SHLQBYI(spu_opcode_t op) { - if (get_reg_raw(op.ra) && !op.i7) return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); // For expressions matching + if (get_reg_raw(op.ra) && !op.i7) + return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); // For expressions matching const auto a = get_vr(op.ra); const auto sc = build(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); const auto sh = sc - (get_imm(op.i7, false) & 0x1f); @@ -5424,19 +5435,22 @@ public: void ORI(spu_opcode_t op) { - if (get_reg_raw(op.ra) && !op.si10) return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); // For expressions matching + if (get_reg_raw(op.ra) && !op.si10) + return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); // For expressions matching set_vr(op.rt, get_vr(op.ra) | get_imm(op.si10)); } void ORHI(spu_opcode_t op) { - if (get_reg_raw(op.ra) && !op.si10) return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); + if (get_reg_raw(op.ra) && !op.si10) + return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); set_vr(op.rt, get_vr(op.ra) | get_imm(op.si10)); } void ORBI(spu_opcode_t op) { - if (get_reg_raw(op.ra) && !op.si10) return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); + if (get_reg_raw(op.ra) && !op.si10) + return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); set_vr(op.rt, get_vr(op.ra) | get_imm(op.si10)); } @@ -5452,49 +5466,57 @@ public: void ANDI(spu_opcode_t op) { - if (get_reg_raw(op.ra) && op.si10 == -1) return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); + if (get_reg_raw(op.ra) && op.si10 == -1) + return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); set_vr(op.rt, get_vr(op.ra) & get_imm(op.si10)); } void ANDHI(spu_opcode_t op) { - if (get_reg_raw(op.ra) && op.si10 == -1) return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); + if (get_reg_raw(op.ra) && op.si10 == -1) + return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); set_vr(op.rt, get_vr(op.ra) & get_imm(op.si10)); } void ANDBI(spu_opcode_t op) { - if (get_reg_raw(op.ra) && static_cast(op.si10) == -1) return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); + if (get_reg_raw(op.ra) && static_cast(op.si10) == -1) + return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); set_vr(op.rt, get_vr(op.ra) & get_imm(op.si10)); } void AI(spu_opcode_t op) { - if (get_reg_raw(op.ra) && !op.si10) return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); + if (get_reg_raw(op.ra) && !op.si10) + return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); set_vr(op.rt, get_vr(op.ra) + get_imm(op.si10)); } void AHI(spu_opcode_t op) { - if (get_reg_raw(op.ra) && !op.si10) return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); + if (get_reg_raw(op.ra) && !op.si10) + return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); set_vr(op.rt, get_vr(op.ra) + get_imm(op.si10)); } void XORI(spu_opcode_t op) { - if (get_reg_raw(op.ra) && !op.si10) return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); + if (get_reg_raw(op.ra) && !op.si10) + return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); set_vr(op.rt, get_vr(op.ra) ^ get_imm(op.si10)); } void XORHI(spu_opcode_t op) { - if (get_reg_raw(op.ra) && !op.si10) return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); + if (get_reg_raw(op.ra) && !op.si10) + return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); set_vr(op.rt, get_vr(op.ra) ^ get_imm(op.si10)); } void XORBI(spu_opcode_t op) { - if (get_reg_raw(op.ra) && !op.si10) return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); + if (get_reg_raw(op.ra) && !op.si10) + return set_reg_fixed(op.rt, get_reg_raw(op.ra), false); set_vr(op.rt, get_vr(op.ra) ^ get_imm(op.si10)); } @@ -5561,82 +5583,82 @@ public: void SELB(spu_opcode_t op) { if (match_vr(op.rc, [&](auto c, auto MP) - { - using VT = typename decltype(MP)::type; - - // If the control mask comes from a comparison instruction, replace SELB with select - if (auto [ok, x] = match_expr(c, sext(match]>())); ok) - { - if constexpr (std::extent_v == 2) // u64[2] { - // Try to select floats as floats if a OR b is typed as f64[2] - if (auto [a, b] = match_vrs(op.ra, op.rb); a || b) - { - set_vr(op.rt4, select(x, get_vr(op.rb), get_vr(op.ra))); - return true; - } - } + using VT = typename decltype(MP)::type; - if constexpr (std::extent_v == 4) // u32[4] - { - // Match division (adjusted) (TODO) - if (auto a = match_vr(op.ra)) + // If the control mask comes from a comparison instruction, replace SELB with select + if (auto [ok, x] = match_expr(c, sext(match]>())); ok) { - static const auto MT = match(); - - if (auto [div_ok, diva, divb] = match_expr(a, MT / MT); div_ok) + if constexpr (std::extent_v == 2) // u64[2] { - if (auto b = match_vr(op.rb)) + // Try to select floats as floats if a OR b is typed as f64[2] + if (auto [a, b] = match_vrs(op.ra, op.rb); a || b) { - if (auto [add1_ok] = match_expr(b, bitcast(a) + splat(1)); add1_ok) - { - if (auto [fm_ok, a1, b1] = match_expr(x, bitcast(fm(MT, MT)) > splat(-1)); fm_ok) - { - if (auto [fnma_ok] = match_expr(a1, fnms(divb, bitcast(b), diva)); fnma_ok) - { - if (fabs(b1).eval(m_ir) == fsplat(1.0).eval(m_ir)) - { - set_vr(op.rt4, diva / divb); - return true; - } + set_vr(op.rt4, select(x, get_vr(op.rb), get_vr(op.ra))); + return true; + } + } - if (auto [sel_ok] = match_expr(b1, bitcast((bitcast(diva) & 0x80000000) | 0x3f800000)); sel_ok) + if constexpr (std::extent_v == 4) // u32[4] + { + // Match division (adjusted) (TODO) + if (auto a = match_vr(op.ra)) + { + static const auto MT = match(); + + if (auto [div_ok, diva, divb] = match_expr(a, MT / MT); div_ok) + { + if (auto b = match_vr(op.rb)) + { + if (auto [add1_ok] = match_expr(b, bitcast(a) + splat(1)); add1_ok) + { + if (auto [fm_ok, a1, b1] = match_expr(x, bitcast(fm(MT, MT)) > splat(-1)); fm_ok) { - set_vr(op.rt4, diva / divb); - return true; + if (auto [fnma_ok] = match_expr(a1, fnms(divb, bitcast(b), diva)); fnma_ok) + { + if (fabs(b1).eval(m_ir) == fsplat(1.0).eval(m_ir)) + { + set_vr(op.rt4, diva / divb); + return true; + } + + if (auto [sel_ok] = match_expr(b1, bitcast((bitcast(diva) & 0x80000000) | 0x3f800000)); sel_ok) + { + set_vr(op.rt4, diva / divb); + return true; + } + } } } } } } + + if (auto [a, b] = match_vrs(op.ra, op.rb); a || b) + { + set_vr(op.rt4, select(x, get_vr(op.rb), get_vr(op.ra))); + return true; + } + + if (auto [a, b] = match_vrs(op.ra, op.rb); a || b) + { + set_vr(op.rt4, select(x, get_vr(op.rb), get_vr(op.ra))); + return true; + } } - } - if (auto [a, b] = match_vrs(op.ra, op.rb); a || b) - { - set_vr(op.rt4, select(x, get_vr(op.rb), get_vr(op.ra))); + if (auto [ok, y] = match_expr(x, bitcast]>(match>>())); ok) + { + // Don't ruin FSMB/FSM/FSMH instructions + return false; + } + + set_vr(op.rt4, select(x, get_vr(op.rb), get_vr(op.ra))); return true; } - if (auto [a, b] = match_vrs(op.ra, op.rb); a || b) - { - set_vr(op.rt4, select(x, get_vr(op.rb), get_vr(op.ra))); - return true; - } - } - - if (auto [ok, y] = match_expr(x, bitcast]>(match>>())); ok) - { - // Don't ruin FSMB/FSM/FSMH instructions return false; - } - - set_vr(op.rt4, select(x, get_vr(op.rb), get_vr(op.ra))); - return true; - } - - return false; - })) + })) { return; } @@ -5660,12 +5682,12 @@ public: { if (auto [a, b] = match_vrs(op.ra, op.rb); a || b) { - set_vr(op.rt4, select(noncast(c) != 0, get_vr(op.rb), get_vr(op.ra))); + set_vr(op.rt4, select(noncast(c) != 0, get_vr(op.rb), get_vr(op.ra))); return; } else if (auto [a, b] = match_vrs(op.ra, op.rb); a || b) { - set_vr(op.rt4, select(noncast(c) != 0, get_vr(op.rb), get_vr(op.ra))); + set_vr(op.rt4, select(noncast(c) != 0, get_vr(op.rb), get_vr(op.ra))); return; } @@ -5701,7 +5723,7 @@ public: if (sel_8) { - set_vr(op.rt4, select(bitcast(c) != 0,get_vr(op.rb), get_vr(op.ra))); + set_vr(op.rt4, select(bitcast(c) != 0, get_vr(op.rb), get_vr(op.ra))); return; } } @@ -5728,18 +5750,18 @@ public: void SHUFB(spu_opcode_t op) // { if (match_vr(op.rc, [&](auto c, auto MP) - { - using VT = typename decltype(MP)::type; + { + using VT = typename decltype(MP)::type; - // If the mask comes from a constant generation instruction, replace SHUFB with insert - if (auto [ok, i] = match_expr(c, spu_get_insertion_shuffle_mask(match())); ok) - { - set_vr(op.rt4, insert(get_vr(op.rb), i, get_scalar(get_vr(op.ra)))); - return true; - } + // If the mask comes from a constant generation instruction, replace SHUFB with insert + if (auto [ok, i] = match_expr(c, spu_get_insertion_shuffle_mask(match())); ok) + { + set_vr(op.rt4, insert(get_vr(op.rb), i, get_scalar(get_vr(op.ra)))); + return true; + } - return false; - })) + return false; + })) { return; } @@ -5759,38 +5781,37 @@ public: decltype(&cpu_translator::get_type) type; u64 extract_from; u64 insert_to; - } s_masks[30] - { - { 0x0311121314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 15 }, - { 0x1003121314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 14 }, - { 0x1011031314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 13 }, - { 0x1011120314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 12 }, - { 0x1011121303151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 11 }, - { 0x1011121314031617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 10 }, - { 0x1011121314150317, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 9 }, - { 0x1011121314151603, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 8 }, - { 0x1011121314151617, 0x03191a1b1c1d1e1f, &cpu_translator::get_type, 12, 7 }, - { 0x1011121314151617, 0x18031a1b1c1d1e1f, &cpu_translator::get_type, 12, 6 }, - { 0x1011121314151617, 0x1819031b1c1d1e1f, &cpu_translator::get_type, 12, 5 }, - { 0x1011121314151617, 0x18191a031c1d1e1f, &cpu_translator::get_type, 12, 4 }, - { 0x1011121314151617, 0x18191a1b031d1e1f, &cpu_translator::get_type, 12, 3 }, - { 0x1011121314151617, 0x18191a1b1c031e1f, &cpu_translator::get_type, 12, 2 }, - { 0x1011121314151617, 0x18191a1b1c1d031f, &cpu_translator::get_type, 12, 1 }, - { 0x1011121314151617, 0x18191a1b1c1d1e03, &cpu_translator::get_type, 12, 0 }, - { 0x0203121314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 6, 7 }, - { 0x1011020314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 6, 6 }, - { 0x1011121302031617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 6, 5 }, - { 0x1011121314150203, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 6, 4 }, - { 0x1011121314151617, 0x02031a1b1c1d1e1f, &cpu_translator::get_type, 6, 3 }, - { 0x1011121314151617, 0x181902031c1d1e1f, &cpu_translator::get_type, 6, 2 }, - { 0x1011121314151617, 0x18191a1b02031e1f, &cpu_translator::get_type, 6, 1 }, - { 0x1011121314151617, 0x18191a1b1c1d0203, &cpu_translator::get_type, 6, 0 }, - { 0x0001020314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 3, 3 }, - { 0x1011121300010203, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 3, 2 }, - { 0x1011121314151617, 0x000102031c1d1e1f, &cpu_translator::get_type, 3, 1 }, - { 0x1011121314151617, 0x18191a1b00010203, &cpu_translator::get_type, 3, 0 }, - { 0x0001020304050607, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 1, 1 }, - { 0x1011121303151617, 0x0001020304050607, &cpu_translator::get_type, 1, 0 }, + } s_masks[30]{ + {0x0311121314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 15}, + {0x1003121314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 14}, + {0x1011031314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 13}, + {0x1011120314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 12}, + {0x1011121303151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 11}, + {0x1011121314031617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 10}, + {0x1011121314150317, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 9}, + {0x1011121314151603, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 12, 8}, + {0x1011121314151617, 0x03191a1b1c1d1e1f, &cpu_translator::get_type, 12, 7}, + {0x1011121314151617, 0x18031a1b1c1d1e1f, &cpu_translator::get_type, 12, 6}, + {0x1011121314151617, 0x1819031b1c1d1e1f, &cpu_translator::get_type, 12, 5}, + {0x1011121314151617, 0x18191a031c1d1e1f, &cpu_translator::get_type, 12, 4}, + {0x1011121314151617, 0x18191a1b031d1e1f, &cpu_translator::get_type, 12, 3}, + {0x1011121314151617, 0x18191a1b1c031e1f, &cpu_translator::get_type, 12, 2}, + {0x1011121314151617, 0x18191a1b1c1d031f, &cpu_translator::get_type, 12, 1}, + {0x1011121314151617, 0x18191a1b1c1d1e03, &cpu_translator::get_type, 12, 0}, + {0x0203121314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 6, 7}, + {0x1011020314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 6, 6}, + {0x1011121302031617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 6, 5}, + {0x1011121314150203, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 6, 4}, + {0x1011121314151617, 0x02031a1b1c1d1e1f, &cpu_translator::get_type, 6, 3}, + {0x1011121314151617, 0x181902031c1d1e1f, &cpu_translator::get_type, 6, 2}, + {0x1011121314151617, 0x18191a1b02031e1f, &cpu_translator::get_type, 6, 1}, + {0x1011121314151617, 0x18191a1b1c1d0203, &cpu_translator::get_type, 6, 0}, + {0x0001020314151617, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 3, 3}, + {0x1011121300010203, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 3, 2}, + {0x1011121314151617, 0x000102031c1d1e1f, &cpu_translator::get_type, 3, 1}, + {0x1011121314151617, 0x18191a1b00010203, &cpu_translator::get_type, 3, 0}, + {0x0001020304050607, 0x18191a1b1c1d1e1f, &cpu_translator::get_type, 1, 1}, + {0x1011121303151617, 0x0001020304050607, &cpu_translator::get_type, 1, 0}, }; // Check important constants from CWD-like constant generation instructions @@ -6108,7 +6129,7 @@ public: // clamping helpers value_t clamp_positive_smax(value_t v) { - return eval(bitcast(min(bitcast(v),splat(0x7f7fffff)))); + return eval(bitcast(min(bitcast(v), splat(0x7f7fffff)))); } value_t clamp_negative_smax(value_t v) @@ -6118,7 +6139,7 @@ public: return v; } - return eval(bitcast(min(bitcast(v),splat(0xff7fffff)))); + return eval(bitcast(min(bitcast(v), splat(0xff7fffff)))); } value_t clamp_smax(value_t v) @@ -6178,29 +6199,29 @@ public: void FREST(spu_opcode_t op) { register_intrinsic("spu_frest", [&](llvm::CallInst* ci) - { - const auto a = bitcast(value(ci->getOperand(0))); - - const auto a_fraction = (a >> splat(18)) & splat(0x1F); - const auto a_exponent = (a & splat(0x7F800000u)); - const auto r_exponent = sub_sat(build(0000, 0x7E80, 0000, 0x7E80, 0000, 0x7E80, 0000, 0x7E80), bitcast(a_exponent)); - const auto fix_exponent = select((a_exponent > 0), bitcast(r_exponent), splat(0x7F800000u)); - const auto a_sign = (a & splat(0x80000000)); - value_t final_result = eval(splat(0)); - - for (u32 i = 0; i < 4; i++) { - const auto eval_fraction = eval(extract(a_fraction, i)); + const auto a = bitcast(value(ci->getOperand(0))); - value_t r_fraction = load_const(m_spu_frest_fraction_lut, eval_fraction); + const auto a_fraction = (a >> splat(18)) & splat(0x1F); + const auto a_exponent = (a & splat(0x7F800000u)); + const auto r_exponent = sub_sat(build(0000, 0x7E80, 0000, 0x7E80, 0000, 0x7E80, 0000, 0x7E80), bitcast(a_exponent)); + const auto fix_exponent = select((a_exponent > 0), bitcast(r_exponent), splat(0x7F800000u)); + const auto a_sign = (a & splat(0x80000000)); + value_t final_result = eval(splat(0)); - final_result = eval(insert(final_result, i, r_fraction)); - } + for (u32 i = 0; i < 4; i++) + { + const auto eval_fraction = eval(extract(a_fraction, i)); - //final_result = eval(select(final_result != (0), final_result, bitcast(pshufb(splat(0), bitcast(final_result))))); + value_t r_fraction = load_const(m_spu_frest_fraction_lut, eval_fraction); - return bitcast(bitcast(final_result | bitcast(fix_exponent) | a_sign)); - }); + final_result = eval(insert(final_result, i, r_fraction)); + } + + // final_result = eval(select(final_result != (0), final_result, bitcast(pshufb(splat(0), bitcast(final_result))))); + + return bitcast(bitcast(final_result | bitcast(fix_exponent) | a_sign)); + }); set_vr(op.rt, frest(get_vr(op.ra))); } @@ -6214,26 +6235,26 @@ public: void FRSQEST(spu_opcode_t op) { register_intrinsic("spu_frsqest", [&](llvm::CallInst* ci) - { - const auto a = bitcast(value(ci->getOperand(0))); - - const auto a_fraction = (a >> splat(18)) & splat(0x3F); - const auto a_exponent = (a >> splat(23)) & splat(0xFF); - value_t final_result = eval(splat(0)); - - for (u32 i = 0; i < 4; i++) { - const auto eval_fraction = eval(extract(a_fraction, i)); - const auto eval_exponent = eval(extract(a_exponent, i)); + const auto a = bitcast(value(ci->getOperand(0))); - value_t r_fraction = load_const(m_spu_frsqest_fraction_lut, eval_fraction); - value_t r_exponent = load_const(m_spu_frsqest_exponent_lut, eval_exponent); + const auto a_fraction = (a >> splat(18)) & splat(0x3F); + const auto a_exponent = (a >> splat(23)) & splat(0xFF); + value_t final_result = eval(splat(0)); - final_result = eval(insert(final_result, i, eval(r_fraction | r_exponent))); - } + for (u32 i = 0; i < 4; i++) + { + const auto eval_fraction = eval(extract(a_fraction, i)); + const auto eval_exponent = eval(extract(a_exponent, i)); - return bitcast(final_result); - }); + value_t r_fraction = load_const(m_spu_frsqest_fraction_lut, eval_fraction); + value_t r_exponent = load_const(m_spu_frsqest_exponent_lut, eval_exponent); + + final_result = eval(insert(final_result, i, eval(r_fraction | r_exponent))); + } + + return bitcast(final_result); + }); set_vr(op.rt, frsqest(get_vr(op.ra))); } @@ -6253,61 +6274,62 @@ public: } register_intrinsic("spu_fcgt", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - const auto b = value(ci->getOperand(1)); - - const value_t ab[2]{a, b}; - - std::bitset<2> safe_int_compare(0); - std::bitset<2> safe_finite_compare(0); - - for (u32 i = 0; i < 2; i++) { - if (auto [ok, data] = get_const_vector(ab[i].value, m_pos, __LINE__ + i); ok) + const auto a = value(ci->getOperand(0)); + const auto b = value(ci->getOperand(1)); + + const value_t ab[2]{a, b}; + + std::bitset<2> safe_int_compare(0); + std::bitset<2> safe_finite_compare(0); + + for (u32 i = 0; i < 2; i++) { - safe_int_compare.set(i); - safe_finite_compare.set(i); - - for (u32 j = 0; j < 4; j++) + if (auto [ok, data] = get_const_vector(ab[i].value, m_pos, __LINE__ + i); ok) { - const u32 value = data._u32[j]; - const u8 exponent = static_cast(value >> 23); + safe_int_compare.set(i); + safe_finite_compare.set(i); - if (value >= 0x7f7fffffu || !exponent) + for (u32 j = 0; j < 4; j++) { - // Postive or negative zero, Denormal (treated as zero), Negative constant, or Normalized number with exponent +127 - // Cannot used signed integer compare safely - // Note: Technically this optimization is accurate for any positive value, but due to the fact that - // we don't produce "extended range" values the same way as real hardware, it's not safe to apply - // this optimization for values outside of the range of x86 floating point hardware. - safe_int_compare.reset(i); - if ((value & 0x7fffffffu) >= 0x7f7ffffeu) safe_finite_compare.reset(i); + const u32 value = data._u32[j]; + const u8 exponent = static_cast(value >> 23); + + if (value >= 0x7f7fffffu || !exponent) + { + // Postive or negative zero, Denormal (treated as zero), Negative constant, or Normalized number with exponent +127 + // Cannot used signed integer compare safely + // Note: Technically this optimization is accurate for any positive value, but due to the fact that + // we don't produce "extended range" values the same way as real hardware, it's not safe to apply + // this optimization for values outside of the range of x86 floating point hardware. + safe_int_compare.reset(i); + if ((value & 0x7fffffffu) >= 0x7f7ffffeu) + safe_finite_compare.reset(i); + } } } } - } - if (safe_int_compare.any()) - { - return eval(sext(bitcast(a) > bitcast(b))); - } + if (safe_int_compare.any()) + { + return eval(sext(bitcast(a) > bitcast(b))); + } - if (safe_finite_compare.test(1)) - { - return eval(sext(fcmp_uno(clamp_negative_smax(a) > b))); - } + if (safe_finite_compare.test(1)) + { + return eval(sext(fcmp_uno(clamp_negative_smax(a) > b))); + } - if (safe_finite_compare.test(0)) - { - return eval(sext(fcmp_ord(a > clamp_smax(b)))); - } + if (safe_finite_compare.test(0)) + { + return eval(sext(fcmp_ord(a > clamp_smax(b)))); + } - const auto ai = eval(bitcast(a)); - const auto bi = eval(bitcast(b)); + const auto ai = eval(bitcast(a)); + const auto bi = eval(bitcast(b)); - return eval(sext(fcmp_uno(a != b) & select((ai & bi) >= 0, ai > bi, ai < bi))); - }); + return eval(sext(fcmp_uno(a != b) & select((ai & bi) >= 0, ai > bi, ai < bi))); + }); set_vr(op.rt, fcgt(get_vr(op.ra), get_vr(op.rb))); } @@ -6327,54 +6349,54 @@ public: } register_intrinsic("spu_fcmgt", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - const auto b = value(ci->getOperand(1)); - - const value_t ab[2]{a, b}; - - std::bitset<2> safe_int_compare(0); - - for (u32 i = 0; i < 2; i++) { - if (auto [ok, data] = get_const_vector(ab[i].value, m_pos, __LINE__ + i); ok) + const auto a = value(ci->getOperand(0)); + const auto b = value(ci->getOperand(1)); + + const value_t ab[2]{a, b}; + + std::bitset<2> safe_int_compare(0); + + for (u32 i = 0; i < 2; i++) { - safe_int_compare.set(i); - - for (u32 j = 0; j < 4; j++) + if (auto [ok, data] = get_const_vector(ab[i].value, m_pos, __LINE__ + i); ok) { - const u32 value = data._u32[j]; - const u8 exponent = static_cast(value >> 23); + safe_int_compare.set(i); - if ((value & 0x7fffffffu) >= 0x7f7fffffu || !exponent) + for (u32 j = 0; j < 4; j++) { - // See above - safe_int_compare.reset(i); + const u32 value = data._u32[j]; + const u8 exponent = static_cast(value >> 23); + + if ((value & 0x7fffffffu) >= 0x7f7fffffu || !exponent) + { + // See above + safe_int_compare.reset(i); + } } } } - } - const auto ma = eval(fabs(a)); - const auto mb = eval(fabs(b)); + const auto ma = eval(fabs(a)); + const auto mb = eval(fabs(b)); - const auto mai = eval(bitcast(ma)); - const auto mbi = eval(bitcast(mb)); + const auto mai = eval(bitcast(ma)); + const auto mbi = eval(bitcast(mb)); - if (safe_int_compare.any()) - { - return eval(sext(mai > mbi)); - } + if (safe_int_compare.any()) + { + return eval(sext(mai > mbi)); + } - if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) - { - return eval(sext(fcmp_uno(ma > mb) & (mai > mbi))); - } - else - { - return eval(sext(fcmp_ord(ma > mb))); - } - }); + if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) + { + return eval(sext(fcmp_uno(ma > mb) & (mai > mbi))); + } + else + { + return eval(sext(fcmp_ord(ma > mb))); + } + }); set_vr(op.rt, fcmgt(get_vr(op.ra), get_vr(op.rb))); } @@ -6394,12 +6416,12 @@ public: } register_intrinsic("spu_fa", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - const auto b = value(ci->getOperand(1)); + { + const auto a = value(ci->getOperand(0)); + const auto b = value(ci->getOperand(1)); - return a + b; - }); + return a + b; + }); set_vr(op.rt, fa(get_vr(op.ra), get_vr(op.rb))); } @@ -6419,20 +6441,20 @@ public: } register_intrinsic("spu_fs", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - const auto b = value(ci->getOperand(1)); + { + const auto a = value(ci->getOperand(0)); + const auto b = value(ci->getOperand(1)); - if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) - { - const auto bc = clamp_smax(b); // for #4478 - return eval(a - bc); - } - else - { - return eval(a - b); - } - }); + if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) + { + const auto bc = clamp_smax(b); // for #4478 + return eval(a - bc); + } + else + { + return eval(a - b); + } + }); set_vr(op.rt, fs(get_vr(op.ra), get_vr(op.rb))); } @@ -6452,26 +6474,26 @@ public: } register_intrinsic("spu_fm", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - const auto b = value(ci->getOperand(1)); - - if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) { - if (a.value == b.value) + const auto a = value(ci->getOperand(0)); + const auto b = value(ci->getOperand(1)); + + if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) + { + if (a.value == b.value) + { + return eval(a * b); + } + + const auto ma = sext(fcmp_uno(a != fsplat(0.))); + const auto mb = sext(fcmp_uno(b != fsplat(0.))); + return eval(bitcast(bitcast(a * b) & ma & mb)); + } + else { return eval(a * b); } - - const auto ma = sext(fcmp_uno(a != fsplat(0.))); - const auto mb = sext(fcmp_uno(b != fsplat(0.))); - return eval(bitcast(bitcast(a * b) & ma & mb)); - } - else - { - return eval(a * b); - } - }); + }); if (op.ra == op.rb && !m_interp_magn) { @@ -6539,11 +6561,11 @@ public: } register_intrinsic("spu_fesd", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); + { + const auto a = value(ci->getOperand(0)); - return fpcast(zshuffle(a, 1, 3)); - }); + return fpcast(zshuffle(a, 1, 3)); + }); set_vr(op.rt, fesd(get_vr(op.ra))); } @@ -6570,11 +6592,11 @@ public: } register_intrinsic("spu_frds", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); + { + const auto a = value(ci->getOperand(0)); - return zshuffle(fpcast(a), 2, 0, 3, 1); - }); + return zshuffle(fpcast(a), 2, 0, 3, 1); + }); set_vr(op.rt, frds(get_vr(op.ra))); } @@ -6594,61 +6616,61 @@ public: } register_intrinsic("spu_fceq", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - const auto b = value(ci->getOperand(1)); - - const value_t ab[2]{a, b}; - - std::bitset<2> safe_float_compare(0); - std::bitset<2> safe_int_compare(0); - - for (u32 i = 0; i < 2; i++) { - if (auto [ok, data] = get_const_vector(ab[i].value, m_pos, __LINE__ + i); ok) + const auto a = value(ci->getOperand(0)); + const auto b = value(ci->getOperand(1)); + + const value_t ab[2]{a, b}; + + std::bitset<2> safe_float_compare(0); + std::bitset<2> safe_int_compare(0); + + for (u32 i = 0; i < 2; i++) { - safe_float_compare.set(i); - safe_int_compare.set(i); - - for (u32 j = 0; j < 4; j++) + if (auto [ok, data] = get_const_vector(ab[i].value, m_pos, __LINE__ + i); ok) { - const u32 value = data._u32[j]; - const u8 exponent = static_cast(value >> 23); + safe_float_compare.set(i); + safe_int_compare.set(i); - // unsafe if nan - if (exponent == 255) + for (u32 j = 0; j < 4; j++) { - safe_float_compare.reset(i); - } + const u32 value = data._u32[j]; + const u8 exponent = static_cast(value >> 23); - // unsafe if denormal or 0 - if (!exponent) - { - safe_int_compare.reset(i); + // unsafe if nan + if (exponent == 255) + { + safe_float_compare.reset(i); + } + + // unsafe if denormal or 0 + if (!exponent) + { + safe_int_compare.reset(i); + } } } } - } - if (safe_float_compare.any()) - { - return eval(sext(fcmp_ord(a == b))); - } + if (safe_float_compare.any()) + { + return eval(sext(fcmp_ord(a == b))); + } - if (safe_int_compare.any()) - { - return eval(sext(bitcast(a) == bitcast(b))); - } + if (safe_int_compare.any()) + { + return eval(sext(bitcast(a) == bitcast(b))); + } - if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) - { - return eval(sext(fcmp_ord(a == b)) | sext(bitcast(a) == bitcast(b))); - } - else - { - return eval(sext(fcmp_ord(a == b))); - } - }); + if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) + { + return eval(sext(fcmp_ord(a == b)) | sext(bitcast(a) == bitcast(b))); + } + else + { + return eval(sext(fcmp_ord(a == b))); + } + }); set_vr(op.rt, fceq(get_vr(op.ra), get_vr(op.rb))); } @@ -6668,64 +6690,64 @@ public: } register_intrinsic("spu_fcmeq", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - const auto b = value(ci->getOperand(1)); - - const value_t ab[2]{a, b}; - - std::bitset<2> safe_float_compare(0); - std::bitset<2> safe_int_compare(0); - - for (u32 i = 0; i < 2; i++) { - if (auto [ok, data] = get_const_vector(ab[i].value, m_pos, __LINE__ + i); ok) + const auto a = value(ci->getOperand(0)); + const auto b = value(ci->getOperand(1)); + + const value_t ab[2]{a, b}; + + std::bitset<2> safe_float_compare(0); + std::bitset<2> safe_int_compare(0); + + for (u32 i = 0; i < 2; i++) { - safe_float_compare.set(i); - safe_int_compare.set(i); - - for (u32 j = 0; j < 4; j++) + if (auto [ok, data] = get_const_vector(ab[i].value, m_pos, __LINE__ + i); ok) { - const u32 value = data._u32[j]; - const u8 exponent = static_cast(value >> 23); + safe_float_compare.set(i); + safe_int_compare.set(i); - // unsafe if nan - if (exponent == 255) + for (u32 j = 0; j < 4; j++) { - safe_float_compare.reset(i); - } + const u32 value = data._u32[j]; + const u8 exponent = static_cast(value >> 23); - // unsafe if denormal or 0 - if (!exponent) - { - safe_int_compare.reset(i); + // unsafe if nan + if (exponent == 255) + { + safe_float_compare.reset(i); + } + + // unsafe if denormal or 0 + if (!exponent) + { + safe_int_compare.reset(i); + } } } } - } - const auto fa = eval(fabs(a)); - const auto fb = eval(fabs(b)); + const auto fa = eval(fabs(a)); + const auto fb = eval(fabs(b)); - if (safe_float_compare.any()) - { - return eval(sext(fcmp_ord(fa == fb))); - } + if (safe_float_compare.any()) + { + return eval(sext(fcmp_ord(fa == fb))); + } - if (safe_int_compare.any()) - { - return eval(sext(bitcast(fa) == bitcast(fb))); - } + if (safe_int_compare.any()) + { + return eval(sext(bitcast(fa) == bitcast(fb))); + } - if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) - { - return eval(sext(fcmp_ord(fa == fb)) | sext(bitcast(fa) == bitcast(fb))); - } - else - { - return eval(sext(fcmp_ord(fa == fb))); - } - }); + if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) + { + return eval(sext(fcmp_ord(fa == fb)) | sext(bitcast(fa) == bitcast(fb))); + } + else + { + return eval(sext(fcmp_ord(fa == fb))); + } + }); set_vr(op.rt, fcmeq(get_vr(op.ra), get_vr(op.rb))); } @@ -6743,25 +6765,25 @@ public: } if ([&]() - { - if (auto [ok, data] = get_const_vector(a.value, m_pos); ok) { - if (is_spu_float_zero(data, 0)) + if (auto [ok, data] = get_const_vector(a.value, m_pos); ok) { - return true; + if (is_spu_float_zero(data, 0)) + { + return true; + } } - } - if (auto [ok, data] = get_const_vector(b.value, m_pos); ok) - { - if (is_spu_float_zero(data, 0)) + if (auto [ok, data] = get_const_vector(b.value, m_pos); ok) { - return true; + if (is_spu_float_zero(data, 0)) + { + return true; + } } - } - return false; - }()) + return false; + }()) { // Just return the added value if either a or b are +-0 return c; @@ -6797,13 +6819,13 @@ public: } register_intrinsic("spu_fnms", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - const auto b = value(ci->getOperand(1)); - const auto c = value(ci->getOperand(2)); + { + const auto a = value(ci->getOperand(0)); + const auto b = value(ci->getOperand(1)); + const auto c = value(ci->getOperand(2)); - return fma32x4(eval(-clamp_smax(a)), clamp_smax(b), c); - }); + return fma32x4(eval(-clamp_smax(a)), clamp_smax(b), c); + }); set_vr(op.rt4, fnms(get_vr(op.ra), get_vr(op.rb), get_vr(op.rc))); } @@ -6831,58 +6853,57 @@ public: } register_intrinsic("spu_fma", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - const auto b = value(ci->getOperand(1)); - const auto c = value(ci->getOperand(2)); + { + const auto a = value(ci->getOperand(0)); + const auto b = value(ci->getOperand(1)); + const auto c = value(ci->getOperand(2)); - if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) - { - const auto ma = sext(fcmp_uno(a != fsplat(0.))); - const auto mb = sext(fcmp_uno(b != fsplat(0.))); - const auto ca = bitcast(bitcast(a) & mb); - const auto cb = bitcast(bitcast(b) & ma); - return fma32x4(eval(ca), eval(cb), c); - } - else - { - return fma32x4(a, b, c); - } - }); + if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) + { + const auto ma = sext(fcmp_uno(a != fsplat(0.))); + const auto mb = sext(fcmp_uno(b != fsplat(0.))); + const auto ca = bitcast(bitcast(a) & mb); + const auto cb = bitcast(bitcast(b) & ma); + return fma32x4(eval(ca), eval(cb), c); + } + else + { + return fma32x4(a, b, c); + } + }); if (m_use_avx512) { register_intrinsic("spu_re_acc", [&](llvm::CallInst* ci) - { - const auto div = value(ci->getOperand(0)); - const auto the_one = value(ci->getOperand(1)); + { + const auto div = value(ci->getOperand(0)); + const auto the_one = value(ci->getOperand(1)); - const auto div_result = the_one / div; + const auto div_result = the_one / div; - return vfixupimmps(div_result, div_result, splat(0x00220088u), 0, 0xff); - }); + return vfixupimmps(div_result, div_result, splat(0x00220088u), 0, 0xff); + }); } else { register_intrinsic("spu_re_acc", [&](llvm::CallInst* ci) - { - const auto div = value(ci->getOperand(0)); - const auto the_one = value(ci->getOperand(1)); + { + const auto div = value(ci->getOperand(0)); + const auto the_one = value(ci->getOperand(1)); - const auto div_result = the_one / div; + const auto div_result = the_one / div; - // from ps3 hardware testing: Inf => NaN and NaN => Zero - const auto result_and = bitcast(div_result) & 0x7fffffffu; - const auto result_cmp_inf = sext(result_and == splat(0x7F800000u)); - const auto result_cmp_nan = sext(result_and <= splat(0x7F800000u)); + // from ps3 hardware testing: Inf => NaN and NaN => Zero + const auto result_and = bitcast(div_result) & 0x7fffffffu; + const auto result_cmp_inf = sext(result_and == splat(0x7F800000u)); + const auto result_cmp_nan = sext(result_and <= splat(0x7F800000u)); - const auto and_mask = bitcast(result_cmp_nan) & splat(0xFFFFFFFFu); - const auto or_mask = bitcast(result_cmp_inf) & splat(0xFFFFFFFu); - return bitcast((bitcast(div_result) & and_mask) | or_mask); - }); + const auto and_mask = bitcast(result_cmp_nan) & splat(0xFFFFFFFFu); + const auto or_mask = bitcast(result_cmp_inf) & splat(0xFFFFFFFu); + return bitcast((bitcast(div_result) & and_mask) | or_mask); + }); } - const auto [a, b, c] = get_vrs(op.ra, op.rb, op.rc); static const auto MT = match(); @@ -6914,7 +6935,6 @@ public: return match_expr(b, fm(fsplat(0.5), MT)); }; - if (auto [ok_fnma, a1, b1] = match_fnms(float_value); ok_fnma) { if (auto [ok_fm2, fm_half_mul] = match_fm_half(); ok_fm2 && fm_half_mul.eq(b1)) @@ -6928,7 +6948,7 @@ public: erase_stores(a, b, c, a3); set_vr(op.rt4, fsqrt(fabs(src))); return true; - } + } } else if (auto [ok_fm1, a3, b3] = match_expr(c, fm(MT, MT)); ok_fm1 && b3.eq(a1)) { @@ -6937,7 +6957,7 @@ public: erase_stores(a, b, c, b3); set_vr(op.rt4, fsqrt(fabs(src))); return true; - } + } } } else if (fm_half_mul.eq(a1)) @@ -6949,7 +6969,7 @@ public: erase_stores(a, b, c, a3); set_vr(op.rt4, fsqrt(fabs(src))); return true; - } + } } else if (auto [ok_fm1, a3, b3] = match_expr(c, fm(MT, MT)); ok_fm1 && b3.eq(b1)) { @@ -6958,7 +6978,7 @@ public: erase_stores(a, b, c, b3); set_vr(op.rt4, fsqrt(fabs(src))); return true; - } + } } } } @@ -7101,20 +7121,20 @@ public: } register_intrinsic("spu_fms", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - const auto b = value(ci->getOperand(1)); - const auto c = value(ci->getOperand(2)); + { + const auto a = value(ci->getOperand(0)); + const auto b = value(ci->getOperand(1)); + const auto c = value(ci->getOperand(2)); - if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) - { - return fma32x4(clamp_smax(a), clamp_smax(b), eval(-c)); - } - else - { - return fma32x4(a, b, eval(-c)); - } - }); + if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate) + { + return fma32x4(clamp_smax(a), clamp_smax(b), eval(-c)); + } + else + { + return fma32x4(a, b, eval(-c)); + } + }); set_vr(op.rt4, fms(get_vr(op.ra), get_vr(op.rb), get_vr(op.rc))); } @@ -7140,19 +7160,19 @@ public: void FI(spu_opcode_t op) { register_intrinsic("spu_fi", [&](llvm::CallInst* ci) - { - // TODO: adjustment for denormals(for accurate xfloat only?) - const auto a = bitcast(value(ci->getOperand(0))); - const auto b = bitcast(value(ci->getOperand(1))); + { + // TODO: adjustment for denormals(for accurate xfloat only?) + const auto a = bitcast(value(ci->getOperand(0))); + const auto b = bitcast(value(ci->getOperand(1))); - const auto base = (b & 0x007ffc00u) << 9; // Base fraction - const auto ymul = (b & 0x3ff) * (a & 0x7ffff); // Step fraction * Y fraction (fixed point at 2^-32) - const auto comparison = (ymul > base); // Should exponent be adjusted? - const auto bnew = (base - ymul) >> (zext(comparison) ^ 9); // Shift one less bit if exponent is adjusted - const auto base_result = (b & 0xff800000u) | (bnew & ~0xff800000u); // Inject old sign and exponent - const auto adjustment = bitcast(sext(comparison)) & (1 << 23); // exponent adjustement for negative bnew - return clamp_smax(eval(bitcast(base_result - adjustment))); - }); + const auto base = (b & 0x007ffc00u) << 9; // Base fraction + const auto ymul = (b & 0x3ff) * (a & 0x7ffff); // Step fraction * Y fraction (fixed point at 2^-32) + const auto comparison = (ymul > base); // Should exponent be adjusted? + const auto bnew = (base - ymul) >> (zext(comparison) ^ 9); // Shift one less bit if exponent is adjusted + const auto base_result = (b & 0xff800000u) | (bnew & ~0xff800000u); // Inject old sign and exponent + const auto adjustment = bitcast(sext(comparison)) & (1 << 23); // exponent adjustement for negative bnew + return clamp_smax(eval(bitcast(base_result - adjustment))); + }); const auto [a, b] = get_vrs(op.ra, op.rb); @@ -7162,77 +7182,77 @@ public: { // For approximate, create a pattern but do not optimize yet register_intrinsic("spu_re", [&](llvm::CallInst* ci) - { - const auto a = bitcast(value(ci->getOperand(0))); - const auto a_fraction = (a >> splat(18)) & splat(0x1F); - const auto a_exponent = (a & splat(0x7F800000u)); - const auto r_exponent = sub_sat(build(0000, 0x7E80, 0000, 0x7E80, 0000, 0x7E80, 0000, 0x7E80), bitcast(a_exponent)); - const auto fix_exponent = select((a_exponent > 0), bitcast(r_exponent), splat(0x7F800000u)); - const auto a_sign = (a & splat(0x80000000)); - value_t b = eval(splat(0)); - - for (u32 i = 0; i < 4; i++) { - const auto eval_fraction = eval(extract(a_fraction, i)); + const auto a = bitcast(value(ci->getOperand(0))); + const auto a_fraction = (a >> splat(18)) & splat(0x1F); + const auto a_exponent = (a & splat(0x7F800000u)); + const auto r_exponent = sub_sat(build(0000, 0x7E80, 0000, 0x7E80, 0000, 0x7E80, 0000, 0x7E80), bitcast(a_exponent)); + const auto fix_exponent = select((a_exponent > 0), bitcast(r_exponent), splat(0x7F800000u)); + const auto a_sign = (a & splat(0x80000000)); + value_t b = eval(splat(0)); - value_t r_fraction = load_const(m_spu_frest_fraction_lut, eval_fraction); + for (u32 i = 0; i < 4; i++) + { + const auto eval_fraction = eval(extract(a_fraction, i)); - b = eval(insert(b, i, r_fraction)); - } + value_t r_fraction = load_const(m_spu_frest_fraction_lut, eval_fraction); - b = eval(b | fix_exponent | a_sign); + b = eval(insert(b, i, r_fraction)); + } - const auto base = (b & 0x007ffc00u) << 9; // Base fraction - const auto ymul = (b & 0x3ff) * (a & 0x7ffff); // Step fraction * Y fraction (fixed point at 2^-32) - const auto comparison = (ymul > base); // Should exponent be adjusted? - const auto bnew = (base - ymul) >> (zext(comparison) ^ 9); // Shift one less bit if exponent is adjusted - const auto base_result = (b & 0xff800000u) | (bnew & ~0xff800000u); // Inject old sign and exponent - const auto adjustment = bitcast(sext(comparison)) & (1 << 23); // exponent adjustement for negative bnew - return clamp_smax(eval(bitcast(base_result - adjustment))); - }); + b = eval(b | fix_exponent | a_sign); + + const auto base = (b & 0x007ffc00u) << 9; // Base fraction + const auto ymul = (b & 0x3ff) * (a & 0x7ffff); // Step fraction * Y fraction (fixed point at 2^-32) + const auto comparison = (ymul > base); // Should exponent be adjusted? + const auto bnew = (base - ymul) >> (zext(comparison) ^ 9); // Shift one less bit if exponent is adjusted + const auto base_result = (b & 0xff800000u) | (bnew & ~0xff800000u); // Inject old sign and exponent + const auto adjustment = bitcast(sext(comparison)) & (1 << 23); // exponent adjustement for negative bnew + return clamp_smax(eval(bitcast(base_result - adjustment))); + }); register_intrinsic("spu_rsqrte", [&](llvm::CallInst* ci) - { - const auto a = bitcast(value(ci->getOperand(0))); - const auto a_fraction = (a >> splat(18)) & splat(0x3F); - const auto a_exponent = (a >> splat(23)) & splat(0xFF); - value_t b = eval(splat(0)); - - for (u32 i = 0; i < 4; i++) { - const auto eval_fraction = eval(extract(a_fraction, i)); - const auto eval_exponent = eval(extract(a_exponent, i)); + const auto a = bitcast(value(ci->getOperand(0))); + const auto a_fraction = (a >> splat(18)) & splat(0x3F); + const auto a_exponent = (a >> splat(23)) & splat(0xFF); + value_t b = eval(splat(0)); - value_t r_fraction = load_const(m_spu_frsqest_fraction_lut, eval_fraction); - value_t r_exponent = load_const(m_spu_frsqest_exponent_lut, eval_exponent); + for (u32 i = 0; i < 4; i++) + { + const auto eval_fraction = eval(extract(a_fraction, i)); + const auto eval_exponent = eval(extract(a_exponent, i)); - b = eval(insert(b, i, eval(r_fraction | r_exponent))); - } + value_t r_fraction = load_const(m_spu_frsqest_fraction_lut, eval_fraction); + value_t r_exponent = load_const(m_spu_frsqest_exponent_lut, eval_exponent); - const auto base = (b & 0x007ffc00u) << 9; // Base fraction - const auto ymul = (b & 0x3ff) * (a & 0x7ffff); // Step fraction * Y fraction (fixed point at 2^-32) - const auto comparison = (ymul > base); // Should exponent be adjusted? - const auto bnew = (base - ymul) >> (zext(comparison) ^ 9); // Shift one less bit if exponent is adjusted - const auto base_result = (b & 0xff800000u) | (bnew & ~0xff800000u); // Inject old sign and exponent - const auto adjustment = bitcast(sext(comparison)) & (1 << 23); // exponent adjustement for negative bnew - return clamp_smax(eval(bitcast(base_result - adjustment))); - }); + b = eval(insert(b, i, eval(r_fraction | r_exponent))); + } + + const auto base = (b & 0x007ffc00u) << 9; // Base fraction + const auto ymul = (b & 0x3ff) * (a & 0x7ffff); // Step fraction * Y fraction (fixed point at 2^-32) + const auto comparison = (ymul > base); // Should exponent be adjusted? + const auto bnew = (base - ymul) >> (zext(comparison) ^ 9); // Shift one less bit if exponent is adjusted + const auto base_result = (b & 0xff800000u) | (bnew & ~0xff800000u); // Inject old sign and exponent + const auto adjustment = bitcast(sext(comparison)) & (1 << 23); // exponent adjustement for negative bnew + return clamp_smax(eval(bitcast(base_result - adjustment))); + }); break; } case xfloat_accuracy::relaxed: { // For relaxed, agressively optimize and use intrinsics, those make the results vary per cpu register_intrinsic("spu_re", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - return fre(a); - }); + { + const auto a = value(ci->getOperand(0)); + return fre(a); + }); register_intrinsic("spu_rsqrte", [&](llvm::CallInst* ci) - { - const auto a = value(ci->getOperand(0)); - return frsqe(a); - }); + { + const auto a = value(ci->getOperand(0)); + return frsqe(a); + }); break; } default: @@ -7240,7 +7260,7 @@ public: } // Do not pattern match for accurate - if(g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate || g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::relaxed) + if (g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::approximate || g_cfg.core.spu_xfloat_accuracy == xfloat_accuracy::relaxed) { if (const auto [ok, mb] = match_expr(b, frest(match())); ok && mb.eq(a)) { @@ -7281,13 +7301,11 @@ public: if (auto ca = llvm::dyn_cast(a.value)) { - const f64 data[4] - { + const f64 data[4]{ ca->getElementAsDouble(0), ca->getElementAsDouble(1), ca->getElementAsDouble(2), - ca->getElementAsDouble(3) - }; + ca->getElementAsDouble(3)}; v128 result; @@ -7355,13 +7373,11 @@ public: if (auto ca = llvm::dyn_cast(a.value)) { - const f64 data[4] - { + const f64 data[4]{ ca->getElementAsDouble(0), ca->getElementAsDouble(1), ca->getElementAsDouble(2), - ca->getElementAsDouble(3) - }; + ca->getElementAsDouble(3)}; v128 result; @@ -7410,7 +7426,7 @@ public: if (m_use_avx512) { - const auto sc = eval(bitcast(max(bitcast(a),splat(0x0)))); + const auto sc = eval(bitcast(max(bitcast(a), splat(0x0)))); r.value = m_ir->CreateFPToUI(sc.value, get_type()); set_vr(op.rt, r); return; @@ -7852,7 +7868,8 @@ public: void BIZ(spu_opcode_t op) // { - if (m_block) m_block->block_end = m_ir->GetInsertBlock(); + if (m_block) + m_block->block_end = m_ir->GetInsertBlock(); const auto rt = get_vr(op.rt); @@ -7883,24 +7900,23 @@ public: return; } - // Check sign bit instead (optimization) if (match_vr(op.rt, [&](auto c, auto MP) - { - using VT = typename decltype(MP)::type; + { + using VT = typename decltype(MP)::type; - if (auto [ok, x] = match_expr(c, sext(match]>())); ok) - { - const auto a = get_vr(op.rt); - const auto cond = eval(bitcast(trunc(a)) >= 0); - const auto addr = eval(extract(get_vr(op.ra), 3) & 0x3fffc); - const auto target = add_block_indirect(op, addr); - m_ir->CreateCondBr(cond.value, target, add_block_next()); - return true; - } + if (auto [ok, x] = match_expr(c, sext(match]>())); ok) + { + const auto a = get_vr(op.rt); + const auto cond = eval(bitcast(trunc(a)) >= 0); + const auto addr = eval(extract(get_vr(op.ra), 3) & 0x3fffc); + const auto target = add_block_indirect(op, addr); + m_ir->CreateCondBr(cond.value, target, add_block_next()); + return true; + } - return false; - })) + return false; + })) { return; } @@ -7913,7 +7929,8 @@ public: void BINZ(spu_opcode_t op) // { - if (m_block) m_block->block_end = m_ir->GetInsertBlock(); + if (m_block) + m_block->block_end = m_ir->GetInsertBlock(); const auto rt = get_vr(op.rt); @@ -7944,24 +7961,23 @@ public: return; } - // Check sign bit instead (optimization) if (match_vr(op.rt, [&](auto c, auto MP) - { - using VT = typename decltype(MP)::type; + { + using VT = typename decltype(MP)::type; - if (auto [ok, x] = match_expr(c, sext(match]>())); ok) - { - const auto a = get_vr(op.rt); - const auto cond = eval(bitcast(trunc(a)) < 0); - const auto addr = eval(extract(get_vr(op.ra), 3) & 0x3fffc); - const auto target = add_block_indirect(op, addr); - m_ir->CreateCondBr(cond.value, target, add_block_next()); - return true; - } + if (auto [ok, x] = match_expr(c, sext(match]>())); ok) + { + const auto a = get_vr(op.rt); + const auto cond = eval(bitcast(trunc(a)) < 0); + const auto addr = eval(extract(get_vr(op.ra), 3) & 0x3fffc); + const auto target = add_block_indirect(op, addr); + m_ir->CreateCondBr(cond.value, target, add_block_next()); + return true; + } - return false; - })) + return false; + })) { return; } @@ -7974,25 +7990,26 @@ public: void BIHZ(spu_opcode_t op) // { - if (m_block) m_block->block_end = m_ir->GetInsertBlock(); + if (m_block) + m_block->block_end = m_ir->GetInsertBlock(); // Check sign bits of 2 vector elements (optimization) if (match_vr(op.rt, [&](auto c, auto MP) - { - using VT = typename decltype(MP)::type; + { + using VT = typename decltype(MP)::type; - if (auto [ok, x] = match_expr(c, sext(match]>())); ok) - { - const auto a = get_vr(op.rt); - const auto cond = eval((bitcast(trunc(a)) & 0x3000) == 0); - const auto addr = eval(extract(get_vr(op.ra), 3) & 0x3fffc); - const auto target = add_block_indirect(op, addr); - m_ir->CreateCondBr(cond.value, target, add_block_next()); - return true; - } + if (auto [ok, x] = match_expr(c, sext(match]>())); ok) + { + const auto a = get_vr(op.rt); + const auto cond = eval((bitcast(trunc(a)) & 0x3000) == 0); + const auto addr = eval(extract(get_vr(op.ra), 3) & 0x3fffc); + const auto target = add_block_indirect(op, addr); + m_ir->CreateCondBr(cond.value, target, add_block_next()); + return true; + } - return false; - })) + return false; + })) { return; } @@ -8005,25 +8022,26 @@ public: void BIHNZ(spu_opcode_t op) // { - if (m_block) m_block->block_end = m_ir->GetInsertBlock(); + if (m_block) + m_block->block_end = m_ir->GetInsertBlock(); // Check sign bits of 2 vector elements (optimization) if (match_vr(op.rt, [&](auto c, auto MP) - { - using VT = typename decltype(MP)::type; + { + using VT = typename decltype(MP)::type; - if (auto [ok, x] = match_expr(c, sext(match]>())); ok) - { - const auto a = get_vr(op.rt); - const auto cond = eval((bitcast(trunc(a)) & 0x3000) != 0); - const auto addr = eval(extract(get_vr(op.ra), 3) & 0x3fffc); - const auto target = add_block_indirect(op, addr); - m_ir->CreateCondBr(cond.value, target, add_block_next()); - return true; - } + if (auto [ok, x] = match_expr(c, sext(match]>())); ok) + { + const auto a = get_vr(op.rt); + const auto cond = eval((bitcast(trunc(a)) & 0x3000) != 0); + const auto addr = eval(extract(get_vr(op.ra), 3) & 0x3fffc); + const auto target = add_block_indirect(op, addr); + m_ir->CreateCondBr(cond.value, target, add_block_next()); + return true; + } - return false; - })) + return false; + })) { return; } @@ -8036,7 +8054,8 @@ public: void BI(spu_opcode_t op) // { - if (m_block) m_block->block_end = m_ir->GetInsertBlock(); + if (m_block) + m_block->block_end = m_ir->GetInsertBlock(); const auto addr = eval(extract(get_vr(op.ra), 3) & 0x3fffc); if (m_interp_magn) @@ -8134,7 +8153,8 @@ public: void BISL(spu_opcode_t op) // { - if (m_block) m_block->block_end = m_ir->GetInsertBlock(); + if (m_block) + m_block->block_end = m_ir->GetInsertBlock(); const auto addr = eval(extract(get_vr(op.ra), 3) & 0x3fffc); set_link(op); m_ir->CreateBr(add_block_indirect(op, addr, false)); @@ -8142,7 +8162,8 @@ public: void IRET(spu_opcode_t op) // { - if (m_block) m_block->block_end = m_ir->GetInsertBlock(); + if (m_block) + m_block->block_end = m_ir->GetInsertBlock(); value_t srr0; srr0.value = m_ir->CreateLoad(get_type(), spu_ptr(&spu_thread::srr0)); m_ir->CreateBr(add_block_indirect(op, srr0)); @@ -8150,7 +8171,8 @@ public: void BISLED(spu_opcode_t op) // { - if (m_block) m_block->block_end = m_ir->GetInsertBlock(); + if (m_block) + m_block->block_end = m_ir->GetInsertBlock(); const auto addr = eval(extract(get_vr(op.ra), 3) & 0x3fffc); set_link(op); const auto mask = m_ir->CreateTrunc(m_ir->CreateLShr(m_ir->CreateLoad(get_type(), spu_ptr(&spu_thread::ch_events), true), 32), get_type()); @@ -8203,26 +8225,25 @@ public: } } - // Check sign bit instead (optimization) if (match_vr(op.rt, [&](auto c, auto MP) - { - using VT = typename decltype(MP)::type; - - if (auto [ok, x] = match_expr(c, sext(match]>())); ok) - { - if (target != m_pos + 4) { - m_block->block_end = m_ir->GetInsertBlock(); - const auto a = get_vr(op.rt); - const auto cond = eval(bitcast(trunc(a)) >= 0); - m_ir->CreateCondBr(cond.value, add_block(target), add_block(m_pos + 4)); - return true; - } - } + using VT = typename decltype(MP)::type; - return false; - })) + if (auto [ok, x] = match_expr(c, sext(match]>())); ok) + { + if (target != m_pos + 4) + { + m_block->block_end = m_ir->GetInsertBlock(); + const auto a = get_vr(op.rt); + const auto cond = eval(bitcast(trunc(a)) >= 0); + m_ir->CreateCondBr(cond.value, add_block(target), add_block(m_pos + 4)); + return true; + } + } + + return false; + })) { return; } @@ -8281,23 +8302,23 @@ public: // Check sign bit instead (optimization) if (match_vr(op.rt, [&](auto c, auto MP) - { - using VT = typename decltype(MP)::type; - - if (auto [ok, x] = match_expr(c, sext(match]>())); ok) - { - if (target != m_pos + 4) { - m_block->block_end = m_ir->GetInsertBlock(); - const auto a = get_vr(op.rt); - const auto cond = eval(bitcast(trunc(a)) < 0); - m_ir->CreateCondBr(cond.value, add_block(target), add_block(m_pos + 4)); - return true; - } - } + using VT = typename decltype(MP)::type; - return false; - })) + if (auto [ok, x] = match_expr(c, sext(match]>())); ok) + { + if (target != m_pos + 4) + { + m_block->block_end = m_ir->GetInsertBlock(); + const auto a = get_vr(op.rt); + const auto cond = eval(bitcast(trunc(a)) < 0); + m_ir->CreateCondBr(cond.value, add_block(target), add_block(m_pos + 4)); + return true; + } + } + + return false; + })) { return; } @@ -8325,23 +8346,23 @@ public: // Check sign bits of 2 vector elements (optimization) if (match_vr(op.rt, [&](auto c, auto MP) - { - using VT = typename decltype(MP)::type; - - if (auto [ok, x] = match_expr(c, sext(match]>())); ok) - { - if (target != m_pos + 4) { - m_block->block_end = m_ir->GetInsertBlock(); - const auto a = get_vr(op.rt); - const auto cond = eval((bitcast(trunc(a)) & 0x3000) == 0); - m_ir->CreateCondBr(cond.value, add_block(target), add_block(m_pos + 4)); - return true; - } - } + using VT = typename decltype(MP)::type; - return false; - })) + if (auto [ok, x] = match_expr(c, sext(match]>())); ok) + { + if (target != m_pos + 4) + { + m_block->block_end = m_ir->GetInsertBlock(); + const auto a = get_vr(op.rt); + const auto cond = eval((bitcast(trunc(a)) & 0x3000) == 0); + m_ir->CreateCondBr(cond.value, add_block(target), add_block(m_pos + 4)); + return true; + } + } + + return false; + })) { return; } @@ -8369,23 +8390,23 @@ public: // Check sign bits of 2 vector elements (optimization) if (match_vr(op.rt, [&](auto c, auto MP) - { - using VT = typename decltype(MP)::type; - - if (auto [ok, x] = match_expr(c, sext(match]>())); ok) - { - if (target != m_pos + 4) { - m_block->block_end = m_ir->GetInsertBlock(); - const auto a = get_vr(op.rt); - const auto cond = eval((bitcast(trunc(a)) & 0x3000) != 0); - m_ir->CreateCondBr(cond.value, add_block(target), add_block(m_pos + 4)); - return true; - } - } + using VT = typename decltype(MP)::type; - return false; - })) + if (auto [ok, x] = match_expr(c, sext(match]>())); ok) + { + if (target != m_pos + 4) + { + m_block->block_end = m_ir->GetInsertBlock(); + const auto a = get_vr(op.rt); + const auto cond = eval((bitcast(trunc(a)) & 0x3000) != 0); + m_ir->CreateCondBr(cond.value, add_block(target), add_block(m_pos + 4)); + return true; + } + } + + return false; + })) { return; } diff --git a/rpcs3/rpcs3/Emu/Cell/SPUOpcodes.h b/rpcs3/rpcs3/Emu/Cell/SPUOpcodes.h index cea4513e3..5a9d0a0ff 100644 --- a/rpcs3/rpcs3/Emu/Cell/SPUOpcodes.h +++ b/rpcs3/rpcs3/Emu/Cell/SPUOpcodes.h @@ -6,24 +6,24 @@ union spu_opcode_t { u32 opcode; - bf_t rt; // 25..31, for 3-op instructions - bf_t rc; // 25..31 - bf_t ra; // 18..24 - bf_t rb; // 11..17 - bf_t rt4; // 4..10, for 4-op instructions - bf_t e; // 13, "enable interrupts" bit - bf_t d; // 12, "disable interrupts" bit - bf_t de; // 12..13 combined 'e' and 'd' bits - bf_t c; // 11, "C" bit for SYNC instruction - bf_t r0h; // 7..8, signed - bf_t roh; // 16..17, signed - bf_t i7; // 11..17 - bf_t si7; // 11..17, signed - bf_t i8; // 10..17 + bf_t rt; // 25..31, for 3-op instructions + bf_t rc; // 25..31 + bf_t ra; // 18..24 + bf_t rb; // 11..17 + bf_t rt4; // 4..10, for 4-op instructions + bf_t e; // 13, "enable interrupts" bit + bf_t d; // 12, "disable interrupts" bit + bf_t de; // 12..13 combined 'e' and 'd' bits + bf_t c; // 11, "C" bit for SYNC instruction + bf_t r0h; // 7..8, signed + bf_t roh; // 16..17, signed + bf_t i7; // 11..17 + bf_t si7; // 11..17, signed + bf_t i8; // 10..17 bf_t si10; // 8..17, signed - bf_t i16; // 9..24 - bf_t si16; // 9..24, signed - bf_t i18; // 7..24 + bf_t i16; // 9..24 + bf_t si16; // 9..24, signed + bf_t i18; // 7..24 }; constexpr u32 spu_branch_target(u32 pc, u32 imm = 0) @@ -57,16 +57,12 @@ class spu_decoder T pointer; instruction_info(u32 m, u32 v, T p) noexcept - : magn(m) - , value(v) - , pointer(p) + : magn(m), value(v), pointer(p) { } instruction_info(u32 m, u32 v, const T* p) noexcept - : magn(m) - , value(v) - , pointer(*p) + : magn(m), value(v), pointer(*p) { } }; @@ -82,211 +78,215 @@ public: spu_decoder(const Args&... args) noexcept { // If an object is passed to the constructor, assign values from that object -#define GET(name) [&]{ if constexpr (sizeof...(Args) > 0) return _first(args...).name; else return &D::name; }() +#define GET(name) [&] { \ + if constexpr (sizeof...(Args) > 0) \ + return _first(args...).name; \ + else \ + return &D::name; \ +}() static_assert(sizeof...(Args) <= 1); - const std::initializer_list instructions - { - { 0, 0x0, GET(STOP) }, - { 0, 0x1, GET(LNOP) }, - { 0, 0x2, GET(SYNC) }, - { 0, 0x3, GET(DSYNC) }, - { 0, 0xc, GET(MFSPR) }, - { 0, 0xd, GET(RDCH) }, - { 0, 0xf, GET(RCHCNT) }, - { 0, 0x40, GET(SF) }, - { 0, 0x41, GET(OR) }, - { 0, 0x42, GET(BG) }, - { 0, 0x48, GET(SFH) }, - { 0, 0x49, GET(NOR) }, - { 0, 0x53, GET(ABSDB) }, - { 0, 0x58, GET(ROT) }, - { 0, 0x59, GET(ROTM) }, - { 0, 0x5a, GET(ROTMA) }, - { 0, 0x5b, GET(SHL) }, - { 0, 0x5c, GET(ROTH) }, - { 0, 0x5d, GET(ROTHM) }, - { 0, 0x5e, GET(ROTMAH) }, - { 0, 0x5f, GET(SHLH) }, - { 0, 0x78, GET(ROTI) }, - { 0, 0x79, GET(ROTMI) }, - { 0, 0x7a, GET(ROTMAI) }, - { 0, 0x7b, GET(SHLI) }, - { 0, 0x7c, GET(ROTHI) }, - { 0, 0x7d, GET(ROTHMI) }, - { 0, 0x7e, GET(ROTMAHI) }, - { 0, 0x7f, GET(SHLHI) }, - { 0, 0xc0, GET(A) }, - { 0, 0xc1, GET(AND) }, - { 0, 0xc2, GET(CG) }, - { 0, 0xc8, GET(AH) }, - { 0, 0xc9, GET(NAND) }, - { 0, 0xd3, GET(AVGB) }, - { 0, 0x10c, GET(MTSPR) }, - { 0, 0x10d, GET(WRCH) }, - { 0, 0x128, GET(BIZ) }, - { 0, 0x129, GET(BINZ) }, - { 0, 0x12a, GET(BIHZ) }, - { 0, 0x12b, GET(BIHNZ) }, - { 0, 0x140, GET(STOPD) }, - { 0, 0x144, GET(STQX) }, - { 0, 0x1a8, GET(BI) }, - { 0, 0x1a9, GET(BISL) }, - { 0, 0x1aa, GET(IRET) }, - { 0, 0x1ab, GET(BISLED) }, - { 0, 0x1ac, GET(HBR) }, - { 0, 0x1b0, GET(GB) }, - { 0, 0x1b1, GET(GBH) }, - { 0, 0x1b2, GET(GBB) }, - { 0, 0x1b4, GET(FSM) }, - { 0, 0x1b5, GET(FSMH) }, - { 0, 0x1b6, GET(FSMB) }, - { 0, 0x1b8, GET(FREST) }, - { 0, 0x1b9, GET(FRSQEST) }, - { 0, 0x1c4, GET(LQX) }, - { 0, 0x1cc, GET(ROTQBYBI) }, - { 0, 0x1cd, GET(ROTQMBYBI) }, - { 0, 0x1cf, GET(SHLQBYBI) }, - { 0, 0x1d4, GET(CBX) }, - { 0, 0x1d5, GET(CHX) }, - { 0, 0x1d6, GET(CWX) }, - { 0, 0x1d7, GET(CDX) }, - { 0, 0x1d8, GET(ROTQBI) }, - { 0, 0x1d9, GET(ROTQMBI) }, - { 0, 0x1db, GET(SHLQBI) }, - { 0, 0x1dc, GET(ROTQBY) }, - { 0, 0x1dd, GET(ROTQMBY) }, - { 0, 0x1df, GET(SHLQBY) }, - { 0, 0x1f0, GET(ORX) }, - { 0, 0x1f4, GET(CBD) }, - { 0, 0x1f5, GET(CHD) }, - { 0, 0x1f6, GET(CWD) }, - { 0, 0x1f7, GET(CDD) }, - { 0, 0x1f8, GET(ROTQBII) }, - { 0, 0x1f9, GET(ROTQMBII) }, - { 0, 0x1fb, GET(SHLQBII) }, - { 0, 0x1fc, GET(ROTQBYI) }, - { 0, 0x1fd, GET(ROTQMBYI) }, - { 0, 0x1ff, GET(SHLQBYI) }, - { 0, 0x201, GET(NOP) }, - { 0, 0x240, GET(CGT) }, - { 0, 0x241, GET(XOR) }, - { 0, 0x248, GET(CGTH) }, - { 0, 0x249, GET(EQV) }, - { 0, 0x250, GET(CGTB) }, - { 0, 0x253, GET(SUMB) }, - { 0, 0x258, GET(HGT) }, - { 0, 0x2a5, GET(CLZ) }, - { 0, 0x2a6, GET(XSWD) }, - { 0, 0x2ae, GET(XSHW) }, - { 0, 0x2b4, GET(CNTB) }, - { 0, 0x2b6, GET(XSBH) }, - { 0, 0x2c0, GET(CLGT) }, - { 0, 0x2c1, GET(ANDC) }, - { 0, 0x2c2, GET(FCGT) }, - { 0, 0x2c3, GET(DFCGT) }, - { 0, 0x2c4, GET(FA) }, - { 0, 0x2c5, GET(FS) }, - { 0, 0x2c6, GET(FM) }, - { 0, 0x2c8, GET(CLGTH) }, - { 0, 0x2c9, GET(ORC) }, - { 0, 0x2ca, GET(FCMGT) }, - { 0, 0x2cb, GET(DFCMGT) }, - { 0, 0x2cc, GET(DFA) }, - { 0, 0x2cd, GET(DFS) }, - { 0, 0x2ce, GET(DFM) }, - { 0, 0x2d0, GET(CLGTB) }, - { 0, 0x2d8, GET(HLGT) }, - { 0, 0x35c, GET(DFMA) }, - { 0, 0x35d, GET(DFMS) }, - { 0, 0x35e, GET(DFNMS) }, - { 0, 0x35f, GET(DFNMA) }, - { 0, 0x3c0, GET(CEQ) }, - { 0, 0x3ce, GET(MPYHHU) }, - { 0, 0x340, GET(ADDX) }, - { 0, 0x341, GET(SFX) }, - { 0, 0x342, GET(CGX) }, - { 0, 0x343, GET(BGX) }, - { 0, 0x346, GET(MPYHHA) }, - { 0, 0x34e, GET(MPYHHAU) }, - { 0, 0x398, GET(FSCRRD) }, - { 0, 0x3b8, GET(FESD) }, - { 0, 0x3b9, GET(FRDS) }, - { 0, 0x3ba, GET(FSCRWR) }, - { 0, 0x3bf, GET(DFTSV) }, - { 0, 0x3c2, GET(FCEQ) }, - { 0, 0x3c3, GET(DFCEQ) }, - { 0, 0x3c4, GET(MPY) }, - { 0, 0x3c5, GET(MPYH) }, - { 0, 0x3c6, GET(MPYHH) }, - { 0, 0x3c7, GET(MPYS) }, - { 0, 0x3c8, GET(CEQH) }, - { 0, 0x3ca, GET(FCMEQ) }, - { 0, 0x3cb, GET(DFCMEQ) }, - { 0, 0x3cc, GET(MPYU) }, - { 0, 0x3d0, GET(CEQB) }, - { 0, 0x3d4, GET(FI) }, - { 0, 0x3d8, GET(HEQ) }, - { 1, 0x1d8, GET(CFLTS) }, - { 1, 0x1d9, GET(CFLTU) }, - { 1, 0x1da, GET(CSFLT) }, - { 1, 0x1db, GET(CUFLT) }, - { 2, 0x40, GET(BRZ) }, - { 2, 0x41, GET(STQA) }, - { 2, 0x42, GET(BRNZ) }, - { 2, 0x44, GET(BRHZ) }, - { 2, 0x46, GET(BRHNZ) }, - { 2, 0x47, GET(STQR) }, - { 2, 0x60, GET(BRA) }, - { 2, 0x61, GET(LQA) }, - { 2, 0x62, GET(BRASL) }, - { 2, 0x64, GET(BR) }, - { 2, 0x65, GET(FSMBI) }, - { 2, 0x66, GET(BRSL) }, - { 2, 0x67, GET(LQR) }, - { 2, 0x81, GET(IL) }, - { 2, 0x82, GET(ILHU) }, - { 2, 0x83, GET(ILH) }, - { 2, 0xc1, GET(IOHL) }, - { 3, 0x4, GET(ORI) }, - { 3, 0x5, GET(ORHI) }, - { 3, 0x6, GET(ORBI) }, - { 3, 0xc, GET(SFI) }, - { 3, 0xd, GET(SFHI) }, - { 3, 0x14, GET(ANDI) }, - { 3, 0x15, GET(ANDHI) }, - { 3, 0x16, GET(ANDBI) }, - { 3, 0x1c, GET(AI) }, - { 3, 0x1d, GET(AHI) }, - { 3, 0x24, GET(STQD) }, - { 3, 0x34, GET(LQD) }, - { 3, 0x44, GET(XORI) }, - { 3, 0x45, GET(XORHI) }, - { 3, 0x46, GET(XORBI) }, - { 3, 0x4c, GET(CGTI) }, - { 3, 0x4d, GET(CGTHI) }, - { 3, 0x4e, GET(CGTBI) }, - { 3, 0x4f, GET(HGTI) }, - { 3, 0x5c, GET(CLGTI) }, - { 3, 0x5d, GET(CLGTHI) }, - { 3, 0x5e, GET(CLGTBI) }, - { 3, 0x5f, GET(HLGTI) }, - { 3, 0x74, GET(MPYI) }, - { 3, 0x75, GET(MPYUI) }, - { 3, 0x7c, GET(CEQI) }, - { 3, 0x7d, GET(CEQHI) }, - { 3, 0x7e, GET(CEQBI) }, - { 3, 0x7f, GET(HEQI) }, - { 4, 0x8, GET(HBRA) }, - { 4, 0x9, GET(HBRR) }, - { 4, 0x21, GET(ILA) }, - { 7, 0x8, GET(SELB) }, - { 7, 0xb, GET(SHUFB) }, - { 7, 0xc, GET(MPYA) }, - { 7, 0xd, GET(FNMS) }, - { 7, 0xe, GET(FMA) }, - { 7, 0xf, GET(FMS) }, + const std::initializer_list instructions{ + {0, 0x0, GET(STOP)}, + {0, 0x1, GET(LNOP)}, + {0, 0x2, GET(SYNC)}, + {0, 0x3, GET(DSYNC)}, + {0, 0xc, GET(MFSPR)}, + {0, 0xd, GET(RDCH)}, + {0, 0xf, GET(RCHCNT)}, + {0, 0x40, GET(SF)}, + {0, 0x41, GET(OR)}, + {0, 0x42, GET(BG)}, + {0, 0x48, GET(SFH)}, + {0, 0x49, GET(NOR)}, + {0, 0x53, GET(ABSDB)}, + {0, 0x58, GET(ROT)}, + {0, 0x59, GET(ROTM)}, + {0, 0x5a, GET(ROTMA)}, + {0, 0x5b, GET(SHL)}, + {0, 0x5c, GET(ROTH)}, + {0, 0x5d, GET(ROTHM)}, + {0, 0x5e, GET(ROTMAH)}, + {0, 0x5f, GET(SHLH)}, + {0, 0x78, GET(ROTI)}, + {0, 0x79, GET(ROTMI)}, + {0, 0x7a, GET(ROTMAI)}, + {0, 0x7b, GET(SHLI)}, + {0, 0x7c, GET(ROTHI)}, + {0, 0x7d, GET(ROTHMI)}, + {0, 0x7e, GET(ROTMAHI)}, + {0, 0x7f, GET(SHLHI)}, + {0, 0xc0, GET(A)}, + {0, 0xc1, GET(AND)}, + {0, 0xc2, GET(CG)}, + {0, 0xc8, GET(AH)}, + {0, 0xc9, GET(NAND)}, + {0, 0xd3, GET(AVGB)}, + {0, 0x10c, GET(MTSPR)}, + {0, 0x10d, GET(WRCH)}, + {0, 0x128, GET(BIZ)}, + {0, 0x129, GET(BINZ)}, + {0, 0x12a, GET(BIHZ)}, + {0, 0x12b, GET(BIHNZ)}, + {0, 0x140, GET(STOPD)}, + {0, 0x144, GET(STQX)}, + {0, 0x1a8, GET(BI)}, + {0, 0x1a9, GET(BISL)}, + {0, 0x1aa, GET(IRET)}, + {0, 0x1ab, GET(BISLED)}, + {0, 0x1ac, GET(HBR)}, + {0, 0x1b0, GET(GB)}, + {0, 0x1b1, GET(GBH)}, + {0, 0x1b2, GET(GBB)}, + {0, 0x1b4, GET(FSM)}, + {0, 0x1b5, GET(FSMH)}, + {0, 0x1b6, GET(FSMB)}, + {0, 0x1b8, GET(FREST)}, + {0, 0x1b9, GET(FRSQEST)}, + {0, 0x1c4, GET(LQX)}, + {0, 0x1cc, GET(ROTQBYBI)}, + {0, 0x1cd, GET(ROTQMBYBI)}, + {0, 0x1cf, GET(SHLQBYBI)}, + {0, 0x1d4, GET(CBX)}, + {0, 0x1d5, GET(CHX)}, + {0, 0x1d6, GET(CWX)}, + {0, 0x1d7, GET(CDX)}, + {0, 0x1d8, GET(ROTQBI)}, + {0, 0x1d9, GET(ROTQMBI)}, + {0, 0x1db, GET(SHLQBI)}, + {0, 0x1dc, GET(ROTQBY)}, + {0, 0x1dd, GET(ROTQMBY)}, + {0, 0x1df, GET(SHLQBY)}, + {0, 0x1f0, GET(ORX)}, + {0, 0x1f4, GET(CBD)}, + {0, 0x1f5, GET(CHD)}, + {0, 0x1f6, GET(CWD)}, + {0, 0x1f7, GET(CDD)}, + {0, 0x1f8, GET(ROTQBII)}, + {0, 0x1f9, GET(ROTQMBII)}, + {0, 0x1fb, GET(SHLQBII)}, + {0, 0x1fc, GET(ROTQBYI)}, + {0, 0x1fd, GET(ROTQMBYI)}, + {0, 0x1ff, GET(SHLQBYI)}, + {0, 0x201, GET(NOP)}, + {0, 0x240, GET(CGT)}, + {0, 0x241, GET(XOR)}, + {0, 0x248, GET(CGTH)}, + {0, 0x249, GET(EQV)}, + {0, 0x250, GET(CGTB)}, + {0, 0x253, GET(SUMB)}, + {0, 0x258, GET(HGT)}, + {0, 0x2a5, GET(CLZ)}, + {0, 0x2a6, GET(XSWD)}, + {0, 0x2ae, GET(XSHW)}, + {0, 0x2b4, GET(CNTB)}, + {0, 0x2b6, GET(XSBH)}, + {0, 0x2c0, GET(CLGT)}, + {0, 0x2c1, GET(ANDC)}, + {0, 0x2c2, GET(FCGT)}, + {0, 0x2c3, GET(DFCGT)}, + {0, 0x2c4, GET(FA)}, + {0, 0x2c5, GET(FS)}, + {0, 0x2c6, GET(FM)}, + {0, 0x2c8, GET(CLGTH)}, + {0, 0x2c9, GET(ORC)}, + {0, 0x2ca, GET(FCMGT)}, + {0, 0x2cb, GET(DFCMGT)}, + {0, 0x2cc, GET(DFA)}, + {0, 0x2cd, GET(DFS)}, + {0, 0x2ce, GET(DFM)}, + {0, 0x2d0, GET(CLGTB)}, + {0, 0x2d8, GET(HLGT)}, + {0, 0x35c, GET(DFMA)}, + {0, 0x35d, GET(DFMS)}, + {0, 0x35e, GET(DFNMS)}, + {0, 0x35f, GET(DFNMA)}, + {0, 0x3c0, GET(CEQ)}, + {0, 0x3ce, GET(MPYHHU)}, + {0, 0x340, GET(ADDX)}, + {0, 0x341, GET(SFX)}, + {0, 0x342, GET(CGX)}, + {0, 0x343, GET(BGX)}, + {0, 0x346, GET(MPYHHA)}, + {0, 0x34e, GET(MPYHHAU)}, + {0, 0x398, GET(FSCRRD)}, + {0, 0x3b8, GET(FESD)}, + {0, 0x3b9, GET(FRDS)}, + {0, 0x3ba, GET(FSCRWR)}, + {0, 0x3bf, GET(DFTSV)}, + {0, 0x3c2, GET(FCEQ)}, + {0, 0x3c3, GET(DFCEQ)}, + {0, 0x3c4, GET(MPY)}, + {0, 0x3c5, GET(MPYH)}, + {0, 0x3c6, GET(MPYHH)}, + {0, 0x3c7, GET(MPYS)}, + {0, 0x3c8, GET(CEQH)}, + {0, 0x3ca, GET(FCMEQ)}, + {0, 0x3cb, GET(DFCMEQ)}, + {0, 0x3cc, GET(MPYU)}, + {0, 0x3d0, GET(CEQB)}, + {0, 0x3d4, GET(FI)}, + {0, 0x3d8, GET(HEQ)}, + {1, 0x1d8, GET(CFLTS)}, + {1, 0x1d9, GET(CFLTU)}, + {1, 0x1da, GET(CSFLT)}, + {1, 0x1db, GET(CUFLT)}, + {2, 0x40, GET(BRZ)}, + {2, 0x41, GET(STQA)}, + {2, 0x42, GET(BRNZ)}, + {2, 0x44, GET(BRHZ)}, + {2, 0x46, GET(BRHNZ)}, + {2, 0x47, GET(STQR)}, + {2, 0x60, GET(BRA)}, + {2, 0x61, GET(LQA)}, + {2, 0x62, GET(BRASL)}, + {2, 0x64, GET(BR)}, + {2, 0x65, GET(FSMBI)}, + {2, 0x66, GET(BRSL)}, + {2, 0x67, GET(LQR)}, + {2, 0x81, GET(IL)}, + {2, 0x82, GET(ILHU)}, + {2, 0x83, GET(ILH)}, + {2, 0xc1, GET(IOHL)}, + {3, 0x4, GET(ORI)}, + {3, 0x5, GET(ORHI)}, + {3, 0x6, GET(ORBI)}, + {3, 0xc, GET(SFI)}, + {3, 0xd, GET(SFHI)}, + {3, 0x14, GET(ANDI)}, + {3, 0x15, GET(ANDHI)}, + {3, 0x16, GET(ANDBI)}, + {3, 0x1c, GET(AI)}, + {3, 0x1d, GET(AHI)}, + {3, 0x24, GET(STQD)}, + {3, 0x34, GET(LQD)}, + {3, 0x44, GET(XORI)}, + {3, 0x45, GET(XORHI)}, + {3, 0x46, GET(XORBI)}, + {3, 0x4c, GET(CGTI)}, + {3, 0x4d, GET(CGTHI)}, + {3, 0x4e, GET(CGTBI)}, + {3, 0x4f, GET(HGTI)}, + {3, 0x5c, GET(CLGTI)}, + {3, 0x5d, GET(CLGTHI)}, + {3, 0x5e, GET(CLGTBI)}, + {3, 0x5f, GET(HLGTI)}, + {3, 0x74, GET(MPYI)}, + {3, 0x75, GET(MPYUI)}, + {3, 0x7c, GET(CEQI)}, + {3, 0x7d, GET(CEQHI)}, + {3, 0x7e, GET(CEQBI)}, + {3, 0x7f, GET(HEQI)}, + {4, 0x8, GET(HBRA)}, + {4, 0x9, GET(HBRR)}, + {4, 0x21, GET(ILA)}, + {7, 0x8, GET(SELB)}, + {7, 0xb, GET(SHUFB)}, + {7, 0xc, GET(MPYA)}, + {7, 0xd, GET(FNMS)}, + {7, 0xe, GET(FMA)}, + {7, 0xf, GET(FMS)}, }; for (auto& x : m_table) diff --git a/rpcs3/rpcs3/Emu/Cell/SPURecompiler.h b/rpcs3/rpcs3/Emu/Cell/SPURecompiler.h index 03b69583d..0b67d9258 100644 --- a/rpcs3/rpcs3/Emu/Cell/SPURecompiler.h +++ b/rpcs3/rpcs3/Emu/Cell/SPURecompiler.h @@ -147,10 +147,10 @@ public: static const spu_function_t g_gateway; // Longjmp to the end of the gateway function (native CC) - static void(*const g_escape)(spu_thread*); + static void (*const g_escape)(spu_thread*); // Similar to g_escape, but doing tail call to the new function. - static void(*const g_tail_escape)(spu_thread*, spu_function_t, u8*); + static void (*const g_tail_escape)(spu_thread*, spu_function_t, u8*); // Interpreter table (spu_itype -> ptr) static std::array g_interpreter_table; diff --git a/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp index db53a22f6..4a675a10e 100644 --- a/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp @@ -49,60 +49,56 @@ // LUTs for SPU instructions const u32 spu_frest_fraction_lut[32] = -{ - 0x7FFBE0, 0x7F87A6, 0x70EF72, 0x708B40, 0x638B12, 0x633AEA, 0x5792C4, 0x574AA0, - 0x4CCA7E, 0x4C9262, 0x430A44, 0x42D62A, 0x3A2E12, 0x39FDFA, 0x3215E4, 0x31F1D2, - 0x2AA9BE, 0x2A85AC, 0x23D59A, 0x23BD8E, 0x1D8576, 0x1D8576, 0x17AD5A, 0x17AD5A, - 0x124543, 0x124543, 0x0D392D, 0x0D392D, 0x08851A, 0x08851A, 0x041D07, 0x041D07 -}; + { + 0x7FFBE0, 0x7F87A6, 0x70EF72, 0x708B40, 0x638B12, 0x633AEA, 0x5792C4, 0x574AA0, + 0x4CCA7E, 0x4C9262, 0x430A44, 0x42D62A, 0x3A2E12, 0x39FDFA, 0x3215E4, 0x31F1D2, + 0x2AA9BE, 0x2A85AC, 0x23D59A, 0x23BD8E, 0x1D8576, 0x1D8576, 0x17AD5A, 0x17AD5A, + 0x124543, 0x124543, 0x0D392D, 0x0D392D, 0x08851A, 0x08851A, 0x041D07, 0x041D07}; const u32 spu_frest_exponent_lut[256] = -{ - 0x7F800000, 0x7E000000, 0x7D800000, 0x7D000000, 0x7C800000, 0x7C000000, 0x7B800000, 0x7B000000, 0x7A800000, 0x7A000000, 0x79800000, 0x79000000, 0x78800000, 0x78000000, 0x77800000, 0x77000000, - 0x76800000, 0x76000000, 0x75800000, 0x75000000, 0x74800000, 0x74000000, 0x73800000, 0x73000000, 0x72800000, 0x72000000, 0x71800000, 0x71000000, 0x70800000, 0x70000000, 0x6F800000, 0x6F000000, - 0x6E800000, 0x6E000000, 0x6D800000, 0x6D000000, 0x6C800000, 0x6C000000, 0x6B800000, 0x6B000000, 0x6A800000, 0x6A000000, 0x69800000, 0x69000000, 0x68800000, 0x68000000, 0x67800000, 0x67000000, - 0x66800000, 0x66000000, 0x65800000, 0x65000000, 0x64800000, 0x64000000, 0x63800000, 0x63000000, 0x62800000, 0x62000000, 0x61800000, 0x61000000, 0x60800000, 0x60000000, 0x5F800000, 0x5F000000, - 0x5E800000, 0x5E000000, 0x5D800000, 0x5D000000, 0x5C800000, 0x5C000000, 0x5B800000, 0x5B000000, 0x5A800000, 0x5A000000, 0x59800000, 0x59000000, 0x58800000, 0x58000000, 0x57800000, 0x57000000, - 0x56800000, 0x56000000, 0x55800000, 0x55000000, 0x54800000, 0x54000000, 0x53800000, 0x53000000, 0x52800000, 0x52000000, 0x51800000, 0x51000000, 0x50800000, 0x50000000, 0x4F800000, 0x4F000000, - 0x4E800000, 0x4E000000, 0x4D800000, 0x4D000000, 0x4C800000, 0x4C000000, 0x4B800000, 0x4B000000, 0x4A800000, 0x4A000000, 0x49800000, 0x49000000, 0x48800000, 0x48000000, 0x47800000, 0x47000000, - 0x46800000, 0x46000000, 0x45800000, 0x45000000, 0x44800000, 0x44000000, 0x43800000, 0x43000000, 0x42800000, 0x42000000, 0x41800000, 0x41000000, 0x40800000, 0x40000000, 0x3F800000, 0x3F000000, - 0x3E800000, 0x3E000000, 0x3D800000, 0x3D000000, 0x3C800000, 0x3C000000, 0x3B800000, 0x3B000000, 0x3A800000, 0x3A000000, 0x39800000, 0x39000000, 0x38800000, 0x38000000, 0x37800000, 0x37000000, - 0x36800000, 0x36000000, 0x35800000, 0x35000000, 0x34800000, 0x34000000, 0x33800000, 0x33000000, 0x32800000, 0x32000000, 0x31800000, 0x31000000, 0x30800000, 0x30000000, 0x2F800000, 0x2F000000, - 0x2E800000, 0x2E000000, 0x2D800000, 0x2D000000, 0x2C800000, 0x2C000000, 0x2B800000, 0x2B000000, 0x2A800000, 0x2A000000, 0x29800000, 0x29000000, 0x28800000, 0x28000000, 0x27800000, 0x27000000, - 0x26800000, 0x26000000, 0x25800000, 0x25000000, 0x24800000, 0x24000000, 0x23800000, 0x23000000, 0x22800000, 0x22000000, 0x21800000, 0x21000000, 0x20800000, 0x20000000, 0x1F800000, 0x1F000000, - 0x1E800000, 0x1E000000, 0x1D800000, 0x1D000000, 0x1C800000, 0x1C000000, 0x1B800000, 0x1B000000, 0x1A800000, 0x1A000000, 0x19800000, 0x19000000, 0x18800000, 0x18000000, 0x17800000, 0x17000000, - 0x16800000, 0x16000000, 0x15800000, 0x15000000, 0x14800000, 0x14000000, 0x13800000, 0x13000000, 0x12800000, 0x12000000, 0x11800000, 0x11000000, 0x10800000, 0x10000000, 0x0F800000, 0x0F000000, - 0x0E800000, 0x0E000000, 0x0D800000, 0x0D000000, 0x0C800000, 0x0C000000, 0x0B800000, 0x0B000000, 0x0A800000, 0x0A000000, 0x09800000, 0x09000000, 0x08800000, 0x08000000, 0x07800000, 0x07000000, - 0x06800000, 0x06000000, 0x05800000, 0x05000000, 0x04800000, 0x04000000, 0x03800000, 0x03000000, 0x02800000, 0x02000000, 0x01800000, 0x01000000, 0x00800000, 0x00000000, 0x00000000, 0x00000000 -}; + { + 0x7F800000, 0x7E000000, 0x7D800000, 0x7D000000, 0x7C800000, 0x7C000000, 0x7B800000, 0x7B000000, 0x7A800000, 0x7A000000, 0x79800000, 0x79000000, 0x78800000, 0x78000000, 0x77800000, 0x77000000, + 0x76800000, 0x76000000, 0x75800000, 0x75000000, 0x74800000, 0x74000000, 0x73800000, 0x73000000, 0x72800000, 0x72000000, 0x71800000, 0x71000000, 0x70800000, 0x70000000, 0x6F800000, 0x6F000000, + 0x6E800000, 0x6E000000, 0x6D800000, 0x6D000000, 0x6C800000, 0x6C000000, 0x6B800000, 0x6B000000, 0x6A800000, 0x6A000000, 0x69800000, 0x69000000, 0x68800000, 0x68000000, 0x67800000, 0x67000000, + 0x66800000, 0x66000000, 0x65800000, 0x65000000, 0x64800000, 0x64000000, 0x63800000, 0x63000000, 0x62800000, 0x62000000, 0x61800000, 0x61000000, 0x60800000, 0x60000000, 0x5F800000, 0x5F000000, + 0x5E800000, 0x5E000000, 0x5D800000, 0x5D000000, 0x5C800000, 0x5C000000, 0x5B800000, 0x5B000000, 0x5A800000, 0x5A000000, 0x59800000, 0x59000000, 0x58800000, 0x58000000, 0x57800000, 0x57000000, + 0x56800000, 0x56000000, 0x55800000, 0x55000000, 0x54800000, 0x54000000, 0x53800000, 0x53000000, 0x52800000, 0x52000000, 0x51800000, 0x51000000, 0x50800000, 0x50000000, 0x4F800000, 0x4F000000, + 0x4E800000, 0x4E000000, 0x4D800000, 0x4D000000, 0x4C800000, 0x4C000000, 0x4B800000, 0x4B000000, 0x4A800000, 0x4A000000, 0x49800000, 0x49000000, 0x48800000, 0x48000000, 0x47800000, 0x47000000, + 0x46800000, 0x46000000, 0x45800000, 0x45000000, 0x44800000, 0x44000000, 0x43800000, 0x43000000, 0x42800000, 0x42000000, 0x41800000, 0x41000000, 0x40800000, 0x40000000, 0x3F800000, 0x3F000000, + 0x3E800000, 0x3E000000, 0x3D800000, 0x3D000000, 0x3C800000, 0x3C000000, 0x3B800000, 0x3B000000, 0x3A800000, 0x3A000000, 0x39800000, 0x39000000, 0x38800000, 0x38000000, 0x37800000, 0x37000000, + 0x36800000, 0x36000000, 0x35800000, 0x35000000, 0x34800000, 0x34000000, 0x33800000, 0x33000000, 0x32800000, 0x32000000, 0x31800000, 0x31000000, 0x30800000, 0x30000000, 0x2F800000, 0x2F000000, + 0x2E800000, 0x2E000000, 0x2D800000, 0x2D000000, 0x2C800000, 0x2C000000, 0x2B800000, 0x2B000000, 0x2A800000, 0x2A000000, 0x29800000, 0x29000000, 0x28800000, 0x28000000, 0x27800000, 0x27000000, + 0x26800000, 0x26000000, 0x25800000, 0x25000000, 0x24800000, 0x24000000, 0x23800000, 0x23000000, 0x22800000, 0x22000000, 0x21800000, 0x21000000, 0x20800000, 0x20000000, 0x1F800000, 0x1F000000, + 0x1E800000, 0x1E000000, 0x1D800000, 0x1D000000, 0x1C800000, 0x1C000000, 0x1B800000, 0x1B000000, 0x1A800000, 0x1A000000, 0x19800000, 0x19000000, 0x18800000, 0x18000000, 0x17800000, 0x17000000, + 0x16800000, 0x16000000, 0x15800000, 0x15000000, 0x14800000, 0x14000000, 0x13800000, 0x13000000, 0x12800000, 0x12000000, 0x11800000, 0x11000000, 0x10800000, 0x10000000, 0x0F800000, 0x0F000000, + 0x0E800000, 0x0E000000, 0x0D800000, 0x0D000000, 0x0C800000, 0x0C000000, 0x0B800000, 0x0B000000, 0x0A800000, 0x0A000000, 0x09800000, 0x09000000, 0x08800000, 0x08000000, 0x07800000, 0x07000000, + 0x06800000, 0x06000000, 0x05800000, 0x05000000, 0x04800000, 0x04000000, 0x03800000, 0x03000000, 0x02800000, 0x02000000, 0x01800000, 0x01000000, 0x00800000, 0x00000000, 0x00000000, 0x00000000}; const u32 spu_frsqest_fraction_lut[64] = -{ - 0x350160, 0x34E954, 0x2F993D, 0x2F993D, 0x2AA523, 0x2AA523, 0x26190D, 0x26190D, 0x21E4F9, 0x21E4F9, 0x1E00E9, 0x1E00E9, 0x1A5CD9, 0x1A5CD9, 0x16F8CB, 0x16F8CB, - 0x13CCC0, 0x13CCC0, 0x10CCB3, 0x10CCB3, 0x0E00AA, 0x0E00AA, 0x0B58A1, 0x0B58A1, 0x08D498, 0x08D498, 0x067491, 0x067491, 0x043089, 0x043089, 0x020C83, 0x020C83, - 0x7FFDF4, 0x7FD1DE, 0x7859C8, 0x783DBA, 0x71559C, 0x71559C, 0x6AE57C, 0x6AE57C, 0x64F561, 0x64F561, 0x5F7149, 0x5F7149, 0x5A4D33, 0x5A4D33, 0x55811F, 0x55811F, - 0x51050F, 0x51050F, 0x4CC8FE, 0x4CC8FE, 0x48D0F0, 0x48D0F0, 0x4510E4, 0x4510E4, 0x4180D7, 0x4180D7, 0x3E24CC, 0x3E24CC, 0x3AF4C3, 0x3AF4C3, 0x37E8BA, 0x37E8BA -}; + { + 0x350160, 0x34E954, 0x2F993D, 0x2F993D, 0x2AA523, 0x2AA523, 0x26190D, 0x26190D, 0x21E4F9, 0x21E4F9, 0x1E00E9, 0x1E00E9, 0x1A5CD9, 0x1A5CD9, 0x16F8CB, 0x16F8CB, + 0x13CCC0, 0x13CCC0, 0x10CCB3, 0x10CCB3, 0x0E00AA, 0x0E00AA, 0x0B58A1, 0x0B58A1, 0x08D498, 0x08D498, 0x067491, 0x067491, 0x043089, 0x043089, 0x020C83, 0x020C83, + 0x7FFDF4, 0x7FD1DE, 0x7859C8, 0x783DBA, 0x71559C, 0x71559C, 0x6AE57C, 0x6AE57C, 0x64F561, 0x64F561, 0x5F7149, 0x5F7149, 0x5A4D33, 0x5A4D33, 0x55811F, 0x55811F, + 0x51050F, 0x51050F, 0x4CC8FE, 0x4CC8FE, 0x48D0F0, 0x48D0F0, 0x4510E4, 0x4510E4, 0x4180D7, 0x4180D7, 0x3E24CC, 0x3E24CC, 0x3AF4C3, 0x3AF4C3, 0x37E8BA, 0x37E8BA}; const u32 spu_frsqest_exponent_lut[256] = -{ - 0x7F800000, 0x5E800000, 0x5E800000, 0x5E000000, 0x5E000000, 0x5D800000, 0x5D800000, 0x5D000000, 0x5D000000, 0x5C800000, 0x5C800000, 0x5C000000, 0x5C000000, 0x5B800000, 0x5B800000, 0x5B000000, - 0x5B000000, 0x5A800000, 0x5A800000, 0x5A000000, 0x5A000000, 0x59800000, 0x59800000, 0x59000000, 0x59000000, 0x58800000, 0x58800000, 0x58000000, 0x58000000, 0x57800000, 0x57800000, 0x57000000, - 0x57000000, 0x56800000, 0x56800000, 0x56000000, 0x56000000, 0x55800000, 0x55800000, 0x55000000, 0x55000000, 0x54800000, 0x54800000, 0x54000000, 0x54000000, 0x53800000, 0x53800000, 0x53000000, - 0x53000000, 0x52800000, 0x52800000, 0x52000000, 0x52000000, 0x51800000, 0x51800000, 0x51000000, 0x51000000, 0x50800000, 0x50800000, 0x50000000, 0x50000000, 0x4F800000, 0x4F800000, 0x4F000000, - 0x4F000000, 0x4E800000, 0x4E800000, 0x4E000000, 0x4E000000, 0x4D800000, 0x4D800000, 0x4D000000, 0x4D000000, 0x4C800000, 0x4C800000, 0x4C000000, 0x4C000000, 0x4B800000, 0x4B800000, 0x4B000000, - 0x4B000000, 0x4A800000, 0x4A800000, 0x4A000000, 0x4A000000, 0x49800000, 0x49800000, 0x49000000, 0x49000000, 0x48800000, 0x48800000, 0x48000000, 0x48000000, 0x47800000, 0x47800000, 0x47000000, - 0x47000000, 0x46800000, 0x46800000, 0x46000000, 0x46000000, 0x45800000, 0x45800000, 0x45000000, 0x45000000, 0x44800000, 0x44800000, 0x44000000, 0x44000000, 0x43800000, 0x43800000, 0x43000000, - 0x43000000, 0x42800000, 0x42800000, 0x42000000, 0x42000000, 0x41800000, 0x41800000, 0x41000000, 0x41000000, 0x40800000, 0x40800000, 0x40000000, 0x40000000, 0x3F800000, 0x3F800000, 0x3F000000, - 0x3F000000, 0x3E800000, 0x3E800000, 0x3E000000, 0x3E000000, 0x3D800000, 0x3D800000, 0x3D000000, 0x3D000000, 0x3C800000, 0x3C800000, 0x3C000000, 0x3C000000, 0x3B800000, 0x3B800000, 0x3B000000, - 0x3B000000, 0x3A800000, 0x3A800000, 0x3A000000, 0x3A000000, 0x39800000, 0x39800000, 0x39000000, 0x39000000, 0x38800000, 0x38800000, 0x38000000, 0x38000000, 0x37800000, 0x37800000, 0x37000000, - 0x37000000, 0x36800000, 0x36800000, 0x36000000, 0x36000000, 0x35800000, 0x35800000, 0x35000000, 0x35000000, 0x34800000, 0x34800000, 0x34000000, 0x34000000, 0x33800000, 0x33800000, 0x33000000, - 0x33000000, 0x32800000, 0x32800000, 0x32000000, 0x32000000, 0x31800000, 0x31800000, 0x31000000, 0x31000000, 0x30800000, 0x30800000, 0x30000000, 0x30000000, 0x2F800000, 0x2F800000, 0x2F000000, - 0x2F000000, 0x2E800000, 0x2E800000, 0x2E000000, 0x2E000000, 0x2D800000, 0x2D800000, 0x2D000000, 0x2D000000, 0x2C800000, 0x2C800000, 0x2C000000, 0x2C000000, 0x2B800000, 0x2B800000, 0x2B000000, - 0x2B000000, 0x2A800000, 0x2A800000, 0x2A000000, 0x2A000000, 0x29800000, 0x29800000, 0x29000000, 0x29000000, 0x28800000, 0x28800000, 0x28000000, 0x28000000, 0x27800000, 0x27800000, 0x27000000, - 0x27000000, 0x26800000, 0x26800000, 0x26000000, 0x26000000, 0x25800000, 0x25800000, 0x25000000, 0x25000000, 0x24800000, 0x24800000, 0x24000000, 0x24000000, 0x23800000, 0x23800000, 0x23000000, - 0x23000000, 0x22800000, 0x22800000, 0x22000000, 0x22000000, 0x21800000, 0x21800000, 0x21000000, 0x21000000, 0x20800000, 0x20800000, 0x20000000, 0x20000000, 0x1F800000, 0x1F800000, 0x1F000000 -}; + { + 0x7F800000, 0x5E800000, 0x5E800000, 0x5E000000, 0x5E000000, 0x5D800000, 0x5D800000, 0x5D000000, 0x5D000000, 0x5C800000, 0x5C800000, 0x5C000000, 0x5C000000, 0x5B800000, 0x5B800000, 0x5B000000, + 0x5B000000, 0x5A800000, 0x5A800000, 0x5A000000, 0x5A000000, 0x59800000, 0x59800000, 0x59000000, 0x59000000, 0x58800000, 0x58800000, 0x58000000, 0x58000000, 0x57800000, 0x57800000, 0x57000000, + 0x57000000, 0x56800000, 0x56800000, 0x56000000, 0x56000000, 0x55800000, 0x55800000, 0x55000000, 0x55000000, 0x54800000, 0x54800000, 0x54000000, 0x54000000, 0x53800000, 0x53800000, 0x53000000, + 0x53000000, 0x52800000, 0x52800000, 0x52000000, 0x52000000, 0x51800000, 0x51800000, 0x51000000, 0x51000000, 0x50800000, 0x50800000, 0x50000000, 0x50000000, 0x4F800000, 0x4F800000, 0x4F000000, + 0x4F000000, 0x4E800000, 0x4E800000, 0x4E000000, 0x4E000000, 0x4D800000, 0x4D800000, 0x4D000000, 0x4D000000, 0x4C800000, 0x4C800000, 0x4C000000, 0x4C000000, 0x4B800000, 0x4B800000, 0x4B000000, + 0x4B000000, 0x4A800000, 0x4A800000, 0x4A000000, 0x4A000000, 0x49800000, 0x49800000, 0x49000000, 0x49000000, 0x48800000, 0x48800000, 0x48000000, 0x48000000, 0x47800000, 0x47800000, 0x47000000, + 0x47000000, 0x46800000, 0x46800000, 0x46000000, 0x46000000, 0x45800000, 0x45800000, 0x45000000, 0x45000000, 0x44800000, 0x44800000, 0x44000000, 0x44000000, 0x43800000, 0x43800000, 0x43000000, + 0x43000000, 0x42800000, 0x42800000, 0x42000000, 0x42000000, 0x41800000, 0x41800000, 0x41000000, 0x41000000, 0x40800000, 0x40800000, 0x40000000, 0x40000000, 0x3F800000, 0x3F800000, 0x3F000000, + 0x3F000000, 0x3E800000, 0x3E800000, 0x3E000000, 0x3E000000, 0x3D800000, 0x3D800000, 0x3D000000, 0x3D000000, 0x3C800000, 0x3C800000, 0x3C000000, 0x3C000000, 0x3B800000, 0x3B800000, 0x3B000000, + 0x3B000000, 0x3A800000, 0x3A800000, 0x3A000000, 0x3A000000, 0x39800000, 0x39800000, 0x39000000, 0x39000000, 0x38800000, 0x38800000, 0x38000000, 0x38000000, 0x37800000, 0x37800000, 0x37000000, + 0x37000000, 0x36800000, 0x36800000, 0x36000000, 0x36000000, 0x35800000, 0x35800000, 0x35000000, 0x35000000, 0x34800000, 0x34800000, 0x34000000, 0x34000000, 0x33800000, 0x33800000, 0x33000000, + 0x33000000, 0x32800000, 0x32800000, 0x32000000, 0x32000000, 0x31800000, 0x31800000, 0x31000000, 0x31000000, 0x30800000, 0x30800000, 0x30000000, 0x30000000, 0x2F800000, 0x2F800000, 0x2F000000, + 0x2F000000, 0x2E800000, 0x2E800000, 0x2E000000, 0x2E000000, 0x2D800000, 0x2D800000, 0x2D000000, 0x2D000000, 0x2C800000, 0x2C800000, 0x2C000000, 0x2C000000, 0x2B800000, 0x2B800000, 0x2B000000, + 0x2B000000, 0x2A800000, 0x2A800000, 0x2A000000, 0x2A000000, 0x29800000, 0x29800000, 0x29000000, 0x29000000, 0x28800000, 0x28800000, 0x28000000, 0x28000000, 0x27800000, 0x27800000, 0x27000000, + 0x27000000, 0x26800000, 0x26800000, 0x26000000, 0x26000000, 0x25800000, 0x25800000, 0x25000000, 0x25000000, 0x24800000, 0x24800000, 0x24000000, 0x24000000, 0x23800000, 0x23800000, 0x23000000, + 0x23000000, 0x22800000, 0x22800000, 0x22000000, 0x22000000, 0x21800000, 0x21800000, 0x21000000, 0x21000000, 0x20800000, 0x20800000, 0x20000000, 0x20000000, 0x1F800000, 0x1F800000, 0x1F000000}; using spu_rdata_t = decltype(spu_thread::rdata); @@ -110,49 +106,49 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](mfc_atomic_status arg) - { - switch (arg) { - case MFC_PUTLLC_SUCCESS: return "PUTLLC"; - case MFC_PUTLLC_FAILURE: return "PUTLLC-FAIL"; - case MFC_PUTLLUC_SUCCESS: return "PUTLLUC"; - case MFC_GETLLAR_SUCCESS: return "GETLLAR"; - } + switch (arg) + { + case MFC_PUTLLC_SUCCESS: return "PUTLLC"; + case MFC_PUTLLC_FAILURE: return "PUTLLC-FAIL"; + case MFC_PUTLLUC_SUCCESS: return "PUTLLUC"; + case MFC_GETLLAR_SUCCESS: return "GETLLAR"; + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](mfc_tag_update arg) - { - switch (arg) { - case MFC_TAG_UPDATE_IMMEDIATE: return "empty"; - case MFC_TAG_UPDATE_ANY: return "ANY"; - case MFC_TAG_UPDATE_ALL: return "ALL"; - } + switch (arg) + { + case MFC_TAG_UPDATE_IMMEDIATE: return "empty"; + case MFC_TAG_UPDATE_ANY: return "ANY"; + case MFC_TAG_UPDATE_ALL: return "ALL"; + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](spu_type arg) - { - switch (arg) { - case spu_type::threaded: return "Threaded"; - case spu_type::raw: return "Raw"; - case spu_type::isolated: return "Isolated"; - } + switch (arg) + { + case spu_type::threaded: return "Threaded"; + case spu_type::raw: return "Raw"; + case spu_type::isolated: return "Isolated"; + } - return unknown; - }); + return unknown; + }); } template <> @@ -167,7 +163,9 @@ void fmt_class_string::format(std::string& out, u64 arg) fmt::append(out, "...chunk-0x%05x", (arg & 0xffff) * 4); } -enum class spu_block_hash_short : u64{}; +enum class spu_block_hash_short : u64 +{ +}; template <> void fmt_class_string::format(std::string& out, u64 arg) @@ -188,14 +186,11 @@ static const u32 s_rep_movsb_threshold = utils::get_rep_movsb_threshold(); #if defined(_M_X64) extern "C" void __movsb(uchar*, const uchar*, size_t); #elif defined(ARCH_X64) -static FORCE_INLINE void __movsb(unsigned char * Dst, const unsigned char * Src, size_t Size) +static FORCE_INLINE void __movsb(unsigned char* Dst, const unsigned char* Src, size_t Size) { - __asm__ __volatile__ - ( + __asm__ __volatile__( "rep; movsb" : - [Dst] "=D" (Dst), [Src] "=S" (Src), [Size] "=c" (Size) : - "[Dst]" (Dst), "[Src]" (Src), "[Size]" (Size) - ); + [Dst] "=D"(Dst), [Src] "=S"(Src), [Size] "=c"(Size) : "[Dst]"(Dst), "[Src]"(Src), "[Size]"(Size)); } #else #define s_rep_movsb_threshold umax @@ -231,15 +226,13 @@ static FORCE_INLINE bool cmp_rdata_avx(const __m256i* lhs, const __m256i* rhs) "vorps %%ymm0, %%ymm2, %%ymm0;" "vptest %%ymm0, %%ymm0;" // test "vzeroupper" - : "=@ccz" (result) - : [lhs] "r" (lhs) - , [rhs] "r" (rhs) + : "=@ccz"(result) + : [lhs] "r"(lhs), [rhs] "r"(rhs) : "cc" // Clobber flags - , "xmm0" // Clobber registers ymm0-ymm3 (see mov_rdata_avx) - , "xmm1" - , "xmm2" - , "xmm3" - ); + , + "xmm0" // Clobber registers ymm0-ymm3 (see mov_rdata_avx) + , + "xmm1", "xmm2", "xmm3"); return result; #endif } @@ -248,7 +241,8 @@ static FORCE_INLINE bool cmp_rdata_avx(const __m256i* lhs, const __m256i* rhs) #ifdef _MSC_VER __forceinline #endif -extern bool cmp_rdata(const spu_rdata_t& _lhs, const spu_rdata_t& _rhs) + extern bool + cmp_rdata(const spu_rdata_t& _lhs, const spu_rdata_t& _rhs) { #if defined(ARCH_X64) #ifndef __AVX__ @@ -291,8 +285,7 @@ static FORCE_INLINE void mov_rdata_avx(__m256i* dst, const __m256i* src) "vzeroupper" // Don't need in AVX mode (should be emitted automatically) #endif : - : [src] "r" (src) - , [dst] "r" (dst) + : [src] "r"(src), [dst] "r"(dst) #ifdef __AVX__ : "ymm0" // Clobber ymm0 register (acknowledge its modification) #else @@ -306,7 +299,8 @@ static FORCE_INLINE void mov_rdata_avx(__m256i* dst, const __m256i* src) #ifdef _MSC_VER __forceinline #endif -extern void mov_rdata(spu_rdata_t& _dst, const spu_rdata_t& _src) + extern void + mov_rdata(spu_rdata_t& _dst, const spu_rdata_t& _src) { #if defined(ARCH_X64) #ifndef __AVX__ @@ -344,7 +338,8 @@ extern void mov_rdata(spu_rdata_t& _dst, const spu_rdata_t& _src) #ifdef _MSC_VER __forceinline #endif -extern u32 compute_rdata_hash32(const spu_rdata_t& _src) + extern u32 + compute_rdata_hash32(const spu_rdata_t& _src) { const auto rhs = reinterpret_cast(_src); const v128 a = gv_add32(rhs[0], rhs[1]); @@ -366,7 +361,7 @@ static FORCE_INLINE void mov_rdata_nt_avx(__m256i* dst, const __m256i* src) _mm256_stream_si256(dst + 3, _mm256_load_si256(src + 3)); #else __asm__( - "vmovdqa 0*32(%[src]), %%ymm0;" // load + "vmovdqa 0*32(%[src]), %%ymm0;" // load "vmovntdq %%ymm0, 0*32(%[dst]);" // store "vmovdqa 2*32(%[src]), %%ymm0;" "vmovntdq %%ymm0, 2*32(%[dst]);" @@ -378,8 +373,7 @@ static FORCE_INLINE void mov_rdata_nt_avx(__m256i* dst, const __m256i* src) "vzeroupper" // Don't need in AVX mode (should be emitted automatically) #endif : - : [src] "r" (src) - , [dst] "r" (dst) + : [src] "r"(src), [dst] "r"(dst) #ifdef __AVX__ : "ymm0" // Clobber ymm0 register (acknowledge its modification) #else @@ -486,14 +480,14 @@ namespace vm g_range_lock_bits[1].release(0); } -} +} // namespace vm namespace spu { namespace scheduler { std::array, 65536> atomic_instruction_table = {}; - constexpr u32 native_jiffy_duration_us = 1500; //About 1ms resolution with a half offset + constexpr u32 native_jiffy_duration_us = 1500; // About 1ms resolution with a half offset void acquire_pc_address(spu_thread& spu, u32 pc, u32 timeout_ms, u32 max_concurrent_instructions) { @@ -505,7 +499,7 @@ namespace spu if (timeout_ms > 0) { - const u64 timeout = timeout_ms * 1000u; //convert to microseconds + const u64 timeout = timeout_ms * 1000u; // convert to microseconds const u64 start = get_system_time(); auto remaining = timeout; @@ -519,13 +513,14 @@ namespace spu const auto now = get_system_time(); const auto elapsed = now - start; - if (elapsed > timeout) break; + if (elapsed > timeout) + break; remaining = timeout - elapsed; } } else { - //Slight pause if function is overburdened + // Slight pause if function is overburdened const auto count = atomic_instruction_table[pc_offset].observe() * 100ull; busy_wait(count); } @@ -549,7 +544,7 @@ namespace spu bool active = false; concurrent_execution_watchdog(spu_thread& spu) - :pc(spu.pc) + : pc(spu.pc) { if (const u32 max_concurrent_instructions = g_cfg.core.preferred_spu_threads) { @@ -564,8 +559,8 @@ namespace spu release_pc_address(pc); } }; - } -} + } // namespace scheduler +} // namespace spu std::array op_branch_targets(u32 pc, spu_opcode_t op) { @@ -612,524 +607,524 @@ std::array op_branch_targets(u32 pc, spu_opcode_t op) return res; } -const auto spu_putllc_tx = build_function_asm("spu_putllc_tx", [](native_asm& c, auto& args) -{ - using namespace asmjit; +const auto spu_putllc_tx = build_function_asm("spu_putllc_tx", [](native_asm& c, auto& args) + { + using namespace asmjit; #if defined(ARCH_X64) - Label fall = c.newLabel(); - Label fail = c.newLabel(); - Label _ret = c.newLabel(); - Label load = c.newLabel(); + Label fall = c.newLabel(); + Label fail = c.newLabel(); + Label _ret = c.newLabel(); + Label load = c.newLabel(); - //if (utils::has_avx() && !s_tsx_avx) + // if (utils::has_avx() && !s_tsx_avx) //{ // c.vzeroupper(); - //} + // } // Create stack frame if necessary (Windows ABI has only 6 volatile vector registers) #ifdef _WIN32 - c.sub(x86::rsp, 168); - if (s_tsx_avx) - { - c.vmovups(x86::oword_ptr(x86::rsp, 0), x86::xmm6); - c.vmovups(x86::oword_ptr(x86::rsp, 16), x86::xmm7); - } - else - { - c.movups(x86::oword_ptr(x86::rsp, 0), x86::xmm6); - c.movups(x86::oword_ptr(x86::rsp, 16), x86::xmm7); - c.movups(x86::oword_ptr(x86::rsp, 32), x86::xmm8); - c.movups(x86::oword_ptr(x86::rsp, 48), x86::xmm9); - c.movups(x86::oword_ptr(x86::rsp, 64), x86::xmm10); - c.movups(x86::oword_ptr(x86::rsp, 80), x86::xmm11); - c.movups(x86::oword_ptr(x86::rsp, 96), x86::xmm12); - c.movups(x86::oword_ptr(x86::rsp, 112), x86::xmm13); - c.movups(x86::oword_ptr(x86::rsp, 128), x86::xmm14); - c.movups(x86::oword_ptr(x86::rsp, 144), x86::xmm15); - } + c.sub(x86::rsp, 168); + if (s_tsx_avx) + { + c.vmovups(x86::oword_ptr(x86::rsp, 0), x86::xmm6); + c.vmovups(x86::oword_ptr(x86::rsp, 16), x86::xmm7); + } + else + { + c.movups(x86::oword_ptr(x86::rsp, 0), x86::xmm6); + c.movups(x86::oword_ptr(x86::rsp, 16), x86::xmm7); + c.movups(x86::oword_ptr(x86::rsp, 32), x86::xmm8); + c.movups(x86::oword_ptr(x86::rsp, 48), x86::xmm9); + c.movups(x86::oword_ptr(x86::rsp, 64), x86::xmm10); + c.movups(x86::oword_ptr(x86::rsp, 80), x86::xmm11); + c.movups(x86::oword_ptr(x86::rsp, 96), x86::xmm12); + c.movups(x86::oword_ptr(x86::rsp, 112), x86::xmm13); + c.movups(x86::oword_ptr(x86::rsp, 128), x86::xmm14); + c.movups(x86::oword_ptr(x86::rsp, 144), x86::xmm15); + } #endif - // Prepare registers - build_swap_rdx_with(c, args, x86::r10); - c.mov(args[1], x86::qword_ptr(reinterpret_cast(&vm::g_sudo_addr))); - c.lea(args[1], x86::qword_ptr(args[1], args[0])); - c.prefetchw(x86::byte_ptr(args[1], 0)); - c.prefetchw(x86::byte_ptr(args[1], 64)); - c.and_(args[0].r32(), 0xff80); - c.shr(args[0].r32(), 1); - c.lea(x86::r11, x86::qword_ptr(reinterpret_cast(+vm::g_reservations), args[0])); + // Prepare registers + build_swap_rdx_with(c, args, x86::r10); + c.mov(args[1], x86::qword_ptr(reinterpret_cast(&vm::g_sudo_addr))); + c.lea(args[1], x86::qword_ptr(args[1], args[0])); + c.prefetchw(x86::byte_ptr(args[1], 0)); + c.prefetchw(x86::byte_ptr(args[1], 64)); + c.and_(args[0].r32(), 0xff80); + c.shr(args[0].r32(), 1); + c.lea(x86::r11, x86::qword_ptr(reinterpret_cast(+vm::g_reservations), args[0])); - // Prepare data - if (s_tsx_avx) - { - c.vmovups(x86::ymm0, x86::ymmword_ptr(args[2], 0)); - c.vmovups(x86::ymm1, x86::ymmword_ptr(args[2], 32)); - c.vmovups(x86::ymm2, x86::ymmword_ptr(args[2], 64)); - c.vmovups(x86::ymm3, x86::ymmword_ptr(args[2], 96)); - c.vmovups(x86::ymm4, x86::ymmword_ptr(args[3], 0)); - c.vmovups(x86::ymm5, x86::ymmword_ptr(args[3], 32)); - c.vmovups(x86::ymm6, x86::ymmword_ptr(args[3], 64)); - c.vmovups(x86::ymm7, x86::ymmword_ptr(args[3], 96)); - } - else - { - c.movaps(x86::xmm0, x86::oword_ptr(args[2], 0)); - c.movaps(x86::xmm1, x86::oword_ptr(args[2], 16)); - c.movaps(x86::xmm2, x86::oword_ptr(args[2], 32)); - c.movaps(x86::xmm3, x86::oword_ptr(args[2], 48)); - c.movaps(x86::xmm4, x86::oword_ptr(args[2], 64)); - c.movaps(x86::xmm5, x86::oword_ptr(args[2], 80)); - c.movaps(x86::xmm6, x86::oword_ptr(args[2], 96)); - c.movaps(x86::xmm7, x86::oword_ptr(args[2], 112)); - c.movaps(x86::xmm8, x86::oword_ptr(args[3], 0)); - c.movaps(x86::xmm9, x86::oword_ptr(args[3], 16)); - c.movaps(x86::xmm10, x86::oword_ptr(args[3], 32)); - c.movaps(x86::xmm11, x86::oword_ptr(args[3], 48)); - c.movaps(x86::xmm12, x86::oword_ptr(args[3], 64)); - c.movaps(x86::xmm13, x86::oword_ptr(args[3], 80)); - c.movaps(x86::xmm14, x86::oword_ptr(args[3], 96)); - c.movaps(x86::xmm15, x86::oword_ptr(args[3], 112)); - } + // Prepare data + if (s_tsx_avx) + { + c.vmovups(x86::ymm0, x86::ymmword_ptr(args[2], 0)); + c.vmovups(x86::ymm1, x86::ymmword_ptr(args[2], 32)); + c.vmovups(x86::ymm2, x86::ymmword_ptr(args[2], 64)); + c.vmovups(x86::ymm3, x86::ymmword_ptr(args[2], 96)); + c.vmovups(x86::ymm4, x86::ymmword_ptr(args[3], 0)); + c.vmovups(x86::ymm5, x86::ymmword_ptr(args[3], 32)); + c.vmovups(x86::ymm6, x86::ymmword_ptr(args[3], 64)); + c.vmovups(x86::ymm7, x86::ymmword_ptr(args[3], 96)); + } + else + { + c.movaps(x86::xmm0, x86::oword_ptr(args[2], 0)); + c.movaps(x86::xmm1, x86::oword_ptr(args[2], 16)); + c.movaps(x86::xmm2, x86::oword_ptr(args[2], 32)); + c.movaps(x86::xmm3, x86::oword_ptr(args[2], 48)); + c.movaps(x86::xmm4, x86::oword_ptr(args[2], 64)); + c.movaps(x86::xmm5, x86::oword_ptr(args[2], 80)); + c.movaps(x86::xmm6, x86::oword_ptr(args[2], 96)); + c.movaps(x86::xmm7, x86::oword_ptr(args[2], 112)); + c.movaps(x86::xmm8, x86::oword_ptr(args[3], 0)); + c.movaps(x86::xmm9, x86::oword_ptr(args[3], 16)); + c.movaps(x86::xmm10, x86::oword_ptr(args[3], 32)); + c.movaps(x86::xmm11, x86::oword_ptr(args[3], 48)); + c.movaps(x86::xmm12, x86::oword_ptr(args[3], 64)); + c.movaps(x86::xmm13, x86::oword_ptr(args[3], 80)); + c.movaps(x86::xmm14, x86::oword_ptr(args[3], 96)); + c.movaps(x86::xmm15, x86::oword_ptr(args[3], 112)); + } - // Alloc args[0] to stamp0 - const auto stamp0 = args[0]; - build_get_tsc(c, stamp0); + // Alloc args[0] to stamp0 + const auto stamp0 = args[0]; + build_get_tsc(c, stamp0); - Label fail2 = c.newLabel(); + Label fail2 = c.newLabel(); - Label tx1 = build_transaction_enter(c, fall, [&]() - { - c.add(x86::qword_ptr(args[2], ::offset32(&spu_thread::ftx) - ::offset32(&spu_thread::rdata)), 1); + Label tx1 = build_transaction_enter(c, fall, [&]() + { + c.add(x86::qword_ptr(args[2], ::offset32(&spu_thread::ftx) - ::offset32(&spu_thread::rdata)), 1); + build_get_tsc(c); + c.sub(x86::rax, stamp0); + c.cmp(x86::rax, x86::qword_ptr(reinterpret_cast(&g_rtm_tx_limit2))); + c.jae(fall); + }); + + // Check pause flag + c.bt(x86::dword_ptr(args[2], ::offset32(&spu_thread::state) - ::offset32(&spu_thread::rdata)), static_cast(cpu_flag::pause)); + c.jc(fall); + c.xbegin(tx1); + + if (s_tsx_avx) + { + c.vxorps(x86::ymm0, x86::ymm0, x86::ymmword_ptr(args[1], 0)); + c.vxorps(x86::ymm1, x86::ymm1, x86::ymmword_ptr(args[1], 32)); + c.vxorps(x86::ymm2, x86::ymm2, x86::ymmword_ptr(args[1], 64)); + c.vxorps(x86::ymm3, x86::ymm3, x86::ymmword_ptr(args[1], 96)); + c.vorps(x86::ymm0, x86::ymm0, x86::ymm1); + c.vorps(x86::ymm1, x86::ymm2, x86::ymm3); + c.vorps(x86::ymm0, x86::ymm1, x86::ymm0); + c.vptest(x86::ymm0, x86::ymm0); + } + else + { + c.xorps(x86::xmm0, x86::oword_ptr(args[1], 0)); + c.xorps(x86::xmm1, x86::oword_ptr(args[1], 16)); + c.xorps(x86::xmm2, x86::oword_ptr(args[1], 32)); + c.xorps(x86::xmm3, x86::oword_ptr(args[1], 48)); + c.xorps(x86::xmm4, x86::oword_ptr(args[1], 64)); + c.xorps(x86::xmm5, x86::oword_ptr(args[1], 80)); + c.xorps(x86::xmm6, x86::oword_ptr(args[1], 96)); + c.xorps(x86::xmm7, x86::oword_ptr(args[1], 112)); + c.orps(x86::xmm0, x86::xmm1); + c.orps(x86::xmm2, x86::xmm3); + c.orps(x86::xmm4, x86::xmm5); + c.orps(x86::xmm6, x86::xmm7); + c.orps(x86::xmm0, x86::xmm2); + c.orps(x86::xmm4, x86::xmm6); + c.orps(x86::xmm0, x86::xmm4); + c.ptest(x86::xmm0, x86::xmm0); + } + + c.jnz(fail); + + if (s_tsx_avx) + { + c.vmovaps(x86::ymmword_ptr(args[1], 0), x86::ymm4); + c.vmovaps(x86::ymmword_ptr(args[1], 32), x86::ymm5); + c.vmovaps(x86::ymmword_ptr(args[1], 64), x86::ymm6); + c.vmovaps(x86::ymmword_ptr(args[1], 96), x86::ymm7); + } + else + { + c.movaps(x86::oword_ptr(args[1], 0), x86::xmm8); + c.movaps(x86::oword_ptr(args[1], 16), x86::xmm9); + c.movaps(x86::oword_ptr(args[1], 32), x86::xmm10); + c.movaps(x86::oword_ptr(args[1], 48), x86::xmm11); + c.movaps(x86::oword_ptr(args[1], 64), x86::xmm12); + c.movaps(x86::oword_ptr(args[1], 80), x86::xmm13); + c.movaps(x86::oword_ptr(args[1], 96), x86::xmm14); + c.movaps(x86::oword_ptr(args[1], 112), x86::xmm15); + } + + c.xend(); + c.lock().add(x86::qword_ptr(x86::r11), 64); + c.add(x86::qword_ptr(args[2], ::offset32(&spu_thread::stx) - ::offset32(&spu_thread::rdata)), 1); build_get_tsc(c); c.sub(x86::rax, stamp0); - c.cmp(x86::rax, x86::qword_ptr(reinterpret_cast(&g_rtm_tx_limit2))); - c.jae(fall); - }); + c.jmp(_ret); - // Check pause flag - c.bt(x86::dword_ptr(args[2], ::offset32(&spu_thread::state) - ::offset32(&spu_thread::rdata)), static_cast(cpu_flag::pause)); - c.jc(fall); - c.xbegin(tx1); + // XABORT is expensive so try to finish with xend instead + c.bind(fail); - if (s_tsx_avx) - { - c.vxorps(x86::ymm0, x86::ymm0, x86::ymmword_ptr(args[1], 0)); - c.vxorps(x86::ymm1, x86::ymm1, x86::ymmword_ptr(args[1], 32)); - c.vxorps(x86::ymm2, x86::ymm2, x86::ymmword_ptr(args[1], 64)); - c.vxorps(x86::ymm3, x86::ymm3, x86::ymmword_ptr(args[1], 96)); - c.vorps(x86::ymm0, x86::ymm0, x86::ymm1); - c.vorps(x86::ymm1, x86::ymm2, x86::ymm3); - c.vorps(x86::ymm0, x86::ymm1, x86::ymm0); - c.vptest(x86::ymm0, x86::ymm0); - } - else - { - c.xorps(x86::xmm0, x86::oword_ptr(args[1], 0)); - c.xorps(x86::xmm1, x86::oword_ptr(args[1], 16)); - c.xorps(x86::xmm2, x86::oword_ptr(args[1], 32)); - c.xorps(x86::xmm3, x86::oword_ptr(args[1], 48)); - c.xorps(x86::xmm4, x86::oword_ptr(args[1], 64)); - c.xorps(x86::xmm5, x86::oword_ptr(args[1], 80)); - c.xorps(x86::xmm6, x86::oword_ptr(args[1], 96)); - c.xorps(x86::xmm7, x86::oword_ptr(args[1], 112)); - c.orps(x86::xmm0, x86::xmm1); - c.orps(x86::xmm2, x86::xmm3); - c.orps(x86::xmm4, x86::xmm5); - c.orps(x86::xmm6, x86::xmm7); - c.orps(x86::xmm0, x86::xmm2); - c.orps(x86::xmm4, x86::xmm6); - c.orps(x86::xmm0, x86::xmm4); - c.ptest(x86::xmm0, x86::xmm0); - } + // Load previous data to store back to rdata + if (s_tsx_avx) + { + c.vmovaps(x86::ymm0, x86::ymmword_ptr(args[1], 0)); + c.vmovaps(x86::ymm1, x86::ymmword_ptr(args[1], 32)); + c.vmovaps(x86::ymm2, x86::ymmword_ptr(args[1], 64)); + c.vmovaps(x86::ymm3, x86::ymmword_ptr(args[1], 96)); + } + else + { + c.movaps(x86::xmm0, x86::oword_ptr(args[1], 0)); + c.movaps(x86::xmm1, x86::oword_ptr(args[1], 16)); + c.movaps(x86::xmm2, x86::oword_ptr(args[1], 32)); + c.movaps(x86::xmm3, x86::oword_ptr(args[1], 48)); + c.movaps(x86::xmm4, x86::oword_ptr(args[1], 64)); + c.movaps(x86::xmm5, x86::oword_ptr(args[1], 80)); + c.movaps(x86::xmm6, x86::oword_ptr(args[1], 96)); + c.movaps(x86::xmm7, x86::oword_ptr(args[1], 112)); + } - c.jnz(fail); + c.xend(); + c.add(x86::qword_ptr(args[2], ::offset32(&spu_thread::stx) - ::offset32(&spu_thread::rdata)), 1); + c.jmp(fail2); - if (s_tsx_avx) - { - c.vmovaps(x86::ymmword_ptr(args[1], 0), x86::ymm4); - c.vmovaps(x86::ymmword_ptr(args[1], 32), x86::ymm5); - c.vmovaps(x86::ymmword_ptr(args[1], 64), x86::ymm6); - c.vmovaps(x86::ymmword_ptr(args[1], 96), x86::ymm7); - } - else - { - c.movaps(x86::oword_ptr(args[1], 0), x86::xmm8); - c.movaps(x86::oword_ptr(args[1], 16), x86::xmm9); - c.movaps(x86::oword_ptr(args[1], 32), x86::xmm10); - c.movaps(x86::oword_ptr(args[1], 48), x86::xmm11); - c.movaps(x86::oword_ptr(args[1], 64), x86::xmm12); - c.movaps(x86::oword_ptr(args[1], 80), x86::xmm13); - c.movaps(x86::oword_ptr(args[1], 96), x86::xmm14); - c.movaps(x86::oword_ptr(args[1], 112), x86::xmm15); - } + c.bind(fall); + c.mov(x86::rax, -1); + c.jmp(_ret); - c.xend(); - c.lock().add(x86::qword_ptr(x86::r11), 64); - c.add(x86::qword_ptr(args[2], ::offset32(&spu_thread::stx) - ::offset32(&spu_thread::rdata)), 1); - build_get_tsc(c); - c.sub(x86::rax, stamp0); - c.jmp(_ret); + c.bind(fail2); + c.lock().sub(x86::qword_ptr(x86::r11), 64); + c.bind(load); - // XABORT is expensive so try to finish with xend instead - c.bind(fail); + // Store previous data back to rdata + if (s_tsx_avx) + { + c.vmovaps(x86::ymmword_ptr(args[2], 0), x86::ymm0); + c.vmovaps(x86::ymmword_ptr(args[2], 32), x86::ymm1); + c.vmovaps(x86::ymmword_ptr(args[2], 64), x86::ymm2); + c.vmovaps(x86::ymmword_ptr(args[2], 96), x86::ymm3); + } + else + { + c.movaps(x86::oword_ptr(args[2], 0), x86::xmm0); + c.movaps(x86::oword_ptr(args[2], 16), x86::xmm1); + c.movaps(x86::oword_ptr(args[2], 32), x86::xmm2); + c.movaps(x86::oword_ptr(args[2], 48), x86::xmm3); + c.movaps(x86::oword_ptr(args[2], 64), x86::xmm4); + c.movaps(x86::oword_ptr(args[2], 80), x86::xmm5); + c.movaps(x86::oword_ptr(args[2], 96), x86::xmm6); + c.movaps(x86::oword_ptr(args[2], 112), x86::xmm7); + } - // Load previous data to store back to rdata - if (s_tsx_avx) - { - c.vmovaps(x86::ymm0, x86::ymmword_ptr(args[1], 0)); - c.vmovaps(x86::ymm1, x86::ymmword_ptr(args[1], 32)); - c.vmovaps(x86::ymm2, x86::ymmword_ptr(args[1], 64)); - c.vmovaps(x86::ymm3, x86::ymmword_ptr(args[1], 96)); - } - else - { - c.movaps(x86::xmm0, x86::oword_ptr(args[1], 0)); - c.movaps(x86::xmm1, x86::oword_ptr(args[1], 16)); - c.movaps(x86::xmm2, x86::oword_ptr(args[1], 32)); - c.movaps(x86::xmm3, x86::oword_ptr(args[1], 48)); - c.movaps(x86::xmm4, x86::oword_ptr(args[1], 64)); - c.movaps(x86::xmm5, x86::oword_ptr(args[1], 80)); - c.movaps(x86::xmm6, x86::oword_ptr(args[1], 96)); - c.movaps(x86::xmm7, x86::oword_ptr(args[1], 112)); - } + c.mov(x86::rax, -1); + c.mov(x86::qword_ptr(args[2], ::offset32(&spu_thread::last_ftime) - ::offset32(&spu_thread::rdata)), x86::rax); + c.xor_(x86::eax, x86::eax); + // c.jmp(_ret); - c.xend(); - c.add(x86::qword_ptr(args[2], ::offset32(&spu_thread::stx) - ::offset32(&spu_thread::rdata)), 1); - c.jmp(fail2); - - c.bind(fall); - c.mov(x86::rax, -1); - c.jmp(_ret); - - c.bind(fail2); - c.lock().sub(x86::qword_ptr(x86::r11), 64); - c.bind(load); - - // Store previous data back to rdata - if (s_tsx_avx) - { - c.vmovaps(x86::ymmword_ptr(args[2], 0), x86::ymm0); - c.vmovaps(x86::ymmword_ptr(args[2], 32), x86::ymm1); - c.vmovaps(x86::ymmword_ptr(args[2], 64), x86::ymm2); - c.vmovaps(x86::ymmword_ptr(args[2], 96), x86::ymm3); - } - else - { - c.movaps(x86::oword_ptr(args[2], 0), x86::xmm0); - c.movaps(x86::oword_ptr(args[2], 16), x86::xmm1); - c.movaps(x86::oword_ptr(args[2], 32), x86::xmm2); - c.movaps(x86::oword_ptr(args[2], 48), x86::xmm3); - c.movaps(x86::oword_ptr(args[2], 64), x86::xmm4); - c.movaps(x86::oword_ptr(args[2], 80), x86::xmm5); - c.movaps(x86::oword_ptr(args[2], 96), x86::xmm6); - c.movaps(x86::oword_ptr(args[2], 112), x86::xmm7); - } - - c.mov(x86::rax, -1); - c.mov(x86::qword_ptr(args[2], ::offset32(&spu_thread::last_ftime) - ::offset32(&spu_thread::rdata)), x86::rax); - c.xor_(x86::eax, x86::eax); - //c.jmp(_ret); - - c.bind(_ret); + c.bind(_ret); #ifdef _WIN32 - if (s_tsx_avx) - { - c.vmovups(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); - c.vmovups(x86::xmm7, x86::oword_ptr(x86::rsp, 16)); - } - else - { - c.movups(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); - c.movups(x86::xmm7, x86::oword_ptr(x86::rsp, 16)); - c.movups(x86::xmm8, x86::oword_ptr(x86::rsp, 32)); - c.movups(x86::xmm9, x86::oword_ptr(x86::rsp, 48)); - c.movups(x86::xmm10, x86::oword_ptr(x86::rsp, 64)); - c.movups(x86::xmm11, x86::oword_ptr(x86::rsp, 80)); - c.movups(x86::xmm12, x86::oword_ptr(x86::rsp, 96)); - c.movups(x86::xmm13, x86::oword_ptr(x86::rsp, 112)); - c.movups(x86::xmm14, x86::oword_ptr(x86::rsp, 128)); - c.movups(x86::xmm15, x86::oword_ptr(x86::rsp, 144)); - } - c.add(x86::rsp, 168); + if (s_tsx_avx) + { + c.vmovups(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); + c.vmovups(x86::xmm7, x86::oword_ptr(x86::rsp, 16)); + } + else + { + c.movups(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); + c.movups(x86::xmm7, x86::oword_ptr(x86::rsp, 16)); + c.movups(x86::xmm8, x86::oword_ptr(x86::rsp, 32)); + c.movups(x86::xmm9, x86::oword_ptr(x86::rsp, 48)); + c.movups(x86::xmm10, x86::oword_ptr(x86::rsp, 64)); + c.movups(x86::xmm11, x86::oword_ptr(x86::rsp, 80)); + c.movups(x86::xmm12, x86::oword_ptr(x86::rsp, 96)); + c.movups(x86::xmm13, x86::oword_ptr(x86::rsp, 112)); + c.movups(x86::xmm14, x86::oword_ptr(x86::rsp, 128)); + c.movups(x86::xmm15, x86::oword_ptr(x86::rsp, 144)); + } + c.add(x86::rsp, 168); #endif - if (s_tsx_avx) - { - c.vzeroupper(); - } + if (s_tsx_avx) + { + c.vzeroupper(); + } - maybe_flush_lbr(c); - c.ret(); + maybe_flush_lbr(c); + c.ret(); #else - UNUSED(args); + UNUSED(args); - c.brk(Imm(0x42)); - c.ret(a64::x30); + c.brk(Imm(0x42)); + c.ret(a64::x30); #endif -}); + }); -const auto spu_putlluc_tx = build_function_asm("spu_putlluc_tx", [](native_asm& c, auto& args) -{ - using namespace asmjit; +const auto spu_putlluc_tx = build_function_asm("spu_putlluc_tx", [](native_asm& c, auto& args) + { + using namespace asmjit; #if defined(ARCH_X64) - Label fall = c.newLabel(); - Label _ret = c.newLabel(); + Label fall = c.newLabel(); + Label _ret = c.newLabel(); - //if (utils::has_avx() && !s_tsx_avx) + // if (utils::has_avx() && !s_tsx_avx) //{ // c.vzeroupper(); - //} + // } // Create stack frame if necessary (Windows ABI has only 6 volatile vector registers) #ifdef _WIN32 - c.sub(x86::rsp, 40); - if (!s_tsx_avx) - { - c.movups(x86::oword_ptr(x86::rsp, 0), x86::xmm6); - c.movups(x86::oword_ptr(x86::rsp, 16), x86::xmm7); - } + c.sub(x86::rsp, 40); + if (!s_tsx_avx) + { + c.movups(x86::oword_ptr(x86::rsp, 0), x86::xmm6); + c.movups(x86::oword_ptr(x86::rsp, 16), x86::xmm7); + } #endif - // Prepare registers - build_swap_rdx_with(c, args, x86::r10); - c.mov(x86::r11, x86::qword_ptr(reinterpret_cast(&vm::g_sudo_addr))); - c.lea(x86::r11, x86::qword_ptr(x86::r11, args[0])); - c.prefetchw(x86::byte_ptr(x86::r11, 0)); - c.prefetchw(x86::byte_ptr(x86::r11, 64)); + // Prepare registers + build_swap_rdx_with(c, args, x86::r10); + c.mov(x86::r11, x86::qword_ptr(reinterpret_cast(&vm::g_sudo_addr))); + c.lea(x86::r11, x86::qword_ptr(x86::r11, args[0])); + c.prefetchw(x86::byte_ptr(x86::r11, 0)); + c.prefetchw(x86::byte_ptr(x86::r11, 64)); - // Prepare data - if (s_tsx_avx) - { - c.vmovups(x86::ymm0, x86::ymmword_ptr(args[1], 0)); - c.vmovups(x86::ymm1, x86::ymmword_ptr(args[1], 32)); - c.vmovups(x86::ymm2, x86::ymmword_ptr(args[1], 64)); - c.vmovups(x86::ymm3, x86::ymmword_ptr(args[1], 96)); - } - else - { - c.movaps(x86::xmm0, x86::oword_ptr(args[1], 0)); - c.movaps(x86::xmm1, x86::oword_ptr(args[1], 16)); - c.movaps(x86::xmm2, x86::oword_ptr(args[1], 32)); - c.movaps(x86::xmm3, x86::oword_ptr(args[1], 48)); - c.movaps(x86::xmm4, x86::oword_ptr(args[1], 64)); - c.movaps(x86::xmm5, x86::oword_ptr(args[1], 80)); - c.movaps(x86::xmm6, x86::oword_ptr(args[1], 96)); - c.movaps(x86::xmm7, x86::oword_ptr(args[1], 112)); - } + // Prepare data + if (s_tsx_avx) + { + c.vmovups(x86::ymm0, x86::ymmword_ptr(args[1], 0)); + c.vmovups(x86::ymm1, x86::ymmword_ptr(args[1], 32)); + c.vmovups(x86::ymm2, x86::ymmword_ptr(args[1], 64)); + c.vmovups(x86::ymm3, x86::ymmword_ptr(args[1], 96)); + } + else + { + c.movaps(x86::xmm0, x86::oword_ptr(args[1], 0)); + c.movaps(x86::xmm1, x86::oword_ptr(args[1], 16)); + c.movaps(x86::xmm2, x86::oword_ptr(args[1], 32)); + c.movaps(x86::xmm3, x86::oword_ptr(args[1], 48)); + c.movaps(x86::xmm4, x86::oword_ptr(args[1], 64)); + c.movaps(x86::xmm5, x86::oword_ptr(args[1], 80)); + c.movaps(x86::xmm6, x86::oword_ptr(args[1], 96)); + c.movaps(x86::xmm7, x86::oword_ptr(args[1], 112)); + } - c.and_(args[0].r32(), 0xff80); - c.shr(args[0].r32(), 1); - c.lea(args[1], x86::qword_ptr(reinterpret_cast(+vm::g_reservations), args[0])); + c.and_(args[0].r32(), 0xff80); + c.shr(args[0].r32(), 1); + c.lea(args[1], x86::qword_ptr(reinterpret_cast(+vm::g_reservations), args[0])); - // Alloc args[0] to stamp0 - const auto stamp0 = args[0]; - build_get_tsc(c, stamp0); + // Alloc args[0] to stamp0 + const auto stamp0 = args[0]; + build_get_tsc(c, stamp0); - Label tx1 = build_transaction_enter(c, fall, [&]() - { - // ftx++; - c.add(x86::qword_ptr(args[3]), 1); + Label tx1 = build_transaction_enter(c, fall, [&]() + { + // ftx++; + c.add(x86::qword_ptr(args[3]), 1); + build_get_tsc(c); + c.sub(x86::rax, stamp0); + c.cmp(x86::rax, x86::qword_ptr(reinterpret_cast(&g_rtm_tx_limit2))); + c.jae(fall); + }); + + c.xbegin(tx1); + + if (s_tsx_avx) + { + c.vmovaps(x86::ymmword_ptr(x86::r11, 0), x86::ymm0); + c.vmovaps(x86::ymmword_ptr(x86::r11, 32), x86::ymm1); + c.vmovaps(x86::ymmword_ptr(x86::r11, 64), x86::ymm2); + c.vmovaps(x86::ymmword_ptr(x86::r11, 96), x86::ymm3); + } + else + { + c.movaps(x86::oword_ptr(x86::r11, 0), x86::xmm0); + c.movaps(x86::oword_ptr(x86::r11, 16), x86::xmm1); + c.movaps(x86::oword_ptr(x86::r11, 32), x86::xmm2); + c.movaps(x86::oword_ptr(x86::r11, 48), x86::xmm3); + c.movaps(x86::oword_ptr(x86::r11, 64), x86::xmm4); + c.movaps(x86::oword_ptr(x86::r11, 80), x86::xmm5); + c.movaps(x86::oword_ptr(x86::r11, 96), x86::xmm6); + c.movaps(x86::oword_ptr(x86::r11, 112), x86::xmm7); + } + + c.xend(); + c.lock().add(x86::qword_ptr(args[1]), 32); + // stx++ + c.add(x86::qword_ptr(args[2]), 1); build_get_tsc(c); c.sub(x86::rax, stamp0); - c.cmp(x86::rax, x86::qword_ptr(reinterpret_cast(&g_rtm_tx_limit2))); - c.jae(fall); - }); + c.jmp(_ret); - c.xbegin(tx1); + c.bind(fall); + c.xor_(x86::eax, x86::eax); + // c.jmp(_ret); - if (s_tsx_avx) - { - c.vmovaps(x86::ymmword_ptr(x86::r11, 0), x86::ymm0); - c.vmovaps(x86::ymmword_ptr(x86::r11, 32), x86::ymm1); - c.vmovaps(x86::ymmword_ptr(x86::r11, 64), x86::ymm2); - c.vmovaps(x86::ymmword_ptr(x86::r11, 96), x86::ymm3); - } - else - { - c.movaps(x86::oword_ptr(x86::r11, 0), x86::xmm0); - c.movaps(x86::oword_ptr(x86::r11, 16), x86::xmm1); - c.movaps(x86::oword_ptr(x86::r11, 32), x86::xmm2); - c.movaps(x86::oword_ptr(x86::r11, 48), x86::xmm3); - c.movaps(x86::oword_ptr(x86::r11, 64), x86::xmm4); - c.movaps(x86::oword_ptr(x86::r11, 80), x86::xmm5); - c.movaps(x86::oword_ptr(x86::r11, 96), x86::xmm6); - c.movaps(x86::oword_ptr(x86::r11, 112), x86::xmm7); - } - - c.xend(); - c.lock().add(x86::qword_ptr(args[1]), 32); - // stx++ - c.add(x86::qword_ptr(args[2]), 1); - build_get_tsc(c); - c.sub(x86::rax, stamp0); - c.jmp(_ret); - - c.bind(fall); - c.xor_(x86::eax, x86::eax); - //c.jmp(_ret); - - c.bind(_ret); + c.bind(_ret); #ifdef _WIN32 - if (!s_tsx_avx) - { - c.movups(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); - c.movups(x86::xmm7, x86::oword_ptr(x86::rsp, 16)); - } - c.add(x86::rsp, 40); + if (!s_tsx_avx) + { + c.movups(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); + c.movups(x86::xmm7, x86::oword_ptr(x86::rsp, 16)); + } + c.add(x86::rsp, 40); #endif - if (s_tsx_avx) - { - c.vzeroupper(); - } + if (s_tsx_avx) + { + c.vzeroupper(); + } - maybe_flush_lbr(c); - c.ret(); + maybe_flush_lbr(c); + c.ret(); #else - UNUSED(args); + UNUSED(args); - c.brk(Imm(0x42)); - c.ret(a64::x30); + c.brk(Imm(0x42)); + c.ret(a64::x30); #endif -}); + }); -const auto spu_getllar_tx = build_function_asm("spu_getllar_tx", [](native_asm& c, auto& args) -{ - using namespace asmjit; +const auto spu_getllar_tx = build_function_asm("spu_getllar_tx", [](native_asm& c, auto& args) + { + using namespace asmjit; #if defined(ARCH_X64) - Label fall = c.newLabel(); - Label _ret = c.newLabel(); + Label fall = c.newLabel(); + Label _ret = c.newLabel(); - //if (utils::has_avx() && !s_tsx_avx) - //{ - // c.vzeroupper(); - //} + // if (utils::has_avx() && !s_tsx_avx) + //{ + // c.vzeroupper(); + // } - // Create stack frame if necessary (Windows ABI has only 6 volatile vector registers) - c.push(x86::rbp); - c.push(x86::rbx); - c.sub(x86::rsp, 40); + // Create stack frame if necessary (Windows ABI has only 6 volatile vector registers) + c.push(x86::rbp); + c.push(x86::rbx); + c.sub(x86::rsp, 40); #ifdef _WIN32 - if (!s_tsx_avx) - { - c.movups(x86::oword_ptr(x86::rsp, 0), x86::xmm6); - c.movups(x86::oword_ptr(x86::rsp, 16), x86::xmm7); - } + if (!s_tsx_avx) + { + c.movups(x86::oword_ptr(x86::rsp, 0), x86::xmm6); + c.movups(x86::oword_ptr(x86::rsp, 16), x86::xmm7); + } #endif - // Prepare registers - build_swap_rdx_with(c, args, x86::r10); - c.mov(x86::rbp, x86::qword_ptr(reinterpret_cast(&vm::g_sudo_addr))); - c.lea(x86::rbp, x86::qword_ptr(x86::rbp, args[0])); - c.and_(args[0].r32(), 0xff80); - c.shr(args[0].r32(), 1); - c.lea(x86::r11, x86::qword_ptr(reinterpret_cast(+vm::g_reservations), args[0])); + // Prepare registers + build_swap_rdx_with(c, args, x86::r10); + c.mov(x86::rbp, x86::qword_ptr(reinterpret_cast(&vm::g_sudo_addr))); + c.lea(x86::rbp, x86::qword_ptr(x86::rbp, args[0])); + c.and_(args[0].r32(), 0xff80); + c.shr(args[0].r32(), 1); + c.lea(x86::r11, x86::qword_ptr(reinterpret_cast(+vm::g_reservations), args[0])); - // Alloc args[0] to stamp0 - const auto stamp0 = args[0]; - build_get_tsc(c, stamp0); + // Alloc args[0] to stamp0 + const auto stamp0 = args[0]; + build_get_tsc(c, stamp0); - // Begin transaction - Label tx0 = build_transaction_enter(c, fall, [&]() - { - c.add(x86::qword_ptr(args[2], ::offset32(&spu_thread::ftx)), 1); + // Begin transaction + Label tx0 = build_transaction_enter(c, fall, [&]() + { + c.add(x86::qword_ptr(args[2], ::offset32(&spu_thread::ftx)), 1); + build_get_tsc(c); + c.sub(x86::rax, stamp0); + c.cmp(x86::rax, x86::qword_ptr(reinterpret_cast(&g_rtm_tx_limit1))); + c.jae(fall); + }); + + // Check pause flag + c.bt(x86::dword_ptr(args[2], ::offset32(&cpu_thread::state)), static_cast(cpu_flag::pause)); + c.jc(fall); + c.mov(x86::rax, x86::qword_ptr(x86::r11)); + c.and_(x86::rax, -128); + c.cmp(x86::rax, args[3]); + c.jne(fall); + c.xbegin(tx0); + + // Just read data to registers + if (s_tsx_avx) + { + c.vmovups(x86::ymm0, x86::ymmword_ptr(x86::rbp, 0)); + c.vmovups(x86::ymm1, x86::ymmword_ptr(x86::rbp, 32)); + c.vmovups(x86::ymm2, x86::ymmword_ptr(x86::rbp, 64)); + c.vmovups(x86::ymm3, x86::ymmword_ptr(x86::rbp, 96)); + } + else + { + c.movaps(x86::xmm0, x86::oword_ptr(x86::rbp, 0)); + c.movaps(x86::xmm1, x86::oword_ptr(x86::rbp, 16)); + c.movaps(x86::xmm2, x86::oword_ptr(x86::rbp, 32)); + c.movaps(x86::xmm3, x86::oword_ptr(x86::rbp, 48)); + c.movaps(x86::xmm4, x86::oword_ptr(x86::rbp, 64)); + c.movaps(x86::xmm5, x86::oword_ptr(x86::rbp, 80)); + c.movaps(x86::xmm6, x86::oword_ptr(x86::rbp, 96)); + c.movaps(x86::xmm7, x86::oword_ptr(x86::rbp, 112)); + } + + c.xend(); + c.add(x86::qword_ptr(args[2], ::offset32(&spu_thread::stx)), 1); build_get_tsc(c); c.sub(x86::rax, stamp0); - c.cmp(x86::rax, x86::qword_ptr(reinterpret_cast(&g_rtm_tx_limit1))); - c.jae(fall); - }); - // Check pause flag - c.bt(x86::dword_ptr(args[2], ::offset32(&cpu_thread::state)), static_cast(cpu_flag::pause)); - c.jc(fall); - c.mov(x86::rax, x86::qword_ptr(x86::r11)); - c.and_(x86::rax, -128); - c.cmp(x86::rax, args[3]); - c.jne(fall); - c.xbegin(tx0); + // Store data + if (s_tsx_avx) + { + c.vmovaps(x86::ymmword_ptr(args[1], 0), x86::ymm0); + c.vmovaps(x86::ymmword_ptr(args[1], 32), x86::ymm1); + c.vmovaps(x86::ymmword_ptr(args[1], 64), x86::ymm2); + c.vmovaps(x86::ymmword_ptr(args[1], 96), x86::ymm3); + } + else + { + c.movaps(x86::oword_ptr(args[1], 0), x86::xmm0); + c.movaps(x86::oword_ptr(args[1], 16), x86::xmm1); + c.movaps(x86::oword_ptr(args[1], 32), x86::xmm2); + c.movaps(x86::oword_ptr(args[1], 48), x86::xmm3); + c.movaps(x86::oword_ptr(args[1], 64), x86::xmm4); + c.movaps(x86::oword_ptr(args[1], 80), x86::xmm5); + c.movaps(x86::oword_ptr(args[1], 96), x86::xmm6); + c.movaps(x86::oword_ptr(args[1], 112), x86::xmm7); + } - // Just read data to registers - if (s_tsx_avx) - { - c.vmovups(x86::ymm0, x86::ymmword_ptr(x86::rbp, 0)); - c.vmovups(x86::ymm1, x86::ymmword_ptr(x86::rbp, 32)); - c.vmovups(x86::ymm2, x86::ymmword_ptr(x86::rbp, 64)); - c.vmovups(x86::ymm3, x86::ymmword_ptr(x86::rbp, 96)); - } - else - { - c.movaps(x86::xmm0, x86::oword_ptr(x86::rbp, 0)); - c.movaps(x86::xmm1, x86::oword_ptr(x86::rbp, 16)); - c.movaps(x86::xmm2, x86::oword_ptr(x86::rbp, 32)); - c.movaps(x86::xmm3, x86::oword_ptr(x86::rbp, 48)); - c.movaps(x86::xmm4, x86::oword_ptr(x86::rbp, 64)); - c.movaps(x86::xmm5, x86::oword_ptr(x86::rbp, 80)); - c.movaps(x86::xmm6, x86::oword_ptr(x86::rbp, 96)); - c.movaps(x86::xmm7, x86::oword_ptr(x86::rbp, 112)); - } + c.jmp(_ret); + c.bind(fall); + c.xor_(x86::eax, x86::eax); + // c.jmp(_ret); - c.xend(); - c.add(x86::qword_ptr(args[2], ::offset32(&spu_thread::stx)), 1); - build_get_tsc(c); - c.sub(x86::rax, stamp0); - - // Store data - if (s_tsx_avx) - { - c.vmovaps(x86::ymmword_ptr(args[1], 0), x86::ymm0); - c.vmovaps(x86::ymmword_ptr(args[1], 32), x86::ymm1); - c.vmovaps(x86::ymmword_ptr(args[1], 64), x86::ymm2); - c.vmovaps(x86::ymmword_ptr(args[1], 96), x86::ymm3); - } - else - { - c.movaps(x86::oword_ptr(args[1], 0), x86::xmm0); - c.movaps(x86::oword_ptr(args[1], 16), x86::xmm1); - c.movaps(x86::oword_ptr(args[1], 32), x86::xmm2); - c.movaps(x86::oword_ptr(args[1], 48), x86::xmm3); - c.movaps(x86::oword_ptr(args[1], 64), x86::xmm4); - c.movaps(x86::oword_ptr(args[1], 80), x86::xmm5); - c.movaps(x86::oword_ptr(args[1], 96), x86::xmm6); - c.movaps(x86::oword_ptr(args[1], 112), x86::xmm7); - } - - c.jmp(_ret); - c.bind(fall); - c.xor_(x86::eax, x86::eax); - //c.jmp(_ret); - - c.bind(_ret); + c.bind(_ret); #ifdef _WIN32 - if (!s_tsx_avx) - { - c.movups(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); - c.movups(x86::xmm7, x86::oword_ptr(x86::rsp, 16)); - } + if (!s_tsx_avx) + { + c.movups(x86::xmm6, x86::oword_ptr(x86::rsp, 0)); + c.movups(x86::xmm7, x86::oword_ptr(x86::rsp, 16)); + } #endif - if (s_tsx_avx) - { - c.vzeroupper(); - } + if (s_tsx_avx) + { + c.vzeroupper(); + } - c.add(x86::rsp, 40); - c.pop(x86::rbx); - c.pop(x86::rbp); + c.add(x86::rsp, 40); + c.pop(x86::rbx); + c.pop(x86::rbp); - maybe_flush_lbr(c); - c.ret(); + maybe_flush_lbr(c); + c.ret(); #else - UNUSED(args); + UNUSED(args); - c.brk(Imm(0x42)); - c.ret(a64::x30); + c.brk(Imm(0x42)); + c.ret(a64::x30); #endif -}); + }); void spu_int_ctrl_t::set(u64 ints) { @@ -1225,9 +1220,7 @@ void spu_thread::dump_regs(std::string& ret, std::any& /*custom_data*/) const std::memcpy(rdata_saved, rdata, sizeof(rdata)); std::memcpy(lsa_saved, lsa_state_ptr, std::min(128, SPU_LS_SIZE - (lsa_state_ptr - _ptr(0)))); atomic_fence_acquire(); - } - while (saved_pc != pc || std::memcmp(rdata_saved, rdata, sizeof(rdata)) != 0 || std::memcmp(gpr_saved.data(), gpr.data(), sizeof(v128) * gpr.size()) != 0 - || std::memcmp(&mfc_regs_saved, &ch_mfc_cmd, sizeof(mfc_regs_saved)) != 0 || std::memcmp(lsa_saved, lsa_state_ptr, std::min(128, SPU_LS_SIZE - (lsa_state_ptr - _ptr(0)))) != 0); + } while (saved_pc != pc || std::memcmp(rdata_saved, rdata, sizeof(rdata)) != 0 || std::memcmp(gpr_saved.data(), gpr.data(), sizeof(v128) * gpr.size()) != 0 || std::memcmp(&mfc_regs_saved, &ch_mfc_cmd, sizeof(mfc_regs_saved)) != 0 || std::memcmp(lsa_saved, lsa_state_ptr, std::min(128, SPU_LS_SIZE - (lsa_state_ptr - _ptr(0)))) != 0); for (u32 i = 0; i < 128; i++, ret += '\n') { @@ -1251,7 +1244,8 @@ void spu_thread::dump_regs(std::string& ret, std::any& /*custom_data*/) const size == 1 ? "byte" : size == 2 ? "half" : size == 4 ? "word" : - size == 8 ? "dword" : "error"; + size == 8 ? "dword" : + "error"; if ((size >= 4u && !src) || (size == 2u && src == 1u) || (size == 1u && src == 3u)) { @@ -1325,13 +1319,16 @@ void spu_thread::dump_regs(std::string& ret, std::any& /*custom_data*/) const } } - if (i3 >= 0x80 && is_exec_code(i3, { ls, SPU_LS_SIZE })) + if (i3 >= 0x80 && is_exec_code(i3, {ls, SPU_LS_SIZE})) { dis_asm.disasm(i3); fmt::append(ret, " -> %s", dis_asm.last_opcode); } - if (std::any_of(std::begin(array), std::end(array), [](f64 v){ return v != 0; })) + if (std::any_of(std::begin(array), std::end(array), [](f64 v) + { + return v != 0; + })) { if (is_packed) { @@ -1398,16 +1395,14 @@ void spu_thread::dump_regs(std::string& ret, std::any& /*custom_data*/) const for (usz i = 0; i < std::size(rdata_saved); i += 4) { - fmt::append(ret, "[0x%02x] %08x %08x %08x %08x\n", i * sizeof(rdata_saved[0]) - , rdata_saved[i + 0], rdata_saved[i + 1], rdata_saved[i + 2], rdata_saved[i + 3]); + fmt::append(ret, "[0x%02x] %08x %08x %08x %08x\n", i * sizeof(rdata_saved[0]), rdata_saved[i + 0], rdata_saved[i + 1], rdata_saved[i + 2], rdata_saved[i + 3]); } fmt::append(ret, "\nLSA Data:\n"); for (usz i = 0; i < std::size(lsa_saved); i += 4) { - fmt::append(ret, "[0x%02x] %08x %08x %08x %08x\n", i * sizeof(lsa_saved[0]) - , lsa_saved[i + 0], lsa_saved[i + 1], lsa_saved[i + 2], lsa_saved[i + 3]); + fmt::append(ret, "[0x%02x] %08x %08x %08x %08x\n", i * sizeof(lsa_saved[0]), lsa_saved[i + 0], lsa_saved[i + 1], lsa_saved[i + 2], lsa_saved[i + 3]); } } @@ -1451,7 +1446,7 @@ std::vector> spu_thread::dump_callstack_list() const return true; } - return !addr || !is_exec_code(addr, { ls, SPU_LS_SIZE }); + return !addr || !is_exec_code(addr, {ls, SPU_LS_SIZE}); }; if (first && lr._u32[3] != gpr0._u32[3] && !is_invalid(gpr0)) @@ -1613,7 +1608,6 @@ std::string spu_thread::dump_misc() const ret += '\n'; } - fmt::append(ret, "\nWaiting: %fs", (get_system_time() - _time) / 1000000.); } else @@ -1739,18 +1733,19 @@ void spu_thread::cpu_return() if (get_type() >= spu_type::raw) { if (status_npc.fetch_op([this](status_npc_sync_var& state) - { - if (state.status & SPU_STATUS_RUNNING) - { - // Save next PC and current SPU Interrupt Status - // Used only by RunCtrl stop requests - state.status &= ~SPU_STATUS_RUNNING; - state.npc = pc | +interrupts_enabled; - return true; - } + { + if (state.status & SPU_STATUS_RUNNING) + { + // Save next PC and current SPU Interrupt Status + // Used only by RunCtrl stop requests + state.status &= ~SPU_STATUS_RUNNING; + state.npc = pc | +interrupts_enabled; + return true; + } - return false; - }).second) + return false; + }) + .second) { status_npc.notify_one(); } @@ -1777,8 +1772,7 @@ void spu_thread::cpu_return() if (thread && thread.get() != this && thread->status_npc.load().status >> 16 == SYS_SPU_THREAD_STOP_THREAD_EXIT) { // Wait for all threads to have error codes if exited by sys_spu_thread_exit - for (u32 status; !thread->exit_status.try_read(status) - || status != thread->last_exit_status;) + for (u32 status; !thread->exit_status.try_read(status) || status != thread->last_exit_status;) { utils::pause(); } @@ -1829,7 +1823,7 @@ void spu_thread::cpu_return() } } -extern thread_local std::string(*g_tls_log_prefix)(); +extern thread_local std::string (*g_tls_log_prefix)(); void spu_thread::cpu_task() { @@ -1859,12 +1853,12 @@ void spu_thread::cpu_task() if (!cpu->spu_tname.is_equal(name_cache)) [[unlikely]] { cpu->spu_tname.peek_op([&](const shared_ptr& ptr) - { - if (ptr != name_cache) { - name_cache = ptr; - } - }); + if (ptr != name_cache) + { + name_cache = ptr; + } + }); } const auto type = cpu->get_type(); @@ -2034,17 +2028,17 @@ void spu_thread::cpu_work() { // No more pending work state.atomic_op([](bs_t& flags) - { - if (flags & cpu_flag::pending_recheck) { - // Do not really remove ::pending because external thread may have pushed more pending work - flags -= cpu_flag::pending_recheck; - } - else - { - flags -= cpu_flag::pending; - } - }); + if (flags & cpu_flag::pending_recheck) + { + // Do not really remove ::pending because external thread may have pushed more pending work + flags -= cpu_flag::pending_recheck; + } + else + { + flags -= cpu_flag::pending; + } + }); } if (gen_interrupt) @@ -2060,7 +2054,7 @@ struct raw_spu_cleanup raw_spu_cleanup(const raw_spu_cleanup&) = delete; - raw_spu_cleanup& operator =(const raw_spu_cleanup&) = delete; + raw_spu_cleanup& operator=(const raw_spu_cleanup&) = delete; ~raw_spu_cleanup() { @@ -2108,15 +2102,9 @@ u8* spu_thread::map_ls(utils::shm& shm, void* ptr) } spu_thread::spu_thread(lv2_spu_group* group, u32 index, std::string_view name, u32 lv2_id, bool is_isolated, u32 option) - : cpu_thread(idm::last_id()) - , group(group) - , index(index) - , thread_type(group ? spu_type::threaded : is_isolated ? spu_type::isolated : spu_type::raw) - , shm(std::make_shared(SPU_LS_SIZE)) - , ls(static_cast(utils::memory_reserve(SPU_LS_SIZE * 5, nullptr, true)) + SPU_LS_SIZE * 2) - , option(option) - , lv2_id(lv2_id) - , spu_tname(make_single(name)) + : cpu_thread(idm::last_id()), group(group), index(index), thread_type(group ? spu_type::threaded : is_isolated ? spu_type::isolated : + spu_type::raw), + shm(std::make_shared(SPU_LS_SIZE)), ls(static_cast(utils::memory_reserve(SPU_LS_SIZE * 5, nullptr, true)) + SPU_LS_SIZE * 2), option(option), lv2_id(lv2_id), spu_tname(make_single(name)) { if (g_cfg.core.spu_decoder == spu_decoder_type::asmjit) { @@ -2160,10 +2148,7 @@ spu_thread::spu_thread(lv2_spu_group* group, u32 index, std::string_view name, u void spu_thread::serialize_common(utils::serial& ar) { - ar(gpr, pc, ch_mfc_cmd, mfc_size, mfc_barrier, mfc_fence, mfc_prxy_cmd, mfc_prxy_mask, mfc_prxy_write_state.all - , srr0, ch_tag_upd, ch_tag_mask, ch_tag_stat.data, ch_stall_mask, ch_stall_stat.data, ch_atomic_stat.data - , ch_out_mbox.data, ch_out_intr_mbox.data, snr_config, ch_snr1.data, ch_snr2.data, ch_events.raw().all, interrupts_enabled - , run_ctrl, exit_status.data, status_npc.raw().status, ch_dec_start_timestamp, ch_dec_value, is_dec_frozen); + ar(gpr, pc, ch_mfc_cmd, mfc_size, mfc_barrier, mfc_fence, mfc_prxy_cmd, mfc_prxy_mask, mfc_prxy_write_state.all, srr0, ch_tag_upd, ch_tag_mask, ch_tag_stat.data, ch_stall_mask, ch_stall_stat.data, ch_atomic_stat.data, ch_out_mbox.data, ch_out_intr_mbox.data, snr_config, ch_snr1.data, ch_snr2.data, ch_events.raw().all, interrupts_enabled, run_ctrl, exit_status.data, status_npc.raw().status, ch_dec_start_timestamp, ch_dec_value, is_dec_frozen); ar(std::span(mfc_queue, mfc_size)); @@ -2183,15 +2168,9 @@ void spu_thread::serialize_common(utils::serial& ar) } spu_thread::spu_thread(utils::serial& ar, lv2_spu_group* group) - : cpu_thread(idm::last_id()) - , group(group) - , index(ar) - , thread_type(group ? spu_type::threaded : ar.pop() ? spu_type::isolated : spu_type::raw) - , shm(ensure(vm::get(vm::spu)->peek(vm_offset()).second)) - , ls(map_ls(*this->shm)) - , option(ar) - , lv2_id(ar) - , spu_tname(make_single(ar.operator std::string())) + : cpu_thread(idm::last_id()), group(group), index(ar), thread_type(group ? spu_type::threaded : ar.pop() ? spu_type::isolated : + spu_type::raw), + shm(ensure(vm::get(vm::spu)->peek(vm_offset()).second)), ls(map_ls(*this->shm)), option(ar), lv2_id(ar), spu_tname(make_single(ar.operator std::string())) { if (g_cfg.core.spu_decoder == spu_decoder_type::asmjit) { @@ -2335,41 +2314,41 @@ void spu_thread::push_snr(u32 number, u32 value) bool thread_notify = false; const bool ok = utils::tx_start([&] - { - channel_notify = (channel->data.raw() == spu_channel::bit_wait); - thread_notify = (channel->data.raw() & spu_channel::bit_count) == 0; + { + channel_notify = (channel->data.raw() == spu_channel::bit_wait); + thread_notify = (channel->data.raw() & spu_channel::bit_count) == 0; - if (channel_notify) - { - ensure(channel->jostling_value.raw() == spu_channel::bit_wait); - channel->jostling_value.raw() = value; - channel->data.raw() = 0; - } - else if (bitor_bit) - { - channel->data.raw() &= ~spu_channel::bit_wait; - channel->data.raw() |= spu_channel::bit_count | value; - } - else - { - channel->data.raw() = spu_channel::bit_count | value; - } - - if (thread_notify) - { - ch_events.raw().events |= event_bit; - - if (ch_events.raw().mask & event_bit) + if (channel_notify) { - ch_events.raw().count = 1; - thread_notify = ch_events.raw().waiting != 0; + ensure(channel->jostling_value.raw() == spu_channel::bit_wait); + channel->jostling_value.raw() = value; + channel->data.raw() = 0; + } + else if (bitor_bit) + { + channel->data.raw() &= ~spu_channel::bit_wait; + channel->data.raw() |= spu_channel::bit_count | value; } else { - thread_notify = false; + channel->data.raw() = spu_channel::bit_count | value; } - } - }); + + if (thread_notify) + { + ch_events.raw().events |= event_bit; + + if (ch_events.raw().mask & event_bit) + { + ch_events.raw().count = 1; + thread_notify = ch_events.raw().waiting != 0; + } + else + { + thread_notify = false; + } + } + }); if (ok) { @@ -2384,9 +2363,9 @@ void spu_thread::push_snr(u32 number, u32 value) // Lock event channel in case it needs event notification ch_events.atomic_op([](ch_events_t& ev) - { - ev.locks++; - }); + { + ev.locks++; + }); // Check corresponding SNR register settings auto push_state = channel->push(value, bitor_bit); @@ -2406,9 +2385,9 @@ void spu_thread::push_snr(u32 number, u32 value) } ch_events.atomic_op([](ch_events_t& ev) - { - ev.locks--; - }); + { + ev.locks--; + }); } void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* ls) @@ -2445,7 +2424,7 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* // TODO } - const u32 index = (eal - SYS_SPU_THREAD_BASE_LOW) / SYS_SPU_THREAD_OFFSET; // thread number in group + const u32 index = (eal - SYS_SPU_THREAD_BASE_LOW) / SYS_SPU_THREAD_OFFSET; // thread number in group const u32 offset = (eal - SYS_SPU_THREAD_BASE_LOW) % SYS_SPU_THREAD_OFFSET; // LS offset or MMIO register if (eal < SYS_SPU_THREAD_BASE_LOW) @@ -2465,7 +2444,7 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* _this->_ref(lsa) = value; return; } - else if (args.size == 4 && !is_get && thread->write_reg(eal, args.cmd != MFC_SDCRZ_CMD ? + _this->_ref(lsa) : 0)) + else if (args.size == 4 && !is_get && thread->write_reg(eal, args.cmd != MFC_SDCRZ_CMD ? +_this->_ref(lsa) : 0)) { return; } @@ -2522,7 +2501,7 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* rsx::reservation_lock rsx_lock(eal, args.size, !is_get && (g_cfg.video.strict_rendering_mode || (g_cfg.core.rsx_fifo_accuracy && !g_cfg.core.spu_accurate_dma && eal < rsx::constants::local_mem_base))); - if ((!g_use_rtm && !is_get) || g_cfg.core.spu_accurate_dma) [[unlikely]] + if ((!g_use_rtm && !is_get) || g_cfg.core.spu_accurate_dma) [[unlikely]] { perf_meter<"ADMA_GET"_u64> perf_get = perf_; perf_meter<"ADMA_PUT"_u64> perf_put = perf_; @@ -2555,22 +2534,22 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* size0 = std::min(128 - (eal & 127), std::min(size, 128)); for (u64 i = 0;; [&]() - { - if (_cpu->state) { - _cpu->check_state(); - } - else if (++i < 25) [[likely]] - { - busy_wait(300); - } - else - { - _cpu->state += cpu_flag::wait + cpu_flag::temp; - std::this_thread::yield(); - _cpu->check_state(); - } - }()) + if (_cpu->state) + { + _cpu->check_state(); + } + else if (++i < 25) [[likely]] + { + busy_wait(300); + } + else + { + _cpu->state += cpu_flag::wait + cpu_flag::temp; + std::this_thread::yield(); + _cpu->check_state(); + } + }()) { const u64 time0 = vm::reservation_acquire(eal); @@ -2700,43 +2679,43 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* // Get writing mask const u128 wmask = (~u128{} << (eal & 127)) & (~u128{} >> (127 - ((eal + size0 - 1) & 127))); - //const u64 start = (eal & 127) / 2; - //const u64 _end_ = ((eal + size0 - 1) & 127) / 2; - //const u64 wmask = (UINT64_MAX << start) & (UINT64_MAX >> (63 - _end_)); + // const u64 start = (eal & 127) / 2; + // const u64 _end_ = ((eal + size0 - 1) & 127) / 2; + // const u64 wmask = (UINT64_MAX << start) & (UINT64_MAX >> (63 - _end_)); u128 old = 0; for (u64 i = 0; i != umax; [&]() - { - if (_cpu->state & cpu_flag::pause) { - const bool ok = cpu_thread::if_suspended<0>(_cpu, {dst, dst + 64, &res}, [&] + if (_cpu->state & cpu_flag::pause) { - std::memcpy(dst, src, size0); - res += 128; - }); + const bool ok = cpu_thread::if_suspended<0>(_cpu, {dst, dst + 64, &res}, [&] + { + std::memcpy(dst, src, size0); + res += 128; + }); - if (ok) - { - // Exit loop and function - i = -1; - bits = nullptr; - return; + if (ok) + { + // Exit loop and function + i = -1; + bits = nullptr; + return; + } } - } - if (true || ++i < 10) - { - busy_wait(500); - } - else - { - // Wait - _cpu->state += cpu_flag::wait + cpu_flag::temp; - // bits->wait(old, wmask); - _cpu->check_state(); - } - }()) + if (true || ++i < 10) + { + busy_wait(500); + } + else + { + // Wait + _cpu->state += cpu_flag::wait + cpu_flag::temp; + // bits->wait(old, wmask); + _cpu->check_state(); + } + }()) { // Completed in suspend_all() if (!bits) @@ -2747,15 +2726,15 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* bool ok = false; std::tie(old, ok) = bits->fetch_op([&](u128& v) - { - if (v & wmask) { - return false; - } + if (v & wmask) + { + return false; + } - v |= wmask; - return true; - }); + v |= wmask; + return true; + }); if (ok) [[likely]] { @@ -2775,15 +2754,15 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* // Lock reservation (shared) auto [_oldd, _ok] = res.fetch_op([&](u64& r) - { - if (r & vm::rsrv_unique_lock) { - return false; - } + if (r & vm::rsrv_unique_lock) + { + return false; + } - r += 1; - return true; - }); + r += 1; + return true; + }); if (!_ok) { @@ -2845,9 +2824,9 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* // Release bits and notify bits->atomic_op([&](u128& v) - { - v &= ~wmask; - }); + { + v &= ~wmask; + }); // bits->notify_all(wmask); @@ -2857,7 +2836,7 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* } } - //atomic_fence_seq_cst(); + // atomic_fence_seq_cst(); if (g_cfg.core.mfc_debug && _this) { @@ -3220,9 +3199,9 @@ bool spu_thread::do_list_transfer(spu_mfc_cmd& args) static_assert(sizeof(v128) % sizeof(list_element) == 0); spu_mfc_cmd transfer; - transfer.eah = 0; - transfer.tag = args.tag; - transfer.cmd = MFC{static_cast(args.cmd & ~0xf)}; + transfer.eah = 0; + transfer.tag = args.tag; + transfer.cmd = MFC{static_cast(args.cmd & ~0xf)}; u32 index = fetch_size; @@ -3287,7 +3266,12 @@ bool spu_thread::do_list_transfer(spu_mfc_cmd& args) constexpr usz _128 = 128; // This whole function relies on many constraints to be met (crashes real MFC), we can a have minor optimization assuming EA alignment to be +16 with +16 byte transfers -#define MOV_T(type, index, _ea) { const usz ea = _ea; *reinterpret_cast(dst + index * utils::align(sizeof(type), 16) + ea % (sizeof(type) < 16 ? 16 : 1)) = *reinterpret_cast(src + ea); } void() +#define MOV_T(type, index, _ea) \ + { \ + const usz ea = _ea; \ + *reinterpret_cast(dst + index * utils::align(sizeof(type), 16) + ea % (sizeof(type) < 16 ? 16 : 1)) = *reinterpret_cast(src + ea); \ + } \ + void() #define MOV_128(index, ea) mov_rdata(*reinterpret_cast(dst + index * _128), *reinterpret_cast(src + (ea))) switch (s_size) @@ -3492,18 +3476,18 @@ bool spu_thread::do_list_transfer(spu_mfc_cmd& args) case 512: { const usz ea0 = items[0].ea; - MOV_128(0 , ea0 + _128 * 0); - MOV_128(1 , ea0 + _128 * 1); - MOV_128(2 , ea0 + _128 * 2); - MOV_128(3 , ea0 + _128 * 3); + MOV_128(0, ea0 + _128 * 0); + MOV_128(1, ea0 + _128 * 1); + MOV_128(2, ea0 + _128 * 2); + MOV_128(3, ea0 + _128 * 3); const usz ea1 = items[1].ea; - MOV_128(4 , ea1 + _128 * 0); - MOV_128(5 , ea1 + _128 * 1); - MOV_128(6 , ea1 + _128 * 2); - MOV_128(7 , ea1 + _128 * 3); + MOV_128(4, ea1 + _128 * 0); + MOV_128(5, ea1 + _128 * 1); + MOV_128(6, ea1 + _128 * 2); + MOV_128(7, ea1 + _128 * 3); const usz ea2 = items[2].ea; - MOV_128(8 , ea2 + _128 * 0); - MOV_128(9 , ea2 + _128 * 1); + MOV_128(8, ea2 + _128 * 0); + MOV_128(9, ea2 + _128 * 1); MOV_128(10, ea2 + _128 * 2); MOV_128(11, ea2 + _128 * 3); const usz ea3 = items[3].ea; @@ -3715,8 +3699,8 @@ bool spu_thread::do_list_transfer(spu_mfc_cmd& args) spu_log.trace("LIST: item=0x%016x, lsa=0x%05x", std::bit_cast>(items[index]), arg_lsa | (addr & 0xf)); - transfer.eal = addr; - transfer.lsa = arg_lsa | (addr & 0xf); + transfer.eal = addr; + transfer.lsa = arg_lsa | (addr & 0xf); transfer.size = size; arg_lsa += utils::align(size, 16); @@ -3769,180 +3753,180 @@ bool spu_thread::do_putllc(const spu_mfc_cmd& args) const u32 addr = args.eal & -128; if ([&]() - { - perf_meter<"PUTLLC."_u64> perf2 = perf0; - - if (raddr != addr) { - return false; - } + perf_meter<"PUTLLC."_u64> perf2 = perf0; - const auto& to_write = _ref(args.lsa & 0x3ff80); - auto& res = vm::reservation_acquire(addr); - - // TODO: Limit scope!! - rsx::reservation_lock rsx_lock(addr, 128); - - if (rtime != res) - { - if (!g_cfg.core.spu_accurate_reservations && cmp_rdata(to_write, rdata)) - { - raddr = 0; - return true; - } - - return false; - } - - if (cmp_rdata(to_write, rdata)) - { - if (!g_cfg.core.spu_accurate_reservations) - { - raddr = 0; - return true; - } - - // Writeback of unchanged data. Only check memory change - if (cmp_rdata(rdata, vm::_ref(addr)) && res.compare_and_swap_test(rtime, rtime + 128)) - { - raddr = 0; // Disable notification - return true; - } - - return false; - } - - auto [_oldd, _ok] = res.fetch_op([&](u64& r) - { - if ((r & -128) != rtime || (r & 127)) + if (raddr != addr) { return false; } - r += vm::rsrv_unique_lock; - return true; - }); + const auto& to_write = _ref(args.lsa & 0x3ff80); + auto& res = vm::reservation_acquire(addr); - if (!_ok) - { - // Already locked or updated: give up - return false; - } + // TODO: Limit scope!! + rsx::reservation_lock rsx_lock(addr, 128); - if (!g_cfg.core.spu_accurate_reservations) - { - if (addr - spurs_addr <= 0x80) + if (rtime != res) { - mov_rdata(vm::_ref(addr), to_write); - res += 64; - return true; - } - } - else if (!g_use_rtm) - { - vm::_ref>(addr) += 0; - } - - if (g_use_rtm) [[likely]] - { - switch (u64 count = spu_putllc_tx(addr, rtime, rdata, to_write)) - { - case umax: - { - auto& data = *vm::get_super_ptr(addr); - - const bool ok = cpu_thread::suspend_all<+3>(this, {data, data + 64, &res}, [&]() + if (!g_cfg.core.spu_accurate_reservations && cmp_rdata(to_write, rdata)) { - if ((res & -128) == rtime) + raddr = 0; + return true; + } + + return false; + } + + if (cmp_rdata(to_write, rdata)) + { + if (!g_cfg.core.spu_accurate_reservations) + { + raddr = 0; + return true; + } + + // Writeback of unchanged data. Only check memory change + if (cmp_rdata(rdata, vm::_ref(addr)) && res.compare_and_swap_test(rtime, rtime + 128)) + { + raddr = 0; // Disable notification + return true; + } + + return false; + } + + auto [_oldd, _ok] = res.fetch_op([&](u64& r) + { + if ((r & -128) != rtime || (r & 127)) { - if (cmp_rdata(rdata, data)) - { - mov_rdata(data, to_write); - res += 64; - return true; - } + return false; } - // Save previous data - mov_rdata_nt(rdata, data); - res -= 64; - return false; + r += vm::rsrv_unique_lock; + return true; }); - const u64 count2 = utils::get_tsc() - perf2.get(); - - if (count2 > 20000 && g_cfg.core.perf_report) [[unlikely]] - { - perf_log.warning("PUTLLC: took too long: %.3fus (%u c) (addr=0x%x) (S)", count2 / (utils::get_tsc_freq() / 1000'000.), count2, addr); - } - - if (ok) - { - break; - } - - last_ftime = -1; - [[fallthrough]]; - } - case 0: + if (!_ok) { - if (addr == last_faddr) - { - last_fail++; - } - - if (last_ftime != umax) - { - last_faddr = 0; - return false; - } - - utils::prefetch_read(rdata); - utils::prefetch_read(rdata + 64); - last_faddr = addr; - last_ftime = res.load() & -128; - last_ftsc = utils::get_tsc(); + // Already locked or updated: give up return false; } - default: + + if (!g_cfg.core.spu_accurate_reservations) { - if (count > 20000 && g_cfg.core.perf_report) [[unlikely]] + if (addr - spurs_addr <= 0x80) { - perf_log.warning("PUTLLC: took too long: %.3fus (%u c) (addr = 0x%x)", count / (utils::get_tsc_freq() / 1000'000.), count, addr); + mov_rdata(vm::_ref(addr), to_write); + res += 64; + return true; + } + } + else if (!g_use_rtm) + { + vm::_ref>(addr) += 0; + } + + if (g_use_rtm) [[likely]] + { + switch (u64 count = spu_putllc_tx(addr, rtime, rdata, to_write)) + { + case umax: + { + auto& data = *vm::get_super_ptr(addr); + + const bool ok = cpu_thread::suspend_all<+3>(this, {data, data + 64, &res}, [&]() + { + if ((res & -128) == rtime) + { + if (cmp_rdata(rdata, data)) + { + mov_rdata(data, to_write); + res += 64; + return true; + } + } + + // Save previous data + mov_rdata_nt(rdata, data); + res -= 64; + return false; + }); + + const u64 count2 = utils::get_tsc() - perf2.get(); + + if (count2 > 20000 && g_cfg.core.perf_report) [[unlikely]] + { + perf_log.warning("PUTLLC: took too long: %.3fus (%u c) (addr=0x%x) (S)", count2 / (utils::get_tsc_freq() / 1000'000.), count2, addr); + } + + if (ok) + { + break; + } + + last_ftime = -1; + [[fallthrough]]; + } + case 0: + { + if (addr == last_faddr) + { + last_fail++; + } + + if (last_ftime != umax) + { + last_faddr = 0; + return false; + } + + utils::prefetch_read(rdata); + utils::prefetch_read(rdata + 64); + last_faddr = addr; + last_ftime = res.load() & -128; + last_ftsc = utils::get_tsc(); + return false; + } + default: + { + if (count > 20000 && g_cfg.core.perf_report) [[unlikely]] + { + perf_log.warning("PUTLLC: took too long: %.3fus (%u c) (addr = 0x%x)", count / (utils::get_tsc_freq() / 1000'000.), count, addr); + } + + break; + } } - break; - } - } + if (addr == last_faddr) + { + last_succ++; + } - if (addr == last_faddr) - { - last_succ++; - } - - last_faddr = 0; - return true; - } - - auto& super_data = *vm::get_super_ptr(addr); - const bool success = [&]() - { - // Full lock (heavyweight) - // TODO: vm::check_addr - vm::writer_lock lock(addr, range_lock); - - if (cmp_rdata(rdata, super_data)) - { - mov_rdata(super_data, to_write); + last_faddr = 0; return true; } - return false; - }(); + auto& super_data = *vm::get_super_ptr(addr); + const bool success = [&]() + { + // Full lock (heavyweight) + // TODO: vm::check_addr + vm::writer_lock lock(addr, range_lock); - res += success ? 64 : 0 - 64; - return success; - }()) + if (cmp_rdata(rdata, super_data)) + { + mov_rdata(super_data, to_write); + return true; + } + + return false; + }(); + + res += success ? 64 : 0 - 64; + return success; + }()) { if (raddr) { @@ -4019,17 +4003,17 @@ void do_cell_atomic_128_store(u32 addr, const void* to_write) for (u64 j = 0;; j++) { auto [_oldd, _ok] = res.fetch_op([&](u128& r) - { - if (r & 127) { - return false; - } + if (r & 127) + { + return false; + } - r &= static_cast(r); - r |= u128{shared_mem} << 64; - r |= u128{vm::rsrv_unique_lock | vm::rsrv_putunc_flag}; - return true; - }); + r &= static_cast(r); + r |= u128{shared_mem} << 64; + r |= u128{vm::rsrv_unique_lock | vm::rsrv_putunc_flag}; + return true; + }); if (_ok) { @@ -4113,9 +4097,9 @@ void do_cell_atomic_128_store(u32 addr, const void* to_write) if (result == 0) { cpu_thread::suspend_all<+2>(cpu, {}, [&] - { - mov_rdata(sdata, *static_cast(to_write)); - }); + { + mov_rdata(sdata, *static_cast(to_write)); + }); vm::reservation_acquire(addr) += 32; result = utils::get_tsc() - perf0.get(); @@ -4445,7 +4429,7 @@ bool spu_thread::is_exec_code(u32 addr, std::span ls_ptr, u32 base_add // Detect "invalid" relative branches // Branch offsets that, although are the only way to get X code address using relative address // Rely on overflow/underflow of SPU memory bounds - // Thus they would behave differently if SPU LS memory size was to increase (evolving the CELL architecture was the original plan) + // Thus they would behave differently if SPU LS memory size was to increase (evolving the CELL architecture was the original plan) // Making them highly unlikely to be valid code if (rel < 0) @@ -4620,94 +4604,94 @@ bool spu_thread::process_mfc_cmd() } if ([&]() -> bool - { - // Validation that it is indeed GETLLAR spinning (large time window is intentional) - if (last_getllar_addr != addr || last_getllar_gpr1 != gpr[1]._u32[3] || perf0.get() - last_gtsc >= 5'000 || (interrupts_enabled && ch_events.load().mask)) { - // Seemingly not - getllar_busy_waiting_switch = umax; - getllar_spin_count = 0; - return true; - } - - getllar_spin_count = std::min(getllar_spin_count + 1, u16{umax}); - - static atomic_t g_ok = 0, g_fail = 0; - - if (getllar_busy_waiting_switch == umax && getllar_spin_count == 4) - { - // Hidden value to force busy waiting (100 to 1 are dynamically adjusted, 0 is not) - if (!g_cfg.core.spu_getllar_spin_optimization_disabled) + // Validation that it is indeed GETLLAR spinning (large time window is intentional) + if (last_getllar_addr != addr || last_getllar_gpr1 != gpr[1]._u32[3] || perf0.get() - last_gtsc >= 5'000 || (interrupts_enabled && ch_events.load().mask)) { - const u32 percent = g_cfg.core.spu_getllar_busy_waiting_percentage; + // Seemingly not + getllar_busy_waiting_switch = umax; + getllar_spin_count = 0; + return true; + } - // Predict whether or not to use operating system sleep based on history - auto& stats = getllar_wait_time[(addr % SPU_LS_SIZE) / 128]; + getllar_spin_count = std::min(getllar_spin_count + 1, u16{umax}); - const std::array old_stats = stats; - std::array new_stats{}; + static atomic_t g_ok = 0, g_fail = 0; - // Rotate history (prepare newest entry) - new_stats[0] = 0; - new_stats[1] = old_stats[0]; - new_stats[2] = old_stats[1]; - new_stats[3] = old_stats[2]; - - stats = new_stats; - - u32 total_wait = 0; - u32 zero_count = 0; // Try to ignore major inconsistencies - - for (u8 val : old_stats) + if (getllar_busy_waiting_switch == umax && getllar_spin_count == 4) + { + // Hidden value to force busy waiting (100 to 1 are dynamically adjusted, 0 is not) + if (!g_cfg.core.spu_getllar_spin_optimization_disabled) { - total_wait += val; - if (val == 0) ++zero_count; - } + const u32 percent = g_cfg.core.spu_getllar_busy_waiting_percentage; - // Add to chance if previous wait was long enough - const u32 add_count = zero_count == 3 && total_wait >= 40 ? (total_wait - 39) * 40 - : zero_count == 2 && total_wait >= 11 ? (total_wait - 10) * 40 - : zero_count == 1 && total_wait >= 8 ? (total_wait - 7) * 40 - : zero_count == 0 && total_wait >= 6 ? (total_wait - 5) * 40 - : 0; + // Predict whether or not to use operating system sleep based on history + auto& stats = getllar_wait_time[(addr % SPU_LS_SIZE) / 128]; - // Evalute its value (shift-right to ensure its randomness with different CPUs) - getllar_busy_waiting_switch = ((perf0.get() >> 8) % 100 + add_count < percent) ? 1 : 0; + const std::array old_stats = stats; + std::array new_stats{}; - getllar_evaluate_time = perf0.get(); + // Rotate history (prepare newest entry) + new_stats[0] = 0; + new_stats[1] = old_stats[0]; + new_stats[2] = old_stats[1]; + new_stats[3] = old_stats[2]; - if (getllar_busy_waiting_switch) - { - g_fail++; + stats = new_stats; + + u32 total_wait = 0; + u32 zero_count = 0; // Try to ignore major inconsistencies + + for (u8 val : old_stats) + { + total_wait += val; + if (val == 0) + ++zero_count; + } + + // Add to chance if previous wait was long enough + const u32 add_count = zero_count == 3 && total_wait >= 40 ? (total_wait - 39) * 40 : zero_count == 2 && total_wait >= 11 ? (total_wait - 10) * 40 : + zero_count == 1 && total_wait >= 8 ? (total_wait - 7) * 40 : + zero_count == 0 && total_wait >= 6 ? (total_wait - 5) * 40 : + 0; + + // Evalute its value (shift-right to ensure its randomness with different CPUs) + getllar_busy_waiting_switch = ((perf0.get() >> 8) % 100 + add_count < percent) ? 1 : 0; + + getllar_evaluate_time = perf0.get(); + + if (getllar_busy_waiting_switch) + { + g_fail++; + } + else + { + g_ok++; + } + + if ((g_ok + g_fail) % 200 == 0 && !getllar_busy_waiting_switch) + spu_log.trace("SPU wait: count=%d. switch=%d, spin=%d, fail=%d, ok=%d, {%d, %d, %d, %d}", total_wait, getllar_busy_waiting_switch, getllar_spin_count, +g_fail, +g_ok, old_stats[0], old_stats[1], old_stats[2], old_stats[3]); } else { - g_ok++; + getllar_busy_waiting_switch = 1; } - - if ((g_ok + g_fail) % 200 == 0 && !getllar_busy_waiting_switch) - spu_log.trace("SPU wait: count=%d. switch=%d, spin=%d, fail=%d, ok=%d, {%d, %d, %d, %d}", total_wait, getllar_busy_waiting_switch, getllar_spin_count, +g_fail, +g_ok, old_stats[0], old_stats[1], old_stats[2], old_stats[3] ); } - else + // Don't be stubborn, force operating sleep if too much time has passed + else if (getllar_busy_waiting_switch == 1 && perf0.get() > getllar_evaluate_time && perf0.get() - getllar_evaluate_time >= 400'000) { - getllar_busy_waiting_switch = 1; + // Hidden value to force busy waiting + if (!g_cfg.core.spu_getllar_spin_optimization_disabled) + { + spu_log.trace("SPU wait for 0x%x", addr); + getllar_wait_time[(addr % SPU_LS_SIZE) / 128].front() = 1; + getllar_busy_waiting_switch = 0; + } } - } - // Don't be stubborn, force operating sleep if too much time has passed - else if (getllar_busy_waiting_switch == 1 && perf0.get() > getllar_evaluate_time && perf0.get() - getllar_evaluate_time >= 400'000) - { - // Hidden value to force busy waiting - if (!g_cfg.core.spu_getllar_spin_optimization_disabled) - { - spu_log.trace("SPU wait for 0x%x", addr); - getllar_wait_time[(addr % SPU_LS_SIZE) / 128].front() = 1; - getllar_busy_waiting_switch = 0; - } - } - // Either 1 or umax - return getllar_busy_waiting_switch != 0; - }()) + // Either 1 or umax + return getllar_busy_waiting_switch != 0; + }()) { if (g_cfg.core.mfc_debug) { @@ -4867,39 +4851,39 @@ bool spu_thread::process_mfc_cmd() rsx::reservation_lock rsx_lock(addr, 128); for (u64 i = 0; i != umax; [&]() - { - if (state & cpu_flag::pause) { - auto& sdata = *vm::get_super_ptr(addr); - - const bool ok = cpu_thread::if_suspended<0>(this, {&ntime}, [&] + if (state & cpu_flag::pause) { - // Guaranteed success - ntime = vm::reservation_acquire(addr); - mov_rdata_nt(rdata, sdata); - }); + auto& sdata = *vm::get_super_ptr(addr); - // Exit loop - if (ok && (ntime & 127) == 0) - { - atomic_fence_seq_cst(); - i = -1; - return; + const bool ok = cpu_thread::if_suspended<0>(this, {&ntime}, [&] + { + // Guaranteed success + ntime = vm::reservation_acquire(addr); + mov_rdata_nt(rdata, sdata); + }); + + // Exit loop + if (ok && (ntime & 127) == 0) + { + atomic_fence_seq_cst(); + i = -1; + return; + } } - } - if (i < 24) [[likely]] - { - i++; - busy_wait(300); - } - else - { - state += cpu_flag::wait + cpu_flag::temp; - std::this_thread::yield(); - static_cast(check_state()); - } - }()) + if (i < 24) [[likely]] + { + i++; + busy_wait(300); + } + else + { + state += cpu_flag::wait + cpu_flag::temp; + std::this_thread::yield(); + static_cast(check_state()); + } + }()) { ntime = vm::reservation_acquire(addr); @@ -4928,7 +4912,8 @@ bool spu_thread::process_mfc_cmd() if (u64 time0 = vm::reservation_acquire(addr); (ntime & test_mask) != (time0 & test_mask)) { // Reservation data has been modified recently - if (time0 & vm::rsrv_unique_lock) i += 12; + if (time0 & vm::rsrv_unique_lock) + i += 12; continue; } @@ -4981,16 +4966,16 @@ bool spu_thread::process_mfc_cmd() u32 max_run = group->max_run; auto [prev_running, ok] = spurs_entered_wait ? std::make_pair(+group->spurs_running, false) : - group->spurs_running.fetch_op([max_run, num = group->max_num](u32& x) - { - if (x >= max_run && max_run < num) - { - x--; - return true; - } + group->spurs_running.fetch_op([max_run, num = group->max_num](u32& x) + { + if (x >= max_run && max_run < num) + { + x--; + return true; + } - return false; - }); + return false; + }); if (ok || spurs_entered_wait) { @@ -5004,7 +4989,7 @@ bool spu_thread::process_mfc_cmd() if (group->spurs_running == max_run - 1) { - // Try to let another thread slip in and take over execution + // Try to let another thread slip in and take over execution thread_ctrl::wait_for(300); // Update value @@ -5029,7 +5014,7 @@ bool spu_thread::process_mfc_cmd() if (spurs_last_task_timestamp) { const u64 avg_entry = spurs_average_task_duration / spurs_task_count_to_calculate; - spurs_average_task_duration -= avg_entry; + spurs_average_task_duration -= avg_entry; spurs_average_task_duration += std::min(45'000, current - spurs_last_task_timestamp); spu_log.trace("duration: %d, avg=%d", current - spurs_last_task_timestamp, spurs_average_task_duration / spurs_task_count_to_calculate); spurs_last_task_timestamp = 0; @@ -5050,17 +5035,18 @@ bool spu_thread::process_mfc_cmd() } max_run = group->max_run; - - prev_running = group->spurs_running.fetch_op([max_run](u32& x) - { - if (x < max_run) - { - x++; - return true; - } - return false; - }).first; + prev_running = group->spurs_running.fetch_op([max_run](u32& x) + { + if (x < max_run) + { + x++; + return true; + } + + return false; + }) + .first; if (prev_running < max_run) { @@ -5087,15 +5073,16 @@ bool spu_thread::process_mfc_cmd() if (!was_idle && is_idle) { const u32 prev_running = group->spurs_running.fetch_op([](u32& x) - { - if (x) - { - x--; - return true; - } + { + if (x) + { + x--; + return true; + } - return false; - }).first; + return false; + }) + .first; if (prev_running) { @@ -5115,7 +5102,7 @@ bool spu_thread::process_mfc_cmd() if (spurs_last_task_timestamp) { const u64 avg_entry = spurs_average_task_duration / spurs_task_count_to_calculate; - spurs_average_task_duration -= avg_entry; + spurs_average_task_duration -= avg_entry; spurs_average_task_duration += std::min(45'000, current - spurs_last_task_timestamp); spu_log.trace("duration: %d, avg=%d", current - spurs_last_task_timestamp, spurs_average_task_duration / spurs_task_count_to_calculate); spurs_last_task_timestamp = 0; @@ -5254,14 +5241,14 @@ bool spu_thread::process_mfc_cmd() auto& cmd = mfc_queue[mfc_size]; cmd = ch_mfc_cmd; - //if (g_cfg.core.mfc_debug) + // if (g_cfg.core.mfc_debug) //{ - // TODO: This needs a disambiguator with list elements dumping + // TODO: This needs a disambiguator with list elements dumping // auto& dump = mfc_history[mfc_dump_idx++ % max_mfc_dump_idx]; // dump.cmd = ch_mfc_cmd; // dump.cmd.eah = pc; // std::memcpy(dump.data, _ptr(ch_mfc_cmd.eah & 0x3fff0), std::min(ch_mfc_cmd.size, 128)); - //} + // } if (do_dma_check(cmd)) [[likely]] { @@ -5505,21 +5492,21 @@ usz spu_thread::register_cache_line_waiter(u32 addr) for (usz i = 0; i < std::size(g_spu_waiters_by_value); i++) { auto [old, ok] = g_spu_waiters_by_value[i].fetch_op([value](u64& x) - { - if (x == 0) { - x = value + 1; - return true; - } + if (x == 0) + { + x = value + 1; + return true; + } - if ((x & -128) == value) - { - x++; - return true; - } + if ((x & -128) == value) + { + x++; + return true; + } - return false; - }); + return false; + }); if (ok) { @@ -5530,7 +5517,6 @@ usz spu_thread::register_cache_line_waiter(u32 addr) return umax; } - void spu_thread::deregister_cache_line_waiter(usz index) { if (index == umax) @@ -5539,16 +5525,16 @@ void spu_thread::deregister_cache_line_waiter(usz index) } g_spu_waiters_by_value[index].fetch_op([](u64& x) - { - x--; - - if ((x & 127) == 0) { - x = 0; - } + x--; - return false; - }); + if ((x & 127) == 0) + { + x = 0; + } + + return false; + }); } std::pair spu_thread::read_dec() const @@ -5594,15 +5580,15 @@ retry: } auto [res, ok] = ch_events.fetch_op([&](ch_events_t& events) - { - if (!reading) - return false; - if (waiting) - events.waiting = !events.count; + { + if (!reading) + return false; + if (waiting) + events.waiting = !events.count; - events.count = false; - return true; - }); + events.count = false; + return true; + }); if (reading && res.locks && mask_hint & (SPU_EVENT_S1 | SPU_EVENT_S2)) { @@ -5616,18 +5602,18 @@ retry: void spu_thread::set_events(u32 bits) { if (ch_events.atomic_op([&](ch_events_t& events) - { - events.events |= bits; + { + events.events |= bits; - // If one masked event was fired, set the channel count (even if the event bit was already 1) - if (events.mask & bits) - { - events.count = true; - return !!events.waiting && (bits & (SPU_EVENT_S1 | SPU_EVENT_S2)); - } + // If one masked event was fired, set the channel count (even if the event bit was already 1) + if (events.mask & bits) + { + events.count = true; + return !!events.waiting && (bits & (SPU_EVENT_S1 | SPU_EVENT_S2)); + } - return false; - })) + return false; + })) { notify(); } @@ -5660,21 +5646,22 @@ void spu_thread::set_interrupt_status(bool enable) u32 spu_thread::get_ch_count(u32 ch) { - if (ch < 128) spu_log.trace("get_ch_count(ch=%s)", spu_ch_name[ch]); + if (ch < 128) + spu_log.trace("get_ch_count(ch=%s)", spu_ch_name[ch]); switch (ch) { - case SPU_WrOutMbox: return ch_out_mbox.get_count() ^ 1; - case SPU_WrOutIntrMbox: return ch_out_intr_mbox.get_count() ^ 1; - case SPU_RdInMbox: return ch_in_mbox.get_count(); - case MFC_RdTagStat: return ch_tag_stat.get_count(); + case SPU_WrOutMbox: return ch_out_mbox.get_count() ^ 1; + case SPU_WrOutIntrMbox: return ch_out_intr_mbox.get_count() ^ 1; + case SPU_RdInMbox: return ch_in_mbox.get_count(); + case MFC_RdTagStat: return ch_tag_stat.get_count(); case MFC_RdListStallStat: return ch_stall_stat.get_count(); - case MFC_WrTagUpdate: return 1; - case SPU_RdSigNotify1: return ch_snr1.get_count(); - case SPU_RdSigNotify2: return ch_snr2.get_count(); - case MFC_RdAtomicStat: return ch_atomic_stat.get_count(); - case SPU_RdEventStat: return static_cast(get_events().count); - case MFC_Cmd: return 16 - mfc_size; + case MFC_WrTagUpdate: return 1; + case SPU_RdSigNotify1: return ch_snr1.get_count(); + case SPU_RdSigNotify2: return ch_snr2.get_count(); + case MFC_RdAtomicStat: return ch_atomic_stat.get_count(); + case SPU_RdEventStat: return static_cast(get_events().count); + case MFC_Cmd: return 16 - mfc_size; // Channels with a constant count of 1: case SPU_WrEventMask: @@ -5707,7 +5694,8 @@ u32 spu_thread::get_ch_count(u32 ch) s64 spu_thread::get_ch_value(u32 ch) { - if (ch < 128) spu_log.trace("get_ch_value(ch=%s)", spu_ch_name[ch]); + if (ch < 128) + spu_log.trace("get_ch_value(ch=%s)", spu_ch_name[ch]); auto read_channel = [&](spu_channel& channel) -> s64 { @@ -5840,7 +5828,7 @@ s64 spu_thread::get_ch_value(u32 ch) { u32 out = read_dec().first; - //Polling: We might as well hint to the scheduler to slot in another thread since this one is counting down + // Polling: We might as well hint to the scheduler to slot in another thread since this one is counting down if (g_cfg.core.spu_loop_detection && out > spu::scheduler::native_jiffy_duration_us) { state += cpu_flag::wait; @@ -6175,7 +6163,8 @@ s64 spu_thread::get_ch_value(u32 ch) bool spu_thread::set_ch_value(u32 ch, u32 value) { - if (ch < 128) spu_log.trace("set_ch_value(ch=%s, value=0x%x)", spu_ch_name[ch], value); + if (ch < 128) + spu_log.trace("set_ch_value(ch=%s, value=0x%x)", spu_ch_name[ch], value); switch (ch) { @@ -6253,7 +6242,7 @@ bool spu_thread::set_ch_value(u32 ch, u32 value) } const auto res = !queue ? CELL_ENOTCONN : - queue->send(SYS_SPU_THREAD_EVENT_USER_KEY, lv2_id, (u64{spup} << 32) | (value & 0x00ffffff), data); + queue->send(SYS_SPU_THREAD_EVENT_USER_KEY, lv2_id, (u64{spup} << 32) | (value & 0x00ffffff), data); if (res == CELL_ENOTCONN) { @@ -6536,17 +6525,17 @@ bool spu_thread::set_ch_value(u32 ch, u32 value) get_events(value | static_cast(ch_events.load().mask)); if (ch_events.atomic_op([&](ch_events_t& events) - { - events.mask = value; + { + events.mask = value; - if (events.events & events.mask) - { - events.count = true; - return true; - } + if (events.events & events.mask) + { + events.count = true; + return true; + } - return !!events.count; - })) + return !!events.count; + })) { // Check interrupts in case count is 1 if (check_mfc_interrupts(pc + 4)) @@ -6566,19 +6555,19 @@ bool spu_thread::set_ch_value(u32 ch, u32 value) bool freeze_dec = false; const bool check_intr = ch_events.atomic_op([&](ch_events_t& events) - { - events.events &= ~value; - - freeze_dec = !!((value & SPU_EVENT_TM) & ~events.mask); - - if (events.events & events.mask) { - events.count = true; - return true; - } + events.events &= ~value; - return !!events.count; - }); + freeze_dec = !!((value & SPU_EVENT_TM) & ~events.mask); + + if (events.events & events.mask) + { + events.count = true; + return true; + } + + return !!events.count; + }); if (!is_dec_frozen && freeze_dec) { @@ -6654,12 +6643,12 @@ bool spu_thread::stop_and_signal(u32 code) auto set_status_npc = [&]() { status_npc.atomic_op([&](status_npc_sync_var& state) - { - state.status = (state.status & 0xffff) | (code << 16); - state.status |= SPU_STATUS_STOPPED_BY_STOP; - state.status &= ~SPU_STATUS_RUNNING; - state.npc = (pc + 4) | +interrupts_enabled; - }); + { + state.status = (state.status & 0xffff) | (code << 16); + state.status |= SPU_STATUS_STOPPED_BY_STOP; + state.status &= ~SPU_STATUS_RUNNING; + state.npc = (pc + 4) | +interrupts_enabled; + }); }; if (get_type() >= spu_type::raw) @@ -7022,16 +7011,16 @@ bool spu_thread::stop_and_signal(u32 code) if (thread) { thread->state.fetch_op([](bs_t& flags) - { - if (flags & cpu_flag::stop) { - // In case the thread raised the ret flag itself at some point do not raise it again - return false; - } + if (flags & cpu_flag::stop) + { + // In case the thread raised the ret flag itself at some point do not raise it again + return false; + } - flags += cpu_flag::stop + cpu_flag::ret; - return true; - }); + flags += cpu_flag::stop + cpu_flag::ret; + return true; + }); } } @@ -7111,11 +7100,11 @@ void spu_thread::halt() state += cpu_flag::stop + cpu_flag::wait; status_npc.atomic_op([this](status_npc_sync_var& state) - { - state.status |= SPU_STATUS_STOPPED_BY_HALT; - state.status &= ~SPU_STATUS_RUNNING; - state.npc = pc | +interrupts_enabled; - }); + { + state.status |= SPU_STATUS_STOPPED_BY_HALT; + state.status &= ~SPU_STATUS_RUNNING; + state.npc = pc | +interrupts_enabled; + }); status_npc.notify_one(); @@ -7183,7 +7172,6 @@ spu_exec_object spu_thread::capture_memory_as_elf(std::span std::string_view - { - switch (type) { - case spu_type::threaded: return "SPU"sv; - case spu_type::raw: return "RawSPU"sv; - case spu_type::isolated: return "Iso"sv; - default: fmt::throw_exception("Unreachable"); - } - }(_this->get_type()), _this->lv2_id); + switch (type) + { + case spu_type::threaded: return "SPU"sv; + case spu_type::raw: return "RawSPU"sv; + case spu_type::isolated: return "Iso"sv; + default: fmt::throw_exception("Unreachable"); + } + }(_this->get_type()), + _this->lv2_id); if (const std::string name = *_this->spu_tname.load(); !name.empty()) { @@ -7378,27 +7367,28 @@ spu_thread::spu_prio_t spu_thread::priority_t::load() const s64 spu_channel::pop_wait(cpu_thread& spu, bool pop) { u64 old = data.fetch_op([&](u64& data) - { - if (data & bit_count) [[likely]] - { - if (pop) - { - data = 0; - return true; - } + { + if (data & bit_count) [[likely]] + { + if (pop) + { + data = 0; + return true; + } - return false; - } + return false; + } - data = (pop ? bit_occupy : 0) | bit_wait; + data = (pop ? bit_occupy : 0) | bit_wait; - if (pop) - { - jostling_value.release(bit_occupy); - } + if (pop) + { + jostling_value.release(bit_occupy); + } - return true; - }).first; + return true; + }) + .first; if (old & bit_count) { @@ -7456,25 +7446,25 @@ bool spu_channel::push_wait(cpu_thread& spu, u32 value, bool push) { u64 state{}; data.fetch_op([&](u64& data) - { - if (data & bit_count) [[unlikely]] { - jostling_value.release(push ? (bit_occupy | value) : static_cast(data)); - data |= (push ? bit_occupy : 0) | bit_wait; - } - else if (push) - { - data = bit_count | value; - } - else - { - state = data; - return false; - } + if (data & bit_count) [[unlikely]] + { + jostling_value.release(push ? (bit_occupy | value) : static_cast(data)); + data |= (push ? bit_occupy : 0) | bit_wait; + } + else if (push) + { + data = bit_count | value; + } + else + { + state = data; + return false; + } - state = data; - return true; - }); + state = data; + return true; + }); for (int i = 0; i < 10; i++) { @@ -7507,27 +7497,27 @@ bool spu_channel::push_wait(cpu_thread& spu, u32 value, bool push) std::pair spu_channel_4_t::pop_wait(cpu_thread& spu, bool pop_value) { auto old = values.fetch_op([&](sync_var_t& data) - { - if (data.count != 0) { - if (!pop_value) + if (data.count != 0) { - return; + if (!pop_value) + { + return; + } + + data.waiting = 0; + data.count--; + + data.value0 = data.value1; + data.value1 = data.value2; + data.value2 = this->value3; } - - data.waiting = 0; - data.count--; - - data.value0 = data.value1; - data.value1 = data.value2; - data.value2 = this->value3; - } - else - { - data.waiting = (pop_value ? bit_occupy : 0) | bit_wait; - jostling_value.release(pop_value ? jostling_flag : 0); - } - }); + else + { + data.waiting = (pop_value ? bit_occupy : 0) | bit_wait; + jostling_value.release(pop_value ? jostling_flag : 0); + } + }); if (old.count) { @@ -7585,27 +7575,27 @@ spu_channel_op_state spu_channel_4_t::push(u32 value, bool postpone_notify) { value3.release(value); const auto [old, pushed_to_data] = values.fetch_op([&](sync_var_t& data) - { - if (data.waiting & bit_occupy) { - return false; - } + if (data.waiting & bit_occupy) + { + return false; + } - switch (data.count++) - { - case 0: data.value0 = value; break; - case 1: data.value1 = value; break; - case 2: data.value2 = value; break; - default: - { - data.count = 4; - data.value3_inval++; // Ensure the SPU reads the most recent value3 write in try_pop by re-loading - break; - } - } + switch (data.count++) + { + case 0: data.value0 = value; break; + case 1: data.value1 = value; break; + case 2: data.value2 = value; break; + default: + { + data.count = 4; + data.value3_inval++; // Ensure the SPU reads the most recent value3 write in try_pop by re-loading + break; + } + } - return true; - }); + return true; + }); if (!pushed_to_data) { @@ -7623,7 +7613,7 @@ spu_channel_op_state spu_channel_4_t::push(u32 value, bool postpone_notify) if (~atomic_storage::exchange(values.raw().waiting, 0) & bit_wait) { // Could be fatal or at emulation stopping, to be checked by the caller - return { old.count, old.count, false, false }; + return {old.count, old.count, false, false}; } if (!postpone_notify) @@ -7632,7 +7622,7 @@ spu_channel_op_state spu_channel_4_t::push(u32 value, bool postpone_notify) } } - return { old.count, std::min(static_cast(old.count + 1), 4), !!(old.waiting & bit_wait), true }; + return {old.count, std::min(static_cast(old.count + 1), 4), !!(old.waiting & bit_wait), true}; } } diff --git a/rpcs3/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/rpcs3/Emu/Cell/SPUThread.h index 37cf1cf07..17913bf15 100644 --- a/rpcs3/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/rpcs3/Emu/Cell/SPUThread.h @@ -34,54 +34,54 @@ extern const u32 spu_frsqest_fraction_lut[64]; extern const u32 spu_frsqest_exponent_lut[256]; // JIT Block -using spu_function_t = void(*)(spu_thread&, void*, u8*); +using spu_function_t = void (*)(spu_thread&, void*, u8*); // SPU Channels enum : u32 { - SPU_RdEventStat = 0, // Read event status with mask applied - SPU_WrEventMask = 1, // Write event mask - SPU_WrEventAck = 2, // Write end of event processing - SPU_RdSigNotify1 = 3, // Signal notification 1 - SPU_RdSigNotify2 = 4, // Signal notification 2 - SPU_WrDec = 7, // Write decrementer count - SPU_RdDec = 8, // Read decrementer count - SPU_RdEventMask = 11, // Read event mask - SPU_RdMachStat = 13, // Read SPU run status - SPU_WrSRR0 = 14, // Write SPU machine state save/restore register 0 (SRR0) - SPU_RdSRR0 = 15, // Read SPU machine state save/restore register 0 (SRR0) - SPU_WrOutMbox = 28, // Write outbound mailbox contents - SPU_RdInMbox = 29, // Read inbound mailbox contents - SPU_WrOutIntrMbox = 30, // Write outbound interrupt mailbox contents (interrupting PPU) - SPU_Set_Bkmk_Tag = 69, // Causes an event that can be logged in the performance monitor logic if enabled in the SPU - SPU_PM_Start_Ev = 70, // Starts the performance monitor event if enabled - SPU_PM_Stop_Ev = 71, // Stops the performance monitor event if enabled + SPU_RdEventStat = 0, // Read event status with mask applied + SPU_WrEventMask = 1, // Write event mask + SPU_WrEventAck = 2, // Write end of event processing + SPU_RdSigNotify1 = 3, // Signal notification 1 + SPU_RdSigNotify2 = 4, // Signal notification 2 + SPU_WrDec = 7, // Write decrementer count + SPU_RdDec = 8, // Read decrementer count + SPU_RdEventMask = 11, // Read event mask + SPU_RdMachStat = 13, // Read SPU run status + SPU_WrSRR0 = 14, // Write SPU machine state save/restore register 0 (SRR0) + SPU_RdSRR0 = 15, // Read SPU machine state save/restore register 0 (SRR0) + SPU_WrOutMbox = 28, // Write outbound mailbox contents + SPU_RdInMbox = 29, // Read inbound mailbox contents + SPU_WrOutIntrMbox = 30, // Write outbound interrupt mailbox contents (interrupting PPU) + SPU_Set_Bkmk_Tag = 69, // Causes an event that can be logged in the performance monitor logic if enabled in the SPU + SPU_PM_Start_Ev = 70, // Starts the performance monitor event if enabled + SPU_PM_Stop_Ev = 71, // Stops the performance monitor event if enabled }; // MFC Channels enum : u32 { - MFC_WrMSSyncReq = 9, // Write multisource synchronization request - MFC_RdTagMask = 12, // Read tag mask - MFC_LSA = 16, // Write local memory address command parameter - MFC_EAH = 17, // Write high order DMA effective address command parameter - MFC_EAL = 18, // Write low order DMA effective address command parameter - MFC_Size = 19, // Write DMA transfer size command parameter - MFC_TagID = 20, // Write tag identifier command parameter - MFC_Cmd = 21, // Write and enqueue DMA command with associated class ID - MFC_WrTagMask = 22, // Write tag mask - MFC_WrTagUpdate = 23, // Write request for conditional or unconditional tag status update - MFC_RdTagStat = 24, // Read tag status with mask applied + MFC_WrMSSyncReq = 9, // Write multisource synchronization request + MFC_RdTagMask = 12, // Read tag mask + MFC_LSA = 16, // Write local memory address command parameter + MFC_EAH = 17, // Write high order DMA effective address command parameter + MFC_EAL = 18, // Write low order DMA effective address command parameter + MFC_Size = 19, // Write DMA transfer size command parameter + MFC_TagID = 20, // Write tag identifier command parameter + MFC_Cmd = 21, // Write and enqueue DMA command with associated class ID + MFC_WrTagMask = 22, // Write tag mask + MFC_WrTagUpdate = 23, // Write request for conditional or unconditional tag status update + MFC_RdTagStat = 24, // Read tag status with mask applied MFC_RdListStallStat = 25, // Read DMA list stall-and-notify status - MFC_WrListStallAck = 26, // Write DMA list stall-and-notify acknowledge - MFC_RdAtomicStat = 27, // Read completion status of last completed immediate MFC atomic update command + MFC_WrListStallAck = 26, // Write DMA list stall-and-notify acknowledge + MFC_RdAtomicStat = 27, // Read completion status of last completed immediate MFC atomic update command }; // SPU Events enum : u32 { SPU_EVENT_MS = 0x1000, // Multisource Synchronization event - SPU_EVENT_A = 0x800, // Privileged Attention event + SPU_EVENT_A = 0x800, // Privileged Attention event SPU_EVENT_LR = 0x400, // Lock Line Reservation Lost event SPU_EVENT_S1 = 0x200, // Signal Notification Register 1 available SPU_EVENT_S2 = 0x100, // Signal Notification Register 2 available @@ -93,7 +93,7 @@ enum : u32 SPU_EVENT_SN = 0x2, // MFC List Command stall-and-notify event SPU_EVENT_TG = 0x1, // MFC Tag Group status update event - SPU_EVENT_IMPLEMENTED = SPU_EVENT_LR | SPU_EVENT_TM | SPU_EVENT_SN | SPU_EVENT_S1 | SPU_EVENT_S2, // Mask of implemented events + SPU_EVENT_IMPLEMENTED = SPU_EVENT_LR | SPU_EVENT_TM | SPU_EVENT_SN | SPU_EVENT_S1 | SPU_EVENT_S2, // Mask of implemented events SPU_EVENT_INTR_IMPLEMENTED = SPU_EVENT_SN, SPU_EVENT_INTR_BUSY_CHECK = SPU_EVENT_IMPLEMENTED & ~SPU_EVENT_INTR_IMPLEMENTED, }; @@ -101,37 +101,37 @@ enum : u32 // SPU Class 0 Interrupts enum : u64 { - SPU_INT0_STAT_DMA_ALIGNMENT_INT = (1ull << 0), + SPU_INT0_STAT_DMA_ALIGNMENT_INT = (1ull << 0), SPU_INT0_STAT_INVALID_DMA_CMD_INT = (1ull << 1), - SPU_INT0_STAT_SPU_ERROR_INT = (1ull << 2), + SPU_INT0_STAT_SPU_ERROR_INT = (1ull << 2), }; // SPU Class 2 Interrupts enum : u64 { - SPU_INT2_STAT_MAILBOX_INT = (1ull << 0), - SPU_INT2_STAT_SPU_STOP_AND_SIGNAL_INT = (1ull << 1), - SPU_INT2_STAT_SPU_HALT_OR_STEP_INT = (1ull << 2), + SPU_INT2_STAT_MAILBOX_INT = (1ull << 0), + SPU_INT2_STAT_SPU_STOP_AND_SIGNAL_INT = (1ull << 1), + SPU_INT2_STAT_SPU_HALT_OR_STEP_INT = (1ull << 2), SPU_INT2_STAT_DMA_TAG_GROUP_COMPLETION_INT = (1ull << 3), - SPU_INT2_STAT_SPU_MAILBOX_THRESHOLD_INT = (1ull << 4), + SPU_INT2_STAT_SPU_MAILBOX_THRESHOLD_INT = (1ull << 4), }; enum : u32 { SPU_RUNCNTL_STOP_REQUEST = 0, - SPU_RUNCNTL_RUN_REQUEST = 1, + SPU_RUNCNTL_RUN_REQUEST = 1, }; // SPU Status Register bits (not accurate) enum : u32 { - SPU_STATUS_STOPPED = 0x0, - SPU_STATUS_RUNNING = 0x1, - SPU_STATUS_STOPPED_BY_STOP = 0x2, - SPU_STATUS_STOPPED_BY_HALT = 0x4, + SPU_STATUS_STOPPED = 0x0, + SPU_STATUS_RUNNING = 0x1, + SPU_STATUS_STOPPED_BY_STOP = 0x2, + SPU_STATUS_STOPPED_BY_HALT = 0x4, SPU_STATUS_WAITING_FOR_CHANNEL = 0x8, - SPU_STATUS_SINGLE_STEP = 0x10, - SPU_STATUS_IS_ISOLATED = 0x80, + SPU_STATUS_SINGLE_STEP = 0x10, + SPU_STATUS_IS_ISOLATED = 0x80, }; enum : s32 @@ -141,10 +141,10 @@ enum : s32 enum : u32 { - SYS_SPU_THREAD_BASE_LOW = 0xf0000000, - SYS_SPU_THREAD_OFFSET = 0x100000, - SYS_SPU_THREAD_SNR1 = 0x5400c, - SYS_SPU_THREAD_SNR2 = 0x5C00c, + SYS_SPU_THREAD_BASE_LOW = 0xf0000000, + SYS_SPU_THREAD_OFFSET = 0x100000, + SYS_SPU_THREAD_SNR1 = 0x5400c, + SYS_SPU_THREAD_SNR2 = 0x5C00c, }; enum @@ -171,12 +171,12 @@ enum enum : u32 { - RAW_SPU_BASE_ADDR = 0xE0000000, - RAW_SPU_OFFSET = 0x00100000, - RAW_SPU_LS_OFFSET = 0x00000000, + RAW_SPU_BASE_ADDR = 0xE0000000, + RAW_SPU_OFFSET = 0x00100000, + RAW_SPU_LS_OFFSET = 0x00000000, RAW_SPU_PROB_OFFSET = 0x00040000, - SPU_FAKE_BASE_ADDR = 0xE8000000, + SPU_FAKE_BASE_ADDR = 0xE8000000, }; struct spu_channel_op_state @@ -196,10 +196,10 @@ struct alignas(16) spu_channel atomic_t jostling_value{}; public: - static constexpr u32 off_wait = 32; + static constexpr u32 off_wait = 32; static constexpr u32 off_occupy = 32; static constexpr u32 off_count = 63; - static constexpr u64 bit_wait = 1ull << off_wait; + static constexpr u64 bit_wait = 1ull << off_wait; static constexpr u64 bit_occupy = 1ull << off_occupy; static constexpr u64 bit_count = 1ull << off_count; @@ -207,15 +207,16 @@ public: bool try_push(u32 value) { return data.fetch_op([value](u64& data) - { - if (!(data & bit_count)) [[likely]] - { - data = bit_count | value; - return true; - } + { + if (!(data & bit_count)) [[likely]] + { + data = bit_count | value; + return true; + } - return false; - }).second; + return false; + }) + .second; } // Push unconditionally, may require notification @@ -226,23 +227,23 @@ public: while (true) { const auto [old, pushed_to_data] = data.fetch_op([&](u64& data) - { - if (data & bit_occupy) { - return false; - } + if (data & bit_occupy) + { + return false; + } - if (to_or) - { - data = bit_count | (static_cast(data) | value); - } - else - { - data = bit_count | value; - } + if (to_or) + { + data = bit_count | (static_cast(data) | value); + } + else + { + data = bit_count | value; + } - return true; - }); + return true; + }); if (!pushed_to_data) { @@ -260,7 +261,7 @@ public: if (!this->data.bit_test_reset(off_wait)) { // Could be fatal or at emulation stopping, to be checked by the caller - return { (old & bit_count) == 0, 0, false, false }; + return {(old & bit_count) == 0, 0, false, false}; } if (!postpone_notify) @@ -270,7 +271,7 @@ public: } // Return true if count has changed from 0 to 1, this condition is considered satisfied even if we pushed a value directly to the special storage for waiting SPUs - return { (old & bit_count) == 0, 1, (old & bit_wait) != 0, true }; + return {(old & bit_count) == 0, 1, (old & bit_wait) != 0, true}; } } @@ -283,16 +284,17 @@ public: bool try_pop(u32& out) { return data.fetch_op([&out](u64& data) - { - if (data & bit_count) [[likely]] - { - out = static_cast(data); - data = 0; - return true; - } + { + if (data & bit_count) [[likely]] + { + out = static_cast(data); + data = 0; + return true; + } - return false; - }).second; + return false; + }) + .second; } // Reading without modification @@ -317,16 +319,16 @@ public: constexpr u64 mask = bit_count | bit_occupy; const u64 old = data.fetch_op([&](u64& data) - { - if ((data & mask) == mask) { - // Insert the pending value, leave no time in which the channel has no data - data = bit_count | static_cast(jostling_value); - return; - } + if ((data & mask) == mask) + { + // Insert the pending value, leave no time in which the channel has no data + data = bit_count | static_cast(jostling_value); + return; + } - data &= ~(mask | bit_wait); - }); + data &= ~(mask | bit_wait); + }); if (old & bit_wait) { @@ -374,9 +376,9 @@ struct spu_channel_4_t atomic_t jostling_value; atomic_t value3; - static constexpr u32 off_wait = 0; + static constexpr u32 off_wait = 0; static constexpr u32 off_occupy = 7; - static constexpr u64 bit_wait = 1ull << off_wait; + static constexpr u64 bit_wait = 1ull << off_wait; static constexpr u64 bit_occupy = 1ull << off_occupy; static constexpr u64 jostling_flag = 1ull << 63; @@ -400,22 +402,22 @@ struct spu_channel_4_t uint try_pop(u32& out) { return values.atomic_op([&](sync_var_t& data) - { - const uint result = data.count; - - if (result != 0) { - data.waiting = 0; - data.count--; - out = data.value0; + const uint result = data.count; - data.value0 = data.value1; - data.value1 = data.value2; - data.value2 = this->value3; - } + if (result != 0) + { + data.waiting = 0; + data.count--; + out = data.value0; - return result; - }); + data.value0 = data.value1; + data.value1 = data.value2; + data.value2 = this->value3; + } + + return result; + }); } // Returns [previous count, value] (if aborted 0 count is returned) @@ -445,7 +447,7 @@ struct spu_channel_4_t void set_values(u32 count, u32 value0, u32 value1 = 0, u32 value2 = 0, u32 value3 = 0) { - this->values.raw() = { 0, static_cast(count), {}, value0, value1, value2 }; + this->values.raw() = {0, static_cast(count), {}, value0, value1, value2}; this->value3 = value3; } }; @@ -485,12 +487,11 @@ struct spu_imm_table_t public: scale_table_t(); - FORCE_INLINE const v128& operator [](s32 scale) const + FORCE_INLINE const v128& operator[](s32 scale) const { return m_data[scale + 155]; } - } - const scale; + } const scale; spu_imm_table_t(); }; @@ -499,20 +500,20 @@ extern const spu_imm_table_t g_spu_imm; enum FPSCR_EX { - //Single-precision exceptions - FPSCR_SOVF = 1 << 2, //Overflow - FPSCR_SUNF = 1 << 1, //Underflow - FPSCR_SDIFF = 1 << 0, //Different (could be IEEE non-compliant) - //Double-precision exceptions - FPSCR_DOVF = 1 << 13, //Overflow - FPSCR_DUNF = 1 << 12, //Underflow - FPSCR_DINX = 1 << 11, //Inexact - FPSCR_DINV = 1 << 10, //Invalid operation - FPSCR_DNAN = 1 << 9, //NaN - FPSCR_DDENORM = 1 << 8, //Denormal + // Single-precision exceptions + FPSCR_SOVF = 1 << 2, // Overflow + FPSCR_SUNF = 1 << 1, // Underflow + FPSCR_SDIFF = 1 << 0, // Different (could be IEEE non-compliant) + // Double-precision exceptions + FPSCR_DOVF = 1 << 13, // Overflow + FPSCR_DUNF = 1 << 12, // Underflow + FPSCR_DINX = 1 << 11, // Inexact + FPSCR_DINV = 1 << 10, // Invalid operation + FPSCR_DNAN = 1 << 9, // NaN + FPSCR_DDENORM = 1 << 8, // Denormal }; -//Is 128 bits, but bits 0-19, 24-28, 32-49, 56-60, 64-81, 88-92, 96-115, 120-124 are unused +// Is 128 bits, but bits 0-19, 24-28, 32-49, 56-60, 64-81, 88-92, 96-115, 120-124 are unused class SPU_FPSCR { public: @@ -530,20 +531,20 @@ public: memset(this, 0, sizeof(*this)); } - //slice -> 0 - 1 (double-precision slice index) - //NOTE: slices follow v128 indexing, i.e. slice 0 is RIGHT end of register! - //roundTo -> FPSCR_RN_* + // slice -> 0 - 1 (double-precision slice index) + // NOTE: slices follow v128 indexing, i.e. slice 0 is RIGHT end of register! + // roundTo -> FPSCR_RN_* void setSliceRounding(u8 slice, u8 roundTo) { - int shift = 8 + 2*slice; - //rounding is located in the left end of the FPSCR + int shift = 8 + 2 * slice; + // rounding is located in the left end of the FPSCR this->_u32[3] = (this->_u32[3] & ~(3 << shift)) | (roundTo << shift); } - //Slice 0 or 1 + // Slice 0 or 1 u8 checkSliceRounding(u8 slice) const { - switch(slice) + switch (slice) { case 0: return this->_u32[3] >> 8 & 0x3; @@ -556,24 +557,24 @@ public: } } - //Single-precision exception flags (all 4 slices) - //slice -> slice number (0-3) - //exception: FPSCR_S* bitmask + // Single-precision exception flags (all 4 slices) + // slice -> slice number (0-3) + // exception: FPSCR_S* bitmask void setSinglePrecisionExceptionFlags(u8 slice, u32 exceptions) { _u32[slice] |= exceptions; } - //Single-precision divide-by-zero flags (all 4 slices) - //slice -> slice number (0-3) + // Single-precision divide-by-zero flags (all 4 slices) + // slice -> slice number (0-3) void setDivideByZeroFlag(u8 slice) { _u32[0] |= 1 << (8 + slice); } - //Double-precision exception flags - //slice -> slice number (0-1) - //exception: FPSCR_D* bitmask + // Double-precision exception flags + // slice -> slice number (0-1) + // exception: FPSCR_D* bitmask void setDoublePrecisionExceptionFlags(u8 slice, u32 exceptions) { _u32[1 + slice] |= exceptions; @@ -622,7 +623,9 @@ enum class spu_debugger_mode : u32 max_mode, }; -enum class spu_block_hash : u64 {}; +enum class spu_block_hash : u64 +{ +}; class spu_thread : public cpu_thread { @@ -655,7 +658,10 @@ public: spu_thread(utils::serial& ar, lv2_spu_group* group = nullptr); void serialize_common(utils::serial& ar); void save(utils::serial& ar); - bool savable() const { return get_type() != spu_type::threaded; } // Threaded SPUs are saved as part of the SPU group + bool savable() const + { + return get_type() != spu_type::threaded; + } // Threaded SPUs are saved as part of the SPU group u32 pc = 0; u32 dbg_step_pc = 0; @@ -741,7 +747,7 @@ public: bool interrupts_enabled = false; u64 ch_dec_start_timestamp = 0; // timestamp of writing decrementer value - u32 ch_dec_value = 0; // written decrementer value + u32 ch_dec_value = 0; // written decrementer value bool is_dec_frozen = false; std::pair read_dec() const; // Read decrementer @@ -751,23 +757,23 @@ public: struct alignas(8) status_npc_sync_var { u32 status; // SPU Status register - u32 npc; // SPU Next Program Counter register + u32 npc; // SPU Next Program Counter register }; atomic_t status_npc{}; std::array int_ctrl{}; // SPU Class 0, 1, 2 Interrupt Management std::array>, 32> spuq{}; // Event Queue Keys for SPU Thread - shared_ptr spup[64]; // SPU Ports - spu_channel exit_status{}; // Threaded SPU exit status (not a channel, but the interface fits) - atomic_t last_exit_status; // Value to be written in exit_status after checking group termination - lv2_spu_group* const group; // SPU Thread Group (access by the spu threads in the group only! From other threads obtain a shared pointer to group using group ID) - const u32 index; // SPU index + shared_ptr spup[64]; // SPU Ports + spu_channel exit_status{}; // Threaded SPU exit status (not a channel, but the interface fits) + atomic_t last_exit_status; // Value to be written in exit_status after checking group termination + lv2_spu_group* const group; // SPU Thread Group (access by the spu threads in the group only! From other threads obtain a shared pointer to group using group ID) + const u32 index; // SPU index const spu_type thread_type; std::shared_ptr shm; // SPU memory const std::add_pointer_t ls; // SPU LS pointer - const u32 option; // sys_spu_thread_initialize option - const u32 lv2_id; // The actual id that is used by syscalls + const u32 option; // sys_spu_thread_initialize option + const u32 lv2_id; // The actual id that is used by syscalls u32 spurs_addr = 0; bool spurs_waited = false; bool spurs_entered_wait = false; @@ -816,8 +822,8 @@ public: std::array stack_mirror; // Return address information const char* current_func{}; // Current STOP or RDCH blocking function - u64 start_time{}; // Starting time of STOP or RDCH bloking function - bool unsavable = false; // Flag indicating whether saving the spu thread state is currently unsafe + u64 start_time{}; // Starting time of STOP or RDCH bloking function + bool unsavable = false; // Flag indicating whether saving the spu thread state is currently unsafe atomic_t debugger_mode{}; @@ -828,7 +834,7 @@ public: bool stop_flag_removal_protection = false; std::array, SPU_LS_SIZE / 128> getllar_wait_time{}; - + void push_snr(u32 number, u32 value); static void do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* ls); bool do_dma_check(const spu_mfc_cmd& args); @@ -862,14 +868,14 @@ public: void wakeup_delay(u32 div = 1) const; // Convert specified SPU LS address to a pointer of specified (possibly converted to BE) type - template + template to_be_t* _ptr(u32 lsa) const { return reinterpret_cast*>(ls + (lsa % SPU_LS_SIZE)); } // Convert specified SPU LS address to a reference of specified (possibly converted to BE) type - template + template to_be_t& _ref(u32 lsa) const { return *_ptr(lsa); @@ -920,12 +926,12 @@ public: const spu_thread* _this; operator std::string() const; - } thread_name{ this }; + } thread_name{this}; union spu_prio_t { u64 all; - bf_t prio; // Thread priority (0..3071) (firs 9-bits) + bf_t prio; // Thread priority (0..3071) (firs 9-bits) bf_t order; // Thread enqueue order (TODO, last 52-bits) }; @@ -941,7 +947,7 @@ public: { return static_cast, Func, decltype(_this->group)>>(_this->group)->prio.atomic_op(std::move(func)); } - } prio{ this }; + } prio{this}; }; class spu_function_logger diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/lv2.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/lv2.cpp index e5c00fab9..c4e7c3643 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/lv2.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/lv2.cpp @@ -69,7 +69,6 @@ #endif #endif - extern std::string ppu_get_syscall_name(u64 code); namespace rsx @@ -90,17 +89,17 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto value) - { - switch (value) { - case SYS_SYNC_FIFO: return "FIFO"; - case SYS_SYNC_PRIORITY: return "PRIO"; - case SYS_SYNC_PRIORITY_INHERIT: return "PRIO-INHER"; - case SYS_SYNC_RETRY: return "RETRY"; - } + switch (value) + { + case SYS_SYNC_FIFO: return "FIFO"; + case SYS_SYNC_PRIORITY: return "PRIO"; + case SYS_SYNC_PRIORITY_INHERIT: return "PRIO-INHER"; + case SYS_SYNC_RETRY: return "RETRY"; + } - return unknown; - }); + return unknown; + }); } template <> @@ -138,831 +137,830 @@ constexpr std::pair uns_func{uns_func_, ""}; // DEX..DECR = Unavailable on retail consoles // PM = Product Mode // AuthID = Authentication ID -const std::array, 1024> g_ppu_syscall_table -{ +const std::array, 1024> g_ppu_syscall_table{ null_func, - BIND_SYSC(sys_process_getpid), //1 (0x001) - BIND_SYSC(sys_process_wait_for_child), //2 (0x002) ROOT - BIND_SYSC(sys_process_exit3), //3 (0x003) - BIND_SYSC(sys_process_get_status), //4 (0x004) DBG - BIND_SYSC(sys_process_detach_child), //5 (0x005) DBG + BIND_SYSC(sys_process_getpid), // 1 (0x001) + BIND_SYSC(sys_process_wait_for_child), // 2 (0x002) ROOT + BIND_SYSC(sys_process_exit3), // 3 (0x003) + BIND_SYSC(sys_process_get_status), // 4 (0x004) DBG + BIND_SYSC(sys_process_detach_child), // 5 (0x005) DBG - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //6-11 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 6-11 UNS - BIND_SYSC(sys_process_get_number_of_object), //12 (0x00C) - BIND_SYSC(sys_process_get_id), //13 (0x00D) - BIND_SYSC(sys_process_is_spu_lock_line_reservation_address), //14 (0x00E) + BIND_SYSC(sys_process_get_number_of_object), // 12 (0x00C) + BIND_SYSC(sys_process_get_id), // 13 (0x00D) + BIND_SYSC(sys_process_is_spu_lock_line_reservation_address), // 14 (0x00E) - uns_func, uns_func, uns_func, //15-17 UNS + uns_func, uns_func, uns_func, // 15-17 UNS - BIND_SYSC(sys_process_getppid), //18 (0x012) - BIND_SYSC(sys_process_kill), //19 (0x013) - uns_func, //20 (0x014) UNS - NULL_FUNC(_sys_process_spawn), //21 (0x015) DBG - BIND_SYSC(_sys_process_exit), //22 (0x016) - BIND_SYSC(sys_process_wait_for_child2), //23 (0x017) DBG - null_func,//BIND_SYSC(), //24 (0x018) DBG - BIND_SYSC(sys_process_get_sdk_version), //25 (0x019) - BIND_SYSC(_sys_process_exit2), //26 (0x01A) - BIND_SYSC(sys_process_spawns_a_self2), //27 (0x01B) DBG - NULL_FUNC(_sys_process_get_number_of_object), //28 (0x01C) ROOT - BIND_SYSC(sys_process_get_id2), //29 (0x01D) ROOT - BIND_SYSC(_sys_process_get_paramsfo), //30 (0x01E) - NULL_FUNC(sys_process_get_ppu_guid), //31 (0x01F) + BIND_SYSC(sys_process_getppid), // 18 (0x012) + BIND_SYSC(sys_process_kill), // 19 (0x013) + uns_func, // 20 (0x014) UNS + NULL_FUNC(_sys_process_spawn), // 21 (0x015) DBG + BIND_SYSC(_sys_process_exit), // 22 (0x016) + BIND_SYSC(sys_process_wait_for_child2), // 23 (0x017) DBG + null_func, // BIND_SYSC(), //24 (0x018) DBG + BIND_SYSC(sys_process_get_sdk_version), // 25 (0x019) + BIND_SYSC(_sys_process_exit2), // 26 (0x01A) + BIND_SYSC(sys_process_spawns_a_self2), // 27 (0x01B) DBG + NULL_FUNC(_sys_process_get_number_of_object), // 28 (0x01C) ROOT + BIND_SYSC(sys_process_get_id2), // 29 (0x01D) ROOT + BIND_SYSC(_sys_process_get_paramsfo), // 30 (0x01E) + NULL_FUNC(sys_process_get_ppu_guid), // 31 (0x01F) - uns_func, uns_func ,uns_func , uns_func ,uns_func, uns_func ,uns_func, uns_func ,uns_func, //32-40 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 32-40 UNS - BIND_SYSC(_sys_ppu_thread_exit), //41 (0x029) - uns_func, //42 (0x02A) UNS - BIND_SYSC(sys_ppu_thread_yield), //43 (0x02B) - BIND_SYSC(sys_ppu_thread_join), //44 (0x02C) - BIND_SYSC(sys_ppu_thread_detach), //45 (0x02D) - BIND_SYSC(sys_ppu_thread_get_join_state), //46 (0x02E) - BIND_SYSC(sys_ppu_thread_set_priority), //47 (0x02F) DBG - BIND_SYSC(sys_ppu_thread_get_priority), //48 (0x030) - BIND_SYSC(sys_ppu_thread_get_stack_information), //49 (0x031) - BIND_SYSC(sys_ppu_thread_stop), //50 (0x032) ROOT - BIND_SYSC(sys_ppu_thread_restart), //51 (0x033) ROOT - BIND_SYSC(_sys_ppu_thread_create), //52 (0x034) DBG - BIND_SYSC(sys_ppu_thread_start), //53 (0x035) - null_func,//BIND_SYSC(sys_ppu_...), //54 (0x036) ROOT - null_func,//BIND_SYSC(sys_ppu_...), //55 (0x037) ROOT - BIND_SYSC(sys_ppu_thread_rename), //56 (0x038) - BIND_SYSC(sys_ppu_thread_recover_page_fault), //57 (0x039) - BIND_SYSC(sys_ppu_thread_get_page_fault_context), //58 (0x03A) - uns_func, //59 (0x03B) UNS - BIND_SYSC(sys_trace_create), //60 (0x03C) - BIND_SYSC(sys_trace_start), //61 (0x03D) - BIND_SYSC(sys_trace_stop), //62 (0x03E) - BIND_SYSC(sys_trace_update_top_index), //63 (0x03F) - BIND_SYSC(sys_trace_destroy), //64 (0x040) - BIND_SYSC(sys_trace_drain), //65 (0x041) - BIND_SYSC(sys_trace_attach_process), //66 (0x042) - BIND_SYSC(sys_trace_allocate_buffer), //67 (0x043) - BIND_SYSC(sys_trace_free_buffer), //68 (0x044) - BIND_SYSC(sys_trace_create2), //69 (0x045) - BIND_SYSC(sys_timer_create), //70 (0x046) - BIND_SYSC(sys_timer_destroy), //71 (0x047) - BIND_SYSC(sys_timer_get_information), //72 (0x048) - BIND_SYSC(_sys_timer_start), //73 (0x049) - BIND_SYSC(sys_timer_stop), //74 (0x04A) - BIND_SYSC(sys_timer_connect_event_queue), //75 (0x04B) - BIND_SYSC(sys_timer_disconnect_event_queue), //76 (0x04C) - NULL_FUNC(sys_trace_create2_in_cbepm), //77 (0x04D) - null_func,//BIND_SYSC(sys_trace_...), //78 (0x04E) - uns_func, //79 (0x04F) UNS - NULL_FUNC(sys_interrupt_tag_create), //80 (0x050) - BIND_SYSC(sys_interrupt_tag_destroy), //81 (0x051) - BIND_SYSC(sys_event_flag_create), //82 (0x052) - BIND_SYSC(sys_event_flag_destroy), //83 (0x053) - BIND_SYSC(_sys_interrupt_thread_establish), //84 (0x054) - BIND_SYSC(sys_event_flag_wait), //85 (0x055) - BIND_SYSC(sys_event_flag_trywait), //86 (0x056) - BIND_SYSC(sys_event_flag_set), //87 (0x057) - BIND_SYSC(sys_interrupt_thread_eoi), //88 (0x058) - BIND_SYSC(_sys_interrupt_thread_disestablish), //89 (0x059) - BIND_SYSC(sys_semaphore_create), //90 (0x05A) - BIND_SYSC(sys_semaphore_destroy), //91 (0x05B) - BIND_SYSC(sys_semaphore_wait), //92 (0x05C) - BIND_SYSC(sys_semaphore_trywait), //93 (0x05D) - BIND_SYSC(sys_semaphore_post), //94 (0x05E) - BIND_SYSC(_sys_lwmutex_create), //95 (0x05F) - BIND_SYSC(_sys_lwmutex_destroy), //96 (0x060) - BIND_SYSC(_sys_lwmutex_lock), //97 (0x061) - BIND_SYSC(_sys_lwmutex_unlock), //98 (0x062) - BIND_SYSC(_sys_lwmutex_trylock), //99 (0x063) - BIND_SYSC(sys_mutex_create), //100 (0x064) - BIND_SYSC(sys_mutex_destroy), //101 (0x065) - BIND_SYSC(sys_mutex_lock), //102 (0x066) - BIND_SYSC(sys_mutex_trylock), //103 (0x067) - BIND_SYSC(sys_mutex_unlock), //104 (0x068) - BIND_SYSC(sys_cond_create), //105 (0x069) - BIND_SYSC(sys_cond_destroy), //106 (0x06A) - BIND_SYSC(sys_cond_wait), //107 (0x06B) - BIND_SYSC(sys_cond_signal), //108 (0x06C) - BIND_SYSC(sys_cond_signal_all), //109 (0x06D) - BIND_SYSC(sys_cond_signal_to), //110 (0x06E) - BIND_SYSC(_sys_lwcond_create), //111 (0x06F) - BIND_SYSC(_sys_lwcond_destroy), //112 (0x070) - BIND_SYSC(_sys_lwcond_queue_wait), //113 (0x071) - BIND_SYSC(sys_semaphore_get_value), //114 (0x072) - BIND_SYSC(_sys_lwcond_signal), //115 (0x073) - BIND_SYSC(_sys_lwcond_signal_all), //116 (0x074) - BIND_SYSC(_sys_lwmutex_unlock2), //117 (0x075) - BIND_SYSC(sys_event_flag_clear), //118 (0x076) - BIND_SYSC(sys_time_get_rtc), //119 (0x077) ROOT - BIND_SYSC(sys_rwlock_create), //120 (0x078) - BIND_SYSC(sys_rwlock_destroy), //121 (0x079) - BIND_SYSC(sys_rwlock_rlock), //122 (0x07A) - BIND_SYSC(sys_rwlock_tryrlock), //123 (0x07B) - BIND_SYSC(sys_rwlock_runlock), //124 (0x07C) - BIND_SYSC(sys_rwlock_wlock), //125 (0x07D) - BIND_SYSC(sys_rwlock_trywlock), //126 (0x07E) - BIND_SYSC(sys_rwlock_wunlock), //127 (0x07F) - BIND_SYSC(sys_event_queue_create), //128 (0x080) - BIND_SYSC(sys_event_queue_destroy), //129 (0x081) - BIND_SYSC(sys_event_queue_receive), //130 (0x082) - BIND_SYSC(sys_event_queue_tryreceive), //131 (0x083) - BIND_SYSC(sys_event_flag_cancel), //132 (0x084) - BIND_SYSC(sys_event_queue_drain), //133 (0x085) - BIND_SYSC(sys_event_port_create), //134 (0x086) - BIND_SYSC(sys_event_port_destroy), //135 (0x087) - BIND_SYSC(sys_event_port_connect_local), //136 (0x088) - BIND_SYSC(sys_event_port_disconnect), //137 (0x089) - BIND_SYSC(sys_event_port_send), //138 (0x08A) - BIND_SYSC(sys_event_flag_get), //139 (0x08B) - BIND_SYSC(sys_event_port_connect_ipc), //140 (0x08C) - BIND_SYSC(sys_timer_usleep), //141 (0x08D) - BIND_SYSC(sys_timer_sleep), //142 (0x08E) - BIND_SYSC(sys_time_set_timezone), //143 (0x08F) ROOT - BIND_SYSC(sys_time_get_timezone), //144 (0x090) - BIND_SYSC(sys_time_get_current_time), //145 (0x091) - BIND_SYSC(sys_time_set_current_time), //146 (0x092) ROOT - BIND_SYSC(sys_time_get_timebase_frequency), //147 (0x093) - BIND_SYSC(_sys_rwlock_trywlock), //148 (0x094) - NULL_FUNC(sys_time_get_system_time), //149 (0x095) - BIND_SYSC(sys_raw_spu_create_interrupt_tag), //150 (0x096) - BIND_SYSC(sys_raw_spu_set_int_mask), //151 (0x097) - BIND_SYSC(sys_raw_spu_get_int_mask), //152 (0x098) - BIND_SYSC(sys_raw_spu_set_int_stat), //153 (0x099) - BIND_SYSC(sys_raw_spu_get_int_stat), //154 (0x09A) - BIND_SYSC(_sys_spu_image_get_information), //155 (0x09B) - BIND_SYSC(sys_spu_image_open), //156 (0x09C) - BIND_SYSC(_sys_spu_image_import), //157 (0x09D) - BIND_SYSC(_sys_spu_image_close), //158 (0x09E) - BIND_SYSC(_sys_spu_image_get_segments), //159 (0x09F) - BIND_SYSC(sys_raw_spu_create), //160 (0x0A0) - BIND_SYSC(sys_raw_spu_destroy), //161 (0x0A1) - uns_func, //162 (0x0A2) UNS - BIND_SYSC(sys_raw_spu_read_puint_mb), //163 (0x0A3) - uns_func, //164 (0x0A4) UNS - BIND_SYSC(sys_spu_thread_get_exit_status), //165 (0x0A5) - BIND_SYSC(sys_spu_thread_set_argument), //166 (0x0A6) - NULL_FUNC(sys_spu_thread_group_start_on_exit), //167 (0x0A7) - uns_func, //168 (0x0A8) UNS - BIND_SYSC(sys_spu_initialize), //169 (0x0A9) - BIND_SYSC(sys_spu_thread_group_create), //170 (0x0AA) - BIND_SYSC(sys_spu_thread_group_destroy), //171 (0x0AB) - BIND_SYSC(sys_spu_thread_initialize), //172 (0x0AC) - BIND_SYSC(sys_spu_thread_group_start), //173 (0x0AD) - BIND_SYSC(sys_spu_thread_group_suspend), //174 (0x0AE) - BIND_SYSC(sys_spu_thread_group_resume), //175 (0x0AF) - BIND_SYSC(sys_spu_thread_group_yield), //176 (0x0B0) - BIND_SYSC(sys_spu_thread_group_terminate), //177 (0x0B1) - BIND_SYSC(sys_spu_thread_group_join), //178 (0x0B2) - BIND_SYSC(sys_spu_thread_group_set_priority), //179 (0x0B3) - BIND_SYSC(sys_spu_thread_group_get_priority), //180 (0x0B4) - BIND_SYSC(sys_spu_thread_write_ls), //181 (0x0B5) - BIND_SYSC(sys_spu_thread_read_ls), //182 (0x0B6) - uns_func, //183 (0x0B7) UNS - BIND_SYSC(sys_spu_thread_write_snr), //184 (0x0B8) - BIND_SYSC(sys_spu_thread_group_connect_event), //185 (0x0B9) - BIND_SYSC(sys_spu_thread_group_disconnect_event), //186 (0x0BA) - BIND_SYSC(sys_spu_thread_set_spu_cfg), //187 (0x0BB) - BIND_SYSC(sys_spu_thread_get_spu_cfg), //188 (0x0BC) - uns_func, //189 (0x0BD) UNS - BIND_SYSC(sys_spu_thread_write_spu_mb), //190 (0x0BE) - BIND_SYSC(sys_spu_thread_connect_event), //191 (0x0BF) - BIND_SYSC(sys_spu_thread_disconnect_event), //192 (0x0C0) - BIND_SYSC(sys_spu_thread_bind_queue), //193 (0x0C1) - BIND_SYSC(sys_spu_thread_unbind_queue), //194 (0x0C2) - uns_func, //195 (0x0C3) UNS - BIND_SYSC(sys_raw_spu_set_spu_cfg), //196 (0x0C4) - BIND_SYSC(sys_raw_spu_get_spu_cfg), //197 (0x0C5) - BIND_SYSC(sys_spu_thread_recover_page_fault), //198 (0x0C6) - BIND_SYSC(sys_raw_spu_recover_page_fault), //199 (0x0C7) + BIND_SYSC(_sys_ppu_thread_exit), // 41 (0x029) + uns_func, // 42 (0x02A) UNS + BIND_SYSC(sys_ppu_thread_yield), // 43 (0x02B) + BIND_SYSC(sys_ppu_thread_join), // 44 (0x02C) + BIND_SYSC(sys_ppu_thread_detach), // 45 (0x02D) + BIND_SYSC(sys_ppu_thread_get_join_state), // 46 (0x02E) + BIND_SYSC(sys_ppu_thread_set_priority), // 47 (0x02F) DBG + BIND_SYSC(sys_ppu_thread_get_priority), // 48 (0x030) + BIND_SYSC(sys_ppu_thread_get_stack_information), // 49 (0x031) + BIND_SYSC(sys_ppu_thread_stop), // 50 (0x032) ROOT + BIND_SYSC(sys_ppu_thread_restart), // 51 (0x033) ROOT + BIND_SYSC(_sys_ppu_thread_create), // 52 (0x034) DBG + BIND_SYSC(sys_ppu_thread_start), // 53 (0x035) + null_func, // BIND_SYSC(sys_ppu_...), //54 (0x036) ROOT + null_func, // BIND_SYSC(sys_ppu_...), //55 (0x037) ROOT + BIND_SYSC(sys_ppu_thread_rename), // 56 (0x038) + BIND_SYSC(sys_ppu_thread_recover_page_fault), // 57 (0x039) + BIND_SYSC(sys_ppu_thread_get_page_fault_context), // 58 (0x03A) + uns_func, // 59 (0x03B) UNS + BIND_SYSC(sys_trace_create), // 60 (0x03C) + BIND_SYSC(sys_trace_start), // 61 (0x03D) + BIND_SYSC(sys_trace_stop), // 62 (0x03E) + BIND_SYSC(sys_trace_update_top_index), // 63 (0x03F) + BIND_SYSC(sys_trace_destroy), // 64 (0x040) + BIND_SYSC(sys_trace_drain), // 65 (0x041) + BIND_SYSC(sys_trace_attach_process), // 66 (0x042) + BIND_SYSC(sys_trace_allocate_buffer), // 67 (0x043) + BIND_SYSC(sys_trace_free_buffer), // 68 (0x044) + BIND_SYSC(sys_trace_create2), // 69 (0x045) + BIND_SYSC(sys_timer_create), // 70 (0x046) + BIND_SYSC(sys_timer_destroy), // 71 (0x047) + BIND_SYSC(sys_timer_get_information), // 72 (0x048) + BIND_SYSC(_sys_timer_start), // 73 (0x049) + BIND_SYSC(sys_timer_stop), // 74 (0x04A) + BIND_SYSC(sys_timer_connect_event_queue), // 75 (0x04B) + BIND_SYSC(sys_timer_disconnect_event_queue), // 76 (0x04C) + NULL_FUNC(sys_trace_create2_in_cbepm), // 77 (0x04D) + null_func, // BIND_SYSC(sys_trace_...), //78 (0x04E) + uns_func, // 79 (0x04F) UNS + NULL_FUNC(sys_interrupt_tag_create), // 80 (0x050) + BIND_SYSC(sys_interrupt_tag_destroy), // 81 (0x051) + BIND_SYSC(sys_event_flag_create), // 82 (0x052) + BIND_SYSC(sys_event_flag_destroy), // 83 (0x053) + BIND_SYSC(_sys_interrupt_thread_establish), // 84 (0x054) + BIND_SYSC(sys_event_flag_wait), // 85 (0x055) + BIND_SYSC(sys_event_flag_trywait), // 86 (0x056) + BIND_SYSC(sys_event_flag_set), // 87 (0x057) + BIND_SYSC(sys_interrupt_thread_eoi), // 88 (0x058) + BIND_SYSC(_sys_interrupt_thread_disestablish), // 89 (0x059) + BIND_SYSC(sys_semaphore_create), // 90 (0x05A) + BIND_SYSC(sys_semaphore_destroy), // 91 (0x05B) + BIND_SYSC(sys_semaphore_wait), // 92 (0x05C) + BIND_SYSC(sys_semaphore_trywait), // 93 (0x05D) + BIND_SYSC(sys_semaphore_post), // 94 (0x05E) + BIND_SYSC(_sys_lwmutex_create), // 95 (0x05F) + BIND_SYSC(_sys_lwmutex_destroy), // 96 (0x060) + BIND_SYSC(_sys_lwmutex_lock), // 97 (0x061) + BIND_SYSC(_sys_lwmutex_unlock), // 98 (0x062) + BIND_SYSC(_sys_lwmutex_trylock), // 99 (0x063) + BIND_SYSC(sys_mutex_create), // 100 (0x064) + BIND_SYSC(sys_mutex_destroy), // 101 (0x065) + BIND_SYSC(sys_mutex_lock), // 102 (0x066) + BIND_SYSC(sys_mutex_trylock), // 103 (0x067) + BIND_SYSC(sys_mutex_unlock), // 104 (0x068) + BIND_SYSC(sys_cond_create), // 105 (0x069) + BIND_SYSC(sys_cond_destroy), // 106 (0x06A) + BIND_SYSC(sys_cond_wait), // 107 (0x06B) + BIND_SYSC(sys_cond_signal), // 108 (0x06C) + BIND_SYSC(sys_cond_signal_all), // 109 (0x06D) + BIND_SYSC(sys_cond_signal_to), // 110 (0x06E) + BIND_SYSC(_sys_lwcond_create), // 111 (0x06F) + BIND_SYSC(_sys_lwcond_destroy), // 112 (0x070) + BIND_SYSC(_sys_lwcond_queue_wait), // 113 (0x071) + BIND_SYSC(sys_semaphore_get_value), // 114 (0x072) + BIND_SYSC(_sys_lwcond_signal), // 115 (0x073) + BIND_SYSC(_sys_lwcond_signal_all), // 116 (0x074) + BIND_SYSC(_sys_lwmutex_unlock2), // 117 (0x075) + BIND_SYSC(sys_event_flag_clear), // 118 (0x076) + BIND_SYSC(sys_time_get_rtc), // 119 (0x077) ROOT + BIND_SYSC(sys_rwlock_create), // 120 (0x078) + BIND_SYSC(sys_rwlock_destroy), // 121 (0x079) + BIND_SYSC(sys_rwlock_rlock), // 122 (0x07A) + BIND_SYSC(sys_rwlock_tryrlock), // 123 (0x07B) + BIND_SYSC(sys_rwlock_runlock), // 124 (0x07C) + BIND_SYSC(sys_rwlock_wlock), // 125 (0x07D) + BIND_SYSC(sys_rwlock_trywlock), // 126 (0x07E) + BIND_SYSC(sys_rwlock_wunlock), // 127 (0x07F) + BIND_SYSC(sys_event_queue_create), // 128 (0x080) + BIND_SYSC(sys_event_queue_destroy), // 129 (0x081) + BIND_SYSC(sys_event_queue_receive), // 130 (0x082) + BIND_SYSC(sys_event_queue_tryreceive), // 131 (0x083) + BIND_SYSC(sys_event_flag_cancel), // 132 (0x084) + BIND_SYSC(sys_event_queue_drain), // 133 (0x085) + BIND_SYSC(sys_event_port_create), // 134 (0x086) + BIND_SYSC(sys_event_port_destroy), // 135 (0x087) + BIND_SYSC(sys_event_port_connect_local), // 136 (0x088) + BIND_SYSC(sys_event_port_disconnect), // 137 (0x089) + BIND_SYSC(sys_event_port_send), // 138 (0x08A) + BIND_SYSC(sys_event_flag_get), // 139 (0x08B) + BIND_SYSC(sys_event_port_connect_ipc), // 140 (0x08C) + BIND_SYSC(sys_timer_usleep), // 141 (0x08D) + BIND_SYSC(sys_timer_sleep), // 142 (0x08E) + BIND_SYSC(sys_time_set_timezone), // 143 (0x08F) ROOT + BIND_SYSC(sys_time_get_timezone), // 144 (0x090) + BIND_SYSC(sys_time_get_current_time), // 145 (0x091) + BIND_SYSC(sys_time_set_current_time), // 146 (0x092) ROOT + BIND_SYSC(sys_time_get_timebase_frequency), // 147 (0x093) + BIND_SYSC(_sys_rwlock_trywlock), // 148 (0x094) + NULL_FUNC(sys_time_get_system_time), // 149 (0x095) + BIND_SYSC(sys_raw_spu_create_interrupt_tag), // 150 (0x096) + BIND_SYSC(sys_raw_spu_set_int_mask), // 151 (0x097) + BIND_SYSC(sys_raw_spu_get_int_mask), // 152 (0x098) + BIND_SYSC(sys_raw_spu_set_int_stat), // 153 (0x099) + BIND_SYSC(sys_raw_spu_get_int_stat), // 154 (0x09A) + BIND_SYSC(_sys_spu_image_get_information), // 155 (0x09B) + BIND_SYSC(sys_spu_image_open), // 156 (0x09C) + BIND_SYSC(_sys_spu_image_import), // 157 (0x09D) + BIND_SYSC(_sys_spu_image_close), // 158 (0x09E) + BIND_SYSC(_sys_spu_image_get_segments), // 159 (0x09F) + BIND_SYSC(sys_raw_spu_create), // 160 (0x0A0) + BIND_SYSC(sys_raw_spu_destroy), // 161 (0x0A1) + uns_func, // 162 (0x0A2) UNS + BIND_SYSC(sys_raw_spu_read_puint_mb), // 163 (0x0A3) + uns_func, // 164 (0x0A4) UNS + BIND_SYSC(sys_spu_thread_get_exit_status), // 165 (0x0A5) + BIND_SYSC(sys_spu_thread_set_argument), // 166 (0x0A6) + NULL_FUNC(sys_spu_thread_group_start_on_exit), // 167 (0x0A7) + uns_func, // 168 (0x0A8) UNS + BIND_SYSC(sys_spu_initialize), // 169 (0x0A9) + BIND_SYSC(sys_spu_thread_group_create), // 170 (0x0AA) + BIND_SYSC(sys_spu_thread_group_destroy), // 171 (0x0AB) + BIND_SYSC(sys_spu_thread_initialize), // 172 (0x0AC) + BIND_SYSC(sys_spu_thread_group_start), // 173 (0x0AD) + BIND_SYSC(sys_spu_thread_group_suspend), // 174 (0x0AE) + BIND_SYSC(sys_spu_thread_group_resume), // 175 (0x0AF) + BIND_SYSC(sys_spu_thread_group_yield), // 176 (0x0B0) + BIND_SYSC(sys_spu_thread_group_terminate), // 177 (0x0B1) + BIND_SYSC(sys_spu_thread_group_join), // 178 (0x0B2) + BIND_SYSC(sys_spu_thread_group_set_priority), // 179 (0x0B3) + BIND_SYSC(sys_spu_thread_group_get_priority), // 180 (0x0B4) + BIND_SYSC(sys_spu_thread_write_ls), // 181 (0x0B5) + BIND_SYSC(sys_spu_thread_read_ls), // 182 (0x0B6) + uns_func, // 183 (0x0B7) UNS + BIND_SYSC(sys_spu_thread_write_snr), // 184 (0x0B8) + BIND_SYSC(sys_spu_thread_group_connect_event), // 185 (0x0B9) + BIND_SYSC(sys_spu_thread_group_disconnect_event), // 186 (0x0BA) + BIND_SYSC(sys_spu_thread_set_spu_cfg), // 187 (0x0BB) + BIND_SYSC(sys_spu_thread_get_spu_cfg), // 188 (0x0BC) + uns_func, // 189 (0x0BD) UNS + BIND_SYSC(sys_spu_thread_write_spu_mb), // 190 (0x0BE) + BIND_SYSC(sys_spu_thread_connect_event), // 191 (0x0BF) + BIND_SYSC(sys_spu_thread_disconnect_event), // 192 (0x0C0) + BIND_SYSC(sys_spu_thread_bind_queue), // 193 (0x0C1) + BIND_SYSC(sys_spu_thread_unbind_queue), // 194 (0x0C2) + uns_func, // 195 (0x0C3) UNS + BIND_SYSC(sys_raw_spu_set_spu_cfg), // 196 (0x0C4) + BIND_SYSC(sys_raw_spu_get_spu_cfg), // 197 (0x0C5) + BIND_SYSC(sys_spu_thread_recover_page_fault), // 198 (0x0C6) + BIND_SYSC(sys_raw_spu_recover_page_fault), // 199 (0x0C7) - null_func, null_func, null_func, null_func, null_func, //204 UNS? - null_func, null_func, null_func, null_func, null_func, //209 UNS? - null_func, null_func, null_func, //212 UNS? - BIND_SYSC(sys_console_write2), //213 (0x0D5) - null_func, //214 UNS? + null_func, null_func, null_func, null_func, null_func, // 204 UNS? + null_func, null_func, null_func, null_func, null_func, // 209 UNS? + null_func, null_func, null_func, // 212 UNS? + BIND_SYSC(sys_console_write2), // 213 (0x0D5) + null_func, // 214 UNS? - NULL_FUNC(sys_dbg_mat_set_condition), //215 (0x0D7) - NULL_FUNC(sys_dbg_mat_get_condition), //216 (0x0D8) - uns_func,//BIND_SYSC(sys_dbg_...), //217 (0x0D9) DBG UNS? - uns_func,//BIND_SYSC(sys_dbg_...), //218 (0x0DA) DBG UNS? - uns_func,//BIND_SYSC(sys_dbg_...), //219 (0x0DB) DBG UNS? + NULL_FUNC(sys_dbg_mat_set_condition), // 215 (0x0D7) + NULL_FUNC(sys_dbg_mat_get_condition), // 216 (0x0D8) + uns_func, // BIND_SYSC(sys_dbg_...), //217 (0x0D9) DBG UNS? + uns_func, // BIND_SYSC(sys_dbg_...), //218 (0x0DA) DBG UNS? + uns_func, // BIND_SYSC(sys_dbg_...), //219 (0x0DB) DBG UNS? - null_func, null_func, null_func, null_func, null_func, //224 UNS - null_func, null_func, null_func, null_func, null_func, //229 UNS? + null_func, null_func, null_func, null_func, null_func, // 224 UNS + null_func, null_func, null_func, null_func, null_func, // 229 UNS? - BIND_SYSC(sys_isolated_spu_create), //230 (0x0E6) ROOT - BIND_SYSC(sys_isolated_spu_destroy), //231 (0x0E7) ROOT - BIND_SYSC(sys_isolated_spu_start), //232 (0x0E8) ROOT - BIND_SYSC(sys_isolated_spu_create_interrupt_tag), //233 (0x0E9) ROOT - BIND_SYSC(sys_isolated_spu_set_int_mask), //234 (0x0EA) ROOT - BIND_SYSC(sys_isolated_spu_get_int_mask), //235 (0x0EB) ROOT - BIND_SYSC(sys_isolated_spu_set_int_stat), //236 (0x0EC) ROOT - BIND_SYSC(sys_isolated_spu_get_int_stat), //237 (0x0ED) ROOT - BIND_SYSC(sys_isolated_spu_set_spu_cfg), //238 (0x0EE) ROOT - BIND_SYSC(sys_isolated_spu_get_spu_cfg), //239 (0x0EF) ROOT - BIND_SYSC(sys_isolated_spu_read_puint_mb), //240 (0x0F0) ROOT - uns_func, uns_func, uns_func, //241-243 ROOT UNS - NULL_FUNC(sys_spu_thread_group_system_set_next_group), //244 (0x0F4) ROOT - NULL_FUNC(sys_spu_thread_group_system_unset_next_group),//245 (0x0F5) ROOT - NULL_FUNC(sys_spu_thread_group_system_set_switch_group),//246 (0x0F6) ROOT - NULL_FUNC(sys_spu_thread_group_system_unset_switch_group),//247 (0x0F7) ROOT - null_func,//BIND_SYSC(sys_spu_thread_group...), //248 (0x0F8) ROOT - null_func,//BIND_SYSC(sys_spu_thread_group...), //249 (0x0F9) ROOT - BIND_SYSC(sys_spu_thread_group_set_cooperative_victims),//250 (0x0FA) - BIND_SYSC(sys_spu_thread_group_connect_event_all_threads), //251 (0x0FB) - BIND_SYSC(sys_spu_thread_group_disconnect_event_all_threads), //252 (0x0FC) - BIND_SYSC(sys_spu_thread_group_syscall_253), //253 (0x0FD) - BIND_SYSC(sys_spu_thread_group_log), //254 (0x0FE) + BIND_SYSC(sys_isolated_spu_create), // 230 (0x0E6) ROOT + BIND_SYSC(sys_isolated_spu_destroy), // 231 (0x0E7) ROOT + BIND_SYSC(sys_isolated_spu_start), // 232 (0x0E8) ROOT + BIND_SYSC(sys_isolated_spu_create_interrupt_tag), // 233 (0x0E9) ROOT + BIND_SYSC(sys_isolated_spu_set_int_mask), // 234 (0x0EA) ROOT + BIND_SYSC(sys_isolated_spu_get_int_mask), // 235 (0x0EB) ROOT + BIND_SYSC(sys_isolated_spu_set_int_stat), // 236 (0x0EC) ROOT + BIND_SYSC(sys_isolated_spu_get_int_stat), // 237 (0x0ED) ROOT + BIND_SYSC(sys_isolated_spu_set_spu_cfg), // 238 (0x0EE) ROOT + BIND_SYSC(sys_isolated_spu_get_spu_cfg), // 239 (0x0EF) ROOT + BIND_SYSC(sys_isolated_spu_read_puint_mb), // 240 (0x0F0) ROOT + uns_func, uns_func, uns_func, // 241-243 ROOT UNS + NULL_FUNC(sys_spu_thread_group_system_set_next_group), // 244 (0x0F4) ROOT + NULL_FUNC(sys_spu_thread_group_system_unset_next_group), // 245 (0x0F5) ROOT + NULL_FUNC(sys_spu_thread_group_system_set_switch_group), // 246 (0x0F6) ROOT + NULL_FUNC(sys_spu_thread_group_system_unset_switch_group), // 247 (0x0F7) ROOT + null_func, // BIND_SYSC(sys_spu_thread_group...), //248 (0x0F8) ROOT + null_func, // BIND_SYSC(sys_spu_thread_group...), //249 (0x0F9) ROOT + BIND_SYSC(sys_spu_thread_group_set_cooperative_victims), // 250 (0x0FA) + BIND_SYSC(sys_spu_thread_group_connect_event_all_threads), // 251 (0x0FB) + BIND_SYSC(sys_spu_thread_group_disconnect_event_all_threads), // 252 (0x0FC) + BIND_SYSC(sys_spu_thread_group_syscall_253), // 253 (0x0FD) + BIND_SYSC(sys_spu_thread_group_log), // 254 (0x0FE) - uns_func, uns_func, uns_func, uns_func, uns_func, //255-259 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, // 255-259 UNS - NULL_FUNC(sys_spu_image_open_by_fd), //260 (0x104) + NULL_FUNC(sys_spu_image_open_by_fd), // 260 (0x104) - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //261-269 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //270-279 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //280-289 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //290-299 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 261-269 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 270-279 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 280-289 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 290-299 UNS - BIND_SYSC(sys_vm_memory_map), //300 (0x12C) - BIND_SYSC(sys_vm_unmap), //301 (0x12D) - BIND_SYSC(sys_vm_append_memory), //302 (0x12E) - BIND_SYSC(sys_vm_return_memory), //303 (0x12F) - BIND_SYSC(sys_vm_lock), //304 (0x130) - BIND_SYSC(sys_vm_unlock), //305 (0x131) - BIND_SYSC(sys_vm_touch), //306 (0x132) - BIND_SYSC(sys_vm_flush), //307 (0x133) - BIND_SYSC(sys_vm_invalidate), //308 (0x134) - BIND_SYSC(sys_vm_store), //309 (0x135) - BIND_SYSC(sys_vm_sync), //310 (0x136) - BIND_SYSC(sys_vm_test), //311 (0x137) - BIND_SYSC(sys_vm_get_statistics), //312 (0x138) - BIND_SYSC(sys_vm_memory_map_different), //313 (0x139) - null_func,//BIND_SYSC(sys_...), //314 (0x13A) - null_func,//BIND_SYSC(sys_...), //315 (0x13B) + BIND_SYSC(sys_vm_memory_map), // 300 (0x12C) + BIND_SYSC(sys_vm_unmap), // 301 (0x12D) + BIND_SYSC(sys_vm_append_memory), // 302 (0x12E) + BIND_SYSC(sys_vm_return_memory), // 303 (0x12F) + BIND_SYSC(sys_vm_lock), // 304 (0x130) + BIND_SYSC(sys_vm_unlock), // 305 (0x131) + BIND_SYSC(sys_vm_touch), // 306 (0x132) + BIND_SYSC(sys_vm_flush), // 307 (0x133) + BIND_SYSC(sys_vm_invalidate), // 308 (0x134) + BIND_SYSC(sys_vm_store), // 309 (0x135) + BIND_SYSC(sys_vm_sync), // 310 (0x136) + BIND_SYSC(sys_vm_test), // 311 (0x137) + BIND_SYSC(sys_vm_get_statistics), // 312 (0x138) + BIND_SYSC(sys_vm_memory_map_different), // 313 (0x139) + null_func, // BIND_SYSC(sys_...), //314 (0x13A) + null_func, // BIND_SYSC(sys_...), //315 (0x13B) - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //316-323 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 316-323 UNS - BIND_SYSC(sys_memory_container_create), //324 (0x144) DBG - BIND_SYSC(sys_memory_container_destroy), //325 (0x145) DBG - BIND_SYSC(sys_mmapper_allocate_fixed_address), //326 (0x146) - BIND_SYSC(sys_mmapper_enable_page_fault_notification), //327 (0x147) - BIND_SYSC(sys_mmapper_allocate_shared_memory_from_container_ext), //328 (0x148) - BIND_SYSC(sys_mmapper_free_shared_memory), //329 (0x149) - BIND_SYSC(sys_mmapper_allocate_address), //330 (0x14A) - BIND_SYSC(sys_mmapper_free_address), //331 (0x14B) - BIND_SYSC(sys_mmapper_allocate_shared_memory), //332 (0x14C) - NULL_FUNC(sys_mmapper_set_shared_memory_flag), //333(0x14D) - BIND_SYSC(sys_mmapper_map_shared_memory), //334 (0x14E) - BIND_SYSC(sys_mmapper_unmap_shared_memory), //335 (0x14F) - BIND_SYSC(sys_mmapper_change_address_access_right), //336 (0x150) - BIND_SYSC(sys_mmapper_search_and_map), //337 (0x151) - NULL_FUNC(sys_mmapper_get_shared_memory_attribute), //338 (0x152) - BIND_SYSC(sys_mmapper_allocate_shared_memory_ext), //339 (0x153) - null_func,//BIND_SYSC(sys_...), //340 (0x154) - BIND_SYSC(sys_memory_container_create), //341 (0x155) - BIND_SYSC(sys_memory_container_destroy), //342 (0x156) - BIND_SYSC(sys_memory_container_get_size), //343 (0x157) - NULL_FUNC(sys_memory_budget_set), //344 (0x158) - BIND_SYSC(sys_memory_container_destroy_parent_with_childs), //345 (0x159) - null_func,//BIND_SYSC(sys_memory_...), //346 (0x15A) - uns_func, //347 (0x15B) UNS - BIND_SYSC(sys_memory_allocate), //348 (0x15C) - BIND_SYSC(sys_memory_free), //349 (0x15D) - BIND_SYSC(sys_memory_allocate_from_container), //350 (0x15E) - BIND_SYSC(sys_memory_get_page_attribute), //351 (0x15F) - BIND_SYSC(sys_memory_get_user_memory_size), //352 (0x160) - BIND_SYSC(sys_memory_get_user_memory_stat), //353 (0x161) - null_func,//BIND_SYSC(sys_memory_...), //354 (0x162) - null_func,//BIND_SYSC(sys_memory_...), //355 (0x163) - NULL_FUNC(sys_memory_allocate_colored), //356 (0x164) - null_func,//BIND_SYSC(sys_memory_...), //357 (0x165) - null_func,//BIND_SYSC(sys_memory_...), //358 (0x166) - null_func,//BIND_SYSC(sys_memory_...), //359 (0x167) - null_func,//BIND_SYSC(sys_memory_...), //360 (0x168) - NULL_FUNC(sys_memory_allocate_from_container_colored), //361 (0x169) - BIND_SYSC(sys_mmapper_allocate_shared_memory_from_container),//362 (0x16A) - null_func,//BIND_SYSC(sys_mmapper_...), //363 (0x16B) - null_func,//BIND_SYSC(sys_mmapper_...), //364 (0x16C) - uns_func, uns_func, //366 (0x16E) UNS - BIND_SYSC(sys_uart_initialize), //367 (0x16F) ROOT - BIND_SYSC(sys_uart_receive), //368 (0x170) ROOT - BIND_SYSC(sys_uart_send), //369 (0x171) ROOT - BIND_SYSC(sys_uart_get_params), //370 (0x172) ROOT - uns_func, //371 (0x173) UNS - BIND_SYSC(_sys_game_watchdog_start), //372 (0x174) - BIND_SYSC(_sys_game_watchdog_stop), //373 (0x175) - BIND_SYSC(_sys_game_watchdog_clear), //374 (0x176) - BIND_SYSC(_sys_game_set_system_sw_version), //375 (0x177) ROOT - BIND_SYSC(_sys_game_get_system_sw_version), //376 (0x178) ROOT - BIND_SYSC(sys_sm_set_shop_mode), //377 (0x179) ROOT - BIND_SYSC(sys_sm_get_ext_event2), //378 (0x17A) ROOT - BIND_SYSC(sys_sm_shutdown), //379 (0x17B) ROOT - BIND_SYSC(sys_sm_get_params), //380 (0x17C) DBG - NULL_FUNC(sys_sm_get_inter_lpar_parameter), //381 (0x17D) ROOT - NULL_FUNC(sys_sm_initialize), //382 (0x17E) ROOT - NULL_FUNC(sys_game_get_temperature), //383 (0x17F) ROOT - NULL_FUNC(sys_sm_get_tzpb), //384 (0x180) ROOT - NULL_FUNC(sys_sm_request_led), //385 (0x181) ROOT - BIND_SYSC(sys_sm_control_led), //386 (0x182) ROOT - NULL_FUNC(sys_sm_get_system_info), //387 (0x183) DBG - BIND_SYSC(sys_sm_ring_buzzer2), //388 (0x184) ROOT - NULL_FUNC(sys_sm_set_fan_policy), //389 (0x185) PM - NULL_FUNC(sys_sm_request_error_log), //390 (0x186) ROOT - NULL_FUNC(sys_sm_request_be_count), //391 (0x187) ROOT - BIND_SYSC(sys_sm_ring_buzzer), //392 (0x188) ROOT - NULL_FUNC(sys_sm_get_hw_config), //393 (0x189) ROOT - NULL_FUNC(sys_sm_request_scversion), //394 (0x18A) ROOT - NULL_FUNC(sys_sm_request_system_event_log), //395 (0x18B) PM - NULL_FUNC(sys_sm_set_rtc_alarm), //396 (0x18C) ROOT - NULL_FUNC(sys_sm_get_rtc_alarm), //397 (0x18D) ROOT - BIND_SYSC(sys_console_write), //398 (0x18E) ROOT - uns_func, //399 (0x18F) UNS - null_func,//BIND_SYSC(sys_sm_...), //400 (0x190) PM - null_func,//BIND_SYSC(sys_sm_...), //401 (0x191) ROOT - BIND_SYSC(sys_tty_read), //402 (0x192) - BIND_SYSC(sys_tty_write), //403 (0x193) - null_func,//BIND_SYSC(sys_...), //404 (0x194) ROOT - null_func,//BIND_SYSC(sys_...), //405 (0x195) PM - null_func,//BIND_SYSC(sys_...), //406 (0x196) PM - null_func,//BIND_SYSC(sys_...), //407 (0x197) PM - NULL_FUNC(sys_sm_get_tzpb), //408 (0x198) PM - NULL_FUNC(sys_sm_get_fan_policy), //409 (0x199) PM - BIND_SYSC(_sys_game_board_storage_read), //410 (0x19A) - BIND_SYSC(_sys_game_board_storage_write), //411 (0x19B) - BIND_SYSC(_sys_game_get_rtc_status), //412 (0x19C) - null_func,//BIND_SYSC(sys_...), //413 (0x19D) ROOT - null_func,//BIND_SYSC(sys_...), //414 (0x19E) ROOT - null_func,//BIND_SYSC(sys_...), //415 (0x19F) ROOT + BIND_SYSC(sys_memory_container_create), // 324 (0x144) DBG + BIND_SYSC(sys_memory_container_destroy), // 325 (0x145) DBG + BIND_SYSC(sys_mmapper_allocate_fixed_address), // 326 (0x146) + BIND_SYSC(sys_mmapper_enable_page_fault_notification), // 327 (0x147) + BIND_SYSC(sys_mmapper_allocate_shared_memory_from_container_ext), // 328 (0x148) + BIND_SYSC(sys_mmapper_free_shared_memory), // 329 (0x149) + BIND_SYSC(sys_mmapper_allocate_address), // 330 (0x14A) + BIND_SYSC(sys_mmapper_free_address), // 331 (0x14B) + BIND_SYSC(sys_mmapper_allocate_shared_memory), // 332 (0x14C) + NULL_FUNC(sys_mmapper_set_shared_memory_flag), // 333(0x14D) + BIND_SYSC(sys_mmapper_map_shared_memory), // 334 (0x14E) + BIND_SYSC(sys_mmapper_unmap_shared_memory), // 335 (0x14F) + BIND_SYSC(sys_mmapper_change_address_access_right), // 336 (0x150) + BIND_SYSC(sys_mmapper_search_and_map), // 337 (0x151) + NULL_FUNC(sys_mmapper_get_shared_memory_attribute), // 338 (0x152) + BIND_SYSC(sys_mmapper_allocate_shared_memory_ext), // 339 (0x153) + null_func, // BIND_SYSC(sys_...), //340 (0x154) + BIND_SYSC(sys_memory_container_create), // 341 (0x155) + BIND_SYSC(sys_memory_container_destroy), // 342 (0x156) + BIND_SYSC(sys_memory_container_get_size), // 343 (0x157) + NULL_FUNC(sys_memory_budget_set), // 344 (0x158) + BIND_SYSC(sys_memory_container_destroy_parent_with_childs), // 345 (0x159) + null_func, // BIND_SYSC(sys_memory_...), //346 (0x15A) + uns_func, // 347 (0x15B) UNS + BIND_SYSC(sys_memory_allocate), // 348 (0x15C) + BIND_SYSC(sys_memory_free), // 349 (0x15D) + BIND_SYSC(sys_memory_allocate_from_container), // 350 (0x15E) + BIND_SYSC(sys_memory_get_page_attribute), // 351 (0x15F) + BIND_SYSC(sys_memory_get_user_memory_size), // 352 (0x160) + BIND_SYSC(sys_memory_get_user_memory_stat), // 353 (0x161) + null_func, // BIND_SYSC(sys_memory_...), //354 (0x162) + null_func, // BIND_SYSC(sys_memory_...), //355 (0x163) + NULL_FUNC(sys_memory_allocate_colored), // 356 (0x164) + null_func, // BIND_SYSC(sys_memory_...), //357 (0x165) + null_func, // BIND_SYSC(sys_memory_...), //358 (0x166) + null_func, // BIND_SYSC(sys_memory_...), //359 (0x167) + null_func, // BIND_SYSC(sys_memory_...), //360 (0x168) + NULL_FUNC(sys_memory_allocate_from_container_colored), // 361 (0x169) + BIND_SYSC(sys_mmapper_allocate_shared_memory_from_container), // 362 (0x16A) + null_func, // BIND_SYSC(sys_mmapper_...), //363 (0x16B) + null_func, // BIND_SYSC(sys_mmapper_...), //364 (0x16C) + uns_func, uns_func, // 366 (0x16E) UNS + BIND_SYSC(sys_uart_initialize), // 367 (0x16F) ROOT + BIND_SYSC(sys_uart_receive), // 368 (0x170) ROOT + BIND_SYSC(sys_uart_send), // 369 (0x171) ROOT + BIND_SYSC(sys_uart_get_params), // 370 (0x172) ROOT + uns_func, // 371 (0x173) UNS + BIND_SYSC(_sys_game_watchdog_start), // 372 (0x174) + BIND_SYSC(_sys_game_watchdog_stop), // 373 (0x175) + BIND_SYSC(_sys_game_watchdog_clear), // 374 (0x176) + BIND_SYSC(_sys_game_set_system_sw_version), // 375 (0x177) ROOT + BIND_SYSC(_sys_game_get_system_sw_version), // 376 (0x178) ROOT + BIND_SYSC(sys_sm_set_shop_mode), // 377 (0x179) ROOT + BIND_SYSC(sys_sm_get_ext_event2), // 378 (0x17A) ROOT + BIND_SYSC(sys_sm_shutdown), // 379 (0x17B) ROOT + BIND_SYSC(sys_sm_get_params), // 380 (0x17C) DBG + NULL_FUNC(sys_sm_get_inter_lpar_parameter), // 381 (0x17D) ROOT + NULL_FUNC(sys_sm_initialize), // 382 (0x17E) ROOT + NULL_FUNC(sys_game_get_temperature), // 383 (0x17F) ROOT + NULL_FUNC(sys_sm_get_tzpb), // 384 (0x180) ROOT + NULL_FUNC(sys_sm_request_led), // 385 (0x181) ROOT + BIND_SYSC(sys_sm_control_led), // 386 (0x182) ROOT + NULL_FUNC(sys_sm_get_system_info), // 387 (0x183) DBG + BIND_SYSC(sys_sm_ring_buzzer2), // 388 (0x184) ROOT + NULL_FUNC(sys_sm_set_fan_policy), // 389 (0x185) PM + NULL_FUNC(sys_sm_request_error_log), // 390 (0x186) ROOT + NULL_FUNC(sys_sm_request_be_count), // 391 (0x187) ROOT + BIND_SYSC(sys_sm_ring_buzzer), // 392 (0x188) ROOT + NULL_FUNC(sys_sm_get_hw_config), // 393 (0x189) ROOT + NULL_FUNC(sys_sm_request_scversion), // 394 (0x18A) ROOT + NULL_FUNC(sys_sm_request_system_event_log), // 395 (0x18B) PM + NULL_FUNC(sys_sm_set_rtc_alarm), // 396 (0x18C) ROOT + NULL_FUNC(sys_sm_get_rtc_alarm), // 397 (0x18D) ROOT + BIND_SYSC(sys_console_write), // 398 (0x18E) ROOT + uns_func, // 399 (0x18F) UNS + null_func, // BIND_SYSC(sys_sm_...), //400 (0x190) PM + null_func, // BIND_SYSC(sys_sm_...), //401 (0x191) ROOT + BIND_SYSC(sys_tty_read), // 402 (0x192) + BIND_SYSC(sys_tty_write), // 403 (0x193) + null_func, // BIND_SYSC(sys_...), //404 (0x194) ROOT + null_func, // BIND_SYSC(sys_...), //405 (0x195) PM + null_func, // BIND_SYSC(sys_...), //406 (0x196) PM + null_func, // BIND_SYSC(sys_...), //407 (0x197) PM + NULL_FUNC(sys_sm_get_tzpb), // 408 (0x198) PM + NULL_FUNC(sys_sm_get_fan_policy), // 409 (0x199) PM + BIND_SYSC(_sys_game_board_storage_read), // 410 (0x19A) + BIND_SYSC(_sys_game_board_storage_write), // 411 (0x19B) + BIND_SYSC(_sys_game_get_rtc_status), // 412 (0x19C) + null_func, // BIND_SYSC(sys_...), //413 (0x19D) ROOT + null_func, // BIND_SYSC(sys_...), //414 (0x19E) ROOT + null_func, // BIND_SYSC(sys_...), //415 (0x19F) ROOT - uns_func, uns_func, uns_func, uns_func, //416-419 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //420-429 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //430-439 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //440-449 UNS + uns_func, uns_func, uns_func, uns_func, // 416-419 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 420-429 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 430-439 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 440-449 UNS - BIND_SYSC(sys_overlay_load_module), //450 (0x1C2) - BIND_SYSC(sys_overlay_unload_module), //451 (0x1C3) - NULL_FUNC(sys_overlay_get_module_list), //452 (0x1C4) - NULL_FUNC(sys_overlay_get_module_info), //453 (0x1C5) - BIND_SYSC(sys_overlay_load_module_by_fd), //454 (0x1C6) - NULL_FUNC(sys_overlay_get_module_info2), //455 (0x1C7) - NULL_FUNC(sys_overlay_get_sdk_version), //456 (0x1C8) - NULL_FUNC(sys_overlay_get_module_dbg_info), //457 (0x1C9) - NULL_FUNC(sys_overlay_get_module_dbg_info), //458 (0x1CA) - uns_func, //459 (0x1CB) UNS - NULL_FUNC(sys_prx_dbg_get_module_id_list), //460 (0x1CC) ROOT - BIND_SYSC(_sys_prx_get_module_id_by_address), //461 (0x1CD) - uns_func, //462 (0x1CE) DEX - BIND_SYSC(_sys_prx_load_module_by_fd), //463 (0x1CF) - BIND_SYSC(_sys_prx_load_module_on_memcontainer_by_fd), //464 (0x1D0) - BIND_SYSC(_sys_prx_load_module_list), //465 (0x1D1) - BIND_SYSC(_sys_prx_load_module_list_on_memcontainer), //466 (0x1D2) - BIND_SYSC(sys_prx_get_ppu_guid), //467 (0x1D3) - null_func,//BIND_SYSC(sys_...), //468 (0x1D4) ROOT - uns_func, //469 (0x1D5) UNS - NULL_FUNC(sys_npdrm_check_ekc), //470 (0x1D6) ROOT - NULL_FUNC(sys_npdrm_regist_ekc), //471 (0x1D7) ROOT - null_func,//BIND_SYSC(sys_...), //472 (0x1D8) ROOT - null_func,//BIND_SYSC(sys_...), //473 (0x1D9) - null_func,//BIND_SYSC(sys_...), //474 (0x1DA) - null_func,//BIND_SYSC(sys_...), //475 (0x1DB) ROOT - null_func,//BIND_SYSC(sys_...), //476 (0x1DC) ROOT + BIND_SYSC(sys_overlay_load_module), // 450 (0x1C2) + BIND_SYSC(sys_overlay_unload_module), // 451 (0x1C3) + NULL_FUNC(sys_overlay_get_module_list), // 452 (0x1C4) + NULL_FUNC(sys_overlay_get_module_info), // 453 (0x1C5) + BIND_SYSC(sys_overlay_load_module_by_fd), // 454 (0x1C6) + NULL_FUNC(sys_overlay_get_module_info2), // 455 (0x1C7) + NULL_FUNC(sys_overlay_get_sdk_version), // 456 (0x1C8) + NULL_FUNC(sys_overlay_get_module_dbg_info), // 457 (0x1C9) + NULL_FUNC(sys_overlay_get_module_dbg_info), // 458 (0x1CA) + uns_func, // 459 (0x1CB) UNS + NULL_FUNC(sys_prx_dbg_get_module_id_list), // 460 (0x1CC) ROOT + BIND_SYSC(_sys_prx_get_module_id_by_address), // 461 (0x1CD) + uns_func, // 462 (0x1CE) DEX + BIND_SYSC(_sys_prx_load_module_by_fd), // 463 (0x1CF) + BIND_SYSC(_sys_prx_load_module_on_memcontainer_by_fd), // 464 (0x1D0) + BIND_SYSC(_sys_prx_load_module_list), // 465 (0x1D1) + BIND_SYSC(_sys_prx_load_module_list_on_memcontainer), // 466 (0x1D2) + BIND_SYSC(sys_prx_get_ppu_guid), // 467 (0x1D3) + null_func, // BIND_SYSC(sys_...), //468 (0x1D4) ROOT + uns_func, // 469 (0x1D5) UNS + NULL_FUNC(sys_npdrm_check_ekc), // 470 (0x1D6) ROOT + NULL_FUNC(sys_npdrm_regist_ekc), // 471 (0x1D7) ROOT + null_func, // BIND_SYSC(sys_...), //472 (0x1D8) ROOT + null_func, // BIND_SYSC(sys_...), //473 (0x1D9) + null_func, // BIND_SYSC(sys_...), //474 (0x1DA) + null_func, // BIND_SYSC(sys_...), //475 (0x1DB) ROOT + null_func, // BIND_SYSC(sys_...), //476 (0x1DC) ROOT - uns_func, uns_func, uns_func, //477-479 UNS + uns_func, uns_func, uns_func, // 477-479 UNS - BIND_SYSC(_sys_prx_load_module), //480 (0x1E0) - BIND_SYSC(_sys_prx_start_module), //481 (0x1E1) - BIND_SYSC(_sys_prx_stop_module), //482 (0x1E2) - BIND_SYSC(_sys_prx_unload_module), //483 (0x1E3) - BIND_SYSC(_sys_prx_register_module), //484 (0x1E4) - BIND_SYSC(_sys_prx_query_module), //485 (0x1E5) - BIND_SYSC(_sys_prx_register_library), //486 (0x1E6) - BIND_SYSC(_sys_prx_unregister_library), //487 (0x1E7) - BIND_SYSC(_sys_prx_link_library), //488 (0x1E8) - BIND_SYSC(_sys_prx_unlink_library), //489 (0x1E9) - BIND_SYSC(_sys_prx_query_library), //490 (0x1EA) - uns_func, //491 (0x1EB) UNS - NULL_FUNC(sys_prx_dbg_get_module_list), //492 (0x1EC) DBG - NULL_FUNC(sys_prx_dbg_get_module_info), //493 (0x1ED) DBG - BIND_SYSC(_sys_prx_get_module_list), //494 (0x1EE) - BIND_SYSC(_sys_prx_get_module_info), //495 (0x1EF) - BIND_SYSC(_sys_prx_get_module_id_by_name), //496 (0x1F0) - BIND_SYSC(_sys_prx_load_module_on_memcontainer), //497 (0x1F1) - BIND_SYSC(_sys_prx_start), //498 (0x1F2) - BIND_SYSC(_sys_prx_stop), //499 (0x1F3) - BIND_SYSC(sys_hid_manager_open), //500 (0x1F4) - NULL_FUNC(sys_hid_manager_close), //501 (0x1F5) - BIND_SYSC(sys_hid_manager_read), //502 (0x1F6) ROOT - BIND_SYSC(sys_hid_manager_ioctl), //503 (0x1F7) - NULL_FUNC(sys_hid_manager_map_logical_id_to_port_id), //504 (0x1F8) ROOT - NULL_FUNC(sys_hid_manager_unmap_logical_id_to_port_id), //505 (0x1F9) ROOT - BIND_SYSC(sys_hid_manager_add_hot_key_observer), //506 (0x1FA) ROOT - NULL_FUNC(sys_hid_manager_remove_hot_key_observer), //507 (0x1FB) ROOT - NULL_FUNC(sys_hid_manager_grab_focus), //508 (0x1FC) ROOT - NULL_FUNC(sys_hid_manager_release_focus), //509 (0x1FD) ROOT - BIND_SYSC(sys_hid_manager_check_focus), //510 (0x1FE) - NULL_FUNC(sys_hid_manager_set_master_process), //511 (0x1FF) ROOT - BIND_SYSC(sys_hid_manager_is_process_permission_root), //512 (0x200) ROOT - BIND_SYSC(sys_hid_manager_513), //513 (0x201) - BIND_SYSC(sys_hid_manager_514), //514 (0x202) - uns_func, //515 (0x203) UNS - BIND_SYSC(sys_config_open), //516 (0x204) - BIND_SYSC(sys_config_close), //517 (0x205) - BIND_SYSC(sys_config_get_service_event), //518 (0x206) - BIND_SYSC(sys_config_add_service_listener), //519 (0x207) - BIND_SYSC(sys_config_remove_service_listener), //520 (0x208) - BIND_SYSC(sys_config_register_service), //521 (0x209) - BIND_SYSC(sys_config_unregister_service), //522 (0x20A) - BIND_SYSC(sys_config_get_io_event), //523 (0x20B) - BIND_SYSC(sys_config_register_io_error_listener), //524 (0x20C) - BIND_SYSC(sys_config_unregister_io_error_listener), //525 (0x20D) - uns_func, uns_func, uns_func, uns_func, //526-529 UNS - BIND_SYSC(sys_usbd_initialize), //530 (0x212) - BIND_SYSC(sys_usbd_finalize), //531 (0x213) - BIND_SYSC(sys_usbd_get_device_list), //532 (0x214) - BIND_SYSC(sys_usbd_get_descriptor_size), //533 (0x215) - BIND_SYSC(sys_usbd_get_descriptor), //534 (0x216) - BIND_SYSC(sys_usbd_register_ldd), //535 (0x217) - BIND_SYSC(sys_usbd_unregister_ldd), //536 (0x218) - BIND_SYSC(sys_usbd_open_pipe), //537 (0x219) - BIND_SYSC(sys_usbd_open_default_pipe), //538 (0x21A) - BIND_SYSC(sys_usbd_close_pipe), //539 (0x21B) - BIND_SYSC(sys_usbd_receive_event), //540 (0x21C) - BIND_SYSC(sys_usbd_detect_event), //541 (0x21D) - BIND_SYSC(sys_usbd_attach), //542 (0x21E) - BIND_SYSC(sys_usbd_transfer_data), //543 (0x21F) - BIND_SYSC(sys_usbd_isochronous_transfer_data), //544 (0x220) - BIND_SYSC(sys_usbd_get_transfer_status), //545 (0x221) - BIND_SYSC(sys_usbd_get_isochronous_transfer_status), //546 (0x222) - BIND_SYSC(sys_usbd_get_device_location), //547 (0x223) - BIND_SYSC(sys_usbd_send_event), //548 (0x224) - BIND_SYSC(sys_usbd_event_port_send), //549 (0x225) - BIND_SYSC(sys_usbd_allocate_memory), //550 (0x226) - BIND_SYSC(sys_usbd_free_memory), //551 (0x227) - null_func,//BIND_SYSC(sys_usbd_...), //552 (0x228) - null_func,//BIND_SYSC(sys_usbd_...), //553 (0x229) - null_func,//BIND_SYSC(sys_usbd_...), //554 (0x22A) - null_func,//BIND_SYSC(sys_usbd_...), //555 (0x22B) - BIND_SYSC(sys_usbd_get_device_speed), //556 (0x22C) - null_func,//BIND_SYSC(sys_usbd_...), //557 (0x22D) - BIND_SYSC(sys_usbd_unregister_extra_ldd), //558 (0x22E) - BIND_SYSC(sys_usbd_register_extra_ldd), //559 (0x22F) - null_func,//BIND_SYSC(sys_...), //560 (0x230) ROOT - null_func,//BIND_SYSC(sys_...), //561 (0x231) ROOT - null_func,//BIND_SYSC(sys_...), //562 (0x232) ROOT - null_func,//BIND_SYSC(sys_...), //563 (0x233) - null_func,//BIND_SYSC(sys_...), //564 (0x234) - null_func,//BIND_SYSC(sys_...), //565 (0x235) - null_func,//BIND_SYSC(sys_...), //566 (0x236) - null_func,//BIND_SYSC(sys_...), //567 (0x237) - null_func,//BIND_SYSC(sys_...), //568 (0x238) - null_func,//BIND_SYSC(sys_...), //569 (0x239) - NULL_FUNC(sys_pad_ldd_register_controller), //570 (0x23A) - NULL_FUNC(sys_pad_ldd_unregister_controller), //571 (0x23B) - NULL_FUNC(sys_pad_ldd_data_insert), //572 (0x23C) - NULL_FUNC(sys_pad_dbg_ldd_set_data_insert_mode), //573 (0x23D) - NULL_FUNC(sys_pad_ldd_register_controller), //574 (0x23E) - NULL_FUNC(sys_pad_ldd_get_port_no), //575 (0x23F) - uns_func, //576 (0x240) UNS - null_func,//BIND_SYSC(sys_pad_manager_...), //577 (0x241) ROOT PM - null_func,//BIND_SYSC(sys_bluetooth_...), //578 (0x242) - null_func,//BIND_SYSC(sys_bluetooth_aud_serial_...), //579 (0x243) - null_func,//BIND_SYSC(sys_bluetooth_...), //580 (0x244) ROOT - null_func,//BIND_SYSC(sys_bluetooth_...), //581 (0x245) ROOT - null_func,//BIND_SYSC(sys_bluetooth_...), //582 (0x246) ROOT - NULL_FUNC(sys_bt_read_firmware_version), //583 (0x247) ROOT - NULL_FUNC(sys_bt_complete_wake_on_host), //584 (0x248) ROOT - NULL_FUNC(sys_bt_disable_bluetooth), //585 (0x249) - NULL_FUNC(sys_bt_enable_bluetooth), //586 (0x24A) - NULL_FUNC(sys_bt_bccmd), //587 (0x24B) ROOT - NULL_FUNC(sys_bt_read_hq), //588 (0x24C) - NULL_FUNC(sys_bt_hid_get_remote_status), //589 (0x24D) - NULL_FUNC(sys_bt_register_controller), //590 (0x24E) ROOT - NULL_FUNC(sys_bt_clear_registered_contoller), //591 (0x24F) - NULL_FUNC(sys_bt_connect_accept_controller), //592 (0x250) - NULL_FUNC(sys_bt_get_local_bdaddress), //593 (0x251) ROOT - NULL_FUNC(sys_bt_hid_get_data), //594 (0x252) - NULL_FUNC(sys_bt_hid_set_report), //595 (0x253) - NULL_FUNC(sys_bt_sched_log), //596 (0x254) - NULL_FUNC(sys_bt_cancel_connect_accept_controller), //597 (0x255) - null_func,//BIND_SYSC(sys_bluetooth_...), //598 (0x256) ROOT - null_func,//BIND_SYSC(sys_bluetooth_...), //599 (0x257) ROOT - BIND_SYSC(sys_storage_open), //600 (0x258) ROOT - BIND_SYSC(sys_storage_close), //601 (0x259) - BIND_SYSC(sys_storage_read), //602 (0x25A) - BIND_SYSC(sys_storage_write), //603 (0x25B) - BIND_SYSC(sys_storage_send_device_command), //604 (0x25C) - BIND_SYSC(sys_storage_async_configure), //605 (0x25D) - BIND_SYSC(sys_storage_async_read), //606 (0x25E) - BIND_SYSC(sys_storage_async_write), //607 (0x25F) - BIND_SYSC(sys_storage_async_cancel), //608 (0x260) - BIND_SYSC(sys_storage_get_device_info), //609 (0x261) ROOT - BIND_SYSC(sys_storage_get_device_config), //610 (0x262) ROOT - BIND_SYSC(sys_storage_report_devices), //611 (0x263) ROOT - BIND_SYSC(sys_storage_configure_medium_event), //612 (0x264) ROOT - BIND_SYSC(sys_storage_set_medium_polling_interval), //613 (0x265) - BIND_SYSC(sys_storage_create_region), //614 (0x266) - BIND_SYSC(sys_storage_delete_region), //615 (0x267) - BIND_SYSC(sys_storage_execute_device_command), //616 (0x268) - BIND_SYSC(sys_storage_check_region_acl), //617 (0x269) - BIND_SYSC(sys_storage_set_region_acl), //618 (0x26A) - BIND_SYSC(sys_storage_async_send_device_command), //619 (0x26B) - null_func,//BIND_SYSC(sys_...), //620 (0x26C) ROOT - BIND_SYSC(sys_gamepad_ycon_if), //621 (0x26D) - BIND_SYSC(sys_storage_get_region_offset), //622 (0x26E) - BIND_SYSC(sys_storage_set_emulated_speed), //623 (0x26F) - BIND_SYSC(sys_io_buffer_create), //624 (0x270) - BIND_SYSC(sys_io_buffer_destroy), //625 (0x271) - BIND_SYSC(sys_io_buffer_allocate), //626 (0x272) - BIND_SYSC(sys_io_buffer_free), //627 (0x273) - uns_func, uns_func, //629 (0x275) UNS - BIND_SYSC(sys_gpio_set), //630 (0x276) - BIND_SYSC(sys_gpio_get), //631 (0x277) - uns_func, //632 (0x278) UNS - NULL_FUNC(sys_fsw_connect_event), //633 (0x279) - NULL_FUNC(sys_fsw_disconnect_event), //634 (0x27A) - BIND_SYSC(sys_btsetting_if), //635 (0x27B) - null_func,//BIND_SYSC(sys_...), //636 (0x27C) - null_func,//BIND_SYSC(sys_...), //637 (0x27D) - null_func,//BIND_SYSC(sys_...), //638 (0x27E) + BIND_SYSC(_sys_prx_load_module), // 480 (0x1E0) + BIND_SYSC(_sys_prx_start_module), // 481 (0x1E1) + BIND_SYSC(_sys_prx_stop_module), // 482 (0x1E2) + BIND_SYSC(_sys_prx_unload_module), // 483 (0x1E3) + BIND_SYSC(_sys_prx_register_module), // 484 (0x1E4) + BIND_SYSC(_sys_prx_query_module), // 485 (0x1E5) + BIND_SYSC(_sys_prx_register_library), // 486 (0x1E6) + BIND_SYSC(_sys_prx_unregister_library), // 487 (0x1E7) + BIND_SYSC(_sys_prx_link_library), // 488 (0x1E8) + BIND_SYSC(_sys_prx_unlink_library), // 489 (0x1E9) + BIND_SYSC(_sys_prx_query_library), // 490 (0x1EA) + uns_func, // 491 (0x1EB) UNS + NULL_FUNC(sys_prx_dbg_get_module_list), // 492 (0x1EC) DBG + NULL_FUNC(sys_prx_dbg_get_module_info), // 493 (0x1ED) DBG + BIND_SYSC(_sys_prx_get_module_list), // 494 (0x1EE) + BIND_SYSC(_sys_prx_get_module_info), // 495 (0x1EF) + BIND_SYSC(_sys_prx_get_module_id_by_name), // 496 (0x1F0) + BIND_SYSC(_sys_prx_load_module_on_memcontainer), // 497 (0x1F1) + BIND_SYSC(_sys_prx_start), // 498 (0x1F2) + BIND_SYSC(_sys_prx_stop), // 499 (0x1F3) + BIND_SYSC(sys_hid_manager_open), // 500 (0x1F4) + NULL_FUNC(sys_hid_manager_close), // 501 (0x1F5) + BIND_SYSC(sys_hid_manager_read), // 502 (0x1F6) ROOT + BIND_SYSC(sys_hid_manager_ioctl), // 503 (0x1F7) + NULL_FUNC(sys_hid_manager_map_logical_id_to_port_id), // 504 (0x1F8) ROOT + NULL_FUNC(sys_hid_manager_unmap_logical_id_to_port_id), // 505 (0x1F9) ROOT + BIND_SYSC(sys_hid_manager_add_hot_key_observer), // 506 (0x1FA) ROOT + NULL_FUNC(sys_hid_manager_remove_hot_key_observer), // 507 (0x1FB) ROOT + NULL_FUNC(sys_hid_manager_grab_focus), // 508 (0x1FC) ROOT + NULL_FUNC(sys_hid_manager_release_focus), // 509 (0x1FD) ROOT + BIND_SYSC(sys_hid_manager_check_focus), // 510 (0x1FE) + NULL_FUNC(sys_hid_manager_set_master_process), // 511 (0x1FF) ROOT + BIND_SYSC(sys_hid_manager_is_process_permission_root), // 512 (0x200) ROOT + BIND_SYSC(sys_hid_manager_513), // 513 (0x201) + BIND_SYSC(sys_hid_manager_514), // 514 (0x202) + uns_func, // 515 (0x203) UNS + BIND_SYSC(sys_config_open), // 516 (0x204) + BIND_SYSC(sys_config_close), // 517 (0x205) + BIND_SYSC(sys_config_get_service_event), // 518 (0x206) + BIND_SYSC(sys_config_add_service_listener), // 519 (0x207) + BIND_SYSC(sys_config_remove_service_listener), // 520 (0x208) + BIND_SYSC(sys_config_register_service), // 521 (0x209) + BIND_SYSC(sys_config_unregister_service), // 522 (0x20A) + BIND_SYSC(sys_config_get_io_event), // 523 (0x20B) + BIND_SYSC(sys_config_register_io_error_listener), // 524 (0x20C) + BIND_SYSC(sys_config_unregister_io_error_listener), // 525 (0x20D) + uns_func, uns_func, uns_func, uns_func, // 526-529 UNS + BIND_SYSC(sys_usbd_initialize), // 530 (0x212) + BIND_SYSC(sys_usbd_finalize), // 531 (0x213) + BIND_SYSC(sys_usbd_get_device_list), // 532 (0x214) + BIND_SYSC(sys_usbd_get_descriptor_size), // 533 (0x215) + BIND_SYSC(sys_usbd_get_descriptor), // 534 (0x216) + BIND_SYSC(sys_usbd_register_ldd), // 535 (0x217) + BIND_SYSC(sys_usbd_unregister_ldd), // 536 (0x218) + BIND_SYSC(sys_usbd_open_pipe), // 537 (0x219) + BIND_SYSC(sys_usbd_open_default_pipe), // 538 (0x21A) + BIND_SYSC(sys_usbd_close_pipe), // 539 (0x21B) + BIND_SYSC(sys_usbd_receive_event), // 540 (0x21C) + BIND_SYSC(sys_usbd_detect_event), // 541 (0x21D) + BIND_SYSC(sys_usbd_attach), // 542 (0x21E) + BIND_SYSC(sys_usbd_transfer_data), // 543 (0x21F) + BIND_SYSC(sys_usbd_isochronous_transfer_data), // 544 (0x220) + BIND_SYSC(sys_usbd_get_transfer_status), // 545 (0x221) + BIND_SYSC(sys_usbd_get_isochronous_transfer_status), // 546 (0x222) + BIND_SYSC(sys_usbd_get_device_location), // 547 (0x223) + BIND_SYSC(sys_usbd_send_event), // 548 (0x224) + BIND_SYSC(sys_usbd_event_port_send), // 549 (0x225) + BIND_SYSC(sys_usbd_allocate_memory), // 550 (0x226) + BIND_SYSC(sys_usbd_free_memory), // 551 (0x227) + null_func, // BIND_SYSC(sys_usbd_...), //552 (0x228) + null_func, // BIND_SYSC(sys_usbd_...), //553 (0x229) + null_func, // BIND_SYSC(sys_usbd_...), //554 (0x22A) + null_func, // BIND_SYSC(sys_usbd_...), //555 (0x22B) + BIND_SYSC(sys_usbd_get_device_speed), // 556 (0x22C) + null_func, // BIND_SYSC(sys_usbd_...), //557 (0x22D) + BIND_SYSC(sys_usbd_unregister_extra_ldd), // 558 (0x22E) + BIND_SYSC(sys_usbd_register_extra_ldd), // 559 (0x22F) + null_func, // BIND_SYSC(sys_...), //560 (0x230) ROOT + null_func, // BIND_SYSC(sys_...), //561 (0x231) ROOT + null_func, // BIND_SYSC(sys_...), //562 (0x232) ROOT + null_func, // BIND_SYSC(sys_...), //563 (0x233) + null_func, // BIND_SYSC(sys_...), //564 (0x234) + null_func, // BIND_SYSC(sys_...), //565 (0x235) + null_func, // BIND_SYSC(sys_...), //566 (0x236) + null_func, // BIND_SYSC(sys_...), //567 (0x237) + null_func, // BIND_SYSC(sys_...), //568 (0x238) + null_func, // BIND_SYSC(sys_...), //569 (0x239) + NULL_FUNC(sys_pad_ldd_register_controller), // 570 (0x23A) + NULL_FUNC(sys_pad_ldd_unregister_controller), // 571 (0x23B) + NULL_FUNC(sys_pad_ldd_data_insert), // 572 (0x23C) + NULL_FUNC(sys_pad_dbg_ldd_set_data_insert_mode), // 573 (0x23D) + NULL_FUNC(sys_pad_ldd_register_controller), // 574 (0x23E) + NULL_FUNC(sys_pad_ldd_get_port_no), // 575 (0x23F) + uns_func, // 576 (0x240) UNS + null_func, // BIND_SYSC(sys_pad_manager_...), //577 (0x241) ROOT PM + null_func, // BIND_SYSC(sys_bluetooth_...), //578 (0x242) + null_func, // BIND_SYSC(sys_bluetooth_aud_serial_...), //579 (0x243) + null_func, // BIND_SYSC(sys_bluetooth_...), //580 (0x244) ROOT + null_func, // BIND_SYSC(sys_bluetooth_...), //581 (0x245) ROOT + null_func, // BIND_SYSC(sys_bluetooth_...), //582 (0x246) ROOT + NULL_FUNC(sys_bt_read_firmware_version), // 583 (0x247) ROOT + NULL_FUNC(sys_bt_complete_wake_on_host), // 584 (0x248) ROOT + NULL_FUNC(sys_bt_disable_bluetooth), // 585 (0x249) + NULL_FUNC(sys_bt_enable_bluetooth), // 586 (0x24A) + NULL_FUNC(sys_bt_bccmd), // 587 (0x24B) ROOT + NULL_FUNC(sys_bt_read_hq), // 588 (0x24C) + NULL_FUNC(sys_bt_hid_get_remote_status), // 589 (0x24D) + NULL_FUNC(sys_bt_register_controller), // 590 (0x24E) ROOT + NULL_FUNC(sys_bt_clear_registered_contoller), // 591 (0x24F) + NULL_FUNC(sys_bt_connect_accept_controller), // 592 (0x250) + NULL_FUNC(sys_bt_get_local_bdaddress), // 593 (0x251) ROOT + NULL_FUNC(sys_bt_hid_get_data), // 594 (0x252) + NULL_FUNC(sys_bt_hid_set_report), // 595 (0x253) + NULL_FUNC(sys_bt_sched_log), // 596 (0x254) + NULL_FUNC(sys_bt_cancel_connect_accept_controller), // 597 (0x255) + null_func, // BIND_SYSC(sys_bluetooth_...), //598 (0x256) ROOT + null_func, // BIND_SYSC(sys_bluetooth_...), //599 (0x257) ROOT + BIND_SYSC(sys_storage_open), // 600 (0x258) ROOT + BIND_SYSC(sys_storage_close), // 601 (0x259) + BIND_SYSC(sys_storage_read), // 602 (0x25A) + BIND_SYSC(sys_storage_write), // 603 (0x25B) + BIND_SYSC(sys_storage_send_device_command), // 604 (0x25C) + BIND_SYSC(sys_storage_async_configure), // 605 (0x25D) + BIND_SYSC(sys_storage_async_read), // 606 (0x25E) + BIND_SYSC(sys_storage_async_write), // 607 (0x25F) + BIND_SYSC(sys_storage_async_cancel), // 608 (0x260) + BIND_SYSC(sys_storage_get_device_info), // 609 (0x261) ROOT + BIND_SYSC(sys_storage_get_device_config), // 610 (0x262) ROOT + BIND_SYSC(sys_storage_report_devices), // 611 (0x263) ROOT + BIND_SYSC(sys_storage_configure_medium_event), // 612 (0x264) ROOT + BIND_SYSC(sys_storage_set_medium_polling_interval), // 613 (0x265) + BIND_SYSC(sys_storage_create_region), // 614 (0x266) + BIND_SYSC(sys_storage_delete_region), // 615 (0x267) + BIND_SYSC(sys_storage_execute_device_command), // 616 (0x268) + BIND_SYSC(sys_storage_check_region_acl), // 617 (0x269) + BIND_SYSC(sys_storage_set_region_acl), // 618 (0x26A) + BIND_SYSC(sys_storage_async_send_device_command), // 619 (0x26B) + null_func, // BIND_SYSC(sys_...), //620 (0x26C) ROOT + BIND_SYSC(sys_gamepad_ycon_if), // 621 (0x26D) + BIND_SYSC(sys_storage_get_region_offset), // 622 (0x26E) + BIND_SYSC(sys_storage_set_emulated_speed), // 623 (0x26F) + BIND_SYSC(sys_io_buffer_create), // 624 (0x270) + BIND_SYSC(sys_io_buffer_destroy), // 625 (0x271) + BIND_SYSC(sys_io_buffer_allocate), // 626 (0x272) + BIND_SYSC(sys_io_buffer_free), // 627 (0x273) + uns_func, uns_func, // 629 (0x275) UNS + BIND_SYSC(sys_gpio_set), // 630 (0x276) + BIND_SYSC(sys_gpio_get), // 631 (0x277) + uns_func, // 632 (0x278) UNS + NULL_FUNC(sys_fsw_connect_event), // 633 (0x279) + NULL_FUNC(sys_fsw_disconnect_event), // 634 (0x27A) + BIND_SYSC(sys_btsetting_if), // 635 (0x27B) + null_func, // BIND_SYSC(sys_...), //636 (0x27C) + null_func, // BIND_SYSC(sys_...), //637 (0x27D) + null_func, // BIND_SYSC(sys_...), //638 (0x27E) - null_func,//BIND_SYSC(sys...), //639 DEPRECATED - NULL_FUNC(sys_usbbtaudio_initialize), //640 DEPRECATED - NULL_FUNC(sys_usbbtaudio_finalize), //641 DEPRECATED - NULL_FUNC(sys_usbbtaudio_discovery), //642 DEPRECATED - NULL_FUNC(sys_usbbtaudio_cancel_discovery), //643 DEPRECATED - NULL_FUNC(sys_usbbtaudio_pairing), //644 DEPRECATED - NULL_FUNC(sys_usbbtaudio_set_passkey), //645 DEPRECATED - NULL_FUNC(sys_usbbtaudio_connect), //646 DEPRECATED - NULL_FUNC(sys_usbbtaudio_disconnect), //647 DEPRECATED - null_func,//BIND_SYSC(sys_...), //648 DEPRECATED - null_func,//BIND_SYSC(sys_...), //649 DEPRECATED + null_func, // BIND_SYSC(sys...), //639 DEPRECATED + NULL_FUNC(sys_usbbtaudio_initialize), // 640 DEPRECATED + NULL_FUNC(sys_usbbtaudio_finalize), // 641 DEPRECATED + NULL_FUNC(sys_usbbtaudio_discovery), // 642 DEPRECATED + NULL_FUNC(sys_usbbtaudio_cancel_discovery), // 643 DEPRECATED + NULL_FUNC(sys_usbbtaudio_pairing), // 644 DEPRECATED + NULL_FUNC(sys_usbbtaudio_set_passkey), // 645 DEPRECATED + NULL_FUNC(sys_usbbtaudio_connect), // 646 DEPRECATED + NULL_FUNC(sys_usbbtaudio_disconnect), // 647 DEPRECATED + null_func, // BIND_SYSC(sys_...), //648 DEPRECATED + null_func, // BIND_SYSC(sys_...), //649 DEPRECATED - BIND_SYSC(sys_rsxaudio_initialize), //650 (0x28A) - BIND_SYSC(sys_rsxaudio_finalize), //651 (0x28B) - BIND_SYSC(sys_rsxaudio_import_shared_memory), //652 (0x28C) - BIND_SYSC(sys_rsxaudio_unimport_shared_memory), //653 (0x28D) - BIND_SYSC(sys_rsxaudio_create_connection), //654 (0x28E) - BIND_SYSC(sys_rsxaudio_close_connection), //655 (0x28F) - BIND_SYSC(sys_rsxaudio_prepare_process), //656 (0x290) - BIND_SYSC(sys_rsxaudio_start_process), //657 (0x291) - BIND_SYSC(sys_rsxaudio_stop_process), //658 (0x292) - BIND_SYSC(sys_rsxaudio_get_dma_param), //659 (0x293) + BIND_SYSC(sys_rsxaudio_initialize), // 650 (0x28A) + BIND_SYSC(sys_rsxaudio_finalize), // 651 (0x28B) + BIND_SYSC(sys_rsxaudio_import_shared_memory), // 652 (0x28C) + BIND_SYSC(sys_rsxaudio_unimport_shared_memory), // 653 (0x28D) + BIND_SYSC(sys_rsxaudio_create_connection), // 654 (0x28E) + BIND_SYSC(sys_rsxaudio_close_connection), // 655 (0x28F) + BIND_SYSC(sys_rsxaudio_prepare_process), // 656 (0x290) + BIND_SYSC(sys_rsxaudio_start_process), // 657 (0x291) + BIND_SYSC(sys_rsxaudio_stop_process), // 658 (0x292) + BIND_SYSC(sys_rsxaudio_get_dma_param), // 659 (0x293) - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //660-665 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 660-665 UNS - BIND_SYSC(sys_rsx_device_open), //666 (0x29A) - BIND_SYSC(sys_rsx_device_close), //667 (0x29B) - BIND_SYSC(sys_rsx_memory_allocate), //668 (0x29C) - BIND_SYSC(sys_rsx_memory_free), //669 (0x29D) - BIND_SYSC(sys_rsx_context_allocate), //670 (0x29E) - BIND_SYSC(sys_rsx_context_free), //671 (0x29F) - BIND_SYSC(sys_rsx_context_iomap), //672 (0x2A0) - BIND_SYSC(sys_rsx_context_iounmap), //673 (0x2A1) - BIND_SYSC(sys_rsx_context_attribute), //674 (0x2A2) - BIND_SYSC(sys_rsx_device_map), //675 (0x2A3) - BIND_SYSC(sys_rsx_device_unmap), //676 (0x2A4) - BIND_SYSC(sys_rsx_attribute), //677 (0x2A5) - null_func,//BIND_SYSC(sys_...), //678 (0x2A6) - null_func,//BIND_SYSC(sys_...), //679 (0x2A7) ROOT - null_func,//BIND_SYSC(sys_...), //680 (0x2A8) ROOT - null_func,//BIND_SYSC(sys_...), //681 (0x2A9) ROOT - null_func,//BIND_SYSC(sys_...), //682 (0x2AA) ROOT - null_func,//BIND_SYSC(sys_...), //683 (0x2AB) ROOT - null_func,//BIND_SYSC(sys_...), //684 (0x2AC) ROOT - null_func,//BIND_SYSC(sys_...), //685 (0x2AD) ROOT - null_func,//BIND_SYSC(sys_...), //686 (0x2AE) ROOT - null_func,//BIND_SYSC(sys_...), //687 (0x2AF) ROOT - null_func,//BIND_SYSC(sys_...), //688 (0x2B0) ROOT - null_func,//BIND_SYSC(sys_...), //689 (0x2B1) ROOT - null_func,//BIND_SYSC(sys_...), //690 (0x2B2) ROOT - null_func,//BIND_SYSC(sys_...), //691 (0x2B3) ROOT - null_func,//BIND_SYSC(sys_...), //692 (0x2B4) ROOT - null_func,//BIND_SYSC(sys_...), //693 (0x2B5) ROOT - null_func,//BIND_SYSC(sys_...), //694 (0x2B6) DEPRECATED - null_func,//BIND_SYSC(sys_...), //695 (0x2B7) DEPRECATED - null_func,//BIND_SYSC(sys_...), //696 (0x2B8) ROOT - uns_func,//BIND_SYSC(sys_...), //697 (0x2B9) UNS - uns_func,//BIND_SYSC(sys_...), //698 (0x2BA) UNS - BIND_SYSC(sys_bdemu_send_command), //699 (0x2BB) - BIND_SYSC(sys_net_bnet_accept), //700 (0x2BC) - BIND_SYSC(sys_net_bnet_bind), //701 (0x2BD) - BIND_SYSC(sys_net_bnet_connect), //702 (0x2BE) - BIND_SYSC(sys_net_bnet_getpeername), //703 (0x2BF) - BIND_SYSC(sys_net_bnet_getsockname), //704 (0x2C0) - BIND_SYSC(sys_net_bnet_getsockopt), //705 (0x2C1) - BIND_SYSC(sys_net_bnet_listen), //706 (0x2C2) - BIND_SYSC(sys_net_bnet_recvfrom), //707 (0x2C3) - BIND_SYSC(sys_net_bnet_recvmsg), //708 (0x2C4) - BIND_SYSC(sys_net_bnet_sendmsg), //709 (0x2C5) - BIND_SYSC(sys_net_bnet_sendto), //710 (0x2C6) - BIND_SYSC(sys_net_bnet_setsockopt), //711 (0x2C7) - BIND_SYSC(sys_net_bnet_shutdown), //712 (0x2C8) - BIND_SYSC(sys_net_bnet_socket), //713 (0x2C9) - BIND_SYSC(sys_net_bnet_close), //714 (0x2CA) - BIND_SYSC(sys_net_bnet_poll), //715 (0x2CB) - BIND_SYSC(sys_net_bnet_select), //716 (0x2CC) - BIND_SYSC(_sys_net_open_dump), //717 (0x2CD) - BIND_SYSC(_sys_net_read_dump), //718 (0x2CE) - BIND_SYSC(_sys_net_close_dump), //719 (0x2CF) - BIND_SYSC(_sys_net_write_dump), //720 (0x2D0) - BIND_SYSC(sys_net_abort), //721 (0x2D1) - BIND_SYSC(sys_net_infoctl), //722 (0x2D2) - BIND_SYSC(sys_net_control), //723 (0x2D3) - BIND_SYSC(sys_net_bnet_ioctl), //724 (0x2D4) - BIND_SYSC(sys_net_bnet_sysctl), //725 (0x2D5) - BIND_SYSC(sys_net_eurus_post_command), //726 (0x2D6) + BIND_SYSC(sys_rsx_device_open), // 666 (0x29A) + BIND_SYSC(sys_rsx_device_close), // 667 (0x29B) + BIND_SYSC(sys_rsx_memory_allocate), // 668 (0x29C) + BIND_SYSC(sys_rsx_memory_free), // 669 (0x29D) + BIND_SYSC(sys_rsx_context_allocate), // 670 (0x29E) + BIND_SYSC(sys_rsx_context_free), // 671 (0x29F) + BIND_SYSC(sys_rsx_context_iomap), // 672 (0x2A0) + BIND_SYSC(sys_rsx_context_iounmap), // 673 (0x2A1) + BIND_SYSC(sys_rsx_context_attribute), // 674 (0x2A2) + BIND_SYSC(sys_rsx_device_map), // 675 (0x2A3) + BIND_SYSC(sys_rsx_device_unmap), // 676 (0x2A4) + BIND_SYSC(sys_rsx_attribute), // 677 (0x2A5) + null_func, // BIND_SYSC(sys_...), //678 (0x2A6) + null_func, // BIND_SYSC(sys_...), //679 (0x2A7) ROOT + null_func, // BIND_SYSC(sys_...), //680 (0x2A8) ROOT + null_func, // BIND_SYSC(sys_...), //681 (0x2A9) ROOT + null_func, // BIND_SYSC(sys_...), //682 (0x2AA) ROOT + null_func, // BIND_SYSC(sys_...), //683 (0x2AB) ROOT + null_func, // BIND_SYSC(sys_...), //684 (0x2AC) ROOT + null_func, // BIND_SYSC(sys_...), //685 (0x2AD) ROOT + null_func, // BIND_SYSC(sys_...), //686 (0x2AE) ROOT + null_func, // BIND_SYSC(sys_...), //687 (0x2AF) ROOT + null_func, // BIND_SYSC(sys_...), //688 (0x2B0) ROOT + null_func, // BIND_SYSC(sys_...), //689 (0x2B1) ROOT + null_func, // BIND_SYSC(sys_...), //690 (0x2B2) ROOT + null_func, // BIND_SYSC(sys_...), //691 (0x2B3) ROOT + null_func, // BIND_SYSC(sys_...), //692 (0x2B4) ROOT + null_func, // BIND_SYSC(sys_...), //693 (0x2B5) ROOT + null_func, // BIND_SYSC(sys_...), //694 (0x2B6) DEPRECATED + null_func, // BIND_SYSC(sys_...), //695 (0x2B7) DEPRECATED + null_func, // BIND_SYSC(sys_...), //696 (0x2B8) ROOT + uns_func, // BIND_SYSC(sys_...), //697 (0x2B9) UNS + uns_func, // BIND_SYSC(sys_...), //698 (0x2BA) UNS + BIND_SYSC(sys_bdemu_send_command), // 699 (0x2BB) + BIND_SYSC(sys_net_bnet_accept), // 700 (0x2BC) + BIND_SYSC(sys_net_bnet_bind), // 701 (0x2BD) + BIND_SYSC(sys_net_bnet_connect), // 702 (0x2BE) + BIND_SYSC(sys_net_bnet_getpeername), // 703 (0x2BF) + BIND_SYSC(sys_net_bnet_getsockname), // 704 (0x2C0) + BIND_SYSC(sys_net_bnet_getsockopt), // 705 (0x2C1) + BIND_SYSC(sys_net_bnet_listen), // 706 (0x2C2) + BIND_SYSC(sys_net_bnet_recvfrom), // 707 (0x2C3) + BIND_SYSC(sys_net_bnet_recvmsg), // 708 (0x2C4) + BIND_SYSC(sys_net_bnet_sendmsg), // 709 (0x2C5) + BIND_SYSC(sys_net_bnet_sendto), // 710 (0x2C6) + BIND_SYSC(sys_net_bnet_setsockopt), // 711 (0x2C7) + BIND_SYSC(sys_net_bnet_shutdown), // 712 (0x2C8) + BIND_SYSC(sys_net_bnet_socket), // 713 (0x2C9) + BIND_SYSC(sys_net_bnet_close), // 714 (0x2CA) + BIND_SYSC(sys_net_bnet_poll), // 715 (0x2CB) + BIND_SYSC(sys_net_bnet_select), // 716 (0x2CC) + BIND_SYSC(_sys_net_open_dump), // 717 (0x2CD) + BIND_SYSC(_sys_net_read_dump), // 718 (0x2CE) + BIND_SYSC(_sys_net_close_dump), // 719 (0x2CF) + BIND_SYSC(_sys_net_write_dump), // 720 (0x2D0) + BIND_SYSC(sys_net_abort), // 721 (0x2D1) + BIND_SYSC(sys_net_infoctl), // 722 (0x2D2) + BIND_SYSC(sys_net_control), // 723 (0x2D3) + BIND_SYSC(sys_net_bnet_ioctl), // 724 (0x2D4) + BIND_SYSC(sys_net_bnet_sysctl), // 725 (0x2D5) + BIND_SYSC(sys_net_eurus_post_command), // 726 (0x2D6) - uns_func, uns_func, uns_func, //727-729 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //730-739 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //740-749 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //750-759 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //760-769 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //770-779 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //780-789 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //790-799 UNS + uns_func, uns_func, uns_func, // 727-729 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 730-739 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 740-749 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 750-759 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 760-769 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 770-779 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 780-789 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 790-799 UNS - BIND_SYSC(sys_fs_test), //800 (0x320) - BIND_SYSC(sys_fs_open), //801 (0x321) - BIND_SYSC(sys_fs_read), //802 (0x322) - BIND_SYSC(sys_fs_write), //803 (0x323) - BIND_SYSC(sys_fs_close), //804 (0x324) - BIND_SYSC(sys_fs_opendir), //805 (0x325) - BIND_SYSC(sys_fs_readdir), //806 (0x326) - BIND_SYSC(sys_fs_closedir), //807 (0x327) - BIND_SYSC(sys_fs_stat), //808 (0x328) - BIND_SYSC(sys_fs_fstat), //809 (0x329) - BIND_SYSC(sys_fs_link), //810 (0x32A) - BIND_SYSC(sys_fs_mkdir), //811 (0x32B) - BIND_SYSC(sys_fs_rename), //812 (0x32C) - BIND_SYSC(sys_fs_rmdir), //813 (0x32D) - BIND_SYSC(sys_fs_unlink), //814 (0x32E) - BIND_SYSC(sys_fs_utime), //815 (0x32F) - BIND_SYSC(sys_fs_access), //816 (0x330) - BIND_SYSC(sys_fs_fcntl), //817 (0x331) - BIND_SYSC(sys_fs_lseek), //818 (0x332) - BIND_SYSC(sys_fs_fdatasync), //819 (0x333) - BIND_SYSC(sys_fs_fsync), //820 (0x334) - BIND_SYSC(sys_fs_fget_block_size), //821 (0x335) - BIND_SYSC(sys_fs_get_block_size), //822 (0x336) - BIND_SYSC(sys_fs_acl_read), //823 (0x337) - BIND_SYSC(sys_fs_acl_write), //824 (0x338) - BIND_SYSC(sys_fs_lsn_get_cda_size), //825 (0x339) - BIND_SYSC(sys_fs_lsn_get_cda), //826 (0x33A) - BIND_SYSC(sys_fs_lsn_lock), //827 (0x33B) - BIND_SYSC(sys_fs_lsn_unlock), //828 (0x33C) - BIND_SYSC(sys_fs_lsn_read), //829 (0x33D) - BIND_SYSC(sys_fs_lsn_write), //830 (0x33E) - BIND_SYSC(sys_fs_truncate), //831 (0x33F) - BIND_SYSC(sys_fs_ftruncate), //832 (0x340) - BIND_SYSC(sys_fs_symbolic_link), //833 (0x341) - BIND_SYSC(sys_fs_chmod), //834 (0x342) - BIND_SYSC(sys_fs_chown), //835 (0x343) - BIND_SYSC(sys_fs_newfs), //836 (0x344) - BIND_SYSC(sys_fs_mount), //837 (0x345) - BIND_SYSC(sys_fs_unmount), //838 (0x346) - NULL_FUNC(sys_fs_sync), //839 (0x347) - BIND_SYSC(sys_fs_disk_free), //840 (0x348) - BIND_SYSC(sys_fs_get_mount_info_size), //841 (0x349) - BIND_SYSC(sys_fs_get_mount_info), //842 (0x34A) - NULL_FUNC(sys_fs_get_fs_info_size), //843 (0x34B) - NULL_FUNC(sys_fs_get_fs_info), //844 (0x34C) - BIND_SYSC(sys_fs_mapped_allocate), //845 (0x34D) - BIND_SYSC(sys_fs_mapped_free), //846 (0x34E) - BIND_SYSC(sys_fs_truncate2), //847 (0x34F) + BIND_SYSC(sys_fs_test), // 800 (0x320) + BIND_SYSC(sys_fs_open), // 801 (0x321) + BIND_SYSC(sys_fs_read), // 802 (0x322) + BIND_SYSC(sys_fs_write), // 803 (0x323) + BIND_SYSC(sys_fs_close), // 804 (0x324) + BIND_SYSC(sys_fs_opendir), // 805 (0x325) + BIND_SYSC(sys_fs_readdir), // 806 (0x326) + BIND_SYSC(sys_fs_closedir), // 807 (0x327) + BIND_SYSC(sys_fs_stat), // 808 (0x328) + BIND_SYSC(sys_fs_fstat), // 809 (0x329) + BIND_SYSC(sys_fs_link), // 810 (0x32A) + BIND_SYSC(sys_fs_mkdir), // 811 (0x32B) + BIND_SYSC(sys_fs_rename), // 812 (0x32C) + BIND_SYSC(sys_fs_rmdir), // 813 (0x32D) + BIND_SYSC(sys_fs_unlink), // 814 (0x32E) + BIND_SYSC(sys_fs_utime), // 815 (0x32F) + BIND_SYSC(sys_fs_access), // 816 (0x330) + BIND_SYSC(sys_fs_fcntl), // 817 (0x331) + BIND_SYSC(sys_fs_lseek), // 818 (0x332) + BIND_SYSC(sys_fs_fdatasync), // 819 (0x333) + BIND_SYSC(sys_fs_fsync), // 820 (0x334) + BIND_SYSC(sys_fs_fget_block_size), // 821 (0x335) + BIND_SYSC(sys_fs_get_block_size), // 822 (0x336) + BIND_SYSC(sys_fs_acl_read), // 823 (0x337) + BIND_SYSC(sys_fs_acl_write), // 824 (0x338) + BIND_SYSC(sys_fs_lsn_get_cda_size), // 825 (0x339) + BIND_SYSC(sys_fs_lsn_get_cda), // 826 (0x33A) + BIND_SYSC(sys_fs_lsn_lock), // 827 (0x33B) + BIND_SYSC(sys_fs_lsn_unlock), // 828 (0x33C) + BIND_SYSC(sys_fs_lsn_read), // 829 (0x33D) + BIND_SYSC(sys_fs_lsn_write), // 830 (0x33E) + BIND_SYSC(sys_fs_truncate), // 831 (0x33F) + BIND_SYSC(sys_fs_ftruncate), // 832 (0x340) + BIND_SYSC(sys_fs_symbolic_link), // 833 (0x341) + BIND_SYSC(sys_fs_chmod), // 834 (0x342) + BIND_SYSC(sys_fs_chown), // 835 (0x343) + BIND_SYSC(sys_fs_newfs), // 836 (0x344) + BIND_SYSC(sys_fs_mount), // 837 (0x345) + BIND_SYSC(sys_fs_unmount), // 838 (0x346) + NULL_FUNC(sys_fs_sync), // 839 (0x347) + BIND_SYSC(sys_fs_disk_free), // 840 (0x348) + BIND_SYSC(sys_fs_get_mount_info_size), // 841 (0x349) + BIND_SYSC(sys_fs_get_mount_info), // 842 (0x34A) + NULL_FUNC(sys_fs_get_fs_info_size), // 843 (0x34B) + NULL_FUNC(sys_fs_get_fs_info), // 844 (0x34C) + BIND_SYSC(sys_fs_mapped_allocate), // 845 (0x34D) + BIND_SYSC(sys_fs_mapped_free), // 846 (0x34E) + BIND_SYSC(sys_fs_truncate2), // 847 (0x34F) - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //848-853 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //854-859 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 848-853 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 854-859 UNS - NULL_FUNC(sys_ss_get_cache_of_analog_sunset_flag), //860 (0x35C) AUTHID - NULL_FUNC(sys_ss_protected_file_db), //861 ROOT - BIND_SYSC(sys_ss_virtual_trm_manager), //862 ROOT - BIND_SYSC(sys_ss_update_manager), //863 ROOT - NULL_FUNC(sys_ss_sec_hw_framework), //864 DBG - BIND_SYSC(sys_ss_random_number_generator), //865 (0x361) - BIND_SYSC(sys_ss_secure_rtc), //866 ROOT - BIND_SYSC(sys_ss_appliance_info_manager), //867 ROOT - BIND_SYSC(sys_ss_individual_info_manager), //868 ROOT / DBG AUTHID - NULL_FUNC(sys_ss_factory_data_manager), //869 ROOT - BIND_SYSC(sys_ss_get_console_id), //870 (0x366) - BIND_SYSC(sys_ss_access_control_engine), //871 (0x367) DBG - BIND_SYSC(sys_ss_get_open_psid), //872 (0x368) - BIND_SYSC(sys_ss_get_cache_of_product_mode), //873 (0x369) - BIND_SYSC(sys_ss_get_cache_of_flash_ext_flag), //874 (0x36A) - BIND_SYSC(sys_ss_get_boot_device), //875 (0x36B) - NULL_FUNC(sys_ss_disc_access_control), //876 (0x36C) - null_func, //BIND_SYSC(sys_ss_~utoken_if), //877 (0x36D) ROOT - NULL_FUNC(sys_ss_ad_sign), //878 (0x36E) - NULL_FUNC(sys_ss_media_id), //879 (0x36F) - NULL_FUNC(sys_deci3_open), //880 (0x370) - NULL_FUNC(sys_deci3_create_event_path), //881 (0x371) - NULL_FUNC(sys_deci3_close), //882 (0x372) - NULL_FUNC(sys_deci3_send), //883 (0x373) - NULL_FUNC(sys_deci3_receive), //884 (0x374) - NULL_FUNC(sys_deci3_open2), //885 (0x375) - uns_func, uns_func, uns_func, //886-888 UNS - null_func,//BIND_SYSC(sys_...), //889 (0x379) ROOT - NULL_FUNC(sys_deci3_initialize), //890 (0x37A) - NULL_FUNC(sys_deci3_terminate), //891 (0x37B) - NULL_FUNC(sys_deci3_debug_mode), //892 (0x37C) - NULL_FUNC(sys_deci3_show_status), //893 (0x37D) - NULL_FUNC(sys_deci3_echo_test), //894 (0x37E) - NULL_FUNC(sys_deci3_send_dcmp_packet), //895 (0x37F) - NULL_FUNC(sys_deci3_dump_cp_register), //896 (0x380) - NULL_FUNC(sys_deci3_dump_cp_buffer), //897 (0x381) - uns_func, //898 (0x382) UNS - NULL_FUNC(sys_deci3_test), //899 (0x383) - NULL_FUNC(sys_dbg_stop_processes), //900 (0x384) - NULL_FUNC(sys_dbg_continue_processes), //901 (0x385) - NULL_FUNC(sys_dbg_stop_threads), //902 (0x386) - NULL_FUNC(sys_dbg_continue_threads), //903 (0x387) - BIND_SYSC(sys_dbg_read_process_memory), //904 (0x388) - BIND_SYSC(sys_dbg_write_process_memory), //905 (0x389) - NULL_FUNC(sys_dbg_read_thread_register), //906 (0x38A) - NULL_FUNC(sys_dbg_write_thread_register), //907 (0x38B) - NULL_FUNC(sys_dbg_get_process_list), //908 (0x38C) - NULL_FUNC(sys_dbg_get_thread_list), //909 (0x38D) - NULL_FUNC(sys_dbg_get_thread_info), //910 (0x38E) - NULL_FUNC(sys_dbg_spu_thread_read_from_ls), //911 (0x38F) - NULL_FUNC(sys_dbg_spu_thread_write_to_ls), //912 (0x390) - NULL_FUNC(sys_dbg_kill_process), //913 (0x391) - NULL_FUNC(sys_dbg_get_process_info), //914 (0x392) - NULL_FUNC(sys_dbg_set_run_control_bit_to_spu), //915 (0x393) - NULL_FUNC(sys_dbg_spu_thread_get_exception_cause), //916 (0x394) - NULL_FUNC(sys_dbg_create_kernel_event_queue), //917 (0x395) - NULL_FUNC(sys_dbg_read_kernel_event_queue), //918 (0x396) - NULL_FUNC(sys_dbg_destroy_kernel_event_queue), //919 (0x397) - NULL_FUNC(sys_dbg_get_process_event_ctrl_flag), //920 (0x398) - NULL_FUNC(sys_dbg_set_process_event_cntl_flag), //921 (0x399) - NULL_FUNC(sys_dbg_get_spu_thread_group_event_cntl_flag),//922 (0x39A) - NULL_FUNC(sys_dbg_set_spu_thread_group_event_cntl_flag),//923 (0x39B) - NULL_FUNC(sys_dbg_get_module_list), //924 (0x39C) - NULL_FUNC(sys_dbg_get_raw_spu_list), //925 (0x39D) - NULL_FUNC(sys_dbg_initialize_scratch_executable_area), //926 (0x39E) - NULL_FUNC(sys_dbg_terminate_scratch_executable_area), //927 (0x3A0) - NULL_FUNC(sys_dbg_initialize_scratch_data_area), //928 (0x3A1) - NULL_FUNC(sys_dbg_terminate_scratch_data_area), //929 (0x3A2) - NULL_FUNC(sys_dbg_get_user_memory_stat), //930 (0x3A3) - NULL_FUNC(sys_dbg_get_shared_memory_attribute_list), //931 (0x3A4) - NULL_FUNC(sys_dbg_get_mutex_list), //932 (0x3A4) - NULL_FUNC(sys_dbg_get_mutex_information), //933 (0x3A5) - NULL_FUNC(sys_dbg_get_cond_list), //934 (0x3A6) - NULL_FUNC(sys_dbg_get_cond_information), //935 (0x3A7) - NULL_FUNC(sys_dbg_get_rwlock_list), //936 (0x3A8) - NULL_FUNC(sys_dbg_get_rwlock_information), //937 (0x3A9) - NULL_FUNC(sys_dbg_get_lwmutex_list), //938 (0x3AA) - NULL_FUNC(sys_dbg_get_address_from_dabr), //939 (0x3AB) - NULL_FUNC(sys_dbg_set_address_to_dabr), //940 (0x3AC) - NULL_FUNC(sys_dbg_get_lwmutex_information), //941 (0x3AD) - NULL_FUNC(sys_dbg_get_event_queue_list), //942 (0x3AE) - NULL_FUNC(sys_dbg_get_event_queue_information), //943 (0x3AF) - NULL_FUNC(sys_dbg_initialize_ppu_exception_handler), //944 (0x3B0) - NULL_FUNC(sys_dbg_finalize_ppu_exception_handler), //945 (0x3B1) DBG - NULL_FUNC(sys_dbg_get_semaphore_list), //946 (0x3B2) - NULL_FUNC(sys_dbg_get_semaphore_information), //947 (0x3B3) - NULL_FUNC(sys_dbg_get_kernel_thread_list), //948 (0x3B4) - NULL_FUNC(sys_dbg_get_kernel_thread_info), //949 (0x3B5) - NULL_FUNC(sys_dbg_get_lwcond_list), //950 (0x3B6) - NULL_FUNC(sys_dbg_get_lwcond_information), //951 (0x3B7) - NULL_FUNC(sys_dbg_create_scratch_data_area_ext), //952 (0x3B8) - NULL_FUNC(sys_dbg_vm_get_page_information), //953 (0x3B9) - NULL_FUNC(sys_dbg_vm_get_info), //954 (0x3BA) - NULL_FUNC(sys_dbg_enable_floating_point_enabled_exception),//955 (0x3BB) - NULL_FUNC(sys_dbg_disable_floating_point_enabled_exception),//956 (0x3BC) - NULL_FUNC(sys_dbg_get_process_memory_container_information),//957 (0x3BD) - uns_func, //958 (0x3BE) UNS - null_func,//BIND_SYSC(sys_dbg_...), //959 (0x3BF) - NULL_FUNC(sys_control_performance_monitor), //960 (0x3C0) - NULL_FUNC(sys_performance_monitor_hidden), //961 (0x3C1) - NULL_FUNC(sys_performance_monitor_bookmark), //962 (0x3C2) - NULL_FUNC(sys_lv1_pc_trace_create), //963 (0x3C3) - NULL_FUNC(sys_lv1_pc_trace_start), //964 (0x3C4) - NULL_FUNC(sys_lv1_pc_trace_stop), //965 (0x3C5) - NULL_FUNC(sys_lv1_pc_trace_get_status), //966 (0x3C6) - NULL_FUNC(sys_lv1_pc_trace_destroy), //967 (0x3C7) - NULL_FUNC(sys_rsx_trace_ioctl), //968 (0x3C8) - null_func,//BIND_SYSC(sys_dbg_...), //969 (0x3C9) - NULL_FUNC(sys_dbg_get_event_flag_list), //970 (0x3CA) - NULL_FUNC(sys_dbg_get_event_flag_information), //971 (0x3CB) - null_func,//BIND_SYSC(sys_dbg_...), //972 (0x3CC) - uns_func,//BIND_SYSC(sys_dbg_...), //973 (0x3CD) - null_func,//BIND_SYSC(sys_dbg_...), //974 (0x3CE) - NULL_FUNC(sys_dbg_read_spu_thread_context2), //975 (0x3CF) - BIND_SYSC(sys_crypto_engine_create), //976 (0x3D0) - BIND_SYSC(sys_crypto_engine_destroy), //977 (0x3D1) - NULL_FUNC(sys_crypto_engine_hasher_prepare), //978 (0x3D2) ROOT - NULL_FUNC(sys_crypto_engine_hasher_run), //979 (0x3D3) - NULL_FUNC(sys_crypto_engine_hasher_get_hash), //980 (0x3D4) - NULL_FUNC(sys_crypto_engine_cipher_prepare), //981 (0x3D5) ROOT - NULL_FUNC(sys_crypto_engine_cipher_run), //982 (0x3D6) - NULL_FUNC(sys_crypto_engine_cipher_get_hash), //983 (0x3D7) - BIND_SYSC(sys_crypto_engine_random_generate), //984 (0x3D8) - NULL_FUNC(sys_dbg_get_console_type), //985 (0x3D9) ROOT - null_func,//BIND_SYSC(sys_dbg_...), //986 (0x3DA) ROOT DBG - null_func,//BIND_SYSC(sys_dbg_...), //987 (0x3DB) ROOT - null_func,//BIND_SYSC(sys_dbg_..._ppu_exception_handler) //988 (0x3DC) - null_func,//BIND_SYSC(sys_dbg_...), //989 (0x3DD) + NULL_FUNC(sys_ss_get_cache_of_analog_sunset_flag), // 860 (0x35C) AUTHID + NULL_FUNC(sys_ss_protected_file_db), // 861 ROOT + BIND_SYSC(sys_ss_virtual_trm_manager), // 862 ROOT + BIND_SYSC(sys_ss_update_manager), // 863 ROOT + NULL_FUNC(sys_ss_sec_hw_framework), // 864 DBG + BIND_SYSC(sys_ss_random_number_generator), // 865 (0x361) + BIND_SYSC(sys_ss_secure_rtc), // 866 ROOT + BIND_SYSC(sys_ss_appliance_info_manager), // 867 ROOT + BIND_SYSC(sys_ss_individual_info_manager), // 868 ROOT / DBG AUTHID + NULL_FUNC(sys_ss_factory_data_manager), // 869 ROOT + BIND_SYSC(sys_ss_get_console_id), // 870 (0x366) + BIND_SYSC(sys_ss_access_control_engine), // 871 (0x367) DBG + BIND_SYSC(sys_ss_get_open_psid), // 872 (0x368) + BIND_SYSC(sys_ss_get_cache_of_product_mode), // 873 (0x369) + BIND_SYSC(sys_ss_get_cache_of_flash_ext_flag), // 874 (0x36A) + BIND_SYSC(sys_ss_get_boot_device), // 875 (0x36B) + NULL_FUNC(sys_ss_disc_access_control), // 876 (0x36C) + null_func, // BIND_SYSC(sys_ss_~utoken_if), //877 (0x36D) ROOT + NULL_FUNC(sys_ss_ad_sign), // 878 (0x36E) + NULL_FUNC(sys_ss_media_id), // 879 (0x36F) + NULL_FUNC(sys_deci3_open), // 880 (0x370) + NULL_FUNC(sys_deci3_create_event_path), // 881 (0x371) + NULL_FUNC(sys_deci3_close), // 882 (0x372) + NULL_FUNC(sys_deci3_send), // 883 (0x373) + NULL_FUNC(sys_deci3_receive), // 884 (0x374) + NULL_FUNC(sys_deci3_open2), // 885 (0x375) + uns_func, uns_func, uns_func, // 886-888 UNS + null_func, // BIND_SYSC(sys_...), //889 (0x379) ROOT + NULL_FUNC(sys_deci3_initialize), // 890 (0x37A) + NULL_FUNC(sys_deci3_terminate), // 891 (0x37B) + NULL_FUNC(sys_deci3_debug_mode), // 892 (0x37C) + NULL_FUNC(sys_deci3_show_status), // 893 (0x37D) + NULL_FUNC(sys_deci3_echo_test), // 894 (0x37E) + NULL_FUNC(sys_deci3_send_dcmp_packet), // 895 (0x37F) + NULL_FUNC(sys_deci3_dump_cp_register), // 896 (0x380) + NULL_FUNC(sys_deci3_dump_cp_buffer), // 897 (0x381) + uns_func, // 898 (0x382) UNS + NULL_FUNC(sys_deci3_test), // 899 (0x383) + NULL_FUNC(sys_dbg_stop_processes), // 900 (0x384) + NULL_FUNC(sys_dbg_continue_processes), // 901 (0x385) + NULL_FUNC(sys_dbg_stop_threads), // 902 (0x386) + NULL_FUNC(sys_dbg_continue_threads), // 903 (0x387) + BIND_SYSC(sys_dbg_read_process_memory), // 904 (0x388) + BIND_SYSC(sys_dbg_write_process_memory), // 905 (0x389) + NULL_FUNC(sys_dbg_read_thread_register), // 906 (0x38A) + NULL_FUNC(sys_dbg_write_thread_register), // 907 (0x38B) + NULL_FUNC(sys_dbg_get_process_list), // 908 (0x38C) + NULL_FUNC(sys_dbg_get_thread_list), // 909 (0x38D) + NULL_FUNC(sys_dbg_get_thread_info), // 910 (0x38E) + NULL_FUNC(sys_dbg_spu_thread_read_from_ls), // 911 (0x38F) + NULL_FUNC(sys_dbg_spu_thread_write_to_ls), // 912 (0x390) + NULL_FUNC(sys_dbg_kill_process), // 913 (0x391) + NULL_FUNC(sys_dbg_get_process_info), // 914 (0x392) + NULL_FUNC(sys_dbg_set_run_control_bit_to_spu), // 915 (0x393) + NULL_FUNC(sys_dbg_spu_thread_get_exception_cause), // 916 (0x394) + NULL_FUNC(sys_dbg_create_kernel_event_queue), // 917 (0x395) + NULL_FUNC(sys_dbg_read_kernel_event_queue), // 918 (0x396) + NULL_FUNC(sys_dbg_destroy_kernel_event_queue), // 919 (0x397) + NULL_FUNC(sys_dbg_get_process_event_ctrl_flag), // 920 (0x398) + NULL_FUNC(sys_dbg_set_process_event_cntl_flag), // 921 (0x399) + NULL_FUNC(sys_dbg_get_spu_thread_group_event_cntl_flag), // 922 (0x39A) + NULL_FUNC(sys_dbg_set_spu_thread_group_event_cntl_flag), // 923 (0x39B) + NULL_FUNC(sys_dbg_get_module_list), // 924 (0x39C) + NULL_FUNC(sys_dbg_get_raw_spu_list), // 925 (0x39D) + NULL_FUNC(sys_dbg_initialize_scratch_executable_area), // 926 (0x39E) + NULL_FUNC(sys_dbg_terminate_scratch_executable_area), // 927 (0x3A0) + NULL_FUNC(sys_dbg_initialize_scratch_data_area), // 928 (0x3A1) + NULL_FUNC(sys_dbg_terminate_scratch_data_area), // 929 (0x3A2) + NULL_FUNC(sys_dbg_get_user_memory_stat), // 930 (0x3A3) + NULL_FUNC(sys_dbg_get_shared_memory_attribute_list), // 931 (0x3A4) + NULL_FUNC(sys_dbg_get_mutex_list), // 932 (0x3A4) + NULL_FUNC(sys_dbg_get_mutex_information), // 933 (0x3A5) + NULL_FUNC(sys_dbg_get_cond_list), // 934 (0x3A6) + NULL_FUNC(sys_dbg_get_cond_information), // 935 (0x3A7) + NULL_FUNC(sys_dbg_get_rwlock_list), // 936 (0x3A8) + NULL_FUNC(sys_dbg_get_rwlock_information), // 937 (0x3A9) + NULL_FUNC(sys_dbg_get_lwmutex_list), // 938 (0x3AA) + NULL_FUNC(sys_dbg_get_address_from_dabr), // 939 (0x3AB) + NULL_FUNC(sys_dbg_set_address_to_dabr), // 940 (0x3AC) + NULL_FUNC(sys_dbg_get_lwmutex_information), // 941 (0x3AD) + NULL_FUNC(sys_dbg_get_event_queue_list), // 942 (0x3AE) + NULL_FUNC(sys_dbg_get_event_queue_information), // 943 (0x3AF) + NULL_FUNC(sys_dbg_initialize_ppu_exception_handler), // 944 (0x3B0) + NULL_FUNC(sys_dbg_finalize_ppu_exception_handler), // 945 (0x3B1) DBG + NULL_FUNC(sys_dbg_get_semaphore_list), // 946 (0x3B2) + NULL_FUNC(sys_dbg_get_semaphore_information), // 947 (0x3B3) + NULL_FUNC(sys_dbg_get_kernel_thread_list), // 948 (0x3B4) + NULL_FUNC(sys_dbg_get_kernel_thread_info), // 949 (0x3B5) + NULL_FUNC(sys_dbg_get_lwcond_list), // 950 (0x3B6) + NULL_FUNC(sys_dbg_get_lwcond_information), // 951 (0x3B7) + NULL_FUNC(sys_dbg_create_scratch_data_area_ext), // 952 (0x3B8) + NULL_FUNC(sys_dbg_vm_get_page_information), // 953 (0x3B9) + NULL_FUNC(sys_dbg_vm_get_info), // 954 (0x3BA) + NULL_FUNC(sys_dbg_enable_floating_point_enabled_exception), // 955 (0x3BB) + NULL_FUNC(sys_dbg_disable_floating_point_enabled_exception), // 956 (0x3BC) + NULL_FUNC(sys_dbg_get_process_memory_container_information), // 957 (0x3BD) + uns_func, // 958 (0x3BE) UNS + null_func, // BIND_SYSC(sys_dbg_...), //959 (0x3BF) + NULL_FUNC(sys_control_performance_monitor), // 960 (0x3C0) + NULL_FUNC(sys_performance_monitor_hidden), // 961 (0x3C1) + NULL_FUNC(sys_performance_monitor_bookmark), // 962 (0x3C2) + NULL_FUNC(sys_lv1_pc_trace_create), // 963 (0x3C3) + NULL_FUNC(sys_lv1_pc_trace_start), // 964 (0x3C4) + NULL_FUNC(sys_lv1_pc_trace_stop), // 965 (0x3C5) + NULL_FUNC(sys_lv1_pc_trace_get_status), // 966 (0x3C6) + NULL_FUNC(sys_lv1_pc_trace_destroy), // 967 (0x3C7) + NULL_FUNC(sys_rsx_trace_ioctl), // 968 (0x3C8) + null_func, // BIND_SYSC(sys_dbg_...), //969 (0x3C9) + NULL_FUNC(sys_dbg_get_event_flag_list), // 970 (0x3CA) + NULL_FUNC(sys_dbg_get_event_flag_information), // 971 (0x3CB) + null_func, // BIND_SYSC(sys_dbg_...), //972 (0x3CC) + uns_func, // BIND_SYSC(sys_dbg_...), //973 (0x3CD) + null_func, // BIND_SYSC(sys_dbg_...), //974 (0x3CE) + NULL_FUNC(sys_dbg_read_spu_thread_context2), // 975 (0x3CF) + BIND_SYSC(sys_crypto_engine_create), // 976 (0x3D0) + BIND_SYSC(sys_crypto_engine_destroy), // 977 (0x3D1) + NULL_FUNC(sys_crypto_engine_hasher_prepare), // 978 (0x3D2) ROOT + NULL_FUNC(sys_crypto_engine_hasher_run), // 979 (0x3D3) + NULL_FUNC(sys_crypto_engine_hasher_get_hash), // 980 (0x3D4) + NULL_FUNC(sys_crypto_engine_cipher_prepare), // 981 (0x3D5) ROOT + NULL_FUNC(sys_crypto_engine_cipher_run), // 982 (0x3D6) + NULL_FUNC(sys_crypto_engine_cipher_get_hash), // 983 (0x3D7) + BIND_SYSC(sys_crypto_engine_random_generate), // 984 (0x3D8) + NULL_FUNC(sys_dbg_get_console_type), // 985 (0x3D9) ROOT + null_func, // BIND_SYSC(sys_dbg_...), //986 (0x3DA) ROOT DBG + null_func, // BIND_SYSC(sys_dbg_...), //987 (0x3DB) ROOT + null_func, // BIND_SYSC(sys_dbg_..._ppu_exception_handler) //988 (0x3DC) + null_func, // BIND_SYSC(sys_dbg_...), //989 (0x3DD) - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //990-998 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //999-1007 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //1008-1016 UNS - uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, //1020-1023 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 990-998 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 999-1007 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 1008-1016 UNS + uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, uns_func, // 1020-1023 UNS }; #undef BIND_SYSC @@ -995,8 +993,7 @@ enum SceNpError : u32; template constexpr auto formatter_of = std::make_pair(EnumMin, &fmt_class_string::format); -const std::map s_error_codes_formatting_by_type -{ +const std::map s_error_codes_formatting_by_type{ formatter_of<0x80610000, CellAdecError>, formatter_of<0x80612100, CellAdecError>, formatter_of<0x80610300, CellAtracError>, @@ -1021,7 +1018,7 @@ const std::map s_error_codes_formatting_by_type formatter_of<0x80029500, SceNpError>, }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { // Test if can be formatted by this formatter @@ -1046,75 +1043,75 @@ void fmt_class_string::format(std::string& out, u64 arg) } format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(CELL_EAGAIN); - STR_CASE(CELL_EINVAL); - STR_CASE(CELL_ENOSYS); - STR_CASE(CELL_ENOMEM); - STR_CASE(CELL_ESRCH); - STR_CASE(CELL_ENOENT); - STR_CASE(CELL_ENOEXEC); - STR_CASE(CELL_EDEADLK); - STR_CASE(CELL_EPERM); - STR_CASE(CELL_EBUSY); - STR_CASE(CELL_ETIMEDOUT); - STR_CASE(CELL_EABORT); - STR_CASE(CELL_EFAULT); - STR_CASE(CELL_ENOCHILD); - STR_CASE(CELL_ESTAT); - STR_CASE(CELL_EALIGN); - STR_CASE(CELL_EKRESOURCE); - STR_CASE(CELL_EISDIR); - STR_CASE(CELL_ECANCELED); - STR_CASE(CELL_EEXIST); - STR_CASE(CELL_EISCONN); - STR_CASE(CELL_ENOTCONN); - STR_CASE(CELL_EAUTHFAIL); - STR_CASE(CELL_ENOTMSELF); - STR_CASE(CELL_ESYSVER); - STR_CASE(CELL_EAUTHFATAL); - STR_CASE(CELL_EDOM); - STR_CASE(CELL_ERANGE); - STR_CASE(CELL_EILSEQ); - STR_CASE(CELL_EFPOS); - STR_CASE(CELL_EINTR); - STR_CASE(CELL_EFBIG); - STR_CASE(CELL_EMLINK); - STR_CASE(CELL_ENFILE); - STR_CASE(CELL_ENOSPC); - STR_CASE(CELL_ENOTTY); - STR_CASE(CELL_EPIPE); - STR_CASE(CELL_EROFS); - STR_CASE(CELL_ESPIPE); - STR_CASE(CELL_E2BIG); - STR_CASE(CELL_EACCES); - STR_CASE(CELL_EBADF); - STR_CASE(CELL_EIO); - STR_CASE(CELL_EMFILE); - STR_CASE(CELL_ENODEV); - STR_CASE(CELL_ENOTDIR); - STR_CASE(CELL_ENXIO); - STR_CASE(CELL_EXDEV); - STR_CASE(CELL_EBADMSG); - STR_CASE(CELL_EINPROGRESS); - STR_CASE(CELL_EMSGSIZE); - STR_CASE(CELL_ENAMETOOLONG); - STR_CASE(CELL_ENOLCK); - STR_CASE(CELL_ENOTEMPTY); - STR_CASE(CELL_ENOTSUP); - STR_CASE(CELL_EFSSPECIFIC); - STR_CASE(CELL_EOVERFLOW); - STR_CASE(CELL_ENOTMOUNTED); - STR_CASE(CELL_ENOTSDATA); - STR_CASE(CELL_ESDKVER); - STR_CASE(CELL_ENOLICDISC); - STR_CASE(CELL_ENOLICENT); - } + switch (error) + { + STR_CASE(CELL_EAGAIN); + STR_CASE(CELL_EINVAL); + STR_CASE(CELL_ENOSYS); + STR_CASE(CELL_ENOMEM); + STR_CASE(CELL_ESRCH); + STR_CASE(CELL_ENOENT); + STR_CASE(CELL_ENOEXEC); + STR_CASE(CELL_EDEADLK); + STR_CASE(CELL_EPERM); + STR_CASE(CELL_EBUSY); + STR_CASE(CELL_ETIMEDOUT); + STR_CASE(CELL_EABORT); + STR_CASE(CELL_EFAULT); + STR_CASE(CELL_ENOCHILD); + STR_CASE(CELL_ESTAT); + STR_CASE(CELL_EALIGN); + STR_CASE(CELL_EKRESOURCE); + STR_CASE(CELL_EISDIR); + STR_CASE(CELL_ECANCELED); + STR_CASE(CELL_EEXIST); + STR_CASE(CELL_EISCONN); + STR_CASE(CELL_ENOTCONN); + STR_CASE(CELL_EAUTHFAIL); + STR_CASE(CELL_ENOTMSELF); + STR_CASE(CELL_ESYSVER); + STR_CASE(CELL_EAUTHFATAL); + STR_CASE(CELL_EDOM); + STR_CASE(CELL_ERANGE); + STR_CASE(CELL_EILSEQ); + STR_CASE(CELL_EFPOS); + STR_CASE(CELL_EINTR); + STR_CASE(CELL_EFBIG); + STR_CASE(CELL_EMLINK); + STR_CASE(CELL_ENFILE); + STR_CASE(CELL_ENOSPC); + STR_CASE(CELL_ENOTTY); + STR_CASE(CELL_EPIPE); + STR_CASE(CELL_EROFS); + STR_CASE(CELL_ESPIPE); + STR_CASE(CELL_E2BIG); + STR_CASE(CELL_EACCES); + STR_CASE(CELL_EBADF); + STR_CASE(CELL_EIO); + STR_CASE(CELL_EMFILE); + STR_CASE(CELL_ENODEV); + STR_CASE(CELL_ENOTDIR); + STR_CASE(CELL_ENXIO); + STR_CASE(CELL_EXDEV); + STR_CASE(CELL_EBADMSG); + STR_CASE(CELL_EINPROGRESS); + STR_CASE(CELL_EMSGSIZE); + STR_CASE(CELL_ENAMETOOLONG); + STR_CASE(CELL_ENOLCK); + STR_CASE(CELL_ENOTEMPTY); + STR_CASE(CELL_ENOTSUP); + STR_CASE(CELL_EFSSPECIFIC); + STR_CASE(CELL_EOVERFLOW); + STR_CASE(CELL_ENOTMOUNTED); + STR_CASE(CELL_ENOTSDATA); + STR_CASE(CELL_ESDKVER); + STR_CASE(CELL_ENOLICDISC); + STR_CASE(CELL_ENOLICENT); + } - return unknown; - }); + return unknown; + }); } stx::init_lock acquire_lock(stx::init_mutex& mtx, ppu_thread* ppu) @@ -1125,18 +1122,19 @@ stx::init_lock acquire_lock(stx::init_mutex& mtx, ppu_thread* ppu) } return mtx.init([](int invoke_count, const stx::init_lock&, ppu_thread* ppu) - { - if (!invoke_count) { - // Sleep before waiting on lock - lv2_obj::sleep(*ppu); - } - else - { - // Wake up after acquistion or failure to acquire - ppu->check_state(); - } - }, ppu); + if (!invoke_count) + { + // Sleep before waiting on lock + lv2_obj::sleep(*ppu); + } + else + { + // Wake up after acquistion or failure to acquire + ppu->check_state(); + } + }, + ppu); } stx::access_lock acquire_access_lock(stx::init_mutex& mtx, ppu_thread* ppu) @@ -1158,18 +1156,19 @@ stx::reset_lock acquire_reset_lock(stx::init_mutex& mtx, ppu_thread* ppu) } return mtx.reset([](int invoke_count, const stx::init_lock&, ppu_thread* ppu) - { - if (!invoke_count) { - // Sleep before waiting on lock - lv2_obj::sleep(*ppu); - } - else - { - // Wake up after acquistion or failure to acquire - ppu->check_state(); - } - }, ppu); + if (!invoke_count) + { + // Sleep before waiting on lock + lv2_obj::sleep(*ppu); + } + else + { + // Wake up after acquistion or failure to acquire + ppu->check_state(); + } + }, + ppu); } class ppu_syscall_usage @@ -1321,7 +1320,11 @@ std::string lv2_obj::name64(u64 name_u64) // NTS string, ignore invalid/newline characters // Example: "lv2\n\0tx" will be printed as "lv2" std::string str{ptr, std::find(ptr, ptr + 7, '\0')}; - str.erase(std::remove_if(str.begin(), str.end(), [](uchar c){ return !std::isprint(c); }), str.end()); + str.erase(std::remove_if(str.begin(), str.end(), [](uchar c) + { + return !std::isprint(c); + }), + str.end()); return str; } @@ -1483,13 +1486,13 @@ bool lv2_obj::sleep_unlocked(cpu_thread& thread, u64 timeout, u64 current_time) // All threads are ready, wake threads Emu.CallFromMainThread([] - { - if (Emu.IsStarting()) { - // It uses lv2_obj::g_mutex, run it on main thread - Emu.FinalizeRunRequest(); - } - }); + if (Emu.IsStarting()) + { + // It uses lv2_obj::g_mutex, run it on main thread + Emu.FinalizeRunRequest(); + } + }); } }; @@ -1512,18 +1515,18 @@ bool lv2_obj::sleep_unlocked(cpu_thread& thread, u64 timeout, u64 current_time) } const auto [_, ok] = ppu->state.fetch_op([&](bs_t& val) - { - if (!(val & cpu_flag::signal)) { - val += cpu_flag::suspend; + if (!(val & cpu_flag::signal)) + { + val += cpu_flag::suspend; - // Flag used for forced timeout notification - ensure(!timeout || !(val & cpu_flag::notify)); - return true; - } + // Flag used for forced timeout notification + ensure(!timeout || !(val & cpu_flag::notify)); + return true; + } - return false; - }); + return false; + }); if (!ok) { @@ -1603,18 +1606,18 @@ bool lv2_obj::awake_unlocked(cpu_thread* cpu, s32 prio) } prio.atomic_op([&](ppu_thread::ppu_prio_t& prio) - { - prio.prio = value; + { + prio.prio = value; - if (increment_order_first) - { - prio.order = ~tag; - } - else if (increment_order_last) - { - prio.order = tag; - } - }); + if (increment_order_first) + { + prio.order = ~tag; + } + else if (increment_order_last) + { + prio.order = tag; + } + }); }; const s64 old_prio = static_cast(cpu)->prio.load().prio; @@ -1755,15 +1758,16 @@ bool lv2_obj::awake_unlocked(cpu_thread* cpu, s32 prio) lowest_new_priority = std::min(static_cast(cpu)->prio.load().prio, lowest_new_priority); } } - else for (const auto _cpu : g_to_awake) - { - // Emplace threads from list - if (emplace_thread(_cpu)) + else + for (const auto _cpu : g_to_awake) { - changed_queue = true; - lowest_new_priority = std::min(static_cast(_cpu)->prio.load().prio, lowest_new_priority); + // Emplace threads from list + if (emplace_thread(_cpu)) + { + changed_queue = true; + lowest_new_priority = std::min(static_cast(_cpu)->prio.load().prio, lowest_new_priority); + } } - } auto target = +g_ppu; usz i = 0; @@ -1856,7 +1860,7 @@ void lv2_obj::schedule_all(u64 current_time) target->start_time = 0; - if ((target->state.fetch_op(AOFN(x += cpu_flag::signal, x -= cpu_flag::suspend, x-= remove_yield, void())) & (cpu_flag::wait + cpu_flag::signal)) != cpu_flag::wait) + if ((target->state.fetch_op(AOFN(x += cpu_flag::signal, x -= cpu_flag::suspend, x -= remove_yield, void())) & (cpu_flag::wait + cpu_flag::signal)) != cpu_flag::wait) { continue; } @@ -1982,13 +1986,13 @@ std::pair lv2_obj::ppu_state(ppu_thread* ppu, bool lock_ if (!Emu.IsReady() ? ppu->state.all_of(cpu_flag::stop) : ppu->stop_flag_removal_protection) { - return { PPU_THREAD_STATUS_IDLE, 0}; + return {PPU_THREAD_STATUS_IDLE, 0}; } switch (ppu->joiner) { - case ppu_join_status::zombie: return { PPU_THREAD_STATUS_ZOMBIE, 0}; - case ppu_join_status::exited: return { PPU_THREAD_STATUS_DELETED, 0}; + case ppu_join_status::zombie: return {PPU_THREAD_STATUS_ZOMBIE, 0}; + case ppu_join_status::exited: return {PPU_THREAD_STATUS_DELETED, 0}; default: break; } @@ -2013,18 +2017,18 @@ std::pair lv2_obj::ppu_state(ppu_thread* ppu, bool lock_ { if (!ppu->interrupt_thread_executing) { - return { PPU_THREAD_STATUS_STOP, 0}; + return {PPU_THREAD_STATUS_STOP, 0}; } - return { PPU_THREAD_STATUS_SLEEP, 0 }; + return {PPU_THREAD_STATUS_SLEEP, 0}; } if (pos >= g_cfg.core.ppu_threads + 0u) { - return { PPU_THREAD_STATUS_RUNNABLE, pos }; + return {PPU_THREAD_STATUS_RUNNABLE, pos}; } - return { PPU_THREAD_STATUS_ONPROC, pos}; + return {PPU_THREAD_STATUS_ONPROC, pos}; } void lv2_obj::set_future_sleep(cpu_thread* cpu) @@ -2268,7 +2272,7 @@ void lv2_obj::notify_all() noexcept u32 notifies[total_waiters]{}; - // There may be 6 waiters, but checking them all may be performance expensive + // There may be 6 waiters, but checking them all may be performance expensive // Instead, check 2 at max, but use the CPU ID index to tell which index to start checking so the work would be distributed across all threads atomic_t* range_lock = nullptr; @@ -2289,15 +2293,16 @@ void lv2_obj::notify_all() noexcept { // Clear address to avoid a race, keep waiter counter if (waiter.fetch_op([&](u64& x) - { - if ((x & -128) == (value & -128)) - { - x &= 127; - return true; - } + { + if ((x & -128) == (value & -128)) + { + x &= 127; + return true; + } - return false; - }).second) + return false; + }) + .second) { notifies[i] = raddr; } @@ -2317,15 +2322,16 @@ void lv2_obj::notify_all() noexcept { // Clear address to avoid a race, keep waiter counter if (waiter.fetch_op([&](u64& x) - { - if ((x & -128) == (value & -128)) - { - x &= 127; - return true; - } + { + if ((x & -128) == (value & -128)) + { + x &= 127; + return true; + } - return false; - }).second) + return false; + }) + .second) { notifies[i] = raddr; } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_cond.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_cond.cpp index 401ed3bd6..824c367fd 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_cond.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_cond.cpp @@ -14,20 +14,12 @@ LOG_CHANNEL(sys_cond); lv2_cond::lv2_cond(utils::serial& ar) noexcept - : key(ar) - , name(ar) - , mtx_id(ar) - , mutex(idm::check_unlocked(mtx_id)) - , _mutex(idm::get_unlocked(mtx_id)) // May be nullptr + : key(ar), name(ar), mtx_id(ar), mutex(idm::check_unlocked(mtx_id)), _mutex(idm::get_unlocked(mtx_id)) // May be nullptr { } lv2_cond::lv2_cond(u64 key, u64 name, u32 mtx_id, shared_ptr mutex0) noexcept - : key(key) - , name(name) - , mtx_id(mtx_id) - , mutex(static_cast(mutex0.get())) - , _mutex(mutex0) + : key(key), name(name), mtx_id(mtx_id), mutex(static_cast(mutex0.get())), _mutex(mutex0) { } @@ -55,15 +47,15 @@ CellError lv2_cond::on_id_create() ensure(!!Emu.DeserialManager()); Emu.PostponeInitCode([this]() - { - if (!mutex) { - _mutex = static_cast>(ensure(idm::get_unlocked(mtx_id))); - } + if (!mutex) + { + _mutex = static_cast>(ensure(idm::get_unlocked(mtx_id))); + } - // Defer function - ensure(CellError{} == do_it(this)); - }); + // Defer function + ensure(CellError{} == do_it(this)); + }); return {}; } @@ -101,13 +93,13 @@ error_code sys_cond_create(ppu_thread& ppu, vm::ptr cond_id, u32 mutex_id, } if (const auto error = lv2_obj::create(_attr.pshared, ipc_key, _attr.flags, [&] - { - return make_single( - ipc_key, - _attr.name_u64, - mutex_id, - std::move(mutex)); - })) + { + return make_single( + ipc_key, + _attr.name_u64, + mutex_id, + std::move(mutex)); + })) { return error; } @@ -124,18 +116,18 @@ error_code sys_cond_destroy(ppu_thread& ppu, u32 cond_id) sys_cond.trace("sys_cond_destroy(cond_id=0x%x)", cond_id); const auto cond = idm::withdraw(cond_id, [&](lv2_cond& cond) -> CellError - { - std::lock_guard lock(cond.mutex->mutex); - - if (atomic_storage::load(cond.sq)) { - return CELL_EBUSY; - } + std::lock_guard lock(cond.mutex->mutex); - cond.mutex->cond_count--; - lv2_obj::on_id_destroy(cond, cond.key); - return {}; - }); + if (atomic_storage::load(cond.sq)) + { + return CELL_EBUSY; + } + + cond.mutex->cond_count--; + lv2_obj::on_id_destroy(cond, cond.key); + return {}; + }); if (!cond) { @@ -174,44 +166,44 @@ error_code sys_cond_signal(ppu_thread& ppu, u32 cond_id) ppu.state += cpu_flag::wait; const auto cond = idm::check(cond_id, [&, notify = lv2_obj::notify_all_t()](lv2_cond& cond) - { - if (atomic_storage::load(cond.sq)) { - std::lock_guard lock(cond.mutex->mutex); - - if (ppu.state & cpu_flag::suspend) + if (atomic_storage::load(cond.sq)) { - // Test if another signal caused the current thread to be suspended, in which case it needs to wait until the thread wakes up (otherwise the signal may cause unexpected results) - finished = false; - return; - } + std::lock_guard lock(cond.mutex->mutex); - if (const auto cpu = cond.schedule(cond.sq, cond.mutex->protocol)) - { - if (static_cast(cpu)->state & cpu_flag::again) + if (ppu.state & cpu_flag::suspend) { - ppu.state += cpu_flag::again; + // Test if another signal caused the current thread to be suspended, in which case it needs to wait until the thread wakes up (otherwise the signal may cause unexpected results) + finished = false; return; } - // TODO: Is EBUSY returned after reqeueing, on sys_cond_destroy? - - if (cond.mutex->try_own(*cpu)) + if (const auto cpu = cond.schedule(cond.sq, cond.mutex->protocol)) { - cond.awake(cpu); + if (static_cast(cpu)->state & cpu_flag::again) + { + ppu.state += cpu_flag::again; + return; + } + + // TODO: Is EBUSY returned after reqeueing, on sys_cond_destroy? + + if (cond.mutex->try_own(*cpu)) + { + cond.awake(cpu); + } } } - } - else - { - cond.mutex->mutex.lock_unlock(); - - if (ppu.state & cpu_flag::suspend) + else { - finished = false; + cond.mutex->mutex.lock_unlock(); + + if (ppu.state & cpu_flag::suspend) + { + finished = false; + } } - } - }); + }); if (!finished) { @@ -246,54 +238,54 @@ error_code sys_cond_signal_all(ppu_thread& ppu, u32 cond_id) ppu.state += cpu_flag::wait; const auto cond = idm::check(cond_id, [&, notify = lv2_obj::notify_all_t()](lv2_cond& cond) - { - if (atomic_storage::load(cond.sq)) { - std::lock_guard lock(cond.mutex->mutex); - - if (ppu.state & cpu_flag::suspend) + if (atomic_storage::load(cond.sq)) { - // Test if another signal caused the current thread to be suspended, in which case it needs to wait until the thread wakes up (otherwise the signal may cause unexpected results) - finished = false; - return; - } + std::lock_guard lock(cond.mutex->mutex); - for (auto cpu = +cond.sq; cpu; cpu = cpu->next_cpu) - { - if (cpu->state & cpu_flag::again) + if (ppu.state & cpu_flag::suspend) { - ppu.state += cpu_flag::again; + // Test if another signal caused the current thread to be suspended, in which case it needs to wait until the thread wakes up (otherwise the signal may cause unexpected results) + finished = false; return; } - } - cpu_thread* result = nullptr; - auto sq = cond.sq; - atomic_storage::release(cond.sq, nullptr); - - while (const auto cpu = cond.schedule(sq, SYS_SYNC_PRIORITY)) - { - if (cond.mutex->try_own(*cpu)) + for (auto cpu = +cond.sq; cpu; cpu = cpu->next_cpu) { - ensure(!std::exchange(result, cpu)); + if (cpu->state & cpu_flag::again) + { + ppu.state += cpu_flag::again; + return; + } + } + + cpu_thread* result = nullptr; + auto sq = cond.sq; + atomic_storage::release(cond.sq, nullptr); + + while (const auto cpu = cond.schedule(sq, SYS_SYNC_PRIORITY)) + { + if (cond.mutex->try_own(*cpu)) + { + ensure(!std::exchange(result, cpu)); + } + } + + if (result) + { + cond.awake(result); } } - - if (result) + else { - cond.awake(result); - } - } - else - { - cond.mutex->mutex.lock_unlock(); + cond.mutex->mutex.lock_unlock(); - if (ppu.state & cpu_flag::suspend) - { - finished = false; + if (ppu.state & cpu_flag::suspend) + { + finished = false; + } } - } - }); + }); if (!finished) { @@ -328,57 +320,57 @@ error_code sys_cond_signal_to(ppu_thread& ppu, u32 cond_id, u32 thread_id) ppu.state += cpu_flag::wait; const auto cond = idm::check(cond_id, [&, notify = lv2_obj::notify_all_t()](lv2_cond& cond) - { - if (!idm::check_unlocked>(thread_id)) { - return -1; - } - - if (atomic_storage::load(cond.sq)) - { - std::lock_guard lock(cond.mutex->mutex); - - if (ppu.state & cpu_flag::suspend) + if (!idm::check_unlocked>(thread_id)) { - // Test if another signal caused the current thread to be suspended, in which case it needs to wait until the thread wakes up (otherwise the signal may cause unexpected results) - finished = false; - return 0; + return -1; } - for (auto cpu = +cond.sq; cpu; cpu = cpu->next_cpu) + if (atomic_storage::load(cond.sq)) { - if (cpu->id == thread_id) + std::lock_guard lock(cond.mutex->mutex); + + if (ppu.state & cpu_flag::suspend) { - if (static_cast(cpu)->state & cpu_flag::again) + // Test if another signal caused the current thread to be suspended, in which case it needs to wait until the thread wakes up (otherwise the signal may cause unexpected results) + finished = false; + return 0; + } + + for (auto cpu = +cond.sq; cpu; cpu = cpu->next_cpu) + { + if (cpu->id == thread_id) { - ppu.state += cpu_flag::again; - return 0; + if (static_cast(cpu)->state & cpu_flag::again) + { + ppu.state += cpu_flag::again; + return 0; + } + + ensure(cond.unqueue(cond.sq, cpu)); + + if (cond.mutex->try_own(*cpu)) + { + cond.awake(cpu); + } + + return 1; } - - ensure(cond.unqueue(cond.sq, cpu)); - - if (cond.mutex->try_own(*cpu)) - { - cond.awake(cpu); - } - - return 1; } } - } - else - { - cond.mutex->mutex.lock_unlock(); - - if (ppu.state & cpu_flag::suspend) + else { - finished = false; - return 0; - } - } + cond.mutex->mutex.lock_unlock(); - return 0; - }); + if (ppu.state & cpu_flag::suspend) + { + finished = false; + return 0; + } + } + + return 0; + }); if (!finished) { @@ -411,59 +403,59 @@ error_code sys_cond_wait(ppu_thread& ppu, u32 cond_id, u64 timeout) auto& sstate = *ppu.optional_savestate_state; const auto cond = idm::get(cond_id, [&, notify = lv2_obj::notify_all_t()](lv2_cond& cond) -> s64 - { - if (!ppu.loaded_from_savestate && atomic_storage::load(cond.mutex->control.raw().owner) != ppu.id) { - return -1; - } - - lv2_obj::prepare_for_sleep(ppu); - - std::lock_guard lock(cond.mutex->mutex); - - const u64 syscall_state = sstate.try_read().second; - sstate.clear(); - - if (ppu.loaded_from_savestate) - { - if (syscall_state & 1) + if (!ppu.loaded_from_savestate && atomic_storage::load(cond.mutex->control.raw().owner) != ppu.id) { - // Mutex sleep - ensure(!cond.mutex->try_own(ppu)); - } - else - { - lv2_obj::emplace(cond.sq, &ppu); + return -1; } + lv2_obj::prepare_for_sleep(ppu); + + std::lock_guard lock(cond.mutex->mutex); + + const u64 syscall_state = sstate.try_read().second; + sstate.clear(); + + if (ppu.loaded_from_savestate) + { + if (syscall_state & 1) + { + // Mutex sleep + ensure(!cond.mutex->try_own(ppu)); + } + else + { + lv2_obj::emplace(cond.sq, &ppu); + } + + cond.sleep(ppu, timeout); + return static_cast(syscall_state >> 32); + } + + // Register waiter + lv2_obj::emplace(cond.sq, &ppu); + + // Unlock the mutex + const u32 count = cond.mutex->lock_count.exchange(0); + + if (const auto cpu = cond.mutex->reown()) + { + if (cpu->state & cpu_flag::again) + { + ensure(cond.unqueue(cond.sq, &ppu)); + ppu.state += cpu_flag::again; + return 0; + } + + cond.mutex->append(cpu); + } + + // Sleep current thread and schedule mutex waiter cond.sleep(ppu, timeout); - return static_cast(syscall_state >> 32); - } - // Register waiter - lv2_obj::emplace(cond.sq, &ppu); - - // Unlock the mutex - const u32 count = cond.mutex->lock_count.exchange(0); - - if (const auto cpu = cond.mutex->reown()) - { - if (cpu->state & cpu_flag::again) - { - ensure(cond.unqueue(cond.sq, &ppu)); - ppu.state += cpu_flag::again; - return 0; - } - - cond.mutex->append(cpu); - } - - // Sleep current thread and schedule mutex waiter - cond.sleep(ppu, timeout); - - // Save the recursive value - return count; - }); + // Save the recursive value + return count; + }); if (!cond) { @@ -530,7 +522,7 @@ error_code sys_cond_wait(ppu_thread& ppu, u32 cond_id, u64 timeout) } if (ppu.state & cpu_flag::signal) - { + { continue; } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_config.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_config.cpp index 0179a6b7f..7a95fe158 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_config.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_config.cpp @@ -8,19 +8,18 @@ LOG_CHANNEL(sys_config); - // Enums -template<> +template <> void fmt_class_string::format(std::string& out, u64 id) { const s64 s_id = static_cast(id); switch (s_id) { - case SYS_CONFIG_SERVICE_PADMANAGER : out += "SYS_CONFIG_SERVICE_PADMANAGER"; return; - case SYS_CONFIG_SERVICE_PADMANAGER2 : out += "SYS_CONFIG_SERVICE_PADMANAGER2"; return; - case SYS_CONFIG_SERVICE_USER_LIBPAD : out += "SYS_CONFIG_SERVICE_USER_LIBPAD"; return; - case SYS_CONFIG_SERVICE_USER_LIBKB : out += "SYS_CONFIG_SERVICE_USER_LIBKB"; return; + case SYS_CONFIG_SERVICE_PADMANAGER: out += "SYS_CONFIG_SERVICE_PADMANAGER"; return; + case SYS_CONFIG_SERVICE_PADMANAGER2: out += "SYS_CONFIG_SERVICE_PADMANAGER2"; return; + case SYS_CONFIG_SERVICE_USER_LIBPAD: out += "SYS_CONFIG_SERVICE_USER_LIBPAD"; return; + case SYS_CONFIG_SERVICE_USER_LIBKB: out += "SYS_CONFIG_SERVICE_USER_LIBKB"; return; case SYS_CONFIG_SERVICE_USER_LIBMOUSE: out += "SYS_CONFIG_SERVICE_USER_LIBMOUSE"; return; } @@ -34,19 +33,19 @@ void fmt_class_string::format(std::string& out, u64 id) } } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto value) - { - switch (value) { - STR_CASE(SYS_CONFIG_SERVICE_LISTENER_ONCE); - STR_CASE(SYS_CONFIG_SERVICE_LISTENER_REPEATING); - } + switch (value) + { + STR_CASE(SYS_CONFIG_SERVICE_LISTENER_ONCE); + STR_CASE(SYS_CONFIG_SERVICE_LISTENER_REPEATING); + } - return unknown; - }); + return unknown; + }); } // Utilities @@ -68,7 +67,6 @@ void dump_buffer(std::string& out, const std::vector& buffer) } } - // LV2 Config void lv2_config::initialize() { @@ -95,7 +93,7 @@ void lv2_config::initialize() }; // user_id for the padmanager seems to signify the controller port number, and the buffer contains some sort of HID descriptor - lv2_config_service::create(SYS_CONFIG_SERVICE_PADMANAGER , 0, 1, 0, hid_info, 0x1a)->notify(); + lv2_config_service::create(SYS_CONFIG_SERVICE_PADMANAGER, 0, 1, 0, hid_info, 0x1a)->notify(); lv2_config_service::create(SYS_CONFIG_SERVICE_PADMANAGER2, 0, 1, 0, hid_info, 0x1a)->notify(); } @@ -196,18 +194,18 @@ void lv2_config_service_listener::notify_all() // Grab all events idm::select([&](u32 /*id*/, lv2_config_service& service) - { - if (check_service(service)) { - services.push_back(service.get_shared_ptr()); - } - }); + if (check_service(service)) + { + services.push_back(service.get_shared_ptr()); + } + }); // Sort services by timestamp sort(services.begin(), services.end(), [](const shared_ptr& s1, const shared_ptr& s2) - { - return s1->timestamp < s2->timestamp; - }); + { + return s1->timestamp < s2->timestamp; + }); // Notify listener (now with services in sorted order) for (auto& service : services) @@ -216,7 +214,6 @@ void lv2_config_service_listener::notify_all() } } - // LV2 Config Service void lv2_config_service::unregister() { @@ -237,10 +234,10 @@ void lv2_config_service::notify() const const shared_ptr sptr = get_shared_ptr(); idm::select([&](u32 /*id*/, lv2_config_service_listener& listener) - { - if (listener.check_service(*sptr)) - listeners.push_back(listener.get_shared_ptr()); - }); + { + if (listener.check_service(*sptr)) + listeners.push_back(listener.get_shared_ptr()); + }); for (auto& listener : listeners) { @@ -261,9 +258,8 @@ bool lv2_config_service_event::notify() const return _handle->notify(SYS_CONFIG_EVENT_SOURCE_SERVICE, (static_cast(service->is_registered()) << 32) | id, service->get_size()); } - // LV2 Config Service Event -void lv2_config_service_event::write(sys_config_service_event_t *dst) const +void lv2_config_service_event::write(sys_config_service_event_t* dst) const { const auto registered = service->is_registered(); @@ -283,9 +279,6 @@ void lv2_config_service_event::write(sys_config_service_event_t *dst) const } } - - - /* * Syscalls */ @@ -331,8 +324,6 @@ error_code sys_config_close(u32 config_hdl) return CELL_OK; } - - error_code sys_config_get_service_event(u32 config_hdl, u32 event_id, vm::ptr dst, u64 size) { sys_config.trace("sys_config_get_service_event(config_hdl=0x%x, event_id=0x%llx, dst=*0x%llx, size=0x%llx)", config_hdl, event_id, dst, size); @@ -363,8 +354,6 @@ error_code sys_config_get_service_event(u32 config_hdl, u32 event_id, vm::ptr in, u64 size, sys_config_service_listener_type type, vm::ptr out_listener_hdl) { sys_config.trace("sys_config_add_service_listener(config_hdl=0x%x, service_id=0x%llx, min_verbosity=0x%llx, in=*0x%x, size=%lld, type=0x%llx, out_listener_hdl=*0x%x)", config_hdl, service_id, min_verbosity, in, size, type, out_listener_hdl); @@ -411,8 +400,6 @@ error_code sys_config_remove_service_listener(u32 config_hdl, u32 listener_hdl) return CELL_OK; } - - error_code sys_config_register_service(u32 config_hdl, sys_config_service_id service_id, u64 user_id, u64 verbosity, vm::ptr data_buf, u64 size, vm::ptr out_service_hdl) { sys_config.trace("sys_config_register_service(config_hdl=0x%x, service_id=0x%llx, user_id=0x%llx, verbosity=0x%llx, data_but=*0x%llx, size=%lld, out_service_hdl=*0x%llx)", config_hdl, service_id, user_id, verbosity, data_buf, size, out_service_hdl); @@ -457,8 +444,6 @@ error_code sys_config_unregister_service(u32 config_hdl, u32 service_hdl) return CELL_OK; } - - /* * IO Events - TODO */ diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_config.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_config.h index 080467114..33e23393f 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_config.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_config.h @@ -42,42 +42,44 @@ class lv2_config_service; class lv2_config_service_listener; class lv2_config_service_event; - // Known sys_config service IDs -enum sys_config_service_id : s64 { - SYS_CONFIG_SERVICE_PADMANAGER = 0x11, +enum sys_config_service_id : s64 +{ + SYS_CONFIG_SERVICE_PADMANAGER = 0x11, SYS_CONFIG_SERVICE_PADMANAGER2 = 0x12, // lv2 seems to send padmanager events to both 0x11 and 0x12 - SYS_CONFIG_SERVICE_0x20 = 0x20, - SYS_CONFIG_SERVICE_0x30 = 0x30, + SYS_CONFIG_SERVICE_0x20 = 0x20, + SYS_CONFIG_SERVICE_0x30 = 0x30, - SYS_CONFIG_SERVICE_USER_BASE = static_cast(UINT64_C(0x8000'0000'0000'0000)), - SYS_CONFIG_SERVICE_USER_LIBPAD = SYS_CONFIG_SERVICE_USER_BASE + 1, - SYS_CONFIG_SERVICE_USER_LIBKB = SYS_CONFIG_SERVICE_USER_BASE + 2, - SYS_CONFIG_SERVICE_USER_LIBMOUSE = SYS_CONFIG_SERVICE_USER_BASE + 3, - SYS_CONFIG_SERVICE_USER_0x1000 = SYS_CONFIG_SERVICE_USER_BASE + 0x1000, - SYS_CONFIG_SERVICE_USER_0x1010 = SYS_CONFIG_SERVICE_USER_BASE + 0x1010, - SYS_CONFIG_SERVICE_USER_0x1011 = SYS_CONFIG_SERVICE_USER_BASE + 0x1011, - SYS_CONFIG_SERVICE_USER_0x1013 = SYS_CONFIG_SERVICE_USER_BASE + 0x1013, - SYS_CONFIG_SERVICE_USER_0x1020 = SYS_CONFIG_SERVICE_USER_BASE + 0x1020, - SYS_CONFIG_SERVICE_USER_0x1030 = SYS_CONFIG_SERVICE_USER_BASE + 0x1030, + SYS_CONFIG_SERVICE_USER_BASE = static_cast(UINT64_C(0x8000'0000'0000'0000)), + SYS_CONFIG_SERVICE_USER_LIBPAD = SYS_CONFIG_SERVICE_USER_BASE + 1, + SYS_CONFIG_SERVICE_USER_LIBKB = SYS_CONFIG_SERVICE_USER_BASE + 2, + SYS_CONFIG_SERVICE_USER_LIBMOUSE = SYS_CONFIG_SERVICE_USER_BASE + 3, + SYS_CONFIG_SERVICE_USER_0x1000 = SYS_CONFIG_SERVICE_USER_BASE + 0x1000, + SYS_CONFIG_SERVICE_USER_0x1010 = SYS_CONFIG_SERVICE_USER_BASE + 0x1010, + SYS_CONFIG_SERVICE_USER_0x1011 = SYS_CONFIG_SERVICE_USER_BASE + 0x1011, + SYS_CONFIG_SERVICE_USER_0x1013 = SYS_CONFIG_SERVICE_USER_BASE + 0x1013, + SYS_CONFIG_SERVICE_USER_0x1020 = SYS_CONFIG_SERVICE_USER_BASE + 0x1020, + SYS_CONFIG_SERVICE_USER_0x1030 = SYS_CONFIG_SERVICE_USER_BASE + 0x1030, }; -enum sys_config_service_listener_type : u32 { - SYS_CONFIG_SERVICE_LISTENER_ONCE = 0, +enum sys_config_service_listener_type : u32 +{ + SYS_CONFIG_SERVICE_LISTENER_ONCE = 0, SYS_CONFIG_SERVICE_LISTENER_REPEATING = 1 }; -enum sys_config_event_source : u64 { +enum sys_config_event_source : u64 +{ SYS_CONFIG_EVENT_SOURCE_SERVICE = 1, - SYS_CONFIG_EVENT_SOURCE_IO = 2 + SYS_CONFIG_EVENT_SOURCE_IO = 2 }; - /* * Dynamic-sized struct to describe a sys_config_service_event * We never allocate it - the guest does it for us and provides a pointer */ -struct sys_config_service_event_t { +struct sys_config_service_event_t +{ // Handle to the service listener for whom this event is destined be_t service_listener_handle; @@ -107,12 +109,12 @@ struct sys_config_service_event_t { u8 data[1]; }; - /* * Event data structure for SYS_CONFIG_SERVICE_PADMANAGER * This is a guess */ -struct sys_config_padmanager_data_t { +struct sys_config_padmanager_data_t +{ be_t unk[5]; // hid device type ? be_t vid; be_t pid; @@ -120,7 +122,6 @@ struct sys_config_padmanager_data_t { }; static_assert(sizeof(sys_config_padmanager_data_t) == 26); - /* * Global sys_config state */ @@ -244,12 +245,7 @@ public: // Constructors (should not be used directly) lv2_config_service(sys_config_service_id _id, u64 _user_id, u64 _verbosity, u32 _padding, const u8* _data, usz size) noexcept - : timestamp(get_system_time()) - , id(_id) - , user_id(_user_id) - , verbosity(_verbosity) - , padding(_padding) - , data(&_data[0], &_data[size]) + : timestamp(get_system_time()), id(_id), user_id(_user_id), verbosity(_verbosity), padding(_padding), data(&_data[0], &_data[size]) { } @@ -267,16 +263,28 @@ public: } // Registration - bool is_registered() const { return registered; } + bool is_registered() const + { + return registered; + } void unregister(); // Notify listeners void notify() const; // Utilities - usz get_size() const { return sizeof(sys_config_service_event_t)-1 + data.size(); } - shared_ptr get_shared_ptr () const { return stx::make_shared_from_this(this); } - u32 get_id() const { return idm_id; } + usz get_size() const + { + return sizeof(sys_config_service_event_t) - 1 + data.size(); + } + shared_ptr get_shared_ptr() const + { + return stx::make_shared_from_this(this); + } + u32 get_id() const + { + return idm_id; + } }; /* @@ -310,12 +318,9 @@ public: // Constructors (should not be used directly) lv2_config_service_listener(shared_ptr _handle, sys_config_service_id _service_id, u64 _min_verbosity, sys_config_service_listener_type _type, const u8* _data, usz size) noexcept - : handle(std::move(_handle)) - , service_id(_service_id) - , min_verbosity(_min_verbosity) - , type(_type) - , data(&_data[0], &_data[size]) - {} + : handle(std::move(_handle)), service_id(_service_id), min_verbosity(_min_verbosity), type(_type), data(&_data[0], &_data[size]) + { + } // Factory template @@ -340,8 +345,14 @@ public: void notify_all(); // Utilities - u32 get_id() const { return idm_id; } - shared_ptr get_shared_ptr() const { return stx::make_shared_from_this(this); } + u32 get_id() const + { + return idm_id; + } + shared_ptr get_shared_ptr() const + { + return stx::make_shared_from_this(this); + } }; /* @@ -374,10 +385,7 @@ public: // Constructors (should not be used directly) lv2_config_service_event(shared_ptr _handle, shared_ptr _service, const lv2_config_service_listener& _listener) noexcept - : id(get_next_id()) - , handle(std::move(_handle)) - , service(std::move(_service)) - , listener(_listener) + : id(get_next_id()), handle(std::move(_handle)), service(std::move(_service)), listener(_listener) { } @@ -400,10 +408,13 @@ public: bool notify() const; // Write event to buffer - void write(sys_config_service_event_t *dst) const; + void write(sys_config_service_event_t* dst) const; // Check if the buffer can fit the current event, return false otherwise - bool check_buffer_size(usz size) const { return service->get_size() <= size; } + bool check_buffer_size(usz size) const + { + return service->get_size() <= size; + } }; /* diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_console.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_console.cpp index 0bc409e3d..1cbf7703a 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_console.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_console.cpp @@ -3,7 +3,6 @@ #include "sys_console.h" - LOG_CHANNEL(sys_console); error_code sys_console_write(vm::cptr buf, u32 len) diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_event.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_event.cpp index db72972b9..946bbd137 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_event.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_event.cpp @@ -15,22 +15,12 @@ LOG_CHANNEL(sys_event); lv2_event_queue::lv2_event_queue(u32 protocol, s32 type, s32 size, u64 name, u64 ipc_key) noexcept - : id(idm::last_id()) - , protocol{static_cast(protocol)} - , type(static_cast(type)) - , size(static_cast(size)) - , name(name) - , key(ipc_key) + : id(idm::last_id()), protocol{static_cast(protocol)}, type(static_cast(type)), size(static_cast(size)), name(name), key(ipc_key) { } lv2_event_queue::lv2_event_queue(utils::serial& ar) noexcept - : id(idm::last_id()) - , protocol(ar) - , type(ar) - , size(ar) - , name(ar) - , key(ar) + : id(idm::last_id()), protocol(ar), type(ar), size(ar), name(ar), key(ar) { ar(events); } @@ -38,7 +28,10 @@ lv2_event_queue::lv2_event_queue(utils::serial& ar) noexcept std::function lv2_event_queue::load(utils::serial& ar) { auto queue = make_shared(stx::exact_t(ar)); - return [ptr = lv2_obj::load(queue->key, queue)](void* storage) { *static_cast*>(storage) = ptr; }; + return [ptr = lv2_obj::load(queue->key, queue)](void* storage) + { + *static_cast*>(storage) = ptr; + }; } void lv2_event_queue::save(utils::serial& ar) @@ -78,24 +71,22 @@ shared_ptr lv2_event_queue::load_ptr(utils::serial& ar, shared_ } Emu.PostponeInitCode([id, &queue, msg_str = std::string{msg}]() - { - // Defer resolving - queue = idm::get_unlocked(id); - - if (!queue) { - fmt::throw_exception("Failed in event queue pointer deserialization (not found): location: %s, id=0x%x", msg_str, id); - } - }); + // Defer resolving + queue = idm::get_unlocked(id); + + if (!queue) + { + fmt::throw_exception("Failed in event queue pointer deserialization (not found): location: %s, id=0x%x", msg_str, id); + } + }); // Null until resolved return {}; } lv2_event_port::lv2_event_port(utils::serial& ar) - : type(ar) - , name(ar) - , queue(lv2_event_queue::load_ptr(ar, queue, "eventport")) + : type(ar), name(ar), queue(lv2_event_queue::load_ptr(ar, queue, "eventport")) { } @@ -171,7 +162,7 @@ CellError lv2_event_queue::send(lv2_event event, bool* notified_thread, lv2_even if (port && ppu.prio.load().prio < ensure(cpu_thread::get_current())->prio.load().prio) { // Block event port disconnection for the time being of sending events - // PPU -> lower prio PPU is the only case that can cause thread blocking + // PPU -> lower prio PPU is the only case that can cause thread blocking port->is_busy++; ensure(notified_thread); *notified_thread = true; @@ -237,9 +228,9 @@ error_code sys_event_queue_create(cpu_thread& cpu, vm::ptr equeue_id, vm::p const u64 name = attr->name_u64; if (const auto error = lv2_obj::create(pshared, ipc_key, flags, [&]() - { - return make_shared(protocol, type, size, name, ipc_key); - })) + { + return make_shared(protocol, type, size, name, ipc_key); + })) { return error; } @@ -267,42 +258,42 @@ error_code sys_event_queue_destroy(ppu_thread& ppu, u32 equeue_id, s32 mode) cpu_thread* head{}; const auto queue = idm::withdraw(equeue_id, [&](lv2_event_queue& queue) -> CellError - { - qlock = std::unique_lock{queue.mutex}; - - head = queue.type == SYS_PPU_QUEUE ? static_cast(+queue.pq) : +queue.sq; - - if (!mode && head) { - return CELL_EBUSY; - } + qlock = std::unique_lock{queue.mutex}; - if (!queue.events.empty()) - { - // Copy events for logging, does not empty - events.insert(events.begin(), queue.events.begin(), queue.events.end()); - } + head = queue.type == SYS_PPU_QUEUE ? static_cast(+queue.pq) : +queue.sq; - lv2_obj::on_id_destroy(queue, queue.key); - - if (!head) - { - qlock.unlock(); - } - else - { - for (auto cpu = head; cpu; cpu = cpu->get_next_cpu()) + if (!mode && head) { - if (cpu->state & cpu_flag::again) + return CELL_EBUSY; + } + + if (!queue.events.empty()) + { + // Copy events for logging, does not empty + events.insert(events.begin(), queue.events.begin(), queue.events.end()); + } + + lv2_obj::on_id_destroy(queue, queue.key); + + if (!head) + { + qlock.unlock(); + } + else + { + for (auto cpu = head; cpu; cpu = cpu->get_next_cpu()) { - ppu.state += cpu_flag::again; - return CELL_EAGAIN; + if (cpu->state & cpu_flag::again) + { + ppu.state += cpu_flag::again; + return CELL_EAGAIN; + } } } - } - return {}; - }); + return {}; + }); if (!queue) { @@ -375,8 +366,7 @@ error_code sys_event_queue_destroy(ppu_thread& ppu, u32 equeue_id, s32 mode) for (const lv2_event& evt : events) { - fmt::append(lost_data, "data0=0x%x, data1=0x%x, data2=0x%x, data3=0x%x\n" - , std::get<0>(evt), std::get<1>(evt), std::get<2>(evt), std::get<3>(evt)); + fmt::append(lost_data, "data0=0x%x, data1=0x%x, data2=0x%x, data3=0x%x\n", std::get<0>(evt), std::get<1>(evt), std::get<2>(evt), std::get<3>(evt)); } if (!lost_data.empty()) @@ -442,35 +432,35 @@ error_code sys_event_queue_receive(ppu_thread& ppu, u32 equeue_id, vm::ptr(equeue_id, [&, notify = lv2_obj::notify_all_t()](lv2_event_queue& queue) -> CellError - { - if (queue.type != SYS_PPU_QUEUE) { - return CELL_EINVAL; - } + if (queue.type != SYS_PPU_QUEUE) + { + return CELL_EINVAL; + } - lv2_obj::prepare_for_sleep(ppu); + lv2_obj::prepare_for_sleep(ppu); - std::lock_guard lock(queue.mutex); + std::lock_guard lock(queue.mutex); - // "/dev_flash/vsh/module/msmw2.sprx" seems to rely on some cryptic shared memory behaviour that we don't emulate correctly - // This is a hack to avoid waiting for 1m40s every time we boot vsh - if (queue.key == 0x8005911000000012 && Emu.IsVsh()) - { - sys_event.todo("sys_event_queue_receive(equeue_id=0x%x, *0x%x, timeout=0x%llx) Bypassing timeout for msmw2.sprx", equeue_id, dummy_event, timeout); - timeout = 1; - } + // "/dev_flash/vsh/module/msmw2.sprx" seems to rely on some cryptic shared memory behaviour that we don't emulate correctly + // This is a hack to avoid waiting for 1m40s every time we boot vsh + if (queue.key == 0x8005911000000012 && Emu.IsVsh()) + { + sys_event.todo("sys_event_queue_receive(equeue_id=0x%x, *0x%x, timeout=0x%llx) Bypassing timeout for msmw2.sprx", equeue_id, dummy_event, timeout); + timeout = 1; + } - if (queue.events.empty()) - { - queue.sleep(ppu, timeout); - lv2_obj::emplace(queue.pq, &ppu); - return CELL_EBUSY; - } + if (queue.events.empty()) + { + queue.sleep(ppu, timeout); + lv2_obj::emplace(queue.pq, &ppu); + return CELL_EBUSY; + } - std::tie(ppu.gpr[4], ppu.gpr[5], ppu.gpr[6], ppu.gpr[7]) = queue.events.front(); - queue.events.pop_front(); - return {}; - }); + std::tie(ppu.gpr[4], ppu.gpr[5], ppu.gpr[6], ppu.gpr[7]) = queue.events.front(); + queue.events.pop_front(); + return {}; + }); if (!queue) { @@ -519,7 +509,7 @@ error_code sys_event_queue_receive(ppu_thread& ppu, u32 equeue_id, vm::ptr(equeue_id, [&](lv2_event_queue& queue) - { - std::lock_guard lock(queue.mutex); + { + std::lock_guard lock(queue.mutex); - queue.events.clear(); - }); + queue.events.clear(); + }); if (!queue) { @@ -612,14 +602,14 @@ error_code sys_event_port_destroy(ppu_thread& ppu, u32 eport_id) sys_event.warning("sys_event_port_destroy(eport_id=0x%x)", eport_id); const auto port = idm::withdraw(eport_id, [](lv2_event_port& port) -> CellError - { - if (lv2_obj::check(port.queue)) { - return CELL_EISCONN; - } + if (lv2_obj::check(port.queue)) + { + return CELL_EISCONN; + } - return {}; - }); + return {}; + }); if (!port) { @@ -746,23 +736,23 @@ error_code sys_event_port_send(u32 eport_id, u64 data1, u64 data2, u64 data3) bool notified_thread = false; const auto port = idm::check(eport_id, [&, notify = lv2_obj::notify_all_t()](lv2_event_port& port) -> CellError - { - if (ppu && ppu->loaded_from_savestate) { - port.is_busy++; - notified_thread = true; - return {}; - } + if (ppu && ppu->loaded_from_savestate) + { + port.is_busy++; + notified_thread = true; + return {}; + } - if (lv2_obj::check(port.queue)) - { - const u64 source = port.name ? port.name : (u64{process_getpid() + 0u} << 32) | u64{eport_id}; + if (lv2_obj::check(port.queue)) + { + const u64 source = port.name ? port.name : (u64{process_getpid() + 0u} << 32) | u64{eport_id}; - return port.queue->send(source, data1, data2, data3, ¬ified_thread, ppu && port.queue->type == SYS_PPU_QUEUE ? &port : nullptr); - } + return port.queue->send(source, data1, data2, data3, ¬ified_thread, ppu && port.queue->type == SYS_PPU_QUEUE ? &port : nullptr); + } - return CELL_ENOTCONN; - }); + return CELL_ENOTCONN; + }); if (!port) { diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_event.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_event.h index 6c43798a3..610bd051f 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_event.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_event.h @@ -32,7 +32,7 @@ enum : u64 enum : s32 { SYS_EVENT_PORT_LOCAL = 1, - SYS_EVENT_PORT_IPC = 3, // Unofficial name + SYS_EVENT_PORT_IPC = 3, // Unofficial name }; // Event Port Name @@ -45,21 +45,21 @@ enum : u64 enum : u32 { SYS_SPU_THREAD_EVENT_USER = 1, - SYS_SPU_THREAD_EVENT_DMA = 2, // not supported + SYS_SPU_THREAD_EVENT_DMA = 2, // not supported }; // Event Source Key enum : u64 { - SYS_SPU_THREAD_EVENT_USER_KEY = 0xFFFFFFFF53505501ull, - SYS_SPU_THREAD_EVENT_DMA_KEY = 0xFFFFFFFF53505502ull, + SYS_SPU_THREAD_EVENT_USER_KEY = 0xFFFFFFFF53505501ull, + SYS_SPU_THREAD_EVENT_DMA_KEY = 0xFFFFFFFF53505502ull, SYS_SPU_THREAD_EVENT_EXCEPTION_KEY = 0xFFFFFFFF53505503ull, }; struct sys_event_queue_attribute_t { be_t protocol; // SYS_SYNC_PRIORITY or SYS_SYNC_FIFO - be_t type; // SYS_PPU_QUEUE or SYS_SPU_QUEUE + be_t type; // SYS_PPU_QUEUE or SYS_SPU_QUEUE union { @@ -123,12 +123,11 @@ struct lv2_event_port final : lv2_obj const s32 type; // Port type, either IPC or local const u64 name; // Event source (generated from id and process id if not set) - atomic_t is_busy = 0; // Counts threads waiting on event sending + atomic_t is_busy = 0; // Counts threads waiting on event sending shared_ptr queue; // Event queue this port is connected to lv2_event_port(s32 type, u64 name) - : type(type) - , name(name) + : type(type), name(name) { } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp index c28efaf71..74cbb34d6 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp @@ -11,10 +11,7 @@ LOG_CHANNEL(sys_event_flag); lv2_event_flag::lv2_event_flag(utils::serial& ar) - : protocol(ar) - , key(ar) - , type(ar) - , name(ar) + : protocol(ar), key(ar), type(ar), name(ar) { ar(pattern); } @@ -61,14 +58,14 @@ error_code sys_event_flag_create(ppu_thread& ppu, vm::ptr id, vm::ptr(_attr.pshared, ipc_key, _attr.flags, [&] - { - return make_shared( - _attr.protocol, - ipc_key, - _attr.type, - _attr.name_u64, - init); - })) + { + return make_shared( + _attr.protocol, + ipc_key, + _attr.type, + _attr.name_u64, + init); + })) { return error; } @@ -85,15 +82,15 @@ error_code sys_event_flag_destroy(ppu_thread& ppu, u32 id) sys_event_flag.warning("sys_event_flag_destroy(id=0x%x)", id); const auto flag = idm::withdraw(id, [&](lv2_event_flag& flag) -> CellError - { - if (flag.sq) { - return CELL_EBUSY; - } + if (flag.sq) + { + return CELL_EBUSY; + } - lv2_obj::on_id_destroy(flag, flag.key); - return {}; - }); + lv2_obj::on_id_destroy(flag, flag.key); + return {}; + }); if (!flag) { @@ -143,37 +140,39 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm } const auto flag = idm::get(id, [&, notify = lv2_obj::notify_all_t()](lv2_event_flag& flag) -> CellError - { - if (flag.pattern.fetch_op([&](u64& pat) { - return lv2_event_flag::check_pattern(pat, bitptn, mode, &ppu.gpr[6]); - }).second) - { - // TODO: is it possible to return EPERM in this case? - return {}; - } + if (flag.pattern.fetch_op([&](u64& pat) + { + return lv2_event_flag::check_pattern(pat, bitptn, mode, &ppu.gpr[6]); + }) + .second) + { + // TODO: is it possible to return EPERM in this case? + return {}; + } - lv2_obj::prepare_for_sleep(ppu); + lv2_obj::prepare_for_sleep(ppu); - std::lock_guard lock(flag.mutex); + std::lock_guard lock(flag.mutex); - if (flag.pattern.fetch_op([&](u64& pat) - { - return lv2_event_flag::check_pattern(pat, bitptn, mode, &ppu.gpr[6]); - }).second) - { - return {}; - } + if (flag.pattern.fetch_op([&](u64& pat) + { + return lv2_event_flag::check_pattern(pat, bitptn, mode, &ppu.gpr[6]); + }) + .second) + { + return {}; + } - if (flag.type == SYS_SYNC_WAITER_SINGLE && flag.sq) - { - return CELL_EPERM; - } + if (flag.type == SYS_SYNC_WAITER_SINGLE && flag.sq) + { + return CELL_EPERM; + } - flag.sleep(ppu, timeout); - lv2_obj::emplace(flag.sq, &ppu); - return CELL_EBUSY; - }); + flag.sleep(ppu, timeout); + lv2_obj::emplace(flag.sq, &ppu); + return CELL_EBUSY; + }); if (!flag) { @@ -222,7 +221,7 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm } if (ppu.state & cpu_flag::signal) - { + { continue; } @@ -298,12 +297,13 @@ error_code sys_event_flag_trywait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, u64 pattern{}; const auto flag = idm::check(id, [&](lv2_event_flag& flag) - { - return flag.pattern.fetch_op([&](u64& pat) { - return lv2_event_flag::check_pattern(pat, bitptn, mode, &pattern); - }).second; - }); + return flag.pattern.fetch_op([&](u64& pat) + { + return lv2_event_flag::check_pattern(pat, bitptn, mode, &pattern); + }) + .second; + }); if (!flag) { @@ -423,18 +423,18 @@ error_code sys_event_flag_set(cpu_thread& cpu, u32 id, u64 bitptn) dependant_mask &= ~bitptn; auto [new_val, ok] = flag->pattern.fetch_op([&](u64& x) - { - if ((x ^ pattern) & dependant_mask) { - return false; - } + if ((x ^ pattern) & dependant_mask) + { + return false; + } - x |= bitptn; + x |= bitptn; - // Clear the bit-wise difference - x &= ~((pattern | bitptn) & ~to_write); - return true; - }); + // Clear the bit-wise difference + x &= ~((pattern | bitptn) & ~to_write); + return true; + }); if (ok) { @@ -478,9 +478,9 @@ error_code sys_event_flag_clear(ppu_thread& ppu, u32 id, u64 bitptn) sys_event_flag.trace("sys_event_flag_clear(id=0x%x, bitptn=0x%llx)", id, bitptn); const auto flag = idm::check(id, [&](lv2_event_flag& flag) - { - flag.pattern &= bitptn; - }); + { + flag.pattern &= bitptn; + }); if (!flag) { @@ -496,7 +496,8 @@ error_code sys_event_flag_cancel(ppu_thread& ppu, u32 id, vm::ptr num) sys_event_flag.trace("sys_event_flag_cancel(id=0x%x, num=*0x%x)", id, num); - if (num) *num = 0; + if (num) + *num = 0; const auto flag = idm::get_unlocked(id); @@ -541,7 +542,8 @@ error_code sys_event_flag_cancel(ppu_thread& ppu, u32 id, vm::ptr num) static_cast(ppu.test_stopped()); - if (num) *num = value; + if (num) + *num = value; return CELL_OK; } @@ -552,15 +554,16 @@ error_code sys_event_flag_get(ppu_thread& ppu, u32 id, vm::ptr flags) sys_event_flag.trace("sys_event_flag_get(id=0x%x, flags=*0x%x)", id, flags); const auto flag = idm::check(id, [](lv2_event_flag& flag) - { - return +flag.pattern; - }); + { + return +flag.pattern; + }); ppu.check_state(); if (!flag) { - if (flags) *flags = 0; + if (flags) + *flags = 0; return CELL_ESRCH; } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_event_flag.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_event_flag.h index 652ae9594..db7d4d43d 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_event_flag.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_event_flag.h @@ -45,11 +45,7 @@ struct lv2_event_flag final : lv2_obj ppu_thread* sq{}; lv2_event_flag(u32 protocol, u64 key, s32 type, u64 name, u64 pattern) noexcept - : protocol{static_cast(protocol)} - , key(key) - , type(type) - , name(name) - , pattern(pattern) + : protocol{static_cast(protocol)}, key(key), type(type), name(name), pattern(pattern) { } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_fs.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_fs.cpp index 1f76bb709..97ced5c50 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_fs.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_fs.cpp @@ -25,32 +25,32 @@ lv2_fs_mount_point g_mp_sys_dev_dvd{"/dev_ps2disc", "CELL_FS_ISO9660", "CELL_FS_ lv2_fs_mount_point g_mp_sys_dev_bdvd{"/dev_bdvd", "CELL_FS_ISO9660", "CELL_FS_IOS:PATA0_BDVD_DRIVE", 2048, 0x4D955, 2048, lv2_mp_flag::read_only + lv2_mp_flag::no_uid_gid, &g_mp_sys_dev_dvd}; lv2_fs_mount_point g_mp_sys_dev_hdd1{"/dev_hdd1", "CELL_FS_FAT", "CELL_FS_UTILITY:HDD1", 512, 0x3FFFF8, 32768, lv2_mp_flag::no_uid_gid + lv2_mp_flag::cache, &g_mp_sys_dev_bdvd}; lv2_fs_mount_point g_mp_sys_dev_hdd0{"/dev_hdd0", "CELL_FS_UFS", "CELL_FS_UTILITY:HDD0", 512, 0x24FAEA98, 4096, {}, &g_mp_sys_dev_hdd1}; -lv2_fs_mount_point g_mp_sys_dev_flash3{"/dev_flash3", "CELL_FS_FAT", "CELL_FS_IOS:BUILTIN_FLSH3", 512, 0x400, 8192, lv2_mp_flag::no_uid_gid, &g_mp_sys_dev_hdd0}; // TODO confirm +lv2_fs_mount_point g_mp_sys_dev_flash3{"/dev_flash3", "CELL_FS_FAT", "CELL_FS_IOS:BUILTIN_FLSH3", 512, 0x400, 8192, lv2_mp_flag::no_uid_gid, &g_mp_sys_dev_hdd0}; // TODO confirm lv2_fs_mount_point g_mp_sys_dev_flash2{"/dev_flash2", "CELL_FS_FAT", "CELL_FS_IOS:BUILTIN_FLSH2", 512, 0x8000, 8192, lv2_mp_flag::no_uid_gid, &g_mp_sys_dev_flash3}; // TODO confirm lv2_fs_mount_point g_mp_sys_dev_flash{"/dev_flash", "CELL_FS_FAT", "CELL_FS_IOS:BUILTIN_FLSH1", 512, 0x63E00, 8192, lv2_mp_flag::no_uid_gid, &g_mp_sys_dev_flash2}; lv2_fs_mount_point g_mp_sys_host_root{"/host_root", "CELL_FS_DUMMYFS", "CELL_FS_DUMMY:/", 512, 0x100, 512, lv2_mp_flag::strict_get_block_size + lv2_mp_flag::no_uid_gid, &g_mp_sys_dev_flash}; lv2_fs_mount_point g_mp_sys_app_home{"/app_home", "CELL_FS_DUMMYFS", "CELL_FS_DUMMY:", 512, 0x100, 512, lv2_mp_flag::strict_get_block_size + lv2_mp_flag::no_uid_gid, &g_mp_sys_host_root}; lv2_fs_mount_point g_mp_sys_dev_root{"/", "CELL_FS_ADMINFS", "CELL_FS_ADMINFS:", 512, 0x100, 512, lv2_mp_flag::read_only + lv2_mp_flag::strict_get_block_size + lv2_mp_flag::no_uid_gid, &g_mp_sys_app_home}; lv2_fs_mount_point g_mp_sys_no_device{}; -lv2_fs_mount_info g_mi_sys_not_found{}; // wrapper for &g_mp_sys_no_device +lv2_fs_mount_info g_mi_sys_not_found{}; // wrapper for &g_mp_sys_no_device -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](lv2_file_type type) - { - switch (type) { - case lv2_file_type::regular: return "Regular file"; - case lv2_file_type::sdata: return "SDATA"; - case lv2_file_type::edata: return "EDATA"; - } + switch (type) + { + case lv2_file_type::regular: return "Regular file"; + case lv2_file_type::sdata: return "SDATA"; + case lv2_file_type::edata: return "EDATA"; + } - return unknown; - }); + return unknown; + }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { const auto& file = get_object(arg); @@ -82,7 +82,7 @@ void fmt_class_string::format(std::string& out, u64 arg) fmt::append(out, u8"%s, '%s', Mode: 0x%x, Flags: 0x%x, Pos/Size: %s/%s (0x%x/0x%x)", file.type, file.name.data(), file.mode, file.flags, get_size(pos), get_size(size), pos, size); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { const auto& dir = get_object(arg); @@ -231,7 +231,10 @@ u64 lv2_fs_mount_info_map::get_all(CellFsMountInfo* info, u64 len) const bool lv2_fs_mount_info_map::is_device_mounted(std::string_view device_name) const { - return std::any_of(map.begin(), map.end(), [&](const decltype(map)::value_type& info) { return info.second.device == device_name; }); + return std::any_of(map.begin(), map.end(), [&](const decltype(map)::value_type& info) + { + return info.second.device == device_name; + }); } bool lv2_fs_mount_info_map::vfs_unmount(std::string_view vpath, bool remove_from_map) @@ -308,10 +311,9 @@ lv2_fs_mount_point* lv2_fs_object::get_mp(std::string_view filename, std::string { for (auto mp = &g_mp_sys_dev_root; mp; mp = mp->next) { - const auto& device_alias_check = !is_path && ( - (mp == &g_mp_sys_dev_hdd0 && mp_name == "CELL_FS_IOS:PATA0_HDD_DRIVE"sv) || - (mp == &g_mp_sys_dev_hdd1 && mp_name == "CELL_FS_IOS:PATA1_HDD_DRIVE"sv) || - (mp == &g_mp_sys_dev_flash2 && mp_name == "CELL_FS_IOS:BUILTIN_FLASH"sv)); // TODO confirm + const auto& device_alias_check = !is_path && ((mp == &g_mp_sys_dev_hdd0 && mp_name == "CELL_FS_IOS:PATA0_HDD_DRIVE"sv) || + (mp == &g_mp_sys_dev_hdd1 && mp_name == "CELL_FS_IOS:PATA1_HDD_DRIVE"sv) || + (mp == &g_mp_sys_dev_flash2 && mp_name == "CELL_FS_IOS:BUILTIN_FLASH"sv)); // TODO confirm if (mp == &g_mp_sys_dev_usb) { @@ -369,14 +371,12 @@ lv2_fs_mount_point* lv2_fs_object::get_mp(std::string_view filename, std::string } lv2_fs_object::lv2_fs_object(std::string_view filename) - : name(get_name(filename)) - , mp(g_fxo->get().lookup(name.data())) + : name(get_name(filename)), mp(g_fxo->get().lookup(name.data())) { } lv2_fs_object::lv2_fs_object(utils::serial& ar, bool) - : name(ar) - , mp(g_fxo->get().lookup(name.data())) + : name(ar), mp(g_fxo->get().lookup(name.data())) { } @@ -434,10 +434,7 @@ u64 lv2_file::op_write(const fs::file& file, vm::cptr buf, u64 size) } lv2_file::lv2_file(utils::serial& ar) - : lv2_fs_object(ar, false) - , mode(ar) - , flags(ar) - , type(ar) + : lv2_fs_object(ar, false), mode(ar), flags(ar), type(ar) { [[maybe_unused]] const s32 version = GET_SERIALIZATION_VERSION(lv2_fs); @@ -566,23 +563,22 @@ void lv2_file::save(utils::serial& ar) } lv2_dir::lv2_dir(utils::serial& ar) - : lv2_fs_object(ar, false) - , entries([&] - { - std::vector entries; + : lv2_fs_object(ar, false), entries([&] + { + std::vector entries; - u64 size = 0; - ar.deserialize_vle(size); - entries.resize(size); + u64 size = 0; + ar.deserialize_vle(size); + entries.resize(size); - for (auto& entry : entries) - { - ar(entry.name, static_cast(entry)); - } + for (auto& entry : entries) + { + ar(entry.name, static_cast(entry)); + } - return entries; - }()) - , pos(ar) + return entries; + }()), + pos(ar) { } @@ -620,9 +616,7 @@ struct lv2_file::file_view : fs::file_base u64 m_pos; explicit file_view(const shared_ptr& _file, u64 offset) - : m_file(_file) - , m_off(offset) - , m_pos(0) + : m_file(_file), m_off(offset), m_pos(0) { } @@ -635,7 +629,7 @@ struct lv2_file::file_view : fs::file_base fs::stat_t stat = m_file->file.get_stat(); // TODO: Check this on realhw - //stat.size = utils::sub_saturate(stat.size, m_off); + // stat.size = utils::sub_saturate(stat.size, m_off); stat.is_writable = false; return stat; @@ -669,7 +663,8 @@ struct lv2_file::file_view : fs::file_base const s64 new_pos = whence == fs::seek_set ? offset : whence == fs::seek_cur ? offset + m_pos : - whence == fs::seek_end ? offset + size() : -1; + whence == fs::seek_end ? offset + size() : + -1; if (new_pos < 0) { @@ -974,7 +969,6 @@ lv2_file::open_raw_result_t lv2_file::open_raw(const std::string& local_path, s3 file.reset(std::move(edata_file)); break; - } } @@ -1059,19 +1053,19 @@ error_code sys_fs_open(ppu_thread& ppu, vm::cptr path, s32 flags, vm::ptr< return {g_fxo->get().lookup(vpath) == &g_mp_sys_dev_hdd1 ? sys_fs.warning : sys_fs.error, error, path}; } - if (const u32 id = idm::import([&ppath = ppath, &file = file, mode, flags, &real = real, &type = type]() -> shared_ptr - { - shared_ptr result; + if (const u32 id = idm::import ([&ppath = ppath, &file = file, mode, flags, &real = real, &type = type]() -> shared_ptr + { + shared_ptr result; - if (type >= lv2_file_type::sdata && !g_fxo->get().npdrm_fds.try_inc(16)) - { - return result; - } + if (type >= lv2_file_type::sdata && !g_fxo->get().npdrm_fds.try_inc(16)) + { + return result; + } - result = stx::make_shared(ppath, std::move(file), mode, flags, real, type); - sys_fs.warning("sys_fs_open(): fd=%u, %s", idm::last_id(), *result); - return result; - })) + result = stx::make_shared(ppath, std::move(file), mode, flags, real, type); + sys_fs.warning("sys_fs_open(): fd=%u, %s", idm::last_id(), *result); + return result; + })) { ppu.check_state(); *fd = id; @@ -1294,14 +1288,14 @@ error_code sys_fs_close(ppu_thread& ppu, u32 fd) } ensure(idm::withdraw(fd, [&](lv2_file& _file) -> CellError - { - if (_file.type >= lv2_file_type::sdata) { - g_fxo->get().npdrm_fds--; - } + if (_file.type >= lv2_file_type::sdata) + { + g_fxo->get().npdrm_fds--; + } - return {}; - })); + return {}; + })); if (file->lock == 1) { @@ -1773,7 +1767,7 @@ error_code sys_fs_rename(ppu_thread& ppu, vm::cptr from, vm::cptr to } // Done in vfs::host::rename - //std::lock_guard lock(mp->mutex); + // std::lock_guard lock(mp->mutex); if (!vfs::host::rename(local_from, local_to, mp.mp, false)) { @@ -2030,9 +2024,7 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 file->file.seek(op_pos); } - arg->out_size = op == 0x8000000a - ? file->op_read(arg->buf, arg->size, op_pos) - : file->op_write(arg->buf, arg->size); + arg->out_size = op == 0x8000000a ? file->op_read(arg->buf, arg->size, op_pos) : file->op_write(arg->buf, arg->size); if (op == 0x8000000b) { @@ -2081,15 +2073,15 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 fs::file stream; stream.reset(std::move(sdata_file)); - if (const u32 id = idm::import([&file = *file, &stream = stream]() -> shared_ptr - { - if (!g_fxo->get().npdrm_fds.try_inc(16)) - { - return null_ptr; - } + if (const u32 id = idm::import ([&file = *file, &stream = stream]() -> shared_ptr + { + if (!g_fxo->get().npdrm_fds.try_inc(16)) + { + return null_ptr; + } - return stx::make_shared(file, std::move(stream), file.mode, CELL_FS_O_RDONLY, file.real_path, lv2_file_type::sdata); - })) + return stx::make_shared(file, std::move(stream), file.mode, CELL_FS_O_RDONLY, file.real_path, lv2_file_type::sdata); + })) { arg->out_code = CELL_OK; arg->out_fd = id; @@ -2151,8 +2143,8 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 if (false) { // TODO: /dev_hdd1, /dev_usb000, /dev_flash - //arg->out_code = CELL_OK; - //arg->out_id = 0x1b5; + // arg->out_code = CELL_OK; + // arg->out_id = 0x1b5; } arg->out_code = CELL_ENOTSUP; @@ -2182,7 +2174,7 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 case 0xc0000008: // cellFsSetDefaultContainer, cellFsSetIoBuffer, cellFsSetIoBufferFromDefaultContainer { // Allocates memory from a container/default container to a specific fd or default IO processing - const auto arg = vm::static_ptr_cast(_arg); + const auto arg = vm::static_ptr_cast(_arg); auto& default_container = g_fxo->get(); std::lock_guard def_container_lock(default_container.mutex); @@ -2190,8 +2182,8 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 if (fd == 0xFFFFFFFF) { // No check on container is done when setting default container - default_container.id = arg->size ? ::narrow(arg->container_id) : 0u; - default_container.cap = arg->size; + default_container.id = arg->size ? ::narrow(arg->container_id) : 0u; + default_container.cap = arg->size; default_container.used = 0; arg->out_code = CELL_OK; @@ -2213,7 +2205,7 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 } } - file->ct_id = 0; + file->ct_id = 0; file->ct_used = 0; // Aligns on lower bound @@ -2256,7 +2248,7 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 default_container.used += actual_size; } - file->ct_id = new_container_id; + file->ct_id = new_container_id; file->ct_used = actual_size; arg->out_code = CELL_OK; @@ -2552,7 +2544,7 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 break; } - std::string_view vpath{ arg->name.get_ptr(), arg->name_size }; + std::string_view vpath{arg->name.get_ptr(), arg->name_size}; vpath = vpath.substr(0, vpath.find_first_of('\0')); sys_fs.notice("sys_fs_fcntl(0xe0000025): %s", vpath); @@ -2566,15 +2558,15 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 return result.error; } - if (const u32 id = idm::import([&]() -> shared_ptr - { - if (!g_fxo->get().npdrm_fds.try_inc(16)) - { - return null_ptr; - } + if (const u32 id = idm::import ([&]() -> shared_ptr + { + if (!g_fxo->get().npdrm_fds.try_inc(16)) + { + return null_ptr; + } - return stx::make_shared(result.ppath, std::move(result.file), 0, 0, std::move(result.real_path), lv2_file_type::sdata); - })) + return stx::make_shared(result.ppath, std::move(result.file), 0, 0, std::move(result.real_path), lv2_file_type::sdata); + })) { arg->out_code = CELL_OK; arg->fd = id; @@ -3002,7 +2994,7 @@ error_code sys_fs_disk_free(ppu_thread& ppu, vm::cptr path, vm::ptr t { available = (1u << 31) - mp->sector_size; // 2GB (TODO: Should be the total size) } - else //if (mp == &g_mp_sys_dev_hdd0) + else // if (mp == &g_mp_sys_dev_hdd0) { available = (40ull * 1024 * 1024 * 1024 - mp->sector_size); // Read explanation in cellHddGameCheck } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_fs.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_fs.h index e64a2b4ed..8f0156baf 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_fs.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_fs.h @@ -10,16 +10,16 @@ // Open Flags enum : s32 { - CELL_FS_O_RDONLY = 000000, - CELL_FS_O_WRONLY = 000001, - CELL_FS_O_RDWR = 000002, + CELL_FS_O_RDONLY = 000000, + CELL_FS_O_WRONLY = 000001, + CELL_FS_O_RDWR = 000002, CELL_FS_O_ACCMODE = 000003, - CELL_FS_O_CREAT = 000100, - CELL_FS_O_EXCL = 000200, - CELL_FS_O_TRUNC = 001000, - CELL_FS_O_APPEND = 002000, - CELL_FS_O_MSELF = 010000, - CELL_FS_O_UNK = 01000000, // Tests have shown this is independent of other flags. Only known to be called in Rockband games. + CELL_FS_O_CREAT = 000100, + CELL_FS_O_EXCL = 000200, + CELL_FS_O_TRUNC = 001000, + CELL_FS_O_APPEND = 002000, + CELL_FS_O_MSELF = 010000, + CELL_FS_O_UNK = 01000000, // Tests have shown this is independent of other flags. Only known to be called in Rockband games. }; // Seek Mode @@ -39,7 +39,7 @@ enum : s32 enum : s32 { - CELL_FS_S_IFMT = 0170000, + CELL_FS_S_IFMT = 0170000, CELL_FS_S_IFDIR = 0040000, // directory CELL_FS_S_IFREG = 0100000, // regular CELL_FS_S_IFLNK = 0120000, // symbolic link @@ -61,16 +61,16 @@ enum : s32 // CellFsDirent.d_type enum : u8 { - CELL_FS_TYPE_UNKNOWN = 0, + CELL_FS_TYPE_UNKNOWN = 0, CELL_FS_TYPE_DIRECTORY = 1, - CELL_FS_TYPE_REGULAR = 2, - CELL_FS_TYPE_SYMLINK = 3, + CELL_FS_TYPE_REGULAR = 2, + CELL_FS_TYPE_SYMLINK = 3, }; enum : u32 { CELL_FS_IO_BUFFER_PAGE_SIZE_64KB = 0x0002, - CELL_FS_IO_BUFFER_PAGE_SIZE_1MB = 0x0004, + CELL_FS_IO_BUFFER_PAGE_SIZE_1MB = 0x0004, }; struct CellFsDirent @@ -117,7 +117,6 @@ struct FsMselfHeader be_t m_entry_num; be_t m_entry_size; u8 m_reserve[40]; - }; struct FsMselfEntry @@ -170,10 +169,7 @@ struct lv2_fs_mount_info const bool read_only; lv2_fs_mount_info(lv2_fs_mount_point* mp = nullptr, std::string_view device = {}, std::string_view file_system = {}, bool read_only = false) - : mp(mp ? mp : &g_mp_sys_no_device) - , device(device.empty() ? this->mp->device : device) - , file_system(file_system.empty() ? this->mp->file_system : file_system) - , read_only((this->mp->flags & lv2_mp_flag::read_only) || read_only) // respect the original flags of the mount point as well + : mp(mp ? mp : &g_mp_sys_no_device), device(device.empty() ? this->mp->device : device), file_system(file_system.empty() ? this->mp->file_system : file_system), read_only((this->mp->flags & lv2_mp_flag::read_only) || read_only) // respect the original flags of the mount point as well { } @@ -298,22 +294,12 @@ struct lv2_file final : lv2_fs_object } restore_data{}; lv2_file(std::string_view filename, fs::file&& file, s32 mode, s32 flags, const std::string& real_path, lv2_file_type type = {}) - : lv2_fs_object(filename) - , file(std::move(file)) - , mode(mode) - , flags(flags) - , real_path(real_path) - , type(type) + : lv2_fs_object(filename), file(std::move(file)), mode(mode), flags(flags), real_path(real_path), type(type) { } lv2_file(const lv2_file& host, fs::file&& file, s32 mode, s32 flags, const std::string& real_path, lv2_file_type type = {}) - : lv2_fs_object(host.name.data()) - , file(std::move(file)) - , mode(mode) - , flags(flags) - , real_path(real_path) - , type(type) + : lv2_fs_object(host.name.data()), file(std::move(file)), mode(mode), flags(flags), real_path(real_path), type(type) { } @@ -372,8 +358,7 @@ struct lv2_dir final : lv2_fs_object atomic_t pos{0}; lv2_dir(std::string_view filename, std::vector&& entries) - : lv2_fs_object(filename) - , entries(std::move(entries)) + : lv2_fs_object(filename), entries(std::move(entries)) { } @@ -409,7 +394,7 @@ namespace vtable vm::bptrb)> _dtor1; vm::bptrb)> _dtor2; }; -} +} // namespace vtable // sys_fs_fcntl: read with offset, write with offset struct lv2_file_op_rw : lv2_file_op @@ -420,10 +405,10 @@ struct lv2_file_op_rw : lv2_file_op be_t _x8; // ??? be_t _xc; // ??? - be_t fd; // File descriptor (3..255) + be_t fd; // File descriptor (3..255) vm::bptrb buf; // Buffer for data - be_t offset; // File offset - be_t size; // Access size + be_t offset; // File offset + be_t size; // Access size be_t out_code; // Op result be_t out_size; // Size processed @@ -443,10 +428,10 @@ struct lv2_file_op_09 : lv2_file_op be_t fd; be_t offset; be_t _vtabl2; - be_t arg1; // 0x180 - be_t arg2; // 0x10 + be_t arg1; // 0x180 + be_t arg2; // 0x10 be_t arg_size; // 6th arg - be_t arg_ptr; // 5th arg + be_t arg_ptr; // 5th arg be_t _x34; be_t out_code; @@ -463,12 +448,12 @@ struct lv2_file_e0000025 : lv2_file_op be_t name_size; vm::bcptr name; be_t _x14; - be_t _x18; // 0 - be_t _x1c; // 0 - be_t _x20; // 16 - be_t _x24; // unk, seems to be memory location - be_t out_code; // out_code - be_t fd; // 0xffffffff - likely fd out + be_t _x18; // 0 + be_t _x1c; // 0 + be_t _x20; // 16 + be_t _x24; // unk, seems to be memory location + be_t out_code; // out_code + be_t fd; // 0xffffffff - likely fd out }; CHECK_SIZE(lv2_file_e0000025, 0x30); @@ -521,9 +506,9 @@ struct lv2_file_c0000006 : lv2_file_op be_t _x8; // 0x18 - offset of out_code be_t name_size; vm::bcptr name; - be_t _x14; // 0 + be_t _x14; // 0 be_t out_code; // 0x80010003 - be_t out_id; // set to 0, may return 0x1b5 + be_t out_id; // set to 0, may return 0x1b5 }; CHECK_SIZE(lv2_file_c0000006, 0x20); @@ -531,7 +516,7 @@ CHECK_SIZE(lv2_file_c0000006, 0x20); // sys_fs_fcntl: cellFsArcadeHddSerialNumber struct lv2_file_c0000007 : lv2_file_op { - be_t out_code; // set to 0 + be_t out_code; // set to 0 vm::bcptr device; // CELL_FS_IOS:ATA_HDD be_t device_size; // 0x14 vm::bptr model; @@ -549,10 +534,10 @@ struct lv2_file_c0000008 : lv2_file_op u8 _x8[8]; be_t container_id; be_t size; - be_t page_type; // 0x4000 for cellFsSetDefaultContainer - // 0x4000 | page_type given by user, valid values seem to be: - // CELL_FS_IO_BUFFER_PAGE_SIZE_64KB 0x0002 - // CELL_FS_IO_BUFFER_PAGE_SIZE_1MB 0x0004 + be_t page_type; // 0x4000 for cellFsSetDefaultContainer + // 0x4000 | page_type given by user, valid values seem to be: + // CELL_FS_IO_BUFFER_PAGE_SIZE_64KB 0x0002 + // CELL_FS_IO_BUFFER_PAGE_SIZE_1MB 0x0004 be_t out_code; u8 _x24[4]; }; @@ -607,9 +592,9 @@ CHECK_SIZE(lv2_file_c000001c, 0x60); struct lv2_file_e0000017 : lv2_file_op { be_t size; // 0x28 - be_t _x4; // 0x10, offset - be_t _x8; // 0x20, offset - be_t _xc; // - + be_t _x4; // 0x10, offset + be_t _x8; // 0x20, offset + be_t _xc; // - vm::bcptr file_path; be_t file_size; be_t out_code; @@ -631,8 +616,8 @@ CHECK_SIZE(CellFsMountInfo, 0x94); struct default_sys_fs_container { shared_mutex mutex; - u32 id = 0; - u32 cap = 0; + u32 id = 0; + u32 cap = 0; u32 used = 0; }; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_game.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_game.cpp index 1164dbd21..61093a383 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_game.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_game.cpp @@ -123,15 +123,16 @@ struct watchdog_t old_time = std::exchange(current_time, get_system_time()); const auto old = control.fetch_op([&](control_t& data) - { - if (data.needs_restart) - { - data.needs_restart = false; - return true; - } + { + if (data.needs_restart) + { + data.needs_restart = false; + return true; + } - return false; - }).first; + return false; + }) + .first; if (old.active && old.needs_restart) { @@ -145,9 +146,9 @@ struct watchdog_t sys_game.success("Watchdog timeout! Restarting the game..."); Emu.CallFromMainThread([]() - { - Emu.Restart(false); - }); + { + Emu.Restart(false); + }); return; } @@ -177,17 +178,18 @@ error_code _sys_game_watchdog_start(u32 timeout) timeout &= -64; if (!g_fxo->get>().control.fetch_op([&](watchdog_t::control_t& data) - { - if (data.active) - { - return false; - } + { + if (data.active) + { + return false; + } - data.needs_restart = true; - data.active = true; - data.timeout = timeout; - return true; - }).second) + data.needs_restart = true; + data.active = true; + data.timeout = timeout; + return true; + }) + .second) { return CELL_EABORT; } @@ -200,15 +202,15 @@ error_code _sys_game_watchdog_stop() sys_game.trace("sys_game_watchdog_stop()"); g_fxo->get>().control.fetch_op([](watchdog_t::control_t& data) - { - if (!data.active) { - return false; - } + if (!data.active) + { + return false; + } - data.active = false; - return true; - }); + data.active = false; + return true; + }); return CELL_OK; } @@ -218,15 +220,15 @@ error_code _sys_game_watchdog_clear() sys_game.trace("sys_game_watchdog_clear()"); g_fxo->get>().control.fetch_op([](watchdog_t::control_t& data) - { - if (!data.active || data.needs_restart) { - return false; - } + if (!data.active || data.needs_restart) + { + return false; + } - data.needs_restart = true; - return true; - }); + data.needs_restart = true; + return true; + }); return CELL_OK; } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_gamepad.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_gamepad.h index 832d8553c..c830602f6 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_gamepad.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_gamepad.h @@ -2,6 +2,6 @@ #include "Emu/Memory/vm_ptr.h" -//Syscalls +// Syscalls u32 sys_gamepad_ycon_if(u8 packet_id, vm::ptr in, vm::ptr out); diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_gpio.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_gpio.h index 3208c4f7f..e2cd1ff23 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_gpio.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_gpio.h @@ -5,8 +5,8 @@ enum : u64 { - SYS_GPIO_UNKNOWN_DEVICE_ID = 0x0, - SYS_GPIO_LED_DEVICE_ID = 0x1, + SYS_GPIO_UNKNOWN_DEVICE_ID = 0x0, + SYS_GPIO_LED_DEVICE_ID = 0x1, SYS_GPIO_DIP_SWITCH_DEVICE_ID = 0x2, }; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_hid.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_hid.cpp index 05f87895a..ef932b614 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_hid.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_hid.cpp @@ -15,7 +15,7 @@ error_code sys_hid_manager_open(ppu_thread& ppu, u64 device_type, u64 port_no, v { sys_hid.todo("sys_hid_manager_open(device_type=0x%llx, port_no=0x%llx, handle=*0x%llx)", device_type, port_no, handle); - //device type == 1 = pad, 2 = kb, 3 = mouse + // device type == 1 = pad, 2 = kb, 3 = mouse if (device_type > 3) { return CELL_EINVAL; @@ -74,7 +74,7 @@ error_code sys_hid_manager_ioctl(u32 hid_handle, u32 pkg_id, vm::ptr buf, info->vid = 0x054C; info->pid = 0x0268; - u8 realhw[17] = { 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x50, 0x00, 0x00, 0x1c, 0x1f }; + u8 realhw[17] = {0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x50, 0x00, 0x00, 0x1c, 0x1f}; memcpy(info->unk, &realhw, 17); } else if (pkg_id == 5) @@ -87,7 +87,7 @@ error_code sys_hid_manager_ioctl(u32 hid_handle, u32 pkg_id, vm::ptr buf, else if (pkg_id == 0x68) { [[maybe_unused]] auto info = vm::static_ptr_cast(buf); - //info->unk2 = 0; + // info->unk2 = 0; } return CELL_OK; @@ -158,14 +158,13 @@ error_code sys_hid_manager_read(u32 handle, u32 pkg_id, vm::ptr buf, u64 b return CELL_EFAULT; } - (pkg_id == 2 || pkg_id == 0x81 ? sys_hid.trace : sys_hid.todo) - ("sys_hid_manager_read(handle=0x%x, pkg_id=0x%x, buf=*0x%x, buf_size=0x%llx)", handle, pkg_id, buf, buf_size); + (pkg_id == 2 || pkg_id == 0x81 ? sys_hid.trace : sys_hid.todo)("sys_hid_manager_read(handle=0x%x, pkg_id=0x%x, buf=*0x%x, buf_size=0x%llx)", handle, pkg_id, buf, buf_size); if (pkg_id == 2) { // cellPadGetData // it returns just button array from 'CellPadData' - //auto data = vm::static_ptr_cast(buf); + // auto data = vm::static_ptr_cast(buf); // todo: use handle and dont call cellpad here vm::var tmpData; if ((cellPadGetData(0, +tmpData) == CELL_OK) && tmpData->len > 0) diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp index 3109f042f..d78d17e89 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp @@ -12,30 +12,27 @@ LOG_CHANNEL(sys_interrupt); lv2_int_tag::lv2_int_tag() noexcept - : lv2_obj(1) - , id(idm::last_id()) + : lv2_obj(1), id(idm::last_id()) { } lv2_int_tag::lv2_int_tag(utils::serial& ar) noexcept - : lv2_obj(1) - , id(idm::last_id()) - , handler([&]() - { - const u32 id = ar; + : lv2_obj(1), id(idm::last_id()), handler([&]() + { + const u32 id = ar; - auto ptr = idm::get_unlocked(id); + auto ptr = idm::get_unlocked(id); - if (!ptr && id) - { - Emu.PostponeInitCode([id, &handler = this->handler]() - { - handler = ensure(idm::get_unlocked(id)); - }); - } + if (!ptr && id) + { + Emu.PostponeInitCode([id, &handler = this->handler]() + { + handler = ensure(idm::get_unlocked(id)); + }); + } - return ptr; - }()) + return ptr; + }()) { } @@ -45,20 +42,12 @@ void lv2_int_tag::save(utils::serial& ar) } lv2_int_serv::lv2_int_serv(shared_ptr> thread, u64 arg1, u64 arg2) noexcept - : lv2_obj(1) - , id(idm::last_id()) - , thread(thread) - , arg1(arg1) - , arg2(arg2) + : lv2_obj(1), id(idm::last_id()), thread(thread), arg1(arg1), arg2(arg2) { } lv2_int_serv::lv2_int_serv(utils::serial& ar) noexcept - : lv2_obj(1) - , id(idm::last_id()) - , thread(idm::get_unlocked>(ar)) - , arg1(ar) - , arg2(ar) + : lv2_obj(1), id(idm::last_id()), thread(idm::get_unlocked>(ar)), arg1(ar), arg2(ar) { } @@ -71,26 +60,20 @@ void ppu_interrupt_thread_entry(ppu_thread&, ppu_opcode_t, be_t*, struct pp void lv2_int_serv::exec() const { - thread->cmd_list - ({ - { ppu_cmd::reset_stack, 0 }, - { ppu_cmd::set_args, 2 }, arg1, arg2, - { ppu_cmd::entry_call, 0 }, - { ppu_cmd::sleep, 0 }, - { ppu_cmd::ptr_call, 0 }, - std::bit_cast(&ppu_interrupt_thread_entry) - }); + thread->cmd_list({{ppu_cmd::reset_stack, 0}, + {ppu_cmd::set_args, 2}, arg1, arg2, + {ppu_cmd::entry_call, 0}, + {ppu_cmd::sleep, 0}, + {ppu_cmd::ptr_call, 0}, + std::bit_cast(&ppu_interrupt_thread_entry)}); } void ppu_thread_exit(ppu_thread&, ppu_opcode_t, be_t*, struct ppu_intrp_func*); void lv2_int_serv::join() const { - thread->cmd_list - ({ - { ppu_cmd::ptr_call, 0 }, - std::bit_cast(&ppu_thread_exit) - }); + thread->cmd_list({{ppu_cmd::ptr_call, 0}, + std::bit_cast(&ppu_thread_exit)}); thread->cmd_notify.store(1); thread->cmd_notify.notify_one(); @@ -106,15 +89,15 @@ error_code sys_interrupt_tag_destroy(ppu_thread& ppu, u32 intrtag) sys_interrupt.warning("sys_interrupt_tag_destroy(intrtag=0x%x)", intrtag); const auto tag = idm::withdraw(intrtag, [](lv2_int_tag& tag) -> CellError - { - if (lv2_obj::check(tag.handler)) { - return CELL_EBUSY; - } + if (lv2_obj::check(tag.handler)) + { + return CELL_EBUSY; + } - tag.exists.release(0); - return {}; - }); + tag.exists.release(0); + return {}; + }); if (!tag) { @@ -137,57 +120,54 @@ error_code _sys_interrupt_thread_establish(ppu_thread& ppu, vm::ptr ih, u32 CellError error = CELL_EAGAIN; - const u32 id = idm::import([&]() - { - shared_ptr result; - - // Get interrupt tag - const auto tag = idm::check_unlocked(intrtag); - - if (!tag) + const u32 id = idm::import ([&]() { - error = CELL_ESRCH; + shared_ptr result; + + // Get interrupt tag + const auto tag = idm::check_unlocked(intrtag); + + if (!tag) + { + error = CELL_ESRCH; + return result; + } + + // Get interrupt thread + const auto it = idm::get_unlocked>(intrthread); + + if (!it) + { + error = CELL_ESRCH; + return result; + } + + // If interrupt thread is running, it's already established on another interrupt tag + if (cpu_flag::stop - it->state) + { + error = CELL_EAGAIN; + return result; + } + + // It's unclear if multiple handlers can be established on single interrupt tag + if (lv2_obj::check(tag->handler)) + { + error = CELL_ESTAT; + return result; + } + + result = make_shared(it, arg1, arg2); + tag->handler = result; + + it->cmd_list({{ppu_cmd::ptr_call, 0}, + std::bit_cast(&ppu_interrupt_thread_entry)}); + + it->state -= cpu_flag::stop; + it->state.notify_one(); + return result; - } - - // Get interrupt thread - const auto it = idm::get_unlocked>(intrthread); - - if (!it) - { - error = CELL_ESRCH; - return result; - } - - // If interrupt thread is running, it's already established on another interrupt tag - if (cpu_flag::stop - it->state) - { - error = CELL_EAGAIN; - return result; - } - - // It's unclear if multiple handlers can be established on single interrupt tag - if (lv2_obj::check(tag->handler)) - { - error = CELL_ESTAT; - return result; - } - - result = make_shared(it, arg1, arg2); - tag->handler = result; - - it->cmd_list - ({ - { ppu_cmd::ptr_call, 0 }, - std::bit_cast(&ppu_interrupt_thread_entry) }); - it->state -= cpu_flag::stop; - it->state.notify_one(); - - return result; - }); - if (id) { ppu.check_state(); @@ -205,9 +185,9 @@ error_code _sys_interrupt_thread_disestablish(ppu_thread& ppu, u32 ih, vm::ptr(ih, [](lv2_obj& obj) - { - obj.exists.release(0); - }); + { + obj.exists.release(0); + }); if (!handler) { @@ -255,34 +235,34 @@ void ppu_interrupt_thread_entry(ppu_thread& ppu, ppu_opcode_t, be_t*, struc // Loop endlessly trying to invoke an interrupt if required idm::select>([&](u32, spu_thread& spu) - { - if (spu.get_type() != spu_type::threaded) { - auto& ctrl = spu.int_ctrl[2]; - - if (lv2_obj::check(ctrl.tag)) + if (spu.get_type() != spu_type::threaded) { - auto& handler = ctrl.tag->handler; + auto& ctrl = spu.int_ctrl[2]; - if (lv2_obj::check(handler)) + if (lv2_obj::check(ctrl.tag)) { - if (handler->thread.get() == &ppu) - { - if (spu.ch_out_intr_mbox.get_count() && ctrl.mask & SPU_INT2_STAT_MAILBOX_INT) - { - ctrl.stat |= SPU_INT2_STAT_MAILBOX_INT; - } + auto& handler = ctrl.tag->handler; - if (ctrl.mask & ctrl.stat) + if (lv2_obj::check(handler)) + { + if (handler->thread.get() == &ppu) { - ensure(!serv); - serv = handler; + if (spu.ch_out_intr_mbox.get_count() && ctrl.mask & SPU_INT2_STAT_MAILBOX_INT) + { + ctrl.stat |= SPU_INT2_STAT_MAILBOX_INT; + } + + if (ctrl.mask & ctrl.stat) + { + ensure(!serv); + serv = handler; + } } } } } - } - }); + }); if (serv) { diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_io.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_io.h index 27c8b9985..c60b18d90 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_io.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_io.h @@ -15,10 +15,7 @@ struct lv2_io_buf const u32 unk1; lv2_io_buf(u32 block_count, u32 block_size, u32 blocks, u32 unk1) - : block_count(block_count) - , block_size(block_size) - , blocks(blocks) - , unk1(unk1) + : block_count(block_count), block_size(block_size), blocks(blocks), unk1(unk1) { } }; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp index 75835ffa2..e840cbeff 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp @@ -12,10 +12,7 @@ LOG_CHANNEL(sys_lwcond); lv2_lwcond::lv2_lwcond(utils::serial& ar) - : name(ar.pop>()) - , lwid(ar) - , protocol(ar) - , control(ar.pop()) + : name(ar.pop>()), lwid(ar), protocol(ar), control(ar.pop()) { } @@ -35,9 +32,9 @@ error_code _sys_lwcond_create(ppu_thread& ppu, vm::ptr lwcond_id, u32 lwmut // Extract protocol from lwmutex if (!idm::check(lwmutex_id, [&protocol](lv2_lwmutex& mutex) - { - protocol = mutex.protocol; - })) + { + protocol = mutex.protocol; + })) { return CELL_ESRCH; } @@ -71,34 +68,34 @@ error_code _sys_lwcond_destroy(ppu_thread& ppu, u32 lwcond_id) s32 old_val = 0; auto [ptr, ret] = idm::withdraw(lwcond_id, [&](lv2_lwcond& cond) -> CellError - { - // Ignore check on first iteration - if (_cond && std::addressof(cond) != _cond.get()) { - // Other thread has destroyed the lwcond earlier - return CELL_ESRCH; - } + // Ignore check on first iteration + if (_cond && std::addressof(cond) != _cond.get()) + { + // Other thread has destroyed the lwcond earlier + return CELL_ESRCH; + } - std::lock_guard lock(cond.mutex); + std::lock_guard lock(cond.mutex); - if (atomic_storage::load(cond.sq)) - { - return CELL_EBUSY; - } + if (atomic_storage::load(cond.sq)) + { + return CELL_EBUSY; + } - old_val = cond.lwmutex_waiters.or_fetch(smin); + old_val = cond.lwmutex_waiters.or_fetch(smin); - if (old_val != smin) - { - // De-schedule if waiters were found - lv2_obj::sleep(ppu); + if (old_val != smin) + { + // De-schedule if waiters were found + lv2_obj::sleep(ppu); - // Repeat loop: there are lwmutex waiters inside _sys_lwcond_queue_wait - return CELL_EAGAIN; - } + // Repeat loop: there are lwmutex waiters inside _sys_lwcond_queue_wait + return CELL_EAGAIN; + } - return {}; - }); + return {}; + }); if (!ptr) { @@ -168,113 +165,113 @@ error_code _sys_lwcond_signal(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id, u6 ppu.state += cpu_flag::wait; const auto cond = idm::check(lwcond_id, [&, notify = lv2_obj::notify_all_t()](lv2_lwcond& cond) -> int - { - ppu_thread* cpu = nullptr; - - if (ppu_thread_id != u32{umax}) { - cpu = idm::check_unlocked>(static_cast(ppu_thread_id)); + ppu_thread* cpu = nullptr; - if (!cpu) + if (ppu_thread_id != u32{umax}) { - return -1; - } - } + cpu = idm::check_unlocked>(static_cast(ppu_thread_id)); - lv2_lwmutex* mutex = nullptr; - - if (mode != 2) - { - mutex = idm::check_unlocked(lwmutex_id); - - if (!mutex) - { - return -1; - } - } - - if (atomic_storage::load(cond.sq)) - { - std::lock_guard lock(cond.mutex); - - if (ppu.state & cpu_flag::suspend) - { - // Test if another signal caused the current thread to be suspended, in which case it needs to wait until the thread wakes up (otherwise the signal may cause unexpected results) - finished = false; - return 0; - } - - if (cpu) - { - if (static_cast(cpu)->state & cpu_flag::again) + if (!cpu) { - ppu.state += cpu_flag::again; - return 0; + return -1; } } - auto result = cpu ? cond.unqueue(cond.sq, cpu) : - cond.schedule(cond.sq, cond.protocol); + lv2_lwmutex* mutex = nullptr; - if (result) + if (mode != 2) { - if (static_cast(result)->state & cpu_flag::again) + mutex = idm::check_unlocked(lwmutex_id); + + if (!mutex) { - ppu.state += cpu_flag::again; + return -1; + } + } + + if (atomic_storage::load(cond.sq)) + { + std::lock_guard lock(cond.mutex); + + if (ppu.state & cpu_flag::suspend) + { + // Test if another signal caused the current thread to be suspended, in which case it needs to wait until the thread wakes up (otherwise the signal may cause unexpected results) + finished = false; return 0; } - if (mode == 2) + if (cpu) { - static_cast(result)->gpr[3] = CELL_EBUSY; + if (static_cast(cpu)->state & cpu_flag::again) + { + ppu.state += cpu_flag::again; + return 0; + } } - else if (mode == 3 && mutex->load_sq()) [[unlikely]] + + auto result = cpu ? cond.unqueue(cond.sq, cpu) : + cond.schedule(cond.sq, cond.protocol); + + if (result) { - std::lock_guard lock(mutex->mutex); - - // Respect ordering of the sleep queue - mutex->try_own(result, true); - auto result2 = mutex->reown(); - - if (result2->state & cpu_flag::again) + if (static_cast(result)->state & cpu_flag::again) { ppu.state += cpu_flag::again; return 0; } - if (result2 != result) + if (mode == 2) { - cond.awake(result2); + static_cast(result)->gpr[3] = CELL_EBUSY; + } + else if (mode == 3 && mutex->load_sq()) [[unlikely]] + { + std::lock_guard lock(mutex->mutex); + + // Respect ordering of the sleep queue + mutex->try_own(result, true); + auto result2 = mutex->reown(); + + if (result2->state & cpu_flag::again) + { + ppu.state += cpu_flag::again; + return 0; + } + + if (result2 != result) + { + cond.awake(result2); + result = nullptr; + } + } + else if (mode == 1) + { + mutex->try_own(result, true); result = nullptr; } - } - else if (mode == 1) - { - mutex->try_own(result, true); - result = nullptr; - } - if (result) - { - cond.awake(result); - } + if (result) + { + cond.awake(result); + } - return 1; + return 1; + } } - } - else - { - cond.mutex.lock_unlock(); - - if (ppu.state & cpu_flag::suspend) + else { - finished = false; - return 0; - } - } + cond.mutex.lock_unlock(); - return 0; - }); + if (ppu.state & cpu_flag::suspend) + { + finished = false; + return 0; + } + } + + return 0; + }); if (!finished) { @@ -334,83 +331,83 @@ error_code _sys_lwcond_signal_all(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id ppu.state += cpu_flag::wait; const auto cond = idm::check(lwcond_id, [&, notify = lv2_obj::notify_all_t()](lv2_lwcond& cond) -> int - { - lv2_lwmutex* mutex{}; - - if (mode != 2) { - mutex = idm::check_unlocked(lwmutex_id); + lv2_lwmutex* mutex{}; - if (!mutex) + if (mode != 2) { - return -1; - } - } + mutex = idm::check_unlocked(lwmutex_id); - if (atomic_storage::load(cond.sq)) - { - std::lock_guard lock(cond.mutex); - - if (ppu.state & cpu_flag::suspend) - { - // Test if another signal caused the current thread to be suspended, in which case it needs to wait until the thread wakes up (otherwise the signal may cause unexpected results) - finished = false; - return 0; - } - - u32 result = 0; - - for (auto cpu = +cond.sq; cpu; cpu = cpu->next_cpu) - { - if (cpu->state & cpu_flag::again) + if (!mutex) { - ppu.state += cpu_flag::again; + return -1; + } + } + + if (atomic_storage::load(cond.sq)) + { + std::lock_guard lock(cond.mutex); + + if (ppu.state & cpu_flag::suspend) + { + // Test if another signal caused the current thread to be suspended, in which case it needs to wait until the thread wakes up (otherwise the signal may cause unexpected results) + finished = false; + return 0; + } + + u32 result = 0; + + for (auto cpu = +cond.sq; cpu; cpu = cpu->next_cpu) + { + if (cpu->state & cpu_flag::again) + { + ppu.state += cpu_flag::again; + return 0; + } + } + + auto sq = cond.sq; + atomic_storage::release(cond.sq, nullptr); + + while (const auto cpu = cond.schedule(sq, cond.protocol)) + { + if (mode == 2) + { + static_cast(cpu)->gpr[3] = CELL_EBUSY; + } + + if (mode == 1) + { + mutex->try_own(cpu, true); + } + else + { + lv2_obj::append(cpu); + } + + result++; + } + + if (result && mode == 2) + { + lv2_obj::awake_all(); + } + + return result; + } + else + { + cond.mutex.lock_unlock(); + + if (ppu.state & cpu_flag::suspend) + { + finished = false; return 0; } } - auto sq = cond.sq; - atomic_storage::release(cond.sq, nullptr); - - while (const auto cpu = cond.schedule(sq, cond.protocol)) - { - if (mode == 2) - { - static_cast(cpu)->gpr[3] = CELL_EBUSY; - } - - if (mode == 1) - { - mutex->try_own(cpu, true); - } - else - { - lv2_obj::append(cpu); - } - - result++; - } - - if (result && mode == 2) - { - lv2_obj::awake_all(); - } - - return result; - } - else - { - cond.mutex.lock_unlock(); - - if (ppu.state & cpu_flag::suspend) - { - finished = false; - return 0; - } - } - - return 0; - }); + return 0; + }); if (!finished) { @@ -445,60 +442,60 @@ error_code _sys_lwcond_queue_wait(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id auto& sstate = *ppu.optional_savestate_state; const auto cond = idm::get(lwcond_id, [&, notify = lv2_obj::notify_all_t()](lv2_lwcond& cond) - { - mutex = idm::get_unlocked(lwmutex_id); - - if (!mutex) { - return; - } + mutex = idm::get_unlocked(lwmutex_id); - // Increment lwmutex's lwcond's waiters count - mutex->lwcond_waiters++; - - lv2_obj::prepare_for_sleep(ppu); - - std::lock_guard lock(cond.mutex); - - cond.lwmutex_waiters++; - - const bool mutex_sleep = sstate.try_read().second; - sstate.clear(); - - if (mutex_sleep) - { - // Special: loading state from the point of waiting on lwmutex sleep queue - mutex->try_own(&ppu, true); - } - else - { - // Add a waiter - lv2_obj::emplace(cond.sq, &ppu); - } - - if (!ppu.loaded_from_savestate && !mutex->try_unlock(false)) - { - std::lock_guard lock2(mutex->mutex); - - // Process lwmutex sleep queue - if (const auto cpu = mutex->reown()) + if (!mutex) { - if (static_cast(cpu)->state & cpu_flag::again) - { - ensure(cond.unqueue(cond.sq, &ppu)); - ppu.state += cpu_flag::again; - return; - } - - // Put the current thread to sleep and schedule lwmutex waiter atomically - cond.append(cpu); - cond.sleep(ppu, timeout); return; } - } - cond.sleep(ppu, timeout); - }); + // Increment lwmutex's lwcond's waiters count + mutex->lwcond_waiters++; + + lv2_obj::prepare_for_sleep(ppu); + + std::lock_guard lock(cond.mutex); + + cond.lwmutex_waiters++; + + const bool mutex_sleep = sstate.try_read().second; + sstate.clear(); + + if (mutex_sleep) + { + // Special: loading state from the point of waiting on lwmutex sleep queue + mutex->try_own(&ppu, true); + } + else + { + // Add a waiter + lv2_obj::emplace(cond.sq, &ppu); + } + + if (!ppu.loaded_from_savestate && !mutex->try_unlock(false)) + { + std::lock_guard lock2(mutex->mutex); + + // Process lwmutex sleep queue + if (const auto cpu = mutex->reown()) + { + if (static_cast(cpu)->state & cpu_flag::again) + { + ensure(cond.unqueue(cond.sq, &ppu)); + ppu.state += cpu_flag::again; + return; + } + + // Put the current thread to sleep and schedule lwmutex waiter atomically + cond.append(cpu); + cond.sleep(ppu, timeout); + return; + } + } + + cond.sleep(ppu, timeout); + }); if (!cond || !mutex) { @@ -558,7 +555,7 @@ error_code _sys_lwcond_queue_wait(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id } if (ppu.state & cpu_flag::signal) - { + { continue; } @@ -587,28 +584,28 @@ error_code _sys_lwcond_queue_wait(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id bool success = false; mutex->lv2_control.fetch_op([&](lv2_lwmutex::control_data_t& data) - { - success = false; - - ppu_thread* sq = static_cast(data.sq); - - const bool retval = &ppu == sq; - - if (!mutex->unqueue(sq, &ppu)) { - return false; - } + success = false; - success = true; + ppu_thread* sq = static_cast(data.sq); - if (!retval) - { - return false; - } + const bool retval = &ppu == sq; - data.sq = sq; - return true; - }); + if (!mutex->unqueue(sq, &ppu)) + { + return false; + } + + success = true; + + if (!retval) + { + return false; + } + + data.sq = sq; + return true; + }); if (success) { diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwcond.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwcond.h index 1a841b08c..086964c90 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwcond.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwcond.h @@ -36,10 +36,7 @@ struct lv2_lwcond final : lv2_obj atomic_t lwmutex_waiters = 0; lv2_lwcond(u64 name, u32 lwid, u32 protocol, vm::ptr control) noexcept - : name(std::bit_cast>(name)) - , lwid(lwid) - , protocol{static_cast(protocol)} - , control(control) + : name(std::bit_cast>(name)), lwid(lwid), protocol{static_cast(protocol)}, control(control) { } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp index a56bffedc..441a36bf5 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp @@ -11,9 +11,7 @@ LOG_CHANNEL(sys_lwmutex); lv2_lwmutex::lv2_lwmutex(utils::serial& ar) - : protocol(ar) - , control(ar.pop()) - , name(ar.pop>()) + : protocol(ar), control(ar.pop()), name(ar.pop>()) { ar(lv2_control.raw().signaled); } @@ -63,34 +61,34 @@ error_code _sys_lwmutex_destroy(ppu_thread& ppu, u32 lwmutex_id) s32 old_val = 0; auto [ptr, ret] = idm::withdraw(lwmutex_id, [&](lv2_lwmutex& mutex) -> CellError - { - // Ignore check on first iteration - if (_mutex && std::addressof(mutex) != _mutex.get()) { - // Other thread has destroyed the lwmutex earlier - return CELL_ESRCH; - } + // Ignore check on first iteration + if (_mutex && std::addressof(mutex) != _mutex.get()) + { + // Other thread has destroyed the lwmutex earlier + return CELL_ESRCH; + } - std::lock_guard lock(mutex.mutex); + std::lock_guard lock(mutex.mutex); - if (mutex.load_sq()) - { - return CELL_EBUSY; - } + if (mutex.load_sq()) + { + return CELL_EBUSY; + } - old_val = mutex.lwcond_waiters.or_fetch(smin); + old_val = mutex.lwcond_waiters.or_fetch(smin); - if (old_val != smin) - { - // Deschedule if waiters were found - lv2_obj::sleep(ppu); + if (old_val != smin) + { + // Deschedule if waiters were found + lv2_obj::sleep(ppu); - // Repeat loop: there are lwcond waiters - return CELL_EAGAIN; - } + // Repeat loop: there are lwcond waiters + return CELL_EAGAIN; + } - return {}; - }); + return {}; + }); if (!ptr) { @@ -141,45 +139,46 @@ error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout) ppu.gpr[3] = CELL_OK; const auto mutex = idm::get(lwmutex_id, [&, notify = lv2_obj::notify_all_t()](lv2_lwmutex& mutex) - { - if (s32 signal = mutex.lv2_control.fetch_op([](lv2_lwmutex::control_data_t& data) { - if (data.signaled) + if (s32 signal = mutex.lv2_control.fetch_op([](lv2_lwmutex::control_data_t& data) + { + if (data.signaled) + { + data.signaled = 0; + return true; + } + + return false; + }) + .first.signaled) { - data.signaled = 0; + if (~signal & 1) + { + ppu.gpr[3] = CELL_EBUSY; + } + return true; } - return false; - }).first.signaled) - { - if (~signal & 1) + lv2_obj::prepare_for_sleep(ppu); + + ppu.cancel_sleep = 1; + + if (s32 signal = mutex.try_own(&ppu)) { - ppu.gpr[3] = CELL_EBUSY; + if (~signal & 1) + { + ppu.gpr[3] = CELL_EBUSY; + } + + ppu.cancel_sleep = 0; + return true; } - return true; - } - - lv2_obj::prepare_for_sleep(ppu); - - ppu.cancel_sleep = 1; - - if (s32 signal = mutex.try_own(&ppu)) - { - if (~signal & 1) - { - ppu.gpr[3] = CELL_EBUSY; - } - - ppu.cancel_sleep = 0; - return true; - } - - const bool finished = !mutex.sleep(ppu, timeout); - notify.cleanup(); - return finished; - }); + const bool finished = !mutex.sleep(ppu, timeout); + notify.cleanup(); + return finished; + }); if (!mutex) { @@ -220,7 +219,7 @@ error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout) } if (ppu.state & cpu_flag::signal) - { + { continue; } @@ -248,28 +247,28 @@ error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout) bool success = false; mutex->lv2_control.fetch_op([&](lv2_lwmutex::control_data_t& data) - { - success = false; - - ppu_thread* sq = static_cast(data.sq); - - const bool retval = &ppu == sq; - - if (!mutex->unqueue(sq, &ppu)) { - return false; - } + success = false; - success = true; + ppu_thread* sq = static_cast(data.sq); - if (!retval) - { - return false; - } + const bool retval = &ppu == sq; - data.sq = sq; - return true; - }); + if (!mutex->unqueue(sq, &ppu)) + { + return false; + } + + success = true; + + if (!retval) + { + return false; + } + + data.sq = sq; + return true; + }); if (success) { @@ -296,21 +295,21 @@ error_code _sys_lwmutex_trylock(ppu_thread& ppu, u32 lwmutex_id) sys_lwmutex.trace("_sys_lwmutex_trylock(lwmutex_id=0x%x)", lwmutex_id); const auto mutex = idm::check(lwmutex_id, [&](lv2_lwmutex& mutex) - { - auto [_, ok] = mutex.lv2_control.fetch_op([](lv2_lwmutex::control_data_t& data) { - if (data.signaled & 1) - { - data.signaled = 0; - return true; - } + auto [_, ok] = mutex.lv2_control.fetch_op([](lv2_lwmutex::control_data_t& data) + { + if (data.signaled & 1) + { + data.signaled = 0; + return true; + } - return false; + return false; + }); + + return ok; }); - return ok; - }); - if (!mutex) { return CELL_ESRCH; @@ -331,26 +330,26 @@ error_code _sys_lwmutex_unlock(ppu_thread& ppu, u32 lwmutex_id) sys_lwmutex.trace("_sys_lwmutex_unlock(lwmutex_id=0x%x)", lwmutex_id); const auto mutex = idm::check(lwmutex_id, [&, notify = lv2_obj::notify_all_t()](lv2_lwmutex& mutex) - { - if (mutex.try_unlock(false)) { - return; - } - - std::lock_guard lock(mutex.mutex); - - if (const auto cpu = mutex.reown()) - { - if (static_cast(cpu)->state & cpu_flag::again) + if (mutex.try_unlock(false)) { - ppu.state += cpu_flag::again; return; } - mutex.awake(cpu); - notify.cleanup(); // lv2_lwmutex::mutex is not really active 99% of the time, can be ignored - } - }); + std::lock_guard lock(mutex.mutex); + + if (const auto cpu = mutex.reown()) + { + if (static_cast(cpu)->state & cpu_flag::again) + { + ppu.state += cpu_flag::again; + return; + } + + mutex.awake(cpu); + notify.cleanup(); // lv2_lwmutex::mutex is not really active 99% of the time, can be ignored + } + }); if (!mutex) { @@ -367,27 +366,27 @@ error_code _sys_lwmutex_unlock2(ppu_thread& ppu, u32 lwmutex_id) sys_lwmutex.warning("_sys_lwmutex_unlock2(lwmutex_id=0x%x)", lwmutex_id); const auto mutex = idm::check(lwmutex_id, [&, notify = lv2_obj::notify_all_t()](lv2_lwmutex& mutex) - { - if (mutex.try_unlock(true)) { - return; - } - - std::lock_guard lock(mutex.mutex); - - if (const auto cpu = mutex.reown(true)) - { - if (static_cast(cpu)->state & cpu_flag::again) + if (mutex.try_unlock(true)) { - ppu.state += cpu_flag::again; return; } - static_cast(cpu)->gpr[3] = CELL_EBUSY; - mutex.awake(cpu); - notify.cleanup(); // lv2_lwmutex::mutex is not really active 99% of the time, can be ignored - } - }); + std::lock_guard lock(mutex.mutex); + + if (const auto cpu = mutex.reown(true)) + { + if (static_cast(cpu)->state & cpu_flag::again) + { + ppu.state += cpu_flag::again; + return; + } + + static_cast(cpu)->gpr[3] = CELL_EBUSY; + mutex.awake(cpu); + notify.cleanup(); // lv2_lwmutex::mutex is not really active 99% of the time, can be ignored + } + }); if (!mutex) { diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwmutex.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwmutex.h index 5a97fbae1..2a5e1c901 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwmutex.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_lwmutex.h @@ -18,8 +18,8 @@ struct sys_lwmutex_attribute_t enum : u32 { - lwmutex_free = 0xffffffffu, - lwmutex_dead = 0xfffffffeu, + lwmutex_free = 0xffffffffu, + lwmutex_dead = 0xfffffffeu, lwmutex_reserved = 0xfffffffdu, }; @@ -39,8 +39,7 @@ struct sys_lwmutex_t { atomic_be_t owner; atomic_be_t waiter; - } - vars; + } vars; atomic_be_t all_info; }; @@ -72,9 +71,7 @@ struct lv2_lwmutex final : lv2_obj atomic_t lv2_control{}; lv2_lwmutex(u32 protocol, vm::ptr control, u64 name) noexcept - : protocol{static_cast(protocol)} - , control(control) - , name(std::bit_cast>(name)) + : protocol{static_cast(protocol)}, control(control), name(std::bit_cast>(name)) { } @@ -90,23 +87,24 @@ struct lv2_lwmutex final : lv2_obj s32 try_own(T* cpu, bool wait_only = false) { const s32 signal = lv2_control.fetch_op([&](control_data_t& data) - { - if (!data.signaled) - { - cpu->prio.atomic_op([tag = ++g_priority_order_tag](std::common_type_t& prio) - { - prio.order = tag; - }); + { + if (!data.signaled) + { + cpu->prio.atomic_op([tag = ++g_priority_order_tag](std::common_type_t& prio) + { + prio.order = tag; + }); - cpu->next_cpu = data.sq; - data.sq = cpu; - } - else - { - ensure(!wait_only); - data.signaled = 0; - } - }).signaled; + cpu->next_cpu = data.sq; + data.sq = cpu; + } + else + { + ensure(!wait_only); + data.signaled = 0; + } + }) + .signaled; if (signal) { @@ -115,18 +113,19 @@ struct lv2_lwmutex final : lv2_obj else { const bool notify = lwcond_waiters.fetch_op([](s32& val) - { - if (val + 0u <= 1u << 31) - { - // Value was either positive or INT32_MIN - return false; - } + { + if (val + 0u <= 1u << 31) + { + // Value was either positive or INT32_MIN + return false; + } - // lwmutex was set to be destroyed, but there are lwcond waiters - // Turn off the "lwcond_waiters notification" bit as we are adding an lwmutex waiter - val &= 0x7fff'ffff; - return true; - }).second; + // lwmutex was set to be destroyed, but there are lwcond waiters + // Turn off the "lwcond_waiters notification" bit as we are adding an lwmutex waiter + val &= 0x7fff'ffff; + return true; + }) + .second; if (notify) { @@ -162,26 +161,26 @@ struct lv2_lwmutex final : lv2_obj T* res = nullptr; lv2_control.fetch_op([&](control_data_t& data) - { - res = nullptr; - - if (auto sq = static_cast(data.sq)) { - res = schedule(data.sq, protocol, false); + res = nullptr; - if (sq == data.sq) + if (auto sq = static_cast(data.sq)) { - return false; - } + res = schedule(data.sq, protocol, false); - return true; - } - else - { - data.signaled |= (unlock2 ? s32{smin} : 1); - return true; - } - }); + if (sq == data.sq) + { + return false; + } + + return true; + } + else + { + data.signaled |= (unlock2 ? s32{smin} : 1); + return true; + } + }); if (res && cpu_flag::again - res->state) { diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_memory.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_memory.cpp index 9f726e994..dbb513f9e 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_memory.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_memory.cpp @@ -15,15 +15,12 @@ LOG_CHANNEL(sys_memory); static shared_mutex s_memstats_mtx; lv2_memory_container::lv2_memory_container(u32 size, bool from_idm) noexcept - : size(size) - , id{from_idm ? idm::last_id() : SYS_MEMORY_CONTAINER_ID_INVALID} + : size(size), id{from_idm ? idm::last_id() : SYS_MEMORY_CONTAINER_ID_INVALID} { } lv2_memory_container::lv2_memory_container(utils::serial& ar, bool from_idm) noexcept - : size(ar) - , id{from_idm ? idm::last_id() : SYS_MEMORY_CONTAINER_ID_INVALID} - , used(ar) + : size(ar), id{from_idm ? idm::last_id() : SYS_MEMORY_CONTAINER_ID_INVALID}, used(ar) { } @@ -89,8 +86,7 @@ struct sys_memory_address_table std::shared_ptr reserve_map(u32 alloc_size, u32 align) { - return vm::reserve_map(align == 0x10000 ? vm::user64k : vm::user1m, 0, align == 0x10000 ? 0x20000000 : utils::align(alloc_size, 0x10000000) - , align == 0x10000 ? (vm::page_size_64k | vm::bf0_0x1) : (vm::page_size_1m | vm::bf0_0x1)); + return vm::reserve_map(align == 0x10000 ? vm::user64k : vm::user1m, 0, align == 0x10000 ? 0x20000000 : utils::align(alloc_size, 0x10000000), align == 0x10000 ? (vm::page_size_64k | vm::bf0_0x1) : (vm::page_size_1m | vm::bf0_0x1)); } // Todo: fix order of error checks @@ -108,9 +104,10 @@ error_code sys_memory_allocate(cpu_thread& cpu, u64 size, u64 flags, vm::ptr(cid, [&](lv2_memory_container& ct) -> CellError - { - // Try to get "physical memory" - if (!ct.take(size)) { - return CELL_ENOMEM; - } + // Try to get "physical memory" + if (!ct.take(size)) + { + return CELL_ENOMEM; + } - return {}; - }); + return {}; + }); if (!ct) { @@ -265,8 +263,8 @@ error_code sys_memory_get_page_attribute(cpu_thread& cpu, u32 addr, vm::ptrattribute = 0x40000ull; // SYS_MEMORY_PROT_READ_WRITE (TODO) - attr->access_right = addr >> 28 == 0xdu ? SYS_MEMORY_ACCESS_RIGHT_PPU_THR : SYS_MEMORY_ACCESS_RIGHT_ANY;// (TODO) + attr->attribute = 0x40000ull; // SYS_MEMORY_PROT_READ_WRITE (TODO) + attr->access_right = addr >> 28 == 0xdu ? SYS_MEMORY_ACCESS_RIGHT_PPU_THR : SYS_MEMORY_ACCESS_RIGHT_ANY; // (TODO) if (vm::check_addr(addr, vm::page_1m_size)) { @@ -303,9 +301,9 @@ error_code sys_memory_get_user_memory_size(cpu_thread& cpu, vm::ptr([&](u32, lv2_memory_container& ct) - { - out.total_user_memory -= ct.size; - }); + { + out.total_user_memory -= ct.size; + }); } cpu.check_state(); @@ -367,15 +365,15 @@ error_code sys_memory_container_destroy(cpu_thread& cpu, u32 cid) std::lock_guard lock(s_memstats_mtx); const auto ct = idm::withdraw(cid, [](lv2_memory_container& ct) -> CellError - { - // Check if some memory is not deallocated (the container cannot be destroyed in this case) - if (!ct.used.compare_and_swap_test(0, ct.size)) { - return CELL_EBUSY; - } + // Check if some memory is not deallocated (the container cannot be destroyed in this case) + if (!ct.used.compare_and_swap_test(0, ct.size)) + { + return CELL_EBUSY; + } - return {}; - }); + return {}; + }); if (!ct) { @@ -407,7 +405,7 @@ error_code sys_memory_container_get_size(cpu_thread& cpu, vm::ptrtotal_user_memory = ct->size; // Total container memory + mem_info->total_user_memory = ct->size; // Total container memory mem_info->available_user_memory = ct->size - ct->used; // Available container memory return CELL_OK; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_memory.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_memory.h index c2ca046bc..94235fc2b 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_memory.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_memory.h @@ -12,37 +12,37 @@ enum lv2_mem_container_id : u32 enum : u64 { - SYS_MEMORY_ACCESS_RIGHT_NONE = 0x00000000000000F0ULL, - SYS_MEMORY_ACCESS_RIGHT_ANY = 0x000000000000000FULL, + SYS_MEMORY_ACCESS_RIGHT_NONE = 0x00000000000000F0ULL, + SYS_MEMORY_ACCESS_RIGHT_ANY = 0x000000000000000FULL, SYS_MEMORY_ACCESS_RIGHT_PPU_THR = 0x0000000000000008ULL, SYS_MEMORY_ACCESS_RIGHT_HANDLER = 0x0000000000000004ULL, SYS_MEMORY_ACCESS_RIGHT_SPU_THR = 0x0000000000000002ULL, SYS_MEMORY_ACCESS_RIGHT_RAW_SPU = 0x0000000000000001ULL, - SYS_MEMORY_ATTR_READ_ONLY = 0x0000000000080000ULL, - SYS_MEMORY_ATTR_READ_WRITE = 0x0000000000040000ULL, + SYS_MEMORY_ATTR_READ_ONLY = 0x0000000000080000ULL, + SYS_MEMORY_ATTR_READ_WRITE = 0x0000000000040000ULL, }; enum : u64 { - SYS_MEMORY_PAGE_SIZE_4K = 0x100ull, - SYS_MEMORY_PAGE_SIZE_64K = 0x200ull, - SYS_MEMORY_PAGE_SIZE_1M = 0x400ull, + SYS_MEMORY_PAGE_SIZE_4K = 0x100ull, + SYS_MEMORY_PAGE_SIZE_64K = 0x200ull, + SYS_MEMORY_PAGE_SIZE_1M = 0x400ull, SYS_MEMORY_PAGE_SIZE_MASK = 0xf00ull, }; enum : u64 { - SYS_MEMORY_GRANULARITY_64K = 0x0000000000000200, - SYS_MEMORY_GRANULARITY_1M = 0x0000000000000400, + SYS_MEMORY_GRANULARITY_64K = 0x0000000000000200, + SYS_MEMORY_GRANULARITY_1M = 0x0000000000000400, SYS_MEMORY_GRANULARITY_MASK = 0x0000000000000f00, }; enum : u64 { SYS_MEMORY_PROT_READ_WRITE = 0x0000000000040000, - SYS_MEMORY_PROT_READ_ONLY = 0x0000000000080000, - SYS_MEMORY_PROT_MASK = 0x00000000000f0000, + SYS_MEMORY_PROT_READ_ONLY = 0x0000000000080000, + SYS_MEMORY_PROT_MASK = 0x00000000000f0000, }; struct sys_memory_info_t @@ -51,7 +51,6 @@ struct sys_memory_info_t be_t available_user_memory; }; - struct sys_page_attr_t { be_t attribute; @@ -66,9 +65,9 @@ struct lv2_memory_container static const u32 id_step = 0x1; static const u32 id_count = 16; - const u32 size; // Amount of "physical" memory in this container + const u32 size; // Amount of "physical" memory in this container const lv2_mem_container_id id; // ID of the container in if placed at IDM, otherwise SYS_MEMORY_CONTAINER_ID_INVALID - atomic_t used{}; // Amount of "physical" memory currently used + atomic_t used{}; // Amount of "physical" memory currently used SAVESTATE_INIT_POS(1); @@ -83,15 +82,15 @@ struct lv2_memory_container u32 take(u64 amount) { auto [_, result] = used.fetch_op([&](u32& value) -> u32 - { - if (size - value >= amount) { - value += static_cast(amount); - return static_cast(amount); - } + if (size - value >= amount) + { + value += static_cast(amount); + return static_cast(amount); + } - return 0; - }); + return 0; + }); return result; } @@ -99,15 +98,15 @@ struct lv2_memory_container u32 free(u64 amount) { auto [_, result] = used.fetch_op([&](u32& value) -> u32 - { - if (value >= amount) { - value -= static_cast(amount); - return static_cast(amount); - } + if (value >= amount) + { + value -= static_cast(amount); + return static_cast(amount); + } - return 0; - }); + return 0; + }); // Sanity check ensure(result == amount); diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp index 805d5db0a..c7069a332 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp @@ -18,25 +18,19 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto value) - { - switch (value) { - case SYS_MEMORY_CONTAINER_ID_INVALID: return "Global"; - } + switch (value) + { + case SYS_MEMORY_CONTAINER_ID_INVALID: return "Global"; + } - // Resort to hex formatting for other values - return unknown; - }); + // Resort to hex formatting for other values + return unknown; + }); } lv2_memory::lv2_memory(u32 size, u32 align, u64 flags, u64 key, bool pshared, lv2_memory_container* ct) - : size(size) - , align(align) - , flags(flags) - , key(key) - , pshared(pshared) - , ct(ct) - , shm(std::make_shared(size, 1 /* shareable flag */)) + : size(size), align(align), flags(flags), key(key), pshared(pshared), ct(ct), shm(std::make_shared(size, 1 /* shareable flag */)) { #ifndef _WIN32 // Optimization that's useless on Windows :puke: @@ -45,24 +39,18 @@ lv2_memory::lv2_memory(u32 size, u32 align, u64 flags, u64 key, bool pshared, lv } lv2_memory::lv2_memory(utils::serial& ar) - : size(ar) - , align(ar) - , flags(ar) - , key(ar) - , pshared(ar) - , ct(lv2_memory_container::search(ar.pop())) - , shm([&](u32 addr) - { - if (addr) - { - return ensure(vm::get(vm::any, addr)->peek(addr).second); - } + : size(ar), align(ar), flags(ar), key(ar), pshared(ar), ct(lv2_memory_container::search(ar.pop())), shm([&](u32 addr) + { + if (addr) + { + return ensure(vm::get(vm::any, addr)->peek(addr).second); + } - const auto _shm = std::make_shared(size, 1); - ar(std::span(_shm->map_self(), size)); - return _shm; - }(ar.pop())) - , counter(ar) + const auto _shm = std::make_shared(size, 1); + ar(std::span(_shm->map_self(), size)); + return _shm; + }(ar.pop())), + counter(ar) { #ifndef _WIN32 // Optimization that's useless on Windows :puke: @@ -127,15 +115,16 @@ error_code create_lv2_shm(bool pshared, u64 ipc_key, u64 size, u32 align, u64 fl } if (auto error = lv2_obj::create(_pshared, ipc_key, exclusive ? SYS_SYNC_NEWLY_CREATED : SYS_SYNC_NOT_CARE, [&]() - { - return make_shared( - static_cast(size), - align, - flags, - ipc_key, - pshared, - ct); - }, false)) + { + return make_shared( + static_cast(size), + align, + flags, + ipc_key, + pshared, + ct); + }, + false)) { return error; } @@ -588,22 +577,22 @@ error_code sys_mmapper_free_shared_memory(ppu_thread& ppu, u32 mem_id) // Conditionally remove memory ID const auto mem = idm::withdraw(mem_id, [&](lv2_memory& mem) -> CellError - { - if (mem.counter) { - return CELL_EBUSY; - } + if (mem.counter) + { + return CELL_EBUSY; + } - lv2_obj::on_id_destroy(mem, mem.key, +mem.pshared); + lv2_obj::on_id_destroy(mem, mem.key, +mem.pshared); - if (!mem.exists) - { - // Return "physical memory" to the memory container - mem.ct->free(mem.size); - } + if (!mem.exists) + { + // Return "physical memory" to the memory container + mem.ct->free(mem.size); + } - return {}; - }); + return {}; + }); if (!mem) { @@ -632,22 +621,22 @@ error_code sys_mmapper_map_shared_memory(ppu_thread& ppu, u32 addr, u32 mem_id, } const auto mem = idm::get(mem_id, [&](lv2_memory& mem) -> CellError - { - const u32 page_alignment = area->flags & SYS_MEMORY_PAGE_SIZE_64K ? 0x10000 : 0x100000; - - if (mem.align < page_alignment) { - return CELL_EINVAL; - } + const u32 page_alignment = area->flags & SYS_MEMORY_PAGE_SIZE_64K ? 0x10000 : 0x100000; - if (addr % page_alignment) - { - return CELL_EALIGN; - } + if (mem.align < page_alignment) + { + return CELL_EINVAL; + } - mem.counter++; - return {}; - }); + if (addr % page_alignment) + { + return CELL_EALIGN; + } + + mem.counter++; + return {}; + }); if (!mem) { @@ -689,17 +678,17 @@ error_code sys_mmapper_search_and_map(ppu_thread& ppu, u32 start_addr, u32 mem_i } const auto mem = idm::get(mem_id, [&](lv2_memory& mem) -> CellError - { - const u32 page_alignment = area->flags & SYS_MEMORY_PAGE_SIZE_64K ? 0x10000 : 0x100000; - - if (mem.align < page_alignment) { - return CELL_EALIGN; - } + const u32 page_alignment = area->flags & SYS_MEMORY_PAGE_SIZE_64K ? 0x10000 : 0x100000; - mem.counter++; - return {}; - }); + if (mem.align < page_alignment) + { + return CELL_EALIGN; + } + + mem.counter++; + return {}; + }); if (!mem) { @@ -754,14 +743,14 @@ error_code sys_mmapper_unmap_shared_memory(ppu_thread& ppu, u32 addr, vm::ptr([&](u32 id, lv2_memory& mem) -> u32 - { - if (mem.shm.get() == shm.second.get()) { - return id; - } + if (mem.shm.get() == shm.second.get()) + { + return id; + } - return 0; - }); + return 0; + }); if (!mem) { @@ -829,7 +818,7 @@ error_code sys_mmapper_enable_page_fault_notification(ppu_thread& ppu, u32 start } } - page_fault_notification_entry entry{ start_addr, event_queue_id, port_id->value() }; + page_fault_notification_entry entry{start_addr, event_queue_id, port_id->value()}; pf_entries.entries.emplace_back(entry); return CELL_OK; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_mmapper.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_mmapper.h index 544ff91ee..a24f7f3c1 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_mmapper.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_mmapper.h @@ -18,11 +18,11 @@ struct lv2_memory : lv2_obj { static const u32 id_base = 0x08000000; - const u32 size; // Memory size + const u32 size; // Memory size const u32 align; // Alignment required const u64 flags; - const u64 key; // IPC key - const bool pshared; // Process shared flag + const u64 key; // IPC key + const bool pshared; // Process shared flag lv2_memory_container* const ct; // Associated memory container const std::shared_ptr shm; @@ -39,7 +39,7 @@ struct lv2_memory : lv2_obj enum : u64 { - SYS_MEMORY_PAGE_FAULT_EVENT_KEY = 0xfffe000000000000ULL, + SYS_MEMORY_PAGE_FAULT_EVENT_KEY = 0xfffe000000000000ULL, }; enum : u64 @@ -50,19 +50,19 @@ enum : u64 enum : u64 { SYS_MEMORY_PAGE_FAULT_CAUSE_NON_MAPPED = 0x2ULL, - SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY = 0x1ULL, - SYS_MEMORY_PAGE_FAULT_TYPE_PPU_THREAD = 0x0ULL, - SYS_MEMORY_PAGE_FAULT_TYPE_SPU_THREAD = 0x1ULL, - SYS_MEMORY_PAGE_FAULT_TYPE_RAW_SPU = 0x2ULL, + SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY = 0x1ULL, + SYS_MEMORY_PAGE_FAULT_TYPE_PPU_THREAD = 0x0ULL, + SYS_MEMORY_PAGE_FAULT_TYPE_SPU_THREAD = 0x1ULL, + SYS_MEMORY_PAGE_FAULT_TYPE_RAW_SPU = 0x2ULL, }; struct page_fault_notification_entry { ENABLE_BITWISE_SERIALIZATION; - u32 start_addr; // Starting address of region to monitor. + u32 start_addr; // Starting address of region to monitor. u32 event_queue_id; // Queue to be notified. - u32 port_id; // Port used to notify the queue. + u32 port_id; // Port used to notify the queue. }; // Used to hold list of queues to be notified on page fault event. diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_mutex.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_mutex.cpp index 92bf877a8..8103d9595 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_mutex.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_mutex.cpp @@ -12,11 +12,7 @@ LOG_CHANNEL(sys_mutex); lv2_mutex::lv2_mutex(utils::serial& ar) - : protocol(ar) - , recursive(ar) - , adaptive(ar) - , key(ar) - , name(ar) + : protocol(ar), recursive(ar), adaptive(ar), key(ar), name(ar) { ar(lock_count, control.raw().owner); @@ -85,14 +81,14 @@ error_code sys_mutex_create(ppu_thread& ppu, vm::ptr mutex_id, vm::ptr(_attr.pshared, _attr.ipc_key, _attr.flags, [&]() - { - return make_shared( - _attr.protocol, - _attr.recursive, - _attr.adaptive, - ipc_key, - _attr.name_u64); - })) + { + return make_shared( + _attr.protocol, + _attr.recursive, + _attr.adaptive, + ipc_key, + _attr.name_u64); + })) { return error; } @@ -109,22 +105,22 @@ error_code sys_mutex_destroy(ppu_thread& ppu, u32 mutex_id) sys_mutex.trace("sys_mutex_destroy(mutex_id=0x%x)", mutex_id); const auto mutex = idm::withdraw(mutex_id, [](lv2_mutex& mutex) -> CellError - { - std::lock_guard lock(mutex.mutex); - - if (atomic_storage::load(mutex.control.raw().owner)) { - return CELL_EBUSY; - } + std::lock_guard lock(mutex.mutex); - if (mutex.cond_count) - { - return CELL_EPERM; - } + if (atomic_storage::load(mutex.control.raw().owner)) + { + return CELL_EBUSY; + } - lv2_obj::on_id_destroy(mutex, mutex.key); - return {}; - }); + if (mutex.cond_count) + { + return CELL_EPERM; + } + + lv2_obj::on_id_destroy(mutex, mutex.key); + return {}; + }); if (!mutex) { @@ -151,45 +147,45 @@ error_code sys_mutex_lock(ppu_thread& ppu, u32 mutex_id, u64 timeout) sys_mutex.trace("sys_mutex_lock(mutex_id=0x%x, timeout=0x%llx)", mutex_id, timeout); const auto mutex = idm::get(mutex_id, [&, notify = lv2_obj::notify_all_t()](lv2_mutex& mutex) - { - CellError result = mutex.try_lock(ppu); - - if (result == CELL_EBUSY && !atomic_storage::load(mutex.control.raw().sq)) { - // Try busy waiting a bit if advantageous - for (u32 i = 0, end = lv2_obj::has_ppus_in_running_state() ? 3 : 10; id_manager::g_mutex.is_lockable() && i < end; i++) - { - busy_wait(300); - result = mutex.try_lock(ppu); + CellError result = mutex.try_lock(ppu); - if (!result || atomic_storage::load(mutex.control.raw().sq)) + if (result == CELL_EBUSY && !atomic_storage::load(mutex.control.raw().sq)) + { + // Try busy waiting a bit if advantageous + for (u32 i = 0, end = lv2_obj::has_ppus_in_running_state() ? 3 : 10; id_manager::g_mutex.is_lockable() && i < end; i++) { - break; + busy_wait(300); + result = mutex.try_lock(ppu); + + if (!result || atomic_storage::load(mutex.control.raw().sq)) + { + break; + } } } - } - if (result == CELL_EBUSY) - { - lv2_obj::prepare_for_sleep(ppu); - - ppu.cancel_sleep = 1; - - if (mutex.try_own(ppu) || !mutex.sleep(ppu, timeout)) + if (result == CELL_EBUSY) { - result = {}; + lv2_obj::prepare_for_sleep(ppu); + + ppu.cancel_sleep = 1; + + if (mutex.try_own(ppu) || !mutex.sleep(ppu, timeout)) + { + result = {}; + } + + if (ppu.cancel_sleep != 1) + { + notify.cleanup(); + } + + ppu.cancel_sleep = 0; } - if (ppu.cancel_sleep != 1) - { - notify.cleanup(); - } - - ppu.cancel_sleep = 0; - } - - return result; - }); + return result; + }); if (!mutex) { @@ -239,7 +235,7 @@ error_code sys_mutex_lock(ppu_thread& ppu, u32 mutex_id, u64 timeout) } if (ppu.state & cpu_flag::signal) - { + { continue; } @@ -267,28 +263,28 @@ error_code sys_mutex_lock(ppu_thread& ppu, u32 mutex_id, u64 timeout) bool success = false; mutex->control.fetch_op([&](lv2_mutex::control_data_t& data) - { - success = false; - - ppu_thread* sq = static_cast(data.sq); - - const bool retval = &ppu == sq; - - if (!mutex->unqueue(sq, &ppu)) { - return false; - } + success = false; - success = true; + ppu_thread* sq = static_cast(data.sq); - if (!retval) - { - return false; - } + const bool retval = &ppu == sq; - data.sq = sq; - return true; - }); + if (!mutex->unqueue(sq, &ppu)) + { + return false; + } + + success = true; + + if (!retval) + { + return false; + } + + data.sq = sq; + return true; + }); if (success) { @@ -315,9 +311,9 @@ error_code sys_mutex_trylock(ppu_thread& ppu, u32 mutex_id) sys_mutex.trace("sys_mutex_trylock(mutex_id=0x%x)", mutex_id); const auto mutex = idm::check(mutex_id, [&](lv2_mutex& mutex) - { - return mutex.try_lock(ppu); - }); + { + return mutex.try_lock(ppu); + }); if (!mutex) { @@ -344,30 +340,30 @@ error_code sys_mutex_unlock(ppu_thread& ppu, u32 mutex_id) sys_mutex.trace("sys_mutex_unlock(mutex_id=0x%x)", mutex_id); const auto mutex = idm::check(mutex_id, [&, notify = lv2_obj::notify_all_t()](lv2_mutex& mutex) -> CellError - { - auto result = mutex.try_unlock(ppu); - - if (result == CELL_EBUSY) { - std::lock_guard lock(mutex.mutex); + auto result = mutex.try_unlock(ppu); - if (auto cpu = mutex.reown()) + if (result == CELL_EBUSY) { - if (cpu->state & cpu_flag::again) + std::lock_guard lock(mutex.mutex); + + if (auto cpu = mutex.reown()) { - ppu.state += cpu_flag::again; - return {}; + if (cpu->state & cpu_flag::again) + { + ppu.state += cpu_flag::again; + return {}; + } + + mutex.awake(cpu); } - mutex.awake(cpu); + result = {}; } - result = {}; - } - - notify.cleanup(); - return result; - }); + notify.cleanup(); + return result; + }); if (!mutex) { diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_mutex.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_mutex.h index f82f91339..1dee5ec8b 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_mutex.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_mutex.h @@ -8,7 +8,7 @@ struct sys_mutex_attribute_t { - be_t protocol; // SYS_SYNC_FIFO, SYS_SYNC_PRIORITY or SYS_SYNC_PRIORITY_INHERIT + be_t protocol; // SYS_SYNC_FIFO, SYS_SYNC_PRIORITY or SYS_SYNC_PRIORITY_INHERIT be_t recursive; // SYS_SYNC_RECURSIVE or SYS_SYNC_NOT_RECURSIVE be_t pshared; be_t adaptive; @@ -48,12 +48,8 @@ struct lv2_mutex final : lv2_obj atomic_t control{}; - lv2_mutex(u32 protocol, u32 recursive,u32 adaptive, u64 key, u64 name) noexcept - : protocol{static_cast(protocol)} - , recursive(recursive) - , adaptive(adaptive) - , key(key) - , name(name) + lv2_mutex(u32 protocol, u32 recursive, u32 adaptive, u64 key, u64 name) noexcept + : protocol{static_cast(protocol)}, recursive(recursive), adaptive(adaptive), key(key), name(name) { } @@ -102,24 +98,24 @@ struct lv2_mutex final : lv2_obj bool try_own(T& cpu) { if (control.atomic_op([&](control_data_t& data) - { - if (data.owner) - { - cpu.prio.atomic_op([tag = ++g_priority_order_tag](std::common_type_t& prio) { - prio.order = tag; - }); + if (data.owner) + { + cpu.prio.atomic_op([tag = ++g_priority_order_tag](std::common_type_t& prio) + { + prio.order = tag; + }); - cpu.next_cpu = data.sq; - data.sq = &cpu; - return false; - } - else - { - data.owner = cpu.id; - return true; - } - })) + cpu.next_cpu = data.sq; + data.sq = &cpu; + return false; + } + else + { + data.owner = cpu.id; + return true; + } + })) { cpu.next_cpu = nullptr; return true; @@ -164,28 +160,28 @@ struct lv2_mutex final : lv2_obj T* res{}; control.fetch_op([&](control_data_t& data) - { - res = nullptr; - - if (auto sq = static_cast(data.sq)) { - res = schedule(data.sq, protocol, false); + res = nullptr; - if (sq == data.sq) + if (auto sq = static_cast(data.sq)) { - atomic_storage::release(control.raw().owner, res->id); - return false; - } + res = schedule(data.sq, protocol, false); - data.owner = res->id; - return true; - } - else - { - data.owner = 0; - return true; - } - }); + if (sq == data.sq) + { + atomic_storage::release(control.raw().owner, res->id); + return false; + } + + data.owner = res->id; + return true; + } + else + { + data.owner = 0; + return true; + } + }); if (res && cpu_flag::again - res->state) { @@ -197,7 +193,6 @@ struct lv2_mutex final : lv2_obj } }; - // Syscalls error_code sys_mutex_create(ppu_thread& ppu, vm::ptr mutex_id, vm::ptr attr); diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net.cpp index 827a4c98f..1b5be6482 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net.cpp @@ -237,15 +237,10 @@ void fmt_class_string::format(std::string& out, u64 arg) } lv2_socket::lv2_socket(utils::serial& ar, lv2_socket_type _type) - : family(ar) - , type(_type) - , protocol(ar) - , so_nbio(ar) - , so_error(ar) - , so_tcp_maxseg(ar) + : family(ar), type(_type), protocol(ar), so_nbio(ar), so_error(ar), so_tcp_maxseg(ar) #ifdef _WIN32 - , so_reuseaddr(ar) - , so_reuseport(ar) + , + so_reuseaddr(ar), so_reuseport(ar) { #else { @@ -289,7 +284,11 @@ std::function lv2_socket::load(utils::serial& ar) sock_lv2->bind(sock_lv2->last_bound_addr); } - return [ptr = sock_lv2](void* storage) { *static_cast*>(storage) = ptr; };; + return [ptr = sock_lv2](void* storage) + { + *static_cast*>(storage) = ptr; + }; + ; } void lv2_socket::save(utils::serial& ar, bool save_only_this_class) @@ -356,7 +355,7 @@ error_code sys_net_bnet_accept(ppu_thread& ppu, s32 s, vm::ptr if (success) { - result = res; + result = res; sn_addr = res_addr; new_socket = std::move(res_socket); return true; @@ -371,7 +370,7 @@ error_code sys_net_bnet_accept(ppu_thread& ppu, s32 s, vm::ptr auto [success, res, res_socket, res_addr] = sock.accept(false); if (success) { - result = res; + result = res; sn_addr = res_addr; new_socket = std::move(res_socket); lv2_obj::awake(&ppu); @@ -443,7 +442,7 @@ error_code sys_net_bnet_accept(ppu_thread& ppu, s32 s, vm::ptr if (addr) { *paddrlen = sizeof(sys_net_sockaddr_in); - *addr = sn_addr; + *addr = sn_addr; } // Socket ID @@ -515,7 +514,7 @@ error_code sys_net_bnet_connect(ppu_thread& ppu, s32 s, vm::ptr(s, [&, notify = lv2_obj::notify_all_t()](lv2_socket& sock) @@ -618,7 +617,7 @@ error_code sys_net_bnet_getpeername(ppu_thread& ppu, s32 s, vm::ptr buf, u32 if (addr) { *paddrlen = sizeof(sys_net_sockaddr_in); - *addr = sn_addr; + *addr = sn_addr; } return not_an_error(result); @@ -977,7 +976,6 @@ error_code sys_net_bnet_sendmsg(ppu_thread& ppu, s32 s, vm::cptr return not_an_error(result); } - return sys_net_error{result}; } @@ -1285,7 +1283,7 @@ error_code sys_net_bnet_poll(ppu_thread& ppu, vm::ptr fds, s32 n for (s32 i = 0; i < nfds; i++) { - _fds[i].fd = -1; + _fds[i].fd = -1; fds_buf[i].revents = 0; if (fds_buf[i].fd < 0) @@ -1785,9 +1783,9 @@ error_code sys_net_abort(ppu_thread& ppu, s32 type, u64 arg, s32 flags) std::vector sockets; idm::select([&](u32 id, lv2_socket&) - { - sockets.emplace_back(id); - }); + { + sockets.emplace_back(id); + }); s32 failed = 0; @@ -1849,7 +1847,7 @@ error_code sys_net_infoctl(ppu_thread& ppu, s32 cmd, vm::ptr arg) char buffer[nameserver.size() + 80]{}; std::memcpy(buffer, nameserver.data(), nameserver.size()); - auto& nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); const auto dns_str = np::ip_to_string(nph.get_dns_ip()); std::memcpy(buffer + nameserver.size() - 1, dns_str.data(), dns_str.size()); diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net.h index b1f9ef726..d9577a0ac 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net.h @@ -14,44 +14,44 @@ // Error codes enum sys_net_error : s32 { - SYS_NET_ENOENT = 2, - SYS_NET_EINTR = 4, - SYS_NET_EBADF = 9, - SYS_NET_ENOMEM = 12, - SYS_NET_EACCES = 13, - SYS_NET_EFAULT = 14, - SYS_NET_EBUSY = 16, - SYS_NET_EINVAL = 22, - SYS_NET_EMFILE = 24, - SYS_NET_ENOSPC = 28, - SYS_NET_EPIPE = 32, - SYS_NET_EAGAIN = 35, - SYS_NET_EWOULDBLOCK = SYS_NET_EAGAIN, - SYS_NET_EINPROGRESS = 36, - SYS_NET_EALREADY = 37, - SYS_NET_EDESTADDRREQ = 39, - SYS_NET_EMSGSIZE = 40, - SYS_NET_EPROTOTYPE = 41, - SYS_NET_ENOPROTOOPT = 42, + SYS_NET_ENOENT = 2, + SYS_NET_EINTR = 4, + SYS_NET_EBADF = 9, + SYS_NET_ENOMEM = 12, + SYS_NET_EACCES = 13, + SYS_NET_EFAULT = 14, + SYS_NET_EBUSY = 16, + SYS_NET_EINVAL = 22, + SYS_NET_EMFILE = 24, + SYS_NET_ENOSPC = 28, + SYS_NET_EPIPE = 32, + SYS_NET_EAGAIN = 35, + SYS_NET_EWOULDBLOCK = SYS_NET_EAGAIN, + SYS_NET_EINPROGRESS = 36, + SYS_NET_EALREADY = 37, + SYS_NET_EDESTADDRREQ = 39, + SYS_NET_EMSGSIZE = 40, + SYS_NET_EPROTOTYPE = 41, + SYS_NET_ENOPROTOOPT = 42, SYS_NET_EPROTONOSUPPORT = 43, - SYS_NET_EOPNOTSUPP = 45, - SYS_NET_EPFNOSUPPORT = 46, - SYS_NET_EAFNOSUPPORT = 47, - SYS_NET_EADDRINUSE = 48, - SYS_NET_EADDRNOTAVAIL = 49, - SYS_NET_ENETDOWN = 50, - SYS_NET_ENETUNREACH = 51, - SYS_NET_ECONNABORTED = 53, - SYS_NET_ECONNRESET = 54, - SYS_NET_ENOBUFS = 55, - SYS_NET_EISCONN = 56, - SYS_NET_ENOTCONN = 57, - SYS_NET_ESHUTDOWN = 58, - SYS_NET_ETOOMANYREFS = 59, - SYS_NET_ETIMEDOUT = 60, - SYS_NET_ECONNREFUSED = 61, - SYS_NET_EHOSTDOWN = 64, - SYS_NET_EHOSTUNREACH = 65, + SYS_NET_EOPNOTSUPP = 45, + SYS_NET_EPFNOSUPPORT = 46, + SYS_NET_EAFNOSUPPORT = 47, + SYS_NET_EADDRINUSE = 48, + SYS_NET_EADDRNOTAVAIL = 49, + SYS_NET_ENETDOWN = 50, + SYS_NET_ENETUNREACH = 51, + SYS_NET_ECONNABORTED = 53, + SYS_NET_ECONNRESET = 54, + SYS_NET_ENOBUFS = 55, + SYS_NET_EISCONN = 56, + SYS_NET_ENOTCONN = 57, + SYS_NET_ESHUTDOWN = 58, + SYS_NET_ETOOMANYREFS = 59, + SYS_NET_ETIMEDOUT = 60, + SYS_NET_ECONNREFUSED = 61, + SYS_NET_EHOSTDOWN = 64, + SYS_NET_EHOSTUNREACH = 65, }; static constexpr sys_net_error operator-(sys_net_error v) @@ -62,123 +62,123 @@ static constexpr sys_net_error operator-(sys_net_error v) // Socket types (prefixed with SYS_NET_) enum lv2_socket_type : s32 { - SYS_NET_SOCK_STREAM = 1, - SYS_NET_SOCK_DGRAM = 2, - SYS_NET_SOCK_RAW = 3, - SYS_NET_SOCK_DGRAM_P2P = 6, + SYS_NET_SOCK_STREAM = 1, + SYS_NET_SOCK_DGRAM = 2, + SYS_NET_SOCK_RAW = 3, + SYS_NET_SOCK_DGRAM_P2P = 6, SYS_NET_SOCK_STREAM_P2P = 10, }; // Socket options (prefixed with SYS_NET_) enum lv2_socket_option : s32 { - SYS_NET_SO_SNDBUF = 0x1001, - SYS_NET_SO_RCVBUF = 0x1002, - SYS_NET_SO_SNDLOWAT = 0x1003, - SYS_NET_SO_RCVLOWAT = 0x1004, - SYS_NET_SO_SNDTIMEO = 0x1005, - SYS_NET_SO_RCVTIMEO = 0x1006, - SYS_NET_SO_ERROR = 0x1007, - SYS_NET_SO_TYPE = 0x1008, - SYS_NET_SO_NBIO = 0x1100, // Non-blocking IO - SYS_NET_SO_TPPOLICY = 0x1101, + SYS_NET_SO_SNDBUF = 0x1001, + SYS_NET_SO_RCVBUF = 0x1002, + SYS_NET_SO_SNDLOWAT = 0x1003, + SYS_NET_SO_RCVLOWAT = 0x1004, + SYS_NET_SO_SNDTIMEO = 0x1005, + SYS_NET_SO_RCVTIMEO = 0x1006, + SYS_NET_SO_ERROR = 0x1007, + SYS_NET_SO_TYPE = 0x1008, + SYS_NET_SO_NBIO = 0x1100, // Non-blocking IO + SYS_NET_SO_TPPOLICY = 0x1101, - SYS_NET_SO_REUSEADDR = 0x0004, - SYS_NET_SO_KEEPALIVE = 0x0008, - SYS_NET_SO_BROADCAST = 0x0020, - SYS_NET_SO_LINGER = 0x0080, - SYS_NET_SO_OOBINLINE = 0x0100, - SYS_NET_SO_REUSEPORT = 0x0200, - SYS_NET_SO_ONESBCAST = 0x0800, - SYS_NET_SO_USECRYPTO = 0x1000, + SYS_NET_SO_REUSEADDR = 0x0004, + SYS_NET_SO_KEEPALIVE = 0x0008, + SYS_NET_SO_BROADCAST = 0x0020, + SYS_NET_SO_LINGER = 0x0080, + SYS_NET_SO_OOBINLINE = 0x0100, + SYS_NET_SO_REUSEPORT = 0x0200, + SYS_NET_SO_ONESBCAST = 0x0800, + SYS_NET_SO_USECRYPTO = 0x1000, SYS_NET_SO_USESIGNATURE = 0x2000, - SYS_NET_SOL_SOCKET = 0xffff, + SYS_NET_SOL_SOCKET = 0xffff, }; // IP options (prefixed with SYS_NET_) enum lv2_ip_option : s32 { - SYS_NET_IP_HDRINCL = 2, - SYS_NET_IP_TOS = 3, - SYS_NET_IP_TTL = 4, - SYS_NET_IP_MULTICAST_IF = 9, - SYS_NET_IP_MULTICAST_TTL = 10, - SYS_NET_IP_MULTICAST_LOOP = 11, - SYS_NET_IP_ADD_MEMBERSHIP = 12, + SYS_NET_IP_HDRINCL = 2, + SYS_NET_IP_TOS = 3, + SYS_NET_IP_TTL = 4, + SYS_NET_IP_MULTICAST_IF = 9, + SYS_NET_IP_MULTICAST_TTL = 10, + SYS_NET_IP_MULTICAST_LOOP = 11, + SYS_NET_IP_ADD_MEMBERSHIP = 12, SYS_NET_IP_DROP_MEMBERSHIP = 13, - SYS_NET_IP_TTLCHK = 23, - SYS_NET_IP_MAXTTL = 24, - SYS_NET_IP_DONTFRAG = 26 + SYS_NET_IP_TTLCHK = 23, + SYS_NET_IP_MAXTTL = 24, + SYS_NET_IP_DONTFRAG = 26 }; // Family (prefixed with SYS_NET_) enum lv2_socket_family : s32 { - SYS_NET_AF_UNSPEC = 0, - SYS_NET_AF_LOCAL = 1, - SYS_NET_AF_UNIX = SYS_NET_AF_LOCAL, - SYS_NET_AF_INET = 2, - SYS_NET_AF_INET6 = 24, + SYS_NET_AF_UNSPEC = 0, + SYS_NET_AF_LOCAL = 1, + SYS_NET_AF_UNIX = SYS_NET_AF_LOCAL, + SYS_NET_AF_INET = 2, + SYS_NET_AF_INET6 = 24, }; // Flags (prefixed with SYS_NET_) enum { - SYS_NET_MSG_OOB = 0x1, - SYS_NET_MSG_PEEK = 0x2, - SYS_NET_MSG_DONTROUTE = 0x4, - SYS_NET_MSG_EOR = 0x8, - SYS_NET_MSG_TRUNC = 0x10, - SYS_NET_MSG_CTRUNC = 0x20, - SYS_NET_MSG_WAITALL = 0x40, - SYS_NET_MSG_DONTWAIT = 0x80, - SYS_NET_MSG_BCAST = 0x100, - SYS_NET_MSG_MCAST = 0x200, - SYS_NET_MSG_USECRYPTO = 0x400, - SYS_NET_MSG_USESIGNATURE= 0x800, + SYS_NET_MSG_OOB = 0x1, + SYS_NET_MSG_PEEK = 0x2, + SYS_NET_MSG_DONTROUTE = 0x4, + SYS_NET_MSG_EOR = 0x8, + SYS_NET_MSG_TRUNC = 0x10, + SYS_NET_MSG_CTRUNC = 0x20, + SYS_NET_MSG_WAITALL = 0x40, + SYS_NET_MSG_DONTWAIT = 0x80, + SYS_NET_MSG_BCAST = 0x100, + SYS_NET_MSG_MCAST = 0x200, + SYS_NET_MSG_USECRYPTO = 0x400, + SYS_NET_MSG_USESIGNATURE = 0x800, }; // Shutdown types (prefixed with SYS_NET_) enum { - SYS_NET_SHUT_RD = 0, - SYS_NET_SHUT_WR = 1, - SYS_NET_SHUT_RDWR = 2, + SYS_NET_SHUT_RD = 0, + SYS_NET_SHUT_WR = 1, + SYS_NET_SHUT_RDWR = 2, }; // TCP options (prefixed with SYS_NET_) enum lv2_tcp_option : s32 { - SYS_NET_TCP_NODELAY = 1, - SYS_NET_TCP_MAXSEG = 2, + SYS_NET_TCP_NODELAY = 1, + SYS_NET_TCP_MAXSEG = 2, SYS_NET_TCP_MSS_TO_ADVERTISE = 3, }; // IP protocols (prefixed with SYS_NET_) enum lv2_ip_protocol : s32 { - SYS_NET_IPPROTO_IP = 0, - SYS_NET_IPPROTO_ICMP = 1, - SYS_NET_IPPROTO_IGMP = 2, - SYS_NET_IPPROTO_TCP = 6, - SYS_NET_IPPROTO_UDP = 17, + SYS_NET_IPPROTO_IP = 0, + SYS_NET_IPPROTO_ICMP = 1, + SYS_NET_IPPROTO_IGMP = 2, + SYS_NET_IPPROTO_TCP = 6, + SYS_NET_IPPROTO_UDP = 17, SYS_NET_IPPROTO_ICMPV6 = 58, }; // Poll events (prefixed with SYS_NET_) enum { - SYS_NET_POLLIN = 0x0001, - SYS_NET_POLLPRI = 0x0002, - SYS_NET_POLLOUT = 0x0004, - SYS_NET_POLLERR = 0x0008, /* revent only */ - SYS_NET_POLLHUP = 0x0010, /* revent only */ - SYS_NET_POLLNVAL = 0x0020, /* revent only */ - SYS_NET_POLLRDNORM = 0x0040, - SYS_NET_POLLWRNORM = SYS_NET_POLLOUT, - SYS_NET_POLLRDBAND = 0x0080, - SYS_NET_POLLWRBAND = 0x0100, + SYS_NET_POLLIN = 0x0001, + SYS_NET_POLLPRI = 0x0002, + SYS_NET_POLLOUT = 0x0004, + SYS_NET_POLLERR = 0x0008, /* revent only */ + SYS_NET_POLLHUP = 0x0010, /* revent only */ + SYS_NET_POLLNVAL = 0x0020, /* revent only */ + SYS_NET_POLLRDNORM = 0x0040, + SYS_NET_POLLWRNORM = SYS_NET_POLLOUT, + SYS_NET_POLLRDBAND = 0x0080, + SYS_NET_POLLWRBAND = 0x0100, }; enum lv2_socket_abort_flags : s32 @@ -187,16 +187,16 @@ enum lv2_socket_abort_flags : s32 }; // in_addr_t type prefixed with sys_net_ -using sys_net_in_addr_t = u32; +using sys_net_in_addr_t = u32; // in_port_t type prefixed with sys_net_ -using sys_net_in_port_t = u16; +using sys_net_in_port_t = u16; // sa_family_t type prefixed with sys_net_ -using sys_net_sa_family_t = u8; +using sys_net_sa_family_t = u8; // socklen_t type prefixed with sys_net_ -using sys_net_socklen_t = u32; +using sys_net_socklen_t = u32; // fd_set prefixed with sys_net_ struct sys_net_fd_set diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket.cpp index 0d2a59821..cc3fd027b 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket.cpp @@ -6,8 +6,8 @@ LOG_CHANNEL(sys_net); lv2_socket::lv2_socket(lv2_socket_family family, lv2_socket_type type, lv2_ip_protocol protocol) { - this->family = family; - this->type = type; + this->family = family; + this->type = type; this->protocol = protocol; } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket.h index 314840f24..48f14182c 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket.h @@ -87,32 +87,32 @@ public: virtual s32 bind(const sys_net_sockaddr& addr) = 0; virtual std::optional connect(const sys_net_sockaddr& addr) = 0; - virtual s32 connect_followup() = 0; + virtual s32 connect_followup() = 0; virtual std::pair getpeername() = 0; virtual std::pair getsockname() = 0; virtual std::tuple getsockopt(s32 level, s32 optname, u32 len) = 0; - virtual s32 setsockopt(s32 level, s32 optname, const std::vector& optval) = 0; + virtual s32 setsockopt(s32 level, s32 optname, const std::vector& optval) = 0; virtual s32 listen(s32 backlog) = 0; - virtual std::optional, sys_net_sockaddr>> recvfrom(s32 flags, u32 len, bool is_lock = true) = 0; + virtual std::optional, sys_net_sockaddr>> recvfrom(s32 flags, u32 len, bool is_lock = true) = 0; virtual std::optional sendto(s32 flags, const std::vector& buf, std::optional opt_sn_addr, bool is_lock = true) = 0; - virtual std::optional sendmsg(s32 flags, const sys_net_msghdr& msg, bool is_lock = true) = 0; + virtual std::optional sendmsg(s32 flags, const sys_net_msghdr& msg, bool is_lock = true) = 0; - virtual void close() = 0; + virtual void close() = 0; virtual s32 shutdown(s32 how) = 0; - virtual s32 poll(sys_net_pollfd& sn_pfd, pollfd& native_pfd) = 0; + virtual s32 poll(sys_net_pollfd& sn_pfd, pollfd& native_pfd) = 0; virtual std::tuple select(bs_t selected, pollfd& native_pfd) = 0; error_code abort_socket(s32 flags); public: // IDM data - static const u32 id_base = 24; - static const u32 id_step = 1; + static const u32 id_base = 24; + static const u32 id_step = 1; static const u32 id_count = 1000; protected: diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_native.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_native.cpp index d420f23cc..032ffeb0d 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_native.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_native.cpp @@ -74,7 +74,7 @@ s32 lv2_socket_native::create_socket() int native_proto = protocol == SYS_NET_IPPROTO_TCP ? IPPROTO_TCP : protocol == SYS_NET_IPPROTO_UDP ? IPPROTO_UDP : - IPPROTO_IP; + IPPROTO_IP; auto socket_res = ::socket(native_domain, native_type, native_proto); @@ -90,8 +90,8 @@ s32 lv2_socket_native::create_socket() void lv2_socket_native::set_socket(socket_type native_socket, lv2_socket_family family, lv2_socket_type type, lv2_ip_protocol protocol) { this->native_socket = native_socket; - this->family = family; - this->type = type; + this->family = family; + this->type = type; this->protocol = protocol; set_default_buffers(); @@ -158,8 +158,8 @@ s32 lv2_socket_native::bind(const sys_net_sockaddr& addr) } ::sockaddr_in native_addr{}; - native_addr.sin_family = AF_INET; - native_addr.sin_port = std::bit_cast(psa_in->sin_port); + native_addr.sin_family = AF_INET; + native_addr.sin_port = std::bit_cast(psa_in->sin_port); native_addr.sin_addr.s_addr = saddr; ::socklen_t native_addr_len = sizeof(native_addr); @@ -216,7 +216,7 @@ std::optional lv2_socket_native::connect(const sys_net_sockaddr& addr) const auto* psa_in = reinterpret_cast(&addr); - ::sockaddr_in native_addr = sys_net_addr_to_native_addr(addr); + ::sockaddr_in native_addr = sys_net_addr_to_native_addr(addr); ::socklen_t native_addr_len = sizeof(native_addr); sys_net.notice("[Native] Attempting to connect on %s:%d", native_addr.sin_addr, std::bit_cast, u16>(native_addr.sin_port)); @@ -369,7 +369,7 @@ std::tuple lv2_socket_native::getsockopt(s32 u32 out_len = sizeof(out_val); int native_level = -1; - int native_opt = -1; + int native_opt = -1; union { @@ -390,14 +390,14 @@ std::tuple lv2_socket_native::getsockopt(s32 { // Special out_val._int = so_nbio; - out_len = sizeof(s32); + out_len = sizeof(s32); return {CELL_OK, out_val, out_len}; } case SYS_NET_SO_ERROR: { // Special out_val._int = std::exchange(so_error, 0); - out_len = sizeof(s32); + out_len = sizeof(s32); return {CELL_OK, out_val, out_len}; } case SYS_NET_SO_KEEPALIVE: @@ -434,13 +434,13 @@ std::tuple lv2_socket_native::getsockopt(s32 case SYS_NET_SO_REUSEADDR: { out_val._int = so_reuseaddr; - out_len = sizeof(s32); + out_len = sizeof(s32); return {CELL_OK, out_val, out_len}; } case SYS_NET_SO_REUSEPORT: { out_val._int = so_reuseport; - out_len = sizeof(s32); + out_len = sizeof(s32); return {CELL_OK, out_val, out_len}; } #else @@ -489,7 +489,7 @@ std::tuple lv2_socket_native::getsockopt(s32 { // Special (no effect) out_val._int = so_tcp_maxseg; - out_len = sizeof(s32); + out_len = sizeof(s32); return {CELL_OK, out_val, out_len}; } case SYS_NET_TCP_NODELAY: @@ -595,14 +595,14 @@ std::tuple lv2_socket_native::getsockopt(s32 { // TODO out_val.timeo = {::narrow(native_val.timeo.tv_sec), ::narrow(native_val.timeo.tv_usec)}; - out_len = sizeof(sys_net_timeval); + out_len = sizeof(sys_net_timeval); return {CELL_OK, out_val, out_len}; } case SYS_NET_SO_LINGER: { // TODO out_val.linger = {::narrow(native_val.linger.l_onoff), ::narrow(native_val.linger.l_linger)}; - out_len = sizeof(sys_net_linger); + out_len = sizeof(sys_net_linger); return {CELL_OK, out_val, out_len}; } default: break; @@ -611,7 +611,7 @@ std::tuple lv2_socket_native::getsockopt(s32 // Fallback to int out_val._int = native_val._int; - out_len = sizeof(s32); + out_len = sizeof(s32); return {CELL_OK, out_val, out_len}; } @@ -619,9 +619,9 @@ s32 lv2_socket_native::setsockopt(s32 level, s32 optname, const std::vector& { std::lock_guard lock(mutex); - int native_int = 0; - int native_level = -1; - int native_opt = -1; + int native_int = 0; + int native_level = -1; + int native_opt = -1; const void* native_val = &native_int; ::socklen_t native_len = sizeof(int); ::linger native_linger; @@ -680,16 +680,16 @@ s32 lv2_socket_native::setsockopt(s32 level, s32 optname, const std::vector& #ifdef _WIN32 case SYS_NET_SO_REUSEADDR: { - native_opt = SO_REUSEADDR; + native_opt = SO_REUSEADDR; so_reuseaddr = native_int; - native_int = so_reuseaddr || so_reuseport ? 1 : 0; + native_int = so_reuseaddr || so_reuseport ? 1 : 0; break; } case SYS_NET_SO_REUSEPORT: { - native_opt = SO_REUSEADDR; + native_opt = SO_REUSEADDR; so_reuseport = native_int; - native_int = so_reuseaddr || so_reuseport ? 1 : 0; + native_int = so_reuseaddr || so_reuseport ? 1 : 0; break; } #else @@ -733,10 +733,10 @@ s32 lv2_socket_native::setsockopt(s32 level, s32 optname, const std::vector& return -SYS_NET_EINVAL; // TODO - native_opt = SO_LINGER; - native_val = &native_linger; - native_len = sizeof(native_linger); - native_linger.l_onoff = reinterpret_cast(optval.data())->l_onoff; + native_opt = SO_LINGER; + native_val = &native_linger; + native_len = sizeof(native_linger); + native_linger.l_onoff = reinterpret_cast(optval.data())->l_onoff; native_linger.l_linger = reinterpret_cast(optval.data())->l_linger; break; } @@ -825,9 +825,9 @@ s32 lv2_socket_native::setsockopt(s32 level, s32 optname, const std::vector& if (optval.size() < sizeof(sys_net_ip_mreq)) return -SYS_NET_EINVAL; - native_opt = optname == SYS_NET_IP_ADD_MEMBERSHIP ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP; - native_val = &native_mreq; - native_len = sizeof(::ip_mreq); + native_opt = optname == SYS_NET_IP_ADD_MEMBERSHIP ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP; + native_val = &native_mreq; + native_len = sizeof(::ip_mreq); native_mreq.imr_interface.s_addr = std::bit_cast(reinterpret_cast(optval.data())->imr_interface); native_mreq.imr_multiaddr.s_addr = std::bit_cast(reinterpret_cast(optval.data())->imr_multiaddr); break; @@ -897,7 +897,7 @@ std::optional, sys_net_sockaddr>> lv2_socket_nat { // As if just lost the connection feign_tcp_conn_failure = false; - return {{-SYS_NET_ECONNRESET, {},{}}}; + return {{-SYS_NET_ECONNRESET, {}, {}}}; } int native_flags = 0; @@ -908,14 +908,14 @@ std::optional, sys_net_sockaddr>> lv2_socket_nat auto& dnshook = g_fxo->get(); if (dnshook.is_dns(lv2_id) && dnshook.is_dns_queue(lv2_id)) { - auto& nph = g_fxo->get>(); + auto& nph = g_fxo->get>(); const auto packet = dnshook.get_dns_packet(lv2_id); ensure(packet.size() < len); memcpy(res_buf.data(), packet.data(), packet.size()); - native_addr.ss_family = AF_INET; - (reinterpret_cast<::sockaddr_in*>(&native_addr))->sin_port = std::bit_cast>(53); // htons(53) + native_addr.ss_family = AF_INET; + (reinterpret_cast<::sockaddr_in*>(&native_addr))->sin_port = std::bit_cast>(53); // htons(53) (reinterpret_cast<::sockaddr_in*>(&native_addr))->sin_addr.s_addr = nph.get_dns_ip(); - const auto sn_addr = native_addr_to_sys_net_addr(native_addr); + const auto sn_addr = native_addr_to_sys_net_addr(native_addr); return {{::narrow(packet.size()), res_buf, sn_addr}}; } @@ -975,8 +975,8 @@ std::optional lv2_socket_native::sendto(s32 flags, const std::vector& b lock.lock(); } - int native_flags = 0; - int native_result = -1; + int native_flags = 0; + int native_result = -1; std::optional native_addr = std::nullopt; if (opt_sn_addr) @@ -1052,8 +1052,8 @@ std::optional lv2_socket_native::sendmsg(s32 flags, const sys_net_msghdr& m lock.lock(); } - int native_flags = 0; - int native_result = -1; + int native_flags = 0; + int native_result = -1; sys_net_error result{}; @@ -1127,12 +1127,12 @@ s32 lv2_socket_native::shutdown(s32 how) const int native_how = how == SYS_NET_SHUT_RD ? SD_RECEIVE : how == SYS_NET_SHUT_WR ? SD_SEND : - SD_BOTH; + SD_BOTH; #else const int native_how = how == SYS_NET_SHUT_RD ? SHUT_RD : how == SYS_NET_SHUT_WR ? SHUT_WR : - SHUT_RDWR; + SHUT_RDWR; #endif if (::shutdown(native_socket, native_how) == 0) diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2p.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2p.cpp index 608088aac..50b45c65c 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2p.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2p.cpp @@ -105,8 +105,8 @@ s32 lv2_socket_p2p::listen([[maybe_unused]] s32 backlog) s32 lv2_socket_p2p::bind(const sys_net_sockaddr& addr) { const auto* psa_in_p2p = reinterpret_cast(&addr); - u16 p2p_port = psa_in_p2p->sin_port; - u16 p2p_vport = psa_in_p2p->sin_vport; + u16 p2p_port = psa_in_p2p->sin_port; + u16 p2p_vport = psa_in_p2p->sin_vport; sys_net.notice("[P2P] Trying to bind %s:%d:%d", np::ip_to_string(std::bit_cast(psa_in_p2p->sin_addr)), p2p_port, p2p_vport); @@ -141,7 +141,7 @@ s32 lv2_socket_p2p::bind(const sys_net_sockaddr& addr) p2p_vport++; } } - + if (pport.bound_p2p_vports.contains(p2p_vport)) { // Check that all other sockets are SO_REUSEADDR or SO_REUSEPORT @@ -163,8 +163,8 @@ s32 lv2_socket_p2p::bind(const sys_net_sockaddr& addr) { std::lock_guard lock(mutex); - port = p2p_port; - vport = p2p_vport; + port = p2p_port; + vport = p2p_vport; native_socket = real_socket; bound_addr = psa_in_p2p->sin_addr; } @@ -185,11 +185,11 @@ std::pair lv2_socket_p2p::getsockname() sys_net_sockaddr sn_addr{}; sys_net_sockaddr_in_p2p* paddr = reinterpret_cast(&sn_addr); - paddr->sin_len = sizeof(sys_net_sockaddr_in); + paddr->sin_len = sizeof(sys_net_sockaddr_in); paddr->sin_family = SYS_NET_AF_INET; - paddr->sin_port = port; - paddr->sin_vport = vport; - paddr->sin_addr = bound_addr; + paddr->sin_port = port; + paddr->sin_vport = vport; + paddr->sin_addr = bound_addr; return {CELL_OK, sn_addr}; } @@ -253,7 +253,7 @@ std::optional, sys_net_sockaddr>> lv2_socket_p2p std::vector res_buf(len); const auto& p2p_data = data.front(); - s32 native_result = std::min(len, static_cast(p2p_data.second.size())); + s32 native_result = std::min(len, static_cast(p2p_data.second.size())); memcpy(res_buf.data(), p2p_data.second.data(), native_result); sys_net_sockaddr sn_addr; @@ -274,9 +274,9 @@ std::optional lv2_socket_p2p::sendto(s32 flags, const std::vector& buf, } ensure(opt_sn_addr); - ensure(socket); // ensures it has been bound + ensure(socket); // ensures it has been bound ensure(buf.size() <= static_cast(65535 - VPORT_P2P_HEADER_SIZE)); // catch games using full payload for future fragmentation implementation if necessary - const u16 p2p_port = reinterpret_cast(&*opt_sn_addr)->sin_port; + const u16 p2p_port = reinterpret_cast(&*opt_sn_addr)->sin_port; const u16 p2p_vport = reinterpret_cast(&*opt_sn_addr)->sin_vport; auto native_addr = sys_net_addr_to_native_addr(*opt_sn_addr); @@ -389,7 +389,7 @@ std::tuple lv2_socket_p2p::select(bs_t sel { std::lock_guard lock(mutex); - bool read_set = false; + bool read_set = false; bool write_set = false; // Check if it's a bound P2P socket diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2ps.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2ps.cpp index c0790a2e3..31676477c 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2ps.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2ps.cpp @@ -22,10 +22,10 @@ public: const auto now = steady_clock::now(); message msg; - msg.dst_addr = *dst; - msg.sock_id = sock_id; - msg.data = std::move(data); - msg.seq = seq; + msg.dst_addr = *dst; + msg.sock_id = sock_id; + msg.data = std::move(data); + msg.seq = seq; msg.initial_sendtime = now; rtt_info rtt = rtts[sock_id]; @@ -54,7 +54,7 @@ public: if (now < it->first) { const auto actual_rtt = std::chrono::duration_cast(now - it->second.initial_sendtime); - const auto cur_rtt = rtts[sock_id].rtt_time; + const auto cur_rtt = rtts[sock_id].rtt_time; if (cur_rtt > actual_rtt) { rtts[sock_id].rtt_time = (actual_rtt + cur_rtt) / 2; @@ -111,9 +111,9 @@ public: break; // reply is late, increases rtt - auto& msg = it->second; + auto& msg = it->second; const auto addr = msg.dst_addr.sin_addr.s_addr; - rtt_info rtt = rtts[msg.sock_id]; + rtt_info rtt = rtts[msg.sock_id]; // Only increases rtt once per loop(in case a big number of packets are sent at once) if (!rtt_increased.count(msg.sock_id)) { @@ -218,7 +218,7 @@ private: // List of rtts struct rtt_info { - unsigned long num_retries = 0; + unsigned long num_retries = 0; std::chrono::milliseconds rtt_time = 50ms; }; std::unordered_map rtts; // (sock_id, rtt) @@ -245,9 +245,9 @@ std::vector generate_u2s_packet(const p2ps_encapsulated_tcp& header, const u const u32 packet_size = (VPORT_P2P_HEADER_SIZE + sizeof(p2ps_encapsulated_tcp) + datasize); ensure(packet_size < 65535); // packet size shouldn't be bigger than possible UDP payload std::vector packet(packet_size); - u8* packet_data = packet.data(); - le_t dst_port_le = +header.dst_port; - le_t src_port_le = +header.src_port; + u8* packet_data = packet.data(); + le_t dst_port_le = +header.dst_port; + le_t src_port_le = +header.src_port; le_t p2p_flags_le = P2P_FLAG_P2PS; memcpy(packet_data, &dst_port_le, sizeof(u16)); @@ -257,7 +257,7 @@ std::vector generate_u2s_packet(const p2ps_encapsulated_tcp& header, const u if (datasize) memcpy(packet_data + VPORT_P2P_HEADER_SIZE + sizeof(p2ps_encapsulated_tcp), data, datasize); - auto* hdr_ptr = reinterpret_cast(packet_data + VPORT_P2P_HEADER_SIZE); + auto* hdr_ptr = reinterpret_cast(packet_data + VPORT_P2P_HEADER_SIZE); hdr_ptr->checksum = 0; hdr_ptr->checksum = u2s_tcp_checksum(utils::bless>(hdr_ptr), sizeof(p2ps_encapsulated_tcp) + datasize); @@ -278,15 +278,15 @@ lv2_socket_p2ps::lv2_socket_p2ps(socket_type native_socket, u16 port, u16 vport, : lv2_socket_p2p(SYS_NET_AF_INET, SYS_NET_SOCK_STREAM_P2P, SYS_NET_IPPROTO_IP) { this->native_socket = native_socket; - this->port = port; - this->vport = vport; - this->op_addr = op_addr; - this->op_port = op_port; - this->op_vport = op_vport; - this->cur_seq = cur_seq; + this->port = port; + this->vport = vport; + this->op_addr = op_addr; + this->op_port = op_port; + this->op_vport = op_vport; + this->cur_seq = cur_seq; this->data_beg_seq = data_beg_seq; - this->so_nbio = so_nbio; - status = p2ps_stream_status::stream_connected; + this->so_nbio = so_nbio; + status = p2ps_stream_status::stream_connected; } lv2_socket_p2ps::lv2_socket_p2ps(utils::serial& ar, lv2_socket_type type) @@ -329,9 +329,9 @@ bool lv2_socket_p2ps::handle_connected(p2ps_encapsulated_tcp* tcp_header, u8* da p2ps_encapsulated_tcp send_hdr; send_hdr.src_port = tcp_header->dst_port; send_hdr.dst_port = tcp_header->src_port; - send_hdr.flags = p2ps_tcp_flags::ACK; - send_hdr.ack = final_ack; - auto packet = generate_u2s_packet(send_hdr, nullptr, 0); + send_hdr.flags = p2ps_tcp_flags::ACK; + send_hdr.ack = final_ack; + auto packet = generate_u2s_packet(send_hdr, nullptr, 0); sys_net.trace("[P2PS] Sent ack %d", final_ack); send_u2s_packet(std::move(packet), reinterpret_cast<::sockaddr_in*>(op_addr), 0, false); @@ -363,7 +363,7 @@ bool lv2_socket_p2ps::handle_connected(p2ps_encapsulated_tcp* tcp_header, u8* da { sys_net.trace("[P2PS] Received SYN|ACK, status is now connected"); data_beg_seq = tcp_header->seq + 1; - status = p2ps_stream_status::stream_connected; + status = p2ps_stream_status::stream_connected; send_ack(); } else @@ -443,8 +443,8 @@ bool lv2_socket_p2ps::handle_listening(p2ps_encapsulated_tcp* tcp_header, [[mayb p2ps_encapsulated_tcp send_hdr; send_hdr.src_port = tcp_header->dst_port; send_hdr.dst_port = tcp_header->src_port; - send_hdr.flags = p2ps_tcp_flags::RST; - auto packet = generate_u2s_packet(send_hdr, nullptr, 0); + send_hdr.flags = p2ps_tcp_flags::RST; + auto packet = generate_u2s_packet(send_hdr, nullptr, 0); send_u2s_packet(std::move(packet), reinterpret_cast<::sockaddr_in*>(op_addr), 0, false); return true; } @@ -455,19 +455,19 @@ bool lv2_socket_p2ps::handle_listening(p2ps_encapsulated_tcp* tcp_header, [[mayb p2ps_encapsulated_tcp send_hdr; send_hdr.src_port = tcp_header->dst_port; send_hdr.dst_port = tcp_header->src_port; - send_hdr.flags = p2ps_tcp_flags::SYN | p2ps_tcp_flags::ACK; - send_hdr.ack = tcp_header->seq + 1; + send_hdr.flags = p2ps_tcp_flags::SYN | p2ps_tcp_flags::ACK; + send_hdr.ack = tcp_header->seq + 1; // Generates random starting SEQ send_hdr.seq = rand(); // Create new socket - const u32 new_op_addr = reinterpret_cast(op_addr)->sin_addr.s_addr; - const u16 new_op_port = std::bit_cast>((reinterpret_cast(op_addr)->sin_port)); - const u16 new_op_vport = tcp_header->src_port; - const u64 new_cur_seq = send_hdr.seq + 1; + const u32 new_op_addr = reinterpret_cast(op_addr)->sin_addr.s_addr; + const u16 new_op_port = std::bit_cast>((reinterpret_cast(op_addr)->sin_port)); + const u16 new_op_vport = tcp_header->src_port; + const u64 new_cur_seq = send_hdr.seq + 1; const u64 new_data_beg_seq = send_hdr.ack; auto sock_lv2 = make_shared(native_socket, port, vport, new_op_addr, new_op_port, new_op_vport, new_cur_seq, new_data_beg_seq, so_nbio); - const s32 new_sock_id = idm::import_existing(sock_lv2); + const s32 new_sock_id = idm::import_existing(sock_lv2); sock_lv2->set_lv2_id(new_sock_id); const u64 key_connected = (reinterpret_cast(op_addr)->sin_addr.s_addr) | (static_cast(tcp_header->src_port) << 48) | (static_cast(tcp_header->dst_port) << 32); @@ -629,10 +629,10 @@ std::tuple, sys_net_sockaddr> lv2_socket_p2ps: { std::lock_guard lock(sock_client->mutex); paddr->sin_family = SYS_NET_AF_INET; - paddr->sin_addr = std::bit_cast, u32>(sock_client->op_addr); - paddr->sin_port = sock_client->op_vport; - paddr->sin_vport = sock_client->op_port; - paddr->sin_len = sizeof(sys_net_sockaddr_in_p2p); + paddr->sin_addr = std::bit_cast, u32>(sock_client->op_addr); + paddr->sin_port = sock_client->op_vport; + paddr->sin_vport = sock_client->op_port; + paddr->sin_len = sizeof(sys_net_sockaddr_in_p2p); } return {true, p2ps_client, {}, ps3_addr}; @@ -643,7 +643,7 @@ s32 lv2_socket_p2ps::bind(const sys_net_sockaddr& addr) const auto* psa_in_p2p = reinterpret_cast(&addr); // For SYS_NET_SOCK_STREAM_P2P sockets, the port is the "fake" tcp port and the vport is the udp port it's bound to - u16 p2p_port = psa_in_p2p->sin_vport; + u16 p2p_port = psa_in_p2p->sin_vport; u16 p2p_vport = psa_in_p2p->sin_port; sys_net.notice("[P2PS] Trying to bind %s:%d:%d", np::ip_to_string(std::bit_cast(psa_in_p2p->sin_addr)), p2p_port, p2p_vport); @@ -705,8 +705,8 @@ s32 lv2_socket_p2ps::bind(const sys_net_sockaddr& addr) } } - port = p2p_port; - vport = p2p_vport; + port = p2p_port; + vport = p2p_vport; native_socket = real_socket; bound_addr = psa_in_p2p->sin_addr; } @@ -728,11 +728,11 @@ std::pair lv2_socket_p2ps::getsockname() sys_net_sockaddr sn_addr{}; sys_net_sockaddr_in_p2p* paddr = reinterpret_cast(&sn_addr); - paddr->sin_len = sizeof(sys_net_sockaddr_in); + paddr->sin_len = sizeof(sys_net_sockaddr_in); paddr->sin_family = SYS_NET_AF_INET; - paddr->sin_port = vport; - paddr->sin_vport = port; - paddr->sin_addr = bound_addr; + paddr->sin_port = vport; + paddr->sin_vport = port; + paddr->sin_addr = bound_addr; return {CELL_OK, sn_addr}; } @@ -749,11 +749,11 @@ std::optional lv2_socket_p2ps::connect(const sys_net_sockaddr& addr) p2ps_encapsulated_tcp send_hdr; const auto psa_in_p2p = reinterpret_cast(&addr); - auto name = sys_net_addr_to_native_addr(addr); + auto name = sys_net_addr_to_native_addr(addr); // This is purposefully inverted, not a bug const u16 dst_vport = psa_in_p2p->sin_port; - const u16 dst_port = psa_in_p2p->sin_vport; + const u16 dst_port = psa_in_p2p->sin_vport; socket_type real_socket{}; @@ -787,20 +787,20 @@ std::optional lv2_socket_p2ps::connect(const sys_net_sockaddr& addr) send_hdr.src_port = vport; send_hdr.dst_port = dst_vport; - send_hdr.flags = p2ps_tcp_flags::SYN; - send_hdr.seq = rand(); + send_hdr.flags = p2ps_tcp_flags::SYN; + send_hdr.seq = rand(); - op_addr = name.sin_addr.s_addr; - op_port = dst_port; - op_vport = dst_vport; - cur_seq = send_hdr.seq + 1; - data_beg_seq = 0; + op_addr = name.sin_addr.s_addr; + op_port = dst_port; + op_vport = dst_vport; + cur_seq = send_hdr.seq + 1; + data_beg_seq = 0; data_available = 0u; received_data.clear(); status = p2ps_stream_status::stream_handshaking; std::vector packet = generate_u2s_packet(send_hdr, nullptr, 0); - name.sin_port = std::bit_cast>(dst_port); // not a bug + name.sin_port = std::bit_cast>(dst_port); // not a bug send_u2s_packet(std::move(packet), reinterpret_cast<::sockaddr_in*>(&name), send_hdr.seq, true); return CELL_OK; @@ -810,7 +810,7 @@ s32 lv2_socket_p2ps::listen(s32 backlog) { std::lock_guard lock(mutex); - status = p2ps_stream_status::stream_listening; + status = p2ps_stream_status::stream_listening; max_backlog = backlog; return CELL_OK; @@ -850,7 +850,7 @@ std::optional, sys_net_sockaddr>> lv2_socket_p2p u32 left_to_give = to_give; while (left_to_give) { - auto& cur_data = received_data.begin()->second; + auto& cur_data = received_data.begin()->second; auto to_give_for_this_packet = std::min(static_cast(cur_data.size()), left_to_give); memcpy(dest_buf.data() + (to_give - left_to_give), cur_data.data(), to_give_for_this_packet); if (cur_data.size() != to_give_for_this_packet) @@ -871,11 +871,11 @@ std::optional, sys_net_sockaddr>> lv2_socket_p2p data_beg_seq += to_give; sys_net_sockaddr_in_p2p* addr_p2p = reinterpret_cast(&addr); - addr_p2p->sin_family = AF_INET; - addr_p2p->sin_addr = std::bit_cast, u32>(op_addr); - addr_p2p->sin_port = op_vport; - addr_p2p->sin_vport = op_port; - addr_p2p->sin_len = sizeof(sys_net_sockaddr_in_p2p); + addr_p2p->sin_family = AF_INET; + addr_p2p->sin_addr = std::bit_cast, u32>(op_addr); + addr_p2p->sin_port = op_vport; + addr_p2p->sin_vport = op_port; + addr_p2p->sin_len = sizeof(sys_net_sockaddr_in_p2p); return {{to_give, dest_buf, addr}}; } @@ -904,8 +904,8 @@ std::optional lv2_socket_p2ps::sendto([[maybe_unused]] s32 flags, const std } // Prepare address - name.sin_family = AF_INET; - name.sin_port = std::bit_cast>(op_port); + name.sin_family = AF_INET; + name.sin_port = std::bit_cast>(op_port); name.sin_addr.s_addr = op_addr; // Prepares encapsulated tcp p2ps_encapsulated_tcp tcp_header; @@ -919,7 +919,7 @@ std::optional lv2_socket_p2ps::sendto([[maybe_unused]] s32 flags, const std u32 cur_data_len = std::min(cur_total_len, max_data_len); tcp_header.length = cur_data_len; - tcp_header.seq = cur_seq; + tcp_header.seq = cur_seq; auto packet = generate_u2s_packet(tcp_header, &buf[buf.size() - cur_total_len], cur_data_len); send_u2s_packet(std::move(packet), &name, tcp_header.seq, true); @@ -1017,7 +1017,7 @@ std::tuple lv2_socket_p2ps::select(bs_t se { std::lock_guard lock(mutex); - bool read_set = false; + bool read_set = false; bool write_set = false; if (status == p2ps_stream_status::stream_connected) diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2ps.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2ps.h index 815813893..f06630b39 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2ps.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2ps.h @@ -23,13 +23,13 @@ constexpr be_t P2PS_U2S_SIG = (static_cast('U') << 24 | static_cast signature = P2PS_U2S_SIG; // Signature to verify it's P2P Stream data - be_t length = 0; // Length of data - be_t seq = 0; // This should be u32 but changed to u64 for simplicity - be_t ack = 0; - be_t src_port = 0; // fake source tcp port - be_t dst_port = 0; // fake dest tcp port(should be == vport) - be_t checksum = 0; - u8 flags = 0; + be_t length = 0; // Length of data + be_t seq = 0; // This should be u32 but changed to u64 for simplicity + be_t ack = 0; + be_t src_port = 0; // fake source tcp port + be_t dst_port = 0; // fake dest tcp port(should be == vport) + be_t checksum = 0; + u8 flags = 0; }; enum p2ps_stream_status @@ -106,7 +106,7 @@ private: u16 op_port = 0, op_vport = 0; u32 op_addr = 0; - u64 data_beg_seq = 0; // Seq of first byte of received_data + u64 data_beg_seq = 0; // Seq of first byte of received_data u64 data_available = 0; // Amount of continuous data available(calculated on ACK send) std::map> received_data; // holds seq/data of data received diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/nt_p2p_port.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/nt_p2p_port.cpp index 5f48d273d..3ded718af 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/nt_p2p_port.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/nt_p2p_port.cpp @@ -145,7 +145,7 @@ bool nt_p2p_port::recv_data() { ::sockaddr_storage native_addr{}; ::socklen_t native_addrlen = sizeof(native_addr); - const auto recv_res = ::recvfrom(p2p_socket, reinterpret_cast(p2p_recv_data.data()), ::size32(p2p_recv_data), 0, reinterpret_cast(&native_addr), &native_addrlen); + const auto recv_res = ::recvfrom(p2p_socket, reinterpret_cast(p2p_recv_data.data()), ::size32(p2p_recv_data), 0, reinterpret_cast(&native_addr), &native_addrlen); if (recv_res == -1) { @@ -180,7 +180,7 @@ bool nt_p2p_port::recv_data() return true; } - const u8 subset = p2p_recv_data[2]; + const u8 subset = p2p_recv_data[2]; const auto data_size = recv_res - VPORT_0_HEADER_SIZE; std::vector vport_0_data(p2p_recv_data.data() + VPORT_0_HEADER_SIZE, p2p_recv_data.data() + VPORT_0_HEADER_SIZE + data_size); @@ -197,7 +197,7 @@ bool nt_p2p_port::recv_data() signaling_message msg; msg.src_addr = reinterpret_cast(&native_addr)->sin_addr.s_addr; msg.src_port = std::bit_cast>(reinterpret_cast(&native_addr)->sin_port); - msg.data = std::move(vport_0_data); + msg.data = std::move(vport_0_data); { std::lock_guard lock(s_sign_mutex); @@ -233,11 +233,11 @@ bool nt_p2p_port::recv_data() { sys_net_sockaddr_in_p2p p2p_addr{}; - p2p_addr.sin_len = sizeof(sys_net_sockaddr_in); + p2p_addr.sin_len = sizeof(sys_net_sockaddr_in); p2p_addr.sin_family = SYS_NET_AF_INET; - p2p_addr.sin_addr = std::bit_cast, u32>(reinterpret_cast(&native_addr)->sin_addr.s_addr); - p2p_addr.sin_vport = src_vport; - p2p_addr.sin_port = std::bit_cast, u16>(reinterpret_cast(&native_addr)->sin_port); + p2p_addr.sin_addr = std::bit_cast, u32>(reinterpret_cast(&native_addr)->sin_addr.s_addr); + p2p_addr.sin_vport = src_vport; + p2p_addr.sin_port = std::bit_cast, u16>(reinterpret_cast(&native_addr)->sin_port); auto& bound_sockets = ::at32(bound_p2p_vports, dst_vport); @@ -296,7 +296,7 @@ bool nt_p2p_port::recv_data() } // Validate checksum - u16 given_checksum = tcp_header->checksum; + u16 given_checksum = tcp_header->checksum; tcp_header->checksum = 0; if (given_checksum != u2s_tcp_checksum(reinterpret_cast*>(p2p_data.data()), p2p_data.size())) { diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/nt_p2p_port.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/nt_p2p_port.h index 3ffc3df54..c367812ed 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/nt_p2p_port.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_net/nt_p2p_port.h @@ -25,7 +25,7 @@ constexpr s32 VPORT_P2P_HEADER_SIZE = sizeof(u16) + sizeof(u16) + sizeof(u16); enum VPORT_P2P_FLAGS { - P2P_FLAG_P2P = 1, + P2P_FLAG_P2P = 1, P2P_FLAG_P2PS = 1 << 1, }; @@ -46,7 +46,7 @@ struct nt_p2p_port { // Real socket where P2P packets are received/sent socket_type p2p_socket = 0; - u16 port = 0; + u16 port = 0; bool is_ipv6 = false; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_overlay.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_overlay.cpp index 33475a855..894892f9b 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_overlay.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_overlay.cpp @@ -71,7 +71,7 @@ static error_code overlay_load_module(vm::ptr ovlmid, const std::string& vp sys_overlay.success("Loaded overlay: \"%s\" (id=0x%x)", vpath, idm::last_id()); *ovlmid = idm::last_id(); - *entry = ovlm->entry; + *entry = ovlm->entry; return CELL_OK; } @@ -94,7 +94,7 @@ std::function lv2_overlay::load(utils::serial& ar) { u128 klic = g_fxo->get().last_key(); file = make_file_view(std::move(file), offset, umax); - ovlm = ppu_load_overlay(ppu_exec_object{ decrypt_self(std::move(file), reinterpret_cast(&klic)) }, false, path, 0, &ar).first; + ovlm = ppu_load_overlay(ppu_exec_object{decrypt_self(std::move(file), reinterpret_cast(&klic))}, false, path, 0, &ar).first; if (!ovlm) { diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_overlay.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_overlay.h index 1a204ba9e..780794c8f 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_overlay.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_overlay.h @@ -12,7 +12,7 @@ struct lv2_overlay final : ppu_module u32 seg0_code_end{}; lv2_overlay() = default; - lv2_overlay(utils::serial&){} + lv2_overlay(utils::serial&) {} static std::function load(utils::serial& ar); void save(utils::serial& ar); }; @@ -20,10 +20,10 @@ struct lv2_overlay final : ppu_module error_code sys_overlay_load_module(vm::ptr ovlmid, vm::cptr path, u64 flags, vm::ptr entry); error_code sys_overlay_load_module_by_fd(vm::ptr ovlmid, u32 fd, u64 offset, u64 flags, vm::ptr entry); error_code sys_overlay_unload_module(u32 ovlmid); -//error_code sys_overlay_get_module_list(sys_pid_t pid, usz ovlmids_num, sys_overlay_t * ovlmids, usz * num_of_modules); -//error_code sys_overlay_get_module_info(sys_pid_t pid, sys_overlay_t ovlmid, sys_overlay_module_info_t * info); -//error_code sys_overlay_get_module_info2(sys_pid_t pid, sys_overlay_t ovlmid, sys_overlay_module_info2_t * info);// -//error_code sys_overlay_get_sdk_version(); //2 params -//error_code sys_overlay_get_module_dbg_info(); //3 params? +// error_code sys_overlay_get_module_list(sys_pid_t pid, usz ovlmids_num, sys_overlay_t * ovlmids, usz * num_of_modules); +// error_code sys_overlay_get_module_info(sys_pid_t pid, sys_overlay_t ovlmid, sys_overlay_module_info_t * info); +// error_code sys_overlay_get_module_info2(sys_pid_t pid, sys_overlay_t ovlmid, sys_overlay_module_info2_t * info);// +// error_code sys_overlay_get_sdk_version(); //2 params +// error_code sys_overlay_get_module_dbg_info(); //3 params? -//error_code _sys_prx_load_module(vm::ps3::cptr path, u64 flags, vm::ps3::ptr pOpt); +// error_code _sys_prx_load_module(vm::ps3::cptr path, u64 flags, vm::ps3::ptr pOpt); diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp index 1aa9409f4..d10c64039 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp @@ -96,17 +96,17 @@ void _sys_ppu_thread_exit(ppu_thread& ppu, u64 errorcode) // Get joiner ID old_status = ppu.joiner.fetch_op([](ppu_join_status& status) - { - if (status == ppu_join_status::joinable) { - // Joinable, not joined - status = ppu_join_status::zombie; - return; - } + if (status == ppu_join_status::joinable) + { + // Joinable, not joined + status = ppu_join_status::zombie; + return; + } - // Set deleted thread status - status = ppu_join_status::exited; - }); + // Set deleted thread status + status = ppu_join_status::exited; + }); if (old_status >= ppu_join_status::max) { @@ -191,35 +191,35 @@ error_code sys_ppu_thread_join(ppu_thread& ppu, u32 thread_id, vm::ptr vptr } auto thread = idm::get>(thread_id, [&, notify = lv2_obj::notify_all_t()](ppu_thread& thread) -> CellError - { - CellError result = thread.joiner.atomic_op([&](ppu_join_status& value) -> CellError { - switch (value) + CellError result = thread.joiner.atomic_op([&](ppu_join_status& value) -> CellError + { + switch (value) + { + case ppu_join_status::joinable: + value = ppu_join_status{ppu.id}; + return {}; + case ppu_join_status::zombie: + value = ppu_join_status::exited; + return CELL_EAGAIN; + case ppu_join_status::exited: + return CELL_ESRCH; + case ppu_join_status::detached: + default: + return CELL_EINVAL; + } + }); + + if (!result) { - case ppu_join_status::joinable: - value = ppu_join_status{ppu.id}; - return {}; - case ppu_join_status::zombie: - value = ppu_join_status::exited; - return CELL_EAGAIN; - case ppu_join_status::exited: - return CELL_ESRCH; - case ppu_join_status::detached: - default: - return CELL_EINVAL; + lv2_obj::prepare_for_sleep(ppu); + lv2_obj::sleep(ppu); } + + notify.cleanup(); + return result; }); - if (!result) - { - lv2_obj::prepare_for_sleep(ppu); - lv2_obj::sleep(ppu); - } - - notify.cleanup(); - return result; - }); - if (!thread) { return CELL_ESRCH; @@ -275,29 +275,29 @@ error_code sys_ppu_thread_detach(ppu_thread& ppu, u32 thread_id) CellError result = CELL_ESRCH; auto [ptr, _] = idm::withdraw>(thread_id, [&](ppu_thread& thread) - { - result = thread.joiner.atomic_op([](ppu_join_status& value) -> CellError { - switch (value) - { - case ppu_join_status::joinable: - value = ppu_join_status::detached; - return {}; - case ppu_join_status::detached: - return CELL_EINVAL; - case ppu_join_status::zombie: - value = ppu_join_status::exited; - return CELL_EAGAIN; - case ppu_join_status::exited: - return CELL_ESRCH; - default: - return CELL_EBUSY; - } - }); + result = thread.joiner.atomic_op([](ppu_join_status& value) -> CellError + { + switch (value) + { + case ppu_join_status::joinable: + value = ppu_join_status::detached; + return {}; + case ppu_join_status::detached: + return CELL_EINVAL; + case ppu_join_status::zombie: + value = ppu_join_status::exited; + return CELL_EAGAIN; + case ppu_join_status::exited: + return CELL_ESRCH; + default: + return CELL_EBUSY; + } + }); - // Remove ID on EAGAIN - return result != CELL_EAGAIN; - }); + // Remove ID on EAGAIN + return result != CELL_EAGAIN; + }); if (result) { @@ -349,9 +349,9 @@ error_code sys_ppu_thread_set_priority(ppu_thread& ppu, u32 thread_id, s32 prio) } const auto thread = idm::check>(thread_id, [&, notify = lv2_obj::notify_all_t()](ppu_thread& thread) - { - lv2_obj::set_priority(thread, prio); - }); + { + lv2_obj::set_priority(thread, prio); + }); if (!thread) { @@ -392,16 +392,16 @@ error_code sys_ppu_thread_get_priority(ppu_thread& ppu, u32 thread_id, vm::ptr>(thread_id, [&](ppu_thread& thread) - { - if (reader_lock lock(lv2_obj::g_mutex); cpu_flag::suspend - ppu.state) { - prio = thread.prio.load().prio; - } - else - { - check_state = true; - } - }); + if (reader_lock lock(lv2_obj::g_mutex); cpu_flag::suspend - ppu.state) + { + prio = thread.prio.load().prio; + } + else + { + check_state = true; + } + }); if (check_state) { @@ -528,18 +528,18 @@ error_code _sys_ppu_thread_create(ppu_thread& ppu, vm::ptr thread_id, vm::p } } - const u32 tid = idm::import>([&]() - { - ppu_thread_params p; - p.stack_addr = stack_base; - p.stack_size = stack_size; - p.tls_addr = tls; - p.entry = entry; - p.arg0 = arg; - p.arg1 = unk; + const u32 tid = idm::import >([&]() + { + ppu_thread_params p; + p.stack_addr = stack_base; + p.stack_size = stack_size; + p.tls_addr = tls; + p.entry = entry; + p.arg0 = arg; + p.arg1 = unk; - return stx::make_shared>(p, ppu_name, prio, 1 - static_cast(flags & 3)); - }); + return stx::make_shared>(p, ppu_name, prio, 1 - static_cast(flags & 3)); + }); if (!tid) { @@ -562,23 +562,22 @@ error_code sys_ppu_thread_start(ppu_thread& ppu, u32 thread_id) sys_ppu_thread.trace("sys_ppu_thread_start(thread_id=0x%x)", thread_id); const auto thread = idm::get>(thread_id, [&, notify = lv2_obj::notify_all_t()](ppu_thread& thread) -> CellError - { - if (!thread.state.test_and_reset(cpu_flag::stop)) { - // Already started - return CELL_EBUSY; - } + if (!thread.state.test_and_reset(cpu_flag::stop)) + { + // Already started + return CELL_EBUSY; + } - ensure(lv2_obj::awake(&thread)); + ensure(lv2_obj::awake(&thread)); - thread.cmd_list - ({ - {ppu_cmd::entry_call, 0}, + thread.cmd_list({ + {ppu_cmd::entry_call, 0}, + }); + + return {}; }); - return {}; - }); - if (!thread) { return CELL_ESRCH; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_process.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_process.cpp index b914408ec..3a8297ddb 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_process.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_process.cpp @@ -87,7 +87,7 @@ error_code 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); - switch(object) + switch (object) { case SYS_MEM_OBJECT: *nump = idm_get_count(); break; case SYS_MUTEX_OBJECT: *nump = idm_get_count(); break; @@ -97,10 +97,16 @@ error_code sys_process_get_number_of_object(u32 object, vm::ptr nump) case SYS_INTR_SERVICE_HANDLE_OBJECT: *nump = idm_get_count(); break; case SYS_EVENT_QUEUE_OBJECT: *nump = idm_get_count(); break; case SYS_EVENT_PORT_OBJECT: *nump = idm_get_count(); break; - case SYS_TRACE_OBJECT: sys_process.error("sys_process_get_number_of_object: object = SYS_TRACE_OBJECT"); *nump = 0; break; + case SYS_TRACE_OBJECT: + sys_process.error("sys_process_get_number_of_object: object = SYS_TRACE_OBJECT"); + *nump = 0; + break; case SYS_SPUIMAGE_OBJECT: *nump = idm_get_count(); break; case SYS_PRX_OBJECT: *nump = idm_get_count(); break; - case SYS_SPUPORT_OBJECT: sys_process.error("sys_process_get_number_of_object: object = SYS_SPUPORT_OBJECT"); *nump = 0; break; + case SYS_SPUPORT_OBJECT: + sys_process.error("sys_process_get_number_of_object: object = SYS_SPUPORT_OBJECT"); + *nump = 0; + break; case SYS_OVERLAY_OBJECT: *nump = idm_get_count(); break; case SYS_LWMUTEX_OBJECT: *nump = idm_get_count(); break; case SYS_TIMER_OBJECT: *nump = idm_get_count(); break; @@ -124,9 +130,9 @@ template void idm_get_set(std::set& out) { idm::select([&](u32 id, Get&) - { - out.emplace(id); - }); + { + out.emplace(id); + }); } static error_code process_get_id(u32 object, vm::ptr buffer, u32 size, vm::ptr set_size) @@ -330,7 +336,7 @@ error_code sys_process_wait_for_child2(u64 unk1, u64 unk2, u64 unk3, u64 unk4, u error_code sys_process_get_status(u64 unk) { sys_process.todo("sys_process_get_status(unk=0x%llx)", unk); - //vm::write32(CPU.gpr[4], GetPPUThreadStatus(CPU)); + // vm::write32(CPU.gpr[4], GetPPUThreadStatus(CPU)); return CELL_OK; } @@ -349,11 +355,11 @@ void _sys_process_exit(ppu_thread& ppu, s32 status, u32 arg2, u32 arg3) sys_process.warning("_sys_process_exit(status=%d, arg2=0x%x, arg3=0x%x)", status, arg2, arg3); Emu.CallFromMainThread([]() - { - sys_process.success("Process finished"); - signal_system_cache_can_stay(); - Emu.Kill(); - }); + { + sys_process.success("Process finished"); + signal_system_cache_can_stay(); + Emu.Kill(); + }); // Wait for GUI thread while (auto state = +ppu.state) @@ -416,93 +422,93 @@ void lv2_exitspawn(ppu_thread& ppu, std::vector& argv, std::vector< const bool is_real_reboot = (ppu.gpr[11] == 379); Emu.CallFromMainThread([is_real_reboot, argv = std::move(argv), envp = std::move(envp), data = std::move(data)]() mutable - { - sys_process.success("Process finished -> %s", argv[0]); - - std::string disc; - - if (Emu.GetCat() == "DG" || Emu.GetCat() == "GD") - disc = vfs::get("/dev_bdvd/"); - if (disc.empty() && !Emu.GetTitleID().empty()) - disc = vfs::get(Emu.GetDir()); - - std::string path = vfs::get(argv[0]); - std::string hdd1 = vfs::get("/dev_hdd1/"); - - const u128 klic = g_fxo->get().last_key(); - - using namespace id_manager; - - shared_ptr idm_capture = make_shared(); - - if (!is_real_reboot) { - reader_lock rlock{id_manager::g_mutex}; - g_fxo->get>().save(*idm_capture); - stx::serial_breathe_and_tag(*idm_capture, "id_map", false); - } + sys_process.success("Process finished -> %s", argv[0]); - idm_capture->set_reading_state(); + std::string disc; - auto func = [is_real_reboot, old_size = g_fxo->get().size, idm_capture](u32 sdk_suggested_mem) mutable - { - if (is_real_reboot) + if (Emu.GetCat() == "DG" || Emu.GetCat() == "GD") + disc = vfs::get("/dev_bdvd/"); + if (disc.empty() && !Emu.GetTitleID().empty()) + disc = vfs::get(Emu.GetDir()); + + std::string path = vfs::get(argv[0]); + std::string hdd1 = vfs::get("/dev_hdd1/"); + + const u128 klic = g_fxo->get().last_key(); + + using namespace id_manager; + + shared_ptr idm_capture = make_shared(); + + if (!is_real_reboot) { - // Do not save containers on actual reboot - ensure(g_fxo->init>()); - } - else - { - // Save LV2 memory containers - ensure(g_fxo->init>(*idm_capture)); + reader_lock rlock{id_manager::g_mutex}; + g_fxo->get>().save(*idm_capture); + stx::serial_breathe_and_tag(*idm_capture, "id_map", false); } - // Empty the containers, accumulate their total size - u32 total_size = 0; - idm::select([&](u32, lv2_memory_container& ctr) + idm_capture->set_reading_state(); + + auto func = [is_real_reboot, old_size = g_fxo->get().size, idm_capture](u32 sdk_suggested_mem) mutable { - ctr.used = 0; - total_size += ctr.size; - }); + if (is_real_reboot) + { + // Do not save containers on actual reboot + ensure(g_fxo->init>()); + } + else + { + // Save LV2 memory containers + ensure(g_fxo->init>(*idm_capture)); + } - // The default memory container capacity can only decrease after exitspawn - // 1. If newer SDK version suggests higher memory capacity - it is ignored - // 2. If newer SDK version suggests lower memory capacity - it is lowered - // And if 2. happens while user memory containers exist, the left space can be spent on user memory containers - ensure(g_fxo->init(std::min(old_size - total_size, sdk_suggested_mem) + total_size)); - }; + // Empty the containers, accumulate their total size + u32 total_size = 0; + idm::select([&](u32, lv2_memory_container& ctr) + { + ctr.used = 0; + total_size += ctr.size; + }); - Emu.after_kill_callback = [func = std::move(func), argv = std::move(argv), envp = std::move(envp), data = std::move(data), - disc = std::move(disc), path = std::move(path), hdd1 = std::move(hdd1), old_config = Emu.GetUsedConfig(), klic]() mutable - { - Emu.argv = std::move(argv); - Emu.envp = std::move(envp); - Emu.data = std::move(data); - Emu.disc = std::move(disc); - Emu.hdd1 = std::move(hdd1); - Emu.init_mem_containers = std::move(func); + // The default memory container capacity can only decrease after exitspawn + // 1. If newer SDK version suggests higher memory capacity - it is ignored + // 2. If newer SDK version suggests lower memory capacity - it is lowered + // And if 2. happens while user memory containers exist, the left space can be spent on user memory containers + ensure(g_fxo->init(std::min(old_size - total_size, sdk_suggested_mem) + total_size)); + }; - if (klic) + Emu.after_kill_callback = [func = std::move(func), argv = std::move(argv), envp = std::move(envp), data = std::move(data), + disc = std::move(disc), path = std::move(path), hdd1 = std::move(hdd1), old_config = Emu.GetUsedConfig(), klic]() mutable { - Emu.klic.emplace_back(klic); - } + Emu.argv = std::move(argv); + Emu.envp = std::move(envp); + Emu.data = std::move(data); + Emu.disc = std::move(disc); + Emu.hdd1 = std::move(hdd1); + Emu.init_mem_containers = std::move(func); - Emu.SetForceBoot(true); + if (klic) + { + Emu.klic.emplace_back(klic); + } - auto res = Emu.BootGame(path, "", true, cfg_mode::continuous, old_config); + Emu.SetForceBoot(true); - if (res != game_boot_result::no_errors) - { - sys_process.fatal("Failed to boot from exitspawn! (path=\"%s\", error=%s)", path, res); - } - }; + auto res = Emu.BootGame(path, "", true, cfg_mode::continuous, old_config); - signal_system_cache_can_stay(); + if (res != game_boot_result::no_errors) + { + sys_process.fatal("Failed to boot from exitspawn! (path=\"%s\", error=%s)", path, res); + } + }; - // Make sure we keep the game window opened - Emu.SetContinuousMode(true); - Emu.Kill(false); - }); + signal_system_cache_can_stay(); + + // Make sure we keep the game window opened + Emu.SetContinuousMode(true); + Emu.Kill(false); + }); // Wait for GUI thread while (auto state = +ppu.state) @@ -527,8 +533,7 @@ void sys_process_exit3(ppu_thread& ppu, s32 status) error_code sys_process_spawns_a_self2(vm::ptr pid, u32 primary_prio, u64 flags, vm::ptr stack, u32 stack_size, u32 mem_id, vm::ptr param_sfo, vm::ptr dbg_data) { - sys_process.todo("sys_process_spawns_a_self2(pid=*0x%x, primary_prio=0x%x, flags=0x%llx, stack=*0x%x, stack_size=0x%x, mem_id=0x%x, param_sfo=*0x%x, dbg_data=*0x%x" - , pid, primary_prio, flags, stack, stack_size, mem_id, param_sfo, dbg_data); + sys_process.todo("sys_process_spawns_a_self2(pid=*0x%x, primary_prio=0x%x, flags=0x%llx, stack=*0x%x, stack_size=0x%x, mem_id=0x%x, param_sfo=*0x%x, dbg_data=*0x%x", pid, primary_prio, flags, stack, stack_size, mem_id, param_sfo, dbg_data); return CELL_OK; } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_process.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_process.h index 774384567..8e18ed7ba 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_process.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_process.h @@ -7,37 +7,37 @@ // Process Local Object Type enum : u32 { - SYS_MEM_OBJECT = 0x08, - SYS_MUTEX_OBJECT = 0x85, - SYS_COND_OBJECT = 0x86, - SYS_RWLOCK_OBJECT = 0x88, - SYS_INTR_TAG_OBJECT = 0x0A, - SYS_INTR_SERVICE_HANDLE_OBJECT = 0x0B, - SYS_EVENT_QUEUE_OBJECT = 0x8D, - SYS_EVENT_PORT_OBJECT = 0x0E, - SYS_TRACE_OBJECT = 0x21, - SYS_SPUIMAGE_OBJECT = 0x22, - SYS_PRX_OBJECT = 0x23, - SYS_SPUPORT_OBJECT = 0x24, - SYS_OVERLAY_OBJECT = 0x25, - SYS_LWMUTEX_OBJECT = 0x95, - SYS_TIMER_OBJECT = 0x11, - SYS_SEMAPHORE_OBJECT = 0x96, - SYS_FS_FD_OBJECT = 0x73, - SYS_LWCOND_OBJECT = 0x97, - SYS_EVENT_FLAG_OBJECT = 0x98, - SYS_RSXAUDIO_OBJECT = 0x60, + SYS_MEM_OBJECT = 0x08, + SYS_MUTEX_OBJECT = 0x85, + SYS_COND_OBJECT = 0x86, + SYS_RWLOCK_OBJECT = 0x88, + SYS_INTR_TAG_OBJECT = 0x0A, + SYS_INTR_SERVICE_HANDLE_OBJECT = 0x0B, + SYS_EVENT_QUEUE_OBJECT = 0x8D, + SYS_EVENT_PORT_OBJECT = 0x0E, + SYS_TRACE_OBJECT = 0x21, + SYS_SPUIMAGE_OBJECT = 0x22, + SYS_PRX_OBJECT = 0x23, + SYS_SPUPORT_OBJECT = 0x24, + SYS_OVERLAY_OBJECT = 0x25, + SYS_LWMUTEX_OBJECT = 0x95, + SYS_TIMER_OBJECT = 0x11, + SYS_SEMAPHORE_OBJECT = 0x96, + SYS_FS_FD_OBJECT = 0x73, + SYS_LWCOND_OBJECT = 0x97, + SYS_EVENT_FLAG_OBJECT = 0x98, + SYS_RSXAUDIO_OBJECT = 0x60, }; enum : u64 { - SYS_PROCESS_PRIMARY_STACK_SIZE_32K = 0x0000000000000010, - SYS_PROCESS_PRIMARY_STACK_SIZE_64K = 0x0000000000000020, - SYS_PROCESS_PRIMARY_STACK_SIZE_96K = 0x0000000000000030, + SYS_PROCESS_PRIMARY_STACK_SIZE_32K = 0x0000000000000010, + SYS_PROCESS_PRIMARY_STACK_SIZE_64K = 0x0000000000000020, + SYS_PROCESS_PRIMARY_STACK_SIZE_96K = 0x0000000000000030, SYS_PROCESS_PRIMARY_STACK_SIZE_128K = 0x0000000000000040, SYS_PROCESS_PRIMARY_STACK_SIZE_256K = 0x0000000000000050, SYS_PROCESS_PRIMARY_STACK_SIZE_512K = 0x0000000000000060, - SYS_PROCESS_PRIMARY_STACK_SIZE_1M = 0x0000000000000070, + SYS_PROCESS_PRIMARY_STACK_SIZE_1M = 0x0000000000000070, }; constexpr auto SYS_PROCESS_PARAM_SECTION_NAME = ".sys_proc_param"; @@ -55,19 +55,19 @@ enum : u32 SYS_PROCESS_PARAM_STACK_SIZE_MAX = 0x100000, // 1MB SYS_PROCESS_PARAM_VERSION_INVALID = 0xffffffff, - SYS_PROCESS_PARAM_VERSION_1 = 0x00000001, // for SDK 08X - SYS_PROCESS_PARAM_VERSION_084_0 = 0x00008400, - SYS_PROCESS_PARAM_VERSION_090_0 = 0x00009000, - SYS_PROCESS_PARAM_VERSION_330_0 = 0x00330000, + SYS_PROCESS_PARAM_VERSION_1 = 0x00000001, // for SDK 08X + SYS_PROCESS_PARAM_VERSION_084_0 = 0x00008400, + SYS_PROCESS_PARAM_VERSION_090_0 = 0x00009000, + SYS_PROCESS_PARAM_VERSION_330_0 = 0x00330000, SYS_PROCESS_PARAM_MAGIC = 0x13bcc5f6, SYS_PROCESS_PARAM_MALLOC_PAGE_SIZE_NONE = 0x00000000, - SYS_PROCESS_PARAM_MALLOC_PAGE_SIZE_64K = 0x00010000, - SYS_PROCESS_PARAM_MALLOC_PAGE_SIZE_1M = 0x00100000, + SYS_PROCESS_PARAM_MALLOC_PAGE_SIZE_64K = 0x00010000, + SYS_PROCESS_PARAM_MALLOC_PAGE_SIZE_1M = 0x00100000, - SYS_PROCESS_PARAM_PPC_SEG_DEFAULT = 0x00000000, - SYS_PROCESS_PARAM_PPC_SEG_OVLM = 0x00000001, + SYS_PROCESS_PARAM_PPC_SEG_DEFAULT = 0x00000000, + SYS_PROCESS_PARAM_PPC_SEG_OVLM = 0x00000001, SYS_PROCESS_PARAM_PPC_SEG_FIXEDADDR_PRX = 0x00000002, SYS_PROCESS_PARAM_SDK_VERSION_UNKNOWN = 0xffffffff, @@ -75,7 +75,7 @@ enum : u32 struct sys_exit2_param { - be_t x0; // 0x85 + be_t x0; // 0x85 be_t this_size; // 0x30 be_t next_size; be_t prio; @@ -96,7 +96,7 @@ struct ps3_process_info_t std::string_view get_cellos_appname() const; }; -extern ps3_process_info_t g_ps3_process_info; +extern ps3_process_info_t g_ps3_process_info; // Auxiliary functions s32 process_getpid(); diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_prx.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_prx.cpp index 046d19c48..0cf82ec7b 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_prx.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_prx.cpp @@ -28,151 +28,150 @@ extern void ppu_manual_load_imports_exports(u32 imports_start, u32 imports_size, LOG_CHANNEL(sys_prx); // -extern const std::map g_prx_list -{ - { "/dev_flash/sys/internal/libfs_utility_init.sprx", 1 }, - { "libaacenc.sprx", 0 }, - { "libaacenc_spurs.sprx", 0 }, - { "libac3dec.sprx", 0 }, - { "libac3dec2.sprx", 0 }, - { "libadec.sprx", 1 }, - { "libadec2.sprx", 0 }, - { "libadec_internal.sprx", 0 }, - { "libad_async.sprx", 0 }, - { "libad_billboard_util.sprx", 0 }, - { "libad_core.sprx", 0 }, - { "libapostsrc_mini.sprx", 0 }, - { "libasfparser2_astd.sprx", 0 }, - { "libat3dec.sprx", 0 }, - { "libat3multidec.sprx", 0 }, - { "libatrac3multi.sprx", 0 }, - { "libatrac3plus.sprx", 0 }, - { "libatxdec.sprx", 1 }, - { "libatxdec2.sprx", 0 }, - { "libaudio.sprx", 1 }, - { "libavcdec.sprx", 0 }, - { "libavcenc.sprx", 0 }, - { "libavcenc_small.sprx", 0 }, - { "libavchatjpgdec.sprx", 0 }, - { "libbeisobmf.sprx", 0 }, - { "libbemp2sys.sprx", 0 }, - { "libcamera.sprx", 1 }, - { "libcelp8dec.sprx", 0 }, - { "libcelp8enc.sprx", 0 }, - { "libcelpdec.sprx", 0 }, - { "libcelpenc.sprx", 0 }, - { "libddpdec.sprx", 0 }, - { "libdivxdec.sprx", 0 }, - { "libdmux.sprx", 0 }, - { "libdmuxpamf.sprx", 0 }, - { "libdtslbrdec.sprx", 0 }, - { "libfiber.sprx", 0 }, - { "libfont.sprx", 0 }, - { "libfontFT.sprx", 0 }, - { "libfreetype.sprx", 0 }, - { "libfreetypeTT.sprx", 0 }, - { "libfs.sprx", 0 }, - { "libfs_155.sprx", 0 }, - { "libgcm_sys.sprx", 0 }, - { "libgem.sprx", 1 }, - { "libgifdec.sprx", 0 }, - { "libhttp.sprx", 0 }, - { "libio.sprx", 1 }, - { "libjpgdec.sprx", 0 }, - { "libjpgenc.sprx", 0 }, - { "libkey2char.sprx", 0 }, - { "libl10n.sprx", 0 }, - { "liblv2.sprx", 0 }, - { "liblv2coredump.sprx", 0 }, - { "liblv2dbg_for_cex.sprx", 0 }, - { "libm2bcdec.sprx", 0 }, - { "libm4aacdec.sprx", 0 }, - { "libm4aacdec2ch.sprx", 0 }, - { "libm4hdenc.sprx", 0 }, - { "libm4venc.sprx", 0 }, - { "libmedi.sprx", 1 }, - { "libmic.sprx", 1 }, - { "libmp3dec.sprx", 0 }, - { "libmp4.sprx", 0 }, - { "libmpl1dec.sprx", 0 }, - { "libmvcdec.sprx", 0 }, - { "libnet.sprx", 0 }, - { "libnetctl.sprx", 1 }, - { "libpamf.sprx", 1 }, - { "libpngdec.sprx", 0 }, - { "libpngenc.sprx", 0 }, - { "libresc.sprx", 0 }, - { "librtc.sprx", 1 }, - { "librudp.sprx", 0 }, - { "libsail.sprx", 0 }, - { "libsail_avi.sprx", 0 }, - { "libsail_rec.sprx", 0 }, - { "libsjvtd.sprx", 0 }, - { "libsmvd2.sprx", 0 }, - { "libsmvd4.sprx", 0 }, - { "libspurs_jq.sprx", 0 }, - { "libsre.sprx", 0 }, - { "libssl.sprx", 0 }, - { "libsvc1d.sprx", 0 }, - { "libsync2.sprx", 0 }, - { "libsysmodule.sprx", 0 }, - { "libsysutil.sprx", 1 }, - { "libsysutil_ap.sprx", 1 }, - { "libsysutil_authdialog.sprx", 1 }, - { "libsysutil_avc2.sprx", 1 }, - { "libsysutil_avconf_ext.sprx", 1 }, - { "libsysutil_avc_ext.sprx", 1 }, - { "libsysutil_bgdl.sprx", 1 }, - { "libsysutil_cross_controller.sprx", 1 }, - { "libsysutil_dec_psnvideo.sprx", 1 }, - { "libsysutil_dtcp_ip.sprx", 1 }, - { "libsysutil_game.sprx", 1 }, - { "libsysutil_game_exec.sprx", 1 }, - { "libsysutil_imejp.sprx", 1 }, - { "libsysutil_misc.sprx", 1 }, - { "libsysutil_music.sprx", 1 }, - { "libsysutil_music_decode.sprx", 1 }, - { "libsysutil_music_export.sprx", 1 }, - { "libsysutil_np.sprx", 1 }, - { "libsysutil_np2.sprx", 1 }, - { "libsysutil_np_clans.sprx", 1 }, - { "libsysutil_np_commerce2.sprx", 1 }, - { "libsysutil_np_eula.sprx", 1 }, - { "libsysutil_np_installer.sprx", 1 }, - { "libsysutil_np_sns.sprx", 1 }, - { "libsysutil_np_trophy.sprx", 1 }, - { "libsysutil_np_tus.sprx", 1 }, - { "libsysutil_np_util.sprx", 1 }, - { "libsysutil_oskdialog_ext.sprx", 1 }, - { "libsysutil_pesm.sprx", 1 }, - { "libsysutil_photo_decode.sprx", 1 }, - { "libsysutil_photo_export.sprx", 1 }, - { "libsysutil_photo_export2.sprx", 1 }, - { "libsysutil_photo_import.sprx", 1 }, - { "libsysutil_photo_network_sharing.sprx", 1 }, - { "libsysutil_print.sprx", 1 }, - { "libsysutil_rec.sprx", 1 }, - { "libsysutil_remoteplay.sprx", 1 }, - { "libsysutil_rtcalarm.sprx", 1 }, - { "libsysutil_savedata.sprx", 1 }, - { "libsysutil_savedata_psp.sprx", 1 }, - { "libsysutil_screenshot.sprx", 1 }, - { "libsysutil_search.sprx", 1 }, - { "libsysutil_storagedata.sprx", 1 }, - { "libsysutil_subdisplay.sprx", 1 }, - { "libsysutil_syschat.sprx", 1 }, - { "libsysutil_sysconf_ext.sprx", 1 }, - { "libsysutil_userinfo.sprx", 1 }, - { "libsysutil_video_export.sprx", 1 }, - { "libsysutil_video_player.sprx", 1 }, - { "libsysutil_video_upload.sprx", 1 }, - { "libusbd.sprx", 0 }, - { "libusbpspcm.sprx", 0 }, - { "libvdec.sprx", 1 }, - { "libvoice.sprx", 1 }, - { "libvpost.sprx", 0 }, - { "libvpost2.sprx", 0 }, - { "libwmadec.sprx", 0 }, +extern const std::map g_prx_list{ + {"/dev_flash/sys/internal/libfs_utility_init.sprx", 1}, + {"libaacenc.sprx", 0}, + {"libaacenc_spurs.sprx", 0}, + {"libac3dec.sprx", 0}, + {"libac3dec2.sprx", 0}, + {"libadec.sprx", 1}, + {"libadec2.sprx", 0}, + {"libadec_internal.sprx", 0}, + {"libad_async.sprx", 0}, + {"libad_billboard_util.sprx", 0}, + {"libad_core.sprx", 0}, + {"libapostsrc_mini.sprx", 0}, + {"libasfparser2_astd.sprx", 0}, + {"libat3dec.sprx", 0}, + {"libat3multidec.sprx", 0}, + {"libatrac3multi.sprx", 0}, + {"libatrac3plus.sprx", 0}, + {"libatxdec.sprx", 1}, + {"libatxdec2.sprx", 0}, + {"libaudio.sprx", 1}, + {"libavcdec.sprx", 0}, + {"libavcenc.sprx", 0}, + {"libavcenc_small.sprx", 0}, + {"libavchatjpgdec.sprx", 0}, + {"libbeisobmf.sprx", 0}, + {"libbemp2sys.sprx", 0}, + {"libcamera.sprx", 1}, + {"libcelp8dec.sprx", 0}, + {"libcelp8enc.sprx", 0}, + {"libcelpdec.sprx", 0}, + {"libcelpenc.sprx", 0}, + {"libddpdec.sprx", 0}, + {"libdivxdec.sprx", 0}, + {"libdmux.sprx", 0}, + {"libdmuxpamf.sprx", 0}, + {"libdtslbrdec.sprx", 0}, + {"libfiber.sprx", 0}, + {"libfont.sprx", 0}, + {"libfontFT.sprx", 0}, + {"libfreetype.sprx", 0}, + {"libfreetypeTT.sprx", 0}, + {"libfs.sprx", 0}, + {"libfs_155.sprx", 0}, + {"libgcm_sys.sprx", 0}, + {"libgem.sprx", 1}, + {"libgifdec.sprx", 0}, + {"libhttp.sprx", 0}, + {"libio.sprx", 1}, + {"libjpgdec.sprx", 0}, + {"libjpgenc.sprx", 0}, + {"libkey2char.sprx", 0}, + {"libl10n.sprx", 0}, + {"liblv2.sprx", 0}, + {"liblv2coredump.sprx", 0}, + {"liblv2dbg_for_cex.sprx", 0}, + {"libm2bcdec.sprx", 0}, + {"libm4aacdec.sprx", 0}, + {"libm4aacdec2ch.sprx", 0}, + {"libm4hdenc.sprx", 0}, + {"libm4venc.sprx", 0}, + {"libmedi.sprx", 1}, + {"libmic.sprx", 1}, + {"libmp3dec.sprx", 0}, + {"libmp4.sprx", 0}, + {"libmpl1dec.sprx", 0}, + {"libmvcdec.sprx", 0}, + {"libnet.sprx", 0}, + {"libnetctl.sprx", 1}, + {"libpamf.sprx", 1}, + {"libpngdec.sprx", 0}, + {"libpngenc.sprx", 0}, + {"libresc.sprx", 0}, + {"librtc.sprx", 1}, + {"librudp.sprx", 0}, + {"libsail.sprx", 0}, + {"libsail_avi.sprx", 0}, + {"libsail_rec.sprx", 0}, + {"libsjvtd.sprx", 0}, + {"libsmvd2.sprx", 0}, + {"libsmvd4.sprx", 0}, + {"libspurs_jq.sprx", 0}, + {"libsre.sprx", 0}, + {"libssl.sprx", 0}, + {"libsvc1d.sprx", 0}, + {"libsync2.sprx", 0}, + {"libsysmodule.sprx", 0}, + {"libsysutil.sprx", 1}, + {"libsysutil_ap.sprx", 1}, + {"libsysutil_authdialog.sprx", 1}, + {"libsysutil_avc2.sprx", 1}, + {"libsysutil_avconf_ext.sprx", 1}, + {"libsysutil_avc_ext.sprx", 1}, + {"libsysutil_bgdl.sprx", 1}, + {"libsysutil_cross_controller.sprx", 1}, + {"libsysutil_dec_psnvideo.sprx", 1}, + {"libsysutil_dtcp_ip.sprx", 1}, + {"libsysutil_game.sprx", 1}, + {"libsysutil_game_exec.sprx", 1}, + {"libsysutil_imejp.sprx", 1}, + {"libsysutil_misc.sprx", 1}, + {"libsysutil_music.sprx", 1}, + {"libsysutil_music_decode.sprx", 1}, + {"libsysutil_music_export.sprx", 1}, + {"libsysutil_np.sprx", 1}, + {"libsysutil_np2.sprx", 1}, + {"libsysutil_np_clans.sprx", 1}, + {"libsysutil_np_commerce2.sprx", 1}, + {"libsysutil_np_eula.sprx", 1}, + {"libsysutil_np_installer.sprx", 1}, + {"libsysutil_np_sns.sprx", 1}, + {"libsysutil_np_trophy.sprx", 1}, + {"libsysutil_np_tus.sprx", 1}, + {"libsysutil_np_util.sprx", 1}, + {"libsysutil_oskdialog_ext.sprx", 1}, + {"libsysutil_pesm.sprx", 1}, + {"libsysutil_photo_decode.sprx", 1}, + {"libsysutil_photo_export.sprx", 1}, + {"libsysutil_photo_export2.sprx", 1}, + {"libsysutil_photo_import.sprx", 1}, + {"libsysutil_photo_network_sharing.sprx", 1}, + {"libsysutil_print.sprx", 1}, + {"libsysutil_rec.sprx", 1}, + {"libsysutil_remoteplay.sprx", 1}, + {"libsysutil_rtcalarm.sprx", 1}, + {"libsysutil_savedata.sprx", 1}, + {"libsysutil_savedata_psp.sprx", 1}, + {"libsysutil_screenshot.sprx", 1}, + {"libsysutil_search.sprx", 1}, + {"libsysutil_storagedata.sprx", 1}, + {"libsysutil_subdisplay.sprx", 1}, + {"libsysutil_syschat.sprx", 1}, + {"libsysutil_sysconf_ext.sprx", 1}, + {"libsysutil_userinfo.sprx", 1}, + {"libsysutil_video_export.sprx", 1}, + {"libsysutil_video_player.sprx", 1}, + {"libsysutil_video_upload.sprx", 1}, + {"libusbd.sprx", 0}, + {"libusbpspcm.sprx", 0}, + {"libvdec.sprx", 1}, + {"libvoice.sprx", 1}, + {"libvpost.sprx", 0}, + {"libvpost2.sprx", 0}, + {"libwmadec.sprx", 0}, }; bool ppu_register_library_lock(std::string_view libname, bool lock_lib); @@ -393,7 +392,8 @@ void lv2_prx::save(utils::serial& ar) for (const ppu_segment& seg : segs) { - if (seg.type == 0x1u && seg.size) ar(seg.addr); + if (seg.type == 0x1u && seg.size) + ar(seg.addr); } } @@ -633,7 +633,7 @@ error_code _sys_prx_stop_module(ppu_thread& ppu, u32 id, u64 flags, vm::ptrstop); - //prx->stop = vm::null; + // prx->stop = vm::null; } return CELL_OK; @@ -710,26 +710,27 @@ error_code _sys_prx_unload_module(ppu_thread& ppu, u32 id, u64 flags, vm::ptr(id, [](lv2_prx& prx) -> CellPrxError - { - switch (prx.state.fetch_op([](u32& value) { - if (value == PRX_STATE_INITIALIZED || value == PRX_STATE_STOPPED) + switch (prx.state.fetch_op([](u32& value) + { + if (value == PRX_STATE_INITIALIZED || value == PRX_STATE_STOPPED) + { + value = PRX_STATE_DESTROYED; + return true; + } + + return false; + }) + .first) { - value = PRX_STATE_DESTROYED; - return true; + case PRX_STATE_INITIALIZED: + case PRX_STATE_STOPPED: + return {}; + default: break; } - return false; - }).first) - { - case PRX_STATE_INITIALIZED: - case PRX_STATE_STOPPED: - return {}; - default: break; - } - - return CELL_PRX_ERROR_NOT_REMOVABLE; - }); + return CELL_PRX_ERROR_NOT_REMOVABLE; + }); if (!prx) { @@ -749,7 +750,7 @@ error_code _sys_prx_unload_module(ppu_thread& ppu, u32 id, u64 flags, vm::ptrexit ? prx->exit() : CELL_OK; + // s32 result = prx->exit ? prx->exit() : CELL_OK; return CELL_OK; } @@ -845,8 +846,8 @@ error_code _sys_prx_register_module(ppu_thread& ppu, vm::cptr name, vm::pt } sys_prx.warning("opt: size=0x%x, type=0x%x, unk3=0x%x, unk4=0x%x, lib_entries_ea=%s, lib_entries_size=0x%x" - ", lib_stub_ea=%s, lib_stub_size=0x%x, error_handler=%s", info.size, info.type, info.unk3, info.unk4 - , info.lib_entries_ea, info.lib_entries_size, info.lib_stub_ea, info.lib_stub_size, info.error_handler); + ", lib_stub_ea=%s, lib_stub_size=0x%x, error_handler=%s", + info.size, info.type, info.unk3, info.unk4, info.lib_entries_ea, info.lib_entries_size, info.lib_stub_ea, info.lib_stub_size, info.error_handler); if (info.type & 0x1) { @@ -894,21 +895,21 @@ error_code _sys_prx_register_library(ppu_thread& ppu, vm::ptr library) if (flags.front()) { const bool success = idm::select([&](u32 /*id*/, lv2_prx& prx) - { - if (prx.state == PRX_STATE_INITIALIZED) { - for (u32 lib_addr = prx.exports_start, index = 0; lib_addr < prx.exports_end; index++, lib_addr += vm::read8(lib_addr) ? vm::read8(lib_addr) : sizeof_lib) + if (prx.state == PRX_STATE_INITIALIZED) { - if (std::memcpy(vm::base(lib_addr), mem_copy.data(), sizeof_lib) == 0) + for (u32 lib_addr = prx.exports_start, index = 0; lib_addr < prx.exports_end; index++, lib_addr += vm::read8(lib_addr) ? vm::read8(lib_addr) : sizeof_lib) { - atomic_storage::release(prx.m_external_loaded_flags[index], true); - return true; + if (std::memcpy(vm::base(lib_addr), mem_copy.data(), sizeof_lib) == 0) + { + atomic_storage::release(prx.m_external_loaded_flags[index], true); + return true; + } } } - } - return false; - }).ret; + return false; + }).ret; if (!success) { @@ -983,21 +984,21 @@ error_code _sys_prx_get_module_list(ppu_thread& ppu, u64 flags, vm::ptr([&](u32 id, lv2_prx& prx) - { - if (count >= max_count) { - return true; - } + if (count >= max_count) + { + return true; + } - if (prx.path == liblv2_path) - { - // Hide liblv2.sprx for now + if (prx.path == liblv2_path) + { + // Hide liblv2.sprx for now + return false; + } + + idlist[count++] = id; return false; - } - - idlist[count++] = id; - return false; - }); + }); } pInfo->count = count; @@ -1062,7 +1063,8 @@ error_code _sys_prx_get_module_info(ppu_thread& ppu, u32 id, u64 flags, vm::ptr< u32 i = 0; for (; i < prx->segs.size() && i < pOpt->info->segments_num; i++) { - if (!prx->segs[i].addr) continue; // TODO: Check this + if (!prx->segs[i].addr) + continue; // TODO: Check this pOpt->info->segments[i].index = i; pOpt->info->segments[i].base = prx->segs[i].addr; pOpt->info->segments[i].filesz = prx->segs[i].filesz; @@ -1096,14 +1098,14 @@ error_code _sys_prx_get_module_id_by_name(ppu_thread& ppu, vm::cptr name, } const auto [prx, id] = idm::select([&](u32 id, lv2_prx& prx) -> u32 - { - if (strncmp(module_name.c_str(), prx.module_info_name, sizeof(prx.module_info_name)) == 0) { - return id; - } + if (strncmp(module_name.c_str(), prx.module_info_name, sizeof(prx.module_info_name)) == 0) + { + return id; + } - return 0; - }); + return 0; + }); if (!id) { @@ -1126,17 +1128,17 @@ error_code _sys_prx_get_module_id_by_address(ppu_thread& ppu, u32 addr) } const auto [prx, id] = idm::select([&](u32 id, lv2_prx& prx) -> u32 - { - for (const ppu_segment& seg : prx.segs) { - if (seg.size && addr >= seg.addr && addr < seg.addr + seg.size) + for (const ppu_segment& seg : prx.segs) { - return id; + if (seg.size && addr >= seg.addr && addr < seg.addr + seg.size) + { + return id; + } } - } - return 0; - }); + return 0; + }); if (!id) { @@ -1166,35 +1168,35 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellPrxError value) - { - switch (value) { - STR_CASE(CELL_PRX_ERROR_ERROR); - STR_CASE(CELL_PRX_ERROR_ILLEGAL_PERM); - STR_CASE(CELL_PRX_ERROR_UNKNOWN_MODULE); - STR_CASE(CELL_PRX_ERROR_ALREADY_STARTED); - STR_CASE(CELL_PRX_ERROR_NOT_STARTED); - STR_CASE(CELL_PRX_ERROR_ALREADY_STOPPED); - STR_CASE(CELL_PRX_ERROR_CAN_NOT_STOP); - STR_CASE(CELL_PRX_ERROR_NOT_REMOVABLE); - STR_CASE(CELL_PRX_ERROR_LIBRARY_NOT_YET_LINKED); - STR_CASE(CELL_PRX_ERROR_LIBRARY_FOUND); - STR_CASE(CELL_PRX_ERROR_LIBRARY_NOTFOUND); - STR_CASE(CELL_PRX_ERROR_ILLEGAL_LIBRARY); - STR_CASE(CELL_PRX_ERROR_LIBRARY_INUSE); - STR_CASE(CELL_PRX_ERROR_ALREADY_STOPPING); - STR_CASE(CELL_PRX_ERROR_UNSUPPORTED_PRX_TYPE); - STR_CASE(CELL_PRX_ERROR_INVAL); - STR_CASE(CELL_PRX_ERROR_ILLEGAL_PROCESS); - STR_CASE(CELL_PRX_ERROR_NO_LIBLV2); - STR_CASE(CELL_PRX_ERROR_UNSUPPORTED_ELF_TYPE); - STR_CASE(CELL_PRX_ERROR_UNSUPPORTED_ELF_CLASS); - STR_CASE(CELL_PRX_ERROR_UNDEFINED_SYMBOL); - STR_CASE(CELL_PRX_ERROR_UNSUPPORTED_RELOCATION_TYPE); - STR_CASE(CELL_PRX_ERROR_ELF_IS_REGISTERED); - STR_CASE(CELL_PRX_ERROR_NO_EXIT_ENTRY); - } + switch (value) + { + STR_CASE(CELL_PRX_ERROR_ERROR); + STR_CASE(CELL_PRX_ERROR_ILLEGAL_PERM); + STR_CASE(CELL_PRX_ERROR_UNKNOWN_MODULE); + STR_CASE(CELL_PRX_ERROR_ALREADY_STARTED); + STR_CASE(CELL_PRX_ERROR_NOT_STARTED); + STR_CASE(CELL_PRX_ERROR_ALREADY_STOPPED); + STR_CASE(CELL_PRX_ERROR_CAN_NOT_STOP); + STR_CASE(CELL_PRX_ERROR_NOT_REMOVABLE); + STR_CASE(CELL_PRX_ERROR_LIBRARY_NOT_YET_LINKED); + STR_CASE(CELL_PRX_ERROR_LIBRARY_FOUND); + STR_CASE(CELL_PRX_ERROR_LIBRARY_NOTFOUND); + STR_CASE(CELL_PRX_ERROR_ILLEGAL_LIBRARY); + STR_CASE(CELL_PRX_ERROR_LIBRARY_INUSE); + STR_CASE(CELL_PRX_ERROR_ALREADY_STOPPING); + STR_CASE(CELL_PRX_ERROR_UNSUPPORTED_PRX_TYPE); + STR_CASE(CELL_PRX_ERROR_INVAL); + STR_CASE(CELL_PRX_ERROR_ILLEGAL_PROCESS); + STR_CASE(CELL_PRX_ERROR_NO_LIBLV2); + STR_CASE(CELL_PRX_ERROR_UNSUPPORTED_ELF_TYPE); + STR_CASE(CELL_PRX_ERROR_UNSUPPORTED_ELF_CLASS); + STR_CASE(CELL_PRX_ERROR_UNDEFINED_SYMBOL); + STR_CASE(CELL_PRX_ERROR_UNSUPPORTED_RELOCATION_TYPE); + STR_CASE(CELL_PRX_ERROR_ELF_IS_REGISTERED); + STR_CASE(CELL_PRX_ERROR_NO_EXIT_ENTRY); + } - return unknown; - }); + return unknown; + }); } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_prx.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_prx.h index a78542dcb..5481e76a4 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_prx.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_prx.h @@ -9,30 +9,30 @@ // Return codes enum CellPrxError : u32 { - CELL_PRX_ERROR_ERROR = 0x80011001, // Error state - CELL_PRX_ERROR_ILLEGAL_PERM = 0x800110d1, // No permission to execute API - CELL_PRX_ERROR_UNKNOWN_MODULE = 0x8001112e, // Specified PRX could not be found - CELL_PRX_ERROR_ALREADY_STARTED = 0x80011133, // Specified PRX is already started - CELL_PRX_ERROR_NOT_STARTED = 0x80011134, // Specified PRX is not started - CELL_PRX_ERROR_ALREADY_STOPPED = 0x80011135, // Specified PRX is already stopped - CELL_PRX_ERROR_CAN_NOT_STOP = 0x80011136, // Specified PRX must not be stopped - CELL_PRX_ERROR_NOT_REMOVABLE = 0x80011138, // Specified PRX must not be deleted - CELL_PRX_ERROR_LIBRARY_NOT_YET_LINKED = 0x8001113a, // Called unlinked function - CELL_PRX_ERROR_LIBRARY_FOUND = 0x8001113b, // Specified library is already registered - CELL_PRX_ERROR_LIBRARY_NOTFOUND = 0x8001113c, // Specified library is not registered - CELL_PRX_ERROR_ILLEGAL_LIBRARY = 0x8001113d, // Library structure is invalid - CELL_PRX_ERROR_LIBRARY_INUSE = 0x8001113e, // Library cannot be deleted because it is linked - CELL_PRX_ERROR_ALREADY_STOPPING = 0x8001113f, // Specified PRX is in the process of stopping - CELL_PRX_ERROR_UNSUPPORTED_PRX_TYPE = 0x80011148, // Specified PRX format is invalid and cannot be loaded - CELL_PRX_ERROR_INVAL = 0x80011324, // Argument value is invalid - CELL_PRX_ERROR_ILLEGAL_PROCESS = 0x80011801, // Specified process does not exist - CELL_PRX_ERROR_NO_LIBLV2 = 0x80011881, // liblv2.sprx does not exist - CELL_PRX_ERROR_UNSUPPORTED_ELF_TYPE = 0x80011901, // ELF type of specified file is not supported - CELL_PRX_ERROR_UNSUPPORTED_ELF_CLASS = 0x80011902, // ELF class of specified file is not supported - CELL_PRX_ERROR_UNDEFINED_SYMBOL = 0x80011904, // References undefined symbols + CELL_PRX_ERROR_ERROR = 0x80011001, // Error state + CELL_PRX_ERROR_ILLEGAL_PERM = 0x800110d1, // No permission to execute API + CELL_PRX_ERROR_UNKNOWN_MODULE = 0x8001112e, // Specified PRX could not be found + CELL_PRX_ERROR_ALREADY_STARTED = 0x80011133, // Specified PRX is already started + CELL_PRX_ERROR_NOT_STARTED = 0x80011134, // Specified PRX is not started + CELL_PRX_ERROR_ALREADY_STOPPED = 0x80011135, // Specified PRX is already stopped + CELL_PRX_ERROR_CAN_NOT_STOP = 0x80011136, // Specified PRX must not be stopped + CELL_PRX_ERROR_NOT_REMOVABLE = 0x80011138, // Specified PRX must not be deleted + CELL_PRX_ERROR_LIBRARY_NOT_YET_LINKED = 0x8001113a, // Called unlinked function + CELL_PRX_ERROR_LIBRARY_FOUND = 0x8001113b, // Specified library is already registered + CELL_PRX_ERROR_LIBRARY_NOTFOUND = 0x8001113c, // Specified library is not registered + CELL_PRX_ERROR_ILLEGAL_LIBRARY = 0x8001113d, // Library structure is invalid + CELL_PRX_ERROR_LIBRARY_INUSE = 0x8001113e, // Library cannot be deleted because it is linked + CELL_PRX_ERROR_ALREADY_STOPPING = 0x8001113f, // Specified PRX is in the process of stopping + CELL_PRX_ERROR_UNSUPPORTED_PRX_TYPE = 0x80011148, // Specified PRX format is invalid and cannot be loaded + CELL_PRX_ERROR_INVAL = 0x80011324, // Argument value is invalid + CELL_PRX_ERROR_ILLEGAL_PROCESS = 0x80011801, // Specified process does not exist + CELL_PRX_ERROR_NO_LIBLV2 = 0x80011881, // liblv2.sprx does not exist + CELL_PRX_ERROR_UNSUPPORTED_ELF_TYPE = 0x80011901, // ELF type of specified file is not supported + CELL_PRX_ERROR_UNSUPPORTED_ELF_CLASS = 0x80011902, // ELF class of specified file is not supported + CELL_PRX_ERROR_UNDEFINED_SYMBOL = 0x80011904, // References undefined symbols CELL_PRX_ERROR_UNSUPPORTED_RELOCATION_TYPE = 0x80011905, // Uses unsupported relocation type - CELL_PRX_ERROR_ELF_IS_REGISTERED = 0x80011910, // Fixed ELF is already registered - CELL_PRX_ERROR_NO_EXIT_ENTRY = 0x80011911, + CELL_PRX_ERROR_ELF_IS_REGISTERED = 0x80011910, // Fixed ELF is already registered + CELL_PRX_ERROR_NO_EXIT_ENTRY = 0x80011911, }; enum @@ -63,17 +63,17 @@ struct sys_prx_segment_info_t struct sys_prx_module_info_t { - be_t size; // 0 - char name[30]; // 8 - char version[2]; // 0x26 - be_t modattribute; // 0x28 - be_t start_entry; // 0x2c - be_t stop_entry; // 0x30 - be_t all_segments_num; // 0x34 - vm::bptr filename; // 0x38 - be_t filename_size; // 0x3c + be_t size; // 0 + char name[30]; // 8 + char version[2]; // 0x26 + be_t modattribute; // 0x28 + be_t start_entry; // 0x2c + be_t stop_entry; // 0x30 + be_t all_segments_num; // 0x34 + vm::bptr filename; // 0x38 + be_t filename_size; // 0x3c vm::bptr segments; // 0x40 - be_t segments_num; // 0x44 + be_t segments_num; // 0x44 }; struct sys_prx_module_info_v2_t : sys_prx_module_info_t @@ -138,27 +138,27 @@ struct sys_prx_get_module_list_option_t struct sys_prx_register_module_0x20_t { - be_t size; // 0x0 - be_t toc; // 0x8 - be_t toc_size; // 0xC - vm::bptr stubs_ea; // 0x10 - be_t stubs_size; // 0x14 + be_t size; // 0x0 + be_t toc; // 0x8 + be_t toc_size; // 0xC + vm::bptr stubs_ea; // 0x10 + be_t stubs_size; // 0x14 vm::bptr error_handler; // 0x18 - char pad[4]; // 0x1C + char pad[4]; // 0x1C }; struct sys_prx_register_module_0x30_type_1_t { - be_t size; // 0x0 - be_t type; // 0x8 - be_t unk3; // 0x10 - be_t unk4; // 0x14 + be_t size; // 0x0 + be_t type; // 0x8 + be_t unk3; // 0x10 + be_t unk4; // 0x14 vm::bptr lib_entries_ea; // 0x18 - be_t lib_entries_size; // 0x1C - vm::bptr lib_stub_ea; // 0x20 - be_t lib_stub_size; // 0x24 - vm::bptr error_handler; // 0x28 - char pad[4]; // 0x2C + be_t lib_entries_size; // 0x1C + vm::bptr lib_stub_ea; // 0x20 + be_t lib_stub_size; // 0x24 + vm::bptr error_handler; // 0x28 + char pad[4]; // 0x2C }; enum : u32 @@ -169,8 +169,8 @@ enum : u32 SYS_PRX_START_OK = 0, SYS_PRX_STOP_SUCCESS = 0, - SYS_PRX_STOP_OK = 0, - SYS_PRX_STOP_FAILED = 1 + SYS_PRX_STOP_OK = 0, + SYS_PRX_STOP_FAILED = 1 }; // Unofficial names for PRX state @@ -179,8 +179,8 @@ enum : u32 PRX_STATE_INITIALIZED, PRX_STATE_STARTING, // In-between state between initialized and started (internal) PRX_STATE_STARTED, - PRX_STATE_STOPPING, // In-between state between started and stopped (internal) - PRX_STATE_STOPPED, // Last state, the module cannot be restarted + PRX_STATE_STOPPING, // In-between state between started and stopped (internal) + PRX_STATE_STOPPED, // Last state, the module cannot be restarted PRX_STATE_DESTROYED, // Last state, the module cannot be restarted }; @@ -212,7 +212,7 @@ struct lv2_prx final : ppu_module std::basic_string m_loaded_flags; std::basic_string m_external_loaded_flags; - void load_exports(); // (Re)load exports + void load_exports(); // (Re)load exports void restore_exports(); // For savestates void unload_exports(); @@ -231,16 +231,16 @@ enum : u64 // PPC enum { - SYS_PRX_R_PPC_ADDR32 = 1, + SYS_PRX_R_PPC_ADDR32 = 1, SYS_PRX_R_PPC_ADDR16_LO = 4, SYS_PRX_R_PPC_ADDR16_HI = 5, SYS_PRX_R_PPC_ADDR16_HA = 6, - SYS_PRX_R_PPC64_ADDR32 = SYS_PRX_R_PPC_ADDR32, - SYS_PRX_R_PPC64_ADDR16_LO = SYS_PRX_R_PPC_ADDR16_LO, - SYS_PRX_R_PPC64_ADDR16_HI = SYS_PRX_R_PPC_ADDR16_HI, - SYS_PRX_R_PPC64_ADDR16_HA = SYS_PRX_R_PPC_ADDR16_HA, - SYS_PRX_R_PPC64_ADDR64 = 38, + SYS_PRX_R_PPC64_ADDR32 = SYS_PRX_R_PPC_ADDR32, + SYS_PRX_R_PPC64_ADDR16_LO = SYS_PRX_R_PPC_ADDR16_LO, + SYS_PRX_R_PPC64_ADDR16_HI = SYS_PRX_R_PPC_ADDR16_HI, + SYS_PRX_R_PPC64_ADDR16_HA = SYS_PRX_R_PPC_ADDR16_HA, + SYS_PRX_R_PPC64_ADDR64 = 38, SYS_PRX_VARLINK_TERMINATE32 = 0x00000000 }; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsx.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsx.cpp index 87176ae03..e219feef5 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsx.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsx.cpp @@ -21,18 +21,18 @@ enum sys_rsx_error : s32 SYS_RSX_CONTEXT_ATTRIBUTE_ERROR = -17 }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(SYS_RSX_CONTEXT_ATTRIBUTE_ERROR); - } + switch (error) + { + STR_CASE(SYS_RSX_CONTEXT_ATTRIBUTE_ERROR); + } - return unknown; - }); + return unknown; + }); } static u64 rsx_timeStamp() @@ -265,7 +265,7 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr context_id, vm *lpar_driver_info = dma_address + 0x100000; *lpar_reports = dma_address + 0x200000; - auto &reports = vm::_ref(vm::cast(*lpar_reports)); + auto& reports = vm::_ref(vm::cast(*lpar_reports)); std::memset(&reports, 0, sizeof(RsxReports)); for (usz i = 0; i < std::size(reports.notify); ++i) @@ -286,7 +286,7 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr context_id, vm reports.report[i].pad = -1; } - auto &driverInfo = vm::_ref(vm::cast(*lpar_driver_info)); + auto& driverInfo = vm::_ref(vm::cast(*lpar_driver_info)); std::memset(&driverInfo, 0, sizeof(RsxDriverInfo)); @@ -303,16 +303,15 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr context_id, vm render->driver_info = vm::cast(*lpar_driver_info); - auto &dmaControl = vm::_ref(vm::cast(*lpar_dma_control)); + auto& dmaControl = vm::_ref(vm::cast(*lpar_dma_control)); dmaControl.get = 0; dmaControl.put = 0; dmaControl.ref = 0; // Set later to -1 by cellGcmSys - if ((false/*system_mode & something*/ || g_cfg.video.decr_memory_layout) - && g_cfg.core.debug_console_mode) - rsx::get_current_renderer()->main_mem_size = 0x20000000; //512MB + if ((false /*system_mode & something*/ || g_cfg.video.decr_memory_layout) && g_cfg.core.debug_console_mode) + rsx::get_current_renderer()->main_mem_size = 0x20000000; // 512MB else - rsx::get_current_renderer()->main_mem_size = 0x10000000; //256MB + rsx::get_current_renderer()->main_mem_size = 0x10000000; // 256MB vm::var> attr; attr->protocol = SYS_SYNC_PRIORITY; @@ -445,7 +444,8 @@ error_code sys_rsx_context_iomap(cpu_thread& cpu, u32 context_id, u32 io, u32 ea // TODO: Investigate relaxed memory ordering const u32 prev_ea = table.ea[io + i]; table.ea[io + i].release((ea + i) << 20); - if (prev_ea + 1) table.io[prev_ea >> 20].release(-1); // Clear previous mapping if exists + if (prev_ea + 1) + table.io[prev_ea >> 20].release(-1); // Clear previous mapping if exists table.io[ea + i].release((io + i) << 20); } @@ -467,7 +467,7 @@ error_code sys_rsx_context_iounmap(cpu_thread& cpu, u32 context_id, u32 io, u32 const auto render = rsx::get_current_renderer(); if (!size || size & 0xFFFFF || io & 0xFFFFF || context_id != 0x55555555 || - render->main_mem_size < io + u64{size}) + render->main_mem_size < io + u64{size}) { return CELL_EINVAL; } @@ -487,7 +487,8 @@ error_code sys_rsx_context_iounmap(cpu_thread& cpu, u32 context_id, u32 io, u32 const u32 ea_entry = table.ea[io]; table.ea[io++].release(-1); - if (ea_entry + 1) table.io[ea_entry >> 20].release(-1); + if (ea_entry + 1) + table.io[ea_entry >> 20].release(-1); } return CELL_OK; @@ -519,15 +520,15 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 if (!render->dma_address) { - return { CELL_EINVAL, "dma_address is 0" }; + return {CELL_EINVAL, "dma_address is 0"}; } if (context_id != 0x55555555) { - return { CELL_EINVAL, "context_id is 0x%x", context_id }; + return {CELL_EINVAL, "context_id is 0x%x", context_id}; } - auto &driverInfo = vm::_ref(render->driver_info); + auto& driverInfo = vm::_ref(render->driver_info); switch (package_id) { case 0x001: // FIFO @@ -683,9 +684,9 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 ensure(a3 < 2); driverInfo.head[a3].flipFlags.atomic_op([&](be_t& flipStatus) - { - flipStatus = (flipStatus & static_cast(a4)) | static_cast(a5); - }); + { + flipStatus = (flipStatus & static_cast(a4)) | static_cast(a5); + }); break; } case 0x10D: // Called by cellGcmInitCursor @@ -693,10 +694,10 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 case 0x300: // Tiles { - //a4 high bits = ret.tile = (location + 1) | (bank << 4) | ((offset / 0x10000) << 16) | (location << 31); - //a4 low bits = ret.limit = ((offset + size - 1) / 0x10000) << 16 | (location << 31); - //a5 high bits = ret.pitch = (pitch / 0x100) << 8; - //a5 low bits = ret.format = base | ((base + ((size - 1) / 0x10000)) << 13) | (comp << 26) | (1 << 30); + // a4 high bits = ret.tile = (location + 1) | (bank << 4) | ((offset / 0x10000) << 16) | (location << 31); + // a4 low bits = ret.limit = ((offset + size - 1) / 0x10000) << 16 | (location << 31); + // a5 high bits = ret.pitch = (pitch / 0x100) << 8; + // a5 low bits = ret.format = base | ((base + ((size - 1) / 0x10000)) << 13) | (comp << 26) | (1 << 30); ensure(a3 < std::size(render->tiles)); @@ -713,7 +714,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 const u32 pitch = (((a5 >> 32) & 0xFFFFFFFF) >> 8) * 0x100; const u32 comp = ((a5 & 0xFFFFFFFF) >> 26) & 0xF; const u32 base = (a5 & 0xFFFFFFFF) & 0x7FF; - //const u32 bank = (((a4 >> 32) & 0xFFFFFFFF) >> 4) & 0xF; + // const u32 bank = (((a4 >> 32) & 0xFFFFFFFF) >> 4) & 0xF; const bool bound = ((a4 >> 32) & 0x3) != 0; const auto range = utils::address_range::start_length(offset, size); @@ -722,7 +723,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 { if (!size || !pitch) { - return { CELL_EINVAL, "size or pitch are 0 (size=%d, pitch=%d)", size, pitch }; + return {CELL_EINVAL, "size or pitch are 0 (size=%d, pitch=%d)", size, pitch}; } u32 limit = -1; @@ -736,7 +737,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 if (!range.valid() || range.end >= limit) { - return { CELL_EINVAL, "range invalid (valid=%d, end=%d, limit=%d)", range.valid(), range.end, limit }; + return {CELL_EINVAL, "range invalid (valid=%d, end=%d, limit=%d)", range.valid(), range.end, limit}; } // Hardcoded value in gcm @@ -758,7 +759,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 { if (render->iomap_table.ea[io] == umax) { - return { CELL_EINVAL, "iomap_table ea is umax" }; + return {CELL_EINVAL, "iomap_table ea is umax"}; } } } @@ -775,12 +776,12 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 } case 0x301: // Depth-buffer (Z-cull) { - //a4 high = region = (1 << 0) | (zFormat << 4) | (aaFormat << 8); - //a4 low = size = ((width >> 6) << 22) | ((height >> 6) << 6); - //a5 high = start = cullStart&(~0xFFF); - //a5 low = offset = offset; - //a6 high = status0 = (zcullDir << 1) | (zcullFormat << 2) | ((sFunc & 0xF) << 12) | (sRef << 16) | (sMask << 24); - //a6 low = status1 = (0x2000 << 0) | (0x20 << 16); + // a4 high = region = (1 << 0) | (zFormat << 4) | (aaFormat << 8); + // a4 low = size = ((width >> 6) << 22) | ((height >> 6) << 6); + // a5 high = start = cullStart&(~0xFFF); + // a5 low = offset = offset; + // a6 high = status0 = (zcullDir << 1) | (zcullFormat << 2) | ((sFunc & 0xF) << 12) | (sRef << 16) | (sMask << 24); + // a6 low = status1 = (0x2000 << 0) | (0x20 << 16); if (a3 >= std::size(render->zculls)) { @@ -806,7 +807,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 // width and height are not allowed to be zero (checked by range.valid()) if (!cull_range.valid() || cull_range.end >= 3u << 20 || offset >= render->local_mem_size) { - return { CELL_EINVAL, "cull_range invalid (valid=%d, end=%d, offset=%d, local_mem_size=%d)", cull_range.valid(), cull_range.end, offset, render->local_mem_size }; + return {CELL_EINVAL, "cull_range invalid (valid=%d, end=%d, offset=%d, local_mem_size=%d)", cull_range.valid(), cull_range.end, offset, render->local_mem_size}; } if (a5 & 0xF0000000) @@ -821,7 +822,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 std::lock_guard lock(render->sys_rsx_mtx); - auto &zcull = render->zculls[a3]; + auto& zcull = render->zculls[a3]; zcull.zFormat = ((a4 >> 32) >> 4) & 0xF; zcull.aaFormat = ((a4 >> 32) >> 8) & 0xF; @@ -872,7 +873,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 if (cpu_thread::get_current()) { // VBLANK/RSX thread only - return { CELL_EINVAL, "wrong thread" }; + return {CELL_EINVAL, "wrong thread"}; } // NOTE: There currently seem to only be 2 active heads on PS3 @@ -880,15 +881,14 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 // todo: this is wrong and should be 'second' vblank handler and freq, but since currently everything is reported as being 59.94, this should be fine driverInfo.head[a3].lastSecondVTime.atomic_op([&](be_t& time) - { - a4 = std::max(a4, time + 1); - time = a4; - }); + { + a4 = std::max(a4, time + 1); + time = a4; + }); // Time point is supplied in argument 4 (todo: convert it to MFTB rate and use it) const u64 current_time = rsx_timeStamp(); - // Note: not atomic driverInfo.head[a3].lastVTimeLow = static_cast(current_time); driverInfo.head[a3].lastVTimeHigh = static_cast(current_time >> 32); @@ -915,7 +915,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 } default: - return { CELL_EINVAL, "unsupported package id %d", package_id }; + return {CELL_EINVAL, "unsupported package id %d", package_id}; } return CELL_OK; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsx.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsx.h index 5188453c5..1e626c763 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsx.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsx.h @@ -7,53 +7,53 @@ class cpu_thread; struct RsxDriverInfo { - be_t version_driver; // 0x0 - be_t version_gpu; // 0x4 - be_t memory_size; // 0x8 - be_t hardware_channel; // 0xC - be_t nvcore_frequency; // 0x10 - be_t memory_frequency; // 0x14 - be_t unk1[4]; // 0x18 - 0x24 - be_t unk2; // 0x28 -- pgraph stuff - be_t reportsNotifyOffset;// 0x2C offset to notify memory - be_t reportsOffset; // 0x30 offset to reports memory - be_t reportsReportOffset;// 0x34 offset to reports in reports memory - be_t unk3[6]; // 0x38-0x54 - be_t systemModeFlags; // 0x54 - u8 unk4[0x1064]; // 0x10B8 + be_t version_driver; // 0x0 + be_t version_gpu; // 0x4 + be_t memory_size; // 0x8 + be_t hardware_channel; // 0xC + be_t nvcore_frequency; // 0x10 + be_t memory_frequency; // 0x14 + be_t unk1[4]; // 0x18 - 0x24 + be_t unk2; // 0x28 -- pgraph stuff + be_t reportsNotifyOffset; // 0x2C offset to notify memory + be_t reportsOffset; // 0x30 offset to reports memory + be_t reportsReportOffset; // 0x34 offset to reports in reports memory + be_t unk3[6]; // 0x38-0x54 + be_t systemModeFlags; // 0x54 + u8 unk4[0x1064]; // 0x10B8 struct Head { - be_t lastFlipTime; // 0x0 last flip time - atomic_be_t flipFlags; // 0x8 flags to handle flip/queue - be_t offset; // 0xC - be_t flipBufferId; // 0x10 - be_t lastQueuedBufferId; // 0x14 todo: this is definately not this variable but its 'unused' so im using it for queueId to pass to flip handler - be_t unk3; // 0x18 - be_t lastVTimeLow; // 0x1C last time for first vhandler freq (low 32-bits) + be_t lastFlipTime; // 0x0 last flip time + atomic_be_t flipFlags; // 0x8 flags to handle flip/queue + be_t offset; // 0xC + be_t flipBufferId; // 0x10 + be_t lastQueuedBufferId; // 0x14 todo: this is definately not this variable but its 'unused' so im using it for queueId to pass to flip handler + be_t unk3; // 0x18 + be_t lastVTimeLow; // 0x1C last time for first vhandler freq (low 32-bits) atomic_be_t lastSecondVTime; // 0x20 last time for second vhandler freq - be_t unk4; // 0x28 - atomic_be_t vBlankCount; // 0x30 - be_t unk; // 0x38 possible u32, 'flip field', top/bottom for interlaced - be_t lastVTimeHigh; // 0x3C last time for first vhandler freq (high 32-bits) - } head[8]; // size = 0x40, 0x200 + be_t unk4; // 0x28 + atomic_be_t vBlankCount; // 0x30 + be_t unk; // 0x38 possible u32, 'flip field', top/bottom for interlaced + be_t lastVTimeHigh; // 0x3C last time for first vhandler freq (high 32-bits) + } head[8]; // size = 0x40, 0x200 - be_t unk7; // 0x12B8 - be_t unk8; // 0x12BC + be_t unk7; // 0x12B8 + be_t unk8; // 0x12BC atomic_be_t handlers; // 0x12C0 -- flags showing which handlers are set - be_t unk9; // 0x12C4 - be_t unk10; // 0x12C8 - be_t userCmdParam; // 0x12CC - be_t handler_queue; // 0x12D0 - be_t unk11; // 0x12D4 - be_t unk12; // 0x12D8 - be_t unk13; // 0x12DC - be_t unk14; // 0x12E0 - be_t unk15; // 0x12E4 - be_t unk16; // 0x12E8 - be_t unk17; // 0x12F0 - be_t lastError; // 0x12F4 error param for cellGcmSetGraphicsHandler - // todo: theres more to this + be_t unk9; // 0x12C4 + be_t unk10; // 0x12C8 + be_t userCmdParam; // 0x12CC + be_t handler_queue; // 0x12D0 + be_t unk11; // 0x12D4 + be_t unk12; // 0x12D8 + be_t unk13; // 0x12DC + be_t unk14; // 0x12E0 + be_t unk15; // 0x12E4 + be_t unk16; // 0x12E8 + be_t unk17; // 0x12F0 + be_t lastError; // 0x12F4 error param for cellGcmSetGraphicsHandler + // todo: theres more to this }; static_assert(sizeof(RsxDriverInfo) == 0x12F8, "rsxSizeTest"); @@ -68,7 +68,7 @@ enum : u64 // Unofficial event names enum : u64 { - //SYS_RSX_EVENT_GRAPHICS_ERROR = 1 << 0, + // SYS_RSX_EVENT_GRAPHICS_ERROR = 1 << 0, SYS_RSX_EVENT_VBLANK = 1 << 1, SYS_RSX_EVENT_FLIP_BASE = 1 << 3, SYS_RSX_EVENT_QUEUE_BASE = 1 << 5, diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp index 9fa3a890a..cb462684b 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp @@ -29,17 +29,17 @@ namespace rsxaudio_ringbuf_reader { static constexpr void clean_buf(rsxaudio_shmem::ringbuf_t& ring_buf) { - ring_buf.unk2 = 100; - ring_buf.read_idx = 0; - ring_buf.write_idx = 0; + ring_buf.unk2 = 100; + ring_buf.read_idx = 0; + ring_buf.write_idx = 0; ring_buf.queue_notify_idx = 0; - ring_buf.next_blk_idx = 0; + ring_buf.next_blk_idx = 0; for (auto& ring_entry : ring_buf.entries) { - ring_entry.valid = 0; + ring_entry.valid = 0; ring_entry.audio_blk_idx = 0; - ring_entry.timestamp = 0; + ring_entry.timestamp = 0; } } @@ -65,7 +65,7 @@ namespace rsxaudio_ringbuf_reader ring_buf.entries[read_idx].valid = 0; ring_buf.queue_notify_idx = (ring_buf.queue_notify_idx + 1) % ring_buf.queue_notify_step; - ring_buf.read_idx = (ring_buf.read_idx + 1) % ring_buf.rw_max_idx; + ring_buf.read_idx = (ring_buf.read_idx + 1) % ring_buf.rw_max_idx; return std::make_tuple(((ring_buf.rw_max_idx > 2) ^ ring_buf.queue_notify_idx) == 0, ring_buf.entries[entry_idx].audio_blk_idx, ring_buf.entries[entry_idx].timestamp); } @@ -104,11 +104,10 @@ namespace rsxaudio_ringbuf_reader return std::nullopt; } -} +} // namespace rsxaudio_ringbuf_reader lv2_rsxaudio::lv2_rsxaudio(utils::serial& ar) noexcept - : lv2_obj{1} - , init(ar) + : lv2_obj{1}, init(ar) { if (init) { @@ -183,12 +182,12 @@ error_code sys_rsxaudio_initialize(vm::ptr handle) for (auto& uf : sh_page->ctrl.channel_uf) { uf.uf_event_cnt = 0; - uf.unk1 = 0; + uf.unk1 = 0; } - sh_page->ctrl.unk4 = 0x8000; + sh_page->ctrl.unk4 = 0x8000; sh_page->ctrl.intr_thread_prio = 0xDEADBEEF; - sh_page->ctrl.unk5 = 0; + sh_page->ctrl.unk5 = 0; rsxaudio_obj->init = true; *handle = id; @@ -332,12 +331,12 @@ error_code sys_rsxaudio_create_connection(u32 handle) for (auto& rb : sh_page->ctrl.ringbuf) { rb.dma_silence_addr = rsxaudio_obj->dma_io_base + offsetof(rsxaudio_shmem, dma_silence_region); - rb.unk2 = 100; + rb.unk2 = 100; } for (u32 entry_idx = 0; entry_idx < SYS_RSXAUDIO_RINGBUF_SZ; entry_idx++) { - sh_page->ctrl.ringbuf[static_cast(RsxaudioPort::SERIAL)].entries[entry_idx].dma_addr = rsxaudio_obj->dma_io_base + u32{offsetof(rsxaudio_shmem, dma_serial_region)} + SYS_RSXAUDIO_RINGBUF_BLK_SZ_SERIAL * entry_idx; + sh_page->ctrl.ringbuf[static_cast(RsxaudioPort::SERIAL)].entries[entry_idx].dma_addr = rsxaudio_obj->dma_io_base + u32{offsetof(rsxaudio_shmem, dma_serial_region)} + SYS_RSXAUDIO_RINGBUF_BLK_SZ_SERIAL * entry_idx; sh_page->ctrl.ringbuf[static_cast(RsxaudioPort::SPDIF_0)].entries[entry_idx].dma_addr = rsxaudio_obj->dma_io_base + u32{offsetof(rsxaudio_shmem, dma_spdif_0_region)} + SYS_RSXAUDIO_RINGBUF_BLK_SZ_SPDIF * entry_idx; sh_page->ctrl.ringbuf[static_cast(RsxaudioPort::SPDIF_1)].entries[entry_idx].dma_addr = rsxaudio_obj->dma_io_base + u32{offsetof(rsxaudio_shmem, dma_spdif_1_region)} + SYS_RSXAUDIO_RINGBUF_BLK_SZ_SPDIF * entry_idx; } @@ -430,22 +429,26 @@ error_code sys_rsxaudio_start_process(u32 handle) for (auto& rb : sh_page->ctrl.ringbuf) { - if (rb.active) rsxaudio_ringbuf_reader::clean_buf(rb); + if (rb.active) + rsxaudio_ringbuf_reader::clean_buf(rb); } for (auto& uf : sh_page->ctrl.channel_uf) { uf.uf_event_cnt = 0; - uf.unk1 = 0; + uf.unk1 = 0; } auto& rsxaudio_thread = g_fxo->get(); rsxaudio_thread.update_hw_param([&](auto& param) - { - if (sh_page->ctrl.ringbuf[static_cast(RsxaudioPort::SERIAL)].active) param.serial.dma_en = true; - if (sh_page->ctrl.ringbuf[static_cast(RsxaudioPort::SPDIF_0)].active) param.spdif[0].dma_en = true; - if (sh_page->ctrl.ringbuf[static_cast(RsxaudioPort::SPDIF_1)].active) param.spdif[1].dma_en = true; - }); + { + if (sh_page->ctrl.ringbuf[static_cast(RsxaudioPort::SERIAL)].active) + param.serial.dma_en = true; + if (sh_page->ctrl.ringbuf[static_cast(RsxaudioPort::SPDIF_0)].active) + param.spdif[0].dma_en = true; + if (sh_page->ctrl.ringbuf[static_cast(RsxaudioPort::SPDIF_1)].active) + param.spdif[1].dma_en = true; + }); for (u32 q_idx = 0; q_idx < SYS_RSXAUDIO_PORT_CNT; q_idx++) { @@ -479,28 +482,29 @@ error_code sys_rsxaudio_stop_process(u32 handle) auto& rsxaudio_thread = g_fxo->get(); rsxaudio_thread.update_hw_param([&](auto& param) - { - param.serial.dma_en = false; - param.serial.muted = true; - param.serial.en = false; - - for (auto& spdif : param.spdif) { - spdif.dma_en = false; - if (!spdif.use_serial_buf) - { - spdif.en = false; - } - } + param.serial.dma_en = false; + param.serial.muted = true; + param.serial.en = false; - param.spdif[1].muted = true; - }); + for (auto& spdif : param.spdif) + { + spdif.dma_en = false; + if (!spdif.use_serial_buf) + { + spdif.en = false; + } + } + + param.spdif[1].muted = true; + }); rsxaudio_shmem* sh_page = rsxaudio_obj->get_rw_shared_page(); for (auto& rb : sh_page->ctrl.ringbuf) { - if (rb.active) rsxaudio_ringbuf_reader::clean_buf(rb); + if (rb.active) + rsxaudio_ringbuf_reader::clean_buf(rb); } return CELL_OK; @@ -778,7 +782,10 @@ void rsxaudio_data_thread::operator()() while (thread_ctrl::state() != thread_state::aborting) { - static const std::function tmr_callback = [this]() { extract_audio_data(); }; + static const std::function tmr_callback = [this]() + { + extract_audio_data(); + }; switch (timer.wait(tmr_callback)) { @@ -838,8 +845,8 @@ void rsxaudio_data_thread::extract_audio_data() } rsxaudio_shmem* sh_page = rsxaudio_obj->get_rw_shared_page(); - const auto hw_cfg = hw_param_ts.get_current(); - const u64 crnt_time = get_system_time(); + const auto hw_cfg = hw_param_ts.get_current(); + const u64 crnt_time = get_system_time(); auto process_rb = [&](RsxaudioPort dst, bool dma_en) { @@ -911,22 +918,22 @@ std::pair rsxaudio_data_thread::get_ringbuf_addr(RsxaudioPort dst, void rsxaudio_data_thread::reset_hw() { update_hw_param([&](rsxaudio_hw_param_t& current) - { - const bool serial_dma_en = current.serial.dma_en; - current.serial = {}; - current.serial.dma_en = serial_dma_en; - - for (auto& spdif : current.spdif) { - const bool spdif_dma_en = spdif.dma_en; - spdif = {}; - spdif.dma_en = spdif_dma_en; - } + const bool serial_dma_en = current.serial.dma_en; + current.serial = {}; + current.serial.dma_en = serial_dma_en; - current.serial_freq_base = SYS_RSXAUDIO_FREQ_BASE_384K; - current.spdif_freq_base = SYS_RSXAUDIO_FREQ_BASE_352K; - current.avport_src.fill(RsxaudioPort::INVALID); - }); + for (auto& spdif : current.spdif) + { + const bool spdif_dma_en = spdif.dma_en; + spdif = {}; + spdif.dma_en = spdif_dma_en; + } + + current.serial_freq_base = SYS_RSXAUDIO_FREQ_BASE_384K; + current.spdif_freq_base = SYS_RSXAUDIO_FREQ_BASE_352K; + current.avport_src.fill(RsxaudioPort::INVALID); + }); } void rsxaudio_data_thread::update_hw_param(std::function update_callback) @@ -934,168 +941,167 @@ void rsxaudio_data_thread::update_hw_param(std::function(*hw_param_ts.get_current()); - - update_callback(*new_hw_param); - - const bool serial_active = calc_port_active_state(RsxaudioPort::SERIAL, *new_hw_param); - const bool spdif_active[SYS_RSXAUDIO_SPDIF_CNT] = { - calc_port_active_state(RsxaudioPort::SPDIF_0, *new_hw_param), - calc_port_active_state(RsxaudioPort::SPDIF_1, *new_hw_param) - }; + auto new_hw_param = std::make_shared(*hw_param_ts.get_current()); - std::array port_cfg{}; - port_cfg[static_cast(RsxaudioAvportIdx::AVMULTI)] = {static_cast(new_hw_param->serial_freq_base / new_hw_param->serial.freq_div), AudioChannelCnt::STEREO}; + update_callback(*new_hw_param); - auto gen_spdif_port_cfg = [&](u8 spdif_idx) - { - if (new_hw_param->spdif[spdif_idx].use_serial_buf) - { - return port_cfg[static_cast(RsxaudioAvportIdx::AVMULTI)]; - } - - return rsxaudio_backend_thread::port_config{static_cast(new_hw_param->spdif_freq_base / new_hw_param->spdif[spdif_idx].freq_div), AudioChannelCnt::STEREO}; - }; - - port_cfg[static_cast(RsxaudioAvportIdx::SPDIF_0)] = gen_spdif_port_cfg(0); - port_cfg[static_cast(RsxaudioAvportIdx::SPDIF_1)] = gen_spdif_port_cfg(1); - - auto gen_hdmi_port_cfg = [&](u8 hdmi_idx) - { - if (new_hw_param->hdmi[hdmi_idx].use_spdif_1) - { - return rsxaudio_backend_thread::port_config{port_cfg[static_cast(RsxaudioAvportIdx::SPDIF_1)].freq, new_hw_param->hdmi[hdmi_idx].ch_cfg.total_ch_cnt}; - } - - return rsxaudio_backend_thread::port_config{port_cfg[static_cast(RsxaudioAvportIdx::AVMULTI)].freq, new_hw_param->hdmi[hdmi_idx].ch_cfg.total_ch_cnt}; - }; - - port_cfg[static_cast(RsxaudioAvportIdx::HDMI_0)] = gen_hdmi_port_cfg(0); - port_cfg[static_cast(RsxaudioAvportIdx::HDMI_1)] = gen_hdmi_port_cfg(1); - // TODO: ideally, old data must be flushed from backend buffers if channel became inactive or its src changed - g_fxo->get().set_new_stream_param(port_cfg, calc_avport_mute_state(*new_hw_param)); - - timer.vtimer_access_sec([&]() - { - const u64 crnt_time = get_system_time(); - - if (serial_active) - { - // 2 channels per stream, streams go in parallel - const u32 new_timer_rate = static_cast(port_cfg[static_cast(RsxaudioAvportIdx::AVMULTI)].freq) * - static_cast(new_hw_param->serial.depth) * - SYS_RSXAUDIO_CH_PER_STREAM; - - timer.enable_vtimer(static_cast(RsxaudioPort::SERIAL), new_timer_rate, crnt_time); - } - else - { - timer.disable_vtimer(static_cast(RsxaudioPort::SERIAL)); - } - - for (u8 spdif_idx = 0; spdif_idx < SYS_RSXAUDIO_SPDIF_CNT; spdif_idx++) - { - const u32 vtimer_id = static_cast(RsxaudioPort::SPDIF_0) + spdif_idx; - - if (spdif_active[spdif_idx] && !new_hw_param->spdif[spdif_idx].use_serial_buf) + const bool serial_active = calc_port_active_state(RsxaudioPort::SERIAL, *new_hw_param); + const bool spdif_active[SYS_RSXAUDIO_SPDIF_CNT] = { - // 2 channels per stream, single stream - const u32 new_timer_rate = static_cast(port_cfg[static_cast(RsxaudioAvportIdx::SPDIF_0) + spdif_idx].freq) * - static_cast(new_hw_param->spdif[spdif_idx].depth) * - SYS_RSXAUDIO_CH_PER_STREAM; + calc_port_active_state(RsxaudioPort::SPDIF_0, *new_hw_param), + calc_port_active_state(RsxaudioPort::SPDIF_1, *new_hw_param)}; - timer.enable_vtimer(vtimer_id, new_timer_rate, crnt_time); - } - else + std::array port_cfg{}; + port_cfg[static_cast(RsxaudioAvportIdx::AVMULTI)] = {static_cast(new_hw_param->serial_freq_base / new_hw_param->serial.freq_div), AudioChannelCnt::STEREO}; + + auto gen_spdif_port_cfg = [&](u8 spdif_idx) + { + if (new_hw_param->spdif[spdif_idx].use_serial_buf) { - timer.disable_vtimer(vtimer_id); + return port_cfg[static_cast(RsxaudioAvportIdx::AVMULTI)]; } - } + + return rsxaudio_backend_thread::port_config{static_cast(new_hw_param->spdif_freq_base / new_hw_param->spdif[spdif_idx].freq_div), AudioChannelCnt::STEREO}; + }; + + port_cfg[static_cast(RsxaudioAvportIdx::SPDIF_0)] = gen_spdif_port_cfg(0); + port_cfg[static_cast(RsxaudioAvportIdx::SPDIF_1)] = gen_spdif_port_cfg(1); + + auto gen_hdmi_port_cfg = [&](u8 hdmi_idx) + { + if (new_hw_param->hdmi[hdmi_idx].use_spdif_1) + { + return rsxaudio_backend_thread::port_config{port_cfg[static_cast(RsxaudioAvportIdx::SPDIF_1)].freq, new_hw_param->hdmi[hdmi_idx].ch_cfg.total_ch_cnt}; + } + + return rsxaudio_backend_thread::port_config{port_cfg[static_cast(RsxaudioAvportIdx::AVMULTI)].freq, new_hw_param->hdmi[hdmi_idx].ch_cfg.total_ch_cnt}; + }; + + port_cfg[static_cast(RsxaudioAvportIdx::HDMI_0)] = gen_hdmi_port_cfg(0); + port_cfg[static_cast(RsxaudioAvportIdx::HDMI_1)] = gen_hdmi_port_cfg(1); + // TODO: ideally, old data must be flushed from backend buffers if channel became inactive or its src changed + g_fxo->get().set_new_stream_param(port_cfg, calc_avport_mute_state(*new_hw_param)); + + timer.vtimer_access_sec([&]() + { + const u64 crnt_time = get_system_time(); + + if (serial_active) + { + // 2 channels per stream, streams go in parallel + const u32 new_timer_rate = static_cast(port_cfg[static_cast(RsxaudioAvportIdx::AVMULTI)].freq) * + static_cast(new_hw_param->serial.depth) * + SYS_RSXAUDIO_CH_PER_STREAM; + + timer.enable_vtimer(static_cast(RsxaudioPort::SERIAL), new_timer_rate, crnt_time); + } + else + { + timer.disable_vtimer(static_cast(RsxaudioPort::SERIAL)); + } + + for (u8 spdif_idx = 0; spdif_idx < SYS_RSXAUDIO_SPDIF_CNT; spdif_idx++) + { + const u32 vtimer_id = static_cast(RsxaudioPort::SPDIF_0) + spdif_idx; + + if (spdif_active[spdif_idx] && !new_hw_param->spdif[spdif_idx].use_serial_buf) + { + // 2 channels per stream, single stream + const u32 new_timer_rate = static_cast(port_cfg[static_cast(RsxaudioAvportIdx::SPDIF_0) + spdif_idx].freq) * + static_cast(new_hw_param->spdif[spdif_idx].depth) * + SYS_RSXAUDIO_CH_PER_STREAM; + + timer.enable_vtimer(vtimer_id, new_timer_rate, crnt_time); + } + else + { + timer.disable_vtimer(vtimer_id); + } + } + }); + + return new_hw_param; }); - - return new_hw_param; - }); } void rsxaudio_data_thread::update_mute_state(RsxaudioPort port, bool muted) { hw_param_ts.add_op([&]() - { - auto new_hw_param = std::make_shared(*hw_param_ts.get_current()); + { + auto new_hw_param = std::make_shared(*hw_param_ts.get_current()); - switch (port) - { - case RsxaudioPort::SERIAL: - { - new_hw_param->serial.muted = muted; - break; - } - case RsxaudioPort::SPDIF_0: - { - new_hw_param->spdif[0].muted = muted; - break; - } - case RsxaudioPort::SPDIF_1: - { - new_hw_param->spdif[1].muted = muted; - break; - } - default: - { - fmt::throw_exception("Invalid RSXAudio port: %u", static_cast(port)); - } - } + switch (port) + { + case RsxaudioPort::SERIAL: + { + new_hw_param->serial.muted = muted; + break; + } + case RsxaudioPort::SPDIF_0: + { + new_hw_param->spdif[0].muted = muted; + break; + } + case RsxaudioPort::SPDIF_1: + { + new_hw_param->spdif[1].muted = muted; + break; + } + default: + { + fmt::throw_exception("Invalid RSXAudio port: %u", static_cast(port)); + } + } - g_fxo->get().set_mute_state(calc_avport_mute_state(*new_hw_param)); + g_fxo->get().set_mute_state(calc_avport_mute_state(*new_hw_param)); - return new_hw_param; - }); + return new_hw_param; + }); } void rsxaudio_data_thread::update_av_mute_state(RsxaudioAvportIdx avport, bool muted, bool force_mute, bool set) { hw_param_ts.add_op([&]() - { - auto new_hw_param = std::make_shared(*hw_param_ts.get_current()); - - switch (avport) { - case RsxaudioAvportIdx::HDMI_0: - case RsxaudioAvportIdx::HDMI_1: - { - const u32 hdmi_idx = avport == RsxaudioAvportIdx::HDMI_1; + auto new_hw_param = std::make_shared(*hw_param_ts.get_current()); - if (muted) + switch (avport) { - new_hw_param->hdmi[hdmi_idx].muted = set; + case RsxaudioAvportIdx::HDMI_0: + case RsxaudioAvportIdx::HDMI_1: + { + const u32 hdmi_idx = avport == RsxaudioAvportIdx::HDMI_1; + + if (muted) + { + new_hw_param->hdmi[hdmi_idx].muted = set; + } + + if (force_mute) + { + new_hw_param->hdmi[hdmi_idx].force_mute = set; + } + break; + } + case RsxaudioAvportIdx::AVMULTI: + { + if (muted) + { + new_hw_param->avmulti_av_muted = set; + } + break; + } + default: + { + fmt::throw_exception("Invalid RSXAudio avport: %u", static_cast(avport)); + } } - if (force_mute) - { - new_hw_param->hdmi[hdmi_idx].force_mute = set; - } - break; - } - case RsxaudioAvportIdx::AVMULTI: - { - if (muted) - { - new_hw_param->avmulti_av_muted = set; - } - break; - } - default: - { - fmt::throw_exception("Invalid RSXAudio avport: %u", static_cast(avport)); - } - } + g_fxo->get().set_mute_state(calc_avport_mute_state(*new_hw_param)); - g_fxo->get().set_mute_state(calc_avport_mute_state(*new_hw_param)); - - return new_hw_param; - }); + return new_hw_param; + }); } rsxaudio_backend_thread::avport_bit rsxaudio_data_thread::calc_avport_mute_state(const rsxaudio_hw_param_t& hwp) @@ -1103,10 +1109,9 @@ rsxaudio_backend_thread::avport_bit rsxaudio_data_thread::calc_avport_mute_state const bool serial_active = calc_port_active_state(RsxaudioPort::SERIAL, hwp); const bool spdif_active[SYS_RSXAUDIO_SPDIF_CNT] = - { - calc_port_active_state(RsxaudioPort::SPDIF_0, hwp), - calc_port_active_state(RsxaudioPort::SPDIF_1, hwp) - }; + { + calc_port_active_state(RsxaudioPort::SPDIF_0, hwp), + calc_port_active_state(RsxaudioPort::SPDIF_1, hwp)}; const bool avmulti = !serial_active || hwp.serial.muted || hwp.avmulti_av_muted; @@ -1123,7 +1128,7 @@ rsxaudio_backend_thread::avport_bit rsxaudio_data_thread::calc_avport_mute_state return !spdif_active[spdif_port] || hwp.spdif[spdif_port].muted; }; - auto hdmi_muted = [&](u8 hdmi_idx) + auto hdmi_muted = [&](u8 hdmi_idx) { const u8 hdmi_port = hdmi_idx == 1; @@ -1135,7 +1140,7 @@ rsxaudio_backend_thread::avport_bit rsxaudio_data_thread::calc_avport_mute_state return !serial_active || hwp.serial.muted || hwp.hdmi[hdmi_port].muted || hwp.hdmi[hdmi_port].force_mute || !hwp.hdmi[hdmi_port].init; }; - return { hdmi_muted(0), hdmi_muted(1), avmulti, spdif_muted(0), spdif_muted(1) }; + return {hdmi_muted(0), hdmi_muted(1), avmulti, spdif_muted(0), spdif_muted(1)}; } bool rsxaudio_data_thread::calc_port_active_state(RsxaudioPort port, const rsxaudio_hw_param_t& hwp) @@ -1301,7 +1306,7 @@ namespace audio g_fxo->get().update_emu_cfg(); } } -} +} // namespace audio rsxaudio_backend_thread::rsxaudio_backend_thread() { @@ -1310,10 +1315,10 @@ rsxaudio_backend_thread::rsxaudio_backend_thread() const f32 new_vol = audio::get_volume(); callback_cfg.atomic_op([&](callback_config& val) - { - val.target_volume = static_cast(new_vol * callback_config::VOL_NOMINAL); - val.initial_volume = val.current_volume; - }); + { + val.target_volume = static_cast(new_vol * callback_config::VOL_NOMINAL); + val.initial_volume = val.current_volume; + }); } rsxaudio_backend_thread::~rsxaudio_backend_thread() @@ -1334,10 +1339,10 @@ void rsxaudio_backend_thread::update_emu_cfg() const f32 new_vol = audio::get_volume(); callback_cfg.atomic_op([&](callback_config& val) - { - val.target_volume = static_cast(new_vol * callback_config::VOL_NOMINAL); - val.initial_volume = val.current_volume; - }); + { + val.target_volume = static_cast(new_vol * callback_config::VOL_NOMINAL); + val.initial_volume = val.current_volume; + }); if (new_emu_cfg != _new_emu_cfg) { @@ -1364,20 +1369,19 @@ rsxaudio_backend_thread::emu_audio_cfg rsxaudio_backend_thread::get_emu_cfg() AudioChannelCnt out_ch_cnt = AudioBackend::get_max_channel_count(0); // CELL_AUDIO_OUT_PRIMARY emu_audio_cfg cfg = - { - .audio_device = g_cfg.audio.audio_device, - .desired_buffer_duration = g_cfg.audio.desired_buffer_duration, - .time_stretching_threshold = g_cfg.audio.time_stretching_threshold / 100.0, - .buffering_enabled = static_cast(g_cfg.audio.enable_buffering), - .convert_to_s16 = static_cast(g_cfg.audio.convert_to_s16), - .enable_time_stretching = static_cast(g_cfg.audio.enable_time_stretching), - .dump_to_file = static_cast(g_cfg.audio.dump_to_file), - .channels = out_ch_cnt, - .channel_layout = g_cfg.audio.channel_layout, - .renderer = g_cfg.audio.renderer, - .provider = g_cfg.audio.provider, - .avport = convert_avport(g_cfg.audio.rsxaudio_port) - }; + { + .audio_device = g_cfg.audio.audio_device, + .desired_buffer_duration = g_cfg.audio.desired_buffer_duration, + .time_stretching_threshold = g_cfg.audio.time_stretching_threshold / 100.0, + .buffering_enabled = static_cast(g_cfg.audio.enable_buffering), + .convert_to_s16 = static_cast(g_cfg.audio.convert_to_s16), + .enable_time_stretching = static_cast(g_cfg.audio.enable_time_stretching), + .dump_to_file = static_cast(g_cfg.audio.dump_to_file), + .channels = out_ch_cnt, + .channel_layout = g_cfg.audio.channel_layout, + .renderer = g_cfg.audio.renderer, + .provider = g_cfg.audio.provider, + .avport = convert_avport(g_cfg.audio.rsxaudio_port)}; cfg.buffering_enabled = cfg.buffering_enabled && cfg.renderer != audio_renderer::null; cfg.enable_time_stretching = cfg.buffering_enabled && cfg.enable_time_stretching && cfg.time_stretching_threshold > 0.0; @@ -1435,9 +1439,9 @@ void rsxaudio_backend_thread::operator()() should_update_backend = true; checkDefaultDevice = false; callback_cfg.atomic_op([&](callback_config& val) - { - val.cfg_changed = false; // Acknowledge cfg update - }); + { + val.cfg_changed = false; // Acknowledge cfg update + }); } } @@ -1612,7 +1616,7 @@ rsxaudio_backend_thread& rsxaudio_backend_thread::operator=(thread_state /* stat return *this; } -void rsxaudio_backend_thread::set_new_stream_param(const std::array &cfg, avport_bit muted_avports) +void rsxaudio_backend_thread::set_new_stream_param(const std::array& cfg, avport_bit muted_avports) { std::unique_lock lock(state_update_m); @@ -1620,15 +1624,15 @@ void rsxaudio_backend_thread::set_new_stream_param(const std::array(backend_current_cfg.avport)]; callback_cfg.atomic_op([&](callback_config& val) - { - val.mute_state = new_mute_state; - - if (should_update) { - val.ready = false; // Prevent audio playback until backend is reconfigured - val.cfg_changed = true; - } - }); + val.mute_state = new_mute_state; + + if (should_update) + { + val.ready = false; // Prevent audio playback until backend is reconfigured + val.cfg_changed = true; + } + }); if (new_ra_state.port != cfg) { @@ -1644,20 +1648,25 @@ void rsxaudio_backend_thread::set_mute_state(avport_bit muted_avports) const auto new_mute_state = gen_mute_state(muted_avports); callback_cfg.atomic_op([&](callback_config& val) - { - val.mute_state = new_mute_state; - }); + { + val.mute_state = new_mute_state; + }); } u8 rsxaudio_backend_thread::gen_mute_state(avport_bit avports) { std::bitset mute_state{0}; - if (avports.hdmi_0) mute_state[static_cast(RsxaudioAvportIdx::HDMI_0)] = true; - if (avports.hdmi_1) mute_state[static_cast(RsxaudioAvportIdx::HDMI_1)] = true; - if (avports.avmulti) mute_state[static_cast(RsxaudioAvportIdx::AVMULTI)] = true; - if (avports.spdif_0) mute_state[static_cast(RsxaudioAvportIdx::SPDIF_0)] = true; - if (avports.spdif_1) mute_state[static_cast(RsxaudioAvportIdx::SPDIF_1)] = true; + if (avports.hdmi_0) + mute_state[static_cast(RsxaudioAvportIdx::HDMI_0)] = true; + if (avports.hdmi_1) + mute_state[static_cast(RsxaudioAvportIdx::HDMI_1)] = true; + if (avports.avmulti) + mute_state[static_cast(RsxaudioAvportIdx::AVMULTI)] = true; + if (avports.spdif_0) + mute_state[static_cast(RsxaudioAvportIdx::SPDIF_0)] = true; + if (avports.spdif_1) + mute_state[static_cast(RsxaudioAvportIdx::SPDIF_1)] = true; return static_cast(mute_state.to_ulong()); } @@ -1703,8 +1712,8 @@ RsxaudioAvportIdx rsxaudio_backend_thread::convert_avport(audio_avport avport) { switch (avport) { - case audio_avport::hdmi_0: return RsxaudioAvportIdx::HDMI_0; - case audio_avport::hdmi_1: return RsxaudioAvportIdx::HDMI_1; + case audio_avport::hdmi_0: return RsxaudioAvportIdx::HDMI_0; + case audio_avport::hdmi_1: return RsxaudioAvportIdx::HDMI_1; case audio_avport::avmulti: return RsxaudioAvportIdx::AVMULTI; case audio_avport::spdif_0: return RsxaudioAvportIdx::SPDIF_0; case audio_avport::spdif_1: return RsxaudioAvportIdx::SPDIF_1; @@ -1770,19 +1779,19 @@ void rsxaudio_backend_thread::backend_init(const rsxaudio_state& ra_state, const } callback_cfg.atomic_op([&](callback_config& val) - { - val.callback_active = false; // Backend may take some time to activate. This prevents overflows on input side. - - if (!val.cfg_changed) { - val.freq = static_cast(port_cfg.freq); - val.input_ch_cnt = static_cast(port_cfg.ch_cnt); - val.output_channel_layout = static_cast(backend_channel_layout); - val.convert_to_s16 = emu_cfg.convert_to_s16; - val.avport_idx = emu_cfg.avport; - val.ready = true; - } - }); + val.callback_active = false; // Backend may take some time to activate. This prevents overflows on input side. + + if (!val.cfg_changed) + { + val.freq = static_cast(port_cfg.freq); + val.input_ch_cnt = static_cast(port_cfg.ch_cnt); + val.output_channel_layout = static_cast(backend_channel_layout); + val.convert_to_s16 = emu_cfg.convert_to_s16; + val.avport_idx = emu_cfg.avport; + val.ready = true; + } + }); } void rsxaudio_backend_thread::backend_start() @@ -1809,9 +1818,9 @@ void rsxaudio_backend_thread::backend_stop() backend->Pause(); callback_cfg.atomic_op([&](callback_config& val) - { - val.callback_active = false; - }); + { + val.callback_active = false; + }); } bool rsxaudio_backend_thread::backend_playing() @@ -1827,10 +1836,10 @@ bool rsxaudio_backend_thread::backend_playing() u32 rsxaudio_backend_thread::write_data_callback(u32 bytes, void* buf) { const callback_config cb_cfg = callback_cfg.atomic_op([&](callback_config& val) - { - val.callback_active = true; - return val; - }); + { + val.callback_active = true; + return val; + }); const std::bitset mute_state{cb_cfg.mute_state}; @@ -1867,25 +1876,24 @@ u32 rsxaudio_backend_thread::write_data_callback(u32 bytes, void* buf) if (cb_cfg.target_volume != cb_cfg.current_volume) { const AudioBackend::VolumeParam param = - { - .initial_volume = cb_cfg.initial_volume * callback_config::VOL_NOMINAL_INV, - .current_volume = cb_cfg.current_volume * callback_config::VOL_NOMINAL_INV, - .target_volume = cb_cfg.target_volume * callback_config::VOL_NOMINAL_INV, - .freq = cb_cfg.freq, - .ch_cnt = cb_cfg.input_ch_cnt - }; + { + .initial_volume = cb_cfg.initial_volume * callback_config::VOL_NOMINAL_INV, + .current_volume = cb_cfg.current_volume * callback_config::VOL_NOMINAL_INV, + .target_volume = cb_cfg.target_volume * callback_config::VOL_NOMINAL_INV, + .freq = cb_cfg.freq, + .ch_cnt = cb_cfg.input_ch_cnt}; const u16 new_vol = static_cast(std::round(AudioBackend::apply_volume(param, sample_cnt_out, callback_tmp_buf.data(), callback_tmp_buf.data()) * callback_config::VOL_NOMINAL)); callback_cfg.atomic_op([&](callback_config& val) - { - if (val.target_volume != cb_cfg.target_volume) { - val.initial_volume = new_vol; - } + if (val.target_volume != cb_cfg.target_volume) + { + val.initial_volume = new_vol; + } - // We don't care about proper volume adjustment if underflow has occured - val.current_volume = bytes_from_rb != byte_cnt ? val.target_volume : new_vol; - }); + // We don't care about proper volume adjustment if underflow has occured + val.current_volume = bytes_from_rb != byte_cnt ? val.target_volume : new_vol; + }); } else if (cb_cfg.current_volume != callback_config::VOL_NOMINAL) { @@ -1942,7 +1950,8 @@ u64 rsxaudio_backend_thread::get_time_until_service() void rsxaudio_backend_thread::update_service_time() { - if (get_time_until_service() <= SERVICE_THRESHOLD) time_period_idx++; + if (get_time_until_service() <= SERVICE_THRESHOLD) + time_period_idx++; } void rsxaudio_backend_thread::reset_service_time() @@ -1983,7 +1992,7 @@ void rsxaudio_periodic_tmr::sched_timer() #elif defined(__linux__) const time_t secs = interval / 1'000'000; const long nsecs = (interval - secs * 1'000'000) * 1000; - const itimerspec tspec = {{}, { secs, nsecs }}; + const itimerspec tspec = {{}, {secs, nsecs}}; ensure(timerfd_settime(timer_handle, 0, &tspec, nullptr) == 0); #elif defined(BSD) || defined(__APPLE__) handle[TIMER_ID].data = interval * 1000; @@ -2058,7 +2067,7 @@ rsxaudio_periodic_tmr::rsxaudio_periodic_tmr() #elif defined(__linux__) timer_handle = timerfd_create(CLOCK_MONOTONIC, 0); ensure((epoll_fd = epoll_create(2)) >= 0); - epoll_event evnt{ EPOLLIN, {} }; + epoll_event evnt{EPOLLIN, {}}; evnt.data.fd = timer_handle; ensure(timer_handle >= 0 && epoll_ctl(epoll_fd, EPOLL_CTL_ADD, timer_handle, &evnt) == 0); cancel_event = eventfd(0, EFD_NONBLOCK); @@ -2098,7 +2107,7 @@ rsxaudio_periodic_tmr::~rsxaudio_periodic_tmr() #endif } -rsxaudio_periodic_tmr::wait_result rsxaudio_periodic_tmr::wait(const std::function &callback) +rsxaudio_periodic_tmr::wait_result rsxaudio_periodic_tmr::wait(const std::function& callback) { std::unique_lock lock(mutex); @@ -2109,8 +2118,8 @@ rsxaudio_periodic_tmr::wait_result rsxaudio_periodic_tmr::wait(const std::functi in_wait = true; - bool tmr_error = false; - bool timeout = false; + bool tmr_error = false; + bool timeout = false; bool wait_canceled = false; if (!zero_period) @@ -2119,7 +2128,7 @@ rsxaudio_periodic_tmr::wait_result rsxaudio_periodic_tmr::wait(const std::functi constexpr u8 obj_wait_cnt = 2; #if defined(_WIN32) - const HANDLE wait_arr[obj_wait_cnt] = { timer_handle, cancel_event }; + const HANDLE wait_arr[obj_wait_cnt] = {timer_handle, cancel_event}; const auto wait_status = WaitForMultipleObjects(obj_wait_cnt, wait_arr, false, INFINITE); if (wait_status == WAIT_FAILED || (wait_status >= WAIT_ABANDONED_0 && wait_status < WAIT_ABANDONED_0 + obj_wait_cnt)) @@ -2140,8 +2149,7 @@ rsxaudio_periodic_tmr::wait_result rsxaudio_periodic_tmr::wait(const std::functi do { wait_status = epoll_wait(epoll_fd, event, obj_wait_cnt, -1); - } - while (wait_status == -1 && errno == EINTR); + } while (wait_status == -1 && errno == EINTR); if (wait_status < 0 || wait_status > obj_wait_cnt) { @@ -2168,8 +2176,7 @@ rsxaudio_periodic_tmr::wait_result rsxaudio_periodic_tmr::wait(const std::functi do { wait_status = kevent(kq, nullptr, 0, event, obj_wait_cnt, nullptr); - } - while (wait_status == -1 && errno == EINTR); + } while (wait_status == -1 && errno == EINTR); if (wait_status < 0 || wait_status > obj_wait_cnt) { @@ -2235,7 +2242,8 @@ u64 rsxaudio_periodic_tmr::get_rel_next_time() for (vtimer& vtimer : vtmr_pool) { - if (!vtimer.active) continue; + if (!vtimer.active) + continue; u64 next_blk_time = static_cast(vtimer.blk_cnt * vtimer.blk_time); diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsxaudio.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsxaudio.h index e13b33816..91f2cdcfd 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsxaudio.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_rsxaudio.h @@ -25,34 +25,34 @@ enum : u32 { - SYS_RSXAUDIO_SERIAL_STREAM_CNT = 4, - SYS_RSXAUDIO_STREAM_DATA_BLK_CNT = 4, - SYS_RSXAUDIO_DATA_BLK_SIZE = 256, - SYS_RSXAUDIO_STREAM_SIZE = SYS_RSXAUDIO_DATA_BLK_SIZE * SYS_RSXAUDIO_STREAM_DATA_BLK_CNT, - SYS_RSXAUDIO_CH_PER_STREAM = 2, - SYS_RSXAUDIO_SERIAL_MAX_CH = 8, - SYS_RSXAUDIO_SPDIF_MAX_CH = 2, - SYS_RSXAUDIO_STREAM_SAMPLE_CNT = SYS_RSXAUDIO_STREAM_SIZE / SYS_RSXAUDIO_CH_PER_STREAM / sizeof(f32), + SYS_RSXAUDIO_SERIAL_STREAM_CNT = 4, + SYS_RSXAUDIO_STREAM_DATA_BLK_CNT = 4, + SYS_RSXAUDIO_DATA_BLK_SIZE = 256, + SYS_RSXAUDIO_STREAM_SIZE = SYS_RSXAUDIO_DATA_BLK_SIZE * SYS_RSXAUDIO_STREAM_DATA_BLK_CNT, + SYS_RSXAUDIO_CH_PER_STREAM = 2, + SYS_RSXAUDIO_SERIAL_MAX_CH = 8, + SYS_RSXAUDIO_SPDIF_MAX_CH = 2, + SYS_RSXAUDIO_STREAM_SAMPLE_CNT = SYS_RSXAUDIO_STREAM_SIZE / SYS_RSXAUDIO_CH_PER_STREAM / sizeof(f32), - SYS_RSXAUDIO_RINGBUF_BLK_SZ_SERIAL = SYS_RSXAUDIO_STREAM_SIZE * SYS_RSXAUDIO_SERIAL_STREAM_CNT, - SYS_RSXAUDIO_RINGBUF_BLK_SZ_SPDIF = SYS_RSXAUDIO_STREAM_SIZE, + SYS_RSXAUDIO_RINGBUF_BLK_SZ_SERIAL = SYS_RSXAUDIO_STREAM_SIZE * SYS_RSXAUDIO_SERIAL_STREAM_CNT, + SYS_RSXAUDIO_RINGBUF_BLK_SZ_SPDIF = SYS_RSXAUDIO_STREAM_SIZE, - SYS_RSXAUDIO_RINGBUF_SZ = 16, + SYS_RSXAUDIO_RINGBUF_SZ = 16, - SYS_RSXAUDIO_AVPORT_CNT = 5, + SYS_RSXAUDIO_AVPORT_CNT = 5, - SYS_RSXAUDIO_FREQ_BASE_384K = 384000, - SYS_RSXAUDIO_FREQ_BASE_352K = 352800, + SYS_RSXAUDIO_FREQ_BASE_384K = 384000, + SYS_RSXAUDIO_FREQ_BASE_352K = 352800, - SYS_RSXAUDIO_PORT_CNT = 3, + SYS_RSXAUDIO_PORT_CNT = 3, - SYS_RSXAUDIO_SPDIF_CNT = 2, + SYS_RSXAUDIO_SPDIF_CNT = 2, }; enum class RsxaudioAvportIdx : u8 { - HDMI_0 = 0, - HDMI_1 = 1, + HDMI_0 = 0, + HDMI_1 = 1, AVMULTI = 2, SPDIF_0 = 3, SPDIF_1 = 4, @@ -60,7 +60,7 @@ enum class RsxaudioAvportIdx : u8 enum class RsxaudioPort : u8 { - SERIAL = 0, + SERIAL = 0, SPDIF_0 = 1, SPDIF_1 = 2, INVALID = 0xFF, @@ -152,7 +152,7 @@ enum rsxaudio_dma_flag : u32 struct lv2_rsxaudio final : lv2_obj { - static constexpr u32 id_base = 0x60000000; + static constexpr u32 id_base = 0x60000000; static constexpr u64 dma_io_id = 1; static constexpr u32 dma_io_base = 0x30000000; @@ -164,10 +164,11 @@ struct lv2_rsxaudio final : lv2_obj std::array, SYS_RSXAUDIO_PORT_CNT> event_queue{}; // lv2 uses port memory addresses for their names - static constexpr std::array event_port_name{ 0x8000000000400100, 0x8000000000400200, 0x8000000000400300 }; + static constexpr std::array event_port_name{0x8000000000400100, 0x8000000000400200, 0x8000000000400300}; lv2_rsxaudio() noexcept = default; - lv2_rsxaudio(utils::serial& ar) noexcept; void save(utils::serial& ar); + lv2_rsxaudio(utils::serial& ar) noexcept; + void save(utils::serial& ar); void page_lock() { @@ -188,7 +189,6 @@ struct lv2_rsxaudio final : lv2_obj class rsxaudio_periodic_tmr { public: - enum class wait_result { SUCCESS, @@ -205,7 +205,7 @@ public: rsxaudio_periodic_tmr& operator=(const rsxaudio_periodic_tmr&) = delete; // Wait until timer fires and calls callback. - wait_result wait(const std::function &callback); + wait_result wait(const std::function& callback); // Cancel wait() call void cancel_wait(); @@ -237,7 +237,6 @@ public: u64 vtimer_get_sched_time(u32 vtimer_id) const; private: - static constexpr u64 MAX_BURST_PERIODS = SYS_RSXAUDIO_RINGBUF_SZ; static constexpr u32 VTIMER_MAX = 4; @@ -291,7 +290,7 @@ struct rsxaudio_hw_param_t bool buf_empty_en = false; bool muted = true; bool en = false; - u8 freq_div = 8; + u8 freq_div = 8; RsxaudioSampleSize depth = RsxaudioSampleSize::_16BIT; }; @@ -302,9 +301,9 @@ struct rsxaudio_hw_param_t bool muted = true; bool en = false; bool use_serial_buf = true; - u8 freq_div = 8; + u8 freq_div = 8; RsxaudioSampleSize depth = RsxaudioSampleSize::_16BIT; - std::array cs_data = { 0x00, 0x90, 0x00, 0x40, 0x80, 0x00 }; // HW supports only 6 bytes (uart pkt has 8) + std::array cs_data = {0x00, 0x90, 0x00, 0x40, 0x80, 0x00}; // HW supports only 6 bytes (uart pkt has 8) }; struct hdmi_param_t @@ -317,14 +316,14 @@ struct rsxaudio_hw_param_t static constexpr u8 MAP_SILENT_CH = umax; - bool init = false; - hdmi_ch_cfg_t ch_cfg{}; - std::array info_frame{}; // TODO: check chstat and info_frame for info on audio layout, add default values - std::array chstat{}; + bool init = false; + hdmi_ch_cfg_t ch_cfg{}; + std::array info_frame{}; // TODO: check chstat and info_frame for info on audio layout, add default values + std::array chstat{}; - bool muted = true; - bool force_mute = true; - bool use_spdif_1 = false; // TODO: unused for now + bool muted = true; + bool force_mute = true; + bool use_spdif_1 = false; // TODO: unused for now }; u32 serial_freq_base = SYS_RSXAUDIO_FREQ_BASE_384K; @@ -337,13 +336,12 @@ struct rsxaudio_hw_param_t hdmi_param_t hdmi[2]{}; std::array avport_src = - { - RsxaudioPort::INVALID, - RsxaudioPort::INVALID, - RsxaudioPort::INVALID, - RsxaudioPort::INVALID, - RsxaudioPort::INVALID - }; + { + RsxaudioPort::INVALID, + RsxaudioPort::INVALID, + RsxaudioPort::INVALID, + RsxaudioPort::INVALID, + RsxaudioPort::INVALID}; }; // 16-bit PCM converted into float, so buffer must be twice as big @@ -352,7 +350,6 @@ using ra_stream_blk_t = std::array; class rsxaudio_data_container { public: - struct buf_t { std::array serial{}; @@ -367,7 +364,6 @@ public: bool data_was_used(); private: - const rsxaudio_hw_param_t& hwp; const buf_t& out_buf; @@ -382,9 +378,9 @@ private: rsxaudio_data_container& operator=(rsxaudio_data_container&&) = delete; // Mix individual channels into final PCM stream. Channels in channel map that are > input_ch_cnt treated as silent. - template - requires (output_ch_cnt > 0 && output_ch_cnt <= 8 && input_ch_cnt > 0) - constexpr void mix(const std::array &ch_map, RsxaudioSampleSize sample_size, const std::array &input_channels, data_blk_t& data_out) + template + requires(output_ch_cnt > 0 && output_ch_cnt <= 8 && input_ch_cnt > 0) + constexpr void mix(const std::array& ch_map, RsxaudioSampleSize sample_size, const std::array& input_channels, data_blk_t& data_out) { const ra_stream_blk_t silent_channel{}; @@ -408,14 +404,22 @@ private: { const u32 src_sample_idx = sample_idx / output_ch_cnt; - if constexpr (output_ch_cnt >= 1) data_out[sample_idx + 0] = (*real_input_ch[0])[src_sample_idx]; - if constexpr (output_ch_cnt >= 2) data_out[sample_idx + 1] = (*real_input_ch[1])[src_sample_idx]; - if constexpr (output_ch_cnt >= 3) data_out[sample_idx + 2] = (*real_input_ch[2])[src_sample_idx]; - if constexpr (output_ch_cnt >= 4) data_out[sample_idx + 3] = (*real_input_ch[3])[src_sample_idx]; - if constexpr (output_ch_cnt >= 5) data_out[sample_idx + 4] = (*real_input_ch[4])[src_sample_idx]; - if constexpr (output_ch_cnt >= 6) data_out[sample_idx + 5] = (*real_input_ch[5])[src_sample_idx]; - if constexpr (output_ch_cnt >= 7) data_out[sample_idx + 6] = (*real_input_ch[6])[src_sample_idx]; - if constexpr (output_ch_cnt >= 8) data_out[sample_idx + 7] = (*real_input_ch[7])[src_sample_idx]; + if constexpr (output_ch_cnt >= 1) + data_out[sample_idx + 0] = (*real_input_ch[0])[src_sample_idx]; + if constexpr (output_ch_cnt >= 2) + data_out[sample_idx + 1] = (*real_input_ch[1])[src_sample_idx]; + if constexpr (output_ch_cnt >= 3) + data_out[sample_idx + 2] = (*real_input_ch[2])[src_sample_idx]; + if constexpr (output_ch_cnt >= 4) + data_out[sample_idx + 3] = (*real_input_ch[3])[src_sample_idx]; + if constexpr (output_ch_cnt >= 5) + data_out[sample_idx + 4] = (*real_input_ch[4])[src_sample_idx]; + if constexpr (output_ch_cnt >= 6) + data_out[sample_idx + 5] = (*real_input_ch[5])[src_sample_idx]; + if constexpr (output_ch_cnt >= 7) + data_out[sample_idx + 6] = (*real_input_ch[6])[src_sample_idx]; + if constexpr (output_ch_cnt >= 8) + data_out[sample_idx + 7] = (*real_input_ch[7])[src_sample_idx]; } } }; @@ -428,7 +432,6 @@ namespace audio class rsxaudio_backend_thread { public: - struct port_config { AudioFreq freq = AudioFreq::FREQ_48K; @@ -439,8 +442,8 @@ public: struct avport_bit { - bool hdmi_0 : 1; - bool hdmi_1 : 1; + bool hdmi_0 : 1; + bool hdmi_1 : 1; bool avmulti : 1; bool spdif_0 : 1; bool spdif_1 : 1; @@ -452,7 +455,7 @@ public: void operator()(); rsxaudio_backend_thread& operator=(thread_state state); - void set_new_stream_param(const std::array &cfg, avport_bit muted_avports); + void set_new_stream_param(const std::array& cfg, avport_bit muted_avports); void set_mute_state(avport_bit muted_avports); void add_data(rsxaudio_data_container& cont); @@ -466,7 +469,6 @@ public: SAVESTATE_INIT_POS(8.91); // Depends on audio_out_configuration private: - struct emu_audio_cfg { std::string audio_device{}; @@ -495,21 +497,21 @@ private: static constexpr u16 VOL_NOMINAL = 10000; static constexpr f32 VOL_NOMINAL_INV = 1.0f / VOL_NOMINAL; - u32 freq : 20 = 48000; + u32 freq : 20 = 48000; - u16 target_volume = 10000; - u16 initial_volume = 10000; - u16 current_volume = 10000; + u16 target_volume = 10000; + u16 initial_volume = 10000; + u16 current_volume = 10000; RsxaudioAvportIdx avport_idx = RsxaudioAvportIdx::HDMI_0; u8 mute_state : SYS_RSXAUDIO_AVPORT_CNT = 0b11111; - u8 input_ch_cnt : 4 = 2; + u8 input_ch_cnt : 4 = 2; u8 output_channel_layout : 4 = static_cast(audio_channel_layout::stereo); - bool ready : 1 = false; - bool convert_to_s16 : 1 = false; - bool cfg_changed : 1 = false; + bool ready : 1 = false; + bool convert_to_s16 : 1 = false; + bool cfg_changed : 1 = false; bool callback_active : 1 = false; }; @@ -537,7 +539,7 @@ private: rsxaudio_state new_ra_state{}; bool ra_state_changed = true; - shared_mutex state_update_m{}; + shared_mutex state_update_m{}; cond_variable state_update_c{}; simple_ringbuf ringbuf{}; @@ -548,7 +550,7 @@ private: shared_mutex ringbuf_mutex{}; std::shared_ptr backend{}; - backend_config backend_current_cfg{ {}, new_emu_cfg.avport }; + backend_config backend_current_cfg{{}, new_emu_cfg.avport}; atomic_t callback_cfg{}; bool backend_error_occured = false; bool backend_device_changed = false; @@ -578,7 +580,6 @@ private: class rsxaudio_data_thread { public: - // Prevent creation of multiple rsxaudio contexts atomic_t rsxaudio_ctx_allocated = false; @@ -598,7 +599,6 @@ public: static constexpr auto thread_name = "RsxAudioData Thread"sv; private: - rsxaudio_data_container::buf_t output_buf{}; transactional_storage hw_param_ts{std::make_shared(), std::make_shared()}; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp index c2abd4028..bdf9456a4 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp @@ -11,9 +11,7 @@ LOG_CHANNEL(sys_rwlock); lv2_rwlock::lv2_rwlock(utils::serial& ar) - : protocol(ar) - , key(ar) - , name(ar) + : protocol(ar), key(ar), name(ar) { ar(owner); } @@ -53,9 +51,9 @@ error_code sys_rwlock_create(ppu_thread& ppu, vm::ptr rw_lock_id, vm::ptr(_attr.pshared, ipc_key, _attr.flags, [&] - { - return make_shared(protocol, ipc_key, _attr.name_u64); - })) + { + return make_shared(protocol, ipc_key, _attr.name_u64); + })) { return error; } @@ -72,15 +70,15 @@ error_code sys_rwlock_destroy(ppu_thread& ppu, u32 rw_lock_id) sys_rwlock.warning("sys_rwlock_destroy(rw_lock_id=0x%x)", rw_lock_id); const auto rwlock = idm::withdraw(rw_lock_id, [](lv2_rwlock& rw) -> CellError - { - if (rw.owner) { - return CELL_EBUSY; - } + if (rw.owner) + { + return CELL_EBUSY; + } - lv2_obj::on_id_destroy(rw, rw.key); - return {}; - }); + lv2_obj::on_id_destroy(rw, rw.key); + return {}; + }); if (!rwlock) { @@ -102,43 +100,43 @@ error_code sys_rwlock_rlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) sys_rwlock.trace("sys_rwlock_rlock(rw_lock_id=0x%x, timeout=0x%llx)", rw_lock_id, timeout); const auto rwlock = idm::get(rw_lock_id, [&, notify = lv2_obj::notify_all_t()](lv2_rwlock& rwlock) - { - const s64 val = rwlock.owner; - - if (val <= 0 && !(val & 1)) { - if (rwlock.owner.compare_and_swap_test(val, val - 2)) - { - return true; - } - } + const s64 val = rwlock.owner; - lv2_obj::prepare_for_sleep(ppu); - - std::lock_guard lock(rwlock.mutex); - - const s64 _old = rwlock.owner.fetch_op([&](s64& val) - { if (val <= 0 && !(val & 1)) { - val -= 2; + if (rwlock.owner.compare_and_swap_test(val, val - 2)) + { + return true; + } } - else + + lv2_obj::prepare_for_sleep(ppu); + + std::lock_guard lock(rwlock.mutex); + + const s64 _old = rwlock.owner.fetch_op([&](s64& val) + { + if (val <= 0 && !(val & 1)) + { + val -= 2; + } + else + { + val |= 1; + } + }); + + if (_old > 0 || _old & 1) { - val |= 1; + rwlock.sleep(ppu, timeout); + lv2_obj::emplace(rwlock.rq, &ppu); + return false; } + + return true; }); - if (_old > 0 || _old & 1) - { - rwlock.sleep(ppu, timeout); - lv2_obj::emplace(rwlock.rq, &ppu); - return false; - } - - return true; - }); - if (!rwlock) { return CELL_ESRCH; @@ -180,7 +178,7 @@ error_code sys_rwlock_rlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) } if (ppu.state & cpu_flag::signal) - { + { continue; } @@ -230,21 +228,21 @@ error_code sys_rwlock_tryrlock(ppu_thread& ppu, u32 rw_lock_id) sys_rwlock.trace("sys_rwlock_tryrlock(rw_lock_id=0x%x)", rw_lock_id); const auto rwlock = idm::check(rw_lock_id, [](lv2_rwlock& rwlock) - { - auto [_, ok] = rwlock.owner.fetch_op([](s64& val) { - if (val <= 0 && !(val & 1)) - { - val -= 2; - return true; - } + auto [_, ok] = rwlock.owner.fetch_op([](s64& val) + { + if (val <= 0 && !(val & 1)) + { + val -= 2; + return true; + } - return false; + return false; + }); + + return ok; }); - return ok; - }); - if (!rwlock) { return CELL_ESRCH; @@ -265,19 +263,19 @@ error_code sys_rwlock_runlock(ppu_thread& ppu, u32 rw_lock_id) sys_rwlock.trace("sys_rwlock_runlock(rw_lock_id=0x%x)", rw_lock_id); const auto rwlock = idm::get(rw_lock_id, [](lv2_rwlock& rwlock) - { - const s64 val = rwlock.owner; - - if (val < 0 && !(val & 1)) { - if (rwlock.owner.compare_and_swap_test(val, val + 2)) - { - return true; - } - } + const s64 val = rwlock.owner; - return false; - }); + if (val < 0 && !(val & 1)) + { + if (rwlock.owner.compare_and_swap_test(val, val + 2)) + { + return true; + } + } + + return false; + }); if (!rwlock) { @@ -296,12 +294,12 @@ error_code sys_rwlock_runlock(ppu_thread& ppu, u32 rw_lock_id) // Remove one reader const s64 _old = rwlock->owner.fetch_op([](s64& val) - { - if (val < -1) { - val += 2; - } - }); + if (val < -1) + { + val += 2; + } + }); if (_old >= 0) { @@ -341,46 +339,46 @@ error_code sys_rwlock_wlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) sys_rwlock.trace("sys_rwlock_wlock(rw_lock_id=0x%x, timeout=0x%llx)", rw_lock_id, timeout); const auto rwlock = idm::get(rw_lock_id, [&, notify = lv2_obj::notify_all_t()](lv2_rwlock& rwlock) -> s64 - { - const s64 val = rwlock.owner; - - if (val == 0) { - if (rwlock.owner.compare_and_swap_test(0, ppu.id << 1)) - { - return 0; - } - } - else if (val >> 1 == ppu.id) - { - return val; - } + const s64 val = rwlock.owner; - lv2_obj::prepare_for_sleep(ppu); - - std::lock_guard lock(rwlock.mutex); - - const s64 _old = rwlock.owner.fetch_op([&](s64& val) - { if (val == 0) { - val = ppu.id << 1; + if (rwlock.owner.compare_and_swap_test(0, ppu.id << 1)) + { + return 0; + } } - else + else if (val >> 1 == ppu.id) { - val |= 1; + return val; } + + lv2_obj::prepare_for_sleep(ppu); + + std::lock_guard lock(rwlock.mutex); + + const s64 _old = rwlock.owner.fetch_op([&](s64& val) + { + if (val == 0) + { + val = ppu.id << 1; + } + else + { + val |= 1; + } + }); + + if (_old != 0) + { + rwlock.sleep(ppu, timeout); + lv2_obj::emplace(rwlock.wq, &ppu); + } + + return _old; }); - if (_old != 0) - { - rwlock.sleep(ppu, timeout); - lv2_obj::emplace(rwlock.wq, &ppu); - } - - return _old; - }); - if (!rwlock) { return CELL_ESRCH; @@ -427,7 +425,7 @@ error_code sys_rwlock_wlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) } if (ppu.state & cpu_flag::signal) - { + { continue; } @@ -461,10 +459,10 @@ error_code sys_rwlock_wlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) } rwlock->owner.atomic_op([&](s64& owner) - { - owner -= 2 * size; // Add readers to value - owner &= -2; // Clear wait bit - }); + { + owner -= 2 * size; // Add readers to value + owner &= -2; // Clear wait bit + }); lv2_obj::awake_all(); } @@ -493,12 +491,12 @@ error_code sys_rwlock_trywlock(ppu_thread& ppu, u32 rw_lock_id) sys_rwlock.trace("sys_rwlock_trywlock(rw_lock_id=0x%x)", rw_lock_id); const auto rwlock = idm::check(rw_lock_id, [&](lv2_rwlock& rwlock) - { - const s64 val = rwlock.owner; + { + const s64 val = rwlock.owner; - // Return previous value - return val ? val : rwlock.owner.compare_and_swap(0, ppu.id << 1); - }); + // Return previous value + return val ? val : rwlock.owner.compare_and_swap(0, ppu.id << 1); + }); if (!rwlock) { @@ -525,12 +523,12 @@ error_code sys_rwlock_wunlock(ppu_thread& ppu, u32 rw_lock_id) sys_rwlock.trace("sys_rwlock_wunlock(rw_lock_id=0x%x)", rw_lock_id); const auto rwlock = idm::get(rw_lock_id, [&](lv2_rwlock& rwlock) - { - const s64 val = rwlock.owner; + { + const s64 val = rwlock.owner; - // Return previous value - return val != ppu.id << 1 ? val : rwlock.owner.compare_and_swap(val, 0); - }); + // Return previous value + return val != ppu.id << 1 ? val : rwlock.owner.compare_and_swap(val, 0); + }); if (!rwlock) { diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_rwlock.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_rwlock.h index 9bfcac000..c64a9bff5 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_rwlock.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_rwlock.h @@ -33,9 +33,7 @@ struct lv2_rwlock final : lv2_obj ppu_thread* wq{}; lv2_rwlock(u32 protocol, u64 key, u64 name) noexcept - : protocol{static_cast(protocol)} - , key(key) - , name(name) + : protocol{static_cast(protocol)}, key(key), name(name) { } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_semaphore.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_semaphore.cpp index 7440cf2de..d34f056d0 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_semaphore.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_semaphore.cpp @@ -11,10 +11,7 @@ LOG_CHANNEL(sys_semaphore); lv2_sema::lv2_sema(utils::serial& ar) - : protocol(ar) - , key(ar) - , name(ar) - , max(ar) + : protocol(ar), key(ar), name(ar), max(ar) { ar(val); } @@ -65,9 +62,9 @@ error_code sys_semaphore_create(ppu_thread& ppu, vm::ptr sem_id, vm::ptr(_attr.pshared, ipc_key, _attr.flags, [&] - { - return make_shared(protocol, ipc_key, _attr.name_u64, max_val, initial_val); - })) + { + return make_shared(protocol, ipc_key, _attr.name_u64, max_val, initial_val); + })) { return error; } @@ -85,15 +82,15 @@ error_code sys_semaphore_destroy(ppu_thread& ppu, u32 sem_id) sys_semaphore.trace("sys_semaphore_destroy(sem_id=0x%x)", sem_id); const auto sem = idm::withdraw(sem_id, [](lv2_sema& sema) -> CellError - { - if (sema.val < 0) { - return CELL_EBUSY; - } + if (sema.val < 0) + { + return CELL_EBUSY; + } - lv2_obj::on_id_destroy(sema, sema.key); - return {}; - }); + lv2_obj::on_id_destroy(sema, sema.key); + return {}; + }); if (!sem) { @@ -120,30 +117,30 @@ error_code sys_semaphore_wait(ppu_thread& ppu, u32 sem_id, u64 timeout) sys_semaphore.trace("sys_semaphore_wait(sem_id=0x%x, timeout=0x%llx)", sem_id, timeout); const auto sem = idm::get(sem_id, [&, notify = lv2_obj::notify_all_t()](lv2_sema& sema) - { - const s32 val = sema.val; - - if (val > 0) { - if (sema.val.compare_and_swap_test(val, val - 1)) + const s32 val = sema.val; + + if (val > 0) { - return true; + if (sema.val.compare_and_swap_test(val, val - 1)) + { + return true; + } } - } - lv2_obj::prepare_for_sleep(ppu); + lv2_obj::prepare_for_sleep(ppu); - std::lock_guard lock(sema.mutex); + std::lock_guard lock(sema.mutex); - if (sema.val-- <= 0) - { - sema.sleep(ppu, timeout); - lv2_obj::emplace(sema.sq, &ppu); - return false; - } + if (sema.val-- <= 0) + { + sema.sleep(ppu, timeout); + lv2_obj::emplace(sema.sq, &ppu); + return false; + } - return true; - }); + return true; + }); if (!sem) { @@ -186,7 +183,7 @@ error_code sys_semaphore_wait(ppu_thread& ppu, u32 sem_id, u64 timeout) } if (ppu.state & cpu_flag::signal) - { + { continue; } @@ -210,12 +207,12 @@ error_code sys_semaphore_wait(ppu_thread& ppu, u32 sem_id, u64 timeout) } ensure(0 > sem->val.fetch_op([](s32& val) - { - if (val < 0) - { - val++; - } - })); + { + if (val < 0) + { + val++; + } + })); ppu.gpr[3] = CELL_ETIMEDOUT; break; @@ -237,9 +234,9 @@ error_code sys_semaphore_trywait(ppu_thread& ppu, u32 sem_id) sys_semaphore.trace("sys_semaphore_trywait(sem_id=0x%x)", sem_id); const auto sem = idm::check(sem_id, [&](lv2_sema& sema) - { - return sema.val.try_dec(0); - }); + { + return sema.val.try_dec(0); + }); if (!sem) { @@ -261,19 +258,19 @@ error_code sys_semaphore_post(ppu_thread& ppu, u32 sem_id, s32 count) sys_semaphore.trace("sys_semaphore_post(sem_id=0x%x, count=%d)", sem_id, count); const auto sem = idm::get(sem_id, [&](lv2_sema& sema) - { - const s32 val = sema.val; - - if (val >= 0 && count > 0 && count <= sema.max - val) { - if (sema.val.compare_and_swap_test(val, val + count)) - { - return true; - } - } + const s32 val = sema.val; - return false; - }); + if (val >= 0 && count > 0 && count <= sema.max - val) + { + if (sema.val.compare_and_swap_test(val, val + count)) + { + return true; + } + } + + return false; + }); if (!sem) { @@ -305,15 +302,15 @@ error_code sys_semaphore_post(ppu_thread& ppu, u32 sem_id, s32 count) } const auto [val, ok] = sem->val.fetch_op([&](s32& val) - { - if (count + 0u <= sem->max + 0u - val) { - val += count; - return true; - } + if (count + 0u <= sem->max + 0u - val) + { + val += count; + return true; + } - return false; - }); + return false; + }); if (!ok) { @@ -344,9 +341,9 @@ error_code sys_semaphore_get_value(ppu_thread& ppu, u32 sem_id, vm::ptr cou sys_semaphore.trace("sys_semaphore_get_value(sem_id=0x%x, count=*0x%x)", sem_id, count); const auto sema = idm::check(sem_id, [](lv2_sema& sema) - { - return std::max(0, sema.val); - }); + { + return std::max(0, sema.val); + }); if (!sema) { diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_semaphore.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_semaphore.h index 737d2b0e6..d24cdcea4 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_semaphore.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_semaphore.h @@ -33,11 +33,7 @@ struct lv2_sema final : lv2_obj ppu_thread* sq{}; lv2_sema(u32 protocol, u64 key, u64 name, s32 max, s32 value) noexcept - : protocol{static_cast(protocol)} - , key(key) - , name(name) - , max(max) - , val(value) + : protocol{static_cast(protocol)}, key(key), name(name), max(max), val(value) { } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_sm.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_sm.cpp index 50a9b1c67..d663b9404 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_sm.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_sm.cpp @@ -7,17 +7,28 @@ #include "sys_sm.h" - LOG_CHANNEL(sys_sm); error_code sys_sm_get_params(vm::ptr a, vm::ptr b, vm::ptr c, vm::ptr d) { sys_sm.todo("sys_sm_get_params(a=*0x%x, b=*0x%x, c=*0x%x, d=*0x%x)", a, b, c, d); - if (a) *a = 0; else return CELL_EFAULT; - if (b) *b = 0; else return CELL_EFAULT; - if (c) *c = 0x200; else return CELL_EFAULT; - if (d) *d = 7; else return CELL_EFAULT; + if (a) + *a = 0; + else + return CELL_EFAULT; + if (b) + *b = 0; + else + return CELL_EFAULT; + if (c) + *c = 0x200; + else + return CELL_EFAULT; + if (d) + *d = 7; + else + return CELL_EFAULT; return CELL_OK; } @@ -35,9 +46,18 @@ error_code sys_sm_get_ext_event2(vm::ptr a1, vm::ptr a2, vm::ptr // a2 looks to be used if a1 is either 5 or 3? // a3 looks to be ignored in vsh - if (a1) *a1 = 0; else return CELL_EFAULT; - if (a2) *a2 = 0; else return CELL_EFAULT; - if (a3) *a3 = 0; else return CELL_EFAULT; + if (a1) + *a1 = 0; + else + return CELL_EFAULT; + if (a2) + *a2 = 0; + else + return CELL_EFAULT; + if (a3) + *a3 = 0; + else + return CELL_EFAULT; // eagain for no event return not_an_error(CELL_EAGAIN); diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_spu.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_spu.cpp index 2c6bd6f3a..074af2795 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_spu.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_spu.cpp @@ -28,42 +28,42 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](spu_group_status value) - { - switch (value) { - case SPU_THREAD_GROUP_STATUS_NOT_INITIALIZED: return "uninitialized"; - case SPU_THREAD_GROUP_STATUS_INITIALIZED: return "initialized"; - case SPU_THREAD_GROUP_STATUS_READY: return "ready"; - case SPU_THREAD_GROUP_STATUS_WAITING: return "waiting"; - case SPU_THREAD_GROUP_STATUS_SUSPENDED: return "suspended"; - case SPU_THREAD_GROUP_STATUS_WAITING_AND_SUSPENDED: return "waiting and suspended"; - case SPU_THREAD_GROUP_STATUS_RUNNING: return "running"; - case SPU_THREAD_GROUP_STATUS_STOPPED: return "stopped"; - case SPU_THREAD_GROUP_STATUS_DESTROYED: return "destroyed"; - case SPU_THREAD_GROUP_STATUS_UNKNOWN: break; - } + switch (value) + { + case SPU_THREAD_GROUP_STATUS_NOT_INITIALIZED: return "uninitialized"; + case SPU_THREAD_GROUP_STATUS_INITIALIZED: return "initialized"; + case SPU_THREAD_GROUP_STATUS_READY: return "ready"; + case SPU_THREAD_GROUP_STATUS_WAITING: return "waiting"; + case SPU_THREAD_GROUP_STATUS_SUSPENDED: return "suspended"; + case SPU_THREAD_GROUP_STATUS_WAITING_AND_SUSPENDED: return "waiting and suspended"; + case SPU_THREAD_GROUP_STATUS_RUNNING: return "running"; + case SPU_THREAD_GROUP_STATUS_STOPPED: return "stopped"; + case SPU_THREAD_GROUP_STATUS_DESTROYED: return "destroyed"; + case SPU_THREAD_GROUP_STATUS_UNKNOWN: break; + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](spu_stop_syscall value) - { - switch (value) { - case SYS_SPU_THREAD_STOP_YIELD: return "sys_spu_thread_yield"; - case SYS_SPU_THREAD_STOP_GROUP_EXIT: return "sys_spu_thread_group_exit"; - case SYS_SPU_THREAD_STOP_THREAD_EXIT: return "sys_spu_thread_thread_exit"; - case SYS_SPU_THREAD_STOP_RECEIVE_EVENT: return "sys_spu_thread_receive_event"; - case SYS_SPU_THREAD_STOP_TRY_RECEIVE_EVENT: return "sys_spu_thread_tryreceive_event"; - case SYS_SPU_THREAD_STOP_SWITCH_SYSTEM_MODULE: return "sys_spu_thread_switch_system_module"; - } + switch (value) + { + case SYS_SPU_THREAD_STOP_YIELD: return "sys_spu_thread_yield"; + case SYS_SPU_THREAD_STOP_GROUP_EXIT: return "sys_spu_thread_group_exit"; + case SYS_SPU_THREAD_STOP_THREAD_EXIT: return "sys_spu_thread_thread_exit"; + case SYS_SPU_THREAD_STOP_RECEIVE_EVENT: return "sys_spu_thread_receive_event"; + case SYS_SPU_THREAD_STOP_TRY_RECEIVE_EVENT: return "sys_spu_thread_tryreceive_event"; + case SYS_SPU_THREAD_STOP_SWITCH_SYSTEM_MODULE: return "sys_spu_thread_switch_system_module"; + } - return unknown; - }); + return unknown; + }); } void sys_spu_image::load(const fs::file& stream) @@ -96,7 +96,7 @@ void sys_spu_image::load(const fs::file& stream) const u32 mem_size = nsegs * sizeof(sys_spu_segment) + ::size32(stream); const vm::ptr segs = vm::cast(vm::alloc(mem_size, vm::main)); - //const u32 entry = obj.header.e_entry; + // const u32 entry = obj.header.e_entry; const u32 src = (segs + nsegs).addr(); @@ -200,25 +200,17 @@ void sys_spu_image::deploy(u8* loc, std::span segs, bool } lv2_spu_group::lv2_spu_group(utils::serial& ar) noexcept - : name(ar.pop()) - , id(idm::last_id()) - , max_num(ar) - , mem_size(ar) - , type(ar) // SPU Thread Group Type - , ct(lv2_memory_container::search(ar)) - , has_scheduler_context(ar.pop()) - , max_run(ar) - , init(ar) - , prio([&ar]() - { - std::common_type_t prio{}; + : name(ar.pop()), id(idm::last_id()), max_num(ar), mem_size(ar), type(ar) // SPU Thread Group Type + , + ct(lv2_memory_container::search(ar)), has_scheduler_context(ar.pop()), max_run(ar), init(ar), prio([&ar]() + { + std::common_type_t prio{}; - ar(prio.all); + ar(prio.all); - return prio; - }()) - , run_state(ar.pop()) - , exit_status(ar) + return prio; + }()), + run_state(ar.pop()), exit_status(ar) { for (auto& thread : threads) { @@ -245,9 +237,9 @@ lv2_spu_group::lv2_spu_group(utils::serial& ar) noexcept switch (run_state) { // Commented stuff are handled by different means currently - //case SPU_THREAD_GROUP_STATUS_NOT_INITIALIZED: - //case SPU_THREAD_GROUP_STATUS_INITIALIZED: - //case SPU_THREAD_GROUP_STATUS_READY: + // case SPU_THREAD_GROUP_STATUS_NOT_INITIALIZED: + // case SPU_THREAD_GROUP_STATUS_INITIALIZED: + // case SPU_THREAD_GROUP_STATUS_READY: case SPU_THREAD_GROUP_STATUS_WAITING: { run_state = SPU_THREAD_GROUP_STATUS_RUNNING; @@ -282,9 +274,9 @@ lv2_spu_group::lv2_spu_group(utils::serial& ar) noexcept break; } - //case SPU_THREAD_GROUP_STATUS_RUNNING: - //case SPU_THREAD_GROUP_STATUS_STOPPED: - //case SPU_THREAD_GROUP_STATUS_UNKNOWN: + // case SPU_THREAD_GROUP_STATUS_RUNNING: + // case SPU_THREAD_GROUP_STATUS_STOPPED: + // case SPU_THREAD_GROUP_STATUS_UNKNOWN: default: { break; @@ -325,9 +317,7 @@ void lv2_spu_group::save(utils::serial& ar) } lv2_spu_image::lv2_spu_image(utils::serial& ar) - : e_entry(ar) - , segs(ar.pop()) - , nsegs(ar) + : e_entry(ar), segs(ar.pop()), nsegs(ar) { } @@ -397,16 +387,16 @@ struct spu_limits_t const u32 raw_limit = init.raw_limit != umax ? init.raw_limit : max_raw; idm::select([&](u32, lv2_spu_group& group) - { - if (group.has_scheduler_context) { - controllable_spu_count = std::max(controllable_spu_count, group.max_num); - } - else - { - physical_spus_count += group.max_num; - } - }); + if (group.has_scheduler_context) + { + controllable_spu_count = std::max(controllable_spu_count, group.max_num); + } + else + { + physical_spus_count += group.max_num; + } + }); raw_spu_count += spu_thread::g_raw_spu_ctr; @@ -467,7 +457,7 @@ error_code _sys_spu_image_get_information(ppu_thread& ppu, vm::ptre_entry; - *nsegs = image->nsegs; + *nsegs = image->nsegs; return CELL_OK; } @@ -732,13 +722,13 @@ error_code sys_spu_thread_initialize(ppu_thread& ppu, vm::ptr thread, u32 g const u32 tid = (inited << 24) | (group_id & 0xffffff); - ensure(idm::import>([&]() - { - const auto spu = stx::make_shared>(group.get(), spu_num, thread_name, tid, false, option); - group->threads[inited] = spu; - group->threads_map[spu_num] = static_cast(inited); - return spu; - })); + ensure(idm::import >([&]() + { + const auto spu = stx::make_shared>(group.get(), spu_num, thread_name, tid, false, option); + group->threads[inited] = spu; + group->threads_map[spu_num] = static_cast(inited); + return spu; + })); // alloc_hidden indicates falloc to allocate page with no access rights in base memory auto& spu = group->threads[inited]; @@ -985,24 +975,25 @@ error_code sys_spu_thread_group_destroy(ppu_thread& ppu, u32 id) std::lock_guard lock(limits.mutex); const auto group = idm::withdraw(id, [](lv2_spu_group& group) -> CellError - { - if (!group.run_state.fetch_op([](spu_group_status& state) { - if (state <= SPU_THREAD_GROUP_STATUS_INITIALIZED) + if (!group.run_state.fetch_op([](spu_group_status& state) + { + if (state <= SPU_THREAD_GROUP_STATUS_INITIALIZED) + { + state = SPU_THREAD_GROUP_STATUS_DESTROYED; + return true; + } + + return false; + }) + .second) { - state = SPU_THREAD_GROUP_STATUS_DESTROYED; - return true; + return CELL_EBUSY; } - return false; - }).second) - { - return CELL_EBUSY; - } - - group.ct->free(group.mem_size); - return {}; - }); + group.ct->free(group.mem_size); + return {}; + }); if (!group) { @@ -1140,44 +1131,44 @@ error_code sys_spu_thread_group_suspend(ppu_thread& ppu, u32 id) CellError error; group->run_state.fetch_op([&error](spu_group_status& state) - { - if (state == SPU_THREAD_GROUP_STATUS_DESTROYED) { - error = CELL_ESRCH; - return false; - } + if (state == SPU_THREAD_GROUP_STATUS_DESTROYED) + { + error = CELL_ESRCH; + return false; + } - if (state <= SPU_THREAD_GROUP_STATUS_INITIALIZED || state == SPU_THREAD_GROUP_STATUS_STOPPED) - { - error = CELL_ESTAT; - return false; - } + if (state <= SPU_THREAD_GROUP_STATUS_INITIALIZED || state == SPU_THREAD_GROUP_STATUS_STOPPED) + { + error = CELL_ESTAT; + return false; + } - // SPU_THREAD_GROUP_STATUS_READY state is not used + // SPU_THREAD_GROUP_STATUS_READY state is not used - if (state == SPU_THREAD_GROUP_STATUS_RUNNING) - { - state = SPU_THREAD_GROUP_STATUS_SUSPENDED; - } - else if (state == SPU_THREAD_GROUP_STATUS_WAITING) - { - state = SPU_THREAD_GROUP_STATUS_WAITING_AND_SUSPENDED; - } - else if (state == SPU_THREAD_GROUP_STATUS_SUSPENDED || state == SPU_THREAD_GROUP_STATUS_WAITING_AND_SUSPENDED) - { - error = {}; - return false; - } - else - { + if (state == SPU_THREAD_GROUP_STATUS_RUNNING) + { + state = SPU_THREAD_GROUP_STATUS_SUSPENDED; + } + else if (state == SPU_THREAD_GROUP_STATUS_WAITING) + { + state = SPU_THREAD_GROUP_STATUS_WAITING_AND_SUSPENDED; + } + else if (state == SPU_THREAD_GROUP_STATUS_SUSPENDED || state == SPU_THREAD_GROUP_STATUS_WAITING_AND_SUSPENDED) + { + error = {}; + return false; + } + else + { - error = CELL_ESTAT; - return false; - } + error = CELL_ESTAT; + return false; + } - error = CellError{CELL_CANCEL + 0u}; - return true; - }); + error = CellError{CELL_CANCEL + 0u}; + return true; + }); if (error != CELL_CANCEL + 0u) { @@ -1237,34 +1228,34 @@ error_code sys_spu_thread_group_resume(ppu_thread& ppu, u32 id) CellError error; group->run_state.fetch_op([&error](spu_group_status& state) - { - if (state == SPU_THREAD_GROUP_STATUS_DESTROYED) { - error = CELL_ESRCH; - return false; - } + if (state == SPU_THREAD_GROUP_STATUS_DESTROYED) + { + error = CELL_ESRCH; + return false; + } - // SPU_THREAD_GROUP_STATUS_READY state is not used + // SPU_THREAD_GROUP_STATUS_READY state is not used - if (state == SPU_THREAD_GROUP_STATUS_SUSPENDED) - { - state = SPU_THREAD_GROUP_STATUS_RUNNING; - } - else if (state == SPU_THREAD_GROUP_STATUS_WAITING_AND_SUSPENDED) - { - state = SPU_THREAD_GROUP_STATUS_WAITING; - error = CellError{}; + if (state == SPU_THREAD_GROUP_STATUS_SUSPENDED) + { + state = SPU_THREAD_GROUP_STATUS_RUNNING; + } + else if (state == SPU_THREAD_GROUP_STATUS_WAITING_AND_SUSPENDED) + { + state = SPU_THREAD_GROUP_STATUS_WAITING; + error = CellError{}; + return true; + } + else + { + error = CELL_ESTAT; + return false; + } + + error = CellError{CELL_CANCEL + 0u}; return true; - } - else - { - error = CELL_ESTAT; - return false; - } - - error = CellError{CELL_CANCEL + 0u}; - return true; - }); + }); if (error != CELL_CANCEL + 0u) { @@ -1384,16 +1375,16 @@ error_code sys_spu_thread_group_terminate(ppu_thread& ppu, u32 id, s32 value) if (thread) { thread->state.fetch_op([](bs_t& flags) - { - if (flags & cpu_flag::stop) { - // In case the thread raised the ret flag itself at some point do not raise it again - return false; - } + if (flags & cpu_flag::stop) + { + // In case the thread raised the ret flag itself at some point do not raise it again + return false; + } - flags += cpu_flag::stop + cpu_flag::ret; - return true; - }); + flags += cpu_flag::stop + cpu_flag::ret; + return true; + }); } } @@ -1520,8 +1511,7 @@ error_code sys_spu_thread_group_join(ppu_thread& ppu, u32 id, vm::ptr cause ppu.state.wait(state); } - } - while (false); + } while (false); ppu.check_state(); @@ -1566,9 +1556,9 @@ error_code sys_spu_thread_group_set_priority(ppu_thread& ppu, u32 id, s32 priori } group->prio.atomic_op([&](std::common_type_t& prio) - { - prio.prio = priority; - }); + { + prio.prio = priority; + }); return CELL_OK; } @@ -1861,9 +1851,9 @@ error_code sys_spu_thread_group_connect_event(ppu_thread& ppu, u32 id, u32 eq, u const auto ep = et == SYS_SPU_THREAD_GROUP_EVENT_SYSTEM_MODULE ? &group->ep_sysmodule : - et == SYS_SPU_THREAD_GROUP_EVENT_EXCEPTION ? &group->ep_exception : - et == SYS_SPU_THREAD_GROUP_EVENT_RUN ? &group->ep_run : - nullptr; + et == SYS_SPU_THREAD_GROUP_EVENT_EXCEPTION ? &group->ep_exception : + et == SYS_SPU_THREAD_GROUP_EVENT_RUN ? &group->ep_run : + nullptr; if (!ep) { @@ -1910,9 +1900,9 @@ error_code sys_spu_thread_group_disconnect_event(ppu_thread& ppu, u32 id, u32 et const auto ep = et == SYS_SPU_THREAD_GROUP_EVENT_SYSTEM_MODULE ? &group->ep_sysmodule : - et == SYS_SPU_THREAD_GROUP_EVENT_EXCEPTION ? &group->ep_exception : - et == SYS_SPU_THREAD_GROUP_EVENT_RUN ? &group->ep_run : - nullptr; + et == SYS_SPU_THREAD_GROUP_EVENT_EXCEPTION ? &group->ep_exception : + et == SYS_SPU_THREAD_GROUP_EVENT_RUN ? &group->ep_run : + nullptr; if (!ep) { @@ -2003,7 +1993,8 @@ error_code sys_spu_thread_bind_queue(ppu_thread& ppu, u32 id, u32 spuq, u32 spuq sys_spu.warning("sys_spu_thread_bind_queue(id=0x%x, spuq=0x%x, spuq_num=0x%x)", id, spuq, spuq_num); const auto [thread, group] = lv2_spu_group::get_thread(id); - auto queue = idm::get_unlocked(spuq);; + auto queue = idm::get_unlocked(spuq); + ; if (!queue || !thread) [[unlikely]] { @@ -2380,16 +2371,16 @@ error_code raw_spu_destroy(ppu_thread& ppu, u32 id) const u32 idm_id = spu_thread::find_raw_spu(id); auto thread = idm::get>(idm_id, [](named_thread& thread) - { - if (thread.get_type() != (isolated ? spu_type::isolated : spu_type::raw)) { - return false; - } + if (thread.get_type() != (isolated ? spu_type::isolated : spu_type::raw)) + { + return false; + } - // Stop thread - thread = thread_state::aborting; - return true; - }); + // Stop thread + thread = thread_state::aborting; + return true; + }); if (!thread || !thread.ret) [[unlikely]] { @@ -2434,15 +2425,16 @@ error_code raw_spu_destroy(ppu_thread& ppu, u32 id) std::lock_guard lock(limits.mutex); if (auto ret = idm::withdraw>(idm_id, [&](spu_thread& spu) -> CellError - { - if (std::addressof(spu) != std::addressof(*thread)) - { - return CELL_ESRCH; - } + { + if (std::addressof(spu) != std::addressof(*thread)) + { + return CELL_ESRCH; + } - spu.cleanup(); - return {}; - }); !ret || ret.ret) + spu.cleanup(); + return {}; + }); + !ret || ret.ret) { // Other thread destroyed beforehead return CELL_ESRCH; @@ -2479,30 +2471,30 @@ error_code raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 /*hwthread*/, CellError error = {}; - const auto tag = idm::import([&]() - { - shared_ptr result; - - auto thread = idm::check_unlocked>(spu_thread::find_raw_spu(id)); - - if (!thread || *thread == thread_state::aborting || thread->get_type() != (isolated ? spu_type::isolated : spu_type::raw)) + const auto tag = idm::import ([&]() { - error = CELL_ESRCH; + shared_ptr result; + + auto thread = idm::check_unlocked>(spu_thread::find_raw_spu(id)); + + if (!thread || *thread == thread_state::aborting || thread->get_type() != (isolated ? spu_type::isolated : spu_type::raw)) + { + error = CELL_ESRCH; + return result; + } + + auto& int_ctrl = thread->int_ctrl[class_id]; + + if (lv2_obj::check(int_ctrl.tag)) + { + error = CELL_EAGAIN; + return result; + } + + result = make_single(); + int_ctrl.tag = result; return result; - } - - auto& int_ctrl = thread->int_ctrl[class_id]; - - if (lv2_obj::check(int_ctrl.tag)) - { - error = CELL_EAGAIN; - return result; - } - - result = make_single(); - int_ctrl.tag = result; - return result; - }); + }); if (tag) { @@ -2561,7 +2553,6 @@ error_code sys_raw_spu_set_int_mask(ppu_thread& ppu, u32 id, u32 class_id, u64 m return raw_spu_set_int_mask(id, class_id, mask); } - error_code sys_isolated_spu_set_int_mask(ppu_thread& ppu, u32 id, u32 class_id, u64 mask) { ppu.state += cpu_flag::wait; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_spu.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_spu.h index c1f6c31bb..bf4e86b67 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_spu.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_spu.h @@ -14,40 +14,40 @@ struct lv2_memory_container; enum : s32 { - SYS_SPU_THREAD_GROUP_TYPE_NORMAL = 0x00, - //SYS_SPU_THREAD_GROUP_TYPE_SEQUENTIAL = 0x01, doesn't exist - SYS_SPU_THREAD_GROUP_TYPE_SYSTEM = 0x02, + SYS_SPU_THREAD_GROUP_TYPE_NORMAL = 0x00, + // SYS_SPU_THREAD_GROUP_TYPE_SEQUENTIAL = 0x01, doesn't exist + SYS_SPU_THREAD_GROUP_TYPE_SYSTEM = 0x02, SYS_SPU_THREAD_GROUP_TYPE_MEMORY_FROM_CONTAINER = 0x04, - SYS_SPU_THREAD_GROUP_TYPE_NON_CONTEXT = 0x08, + SYS_SPU_THREAD_GROUP_TYPE_NON_CONTEXT = 0x08, SYS_SPU_THREAD_GROUP_TYPE_EXCLUSIVE_NON_CONTEXT = 0x18, SYS_SPU_THREAD_GROUP_TYPE_COOPERATE_WITH_SYSTEM = 0x20, }; enum { - SYS_SPU_THREAD_GROUP_JOIN_GROUP_EXIT = 0x0001, + SYS_SPU_THREAD_GROUP_JOIN_GROUP_EXIT = 0x0001, SYS_SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT = 0x0002, - SYS_SPU_THREAD_GROUP_JOIN_TERMINATED = 0x0004 + SYS_SPU_THREAD_GROUP_JOIN_TERMINATED = 0x0004 }; enum { - SYS_SPU_THREAD_GROUP_EVENT_RUN = 1, - SYS_SPU_THREAD_GROUP_EVENT_EXCEPTION = 2, + SYS_SPU_THREAD_GROUP_EVENT_RUN = 1, + SYS_SPU_THREAD_GROUP_EVENT_EXCEPTION = 2, SYS_SPU_THREAD_GROUP_EVENT_SYSTEM_MODULE = 4, }; enum : u64 { - SYS_SPU_THREAD_GROUP_EVENT_RUN_KEY = 0xFFFFFFFF53505500ull, - SYS_SPU_THREAD_GROUP_EVENT_EXCEPTION_KEY = 0xFFFFFFFF53505503ull, + SYS_SPU_THREAD_GROUP_EVENT_RUN_KEY = 0xFFFFFFFF53505500ull, + SYS_SPU_THREAD_GROUP_EVENT_EXCEPTION_KEY = 0xFFFFFFFF53505503ull, SYS_SPU_THREAD_GROUP_EVENT_SYSTEM_MODULE_KEY = 0xFFFFFFFF53505504ull, }; enum { - SYS_SPU_THREAD_GROUP_LOG_ON = 0x0, - SYS_SPU_THREAD_GROUP_LOG_OFF = 0x1, + SYS_SPU_THREAD_GROUP_LOG_ON = 0x0, + SYS_SPU_THREAD_GROUP_LOG_OFF = 0x1, SYS_SPU_THREAD_GROUP_LOG_GET_STATUS = 0x2, }; @@ -74,11 +74,11 @@ enum : s32 enum spu_stop_syscall : u32 { - SYS_SPU_THREAD_STOP_YIELD = 0x0100, - SYS_SPU_THREAD_STOP_GROUP_EXIT = 0x0101, - SYS_SPU_THREAD_STOP_THREAD_EXIT = 0x0102, - SYS_SPU_THREAD_STOP_RECEIVE_EVENT = 0x0110, - SYS_SPU_THREAD_STOP_TRY_RECEIVE_EVENT = 0x0111, + SYS_SPU_THREAD_STOP_YIELD = 0x0100, + SYS_SPU_THREAD_STOP_GROUP_EXIT = 0x0101, + SYS_SPU_THREAD_STOP_THREAD_EXIT = 0x0102, + SYS_SPU_THREAD_STOP_RECEIVE_EVENT = 0x0110, + SYS_SPU_THREAD_STOP_TRY_RECEIVE_EVENT = 0x0111, SYS_SPU_THREAD_STOP_SWITCH_SYSTEM_MODULE = 0x0120, }; @@ -92,8 +92,8 @@ struct sys_spu_thread_group_attribute enum : u32 { - SYS_SPU_THREAD_OPTION_NONE = 0, - SYS_SPU_THREAD_OPTION_ASYNC_INTR_ENABLE = 1, + SYS_SPU_THREAD_OPTION_NONE = 0, + SYS_SPU_THREAD_OPTION_ASYNC_INTR_ENABLE = 1, SYS_SPU_THREAD_OPTION_DEC_SYNC_TB_ENABLE = 2, }; @@ -117,7 +117,7 @@ struct sys_spu_segment ENABLE_BITWISE_SERIALIZATION; be_t type; // copy, fill, info - be_t ls; // local storage address + be_t ls; // local storage address be_t size; union @@ -131,13 +131,13 @@ CHECK_SIZE(sys_spu_segment, 0x18); enum : u32 { - SYS_SPU_IMAGE_TYPE_USER = 0, + SYS_SPU_IMAGE_TYPE_USER = 0, SYS_SPU_IMAGE_TYPE_KERNEL = 1, }; struct sys_spu_image { - be_t type; // user, kernel + be_t type; // user, kernel be_t entry_point; // Note: in kernel mode it's used to store id vm::bptr segs; be_t nsegs; @@ -185,7 +185,7 @@ struct sys_spu_image auto* seg = &segs[num_segs++]; seg->type = SYS_SPU_SEGMENT_TYPE_COPY; - seg->ls = static_cast(phdr.p_vaddr); + seg->ls = static_cast(phdr.p_vaddr); seg->size = static_cast(phdr.p_filesz); seg->addr = static_cast(phdr.p_offset + src); } @@ -199,7 +199,7 @@ struct sys_spu_image auto* seg = &segs[num_segs++]; seg->type = SYS_SPU_SEGMENT_TYPE_FILL; - seg->ls = static_cast(phdr.p_vaddr + phdr.p_filesz); + seg->ls = static_cast(phdr.p_vaddr + phdr.p_filesz); seg->size = static_cast(phdr.p_memsz - phdr.p_filesz); seg->addr = 0; } @@ -233,7 +233,7 @@ struct sys_spu_image enum : u32 { SYS_SPU_IMAGE_PROTECT = 0, - SYS_SPU_IMAGE_DIRECT = 1, + SYS_SPU_IMAGE_DIRECT = 1, }; struct lv2_spu_image : lv2_obj @@ -245,9 +245,7 @@ struct lv2_spu_image : lv2_obj const s32 nsegs; lv2_spu_image(u32 entry, vm::ptr segs, s32 nsegs) - : e_entry(entry) - , segs(segs) - , nsegs(nsegs) + : e_entry(entry), segs(segs), nsegs(nsegs) { } @@ -276,49 +274,37 @@ struct lv2_spu_group const u32 id; const u32 max_num; const u32 mem_size; - const s32 type; // SPU Thread Group Type + const s32 type; // SPU Thread Group Type lv2_memory_container* const ct; // Memory Container const bool has_scheduler_context; u32 max_run; shared_mutex mutex; - atomic_t init; // Initialization Counter + atomic_t init; // Initialization Counter atomic_t prio{}; // SPU Thread Group Priority - atomic_t run_state; // SPU Thread Group State - atomic_t exit_status; // SPU Thread Group Exit Status - atomic_t join_state; // flags used to detect exit cause and signal - atomic_t running = 0; // Number of running threads + atomic_t run_state; // SPU Thread Group State + atomic_t exit_status; // SPU Thread Group Exit Status + atomic_t join_state; // flags used to detect exit cause and signal + atomic_t running = 0; // Number of running threads atomic_t spurs_running = 0; atomic_t stop_count = 0; - atomic_t wait_term_count = 0; + atomic_t wait_term_count = 0; u32 waiter_spu_index = -1; // Index of SPU executing a waiting syscall class ppu_thread* waiter = nullptr; bool set_terminate = false; - std::array>, 8> threads; // SPU Threads - std::array threads_map; // SPU Threads map based number + std::array>, 8> threads; // SPU Threads + std::array threads_map; // SPU Threads map based number std::array>, 8> imgs; // Entry points, SPU image segments - std::array, 8> args; // SPU Thread Arguments + std::array, 8> args; // SPU Thread Arguments - shared_ptr ep_run; // port for SYS_SPU_THREAD_GROUP_EVENT_RUN events + shared_ptr ep_run; // port for SYS_SPU_THREAD_GROUP_EVENT_RUN events shared_ptr ep_exception; // TODO: SYS_SPU_THREAD_GROUP_EVENT_EXCEPTION shared_ptr ep_sysmodule; // TODO: SYS_SPU_THREAD_GROUP_EVENT_SYSTEM_MODULE lv2_spu_group(std::string name, u32 num, s32 _prio, s32 type, lv2_memory_container* ct, bool uses_scheduler, u32 mem_size) noexcept - : name(std::move(name)) - , id(idm::last_id()) - , max_num(num) - , mem_size(mem_size) - , type(type) - , ct(ct) - , has_scheduler_context(uses_scheduler) - , max_run(num) - , init(0) - , run_state(SPU_THREAD_GROUP_STATUS_NOT_INITIALIZED) - , exit_status(0) - , join_state(0) - , args({}) + : name(std::move(name)), id(idm::last_id()), max_num(num), mem_size(mem_size), type(type), ct(ct), has_scheduler_context(uses_scheduler), max_run(num), init(0), run_state(SPU_THREAD_GROUP_STATUS_NOT_INITIALIZED), exit_status(0), join_state(0), args({}) { threads_map.fill(-1); prio.raw().prio = _prio; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_ss.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_ss.cpp index 7eb36d4e1..4ed94e146 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_ss.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_ss.cpp @@ -12,7 +12,7 @@ #include #ifdef _WIN32 -#include +#include #include #endif @@ -37,22 +37,22 @@ struct lv2_update_manager u64 system_sw_version; std::unordered_map eeprom_map // offset, value - { - // system language - // *i think* this gives english - {0x48C18, 0x00}, - {0x48C19, 0x00}, - {0x48C1A, 0x00}, - {0x48C1B, 0x01}, - // system language end + { + // system language + // *i think* this gives english + {0x48C18, 0x00}, + {0x48C19, 0x00}, + {0x48C1A, 0x00}, + {0x48C1B, 0x01}, + // system language end - // vsh target (seems it can be 0xFFFFFFFE, 0xFFFFFFFF, 0x00000001 default: 0x00000000 / vsh sets it to 0x00000000 on boot if it isn't 0x00000000) - {0x48C1C, 0x00}, - {0x48C1D, 0x00}, - {0x48C1E, 0x00}, - {0x48C1F, 0x00} - // vsh target end - }; + // vsh target (seems it can be 0xFFFFFFFE, 0xFFFFFFFF, 0x00000001 default: 0x00000000 / vsh sets it to 0x00000000 on boot if it isn't 0x00000000) + {0x48C1C, 0x00}, + {0x48C1D, 0x00}, + {0x48C1E, 0x00}, + {0x48C1F, 0x00} + // vsh target end + }; mutable std::shared_mutex eeprom_mutex; std::unordered_set malloc_set; @@ -86,22 +86,22 @@ struct lv2_update_manager } }; -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](auto error) - { - switch (error) { - STR_CASE(SYS_SS_RNG_ERROR_INVALID_PKG); - STR_CASE(SYS_SS_RNG_ERROR_ENOMEM); - STR_CASE(SYS_SS_RNG_ERROR_EAGAIN); - STR_CASE(SYS_SS_RNG_ERROR_EFAULT); - STR_CASE(SYS_SS_RTC_ERROR_UNK); - } + switch (error) + { + STR_CASE(SYS_SS_RNG_ERROR_INVALID_PKG); + STR_CASE(SYS_SS_RNG_ERROR_ENOMEM); + STR_CASE(SYS_SS_RNG_ERROR_EAGAIN); + STR_CASE(SYS_SS_RNG_ERROR_EFAULT); + STR_CASE(SYS_SS_RTC_ERROR_UNK); + } - return unknown; - }); + return unknown; + }); } LOG_CHANNEL(sys_ss); @@ -158,7 +158,8 @@ error_code sys_ss_access_control_engine(u64 pkg_id, u64 a2, u64 a3) sys_ss.success("sys_ss_access_control_engine(pkg_id=0x%llx, a2=0x%llx, a3=0x%llx)", pkg_id, a2, a3); const u64 authid = g_ps3_process_info.self_info.valid ? - g_ps3_process_info.self_info.prog_id_hdr.program_authority_id : 0; + g_ps3_process_info.self_info.prog_id_hdr.program_authority_id : + 0; switch (pkg_id) { @@ -231,7 +232,7 @@ error_code sys_ss_appliance_info_manager(u32 code, vm::ptr buffer) case 0x19002: { // AIM_get_device_type - constexpr u8 product_code[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89 }; + constexpr u8 product_code[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89}; std::memcpy(buffer.get_ptr(), product_code, 16); if (g_cfg.core.debug_console_mode) buffer[15] = 0x81; // DECR @@ -240,7 +241,7 @@ error_code sys_ss_appliance_info_manager(u32 code, vm::ptr buffer) case 0x19003: { // AIM_get_device_id - constexpr u8 idps[] = { 0x00, 0x00, 0x00, 0x01, 0x00, 0x89, 0x00, 0x0B, 0x14, 0x00, 0xEF, 0xDD, 0xCA, 0x25, 0x52, 0x66 }; + constexpr u8 idps[] = {0x00, 0x00, 0x00, 0x01, 0x00, 0x89, 0x00, 0x0B, 0x14, 0x00, 0xEF, 0xDD, 0xCA, 0x25, 0x52, 0x66}; std::memcpy(buffer.get_ptr(), idps, 16); if (g_cfg.core.debug_console_mode) { @@ -252,14 +253,14 @@ error_code sys_ss_appliance_info_manager(u32 code, vm::ptr buffer) case 0x19004: { // AIM_get_ps_code - constexpr u8 pscode[] = { 0x00, 0x01, 0x00, 0x85, 0x00, 0x07, 0x00, 0x04 }; + constexpr u8 pscode[] = {0x00, 0x01, 0x00, 0x85, 0x00, 0x07, 0x00, 0x04}; std::memcpy(buffer.get_ptr(), pscode, 8); break; } case 0x19005: { // AIM_get_open_ps_id - be_t psid[2] = { +g_cfg.sys.console_psid_high, +g_cfg.sys.console_psid_low }; + be_t psid[2] = {+g_cfg.sys.console_psid_high, +g_cfg.sys.console_psid_low}; std::memcpy(buffer.get_ptr(), psid, 16); break; } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_storage.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_storage.cpp index d5ee3bbda..061849656 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_storage.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_storage.cpp @@ -17,7 +17,7 @@ namespace // This is probably wrong and should be assigned per fd or something atomic_ptr asyncequeue; }; -} +} // namespace error_code sys_storage_open(u64 device, u64 mode, vm::ptr fd, u64 flags) { @@ -260,19 +260,26 @@ error_code sys_storage_get_device_info(u64 device, vm::ptr bu // see ata_hdd for explanation switch (dev_num) { - case 0: buffer->sector_count = 0x80000; + case 0: + buffer->sector_count = 0x80000; break; - case 1: buffer->sector_count = 0x75F8; + case 1: + buffer->sector_count = 0x75F8; break; - case 2: buffer->sector_count = 0x63E00; + case 2: + buffer->sector_count = 0x63E00; break; - case 3: buffer->sector_count = 0x8000; + case 3: + buffer->sector_count = 0x8000; break; - case 4: buffer->sector_count = 0x400; + case 4: + buffer->sector_count = 0x400; break; - case 5: buffer->sector_count = 0x2000; + case 5: + buffer->sector_count = 0x2000; break; - case 6: buffer->sector_count = 0x200; + case 6: + buffer->sector_count = 0x200; break; } } @@ -294,13 +301,17 @@ error_code sys_storage_get_device_info(u64 device, vm::ptr bu // see ata_hdd for explanation switch (dev_num) { - case 0: buffer->sector_count = 0x8000; + case 0: + buffer->sector_count = 0x8000; break; - case 1: buffer->sector_count = 0x77F8; + case 1: + buffer->sector_count = 0x77F8; break; - case 2: buffer->sector_count = 0x100; // offset, 0x20000 + case 2: + buffer->sector_count = 0x100; // offset, 0x20000 break; - case 3: buffer->sector_count = 0x400; + case 3: + buffer->sector_count = 0x400; break; } } @@ -322,7 +333,8 @@ error_code sys_storage_get_device_info(u64 device, vm::ptr bu // see ata_hdd for explanation switch (dev_num) { - case 0: buffer->sector_count = 0x7FFFFFFF; + case 0: + buffer->sector_count = 0x7FFFFFFF; break; } } @@ -338,8 +350,14 @@ error_code sys_storage_get_device_config(vm::ptr storages, vm::ptr dev { sys_storage.todo("sys_storage_get_device_config(storages=*0x%x, devices=*0x%x)", storages, devices); - if (storages) *storages = 6; else return CELL_EFAULT; - if (devices) *devices = 17; else return CELL_EFAULT; + if (storages) + *storages = 6; + else + return CELL_EFAULT; + if (devices) + *devices = 17; + else + return CELL_EFAULT; return CELL_OK; } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_storage.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_storage.h index 9916f2e58..2312268e7 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_storage.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_storage.h @@ -34,10 +34,7 @@ struct lv2_storage const u64 flags; lv2_storage(u64 device_id, fs::file&& file, u64 mode, u64 flags) - : device_id(device_id) - , file(std::move(file)) - , mode(mode) - , flags(flags) + : device_id(device_id), file(std::move(file)), mode(mode), flags(flags) { } }; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_sync.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_sync.h index bf99bcb05..d13bf7754 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_sync.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_sync.h @@ -12,48 +12,48 @@ // attr_protocol (waiting scheduling policy) enum lv2_protocol : u8 { - SYS_SYNC_FIFO = 0x1, // First In, First Out Order - SYS_SYNC_PRIORITY = 0x2, // Priority Order - SYS_SYNC_PRIORITY_INHERIT = 0x3, // Basic Priority Inheritance Protocol - SYS_SYNC_RETRY = 0x4, // Not selected while unlocking + SYS_SYNC_FIFO = 0x1, // First In, First Out Order + SYS_SYNC_PRIORITY = 0x2, // Priority Order + SYS_SYNC_PRIORITY_INHERIT = 0x3, // Basic Priority Inheritance Protocol + SYS_SYNC_RETRY = 0x4, // Not selected while unlocking }; enum : u32 { - SYS_SYNC_ATTR_PROTOCOL_MASK = 0xf, + SYS_SYNC_ATTR_PROTOCOL_MASK = 0xf, }; // attr_recursive (recursive locks policy) enum { - SYS_SYNC_RECURSIVE = 0x10, - SYS_SYNC_NOT_RECURSIVE = 0x20, + SYS_SYNC_RECURSIVE = 0x10, + SYS_SYNC_NOT_RECURSIVE = 0x20, SYS_SYNC_ATTR_RECURSIVE_MASK = 0xf0, }; // attr_pshared (sharing among processes policy) enum { - SYS_SYNC_PROCESS_SHARED = 0x100, - SYS_SYNC_NOT_PROCESS_SHARED = 0x200, - SYS_SYNC_ATTR_PSHARED_MASK = 0xf00, + SYS_SYNC_PROCESS_SHARED = 0x100, + SYS_SYNC_NOT_PROCESS_SHARED = 0x200, + SYS_SYNC_ATTR_PSHARED_MASK = 0xf00, }; // attr_flags (creation policy) enum { - SYS_SYNC_NEWLY_CREATED = 0x1, // Create new object, fails if specified IPC key exists - SYS_SYNC_NOT_CREATE = 0x2, // Reference existing object, fails if IPC key not found - SYS_SYNC_NOT_CARE = 0x3, // Reference existing object, create new one if IPC key not found - SYS_SYNC_ATTR_FLAGS_MASK = 0xf, + SYS_SYNC_NEWLY_CREATED = 0x1, // Create new object, fails if specified IPC key exists + SYS_SYNC_NOT_CREATE = 0x2, // Reference existing object, fails if IPC key not found + SYS_SYNC_NOT_CARE = 0x3, // Reference existing object, create new one if IPC key not found + SYS_SYNC_ATTR_FLAGS_MASK = 0xf, }; // attr_adaptive enum { - SYS_SYNC_ADAPTIVE = 0x1000, - SYS_SYNC_NOT_ADAPTIVE = 0x2000, - SYS_SYNC_ATTR_ADAPTIVE_MASK = 0xf000, + SYS_SYNC_ADAPTIVE = 0x1000, + SYS_SYNC_NOT_ADAPTIVE = 0x2000, + SYS_SYNC_ATTR_ADAPTIVE_MASK = 0xf000, }; enum ppu_thread_status : u32; @@ -89,10 +89,14 @@ public: SAVESTATE_INIT_POS(4); // Dependency on PPUs lv2_obj() noexcept = default; - lv2_obj(u32 i) noexcept : exists{ i } {} - lv2_obj(lv2_obj&& rhs) noexcept : exists{ +rhs.exists } {} + lv2_obj(u32 i) noexcept : exists{i} {} + lv2_obj(lv2_obj&& rhs) noexcept : exists{+rhs.exists} {} lv2_obj(utils::serial&) noexcept {} - lv2_obj& operator=(lv2_obj&& rhs) noexcept { exists = +rhs.exists; return *this; } + lv2_obj& operator=(lv2_obj&& rhs) noexcept + { + exists = +rhs.exists; + return *this; + } void save(utils::serial&) {} // Existence validation (workaround for shared-ptr ref-counting) @@ -233,19 +237,19 @@ public: atomic_storage::release(first, object); object->prio.atomic_op([order = ++g_priority_order_tag](std::common_type_t()->prio.load())>& prio) - { - if constexpr (requires { +std::declval().preserve_bit; } ) { - if (prio.preserve_bit) + if constexpr (requires { +std::declval().preserve_bit; }) { - // Restoring state on load - prio.preserve_bit = 0; - return; + if (prio.preserve_bit) + { + // Restoring state on load + prio.preserve_bit = 0; + return; + } } - } - prio.order = order; - }); + prio.order = order; + }); } private: @@ -343,63 +347,63 @@ public: // EAGAIN for IDM IDs shortage CellError error = CELL_EAGAIN; - if (!idm::import([&]() -> shared_ptr - { - shared_ptr result = make(); - - auto finalize_construct = [&]() -> shared_ptr - { - if ((error = result->on_id_create())) + if (!idm::import ([&]() -> shared_ptr { - result.reset(); - } + shared_ptr result = make(); - return std::move(result); - }; + auto finalize_construct = [&]() -> shared_ptr + { + if ((error = result->on_id_create())) + { + result.reset(); + } - if (pshared != SYS_SYNC_PROCESS_SHARED) - { - // Creation of unique (non-shared) object handle - return finalize_construct(); - } + return std::move(result); + }; - auto& ipc_container = g_fxo->get>(); + if (pshared != SYS_SYNC_PROCESS_SHARED) + { + // Creation of unique (non-shared) object handle + return finalize_construct(); + } - if (flags == SYS_SYNC_NOT_CREATE) - { - result = ipc_container.get(ipc_key); + auto& ipc_container = g_fxo->get>(); + + if (flags == SYS_SYNC_NOT_CREATE) + { + result = ipc_container.get(ipc_key); + + if (!result) + { + error = CELL_ESRCH; + return result; + } + + // Run on_id_create() on existing object + return finalize_construct(); + } + + bool added = false; + std::tie(added, result) = ipc_container.add(ipc_key, finalize_construct, flags != SYS_SYNC_NEWLY_CREATED); + + if (!added) + { + if (flags == SYS_SYNC_NEWLY_CREATED) + { + // Object already exists but flags does not allow it + error = CELL_EEXIST; + + // We specified we do not want to peek pointer's value, result must be empty + AUDIT(!result); + return result; + } + + // Run on_id_create() on existing object + return finalize_construct(); + } - if (!result) - { - error = CELL_ESRCH; return result; - } - - // Run on_id_create() on existing object - return finalize_construct(); - } - - bool added = false; - std::tie(added, result) = ipc_container.add(ipc_key, finalize_construct, flags != SYS_SYNC_NEWLY_CREATED); - - if (!added) - { - if (flags == SYS_SYNC_NEWLY_CREATED) - { - // Object already exists but flags does not allow it - error = CELL_EEXIST; - - // We specified we do not want to peek pointer's value, result must be empty - AUDIT(!result); - return result; - } - - // Run on_id_create() on existing object - return finalize_construct(); - } - - return result; - })) + })) { return error; } @@ -430,9 +434,9 @@ public: g_fxo->need>(); g_fxo->get>().add(ipc_key, [&]() - { - return make; - }); + { + return make; + }); } // Ensure no error @@ -444,7 +448,10 @@ public: static std::function load_func(shared_ptr make, u64 pshared = umax) { const u64 key = make->key; - return [ptr = load(key, make, pshared)](void* storage) { *static_cast*>(storage) = ptr; }; + return [ptr = load(key, make, pshared)](void* storage) + { + *static_cast*>(storage) = ptr; + }; } static bool wait_timeout(u64 usec, ppu_thread* cpu = {}, bool scale = true, bool is_usleep = false); diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_time.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_time.cpp index 539bb9ded..0e4adff54 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_time.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_time.cpp @@ -18,7 +18,7 @@ static u64 systemtime_offset; #ifdef _WIN32 -#include +#include struct time_aux_info_t { @@ -44,8 +44,8 @@ const auto s_time_aux_info = []() -> time_aux_info_t GetSystemTimeAsFileTime(&ftime); // get time in 100ns units since January 1, 1601 (UTC) time_aux_info_t result; - result.perf_freq = freq.QuadPart; - result.start_time = start.QuadPart; + result.perf_freq = freq.QuadPart; + result.start_time = start.QuadPart; result.start_ftime = (ftime.dwLowDateTime | static_cast(ftime.dwHighDateTime) << 32) - 116444736000000000; return result; @@ -58,7 +58,7 @@ const auto s_time_aux_info = []() -> time_aux_info_t #define TIMER_ABSTIME -1 // The opengroup spec isn't clear on the mapping from REALTIME to CALENDAR being appropriate or not. // http://pubs.opengroup.org/onlinepubs/009695299/basedefs/time.h.html -#define CLOCK_REALTIME 1 // #define CALENDAR_CLOCK 1 from mach/clock_types.h +#define CLOCK_REALTIME 1 // #define CALENDAR_CLOCK 1 from mach/clock_types.h #define CLOCK_MONOTONIC 0 // #define SYSTEM_CLOCK 0 // the mach kernel uses struct mach_timespec, so struct timespec is loaded from for compatability @@ -94,7 +94,7 @@ static int clock_gettime(int clk_id, struct timespec* tp) } double diff = (mach_absolute_time() - mt_timestart) * mt_timebase; - tp->tv_sec = diff * MT_NANO; + tp->tv_sec = diff * MT_NANO; tp->tv_nsec = diff - (tp->tv_sec * MT_GIGA); } else // other clk_ids are mapped to the coresponding mach clock_service @@ -106,7 +106,7 @@ static int clock_gettime(int clk_id, struct timespec* tp) retval = clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); - tp->tv_sec = mts.tv_sec; + tp->tv_sec = mts.tv_sec; tp->tv_nsec = mts.tv_nsec; } @@ -183,7 +183,8 @@ u64 get_timebased_time() const u64 result = (static_cast(ts.tv_sec) * g_timebase_freq + static_cast(ts.tv_nsec) * g_timebase_freq / 1000000000ull) * g_cfg.core.clocks_scale / 100u; #endif - if (result) return result - g_timebase_offs; + if (result) + return result - g_timebase_offs; } } @@ -244,7 +245,8 @@ u64 get_system_time() const u64 result = static_cast(ts.tv_sec) * 1000000ull + static_cast(ts.tv_nsec) / 1000u; #endif - if (result) return result; + if (result) + return result; } } @@ -378,7 +380,7 @@ error_code sys_time_get_current_time(vm::ptr sec, vm::ptr nsec) if (g_cfg.core.clocks_scale == 100) { // get the seconds from the system clock, and add the console time offset (which might be negative) - *sec = ts.tv_sec + g_cfg.sys.console_time_offset; + *sec = ts.tv_sec + g_cfg.sys.console_time_offset; if (!nsec) { diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_timer.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_timer.cpp index 5e6c3d20c..6665b58b9 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_timer.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_timer.cpp @@ -25,20 +25,13 @@ struct lv2_timer_thread lv2_timer_thread(); void operator()(); - //SAVESTATE_INIT_POS(46); // FREE SAVESTATE_INIT_POS number + // SAVESTATE_INIT_POS(46); // FREE SAVESTATE_INIT_POS number static constexpr auto thread_name = "Timer Thread"sv; }; lv2_timer::lv2_timer(utils::serial& ar) - : lv2_obj(1) - , state(ar) - , port(lv2_event_queue::load_ptr(ar, port, "timer")) - , source(ar) - , data1(ar) - , data2(ar) - , expire(ar) - , period(ar) + : lv2_obj(1), state(ar), port(lv2_event_queue::load_ptr(ar, port, "timer")), source(ar), data1(ar), data2(ar), expire(ar), period(ar) { } @@ -106,12 +99,12 @@ u64 lv2_timer::check_unlocked(u64 _now) noexcept lv2_timer_thread::lv2_timer_thread() { Emu.PostponeInitCode([this]() - { - idm::select([&](u32 id, lv2_timer&) { - timers.emplace_back(idm::get_unlocked(id)); + idm::select([&](u32 id, lv2_timer&) + { + timers.emplace_back(idm::get_unlocked(id)); + }); }); - }); } void lv2_timer_thread::operator()() @@ -202,15 +195,15 @@ error_code sys_timer_destroy(ppu_thread& ppu, u32 timer_id) sys_timer.warning("sys_timer_destroy(timer_id=0x%x)", timer_id); auto timer = idm::withdraw(timer_id, [&](lv2_timer& timer) -> CellError - { - if (reader_lock lock(timer.mutex); lv2_obj::check(timer.port)) { - return CELL_EISCONN; - } + if (reader_lock lock(timer.mutex); lv2_obj::check(timer.port)) + { + return CELL_EISCONN; + } - timer.exists--; - return {}; - }); + timer.exists--; + return {}; + }); if (!timer) { @@ -243,12 +236,12 @@ error_code sys_timer_get_information(ppu_thread& ppu, u32 timer_id, vm::ptr(timer_id, [&](lv2_timer& timer) - { - std::lock_guard lock(timer.mutex); + { + std::lock_guard lock(timer.mutex); - timer.check_unlocked(now); - timer.get_information(_info); - }); + timer.check_unlocked(now); + timer.get_information(_info); + }); if (!timer) { @@ -275,49 +268,51 @@ error_code _sys_timer_start(ppu_thread& ppu, u32 timer_id, u64 base_time, u64 pe } const auto timer = idm::check(timer_id, [&](lv2_timer& timer) -> CellError - { - std::lock_guard lock(timer.mutex); - - // LV2 Disassembly: Simple nullptr check (assignment test, do not use lv2_obj::check here) - if (!timer.port) { - return CELL_ENOTCONN; - } + std::lock_guard lock(timer.mutex); - timer.check_unlocked(start_time); - if (timer.state != SYS_TIMER_STATE_STOP) - { - return CELL_EBUSY; - } + // LV2 Disassembly: Simple nullptr check (assignment test, do not use lv2_obj::check here) + if (!timer.port) + { + return CELL_ENOTCONN; + } - if (!period && start_time >= base_time) - { - // Invalid oneshot - return CELL_ETIMEDOUT; - } + timer.check_unlocked(start_time); + if (timer.state != SYS_TIMER_STATE_STOP) + { + return CELL_EBUSY; + } - const u64 expire = period == 0 ? base_time : // oneshot - base_time == 0 ? utils::add_saturate(start_time, period) : // periodic timer with no base (using start time as base) - start_time < utils::add_saturate(base_time, period) ? utils::add_saturate(base_time, period) : // periodic with base time over start time - [&]() -> u64 // periodic timer base before start time (align to be at least a period over start time) + if (!period && start_time >= base_time) + { + // Invalid oneshot + return CELL_ETIMEDOUT; + } + + const u64 expire = period == 0 ? base_time : // oneshot + base_time == 0 ? utils::add_saturate(start_time, period) : + // periodic timer with no base (using start time as base) + start_time < utils::add_saturate(base_time, period) ? utils::add_saturate(base_time, period) : + // periodic with base time over start time + [&]() -> u64 // periodic timer base before start time (align to be at least a period over start time) { // Optimized from a loop in LV2: - // do - // { - // base_time += period; - // } - // while (base_time < start_time); + // do + // { + // base_time += period; + // } + // while (base_time < start_time); const u64 start_time_with_base_time_reminder = utils::add_saturate(start_time - start_time % period, base_time % period); return utils::add_saturate(start_time_with_base_time_reminder, start_time_with_base_time_reminder < start_time ? period : 0); }(); - timer.expire = expire; - timer.period = period; - timer.state = SYS_TIMER_STATE_RUN; - return {}; - }); + timer.expire = expire; + timer.period = period; + timer.state = SYS_TIMER_STATE_RUN; + return {}; + }); if (!timer) { @@ -334,7 +329,7 @@ error_code _sys_timer_start(ppu_thread& ppu, u32 timer_id, u64 base_time, u64 pe return timer.ret; } - g_fxo->get>()([]{}); + g_fxo->get>()([] {}); return CELL_OK; } @@ -346,11 +341,11 @@ error_code sys_timer_stop(ppu_thread& ppu, u32 timer_id) sys_timer.trace("sys_timer_stop()"); const auto timer = idm::check(timer_id, [now = get_guest_system_time(), notify = lv2_obj::notify_all_t()](lv2_timer& timer) - { - std::lock_guard lock(timer.mutex); - timer.check_unlocked(now); - timer.state = SYS_TIMER_STATE_STOP; - }); + { + std::lock_guard lock(timer.mutex); + timer.check_unlocked(now); + timer.state = SYS_TIMER_STATE_STOP; + }); if (!timer) { @@ -367,28 +362,28 @@ error_code sys_timer_connect_event_queue(ppu_thread& ppu, u32 timer_id, u32 queu sys_timer.warning("sys_timer_connect_event_queue(timer_id=0x%x, queue_id=0x%x, name=0x%llx, data1=0x%llx, data2=0x%llx)", timer_id, queue_id, name, data1, data2); const auto timer = idm::check(timer_id, [&](lv2_timer& timer) -> CellError - { - auto found = idm::get_unlocked(queue_id); - - if (!found) { - return CELL_ESRCH; - } + auto found = idm::get_unlocked(queue_id); - std::lock_guard lock(timer.mutex); + if (!found) + { + return CELL_ESRCH; + } - if (lv2_obj::check(timer.port)) - { - return CELL_EISCONN; - } + std::lock_guard lock(timer.mutex); - // Connect event queue - timer.port = found; - timer.source = name ? name : (u64{process_getpid() + 0u} << 32) | u64{timer_id}; - timer.data1 = data1; - timer.data2 = data2; - return {}; - }); + if (lv2_obj::check(timer.port)) + { + return CELL_EISCONN; + } + + // Connect event queue + timer.port = found; + timer.source = name ? name : (u64{process_getpid() + 0u} << 32) | u64{timer_id}; + timer.data1 = data1; + timer.data2 = data2; + return {}; + }); if (!timer) { @@ -410,20 +405,20 @@ error_code sys_timer_disconnect_event_queue(ppu_thread& ppu, u32 timer_id) sys_timer.warning("sys_timer_disconnect_event_queue(timer_id=0x%x)", timer_id); const auto timer = idm::check(timer_id, [now = get_guest_system_time(), notify = lv2_obj::notify_all_t()](lv2_timer& timer) -> CellError - { - std::lock_guard lock(timer.mutex); - - timer.check_unlocked(now); - timer.state = SYS_TIMER_STATE_STOP; - - if (!lv2_obj::check(timer.port)) { - return CELL_ENOTCONN; - } + std::lock_guard lock(timer.mutex); - timer.port.reset(); - return {}; - }); + timer.check_unlocked(now); + timer.state = SYS_TIMER_STATE_STOP; + + if (!lv2_obj::check(timer.port)) + { + return CELL_ENOTCONN; + } + + timer.port.reset(); + return {}; + }); if (!timer) { diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_timer.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_timer.h index 8a0b2eda8..854ba9977 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_timer.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_timer.h @@ -3,12 +3,11 @@ #include "sys_event.h" #include "Emu/Memory/vm_ptr.h" - // Timer State enum : u32 { SYS_TIMER_STATE_STOP = 0, - SYS_TIMER_STATE_RUN = 1, + SYS_TIMER_STATE_RUN = 1, }; struct sys_timer_information_t @@ -48,13 +47,13 @@ struct lv2_timer : lv2_obj { info.timer_state = state; info.next_expire = expire; - info.period = period; + info.period = period; } else { info.timer_state = SYS_TIMER_STATE_STOP; info.next_expire = 0; - info.period = 0; + info.period = 0; } } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_trace.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_trace.cpp index f1ab81186..26f73a9fa 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_trace.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_trace.cpp @@ -3,8 +3,6 @@ #include "Emu/Cell/ErrorCodes.h" - - LOG_CHANNEL(sys_trace); // TODO: DEX/DECR mode support? diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_tty.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_tty.cpp index dcc142b81..3943acf9f 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_tty.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_tty.cpp @@ -35,7 +35,7 @@ error_code sys_tty_read(s32 ch, vm::ptr buf, u32 len, vm::ptr preadle } usz chars_to_read = 0; // number of chars that will be read from the input string - std::string tty_read; // string for storage of read chars + std::string tty_read; // string for storage of read chars if (len > 0) { @@ -123,19 +123,18 @@ error_code sys_tty_write([[maybe_unused]] ppu_thread& ppu, s32 ch, vm::cptr= 2u && [&]() - { - static thread_local u64 last_write = 0; + { + static thread_local u64 last_write = 0; - // Dump thread about every period which TTY was not being touched for about half a second - const u64 current = get_system_time(); - return current - std::exchange(last_write, current) >= (warning ? 500'000 : 3'000'000); - }()) + // Dump thread about every period which TTY was not being touched for about half a second + const u64 current = get_system_time(); + return current - std::exchange(last_write, current) >= (warning ? 500'000 : 3'000'000); + }()) { ppu_log.notice("\n%s", dump_useful_thread_info()); } diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_tty.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_tty.h index 8b35588cd..5363df302 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_tty.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_tty.h @@ -6,23 +6,23 @@ // TTY channels enum { - SYS_TTYP_PPU_STDIN = 0, - SYS_TTYP_PPU_STDOUT = 0, - SYS_TTYP_PPU_STDERR = 1, - SYS_TTYP_SPU_STDOUT = 2, - SYS_TTYP_USER1 = 3, - SYS_TTYP_USER2 = 4, - SYS_TTYP_USER3 = 5, - SYS_TTYP_USER4 = 6, - SYS_TTYP_USER5 = 7, - SYS_TTYP_USER6 = 8, - SYS_TTYP_USER7 = 9, - SYS_TTYP_USER8 = 10, - SYS_TTYP_USER9 = 11, - SYS_TTYP_USER10 = 12, - SYS_TTYP_USER11 = 13, - SYS_TTYP_USER12 = 14, - SYS_TTYP_USER13 = 15, + SYS_TTYP_PPU_STDIN = 0, + SYS_TTYP_PPU_STDOUT = 0, + SYS_TTYP_PPU_STDERR = 1, + SYS_TTYP_SPU_STDOUT = 2, + SYS_TTYP_USER1 = 3, + SYS_TTYP_USER2 = 4, + SYS_TTYP_USER3 = 5, + SYS_TTYP_USER4 = 6, + SYS_TTYP_USER5 = 7, + SYS_TTYP_USER6 = 8, + SYS_TTYP_USER7 = 9, + SYS_TTYP_USER8 = 10, + SYS_TTYP_USER9 = 11, + SYS_TTYP_USER10 = 12, + SYS_TTYP_USER11 = 13, + SYS_TTYP_USER12 = 14, + SYS_TTYP_USER13 = 15, }; class ppu_thread; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_uart.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_uart.cpp index 67e91b97a..f55410559 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_uart.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_uart.cpp @@ -16,16 +16,16 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](UartAudioCtrlID value) - { - switch (value) { - STR_CASE(UartAudioCtrlID::DAC_RESET); - STR_CASE(UartAudioCtrlID::DAC_DE_EMPHASIS); - STR_CASE(UartAudioCtrlID::AVCLK); - } + switch (value) + { + STR_CASE(UartAudioCtrlID::DAC_RESET); + STR_CASE(UartAudioCtrlID::DAC_DE_EMPHASIS); + STR_CASE(UartAudioCtrlID::AVCLK); + } - return unknown; - }); + return unknown; + }); } struct av_init_cmd : public ps3av_cmd @@ -35,9 +35,9 @@ struct av_init_cmd : public ps3av_cmd return sizeof(ps3av_pkt_av_init); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -51,7 +51,7 @@ struct av_init_cmd : public ps3av_cmd if (pkt->event_bit & PS3AV_EVENT_BIT_UNK) { // 0 or 255, probably ps2 backwards compatibility (inverted) - const ps3av_pkt_av_init_reply reply = { 0 }; + const ps3av_pkt_av_init_reply reply = {0}; vuart.write_resp(pkt->hdr.cid, PS3AV_STATUS_SUCCESS, &reply, sizeof(ps3av_pkt_av_init_reply)); return; @@ -68,9 +68,9 @@ struct av_fini_cmd : public ps3av_cmd return sizeof(ps3av_header); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -91,9 +91,9 @@ struct av_get_monitor_info_cmd : public ps3av_cmd return sizeof(ps3av_get_monitor_info); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -140,7 +140,7 @@ struct av_get_monitor_info_cmd : public ps3av_cmd } } - static void set_hdmi_display_cfg(vuart_av_thread &vuart, ps3av_get_monitor_info_reply &cfg, u8 avport) + static void set_hdmi_display_cfg(vuart_av_thread& vuart, ps3av_get_monitor_info_reply& cfg, u8 avport) { if (vuart.hdmi_behavior_mode != PS3AV_HDMI_BEHAVIOR_NORMAL && (vuart.hdmi_behavior_mode & PS3AV_HDMI_BEHAVIOR_EDID_PASS)) { @@ -150,18 +150,18 @@ struct av_get_monitor_info_cmd : public ps3av_cmd // Report maximum support - static constexpr u8 mon_id[sizeof(cfg.monitor_id)] = { 0x4A, 0x13, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15 }; - static constexpr u8 mon_name[sizeof(cfg.monitor_name)] = { 'R', 'P', 'C', 'S', '3', ' ', 'V', 'i', 'r', 't', 'M', 'o', 'n', '\0', '\0', '\0' }; + static constexpr u8 mon_id[sizeof(cfg.monitor_id)] = {0x4A, 0x13, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15}; + static constexpr u8 mon_name[sizeof(cfg.monitor_name)] = {'R', 'P', 'C', 'S', '3', ' ', 'V', 'i', 'r', 't', 'M', 'o', 'n', '\0', '\0', '\0'}; static constexpr ps3av_info_audio audio_info[PS3AV_MON_INFO_AUDIO_BLK_MAX] = - { - { PS3AV_MON_INFO_AUDIO_TYPE_LPCM, 8, 0x7F, 0x07 }, - { PS3AV_MON_INFO_AUDIO_TYPE_AC3, 8, 0x7F, 0xFF }, - { PS3AV_MON_INFO_AUDIO_TYPE_AAC, 8, 0x7F, 0xFF }, - { PS3AV_MON_INFO_AUDIO_TYPE_DTS, 8, 0x7F, 0xFF }, - { PS3AV_MON_INFO_AUDIO_TYPE_DDP, 8, 0x7F, 0xFF }, - { PS3AV_MON_INFO_AUDIO_TYPE_DTS_HD, 8, 0x7F, 0xFF }, - { PS3AV_MON_INFO_AUDIO_TYPE_DOLBY_THD, 8, 0x7F, 0xFF }, - }; + { + {PS3AV_MON_INFO_AUDIO_TYPE_LPCM, 8, 0x7F, 0x07}, + {PS3AV_MON_INFO_AUDIO_TYPE_AC3, 8, 0x7F, 0xFF}, + {PS3AV_MON_INFO_AUDIO_TYPE_AAC, 8, 0x7F, 0xFF}, + {PS3AV_MON_INFO_AUDIO_TYPE_DTS, 8, 0x7F, 0xFF}, + {PS3AV_MON_INFO_AUDIO_TYPE_DDP, 8, 0x7F, 0xFF}, + {PS3AV_MON_INFO_AUDIO_TYPE_DTS_HD, 8, 0x7F, 0xFF}, + {PS3AV_MON_INFO_AUDIO_TYPE_DOLBY_THD, 8, 0x7F, 0xFF}, + }; cfg.avport = avport; memcpy(cfg.monitor_id, mon_id, sizeof(cfg.monitor_id)); @@ -241,9 +241,9 @@ struct av_get_bksv_list_cmd : public ps3av_cmd return sizeof(ps3av_pkt_get_bksv); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -285,9 +285,9 @@ struct av_enable_event_cmd : public ps3av_cmd return sizeof(ps3av_pkt_enable_event); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -308,9 +308,9 @@ struct av_disable_event_cmd : public ps3av_cmd return sizeof(ps3av_pkt_enable_event); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -332,9 +332,9 @@ struct av_tv_mute_cmd : public ps3av_cmd } // Behavior is unknown, but it seems that this pkt could be ignored - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -358,9 +358,9 @@ struct av_null_cmd : public ps3av_cmd return 12; } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -379,9 +379,9 @@ struct av_get_aksv_list_cmd : public ps3av_cmd return sizeof(ps3av_header); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr) + sizeof(ps3av_pkt_get_aksv_reply)) { @@ -414,9 +414,9 @@ struct video_disable_signal_cmd : public ps3av_cmd } // Cross color reduction filter setting in vsh. (AVMULTI) - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -459,9 +459,9 @@ struct av_video_ytrapcontrol_cmd : public ps3av_cmd } // Cross color reduction filter setting in vsh. (AVMULTI) - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_get_hw_info_reply) + sizeof(ps3av_pkt_reply_hdr)) { @@ -488,9 +488,9 @@ struct av_audio_mute_cmd : public ps3av_cmd return sizeof(ps3av_pkt_av_audio_mute); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (pkt->avport == static_cast(UartAudioAvport::AVMULTI_1)) { @@ -518,9 +518,9 @@ struct av_acp_ctrl_cmd : public ps3av_cmd return sizeof(ps3av_pkt_acp_ctrl); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (pkt->avport > static_cast(UartAudioAvport::HDMI_1) || (pkt->avport == static_cast(UartAudioAvport::HDMI_1) && !g_cfg.core.debug_console_mode)) @@ -542,9 +542,9 @@ struct av_set_acp_packet_cmd : public ps3av_cmd return sizeof(ps3av_pkt_set_acp_packet); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (pkt->avport > static_cast(UartAudioAvport::HDMI_1) || (pkt->avport == static_cast(UartAudioAvport::HDMI_1) && !g_cfg.core.debug_console_mode) || @@ -568,9 +568,9 @@ struct av_add_signal_ctl_cmd : public ps3av_cmd return sizeof(ps3av_pkt_add_signal_ctl); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -598,9 +598,9 @@ struct av_set_cgms_wss_cmd : public ps3av_cmd } // Something related to copy control on AVMULTI. - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -627,9 +627,9 @@ struct av_get_hw_conf_cmd : public ps3av_cmd return sizeof(ps3av_header); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_get_hw_info_reply) + sizeof(ps3av_pkt_reply_hdr)) { @@ -654,9 +654,9 @@ struct av_set_hdmi_mode_cmd : public ps3av_cmd return sizeof(ps3av_pkt_set_hdmi_mode); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (pkt->mode != PS3AV_HDMI_BEHAVIOR_NORMAL) { @@ -687,9 +687,9 @@ struct av_get_cec_status_cmd : public ps3av_cmd return sizeof(ps3av_header); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_av_get_cec_config_reply) + sizeof(ps3av_pkt_reply_hdr)) { @@ -709,9 +709,9 @@ struct video_init_cmd : public ps3av_cmd return sizeof(ps3av_header); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -730,9 +730,9 @@ struct video_set_format_cmd : public ps3av_cmd return sizeof(ps3av_pkt_video_format); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -757,9 +757,9 @@ struct video_set_route_cmd : public ps3av_cmd return 24; } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -778,9 +778,9 @@ struct video_set_pitch_cmd : public ps3av_cmd return sizeof(ps3av_pkt_video_set_pitch); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -805,9 +805,9 @@ struct video_get_hw_cfg_cmd : public ps3av_cmd return sizeof(ps3av_header); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_video_get_hw_cfg_reply) + sizeof(ps3av_pkt_reply_hdr)) { @@ -829,9 +829,9 @@ struct audio_init_cmd : public ps3av_cmd return sizeof(ps3av_header); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -852,9 +852,9 @@ struct audio_set_mode_cmd : public ps3av_cmd return sizeof(ps3av_pkt_audio_mode); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -873,7 +873,6 @@ struct audio_set_mode_cmd : public ps3av_cmd } private: - bool set_mode(const ps3av_pkt_audio_mode& pkt) { bool spdif_use_serial_buf = false; @@ -916,12 +915,12 @@ private: } case UartAudioAvport::SPDIF_0: { - avport_idx = RsxaudioAvportIdx::SPDIF_0; + avport_idx = RsxaudioAvportIdx::SPDIF_0; rsxaudio_port = RsxaudioPort::SPDIF_0; if (pkt.audio_source == UartAudioSource::SERIAL) { spdif_use_serial_buf = true; - avport_src = RsxaudioPort::SERIAL; + avport_src = RsxaudioPort::SERIAL; } else { @@ -932,12 +931,12 @@ private: } case UartAudioAvport::SPDIF_1: { - avport_idx = RsxaudioAvportIdx::SPDIF_1; + avport_idx = RsxaudioAvportIdx::SPDIF_1; rsxaudio_port = RsxaudioPort::SPDIF_1; if (pkt.audio_source == UartAudioSource::SERIAL) { spdif_use_serial_buf = true; - avport_src = RsxaudioPort::SERIAL; + avport_src = RsxaudioPort::SERIAL; } else { @@ -952,7 +951,8 @@ private: } } - if (static_cast(pkt.audio_fs.value()) > static_cast(UartAudioFreq::_192K)) return false; + if (static_cast(pkt.audio_fs.value()) > static_cast(UartAudioFreq::_192K)) + return false; const auto bit_cnt = [&]() { @@ -971,7 +971,7 @@ private: } bool commit_param(RsxaudioPort rsxaudio_port, RsxaudioAvportIdx avport, RsxaudioPort avport_src, UartAudioFreq freq, - UartAudioSampleSize bit_cnt, bool spdif_use_serial_buf, const u8 *cs_data) + UartAudioSampleSize bit_cnt, bool spdif_use_serial_buf, const u8* cs_data) { auto& rsxaudio_thread = g_fxo->get(); const auto avport_idx = static_cast>(avport); @@ -980,11 +980,11 @@ private: { switch (freq) { - case UartAudioFreq::_44K: return std::make_pair(8, SYS_RSXAUDIO_FREQ_BASE_352K); + case UartAudioFreq::_44K: return std::make_pair(8, SYS_RSXAUDIO_FREQ_BASE_352K); default: - case UartAudioFreq::_48K: return std::make_pair(8, SYS_RSXAUDIO_FREQ_BASE_384K); - case UartAudioFreq::_88K: return std::make_pair(4, SYS_RSXAUDIO_FREQ_BASE_352K); - case UartAudioFreq::_96K: return std::make_pair(4, SYS_RSXAUDIO_FREQ_BASE_384K); + case UartAudioFreq::_48K: return std::make_pair(8, SYS_RSXAUDIO_FREQ_BASE_384K); + case UartAudioFreq::_88K: return std::make_pair(4, SYS_RSXAUDIO_FREQ_BASE_352K); + case UartAudioFreq::_96K: return std::make_pair(4, SYS_RSXAUDIO_FREQ_BASE_384K); case UartAudioFreq::_176K: return std::make_pair(2, SYS_RSXAUDIO_FREQ_BASE_352K); case UartAudioFreq::_192K: return std::make_pair(2, SYS_RSXAUDIO_FREQ_BASE_384K); } @@ -995,13 +995,13 @@ private: case RsxaudioPort::SERIAL: { rsxaudio_thread.update_hw_param([&](auto& obj) - { - obj.serial_freq_base = freq_param.second; - obj.serial.freq_div = freq_param.first; - obj.serial.depth = rsxaudio_word_depth; - obj.serial.buf_empty_en = true; - obj.avport_src[avport_idx] = avport_src; - }); + { + obj.serial_freq_base = freq_param.second; + obj.serial.freq_div = freq_param.first; + obj.serial.depth = rsxaudio_word_depth; + obj.serial.buf_empty_en = true; + obj.avport_src[avport_idx] = avport_src; + }); break; } case RsxaudioPort::SPDIF_0: @@ -1010,15 +1010,15 @@ private: const u8 spdif_idx = rsxaudio_port == RsxaudioPort::SPDIF_1; rsxaudio_thread.update_hw_param([&](auto& obj) - { - obj.spdif_freq_base = freq_param.second; - obj.spdif[spdif_idx].freq_div = freq_param.first; - obj.spdif[spdif_idx].depth = rsxaudio_word_depth; - obj.spdif[spdif_idx].use_serial_buf = spdif_use_serial_buf; - obj.spdif[spdif_idx].buf_empty_en = true; - obj.avport_src[avport_idx] = avport_src; - memcpy(obj.spdif[spdif_idx].cs_data.data(), cs_data, sizeof(obj.spdif[spdif_idx].cs_data)); - }); + { + obj.spdif_freq_base = freq_param.second; + obj.spdif[spdif_idx].freq_div = freq_param.first; + obj.spdif[spdif_idx].depth = rsxaudio_word_depth; + obj.spdif[spdif_idx].use_serial_buf = spdif_use_serial_buf; + obj.spdif[spdif_idx].buf_empty_en = true; + obj.avport_src[avport_idx] = avport_src; + memcpy(obj.spdif[spdif_idx].cs_data.data(), cs_data, sizeof(obj.spdif[spdif_idx].cs_data)); + }); break; } default: @@ -1039,9 +1039,9 @@ struct audio_mute_cmd : public ps3av_cmd return 0; } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -1078,9 +1078,9 @@ struct audio_set_active_cmd : public ps3av_cmd return sizeof(ps3av_pkt_audio_set_active); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -1089,44 +1089,43 @@ struct audio_set_active_cmd : public ps3av_cmd } const bool requested_avports[SYS_RSXAUDIO_AVPORT_CNT] = - { - (pkt->audio_port & PS3AV_AUDIO_PORT_HDMI_0) != 0U, - (pkt->audio_port & PS3AV_AUDIO_PORT_HDMI_1) != 0U, - (pkt->audio_port & PS3AV_AUDIO_PORT_AVMULTI) != 0U, - (pkt->audio_port & PS3AV_AUDIO_PORT_SPDIF_0) != 0U, - (pkt->audio_port & PS3AV_AUDIO_PORT_SPDIF_1) != 0U - }; - - g_fxo->get().update_hw_param([&](auto &obj) - { - for (u8 avport_idx = 0; avport_idx < SYS_RSXAUDIO_AVPORT_CNT; avport_idx++) { - if (requested_avports[avport_idx]) + (pkt->audio_port & PS3AV_AUDIO_PORT_HDMI_0) != 0U, + (pkt->audio_port & PS3AV_AUDIO_PORT_HDMI_1) != 0U, + (pkt->audio_port & PS3AV_AUDIO_PORT_AVMULTI) != 0U, + (pkt->audio_port & PS3AV_AUDIO_PORT_SPDIF_0) != 0U, + (pkt->audio_port & PS3AV_AUDIO_PORT_SPDIF_1) != 0U}; + + g_fxo->get().update_hw_param([&](auto& obj) + { + for (u8 avport_idx = 0; avport_idx < SYS_RSXAUDIO_AVPORT_CNT; avport_idx++) { - switch (obj.avport_src[avport_idx]) + if (requested_avports[avport_idx]) { - case RsxaudioPort::SERIAL: - obj.serial.en = true; - break; - case RsxaudioPort::SPDIF_0: - case RsxaudioPort::SPDIF_1: - { - const u8 spdif_idx = obj.avport_src[avport_idx] == RsxaudioPort::SPDIF_1; - if (!obj.spdif[spdif_idx].use_serial_buf) + switch (obj.avport_src[avport_idx]) { - obj.spdif[spdif_idx].en = true; + case RsxaudioPort::SERIAL: + obj.serial.en = true; + break; + case RsxaudioPort::SPDIF_0: + case RsxaudioPort::SPDIF_1: + { + const u8 spdif_idx = obj.avport_src[avport_idx] == RsxaudioPort::SPDIF_1; + if (!obj.spdif[spdif_idx].use_serial_buf) + { + obj.spdif[spdif_idx].en = true; + } + break; + } + default: + break; } - break; - } - default: - break; } } - } - obj.serial.muted = false; - obj.spdif[1].muted = false; - }); + obj.serial.muted = false; + obj.spdif[1].muted = false; + }); vuart.write_resp(pkt->hdr.cid, PS3AV_STATUS_SUCCESS); } @@ -1139,9 +1138,9 @@ struct audio_set_inactive_cmd : public ps3av_cmd return sizeof(ps3av_pkt_audio_set_active); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -1149,24 +1148,24 @@ struct audio_set_inactive_cmd : public ps3av_cmd return; } - g_fxo->get().update_hw_param([&](auto &obj) - { - if ((pkt->audio_port & 0x8000'0000) == 0U) + g_fxo->get().update_hw_param([&](auto& obj) { - obj.avport_src.fill(RsxaudioPort::INVALID); - } - - obj.serial.en = false; - obj.serial.muted = true; - obj.spdif[1].muted = true; - for (u8 spdif_idx = 0; spdif_idx < SYS_RSXAUDIO_SPDIF_CNT; spdif_idx++) - { - if (!obj.spdif[spdif_idx].use_serial_buf) + if ((pkt->audio_port & 0x8000'0000) == 0U) { - obj.spdif[spdif_idx].en = false; + obj.avport_src.fill(RsxaudioPort::INVALID); } - } - }); + + obj.serial.en = false; + obj.serial.muted = true; + obj.spdif[1].muted = true; + for (u8 spdif_idx = 0; spdif_idx < SYS_RSXAUDIO_SPDIF_CNT; spdif_idx++) + { + if (!obj.spdif[spdif_idx].use_serial_buf) + { + obj.spdif[spdif_idx].en = false; + } + } + }); vuart.write_resp(pkt->hdr.cid, PS3AV_STATUS_SUCCESS); } @@ -1179,9 +1178,9 @@ struct audio_spdif_bit_cmd : public ps3av_cmd return sizeof(ps3av_pkt_audio_spdif_bit); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -1190,29 +1189,28 @@ struct audio_spdif_bit_cmd : public ps3av_cmd } const bool requested_avports[SYS_RSXAUDIO_AVPORT_CNT] = - { - (pkt->audio_port & PS3AV_AUDIO_PORT_HDMI_0) != 0U, - (pkt->audio_port & PS3AV_AUDIO_PORT_HDMI_1) != 0U, - (pkt->audio_port & PS3AV_AUDIO_PORT_AVMULTI) != 0U, - (pkt->audio_port & PS3AV_AUDIO_PORT_SPDIF_0) != 0U, - (pkt->audio_port & PS3AV_AUDIO_PORT_SPDIF_1) != 0U - }; - - g_fxo->get().update_hw_param([&](auto &obj) - { - for (u8 avport_idx = 0; avport_idx < SYS_RSXAUDIO_AVPORT_CNT; avport_idx++) { - if (requested_avports[avport_idx] && obj.avport_src[avport_idx] == RsxaudioPort::SPDIF_0) - { - auto &b_data = pkt->spdif_bit_data; + (pkt->audio_port & PS3AV_AUDIO_PORT_HDMI_0) != 0U, + (pkt->audio_port & PS3AV_AUDIO_PORT_HDMI_1) != 0U, + (pkt->audio_port & PS3AV_AUDIO_PORT_AVMULTI) != 0U, + (pkt->audio_port & PS3AV_AUDIO_PORT_SPDIF_0) != 0U, + (pkt->audio_port & PS3AV_AUDIO_PORT_SPDIF_1) != 0U}; - sys_uart.notice("[audio_spdif_bit_cmd] Data 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", - b_data[0], b_data[1], b_data[2], b_data[3], b_data[4], b_data[5], b_data[6], b_data[7], - b_data[8], b_data[9], b_data[10], b_data[11]); - break; + g_fxo->get().update_hw_param([&](auto& obj) + { + for (u8 avport_idx = 0; avport_idx < SYS_RSXAUDIO_AVPORT_CNT; avport_idx++) + { + if (requested_avports[avport_idx] && obj.avport_src[avport_idx] == RsxaudioPort::SPDIF_0) + { + auto& b_data = pkt->spdif_bit_data; + + sys_uart.notice("[audio_spdif_bit_cmd] Data 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", + b_data[0], b_data[1], b_data[2], b_data[3], b_data[4], b_data[5], b_data[6], b_data[7], + b_data[8], b_data[9], b_data[10], b_data[11]); + break; + } } - } - }); + }); vuart.write_resp(pkt->hdr.cid, PS3AV_STATUS_SUCCESS); } @@ -1225,9 +1223,9 @@ struct audio_ctrl_cmd : public ps3av_cmd return sizeof(ps3av_pkt_audio_ctrl); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -1254,14 +1252,14 @@ struct inc_avset_cmd : public ps3av_cmd { u16 get_size(vuart_av_thread& /*vuart*/, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (pkt->num_of_video_pkt > 2 || pkt->num_of_av_video_pkt > 4 || pkt->num_of_av_audio_pkt > 4) { return -1; } - const auto data_start = static_cast(pkt_buf) + sizeof(ps3av_pkt_inc_avset); + const auto data_start = static_cast(pkt_buf) + sizeof(ps3av_pkt_inc_avset); u64 video_pkt_sec_size = 0; u64 av_video_pkt_sec_size = 0; @@ -1269,26 +1267,26 @@ struct inc_avset_cmd : public ps3av_cmd for (u16 pkt_idx = 0; pkt_idx < pkt->num_of_video_pkt; pkt_idx++) { - video_pkt_sec_size += reinterpret_cast(&data_start[video_pkt_sec_size])->length + 4ULL; + video_pkt_sec_size += reinterpret_cast(&data_start[video_pkt_sec_size])->length + 4ULL; } for (u16 pkt_idx = 0; pkt_idx < pkt->num_of_av_video_pkt; pkt_idx++) { - av_video_pkt_sec_size += reinterpret_cast(&data_start[video_pkt_sec_size + av_video_pkt_sec_size])->length + 4ULL; + av_video_pkt_sec_size += reinterpret_cast(&data_start[video_pkt_sec_size + av_video_pkt_sec_size])->length + 4ULL; } for (u16 pkt_idx = 0; pkt_idx < pkt->num_of_av_audio_pkt; pkt_idx++) { - av_audio_pkt_sec_size += reinterpret_cast(&data_start[video_pkt_sec_size + av_video_pkt_sec_size + av_audio_pkt_sec_size])->length + 4ULL; + av_audio_pkt_sec_size += reinterpret_cast(&data_start[video_pkt_sec_size + av_video_pkt_sec_size + av_audio_pkt_sec_size])->length + 4ULL; } return static_cast(sizeof(ps3av_pkt_inc_avset) + video_pkt_sec_size + av_video_pkt_sec_size + av_audio_pkt_sec_size); } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); - auto pkt_data_addr = static_cast(pkt_buf) + sizeof(ps3av_pkt_inc_avset); + const auto pkt = static_cast(pkt_buf); + auto pkt_data_addr = static_cast(pkt_buf) + sizeof(ps3av_pkt_inc_avset); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -1302,7 +1300,7 @@ struct inc_avset_cmd : public ps3av_cmd u32 video_cmd_status = PS3AV_STATUS_SUCCESS; for (u32 video_pkt_idx = 0; video_pkt_idx < pkt->num_of_video_pkt; ++video_pkt_idx) { - const auto video_pkt = reinterpret_cast(pkt_data_addr); + const auto video_pkt = reinterpret_cast(pkt_data_addr); const u32 subcmd_status = video_pkt_parse(*video_pkt); if (video_pkt->video_head == PS3AV_HEAD_B_ANALOG) @@ -1329,7 +1327,7 @@ struct inc_avset_cmd : public ps3av_cmd // AV Video for (u32 video_av_pkt_idx = 0; video_av_pkt_idx < pkt->num_of_av_video_pkt; video_av_pkt_idx++) { - const auto av_video_pkt = reinterpret_cast(pkt_data_addr); + const auto av_video_pkt = reinterpret_cast(pkt_data_addr); const av_video_resp subcmd_resp = av_video_pkt_parse(*av_video_pkt, syscon_check_passed); if (subcmd_resp.status != PS3AV_STATUS_SUCCESS) @@ -1365,7 +1363,7 @@ struct inc_avset_cmd : public ps3av_cmd // AV Audio for (u32 audio_av_pkt_idx = 0; audio_av_pkt_idx < pkt->num_of_av_audio_pkt; audio_av_pkt_idx++) { - const auto av_audio_pkt = reinterpret_cast(pkt_data_addr); + const auto av_audio_pkt = reinterpret_cast(pkt_data_addr); if (av_audio_pkt->avport <= static_cast(UartAudioAvport::HDMI_1)) { @@ -1379,41 +1377,38 @@ struct inc_avset_cmd : public ps3av_cmd const u8 hdmi_idx = av_audio_pkt->avport == static_cast(UartAudioAvport::HDMI_1); - g_fxo->get().update_hw_param([&](auto &obj) - { - auto &hdmi = obj.hdmi[hdmi_idx]; - hdmi.init = true; - - const std::array fifomap = + g_fxo->get().update_hw_param([&](auto& obj) { - static_cast((av_audio_pkt->fifomap >> 0) & 3U), - static_cast((av_audio_pkt->fifomap >> 2) & 3U), - static_cast((av_audio_pkt->fifomap >> 4) & 3U), - static_cast((av_audio_pkt->fifomap >> 6) & 3U) - }; + auto& hdmi = obj.hdmi[hdmi_idx]; + hdmi.init = true; - const std::array en_streams = - { - static_cast(av_audio_pkt->enable & 0x10), - static_cast(av_audio_pkt->enable & 0x20), - static_cast(av_audio_pkt->enable & 0x40), - static_cast(av_audio_pkt->enable & 0x80) - }; + const std::array fifomap = + { + static_cast((av_audio_pkt->fifomap >> 0) & 3U), + static_cast((av_audio_pkt->fifomap >> 2) & 3U), + static_cast((av_audio_pkt->fifomap >> 4) & 3U), + static_cast((av_audio_pkt->fifomap >> 6) & 3U)}; - // Might be wrong - const std::array swap_lr = - { - static_cast(av_audio_pkt->swaplr & 0x10), - static_cast(av_audio_pkt->swaplr & 0x20), - static_cast(av_audio_pkt->swaplr & 0x40), - static_cast(av_audio_pkt->swaplr & 0x80) - }; + const std::array en_streams = + { + static_cast(av_audio_pkt->enable & 0x10), + static_cast(av_audio_pkt->enable & 0x20), + static_cast(av_audio_pkt->enable & 0x40), + static_cast(av_audio_pkt->enable & 0x80)}; - memcpy(hdmi.info_frame.data(), av_audio_pkt->info, sizeof(av_audio_pkt->info)); - memcpy(hdmi.chstat.data(), av_audio_pkt->chstat, sizeof(av_audio_pkt->chstat)); + // Might be wrong + const std::array swap_lr = + { + static_cast(av_audio_pkt->swaplr & 0x10), + static_cast(av_audio_pkt->swaplr & 0x20), + static_cast(av_audio_pkt->swaplr & 0x40), + static_cast(av_audio_pkt->swaplr & 0x80)}; - hdmi.ch_cfg = hdmi_param_conv(fifomap, en_streams, swap_lr); - }); + memcpy(hdmi.info_frame.data(), av_audio_pkt->info, sizeof(av_audio_pkt->info)); + memcpy(hdmi.chstat.data(), av_audio_pkt->chstat, sizeof(av_audio_pkt->chstat)); + + hdmi.ch_cfg = hdmi_param_conv(fifomap, en_streams, swap_lr); + }); } pkt_data_addr += av_audio_pkt->hdr.length + 4ULL; @@ -1436,7 +1431,6 @@ struct inc_avset_cmd : public ps3av_cmd } private: - struct video_sce_param { u32 width_div; @@ -1450,56 +1444,55 @@ private: bool hdcp_done_event[2]{}; }; - u32 video_pkt_parse(const ps3av_pkt_video_mode &video_head_cfg) + u32 video_pkt_parse(const ps3av_pkt_video_mode& video_head_cfg) { static constexpr video_sce_param sce_param_arr[28] = - { - { 0, 0, 0 }, - { 4, 2880, 480 }, - { 4, 2880, 480 }, - { 4, 2880, 576 }, - { 4, 2880, 576 }, - { 2, 1440, 480 }, - { 2, 1440, 576 }, - { 1, 1920, 1080 }, - { 1, 1920, 1080 }, - { 1, 1920, 1080 }, - { 1, 1280, 720 }, - { 1, 1280, 720 }, - { 1, 1920, 1080 }, - { 1, 1920, 1080 }, - { 1, 1920, 1080 }, - { 1, 1920, 1080 }, - { 1, 1280, 768 }, - { 1, 1280, 1024 }, - { 1, 1920, 1200 }, - { 1, 1360, 768 }, - { 1, 1280, 1470 }, - { 1, 1280, 1470 }, - { 1, 1920, 1080 }, - { 1, 1920, 2205 }, - { 1, 1920, 2205 }, - { 1, 1280, 721 }, - { 1, 720, 481 }, - { 1, 720, 577 } - }; + { + {0, 0, 0}, + {4, 2880, 480}, + {4, 2880, 480}, + {4, 2880, 576}, + {4, 2880, 576}, + {2, 1440, 480}, + {2, 1440, 576}, + {1, 1920, 1080}, + {1, 1920, 1080}, + {1, 1920, 1080}, + {1, 1280, 720}, + {1, 1280, 720}, + {1, 1920, 1080}, + {1, 1920, 1080}, + {1, 1920, 1080}, + {1, 1920, 1080}, + {1, 1280, 768}, + {1, 1280, 1024}, + {1, 1920, 1200}, + {1, 1360, 768}, + {1, 1280, 1470}, + {1, 1280, 1470}, + {1, 1920, 1080}, + {1, 1920, 2205}, + {1, 1920, 2205}, + {1, 1280, 721}, + {1, 720, 481}, + {1, 720, 577}}; const auto sce_idx = [&]() -> u8 { switch (video_head_cfg.video_vid) { case 16: return 1; - case 1: return 2; - case 3: return 4; + case 1: return 2; + case 3: return 4; case 17: return 4; - case 5: return 5; - case 6: return 6; + case 5: return 5; + case 6: return 6; case 18: return 7; - case 7: return 8; + case 7: return 8; case 33: return 8; - case 8: return 9; + case 8: return 9; case 34: return 9; - case 9: return 10; + case 9: return 10; case 31: return 10; case 10: return 11; case 32: return 11; @@ -1531,7 +1524,7 @@ private: } }(); - const video_sce_param &sce_param = sce_param_arr[sce_idx]; + const video_sce_param& sce_param = sce_param_arr[sce_idx]; if (sce_idx == umax || video_head_cfg.video_head > PS3AV_HEAD_B_ANALOG || video_head_cfg.video_order > 1 || @@ -1553,7 +1546,7 @@ private: return PS3AV_STATUS_SUCCESS; } - av_video_resp av_video_pkt_parse(const ps3av_pkt_av_video_cs &pkt, bool &syscon_pkt_valid) + av_video_resp av_video_pkt_parse(const ps3av_pkt_av_video_cs& pkt, bool& syscon_pkt_valid) { if (pkt.avport <= static_cast(UartAudioAvport::HDMI_1)) { @@ -1597,9 +1590,9 @@ private: return {}; } - static rsxaudio_hw_param_t::hdmi_param_t::hdmi_ch_cfg_t hdmi_param_conv(const std::array &map, - const std::array &en, - const std::array &swap) + static rsxaudio_hw_param_t::hdmi_param_t::hdmi_ch_cfg_t hdmi_param_conv(const std::array& map, + const std::array& en, + const std::array& swap) { std::array result{}; u8 ch_cnt = 0; @@ -1636,7 +1629,7 @@ private: } }(); - return { result, ch_cnt_conv }; + return {result, ch_cnt_conv}; } }; @@ -1647,9 +1640,9 @@ struct generic_reply_cmd : public ps3av_cmd return 0; } - void execute(vuart_av_thread &vuart, const void *pkt_buf) override + void execute(vuart_av_thread& vuart, const void* pkt_buf) override { - const auto pkt = static_cast(pkt_buf); + const auto pkt = static_cast(pkt_buf); if (vuart.get_reply_buf_free_size() < sizeof(ps3av_pkt_reply_hdr)) { @@ -1663,7 +1656,7 @@ struct generic_reply_cmd : public ps3av_cmd } }; -error_code sys_uart_initialize(ppu_thread &ppu) +error_code sys_uart_initialize(ppu_thread& ppu) { ppu.state += cpu_flag::wait; @@ -1674,7 +1667,7 @@ error_code sys_uart_initialize(ppu_thread &ppu) return CELL_ENOSYS; } - auto &vuart_thread = g_fxo->get(); + auto& vuart_thread = g_fxo->get(); if (vuart_thread.initialized.test_and_set()) { @@ -1684,7 +1677,7 @@ error_code sys_uart_initialize(ppu_thread &ppu) return CELL_OK; } -error_code sys_uart_receive(ppu_thread &ppu, vm::ptr buffer, u64 size, u32 mode) +error_code sys_uart_receive(ppu_thread& ppu, vm::ptr buffer, u64 size, u32 mode) { sys_uart.trace("sys_uart_receive(buffer=*0x%x, size=0x%llx, mode=0x%x)", buffer, size, mode); @@ -1703,7 +1696,7 @@ error_code sys_uart_receive(ppu_thread &ppu, vm::ptr buffer, u64 size, u32 return CELL_EINVAL; } - auto &vuart_thread = g_fxo->get(); + auto& vuart_thread = g_fxo->get(); if (!vuart_thread.initialized) { @@ -1719,7 +1712,7 @@ error_code sys_uart_receive(ppu_thread &ppu, vm::ptr buffer, u64 size, u32 const std::unique_ptr data = std::make_unique(size); u32 read_size = 0; - auto vuart_read = [&](u8 *buf, u32 buf_size) -> s32 + auto vuart_read = [&](u8* buf, u32 buf_size) -> s32 { constexpr u32 ITER_SIZE = 4096; std::unique_lock lock(vuart_thread.rx_mutex, std::defer_lock); @@ -1793,7 +1786,7 @@ error_code sys_uart_receive(ppu_thread &ppu, vm::ptr buffer, u64 size, u32 return not_an_error(read_size); } -error_code sys_uart_send(ppu_thread &ppu, vm::cptr buffer, u64 size, u32 mode) +error_code sys_uart_send(ppu_thread& ppu, vm::cptr buffer, u64 size, u32 mode) { sys_uart.trace("sys_uart_send(buffer=0x%x, size=0x%llx, mode=0x%x)", buffer, size, mode); @@ -1812,7 +1805,7 @@ error_code sys_uart_send(ppu_thread &ppu, vm::cptr buffer, u64 size, u32 m return CELL_EINVAL; } - auto &vuart_thread = g_fxo->get(); + auto& vuart_thread = g_fxo->get(); if (!vuart_thread.initialized) { @@ -1844,7 +1837,7 @@ error_code sys_uart_send(ppu_thread &ppu, vm::cptr buffer, u64 size, u32 m lock.lock(); - auto vuart_send_all = [&](const u8 *data, u32 data_sz) + auto vuart_send_all = [&](const u8* data, u32 data_sz) { u32 rem_size = data_sz; @@ -1876,7 +1869,8 @@ error_code sys_uart_send(ppu_thread &ppu, vm::cptr buffer, u64 size, u32 m while (remaining) { const u32 packet_size = std::min(remaining, ITER_SIZE); - if (!vuart_send_all(data.get() + sent_size, packet_size)) return {}; + if (!vuart_send_all(data.get() + sent_size, packet_size)) + return {}; sent_size += packet_size; remaining -= packet_size; } @@ -1946,7 +1940,7 @@ error_code sys_uart_get_params(vm::ptr buffer) return CELL_ENOSYS; } - auto &vuart_thread = g_fxo->get(); + auto& vuart_thread = g_fxo->get(); if (!vuart_thread.initialized) { @@ -1974,7 +1968,7 @@ void vuart_av_thread::operator()() continue; } - const u64 hdmi_event_dist[2] = { hdmi_event_handler[0].time_until_next(), hdmi_event_handler[1].time_until_next() }; + const u64 hdmi_event_dist[2] = {hdmi_event_handler[0].time_until_next(), hdmi_event_handler[1].time_until_next()}; bool update_dist = false; if (hdmi_event_dist[0] == 0) @@ -2029,7 +2023,8 @@ void vuart_av_thread::parse_tx_buffer(u32 buf_size) { if (buf_size >= PS3AV_TX_BUF_SIZE) { - while (read_tx_data(temp_tx_buf, PS3AV_TX_BUF_SIZE) >= PS3AV_TX_BUF_SIZE); + while (read_tx_data(temp_tx_buf, PS3AV_TX_BUF_SIZE) >= PS3AV_TX_BUF_SIZE) + ; write_resp(reinterpret_cast*>(temp_tx_buf)[3], PS3AV_STATUS_BUFFER_OVERFLOW); return; } @@ -2039,7 +2034,7 @@ void vuart_av_thread::parse_tx_buffer(u32 buf_size) while (buf_size) { const ps3av_header* const hdr = reinterpret_cast(&temp_tx_buf[read_ptr]); - const u16 pkt_size = hdr->length + 4; + const u16 pkt_size = hdr->length + 4; if (hdr->length == 0xFFFCU) { @@ -2074,7 +2069,7 @@ void vuart_av_thread::parse_tx_buffer(u32 buf_size) if (cmd_size != pkt_size && cmd_size) { - sys_uart.error("Invalid size for cid=0x%x, expected=0x%x, got=0x%x", static_cast(pkt_storage)->cid, cmd_size, pkt_size); + sys_uart.error("Invalid size for cid=0x%x, expected=0x%x, got=0x%x", static_cast(pkt_storage)->cid, cmd_size, pkt_size); write_resp(static_cast(hdr->cid.get()), PS3AV_STATUS_INVALID_SAMPLE_SIZE); return; } @@ -2083,7 +2078,7 @@ void vuart_av_thread::parse_tx_buffer(u32 buf_size) } } -vuart_av_thread &vuart_av_thread::operator=(thread_state) +vuart_av_thread& vuart_av_thread::operator=(thread_state) { { std::lock_guard lock(tx_wake_m); @@ -2092,7 +2087,7 @@ vuart_av_thread &vuart_av_thread::operator=(thread_state) return *this; } -u32 vuart_av_thread::enque_tx_data(const void *data, u32 data_sz) +u32 vuart_av_thread::enque_tx_data(const void* data, u32 data_sz) { std::unique_lock lock(tx_wake_m); if (u32 size = static_cast(tx_buf.push(data, data_sz, true))) @@ -2110,12 +2105,12 @@ u32 vuart_av_thread::get_tx_bytes() return static_cast(tx_buf.get_used_size()); } -u32 vuart_av_thread::read_rx_data(void *data, u32 data_sz) +u32 vuart_av_thread::read_rx_data(void* data, u32 data_sz) { return static_cast(rx_buf.pop(data, data_sz, true)); } -u32 vuart_av_thread::read_tx_data(void *data, u32 data_sz) +u32 vuart_av_thread::read_tx_data(void* data, u32 data_sz) { std::unique_lock lock(tx_rdy_m); if (u32 size = static_cast(tx_buf.pop(data, data_sz, true))) @@ -2132,23 +2127,22 @@ u32 vuart_av_thread::get_reply_buf_free_size() return sizeof(temp_rx_buf.buf) - temp_rx_buf.crnt_size; } -template -void vuart_av_thread::write_resp(u32 cid, u32 status, const void *data, u16 data_size) +template +void vuart_av_thread::write_resp(u32 cid, u32 status, const void* data, u16 data_size) { const ps3av_pkt_reply_hdr pkt_hdr = - { - PS3AV_VERSION, - data_size + 8U, - cid | PS3AV_REPLY_BIT, - status - }; + { + PS3AV_VERSION, + data_size + 8U, + cid | PS3AV_REPLY_BIT, + status}; if (status != PS3AV_STATUS_SUCCESS) { sys_uart.error("Packet failed cid=0x%08x status=0x%02x", cid, status); } - temp_buf &buf = UseScBuffer ? temp_rx_sc_buf : temp_rx_buf; + temp_buf& buf = UseScBuffer ? temp_rx_sc_buf : temp_rx_buf; const u32 total_size = sizeof(pkt_hdr) + data_size; if (buf.crnt_size + total_size <= sizeof(buf.buf)) @@ -2169,44 +2163,44 @@ std::shared_ptr vuart_av_thread::get_cmd(u32 cid) return std::make_shared(); // AV commands - case PS3AV_CID_AV_INIT: return std::make_shared(); - case PS3AV_CID_AV_FIN: return std::make_shared(); - case PS3AV_CID_AV_GET_HW_CONF: return std::make_shared(); - case PS3AV_CID_AV_GET_MONITOR_INFO: return std::make_shared(); - case PS3AV_CID_AV_GET_BKSV_LIST: return std::make_shared(); - case PS3AV_CID_AV_ENABLE_EVENT: return std::make_shared(); - case PS3AV_CID_AV_DISABLE_EVENT: return std::make_shared(); - case PS3AV_CID_AV_TV_MUTE: return std::make_shared(); - case PS3AV_CID_AV_NULL_CMD: return std::make_shared(); - case PS3AV_CID_AV_GET_AKSV: return std::make_shared(); - case PS3AV_CID_AV_VIDEO_DISABLE_SIG: return std::make_shared(); + case PS3AV_CID_AV_INIT: return std::make_shared(); + case PS3AV_CID_AV_FIN: return std::make_shared(); + case PS3AV_CID_AV_GET_HW_CONF: return std::make_shared(); + case PS3AV_CID_AV_GET_MONITOR_INFO: return std::make_shared(); + case PS3AV_CID_AV_GET_BKSV_LIST: return std::make_shared(); + case PS3AV_CID_AV_ENABLE_EVENT: return std::make_shared(); + case PS3AV_CID_AV_DISABLE_EVENT: return std::make_shared(); + case PS3AV_CID_AV_TV_MUTE: return std::make_shared(); + case PS3AV_CID_AV_NULL_CMD: return std::make_shared(); + case PS3AV_CID_AV_GET_AKSV: return std::make_shared(); + case PS3AV_CID_AV_VIDEO_DISABLE_SIG: return std::make_shared(); case PS3AV_CID_AV_VIDEO_YTRAPCONTROL: return std::make_shared(); - case PS3AV_CID_AV_AUDIO_MUTE: return std::make_shared(); - case PS3AV_CID_AV_ACP_CTRL: return std::make_shared(); - case PS3AV_CID_AV_SET_ACP_PACKET: return std::make_shared(); - case PS3AV_CID_AV_ADD_SIGNAL_CTL: return std::make_shared(); - case PS3AV_CID_AV_SET_CGMS_WSS: return std::make_shared(); - case PS3AV_CID_AV_HDMI_MODE: return std::make_shared(); - case PS3AV_CID_AV_GET_CEC_CONFIG: return std::make_shared(); + case PS3AV_CID_AV_AUDIO_MUTE: return std::make_shared(); + case PS3AV_CID_AV_ACP_CTRL: return std::make_shared(); + case PS3AV_CID_AV_SET_ACP_PACKET: return std::make_shared(); + case PS3AV_CID_AV_ADD_SIGNAL_CTL: return std::make_shared(); + case PS3AV_CID_AV_SET_CGMS_WSS: return std::make_shared(); + case PS3AV_CID_AV_HDMI_MODE: return std::make_shared(); + case PS3AV_CID_AV_GET_CEC_CONFIG: return std::make_shared(); // Video commands - case PS3AV_CID_VIDEO_INIT: return std::make_shared(); - case PS3AV_CID_VIDEO_ROUTE: return std::make_shared(); - case PS3AV_CID_VIDEO_FORMAT: return std::make_shared(); - case PS3AV_CID_VIDEO_PITCH: return std::make_shared(); - case PS3AV_CID_VIDEO_GET_HW_CONF: return std::make_shared(); + case PS3AV_CID_VIDEO_INIT: return std::make_shared(); + case PS3AV_CID_VIDEO_ROUTE: return std::make_shared(); + case PS3AV_CID_VIDEO_FORMAT: return std::make_shared(); + case PS3AV_CID_VIDEO_PITCH: return std::make_shared(); + case PS3AV_CID_VIDEO_GET_HW_CONF: return std::make_shared(); // Audio commands - case PS3AV_CID_AUDIO_INIT: return std::make_shared(); - case PS3AV_CID_AUDIO_MODE: return std::make_shared(); - case PS3AV_CID_AUDIO_MUTE: return std::make_shared(); - case PS3AV_CID_AUDIO_ACTIVE: return std::make_shared(); - case PS3AV_CID_AUDIO_INACTIVE: return std::make_shared(); - case PS3AV_CID_AUDIO_SPDIF_BIT: return std::make_shared(); - case PS3AV_CID_AUDIO_CTRL: return std::make_shared(); + case PS3AV_CID_AUDIO_INIT: return std::make_shared(); + case PS3AV_CID_AUDIO_MODE: return std::make_shared(); + case PS3AV_CID_AUDIO_MUTE: return std::make_shared(); + case PS3AV_CID_AUDIO_ACTIVE: return std::make_shared(); + case PS3AV_CID_AUDIO_INACTIVE: return std::make_shared(); + case PS3AV_CID_AUDIO_SPDIF_BIT: return std::make_shared(); + case PS3AV_CID_AUDIO_CTRL: return std::make_shared(); // Multipacket - case PS3AV_CID_AVB_PARAM: return std::make_shared(); + case PS3AV_CID_AVB_PARAM: return std::make_shared(); default: return {}; } @@ -2214,7 +2208,7 @@ std::shared_ptr vuart_av_thread::get_cmd(u32 cid) void vuart_av_thread::commit_rx_buf(bool syscon_buf) { - temp_buf &buf = syscon_buf ? temp_rx_sc_buf : temp_rx_buf; + temp_buf& buf = syscon_buf ? temp_rx_sc_buf : temp_rx_buf; std::unique_lock lock(rx_wake_m); rx_buf.push(buf.buf, buf.crnt_size, true); @@ -2293,7 +2287,8 @@ RsxaudioAvportIdx vuart_av_thread::avport_to_idx(UartAudioAvport avport) void vuart_av_thread::add_unplug_event(bool hdmi_0, bool hdmi_1) { - if ((hdmi_events_bitmask & PS3AV_EVENT_BIT_UNPLUGGED) == 0) return; + if ((hdmi_events_bitmask & PS3AV_EVENT_BIT_UNPLUGGED) == 0) + return; ps3av_header pkt{}; pkt.version = av_cmd_ver; @@ -2318,7 +2313,8 @@ void vuart_av_thread::add_unplug_event(bool hdmi_0, bool hdmi_1) void vuart_av_thread::add_plug_event(bool hdmi_0, bool hdmi_1) { - if ((hdmi_events_bitmask & PS3AV_EVENT_BIT_PLUGGED) == 0) return; + if ((hdmi_events_bitmask & PS3AV_EVENT_BIT_PLUGGED) == 0) + return; ps3av_pkt_hdmi_plugged_event pkt{}; pkt.hdr.version = av_cmd_ver; @@ -2398,7 +2394,7 @@ void vuart_av_thread::add_hdcp_done_event(bool hdmi_0, bool hdmi_1) } } -void vuart_av_thread::commit_event_data(const void *data, u16 data_size) +void vuart_av_thread::commit_event_data(const void* data, u16 data_size) { std::unique_lock lock(rx_wake_m); rx_buf.push(data, data_size, true); diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_uart.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_uart.h index 3618917b5..1fb3a8f24 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_uart.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_uart.h @@ -7,214 +7,214 @@ enum : u32 { - PS3AV_RX_BUF_SIZE = 0x800, - PS3AV_TX_BUF_SIZE = 0x800, + PS3AV_RX_BUF_SIZE = 0x800, + PS3AV_TX_BUF_SIZE = 0x800, - PS3AV_VERSION = 0x205, + PS3AV_VERSION = 0x205, - PS3AV_CID_AV_INIT = 0x00000001, - PS3AV_CID_AV_FIN = 0x00000002, - PS3AV_CID_AV_GET_HW_CONF = 0x00000003, - PS3AV_CID_AV_GET_MONITOR_INFO = 0x00000004, - PS3AV_CID_AV_GET_BKSV_LIST = 0x00000005, - PS3AV_CID_AV_ENABLE_EVENT = 0x00000006, - PS3AV_CID_AV_DISABLE_EVENT = 0x00000007, - PS3AV_CID_AV_GET_PORT_STATE = 0x00000009, - PS3AV_CID_AV_TV_MUTE = 0x0000000A, - PS3AV_CID_AV_NULL_CMD = 0x0000000B, - PS3AV_CID_AV_GET_AKSV = 0x0000000C, - PS3AV_CID_AV_UNK4 = 0x0000000D, - PS3AV_CID_AV_UNK5 = 0x0000000E, + PS3AV_CID_AV_INIT = 0x00000001, + PS3AV_CID_AV_FIN = 0x00000002, + PS3AV_CID_AV_GET_HW_CONF = 0x00000003, + PS3AV_CID_AV_GET_MONITOR_INFO = 0x00000004, + PS3AV_CID_AV_GET_BKSV_LIST = 0x00000005, + PS3AV_CID_AV_ENABLE_EVENT = 0x00000006, + PS3AV_CID_AV_DISABLE_EVENT = 0x00000007, + PS3AV_CID_AV_GET_PORT_STATE = 0x00000009, + PS3AV_CID_AV_TV_MUTE = 0x0000000A, + PS3AV_CID_AV_NULL_CMD = 0x0000000B, + PS3AV_CID_AV_GET_AKSV = 0x0000000C, + PS3AV_CID_AV_UNK4 = 0x0000000D, + PS3AV_CID_AV_UNK5 = 0x0000000E, - PS3AV_CID_AV_VIDEO_MUTE = 0x00010002, - PS3AV_CID_AV_VIDEO_DISABLE_SIG = 0x00010003, - PS3AV_CID_AV_VIDEO_YTRAPCONTROL = 0x00010004, - PS3AV_CID_AV_VIDEO_UNK5 = 0x00010005, - PS3AV_CID_AV_VIDEO_UNK6 = 0x00010006, - PS3AV_CID_AV_AUDIO_MUTE = 0x00020002, - PS3AV_CID_AV_ACP_CTRL = 0x00020003, - PS3AV_CID_AV_SET_ACP_PACKET = 0x00020004, - PS3AV_CID_AV_ADD_SIGNAL_CTL = 0x00030001, - PS3AV_CID_AV_SET_CC_CODE = 0x00030002, - PS3AV_CID_AV_SET_CGMS_WSS = 0x00030003, - PS3AV_CID_AV_SET_MACROVISION = 0x00030004, - PS3AV_CID_AV_UNK7 = 0x00030005, - PS3AV_CID_AV_UNK8 = 0x00030006, - PS3AV_CID_AV_UNK9 = 0x00030007, - PS3AV_CID_AV_HDMI_MODE = 0x00040001, - PS3AV_CID_AV_UNK15 = 0x00050001, + PS3AV_CID_AV_VIDEO_MUTE = 0x00010002, + PS3AV_CID_AV_VIDEO_DISABLE_SIG = 0x00010003, + PS3AV_CID_AV_VIDEO_YTRAPCONTROL = 0x00010004, + PS3AV_CID_AV_VIDEO_UNK5 = 0x00010005, + PS3AV_CID_AV_VIDEO_UNK6 = 0x00010006, + PS3AV_CID_AV_AUDIO_MUTE = 0x00020002, + PS3AV_CID_AV_ACP_CTRL = 0x00020003, + PS3AV_CID_AV_SET_ACP_PACKET = 0x00020004, + PS3AV_CID_AV_ADD_SIGNAL_CTL = 0x00030001, + PS3AV_CID_AV_SET_CC_CODE = 0x00030002, + PS3AV_CID_AV_SET_CGMS_WSS = 0x00030003, + PS3AV_CID_AV_SET_MACROVISION = 0x00030004, + PS3AV_CID_AV_UNK7 = 0x00030005, + PS3AV_CID_AV_UNK8 = 0x00030006, + PS3AV_CID_AV_UNK9 = 0x00030007, + PS3AV_CID_AV_HDMI_MODE = 0x00040001, + PS3AV_CID_AV_UNK15 = 0x00050001, - PS3AV_CID_AV_CEC_MESSAGE = 0x000A0001, - PS3AV_CID_AV_GET_CEC_CONFIG = 0x000A0002, - PS3AV_CID_AV_UNK11 = 0x000A0003, - PS3AV_CID_AV_UNK12 = 0x000A0004, - PS3AV_CID_AV_UNK13 = 0x000A0005, - PS3AV_CID_AV_UNK14 = 0x000A0006, + PS3AV_CID_AV_CEC_MESSAGE = 0x000A0001, + PS3AV_CID_AV_GET_CEC_CONFIG = 0x000A0002, + PS3AV_CID_AV_UNK11 = 0x000A0003, + PS3AV_CID_AV_UNK12 = 0x000A0004, + PS3AV_CID_AV_UNK13 = 0x000A0005, + PS3AV_CID_AV_UNK14 = 0x000A0006, - PS3AV_CID_VIDEO_INIT = 0x01000001, - PS3AV_CID_VIDEO_MODE = 0x01000002, - PS3AV_CID_VIDEO_ROUTE = 0x01000003, - PS3AV_CID_VIDEO_FORMAT = 0x01000004, - PS3AV_CID_VIDEO_PITCH = 0x01000005, - PS3AV_CID_VIDEO_GET_HW_CONF = 0x01000006, - PS3AV_CID_VIDEO_GET_REG = 0x01000008, - PS3AV_CID_VIDEO_UNK = 0x01000009, - PS3AV_CID_VIDEO_UNK1 = 0x0100000A, - PS3AV_CID_VIDEO_UNK2 = 0x0100000B, - PS3AV_CID_VIDEO_UNK3 = 0x0100000C, + PS3AV_CID_VIDEO_INIT = 0x01000001, + PS3AV_CID_VIDEO_MODE = 0x01000002, + PS3AV_CID_VIDEO_ROUTE = 0x01000003, + PS3AV_CID_VIDEO_FORMAT = 0x01000004, + PS3AV_CID_VIDEO_PITCH = 0x01000005, + PS3AV_CID_VIDEO_GET_HW_CONF = 0x01000006, + PS3AV_CID_VIDEO_GET_REG = 0x01000008, + PS3AV_CID_VIDEO_UNK = 0x01000009, + PS3AV_CID_VIDEO_UNK1 = 0x0100000A, + PS3AV_CID_VIDEO_UNK2 = 0x0100000B, + PS3AV_CID_VIDEO_UNK3 = 0x0100000C, - PS3AV_CID_AUDIO_INIT = 0x02000001, - PS3AV_CID_AUDIO_MODE = 0x02000002, - PS3AV_CID_AUDIO_MUTE = 0x02000003, - PS3AV_CID_AUDIO_ACTIVE = 0x02000004, - PS3AV_CID_AUDIO_INACTIVE = 0x02000005, - PS3AV_CID_AUDIO_SPDIF_BIT = 0x02000006, - PS3AV_CID_AUDIO_CTRL = 0x02000007, + PS3AV_CID_AUDIO_INIT = 0x02000001, + PS3AV_CID_AUDIO_MODE = 0x02000002, + PS3AV_CID_AUDIO_MUTE = 0x02000003, + PS3AV_CID_AUDIO_ACTIVE = 0x02000004, + PS3AV_CID_AUDIO_INACTIVE = 0x02000005, + PS3AV_CID_AUDIO_SPDIF_BIT = 0x02000006, + PS3AV_CID_AUDIO_CTRL = 0x02000007, - PS3AV_CID_AVB_PARAM = 0x04000001, + PS3AV_CID_AVB_PARAM = 0x04000001, - PS3AV_CID_EVENT_UNPLUGGED = 0x10000001, - PS3AV_CID_EVENT_PLUGGED = 0x10000002, - PS3AV_CID_EVENT_HDCP_DONE = 0x10000003, - PS3AV_CID_EVENT_HDCP_FAIL = 0x10000004, - PS3AV_CID_EVENT_HDCP_REAUTH = 0x10000005, - PS3AV_CID_EVENT_HDCP_ERROR = 0x10000006, + PS3AV_CID_EVENT_UNPLUGGED = 0x10000001, + PS3AV_CID_EVENT_PLUGGED = 0x10000002, + PS3AV_CID_EVENT_HDCP_DONE = 0x10000003, + PS3AV_CID_EVENT_HDCP_FAIL = 0x10000004, + PS3AV_CID_EVENT_HDCP_REAUTH = 0x10000005, + PS3AV_CID_EVENT_HDCP_ERROR = 0x10000006, - PS3AV_REPLY_BIT = 0x80000000, + PS3AV_REPLY_BIT = 0x80000000, - PS3AV_RESBIT_720x480P = 0x0003, /* 0x0001 | 0x0002 */ - PS3AV_RESBIT_720x576P = 0x0003, /* 0x0001 | 0x0002 */ - PS3AV_RESBIT_1280x720P = 0x0004, - PS3AV_RESBIT_1920x1080I = 0x0008, - PS3AV_RESBIT_1920x1080P = 0x4000, + PS3AV_RESBIT_720x480P = 0x0003, /* 0x0001 | 0x0002 */ + PS3AV_RESBIT_720x576P = 0x0003, /* 0x0001 | 0x0002 */ + PS3AV_RESBIT_1280x720P = 0x0004, + PS3AV_RESBIT_1920x1080I = 0x0008, + PS3AV_RESBIT_1920x1080P = 0x4000, - PS3AV_MONITOR_TYPE_NONE = 0, - PS3AV_MONITOR_TYPE_HDMI = 1, - PS3AV_MONITOR_TYPE_DVI = 2, - PS3AV_MONITOR_TYPE_AVMULTI = 3, + PS3AV_MONITOR_TYPE_NONE = 0, + PS3AV_MONITOR_TYPE_HDMI = 1, + PS3AV_MONITOR_TYPE_DVI = 2, + PS3AV_MONITOR_TYPE_AVMULTI = 3, - PS3AV_COLORIMETRY_xvYCC_601 = 1, - PS3AV_COLORIMETRY_xvYCC_709 = 2, - PS3AV_COLORIMETRY_MD0 = 1 << 4, - PS3AV_COLORIMETRY_MD1 = 1 << 5, - PS3AV_COLORIMETRY_MD2 = 1 << 6, + PS3AV_COLORIMETRY_xvYCC_601 = 1, + PS3AV_COLORIMETRY_xvYCC_709 = 2, + PS3AV_COLORIMETRY_MD0 = 1 << 4, + PS3AV_COLORIMETRY_MD1 = 1 << 5, + PS3AV_COLORIMETRY_MD2 = 1 << 6, - PS3AV_CS_SUPPORTED = 1, + PS3AV_CS_SUPPORTED = 1, PS3AV_RGB_SELECTABLE_QAUNTIZATION_RANGE = 8, - PS3AV_12BIT_COLOR = 16, + PS3AV_12BIT_COLOR = 16, - PS3AV_MON_INFO_AUDIO_BLK_MAX = 16, + PS3AV_MON_INFO_AUDIO_BLK_MAX = 16, - PS3AV_MON_INFO_AUDIO_TYPE_LPCM = 1, - PS3AV_MON_INFO_AUDIO_TYPE_AC3 = 2, - PS3AV_MON_INFO_AUDIO_TYPE_AAC = 6, - PS3AV_MON_INFO_AUDIO_TYPE_DTS = 7, - PS3AV_MON_INFO_AUDIO_TYPE_DDP = 10, - PS3AV_MON_INFO_AUDIO_TYPE_DTS_HD = 11, - PS3AV_MON_INFO_AUDIO_TYPE_DOLBY_THD = 12, + PS3AV_MON_INFO_AUDIO_TYPE_LPCM = 1, + PS3AV_MON_INFO_AUDIO_TYPE_AC3 = 2, + PS3AV_MON_INFO_AUDIO_TYPE_AAC = 6, + PS3AV_MON_INFO_AUDIO_TYPE_DTS = 7, + PS3AV_MON_INFO_AUDIO_TYPE_DDP = 10, + PS3AV_MON_INFO_AUDIO_TYPE_DTS_HD = 11, + PS3AV_MON_INFO_AUDIO_TYPE_DOLBY_THD = 12, - PS3AV_HDMI_BEHAVIOR_HDCP_OFF = 0x01, - PS3AV_HDMI_BEHAVIOR_DVI = 0x40, - PS3AV_HDMI_BEHAVIOR_EDID_PASS = 0x80, - PS3AV_HDMI_BEHAVIOR_NORMAL = 0xFF, + PS3AV_HDMI_BEHAVIOR_HDCP_OFF = 0x01, + PS3AV_HDMI_BEHAVIOR_DVI = 0x40, + PS3AV_HDMI_BEHAVIOR_EDID_PASS = 0x80, + PS3AV_HDMI_BEHAVIOR_NORMAL = 0xFF, - PS3AV_EVENT_BIT_UNPLUGGED = 0x01, - PS3AV_EVENT_BIT_PLUGGED = 0x02, - PS3AV_EVENT_BIT_HDCP_DONE = 0x04, - PS3AV_EVENT_BIT_HDCP_FAIL = 0x08, - PS3AV_EVENT_BIT_HDCP_REAUTH = 0x10, - PS3AV_EVENT_BIT_HDCP_TOPOLOGY = 0x20, - PS3AV_EVENT_BIT_UNK = 0x80000000, + PS3AV_EVENT_BIT_UNPLUGGED = 0x01, + PS3AV_EVENT_BIT_PLUGGED = 0x02, + PS3AV_EVENT_BIT_HDCP_DONE = 0x04, + PS3AV_EVENT_BIT_HDCP_FAIL = 0x08, + PS3AV_EVENT_BIT_HDCP_REAUTH = 0x10, + PS3AV_EVENT_BIT_HDCP_TOPOLOGY = 0x20, + PS3AV_EVENT_BIT_UNK = 0x80000000, - PS3AV_HEAD_A_HDMI = 0, - PS3AV_HEAD_B_ANALOG = 1, + PS3AV_HEAD_A_HDMI = 0, + PS3AV_HEAD_B_ANALOG = 1, - PS3AV_AUDIO_PORT_HDMI_0 = 1 << 0, - PS3AV_AUDIO_PORT_HDMI_1 = 1 << 1, - PS3AV_AUDIO_PORT_AVMULTI = 1 << 10, - PS3AV_AUDIO_PORT_SPDIF_0 = 1 << 20, - PS3AV_AUDIO_PORT_SPDIF_1 = 1 << 21, + PS3AV_AUDIO_PORT_HDMI_0 = 1 << 0, + PS3AV_AUDIO_PORT_HDMI_1 = 1 << 1, + PS3AV_AUDIO_PORT_AVMULTI = 1 << 10, + PS3AV_AUDIO_PORT_SPDIF_0 = 1 << 20, + PS3AV_AUDIO_PORT_SPDIF_1 = 1 << 21, - PS3AV_STATUS_SUCCESS = 0x00, - PS3AV_STATUS_RECEIVE_VUART_ERROR = 0x01, - PS3AV_STATUS_SYSCON_COMMUNICATE_FAIL = 0x02, - PS3AV_STATUS_INVALID_COMMAND = 0x03, - PS3AV_STATUS_INVALID_PORT = 0x04, - PS3AV_STATUS_INVALID_VID = 0x05, - PS3AV_STATUS_INVALID_COLOR_SPACE = 0x06, - PS3AV_STATUS_INVALID_FS = 0x07, - PS3AV_STATUS_INVALID_AUDIO_CH = 0x08, - PS3AV_STATUS_UNSUPPORTED_VERSION = 0x09, - PS3AV_STATUS_INVALID_SAMPLE_SIZE = 0x0A, - PS3AV_STATUS_FAILURE = 0x0B, - PS3AV_STATUS_UNSUPPORTED_COMMAND = 0x0C, - PS3AV_STATUS_BUFFER_OVERFLOW = 0x0D, - PS3AV_STATUS_INVALID_VIDEO_PARAM = 0x0E, - PS3AV_STATUS_NO_SEL = 0x0F, - PS3AV_STATUS_INVALID_AV_PARAM = 0x10, - PS3AV_STATUS_INVALID_AUDIO_PARAM = 0x11, - PS3AV_STATUS_UNSUPPORTED_HDMI_MODE = 0x12, - PS3AV_STATUS_NO_SYNC_HEAD = 0x13, - PS3AV_STATUS_UNK_0x14 = 0x14, + PS3AV_STATUS_SUCCESS = 0x00, + PS3AV_STATUS_RECEIVE_VUART_ERROR = 0x01, + PS3AV_STATUS_SYSCON_COMMUNICATE_FAIL = 0x02, + PS3AV_STATUS_INVALID_COMMAND = 0x03, + PS3AV_STATUS_INVALID_PORT = 0x04, + PS3AV_STATUS_INVALID_VID = 0x05, + PS3AV_STATUS_INVALID_COLOR_SPACE = 0x06, + PS3AV_STATUS_INVALID_FS = 0x07, + PS3AV_STATUS_INVALID_AUDIO_CH = 0x08, + PS3AV_STATUS_UNSUPPORTED_VERSION = 0x09, + PS3AV_STATUS_INVALID_SAMPLE_SIZE = 0x0A, + PS3AV_STATUS_FAILURE = 0x0B, + PS3AV_STATUS_UNSUPPORTED_COMMAND = 0x0C, + PS3AV_STATUS_BUFFER_OVERFLOW = 0x0D, + PS3AV_STATUS_INVALID_VIDEO_PARAM = 0x0E, + PS3AV_STATUS_NO_SEL = 0x0F, + PS3AV_STATUS_INVALID_AV_PARAM = 0x10, + PS3AV_STATUS_INVALID_AUDIO_PARAM = 0x11, + PS3AV_STATUS_UNSUPPORTED_HDMI_MODE = 0x12, + PS3AV_STATUS_NO_SYNC_HEAD = 0x13, + PS3AV_STATUS_UNK_0x14 = 0x14, }; -const u8 PS3AV_AKSV_VALUE[5] = { 0x00, 0x00, 0x0F, 0xFF, 0xFF }; -const u8 PS3AV_BKSV_VALUE[5] = { 0xFF, 0xFF, 0xF0, 0x00, 0x00 }; +const u8 PS3AV_AKSV_VALUE[5] = {0x00, 0x00, 0x0F, 0xFF, 0xFF}; +const u8 PS3AV_BKSV_VALUE[5] = {0xFF, 0xFF, 0xF0, 0x00, 0x00}; enum PS3_AV_OP_MODE : u32 { // BIG operation modes could send more then 4096 bytes NOT_BLOCKING_BIG_OP = 0, - BLOCKING_BIG_OP = 1, - NOT_BLOCKING_OP = 2, + BLOCKING_BIG_OP = 1, + NOT_BLOCKING_OP = 2, }; enum class UartHdmiEvent : u8 { - NONE = 0, - UNPLUGGED = 1, - PLUGGED = 2, - HDCP_DONE = 3, + NONE = 0, + UNPLUGGED = 1, + PLUGGED = 2, + HDCP_DONE = 3, }; enum class UartAudioCtrlID : u32 { - DAC_RESET = 0, + DAC_RESET = 0, DAC_DE_EMPHASIS = 1, - AVCLK = 2, + AVCLK = 2, }; enum class UartAudioAvport : u8 { - HDMI_0 = 0x0, - HDMI_1 = 0x1, + HDMI_0 = 0x0, + HDMI_1 = 0x1, AVMULTI_0 = 0x10, AVMULTI_1 = 0x11, - SPDIF_0 = 0x20, - SPDIF_1 = 0x21, + SPDIF_0 = 0x20, + SPDIF_1 = 0x21, }; enum class UartAudioSource : u32 { SERIAL = 0, - SPDIF = 1, + SPDIF = 1, }; enum class UartAudioFreq : u32 { - _32K = 1, - _44K = 2, - _48K = 3, - _88K = 4, - _96K = 5, + _32K = 1, + _44K = 2, + _48K = 3, + _88K = 4, + _96K = 5, _176K = 6, _192K = 7, }; enum class UartAudioFormat : u32 { - PCM = 1, + PCM = 1, BITSTREAM = 0xFF, }; @@ -228,7 +228,6 @@ enum class UartAudioSampleSize : u32 class vuart_hdmi_event_handler { public: - vuart_hdmi_event_handler(u64 time_offset = 0); void set_target_state(UartHdmiEvent start_state, UartHdmiEvent end_state); @@ -238,7 +237,6 @@ public: UartHdmiEvent get_occured_event(); private: - static constexpr u64 EVENT_TIME_DURATION = 20000; static constexpr u64 EVENT_TIME_THRESHOLD = 1000; @@ -260,15 +258,14 @@ class vuart_av_thread; struct ps3av_cmd { - virtual u16 get_size(vuart_av_thread &vuart, const void *pkt_buf) = 0; - virtual void execute(vuart_av_thread &vuart, const void *pkt_buf) = 0; + virtual u16 get_size(vuart_av_thread& vuart, const void* pkt_buf) = 0; + virtual void execute(vuart_av_thread& vuart, const void* pkt_buf) = 0; virtual ~ps3av_cmd() {}; }; class vuart_av_thread { public: - atomic_t initialized{}; shared_mutex rx_mutex{}; @@ -285,20 +282,20 @@ public: u8 hdmi_behavior_mode = PS3AV_HDMI_BEHAVIOR_NORMAL; u16 av_cmd_ver = 0; u32 hdmi_events_bitmask = 0; - bool hdmi_res_set[2]{ false, false }; + bool hdmi_res_set[2]{false, false}; void operator()(); void parse_tx_buffer(u32 buf_size); - vuart_av_thread &operator=(thread_state); + vuart_av_thread& operator=(thread_state); - u32 enque_tx_data(const void *data, u32 data_sz); + u32 enque_tx_data(const void* data, u32 data_sz); u32 get_tx_bytes(); - u32 read_rx_data(void *data, u32 data_sz); + u32 read_rx_data(void* data, u32 data_sz); u32 get_reply_buf_free_size(); - template - void write_resp(u32 cid, u32 status, const void *data = nullptr, u16 data_size = 0); + template + void write_resp(u32 cid, u32 status, const void* data = nullptr, u16 data_size = 0); void add_hdmi_events(UartHdmiEvent first_event, UartHdmiEvent last_event, bool hdmi_0, bool hdmi_1); void add_hdmi_events(UartHdmiEvent last_event, bool hdmi_0, bool hdmi_1); @@ -308,7 +305,6 @@ public: static constexpr auto thread_name = "VUART AV Thread"sv; private: - struct temp_buf { u32 crnt_size = 0; @@ -324,17 +320,17 @@ private: temp_buf temp_rx_buf{}; temp_buf temp_rx_sc_buf{}; - vuart_hdmi_event_handler hdmi_event_handler[2]{ 0, 5000 }; - bool hdcp_first_auth[2]{ true, true }; + vuart_hdmi_event_handler hdmi_event_handler[2]{0, 5000}; + bool hdcp_first_auth[2]{true, true}; - u32 read_tx_data(void *data, u32 data_sz); + u32 read_tx_data(void* data, u32 data_sz); std::shared_ptr get_cmd(u32 cid); void commit_rx_buf(bool syscon_buf); void add_unplug_event(bool hdmi_0, bool hdmi_1); void add_plug_event(bool hdmi_0, bool hdmi_1); void add_hdcp_done_event(bool hdmi_0, bool hdmi_1); - void commit_event_data(const void *data, u16 data_size); + void commit_event_data(const void* data, u16 data_size); void dispatch_hdmi_event(UartHdmiEvent event, UartAudioAvport hdmi); }; @@ -757,7 +753,7 @@ static_assert(sizeof(ps3av_pkt_video_disable_sig) == 12); // SysCalls -error_code sys_uart_initialize(ppu_thread &ppu); -error_code sys_uart_receive(ppu_thread &ppu, vm::ptr buffer, u64 size, u32 mode); -error_code sys_uart_send(ppu_thread &ppu, vm::cptr buffer, u64 size, u32 mode); +error_code sys_uart_initialize(ppu_thread& ppu); +error_code sys_uart_receive(ppu_thread& ppu, vm::ptr buffer, u64 size, u32 mode); +error_code sys_uart_send(ppu_thread& ppu, vm::cptr buffer, u64 size, u32 mode); error_code sys_uart_get_params(vm::ptr buffer); diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_usbd.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_usbd.cpp index c8b5b7d6c..26ceeaa8f 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_usbd.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_usbd.cpp @@ -79,8 +79,8 @@ struct usb_allow_list_entry u16 id_product_min; u16 id_product_max; std::string_view device_name; - u16(*max_device_count)(void); - std::shared_ptr(*make_instance)(u32, const std::array&); + u16 (*max_device_count)(void); + std::shared_ptr (*make_instance)(u32, const std::array&); auto operator<(const usb_allow_list_entry& r) const { return std::tuple(id_vendor, id_product_min, id_product_max, device_name, max_device_count, make_instance) < std::tuple(r.id_vendor, r.id_product_min, r.id_product_max, device_name, max_device_count, make_instance); @@ -160,14 +160,13 @@ private: private: // Counters for device IDs, transfer IDs and pipe IDs atomic_t dev_counter = 1; - u32 transfer_counter = 0; - u32 pipe_counter = 0x10; // Start at 0x10 only for tracing purposes + u32 transfer_counter = 0; + u32 pipe_counter = 0x10; // Start at 0x10 only for tracing purposes // List of device drivers std::unordered_map> ldds; - const std::vector device_allow_list - { + const std::vector device_allow_list{ // Portals {0x1430, 0x0150, 0x0150, "Skylanders Portal", &usb_device_skylander::get_num_emu_devices, &usb_device_skylander::make_instance}, {0x0E6F, 0x0129, 0x0129, "Disney Infinity Base", &usb_device_infinity::get_num_emu_devices, &usb_device_infinity::make_instance}, @@ -175,7 +174,7 @@ private: {0x0E6F, 0x200A, 0x200A, "Kamen Rider Summonride Portal", nullptr, nullptr}, // Cameras - // {0x1415, 0x0020, 0x2000, "Sony Playstation Eye", nullptr, nullptr}, // TODO: verifiy + // {0x1415, 0x0020, 0x2000, "Sony Playstation Eye", nullptr, nullptr}, // TODO: verifiy // Music devices {0x1415, 0x0000, 0x0000, "Singstar Microphone", nullptr, nullptr}, @@ -201,12 +200,11 @@ private: {0x1BAD, 0x3430, 0x343F, "Harmonix Button Guitar - Wii", nullptr, nullptr}, {0x1BAD, 0x3530, 0x353F, "Harmonix Real Guitar - Wii", nullptr, nullptr}, - //Top Shot Elite controllers + // Top Shot Elite controllers {0x12BA, 0x04A0, 0x04A0, "Top Shot Elite", nullptr, nullptr}, {0x12BA, 0x04A1, 0x04A1, "Top Shot Fearmaster", nullptr, nullptr}, {0x12BA, 0x04B0, 0x04B0, "Rapala Fishing Rod", nullptr, nullptr}, - // GT5 Wheels&co {0x046D, 0xC283, 0xC29B, "lgFF_c283_c29b", nullptr, nullptr}, {0x044F, 0xB653, 0xB653, "Thrustmaster RGT FFB Pro", nullptr, nullptr}, @@ -279,7 +277,7 @@ private: libusb_context* ctx = nullptr; #if LIBUSB_API_VERSION >= 0x01000102 - libusb_hotplug_callback_handle callback_handle {}; + libusb_hotplug_callback_handle callback_handle{}; #endif bool hotplug_supported = false; @@ -296,7 +294,7 @@ void LIBUSB_CALL callback_transfer(struct libusb_transfer* transfer) } #if LIBUSB_API_VERSION >= 0x01000102 -static int LIBUSB_CALL hotplug_callback(libusb_context* /*ctx*/, libusb_device * /*dev*/, libusb_hotplug_event event, void * /*user_data*/) +static int LIBUSB_CALL hotplug_callback(libusb_context* /*ctx*/, libusb_device* /*dev*/, libusb_hotplug_event event, void* /*user_data*/) { handle_hotplug_event(event == LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED); return 0; @@ -335,7 +333,7 @@ void usb_handler_thread::perform_scan() { // look if any device which we could be interested in is actually connected libusb_device** list = nullptr; - const ssize_t ndev = libusb_get_device_list(ctx, &list); + const ssize_t ndev = libusb_get_device_list(ctx, &list); std::set seen_usb_devices; if (ndev < 0) @@ -367,9 +365,7 @@ void usb_handler_thread::perform_scan() for (const auto& entry : device_allow_list) { // attach - if (desc.idVendor == entry.id_vendor - && desc.idProduct >= entry.id_product_min - && desc.idProduct <= entry.id_product_max) + if (desc.idVendor == entry.id_vendor && desc.idProduct >= entry.id_product_min && desc.idProduct <= entry.id_product_max) { sys_usbd.success("Found device: %s", std::basic_string(entry.device_name)); libusb_ref_device(dev); @@ -413,7 +409,6 @@ void usb_handler_thread::perform_scan() disconnect_usb_device(dev.second, true); it = usb_passthrough_devices.erase(it); } - } libusb_free_device_list(list, 1); } @@ -423,7 +418,7 @@ usb_handler_thread::usb_handler_thread() #if LIBUSB_API_VERSION >= 0x0100010A libusb_init_option log_lv_opt{}; log_lv_opt.option = LIBUSB_OPTION_LOG_LEVEL; - log_lv_opt.value.ival = LIBUSB_LOG_LEVEL_WARNING;// You can also set the LIBUSB_DEBUG env variable instead + log_lv_opt.value.ival = LIBUSB_LOG_LEVEL_WARNING; // You can also set the LIBUSB_DEBUG env variable instead libusb_init_option log_cb_opt{}; log_cb_opt.option = LIBUSB_OPTION_LOG_CB; @@ -431,8 +426,7 @@ usb_handler_thread::usb_handler_thread() std::vector options = { std::move(log_lv_opt), - std::move(log_cb_opt) - }; + std::move(log_cb_opt)}; if (int res = libusb_init_context(&ctx, options.data(), static_cast(options.size())); res < 0) #else @@ -448,10 +442,10 @@ usb_handler_thread::usb_handler_thread() #elif LIBUSB_API_VERSION >= 0x01000102 if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) { - if (int res = libusb_hotplug_register_callback(ctx, static_cast(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED | - LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT), static_cast(0), LIBUSB_HOTPLUG_MATCH_ANY, LIBUSB_HOTPLUG_MATCH_ANY, - LIBUSB_HOTPLUG_MATCH_ANY, static_cast(hotplug_callback), nullptr, - &callback_handle); res < 0) + if (int res = libusb_hotplug_register_callback(ctx, static_cast(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED | LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT), static_cast(0), LIBUSB_HOTPLUG_MATCH_ANY, LIBUSB_HOTPLUG_MATCH_ANY, + LIBUSB_HOTPLUG_MATCH_ANY, static_cast(hotplug_callback), nullptr, + &callback_handle); + res < 0) { sys_usbd.error("Failed to initialize sys_usbd hotplug: %s", libusb_error_name(res)); } @@ -464,7 +458,7 @@ usb_handler_thread::usb_handler_thread() for (u32 index = 0; index < MAX_SYS_USBD_TRANSFERS; index++) { - transfers[index].transfer = libusb_alloc_transfer(8); + transfers[index].transfer = libusb_alloc_transfer(8); transfers[index].transfer_id = index; } @@ -543,11 +537,12 @@ usb_handler_thread::usb_handler_thread() usb_devices.push_back(std::make_shared(usb_info, get_new_location())); } - const std::vector devices_list = fmt::split(g_cfg.io.midi_devices.to_string(), { "@@@" }); + const std::vector devices_list = fmt::split(g_cfg.io.midi_devices.to_string(), {"@@@"}); for (usz index = 0; index < std::min(max_midi_devices, devices_list.size()); index++) { const midi_device device = midi_device::from_string(::at32(devices_list, index)); - if (device.name.empty()) continue; + if (device.name.empty()) + continue; sys_usbd.notice("Adding Emulated Midi Pro Adapter (type=%s, name=%s)", device.type, device.name); @@ -640,9 +635,9 @@ void usb_handler_thread::operator()() } transfer->result = transfer->expected_result; - transfer->count = transfer->expected_count; - transfer->fake = false; - transfer->busy = false; + transfer->count = transfer->expected_count; + transfer->fake = false; + transfer->busy = false; send_message(SYS_USBD_TRANSFER_COMPLETE, transfer->transfer_id); it = fake_transfers.erase(it); // if we've processed this, then we erase this entry (replacing the iterator with the new reference) @@ -799,9 +794,9 @@ bool usb_handler_thread::get_event(vm::ptr& arg1, vm::ptr& arg2, vm::p if (!usbd_events.empty()) { const auto& usb_event = usbd_events.front(); - *arg1 = std::get<0>(usb_event); - *arg2 = std::get<1>(usb_event); - *arg3 = std::get<2>(usb_event); + *arg1 = std::get<0>(usb_event); + *arg2 = std::get<1>(usb_event); + *arg3 = std::get<2>(usb_event); usbd_events.pop(); sys_usbd.trace("Received event: arg1=0x%x arg2=0x%x arg3=0x%x", *arg1, *arg2, *arg3); return true; @@ -862,8 +857,8 @@ std::pair usb_handler_thread::get_free_transfer() std::lock_guard lock_tf(mutex_transfers); u32 transfer_id = get_free_transfer_id(); - auto& transfer = get_transfer(transfer_id); - transfer.busy = true; + auto& transfer = get_transfer(transfer_id); + transfer.busy = true; return {transfer_id, transfer}; } @@ -932,16 +927,16 @@ void usb_handler_thread::disconnect_usb_device(std::shared_ptr dev, sys_usbd.success("USB device(VID=0x%04x, PID=0x%04x) unassigned, handled_device=0x%x", dev->device._device.idVendor, dev->device._device.idProduct, dev->assigned_number); dev->assigned_number = 0; std::erase_if(open_pipes, [&](const auto& val) - { - return val.second.device == dev; - }); + { + return val.second.device == dev; + }); } if (update_usb_devices) { std::erase_if(usb_devices, [&](const auto& val) - { - return val == dev; - }); + { + return val == dev; + }); } } @@ -1039,7 +1034,6 @@ void handle_hotplug_event(bool connected) } } - error_code sys_usbd_initialize(ppu_thread& ppu, vm::ptr handle) { ppu.state += cpu_flag::wait; @@ -1208,12 +1202,10 @@ error_code sys_usbd_register_ldd(ppu_thread& ppu, u32 handle, vm::cptr s_p // slightly hacky way of getting Namco GCon3 gun to work. // The register_ldd appears to be a more promiscuous mode function, where all device 'inserts' would be presented to the cellUsbd for Probing. // Unsure how many more devices might need similar treatment (i.e. just a compare and force VID/PID add), or if it's worth adding a full promiscuous capability - static const std::unordered_map> predefined_ldds - { + static const std::unordered_map> predefined_ldds{ {"cellUsbPspcm", {0x054C, 0x01CB, 0x01CB}}, {"guncon3", {0x0B9A, 0x0800, 0x0800}}, - {"PS3A-USJ", {0x0B9A, 0x0900, 0x0910}} - }; + {"PS3A-USJ", {0x0B9A, 0x0900, 0x0910}}}; if (const auto iterator = predefined_ldds.find(product); iterator != predefined_ldds.end()) { @@ -1404,7 +1396,7 @@ error_code sys_usbd_transfer_data(ppu_thread& ppu, u32 handle, u32 id_pipe, vm:: return CELL_EINVAL; } - const auto& pipe = usbh.get_pipe(id_pipe); + const auto& pipe = usbh.get_pipe(id_pipe); auto&& [transfer_id, transfer] = usbh.get_free_transfer(); transfer.assigned_number = pipe.device->assigned_number; @@ -1482,7 +1474,7 @@ error_code sys_usbd_isochronous_transfer_data(ppu_thread& ppu, u32 handle, u32 i return CELL_EINVAL; } - const auto& pipe = usbh.get_pipe(id_pipe); + const auto& pipe = usbh.get_pipe(id_pipe); auto&& [transfer_id, transfer] = usbh.get_free_transfer(); pipe.device->isochronous_transfer(&transfer); @@ -1505,8 +1497,8 @@ error_code sys_usbd_get_transfer_status(ppu_thread& ppu, u32 handle, u32 id_tran return CELL_EINVAL; const auto status = usbh.get_transfer_status(id_transfer); - *result = status.first; - *count = status.second; + *result = status.first; + *count = status.second; return CELL_OK; } @@ -1526,7 +1518,7 @@ error_code sys_usbd_get_isochronous_transfer_status(ppu_thread& ppu, u32 handle, const auto status = usbh.get_isochronous_transfer_status(id_transfer); - *result = status.first; + *result = status.first; *request = status.second; return CELL_OK; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_usbd.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_usbd.h index a2fd911e3..81f39f29c 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_usbd.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_usbd.h @@ -11,29 +11,29 @@ class ppu_thread; // PS3 internal codes enum PS3StandardUsbErrors : u32 { - HC_CC_NOERR = 0x00, - EHCI_CC_MISSMF = 0x10, - EHCI_CC_XACT = 0x20, - EHCI_CC_BABBLE = 0x30, + HC_CC_NOERR = 0x00, + EHCI_CC_MISSMF = 0x10, + EHCI_CC_XACT = 0x20, + EHCI_CC_BABBLE = 0x30, EHCI_CC_DATABUF = 0x40, - EHCI_CC_HALTED = 0x50, + EHCI_CC_HALTED = 0x50, }; enum PS3IsochronousUsbErrors : u8 { - USBD_HC_CC_NOERR = 0x00, - USBD_HC_CC_MISSMF = 0x01, - USBD_HC_CC_XACT = 0x02, - USBD_HC_CC_BABBLE = 0x04, + USBD_HC_CC_NOERR = 0x00, + USBD_HC_CC_MISSMF = 0x01, + USBD_HC_CC_XACT = 0x02, + USBD_HC_CC_BABBLE = 0x04, USBD_HC_CC_DATABUF = 0x08, }; enum SysUsbdEvents : u32 { - SYS_USBD_ATTACH = 0x01, - SYS_USBD_DETACH = 0x02, + SYS_USBD_ATTACH = 0x01, + SYS_USBD_DETACH = 0x02, SYS_USBD_TRANSFER_COMPLETE = 0x03, - SYS_USBD_TERMINATE = 0x04, + SYS_USBD_TERMINATE = 0x04, }; // PS3 internal structures diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_vm.cpp b/rpcs3/rpcs3/Emu/Cell/lv2/sys_vm.cpp index 2a224d233..aa9ac9ff2 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_vm.cpp +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_vm.cpp @@ -8,10 +8,7 @@ #include "Emu/Cell/timers.hpp" sys_vm_t::sys_vm_t(u32 _addr, u32 vsize, lv2_memory_container* ct, u32 psize) - : ct(ct) - , addr(_addr) - , size(vsize) - , psize(psize) + : ct(ct), addr(_addr), size(vsize), psize(psize) { // Write ID g_ids[addr >> 28].release(idm::last_id()); @@ -37,10 +34,7 @@ struct sys_vm_global_t }; sys_vm_t::sys_vm_t(utils::serial& ar) - : ct(lv2_memory_container::search(ar)) - , addr(ar) - , size(ar) - , psize(ar) + : ct(lv2_memory_container::search(ar)), addr(ar), size(ar), psize(ar) { g_ids[addr >> 28].release(idm::last_id()); g_fxo->need(); @@ -73,17 +67,18 @@ error_code sys_vm_memory_map(ppu_thread& ppu, u64 vsize, u64 psize, u32 cid, u64 } if (!g_fxo->get().total_vsize.fetch_op([vsize, has_root = g_ps3_process_info.has_root_perm()](u32& size) - { - // A single process can hold up to 256MB of virtual memory, even on DECR - // VSH can hold more - if ((has_root ? 0x1E000000 : 0x10000000) - size < vsize) - { - return false; - } + { + // A single process can hold up to 256MB of virtual memory, even on DECR + // VSH can hold more + if ((has_root ? 0x1E000000 : 0x10000000) - size < vsize) + { + return false; + } - size += static_cast(vsize); - return true; - }).second) + size += static_cast(vsize); + return true; + }) + .second) { return CELL_EBUSY; } @@ -140,14 +135,14 @@ error_code sys_vm_unmap(ppu_thread& ppu, u32 addr) // Free block and info const auto vmo = idm::withdraw(sys_vm_t::find_id(addr), [&](sys_vm_t& vmo) - { - // Free block - ensure(vm::unmap(addr).second); + { + // Free block + ensure(vm::unmap(addr).second); - // Return memory - vmo.ct->free(vmo.psize); - g_fxo->get().total_vsize -= vmo.size; - }); + // Return memory + vmo.ct->free(vmo.psize); + g_fxo->get().total_vsize -= vmo.size; + }); if (!vmo) { @@ -169,20 +164,20 @@ error_code sys_vm_append_memory(ppu_thread& ppu, u32 addr, u64 size) } const auto block = idm::check(sys_vm_t::find_id(addr), [&](sys_vm_t& vmo) -> CellError - { - if (vmo.addr != addr) { - return CELL_EINVAL; - } + if (vmo.addr != addr) + { + return CELL_EINVAL; + } - if (!vmo.ct->take(size)) - { - return CELL_ENOMEM; - } + if (!vmo.ct->take(size)) + { + return CELL_ENOMEM; + } - vmo.psize += static_cast(size); - return {}; - }); + vmo.psize += static_cast(size); + return {}; + }); if (!block) { @@ -209,32 +204,32 @@ error_code sys_vm_return_memory(ppu_thread& ppu, u32 addr, u64 size) } const auto block = idm::check(sys_vm_t::find_id(addr), [&](sys_vm_t& vmo) -> CellError - { - if (vmo.addr != addr) { - return CELL_EINVAL; - } - - auto [_, ok] = vmo.psize.fetch_op([&](u32& value) - { - if (value <= size || value - size < 0x100000ull) + if (vmo.addr != addr) { - return false; + return CELL_EINVAL; } - value -= static_cast(size); - return true; + auto [_, ok] = vmo.psize.fetch_op([&](u32& value) + { + if (value <= size || value - size < 0x100000ull) + { + return false; + } + + value -= static_cast(size); + return true; + }); + + if (!ok) + { + return CELL_EBUSY; + } + + vmo.ct->free(size); + return {}; }); - if (!ok) - { - return CELL_EBUSY; - } - - vmo.ct->free(size); - return {}; - }); - if (!block) { return CELL_EINVAL; diff --git a/rpcs3/rpcs3/Emu/Cell/lv2/sys_vm.h b/rpcs3/rpcs3/Emu/Cell/lv2/sys_vm.h index 4d588b920..9493eb967 100644 --- a/rpcs3/rpcs3/Emu/Cell/lv2/sys_vm.h +++ b/rpcs3/rpcs3/Emu/Cell/lv2/sys_vm.h @@ -7,10 +7,10 @@ enum : u64 { - SYS_VM_STATE_INVALID = 0ull, - SYS_VM_STATE_UNUSED = 1ull, + SYS_VM_STATE_INVALID = 0ull, + SYS_VM_STATE_UNUSED = 1ull, SYS_VM_STATE_ON_MEMORY = 2ull, - SYS_VM_STATE_STORED = 4ull, + SYS_VM_STATE_STORED = 4ull, SYS_VM_POLICY_AUTO_RECOMMENDED = 1ull, }; diff --git a/rpcs3/rpcs3/Emu/GDB.cpp b/rpcs3/rpcs3/Emu/GDB.cpp index 20e6c82cd..c4726acd1 100644 --- a/rpcs3/rpcs3/Emu/GDB.cpp +++ b/rpcs3/rpcs3/Emu/GDB.cpp @@ -137,7 +137,7 @@ void gdb_thread::start_server() { struct addrinfo hints{}; struct addrinfo* info; - hints.ai_flags = AI_PASSIVE; + hints.ai_flags = AI_PASSIVE; hints.ai_socktype = SOCK_STREAM; std::string bind_addr = match[1].str(); @@ -253,7 +253,7 @@ u8 gdb_thread::read_hexbyte() bool gdb_thread::try_read_cmd(gdb_cmd& out_cmd) { char c = read_char(); - //interrupt + // interrupt if (c == 0x03) [[unlikely]] { out_cmd.cmd = '\x03'; @@ -263,7 +263,7 @@ bool gdb_thread::try_read_cmd(gdb_cmd& out_cmd) } if (c != '$') [[unlikely]] { - //gdb starts conversation with + for some reason + // gdb starts conversation with + for some reason if (c == '+') { c = read_char(); @@ -273,7 +273,7 @@ bool gdb_thread::try_read_cmd(gdb_cmd& out_cmd) fmt::throw_exception("Expected start of packet character '$', got '%c' instead", c); } } - //clear packet data + // clear packet data out_cmd.cmd = ""; out_cmd.data = ""; out_cmd.checksum = 0; @@ -287,13 +287,13 @@ bool gdb_thread::try_read_cmd(gdb_cmd& out_cmd) break; } checksum = (checksum + reinterpret_cast(c)) % 256; - //escaped char + // escaped char if (c == '}') { c = read_char() ^ 0x20; checksum = (checksum + reinterpret_cast(c)) % 256; } - //cmd-data splitters + // cmd-data splitters if (cmd_part && ((c == ':') || (c == '.') || (c == ';'))) { cmd_part = false; @@ -301,7 +301,7 @@ bool gdb_thread::try_read_cmd(gdb_cmd& out_cmd) if (cmd_part) { out_cmd.cmd += c; - //only q and v commands can have multi-char command + // only q and v commands can have multi-char command if ((out_cmd.cmd.length() == 1) && (c != 'q') && (c != 'v')) { cmd_part = false; @@ -419,7 +419,7 @@ std::string gdb_thread::to_hexbyte(u8 i) bool gdb_thread::select_thread(u64 id) { - //in case we have none at all + // in case we have none at all selected_thread.reset(); const auto on_select = [&](u32, cpu_thread& cpu) { @@ -436,13 +436,13 @@ bool gdb_thread::select_thread(u64 id) std::string gdb_thread::get_reg(ppu_thread* thread, u32 rid) { - //ids from gdb/features/rs6000/powerpc-64.c - //pc + // ids from gdb/features/rs6000/powerpc-64.c + // pc switch (rid) { case 64: return u64_to_padded_hex(thread->cia); - //msr? + // msr? case 65: return std::string(16, 'x'); case 66: @@ -451,17 +451,18 @@ std::string gdb_thread::get_reg(ppu_thread* thread, u32 rid) return u64_to_padded_hex(thread->lr); case 68: return u64_to_padded_hex(thread->ctr); - //xer + // xer case 69: return std::string(8, 'x'); - //fpscr + // fpscr case 70: return std::string(8, 'x'); default: - if (rid > 70) return ""; - return (rid > 31) - ? u64_to_padded_hex(std::bit_cast(thread->fpr[rid - 32])) //fpr - : u64_to_padded_hex(thread->gpr[rid]); //gpr + if (rid > 70) + return ""; + return (rid > 31) ? u64_to_padded_hex(std::bit_cast(thread->fpr[rid - 32])) // fpr + : + u64_to_padded_hex(thread->gpr[rid]); // gpr } } @@ -472,7 +473,7 @@ bool gdb_thread::set_reg(ppu_thread* thread, u32 rid, const std::string& value) case 64: thread->cia = static_cast(hex_to_u64(value)); return true; - //msr? + // msr? case 65: return true; case 66: @@ -484,14 +485,15 @@ bool gdb_thread::set_reg(ppu_thread* thread, u32 rid, const std::string& value) case 68: thread->ctr = hex_to_u64(value); return true; - //xer + // xer case 69: return true; - //fpscr + // fpscr case 70: return true; default: - if (rid > 70) return false; + if (rid > 70) + return false; if (rid > 31) { const u64 val = hex_to_u64(value); @@ -579,9 +581,9 @@ bool gdb_thread::cmd_thread_info(gdb_cmd&) result += u64_to_padded_hex(static_cast(cpu.id)); }; idm::select>(on_select); - //idm::select>(on_select); + // idm::select>(on_select); - //todo: this may exceed max command length + // todo: this may exceed max command length result = "m" + result + "l"; return send_cmd_ack(result); @@ -669,12 +671,12 @@ bool gdb_thread::cmd_read_memory(gdb_cmd& cmd) else { break; - //result += "xx"; + // result += "xx"; } } if (len && result.empty()) { - //nothing read + // nothing read return send_cmd_ack("E01"); } return send_cmd_ack(result); @@ -726,8 +728,8 @@ bool gdb_thread::cmd_read_all_registers(gdb_cmd&) if (auto ppu = selected_thread->try_get>()) { - //68 64-bit registers, and 3 32-bit - result.reserve(68*16 + 3*8); + // 68 64-bit registers, and 3 32-bit + result.reserve(68 * 16 + 3 * 8); for (int i = 0; i < 71; ++i) { result += get_reg(ppu, i); @@ -787,14 +789,17 @@ bool gdb_thread::cmd_set_thread_ops(gdb_cmd& cmd) bool gdb_thread::cmd_attached_to_what(gdb_cmd&) { - //creating processes from client is not available yet + // creating processes from client is not available yet return send_cmd_ack("1"); } bool gdb_thread::cmd_kill(gdb_cmd&) { GDB.notice("Kill command issued"); - Emu.CallFromMainThread([](){ Emu.GracefulShutdown(); }); + Emu.CallFromMainThread([]() + { + Emu.GracefulShutdown(); + }); return true; } @@ -805,7 +810,7 @@ bool gdb_thread::cmd_continue_support(gdb_cmd&) bool gdb_thread::cmd_vcont(gdb_cmd& cmd) { - //todo: handle multiple actions and thread ids + // todo: handle multiple actions and thread ids this->from_breakpoint = false; if (cmd.data[1] == 'c' || cmd.data[1] == 's') { @@ -827,7 +832,7 @@ bool gdb_thread::cmd_vcont(gdb_cmd& cmd) ppu->add_remove_flags(add_flags, cpu_flag::dbg_pause); } - //special case if app didn't start yet (only loaded) + // special case if app didn't start yet (only loaded) if (Emu.IsReady()) { Emu.Run(true); @@ -838,7 +843,7 @@ bool gdb_thread::cmd_vcont(gdb_cmd& cmd) } wait_with_interrupts(); - //we are in all-stop mode + // we are in all-stop mode Emu.Pause(); select_thread(pausedBy); // we have to remove dbg_pause from thread that paused execution, otherwise @@ -861,7 +866,7 @@ static const u32 INVALID_PTR = 0xffffffff; bool gdb_thread::cmd_set_breakpoint(gdb_cmd& cmd) { char type = cmd.data[0]; - //software breakpoint + // software breakpoint if (type == '0') { u32 addr = INVALID_PTR; @@ -879,14 +884,14 @@ bool gdb_thread::cmd_set_breakpoint(gdb_cmd& cmd) ppu_breakpoint(addr, true); return send_cmd_ack("OK"); } - //other breakpoint types are not supported + // other breakpoint types are not supported return send_cmd_ack(""); } bool gdb_thread::cmd_remove_breakpoint(gdb_cmd& cmd) { char type = cmd.data[0]; - //software breakpoint + // software breakpoint if (type == '0') { u32 addr = INVALID_PTR; @@ -899,12 +904,18 @@ bool gdb_thread::cmd_remove_breakpoint(gdb_cmd& cmd) ppu_breakpoint(addr, false); return send_cmd_ack("OK"); } - //other breakpoint types are not supported + // other breakpoint types are not supported return send_cmd_ack(""); - } -#define PROCESS_CMD(cmds,handler) if (cmd.cmd == cmds) { if (!handler(cmd)) break; else continue; } +#define PROCESS_CMD(cmds, handler) \ + if (cmd.cmd == cmds) \ + { \ + if (!handler(cmd)) \ + break; \ + else \ + continue; \ + } gdb_thread::gdb_thread() noexcept { @@ -944,7 +955,7 @@ void gdb_thread::operator()() GDB.error("Could not establish new connection."); return; } - //stop immediately + // stop immediately if (Emu.IsRunning()) { Emu.Pause(); diff --git a/rpcs3/rpcs3/Emu/GDB.h b/rpcs3/rpcs3/Emu/GDB.h index 75d272f9d..4c86d0e5c 100644 --- a/rpcs3/rpcs3/Emu/GDB.h +++ b/rpcs3/rpcs3/Emu/GDB.h @@ -19,53 +19,53 @@ class gdb_thread u64 continue_ops_thread_id = ANY_THREAD; u64 general_ops_thread_id = ANY_THREAD; - //initialize server socket and start listening + // initialize server socket and start listening void start_server(); - //read at most cnt bytes to buf, returns number of bytes actually read + // read at most cnt bytes to buf, returns number of bytes actually read int read(void* buf, int cnt) const; - //reads one character + // reads one character char read_char(); - //reads pairs of hex characters and returns their integer value + // reads pairs of hex characters and returns their integer value u8 read_hexbyte(); // Tries to read command, returns false on error bool try_read_cmd(gdb_cmd& out_cmd); - //reads commands until receiveing one with valid checksum - //in case of other exception (i.e. wrong first char of command) - //it will log exception text and return false - //in that case best for caller would be to stop reading, because - //chance of getting correct command is low + // reads commands until receiveing one with valid checksum + // in case of other exception (i.e. wrong first char of command) + // it will log exception text and return false + // in that case best for caller would be to stop reading, because + // chance of getting correct command is low bool read_cmd(gdb_cmd& out_cmd); - //send cnt bytes from buf to client + // send cnt bytes from buf to client void send(const char* buf, int cnt) const; - //send character to client + // send character to client void send_char(char c); - //acknowledge packet, either as accepted or declined + // acknowledge packet, either as accepted or declined void ack(bool accepted); - //sends command body cmd to client + // sends command body cmd to client void send_cmd(const std::string& cmd); - //sends command to client until receives positive acknowledgement - //returns false in case some error happened, and command wasn't sent + // sends command to client until receives positive acknowledgement + // returns false in case some error happened, and command wasn't sent bool send_cmd_ack(const std::string& cmd); - //appends encoded char c to string str, and returns checksum. encoded byte can occupy 2 bytes + // appends encoded char c to string str, and returns checksum. encoded byte can occupy 2 bytes static u8 append_encoded_char(char c, std::string& str); - //convert u8 to 2 byte hexademical representation + // convert u8 to 2 byte hexademical representation static std::string to_hexbyte(u8 i); - //choose thread, support ALL_THREADS and ANY_THREAD values, returns true if some thread was selected + // choose thread, support ALL_THREADS and ANY_THREAD values, returns true if some thread was selected bool select_thread(u64 id); - //returns register value as hex string by register id (in gdb), in case of wrong id returns empty string + // returns register value as hex string by register id (in gdb), in case of wrong id returns empty string static std::string get_reg(ppu_thread* thread, u32 rid); - //sets register value to hex string by register id (in gdb), in case of wrong id returns false + // sets register value to hex string by register id (in gdb), in case of wrong id returns false static bool set_reg(ppu_thread* thread, u32 rid, const std::string& value); - //returns size of register with id rid in bytes, zero if invalid rid is provided + // returns size of register with id rid in bytes, zero if invalid rid is provided static u32 get_reg_size(ppu_thread* thread, u32 rid); - //send reason of stop, returns false if sending response failed + // send reason of stop, returns false if sending response failed bool send_reason(); void wait_with_interrupts(); - //commands + // commands bool cmd_extended_mode(gdb_cmd& cmd); bool cmd_reason(gdb_cmd& cmd); bool cmd_supported(gdb_cmd& cmd); diff --git a/rpcs3/rpcs3/Emu/IPC_config.h b/rpcs3/rpcs3/Emu/IPC_config.h index 3209257d2..29be94a0f 100644 --- a/rpcs3/rpcs3/Emu/IPC_config.h +++ b/rpcs3/rpcs3/Emu/IPC_config.h @@ -4,8 +4,8 @@ struct cfg_ipc : cfg::node { - cfg::_bool ipc_server_enabled{ this, "IPC Server enabled", false }; - cfg::_int<1025, 65535> ipc_port{ this, "IPC Port", 28012 }; + cfg::_bool ipc_server_enabled{this, "IPC Server enabled", false}; + cfg::_int<1025, 65535> ipc_port{this, "IPC Port", 28012}; void load(); void save() const; diff --git a/rpcs3/rpcs3/Emu/IPC_socket.cpp b/rpcs3/rpcs3/Emu/IPC_socket.cpp index 81ff9c11c..472b63c5a 100644 --- a/rpcs3/rpcs3/Emu/IPC_socket.cpp +++ b/rpcs3/rpcs3/Emu/IPC_socket.cpp @@ -4,7 +4,6 @@ #include "IPC_socket.h" #include "rpcs3_version.h" - namespace IPC_socket { const u8& IPC_impl::read8(u32 addr) @@ -119,4 +118,4 @@ namespace IPC_socket m_ipc_server.reset(); } } -} +} // namespace IPC_socket diff --git a/rpcs3/rpcs3/Emu/IPC_socket.h b/rpcs3/rpcs3/Emu/IPC_socket.h index d973184c3..618dafea3 100644 --- a/rpcs3/rpcs3/Emu/IPC_socket.h +++ b/rpcs3/rpcs3/Emu/IPC_socket.h @@ -27,7 +27,7 @@ namespace IPC_socket static const be_t& read64(u32 addr); static void write64(u32 addr, be_t value); - template + template static void error(const const_str& fmt, Args&&... args) { IPC.error(fmt, std::forward(args)...); @@ -57,4 +57,4 @@ namespace IPC_socket explicit IPC_server_manager(bool enabled); void set_server_enabled(bool enabled); }; -} +} // namespace IPC_socket diff --git a/rpcs3/rpcs3/Emu/IdManager.h b/rpcs3/rpcs3/Emu/IdManager.h index b3c898c23..bf0823a52 100644 --- a/rpcs3/rpcs3/Emu/IdManager.h +++ b/rpcs3/rpcs3/Emu/IdManager.h @@ -20,17 +20,17 @@ enum class thread_state : u32; extern u16 serial_breathe_and_tag(utils::serial& ar, std::string_view name, bool tag_bit); template -concept IdmCompatible = requires () { u32{T::id_base}, u32{T::id_step}, u32{T::id_count}; }; +concept IdmCompatible = requires() { u32{T::id_base}, u32{T::id_step}, u32{T::id_count}; }; template -concept IdmBaseCompatible = (std::is_final_v ? IdmCompatible : !!(requires () { u32{T::id_step}, u32{T::id_count}; })); +concept IdmBaseCompatible = (std::is_final_v ? IdmCompatible : !!(requires() { u32{T::id_step}, u32{T::id_count}; })); template concept IdmSavable = IdmBaseCompatible && T::savestate_init_pos != 0 && (requires(T& t, utils::serial& ar) { t.save(stx::exact_t(ar)); }); // If id_base is declared in base type, than storage type must declare id_type template -concept IdmTypesCompatible = PtrSame && IdmCompatible && IdmBaseCompatible && (std::is_same_v || !IdmCompatible || !!(requires () { u32{Type::id_type}; })); +concept IdmTypesCompatible = PtrSame && IdmCompatible && IdmBaseCompatible && (std::is_same_v || !IdmCompatible || !!(requires() { u32{Type::id_type}; })); // Helper namespace namespace id_manager @@ -46,7 +46,8 @@ namespace id_manager return {0, 0}; } - template requires requires () { T::id_invl_range.first + T::id_invl_range.second; } + template + requires requires() { T::id_invl_range.first + T::id_invl_range.second; } constexpr std::pair get_invl_range() { return T::id_invl_range; @@ -58,7 +59,8 @@ namespace id_manager return false; } - template requires requires () { bool{T::id_lowest}; } + template + requires requires() { bool{T::id_lowest}; } consteval bool get_force_lowest_id() { return T::id_lowest; @@ -73,10 +75,10 @@ namespace id_manager { static_assert(IdmCompatible, "ID object must specify: id_base, id_step, id_count"); - static constexpr u32 base = T::id_base; // First ID (N = 0) - static constexpr u32 step = T::id_step; // Any ID: N * id_setp + id_base + static constexpr u32 base = T::id_base; // First ID (N = 0) + static constexpr u32 step = T::id_step; // Any ID: N * id_setp + id_base static constexpr u32 count = T::id_count; // Limit: N < id_count - static constexpr u32 invalid = -+!base; // Invalid ID sample + static constexpr u32 invalid = -+!base; // Invalid ID sample static constexpr std::pair invl_range = get_invl_range(); static constexpr bool uses_lowest_id = get_force_lowest_id(); @@ -84,7 +86,7 @@ namespace id_manager static_assert(u32{count} && u32{step} && u64{step} * (count - 1) + base < u32{umax} + u64{base != 0 ? 1 : 0}, "ID traits: invalid object range"); // TODO: Add more conditions - static_assert(!invl_range.second || (u64{invl_range.second} + invl_range.first <= 32 /*....*/ )); + static_assert(!invl_range.second || (u64{invl_range.second} + invl_range.first <= 32 /*....*/)); }; static constexpr u32 get_index(u32 id, u32 base, u32 step, u32 count, std::pair invl_range) @@ -108,8 +110,7 @@ namespace id_manager template struct id_traits_load_func { - static constexpr pointer_keeper(*load)(utils::serial&) = [](utils::serial& ar) -> pointer_keeper - { + static constexpr pointer_keeper (*load)(utils::serial&) = [](utils::serial& ar) -> pointer_keeper { stx::shared_ptr ptr; if constexpr (std::is_constructible_v, stx::exact_t>) @@ -121,7 +122,10 @@ namespace id_manager ptr = stx::make_shared(stx::exact_t(ar)); } - return [ptr](void* storage) { *static_cast*>(storage) = ptr; }; + return [ptr](void* storage) + { + *static_cast*>(storage) = ptr; + }; }; }; @@ -129,8 +133,7 @@ namespace id_manager requires requires() { &T::load; } struct id_traits_load_func { - static constexpr pointer_keeper(*load)(utils::serial&) = [](utils::serial& ar) -> pointer_keeper - { + static constexpr pointer_keeper (*load)(utils::serial&) = [](utils::serial& ar) -> pointer_keeper { return T::load(stx::exact_t(ar)); }; }; @@ -138,14 +141,20 @@ namespace id_manager template struct id_traits_savable_func { - static constexpr bool(*savable)(void*) = [](void*) -> bool { return true; }; + static constexpr bool (*savable)(void*) = [](void*) -> bool + { + return true; + }; }; template requires requires { &T::savable; } struct id_traits_savable_func { - static constexpr bool(*savable)(void* ptr) = [](void* ptr) -> bool { return static_cast(ptr)->savable(); }; + static constexpr bool (*savable)(void* ptr) = [](void* ptr) -> bool + { + return static_cast(ptr)->savable(); + }; }; struct dummy_construct @@ -166,9 +175,9 @@ namespace id_manager struct typeinfo { public: - std::function(*load)(utils::serial&); - void(*save)(utils::serial&, void*); - bool(*savable)(void* ptr); + std::function (*load)(utils::serial&); + void (*save)(utils::serial&, void*); + bool (*savable)(void* ptr); u32 base; u32 step; @@ -184,7 +193,8 @@ namespace id_manager } // Specified type ID for containers which their types may be sharing an overlapping IDs range - template requires requires () { u32{T::id_type}; } + template + requires requires() { u32{T::id_type}; } static consteval u32 get_type() { return T::id_type; @@ -201,12 +211,19 @@ namespace id_manager if constexpr (std::is_same_v) { info = - { - +id_traits_load_func::load, - +[](utils::serial& ar, void* obj) { static_cast(obj)->save(ar); }, - +id_traits_savable_func::savable, - id_traits::base, id_traits::step, id_traits::count, id_traits::uses_lowest_id, id_traits::invl_range, - }; + { + +id_traits_load_func::load, + +[](utils::serial& ar, void* obj) + { + static_cast(obj)->save(ar); + }, + +id_traits_savable_func::savable, + id_traits::base, + id_traits::step, + id_traits::count, + id_traits::uses_lowest_id, + id_traits::invl_range, + }; const u128 key = u128{get_type()} << 64 | std::bit_cast(C::savestate_init_pos); @@ -225,12 +242,16 @@ namespace id_manager else { info = - { - nullptr, - nullptr, - nullptr, - id_traits::base, id_traits::step, id_traits::count, id_traits::uses_lowest_id, id_traits::invl_range, - }; + { + nullptr, + nullptr, + nullptr, + id_traits::base, + id_traits::step, + id_traits::count, + id_traits::uses_lowest_id, + id_traits::invl_range, + }; } return info; @@ -245,15 +266,14 @@ namespace id_manager // ID value with additional type stored class id_key { - u32 m_value = 0; // ID value - u32 m_base = umax; // ID base (must be unique for each type in the same container) + u32 m_value = 0; // ID value + u32 m_base = umax; // ID base (must be unique for each type in the same container) public: id_key() noexcept = default; id_key(u32 value, u32 type) noexcept - : m_value(value) - , m_base(type) + : m_value(value), m_base(type) { } @@ -296,7 +316,8 @@ namespace id_manager static constexpr double savestate_init_pos_original = T::savestate_init_pos; static constexpr double savestate_init_pos = std::bit_cast(std::bit_cast(savestate_init_pos_original) - 1); - id_map(utils::serial& ar) noexcept requires IdmSavable + id_map(utils::serial& ar) noexcept + requires IdmSavable { while (true) { @@ -341,11 +362,13 @@ namespace id_manager } } - void save(utils::serial& ar) requires IdmSavable + void save(utils::serial& ar) + requires IdmSavable { for (const auto& p : vec_data) { - if (!p) continue; + if (!p) + continue; auto& key = vec_keys[&p - vec_data.data()]; @@ -376,7 +399,8 @@ namespace id_manager serial_breathe_and_tag(ar, g_fxo->get_name>(), true); } - id_map& operator=(thread_state state) noexcept requires (std::is_assignable_v) + id_map& operator=(thread_state state) noexcept + requires(std::is_assignable_v) { if (highest_index) { @@ -401,7 +425,7 @@ namespace id_manager return *this; } }; -} +} // namespace id_manager // Object manager for emulated process. Multiple objects of specified arbitrary type are given unique IDs. class idm @@ -513,7 +537,7 @@ class idm { if (!id_manager::id_traits::invl_range.second || key.value() == id) { - return { &data, &key }; + return {&data, &key}; } } } @@ -567,7 +591,6 @@ class idm } public: - // Remove all objects of a type template static inline void clear() @@ -592,10 +615,14 @@ public: } // Add a new ID of specified type with specified constructor arguments (returns object or null_ptr) - template requires (std::is_constructible_v) + template + requires(std::is_constructible_v) static inline stx::shared_ptr make_ptr(Args&&... args) { - if (auto pair = create_id([&] { return stx::make_shared(std::forward(args)...); })) + if (auto pair = create_id([&] + { + return stx::make_shared(std::forward(args)...); + })) { return pair; } @@ -604,10 +631,14 @@ public: } // Add a new ID of specified type with specified constructor arguments (returns id) - template requires (std::is_constructible_v) + template + requires(std::is_constructible_v) static inline u32 make(Args&&... args) { - if (create_id([&] { return stx::make_shared(std::forward(args)...); })) + if (create_id([&] + { + return stx::make_shared(std::forward(args)...); + })) { return last_id(); } @@ -633,7 +664,11 @@ public: requires IdmTypesCompatible static inline u32 import_existing(stx::shared_ptr ptr, u32 id = id_manager::id_traits::invalid) { - return import([&]() -> stx::shared_ptr { return std::move(ptr); }, id); + return import ([&]() -> stx::shared_ptr + { + return std::move(ptr); + }, + id); } // Check the ID without locking (can be called from other method) diff --git a/rpcs3/rpcs3/Emu/Io/Buzz.cpp b/rpcs3/rpcs3/Emu/Io/Buzz.cpp index 7c7890d41..2d7549574 100644 --- a/rpcs3/rpcs3/Emu/Io/Buzz.cpp +++ b/rpcs3/rpcs3/Emu/Io/Buzz.cpp @@ -13,70 +13,68 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](buzz_btn value) - { - switch (value) { - case buzz_btn::red: return "Red"; - case buzz_btn::yellow: return "Yellow"; - case buzz_btn::green: return "Green"; - case buzz_btn::orange: return "Orange"; - case buzz_btn::blue: return "Blue"; - case buzz_btn::count: return "Count"; - } + switch (value) + { + case buzz_btn::red: return "Red"; + case buzz_btn::yellow: return "Yellow"; + case buzz_btn::green: return "Green"; + case buzz_btn::orange: return "Orange"; + case buzz_btn::blue: return "Blue"; + case buzz_btn::count: return "Count"; + } - return unknown; - }); + return unknown; + }); } usb_device_buzz::usb_device_buzz(u32 first_controller, u32 last_controller, const std::array& location) - : usb_device_emulated(location) - , m_first_controller(first_controller) - , m_last_controller(last_controller) + : usb_device_emulated(location), m_first_controller(first_controller), m_last_controller(last_controller) { device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, UsbDeviceDescriptor{ - .bcdUSB = 0x0200, - .bDeviceClass = 0x00, - .bDeviceSubClass = 0x00, - .bDeviceProtocol = 0x00, - .bMaxPacketSize0 = 0x08, - .idVendor = 0x054c, - .idProduct = 0x0002, - .bcdDevice = 0x05a1, - .iManufacturer = 0x02, - .iProduct = 0x01, - .iSerialNumber = 0x00, + .bcdUSB = 0x0200, + .bDeviceClass = 0x00, + .bDeviceSubClass = 0x00, + .bDeviceProtocol = 0x00, + .bMaxPacketSize0 = 0x08, + .idVendor = 0x054c, + .idProduct = 0x0002, + .bcdDevice = 0x05a1, + .iManufacturer = 0x02, + .iProduct = 0x01, + .iSerialNumber = 0x00, .bNumConfigurations = 0x01}); auto& config0 = device.add_node(UsbDescriptorNode(USB_DESCRIPTOR_CONFIG, UsbDeviceConfiguration{ - .wTotalLength = 0x0022, - .bNumInterfaces = 0x01, + .wTotalLength = 0x0022, + .bNumInterfaces = 0x01, .bConfigurationValue = 0x01, - .iConfiguration = 0x00, - .bmAttributes = 0x80, - .bMaxPower = 0x32})); + .iConfiguration = 0x00, + .bmAttributes = 0x80, + .bMaxPower = 0x32})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_INTERFACE, UsbDeviceInterface{ - .bInterfaceNumber = 0x00, - .bAlternateSetting = 0x00, - .bNumEndpoints = 0x01, - .bInterfaceClass = 0x03, + .bInterfaceNumber = 0x00, + .bAlternateSetting = 0x00, + .bNumEndpoints = 0x01, + .bInterfaceClass = 0x03, .bInterfaceSubClass = 0x00, .bInterfaceProtocol = 0x00, - .iInterface = 0x00})); + .iInterface = 0x00})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_HID, UsbDeviceHID{ - .bcdHID = 0x0111, - .bCountryCode = 0x33, - .bNumDescriptors = 0x01, - .bDescriptorType = 0x22, + .bcdHID = 0x0111, + .bCountryCode = 0x33, + .bNumDescriptors = 0x01, + .bDescriptorType = 0x22, .wDescriptorLength = 0x004e})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_ENDPOINT, UsbDeviceEndpoint{ .bEndpointAddress = 0x81, - .bmAttributes = 0x03, - .wMaxPacketSize = 0x0008, - .bInterval = 0x0A})); + .bmAttributes = 0x03, + .wMaxPacketSize = 0x0008, + .bInterval = 0x0A})); add_string("Logitech Buzz(tm) Controller V1"); add_string("Logitech"); @@ -105,11 +103,11 @@ u16 usb_device_buzz::get_num_emu_devices() void usb_device_buzz::control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 wLength, u32 buf_size, u8* buf, UsbTransfer* transfer) { - transfer->fake = true; - transfer->expected_count = buf_size; + transfer->fake = true; + transfer->expected_count = buf_size; transfer->expected_result = HC_CC_NOERR; // Control transfers are nearly instant - transfer->expected_time = get_timestamp() + 100; + transfer->expected_time = get_timestamp() + 100; switch (bmRequestType) { @@ -122,8 +120,7 @@ void usb_device_buzz::control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue buf[1] == 0xff ? "ON" : "OFF", buf[2] == 0xff ? "ON" : "OFF", buf[3] == 0xff ? "ON" : "OFF", - buf[4] == 0xff ? "ON" : "OFF" - ); + buf[4] == 0xff ? "ON" : "OFF"); break; default: buzz_log.error("Unhandled Request: 0x%02X/0x%02X", bmRequestType, bRequest); @@ -143,8 +140,8 @@ void usb_device_buzz::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endpoint*/ const u8 max_index = 2 + (4 + 5 * m_last_controller) / 8; ensure(buf_size > max_index); - transfer->fake = true; - transfer->expected_count = 5; + transfer->fake = true; + transfer->expected_count = 5; transfer->expected_result = HC_CC_NOERR; // Interrupt transfers are slow (6ms, TODO accurate measurement) transfer->expected_time = get_timestamp() + 6000; @@ -165,7 +162,7 @@ void usb_device_buzz::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endpoint*/ std::lock_guard lock(pad::g_pad_mutex); const auto handler = pad::get_pad_thread(); - const auto& pads = handler->GetPads(); + const auto& pads = handler->GetPads(); ensure(pads.size() > m_last_controller); ensure(g_cfg_buzz.players.size() > m_last_controller); diff --git a/rpcs3/rpcs3/Emu/Io/GHLtar.cpp b/rpcs3/rpcs3/Emu/Io/GHLtar.cpp index e520e53c7..c01a70f3b 100644 --- a/rpcs3/rpcs3/Emu/Io/GHLtar.cpp +++ b/rpcs3/rpcs3/Emu/Io/GHLtar.cpp @@ -13,35 +13,35 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](ghltar_btn value) - { - switch (value) { - case ghltar_btn::w1: return "W1"; - case ghltar_btn::w2: return "W2"; - case ghltar_btn::w3: return "W3"; - case ghltar_btn::b1: return "B1"; - case ghltar_btn::b2: return "B2"; - case ghltar_btn::b3: return "B3"; - case ghltar_btn::start: return "Start"; - case ghltar_btn::hero_power: return "Hero Power"; - case ghltar_btn::ghtv: return "GHTV"; - case ghltar_btn::strum_down: return "Strum Down"; - case ghltar_btn::strum_up: return "Strum Up"; - case ghltar_btn::dpad_left: return "D-Pad Left"; - case ghltar_btn::dpad_right: return "D-Pad Right"; - case ghltar_btn::whammy: return "Whammy"; - case ghltar_btn::tilt: return "Tilt"; - case ghltar_btn::count: return "Count"; - } + switch (value) + { + case ghltar_btn::w1: return "W1"; + case ghltar_btn::w2: return "W2"; + case ghltar_btn::w3: return "W3"; + case ghltar_btn::b1: return "B1"; + case ghltar_btn::b2: return "B2"; + case ghltar_btn::b3: return "B3"; + case ghltar_btn::start: return "Start"; + case ghltar_btn::hero_power: return "Hero Power"; + case ghltar_btn::ghtv: return "GHTV"; + case ghltar_btn::strum_down: return "Strum Down"; + case ghltar_btn::strum_up: return "Strum Up"; + case ghltar_btn::dpad_left: return "D-Pad Left"; + case ghltar_btn::dpad_right: return "D-Pad Right"; + case ghltar_btn::whammy: return "Whammy"; + case ghltar_btn::tilt: return "Tilt"; + case ghltar_btn::count: return "Count"; + } - return unknown; - }); + return unknown; + }); } usb_device_ghltar::usb_device_ghltar(u32 controller_index, const std::array& location) : usb_device_emulated(location), m_controller_index(controller_index) { - device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, UsbDeviceDescriptor{0x0200, 0x00, 0x00, 0x00, 0x20, 0x12BA, 0x074B, 0x0100, 0x01, 0x02, 0x00, 0x01}); + device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, UsbDeviceDescriptor{0x0200, 0x00, 0x00, 0x00, 0x20, 0x12BA, 0x074B, 0x0100, 0x01, 0x02, 0x00, 0x01}); auto& config0 = device.add_node(UsbDescriptorNode(USB_DESCRIPTOR_CONFIG, UsbDeviceConfiguration{0x0029, 0x01, 0x01, 0x00, 0x80, 0x96})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_INTERFACE, UsbDeviceInterface{0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_HID, UsbDeviceHID{0x0111, 0x00, 0x01, 0x22, 0x001d})); @@ -70,20 +70,20 @@ void usb_device_ghltar::control_transfer(u8 bmRequestType, u8 bRequest, u16 wVal // Control transfers are nearly instant switch (bmRequestType) { - case 0x21: - switch (bRequest) - { - case 0x09: - // Do nothing here - not sure what it should do. - break; - default: - ghltar_log.error("Unhandled Query: buf_size=0x%02X, Type=0x%02X, bRequest=0x%02X, bmRequestType=0x%02X", buf_size, (buf_size > 0) ? buf[0] : -1, bRequest, bmRequestType); - break; - } + case 0x21: + switch (bRequest) + { + case 0x09: + // Do nothing here - not sure what it should do. break; default: - usb_device_emulated::control_transfer(bmRequestType, bRequest, wValue, wIndex, wLength, buf_size, buf, transfer); + ghltar_log.error("Unhandled Query: buf_size=0x%02X, Type=0x%02X, bRequest=0x%02X, bmRequestType=0x%02X", buf_size, (buf_size > 0) ? buf[0] : -1, bRequest, bmRequestType); break; + } + break; + default: + usb_device_emulated::control_transfer(bmRequestType, bRequest, wValue, wIndex, wLength, buf_size, buf, transfer); + break; } } @@ -93,8 +93,8 @@ void usb_device_ghltar::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endpoint { ensure(buf_size >= 27); - transfer->fake = true; - transfer->expected_count = buf_size; + transfer->fake = true; + transfer->expected_count = buf_size; transfer->expected_result = HC_CC_NOERR; // Interrupt transfers are slow(6ms, TODO accurate measurement) // But make the emulated guitar reply in 1ms for better input behavior @@ -132,11 +132,11 @@ void usb_device_ghltar::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endpoint buf[4] = 0x80; // Strummer - buf[5] = 0x80; // Hero Power (when buf[19] == 0x00 or 0xFF, set to that.) - buf[6] = 0x80; // Whammy + buf[5] = 0x80; // Hero Power (when buf[19] == 0x00 or 0xFF, set to that.) + buf[6] = 0x80; // Whammy buf[19] = 0x80; // Accelerometer - buf[3] = 0x80; // Unknown, always 0x80 + buf[3] = 0x80; // Unknown, always 0x80 buf[22] = 0x01; // Unknown, always 0x01 buf[24] = 0x02; // Unknown, always 0x02 buf[26] = 0x02; // Unknown, always 0x02 @@ -150,7 +150,7 @@ void usb_device_ghltar::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endpoint std::lock_guard lock(pad::g_pad_mutex); const auto handler = pad::get_pad_thread(); - const auto& pad = ::at32(handler->GetPads(), m_controller_index); + const auto& pad = ::at32(handler->GetPads(), m_controller_index); if (!(pad->m_port_status & CELL_PAD_STATUS_CONNECTED)) { diff --git a/rpcs3/rpcs3/Emu/Io/GameTablet.cpp b/rpcs3/rpcs3/Emu/Io/GameTablet.cpp index 31ed81f3a..f17a0980e 100644 --- a/rpcs3/rpcs3/Emu/Io/GameTablet.cpp +++ b/rpcs3/rpcs3/Emu/Io/GameTablet.cpp @@ -20,7 +20,7 @@ struct GameTablet_data uint8_t btn_select : 1; uint8_t btn_start : 1; uint8_t : 2; - uint8_t btn_ps: 1; + uint8_t btn_ps : 1; uint8_t : 3; uint8_t dpad; @@ -63,59 +63,58 @@ enum }; usb_device_gametablet::usb_device_gametablet(u32 controller_index, const std::array& location) - : usb_device_emulated(location) - , m_controller_index(controller_index) + : usb_device_emulated(location), m_controller_index(controller_index) { device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, - UsbDeviceDescriptor { - .bcdUSB = 0x0200, - .bDeviceClass = 0x00, - .bDeviceSubClass = 0x00, - .bDeviceProtocol = 0x00, - .bMaxPacketSize0 = 0x08, - .idVendor = 0x20d6, - .idProduct = 0xcb17, - .bcdDevice = 0x0108, - .iManufacturer = 0x01, - .iProduct = 0x02, - .iSerialNumber = 0x00, + UsbDeviceDescriptor{ + .bcdUSB = 0x0200, + .bDeviceClass = 0x00, + .bDeviceSubClass = 0x00, + .bDeviceProtocol = 0x00, + .bMaxPacketSize0 = 0x08, + .idVendor = 0x20d6, + .idProduct = 0xcb17, + .bcdDevice = 0x0108, + .iManufacturer = 0x01, + .iProduct = 0x02, + .iSerialNumber = 0x00, .bNumConfigurations = 0x01}); auto& config0 = device.add_node(UsbDescriptorNode(USB_DESCRIPTOR_CONFIG, - UsbDeviceConfiguration { - .wTotalLength = 0x0029, - .bNumInterfaces = 0x01, + UsbDeviceConfiguration{ + .wTotalLength = 0x0029, + .bNumInterfaces = 0x01, .bConfigurationValue = 0x01, - .iConfiguration = 0x00, - .bmAttributes = 0x80, - .bMaxPower = 0x32})); + .iConfiguration = 0x00, + .bmAttributes = 0x80, + .bMaxPower = 0x32})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_INTERFACE, - UsbDeviceInterface { - .bInterfaceNumber = 0x00, - .bAlternateSetting = 0x00, - .bNumEndpoints = 0x02, - .bInterfaceClass = 0x03, + UsbDeviceInterface{ + .bInterfaceNumber = 0x00, + .bAlternateSetting = 0x00, + .bNumEndpoints = 0x02, + .bInterfaceClass = 0x03, .bInterfaceSubClass = 0x00, .bInterfaceProtocol = 0x00, - .iInterface = 0x00})); + .iInterface = 0x00})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_HID, - UsbDeviceHID { - .bcdHID = 0x0110, - .bCountryCode = 0x00, - .bNumDescriptors = 0x01, - .bDescriptorType = 0x22, + UsbDeviceHID{ + .bcdHID = 0x0110, + .bCountryCode = 0x00, + .bNumDescriptors = 0x01, + .bDescriptorType = 0x22, .wDescriptorLength = 0x0089})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_ENDPOINT, - UsbDeviceEndpoint { + UsbDeviceEndpoint{ .bEndpointAddress = 0x83, - .bmAttributes = 0x03, - .wMaxPacketSize = 0x0040, - .bInterval = 0x0A})); + .bmAttributes = 0x03, + .wMaxPacketSize = 0x0040, + .bInterval = 0x0A})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_ENDPOINT, - UsbDeviceEndpoint { + UsbDeviceEndpoint{ .bEndpointAddress = 0x04, - .bmAttributes = 0x03, - .wMaxPacketSize = 0x0040, - .bInterval = 0x0A})); + .bmAttributes = 0x03, + .wMaxPacketSize = 0x0040, + .bInterval = 0x0A})); add_string("THQ Inc"); add_string("THQ uDraw Game Tablet for PS3"); @@ -127,10 +126,10 @@ usb_device_gametablet::~usb_device_gametablet() void usb_device_gametablet::control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 wLength, u32 buf_size, u8* buf, UsbTransfer* transfer) { - transfer->fake = true; - transfer->expected_count = buf_size; + transfer->fake = true; + transfer->expected_count = buf_size; transfer->expected_result = HC_CC_NOERR; - transfer->expected_time = get_timestamp() + 100; + transfer->expected_time = get_timestamp() + 100; // Control transfers are nearly instant switch (bmRequestType) @@ -163,8 +162,8 @@ void usb_device_gametablet::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endp { ensure(buf_size >= sizeof(GameTablet_data)); - transfer->fake = true; - transfer->expected_count = sizeof(GameTablet_data); + transfer->fake = true; + transfer->expected_count = sizeof(GameTablet_data); transfer->expected_result = HC_CC_NOERR; // Interrupt transfers are slow (6ms, TODO accurate measurement) transfer->expected_time = get_timestamp() + 6000; diff --git a/rpcs3/rpcs3/Emu/Io/GunCon3.cpp b/rpcs3/rpcs3/Emu/Io/GunCon3.cpp index d22969390..5153f6f51 100644 --- a/rpcs3/rpcs3/Emu/Io/GunCon3.cpp +++ b/rpcs3/rpcs3/Emu/Io/GunCon3.cpp @@ -13,27 +13,27 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](guncon3_btn value) - { - switch (value) { - case guncon3_btn::trigger: return "Trigger"; - case guncon3_btn::a1: return "A1"; - case guncon3_btn::a2: return "A2"; - case guncon3_btn::a3: return "A3"; - case guncon3_btn::b1: return "B1"; - case guncon3_btn::b2: return "B2"; - case guncon3_btn::b3: return "B3"; - case guncon3_btn::c1: return "C1"; - case guncon3_btn::c2: return "C2"; - case guncon3_btn::as_x: return "A-stick X-Axis"; - case guncon3_btn::as_y: return "A-stick Y-Axis"; - case guncon3_btn::bs_x: return "B-stick X-Axis"; - case guncon3_btn::bs_y: return "B-stick Y-Axis"; - case guncon3_btn::count: return "Count"; - } + switch (value) + { + case guncon3_btn::trigger: return "Trigger"; + case guncon3_btn::a1: return "A1"; + case guncon3_btn::a2: return "A2"; + case guncon3_btn::a3: return "A3"; + case guncon3_btn::b1: return "B1"; + case guncon3_btn::b2: return "B2"; + case guncon3_btn::b3: return "B3"; + case guncon3_btn::c1: return "C1"; + case guncon3_btn::c2: return "C2"; + case guncon3_btn::as_x: return "A-stick X-Axis"; + case guncon3_btn::as_y: return "A-stick Y-Axis"; + case guncon3_btn::bs_x: return "B-stick X-Axis"; + case guncon3_btn::bs_y: return "B-stick Y-Axis"; + case guncon3_btn::count: return "Count"; + } - return unknown; - }); + return unknown; + }); } static const u8 KEY_TABLE[] = { @@ -52,8 +52,7 @@ static const u8 KEY_TABLE[] = { 0x75, 0xC3, 0x10, 0x31, 0xB5, 0xD3, 0x69, 0x84, 0x89, 0xBA, 0xD6, 0x89, 0xBD, 0x70, 0x19, 0x8E, 0x58, 0xA8, 0x3D, 0x9B, 0x5D, 0xF0, 0x49, 0xE8, 0xAD, 0x9D, 0x7A, 0x0D, 0x7E, 0x24, 0xDA, 0xFC, 0x0D, 0x14, 0xC5, 0x23, 0x91, 0x11, 0xF5, 0xC0, 0x4B, 0xCD, 0x44, 0x1C, 0xC5, 0x21, 0xDF, 0x61, - 0x54, 0xED, 0xA2, 0x81, 0xB7, 0xE5, 0x74, 0x94, 0xB0, 0x47, 0xEE, 0xF1, 0xA5, 0xBB, 0x21, 0xC8 -}; + 0x54, 0xED, 0xA2, 0x81, 0xB7, 0xE5, 0x74, 0x94, 0xB0, 0x47, 0xEE, 0xF1, 0xA5, 0xBB, 0x21, 0xC8}; #pragma pack(push, 1) struct GunCon3_data @@ -118,58 +117,55 @@ static void guncon3_encode(const GunCon3_data* gc, u8* data, const u8* key) data[i] = byte; } - data[13] = ((((((key[7] + data[0] - data[1] - data[2]) ^ data[3]) - + data[4] + data[5]) ^ data[6]) ^ data[7]) - + data[8] + data[9] - data[10] - data[11]) ^ data[12]; + data[13] = ((((((key[7] + data[0] - data[1] - data[2]) ^ data[3]) + data[4] + data[5]) ^ data[6]) ^ data[7]) + data[8] + data[9] - data[10] - data[11]) ^ data[12]; } usb_device_guncon3::usb_device_guncon3(u32 controller_index, const std::array& location) - : usb_device_emulated(location) - , m_controller_index(controller_index) + : usb_device_emulated(location), m_controller_index(controller_index) { device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, - UsbDeviceDescriptor { - .bcdUSB = 0x0110, - .bDeviceClass = 0x00, - .bDeviceSubClass = 0x00, - .bDeviceProtocol = 0x00, - .bMaxPacketSize0 = 0x08, - .idVendor = 0x0b9a, - .idProduct = 0x0800, - .bcdDevice = 0x8000, - .iManufacturer = 0x00, - .iProduct = 0x00, - .iSerialNumber = 0x00, + UsbDeviceDescriptor{ + .bcdUSB = 0x0110, + .bDeviceClass = 0x00, + .bDeviceSubClass = 0x00, + .bDeviceProtocol = 0x00, + .bMaxPacketSize0 = 0x08, + .idVendor = 0x0b9a, + .idProduct = 0x0800, + .bcdDevice = 0x8000, + .iManufacturer = 0x00, + .iProduct = 0x00, + .iSerialNumber = 0x00, .bNumConfigurations = 0x01}); auto& config0 = device.add_node(UsbDescriptorNode(USB_DESCRIPTOR_CONFIG, - UsbDeviceConfiguration { - .wTotalLength = 0x0020, - .bNumInterfaces = 0x01, + UsbDeviceConfiguration{ + .wTotalLength = 0x0020, + .bNumInterfaces = 0x01, .bConfigurationValue = 0x01, - .iConfiguration = 0x00, - .bmAttributes = 0x00, - .bMaxPower = 0x32})); + .iConfiguration = 0x00, + .bmAttributes = 0x00, + .bMaxPower = 0x32})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_INTERFACE, - UsbDeviceInterface { - .bInterfaceNumber = 0x00, - .bAlternateSetting = 0x00, - .bNumEndpoints = 0x02, - .bInterfaceClass = 0xff, + UsbDeviceInterface{ + .bInterfaceNumber = 0x00, + .bAlternateSetting = 0x00, + .bNumEndpoints = 0x02, + .bInterfaceClass = 0xff, .bInterfaceSubClass = 0x00, .bInterfaceProtocol = 0x00, - .iInterface = 0x00})); + .iInterface = 0x00})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_ENDPOINT, - UsbDeviceEndpoint { + UsbDeviceEndpoint{ .bEndpointAddress = 0x02, - .bmAttributes = 0x03, - .wMaxPacketSize = 0x0008, - .bInterval = 0x10})); + .bmAttributes = 0x03, + .wMaxPacketSize = 0x0008, + .bInterval = 0x10})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_ENDPOINT, - UsbDeviceEndpoint { + UsbDeviceEndpoint{ .bEndpointAddress = 0x82, - .bmAttributes = 0x03, - .wMaxPacketSize = 0x000f, - .bInterval = 0x04})); + .bmAttributes = 0x03, + .wMaxPacketSize = 0x000f, + .bInterval = 0x04})); } usb_device_guncon3::~usb_device_guncon3() @@ -178,10 +174,10 @@ usb_device_guncon3::~usb_device_guncon3() void usb_device_guncon3::control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 wLength, u32 buf_size, u8* buf, UsbTransfer* transfer) { - transfer->fake = true; - transfer->expected_count = buf_size; + transfer->fake = true; + transfer->expected_count = buf_size; transfer->expected_result = HC_CC_NOERR; - transfer->expected_time = get_timestamp() + 100; + transfer->expected_time = get_timestamp() + 100; usb_device_emulated::control_transfer(bmRequestType, bRequest, wValue, wIndex, wLength, buf_size, buf, transfer); } diff --git a/rpcs3/rpcs3/Emu/Io/Keyboard.h b/rpcs3/rpcs3/Emu/Io/Keyboard.h index e53595d16..df0215fab 100644 --- a/rpcs3/rpcs3/Emu/Io/Keyboard.h +++ b/rpcs3/rpcs3/Emu/Io/Keyboard.h @@ -9,202 +9,202 @@ enum enum { - CELL_KB_MAX_KEYCODES = 62, + CELL_KB_MAX_KEYCODES = 62, CELL_KB_MAX_KEYBOARDS = 127, }; enum KbPortStatus { CELL_KB_STATUS_DISCONNECTED = 0x00000000, - CELL_KB_STATUS_CONNECTED = 0x00000001, + CELL_KB_STATUS_CONNECTED = 0x00000001, }; enum CellKbReadMode { CELL_KB_RMODE_INPUTCHAR = 0, - CELL_KB_RMODE_PACKET = 1, + CELL_KB_RMODE_PACKET = 1, }; enum CellKbCodeType { - CELL_KB_CODETYPE_RAW = 0, - CELL_KB_CODETYPE_ASCII = 1, + CELL_KB_CODETYPE_RAW = 0, + CELL_KB_CODETYPE_ASCII = 1, }; enum KbLedCodes { - CELL_KB_LED_NUM_LOCK = 0x00000001, - CELL_KB_LED_CAPS_LOCK = 0x00000002, + CELL_KB_LED_NUM_LOCK = 0x00000001, + CELL_KB_LED_CAPS_LOCK = 0x00000002, CELL_KB_LED_SCROLL_LOCK = 0x00000004, - CELL_KB_LED_COMPOSE = 0x00000008, - CELL_KB_LED_KANA = 0x00000016, + CELL_KB_LED_COMPOSE = 0x00000008, + CELL_KB_LED_KANA = 0x00000016, }; enum KbMetaKeys { - CELL_KB_MKEY_L_CTRL = 0x00000001, + CELL_KB_MKEY_L_CTRL = 0x00000001, CELL_KB_MKEY_L_SHIFT = 0x00000002, - CELL_KB_MKEY_L_ALT = 0x00000004, - CELL_KB_MKEY_L_WIN = 0x00000008, - CELL_KB_MKEY_R_CTRL = 0x00000010, + CELL_KB_MKEY_L_ALT = 0x00000004, + CELL_KB_MKEY_L_WIN = 0x00000008, + CELL_KB_MKEY_R_CTRL = 0x00000010, CELL_KB_MKEY_R_SHIFT = 0x00000020, - CELL_KB_MKEY_R_ALT = 0x00000040, - CELL_KB_MKEY_R_WIN = 0x00000080, + CELL_KB_MKEY_R_ALT = 0x00000040, + CELL_KB_MKEY_R_WIN = 0x00000080, }; enum Keys { // Non-ASCII Raw data - CELL_KEYC_NO_EVENT = 0x00, - CELL_KEYC_E_ROLLOVER = 0x01, - CELL_KEYC_E_POSTFAIL = 0x02, - CELL_KEYC_E_UNDEF = 0x03, - CELL_KEYC_ESCAPE = 0x29, - CELL_KEYC_106_KANJI = 0x35, - CELL_KEYC_CAPS_LOCK = 0x39, - CELL_KEYC_F1 = 0x3a, - CELL_KEYC_F2 = 0x3b, - CELL_KEYC_F3 = 0x3c, - CELL_KEYC_F4 = 0x3d, - CELL_KEYC_F5 = 0x3e, - CELL_KEYC_F6 = 0x3f, - CELL_KEYC_F7 = 0x40, - CELL_KEYC_F8 = 0x41, - CELL_KEYC_F9 = 0x42, - CELL_KEYC_F10 = 0x43, - CELL_KEYC_F11 = 0x44, - CELL_KEYC_F12 = 0x45, + CELL_KEYC_NO_EVENT = 0x00, + CELL_KEYC_E_ROLLOVER = 0x01, + CELL_KEYC_E_POSTFAIL = 0x02, + CELL_KEYC_E_UNDEF = 0x03, + CELL_KEYC_ESCAPE = 0x29, + CELL_KEYC_106_KANJI = 0x35, + CELL_KEYC_CAPS_LOCK = 0x39, + CELL_KEYC_F1 = 0x3a, + CELL_KEYC_F2 = 0x3b, + CELL_KEYC_F3 = 0x3c, + CELL_KEYC_F4 = 0x3d, + CELL_KEYC_F5 = 0x3e, + CELL_KEYC_F6 = 0x3f, + CELL_KEYC_F7 = 0x40, + CELL_KEYC_F8 = 0x41, + CELL_KEYC_F9 = 0x42, + CELL_KEYC_F10 = 0x43, + CELL_KEYC_F11 = 0x44, + CELL_KEYC_F12 = 0x45, CELL_KEYC_PRINTSCREEN = 0x46, CELL_KEYC_SCROLL_LOCK = 0x47, - CELL_KEYC_PAUSE = 0x48, - CELL_KEYC_INSERT = 0x49, - CELL_KEYC_HOME = 0x4a, - CELL_KEYC_PAGE_UP = 0x4b, - CELL_KEYC_DELETE = 0x4c, - CELL_KEYC_END = 0x4d, - CELL_KEYC_PAGE_DOWN = 0x4e, + CELL_KEYC_PAUSE = 0x48, + CELL_KEYC_INSERT = 0x49, + CELL_KEYC_HOME = 0x4a, + CELL_KEYC_PAGE_UP = 0x4b, + CELL_KEYC_DELETE = 0x4c, + CELL_KEYC_END = 0x4d, + CELL_KEYC_PAGE_DOWN = 0x4e, CELL_KEYC_RIGHT_ARROW = 0x4f, - CELL_KEYC_LEFT_ARROW = 0x50, - CELL_KEYC_DOWN_ARROW = 0x51, - CELL_KEYC_UP_ARROW = 0x52, - CELL_KEYC_NUM_LOCK = 0x53, + CELL_KEYC_LEFT_ARROW = 0x50, + CELL_KEYC_DOWN_ARROW = 0x51, + CELL_KEYC_UP_ARROW = 0x52, + CELL_KEYC_NUM_LOCK = 0x53, CELL_KEYC_APPLICATION = 0x65, - CELL_KEYC_KANA = 0x88, - CELL_KEYC_HENKAN = 0x8a, - CELL_KEYC_MUHENKAN = 0x8b, + CELL_KEYC_KANA = 0x88, + CELL_KEYC_HENKAN = 0x8a, + CELL_KEYC_MUHENKAN = 0x8b, // Raw keycodes for ASCII keys - CELL_KEYC_A = 0x04, - CELL_KEYC_B = 0x05, - CELL_KEYC_C = 0x06, - CELL_KEYC_D = 0x07, - CELL_KEYC_E = 0x08, - CELL_KEYC_F = 0x09, - CELL_KEYC_G = 0x0A, - CELL_KEYC_H = 0x0B, - CELL_KEYC_I = 0x0C, - CELL_KEYC_J = 0x0D, - CELL_KEYC_K = 0x0E, - CELL_KEYC_L = 0x0F, - CELL_KEYC_M = 0x10, - CELL_KEYC_N = 0x11, - CELL_KEYC_O = 0x12, - CELL_KEYC_P = 0x13, - CELL_KEYC_Q = 0x14, - CELL_KEYC_R = 0x15, - CELL_KEYC_S = 0x16, - CELL_KEYC_T = 0x17, - CELL_KEYC_U = 0x18, - CELL_KEYC_V = 0x19, - CELL_KEYC_W = 0x1A, - CELL_KEYC_X = 0x1B, - CELL_KEYC_Y = 0x1C, - CELL_KEYC_Z = 0x1D, - CELL_KEYC_1 = 0x1E, - CELL_KEYC_2 = 0x1F, - CELL_KEYC_3 = 0x20, - CELL_KEYC_4 = 0x21, - CELL_KEYC_5 = 0x22, - CELL_KEYC_6 = 0x23, - CELL_KEYC_7 = 0x24, - CELL_KEYC_8 = 0x25, - CELL_KEYC_9 = 0x26, - CELL_KEYC_0 = 0x27, - CELL_KEYC_ENTER = 0x28, - CELL_KEYC_ESC = 0x29, - CELL_KEYC_BS = 0x2A, - CELL_KEYC_TAB = 0x2B, - CELL_KEYC_SPACE = 0x2C, - CELL_KEYC_MINUS = 0x2D, - CELL_KEYC_EQUAL_101 = 0x2E, + CELL_KEYC_A = 0x04, + CELL_KEYC_B = 0x05, + CELL_KEYC_C = 0x06, + CELL_KEYC_D = 0x07, + CELL_KEYC_E = 0x08, + CELL_KEYC_F = 0x09, + CELL_KEYC_G = 0x0A, + CELL_KEYC_H = 0x0B, + CELL_KEYC_I = 0x0C, + CELL_KEYC_J = 0x0D, + CELL_KEYC_K = 0x0E, + CELL_KEYC_L = 0x0F, + CELL_KEYC_M = 0x10, + CELL_KEYC_N = 0x11, + CELL_KEYC_O = 0x12, + CELL_KEYC_P = 0x13, + CELL_KEYC_Q = 0x14, + CELL_KEYC_R = 0x15, + CELL_KEYC_S = 0x16, + CELL_KEYC_T = 0x17, + CELL_KEYC_U = 0x18, + CELL_KEYC_V = 0x19, + CELL_KEYC_W = 0x1A, + CELL_KEYC_X = 0x1B, + CELL_KEYC_Y = 0x1C, + CELL_KEYC_Z = 0x1D, + CELL_KEYC_1 = 0x1E, + CELL_KEYC_2 = 0x1F, + CELL_KEYC_3 = 0x20, + CELL_KEYC_4 = 0x21, + CELL_KEYC_5 = 0x22, + CELL_KEYC_6 = 0x23, + CELL_KEYC_7 = 0x24, + CELL_KEYC_8 = 0x25, + CELL_KEYC_9 = 0x26, + CELL_KEYC_0 = 0x27, + CELL_KEYC_ENTER = 0x28, + CELL_KEYC_ESC = 0x29, + CELL_KEYC_BS = 0x2A, + CELL_KEYC_TAB = 0x2B, + CELL_KEYC_SPACE = 0x2C, + CELL_KEYC_MINUS = 0x2D, + CELL_KEYC_EQUAL_101 = 0x2E, CELL_KEYC_ACCENT_CIRCONFLEX_106 = 0x2E, - CELL_KEYC_LEFT_BRACKET_101 = 0x2F, - CELL_KEYC_ATMARK_106 = 0x2F, - CELL_KEYC_RIGHT_BRACKET_101 = 0x30, - CELL_KEYC_LEFT_BRACKET_106 = 0x30, - CELL_KEYC_BACKSLASH_101 = 0x31, - CELL_KEYC_RIGHT_BRACKET_106 = 0x32, - CELL_KEYC_SEMICOLON = 0x33, - CELL_KEYC_QUOTATION_101 = 0x34, - CELL_KEYC_COLON_106 = 0x34, - CELL_KEYC_COMMA = 0x36, - CELL_KEYC_PERIOD = 0x37, - CELL_KEYC_SLASH = 0x38, - //CELL_KEYC_CAPS_LOCK = 0x39, - CELL_KEYC_KPAD_NUMLOCK = 0x53, - CELL_KEYC_KPAD_SLASH = 0x54, - CELL_KEYC_KPAD_ASTERISK = 0x55, - CELL_KEYC_KPAD_MINUS = 0x56, - CELL_KEYC_KPAD_PLUS = 0x57, - CELL_KEYC_KPAD_ENTER = 0x58, - CELL_KEYC_KPAD_1 = 0x59, - CELL_KEYC_KPAD_2 = 0x5A, - CELL_KEYC_KPAD_3 = 0x5B, - CELL_KEYC_KPAD_4 = 0x5C, - CELL_KEYC_KPAD_5 = 0x5D, - CELL_KEYC_KPAD_6 = 0x5E, - CELL_KEYC_KPAD_7 = 0x5F, - CELL_KEYC_KPAD_8 = 0x60, - CELL_KEYC_KPAD_9 = 0x61, - CELL_KEYC_KPAD_0 = 0x62, - CELL_KEYC_KPAD_PERIOD = 0x63, - CELL_KEYC_BACKSLASH_106 = 0x87, - CELL_KEYC_YEN_106 = 0x89, + CELL_KEYC_LEFT_BRACKET_101 = 0x2F, + CELL_KEYC_ATMARK_106 = 0x2F, + CELL_KEYC_RIGHT_BRACKET_101 = 0x30, + CELL_KEYC_LEFT_BRACKET_106 = 0x30, + CELL_KEYC_BACKSLASH_101 = 0x31, + CELL_KEYC_RIGHT_BRACKET_106 = 0x32, + CELL_KEYC_SEMICOLON = 0x33, + CELL_KEYC_QUOTATION_101 = 0x34, + CELL_KEYC_COLON_106 = 0x34, + CELL_KEYC_COMMA = 0x36, + CELL_KEYC_PERIOD = 0x37, + CELL_KEYC_SLASH = 0x38, + // CELL_KEYC_CAPS_LOCK = 0x39, + CELL_KEYC_KPAD_NUMLOCK = 0x53, + CELL_KEYC_KPAD_SLASH = 0x54, + CELL_KEYC_KPAD_ASTERISK = 0x55, + CELL_KEYC_KPAD_MINUS = 0x56, + CELL_KEYC_KPAD_PLUS = 0x57, + CELL_KEYC_KPAD_ENTER = 0x58, + CELL_KEYC_KPAD_1 = 0x59, + CELL_KEYC_KPAD_2 = 0x5A, + CELL_KEYC_KPAD_3 = 0x5B, + CELL_KEYC_KPAD_4 = 0x5C, + CELL_KEYC_KPAD_5 = 0x5D, + CELL_KEYC_KPAD_6 = 0x5E, + CELL_KEYC_KPAD_7 = 0x5F, + CELL_KEYC_KPAD_8 = 0x60, + CELL_KEYC_KPAD_9 = 0x61, + CELL_KEYC_KPAD_0 = 0x62, + CELL_KEYC_KPAD_PERIOD = 0x63, + CELL_KEYC_BACKSLASH_106 = 0x87, + CELL_KEYC_YEN_106 = 0x89, // Made up helper codes (Maybe there's a real code somewhere hidden in the SDK) - CELL_KEYC_LESS = 0x90, - CELL_KEYC_HASHTAG = 0x91, - CELL_KEYC_SSHARP = 0x92, - CELL_KEYC_BACK_QUOTE = 0x93 + CELL_KEYC_LESS = 0x90, + CELL_KEYC_HASHTAG = 0x91, + CELL_KEYC_SSHARP = 0x92, + CELL_KEYC_BACK_QUOTE = 0x93 }; enum CellKbMappingType : s32 { - CELL_KB_MAPPING_101 = 0, - CELL_KB_MAPPING_106 = 1, - CELL_KB_MAPPING_106_KANA = 2, - CELL_KB_MAPPING_GERMAN_GERMANY = 3, - CELL_KB_MAPPING_SPANISH_SPAIN = 4, - CELL_KB_MAPPING_FRENCH_FRANCE = 5, - CELL_KB_MAPPING_ITALIAN_ITALY = 6, - CELL_KB_MAPPING_DUTCH_NETHERLANDS = 7, - CELL_KB_MAPPING_PORTUGUESE_PORTUGAL = 8, - CELL_KB_MAPPING_RUSSIAN_RUSSIA = 9, - CELL_KB_MAPPING_ENGLISH_UK = 10, - CELL_KB_MAPPING_KOREAN_KOREA = 11, - CELL_KB_MAPPING_NORWEGIAN_NORWAY = 12, - CELL_KB_MAPPING_FINNISH_FINLAND = 13, - CELL_KB_MAPPING_DANISH_DENMARK = 14, - CELL_KB_MAPPING_SWEDISH_SWEDEN = 15, - CELL_KB_MAPPING_CHINESE_TRADITIONAL = 16, - CELL_KB_MAPPING_CHINESE_SIMPLIFIED = 17, + CELL_KB_MAPPING_101 = 0, + CELL_KB_MAPPING_106 = 1, + CELL_KB_MAPPING_106_KANA = 2, + CELL_KB_MAPPING_GERMAN_GERMANY = 3, + CELL_KB_MAPPING_SPANISH_SPAIN = 4, + CELL_KB_MAPPING_FRENCH_FRANCE = 5, + CELL_KB_MAPPING_ITALIAN_ITALY = 6, + CELL_KB_MAPPING_DUTCH_NETHERLANDS = 7, + CELL_KB_MAPPING_PORTUGUESE_PORTUGAL = 8, + CELL_KB_MAPPING_RUSSIAN_RUSSIA = 9, + CELL_KB_MAPPING_ENGLISH_UK = 10, + CELL_KB_MAPPING_KOREAN_KOREA = 11, + CELL_KB_MAPPING_NORWEGIAN_NORWAY = 12, + CELL_KB_MAPPING_FINNISH_FINLAND = 13, + CELL_KB_MAPPING_DANISH_DENMARK = 14, + CELL_KB_MAPPING_SWEDISH_SWEDEN = 15, + CELL_KB_MAPPING_CHINESE_TRADITIONAL = 16, + CELL_KB_MAPPING_CHINESE_SIMPLIFIED = 17, CELL_KB_MAPPING_SWISS_FRENCH_SWITZERLAND = 18, CELL_KB_MAPPING_SWISS_GERMAN_SWITZERLAND = 19, - CELL_KB_MAPPING_CANADIAN_FRENCH_CANADA = 20, - CELL_KB_MAPPING_BELGIAN_BELGIUM = 21, - CELL_KB_MAPPING_POLISH_POLAND = 22, - CELL_KB_MAPPING_PORTUGUESE_BRAZIL = 23, - CELL_KB_MAPPING_TURKISH_TURKEY = 24 + CELL_KB_MAPPING_CANADIAN_FRENCH_CANADA = 20, + CELL_KB_MAPPING_BELGIAN_BELGIUM = 21, + CELL_KB_MAPPING_POLISH_POLAND = 22, + CELL_KB_MAPPING_PORTUGUESE_BRAZIL = 23, + CELL_KB_MAPPING_TURKISH_TURKEY = 24 }; u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode); diff --git a/rpcs3/rpcs3/Emu/Io/KeyboardHandler.cpp b/rpcs3/rpcs3/Emu/Io/KeyboardHandler.cpp index 05ef6ef52..e32e797a4 100644 --- a/rpcs3/rpcs3/Emu/Io/KeyboardHandler.cpp +++ b/rpcs3/rpcs3/Emu/Io/KeyboardHandler.cpp @@ -7,54 +7,54 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](CellKbMappingType value) - { - switch (value) { - case CELL_KB_MAPPING_101: return "English keyboard (US standard)"; - case CELL_KB_MAPPING_106: return "Japanese keyboard"; - case CELL_KB_MAPPING_106_KANA: return "Japanese keyboard (Kana state)"; - case CELL_KB_MAPPING_GERMAN_GERMANY: return "German keyboard"; - case CELL_KB_MAPPING_SPANISH_SPAIN: return "Spanish keyboard"; - case CELL_KB_MAPPING_FRENCH_FRANCE: return "French keyboard"; - case CELL_KB_MAPPING_ITALIAN_ITALY: return "Italian keyboard"; - case CELL_KB_MAPPING_DUTCH_NETHERLANDS: return "Dutch keyboard"; - case CELL_KB_MAPPING_PORTUGUESE_PORTUGAL: return "Portuguese keyboard (Portugal)"; - case CELL_KB_MAPPING_RUSSIAN_RUSSIA: return "Russian keyboard"; - case CELL_KB_MAPPING_ENGLISH_UK: return "English keyboard (UK standard)"; - case CELL_KB_MAPPING_KOREAN_KOREA: return "Korean keyboard"; - case CELL_KB_MAPPING_NORWEGIAN_NORWAY: return "Norwegian keyboard"; - case CELL_KB_MAPPING_FINNISH_FINLAND: return "Finnish keyboard"; - case CELL_KB_MAPPING_DANISH_DENMARK: return "Danish keyboard"; - case CELL_KB_MAPPING_SWEDISH_SWEDEN: return "Swedish keyboard"; - case CELL_KB_MAPPING_CHINESE_TRADITIONAL: return "Chinese keyboard (Traditional)"; - case CELL_KB_MAPPING_CHINESE_SIMPLIFIED: return "Chinese keyboard (Simplified)"; - case CELL_KB_MAPPING_SWISS_FRENCH_SWITZERLAND: return "French keyboard (Switzerland)"; - case CELL_KB_MAPPING_SWISS_GERMAN_SWITZERLAND: return "German keyboard (Switzerland)"; - case CELL_KB_MAPPING_CANADIAN_FRENCH_CANADA: return "French keyboard (Canada)"; - case CELL_KB_MAPPING_BELGIAN_BELGIUM: return "French keyboard (Belgium)"; - case CELL_KB_MAPPING_POLISH_POLAND: return "Polish keyboard"; - case CELL_KB_MAPPING_PORTUGUESE_BRAZIL: return "Portuguese keyboard (Brazil)"; - case CELL_KB_MAPPING_TURKISH_TURKEY: return "Turkish keyboard"; - } + switch (value) + { + case CELL_KB_MAPPING_101: return "English keyboard (US standard)"; + case CELL_KB_MAPPING_106: return "Japanese keyboard"; + case CELL_KB_MAPPING_106_KANA: return "Japanese keyboard (Kana state)"; + case CELL_KB_MAPPING_GERMAN_GERMANY: return "German keyboard"; + case CELL_KB_MAPPING_SPANISH_SPAIN: return "Spanish keyboard"; + case CELL_KB_MAPPING_FRENCH_FRANCE: return "French keyboard"; + case CELL_KB_MAPPING_ITALIAN_ITALY: return "Italian keyboard"; + case CELL_KB_MAPPING_DUTCH_NETHERLANDS: return "Dutch keyboard"; + case CELL_KB_MAPPING_PORTUGUESE_PORTUGAL: return "Portuguese keyboard (Portugal)"; + case CELL_KB_MAPPING_RUSSIAN_RUSSIA: return "Russian keyboard"; + case CELL_KB_MAPPING_ENGLISH_UK: return "English keyboard (UK standard)"; + case CELL_KB_MAPPING_KOREAN_KOREA: return "Korean keyboard"; + case CELL_KB_MAPPING_NORWEGIAN_NORWAY: return "Norwegian keyboard"; + case CELL_KB_MAPPING_FINNISH_FINLAND: return "Finnish keyboard"; + case CELL_KB_MAPPING_DANISH_DENMARK: return "Danish keyboard"; + case CELL_KB_MAPPING_SWEDISH_SWEDEN: return "Swedish keyboard"; + case CELL_KB_MAPPING_CHINESE_TRADITIONAL: return "Chinese keyboard (Traditional)"; + case CELL_KB_MAPPING_CHINESE_SIMPLIFIED: return "Chinese keyboard (Simplified)"; + case CELL_KB_MAPPING_SWISS_FRENCH_SWITZERLAND: return "French keyboard (Switzerland)"; + case CELL_KB_MAPPING_SWISS_GERMAN_SWITZERLAND: return "German keyboard (Switzerland)"; + case CELL_KB_MAPPING_CANADIAN_FRENCH_CANADA: return "French keyboard (Canada)"; + case CELL_KB_MAPPING_BELGIAN_BELGIUM: return "French keyboard (Belgium)"; + case CELL_KB_MAPPING_POLISH_POLAND: return "Polish keyboard"; + case CELL_KB_MAPPING_PORTUGUESE_BRAZIL: return "Portuguese keyboard (Brazil)"; + case CELL_KB_MAPPING_TURKISH_TURKEY: return "Turkish keyboard"; + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](keyboard_consumer::identifier value) - { - switch (value) { - STR_CASE(keyboard_consumer::identifier::unknown); - STR_CASE(keyboard_consumer::identifier::overlays); - STR_CASE(keyboard_consumer::identifier::cellKb); - } + switch (value) + { + STR_CASE(keyboard_consumer::identifier::unknown); + STR_CASE(keyboard_consumer::identifier::overlays); + STR_CASE(keyboard_consumer::identifier::cellKb); + } - return unknown; - }); + return unknown; + }); } keyboard_consumer& KeyboardHandlerBase::AddConsumer(keyboard_consumer::identifier id, u32 max_connect) @@ -168,9 +168,12 @@ bool keyboard_consumer::ConsumeKey(u32 qt_code, u32 native_code, bool pressed, b else { // Led Keys - if (qt_code == Key_CapsLock) data.led ^= CELL_KB_LED_CAPS_LOCK; - if (qt_code == Key_NumLock) data.led ^= CELL_KB_LED_NUM_LOCK; - if (qt_code == Key_ScrollLock) data.led ^= CELL_KB_LED_SCROLL_LOCK; + if (qt_code == Key_CapsLock) + data.led ^= CELL_KB_LED_CAPS_LOCK; + if (qt_code == Key_NumLock) + data.led ^= CELL_KB_LED_NUM_LOCK; + if (qt_code == Key_ScrollLock) + data.led ^= CELL_KB_LED_SCROLL_LOCK; // if (qt_code == Key_Kana_Lock) data.led ^= CELL_KB_LED_KANA; // if (qt_code == ???) data.led ^= CELL_KB_LED_COMPOSE; @@ -245,12 +248,7 @@ bool keyboard_consumer::ConsumeKey(u32 qt_code, u32 native_code, bool pressed, b bool keyboard_consumer::IsMetaKey(u32 code) { - return code == Key_Control - || code == Key_Shift - || code == Key_Alt - || code == Key_Meta - || code == Key_Super_L - || code == Key_Super_R; + return code == Key_Control || code == Key_Shift || code == Key_Alt || code == Key_Meta || code == Key_Super_L || code == Key_Super_R; } u32 keyboard_consumer::get_out_key_code(u32 qt_code, u32 native_code, u32 out_key_code) @@ -293,7 +291,7 @@ void keyboard_consumer::SetIntercepted(bool intercepted) for (Keyboard& keyboard : m_keyboards) { keyboard.m_data.mkey = 0; - keyboard.m_data.len = 0; + keyboard.m_data.len = 0; for (auto& button : keyboard.m_data.buttons) { diff --git a/rpcs3/rpcs3/Emu/Io/KeyboardHandler.h b/rpcs3/rpcs3/Emu/Io/KeyboardHandler.h index 594f7be3f..c12d28cab 100644 --- a/rpcs3/rpcs3/Emu/Io/KeyboardHandler.h +++ b/rpcs3/rpcs3/Emu/Io/KeyboardHandler.h @@ -11,15 +11,15 @@ enum QtKeys { - Key_Shift = 0x01000020, - Key_Control = 0x01000021, - Key_Meta = 0x01000022, - Key_Alt = 0x01000023, - Key_CapsLock = 0x01000024, - Key_NumLock = 0x01000025, + Key_Shift = 0x01000020, + Key_Control = 0x01000021, + Key_Meta = 0x01000022, + Key_Alt = 0x01000023, + Key_CapsLock = 0x01000024, + Key_NumLock = 0x01000025, Key_ScrollLock = 0x01000026, - Key_Super_L = 0x01000053, - Key_Super_R = 0x01000054 + Key_Super_L = 0x01000053, + Key_Super_R = 0x01000054 }; // See https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values @@ -34,7 +34,7 @@ enum native_key : u32 alt_r = 0xE038, meta_l = 0xE05B, meta_r = 0xE05C, -#elif defined (__APPLE__) +#elif defined(__APPLE__) ctrl_l = 0x3B, // kVK_Control ctrl_r = 0x3E, // kVK_RightControl shift_l = 0x38, // kVK_Shift @@ -72,9 +72,7 @@ struct KbButton KbButton() = default; KbButton(u32 keyCode, u32 outKeyCode, bool pressed = false) - : m_keyCode(keyCode) - , m_outKeyCode(outKeyCode) - , m_pressed(pressed) + : m_keyCode(keyCode), m_outKeyCode(outKeyCode), m_pressed(pressed) { } }; @@ -126,12 +124,30 @@ public: static bool IsMetaKey(u32 code); - KbInfo& GetInfo() { return m_info; } - std::vector& GetKeyboards() { return m_keyboards; } - KbData& GetData(const u32 keyboard) { return m_keyboards[keyboard].m_data; } - KbExtraData& GetExtraData(const u32 keyboard) { return m_keyboards[keyboard].m_extra_data; } - KbConfig& GetConfig(const u32 keyboard) { return m_keyboards[keyboard].m_config; } - identifier id() const { return m_id; } + KbInfo& GetInfo() + { + return m_info; + } + std::vector& GetKeyboards() + { + return m_keyboards; + } + KbData& GetData(const u32 keyboard) + { + return m_keyboards[keyboard].m_data; + } + KbExtraData& GetExtraData(const u32 keyboard) + { + return m_keyboards[keyboard].m_extra_data; + } + KbConfig& GetConfig(const u32 keyboard) + { + return m_keyboards[keyboard].m_config; + } + identifier id() const + { + return m_id; + } void ReleaseAllKeys(); diff --git a/rpcs3/rpcs3/Emu/Io/MouseHandler.cpp b/rpcs3/rpcs3/Emu/Io/MouseHandler.cpp index c80d7556d..ae7cd5323 100644 --- a/rpcs3/rpcs3/Emu/Io/MouseHandler.cpp +++ b/rpcs3/rpcs3/Emu/Io/MouseHandler.cpp @@ -17,10 +17,10 @@ MouseHandlerBase::MouseHandlerBase(utils::serial* ar) if (m_info.max_connect) { Emu.PostponeInitCode([this]() - { - Init(m_info.max_connect); - auto lk = init.init(); - }); + { + Init(m_info.max_connect); + auto lk = init.init(); + }); } } @@ -143,9 +143,9 @@ void MouseHandlerBase::Move(u32 index, s32 x_pos_new, s32 y_pos_new, s32 x_max, mouse.x_pos = x_pos_new; mouse.y_pos = y_pos_new; - //CellMouseRawData& rawdata = GetRawData(p); - //rawdata.data[rawdata.len % CELL_MOUSE_MAX_CODES] = 0; // (TODO) - //rawdata.len++; + // CellMouseRawData& rawdata = GetRawData(p); + // rawdata.data[rawdata.len % CELL_MOUSE_MAX_CODES] = 0; // (TODO) + // rawdata.len++; datalist.push_back(std::move(new_data)); } diff --git a/rpcs3/rpcs3/Emu/Io/MouseHandler.h b/rpcs3/rpcs3/Emu/Io/MouseHandler.h index 8a8824152..20ccb6429 100644 --- a/rpcs3/rpcs3/Emu/Io/MouseHandler.h +++ b/rpcs3/rpcs3/Emu/Io/MouseHandler.h @@ -13,23 +13,23 @@ enum { // is_supported CELL_MOUSE_INFO_TABLET_NOT_SUPPORTED = 0, - CELL_MOUSE_INFO_TABLET_SUPPORTED = 1, + CELL_MOUSE_INFO_TABLET_SUPPORTED = 1, // mode - CELL_MOUSE_INFO_TABLET_MOUSE_MODE = 1, - CELL_MOUSE_INFO_TABLET_TABLET_MODE = 2, + CELL_MOUSE_INFO_TABLET_MOUSE_MODE = 1, + CELL_MOUSE_INFO_TABLET_TABLET_MODE = 2, }; enum MousePortStatus { CELL_MOUSE_STATUS_DISCONNECTED = 0x00000000, - CELL_MOUSE_STATUS_CONNECTED = 0x00000001, + CELL_MOUSE_STATUS_CONNECTED = 0x00000001, }; enum MouseDataUpdate { CELL_MOUSE_DATA_UPDATE = 1, - CELL_MOUSE_DATA_NON = 0, + CELL_MOUSE_DATA_NON = 0, }; enum MouseButtonCodes @@ -53,14 +53,14 @@ static inline MouseButtonCodes get_mouse_button_code(int i) { switch (i) { - case 0: return CELL_MOUSE_BUTTON_1; - case 1: return CELL_MOUSE_BUTTON_2; - case 2: return CELL_MOUSE_BUTTON_3; - case 3: return CELL_MOUSE_BUTTON_4; - case 4: return CELL_MOUSE_BUTTON_5; - case 5: return CELL_MOUSE_BUTTON_6; - case 6: return CELL_MOUSE_BUTTON_7; - case 7: return CELL_MOUSE_BUTTON_8; + case 0: return CELL_MOUSE_BUTTON_1; + case 1: return CELL_MOUSE_BUTTON_2; + case 2: return CELL_MOUSE_BUTTON_3; + case 3: return CELL_MOUSE_BUTTON_4; + case 4: return CELL_MOUSE_BUTTON_5; + case 5: return CELL_MOUSE_BUTTON_6; + case 6: return CELL_MOUSE_BUTTON_7; + case 7: return CELL_MOUSE_BUTTON_8; default: fmt::throw_exception("get_mouse_button_code: Invalid index %d", i); } } @@ -74,7 +74,7 @@ struct MouseInfo u32 max_connect = 0; u32 now_connect = 0; u32 info = 0; - u32 mode[MAX_MICE]{}; // TODO: tablet support + u32 mode[MAX_MICE]{}; // TODO: tablet support u32 tablet_is_supported[MAX_MICE]{}; // TODO: tablet support u16 vendor_id[MAX_MICE]{}; u16 product_id[MAX_MICE]{}; @@ -137,7 +137,7 @@ public: SAVESTATE_INIT_POS(18); - MouseHandlerBase(){}; + MouseHandlerBase() {}; MouseHandlerBase(const MouseHandlerBase&) = delete; MouseHandlerBase(utils::serial* ar); MouseHandlerBase(utils::serial& ar) : MouseHandlerBase(&ar) {} @@ -149,11 +149,26 @@ public: void SetIntercepted(bool intercepted); - MouseInfo& GetInfo() { return m_info; } - std::vector& GetMice() { return m_mice; } - MouseDataList& GetDataList(const u32 mouse) { return m_mice[mouse].m_datalist; } - MouseTabletDataList& GetTabletDataList(const u32 mouse) { return m_mice[mouse].m_tablet_datalist; } - MouseRawData& GetRawData(const u32 mouse) { return m_mice[mouse].m_rawdata; } + MouseInfo& GetInfo() + { + return m_info; + } + std::vector& GetMice() + { + return m_mice; + } + MouseDataList& GetDataList(const u32 mouse) + { + return m_mice[mouse].m_datalist; + } + MouseTabletDataList& GetTabletDataList(const u32 mouse) + { + return m_mice[mouse].m_tablet_datalist; + } + MouseRawData& GetRawData(const u32 mouse) + { + return m_mice[mouse].m_rawdata; + } stx::init_mutex init; diff --git a/rpcs3/rpcs3/Emu/Io/Null/NullPadHandler.h b/rpcs3/rpcs3/Emu/Io/Null/NullPadHandler.h index afb59ea70..e7d9041c9 100644 --- a/rpcs3/rpcs3/Emu/Io/Null/NullPadHandler.h +++ b/rpcs3/rpcs3/Emu/Io/Null/NullPadHandler.h @@ -12,34 +12,35 @@ public: void init_config(cfg_pad* cfg) override { - if (!cfg) return; + if (!cfg) + return; // Reset default button mapping - cfg->ls_left.def = ""; - cfg->ls_down.def = ""; + cfg->ls_left.def = ""; + cfg->ls_down.def = ""; cfg->ls_right.def = ""; - cfg->ls_up.def = ""; - cfg->rs_left.def = ""; - cfg->rs_down.def = ""; + cfg->ls_up.def = ""; + cfg->rs_left.def = ""; + cfg->rs_down.def = ""; cfg->rs_right.def = ""; - cfg->rs_up.def = ""; - cfg->start.def = ""; - cfg->select.def = ""; - cfg->ps.def = ""; - cfg->square.def = ""; - cfg->cross.def = ""; - cfg->circle.def = ""; + cfg->rs_up.def = ""; + cfg->start.def = ""; + cfg->select.def = ""; + cfg->ps.def = ""; + cfg->square.def = ""; + cfg->cross.def = ""; + cfg->circle.def = ""; cfg->triangle.def = ""; - cfg->left.def = ""; - cfg->down.def = ""; - cfg->right.def = ""; - cfg->up.def = ""; - cfg->r1.def = ""; - cfg->r2.def = ""; - cfg->r3.def = ""; - cfg->l1.def = ""; - cfg->l2.def = ""; - cfg->l3.def = ""; + cfg->left.def = ""; + cfg->down.def = ""; + cfg->right.def = ""; + cfg->up.def = ""; + cfg->r1.def = ""; + cfg->r2.def = ""; + cfg->r3.def = ""; + cfg->l1.def = ""; + cfg->l2.def = ""; + cfg->l3.def = ""; cfg->pressure_intensity_button.def = ""; cfg->analog_limiter_button.def = ""; diff --git a/rpcs3/rpcs3/Emu/Io/Null/null_camera_handler.h b/rpcs3/rpcs3/Emu/Io/Null/null_camera_handler.h index a250facd7..a2f404e70 100644 --- a/rpcs3/rpcs3/Emu/Io/Null/null_camera_handler.h +++ b/rpcs3/rpcs3/Emu/Io/Null/null_camera_handler.h @@ -7,10 +7,22 @@ class null_camera_handler final : public camera_handler_base public: null_camera_handler() : camera_handler_base() {} - void open_camera() override { set_state(camera_handler_state::open); } - void close_camera() override { set_state(camera_handler_state::closed); } - void start_camera() override { set_state(camera_handler_state::running); } - void stop_camera() override { set_state(camera_handler_state::open); } + void open_camera() override + { + set_state(camera_handler_state::open); + } + void close_camera() override + { + set_state(camera_handler_state::closed); + } + void start_camera() override + { + set_state(camera_handler_state::running); + } + void stop_camera() override + { + set_state(camera_handler_state::open); + } void set_format(s32 format, u32 bytesize) override { diff --git a/rpcs3/rpcs3/Emu/Io/Null/null_music_handler.h b/rpcs3/rpcs3/Emu/Io/Null/null_music_handler.h index fe022dc79..ea0b1d4fd 100644 --- a/rpcs3/rpcs3/Emu/Io/Null/null_music_handler.h +++ b/rpcs3/rpcs3/Emu/Io/Null/null_music_handler.h @@ -7,13 +7,34 @@ class null_music_handler final : public music_handler_base public: null_music_handler() : music_handler_base() {} - void stop() override { m_state = 0; } // CELL_MUSIC_PB_STATUS_STOP - void pause() override { m_state = 2; } // CELL_MUSIC_PB_STATUS_PAUSE - void play(const std::string& /*path*/) override { m_state = 1; } // CELL_MUSIC_PB_STATUS_PLAY - void fast_forward(const std::string& /*path*/) override { m_state = 3; } // CELL_MUSIC_PB_STATUS_FASTFORWARD - void fast_reverse(const std::string& /*path*/) override { m_state = 4; } // CELL_MUSIC_PB_STATUS_FASTREVERSE - void set_volume(f32 volume) override { m_volume = volume; } - f32 get_volume() const override { return m_volume; } + void stop() override + { + m_state = 0; + } // CELL_MUSIC_PB_STATUS_STOP + void pause() override + { + m_state = 2; + } // CELL_MUSIC_PB_STATUS_PAUSE + void play(const std::string& /*path*/) override + { + m_state = 1; + } // CELL_MUSIC_PB_STATUS_PLAY + void fast_forward(const std::string& /*path*/) override + { + m_state = 3; + } // CELL_MUSIC_PB_STATUS_FASTFORWARD + void fast_reverse(const std::string& /*path*/) override + { + m_state = 4; + } // CELL_MUSIC_PB_STATUS_FASTREVERSE + void set_volume(f32 volume) override + { + m_volume = volume; + } + f32 get_volume() const override + { + return m_volume; + } private: atomic_t m_volume{0.0f}; diff --git a/rpcs3/rpcs3/Emu/Io/PadHandler.cpp b/rpcs3/rpcs3/Emu/Io/PadHandler.cpp index 19b9347da..cbae799d9 100644 --- a/rpcs3/rpcs3/Emu/Io/PadHandler.cpp +++ b/rpcs3/rpcs3/Emu/Io/PadHandler.cpp @@ -287,7 +287,7 @@ PadHandlerBase::connection PadHandlerBase::get_next_button_press(const std::stri } const bool is_trigger = get_is_left_trigger(device, keycode) || get_is_right_trigger(device, keycode); - const bool is_stick = !is_trigger && (get_is_left_stick(device, keycode) || get_is_right_stick(device, keycode)); + const bool is_stick = !is_trigger && (get_is_left_stick(device, keycode) || get_is_right_stick(device, keycode)); const bool is_touch_motion = !is_trigger && !is_stick && get_is_touch_pad_motion(device, keycode); const bool is_button = !is_trigger && !is_stick && !is_touch_motion; @@ -307,7 +307,7 @@ PadHandlerBase::connection PadHandlerBase::get_next_button_press(const std::stri if (diff > button_press_threshold && value > pressed_button.value) { - pressed_button = { .value = value, .name = name }; + pressed_button = {.value = value, .name = name}; } } } @@ -470,8 +470,7 @@ bool PadHandlerBase::bindPadToDevice(std::shared_ptr pad) } } - pad->Init - ( + pad->Init( CELL_PAD_STATUS_DISCONNECTED, capabilities, CELL_PAD_DEV_TYPE_STANDARD, @@ -479,8 +478,7 @@ bool PadHandlerBase::bindPadToDevice(std::shared_ptr pad) pclass_profile, config->vendor_id, config->product_id, - config->pressure_intensity - ); + config->pressure_intensity); if (b_has_pressure_intensity_button) { @@ -552,48 +550,48 @@ std::array, PadHandlerBase::button::button_count> PadHandlerBase:: if (!device || !cfg) return mapping; - device->trigger_code_left = FindKeyCodes(button_list, cfg->l2); + device->trigger_code_left = FindKeyCodes(button_list, cfg->l2); device->trigger_code_right = FindKeyCodes(button_list, cfg->r2); - device->axis_code_left[0] = FindKeyCodes(button_list, cfg->ls_left); - device->axis_code_left[1] = FindKeyCodes(button_list, cfg->ls_right); - device->axis_code_left[2] = FindKeyCodes(button_list, cfg->ls_down); - device->axis_code_left[3] = FindKeyCodes(button_list, cfg->ls_up); + device->axis_code_left[0] = FindKeyCodes(button_list, cfg->ls_left); + device->axis_code_left[1] = FindKeyCodes(button_list, cfg->ls_right); + device->axis_code_left[2] = FindKeyCodes(button_list, cfg->ls_down); + device->axis_code_left[3] = FindKeyCodes(button_list, cfg->ls_up); device->axis_code_right[0] = FindKeyCodes(button_list, cfg->rs_left); device->axis_code_right[1] = FindKeyCodes(button_list, cfg->rs_right); device->axis_code_right[2] = FindKeyCodes(button_list, cfg->rs_down); device->axis_code_right[3] = FindKeyCodes(button_list, cfg->rs_up); - mapping[button::up] = FindKeyCodes(button_list, cfg->up); - mapping[button::down] = FindKeyCodes(button_list, cfg->down); - mapping[button::left] = FindKeyCodes(button_list, cfg->left); - mapping[button::right] = FindKeyCodes(button_list, cfg->right); - mapping[button::cross] = FindKeyCodes(button_list, cfg->cross); - mapping[button::square] = FindKeyCodes(button_list, cfg->square); - mapping[button::circle] = FindKeyCodes(button_list, cfg->circle); + mapping[button::up] = FindKeyCodes(button_list, cfg->up); + mapping[button::down] = FindKeyCodes(button_list, cfg->down); + mapping[button::left] = FindKeyCodes(button_list, cfg->left); + mapping[button::right] = FindKeyCodes(button_list, cfg->right); + mapping[button::cross] = FindKeyCodes(button_list, cfg->cross); + mapping[button::square] = FindKeyCodes(button_list, cfg->square); + mapping[button::circle] = FindKeyCodes(button_list, cfg->circle); mapping[button::triangle] = FindKeyCodes(button_list, cfg->triangle); - mapping[button::start] = FindKeyCodes(button_list, cfg->start); - mapping[button::select] = FindKeyCodes(button_list, cfg->select); - mapping[button::l1] = FindKeyCodes(button_list, cfg->l1); - mapping[button::l2] = narrow_set(device->trigger_code_left); - mapping[button::l3] = FindKeyCodes(button_list, cfg->l3); - mapping[button::r1] = FindKeyCodes(button_list, cfg->r1); - mapping[button::r2] = narrow_set(device->trigger_code_right); - mapping[button::r3] = FindKeyCodes(button_list, cfg->r3); - mapping[button::ls_left] = narrow_set(device->axis_code_left[0]); + mapping[button::start] = FindKeyCodes(button_list, cfg->start); + mapping[button::select] = FindKeyCodes(button_list, cfg->select); + mapping[button::l1] = FindKeyCodes(button_list, cfg->l1); + mapping[button::l2] = narrow_set(device->trigger_code_left); + mapping[button::l3] = FindKeyCodes(button_list, cfg->l3); + mapping[button::r1] = FindKeyCodes(button_list, cfg->r1); + mapping[button::r2] = narrow_set(device->trigger_code_right); + mapping[button::r3] = FindKeyCodes(button_list, cfg->r3); + mapping[button::ls_left] = narrow_set(device->axis_code_left[0]); mapping[button::ls_right] = narrow_set(device->axis_code_left[1]); - mapping[button::ls_down] = narrow_set(device->axis_code_left[2]); - mapping[button::ls_up] = narrow_set(device->axis_code_left[3]); - mapping[button::rs_left] = narrow_set(device->axis_code_right[0]); + mapping[button::ls_down] = narrow_set(device->axis_code_left[2]); + mapping[button::ls_up] = narrow_set(device->axis_code_left[3]); + mapping[button::rs_left] = narrow_set(device->axis_code_right[0]); mapping[button::rs_right] = narrow_set(device->axis_code_right[1]); - mapping[button::rs_down] = narrow_set(device->axis_code_right[2]); - mapping[button::rs_up] = narrow_set(device->axis_code_right[3]); - mapping[button::ps] = FindKeyCodes(button_list, cfg->ps); + mapping[button::rs_down] = narrow_set(device->axis_code_right[2]); + mapping[button::rs_up] = narrow_set(device->axis_code_right[3]); + mapping[button::ps] = FindKeyCodes(button_list, cfg->ps); - mapping[button::skateboard_ir_nose] = FindKeyCodes(button_list, cfg->ir_nose); - mapping[button::skateboard_ir_tail] = FindKeyCodes(button_list, cfg->ir_tail); - mapping[button::skateboard_ir_left] = FindKeyCodes(button_list, cfg->ir_left); - mapping[button::skateboard_ir_right] = FindKeyCodes(button_list, cfg->ir_right); - mapping[button::skateboard_tilt_left] = FindKeyCodes(button_list, cfg->tilt_left); + mapping[button::skateboard_ir_nose] = FindKeyCodes(button_list, cfg->ir_nose); + mapping[button::skateboard_ir_tail] = FindKeyCodes(button_list, cfg->ir_tail); + mapping[button::skateboard_ir_left] = FindKeyCodes(button_list, cfg->ir_left); + mapping[button::skateboard_ir_right] = FindKeyCodes(button_list, cfg->ir_right); + mapping[button::skateboard_tilt_left] = FindKeyCodes(button_list, cfg->tilt_left); mapping[button::skateboard_tilt_right] = FindKeyCodes(button_list, cfg->tilt_right); if (b_has_pressure_intensity_button) @@ -745,7 +743,7 @@ void PadHandlerBase::process() for (usz i = 0; i < m_bindings.size(); ++i) { auto& device = m_bindings[i].device; - auto& pad = m_bindings[i].pad; + auto& pad = m_bindings[i].pad; if (!device || !pad) continue; @@ -884,11 +882,13 @@ void PadHandlerBase::set_raw_orientation(Pad& pad) void PadHandlerBase::get_orientation(const pad_ensemble& binding) const { - if (!b_has_orientation) return; + if (!b_has_orientation) + return; const auto& pad = binding.pad; const auto& device = binding.device; - if (!pad || !device) return; + if (!pad || !device) + return; if (pad->move_data.calibration_requested) { @@ -937,32 +937,26 @@ void PadDevice::update_orientation(ps_move_data& move_data) ensure(ahrs->settings.convention == FusionConvention::FusionConventionEnu); // East-North-Up const FusionVector accelerometer{ - .axis { + .axis{ .x = -move_data.accelerometer_x, .y = +move_data.accelerometer_y, - .z = +move_data.accelerometer_z - } - }; + .z = +move_data.accelerometer_z}}; const FusionVector gyroscope{ - .axis { + .axis{ .x = +PadHandlerBase::rad_to_degree(move_data.gyro_x), .y = +PadHandlerBase::rad_to_degree(move_data.gyro_z), - .z = -PadHandlerBase::rad_to_degree(move_data.gyro_y) - } - }; + .z = -PadHandlerBase::rad_to_degree(move_data.gyro_y)}}; - FusionVector magnetometer {}; + FusionVector magnetometer{}; if (move_data.magnetometer_enabled) { magnetometer = FusionVector{ - .axis { + .axis{ .x = move_data.magnetometer_x, .y = move_data.magnetometer_y, - .z = move_data.magnetometer_z - } - }; + .z = move_data.magnetometer_z}}; } // Update Fusion diff --git a/rpcs3/rpcs3/Emu/Io/PadHandler.h b/rpcs3/rpcs3/Emu/Io/PadHandler.h index 596ee7864..37264bc3d 100644 --- a/rpcs3/rpcs3/Emu/Io/PadHandler.h +++ b/rpcs3/rpcs3/Emu/Io/PadHandler.h @@ -9,7 +9,8 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wold-style-cast" #endif -extern "C" { +extern "C" +{ #include "3rdparty/fusion/fusion/Fusion/FusionAhrs.h" } #ifndef _MSC_VER @@ -30,7 +31,7 @@ class PadDevice { public: virtual ~PadDevice() = default; - cfg_pad* config{ nullptr }; + cfg_pad* config{nullptr}; u8 player_id{0}; u8 large_motor{0}; u8 small_motor{0}; @@ -68,7 +69,8 @@ struct pad_ensemble explicit pad_ensemble(std::shared_ptr _pad, std::shared_ptr _device, std::shared_ptr _buddy_device) : pad(std::move(_pad)), device(std::move(_device)), buddy_device(std::move(_buddy_device)) - {} + { + } }; struct pad_list_entry @@ -78,7 +80,8 @@ struct pad_list_entry explicit pad_list_entry(std::string _name, bool _is_buddy_only) : name(std::move(_name)), is_buddy_only(_is_buddy_only) - {} + { + } }; using pad_preview_values = std::array; @@ -126,7 +129,7 @@ protected: start, select, ps, - //reserved, + // reserved, ls_left, ls_right, ls_down, @@ -155,7 +158,7 @@ protected: static constexpr u16 touch_threshold = static_cast(255 * 0.9f); static constexpr auto min_output_interval = 300ms; - std::array last_connection_status{{ false, false, false, false, false, false, false }}; + std::array last_connection_status{{false, false, false, false, false, false, false}}; std::string m_name_string; usz m_max_devices = 0; @@ -222,7 +225,7 @@ protected: if (def_code != umax) { - return { def_code }; + return {def_code}; } } @@ -309,32 +312,86 @@ public: blacklist }; - std::vector& bindings() { return m_bindings; } - const std::string& name_string() const { return m_name_string; } - usz max_devices() const { return m_max_devices; } - bool has_config() const { return b_has_config; } - bool has_rumble() const { return b_has_rumble; } - bool has_motion() const { return b_has_motion; } - bool has_deadzones() const { return b_has_deadzones; } - bool has_led() const { return b_has_led; } - bool has_rgb() const { return b_has_rgb; } - bool has_player_led() const { return b_has_player_led; } - bool has_battery() const { return b_has_battery; } - bool has_battery_led() const { return b_has_battery_led; } - bool has_pressure_intensity_button() const { return b_has_pressure_intensity_button; } - bool has_analog_limiter_button() const { return b_has_analog_limiter_button; } - bool has_orientation() const { return b_has_orientation; } + std::vector& bindings() + { + return m_bindings; + } + const std::string& name_string() const + { + return m_name_string; + } + usz max_devices() const + { + return m_max_devices; + } + bool has_config() const + { + return b_has_config; + } + bool has_rumble() const + { + return b_has_rumble; + } + bool has_motion() const + { + return b_has_motion; + } + bool has_deadzones() const + { + return b_has_deadzones; + } + bool has_led() const + { + return b_has_led; + } + bool has_rgb() const + { + return b_has_rgb; + } + bool has_player_led() const + { + return b_has_player_led; + } + bool has_battery() const + { + return b_has_battery; + } + bool has_battery_led() const + { + return b_has_battery_led; + } + bool has_pressure_intensity_button() const + { + return b_has_pressure_intensity_button; + } + bool has_analog_limiter_button() const + { + return b_has_analog_limiter_button; + } + bool has_orientation() const + { + return b_has_orientation; + } u16 NormalizeStickInput(u16 raw_value, s32 threshold, s32 multiplier, bool ignore_threshold = false) const; void convert_stick_values(u16& x_out, u16& y_out, s32 x_in, s32 y_in, u32 deadzone, u32 anti_deadzone, u32 padsquircling) const; - void set_trigger_recognition_mode(trigger_recognition_mode mode) { m_trigger_recognition_mode = mode; } + void set_trigger_recognition_mode(trigger_recognition_mode mode) + { + m_trigger_recognition_mode = mode; + } - virtual bool Init() { return true; } + virtual bool Init() + { + return true; + } PadHandlerBase(pad_handler type = pad_handler::null); virtual ~PadHandlerBase() = default; // Sets window to config the controller(optional) virtual void SetPadData(const std::string& /*padId*/, u8 /*player_id*/, u8 /*large_motor*/, u8 /*small_motor*/, s32 /*r*/, s32 /*g*/, s32 /*b*/, bool /*player_led*/, bool /*battery_led*/, u32 /*battery_led_brightness*/) {} - virtual u32 get_battery_level(const std::string& /*padId*/) { return 0; } + virtual u32 get_battery_level(const std::string& /*padId*/) + { + return 0; + } // Return list of devices for that handler virtual std::vector list_devices() = 0; // Callback called during pad_thread::ThreadFunc @@ -344,7 +401,10 @@ public: virtual void init_config(cfg_pad* cfg) = 0; virtual connection get_next_button_press(const std::string& padId, const pad_callback& callback, const pad_fail_callback& fail_callback, gui_call_type call_type, const std::vector& buttons); virtual void get_motion_sensors(const std::string& pad_id, const motion_callback& callback, const motion_fail_callback& fail_callback, motion_preview_values preview_values, const std::array& sensors); - virtual std::unordered_map get_motion_axis_list() const { return {}; } + virtual std::unordered_map get_motion_axis_list() const + { + return {}; + } static constexpr f32 PI = 3.14159265f; @@ -359,17 +419,44 @@ public: }; private: - virtual std::shared_ptr get_device(const std::string& /*device*/) { return nullptr; } - virtual bool get_is_left_trigger(const std::shared_ptr& /*device*/, u64 /*keyCode*/) { return false; } - virtual bool get_is_right_trigger(const std::shared_ptr& /*device*/, u64 /*keyCode*/) { return false; } - virtual bool get_is_left_stick(const std::shared_ptr& /*device*/, u64 /*keyCode*/) { return false; } - virtual bool get_is_right_stick(const std::shared_ptr& /*device*/, u64 /*keyCode*/) { return false; } - virtual bool get_is_touch_pad_motion(const std::shared_ptr& /*device*/, u64 /*keyCode*/) { return false; } - virtual PadHandlerBase::connection update_connection(const std::shared_ptr& /*device*/) { return connection::disconnected; } + virtual std::shared_ptr get_device(const std::string& /*device*/) + { + return nullptr; + } + virtual bool get_is_left_trigger(const std::shared_ptr& /*device*/, u64 /*keyCode*/) + { + return false; + } + virtual bool get_is_right_trigger(const std::shared_ptr& /*device*/, u64 /*keyCode*/) + { + return false; + } + virtual bool get_is_left_stick(const std::shared_ptr& /*device*/, u64 /*keyCode*/) + { + return false; + } + virtual bool get_is_right_stick(const std::shared_ptr& /*device*/, u64 /*keyCode*/) + { + return false; + } + virtual bool get_is_touch_pad_motion(const std::shared_ptr& /*device*/, u64 /*keyCode*/) + { + return false; + } + virtual PadHandlerBase::connection update_connection(const std::shared_ptr& /*device*/) + { + return connection::disconnected; + } virtual void get_extended_info(const pad_ensemble& /*binding*/) {} virtual void apply_pad_data(const pad_ensemble& /*binding*/) {} - virtual std::unordered_map get_button_values(const std::shared_ptr& /*device*/) { return {}; } - virtual pad_preview_values get_preview_values(const std::unordered_map& /*data*/) { return {}; } + virtual std::unordered_map get_button_values(const std::shared_ptr& /*device*/) + { + return {}; + } + virtual pad_preview_values get_preview_values(const std::unordered_map& /*data*/) + { + return {}; + } void get_orientation(const pad_ensemble& binding) const; diff --git a/rpcs3/rpcs3/Emu/Io/RB3MidiDrums.cpp b/rpcs3/rpcs3/Emu/Io/RB3MidiDrums.cpp index 67ff121d7..999182ae0 100644 --- a/rpcs3/rpcs3/Emu/Io/RB3MidiDrums.cpp +++ b/rpcs3/rpcs3/Emu/Io/RB3MidiDrums.cpp @@ -12,305 +12,306 @@ LOG_CHANNEL(rb3_midi_drums_log); namespace controller { -// Bit flags by byte index. + // Bit flags by byte index. -constexpr usz FLAG = 0; -constexpr usz INDEX = 1; + constexpr usz FLAG = 0; + constexpr usz INDEX = 1; -using FlagByIndex = std::array; + using FlagByIndex = std::array; -constexpr FlagByIndex BUTTON_1 = {0x01, 0}; -constexpr FlagByIndex BUTTON_2 = {0x02, 0}; -constexpr FlagByIndex BUTTON_3 = {0x04, 0}; -constexpr FlagByIndex BUTTON_4 = {0x08, 0}; -constexpr FlagByIndex BUTTON_5 = {0x10, 0}; -constexpr FlagByIndex BUTTON_6 = {0x20, 0}; -// constexpr FlagByIndex BUTTON_7 = {0x40, 0}; -// constexpr FlagByIndex BUTTON_8 = {0x80, 0}; + constexpr FlagByIndex BUTTON_1 = {0x01, 0}; + constexpr FlagByIndex BUTTON_2 = {0x02, 0}; + constexpr FlagByIndex BUTTON_3 = {0x04, 0}; + constexpr FlagByIndex BUTTON_4 = {0x08, 0}; + constexpr FlagByIndex BUTTON_5 = {0x10, 0}; + constexpr FlagByIndex BUTTON_6 = {0x20, 0}; + // constexpr FlagByIndex BUTTON_7 = {0x40, 0}; + // constexpr FlagByIndex BUTTON_8 = {0x80, 0}; -constexpr FlagByIndex BUTTON_9 = {0x01, 1}; -constexpr FlagByIndex BUTTON_10 = {0x02, 1}; -constexpr FlagByIndex BUTTON_11 = {0x04, 1}; -constexpr FlagByIndex BUTTON_12 = {0x08, 1}; -// constexpr FlagByIndex BUTTON_13 = {0x10, 1}; + constexpr FlagByIndex BUTTON_9 = {0x01, 1}; + constexpr FlagByIndex BUTTON_10 = {0x02, 1}; + constexpr FlagByIndex BUTTON_11 = {0x04, 1}; + constexpr FlagByIndex BUTTON_12 = {0x08, 1}; + // constexpr FlagByIndex BUTTON_13 = {0x10, 1}; -constexpr usz DPAD_INDEX = 2; -enum class DPad : u8 -{ - Up = 0x00, - Right = 0x02, - Down = 0x04, - Left = 0x06, - Center = 0x08, -}; + constexpr usz DPAD_INDEX = 2; + enum class DPad : u8 + { + Up = 0x00, + Right = 0x02, + Down = 0x04, + Left = 0x06, + Center = 0x08, + }; -constexpr u8 AXIS_CENTER = 0x7F; + constexpr u8 AXIS_CENTER = 0x7F; -constexpr std::array default_state = { - 0x00, // buttons 1 to 8 - 0x00, // buttons 9 to 13 - static_cast(controller::DPad::Center), - controller::AXIS_CENTER, // x axis - controller::AXIS_CENTER, // y axis - controller::AXIS_CENTER, // z axis - controller::AXIS_CENTER, // w axis - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, // yellow drum/cymbal velocity - 0x00, // red drum/cymbal velocity - 0x00, // green drum/cymbal velocity - 0x00, // blue drum/cymbal velocity - 0x00, - 0x00, - 0x00, - 0x00, - 0x02, - 0x00, - 0x02, - 0x00, - 0x02, - 0x00, - 0x02, - 0x00 -}; + constexpr std::array default_state = { + 0x00, // buttons 1 to 8 + 0x00, // buttons 9 to 13 + static_cast(controller::DPad::Center), + controller::AXIS_CENTER, // x axis + controller::AXIS_CENTER, // y axis + controller::AXIS_CENTER, // z axis + controller::AXIS_CENTER, // w axis + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, // yellow drum/cymbal velocity + 0x00, // red drum/cymbal velocity + 0x00, // green drum/cymbal velocity + 0x00, // blue drum/cymbal velocity + 0x00, + 0x00, + 0x00, + 0x00, + 0x02, + 0x00, + 0x02, + 0x00, + 0x02, + 0x00, + 0x02, + 0x00}; } // namespace controller namespace drum { -// Hold each hit for a period of time. Rock band doesn't pick up a single tick. -std::chrono::milliseconds hit_duration() -{ - return std::chrono::milliseconds(g_cfg_rb3drums.pulse_ms); -} + // Hold each hit for a period of time. Rock band doesn't pick up a single tick. + std::chrono::milliseconds hit_duration() + { + return std::chrono::milliseconds(g_cfg_rb3drums.pulse_ms); + } -// Scale velocity from midi to what rock band expects. -u8 scale_velocity(u8 value) -{ - return (0xFF - (2 * value)); -} + // Scale velocity from midi to what rock band expects. + u8 scale_velocity(u8 value) + { + return (0xFF - (2 * value)); + } -constexpr usz FLAG = controller::FLAG; -constexpr usz INDEX = controller::INDEX; + constexpr usz FLAG = controller::FLAG; + constexpr usz INDEX = controller::INDEX; -using FlagByIndex = controller::FlagByIndex; + using FlagByIndex = controller::FlagByIndex; -constexpr FlagByIndex GREEN = controller::BUTTON_2; -constexpr FlagByIndex RED = controller::BUTTON_3; -constexpr FlagByIndex YELLOW = controller::BUTTON_4; -constexpr FlagByIndex BLUE = controller::BUTTON_1; -constexpr FlagByIndex KICK_PEDAL = controller::BUTTON_5; -constexpr FlagByIndex HIHAT_PEDAL = controller::BUTTON_6; + constexpr FlagByIndex GREEN = controller::BUTTON_2; + constexpr FlagByIndex RED = controller::BUTTON_3; + constexpr FlagByIndex YELLOW = controller::BUTTON_4; + constexpr FlagByIndex BLUE = controller::BUTTON_1; + constexpr FlagByIndex KICK_PEDAL = controller::BUTTON_5; + constexpr FlagByIndex HIHAT_PEDAL = controller::BUTTON_6; -constexpr FlagByIndex IS_DRUM = controller::BUTTON_11; -constexpr FlagByIndex IS_CYMBAL = controller::BUTTON_12; + constexpr FlagByIndex IS_DRUM = controller::BUTTON_11; + constexpr FlagByIndex IS_CYMBAL = controller::BUTTON_12; -// constexpr FlagByIndex BACK_BUTTON = controller::BUTTON_3; -constexpr FlagByIndex START_BUTTON = controller::BUTTON_10; -// constexpr FlagByIndex SYSTEM_BUTTON = controller::BUTTON_13; -constexpr FlagByIndex SELECT_BUTTON = controller::BUTTON_9; + // constexpr FlagByIndex BACK_BUTTON = controller::BUTTON_3; + constexpr FlagByIndex START_BUTTON = controller::BUTTON_10; + // constexpr FlagByIndex SYSTEM_BUTTON = controller::BUTTON_13; + constexpr FlagByIndex SELECT_BUTTON = controller::BUTTON_9; -rb3drums::KitState start_state() -{ - rb3drums::KitState s{}; - s.expiry = std::chrono::steady_clock::now() + drum::hit_duration(); - s.start = true; - return s; -} + rb3drums::KitState start_state() + { + rb3drums::KitState s{}; + s.expiry = std::chrono::steady_clock::now() + drum::hit_duration(); + s.start = true; + return s; + } -rb3drums::KitState select_state() -{ - rb3drums::KitState s{}; - s.expiry = std::chrono::steady_clock::now() + drum::hit_duration(); - s.select = true; - return s; -} + rb3drums::KitState select_state() + { + rb3drums::KitState s{}; + s.expiry = std::chrono::steady_clock::now() + drum::hit_duration(); + s.select = true; + return s; + } -rb3drums::KitState toggle_hold_kick_state() -{ - rb3drums::KitState s{}; - s.expiry = std::chrono::steady_clock::now() + drum::hit_duration(); - s.toggle_hold_kick = true; - return s; -} + rb3drums::KitState toggle_hold_kick_state() + { + rb3drums::KitState s{}; + s.expiry = std::chrono::steady_clock::now() + drum::hit_duration(); + s.toggle_hold_kick = true; + return s; + } -rb3drums::KitState kick_state() -{ - rb3drums::KitState s{}; - s.expiry = std::chrono::steady_clock::now() + drum::hit_duration(); - s.kick_pedal = 127; - return s; -} + rb3drums::KitState kick_state() + { + rb3drums::KitState s{}; + s.expiry = std::chrono::steady_clock::now() + drum::hit_duration(); + s.kick_pedal = 127; + return s; + } } // namespace drum namespace midi { -u8 min_velocity() -{ - return g_cfg_rb3drums.minimum_velocity; -} - -Note str_to_note(const std::string_view name) -{ - static const std::unordered_map mapping{ - {"Invalid", Note::Invalid}, - {"Kick", Note::Kick}, - {"HihatPedal", Note::HihatPedal}, - {"Snare", Note::Snare}, - {"SnareRim", Note::SnareRim}, - {"HiTom", Note::HiTom}, - {"LowTom", Note::LowTom}, - {"FloorTom", Note::FloorTom}, - {"HihatWithPedalUp", Note::HihatWithPedalUp}, - {"Hihat", Note::Hihat}, - {"Ride", Note::Ride}, - {"Crash", Note::Crash}, - }; - auto it = mapping.find(name); - return it != std::end(mapping) ? it->second : Note::Invalid; -} - -std::optional> parse_midi_override(const std::string_view config) -{ - auto split = fmt::split(config, {"="}); - if (split.size() != 2) + u8 min_velocity() { - return {}; + return g_cfg_rb3drums.minimum_velocity; } - uint64_t id_int = 0; - if (!try_to_uint64(&id_int, split[0], 0, 255)) - { - rb3_midi_drums_log.warning("midi override: %s is not a valid midi id", split[0]); - return {}; - } - auto id = static_cast(id_int); - auto note = str_to_note(split[1]); - if (note == Note::Invalid) - { - rb3_midi_drums_log.warning("midi override: %s is not a valid note", split[1]); - return {}; - } - rb3_midi_drums_log.success("found valid midi override: %s", config); - return {{id, note}}; -} -std::unordered_map create_id_to_note_mapping() -{ - std::unordered_map mapping{ - {Id::MidiCC, Note::Kick}, - {Id::Kick0, Note::Kick}, - {Id::Kick1, Note::Kick}, - {Id::Kick2, Note::Kick}, - {Id::HihatPedal, Note::HihatPedal}, - {Id::HihatPedalPartial, Note::HihatPedal}, - {Id::Snare0, Note::Snare}, - {Id::Snare1, Note::Snare}, - {Id::Snare2, Note::Snare}, - {Id::Snare3, Note::Snare}, - {Id::Snare4, Note::Snare}, - {Id::SnareRim, Note::SnareRim}, - {Id::HiTom0, Note::HiTom}, - {Id::HiTom1, Note::HiTom}, - {Id::LowTom0, Note::LowTom}, - {Id::LowTom1, Note::LowTom}, - {Id::FloorTom0, Note::FloorTom}, - {Id::FloorTom1, Note::FloorTom}, - {Id::Hihat0, Note::Hihat}, - {Id::Hihat1, Note::Hihat}, - {Id::Hihat2, Note::Hihat}, - {Id::Hihat3, Note::Hihat}, - {Id::HihatWithPedalUp, Note::Hihat}, - {Id::Ride0, Note::Ride}, - {Id::Ride1, Note::Ride}, - {Id::Ride2, Note::Ride}, - {Id::Ride3, Note::Ride}, - {Id::Crash0, Note::Crash}, - {Id::Crash1, Note::Crash}, - {Id::Crash2, Note::Crash}, - {Id::Crash3, Note::Crash}, - }; - - // Apply configured overrides. - const std::vector segments = fmt::split(g_cfg_rb3drums.midi_overrides.to_string(), {","}); - for (const std::string& segment : segments) + Note str_to_note(const std::string_view name) { - if (const auto midi_override = parse_midi_override(segment)) + static const std::unordered_map mapping{ + {"Invalid", Note::Invalid}, + {"Kick", Note::Kick}, + {"HihatPedal", Note::HihatPedal}, + {"Snare", Note::Snare}, + {"SnareRim", Note::SnareRim}, + {"HiTom", Note::HiTom}, + {"LowTom", Note::LowTom}, + {"FloorTom", Note::FloorTom}, + {"HihatWithPedalUp", Note::HihatWithPedalUp}, + {"Hihat", Note::Hihat}, + {"Ride", Note::Ride}, + {"Crash", Note::Crash}, + }; + auto it = mapping.find(name); + return it != std::end(mapping) ? it->second : Note::Invalid; + } + + std::optional> parse_midi_override(const std::string_view config) + { + auto split = fmt::split(config, {"="}); + if (split.size() != 2) { - const auto id = midi_override->first; - const auto note = midi_override->second; - mapping[id] = note; + return {}; } - } - return mapping; -} - -namespace combo -{ - -std::vector parse_combo(const std::string_view name, const std::string_view csv) -{ - if (csv.empty()) - { - return {}; - } - std::vector notes; - const auto& note_names = fmt::split(csv, {","}); - for (const auto& note_name : note_names) - { - const auto note = str_to_note(note_name); - if (note != midi::Note::Invalid) + uint64_t id_int = 0; + if (!try_to_uint64(&id_int, split[0], 0, 255)) { - notes.push_back(static_cast(note)); + rb3_midi_drums_log.warning("midi override: %s is not a valid midi id", split[0]); + return {}; } - else + auto id = static_cast(id_int); + auto note = str_to_note(split[1]); + if (note == Note::Invalid) { - rb3_midi_drums_log.warning("invalid note '%s' in configured combo '%s'", note_name, name); + rb3_midi_drums_log.warning("midi override: %s is not a valid note", split[1]); + return {}; } + rb3_midi_drums_log.success("found valid midi override: %s", config); + return {{id, note}}; } - return notes; -} -std::chrono::milliseconds window() -{ - return std::chrono::milliseconds{g_cfg_rb3drums.combo_window_ms}; -} + std::unordered_map create_id_to_note_mapping() + { + std::unordered_map mapping{ + {Id::MidiCC, Note::Kick}, + {Id::Kick0, Note::Kick}, + {Id::Kick1, Note::Kick}, + {Id::Kick2, Note::Kick}, + {Id::HihatPedal, Note::HihatPedal}, + {Id::HihatPedalPartial, Note::HihatPedal}, + {Id::Snare0, Note::Snare}, + {Id::Snare1, Note::Snare}, + {Id::Snare2, Note::Snare}, + {Id::Snare3, Note::Snare}, + {Id::Snare4, Note::Snare}, + {Id::SnareRim, Note::SnareRim}, + {Id::HiTom0, Note::HiTom}, + {Id::HiTom1, Note::HiTom}, + {Id::LowTom0, Note::LowTom}, + {Id::LowTom1, Note::LowTom}, + {Id::FloorTom0, Note::FloorTom}, + {Id::FloorTom1, Note::FloorTom}, + {Id::Hihat0, Note::Hihat}, + {Id::Hihat1, Note::Hihat}, + {Id::Hihat2, Note::Hihat}, + {Id::Hihat3, Note::Hihat}, + {Id::HihatWithPedalUp, Note::Hihat}, + {Id::Ride0, Note::Ride}, + {Id::Ride1, Note::Ride}, + {Id::Ride2, Note::Ride}, + {Id::Ride3, Note::Ride}, + {Id::Crash0, Note::Crash}, + {Id::Crash1, Note::Crash}, + {Id::Crash2, Note::Crash}, + {Id::Crash3, Note::Crash}, + }; -} + // Apply configured overrides. + const std::vector segments = fmt::split(g_cfg_rb3drums.midi_overrides.to_string(), {","}); + for (const std::string& segment : segments) + { + if (const auto midi_override = parse_midi_override(segment)) + { + const auto id = midi_override->first; + const auto note = midi_override->second; + mapping[id] = note; + } + } + return mapping; + } + + namespace combo + { + + std::vector parse_combo(const std::string_view name, const std::string_view csv) + { + if (csv.empty()) + { + return {}; + } + std::vector notes; + const auto& note_names = fmt::split(csv, {","}); + for (const auto& note_name : note_names) + { + const auto note = str_to_note(note_name); + if (note != midi::Note::Invalid) + { + notes.push_back(static_cast(note)); + } + else + { + rb3_midi_drums_log.warning("invalid note '%s' in configured combo '%s'", note_name, name); + } + } + return notes; + } + + std::chrono::milliseconds window() + { + return std::chrono::milliseconds{g_cfg_rb3drums.combo_window_ms}; + } + + } // namespace combo } // namespace midi namespace { -void set_flag(u8* buf, [[maybe_unused]] std::string_view name, const controller::FlagByIndex& fbi) -{ - auto i = fbi[drum::INDEX]; - auto flag = fbi[drum::FLAG]; - buf[i] |= flag; - // rb3_midi_drums_log.success("wrote flag %x at index %d", flag, i); -} - -void set_flag_if_any(u8* buf, std::string_view name, const controller::FlagByIndex& fbi, const std::vector velocities) -{ - if (std::none_of(velocities.begin(), velocities.end(), [](u8 velocity){ return velocity >= midi::min_velocity(); })) + void set_flag(u8* buf, [[maybe_unused]] std::string_view name, const controller::FlagByIndex& fbi) { - return; + auto i = fbi[drum::INDEX]; + auto flag = fbi[drum::FLAG]; + buf[i] |= flag; + // rb3_midi_drums_log.success("wrote flag %x at index %d", flag, i); } - set_flag(buf, name, fbi); -} -} + void set_flag_if_any(u8* buf, std::string_view name, const controller::FlagByIndex& fbi, const std::vector velocities) + { + if (std::none_of(velocities.begin(), velocities.end(), [](u8 velocity) + { + return velocity >= midi::min_velocity(); + })) + { + return; + } + set_flag(buf, name, fbi); + } + +} // namespace usb_device_rb3_midi_drums::Definition::Definition(std::string name, const std::string_view csv, const std::function create_state) - : name{std::move(name)} - , notes{midi::combo::parse_combo(this->name, csv)} - , create_state{create_state} -{} + : name{std::move(name)}, notes{midi::combo::parse_combo(this->name, csv)}, create_state{create_state} +{ +} usb_device_rb3_midi_drums::usb_device_rb3_midi_drums(const std::array& location, const std::string& device_name) : usb_device_emulated(location) @@ -324,7 +325,7 @@ usb_device_rb3_midi_drums::usb_device_rb3_midi_drums(const std::array& lo descriptor.bDeviceSubClass = 0x00; descriptor.bDeviceProtocol = 0x00; descriptor.bMaxPacketSize0 = 64; - descriptor.idVendor = 0x12BA; // Harmonix + descriptor.idVendor = 0x12BA; // Harmonix descriptor.idProduct = 0x0210; // Drums descriptor.bcdDevice = 0x01; descriptor.iManufacturer = 0x01; @@ -464,7 +465,7 @@ void usb_device_rb3_midi_drums::control_transfer(u8 bmRequestType, u8 bRequest, // the game expects some sort of response to the configuration packet else if (bmRequestType == 0xa1 && bRequest == 0x1) { - //rb3_midi_drums_log.success("[control_transfer] config 0xa1 0x1 length %d", wLength); + // rb3_midi_drums_log.success("[control_transfer] config 0xa1 0x1 length %d", wLength); transfer->expected_count = buf_size; if (buttons_enabled) @@ -482,16 +483,16 @@ void usb_device_rb3_midi_drums::control_transfer(u8 bmRequestType, u8 bRequest, response_pos += copied_bytes; } } - //else if (bmRequestType == 0x00 && bRequest == 0x9) + // else if (bmRequestType == 0x00 && bRequest == 0x9) //{ - // // idk what this is but if I handle it we don't get input. + // // idk what this is but if I handle it we don't get input. // rb3_midi_drums_log.success("handled -- request %x, type %x, length %x", bmRequestType, bRequest, wLength); - //} - //else if (bmRequestType == 0x80 && bRequest == 0x6) + // } + // else if (bmRequestType == 0x80 && bRequest == 0x6) //{ - // // idk what this is but if I handle it we don't get input. + // // idk what this is but if I handle it we don't get input. // rb3_midi_drums_log.success("handled -- request %x, type %x, length %x", bmRequestType, bRequest, wLength); - //} + // } else if (bmRequestType == 0x21 && bRequest == 0x9 && wLength == 8) { // the game uses this request to do things like set the LEDs @@ -575,9 +576,11 @@ void usb_device_rb3_midi_drums::interrupt_transfer(u32 buf_size, u8* buf, u32 /* // Clean expired states. auto now = std::chrono::steady_clock::now(); - kit_states.erase(std::remove_if(std::begin(kit_states), std::end(kit_states), [&now](const rb3drums::KitState& kit_state) { - return now >= kit_state.expiry; - }), std::end(kit_states)); + kit_states.erase(std::remove_if(std::begin(kit_states), std::end(kit_states), [&now](const rb3drums::KitState& kit_state) + { + return now >= kit_state.expiry; + }), + std::end(kit_states)); bool cymbal_hit = false; usz i = 0; @@ -655,20 +658,20 @@ rb3drums::KitState usb_device_rb3_midi_drums::parse_midi_note(const u8 id, const const midi::Note note = id_to_note(static_cast(id)); switch (note) { - case midi::Note::Kick: kit_state.kick_pedal = velocity; break; - case midi::Note::HihatPedal: kit_state.hihat_pedal = velocity; break; - case midi::Note::Snare: kit_state.snare = velocity; break; - case midi::Note::SnareRim: kit_state.snare_rim = velocity; break; - case midi::Note::HiTom: kit_state.hi_tom = velocity; break; - case midi::Note::LowTom: kit_state.low_tom = velocity; break; - case midi::Note::FloorTom: kit_state.floor_tom = velocity; break; - case midi::Note::Hihat: kit_state.hihat = velocity; break; - case midi::Note::Ride: kit_state.ride = velocity; break; - case midi::Note::Crash: kit_state.crash = velocity; break; - default: - // Ignored note. - rb3_midi_drums_log.error("IGNORED NOTE: id = %x or %d", id, id); - return rb3drums::KitState{}; + case midi::Note::Kick: kit_state.kick_pedal = velocity; break; + case midi::Note::HihatPedal: kit_state.hihat_pedal = velocity; break; + case midi::Note::Snare: kit_state.snare = velocity; break; + case midi::Note::SnareRim: kit_state.snare_rim = velocity; break; + case midi::Note::HiTom: kit_state.hi_tom = velocity; break; + case midi::Note::LowTom: kit_state.low_tom = velocity; break; + case midi::Note::FloorTom: kit_state.floor_tom = velocity; break; + case midi::Note::Hihat: kit_state.hihat = velocity; break; + case midi::Note::Ride: kit_state.ride = velocity; break; + case midi::Note::Crash: kit_state.crash = velocity; break; + default: + // Ignored note. + rb3_midi_drums_log.error("IGNORED NOTE: id = %x or %d", id, id); + return rb3drums::KitState{}; } combo.add(static_cast(note)); @@ -685,9 +688,7 @@ bool usb_device_rb3_midi_drums::is_midi_cc(const u8 id, const u8 value) const auto is_past_threshold = [](u8 value) { const u8 threshold = g_cfg_rb3drums.midi_cc_threshold; - return g_cfg_rb3drums.midi_cc_invert_threshold - ? value < threshold - : value > threshold; + return g_cfg_rb3drums.midi_cc_invert_threshold ? value < threshold : value > threshold; }; if (midi_cc_triggered) @@ -768,10 +769,18 @@ bool rb3drums::KitState::is_drum() const void usb_device_rb3_midi_drums::ComboTracker::reload_definitions() { m_definitions = { - {"start", g_cfg_rb3drums.combo_start.to_string(), []{ return drum::start_state(); }}, - {"select", g_cfg_rb3drums.combo_select.to_string(), []{ return drum::select_state(); }}, - {"hold kick", g_cfg_rb3drums.combo_toggle_hold_kick.to_string(), []{ return drum::toggle_hold_kick_state(); }} - }; + {"start", g_cfg_rb3drums.combo_start.to_string(), [] + { + return drum::start_state(); + }}, + {"select", g_cfg_rb3drums.combo_select.to_string(), [] + { + return drum::select_state(); + }}, + {"hold kick", g_cfg_rb3drums.combo_toggle_hold_kick.to_string(), [] + { + return drum::toggle_hold_kick_state(); + }}}; } void usb_device_rb3_midi_drums::ComboTracker::add(u8 note) diff --git a/rpcs3/rpcs3/Emu/Io/RB3MidiDrums.h b/rpcs3/rpcs3/Emu/Io/RB3MidiDrums.h index 9d13a8181..60a2874ce 100644 --- a/rpcs3/rpcs3/Emu/Io/RB3MidiDrums.h +++ b/rpcs3/rpcs3/Emu/Io/RB3MidiDrums.h @@ -9,102 +9,102 @@ namespace rb3drums { -struct KitState -{ - std::chrono::steady_clock::time_point expiry; + struct KitState + { + std::chrono::steady_clock::time_point expiry; - u8 kick_pedal{}; - u8 hihat_pedal{}; + u8 kick_pedal{}; + u8 hihat_pedal{}; - u8 snare{}; - u8 snare_rim{}; - u8 hi_tom{}; - u8 low_tom{}; - u8 floor_tom{}; + u8 snare{}; + u8 snare_rim{}; + u8 hi_tom{}; + u8 low_tom{}; + u8 floor_tom{}; - u8 hihat{}; - u8 ride{}; - u8 crash{}; + u8 hihat{}; + u8 ride{}; + u8 crash{}; - // Buttons triggered by combos. - bool start{}; - bool select{}; + // Buttons triggered by combos. + bool start{}; + bool select{}; - // Special flag that keeps kick pedal held until toggled off. - // This is used in rb3 to access the category select dropdown in the song list. - bool toggle_hold_kick{}; + // Special flag that keeps kick pedal held until toggled off. + // This is used in rb3 to access the category select dropdown in the song list. + bool toggle_hold_kick{}; - bool is_cymbal() const; - bool is_drum() const; -}; + bool is_cymbal() const; + bool is_drum() const; + }; } // namespace rb3drums namespace midi { -enum class Id : u8 -{ - // Each 'Note' can be triggered by multiple different numbers. - // Keeping them flattened in an enum for simplicity / switch statement usage. + enum class Id : u8 + { + // Each 'Note' can be triggered by multiple different numbers. + // Keeping them flattened in an enum for simplicity / switch statement usage. - // These follow the rockband 3 midi pro adapter support. - Snare0 = 38, - Snare1 = 31, - Snare2 = 34, - Snare3 = 37, - Snare4 = 39, - HiTom0 = 48, - HiTom1 = 50, - LowTom0 = 45, - LowTom1 = 47, - FloorTom0 = 41, - FloorTom1 = 43, - Hihat0 = 22, - Hihat1 = 26, - Hihat2 = 42, - Hihat3 = 54, - Ride0 = 51, - Ride1 = 53, - Ride2 = 56, - Ride3 = 59, - Crash0 = 49, - Crash1 = 52, - Crash2 = 55, - Crash3 = 57, - Kick0 = 33, - Kick1 = 35, - Kick2 = 36, - HihatPedal = 44, + // These follow the rockband 3 midi pro adapter support. + Snare0 = 38, + Snare1 = 31, + Snare2 = 34, + Snare3 = 37, + Snare4 = 39, + HiTom0 = 48, + HiTom1 = 50, + LowTom0 = 45, + LowTom1 = 47, + FloorTom0 = 41, + FloorTom1 = 43, + Hihat0 = 22, + Hihat1 = 26, + Hihat2 = 42, + Hihat3 = 54, + Ride0 = 51, + Ride1 = 53, + Ride2 = 56, + Ride3 = 59, + Crash0 = 49, + Crash1 = 52, + Crash2 = 55, + Crash3 = 57, + Kick0 = 33, + Kick1 = 35, + Kick2 = 36, + HihatPedal = 44, - // These are from alesis nitro mesh max. ymmv. - SnareRim = 40, // midi pro adapter counts this as snare. - HihatWithPedalUp = 46, // The midi pro adapter considers this a normal hihat hit. - HihatPedalPartial = 23, // If pedal is not 100% down, this will be sent instead of a normal hihat hit. + // These are from alesis nitro mesh max. ymmv. + SnareRim = 40, // midi pro adapter counts this as snare. + HihatWithPedalUp = 46, // The midi pro adapter considers this a normal hihat hit. + HihatPedalPartial = 23, // If pedal is not 100% down, this will be sent instead of a normal hihat hit. - // Internal value used for converting midi CC. - // Values past 127 are not used in midi notes. - MidiCC = 255, -}; + // Internal value used for converting midi CC. + // Values past 127 are not used in midi notes. + MidiCC = 255, + }; -// Intermediate mapping regardless of which midi ids triggered it. -enum class Note : u8 -{ - Invalid, - Kick, - HihatPedal, - Snare, - SnareRim, - HiTom, - LowTom, - FloorTom, - HihatWithPedalUp, - Hihat, - Ride, - Crash, -}; + // Intermediate mapping regardless of which midi ids triggered it. + enum class Note : u8 + { + Invalid, + Kick, + HihatPedal, + Snare, + SnareRim, + HiTom, + LowTom, + FloorTom, + HihatWithPedalUp, + Hihat, + Ride, + Crash, + }; -} +} // namespace midi class usb_device_rb3_midi_drums : public usb_device_emulated { @@ -128,7 +128,7 @@ private: std::string name; std::vector notes; std::function create_state; - + Definition(std::string name, const std::string_view csv, const std::function create_state); }; diff --git a/rpcs3/rpcs3/Emu/Io/RB3MidiGuitar.cpp b/rpcs3/rpcs3/Emu/Io/RB3MidiGuitar.cpp index 989572263..54654c24c 100644 --- a/rpcs3/rpcs3/Emu/Io/RB3MidiGuitar.cpp +++ b/rpcs3/rpcs3/Emu/Io/RB3MidiGuitar.cpp @@ -188,7 +188,6 @@ void usb_device_rb3_midi_guitar::interrupt_transfer(u32 buf_size, u8* buf, u32 / // no reason we can't make it faster transfer->expected_time = get_timestamp() + 1'000; - // default input state const std::array bytes = { 0x00, 0x00, 0x08, 0x80, 0x80, 0x00, 0x00, 0x00, @@ -317,39 +316,39 @@ void usb_device_rb3_midi_guitar::write_state(u8* buf) { switch (i) { - case 1: - case 6: - case 13: - buf[9] |= 0b1000'0000; - break; - case 2: - case 7: - case 14: - buf[10] |= 0b1000'0000; - break; - case 3: - case 8: - case 15: - buf[11] |= 0b1000'0000; - break; - case 4: - case 9: - case 16: - buf[12] |= 0b1000'0000; - break; - case 5: - case 10: - case 17: - buf[13] |= 0b1000'0000; - break; - default: - break; + case 1: + case 6: + case 13: + buf[9] |= 0b1000'0000; + break; + case 2: + case 7: + case 14: + buf[10] |= 0b1000'0000; + break; + case 3: + case 8: + case 15: + buf[11] |= 0b1000'0000; + break; + case 4: + case 9: + case 16: + buf[12] |= 0b1000'0000; + break; + case 5: + case 10: + case 17: + buf[13] |= 0b1000'0000; + break; + default: + break; } // enable the solo bit for frets >= 13 if (i >= 13) { - buf[8] |= 0b1000'0000; + buf[8] |= 0b1000'0000; } } diff --git a/rpcs3/rpcs3/Emu/Io/Skylander.cpp b/rpcs3/rpcs3/Emu/Io/Skylander.cpp index 974e9a887..ff9d9bf3e 100644 --- a/rpcs3/rpcs3/Emu/Io/Skylander.cpp +++ b/rpcs3/rpcs3/Emu/Io/Skylander.cpp @@ -51,7 +51,7 @@ void sky_portal::deactivate() // check if at the end of the updates there would be a figure on the portal if (!s.queued_status.empty()) { - s.status = s.queued_status.back(); + s.status = s.queued_status.back(); s.queued_status = std::queue(); } @@ -158,7 +158,7 @@ u8 sky_portal::load_skylander(u8* buf, fs::file in_file) std::lock_guard lock(sky_mutex); const u32 sky_serial = read_from_ptr>(buf); - u8 found_slot = 0xFF; + u8 found_slot = 0xFF; // mimics spot retaining on the portal for (u8 i = 0; i < 8; i++) @@ -183,7 +183,7 @@ u8 sky_portal::load_skylander(u8* buf, fs::file in_file) skylander& thesky = skylanders[found_slot]; memcpy(thesky.data.data(), buf, thesky.data.size()); thesky.sky_file = std::move(in_file); - thesky.status = 3; + thesky.status = 3; thesky.queued_status.push(3); thesky.queued_status.push(1); thesky.last_id = sky_serial; @@ -194,7 +194,7 @@ u8 sky_portal::load_skylander(u8* buf, fs::file in_file) usb_device_skylander::usb_device_skylander(const std::array& location) : usb_device_emulated(location) { - device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, UsbDeviceDescriptor{0x0200, 0x00, 0x00, 0x00, 0x40, 0x1430, 0x0150, 0x0100, 0x01, 0x02, 0x00, 0x01}); + device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, UsbDeviceDescriptor{0x0200, 0x00, 0x00, 0x00, 0x40, 0x1430, 0x0150, 0x0100, 0x01, 0x02, 0x00, 0x01}); auto& config0 = device.add_node(UsbDescriptorNode(USB_DESCRIPTOR_CONFIG, UsbDeviceConfiguration{0x0029, 0x01, 0x01, 0x00, 0x80, 0xFA})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_INTERFACE, UsbDeviceInterface{0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_HID, UsbDeviceHID{0x0111, 0x00, 0x01, 0x22, 0x001d})); @@ -228,7 +228,7 @@ void usb_device_skylander::control_transfer(u8 bmRequestType, u8 bRequest, u16 w switch (bRequest) { case 0x09: - transfer->expected_count = buf_size; + transfer->expected_count = buf_size; transfer->expected_result = HC_CC_NOERR; // 100 usec, control transfers are very fast transfer->expected_time = get_timestamp() + 100; @@ -242,7 +242,7 @@ void usb_device_skylander::control_transfer(u8 bmRequestType, u8 bRequest, u16 w // Activate command ensure(buf_size == 2 || buf_size == 32); q_result = {0x41, buf[1], 0xFF, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00}; + 0x00, 0x00}; q_queries.push(q_result); g_skyportal.activate(); break; @@ -298,7 +298,7 @@ void usb_device_skylander::control_transfer(u8 bmRequestType, u8 bRequest, u16 w // Shutdowns the portal ensure(buf_size == 2 || buf_size == 32); q_result = { - 0x52, 0x02, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + 0x52, 0x02, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; q_queries.push(q_result); g_skyportal.deactivate(); break; @@ -347,8 +347,8 @@ void usb_device_skylander::interrupt_transfer(u32 buf_size, u8* buf, u32 endpoin { ensure(buf_size == 0x20); - transfer->fake = true; - transfer->expected_count = buf_size; + transfer->fake = true; + transfer->expected_count = buf_size; transfer->expected_result = HC_CC_NOERR; if (endpoint == 0x02) diff --git a/rpcs3/rpcs3/Emu/Io/Skylander.h b/rpcs3/rpcs3/Emu/Io/Skylander.h index be67c8c3c..c3eb596b2 100644 --- a/rpcs3/rpcs3/Emu/Io/Skylander.h +++ b/rpcs3/rpcs3/Emu/Io/Skylander.h @@ -31,7 +31,7 @@ public: protected: shared_mutex sky_mutex; - bool activated = true; + bool activated = true; u8 interrupt_counter = 0; u8 r = 0, g = 0, b = 0; diff --git a/rpcs3/rpcs3/Emu/Io/TopShotElite.cpp b/rpcs3/rpcs3/Emu/Io/TopShotElite.cpp index 06cddab9f..fa87a4774 100644 --- a/rpcs3/rpcs3/Emu/Io/TopShotElite.cpp +++ b/rpcs3/rpcs3/Emu/Io/TopShotElite.cpp @@ -12,43 +12,43 @@ LOG_CHANNEL(topshotelite_log); #define TSE_CALIB_LOG false // 0 < Calib_Top < Calib_Bottom < 0x2ff // 0 < Calib_Right < Calib_Left < 0x3ff -constexpr u16 TSE_CALIB_TOP = 20; +constexpr u16 TSE_CALIB_TOP = 20; constexpr u16 TSE_CALIB_BOTTOM = 840; -constexpr u16 TSE_CALIB_LEFT = 930; -constexpr u16 TSE_CALIB_RIGHT = 95; -constexpr u16 TSE_CALIB_DIST = 95; +constexpr u16 TSE_CALIB_LEFT = 930; +constexpr u16 TSE_CALIB_RIGHT = 95; +constexpr u16 TSE_CALIB_DIST = 95; template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](topshotelite_btn value) - { - switch (value) { - case topshotelite_btn::trigger: return "Trigger"; - case topshotelite_btn::reload: return "Reload"; - case topshotelite_btn::square: return "Square"; - case topshotelite_btn::cross: return "Cross"; - case topshotelite_btn::circle: return "Circle"; - case topshotelite_btn::triangle: return "Triangle"; - case topshotelite_btn::select: return "Select"; - case topshotelite_btn::start: return "Start"; - case topshotelite_btn::l3: return "L3"; - case topshotelite_btn::r3: return "R3"; - case topshotelite_btn::ps: return "PS"; - case topshotelite_btn::dpad_up: return "D-Pad Up"; - case topshotelite_btn::dpad_down: return "D-Pad Down"; - case topshotelite_btn::dpad_left: return "D-Pad Left"; - case topshotelite_btn::dpad_right: return "D-Pad Right"; - case topshotelite_btn::ls_x: return "Left Stick X-Axis"; - case topshotelite_btn::ls_y: return "Left Stick Y-Axis"; - case topshotelite_btn::rs_x: return "Right Stick X-Axis"; - case topshotelite_btn::rs_y: return "Right Stick Y-Axis"; - case topshotelite_btn::count: return "Count"; - } + switch (value) + { + case topshotelite_btn::trigger: return "Trigger"; + case topshotelite_btn::reload: return "Reload"; + case topshotelite_btn::square: return "Square"; + case topshotelite_btn::cross: return "Cross"; + case topshotelite_btn::circle: return "Circle"; + case topshotelite_btn::triangle: return "Triangle"; + case topshotelite_btn::select: return "Select"; + case topshotelite_btn::start: return "Start"; + case topshotelite_btn::l3: return "L3"; + case topshotelite_btn::r3: return "R3"; + case topshotelite_btn::ps: return "PS"; + case topshotelite_btn::dpad_up: return "D-Pad Up"; + case topshotelite_btn::dpad_down: return "D-Pad Down"; + case topshotelite_btn::dpad_left: return "D-Pad Left"; + case topshotelite_btn::dpad_right: return "D-Pad Right"; + case topshotelite_btn::ls_x: return "Left Stick X-Axis"; + case topshotelite_btn::ls_y: return "Left Stick Y-Axis"; + case topshotelite_btn::rs_x: return "Right Stick X-Axis"; + case topshotelite_btn::rs_y: return "Right Stick Y-Axis"; + case topshotelite_btn::count: return "Count"; + } - return unknown; - }); + return unknown; + }); } #pragma pack(push, 1) @@ -58,15 +58,15 @@ struct TopShotElite_data uint8_t btn_cross : 1; uint8_t btn_circle : 1; uint8_t btn_triangle : 1; - uint8_t btn_reload: 1; - uint8_t btn_trigger: 1; + uint8_t btn_reload : 1; + uint8_t btn_trigger : 1; uint8_t : 2; uint8_t btn_select : 1; uint8_t btn_start : 1; uint8_t btn_l3 : 1; uint8_t btn_r3 : 1; - uint8_t btn_ps: 1; + uint8_t btn_ps : 1; uint8_t : 3; uint8_t dpad; @@ -112,60 +112,58 @@ enum }; usb_device_topshotelite::usb_device_topshotelite(u32 controller_index, const std::array& location) - : usb_device_emulated(location) - , m_controller_index(controller_index) - , m_mode(0) + : usb_device_emulated(location), m_controller_index(controller_index), m_mode(0) { device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, - UsbDeviceDescriptor { - .bcdUSB = 0x0100, - .bDeviceClass = 0x00, - .bDeviceSubClass = 0x00, - .bDeviceProtocol = 0x00, - .bMaxPacketSize0 = 0x20, - .idVendor = 0x12ba, - .idProduct = 0x04a0, - .bcdDevice = 0x0108, - .iManufacturer = 0x01, - .iProduct = 0x02, - .iSerialNumber = 0x03, + UsbDeviceDescriptor{ + .bcdUSB = 0x0100, + .bDeviceClass = 0x00, + .bDeviceSubClass = 0x00, + .bDeviceProtocol = 0x00, + .bMaxPacketSize0 = 0x20, + .idVendor = 0x12ba, + .idProduct = 0x04a0, + .bcdDevice = 0x0108, + .iManufacturer = 0x01, + .iProduct = 0x02, + .iSerialNumber = 0x03, .bNumConfigurations = 0x01}); auto& config0 = device.add_node(UsbDescriptorNode(USB_DESCRIPTOR_CONFIG, - UsbDeviceConfiguration { - .wTotalLength = 0x0029, - .bNumInterfaces = 0x01, + UsbDeviceConfiguration{ + .wTotalLength = 0x0029, + .bNumInterfaces = 0x01, .bConfigurationValue = 0x01, - .iConfiguration = 0x00, - .bmAttributes = 0x80, - .bMaxPower = 0x32})); + .iConfiguration = 0x00, + .bmAttributes = 0x80, + .bMaxPower = 0x32})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_INTERFACE, - UsbDeviceInterface { - .bInterfaceNumber = 0x00, - .bAlternateSetting = 0x00, - .bNumEndpoints = 0x02, - .bInterfaceClass = 0x03, + UsbDeviceInterface{ + .bInterfaceNumber = 0x00, + .bAlternateSetting = 0x00, + .bNumEndpoints = 0x02, + .bInterfaceClass = 0x03, .bInterfaceSubClass = 0x00, .bInterfaceProtocol = 0x00, - .iInterface = 0x00})); + .iInterface = 0x00})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_HID, - UsbDeviceHID { - .bcdHID = 0x0110, - .bCountryCode = 0x00, - .bNumDescriptors = 0x01, - .bDescriptorType = 0x22, + UsbDeviceHID{ + .bcdHID = 0x0110, + .bCountryCode = 0x00, + .bNumDescriptors = 0x01, + .bDescriptorType = 0x22, .wDescriptorLength = 0x0089})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_ENDPOINT, - UsbDeviceEndpoint { + UsbDeviceEndpoint{ .bEndpointAddress = 0x81, - .bmAttributes = 0x03, - .wMaxPacketSize = 0x0040, - .bInterval = 0x0a})); + .bmAttributes = 0x03, + .wMaxPacketSize = 0x0040, + .bInterval = 0x0a})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_ENDPOINT, - UsbDeviceEndpoint { + UsbDeviceEndpoint{ .bEndpointAddress = 0x02, - .bmAttributes = 0x03, - .wMaxPacketSize = 0x0040, - .bInterval = 0x0a})); + .bmAttributes = 0x03, + .wMaxPacketSize = 0x0040, + .bInterval = 0x0a})); add_string("GuitarHero for Playstation (R) 3"); add_string("GuitarHero for Playstation (R) 3"); @@ -177,10 +175,10 @@ usb_device_topshotelite::~usb_device_topshotelite() void usb_device_topshotelite::control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 wLength, u32 buf_size, u8* buf, UsbTransfer* transfer) { - transfer->fake = true; - transfer->expected_count = buf_size; + transfer->fake = true; + transfer->expected_count = buf_size; transfer->expected_result = HC_CC_NOERR; - transfer->expected_time = get_timestamp() + 100; + transfer->expected_time = get_timestamp() + 100; switch (bmRequestType) { @@ -391,9 +389,9 @@ void usb_device_topshotelite::interrupt_transfer(u32 buf_size, u8* buf, u32 /*en set_sensor_pos(&ts, led_lx, led_ly, led_rx, led_ry, detect_l, detect_r); - #if TSE_CALIB_LOG - topshotelite_log.error("L: %d x %d, R: %d x %d", led_lx + TSE_CALIB_DIST, led_ly, led_rx - TSE_CALIB_DIST, led_ry); - #endif +#if TSE_CALIB_LOG + topshotelite_log.error("L: %d x %d, R: %d x %d", led_lx + TSE_CALIB_DIST, led_ly, led_rx - TSE_CALIB_DIST, led_ry); +#endif } prepare_data(&ts, buf); diff --git a/rpcs3/rpcs3/Emu/Io/TopShotFearmaster.cpp b/rpcs3/rpcs3/Emu/Io/TopShotFearmaster.cpp index 98b54700d..d2c3e0962 100644 --- a/rpcs3/rpcs3/Emu/Io/TopShotFearmaster.cpp +++ b/rpcs3/rpcs3/Emu/Io/TopShotFearmaster.cpp @@ -12,40 +12,40 @@ LOG_CHANNEL(topshotfearmaster_log); #define TSF_CALIB_LOG false // 0 < Calib_Top < Calib_Bottom < 0x2ff // 0 < Calib_Right < Calib_Left < 0x3ff -constexpr u16 TSF_CALIB_TOP = 20; +constexpr u16 TSF_CALIB_TOP = 20; constexpr u16 TSF_CALIB_BOTTOM = 840; -constexpr u16 TSF_CALIB_LEFT = 900; -constexpr u16 TSF_CALIB_RIGHT = 120; -constexpr u16 TSF_CALIB_DIST = 95; +constexpr u16 TSF_CALIB_LEFT = 900; +constexpr u16 TSF_CALIB_RIGHT = 120; +constexpr u16 TSF_CALIB_DIST = 95; template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](topshotfearmaster_btn value) - { - switch (value) { - case topshotfearmaster_btn::trigger: return "Trigger"; - case topshotfearmaster_btn::heartrate: return "Heartrate"; - case topshotfearmaster_btn::square: return "Square"; - case topshotfearmaster_btn::cross: return "Cross"; - case topshotfearmaster_btn::circle: return "Circle"; - case topshotfearmaster_btn::triangle: return "Triangle"; - case topshotfearmaster_btn::select: return "Select"; - case topshotfearmaster_btn::start: return "Start"; - case topshotfearmaster_btn::l3: return "L3"; - case topshotfearmaster_btn::ps: return "PS"; - case topshotfearmaster_btn::dpad_up: return "D-Pad Up"; - case topshotfearmaster_btn::dpad_down: return "D-Pad Down"; - case topshotfearmaster_btn::dpad_left: return "D-Pad Left"; - case topshotfearmaster_btn::dpad_right: return "D-Pad Right"; - case topshotfearmaster_btn::ls_x: return "Left Stick X-Axis"; - case topshotfearmaster_btn::ls_y: return "Left Stick Y-Axis"; - case topshotfearmaster_btn::count: return "Count"; - } + switch (value) + { + case topshotfearmaster_btn::trigger: return "Trigger"; + case topshotfearmaster_btn::heartrate: return "Heartrate"; + case topshotfearmaster_btn::square: return "Square"; + case topshotfearmaster_btn::cross: return "Cross"; + case topshotfearmaster_btn::circle: return "Circle"; + case topshotfearmaster_btn::triangle: return "Triangle"; + case topshotfearmaster_btn::select: return "Select"; + case topshotfearmaster_btn::start: return "Start"; + case topshotfearmaster_btn::l3: return "L3"; + case topshotfearmaster_btn::ps: return "PS"; + case topshotfearmaster_btn::dpad_up: return "D-Pad Up"; + case topshotfearmaster_btn::dpad_down: return "D-Pad Down"; + case topshotfearmaster_btn::dpad_left: return "D-Pad Left"; + case topshotfearmaster_btn::dpad_right: return "D-Pad Right"; + case topshotfearmaster_btn::ls_x: return "Left Stick X-Axis"; + case topshotfearmaster_btn::ls_y: return "Left Stick Y-Axis"; + case topshotfearmaster_btn::count: return "Count"; + } - return unknown; - }); + return unknown; + }); } #pragma pack(push, 1) @@ -56,14 +56,14 @@ struct TopShotFearmaster_data uint8_t btn_circle : 1; uint8_t btn_triangle : 1; uint8_t : 1; - uint8_t btn_trigger: 1; + uint8_t btn_trigger : 1; uint8_t : 2; uint8_t btn_select : 1; uint8_t btn_start : 1; uint8_t btn_l3 : 1; uint8_t btn_heartrate : 1; - uint8_t btn_ps: 1; + uint8_t btn_ps : 1; uint8_t : 3; uint8_t dpad; @@ -116,60 +116,58 @@ enum }; usb_device_topshotfearmaster::usb_device_topshotfearmaster(u32 controller_index, const std::array& location) - : usb_device_emulated(location) - , m_controller_index(controller_index) - , m_mode(0) + : usb_device_emulated(location), m_controller_index(controller_index), m_mode(0) { device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, - UsbDeviceDescriptor { - .bcdUSB = 0x0100, - .bDeviceClass = 0x00, - .bDeviceSubClass = 0x00, - .bDeviceProtocol = 0x00, - .bMaxPacketSize0 = 0x20, - .idVendor = 0x12ba, - .idProduct = 0x04a1, - .bcdDevice = 0x0108, - .iManufacturer = 0x01, - .iProduct = 0x02, - .iSerialNumber = 0x03, + UsbDeviceDescriptor{ + .bcdUSB = 0x0100, + .bDeviceClass = 0x00, + .bDeviceSubClass = 0x00, + .bDeviceProtocol = 0x00, + .bMaxPacketSize0 = 0x20, + .idVendor = 0x12ba, + .idProduct = 0x04a1, + .bcdDevice = 0x0108, + .iManufacturer = 0x01, + .iProduct = 0x02, + .iSerialNumber = 0x03, .bNumConfigurations = 0x01}); auto& config0 = device.add_node(UsbDescriptorNode(USB_DESCRIPTOR_CONFIG, - UsbDeviceConfiguration { - .wTotalLength = 0x0029, - .bNumInterfaces = 0x01, + UsbDeviceConfiguration{ + .wTotalLength = 0x0029, + .bNumInterfaces = 0x01, .bConfigurationValue = 0x01, - .iConfiguration = 0x00, - .bmAttributes = 0x80, - .bMaxPower = 0x32})); + .iConfiguration = 0x00, + .bmAttributes = 0x80, + .bMaxPower = 0x32})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_INTERFACE, - UsbDeviceInterface { - .bInterfaceNumber = 0x00, - .bAlternateSetting = 0x00, - .bNumEndpoints = 0x02, - .bInterfaceClass = 0x03, + UsbDeviceInterface{ + .bInterfaceNumber = 0x00, + .bAlternateSetting = 0x00, + .bNumEndpoints = 0x02, + .bInterfaceClass = 0x03, .bInterfaceSubClass = 0x00, .bInterfaceProtocol = 0x00, - .iInterface = 0x00})); + .iInterface = 0x00})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_HID, - UsbDeviceHID { - .bcdHID = 0x0110, - .bCountryCode = 0x00, - .bNumDescriptors = 0x01, - .bDescriptorType = 0x22, + UsbDeviceHID{ + .bcdHID = 0x0110, + .bCountryCode = 0x00, + .bNumDescriptors = 0x01, + .bDescriptorType = 0x22, .wDescriptorLength = 0x0089})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_ENDPOINT, - UsbDeviceEndpoint { + UsbDeviceEndpoint{ .bEndpointAddress = 0x81, - .bmAttributes = 0x03, - .wMaxPacketSize = 0x0040, - .bInterval = 0x0a})); + .bmAttributes = 0x03, + .wMaxPacketSize = 0x0040, + .bInterval = 0x0a})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_ENDPOINT, - UsbDeviceEndpoint { + UsbDeviceEndpoint{ .bEndpointAddress = 0x02, - .bmAttributes = 0x03, - .wMaxPacketSize = 0x0040, - .bInterval = 0x0a})); + .bmAttributes = 0x03, + .wMaxPacketSize = 0x0040, + .bInterval = 0x0a})); add_string("Dangerous Hunts for Playstation (R) 3"); add_string("Dangerous Hunts for Playstation (R) 3"); @@ -181,10 +179,10 @@ usb_device_topshotfearmaster::~usb_device_topshotfearmaster() void usb_device_topshotfearmaster::control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 wLength, u32 buf_size, u8* buf, UsbTransfer* transfer) { - transfer->fake = true; - transfer->expected_count = buf_size; + transfer->fake = true; + transfer->expected_count = buf_size; transfer->expected_result = HC_CC_NOERR; - transfer->expected_time = get_timestamp() + 100; + transfer->expected_time = get_timestamp() + 100; switch (bmRequestType) { @@ -416,9 +414,9 @@ void usb_device_topshotfearmaster::interrupt_transfer(u32 buf_size, u8* buf, u32 set_sensor_pos(&ts, led_lx, led_ly, led_rx, led_ry, detect_l, detect_r); - #if TSF_CALIB_LOG - topshotfearmaster_log.error("L: %d x %d, R: %d x %d", led_lx + TSF_CALIB_DIST, led_ly, led_rx - TSF_CALIB_DIST, led_ry); - #endif +#if TSF_CALIB_LOG + topshotfearmaster_log.error("L: %d x %d, R: %d x %d", led_lx + TSF_CALIB_DIST, led_ly, led_rx - TSF_CALIB_DIST, led_ry); +#endif } prepare_data(&ts, buf); diff --git a/rpcs3/rpcs3/Emu/Io/TopShotFearmaster.h b/rpcs3/rpcs3/Emu/Io/TopShotFearmaster.h index 7243fb5ef..dee955cd7 100644 --- a/rpcs3/rpcs3/Emu/Io/TopShotFearmaster.h +++ b/rpcs3/rpcs3/Emu/Io/TopShotFearmaster.h @@ -2,7 +2,7 @@ #include "Emu/Io/usb_device.h" -class usb_device_topshotfearmaster: public usb_device_emulated +class usb_device_topshotfearmaster : public usb_device_emulated { public: usb_device_topshotfearmaster(u32 controller_index, const std::array& location); diff --git a/rpcs3/rpcs3/Emu/Io/Turntable.cpp b/rpcs3/rpcs3/Emu/Io/Turntable.cpp index eca192682..b85666ea2 100644 --- a/rpcs3/rpcs3/Emu/Io/Turntable.cpp +++ b/rpcs3/rpcs3/Emu/Io/Turntable.cpp @@ -13,36 +13,36 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](turntable_btn value) - { - switch (value) { - case turntable_btn::blue: return "Blue"; - case turntable_btn::green: return "Green"; - case turntable_btn::red: return "Red"; - case turntable_btn::dpad_up: return "D-Pad Up"; - case turntable_btn::dpad_down: return "D-Pad Down"; - case turntable_btn::dpad_left: return "D-Pad Left"; - case turntable_btn::dpad_right: return "D-Pad Right"; - case turntable_btn::start: return "Start"; - case turntable_btn::select: return "Select"; - case turntable_btn::square: return "Square"; - case turntable_btn::circle: return "Circle"; - case turntable_btn::cross: return "Cross"; - case turntable_btn::triangle: return "Triangle"; - case turntable_btn::right_turntable: return "Right Turntable"; - case turntable_btn::crossfader: return "Crossfader"; - case turntable_btn::effects_dial: return "Effects Dial"; - case turntable_btn::count: return "Count"; - } + switch (value) + { + case turntable_btn::blue: return "Blue"; + case turntable_btn::green: return "Green"; + case turntable_btn::red: return "Red"; + case turntable_btn::dpad_up: return "D-Pad Up"; + case turntable_btn::dpad_down: return "D-Pad Down"; + case turntable_btn::dpad_left: return "D-Pad Left"; + case turntable_btn::dpad_right: return "D-Pad Right"; + case turntable_btn::start: return "Start"; + case turntable_btn::select: return "Select"; + case turntable_btn::square: return "Square"; + case turntable_btn::circle: return "Circle"; + case turntable_btn::cross: return "Cross"; + case turntable_btn::triangle: return "Triangle"; + case turntable_btn::right_turntable: return "Right Turntable"; + case turntable_btn::crossfader: return "Crossfader"; + case turntable_btn::effects_dial: return "Effects Dial"; + case turntable_btn::count: return "Count"; + } - return unknown; - }); + return unknown; + }); } usb_device_turntable::usb_device_turntable(u32 controller_index, const std::array& location) : usb_device_emulated(location), m_controller_index(controller_index) { - device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, UsbDeviceDescriptor{0x0100, 0x00, 0x00, 0x00, 0x40, 0x12BA, 0x0140, 0x0005, 0x01, 0x02, 0x00, 0x01}); + device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, UsbDeviceDescriptor{0x0100, 0x00, 0x00, 0x00, 0x40, 0x12BA, 0x0140, 0x0005, 0x01, 0x02, 0x00, 0x01}); auto& config0 = device.add_node(UsbDescriptorNode(USB_DESCRIPTOR_CONFIG, UsbDeviceConfiguration{0x0029, 0x01, 0x01, 0x00, 0x80, 0x19})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_INTERFACE, UsbDeviceInterface{0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_HID, UsbDeviceHID{0x0110, 0x00, 0x01, 0x22, 0x0089})); @@ -71,20 +71,20 @@ void usb_device_turntable::control_transfer(u8 bmRequestType, u8 bRequest, u16 w // Control transfers are nearly instant switch (bmRequestType) { - case 0x21: - switch (bRequest) - { - case 0x09: - // Do nothing here - not sure what it should do. - break; - default: - turntable_log.error("Unhandled Query: buf_size=0x%02X, Type=0x%02X, bRequest=0x%02X, bmRequestType=0x%02X", buf_size, (buf_size > 0) ? buf[0] : -1, bRequest, bmRequestType); - break; - } + case 0x21: + switch (bRequest) + { + case 0x09: + // Do nothing here - not sure what it should do. break; default: - usb_device_emulated::control_transfer(bmRequestType, bRequest, wValue, wIndex, wLength, buf_size, buf, transfer); + turntable_log.error("Unhandled Query: buf_size=0x%02X, Type=0x%02X, bRequest=0x%02X, bmRequestType=0x%02X", buf_size, (buf_size > 0) ? buf[0] : -1, bRequest, bmRequestType); break; + } + break; + default: + usb_device_emulated::control_transfer(bmRequestType, bRequest, wValue, wIndex, wLength, buf_size, buf, transfer); + break; } } @@ -92,8 +92,8 @@ void usb_device_turntable::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endpo { ensure(buf_size >= 27); - transfer->fake = true; - transfer->expected_count = buf_size; + transfer->fake = true; + transfer->expected_count = buf_size; transfer->expected_result = HC_CC_NOERR; // Turntable runs at 100hz --> 10ms // But make the emulated table go at 1ms for better input behavior @@ -134,9 +134,9 @@ void usb_device_turntable::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endpo // The following bytes are NOTed (set to 0xFF) when active. // If multiple buttons are pressed for one byte, the byte is NOTed twice (reset to 0x00). - buf[7] = 0x00; // Square Button / D-Pad Right - buf[8] = 0x00; // D-Pad Left - buf[9] = 0x00; // Cross Button / D-Pad Up + buf[7] = 0x00; // Square Button / D-Pad Right + buf[8] = 0x00; // D-Pad Left + buf[9] = 0x00; // Cross Button / D-Pad Up buf[10] = 0x00; // D-Pad Down buf[11] = 0x00; // Triangle / Euphoria Button buf[12] = 0x00; // Circle Button @@ -163,8 +163,8 @@ void usb_device_turntable::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endpo std::lock_guard lock(pad::g_pad_mutex); const auto handler = pad::get_pad_thread(); - const auto& pads = handler->GetPads(); - const auto& pad = ::at32(pads, m_controller_index); + const auto& pads = handler->GetPads(); + const auto& pad = ::at32(pads, m_controller_index); if (!(pad->m_port_status & CELL_PAD_STATUS_CONNECTED)) return; @@ -278,7 +278,7 @@ void usb_device_turntable::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endpo // DJ Hero does not register input if the turntable is 0, so force it to 1. buf[6] = std::max(1, 255 - value); // Right Turntable // DJ Hero requires turntables to be centered at 128. - // If this axis ends up centered at 127, force it to 128. + // If this axis ends up centered at 127, force it to 128. if (buf[6] == 127) { buf[6] = 128; diff --git a/rpcs3/rpcs3/Emu/Io/buzz_config.h b/rpcs3/rpcs3/Emu/Io/buzz_config.h index f340ecd70..3012a7b99 100644 --- a/rpcs3/rpcs3/Emu/Io/buzz_config.h +++ b/rpcs3/rpcs3/Emu/Io/buzz_config.h @@ -17,11 +17,11 @@ struct cfg_buzzer final : public emulated_pad_config { cfg_buzzer(node* owner, const std::string& name) : emulated_pad_config(owner, name) {} - cfg_pad_btn red{ this, "Red", buzz_btn::red, pad_button::R1 }; - cfg_pad_btn yellow{ this, "Yellow", buzz_btn::yellow, pad_button::cross }; - cfg_pad_btn green{ this, "Green", buzz_btn::green, pad_button::circle }; - cfg_pad_btn orange{ this, "Orange", buzz_btn::orange, pad_button::square }; - cfg_pad_btn blue{ this, "Blue", buzz_btn::blue, pad_button::triangle }; + cfg_pad_btn red{this, "Red", buzz_btn::red, pad_button::R1}; + cfg_pad_btn yellow{this, "Yellow", buzz_btn::yellow, pad_button::cross}; + cfg_pad_btn green{this, "Green", buzz_btn::green, pad_button::circle}; + cfg_pad_btn orange{this, "Orange", buzz_btn::orange, pad_button::square}; + cfg_pad_btn blue{this, "Blue", buzz_btn::blue, pad_button::triangle}; }; struct cfg_buzz final : public emulated_pads_config diff --git a/rpcs3/rpcs3/Emu/Io/camera_config.cpp b/rpcs3/rpcs3/Emu/Io/camera_config.cpp index d7071b05c..074bd8ad6 100644 --- a/rpcs3/rpcs3/Emu/Io/camera_config.cpp +++ b/rpcs3/rpcs3/Emu/Io/camera_config.cpp @@ -7,8 +7,7 @@ LOG_CHANNEL(camera_log, "Camera"); cfg_camera g_cfg_camera; cfg_camera::cfg_camera() - : cfg::node() - , path(fs::get_config_dir(true) + "camera.yml") + : cfg::node(), path(fs::get_config_dir(true) + "camera.yml") { } @@ -16,7 +15,7 @@ bool cfg_camera::load() { camera_log.notice("Loading camera config from '%s'", path); - if (fs::file cfg_file{ path, fs::read }) + if (fs::file cfg_file{path, fs::read}) { return from_string(cfg_file.to_string()); } @@ -71,7 +70,7 @@ void cfg_camera::camera_setting::from_string(const std::string& text) return; } - const std::vector list = fmt::split(text, { "," }); + const std::vector list = fmt::split(text, {","}); if (list.size() != member_count) { diff --git a/rpcs3/rpcs3/Emu/Io/camera_config.h b/rpcs3/rpcs3/Emu/Io/camera_config.h index a918dea45..238db5622 100644 --- a/rpcs3/rpcs3/Emu/Io/camera_config.h +++ b/rpcs3/rpcs3/Emu/Io/camera_config.h @@ -26,7 +26,7 @@ struct cfg_camera final : cfg::node const std::string path; - cfg::map_entry cameras{ this, "Cameras" }; // : ,,,, + cfg::map_entry cameras{this, "Cameras"}; // : ,,,, }; extern cfg_camera g_cfg_camera; diff --git a/rpcs3/rpcs3/Emu/Io/camera_handler_base.h b/rpcs3/rpcs3/Emu/Io/camera_handler_base.h index 49ce4dc63..54c493f29 100644 --- a/rpcs3/rpcs3/Emu/Io/camera_handler_base.h +++ b/rpcs3/rpcs3/Emu/Io/camera_handler_base.h @@ -30,18 +30,48 @@ public: virtual u64 frame_number() const = 0; // Convenience function to check if there's a new frame. virtual camera_handler_state get_image(u8* buf, u64 size, u32& width, u32& height, u64& frame_number, u64& bytes_read) = 0; - camera_handler_state get_state() const { return m_state.load(); } - void set_state(camera_handler_state state) { m_state = m_state_expected = state; } + camera_handler_state get_state() const + { + return m_state.load(); + } + void set_state(camera_handler_state state) + { + m_state = m_state_expected = state; + } - camera_handler_state get_expected_state() const { return m_state_expected.load(); } - void set_expected_state(camera_handler_state state) { m_state_expected = state; } + camera_handler_state get_expected_state() const + { + return m_state_expected.load(); + } + void set_expected_state(camera_handler_state state) + { + m_state_expected = state; + } - bool mirrored() const { return m_mirrored; } - s32 format() const { return m_format; } - u32 bytesize() const { return m_bytesize; } - u32 width() const { return m_width; } - u32 height() const { return m_height; } - u32 frame_rate() const { return m_frame_rate; } + bool mirrored() const + { + return m_mirrored; + } + s32 format() const + { + return m_format; + } + u32 bytesize() const + { + return m_bytesize; + } + u32 width() const + { + return m_width; + } + u32 height() const + { + return m_height; + } + u32 frame_rate() const + { + return m_frame_rate; + } protected: std::mutex m_mutex; diff --git a/rpcs3/rpcs3/Emu/Io/emulated_pad_config.h b/rpcs3/rpcs3/Emu/Io/emulated_pad_config.h index e2b46d3da..4b44e0080 100644 --- a/rpcs3/rpcs3/Emu/Io/emulated_pad_config.h +++ b/rpcs3/rpcs3/Emu/Io/emulated_pad_config.h @@ -17,9 +17,7 @@ class cfg_pad_btn : public cfg::_enum { public: cfg_pad_btn(cfg::node* owner, const std::string& name, T id, pad_button value, bool dynamic = false) - : cfg::_enum(owner, name, value, dynamic) - , m_btn_id(id) - {}; + : cfg::_enum(owner, name, value, dynamic), m_btn_id(id) {}; T btn_id() const { @@ -152,7 +150,8 @@ protected: void init_button(cfg_pad_btn* pbtn) { - if (!pbtn) return; + if (!pbtn) + return; const u32 offset = pad_button_offset(pbtn->get()); const u32 keycode = pad_button_keycode(pbtn->get()); button_map[offset][keycode].insert(std::as_const(pbtn)); @@ -206,7 +205,8 @@ protected: if (btn && func) { func(btn->btn_id(), btn->get(), value, pressed, abort); - if (abort) break; + if (abort) + break; } } @@ -245,7 +245,7 @@ struct emulated_pads_config : cfg::node player->clear_buttons(); } - if (fs::file cfg_file{ cfg_name, fs::read }) + if (fs::file cfg_file{cfg_name, fs::read}) { if (const std::string content = cfg_file.to_string(); !content.empty()) { diff --git a/rpcs3/rpcs3/Emu/Io/gem_config.h b/rpcs3/rpcs3/Emu/Io/gem_config.h index 9cfca88dd..4709703c2 100644 --- a/rpcs3/rpcs3/Emu/Io/gem_config.h +++ b/rpcs3/rpcs3/Emu/Io/gem_config.h @@ -34,16 +34,16 @@ struct cfg_fake_gem final : public emulated_pad_config { cfg_fake_gem(node* owner, const std::string& name) : emulated_pad_config(owner, name) {} - cfg_pad_btn start{ this, "Start", gem_btn::start, pad_button::start }; - cfg_pad_btn select{ this, "Select", gem_btn::select, pad_button::select }; - cfg_pad_btn triangle{ this, "Triangle", gem_btn::triangle, pad_button::triangle }; - cfg_pad_btn circle{ this, "Circle", gem_btn::circle, pad_button::circle }; - cfg_pad_btn cross{ this, "Cross", gem_btn::cross, pad_button::cross }; - cfg_pad_btn square{ this, "Square", gem_btn::square, pad_button::square }; - cfg_pad_btn move{ this, "Move", gem_btn::move, pad_button::R1 }; - cfg_pad_btn t{ this, "T", gem_btn::t, pad_button::R2 }; - cfg_pad_btn x_axis{ this, "X-Axis", gem_btn::x_axis, pad_button::ls_x }; - cfg_pad_btn y_axis{ this, "Y-Axis", gem_btn::y_axis, pad_button::ls_y }; + cfg_pad_btn start{this, "Start", gem_btn::start, pad_button::start}; + cfg_pad_btn select{this, "Select", gem_btn::select, pad_button::select}; + cfg_pad_btn triangle{this, "Triangle", gem_btn::triangle, pad_button::triangle}; + cfg_pad_btn circle{this, "Circle", gem_btn::circle, pad_button::circle}; + cfg_pad_btn cross{this, "Cross", gem_btn::cross, pad_button::cross}; + cfg_pad_btn square{this, "Square", gem_btn::square, pad_button::square}; + cfg_pad_btn move{this, "Move", gem_btn::move, pad_button::R1}; + cfg_pad_btn t{this, "T", gem_btn::t, pad_button::R2}; + cfg_pad_btn x_axis{this, "X-Axis", gem_btn::x_axis, pad_button::ls_x}; + cfg_pad_btn y_axis{this, "Y-Axis", gem_btn::y_axis, pad_button::ls_y}; }; struct cfg_fake_gems final : public emulated_pads_config @@ -55,23 +55,23 @@ struct cfg_mouse_gem final : public emulated_pad_config { cfg_mouse_gem(node* owner, const std::string& name) : emulated_pad_config(owner, name) {} - cfg_pad_btn start{ this, "Start", gem_btn::start, pad_button::mouse_button_6 }; - cfg_pad_btn select{ this, "Select", gem_btn::select, pad_button::mouse_button_7 }; - cfg_pad_btn triangle{ this, "Triangle", gem_btn::triangle, pad_button::mouse_button_8 }; - cfg_pad_btn circle{ this, "Circle", gem_btn::circle, pad_button::mouse_button_4 }; - cfg_pad_btn cross{ this, "Cross", gem_btn::cross, pad_button::mouse_button_5 }; - cfg_pad_btn square{ this, "Square", gem_btn::square, pad_button::mouse_button_3 }; - cfg_pad_btn move{ this, "Move", gem_btn::move, pad_button::mouse_button_2 }; - cfg_pad_btn t{ this, "T", gem_btn::t, pad_button::mouse_button_1 }; - cfg_pad_btn combo{ this, "Combo", gem_btn::combo, pad_button::pad_button_max_enum }; - cfg_pad_btn combo_start{ this, "Combo Start", gem_btn::combo_start, pad_button::pad_button_max_enum }; - cfg_pad_btn combo_select{ this, "Combo Select", gem_btn::combo_select, pad_button::pad_button_max_enum }; - cfg_pad_btn combo_triangle{ this, "Combo Triangle", gem_btn::combo_triangle, pad_button::pad_button_max_enum }; - cfg_pad_btn combo_circle{ this, "Combo Circle", gem_btn::combo_circle, pad_button::pad_button_max_enum }; - cfg_pad_btn combo_cross{ this, "Combo Cross", gem_btn::combo_cross, pad_button::pad_button_max_enum }; - cfg_pad_btn combo_square{ this, "Combo Square", gem_btn::combo_square, pad_button::pad_button_max_enum }; - cfg_pad_btn combo_move{ this, "Combo Move", gem_btn::combo_move, pad_button::pad_button_max_enum }; - cfg_pad_btn combo_t{ this, "Combo T", gem_btn::combo_t, pad_button::pad_button_max_enum }; + cfg_pad_btn start{this, "Start", gem_btn::start, pad_button::mouse_button_6}; + cfg_pad_btn select{this, "Select", gem_btn::select, pad_button::mouse_button_7}; + cfg_pad_btn triangle{this, "Triangle", gem_btn::triangle, pad_button::mouse_button_8}; + cfg_pad_btn circle{this, "Circle", gem_btn::circle, pad_button::mouse_button_4}; + cfg_pad_btn cross{this, "Cross", gem_btn::cross, pad_button::mouse_button_5}; + cfg_pad_btn square{this, "Square", gem_btn::square, pad_button::mouse_button_3}; + cfg_pad_btn move{this, "Move", gem_btn::move, pad_button::mouse_button_2}; + cfg_pad_btn t{this, "T", gem_btn::t, pad_button::mouse_button_1}; + cfg_pad_btn combo{this, "Combo", gem_btn::combo, pad_button::pad_button_max_enum}; + cfg_pad_btn combo_start{this, "Combo Start", gem_btn::combo_start, pad_button::pad_button_max_enum}; + cfg_pad_btn combo_select{this, "Combo Select", gem_btn::combo_select, pad_button::pad_button_max_enum}; + cfg_pad_btn combo_triangle{this, "Combo Triangle", gem_btn::combo_triangle, pad_button::pad_button_max_enum}; + cfg_pad_btn combo_circle{this, "Combo Circle", gem_btn::combo_circle, pad_button::pad_button_max_enum}; + cfg_pad_btn combo_cross{this, "Combo Cross", gem_btn::combo_cross, pad_button::pad_button_max_enum}; + cfg_pad_btn combo_square{this, "Combo Square", gem_btn::combo_square, pad_button::pad_button_max_enum}; + cfg_pad_btn combo_move{this, "Combo Move", gem_btn::combo_move, pad_button::pad_button_max_enum}; + cfg_pad_btn combo_t{this, "Combo T", gem_btn::combo_t, pad_button::pad_button_max_enum}; }; struct cfg_mouse_gems final : public emulated_pads_config @@ -83,14 +83,14 @@ struct cfg_gem final : public emulated_pad_config { cfg_gem(node* owner, const std::string& name) : emulated_pad_config(owner, name) {} - cfg_pad_btn start{ this, "Start", gem_btn::start, pad_button::start }; - cfg_pad_btn select{ this, "Select", gem_btn::select, pad_button::select }; - cfg_pad_btn triangle{ this, "Triangle", gem_btn::triangle, pad_button::triangle }; - cfg_pad_btn circle{ this, "Circle", gem_btn::circle, pad_button::circle }; - cfg_pad_btn cross{ this, "Cross", gem_btn::cross, pad_button::cross }; - cfg_pad_btn square{ this, "Square", gem_btn::square, pad_button::square }; - cfg_pad_btn move{ this, "Move", gem_btn::move, pad_button::R1 }; - cfg_pad_btn t{ this, "T", gem_btn::t, pad_button::R2 }; + cfg_pad_btn start{this, "Start", gem_btn::start, pad_button::start}; + cfg_pad_btn select{this, "Select", gem_btn::select, pad_button::select}; + cfg_pad_btn triangle{this, "Triangle", gem_btn::triangle, pad_button::triangle}; + cfg_pad_btn circle{this, "Circle", gem_btn::circle, pad_button::circle}; + cfg_pad_btn cross{this, "Cross", gem_btn::cross, pad_button::cross}; + cfg_pad_btn square{this, "Square", gem_btn::square, pad_button::square}; + cfg_pad_btn move{this, "Move", gem_btn::move, pad_button::R1}; + cfg_pad_btn t{this, "T", gem_btn::t, pad_button::R2}; }; struct cfg_gems final : public emulated_pads_config diff --git a/rpcs3/rpcs3/Emu/Io/ghltar_config.h b/rpcs3/rpcs3/Emu/Io/ghltar_config.h index dfe43ea2c..302eda75e 100644 --- a/rpcs3/rpcs3/Emu/Io/ghltar_config.h +++ b/rpcs3/rpcs3/Emu/Io/ghltar_config.h @@ -27,21 +27,21 @@ struct cfg_ghltar final : public emulated_pad_config { cfg_ghltar(node* owner, const std::string& name) : emulated_pad_config(owner, name) {} - cfg_pad_btn w1{ this, "W1", ghltar_btn::w1, pad_button::square }; - cfg_pad_btn w2{ this, "W2", ghltar_btn::w2, pad_button::L1 }; - cfg_pad_btn w3{ this, "W3", ghltar_btn::w3, pad_button::R1 }; - cfg_pad_btn b1{ this, "B1", ghltar_btn::b1, pad_button::cross }; - cfg_pad_btn b2{ this, "B2", ghltar_btn::b2, pad_button::circle }; - cfg_pad_btn b3{ this, "B3", ghltar_btn::b3, pad_button::triangle }; - cfg_pad_btn start{ this, "Start", ghltar_btn::start, pad_button::start }; - cfg_pad_btn hero_power{ this, "Hero Power", ghltar_btn::hero_power, pad_button::select }; - cfg_pad_btn ghtv{ this, "GHTV", ghltar_btn::ghtv, pad_button::L3 }; - cfg_pad_btn strum_down{ this, "Strum Down", ghltar_btn::strum_down, pad_button::dpad_down }; - cfg_pad_btn strum_up{ this, "Strum Up", ghltar_btn::strum_up, pad_button::dpad_up }; - cfg_pad_btn dpad_left{ this, "D-Pad Left", ghltar_btn::dpad_left, pad_button::dpad_left }; - cfg_pad_btn dpad_right{ this, "D-Pad Right", ghltar_btn::dpad_right, pad_button::dpad_right }; - cfg_pad_btn whammy{ this, "Whammy", ghltar_btn::whammy, pad_button::rs_y }; - cfg_pad_btn tilt{ this, "tilt", ghltar_btn::tilt, pad_button::rs_x }; + cfg_pad_btn w1{this, "W1", ghltar_btn::w1, pad_button::square}; + cfg_pad_btn w2{this, "W2", ghltar_btn::w2, pad_button::L1}; + cfg_pad_btn w3{this, "W3", ghltar_btn::w3, pad_button::R1}; + cfg_pad_btn b1{this, "B1", ghltar_btn::b1, pad_button::cross}; + cfg_pad_btn b2{this, "B2", ghltar_btn::b2, pad_button::circle}; + cfg_pad_btn b3{this, "B3", ghltar_btn::b3, pad_button::triangle}; + cfg_pad_btn start{this, "Start", ghltar_btn::start, pad_button::start}; + cfg_pad_btn hero_power{this, "Hero Power", ghltar_btn::hero_power, pad_button::select}; + cfg_pad_btn ghtv{this, "GHTV", ghltar_btn::ghtv, pad_button::L3}; + cfg_pad_btn strum_down{this, "Strum Down", ghltar_btn::strum_down, pad_button::dpad_down}; + cfg_pad_btn strum_up{this, "Strum Up", ghltar_btn::strum_up, pad_button::dpad_up}; + cfg_pad_btn dpad_left{this, "D-Pad Left", ghltar_btn::dpad_left, pad_button::dpad_left}; + cfg_pad_btn dpad_right{this, "D-Pad Right", ghltar_btn::dpad_right, pad_button::dpad_right}; + cfg_pad_btn whammy{this, "Whammy", ghltar_btn::whammy, pad_button::rs_y}; + cfg_pad_btn tilt{this, "tilt", ghltar_btn::tilt, pad_button::rs_x}; }; struct cfg_ghltars final : public emulated_pads_config diff --git a/rpcs3/rpcs3/Emu/Io/interception.cpp b/rpcs3/rpcs3/Emu/Io/interception.cpp index dab9dbe3e..00c56708a 100644 --- a/rpcs3/rpcs3/Emu/Io/interception.cpp +++ b/rpcs3/rpcs3/Emu/Io/interception.cpp @@ -13,15 +13,15 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](input::active_mouse_and_keyboard value) - { - switch (value) { - case input::active_mouse_and_keyboard::emulated: return "emulated"; - case input::active_mouse_and_keyboard::pad: return "pad"; - } + switch (value) + { + case input::active_mouse_and_keyboard::emulated: return "emulated"; + case input::active_mouse_and_keyboard::pad: return "pad"; + } - return unknown; - }); + return unknown; + }); } namespace input @@ -62,9 +62,7 @@ namespace input if (!g_cfg.misc.show_mouse_and_keyboard_toggle_hint) return; - const localized_string_id id = g_active_mouse_and_keyboard == active_mouse_and_keyboard::emulated - ? localized_string_id::RSX_OVERLAYS_MOUSE_AND_KEYBOARD_EMULATED - : localized_string_id::RSX_OVERLAYS_MOUSE_AND_KEYBOARD_PAD; + const localized_string_id id = g_active_mouse_and_keyboard == active_mouse_and_keyboard::emulated ? localized_string_id::RSX_OVERLAYS_MOUSE_AND_KEYBOARD_EMULATED : localized_string_id::RSX_OVERLAYS_MOUSE_AND_KEYBOARD_PAD; rsx::overlays::queue_message(get_localized_string(id), 3'000'000); } @@ -86,4 +84,4 @@ namespace input input_log.notice("toggle_mouse_and_keyboard: device=%s", g_active_mouse_and_keyboard.load()); show_mouse_and_keyboard_overlay(); } -} +} // namespace input diff --git a/rpcs3/rpcs3/Emu/Io/interception.h b/rpcs3/rpcs3/Emu/Io/interception.h index 16a407b8e..4dc5dbdc9 100644 --- a/rpcs3/rpcs3/Emu/Io/interception.h +++ b/rpcs3/rpcs3/Emu/Io/interception.h @@ -20,4 +20,4 @@ namespace input void set_mouse_and_keyboard(active_mouse_and_keyboard device); void toggle_mouse_and_keyboard(); -} +} // namespace input diff --git a/rpcs3/rpcs3/Emu/Io/midi_config_types.cpp b/rpcs3/rpcs3/Emu/Io/midi_config_types.cpp index abe976ee9..e730f4bf1 100644 --- a/rpcs3/rpcs3/Emu/Io/midi_config_types.cpp +++ b/rpcs3/rpcs3/Emu/Io/midi_config_types.cpp @@ -7,17 +7,17 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](midi_device_type value) - { - switch (value) { - case midi_device_type::guitar: return "Guitar (17 frets)"; - case midi_device_type::guitar_22fret: return "Guitar (22 frets)"; - case midi_device_type::keyboard: return "Keyboard"; - case midi_device_type::drums: return "Drums"; - } + switch (value) + { + case midi_device_type::guitar: return "Guitar (17 frets)"; + case midi_device_type::guitar_22fret: return "Guitar (22 frets)"; + case midi_device_type::keyboard: return "Keyboard"; + case midi_device_type::drums: return "Drums"; + } - return unknown; - }); + return unknown; + }); } template <> diff --git a/rpcs3/rpcs3/Emu/Io/mouse_config.h b/rpcs3/rpcs3/Emu/Io/mouse_config.h index 8b583a95f..219ede29b 100644 --- a/rpcs3/rpcs3/Emu/Io/mouse_config.h +++ b/rpcs3/rpcs3/Emu/Io/mouse_config.h @@ -9,14 +9,14 @@ struct mouse_config final : cfg::node const std::string cfg_name; - cfg::string mouse_button_1{ this, "Button 1", "Mouse Left", true }; - cfg::string mouse_button_2{ this, "Button 2", "Mouse Right", true }; - cfg::string mouse_button_3{ this, "Button 3", "Mouse Middle", true }; - cfg::string mouse_button_4{ this, "Button 4", "", true }; - cfg::string mouse_button_5{ this, "Button 5", "", true }; - cfg::string mouse_button_6{ this, "Button 6", "", true }; - cfg::string mouse_button_7{ this, "Button 7", "", true }; - cfg::string mouse_button_8{ this, "Button 8", "", true }; + cfg::string mouse_button_1{this, "Button 1", "Mouse Left", true}; + cfg::string mouse_button_2{this, "Button 2", "Mouse Right", true}; + cfg::string mouse_button_3{this, "Button 3", "Mouse Middle", true}; + cfg::string mouse_button_4{this, "Button 4", "", true}; + cfg::string mouse_button_5{this, "Button 5", "", true}; + cfg::string mouse_button_6{this, "Button 6", "", true}; + cfg::string mouse_button_7{this, "Button 7", "", true}; + cfg::string mouse_button_8{this, "Button 8", "", true}; atomic_t reload_requested = true; diff --git a/rpcs3/rpcs3/Emu/Io/pad_config.cpp b/rpcs3/rpcs3/Emu/Io/pad_config.cpp index fb0b140ae..67b73445e 100644 --- a/rpcs3/rpcs3/Emu/Io/pad_config.cpp +++ b/rpcs3/rpcs3/Emu/Io/pad_config.cpp @@ -78,7 +78,7 @@ bool cfg_input::load(const std::string& title_id, const std::string& config_file from_default(); - if (fs::file cfg_file{ cfg_name, fs::read }) + if (fs::file cfg_file{cfg_name, fs::read}) { input_log.notice("Loading input configuration: '%s'", cfg_name); @@ -130,7 +130,7 @@ cfg_input_configurations::cfg_input_configurations() bool cfg_input_configurations::load() { - if (fs::file cfg_file{ path, fs::read }) + if (fs::file cfg_file{path, fs::read}) { return from_string(cfg_file.to_string()); } diff --git a/rpcs3/rpcs3/Emu/Io/pad_config.h b/rpcs3/rpcs3/Emu/Io/pad_config.h index 7c39a7941..db62d869a 100644 --- a/rpcs3/rpcs3/Emu/Io/pad_config.h +++ b/rpcs3/rpcs3/Emu/Io/pad_config.h @@ -15,9 +15,9 @@ struct cfg_sensor final : cfg::node { cfg_sensor(node* owner, const std::string& name) : cfg::node(owner, name) {} - cfg::string axis{ this, "Axis", "" }; - cfg::_bool mirrored{ this, "Mirrored", false }; - cfg::_int<-1023, 1023> shift{ this, "Shift", 0 }; + cfg::string axis{this, "Axis", ""}; + cfg::_bool mirrored{this, "Mirrored", false}; + cfg::_int<-1023, 1023> shift{this, "Shift", 0}; }; struct cfg_pad final : cfg::node @@ -31,92 +31,92 @@ struct cfg_pad final : cfg::node u8 get_large_motor_speed(const std::array& motor_speed) const; u8 get_small_motor_speed(const std::array& motor_speed) const; - cfg::string ls_left{ this, "Left Stick Left", "" }; - cfg::string ls_down{ this, "Left Stick Down", "" }; - cfg::string ls_right{ this, "Left Stick Right", "" }; - cfg::string ls_up{ this, "Left Stick Up", "" }; - cfg::string rs_left{ this, "Right Stick Left", "" }; - cfg::string rs_down{ this, "Right Stick Down", "" }; - cfg::string rs_right{ this, "Right Stick Right", "" }; - cfg::string rs_up{ this, "Right Stick Up", "" }; - cfg::string start{ this, "Start", "" }; - cfg::string select{ this, "Select", "" }; - cfg::string ps{ this, "PS Button", "" }; - cfg::string square{ this, "Square", "" }; - cfg::string cross{ this, "Cross", "" }; - cfg::string circle{ this, "Circle", "" }; - cfg::string triangle{ this, "Triangle", "" }; - cfg::string left{ this, "Left", "" }; - cfg::string down{ this, "Down", "" }; - cfg::string right{ this, "Right", "" }; - cfg::string up{ this, "Up", "" }; - cfg::string r1{ this, "R1", "" }; - cfg::string r2{ this, "R2", "" }; - cfg::string r3{ this, "R3", "" }; - cfg::string l1{ this, "L1", "" }; - cfg::string l2{ this, "L2", "" }; - cfg::string l3{ this, "L3", "" }; + cfg::string ls_left{this, "Left Stick Left", ""}; + cfg::string ls_down{this, "Left Stick Down", ""}; + cfg::string ls_right{this, "Left Stick Right", ""}; + cfg::string ls_up{this, "Left Stick Up", ""}; + cfg::string rs_left{this, "Right Stick Left", ""}; + cfg::string rs_down{this, "Right Stick Down", ""}; + cfg::string rs_right{this, "Right Stick Right", ""}; + cfg::string rs_up{this, "Right Stick Up", ""}; + cfg::string start{this, "Start", ""}; + cfg::string select{this, "Select", ""}; + cfg::string ps{this, "PS Button", ""}; + cfg::string square{this, "Square", ""}; + cfg::string cross{this, "Cross", ""}; + cfg::string circle{this, "Circle", ""}; + cfg::string triangle{this, "Triangle", ""}; + cfg::string left{this, "Left", ""}; + cfg::string down{this, "Down", ""}; + cfg::string right{this, "Right", ""}; + cfg::string up{this, "Up", ""}; + cfg::string r1{this, "R1", ""}; + cfg::string r2{this, "R2", ""}; + cfg::string r3{this, "R3", ""}; + cfg::string l1{this, "L1", ""}; + cfg::string l2{this, "L2", ""}; + cfg::string l3{this, "L3", ""}; - cfg::string ir_nose{ this, "IR Nose", "" }; - cfg::string ir_tail{ this, "IR Tail", "" }; - cfg::string ir_left{ this, "IR Left", "" }; - cfg::string ir_right{ this, "IR Right", "" }; - cfg::string tilt_left{ this, "Tilt Left", "" }; - cfg::string tilt_right{ this, "Tilt Right", "" }; + cfg::string ir_nose{this, "IR Nose", ""}; + cfg::string ir_tail{this, "IR Tail", ""}; + cfg::string ir_left{this, "IR Left", ""}; + cfg::string ir_right{this, "IR Right", ""}; + cfg::string tilt_left{this, "Tilt Left", ""}; + cfg::string tilt_right{this, "Tilt Right", ""}; - cfg_sensor motion_sensor_x{ this, "Motion Sensor X" }; - cfg_sensor motion_sensor_y{ this, "Motion Sensor Y" }; - cfg_sensor motion_sensor_z{ this, "Motion Sensor Z" }; - cfg_sensor motion_sensor_g{ this, "Motion Sensor G" }; + cfg_sensor motion_sensor_x{this, "Motion Sensor X"}; + cfg_sensor motion_sensor_y{this, "Motion Sensor Y"}; + cfg_sensor motion_sensor_z{this, "Motion Sensor Z"}; + cfg_sensor motion_sensor_g{this, "Motion Sensor G"}; - cfg::string orientation_reset_button{ this, "Orientation Reset Button", "" }; - cfg::_bool orientation_enabled{ this, "Orientation Enabled", false }; + cfg::string orientation_reset_button{this, "Orientation Reset Button", ""}; + cfg::_bool orientation_enabled{this, "Orientation Enabled", false}; - cfg::string pressure_intensity_button{ this, "Pressure Intensity Button", "" }; - cfg::uint<0, 100> pressure_intensity{ this, "Pressure Intensity Percent", 50 }; - cfg::_bool pressure_intensity_toggle_mode{ this, "Pressure Intensity Toggle Mode", false }; - cfg::uint<0, 255> pressure_intensity_deadzone{ this, "Pressure Intensity Deadzone", 0 }; + cfg::string pressure_intensity_button{this, "Pressure Intensity Button", ""}; + cfg::uint<0, 100> pressure_intensity{this, "Pressure Intensity Percent", 50}; + cfg::_bool pressure_intensity_toggle_mode{this, "Pressure Intensity Toggle Mode", false}; + cfg::uint<0, 255> pressure_intensity_deadzone{this, "Pressure Intensity Deadzone", 0}; - cfg::string analog_limiter_button{ this, "Analog Limiter Button", "" }; - cfg::_bool analog_limiter_toggle_mode{ this, "Analog Limiter Toggle Mode", false }; - cfg::uint<0, 200> lstickmultiplier{ this, "Left Stick Multiplier", 100 }; - cfg::uint<0, 200> rstickmultiplier{ this, "Right Stick Multiplier", 100 }; - cfg::uint<0, 1000000> lstickdeadzone{ this, "Left Stick Deadzone", 0 }; - cfg::uint<0, 1000000> rstickdeadzone{ this, "Right Stick Deadzone", 0 }; - cfg::uint<0, 1000000> lstick_anti_deadzone{ this, "Left Stick Anti-Deadzone", 0 }; - cfg::uint<0, 1000000> rstick_anti_deadzone{ this, "Right Stick Anti-Deadzone", 0 }; - cfg::uint<0, 1000000> ltriggerthreshold{ this, "Left Trigger Threshold", 0 }; - cfg::uint<0, 1000000> rtriggerthreshold{ this, "Right Trigger Threshold", 0 }; - cfg::uint<0, 1000000> lpadsquircling{ this, "Left Pad Squircling Factor", 8000 }; - cfg::uint<0, 1000000> rpadsquircling{ this, "Right Pad Squircling Factor", 8000 }; + cfg::string analog_limiter_button{this, "Analog Limiter Button", ""}; + cfg::_bool analog_limiter_toggle_mode{this, "Analog Limiter Toggle Mode", false}; + cfg::uint<0, 200> lstickmultiplier{this, "Left Stick Multiplier", 100}; + cfg::uint<0, 200> rstickmultiplier{this, "Right Stick Multiplier", 100}; + cfg::uint<0, 1000000> lstickdeadzone{this, "Left Stick Deadzone", 0}; + cfg::uint<0, 1000000> rstickdeadzone{this, "Right Stick Deadzone", 0}; + cfg::uint<0, 1000000> lstick_anti_deadzone{this, "Left Stick Anti-Deadzone", 0}; + cfg::uint<0, 1000000> rstick_anti_deadzone{this, "Right Stick Anti-Deadzone", 0}; + cfg::uint<0, 1000000> ltriggerthreshold{this, "Left Trigger Threshold", 0}; + cfg::uint<0, 1000000> rtriggerthreshold{this, "Right Trigger Threshold", 0}; + cfg::uint<0, 1000000> lpadsquircling{this, "Left Pad Squircling Factor", 8000}; + cfg::uint<0, 1000000> rpadsquircling{this, "Right Pad Squircling Factor", 8000}; - cfg::uint<0, 255> colorR{ this, "Color Value R", 0 }; - cfg::uint<0, 255> colorG{ this, "Color Value G", 0 }; - cfg::uint<0, 255> colorB{ this, "Color Value B", 0 }; + cfg::uint<0, 255> colorR{this, "Color Value R", 0}; + cfg::uint<0, 255> colorG{this, "Color Value G", 0}; + cfg::uint<0, 255> colorB{this, "Color Value B", 0}; - cfg::_bool led_low_battery_blink{ this, "Blink LED when battery is below 20%", true }; - cfg::_bool led_battery_indicator{ this, "Use LED as a battery indicator", false }; - cfg::uint<0, 100> led_battery_indicator_brightness{ this, "LED battery indicator brightness", 50 }; - cfg::_bool player_led_enabled{ this, "Player LED enabled", true }; + cfg::_bool led_low_battery_blink{this, "Blink LED when battery is below 20%", true}; + cfg::_bool led_battery_indicator{this, "Use LED as a battery indicator", false}; + cfg::uint<0, 100> led_battery_indicator_brightness{this, "LED battery indicator brightness", 50}; + cfg::_bool player_led_enabled{this, "Player LED enabled", true}; - cfg::uint<0, 200> multiplier_vibration_motor_large{ this, "Large Vibration Motor Multiplier", 100 }; - cfg::uint<0, 200> multiplier_vibration_motor_small{ this, "Small Vibration Motor Multiplier", 100 }; - cfg::_bool switch_vibration_motors{ this, "Switch Vibration Motors", false }; + cfg::uint<0, 200> multiplier_vibration_motor_large{this, "Large Vibration Motor Multiplier", 100}; + cfg::uint<0, 200> multiplier_vibration_motor_small{this, "Small Vibration Motor Multiplier", 100}; + cfg::_bool switch_vibration_motors{this, "Switch Vibration Motors", false}; - cfg::_enum mouse_move_mode{ this, "Mouse Movement Mode", mouse_movement_mode::relative }; - cfg::uint<0, 255> mouse_deadzone_x{ this, "Mouse Deadzone X Axis", 60 }; - cfg::uint<0, 255> mouse_deadzone_y{ this, "Mouse Deadzone Y Axis", 60 }; - cfg::uint<0, 999999> mouse_acceleration_x{ this, "Mouse Acceleration X Axis", 200 }; - cfg::uint<0, 999999> mouse_acceleration_y{ this, "Mouse Acceleration Y Axis", 250 }; + cfg::_enum mouse_move_mode{this, "Mouse Movement Mode", mouse_movement_mode::relative}; + cfg::uint<0, 255> mouse_deadzone_x{this, "Mouse Deadzone X Axis", 60}; + cfg::uint<0, 255> mouse_deadzone_y{this, "Mouse Deadzone Y Axis", 60}; + cfg::uint<0, 999999> mouse_acceleration_x{this, "Mouse Acceleration X Axis", 200}; + cfg::uint<0, 999999> mouse_acceleration_y{this, "Mouse Acceleration Y Axis", 250}; - cfg::uint<0, 100> l_stick_lerp_factor{ this, "Left Stick Lerp Factor", 100 }; - cfg::uint<0, 100> r_stick_lerp_factor{ this, "Right Stick Lerp Factor", 100 }; - cfg::uint<0, 100> analog_lerp_factor{ this, "Analog Button Lerp Factor", 100 }; - cfg::uint<0, 100> trigger_lerp_factor{ this, "Trigger Lerp Factor", 100 }; + cfg::uint<0, 100> l_stick_lerp_factor{this, "Left Stick Lerp Factor", 100}; + cfg::uint<0, 100> r_stick_lerp_factor{this, "Right Stick Lerp Factor", 100}; + cfg::uint<0, 100> analog_lerp_factor{this, "Analog Button Lerp Factor", 100}; + cfg::uint<0, 100> trigger_lerp_factor{this, "Trigger Lerp Factor", 100}; - cfg::uint device_class_type{ this, "Device Class Type", 0 }; - cfg::uint<0, 65535> vendor_id{ this, "Vendor ID", 0 }; - cfg::uint<0, 65535> product_id{ this, "Product ID", 0 }; + cfg::uint device_class_type{this, "Device Class Type", 0}; + cfg::uint<0, 65535> vendor_id{this, "Vendor ID", 0}; + cfg::uint<0, 65535> product_id{this, "Product ID", 0}; }; struct cfg_player final : cfg::node @@ -124,25 +124,25 @@ struct cfg_player final : cfg::node pad_handler def_handler = pad_handler::null; cfg_player(node* owner, const std::string& name, pad_handler type) : cfg::node(owner, name), def_handler(type) {} - cfg::_enum handler{ this, "Handler", def_handler }; + cfg::_enum handler{this, "Handler", def_handler}; - cfg::string device{ this, "Device", handler.to_string() }; - cfg_pad config{ this, "Config" }; + cfg::string device{this, "Device", handler.to_string()}; + cfg_pad config{this, "Config"}; - cfg::string buddy_device{ this, "Buddy Device", handler.to_string() }; + cfg::string buddy_device{this, "Buddy Device", handler.to_string()}; }; struct cfg_input final : cfg::node { - cfg_player player1{ this, "Player 1 Input", pad_handler::null }; - cfg_player player2{ this, "Player 2 Input", pad_handler::null }; - cfg_player player3{ this, "Player 3 Input", pad_handler::null }; - cfg_player player4{ this, "Player 4 Input", pad_handler::null }; - cfg_player player5{ this, "Player 5 Input", pad_handler::null }; - cfg_player player6{ this, "Player 6 Input", pad_handler::null }; - cfg_player player7{ this, "Player 7 Input", pad_handler::null }; + cfg_player player1{this, "Player 1 Input", pad_handler::null}; + cfg_player player2{this, "Player 2 Input", pad_handler::null}; + cfg_player player3{this, "Player 3 Input", pad_handler::null}; + cfg_player player4{this, "Player 4 Input", pad_handler::null}; + cfg_player player5{this, "Player 5 Input", pad_handler::null}; + cfg_player player6{this, "Player 6 Input", pad_handler::null}; + cfg_player player7{this, "Player 7 Input", pad_handler::null}; - std::array player{ &player1, &player2, &player3, &player4, &player5, &player6, &player7 }; // Thanks gcc! + std::array player{&player1, &player2, &player3, &player4, &player5, &player6, &player7}; // Thanks gcc! bool load(const std::string& title_id = "", const std::string& profile = "", bool strict = false); void save(const std::string& title_id, const std::string& profile = "") const; @@ -158,7 +158,7 @@ struct cfg_input_configurations final : cfg::node const std::string global_key = "global"; const std::string default_config = "Default"; - cfg::map_entry active_configs{ this, "Active Configurations" }; + cfg::map_entry active_configs{this, "Active Configurations"}; }; extern cfg_input g_cfg_input; diff --git a/rpcs3/rpcs3/Emu/Io/pad_config_types.cpp b/rpcs3/rpcs3/Emu/Io/pad_config_types.cpp index 481fe7078..46096dd09 100644 --- a/rpcs3/rpcs3/Emu/Io/pad_config_types.cpp +++ b/rpcs3/rpcs3/Emu/Io/pad_config_types.cpp @@ -5,44 +5,44 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](pad_handler value) - { - switch (value) { - case pad_handler::null: return "Null"; - case pad_handler::keyboard: return "Keyboard"; - case pad_handler::ds3: return "DualShock 3"; - case pad_handler::ds4: return "DualShock 4"; - case pad_handler::dualsense: return "DualSense"; - case pad_handler::skateboard: return "Skateboard"; - case pad_handler::move: return "PS Move"; + switch (value) + { + case pad_handler::null: return "Null"; + case pad_handler::keyboard: return "Keyboard"; + case pad_handler::ds3: return "DualShock 3"; + case pad_handler::ds4: return "DualShock 4"; + case pad_handler::dualsense: return "DualSense"; + case pad_handler::skateboard: return "Skateboard"; + case pad_handler::move: return "PS Move"; #ifdef _WIN32 - case pad_handler::xinput: return "XInput"; - case pad_handler::mm: return "MMJoystick"; + case pad_handler::xinput: return "XInput"; + case pad_handler::mm: return "MMJoystick"; #endif #ifdef HAVE_SDL3 - case pad_handler::sdl: return "SDL"; + case pad_handler::sdl: return "SDL"; #endif #ifdef HAVE_LIBEVDEV - case pad_handler::evdev: return "Evdev"; + case pad_handler::evdev: return "Evdev"; #endif - case pad_handler::virtual_pad: return "Virtual"; - } + case pad_handler::virtual_pad: return "Virtual"; + } - return unknown; - }); + return unknown; + }); } template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](mouse_movement_mode value) - { - switch (value) { - case mouse_movement_mode::relative: return "Relative"; - case mouse_movement_mode::absolute: return "Absolute"; - } + switch (value) + { + case mouse_movement_mode::relative: return "Relative"; + case mouse_movement_mode::absolute: return "Absolute"; + } - return unknown; - }); + return unknown; + }); } diff --git a/rpcs3/rpcs3/Emu/Io/pad_types.cpp b/rpcs3/rpcs3/Emu/Io/pad_types.cpp index 428e0d6ce..7123093bc 100644 --- a/rpcs3/rpcs3/Emu/Io/pad_types.cpp +++ b/rpcs3/rpcs3/Emu/Io/pad_types.cpp @@ -7,51 +7,51 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](pad_button value) - { - switch (value) { - case pad_button::dpad_up: return "D-Pad Up"; - case pad_button::dpad_down: return "D-Pad Down"; - case pad_button::dpad_left: return "D-Pad Left"; - case pad_button::dpad_right: return "D-Pad Right"; - case pad_button::select: return "Select"; - case pad_button::start: return "Start"; - case pad_button::ps: return "PS"; - case pad_button::triangle: return "Triangle"; - case pad_button::circle: return "Circle"; - case pad_button::square: return "Square"; - case pad_button::cross: return "Cross"; - case pad_button::L1: return "L1"; - case pad_button::R1: return "R1"; - case pad_button::L2: return "L2"; - case pad_button::R2: return "R2"; - case pad_button::L3: return "L3"; - case pad_button::R3: return "R3"; - case pad_button::ls_up: return "Left Stick Up"; - case pad_button::ls_down: return "Left Stick Down"; - case pad_button::ls_left: return "Left Stick Left"; - case pad_button::ls_right: return "Left Stick Right"; - case pad_button::ls_x: return "Left Stick X-Axis"; - case pad_button::ls_y: return "Left Stick Y-Axis"; - case pad_button::rs_up: return "Right Stick Up"; - case pad_button::rs_down: return "Right Stick Down"; - case pad_button::rs_left: return "Right Stick Left"; - case pad_button::rs_right: return "Right Stick Right"; - case pad_button::rs_x: return "Right Stick X-Axis"; - case pad_button::rs_y: return "Right Stick Y-Axis"; - case pad_button::pad_button_max_enum: return ""; - case pad_button::mouse_button_1: return "Mouse Button 1"; - case pad_button::mouse_button_2: return "Mouse Button 2"; - case pad_button::mouse_button_3: return "Mouse Button 3"; - case pad_button::mouse_button_4: return "Mouse Button 4"; - case pad_button::mouse_button_5: return "Mouse Button 5"; - case pad_button::mouse_button_6: return "Mouse Button 6"; - case pad_button::mouse_button_7: return "Mouse Button 7"; - case pad_button::mouse_button_8: return "Mouse Button 8"; - } + switch (value) + { + case pad_button::dpad_up: return "D-Pad Up"; + case pad_button::dpad_down: return "D-Pad Down"; + case pad_button::dpad_left: return "D-Pad Left"; + case pad_button::dpad_right: return "D-Pad Right"; + case pad_button::select: return "Select"; + case pad_button::start: return "Start"; + case pad_button::ps: return "PS"; + case pad_button::triangle: return "Triangle"; + case pad_button::circle: return "Circle"; + case pad_button::square: return "Square"; + case pad_button::cross: return "Cross"; + case pad_button::L1: return "L1"; + case pad_button::R1: return "R1"; + case pad_button::L2: return "L2"; + case pad_button::R2: return "R2"; + case pad_button::L3: return "L3"; + case pad_button::R3: return "R3"; + case pad_button::ls_up: return "Left Stick Up"; + case pad_button::ls_down: return "Left Stick Down"; + case pad_button::ls_left: return "Left Stick Left"; + case pad_button::ls_right: return "Left Stick Right"; + case pad_button::ls_x: return "Left Stick X-Axis"; + case pad_button::ls_y: return "Left Stick Y-Axis"; + case pad_button::rs_up: return "Right Stick Up"; + case pad_button::rs_down: return "Right Stick Down"; + case pad_button::rs_left: return "Right Stick Left"; + case pad_button::rs_right: return "Right Stick Right"; + case pad_button::rs_x: return "Right Stick X-Axis"; + case pad_button::rs_y: return "Right Stick Y-Axis"; + case pad_button::pad_button_max_enum: return ""; + case pad_button::mouse_button_1: return "Mouse Button 1"; + case pad_button::mouse_button_2: return "Mouse Button 2"; + case pad_button::mouse_button_3: return "Mouse Button 3"; + case pad_button::mouse_button_4: return "Mouse Button 4"; + case pad_button::mouse_button_5: return "Mouse Button 5"; + case pad_button::mouse_button_6: return "Mouse Button 6"; + case pad_button::mouse_button_7: return "Mouse Button 7"; + case pad_button::mouse_button_8: return "Mouse Button 8"; + } - return unknown; - }); + return unknown; + }); } u32 pad_button_offset(pad_button button) @@ -151,8 +151,8 @@ u32 get_axis_keycode(u32 offset, u16 value) { switch (offset) { - case CELL_PAD_BTN_OFFSET_ANALOG_LEFT_X: return static_cast(value > 127 ? axis_direction::positive : axis_direction::negative); - case CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y: return static_cast(value < 128 ? axis_direction::positive : axis_direction::negative); + case CELL_PAD_BTN_OFFSET_ANALOG_LEFT_X: return static_cast(value > 127 ? axis_direction::positive : axis_direction::negative); + case CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y: return static_cast(value < 128 ? axis_direction::positive : axis_direction::negative); case CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X: return static_cast(value > 127 ? axis_direction::positive : axis_direction::negative); case CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_Y: return static_cast(value < 128 ? axis_direction::positive : axis_direction::negative); default: return static_cast(axis_direction::both); diff --git a/rpcs3/rpcs3/Emu/Io/pad_types.h b/rpcs3/rpcs3/Emu/Io/pad_types.h index 710edb274..49ff0b5e7 100644 --- a/rpcs3/rpcs3/Emu/Io/pad_types.h +++ b/rpcs3/rpcs3/Emu/Io/pad_types.h @@ -91,26 +91,26 @@ enum PortSettings enum Digital1Flags : u32 { CELL_PAD_CTRL_SELECT = 0x00000001, - CELL_PAD_CTRL_L3 = 0x00000002, - CELL_PAD_CTRL_R3 = 0x00000004, - CELL_PAD_CTRL_START = 0x00000008, - CELL_PAD_CTRL_UP = 0x00000010, - CELL_PAD_CTRL_RIGHT = 0x00000020, - CELL_PAD_CTRL_DOWN = 0x00000040, - CELL_PAD_CTRL_LEFT = 0x00000080, - CELL_PAD_CTRL_PS = 0x00000100, + CELL_PAD_CTRL_L3 = 0x00000002, + CELL_PAD_CTRL_R3 = 0x00000004, + CELL_PAD_CTRL_START = 0x00000008, + CELL_PAD_CTRL_UP = 0x00000010, + CELL_PAD_CTRL_RIGHT = 0x00000020, + CELL_PAD_CTRL_DOWN = 0x00000040, + CELL_PAD_CTRL_LEFT = 0x00000080, + CELL_PAD_CTRL_PS = 0x00000100, }; enum Digital2Flags : u32 { - CELL_PAD_CTRL_L2 = 0x00000001, - CELL_PAD_CTRL_R2 = 0x00000002, - CELL_PAD_CTRL_L1 = 0x00000004, - CELL_PAD_CTRL_R1 = 0x00000008, + CELL_PAD_CTRL_L2 = 0x00000001, + CELL_PAD_CTRL_R2 = 0x00000002, + CELL_PAD_CTRL_L1 = 0x00000004, + CELL_PAD_CTRL_R1 = 0x00000008, CELL_PAD_CTRL_TRIANGLE = 0x00000010, - CELL_PAD_CTRL_CIRCLE = 0x00000020, - CELL_PAD_CTRL_CROSS = 0x00000040, - CELL_PAD_CTRL_SQUARE = 0x00000080, + CELL_PAD_CTRL_CIRCLE = 0x00000020, + CELL_PAD_CTRL_CROSS = 0x00000040, + CELL_PAD_CTRL_SQUARE = 0x00000080, }; enum @@ -120,11 +120,11 @@ enum enum DeviceCapability { - CELL_PAD_CAPABILITY_PS3_CONFORMITY = 0x00000001, // PS3 Conformity Controller - CELL_PAD_CAPABILITY_PRESS_MODE = 0x00000002, // Press mode supported - CELL_PAD_CAPABILITY_SENSOR_MODE = 0x00000004, // Sensor mode supported + CELL_PAD_CAPABILITY_PS3_CONFORMITY = 0x00000001, // PS3 Conformity Controller + CELL_PAD_CAPABILITY_PRESS_MODE = 0x00000002, // Press mode supported + CELL_PAD_CAPABILITY_SENSOR_MODE = 0x00000004, // Sensor mode supported CELL_PAD_CAPABILITY_HP_ANALOG_STICK = 0x00000008, // High Precision analog stick - CELL_PAD_CAPABILITY_ACTUATOR = 0x00000010, // Motor supported + CELL_PAD_CAPABILITY_ACTUATOR = 0x00000010, // Motor supported }; enum DeviceType @@ -137,20 +137,20 @@ enum DeviceType // Controller types enum { - CELL_PAD_PCLASS_TYPE_STANDARD = 0x00, - CELL_PAD_PCLASS_TYPE_GUITAR = 0x01, - CELL_PAD_PCLASS_TYPE_DRUM = 0x02, - CELL_PAD_PCLASS_TYPE_DJ = 0x03, - CELL_PAD_PCLASS_TYPE_DANCEMAT = 0x04, + CELL_PAD_PCLASS_TYPE_STANDARD = 0x00, + CELL_PAD_PCLASS_TYPE_GUITAR = 0x01, + CELL_PAD_PCLASS_TYPE_DRUM = 0x02, + CELL_PAD_PCLASS_TYPE_DJ = 0x03, + CELL_PAD_PCLASS_TYPE_DANCEMAT = 0x04, CELL_PAD_PCLASS_TYPE_NAVIGATION = 0x05, CELL_PAD_PCLASS_TYPE_SKATEBOARD = 0x8001, // these are used together with pad->is_fake_pad to capture input events for usbd/gem/move without conflicting with cellPad - CELL_PAD_FAKE_TYPE_FIRST = 0xa000, - CELL_PAD_FAKE_TYPE_GUNCON3 = 0xa000, - CELL_PAD_FAKE_TYPE_TOP_SHOT_ELITE = 0xa001, + CELL_PAD_FAKE_TYPE_FIRST = 0xa000, + CELL_PAD_FAKE_TYPE_GUNCON3 = 0xa000, + CELL_PAD_FAKE_TYPE_TOP_SHOT_ELITE = 0xa001, CELL_PAD_FAKE_TYPE_TOP_SHOT_FEARMASTER = 0xa002, - CELL_PAD_FAKE_TYPE_GAMETABLET = 0xa003, + CELL_PAD_FAKE_TYPE_GAMETABLET = 0xa003, CELL_PAD_FAKE_TYPE_LAST, CELL_PAD_PCLASS_TYPE_MAX // last item @@ -164,70 +164,70 @@ enum enum { // Basic - CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_1 = 0x00000001, - CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_2 = 0x00000002, - CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_3 = 0x00000004, - CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_4 = 0x00000008, - CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_5 = 0x00000010, - CELL_PAD_PCLASS_PROFILE_GUITAR_STRUM_UP = 0x00000020, - CELL_PAD_PCLASS_PROFILE_GUITAR_STRUM_DOWN = 0x00000040, - CELL_PAD_PCLASS_PROFILE_GUITAR_WHAMMYBAR = 0x00000080, + CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_1 = 0x00000001, + CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_2 = 0x00000002, + CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_3 = 0x00000004, + CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_4 = 0x00000008, + CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_5 = 0x00000010, + CELL_PAD_PCLASS_PROFILE_GUITAR_STRUM_UP = 0x00000020, + CELL_PAD_PCLASS_PROFILE_GUITAR_STRUM_DOWN = 0x00000040, + CELL_PAD_PCLASS_PROFILE_GUITAR_WHAMMYBAR = 0x00000080, // All Basic = 0x000000FF // Optional - CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H1 = 0x00000100, - CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H2 = 0x00000200, - CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H3 = 0x00000400, - CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H4 = 0x00000800, - CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H5 = 0x00001000, - CELL_PAD_PCLASS_PROFILE_GUITAR_5WAY_EFFECT = 0x00002000, - CELL_PAD_PCLASS_PROFILE_GUITAR_TILT_SENS = 0x00004000, + CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H1 = 0x00000100, + CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H2 = 0x00000200, + CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H3 = 0x00000400, + CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H4 = 0x00000800, + CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H5 = 0x00001000, + CELL_PAD_PCLASS_PROFILE_GUITAR_5WAY_EFFECT = 0x00002000, + CELL_PAD_PCLASS_PROFILE_GUITAR_TILT_SENS = 0x00004000, // All = 0x00007FFF }; // Profile of a Drum Type Controller enum { - CELL_PAD_PCLASS_PROFILE_DRUM_SNARE = 0x00000001, - CELL_PAD_PCLASS_PROFILE_DRUM_TOM = 0x00000002, - CELL_PAD_PCLASS_PROFILE_DRUM_TOM2 = 0x00000004, + CELL_PAD_PCLASS_PROFILE_DRUM_SNARE = 0x00000001, + CELL_PAD_PCLASS_PROFILE_DRUM_TOM = 0x00000002, + CELL_PAD_PCLASS_PROFILE_DRUM_TOM2 = 0x00000004, CELL_PAD_PCLASS_PROFILE_DRUM_TOM_FLOOR = 0x00000008, - CELL_PAD_PCLASS_PROFILE_DRUM_KICK = 0x00000010, + CELL_PAD_PCLASS_PROFILE_DRUM_KICK = 0x00000010, CELL_PAD_PCLASS_PROFILE_DRUM_CYM_HiHAT = 0x00000020, CELL_PAD_PCLASS_PROFILE_DRUM_CYM_CRASH = 0x00000040, - CELL_PAD_PCLASS_PROFILE_DRUM_CYM_RIDE = 0x00000080, - CELL_PAD_PCLASS_PROFILE_DRUM_KICK2 = 0x00000100, + CELL_PAD_PCLASS_PROFILE_DRUM_CYM_RIDE = 0x00000080, + CELL_PAD_PCLASS_PROFILE_DRUM_KICK2 = 0x00000100, // All = 0x000001FF }; // Profile of a DJ Deck Type Controller enum { - CELL_PAD_PCLASS_PROFILE_DJ_MIXER_ATTACK = 0x00000001, + CELL_PAD_PCLASS_PROFILE_DJ_MIXER_ATTACK = 0x00000001, CELL_PAD_PCLASS_PROFILE_DJ_MIXER_CROSSFADER = 0x00000002, - CELL_PAD_PCLASS_PROFILE_DJ_MIXER_DSP_DIAL = 0x00000004, - CELL_PAD_PCLASS_PROFILE_DJ_DECK1_STREAM1 = 0x00000008, - CELL_PAD_PCLASS_PROFILE_DJ_DECK1_STREAM2 = 0x00000010, - CELL_PAD_PCLASS_PROFILE_DJ_DECK1_STREAM3 = 0x00000020, - CELL_PAD_PCLASS_PROFILE_DJ_DECK1_PLATTER = 0x00000040, - CELL_PAD_PCLASS_PROFILE_DJ_DECK2_STREAM1 = 0x00000080, - CELL_PAD_PCLASS_PROFILE_DJ_DECK2_STREAM2 = 0x00000100, - CELL_PAD_PCLASS_PROFILE_DJ_DECK2_STREAM3 = 0x00000200, - CELL_PAD_PCLASS_PROFILE_DJ_DECK2_PLATTER = 0x00000400, + CELL_PAD_PCLASS_PROFILE_DJ_MIXER_DSP_DIAL = 0x00000004, + CELL_PAD_PCLASS_PROFILE_DJ_DECK1_STREAM1 = 0x00000008, + CELL_PAD_PCLASS_PROFILE_DJ_DECK1_STREAM2 = 0x00000010, + CELL_PAD_PCLASS_PROFILE_DJ_DECK1_STREAM3 = 0x00000020, + CELL_PAD_PCLASS_PROFILE_DJ_DECK1_PLATTER = 0x00000040, + CELL_PAD_PCLASS_PROFILE_DJ_DECK2_STREAM1 = 0x00000080, + CELL_PAD_PCLASS_PROFILE_DJ_DECK2_STREAM2 = 0x00000100, + CELL_PAD_PCLASS_PROFILE_DJ_DECK2_STREAM3 = 0x00000200, + CELL_PAD_PCLASS_PROFILE_DJ_DECK2_PLATTER = 0x00000400, // All = 0x000007FF }; // Profile of a Dance Mat Type Controller enum { - CELL_PAD_PCLASS_PROFILE_DANCEMAT_CIRCLE = 0x00000001, - CELL_PAD_PCLASS_PROFILE_DANCEMAT_CROSS = 0x00000002, + CELL_PAD_PCLASS_PROFILE_DANCEMAT_CIRCLE = 0x00000001, + CELL_PAD_PCLASS_PROFILE_DANCEMAT_CROSS = 0x00000002, CELL_PAD_PCLASS_PROFILE_DANCEMAT_TRIANGLE = 0x00000004, - CELL_PAD_PCLASS_PROFILE_DANCEMAT_SQUARE = 0x00000008, - CELL_PAD_PCLASS_PROFILE_DANCEMAT_RIGHT = 0x00000010, - CELL_PAD_PCLASS_PROFILE_DANCEMAT_LEFT = 0x00000020, - CELL_PAD_PCLASS_PROFILE_DANCEMAT_UP = 0x00000040, - CELL_PAD_PCLASS_PROFILE_DANCEMAT_DOWN = 0x00000080, + CELL_PAD_PCLASS_PROFILE_DANCEMAT_SQUARE = 0x00000008, + CELL_PAD_PCLASS_PROFILE_DANCEMAT_RIGHT = 0x00000010, + CELL_PAD_PCLASS_PROFILE_DANCEMAT_LEFT = 0x00000020, + CELL_PAD_PCLASS_PROFILE_DANCEMAT_UP = 0x00000040, + CELL_PAD_PCLASS_PROFILE_DANCEMAT_DOWN = 0x00000080, // All = 0x000000FF }; @@ -263,63 +263,63 @@ enum ButtonDataOffset enum CellPadPeriphGuitarBtnDataOffset { // Basic - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_1 = 24, - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_2 = 25, - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_3 = 26, - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_4 = 27, - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_5 = 28, - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_STRUM_UP = 29, - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_STRUM_DOWN = 30, - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_WHAMMYBAR = 31, // 128-255 + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_1 = 24, + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_2 = 25, + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_3 = 26, + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_4 = 27, + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_5 = 28, + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_STRUM_UP = 29, + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_STRUM_DOWN = 30, + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_WHAMMYBAR = 31, // 128-255 // Optional - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H1 = 32, // ROCKBAND Stratocaster - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H2 = 33, - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H3 = 34, - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H4 = 35, - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H5 = 36, + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H1 = 32, // ROCKBAND Stratocaster + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H2 = 33, + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H3 = 34, + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H4 = 35, + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_FRET_H5 = 36, CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_5WAY_EFFECT = 37, - CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_TILT_SENS = 38, + CELL_PAD_PCLASS_BTN_OFFSET_GUITAR_TILT_SENS = 38, }; enum CellPadPeriphDrumBtnDataOffset { - CELL_PAD_PCLASS_BTN_OFFSET_DRUM_SNARE = 24, - CELL_PAD_PCLASS_BTN_OFFSET_DRUM_TOM = 25, - CELL_PAD_PCLASS_BTN_OFFSET_DRUM_TOM2 = 26, + CELL_PAD_PCLASS_BTN_OFFSET_DRUM_SNARE = 24, + CELL_PAD_PCLASS_BTN_OFFSET_DRUM_TOM = 25, + CELL_PAD_PCLASS_BTN_OFFSET_DRUM_TOM2 = 26, CELL_PAD_PCLASS_BTN_OFFSET_DRUM_TOM_FLOOR = 27, - CELL_PAD_PCLASS_BTN_OFFSET_DRUM_KICK = 28, + CELL_PAD_PCLASS_BTN_OFFSET_DRUM_KICK = 28, CELL_PAD_PCLASS_BTN_OFFSET_DRUM_CYM_HiHAT = 29, CELL_PAD_PCLASS_BTN_OFFSET_DRUM_CYM_CRASH = 30, - CELL_PAD_PCLASS_BTN_OFFSET_DRUM_CYM_RIDE = 31, - CELL_PAD_PCLASS_BTN_OFFSET_DRUM_KICK2 = 32, + CELL_PAD_PCLASS_BTN_OFFSET_DRUM_CYM_RIDE = 31, + CELL_PAD_PCLASS_BTN_OFFSET_DRUM_KICK2 = 32, }; enum CellPadPeriphDJBtnDataOffset { - CELL_PAD_PCLASS_BTN_OFFSET_DJ_MIXER_ATTACK = 24, + CELL_PAD_PCLASS_BTN_OFFSET_DJ_MIXER_ATTACK = 24, CELL_PAD_PCLASS_BTN_OFFSET_DJ_MIXER_CROSSFADER = 25, - CELL_PAD_PCLASS_BTN_OFFSET_DJ_MIXER_DSP_DIAL = 26, - CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_STREAM1 = 27, - CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_STREAM2 = 28, - CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_STREAM3 = 29, - CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_PLATTER = 30, - CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_STREAM1 = 31, - CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_STREAM2 = 32, - CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_STREAM3 = 33, - CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_PLATTER = 34, + CELL_PAD_PCLASS_BTN_OFFSET_DJ_MIXER_DSP_DIAL = 26, + CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_STREAM1 = 27, + CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_STREAM2 = 28, + CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_STREAM3 = 29, + CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK1_PLATTER = 30, + CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_STREAM1 = 31, + CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_STREAM2 = 32, + CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_STREAM3 = 33, + CELL_PAD_PCLASS_BTN_OFFSET_DJ_DECK2_PLATTER = 34, }; enum CellPadPeriphDanceMatBtnDataOffset { - CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_CIRCLE = 24, - CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_CROSS = 25, + CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_CIRCLE = 24, + CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_CROSS = 25, CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_TRIANGLE = 26, - CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_SQUARE = 27, - CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_RIGHT = 28, - CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_LEFT = 29, - CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_UP = 30, - CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_DOWN = 31, + CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_SQUARE = 27, + CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_RIGHT = 28, + CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_LEFT = 29, + CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_UP = 30, + CELL_PAD_PCLASS_BTN_OFFSET_DANCEMAT_DOWN = 31, }; enum @@ -346,18 +346,18 @@ static constexpr u16 DEFAULT_MOTION_G = 512; // Fake helper enum enum PressurePiggybackFlags : u32 { - CELL_PAD_CTRL_PRESS_RIGHT = CELL_PAD_BTN_OFFSET_PRESS_RIGHT, - CELL_PAD_CTRL_PRESS_LEFT = CELL_PAD_BTN_OFFSET_PRESS_LEFT, - CELL_PAD_CTRL_PRESS_UP = CELL_PAD_BTN_OFFSET_PRESS_UP, - CELL_PAD_CTRL_PRESS_DOWN = CELL_PAD_BTN_OFFSET_PRESS_DOWN, + CELL_PAD_CTRL_PRESS_RIGHT = CELL_PAD_BTN_OFFSET_PRESS_RIGHT, + CELL_PAD_CTRL_PRESS_LEFT = CELL_PAD_BTN_OFFSET_PRESS_LEFT, + CELL_PAD_CTRL_PRESS_UP = CELL_PAD_BTN_OFFSET_PRESS_UP, + CELL_PAD_CTRL_PRESS_DOWN = CELL_PAD_BTN_OFFSET_PRESS_DOWN, CELL_PAD_CTRL_PRESS_TRIANGLE = CELL_PAD_BTN_OFFSET_PRESS_TRIANGLE, - CELL_PAD_CTRL_PRESS_CIRCLE = CELL_PAD_BTN_OFFSET_PRESS_CIRCLE, - CELL_PAD_CTRL_PRESS_CROSS = CELL_PAD_BTN_OFFSET_PRESS_CROSS, - CELL_PAD_CTRL_PRESS_SQUARE = CELL_PAD_BTN_OFFSET_PRESS_SQUARE, - CELL_PAD_CTRL_PRESS_L1 = CELL_PAD_BTN_OFFSET_PRESS_L1, - CELL_PAD_CTRL_PRESS_R1 = CELL_PAD_BTN_OFFSET_PRESS_R1, - CELL_PAD_CTRL_PRESS_L2 = CELL_PAD_BTN_OFFSET_PRESS_L2, - CELL_PAD_CTRL_PRESS_R2 = CELL_PAD_BTN_OFFSET_PRESS_R2, + CELL_PAD_CTRL_PRESS_CIRCLE = CELL_PAD_BTN_OFFSET_PRESS_CIRCLE, + CELL_PAD_CTRL_PRESS_CROSS = CELL_PAD_BTN_OFFSET_PRESS_CROSS, + CELL_PAD_CTRL_PRESS_SQUARE = CELL_PAD_BTN_OFFSET_PRESS_SQUARE, + CELL_PAD_CTRL_PRESS_L1 = CELL_PAD_BTN_OFFSET_PRESS_L1, + CELL_PAD_CTRL_PRESS_R1 = CELL_PAD_BTN_OFFSET_PRESS_R1, + CELL_PAD_CTRL_PRESS_L2 = CELL_PAD_BTN_OFFSET_PRESS_L2, + CELL_PAD_CTRL_PRESS_R2 = CELL_PAD_BTN_OFFSET_PRESS_R2, }; constexpr u32 special_button_offset = 666; // Must not conflict with other CELL offsets like ButtonDataOffset @@ -374,18 +374,16 @@ struct Button u32 m_offset = 0; std::set m_key_codes{}; u32 m_outKeyCode = 0; - u16 m_value = 0; + u16 m_value = 0; bool m_pressed = false; u16 m_actual_value = 0; // only used in keyboard_pad_handler - bool m_analog = false; // only used in keyboard_pad_handler - bool m_trigger = false; // only used in keyboard_pad_handler + bool m_analog = false; // only used in keyboard_pad_handler + bool m_trigger = false; // only used in keyboard_pad_handler std::map m_pressed_keys{}; // only used in keyboard_pad_handler Button(u32 offset, std::set key_codes, u32 outKeyCode) - : m_offset(offset) - , m_key_codes(std::move(key_codes)) - , m_outKeyCode(outKeyCode) + : m_offset(offset), m_key_codes(std::move(key_codes)), m_outKeyCode(outKeyCode) { if (offset == CELL_PAD_BTN_OFFSET_DIGITAL1) { @@ -397,7 +395,7 @@ struct Button else if (offset == CELL_PAD_BTN_OFFSET_DIGITAL2) { if (outKeyCode == CELL_PAD_CTRL_CROSS || outKeyCode == CELL_PAD_CTRL_CIRCLE || outKeyCode == CELL_PAD_CTRL_SQUARE || outKeyCode == CELL_PAD_CTRL_TRIANGLE || outKeyCode == CELL_PAD_CTRL_L1 || - outKeyCode == CELL_PAD_CTRL_R1) + outKeyCode == CELL_PAD_CTRL_R1) { m_analog = true; } @@ -421,10 +419,9 @@ struct AnalogStick AnalogStick() {} AnalogStick(u32 offset, std::set key_codes_min, std::set key_codes_max) - : m_offset(offset) - , m_key_codes_min(std::move(key_codes_min)) - , m_key_codes_max(std::move(key_codes_max)) - {} + : m_offset(offset), m_key_codes_min(std::move(key_codes_min)), m_key_codes_max(std::move(key_codes_max)) + { + } }; struct AnalogSensor @@ -437,12 +434,9 @@ struct AnalogSensor AnalogSensor() {} AnalogSensor(u32 offset, u32 key_code, b8 mirrored, s16 shift, u16 value) - : m_offset(offset) - , m_keyCode(key_code) - , m_mirrored(mirrored) - , m_shift(shift) - , m_value(value) - {} + : m_offset(offset), m_keyCode(key_code), m_mirrored(mirrored), m_shift(shift), m_value(value) + { + } }; struct VibrateMotor @@ -452,9 +446,9 @@ struct VibrateMotor VibrateMotor() {} VibrateMotor(bool is_large_motor, u8 value) - : m_is_large_motor(is_large_motor) - , m_value(value) - {} + : m_is_large_motor(is_large_motor), m_value(value) + { + } }; struct ps_move_data @@ -473,14 +467,14 @@ struct ps_move_data bool magnetometer_enabled = false; bool orientation_enabled = false; - static constexpr std::array default_quaternion { 1.0f, 0.0f, 0.0f, 0.0f }; + static constexpr std::array default_quaternion{1.0f, 0.0f, 0.0f, 0.0f}; std::array quaternion = default_quaternion; // quaternion orientation (x,y,z,w) of controller relative to default (facing the camera with buttons up) - f32 accelerometer_x = 0.0f; // linear velocity in m/s² - f32 accelerometer_y = 0.0f; // linear velocity in m/s² - f32 accelerometer_z = 0.0f; // linear velocity in m/s² - f32 gyro_x = 0.0f; // angular velocity in rad/s - f32 gyro_y = 0.0f; // angular velocity in rad/s - f32 gyro_z = 0.0f; // angular velocity in rad/s + f32 accelerometer_x = 0.0f; // linear velocity in m/s² + f32 accelerometer_y = 0.0f; // linear velocity in m/s² + f32 accelerometer_z = 0.0f; // linear velocity in m/s² + f32 gyro_x = 0.0f; // angular velocity in rad/s + f32 gyro_y = 0.0f; // angular velocity in rad/s + f32 gyro_z = 0.0f; // angular velocity in rad/s f32 magnetometer_x = 0.0f; f32 magnetometer_y = 0.0f; f32 magnetometer_z = 0.0f; @@ -506,17 +500,17 @@ struct Pad u64 m_disconnection_timer{0}; - s32 m_pressure_intensity_button_index{-1}; // Special button index. -1 if not set. + s32 m_pressure_intensity_button_index{-1}; // Special button index. -1 if not set. bool m_pressure_intensity_button_pressed{}; // Last sensitivity button press state, used for toggle. - bool m_pressure_intensity_toggled{}; // Whether the sensitivity is toggled on or off. - u8 m_pressure_intensity{127}; // 0-255 - bool m_adjust_pressure_last{}; // only used in keyboard_pad_handler + bool m_pressure_intensity_toggled{}; // Whether the sensitivity is toggled on or off. + u8 m_pressure_intensity{127}; // 0-255 + bool m_adjust_pressure_last{}; // only used in keyboard_pad_handler bool get_pressure_intensity_button_active(bool is_toggle_mode, u32 player_id); - s32 m_analog_limiter_button_index{-1}; // Special button index. -1 if not set. + s32 m_analog_limiter_button_index{-1}; // Special button index. -1 if not set. bool m_analog_limiter_button_pressed{}; // Last sensitivity button press state, used for toggle. - bool m_analog_limiter_toggled{}; // Whether the sensitivity is toggled on or off. - bool m_analog_limiter_enabled_last{}; // only used in keyboard_pad_handler + bool m_analog_limiter_toggled{}; // Whether the sensitivity is toggled on or off. + bool m_analog_limiter_enabled_last{}; // only used in keyboard_pad_handler bool get_analog_limiter_button_active(bool is_toggle_mode, u32 player_id); s32 m_orientation_reset_button_index{-1}; // Special button index. -1 if not set. @@ -573,11 +567,7 @@ struct Pad ps_move_data move_data{}; explicit Pad(pad_handler handler, u32 player_id, u32 port_status, u32 device_capability, u32 device_type) - : m_pad_handler(handler) - , m_player_id(player_id) - , m_port_status(port_status) - , m_device_capability(device_capability) - , m_device_type(device_type) + : m_pad_handler(handler), m_player_id(player_id), m_port_status(port_status), m_device_capability(device_capability), m_device_type(device_type) { } diff --git a/rpcs3/rpcs3/Emu/Io/rb3drums_config.cpp b/rpcs3/rpcs3/Emu/Io/rb3drums_config.cpp index 76c86252a..c82733381 100644 --- a/rpcs3/rpcs3/Emu/Io/rb3drums_config.cpp +++ b/rpcs3/rpcs3/Emu/Io/rb3drums_config.cpp @@ -6,8 +6,7 @@ LOG_CHANNEL(cfg_log, "CFG"); cfg_rb3drums g_cfg_rb3drums; cfg_rb3drums::cfg_rb3drums() - : cfg::node() - , path(fs::get_config_dir(true) + "rb3drums.yml") + : cfg::node(), path(fs::get_config_dir(true) + "rb3drums.yml") { } diff --git a/rpcs3/rpcs3/Emu/Io/recording_config.cpp b/rpcs3/rpcs3/Emu/Io/recording_config.cpp index 9b360a24e..03fe8bc00 100644 --- a/rpcs3/rpcs3/Emu/Io/recording_config.cpp +++ b/rpcs3/rpcs3/Emu/Io/recording_config.cpp @@ -6,8 +6,7 @@ LOG_CHANNEL(cfg_log, "CFG"); cfg_recording g_cfg_recording; cfg_recording::cfg_recording() - : cfg::node() - , path(fs::get_config_dir(true) + "recording.yml") + : cfg::node(), path(fs::get_config_dir(true) + "recording.yml") { } diff --git a/rpcs3/rpcs3/Emu/Io/recording_config.h b/rpcs3/rpcs3/Emu/Io/recording_config.h index 127d24015..24019d499 100644 --- a/rpcs3/rpcs3/Emu/Io/recording_config.h +++ b/rpcs3/rpcs3/Emu/Io/recording_config.h @@ -16,21 +16,21 @@ struct cfg_recording final : cfg::node cfg::uint<0, 7680> width{this, "Width", 1280}; cfg::uint<0, 4320> height{this, "Height", 720}; cfg::uint<0, 192> pixel_format{this, "AVPixelFormat", 0}; // AVPixelFormat::AV_PIX_FMT_YUV420P - cfg::uint<0, 0xFFFF> video_codec{this, "AVCodecID", 12}; // AVCodecID::AV_CODEC_ID_MPEG4 + cfg::uint<0, 0xFFFF> video_codec{this, "AVCodecID", 12}; // AVCodecID::AV_CODEC_ID_MPEG4 cfg::uint<0, 25000000> video_bps{this, "Video Bitrate", 4000000}; cfg::uint<0, 5> max_b_frames{this, "Max B-Frames", 2}; cfg::uint<0, 20> gop_size{this, "Group of Pictures Size", 12}; - } video{ this }; + } video{this}; struct node_audio : cfg::node { node_audio(cfg::node* _this) : cfg::node(_this, "Audio") {} - + cfg::uint<0x10000, 0x17000> audio_codec{this, "AVCodecID", 86018}; // AVCodecID::AV_CODEC_ID_AAC cfg::uint<0, 25000000> audio_bps{this, "Audio Bitrate", 320000}; - } audio{ this }; + } audio{this}; const std::string path; }; diff --git a/rpcs3/rpcs3/Emu/Io/turntable_config.h b/rpcs3/rpcs3/Emu/Io/turntable_config.h index c2237520f..b50a24fc8 100644 --- a/rpcs3/rpcs3/Emu/Io/turntable_config.h +++ b/rpcs3/rpcs3/Emu/Io/turntable_config.h @@ -28,22 +28,22 @@ struct cfg_turntable final : public emulated_pad_config { cfg_turntable(node* owner, const std::string& name) : emulated_pad_config(owner, name) {} - cfg_pad_btn blue{ this, "Blue", turntable_btn::blue, pad_button::square }; - cfg_pad_btn green{ this, "Green", turntable_btn::green, pad_button::cross }; - cfg_pad_btn red{ this, "Red", turntable_btn::red, pad_button::circle }; - cfg_pad_btn dpad_up{ this, "D-Pad Up", turntable_btn::dpad_up, pad_button::dpad_up }; - cfg_pad_btn dpad_down{ this, "D-Pad Down", turntable_btn::dpad_down, pad_button::dpad_down }; - cfg_pad_btn dpad_left{ this, "D-Pad Left", turntable_btn::dpad_left, pad_button::dpad_left }; - cfg_pad_btn dpad_right{ this, "D-Pad Right", turntable_btn::dpad_right, pad_button::dpad_right }; - cfg_pad_btn start{ this, "Start", turntable_btn::start, pad_button::start }; - cfg_pad_btn select{ this, "Select", turntable_btn::select, pad_button::select }; - cfg_pad_btn square{ this, "Square", turntable_btn::square, pad_button::R2 }; - cfg_pad_btn circle{ this, "Circle", turntable_btn::circle, pad_button::L1 }; - cfg_pad_btn cross{ this, "Cross", turntable_btn::cross, pad_button::R1 }; - cfg_pad_btn triangle{ this, "Triangle", turntable_btn::triangle, pad_button::triangle }; - cfg_pad_btn right_turntable{ this, "Right Turntable", turntable_btn::right_turntable, pad_button::ls_y }; - cfg_pad_btn crossfader{ this, "Crossfader", turntable_btn::crossfader, pad_button::rs_y }; - cfg_pad_btn effects_dial{ this, "Effects Dial", turntable_btn::effects_dial, pad_button::rs_x }; + cfg_pad_btn blue{this, "Blue", turntable_btn::blue, pad_button::square}; + cfg_pad_btn green{this, "Green", turntable_btn::green, pad_button::cross}; + cfg_pad_btn red{this, "Red", turntable_btn::red, pad_button::circle}; + cfg_pad_btn dpad_up{this, "D-Pad Up", turntable_btn::dpad_up, pad_button::dpad_up}; + cfg_pad_btn dpad_down{this, "D-Pad Down", turntable_btn::dpad_down, pad_button::dpad_down}; + cfg_pad_btn dpad_left{this, "D-Pad Left", turntable_btn::dpad_left, pad_button::dpad_left}; + cfg_pad_btn dpad_right{this, "D-Pad Right", turntable_btn::dpad_right, pad_button::dpad_right}; + cfg_pad_btn start{this, "Start", turntable_btn::start, pad_button::start}; + cfg_pad_btn select{this, "Select", turntable_btn::select, pad_button::select}; + cfg_pad_btn square{this, "Square", turntable_btn::square, pad_button::R2}; + cfg_pad_btn circle{this, "Circle", turntable_btn::circle, pad_button::L1}; + cfg_pad_btn cross{this, "Cross", turntable_btn::cross, pad_button::R1}; + cfg_pad_btn triangle{this, "Triangle", turntable_btn::triangle, pad_button::triangle}; + cfg_pad_btn right_turntable{this, "Right Turntable", turntable_btn::right_turntable, pad_button::ls_y}; + cfg_pad_btn crossfader{this, "Crossfader", turntable_btn::crossfader, pad_button::rs_y}; + cfg_pad_btn effects_dial{this, "Effects Dial", turntable_btn::effects_dial, pad_button::rs_x}; }; struct cfg_turntables final : public emulated_pads_config diff --git a/rpcs3/rpcs3/Emu/Io/usb_device.cpp b/rpcs3/rpcs3/Emu/Io/usb_device.cpp index be35a6146..799f6f77a 100644 --- a/rpcs3/rpcs3/Emu/Io/usb_device.cpp +++ b/rpcs3/rpcs3/Emu/Io/usb_device.cpp @@ -273,10 +273,10 @@ u32 usb_device_emulated::get_status(bool self_powered, bool remote_wakeup, u8* b void usb_device_emulated::control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 /*wLength*/, u32 buf_size, u8* buf, UsbTransfer* transfer) { - transfer->fake = true; - transfer->expected_count = buf_size; + transfer->fake = true; + transfer->expected_count = buf_size; transfer->expected_result = HC_CC_NOERR; - transfer->expected_time = usb_device::get_timestamp() + 100; + transfer->expected_time = usb_device::get_timestamp() + 100; switch (bmRequestType) { diff --git a/rpcs3/rpcs3/Emu/Io/usb_device.h b/rpcs3/rpcs3/Emu/Io/usb_device.h index 3d60bd36b..d8884ffc8 100644 --- a/rpcs3/rpcs3/Emu/Io/usb_device.h +++ b/rpcs3/rpcs3/Emu/Io/usb_device.h @@ -22,13 +22,13 @@ struct UsbTransfer; // Usb descriptors enum : u8 { - USB_DESCRIPTOR_DEVICE = 0x01, - USB_DESCRIPTOR_CONFIG = 0x02, - USB_DESCRIPTOR_STRING = 0x03, - USB_DESCRIPTOR_INTERFACE = 0x04, - USB_DESCRIPTOR_ENDPOINT = 0x05, - USB_DESCRIPTOR_HID = 0x21, - USB_DESCRIPTOR_ACI = 0x24, + USB_DESCRIPTOR_DEVICE = 0x01, + USB_DESCRIPTOR_CONFIG = 0x02, + USB_DESCRIPTOR_STRING = 0x03, + USB_DESCRIPTOR_INTERFACE = 0x04, + USB_DESCRIPTOR_ENDPOINT = 0x05, + USB_DESCRIPTOR_HID = 0x21, + USB_DESCRIPTOR_ACI = 0x24, USB_DESCRIPTOR_ENDPOINT_ASI = 0x25, }; @@ -92,21 +92,21 @@ struct UsbTransfer u32 transfer_id = 0; s32 result = 0; - u32 count = 0; + u32 count = 0; UsbDeviceIsoRequest iso_request{}; std::vector setup_buf; libusb_transfer* transfer = nullptr; - bool busy = false; + bool busy = false; // For control transfers - u8 *control_destbuf = nullptr; + u8* control_destbuf = nullptr; // For fake transfers - bool fake = false; - u64 expected_time = 0; + bool fake = false; + u64 expected_time = 0; s32 expected_result = 0; - u32 expected_count = 0; + u32 expected_count = 0; }; // Usb descriptor helper @@ -163,7 +163,8 @@ struct UsbDescriptorNode for (const auto& node : subnodes) { const u32 remaining = max_size - size; - if (remaining == 0) break; + if (remaining == 0) + break; size += node.write_data(ptr + size, remaining); } return size; @@ -186,8 +187,8 @@ public: virtual bool set_interface(u8 int_num); virtual void control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 wLength, u32 buf_size, u8* buf, UsbTransfer* transfer) = 0; - virtual void interrupt_transfer(u32 buf_size, u8* buf, u32 endpoint, UsbTransfer* transfer) = 0; - virtual void isochronous_transfer(UsbTransfer* transfer) = 0; + virtual void interrupt_transfer(u32 buf_size, u8* buf, u32 endpoint, UsbTransfer* transfer) = 0; + virtual void isochronous_transfer(UsbTransfer* transfer) = 0; public: // device ID if the device has been ldded(0 otherwise) @@ -196,7 +197,7 @@ public: UsbDescriptorNode device; protected: - u8 current_config = 1; + u8 current_config = 1; u8 current_interface = 0; std::array location{}; @@ -223,7 +224,7 @@ protected: void send_libusb_transfer(libusb_transfer* transfer); protected: - libusb_device* lusb_device = nullptr; + libusb_device* lusb_device = nullptr; libusb_device_handle* lusb_handle = nullptr; }; diff --git a/rpcs3/rpcs3/Emu/Io/usio.cpp b/rpcs3/rpcs3/Emu/Io/usio.cpp index e01deccf8..fc0318ca4 100644 --- a/rpcs3/rpcs3/Emu/Io/usio.cpp +++ b/rpcs3/rpcs3/Emu/Io/usio.cpp @@ -12,31 +12,31 @@ template <> void fmt_class_string::format(std::string& out, u64 arg) { format_enum(out, arg, [](usio_btn value) - { - switch (value) { - case usio_btn::test: return "Test"; - case usio_btn::coin: return "Coin"; - case usio_btn::service: return "Service"; - case usio_btn::enter: return "Enter/Start"; - case usio_btn::up: return "Up"; - case usio_btn::down: return "Down"; - case usio_btn::left: return "Left"; - case usio_btn::right: return "Right"; - case usio_btn::taiko_hit_side_left: return "Taiko Hit Side Left"; - case usio_btn::taiko_hit_side_right: return "Taiko Hit Side Right"; - case usio_btn::taiko_hit_center_left: return "Taiko Hit Center Left"; - case usio_btn::taiko_hit_center_right: return "Taiko Hit Center Right"; - case usio_btn::tekken_button1: return "Tekken Button 1"; - case usio_btn::tekken_button2: return "Tekken Button 2"; - case usio_btn::tekken_button3: return "Tekken Button 3"; - case usio_btn::tekken_button4: return "Tekken Button 4"; - case usio_btn::tekken_button5: return "Tekken Button 5"; - case usio_btn::count: return "Count"; - } + switch (value) + { + case usio_btn::test: return "Test"; + case usio_btn::coin: return "Coin"; + case usio_btn::service: return "Service"; + case usio_btn::enter: return "Enter/Start"; + case usio_btn::up: return "Up"; + case usio_btn::down: return "Down"; + case usio_btn::left: return "Left"; + case usio_btn::right: return "Right"; + case usio_btn::taiko_hit_side_left: return "Taiko Hit Side Left"; + case usio_btn::taiko_hit_side_right: return "Taiko Hit Side Right"; + case usio_btn::taiko_hit_center_left: return "Taiko Hit Center Left"; + case usio_btn::taiko_hit_center_right: return "Taiko Hit Center Right"; + case usio_btn::tekken_button1: return "Tekken Button 1"; + case usio_btn::tekken_button2: return "Tekken Button 2"; + case usio_btn::tekken_button3: return "Tekken Button 3"; + case usio_btn::tekken_button4: return "Tekken Button 4"; + case usio_btn::tekken_button5: return "Tekken Button 5"; + case usio_btn::count: return "Count"; + } - return unknown; - }); + return unknown; + }); } struct usio_memory @@ -65,59 +65,59 @@ usb_device_usio::usb_device_usio(const std::array& location) device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, UsbDeviceDescriptor{ - .bcdUSB = 0x0110, - .bDeviceClass = 0xff, - .bDeviceSubClass = 0x00, - .bDeviceProtocol = 0xff, - .bMaxPacketSize0 = 0x8, - .idVendor = 0x0b9a, - .idProduct = 0x0910, - .bcdDevice = 0x0910, - .iManufacturer = 0x01, - .iProduct = 0x02, - .iSerialNumber = 0x00, + .bcdUSB = 0x0110, + .bDeviceClass = 0xff, + .bDeviceSubClass = 0x00, + .bDeviceProtocol = 0xff, + .bMaxPacketSize0 = 0x8, + .idVendor = 0x0b9a, + .idProduct = 0x0910, + .bcdDevice = 0x0910, + .iManufacturer = 0x01, + .iProduct = 0x02, + .iSerialNumber = 0x00, .bNumConfigurations = 0x01}); auto& config0 = device.add_node(UsbDescriptorNode(USB_DESCRIPTOR_CONFIG, UsbDeviceConfiguration{ - .wTotalLength = 39, - .bNumInterfaces = 0x01, + .wTotalLength = 39, + .bNumInterfaces = 0x01, .bConfigurationValue = 0x01, - .iConfiguration = 0x00, - .bmAttributes = 0xc0, - .bMaxPower = 0x32 // ??? 100ma + .iConfiguration = 0x00, + .bmAttributes = 0xc0, + .bMaxPower = 0x32 // ??? 100ma })); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_INTERFACE, UsbDeviceInterface{ - .bInterfaceNumber = 0x00, - .bAlternateSetting = 0x00, - .bNumEndpoints = 0x03, - .bInterfaceClass = 0x00, + .bInterfaceNumber = 0x00, + .bAlternateSetting = 0x00, + .bNumEndpoints = 0x03, + .bInterfaceClass = 0x00, .bInterfaceSubClass = 0x00, .bInterfaceProtocol = 0x00, - .iInterface = 0x00})); + .iInterface = 0x00})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_ENDPOINT, UsbDeviceEndpoint{ .bEndpointAddress = 0x01, - .bmAttributes = 0x02, - .wMaxPacketSize = 0x0040, - .bInterval = 0x00})); + .bmAttributes = 0x02, + .wMaxPacketSize = 0x0040, + .bInterval = 0x00})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_ENDPOINT, UsbDeviceEndpoint{ .bEndpointAddress = 0x82, - .bmAttributes = 0x02, - .wMaxPacketSize = 0x0040, - .bInterval = 0x00})); + .bmAttributes = 0x02, + .wMaxPacketSize = 0x0040, + .bInterval = 0x00})); config0.add_node(UsbDescriptorNode(USB_DESCRIPTOR_ENDPOINT, UsbDeviceEndpoint{ .bEndpointAddress = 0x83, - .bmAttributes = 0x03, - .wMaxPacketSize = 0x0008, - .bInterval = 16})); + .bmAttributes = 0x03, + .wMaxPacketSize = 0x0008, + .bInterval = 16})); load_backup(); } @@ -142,12 +142,12 @@ void usb_device_usio::control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue transfer->fake = true; // Control transfers are nearly instant - //switch (bmRequestType) + // switch (bmRequestType) { - //default: - // Follow to default emulated handler + // default: + // Follow to default emulated handler usb_device_emulated::control_transfer(bmRequestType, bRequest, wValue, wIndex, wLength, buf_size, buf, transfer); - //break; + // break; } } @@ -214,57 +214,59 @@ void usb_device_usio::translate_input_taiko() { const auto& cfg = ::at32(g_cfg_usio.players, pad_number); cfg->handle_input(pad, false, [&](usio_btn btn, pad_button /*pad_btn*/, u16 /*value*/, bool pressed, bool& /*abort*/) - { - switch (btn) { - case usio_btn::test: - if (player != 0) break; - if (pressed && !status.test_key_pressed) // Solve the need to hold the Test key - status.test_on = !status.test_on; - status.test_key_pressed = pressed; - break; - case usio_btn::coin: - if (player != 0) break; - if (pressed && !status.coin_key_pressed) // Ensure only one coin is inserted each time the Coin key is pressed - status.coin_counter++; - status.coin_key_pressed = pressed; - break; - case usio_btn::service: - if (player == 0 && pressed) - digital_input |= 0x4000; - break; - case usio_btn::enter: - if (player == 0 && pressed) - digital_input |= 0x200; - break; - case usio_btn::up: - if (player == 0 && pressed) - digital_input |= 0x2000; - break; - case usio_btn::down: - if (player == 0 && pressed) - digital_input |= 0x1000; - break; - case usio_btn::taiko_hit_side_left: - if (pressed) - std::memcpy(input_buf.data() + 32 + offset, &c_hit, sizeof(u16)); - break; - case usio_btn::taiko_hit_center_right: - if (pressed) - std::memcpy(input_buf.data() + 36 + offset, &c_hit, sizeof(u16)); - break; - case usio_btn::taiko_hit_side_right: - if (pressed) - std::memcpy(input_buf.data() + 38 + offset, &c_hit, sizeof(u16)); - break; - case usio_btn::taiko_hit_center_left: - if (pressed) - std::memcpy(input_buf.data() + 34 + offset, &c_hit, sizeof(u16)); - break; - default: - break; - } - }); + switch (btn) + { + case usio_btn::test: + if (player != 0) + break; + if (pressed && !status.test_key_pressed) // Solve the need to hold the Test key + status.test_on = !status.test_on; + status.test_key_pressed = pressed; + break; + case usio_btn::coin: + if (player != 0) + break; + if (pressed && !status.coin_key_pressed) // Ensure only one coin is inserted each time the Coin key is pressed + status.coin_counter++; + status.coin_key_pressed = pressed; + break; + case usio_btn::service: + if (player == 0 && pressed) + digital_input |= 0x4000; + break; + case usio_btn::enter: + if (player == 0 && pressed) + digital_input |= 0x200; + break; + case usio_btn::up: + if (player == 0 && pressed) + digital_input |= 0x2000; + break; + case usio_btn::down: + if (player == 0 && pressed) + digital_input |= 0x1000; + break; + case usio_btn::taiko_hit_side_left: + if (pressed) + std::memcpy(input_buf.data() + 32 + offset, &c_hit, sizeof(u16)); + break; + case usio_btn::taiko_hit_center_right: + if (pressed) + std::memcpy(input_buf.data() + 36 + offset, &c_hit, sizeof(u16)); + break; + case usio_btn::taiko_hit_side_right: + if (pressed) + std::memcpy(input_buf.data() + 38 + offset, &c_hit, sizeof(u16)); + break; + case usio_btn::taiko_hit_center_left: + if (pressed) + std::memcpy(input_buf.data() + 34 + offset, &c_hit, sizeof(u16)); + break; + default: + break; + } + }); } if (player == 0 && status.test_on) @@ -299,95 +301,95 @@ void usb_device_usio::translate_input_tekken() { const auto& cfg = ::at32(g_cfg_usio.players, pad_number); cfg->handle_input(pad, false, [&](usio_btn btn, pad_button /*pad_btn*/, u16 /*value*/, bool pressed, bool& /*abort*/) - { - switch (btn) { - case usio_btn::test: - if (player % 2 != 0) + switch (btn) + { + case usio_btn::test: + if (player % 2 != 0) + break; + if (pressed && !status.test_key_pressed) // Solve the need to hold the Test button + status.test_on = !status.test_on; + status.test_key_pressed = pressed; break; - if (pressed && !status.test_key_pressed) // Solve the need to hold the Test button - status.test_on = !status.test_on; - status.test_key_pressed = pressed; - break; - case usio_btn::coin: - if (player % 2 != 0) + case usio_btn::coin: + if (player % 2 != 0) + break; + if (pressed && !status.coin_key_pressed) // Ensure only one coin is inserted each time the Coin button is pressed + status.coin_counter++; + status.coin_key_pressed = pressed; + break; + case usio_btn::service: + if (player % 2 == 0 && pressed) + input |= 0x4000; + break; + case usio_btn::enter: + if (pressed) + { + input |= 0x800000ULL << shift; + if (player == 0) + digital_input_lm |= 0x800; + } + break; + case usio_btn::up: + if (pressed) + { + input |= 0x200000ULL << shift; + if (player == 0) + digital_input_lm |= 0x200; + } + break; + case usio_btn::down: + if (pressed) + { + input |= 0x100000ULL << shift; + if (player == 0) + digital_input_lm |= 0x400; + } + break; + case usio_btn::left: + if (pressed) + { + input |= 0x80000ULL << shift; + if (player == 0) + digital_input_lm |= 0x2000; + } + break; + case usio_btn::right: + if (pressed) + { + input |= 0x40000ULL << shift; + if (player == 0) + digital_input_lm |= 0x4000; + } + break; + case usio_btn::tekken_button1: + if (pressed) + { + input |= 0x20000ULL << shift; + if (player == 0) + digital_input_lm |= 0x100; + } + break; + case usio_btn::tekken_button2: + if (pressed) + input |= 0x10000ULL << shift; + break; + case usio_btn::tekken_button3: + if (pressed) + input |= 0x40000000ULL << shift; + break; + case usio_btn::tekken_button4: + if (pressed) + input |= 0x20000000ULL << shift; + break; + case usio_btn::tekken_button5: + if (pressed) + input |= 0x80000000ULL << shift; + break; + default: break; - if (pressed && !status.coin_key_pressed) // Ensure only one coin is inserted each time the Coin button is pressed - status.coin_counter++; - status.coin_key_pressed = pressed; - break; - case usio_btn::service: - if (player % 2 == 0 && pressed) - input |= 0x4000; - break; - case usio_btn::enter: - if (pressed) - { - input |= 0x800000ULL << shift; - if (player == 0) - digital_input_lm |= 0x800; } - break; - case usio_btn::up: - if (pressed) - { - input |= 0x200000ULL << shift; - if (player == 0) - digital_input_lm |= 0x200; - } - break; - case usio_btn::down: - if (pressed) - { - input |= 0x100000ULL << shift; - if (player == 0) - digital_input_lm |= 0x400; - } - break; - case usio_btn::left: - if (pressed) - { - input |= 0x80000ULL << shift; - if (player == 0) - digital_input_lm |= 0x2000; - } - break; - case usio_btn::right: - if (pressed) - { - input |= 0x40000ULL << shift; - if (player == 0) - digital_input_lm |= 0x4000; - } - break; - case usio_btn::tekken_button1: - if (pressed) - { - input |= 0x20000ULL << shift; - if (player == 0) - digital_input_lm |= 0x100; - } - break; - case usio_btn::tekken_button2: - if (pressed) - input |= 0x10000ULL << shift; - break; - case usio_btn::tekken_button3: - if (pressed) - input |= 0x40000000ULL << shift; - break; - case usio_btn::tekken_button4: - if (pressed) - input |= 0x20000000ULL << shift; - break; - case usio_btn::tekken_button5: - if (pressed) - input |= 0x80000000ULL << shift; - break; - default: - break; - } - }); + }); } if (player % 2 == 0 && status.test_on) @@ -437,7 +439,7 @@ void usb_device_usio::usio_write(u8 channel, u16 reg, std::vector& data) case 0x000A: { if (get_u16("ClearSram") == 0x6666) - usio_log.trace("ClearSram"); + usio_log.trace("ClearSram"); break; } case 0x0028: @@ -531,7 +533,7 @@ void usb_device_usio::usio_read(u8 channel, u16 reg, u16 size) // Seems to contain a few extra bytes of info in addition to the firmware string // Firmware // "NBGI.;USIO01;Ver1.00;JPN,Multipurpose with PPG." - constexpr std::array info {0x4E, 0x42, 0x47, 0x49, 0x2E, 0x3B, 0x55, 0x53, 0x49, 0x4F, 0x30, 0x31, 0x3B, 0x56, 0x65, 0x72, 0x31, 0x2E, 0x30, 0x30, 0x3B, 0x4A, 0x50, 0x4E, 0x2C, 0x4D, 0x75, 0x6C, 0x74, 0x69, 0x70, 0x75, 0x72, 0x70, 0x6F, 0x73, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x50, 0x50, 0x47, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x42, 0x47, 0x49, 0x31, 0x3B, 0x55, 0x53, 0x49, 0x4F, 0x30, 0x31, 0x3B, 0x56, 0x65, 0x72, 0x31, 0x2E, 0x30, 0x30, 0x3B, 0x4A, 0x50, 0x4E, 0x2C, 0x4D, 0x75, 0x6C, 0x74, 0x69, 0x70, 0x75, 0x72, 0x70, 0x6F, 0x73, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x50, 0x50, 0x47, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x13, 0x00, 0x30, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x02, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x75, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x42, 0x47, 0x49, 0x32, 0x3B, 0x55, 0x53, 0x49, 0x4F, 0x30, 0x31, 0x3B, 0x56, 0x65, 0x72, 0x31, 0x2E, 0x30, 0x30, 0x3B, 0x4A, 0x50, 0x4E, 0x2C, 0x4D, 0x75, 0x6C, 0x74, 0x69, 0x70, 0x75, 0x72, 0x70, 0x6F, 0x73, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x50, 0x50, 0x47, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x13, 0x00, 0x30, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x02, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x75, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + constexpr std::array info{0x4E, 0x42, 0x47, 0x49, 0x2E, 0x3B, 0x55, 0x53, 0x49, 0x4F, 0x30, 0x31, 0x3B, 0x56, 0x65, 0x72, 0x31, 0x2E, 0x30, 0x30, 0x3B, 0x4A, 0x50, 0x4E, 0x2C, 0x4D, 0x75, 0x6C, 0x74, 0x69, 0x70, 0x75, 0x72, 0x70, 0x6F, 0x73, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x50, 0x50, 0x47, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x42, 0x47, 0x49, 0x31, 0x3B, 0x55, 0x53, 0x49, 0x4F, 0x30, 0x31, 0x3B, 0x56, 0x65, 0x72, 0x31, 0x2E, 0x30, 0x30, 0x3B, 0x4A, 0x50, 0x4E, 0x2C, 0x4D, 0x75, 0x6C, 0x74, 0x69, 0x70, 0x75, 0x72, 0x70, 0x6F, 0x73, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x50, 0x50, 0x47, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x13, 0x00, 0x30, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x02, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x75, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x42, 0x47, 0x49, 0x32, 0x3B, 0x55, 0x53, 0x49, 0x4F, 0x30, 0x31, 0x3B, 0x56, 0x65, 0x72, 0x31, 0x2E, 0x30, 0x30, 0x3B, 0x4A, 0x50, 0x4E, 0x2C, 0x4D, 0x75, 0x6C, 0x74, 0x69, 0x70, 0x75, 0x72, 0x70, 0x6F, 0x73, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x50, 0x50, 0x47, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x13, 0x00, 0x30, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x02, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x75, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; response = {info.begin() + (reg - 0x1800), info.end()}; break; } @@ -596,17 +598,17 @@ void usb_device_usio::usio_init(u8 channel, u16 reg, u16 size) void usb_device_usio::interrupt_transfer(u32 buf_size, u8* buf, u32 endpoint, UsbTransfer* transfer) { constexpr u8 USIO_COMMAND_WRITE = 0x90; - constexpr u8 USIO_COMMAND_READ = 0x10; - constexpr u8 USIO_COMMAND_INIT = 0xA0; + constexpr u8 USIO_COMMAND_READ = 0x10; + constexpr u8 USIO_COMMAND_INIT = 0xA0; static bool expecting_data = false; static std::vector usio_data; static u32 response_seek = 0; - static u8 usio_channel = 0; + static u8 usio_channel = 0; static u16 usio_register = 0; - static u16 usio_length = 0; + static u16 usio_length = 0; - transfer->fake = true; + transfer->fake = true; transfer->expected_result = HC_CC_NOERR; // The latency varies per operation but it doesn't seem to matter for this device so let's go fast! transfer->expected_time = get_timestamp() + 1'000; @@ -640,9 +642,9 @@ void usb_device_usio::interrupt_transfer(u32 buf_size, u8* buf, u32 endpoint, Us return; } - usio_channel = buf[0] & 0xF; + usio_channel = buf[0] & 0xF; usio_register = *reinterpret_cast*>(&buf[2]); - usio_length = *reinterpret_cast*>(&buf[4]); + usio_length = *reinterpret_cast*>(&buf[4]); if ((buf[0] & USIO_COMMAND_WRITE) == USIO_COMMAND_WRITE) { diff --git a/rpcs3/rpcs3/Emu/Io/usio_config.h b/rpcs3/rpcs3/Emu/Io/usio_config.h index 4c5fe6f01..5ce4fba92 100644 --- a/rpcs3/rpcs3/Emu/Io/usio_config.h +++ b/rpcs3/rpcs3/Emu/Io/usio_config.h @@ -29,18 +29,18 @@ struct cfg_usio final : public emulated_pad_config { cfg_usio(node* owner, const std::string& name) : emulated_pad_config(owner, name) {} - cfg_pad_btn test{ this, "Test", usio_btn::test, pad_button::select }; - cfg_pad_btn coin{ this, "Coin", usio_btn::coin, pad_button::L3 }; + cfg_pad_btn test{this, "Test", usio_btn::test, pad_button::select}; + cfg_pad_btn coin{this, "Coin", usio_btn::coin, pad_button::L3}; cfg_pad_btn service{this, "Service", usio_btn::service, pad_button::R3}; - cfg_pad_btn enter{ this, "Enter/Start", usio_btn::enter, pad_button::start }; - cfg_pad_btn up{ this, "Up", usio_btn::up, pad_button::dpad_up }; - cfg_pad_btn down{ this, "Down", usio_btn::down, pad_button::dpad_down }; + cfg_pad_btn enter{this, "Enter/Start", usio_btn::enter, pad_button::start}; + cfg_pad_btn up{this, "Up", usio_btn::up, pad_button::dpad_up}; + cfg_pad_btn down{this, "Down", usio_btn::down, pad_button::dpad_down}; cfg_pad_btn left{this, "Left", usio_btn::left, pad_button::dpad_left}; cfg_pad_btn right{this, "Right", usio_btn::right, pad_button::dpad_right}; - cfg_pad_btn taiko_hit_side_left{ this, "Taiko Hit Side Left", usio_btn::taiko_hit_side_left, pad_button::square }; - cfg_pad_btn taiko_hit_side_right{ this, "Taiko Hit Side Right", usio_btn::taiko_hit_side_right, pad_button::circle }; - cfg_pad_btn taiko_hit_center_left{ this, "Taiko Hit Center Left", usio_btn::taiko_hit_center_left, pad_button::triangle }; - cfg_pad_btn taiko_hit_center_right{ this, "Taiko Hit Center Right", usio_btn::taiko_hit_center_right, pad_button::cross }; + cfg_pad_btn taiko_hit_side_left{this, "Taiko Hit Side Left", usio_btn::taiko_hit_side_left, pad_button::square}; + cfg_pad_btn taiko_hit_side_right{this, "Taiko Hit Side Right", usio_btn::taiko_hit_side_right, pad_button::circle}; + cfg_pad_btn taiko_hit_center_left{this, "Taiko Hit Center Left", usio_btn::taiko_hit_center_left, pad_button::triangle}; + cfg_pad_btn taiko_hit_center_right{this, "Taiko Hit Center Right", usio_btn::taiko_hit_center_right, pad_button::cross}; cfg_pad_btn tekken_button1{this, "Tekken Button 1", usio_btn::tekken_button1, pad_button::square}; cfg_pad_btn tekken_button2{this, "Tekken Button 2", usio_btn::tekken_button2, pad_button::triangle}; cfg_pad_btn tekken_button3{this, "Tekken Button 3", usio_btn::tekken_button3, pad_button::cross}; diff --git a/rpcs3/rpcs3/Emu/Memory/vm.cpp b/rpcs3/rpcs3/Emu/Memory/vm.cpp index 91bd965ee..421b7990f 100644 --- a/rpcs3/rpcs3/Emu/Memory/vm.cpp +++ b/rpcs3/rpcs3/Emu/Memory/vm.cpp @@ -141,23 +141,24 @@ namespace vm break; } - if (++i == max) i = 0; + if (++i == max) + i = 0; } } atomic_t* alloc_range_lock() { const auto [bits, ok] = get_range_lock_bits(false).fetch_op([](u64& bits) - { - // MSB is reserved for locking with memory setting changes - if ((~(bits | (bits + 1))) << 1) [[likely]] { - bits |= bits + 1; - return true; - } + // MSB is reserved for locking with memory setting changes + if ((~(bits | (bits + 1))) << 1) [[likely]] + { + bits |= bits + 1; + return true; + } - return false; - }); + return false; + }); if (!ok) [[unlikely]] { @@ -186,34 +187,34 @@ namespace vm const u64 is_share = g_shmem[begin >> 16].load(); const u64 busy = for_all_range_locks(get_range_lock_bits(true), [&](u64 addr_exec, u32 size_exec) - { - u64 addr = begin; - - if ((size_exec & (range_full_mask >> 32)) == (range_locked >> 32)) [[likely]] { - size_exec = 128; + u64 addr = begin; - if (is_share) + if ((size_exec & (range_full_mask >> 32)) == (range_locked >> 32)) [[likely]] { - addr = static_cast(addr) | is_share; + size_exec = 128; + + if (is_share) + { + addr = static_cast(addr) | is_share; + } } - } - size_exec = (size_exec << range_bits) >> range_bits; + size_exec = (size_exec << range_bits) >> range_bits; - // TODO (currently not possible): handle 2 64K pages (inverse range), or more pages - if (u64 is_shared = g_shmem[addr_exec >> 16]) [[unlikely]] - { - addr_exec = static_cast(addr_exec) | is_shared; - } + // TODO (currently not possible): handle 2 64K pages (inverse range), or more pages + if (u64 is_shared = g_shmem[addr_exec >> 16]) [[unlikely]] + { + addr_exec = static_cast(addr_exec) | is_shared; + } - if (addr <= addr_exec + size_exec - 1 && addr_exec <= addr + size - 1) [[unlikely]] - { - return 1; - } + if (addr <= addr_exec + size_exec - 1 && addr_exec <= addr + size - 1) [[unlikely]] + { + return 1; + } - return 0; - }); + return 0; + }); if (!busy) [[likely]] { @@ -349,14 +350,14 @@ namespace vm while (to_clear) { to_clear = for_all_range_locks(to_clear, [&](u32 addr2, u32 size2) - { - if (range.overlaps(utils::address_range::start_length(addr2, size2))) [[unlikely]] { - return 1; - } + if (range.overlaps(utils::address_range::start_length(addr2, size2))) [[unlikely]] + { + return 1; + } - return 0; - }); + return 0; + }); if (!to_clear) [[likely]] { @@ -562,29 +563,29 @@ namespace vm while (true) { to_clear = for_all_range_locks(to_clear & ~get_range_lock_bits(true), [&](u64 addr2, u32 size2) - { - // Split and check every 64K page separately - for (u64 hi = addr2 >> 16, max = (addr2 + size2 - 1) >> 16; hi <= max; hi++) { - u64 addr3 = addr2; - u64 size3 = std::min(addr2 + size2, utils::align(addr2, 0x10000)) - addr2; - - if (u64 is_shared = g_shmem[hi]) [[unlikely]] + // Split and check every 64K page separately + for (u64 hi = addr2 >> 16, max = (addr2 + size2 - 1) >> 16; hi <= max; hi++) { - addr3 = static_cast(addr2) | is_shared; + u64 addr3 = addr2; + u64 size3 = std::min(addr2 + size2, utils::align(addr2, 0x10000)) - addr2; + + if (u64 is_shared = g_shmem[hi]) [[unlikely]] + { + addr3 = static_cast(addr2) | is_shared; + } + + if (point - (addr3 / 128) <= (addr3 + size3 - 1) / 128 - (addr3 / 128)) [[unlikely]] + { + return 1; + } + + addr2 += size3; + size2 -= static_cast(size3); } - if (point - (addr3 / 128) <= (addr3 + size3 - 1) / 128 - (addr3 / 128)) [[unlikely]] - { - return 1; - } - - addr2 += size3; - size2 -= static_cast(size3); - } - - return 0; - }); + return 0; + }); if (!to_clear) [[likely]] { @@ -661,15 +662,15 @@ namespace vm for (u64 i = 0;; i++) { auto [_oldd, _ok] = res.fetch_op([&](u64& r) - { - if (r & rsrv_unique_lock) { - return false; - } + if (r & rsrv_unique_lock) + { + return false; + } - r += 1; - return true; - }); + r += 1; + return true; + }); if (_ok) [[likely]] { @@ -697,18 +698,18 @@ namespace vm auto* ptr = vm::get_super_ptr(addr & -128); cpu_thread::suspend_all<+1>(get_current_cpu_thread(), {ptr, ptr + 64, &res}, [&] - { - if (func()) { - // Success, release the lock and progress - res += 127; - } - else - { - // Only release the lock on failure - res -= 1; - } - }); + if (func()) + { + // Success, release the lock and progress + res += 127; + } + else + { + // Only release the lock on failure + res -= 1; + } + }); } [[noreturn]] void reservation_escape_internal() @@ -882,8 +883,8 @@ namespace vm const u8 flags_both = flags_set & flags_clear; - flags_test |= page_allocated; - flags_set &= ~flags_both; + flags_test |= page_allocated; + flags_set &= ~flags_both; flags_clear &= ~flags_both; if (!check_addr(addr, flags_test, size)) @@ -1202,28 +1203,28 @@ namespace vm // Map "real" memory pages; provide a function to search for mirrors with private member access _page_map(page_addr, flags, page_size, shm.get(), this->flags, [](vm::block_t* _this, utils::shm* shm) - { - auto& map = (_this->m.*block_map)(); - - std::remove_reference_t::value_type* result = nullptr; - - // Check eligibility - if (!_this || !(page_size_mask & _this->flags) || _this->addr < 0x20000000 || _this->addr >= 0xC0000000) { - return result; - } + auto& map = (_this->m.*block_map)(); - for (auto& pp : map) - { - if (pp.second.second.get() == shm) + std::remove_reference_t::value_type* result = nullptr; + + // Check eligibility + if (!_this || !(page_size_mask & _this->flags) || _this->addr < 0x20000000 || _this->addr >= 0xC0000000) { - // Found match - return &pp; + return result; } - } - return result; - }); + for (auto& pp : map) + { + if (pp.second.second.get() == shm) + { + // Found match + return &pp; + } + } + + return result; + }); // Fill stack guards with STACKGRD if (this->flags & stack_guarded) @@ -1233,9 +1234,9 @@ namespace vm #if defined(_M_X64) && defined(_MSC_VER) __stosq(reinterpret_cast(ptr), data, count); #elif defined(ARCH_X64) - __asm__ ("mov %0, %%rdi; mov %1, %%rax; mov %2, %%rcx; rep stosq;" + __asm__("mov %0, %%rdi; mov %1, %%rax; mov %2, %%rcx; rep stosq;" : - : "r" (ptr), "r" (data), "r" (count) + : "r"(ptr), "r"(data), "r"(count) : "rdi", "rax", "rcx", "memory"); #else for (usz i = 0; i < count; i++) @@ -1280,10 +1281,7 @@ namespace vm } block_t::block_t(u32 addr, u32 size, u64 flags) - : m_id(init_block_id()) - , addr(addr) - , size(size) - , flags(process_block_flags(flags)) + : m_id(init_block_id()), addr(addr), size(size), flags(process_block_flags(flags)) { if (this->flags & preallocated) { @@ -1770,10 +1768,7 @@ namespace vm } block_t::block_t(utils::serial& ar, std::vector>& shared) - : m_id(init_block_id()) - , addr(ar) - , size(ar) - , flags(ar) + : m_id(init_block_id()), addr(ar), size(ar), flags(ar) { if (flags & preallocated) { @@ -1971,7 +1966,8 @@ namespace vm auto block = _find_map(size, align, flags); - if (block) g_locations.emplace_back(block); + if (block) + g_locations.emplace_back(block); return block; } @@ -2197,31 +2193,31 @@ namespace vm void init() { vm_log.notice("Guest memory bases address ranges:\n" - "vm::g_base_addr = %p - %p\n" - "vm::g_sudo_addr = %p - %p\n" - "vm::g_exec_addr = %p - %p\n" - "vm::g_hook_addr = %p - %p\n" - "vm::g_stat_addr = %p - %p\n" - "vm::g_reservations = %p - %p\n", - g_base_addr, g_base_addr + 0xffff'ffff, - g_sudo_addr, g_sudo_addr + 0xffff'ffff, - g_exec_addr, g_exec_addr + 0x200000000 - 1, - g_hook_addr, g_hook_addr + 0x800000000 - 1, - g_stat_addr, g_stat_addr + 0xffff'ffff, - g_reservations, g_reservations + sizeof(g_reservations) - 1); + "vm::g_base_addr = %p - %p\n" + "vm::g_sudo_addr = %p - %p\n" + "vm::g_exec_addr = %p - %p\n" + "vm::g_hook_addr = %p - %p\n" + "vm::g_stat_addr = %p - %p\n" + "vm::g_reservations = %p - %p\n", + g_base_addr, g_base_addr + 0xffff'ffff, + g_sudo_addr, g_sudo_addr + 0xffff'ffff, + g_exec_addr, g_exec_addr + 0x200000000 - 1, + g_hook_addr, g_hook_addr + 0x800000000 - 1, + g_stat_addr, g_stat_addr + 0xffff'ffff, + g_reservations, g_reservations + sizeof(g_reservations) - 1); std::memset(&g_pages, 0, sizeof(g_pages)); g_locations = - { - std::make_shared(0x00010000, 0x0FFF0000, page_size_64k | preallocated), // main - nullptr, // user 64k pages - nullptr, // user 1m pages - nullptr, // rsx context - std::make_shared(0xC0000000, 0x10000000, page_size_64k | preallocated), // video - std::make_shared(0xD0000000, 0x10000000, page_size_4k | preallocated | stack_guarded | bf0_0x1), // stack - std::make_shared(0xE0000000, 0x20000000, page_size_64k), // SPU reserved - }; + { + std::make_shared(0x00010000, 0x0FFF0000, page_size_64k | preallocated), // main + nullptr, // user 64k pages + nullptr, // user 1m pages + nullptr, // rsx context + std::make_shared(0xC0000000, 0x10000000, page_size_64k | preallocated), // video + std::make_shared(0xD0000000, 0x10000000, page_size_4k | preallocated | stack_guarded | bf0_0x1), // stack + std::make_shared(0xE0000000, 0x20000000, page_size_64k), // SPU reserved + }; std::memset(g_reservations, 0, sizeof(g_reservations)); std::memset(g_shmem, 0, sizeof(g_shmem)); @@ -2233,7 +2229,7 @@ namespace vm #endif ensure(s_hook.map(g_hook_addr, utils::protection::rw, true)); } - } + } // namespace ps3_ void close() { @@ -2242,7 +2238,8 @@ namespace vm for (auto& block : g_locations) { - if (block) _unmap_block(block); + if (block) + _unmap_block(block); } g_locations.clear(); @@ -2270,13 +2267,18 @@ namespace vm for (auto& loc : g_locations) { - if (loc) loc->get_shared_memory(shared); + if (loc) + loc->get_shared_memory(shared); } std::map shared_map; #ifndef _MSC_VER - shared.erase(std::unique(shared.begin(), shared.end(), [](auto& a, auto& b) { return a.first == b.first; }), shared.end()); + shared.erase(std::unique(shared.begin(), shared.end(), [](auto& a, auto& b) + { + return a.first == b.first; + }), + shared.end()); #else // Workaround for bugged std::unique for (auto it = shared.begin(); it != shared.end();) @@ -2356,7 +2358,8 @@ namespace vm for (auto& block : g_locations) { - if (block) _unmap_block(block); + if (block) + _unmap_block(block); } g_locations.clear(); @@ -2433,7 +2436,7 @@ namespace vm // Non-null terminated but terminated by size limit (so the string may continue) return size == max_size; } -} +} // namespace vm void fmt_class_string>::format(std::string& out, u64 arg) { diff --git a/rpcs3/rpcs3/Emu/Memory/vm.h b/rpcs3/rpcs3/Emu/Memory/vm.h index 915791e2d..3f540fe2a 100644 --- a/rpcs3/rpcs3/Emu/Memory/vm.h +++ b/rpcs3/rpcs3/Emu/Memory/vm.h @@ -23,7 +23,7 @@ namespace utils { class shm; class address_range; -} +} // namespace utils namespace vm { @@ -52,20 +52,22 @@ namespace vm enum page_info_t : u8 { - page_readable = (1 << 0), - page_writable = (1 << 1), - page_executable = (1 << 2), + page_readable = (1 << 0), + page_writable = (1 << 1), + page_executable = (1 << 2), page_fault_notification = (1 << 3), - page_no_reservations = (1 << 4), - page_64k_size = (1 << 5), - page_1m_size = (1 << 6), + page_no_reservations = (1 << 4), + page_64k_size = (1 << 5), + page_1m_size = (1 << 6), - page_allocated = (1 << 7), + page_allocated = (1 << 7), }; // Address type - enum addr_t : u32 {}; + enum addr_t : u32 + { + }; // Page information using memory_page = atomic_t; @@ -107,13 +109,13 @@ namespace vm enum block_flags_3 { - page_size_4k = 0x100, // SYS_MEMORY_PAGE_SIZE_4K - page_size_64k = 0x200, // SYS_MEMORY_PAGE_SIZE_64K - page_size_1m = 0x400, // SYS_MEMORY_PAGE_SIZE_1M + page_size_4k = 0x100, // SYS_MEMORY_PAGE_SIZE_4K + page_size_64k = 0x200, // SYS_MEMORY_PAGE_SIZE_64K + page_size_1m = 0x400, // SYS_MEMORY_PAGE_SIZE_1M page_size_mask = 0xF00, // SYS_MEMORY_PAGE_SIZE_MASK - stack_guarded = 0x10, - preallocated = 0x20, // nonshareable + stack_guarded = 0x10, + preallocated = 0x20, // nonshareable bf0_0x1 = 0x1, // TODO: document bf0_0x2 = 0x2, // TODO: document @@ -152,12 +154,12 @@ namespace vm ~block_t(); public: - const u32 addr; // Start address - const u32 size; // Total size + const u32 addr; // Start address + const u32 size; // Total size const u64 flags; // Byte 0xF000: block_flags_3 - // Byte 0x0F00: block_flags_2_page_size (SYS_MEMORY_PAGE_SIZE_*) - // Byte 0x00F0: block_flags_1 - // Byte 0x000F: block_flags_0 + // Byte 0x0F00: block_flags_2_page_size (SYS_MEMORY_PAGE_SIZE_*) + // Byte 0x00F0: block_flags_1 + // Byte 0x000F: block_flags_0 // Search and map memory (min alignment is 0x10000) u32 alloc(u32 size, const std::shared_ptr* = nullptr, u32 align = 0x10000, u64 flags = 0); @@ -229,20 +231,23 @@ namespace vm return vm::addr_t{static_cast(uptr(ptr))}; } - template requires (std::is_integral_v && (sizeof(+T{}) > 4 || std::is_signed_v)) + template + requires(std::is_integral_v && (sizeof(+T{}) > 4 || std::is_signed_v)) vm::addr_t cast(const T& addr, std::source_location src_loc = std::source_location::current()) { return vm::addr_t{::narrow(+addr, src_loc)}; } - template requires (std::is_integral_v && (sizeof(+T{}) <= 4 && !std::is_signed_v)) + template + requires(std::is_integral_v && (sizeof(+T{}) <= 4 && !std::is_signed_v)) vm::addr_t cast(const T& addr, u32 = 0, u32 = 0, const char* = nullptr, const char* = nullptr) { return vm::addr_t{static_cast(+addr)}; } // Convert specified PS3/PSV virtual memory address to a pointer for common access - template requires (std::is_integral_v) + template + requires(std::is_integral_v) inline void* base(T addr) { return g_base_addr + static_cast(vm::cast(addr)); @@ -276,13 +281,15 @@ namespace vm inline namespace ps3_ { // Convert specified PS3 address to a pointer of specified (possibly converted to BE) type - template inline to_be_t* _ptr(const U& addr) + template + inline to_be_t* _ptr(const U& addr) { return static_cast*>(base(addr)); } // Convert specified PS3 address to a reference of specified (possibly converted to BE) type - template inline to_be_t& _ref(const U& addr) + template + inline to_be_t& _ref(const U& addr) { return *static_cast*>(base(addr)); } @@ -361,7 +368,7 @@ namespace vm } void init(); - } + } // namespace ps3_ void close(); @@ -376,4 +383,4 @@ namespace vm template class _ref_base; -} +} // namespace vm diff --git a/rpcs3/rpcs3/Emu/Memory/vm_locking.h b/rpcs3/rpcs3/Emu/Memory/vm_locking.h index c4d805554..40649031c 100644 --- a/rpcs3/rpcs3/Emu/Memory/vm_locking.h +++ b/rpcs3/rpcs3/Emu/Memory/vm_locking.h @@ -22,7 +22,7 @@ namespace vm /* flag combinations with special meaning */ range_locked = 4ull << 61, // R+W as well, but being exclusively accessed (size extends addr) - range_allocation = 0, // Allocation, no safe access, g_shmem may change at ANY location + range_allocation = 0, // Allocation, no safe access, g_shmem may change at ANY location range_pos = 61, range_bits = 3, @@ -66,9 +66,9 @@ namespace vm return; } - #ifndef _MSC_VER +#ifndef _MSC_VER __asm__(""); // Tiny barrier - #endif +#endif if (!g_range_lock_bits[1]) [[likely]] { diff --git a/rpcs3/rpcs3/Emu/Memory/vm_ptr.h b/rpcs3/rpcs3/Emu/Memory/vm_ptr.h index 5081e0701..ac7588013 100644 --- a/rpcs3/rpcs3/Emu/Memory/vm_ptr.h +++ b/rpcs3/rpcs3/Emu/Memory/vm_ptr.h @@ -14,8 +14,8 @@ namespace vm class _ref_base; // Enables comparison between comparable types of pointers - template - concept PtrComparable = requires (T1* t1, T2* t2) { t1 == t2; }; + template + concept PtrComparable = requires(T1* t1, T2* t2) { t1 == t2; }; template class _ptr_base @@ -56,7 +56,8 @@ namespace vm } // Enable only the conversions which are originally possible between pointer types - template requires (std::is_convertible_v) + template + requires(std::is_convertible_v) operator _ptr_base() const noexcept { return vm::cast(m_addr); @@ -68,35 +69,40 @@ namespace vm } // Get vm pointer to a struct member - template requires PtrComparable - _ptr_base ptr(MT T2::*const mptr) const + template + requires PtrComparable + _ptr_base ptr(MT T2::* const mptr) const { return vm::cast(vm::cast(m_addr) + offset32(mptr)); } // Get vm pointer to a struct member with array subscription - template > requires PtrComparable - _ptr_base ptr(MT T2::*const mptr, u32 index) const + template > + requires PtrComparable + _ptr_base ptr(MT T2::* const mptr, u32 index) const { return vm::cast(vm::cast(m_addr) + offset32(mptr) + u32{sizeof(ET)} * index); } // Get vm reference to a struct member - template requires PtrComparable && (!std::is_void_v) - _ref_base ref(MT T2::*const mptr) const + template + requires PtrComparable && (!std::is_void_v) + _ref_base ref(MT T2::* const mptr) const { return vm::cast(vm::cast(m_addr) + offset32(mptr)); } // Get vm reference to a struct member with array subscription - template > requires PtrComparable && (!std::is_void_v) - _ref_base ref(MT T2::*const mptr, u32 index) const + template > + requires PtrComparable && (!std::is_void_v) + _ref_base ref(MT T2::* const mptr, u32 index) const { return vm::cast(vm::cast(m_addr) + offset32(mptr) + u32{sizeof(ET)} * index); } // Get vm reference - _ref_base ref() const requires (!std::is_void_v) + _ref_base ref() const + requires(!std::is_void_v) { return vm::cast(m_addr); } @@ -112,17 +118,20 @@ namespace vm return static_cast(vm::base(vm::cast(m_addr))); } - T* operator ->() const requires (!std::is_void_v) + T* operator->() const + requires(!std::is_void_v) { return get_ptr(); } - std::add_lvalue_reference_t operator *() const requires (!std::is_void_v) + std::add_lvalue_reference_t operator*() const + requires(!std::is_void_v) { return *get_ptr(); } - std::add_lvalue_reference_t operator [](u32 index) const requires (!std::is_void_v) + std::add_lvalue_reference_t operator[](u32 index) const + requires(!std::is_void_v) { AUDIT(m_addr); @@ -136,95 +145,110 @@ namespace vm } // Get type size - static constexpr u32 size() noexcept requires (!std::is_void_v) + static constexpr u32 size() noexcept + requires(!std::is_void_v) { return sizeof(T); } // Get type alignment - static constexpr u32 align() noexcept requires (!std::is_void_v) + static constexpr u32 align() noexcept + requires(!std::is_void_v) { return alignof(T); } - _ptr_base operator +() const + _ptr_base operator+() const { return vm::cast(m_addr); } - _ptr_base operator +(u32 count) const requires (!std::is_void_v) + _ptr_base operator+(u32 count) const + requires(!std::is_void_v) { return vm::cast(vm::cast(m_addr) + count * size()); } - _ptr_base operator -(u32 count) const requires (!std::is_void_v) + _ptr_base operator-(u32 count) const + requires(!std::is_void_v) { return vm::cast(vm::cast(m_addr) - count * size()); } - friend _ptr_base operator +(u32 count, const _ptr_base& ptr) requires (!std::is_void_v) + friend _ptr_base operator+(u32 count, const _ptr_base& ptr) + requires(!std::is_void_v) { return vm::cast(vm::cast(ptr.m_addr) + count * size()); } // Pointer difference operator - template requires (std::is_object_v && std::is_same_v, std::decay_t>) - s32 operator -(const _ptr_base& right) const + template + requires(std::is_object_v && std::is_same_v, std::decay_t>) + s32 operator-(const _ptr_base& right) const { return static_cast(vm::cast(m_addr) - vm::cast(right.m_addr)) / size(); } - _ptr_base operator ++(int) requires (!std::is_void_v) + _ptr_base operator++(int) + requires(!std::is_void_v) { _ptr_base result = *this; m_addr = vm::cast(m_addr) + size(); return result; } - _ptr_base& operator ++() requires (!std::is_void_v) + _ptr_base& operator++() + requires(!std::is_void_v) { m_addr = vm::cast(m_addr) + size(); return *this; } - _ptr_base operator --(int) requires (!std::is_void_v) + _ptr_base operator--(int) + requires(!std::is_void_v) { _ptr_base result = *this; m_addr = vm::cast(m_addr) - size(); return result; } - _ptr_base& operator --() requires (!std::is_void_v) + _ptr_base& operator--() + requires(!std::is_void_v) { m_addr = vm::cast(m_addr) - size(); return *this; } - _ptr_base& operator +=(s32 count) requires (!std::is_void_v) + _ptr_base& operator+=(s32 count) + requires(!std::is_void_v) { m_addr = vm::cast(m_addr) + count * size(); return *this; } - _ptr_base& operator -=(s32 count) requires (!std::is_void_v) + _ptr_base& operator-=(s32 count) + requires(!std::is_void_v) { m_addr = vm::cast(m_addr) - count * size(); return *this; } - std::pair, char, std::remove_const_t>> try_read() const requires (std::is_copy_constructible_v) + std::pair, char, std::remove_const_t>> try_read() const + requires(std::is_copy_constructible_v) { alignas(sizeof(T) >= 16 ? 16 : 8) char buf[sizeof(T)]{}; const bool ok = vm::try_access(vm::cast(m_addr), buf, sizeof(T), false); - return { ok, std::bit_cast(buf) }; + return {ok, std::bit_cast(buf)}; } - bool try_read(std::conditional_t, char, std::remove_const_t>& out) const requires (!std::is_void_v) + bool try_read(std::conditional_t, char, std::remove_const_t>& out) const + requires(!std::is_void_v) { return vm::try_access(vm::cast(m_addr), std::addressof(out), sizeof(T), false); } - bool try_write(const std::conditional_t, char, T>& _in) const requires (!std::is_void_v) + bool try_write(const std::conditional_t, char, T>& _in) const + requires(!std::is_void_v) { return vm::try_access(vm::cast(m_addr), const_cast(std::addressof(_in)), sizeof(T), true); } @@ -236,7 +260,7 @@ namespace vm } }; - template + template class _ptr_base { AT m_addr; @@ -270,7 +294,7 @@ namespace vm } // Conversion to another function pointer - template + template operator _ptr_base() const { return vm::cast(m_addr); @@ -281,7 +305,7 @@ namespace vm return m_addr != 0u; } - _ptr_base operator +() const + _ptr_base operator+() const { return vm::cast(m_addr); } @@ -297,49 +321,65 @@ namespace vm const ppu_func_opd_t& opd() const; }; - template - class _ptr_base + template + class _ptr_base { static_assert(!sizeof(AT), "vm::_ptr_base<> error: use RT(T...) format for functions instead of RT(*)(T...)"); }; // Native endianness pointer to LE data - template using ptrl = _ptr_base, AT>; - template using cptrl = ptrl; + template + using ptrl = _ptr_base, AT>; + template + using cptrl = ptrl; // Native endianness pointer to BE data - template using ptrb = _ptr_base, AT>; - template using cptrb = ptrb; + template + using ptrb = _ptr_base, AT>; + template + using cptrb = ptrb; // BE pointer to LE data - template using bptrl = _ptr_base, to_be_t>; + template + using bptrl = _ptr_base, to_be_t>; // BE pointer to BE data - template using bptrb = _ptr_base, to_be_t>; + template + using bptrb = _ptr_base, to_be_t>; // LE pointer to LE data - template using lptrl = _ptr_base, to_le_t>; + template + using lptrl = _ptr_base, to_le_t>; // LE pointer to BE data - template using lptrb = _ptr_base, to_le_t>; + template + using lptrb = _ptr_base, to_le_t>; inline namespace ps3_ { // Default pointer type for PS3 HLE functions (Native endianness pointer to BE data) - template using ptr = ptrb; - template using cptr = ptr; + template + using ptr = ptrb; + template + using cptr = ptr; // Default pointer to pointer type for PS3 HLE functions (Native endianness pointer to BE pointer to BE data) - template using pptr = ptr, AT>; - template using cpptr = pptr; + template + using pptr = ptr, AT>; + template + using cpptr = pptr; // Default pointer type for PS3 HLE structures (BE pointer to BE data) - template using bptr = bptrb; - template using bcptr = bptr; + template + using bptr = bptrb; + template + using bcptr = bptr; // Default pointer to pointer type for PS3 HLE structures (BE pointer to BE pointer to BE data) - template using bpptr = bptr, AT>; - template using bcpptr = bpptr; + template + using bpptr = bptr, AT>; + template + using bcpptr = bpptr; // Perform static_cast (for example, vm::ptr to vm::ptr) template @@ -364,24 +404,24 @@ namespace vm { return vm::cast(other.addr()); } - } + } // namespace ps3_ struct null_t { - template + template operator _ptr_base() const { return _ptr_base{}; } - template - constexpr bool operator ==(const _ptr_base& ptr) const + template + constexpr bool operator==(const _ptr_base& ptr) const { return !ptr; } - template - constexpr bool operator <(const _ptr_base& ptr) const + template + constexpr bool operator<(const _ptr_base& ptr) const { return 0 < ptr.addr(); } @@ -389,40 +429,45 @@ namespace vm // Null pointer convertible to any vm::ptr* type constexpr null_t null{}; -} +} // namespace vm -template requires vm::PtrComparable -inline bool operator ==(const vm::_ptr_base& left, const vm::_ptr_base& right) +template + requires vm::PtrComparable +inline bool operator==(const vm::_ptr_base& left, const vm::_ptr_base& right) { return left.addr() == right.addr(); } -template requires vm::PtrComparable -inline bool operator <(const vm::_ptr_base& left, const vm::_ptr_base& right) +template + requires vm::PtrComparable +inline bool operator<(const vm::_ptr_base& left, const vm::_ptr_base& right) { return left.addr() < right.addr(); } -template requires vm::PtrComparable -inline bool operator <=(const vm::_ptr_base& left, const vm::_ptr_base& right) +template + requires vm::PtrComparable +inline bool operator<=(const vm::_ptr_base& left, const vm::_ptr_base& right) { return left.addr() <= right.addr(); } -template requires vm::PtrComparable -inline bool operator >(const vm::_ptr_base& left, const vm::_ptr_base& right) +template + requires vm::PtrComparable +inline bool operator>(const vm::_ptr_base& left, const vm::_ptr_base& right) { return left.addr() > right.addr(); } -template requires vm::PtrComparable -inline bool operator >=(const vm::_ptr_base& left, const vm::_ptr_base& right) +template + requires vm::PtrComparable +inline bool operator>=(const vm::_ptr_base& left, const vm::_ptr_base& right) { return left.addr() >= right.addr(); } // Change AT endianness to BE/LE -template +template struct to_se, Se> { using type = vm::_ptr_base::type>; diff --git a/rpcs3/rpcs3/Emu/Memory/vm_ref.h b/rpcs3/rpcs3/Emu/Memory/vm_ref.h index 59e6daa8f..26e5a0f44 100644 --- a/rpcs3/rpcs3/Emu/Memory/vm_ref.h +++ b/rpcs3/rpcs3/Emu/Memory/vm_ref.h @@ -62,131 +62,139 @@ namespace vm return get_ref(); } - T& operator =(const _ref_base& right) + T& operator=(const _ref_base& right) { return get_ref() = right.get_ref(); } - T& operator =(const std::common_type_t& right) const + T& operator=(const std::common_type_t& right) const { return get_ref() = right; } - decltype(auto) operator ++(int) const + decltype(auto) operator++(int) const { return get_ref()++; } - decltype(auto) operator ++() const + decltype(auto) operator++() const { return ++get_ref(); } - decltype(auto) operator --(int) const + decltype(auto) operator--(int) const { return get_ref()--; } - decltype(auto) operator --() const + decltype(auto) operator--() const { return --get_ref(); } - template - decltype(auto) operator +=(const T2& right) + template + decltype(auto) operator+=(const T2& right) { return get_ref() += right; } - template - decltype(auto) operator -=(const T2& right) + template + decltype(auto) operator-=(const T2& right) { return get_ref() -= right; } - template - decltype(auto) operator *=(const T2& right) + template + decltype(auto) operator*=(const T2& right) { return get_ref() *= right; } - template - decltype(auto) operator /=(const T2& right) + template + decltype(auto) operator/=(const T2& right) { return get_ref() /= right; } - template - decltype(auto) operator %=(const T2& right) + template + decltype(auto) operator%=(const T2& right) { return get_ref() %= right; } - template - decltype(auto) operator &=(const T2& right) + template + decltype(auto) operator&=(const T2& right) { return get_ref() &= right; } - template - decltype(auto) operator |=(const T2& right) + template + decltype(auto) operator|=(const T2& right) { return get_ref() |= right; } - template - decltype(auto) operator ^=(const T2& right) + template + decltype(auto) operator^=(const T2& right) { return get_ref() ^= right; } - template - decltype(auto) operator <<=(const T2& right) + template + decltype(auto) operator<<=(const T2& right) { return get_ref() <<= right; } - template - decltype(auto) operator >>=(const T2& right) + template + decltype(auto) operator>>=(const T2& right) { return get_ref() >>= right; } }; // Native endianness reference to LE data - template using refl = _ref_base, AT>; + template + using refl = _ref_base, AT>; // Native endianness reference to BE data - template using refb = _ref_base, AT>; + template + using refb = _ref_base, AT>; // BE reference to LE data - template using brefl = _ref_base, to_be_t>; + template + using brefl = _ref_base, to_be_t>; // BE reference to BE data - template using brefb = _ref_base, to_be_t>; + template + using brefb = _ref_base, to_be_t>; // LE reference to LE data - template using lrefl = _ref_base, to_le_t>; + template + using lrefl = _ref_base, to_le_t>; // LE reference to BE data - template using lrefb = _ref_base, to_le_t>; + template + using lrefb = _ref_base, to_le_t>; inline namespace ps3_ { // default reference for PS3 HLE functions (Native endianness reference to BE data) - template using ref = refb; + template + using ref = refb; // default reference for PS3 HLE structures (BE reference to BE data) - template using bref = brefb; - } -} + template + using bref = brefb; + } // namespace ps3_ +} // namespace vm #ifndef _MSC_VER #pragma GCC diagnostic pop #endif // Change AT endianness to BE/LE -template +template struct to_se, Se> { using type = vm::_ref_base::type>; diff --git a/rpcs3/rpcs3/Emu/Memory/vm_reservation.h b/rpcs3/rpcs3/Emu/Memory/vm_reservation.h index c9d2e0c50..fd34a36a7 100644 --- a/rpcs3/rpcs3/Emu/Memory/vm_reservation.h +++ b/rpcs3/rpcs3/Emu/Memory/vm_reservation.h @@ -52,14 +52,14 @@ namespace vm constexpr u32 unique_address_bit_mask = 0b11; const usz index = std::popcount(raddr & -1024) + ((raddr / 128) & unique_address_bit_mask) * 32; auto& waiter = g_resrv_waiters_count[index * wait_vars_for_each]; - return { &g_resrv_waiters_count[index * wait_vars_for_each + waiter.load().waiters_index % wait_vars_for_each], &waiter }; + return {&g_resrv_waiters_count[index * wait_vars_for_each + waiter.load().waiters_index % wait_vars_for_each], &waiter}; } // Returns waiter count and index static inline std::pair reservation_notifier_count_index(u32 raddr) { const auto notifiers = reservation_notifier(raddr); - return { notifiers.first->load().waiters_count, static_cast(notifiers.first - notifiers.second) }; + return {notifiers.first->load().waiters_count, static_cast(notifiers.first - notifiers.second)}; } // Returns waiter count @@ -71,12 +71,12 @@ namespace vm static inline void reservation_notifier_end_wait(atomic_t& waiter) { waiter.atomic_op([](reservation_waiter_t& value) - { - if (value.waiters_count-- == 1) { - value.wait_flag = 0; - } - }); + if (value.waiters_count-- == 1) + { + value.wait_flag = 0; + } + }); } static inline atomic_t* reservation_notifier_begin_wait(u32 raddr, u64 rtime) @@ -84,10 +84,10 @@ namespace vm atomic_t& waiter = *reservation_notifier(raddr).first; waiter.atomic_op([](reservation_waiter_t& value) - { - value.wait_flag = 1; - value.waiters_count++; - }); + { + value.wait_flag = 1; + value.waiters_count++; + }); if ((reservation_acquire(raddr) & -128) != rtime) { @@ -107,17 +107,18 @@ namespace vm if (notifiers.first == notifiers.second) { if (!notifiers.first->fetch_op([](reservation_waiter_t& value) - { - if (value.waiters_index == 0) - { - value.wait_flag = 0; - value.waiters_count = 0; - value.waiters_index++; - return true; - } + { + if (value.waiters_index == 0) + { + value.wait_flag = 0; + value.waiters_count = 0; + value.waiters_index++; + return true; + } - return false; - }).second) + return false; + }) + .second) { return nullptr; } @@ -211,7 +212,7 @@ namespace vm auto stamp0 = utils::get_tsc(), stamp1 = stamp0, stamp2 = stamp0; #ifndef _MSC_VER - __asm__ goto ("xbegin %l[stage2];" ::: "memory" : stage2); + __asm__ goto("xbegin %l[stage2];" ::: "memory" : stage2); #else status = _xbegin(); if (status == umax) @@ -220,7 +221,7 @@ namespace vm if (res & rsrv_unique_lock) { #ifndef _MSC_VER - __asm__ volatile ("xend; mov $-1, %%eax;" ::: "memory"); + __asm__ volatile("xend; mov $-1, %%eax;" ::: "memory"); #else _xend(); #endif @@ -232,7 +233,7 @@ namespace vm std::invoke(op, *sptr); res += 128; #ifndef _MSC_VER - __asm__ volatile ("xend;" ::: "memory"); + __asm__ volatile("xend;" ::: "memory"); #else _xend(); #endif @@ -246,7 +247,7 @@ namespace vm { res += 128; #ifndef _MSC_VER - __asm__ volatile ("xend;" ::: "memory"); + __asm__ volatile("xend;" ::: "memory"); #else _xend(); #endif @@ -257,7 +258,7 @@ namespace vm else { #ifndef _MSC_VER - __asm__ volatile ("xend;" ::: "memory"); + __asm__ volatile("xend;" ::: "memory"); #else _xend(); #endif @@ -266,9 +267,9 @@ namespace vm } } - stage2: + stage2: #ifndef _MSC_VER - __asm__ volatile ("mov %%eax, %0;" : "=r" (status) :: "memory"); + __asm__ volatile("mov %%eax, %0;" : "=r"(status)::"memory"); #endif stamp1 = utils::get_tsc(); @@ -287,7 +288,7 @@ namespace vm } #ifndef _MSC_VER - __asm__ goto ("xbegin %l[retry];" ::: "memory" : retry); + __asm__ goto("xbegin %l[retry];" ::: "memory" : retry); #else status = _xbegin(); @@ -300,7 +301,7 @@ namespace vm { std::invoke(op, *sptr); #ifndef _MSC_VER - __asm__ volatile ("xend;" ::: "memory"); + __asm__ volatile("xend;" ::: "memory"); #else _xend(); #endif @@ -314,7 +315,7 @@ namespace vm if (auto result = std::invoke(op, *sptr)) { #ifndef _MSC_VER - __asm__ volatile ("xend;" ::: "memory"); + __asm__ volatile("xend;" ::: "memory"); #else _xend(); #endif @@ -326,7 +327,7 @@ namespace vm else { #ifndef _MSC_VER - __asm__ volatile ("xend;" ::: "memory"); + __asm__ volatile("xend;" ::: "memory"); #else _xend(); #endif @@ -334,9 +335,9 @@ namespace vm } } - retry: + retry: #ifndef _MSC_VER - __asm__ volatile ("mov %%eax, %0;" : "=r" (status) :: "memory"); + __asm__ volatile("mov %%eax, %0;" : "=r"(status)::"memory"); #endif if (!status) @@ -349,10 +350,10 @@ namespace vm if constexpr (std::is_void_v>) { vm::reservation_op_internal(addr, [&] - { - std::invoke(op, *sptr); - return true; - }); + { + std::invoke(op, *sptr); + return true; + }); if constexpr (Ack) res.notify_all(); @@ -363,16 +364,16 @@ namespace vm auto result = std::invoke_result_t(); vm::reservation_op_internal(addr, [&] - { - if ((result = std::invoke(op, *sptr))) { - return true; - } - else - { - return false; - } - }); + if ((result = std::invoke(op, *sptr))) + { + return true; + } + else + { + return false; + } + }); if (Ack && result) res.notify_all(); @@ -485,15 +486,15 @@ namespace vm auto& res = vm::reservation_acquire(addr); auto [_old, _ok] = res.fetch_op([&](u64& r) - { - if (r & vm::rsrv_unique_lock) { - return false; - } + if (r & vm::rsrv_unique_lock) + { + return false; + } - r += 1; - return true; - }); + r += 1; + return true; + }); if (!_ok) [[unlikely]] { @@ -528,17 +529,17 @@ namespace vm inline SAFE_BUFFERS(auto) atomic_op(T& data, F op) { return light_op(data, [&](T& data) - { - return data.atomic_op(op); - }); + { + return data.atomic_op(op); + }); } template inline SAFE_BUFFERS(auto) fetch_op(T& data, F op) { return light_op(data, [&](T& data) - { - return data.fetch_op(op); - }); + { + return data.fetch_op(op); + }); } } // namespace vm diff --git a/rpcs3/rpcs3/Emu/Memory/vm_var.h b/rpcs3/rpcs3/Emu/Memory/vm_var.h index 4231ab048..e7bcc8523 100644 --- a/rpcs3/rpcs3/Emu/Memory/vm_var.h +++ b/rpcs3/rpcs3/Emu/Memory/vm_var.h @@ -43,8 +43,7 @@ namespace vm const u32 m_mem_size; _var_base(std::pair alloc_info) - : pointer(alloc_info.first) - , m_mem_size(alloc_info.second) + : pointer(alloc_info.first), m_mem_size(alloc_info.second) { } @@ -57,12 +56,12 @@ namespace vm using enable_bitcopy = std::false_type; // Disable bitcopy inheritence _var_base() - : _var_base(A::alloc(sizeof(T), alignof(T))) + : _var_base(A::alloc(sizeof(T), alignof(T))) { } _var_base(const T& right) - : _var_base() + : _var_base() { std::memcpy(pointer::get_ptr(), &right, sizeof(T)); } @@ -86,9 +85,7 @@ namespace vm const u32 m_size; _var_base(u32 count, std::pair alloc_info) - : pointer(alloc_info.first) - , m_mem_size(alloc_info.second) - , m_size(u32{sizeof(T)} * count) + : pointer(alloc_info.first), m_mem_size(alloc_info.second), m_size(u32{sizeof(T)} * count) { } @@ -100,7 +97,7 @@ namespace vm using enable_bitcopy = std::false_type; // Disable bitcopy inheritence _var_base(u32 count) - : _var_base(count, A::alloc(u32{sizeof(T)} * count, alignof(T))) + : _var_base(count, A::alloc(u32{sizeof(T)} * count, alignof(T))) { } diff --git a/rpcs3/rpcs3/Emu/NP/fb_helpers.cpp b/rpcs3/rpcs3/Emu/NP/fb_helpers.cpp index 100c3e864..4f2abef99 100644 --- a/rpcs3/rpcs3/Emu/NP/fb_helpers.cpp +++ b/rpcs3/rpcs3/Emu/NP/fb_helpers.cpp @@ -8,9 +8,9 @@ namespace np { void BinAttr_to_SceNpMatching2BinAttr(event_data& edata, const BinAttr* bin_attr, SceNpMatching2BinAttr* binattr_info) { - binattr_info->id = bin_attr->id(); + binattr_info->id = bin_attr->id(); binattr_info->size = bin_attr->data()->size(); - auto* ptr = edata.allocate(binattr_info->size, binattr_info->ptr); + auto* ptr = edata.allocate(binattr_info->size, binattr_info->ptr); for (flatbuffers::uoffset_t i = 0; i < bin_attr->data()->size(); i++) { ptr[i] = bin_attr->data()->Get(i); @@ -37,13 +37,13 @@ namespace np void RoomBinAttrInternal_to_SceNpMatching2RoomBinAttrInternal(event_data& edata, const BinAttrInternal* fb_attr, SceNpMatching2RoomBinAttrInternal* binattr_info) { binattr_info->updateDate.tick = fb_attr->updateDate(); - binattr_info->updateMemberId = fb_attr->updateMemberId(); + binattr_info->updateMemberId = fb_attr->updateMemberId(); BinAttr_to_SceNpMatching2BinAttr(edata, fb_attr->data(), &binattr_info->data); } void RoomGroup_to_SceNpMatching2RoomGroup(const RoomGroup* fb_group, SceNpMatching2RoomGroup* sce_group) { - sce_group->groupId = fb_group->groupId(); + sce_group->groupId = fb_group->groupId(); sce_group->withPassword = fb_group->withPassword(); sce_group->withLabel = fb_group->label() ? 1 : 0; if (fb_group->label()) @@ -53,7 +53,7 @@ namespace np sce_group->label.data[l_index] = fb_group->label()->Get(l_index); } } - sce_group->slotNum = fb_group->slotNum(); + sce_group->slotNum = fb_group->slotNum(); sce_group->curGroupMemberNum = fb_group->curGroupMemberNum(); } @@ -61,7 +61,7 @@ namespace np { for (flatbuffers::uoffset_t i = 0; i < fb_groups->size(); i++) { - const auto* fb_group = fb_groups->Get(i); + const auto* fb_group = fb_groups->Get(i); SceNpMatching2RoomGroup* sce_group = &sce_groups[i]; RoomGroup_to_SceNpMatching2RoomGroup(fb_group, sce_group); } @@ -104,13 +104,13 @@ namespace np void RoomDataExternal_to_SceNpMatching2RoomDataExternal(event_data& edata, const RoomDataExternal* room, SceNpMatching2RoomDataExternal* room_info, bool include_onlinename, bool include_avatarurl) { - room_info->serverId = room->serverId(); - room_info->worldId = room->worldId(); - room_info->lobbyId = room->lobbyId(); - room_info->roomId = room->roomId(); - room_info->maxSlot = room->maxSlot(); - room_info->curMemberNum = room->curMemberNum(); - room_info->passwordSlotMask = room->passwordSlotMask(); + room_info->serverId = room->serverId(); + room_info->worldId = room->worldId(); + room_info->lobbyId = room->lobbyId(); + room_info->roomId = room->roomId(); + room_info->maxSlot = room->maxSlot(); + room_info->curMemberNum = room->curMemberNum(); + room_info->passwordSlotMask = room->passwordSlotMask(); s32 sdk_ver; process_get_sdk_version(process_getpid(), sdk_ver); @@ -140,7 +140,7 @@ namespace np if (room->roomGroup() && room->roomGroup()->size() != 0) { room_info->roomGroupNum = room->roomGroup()->size(); - auto* ptr_groups = edata.allocate(sizeof(SceNpMatching2RoomGroup) * room_info->roomGroupNum, room_info->roomGroup); + auto* ptr_groups = edata.allocate(sizeof(SceNpMatching2RoomGroup) * room_info->roomGroupNum, room_info->roomGroup); RoomGroups_to_SceNpMatching2RoomGroups(room->roomGroup(), ptr_groups); } @@ -149,11 +149,11 @@ namespace np if (room->roomSearchableIntAttrExternal() && room->roomSearchableIntAttrExternal()->size() != 0) { room_info->roomSearchableIntAttrExternalNum = room->roomSearchableIntAttrExternal()->size(); - auto* ptr_int_attr = edata.allocate(sizeof(SceNpMatching2IntAttr) * room_info->roomSearchableIntAttrExternalNum, room_info->roomSearchableIntAttrExternal); + auto* ptr_int_attr = edata.allocate(sizeof(SceNpMatching2IntAttr) * room_info->roomSearchableIntAttrExternalNum, room_info->roomSearchableIntAttrExternal); for (flatbuffers::uoffset_t a_index = 0; a_index < room->roomSearchableIntAttrExternal()->size(); a_index++) { - auto fb_int_attr = room->roomSearchableIntAttrExternal()->Get(a_index); - ptr_int_attr[a_index].id = fb_int_attr->id(); + auto fb_int_attr = room->roomSearchableIntAttrExternal()->Get(a_index); + ptr_int_attr[a_index].id = fb_int_attr->id(); ptr_int_attr[a_index].num = fb_int_attr->num(); } } @@ -161,14 +161,14 @@ namespace np if (room->roomSearchableBinAttrExternal() && room->roomSearchableBinAttrExternal()->size() != 0) { room_info->roomSearchableBinAttrExternalNum = room->roomSearchableBinAttrExternal()->size(); - auto* ptr_bin_attr = edata.allocate(sizeof(SceNpMatching2BinAttr) * room_info->roomSearchableBinAttrExternalNum, room_info->roomSearchableBinAttrExternal); + auto* ptr_bin_attr = edata.allocate(sizeof(SceNpMatching2BinAttr) * room_info->roomSearchableBinAttrExternalNum, room_info->roomSearchableBinAttrExternal); BinAttrs_to_SceNpMatching2BinAttrs(edata, room->roomSearchableBinAttrExternal(), ptr_bin_attr); } if (room->roomBinAttrExternal() && room->roomBinAttrExternal()->size() != 0) { room_info->roomBinAttrExternalNum = room->roomBinAttrExternal()->size(); - auto* ptr_bin_attr = edata.allocate(sizeof(SceNpMatching2BinAttr) * room_info->roomBinAttrExternalNum, room_info->roomBinAttrExternal); + auto* ptr_bin_attr = edata.allocate(sizeof(SceNpMatching2BinAttr) * room_info->roomBinAttrExternalNum, room_info->roomBinAttrExternal); BinAttrs_to_SceNpMatching2BinAttrs(edata, room->roomBinAttrExternal(), ptr_bin_attr); } } @@ -177,7 +177,7 @@ namespace np { search_resp->range.size = resp->rooms() ? resp->rooms()->size() : 0; search_resp->range.startIndex = resp->startIndex(); - search_resp->range.total = resp->total(); + search_resp->range.total = resp->total(); SceNpMatching2RoomDataExternal* prev_room = nullptr; for (flatbuffers::uoffset_t i = 0; i < search_resp->range.size; i++) @@ -209,18 +209,18 @@ namespace np u16 RoomDataInternal_to_SceNpMatching2RoomDataInternal(event_data& edata, const RoomDataInternal* resp, SceNpMatching2RoomDataInternal* room_info, const SceNpId& npid, bool include_onlinename, bool include_avatarurl) { - u16 member_id = 0; - room_info->serverId = resp->serverId(); - room_info->worldId = resp->worldId(); - room_info->lobbyId = resp->lobbyId(); - room_info->roomId = resp->roomId(); + u16 member_id = 0; + room_info->serverId = resp->serverId(); + room_info->worldId = resp->worldId(); + room_info->lobbyId = resp->lobbyId(); + room_info->roomId = resp->roomId(); room_info->passwordSlotMask = resp->passwordSlotMask(); - room_info->maxSlot = resp->maxSlot(); + room_info->maxSlot = resp->maxSlot(); if (resp->roomGroup() && resp->roomGroup()->size() != 0) { room_info->roomGroupNum = resp->roomGroup()->size(); - auto* ptr_groups = edata.allocate(sizeof(SceNpMatching2RoomGroup) * room_info->roomGroupNum, room_info->roomGroup); + auto* ptr_groups = edata.allocate(sizeof(SceNpMatching2RoomGroup) * room_info->roomGroupNum, room_info->roomGroup); RoomGroups_to_SceNpMatching2RoomGroups(resp->roomGroup(), ptr_groups); } @@ -229,7 +229,7 @@ namespace np for (flatbuffers::uoffset_t i = 0; i < resp->memberList()->size(); i++) { - auto fb_member = resp->memberList()->Get(i); + auto fb_member = resp->memberList()->Get(i); SceNpMatching2RoomMemberDataInternal* sce_member = &room_info->memberList.members[i]; if (i < (resp->memberList()->size() - 1)) @@ -269,17 +269,17 @@ namespace np if (resp->roomBinAttrInternal() && resp->roomBinAttrInternal()->size() != 0) { room_info->roomBinAttrInternalNum = resp->roomBinAttrInternal()->size(); - auto* ptr_bin_attr = edata.allocate(sizeof(SceNpMatching2RoomBinAttrInternal) * room_info->roomBinAttrInternalNum, room_info->roomBinAttrInternal); + auto* ptr_bin_attr = edata.allocate(sizeof(SceNpMatching2RoomBinAttrInternal) * room_info->roomBinAttrInternalNum, room_info->roomBinAttrInternal); for (u32 b_index = 0; b_index < room_info->roomBinAttrInternalNum; b_index++) { - auto fb_bin_attr = resp->roomBinAttrInternal()->Get(b_index); + auto fb_bin_attr = resp->roomBinAttrInternal()->Get(b_index); ptr_bin_attr[b_index].updateDate.tick = fb_bin_attr->updateDate(); - ptr_bin_attr[b_index].updateMemberId = fb_bin_attr->updateMemberId(); + ptr_bin_attr[b_index].updateMemberId = fb_bin_attr->updateMemberId(); - ptr_bin_attr[b_index].data.id = fb_bin_attr->data()->id(); + ptr_bin_attr[b_index].data.id = fb_bin_attr->data()->id(); ptr_bin_attr[b_index].data.size = fb_bin_attr->data()->data()->size(); - auto* ptr_bin_attr_data = edata.allocate(ptr_bin_attr[b_index].data.size, ptr_bin_attr[b_index].data.ptr); + auto* ptr_bin_attr_data = edata.allocate(ptr_bin_attr[b_index].data.size, ptr_bin_attr[b_index].data.ptr); for (flatbuffers::uoffset_t tmp_index = 0; tmp_index < ptr_bin_attr[b_index].data.size; tmp_index++) { ptr_bin_attr_data[tmp_index] = fb_bin_attr->data()->data()->Get(tmp_index); @@ -294,8 +294,8 @@ namespace np { UserInfo_to_SceNpUserInfo2(edata, member_data->userInfo(), &sce_member_data->userInfo, include_onlinename, include_avatarurl); sce_member_data->joinDate.tick = member_data->joinDate(); - sce_member_data->memberId = member_data->memberId(); - sce_member_data->teamId = member_data->teamId(); + sce_member_data->memberId = member_data->memberId(); + sce_member_data->teamId = member_data->teamId(); if (const auto* fb_roomgroup = member_data->roomGroup()) { @@ -313,21 +313,21 @@ namespace np } } - sce_member_data->natType = member_data->natType(); + sce_member_data->natType = member_data->natType(); sce_member_data->flagAttr = member_data->flagAttr(); if (member_data->roomMemberBinAttrInternal() && member_data->roomMemberBinAttrInternal()->size() != 0) { sce_member_data->roomMemberBinAttrInternalNum = member_data->roomMemberBinAttrInternal()->size(); - auto* sce_binattrs = edata.allocate(sizeof(SceNpMatching2RoomMemberBinAttrInternal) * sce_member_data->roomMemberBinAttrInternalNum, sce_member_data->roomMemberBinAttrInternal); + auto* sce_binattrs = edata.allocate(sizeof(SceNpMatching2RoomMemberBinAttrInternal) * sce_member_data->roomMemberBinAttrInternalNum, sce_member_data->roomMemberBinAttrInternal); for (u32 b_index = 0; b_index < sce_member_data->roomMemberBinAttrInternalNum; b_index++) { - const auto fb_battr = member_data->roomMemberBinAttrInternal()->Get(b_index); + const auto fb_battr = member_data->roomMemberBinAttrInternal()->Get(b_index); sce_binattrs[b_index].updateDate.tick = fb_battr->updateDate(); - sce_binattrs[b_index].data.id = fb_battr->data()->id(); + sce_binattrs[b_index].data.id = fb_battr->data()->id(); sce_binattrs[b_index].data.size = fb_battr->data()->data()->size(); - auto* sce_binattr_data = edata.allocate(sce_binattrs[b_index].data.size, sce_binattrs[b_index].data.ptr); + auto* sce_binattr_data = edata.allocate(sce_binattrs[b_index].data.size, sce_binattrs[b_index].data.ptr); for (flatbuffers::uoffset_t tmp_index = 0; tmp_index < sce_binattrs[b_index].data.size; tmp_index++) { sce_binattr_data[tmp_index] = fb_battr->data()->data()->Get(tmp_index); @@ -350,7 +350,7 @@ namespace np if (update_info->roomMemberDataInternal()) { - auto fb_member = update_info->roomMemberDataInternal(); + auto fb_member = update_info->roomMemberDataInternal(); auto* ptr_roomemberinternal = edata.allocate(sizeof(SceNpMatching2RoomMemberDataInternal), sce_update_info->roomMemberDataInternal); // TODO: Pass room_info @@ -360,7 +360,7 @@ namespace np void RoomUpdateInfo_to_SceNpMatching2RoomUpdateInfo(const RoomUpdateInfo* update_info, SceNpMatching2RoomUpdateInfo* sce_update_info) { - sce_update_info->errorCode = 0; + sce_update_info->errorCode = 0; sce_update_info->eventCause = 0; if (update_info->optData()) { @@ -382,7 +382,7 @@ namespace np sce_update_info->newFlagAttr = sce_update_info->newRoomDataInternal.ptr(&SceNpMatching2RoomDataInternal::flagAttr); edata.add_relocation(sce_update_info->newFlagAttr); auto* ptr_sce_prevflag = edata.allocate(sizeof(SceNpMatching2FlagAttr), sce_update_info->prevFlagAttr); - *ptr_sce_prevflag = update_info->prevFlagAttr(); + *ptr_sce_prevflag = update_info->prevFlagAttr(); } if (sce_room_data->passwordSlotMask != update_info->prevRoomPasswordSlotMask()) @@ -390,7 +390,7 @@ namespace np sce_update_info->newRoomPasswordSlotMask = sce_update_info->newRoomDataInternal.ptr(&SceNpMatching2RoomDataInternal::passwordSlotMask); edata.add_relocation(sce_update_info->newRoomPasswordSlotMask); auto* ptr_sce_prevpass = edata.allocate(sizeof(SceNpMatching2RoomPasswordSlotMask), sce_update_info->prevRoomPasswordSlotMask); - *ptr_sce_prevpass = update_info->prevRoomPasswordSlotMask(); + *ptr_sce_prevpass = update_info->prevRoomPasswordSlotMask(); } if (update_info->newRoomGroup() && update_info->newRoomGroup()->size() != 0) @@ -438,7 +438,7 @@ namespace np sce_update_info->newFlagAttr = sce_update_info->newRoomMemberDataInternal.ptr(&SceNpMatching2RoomMemberDataInternal::flagAttr); edata.add_relocation(sce_update_info->newFlagAttr); auto* ptr_sce_prevflag = edata.allocate(sizeof(SceNpMatching2FlagAttr), sce_update_info->prevFlagAttr); - *ptr_sce_prevflag = update_info->prevFlagAttr(); + *ptr_sce_prevflag = update_info->prevFlagAttr(); } if (sce_update_info->newRoomMemberDataInternal->teamId != update_info->prevTeamId()) @@ -475,9 +475,9 @@ namespace np void GetPingInfoResponse_to_SceNpMatching2SignalingGetPingInfoResponse(const GetPingInfoResponse* resp, SceNpMatching2SignalingGetPingInfoResponse* sce_resp) { sce_resp->serverId = resp->serverId(); - sce_resp->worldId = resp->worldId(); - sce_resp->roomId = resp->roomId(); - sce_resp->rtt = resp->rtt(); + sce_resp->worldId = resp->worldId(); + sce_resp->roomId = resp->roomId(); + sce_resp->rtt = resp->rtt(); } void RoomMessageInfo_to_SceNpMatching2RoomMessageInfo(event_data& edata, const RoomMessageInfo* mi, SceNpMatching2RoomMessageInfo* sce_mi, bool include_onlinename, bool include_avatarurl) @@ -516,7 +516,7 @@ namespace np if (auto msg = mi->msg()) { - sce_mi->msgLen = msg->size(); + sce_mi->msgLen = msg->size(); auto* ptr_msg_data = static_cast(edata.allocate(msg->size(), sce_mi->msg)); for (u32 i = 0; i < msg->size(); i++) { diff --git a/rpcs3/rpcs3/Emu/NP/generated/np2_structs_generated.h b/rpcs3/rpcs3/Emu/NP/generated/np2_structs_generated.h index f1d24ae56..5ba7c17ec 100644 --- a/rpcs3/rpcs3/Emu/NP/generated/np2_structs_generated.h +++ b/rpcs3/rpcs3/Emu/NP/generated/np2_structs_generated.h @@ -1,6 +1,5 @@ // automatically generated by the FlatBuffers compiler, do not modify - #ifndef FLATBUFFERS_GENERATED_NP2STRUCTS_H_ #define FLATBUFFERS_GENERATED_NP2STRUCTS_H_ @@ -9,9 +8,9 @@ // Ensure the included flatbuffers.h is the same version as when this file was // generated, otherwise it may not be compatible. static_assert(FLATBUFFERS_VERSION_MAJOR == 24 && - FLATBUFFERS_VERSION_MINOR == 3 && - FLATBUFFERS_VERSION_REVISION == 25, - "Non-compatible flatbuffers version included"); + FLATBUFFERS_VERSION_MINOR == 3 && + FLATBUFFERS_VERSION_REVISION == 25, + "Non-compatible flatbuffers version included"); struct SignalingAddr; struct SignalingAddrBuilder; @@ -271,7157 +270,8475 @@ struct SearchJoinRoomGUIRequestBuilder; struct MatchingSearchJoinRoomInfo; struct MatchingSearchJoinRoomInfoBuilder; -struct SignalingAddr FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef SignalingAddrBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_IP = 4, - VT_PORT = 6 - }; - const ::flatbuffers::Vector *ip() const { - return GetPointer *>(VT_IP); - } - uint16_t port() const { - return GetField(VT_PORT, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_IP) && - verifier.VerifyVector(ip()) && - VerifyField(verifier, VT_PORT, 2) && - verifier.EndTable(); - } +struct SignalingAddr FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef SignalingAddrBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_IP = 4, + VT_PORT = 6 + }; + const ::flatbuffers::Vector* ip() const + { + return GetPointer*>(VT_IP); + } + uint16_t port() const + { + return GetField(VT_PORT, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_IP) && + verifier.VerifyVector(ip()) && + VerifyField(verifier, VT_PORT, 2) && + verifier.EndTable(); + } }; -struct SignalingAddrBuilder { - typedef SignalingAddr Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_ip(::flatbuffers::Offset<::flatbuffers::Vector> ip) { - fbb_.AddOffset(SignalingAddr::VT_IP, ip); - } - void add_port(uint16_t port) { - fbb_.AddElement(SignalingAddr::VT_PORT, port, 0); - } - explicit SignalingAddrBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct SignalingAddrBuilder +{ + typedef SignalingAddr Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_ip(::flatbuffers::Offset<::flatbuffers::Vector> ip) + { + fbb_.AddOffset(SignalingAddr::VT_IP, ip); + } + void add_port(uint16_t port) + { + fbb_.AddElement(SignalingAddr::VT_PORT, port, 0); + } + explicit SignalingAddrBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateSignalingAddr( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector> ip = 0, - uint16_t port = 0) { - SignalingAddrBuilder builder_(_fbb); - builder_.add_ip(ip); - builder_.add_port(port); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> ip = 0, + uint16_t port = 0) +{ + SignalingAddrBuilder builder_(_fbb); + builder_.add_ip(ip); + builder_.add_port(port); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateSignalingAddrDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *ip = nullptr, - uint16_t port = 0) { - auto ip__ = ip ? _fbb.CreateVector(*ip) : 0; - return CreateSignalingAddr( - _fbb, - ip__, - port); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector* ip = nullptr, + uint16_t port = 0) +{ + auto ip__ = ip ? _fbb.CreateVector(*ip) : 0; + return CreateSignalingAddr( + _fbb, + ip__, + port); } -struct MatchingSignalingInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef MatchingSignalingInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NPID = 4, - VT_ADDR = 6 - }; - const ::flatbuffers::String *npid() const { - return GetPointer(VT_NPID); - } - const SignalingAddr *addr() const { - return GetPointer(VT_ADDR); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_NPID) && - verifier.VerifyString(npid()) && - VerifyOffset(verifier, VT_ADDR) && - verifier.VerifyTable(addr()) && - verifier.EndTable(); - } +struct MatchingSignalingInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef MatchingSignalingInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_NPID = 4, + VT_ADDR = 6 + }; + const ::flatbuffers::String* npid() const + { + return GetPointer(VT_NPID); + } + const SignalingAddr* addr() const + { + return GetPointer(VT_ADDR); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_NPID) && + verifier.VerifyString(npid()) && + VerifyOffset(verifier, VT_ADDR) && + verifier.VerifyTable(addr()) && + verifier.EndTable(); + } }; -struct MatchingSignalingInfoBuilder { - typedef MatchingSignalingInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_npid(::flatbuffers::Offset<::flatbuffers::String> npid) { - fbb_.AddOffset(MatchingSignalingInfo::VT_NPID, npid); - } - void add_addr(::flatbuffers::Offset addr) { - fbb_.AddOffset(MatchingSignalingInfo::VT_ADDR, addr); - } - explicit MatchingSignalingInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct MatchingSignalingInfoBuilder +{ + typedef MatchingSignalingInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_npid(::flatbuffers::Offset<::flatbuffers::String> npid) + { + fbb_.AddOffset(MatchingSignalingInfo::VT_NPID, npid); + } + void add_addr(::flatbuffers::Offset addr) + { + fbb_.AddOffset(MatchingSignalingInfo::VT_ADDR, addr); + } + explicit MatchingSignalingInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateMatchingSignalingInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::String> npid = 0, - ::flatbuffers::Offset addr = 0) { - MatchingSignalingInfoBuilder builder_(_fbb); - builder_.add_addr(addr); - builder_.add_npid(npid); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::String> npid = 0, + ::flatbuffers::Offset addr = 0) +{ + MatchingSignalingInfoBuilder builder_(_fbb); + builder_.add_addr(addr); + builder_.add_npid(npid); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateMatchingSignalingInfoDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const char *npid = nullptr, - ::flatbuffers::Offset addr = 0) { - auto npid__ = npid ? _fbb.CreateString(npid) : 0; - return CreateMatchingSignalingInfo( - _fbb, - npid__, - addr); + ::flatbuffers::FlatBufferBuilder& _fbb, + const char* npid = nullptr, + ::flatbuffers::Offset addr = 0) +{ + auto npid__ = npid ? _fbb.CreateString(npid) : 0; + return CreateMatchingSignalingInfo( + _fbb, + npid__, + addr); } -struct Matching2SignalingInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef Matching2SignalingInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_MEMBER_ID = 4, - VT_ADDR = 6 - }; - uint16_t member_id() const { - return GetField(VT_MEMBER_ID, 0); - } - const SignalingAddr *addr() const { - return GetPointer(VT_ADDR); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_MEMBER_ID, 2) && - VerifyOffset(verifier, VT_ADDR) && - verifier.VerifyTable(addr()) && - verifier.EndTable(); - } +struct Matching2SignalingInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef Matching2SignalingInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_MEMBER_ID = 4, + VT_ADDR = 6 + }; + uint16_t member_id() const + { + return GetField(VT_MEMBER_ID, 0); + } + const SignalingAddr* addr() const + { + return GetPointer(VT_ADDR); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_MEMBER_ID, 2) && + VerifyOffset(verifier, VT_ADDR) && + verifier.VerifyTable(addr()) && + verifier.EndTable(); + } }; -struct Matching2SignalingInfoBuilder { - typedef Matching2SignalingInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_member_id(uint16_t member_id) { - fbb_.AddElement(Matching2SignalingInfo::VT_MEMBER_ID, member_id, 0); - } - void add_addr(::flatbuffers::Offset addr) { - fbb_.AddOffset(Matching2SignalingInfo::VT_ADDR, addr); - } - explicit Matching2SignalingInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct Matching2SignalingInfoBuilder +{ + typedef Matching2SignalingInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_member_id(uint16_t member_id) + { + fbb_.AddElement(Matching2SignalingInfo::VT_MEMBER_ID, member_id, 0); + } + void add_addr(::flatbuffers::Offset addr) + { + fbb_.AddOffset(Matching2SignalingInfo::VT_ADDR, addr); + } + explicit Matching2SignalingInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateMatching2SignalingInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint16_t member_id = 0, - ::flatbuffers::Offset addr = 0) { - Matching2SignalingInfoBuilder builder_(_fbb); - builder_.add_addr(addr); - builder_.add_member_id(member_id); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint16_t member_id = 0, + ::flatbuffers::Offset addr = 0) +{ + Matching2SignalingInfoBuilder builder_(_fbb); + builder_.add_addr(addr); + builder_.add_member_id(member_id); + return builder_.Finish(); } -struct BinAttr FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef BinAttrBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ID = 4, - VT_DATA = 6 - }; - uint16_t id() const { - return GetField(VT_ID, 0); - } - const ::flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ID, 2) && - VerifyOffset(verifier, VT_DATA) && - verifier.VerifyVector(data()) && - verifier.EndTable(); - } +struct BinAttr FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef BinAttrBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ID = 4, + VT_DATA = 6 + }; + uint16_t id() const + { + return GetField(VT_ID, 0); + } + const ::flatbuffers::Vector* data() const + { + return GetPointer*>(VT_DATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ID, 2) && + VerifyOffset(verifier, VT_DATA) && + verifier.VerifyVector(data()) && + verifier.EndTable(); + } }; -struct BinAttrBuilder { - typedef BinAttr Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_id(uint16_t id) { - fbb_.AddElement(BinAttr::VT_ID, id, 0); - } - void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { - fbb_.AddOffset(BinAttr::VT_DATA, data); - } - explicit BinAttrBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct BinAttrBuilder +{ + typedef BinAttr Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_id(uint16_t id) + { + fbb_.AddElement(BinAttr::VT_ID, id, 0); + } + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) + { + fbb_.AddOffset(BinAttr::VT_DATA, data); + } + explicit BinAttrBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateBinAttr( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint16_t id = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) { - BinAttrBuilder builder_(_fbb); - builder_.add_data(data); - builder_.add_id(id); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint16_t id = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) +{ + BinAttrBuilder builder_(_fbb); + builder_.add_data(data); + builder_.add_id(id); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateBinAttrDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint16_t id = 0, - const std::vector *data = nullptr) { - auto data__ = data ? _fbb.CreateVector(*data) : 0; - return CreateBinAttr( - _fbb, - id, - data__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint16_t id = 0, + const std::vector* data = nullptr) +{ + auto data__ = data ? _fbb.CreateVector(*data) : 0; + return CreateBinAttr( + _fbb, + id, + data__); } -struct IntAttr FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef IntAttrBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ID = 4, - VT_NUM = 6 - }; - uint16_t id() const { - return GetField(VT_ID, 0); - } - uint32_t num() const { - return GetField(VT_NUM, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ID, 2) && - VerifyField(verifier, VT_NUM, 4) && - verifier.EndTable(); - } +struct IntAttr FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef IntAttrBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ID = 4, + VT_NUM = 6 + }; + uint16_t id() const + { + return GetField(VT_ID, 0); + } + uint32_t num() const + { + return GetField(VT_NUM, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ID, 2) && + VerifyField(verifier, VT_NUM, 4) && + verifier.EndTable(); + } }; -struct IntAttrBuilder { - typedef IntAttr Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_id(uint16_t id) { - fbb_.AddElement(IntAttr::VT_ID, id, 0); - } - void add_num(uint32_t num) { - fbb_.AddElement(IntAttr::VT_NUM, num, 0); - } - explicit IntAttrBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct IntAttrBuilder +{ + typedef IntAttr Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_id(uint16_t id) + { + fbb_.AddElement(IntAttr::VT_ID, id, 0); + } + void add_num(uint32_t num) + { + fbb_.AddElement(IntAttr::VT_NUM, num, 0); + } + explicit IntAttrBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateIntAttr( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint16_t id = 0, - uint32_t num = 0) { - IntAttrBuilder builder_(_fbb); - builder_.add_num(num); - builder_.add_id(id); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint16_t id = 0, + uint32_t num = 0) +{ + IntAttrBuilder builder_(_fbb); + builder_.add_num(num); + builder_.add_id(id); + return builder_.Finish(); } -struct RoomMemberBinAttrInternal FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RoomMemberBinAttrInternalBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_UPDATEDATE = 4, - VT_DATA = 6 - }; - uint64_t updateDate() const { - return GetField(VT_UPDATEDATE, 0); - } - const BinAttr *data() const { - return GetPointer(VT_DATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_UPDATEDATE, 8) && - VerifyOffset(verifier, VT_DATA) && - verifier.VerifyTable(data()) && - verifier.EndTable(); - } +struct RoomMemberBinAttrInternal FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RoomMemberBinAttrInternalBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_UPDATEDATE = 4, + VT_DATA = 6 + }; + uint64_t updateDate() const + { + return GetField(VT_UPDATEDATE, 0); + } + const BinAttr* data() const + { + return GetPointer(VT_DATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_UPDATEDATE, 8) && + VerifyOffset(verifier, VT_DATA) && + verifier.VerifyTable(data()) && + verifier.EndTable(); + } }; -struct RoomMemberBinAttrInternalBuilder { - typedef RoomMemberBinAttrInternal Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_updateDate(uint64_t updateDate) { - fbb_.AddElement(RoomMemberBinAttrInternal::VT_UPDATEDATE, updateDate, 0); - } - void add_data(::flatbuffers::Offset data) { - fbb_.AddOffset(RoomMemberBinAttrInternal::VT_DATA, data); - } - explicit RoomMemberBinAttrInternalBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RoomMemberBinAttrInternalBuilder +{ + typedef RoomMemberBinAttrInternal Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_updateDate(uint64_t updateDate) + { + fbb_.AddElement(RoomMemberBinAttrInternal::VT_UPDATEDATE, updateDate, 0); + } + void add_data(::flatbuffers::Offset data) + { + fbb_.AddOffset(RoomMemberBinAttrInternal::VT_DATA, data); + } + explicit RoomMemberBinAttrInternalBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRoomMemberBinAttrInternal( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t updateDate = 0, - ::flatbuffers::Offset data = 0) { - RoomMemberBinAttrInternalBuilder builder_(_fbb); - builder_.add_updateDate(updateDate); - builder_.add_data(data); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t updateDate = 0, + ::flatbuffers::Offset data = 0) +{ + RoomMemberBinAttrInternalBuilder builder_(_fbb); + builder_.add_updateDate(updateDate); + builder_.add_data(data); + return builder_.Finish(); } -struct BinAttrInternal FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef BinAttrInternalBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_UPDATEDATE = 4, - VT_UPDATEMEMBERID = 6, - VT_DATA = 8 - }; - uint64_t updateDate() const { - return GetField(VT_UPDATEDATE, 0); - } - uint16_t updateMemberId() const { - return GetField(VT_UPDATEMEMBERID, 0); - } - const BinAttr *data() const { - return GetPointer(VT_DATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_UPDATEDATE, 8) && - VerifyField(verifier, VT_UPDATEMEMBERID, 2) && - VerifyOffset(verifier, VT_DATA) && - verifier.VerifyTable(data()) && - verifier.EndTable(); - } +struct BinAttrInternal FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef BinAttrInternalBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_UPDATEDATE = 4, + VT_UPDATEMEMBERID = 6, + VT_DATA = 8 + }; + uint64_t updateDate() const + { + return GetField(VT_UPDATEDATE, 0); + } + uint16_t updateMemberId() const + { + return GetField(VT_UPDATEMEMBERID, 0); + } + const BinAttr* data() const + { + return GetPointer(VT_DATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_UPDATEDATE, 8) && + VerifyField(verifier, VT_UPDATEMEMBERID, 2) && + VerifyOffset(verifier, VT_DATA) && + verifier.VerifyTable(data()) && + verifier.EndTable(); + } }; -struct BinAttrInternalBuilder { - typedef BinAttrInternal Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_updateDate(uint64_t updateDate) { - fbb_.AddElement(BinAttrInternal::VT_UPDATEDATE, updateDate, 0); - } - void add_updateMemberId(uint16_t updateMemberId) { - fbb_.AddElement(BinAttrInternal::VT_UPDATEMEMBERID, updateMemberId, 0); - } - void add_data(::flatbuffers::Offset data) { - fbb_.AddOffset(BinAttrInternal::VT_DATA, data); - } - explicit BinAttrInternalBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct BinAttrInternalBuilder +{ + typedef BinAttrInternal Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_updateDate(uint64_t updateDate) + { + fbb_.AddElement(BinAttrInternal::VT_UPDATEDATE, updateDate, 0); + } + void add_updateMemberId(uint16_t updateMemberId) + { + fbb_.AddElement(BinAttrInternal::VT_UPDATEMEMBERID, updateMemberId, 0); + } + void add_data(::flatbuffers::Offset data) + { + fbb_.AddOffset(BinAttrInternal::VT_DATA, data); + } + explicit BinAttrInternalBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateBinAttrInternal( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t updateDate = 0, - uint16_t updateMemberId = 0, - ::flatbuffers::Offset data = 0) { - BinAttrInternalBuilder builder_(_fbb); - builder_.add_updateDate(updateDate); - builder_.add_data(data); - builder_.add_updateMemberId(updateMemberId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t updateDate = 0, + uint16_t updateMemberId = 0, + ::flatbuffers::Offset data = 0) +{ + BinAttrInternalBuilder builder_(_fbb); + builder_.add_updateDate(updateDate); + builder_.add_data(data); + builder_.add_updateMemberId(updateMemberId); + return builder_.Finish(); } -struct OptParam FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef OptParamBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_TYPE = 4, - VT_FLAG = 6, - VT_HUBMEMBERID = 8 - }; - uint8_t type() const { - return GetField(VT_TYPE, 0); - } - uint8_t flag() const { - return GetField(VT_FLAG, 0); - } - uint16_t hubMemberId() const { - return GetField(VT_HUBMEMBERID, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_TYPE, 1) && - VerifyField(verifier, VT_FLAG, 1) && - VerifyField(verifier, VT_HUBMEMBERID, 2) && - verifier.EndTable(); - } +struct OptParam FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef OptParamBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_TYPE = 4, + VT_FLAG = 6, + VT_HUBMEMBERID = 8 + }; + uint8_t type() const + { + return GetField(VT_TYPE, 0); + } + uint8_t flag() const + { + return GetField(VT_FLAG, 0); + } + uint16_t hubMemberId() const + { + return GetField(VT_HUBMEMBERID, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_TYPE, 1) && + VerifyField(verifier, VT_FLAG, 1) && + VerifyField(verifier, VT_HUBMEMBERID, 2) && + verifier.EndTable(); + } }; -struct OptParamBuilder { - typedef OptParam Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_type(uint8_t type) { - fbb_.AddElement(OptParam::VT_TYPE, type, 0); - } - void add_flag(uint8_t flag) { - fbb_.AddElement(OptParam::VT_FLAG, flag, 0); - } - void add_hubMemberId(uint16_t hubMemberId) { - fbb_.AddElement(OptParam::VT_HUBMEMBERID, hubMemberId, 0); - } - explicit OptParamBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct OptParamBuilder +{ + typedef OptParam Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_type(uint8_t type) + { + fbb_.AddElement(OptParam::VT_TYPE, type, 0); + } + void add_flag(uint8_t flag) + { + fbb_.AddElement(OptParam::VT_FLAG, flag, 0); + } + void add_hubMemberId(uint16_t hubMemberId) + { + fbb_.AddElement(OptParam::VT_HUBMEMBERID, hubMemberId, 0); + } + explicit OptParamBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateOptParam( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint8_t type = 0, - uint8_t flag = 0, - uint16_t hubMemberId = 0) { - OptParamBuilder builder_(_fbb); - builder_.add_hubMemberId(hubMemberId); - builder_.add_flag(flag); - builder_.add_type(type); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint8_t type = 0, + uint8_t flag = 0, + uint16_t hubMemberId = 0) +{ + OptParamBuilder builder_(_fbb); + builder_.add_hubMemberId(hubMemberId); + builder_.add_flag(flag); + builder_.add_type(type); + return builder_.Finish(); } -struct GroupConfig FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GroupConfigBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SLOTNUM = 4, - VT_LABEL = 6, - VT_WITHPASSWORD = 8 - }; - uint32_t slotNum() const { - return GetField(VT_SLOTNUM, 0); - } - const ::flatbuffers::Vector *label() const { - return GetPointer *>(VT_LABEL); - } - bool withPassword() const { - return GetField(VT_WITHPASSWORD, 0) != 0; - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_SLOTNUM, 4) && - VerifyOffset(verifier, VT_LABEL) && - verifier.VerifyVector(label()) && - VerifyField(verifier, VT_WITHPASSWORD, 1) && - verifier.EndTable(); - } +struct GroupConfig FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GroupConfigBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_SLOTNUM = 4, + VT_LABEL = 6, + VT_WITHPASSWORD = 8 + }; + uint32_t slotNum() const + { + return GetField(VT_SLOTNUM, 0); + } + const ::flatbuffers::Vector* label() const + { + return GetPointer*>(VT_LABEL); + } + bool withPassword() const + { + return GetField(VT_WITHPASSWORD, 0) != 0; + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_SLOTNUM, 4) && + VerifyOffset(verifier, VT_LABEL) && + verifier.VerifyVector(label()) && + VerifyField(verifier, VT_WITHPASSWORD, 1) && + verifier.EndTable(); + } }; -struct GroupConfigBuilder { - typedef GroupConfig Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_slotNum(uint32_t slotNum) { - fbb_.AddElement(GroupConfig::VT_SLOTNUM, slotNum, 0); - } - void add_label(::flatbuffers::Offset<::flatbuffers::Vector> label) { - fbb_.AddOffset(GroupConfig::VT_LABEL, label); - } - void add_withPassword(bool withPassword) { - fbb_.AddElement(GroupConfig::VT_WITHPASSWORD, static_cast(withPassword), 0); - } - explicit GroupConfigBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GroupConfigBuilder +{ + typedef GroupConfig Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_slotNum(uint32_t slotNum) + { + fbb_.AddElement(GroupConfig::VT_SLOTNUM, slotNum, 0); + } + void add_label(::flatbuffers::Offset<::flatbuffers::Vector> label) + { + fbb_.AddOffset(GroupConfig::VT_LABEL, label); + } + void add_withPassword(bool withPassword) + { + fbb_.AddElement(GroupConfig::VT_WITHPASSWORD, static_cast(withPassword), 0); + } + explicit GroupConfigBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGroupConfig( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t slotNum = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> label = 0, - bool withPassword = false) { - GroupConfigBuilder builder_(_fbb); - builder_.add_label(label); - builder_.add_slotNum(slotNum); - builder_.add_withPassword(withPassword); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t slotNum = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> label = 0, + bool withPassword = false) +{ + GroupConfigBuilder builder_(_fbb); + builder_.add_label(label); + builder_.add_slotNum(slotNum); + builder_.add_withPassword(withPassword); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateGroupConfigDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t slotNum = 0, - const std::vector *label = nullptr, - bool withPassword = false) { - auto label__ = label ? _fbb.CreateVector(*label) : 0; - return CreateGroupConfig( - _fbb, - slotNum, - label__, - withPassword); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t slotNum = 0, + const std::vector* label = nullptr, + bool withPassword = false) +{ + auto label__ = label ? _fbb.CreateVector(*label) : 0; + return CreateGroupConfig( + _fbb, + slotNum, + label__, + withPassword); } -struct UserInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef UserInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NPID = 4, - VT_ONLINENAME = 6, - VT_AVATARURL = 8 - }; - const ::flatbuffers::String *npId() const { - return GetPointer(VT_NPID); - } - const ::flatbuffers::String *onlineName() const { - return GetPointer(VT_ONLINENAME); - } - const ::flatbuffers::String *avatarUrl() const { - return GetPointer(VT_AVATARURL); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_NPID) && - verifier.VerifyString(npId()) && - VerifyOffset(verifier, VT_ONLINENAME) && - verifier.VerifyString(onlineName()) && - VerifyOffset(verifier, VT_AVATARURL) && - verifier.VerifyString(avatarUrl()) && - verifier.EndTable(); - } +struct UserInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef UserInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_NPID = 4, + VT_ONLINENAME = 6, + VT_AVATARURL = 8 + }; + const ::flatbuffers::String* npId() const + { + return GetPointer(VT_NPID); + } + const ::flatbuffers::String* onlineName() const + { + return GetPointer(VT_ONLINENAME); + } + const ::flatbuffers::String* avatarUrl() const + { + return GetPointer(VT_AVATARURL); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_NPID) && + verifier.VerifyString(npId()) && + VerifyOffset(verifier, VT_ONLINENAME) && + verifier.VerifyString(onlineName()) && + VerifyOffset(verifier, VT_AVATARURL) && + verifier.VerifyString(avatarUrl()) && + verifier.EndTable(); + } }; -struct UserInfoBuilder { - typedef UserInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_npId(::flatbuffers::Offset<::flatbuffers::String> npId) { - fbb_.AddOffset(UserInfo::VT_NPID, npId); - } - void add_onlineName(::flatbuffers::Offset<::flatbuffers::String> onlineName) { - fbb_.AddOffset(UserInfo::VT_ONLINENAME, onlineName); - } - void add_avatarUrl(::flatbuffers::Offset<::flatbuffers::String> avatarUrl) { - fbb_.AddOffset(UserInfo::VT_AVATARURL, avatarUrl); - } - explicit UserInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct UserInfoBuilder +{ + typedef UserInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_npId(::flatbuffers::Offset<::flatbuffers::String> npId) + { + fbb_.AddOffset(UserInfo::VT_NPID, npId); + } + void add_onlineName(::flatbuffers::Offset<::flatbuffers::String> onlineName) + { + fbb_.AddOffset(UserInfo::VT_ONLINENAME, onlineName); + } + void add_avatarUrl(::flatbuffers::Offset<::flatbuffers::String> avatarUrl) + { + fbb_.AddOffset(UserInfo::VT_AVATARURL, avatarUrl); + } + explicit UserInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateUserInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::String> npId = 0, - ::flatbuffers::Offset<::flatbuffers::String> onlineName = 0, - ::flatbuffers::Offset<::flatbuffers::String> avatarUrl = 0) { - UserInfoBuilder builder_(_fbb); - builder_.add_avatarUrl(avatarUrl); - builder_.add_onlineName(onlineName); - builder_.add_npId(npId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::String> npId = 0, + ::flatbuffers::Offset<::flatbuffers::String> onlineName = 0, + ::flatbuffers::Offset<::flatbuffers::String> avatarUrl = 0) +{ + UserInfoBuilder builder_(_fbb); + builder_.add_avatarUrl(avatarUrl); + builder_.add_onlineName(onlineName); + builder_.add_npId(npId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateUserInfoDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const char *npId = nullptr, - const char *onlineName = nullptr, - const char *avatarUrl = nullptr) { - auto npId__ = npId ? _fbb.CreateString(npId) : 0; - auto onlineName__ = onlineName ? _fbb.CreateString(onlineName) : 0; - auto avatarUrl__ = avatarUrl ? _fbb.CreateString(avatarUrl) : 0; - return CreateUserInfo( - _fbb, - npId__, - onlineName__, - avatarUrl__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const char* npId = nullptr, + const char* onlineName = nullptr, + const char* avatarUrl = nullptr) +{ + auto npId__ = npId ? _fbb.CreateString(npId) : 0; + auto onlineName__ = onlineName ? _fbb.CreateString(onlineName) : 0; + auto avatarUrl__ = avatarUrl ? _fbb.CreateString(avatarUrl) : 0; + return CreateUserInfo( + _fbb, + npId__, + onlineName__, + avatarUrl__); } -struct RoomMemberDataInternal FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RoomMemberDataInternalBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_USERINFO = 4, - VT_JOINDATE = 6, - VT_MEMBERID = 8, - VT_TEAMID = 10, - VT_ROOMGROUP = 12, - VT_NATTYPE = 14, - VT_FLAGATTR = 16, - VT_ROOMMEMBERBINATTRINTERNAL = 18 - }; - const UserInfo *userInfo() const { - return GetPointer(VT_USERINFO); - } - uint64_t joinDate() const { - return GetField(VT_JOINDATE, 0); - } - uint16_t memberId() const { - return GetField(VT_MEMBERID, 0); - } - uint8_t teamId() const { - return GetField(VT_TEAMID, 0); - } - const RoomGroup *roomGroup() const { - return GetPointer(VT_ROOMGROUP); - } - uint8_t natType() const { - return GetField(VT_NATTYPE, 0); - } - uint32_t flagAttr() const { - return GetField(VT_FLAGATTR, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomMemberBinAttrInternal() const { - return GetPointer> *>(VT_ROOMMEMBERBINATTRINTERNAL); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_USERINFO) && - verifier.VerifyTable(userInfo()) && - VerifyField(verifier, VT_JOINDATE, 8) && - VerifyField(verifier, VT_MEMBERID, 2) && - VerifyField(verifier, VT_TEAMID, 1) && - VerifyOffset(verifier, VT_ROOMGROUP) && - verifier.VerifyTable(roomGroup()) && - VerifyField(verifier, VT_NATTYPE, 1) && - VerifyField(verifier, VT_FLAGATTR, 4) && - VerifyOffset(verifier, VT_ROOMMEMBERBINATTRINTERNAL) && - verifier.VerifyVector(roomMemberBinAttrInternal()) && - verifier.VerifyVectorOfTables(roomMemberBinAttrInternal()) && - verifier.EndTable(); - } +struct RoomMemberDataInternal FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RoomMemberDataInternalBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_USERINFO = 4, + VT_JOINDATE = 6, + VT_MEMBERID = 8, + VT_TEAMID = 10, + VT_ROOMGROUP = 12, + VT_NATTYPE = 14, + VT_FLAGATTR = 16, + VT_ROOMMEMBERBINATTRINTERNAL = 18 + }; + const UserInfo* userInfo() const + { + return GetPointer(VT_USERINFO); + } + uint64_t joinDate() const + { + return GetField(VT_JOINDATE, 0); + } + uint16_t memberId() const + { + return GetField(VT_MEMBERID, 0); + } + uint8_t teamId() const + { + return GetField(VT_TEAMID, 0); + } + const RoomGroup* roomGroup() const + { + return GetPointer(VT_ROOMGROUP); + } + uint8_t natType() const + { + return GetField(VT_NATTYPE, 0); + } + uint32_t flagAttr() const + { + return GetField(VT_FLAGATTR, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomMemberBinAttrInternal() const + { + return GetPointer>*>(VT_ROOMMEMBERBINATTRINTERNAL); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_USERINFO) && + verifier.VerifyTable(userInfo()) && + VerifyField(verifier, VT_JOINDATE, 8) && + VerifyField(verifier, VT_MEMBERID, 2) && + VerifyField(verifier, VT_TEAMID, 1) && + VerifyOffset(verifier, VT_ROOMGROUP) && + verifier.VerifyTable(roomGroup()) && + VerifyField(verifier, VT_NATTYPE, 1) && + VerifyField(verifier, VT_FLAGATTR, 4) && + VerifyOffset(verifier, VT_ROOMMEMBERBINATTRINTERNAL) && + verifier.VerifyVector(roomMemberBinAttrInternal()) && + verifier.VerifyVectorOfTables(roomMemberBinAttrInternal()) && + verifier.EndTable(); + } }; -struct RoomMemberDataInternalBuilder { - typedef RoomMemberDataInternal Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_userInfo(::flatbuffers::Offset userInfo) { - fbb_.AddOffset(RoomMemberDataInternal::VT_USERINFO, userInfo); - } - void add_joinDate(uint64_t joinDate) { - fbb_.AddElement(RoomMemberDataInternal::VT_JOINDATE, joinDate, 0); - } - void add_memberId(uint16_t memberId) { - fbb_.AddElement(RoomMemberDataInternal::VT_MEMBERID, memberId, 0); - } - void add_teamId(uint8_t teamId) { - fbb_.AddElement(RoomMemberDataInternal::VT_TEAMID, teamId, 0); - } - void add_roomGroup(::flatbuffers::Offset roomGroup) { - fbb_.AddOffset(RoomMemberDataInternal::VT_ROOMGROUP, roomGroup); - } - void add_natType(uint8_t natType) { - fbb_.AddElement(RoomMemberDataInternal::VT_NATTYPE, natType, 0); - } - void add_flagAttr(uint32_t flagAttr) { - fbb_.AddElement(RoomMemberDataInternal::VT_FLAGATTR, flagAttr, 0); - } - void add_roomMemberBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal) { - fbb_.AddOffset(RoomMemberDataInternal::VT_ROOMMEMBERBINATTRINTERNAL, roomMemberBinAttrInternal); - } - explicit RoomMemberDataInternalBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RoomMemberDataInternalBuilder +{ + typedef RoomMemberDataInternal Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_userInfo(::flatbuffers::Offset userInfo) + { + fbb_.AddOffset(RoomMemberDataInternal::VT_USERINFO, userInfo); + } + void add_joinDate(uint64_t joinDate) + { + fbb_.AddElement(RoomMemberDataInternal::VT_JOINDATE, joinDate, 0); + } + void add_memberId(uint16_t memberId) + { + fbb_.AddElement(RoomMemberDataInternal::VT_MEMBERID, memberId, 0); + } + void add_teamId(uint8_t teamId) + { + fbb_.AddElement(RoomMemberDataInternal::VT_TEAMID, teamId, 0); + } + void add_roomGroup(::flatbuffers::Offset roomGroup) + { + fbb_.AddOffset(RoomMemberDataInternal::VT_ROOMGROUP, roomGroup); + } + void add_natType(uint8_t natType) + { + fbb_.AddElement(RoomMemberDataInternal::VT_NATTYPE, natType, 0); + } + void add_flagAttr(uint32_t flagAttr) + { + fbb_.AddElement(RoomMemberDataInternal::VT_FLAGATTR, flagAttr, 0); + } + void add_roomMemberBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal) + { + fbb_.AddOffset(RoomMemberDataInternal::VT_ROOMMEMBERBINATTRINTERNAL, roomMemberBinAttrInternal); + } + explicit RoomMemberDataInternalBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRoomMemberDataInternal( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset userInfo = 0, - uint64_t joinDate = 0, - uint16_t memberId = 0, - uint8_t teamId = 0, - ::flatbuffers::Offset roomGroup = 0, - uint8_t natType = 0, - uint32_t flagAttr = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal = 0) { - RoomMemberDataInternalBuilder builder_(_fbb); - builder_.add_joinDate(joinDate); - builder_.add_roomMemberBinAttrInternal(roomMemberBinAttrInternal); - builder_.add_flagAttr(flagAttr); - builder_.add_roomGroup(roomGroup); - builder_.add_userInfo(userInfo); - builder_.add_memberId(memberId); - builder_.add_natType(natType); - builder_.add_teamId(teamId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset userInfo = 0, + uint64_t joinDate = 0, + uint16_t memberId = 0, + uint8_t teamId = 0, + ::flatbuffers::Offset roomGroup = 0, + uint8_t natType = 0, + uint32_t flagAttr = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal = 0) +{ + RoomMemberDataInternalBuilder builder_(_fbb); + builder_.add_joinDate(joinDate); + builder_.add_roomMemberBinAttrInternal(roomMemberBinAttrInternal); + builder_.add_flagAttr(flagAttr); + builder_.add_roomGroup(roomGroup); + builder_.add_userInfo(userInfo); + builder_.add_memberId(memberId); + builder_.add_natType(natType); + builder_.add_teamId(teamId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateRoomMemberDataInternalDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset userInfo = 0, - uint64_t joinDate = 0, - uint16_t memberId = 0, - uint8_t teamId = 0, - ::flatbuffers::Offset roomGroup = 0, - uint8_t natType = 0, - uint32_t flagAttr = 0, - const std::vector<::flatbuffers::Offset> *roomMemberBinAttrInternal = nullptr) { - auto roomMemberBinAttrInternal__ = roomMemberBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomMemberBinAttrInternal) : 0; - return CreateRoomMemberDataInternal( - _fbb, - userInfo, - joinDate, - memberId, - teamId, - roomGroup, - natType, - flagAttr, - roomMemberBinAttrInternal__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset userInfo = 0, + uint64_t joinDate = 0, + uint16_t memberId = 0, + uint8_t teamId = 0, + ::flatbuffers::Offset roomGroup = 0, + uint8_t natType = 0, + uint32_t flagAttr = 0, + const std::vector<::flatbuffers::Offset>* roomMemberBinAttrInternal = nullptr) +{ + auto roomMemberBinAttrInternal__ = roomMemberBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomMemberBinAttrInternal) : 0; + return CreateRoomMemberDataInternal( + _fbb, + userInfo, + joinDate, + memberId, + teamId, + roomGroup, + natType, + flagAttr, + roomMemberBinAttrInternal__); } -struct RoomGroup FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RoomGroupBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_GROUPID = 4, - VT_WITHPASSWORD = 6, - VT_LABEL = 8, - VT_SLOTNUM = 10, - VT_CURGROUPMEMBERNUM = 12 - }; - uint8_t groupId() const { - return GetField(VT_GROUPID, 0); - } - bool withPassword() const { - return GetField(VT_WITHPASSWORD, 0) != 0; - } - const ::flatbuffers::Vector *label() const { - return GetPointer *>(VT_LABEL); - } - uint32_t slotNum() const { - return GetField(VT_SLOTNUM, 0); - } - uint32_t curGroupMemberNum() const { - return GetField(VT_CURGROUPMEMBERNUM, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_GROUPID, 1) && - VerifyField(verifier, VT_WITHPASSWORD, 1) && - VerifyOffset(verifier, VT_LABEL) && - verifier.VerifyVector(label()) && - VerifyField(verifier, VT_SLOTNUM, 4) && - VerifyField(verifier, VT_CURGROUPMEMBERNUM, 4) && - verifier.EndTable(); - } +struct RoomGroup FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RoomGroupBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_GROUPID = 4, + VT_WITHPASSWORD = 6, + VT_LABEL = 8, + VT_SLOTNUM = 10, + VT_CURGROUPMEMBERNUM = 12 + }; + uint8_t groupId() const + { + return GetField(VT_GROUPID, 0); + } + bool withPassword() const + { + return GetField(VT_WITHPASSWORD, 0) != 0; + } + const ::flatbuffers::Vector* label() const + { + return GetPointer*>(VT_LABEL); + } + uint32_t slotNum() const + { + return GetField(VT_SLOTNUM, 0); + } + uint32_t curGroupMemberNum() const + { + return GetField(VT_CURGROUPMEMBERNUM, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_GROUPID, 1) && + VerifyField(verifier, VT_WITHPASSWORD, 1) && + VerifyOffset(verifier, VT_LABEL) && + verifier.VerifyVector(label()) && + VerifyField(verifier, VT_SLOTNUM, 4) && + VerifyField(verifier, VT_CURGROUPMEMBERNUM, 4) && + verifier.EndTable(); + } }; -struct RoomGroupBuilder { - typedef RoomGroup Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_groupId(uint8_t groupId) { - fbb_.AddElement(RoomGroup::VT_GROUPID, groupId, 0); - } - void add_withPassword(bool withPassword) { - fbb_.AddElement(RoomGroup::VT_WITHPASSWORD, static_cast(withPassword), 0); - } - void add_label(::flatbuffers::Offset<::flatbuffers::Vector> label) { - fbb_.AddOffset(RoomGroup::VT_LABEL, label); - } - void add_slotNum(uint32_t slotNum) { - fbb_.AddElement(RoomGroup::VT_SLOTNUM, slotNum, 0); - } - void add_curGroupMemberNum(uint32_t curGroupMemberNum) { - fbb_.AddElement(RoomGroup::VT_CURGROUPMEMBERNUM, curGroupMemberNum, 0); - } - explicit RoomGroupBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RoomGroupBuilder +{ + typedef RoomGroup Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_groupId(uint8_t groupId) + { + fbb_.AddElement(RoomGroup::VT_GROUPID, groupId, 0); + } + void add_withPassword(bool withPassword) + { + fbb_.AddElement(RoomGroup::VT_WITHPASSWORD, static_cast(withPassword), 0); + } + void add_label(::flatbuffers::Offset<::flatbuffers::Vector> label) + { + fbb_.AddOffset(RoomGroup::VT_LABEL, label); + } + void add_slotNum(uint32_t slotNum) + { + fbb_.AddElement(RoomGroup::VT_SLOTNUM, slotNum, 0); + } + void add_curGroupMemberNum(uint32_t curGroupMemberNum) + { + fbb_.AddElement(RoomGroup::VT_CURGROUPMEMBERNUM, curGroupMemberNum, 0); + } + explicit RoomGroupBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRoomGroup( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint8_t groupId = 0, - bool withPassword = false, - ::flatbuffers::Offset<::flatbuffers::Vector> label = 0, - uint32_t slotNum = 0, - uint32_t curGroupMemberNum = 0) { - RoomGroupBuilder builder_(_fbb); - builder_.add_curGroupMemberNum(curGroupMemberNum); - builder_.add_slotNum(slotNum); - builder_.add_label(label); - builder_.add_withPassword(withPassword); - builder_.add_groupId(groupId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint8_t groupId = 0, + bool withPassword = false, + ::flatbuffers::Offset<::flatbuffers::Vector> label = 0, + uint32_t slotNum = 0, + uint32_t curGroupMemberNum = 0) +{ + RoomGroupBuilder builder_(_fbb); + builder_.add_curGroupMemberNum(curGroupMemberNum); + builder_.add_slotNum(slotNum); + builder_.add_label(label); + builder_.add_withPassword(withPassword); + builder_.add_groupId(groupId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateRoomGroupDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint8_t groupId = 0, - bool withPassword = false, - const std::vector *label = nullptr, - uint32_t slotNum = 0, - uint32_t curGroupMemberNum = 0) { - auto label__ = label ? _fbb.CreateVector(*label) : 0; - return CreateRoomGroup( - _fbb, - groupId, - withPassword, - label__, - slotNum, - curGroupMemberNum); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint8_t groupId = 0, + bool withPassword = false, + const std::vector* label = nullptr, + uint32_t slotNum = 0, + uint32_t curGroupMemberNum = 0) +{ + auto label__ = label ? _fbb.CreateVector(*label) : 0; + return CreateRoomGroup( + _fbb, + groupId, + withPassword, + label__, + slotNum, + curGroupMemberNum); } -struct RoomDataInternal FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RoomDataInternalBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SERVERID = 4, - VT_WORLDID = 6, - VT_LOBBYID = 8, - VT_ROOMID = 10, - VT_PASSWORDSLOTMASK = 12, - VT_MAXSLOT = 14, - VT_MEMBERLIST = 16, - VT_OWNERID = 18, - VT_ROOMGROUP = 20, - VT_FLAGATTR = 22, - VT_ROOMBINATTRINTERNAL = 24 - }; - uint16_t serverId() const { - return GetField(VT_SERVERID, 0); - } - uint32_t worldId() const { - return GetField(VT_WORLDID, 0); - } - uint64_t lobbyId() const { - return GetField(VT_LOBBYID, 0); - } - uint64_t roomId() const { - return GetField(VT_ROOMID, 0); - } - uint64_t passwordSlotMask() const { - return GetField(VT_PASSWORDSLOTMASK, 0); - } - uint32_t maxSlot() const { - return GetField(VT_MAXSLOT, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *memberList() const { - return GetPointer> *>(VT_MEMBERLIST); - } - uint16_t ownerId() const { - return GetField(VT_OWNERID, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomGroup() const { - return GetPointer> *>(VT_ROOMGROUP); - } - uint32_t flagAttr() const { - return GetField(VT_FLAGATTR, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomBinAttrInternal() const { - return GetPointer> *>(VT_ROOMBINATTRINTERNAL); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_SERVERID, 2) && - VerifyField(verifier, VT_WORLDID, 4) && - VerifyField(verifier, VT_LOBBYID, 8) && - VerifyField(verifier, VT_ROOMID, 8) && - VerifyField(verifier, VT_PASSWORDSLOTMASK, 8) && - VerifyField(verifier, VT_MAXSLOT, 4) && - VerifyOffset(verifier, VT_MEMBERLIST) && - verifier.VerifyVector(memberList()) && - verifier.VerifyVectorOfTables(memberList()) && - VerifyField(verifier, VT_OWNERID, 2) && - VerifyOffset(verifier, VT_ROOMGROUP) && - verifier.VerifyVector(roomGroup()) && - verifier.VerifyVectorOfTables(roomGroup()) && - VerifyField(verifier, VT_FLAGATTR, 4) && - VerifyOffset(verifier, VT_ROOMBINATTRINTERNAL) && - verifier.VerifyVector(roomBinAttrInternal()) && - verifier.VerifyVectorOfTables(roomBinAttrInternal()) && - verifier.EndTable(); - } +struct RoomDataInternal FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RoomDataInternalBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_SERVERID = 4, + VT_WORLDID = 6, + VT_LOBBYID = 8, + VT_ROOMID = 10, + VT_PASSWORDSLOTMASK = 12, + VT_MAXSLOT = 14, + VT_MEMBERLIST = 16, + VT_OWNERID = 18, + VT_ROOMGROUP = 20, + VT_FLAGATTR = 22, + VT_ROOMBINATTRINTERNAL = 24 + }; + uint16_t serverId() const + { + return GetField(VT_SERVERID, 0); + } + uint32_t worldId() const + { + return GetField(VT_WORLDID, 0); + } + uint64_t lobbyId() const + { + return GetField(VT_LOBBYID, 0); + } + uint64_t roomId() const + { + return GetField(VT_ROOMID, 0); + } + uint64_t passwordSlotMask() const + { + return GetField(VT_PASSWORDSLOTMASK, 0); + } + uint32_t maxSlot() const + { + return GetField(VT_MAXSLOT, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* memberList() const + { + return GetPointer>*>(VT_MEMBERLIST); + } + uint16_t ownerId() const + { + return GetField(VT_OWNERID, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomGroup() const + { + return GetPointer>*>(VT_ROOMGROUP); + } + uint32_t flagAttr() const + { + return GetField(VT_FLAGATTR, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomBinAttrInternal() const + { + return GetPointer>*>(VT_ROOMBINATTRINTERNAL); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_SERVERID, 2) && + VerifyField(verifier, VT_WORLDID, 4) && + VerifyField(verifier, VT_LOBBYID, 8) && + VerifyField(verifier, VT_ROOMID, 8) && + VerifyField(verifier, VT_PASSWORDSLOTMASK, 8) && + VerifyField(verifier, VT_MAXSLOT, 4) && + VerifyOffset(verifier, VT_MEMBERLIST) && + verifier.VerifyVector(memberList()) && + verifier.VerifyVectorOfTables(memberList()) && + VerifyField(verifier, VT_OWNERID, 2) && + VerifyOffset(verifier, VT_ROOMGROUP) && + verifier.VerifyVector(roomGroup()) && + verifier.VerifyVectorOfTables(roomGroup()) && + VerifyField(verifier, VT_FLAGATTR, 4) && + VerifyOffset(verifier, VT_ROOMBINATTRINTERNAL) && + verifier.VerifyVector(roomBinAttrInternal()) && + verifier.VerifyVectorOfTables(roomBinAttrInternal()) && + verifier.EndTable(); + } }; -struct RoomDataInternalBuilder { - typedef RoomDataInternal Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_serverId(uint16_t serverId) { - fbb_.AddElement(RoomDataInternal::VT_SERVERID, serverId, 0); - } - void add_worldId(uint32_t worldId) { - fbb_.AddElement(RoomDataInternal::VT_WORLDID, worldId, 0); - } - void add_lobbyId(uint64_t lobbyId) { - fbb_.AddElement(RoomDataInternal::VT_LOBBYID, lobbyId, 0); - } - void add_roomId(uint64_t roomId) { - fbb_.AddElement(RoomDataInternal::VT_ROOMID, roomId, 0); - } - void add_passwordSlotMask(uint64_t passwordSlotMask) { - fbb_.AddElement(RoomDataInternal::VT_PASSWORDSLOTMASK, passwordSlotMask, 0); - } - void add_maxSlot(uint32_t maxSlot) { - fbb_.AddElement(RoomDataInternal::VT_MAXSLOT, maxSlot, 0); - } - void add_memberList(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> memberList) { - fbb_.AddOffset(RoomDataInternal::VT_MEMBERLIST, memberList); - } - void add_ownerId(uint16_t ownerId) { - fbb_.AddElement(RoomDataInternal::VT_OWNERID, ownerId, 0); - } - void add_roomGroup(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomGroup) { - fbb_.AddOffset(RoomDataInternal::VT_ROOMGROUP, roomGroup); - } - void add_flagAttr(uint32_t flagAttr) { - fbb_.AddElement(RoomDataInternal::VT_FLAGATTR, flagAttr, 0); - } - void add_roomBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrInternal) { - fbb_.AddOffset(RoomDataInternal::VT_ROOMBINATTRINTERNAL, roomBinAttrInternal); - } - explicit RoomDataInternalBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RoomDataInternalBuilder +{ + typedef RoomDataInternal Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_serverId(uint16_t serverId) + { + fbb_.AddElement(RoomDataInternal::VT_SERVERID, serverId, 0); + } + void add_worldId(uint32_t worldId) + { + fbb_.AddElement(RoomDataInternal::VT_WORLDID, worldId, 0); + } + void add_lobbyId(uint64_t lobbyId) + { + fbb_.AddElement(RoomDataInternal::VT_LOBBYID, lobbyId, 0); + } + void add_roomId(uint64_t roomId) + { + fbb_.AddElement(RoomDataInternal::VT_ROOMID, roomId, 0); + } + void add_passwordSlotMask(uint64_t passwordSlotMask) + { + fbb_.AddElement(RoomDataInternal::VT_PASSWORDSLOTMASK, passwordSlotMask, 0); + } + void add_maxSlot(uint32_t maxSlot) + { + fbb_.AddElement(RoomDataInternal::VT_MAXSLOT, maxSlot, 0); + } + void add_memberList(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> memberList) + { + fbb_.AddOffset(RoomDataInternal::VT_MEMBERLIST, memberList); + } + void add_ownerId(uint16_t ownerId) + { + fbb_.AddElement(RoomDataInternal::VT_OWNERID, ownerId, 0); + } + void add_roomGroup(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomGroup) + { + fbb_.AddOffset(RoomDataInternal::VT_ROOMGROUP, roomGroup); + } + void add_flagAttr(uint32_t flagAttr) + { + fbb_.AddElement(RoomDataInternal::VT_FLAGATTR, flagAttr, 0); + } + void add_roomBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrInternal) + { + fbb_.AddOffset(RoomDataInternal::VT_ROOMBINATTRINTERNAL, roomBinAttrInternal); + } + explicit RoomDataInternalBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRoomDataInternal( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint16_t serverId = 0, - uint32_t worldId = 0, - uint64_t lobbyId = 0, - uint64_t roomId = 0, - uint64_t passwordSlotMask = 0, - uint32_t maxSlot = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> memberList = 0, - uint16_t ownerId = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomGroup = 0, - uint32_t flagAttr = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrInternal = 0) { - RoomDataInternalBuilder builder_(_fbb); - builder_.add_passwordSlotMask(passwordSlotMask); - builder_.add_roomId(roomId); - builder_.add_lobbyId(lobbyId); - builder_.add_roomBinAttrInternal(roomBinAttrInternal); - builder_.add_flagAttr(flagAttr); - builder_.add_roomGroup(roomGroup); - builder_.add_memberList(memberList); - builder_.add_maxSlot(maxSlot); - builder_.add_worldId(worldId); - builder_.add_ownerId(ownerId); - builder_.add_serverId(serverId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint16_t serverId = 0, + uint32_t worldId = 0, + uint64_t lobbyId = 0, + uint64_t roomId = 0, + uint64_t passwordSlotMask = 0, + uint32_t maxSlot = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> memberList = 0, + uint16_t ownerId = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomGroup = 0, + uint32_t flagAttr = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrInternal = 0) +{ + RoomDataInternalBuilder builder_(_fbb); + builder_.add_passwordSlotMask(passwordSlotMask); + builder_.add_roomId(roomId); + builder_.add_lobbyId(lobbyId); + builder_.add_roomBinAttrInternal(roomBinAttrInternal); + builder_.add_flagAttr(flagAttr); + builder_.add_roomGroup(roomGroup); + builder_.add_memberList(memberList); + builder_.add_maxSlot(maxSlot); + builder_.add_worldId(worldId); + builder_.add_ownerId(ownerId); + builder_.add_serverId(serverId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateRoomDataInternalDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint16_t serverId = 0, - uint32_t worldId = 0, - uint64_t lobbyId = 0, - uint64_t roomId = 0, - uint64_t passwordSlotMask = 0, - uint32_t maxSlot = 0, - const std::vector<::flatbuffers::Offset> *memberList = nullptr, - uint16_t ownerId = 0, - const std::vector<::flatbuffers::Offset> *roomGroup = nullptr, - uint32_t flagAttr = 0, - const std::vector<::flatbuffers::Offset> *roomBinAttrInternal = nullptr) { - auto memberList__ = memberList ? _fbb.CreateVector<::flatbuffers::Offset>(*memberList) : 0; - auto roomGroup__ = roomGroup ? _fbb.CreateVector<::flatbuffers::Offset>(*roomGroup) : 0; - auto roomBinAttrInternal__ = roomBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomBinAttrInternal) : 0; - return CreateRoomDataInternal( - _fbb, - serverId, - worldId, - lobbyId, - roomId, - passwordSlotMask, - maxSlot, - memberList__, - ownerId, - roomGroup__, - flagAttr, - roomBinAttrInternal__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint16_t serverId = 0, + uint32_t worldId = 0, + uint64_t lobbyId = 0, + uint64_t roomId = 0, + uint64_t passwordSlotMask = 0, + uint32_t maxSlot = 0, + const std::vector<::flatbuffers::Offset>* memberList = nullptr, + uint16_t ownerId = 0, + const std::vector<::flatbuffers::Offset>* roomGroup = nullptr, + uint32_t flagAttr = 0, + const std::vector<::flatbuffers::Offset>* roomBinAttrInternal = nullptr) +{ + auto memberList__ = memberList ? _fbb.CreateVector<::flatbuffers::Offset>(*memberList) : 0; + auto roomGroup__ = roomGroup ? _fbb.CreateVector<::flatbuffers::Offset>(*roomGroup) : 0; + auto roomBinAttrInternal__ = roomBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomBinAttrInternal) : 0; + return CreateRoomDataInternal( + _fbb, + serverId, + worldId, + lobbyId, + roomId, + passwordSlotMask, + maxSlot, + memberList__, + ownerId, + roomGroup__, + flagAttr, + roomBinAttrInternal__); } -struct RoomDataExternal FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RoomDataExternalBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SERVERID = 4, - VT_WORLDID = 6, - VT_PUBLICSLOTNUM = 8, - VT_PRIVATESLOTNUM = 10, - VT_LOBBYID = 12, - VT_ROOMID = 14, - VT_OPENPUBLICSLOTNUM = 16, - VT_MAXSLOT = 18, - VT_OPENPRIVATESLOTNUM = 20, - VT_CURMEMBERNUM = 22, - VT_PASSWORDSLOTMASK = 24, - VT_OWNER = 26, - VT_ROOMGROUP = 28, - VT_FLAGATTR = 30, - VT_ROOMSEARCHABLEINTATTREXTERNAL = 32, - VT_ROOMSEARCHABLEBINATTREXTERNAL = 34, - VT_ROOMBINATTREXTERNAL = 36 - }; - uint16_t serverId() const { - return GetField(VT_SERVERID, 0); - } - uint32_t worldId() const { - return GetField(VT_WORLDID, 0); - } - uint16_t publicSlotNum() const { - return GetField(VT_PUBLICSLOTNUM, 0); - } - uint16_t privateSlotNum() const { - return GetField(VT_PRIVATESLOTNUM, 0); - } - uint64_t lobbyId() const { - return GetField(VT_LOBBYID, 0); - } - uint64_t roomId() const { - return GetField(VT_ROOMID, 0); - } - uint16_t openPublicSlotNum() const { - return GetField(VT_OPENPUBLICSLOTNUM, 0); - } - uint16_t maxSlot() const { - return GetField(VT_MAXSLOT, 0); - } - uint16_t openPrivateSlotNum() const { - return GetField(VT_OPENPRIVATESLOTNUM, 0); - } - uint16_t curMemberNum() const { - return GetField(VT_CURMEMBERNUM, 0); - } - uint64_t passwordSlotMask() const { - return GetField(VT_PASSWORDSLOTMASK, 0); - } - const UserInfo *owner() const { - return GetPointer(VT_OWNER); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomGroup() const { - return GetPointer> *>(VT_ROOMGROUP); - } - uint32_t flagAttr() const { - return GetField(VT_FLAGATTR, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomSearchableIntAttrExternal() const { - return GetPointer> *>(VT_ROOMSEARCHABLEINTATTREXTERNAL); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomSearchableBinAttrExternal() const { - return GetPointer> *>(VT_ROOMSEARCHABLEBINATTREXTERNAL); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomBinAttrExternal() const { - return GetPointer> *>(VT_ROOMBINATTREXTERNAL); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_SERVERID, 2) && - VerifyField(verifier, VT_WORLDID, 4) && - VerifyField(verifier, VT_PUBLICSLOTNUM, 2) && - VerifyField(verifier, VT_PRIVATESLOTNUM, 2) && - VerifyField(verifier, VT_LOBBYID, 8) && - VerifyField(verifier, VT_ROOMID, 8) && - VerifyField(verifier, VT_OPENPUBLICSLOTNUM, 2) && - VerifyField(verifier, VT_MAXSLOT, 2) && - VerifyField(verifier, VT_OPENPRIVATESLOTNUM, 2) && - VerifyField(verifier, VT_CURMEMBERNUM, 2) && - VerifyField(verifier, VT_PASSWORDSLOTMASK, 8) && - VerifyOffset(verifier, VT_OWNER) && - verifier.VerifyTable(owner()) && - VerifyOffset(verifier, VT_ROOMGROUP) && - verifier.VerifyVector(roomGroup()) && - verifier.VerifyVectorOfTables(roomGroup()) && - VerifyField(verifier, VT_FLAGATTR, 4) && - VerifyOffset(verifier, VT_ROOMSEARCHABLEINTATTREXTERNAL) && - verifier.VerifyVector(roomSearchableIntAttrExternal()) && - verifier.VerifyVectorOfTables(roomSearchableIntAttrExternal()) && - VerifyOffset(verifier, VT_ROOMSEARCHABLEBINATTREXTERNAL) && - verifier.VerifyVector(roomSearchableBinAttrExternal()) && - verifier.VerifyVectorOfTables(roomSearchableBinAttrExternal()) && - VerifyOffset(verifier, VT_ROOMBINATTREXTERNAL) && - verifier.VerifyVector(roomBinAttrExternal()) && - verifier.VerifyVectorOfTables(roomBinAttrExternal()) && - verifier.EndTable(); - } +struct RoomDataExternal FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RoomDataExternalBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_SERVERID = 4, + VT_WORLDID = 6, + VT_PUBLICSLOTNUM = 8, + VT_PRIVATESLOTNUM = 10, + VT_LOBBYID = 12, + VT_ROOMID = 14, + VT_OPENPUBLICSLOTNUM = 16, + VT_MAXSLOT = 18, + VT_OPENPRIVATESLOTNUM = 20, + VT_CURMEMBERNUM = 22, + VT_PASSWORDSLOTMASK = 24, + VT_OWNER = 26, + VT_ROOMGROUP = 28, + VT_FLAGATTR = 30, + VT_ROOMSEARCHABLEINTATTREXTERNAL = 32, + VT_ROOMSEARCHABLEBINATTREXTERNAL = 34, + VT_ROOMBINATTREXTERNAL = 36 + }; + uint16_t serverId() const + { + return GetField(VT_SERVERID, 0); + } + uint32_t worldId() const + { + return GetField(VT_WORLDID, 0); + } + uint16_t publicSlotNum() const + { + return GetField(VT_PUBLICSLOTNUM, 0); + } + uint16_t privateSlotNum() const + { + return GetField(VT_PRIVATESLOTNUM, 0); + } + uint64_t lobbyId() const + { + return GetField(VT_LOBBYID, 0); + } + uint64_t roomId() const + { + return GetField(VT_ROOMID, 0); + } + uint16_t openPublicSlotNum() const + { + return GetField(VT_OPENPUBLICSLOTNUM, 0); + } + uint16_t maxSlot() const + { + return GetField(VT_MAXSLOT, 0); + } + uint16_t openPrivateSlotNum() const + { + return GetField(VT_OPENPRIVATESLOTNUM, 0); + } + uint16_t curMemberNum() const + { + return GetField(VT_CURMEMBERNUM, 0); + } + uint64_t passwordSlotMask() const + { + return GetField(VT_PASSWORDSLOTMASK, 0); + } + const UserInfo* owner() const + { + return GetPointer(VT_OWNER); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomGroup() const + { + return GetPointer>*>(VT_ROOMGROUP); + } + uint32_t flagAttr() const + { + return GetField(VT_FLAGATTR, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomSearchableIntAttrExternal() const + { + return GetPointer>*>(VT_ROOMSEARCHABLEINTATTREXTERNAL); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomSearchableBinAttrExternal() const + { + return GetPointer>*>(VT_ROOMSEARCHABLEBINATTREXTERNAL); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomBinAttrExternal() const + { + return GetPointer>*>(VT_ROOMBINATTREXTERNAL); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_SERVERID, 2) && + VerifyField(verifier, VT_WORLDID, 4) && + VerifyField(verifier, VT_PUBLICSLOTNUM, 2) && + VerifyField(verifier, VT_PRIVATESLOTNUM, 2) && + VerifyField(verifier, VT_LOBBYID, 8) && + VerifyField(verifier, VT_ROOMID, 8) && + VerifyField(verifier, VT_OPENPUBLICSLOTNUM, 2) && + VerifyField(verifier, VT_MAXSLOT, 2) && + VerifyField(verifier, VT_OPENPRIVATESLOTNUM, 2) && + VerifyField(verifier, VT_CURMEMBERNUM, 2) && + VerifyField(verifier, VT_PASSWORDSLOTMASK, 8) && + VerifyOffset(verifier, VT_OWNER) && + verifier.VerifyTable(owner()) && + VerifyOffset(verifier, VT_ROOMGROUP) && + verifier.VerifyVector(roomGroup()) && + verifier.VerifyVectorOfTables(roomGroup()) && + VerifyField(verifier, VT_FLAGATTR, 4) && + VerifyOffset(verifier, VT_ROOMSEARCHABLEINTATTREXTERNAL) && + verifier.VerifyVector(roomSearchableIntAttrExternal()) && + verifier.VerifyVectorOfTables(roomSearchableIntAttrExternal()) && + VerifyOffset(verifier, VT_ROOMSEARCHABLEBINATTREXTERNAL) && + verifier.VerifyVector(roomSearchableBinAttrExternal()) && + verifier.VerifyVectorOfTables(roomSearchableBinAttrExternal()) && + VerifyOffset(verifier, VT_ROOMBINATTREXTERNAL) && + verifier.VerifyVector(roomBinAttrExternal()) && + verifier.VerifyVectorOfTables(roomBinAttrExternal()) && + verifier.EndTable(); + } }; -struct RoomDataExternalBuilder { - typedef RoomDataExternal Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_serverId(uint16_t serverId) { - fbb_.AddElement(RoomDataExternal::VT_SERVERID, serverId, 0); - } - void add_worldId(uint32_t worldId) { - fbb_.AddElement(RoomDataExternal::VT_WORLDID, worldId, 0); - } - void add_publicSlotNum(uint16_t publicSlotNum) { - fbb_.AddElement(RoomDataExternal::VT_PUBLICSLOTNUM, publicSlotNum, 0); - } - void add_privateSlotNum(uint16_t privateSlotNum) { - fbb_.AddElement(RoomDataExternal::VT_PRIVATESLOTNUM, privateSlotNum, 0); - } - void add_lobbyId(uint64_t lobbyId) { - fbb_.AddElement(RoomDataExternal::VT_LOBBYID, lobbyId, 0); - } - void add_roomId(uint64_t roomId) { - fbb_.AddElement(RoomDataExternal::VT_ROOMID, roomId, 0); - } - void add_openPublicSlotNum(uint16_t openPublicSlotNum) { - fbb_.AddElement(RoomDataExternal::VT_OPENPUBLICSLOTNUM, openPublicSlotNum, 0); - } - void add_maxSlot(uint16_t maxSlot) { - fbb_.AddElement(RoomDataExternal::VT_MAXSLOT, maxSlot, 0); - } - void add_openPrivateSlotNum(uint16_t openPrivateSlotNum) { - fbb_.AddElement(RoomDataExternal::VT_OPENPRIVATESLOTNUM, openPrivateSlotNum, 0); - } - void add_curMemberNum(uint16_t curMemberNum) { - fbb_.AddElement(RoomDataExternal::VT_CURMEMBERNUM, curMemberNum, 0); - } - void add_passwordSlotMask(uint64_t passwordSlotMask) { - fbb_.AddElement(RoomDataExternal::VT_PASSWORDSLOTMASK, passwordSlotMask, 0); - } - void add_owner(::flatbuffers::Offset owner) { - fbb_.AddOffset(RoomDataExternal::VT_OWNER, owner); - } - void add_roomGroup(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomGroup) { - fbb_.AddOffset(RoomDataExternal::VT_ROOMGROUP, roomGroup); - } - void add_flagAttr(uint32_t flagAttr) { - fbb_.AddElement(RoomDataExternal::VT_FLAGATTR, flagAttr, 0); - } - void add_roomSearchableIntAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableIntAttrExternal) { - fbb_.AddOffset(RoomDataExternal::VT_ROOMSEARCHABLEINTATTREXTERNAL, roomSearchableIntAttrExternal); - } - void add_roomSearchableBinAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableBinAttrExternal) { - fbb_.AddOffset(RoomDataExternal::VT_ROOMSEARCHABLEBINATTREXTERNAL, roomSearchableBinAttrExternal); - } - void add_roomBinAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrExternal) { - fbb_.AddOffset(RoomDataExternal::VT_ROOMBINATTREXTERNAL, roomBinAttrExternal); - } - explicit RoomDataExternalBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RoomDataExternalBuilder +{ + typedef RoomDataExternal Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_serverId(uint16_t serverId) + { + fbb_.AddElement(RoomDataExternal::VT_SERVERID, serverId, 0); + } + void add_worldId(uint32_t worldId) + { + fbb_.AddElement(RoomDataExternal::VT_WORLDID, worldId, 0); + } + void add_publicSlotNum(uint16_t publicSlotNum) + { + fbb_.AddElement(RoomDataExternal::VT_PUBLICSLOTNUM, publicSlotNum, 0); + } + void add_privateSlotNum(uint16_t privateSlotNum) + { + fbb_.AddElement(RoomDataExternal::VT_PRIVATESLOTNUM, privateSlotNum, 0); + } + void add_lobbyId(uint64_t lobbyId) + { + fbb_.AddElement(RoomDataExternal::VT_LOBBYID, lobbyId, 0); + } + void add_roomId(uint64_t roomId) + { + fbb_.AddElement(RoomDataExternal::VT_ROOMID, roomId, 0); + } + void add_openPublicSlotNum(uint16_t openPublicSlotNum) + { + fbb_.AddElement(RoomDataExternal::VT_OPENPUBLICSLOTNUM, openPublicSlotNum, 0); + } + void add_maxSlot(uint16_t maxSlot) + { + fbb_.AddElement(RoomDataExternal::VT_MAXSLOT, maxSlot, 0); + } + void add_openPrivateSlotNum(uint16_t openPrivateSlotNum) + { + fbb_.AddElement(RoomDataExternal::VT_OPENPRIVATESLOTNUM, openPrivateSlotNum, 0); + } + void add_curMemberNum(uint16_t curMemberNum) + { + fbb_.AddElement(RoomDataExternal::VT_CURMEMBERNUM, curMemberNum, 0); + } + void add_passwordSlotMask(uint64_t passwordSlotMask) + { + fbb_.AddElement(RoomDataExternal::VT_PASSWORDSLOTMASK, passwordSlotMask, 0); + } + void add_owner(::flatbuffers::Offset owner) + { + fbb_.AddOffset(RoomDataExternal::VT_OWNER, owner); + } + void add_roomGroup(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomGroup) + { + fbb_.AddOffset(RoomDataExternal::VT_ROOMGROUP, roomGroup); + } + void add_flagAttr(uint32_t flagAttr) + { + fbb_.AddElement(RoomDataExternal::VT_FLAGATTR, flagAttr, 0); + } + void add_roomSearchableIntAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableIntAttrExternal) + { + fbb_.AddOffset(RoomDataExternal::VT_ROOMSEARCHABLEINTATTREXTERNAL, roomSearchableIntAttrExternal); + } + void add_roomSearchableBinAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableBinAttrExternal) + { + fbb_.AddOffset(RoomDataExternal::VT_ROOMSEARCHABLEBINATTREXTERNAL, roomSearchableBinAttrExternal); + } + void add_roomBinAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrExternal) + { + fbb_.AddOffset(RoomDataExternal::VT_ROOMBINATTREXTERNAL, roomBinAttrExternal); + } + explicit RoomDataExternalBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRoomDataExternal( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint16_t serverId = 0, - uint32_t worldId = 0, - uint16_t publicSlotNum = 0, - uint16_t privateSlotNum = 0, - uint64_t lobbyId = 0, - uint64_t roomId = 0, - uint16_t openPublicSlotNum = 0, - uint16_t maxSlot = 0, - uint16_t openPrivateSlotNum = 0, - uint16_t curMemberNum = 0, - uint64_t passwordSlotMask = 0, - ::flatbuffers::Offset owner = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomGroup = 0, - uint32_t flagAttr = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableIntAttrExternal = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableBinAttrExternal = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrExternal = 0) { - RoomDataExternalBuilder builder_(_fbb); - builder_.add_passwordSlotMask(passwordSlotMask); - builder_.add_roomId(roomId); - builder_.add_lobbyId(lobbyId); - builder_.add_roomBinAttrExternal(roomBinAttrExternal); - builder_.add_roomSearchableBinAttrExternal(roomSearchableBinAttrExternal); - builder_.add_roomSearchableIntAttrExternal(roomSearchableIntAttrExternal); - builder_.add_flagAttr(flagAttr); - builder_.add_roomGroup(roomGroup); - builder_.add_owner(owner); - builder_.add_worldId(worldId); - builder_.add_curMemberNum(curMemberNum); - builder_.add_openPrivateSlotNum(openPrivateSlotNum); - builder_.add_maxSlot(maxSlot); - builder_.add_openPublicSlotNum(openPublicSlotNum); - builder_.add_privateSlotNum(privateSlotNum); - builder_.add_publicSlotNum(publicSlotNum); - builder_.add_serverId(serverId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint16_t serverId = 0, + uint32_t worldId = 0, + uint16_t publicSlotNum = 0, + uint16_t privateSlotNum = 0, + uint64_t lobbyId = 0, + uint64_t roomId = 0, + uint16_t openPublicSlotNum = 0, + uint16_t maxSlot = 0, + uint16_t openPrivateSlotNum = 0, + uint16_t curMemberNum = 0, + uint64_t passwordSlotMask = 0, + ::flatbuffers::Offset owner = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomGroup = 0, + uint32_t flagAttr = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableIntAttrExternal = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableBinAttrExternal = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrExternal = 0) +{ + RoomDataExternalBuilder builder_(_fbb); + builder_.add_passwordSlotMask(passwordSlotMask); + builder_.add_roomId(roomId); + builder_.add_lobbyId(lobbyId); + builder_.add_roomBinAttrExternal(roomBinAttrExternal); + builder_.add_roomSearchableBinAttrExternal(roomSearchableBinAttrExternal); + builder_.add_roomSearchableIntAttrExternal(roomSearchableIntAttrExternal); + builder_.add_flagAttr(flagAttr); + builder_.add_roomGroup(roomGroup); + builder_.add_owner(owner); + builder_.add_worldId(worldId); + builder_.add_curMemberNum(curMemberNum); + builder_.add_openPrivateSlotNum(openPrivateSlotNum); + builder_.add_maxSlot(maxSlot); + builder_.add_openPublicSlotNum(openPublicSlotNum); + builder_.add_privateSlotNum(privateSlotNum); + builder_.add_publicSlotNum(publicSlotNum); + builder_.add_serverId(serverId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateRoomDataExternalDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint16_t serverId = 0, - uint32_t worldId = 0, - uint16_t publicSlotNum = 0, - uint16_t privateSlotNum = 0, - uint64_t lobbyId = 0, - uint64_t roomId = 0, - uint16_t openPublicSlotNum = 0, - uint16_t maxSlot = 0, - uint16_t openPrivateSlotNum = 0, - uint16_t curMemberNum = 0, - uint64_t passwordSlotMask = 0, - ::flatbuffers::Offset owner = 0, - const std::vector<::flatbuffers::Offset> *roomGroup = nullptr, - uint32_t flagAttr = 0, - const std::vector<::flatbuffers::Offset> *roomSearchableIntAttrExternal = nullptr, - const std::vector<::flatbuffers::Offset> *roomSearchableBinAttrExternal = nullptr, - const std::vector<::flatbuffers::Offset> *roomBinAttrExternal = nullptr) { - auto roomGroup__ = roomGroup ? _fbb.CreateVector<::flatbuffers::Offset>(*roomGroup) : 0; - auto roomSearchableIntAttrExternal__ = roomSearchableIntAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomSearchableIntAttrExternal) : 0; - auto roomSearchableBinAttrExternal__ = roomSearchableBinAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomSearchableBinAttrExternal) : 0; - auto roomBinAttrExternal__ = roomBinAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomBinAttrExternal) : 0; - return CreateRoomDataExternal( - _fbb, - serverId, - worldId, - publicSlotNum, - privateSlotNum, - lobbyId, - roomId, - openPublicSlotNum, - maxSlot, - openPrivateSlotNum, - curMemberNum, - passwordSlotMask, - owner, - roomGroup__, - flagAttr, - roomSearchableIntAttrExternal__, - roomSearchableBinAttrExternal__, - roomBinAttrExternal__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint16_t serverId = 0, + uint32_t worldId = 0, + uint16_t publicSlotNum = 0, + uint16_t privateSlotNum = 0, + uint64_t lobbyId = 0, + uint64_t roomId = 0, + uint16_t openPublicSlotNum = 0, + uint16_t maxSlot = 0, + uint16_t openPrivateSlotNum = 0, + uint16_t curMemberNum = 0, + uint64_t passwordSlotMask = 0, + ::flatbuffers::Offset owner = 0, + const std::vector<::flatbuffers::Offset>* roomGroup = nullptr, + uint32_t flagAttr = 0, + const std::vector<::flatbuffers::Offset>* roomSearchableIntAttrExternal = nullptr, + const std::vector<::flatbuffers::Offset>* roomSearchableBinAttrExternal = nullptr, + const std::vector<::flatbuffers::Offset>* roomBinAttrExternal = nullptr) +{ + auto roomGroup__ = roomGroup ? _fbb.CreateVector<::flatbuffers::Offset>(*roomGroup) : 0; + auto roomSearchableIntAttrExternal__ = roomSearchableIntAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomSearchableIntAttrExternal) : 0; + auto roomSearchableBinAttrExternal__ = roomSearchableBinAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomSearchableBinAttrExternal) : 0; + auto roomBinAttrExternal__ = roomBinAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomBinAttrExternal) : 0; + return CreateRoomDataExternal( + _fbb, + serverId, + worldId, + publicSlotNum, + privateSlotNum, + lobbyId, + roomId, + openPublicSlotNum, + maxSlot, + openPrivateSlotNum, + curMemberNum, + passwordSlotMask, + owner, + roomGroup__, + flagAttr, + roomSearchableIntAttrExternal__, + roomSearchableBinAttrExternal__, + roomBinAttrExternal__); } -struct IntSearchFilter FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef IntSearchFilterBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SEARCHOPERATOR = 4, - VT_ATTR = 6 - }; - uint8_t searchOperator() const { - return GetField(VT_SEARCHOPERATOR, 0); - } - const IntAttr *attr() const { - return GetPointer(VT_ATTR); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_SEARCHOPERATOR, 1) && - VerifyOffset(verifier, VT_ATTR) && - verifier.VerifyTable(attr()) && - verifier.EndTable(); - } +struct IntSearchFilter FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef IntSearchFilterBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_SEARCHOPERATOR = 4, + VT_ATTR = 6 + }; + uint8_t searchOperator() const + { + return GetField(VT_SEARCHOPERATOR, 0); + } + const IntAttr* attr() const + { + return GetPointer(VT_ATTR); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_SEARCHOPERATOR, 1) && + VerifyOffset(verifier, VT_ATTR) && + verifier.VerifyTable(attr()) && + verifier.EndTable(); + } }; -struct IntSearchFilterBuilder { - typedef IntSearchFilter Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_searchOperator(uint8_t searchOperator) { - fbb_.AddElement(IntSearchFilter::VT_SEARCHOPERATOR, searchOperator, 0); - } - void add_attr(::flatbuffers::Offset attr) { - fbb_.AddOffset(IntSearchFilter::VT_ATTR, attr); - } - explicit IntSearchFilterBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct IntSearchFilterBuilder +{ + typedef IntSearchFilter Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_searchOperator(uint8_t searchOperator) + { + fbb_.AddElement(IntSearchFilter::VT_SEARCHOPERATOR, searchOperator, 0); + } + void add_attr(::flatbuffers::Offset attr) + { + fbb_.AddOffset(IntSearchFilter::VT_ATTR, attr); + } + explicit IntSearchFilterBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateIntSearchFilter( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint8_t searchOperator = 0, - ::flatbuffers::Offset attr = 0) { - IntSearchFilterBuilder builder_(_fbb); - builder_.add_attr(attr); - builder_.add_searchOperator(searchOperator); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint8_t searchOperator = 0, + ::flatbuffers::Offset attr = 0) +{ + IntSearchFilterBuilder builder_(_fbb); + builder_.add_attr(attr); + builder_.add_searchOperator(searchOperator); + return builder_.Finish(); } -struct BinSearchFilter FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef BinSearchFilterBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SEARCHOPERATOR = 4, - VT_ATTR = 6 - }; - uint8_t searchOperator() const { - return GetField(VT_SEARCHOPERATOR, 0); - } - const BinAttr *attr() const { - return GetPointer(VT_ATTR); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_SEARCHOPERATOR, 1) && - VerifyOffset(verifier, VT_ATTR) && - verifier.VerifyTable(attr()) && - verifier.EndTable(); - } +struct BinSearchFilter FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef BinSearchFilterBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_SEARCHOPERATOR = 4, + VT_ATTR = 6 + }; + uint8_t searchOperator() const + { + return GetField(VT_SEARCHOPERATOR, 0); + } + const BinAttr* attr() const + { + return GetPointer(VT_ATTR); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_SEARCHOPERATOR, 1) && + VerifyOffset(verifier, VT_ATTR) && + verifier.VerifyTable(attr()) && + verifier.EndTable(); + } }; -struct BinSearchFilterBuilder { - typedef BinSearchFilter Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_searchOperator(uint8_t searchOperator) { - fbb_.AddElement(BinSearchFilter::VT_SEARCHOPERATOR, searchOperator, 0); - } - void add_attr(::flatbuffers::Offset attr) { - fbb_.AddOffset(BinSearchFilter::VT_ATTR, attr); - } - explicit BinSearchFilterBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct BinSearchFilterBuilder +{ + typedef BinSearchFilter Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_searchOperator(uint8_t searchOperator) + { + fbb_.AddElement(BinSearchFilter::VT_SEARCHOPERATOR, searchOperator, 0); + } + void add_attr(::flatbuffers::Offset attr) + { + fbb_.AddOffset(BinSearchFilter::VT_ATTR, attr); + } + explicit BinSearchFilterBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateBinSearchFilter( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint8_t searchOperator = 0, - ::flatbuffers::Offset attr = 0) { - BinSearchFilterBuilder builder_(_fbb); - builder_.add_attr(attr); - builder_.add_searchOperator(searchOperator); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint8_t searchOperator = 0, + ::flatbuffers::Offset attr = 0) +{ + BinSearchFilterBuilder builder_(_fbb); + builder_.add_attr(attr); + builder_.add_searchOperator(searchOperator); + return builder_.Finish(); } -struct PresenceOptionData FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef PresenceOptionDataBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_DATA = 4, - VT_LEN = 6 - }; - const ::flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); - } - uint32_t len() const { - return GetField(VT_LEN, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_DATA) && - verifier.VerifyVector(data()) && - VerifyField(verifier, VT_LEN, 4) && - verifier.EndTable(); - } +struct PresenceOptionData FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef PresenceOptionDataBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_DATA = 4, + VT_LEN = 6 + }; + const ::flatbuffers::Vector* data() const + { + return GetPointer*>(VT_DATA); + } + uint32_t len() const + { + return GetField(VT_LEN, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_DATA) && + verifier.VerifyVector(data()) && + VerifyField(verifier, VT_LEN, 4) && + verifier.EndTable(); + } }; -struct PresenceOptionDataBuilder { - typedef PresenceOptionData Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { - fbb_.AddOffset(PresenceOptionData::VT_DATA, data); - } - void add_len(uint32_t len) { - fbb_.AddElement(PresenceOptionData::VT_LEN, len, 0); - } - explicit PresenceOptionDataBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct PresenceOptionDataBuilder +{ + typedef PresenceOptionData Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) + { + fbb_.AddOffset(PresenceOptionData::VT_DATA, data); + } + void add_len(uint32_t len) + { + fbb_.AddElement(PresenceOptionData::VT_LEN, len, 0); + } + explicit PresenceOptionDataBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreatePresenceOptionData( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector> data = 0, - uint32_t len = 0) { - PresenceOptionDataBuilder builder_(_fbb); - builder_.add_len(len); - builder_.add_data(data); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0, + uint32_t len = 0) +{ + PresenceOptionDataBuilder builder_(_fbb); + builder_.add_len(len); + builder_.add_data(data); + return builder_.Finish(); } inline ::flatbuffers::Offset CreatePresenceOptionDataDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *data = nullptr, - uint32_t len = 0) { - auto data__ = data ? _fbb.CreateVector(*data) : 0; - return CreatePresenceOptionData( - _fbb, - data__, - len); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector* data = nullptr, + uint32_t len = 0) +{ + auto data__ = data ? _fbb.CreateVector(*data) : 0; + return CreatePresenceOptionData( + _fbb, + data__, + len); } -struct RoomGroupPasswordConfig FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RoomGroupPasswordConfigBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_GROUPID = 4, - VT_WITHPASSWORD = 6 - }; - uint8_t groupId() const { - return GetField(VT_GROUPID, 0); - } - bool withPassword() const { - return GetField(VT_WITHPASSWORD, 0) != 0; - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_GROUPID, 1) && - VerifyField(verifier, VT_WITHPASSWORD, 1) && - verifier.EndTable(); - } +struct RoomGroupPasswordConfig FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RoomGroupPasswordConfigBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_GROUPID = 4, + VT_WITHPASSWORD = 6 + }; + uint8_t groupId() const + { + return GetField(VT_GROUPID, 0); + } + bool withPassword() const + { + return GetField(VT_WITHPASSWORD, 0) != 0; + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_GROUPID, 1) && + VerifyField(verifier, VT_WITHPASSWORD, 1) && + verifier.EndTable(); + } }; -struct RoomGroupPasswordConfigBuilder { - typedef RoomGroupPasswordConfig Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_groupId(uint8_t groupId) { - fbb_.AddElement(RoomGroupPasswordConfig::VT_GROUPID, groupId, 0); - } - void add_withPassword(bool withPassword) { - fbb_.AddElement(RoomGroupPasswordConfig::VT_WITHPASSWORD, static_cast(withPassword), 0); - } - explicit RoomGroupPasswordConfigBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RoomGroupPasswordConfigBuilder +{ + typedef RoomGroupPasswordConfig Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_groupId(uint8_t groupId) + { + fbb_.AddElement(RoomGroupPasswordConfig::VT_GROUPID, groupId, 0); + } + void add_withPassword(bool withPassword) + { + fbb_.AddElement(RoomGroupPasswordConfig::VT_WITHPASSWORD, static_cast(withPassword), 0); + } + explicit RoomGroupPasswordConfigBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRoomGroupPasswordConfig( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint8_t groupId = 0, - bool withPassword = false) { - RoomGroupPasswordConfigBuilder builder_(_fbb); - builder_.add_withPassword(withPassword); - builder_.add_groupId(groupId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint8_t groupId = 0, + bool withPassword = false) +{ + RoomGroupPasswordConfigBuilder builder_(_fbb); + builder_.add_withPassword(withPassword); + builder_.add_groupId(groupId); + return builder_.Finish(); } -struct SearchRoomRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef SearchRoomRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_OPTION = 4, - VT_WORLDID = 6, - VT_LOBBYID = 8, - VT_RANGEFILTER_STARTINDEX = 10, - VT_RANGEFILTER_MAX = 12, - VT_FLAGFILTER = 14, - VT_FLAGATTR = 16, - VT_INTFILTER = 18, - VT_BINFILTER = 20, - VT_ATTRID = 22 - }; - int32_t option() const { - return GetField(VT_OPTION, 0); - } - uint32_t worldId() const { - return GetField(VT_WORLDID, 0); - } - uint64_t lobbyId() const { - return GetField(VT_LOBBYID, 0); - } - uint32_t rangeFilter_startIndex() const { - return GetField(VT_RANGEFILTER_STARTINDEX, 0); - } - uint32_t rangeFilter_max() const { - return GetField(VT_RANGEFILTER_MAX, 0); - } - uint32_t flagFilter() const { - return GetField(VT_FLAGFILTER, 0); - } - uint32_t flagAttr() const { - return GetField(VT_FLAGATTR, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *intFilter() const { - return GetPointer> *>(VT_INTFILTER); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *binFilter() const { - return GetPointer> *>(VT_BINFILTER); - } - const ::flatbuffers::Vector *attrId() const { - return GetPointer *>(VT_ATTRID); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_OPTION, 4) && - VerifyField(verifier, VT_WORLDID, 4) && - VerifyField(verifier, VT_LOBBYID, 8) && - VerifyField(verifier, VT_RANGEFILTER_STARTINDEX, 4) && - VerifyField(verifier, VT_RANGEFILTER_MAX, 4) && - VerifyField(verifier, VT_FLAGFILTER, 4) && - VerifyField(verifier, VT_FLAGATTR, 4) && - VerifyOffset(verifier, VT_INTFILTER) && - verifier.VerifyVector(intFilter()) && - verifier.VerifyVectorOfTables(intFilter()) && - VerifyOffset(verifier, VT_BINFILTER) && - verifier.VerifyVector(binFilter()) && - verifier.VerifyVectorOfTables(binFilter()) && - VerifyOffset(verifier, VT_ATTRID) && - verifier.VerifyVector(attrId()) && - verifier.EndTable(); - } +struct SearchRoomRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef SearchRoomRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_OPTION = 4, + VT_WORLDID = 6, + VT_LOBBYID = 8, + VT_RANGEFILTER_STARTINDEX = 10, + VT_RANGEFILTER_MAX = 12, + VT_FLAGFILTER = 14, + VT_FLAGATTR = 16, + VT_INTFILTER = 18, + VT_BINFILTER = 20, + VT_ATTRID = 22 + }; + int32_t option() const + { + return GetField(VT_OPTION, 0); + } + uint32_t worldId() const + { + return GetField(VT_WORLDID, 0); + } + uint64_t lobbyId() const + { + return GetField(VT_LOBBYID, 0); + } + uint32_t rangeFilter_startIndex() const + { + return GetField(VT_RANGEFILTER_STARTINDEX, 0); + } + uint32_t rangeFilter_max() const + { + return GetField(VT_RANGEFILTER_MAX, 0); + } + uint32_t flagFilter() const + { + return GetField(VT_FLAGFILTER, 0); + } + uint32_t flagAttr() const + { + return GetField(VT_FLAGATTR, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* intFilter() const + { + return GetPointer>*>(VT_INTFILTER); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* binFilter() const + { + return GetPointer>*>(VT_BINFILTER); + } + const ::flatbuffers::Vector* attrId() const + { + return GetPointer*>(VT_ATTRID); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_OPTION, 4) && + VerifyField(verifier, VT_WORLDID, 4) && + VerifyField(verifier, VT_LOBBYID, 8) && + VerifyField(verifier, VT_RANGEFILTER_STARTINDEX, 4) && + VerifyField(verifier, VT_RANGEFILTER_MAX, 4) && + VerifyField(verifier, VT_FLAGFILTER, 4) && + VerifyField(verifier, VT_FLAGATTR, 4) && + VerifyOffset(verifier, VT_INTFILTER) && + verifier.VerifyVector(intFilter()) && + verifier.VerifyVectorOfTables(intFilter()) && + VerifyOffset(verifier, VT_BINFILTER) && + verifier.VerifyVector(binFilter()) && + verifier.VerifyVectorOfTables(binFilter()) && + VerifyOffset(verifier, VT_ATTRID) && + verifier.VerifyVector(attrId()) && + verifier.EndTable(); + } }; -struct SearchRoomRequestBuilder { - typedef SearchRoomRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_option(int32_t option) { - fbb_.AddElement(SearchRoomRequest::VT_OPTION, option, 0); - } - void add_worldId(uint32_t worldId) { - fbb_.AddElement(SearchRoomRequest::VT_WORLDID, worldId, 0); - } - void add_lobbyId(uint64_t lobbyId) { - fbb_.AddElement(SearchRoomRequest::VT_LOBBYID, lobbyId, 0); - } - void add_rangeFilter_startIndex(uint32_t rangeFilter_startIndex) { - fbb_.AddElement(SearchRoomRequest::VT_RANGEFILTER_STARTINDEX, rangeFilter_startIndex, 0); - } - void add_rangeFilter_max(uint32_t rangeFilter_max) { - fbb_.AddElement(SearchRoomRequest::VT_RANGEFILTER_MAX, rangeFilter_max, 0); - } - void add_flagFilter(uint32_t flagFilter) { - fbb_.AddElement(SearchRoomRequest::VT_FLAGFILTER, flagFilter, 0); - } - void add_flagAttr(uint32_t flagAttr) { - fbb_.AddElement(SearchRoomRequest::VT_FLAGATTR, flagAttr, 0); - } - void add_intFilter(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> intFilter) { - fbb_.AddOffset(SearchRoomRequest::VT_INTFILTER, intFilter); - } - void add_binFilter(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> binFilter) { - fbb_.AddOffset(SearchRoomRequest::VT_BINFILTER, binFilter); - } - void add_attrId(::flatbuffers::Offset<::flatbuffers::Vector> attrId) { - fbb_.AddOffset(SearchRoomRequest::VT_ATTRID, attrId); - } - explicit SearchRoomRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct SearchRoomRequestBuilder +{ + typedef SearchRoomRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_option(int32_t option) + { + fbb_.AddElement(SearchRoomRequest::VT_OPTION, option, 0); + } + void add_worldId(uint32_t worldId) + { + fbb_.AddElement(SearchRoomRequest::VT_WORLDID, worldId, 0); + } + void add_lobbyId(uint64_t lobbyId) + { + fbb_.AddElement(SearchRoomRequest::VT_LOBBYID, lobbyId, 0); + } + void add_rangeFilter_startIndex(uint32_t rangeFilter_startIndex) + { + fbb_.AddElement(SearchRoomRequest::VT_RANGEFILTER_STARTINDEX, rangeFilter_startIndex, 0); + } + void add_rangeFilter_max(uint32_t rangeFilter_max) + { + fbb_.AddElement(SearchRoomRequest::VT_RANGEFILTER_MAX, rangeFilter_max, 0); + } + void add_flagFilter(uint32_t flagFilter) + { + fbb_.AddElement(SearchRoomRequest::VT_FLAGFILTER, flagFilter, 0); + } + void add_flagAttr(uint32_t flagAttr) + { + fbb_.AddElement(SearchRoomRequest::VT_FLAGATTR, flagAttr, 0); + } + void add_intFilter(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> intFilter) + { + fbb_.AddOffset(SearchRoomRequest::VT_INTFILTER, intFilter); + } + void add_binFilter(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> binFilter) + { + fbb_.AddOffset(SearchRoomRequest::VT_BINFILTER, binFilter); + } + void add_attrId(::flatbuffers::Offset<::flatbuffers::Vector> attrId) + { + fbb_.AddOffset(SearchRoomRequest::VT_ATTRID, attrId); + } + explicit SearchRoomRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateSearchRoomRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - int32_t option = 0, - uint32_t worldId = 0, - uint64_t lobbyId = 0, - uint32_t rangeFilter_startIndex = 0, - uint32_t rangeFilter_max = 0, - uint32_t flagFilter = 0, - uint32_t flagAttr = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> intFilter = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> binFilter = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> attrId = 0) { - SearchRoomRequestBuilder builder_(_fbb); - builder_.add_lobbyId(lobbyId); - builder_.add_attrId(attrId); - builder_.add_binFilter(binFilter); - builder_.add_intFilter(intFilter); - builder_.add_flagAttr(flagAttr); - builder_.add_flagFilter(flagFilter); - builder_.add_rangeFilter_max(rangeFilter_max); - builder_.add_rangeFilter_startIndex(rangeFilter_startIndex); - builder_.add_worldId(worldId); - builder_.add_option(option); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + int32_t option = 0, + uint32_t worldId = 0, + uint64_t lobbyId = 0, + uint32_t rangeFilter_startIndex = 0, + uint32_t rangeFilter_max = 0, + uint32_t flagFilter = 0, + uint32_t flagAttr = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> intFilter = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> binFilter = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> attrId = 0) +{ + SearchRoomRequestBuilder builder_(_fbb); + builder_.add_lobbyId(lobbyId); + builder_.add_attrId(attrId); + builder_.add_binFilter(binFilter); + builder_.add_intFilter(intFilter); + builder_.add_flagAttr(flagAttr); + builder_.add_flagFilter(flagFilter); + builder_.add_rangeFilter_max(rangeFilter_max); + builder_.add_rangeFilter_startIndex(rangeFilter_startIndex); + builder_.add_worldId(worldId); + builder_.add_option(option); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateSearchRoomRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - int32_t option = 0, - uint32_t worldId = 0, - uint64_t lobbyId = 0, - uint32_t rangeFilter_startIndex = 0, - uint32_t rangeFilter_max = 0, - uint32_t flagFilter = 0, - uint32_t flagAttr = 0, - const std::vector<::flatbuffers::Offset> *intFilter = nullptr, - const std::vector<::flatbuffers::Offset> *binFilter = nullptr, - const std::vector *attrId = nullptr) { - auto intFilter__ = intFilter ? _fbb.CreateVector<::flatbuffers::Offset>(*intFilter) : 0; - auto binFilter__ = binFilter ? _fbb.CreateVector<::flatbuffers::Offset>(*binFilter) : 0; - auto attrId__ = attrId ? _fbb.CreateVector(*attrId) : 0; - return CreateSearchRoomRequest( - _fbb, - option, - worldId, - lobbyId, - rangeFilter_startIndex, - rangeFilter_max, - flagFilter, - flagAttr, - intFilter__, - binFilter__, - attrId__); + ::flatbuffers::FlatBufferBuilder& _fbb, + int32_t option = 0, + uint32_t worldId = 0, + uint64_t lobbyId = 0, + uint32_t rangeFilter_startIndex = 0, + uint32_t rangeFilter_max = 0, + uint32_t flagFilter = 0, + uint32_t flagAttr = 0, + const std::vector<::flatbuffers::Offset>* intFilter = nullptr, + const std::vector<::flatbuffers::Offset>* binFilter = nullptr, + const std::vector* attrId = nullptr) +{ + auto intFilter__ = intFilter ? _fbb.CreateVector<::flatbuffers::Offset>(*intFilter) : 0; + auto binFilter__ = binFilter ? _fbb.CreateVector<::flatbuffers::Offset>(*binFilter) : 0; + auto attrId__ = attrId ? _fbb.CreateVector(*attrId) : 0; + return CreateSearchRoomRequest( + _fbb, + option, + worldId, + lobbyId, + rangeFilter_startIndex, + rangeFilter_max, + flagFilter, + flagAttr, + intFilter__, + binFilter__, + attrId__); } -struct SearchRoomResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef SearchRoomResponseBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_STARTINDEX = 4, - VT_TOTAL = 6, - VT_ROOMS = 8 - }; - uint32_t startIndex() const { - return GetField(VT_STARTINDEX, 0); - } - uint32_t total() const { - return GetField(VT_TOTAL, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *rooms() const { - return GetPointer> *>(VT_ROOMS); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_STARTINDEX, 4) && - VerifyField(verifier, VT_TOTAL, 4) && - VerifyOffset(verifier, VT_ROOMS) && - verifier.VerifyVector(rooms()) && - verifier.VerifyVectorOfTables(rooms()) && - verifier.EndTable(); - } +struct SearchRoomResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef SearchRoomResponseBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_STARTINDEX = 4, + VT_TOTAL = 6, + VT_ROOMS = 8 + }; + uint32_t startIndex() const + { + return GetField(VT_STARTINDEX, 0); + } + uint32_t total() const + { + return GetField(VT_TOTAL, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* rooms() const + { + return GetPointer>*>(VT_ROOMS); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_STARTINDEX, 4) && + VerifyField(verifier, VT_TOTAL, 4) && + VerifyOffset(verifier, VT_ROOMS) && + verifier.VerifyVector(rooms()) && + verifier.VerifyVectorOfTables(rooms()) && + verifier.EndTable(); + } }; -struct SearchRoomResponseBuilder { - typedef SearchRoomResponse Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_startIndex(uint32_t startIndex) { - fbb_.AddElement(SearchRoomResponse::VT_STARTINDEX, startIndex, 0); - } - void add_total(uint32_t total) { - fbb_.AddElement(SearchRoomResponse::VT_TOTAL, total, 0); - } - void add_rooms(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rooms) { - fbb_.AddOffset(SearchRoomResponse::VT_ROOMS, rooms); - } - explicit SearchRoomResponseBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct SearchRoomResponseBuilder +{ + typedef SearchRoomResponse Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_startIndex(uint32_t startIndex) + { + fbb_.AddElement(SearchRoomResponse::VT_STARTINDEX, startIndex, 0); + } + void add_total(uint32_t total) + { + fbb_.AddElement(SearchRoomResponse::VT_TOTAL, total, 0); + } + void add_rooms(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rooms) + { + fbb_.AddOffset(SearchRoomResponse::VT_ROOMS, rooms); + } + explicit SearchRoomResponseBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateSearchRoomResponse( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t startIndex = 0, - uint32_t total = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rooms = 0) { - SearchRoomResponseBuilder builder_(_fbb); - builder_.add_rooms(rooms); - builder_.add_total(total); - builder_.add_startIndex(startIndex); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t startIndex = 0, + uint32_t total = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rooms = 0) +{ + SearchRoomResponseBuilder builder_(_fbb); + builder_.add_rooms(rooms); + builder_.add_total(total); + builder_.add_startIndex(startIndex); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateSearchRoomResponseDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t startIndex = 0, - uint32_t total = 0, - const std::vector<::flatbuffers::Offset> *rooms = nullptr) { - auto rooms__ = rooms ? _fbb.CreateVector<::flatbuffers::Offset>(*rooms) : 0; - return CreateSearchRoomResponse( - _fbb, - startIndex, - total, - rooms__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t startIndex = 0, + uint32_t total = 0, + const std::vector<::flatbuffers::Offset>* rooms = nullptr) +{ + auto rooms__ = rooms ? _fbb.CreateVector<::flatbuffers::Offset>(*rooms) : 0; + return CreateSearchRoomResponse( + _fbb, + startIndex, + total, + rooms__); } -struct CreateJoinRoomRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef CreateJoinRoomRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_WORLDID = 4, - VT_LOBBYID = 6, - VT_MAXSLOT = 8, - VT_FLAGATTR = 10, - VT_ROOMBINATTRINTERNAL = 12, - VT_ROOMSEARCHABLEINTATTREXTERNAL = 14, - VT_ROOMSEARCHABLEBINATTREXTERNAL = 16, - VT_ROOMBINATTREXTERNAL = 18, - VT_ROOMPASSWORD = 20, - VT_GROUPCONFIG = 22, - VT_PASSWORDSLOTMASK = 24, - VT_ALLOWEDUSER = 26, - VT_BLOCKEDUSER = 28, - VT_JOINROOMGROUPLABEL = 30, - VT_ROOMMEMBERBINATTRINTERNAL = 32, - VT_TEAMID = 34, - VT_SIGOPTPARAM = 36 - }; - uint32_t worldId() const { - return GetField(VT_WORLDID, 0); - } - uint64_t lobbyId() const { - return GetField(VT_LOBBYID, 0); - } - uint32_t maxSlot() const { - return GetField(VT_MAXSLOT, 0); - } - uint32_t flagAttr() const { - return GetField(VT_FLAGATTR, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomBinAttrInternal() const { - return GetPointer> *>(VT_ROOMBINATTRINTERNAL); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomSearchableIntAttrExternal() const { - return GetPointer> *>(VT_ROOMSEARCHABLEINTATTREXTERNAL); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomSearchableBinAttrExternal() const { - return GetPointer> *>(VT_ROOMSEARCHABLEBINATTREXTERNAL); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomBinAttrExternal() const { - return GetPointer> *>(VT_ROOMBINATTREXTERNAL); - } - const ::flatbuffers::Vector *roomPassword() const { - return GetPointer *>(VT_ROOMPASSWORD); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *groupConfig() const { - return GetPointer> *>(VT_GROUPCONFIG); - } - uint64_t passwordSlotMask() const { - return GetField(VT_PASSWORDSLOTMASK, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *allowedUser() const { - return GetPointer> *>(VT_ALLOWEDUSER); - } - const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *blockedUser() const { - return GetPointer> *>(VT_BLOCKEDUSER); - } - const ::flatbuffers::Vector *joinRoomGroupLabel() const { - return GetPointer *>(VT_JOINROOMGROUPLABEL); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomMemberBinAttrInternal() const { - return GetPointer> *>(VT_ROOMMEMBERBINATTRINTERNAL); - } - uint8_t teamId() const { - return GetField(VT_TEAMID, 0); - } - const OptParam *sigOptParam() const { - return GetPointer(VT_SIGOPTPARAM); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_WORLDID, 4) && - VerifyField(verifier, VT_LOBBYID, 8) && - VerifyField(verifier, VT_MAXSLOT, 4) && - VerifyField(verifier, VT_FLAGATTR, 4) && - VerifyOffset(verifier, VT_ROOMBINATTRINTERNAL) && - verifier.VerifyVector(roomBinAttrInternal()) && - verifier.VerifyVectorOfTables(roomBinAttrInternal()) && - VerifyOffset(verifier, VT_ROOMSEARCHABLEINTATTREXTERNAL) && - verifier.VerifyVector(roomSearchableIntAttrExternal()) && - verifier.VerifyVectorOfTables(roomSearchableIntAttrExternal()) && - VerifyOffset(verifier, VT_ROOMSEARCHABLEBINATTREXTERNAL) && - verifier.VerifyVector(roomSearchableBinAttrExternal()) && - verifier.VerifyVectorOfTables(roomSearchableBinAttrExternal()) && - VerifyOffset(verifier, VT_ROOMBINATTREXTERNAL) && - verifier.VerifyVector(roomBinAttrExternal()) && - verifier.VerifyVectorOfTables(roomBinAttrExternal()) && - VerifyOffset(verifier, VT_ROOMPASSWORD) && - verifier.VerifyVector(roomPassword()) && - VerifyOffset(verifier, VT_GROUPCONFIG) && - verifier.VerifyVector(groupConfig()) && - verifier.VerifyVectorOfTables(groupConfig()) && - VerifyField(verifier, VT_PASSWORDSLOTMASK, 8) && - VerifyOffset(verifier, VT_ALLOWEDUSER) && - verifier.VerifyVector(allowedUser()) && - verifier.VerifyVectorOfStrings(allowedUser()) && - VerifyOffset(verifier, VT_BLOCKEDUSER) && - verifier.VerifyVector(blockedUser()) && - verifier.VerifyVectorOfStrings(blockedUser()) && - VerifyOffset(verifier, VT_JOINROOMGROUPLABEL) && - verifier.VerifyVector(joinRoomGroupLabel()) && - VerifyOffset(verifier, VT_ROOMMEMBERBINATTRINTERNAL) && - verifier.VerifyVector(roomMemberBinAttrInternal()) && - verifier.VerifyVectorOfTables(roomMemberBinAttrInternal()) && - VerifyField(verifier, VT_TEAMID, 1) && - VerifyOffset(verifier, VT_SIGOPTPARAM) && - verifier.VerifyTable(sigOptParam()) && - verifier.EndTable(); - } +struct CreateJoinRoomRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef CreateJoinRoomRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_WORLDID = 4, + VT_LOBBYID = 6, + VT_MAXSLOT = 8, + VT_FLAGATTR = 10, + VT_ROOMBINATTRINTERNAL = 12, + VT_ROOMSEARCHABLEINTATTREXTERNAL = 14, + VT_ROOMSEARCHABLEBINATTREXTERNAL = 16, + VT_ROOMBINATTREXTERNAL = 18, + VT_ROOMPASSWORD = 20, + VT_GROUPCONFIG = 22, + VT_PASSWORDSLOTMASK = 24, + VT_ALLOWEDUSER = 26, + VT_BLOCKEDUSER = 28, + VT_JOINROOMGROUPLABEL = 30, + VT_ROOMMEMBERBINATTRINTERNAL = 32, + VT_TEAMID = 34, + VT_SIGOPTPARAM = 36 + }; + uint32_t worldId() const + { + return GetField(VT_WORLDID, 0); + } + uint64_t lobbyId() const + { + return GetField(VT_LOBBYID, 0); + } + uint32_t maxSlot() const + { + return GetField(VT_MAXSLOT, 0); + } + uint32_t flagAttr() const + { + return GetField(VT_FLAGATTR, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomBinAttrInternal() const + { + return GetPointer>*>(VT_ROOMBINATTRINTERNAL); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomSearchableIntAttrExternal() const + { + return GetPointer>*>(VT_ROOMSEARCHABLEINTATTREXTERNAL); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomSearchableBinAttrExternal() const + { + return GetPointer>*>(VT_ROOMSEARCHABLEBINATTREXTERNAL); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomBinAttrExternal() const + { + return GetPointer>*>(VT_ROOMBINATTREXTERNAL); + } + const ::flatbuffers::Vector* roomPassword() const + { + return GetPointer*>(VT_ROOMPASSWORD); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* groupConfig() const + { + return GetPointer>*>(VT_GROUPCONFIG); + } + uint64_t passwordSlotMask() const + { + return GetField(VT_PASSWORDSLOTMASK, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>* allowedUser() const + { + return GetPointer>*>(VT_ALLOWEDUSER); + } + const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>* blockedUser() const + { + return GetPointer>*>(VT_BLOCKEDUSER); + } + const ::flatbuffers::Vector* joinRoomGroupLabel() const + { + return GetPointer*>(VT_JOINROOMGROUPLABEL); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomMemberBinAttrInternal() const + { + return GetPointer>*>(VT_ROOMMEMBERBINATTRINTERNAL); + } + uint8_t teamId() const + { + return GetField(VT_TEAMID, 0); + } + const OptParam* sigOptParam() const + { + return GetPointer(VT_SIGOPTPARAM); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_WORLDID, 4) && + VerifyField(verifier, VT_LOBBYID, 8) && + VerifyField(verifier, VT_MAXSLOT, 4) && + VerifyField(verifier, VT_FLAGATTR, 4) && + VerifyOffset(verifier, VT_ROOMBINATTRINTERNAL) && + verifier.VerifyVector(roomBinAttrInternal()) && + verifier.VerifyVectorOfTables(roomBinAttrInternal()) && + VerifyOffset(verifier, VT_ROOMSEARCHABLEINTATTREXTERNAL) && + verifier.VerifyVector(roomSearchableIntAttrExternal()) && + verifier.VerifyVectorOfTables(roomSearchableIntAttrExternal()) && + VerifyOffset(verifier, VT_ROOMSEARCHABLEBINATTREXTERNAL) && + verifier.VerifyVector(roomSearchableBinAttrExternal()) && + verifier.VerifyVectorOfTables(roomSearchableBinAttrExternal()) && + VerifyOffset(verifier, VT_ROOMBINATTREXTERNAL) && + verifier.VerifyVector(roomBinAttrExternal()) && + verifier.VerifyVectorOfTables(roomBinAttrExternal()) && + VerifyOffset(verifier, VT_ROOMPASSWORD) && + verifier.VerifyVector(roomPassword()) && + VerifyOffset(verifier, VT_GROUPCONFIG) && + verifier.VerifyVector(groupConfig()) && + verifier.VerifyVectorOfTables(groupConfig()) && + VerifyField(verifier, VT_PASSWORDSLOTMASK, 8) && + VerifyOffset(verifier, VT_ALLOWEDUSER) && + verifier.VerifyVector(allowedUser()) && + verifier.VerifyVectorOfStrings(allowedUser()) && + VerifyOffset(verifier, VT_BLOCKEDUSER) && + verifier.VerifyVector(blockedUser()) && + verifier.VerifyVectorOfStrings(blockedUser()) && + VerifyOffset(verifier, VT_JOINROOMGROUPLABEL) && + verifier.VerifyVector(joinRoomGroupLabel()) && + VerifyOffset(verifier, VT_ROOMMEMBERBINATTRINTERNAL) && + verifier.VerifyVector(roomMemberBinAttrInternal()) && + verifier.VerifyVectorOfTables(roomMemberBinAttrInternal()) && + VerifyField(verifier, VT_TEAMID, 1) && + VerifyOffset(verifier, VT_SIGOPTPARAM) && + verifier.VerifyTable(sigOptParam()) && + verifier.EndTable(); + } }; -struct CreateJoinRoomRequestBuilder { - typedef CreateJoinRoomRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_worldId(uint32_t worldId) { - fbb_.AddElement(CreateJoinRoomRequest::VT_WORLDID, worldId, 0); - } - void add_lobbyId(uint64_t lobbyId) { - fbb_.AddElement(CreateJoinRoomRequest::VT_LOBBYID, lobbyId, 0); - } - void add_maxSlot(uint32_t maxSlot) { - fbb_.AddElement(CreateJoinRoomRequest::VT_MAXSLOT, maxSlot, 0); - } - void add_flagAttr(uint32_t flagAttr) { - fbb_.AddElement(CreateJoinRoomRequest::VT_FLAGATTR, flagAttr, 0); - } - void add_roomBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrInternal) { - fbb_.AddOffset(CreateJoinRoomRequest::VT_ROOMBINATTRINTERNAL, roomBinAttrInternal); - } - void add_roomSearchableIntAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableIntAttrExternal) { - fbb_.AddOffset(CreateJoinRoomRequest::VT_ROOMSEARCHABLEINTATTREXTERNAL, roomSearchableIntAttrExternal); - } - void add_roomSearchableBinAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableBinAttrExternal) { - fbb_.AddOffset(CreateJoinRoomRequest::VT_ROOMSEARCHABLEBINATTREXTERNAL, roomSearchableBinAttrExternal); - } - void add_roomBinAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrExternal) { - fbb_.AddOffset(CreateJoinRoomRequest::VT_ROOMBINATTREXTERNAL, roomBinAttrExternal); - } - void add_roomPassword(::flatbuffers::Offset<::flatbuffers::Vector> roomPassword) { - fbb_.AddOffset(CreateJoinRoomRequest::VT_ROOMPASSWORD, roomPassword); - } - void add_groupConfig(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> groupConfig) { - fbb_.AddOffset(CreateJoinRoomRequest::VT_GROUPCONFIG, groupConfig); - } - void add_passwordSlotMask(uint64_t passwordSlotMask) { - fbb_.AddElement(CreateJoinRoomRequest::VT_PASSWORDSLOTMASK, passwordSlotMask, 0); - } - void add_allowedUser(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> allowedUser) { - fbb_.AddOffset(CreateJoinRoomRequest::VT_ALLOWEDUSER, allowedUser); - } - void add_blockedUser(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> blockedUser) { - fbb_.AddOffset(CreateJoinRoomRequest::VT_BLOCKEDUSER, blockedUser); - } - void add_joinRoomGroupLabel(::flatbuffers::Offset<::flatbuffers::Vector> joinRoomGroupLabel) { - fbb_.AddOffset(CreateJoinRoomRequest::VT_JOINROOMGROUPLABEL, joinRoomGroupLabel); - } - void add_roomMemberBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal) { - fbb_.AddOffset(CreateJoinRoomRequest::VT_ROOMMEMBERBINATTRINTERNAL, roomMemberBinAttrInternal); - } - void add_teamId(uint8_t teamId) { - fbb_.AddElement(CreateJoinRoomRequest::VT_TEAMID, teamId, 0); - } - void add_sigOptParam(::flatbuffers::Offset sigOptParam) { - fbb_.AddOffset(CreateJoinRoomRequest::VT_SIGOPTPARAM, sigOptParam); - } - explicit CreateJoinRoomRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct CreateJoinRoomRequestBuilder +{ + typedef CreateJoinRoomRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_worldId(uint32_t worldId) + { + fbb_.AddElement(CreateJoinRoomRequest::VT_WORLDID, worldId, 0); + } + void add_lobbyId(uint64_t lobbyId) + { + fbb_.AddElement(CreateJoinRoomRequest::VT_LOBBYID, lobbyId, 0); + } + void add_maxSlot(uint32_t maxSlot) + { + fbb_.AddElement(CreateJoinRoomRequest::VT_MAXSLOT, maxSlot, 0); + } + void add_flagAttr(uint32_t flagAttr) + { + fbb_.AddElement(CreateJoinRoomRequest::VT_FLAGATTR, flagAttr, 0); + } + void add_roomBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrInternal) + { + fbb_.AddOffset(CreateJoinRoomRequest::VT_ROOMBINATTRINTERNAL, roomBinAttrInternal); + } + void add_roomSearchableIntAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableIntAttrExternal) + { + fbb_.AddOffset(CreateJoinRoomRequest::VT_ROOMSEARCHABLEINTATTREXTERNAL, roomSearchableIntAttrExternal); + } + void add_roomSearchableBinAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableBinAttrExternal) + { + fbb_.AddOffset(CreateJoinRoomRequest::VT_ROOMSEARCHABLEBINATTREXTERNAL, roomSearchableBinAttrExternal); + } + void add_roomBinAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrExternal) + { + fbb_.AddOffset(CreateJoinRoomRequest::VT_ROOMBINATTREXTERNAL, roomBinAttrExternal); + } + void add_roomPassword(::flatbuffers::Offset<::flatbuffers::Vector> roomPassword) + { + fbb_.AddOffset(CreateJoinRoomRequest::VT_ROOMPASSWORD, roomPassword); + } + void add_groupConfig(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> groupConfig) + { + fbb_.AddOffset(CreateJoinRoomRequest::VT_GROUPCONFIG, groupConfig); + } + void add_passwordSlotMask(uint64_t passwordSlotMask) + { + fbb_.AddElement(CreateJoinRoomRequest::VT_PASSWORDSLOTMASK, passwordSlotMask, 0); + } + void add_allowedUser(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> allowedUser) + { + fbb_.AddOffset(CreateJoinRoomRequest::VT_ALLOWEDUSER, allowedUser); + } + void add_blockedUser(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> blockedUser) + { + fbb_.AddOffset(CreateJoinRoomRequest::VT_BLOCKEDUSER, blockedUser); + } + void add_joinRoomGroupLabel(::flatbuffers::Offset<::flatbuffers::Vector> joinRoomGroupLabel) + { + fbb_.AddOffset(CreateJoinRoomRequest::VT_JOINROOMGROUPLABEL, joinRoomGroupLabel); + } + void add_roomMemberBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal) + { + fbb_.AddOffset(CreateJoinRoomRequest::VT_ROOMMEMBERBINATTRINTERNAL, roomMemberBinAttrInternal); + } + void add_teamId(uint8_t teamId) + { + fbb_.AddElement(CreateJoinRoomRequest::VT_TEAMID, teamId, 0); + } + void add_sigOptParam(::flatbuffers::Offset sigOptParam) + { + fbb_.AddOffset(CreateJoinRoomRequest::VT_SIGOPTPARAM, sigOptParam); + } + explicit CreateJoinRoomRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateCreateJoinRoomRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t worldId = 0, - uint64_t lobbyId = 0, - uint32_t maxSlot = 0, - uint32_t flagAttr = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrInternal = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableIntAttrExternal = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableBinAttrExternal = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrExternal = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> roomPassword = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> groupConfig = 0, - uint64_t passwordSlotMask = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> allowedUser = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> blockedUser = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> joinRoomGroupLabel = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal = 0, - uint8_t teamId = 0, - ::flatbuffers::Offset sigOptParam = 0) { - CreateJoinRoomRequestBuilder builder_(_fbb); - builder_.add_passwordSlotMask(passwordSlotMask); - builder_.add_lobbyId(lobbyId); - builder_.add_sigOptParam(sigOptParam); - builder_.add_roomMemberBinAttrInternal(roomMemberBinAttrInternal); - builder_.add_joinRoomGroupLabel(joinRoomGroupLabel); - builder_.add_blockedUser(blockedUser); - builder_.add_allowedUser(allowedUser); - builder_.add_groupConfig(groupConfig); - builder_.add_roomPassword(roomPassword); - builder_.add_roomBinAttrExternal(roomBinAttrExternal); - builder_.add_roomSearchableBinAttrExternal(roomSearchableBinAttrExternal); - builder_.add_roomSearchableIntAttrExternal(roomSearchableIntAttrExternal); - builder_.add_roomBinAttrInternal(roomBinAttrInternal); - builder_.add_flagAttr(flagAttr); - builder_.add_maxSlot(maxSlot); - builder_.add_worldId(worldId); - builder_.add_teamId(teamId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t worldId = 0, + uint64_t lobbyId = 0, + uint32_t maxSlot = 0, + uint32_t flagAttr = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrInternal = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableIntAttrExternal = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableBinAttrExternal = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrExternal = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> roomPassword = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> groupConfig = 0, + uint64_t passwordSlotMask = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> allowedUser = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> blockedUser = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> joinRoomGroupLabel = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal = 0, + uint8_t teamId = 0, + ::flatbuffers::Offset sigOptParam = 0) +{ + CreateJoinRoomRequestBuilder builder_(_fbb); + builder_.add_passwordSlotMask(passwordSlotMask); + builder_.add_lobbyId(lobbyId); + builder_.add_sigOptParam(sigOptParam); + builder_.add_roomMemberBinAttrInternal(roomMemberBinAttrInternal); + builder_.add_joinRoomGroupLabel(joinRoomGroupLabel); + builder_.add_blockedUser(blockedUser); + builder_.add_allowedUser(allowedUser); + builder_.add_groupConfig(groupConfig); + builder_.add_roomPassword(roomPassword); + builder_.add_roomBinAttrExternal(roomBinAttrExternal); + builder_.add_roomSearchableBinAttrExternal(roomSearchableBinAttrExternal); + builder_.add_roomSearchableIntAttrExternal(roomSearchableIntAttrExternal); + builder_.add_roomBinAttrInternal(roomBinAttrInternal); + builder_.add_flagAttr(flagAttr); + builder_.add_maxSlot(maxSlot); + builder_.add_worldId(worldId); + builder_.add_teamId(teamId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateCreateJoinRoomRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t worldId = 0, - uint64_t lobbyId = 0, - uint32_t maxSlot = 0, - uint32_t flagAttr = 0, - const std::vector<::flatbuffers::Offset> *roomBinAttrInternal = nullptr, - const std::vector<::flatbuffers::Offset> *roomSearchableIntAttrExternal = nullptr, - const std::vector<::flatbuffers::Offset> *roomSearchableBinAttrExternal = nullptr, - const std::vector<::flatbuffers::Offset> *roomBinAttrExternal = nullptr, - const std::vector *roomPassword = nullptr, - const std::vector<::flatbuffers::Offset> *groupConfig = nullptr, - uint64_t passwordSlotMask = 0, - const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *allowedUser = nullptr, - const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *blockedUser = nullptr, - const std::vector *joinRoomGroupLabel = nullptr, - const std::vector<::flatbuffers::Offset> *roomMemberBinAttrInternal = nullptr, - uint8_t teamId = 0, - ::flatbuffers::Offset sigOptParam = 0) { - auto roomBinAttrInternal__ = roomBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomBinAttrInternal) : 0; - auto roomSearchableIntAttrExternal__ = roomSearchableIntAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomSearchableIntAttrExternal) : 0; - auto roomSearchableBinAttrExternal__ = roomSearchableBinAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomSearchableBinAttrExternal) : 0; - auto roomBinAttrExternal__ = roomBinAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomBinAttrExternal) : 0; - auto roomPassword__ = roomPassword ? _fbb.CreateVector(*roomPassword) : 0; - auto groupConfig__ = groupConfig ? _fbb.CreateVector<::flatbuffers::Offset>(*groupConfig) : 0; - auto allowedUser__ = allowedUser ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*allowedUser) : 0; - auto blockedUser__ = blockedUser ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*blockedUser) : 0; - auto joinRoomGroupLabel__ = joinRoomGroupLabel ? _fbb.CreateVector(*joinRoomGroupLabel) : 0; - auto roomMemberBinAttrInternal__ = roomMemberBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomMemberBinAttrInternal) : 0; - return CreateCreateJoinRoomRequest( - _fbb, - worldId, - lobbyId, - maxSlot, - flagAttr, - roomBinAttrInternal__, - roomSearchableIntAttrExternal__, - roomSearchableBinAttrExternal__, - roomBinAttrExternal__, - roomPassword__, - groupConfig__, - passwordSlotMask, - allowedUser__, - blockedUser__, - joinRoomGroupLabel__, - roomMemberBinAttrInternal__, - teamId, - sigOptParam); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t worldId = 0, + uint64_t lobbyId = 0, + uint32_t maxSlot = 0, + uint32_t flagAttr = 0, + const std::vector<::flatbuffers::Offset>* roomBinAttrInternal = nullptr, + const std::vector<::flatbuffers::Offset>* roomSearchableIntAttrExternal = nullptr, + const std::vector<::flatbuffers::Offset>* roomSearchableBinAttrExternal = nullptr, + const std::vector<::flatbuffers::Offset>* roomBinAttrExternal = nullptr, + const std::vector* roomPassword = nullptr, + const std::vector<::flatbuffers::Offset>* groupConfig = nullptr, + uint64_t passwordSlotMask = 0, + const std::vector<::flatbuffers::Offset<::flatbuffers::String>>* allowedUser = nullptr, + const std::vector<::flatbuffers::Offset<::flatbuffers::String>>* blockedUser = nullptr, + const std::vector* joinRoomGroupLabel = nullptr, + const std::vector<::flatbuffers::Offset>* roomMemberBinAttrInternal = nullptr, + uint8_t teamId = 0, + ::flatbuffers::Offset sigOptParam = 0) +{ + auto roomBinAttrInternal__ = roomBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomBinAttrInternal) : 0; + auto roomSearchableIntAttrExternal__ = roomSearchableIntAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomSearchableIntAttrExternal) : 0; + auto roomSearchableBinAttrExternal__ = roomSearchableBinAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomSearchableBinAttrExternal) : 0; + auto roomBinAttrExternal__ = roomBinAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomBinAttrExternal) : 0; + auto roomPassword__ = roomPassword ? _fbb.CreateVector(*roomPassword) : 0; + auto groupConfig__ = groupConfig ? _fbb.CreateVector<::flatbuffers::Offset>(*groupConfig) : 0; + auto allowedUser__ = allowedUser ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*allowedUser) : 0; + auto blockedUser__ = blockedUser ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*blockedUser) : 0; + auto joinRoomGroupLabel__ = joinRoomGroupLabel ? _fbb.CreateVector(*joinRoomGroupLabel) : 0; + auto roomMemberBinAttrInternal__ = roomMemberBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomMemberBinAttrInternal) : 0; + return CreateCreateJoinRoomRequest( + _fbb, + worldId, + lobbyId, + maxSlot, + flagAttr, + roomBinAttrInternal__, + roomSearchableIntAttrExternal__, + roomSearchableBinAttrExternal__, + roomBinAttrExternal__, + roomPassword__, + groupConfig__, + passwordSlotMask, + allowedUser__, + blockedUser__, + joinRoomGroupLabel__, + roomMemberBinAttrInternal__, + teamId, + sigOptParam); } -struct JoinRoomRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef JoinRoomRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOMID = 4, - VT_ROOMPASSWORD = 6, - VT_JOINROOMGROUPLABEL = 8, - VT_ROOMMEMBERBINATTRINTERNAL = 10, - VT_OPTDATA = 12, - VT_TEAMID = 14 - }; - uint64_t roomId() const { - return GetField(VT_ROOMID, 0); - } - const ::flatbuffers::Vector *roomPassword() const { - return GetPointer *>(VT_ROOMPASSWORD); - } - const ::flatbuffers::Vector *joinRoomGroupLabel() const { - return GetPointer *>(VT_JOINROOMGROUPLABEL); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomMemberBinAttrInternal() const { - return GetPointer> *>(VT_ROOMMEMBERBINATTRINTERNAL); - } - const PresenceOptionData *optData() const { - return GetPointer(VT_OPTDATA); - } - uint8_t teamId() const { - return GetField(VT_TEAMID, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ROOMID, 8) && - VerifyOffset(verifier, VT_ROOMPASSWORD) && - verifier.VerifyVector(roomPassword()) && - VerifyOffset(verifier, VT_JOINROOMGROUPLABEL) && - verifier.VerifyVector(joinRoomGroupLabel()) && - VerifyOffset(verifier, VT_ROOMMEMBERBINATTRINTERNAL) && - verifier.VerifyVector(roomMemberBinAttrInternal()) && - verifier.VerifyVectorOfTables(roomMemberBinAttrInternal()) && - VerifyOffset(verifier, VT_OPTDATA) && - verifier.VerifyTable(optData()) && - VerifyField(verifier, VT_TEAMID, 1) && - verifier.EndTable(); - } +struct JoinRoomRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef JoinRoomRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOMID = 4, + VT_ROOMPASSWORD = 6, + VT_JOINROOMGROUPLABEL = 8, + VT_ROOMMEMBERBINATTRINTERNAL = 10, + VT_OPTDATA = 12, + VT_TEAMID = 14 + }; + uint64_t roomId() const + { + return GetField(VT_ROOMID, 0); + } + const ::flatbuffers::Vector* roomPassword() const + { + return GetPointer*>(VT_ROOMPASSWORD); + } + const ::flatbuffers::Vector* joinRoomGroupLabel() const + { + return GetPointer*>(VT_JOINROOMGROUPLABEL); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomMemberBinAttrInternal() const + { + return GetPointer>*>(VT_ROOMMEMBERBINATTRINTERNAL); + } + const PresenceOptionData* optData() const + { + return GetPointer(VT_OPTDATA); + } + uint8_t teamId() const + { + return GetField(VT_TEAMID, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ROOMID, 8) && + VerifyOffset(verifier, VT_ROOMPASSWORD) && + verifier.VerifyVector(roomPassword()) && + VerifyOffset(verifier, VT_JOINROOMGROUPLABEL) && + verifier.VerifyVector(joinRoomGroupLabel()) && + VerifyOffset(verifier, VT_ROOMMEMBERBINATTRINTERNAL) && + verifier.VerifyVector(roomMemberBinAttrInternal()) && + verifier.VerifyVectorOfTables(roomMemberBinAttrInternal()) && + VerifyOffset(verifier, VT_OPTDATA) && + verifier.VerifyTable(optData()) && + VerifyField(verifier, VT_TEAMID, 1) && + verifier.EndTable(); + } }; -struct JoinRoomRequestBuilder { - typedef JoinRoomRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_roomId(uint64_t roomId) { - fbb_.AddElement(JoinRoomRequest::VT_ROOMID, roomId, 0); - } - void add_roomPassword(::flatbuffers::Offset<::flatbuffers::Vector> roomPassword) { - fbb_.AddOffset(JoinRoomRequest::VT_ROOMPASSWORD, roomPassword); - } - void add_joinRoomGroupLabel(::flatbuffers::Offset<::flatbuffers::Vector> joinRoomGroupLabel) { - fbb_.AddOffset(JoinRoomRequest::VT_JOINROOMGROUPLABEL, joinRoomGroupLabel); - } - void add_roomMemberBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal) { - fbb_.AddOffset(JoinRoomRequest::VT_ROOMMEMBERBINATTRINTERNAL, roomMemberBinAttrInternal); - } - void add_optData(::flatbuffers::Offset optData) { - fbb_.AddOffset(JoinRoomRequest::VT_OPTDATA, optData); - } - void add_teamId(uint8_t teamId) { - fbb_.AddElement(JoinRoomRequest::VT_TEAMID, teamId, 0); - } - explicit JoinRoomRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct JoinRoomRequestBuilder +{ + typedef JoinRoomRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_roomId(uint64_t roomId) + { + fbb_.AddElement(JoinRoomRequest::VT_ROOMID, roomId, 0); + } + void add_roomPassword(::flatbuffers::Offset<::flatbuffers::Vector> roomPassword) + { + fbb_.AddOffset(JoinRoomRequest::VT_ROOMPASSWORD, roomPassword); + } + void add_joinRoomGroupLabel(::flatbuffers::Offset<::flatbuffers::Vector> joinRoomGroupLabel) + { + fbb_.AddOffset(JoinRoomRequest::VT_JOINROOMGROUPLABEL, joinRoomGroupLabel); + } + void add_roomMemberBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal) + { + fbb_.AddOffset(JoinRoomRequest::VT_ROOMMEMBERBINATTRINTERNAL, roomMemberBinAttrInternal); + } + void add_optData(::flatbuffers::Offset optData) + { + fbb_.AddOffset(JoinRoomRequest::VT_OPTDATA, optData); + } + void add_teamId(uint8_t teamId) + { + fbb_.AddElement(JoinRoomRequest::VT_TEAMID, teamId, 0); + } + explicit JoinRoomRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateJoinRoomRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> roomPassword = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> joinRoomGroupLabel = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal = 0, - ::flatbuffers::Offset optData = 0, - uint8_t teamId = 0) { - JoinRoomRequestBuilder builder_(_fbb); - builder_.add_roomId(roomId); - builder_.add_optData(optData); - builder_.add_roomMemberBinAttrInternal(roomMemberBinAttrInternal); - builder_.add_joinRoomGroupLabel(joinRoomGroupLabel); - builder_.add_roomPassword(roomPassword); - builder_.add_teamId(teamId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> roomPassword = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> joinRoomGroupLabel = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal = 0, + ::flatbuffers::Offset optData = 0, + uint8_t teamId = 0) +{ + JoinRoomRequestBuilder builder_(_fbb); + builder_.add_roomId(roomId); + builder_.add_optData(optData); + builder_.add_roomMemberBinAttrInternal(roomMemberBinAttrInternal); + builder_.add_joinRoomGroupLabel(joinRoomGroupLabel); + builder_.add_roomPassword(roomPassword); + builder_.add_teamId(teamId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateJoinRoomRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - const std::vector *roomPassword = nullptr, - const std::vector *joinRoomGroupLabel = nullptr, - const std::vector<::flatbuffers::Offset> *roomMemberBinAttrInternal = nullptr, - ::flatbuffers::Offset optData = 0, - uint8_t teamId = 0) { - auto roomPassword__ = roomPassword ? _fbb.CreateVector(*roomPassword) : 0; - auto joinRoomGroupLabel__ = joinRoomGroupLabel ? _fbb.CreateVector(*joinRoomGroupLabel) : 0; - auto roomMemberBinAttrInternal__ = roomMemberBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomMemberBinAttrInternal) : 0; - return CreateJoinRoomRequest( - _fbb, - roomId, - roomPassword__, - joinRoomGroupLabel__, - roomMemberBinAttrInternal__, - optData, - teamId); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + const std::vector* roomPassword = nullptr, + const std::vector* joinRoomGroupLabel = nullptr, + const std::vector<::flatbuffers::Offset>* roomMemberBinAttrInternal = nullptr, + ::flatbuffers::Offset optData = 0, + uint8_t teamId = 0) +{ + auto roomPassword__ = roomPassword ? _fbb.CreateVector(*roomPassword) : 0; + auto joinRoomGroupLabel__ = joinRoomGroupLabel ? _fbb.CreateVector(*joinRoomGroupLabel) : 0; + auto roomMemberBinAttrInternal__ = roomMemberBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomMemberBinAttrInternal) : 0; + return CreateJoinRoomRequest( + _fbb, + roomId, + roomPassword__, + joinRoomGroupLabel__, + roomMemberBinAttrInternal__, + optData, + teamId); } -struct JoinRoomResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef JoinRoomResponseBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOM_DATA = 4, - VT_SIGNALING_DATA = 6 - }; - const RoomDataInternal *room_data() const { - return GetPointer(VT_ROOM_DATA); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *signaling_data() const { - return GetPointer> *>(VT_SIGNALING_DATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ROOM_DATA) && - verifier.VerifyTable(room_data()) && - VerifyOffset(verifier, VT_SIGNALING_DATA) && - verifier.VerifyVector(signaling_data()) && - verifier.VerifyVectorOfTables(signaling_data()) && - verifier.EndTable(); - } +struct JoinRoomResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef JoinRoomResponseBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOM_DATA = 4, + VT_SIGNALING_DATA = 6 + }; + const RoomDataInternal* room_data() const + { + return GetPointer(VT_ROOM_DATA); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* signaling_data() const + { + return GetPointer>*>(VT_SIGNALING_DATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_ROOM_DATA) && + verifier.VerifyTable(room_data()) && + VerifyOffset(verifier, VT_SIGNALING_DATA) && + verifier.VerifyVector(signaling_data()) && + verifier.VerifyVectorOfTables(signaling_data()) && + verifier.EndTable(); + } }; -struct JoinRoomResponseBuilder { - typedef JoinRoomResponse Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_room_data(::flatbuffers::Offset room_data) { - fbb_.AddOffset(JoinRoomResponse::VT_ROOM_DATA, room_data); - } - void add_signaling_data(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> signaling_data) { - fbb_.AddOffset(JoinRoomResponse::VT_SIGNALING_DATA, signaling_data); - } - explicit JoinRoomResponseBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct JoinRoomResponseBuilder +{ + typedef JoinRoomResponse Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_room_data(::flatbuffers::Offset room_data) + { + fbb_.AddOffset(JoinRoomResponse::VT_ROOM_DATA, room_data); + } + void add_signaling_data(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> signaling_data) + { + fbb_.AddOffset(JoinRoomResponse::VT_SIGNALING_DATA, signaling_data); + } + explicit JoinRoomResponseBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateJoinRoomResponse( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset room_data = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> signaling_data = 0) { - JoinRoomResponseBuilder builder_(_fbb); - builder_.add_signaling_data(signaling_data); - builder_.add_room_data(room_data); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset room_data = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> signaling_data = 0) +{ + JoinRoomResponseBuilder builder_(_fbb); + builder_.add_signaling_data(signaling_data); + builder_.add_room_data(room_data); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateJoinRoomResponseDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset room_data = 0, - const std::vector<::flatbuffers::Offset> *signaling_data = nullptr) { - auto signaling_data__ = signaling_data ? _fbb.CreateVector<::flatbuffers::Offset>(*signaling_data) : 0; - return CreateJoinRoomResponse( - _fbb, - room_data, - signaling_data__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset room_data = 0, + const std::vector<::flatbuffers::Offset>* signaling_data = nullptr) +{ + auto signaling_data__ = signaling_data ? _fbb.CreateVector<::flatbuffers::Offset>(*signaling_data) : 0; + return CreateJoinRoomResponse( + _fbb, + room_data, + signaling_data__); } -struct LeaveRoomRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef LeaveRoomRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOMID = 4, - VT_OPTDATA = 6 - }; - uint64_t roomId() const { - return GetField(VT_ROOMID, 0); - } - const PresenceOptionData *optData() const { - return GetPointer(VT_OPTDATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ROOMID, 8) && - VerifyOffset(verifier, VT_OPTDATA) && - verifier.VerifyTable(optData()) && - verifier.EndTable(); - } +struct LeaveRoomRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef LeaveRoomRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOMID = 4, + VT_OPTDATA = 6 + }; + uint64_t roomId() const + { + return GetField(VT_ROOMID, 0); + } + const PresenceOptionData* optData() const + { + return GetPointer(VT_OPTDATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ROOMID, 8) && + VerifyOffset(verifier, VT_OPTDATA) && + verifier.VerifyTable(optData()) && + verifier.EndTable(); + } }; -struct LeaveRoomRequestBuilder { - typedef LeaveRoomRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_roomId(uint64_t roomId) { - fbb_.AddElement(LeaveRoomRequest::VT_ROOMID, roomId, 0); - } - void add_optData(::flatbuffers::Offset optData) { - fbb_.AddOffset(LeaveRoomRequest::VT_OPTDATA, optData); - } - explicit LeaveRoomRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct LeaveRoomRequestBuilder +{ + typedef LeaveRoomRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_roomId(uint64_t roomId) + { + fbb_.AddElement(LeaveRoomRequest::VT_ROOMID, roomId, 0); + } + void add_optData(::flatbuffers::Offset optData) + { + fbb_.AddOffset(LeaveRoomRequest::VT_OPTDATA, optData); + } + explicit LeaveRoomRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateLeaveRoomRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - ::flatbuffers::Offset optData = 0) { - LeaveRoomRequestBuilder builder_(_fbb); - builder_.add_roomId(roomId); - builder_.add_optData(optData); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + ::flatbuffers::Offset optData = 0) +{ + LeaveRoomRequestBuilder builder_(_fbb); + builder_.add_roomId(roomId); + builder_.add_optData(optData); + return builder_.Finish(); } -struct GetRoomDataExternalListRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GetRoomDataExternalListRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOMIDS = 4, - VT_ATTRIDS = 6 - }; - const ::flatbuffers::Vector *roomIds() const { - return GetPointer *>(VT_ROOMIDS); - } - const ::flatbuffers::Vector *attrIds() const { - return GetPointer *>(VT_ATTRIDS); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ROOMIDS) && - verifier.VerifyVector(roomIds()) && - VerifyOffset(verifier, VT_ATTRIDS) && - verifier.VerifyVector(attrIds()) && - verifier.EndTable(); - } +struct GetRoomDataExternalListRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GetRoomDataExternalListRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOMIDS = 4, + VT_ATTRIDS = 6 + }; + const ::flatbuffers::Vector* roomIds() const + { + return GetPointer*>(VT_ROOMIDS); + } + const ::flatbuffers::Vector* attrIds() const + { + return GetPointer*>(VT_ATTRIDS); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_ROOMIDS) && + verifier.VerifyVector(roomIds()) && + VerifyOffset(verifier, VT_ATTRIDS) && + verifier.VerifyVector(attrIds()) && + verifier.EndTable(); + } }; -struct GetRoomDataExternalListRequestBuilder { - typedef GetRoomDataExternalListRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_roomIds(::flatbuffers::Offset<::flatbuffers::Vector> roomIds) { - fbb_.AddOffset(GetRoomDataExternalListRequest::VT_ROOMIDS, roomIds); - } - void add_attrIds(::flatbuffers::Offset<::flatbuffers::Vector> attrIds) { - fbb_.AddOffset(GetRoomDataExternalListRequest::VT_ATTRIDS, attrIds); - } - explicit GetRoomDataExternalListRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GetRoomDataExternalListRequestBuilder +{ + typedef GetRoomDataExternalListRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_roomIds(::flatbuffers::Offset<::flatbuffers::Vector> roomIds) + { + fbb_.AddOffset(GetRoomDataExternalListRequest::VT_ROOMIDS, roomIds); + } + void add_attrIds(::flatbuffers::Offset<::flatbuffers::Vector> attrIds) + { + fbb_.AddOffset(GetRoomDataExternalListRequest::VT_ATTRIDS, attrIds); + } + explicit GetRoomDataExternalListRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGetRoomDataExternalListRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector> roomIds = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> attrIds = 0) { - GetRoomDataExternalListRequestBuilder builder_(_fbb); - builder_.add_attrIds(attrIds); - builder_.add_roomIds(roomIds); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> roomIds = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> attrIds = 0) +{ + GetRoomDataExternalListRequestBuilder builder_(_fbb); + builder_.add_attrIds(attrIds); + builder_.add_roomIds(roomIds); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateGetRoomDataExternalListRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *roomIds = nullptr, - const std::vector *attrIds = nullptr) { - auto roomIds__ = roomIds ? _fbb.CreateVector(*roomIds) : 0; - auto attrIds__ = attrIds ? _fbb.CreateVector(*attrIds) : 0; - return CreateGetRoomDataExternalListRequest( - _fbb, - roomIds__, - attrIds__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector* roomIds = nullptr, + const std::vector* attrIds = nullptr) +{ + auto roomIds__ = roomIds ? _fbb.CreateVector(*roomIds) : 0; + auto attrIds__ = attrIds ? _fbb.CreateVector(*attrIds) : 0; + return CreateGetRoomDataExternalListRequest( + _fbb, + roomIds__, + attrIds__); } -struct GetRoomDataExternalListResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GetRoomDataExternalListResponseBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOMS = 4 - }; - const ::flatbuffers::Vector<::flatbuffers::Offset> *rooms() const { - return GetPointer> *>(VT_ROOMS); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ROOMS) && - verifier.VerifyVector(rooms()) && - verifier.VerifyVectorOfTables(rooms()) && - verifier.EndTable(); - } +struct GetRoomDataExternalListResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GetRoomDataExternalListResponseBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOMS = 4 + }; + const ::flatbuffers::Vector<::flatbuffers::Offset>* rooms() const + { + return GetPointer>*>(VT_ROOMS); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_ROOMS) && + verifier.VerifyVector(rooms()) && + verifier.VerifyVectorOfTables(rooms()) && + verifier.EndTable(); + } }; -struct GetRoomDataExternalListResponseBuilder { - typedef GetRoomDataExternalListResponse Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_rooms(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rooms) { - fbb_.AddOffset(GetRoomDataExternalListResponse::VT_ROOMS, rooms); - } - explicit GetRoomDataExternalListResponseBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GetRoomDataExternalListResponseBuilder +{ + typedef GetRoomDataExternalListResponse Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_rooms(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rooms) + { + fbb_.AddOffset(GetRoomDataExternalListResponse::VT_ROOMS, rooms); + } + explicit GetRoomDataExternalListResponseBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGetRoomDataExternalListResponse( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rooms = 0) { - GetRoomDataExternalListResponseBuilder builder_(_fbb); - builder_.add_rooms(rooms); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rooms = 0) +{ + GetRoomDataExternalListResponseBuilder builder_(_fbb); + builder_.add_rooms(rooms); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateGetRoomDataExternalListResponseDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector<::flatbuffers::Offset> *rooms = nullptr) { - auto rooms__ = rooms ? _fbb.CreateVector<::flatbuffers::Offset>(*rooms) : 0; - return CreateGetRoomDataExternalListResponse( - _fbb, - rooms__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector<::flatbuffers::Offset>* rooms = nullptr) +{ + auto rooms__ = rooms ? _fbb.CreateVector<::flatbuffers::Offset>(*rooms) : 0; + return CreateGetRoomDataExternalListResponse( + _fbb, + rooms__); } -struct SetRoomDataExternalRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef SetRoomDataExternalRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOMID = 4, - VT_ROOMSEARCHABLEINTATTREXTERNAL = 6, - VT_ROOMSEARCHABLEBINATTREXTERNAL = 8, - VT_ROOMBINATTREXTERNAL = 10 - }; - uint64_t roomId() const { - return GetField(VT_ROOMID, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomSearchableIntAttrExternal() const { - return GetPointer> *>(VT_ROOMSEARCHABLEINTATTREXTERNAL); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomSearchableBinAttrExternal() const { - return GetPointer> *>(VT_ROOMSEARCHABLEBINATTREXTERNAL); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomBinAttrExternal() const { - return GetPointer> *>(VT_ROOMBINATTREXTERNAL); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ROOMID, 8) && - VerifyOffset(verifier, VT_ROOMSEARCHABLEINTATTREXTERNAL) && - verifier.VerifyVector(roomSearchableIntAttrExternal()) && - verifier.VerifyVectorOfTables(roomSearchableIntAttrExternal()) && - VerifyOffset(verifier, VT_ROOMSEARCHABLEBINATTREXTERNAL) && - verifier.VerifyVector(roomSearchableBinAttrExternal()) && - verifier.VerifyVectorOfTables(roomSearchableBinAttrExternal()) && - VerifyOffset(verifier, VT_ROOMBINATTREXTERNAL) && - verifier.VerifyVector(roomBinAttrExternal()) && - verifier.VerifyVectorOfTables(roomBinAttrExternal()) && - verifier.EndTable(); - } +struct SetRoomDataExternalRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef SetRoomDataExternalRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOMID = 4, + VT_ROOMSEARCHABLEINTATTREXTERNAL = 6, + VT_ROOMSEARCHABLEBINATTREXTERNAL = 8, + VT_ROOMBINATTREXTERNAL = 10 + }; + uint64_t roomId() const + { + return GetField(VT_ROOMID, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomSearchableIntAttrExternal() const + { + return GetPointer>*>(VT_ROOMSEARCHABLEINTATTREXTERNAL); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomSearchableBinAttrExternal() const + { + return GetPointer>*>(VT_ROOMSEARCHABLEBINATTREXTERNAL); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomBinAttrExternal() const + { + return GetPointer>*>(VT_ROOMBINATTREXTERNAL); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ROOMID, 8) && + VerifyOffset(verifier, VT_ROOMSEARCHABLEINTATTREXTERNAL) && + verifier.VerifyVector(roomSearchableIntAttrExternal()) && + verifier.VerifyVectorOfTables(roomSearchableIntAttrExternal()) && + VerifyOffset(verifier, VT_ROOMSEARCHABLEBINATTREXTERNAL) && + verifier.VerifyVector(roomSearchableBinAttrExternal()) && + verifier.VerifyVectorOfTables(roomSearchableBinAttrExternal()) && + VerifyOffset(verifier, VT_ROOMBINATTREXTERNAL) && + verifier.VerifyVector(roomBinAttrExternal()) && + verifier.VerifyVectorOfTables(roomBinAttrExternal()) && + verifier.EndTable(); + } }; -struct SetRoomDataExternalRequestBuilder { - typedef SetRoomDataExternalRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_roomId(uint64_t roomId) { - fbb_.AddElement(SetRoomDataExternalRequest::VT_ROOMID, roomId, 0); - } - void add_roomSearchableIntAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableIntAttrExternal) { - fbb_.AddOffset(SetRoomDataExternalRequest::VT_ROOMSEARCHABLEINTATTREXTERNAL, roomSearchableIntAttrExternal); - } - void add_roomSearchableBinAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableBinAttrExternal) { - fbb_.AddOffset(SetRoomDataExternalRequest::VT_ROOMSEARCHABLEBINATTREXTERNAL, roomSearchableBinAttrExternal); - } - void add_roomBinAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrExternal) { - fbb_.AddOffset(SetRoomDataExternalRequest::VT_ROOMBINATTREXTERNAL, roomBinAttrExternal); - } - explicit SetRoomDataExternalRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct SetRoomDataExternalRequestBuilder +{ + typedef SetRoomDataExternalRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_roomId(uint64_t roomId) + { + fbb_.AddElement(SetRoomDataExternalRequest::VT_ROOMID, roomId, 0); + } + void add_roomSearchableIntAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableIntAttrExternal) + { + fbb_.AddOffset(SetRoomDataExternalRequest::VT_ROOMSEARCHABLEINTATTREXTERNAL, roomSearchableIntAttrExternal); + } + void add_roomSearchableBinAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableBinAttrExternal) + { + fbb_.AddOffset(SetRoomDataExternalRequest::VT_ROOMSEARCHABLEBINATTREXTERNAL, roomSearchableBinAttrExternal); + } + void add_roomBinAttrExternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrExternal) + { + fbb_.AddOffset(SetRoomDataExternalRequest::VT_ROOMBINATTREXTERNAL, roomBinAttrExternal); + } + explicit SetRoomDataExternalRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateSetRoomDataExternalRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableIntAttrExternal = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableBinAttrExternal = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrExternal = 0) { - SetRoomDataExternalRequestBuilder builder_(_fbb); - builder_.add_roomId(roomId); - builder_.add_roomBinAttrExternal(roomBinAttrExternal); - builder_.add_roomSearchableBinAttrExternal(roomSearchableBinAttrExternal); - builder_.add_roomSearchableIntAttrExternal(roomSearchableIntAttrExternal); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableIntAttrExternal = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomSearchableBinAttrExternal = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrExternal = 0) +{ + SetRoomDataExternalRequestBuilder builder_(_fbb); + builder_.add_roomId(roomId); + builder_.add_roomBinAttrExternal(roomBinAttrExternal); + builder_.add_roomSearchableBinAttrExternal(roomSearchableBinAttrExternal); + builder_.add_roomSearchableIntAttrExternal(roomSearchableIntAttrExternal); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateSetRoomDataExternalRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - const std::vector<::flatbuffers::Offset> *roomSearchableIntAttrExternal = nullptr, - const std::vector<::flatbuffers::Offset> *roomSearchableBinAttrExternal = nullptr, - const std::vector<::flatbuffers::Offset> *roomBinAttrExternal = nullptr) { - auto roomSearchableIntAttrExternal__ = roomSearchableIntAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomSearchableIntAttrExternal) : 0; - auto roomSearchableBinAttrExternal__ = roomSearchableBinAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomSearchableBinAttrExternal) : 0; - auto roomBinAttrExternal__ = roomBinAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomBinAttrExternal) : 0; - return CreateSetRoomDataExternalRequest( - _fbb, - roomId, - roomSearchableIntAttrExternal__, - roomSearchableBinAttrExternal__, - roomBinAttrExternal__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + const std::vector<::flatbuffers::Offset>* roomSearchableIntAttrExternal = nullptr, + const std::vector<::flatbuffers::Offset>* roomSearchableBinAttrExternal = nullptr, + const std::vector<::flatbuffers::Offset>* roomBinAttrExternal = nullptr) +{ + auto roomSearchableIntAttrExternal__ = roomSearchableIntAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomSearchableIntAttrExternal) : 0; + auto roomSearchableBinAttrExternal__ = roomSearchableBinAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomSearchableBinAttrExternal) : 0; + auto roomBinAttrExternal__ = roomBinAttrExternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomBinAttrExternal) : 0; + return CreateSetRoomDataExternalRequest( + _fbb, + roomId, + roomSearchableIntAttrExternal__, + roomSearchableBinAttrExternal__, + roomBinAttrExternal__); } -struct SetRoomDataInternalRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef SetRoomDataInternalRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOMID = 4, - VT_FLAGFILTER = 6, - VT_FLAGATTR = 8, - VT_ROOMBINATTRINTERNAL = 10, - VT_PASSWORDCONFIG = 12, - VT_PASSWORDSLOTMASK = 14, - VT_OWNERPRIVILEGERANK = 16 - }; - uint64_t roomId() const { - return GetField(VT_ROOMID, 0); - } - uint32_t flagFilter() const { - return GetField(VT_FLAGFILTER, 0); - } - uint32_t flagAttr() const { - return GetField(VT_FLAGATTR, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomBinAttrInternal() const { - return GetPointer> *>(VT_ROOMBINATTRINTERNAL); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *passwordConfig() const { - return GetPointer> *>(VT_PASSWORDCONFIG); - } - uint64_t passwordSlotMask() const { - return GetField(VT_PASSWORDSLOTMASK, 0); - } - const ::flatbuffers::Vector *ownerPrivilegeRank() const { - return GetPointer *>(VT_OWNERPRIVILEGERANK); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ROOMID, 8) && - VerifyField(verifier, VT_FLAGFILTER, 4) && - VerifyField(verifier, VT_FLAGATTR, 4) && - VerifyOffset(verifier, VT_ROOMBINATTRINTERNAL) && - verifier.VerifyVector(roomBinAttrInternal()) && - verifier.VerifyVectorOfTables(roomBinAttrInternal()) && - VerifyOffset(verifier, VT_PASSWORDCONFIG) && - verifier.VerifyVector(passwordConfig()) && - verifier.VerifyVectorOfTables(passwordConfig()) && - VerifyField(verifier, VT_PASSWORDSLOTMASK, 8) && - VerifyOffset(verifier, VT_OWNERPRIVILEGERANK) && - verifier.VerifyVector(ownerPrivilegeRank()) && - verifier.EndTable(); - } +struct SetRoomDataInternalRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef SetRoomDataInternalRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOMID = 4, + VT_FLAGFILTER = 6, + VT_FLAGATTR = 8, + VT_ROOMBINATTRINTERNAL = 10, + VT_PASSWORDCONFIG = 12, + VT_PASSWORDSLOTMASK = 14, + VT_OWNERPRIVILEGERANK = 16 + }; + uint64_t roomId() const + { + return GetField(VT_ROOMID, 0); + } + uint32_t flagFilter() const + { + return GetField(VT_FLAGFILTER, 0); + } + uint32_t flagAttr() const + { + return GetField(VT_FLAGATTR, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomBinAttrInternal() const + { + return GetPointer>*>(VT_ROOMBINATTRINTERNAL); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* passwordConfig() const + { + return GetPointer>*>(VT_PASSWORDCONFIG); + } + uint64_t passwordSlotMask() const + { + return GetField(VT_PASSWORDSLOTMASK, 0); + } + const ::flatbuffers::Vector* ownerPrivilegeRank() const + { + return GetPointer*>(VT_OWNERPRIVILEGERANK); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ROOMID, 8) && + VerifyField(verifier, VT_FLAGFILTER, 4) && + VerifyField(verifier, VT_FLAGATTR, 4) && + VerifyOffset(verifier, VT_ROOMBINATTRINTERNAL) && + verifier.VerifyVector(roomBinAttrInternal()) && + verifier.VerifyVectorOfTables(roomBinAttrInternal()) && + VerifyOffset(verifier, VT_PASSWORDCONFIG) && + verifier.VerifyVector(passwordConfig()) && + verifier.VerifyVectorOfTables(passwordConfig()) && + VerifyField(verifier, VT_PASSWORDSLOTMASK, 8) && + VerifyOffset(verifier, VT_OWNERPRIVILEGERANK) && + verifier.VerifyVector(ownerPrivilegeRank()) && + verifier.EndTable(); + } }; -struct SetRoomDataInternalRequestBuilder { - typedef SetRoomDataInternalRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_roomId(uint64_t roomId) { - fbb_.AddElement(SetRoomDataInternalRequest::VT_ROOMID, roomId, 0); - } - void add_flagFilter(uint32_t flagFilter) { - fbb_.AddElement(SetRoomDataInternalRequest::VT_FLAGFILTER, flagFilter, 0); - } - void add_flagAttr(uint32_t flagAttr) { - fbb_.AddElement(SetRoomDataInternalRequest::VT_FLAGATTR, flagAttr, 0); - } - void add_roomBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrInternal) { - fbb_.AddOffset(SetRoomDataInternalRequest::VT_ROOMBINATTRINTERNAL, roomBinAttrInternal); - } - void add_passwordConfig(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> passwordConfig) { - fbb_.AddOffset(SetRoomDataInternalRequest::VT_PASSWORDCONFIG, passwordConfig); - } - void add_passwordSlotMask(uint64_t passwordSlotMask) { - fbb_.AddElement(SetRoomDataInternalRequest::VT_PASSWORDSLOTMASK, passwordSlotMask, 0); - } - void add_ownerPrivilegeRank(::flatbuffers::Offset<::flatbuffers::Vector> ownerPrivilegeRank) { - fbb_.AddOffset(SetRoomDataInternalRequest::VT_OWNERPRIVILEGERANK, ownerPrivilegeRank); - } - explicit SetRoomDataInternalRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct SetRoomDataInternalRequestBuilder +{ + typedef SetRoomDataInternalRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_roomId(uint64_t roomId) + { + fbb_.AddElement(SetRoomDataInternalRequest::VT_ROOMID, roomId, 0); + } + void add_flagFilter(uint32_t flagFilter) + { + fbb_.AddElement(SetRoomDataInternalRequest::VT_FLAGFILTER, flagFilter, 0); + } + void add_flagAttr(uint32_t flagAttr) + { + fbb_.AddElement(SetRoomDataInternalRequest::VT_FLAGATTR, flagAttr, 0); + } + void add_roomBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrInternal) + { + fbb_.AddOffset(SetRoomDataInternalRequest::VT_ROOMBINATTRINTERNAL, roomBinAttrInternal); + } + void add_passwordConfig(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> passwordConfig) + { + fbb_.AddOffset(SetRoomDataInternalRequest::VT_PASSWORDCONFIG, passwordConfig); + } + void add_passwordSlotMask(uint64_t passwordSlotMask) + { + fbb_.AddElement(SetRoomDataInternalRequest::VT_PASSWORDSLOTMASK, passwordSlotMask, 0); + } + void add_ownerPrivilegeRank(::flatbuffers::Offset<::flatbuffers::Vector> ownerPrivilegeRank) + { + fbb_.AddOffset(SetRoomDataInternalRequest::VT_OWNERPRIVILEGERANK, ownerPrivilegeRank); + } + explicit SetRoomDataInternalRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateSetRoomDataInternalRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - uint32_t flagFilter = 0, - uint32_t flagAttr = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrInternal = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> passwordConfig = 0, - uint64_t passwordSlotMask = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> ownerPrivilegeRank = 0) { - SetRoomDataInternalRequestBuilder builder_(_fbb); - builder_.add_passwordSlotMask(passwordSlotMask); - builder_.add_roomId(roomId); - builder_.add_ownerPrivilegeRank(ownerPrivilegeRank); - builder_.add_passwordConfig(passwordConfig); - builder_.add_roomBinAttrInternal(roomBinAttrInternal); - builder_.add_flagAttr(flagAttr); - builder_.add_flagFilter(flagFilter); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + uint32_t flagFilter = 0, + uint32_t flagAttr = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomBinAttrInternal = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> passwordConfig = 0, + uint64_t passwordSlotMask = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> ownerPrivilegeRank = 0) +{ + SetRoomDataInternalRequestBuilder builder_(_fbb); + builder_.add_passwordSlotMask(passwordSlotMask); + builder_.add_roomId(roomId); + builder_.add_ownerPrivilegeRank(ownerPrivilegeRank); + builder_.add_passwordConfig(passwordConfig); + builder_.add_roomBinAttrInternal(roomBinAttrInternal); + builder_.add_flagAttr(flagAttr); + builder_.add_flagFilter(flagFilter); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateSetRoomDataInternalRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - uint32_t flagFilter = 0, - uint32_t flagAttr = 0, - const std::vector<::flatbuffers::Offset> *roomBinAttrInternal = nullptr, - const std::vector<::flatbuffers::Offset> *passwordConfig = nullptr, - uint64_t passwordSlotMask = 0, - const std::vector *ownerPrivilegeRank = nullptr) { - auto roomBinAttrInternal__ = roomBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomBinAttrInternal) : 0; - auto passwordConfig__ = passwordConfig ? _fbb.CreateVector<::flatbuffers::Offset>(*passwordConfig) : 0; - auto ownerPrivilegeRank__ = ownerPrivilegeRank ? _fbb.CreateVector(*ownerPrivilegeRank) : 0; - return CreateSetRoomDataInternalRequest( - _fbb, - roomId, - flagFilter, - flagAttr, - roomBinAttrInternal__, - passwordConfig__, - passwordSlotMask, - ownerPrivilegeRank__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + uint32_t flagFilter = 0, + uint32_t flagAttr = 0, + const std::vector<::flatbuffers::Offset>* roomBinAttrInternal = nullptr, + const std::vector<::flatbuffers::Offset>* passwordConfig = nullptr, + uint64_t passwordSlotMask = 0, + const std::vector* ownerPrivilegeRank = nullptr) +{ + auto roomBinAttrInternal__ = roomBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomBinAttrInternal) : 0; + auto passwordConfig__ = passwordConfig ? _fbb.CreateVector<::flatbuffers::Offset>(*passwordConfig) : 0; + auto ownerPrivilegeRank__ = ownerPrivilegeRank ? _fbb.CreateVector(*ownerPrivilegeRank) : 0; + return CreateSetRoomDataInternalRequest( + _fbb, + roomId, + flagFilter, + flagAttr, + roomBinAttrInternal__, + passwordConfig__, + passwordSlotMask, + ownerPrivilegeRank__); } -struct GetRoomMemberDataInternalRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GetRoomMemberDataInternalRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOMID = 4, - VT_MEMBERID = 6, - VT_ATTRID = 8 - }; - uint64_t roomId() const { - return GetField(VT_ROOMID, 0); - } - uint16_t memberId() const { - return GetField(VT_MEMBERID, 0); - } - const ::flatbuffers::Vector *attrId() const { - return GetPointer *>(VT_ATTRID); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ROOMID, 8) && - VerifyField(verifier, VT_MEMBERID, 2) && - VerifyOffset(verifier, VT_ATTRID) && - verifier.VerifyVector(attrId()) && - verifier.EndTable(); - } +struct GetRoomMemberDataInternalRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GetRoomMemberDataInternalRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOMID = 4, + VT_MEMBERID = 6, + VT_ATTRID = 8 + }; + uint64_t roomId() const + { + return GetField(VT_ROOMID, 0); + } + uint16_t memberId() const + { + return GetField(VT_MEMBERID, 0); + } + const ::flatbuffers::Vector* attrId() const + { + return GetPointer*>(VT_ATTRID); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ROOMID, 8) && + VerifyField(verifier, VT_MEMBERID, 2) && + VerifyOffset(verifier, VT_ATTRID) && + verifier.VerifyVector(attrId()) && + verifier.EndTable(); + } }; -struct GetRoomMemberDataInternalRequestBuilder { - typedef GetRoomMemberDataInternalRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_roomId(uint64_t roomId) { - fbb_.AddElement(GetRoomMemberDataInternalRequest::VT_ROOMID, roomId, 0); - } - void add_memberId(uint16_t memberId) { - fbb_.AddElement(GetRoomMemberDataInternalRequest::VT_MEMBERID, memberId, 0); - } - void add_attrId(::flatbuffers::Offset<::flatbuffers::Vector> attrId) { - fbb_.AddOffset(GetRoomMemberDataInternalRequest::VT_ATTRID, attrId); - } - explicit GetRoomMemberDataInternalRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GetRoomMemberDataInternalRequestBuilder +{ + typedef GetRoomMemberDataInternalRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_roomId(uint64_t roomId) + { + fbb_.AddElement(GetRoomMemberDataInternalRequest::VT_ROOMID, roomId, 0); + } + void add_memberId(uint16_t memberId) + { + fbb_.AddElement(GetRoomMemberDataInternalRequest::VT_MEMBERID, memberId, 0); + } + void add_attrId(::flatbuffers::Offset<::flatbuffers::Vector> attrId) + { + fbb_.AddOffset(GetRoomMemberDataInternalRequest::VT_ATTRID, attrId); + } + explicit GetRoomMemberDataInternalRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGetRoomMemberDataInternalRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - uint16_t memberId = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> attrId = 0) { - GetRoomMemberDataInternalRequestBuilder builder_(_fbb); - builder_.add_roomId(roomId); - builder_.add_attrId(attrId); - builder_.add_memberId(memberId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + uint16_t memberId = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> attrId = 0) +{ + GetRoomMemberDataInternalRequestBuilder builder_(_fbb); + builder_.add_roomId(roomId); + builder_.add_attrId(attrId); + builder_.add_memberId(memberId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateGetRoomMemberDataInternalRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - uint16_t memberId = 0, - const std::vector *attrId = nullptr) { - auto attrId__ = attrId ? _fbb.CreateVector(*attrId) : 0; - return CreateGetRoomMemberDataInternalRequest( - _fbb, - roomId, - memberId, - attrId__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + uint16_t memberId = 0, + const std::vector* attrId = nullptr) +{ + auto attrId__ = attrId ? _fbb.CreateVector(*attrId) : 0; + return CreateGetRoomMemberDataInternalRequest( + _fbb, + roomId, + memberId, + attrId__); } -struct SetRoomMemberDataInternalRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef SetRoomMemberDataInternalRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOMID = 4, - VT_MEMBERID = 6, - VT_TEAMID = 8, - VT_ROOMMEMBERBINATTRINTERNAL = 10 - }; - uint64_t roomId() const { - return GetField(VT_ROOMID, 0); - } - uint16_t memberId() const { - return GetField(VT_MEMBERID, 0); - } - uint8_t teamId() const { - return GetField(VT_TEAMID, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *roomMemberBinAttrInternal() const { - return GetPointer> *>(VT_ROOMMEMBERBINATTRINTERNAL); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ROOMID, 8) && - VerifyField(verifier, VT_MEMBERID, 2) && - VerifyField(verifier, VT_TEAMID, 1) && - VerifyOffset(verifier, VT_ROOMMEMBERBINATTRINTERNAL) && - verifier.VerifyVector(roomMemberBinAttrInternal()) && - verifier.VerifyVectorOfTables(roomMemberBinAttrInternal()) && - verifier.EndTable(); - } +struct SetRoomMemberDataInternalRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef SetRoomMemberDataInternalRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOMID = 4, + VT_MEMBERID = 6, + VT_TEAMID = 8, + VT_ROOMMEMBERBINATTRINTERNAL = 10 + }; + uint64_t roomId() const + { + return GetField(VT_ROOMID, 0); + } + uint16_t memberId() const + { + return GetField(VT_MEMBERID, 0); + } + uint8_t teamId() const + { + return GetField(VT_TEAMID, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* roomMemberBinAttrInternal() const + { + return GetPointer>*>(VT_ROOMMEMBERBINATTRINTERNAL); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ROOMID, 8) && + VerifyField(verifier, VT_MEMBERID, 2) && + VerifyField(verifier, VT_TEAMID, 1) && + VerifyOffset(verifier, VT_ROOMMEMBERBINATTRINTERNAL) && + verifier.VerifyVector(roomMemberBinAttrInternal()) && + verifier.VerifyVectorOfTables(roomMemberBinAttrInternal()) && + verifier.EndTable(); + } }; -struct SetRoomMemberDataInternalRequestBuilder { - typedef SetRoomMemberDataInternalRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_roomId(uint64_t roomId) { - fbb_.AddElement(SetRoomMemberDataInternalRequest::VT_ROOMID, roomId, 0); - } - void add_memberId(uint16_t memberId) { - fbb_.AddElement(SetRoomMemberDataInternalRequest::VT_MEMBERID, memberId, 0); - } - void add_teamId(uint8_t teamId) { - fbb_.AddElement(SetRoomMemberDataInternalRequest::VT_TEAMID, teamId, 0); - } - void add_roomMemberBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal) { - fbb_.AddOffset(SetRoomMemberDataInternalRequest::VT_ROOMMEMBERBINATTRINTERNAL, roomMemberBinAttrInternal); - } - explicit SetRoomMemberDataInternalRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct SetRoomMemberDataInternalRequestBuilder +{ + typedef SetRoomMemberDataInternalRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_roomId(uint64_t roomId) + { + fbb_.AddElement(SetRoomMemberDataInternalRequest::VT_ROOMID, roomId, 0); + } + void add_memberId(uint16_t memberId) + { + fbb_.AddElement(SetRoomMemberDataInternalRequest::VT_MEMBERID, memberId, 0); + } + void add_teamId(uint8_t teamId) + { + fbb_.AddElement(SetRoomMemberDataInternalRequest::VT_TEAMID, teamId, 0); + } + void add_roomMemberBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal) + { + fbb_.AddOffset(SetRoomMemberDataInternalRequest::VT_ROOMMEMBERBINATTRINTERNAL, roomMemberBinAttrInternal); + } + explicit SetRoomMemberDataInternalRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateSetRoomMemberDataInternalRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - uint16_t memberId = 0, - uint8_t teamId = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal = 0) { - SetRoomMemberDataInternalRequestBuilder builder_(_fbb); - builder_.add_roomId(roomId); - builder_.add_roomMemberBinAttrInternal(roomMemberBinAttrInternal); - builder_.add_memberId(memberId); - builder_.add_teamId(teamId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + uint16_t memberId = 0, + uint8_t teamId = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> roomMemberBinAttrInternal = 0) +{ + SetRoomMemberDataInternalRequestBuilder builder_(_fbb); + builder_.add_roomId(roomId); + builder_.add_roomMemberBinAttrInternal(roomMemberBinAttrInternal); + builder_.add_memberId(memberId); + builder_.add_teamId(teamId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateSetRoomMemberDataInternalRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - uint16_t memberId = 0, - uint8_t teamId = 0, - const std::vector<::flatbuffers::Offset> *roomMemberBinAttrInternal = nullptr) { - auto roomMemberBinAttrInternal__ = roomMemberBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomMemberBinAttrInternal) : 0; - return CreateSetRoomMemberDataInternalRequest( - _fbb, - roomId, - memberId, - teamId, - roomMemberBinAttrInternal__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + uint16_t memberId = 0, + uint8_t teamId = 0, + const std::vector<::flatbuffers::Offset>* roomMemberBinAttrInternal = nullptr) +{ + auto roomMemberBinAttrInternal__ = roomMemberBinAttrInternal ? _fbb.CreateVector<::flatbuffers::Offset>(*roomMemberBinAttrInternal) : 0; + return CreateSetRoomMemberDataInternalRequest( + _fbb, + roomId, + memberId, + teamId, + roomMemberBinAttrInternal__); } -struct SetUserInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef SetUserInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SERVERID = 4, - VT_USERBINATTR = 6 - }; - uint16_t serverId() const { - return GetField(VT_SERVERID, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *userBinAttr() const { - return GetPointer> *>(VT_USERBINATTR); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_SERVERID, 2) && - VerifyOffset(verifier, VT_USERBINATTR) && - verifier.VerifyVector(userBinAttr()) && - verifier.VerifyVectorOfTables(userBinAttr()) && - verifier.EndTable(); - } +struct SetUserInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef SetUserInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_SERVERID = 4, + VT_USERBINATTR = 6 + }; + uint16_t serverId() const + { + return GetField(VT_SERVERID, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* userBinAttr() const + { + return GetPointer>*>(VT_USERBINATTR); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_SERVERID, 2) && + VerifyOffset(verifier, VT_USERBINATTR) && + verifier.VerifyVector(userBinAttr()) && + verifier.VerifyVectorOfTables(userBinAttr()) && + verifier.EndTable(); + } }; -struct SetUserInfoBuilder { - typedef SetUserInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_serverId(uint16_t serverId) { - fbb_.AddElement(SetUserInfo::VT_SERVERID, serverId, 0); - } - void add_userBinAttr(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> userBinAttr) { - fbb_.AddOffset(SetUserInfo::VT_USERBINATTR, userBinAttr); - } - explicit SetUserInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct SetUserInfoBuilder +{ + typedef SetUserInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_serverId(uint16_t serverId) + { + fbb_.AddElement(SetUserInfo::VT_SERVERID, serverId, 0); + } + void add_userBinAttr(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> userBinAttr) + { + fbb_.AddOffset(SetUserInfo::VT_USERBINATTR, userBinAttr); + } + explicit SetUserInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateSetUserInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint16_t serverId = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> userBinAttr = 0) { - SetUserInfoBuilder builder_(_fbb); - builder_.add_userBinAttr(userBinAttr); - builder_.add_serverId(serverId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint16_t serverId = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> userBinAttr = 0) +{ + SetUserInfoBuilder builder_(_fbb); + builder_.add_userBinAttr(userBinAttr); + builder_.add_serverId(serverId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateSetUserInfoDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint16_t serverId = 0, - const std::vector<::flatbuffers::Offset> *userBinAttr = nullptr) { - auto userBinAttr__ = userBinAttr ? _fbb.CreateVector<::flatbuffers::Offset>(*userBinAttr) : 0; - return CreateSetUserInfo( - _fbb, - serverId, - userBinAttr__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint16_t serverId = 0, + const std::vector<::flatbuffers::Offset>* userBinAttr = nullptr) +{ + auto userBinAttr__ = userBinAttr ? _fbb.CreateVector<::flatbuffers::Offset>(*userBinAttr) : 0; + return CreateSetUserInfo( + _fbb, + serverId, + userBinAttr__); } -struct GetRoomDataInternalRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GetRoomDataInternalRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOMID = 4, - VT_ATTRID = 6 - }; - uint64_t roomId() const { - return GetField(VT_ROOMID, 0); - } - const ::flatbuffers::Vector *attrId() const { - return GetPointer *>(VT_ATTRID); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ROOMID, 8) && - VerifyOffset(verifier, VT_ATTRID) && - verifier.VerifyVector(attrId()) && - verifier.EndTable(); - } +struct GetRoomDataInternalRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GetRoomDataInternalRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOMID = 4, + VT_ATTRID = 6 + }; + uint64_t roomId() const + { + return GetField(VT_ROOMID, 0); + } + const ::flatbuffers::Vector* attrId() const + { + return GetPointer*>(VT_ATTRID); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ROOMID, 8) && + VerifyOffset(verifier, VT_ATTRID) && + verifier.VerifyVector(attrId()) && + verifier.EndTable(); + } }; -struct GetRoomDataInternalRequestBuilder { - typedef GetRoomDataInternalRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_roomId(uint64_t roomId) { - fbb_.AddElement(GetRoomDataInternalRequest::VT_ROOMID, roomId, 0); - } - void add_attrId(::flatbuffers::Offset<::flatbuffers::Vector> attrId) { - fbb_.AddOffset(GetRoomDataInternalRequest::VT_ATTRID, attrId); - } - explicit GetRoomDataInternalRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GetRoomDataInternalRequestBuilder +{ + typedef GetRoomDataInternalRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_roomId(uint64_t roomId) + { + fbb_.AddElement(GetRoomDataInternalRequest::VT_ROOMID, roomId, 0); + } + void add_attrId(::flatbuffers::Offset<::flatbuffers::Vector> attrId) + { + fbb_.AddOffset(GetRoomDataInternalRequest::VT_ATTRID, attrId); + } + explicit GetRoomDataInternalRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGetRoomDataInternalRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> attrId = 0) { - GetRoomDataInternalRequestBuilder builder_(_fbb); - builder_.add_roomId(roomId); - builder_.add_attrId(attrId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> attrId = 0) +{ + GetRoomDataInternalRequestBuilder builder_(_fbb); + builder_.add_roomId(roomId); + builder_.add_attrId(attrId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateGetRoomDataInternalRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - const std::vector *attrId = nullptr) { - auto attrId__ = attrId ? _fbb.CreateVector(*attrId) : 0; - return CreateGetRoomDataInternalRequest( - _fbb, - roomId, - attrId__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + const std::vector* attrId = nullptr) +{ + auto attrId__ = attrId ? _fbb.CreateVector(*attrId) : 0; + return CreateGetRoomDataInternalRequest( + _fbb, + roomId, + attrId__); } -struct RoomMemberUpdateInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RoomMemberUpdateInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOMMEMBERDATAINTERNAL = 4, - VT_EVENTCAUSE = 6, - VT_OPTDATA = 8 - }; - const RoomMemberDataInternal *roomMemberDataInternal() const { - return GetPointer(VT_ROOMMEMBERDATAINTERNAL); - } - uint8_t eventCause() const { - return GetField(VT_EVENTCAUSE, 0); - } - const PresenceOptionData *optData() const { - return GetPointer(VT_OPTDATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ROOMMEMBERDATAINTERNAL) && - verifier.VerifyTable(roomMemberDataInternal()) && - VerifyField(verifier, VT_EVENTCAUSE, 1) && - VerifyOffset(verifier, VT_OPTDATA) && - verifier.VerifyTable(optData()) && - verifier.EndTable(); - } +struct RoomMemberUpdateInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RoomMemberUpdateInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOMMEMBERDATAINTERNAL = 4, + VT_EVENTCAUSE = 6, + VT_OPTDATA = 8 + }; + const RoomMemberDataInternal* roomMemberDataInternal() const + { + return GetPointer(VT_ROOMMEMBERDATAINTERNAL); + } + uint8_t eventCause() const + { + return GetField(VT_EVENTCAUSE, 0); + } + const PresenceOptionData* optData() const + { + return GetPointer(VT_OPTDATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_ROOMMEMBERDATAINTERNAL) && + verifier.VerifyTable(roomMemberDataInternal()) && + VerifyField(verifier, VT_EVENTCAUSE, 1) && + VerifyOffset(verifier, VT_OPTDATA) && + verifier.VerifyTable(optData()) && + verifier.EndTable(); + } }; -struct RoomMemberUpdateInfoBuilder { - typedef RoomMemberUpdateInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_roomMemberDataInternal(::flatbuffers::Offset roomMemberDataInternal) { - fbb_.AddOffset(RoomMemberUpdateInfo::VT_ROOMMEMBERDATAINTERNAL, roomMemberDataInternal); - } - void add_eventCause(uint8_t eventCause) { - fbb_.AddElement(RoomMemberUpdateInfo::VT_EVENTCAUSE, eventCause, 0); - } - void add_optData(::flatbuffers::Offset optData) { - fbb_.AddOffset(RoomMemberUpdateInfo::VT_OPTDATA, optData); - } - explicit RoomMemberUpdateInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RoomMemberUpdateInfoBuilder +{ + typedef RoomMemberUpdateInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_roomMemberDataInternal(::flatbuffers::Offset roomMemberDataInternal) + { + fbb_.AddOffset(RoomMemberUpdateInfo::VT_ROOMMEMBERDATAINTERNAL, roomMemberDataInternal); + } + void add_eventCause(uint8_t eventCause) + { + fbb_.AddElement(RoomMemberUpdateInfo::VT_EVENTCAUSE, eventCause, 0); + } + void add_optData(::flatbuffers::Offset optData) + { + fbb_.AddOffset(RoomMemberUpdateInfo::VT_OPTDATA, optData); + } + explicit RoomMemberUpdateInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRoomMemberUpdateInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset roomMemberDataInternal = 0, - uint8_t eventCause = 0, - ::flatbuffers::Offset optData = 0) { - RoomMemberUpdateInfoBuilder builder_(_fbb); - builder_.add_optData(optData); - builder_.add_roomMemberDataInternal(roomMemberDataInternal); - builder_.add_eventCause(eventCause); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset roomMemberDataInternal = 0, + uint8_t eventCause = 0, + ::flatbuffers::Offset optData = 0) +{ + RoomMemberUpdateInfoBuilder builder_(_fbb); + builder_.add_optData(optData); + builder_.add_roomMemberDataInternal(roomMemberDataInternal); + builder_.add_eventCause(eventCause); + return builder_.Finish(); } -struct NotificationUserJoinedRoom FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef NotificationUserJoinedRoomBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOM_ID = 4, - VT_UPDATE_INFO = 6, - VT_SIGNALING = 8 - }; - uint64_t room_id() const { - return GetField(VT_ROOM_ID, 0); - } - const RoomMemberUpdateInfo *update_info() const { - return GetPointer(VT_UPDATE_INFO); - } - const SignalingAddr *signaling() const { - return GetPointer(VT_SIGNALING); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ROOM_ID, 8) && - VerifyOffset(verifier, VT_UPDATE_INFO) && - verifier.VerifyTable(update_info()) && - VerifyOffset(verifier, VT_SIGNALING) && - verifier.VerifyTable(signaling()) && - verifier.EndTable(); - } +struct NotificationUserJoinedRoom FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef NotificationUserJoinedRoomBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOM_ID = 4, + VT_UPDATE_INFO = 6, + VT_SIGNALING = 8 + }; + uint64_t room_id() const + { + return GetField(VT_ROOM_ID, 0); + } + const RoomMemberUpdateInfo* update_info() const + { + return GetPointer(VT_UPDATE_INFO); + } + const SignalingAddr* signaling() const + { + return GetPointer(VT_SIGNALING); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ROOM_ID, 8) && + VerifyOffset(verifier, VT_UPDATE_INFO) && + verifier.VerifyTable(update_info()) && + VerifyOffset(verifier, VT_SIGNALING) && + verifier.VerifyTable(signaling()) && + verifier.EndTable(); + } }; -struct NotificationUserJoinedRoomBuilder { - typedef NotificationUserJoinedRoom Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_room_id(uint64_t room_id) { - fbb_.AddElement(NotificationUserJoinedRoom::VT_ROOM_ID, room_id, 0); - } - void add_update_info(::flatbuffers::Offset update_info) { - fbb_.AddOffset(NotificationUserJoinedRoom::VT_UPDATE_INFO, update_info); - } - void add_signaling(::flatbuffers::Offset signaling) { - fbb_.AddOffset(NotificationUserJoinedRoom::VT_SIGNALING, signaling); - } - explicit NotificationUserJoinedRoomBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct NotificationUserJoinedRoomBuilder +{ + typedef NotificationUserJoinedRoom Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_room_id(uint64_t room_id) + { + fbb_.AddElement(NotificationUserJoinedRoom::VT_ROOM_ID, room_id, 0); + } + void add_update_info(::flatbuffers::Offset update_info) + { + fbb_.AddOffset(NotificationUserJoinedRoom::VT_UPDATE_INFO, update_info); + } + void add_signaling(::flatbuffers::Offset signaling) + { + fbb_.AddOffset(NotificationUserJoinedRoom::VT_SIGNALING, signaling); + } + explicit NotificationUserJoinedRoomBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateNotificationUserJoinedRoom( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t room_id = 0, - ::flatbuffers::Offset update_info = 0, - ::flatbuffers::Offset signaling = 0) { - NotificationUserJoinedRoomBuilder builder_(_fbb); - builder_.add_room_id(room_id); - builder_.add_signaling(signaling); - builder_.add_update_info(update_info); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t room_id = 0, + ::flatbuffers::Offset update_info = 0, + ::flatbuffers::Offset signaling = 0) +{ + NotificationUserJoinedRoomBuilder builder_(_fbb); + builder_.add_room_id(room_id); + builder_.add_signaling(signaling); + builder_.add_update_info(update_info); + return builder_.Finish(); } -struct RoomUpdateInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RoomUpdateInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_EVENTCAUSE = 4, - VT_ERRORCODE = 6, - VT_OPTDATA = 8 - }; - uint8_t eventCause() const { - return GetField(VT_EVENTCAUSE, 0); - } - int32_t errorCode() const { - return GetField(VT_ERRORCODE, 0); - } - const PresenceOptionData *optData() const { - return GetPointer(VT_OPTDATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_EVENTCAUSE, 1) && - VerifyField(verifier, VT_ERRORCODE, 4) && - VerifyOffset(verifier, VT_OPTDATA) && - verifier.VerifyTable(optData()) && - verifier.EndTable(); - } +struct RoomUpdateInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RoomUpdateInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_EVENTCAUSE = 4, + VT_ERRORCODE = 6, + VT_OPTDATA = 8 + }; + uint8_t eventCause() const + { + return GetField(VT_EVENTCAUSE, 0); + } + int32_t errorCode() const + { + return GetField(VT_ERRORCODE, 0); + } + const PresenceOptionData* optData() const + { + return GetPointer(VT_OPTDATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_EVENTCAUSE, 1) && + VerifyField(verifier, VT_ERRORCODE, 4) && + VerifyOffset(verifier, VT_OPTDATA) && + verifier.VerifyTable(optData()) && + verifier.EndTable(); + } }; -struct RoomUpdateInfoBuilder { - typedef RoomUpdateInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_eventCause(uint8_t eventCause) { - fbb_.AddElement(RoomUpdateInfo::VT_EVENTCAUSE, eventCause, 0); - } - void add_errorCode(int32_t errorCode) { - fbb_.AddElement(RoomUpdateInfo::VT_ERRORCODE, errorCode, 0); - } - void add_optData(::flatbuffers::Offset optData) { - fbb_.AddOffset(RoomUpdateInfo::VT_OPTDATA, optData); - } - explicit RoomUpdateInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RoomUpdateInfoBuilder +{ + typedef RoomUpdateInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_eventCause(uint8_t eventCause) + { + fbb_.AddElement(RoomUpdateInfo::VT_EVENTCAUSE, eventCause, 0); + } + void add_errorCode(int32_t errorCode) + { + fbb_.AddElement(RoomUpdateInfo::VT_ERRORCODE, errorCode, 0); + } + void add_optData(::flatbuffers::Offset optData) + { + fbb_.AddOffset(RoomUpdateInfo::VT_OPTDATA, optData); + } + explicit RoomUpdateInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRoomUpdateInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint8_t eventCause = 0, - int32_t errorCode = 0, - ::flatbuffers::Offset optData = 0) { - RoomUpdateInfoBuilder builder_(_fbb); - builder_.add_optData(optData); - builder_.add_errorCode(errorCode); - builder_.add_eventCause(eventCause); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint8_t eventCause = 0, + int32_t errorCode = 0, + ::flatbuffers::Offset optData = 0) +{ + RoomUpdateInfoBuilder builder_(_fbb); + builder_.add_optData(optData); + builder_.add_errorCode(errorCode); + builder_.add_eventCause(eventCause); + return builder_.Finish(); } -struct RoomDataInternalUpdateInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RoomDataInternalUpdateInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NEWROOMDATAINTERNAL = 4, - VT_PREVFLAGATTR = 6, - VT_PREVROOMPASSWORDSLOTMASK = 8, - VT_NEWROOMGROUP = 10, - VT_NEWROOMBINATTRINTERNAL = 12 - }; - const RoomDataInternal *newRoomDataInternal() const { - return GetPointer(VT_NEWROOMDATAINTERNAL); - } - uint32_t prevFlagAttr() const { - return GetField(VT_PREVFLAGATTR, 0); - } - uint64_t prevRoomPasswordSlotMask() const { - return GetField(VT_PREVROOMPASSWORDSLOTMASK, 0); - } - const ::flatbuffers::Vector *newRoomGroup() const { - return GetPointer *>(VT_NEWROOMGROUP); - } - const ::flatbuffers::Vector *newRoomBinAttrInternal() const { - return GetPointer *>(VT_NEWROOMBINATTRINTERNAL); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_NEWROOMDATAINTERNAL) && - verifier.VerifyTable(newRoomDataInternal()) && - VerifyField(verifier, VT_PREVFLAGATTR, 4) && - VerifyField(verifier, VT_PREVROOMPASSWORDSLOTMASK, 8) && - VerifyOffset(verifier, VT_NEWROOMGROUP) && - verifier.VerifyVector(newRoomGroup()) && - VerifyOffset(verifier, VT_NEWROOMBINATTRINTERNAL) && - verifier.VerifyVector(newRoomBinAttrInternal()) && - verifier.EndTable(); - } +struct RoomDataInternalUpdateInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RoomDataInternalUpdateInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_NEWROOMDATAINTERNAL = 4, + VT_PREVFLAGATTR = 6, + VT_PREVROOMPASSWORDSLOTMASK = 8, + VT_NEWROOMGROUP = 10, + VT_NEWROOMBINATTRINTERNAL = 12 + }; + const RoomDataInternal* newRoomDataInternal() const + { + return GetPointer(VT_NEWROOMDATAINTERNAL); + } + uint32_t prevFlagAttr() const + { + return GetField(VT_PREVFLAGATTR, 0); + } + uint64_t prevRoomPasswordSlotMask() const + { + return GetField(VT_PREVROOMPASSWORDSLOTMASK, 0); + } + const ::flatbuffers::Vector* newRoomGroup() const + { + return GetPointer*>(VT_NEWROOMGROUP); + } + const ::flatbuffers::Vector* newRoomBinAttrInternal() const + { + return GetPointer*>(VT_NEWROOMBINATTRINTERNAL); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_NEWROOMDATAINTERNAL) && + verifier.VerifyTable(newRoomDataInternal()) && + VerifyField(verifier, VT_PREVFLAGATTR, 4) && + VerifyField(verifier, VT_PREVROOMPASSWORDSLOTMASK, 8) && + VerifyOffset(verifier, VT_NEWROOMGROUP) && + verifier.VerifyVector(newRoomGroup()) && + VerifyOffset(verifier, VT_NEWROOMBINATTRINTERNAL) && + verifier.VerifyVector(newRoomBinAttrInternal()) && + verifier.EndTable(); + } }; -struct RoomDataInternalUpdateInfoBuilder { - typedef RoomDataInternalUpdateInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_newRoomDataInternal(::flatbuffers::Offset newRoomDataInternal) { - fbb_.AddOffset(RoomDataInternalUpdateInfo::VT_NEWROOMDATAINTERNAL, newRoomDataInternal); - } - void add_prevFlagAttr(uint32_t prevFlagAttr) { - fbb_.AddElement(RoomDataInternalUpdateInfo::VT_PREVFLAGATTR, prevFlagAttr, 0); - } - void add_prevRoomPasswordSlotMask(uint64_t prevRoomPasswordSlotMask) { - fbb_.AddElement(RoomDataInternalUpdateInfo::VT_PREVROOMPASSWORDSLOTMASK, prevRoomPasswordSlotMask, 0); - } - void add_newRoomGroup(::flatbuffers::Offset<::flatbuffers::Vector> newRoomGroup) { - fbb_.AddOffset(RoomDataInternalUpdateInfo::VT_NEWROOMGROUP, newRoomGroup); - } - void add_newRoomBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector> newRoomBinAttrInternal) { - fbb_.AddOffset(RoomDataInternalUpdateInfo::VT_NEWROOMBINATTRINTERNAL, newRoomBinAttrInternal); - } - explicit RoomDataInternalUpdateInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RoomDataInternalUpdateInfoBuilder +{ + typedef RoomDataInternalUpdateInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_newRoomDataInternal(::flatbuffers::Offset newRoomDataInternal) + { + fbb_.AddOffset(RoomDataInternalUpdateInfo::VT_NEWROOMDATAINTERNAL, newRoomDataInternal); + } + void add_prevFlagAttr(uint32_t prevFlagAttr) + { + fbb_.AddElement(RoomDataInternalUpdateInfo::VT_PREVFLAGATTR, prevFlagAttr, 0); + } + void add_prevRoomPasswordSlotMask(uint64_t prevRoomPasswordSlotMask) + { + fbb_.AddElement(RoomDataInternalUpdateInfo::VT_PREVROOMPASSWORDSLOTMASK, prevRoomPasswordSlotMask, 0); + } + void add_newRoomGroup(::flatbuffers::Offset<::flatbuffers::Vector> newRoomGroup) + { + fbb_.AddOffset(RoomDataInternalUpdateInfo::VT_NEWROOMGROUP, newRoomGroup); + } + void add_newRoomBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector> newRoomBinAttrInternal) + { + fbb_.AddOffset(RoomDataInternalUpdateInfo::VT_NEWROOMBINATTRINTERNAL, newRoomBinAttrInternal); + } + explicit RoomDataInternalUpdateInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRoomDataInternalUpdateInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset newRoomDataInternal = 0, - uint32_t prevFlagAttr = 0, - uint64_t prevRoomPasswordSlotMask = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> newRoomGroup = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> newRoomBinAttrInternal = 0) { - RoomDataInternalUpdateInfoBuilder builder_(_fbb); - builder_.add_prevRoomPasswordSlotMask(prevRoomPasswordSlotMask); - builder_.add_newRoomBinAttrInternal(newRoomBinAttrInternal); - builder_.add_newRoomGroup(newRoomGroup); - builder_.add_prevFlagAttr(prevFlagAttr); - builder_.add_newRoomDataInternal(newRoomDataInternal); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset newRoomDataInternal = 0, + uint32_t prevFlagAttr = 0, + uint64_t prevRoomPasswordSlotMask = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> newRoomGroup = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> newRoomBinAttrInternal = 0) +{ + RoomDataInternalUpdateInfoBuilder builder_(_fbb); + builder_.add_prevRoomPasswordSlotMask(prevRoomPasswordSlotMask); + builder_.add_newRoomBinAttrInternal(newRoomBinAttrInternal); + builder_.add_newRoomGroup(newRoomGroup); + builder_.add_prevFlagAttr(prevFlagAttr); + builder_.add_newRoomDataInternal(newRoomDataInternal); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateRoomDataInternalUpdateInfoDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset newRoomDataInternal = 0, - uint32_t prevFlagAttr = 0, - uint64_t prevRoomPasswordSlotMask = 0, - const std::vector *newRoomGroup = nullptr, - const std::vector *newRoomBinAttrInternal = nullptr) { - auto newRoomGroup__ = newRoomGroup ? _fbb.CreateVector(*newRoomGroup) : 0; - auto newRoomBinAttrInternal__ = newRoomBinAttrInternal ? _fbb.CreateVector(*newRoomBinAttrInternal) : 0; - return CreateRoomDataInternalUpdateInfo( - _fbb, - newRoomDataInternal, - prevFlagAttr, - prevRoomPasswordSlotMask, - newRoomGroup__, - newRoomBinAttrInternal__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset newRoomDataInternal = 0, + uint32_t prevFlagAttr = 0, + uint64_t prevRoomPasswordSlotMask = 0, + const std::vector* newRoomGroup = nullptr, + const std::vector* newRoomBinAttrInternal = nullptr) +{ + auto newRoomGroup__ = newRoomGroup ? _fbb.CreateVector(*newRoomGroup) : 0; + auto newRoomBinAttrInternal__ = newRoomBinAttrInternal ? _fbb.CreateVector(*newRoomBinAttrInternal) : 0; + return CreateRoomDataInternalUpdateInfo( + _fbb, + newRoomDataInternal, + prevFlagAttr, + prevRoomPasswordSlotMask, + newRoomGroup__, + newRoomBinAttrInternal__); } -struct RoomMemberDataInternalUpdateInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RoomMemberDataInternalUpdateInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NEWROOMMEMBERDATAINTERNAL = 4, - VT_PREVFLAGATTR = 6, - VT_PREVTEAMID = 8, - VT_NEWROOMMEMBERBINATTRINTERNAL = 10 - }; - const RoomMemberDataInternal *newRoomMemberDataInternal() const { - return GetPointer(VT_NEWROOMMEMBERDATAINTERNAL); - } - uint32_t prevFlagAttr() const { - return GetField(VT_PREVFLAGATTR, 0); - } - uint8_t prevTeamId() const { - return GetField(VT_PREVTEAMID, 0); - } - const ::flatbuffers::Vector *newRoomMemberBinAttrInternal() const { - return GetPointer *>(VT_NEWROOMMEMBERBINATTRINTERNAL); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_NEWROOMMEMBERDATAINTERNAL) && - verifier.VerifyTable(newRoomMemberDataInternal()) && - VerifyField(verifier, VT_PREVFLAGATTR, 4) && - VerifyField(verifier, VT_PREVTEAMID, 1) && - VerifyOffset(verifier, VT_NEWROOMMEMBERBINATTRINTERNAL) && - verifier.VerifyVector(newRoomMemberBinAttrInternal()) && - verifier.EndTable(); - } +struct RoomMemberDataInternalUpdateInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RoomMemberDataInternalUpdateInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_NEWROOMMEMBERDATAINTERNAL = 4, + VT_PREVFLAGATTR = 6, + VT_PREVTEAMID = 8, + VT_NEWROOMMEMBERBINATTRINTERNAL = 10 + }; + const RoomMemberDataInternal* newRoomMemberDataInternal() const + { + return GetPointer(VT_NEWROOMMEMBERDATAINTERNAL); + } + uint32_t prevFlagAttr() const + { + return GetField(VT_PREVFLAGATTR, 0); + } + uint8_t prevTeamId() const + { + return GetField(VT_PREVTEAMID, 0); + } + const ::flatbuffers::Vector* newRoomMemberBinAttrInternal() const + { + return GetPointer*>(VT_NEWROOMMEMBERBINATTRINTERNAL); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_NEWROOMMEMBERDATAINTERNAL) && + verifier.VerifyTable(newRoomMemberDataInternal()) && + VerifyField(verifier, VT_PREVFLAGATTR, 4) && + VerifyField(verifier, VT_PREVTEAMID, 1) && + VerifyOffset(verifier, VT_NEWROOMMEMBERBINATTRINTERNAL) && + verifier.VerifyVector(newRoomMemberBinAttrInternal()) && + verifier.EndTable(); + } }; -struct RoomMemberDataInternalUpdateInfoBuilder { - typedef RoomMemberDataInternalUpdateInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_newRoomMemberDataInternal(::flatbuffers::Offset newRoomMemberDataInternal) { - fbb_.AddOffset(RoomMemberDataInternalUpdateInfo::VT_NEWROOMMEMBERDATAINTERNAL, newRoomMemberDataInternal); - } - void add_prevFlagAttr(uint32_t prevFlagAttr) { - fbb_.AddElement(RoomMemberDataInternalUpdateInfo::VT_PREVFLAGATTR, prevFlagAttr, 0); - } - void add_prevTeamId(uint8_t prevTeamId) { - fbb_.AddElement(RoomMemberDataInternalUpdateInfo::VT_PREVTEAMID, prevTeamId, 0); - } - void add_newRoomMemberBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector> newRoomMemberBinAttrInternal) { - fbb_.AddOffset(RoomMemberDataInternalUpdateInfo::VT_NEWROOMMEMBERBINATTRINTERNAL, newRoomMemberBinAttrInternal); - } - explicit RoomMemberDataInternalUpdateInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RoomMemberDataInternalUpdateInfoBuilder +{ + typedef RoomMemberDataInternalUpdateInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_newRoomMemberDataInternal(::flatbuffers::Offset newRoomMemberDataInternal) + { + fbb_.AddOffset(RoomMemberDataInternalUpdateInfo::VT_NEWROOMMEMBERDATAINTERNAL, newRoomMemberDataInternal); + } + void add_prevFlagAttr(uint32_t prevFlagAttr) + { + fbb_.AddElement(RoomMemberDataInternalUpdateInfo::VT_PREVFLAGATTR, prevFlagAttr, 0); + } + void add_prevTeamId(uint8_t prevTeamId) + { + fbb_.AddElement(RoomMemberDataInternalUpdateInfo::VT_PREVTEAMID, prevTeamId, 0); + } + void add_newRoomMemberBinAttrInternal(::flatbuffers::Offset<::flatbuffers::Vector> newRoomMemberBinAttrInternal) + { + fbb_.AddOffset(RoomMemberDataInternalUpdateInfo::VT_NEWROOMMEMBERBINATTRINTERNAL, newRoomMemberBinAttrInternal); + } + explicit RoomMemberDataInternalUpdateInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRoomMemberDataInternalUpdateInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset newRoomMemberDataInternal = 0, - uint32_t prevFlagAttr = 0, - uint8_t prevTeamId = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> newRoomMemberBinAttrInternal = 0) { - RoomMemberDataInternalUpdateInfoBuilder builder_(_fbb); - builder_.add_newRoomMemberBinAttrInternal(newRoomMemberBinAttrInternal); - builder_.add_prevFlagAttr(prevFlagAttr); - builder_.add_newRoomMemberDataInternal(newRoomMemberDataInternal); - builder_.add_prevTeamId(prevTeamId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset newRoomMemberDataInternal = 0, + uint32_t prevFlagAttr = 0, + uint8_t prevTeamId = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> newRoomMemberBinAttrInternal = 0) +{ + RoomMemberDataInternalUpdateInfoBuilder builder_(_fbb); + builder_.add_newRoomMemberBinAttrInternal(newRoomMemberBinAttrInternal); + builder_.add_prevFlagAttr(prevFlagAttr); + builder_.add_newRoomMemberDataInternal(newRoomMemberDataInternal); + builder_.add_prevTeamId(prevTeamId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateRoomMemberDataInternalUpdateInfoDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset newRoomMemberDataInternal = 0, - uint32_t prevFlagAttr = 0, - uint8_t prevTeamId = 0, - const std::vector *newRoomMemberBinAttrInternal = nullptr) { - auto newRoomMemberBinAttrInternal__ = newRoomMemberBinAttrInternal ? _fbb.CreateVector(*newRoomMemberBinAttrInternal) : 0; - return CreateRoomMemberDataInternalUpdateInfo( - _fbb, - newRoomMemberDataInternal, - prevFlagAttr, - prevTeamId, - newRoomMemberBinAttrInternal__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset newRoomMemberDataInternal = 0, + uint32_t prevFlagAttr = 0, + uint8_t prevTeamId = 0, + const std::vector* newRoomMemberBinAttrInternal = nullptr) +{ + auto newRoomMemberBinAttrInternal__ = newRoomMemberBinAttrInternal ? _fbb.CreateVector(*newRoomMemberBinAttrInternal) : 0; + return CreateRoomMemberDataInternalUpdateInfo( + _fbb, + newRoomMemberDataInternal, + prevFlagAttr, + prevTeamId, + newRoomMemberBinAttrInternal__); } -struct GetPingInfoResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GetPingInfoResponseBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SERVERID = 4, - VT_WORLDID = 6, - VT_ROOMID = 8, - VT_RTT = 10 - }; - uint16_t serverId() const { - return GetField(VT_SERVERID, 0); - } - uint32_t worldId() const { - return GetField(VT_WORLDID, 0); - } - uint64_t roomId() const { - return GetField(VT_ROOMID, 0); - } - uint32_t rtt() const { - return GetField(VT_RTT, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_SERVERID, 2) && - VerifyField(verifier, VT_WORLDID, 4) && - VerifyField(verifier, VT_ROOMID, 8) && - VerifyField(verifier, VT_RTT, 4) && - verifier.EndTable(); - } +struct GetPingInfoResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GetPingInfoResponseBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_SERVERID = 4, + VT_WORLDID = 6, + VT_ROOMID = 8, + VT_RTT = 10 + }; + uint16_t serverId() const + { + return GetField(VT_SERVERID, 0); + } + uint32_t worldId() const + { + return GetField(VT_WORLDID, 0); + } + uint64_t roomId() const + { + return GetField(VT_ROOMID, 0); + } + uint32_t rtt() const + { + return GetField(VT_RTT, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_SERVERID, 2) && + VerifyField(verifier, VT_WORLDID, 4) && + VerifyField(verifier, VT_ROOMID, 8) && + VerifyField(verifier, VT_RTT, 4) && + verifier.EndTable(); + } }; -struct GetPingInfoResponseBuilder { - typedef GetPingInfoResponse Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_serverId(uint16_t serverId) { - fbb_.AddElement(GetPingInfoResponse::VT_SERVERID, serverId, 0); - } - void add_worldId(uint32_t worldId) { - fbb_.AddElement(GetPingInfoResponse::VT_WORLDID, worldId, 0); - } - void add_roomId(uint64_t roomId) { - fbb_.AddElement(GetPingInfoResponse::VT_ROOMID, roomId, 0); - } - void add_rtt(uint32_t rtt) { - fbb_.AddElement(GetPingInfoResponse::VT_RTT, rtt, 0); - } - explicit GetPingInfoResponseBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GetPingInfoResponseBuilder +{ + typedef GetPingInfoResponse Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_serverId(uint16_t serverId) + { + fbb_.AddElement(GetPingInfoResponse::VT_SERVERID, serverId, 0); + } + void add_worldId(uint32_t worldId) + { + fbb_.AddElement(GetPingInfoResponse::VT_WORLDID, worldId, 0); + } + void add_roomId(uint64_t roomId) + { + fbb_.AddElement(GetPingInfoResponse::VT_ROOMID, roomId, 0); + } + void add_rtt(uint32_t rtt) + { + fbb_.AddElement(GetPingInfoResponse::VT_RTT, rtt, 0); + } + explicit GetPingInfoResponseBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGetPingInfoResponse( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint16_t serverId = 0, - uint32_t worldId = 0, - uint64_t roomId = 0, - uint32_t rtt = 0) { - GetPingInfoResponseBuilder builder_(_fbb); - builder_.add_roomId(roomId); - builder_.add_rtt(rtt); - builder_.add_worldId(worldId); - builder_.add_serverId(serverId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint16_t serverId = 0, + uint32_t worldId = 0, + uint64_t roomId = 0, + uint32_t rtt = 0) +{ + GetPingInfoResponseBuilder builder_(_fbb); + builder_.add_roomId(roomId); + builder_.add_rtt(rtt); + builder_.add_worldId(worldId); + builder_.add_serverId(serverId); + return builder_.Finish(); } -struct SendRoomMessageRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef SendRoomMessageRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOMID = 4, - VT_CASTTYPE = 6, - VT_DST = 8, - VT_MSG = 10, - VT_OPTION = 12 - }; - uint64_t roomId() const { - return GetField(VT_ROOMID, 0); - } - uint8_t castType() const { - return GetField(VT_CASTTYPE, 0); - } - const ::flatbuffers::Vector *dst() const { - return GetPointer *>(VT_DST); - } - const ::flatbuffers::Vector *msg() const { - return GetPointer *>(VT_MSG); - } - uint8_t option() const { - return GetField(VT_OPTION, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ROOMID, 8) && - VerifyField(verifier, VT_CASTTYPE, 1) && - VerifyOffset(verifier, VT_DST) && - verifier.VerifyVector(dst()) && - VerifyOffset(verifier, VT_MSG) && - verifier.VerifyVector(msg()) && - VerifyField(verifier, VT_OPTION, 1) && - verifier.EndTable(); - } +struct SendRoomMessageRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef SendRoomMessageRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOMID = 4, + VT_CASTTYPE = 6, + VT_DST = 8, + VT_MSG = 10, + VT_OPTION = 12 + }; + uint64_t roomId() const + { + return GetField(VT_ROOMID, 0); + } + uint8_t castType() const + { + return GetField(VT_CASTTYPE, 0); + } + const ::flatbuffers::Vector* dst() const + { + return GetPointer*>(VT_DST); + } + const ::flatbuffers::Vector* msg() const + { + return GetPointer*>(VT_MSG); + } + uint8_t option() const + { + return GetField(VT_OPTION, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ROOMID, 8) && + VerifyField(verifier, VT_CASTTYPE, 1) && + VerifyOffset(verifier, VT_DST) && + verifier.VerifyVector(dst()) && + VerifyOffset(verifier, VT_MSG) && + verifier.VerifyVector(msg()) && + VerifyField(verifier, VT_OPTION, 1) && + verifier.EndTable(); + } }; -struct SendRoomMessageRequestBuilder { - typedef SendRoomMessageRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_roomId(uint64_t roomId) { - fbb_.AddElement(SendRoomMessageRequest::VT_ROOMID, roomId, 0); - } - void add_castType(uint8_t castType) { - fbb_.AddElement(SendRoomMessageRequest::VT_CASTTYPE, castType, 0); - } - void add_dst(::flatbuffers::Offset<::flatbuffers::Vector> dst) { - fbb_.AddOffset(SendRoomMessageRequest::VT_DST, dst); - } - void add_msg(::flatbuffers::Offset<::flatbuffers::Vector> msg) { - fbb_.AddOffset(SendRoomMessageRequest::VT_MSG, msg); - } - void add_option(uint8_t option) { - fbb_.AddElement(SendRoomMessageRequest::VT_OPTION, option, 0); - } - explicit SendRoomMessageRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct SendRoomMessageRequestBuilder +{ + typedef SendRoomMessageRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_roomId(uint64_t roomId) + { + fbb_.AddElement(SendRoomMessageRequest::VT_ROOMID, roomId, 0); + } + void add_castType(uint8_t castType) + { + fbb_.AddElement(SendRoomMessageRequest::VT_CASTTYPE, castType, 0); + } + void add_dst(::flatbuffers::Offset<::flatbuffers::Vector> dst) + { + fbb_.AddOffset(SendRoomMessageRequest::VT_DST, dst); + } + void add_msg(::flatbuffers::Offset<::flatbuffers::Vector> msg) + { + fbb_.AddOffset(SendRoomMessageRequest::VT_MSG, msg); + } + void add_option(uint8_t option) + { + fbb_.AddElement(SendRoomMessageRequest::VT_OPTION, option, 0); + } + explicit SendRoomMessageRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateSendRoomMessageRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - uint8_t castType = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> dst = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> msg = 0, - uint8_t option = 0) { - SendRoomMessageRequestBuilder builder_(_fbb); - builder_.add_roomId(roomId); - builder_.add_msg(msg); - builder_.add_dst(dst); - builder_.add_option(option); - builder_.add_castType(castType); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + uint8_t castType = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> dst = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> msg = 0, + uint8_t option = 0) +{ + SendRoomMessageRequestBuilder builder_(_fbb); + builder_.add_roomId(roomId); + builder_.add_msg(msg); + builder_.add_dst(dst); + builder_.add_option(option); + builder_.add_castType(castType); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateSendRoomMessageRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint64_t roomId = 0, - uint8_t castType = 0, - const std::vector *dst = nullptr, - const std::vector *msg = nullptr, - uint8_t option = 0) { - auto dst__ = dst ? _fbb.CreateVector(*dst) : 0; - auto msg__ = msg ? _fbb.CreateVector(*msg) : 0; - return CreateSendRoomMessageRequest( - _fbb, - roomId, - castType, - dst__, - msg__, - option); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint64_t roomId = 0, + uint8_t castType = 0, + const std::vector* dst = nullptr, + const std::vector* msg = nullptr, + uint8_t option = 0) +{ + auto dst__ = dst ? _fbb.CreateVector(*dst) : 0; + auto msg__ = msg ? _fbb.CreateVector(*msg) : 0; + return CreateSendRoomMessageRequest( + _fbb, + roomId, + castType, + dst__, + msg__, + option); } -struct RoomMessageInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RoomMessageInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_FILTERED = 4, - VT_CASTTYPE = 6, - VT_DST = 8, - VT_SRCMEMBER = 10, - VT_MSG = 12 - }; - bool filtered() const { - return GetField(VT_FILTERED, 0) != 0; - } - uint8_t castType() const { - return GetField(VT_CASTTYPE, 0); - } - const ::flatbuffers::Vector *dst() const { - return GetPointer *>(VT_DST); - } - const UserInfo *srcMember() const { - return GetPointer(VT_SRCMEMBER); - } - const ::flatbuffers::Vector *msg() const { - return GetPointer *>(VT_MSG); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_FILTERED, 1) && - VerifyField(verifier, VT_CASTTYPE, 1) && - VerifyOffset(verifier, VT_DST) && - verifier.VerifyVector(dst()) && - VerifyOffset(verifier, VT_SRCMEMBER) && - verifier.VerifyTable(srcMember()) && - VerifyOffset(verifier, VT_MSG) && - verifier.VerifyVector(msg()) && - verifier.EndTable(); - } +struct RoomMessageInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RoomMessageInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_FILTERED = 4, + VT_CASTTYPE = 6, + VT_DST = 8, + VT_SRCMEMBER = 10, + VT_MSG = 12 + }; + bool filtered() const + { + return GetField(VT_FILTERED, 0) != 0; + } + uint8_t castType() const + { + return GetField(VT_CASTTYPE, 0); + } + const ::flatbuffers::Vector* dst() const + { + return GetPointer*>(VT_DST); + } + const UserInfo* srcMember() const + { + return GetPointer(VT_SRCMEMBER); + } + const ::flatbuffers::Vector* msg() const + { + return GetPointer*>(VT_MSG); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_FILTERED, 1) && + VerifyField(verifier, VT_CASTTYPE, 1) && + VerifyOffset(verifier, VT_DST) && + verifier.VerifyVector(dst()) && + VerifyOffset(verifier, VT_SRCMEMBER) && + verifier.VerifyTable(srcMember()) && + VerifyOffset(verifier, VT_MSG) && + verifier.VerifyVector(msg()) && + verifier.EndTable(); + } }; -struct RoomMessageInfoBuilder { - typedef RoomMessageInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_filtered(bool filtered) { - fbb_.AddElement(RoomMessageInfo::VT_FILTERED, static_cast(filtered), 0); - } - void add_castType(uint8_t castType) { - fbb_.AddElement(RoomMessageInfo::VT_CASTTYPE, castType, 0); - } - void add_dst(::flatbuffers::Offset<::flatbuffers::Vector> dst) { - fbb_.AddOffset(RoomMessageInfo::VT_DST, dst); - } - void add_srcMember(::flatbuffers::Offset srcMember) { - fbb_.AddOffset(RoomMessageInfo::VT_SRCMEMBER, srcMember); - } - void add_msg(::flatbuffers::Offset<::flatbuffers::Vector> msg) { - fbb_.AddOffset(RoomMessageInfo::VT_MSG, msg); - } - explicit RoomMessageInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RoomMessageInfoBuilder +{ + typedef RoomMessageInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_filtered(bool filtered) + { + fbb_.AddElement(RoomMessageInfo::VT_FILTERED, static_cast(filtered), 0); + } + void add_castType(uint8_t castType) + { + fbb_.AddElement(RoomMessageInfo::VT_CASTTYPE, castType, 0); + } + void add_dst(::flatbuffers::Offset<::flatbuffers::Vector> dst) + { + fbb_.AddOffset(RoomMessageInfo::VT_DST, dst); + } + void add_srcMember(::flatbuffers::Offset srcMember) + { + fbb_.AddOffset(RoomMessageInfo::VT_SRCMEMBER, srcMember); + } + void add_msg(::flatbuffers::Offset<::flatbuffers::Vector> msg) + { + fbb_.AddOffset(RoomMessageInfo::VT_MSG, msg); + } + explicit RoomMessageInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRoomMessageInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - bool filtered = false, - uint8_t castType = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> dst = 0, - ::flatbuffers::Offset srcMember = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> msg = 0) { - RoomMessageInfoBuilder builder_(_fbb); - builder_.add_msg(msg); - builder_.add_srcMember(srcMember); - builder_.add_dst(dst); - builder_.add_castType(castType); - builder_.add_filtered(filtered); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + bool filtered = false, + uint8_t castType = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> dst = 0, + ::flatbuffers::Offset srcMember = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> msg = 0) +{ + RoomMessageInfoBuilder builder_(_fbb); + builder_.add_msg(msg); + builder_.add_srcMember(srcMember); + builder_.add_dst(dst); + builder_.add_castType(castType); + builder_.add_filtered(filtered); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateRoomMessageInfoDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - bool filtered = false, - uint8_t castType = 0, - const std::vector *dst = nullptr, - ::flatbuffers::Offset srcMember = 0, - const std::vector *msg = nullptr) { - auto dst__ = dst ? _fbb.CreateVector(*dst) : 0; - auto msg__ = msg ? _fbb.CreateVector(*msg) : 0; - return CreateRoomMessageInfo( - _fbb, - filtered, - castType, - dst__, - srcMember, - msg__); + ::flatbuffers::FlatBufferBuilder& _fbb, + bool filtered = false, + uint8_t castType = 0, + const std::vector* dst = nullptr, + ::flatbuffers::Offset srcMember = 0, + const std::vector* msg = nullptr) +{ + auto dst__ = dst ? _fbb.CreateVector(*dst) : 0; + auto msg__ = msg ? _fbb.CreateVector(*msg) : 0; + return CreateRoomMessageInfo( + _fbb, + filtered, + castType, + dst__, + srcMember, + msg__); } -struct MessageDetails FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef MessageDetailsBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_COMMUNICATIONID = 4, - VT_MSGID = 6, - VT_MAINTYPE = 8, - VT_SUBTYPE = 10, - VT_MSGFEATURES = 12, - VT_SUBJECT = 14, - VT_BODY = 16, - VT_DATA = 18 - }; - const ::flatbuffers::String *communicationId() const { - return GetPointer(VT_COMMUNICATIONID); - } - uint64_t msgId() const { - return GetField(VT_MSGID, 0); - } - uint16_t mainType() const { - return GetField(VT_MAINTYPE, 0); - } - uint16_t subType() const { - return GetField(VT_SUBTYPE, 0); - } - uint32_t msgFeatures() const { - return GetField(VT_MSGFEATURES, 0); - } - const ::flatbuffers::String *subject() const { - return GetPointer(VT_SUBJECT); - } - const ::flatbuffers::String *body() const { - return GetPointer(VT_BODY); - } - const ::flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_COMMUNICATIONID) && - verifier.VerifyString(communicationId()) && - VerifyField(verifier, VT_MSGID, 8) && - VerifyField(verifier, VT_MAINTYPE, 2) && - VerifyField(verifier, VT_SUBTYPE, 2) && - VerifyField(verifier, VT_MSGFEATURES, 4) && - VerifyOffset(verifier, VT_SUBJECT) && - verifier.VerifyString(subject()) && - VerifyOffset(verifier, VT_BODY) && - verifier.VerifyString(body()) && - VerifyOffset(verifier, VT_DATA) && - verifier.VerifyVector(data()) && - verifier.EndTable(); - } +struct MessageDetails FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef MessageDetailsBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_COMMUNICATIONID = 4, + VT_MSGID = 6, + VT_MAINTYPE = 8, + VT_SUBTYPE = 10, + VT_MSGFEATURES = 12, + VT_SUBJECT = 14, + VT_BODY = 16, + VT_DATA = 18 + }; + const ::flatbuffers::String* communicationId() const + { + return GetPointer(VT_COMMUNICATIONID); + } + uint64_t msgId() const + { + return GetField(VT_MSGID, 0); + } + uint16_t mainType() const + { + return GetField(VT_MAINTYPE, 0); + } + uint16_t subType() const + { + return GetField(VT_SUBTYPE, 0); + } + uint32_t msgFeatures() const + { + return GetField(VT_MSGFEATURES, 0); + } + const ::flatbuffers::String* subject() const + { + return GetPointer(VT_SUBJECT); + } + const ::flatbuffers::String* body() const + { + return GetPointer(VT_BODY); + } + const ::flatbuffers::Vector* data() const + { + return GetPointer*>(VT_DATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_COMMUNICATIONID) && + verifier.VerifyString(communicationId()) && + VerifyField(verifier, VT_MSGID, 8) && + VerifyField(verifier, VT_MAINTYPE, 2) && + VerifyField(verifier, VT_SUBTYPE, 2) && + VerifyField(verifier, VT_MSGFEATURES, 4) && + VerifyOffset(verifier, VT_SUBJECT) && + verifier.VerifyString(subject()) && + VerifyOffset(verifier, VT_BODY) && + verifier.VerifyString(body()) && + VerifyOffset(verifier, VT_DATA) && + verifier.VerifyVector(data()) && + verifier.EndTable(); + } }; -struct MessageDetailsBuilder { - typedef MessageDetails Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_communicationId(::flatbuffers::Offset<::flatbuffers::String> communicationId) { - fbb_.AddOffset(MessageDetails::VT_COMMUNICATIONID, communicationId); - } - void add_msgId(uint64_t msgId) { - fbb_.AddElement(MessageDetails::VT_MSGID, msgId, 0); - } - void add_mainType(uint16_t mainType) { - fbb_.AddElement(MessageDetails::VT_MAINTYPE, mainType, 0); - } - void add_subType(uint16_t subType) { - fbb_.AddElement(MessageDetails::VT_SUBTYPE, subType, 0); - } - void add_msgFeatures(uint32_t msgFeatures) { - fbb_.AddElement(MessageDetails::VT_MSGFEATURES, msgFeatures, 0); - } - void add_subject(::flatbuffers::Offset<::flatbuffers::String> subject) { - fbb_.AddOffset(MessageDetails::VT_SUBJECT, subject); - } - void add_body(::flatbuffers::Offset<::flatbuffers::String> body) { - fbb_.AddOffset(MessageDetails::VT_BODY, body); - } - void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { - fbb_.AddOffset(MessageDetails::VT_DATA, data); - } - explicit MessageDetailsBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct MessageDetailsBuilder +{ + typedef MessageDetails Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_communicationId(::flatbuffers::Offset<::flatbuffers::String> communicationId) + { + fbb_.AddOffset(MessageDetails::VT_COMMUNICATIONID, communicationId); + } + void add_msgId(uint64_t msgId) + { + fbb_.AddElement(MessageDetails::VT_MSGID, msgId, 0); + } + void add_mainType(uint16_t mainType) + { + fbb_.AddElement(MessageDetails::VT_MAINTYPE, mainType, 0); + } + void add_subType(uint16_t subType) + { + fbb_.AddElement(MessageDetails::VT_SUBTYPE, subType, 0); + } + void add_msgFeatures(uint32_t msgFeatures) + { + fbb_.AddElement(MessageDetails::VT_MSGFEATURES, msgFeatures, 0); + } + void add_subject(::flatbuffers::Offset<::flatbuffers::String> subject) + { + fbb_.AddOffset(MessageDetails::VT_SUBJECT, subject); + } + void add_body(::flatbuffers::Offset<::flatbuffers::String> body) + { + fbb_.AddOffset(MessageDetails::VT_BODY, body); + } + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) + { + fbb_.AddOffset(MessageDetails::VT_DATA, data); + } + explicit MessageDetailsBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateMessageDetails( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::String> communicationId = 0, - uint64_t msgId = 0, - uint16_t mainType = 0, - uint16_t subType = 0, - uint32_t msgFeatures = 0, - ::flatbuffers::Offset<::flatbuffers::String> subject = 0, - ::flatbuffers::Offset<::flatbuffers::String> body = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) { - MessageDetailsBuilder builder_(_fbb); - builder_.add_msgId(msgId); - builder_.add_data(data); - builder_.add_body(body); - builder_.add_subject(subject); - builder_.add_msgFeatures(msgFeatures); - builder_.add_communicationId(communicationId); - builder_.add_subType(subType); - builder_.add_mainType(mainType); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::String> communicationId = 0, + uint64_t msgId = 0, + uint16_t mainType = 0, + uint16_t subType = 0, + uint32_t msgFeatures = 0, + ::flatbuffers::Offset<::flatbuffers::String> subject = 0, + ::flatbuffers::Offset<::flatbuffers::String> body = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) +{ + MessageDetailsBuilder builder_(_fbb); + builder_.add_msgId(msgId); + builder_.add_data(data); + builder_.add_body(body); + builder_.add_subject(subject); + builder_.add_msgFeatures(msgFeatures); + builder_.add_communicationId(communicationId); + builder_.add_subType(subType); + builder_.add_mainType(mainType); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateMessageDetailsDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const char *communicationId = nullptr, - uint64_t msgId = 0, - uint16_t mainType = 0, - uint16_t subType = 0, - uint32_t msgFeatures = 0, - const char *subject = nullptr, - const char *body = nullptr, - const std::vector *data = nullptr) { - auto communicationId__ = communicationId ? _fbb.CreateString(communicationId) : 0; - auto subject__ = subject ? _fbb.CreateString(subject) : 0; - auto body__ = body ? _fbb.CreateString(body) : 0; - auto data__ = data ? _fbb.CreateVector(*data) : 0; - return CreateMessageDetails( - _fbb, - communicationId__, - msgId, - mainType, - subType, - msgFeatures, - subject__, - body__, - data__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const char* communicationId = nullptr, + uint64_t msgId = 0, + uint16_t mainType = 0, + uint16_t subType = 0, + uint32_t msgFeatures = 0, + const char* subject = nullptr, + const char* body = nullptr, + const std::vector* data = nullptr) +{ + auto communicationId__ = communicationId ? _fbb.CreateString(communicationId) : 0; + auto subject__ = subject ? _fbb.CreateString(subject) : 0; + auto body__ = body ? _fbb.CreateString(body) : 0; + auto data__ = data ? _fbb.CreateVector(*data) : 0; + return CreateMessageDetails( + _fbb, + communicationId__, + msgId, + mainType, + subType, + msgFeatures, + subject__, + body__, + data__); } -struct SendMessageRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef SendMessageRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_MESSAGE = 4, - VT_NPIDS = 6 - }; - const ::flatbuffers::Vector *message() const { - return GetPointer *>(VT_MESSAGE); - } - const MessageDetails *message_nested_root() const { - const auto _f = message(); - return _f ? ::flatbuffers::GetRoot(_f->Data()) - : nullptr; - } - const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *npids() const { - return GetPointer> *>(VT_NPIDS); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_MESSAGE) && - verifier.VerifyVector(message()) && - verifier.VerifyNestedFlatBuffer(message(), nullptr) && - VerifyOffset(verifier, VT_NPIDS) && - verifier.VerifyVector(npids()) && - verifier.VerifyVectorOfStrings(npids()) && - verifier.EndTable(); - } +struct SendMessageRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef SendMessageRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_MESSAGE = 4, + VT_NPIDS = 6 + }; + const ::flatbuffers::Vector* message() const + { + return GetPointer*>(VT_MESSAGE); + } + const MessageDetails* message_nested_root() const + { + const auto _f = message(); + return _f ? ::flatbuffers::GetRoot(_f->Data()) : nullptr; + } + const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>* npids() const + { + return GetPointer>*>(VT_NPIDS); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_MESSAGE) && + verifier.VerifyVector(message()) && + verifier.VerifyNestedFlatBuffer(message(), nullptr) && + VerifyOffset(verifier, VT_NPIDS) && + verifier.VerifyVector(npids()) && + verifier.VerifyVectorOfStrings(npids()) && + verifier.EndTable(); + } }; -struct SendMessageRequestBuilder { - typedef SendMessageRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_message(::flatbuffers::Offset<::flatbuffers::Vector> message) { - fbb_.AddOffset(SendMessageRequest::VT_MESSAGE, message); - } - void add_npids(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> npids) { - fbb_.AddOffset(SendMessageRequest::VT_NPIDS, npids); - } - explicit SendMessageRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct SendMessageRequestBuilder +{ + typedef SendMessageRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_message(::flatbuffers::Offset<::flatbuffers::Vector> message) + { + fbb_.AddOffset(SendMessageRequest::VT_MESSAGE, message); + } + void add_npids(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> npids) + { + fbb_.AddOffset(SendMessageRequest::VT_NPIDS, npids); + } + explicit SendMessageRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateSendMessageRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector> message = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> npids = 0) { - SendMessageRequestBuilder builder_(_fbb); - builder_.add_npids(npids); - builder_.add_message(message); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> message = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> npids = 0) +{ + SendMessageRequestBuilder builder_(_fbb); + builder_.add_npids(npids); + builder_.add_message(message); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateSendMessageRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *message = nullptr, - const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *npids = nullptr) { - auto message__ = message ? _fbb.CreateVector(*message) : 0; - auto npids__ = npids ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*npids) : 0; - return CreateSendMessageRequest( - _fbb, - message__, - npids__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector* message = nullptr, + const std::vector<::flatbuffers::Offset<::flatbuffers::String>>* npids = nullptr) +{ + auto message__ = message ? _fbb.CreateVector(*message) : 0; + auto npids__ = npids ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*npids) : 0; + return CreateSendMessageRequest( + _fbb, + message__, + npids__); } -struct BoardInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef BoardInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_RANKLIMIT = 4, - VT_UPDATEMODE = 6, - VT_SORTMODE = 8, - VT_UPLOADNUMLIMIT = 10, - VT_UPLOADSIZELIMIT = 12 - }; - uint32_t rankLimit() const { - return GetField(VT_RANKLIMIT, 0); - } - uint32_t updateMode() const { - return GetField(VT_UPDATEMODE, 0); - } - uint32_t sortMode() const { - return GetField(VT_SORTMODE, 0); - } - uint32_t uploadNumLimit() const { - return GetField(VT_UPLOADNUMLIMIT, 0); - } - uint32_t uploadSizeLimit() const { - return GetField(VT_UPLOADSIZELIMIT, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_RANKLIMIT, 4) && - VerifyField(verifier, VT_UPDATEMODE, 4) && - VerifyField(verifier, VT_SORTMODE, 4) && - VerifyField(verifier, VT_UPLOADNUMLIMIT, 4) && - VerifyField(verifier, VT_UPLOADSIZELIMIT, 4) && - verifier.EndTable(); - } +struct BoardInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef BoardInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_RANKLIMIT = 4, + VT_UPDATEMODE = 6, + VT_SORTMODE = 8, + VT_UPLOADNUMLIMIT = 10, + VT_UPLOADSIZELIMIT = 12 + }; + uint32_t rankLimit() const + { + return GetField(VT_RANKLIMIT, 0); + } + uint32_t updateMode() const + { + return GetField(VT_UPDATEMODE, 0); + } + uint32_t sortMode() const + { + return GetField(VT_SORTMODE, 0); + } + uint32_t uploadNumLimit() const + { + return GetField(VT_UPLOADNUMLIMIT, 0); + } + uint32_t uploadSizeLimit() const + { + return GetField(VT_UPLOADSIZELIMIT, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_RANKLIMIT, 4) && + VerifyField(verifier, VT_UPDATEMODE, 4) && + VerifyField(verifier, VT_SORTMODE, 4) && + VerifyField(verifier, VT_UPLOADNUMLIMIT, 4) && + VerifyField(verifier, VT_UPLOADSIZELIMIT, 4) && + verifier.EndTable(); + } }; -struct BoardInfoBuilder { - typedef BoardInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_rankLimit(uint32_t rankLimit) { - fbb_.AddElement(BoardInfo::VT_RANKLIMIT, rankLimit, 0); - } - void add_updateMode(uint32_t updateMode) { - fbb_.AddElement(BoardInfo::VT_UPDATEMODE, updateMode, 0); - } - void add_sortMode(uint32_t sortMode) { - fbb_.AddElement(BoardInfo::VT_SORTMODE, sortMode, 0); - } - void add_uploadNumLimit(uint32_t uploadNumLimit) { - fbb_.AddElement(BoardInfo::VT_UPLOADNUMLIMIT, uploadNumLimit, 0); - } - void add_uploadSizeLimit(uint32_t uploadSizeLimit) { - fbb_.AddElement(BoardInfo::VT_UPLOADSIZELIMIT, uploadSizeLimit, 0); - } - explicit BoardInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct BoardInfoBuilder +{ + typedef BoardInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_rankLimit(uint32_t rankLimit) + { + fbb_.AddElement(BoardInfo::VT_RANKLIMIT, rankLimit, 0); + } + void add_updateMode(uint32_t updateMode) + { + fbb_.AddElement(BoardInfo::VT_UPDATEMODE, updateMode, 0); + } + void add_sortMode(uint32_t sortMode) + { + fbb_.AddElement(BoardInfo::VT_SORTMODE, sortMode, 0); + } + void add_uploadNumLimit(uint32_t uploadNumLimit) + { + fbb_.AddElement(BoardInfo::VT_UPLOADNUMLIMIT, uploadNumLimit, 0); + } + void add_uploadSizeLimit(uint32_t uploadSizeLimit) + { + fbb_.AddElement(BoardInfo::VT_UPLOADSIZELIMIT, uploadSizeLimit, 0); + } + explicit BoardInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateBoardInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t rankLimit = 0, - uint32_t updateMode = 0, - uint32_t sortMode = 0, - uint32_t uploadNumLimit = 0, - uint32_t uploadSizeLimit = 0) { - BoardInfoBuilder builder_(_fbb); - builder_.add_uploadSizeLimit(uploadSizeLimit); - builder_.add_uploadNumLimit(uploadNumLimit); - builder_.add_sortMode(sortMode); - builder_.add_updateMode(updateMode); - builder_.add_rankLimit(rankLimit); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t rankLimit = 0, + uint32_t updateMode = 0, + uint32_t sortMode = 0, + uint32_t uploadNumLimit = 0, + uint32_t uploadSizeLimit = 0) +{ + BoardInfoBuilder builder_(_fbb); + builder_.add_uploadSizeLimit(uploadSizeLimit); + builder_.add_uploadNumLimit(uploadNumLimit); + builder_.add_sortMode(sortMode); + builder_.add_updateMode(updateMode); + builder_.add_rankLimit(rankLimit); + return builder_.Finish(); } -struct RecordScoreRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RecordScoreRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_BOARDID = 4, - VT_PCID = 6, - VT_SCORE = 8, - VT_COMMENT = 10, - VT_DATA = 12 - }; - uint32_t boardId() const { - return GetField(VT_BOARDID, 0); - } - int32_t pcId() const { - return GetField(VT_PCID, 0); - } - int64_t score() const { - return GetField(VT_SCORE, 0); - } - const ::flatbuffers::String *comment() const { - return GetPointer(VT_COMMENT); - } - const ::flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_BOARDID, 4) && - VerifyField(verifier, VT_PCID, 4) && - VerifyField(verifier, VT_SCORE, 8) && - VerifyOffset(verifier, VT_COMMENT) && - verifier.VerifyString(comment()) && - VerifyOffset(verifier, VT_DATA) && - verifier.VerifyVector(data()) && - verifier.EndTable(); - } +struct RecordScoreRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RecordScoreRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_BOARDID = 4, + VT_PCID = 6, + VT_SCORE = 8, + VT_COMMENT = 10, + VT_DATA = 12 + }; + uint32_t boardId() const + { + return GetField(VT_BOARDID, 0); + } + int32_t pcId() const + { + return GetField(VT_PCID, 0); + } + int64_t score() const + { + return GetField(VT_SCORE, 0); + } + const ::flatbuffers::String* comment() const + { + return GetPointer(VT_COMMENT); + } + const ::flatbuffers::Vector* data() const + { + return GetPointer*>(VT_DATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_BOARDID, 4) && + VerifyField(verifier, VT_PCID, 4) && + VerifyField(verifier, VT_SCORE, 8) && + VerifyOffset(verifier, VT_COMMENT) && + verifier.VerifyString(comment()) && + VerifyOffset(verifier, VT_DATA) && + verifier.VerifyVector(data()) && + verifier.EndTable(); + } }; -struct RecordScoreRequestBuilder { - typedef RecordScoreRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_boardId(uint32_t boardId) { - fbb_.AddElement(RecordScoreRequest::VT_BOARDID, boardId, 0); - } - void add_pcId(int32_t pcId) { - fbb_.AddElement(RecordScoreRequest::VT_PCID, pcId, 0); - } - void add_score(int64_t score) { - fbb_.AddElement(RecordScoreRequest::VT_SCORE, score, 0); - } - void add_comment(::flatbuffers::Offset<::flatbuffers::String> comment) { - fbb_.AddOffset(RecordScoreRequest::VT_COMMENT, comment); - } - void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { - fbb_.AddOffset(RecordScoreRequest::VT_DATA, data); - } - explicit RecordScoreRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RecordScoreRequestBuilder +{ + typedef RecordScoreRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_boardId(uint32_t boardId) + { + fbb_.AddElement(RecordScoreRequest::VT_BOARDID, boardId, 0); + } + void add_pcId(int32_t pcId) + { + fbb_.AddElement(RecordScoreRequest::VT_PCID, pcId, 0); + } + void add_score(int64_t score) + { + fbb_.AddElement(RecordScoreRequest::VT_SCORE, score, 0); + } + void add_comment(::flatbuffers::Offset<::flatbuffers::String> comment) + { + fbb_.AddOffset(RecordScoreRequest::VT_COMMENT, comment); + } + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) + { + fbb_.AddOffset(RecordScoreRequest::VT_DATA, data); + } + explicit RecordScoreRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRecordScoreRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t boardId = 0, - int32_t pcId = 0, - int64_t score = 0, - ::flatbuffers::Offset<::flatbuffers::String> comment = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) { - RecordScoreRequestBuilder builder_(_fbb); - builder_.add_score(score); - builder_.add_data(data); - builder_.add_comment(comment); - builder_.add_pcId(pcId); - builder_.add_boardId(boardId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t boardId = 0, + int32_t pcId = 0, + int64_t score = 0, + ::flatbuffers::Offset<::flatbuffers::String> comment = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) +{ + RecordScoreRequestBuilder builder_(_fbb); + builder_.add_score(score); + builder_.add_data(data); + builder_.add_comment(comment); + builder_.add_pcId(pcId); + builder_.add_boardId(boardId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateRecordScoreRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t boardId = 0, - int32_t pcId = 0, - int64_t score = 0, - const char *comment = nullptr, - const std::vector *data = nullptr) { - auto comment__ = comment ? _fbb.CreateString(comment) : 0; - auto data__ = data ? _fbb.CreateVector(*data) : 0; - return CreateRecordScoreRequest( - _fbb, - boardId, - pcId, - score, - comment__, - data__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t boardId = 0, + int32_t pcId = 0, + int64_t score = 0, + const char* comment = nullptr, + const std::vector* data = nullptr) +{ + auto comment__ = comment ? _fbb.CreateString(comment) : 0; + auto data__ = data ? _fbb.CreateVector(*data) : 0; + return CreateRecordScoreRequest( + _fbb, + boardId, + pcId, + score, + comment__, + data__); } -struct GetScoreRangeRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GetScoreRangeRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_BOARDID = 4, - VT_STARTRANK = 6, - VT_NUMRANKS = 8, - VT_WITHCOMMENT = 10, - VT_WITHGAMEINFO = 12 - }; - uint32_t boardId() const { - return GetField(VT_BOARDID, 0); - } - uint32_t startRank() const { - return GetField(VT_STARTRANK, 0); - } - uint32_t numRanks() const { - return GetField(VT_NUMRANKS, 0); - } - bool withComment() const { - return GetField(VT_WITHCOMMENT, 0) != 0; - } - bool withGameInfo() const { - return GetField(VT_WITHGAMEINFO, 0) != 0; - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_BOARDID, 4) && - VerifyField(verifier, VT_STARTRANK, 4) && - VerifyField(verifier, VT_NUMRANKS, 4) && - VerifyField(verifier, VT_WITHCOMMENT, 1) && - VerifyField(verifier, VT_WITHGAMEINFO, 1) && - verifier.EndTable(); - } +struct GetScoreRangeRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GetScoreRangeRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_BOARDID = 4, + VT_STARTRANK = 6, + VT_NUMRANKS = 8, + VT_WITHCOMMENT = 10, + VT_WITHGAMEINFO = 12 + }; + uint32_t boardId() const + { + return GetField(VT_BOARDID, 0); + } + uint32_t startRank() const + { + return GetField(VT_STARTRANK, 0); + } + uint32_t numRanks() const + { + return GetField(VT_NUMRANKS, 0); + } + bool withComment() const + { + return GetField(VT_WITHCOMMENT, 0) != 0; + } + bool withGameInfo() const + { + return GetField(VT_WITHGAMEINFO, 0) != 0; + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_BOARDID, 4) && + VerifyField(verifier, VT_STARTRANK, 4) && + VerifyField(verifier, VT_NUMRANKS, 4) && + VerifyField(verifier, VT_WITHCOMMENT, 1) && + VerifyField(verifier, VT_WITHGAMEINFO, 1) && + verifier.EndTable(); + } }; -struct GetScoreRangeRequestBuilder { - typedef GetScoreRangeRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_boardId(uint32_t boardId) { - fbb_.AddElement(GetScoreRangeRequest::VT_BOARDID, boardId, 0); - } - void add_startRank(uint32_t startRank) { - fbb_.AddElement(GetScoreRangeRequest::VT_STARTRANK, startRank, 0); - } - void add_numRanks(uint32_t numRanks) { - fbb_.AddElement(GetScoreRangeRequest::VT_NUMRANKS, numRanks, 0); - } - void add_withComment(bool withComment) { - fbb_.AddElement(GetScoreRangeRequest::VT_WITHCOMMENT, static_cast(withComment), 0); - } - void add_withGameInfo(bool withGameInfo) { - fbb_.AddElement(GetScoreRangeRequest::VT_WITHGAMEINFO, static_cast(withGameInfo), 0); - } - explicit GetScoreRangeRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GetScoreRangeRequestBuilder +{ + typedef GetScoreRangeRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_boardId(uint32_t boardId) + { + fbb_.AddElement(GetScoreRangeRequest::VT_BOARDID, boardId, 0); + } + void add_startRank(uint32_t startRank) + { + fbb_.AddElement(GetScoreRangeRequest::VT_STARTRANK, startRank, 0); + } + void add_numRanks(uint32_t numRanks) + { + fbb_.AddElement(GetScoreRangeRequest::VT_NUMRANKS, numRanks, 0); + } + void add_withComment(bool withComment) + { + fbb_.AddElement(GetScoreRangeRequest::VT_WITHCOMMENT, static_cast(withComment), 0); + } + void add_withGameInfo(bool withGameInfo) + { + fbb_.AddElement(GetScoreRangeRequest::VT_WITHGAMEINFO, static_cast(withGameInfo), 0); + } + explicit GetScoreRangeRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGetScoreRangeRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t boardId = 0, - uint32_t startRank = 0, - uint32_t numRanks = 0, - bool withComment = false, - bool withGameInfo = false) { - GetScoreRangeRequestBuilder builder_(_fbb); - builder_.add_numRanks(numRanks); - builder_.add_startRank(startRank); - builder_.add_boardId(boardId); - builder_.add_withGameInfo(withGameInfo); - builder_.add_withComment(withComment); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t boardId = 0, + uint32_t startRank = 0, + uint32_t numRanks = 0, + bool withComment = false, + bool withGameInfo = false) +{ + GetScoreRangeRequestBuilder builder_(_fbb); + builder_.add_numRanks(numRanks); + builder_.add_startRank(startRank); + builder_.add_boardId(boardId); + builder_.add_withGameInfo(withGameInfo); + builder_.add_withComment(withComment); + return builder_.Finish(); } -struct ScoreNpIdPcId FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef ScoreNpIdPcIdBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NPID = 4, - VT_PCID = 6 - }; - const ::flatbuffers::String *npid() const { - return GetPointer(VT_NPID); - } - int32_t pcId() const { - return GetField(VT_PCID, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_NPID) && - verifier.VerifyString(npid()) && - VerifyField(verifier, VT_PCID, 4) && - verifier.EndTable(); - } +struct ScoreNpIdPcId FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef ScoreNpIdPcIdBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_NPID = 4, + VT_PCID = 6 + }; + const ::flatbuffers::String* npid() const + { + return GetPointer(VT_NPID); + } + int32_t pcId() const + { + return GetField(VT_PCID, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_NPID) && + verifier.VerifyString(npid()) && + VerifyField(verifier, VT_PCID, 4) && + verifier.EndTable(); + } }; -struct ScoreNpIdPcIdBuilder { - typedef ScoreNpIdPcId Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_npid(::flatbuffers::Offset<::flatbuffers::String> npid) { - fbb_.AddOffset(ScoreNpIdPcId::VT_NPID, npid); - } - void add_pcId(int32_t pcId) { - fbb_.AddElement(ScoreNpIdPcId::VT_PCID, pcId, 0); - } - explicit ScoreNpIdPcIdBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct ScoreNpIdPcIdBuilder +{ + typedef ScoreNpIdPcId Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_npid(::flatbuffers::Offset<::flatbuffers::String> npid) + { + fbb_.AddOffset(ScoreNpIdPcId::VT_NPID, npid); + } + void add_pcId(int32_t pcId) + { + fbb_.AddElement(ScoreNpIdPcId::VT_PCID, pcId, 0); + } + explicit ScoreNpIdPcIdBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateScoreNpIdPcId( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::String> npid = 0, - int32_t pcId = 0) { - ScoreNpIdPcIdBuilder builder_(_fbb); - builder_.add_pcId(pcId); - builder_.add_npid(npid); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::String> npid = 0, + int32_t pcId = 0) +{ + ScoreNpIdPcIdBuilder builder_(_fbb); + builder_.add_pcId(pcId); + builder_.add_npid(npid); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateScoreNpIdPcIdDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const char *npid = nullptr, - int32_t pcId = 0) { - auto npid__ = npid ? _fbb.CreateString(npid) : 0; - return CreateScoreNpIdPcId( - _fbb, - npid__, - pcId); + ::flatbuffers::FlatBufferBuilder& _fbb, + const char* npid = nullptr, + int32_t pcId = 0) +{ + auto npid__ = npid ? _fbb.CreateString(npid) : 0; + return CreateScoreNpIdPcId( + _fbb, + npid__, + pcId); } -struct GetScoreNpIdRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GetScoreNpIdRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_BOARDID = 4, - VT_NPIDS = 6, - VT_WITHCOMMENT = 8, - VT_WITHGAMEINFO = 10 - }; - uint32_t boardId() const { - return GetField(VT_BOARDID, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *npids() const { - return GetPointer> *>(VT_NPIDS); - } - bool withComment() const { - return GetField(VT_WITHCOMMENT, 0) != 0; - } - bool withGameInfo() const { - return GetField(VT_WITHGAMEINFO, 0) != 0; - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_BOARDID, 4) && - VerifyOffset(verifier, VT_NPIDS) && - verifier.VerifyVector(npids()) && - verifier.VerifyVectorOfTables(npids()) && - VerifyField(verifier, VT_WITHCOMMENT, 1) && - VerifyField(verifier, VT_WITHGAMEINFO, 1) && - verifier.EndTable(); - } +struct GetScoreNpIdRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GetScoreNpIdRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_BOARDID = 4, + VT_NPIDS = 6, + VT_WITHCOMMENT = 8, + VT_WITHGAMEINFO = 10 + }; + uint32_t boardId() const + { + return GetField(VT_BOARDID, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* npids() const + { + return GetPointer>*>(VT_NPIDS); + } + bool withComment() const + { + return GetField(VT_WITHCOMMENT, 0) != 0; + } + bool withGameInfo() const + { + return GetField(VT_WITHGAMEINFO, 0) != 0; + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_BOARDID, 4) && + VerifyOffset(verifier, VT_NPIDS) && + verifier.VerifyVector(npids()) && + verifier.VerifyVectorOfTables(npids()) && + VerifyField(verifier, VT_WITHCOMMENT, 1) && + VerifyField(verifier, VT_WITHGAMEINFO, 1) && + verifier.EndTable(); + } }; -struct GetScoreNpIdRequestBuilder { - typedef GetScoreNpIdRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_boardId(uint32_t boardId) { - fbb_.AddElement(GetScoreNpIdRequest::VT_BOARDID, boardId, 0); - } - void add_npids(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> npids) { - fbb_.AddOffset(GetScoreNpIdRequest::VT_NPIDS, npids); - } - void add_withComment(bool withComment) { - fbb_.AddElement(GetScoreNpIdRequest::VT_WITHCOMMENT, static_cast(withComment), 0); - } - void add_withGameInfo(bool withGameInfo) { - fbb_.AddElement(GetScoreNpIdRequest::VT_WITHGAMEINFO, static_cast(withGameInfo), 0); - } - explicit GetScoreNpIdRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GetScoreNpIdRequestBuilder +{ + typedef GetScoreNpIdRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_boardId(uint32_t boardId) + { + fbb_.AddElement(GetScoreNpIdRequest::VT_BOARDID, boardId, 0); + } + void add_npids(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> npids) + { + fbb_.AddOffset(GetScoreNpIdRequest::VT_NPIDS, npids); + } + void add_withComment(bool withComment) + { + fbb_.AddElement(GetScoreNpIdRequest::VT_WITHCOMMENT, static_cast(withComment), 0); + } + void add_withGameInfo(bool withGameInfo) + { + fbb_.AddElement(GetScoreNpIdRequest::VT_WITHGAMEINFO, static_cast(withGameInfo), 0); + } + explicit GetScoreNpIdRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGetScoreNpIdRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t boardId = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> npids = 0, - bool withComment = false, - bool withGameInfo = false) { - GetScoreNpIdRequestBuilder builder_(_fbb); - builder_.add_npids(npids); - builder_.add_boardId(boardId); - builder_.add_withGameInfo(withGameInfo); - builder_.add_withComment(withComment); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t boardId = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> npids = 0, + bool withComment = false, + bool withGameInfo = false) +{ + GetScoreNpIdRequestBuilder builder_(_fbb); + builder_.add_npids(npids); + builder_.add_boardId(boardId); + builder_.add_withGameInfo(withGameInfo); + builder_.add_withComment(withComment); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateGetScoreNpIdRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t boardId = 0, - const std::vector<::flatbuffers::Offset> *npids = nullptr, - bool withComment = false, - bool withGameInfo = false) { - auto npids__ = npids ? _fbb.CreateVector<::flatbuffers::Offset>(*npids) : 0; - return CreateGetScoreNpIdRequest( - _fbb, - boardId, - npids__, - withComment, - withGameInfo); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t boardId = 0, + const std::vector<::flatbuffers::Offset>* npids = nullptr, + bool withComment = false, + bool withGameInfo = false) +{ + auto npids__ = npids ? _fbb.CreateVector<::flatbuffers::Offset>(*npids) : 0; + return CreateGetScoreNpIdRequest( + _fbb, + boardId, + npids__, + withComment, + withGameInfo); } -struct GetScoreFriendsRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GetScoreFriendsRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_BOARDID = 4, - VT_INCLUDE_SELF = 6, - VT_MAX = 8, - VT_WITHCOMMENT = 10, - VT_WITHGAMEINFO = 12 - }; - uint32_t boardId() const { - return GetField(VT_BOARDID, 0); - } - bool include_self() const { - return GetField(VT_INCLUDE_SELF, 0) != 0; - } - uint32_t max() const { - return GetField(VT_MAX, 0); - } - bool withComment() const { - return GetField(VT_WITHCOMMENT, 0) != 0; - } - bool withGameInfo() const { - return GetField(VT_WITHGAMEINFO, 0) != 0; - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_BOARDID, 4) && - VerifyField(verifier, VT_INCLUDE_SELF, 1) && - VerifyField(verifier, VT_MAX, 4) && - VerifyField(verifier, VT_WITHCOMMENT, 1) && - VerifyField(verifier, VT_WITHGAMEINFO, 1) && - verifier.EndTable(); - } +struct GetScoreFriendsRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GetScoreFriendsRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_BOARDID = 4, + VT_INCLUDE_SELF = 6, + VT_MAX = 8, + VT_WITHCOMMENT = 10, + VT_WITHGAMEINFO = 12 + }; + uint32_t boardId() const + { + return GetField(VT_BOARDID, 0); + } + bool include_self() const + { + return GetField(VT_INCLUDE_SELF, 0) != 0; + } + uint32_t max() const + { + return GetField(VT_MAX, 0); + } + bool withComment() const + { + return GetField(VT_WITHCOMMENT, 0) != 0; + } + bool withGameInfo() const + { + return GetField(VT_WITHGAMEINFO, 0) != 0; + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_BOARDID, 4) && + VerifyField(verifier, VT_INCLUDE_SELF, 1) && + VerifyField(verifier, VT_MAX, 4) && + VerifyField(verifier, VT_WITHCOMMENT, 1) && + VerifyField(verifier, VT_WITHGAMEINFO, 1) && + verifier.EndTable(); + } }; -struct GetScoreFriendsRequestBuilder { - typedef GetScoreFriendsRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_boardId(uint32_t boardId) { - fbb_.AddElement(GetScoreFriendsRequest::VT_BOARDID, boardId, 0); - } - void add_include_self(bool include_self) { - fbb_.AddElement(GetScoreFriendsRequest::VT_INCLUDE_SELF, static_cast(include_self), 0); - } - void add_max(uint32_t max) { - fbb_.AddElement(GetScoreFriendsRequest::VT_MAX, max, 0); - } - void add_withComment(bool withComment) { - fbb_.AddElement(GetScoreFriendsRequest::VT_WITHCOMMENT, static_cast(withComment), 0); - } - void add_withGameInfo(bool withGameInfo) { - fbb_.AddElement(GetScoreFriendsRequest::VT_WITHGAMEINFO, static_cast(withGameInfo), 0); - } - explicit GetScoreFriendsRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GetScoreFriendsRequestBuilder +{ + typedef GetScoreFriendsRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_boardId(uint32_t boardId) + { + fbb_.AddElement(GetScoreFriendsRequest::VT_BOARDID, boardId, 0); + } + void add_include_self(bool include_self) + { + fbb_.AddElement(GetScoreFriendsRequest::VT_INCLUDE_SELF, static_cast(include_self), 0); + } + void add_max(uint32_t max) + { + fbb_.AddElement(GetScoreFriendsRequest::VT_MAX, max, 0); + } + void add_withComment(bool withComment) + { + fbb_.AddElement(GetScoreFriendsRequest::VT_WITHCOMMENT, static_cast(withComment), 0); + } + void add_withGameInfo(bool withGameInfo) + { + fbb_.AddElement(GetScoreFriendsRequest::VT_WITHGAMEINFO, static_cast(withGameInfo), 0); + } + explicit GetScoreFriendsRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGetScoreFriendsRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t boardId = 0, - bool include_self = false, - uint32_t max = 0, - bool withComment = false, - bool withGameInfo = false) { - GetScoreFriendsRequestBuilder builder_(_fbb); - builder_.add_max(max); - builder_.add_boardId(boardId); - builder_.add_withGameInfo(withGameInfo); - builder_.add_withComment(withComment); - builder_.add_include_self(include_self); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t boardId = 0, + bool include_self = false, + uint32_t max = 0, + bool withComment = false, + bool withGameInfo = false) +{ + GetScoreFriendsRequestBuilder builder_(_fbb); + builder_.add_max(max); + builder_.add_boardId(boardId); + builder_.add_withGameInfo(withGameInfo); + builder_.add_withComment(withComment); + builder_.add_include_self(include_self); + return builder_.Finish(); } -struct ScoreRankData FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef ScoreRankDataBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NPID = 4, - VT_ONLINENAME = 6, - VT_PCID = 8, - VT_RANK = 10, - VT_SCORE = 12, - VT_HASGAMEDATA = 14, - VT_RECORDDATE = 16 - }; - const ::flatbuffers::String *npId() const { - return GetPointer(VT_NPID); - } - const ::flatbuffers::String *onlineName() const { - return GetPointer(VT_ONLINENAME); - } - int32_t pcId() const { - return GetField(VT_PCID, 0); - } - uint32_t rank() const { - return GetField(VT_RANK, 0); - } - int64_t score() const { - return GetField(VT_SCORE, 0); - } - bool hasGameData() const { - return GetField(VT_HASGAMEDATA, 0) != 0; - } - uint64_t recordDate() const { - return GetField(VT_RECORDDATE, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_NPID) && - verifier.VerifyString(npId()) && - VerifyOffset(verifier, VT_ONLINENAME) && - verifier.VerifyString(onlineName()) && - VerifyField(verifier, VT_PCID, 4) && - VerifyField(verifier, VT_RANK, 4) && - VerifyField(verifier, VT_SCORE, 8) && - VerifyField(verifier, VT_HASGAMEDATA, 1) && - VerifyField(verifier, VT_RECORDDATE, 8) && - verifier.EndTable(); - } +struct ScoreRankData FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef ScoreRankDataBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_NPID = 4, + VT_ONLINENAME = 6, + VT_PCID = 8, + VT_RANK = 10, + VT_SCORE = 12, + VT_HASGAMEDATA = 14, + VT_RECORDDATE = 16 + }; + const ::flatbuffers::String* npId() const + { + return GetPointer(VT_NPID); + } + const ::flatbuffers::String* onlineName() const + { + return GetPointer(VT_ONLINENAME); + } + int32_t pcId() const + { + return GetField(VT_PCID, 0); + } + uint32_t rank() const + { + return GetField(VT_RANK, 0); + } + int64_t score() const + { + return GetField(VT_SCORE, 0); + } + bool hasGameData() const + { + return GetField(VT_HASGAMEDATA, 0) != 0; + } + uint64_t recordDate() const + { + return GetField(VT_RECORDDATE, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_NPID) && + verifier.VerifyString(npId()) && + VerifyOffset(verifier, VT_ONLINENAME) && + verifier.VerifyString(onlineName()) && + VerifyField(verifier, VT_PCID, 4) && + VerifyField(verifier, VT_RANK, 4) && + VerifyField(verifier, VT_SCORE, 8) && + VerifyField(verifier, VT_HASGAMEDATA, 1) && + VerifyField(verifier, VT_RECORDDATE, 8) && + verifier.EndTable(); + } }; -struct ScoreRankDataBuilder { - typedef ScoreRankData Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_npId(::flatbuffers::Offset<::flatbuffers::String> npId) { - fbb_.AddOffset(ScoreRankData::VT_NPID, npId); - } - void add_onlineName(::flatbuffers::Offset<::flatbuffers::String> onlineName) { - fbb_.AddOffset(ScoreRankData::VT_ONLINENAME, onlineName); - } - void add_pcId(int32_t pcId) { - fbb_.AddElement(ScoreRankData::VT_PCID, pcId, 0); - } - void add_rank(uint32_t rank) { - fbb_.AddElement(ScoreRankData::VT_RANK, rank, 0); - } - void add_score(int64_t score) { - fbb_.AddElement(ScoreRankData::VT_SCORE, score, 0); - } - void add_hasGameData(bool hasGameData) { - fbb_.AddElement(ScoreRankData::VT_HASGAMEDATA, static_cast(hasGameData), 0); - } - void add_recordDate(uint64_t recordDate) { - fbb_.AddElement(ScoreRankData::VT_RECORDDATE, recordDate, 0); - } - explicit ScoreRankDataBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct ScoreRankDataBuilder +{ + typedef ScoreRankData Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_npId(::flatbuffers::Offset<::flatbuffers::String> npId) + { + fbb_.AddOffset(ScoreRankData::VT_NPID, npId); + } + void add_onlineName(::flatbuffers::Offset<::flatbuffers::String> onlineName) + { + fbb_.AddOffset(ScoreRankData::VT_ONLINENAME, onlineName); + } + void add_pcId(int32_t pcId) + { + fbb_.AddElement(ScoreRankData::VT_PCID, pcId, 0); + } + void add_rank(uint32_t rank) + { + fbb_.AddElement(ScoreRankData::VT_RANK, rank, 0); + } + void add_score(int64_t score) + { + fbb_.AddElement(ScoreRankData::VT_SCORE, score, 0); + } + void add_hasGameData(bool hasGameData) + { + fbb_.AddElement(ScoreRankData::VT_HASGAMEDATA, static_cast(hasGameData), 0); + } + void add_recordDate(uint64_t recordDate) + { + fbb_.AddElement(ScoreRankData::VT_RECORDDATE, recordDate, 0); + } + explicit ScoreRankDataBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateScoreRankData( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::String> npId = 0, - ::flatbuffers::Offset<::flatbuffers::String> onlineName = 0, - int32_t pcId = 0, - uint32_t rank = 0, - int64_t score = 0, - bool hasGameData = false, - uint64_t recordDate = 0) { - ScoreRankDataBuilder builder_(_fbb); - builder_.add_recordDate(recordDate); - builder_.add_score(score); - builder_.add_rank(rank); - builder_.add_pcId(pcId); - builder_.add_onlineName(onlineName); - builder_.add_npId(npId); - builder_.add_hasGameData(hasGameData); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::String> npId = 0, + ::flatbuffers::Offset<::flatbuffers::String> onlineName = 0, + int32_t pcId = 0, + uint32_t rank = 0, + int64_t score = 0, + bool hasGameData = false, + uint64_t recordDate = 0) +{ + ScoreRankDataBuilder builder_(_fbb); + builder_.add_recordDate(recordDate); + builder_.add_score(score); + builder_.add_rank(rank); + builder_.add_pcId(pcId); + builder_.add_onlineName(onlineName); + builder_.add_npId(npId); + builder_.add_hasGameData(hasGameData); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateScoreRankDataDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const char *npId = nullptr, - const char *onlineName = nullptr, - int32_t pcId = 0, - uint32_t rank = 0, - int64_t score = 0, - bool hasGameData = false, - uint64_t recordDate = 0) { - auto npId__ = npId ? _fbb.CreateString(npId) : 0; - auto onlineName__ = onlineName ? _fbb.CreateString(onlineName) : 0; - return CreateScoreRankData( - _fbb, - npId__, - onlineName__, - pcId, - rank, - score, - hasGameData, - recordDate); + ::flatbuffers::FlatBufferBuilder& _fbb, + const char* npId = nullptr, + const char* onlineName = nullptr, + int32_t pcId = 0, + uint32_t rank = 0, + int64_t score = 0, + bool hasGameData = false, + uint64_t recordDate = 0) +{ + auto npId__ = npId ? _fbb.CreateString(npId) : 0; + auto onlineName__ = onlineName ? _fbb.CreateString(onlineName) : 0; + return CreateScoreRankData( + _fbb, + npId__, + onlineName__, + pcId, + rank, + score, + hasGameData, + recordDate); } -struct ScoreInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef ScoreInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_DATA = 4 - }; - const ::flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_DATA) && - verifier.VerifyVector(data()) && - verifier.EndTable(); - } +struct ScoreInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef ScoreInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_DATA = 4 + }; + const ::flatbuffers::Vector* data() const + { + return GetPointer*>(VT_DATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_DATA) && + verifier.VerifyVector(data()) && + verifier.EndTable(); + } }; -struct ScoreInfoBuilder { - typedef ScoreInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { - fbb_.AddOffset(ScoreInfo::VT_DATA, data); - } - explicit ScoreInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct ScoreInfoBuilder +{ + typedef ScoreInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) + { + fbb_.AddOffset(ScoreInfo::VT_DATA, data); + } + explicit ScoreInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateScoreInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) { - ScoreInfoBuilder builder_(_fbb); - builder_.add_data(data); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) +{ + ScoreInfoBuilder builder_(_fbb); + builder_.add_data(data); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateScoreInfoDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *data = nullptr) { - auto data__ = data ? _fbb.CreateVector(*data) : 0; - return CreateScoreInfo( - _fbb, - data__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector* data = nullptr) +{ + auto data__ = data ? _fbb.CreateVector(*data) : 0; + return CreateScoreInfo( + _fbb, + data__); } -struct GetScoreResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GetScoreResponseBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_RANKARRAY = 4, - VT_COMMENTARRAY = 6, - VT_INFOARRAY = 8, - VT_LASTSORTDATE = 10, - VT_TOTALRECORD = 12 - }; - const ::flatbuffers::Vector<::flatbuffers::Offset> *rankArray() const { - return GetPointer> *>(VT_RANKARRAY); - } - const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *commentArray() const { - return GetPointer> *>(VT_COMMENTARRAY); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *infoArray() const { - return GetPointer> *>(VT_INFOARRAY); - } - uint64_t lastSortDate() const { - return GetField(VT_LASTSORTDATE, 0); - } - uint32_t totalRecord() const { - return GetField(VT_TOTALRECORD, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_RANKARRAY) && - verifier.VerifyVector(rankArray()) && - verifier.VerifyVectorOfTables(rankArray()) && - VerifyOffset(verifier, VT_COMMENTARRAY) && - verifier.VerifyVector(commentArray()) && - verifier.VerifyVectorOfStrings(commentArray()) && - VerifyOffset(verifier, VT_INFOARRAY) && - verifier.VerifyVector(infoArray()) && - verifier.VerifyVectorOfTables(infoArray()) && - VerifyField(verifier, VT_LASTSORTDATE, 8) && - VerifyField(verifier, VT_TOTALRECORD, 4) && - verifier.EndTable(); - } +struct GetScoreResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GetScoreResponseBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_RANKARRAY = 4, + VT_COMMENTARRAY = 6, + VT_INFOARRAY = 8, + VT_LASTSORTDATE = 10, + VT_TOTALRECORD = 12 + }; + const ::flatbuffers::Vector<::flatbuffers::Offset>* rankArray() const + { + return GetPointer>*>(VT_RANKARRAY); + } + const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>* commentArray() const + { + return GetPointer>*>(VT_COMMENTARRAY); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* infoArray() const + { + return GetPointer>*>(VT_INFOARRAY); + } + uint64_t lastSortDate() const + { + return GetField(VT_LASTSORTDATE, 0); + } + uint32_t totalRecord() const + { + return GetField(VT_TOTALRECORD, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_RANKARRAY) && + verifier.VerifyVector(rankArray()) && + verifier.VerifyVectorOfTables(rankArray()) && + VerifyOffset(verifier, VT_COMMENTARRAY) && + verifier.VerifyVector(commentArray()) && + verifier.VerifyVectorOfStrings(commentArray()) && + VerifyOffset(verifier, VT_INFOARRAY) && + verifier.VerifyVector(infoArray()) && + verifier.VerifyVectorOfTables(infoArray()) && + VerifyField(verifier, VT_LASTSORTDATE, 8) && + VerifyField(verifier, VT_TOTALRECORD, 4) && + verifier.EndTable(); + } }; -struct GetScoreResponseBuilder { - typedef GetScoreResponse Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_rankArray(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rankArray) { - fbb_.AddOffset(GetScoreResponse::VT_RANKARRAY, rankArray); - } - void add_commentArray(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> commentArray) { - fbb_.AddOffset(GetScoreResponse::VT_COMMENTARRAY, commentArray); - } - void add_infoArray(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> infoArray) { - fbb_.AddOffset(GetScoreResponse::VT_INFOARRAY, infoArray); - } - void add_lastSortDate(uint64_t lastSortDate) { - fbb_.AddElement(GetScoreResponse::VT_LASTSORTDATE, lastSortDate, 0); - } - void add_totalRecord(uint32_t totalRecord) { - fbb_.AddElement(GetScoreResponse::VT_TOTALRECORD, totalRecord, 0); - } - explicit GetScoreResponseBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GetScoreResponseBuilder +{ + typedef GetScoreResponse Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_rankArray(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rankArray) + { + fbb_.AddOffset(GetScoreResponse::VT_RANKARRAY, rankArray); + } + void add_commentArray(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> commentArray) + { + fbb_.AddOffset(GetScoreResponse::VT_COMMENTARRAY, commentArray); + } + void add_infoArray(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> infoArray) + { + fbb_.AddOffset(GetScoreResponse::VT_INFOARRAY, infoArray); + } + void add_lastSortDate(uint64_t lastSortDate) + { + fbb_.AddElement(GetScoreResponse::VT_LASTSORTDATE, lastSortDate, 0); + } + void add_totalRecord(uint32_t totalRecord) + { + fbb_.AddElement(GetScoreResponse::VT_TOTALRECORD, totalRecord, 0); + } + explicit GetScoreResponseBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGetScoreResponse( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rankArray = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> commentArray = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> infoArray = 0, - uint64_t lastSortDate = 0, - uint32_t totalRecord = 0) { - GetScoreResponseBuilder builder_(_fbb); - builder_.add_lastSortDate(lastSortDate); - builder_.add_totalRecord(totalRecord); - builder_.add_infoArray(infoArray); - builder_.add_commentArray(commentArray); - builder_.add_rankArray(rankArray); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rankArray = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> commentArray = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> infoArray = 0, + uint64_t lastSortDate = 0, + uint32_t totalRecord = 0) +{ + GetScoreResponseBuilder builder_(_fbb); + builder_.add_lastSortDate(lastSortDate); + builder_.add_totalRecord(totalRecord); + builder_.add_infoArray(infoArray); + builder_.add_commentArray(commentArray); + builder_.add_rankArray(rankArray); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateGetScoreResponseDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector<::flatbuffers::Offset> *rankArray = nullptr, - const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *commentArray = nullptr, - const std::vector<::flatbuffers::Offset> *infoArray = nullptr, - uint64_t lastSortDate = 0, - uint32_t totalRecord = 0) { - auto rankArray__ = rankArray ? _fbb.CreateVector<::flatbuffers::Offset>(*rankArray) : 0; - auto commentArray__ = commentArray ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*commentArray) : 0; - auto infoArray__ = infoArray ? _fbb.CreateVector<::flatbuffers::Offset>(*infoArray) : 0; - return CreateGetScoreResponse( - _fbb, - rankArray__, - commentArray__, - infoArray__, - lastSortDate, - totalRecord); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector<::flatbuffers::Offset>* rankArray = nullptr, + const std::vector<::flatbuffers::Offset<::flatbuffers::String>>* commentArray = nullptr, + const std::vector<::flatbuffers::Offset>* infoArray = nullptr, + uint64_t lastSortDate = 0, + uint32_t totalRecord = 0) +{ + auto rankArray__ = rankArray ? _fbb.CreateVector<::flatbuffers::Offset>(*rankArray) : 0; + auto commentArray__ = commentArray ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*commentArray) : 0; + auto infoArray__ = infoArray ? _fbb.CreateVector<::flatbuffers::Offset>(*infoArray) : 0; + return CreateGetScoreResponse( + _fbb, + rankArray__, + commentArray__, + infoArray__, + lastSortDate, + totalRecord); } -struct RecordScoreGameDataRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef RecordScoreGameDataRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_BOARDID = 4, - VT_PCID = 6, - VT_SCORE = 8 - }; - uint32_t boardId() const { - return GetField(VT_BOARDID, 0); - } - int32_t pcId() const { - return GetField(VT_PCID, 0); - } - int64_t score() const { - return GetField(VT_SCORE, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_BOARDID, 4) && - VerifyField(verifier, VT_PCID, 4) && - VerifyField(verifier, VT_SCORE, 8) && - verifier.EndTable(); - } +struct RecordScoreGameDataRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef RecordScoreGameDataRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_BOARDID = 4, + VT_PCID = 6, + VT_SCORE = 8 + }; + uint32_t boardId() const + { + return GetField(VT_BOARDID, 0); + } + int32_t pcId() const + { + return GetField(VT_PCID, 0); + } + int64_t score() const + { + return GetField(VT_SCORE, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_BOARDID, 4) && + VerifyField(verifier, VT_PCID, 4) && + VerifyField(verifier, VT_SCORE, 8) && + verifier.EndTable(); + } }; -struct RecordScoreGameDataRequestBuilder { - typedef RecordScoreGameDataRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_boardId(uint32_t boardId) { - fbb_.AddElement(RecordScoreGameDataRequest::VT_BOARDID, boardId, 0); - } - void add_pcId(int32_t pcId) { - fbb_.AddElement(RecordScoreGameDataRequest::VT_PCID, pcId, 0); - } - void add_score(int64_t score) { - fbb_.AddElement(RecordScoreGameDataRequest::VT_SCORE, score, 0); - } - explicit RecordScoreGameDataRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct RecordScoreGameDataRequestBuilder +{ + typedef RecordScoreGameDataRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_boardId(uint32_t boardId) + { + fbb_.AddElement(RecordScoreGameDataRequest::VT_BOARDID, boardId, 0); + } + void add_pcId(int32_t pcId) + { + fbb_.AddElement(RecordScoreGameDataRequest::VT_PCID, pcId, 0); + } + void add_score(int64_t score) + { + fbb_.AddElement(RecordScoreGameDataRequest::VT_SCORE, score, 0); + } + explicit RecordScoreGameDataRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateRecordScoreGameDataRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t boardId = 0, - int32_t pcId = 0, - int64_t score = 0) { - RecordScoreGameDataRequestBuilder builder_(_fbb); - builder_.add_score(score); - builder_.add_pcId(pcId); - builder_.add_boardId(boardId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t boardId = 0, + int32_t pcId = 0, + int64_t score = 0) +{ + RecordScoreGameDataRequestBuilder builder_(_fbb); + builder_.add_score(score); + builder_.add_pcId(pcId); + builder_.add_boardId(boardId); + return builder_.Finish(); } -struct GetScoreGameDataRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GetScoreGameDataRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_BOARDID = 4, - VT_NPID = 6, - VT_PCID = 8 - }; - uint32_t boardId() const { - return GetField(VT_BOARDID, 0); - } - const ::flatbuffers::String *npId() const { - return GetPointer(VT_NPID); - } - int32_t pcId() const { - return GetField(VT_PCID, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_BOARDID, 4) && - VerifyOffset(verifier, VT_NPID) && - verifier.VerifyString(npId()) && - VerifyField(verifier, VT_PCID, 4) && - verifier.EndTable(); - } +struct GetScoreGameDataRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GetScoreGameDataRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_BOARDID = 4, + VT_NPID = 6, + VT_PCID = 8 + }; + uint32_t boardId() const + { + return GetField(VT_BOARDID, 0); + } + const ::flatbuffers::String* npId() const + { + return GetPointer(VT_NPID); + } + int32_t pcId() const + { + return GetField(VT_PCID, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_BOARDID, 4) && + VerifyOffset(verifier, VT_NPID) && + verifier.VerifyString(npId()) && + VerifyField(verifier, VT_PCID, 4) && + verifier.EndTable(); + } }; -struct GetScoreGameDataRequestBuilder { - typedef GetScoreGameDataRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_boardId(uint32_t boardId) { - fbb_.AddElement(GetScoreGameDataRequest::VT_BOARDID, boardId, 0); - } - void add_npId(::flatbuffers::Offset<::flatbuffers::String> npId) { - fbb_.AddOffset(GetScoreGameDataRequest::VT_NPID, npId); - } - void add_pcId(int32_t pcId) { - fbb_.AddElement(GetScoreGameDataRequest::VT_PCID, pcId, 0); - } - explicit GetScoreGameDataRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GetScoreGameDataRequestBuilder +{ + typedef GetScoreGameDataRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_boardId(uint32_t boardId) + { + fbb_.AddElement(GetScoreGameDataRequest::VT_BOARDID, boardId, 0); + } + void add_npId(::flatbuffers::Offset<::flatbuffers::String> npId) + { + fbb_.AddOffset(GetScoreGameDataRequest::VT_NPID, npId); + } + void add_pcId(int32_t pcId) + { + fbb_.AddElement(GetScoreGameDataRequest::VT_PCID, pcId, 0); + } + explicit GetScoreGameDataRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGetScoreGameDataRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t boardId = 0, - ::flatbuffers::Offset<::flatbuffers::String> npId = 0, - int32_t pcId = 0) { - GetScoreGameDataRequestBuilder builder_(_fbb); - builder_.add_pcId(pcId); - builder_.add_npId(npId); - builder_.add_boardId(boardId); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t boardId = 0, + ::flatbuffers::Offset<::flatbuffers::String> npId = 0, + int32_t pcId = 0) +{ + GetScoreGameDataRequestBuilder builder_(_fbb); + builder_.add_pcId(pcId); + builder_.add_npId(npId); + builder_.add_boardId(boardId); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateGetScoreGameDataRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t boardId = 0, - const char *npId = nullptr, - int32_t pcId = 0) { - auto npId__ = npId ? _fbb.CreateString(npId) : 0; - return CreateGetScoreGameDataRequest( - _fbb, - boardId, - npId__, - pcId); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t boardId = 0, + const char* npId = nullptr, + int32_t pcId = 0) +{ + auto npId__ = npId ? _fbb.CreateString(npId) : 0; + return CreateGetScoreGameDataRequest( + _fbb, + boardId, + npId__, + pcId); } -struct TusUser FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusUserBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_VUSER = 4, - VT_NPID = 6 - }; - bool vuser() const { - return GetField(VT_VUSER, 0) != 0; - } - const ::flatbuffers::String *npid() const { - return GetPointer(VT_NPID); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_VUSER, 1) && - VerifyOffset(verifier, VT_NPID) && - verifier.VerifyString(npid()) && - verifier.EndTable(); - } +struct TusUser FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusUserBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_VUSER = 4, + VT_NPID = 6 + }; + bool vuser() const + { + return GetField(VT_VUSER, 0) != 0; + } + const ::flatbuffers::String* npid() const + { + return GetPointer(VT_NPID); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_VUSER, 1) && + VerifyOffset(verifier, VT_NPID) && + verifier.VerifyString(npid()) && + verifier.EndTable(); + } }; -struct TusUserBuilder { - typedef TusUser Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_vuser(bool vuser) { - fbb_.AddElement(TusUser::VT_VUSER, static_cast(vuser), 0); - } - void add_npid(::flatbuffers::Offset<::flatbuffers::String> npid) { - fbb_.AddOffset(TusUser::VT_NPID, npid); - } - explicit TusUserBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusUserBuilder +{ + typedef TusUser Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_vuser(bool vuser) + { + fbb_.AddElement(TusUser::VT_VUSER, static_cast(vuser), 0); + } + void add_npid(::flatbuffers::Offset<::flatbuffers::String> npid) + { + fbb_.AddOffset(TusUser::VT_NPID, npid); + } + explicit TusUserBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusUser( - ::flatbuffers::FlatBufferBuilder &_fbb, - bool vuser = false, - ::flatbuffers::Offset<::flatbuffers::String> npid = 0) { - TusUserBuilder builder_(_fbb); - builder_.add_npid(npid); - builder_.add_vuser(vuser); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + bool vuser = false, + ::flatbuffers::Offset<::flatbuffers::String> npid = 0) +{ + TusUserBuilder builder_(_fbb); + builder_.add_npid(npid); + builder_.add_vuser(vuser); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusUserDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - bool vuser = false, - const char *npid = nullptr) { - auto npid__ = npid ? _fbb.CreateString(npid) : 0; - return CreateTusUser( - _fbb, - vuser, - npid__); + ::flatbuffers::FlatBufferBuilder& _fbb, + bool vuser = false, + const char* npid = nullptr) +{ + auto npid__ = npid ? _fbb.CreateString(npid) : 0; + return CreateTusUser( + _fbb, + vuser, + npid__); } -struct TusVariable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusVariableBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_OWNERID = 4, - VT_HASDATA = 6, - VT_LASTCHANGEDDATE = 8, - VT_LASTCHANGEDAUTHORID = 10, - VT_VARIABLE = 12, - VT_OLDVARIABLE = 14 - }; - const ::flatbuffers::String *ownerId() const { - return GetPointer(VT_OWNERID); - } - bool hasData() const { - return GetField(VT_HASDATA, 0) != 0; - } - uint64_t lastChangedDate() const { - return GetField(VT_LASTCHANGEDDATE, 0); - } - const ::flatbuffers::String *lastChangedAuthorId() const { - return GetPointer(VT_LASTCHANGEDAUTHORID); - } - int64_t variable() const { - return GetField(VT_VARIABLE, 0); - } - int64_t oldVariable() const { - return GetField(VT_OLDVARIABLE, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_OWNERID) && - verifier.VerifyString(ownerId()) && - VerifyField(verifier, VT_HASDATA, 1) && - VerifyField(verifier, VT_LASTCHANGEDDATE, 8) && - VerifyOffset(verifier, VT_LASTCHANGEDAUTHORID) && - verifier.VerifyString(lastChangedAuthorId()) && - VerifyField(verifier, VT_VARIABLE, 8) && - VerifyField(verifier, VT_OLDVARIABLE, 8) && - verifier.EndTable(); - } +struct TusVariable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusVariableBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_OWNERID = 4, + VT_HASDATA = 6, + VT_LASTCHANGEDDATE = 8, + VT_LASTCHANGEDAUTHORID = 10, + VT_VARIABLE = 12, + VT_OLDVARIABLE = 14 + }; + const ::flatbuffers::String* ownerId() const + { + return GetPointer(VT_OWNERID); + } + bool hasData() const + { + return GetField(VT_HASDATA, 0) != 0; + } + uint64_t lastChangedDate() const + { + return GetField(VT_LASTCHANGEDDATE, 0); + } + const ::flatbuffers::String* lastChangedAuthorId() const + { + return GetPointer(VT_LASTCHANGEDAUTHORID); + } + int64_t variable() const + { + return GetField(VT_VARIABLE, 0); + } + int64_t oldVariable() const + { + return GetField(VT_OLDVARIABLE, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_OWNERID) && + verifier.VerifyString(ownerId()) && + VerifyField(verifier, VT_HASDATA, 1) && + VerifyField(verifier, VT_LASTCHANGEDDATE, 8) && + VerifyOffset(verifier, VT_LASTCHANGEDAUTHORID) && + verifier.VerifyString(lastChangedAuthorId()) && + VerifyField(verifier, VT_VARIABLE, 8) && + VerifyField(verifier, VT_OLDVARIABLE, 8) && + verifier.EndTable(); + } }; -struct TusVariableBuilder { - typedef TusVariable Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_ownerId(::flatbuffers::Offset<::flatbuffers::String> ownerId) { - fbb_.AddOffset(TusVariable::VT_OWNERID, ownerId); - } - void add_hasData(bool hasData) { - fbb_.AddElement(TusVariable::VT_HASDATA, static_cast(hasData), 0); - } - void add_lastChangedDate(uint64_t lastChangedDate) { - fbb_.AddElement(TusVariable::VT_LASTCHANGEDDATE, lastChangedDate, 0); - } - void add_lastChangedAuthorId(::flatbuffers::Offset<::flatbuffers::String> lastChangedAuthorId) { - fbb_.AddOffset(TusVariable::VT_LASTCHANGEDAUTHORID, lastChangedAuthorId); - } - void add_variable(int64_t variable) { - fbb_.AddElement(TusVariable::VT_VARIABLE, variable, 0); - } - void add_oldVariable(int64_t oldVariable) { - fbb_.AddElement(TusVariable::VT_OLDVARIABLE, oldVariable, 0); - } - explicit TusVariableBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusVariableBuilder +{ + typedef TusVariable Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_ownerId(::flatbuffers::Offset<::flatbuffers::String> ownerId) + { + fbb_.AddOffset(TusVariable::VT_OWNERID, ownerId); + } + void add_hasData(bool hasData) + { + fbb_.AddElement(TusVariable::VT_HASDATA, static_cast(hasData), 0); + } + void add_lastChangedDate(uint64_t lastChangedDate) + { + fbb_.AddElement(TusVariable::VT_LASTCHANGEDDATE, lastChangedDate, 0); + } + void add_lastChangedAuthorId(::flatbuffers::Offset<::flatbuffers::String> lastChangedAuthorId) + { + fbb_.AddOffset(TusVariable::VT_LASTCHANGEDAUTHORID, lastChangedAuthorId); + } + void add_variable(int64_t variable) + { + fbb_.AddElement(TusVariable::VT_VARIABLE, variable, 0); + } + void add_oldVariable(int64_t oldVariable) + { + fbb_.AddElement(TusVariable::VT_OLDVARIABLE, oldVariable, 0); + } + explicit TusVariableBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusVariable( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::String> ownerId = 0, - bool hasData = false, - uint64_t lastChangedDate = 0, - ::flatbuffers::Offset<::flatbuffers::String> lastChangedAuthorId = 0, - int64_t variable = 0, - int64_t oldVariable = 0) { - TusVariableBuilder builder_(_fbb); - builder_.add_oldVariable(oldVariable); - builder_.add_variable(variable); - builder_.add_lastChangedDate(lastChangedDate); - builder_.add_lastChangedAuthorId(lastChangedAuthorId); - builder_.add_ownerId(ownerId); - builder_.add_hasData(hasData); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::String> ownerId = 0, + bool hasData = false, + uint64_t lastChangedDate = 0, + ::flatbuffers::Offset<::flatbuffers::String> lastChangedAuthorId = 0, + int64_t variable = 0, + int64_t oldVariable = 0) +{ + TusVariableBuilder builder_(_fbb); + builder_.add_oldVariable(oldVariable); + builder_.add_variable(variable); + builder_.add_lastChangedDate(lastChangedDate); + builder_.add_lastChangedAuthorId(lastChangedAuthorId); + builder_.add_ownerId(ownerId); + builder_.add_hasData(hasData); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusVariableDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const char *ownerId = nullptr, - bool hasData = false, - uint64_t lastChangedDate = 0, - const char *lastChangedAuthorId = nullptr, - int64_t variable = 0, - int64_t oldVariable = 0) { - auto ownerId__ = ownerId ? _fbb.CreateString(ownerId) : 0; - auto lastChangedAuthorId__ = lastChangedAuthorId ? _fbb.CreateString(lastChangedAuthorId) : 0; - return CreateTusVariable( - _fbb, - ownerId__, - hasData, - lastChangedDate, - lastChangedAuthorId__, - variable, - oldVariable); + ::flatbuffers::FlatBufferBuilder& _fbb, + const char* ownerId = nullptr, + bool hasData = false, + uint64_t lastChangedDate = 0, + const char* lastChangedAuthorId = nullptr, + int64_t variable = 0, + int64_t oldVariable = 0) +{ + auto ownerId__ = ownerId ? _fbb.CreateString(ownerId) : 0; + auto lastChangedAuthorId__ = lastChangedAuthorId ? _fbb.CreateString(lastChangedAuthorId) : 0; + return CreateTusVariable( + _fbb, + ownerId__, + hasData, + lastChangedDate, + lastChangedAuthorId__, + variable, + oldVariable); } -struct TusVarResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusVarResponseBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_VARS = 4 - }; - const ::flatbuffers::Vector<::flatbuffers::Offset> *vars() const { - return GetPointer> *>(VT_VARS); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_VARS) && - verifier.VerifyVector(vars()) && - verifier.VerifyVectorOfTables(vars()) && - verifier.EndTable(); - } +struct TusVarResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusVarResponseBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_VARS = 4 + }; + const ::flatbuffers::Vector<::flatbuffers::Offset>* vars() const + { + return GetPointer>*>(VT_VARS); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_VARS) && + verifier.VerifyVector(vars()) && + verifier.VerifyVectorOfTables(vars()) && + verifier.EndTable(); + } }; -struct TusVarResponseBuilder { - typedef TusVarResponse Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_vars(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> vars) { - fbb_.AddOffset(TusVarResponse::VT_VARS, vars); - } - explicit TusVarResponseBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusVarResponseBuilder +{ + typedef TusVarResponse Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_vars(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> vars) + { + fbb_.AddOffset(TusVarResponse::VT_VARS, vars); + } + explicit TusVarResponseBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusVarResponse( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> vars = 0) { - TusVarResponseBuilder builder_(_fbb); - builder_.add_vars(vars); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> vars = 0) +{ + TusVarResponseBuilder builder_(_fbb); + builder_.add_vars(vars); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusVarResponseDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector<::flatbuffers::Offset> *vars = nullptr) { - auto vars__ = vars ? _fbb.CreateVector<::flatbuffers::Offset>(*vars) : 0; - return CreateTusVarResponse( - _fbb, - vars__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector<::flatbuffers::Offset>* vars = nullptr) +{ + auto vars__ = vars ? _fbb.CreateVector<::flatbuffers::Offset>(*vars) : 0; + return CreateTusVarResponse( + _fbb, + vars__); } -struct TusSetMultiSlotVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusSetMultiSlotVariableRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_USER = 4, - VT_SLOTIDARRAY = 6, - VT_VARIABLEARRAY = 8 - }; - const TusUser *user() const { - return GetPointer(VT_USER); - } - const ::flatbuffers::Vector *slotIdArray() const { - return GetPointer *>(VT_SLOTIDARRAY); - } - const ::flatbuffers::Vector *variableArray() const { - return GetPointer *>(VT_VARIABLEARRAY); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_USER) && - verifier.VerifyTable(user()) && - VerifyOffset(verifier, VT_SLOTIDARRAY) && - verifier.VerifyVector(slotIdArray()) && - VerifyOffset(verifier, VT_VARIABLEARRAY) && - verifier.VerifyVector(variableArray()) && - verifier.EndTable(); - } +struct TusSetMultiSlotVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusSetMultiSlotVariableRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_USER = 4, + VT_SLOTIDARRAY = 6, + VT_VARIABLEARRAY = 8 + }; + const TusUser* user() const + { + return GetPointer(VT_USER); + } + const ::flatbuffers::Vector* slotIdArray() const + { + return GetPointer*>(VT_SLOTIDARRAY); + } + const ::flatbuffers::Vector* variableArray() const + { + return GetPointer*>(VT_VARIABLEARRAY); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_USER) && + verifier.VerifyTable(user()) && + VerifyOffset(verifier, VT_SLOTIDARRAY) && + verifier.VerifyVector(slotIdArray()) && + VerifyOffset(verifier, VT_VARIABLEARRAY) && + verifier.VerifyVector(variableArray()) && + verifier.EndTable(); + } }; -struct TusSetMultiSlotVariableRequestBuilder { - typedef TusSetMultiSlotVariableRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_user(::flatbuffers::Offset user) { - fbb_.AddOffset(TusSetMultiSlotVariableRequest::VT_USER, user); - } - void add_slotIdArray(::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray) { - fbb_.AddOffset(TusSetMultiSlotVariableRequest::VT_SLOTIDARRAY, slotIdArray); - } - void add_variableArray(::flatbuffers::Offset<::flatbuffers::Vector> variableArray) { - fbb_.AddOffset(TusSetMultiSlotVariableRequest::VT_VARIABLEARRAY, variableArray); - } - explicit TusSetMultiSlotVariableRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusSetMultiSlotVariableRequestBuilder +{ + typedef TusSetMultiSlotVariableRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_user(::flatbuffers::Offset user) + { + fbb_.AddOffset(TusSetMultiSlotVariableRequest::VT_USER, user); + } + void add_slotIdArray(::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray) + { + fbb_.AddOffset(TusSetMultiSlotVariableRequest::VT_SLOTIDARRAY, slotIdArray); + } + void add_variableArray(::flatbuffers::Offset<::flatbuffers::Vector> variableArray) + { + fbb_.AddOffset(TusSetMultiSlotVariableRequest::VT_VARIABLEARRAY, variableArray); + } + explicit TusSetMultiSlotVariableRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusSetMultiSlotVariableRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> variableArray = 0) { - TusSetMultiSlotVariableRequestBuilder builder_(_fbb); - builder_.add_variableArray(variableArray); - builder_.add_slotIdArray(slotIdArray); - builder_.add_user(user); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> variableArray = 0) +{ + TusSetMultiSlotVariableRequestBuilder builder_(_fbb); + builder_.add_variableArray(variableArray); + builder_.add_slotIdArray(slotIdArray); + builder_.add_user(user); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusSetMultiSlotVariableRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - const std::vector *slotIdArray = nullptr, - const std::vector *variableArray = nullptr) { - auto slotIdArray__ = slotIdArray ? _fbb.CreateVector(*slotIdArray) : 0; - auto variableArray__ = variableArray ? _fbb.CreateVector(*variableArray) : 0; - return CreateTusSetMultiSlotVariableRequest( - _fbb, - user, - slotIdArray__, - variableArray__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + const std::vector* slotIdArray = nullptr, + const std::vector* variableArray = nullptr) +{ + auto slotIdArray__ = slotIdArray ? _fbb.CreateVector(*slotIdArray) : 0; + auto variableArray__ = variableArray ? _fbb.CreateVector(*variableArray) : 0; + return CreateTusSetMultiSlotVariableRequest( + _fbb, + user, + slotIdArray__, + variableArray__); } -struct TusGetMultiSlotVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusGetMultiSlotVariableRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_USER = 4, - VT_SLOTIDARRAY = 6 - }; - const TusUser *user() const { - return GetPointer(VT_USER); - } - const ::flatbuffers::Vector *slotIdArray() const { - return GetPointer *>(VT_SLOTIDARRAY); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_USER) && - verifier.VerifyTable(user()) && - VerifyOffset(verifier, VT_SLOTIDARRAY) && - verifier.VerifyVector(slotIdArray()) && - verifier.EndTable(); - } +struct TusGetMultiSlotVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusGetMultiSlotVariableRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_USER = 4, + VT_SLOTIDARRAY = 6 + }; + const TusUser* user() const + { + return GetPointer(VT_USER); + } + const ::flatbuffers::Vector* slotIdArray() const + { + return GetPointer*>(VT_SLOTIDARRAY); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_USER) && + verifier.VerifyTable(user()) && + VerifyOffset(verifier, VT_SLOTIDARRAY) && + verifier.VerifyVector(slotIdArray()) && + verifier.EndTable(); + } }; -struct TusGetMultiSlotVariableRequestBuilder { - typedef TusGetMultiSlotVariableRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_user(::flatbuffers::Offset user) { - fbb_.AddOffset(TusGetMultiSlotVariableRequest::VT_USER, user); - } - void add_slotIdArray(::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray) { - fbb_.AddOffset(TusGetMultiSlotVariableRequest::VT_SLOTIDARRAY, slotIdArray); - } - explicit TusGetMultiSlotVariableRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusGetMultiSlotVariableRequestBuilder +{ + typedef TusGetMultiSlotVariableRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_user(::flatbuffers::Offset user) + { + fbb_.AddOffset(TusGetMultiSlotVariableRequest::VT_USER, user); + } + void add_slotIdArray(::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray) + { + fbb_.AddOffset(TusGetMultiSlotVariableRequest::VT_SLOTIDARRAY, slotIdArray); + } + explicit TusGetMultiSlotVariableRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusGetMultiSlotVariableRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray = 0) { - TusGetMultiSlotVariableRequestBuilder builder_(_fbb); - builder_.add_slotIdArray(slotIdArray); - builder_.add_user(user); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray = 0) +{ + TusGetMultiSlotVariableRequestBuilder builder_(_fbb); + builder_.add_slotIdArray(slotIdArray); + builder_.add_user(user); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusGetMultiSlotVariableRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - const std::vector *slotIdArray = nullptr) { - auto slotIdArray__ = slotIdArray ? _fbb.CreateVector(*slotIdArray) : 0; - return CreateTusGetMultiSlotVariableRequest( - _fbb, - user, - slotIdArray__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + const std::vector* slotIdArray = nullptr) +{ + auto slotIdArray__ = slotIdArray ? _fbb.CreateVector(*slotIdArray) : 0; + return CreateTusGetMultiSlotVariableRequest( + _fbb, + user, + slotIdArray__); } -struct TusGetMultiUserVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusGetMultiUserVariableRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_USERS = 4, - VT_SLOTID = 6 - }; - const ::flatbuffers::Vector<::flatbuffers::Offset> *users() const { - return GetPointer> *>(VT_USERS); - } - int32_t slotId() const { - return GetField(VT_SLOTID, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_USERS) && - verifier.VerifyVector(users()) && - verifier.VerifyVectorOfTables(users()) && - VerifyField(verifier, VT_SLOTID, 4) && - verifier.EndTable(); - } +struct TusGetMultiUserVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusGetMultiUserVariableRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_USERS = 4, + VT_SLOTID = 6 + }; + const ::flatbuffers::Vector<::flatbuffers::Offset>* users() const + { + return GetPointer>*>(VT_USERS); + } + int32_t slotId() const + { + return GetField(VT_SLOTID, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_USERS) && + verifier.VerifyVector(users()) && + verifier.VerifyVectorOfTables(users()) && + VerifyField(verifier, VT_SLOTID, 4) && + verifier.EndTable(); + } }; -struct TusGetMultiUserVariableRequestBuilder { - typedef TusGetMultiUserVariableRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_users(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> users) { - fbb_.AddOffset(TusGetMultiUserVariableRequest::VT_USERS, users); - } - void add_slotId(int32_t slotId) { - fbb_.AddElement(TusGetMultiUserVariableRequest::VT_SLOTID, slotId, 0); - } - explicit TusGetMultiUserVariableRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusGetMultiUserVariableRequestBuilder +{ + typedef TusGetMultiUserVariableRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_users(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> users) + { + fbb_.AddOffset(TusGetMultiUserVariableRequest::VT_USERS, users); + } + void add_slotId(int32_t slotId) + { + fbb_.AddElement(TusGetMultiUserVariableRequest::VT_SLOTID, slotId, 0); + } + explicit TusGetMultiUserVariableRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusGetMultiUserVariableRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> users = 0, - int32_t slotId = 0) { - TusGetMultiUserVariableRequestBuilder builder_(_fbb); - builder_.add_slotId(slotId); - builder_.add_users(users); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> users = 0, + int32_t slotId = 0) +{ + TusGetMultiUserVariableRequestBuilder builder_(_fbb); + builder_.add_slotId(slotId); + builder_.add_users(users); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusGetMultiUserVariableRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector<::flatbuffers::Offset> *users = nullptr, - int32_t slotId = 0) { - auto users__ = users ? _fbb.CreateVector<::flatbuffers::Offset>(*users) : 0; - return CreateTusGetMultiUserVariableRequest( - _fbb, - users__, - slotId); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector<::flatbuffers::Offset>* users = nullptr, + int32_t slotId = 0) +{ + auto users__ = users ? _fbb.CreateVector<::flatbuffers::Offset>(*users) : 0; + return CreateTusGetMultiUserVariableRequest( + _fbb, + users__, + slotId); } -struct TusGetFriendsVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusGetFriendsVariableRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SLOTID = 4, - VT_INCLUDESELF = 6, - VT_SORTTYPE = 8, - VT_ARRAYNUM = 10 - }; - int32_t slotId() const { - return GetField(VT_SLOTID, 0); - } - bool includeSelf() const { - return GetField(VT_INCLUDESELF, 0) != 0; - } - int32_t sortType() const { - return GetField(VT_SORTTYPE, 0); - } - uint32_t arrayNum() const { - return GetField(VT_ARRAYNUM, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_SLOTID, 4) && - VerifyField(verifier, VT_INCLUDESELF, 1) && - VerifyField(verifier, VT_SORTTYPE, 4) && - VerifyField(verifier, VT_ARRAYNUM, 4) && - verifier.EndTable(); - } +struct TusGetFriendsVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusGetFriendsVariableRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_SLOTID = 4, + VT_INCLUDESELF = 6, + VT_SORTTYPE = 8, + VT_ARRAYNUM = 10 + }; + int32_t slotId() const + { + return GetField(VT_SLOTID, 0); + } + bool includeSelf() const + { + return GetField(VT_INCLUDESELF, 0) != 0; + } + int32_t sortType() const + { + return GetField(VT_SORTTYPE, 0); + } + uint32_t arrayNum() const + { + return GetField(VT_ARRAYNUM, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_SLOTID, 4) && + VerifyField(verifier, VT_INCLUDESELF, 1) && + VerifyField(verifier, VT_SORTTYPE, 4) && + VerifyField(verifier, VT_ARRAYNUM, 4) && + verifier.EndTable(); + } }; -struct TusGetFriendsVariableRequestBuilder { - typedef TusGetFriendsVariableRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_slotId(int32_t slotId) { - fbb_.AddElement(TusGetFriendsVariableRequest::VT_SLOTID, slotId, 0); - } - void add_includeSelf(bool includeSelf) { - fbb_.AddElement(TusGetFriendsVariableRequest::VT_INCLUDESELF, static_cast(includeSelf), 0); - } - void add_sortType(int32_t sortType) { - fbb_.AddElement(TusGetFriendsVariableRequest::VT_SORTTYPE, sortType, 0); - } - void add_arrayNum(uint32_t arrayNum) { - fbb_.AddElement(TusGetFriendsVariableRequest::VT_ARRAYNUM, arrayNum, 0); - } - explicit TusGetFriendsVariableRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusGetFriendsVariableRequestBuilder +{ + typedef TusGetFriendsVariableRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_slotId(int32_t slotId) + { + fbb_.AddElement(TusGetFriendsVariableRequest::VT_SLOTID, slotId, 0); + } + void add_includeSelf(bool includeSelf) + { + fbb_.AddElement(TusGetFriendsVariableRequest::VT_INCLUDESELF, static_cast(includeSelf), 0); + } + void add_sortType(int32_t sortType) + { + fbb_.AddElement(TusGetFriendsVariableRequest::VT_SORTTYPE, sortType, 0); + } + void add_arrayNum(uint32_t arrayNum) + { + fbb_.AddElement(TusGetFriendsVariableRequest::VT_ARRAYNUM, arrayNum, 0); + } + explicit TusGetFriendsVariableRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusGetFriendsVariableRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - int32_t slotId = 0, - bool includeSelf = false, - int32_t sortType = 0, - uint32_t arrayNum = 0) { - TusGetFriendsVariableRequestBuilder builder_(_fbb); - builder_.add_arrayNum(arrayNum); - builder_.add_sortType(sortType); - builder_.add_slotId(slotId); - builder_.add_includeSelf(includeSelf); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + int32_t slotId = 0, + bool includeSelf = false, + int32_t sortType = 0, + uint32_t arrayNum = 0) +{ + TusGetFriendsVariableRequestBuilder builder_(_fbb); + builder_.add_arrayNum(arrayNum); + builder_.add_sortType(sortType); + builder_.add_slotId(slotId); + builder_.add_includeSelf(includeSelf); + return builder_.Finish(); } -struct TusAddAndGetVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusAddAndGetVariableRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_USER = 4, - VT_SLOTID = 6, - VT_INVARIABLE = 8, - VT_ISLASTCHANGEDDATE = 10, - VT_ISLASTCHANGEDAUTHORID = 12 - }; - const TusUser *user() const { - return GetPointer(VT_USER); - } - int32_t slotId() const { - return GetField(VT_SLOTID, 0); - } - int64_t inVariable() const { - return GetField(VT_INVARIABLE, 0); - } - const ::flatbuffers::Vector *isLastChangedDate() const { - return GetPointer *>(VT_ISLASTCHANGEDDATE); - } - const ::flatbuffers::String *isLastChangedAuthorId() const { - return GetPointer(VT_ISLASTCHANGEDAUTHORID); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_USER) && - verifier.VerifyTable(user()) && - VerifyField(verifier, VT_SLOTID, 4) && - VerifyField(verifier, VT_INVARIABLE, 8) && - VerifyOffset(verifier, VT_ISLASTCHANGEDDATE) && - verifier.VerifyVector(isLastChangedDate()) && - VerifyOffset(verifier, VT_ISLASTCHANGEDAUTHORID) && - verifier.VerifyString(isLastChangedAuthorId()) && - verifier.EndTable(); - } +struct TusAddAndGetVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusAddAndGetVariableRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_USER = 4, + VT_SLOTID = 6, + VT_INVARIABLE = 8, + VT_ISLASTCHANGEDDATE = 10, + VT_ISLASTCHANGEDAUTHORID = 12 + }; + const TusUser* user() const + { + return GetPointer(VT_USER); + } + int32_t slotId() const + { + return GetField(VT_SLOTID, 0); + } + int64_t inVariable() const + { + return GetField(VT_INVARIABLE, 0); + } + const ::flatbuffers::Vector* isLastChangedDate() const + { + return GetPointer*>(VT_ISLASTCHANGEDDATE); + } + const ::flatbuffers::String* isLastChangedAuthorId() const + { + return GetPointer(VT_ISLASTCHANGEDAUTHORID); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_USER) && + verifier.VerifyTable(user()) && + VerifyField(verifier, VT_SLOTID, 4) && + VerifyField(verifier, VT_INVARIABLE, 8) && + VerifyOffset(verifier, VT_ISLASTCHANGEDDATE) && + verifier.VerifyVector(isLastChangedDate()) && + VerifyOffset(verifier, VT_ISLASTCHANGEDAUTHORID) && + verifier.VerifyString(isLastChangedAuthorId()) && + verifier.EndTable(); + } }; -struct TusAddAndGetVariableRequestBuilder { - typedef TusAddAndGetVariableRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_user(::flatbuffers::Offset user) { - fbb_.AddOffset(TusAddAndGetVariableRequest::VT_USER, user); - } - void add_slotId(int32_t slotId) { - fbb_.AddElement(TusAddAndGetVariableRequest::VT_SLOTID, slotId, 0); - } - void add_inVariable(int64_t inVariable) { - fbb_.AddElement(TusAddAndGetVariableRequest::VT_INVARIABLE, inVariable, 0); - } - void add_isLastChangedDate(::flatbuffers::Offset<::flatbuffers::Vector> isLastChangedDate) { - fbb_.AddOffset(TusAddAndGetVariableRequest::VT_ISLASTCHANGEDDATE, isLastChangedDate); - } - void add_isLastChangedAuthorId(::flatbuffers::Offset<::flatbuffers::String> isLastChangedAuthorId) { - fbb_.AddOffset(TusAddAndGetVariableRequest::VT_ISLASTCHANGEDAUTHORID, isLastChangedAuthorId); - } - explicit TusAddAndGetVariableRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusAddAndGetVariableRequestBuilder +{ + typedef TusAddAndGetVariableRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_user(::flatbuffers::Offset user) + { + fbb_.AddOffset(TusAddAndGetVariableRequest::VT_USER, user); + } + void add_slotId(int32_t slotId) + { + fbb_.AddElement(TusAddAndGetVariableRequest::VT_SLOTID, slotId, 0); + } + void add_inVariable(int64_t inVariable) + { + fbb_.AddElement(TusAddAndGetVariableRequest::VT_INVARIABLE, inVariable, 0); + } + void add_isLastChangedDate(::flatbuffers::Offset<::flatbuffers::Vector> isLastChangedDate) + { + fbb_.AddOffset(TusAddAndGetVariableRequest::VT_ISLASTCHANGEDDATE, isLastChangedDate); + } + void add_isLastChangedAuthorId(::flatbuffers::Offset<::flatbuffers::String> isLastChangedAuthorId) + { + fbb_.AddOffset(TusAddAndGetVariableRequest::VT_ISLASTCHANGEDAUTHORID, isLastChangedAuthorId); + } + explicit TusAddAndGetVariableRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusAddAndGetVariableRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - int32_t slotId = 0, - int64_t inVariable = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> isLastChangedDate = 0, - ::flatbuffers::Offset<::flatbuffers::String> isLastChangedAuthorId = 0) { - TusAddAndGetVariableRequestBuilder builder_(_fbb); - builder_.add_inVariable(inVariable); - builder_.add_isLastChangedAuthorId(isLastChangedAuthorId); - builder_.add_isLastChangedDate(isLastChangedDate); - builder_.add_slotId(slotId); - builder_.add_user(user); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + int32_t slotId = 0, + int64_t inVariable = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> isLastChangedDate = 0, + ::flatbuffers::Offset<::flatbuffers::String> isLastChangedAuthorId = 0) +{ + TusAddAndGetVariableRequestBuilder builder_(_fbb); + builder_.add_inVariable(inVariable); + builder_.add_isLastChangedAuthorId(isLastChangedAuthorId); + builder_.add_isLastChangedDate(isLastChangedDate); + builder_.add_slotId(slotId); + builder_.add_user(user); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusAddAndGetVariableRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - int32_t slotId = 0, - int64_t inVariable = 0, - const std::vector *isLastChangedDate = nullptr, - const char *isLastChangedAuthorId = nullptr) { - auto isLastChangedDate__ = isLastChangedDate ? _fbb.CreateVector(*isLastChangedDate) : 0; - auto isLastChangedAuthorId__ = isLastChangedAuthorId ? _fbb.CreateString(isLastChangedAuthorId) : 0; - return CreateTusAddAndGetVariableRequest( - _fbb, - user, - slotId, - inVariable, - isLastChangedDate__, - isLastChangedAuthorId__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + int32_t slotId = 0, + int64_t inVariable = 0, + const std::vector* isLastChangedDate = nullptr, + const char* isLastChangedAuthorId = nullptr) +{ + auto isLastChangedDate__ = isLastChangedDate ? _fbb.CreateVector(*isLastChangedDate) : 0; + auto isLastChangedAuthorId__ = isLastChangedAuthorId ? _fbb.CreateString(isLastChangedAuthorId) : 0; + return CreateTusAddAndGetVariableRequest( + _fbb, + user, + slotId, + inVariable, + isLastChangedDate__, + isLastChangedAuthorId__); } -struct TusTryAndSetVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusTryAndSetVariableRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_USER = 4, - VT_SLOTID = 6, - VT_OPETYPE = 8, - VT_VARIABLE = 10, - VT_ISLASTCHANGEDDATE = 12, - VT_ISLASTCHANGEDAUTHORID = 14, - VT_COMPAREVALUE = 16 - }; - const TusUser *user() const { - return GetPointer(VT_USER); - } - int32_t slotId() const { - return GetField(VT_SLOTID, 0); - } - int32_t opeType() const { - return GetField(VT_OPETYPE, 0); - } - int64_t variable() const { - return GetField(VT_VARIABLE, 0); - } - const ::flatbuffers::Vector *isLastChangedDate() const { - return GetPointer *>(VT_ISLASTCHANGEDDATE); - } - const ::flatbuffers::String *isLastChangedAuthorId() const { - return GetPointer(VT_ISLASTCHANGEDAUTHORID); - } - const ::flatbuffers::Vector *compareValue() const { - return GetPointer *>(VT_COMPAREVALUE); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_USER) && - verifier.VerifyTable(user()) && - VerifyField(verifier, VT_SLOTID, 4) && - VerifyField(verifier, VT_OPETYPE, 4) && - VerifyField(verifier, VT_VARIABLE, 8) && - VerifyOffset(verifier, VT_ISLASTCHANGEDDATE) && - verifier.VerifyVector(isLastChangedDate()) && - VerifyOffset(verifier, VT_ISLASTCHANGEDAUTHORID) && - verifier.VerifyString(isLastChangedAuthorId()) && - VerifyOffset(verifier, VT_COMPAREVALUE) && - verifier.VerifyVector(compareValue()) && - verifier.EndTable(); - } +struct TusTryAndSetVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusTryAndSetVariableRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_USER = 4, + VT_SLOTID = 6, + VT_OPETYPE = 8, + VT_VARIABLE = 10, + VT_ISLASTCHANGEDDATE = 12, + VT_ISLASTCHANGEDAUTHORID = 14, + VT_COMPAREVALUE = 16 + }; + const TusUser* user() const + { + return GetPointer(VT_USER); + } + int32_t slotId() const + { + return GetField(VT_SLOTID, 0); + } + int32_t opeType() const + { + return GetField(VT_OPETYPE, 0); + } + int64_t variable() const + { + return GetField(VT_VARIABLE, 0); + } + const ::flatbuffers::Vector* isLastChangedDate() const + { + return GetPointer*>(VT_ISLASTCHANGEDDATE); + } + const ::flatbuffers::String* isLastChangedAuthorId() const + { + return GetPointer(VT_ISLASTCHANGEDAUTHORID); + } + const ::flatbuffers::Vector* compareValue() const + { + return GetPointer*>(VT_COMPAREVALUE); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_USER) && + verifier.VerifyTable(user()) && + VerifyField(verifier, VT_SLOTID, 4) && + VerifyField(verifier, VT_OPETYPE, 4) && + VerifyField(verifier, VT_VARIABLE, 8) && + VerifyOffset(verifier, VT_ISLASTCHANGEDDATE) && + verifier.VerifyVector(isLastChangedDate()) && + VerifyOffset(verifier, VT_ISLASTCHANGEDAUTHORID) && + verifier.VerifyString(isLastChangedAuthorId()) && + VerifyOffset(verifier, VT_COMPAREVALUE) && + verifier.VerifyVector(compareValue()) && + verifier.EndTable(); + } }; -struct TusTryAndSetVariableRequestBuilder { - typedef TusTryAndSetVariableRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_user(::flatbuffers::Offset user) { - fbb_.AddOffset(TusTryAndSetVariableRequest::VT_USER, user); - } - void add_slotId(int32_t slotId) { - fbb_.AddElement(TusTryAndSetVariableRequest::VT_SLOTID, slotId, 0); - } - void add_opeType(int32_t opeType) { - fbb_.AddElement(TusTryAndSetVariableRequest::VT_OPETYPE, opeType, 0); - } - void add_variable(int64_t variable) { - fbb_.AddElement(TusTryAndSetVariableRequest::VT_VARIABLE, variable, 0); - } - void add_isLastChangedDate(::flatbuffers::Offset<::flatbuffers::Vector> isLastChangedDate) { - fbb_.AddOffset(TusTryAndSetVariableRequest::VT_ISLASTCHANGEDDATE, isLastChangedDate); - } - void add_isLastChangedAuthorId(::flatbuffers::Offset<::flatbuffers::String> isLastChangedAuthorId) { - fbb_.AddOffset(TusTryAndSetVariableRequest::VT_ISLASTCHANGEDAUTHORID, isLastChangedAuthorId); - } - void add_compareValue(::flatbuffers::Offset<::flatbuffers::Vector> compareValue) { - fbb_.AddOffset(TusTryAndSetVariableRequest::VT_COMPAREVALUE, compareValue); - } - explicit TusTryAndSetVariableRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusTryAndSetVariableRequestBuilder +{ + typedef TusTryAndSetVariableRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_user(::flatbuffers::Offset user) + { + fbb_.AddOffset(TusTryAndSetVariableRequest::VT_USER, user); + } + void add_slotId(int32_t slotId) + { + fbb_.AddElement(TusTryAndSetVariableRequest::VT_SLOTID, slotId, 0); + } + void add_opeType(int32_t opeType) + { + fbb_.AddElement(TusTryAndSetVariableRequest::VT_OPETYPE, opeType, 0); + } + void add_variable(int64_t variable) + { + fbb_.AddElement(TusTryAndSetVariableRequest::VT_VARIABLE, variable, 0); + } + void add_isLastChangedDate(::flatbuffers::Offset<::flatbuffers::Vector> isLastChangedDate) + { + fbb_.AddOffset(TusTryAndSetVariableRequest::VT_ISLASTCHANGEDDATE, isLastChangedDate); + } + void add_isLastChangedAuthorId(::flatbuffers::Offset<::flatbuffers::String> isLastChangedAuthorId) + { + fbb_.AddOffset(TusTryAndSetVariableRequest::VT_ISLASTCHANGEDAUTHORID, isLastChangedAuthorId); + } + void add_compareValue(::flatbuffers::Offset<::flatbuffers::Vector> compareValue) + { + fbb_.AddOffset(TusTryAndSetVariableRequest::VT_COMPAREVALUE, compareValue); + } + explicit TusTryAndSetVariableRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusTryAndSetVariableRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - int32_t slotId = 0, - int32_t opeType = 0, - int64_t variable = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> isLastChangedDate = 0, - ::flatbuffers::Offset<::flatbuffers::String> isLastChangedAuthorId = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> compareValue = 0) { - TusTryAndSetVariableRequestBuilder builder_(_fbb); - builder_.add_variable(variable); - builder_.add_compareValue(compareValue); - builder_.add_isLastChangedAuthorId(isLastChangedAuthorId); - builder_.add_isLastChangedDate(isLastChangedDate); - builder_.add_opeType(opeType); - builder_.add_slotId(slotId); - builder_.add_user(user); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + int32_t slotId = 0, + int32_t opeType = 0, + int64_t variable = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> isLastChangedDate = 0, + ::flatbuffers::Offset<::flatbuffers::String> isLastChangedAuthorId = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> compareValue = 0) +{ + TusTryAndSetVariableRequestBuilder builder_(_fbb); + builder_.add_variable(variable); + builder_.add_compareValue(compareValue); + builder_.add_isLastChangedAuthorId(isLastChangedAuthorId); + builder_.add_isLastChangedDate(isLastChangedDate); + builder_.add_opeType(opeType); + builder_.add_slotId(slotId); + builder_.add_user(user); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusTryAndSetVariableRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - int32_t slotId = 0, - int32_t opeType = 0, - int64_t variable = 0, - const std::vector *isLastChangedDate = nullptr, - const char *isLastChangedAuthorId = nullptr, - const std::vector *compareValue = nullptr) { - auto isLastChangedDate__ = isLastChangedDate ? _fbb.CreateVector(*isLastChangedDate) : 0; - auto isLastChangedAuthorId__ = isLastChangedAuthorId ? _fbb.CreateString(isLastChangedAuthorId) : 0; - auto compareValue__ = compareValue ? _fbb.CreateVector(*compareValue) : 0; - return CreateTusTryAndSetVariableRequest( - _fbb, - user, - slotId, - opeType, - variable, - isLastChangedDate__, - isLastChangedAuthorId__, - compareValue__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + int32_t slotId = 0, + int32_t opeType = 0, + int64_t variable = 0, + const std::vector* isLastChangedDate = nullptr, + const char* isLastChangedAuthorId = nullptr, + const std::vector* compareValue = nullptr) +{ + auto isLastChangedDate__ = isLastChangedDate ? _fbb.CreateVector(*isLastChangedDate) : 0; + auto isLastChangedAuthorId__ = isLastChangedAuthorId ? _fbb.CreateString(isLastChangedAuthorId) : 0; + auto compareValue__ = compareValue ? _fbb.CreateVector(*compareValue) : 0; + return CreateTusTryAndSetVariableRequest( + _fbb, + user, + slotId, + opeType, + variable, + isLastChangedDate__, + isLastChangedAuthorId__, + compareValue__); } -struct TusDeleteMultiSlotVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusDeleteMultiSlotVariableRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_USER = 4, - VT_SLOTIDARRAY = 6 - }; - const TusUser *user() const { - return GetPointer(VT_USER); - } - const ::flatbuffers::Vector *slotIdArray() const { - return GetPointer *>(VT_SLOTIDARRAY); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_USER) && - verifier.VerifyTable(user()) && - VerifyOffset(verifier, VT_SLOTIDARRAY) && - verifier.VerifyVector(slotIdArray()) && - verifier.EndTable(); - } +struct TusDeleteMultiSlotVariableRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusDeleteMultiSlotVariableRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_USER = 4, + VT_SLOTIDARRAY = 6 + }; + const TusUser* user() const + { + return GetPointer(VT_USER); + } + const ::flatbuffers::Vector* slotIdArray() const + { + return GetPointer*>(VT_SLOTIDARRAY); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_USER) && + verifier.VerifyTable(user()) && + VerifyOffset(verifier, VT_SLOTIDARRAY) && + verifier.VerifyVector(slotIdArray()) && + verifier.EndTable(); + } }; -struct TusDeleteMultiSlotVariableRequestBuilder { - typedef TusDeleteMultiSlotVariableRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_user(::flatbuffers::Offset user) { - fbb_.AddOffset(TusDeleteMultiSlotVariableRequest::VT_USER, user); - } - void add_slotIdArray(::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray) { - fbb_.AddOffset(TusDeleteMultiSlotVariableRequest::VT_SLOTIDARRAY, slotIdArray); - } - explicit TusDeleteMultiSlotVariableRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusDeleteMultiSlotVariableRequestBuilder +{ + typedef TusDeleteMultiSlotVariableRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_user(::flatbuffers::Offset user) + { + fbb_.AddOffset(TusDeleteMultiSlotVariableRequest::VT_USER, user); + } + void add_slotIdArray(::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray) + { + fbb_.AddOffset(TusDeleteMultiSlotVariableRequest::VT_SLOTIDARRAY, slotIdArray); + } + explicit TusDeleteMultiSlotVariableRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusDeleteMultiSlotVariableRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray = 0) { - TusDeleteMultiSlotVariableRequestBuilder builder_(_fbb); - builder_.add_slotIdArray(slotIdArray); - builder_.add_user(user); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray = 0) +{ + TusDeleteMultiSlotVariableRequestBuilder builder_(_fbb); + builder_.add_slotIdArray(slotIdArray); + builder_.add_user(user); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusDeleteMultiSlotVariableRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - const std::vector *slotIdArray = nullptr) { - auto slotIdArray__ = slotIdArray ? _fbb.CreateVector(*slotIdArray) : 0; - return CreateTusDeleteMultiSlotVariableRequest( - _fbb, - user, - slotIdArray__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + const std::vector* slotIdArray = nullptr) +{ + auto slotIdArray__ = slotIdArray ? _fbb.CreateVector(*slotIdArray) : 0; + return CreateTusDeleteMultiSlotVariableRequest( + _fbb, + user, + slotIdArray__); } -struct TusSetDataRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusSetDataRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_USER = 4, - VT_SLOTID = 6, - VT_DATA = 8, - VT_INFO = 10, - VT_ISLASTCHANGEDDATE = 12, - VT_ISLASTCHANGEDAUTHORID = 14 - }; - const TusUser *user() const { - return GetPointer(VT_USER); - } - int32_t slotId() const { - return GetField(VT_SLOTID, 0); - } - const ::flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); - } - const ::flatbuffers::Vector *info() const { - return GetPointer *>(VT_INFO); - } - const ::flatbuffers::Vector *isLastChangedDate() const { - return GetPointer *>(VT_ISLASTCHANGEDDATE); - } - const ::flatbuffers::String *isLastChangedAuthorId() const { - return GetPointer(VT_ISLASTCHANGEDAUTHORID); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_USER) && - verifier.VerifyTable(user()) && - VerifyField(verifier, VT_SLOTID, 4) && - VerifyOffset(verifier, VT_DATA) && - verifier.VerifyVector(data()) && - VerifyOffset(verifier, VT_INFO) && - verifier.VerifyVector(info()) && - VerifyOffset(verifier, VT_ISLASTCHANGEDDATE) && - verifier.VerifyVector(isLastChangedDate()) && - VerifyOffset(verifier, VT_ISLASTCHANGEDAUTHORID) && - verifier.VerifyString(isLastChangedAuthorId()) && - verifier.EndTable(); - } +struct TusSetDataRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusSetDataRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_USER = 4, + VT_SLOTID = 6, + VT_DATA = 8, + VT_INFO = 10, + VT_ISLASTCHANGEDDATE = 12, + VT_ISLASTCHANGEDAUTHORID = 14 + }; + const TusUser* user() const + { + return GetPointer(VT_USER); + } + int32_t slotId() const + { + return GetField(VT_SLOTID, 0); + } + const ::flatbuffers::Vector* data() const + { + return GetPointer*>(VT_DATA); + } + const ::flatbuffers::Vector* info() const + { + return GetPointer*>(VT_INFO); + } + const ::flatbuffers::Vector* isLastChangedDate() const + { + return GetPointer*>(VT_ISLASTCHANGEDDATE); + } + const ::flatbuffers::String* isLastChangedAuthorId() const + { + return GetPointer(VT_ISLASTCHANGEDAUTHORID); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_USER) && + verifier.VerifyTable(user()) && + VerifyField(verifier, VT_SLOTID, 4) && + VerifyOffset(verifier, VT_DATA) && + verifier.VerifyVector(data()) && + VerifyOffset(verifier, VT_INFO) && + verifier.VerifyVector(info()) && + VerifyOffset(verifier, VT_ISLASTCHANGEDDATE) && + verifier.VerifyVector(isLastChangedDate()) && + VerifyOffset(verifier, VT_ISLASTCHANGEDAUTHORID) && + verifier.VerifyString(isLastChangedAuthorId()) && + verifier.EndTable(); + } }; -struct TusSetDataRequestBuilder { - typedef TusSetDataRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_user(::flatbuffers::Offset user) { - fbb_.AddOffset(TusSetDataRequest::VT_USER, user); - } - void add_slotId(int32_t slotId) { - fbb_.AddElement(TusSetDataRequest::VT_SLOTID, slotId, 0); - } - void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { - fbb_.AddOffset(TusSetDataRequest::VT_DATA, data); - } - void add_info(::flatbuffers::Offset<::flatbuffers::Vector> info) { - fbb_.AddOffset(TusSetDataRequest::VT_INFO, info); - } - void add_isLastChangedDate(::flatbuffers::Offset<::flatbuffers::Vector> isLastChangedDate) { - fbb_.AddOffset(TusSetDataRequest::VT_ISLASTCHANGEDDATE, isLastChangedDate); - } - void add_isLastChangedAuthorId(::flatbuffers::Offset<::flatbuffers::String> isLastChangedAuthorId) { - fbb_.AddOffset(TusSetDataRequest::VT_ISLASTCHANGEDAUTHORID, isLastChangedAuthorId); - } - explicit TusSetDataRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusSetDataRequestBuilder +{ + typedef TusSetDataRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_user(::flatbuffers::Offset user) + { + fbb_.AddOffset(TusSetDataRequest::VT_USER, user); + } + void add_slotId(int32_t slotId) + { + fbb_.AddElement(TusSetDataRequest::VT_SLOTID, slotId, 0); + } + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) + { + fbb_.AddOffset(TusSetDataRequest::VT_DATA, data); + } + void add_info(::flatbuffers::Offset<::flatbuffers::Vector> info) + { + fbb_.AddOffset(TusSetDataRequest::VT_INFO, info); + } + void add_isLastChangedDate(::flatbuffers::Offset<::flatbuffers::Vector> isLastChangedDate) + { + fbb_.AddOffset(TusSetDataRequest::VT_ISLASTCHANGEDDATE, isLastChangedDate); + } + void add_isLastChangedAuthorId(::flatbuffers::Offset<::flatbuffers::String> isLastChangedAuthorId) + { + fbb_.AddOffset(TusSetDataRequest::VT_ISLASTCHANGEDAUTHORID, isLastChangedAuthorId); + } + explicit TusSetDataRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusSetDataRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - int32_t slotId = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> data = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> info = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> isLastChangedDate = 0, - ::flatbuffers::Offset<::flatbuffers::String> isLastChangedAuthorId = 0) { - TusSetDataRequestBuilder builder_(_fbb); - builder_.add_isLastChangedAuthorId(isLastChangedAuthorId); - builder_.add_isLastChangedDate(isLastChangedDate); - builder_.add_info(info); - builder_.add_data(data); - builder_.add_slotId(slotId); - builder_.add_user(user); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + int32_t slotId = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> info = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> isLastChangedDate = 0, + ::flatbuffers::Offset<::flatbuffers::String> isLastChangedAuthorId = 0) +{ + TusSetDataRequestBuilder builder_(_fbb); + builder_.add_isLastChangedAuthorId(isLastChangedAuthorId); + builder_.add_isLastChangedDate(isLastChangedDate); + builder_.add_info(info); + builder_.add_data(data); + builder_.add_slotId(slotId); + builder_.add_user(user); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusSetDataRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - int32_t slotId = 0, - const std::vector *data = nullptr, - const std::vector *info = nullptr, - const std::vector *isLastChangedDate = nullptr, - const char *isLastChangedAuthorId = nullptr) { - auto data__ = data ? _fbb.CreateVector(*data) : 0; - auto info__ = info ? _fbb.CreateVector(*info) : 0; - auto isLastChangedDate__ = isLastChangedDate ? _fbb.CreateVector(*isLastChangedDate) : 0; - auto isLastChangedAuthorId__ = isLastChangedAuthorId ? _fbb.CreateString(isLastChangedAuthorId) : 0; - return CreateTusSetDataRequest( - _fbb, - user, - slotId, - data__, - info__, - isLastChangedDate__, - isLastChangedAuthorId__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + int32_t slotId = 0, + const std::vector* data = nullptr, + const std::vector* info = nullptr, + const std::vector* isLastChangedDate = nullptr, + const char* isLastChangedAuthorId = nullptr) +{ + auto data__ = data ? _fbb.CreateVector(*data) : 0; + auto info__ = info ? _fbb.CreateVector(*info) : 0; + auto isLastChangedDate__ = isLastChangedDate ? _fbb.CreateVector(*isLastChangedDate) : 0; + auto isLastChangedAuthorId__ = isLastChangedAuthorId ? _fbb.CreateString(isLastChangedAuthorId) : 0; + return CreateTusSetDataRequest( + _fbb, + user, + slotId, + data__, + info__, + isLastChangedDate__, + isLastChangedAuthorId__); } -struct TusDataStatus FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusDataStatusBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_OWNERID = 4, - VT_HASDATA = 6, - VT_LASTCHANGEDDATE = 8, - VT_LASTCHANGEDAUTHORID = 10, - VT_INFO = 12 - }; - const ::flatbuffers::String *ownerId() const { - return GetPointer(VT_OWNERID); - } - bool hasData() const { - return GetField(VT_HASDATA, 0) != 0; - } - uint64_t lastChangedDate() const { - return GetField(VT_LASTCHANGEDDATE, 0); - } - const ::flatbuffers::String *lastChangedAuthorId() const { - return GetPointer(VT_LASTCHANGEDAUTHORID); - } - const ::flatbuffers::Vector *info() const { - return GetPointer *>(VT_INFO); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_OWNERID) && - verifier.VerifyString(ownerId()) && - VerifyField(verifier, VT_HASDATA, 1) && - VerifyField(verifier, VT_LASTCHANGEDDATE, 8) && - VerifyOffset(verifier, VT_LASTCHANGEDAUTHORID) && - verifier.VerifyString(lastChangedAuthorId()) && - VerifyOffset(verifier, VT_INFO) && - verifier.VerifyVector(info()) && - verifier.EndTable(); - } +struct TusDataStatus FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusDataStatusBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_OWNERID = 4, + VT_HASDATA = 6, + VT_LASTCHANGEDDATE = 8, + VT_LASTCHANGEDAUTHORID = 10, + VT_INFO = 12 + }; + const ::flatbuffers::String* ownerId() const + { + return GetPointer(VT_OWNERID); + } + bool hasData() const + { + return GetField(VT_HASDATA, 0) != 0; + } + uint64_t lastChangedDate() const + { + return GetField(VT_LASTCHANGEDDATE, 0); + } + const ::flatbuffers::String* lastChangedAuthorId() const + { + return GetPointer(VT_LASTCHANGEDAUTHORID); + } + const ::flatbuffers::Vector* info() const + { + return GetPointer*>(VT_INFO); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_OWNERID) && + verifier.VerifyString(ownerId()) && + VerifyField(verifier, VT_HASDATA, 1) && + VerifyField(verifier, VT_LASTCHANGEDDATE, 8) && + VerifyOffset(verifier, VT_LASTCHANGEDAUTHORID) && + verifier.VerifyString(lastChangedAuthorId()) && + VerifyOffset(verifier, VT_INFO) && + verifier.VerifyVector(info()) && + verifier.EndTable(); + } }; -struct TusDataStatusBuilder { - typedef TusDataStatus Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_ownerId(::flatbuffers::Offset<::flatbuffers::String> ownerId) { - fbb_.AddOffset(TusDataStatus::VT_OWNERID, ownerId); - } - void add_hasData(bool hasData) { - fbb_.AddElement(TusDataStatus::VT_HASDATA, static_cast(hasData), 0); - } - void add_lastChangedDate(uint64_t lastChangedDate) { - fbb_.AddElement(TusDataStatus::VT_LASTCHANGEDDATE, lastChangedDate, 0); - } - void add_lastChangedAuthorId(::flatbuffers::Offset<::flatbuffers::String> lastChangedAuthorId) { - fbb_.AddOffset(TusDataStatus::VT_LASTCHANGEDAUTHORID, lastChangedAuthorId); - } - void add_info(::flatbuffers::Offset<::flatbuffers::Vector> info) { - fbb_.AddOffset(TusDataStatus::VT_INFO, info); - } - explicit TusDataStatusBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusDataStatusBuilder +{ + typedef TusDataStatus Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_ownerId(::flatbuffers::Offset<::flatbuffers::String> ownerId) + { + fbb_.AddOffset(TusDataStatus::VT_OWNERID, ownerId); + } + void add_hasData(bool hasData) + { + fbb_.AddElement(TusDataStatus::VT_HASDATA, static_cast(hasData), 0); + } + void add_lastChangedDate(uint64_t lastChangedDate) + { + fbb_.AddElement(TusDataStatus::VT_LASTCHANGEDDATE, lastChangedDate, 0); + } + void add_lastChangedAuthorId(::flatbuffers::Offset<::flatbuffers::String> lastChangedAuthorId) + { + fbb_.AddOffset(TusDataStatus::VT_LASTCHANGEDAUTHORID, lastChangedAuthorId); + } + void add_info(::flatbuffers::Offset<::flatbuffers::Vector> info) + { + fbb_.AddOffset(TusDataStatus::VT_INFO, info); + } + explicit TusDataStatusBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusDataStatus( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::String> ownerId = 0, - bool hasData = false, - uint64_t lastChangedDate = 0, - ::flatbuffers::Offset<::flatbuffers::String> lastChangedAuthorId = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> info = 0) { - TusDataStatusBuilder builder_(_fbb); - builder_.add_lastChangedDate(lastChangedDate); - builder_.add_info(info); - builder_.add_lastChangedAuthorId(lastChangedAuthorId); - builder_.add_ownerId(ownerId); - builder_.add_hasData(hasData); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::String> ownerId = 0, + bool hasData = false, + uint64_t lastChangedDate = 0, + ::flatbuffers::Offset<::flatbuffers::String> lastChangedAuthorId = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> info = 0) +{ + TusDataStatusBuilder builder_(_fbb); + builder_.add_lastChangedDate(lastChangedDate); + builder_.add_info(info); + builder_.add_lastChangedAuthorId(lastChangedAuthorId); + builder_.add_ownerId(ownerId); + builder_.add_hasData(hasData); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusDataStatusDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const char *ownerId = nullptr, - bool hasData = false, - uint64_t lastChangedDate = 0, - const char *lastChangedAuthorId = nullptr, - const std::vector *info = nullptr) { - auto ownerId__ = ownerId ? _fbb.CreateString(ownerId) : 0; - auto lastChangedAuthorId__ = lastChangedAuthorId ? _fbb.CreateString(lastChangedAuthorId) : 0; - auto info__ = info ? _fbb.CreateVector(*info) : 0; - return CreateTusDataStatus( - _fbb, - ownerId__, - hasData, - lastChangedDate, - lastChangedAuthorId__, - info__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const char* ownerId = nullptr, + bool hasData = false, + uint64_t lastChangedDate = 0, + const char* lastChangedAuthorId = nullptr, + const std::vector* info = nullptr) +{ + auto ownerId__ = ownerId ? _fbb.CreateString(ownerId) : 0; + auto lastChangedAuthorId__ = lastChangedAuthorId ? _fbb.CreateString(lastChangedAuthorId) : 0; + auto info__ = info ? _fbb.CreateVector(*info) : 0; + return CreateTusDataStatus( + _fbb, + ownerId__, + hasData, + lastChangedDate, + lastChangedAuthorId__, + info__); } -struct TusData FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusDataBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_STATUS = 4, - VT_DATA = 6 - }; - const TusDataStatus *status() const { - return GetPointer(VT_STATUS); - } - const ::flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_STATUS) && - verifier.VerifyTable(status()) && - VerifyOffset(verifier, VT_DATA) && - verifier.VerifyVector(data()) && - verifier.EndTable(); - } +struct TusData FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusDataBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_STATUS = 4, + VT_DATA = 6 + }; + const TusDataStatus* status() const + { + return GetPointer(VT_STATUS); + } + const ::flatbuffers::Vector* data() const + { + return GetPointer*>(VT_DATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_STATUS) && + verifier.VerifyTable(status()) && + VerifyOffset(verifier, VT_DATA) && + verifier.VerifyVector(data()) && + verifier.EndTable(); + } }; -struct TusDataBuilder { - typedef TusData Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_status(::flatbuffers::Offset status) { - fbb_.AddOffset(TusData::VT_STATUS, status); - } - void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { - fbb_.AddOffset(TusData::VT_DATA, data); - } - explicit TusDataBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusDataBuilder +{ + typedef TusData Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_status(::flatbuffers::Offset status) + { + fbb_.AddOffset(TusData::VT_STATUS, status); + } + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) + { + fbb_.AddOffset(TusData::VT_DATA, data); + } + explicit TusDataBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusData( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset status = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) { - TusDataBuilder builder_(_fbb); - builder_.add_data(data); - builder_.add_status(status); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset status = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) +{ + TusDataBuilder builder_(_fbb); + builder_.add_data(data); + builder_.add_status(status); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusDataDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset status = 0, - const std::vector *data = nullptr) { - auto data__ = data ? _fbb.CreateVector(*data) : 0; - return CreateTusData( - _fbb, - status, - data__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset status = 0, + const std::vector* data = nullptr) +{ + auto data__ = data ? _fbb.CreateVector(*data) : 0; + return CreateTusData( + _fbb, + status, + data__); } -struct TusDataStatusResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusDataStatusResponseBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_STATUS = 4 - }; - const ::flatbuffers::Vector<::flatbuffers::Offset> *status() const { - return GetPointer> *>(VT_STATUS); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_STATUS) && - verifier.VerifyVector(status()) && - verifier.VerifyVectorOfTables(status()) && - verifier.EndTable(); - } +struct TusDataStatusResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusDataStatusResponseBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_STATUS = 4 + }; + const ::flatbuffers::Vector<::flatbuffers::Offset>* status() const + { + return GetPointer>*>(VT_STATUS); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_STATUS) && + verifier.VerifyVector(status()) && + verifier.VerifyVectorOfTables(status()) && + verifier.EndTable(); + } }; -struct TusDataStatusResponseBuilder { - typedef TusDataStatusResponse Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_status(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> status) { - fbb_.AddOffset(TusDataStatusResponse::VT_STATUS, status); - } - explicit TusDataStatusResponseBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusDataStatusResponseBuilder +{ + typedef TusDataStatusResponse Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_status(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> status) + { + fbb_.AddOffset(TusDataStatusResponse::VT_STATUS, status); + } + explicit TusDataStatusResponseBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusDataStatusResponse( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> status = 0) { - TusDataStatusResponseBuilder builder_(_fbb); - builder_.add_status(status); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> status = 0) +{ + TusDataStatusResponseBuilder builder_(_fbb); + builder_.add_status(status); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusDataStatusResponseDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector<::flatbuffers::Offset> *status = nullptr) { - auto status__ = status ? _fbb.CreateVector<::flatbuffers::Offset>(*status) : 0; - return CreateTusDataStatusResponse( - _fbb, - status__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector<::flatbuffers::Offset>* status = nullptr) +{ + auto status__ = status ? _fbb.CreateVector<::flatbuffers::Offset>(*status) : 0; + return CreateTusDataStatusResponse( + _fbb, + status__); } -struct TusGetDataRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusGetDataRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_USER = 4, - VT_SLOTID = 6 - }; - const TusUser *user() const { - return GetPointer(VT_USER); - } - int32_t slotId() const { - return GetField(VT_SLOTID, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_USER) && - verifier.VerifyTable(user()) && - VerifyField(verifier, VT_SLOTID, 4) && - verifier.EndTable(); - } +struct TusGetDataRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusGetDataRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_USER = 4, + VT_SLOTID = 6 + }; + const TusUser* user() const + { + return GetPointer(VT_USER); + } + int32_t slotId() const + { + return GetField(VT_SLOTID, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_USER) && + verifier.VerifyTable(user()) && + VerifyField(verifier, VT_SLOTID, 4) && + verifier.EndTable(); + } }; -struct TusGetDataRequestBuilder { - typedef TusGetDataRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_user(::flatbuffers::Offset user) { - fbb_.AddOffset(TusGetDataRequest::VT_USER, user); - } - void add_slotId(int32_t slotId) { - fbb_.AddElement(TusGetDataRequest::VT_SLOTID, slotId, 0); - } - explicit TusGetDataRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusGetDataRequestBuilder +{ + typedef TusGetDataRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_user(::flatbuffers::Offset user) + { + fbb_.AddOffset(TusGetDataRequest::VT_USER, user); + } + void add_slotId(int32_t slotId) + { + fbb_.AddElement(TusGetDataRequest::VT_SLOTID, slotId, 0); + } + explicit TusGetDataRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusGetDataRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - int32_t slotId = 0) { - TusGetDataRequestBuilder builder_(_fbb); - builder_.add_slotId(slotId); - builder_.add_user(user); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + int32_t slotId = 0) +{ + TusGetDataRequestBuilder builder_(_fbb); + builder_.add_slotId(slotId); + builder_.add_user(user); + return builder_.Finish(); } -struct TusGetMultiSlotDataStatusRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusGetMultiSlotDataStatusRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_USER = 4, - VT_SLOTIDARRAY = 6 - }; - const TusUser *user() const { - return GetPointer(VT_USER); - } - const ::flatbuffers::Vector *slotIdArray() const { - return GetPointer *>(VT_SLOTIDARRAY); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_USER) && - verifier.VerifyTable(user()) && - VerifyOffset(verifier, VT_SLOTIDARRAY) && - verifier.VerifyVector(slotIdArray()) && - verifier.EndTable(); - } +struct TusGetMultiSlotDataStatusRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusGetMultiSlotDataStatusRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_USER = 4, + VT_SLOTIDARRAY = 6 + }; + const TusUser* user() const + { + return GetPointer(VT_USER); + } + const ::flatbuffers::Vector* slotIdArray() const + { + return GetPointer*>(VT_SLOTIDARRAY); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_USER) && + verifier.VerifyTable(user()) && + VerifyOffset(verifier, VT_SLOTIDARRAY) && + verifier.VerifyVector(slotIdArray()) && + verifier.EndTable(); + } }; -struct TusGetMultiSlotDataStatusRequestBuilder { - typedef TusGetMultiSlotDataStatusRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_user(::flatbuffers::Offset user) { - fbb_.AddOffset(TusGetMultiSlotDataStatusRequest::VT_USER, user); - } - void add_slotIdArray(::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray) { - fbb_.AddOffset(TusGetMultiSlotDataStatusRequest::VT_SLOTIDARRAY, slotIdArray); - } - explicit TusGetMultiSlotDataStatusRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusGetMultiSlotDataStatusRequestBuilder +{ + typedef TusGetMultiSlotDataStatusRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_user(::flatbuffers::Offset user) + { + fbb_.AddOffset(TusGetMultiSlotDataStatusRequest::VT_USER, user); + } + void add_slotIdArray(::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray) + { + fbb_.AddOffset(TusGetMultiSlotDataStatusRequest::VT_SLOTIDARRAY, slotIdArray); + } + explicit TusGetMultiSlotDataStatusRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusGetMultiSlotDataStatusRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray = 0) { - TusGetMultiSlotDataStatusRequestBuilder builder_(_fbb); - builder_.add_slotIdArray(slotIdArray); - builder_.add_user(user); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray = 0) +{ + TusGetMultiSlotDataStatusRequestBuilder builder_(_fbb); + builder_.add_slotIdArray(slotIdArray); + builder_.add_user(user); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusGetMultiSlotDataStatusRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - const std::vector *slotIdArray = nullptr) { - auto slotIdArray__ = slotIdArray ? _fbb.CreateVector(*slotIdArray) : 0; - return CreateTusGetMultiSlotDataStatusRequest( - _fbb, - user, - slotIdArray__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + const std::vector* slotIdArray = nullptr) +{ + auto slotIdArray__ = slotIdArray ? _fbb.CreateVector(*slotIdArray) : 0; + return CreateTusGetMultiSlotDataStatusRequest( + _fbb, + user, + slotIdArray__); } -struct TusGetMultiUserDataStatusRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusGetMultiUserDataStatusRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_USERS = 4, - VT_SLOTID = 6 - }; - const ::flatbuffers::Vector<::flatbuffers::Offset> *users() const { - return GetPointer> *>(VT_USERS); - } - int32_t slotId() const { - return GetField(VT_SLOTID, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_USERS) && - verifier.VerifyVector(users()) && - verifier.VerifyVectorOfTables(users()) && - VerifyField(verifier, VT_SLOTID, 4) && - verifier.EndTable(); - } +struct TusGetMultiUserDataStatusRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusGetMultiUserDataStatusRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_USERS = 4, + VT_SLOTID = 6 + }; + const ::flatbuffers::Vector<::flatbuffers::Offset>* users() const + { + return GetPointer>*>(VT_USERS); + } + int32_t slotId() const + { + return GetField(VT_SLOTID, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_USERS) && + verifier.VerifyVector(users()) && + verifier.VerifyVectorOfTables(users()) && + VerifyField(verifier, VT_SLOTID, 4) && + verifier.EndTable(); + } }; -struct TusGetMultiUserDataStatusRequestBuilder { - typedef TusGetMultiUserDataStatusRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_users(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> users) { - fbb_.AddOffset(TusGetMultiUserDataStatusRequest::VT_USERS, users); - } - void add_slotId(int32_t slotId) { - fbb_.AddElement(TusGetMultiUserDataStatusRequest::VT_SLOTID, slotId, 0); - } - explicit TusGetMultiUserDataStatusRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusGetMultiUserDataStatusRequestBuilder +{ + typedef TusGetMultiUserDataStatusRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_users(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> users) + { + fbb_.AddOffset(TusGetMultiUserDataStatusRequest::VT_USERS, users); + } + void add_slotId(int32_t slotId) + { + fbb_.AddElement(TusGetMultiUserDataStatusRequest::VT_SLOTID, slotId, 0); + } + explicit TusGetMultiUserDataStatusRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusGetMultiUserDataStatusRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> users = 0, - int32_t slotId = 0) { - TusGetMultiUserDataStatusRequestBuilder builder_(_fbb); - builder_.add_slotId(slotId); - builder_.add_users(users); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> users = 0, + int32_t slotId = 0) +{ + TusGetMultiUserDataStatusRequestBuilder builder_(_fbb); + builder_.add_slotId(slotId); + builder_.add_users(users); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusGetMultiUserDataStatusRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector<::flatbuffers::Offset> *users = nullptr, - int32_t slotId = 0) { - auto users__ = users ? _fbb.CreateVector<::flatbuffers::Offset>(*users) : 0; - return CreateTusGetMultiUserDataStatusRequest( - _fbb, - users__, - slotId); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector<::flatbuffers::Offset>* users = nullptr, + int32_t slotId = 0) +{ + auto users__ = users ? _fbb.CreateVector<::flatbuffers::Offset>(*users) : 0; + return CreateTusGetMultiUserDataStatusRequest( + _fbb, + users__, + slotId); } -struct TusGetFriendsDataStatusRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusGetFriendsDataStatusRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SLOTID = 4, - VT_INCLUDESELF = 6, - VT_SORTTYPE = 8, - VT_ARRAYNUM = 10 - }; - int32_t slotId() const { - return GetField(VT_SLOTID, 0); - } - bool includeSelf() const { - return GetField(VT_INCLUDESELF, 0) != 0; - } - int32_t sortType() const { - return GetField(VT_SORTTYPE, 0); - } - uint32_t arrayNum() const { - return GetField(VT_ARRAYNUM, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_SLOTID, 4) && - VerifyField(verifier, VT_INCLUDESELF, 1) && - VerifyField(verifier, VT_SORTTYPE, 4) && - VerifyField(verifier, VT_ARRAYNUM, 4) && - verifier.EndTable(); - } +struct TusGetFriendsDataStatusRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusGetFriendsDataStatusRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_SLOTID = 4, + VT_INCLUDESELF = 6, + VT_SORTTYPE = 8, + VT_ARRAYNUM = 10 + }; + int32_t slotId() const + { + return GetField(VT_SLOTID, 0); + } + bool includeSelf() const + { + return GetField(VT_INCLUDESELF, 0) != 0; + } + int32_t sortType() const + { + return GetField(VT_SORTTYPE, 0); + } + uint32_t arrayNum() const + { + return GetField(VT_ARRAYNUM, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_SLOTID, 4) && + VerifyField(verifier, VT_INCLUDESELF, 1) && + VerifyField(verifier, VT_SORTTYPE, 4) && + VerifyField(verifier, VT_ARRAYNUM, 4) && + verifier.EndTable(); + } }; -struct TusGetFriendsDataStatusRequestBuilder { - typedef TusGetFriendsDataStatusRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_slotId(int32_t slotId) { - fbb_.AddElement(TusGetFriendsDataStatusRequest::VT_SLOTID, slotId, 0); - } - void add_includeSelf(bool includeSelf) { - fbb_.AddElement(TusGetFriendsDataStatusRequest::VT_INCLUDESELF, static_cast(includeSelf), 0); - } - void add_sortType(int32_t sortType) { - fbb_.AddElement(TusGetFriendsDataStatusRequest::VT_SORTTYPE, sortType, 0); - } - void add_arrayNum(uint32_t arrayNum) { - fbb_.AddElement(TusGetFriendsDataStatusRequest::VT_ARRAYNUM, arrayNum, 0); - } - explicit TusGetFriendsDataStatusRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusGetFriendsDataStatusRequestBuilder +{ + typedef TusGetFriendsDataStatusRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_slotId(int32_t slotId) + { + fbb_.AddElement(TusGetFriendsDataStatusRequest::VT_SLOTID, slotId, 0); + } + void add_includeSelf(bool includeSelf) + { + fbb_.AddElement(TusGetFriendsDataStatusRequest::VT_INCLUDESELF, static_cast(includeSelf), 0); + } + void add_sortType(int32_t sortType) + { + fbb_.AddElement(TusGetFriendsDataStatusRequest::VT_SORTTYPE, sortType, 0); + } + void add_arrayNum(uint32_t arrayNum) + { + fbb_.AddElement(TusGetFriendsDataStatusRequest::VT_ARRAYNUM, arrayNum, 0); + } + explicit TusGetFriendsDataStatusRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusGetFriendsDataStatusRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - int32_t slotId = 0, - bool includeSelf = false, - int32_t sortType = 0, - uint32_t arrayNum = 0) { - TusGetFriendsDataStatusRequestBuilder builder_(_fbb); - builder_.add_arrayNum(arrayNum); - builder_.add_sortType(sortType); - builder_.add_slotId(slotId); - builder_.add_includeSelf(includeSelf); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + int32_t slotId = 0, + bool includeSelf = false, + int32_t sortType = 0, + uint32_t arrayNum = 0) +{ + TusGetFriendsDataStatusRequestBuilder builder_(_fbb); + builder_.add_arrayNum(arrayNum); + builder_.add_sortType(sortType); + builder_.add_slotId(slotId); + builder_.add_includeSelf(includeSelf); + return builder_.Finish(); } -struct TusDeleteMultiSlotDataRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef TusDeleteMultiSlotDataRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_USER = 4, - VT_SLOTIDARRAY = 6 - }; - const TusUser *user() const { - return GetPointer(VT_USER); - } - const ::flatbuffers::Vector *slotIdArray() const { - return GetPointer *>(VT_SLOTIDARRAY); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_USER) && - verifier.VerifyTable(user()) && - VerifyOffset(verifier, VT_SLOTIDARRAY) && - verifier.VerifyVector(slotIdArray()) && - verifier.EndTable(); - } +struct TusDeleteMultiSlotDataRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef TusDeleteMultiSlotDataRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_USER = 4, + VT_SLOTIDARRAY = 6 + }; + const TusUser* user() const + { + return GetPointer(VT_USER); + } + const ::flatbuffers::Vector* slotIdArray() const + { + return GetPointer*>(VT_SLOTIDARRAY); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_USER) && + verifier.VerifyTable(user()) && + VerifyOffset(verifier, VT_SLOTIDARRAY) && + verifier.VerifyVector(slotIdArray()) && + verifier.EndTable(); + } }; -struct TusDeleteMultiSlotDataRequestBuilder { - typedef TusDeleteMultiSlotDataRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_user(::flatbuffers::Offset user) { - fbb_.AddOffset(TusDeleteMultiSlotDataRequest::VT_USER, user); - } - void add_slotIdArray(::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray) { - fbb_.AddOffset(TusDeleteMultiSlotDataRequest::VT_SLOTIDARRAY, slotIdArray); - } - explicit TusDeleteMultiSlotDataRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct TusDeleteMultiSlotDataRequestBuilder +{ + typedef TusDeleteMultiSlotDataRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_user(::flatbuffers::Offset user) + { + fbb_.AddOffset(TusDeleteMultiSlotDataRequest::VT_USER, user); + } + void add_slotIdArray(::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray) + { + fbb_.AddOffset(TusDeleteMultiSlotDataRequest::VT_SLOTIDARRAY, slotIdArray); + } + explicit TusDeleteMultiSlotDataRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateTusDeleteMultiSlotDataRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray = 0) { - TusDeleteMultiSlotDataRequestBuilder builder_(_fbb); - builder_.add_slotIdArray(slotIdArray); - builder_.add_user(user); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> slotIdArray = 0) +{ + TusDeleteMultiSlotDataRequestBuilder builder_(_fbb); + builder_.add_slotIdArray(slotIdArray); + builder_.add_user(user); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateTusDeleteMultiSlotDataRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset user = 0, - const std::vector *slotIdArray = nullptr) { - auto slotIdArray__ = slotIdArray ? _fbb.CreateVector(*slotIdArray) : 0; - return CreateTusDeleteMultiSlotDataRequest( - _fbb, - user, - slotIdArray__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset user = 0, + const std::vector* slotIdArray = nullptr) +{ + auto slotIdArray__ = slotIdArray ? _fbb.CreateVector(*slotIdArray) : 0; + return CreateTusDeleteMultiSlotDataRequest( + _fbb, + user, + slotIdArray__); } -struct SetPresenceRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef SetPresenceRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_TITLE = 4, - VT_STATUS = 6, - VT_COMMENT = 8, - VT_DATA = 10 - }; - const ::flatbuffers::String *title() const { - return GetPointer(VT_TITLE); - } - const ::flatbuffers::String *status() const { - return GetPointer(VT_STATUS); - } - const ::flatbuffers::String *comment() const { - return GetPointer(VT_COMMENT); - } - const ::flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_TITLE) && - verifier.VerifyString(title()) && - VerifyOffset(verifier, VT_STATUS) && - verifier.VerifyString(status()) && - VerifyOffset(verifier, VT_COMMENT) && - verifier.VerifyString(comment()) && - VerifyOffset(verifier, VT_DATA) && - verifier.VerifyVector(data()) && - verifier.EndTable(); - } +struct SetPresenceRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef SetPresenceRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_TITLE = 4, + VT_STATUS = 6, + VT_COMMENT = 8, + VT_DATA = 10 + }; + const ::flatbuffers::String* title() const + { + return GetPointer(VT_TITLE); + } + const ::flatbuffers::String* status() const + { + return GetPointer(VT_STATUS); + } + const ::flatbuffers::String* comment() const + { + return GetPointer(VT_COMMENT); + } + const ::flatbuffers::Vector* data() const + { + return GetPointer*>(VT_DATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_TITLE) && + verifier.VerifyString(title()) && + VerifyOffset(verifier, VT_STATUS) && + verifier.VerifyString(status()) && + VerifyOffset(verifier, VT_COMMENT) && + verifier.VerifyString(comment()) && + VerifyOffset(verifier, VT_DATA) && + verifier.VerifyVector(data()) && + verifier.EndTable(); + } }; -struct SetPresenceRequestBuilder { - typedef SetPresenceRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_title(::flatbuffers::Offset<::flatbuffers::String> title) { - fbb_.AddOffset(SetPresenceRequest::VT_TITLE, title); - } - void add_status(::flatbuffers::Offset<::flatbuffers::String> status) { - fbb_.AddOffset(SetPresenceRequest::VT_STATUS, status); - } - void add_comment(::flatbuffers::Offset<::flatbuffers::String> comment) { - fbb_.AddOffset(SetPresenceRequest::VT_COMMENT, comment); - } - void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { - fbb_.AddOffset(SetPresenceRequest::VT_DATA, data); - } - explicit SetPresenceRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct SetPresenceRequestBuilder +{ + typedef SetPresenceRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_title(::flatbuffers::Offset<::flatbuffers::String> title) + { + fbb_.AddOffset(SetPresenceRequest::VT_TITLE, title); + } + void add_status(::flatbuffers::Offset<::flatbuffers::String> status) + { + fbb_.AddOffset(SetPresenceRequest::VT_STATUS, status); + } + void add_comment(::flatbuffers::Offset<::flatbuffers::String> comment) + { + fbb_.AddOffset(SetPresenceRequest::VT_COMMENT, comment); + } + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) + { + fbb_.AddOffset(SetPresenceRequest::VT_DATA, data); + } + explicit SetPresenceRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateSetPresenceRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::String> title = 0, - ::flatbuffers::Offset<::flatbuffers::String> status = 0, - ::flatbuffers::Offset<::flatbuffers::String> comment = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) { - SetPresenceRequestBuilder builder_(_fbb); - builder_.add_data(data); - builder_.add_comment(comment); - builder_.add_status(status); - builder_.add_title(title); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::String> title = 0, + ::flatbuffers::Offset<::flatbuffers::String> status = 0, + ::flatbuffers::Offset<::flatbuffers::String> comment = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) +{ + SetPresenceRequestBuilder builder_(_fbb); + builder_.add_data(data); + builder_.add_comment(comment); + builder_.add_status(status); + builder_.add_title(title); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateSetPresenceRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const char *title = nullptr, - const char *status = nullptr, - const char *comment = nullptr, - const std::vector *data = nullptr) { - auto title__ = title ? _fbb.CreateString(title) : 0; - auto status__ = status ? _fbb.CreateString(status) : 0; - auto comment__ = comment ? _fbb.CreateString(comment) : 0; - auto data__ = data ? _fbb.CreateVector(*data) : 0; - return CreateSetPresenceRequest( - _fbb, - title__, - status__, - comment__, - data__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const char* title = nullptr, + const char* status = nullptr, + const char* comment = nullptr, + const std::vector* data = nullptr) +{ + auto title__ = title ? _fbb.CreateString(title) : 0; + auto status__ = status ? _fbb.CreateString(status) : 0; + auto comment__ = comment ? _fbb.CreateString(comment) : 0; + auto data__ = data ? _fbb.CreateVector(*data) : 0; + return CreateSetPresenceRequest( + _fbb, + title__, + status__, + comment__, + data__); } -struct MatchingSearchCondition FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef MatchingSearchConditionBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ATTR_TYPE = 4, - VT_ATTR_ID = 6, - VT_COMP_OP = 8, - VT_COMP_VALUE = 10 - }; - uint32_t attr_type() const { - return GetField(VT_ATTR_TYPE, 0); - } - uint32_t attr_id() const { - return GetField(VT_ATTR_ID, 0); - } - uint32_t comp_op() const { - return GetField(VT_COMP_OP, 0); - } - uint32_t comp_value() const { - return GetField(VT_COMP_VALUE, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ATTR_TYPE, 4) && - VerifyField(verifier, VT_ATTR_ID, 4) && - VerifyField(verifier, VT_COMP_OP, 4) && - VerifyField(verifier, VT_COMP_VALUE, 4) && - verifier.EndTable(); - } +struct MatchingSearchCondition FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef MatchingSearchConditionBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ATTR_TYPE = 4, + VT_ATTR_ID = 6, + VT_COMP_OP = 8, + VT_COMP_VALUE = 10 + }; + uint32_t attr_type() const + { + return GetField(VT_ATTR_TYPE, 0); + } + uint32_t attr_id() const + { + return GetField(VT_ATTR_ID, 0); + } + uint32_t comp_op() const + { + return GetField(VT_COMP_OP, 0); + } + uint32_t comp_value() const + { + return GetField(VT_COMP_VALUE, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ATTR_TYPE, 4) && + VerifyField(verifier, VT_ATTR_ID, 4) && + VerifyField(verifier, VT_COMP_OP, 4) && + VerifyField(verifier, VT_COMP_VALUE, 4) && + verifier.EndTable(); + } }; -struct MatchingSearchConditionBuilder { - typedef MatchingSearchCondition Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_attr_type(uint32_t attr_type) { - fbb_.AddElement(MatchingSearchCondition::VT_ATTR_TYPE, attr_type, 0); - } - void add_attr_id(uint32_t attr_id) { - fbb_.AddElement(MatchingSearchCondition::VT_ATTR_ID, attr_id, 0); - } - void add_comp_op(uint32_t comp_op) { - fbb_.AddElement(MatchingSearchCondition::VT_COMP_OP, comp_op, 0); - } - void add_comp_value(uint32_t comp_value) { - fbb_.AddElement(MatchingSearchCondition::VT_COMP_VALUE, comp_value, 0); - } - explicit MatchingSearchConditionBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct MatchingSearchConditionBuilder +{ + typedef MatchingSearchCondition Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_attr_type(uint32_t attr_type) + { + fbb_.AddElement(MatchingSearchCondition::VT_ATTR_TYPE, attr_type, 0); + } + void add_attr_id(uint32_t attr_id) + { + fbb_.AddElement(MatchingSearchCondition::VT_ATTR_ID, attr_id, 0); + } + void add_comp_op(uint32_t comp_op) + { + fbb_.AddElement(MatchingSearchCondition::VT_COMP_OP, comp_op, 0); + } + void add_comp_value(uint32_t comp_value) + { + fbb_.AddElement(MatchingSearchCondition::VT_COMP_VALUE, comp_value, 0); + } + explicit MatchingSearchConditionBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateMatchingSearchCondition( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t attr_type = 0, - uint32_t attr_id = 0, - uint32_t comp_op = 0, - uint32_t comp_value = 0) { - MatchingSearchConditionBuilder builder_(_fbb); - builder_.add_comp_value(comp_value); - builder_.add_comp_op(comp_op); - builder_.add_attr_id(attr_id); - builder_.add_attr_type(attr_type); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t attr_type = 0, + uint32_t attr_id = 0, + uint32_t comp_op = 0, + uint32_t comp_value = 0) +{ + MatchingSearchConditionBuilder builder_(_fbb); + builder_.add_comp_value(comp_value); + builder_.add_comp_op(comp_op); + builder_.add_attr_id(attr_id); + builder_.add_attr_type(attr_type); + return builder_.Finish(); } -struct MatchingAttr FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef MatchingAttrBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ATTR_TYPE = 4, - VT_ATTR_ID = 6, - VT_NUM = 8, - VT_DATA = 10 - }; - uint32_t attr_type() const { - return GetField(VT_ATTR_TYPE, 0); - } - uint32_t attr_id() const { - return GetField(VT_ATTR_ID, 0); - } - uint32_t num() const { - return GetField(VT_NUM, 0); - } - const ::flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ATTR_TYPE, 4) && - VerifyField(verifier, VT_ATTR_ID, 4) && - VerifyField(verifier, VT_NUM, 4) && - VerifyOffset(verifier, VT_DATA) && - verifier.VerifyVector(data()) && - verifier.EndTable(); - } +struct MatchingAttr FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef MatchingAttrBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ATTR_TYPE = 4, + VT_ATTR_ID = 6, + VT_NUM = 8, + VT_DATA = 10 + }; + uint32_t attr_type() const + { + return GetField(VT_ATTR_TYPE, 0); + } + uint32_t attr_id() const + { + return GetField(VT_ATTR_ID, 0); + } + uint32_t num() const + { + return GetField(VT_NUM, 0); + } + const ::flatbuffers::Vector* data() const + { + return GetPointer*>(VT_DATA); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_ATTR_TYPE, 4) && + VerifyField(verifier, VT_ATTR_ID, 4) && + VerifyField(verifier, VT_NUM, 4) && + VerifyOffset(verifier, VT_DATA) && + verifier.VerifyVector(data()) && + verifier.EndTable(); + } }; -struct MatchingAttrBuilder { - typedef MatchingAttr Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_attr_type(uint32_t attr_type) { - fbb_.AddElement(MatchingAttr::VT_ATTR_TYPE, attr_type, 0); - } - void add_attr_id(uint32_t attr_id) { - fbb_.AddElement(MatchingAttr::VT_ATTR_ID, attr_id, 0); - } - void add_num(uint32_t num) { - fbb_.AddElement(MatchingAttr::VT_NUM, num, 0); - } - void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { - fbb_.AddOffset(MatchingAttr::VT_DATA, data); - } - explicit MatchingAttrBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct MatchingAttrBuilder +{ + typedef MatchingAttr Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_attr_type(uint32_t attr_type) + { + fbb_.AddElement(MatchingAttr::VT_ATTR_TYPE, attr_type, 0); + } + void add_attr_id(uint32_t attr_id) + { + fbb_.AddElement(MatchingAttr::VT_ATTR_ID, attr_id, 0); + } + void add_num(uint32_t num) + { + fbb_.AddElement(MatchingAttr::VT_NUM, num, 0); + } + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) + { + fbb_.AddOffset(MatchingAttr::VT_DATA, data); + } + explicit MatchingAttrBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateMatchingAttr( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t attr_type = 0, - uint32_t attr_id = 0, - uint32_t num = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) { - MatchingAttrBuilder builder_(_fbb); - builder_.add_data(data); - builder_.add_num(num); - builder_.add_attr_id(attr_id); - builder_.add_attr_type(attr_type); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t attr_type = 0, + uint32_t attr_id = 0, + uint32_t num = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) +{ + MatchingAttrBuilder builder_(_fbb); + builder_.add_data(data); + builder_.add_num(num); + builder_.add_attr_id(attr_id); + builder_.add_attr_type(attr_type); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateMatchingAttrDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t attr_type = 0, - uint32_t attr_id = 0, - uint32_t num = 0, - const std::vector *data = nullptr) { - auto data__ = data ? _fbb.CreateVector(*data) : 0; - return CreateMatchingAttr( - _fbb, - attr_type, - attr_id, - num, - data__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t attr_type = 0, + uint32_t attr_id = 0, + uint32_t num = 0, + const std::vector* data = nullptr) +{ + auto data__ = data ? _fbb.CreateVector(*data) : 0; + return CreateMatchingAttr( + _fbb, + attr_type, + attr_id, + num, + data__); } -struct CreateRoomGUIRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef CreateRoomGUIRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_TOTAL_SLOTS = 4, - VT_PRIVATE_SLOTS = 6, - VT_PRIVILEGE_GRANT = 8, - VT_STEALTH = 10, - VT_GAME_ATTRS = 12 - }; - uint32_t total_slots() const { - return GetField(VT_TOTAL_SLOTS, 0); - } - uint32_t private_slots() const { - return GetField(VT_PRIVATE_SLOTS, 0); - } - bool privilege_grant() const { - return GetField(VT_PRIVILEGE_GRANT, 0) != 0; - } - bool stealth() const { - return GetField(VT_STEALTH, 0) != 0; - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *game_attrs() const { - return GetPointer> *>(VT_GAME_ATTRS); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_TOTAL_SLOTS, 4) && - VerifyField(verifier, VT_PRIVATE_SLOTS, 4) && - VerifyField(verifier, VT_PRIVILEGE_GRANT, 1) && - VerifyField(verifier, VT_STEALTH, 1) && - VerifyOffset(verifier, VT_GAME_ATTRS) && - verifier.VerifyVector(game_attrs()) && - verifier.VerifyVectorOfTables(game_attrs()) && - verifier.EndTable(); - } +struct CreateRoomGUIRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef CreateRoomGUIRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_TOTAL_SLOTS = 4, + VT_PRIVATE_SLOTS = 6, + VT_PRIVILEGE_GRANT = 8, + VT_STEALTH = 10, + VT_GAME_ATTRS = 12 + }; + uint32_t total_slots() const + { + return GetField(VT_TOTAL_SLOTS, 0); + } + uint32_t private_slots() const + { + return GetField(VT_PRIVATE_SLOTS, 0); + } + bool privilege_grant() const + { + return GetField(VT_PRIVILEGE_GRANT, 0) != 0; + } + bool stealth() const + { + return GetField(VT_STEALTH, 0) != 0; + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* game_attrs() const + { + return GetPointer>*>(VT_GAME_ATTRS); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_TOTAL_SLOTS, 4) && + VerifyField(verifier, VT_PRIVATE_SLOTS, 4) && + VerifyField(verifier, VT_PRIVILEGE_GRANT, 1) && + VerifyField(verifier, VT_STEALTH, 1) && + VerifyOffset(verifier, VT_GAME_ATTRS) && + verifier.VerifyVector(game_attrs()) && + verifier.VerifyVectorOfTables(game_attrs()) && + verifier.EndTable(); + } }; -struct CreateRoomGUIRequestBuilder { - typedef CreateRoomGUIRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_total_slots(uint32_t total_slots) { - fbb_.AddElement(CreateRoomGUIRequest::VT_TOTAL_SLOTS, total_slots, 0); - } - void add_private_slots(uint32_t private_slots) { - fbb_.AddElement(CreateRoomGUIRequest::VT_PRIVATE_SLOTS, private_slots, 0); - } - void add_privilege_grant(bool privilege_grant) { - fbb_.AddElement(CreateRoomGUIRequest::VT_PRIVILEGE_GRANT, static_cast(privilege_grant), 0); - } - void add_stealth(bool stealth) { - fbb_.AddElement(CreateRoomGUIRequest::VT_STEALTH, static_cast(stealth), 0); - } - void add_game_attrs(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> game_attrs) { - fbb_.AddOffset(CreateRoomGUIRequest::VT_GAME_ATTRS, game_attrs); - } - explicit CreateRoomGUIRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct CreateRoomGUIRequestBuilder +{ + typedef CreateRoomGUIRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_total_slots(uint32_t total_slots) + { + fbb_.AddElement(CreateRoomGUIRequest::VT_TOTAL_SLOTS, total_slots, 0); + } + void add_private_slots(uint32_t private_slots) + { + fbb_.AddElement(CreateRoomGUIRequest::VT_PRIVATE_SLOTS, private_slots, 0); + } + void add_privilege_grant(bool privilege_grant) + { + fbb_.AddElement(CreateRoomGUIRequest::VT_PRIVILEGE_GRANT, static_cast(privilege_grant), 0); + } + void add_stealth(bool stealth) + { + fbb_.AddElement(CreateRoomGUIRequest::VT_STEALTH, static_cast(stealth), 0); + } + void add_game_attrs(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> game_attrs) + { + fbb_.AddOffset(CreateRoomGUIRequest::VT_GAME_ATTRS, game_attrs); + } + explicit CreateRoomGUIRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateCreateRoomGUIRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t total_slots = 0, - uint32_t private_slots = 0, - bool privilege_grant = false, - bool stealth = false, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> game_attrs = 0) { - CreateRoomGUIRequestBuilder builder_(_fbb); - builder_.add_game_attrs(game_attrs); - builder_.add_private_slots(private_slots); - builder_.add_total_slots(total_slots); - builder_.add_stealth(stealth); - builder_.add_privilege_grant(privilege_grant); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t total_slots = 0, + uint32_t private_slots = 0, + bool privilege_grant = false, + bool stealth = false, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> game_attrs = 0) +{ + CreateRoomGUIRequestBuilder builder_(_fbb); + builder_.add_game_attrs(game_attrs); + builder_.add_private_slots(private_slots); + builder_.add_total_slots(total_slots); + builder_.add_stealth(stealth); + builder_.add_privilege_grant(privilege_grant); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateCreateRoomGUIRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t total_slots = 0, - uint32_t private_slots = 0, - bool privilege_grant = false, - bool stealth = false, - const std::vector<::flatbuffers::Offset> *game_attrs = nullptr) { - auto game_attrs__ = game_attrs ? _fbb.CreateVector<::flatbuffers::Offset>(*game_attrs) : 0; - return CreateCreateRoomGUIRequest( - _fbb, - total_slots, - private_slots, - privilege_grant, - stealth, - game_attrs__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t total_slots = 0, + uint32_t private_slots = 0, + bool privilege_grant = false, + bool stealth = false, + const std::vector<::flatbuffers::Offset>* game_attrs = nullptr) +{ + auto game_attrs__ = game_attrs ? _fbb.CreateVector<::flatbuffers::Offset>(*game_attrs) : 0; + return CreateCreateRoomGUIRequest( + _fbb, + total_slots, + private_slots, + privilege_grant, + stealth, + game_attrs__); } -struct GUIUserInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GUIUserInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_INFO = 4, - VT_OWNER = 6 - }; - const UserInfo *info() const { - return GetPointer(VT_INFO); - } - bool owner() const { - return GetField(VT_OWNER, 0) != 0; - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_INFO) && - verifier.VerifyTable(info()) && - VerifyField(verifier, VT_OWNER, 1) && - verifier.EndTable(); - } +struct GUIUserInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GUIUserInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_INFO = 4, + VT_OWNER = 6 + }; + const UserInfo* info() const + { + return GetPointer(VT_INFO); + } + bool owner() const + { + return GetField(VT_OWNER, 0) != 0; + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_INFO) && + verifier.VerifyTable(info()) && + VerifyField(verifier, VT_OWNER, 1) && + verifier.EndTable(); + } }; -struct GUIUserInfoBuilder { - typedef GUIUserInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_info(::flatbuffers::Offset info) { - fbb_.AddOffset(GUIUserInfo::VT_INFO, info); - } - void add_owner(bool owner) { - fbb_.AddElement(GUIUserInfo::VT_OWNER, static_cast(owner), 0); - } - explicit GUIUserInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GUIUserInfoBuilder +{ + typedef GUIUserInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_info(::flatbuffers::Offset info) + { + fbb_.AddOffset(GUIUserInfo::VT_INFO, info); + } + void add_owner(bool owner) + { + fbb_.AddElement(GUIUserInfo::VT_OWNER, static_cast(owner), 0); + } + explicit GUIUserInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGUIUserInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset info = 0, - bool owner = false) { - GUIUserInfoBuilder builder_(_fbb); - builder_.add_info(info); - builder_.add_owner(owner); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset info = 0, + bool owner = false) +{ + GUIUserInfoBuilder builder_(_fbb); + builder_.add_info(info); + builder_.add_owner(owner); + return builder_.Finish(); } -struct MatchingRoomStatus FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef MatchingRoomStatusBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ID = 4, - VT_MEMBERS = 6, - VT_KICK_ACTOR = 8, - VT_OPT = 10 - }; - const ::flatbuffers::Vector *id() const { - return GetPointer *>(VT_ID); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *members() const { - return GetPointer> *>(VT_MEMBERS); - } - const ::flatbuffers::String *kick_actor() const { - return GetPointer(VT_KICK_ACTOR); - } - const ::flatbuffers::Vector *opt() const { - return GetPointer *>(VT_OPT); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ID) && - verifier.VerifyVector(id()) && - VerifyOffset(verifier, VT_MEMBERS) && - verifier.VerifyVector(members()) && - verifier.VerifyVectorOfTables(members()) && - VerifyOffset(verifier, VT_KICK_ACTOR) && - verifier.VerifyString(kick_actor()) && - VerifyOffset(verifier, VT_OPT) && - verifier.VerifyVector(opt()) && - verifier.EndTable(); - } +struct MatchingRoomStatus FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef MatchingRoomStatusBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ID = 4, + VT_MEMBERS = 6, + VT_KICK_ACTOR = 8, + VT_OPT = 10 + }; + const ::flatbuffers::Vector* id() const + { + return GetPointer*>(VT_ID); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* members() const + { + return GetPointer>*>(VT_MEMBERS); + } + const ::flatbuffers::String* kick_actor() const + { + return GetPointer(VT_KICK_ACTOR); + } + const ::flatbuffers::Vector* opt() const + { + return GetPointer*>(VT_OPT); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_ID) && + verifier.VerifyVector(id()) && + VerifyOffset(verifier, VT_MEMBERS) && + verifier.VerifyVector(members()) && + verifier.VerifyVectorOfTables(members()) && + VerifyOffset(verifier, VT_KICK_ACTOR) && + verifier.VerifyString(kick_actor()) && + VerifyOffset(verifier, VT_OPT) && + verifier.VerifyVector(opt()) && + verifier.EndTable(); + } }; -struct MatchingRoomStatusBuilder { - typedef MatchingRoomStatus Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_id(::flatbuffers::Offset<::flatbuffers::Vector> id) { - fbb_.AddOffset(MatchingRoomStatus::VT_ID, id); - } - void add_members(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> members) { - fbb_.AddOffset(MatchingRoomStatus::VT_MEMBERS, members); - } - void add_kick_actor(::flatbuffers::Offset<::flatbuffers::String> kick_actor) { - fbb_.AddOffset(MatchingRoomStatus::VT_KICK_ACTOR, kick_actor); - } - void add_opt(::flatbuffers::Offset<::flatbuffers::Vector> opt) { - fbb_.AddOffset(MatchingRoomStatus::VT_OPT, opt); - } - explicit MatchingRoomStatusBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct MatchingRoomStatusBuilder +{ + typedef MatchingRoomStatus Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_id(::flatbuffers::Offset<::flatbuffers::Vector> id) + { + fbb_.AddOffset(MatchingRoomStatus::VT_ID, id); + } + void add_members(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> members) + { + fbb_.AddOffset(MatchingRoomStatus::VT_MEMBERS, members); + } + void add_kick_actor(::flatbuffers::Offset<::flatbuffers::String> kick_actor) + { + fbb_.AddOffset(MatchingRoomStatus::VT_KICK_ACTOR, kick_actor); + } + void add_opt(::flatbuffers::Offset<::flatbuffers::Vector> opt) + { + fbb_.AddOffset(MatchingRoomStatus::VT_OPT, opt); + } + explicit MatchingRoomStatusBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateMatchingRoomStatus( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector> id = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> members = 0, - ::flatbuffers::Offset<::flatbuffers::String> kick_actor = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> opt = 0) { - MatchingRoomStatusBuilder builder_(_fbb); - builder_.add_opt(opt); - builder_.add_kick_actor(kick_actor); - builder_.add_members(members); - builder_.add_id(id); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> id = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> members = 0, + ::flatbuffers::Offset<::flatbuffers::String> kick_actor = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> opt = 0) +{ + MatchingRoomStatusBuilder builder_(_fbb); + builder_.add_opt(opt); + builder_.add_kick_actor(kick_actor); + builder_.add_members(members); + builder_.add_id(id); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateMatchingRoomStatusDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *id = nullptr, - const std::vector<::flatbuffers::Offset> *members = nullptr, - const char *kick_actor = nullptr, - const std::vector *opt = nullptr) { - auto id__ = id ? _fbb.CreateVector(*id) : 0; - auto members__ = members ? _fbb.CreateVector<::flatbuffers::Offset>(*members) : 0; - auto kick_actor__ = kick_actor ? _fbb.CreateString(kick_actor) : 0; - auto opt__ = opt ? _fbb.CreateVector(*opt) : 0; - return CreateMatchingRoomStatus( - _fbb, - id__, - members__, - kick_actor__, - opt__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector* id = nullptr, + const std::vector<::flatbuffers::Offset>* members = nullptr, + const char* kick_actor = nullptr, + const std::vector* opt = nullptr) +{ + auto id__ = id ? _fbb.CreateVector(*id) : 0; + auto members__ = members ? _fbb.CreateVector<::flatbuffers::Offset>(*members) : 0; + auto kick_actor__ = kick_actor ? _fbb.CreateString(kick_actor) : 0; + auto opt__ = opt ? _fbb.CreateVector(*opt) : 0; + return CreateMatchingRoomStatus( + _fbb, + id__, + members__, + kick_actor__, + opt__); } -struct GetRoomListGUIRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef GetRoomListGUIRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_RANGE_START = 4, - VT_RANGE_MAX = 6, - VT_CONDS = 8, - VT_ATTRS = 10 - }; - uint32_t range_start() const { - return GetField(VT_RANGE_START, 0); - } - uint32_t range_max() const { - return GetField(VT_RANGE_MAX, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *conds() const { - return GetPointer> *>(VT_CONDS); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *attrs() const { - return GetPointer> *>(VT_ATTRS); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_RANGE_START, 4) && - VerifyField(verifier, VT_RANGE_MAX, 4) && - VerifyOffset(verifier, VT_CONDS) && - verifier.VerifyVector(conds()) && - verifier.VerifyVectorOfTables(conds()) && - VerifyOffset(verifier, VT_ATTRS) && - verifier.VerifyVector(attrs()) && - verifier.VerifyVectorOfTables(attrs()) && - verifier.EndTable(); - } +struct GetRoomListGUIRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef GetRoomListGUIRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_RANGE_START = 4, + VT_RANGE_MAX = 6, + VT_CONDS = 8, + VT_ATTRS = 10 + }; + uint32_t range_start() const + { + return GetField(VT_RANGE_START, 0); + } + uint32_t range_max() const + { + return GetField(VT_RANGE_MAX, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* conds() const + { + return GetPointer>*>(VT_CONDS); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* attrs() const + { + return GetPointer>*>(VT_ATTRS); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_RANGE_START, 4) && + VerifyField(verifier, VT_RANGE_MAX, 4) && + VerifyOffset(verifier, VT_CONDS) && + verifier.VerifyVector(conds()) && + verifier.VerifyVectorOfTables(conds()) && + VerifyOffset(verifier, VT_ATTRS) && + verifier.VerifyVector(attrs()) && + verifier.VerifyVectorOfTables(attrs()) && + verifier.EndTable(); + } }; -struct GetRoomListGUIRequestBuilder { - typedef GetRoomListGUIRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_range_start(uint32_t range_start) { - fbb_.AddElement(GetRoomListGUIRequest::VT_RANGE_START, range_start, 0); - } - void add_range_max(uint32_t range_max) { - fbb_.AddElement(GetRoomListGUIRequest::VT_RANGE_MAX, range_max, 0); - } - void add_conds(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> conds) { - fbb_.AddOffset(GetRoomListGUIRequest::VT_CONDS, conds); - } - void add_attrs(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attrs) { - fbb_.AddOffset(GetRoomListGUIRequest::VT_ATTRS, attrs); - } - explicit GetRoomListGUIRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct GetRoomListGUIRequestBuilder +{ + typedef GetRoomListGUIRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_range_start(uint32_t range_start) + { + fbb_.AddElement(GetRoomListGUIRequest::VT_RANGE_START, range_start, 0); + } + void add_range_max(uint32_t range_max) + { + fbb_.AddElement(GetRoomListGUIRequest::VT_RANGE_MAX, range_max, 0); + } + void add_conds(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> conds) + { + fbb_.AddOffset(GetRoomListGUIRequest::VT_CONDS, conds); + } + void add_attrs(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attrs) + { + fbb_.AddOffset(GetRoomListGUIRequest::VT_ATTRS, attrs); + } + explicit GetRoomListGUIRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateGetRoomListGUIRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t range_start = 0, - uint32_t range_max = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> conds = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attrs = 0) { - GetRoomListGUIRequestBuilder builder_(_fbb); - builder_.add_attrs(attrs); - builder_.add_conds(conds); - builder_.add_range_max(range_max); - builder_.add_range_start(range_start); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t range_start = 0, + uint32_t range_max = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> conds = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attrs = 0) +{ + GetRoomListGUIRequestBuilder builder_(_fbb); + builder_.add_attrs(attrs); + builder_.add_conds(conds); + builder_.add_range_max(range_max); + builder_.add_range_start(range_start); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateGetRoomListGUIRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t range_start = 0, - uint32_t range_max = 0, - const std::vector<::flatbuffers::Offset> *conds = nullptr, - const std::vector<::flatbuffers::Offset> *attrs = nullptr) { - auto conds__ = conds ? _fbb.CreateVector<::flatbuffers::Offset>(*conds) : 0; - auto attrs__ = attrs ? _fbb.CreateVector<::flatbuffers::Offset>(*attrs) : 0; - return CreateGetRoomListGUIRequest( - _fbb, - range_start, - range_max, - conds__, - attrs__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t range_start = 0, + uint32_t range_max = 0, + const std::vector<::flatbuffers::Offset>* conds = nullptr, + const std::vector<::flatbuffers::Offset>* attrs = nullptr) +{ + auto conds__ = conds ? _fbb.CreateVector<::flatbuffers::Offset>(*conds) : 0; + auto attrs__ = attrs ? _fbb.CreateVector<::flatbuffers::Offset>(*attrs) : 0; + return CreateGetRoomListGUIRequest( + _fbb, + range_start, + range_max, + conds__, + attrs__); } -struct MatchingRoom FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef MatchingRoomBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ID = 4, - VT_ATTR = 6 - }; - const ::flatbuffers::Vector *id() const { - return GetPointer *>(VT_ID); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *attr() const { - return GetPointer> *>(VT_ATTR); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ID) && - verifier.VerifyVector(id()) && - VerifyOffset(verifier, VT_ATTR) && - verifier.VerifyVector(attr()) && - verifier.VerifyVectorOfTables(attr()) && - verifier.EndTable(); - } +struct MatchingRoom FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef MatchingRoomBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ID = 4, + VT_ATTR = 6 + }; + const ::flatbuffers::Vector* id() const + { + return GetPointer*>(VT_ID); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* attr() const + { + return GetPointer>*>(VT_ATTR); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_ID) && + verifier.VerifyVector(id()) && + VerifyOffset(verifier, VT_ATTR) && + verifier.VerifyVector(attr()) && + verifier.VerifyVectorOfTables(attr()) && + verifier.EndTable(); + } }; -struct MatchingRoomBuilder { - typedef MatchingRoom Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_id(::flatbuffers::Offset<::flatbuffers::Vector> id) { - fbb_.AddOffset(MatchingRoom::VT_ID, id); - } - void add_attr(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attr) { - fbb_.AddOffset(MatchingRoom::VT_ATTR, attr); - } - explicit MatchingRoomBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct MatchingRoomBuilder +{ + typedef MatchingRoom Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_id(::flatbuffers::Offset<::flatbuffers::Vector> id) + { + fbb_.AddOffset(MatchingRoom::VT_ID, id); + } + void add_attr(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attr) + { + fbb_.AddOffset(MatchingRoom::VT_ATTR, attr); + } + explicit MatchingRoomBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateMatchingRoom( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector> id = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attr = 0) { - MatchingRoomBuilder builder_(_fbb); - builder_.add_attr(attr); - builder_.add_id(id); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> id = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attr = 0) +{ + MatchingRoomBuilder builder_(_fbb); + builder_.add_attr(attr); + builder_.add_id(id); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateMatchingRoomDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *id = nullptr, - const std::vector<::flatbuffers::Offset> *attr = nullptr) { - auto id__ = id ? _fbb.CreateVector(*id) : 0; - auto attr__ = attr ? _fbb.CreateVector<::flatbuffers::Offset>(*attr) : 0; - return CreateMatchingRoom( - _fbb, - id__, - attr__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector* id = nullptr, + const std::vector<::flatbuffers::Offset>* attr = nullptr) +{ + auto id__ = id ? _fbb.CreateVector(*id) : 0; + auto attr__ = attr ? _fbb.CreateVector<::flatbuffers::Offset>(*attr) : 0; + return CreateMatchingRoom( + _fbb, + id__, + attr__); } -struct MatchingRoomList FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef MatchingRoomListBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_START = 4, - VT_TOTAL = 6, - VT_ROOMS = 8 - }; - uint32_t start() const { - return GetField(VT_START, 0); - } - uint32_t total() const { - return GetField(VT_TOTAL, 0); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *rooms() const { - return GetPointer> *>(VT_ROOMS); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_START, 4) && - VerifyField(verifier, VT_TOTAL, 4) && - VerifyOffset(verifier, VT_ROOMS) && - verifier.VerifyVector(rooms()) && - verifier.VerifyVectorOfTables(rooms()) && - verifier.EndTable(); - } +struct MatchingRoomList FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef MatchingRoomListBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_START = 4, + VT_TOTAL = 6, + VT_ROOMS = 8 + }; + uint32_t start() const + { + return GetField(VT_START, 0); + } + uint32_t total() const + { + return GetField(VT_TOTAL, 0); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* rooms() const + { + return GetPointer>*>(VT_ROOMS); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyField(verifier, VT_START, 4) && + VerifyField(verifier, VT_TOTAL, 4) && + VerifyOffset(verifier, VT_ROOMS) && + verifier.VerifyVector(rooms()) && + verifier.VerifyVectorOfTables(rooms()) && + verifier.EndTable(); + } }; -struct MatchingRoomListBuilder { - typedef MatchingRoomList Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_start(uint32_t start) { - fbb_.AddElement(MatchingRoomList::VT_START, start, 0); - } - void add_total(uint32_t total) { - fbb_.AddElement(MatchingRoomList::VT_TOTAL, total, 0); - } - void add_rooms(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rooms) { - fbb_.AddOffset(MatchingRoomList::VT_ROOMS, rooms); - } - explicit MatchingRoomListBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct MatchingRoomListBuilder +{ + typedef MatchingRoomList Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_start(uint32_t start) + { + fbb_.AddElement(MatchingRoomList::VT_START, start, 0); + } + void add_total(uint32_t total) + { + fbb_.AddElement(MatchingRoomList::VT_TOTAL, total, 0); + } + void add_rooms(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rooms) + { + fbb_.AddOffset(MatchingRoomList::VT_ROOMS, rooms); + } + explicit MatchingRoomListBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateMatchingRoomList( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t start = 0, - uint32_t total = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rooms = 0) { - MatchingRoomListBuilder builder_(_fbb); - builder_.add_rooms(rooms); - builder_.add_total(total); - builder_.add_start(start); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t start = 0, + uint32_t total = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> rooms = 0) +{ + MatchingRoomListBuilder builder_(_fbb); + builder_.add_rooms(rooms); + builder_.add_total(total); + builder_.add_start(start); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateMatchingRoomListDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t start = 0, - uint32_t total = 0, - const std::vector<::flatbuffers::Offset> *rooms = nullptr) { - auto rooms__ = rooms ? _fbb.CreateVector<::flatbuffers::Offset>(*rooms) : 0; - return CreateMatchingRoomList( - _fbb, - start, - total, - rooms__); + ::flatbuffers::FlatBufferBuilder& _fbb, + uint32_t start = 0, + uint32_t total = 0, + const std::vector<::flatbuffers::Offset>* rooms = nullptr) +{ + auto rooms__ = rooms ? _fbb.CreateVector<::flatbuffers::Offset>(*rooms) : 0; + return CreateMatchingRoomList( + _fbb, + start, + total, + rooms__); } -struct MatchingGuiRoomId FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef MatchingGuiRoomIdBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ID = 4 - }; - const ::flatbuffers::Vector *id() const { - return GetPointer *>(VT_ID); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ID) && - verifier.VerifyVector(id()) && - verifier.EndTable(); - } +struct MatchingGuiRoomId FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef MatchingGuiRoomIdBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ID = 4 + }; + const ::flatbuffers::Vector* id() const + { + return GetPointer*>(VT_ID); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_ID) && + verifier.VerifyVector(id()) && + verifier.EndTable(); + } }; -struct MatchingGuiRoomIdBuilder { - typedef MatchingGuiRoomId Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_id(::flatbuffers::Offset<::flatbuffers::Vector> id) { - fbb_.AddOffset(MatchingGuiRoomId::VT_ID, id); - } - explicit MatchingGuiRoomIdBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct MatchingGuiRoomIdBuilder +{ + typedef MatchingGuiRoomId Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_id(::flatbuffers::Offset<::flatbuffers::Vector> id) + { + fbb_.AddOffset(MatchingGuiRoomId::VT_ID, id); + } + explicit MatchingGuiRoomIdBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateMatchingGuiRoomId( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector> id = 0) { - MatchingGuiRoomIdBuilder builder_(_fbb); - builder_.add_id(id); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> id = 0) +{ + MatchingGuiRoomIdBuilder builder_(_fbb); + builder_.add_id(id); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateMatchingGuiRoomIdDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *id = nullptr) { - auto id__ = id ? _fbb.CreateVector(*id) : 0; - return CreateMatchingGuiRoomId( - _fbb, - id__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector* id = nullptr) +{ + auto id__ = id ? _fbb.CreateVector(*id) : 0; + return CreateMatchingGuiRoomId( + _fbb, + id__); } -struct SetRoomSearchFlagGUI FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef SetRoomSearchFlagGUIBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOMID = 4, - VT_STEALTH = 6 - }; - const ::flatbuffers::Vector *roomid() const { - return GetPointer *>(VT_ROOMID); - } - bool stealth() const { - return GetField(VT_STEALTH, 0) != 0; - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ROOMID) && - verifier.VerifyVector(roomid()) && - VerifyField(verifier, VT_STEALTH, 1) && - verifier.EndTable(); - } +struct SetRoomSearchFlagGUI FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef SetRoomSearchFlagGUIBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOMID = 4, + VT_STEALTH = 6 + }; + const ::flatbuffers::Vector* roomid() const + { + return GetPointer*>(VT_ROOMID); + } + bool stealth() const + { + return GetField(VT_STEALTH, 0) != 0; + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_ROOMID) && + verifier.VerifyVector(roomid()) && + VerifyField(verifier, VT_STEALTH, 1) && + verifier.EndTable(); + } }; -struct SetRoomSearchFlagGUIBuilder { - typedef SetRoomSearchFlagGUI Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_roomid(::flatbuffers::Offset<::flatbuffers::Vector> roomid) { - fbb_.AddOffset(SetRoomSearchFlagGUI::VT_ROOMID, roomid); - } - void add_stealth(bool stealth) { - fbb_.AddElement(SetRoomSearchFlagGUI::VT_STEALTH, static_cast(stealth), 0); - } - explicit SetRoomSearchFlagGUIBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct SetRoomSearchFlagGUIBuilder +{ + typedef SetRoomSearchFlagGUI Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_roomid(::flatbuffers::Offset<::flatbuffers::Vector> roomid) + { + fbb_.AddOffset(SetRoomSearchFlagGUI::VT_ROOMID, roomid); + } + void add_stealth(bool stealth) + { + fbb_.AddElement(SetRoomSearchFlagGUI::VT_STEALTH, static_cast(stealth), 0); + } + explicit SetRoomSearchFlagGUIBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateSetRoomSearchFlagGUI( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector> roomid = 0, - bool stealth = false) { - SetRoomSearchFlagGUIBuilder builder_(_fbb); - builder_.add_roomid(roomid); - builder_.add_stealth(stealth); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> roomid = 0, + bool stealth = false) +{ + SetRoomSearchFlagGUIBuilder builder_(_fbb); + builder_.add_roomid(roomid); + builder_.add_stealth(stealth); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateSetRoomSearchFlagGUIDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *roomid = nullptr, - bool stealth = false) { - auto roomid__ = roomid ? _fbb.CreateVector(*roomid) : 0; - return CreateSetRoomSearchFlagGUI( - _fbb, - roomid__, - stealth); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector* roomid = nullptr, + bool stealth = false) +{ + auto roomid__ = roomid ? _fbb.CreateVector(*roomid) : 0; + return CreateSetRoomSearchFlagGUI( + _fbb, + roomid__, + stealth); } -struct QuickMatchGUIRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef QuickMatchGUIRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_CONDS = 4, - VT_AVAILABLE_NUM = 6 - }; - const ::flatbuffers::Vector<::flatbuffers::Offset> *conds() const { - return GetPointer> *>(VT_CONDS); - } - uint32_t available_num() const { - return GetField(VT_AVAILABLE_NUM, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_CONDS) && - verifier.VerifyVector(conds()) && - verifier.VerifyVectorOfTables(conds()) && - VerifyField(verifier, VT_AVAILABLE_NUM, 4) && - verifier.EndTable(); - } +struct QuickMatchGUIRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef QuickMatchGUIRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_CONDS = 4, + VT_AVAILABLE_NUM = 6 + }; + const ::flatbuffers::Vector<::flatbuffers::Offset>* conds() const + { + return GetPointer>*>(VT_CONDS); + } + uint32_t available_num() const + { + return GetField(VT_AVAILABLE_NUM, 0); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_CONDS) && + verifier.VerifyVector(conds()) && + verifier.VerifyVectorOfTables(conds()) && + VerifyField(verifier, VT_AVAILABLE_NUM, 4) && + verifier.EndTable(); + } }; -struct QuickMatchGUIRequestBuilder { - typedef QuickMatchGUIRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_conds(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> conds) { - fbb_.AddOffset(QuickMatchGUIRequest::VT_CONDS, conds); - } - void add_available_num(uint32_t available_num) { - fbb_.AddElement(QuickMatchGUIRequest::VT_AVAILABLE_NUM, available_num, 0); - } - explicit QuickMatchGUIRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct QuickMatchGUIRequestBuilder +{ + typedef QuickMatchGUIRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_conds(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> conds) + { + fbb_.AddOffset(QuickMatchGUIRequest::VT_CONDS, conds); + } + void add_available_num(uint32_t available_num) + { + fbb_.AddElement(QuickMatchGUIRequest::VT_AVAILABLE_NUM, available_num, 0); + } + explicit QuickMatchGUIRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateQuickMatchGUIRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> conds = 0, - uint32_t available_num = 0) { - QuickMatchGUIRequestBuilder builder_(_fbb); - builder_.add_available_num(available_num); - builder_.add_conds(conds); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> conds = 0, + uint32_t available_num = 0) +{ + QuickMatchGUIRequestBuilder builder_(_fbb); + builder_.add_available_num(available_num); + builder_.add_conds(conds); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateQuickMatchGUIRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector<::flatbuffers::Offset> *conds = nullptr, - uint32_t available_num = 0) { - auto conds__ = conds ? _fbb.CreateVector<::flatbuffers::Offset>(*conds) : 0; - return CreateQuickMatchGUIRequest( - _fbb, - conds__, - available_num); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector<::flatbuffers::Offset>* conds = nullptr, + uint32_t available_num = 0) +{ + auto conds__ = conds ? _fbb.CreateVector<::flatbuffers::Offset>(*conds) : 0; + return CreateQuickMatchGUIRequest( + _fbb, + conds__, + available_num); } -struct SearchJoinRoomGUIRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef SearchJoinRoomGUIRequestBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_CONDS = 4, - VT_ATTRS = 6 - }; - const ::flatbuffers::Vector<::flatbuffers::Offset> *conds() const { - return GetPointer> *>(VT_CONDS); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *attrs() const { - return GetPointer> *>(VT_ATTRS); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_CONDS) && - verifier.VerifyVector(conds()) && - verifier.VerifyVectorOfTables(conds()) && - VerifyOffset(verifier, VT_ATTRS) && - verifier.VerifyVector(attrs()) && - verifier.VerifyVectorOfTables(attrs()) && - verifier.EndTable(); - } +struct SearchJoinRoomGUIRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef SearchJoinRoomGUIRequestBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_CONDS = 4, + VT_ATTRS = 6 + }; + const ::flatbuffers::Vector<::flatbuffers::Offset>* conds() const + { + return GetPointer>*>(VT_CONDS); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* attrs() const + { + return GetPointer>*>(VT_ATTRS); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_CONDS) && + verifier.VerifyVector(conds()) && + verifier.VerifyVectorOfTables(conds()) && + VerifyOffset(verifier, VT_ATTRS) && + verifier.VerifyVector(attrs()) && + verifier.VerifyVectorOfTables(attrs()) && + verifier.EndTable(); + } }; -struct SearchJoinRoomGUIRequestBuilder { - typedef SearchJoinRoomGUIRequest Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_conds(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> conds) { - fbb_.AddOffset(SearchJoinRoomGUIRequest::VT_CONDS, conds); - } - void add_attrs(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attrs) { - fbb_.AddOffset(SearchJoinRoomGUIRequest::VT_ATTRS, attrs); - } - explicit SearchJoinRoomGUIRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct SearchJoinRoomGUIRequestBuilder +{ + typedef SearchJoinRoomGUIRequest Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_conds(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> conds) + { + fbb_.AddOffset(SearchJoinRoomGUIRequest::VT_CONDS, conds); + } + void add_attrs(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attrs) + { + fbb_.AddOffset(SearchJoinRoomGUIRequest::VT_ATTRS, attrs); + } + explicit SearchJoinRoomGUIRequestBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateSearchJoinRoomGUIRequest( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> conds = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attrs = 0) { - SearchJoinRoomGUIRequestBuilder builder_(_fbb); - builder_.add_attrs(attrs); - builder_.add_conds(conds); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> conds = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attrs = 0) +{ + SearchJoinRoomGUIRequestBuilder builder_(_fbb); + builder_.add_attrs(attrs); + builder_.add_conds(conds); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateSearchJoinRoomGUIRequestDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const std::vector<::flatbuffers::Offset> *conds = nullptr, - const std::vector<::flatbuffers::Offset> *attrs = nullptr) { - auto conds__ = conds ? _fbb.CreateVector<::flatbuffers::Offset>(*conds) : 0; - auto attrs__ = attrs ? _fbb.CreateVector<::flatbuffers::Offset>(*attrs) : 0; - return CreateSearchJoinRoomGUIRequest( - _fbb, - conds__, - attrs__); + ::flatbuffers::FlatBufferBuilder& _fbb, + const std::vector<::flatbuffers::Offset>* conds = nullptr, + const std::vector<::flatbuffers::Offset>* attrs = nullptr) +{ + auto conds__ = conds ? _fbb.CreateVector<::flatbuffers::Offset>(*conds) : 0; + auto attrs__ = attrs ? _fbb.CreateVector<::flatbuffers::Offset>(*attrs) : 0; + return CreateSearchJoinRoomGUIRequest( + _fbb, + conds__, + attrs__); } -struct MatchingSearchJoinRoomInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef MatchingSearchJoinRoomInfoBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ROOM = 4, - VT_ATTR = 6 - }; - const MatchingRoomStatus *room() const { - return GetPointer(VT_ROOM); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *attr() const { - return GetPointer> *>(VT_ATTR); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ROOM) && - verifier.VerifyTable(room()) && - VerifyOffset(verifier, VT_ATTR) && - verifier.VerifyVector(attr()) && - verifier.VerifyVectorOfTables(attr()) && - verifier.EndTable(); - } +struct MatchingSearchJoinRoomInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table +{ + typedef MatchingSearchJoinRoomInfoBuilder Builder; + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE + { + VT_ROOM = 4, + VT_ATTR = 6 + }; + const MatchingRoomStatus* room() const + { + return GetPointer(VT_ROOM); + } + const ::flatbuffers::Vector<::flatbuffers::Offset>* attr() const + { + return GetPointer>*>(VT_ATTR); + } + bool Verify(::flatbuffers::Verifier& verifier) const + { + return VerifyTableStart(verifier) && + VerifyOffset(verifier, VT_ROOM) && + verifier.VerifyTable(room()) && + VerifyOffset(verifier, VT_ATTR) && + verifier.VerifyVector(attr()) && + verifier.VerifyVectorOfTables(attr()) && + verifier.EndTable(); + } }; -struct MatchingSearchJoinRoomInfoBuilder { - typedef MatchingSearchJoinRoomInfo Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_room(::flatbuffers::Offset room) { - fbb_.AddOffset(MatchingSearchJoinRoomInfo::VT_ROOM, room); - } - void add_attr(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attr) { - fbb_.AddOffset(MatchingSearchJoinRoomInfo::VT_ATTR, attr); - } - explicit MatchingSearchJoinRoomInfoBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } +struct MatchingSearchJoinRoomInfoBuilder +{ + typedef MatchingSearchJoinRoomInfo Table; + ::flatbuffers::FlatBufferBuilder& fbb_; + ::flatbuffers::uoffset_t start_; + void add_room(::flatbuffers::Offset room) + { + fbb_.AddOffset(MatchingSearchJoinRoomInfo::VT_ROOM, room); + } + void add_attr(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attr) + { + fbb_.AddOffset(MatchingSearchJoinRoomInfo::VT_ATTR, attr); + } + explicit MatchingSearchJoinRoomInfoBuilder(::flatbuffers::FlatBufferBuilder& _fbb) + : fbb_(_fbb) + { + start_ = fbb_.StartTable(); + } + ::flatbuffers::Offset Finish() + { + const auto end = fbb_.EndTable(start_); + auto o = ::flatbuffers::Offset(end); + return o; + } }; inline ::flatbuffers::Offset CreateMatchingSearchJoinRoomInfo( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset room = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attr = 0) { - MatchingSearchJoinRoomInfoBuilder builder_(_fbb); - builder_.add_attr(attr); - builder_.add_room(room); - return builder_.Finish(); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset room = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attr = 0) +{ + MatchingSearchJoinRoomInfoBuilder builder_(_fbb); + builder_.add_attr(attr); + builder_.add_room(room); + return builder_.Finish(); } inline ::flatbuffers::Offset CreateMatchingSearchJoinRoomInfoDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset room = 0, - const std::vector<::flatbuffers::Offset> *attr = nullptr) { - auto attr__ = attr ? _fbb.CreateVector<::flatbuffers::Offset>(*attr) : 0; - return CreateMatchingSearchJoinRoomInfo( - _fbb, - room, - attr__); + ::flatbuffers::FlatBufferBuilder& _fbb, + ::flatbuffers::Offset room = 0, + const std::vector<::flatbuffers::Offset>* attr = nullptr) +{ + auto attr__ = attr ? _fbb.CreateVector<::flatbuffers::Offset>(*attr) : 0; + return CreateMatchingSearchJoinRoomInfo( + _fbb, + room, + attr__); } -#endif // FLATBUFFERS_GENERATED_NP2STRUCTS_H_ +#endif // FLATBUFFERS_GENERATED_NP2STRUCTS_H_ diff --git a/rpcs3/rpcs3/Emu/NP/np_allocator.h b/rpcs3/rpcs3/Emu/NP/np_allocator.h index 25c65ea2e..a78bb1beb 100644 --- a/rpcs3/rpcs3/Emu/NP/np_allocator.h +++ b/rpcs3/rpcs3/Emu/NP/np_allocator.h @@ -15,7 +15,10 @@ namespace np { public: memory_allocator() = default; - memory_allocator(utils::serial& ar) noexcept { save(ar); } + memory_allocator(utils::serial& ar) noexcept + { + save(ar); + } memory_allocator(const memory_allocator&) = delete; memory_allocator& operator=(const memory_allocator&) = delete; @@ -24,8 +27,8 @@ namespace np void setup(vm::ptr ptr_pool, u32 size) { std::lock_guard lock(m_mutex); - m_pool = ptr_pool; - m_size = size; + m_pool = ptr_pool; + m_size = size; m_avail = size; m_allocs.clear(); } @@ -33,8 +36,8 @@ namespace np void release() { std::lock_guard lock(m_mutex); - m_pool = vm::null; - m_size = 0; + m_pool = vm::null; + m_size = 0; m_avail = 0; m_allocs.clear(); } @@ -56,7 +59,7 @@ namespace np return 0; } - u32 last_free = 0; + u32 last_free = 0; bool found_space = false; for (auto& a : m_allocs) @@ -119,7 +122,7 @@ namespace np private: shared_mutex m_mutex; vm::ptr m_pool{}; - u32 m_size = 0; + u32 m_size = 0; u32 m_avail = 0; std::map m_allocs{}; // offset/size }; diff --git a/rpcs3/rpcs3/Emu/NP/np_cache.cpp b/rpcs3/rpcs3/Emu/NP/np_cache.cpp index 3b1c38bd9..7e6e8d6f6 100644 --- a/rpcs3/rpcs3/Emu/NP/np_cache.cpp +++ b/rpcs3/rpcs3/Emu/NP/np_cache.cpp @@ -31,8 +31,8 @@ namespace np } joinDate.tick = sce_member->joinDate.tick; - memberId = sce_member->memberId; - teamId = sce_member->teamId; + memberId = sce_member->memberId; + teamId = sce_member->teamId; if (sce_member->roomGroup) { group_id = sce_member->roomGroup->groupId; @@ -42,7 +42,7 @@ namespace np group_id = 0; } - natType = sce_member->natType; + natType = sce_member->natType; flagAttr = sce_member->flagAttr; for (u32 i = 0; i < sce_member->roomMemberBinAttrInternalNum; i++) @@ -53,7 +53,7 @@ namespace np void room_cache::update(const SceNpMatching2RoomDataInternal* sce_roomdata) { - num_slots = sce_roomdata->maxSlot; + num_slots = sce_roomdata->maxSlot; mask_password = sce_roomdata->passwordSlotMask; groups.clear(); @@ -139,20 +139,20 @@ namespace np { join_mask |= (1ull << ((member.first >> 4) - 1)); } - slots.joinedSlotMask = join_mask; + slots.joinedSlotMask = join_mask; slots.passwordSlotMask = room.mask_password; u64 joinable_slot_mask = (static_cast(1) << room.num_slots) - 1; - u16 num_private_slots = std::popcount(room.mask_password & joinable_slot_mask); - u16 num_public_slots = room.num_slots - num_private_slots; + u16 num_private_slots = std::popcount(room.mask_password & joinable_slot_mask); + u16 num_public_slots = room.num_slots - num_private_slots; - slots.publicSlotNum = num_public_slots; + slots.publicSlotNum = num_public_slots; slots.privateSlotNum = num_private_slots; u16 open_private_slots = num_private_slots - std::popcount(join_mask & room.mask_password); - u16 open_public_slots = num_public_slots - std::popcount(join_mask & (~room.mask_password)); + u16 open_public_slots = num_public_slots - std::popcount(join_mask & (~room.mask_password)); - slots.openPublicSlotNum = open_public_slots; + slots.openPublicSlotNum = open_public_slots; slots.openPrivateSlotNum = open_private_slots; return {CELL_OK, slots}; @@ -242,10 +242,10 @@ namespace np memset(ptr_member, 0, sizeof(SceNpMatching2RoomMemberDataInternal)); memcpy(&ptr_member->userInfo.npId, &member.userInfo.npId, sizeof(SceNpId)); ptr_member->joinDate.tick = member.joinDate.tick; - ptr_member->memberId = member.memberId; - ptr_member->teamId = member.teamId; - ptr_member->natType = member.natType; - ptr_member->flagAttr = member.flagAttr; + ptr_member->memberId = member.memberId; + ptr_member->teamId = member.teamId; + ptr_member->natType = member.natType; + ptr_member->flagAttr = member.flagAttr; } u32 needed_data_size = 0; @@ -310,7 +310,7 @@ namespace np if (num_binattrs) { ptr_member->roomMemberBinAttrInternal.set(mem.allocate(sizeof(SceNpMatching2RoomMemberBinAttrInternal) * num_binattrs)); - ptr_member->roomMemberBinAttrInternalNum = num_binattrs; + ptr_member->roomMemberBinAttrInternalNum = num_binattrs; SceNpMatching2RoomMemberBinAttrInternal* bin_ptr = ptr_member->roomMemberBinAttrInternal.get_ptr(); u32 actual_cnt = 0; @@ -320,8 +320,8 @@ namespace np { const auto& bin = ::at32(member.bins, binattrs_list[i]); bin_ptr[actual_cnt].updateDate.tick = bin.updateDate.tick; - bin_ptr[actual_cnt].data.id = bin.id; - bin_ptr[actual_cnt].data.size = ::size32(bin.data); + bin_ptr[actual_cnt].data.id = bin.id; + bin_ptr[actual_cnt].data.size = ::size32(bin.data); bin_ptr[actual_cnt].data.ptr.set(mem.allocate(::size32(bin.data))); std::memcpy(bin_ptr[actual_cnt].data.ptr.get_ptr(), bin.data.data(), bin.data.size()); actual_cnt++; diff --git a/rpcs3/rpcs3/Emu/NP/np_cache.h b/rpcs3/rpcs3/Emu/NP/np_cache.h index 9e1b496ea..d9de5e937 100644 --- a/rpcs3/rpcs3/Emu/NP/np_cache.h +++ b/rpcs3/rpcs3/Emu/NP/np_cache.h @@ -51,7 +51,7 @@ namespace np { void update(const SceNpMatching2RoomDataInternal* sce_roomdata); - u32 num_slots = 0; + u32 num_slots = 0; SceNpMatching2RoomPasswordSlotMask mask_password = 0; std::optional password; diff --git a/rpcs3/rpcs3/Emu/NP/np_contexts.cpp b/rpcs3/rpcs3/Emu/NP/np_contexts.cpp index acc934c8b..fe1a7241e 100644 --- a/rpcs3/rpcs3/Emu/NP/np_contexts.cpp +++ b/rpcs3/rpcs3/Emu/NP/np_contexts.cpp @@ -8,8 +8,7 @@ LOG_CHANNEL(sceNp2); generic_async_transaction_context::generic_async_transaction_context(const SceNpCommunicationId& communicationId, const SceNpCommunicationPassphrase& passphrase, u64 timeout) - : communicationId(communicationId), passphrase(passphrase), timeout(timeout) - , idm_id(idm::last_id()) + : communicationId(communicationId), passphrase(passphrase), timeout(timeout), idm_id(idm::last_id()) { } diff --git a/rpcs3/rpcs3/Emu/NP/np_contexts.h b/rpcs3/rpcs3/Emu/NP/np_contexts.h index 20e123730..7922c0a88 100644 --- a/rpcs3/rpcs3/Emu/NP/np_contexts.h +++ b/rpcs3/rpcs3/Emu/NP/np_contexts.h @@ -137,8 +137,8 @@ struct tus_transaction_ctx : public generic_async_transaction_context { tus_transaction_ctx(const shared_ptr& tus); - static const u32 id_base = 0x8001; - static const u32 id_step = 1; + static const u32 id_base = 0x8001; + static const u32 id_step = 1; static const u32 id_count = SCE_NP_TUS_MAX_CTX_NUM; SAVESTATE_INIT_POS(51); @@ -153,8 +153,8 @@ struct score_ctx { score_ctx(vm::cptr communicationId, vm::cptr passphrase); - static const u32 id_base = 0x2001; - static const u32 id_step = 1; + static const u32 id_base = 0x2001; + static const u32 id_step = 1; static const u32 id_count = SCE_NP_SCORE_MAX_CTX_NUM; SAVESTATE_INIT_POS(25); @@ -171,8 +171,8 @@ struct score_transaction_ctx : public generic_async_transaction_context { score_transaction_ctx(const shared_ptr& score); - static const u32 id_base = 0x1001; - static const u32 id_step = 1; + static const u32 id_base = 0x1001; + static const u32 id_step = 1; static const u32 id_count = SCE_NP_SCORE_MAX_CTX_NUM; SAVESTATE_INIT_POS(26); @@ -187,8 +187,8 @@ struct match2_ctx { match2_ctx(vm::cptr communicationId, vm::cptr passphrase, s32 option); - static const u32 id_base = 1; - static const u32 id_step = 1; + static const u32 id_base = 1; + static const u32 id_step = 1; static const u32 id_count = 255; // TODO: constant here? SAVESTATE_INIT_POS(27); @@ -217,8 +217,8 @@ struct lookup_title_ctx { lookup_title_ctx(vm::cptr communicationId); - static const u32 id_base = 0x3001; - static const u32 id_step = 1; + static const u32 id_base = 0x3001; + static const u32 id_step = 1; static const u32 id_count = SCE_NP_LOOKUP_MAX_CTX_NUM; SAVESTATE_INIT_POS(28); @@ -232,8 +232,8 @@ struct lookup_transaction_ctx { lookup_transaction_ctx(s32 lt_ctx); - static const u32 id_base = 0x4001; - static const u32 id_step = 1; + static const u32 id_base = 0x4001; + static const u32 id_step = 1; static const u32 id_count = SCE_NP_LOOKUP_MAX_CTX_NUM; SAVESTATE_INIT_POS(29); @@ -246,8 +246,8 @@ struct commerce2_ctx { commerce2_ctx(u32 version, vm::cptr npid, vm::ptr handler, vm::ptr arg); - static const u32 id_base = 0x5001; - static const u32 id_step = 1; + static const u32 id_base = 0x5001; + static const u32 id_step = 1; static const u32 id_count = SCE_NP_COMMERCE2_CTX_MAX; SAVESTATE_INIT_POS(30); @@ -264,8 +264,8 @@ struct signaling_ctx { signaling_ctx(vm::ptr npid, vm::ptr handler, vm::ptr arg); - static const u32 id_base = 0x6001; - static const u32 id_step = 1; + static const u32 id_base = 0x6001; + static const u32 id_step = 1; static const u32 id_count = SCE_NP_SIGNALING_CTX_MAX; SAVESTATE_INIT_POS(31); diff --git a/rpcs3/rpcs3/Emu/NP/np_dnshook.cpp b/rpcs3/rpcs3/Emu/NP/np_dnshook.cpp index a035947e1..acf4b0ead 100644 --- a/rpcs3/rpcs3/Emu/NP/np_dnshook.cpp +++ b/rpcs3/rpcs3/Emu/NP/np_dnshook.cpp @@ -163,9 +163,9 @@ namespace np std::vector fake(len); memcpy(fake.data(), buf, len); dns_header* fake_header = reinterpret_cast(fake.data()); - fake_header->qr = 1; - fake_header->ra = 1; - fake_header->ans_count = 1; + fake_header->qr = 1; + fake_header->ra = 1; + fake_header->ans_count = 1; fake.insert(fake.end(), {0xC0, 0x0C}); // Ref to name in header fake.insert(fake.end(), {0x00, 0x01}); // IPv4 fake.insert(fake.end(), {0x00, 0x01}); // Class? diff --git a/rpcs3/rpcs3/Emu/NP/np_handler.cpp b/rpcs3/rpcs3/Emu/NP/np_handler.cpp index 4597d27b1..86fa47b1a 100644 --- a/rpcs3/rpcs3/Emu/NP/np_handler.cpp +++ b/rpcs3/rpcs3/Emu/NP/np_handler.cpp @@ -154,25 +154,25 @@ namespace np case SCE_NP_TICKET_PARAM_ISSUER_ID: { const auto& node = nodes[0].data.data_nodes[1]; - param->ui32 = node.data.data_u32; + param->ui32 = node.data.data_u32; break; } case SCE_NP_TICKET_PARAM_ISSUED_DATE: { const auto& node = nodes[0].data.data_nodes[2]; - param->ui64 = node.data.data_u64; + param->ui64 = node.data.data_u64; break; } case SCE_NP_TICKET_PARAM_EXPIRE_DATE: { const auto& node = nodes[0].data.data_nodes[3]; - param->ui64 = node.data.data_u64; + param->ui64 = node.data.data_u64; break; } case SCE_NP_TICKET_PARAM_SUBJECT_ACCOUNT_ID: { const auto& node = nodes[0].data.data_nodes[4]; - param->ui64 = node.data.data_u64; + param->ui64 = node.data.data_u64; break; } case SCE_NP_TICKET_PARAM_SUBJECT_ONLINE_ID: @@ -222,7 +222,7 @@ namespace np case SCE_NP_TICKET_PARAM_SUBJECT_STATUS: { const auto& node = nodes[0].data.data_nodes[9]; - param->ui32 = node.data.data_u32; + param->ui32 = node.data.data_u32; break; } case SCE_NP_TICKET_PARAM_STATUS_DURATION: @@ -427,7 +427,7 @@ namespace np g_fxo->need>(); - is_connected = (g_cfg.net.net_active == np_internet_status::enabled); + is_connected = (g_cfg.net.net_active == np_internet_status::enabled); is_psn_active = (g_cfg.net.psn_status >= np_psn_status::psn_fake) && is_connected; if (get_net_status() == CELL_NET_CTL_STATE_IPObtained) @@ -436,7 +436,7 @@ namespace np if (!discover_ether_address() || !discover_ip_address()) { nph_log.error("Failed to discover ethernet or ip address!"); - is_connected = false; + is_connected = false; is_psn_active = false; return; } @@ -576,7 +576,7 @@ namespace np addr.sin_family = AF_INET; addr.sin_port = 53; addr.sin_addr.s_addr = 0x08080808; - if (connect(sockfd, reinterpret_cast(&addr), sizeof(addr)) != 0) + if (connect(sockfd, reinterpret_cast(&addr), sizeof(addr)) != 0) { // If connect fails a route to the internet is not available nph_log.error("connect to discover local ip failed: %d", get_native_error()); @@ -650,7 +650,7 @@ namespace np if (ioctl(sock, SIOCGIFCONF, &ifc) == -1) return false; - ifreq* it = ifc.ifc_req; + ifreq* it = ifc.ifc_req; const ifreq* const end = it + (ifc.ifc_len / sizeof(ifreq)); for (; it != end; ++it) @@ -831,7 +831,7 @@ namespace np return; } - local_ip_addr = std::bit_cast>(rpcn->get_addr_local()); + local_ip_addr = std::bit_cast>(rpcn->get_addr_local()); break; } @@ -1003,7 +1003,7 @@ namespace np if (cur_event.event != SCE_NP_BASIC_EVENT_OFFLINE) { const u32 size_avail = *size; - const u32 res_size = std::min(static_cast(cur_event.data.size()), size_avail); + const u32 res_size = std::min(static_cast(cur_event.data.size()), size_avail); memcpy(data.get_ptr(), cur_event.data.data(), res_size); *size = res_size; @@ -1098,7 +1098,7 @@ namespace np for (auto& reply : replies) { const rpcn::CommandType command = static_cast(reply.second.first); - const u32 req_id = reply.first; + const u32 req_id = reply.first; std::vector& data = reply.second.second; // Every reply should at least contain a return value/error code @@ -1293,7 +1293,7 @@ namespace np ret.ctx_id = ctx_id; ret.cb_arg = (optParam && optParam->cbFuncArg) ? optParam->cbFuncArg : ctx->default_match2_optparam.cbFuncArg; - ret.cb = (optParam && optParam->cbFunc) ? optParam->cbFunc : ctx->default_match2_optparam.cbFunc; + ret.cb = (optParam && optParam->cbFunc) ? optParam->cbFunc : ctx->default_match2_optparam.cbFunc; ret.event_type = event_type; nph_log.trace("Callback used is 0x%x with req_id %d", ret.cb, req_id); @@ -1366,7 +1366,10 @@ namespace np while (players_history.size() > MAX_HISTORY_ENTRIES) { - auto it = std::min_element(players_history.begin(), players_history.end(), [](const auto& a, const auto& b) { return a.second.timestamp < b.second.timestamp; } ); + auto it = std::min_element(players_history.begin(), players_history.end(), [](const auto& a, const auto& b) + { + return a.second.timestamp < b.second.timestamp; + }); players_history.erase(it); } @@ -1391,7 +1394,10 @@ namespace np while (players_history.size() > MAX_HISTORY_ENTRIES) { - auto it = std::min_element(players_history.begin(), players_history.end(), [](const auto& a, const auto& b) { return a.second.timestamp < b.second.timestamp; } ); + auto it = std::min_element(players_history.begin(), players_history.end(), [](const auto& a, const auto& b) + { + return a.second.timestamp < b.second.timestamp; + }); players_history.erase(it); } @@ -1596,7 +1602,7 @@ namespace np } std::lock_guard lock(mutex_rpcn); - + if (!rpcn) { return SCE_NP_BASIC_ERROR_NOT_CONNECTED; diff --git a/rpcs3/rpcs3/Emu/NP/np_handler.h b/rpcs3/rpcs3/Emu/NP/np_handler.h index c7a086f22..5921a1700 100644 --- a/rpcs3/rpcs3/Emu/NP/np_handler.h +++ b/rpcs3/rpcs3/Emu/NP/np_handler.h @@ -19,9 +19,8 @@ namespace np { - constexpr usz MAX_SceNpMatchingAttr_list_SIZE = ((SCE_NP_MATCHING_ATTR_ID_MAX * 2) * sizeof(SceNpMatchingAttr)) - + (SCE_NP_MATCHING_ATTR_BIN_BIG_SIZE_ID_MAX * SCE_NP_MATCHING_ATTR_BIN_MAX_SIZE_BIG) + - + ((SCE_NP_MATCHING_ATTR_ID_MAX - SCE_NP_MATCHING_ATTR_BIN_BIG_SIZE_ID_MAX) * SCE_NP_MATCHING_ATTR_BIN_MAX_SIZE_SMALL); + constexpr usz MAX_SceNpMatchingAttr_list_SIZE = ((SCE_NP_MATCHING_ATTR_ID_MAX * 2) * sizeof(SceNpMatchingAttr)) + (SCE_NP_MATCHING_ATTR_BIN_BIG_SIZE_ID_MAX * SCE_NP_MATCHING_ATTR_BIN_MAX_SIZE_BIG) + + +((SCE_NP_MATCHING_ATTR_ID_MAX - SCE_NP_MATCHING_ATTR_BIN_BIG_SIZE_ID_MAX) * SCE_NP_MATCHING_ATTR_BIN_MAX_SIZE_SMALL); constexpr usz MAX_MEMBERS_PER_ROOM = 64; constexpr usz MAX_ROOMS_PER_GET_ROOM_LIST = 20; constexpr usz MAX_SceNpMatchingRoomStatus_SIZE = sizeof(SceNpMatchingRoomStatus) + (MAX_MEMBERS_PER_ROOM * sizeof(SceNpMatchingRoomMember)) + sizeof(SceNpId); @@ -124,15 +123,15 @@ namespace np void init_NP(u32 poolsize, vm::ptr poolptr); void terminate_NP(); - atomic_t is_netctl_init = false; - atomic_t is_NP_init = false; - atomic_t is_NP_Lookup_init = false; - atomic_t is_NP_Score_init = false; - atomic_t is_NP2_init = false; + atomic_t is_netctl_init = false; + atomic_t is_NP_init = false; + atomic_t is_NP_Lookup_init = false; + atomic_t is_NP_Score_init = false; + atomic_t is_NP2_init = false; atomic_t is_NP2_Match2_init = false; - atomic_t is_NP_Auth_init = false; - atomic_t is_NP_TUS_init = false; // TODO: savestate - atomic_t is_NP_Com2_init = false; // TODO: savestate + atomic_t is_NP_Auth_init = false; + atomic_t is_NP_TUS_init = false; // TODO: savestate + atomic_t is_NP_Com2_init = false; // TODO: savestate // NP Handlers/Callbacks // Seems to be global @@ -217,7 +216,7 @@ namespace np void tus_set_multislot_variable(shared_ptr& trans_ctx, const SceNpOnlineId& targetNpId, vm::cptr slotIdArray, vm::cptr variableArray, s32 arrayNum, bool vuser, bool async); void tus_get_multislot_variable(shared_ptr& trans_ctx, const SceNpOnlineId& targetNpId, vm::cptr slotIdArray, vm::ptr variableArray, s32 arrayNum, bool vuser, bool async); void tus_get_multiuser_variable(shared_ptr& trans_ctx, std::vector targetNpIdArray, SceNpTusSlotId slotId, vm::ptr variableArray, s32 arrayNum, bool vuser, bool async); - void tus_get_friends_variable(shared_ptr& trans_ctx, SceNpTusSlotId slotId, s32 includeSelf, s32 sortType, vm::ptr variableArray,s32 arrayNum, bool async); + void tus_get_friends_variable(shared_ptr& trans_ctx, SceNpTusSlotId slotId, s32 includeSelf, s32 sortType, vm::ptr variableArray, s32 arrayNum, bool async); void tus_add_and_get_variable(shared_ptr& trans_ctx, const SceNpOnlineId& targetNpId, SceNpTusSlotId slotId, s64 inVariable, vm::ptr outVariable, vm::ptr option, bool vuser, bool async); void tus_try_and_set_variable(shared_ptr& trans_ctx, const SceNpOnlineId& targetNpId, SceNpTusSlotId slotId, s32 opeType, s64 variable, vm::ptr resultVariable, vm::ptr option, bool vuser, bool async); void tus_delete_multislot_variable(shared_ptr& trans_ctx, const SceNpOnlineId& targetNpId, vm::cptr slotIdArray, s32 arrayNum, bool vuser, bool async); @@ -269,7 +268,7 @@ namespace np // For custom menu struct custom_menu_action { - s32 id = 0; + s32 id = 0; u32 mask = SCE_NP_CUSTOM_MENU_ACTION_MASK_ME; std::string name; }; @@ -378,10 +377,10 @@ namespace np if (cb) { sysutil_register_cb([=, ctx_id = this->ctx_id, event_type = this->event_type, cb = this->cb, cb_arg = this->cb_arg](ppu_thread& cb_ppu) -> s32 - { - cb(cb_ppu, ctx_id, req_id, event_type, event_key, error_code, data_size, cb_arg); - return 0; - }); + { + cb(cb_ppu, ctx_id, req_id, event_type, event_key, error_code, data_size, cb_arg); + return 0; + }); } } }; @@ -410,7 +409,7 @@ namespace np bool context_sensitive = false; } basic_handler; - bool is_connected = false; + bool is_connected = false; bool is_psn_active = false; ticket current_ticket; @@ -447,7 +446,7 @@ namespace np shared_mutex mutex_match2_req_results; std::unordered_map match2_req_results; atomic_t match2_low_reqid_cnt = 1; - atomic_t match2_event_cnt = 1; + atomic_t match2_event_cnt = 1; u32 get_req_id(u16 app_req) { return ((app_req << 16) | match2_low_reqid_cnt.fetch_add(1)); diff --git a/rpcs3/rpcs3/Emu/NP/np_helpers.cpp b/rpcs3/rpcs3/Emu/NP/np_helpers.cpp index be2618b5c..d6147c352 100644 --- a/rpcs3/rpcs3/Emu/NP/np_helpers.cpp +++ b/rpcs3/rpcs3/Emu/NP/np_helpers.cpp @@ -82,9 +82,14 @@ namespace np bool is_valid_npid(const SceNpId& npid) { - if (!std::all_of(npid.handle.data, npid.handle.data + 16, [](char c) { return std::isalnum(c) || c == '-' || c == '_' || c == 0; } ) - || npid.handle.data[16] != 0 - || !std::all_of(npid.handle.dummy, npid.handle.dummy + 3, [](char val) { return val == 0; }) ) + if (!std::all_of(npid.handle.data, npid.handle.data + 16, [](char c) + { + return std::isalnum(c) || c == '-' || c == '_' || c == 0; + }) || + npid.handle.data[16] != 0 || !std::all_of(npid.handle.dummy, npid.handle.dummy + 3, [](char val) + { + return val == 0; + })) { return false; } @@ -116,4 +121,4 @@ namespace np return false; } -} +} // namespace np diff --git a/rpcs3/rpcs3/Emu/NP/np_helpers.h b/rpcs3/rpcs3/Emu/NP/np_helpers.h index a90f5d144..e9017346c 100644 --- a/rpcs3/rpcs3/Emu/NP/np_helpers.h +++ b/rpcs3/rpcs3/Emu/NP/np_helpers.h @@ -21,4 +21,4 @@ namespace np bool is_valid_npid(const SceNpId& npid); bool is_same_npid(const SceNpId& npid_1, const SceNpId& npid_2); -} +} // namespace np diff --git a/rpcs3/rpcs3/Emu/NP/np_notifications.cpp b/rpcs3/rpcs3/Emu/NP/np_notifications.cpp index 55b74ec76..9fa79053a 100644 --- a/rpcs3/rpcs3/Emu/NP/np_notifications.cpp +++ b/rpcs3/rpcs3/Emu/NP/np_notifications.cpp @@ -29,7 +29,7 @@ namespace np const auto [include_onlinename, include_avatarurl] = get_match2_context_options(room_event_cb_ctx); const auto room_id = notification->room_id(); - auto& edata = allocate_req_result(event_key, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMemberUpdateInfo, sizeof(SceNpMatching2RoomMemberUpdateInfo)); + auto& edata = allocate_req_result(event_key, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMemberUpdateInfo, sizeof(SceNpMatching2RoomMemberUpdateInfo)); auto* notif_data = reinterpret_cast(edata.data()); RoomMemberUpdateInfo_to_SceNpMatching2RoomMemberUpdateInfo(edata, notification->update_info(), notif_data, include_onlinename, include_avatarurl); np_memory.shrink_allocation(edata.addr(), edata.size()); @@ -73,7 +73,7 @@ namespace np void np_handler::notif_user_left_room(vec_stream& noti) { - u64 room_id = noti.get(); + u64 room_id = noti.get(); const auto* update_info = noti.get_flatbuffer(); if (noti.is_error()) @@ -85,7 +85,7 @@ namespace np const u32 event_key = get_event_key(); auto [include_onlinename, include_avatarurl] = get_match2_context_options(room_event_cb_ctx); - auto& edata = allocate_req_result(event_key, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMemberUpdateInfo, sizeof(SceNpMatching2RoomMemberUpdateInfo)); + auto& edata = allocate_req_result(event_key, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMemberUpdateInfo, sizeof(SceNpMatching2RoomMemberUpdateInfo)); auto* notif_data = reinterpret_cast(edata.data()); RoomMemberUpdateInfo_to_SceNpMatching2RoomMemberUpdateInfo(edata, update_info, notif_data, include_onlinename, include_avatarurl); np_memory.shrink_allocation(edata.addr(), edata.size()); @@ -112,7 +112,7 @@ namespace np void np_handler::notif_room_destroyed(vec_stream& noti) { - u64 room_id = noti.get(); + u64 room_id = noti.get(); const auto* update_info = noti.get_flatbuffer(); if (noti.is_error()) @@ -123,7 +123,7 @@ namespace np const u32 event_key = get_event_key(); - auto& edata = allocate_req_result(event_key, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomUpdateInfo, sizeof(SceNpMatching2RoomUpdateInfo)); + auto& edata = allocate_req_result(event_key, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomUpdateInfo, sizeof(SceNpMatching2RoomUpdateInfo)); auto* notif_data = reinterpret_cast(edata.data()); RoomUpdateInfo_to_SceNpMatching2RoomUpdateInfo(update_info, notif_data); np_memory.shrink_allocation(edata.addr(), edata.size()); @@ -157,7 +157,7 @@ namespace np const u32 event_key = get_event_key(); auto [include_onlinename, include_avatarurl] = get_match2_context_options(room_event_cb_ctx); - auto& edata = allocate_req_result(event_key, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomDataInternalUpdateInfo, sizeof(SceNpMatching2RoomDataInternalUpdateInfo)); + auto& edata = allocate_req_result(event_key, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomDataInternalUpdateInfo, sizeof(SceNpMatching2RoomDataInternalUpdateInfo)); auto* notif_data = reinterpret_cast(edata.data()); RoomDataInternalUpdateInfo_to_SceNpMatching2RoomDataInternalUpdateInfo(edata, update_info, notif_data, npid, include_onlinename, include_avatarurl); np_memory.shrink_allocation(edata.addr(), edata.size()); @@ -192,7 +192,7 @@ namespace np const u32 event_key = get_event_key(); auto [include_onlinename, include_avatarurl] = get_match2_context_options(room_event_cb_ctx); - auto& edata = allocate_req_result(event_key, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMemberDataInternalUpdateInfo, sizeof(SceNpMatching2RoomMemberDataInternalUpdateInfo)); + auto& edata = allocate_req_result(event_key, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMemberDataInternalUpdateInfo, sizeof(SceNpMatching2RoomMemberDataInternalUpdateInfo)); auto* notif_data = reinterpret_cast(edata.data()); RoomMemberDataInternalUpdateInfo_to_SceNpMatching2RoomMemberDataInternalUpdateInfo(edata, update_info, notif_data, include_onlinename, include_avatarurl); np_memory.shrink_allocation(edata.addr(), edata.size()); @@ -218,8 +218,8 @@ namespace np void np_handler::notif_room_message_received(vec_stream& noti) { - u64 room_id = noti.get(); - u16 member_id = noti.get(); + u64 room_id = noti.get(); + u16 member_id = noti.get(); const auto* message_info = noti.get_flatbuffer(); if (noti.is_error()) @@ -231,7 +231,7 @@ namespace np const u32 event_key = get_event_key(); auto [include_onlinename, include_avatarurl] = get_match2_context_options(room_event_cb_ctx); - auto& edata = allocate_req_result(event_key, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMessageInfo, sizeof(SceNpMatching2RoomMessageInfo)); + auto& edata = allocate_req_result(event_key, SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomMessageInfo, sizeof(SceNpMatching2RoomMessageInfo)); auto* notif_data = reinterpret_cast(edata.data()); RoomMessageInfo_to_SceNpMatching2RoomMessageInfo(edata, message_info, notif_data, include_onlinename, include_avatarurl); np_memory.shrink_allocation(edata.addr(), edata.size()); diff --git a/rpcs3/rpcs3/Emu/NP/np_requests.cpp b/rpcs3/rpcs3/Emu/NP/np_requests.cpp index 23e18f135..f49967750 100644 --- a/rpcs3/rpcs3/Emu/NP/np_requests.cpp +++ b/rpcs3/rpcs3/Emu/NP/np_requests.cpp @@ -964,8 +964,7 @@ namespace np .updateMode = resp->updateMode(), .sortMode = resp->sortMode(), .uploadNumLimit = resp->uploadNumLimit(), - .uploadSizeLimit = resp->uploadSizeLimit() - }; + .uploadSizeLimit = resp->uploadSizeLimit()}; std::lock_guard lock(score_trans->mutex); @@ -1596,7 +1595,7 @@ namespace np std::unique_lock lock(trans_ctx->mutex); const u32 req_id = get_req_id(REQUEST_ID_HIGH::TUS); - trans_ctx->tdata = tdata_tus_get_variables_generic { + trans_ctx->tdata = tdata_tus_get_variables_generic{ .variableArray = variableArray, .arrayNum = arrayNum, }; @@ -1615,7 +1614,7 @@ namespace np std::unique_lock lock(trans_ctx->mutex); const u32 req_id = get_req_id(REQUEST_ID_HIGH::TUS); - trans_ctx->tdata = tdata_tus_get_variables_generic { + trans_ctx->tdata = tdata_tus_get_variables_generic{ .variableArray = variableArray, .arrayNum = arrayNum, }; @@ -1629,12 +1628,12 @@ namespace np return handle_TusVarResponse(req_id, error, reply); } - void np_handler::tus_get_friends_variable(shared_ptr& trans_ctx, SceNpTusSlotId slotId, s32 includeSelf, s32 sortType, vm::ptr variableArray,s32 arrayNum, bool async) + void np_handler::tus_get_friends_variable(shared_ptr& trans_ctx, SceNpTusSlotId slotId, s32 includeSelf, s32 sortType, vm::ptr variableArray, s32 arrayNum, bool async) { std::unique_lock lock(trans_ctx->mutex); const u32 req_id = get_req_id(REQUEST_ID_HIGH::TUS); - trans_ctx->tdata = tdata_tus_get_variables_generic { + trans_ctx->tdata = tdata_tus_get_variables_generic{ .variableArray = variableArray, .arrayNum = arrayNum, }; @@ -1653,7 +1652,7 @@ namespace np std::unique_lock lock(trans_ctx->mutex); const u32 req_id = get_req_id(REQUEST_ID_HIGH::TUS); - trans_ctx->tdata = tdata_tus_get_variable_generic { + trans_ctx->tdata = tdata_tus_get_variable_generic{ .outVariable = outVariable, }; @@ -1671,7 +1670,7 @@ namespace np std::unique_lock lock(trans_ctx->mutex); const u32 req_id = get_req_id(REQUEST_ID_HIGH::TUS); - trans_ctx->tdata = tdata_tus_get_variable_generic { + trans_ctx->tdata = tdata_tus_get_variable_generic{ .outVariable = resultVariable, }; @@ -1796,7 +1795,7 @@ namespace np return; // Sanity check to make compiler happy auto* data_status = tdata->dataStatus.get_ptr(); - auto* data = static_cast(tdata->data.get_ptr()); + auto* data = static_cast(tdata->data.get_ptr()); memset(data_status, 0, sizeof(SceNpTusDataStatus)); string_to_npid(fb_status->ownerId()->string_view(), data_status->ownerId); @@ -1809,7 +1808,7 @@ namespace np data_status->data = tdata->data; data_status->dataSize = fb_data->data() ? fb_data->data()->size() : 0; data_status->info.infoSize = fb_status->info() ? fb_status->info()->size() : 0; - + const u32 to_copy = std::min(data_status->dataSize, tdata->recvSize); for (flatbuffers::uoffset_t i = 0; i < to_copy; i++) { @@ -1841,7 +1840,7 @@ namespace np std::unique_lock lock(trans_ctx->mutex); const u32 req_id = get_req_id(REQUEST_ID_HIGH::TUS); - trans_ctx->tdata = tdata_tus_get_datastatus_generic { + trans_ctx->tdata = tdata_tus_get_datastatus_generic{ .statusArray = statusArray, .arrayNum = arrayNum, }; @@ -1860,7 +1859,7 @@ namespace np std::unique_lock lock(trans_ctx->mutex); const u32 req_id = get_req_id(REQUEST_ID_HIGH::TUS); - trans_ctx->tdata = tdata_tus_get_datastatus_generic { + trans_ctx->tdata = tdata_tus_get_datastatus_generic{ .statusArray = statusArray, .arrayNum = arrayNum, }; @@ -1879,7 +1878,7 @@ namespace np std::unique_lock lock(trans_ctx->mutex); const u32 req_id = get_req_id(REQUEST_ID_HIGH::TUS); - trans_ctx->tdata = tdata_tus_get_datastatus_generic { + trans_ctx->tdata = tdata_tus_get_datastatus_generic{ .statusArray = statusArray, .arrayNum = arrayNum, }; diff --git a/rpcs3/rpcs3/Emu/NP/np_structs_extra.cpp b/rpcs3/rpcs3/Emu/NP/np_structs_extra.cpp index 2acba3d04..5fb857e22 100644 --- a/rpcs3/rpcs3/Emu/NP/np_structs_extra.cpp +++ b/rpcs3/rpcs3/Emu/NP/np_structs_extra.cpp @@ -104,7 +104,7 @@ namespace extra_nps for (u32 i = 0; i < req->roomSearchableIntAttrExternalNum && req->roomSearchableIntAttrExternal; i++) print_int_attr(&req->roomSearchableIntAttrExternal[i]); - + sceNp2.warning("roomSearchableBinAttrExternal: *0x%x", req->roomSearchableBinAttrExternal); sceNp2.warning("roomSearchableBinAttrExternalNum: %d", req->roomSearchableBinAttrExternalNum); @@ -186,7 +186,7 @@ namespace extra_nps sceNp2.warning("SceNpMatching2SearchRoomResponse:"); print_range(&resp->range); - const SceNpMatching2RoomDataExternal *room_ptr = resp->roomDataExternal.get_ptr(); + const SceNpMatching2RoomDataExternal* room_ptr = resp->roomDataExternal.get_ptr(); for (u32 i = 0; i < resp->range.total; i++) { sceNp2.warning("SceNpMatching2SearchRoomResponse[%d]:", i); @@ -471,7 +471,7 @@ namespace extra_nps { sceNp.warning("ptr: *0x%x", data->value.data.ptr); sceNp.warning("size: %d", data->value.data.size); - sceNp.warning("data:\n%s", fmt::buf_to_hexstring(static_cast(data->value.data.ptr.get_ptr()), data->value.data.size)); + sceNp.warning("data:\n%s", fmt::buf_to_hexstring(static_cast(data->value.data.ptr.get_ptr()), data->value.data.size)); } else { diff --git a/rpcs3/rpcs3/Emu/NP/rpcn_client.h b/rpcs3/rpcs3/Emu/NP/rpcn_client.h index 2ada34b58..d13721087 100644 --- a/rpcs3/rpcs3/Emu/NP/rpcn_client.h +++ b/rpcs3/rpcs3/Emu/NP/rpcn_client.h @@ -177,13 +177,13 @@ public: protected: std::vector& vec; std::vector> aligned_bufs; - usz i = 0; + usz i = 0; bool error = false; }; namespace rpcn { - using friend_cb_func = void (*)(void* param, NotificationType ntype, const std::string& username, bool status); + using friend_cb_func = void (*)(void* param, NotificationType ntype, const std::string& username, bool status); using message_cb_func = void (*)(void* param, const shared_ptr> new_msg, u64 msg_id); struct friend_online_data @@ -223,10 +223,10 @@ namespace rpcn static inline std::weak_ptr instance; static inline shared_mutex inst_mutex; - atomic_t connected = false; + atomic_t connected = false; atomic_t authentified = false; - atomic_t want_conn = false; - atomic_t want_auth = false; + atomic_t want_conn = false; + atomic_t want_auth = false; std::binary_semaphore sem_connected, sem_authentified; std::mutex mutex_connected, mutex_authentified; @@ -285,7 +285,7 @@ namespace rpcn public: ~rpcn_client(); - rpcn_client(rpcn_client& other) = delete; + rpcn_client(rpcn_client& other) = delete; void operator=(const rpcn_client&) = delete; static std::shared_ptr get_instance(bool check_config = false); rpcn_state wait_for_connection(); @@ -354,7 +354,7 @@ namespace rpcn bool get_score_range(u32 req_id, const SceNpCommunicationId& communication_id, SceNpScoreBoardId board_id, u32 start_rank, u32 num_rank, bool with_comment, bool with_gameinfo); bool get_score_npid(u32 req_id, const SceNpCommunicationId& communication_id, SceNpScoreBoardId board_id, const std::vector>& npids, bool with_comment, bool with_gameinfo); bool get_score_friend(u32 req_id, const SceNpCommunicationId& communication_id, SceNpScoreBoardId board_id, bool include_self, bool with_comment, bool with_gameinfo, u32 max_entries); - bool record_score_data(u32 req_id, const SceNpCommunicationId& communication_id, SceNpScorePcId pc_id, SceNpScoreBoardId board_id, s64 score, const std::vector& score_data); + bool record_score_data(u32 req_id, const SceNpCommunicationId& communication_id, SceNpScorePcId pc_id, SceNpScoreBoardId board_id, s64 score, const std::vector& score_data); bool get_score_data(u32 req_id, const SceNpCommunicationId& communication_id, SceNpScorePcId pc_id, SceNpScoreBoardId board_id, const SceNpId& npid); bool tus_set_multislot_variable(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpOnlineId& targetNpId, vm::cptr slotIdArray, vm::cptr variableArray, s32 arrayNum, bool vuser); bool tus_get_multislot_variable(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpOnlineId& targetNpId, vm::cptr slotIdArray, s32 arrayNum, bool vuser); @@ -407,11 +407,11 @@ namespace rpcn private: WOLFSSL_CTX* wssl_ctx = nullptr; - WOLFSSL* read_wssl = nullptr; - WOLFSSL* write_wssl = nullptr; + WOLFSSL* read_wssl = nullptr; + WOLFSSL* write_wssl = nullptr; atomic_t server_info_received = false; - u32 received_version = 0; + u32 received_version = 0; sockaddr_in addr_rpcn{}; sockaddr_in addr_rpcn_udp_ipv4{}; @@ -440,7 +440,7 @@ namespace rpcn bool operator<(const message_cb_t& other) const { - const void* void_cb_func = reinterpret_cast(cb_func); + const void* void_cb_func = reinterpret_cast(cb_func); const void* void_other_cb_func = reinterpret_cast(other.cb_func); return (void_cb_func < void_other_cb_func) || ((!(void_other_cb_func < void_cb_func)) && (cb_param < other.cb_param)); } @@ -448,9 +448,9 @@ namespace rpcn shared_mutex mutex_messages; std::set message_cbs; std::unordered_map>> messages; // msg id / (sender / message) - std::set active_messages; // msg id of messages that have not been discarded - std::vector new_messages; // list of msg_id used to inform np_handler of new messages - u64 message_counter = 3; // id counter + std::set active_messages; // msg id of messages that have not been discarded + std::vector new_messages; // list of msg_id used to inform np_handler of new messages + u64 message_counter = 3; // id counter std::string online_name{}; std::string avatar_url{}; diff --git a/rpcs3/rpcs3/Emu/NP/rpcn_countries.cpp b/rpcs3/rpcs3/Emu/NP/rpcn_countries.cpp index 9d841d9df..1e225c792 100644 --- a/rpcs3/rpcs3/Emu/NP/rpcn_countries.cpp +++ b/rpcs3/rpcs3/Emu/NP/rpcn_countries.cpp @@ -76,7 +76,5 @@ namespace countries country_code{"United Arab Emirates", "ae"}, country_code{"United Kingdom", "gb"}, country_code{"Uruguay", "uy"}, - country_code{"Vietnam", "vn"} - }; + country_code{"Vietnam", "vn"}}; } // namespace countries - diff --git a/rpcs3/rpcs3/Emu/NP/rpcn_countries.h b/rpcs3/rpcs3/Emu/NP/rpcn_countries.h index 5c7e00fb4..d55360f82 100644 --- a/rpcs3/rpcs3/Emu/NP/rpcn_countries.h +++ b/rpcs3/rpcs3/Emu/NP/rpcn_countries.h @@ -12,4 +12,3 @@ namespace countries }; extern const std::array g_countries; } // namespace countries - diff --git a/rpcs3/rpcs3/Emu/NP/signaling_handler.cpp b/rpcs3/rpcs3/Emu/NP/signaling_handler.cpp index 2e4ac5df5..30ef1a092 100644 --- a/rpcs3/rpcs3/Emu/NP/signaling_handler.cpp +++ b/rpcs3/rpcs3/Emu/NP/signaling_handler.cpp @@ -429,7 +429,7 @@ void signaling_handler::operator()() sign_log.notice("Timeout disconnection"); update_si_status(sig.sig_info, SCE_NP_SIGNALING_CONN_STATUS_INACTIVE, SCE_NP_SIGNALING_ERROR_TIMEOUT); retire_packet(sig.sig_info, signal_ping); // Retire ping packet if necessary - break; // qpackets has been emptied of all packets for this user so we're requeuing + break; // qpackets has been emptied of all packets for this user so we're requeuing } // Update the timestamp if necessary diff --git a/rpcs3/rpcs3/Emu/NP/vport0.h b/rpcs3/rpcs3/Emu/NP/vport0.h index 927e1a539..c34cf8545 100644 --- a/rpcs3/rpcs3/Emu/NP/vport0.h +++ b/rpcs3/rpcs3/Emu/NP/vport0.h @@ -22,6 +22,6 @@ constexpr s32 VPORT_0_HEADER_SIZE = sizeof(u16) + sizeof(u8); // Subset 1: Signaling enum VPORT_0_SUBSET : u8 { - SUBSET_RPCN = 0, + SUBSET_RPCN = 0, SUBSET_SIGNALING = 1, }; diff --git a/rpcs3/rpcs3/Emu/RSX/Capture/rsx_capture.cpp b/rpcs3/rpcs3/Emu/RSX/Capture/rsx_capture.cpp index 3ac2dd929..9fbc035ae 100644 --- a/rpcs3/rpcs3/Emu/RSX/Capture/rsx_capture.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Capture/rsx_capture.cpp @@ -53,10 +53,10 @@ namespace rsx // capture fragment shader mem const auto [program_offset, program_location] = method_registers.shader_program_address(); - const u32 addr = get_address(program_offset, program_location); + const u32 addr = get_address(program_offset, program_location); const auto program_info = program_hash_util::fragment_program_utils::analyse_fragment_program(vm::base(addr)); const u32 program_start = program_info.program_start_offset; - const u32 ucode_size = program_info.program_ucode_length; + const u32 ucode_size = program_info.program_ucode_length; frame_capture_data::memory_block block; block.offset = program_offset; @@ -75,7 +75,7 @@ namespace rsx continue; const u32 texaddr = get_address(tex.offset(), tex.location()); - auto layout = get_subresources_layout(tex); + auto layout = get_subresources_layout(tex); // todo: dont use this function and just get size somehow usz texSize = 0; @@ -101,7 +101,7 @@ namespace rsx continue; const u32 texaddr = get_address(tex.offset(), tex.location()); - auto layout = get_subresources_layout(tex); + auto layout = get_subresources_layout(tex); // todo: dont use this function and just get size somehow usz texSize = 0; @@ -135,11 +135,11 @@ namespace rsx continue; // vert buffer - const u32 base_address = get_vertex_offset_from_base(method_registers.vertex_data_base_offset(), info.offset() & 0x7fffffff); + const u32 base_address = get_vertex_offset_from_base(method_registers.vertex_data_base_offset(), info.offset() & 0x7fffffff); const u32 memory_location = info.offset() >> 31; - const u32 addr = get_address(base_address, memory_location); - const u32 vertSize = get_vertex_type_size_on_host(info.type(), info.size()); + const u32 addr = get_address(base_address, memory_location); + const u32 vertSize = get_vertex_type_size_on_host(info.type(), info.size()); const u32 vertStride = info.stride(); method_registers.current_draw_clause.begin(); @@ -156,8 +156,7 @@ namespace rsx block_data.data.resize(bufferSize); std::memcpy(block_data.data.data(), vm::base(addr + (range.first * vertStride)), bufferSize); insert_mem_block_in_map(mem_indexer, mem_changes, std::move(block), std::move(block_data)); - } - while (method_registers.current_draw_clause.next()); + } while (method_registers.current_draw_clause.next()); } } // save index buffer if used @@ -165,18 +164,18 @@ namespace rsx { const u32 input_mask = method_registers.vertex_attrib_input_mask(); - const u32 base_address = method_registers.index_array_address(); + const u32 base_address = method_registers.index_array_address(); const u32 memory_location = method_registers.index_array_location(); const auto index_type = method_registers.index_type(); - const u32 type_size = get_index_type_size(index_type); - const u32 base_addr = get_address(base_address, memory_location) & (0 - type_size); + const u32 type_size = get_index_type_size(index_type); + const u32 base_addr = get_address(base_address, memory_location) & (0 - type_size); // manually parse index buffer and copy vertex buffer u32 min_index = 0xFFFFFFFF, max_index = 0; const bool is_primitive_restart_enabled = method_registers.restart_index_enabled(); - const u32 primitive_restart_index = method_registers.restart_index(); + const u32 primitive_restart_index = method_registers.restart_index(); method_registers.current_draw_clause.begin(); do @@ -184,7 +183,7 @@ namespace rsx const auto& range = method_registers.current_draw_clause.get_range(); const u32 idxFirst = range.first; const u32 idxCount = range.count; - const u32 idxAddr = base_addr + (idxFirst * type_size); + const u32 idxAddr = base_addr + (idxFirst * type_size); const usz bufferSize = idxCount * type_size; @@ -206,7 +205,7 @@ namespace rsx u16 index = fifo[i]; if (is_primitive_restart_enabled && u32{index} == primitive_restart_index) continue; - index = static_cast(get_index_from_base(index, method_registers.vertex_data_base_index())); + index = static_cast(get_index_from_base(index, method_registers.vertex_data_base_index())); min_index = std::min(index, static_cast(min_index)); max_index = std::max(index, static_cast(max_index)); } @@ -220,15 +219,14 @@ namespace rsx u32 index = fifo[i]; if (is_primitive_restart_enabled && index == primitive_restart_index) continue; - index = get_index_from_base(index, method_registers.vertex_data_base_index()); + index = get_index_from_base(index, method_registers.vertex_data_base_index()); min_index = std::min(index, min_index); max_index = std::max(index, max_index); } break; } } - } - while (method_registers.current_draw_clause.next()); + } while (method_registers.current_draw_clause.next()); if (min_index <= max_index) { @@ -243,11 +241,11 @@ namespace rsx continue; // vert buffer - const u32 vertStride = info.stride(); - const u32 base_address = get_vertex_offset_from_base(method_registers.vertex_data_base_offset(), (info.offset() & 0x7fffffff)); + const u32 vertStride = info.stride(); + const u32 base_address = get_vertex_offset_from_base(method_registers.vertex_data_base_offset(), (info.offset() & 0x7fffffff)); const u32 memory_location = info.offset() >> 31; - const u32 addr = get_address(base_address, memory_location); + const u32 addr = get_address(base_address, memory_location); const u32 vertSize = get_vertex_type_size_on_host(info.type(), info.size()); const u32 bufferSize = vertStride * (max_index - min_index + 1) + vertSize; @@ -268,7 +266,7 @@ namespace rsx // i realize these are a slight copy pasta of the rsx_method implementations but its kinda unavoidable currently void capture_image_in(thread* rsx, frame_capture_data::replay_command& replay_command) { - //const rsx::blit_engine::transfer_operation operation = method_registers.blit_engine_operation(); + // const rsx::blit_engine::transfer_operation operation = method_registers.blit_engine_operation(); const u16 clip_w = std::min(method_registers.blit_engine_output_width(), method_registers.blit_engine_clip_width()); const u16 clip_h = std::min(method_registers.blit_engine_output_height(), method_registers.blit_engine_clip_height()); @@ -276,8 +274,8 @@ namespace rsx const u16 in_w = method_registers.blit_engine_input_width(); const u16 in_h = method_registers.blit_engine_input_height(); - //const blit_engine::transfer_origin in_origin = method_registers.blit_engine_input_origin(); - //const blit_engine::transfer_interpolator in_inter = method_registers.blit_engine_input_inter(); + // const blit_engine::transfer_origin in_origin = method_registers.blit_engine_input_origin(); + // const blit_engine::transfer_interpolator in_inter = method_registers.blit_engine_input_inter(); const rsx::blit_engine::transfer_source_format src_color_format = method_registers.blit_engine_src_color_format(); const f32 in_x = std::floor(method_registers.blit_engine_in_x()); @@ -291,10 +289,10 @@ namespace rsx } const u32 src_offset = method_registers.blit_engine_input_offset(); - const u32 src_dma = method_registers.blit_engine_input_location(); + const u32 src_dma = method_registers.blit_engine_input_location(); - const u32 in_bpp = (src_color_format == rsx::blit_engine::transfer_source_format::r5g6b5) ? 2 : 4; // bytes per pixel - const u32 in_offset = u32(in_x * in_bpp + in_pitch * in_y); + const u32 in_bpp = (src_color_format == rsx::blit_engine::transfer_source_format::r5g6b5) ? 2 : 4; // bytes per pixel + const u32 in_offset = u32(in_x * in_bpp + in_pitch * in_y); frame_capture_data::memory_block block; block.offset = src_offset + in_offset; @@ -316,14 +314,14 @@ namespace rsx void capture_buffer_notify(thread* rsx, frame_capture_data::replay_command& replay_command) { - s32 in_pitch = method_registers.nv0039_input_pitch(); + s32 in_pitch = method_registers.nv0039_input_pitch(); const u32 line_length = method_registers.nv0039_line_length(); - const u32 line_count = method_registers.nv0039_line_count(); - //const u8 in_format = method_registers.nv0039_input_format(); + const u32 line_count = method_registers.nv0039_line_count(); + // const u8 in_format = method_registers.nv0039_input_format(); u32 src_offset = method_registers.nv0039_input_offset(); - u32 src_dma = method_registers.nv0039_input_location(); - u32 src_addr = get_address(src_offset, src_dma); + u32 src_dma = method_registers.nv0039_input_location(); + u32 src_addr = get_address(src_offset, src_dma); rsx->read_barrier(src_addr, in_pitch * (line_count - 1) + line_length, true); @@ -355,11 +353,11 @@ namespace rsx // should this only happen on flip? for (u32 i = 0; i < rsx->display_buffers_count; ++i) { - const auto& db = rsx->display_buffers[i]; + const auto& db = rsx->display_buffers[i]; dbstate.buffers[i].height = db.height; - dbstate.buffers[i].width = db.width; + dbstate.buffers[i].width = db.width; dbstate.buffers[i].offset = db.offset; - dbstate.buffers[i].pitch = db.pitch; + dbstate.buffers[i].pitch = db.pitch; } const auto [db_it, db_inserted] = frame_capture.display_buffers_map.try_emplace(dbstate, 0); @@ -403,7 +401,7 @@ namespace rsx } replay_command.display_buffer_state = dbnum; - replay_command.tile_state = tsnum; + replay_command.tile_state = tsnum; } - } -} + } // namespace capture +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Capture/rsx_capture.h b/rpcs3/rpcs3/Emu/RSX/Capture/rsx_capture.h index b23713917..61b1066cf 100644 --- a/rpcs3/rpcs3/Emu/RSX/Capture/rsx_capture.h +++ b/rpcs3/rpcs3/Emu/RSX/Capture/rsx_capture.h @@ -10,5 +10,5 @@ namespace rsx void capture_image_in(thread* rsx, frame_capture_data::replay_command& replay_command); void capture_buffer_notify(thread* rsx, frame_capture_data::replay_command& replay_command); void capture_display_tile_state(thread* rsx, frame_capture_data::replay_command& replay_command); - } -} + } // namespace capture +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Capture/rsx_replay.cpp b/rpcs3/rpcs3/Emu/RSX/Capture/rsx_replay.cpp index bb558744a..2c30b035f 100644 --- a/rpcs3/rpcs3/Emu/RSX/Capture/rsx_replay.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Capture/rsx_replay.cpp @@ -247,4 +247,4 @@ namespace rsx get_current_cpu_thread()->state += (cpu_flag::exit + cpu_flag::wait); } -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Capture/rsx_replay.h b/rpcs3/rpcs3/Emu/RSX/Capture/rsx_replay.h index f11f2e08e..85aafa9f0 100644 --- a/rpcs3/rpcs3/Emu/RSX/Capture/rsx_replay.h +++ b/rpcs3/rpcs3/Emu/RSX/Capture/rsx_replay.h @@ -26,7 +26,7 @@ namespace rsx { ENABLE_BITWISE_SERIALIZATION; - u32 offset; // Offset in rsx address space + u32 offset; // Offset in rsx address space u32 location; // rsx memory location of the block u64 data_state; }; @@ -97,18 +97,18 @@ namespace rsx template usz operator()(const T& key) const noexcept { - if constexpr (!!(requires (const T& a) { a.data[0]; })) + if constexpr (!!(requires(const T& a) { a.data[0]; })) { - return std::hash{}(std::string_view{ reinterpret_cast(key.data.data()), key.data.size() * sizeof(key.data[0]) }); + return std::hash{}(std::string_view{reinterpret_cast(key.data.data()), key.data.size() * sizeof(key.data[0])}); } - return std::hash{}(std::string_view{ reinterpret_cast(&key), sizeof(key) }); + return std::hash{}(std::string_view{reinterpret_cast(&key), sizeof(key)}); } template bool operator()(const T& keya, const T& keyb) const noexcept { - if constexpr (!!(requires (const T& a) { a.data[0]; })) + if constexpr (!!(requires(const T& a) { a.data[0]; })) { if (keya.data.size() != keyb.data.size()) { @@ -157,7 +157,6 @@ namespace rsx } }; - class rsx_replay_thread : public cpu_thread { struct rsx_context @@ -186,16 +185,16 @@ namespace rsx public: rsx_replay_thread(std::unique_ptr&& frame_data) - : cpu_thread(0) - , frame(std::move(frame_data)) + : cpu_thread(0), frame(std::move(frame_data)) { } using cpu_thread::operator=; void cpu_task() override; + private: be_t allocate_context(); std::vector alloc_write_fifo(be_t context_id) const; void apply_frame_state(be_t context_id, const frame_capture_data::replay_command& replay_cmd); }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Capture/rsx_trace.h b/rpcs3/rpcs3/Emu/RSX/Capture/rsx_trace.h index 0d005423d..43886699c 100644 --- a/rpcs3/rpcs3/Emu/RSX/Capture/rsx_trace.h +++ b/rpcs3/rpcs3/Emu/RSX/Capture/rsx_trace.h @@ -8,26 +8,26 @@ namespace rsx { -struct frame_trace_data -{ - struct draw_state + struct frame_trace_data { - std::string name; - std::pair programs; - rsx::rsx_state state; - std::array, 4> color_buffer; - std::array, 2> depth_stencil; - std::vector index; - u32 vertex_count; + struct draw_state + { + std::string name; + std::pair programs; + rsx::rsx_state state; + std::array, 4> color_buffer; + std::array, 2> depth_stencil; + std::vector index; + u32 vertex_count; + }; + + std::vector> command_queue; + std::vector draw_calls; + + void reset() + { + command_queue.clear(); + draw_calls.clear(); + } }; - - std::vector> command_queue; - std::vector draw_calls; - - void reset() - { - command_queue.clear(); - draw_calls.clear(); - } -}; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/BufferUtils.cpp b/rpcs3/rpcs3/Emu/RSX/Common/BufferUtils.cpp index 0250daead..bcb461b60 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/BufferUtils.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/BufferUtils.cpp @@ -47,7 +47,7 @@ [[maybe_unused]] const bool s_use_avx2 = utils::has_avx2(); [[maybe_unused]] const bool s_use_avx3 = utils::has_avx512(); #else -[[maybe_unused]] constexpr bool s_use_ssse3 = true; // Non x86 +[[maybe_unused]] constexpr bool s_use_ssse3 = true; // Non x86 [[maybe_unused]] constexpr bool s_use_sse4_1 = true; // Non x86 [[maybe_unused]] constexpr bool s_use_avx2 = false; [[maybe_unused]] constexpr bool s_use_avx3 = false; @@ -63,7 +63,7 @@ namespace utils { return std::span(bless(span.data()), sizeof(U) * span.size() / sizeof(T)); } -} +} // namespace utils namespace { @@ -109,50 +109,51 @@ namespace } c.build_loop(sizeof(u32), x86::eax, args[2].r32(), [&] - { - c.zero_if_not_masked().vec_load_unaligned(sizeof(u32), c.v0, c.ptr_scale_for_vec(sizeof(u32), args[1], x86::rax)); + { + c.zero_if_not_masked().vec_load_unaligned(sizeof(u32), c.v0, c.ptr_scale_for_vec(sizeof(u32), args[1], x86::rax)); - if (utils::has_ssse3()) - { - c.vec_shuffle_xi8(c.v0, c.v0, c.v1); - } - else - { - c.emit(x86::Inst::kIdMovdqa, c.v1, c.v0); - c.emit(x86::Inst::kIdPsrlw, c.v0, 8); - c.emit(x86::Inst::kIdPsllw, c.v1, 8); - c.emit(x86::Inst::kIdPor, c.v0, c.v1); - c.emit(x86::Inst::kIdPshuflw, c.v0, c.v0, 0b10110001); - c.emit(x86::Inst::kIdPshufhw, c.v0, c.v0, 0b10110001); - } - - if constexpr (Compare) - { - if (utils::has_avx512()) + if (utils::has_ssse3()) { - c.keep_if_not_masked().emit(x86::Inst::kIdVpternlogd, c.v2, c.v0, c.ptr_scale_for_vec(sizeof(u32), args[0], x86::rax), 0xf6); // orAxorBC + c.vec_shuffle_xi8(c.v0, c.v0, c.v1); } else { - c.zero_if_not_masked().vec_load_unaligned(sizeof(u32), c.v3, c.ptr_scale_for_vec(sizeof(u32), args[0], x86::rax)); - c.vec_xor(sizeof(u32), c.v3, c.v3, c.v0); - c.vec_or(sizeof(u32), c.v2, c.v2, c.v3); + c.emit(x86::Inst::kIdMovdqa, c.v1, c.v0); + c.emit(x86::Inst::kIdPsrlw, c.v0, 8); + c.emit(x86::Inst::kIdPsllw, c.v1, 8); + c.emit(x86::Inst::kIdPor, c.v0, c.v1); + c.emit(x86::Inst::kIdPshuflw, c.v0, c.v0, 0b10110001); + c.emit(x86::Inst::kIdPshufhw, c.v0, c.v0, 0b10110001); } - } - c.keep_if_not_masked().vec_store_unaligned(sizeof(u32), c.v0, c.ptr_scale_for_vec(sizeof(u32), args[0], x86::rax)); - }, [&] - { - if constexpr (Compare) - { - if (c.vsize == 16 && c.vmask == 0) + if constexpr (Compare) { - // Fix for AVX2 path - c.vextracti128(x86::xmm0, x86::ymm2, 1); - c.vpor(x86::xmm2, x86::xmm2, x86::xmm0); + if (utils::has_avx512()) + { + c.keep_if_not_masked().emit(x86::Inst::kIdVpternlogd, c.v2, c.v0, c.ptr_scale_for_vec(sizeof(u32), args[0], x86::rax), 0xf6); // orAxorBC + } + else + { + c.zero_if_not_masked().vec_load_unaligned(sizeof(u32), c.v3, c.ptr_scale_for_vec(sizeof(u32), args[0], x86::rax)); + c.vec_xor(sizeof(u32), c.v3, c.v3, c.v0); + c.vec_or(sizeof(u32), c.v2, c.v2, c.v3); + } } - } - }); + + c.keep_if_not_masked().vec_store_unaligned(sizeof(u32), c.v0, c.ptr_scale_for_vec(sizeof(u32), args[0], x86::rax)); + }, + [&] + { + if constexpr (Compare) + { + if (c.vsize == 16 && c.vmask == 0) + { + // Fix for AVX2 path + c.vextracti128(x86::xmm0, x86::ymm2, 1); + c.vpor(x86::xmm2, x86::xmm2, x86::xmm0); + } + } + }); if constexpr (Compare) { @@ -166,11 +167,11 @@ namespace c.vec_cleanup_ret(); } #endif -} +} // namespace #if defined(ARCH_X64) -DECLARE(copy_data_swap_u32) = build_function_asm("copy_data_swap_u32", &build_copy_data_swap_u32); -DECLARE(copy_data_swap_u32_cmp) = build_function_asm("copy_data_swap_u32_cmp", &build_copy_data_swap_u32); +DECLARE(copy_data_swap_u32) = build_function_asm("copy_data_swap_u32", &build_copy_data_swap_u32); +DECLARE(copy_data_swap_u32_cmp) = build_function_asm("copy_data_swap_u32_cmp", &build_copy_data_swap_u32); #else DECLARE(copy_data_swap_u32) = copy_data_swap_u32_naive; DECLARE(copy_data_swap_u32_cmp) = copy_data_swap_u32_naive; @@ -227,42 +228,43 @@ namespace } c.vec_set_const(c.v1, sizeof(T) == 2 ? s_bswap_u16_mask : s_bswap_u32_mask); - c.vec_set_all_ones(c.v2); // vec min + c.vec_set_all_ones(c.v2); // vec min c.vec_set_all_zeros(c.v3); // vec max c.build_loop(sizeof(T), x86::eax, args[2].r32(), [&] - { - c.zero_if_not_masked().vec_load_unaligned(sizeof(T), c.v0, c.ptr_scale_for_vec(sizeof(T), args[0], x86::rax)); - - if (utils::has_ssse3()) { - c.vec_shuffle_xi8(c.v0, c.v0, c.v1); - } - else - { - c.emit(x86::Inst::kIdMovdqa, c.v1, c.v0); - c.emit(x86::Inst::kIdPsrlw, c.v0, 8); - c.emit(x86::Inst::kIdPsllw, c.v1, 8); - c.emit(x86::Inst::kIdPor, c.v0, c.v1); + c.zero_if_not_masked().vec_load_unaligned(sizeof(T), c.v0, c.ptr_scale_for_vec(sizeof(T), args[0], x86::rax)); - if constexpr (sizeof(T) == 4) + if (utils::has_ssse3()) { - c.emit(x86::Inst::kIdPshuflw, c.v0, c.v0, 0b10110001); - c.emit(x86::Inst::kIdPshufhw, c.v0, c.v0, 0b10110001); + c.vec_shuffle_xi8(c.v0, c.v0, c.v1); } - } + else + { + c.emit(x86::Inst::kIdMovdqa, c.v1, c.v0); + c.emit(x86::Inst::kIdPsrlw, c.v0, 8); + c.emit(x86::Inst::kIdPsllw, c.v1, 8); + c.emit(x86::Inst::kIdPor, c.v0, c.v1); - c.keep_if_not_masked().vec_umax(sizeof(T), c.v3, c.v3, c.v0); - c.keep_if_not_masked().vec_umin(sizeof(T), c.v2, c.v2, c.v0); - c.keep_if_not_masked().vec_store_unaligned(sizeof(T), c.v0, c.ptr_scale_for_vec(sizeof(T), args[1], x86::rax)); - }, [&] - { - // Compress horizontally, protect high values - c.vec_extract_high(sizeof(T), c.v0, c.v3); - c.vec_umax(sizeof(T), c.v3, c.v3, c.v0); - c.vec_extract_high(sizeof(T), c.v0, c.v2); - c.vec_umin(sizeof(T), c.v2, c.v2, c.v0); - }); + if constexpr (sizeof(T) == 4) + { + c.emit(x86::Inst::kIdPshuflw, c.v0, c.v0, 0b10110001); + c.emit(x86::Inst::kIdPshufhw, c.v0, c.v0, 0b10110001); + } + } + + c.keep_if_not_masked().vec_umax(sizeof(T), c.v3, c.v3, c.v0); + c.keep_if_not_masked().vec_umin(sizeof(T), c.v2, c.v2, c.v0); + c.keep_if_not_masked().vec_store_unaligned(sizeof(T), c.v0, c.ptr_scale_for_vec(sizeof(T), args[1], x86::rax)); + }, + [&] + { + // Compress horizontally, protect high values + c.vec_extract_high(sizeof(T), c.v0, c.v3); + c.vec_umax(sizeof(T), c.v3, c.v3, c.v0); + c.vec_extract_high(sizeof(T), c.v0, c.v2); + c.vec_umin(sizeof(T), c.v2, c.v2, c.v0); + }); c.vec_extract_gpr(sizeof(T), x86::edx, c.v3); c.vec_extract_gpr(sizeof(T), x86::eax, c.v2); @@ -271,8 +273,8 @@ namespace c.vec_cleanup_ret(); } - static inline auto upload_xi16 = build_function_asm*, u16*, u32), asmjit::simd_builder>("untouched_upload_xi16", &build_upload_untouched); - static inline auto upload_xi32 = build_function_asm*, u32*, u32), asmjit::simd_builder>("untouched_upload_xi32", &build_upload_untouched); + static inline auto upload_xi16 = build_function_asm*, u16*, u32), asmjit::simd_builder>("untouched_upload_xi16", &build_upload_untouched); + static inline auto upload_xi32 = build_function_asm*, u32*, u32), asmjit::simd_builder>("untouched_upload_xi32", &build_upload_untouched); #endif template @@ -328,47 +330,48 @@ namespace } c.vec_set_const(c.v1, sizeof(T) == 2 ? s_bswap_u16_mask : s_bswap_u32_mask); - c.vec_set_all_ones(c.v2); // vec min + c.vec_set_all_ones(c.v2); // vec min c.vec_set_all_zeros(c.v3); // vec max c.vec_broadcast_gpr(sizeof(T), c.v4, args[3].r32()); c.build_loop(sizeof(T), x86::eax, args[2].r32(), [&] - { - c.zero_if_not_masked().vec_load_unaligned(sizeof(T), c.v0, c.ptr_scale_for_vec(sizeof(T), args[0], x86::rax)); - - if (utils::has_ssse3()) { - c.vec_shuffle_xi8(c.v0, c.v0, c.v1); - } - else - { - c.emit(x86::Inst::kIdMovdqa, c.v1, c.v0); - c.emit(x86::Inst::kIdPsrlw, c.v0, 8); - c.emit(x86::Inst::kIdPsllw, c.v1, 8); - c.emit(x86::Inst::kIdPor, c.v0, c.v1); + c.zero_if_not_masked().vec_load_unaligned(sizeof(T), c.v0, c.ptr_scale_for_vec(sizeof(T), args[0], x86::rax)); - if constexpr (sizeof(T) == 4) + if (utils::has_ssse3()) { - c.emit(x86::Inst::kIdPshuflw, c.v0, c.v0, 0b10110001); - c.emit(x86::Inst::kIdPshufhw, c.v0, c.v0, 0b10110001); + c.vec_shuffle_xi8(c.v0, c.v0, c.v1); } - } + else + { + c.emit(x86::Inst::kIdMovdqa, c.v1, c.v0); + c.emit(x86::Inst::kIdPsrlw, c.v0, 8); + c.emit(x86::Inst::kIdPsllw, c.v1, 8); + c.emit(x86::Inst::kIdPor, c.v0, c.v1); - c.vec_cmp_eq(sizeof(T), c.v5, c.v4, c.v0); - c.vec_andn(sizeof(T), c.v5, c.v5, c.v0); - c.keep_if_not_masked().vec_umax(sizeof(T), c.v3, c.v3, c.v5); - c.vec_cmp_eq(sizeof(T), c.v5, c.v4, c.v0); - c.vec_or(sizeof(T), c.v0, c.v0, c.v5); - c.keep_if_not_masked().vec_umin(sizeof(T), c.v2, c.v2, c.v0); - c.keep_if_not_masked().vec_store_unaligned(sizeof(T), c.v0, c.ptr_scale_for_vec(sizeof(T), args[1], x86::rax)); - }, [&] - { - // Compress horizontally, protect high values - c.vec_extract_high(sizeof(T), c.v0, c.v3); - c.vec_umax(sizeof(T), c.v3, c.v3, c.v0); - c.vec_extract_high(sizeof(T), c.v0, c.v2); - c.vec_umin(sizeof(T), c.v2, c.v2, c.v0); - }); + if constexpr (sizeof(T) == 4) + { + c.emit(x86::Inst::kIdPshuflw, c.v0, c.v0, 0b10110001); + c.emit(x86::Inst::kIdPshufhw, c.v0, c.v0, 0b10110001); + } + } + + c.vec_cmp_eq(sizeof(T), c.v5, c.v4, c.v0); + c.vec_andn(sizeof(T), c.v5, c.v5, c.v0); + c.keep_if_not_masked().vec_umax(sizeof(T), c.v3, c.v3, c.v5); + c.vec_cmp_eq(sizeof(T), c.v5, c.v4, c.v0); + c.vec_or(sizeof(T), c.v0, c.v0, c.v5); + c.keep_if_not_masked().vec_umin(sizeof(T), c.v2, c.v2, c.v0); + c.keep_if_not_masked().vec_store_unaligned(sizeof(T), c.v0, c.ptr_scale_for_vec(sizeof(T), args[1], x86::rax)); + }, + [&] + { + // Compress horizontally, protect high values + c.vec_extract_high(sizeof(T), c.v0, c.v3); + c.vec_umax(sizeof(T), c.v3, c.v3, c.v0); + c.vec_extract_high(sizeof(T), c.v0, c.v2); + c.vec_umin(sizeof(T), c.v2, c.v2, c.v0); + }); c.vec_extract_gpr(sizeof(T), x86::edx, c.v3); c.vec_extract_gpr(sizeof(T), x86::eax, c.v2); @@ -377,8 +380,8 @@ namespace c.vec_cleanup_ret(); } - static inline auto upload_xi16 = build_function_asm*, u16*, u32, u32), asmjit::simd_builder>("restart_untouched_upload_xi16", &build_upload_untouched); - static inline auto upload_xi32 = build_function_asm*, u32*, u32, u32), asmjit::simd_builder>("restart_untouched_upload_xi32", &build_upload_untouched); + static inline auto upload_xi16 = build_function_asm*, u16*, u32, u32), asmjit::simd_builder>("restart_untouched_upload_xi16", &build_upload_untouched); + static inline auto upload_xi32 = build_function_asm*, u32*, u32, u32), asmjit::simd_builder>("restart_untouched_upload_xi32", &build_upload_untouched); #endif template @@ -404,59 +407,59 @@ namespace } }; -template -NEVER_INLINE std::tuple upload_untouched_skip_restart(std::span> src, std::span dst, T restart_index) -{ - T min_index = index_limit(); - T max_index = 0; - u32 written = 0; - u32 length = ::size32(src); - - for (u32 i = written; i < length; ++i) + template + NEVER_INLINE std::tuple upload_untouched_skip_restart(std::span> src, std::span dst, T restart_index) { - T index = src[i]; - if (index != restart_index) + T min_index = index_limit(); + T max_index = 0; + u32 written = 0; + u32 length = ::size32(src); + + for (u32 i = written; i < length; ++i) { - dst[written++] = min_max(min_index, max_index, index); + T index = src[i]; + if (index != restart_index) + { + dst[written++] = min_max(min_index, max_index, index); + } } + + return std::make_tuple(min_index, max_index, written); } - return std::make_tuple(min_index, max_index, written); -} - -template -std::tuple upload_untouched(std::span> src, std::span dst, rsx::primitive_type draw_mode, bool is_primitive_restart_enabled, u32 primitive_restart_index) -{ - if (!is_primitive_restart_enabled) + template + std::tuple upload_untouched(std::span> src, std::span dst, rsx::primitive_type draw_mode, bool is_primitive_restart_enabled, u32 primitive_restart_index) { - return untouched_impl::upload_untouched(src, dst); - } - else if constexpr (std::is_same_v) - { - if (primitive_restart_index > 0xffff) + if (!is_primitive_restart_enabled) { return untouched_impl::upload_untouched(src, dst); } + else if constexpr (std::is_same_v) + { + if (primitive_restart_index > 0xffff) + { + return untouched_impl::upload_untouched(src, dst); + } + else if (is_primitive_disjointed(draw_mode)) + { + return upload_untouched_skip_restart(src, dst, static_cast(primitive_restart_index)); + } + else + { + return primitive_restart_impl::upload_untouched(src, dst, static_cast(primitive_restart_index)); + } + } else if (is_primitive_disjointed(draw_mode)) { - return upload_untouched_skip_restart(src, dst, static_cast(primitive_restart_index)); + return upload_untouched_skip_restart(src, dst, primitive_restart_index); } else { - return primitive_restart_impl::upload_untouched(src, dst, static_cast(primitive_restart_index)); + return primitive_restart_impl::upload_untouched(src, dst, primitive_restart_index); } } - else if (is_primitive_disjointed(draw_mode)) - { - return upload_untouched_skip_restart(src, dst, primitive_restart_index); - } - else - { - return primitive_restart_impl::upload_untouched(src, dst, primitive_restart_index); - } -} - template + template std::tuple expand_indexed_triangle_fan(std::span> src, std::span dst, bool is_primitive_restart_enabled, u32 primitive_restart_index) { const T invalid_index = index_limit(); @@ -493,7 +496,7 @@ std::tuple upload_untouched(std::span> src, std::spa if (last_index == invalid_index) { - //Need at least one anchor and one outer index to create a triangle + // Need at least one anchor and one outer index to create a triangle last_index = min_max(min_index, max_index, index); continue; } @@ -508,7 +511,7 @@ std::tuple upload_untouched(std::span> src, std::spa return std::make_tuple(min_index, max_index, dst_idx); } - template + template std::tuple expand_indexed_quads(std::span> src, std::span dst, bool is_primitive_restart_enabled, u32 primitive_restart_index) { T min_index = index_limit(); @@ -524,7 +527,7 @@ std::tuple upload_untouched(std::span> src, std::spa { if (is_primitive_restart_enabled && index == primitive_restart_index) { - //empty temp buffer + // empty temp buffer set_size = 0; continue; } @@ -548,7 +551,7 @@ std::tuple upload_untouched(std::span> src, std::spa return std::make_tuple(min_index, max_index, dst_idx); } -} +} // namespace // Only handle quads and triangle fan now bool is_primitive_native(rsx::primitive_type draw_mode) @@ -662,10 +665,9 @@ void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst, fmt::throw_exception("Tried to load invalid primitive type"); } - namespace { - template + template std::tuple write_index_array_data_to_buffer_impl(std::span dst, std::span> src, rsx::primitive_type draw_mode, bool restart_index_enabled, u32 restart_index, @@ -680,7 +682,7 @@ namespace { case rsx::primitive_type::line_loop: { - const auto &returnvalue = upload_untouched(src, dst, draw_mode, restart_index_enabled, restart_index); + const auto& returnvalue = upload_untouched(src, dst, draw_mode, restart_index_enabled, restart_index); const auto index_count = dst.size_bytes() / sizeof(T); dst[index_count] = src[0]; return returnvalue; @@ -698,7 +700,7 @@ namespace fmt::throw_exception("Unknown draw mode (0x%x)", static_cast(draw_mode)); } } -} +} // namespace std::tuple write_index_array_data_to_buffer(std::span dst_ptr, std::span src_ptr, diff --git a/rpcs3/rpcs3/Emu/RSX/Common/BufferUtils.h b/rpcs3/rpcs3/Emu/RSX/Common/BufferUtils.h index 183ee1f8d..4cea18006 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/BufferUtils.h +++ b/rpcs3/rpcs3/Emu/RSX/Common/BufferUtils.h @@ -39,7 +39,7 @@ std::tuple write_index_array_data_to_buffer(std::span void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst, rsx::primitive_type draw_mode, unsigned count); // Copy and swap data in 32-bit units -extern void(*const copy_data_swap_u32)(u32* dst, const u32* src, u32 count); +extern void (*const copy_data_swap_u32)(u32* dst, const u32* src, u32 count); // Copy and swap data in 32-bit units, return true if changed -extern bool(*const copy_data_swap_u32_cmp)(u32* dst, const u32* src, u32 count); +extern bool (*const copy_data_swap_u32_cmp)(u32* dst, const u32* src, u32 count); diff --git a/rpcs3/rpcs3/Emu/RSX/Common/TextureUtils.cpp b/rpcs3/rpcs3/Emu/RSX/Common/TextureUtils.cpp index 382ef9cc0..b31144b1d 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/TextureUtils.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/TextureUtils.cpp @@ -15,221 +15,143 @@ namespace utils return std::span(bless(span.data()), sizeof(U) * span.size() / sizeof(T)); } - template requires(std::is_integral_v && std::is_unsigned_v) + template + requires(std::is_integral_v && std::is_unsigned_v) bool is_power_of_2(T value) { return !(value & (value - 1)); } -} +} // namespace utils namespace { #ifndef __APPLE__ -u16 convert_rgb655_to_rgb565(const u16 bits) -{ - // g6 = g5 - // r5 = (((bits & 0xFC00) >> 1) & 0xFC00) << 1 is equivalent to truncating the least significant bit - return (bits & 0xF81F) | (bits & 0x3E0) << 1; -} -#else -u32 convert_rgb565_to_bgra8(const u16 bits) -{ - const u8 r5 = ((bits >> 11) & 0x1F); - const u8 g6 = ((bits >> 5) & 0x3F); - const u8 b5 = (bits & 0x1F); - - const u8 b8 = ((b5 * 527) + 23) >> 6; - const u8 g8 = ((g6 * 259) + 33) >> 6; - const u8 r8 = ((r5 * 527) + 23) >> 6; - const u8 a8 = 255; - - return b8 | (g8 << 8) | (r8 << 16) | (a8 << 24); -} - -u32 convert_argb4_to_bgra8(const u16 bits) -{ - const u8 b8 = (bits & 0xF0); - const u8 g8 = ((bits >> 4) & 0xF0); - const u8 r8 = ((bits >> 8) & 0xF0); - const u8 a8 = ((bits << 4) & 0xF0); - - return b8 | (g8 << 8) | (r8 << 16) | (a8 << 24); -} - -u32 convert_a1rgb5_to_bgra8(const u16 bits) -{ - const u8 a1 = ((bits >> 11) & 0x80); - const u8 r5 = ((bits >> 10) & 0x1F); - const u8 g5 = ((bits >> 5) & 0x1F); - const u8 b5 = (bits & 0x1F); - - const u8 b8 = ((b5 * 527) + 23) >> 6; - const u8 g8 = ((g5 * 527) + 23) >> 6; - const u8 r8 = ((r5 * 527) + 23) >> 6; - const u8 a8 = a1; - - return b8 | (g8 << 8) | (r8 << 16) | (a8 << 24); -} - -u32 convert_rgb5a1_to_bgra8(const u16 bits) -{ - const u8 r5 = ((bits >> 11) & 0x1F); - const u8 g5 = ((bits >> 6) & 0x1F); - const u8 b5 = ((bits >> 1) & 0x1F); - const u8 a1 = (bits & 0x80); - - const u8 b8 = ((b5 * 527) + 23) >> 6; - const u8 g8 = ((g5 * 527) + 23) >> 6; - const u8 r8 = ((r5 * 527) + 23) >> 6; - const u8 a8 = a1; - - return b8 | (g8 << 8) | (r8 << 16) | (a8 << 24); -} - -u32 convert_rgb655_to_bgra8(const u16 bits) -{ - const u8 r6 = ((bits >> 10) & 0x3F); - const u8 g5 = ((bits >> 5) & 0x1F); - const u8 b5 = ((bits) & 0x1F); - - const u8 b8 = ((b5 * 527) + 23) >> 6; - const u8 g8 = ((g5 * 527) + 23) >> 6; - const u8 r8 = ((r6 * 259) + 33) >> 6; - const u8 a8 = 1; - - return b8 | (g8 << 8) | (r8 << 16) | (a8 << 24); -} - -u32 convert_d1rgb5_to_bgra8(const u16 bits) -{ - const u8 r5 = ((bits >> 10) & 0x1F); - const u8 g5 = ((bits >> 5) & 0x1F); - const u8 b5 = (bits & 0x1F); - - const u8 b8 = ((b5 * 527) + 23) >> 6; - const u8 g8 = ((g5 * 527) + 23) >> 6; - const u8 r8 = ((r5 * 527) + 23) >> 6; - const u8 a8 = 1; - - return b8 | (g8 << 8) | (r8 << 16) | (a8 << 24); -} - -struct convert_16_block_32 -{ - template - static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block, u32 src_pitch_in_block, u32 (*converter)(const u16)) + u16 convert_rgb655_to_rgb565(const u16 bits) { - static_assert(sizeof(T) == 2, "Type size doesn't match."); + // g6 = g5 + // r5 = (((bits & 0xFC00) >> 1) & 0xFC00) << 1 is equivalent to truncating the least significant bit + return (bits & 0xF81F) | (bits & 0x3E0) << 1; + } +#else + u32 convert_rgb565_to_bgra8(const u16 bits) + { + const u8 r5 = ((bits >> 11) & 0x1F); + const u8 g6 = ((bits >> 5) & 0x3F); + const u8 b5 = (bits & 0x1F); - u32 src_offset = 0, dst_offset = 0; - const u32 v_porch = src_pitch_in_block * border; + const u8 b8 = ((b5 * 527) + 23) >> 6; + const u8 g8 = ((g6 * 259) + 33) >> 6; + const u8 r8 = ((r5 * 527) + 23) >> 6; + const u8 a8 = 255; - for (int layer = 0; layer < depth; ++layer) + return b8 | (g8 << 8) | (r8 << 16) | (a8 << 24); + } + + u32 convert_argb4_to_bgra8(const u16 bits) + { + const u8 b8 = (bits & 0xF0); + const u8 g8 = ((bits >> 4) & 0xF0); + const u8 r8 = ((bits >> 8) & 0xF0); + const u8 a8 = ((bits << 4) & 0xF0); + + return b8 | (g8 << 8) | (r8 << 16) | (a8 << 24); + } + + u32 convert_a1rgb5_to_bgra8(const u16 bits) + { + const u8 a1 = ((bits >> 11) & 0x80); + const u8 r5 = ((bits >> 10) & 0x1F); + const u8 g5 = ((bits >> 5) & 0x1F); + const u8 b5 = (bits & 0x1F); + + const u8 b8 = ((b5 * 527) + 23) >> 6; + const u8 g8 = ((g5 * 527) + 23) >> 6; + const u8 r8 = ((r5 * 527) + 23) >> 6; + const u8 a8 = a1; + + return b8 | (g8 << 8) | (r8 << 16) | (a8 << 24); + } + + u32 convert_rgb5a1_to_bgra8(const u16 bits) + { + const u8 r5 = ((bits >> 11) & 0x1F); + const u8 g5 = ((bits >> 6) & 0x1F); + const u8 b5 = ((bits >> 1) & 0x1F); + const u8 a1 = (bits & 0x80); + + const u8 b8 = ((b5 * 527) + 23) >> 6; + const u8 g8 = ((g5 * 527) + 23) >> 6; + const u8 r8 = ((r5 * 527) + 23) >> 6; + const u8 a8 = a1; + + return b8 | (g8 << 8) | (r8 << 16) | (a8 << 24); + } + + u32 convert_rgb655_to_bgra8(const u16 bits) + { + const u8 r6 = ((bits >> 10) & 0x3F); + const u8 g5 = ((bits >> 5) & 0x1F); + const u8 b5 = ((bits) & 0x1F); + + const u8 b8 = ((b5 * 527) + 23) >> 6; + const u8 g8 = ((g5 * 527) + 23) >> 6; + const u8 r8 = ((r6 * 259) + 33) >> 6; + const u8 a8 = 1; + + return b8 | (g8 << 8) | (r8 << 16) | (a8 << 24); + } + + u32 convert_d1rgb5_to_bgra8(const u16 bits) + { + const u8 r5 = ((bits >> 10) & 0x1F); + const u8 g5 = ((bits >> 5) & 0x1F); + const u8 b5 = (bits & 0x1F); + + const u8 b8 = ((b5 * 527) + 23) >> 6; + const u8 g8 = ((g5 * 527) + 23) >> 6; + const u8 r8 = ((r5 * 527) + 23) >> 6; + const u8 a8 = 1; + + return b8 | (g8 << 8) | (r8 << 16) | (a8 << 24); + } + + struct convert_16_block_32 + { + template + static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block, u32 src_pitch_in_block, u32 (*converter)(const u16)) { - // Front - src_offset += v_porch; + static_assert(sizeof(T) == 2, "Type size doesn't match."); - for (u32 row = 0; row < row_count; ++row) + u32 src_offset = 0, dst_offset = 0; + const u32 v_porch = src_pitch_in_block * border; + + for (int layer = 0; layer < depth; ++layer) { - for (int col = 0; col < width_in_block; ++col) + // Front + src_offset += v_porch; + + for (u32 row = 0; row < row_count; ++row) { - dst[dst_offset + col] = converter(src[src_offset + col + border]); + for (int col = 0; col < width_in_block; ++col) + { + dst[dst_offset + col] = converter(src[src_offset + col + border]); + } + + src_offset += src_pitch_in_block; + dst_offset += dst_pitch_in_block; } - src_offset += src_pitch_in_block; - dst_offset += dst_pitch_in_block; + // Back + src_offset += v_porch; } - - // Back - src_offset += v_porch; } - } -}; + }; -struct convert_16_block_32_swizzled -{ - template - static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block, u32 (*converter)(const u16)) + struct convert_16_block_32_swizzled { - u32 padded_width, padded_height; - if (border) - { - padded_width = rsx::next_pow2(width_in_block + border + border); - padded_height = rsx::next_pow2(row_count + border + border); - } - else - { - padded_width = width_in_block; - padded_height = row_count; - } - - u32 size = padded_width * padded_height * depth * 2; - rsx::simple_array tmp(size); - - rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); - - std::span src_span = tmp; - convert_16_block_32::copy_mipmap_level(dst, src_span, width_in_block, row_count, depth, border, dst_pitch_in_block, padded_width, converter); - } -}; -#endif - -struct copy_unmodified_block -{ - template - static void copy_mipmap_level(std::span dst, std::span src, u16 words_per_block, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block, u32 src_pitch_in_block) - { - static_assert(sizeof(T) == sizeof(U), "Type size doesn't match."); - - if (src_pitch_in_block == dst_pitch_in_block && !border) - { - // Fast copy - const auto data_length = src_pitch_in_block * words_per_block * row_count * depth; - std::copy_n(src.begin(), std::min({data_length, src.size(), dst.size()}), dst.begin()); - return; - } - - const u32 width_in_words = width_in_block * words_per_block; - const u32 src_pitch_in_words = src_pitch_in_block * words_per_block; - const u32 dst_pitch_in_words = dst_pitch_in_block * words_per_block; - - const u32 h_porch = border * words_per_block; - const u32 v_porch = src_pitch_in_words * border; - u32 src_offset = h_porch, dst_offset = 0; - - for (int layer = 0; layer < depth; ++layer) - { - // Front - src_offset += v_porch; - - for (int row = 0; row < row_count; ++row) - { - // NOTE: src_offset is already shifted along the border at initialization - std::copy_n(src.begin() + src_offset, width_in_words, dst.begin() + dst_offset); - - src_offset += src_pitch_in_words; - dst_offset += dst_pitch_in_words; - } - - // Back - src_offset += v_porch; - } - } -}; - -struct copy_unmodified_block_swizzled -{ - // NOTE: Pixel channel types are T (out) and const U (in). V is the pixel block type that consumes one whole pixel. - // e.g 4x16-bit format can use u16, be_t, u64 as arguments - template - static void copy_mipmap_level(std::span dst, std::span src, u16 words_per_block, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block) - { - if (std::is_same_v && dst_pitch_in_block == width_in_block && words_per_block == 1 && !border) - { - rsx::convert_linear_swizzle_3d(src.data(), dst.data(), width_in_block, row_count, depth); - } - else + template + static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block, u32 (*converter)(const u16)) { u32 padded_width, padded_height; if (border) @@ -243,518 +165,597 @@ struct copy_unmodified_block_swizzled padded_height = row_count; } - const u32 size_in_block = padded_width * padded_height * depth * 2; - rsx::simple_array tmp(size_in_block * words_per_block); + u32 size = padded_width * padded_height * depth * 2; + rsx::simple_array tmp(size); - if (words_per_block == 1) [[likely]] - { - rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); - } - else - { - switch (words_per_block * sizeof(T)) - { - case 4: - rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); - break; - case 8: - rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); - break; - case 16: - rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); - break; - default: - fmt::throw_exception("Failed to decode swizzled format, words_per_block=%d, src_type_size=%d", words_per_block, sizeof(T)); - } - } + rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); std::span src_span = tmp; - copy_unmodified_block::copy_mipmap_level(dst, src_span, words_per_block, width_in_block, row_count, depth, border, dst_pitch_in_block, padded_width); + convert_16_block_32::copy_mipmap_level(dst, src_span, width_in_block, row_count, depth, border, dst_pitch_in_block, padded_width, converter); } - } -}; + }; +#endif -struct copy_unmodified_block_vtc -{ - template - static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u32 dst_pitch_in_block, u32 /*src_pitch_in_block*/) + struct copy_unmodified_block { - static_assert(sizeof(T) == sizeof(U), "Type size doesn't match."); - u32 plane_size = dst_pitch_in_block * row_count; - u32 row_element_count = width_in_block * row_count; - u32 dst_offset = 0; - u32 src_offset = 0; - const u16 depth_4 = (depth >> 2) * 4; // multiple of 4 - - // Undo Nvidia VTC tiling - place each 2D texture slice back to back in linear memory - // - // More info: - // https://www.khronos.org/registry/OpenGL/extensions/NV/NV_texture_compression_vtc.txt - // - // Note that the memory is tiled 4 planes at a time in the depth direction. - // e.g. d0, d1, d2, d3 is tiled as a group then d4, d5, d6, d7 - // - - // Tile as 4x4x4 - for (int d = 0; d < depth_4; d++) + template + static void copy_mipmap_level(std::span dst, std::span src, u16 words_per_block, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block, u32 src_pitch_in_block) { - // Copy one slice of the 3d texture - for (u32 i = 0; i < row_element_count; i += 1) + static_assert(sizeof(T) == sizeof(U), "Type size doesn't match."); + + if (src_pitch_in_block == dst_pitch_in_block && !border) { - // Copy one span (8 bytes for DXT1 or 16 bytes for DXT5) - dst[dst_offset + i] = src[src_offset + i * 4]; + // Fast copy + const auto data_length = src_pitch_in_block * words_per_block * row_count * depth; + std::copy_n(src.begin(), std::min({data_length, src.size(), dst.size()}), dst.begin()); + return; } - dst_offset += plane_size; + const u32 width_in_words = width_in_block * words_per_block; + const u32 src_pitch_in_words = src_pitch_in_block * words_per_block; + const u32 dst_pitch_in_words = dst_pitch_in_block * words_per_block; - // Last plane in the group of 4? - if ((d & 0x3) == 0x3) + const u32 h_porch = border * words_per_block; + const u32 v_porch = src_pitch_in_words * border; + u32 src_offset = h_porch, dst_offset = 0; + + for (int layer = 0; layer < depth; ++layer) { - // Move forward to next group of 4 planes - src_offset += row_element_count * 4 - 3; - } - else - { - src_offset += 1; - } - } + // Front + src_offset += v_porch; - // End Case - tile as 4x4x3 or 4x4x2 or 4x4x1 - const int vtc_tile_count = depth - depth_4; - for (int d = 0; d < vtc_tile_count; d++) - { - // Copy one slice of the 3d texture - for (u32 i = 0; i < row_element_count; i += 1) - { - // Copy one span (8 bytes for DXT1 or 16 bytes for DXT5) - dst[dst_offset + i] = src[src_offset + i * vtc_tile_count]; - } - - dst_offset += plane_size; - src_offset += 1; - } - } -}; - -struct copy_linear_block_to_vtc -{ - template - static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u32 /*dst_pitch_in_block*/, u32 src_pitch_in_block) - { - static_assert(sizeof(T) == sizeof(U), "Type size doesn't match."); - u32 plane_size = src_pitch_in_block * row_count; - u32 row_element_count = width_in_block * row_count; - u32 dst_offset = 0; - u32 src_offset = 0; - const u16 depth_4 = (depth >> 2) * 4; // multiple of 4 - - // Convert incoming linear texture to VTC compressed texture - // https://www.khronos.org/registry/OpenGL/extensions/NV/NV_texture_compression_vtc.txt - - // Tile as 4x4x4 - for (int d = 0; d < depth_4; d++) - { - // Copy one slice of the 3d texture - for (u32 i = 0; i < row_element_count; i += 1) - { - // Copy one span (8 bytes for DXT1 or 16 bytes for DXT5) - dst[dst_offset + i * 4] = src[src_offset + i]; - } - - src_offset += plane_size; - - // Last plane in the group of 4? - if ((d & 0x3) == 0x3) - { - // Move forward to next group of 4 planes - dst_offset += row_element_count * 4 - 3; - } - else - { - dst_offset ++; - } - } - - // End Case - tile as 4x4x3 or 4x4x2 or 4x4x1 - const int vtc_tile_count = depth - depth_4; - for (int d = 0; d < vtc_tile_count; d++) - { - // Copy one slice of the 3d texture - for (u32 i = 0; i < row_element_count; i += 1) - { - // Copy one span (8 bytes for DXT1 or 16 bytes for DXT5) - dst[dst_offset + i * vtc_tile_count] = src[src_offset + i]; - } - - src_offset += row_element_count; - dst_offset ++; - } - } -}; - -struct copy_decoded_rb_rg_block -{ - template - static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u32 dst_pitch_in_block, u32 src_pitch_in_block) - { - static_assert(sizeof(T) == 4, "Type size doesn't match."); - - u32 src_offset = 0; - u32 dst_offset = 0; - - // Temporaries - u32 red0, red1, blue, green; - - for (int row = 0; row < row_count * depth; ++row) - { - for (int col = 0; col < width_in_block; ++col) - { - // Decompress one block to 2 pixels at a time and write output in BGRA format - const auto data = src[src_offset + col]; - - if constexpr (SwapWords) + for (int row = 0; row < row_count; ++row) { - // BR_GR - blue = (data >> 0) & 0xFF; - red0 = (data >> 8) & 0xFF; - green = (data >> 16) & 0XFF; - red1 = (data >> 24) & 0xFF; + // NOTE: src_offset is already shifted along the border at initialization + std::copy_n(src.begin() + src_offset, width_in_words, dst.begin() + dst_offset); + + src_offset += src_pitch_in_words; + dst_offset += dst_pitch_in_words; + } + + // Back + src_offset += v_porch; + } + } + }; + + struct copy_unmodified_block_swizzled + { + // NOTE: Pixel channel types are T (out) and const U (in). V is the pixel block type that consumes one whole pixel. + // e.g 4x16-bit format can use u16, be_t, u64 as arguments + template + static void copy_mipmap_level(std::span dst, std::span src, u16 words_per_block, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block) + { + if (std::is_same_v && dst_pitch_in_block == width_in_block && words_per_block == 1 && !border) + { + rsx::convert_linear_swizzle_3d(src.data(), dst.data(), width_in_block, row_count, depth); + } + else + { + u32 padded_width, padded_height; + if (border) + { + padded_width = rsx::next_pow2(width_in_block + border + border); + padded_height = rsx::next_pow2(row_count + border + border); } else { - // RB_RG - red0 = (data >> 0) & 0xFF; - blue = (data >> 8) & 0xFF; - red1 = (data >> 16) & 0XFF; - green = (data >> 24) & 0xFF; + padded_width = width_in_block; + padded_height = row_count; } - dst[dst_offset + (col * 2)] = blue | (green << 8) | (red0 << 16) | (0xFF << 24); - dst[dst_offset + (col * 2 + 1)] = blue | (green << 8) | (red1 << 16) | (0xFF << 24); + const u32 size_in_block = padded_width * padded_height * depth * 2; + rsx::simple_array tmp(size_in_block * words_per_block); + + if (words_per_block == 1) [[likely]] + { + rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); + } + else + { + switch (words_per_block * sizeof(T)) + { + case 4: + rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); + break; + case 8: + rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); + break; + case 16: + rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); + break; + default: + fmt::throw_exception("Failed to decode swizzled format, words_per_block=%d, src_type_size=%d", words_per_block, sizeof(T)); + } + } + + std::span src_span = tmp; + copy_unmodified_block::copy_mipmap_level(dst, src_span, words_per_block, width_in_block, row_count, depth, border, dst_pitch_in_block, padded_width); + } + } + }; + + struct copy_unmodified_block_vtc + { + template + static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u32 dst_pitch_in_block, u32 /*src_pitch_in_block*/) + { + static_assert(sizeof(T) == sizeof(U), "Type size doesn't match."); + u32 plane_size = dst_pitch_in_block * row_count; + u32 row_element_count = width_in_block * row_count; + u32 dst_offset = 0; + u32 src_offset = 0; + const u16 depth_4 = (depth >> 2) * 4; // multiple of 4 + + // Undo Nvidia VTC tiling - place each 2D texture slice back to back in linear memory + // + // More info: + // https://www.khronos.org/registry/OpenGL/extensions/NV/NV_texture_compression_vtc.txt + // + // Note that the memory is tiled 4 planes at a time in the depth direction. + // e.g. d0, d1, d2, d3 is tiled as a group then d4, d5, d6, d7 + // + + // Tile as 4x4x4 + for (int d = 0; d < depth_4; d++) + { + // Copy one slice of the 3d texture + for (u32 i = 0; i < row_element_count; i += 1) + { + // Copy one span (8 bytes for DXT1 or 16 bytes for DXT5) + dst[dst_offset + i] = src[src_offset + i * 4]; + } + + dst_offset += plane_size; + + // Last plane in the group of 4? + if ((d & 0x3) == 0x3) + { + // Move forward to next group of 4 planes + src_offset += row_element_count * 4 - 3; + } + else + { + src_offset += 1; + } } - src_offset += src_pitch_in_block; - dst_offset += dst_pitch_in_block; + // End Case - tile as 4x4x3 or 4x4x2 or 4x4x1 + const int vtc_tile_count = depth - depth_4; + for (int d = 0; d < vtc_tile_count; d++) + { + // Copy one slice of the 3d texture + for (u32 i = 0; i < row_element_count; i += 1) + { + // Copy one span (8 bytes for DXT1 or 16 bytes for DXT5) + dst[dst_offset + i] = src[src_offset + i * vtc_tile_count]; + } + + dst_offset += plane_size; + src_offset += 1; + } } - } -}; + }; -struct copy_rgb655_block -{ - template - static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block, u32 src_pitch_in_block) + struct copy_linear_block_to_vtc { - static_assert(sizeof(T) == 2, "Type size doesn't match."); - - u32 src_offset = 0, dst_offset = 0; - const u32 v_porch = src_pitch_in_block * border; - - for (int layer = 0; layer < depth; ++layer) + template + static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u32 /*dst_pitch_in_block*/, u32 src_pitch_in_block) { - // Front - src_offset += v_porch; + static_assert(sizeof(T) == sizeof(U), "Type size doesn't match."); + u32 plane_size = src_pitch_in_block * row_count; + u32 row_element_count = width_in_block * row_count; + u32 dst_offset = 0; + u32 src_offset = 0; + const u16 depth_4 = (depth >> 2) * 4; // multiple of 4 - for (u32 row = 0; row < row_count; ++row) + // Convert incoming linear texture to VTC compressed texture + // https://www.khronos.org/registry/OpenGL/extensions/NV/NV_texture_compression_vtc.txt + + // Tile as 4x4x4 + for (int d = 0; d < depth_4; d++) + { + // Copy one slice of the 3d texture + for (u32 i = 0; i < row_element_count; i += 1) + { + // Copy one span (8 bytes for DXT1 or 16 bytes for DXT5) + dst[dst_offset + i * 4] = src[src_offset + i]; + } + + src_offset += plane_size; + + // Last plane in the group of 4? + if ((d & 0x3) == 0x3) + { + // Move forward to next group of 4 planes + dst_offset += row_element_count * 4 - 3; + } + else + { + dst_offset++; + } + } + + // End Case - tile as 4x4x3 or 4x4x2 or 4x4x1 + const int vtc_tile_count = depth - depth_4; + for (int d = 0; d < vtc_tile_count; d++) + { + // Copy one slice of the 3d texture + for (u32 i = 0; i < row_element_count; i += 1) + { + // Copy one span (8 bytes for DXT1 or 16 bytes for DXT5) + dst[dst_offset + i * vtc_tile_count] = src[src_offset + i]; + } + + src_offset += row_element_count; + dst_offset++; + } + } + }; + + struct copy_decoded_rb_rg_block + { + template + static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u32 dst_pitch_in_block, u32 src_pitch_in_block) + { + static_assert(sizeof(T) == 4, "Type size doesn't match."); + + u32 src_offset = 0; + u32 dst_offset = 0; + + // Temporaries + u32 red0, red1, blue, green; + + for (int row = 0; row < row_count * depth; ++row) { for (int col = 0; col < width_in_block; ++col) { - dst[dst_offset + col] = convert_rgb655_to_rgb565(src[src_offset + col + border]); + // Decompress one block to 2 pixels at a time and write output in BGRA format + const auto data = src[src_offset + col]; + + if constexpr (SwapWords) + { + // BR_GR + blue = (data >> 0) & 0xFF; + red0 = (data >> 8) & 0xFF; + green = (data >> 16) & 0XFF; + red1 = (data >> 24) & 0xFF; + } + else + { + // RB_RG + red0 = (data >> 0) & 0xFF; + blue = (data >> 8) & 0xFF; + red1 = (data >> 16) & 0XFF; + green = (data >> 24) & 0xFF; + } + + dst[dst_offset + (col * 2)] = blue | (green << 8) | (red0 << 16) | (0xFF << 24); + dst[dst_offset + (col * 2 + 1)] = blue | (green << 8) | (red1 << 16) | (0xFF << 24); } src_offset += src_pitch_in_block; dst_offset += dst_pitch_in_block; } - - // Back - src_offset += v_porch; } - } -}; + }; -struct copy_rgb655_block_swizzled -{ - template - static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block) + struct copy_rgb655_block { - u32 padded_width, padded_height; - if (border) + template + static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block, u32 src_pitch_in_block) { - padded_width = rsx::next_pow2(width_in_block + border + border); - padded_height = rsx::next_pow2(row_count + border + border); + static_assert(sizeof(T) == 2, "Type size doesn't match."); + + u32 src_offset = 0, dst_offset = 0; + const u32 v_porch = src_pitch_in_block * border; + + for (int layer = 0; layer < depth; ++layer) + { + // Front + src_offset += v_porch; + + for (u32 row = 0; row < row_count; ++row) + { + for (int col = 0; col < width_in_block; ++col) + { + dst[dst_offset + col] = convert_rgb655_to_rgb565(src[src_offset + col + border]); + } + + src_offset += src_pitch_in_block; + dst_offset += dst_pitch_in_block; + } + + // Back + src_offset += v_porch; + } + } + }; + + struct copy_rgb655_block_swizzled + { + template + static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block) + { + u32 padded_width, padded_height; + if (border) + { + padded_width = rsx::next_pow2(width_in_block + border + border); + padded_height = rsx::next_pow2(row_count + border + border); + } + else + { + padded_width = width_in_block; + padded_height = row_count; + } + + u32 size = padded_width * padded_height * depth * 2; + rsx::simple_array tmp(size); + + rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); + + std::span src_span = tmp; + copy_rgb655_block::copy_mipmap_level(dst, src_span, width_in_block, row_count, depth, border, dst_pitch_in_block, padded_width); + } + }; + + struct copy_decoded_bc1_block + { + static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u32 row_count, u16 depth, u32 dst_pitch_in_block, u32 src_pitch_in_block) + { + u32 src_offset = 0, dst_offset = 0, destinationPitch = dst_pitch_in_block * 4; + for (u32 row = 0; row < row_count * depth; row++) + { + for (u32 col = 0; col < width_in_block; col++) + { + const u8* compressedBlock = reinterpret_cast(&src[src_offset + col]); + u8* decompressedBlock = reinterpret_cast(&dst[dst_offset + col * 4]); + bcdec_bc1(compressedBlock, decompressedBlock, destinationPitch); + } + + src_offset += src_pitch_in_block; + dst_offset += destinationPitch; + } + } + }; + + struct copy_decoded_bc2_block + { + static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u32 row_count, u16 depth, u32 dst_pitch_in_block, u32 src_pitch_in_block) + { + u32 src_offset = 0, dst_offset = 0, destinationPitch = dst_pitch_in_block * 4; + for (u32 row = 0; row < row_count * depth; row++) + { + for (u32 col = 0; col < width_in_block; col++) + { + const u8* compressedBlock = reinterpret_cast(&src[src_offset + col]); + u8* decompressedBlock = reinterpret_cast(&dst[dst_offset + col * 4]); + bcdec_bc2(compressedBlock, decompressedBlock, destinationPitch); + } + + src_offset += src_pitch_in_block; + dst_offset += destinationPitch; + } + } + }; + + struct copy_decoded_bc3_block + { + static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u32 row_count, u16 depth, u32 dst_pitch_in_block, u32 src_pitch_in_block) + { + u32 src_offset = 0, dst_offset = 0, destinationPitch = dst_pitch_in_block * 4; + for (u32 row = 0; row < row_count * depth; row++) + { + for (u32 col = 0; col < width_in_block; col++) + { + const u8* compressedBlock = reinterpret_cast(&src[src_offset + col]); + u8* decompressedBlock = reinterpret_cast(&dst[dst_offset + col * 4]); + bcdec_bc3(compressedBlock, decompressedBlock, destinationPitch); + } + + src_offset += src_pitch_in_block; + dst_offset += destinationPitch; + } + } + }; + + namespace + { + /** + * Generates copy instructions required to build the texture GPU side without actually copying anything. + * Returns a set of addresses and data lengths to use. This can be used to generate a GPU task to avoid CPU doing the heavy lifting. + */ + std::vector + build_transfer_cmds(const void* src, u16 block_size_in_bytes, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block, u32 src_pitch_in_block) + { + std::vector result; + + if (src_pitch_in_block == dst_pitch_in_block && !border) + { + // Fast copy + rsx::memory_transfer_cmd cmd; + cmd.src = src; + cmd.dst = nullptr; + cmd.length = src_pitch_in_block * block_size_in_bytes * row_count * depth; + return {cmd}; + } + + const u32 width_in_bytes = width_in_block * block_size_in_bytes; + const u32 src_pitch_in_bytes = src_pitch_in_block * block_size_in_bytes; + const u32 dst_pitch_in_bytes = dst_pitch_in_block * block_size_in_bytes; + + const u32 h_porch = border * block_size_in_bytes; + const u32 v_porch = src_pitch_in_bytes * border; + + auto src_ = static_cast(src) + h_porch; + auto dst_ = static_cast(nullptr); + + for (int layer = 0; layer < depth; ++layer) + { + // Front + src_ += v_porch; + + for (int row = 0; row < row_count; ++row) + { + rsx::memory_transfer_cmd cmd{dst_, src_, width_in_bytes}; + result.push_back(cmd); + src_ += src_pitch_in_bytes; + dst_ += dst_pitch_in_bytes; + } + + // Back + src_ += v_porch; + } + + return result; + } + + /** + * Texture upload template. + * + * Source textures are stored as following (for power of 2 textures): + * - For linear texture every mipmap level share rowpitch (which is the one of mipmap 0). This means that for non 0 mipmap there's padding between row. + * - For swizzled texture row pitch is texture width X pixel/block size. There's not padding between row. + * - There is no padding between 2 mipmap levels. This means that next mipmap level starts at offset rowpitch X row count + * - Cubemap images are 128 bytes aligned. + * + * The template iterates over all depth (including cubemap) and over all mipmaps. + * Sometimes texture provides a pitch even if texture is swizzled (and then packed) and in such case it's ignored. It's passed via suggested_pitch and is used only if padded_row is false. + */ + template + std::vector get_subresources_layout_impl(const std::byte* texture_data_pointer, u16 width_in_texel, u16 height_in_texel, u16 depth, u8 layer_count, u16 mipmap_count, u32 suggested_pitch_in_bytes, bool padded_row, bool border) + { + /** + * Note about size type: RSX texture width is stored in a 16 bits int and pitch is stored in a 20 bits int. + */ + + // <= 128 so fits in u8 + constexpr u8 block_size_in_bytes = sizeof(SRC_TYPE); + + std::vector result; + usz offset_in_src = 0; + + const u8 border_size = border ? (padded_row ? 1 : 4) : 0; + u32 src_pitch_in_block; + u32 full_height_in_block; + + for (unsigned layer = 0; layer < layer_count; layer++) + { + u16 miplevel_width_in_texel = width_in_texel, miplevel_height_in_texel = height_in_texel, miplevel_depth = depth; + for (unsigned mip_level = 0; mip_level < mipmap_count; mip_level++) + { + result.push_back({}); + rsx::subresource_layout& current_subresource_layout = result.back(); + + current_subresource_layout.width_in_texel = miplevel_width_in_texel; + current_subresource_layout.height_in_texel = miplevel_height_in_texel; + current_subresource_layout.level = mip_level; + current_subresource_layout.layer = layer; + current_subresource_layout.depth = miplevel_depth; + current_subresource_layout.border = border_size; + + if constexpr (block_edge_in_texel == 1) + { + current_subresource_layout.width_in_block = miplevel_width_in_texel; + current_subresource_layout.height_in_block = miplevel_height_in_texel; + } + else if constexpr (block_edge_in_texel == 4) + { + current_subresource_layout.width_in_block = utils::aligned_div(miplevel_width_in_texel, block_edge_in_texel); + current_subresource_layout.height_in_block = utils::aligned_div(miplevel_height_in_texel, block_edge_in_texel); + } + else + { + // Only the width is compressed + current_subresource_layout.width_in_block = utils::aligned_div(miplevel_width_in_texel, block_edge_in_texel); + current_subresource_layout.height_in_block = miplevel_height_in_texel; + } + + if (padded_row) + { + src_pitch_in_block = suggested_pitch_in_bytes / block_size_in_bytes; + full_height_in_block = current_subresource_layout.height_in_block + (border_size + border_size); + } + else if (!border) + { + src_pitch_in_block = current_subresource_layout.width_in_block; + full_height_in_block = current_subresource_layout.height_in_block; + } + else + { + src_pitch_in_block = rsx::next_pow2(current_subresource_layout.width_in_block + border_size + border_size); + full_height_in_block = rsx::next_pow2(current_subresource_layout.height_in_block + border_size + border_size); + } + + const u32 slice_sz = src_pitch_in_block * block_size_in_bytes * full_height_in_block * miplevel_depth; + current_subresource_layout.pitch_in_block = src_pitch_in_block; + current_subresource_layout.data = {texture_data_pointer + offset_in_src, slice_sz}; + + offset_in_src += slice_sz; + miplevel_width_in_texel = std::max(miplevel_width_in_texel / 2, 1); + miplevel_height_in_texel = std::max(miplevel_height_in_texel / 2, 1); + miplevel_depth = std::max(miplevel_depth / 2, 1); + } + + if (!padded_row) // Only swizzled textures obey this restriction + { + offset_in_src = utils::align(offset_in_src, 128); + } + } + + return result; + } + } // namespace + + template + u32 get_row_pitch_in_block(u16 width_in_block, usz alignment) + { + if (const usz pitch = width_in_block * sizeof(T); + pitch == alignment) + { + return width_in_block; } else { - padded_width = width_in_block; - padded_height = row_count; - } - - u32 size = padded_width * padded_height * depth * 2; - rsx::simple_array tmp(size); - - rsx::convert_linear_swizzle_3d(src.data(), tmp.data(), padded_width, padded_height, depth); - - std::span src_span = tmp; - copy_rgb655_block::copy_mipmap_level(dst, src_span, width_in_block, row_count, depth, border, dst_pitch_in_block, padded_width); - } -}; - -struct copy_decoded_bc1_block -{ - static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u32 row_count, u16 depth, u32 dst_pitch_in_block, u32 src_pitch_in_block) - { - u32 src_offset = 0, dst_offset = 0, destinationPitch = dst_pitch_in_block * 4; - for (u32 row = 0; row < row_count * depth; row++) - { - for (u32 col = 0; col < width_in_block; col++) - { - const u8* compressedBlock = reinterpret_cast(&src[src_offset + col]); - u8* decompressedBlock = reinterpret_cast(&dst[dst_offset + col * 4]); - bcdec_bc1(compressedBlock, decompressedBlock, destinationPitch); - } - - src_offset += src_pitch_in_block; - dst_offset += destinationPitch; + usz divided = (pitch + alignment - 1) / alignment; + return static_cast(divided * alignment / sizeof(T)); } } -}; -struct copy_decoded_bc2_block -{ - static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u32 row_count, u16 depth, u32 dst_pitch_in_block, u32 src_pitch_in_block) + u32 get_row_pitch_in_block(u16 block_size_in_bytes, u16 width_in_block, usz alignment) { - u32 src_offset = 0, dst_offset = 0, destinationPitch = dst_pitch_in_block * 4; - for (u32 row = 0; row < row_count * depth; row++) + if (const usz pitch = width_in_block * block_size_in_bytes; + pitch == alignment) { - for (u32 col = 0; col < width_in_block; col++) - { - const u8* compressedBlock = reinterpret_cast(&src[src_offset + col]); - u8* decompressedBlock = reinterpret_cast(&dst[dst_offset + col * 4]); - bcdec_bc2(compressedBlock, decompressedBlock, destinationPitch); - } - - src_offset += src_pitch_in_block; - dst_offset += destinationPitch; + return width_in_block; } - } -}; - -struct copy_decoded_bc3_block -{ - static void copy_mipmap_level(std::span dst, std::span src, u16 width_in_block, u32 row_count, u16 depth, u32 dst_pitch_in_block, u32 src_pitch_in_block) - { - u32 src_offset = 0, dst_offset = 0, destinationPitch = dst_pitch_in_block * 4; - for (u32 row = 0; row < row_count * depth; row++) + else { - for (u32 col = 0; col < width_in_block; col++) - { - const u8* compressedBlock = reinterpret_cast(&src[src_offset + col]); - u8* decompressedBlock = reinterpret_cast(&dst[dst_offset + col * 4]); - bcdec_bc3(compressedBlock, decompressedBlock, destinationPitch); - } - - src_offset += src_pitch_in_block; - dst_offset += destinationPitch; + usz divided = (pitch + alignment - 1) / alignment; + return static_cast(divided * alignment / block_size_in_bytes); } } -}; - -namespace -{ - /** - * Generates copy instructions required to build the texture GPU side without actually copying anything. - * Returns a set of addresses and data lengths to use. This can be used to generate a GPU task to avoid CPU doing the heavy lifting. - */ - std::vector - build_transfer_cmds(const void* src, u16 block_size_in_bytes, u16 width_in_block, u16 row_count, u16 depth, u8 border, u32 dst_pitch_in_block, u32 src_pitch_in_block) - { - std::vector result; - - if (src_pitch_in_block == dst_pitch_in_block && !border) - { - // Fast copy - rsx::memory_transfer_cmd cmd; - cmd.src = src; - cmd.dst = nullptr; - cmd.length = src_pitch_in_block * block_size_in_bytes * row_count * depth; - return { cmd }; - } - - const u32 width_in_bytes = width_in_block * block_size_in_bytes; - const u32 src_pitch_in_bytes = src_pitch_in_block * block_size_in_bytes; - const u32 dst_pitch_in_bytes = dst_pitch_in_block * block_size_in_bytes; - - const u32 h_porch = border * block_size_in_bytes; - const u32 v_porch = src_pitch_in_bytes * border; - - auto src_ = static_cast(src) + h_porch; - auto dst_ = static_cast(nullptr); - - for (int layer = 0; layer < depth; ++layer) - { - // Front - src_ += v_porch; - - for (int row = 0; row < row_count; ++row) - { - rsx::memory_transfer_cmd cmd{ dst_, src_, width_in_bytes }; - result.push_back(cmd); - src_ += src_pitch_in_bytes; - dst_ += dst_pitch_in_bytes; - } - - // Back - src_ += v_porch; - } - - return result; - } /** - * Texture upload template. - * - * Source textures are stored as following (for power of 2 textures): - * - For linear texture every mipmap level share rowpitch (which is the one of mipmap 0). This means that for non 0 mipmap there's padding between row. - * - For swizzled texture row pitch is texture width X pixel/block size. There's not padding between row. - * - There is no padding between 2 mipmap levels. This means that next mipmap level starts at offset rowpitch X row count - * - Cubemap images are 128 bytes aligned. - * - * The template iterates over all depth (including cubemap) and over all mipmaps. - * Sometimes texture provides a pitch even if texture is swizzled (and then packed) and in such case it's ignored. It's passed via suggested_pitch and is used only if padded_row is false. + * Since rsx ignore unused dimensionality some app set them to 0. + * Use 1 value instead to be more general. */ - template - std::vector get_subresources_layout_impl(const std::byte *texture_data_pointer, u16 width_in_texel, u16 height_in_texel, u16 depth, u8 layer_count, u16 mipmap_count, u32 suggested_pitch_in_bytes, bool padded_row, bool border) + template + std::tuple get_height_depth_layer(const RsxTextureType& tex) { - /** - * Note about size type: RSX texture width is stored in a 16 bits int and pitch is stored in a 20 bits int. - */ - - // <= 128 so fits in u8 - constexpr u8 block_size_in_bytes = sizeof(SRC_TYPE); - - std::vector result; - usz offset_in_src = 0; - - const u8 border_size = border ? (padded_row ? 1 : 4) : 0; - u32 src_pitch_in_block; - u32 full_height_in_block; - - for (unsigned layer = 0; layer < layer_count; layer++) + switch (tex.get_extended_texture_dimension()) { - u16 miplevel_width_in_texel = width_in_texel, miplevel_height_in_texel = height_in_texel, miplevel_depth = depth; - for (unsigned mip_level = 0; mip_level < mipmap_count; mip_level++) - { - result.push_back({}); - rsx::subresource_layout& current_subresource_layout = result.back(); - - current_subresource_layout.width_in_texel = miplevel_width_in_texel; - current_subresource_layout.height_in_texel = miplevel_height_in_texel; - current_subresource_layout.level = mip_level; - current_subresource_layout.layer = layer; - current_subresource_layout.depth = miplevel_depth; - current_subresource_layout.border = border_size; - - if constexpr (block_edge_in_texel == 1) - { - current_subresource_layout.width_in_block = miplevel_width_in_texel; - current_subresource_layout.height_in_block = miplevel_height_in_texel; - } - else if constexpr (block_edge_in_texel == 4) - { - current_subresource_layout.width_in_block = utils::aligned_div(miplevel_width_in_texel, block_edge_in_texel); - current_subresource_layout.height_in_block = utils::aligned_div(miplevel_height_in_texel, block_edge_in_texel); - } - else - { - // Only the width is compressed - current_subresource_layout.width_in_block = utils::aligned_div(miplevel_width_in_texel, block_edge_in_texel); - current_subresource_layout.height_in_block = miplevel_height_in_texel; - } - - if (padded_row) - { - src_pitch_in_block = suggested_pitch_in_bytes / block_size_in_bytes; - full_height_in_block = current_subresource_layout.height_in_block + (border_size + border_size); - } - else if (!border) - { - src_pitch_in_block = current_subresource_layout.width_in_block; - full_height_in_block = current_subresource_layout.height_in_block; - } - else - { - src_pitch_in_block = rsx::next_pow2(current_subresource_layout.width_in_block + border_size + border_size); - full_height_in_block = rsx::next_pow2(current_subresource_layout.height_in_block + border_size + border_size); - } - - const u32 slice_sz = src_pitch_in_block * block_size_in_bytes * full_height_in_block * miplevel_depth; - current_subresource_layout.pitch_in_block = src_pitch_in_block; - current_subresource_layout.data = { texture_data_pointer + offset_in_src, slice_sz }; - - offset_in_src += slice_sz; - miplevel_width_in_texel = std::max(miplevel_width_in_texel / 2, 1); - miplevel_height_in_texel = std::max(miplevel_height_in_texel / 2, 1); - miplevel_depth = std::max(miplevel_depth / 2, 1); - } - - if (!padded_row) // Only swizzled textures obey this restriction - { - offset_in_src = utils::align(offset_in_src, 128); - } + case rsx::texture_dimension_extended::texture_dimension_1d: return std::make_tuple(1, 1, 1); + case rsx::texture_dimension_extended::texture_dimension_2d: return std::make_tuple(tex.height(), 1, 1); + case rsx::texture_dimension_extended::texture_dimension_cubemap: return std::make_tuple(tex.height(), 1, 6); + case rsx::texture_dimension_extended::texture_dimension_3d: return std::make_tuple(tex.height(), tex.depth(), 1); } + fmt::throw_exception("Unsupported texture dimension"); + } +} // namespace - return result; - } -} - -template -u32 get_row_pitch_in_block(u16 width_in_block, usz alignment) -{ - if (const usz pitch = width_in_block * sizeof(T); - pitch == alignment) - { - return width_in_block; - } - else - { - usz divided = (pitch + alignment - 1) / alignment; - return static_cast(divided * alignment / sizeof(T)); - } -} - -u32 get_row_pitch_in_block(u16 block_size_in_bytes, u16 width_in_block, usz alignment) -{ - if (const usz pitch = width_in_block * block_size_in_bytes; - pitch == alignment) - { - return width_in_block; - } - else - { - usz divided = (pitch + alignment - 1) / alignment; - return static_cast(divided * alignment / block_size_in_bytes); - } -} - -/** - * Since rsx ignore unused dimensionality some app set them to 0. - * Use 1 value instead to be more general. - */ -template -std::tuple get_height_depth_layer(const RsxTextureType &tex) -{ - switch (tex.get_extended_texture_dimension()) - { - case rsx::texture_dimension_extended::texture_dimension_1d: return std::make_tuple(1, 1, 1); - case rsx::texture_dimension_extended::texture_dimension_2d: return std::make_tuple(tex.height(), 1, 1); - case rsx::texture_dimension_extended::texture_dimension_cubemap: return std::make_tuple(tex.height(), 1, 6); - case rsx::texture_dimension_extended::texture_dimension_3d: return std::make_tuple(tex.height(), tex.depth(), 1); - } - fmt::throw_exception("Unsupported texture dimension"); -} -} - -template -std::vector get_subresources_layout_impl(const RsxTextureType &texture) +template +std::vector get_subresources_layout_impl(const RsxTextureType& texture) { u16 w = texture.width(); u16 h; @@ -809,7 +810,7 @@ std::vector get_subresources_layout_impl(const RsxTextu case CELL_GCM_TEXTURE_G8B8: case CELL_GCM_TEXTURE_X16: return get_subresources_layout_impl<1, u16>(pixels, w, h, depth, layer, texture.get_exact_mipmap_count(), pitch, !is_swizzled, has_border); - case CELL_GCM_TEXTURE_DEPTH24_D8: // Untested + case CELL_GCM_TEXTURE_DEPTH24_D8: // Untested case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT: // Untested case CELL_GCM_TEXTURE_D8R8G8B8: case CELL_GCM_TEXTURE_A8R8G8B8: @@ -986,8 +987,8 @@ namespace rsx break; } - // NOTE: Textures with WZYX notations refer to arbitrary data and not color swizzles as in common GPU lang - // WZYX actually maps directly as a RGBA16 format in Cell memory! R=W, not R=X + // NOTE: Textures with WZYX notations refer to arbitrary data and not color swizzles as in common GPU lang + // WZYX actually maps directly as a RGBA16 format in Cell memory! R=W, not R=X case CELL_GCM_TEXTURE_X16: case CELL_GCM_TEXTURE_Y16_X16: @@ -1410,7 +1411,7 @@ namespace rsx if (border) { width_in_block = swizzled ? rsx::next_pow2(width_in_block + 8) : - width_in_block + 2; + width_in_block + 2; } return width_in_block * bytes_per_block; @@ -1472,7 +1473,7 @@ namespace rsx if (!packed) { // Constant pitch layout, simple scanning - const u32 internal_height = (height + texel_rows_per_line - 1) / texel_rows_per_line; // Convert texels to blocks + const u32 internal_height = (height + texel_rows_per_line - 1) / texel_rows_per_line; // Convert texels to blocks for (u32 layer = 0; layer < layers; ++layer) { u32 mip_height = internal_height; @@ -1489,8 +1490,8 @@ namespace rsx const auto texels_per_block = get_format_block_size_in_texel(gcm_format); const auto bytes_per_block = get_format_block_size_in_bytes(gcm_format); - const u32 internal_height = (height + texel_rows_per_line - 1) / texel_rows_per_line; // Convert texels to blocks - const u32 internal_width = (width + texels_per_block - 1) / texels_per_block; // Convert texels to blocks + const u32 internal_height = (height + texel_rows_per_line - 1) / texel_rows_per_line; // Convert texels to blocks + const u32 internal_width = (width + texels_per_block - 1) / texels_per_block; // Convert texels to blocks for (u32 layer = 0; layer < layers; ++layer) { u32 mip_height = internal_height; @@ -1541,36 +1542,36 @@ namespace rsx switch (format) { case rsx::surface_color_format::r5g6b5: - return{ CELL_GCM_TEXTURE_R5G6B5, false }; + return {CELL_GCM_TEXTURE_R5G6B5, false}; case rsx::surface_color_format::x8r8g8b8_z8r8g8b8: case rsx::surface_color_format::x8r8g8b8_o8r8g8b8: case rsx::surface_color_format::a8r8g8b8: - return{ CELL_GCM_TEXTURE_A8R8G8B8, true }; //verified + return {CELL_GCM_TEXTURE_A8R8G8B8, true}; // verified case rsx::surface_color_format::x8b8g8r8_o8b8g8r8: case rsx::surface_color_format::x8b8g8r8_z8b8g8r8: case rsx::surface_color_format::a8b8g8r8: - return{ CELL_GCM_TEXTURE_A8R8G8B8, true }; + return {CELL_GCM_TEXTURE_A8R8G8B8, true}; case rsx::surface_color_format::w16z16y16x16: - return{ CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT, true }; + return {CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT, true}; case rsx::surface_color_format::w32z32y32x32: - return{ CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT, true }; + return {CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT, true}; case rsx::surface_color_format::x1r5g5b5_o1r5g5b5: case rsx::surface_color_format::x1r5g5b5_z1r5g5b5: - return{ CELL_GCM_TEXTURE_A1R5G5B5, false }; + return {CELL_GCM_TEXTURE_A1R5G5B5, false}; case rsx::surface_color_format::b8: - return{ CELL_GCM_TEXTURE_B8, false }; + return {CELL_GCM_TEXTURE_B8, false}; case rsx::surface_color_format::g8b8: - return{ CELL_GCM_TEXTURE_G8B8, true }; + return {CELL_GCM_TEXTURE_G8B8, true}; case rsx::surface_color_format::x32: - return{ CELL_GCM_TEXTURE_X32_FLOAT, true }; //verified + return {CELL_GCM_TEXTURE_X32_FLOAT, true}; // verified default: fmt::throw_exception("Unhandled surface format 0x%x", static_cast(format)); } @@ -1581,13 +1582,13 @@ namespace rsx switch (format) { case rsx::surface_depth_format2::z16_uint: - return{ CELL_GCM_TEXTURE_DEPTH16, true }; + return {CELL_GCM_TEXTURE_DEPTH16, true}; case rsx::surface_depth_format2::z24s8_uint: - return{ CELL_GCM_TEXTURE_DEPTH24_D8, true }; + return {CELL_GCM_TEXTURE_DEPTH24_D8, true}; case rsx::surface_depth_format2::z16_float: - return{ CELL_GCM_TEXTURE_DEPTH16_FLOAT, true }; + return {CELL_GCM_TEXTURE_DEPTH16_FLOAT, true}; case rsx::surface_depth_format2::z24s8_float: - return{ CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT, true }; + return {CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT, true}; default: fmt::throw_exception("Unreachable"); } @@ -1636,21 +1637,21 @@ namespace rsx { switch (mode) { - // Clamping modes - default: - rsx_log.error("Unknown texture wrap mode: %d", static_cast(mode)); - [[ fallthrough ]]; - case rsx::texture_wrap_mode::border: - case rsx::texture_wrap_mode::clamp: - case rsx::texture_wrap_mode::clamp_to_edge: - case rsx::texture_wrap_mode::mirror_once_clamp_to_edge: - case rsx::texture_wrap_mode::mirror_once_border: - case rsx::texture_wrap_mode::mirror_once_clamp: - return false; - // Wrapping modes - case rsx::texture_wrap_mode::wrap: - case rsx::texture_wrap_mode::mirror: - return true; + // Clamping modes + default: + rsx_log.error("Unknown texture wrap mode: %d", static_cast(mode)); + [[fallthrough]]; + case rsx::texture_wrap_mode::border: + case rsx::texture_wrap_mode::clamp: + case rsx::texture_wrap_mode::clamp_to_edge: + case rsx::texture_wrap_mode::mirror_once_clamp_to_edge: + case rsx::texture_wrap_mode::mirror_once_border: + case rsx::texture_wrap_mode::mirror_once_clamp: + return false; + // Wrapping modes + case rsx::texture_wrap_mode::wrap: + case rsx::texture_wrap_mode::mirror: + return true; } } @@ -1674,4 +1675,4 @@ namespace rsx return false; } } -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/TextureUtils.h b/rpcs3/rpcs3/Emu/RSX/Common/TextureUtils.h index 2b9552bc7..983a7eac7 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/TextureUtils.h +++ b/rpcs3/rpcs3/Emu/RSX/Common/TextureUtils.h @@ -44,17 +44,17 @@ namespace rsx // Publicly visible enumerators enum { - shader_read = (1 << 0), - shader_write = (1 << 1), - transfer_read = (1 << 2), + shader_read = (1 << 0), + shader_write = (1 << 1), + transfer_read = (1 << 2), transfer_write = (1 << 3), // Arbitrary r/w flags, use with caution. - memory_write = (1 << 4), - memory_read = (1 << 5), + memory_write = (1 << 4), + memory_read = (1 << 5), // Not r/w but signifies a GPU reference to this object. - gpu_reference = (1 << 6), + gpu_reference = (1 << 6), }; private: @@ -71,7 +71,8 @@ namespace rsx public: // Ctor surface_access(u32 value) : value_(value) - {} + { + } // Quick helpers inline bool is_read() const @@ -94,12 +95,12 @@ namespace rsx return !(value_ & ~(all_transfer | all_reads)); } - bool operator == (const surface_access& other) const + bool operator==(const surface_access& other) const { return value_ == other.value_; } - bool operator == (u32 other) const + bool operator==(u32 other) const { return value_ == other; } @@ -121,7 +122,7 @@ namespace rsx RSX_FORMAT_CLASS_DEPTH_FLOAT_MASK = (RSX_FORMAT_CLASS_DEPTH16_FLOAT | RSX_FORMAT_CLASS_DEPTH24_FLOAT_X8_PACK32), RSX_FORMAT_CLASS_DONT_CARE = RSX_FORMAT_CLASS_UNDEFINED, }; - } + } // namespace format_class_ using namespace format_class_; @@ -198,8 +199,8 @@ namespace rsx u16 depth; u16 level; u16 layer; - u8 border; - u8 reserved; + u8 border; + u8 reserved; u32 pitch_in_block; }; @@ -232,21 +233,21 @@ namespace rsx }; /** - * Get size to store texture in a linear fashion. - * Storage is assumed to use a rowPitchAlignment boundary for every row of texture. - */ + * Get size to store texture in a linear fashion. + * Storage is assumed to use a rowPitchAlignment boundary for every row of texture. + */ usz get_placed_texture_storage_size(u16 width, u16 height, u32 depth, u8 format, u16 mipmap, bool cubemap, usz row_pitch_alignment, usz mipmap_alignment); - usz get_placed_texture_storage_size(const rsx::fragment_texture &texture, usz row_pitch_alignment, usz mipmap_alignment = 0x200); - usz get_placed_texture_storage_size(const rsx::vertex_texture &texture, usz row_pitch_alignment, usz mipmap_alignment = 0x200); + usz get_placed_texture_storage_size(const rsx::fragment_texture& texture, usz row_pitch_alignment, usz mipmap_alignment = 0x200); + usz get_placed_texture_storage_size(const rsx::vertex_texture& texture, usz row_pitch_alignment, usz mipmap_alignment = 0x200); /** * get all rsx::subresource_layout for texture. * The subresources are ordered per layer then per mipmap level (as in rsx memory). */ - std::vector get_subresources_layout(const rsx::fragment_texture &texture); - std::vector get_subresources_layout(const rsx::vertex_texture &texture); + std::vector get_subresources_layout(const rsx::fragment_texture& texture); + std::vector get_subresources_layout(const rsx::vertex_texture& texture); - texture_memory_info upload_texture_subresource(rsx::io_buffer& dst_buffer, const subresource_layout &src_layout, int format, bool is_swizzled, texture_uploader_capabilities& caps); + texture_memory_info upload_texture_subresource(rsx::io_buffer& dst_buffer, const subresource_layout& src_layout, int format, bool is_swizzled, texture_uploader_capabilities& caps); u8 get_format_block_size_in_bytes(int format); u8 get_format_block_size_in_texel(int format); @@ -265,19 +266,19 @@ namespace rsx u8 get_format_texel_rows_per_line(u32 format); /** - * Get number of bytes occupied by texture in RSX mem - */ - usz get_texture_size(const rsx::fragment_texture &texture); - usz get_texture_size(const rsx::vertex_texture &texture); + * Get number of bytes occupied by texture in RSX mem + */ + usz get_texture_size(const rsx::fragment_texture& texture); + usz get_texture_size(const rsx::vertex_texture& texture); /** - * Get packed pitch - */ + * Get packed pitch + */ u32 get_format_packed_pitch(u32 format, u16 width, bool border = false, bool swizzled = false); /** - * Reverse encoding - */ + * Reverse encoding + */ u32 get_remap_encoding(const texture_channel_remap_t& remap); /** @@ -297,4 +298,4 @@ namespace rsx { return is_border_clamped_texture(tex.wrap_s(), tex.wrap_t(), tex.wrap_r(), tex.dimension()); } -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/bitfield.hpp b/rpcs3/rpcs3/Emu/RSX/Common/bitfield.hpp index af02792fc..343417f3f 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/bitfield.hpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/bitfield.hpp @@ -36,11 +36,11 @@ namespace rsx } template - requires std::is_integral_v&& std::is_enum_v + requires std::is_integral_v && std::is_enum_v class atomic_bitmask_t { private: - atomic_t m_data{ 0 }; + atomic_t m_data{0}; public: atomic_bitmask_t() = default; @@ -55,22 +55,22 @@ namespace rsx m_data.store(static_cast(value)); } - bool operator & (T mask) const + bool operator&(T mask) const { return ((m_data.load() & static_cast(mask)) != 0); } - T operator | (T mask) const + T operator|(T mask) const { return static_cast(m_data.load() | static_cast(mask)); } - void operator &= (T mask) + void operator&=(T mask) { m_data.fetch_and(static_cast(mask)); } - void operator |= (T mask) + void operator|=(T mask) { m_data.fetch_or(static_cast(mask)); } @@ -92,7 +92,7 @@ namespace rsx m_data.release(0); } - operator bool () const + operator bool() const { return m_data.observe() != 0; } @@ -113,22 +113,22 @@ namespace rsx return m_data; } - bool operator & (bitmask_type mask) const + bool operator&(bitmask_type mask) const { return !!(m_data & mask); } - bitmask_type operator | (bitmask_type mask) const + bitmask_type operator|(bitmask_type mask) const { return m_data | mask; } - void operator &= (bitmask_type mask) + void operator&=(bitmask_type mask) { m_data &= mask; } - void operator |= (bitmask_type mask) + void operator|=(bitmask_type mask) { m_data |= mask; } @@ -168,4 +168,4 @@ namespace rsx return !!m_data; } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/buffer_stream.hpp b/rpcs3/rpcs3/Emu/RSX/Common/buffer_stream.hpp index ff68d6008..be265eb45 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/buffer_stream.hpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/buffer_stream.hpp @@ -24,15 +24,13 @@ namespace utils /** * Stream a 128 bits vector to dst. */ - static inline - void stream_vector(void* dst, u32 x, u32 y, u32 z, u32 w) + static inline void stream_vector(void* dst, u32 x, u32 y, u32 z, u32 w) { const __m128i vector = _mm_set_epi32(w, z, y, x); _mm_stream_si128(reinterpret_cast<__m128i*>(dst), vector); } - static inline - void stream_vector(void* dst, f32 x, f32 y, f32 z, f32 w) + static inline void stream_vector(void* dst, f32 x, f32 y, f32 z, f32 w) { stream_vector(dst, std::bit_cast(x), std::bit_cast(y), std::bit_cast(z), std::bit_cast(w)); } @@ -40,10 +38,9 @@ namespace utils /** * Stream a 128 bits vector from src to dst. */ - static inline - void stream_vector_from_memory(void* dst, void* src) + static inline void stream_vector_from_memory(void* dst, void* src) { const __m128i vector = _mm_loadu_si128(reinterpret_cast<__m128i*>(src)); _mm_stream_si128(reinterpret_cast<__m128i*>(dst), vector); } -} +} // namespace utils diff --git a/rpcs3/rpcs3/Emu/RSX/Common/expected.hpp b/rpcs3/rpcs3/Emu/RSX/Common/expected.hpp index d3da0a402..4f3929db8 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/expected.hpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/expected.hpp @@ -8,7 +8,7 @@ namespace fmt { template - static std::string format(const CharT(&)[N], const Args&...); + static std::string format(const CharT (&)[N], const Args&...); } namespace rsx @@ -50,49 +50,49 @@ namespace rsx } } }; - } + } // namespace exception_utils template - concept ErrorType = requires (E & e) - { + concept ErrorType = requires(E& e) { { e.empty() } -> std::same_as; }; - template - class expected - { - T value; - E error{}; + template + class expected + { + T value; + E error{}; - public: - [[ nodiscard ]] expected(const T& value_) - : value(value_) - {} + public: + [[nodiscard]] expected(const T& value_) + : value(value_) + { + } #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable : 26495) // disable warning for uninitialized value member (performance reasons) #endif - [[ nodiscard ]] expected(const E& error_) - : error(error_) - { - ensure(!error.empty()); - } + [[nodiscard]] expected(const E& error_) + : error(error_) + { + ensure(!error.empty()); + } #ifdef _MSC_VER #pragma warning(pop) #endif - operator T() const - { - ensure(error.empty()); - return value; - } + operator T() const + { + ensure(error.empty()); + return value; + } - T operator *() const - { - ensure(error.empty()); - return value; - } + T operator*() const + { + ensure(error.empty()); + return value; + } operator bool() const requires(!std::is_same_v) @@ -100,15 +100,15 @@ namespace rsx return error.empty(); } - operator std::pair() const - { - return { value, error }; - } + operator std::pair() const + { + return {value, error}; + } - bool operator == (const T& other) const - { - return error.empty() && value == other; - } + bool operator==(const T& other) const + { + return error.empty() && value == other; + } std::string to_string() const { @@ -124,5 +124,5 @@ namespace rsx return fmt::format("%s", error); } - }; -} + }; +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/io_buffer.h b/rpcs3/rpcs3/Emu/RSX/Common/io_buffer.h index 29397d113..c478bb04b 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/io_buffer.h +++ b/rpcs3/rpcs3/Emu/RSX/Common/io_buffer.h @@ -7,8 +7,7 @@ namespace rsx { template - concept SpanLike = requires(T t) - { + concept SpanLike = requires(T t) { { t.data() } -> std::convertible_to; { t.size_bytes() } -> std::convertible_to; }; @@ -43,12 +42,14 @@ namespace rsx template io_buffer(void* ptr, T size) : m_ptr(ptr), m_size(size) - {} + { + } template io_buffer(const void* ptr, T size) : m_ptr(const_cast(ptr)), m_size(size) - {} + { + } void reserve(usz size) const { @@ -57,7 +58,7 @@ namespace rsx std::pair raw() const { - return { m_ptr, m_size }; + return {m_ptr, m_size}; } template @@ -76,11 +77,11 @@ namespace rsx return m_size; } - template + template std::span as_span() const { auto bytes = data(); - return { utils::bless(bytes), m_size / sizeof(T) }; + return {utils::bless(bytes), m_size / sizeof(T)}; } bool empty() const @@ -88,4 +89,4 @@ namespace rsx return m_size == 0; } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/profiling_timer.hpp b/rpcs3/rpcs3/Emu/RSX/Common/profiling_timer.hpp index f5ecacb4e..c95c3a1bf 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/profiling_timer.hpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/profiling_timer.hpp @@ -32,4 +32,4 @@ namespace rsx return static_cast(last - old); } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/ranged_map.hpp b/rpcs3/rpcs3/Emu/RSX/Common/ranged_map.hpp index 8103e3697..94a8ee112 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/ranged_map.hpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/ranged_map.hpp @@ -13,8 +13,8 @@ namespace rsx protected: struct block_metadata_t { - u32 id = umax; // ID of the matadata blob - u32 head_block = umax; // Earliest block that may have an object that intersects with the data at the block with ID 'id' + u32 id = umax; // ID of the matadata blob + u32 head_block = umax; // Earliest block that may have an object that intersects with the data at the block with ID 'id' }; public: @@ -65,7 +65,7 @@ namespace rsx while (m_current < m_end) { m_it = (++m_current)->begin(); - if (m_it != m_current->end()) [[ likely ]] + if (m_it != m_current->end()) [[likely]] { return; } @@ -83,7 +83,7 @@ namespace rsx return; } - if (++m_it != m_current->end()) [[ likely ]] + if (++m_it != m_current->end()) [[likely]] { return; } @@ -120,49 +120,49 @@ namespace rsx forward_scan(); } - iterator(super* parent): - m_data_ptr(parent->m_data.data()), - m_metadata_ptr(parent->m_metadata.data()) - {} + iterator(super* parent) : m_data_ptr(parent->m_data.data()), + m_metadata_ptr(parent->m_metadata.data()) + { + } public: - bool operator == (const iterator& other) const + bool operator==(const iterator& other) const { return m_current == other.m_current && m_it == other.m_it; } - auto* operator -> () + auto* operator->() { ensure(m_current); return m_it.operator->(); } - auto& operator * () + auto& operator*() { ensure(m_current); return m_it.operator*(); } - auto* operator -> () const + auto* operator->() const { ensure(m_current); return m_it.operator->(); } - auto& operator * () const + auto& operator*() const { ensure(m_current); return m_it.operator*(); } - iterator& operator ++ () + iterator& operator++() { ensure(m_current); next(); return *this; } - T& operator ++ (int) + T& operator++(int) { ensure(m_current); auto old = *this; @@ -174,7 +174,10 @@ namespace rsx public: ranged_map() { - std::for_each(m_metadata.begin(), m_metadata.end(), [&](auto& meta) { meta.id = static_cast(&meta - m_metadata.data()); }); + std::for_each(m_metadata.begin(), m_metadata.end(), [&](auto& meta) + { + meta.id = static_cast(&meta - m_metadata.data()); + }); } void emplace(const utils::address_range& range, T&& value) @@ -198,7 +201,7 @@ namespace rsx iterator find(const u32 key) { auto& block = m_data[block_for(key)]; - iterator ret = { this }; + iterator ret = {this}; if (auto found = block.find(key); found != block.end()) @@ -222,14 +225,14 @@ namespace rsx iterator begin_range(const utils::address_range& range) { - iterator ret = { this }; + iterator ret = {this}; ret.begin_range(range); return ret; } iterator end() { - iterator ret = { this }; + iterator ret = {this}; return ret; } @@ -241,4 +244,4 @@ namespace rsx } } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/ring_buffer_helper.h b/rpcs3/rpcs3/Emu/RSX/Common/ring_buffer_helper.h index 46e99d928..6b602ee05 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/ring_buffer_helper.h +++ b/rpcs3/rpcs3/Emu/RSX/Common/ring_buffer_helper.h @@ -15,9 +15,9 @@ class data_heap { protected: /** - * Does alloc cross get position ? - */ - template + * Does alloc cross get position ? + */ + template bool can_alloc(usz size) const { usz alloc_size = utils::align(size, Alignment); @@ -53,12 +53,13 @@ protected: } usz m_size; - usz m_put_pos; // Start of free space - usz m_min_guard_size; //If an allocation touches the guard region, reset the heap to avoid going over budget + usz m_put_pos; // Start of free space + usz m_min_guard_size; // If an allocation touches the guard region, reset the heap to avoid going over budget usz m_current_allocated_size; usz m_largest_allocated_pool; char* m_name; + public: data_heap() = default; ~data_heap() = default; @@ -67,7 +68,7 @@ public: usz m_get_pos; // End of free space - void init(usz heap_size, const char* buffer_name = "unnamed", usz min_guard_size=0x10000) + void init(usz heap_size, const char* buffer_name = "unnamed", usz min_guard_size = 0x10000) { m_name = const_cast(buffer_name); @@ -75,13 +76,13 @@ public: m_put_pos = 0; m_get_pos = heap_size - 1; - //allocation stats + // allocation stats m_min_guard_size = min_guard_size; m_current_allocated_size = 0; m_largest_allocated_pool = 0; } - template + template usz alloc(usz size) { const usz alloc_size = utils::align(size, Alignment); @@ -90,7 +91,7 @@ public: if (!can_alloc(size) && !grow(alloc_size)) { fmt::throw_exception("[%s] Working buffer not big enough, buffer_length=%d allocated=%d requested=%d guard=%d largest_pool=%d", - m_name, m_size, m_current_allocated_size, size, m_min_guard_size, m_largest_allocated_pool); + m_name, m_size, m_current_allocated_size, size, m_min_guard_size, m_largest_allocated_pool); } const usz block_length = (aligned_put_pos - m_put_pos) + alloc_size; @@ -110,8 +111,8 @@ public: } /** - * return current putpos - 1 - */ + * return current putpos - 1 + */ usz get_current_put_pos_minus_one() const { return (m_put_pos > 0) ? m_put_pos - 1 : m_size - 1; diff --git a/rpcs3/rpcs3/Emu/RSX/Common/simple_array.hpp b/rpcs3/rpcs3/Emu/RSX/Common/simple_array.hpp index 0fec53085..a0287558e 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/simple_array.hpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/simple_array.hpp @@ -149,7 +149,7 @@ namespace rsx if (_this_is_local != _that_is_local) { // Mismatched usage of the stack storage. - rsx::simple_array tmp{ *this }; + rsx::simple_array tmp{*this}; *this = that; that = tmp; return; @@ -185,7 +185,8 @@ namespace rsx _capacity = size; } - template requires UnsignedInt + template + requires UnsignedInt void resize(T size) { const auto new_size = static_cast(size); @@ -310,12 +311,12 @@ namespace rsx return _capacity; } - Ty& operator[] (u32 index) + Ty& operator[](u32 index) { return _data[index]; } - const Ty& operator[] (u32 index) const + const Ty& operator[](u32 index) const { return _data[index]; } @@ -416,7 +417,7 @@ namespace rsx } template > - requires (std::is_invocable_v && std::is_trivially_destructible_v) + requires(std::is_invocable_v && std::is_trivially_destructible_v) simple_array map(F&& xform) const { simple_array result; @@ -430,7 +431,7 @@ namespace rsx } template > - requires (std::is_invocable_v && !std::is_trivially_destructible_v) + requires(std::is_invocable_v && !std::is_trivially_destructible_v) std::vector map(F&& xform) const { std::vector result; @@ -455,4 +456,4 @@ namespace rsx return accumulate; } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/surface_cache_dma.hpp b/rpcs3/rpcs3/Emu/RSX/Common/surface_cache_dma.hpp index a4aa58b3e..07491b4ae 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/surface_cache_dma.hpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/surface_cache_dma.hpp @@ -30,11 +30,23 @@ namespace rsx u64 memory_tag = 0; u32 base_address = 0; - inline buffer_object_type get() { return Traits::get(bo); } - inline operator bool () const { return base_address != 0; } + inline buffer_object_type get() + { + return Traits::get(bo); + } + inline operator bool() const + { + return base_address != 0; + } - inline void release() { bo.release(); } - inline void acquire(buffer_object_type b) { bo = b; } + inline void release() + { + bo.release(); + } + inline void acquire(buffer_object_type b) + { + bo = b; + } }; using buffer_block_array = typename std::array; @@ -104,7 +116,7 @@ namespace rsx std::tuple get(u32 address) { const auto& block = m_buffer_list[block_for(address)]; - return { block.get(), block.base_address - address }; + return {block.get(), block.base_address - address}; } void touch(const utils::address_range& range) @@ -116,4 +128,4 @@ namespace rsx } } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/surface_store.cpp b/rpcs3/rpcs3/Emu/RSX/Common/surface_store.cpp index 43f4b4161..a96ca453e 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/surface_store.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/surface_store.cpp @@ -11,12 +11,12 @@ namespace rsx { switch (color_target) { - case surface_target::none: return{}; - case surface_target::surface_a: return{ 0 }; - case surface_target::surface_b: return{ 1 }; - case surface_target::surfaces_a_b: return{ 0, 1 }; - case surface_target::surfaces_a_b_c: return{ 0, 1, 2 }; - case surface_target::surfaces_a_b_c_d: return{ 0, 1, 2, 3 }; + case surface_target::none: return {}; + case surface_target::surface_a: return {0}; + case surface_target::surface_b: return {1}; + case surface_target::surfaces_a_b: return {0, 1}; + case surface_target::surfaces_a_b_c: return {0, 1, 2}; + case surface_target::surfaces_a_b_c_d: return {0, 1, 2, 3}; } fmt::throw_exception("Invalid color target %d", static_cast(color_target)); } @@ -78,5 +78,5 @@ namespace rsx } fmt::throw_exception("Unknown color surface format"); } - } -} \ No newline at end of file + } // namespace utility +} // namespace rsx \ No newline at end of file diff --git a/rpcs3/rpcs3/Emu/RSX/Common/surface_store.h b/rpcs3/rpcs3/Emu/RSX/Common/surface_store.h index 35813965e..867ff1aeb 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/rpcs3/Emu/RSX/Common/surface_store.h @@ -18,14 +18,14 @@ namespace rsx u8 get_mrt_buffers_count(surface_target color_target); usz get_aligned_pitch(surface_color_format format, u32 width); usz get_packed_pitch(surface_color_format format, u32 width); - } + } // namespace utility template struct surface_store { static constexpr u32 get_aa_factor_u(surface_antialiasing aa_mode) { - return (aa_mode == surface_antialiasing::center_1_sample)? 1 : 2; + return (aa_mode == surface_antialiasing::center_1_sample) ? 1 : 2; } static constexpr u32 get_aa_factor_v(surface_antialiasing aa_mode) @@ -89,9 +89,9 @@ namespace rsx void split_surface_region(command_list_type cmd, u32 address, surface_type prev_surface, u16 width, u16 height, u8 bpp, rsx::surface_antialiasing aa) { auto insert_new_surface = [&]( - u32 new_address, - deferred_clipped_region& region, - surface_ranged_map& data) + u32 new_address, + deferred_clipped_region& region, + surface_ranged_map& data) { surface_storage_type sink; surface_type invalidated = 0; @@ -114,7 +114,7 @@ namespace rsx invalidate(found->second); data.erase(new_address); - auto &old = invalidated_resources.back(); + auto& old = invalidated_resources.back(); if (Traits::surface_is_pitch_compatible(old, prev_surface->get_rsx_pitch())) { if (old->last_use_tag >= prev_surface->last_use_tag) [[unlikely]] @@ -156,7 +156,7 @@ namespace rsx } ensure(region.target == Traits::get(sink)); - orphaned_surfaces.push_back({ address, region.target }); + orphaned_surfaces.push_back({address, region.target}); data.emplace(region.target->get_memory_range(), std::move(sink)); }; @@ -245,7 +245,7 @@ namespace rsx void intersect_surface_region(command_list_type cmd, u32 address, surface_type new_surface, surface_type prev_surface) { auto scan_list = [&new_surface, address](const rsx::address_range& mem_range, - surface_ranged_map& data) -> std::vector> + surface_ranged_map& data) -> std::vector> { std::vector> result; for (auto it = data.begin_range(mem_range); it != data.end(); ++it) @@ -263,11 +263,13 @@ namespace rsx // Memory partition check if (mem_range.start >= constants::local_mem_base) { - if (it->first < constants::local_mem_base) continue; + if (it->first < constants::local_mem_base) + continue; } else { - if (it->first >= constants::local_mem_base) continue; + if (it->first >= constants::local_mem_base) + continue; } // Pitch check @@ -283,7 +285,7 @@ namespace rsx continue; } - result.push_back({ it->first, surface }); + result.push_back({it->first, surface}); ensure(it->first == surface->base_addr); } @@ -299,11 +301,11 @@ namespace rsx // Append the previous removed surface to the intersection list if constexpr (is_depth_surface) { - list2.push_back({ address, prev_surface }); + list2.push_back({address, prev_surface}); } else { - list1.push_back({ address, prev_surface }); + list1.push_back({address, prev_surface}); } } else @@ -329,10 +331,11 @@ namespace rsx surface_info = std::move(list1); surface_info.reserve(reserve); - for (const auto& e : list2) surface_info.push_back(e); + for (const auto& e : list2) + surface_info.push_back(e); } - for (const auto &e: surface_info) + for (const auto& e : surface_info) { auto this_address = e.first; auto surface = e.second; @@ -361,7 +364,8 @@ namespace rsx } } - if (ignore) continue; + if (ignore) + continue; this_address = surface->base_addr; ensure(this_address); @@ -390,7 +394,7 @@ namespace rsx } } - template + template surface_type bind_surface_address( command_list_type command_list, u32 address, @@ -494,7 +498,7 @@ namespace rsx // Search invalidated resources for a suitable surface for (auto It = invalidated_resources.begin(); It != invalidated_resources.end(); It++) { - auto &surface = *It; + auto& surface = *It; if (Traits::surface_matches_properties(surface, format, width, height, antialias, true)) { new_surface_storage = std::move(surface); @@ -718,7 +722,7 @@ namespace rsx while (length >= 8) { const u64 value = read_from_ptr(dst_ptr); - const u64 block_mask = ~value; // If the value is not all 1s, set valid to true + const u64 block_mask = ~value; // If the value is not all 1s, set valid to true mask |= block_mask; write_to_ptr(dst_ptr, umax); @@ -829,11 +833,11 @@ namespace rsx protected: /** - * If render target already exists at address, issue state change operation on cmdList. - * Otherwise create one with width, height, clearColor info. - * returns the corresponding render target resource. - */ - template + * If render target already exists at address, issue state change operation on cmdList. + * Otherwise create one with width, height, clearColor info. + * returns the corresponding render target resource. + */ + template surface_type bind_address_as_render_targets( command_list_type command_list, u32 address, @@ -848,7 +852,7 @@ namespace rsx std::forward(extra_params)...); } - template + template surface_type bind_address_as_depth_stencil( command_list_type command_list, u32 address, @@ -898,7 +902,7 @@ namespace rsx } } - return { color_result, depth_result, result_range }; + return {color_result, depth_result, result_range}; } void write_to_dma_buffers( @@ -908,8 +912,8 @@ namespace rsx auto block_range = m_dma_block.to_block_range(range); auto [color_data, depth_stencil_data] = find_overlapping_set(block_range); auto [bo, offset, bo_timestamp] = m_dma_block - .with_range(command_list, block_range) - .get(block_range.start); + .with_range(command_list, block_range) + .get(block_range.start); u64 src_offset, dst_offset, write_length; auto block_length = block_range.length(); @@ -920,9 +924,9 @@ namespace rsx if (all_data.size() > 1) { std::sort(all_data.begin(), all_data.end(), [](const auto& a, const auto& b) - { - return a->last_use_tag < b->last_use_tag; - }); + { + return a->last_use_tag < b->last_use_tag; + }); } for (const auto& surface : all_data) @@ -957,7 +961,7 @@ namespace rsx * Update bound color and depth surface. * Must be called everytime surface format, clip, or addresses changes. */ - template + template void prepare_render_target( command_list_type command_list, surface_color_format color_format, surface_depth_format2 depth_format, @@ -965,8 +969,8 @@ namespace rsx surface_target set_surface_target, surface_antialiasing antialias, surface_raster_type raster_type, - const std::array &surface_addresses, u32 address_z, - const std::array &surface_pitch, u32 zeta_pitch, + const std::array& surface_addresses, u32 address_z, + const std::array& surface_pitch, u32 zeta_pitch, Args&&... extra_params) { u32 clip_width = clip_horizontal_reg; @@ -979,7 +983,7 @@ namespace rsx // Make previous RTTs sampleable for (const auto& i : m_bound_render_target_ids) { - auto &rtt = m_bound_render_targets[i]; + auto& rtt = m_bound_render_targets[i]; Traits::prepare_surface_for_sampling(command_list, std::get<1>(rtt)); rtt = std::make_pair(0, nullptr); } @@ -1097,7 +1101,7 @@ namespace rsx if (surface_internal_pitch > required_pitch) [[unlikely]] { rsx_log.warning("Invalid 2D region descriptor. w=%d, h=%d, bpp=%d, pitch=%d", - required_width, required_height, required_bpp, required_pitch); + required_width, required_height, required_bpp, required_pitch); return {}; } @@ -1217,18 +1221,18 @@ namespace rsx if (result.size() > 1) { - std::sort(result.begin(), result.end(), [](const auto &a, const auto &b) - { - if (a.surface->last_use_tag == b.surface->last_use_tag) + std::sort(result.begin(), result.end(), [](const auto& a, const auto& b) { - const auto area_a = a.dst_area.width * a.dst_area.height; - const auto area_b = b.dst_area.width * b.dst_area.height; + if (a.surface->last_use_tag == b.surface->last_use_tag) + { + const auto area_a = a.dst_area.width * a.dst_area.height; + const auto area_b = b.dst_area.width * b.dst_area.height; - return area_a < area_b; - } + return area_a < area_b; + } - return a.surface->last_use_tag < b.surface->last_use_tag; - }); + return a.surface->last_use_tag < b.surface->last_use_tag; + }); } return result; @@ -1265,7 +1269,7 @@ namespace rsx if (color_mrt_writes_enabled[i]) { auto surface = m_bound_render_targets[i].second; - if (surface->last_use_tag > cache_tag) [[ likely ]] + if (surface->last_use_tag > cache_tag) [[likely]] { surface->on_write_fast(write_tag); } @@ -1279,7 +1283,7 @@ namespace rsx if (auto zsurface = m_bound_depth_stencil.second; zsurface && depth_stencil_writes_enabled) { - if (zsurface->last_use_tag > cache_tag) [[ likely ]] + if (zsurface->last_use_tag > cache_tag) [[likely]] { zsurface->on_write_fast(write_tag); } @@ -1293,7 +1297,7 @@ namespace rsx void invalidate_all() { // Unbind and invalidate all resources - auto free_resource_list = [&](auto &data, const utils::address_range& range) + auto free_resource_list = [&](auto& data, const utils::address_range& range) { for (auto it = data.begin_range(range); it != data.end(); ++it) { @@ -1310,7 +1314,7 @@ namespace rsx m_bound_depth_stencil = std::make_pair(0, nullptr); m_bound_render_target_ids.clear(); - for (auto &rtt : m_bound_render_targets) + for (auto& rtt : m_bound_render_targets) { rtt = std::make_pair(0, nullptr); } @@ -1462,4 +1466,4 @@ namespace rsx } } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/surface_utils.h b/rpcs3/rpcs3/Emu/RSX/Common/surface_utils.h index 05e199378..b4b22fe7e 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/surface_utils.h +++ b/rpcs3/rpcs3/Emu/RSX/Common/surface_utils.h @@ -113,20 +113,20 @@ namespace rsx areai src_rect() const { ensure(width); - return { src_x, src_y, src_x + width, src_y + height }; + return {src_x, src_y, src_x + width, src_y + height}; } areai dst_rect() const { ensure(width); - return { dst_x, dst_y, dst_x + u16(width * transfer_scale_x + 0.5f), dst_y + u16(height * transfer_scale_y + 0.5f) }; + return {dst_x, dst_y, dst_x + u16(width * transfer_scale_x + 0.5f), dst_y + u16(height * transfer_scale_y + 0.5f)}; } }; template struct render_target_descriptor : public rsx::ref_counted { - u64 last_use_tag = 0; // tag indicating when this block was last confirmed to have been written to + u64 last_use_tag = 0; // tag indicating when this block was last confirmed to have been written to u32 base_addr = 0; #if (ENABLE_SURFACE_CACHE_DEBUG) @@ -142,9 +142,9 @@ namespace rsx u32 native_pitch = 0; u16 surface_width = 0; u16 surface_height = 0; - u8 spp = 1; - u8 samples_x = 1; - u8 samples_y = 1; + u8 spp = 1; + u8 samples_x = 1; + u8 samples_y = 1; rsx::address_range memory_range; @@ -161,15 +161,13 @@ namespace rsx { rsx::surface_color_format gcm_color_format; rsx::surface_depth_format2 gcm_depth_format; - } - format_info; + } format_info; struct { u64 timestamp = 0; bool locked = false; - } - texture_cache_metadata; + } texture_cache_metadata; render_target_descriptor() {} @@ -190,7 +188,7 @@ namespace rsx texture_cache_metadata = {}; } - template + template T get_surface_width() const { if constexpr (Metrics == rsx::surface_metrics::samples) @@ -211,7 +209,7 @@ namespace rsx } } - template + template T get_surface_height() const { if constexpr (Metrics == rsx::surface_metrics::samples) @@ -256,20 +254,20 @@ namespace rsx { switch (aa) { - case rsx::surface_antialiasing::center_1_sample: - samples_x = samples_y = spp = 1; - break; - case rsx::surface_antialiasing::diagonal_centered_2_samples: - samples_x = spp = 2; - samples_y = 1; - break; - case rsx::surface_antialiasing::square_centered_4_samples: - case rsx::surface_antialiasing::square_rotated_4_samples: - samples_x = samples_y = 2; - spp = 4; - break; - default: - fmt::throw_exception("Unknown AA mode 0x%x", static_cast(aa)); + case rsx::surface_antialiasing::center_1_sample: + samples_x = samples_y = spp = 1; + break; + case rsx::surface_antialiasing::diagonal_centered_2_samples: + samples_x = spp = 2; + samples_y = 1; + break; + case rsx::surface_antialiasing::square_centered_4_samples: + case rsx::surface_antialiasing::square_rotated_4_samples: + samples_x = samples_y = 2; + spp = 4; + break; + default: + fmt::throw_exception("Unknown AA mode 0x%x", static_cast(aa)); } } @@ -315,12 +313,10 @@ namespace rsx inline u32 get_gcm_format() const { - return - ( + return ( is_depth_surface() ? get_compatible_gcm_format(format_info.gcm_depth_format).first : - get_compatible_gcm_format(format_info.gcm_color_format).first - ); + get_compatible_gcm_format(format_info.gcm_color_format).first); } inline bool dirty() const @@ -396,20 +392,20 @@ namespace rsx base_addr = address; - const u32 size_x = (native_pitch > 8)? (native_pitch - 8) : 0u; + const u32 size_x = (native_pitch > 8) ? (native_pitch - 8) : 0u; const u32 size_y = u32(surface_height * samples_y) - 1u; const position2u samples[] = - { - // NOTE: Sorted by probability to catch dirty flag - {0, 0}, - {size_x, size_y}, - {size_x / 2, size_y / 2}, + { + // NOTE: Sorted by probability to catch dirty flag + {0, 0}, + {size_x, size_y}, + {size_x / 2, size_y / 2}, - // Auxilliary, highly unlikely to ever catch anything - // NOTE: Currently unused as length of samples is truncated to 3 - {size_x, 0}, - {0, size_y}, - }; + // Auxilliary, highly unlikely to ever catch anything + // NOTE: Currently unused as length of samples is truncated to 3 + {size_x, 0}, + {0, size_y}, + }; for (uint n = 0; n < memory_tag_samples.size(); ++n) { @@ -424,7 +420,7 @@ namespace rsx void sync_tag() { - for (auto &e : memory_tag_samples) + for (auto& e : memory_tag_samples) { e.second = *reinterpret_cast*>(vm::g_sudo_addr + e.first); } @@ -456,7 +452,7 @@ namespace rsx void clear_rw_barrier() { - for (auto &e : old_contents) + for (auto& e : old_contents) { ensure(dynamic_cast(e.source))->release(); } @@ -465,18 +461,18 @@ namespace rsx } template - u32 prepare_rw_barrier_for_transfer(T *target) + u32 prepare_rw_barrier_for_transfer(T* target) { if (old_contents.size() <= 1) return 0; // Sort here before doing transfers since surfaces may have been updated in the meantime - std::sort(old_contents.begin(), old_contents.end(), [](const auto& a, const auto &b) - { - const auto _a = static_cast(a.source); - const auto _b = static_cast(b.source); - return (_a->last_use_tag < _b->last_use_tag); - }); + std::sort(old_contents.begin(), old_contents.end(), [](const auto& a, const auto& b) + { + const auto _a = static_cast(a.source); + const auto _b = static_cast(b.source); + return (_a->last_use_tag < _b->last_use_tag); + }); // Try and optimize by omitting possible overlapped transfers for (usz i = old_contents.size() - 1; i > 0 /* Intentional */; i--) @@ -495,7 +491,7 @@ namespace rsx return 0; } - template + template void set_old_contents(T* other) { ensure(old_contents.empty()); @@ -510,7 +506,7 @@ namespace rsx other->add_ref(); } - template + template void set_old_contents_region(const T& region, bool normalized) { // NOTE: This method will not perform pitch verification! @@ -518,7 +514,7 @@ namespace rsx ensure(region.source != static_cast(this)); old_contents.push_back(region.template cast()); - auto &slice = old_contents.back(); + auto& slice = old_contents.back(); region.source->add_ref(); // Reverse normalization process if needed @@ -589,8 +585,8 @@ namespace rsx set_old_contents_region(region, true); return (region.width == parent_w && region.height == parent_h) ? - surface_inheritance_result::full : - surface_inheritance_result::partial; + surface_inheritance_result::full : + surface_inheritance_result::partial; } void on_write(u64 write_tag = 0, @@ -655,7 +651,7 @@ namespace rsx const u16 internal_width = get_surface_width(); const u16 internal_height = get_surface_height(); - return { 0, 0, internal_width, internal_height }; + return {0, 0, internal_width, internal_height}; } inline rsx::address_range get_memory_range() const @@ -666,7 +662,8 @@ namespace rsx template void transform_samples_to_pixels(area_base& area) { - if (spp == 1) [[likely]] return; + if (spp == 1) [[likely]] + return; area.x1 /= samples_x; area.x2 /= samples_x; @@ -677,7 +674,8 @@ namespace rsx template void transform_pixels_to_samples(area_base& area) { - if (spp == 1) [[likely]] return; + if (spp == 1) [[likely]] + return; area.x1 *= samples_x; area.x2 *= samples_x; @@ -688,7 +686,8 @@ namespace rsx template void transform_samples_to_pixels(T& x1, T& x2, T& y1, T& y2) { - if (spp == 1) [[likely]] return; + if (spp == 1) [[likely]] + return; x1 /= samples_x; x2 /= samples_x; @@ -699,7 +698,8 @@ namespace rsx template void transform_pixels_to_samples(T& x1, T& x2, T& y1, T& y2) { - if (spp == 1) [[likely]] return; + if (spp == 1) [[likely]] + return; x1 *= samples_x; x2 *= samples_x; @@ -707,7 +707,7 @@ namespace rsx y2 *= samples_y; } - template + template void transform_blit_coordinates(rsx::surface_access access_type, area_base& region) { if (spp == 1 || sample_layout == rsx::surface_sample_layout::ps3) @@ -765,7 +765,7 @@ namespace rsx rsx_pitch = ref->get_rsx_pitch(); last_use_tag = ref->last_use_tag; - raster_type = ref->raster_type; // Can't actually cut up swizzled data + raster_type = ref->raster_type; // Can't actually cut up swizzled data } bool is_locked() const @@ -780,4 +780,4 @@ namespace rsx return (texture_cache_metadata.timestamp < last_use_tag); } }; -} \ No newline at end of file +} // namespace rsx \ No newline at end of file diff --git a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache.cpp b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache.cpp index d1cdd25a3..0a1ce43ed 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache.cpp @@ -47,7 +47,8 @@ namespace rsx void buffered_section::protect(utils::protection new_prot, bool force) { - if (new_prot == protection && !force) return; + if (new_prot == protection && !force) + return; ensure(locked_range.is_page_range()); AUDIT(!confirmed_range.valid() || confirmed_range.inside(cpu_range)); @@ -215,4 +216,4 @@ namespace rsx return (fast_hash_internal() == mem_hash); } -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache.h index a5ed28353..68efbafd8 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache.h @@ -21,16 +21,16 @@ namespace rsx public: using traits = _traits; - using commandbuffer_type = typename traits::commandbuffer_type; + using commandbuffer_type = typename traits::commandbuffer_type; using section_storage_type = typename traits::section_storage_type; - using image_resource_type = typename traits::image_resource_type; - using image_view_type = typename traits::image_view_type; - using image_storage_type = typename traits::image_storage_type; - using texture_format = typename traits::texture_format; - using viewable_image_type = typename traits::viewable_image_type; + using image_resource_type = typename traits::image_resource_type; + using image_view_type = typename traits::image_view_type; + using image_storage_type = typename traits::image_storage_type; + using texture_format = typename traits::texture_format; + using viewable_image_type = typename traits::viewable_image_type; - using predictor_type = texture_cache_predictor; - using ranged_storage = rsx::ranged_storage; + using predictor_type = texture_cache_predictor; + using ranged_storage = rsx::ranged_storage; using ranged_storage_block = typename ranged_storage::block_type; using copy_region_descriptor = copy_region_descriptor_base; @@ -50,18 +50,18 @@ namespace rsx }; public: - //Struct to hold data on sections to be paged back onto cpu memory + // Struct to hold data on sections to be paged back onto cpu memory struct thrashed_set { bool violation_handled = false; bool flushed = false; bool invalidate_samplers = false; invalidation_cause cause; - std::vector sections_to_flush; // Sections to be flushed + std::vector sections_to_flush; // Sections to be flushed std::vector sections_to_unprotect; // These sections are to be unpotected and discarded by caller - std::vector sections_to_exclude; // These sections are do be excluded from protection manipulation (subtracted from other sections) + std::vector sections_to_exclude; // These sections are do be excluded from protection manipulation (subtracted from other sections) u32 num_flushable = 0; - u32 num_excluded = 0; // Sections-to-exclude + sections that would have been excluded but are false positives + u32 num_excluded = 0; // Sections-to-exclude + sections that would have been excluded but are false positives u32 num_discarded = 0; u64 cache_tag = 0; @@ -98,7 +98,7 @@ namespace rsx if (flush_and_unprotect_count == 0 && exclude_count > 0) { // double-check that only RO sections exists - for (auto *tex : sections_to_exclude) + for (auto* tex : sections_to_exclude) ensure(tex->get_protection() == utils::protection::ro); } @@ -158,11 +158,7 @@ namespace rsx deferred_subresource(image_resource_type _res, deferred_request_command _op, const image_section_attributes_t& attr, position2u offset, texture_channel_remap_t _remap) - : external_handle(_res) - , remap(std::move(_remap)) - , op(_op) - , x(offset.x) - , y(offset.y) + : external_handle(_res), remap(std::move(_remap)), op(_op), x(offset.x), y(offset.y) { static_cast(*this) = attr; } @@ -222,7 +218,7 @@ namespace rsx texture_upload_context ctx, rsx::format_class ftype, size3f scale, rsx::texture_dimension_extended type, const texture_channel_remap_t& remap) { - external_subresource_desc = { external_handle, reason, attr, src_offset, remap }; + external_subresource_desc = {external_handle, reason, attr, src_offset, remap}; image_handle = 0; upload_context = ctx; @@ -241,7 +237,7 @@ namespace rsx inline bool section_fills_target(const copy_region_descriptor& cpy) const { return cpy.dst_x == 0 && cpy.dst_y == 0 && - cpy.dst_w == external_subresource_desc.width && cpy.dst_h == external_subresource_desc.height; + cpy.dst_w == external_subresource_desc.width && cpy.dst_h == external_subresource_desc.height; } inline bool section_is_transfer_only(const copy_region_descriptor& cpy) const @@ -269,8 +265,7 @@ namespace rsx std::memcpy( sections.data(), §ions[idx], - remaining * sizeof(sections[0]) - ); + remaining * sizeof(sections[0])); sections.resize(remaining); break; } @@ -394,7 +389,7 @@ namespace rsx // Normally the global samplers dirty flag should have been set to invalidate all references. ensure(external_subresource_desc.op == deferred_request_command::nop); rsx_log.warning("Renderer is holding a stale reference to a surface that no longer exists!"); - return { true, nullptr }; + return {true, nullptr}; } } @@ -419,20 +414,18 @@ namespace rsx case deferred_request_command::copy_image_dynamic: case deferred_request_command::copy_image_static: external_subresource_desc.op = (is_cyclic_reference) ? deferred_request_command::copy_image_dynamic : deferred_request_command::copy_image_static; - [[ fallthrough ]]; + [[fallthrough]]; default: - return { false, surface }; + return {false, surface}; } } // Reupload - return { true, nullptr }; + return {true, nullptr}; } }; - protected: - /** * Variable declarations */ @@ -448,35 +441,32 @@ namespace rsx address_range read_only_range; address_range no_access_range; - //Map of messages to only emit once + // Map of messages to only emit once std::unordered_set m_once_only_messages_set; - //Set when a shader read-only texture data suddenly becomes contested, usually by fbo memory + // Set when a shader read-only texture data suddenly becomes contested, usually by fbo memory bool read_only_tex_invalidate = false; - //Store of all objects in a flush_always state. A lazy readback is attempted every draw call + // Store of all objects in a flush_always state. A lazy readback is attempted every draw call std::unordered_map m_flush_always_cache; u64 m_flush_always_update_timestamp = 0; - //Memory usage - const u32 m_max_zombie_objects = 64; //Limit on how many texture objects to keep around for reuse after they are invalidated + // Memory usage + const u32 m_max_zombie_objects = 64; // Limit on how many texture objects to keep around for reuse after they are invalidated - //Other statistics - atomic_t m_flushes_this_frame = { 0 }; - atomic_t m_misses_this_frame = { 0 }; - atomic_t m_speculations_this_frame = { 0 }; - atomic_t m_unavoidable_hard_faults_this_frame = { 0 }; - atomic_t m_texture_upload_calls_this_frame = { 0 }; - atomic_t m_texture_upload_misses_this_frame = { 0 }; - atomic_t m_texture_copies_ellided_this_frame = { 0 }; + // Other statistics + atomic_t m_flushes_this_frame = {0}; + atomic_t m_misses_this_frame = {0}; + atomic_t m_speculations_this_frame = {0}; + atomic_t m_unavoidable_hard_faults_this_frame = {0}; + atomic_t m_texture_upload_calls_this_frame = {0}; + atomic_t m_texture_upload_misses_this_frame = {0}; + atomic_t m_texture_copies_ellided_this_frame = {0}; static const u32 m_predict_max_flushes_per_frame = 50; // Above this number the predictions are disabled // Invalidation static const bool invalidation_ignore_unsynchronized = true; // If true, unsynchronized sections don't get forcefully flushed unless they overlap the fault range - static const bool invalidation_keep_ro_during_read = true; // If true, RO sections are not invalidated during read faults - - - + static const bool invalidation_keep_ro_during_read = true; // If true, RO sections are not invalidated during read faults /** * Virtual Methods @@ -484,11 +474,11 @@ namespace rsx virtual image_view_type create_temporary_subresource_view(commandbuffer_type&, image_resource_type* src, u32 gcm_format, u16 x, u16 y, u16 w, u16 h, const texture_channel_remap_t& remap_vector) = 0; virtual image_view_type create_temporary_subresource_view(commandbuffer_type&, image_storage_type* src, u32 gcm_format, u16 x, u16 y, u16 w, u16 h, const texture_channel_remap_t& remap_vector) = 0; virtual void release_temporary_subresource(image_view_type rsc) = 0; - virtual section_storage_type* create_new_texture(commandbuffer_type&, const address_range &rsx_range, u16 width, u16 height, u16 depth, u16 mipmaps, u32 pitch, u32 gcm_format, + virtual section_storage_type* create_new_texture(commandbuffer_type&, const address_range& rsx_range, u16 width, u16 height, u16 depth, u16 mipmaps, u32 pitch, u32 gcm_format, rsx::texture_upload_context context, rsx::texture_dimension_extended type, bool swizzled, component_order swizzle_flags, rsx::flags32_t flags) = 0; - virtual section_storage_type* upload_image_from_cpu(commandbuffer_type&, const address_range &rsx_range, u16 width, u16 height, u16 depth, u16 mipmaps, u32 pitch, u32 gcm_format, texture_upload_context context, + virtual section_storage_type* upload_image_from_cpu(commandbuffer_type&, const address_range& rsx_range, u16 width, u16 height, u16 depth, u16 mipmaps, u32 pitch, u32 gcm_format, texture_upload_context context, const std::vector& subresource_layout, rsx::texture_dimension_extended type, bool swizzled) = 0; - virtual section_storage_type* create_nul_section(commandbuffer_type&, const address_range &rsx_range, const image_section_attributes_t& attrs, const GCM_tile_reference& tile, bool memory_load) = 0; + virtual section_storage_type* create_nul_section(commandbuffer_type&, const address_range& rsx_range, const image_section_attributes_t& attrs, const GCM_tile_reference& tile, bool memory_load) = 0; virtual void set_component_order(section_storage_type& section, u32 gcm_format, component_order expected) = 0; virtual void insert_texture_barrier(commandbuffer_type&, image_storage_type* tex, bool strong_ordering = true) = 0; virtual image_view_type generate_cubemap_from_images(commandbuffer_type&, u32 gcm_format, u16 size, const std::vector& sources, const texture_channel_remap_t& remap_vector) = 0; @@ -504,8 +494,8 @@ namespace rsx virtual void destroy() = 0; virtual bool is_depth_texture(u32, u32) = 0; virtual void on_section_destroyed(section_storage_type& /*section*/) - {} - + { + } protected: /** @@ -517,7 +507,7 @@ namespace rsx } template - void emit_once(bool error, const CharT(&fmt)[N], const Args&... params) + void emit_once(bool error, const CharT (&fmt)[N], const Args&... params) { const auto result = m_once_only_messages_set.emplace(fmt::format(fmt, params...)); if (!result.second) @@ -530,13 +520,13 @@ namespace rsx } template - void err_once(const CharT(&fmt)[N], const Args&... params) + void err_once(const CharT (&fmt)[N], const Args&... params) { emit_once(true, fmt, params...); } template - void warn_once(const CharT(&fmt)[N], const Args&... params) + void warn_once(const CharT (&fmt)[N], const Args&... params) { emit_once(false, fmt, params...); } @@ -545,7 +535,7 @@ namespace rsx * Internal implementation methods and helpers */ - inline bool region_intersects_cache(const address_range &test_range, bool is_writing) + inline bool region_intersects_cache(const address_range& test_range, bool is_writing) { AUDIT(test_range.valid()); @@ -559,7 +549,7 @@ namespace rsx { if (!read_only_range.valid() || !test_range.overlaps(read_only_range)) { - //Doesnt fall in the read_only textures range; check render targets + // Doesnt fall in the read_only textures range; check render targets if (!no_access_range.valid() || !test_range.overlaps(no_access_range)) return false; } @@ -578,7 +568,7 @@ namespace rsx * Section invalidation */ private: - template + template void flush_set(commandbuffer_type& cmd, thrashed_set& data, std::function on_data_transfer_completed, Args&&... extras) { AUDIT(!data.flushed); @@ -591,7 +581,7 @@ namespace rsx } rsx::simple_array sections_to_transfer; - for (auto &surface : data.sections_to_flush) + for (auto& surface : data.sections_to_flush) { if (!surface->is_synchronized()) { @@ -613,7 +603,7 @@ namespace rsx // Batch all hard faults together prepare_for_dma_transfers(cmd); - for (auto &surface : sections_to_transfer) + for (auto& surface : sections_to_transfer) { surface->copy_texture(cmd, true, std::forward(extras)...); } @@ -626,13 +616,13 @@ namespace rsx on_data_transfer_completed(); } - for (auto &surface : data.sections_to_flush) + for (auto& surface : data.sections_to_flush) { surface->flush(); // Exclude this region when flushing other sections that should not trample it // If we overlap an excluded RO, set it as dirty - for (auto &other : data.sections_to_exclude) + for (auto& other : data.sections_to_exclude) { AUDIT(other != surface); if (!other->is_flushable()) @@ -644,7 +634,7 @@ namespace rsx other->set_dirty(true); } } - else if(surface->last_write_tag > other->last_write_tag) + else if (surface->last_write_tag > other->last_write_tag) { other->add_flush_exclusion(surface->get_confirmed_range()); } @@ -683,17 +673,16 @@ namespace rsx update_cache_tag(); } - // Merges the protected ranges of the sections in "sections" into "result" - void merge_protected_ranges(address_range_vector &result, const std::vector §ions) + void merge_protected_ranges(address_range_vector& result, const std::vector& sections) { result.reserve(result.size() + sections.size()); // Copy ranges to result, merging them if possible - for (const auto §ion : sections) + for (const auto& section : sections) { ensure(section->is_locked(true)); - const auto &new_range = section->get_locked_range(); + const auto& new_range = section->get_locked_range(); AUDIT(new_range.is_page_range()); result.merge(new_range); @@ -706,16 +695,16 @@ namespace rsx { auto protect_ranges = [](address_range_vector& _set, utils::protection _prot) { - //u32 count = 0; - for (auto &range : _set) + // u32 count = 0; + for (auto& range : _set) { if (range.valid()) { rsx::memory_protect(range, _prot); - //count++; + // count++; } } - //rsx_log.error("Set protection of %d blocks to 0x%x", count, static_cast(prot)); + // rsx_log.error("Set protection of %d blocks to 0x%x", count, static_cast(prot)); }; auto discard_set = [](std::vector& _set) @@ -748,7 +737,7 @@ namespace rsx ranges_to_protect_ro.reserve(data.sections_to_exclude.size()); u32 no_access_count = 0; - for (const auto &excluded : data.sections_to_exclude) + for (const auto& excluded : data.sections_to_exclude) { ensure(excluded->is_locked(true)); address_range exclusion_range = excluded->get_locked_range(); @@ -783,7 +772,7 @@ namespace rsx // Exclude NA ranges from ranges_to_reprotect_ro if (no_access_count > 0 && !ranges_to_protect_ro.empty()) { - for (auto &exclusion : data.sections_to_exclude) + for (auto& exclusion : data.sections_to_exclude) { if (exclusion->get_protection() != utils::protection::ro) { @@ -824,14 +813,14 @@ namespace rsx // Return a set containing all sections that should be flushed/unprotected/reprotected atomic_t m_last_section_cache_tag = 0; - intersecting_set get_intersecting_set(const address_range &fault_range) + intersecting_set get_intersecting_set(const address_range& fault_range) { AUDIT(fault_range.is_page_range()); const u64 cache_tag = ++m_last_section_cache_tag; intersecting_set result = {}; - address_range &invalidate_range = result.invalidate_range; + address_range& invalidate_range = result.invalidate_range; invalidate_range = fault_range; // Sections fully inside this range will be invalidated, others will be deemed false positives // Loop through cache and find pages that overlap the invalidate_range @@ -847,12 +836,12 @@ namespace rsx if (!repeat_loop && base > last_dirty_block) // note: blocks are iterated in order from lowest to highest base address break; - auto &tex = *It; + auto& tex = *It; - AUDIT(tex.is_locked()); // we should be iterating locked sections only, but just to make sure... + AUDIT(tex.is_locked()); // we should be iterating locked sections only, but just to make sure... AUDIT(tex.cache_tag != cache_tag || last_dirty_block != umax); // cache tag should not match during the first loop - if (tex.cache_tag != cache_tag) //flushable sections can be 'clean' but unlocked. TODO: Handle this better + if (tex.cache_tag != cache_tag) // flushable sections can be 'clean' but unlocked. TODO: Handle this better { const rsx::section_bounds bounds = tex.get_overlap_test_bounds(); @@ -871,7 +860,7 @@ namespace rsx It.set_end(new_range.end); invalidate_range = new_range; - repeat_loop = true; // we will need to repeat the loop again + repeat_loop = true; // we will need to repeat the loop again last_dirty_block = base; // stop the repeat loop once we finish this block } @@ -901,26 +890,26 @@ namespace rsx #ifdef TEXTURE_CACHE_DEBUG // naive check that sections are not duplicated in the results - for (auto §ion1 : result.sections) + for (auto& section1 : result.sections) { usz count = 0; - for (auto §ion2 : result.sections) + for (auto& section2 : result.sections) { - if (section1 == section2) count++; + if (section1 == section2) + count++; } ensure(count == 1); } -#endif //TEXTURE_CACHE_DEBUG +#endif // TEXTURE_CACHE_DEBUG return result; } - - //Invalidate range base implementation - template + // Invalidate range base implementation + template thrashed_set invalidate_range_impl_base( commandbuffer_type& cmd, - const address_range &fault_range_in, + const address_range& fault_range_in, invalidation_cause cause, std::function on_data_transfer_completed = {}, Args&&... extras) @@ -962,9 +951,9 @@ namespace rsx ensure(cause != invalidation_cause::committed_as_fbo); // We discard all sections fully inside fault_range - for (auto &obj : trampled_set.sections) + for (auto& obj : trampled_set.sections) { - auto &tex = *obj; + auto& tex = *obj; if (tex.overlaps(fault_range, section_bounds::locked_range)) { if (cause == invalidation_cause::superseded_by_fbo && @@ -1020,13 +1009,12 @@ namespace rsx AUDIT(fault_range.inside(invalidate_range)); } - // Decide which sections to flush, unprotect, and exclude update_cache_tag(); - for (auto &obj : trampled_set.sections) + for (auto& obj : trampled_set.sections) { - auto &tex = *obj; + auto& tex = *obj; if (!tex.is_locked()) continue; @@ -1042,9 +1030,8 @@ namespace rsx // Unsynchronized sections (or any flushable when skipping flushes) that do not overlap the fault range directly can also be ignored (invalidation_ignore_unsynchronized && tex.is_flushable() && (cause.skip_flush() || !tex.is_synchronized()) && !overlaps_fault_range) || // HACK: When being superseded by an fbo, we preserve other overlapped flushables unless the start addresses match - // If region is committed as fbo, all non-flushable data is removed but all flushables in the region must be preserved if possible - (overlaps_fault_range && tex.is_flushable() && cause.skip_fbos() && tex.get_section_base() != fault_range_in.start) - ) + // If region is committed as fbo, all non-flushable data is removed but all flushables in the region must be preserved if possible + (overlaps_fault_range && tex.is_flushable() && cause.skip_fbos() && tex.get_section_base() != fault_range_in.start)) { // False positive if (tex.is_locked(true)) @@ -1159,7 +1146,6 @@ namespace rsx } public: - texture_cache() : m_storage(this), m_predictor(this) {} ~texture_cache() = default; @@ -1187,13 +1173,13 @@ namespace rsx } template - std::vector find_texture_from_range(const address_range &test_range, u32 required_pitch = 0, u32 context_mask = 0xFF) + std::vector find_texture_from_range(const address_range& test_range, u32 required_pitch = 0, u32 context_mask = 0xFF) { std::vector results; for (auto It = m_storage.range_begin(test_range, full_range, check_unlocked); It != m_storage.range_end(); It++) { - auto &tex = *It; + auto& tex = *It; if (!tex.is_dirty() && (context_mask & static_cast(tex.get_context()))) { @@ -1215,10 +1201,10 @@ namespace rsx } template - section_storage_type *find_texture_from_dimensions(u32 rsx_address, u32 format, u16 width = 0, u16 height = 0, u16 depth = 0, u16 mipmaps = 0) + section_storage_type* find_texture_from_dimensions(u32 rsx_address, u32 format, u16 width = 0, u16 height = 0, u16 depth = 0, u16 mipmaps = 0) { - auto &block = m_storage.block_for(rsx_address); - for (auto &tex : block) + auto& block = m_storage.block_for(rsx_address); + for (auto& tex : block) { if constexpr (check_unlocked) { @@ -1239,19 +1225,19 @@ namespace rsx return nullptr; } - section_storage_type* find_cached_texture(const address_range &range, const image_section_attributes_t& attr, bool create_if_not_found, bool confirm_dimensions, bool allow_dirty) + section_storage_type* find_cached_texture(const address_range& range, const image_section_attributes_t& attr, bool create_if_not_found, bool confirm_dimensions, bool allow_dirty) { - auto &block = m_storage.block_for(range); + auto& block = m_storage.block_for(range); - section_storage_type *dimensions_mismatch = nullptr; - section_storage_type *best_fit = nullptr; - section_storage_type *reuse = nullptr; + section_storage_type* dimensions_mismatch = nullptr; + section_storage_type* best_fit = nullptr; + section_storage_type* reuse = nullptr; #ifdef TEXTURE_CACHE_DEBUG - section_storage_type *res = nullptr; + section_storage_type* res = nullptr; #endif // Try to find match in block - for (auto &tex : block) + for (auto& tex : block) { if (tex.matches(range)) { @@ -1293,7 +1279,7 @@ namespace rsx if (dimensions_mismatch != nullptr) { - auto &tex = *dimensions_mismatch; + auto& tex = *dimensions_mismatch; rsx_log.warning("Cached object for address 0x%X was found, but it does not match stored parameters (width=%d vs %d; height=%d vs %d; depth=%d vs %d; mipmaps=%d vs %d)", range.start, attr.width, tex.get_width(), attr.height, tex.get_height(), attr.depth, tex.get_depth(), attr.mipmaps, tex.get_mipmaps()); } @@ -1329,13 +1315,15 @@ namespace rsx return tex; } - section_storage_type* find_flushable_section(const address_range &memory_range) + section_storage_type* find_flushable_section(const address_range& memory_range) { - auto &block = m_storage.block_for(memory_range); - for (auto &tex : block) + auto& block = m_storage.block_for(memory_range); + for (auto& tex : block) { - if (tex.is_dirty()) continue; - if (!tex.is_flushable() && !tex.is_flushed()) continue; + if (tex.is_dirty()) + continue; + if (!tex.is_flushable() && !tex.is_flushed()) + continue; if (tex.matches(memory_range)) return &tex; @@ -1344,22 +1332,22 @@ namespace rsx return nullptr; } - template - void lock_memory_region(commandbuffer_type& cmd, image_storage_type* image, const address_range &rsx_range, bool is_active_surface, u16 width, u16 height, u32 pitch, Args&&... extras) + template + void lock_memory_region(commandbuffer_type& cmd, image_storage_type* image, const address_range& rsx_range, bool is_active_surface, u16 width, u16 height, u32 pitch, Args&&... extras) { AUDIT(g_cfg.video.write_color_buffers || g_cfg.video.write_depth_buffer); // this method is only called when either WCB or WDB are enabled std::lock_guard lock(m_cache_mutex); // Find a cached section to use - image_section_attributes_t search_desc = { .gcm_format = RSX_GCM_FORMAT_IGNORED, .width = width, .height = height }; + image_section_attributes_t search_desc = {.gcm_format = RSX_GCM_FORMAT_IGNORED, .width = width, .height = height}; section_storage_type& region = *find_cached_texture(rsx_range, search_desc, true, true, false); // Prepare and initialize fbo region if (region.exists() && region.get_context() != texture_upload_context::framebuffer_storage) { - //This space was being used for other purposes other than framebuffer storage - //Delete used resources before attaching it to framebuffer memory + // This space was being used for other purposes other than framebuffer storage + // Delete used resources before attaching it to framebuffer memory read_only_tex_invalidate = true; } @@ -1386,7 +1374,7 @@ namespace rsx } region.create(width, height, 1, 1, image, pitch, false, std::forward(extras)...); - region.reprotect(utils::protection::no, { 0, rsx_range.length() }); + region.reprotect(utils::protection::no, {0, rsx_range.length()}); region.set_dirty(false); region.touch(m_cache_update_tag); @@ -1413,8 +1401,8 @@ namespace rsx #endif // TEXTURE_CACHE_DEBUG } - template - void commit_framebuffer_memory_region(commandbuffer_type& cmd, const address_range &rsx_range, Args&&... extras) + template + void commit_framebuffer_memory_region(commandbuffer_type& cmd, const address_range& rsx_range, Args&&... extras) { AUDIT(!g_cfg.video.write_color_buffers || !g_cfg.video.write_depth_buffer); @@ -1425,12 +1413,12 @@ namespace rsx invalidate_range_impl_base(cmd, rsx_range, invalidation_cause::committed_as_fbo, {}, std::forward(extras)...); } - template + template void discard_framebuffer_memory_region(commandbuffer_type& /*cmd*/, const address_range& rsx_range, Args&&... /*extras*/) { if (g_cfg.video.write_color_buffers || g_cfg.video.write_depth_buffer) { - auto* region_ptr = find_cached_texture(rsx_range, { .gcm_format = RSX_GCM_FORMAT_IGNORED }, false, false, false); + auto* region_ptr = find_cached_texture(rsx_range, {.gcm_format = RSX_GCM_FORMAT_IGNORED}, false, false, false); if (region_ptr && region_ptr->is_locked() && region_ptr->get_context() == texture_upload_context::framebuffer_storage) { ensure(region_ptr->get_protection() == utils::protection::no); @@ -1439,11 +1427,11 @@ namespace rsx } } - void set_memory_read_flags(const address_range &memory_range, memory_read_flags flags) + void set_memory_read_flags(const address_range& memory_range, memory_read_flags flags) { std::lock_guard lock(m_cache_mutex); - auto* region_ptr = find_cached_texture(memory_range, { .gcm_format = RSX_GCM_FORMAT_IGNORED }, false, false, true); + auto* region_ptr = find_cached_texture(memory_range, {.gcm_format = RSX_GCM_FORMAT_IGNORED}, false, false, true); if (region_ptr == nullptr) { AUDIT(m_flush_always_cache.find(memory_range) == m_flush_always_cache.end()); @@ -1477,10 +1465,10 @@ namespace rsx region.set_memory_read_flags(flags, false); } - virtual void on_memory_read_flags_changed(section_storage_type §ion, rsx::memory_read_flags flags) + virtual void on_memory_read_flags_changed(section_storage_type& section, rsx::memory_read_flags flags) { #ifdef TEXTURE_CACHE_DEBUG - const auto &memory_range = section.get_section_range(); + const auto& memory_range = section.get_section_range(); if (flags == memory_read_flags::flush_once) ensure(m_flush_always_cache[memory_range] == §ion); else @@ -1490,7 +1478,7 @@ namespace rsx } private: - inline void update_flush_always_cache(section_storage_type §ion, bool add) + inline void update_flush_always_cache(section_storage_type& section, bool add) { const address_range& range = section.get_section_range(); if (add) @@ -1508,8 +1496,7 @@ namespace rsx } public: - - template + template thrashed_set invalidate_address( commandbuffer_type& cmd, u32 address, @@ -1520,16 +1507,16 @@ namespace rsx // Test before trying to acquire the lock const auto range = page_for(address); if (!region_intersects_cache(range, !cause.is_read())) - return{}; + return {}; std::lock_guard lock(m_cache_mutex); return invalidate_range_impl_base(cmd, range, cause, on_data_transfer_completed, std::forward(extras)...); } - template + template thrashed_set invalidate_range( commandbuffer_type& cmd, - const address_range &range, + const address_range& range, invalidation_cause cause, std::function on_data_transfer_completed = {}, Args&&... extras) @@ -1542,7 +1529,7 @@ namespace rsx return invalidate_range_impl_base(cmd, range, cause, on_data_transfer_completed, std::forward(extras)...); } - template + template bool flush_all(commandbuffer_type& cmd, thrashed_set& data, std::function on_data_transfer_completed = {}, Args&&... extras) { std::lock_guard lock(m_cache_mutex); @@ -1552,10 +1539,10 @@ namespace rsx if (m_cache_update_tag.load() == data.cache_tag) { - //1. Write memory to cpu side + // 1. Write memory to cpu side flush_set(cmd, data, on_data_transfer_completed, std::forward(extras)...); - //2. Release all obsolete sections + // 2. Release all obsolete sections unprotect_set(data); } else @@ -1567,8 +1554,8 @@ namespace rsx return true; } - template - bool flush_if_cache_miss_likely(commandbuffer_type& cmd, const address_range &range, Args&&... extras) + template + bool flush_if_cache_miss_likely(commandbuffer_type& cmd, const address_range& range, Args&&... extras) { u32 cur_flushes_this_frame = (m_flushes_this_frame + m_speculations_this_frame); @@ -1583,7 +1570,7 @@ namespace rsx // Try to find matching regions bool result = false; - for (auto ®ion : block) + for (auto& region : block) { if (region.is_dirty() || region.is_synchronized() || !region.is_flushable()) continue; @@ -1698,7 +1685,7 @@ namespace rsx return evicted_set.violation_handled; } - image_view_type create_temporary_subresource(commandbuffer_type &cmd, deferred_subresource& desc) + image_view_type create_temporary_subresource(commandbuffer_type& cmd, deferred_subresource& desc) { if (!desc.do_not_cache) [[likely]] { @@ -1735,20 +1722,19 @@ namespace rsx for (u16 n = 0; n < 6; ++n) { sections[n] = - { - .src = desc.external_handle, - .xform = surface_transform::coordinate_transform, - .level = 0, - .src_x = 0, - .src_y = static_cast(desc.slice_h * n), - .dst_x = 0, - .dst_y = 0, - .dst_z = n, - .src_w = desc.width, - .src_h = desc.height, - .dst_w = desc.width, - .dst_h = desc.height - }; + { + .src = desc.external_handle, + .xform = surface_transform::coordinate_transform, + .level = 0, + .src_x = 0, + .src_y = static_cast(desc.slice_h * n), + .dst_x = 0, + .dst_y = 0, + .dst_z = n, + .src_w = desc.width, + .src_h = desc.height, + .dst_w = desc.width, + .dst_h = desc.height}; } result = generate_cubemap_from_images(cmd, desc.gcm_format, desc.width, sections, desc.remap); @@ -1766,20 +1752,19 @@ namespace rsx for (u16 n = 0; n < desc.depth; ++n) { sections[n] = - { - .src = desc.external_handle, - .xform = surface_transform::coordinate_transform, - .level = 0, - .src_x = 0, - .src_y = static_cast(desc.slice_h * n), - .dst_x = 0, - .dst_y = 0, - .dst_z = n, - .src_w = desc.width, - .src_h = desc.height, - .dst_w = desc.width, - .dst_h = desc.height - }; + { + .src = desc.external_handle, + .xform = surface_transform::coordinate_transform, + .level = 0, + .src_x = 0, + .src_y = static_cast(desc.slice_h * n), + .dst_x = 0, + .dst_y = 0, + .dst_z = n, + .src_w = desc.width, + .src_h = desc.height, + .dst_w = desc.width, + .dst_h = desc.height}; } result = generate_3d_from_2d_images(cmd, desc.gcm_format, desc.width, desc.height, desc.depth, sections, desc.remap); @@ -1804,7 +1789,7 @@ namespace rsx } default: { - //Throw + // Throw fmt::throw_exception("Invalid deferred command op 0x%X", static_cast(desc.op)); } } @@ -1813,7 +1798,7 @@ namespace rsx { if (!desc.do_not_cache) [[likely]] { - m_temporary_subresource_cache.insert({ desc.address,{ desc, result } }); + m_temporary_subresource_cache.insert({desc.address, {desc, result}}); } else { @@ -1867,7 +1852,7 @@ namespace rsx // Most mesh textures are stored as compressed to make the most of the limited memory if (auto cached_texture = find_texture_from_dimensions(attr.address, attr.gcm_format, attr.width, attr.height, attr.depth)) { - return{ cached_texture->get_view(remap), cached_texture->get_context(), cached_texture->get_format_class(), scale, cached_texture->get_image_type() }; + return {cached_texture->get_view(remap), cached_texture->get_context(), cached_texture->get_format_class(), scale, cached_texture->get_image_type()}; } } else @@ -1959,21 +1944,19 @@ namespace rsx break; } - return{ cached_texture->get_view(remap), cached_texture->get_context(), cached_texture->get_format_class(), scale, cached_texture->get_image_type() }; + return {cached_texture->get_view(remap), cached_texture->get_context(), cached_texture->get_format_class(), scale, cached_texture->get_image_type()}; } } if (!overlapping_locals.empty()) { // Remove everything that is not a transfer target - overlapping_locals.erase - ( + overlapping_locals.erase( std::remove_if(overlapping_locals.begin(), overlapping_locals.end(), [](const auto& e) - { - return e->is_dirty() || (e->get_context() != rsx::texture_upload_context::blit_engine_dst); - }), - overlapping_locals.end() - ); + { + return e->is_dirty() || (e->get_context() != rsx::texture_upload_context::blit_engine_dst); + }), + overlapping_locals.end()); } if (!options.prefer_surface_cache) @@ -2018,7 +2001,7 @@ namespace rsx if (last->get_section_base() == attr.address && normalized_width >= attr.width && last->get_height() >= attr.height) { - u32 gcm_format = attr.gcm_format; + u32 gcm_format = attr.gcm_format; const bool gcm_format_is_depth = helpers::is_gcm_depth_format(attr.gcm_format); if (!gcm_format_is_depth && last->is_depth_texture()) @@ -2034,15 +2017,15 @@ namespace rsx { // Clipped view auto viewed_image = last->get_raw_texture(); - sampled_image_descriptor result = { viewed_image->get_view(remap), last->get_context(), - viewed_image->format_class(), scale, extended_dimension, false, viewed_image->samples() }; + sampled_image_descriptor result = {viewed_image->get_view(remap), last->get_context(), + viewed_image->format_class(), scale, extended_dimension, false, viewed_image->samples()}; helpers::calculate_sample_clip_parameters(result, position2i(0, 0), size2i(attr.width, attr.height), size2i(normalized_width, last->get_height())); return result; } - return { last->get_raw_texture(), deferred_request_command::copy_image_static, new_attr, {}, - last->get_context(), classify_format(gcm_format), scale, extended_dimension, remap }; + return {last->get_raw_texture(), deferred_request_command::copy_image_static, new_attr, {}, + last->get_context(), classify_format(gcm_format), scale, extended_dimension, remap}; } } @@ -2059,7 +2042,7 @@ namespace rsx is_simple_subresource_copy && render_target_format_is_compatible(result.external_subresource_desc.src0(), attr.gcm_format)) { - if (result.external_subresource_desc.op != deferred_request_command::blit_image_static) [[ likely ]] + if (result.external_subresource_desc.op != deferred_request_command::blit_image_static) [[likely]] { helpers::convert_image_copy_to_clip_descriptor( result, @@ -2118,8 +2101,8 @@ namespace rsx if (result_is_valid) { // Check for possible duplicates - usz max_overdraw_ratio = u32{ umax }; - usz max_safe_sections = u32{ umax }; + usz max_overdraw_ratio = u32{umax}; + usz max_safe_sections = u32{umax}; switch (result.external_subresource_desc.op) { @@ -2214,7 +2197,7 @@ namespace rsx attr.height = src->height(); attr.depth = 1; attr.mipmaps = 1; - attr.pitch = 0; // Unused + attr.pitch = 0; // Unused attr.slice_h = src->height(); attr.bpp = get_format_block_size_in_bytes(attr.gcm_format); attr.swizzled = false; @@ -2230,13 +2213,12 @@ namespace rsx } descriptor->external_subresource_desc = - { - src, - rsx::deferred_request_command::copy_image_dynamic, - attr, - {}, - rsx::default_remap_vector - }; + { + src, + rsx::deferred_request_command::copy_image_dynamic, + attr, + {}, + rsx::default_remap_vector}; descriptor->external_subresource_desc.do_not_cache = true; descriptor->image_handle = nullptr; @@ -2251,7 +2233,7 @@ namespace rsx return result.first; } - template + template sampled_image_descriptor upload_texture(commandbuffer_type& cmd, const RsxTextureType& tex, surface_store_type& m_rtts, Args&&... extras) { m_texture_upload_calls_this_frame++; @@ -2273,7 +2255,7 @@ namespace rsx u32 tex_size = 0, required_surface_height = 1; u8 subsurface_count = 1; - size3f scale{ 1.f, 1.f, 1.f }; + size3f scale{1.f, 1.f, 1.f}; if (is_unnormalized) { @@ -2282,10 +2264,10 @@ namespace rsx case rsx::texture_dimension_extended::texture_dimension_3d: case rsx::texture_dimension_extended::texture_dimension_cubemap: scale.depth /= attributes.depth; - [[ fallthrough ]]; + [[fallthrough]]; case rsx::texture_dimension_extended::texture_dimension_2d: scale.height /= attributes.height; - [[ fallthrough ]]; + [[fallthrough]]; default: scale.width /= attributes.width; break; @@ -2298,7 +2280,7 @@ namespace rsx if (attributes.pitch = tex.pitch(); !attributes.pitch) { attributes.pitch = packed_pitch; - scale = { 1.f, 0.f, 0.f }; + scale = {1.f, 0.f, 0.f}; } else if (packed_pitch > attributes.pitch && !options.is_compressed_format) { @@ -2326,7 +2308,7 @@ namespace rsx attributes.depth = 1; attributes.edge_clamped = (tex.wrap_s() == rsx::texture_wrap_mode::clamp_to_edge && tex.wrap_t() == rsx::texture_wrap_mode::clamp_to_edge); scale.depth = 0.f; - subsurface_count = options.is_compressed_format? 1 : tex.get_exact_mipmap_count(); + subsurface_count = options.is_compressed_format ? 1 : tex.get_exact_mipmap_count(); attributes.slice_h = required_surface_height = attributes.height; break; case rsx::texture_dimension_extended::texture_dimension_cubemap: @@ -2459,7 +2441,7 @@ namespace rsx { // NOTE: Do not disable 'cyclic ref' since the texture_barrier may have already been issued! result.image_handle = 0; - result.external_subresource_desc = { 0, deferred_request_command::mipmap_gather, attributes, {}, tex.decoded_remap() }; + result.external_subresource_desc = {0, deferred_request_command::mipmap_gather, attributes, {}, tex.decoded_remap()}; result.format_class = rsx::classify_format(attributes.gcm_format); if (result.texcoord_xform.clamp) @@ -2505,12 +2487,12 @@ namespace rsx auto uploaded = upload_image_from_cpu(cmd, tex_range, attributes.width, attributes.height, attributes.depth, tex.get_exact_mipmap_count(), attributes.pitch, attributes.gcm_format, texture_upload_context::shader_read, subresources_layout, extended_dimension, attributes.swizzled); - return{ uploaded->get_view(tex.decoded_remap()), - texture_upload_context::shader_read, format_class, scale, extended_dimension }; + return {uploaded->get_view(tex.decoded_remap()), + texture_upload_context::shader_read, format_class, scale, extended_dimension}; } // FIXME: This function is way too large and needs an urgent refactor. - template + template blit_op_result upload_scaled_image(const rsx::blit_src_info& src_info, const rsx::blit_dst_info& dst_info, bool interpolate, commandbuffer_type& cmd, surface_store_type& m_rtts, blitter_type& blitter, Args&&... extras) { // Local working copy. We may modify the descriptors for optimization purposes @@ -2700,7 +2682,7 @@ namespace rsx } // Optimal setup. We have ideal conditions presented so we can correctly decide what to do here. - const auto section = find_cached_texture(range, { .gcm_format = RSX_GCM_FORMAT_IGNORED }, false, false, false); + const auto section = find_cached_texture(range, {.gcm_format = RSX_GCM_FORMAT_IGNORED}, false, false, false); return section && section->is_locked(); }; @@ -2854,11 +2836,11 @@ namespace rsx bool dst_is_depth_surface = false; u16 max_dst_width = dst.width; u16 max_dst_height = dst.height; - areai src_area = { 0, 0, src_w, src_h }; - areai dst_area = { 0, 0, dst_w, dst_h }; + areai src_area = {0, 0, src_w, src_h}; + areai dst_area = {0, 0, dst_w, dst_h}; - size2i dst_dimensions = { static_cast(dst.pitch / dst_bpp), dst.height }; - position2i dst_offset = { dst.offset_x, dst.offset_y }; + size2i dst_dimensions = {static_cast(dst.pitch / dst_bpp), dst.height}; + position2i dst_offset = {dst.offset_x, dst.offset_y}; u32 dst_base_address = dst.rsx_address; const auto src_payload_length = (src.pitch * (src_h - 1) + (src_w * src_bpp)); @@ -2867,7 +2849,7 @@ namespace rsx if (!use_null_region && !dst_is_render_target) { - size2u src_dimensions = { 0, 0 }; + size2u src_dimensions = {0, 0}; if (src_is_render_target) { src_dimensions.width = src_subres.surface->template get_surface_width(); @@ -2879,8 +2861,7 @@ namespace rsx dst_range, dst.pitch, src_dimensions, - static_cast(dst_dimensions) - ); + static_cast(dst_dimensions)); if (props.use_dma_region) { @@ -2919,11 +2900,12 @@ namespace rsx else { required_type_mask = texture_upload_context::blit_engine_dst; - if (skip_if_collision_exists) required_type_mask |= texture_upload_context::shader_read; + if (skip_if_collision_exists) + required_type_mask |= texture_upload_context::shader_read; } auto overlapping_surfaces = find_texture_from_range(dst_range, dst.pitch, required_type_mask); - for (const auto &surface : overlapping_surfaces) + for (const auto& surface : overlapping_surfaces) { if (!surface->is_locked()) { @@ -2968,10 +2950,12 @@ namespace rsx switch (surface->get_gcm_format()) { case CELL_GCM_TEXTURE_A8R8G8B8: - if (!dst_is_argb8) continue; + if (!dst_is_argb8) + continue; break; case CELL_GCM_TEXTURE_R5G6B5: - if (dst_is_argb8) continue; + if (dst_is_argb8) + continue; break; default: continue; @@ -3038,7 +3022,7 @@ namespace rsx auto overlapping_surfaces = find_texture_from_range(address_range::start_length(src_address, src_payload_length), src.pitch, lookup_mask); auto old_src_area = src_area; - for (const auto &surface : overlapping_surfaces) + for (const auto& surface : overlapping_surfaces) { if (!surface->is_locked()) { @@ -3055,21 +3039,24 @@ namespace rsx case CELL_GCM_TEXTURE_Y16_X16_FLOAT: { // Should be copy compatible but not scaling compatible - if (src_is_argb8 && (is_copy_op || dst_is_render_target)) break; + if (src_is_argb8 && (is_copy_op || dst_is_render_target)) + break; continue; } case CELL_GCM_TEXTURE_DEPTH24_D8: case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT: { // Should be copy compatible but not scaling compatible - if (src_is_argb8 && (is_copy_op || !dst_is_render_target)) break; + if (src_is_argb8 && (is_copy_op || !dst_is_render_target)) + break; continue; } case CELL_GCM_TEXTURE_A8R8G8B8: case CELL_GCM_TEXTURE_D8R8G8B8: { // Perfect match - if (src_is_argb8) break; + if (src_is_argb8) + break; continue; } case CELL_GCM_TEXTURE_X16: @@ -3080,20 +3067,23 @@ namespace rsx case CELL_GCM_TEXTURE_R5G5B5A1: { // Copy compatible - if (!src_is_argb8 && (is_copy_op || dst_is_render_target)) break; + if (!src_is_argb8 && (is_copy_op || dst_is_render_target)) + break; continue; } case CELL_GCM_TEXTURE_DEPTH16: case CELL_GCM_TEXTURE_DEPTH16_FLOAT: { // Copy compatible - if (!src_is_argb8 && (is_copy_op || !dst_is_render_target)) break; + if (!src_is_argb8 && (is_copy_op || !dst_is_render_target)) + break; continue; } case CELL_GCM_TEXTURE_R5G6B5: { // Perfect match - if (!src_is_argb8) break; + if (!src_is_argb8) + break; continue; } default: @@ -3164,7 +3154,7 @@ namespace rsx subres.height_in_block = subres.height_in_texel = image_height; subres.pitch_in_block = full_width; subres.depth = 1; - subres.data = { vm::_ptr(image_base), static_cast::size_type>(src.pitch * image_height) }; + subres.data = {vm::_ptr(image_base), static_cast::size_type>(src.pitch * image_height)}; subresource_layout.push_back(subres); const u32 gcm_format = helpers::get_sized_blit_format(src_is_argb8, dst_is_depth_surface, is_format_convert); @@ -3195,22 +3185,24 @@ namespace rsx typeless_info.src_context = texture_upload_context::framebuffer_storage; } - //const auto src_is_depth_format = helpers::is_gcm_depth_format(typeless_info.src_gcm_format); + // const auto src_is_depth_format = helpers::is_gcm_depth_format(typeless_info.src_gcm_format); const auto preferred_dst_format = helpers::get_sized_blit_format(dst_is_argb8, false, is_format_convert); if (cached_dest && !use_null_region) { // Prep surface auto channel_order = src_is_render_target ? rsx::component_order::native : - dst_is_argb8 ? rsx::component_order::default_ : - rsx::component_order::swapped_native; + dst_is_argb8 ? rsx::component_order::default_ : + rsx::component_order::swapped_native; set_component_order(*cached_dest, preferred_dst_format, channel_order); } // Validate clipping region - if ((dst.offset_x + dst.clip_x + dst.clip_width) > max_dst_width) dst.clip_x = 0; - if ((dst.offset_y + dst.clip_y + dst.clip_height) > max_dst_height) dst.clip_y = 0; + if ((dst.offset_x + dst.clip_x + dst.clip_width) > max_dst_width) + dst.clip_x = 0; + if ((dst.offset_y + dst.clip_y + dst.clip_height) > max_dst_height) + dst.clip_y = 0; // Reproject clip offsets onto source to simplify blit if (dst.clip_x || dst.clip_y) @@ -3264,20 +3256,19 @@ namespace rsx } const image_section_attributes_t attrs = - { - .pitch = dst.pitch, - .width = static_cast(dst_dimensions.width), - .height = static_cast(dst_dimensions.height), - .bpp = dst_bpp - }; + { + .pitch = dst.pitch, + .width = static_cast(dst_dimensions.width), + .height = static_cast(dst_dimensions.height), + .bpp = dst_bpp}; cached_dest = create_nul_section(cmd, rsx_range, attrs, dst_tile, force_dma_load); } else { // render target data is already in correct swizzle layout auto channel_order = src_is_render_target ? rsx::component_order::native : - dst_is_argb8 ? rsx::component_order::default_ : - rsx::component_order::swapped_native; + dst_is_argb8 ? rsx::component_order::default_ : + rsx::component_order::swapped_native; // Translate dst_area into the 'full' dst block based on dst.rsx_address as (0, 0) dst_area.x1 += dst_offset.x; @@ -3305,7 +3296,7 @@ namespace rsx subres.height_in_block = subres.height_in_texel = dst_dimensions.height; subres.pitch_in_block = pitch_in_block; subres.depth = 1; - subres.data = { vm::get_super_ptr(dst_base_address), static_cast::size_type>(dst.pitch * dst_dimensions.height) }; + subres.data = {vm::get_super_ptr(dst_base_address), static_cast::size_type>(dst.pitch * dst_dimensions.height)}; subresource_layout.push_back(subres); cached_dest = upload_image_from_cpu(cmd, rsx_range, dst_dimensions.width, dst_dimensions.height, 1, 1, dst.pitch, @@ -3337,7 +3328,7 @@ namespace rsx lock.upgrade(); - cached_dest->reprotect(utils::protection::no, { mem_offset, dst_payload_length }); + cached_dest->reprotect(utils::protection::no, {mem_offset, dst_payload_length}); cached_dest->touch(m_cache_update_tag); update_cache_tag(); @@ -3353,7 +3344,7 @@ namespace rsx // Reset this object's synchronization status if it is locked lock.upgrade(); - if (const auto found = find_cached_texture(dst_subres.surface->get_memory_range(), { .gcm_format = RSX_GCM_FORMAT_IGNORED }, false, false, false)) + if (const auto found = find_cached_texture(dst_subres.surface->get_memory_range(), {.gcm_format = RSX_GCM_FORMAT_IGNORED}, false, false, false)) { if (found->is_locked()) { @@ -3472,7 +3463,7 @@ namespace rsx std::lock_guard lock(m_cache_mutex); bool update_tag = false; - for (const auto &It : m_flush_always_cache) + for (const auto& It : m_flush_always_cache) { auto& section = *(It.second); if (section.get_protection() != utils::protection::no) @@ -3486,7 +3477,8 @@ namespace rsx } } - if (update_tag) update_cache_tag(); + if (update_tag) + update_cache_tag(); m_flush_always_update_timestamp = m_cache_update_tag.load(); #ifdef TEXTURE_CACHE_DEBUG @@ -3512,15 +3504,14 @@ namespace rsx if (tex.get_section_base() == section_base_address) { return tex.get_context() == context && - tex.is_locked() && - test_range.inside(tex.get_section_range()); + tex.is_locked() && + test_range.inside(tex.get_section_range()); } } return false; } - /** * The read only texture invalidate flag is set if a read only texture is trampled by framebuffer memory * If set, all cached read only textures are considered invalid and should be re-fetched from the texture cache @@ -3535,7 +3526,6 @@ namespace rsx return read_only_tex_invalidate; } - /** * Per-frame statistics */ @@ -3628,7 +3618,7 @@ namespace rsx u32 get_texture_upload_miss_percentage() const { - return (m_texture_upload_calls_this_frame)? (m_texture_upload_misses_this_frame * 100 / m_texture_upload_calls_this_frame) : 0; + return (m_texture_upload_calls_this_frame) ? (m_texture_upload_misses_this_frame * 100 / m_texture_upload_calls_this_frame) : 0; } u32 get_texture_copies_ellided_this_frame() const @@ -3636,4 +3626,4 @@ namespace rsx return m_texture_copies_ellided_this_frame; } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_checker.h b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_checker.h index 094220ac3..919d1d4e7 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_checker.h +++ b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_checker.h @@ -4,10 +4,13 @@ #include "../rsx_utils.h" -namespace rsx { +namespace rsx +{ - class tex_cache_checker_t { - struct per_page_info_t { + class tex_cache_checker_t + { + struct per_page_info_t + { u8 prot = 0; u8 no = 0; u8 ro = 0; @@ -30,7 +33,7 @@ namespace rsx { FORCE_INLINE u16 sum() const { - return u16{ no } + ro; + return u16{no} + ro; } FORCE_INLINE bool verify() const @@ -49,8 +52,14 @@ namespace rsx { { switch (prot) { - case utils::protection::no: if (no++ == umax) fmt::throw_exception("add(protection::no) overflow"); return; - case utils::protection::ro: if (ro++ == umax) fmt::throw_exception("add(protection::ro) overflow"); return; + case utils::protection::no: + if (no++ == umax) + fmt::throw_exception("add(protection::no) overflow"); + return; + case utils::protection::ro: + if (ro++ == umax) + fmt::throw_exception("add(protection::ro) overflow"); + return; default: fmt::throw_exception("Unreachable"); } } @@ -59,15 +68,20 @@ namespace rsx { { switch (prot) { - case utils::protection::no: if (no-- == 0) fmt::throw_exception("remove(protection::no) overflow with NO==0"); return; - case utils::protection::ro: if (ro-- == 0) fmt::throw_exception("remove(protection::ro) overflow with RO==0"); return; + case utils::protection::no: + if (no-- == 0) + fmt::throw_exception("remove(protection::no) overflow with NO==0"); + return; + case utils::protection::ro: + if (ro-- == 0) + fmt::throw_exception("remove(protection::ro) overflow with RO==0"); + return; default: fmt::throw_exception("Unreachable"); } } }; static_assert(sizeof(per_page_info_t) <= 4, "page_info_elmnt must be less than 4-bytes in size"); - // 4GB memory space / 4096 bytes per page = 1048576 pages // Initialized to utils::protection::rw static constexpr usz num_pages = 0x1'0000'0000 / 4096; @@ -160,7 +174,7 @@ namespace rsx { // Returns the a lower bound as to how many locked sections are known to be within the given range with each protection {NA,RO} // The assumption here is that the page in the given range with the largest number of refcounted sections represents the lower bound to how many there must be - std::pair get_minimum_number_of_sections(const address_range& range) const + std::pair get_minimum_number_of_sections(const address_range& range) const { AUDIT(range.is_page_range()); @@ -172,7 +186,7 @@ namespace rsx { ro = std::max(ro, ptr->ro); } - return { no,ro }; + return {no, ro}; } void check_unprotected(const address_range& range, bool allow_ro = false, bool must_be_empty = true) const @@ -187,10 +201,8 @@ namespace rsx { fmt::throw_exception("Page at addr=0x%8x should be RW%s: Prot=%s, RO=%d, NA=%d", addr, allow_ro ? " or RO" : "", prot_to_str(prot), ptr->ro, ptr->no); } - if (must_be_empty && ( - ptr->no > 0 || - (!allow_ro && ptr->ro > 0) - )) + if (must_be_empty && (ptr->no > 0 || + (!allow_ro && ptr->ro > 0))) { const u32 addr = info_pointer_to_address(ptr); fmt::throw_exception("Page at addr=0x%8x should not have any NA%s sections: Prot=%s, RO=%d, NA=%d", addr, allow_ro ? " or RO" : "", prot_to_str(prot), ptr->ro, ptr->no); @@ -202,7 +214,7 @@ namespace rsx { { for (usz idx = 0; idx < num_pages; idx++) { - auto &elmnt = _info[idx]; + auto& elmnt = _info[idx]; if (!elmnt.verify()) { const u32 addr = index_to_rsx_address(idx); @@ -215,4 +227,4 @@ namespace rsx { extern tex_cache_checker_t tex_cache_checker; }; // namespace rsx -#endif //TEXTURE_CACHE_DEBUG \ No newline at end of file +#endif // TEXTURE_CACHE_DEBUG \ No newline at end of file diff --git a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_helpers.h b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_helpers.h index 617f3b75d..9526618d9 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_helpers.h +++ b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_helpers.h @@ -8,17 +8,17 @@ namespace rsx // Defines pixel operation to be performed on a surface before it is ready for use enum surface_transform : u32 { - identity = 0, // Nothing - coordinate_transform = 1 // Incoming source coordinates may generated based on the format of the secondary (dest) surface. Recalculate them before use. + identity = 0, // Nothing + coordinate_transform = 1 // Incoming source coordinates may generated based on the format of the secondary (dest) surface. Recalculate them before use. }; - template + template struct copy_region_descriptor_base { image_resource_type src; flags32_t xform; u32 base_addr; - u8 level; + u8 level; u16 src_x; u16 src_y; u16 dst_x; @@ -33,16 +33,16 @@ namespace rsx // Deferred texture processing commands enum class deferred_request_command : u32 { - nop = 0, // Nothing - copy_image_static, // Copy image and cache the results - copy_image_dynamic, // Copy image but do not cache the results - cubemap_gather, // Provided list of sections generates a cubemap - cubemap_unwrap, // One large texture provided to be partitioned into a cubemap - atlas_gather, // Provided list of sections generates a texture atlas - _3d_gather, // Provided list of sections generates a 3D array - _3d_unwrap, // One large texture provided to be partitioned into a 3D array - mipmap_gather, // Provided list of sections to be reassembled as mipmap levels of the same texture - blit_image_static, // Variant of the copy command that does scaling instead of copying + nop = 0, // Nothing + copy_image_static, // Copy image and cache the results + copy_image_dynamic, // Copy image but do not cache the results + cubemap_gather, // Provided list of sections generates a cubemap + cubemap_unwrap, // One large texture provided to be partitioned into a cubemap + atlas_gather, // Provided list of sections generates a texture atlas + _3d_gather, // Provided list of sections generates a 3D array + _3d_unwrap, // One large texture provided to be partitioned into a 3D array + mipmap_gather, // Provided list of sections to be reassembled as mipmap levels of the same texture + blit_image_static, // Variant of the copy command that does scaling instead of copying }; struct image_section_attributes_t @@ -55,7 +55,7 @@ namespace rsx u16 depth; u16 mipmaps; u16 slice_h; - u8 bpp; + u8 bpp; bool swizzled; bool edge_clamped; }; @@ -67,7 +67,8 @@ namespace rsx u32 real_dst_size = 0; blit_op_result(bool success) : succeeded(success) - {} + { + } inline address_range to_address_range() const { @@ -138,12 +139,12 @@ namespace rsx case CELL_GCM_TEXTURE_A8R8G8B8: return CELL_GCM_TEXTURE_DEPTH24_D8; case CELL_GCM_TEXTURE_X16: - //case CELL_GCM_TEXTURE_A4R4G4B4: - //case CELL_GCM_TEXTURE_G8B8: - //case CELL_GCM_TEXTURE_A1R5G5B5: - //case CELL_GCM_TEXTURE_R5G5B5A1: - //case CELL_GCM_TEXTURE_R5G6B5: - //case CELL_GCM_TEXTURE_R6G5B5: + // case CELL_GCM_TEXTURE_A4R4G4B4: + // case CELL_GCM_TEXTURE_G8B8: + // case CELL_GCM_TEXTURE_A1R5G5B5: + // case CELL_GCM_TEXTURE_R5G5B5A1: + // case CELL_GCM_TEXTURE_R5G6B5: + // case CELL_GCM_TEXTURE_R6G5B5: return CELL_GCM_TEXTURE_DEPTH16; } @@ -213,14 +214,14 @@ namespace rsx if (dst_range.inside(buffer_range)) { // Match found - return { false, buffer_range.start, buffer.width, buffer.height }; + return {false, buffer_range.start, buffer.width, buffer.height}; } if (dst_range.overlaps(buffer_range)) [[unlikely]] { // The range clips the destination but does not fit inside it // Use DMA stream to optimize the flush that is likely to happen when flipping - return { true }; + return {true}; } } } @@ -233,20 +234,20 @@ namespace rsx // Optimizations table based on common width/height pairings. If we guess wrong, the upload resolver will fix it anyway // TODO: Add more entries based on empirical data const auto optimal_height = std::max(dst_dimensions.height, 720u); - return { false, 0, dst_dimensions.width, optimal_height }; + return {false, 0, dst_dimensions.width, optimal_height}; } if (dst_dimensions.width == src_dimensions.width) { const auto optimal_height = std::max(dst_dimensions.height, src_dimensions.height); - return { false, 0, dst_dimensions.width, optimal_height }; + return {false, 0, dst_dimensions.width, optimal_height}; } } - return { false, 0, dst_dimensions.width, dst_dimensions.height }; + return {false, 0, dst_dimensions.width, dst_dimensions.height}; } - template + template void gather_texture_slices( commandbuffer_type& cmd, std::vector& out, @@ -272,7 +273,7 @@ namespace rsx for (u32 index = 0; index < fbos.size(); ++index) { - sort_list.push_back({ fbos[index].surface->last_use_tag, 0, index }); + sort_list.push_back({fbos[index].surface->last_use_tag, 0, index}); } for (u32 index = 0; index < local.size(); ++index) @@ -280,7 +281,7 @@ namespace rsx if (local[index]->get_context() != rsx::texture_upload_context::blit_engine_dst) continue; - sort_list.push_back({ local[index]->last_write_tag, 1, index }); + sort_list.push_back({local[index]->last_write_tag, 1, index}); } std::sort(sort_list.begin(), sort_list.end(), FN(x.tag < y.tag)); @@ -329,9 +330,7 @@ namespace rsx section.surface->memory_barrier(cmd, rsx::surface_access::transfer_read); - out.push_back - ({ - .src = section.surface->get_surface(rsx::surface_access::transfer_read), + out.push_back({.src = section.surface->get_surface(rsx::surface_access::transfer_read), .xform = surface_transform::identity, .base_addr = section.base_address, .level = 0, @@ -343,8 +342,7 @@ namespace rsx .src_w = src_width, .src_h = src_height, .dst_w = dst_width, - .dst_h = dst_height - }); + .dst_h = dst_height}); }; auto add_local_resource = [&](auto& section, u32 address, u16 slice, bool scaling = true) @@ -357,7 +355,7 @@ namespace rsx auto [src_offset, dst_offset, dimensions] = rsx::intersect_region( section->get_section_base(), normalized_section_width, section->get_height(), /* parent region (extractee) */ - address, normalized_attr_width, attr.slice_h, /* child region (extracted) */ + address, normalized_attr_width, attr.slice_h, /* child region (extracted) */ attr.pitch); if (!dimensions.width || !dimensions.height) @@ -369,11 +367,11 @@ namespace rsx // The intersection takes place in a normalized coordinate space. Now we convert back to domain-specific src_offset.x /= section_bpp; dst_offset.x /= attr.bpp; - const size2u dst_size = { dimensions.width / attr.bpp, dimensions.height }; - const size2u src_size = { dimensions.width / section_bpp, dimensions.height }; + const size2u dst_size = {dimensions.width / attr.bpp, dimensions.height}; + const size2u src_size = {dimensions.width / section_bpp, dimensions.height}; - const u32 dst_slice_begin = slice * attr.slice_h; // Output slice low watermark - const u32 dst_slice_end = dst_slice_begin + attr.height; // Output slice high watermark + const u32 dst_slice_begin = slice * attr.slice_h; // Output slice low watermark + const u32 dst_slice_end = dst_slice_begin + attr.height; // Output slice high watermark const auto dst_y = dst_offset.y; const auto dst_h = dst_size.height; @@ -395,45 +393,39 @@ namespace rsx const auto [_dst_x, _dst_y] = rsx::apply_resolution_scale(static_cast(dst_offset.x), static_cast(dst_y - dst_slice_begin), attr.width, attr.height); const auto [_dst_w, _dst_h] = rsx::apply_resolution_scale(dst_w, height, attr.width, attr.height); - out.push_back - ({ - .src = section->get_raw_texture(), + out.push_back({.src = section->get_raw_texture(), .xform = surface_transform::identity, .level = 0, - .src_x = static_cast(src_offset.x), // src.x - .src_y = static_cast(src_offset.y), // src.y - .dst_x = _dst_x, // dst.x - .dst_y = _dst_y, // dst.y + .src_x = static_cast(src_offset.x), // src.x + .src_y = static_cast(src_offset.y), // src.y + .dst_x = _dst_x, // dst.x + .dst_y = _dst_y, // dst.y .dst_z = slice, .src_w = src_w, .src_h = height, .dst_w = _dst_w, - .dst_h = _dst_h - }); + .dst_h = _dst_h}); } else { - out.push_back - ({ - .src = section->get_raw_texture(), + out.push_back({.src = section->get_raw_texture(), .xform = surface_transform::identity, .level = 0, - .src_x = static_cast(src_offset.x), // src.x - .src_y = static_cast(src_offset.y), // src.y - .dst_x = static_cast(dst_offset.x), // dst.x - .dst_y = static_cast(dst_y - dst_slice_begin), // dst.y + .src_x = static_cast(src_offset.x), // src.x + .src_y = static_cast(src_offset.y), // src.y + .dst_x = static_cast(dst_offset.x), // dst.x + .dst_y = static_cast(dst_y - dst_slice_begin), // dst.y .dst_z = 0, .src_w = src_w, .src_h = height, .dst_w = dst_w, - .dst_h = height - }); + .dst_h = height}); } }; u32 current_address = attr.address; - //u16 current_src_offset = 0; - //u16 current_dst_offset = 0; + // u16 current_src_offset = 0; + // u16 current_dst_offset = 0; u32 slice_size = (attr.pitch * attr.slice_h); out.reserve(count); @@ -493,7 +485,7 @@ namespace rsx } } - template + template bool check_framebuffer_resource( render_target_type texptr, const image_section_attributes_t& attr, @@ -698,15 +690,15 @@ namespace rsx const auto command = surface_is_rop_target ? deferred_request_command::copy_image_dynamic : deferred_request_command::copy_image_static; texptr->memory_barrier(cmd, rsx::surface_access::transfer_read); - return { texptr->get_surface(rsx::surface_access::transfer_read), command, attr2, {}, - texture_upload_context::framebuffer_storage, format_class, scale, - extended_dimension, decoded_remap }; + return {texptr->get_surface(rsx::surface_access::transfer_read), command, attr2, {}, + texture_upload_context::framebuffer_storage, format_class, scale, + extended_dimension, decoded_remap}; } texptr->memory_barrier(cmd, access_type); auto viewed_surface = texptr->get_surface(access_type); - sampled_image_descriptor result = { viewed_surface->get_view(decoded_remap), texture_upload_context::framebuffer_storage, - texptr->format_class(), scale, rsx::texture_dimension_extended::texture_dimension_2d, surface_is_rop_target, viewed_surface->samples() }; + sampled_image_descriptor result = {viewed_surface->get_view(decoded_remap), texture_upload_context::framebuffer_storage, + texptr->format_class(), scale, rsx::texture_dimension_extended::texture_dimension_2d, surface_is_rop_target, viewed_surface->samples()}; if (requires_clip) { @@ -720,18 +712,18 @@ namespace rsx if (extended_dimension == rsx::texture_dimension_extended::texture_dimension_3d) { - return{ texptr->get_surface(rsx::surface_access::transfer_read), deferred_request_command::_3d_unwrap, - attr2, {}, - texture_upload_context::framebuffer_storage, texptr->format_class(), scale, - rsx::texture_dimension_extended::texture_dimension_3d, decoded_remap }; + return {texptr->get_surface(rsx::surface_access::transfer_read), deferred_request_command::_3d_unwrap, + attr2, {}, + texture_upload_context::framebuffer_storage, texptr->format_class(), scale, + rsx::texture_dimension_extended::texture_dimension_3d, decoded_remap}; } ensure(extended_dimension == rsx::texture_dimension_extended::texture_dimension_cubemap); - return{ texptr->get_surface(rsx::surface_access::transfer_read), deferred_request_command::cubemap_unwrap, - attr2, {}, - texture_upload_context::framebuffer_storage, texptr->format_class(), scale, - rsx::texture_dimension_extended::texture_dimension_cubemap, decoded_remap }; + return {texptr->get_surface(rsx::surface_access::transfer_read), deferred_request_command::cubemap_unwrap, + attr2, {}, + texture_upload_context::framebuffer_storage, texptr->format_class(), scale, + rsx::texture_dimension_extended::texture_dimension_cubemap, decoded_remap}; } template @@ -808,10 +800,10 @@ namespace rsx attr2.width = scaled_w; attr2.height = scaled_h; - sampled_image_descriptor desc = { nullptr, deferred_request_command::cubemap_gather, - attr2, {}, - upload_context, format_class, scale, - rsx::texture_dimension_extended::texture_dimension_cubemap, decoded_remap }; + sampled_image_descriptor desc = {nullptr, deferred_request_command::cubemap_gather, + attr2, {}, + upload_context, format_class, scale, + rsx::texture_dimension_extended::texture_dimension_cubemap, decoded_remap}; gather_texture_slices(cmd, desc.external_subresource_desc.sections_to_copy, fbos, local, attr, 6, is_depth); return desc; @@ -821,10 +813,10 @@ namespace rsx attr2.width = scaled_w; attr2.height = scaled_h; - sampled_image_descriptor desc = { nullptr, deferred_request_command::_3d_gather, + sampled_image_descriptor desc = {nullptr, deferred_request_command::_3d_gather, attr2, {}, upload_context, format_class, scale, - rsx::texture_dimension_extended::texture_dimension_3d, decoded_remap }; + rsx::texture_dimension_extended::texture_dimension_3d, decoded_remap}; gather_texture_slices(cmd, desc.external_subresource_desc.sections_to_copy, fbos, local, attr, attr.depth, is_depth); return desc; @@ -841,34 +833,32 @@ namespace rsx attr2.height = scaled_h; } - sampled_image_descriptor result = { nullptr, deferred_request_command::atlas_gather, - attr2, {}, upload_context, format_class, - scale, rsx::texture_dimension_extended::texture_dimension_2d, decoded_remap }; + sampled_image_descriptor result = {nullptr, deferred_request_command::atlas_gather, + attr2, {}, upload_context, format_class, + scale, rsx::texture_dimension_extended::texture_dimension_2d, decoded_remap}; gather_texture_slices(cmd, result.external_subresource_desc.sections_to_copy, fbos, local, attr, 1, is_depth); result.simplify(); return result; } - template + template bool append_mipmap_level( - std::vector& sections, // Destination list - const sampled_image_descriptor& level, // Descriptor for the image level being checked - const image_section_attributes_t& attr, // Attributes of image level - u8 mipmap_level, // Level index - bool apply_upscaling, // Whether to upscale the results or not - const image_section_attributes_t& level0_attr) // Attributes of the first mipmap level + std::vector& sections, // Destination list + const sampled_image_descriptor& level, // Descriptor for the image level being checked + const image_section_attributes_t& attr, // Attributes of image level + u8 mipmap_level, // Level index + bool apply_upscaling, // Whether to upscale the results or not + const image_section_attributes_t& level0_attr) // Attributes of the first mipmap level { if (level.image_handle) { - copy_region_descriptor_type mip - { + copy_region_descriptor_type mip{ .src = level.image_handle->image(), .xform = surface_transform::coordinate_transform, .level = mipmap_level, .dst_w = attr.width, - .dst_h = attr.height - }; + .dst_h = attr.height}; // "Fast" framebuffer results are a perfect match for attr so we do not store transfer sizes // Calculate transfer dimensions from attr @@ -891,8 +881,7 @@ namespace rsx case deferred_request_command::copy_image_dynamic: case deferred_request_command::copy_image_static: { - copy_region_descriptor_type mip - { + copy_region_descriptor_type mip{ .src = level.external_subresource_desc.external_handle, .xform = surface_transform::coordinate_transform, .level = mipmap_level, @@ -904,8 +893,7 @@ namespace rsx .src_h = level.external_subresource_desc.height, .dst_w = attr.width, - .dst_h = attr.height - }; + .dst_h = attr.height}; sections.push_back(mip); break; @@ -927,5 +915,5 @@ namespace rsx return true; } - }; -} + }; // namespace texture_cache_helpers +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_predictor.h b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_predictor.h index a18fc93c7..bf3662022 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_predictor.h +++ b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_predictor.h @@ -26,7 +26,7 @@ namespace rsx void clear() { m_front = buffer_size; - m_size = 0; + m_size = 0; } usz size() const @@ -73,27 +73,25 @@ namespace rsx template struct texture_cache_predictor_key { - using texture_format = typename traits::texture_format; + using texture_format = typename traits::texture_format; using section_storage_type = typename traits::section_storage_type; - address_range cpu_range; - texture_format format; + address_range cpu_range; + texture_format format; texture_upload_context context; // Constructors texture_cache_predictor_key() = default; texture_cache_predictor_key(const address_range& _cpu_range, texture_format _format, texture_upload_context _context) - : cpu_range(_cpu_range) - , format(_format) - , context(_context) - {} + : cpu_range(_cpu_range), format(_format), context(_context) + { + } texture_cache_predictor_key(const section_storage_type& section) - : cpu_range(section.get_section_range()) - , format(section.get_format()) - , context(section.get_context()) - {} + : cpu_range(section.get_section_range()), format(section.get_format()), context(section.get_context()) + { + } // Methods bool operator==(const texture_cache_predictor_key& other) const @@ -105,7 +103,7 @@ namespace rsx /** * Predictor entry */ - template + template class texture_cache_predictor_entry { public: @@ -121,14 +119,14 @@ namespace rsx static const u32 max_write_history_size = 16; texture_cache_predictor_entry_history_queue write_history; - static const u32 max_confidence = 8; // Cannot be more "confident" than this value + static const u32 max_confidence = 8; // Cannot be more "confident" than this value static const u32 confident_threshold = 6; // We are confident if confidence >= confidence_threshold static const u32 starting_confidence = 3; - static const u32 confidence_guessed_flush = 2; // Confidence granted when we correctly guess there will be a flush - static const u32 confidence_guessed_no_flush = 1; // Confidence granted when we correctly guess there won't be a flush - static const u32 confidence_incorrect_guess = -2; // Confidence granted when our guess is incorrect - static const u32 confidence_mispredict = -4; // Confidence granted when a speculative flush is incorrect + static const u32 confidence_guessed_flush = 2; // Confidence granted when we correctly guess there will be a flush + static const u32 confidence_guessed_no_flush = 1; // Confidence granted when we correctly guess there won't be a flush + static const u32 confidence_incorrect_guess = -2; // Confidence granted when our guess is incorrect + static const u32 confidence_mispredict = -4; // Confidence granted when a speculative flush is incorrect u32 confidence; @@ -207,8 +205,8 @@ namespace rsx // For more than one entry, we try and find a pattern, and assume it holds const u32 stop_when_found_matches = 4; - u32 matches_found = 0; - u32 guess = -1; + u32 matches_found = 0; + u32 guess = -1; for (u32 i = 0; i < history_size; i++) { @@ -234,7 +232,7 @@ namespace rsx // If we found more matches than all other comparisons, we take a guess if (cur_matches_found > matches_found) { - guess = write_history[i]; + guess = write_history[i]; matches_found = cur_matches_found; } @@ -257,9 +255,9 @@ namespace rsx public: void reset() { - confidence = starting_confidence; + confidence = starting_confidence; m_writes_since_last_flush = 0; - m_guessed_writes = -1; + m_guessed_writes = -1; write_history.clear(); } @@ -315,15 +313,15 @@ namespace rsx public: // Traits using section_storage_type = typename traits::section_storage_type; - using texture_cache_type = typename traits::texture_cache_base_type; + using texture_cache_type = typename traits::texture_cache_base_type; - using key_type = texture_cache_predictor_key; + using key_type = texture_cache_predictor_key; using mapped_type = texture_cache_predictor_entry; - using map_type = std::unordered_map; + using map_type = std::unordered_map; - using value_type = typename map_type::value_type; - using size_type = typename map_type::size_type; - using iterator = typename map_type::iterator; + using value_type = typename map_type::value_type; + using size_type = typename map_type::size_type; + using iterator = typename map_type::iterator; using const_iterator = typename map_type::const_iterator; private: @@ -337,17 +335,38 @@ namespace rsx // Constructors texture_cache_predictor(texture_cache_type* tex_cache) - : m_tex_cache(tex_cache) {} + : m_tex_cache(tex_cache) {} ~texture_cache_predictor() = default; // Trait wrappers - constexpr iterator begin() noexcept { return m_entries.begin(); } - constexpr const_iterator begin() const noexcept { return m_entries.begin(); } - inline iterator end() noexcept { return m_entries.end(); } - inline const_iterator end() const noexcept { return m_entries.end(); } - bool empty() const noexcept { return m_entries.empty(); } - size_type size() const noexcept { return m_entries.size(); } - void clear() { m_entries.clear(); } + constexpr iterator begin() noexcept + { + return m_entries.begin(); + } + constexpr const_iterator begin() const noexcept + { + return m_entries.begin(); + } + inline iterator end() noexcept + { + return m_entries.end(); + } + inline const_iterator end() const noexcept + { + return m_entries.end(); + } + bool empty() const noexcept + { + return m_entries.empty(); + } + size_type size() const noexcept + { + return m_entries.size(); + } + void clear() + { + m_entries.clear(); + } mapped_type& operator[](const key_type& key) { diff --git a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_types.cpp b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_types.cpp index 4a90f2719..fa36b87ab 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_types.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_types.cpp @@ -6,8 +6,7 @@ namespace rsx { void invalidation_cause::flag_bits_from_cause(enum_type cause) { - constexpr const std::array s_lookup_table - { + constexpr const std::array s_lookup_table{ std::make_pair(enum_type::read, flags::cause_is_read), std::make_pair(enum_type::deferred_read, flags::cause_is_read | flags::cause_is_deferred), std::make_pair(enum_type::write, flags::cause_is_write), @@ -29,9 +28,9 @@ namespace rsx } if (cause == enum_type::superseded_by_fbo && - g_cfg.video.strict_texture_flushing) [[ unlikely ]] + g_cfg.video.strict_texture_flushing) [[unlikely]] { m_flag_bits &= ~flags::cause_skips_flush; } } -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_types.h b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_types.h index 77ba88d0b..323818ab4 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_types.h +++ b/rpcs3/rpcs3/Emu/RSX/Common/texture_cache_types.h @@ -7,9 +7,9 @@ namespace rsx */ enum invalidation_chain_policy { - invalidation_chain_none, // No chaining: Only sections that overlap the faulting page get invalidated. - invalidation_chain_full, // Full chaining: Sections overlapping the faulting page get invalidated, as well as any sections overlapping invalidated sections. - invalidation_chain_nearby // Invalidations chain if they are near to the fault (m_data.begin()), - idx(0) + iterator_tmpl(block_list* _block) : block(_block), + list_it(_block->m_data.begin()), + idx(0) { if (_block->empty()) idx = u32{umax}; @@ -79,7 +78,7 @@ namespace rsx private: // Members - block_list *block; + block_list* block; list_iterator list_it = {}; size_type idx = u32{umax}; size_type array_idx = 0; @@ -102,11 +101,29 @@ namespace rsx } public: - inline reference operator*() const { return (*list_it)[array_idx]; } - inline pointer operator->() const { return &((*list_it)[array_idx]); } - inline reference operator++() { next(); return **this; } - inline reference operator++(int) { auto &res = **this; next(); return res; } - inline bool operator==(const iterator_tmpl &rhs) const { return idx == rhs.idx; } + inline reference operator*() const + { + return (*list_it)[array_idx]; + } + inline pointer operator->() const + { + return &((*list_it)[array_idx]); + } + inline reference operator++() + { + next(); + return **this; + } + inline reference operator++(int) + { + auto& res = **this; + next(); + return res; + } + inline bool operator==(const iterator_tmpl& rhs) const + { + return idx == rhs.idx; + } }; using iterator = iterator_tmpl; @@ -133,17 +150,29 @@ namespace rsx public: // Constructor, Destructor - ranged_storage_block_list() : - m_data_it(m_data.end()), - m_array_idx(-1), - m_capacity(0) - {} + ranged_storage_block_list() : m_data_it(m_data.end()), + m_array_idx(-1), + m_capacity(0) + { + } // Iterator - inline iterator begin() noexcept { return { this }; } - inline const_iterator begin() const noexcept { return { this }; } - constexpr iterator end() noexcept { return {}; } - constexpr const_iterator end() const noexcept { return {}; } + inline iterator begin() noexcept + { + return {this}; + } + inline const_iterator begin() const noexcept + { + return {this}; + } + constexpr iterator end() noexcept + { + return {}; + } + constexpr const_iterator end() const noexcept + { + return {}; + } // Operators inline value_type& front() @@ -159,9 +188,18 @@ namespace rsx } // Other operations on data - inline size_type size() const { return m_size; } - inline size_type capacity() const { return m_capacity; } - inline bool empty() const { return m_size == 0; } + inline size_type size() const + { + return m_size; + } + inline size_type capacity() const + { + return m_capacity; + } + inline bool empty() const + { + return m_size == 0; + } inline void clear() { @@ -181,13 +219,14 @@ namespace rsx inline void reserve(size_type new_size) { - if (new_size <= m_capacity) return; + if (new_size <= m_capacity) + return; size_type new_num_arrays = ((new_size - 1) / array_size) + 1; m_data.reserve(new_num_arrays); m_capacity = new_num_arrays * array_size; } - template + template inline value_type& emplace_back(Args&&... args) { if (m_array_idx >= array_size) @@ -197,14 +236,13 @@ namespace rsx ensure(m_capacity > 0 && m_array_idx < array_size && m_data_it != m_data.end()); - value_type *dest = &((*m_data_it)[m_array_idx++]); + value_type* dest = &((*m_data_it)[m_array_idx++]); new (dest) value_type(std::forward(args)...); ++m_size; return *dest; } }; - /** * Ranged storage */ @@ -216,7 +254,7 @@ namespace rsx using section_storage_type = typename ranged_storage_type::section_storage_type; using texture_cache_type = typename ranged_storage_type::texture_cache_type; - //using block_container_type = std::list; + // using block_container_type = std::list; using block_container_type = ranged_storage_block_list; using iterator = typename block_container_type::iterator; using const_iterator = typename block_container_type::const_iterator; @@ -238,21 +276,21 @@ namespace rsx atomic_t exists_count = 0; atomic_t locked_count = 0; atomic_t unreleased_count = 0; - ranged_storage_type *m_storage = nullptr; + ranged_storage_type* m_storage = nullptr; - inline void add_owned_section_overlaps(section_storage_type §ion) + inline void add_owned_section_overlaps(section_storage_type& section) { u32 end = section.get_section_range().end; - for (auto *block = next_block(); block != nullptr && end >= block->get_start(); block = block->next_block()) + for (auto* block = next_block(); block != nullptr && end >= block->get_start(); block = block->next_block()) { block->add_unowned_section(section); } } - inline void remove_owned_section_overlaps(section_storage_type §ion) + inline void remove_owned_section_overlaps(section_storage_type& section) { u32 end = section.get_section_range().end; - for (auto *block = next_block(); block != nullptr && end >= block->get_start(); block = block->next_block()) + for (auto* block = next_block(); block != nullptr && end >= block->get_start(); block = block->next_block()) { block->remove_unowned_section(section); } @@ -262,7 +300,7 @@ namespace rsx // Construction ranged_storage_block() = default; - void initialize(u32 _index, ranged_storage_type *storage) + void initialize(u32 _index, ranged_storage_type* storage) { ensure(m_storage == nullptr && storage != nullptr); AUDIT(index < num_blocks); @@ -277,15 +315,42 @@ namespace rsx /** * Wrappers */ - constexpr iterator begin() noexcept { return sections.begin(); } - constexpr const_iterator begin() const noexcept { return sections.begin(); } - inline iterator end() noexcept { return sections.end(); } - inline const_iterator end() const noexcept { return sections.end(); } - inline bool empty() const { return sections.empty(); } - inline size_type size() const { return sections.size(); } - inline u32 get_exists_count() const { return exists_count; } - inline u32 get_locked_count() const { return locked_count; } - inline u32 get_unreleased_count() const { return unreleased_count; } + constexpr iterator begin() noexcept + { + return sections.begin(); + } + constexpr const_iterator begin() const noexcept + { + return sections.begin(); + } + inline iterator end() noexcept + { + return sections.end(); + } + inline const_iterator end() const noexcept + { + return sections.end(); + } + inline bool empty() const + { + return sections.empty(); + } + inline size_type size() const + { + return sections.size(); + } + inline u32 get_exists_count() const + { + return exists_count; + } + inline u32 get_locked_count() const + { + return locked_count; + } + inline u32 get_unreleased_count() const + { + return unreleased_count; + } /** * Utilities @@ -303,13 +368,13 @@ namespace rsx inline section_storage_type& create_section() { - auto &res = sections.emplace_back(this); + auto& res = sections.emplace_back(this); return res; } inline void clear() { - for (auto §ion : *this) + for (auto& section : *this) { if (section.is_locked()) section.unprotect(); @@ -335,35 +400,55 @@ namespace rsx inline ranged_storage_block* prev_block() const { - if (is_first_block()) return nullptr; + if (is_first_block()) + return nullptr; return &get_storage()[index - 1]; } inline ranged_storage_block* next_block() const { - if (is_last_block()) return nullptr; + if (is_last_block()) + return nullptr; return &get_storage()[index + 1]; } // Address range - inline const address_range& get_range() const { return range; } - inline u32 get_start() const { return range.start; } - inline u32 get_end() const { return range.end; } - inline u32 get_index() const { return index; } - inline bool overlaps(const section_storage_type& section, section_bounds bounds = full_range) const { return section.overlaps(range, bounds); } - inline bool overlaps(const address_range& _range) const { return range.overlaps(_range); } + inline const address_range& get_range() const + { + return range; + } + inline u32 get_start() const + { + return range.start; + } + inline u32 get_end() const + { + return range.end; + } + inline u32 get_index() const + { + return index; + } + inline bool overlaps(const section_storage_type& section, section_bounds bounds = full_range) const + { + return section.overlaps(range, bounds); + } + inline bool overlaps(const address_range& _range) const + { + return range.overlaps(_range); + } /** * Section callbacks */ - inline void on_section_protected(const section_storage_type §ion) + inline void on_section_protected(const section_storage_type& section) { (void)section; // silence unused warning without _AUDIT AUDIT(section.is_locked()); locked_count++; } - inline void on_section_unprotected(const section_storage_type §ion) + inline void on_section_unprotected(const section_storage_type& section) { (void)section; // silence unused warning without _AUDIT AUDIT(!section.is_locked()); @@ -371,21 +456,21 @@ namespace rsx ensure(prev_locked > 0); } - inline void on_section_range_valid(section_storage_type §ion) + inline void on_section_range_valid(section_storage_type& section) { AUDIT(section.valid_range()); AUDIT(range.overlaps(section.get_section_base())); add_owned_section_overlaps(section); } - inline void on_section_range_invalid(section_storage_type §ion) + inline void on_section_range_invalid(section_storage_type& section) { AUDIT(section.valid_range()); AUDIT(range.overlaps(section.get_section_base())); remove_owned_section_overlaps(section); } - inline void on_section_resources_created(const section_storage_type §ion) + inline void on_section_resources_created(const section_storage_type& section) { (void)section; // silence unused warning without _AUDIT AUDIT(section.exists()); @@ -398,7 +483,7 @@ namespace rsx } } - inline void on_section_resources_destroyed(const section_storage_type §ion) + inline void on_section_resources_destroyed(const section_storage_type& section) { (void)section; // silence unused warning without _AUDIT AUDIT(!section.exists()); @@ -412,27 +497,26 @@ namespace rsx } } - void on_section_released(const section_storage_type &/*section*/) + void on_section_released(const section_storage_type& /*section*/) { u32 prev_unreleased = unreleased_count--; ensure(prev_unreleased > 0); } - void on_section_unreleased(const section_storage_type &/*section*/) + void on_section_unreleased(const section_storage_type& /*section*/) { unreleased_count++; } - /** * Overlapping sections */ - inline bool contains_unowned(section_storage_type §ion) const + inline bool contains_unowned(section_storage_type& section) const { return (unowned.find(§ion) != unowned.end()); } - inline void add_unowned_section(section_storage_type §ion) + inline void add_unowned_section(section_storage_type& section) { AUDIT(overlaps(section)); AUDIT(section.get_section_base() < range.start); @@ -440,7 +524,7 @@ namespace rsx unowned.insert(§ion); } - inline void remove_unowned_section(section_storage_type §ion) + inline void remove_unowned_section(section_storage_type& section) { AUDIT(overlaps(section)); AUDIT(section.get_section_base() < range.start); @@ -448,14 +532,28 @@ namespace rsx unowned.erase(§ion); } - inline unowned_iterator unowned_begin() { return unowned.begin(); } - inline unowned_const_iterator unowned_begin() const { return unowned.begin(); } - inline unowned_iterator unowned_end() { return unowned.end(); } - inline unowned_const_iterator unowned_end() const { return unowned.end(); } - inline bool unowned_empty() const { return unowned.empty(); } + inline unowned_iterator unowned_begin() + { + return unowned.begin(); + } + inline unowned_const_iterator unowned_begin() const + { + return unowned.begin(); + } + inline unowned_iterator unowned_end() + { + return unowned.end(); + } + inline unowned_const_iterator unowned_end() const + { + return unowned.end(); + } + inline bool unowned_empty() const + { + return unowned.empty(); + } }; - template class ranged_storage { @@ -463,24 +561,23 @@ namespace rsx static constexpr u32 block_size = 0x100000; static_assert(block_size % 4096u == 0, "block_size must be a multiple of the page size"); static constexpr u32 num_blocks = u32{0x100000000ull / block_size}; - static_assert((num_blocks > 0) && (u64{num_blocks} *block_size == 0x100000000ull), "Invalid block_size/num_blocks"); + static_assert((num_blocks > 0) && (u64{num_blocks} * block_size == 0x100000000ull), "Invalid block_size/num_blocks"); using section_storage_type = typename traits::section_storage_type; - using texture_cache_type = typename traits::texture_cache_base_type; - using block_type = ranged_storage_block; + using texture_cache_type = typename traits::texture_cache_base_type; + using block_type = ranged_storage_block; private: block_type blocks[num_blocks]; - texture_cache_type *m_tex_cache; + texture_cache_type* m_tex_cache; std::unordered_set m_in_use; public: - atomic_t m_unreleased_texture_objects = { 0 }; //Number of invalidated objects not yet freed from memory - atomic_t m_texture_memory_in_use = { 0 }; + atomic_t m_unreleased_texture_objects = {0}; // Number of invalidated objects not yet freed from memory + atomic_t m_texture_memory_in_use = {0}; // Constructor - ranged_storage(texture_cache_type *tex_cache) : - m_tex_cache(tex_cache) + ranged_storage(texture_cache_type* tex_cache) : m_tex_cache(tex_cache) { // Initialize blocks for (u32 i = 0; i < num_blocks; i++) @@ -493,10 +590,22 @@ namespace rsx * Iterators */ - constexpr auto begin() { return std::begin(blocks); } - constexpr auto begin() const { return std::begin(blocks); } - constexpr auto end() { return std::end(blocks); } - constexpr auto end() const { return std::end(blocks); } + constexpr auto begin() + { + return std::begin(blocks); + } + constexpr auto begin() const + { + return std::begin(blocks); + } + constexpr auto end() + { + return std::end(blocks); + } + constexpr auto end() const + { + return std::end(blocks); + } /** * Utilities @@ -511,13 +620,13 @@ namespace rsx return blocks[address / block_size]; } - inline block_type& block_for(const address_range &range) + inline block_type& block_for(const address_range& range) { AUDIT(range.valid()); return block_for(range.start); } - inline block_type& block_for(const section_storage_type §ion) + inline block_type& block_for(const section_storage_type& section) { return block_for(section.get_section_base()); } @@ -534,14 +643,13 @@ namespace rsx return *m_tex_cache; } - /** * Blocks */ void clear() { - for (auto &block : *this) + for (auto& block : *this) { block.clear(); } @@ -632,27 +740,26 @@ namespace rsx } } - /** * Callbacks */ - void on_section_released(const section_storage_type &/*section*/) + void on_section_released(const section_storage_type& /*section*/) { u32 prev_unreleased = m_unreleased_texture_objects--; ensure(prev_unreleased > 0); } - void on_section_unreleased(const section_storage_type &/*section*/) + void on_section_unreleased(const section_storage_type& /*section*/) { m_unreleased_texture_objects++; } - void on_section_resources_created(const section_storage_type §ion) + void on_section_resources_created(const section_storage_type& section) { m_texture_memory_in_use += section.get_section_size(); } - void on_section_resources_destroyed(const section_storage_type §ion) + void on_section_resources_destroyed(const section_storage_type& section) { u64 size = section.get_section_size(); u64 prev_size = m_texture_memory_in_use.fetch_sub(size); @@ -674,29 +781,23 @@ namespace rsx /** * Ranged Iterator */ - // Iterator + // Iterator template class range_iterator_tmpl { public: // Traits using value_type = T; - using pointer = T * ; + using pointer = T*; using difference_type = int; - using reference = T & ; + using reference = T&; using iterator_category = std::forward_iterator_tag; // Constructors range_iterator_tmpl() = default; // end iterator - explicit range_iterator_tmpl(parent_type &storage, const address_range &_range, section_bounds _bounds, bool _locked_only) - : range(_range) - , bounds(_bounds) - , block(&storage.block_for(range.start)) - , unowned_remaining(true) - , unowned_it(block->unowned_begin()) - , cur_block_it(block->begin()) - , locked_only(_locked_only) + explicit range_iterator_tmpl(parent_type& storage, const address_range& _range, section_bounds _bounds, bool _locked_only) + : range(_range), bounds(_bounds), block(&storage.block_for(range.start)), unowned_remaining(true), unowned_it(block->unowned_begin()), cur_block_it(block->begin()), locked_only(_locked_only) { // do a "fake" iteration to ensure the internal state is consistent next(false); @@ -707,7 +808,7 @@ namespace rsx address_range range; section_bounds bounds; - block_type *block = nullptr; + block_type* block = nullptr; bool needs_overlap_check = true; bool unowned_remaining = false; unowned_iterator unowned_it = {}; @@ -793,11 +894,29 @@ namespace rsx } public: - inline reference operator*() const { return *obj; } - inline pointer operator->() const { return obj; } - inline reference operator++() { next(); return *obj; } - inline reference operator++(int) { auto *ptr = obj; next(); return *ptr; } - inline bool operator==(const range_iterator_tmpl &rhs) const { return obj == rhs.obj && unowned_remaining == rhs.unowned_remaining; } + inline reference operator*() const + { + return *obj; + } + inline pointer operator->() const + { + return obj; + } + inline reference operator++() + { + next(); + return *obj; + } + inline reference operator++(int) + { + auto* ptr = obj; + next(); + return *ptr; + } + inline bool operator==(const range_iterator_tmpl& rhs) const + { + return obj == rhs.obj && unowned_remaining == rhs.unowned_remaining; + } inline void set_end(u32 new_end) { @@ -825,15 +944,18 @@ namespace rsx using range_iterator = range_iterator_tmpl; using range_const_iterator = range_iterator_tmpl; - inline range_iterator range_begin(const address_range &range, section_bounds bounds, bool locked_only = false) { + inline range_iterator range_begin(const address_range& range, section_bounds bounds, bool locked_only = false) + { return range_iterator(*this, range, bounds, locked_only); } - inline range_const_iterator range_begin(const address_range &range, section_bounds bounds, bool locked_only = false) const { + inline range_const_iterator range_begin(const address_range& range, section_bounds bounds, bool locked_only = false) const + { return range_const_iterator(*this, range, bounds, locked_only); } - inline range_const_iterator range_begin(u32 address, section_bounds bounds, bool locked_only = false) const { + inline range_const_iterator range_begin(u32 address, section_bounds bounds, bool locked_only = false) const + { return range_const_iterator(*this, address_range::start_length(address, 1), bounds, locked_only); } @@ -859,9 +981,9 @@ namespace rsx tex_cache_checker.reset_refcount(); // Go through all blocks and update calculated values - for (auto &block : *this) + for (auto& block : *this) { - for (auto &tex : block) + for (auto& tex : block) { if (tex.is_locked()) { @@ -874,8 +996,7 @@ namespace rsx // Verify tex_cache_checker.verify(); } -#endif //TEXTURE_CACHE_DEBUG - +#endif // TEXTURE_CACHE_DEBUG }; class buffered_section @@ -892,10 +1013,9 @@ namespace rsx bool locked = false; void init_lockable_range(const address_range& range); - u64 fast_hash_internal() const; + u64 fast_hash_internal() const; public: - buffered_section() = default; ~buffered_section() = default; @@ -964,8 +1084,8 @@ namespace rsx } /** - * Utilities - */ + * Utilities + */ inline bool valid_range() const { return cpu_range.valid(); @@ -1000,9 +1120,9 @@ namespace rsx const std::pair get_confirmed_range_delta() const { if (!confirmed_range.valid()) - return { 0, cpu_range.length() }; + return {0, cpu_range.length()}; - return { confirmed_range.start - cpu_range.start, confirmed_range.length() }; + return {confirmed_range.start - cpu_range.start, confirmed_range.length()}; } inline bool matches(const address_range& range) const @@ -1037,17 +1157,17 @@ namespace rsx class cached_texture_section : public rsx::buffered_section, public rsx::ref_counted { public: - using ranged_storage_type = ranged_storage; + using ranged_storage_type = ranged_storage; using ranged_storage_block_type = ranged_storage_block; - using texture_cache_type = typename traits::texture_cache_base_type; - using predictor_type = texture_cache_predictor; - using predictor_key_type = typename predictor_type::key_type; - using predictor_entry_type = typename predictor_type::mapped_type; + using texture_cache_type = typename traits::texture_cache_base_type; + using predictor_type = texture_cache_predictor; + using predictor_key_type = typename predictor_type::key_type; + using predictor_entry_type = typename predictor_type::mapped_type; protected: - ranged_storage_type *m_storage = nullptr; - ranged_storage_block_type *m_block = nullptr; - texture_cache_type *m_tex_cache = nullptr; + ranged_storage_type* m_storage = nullptr; + ranged_storage_block_type* m_block = nullptr; + texture_cache_type* m_tex_cache = nullptr; private: constexpr derived_type* derived() @@ -1065,7 +1185,6 @@ namespace rsx bool triggered_unreleased_callbacks = false; protected: - u16 width; u16 height; u16 depth; @@ -1090,9 +1209,9 @@ namespace rsx address_range_vector flush_exclusions; // Address ranges that will be skipped during flush - predictor_type *m_predictor = nullptr; + predictor_type* m_predictor = nullptr; usz m_predictor_key_hash = 0; - predictor_entry_type *m_predictor_entry = nullptr; + predictor_entry_type* m_predictor_entry = nullptr; public: u64 cache_tag = 0; @@ -1104,12 +1223,12 @@ namespace rsx } cached_texture_section() = default; - cached_texture_section(ranged_storage_block_type *block) + cached_texture_section(ranged_storage_block_type* block) { initialize(block); } - void initialize(ranged_storage_block_type *block) + void initialize(ranged_storage_block_type* block) { ensure(m_block == nullptr && m_tex_cache == nullptr && m_storage == nullptr); m_block = block; @@ -1120,11 +1239,10 @@ namespace rsx update_unreleased(); } - /** * Reset */ - void reset(const address_range &memory_range) + void reset(const address_range& memory_range) { AUDIT(memory_range.valid()); AUDIT(!is_locked()); @@ -1184,7 +1302,10 @@ namespace rsx /** * Destroyed Flag */ - inline bool is_destroyed() const { return !exists(); } // this section is currently destroyed + inline bool is_destroyed() const + { + return !exists(); + } // this section is currently destroyed protected: void on_section_resources_created() @@ -1192,7 +1313,8 @@ namespace rsx AUDIT(exists()); AUDIT(valid_range()); - if (triggered_exists_callbacks) return; + if (triggered_exists_callbacks) + return; triggered_exists_callbacks = true; // Callbacks @@ -1202,7 +1324,8 @@ namespace rsx void on_section_resources_destroyed() { - if (!triggered_exists_callbacks) return; + if (!triggered_exists_callbacks) + return; triggered_exists_callbacks = false; AUDIT(valid_range()); @@ -1221,13 +1344,17 @@ namespace rsx } virtual void dma_abort() - {} + { + } public: /** * Dirty/Unreleased Flag */ - inline bool is_dirty() const { return dirty; } // this section is dirty and will need to be reuploaded + inline bool is_dirty() const + { + return dirty; + } // this section is dirty and will need to be reuploaded void set_dirty(bool new_dirty) { @@ -1260,7 +1387,6 @@ namespace rsx } } - /** * Valid Range */ @@ -1271,7 +1397,7 @@ namespace rsx // Callbacks m_block->on_section_range_valid(*derived()); - //m_storage->on_section_range_valid(*derived()); + // m_storage->on_section_range_valid(*derived()); // Reset texture_cache m_flush_always_cache if (readback_behaviour == memory_read_flags::flush_always) @@ -1293,7 +1419,7 @@ namespace rsx // Notify the storage block that we are now invalid m_block->on_section_range_invalid(*derived()); - //m_storage->on_section_range_invalid(*derived()); + // m_storage->on_section_range_invalid(*derived()); m_predictor_entry = nullptr; speculatively_flushed = false; @@ -1321,7 +1447,7 @@ namespace rsx bool is_flushable() const { - //This section is active and can be flushed to cpu + // This section is active and can be flushed to cpu return (get_protection() == utils::protection::no); } @@ -1393,7 +1519,6 @@ namespace rsx } public: - inline void protect(utils::protection prot) { utils::protection old_prot = get_protection(); @@ -1435,7 +1560,7 @@ namespace rsx dma_abort(); } - //Reset properties and protect again + // Reset properties and protect again flushed = false; synchronized = false; sync_timestamp = 0ull; @@ -1451,7 +1576,7 @@ namespace rsx dma_abort(); } - //Reset properties and protect again + // Reset properties and protect again flushed = false; synchronized = false; sync_timestamp = 0ull; @@ -1529,14 +1654,13 @@ namespace rsx return true; } - /** * Flush */ private: void imp_flush_memcpy(u32 vm_dst, u8* src, u32 len) const { - u8 *dst = get_ptr(vm_dst); + u8* dst = get_ptr(vm_dst); address_range copy_range = address_range::start_length(vm_dst, len); if (flush_exclusions.empty() || !copy_range.overlaps(flush_exclusions)) @@ -1575,7 +1699,7 @@ namespace rsx ensure(real_pitch > 0); // Calculate valid range - const auto valid_range = get_confirmed_range(); + const auto valid_range = get_confirmed_range(); AUDIT(valid_range.valid()); const auto valid_length = valid_range.length(); const auto valid_offset = valid_range.start - get_section_base(); @@ -1606,7 +1730,7 @@ namespace rsx } // Obtain pointers to the source and destination memory regions - u8 *src = static_cast(derived()->map_synchronized(mapped_offset, mapped_length)); + u8* src = static_cast(derived()->map_synchronized(mapped_offset, mapped_length)); u32 dst = valid_range.start; ensure(src != nullptr); @@ -1617,7 +1741,7 @@ namespace rsx } else { - u8 *_src = src; + u8* _src = src; u32 _dst = dst; const auto num_exclusions = flush_exclusions.size(); @@ -1635,12 +1759,12 @@ namespace rsx } } - public: // Returns false if there was a cache miss void flush() { - if (flushed) return; + if (flushed) + return; // Sanity checks ensure(exists()); @@ -1804,7 +1928,7 @@ namespace rsx /** * Comparison */ - inline bool matches(const address_range &memory_range) const + inline bool matches(const address_range& memory_range) const { return valid_range() && rsx::buffered_section::matches(memory_range); } @@ -1857,7 +1981,6 @@ namespace rsx return matches(format, width, height, depth, mipmaps); } - /** * Derived wrappers */ diff --git a/rpcs3/rpcs3/Emu/RSX/Common/tiled_dma_copy.hpp b/rpcs3/rpcs3/Emu/RSX/Common/tiled_dma_copy.hpp index f336ec30a..1867526c2 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/tiled_dma_copy.hpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/tiled_dma_copy.hpp @@ -51,7 +51,7 @@ namespace rsx // 2. Calculate bank selector // There's a lot of weird math here, but it's just a variant of (tile_selector % 4) to pick a value between [0..3] uint32_t bank_selector = 0; - const uint32_t bank_distribution_lookup[16] = { 0, 1, 2, 3, 2, 3, 0, 1, 1, 2, 3, 0, 3, 0, 1, 2 }; + const uint32_t bank_distribution_lookup[16] = {0, 1, 2, 3, 2, 3, 0, 1, 1, 2, 3, 0, 3, 0, 1, 2}; if (conf.factor == 1) { @@ -133,14 +133,14 @@ namespace rsx const uint32_t base = (pitch >> 8); if ((pitch & (pitch - 1)) == 0) { - return { 1u, base }; + return {1u, base}; } - for (const auto prime : { 3, 5, 7, 11, 13 }) + for (const auto prime : {3, 5, 7, 11, 13}) { if ((base % prime) == 0) { - return { prime, base / prime }; + return {prime, base / prime}; } } @@ -168,8 +168,7 @@ namespace rsx .image_width = image_width, .image_height = image_height, .image_pitch = row_pitch_in_bytes, - .image_bpp = sizeof(T) - }; + .image_bpp = sizeof(T)}; for (u16 row = 0; row < image_height; ++row) { @@ -196,4 +195,4 @@ namespace rsx #undef RSX_TILE_HEIGHT #undef RSX_DMA_OP_ENCODE_TILE #undef RSX_DMA_OP_DECODE_TILE -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Common/unordered_map.hpp b/rpcs3/rpcs3/Emu/RSX/Common/unordered_map.hpp index 941217f33..90d6f69c1 100644 --- a/rpcs3/rpcs3/Emu/RSX/Common/unordered_map.hpp +++ b/rpcs3/rpcs3/Emu/RSX/Common/unordered_map.hpp @@ -5,7 +5,7 @@ namespace rsx { - template + template using unordered_map = std::unordered_map; } #else @@ -13,7 +13,7 @@ namespace rsx namespace rsx { - template + template using unordered_map = ::robin_hood::unordered_map; } #endif diff --git a/rpcs3/rpcs3/Emu/RSX/Core/RSXContext.cpp b/rpcs3/rpcs3/Emu/RSX/Core/RSXContext.cpp index 3d770b8ce..a81a04cdd 100644 --- a/rpcs3/rpcs3/Emu/RSX/Core/RSXContext.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Core/RSXContext.cpp @@ -32,7 +32,7 @@ namespace rsx if (range.inside(tile_range)) { ensure(tile_base_address + 1); - return { .base_address = tile_base_address, .tile = &tile }; + return {.base_address = tile_base_address, .tile = &tile}; } } @@ -47,4 +47,4 @@ namespace rsx return utils::address_range::start_length(start_offset + base_address, end_offset - start_offset); } -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Core/RSXContext.h b/rpcs3/rpcs3/Emu/RSX/Core/RSXContext.h index 3b69d569a..7d611b8a6 100644 --- a/rpcs3/rpcs3/Emu/RSX/Core/RSXContext.h +++ b/rpcs3/rpcs3/Emu/RSX/Core/RSXContext.h @@ -33,26 +33,26 @@ namespace rsx struct GCM_context { RsxDmaControl* ctrl = nullptr; - u32 dma_address{ 0 }; + u32 dma_address{0}; rsx_iomap_table iomap_table; GcmTileInfo tiles[gcm::limits::tiles_count]; GcmZcullInfo zculls[gcm::limits::zculls_count]; RsxDisplayInfo display_buffers[8]; - u32 display_buffers_count{ 0 }; - u32 current_display_buffer{ 0 }; + u32 display_buffers_count{0}; + u32 current_display_buffer{0}; shared_mutex sys_rsx_mtx; - u32 device_addr{ 0 }; - u32 label_addr{ 0 }; - u32 main_mem_size{ 0 }; - u32 local_mem_size{ 0 }; - u32 rsx_event_port{ 0 }; - u32 driver_info{ 0 }; + u32 device_addr{0}; + u32 label_addr{0}; + u32 main_mem_size{0}; + u32 local_mem_size{0}; + u32 rsx_event_port{0}; + u32 driver_info{0}; atomic_t unsent_gcm_events = 0; // Unsent event bits when aborting RSX/VBLANK thread (will be sent on savestate load) GCM_tile_reference get_tiled_memory_region(const utils::address_range& range) const; }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Core/RSXDisplay.cpp b/rpcs3/rpcs3/Emu/RSX/Core/RSXDisplay.cpp index e263a945e..2ea56da63 100644 --- a/rpcs3/rpcs3/Emu/RSX/Core/RSXDisplay.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Core/RSXDisplay.cpp @@ -21,7 +21,7 @@ namespace rsx framebuffer_dimensions_t framebuffer_dimensions_t::make(u16 width, u16 height, rsx::surface_antialiasing aa) { - framebuffer_dimensions_t result { .width = width, .height = height }; + framebuffer_dimensions_t result{.width = width, .height = height}; switch (aa) { case rsx::surface_antialiasing::center_1_sample: @@ -84,7 +84,7 @@ namespace rsx { messages.sort(FN(x.samples > y.samples)); return real_stats[messages.front().id] - .to_string(g_cfg.video.antialiasing_level == msaa_level::none); + .to_string(g_cfg.video.antialiasing_level == msaa_level::none); } if (messages.size() > 1) @@ -100,8 +100,8 @@ namespace rsx } const auto text = messages - .sort(FN(static_cast(x.aa_mode) > static_cast(y.aa_mode))) - .map(FN(real_stats[x.id].to_string())); + .sort(FN(static_cast(x.aa_mode) > static_cast(y.aa_mode))) + .map(FN(real_stats[x.id].to_string())); return fmt::merge(text, ", "); } -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Core/RSXDisplay.h b/rpcs3/rpcs3/Emu/RSX/Core/RSXDisplay.h index 77407f2f1..112463b3d 100644 --- a/rpcs3/rpcs3/Emu/RSX/Core/RSXDisplay.h +++ b/rpcs3/rpcs3/Emu/RSX/Core/RSXDisplay.h @@ -24,7 +24,7 @@ namespace rsx return static_cast(width) * height * samples_x * samples_y; } - inline bool operator > (const framebuffer_dimensions_t& that) const + inline bool operator>(const framebuffer_dimensions_t& that) const { return samples_total() > that.samples_total(); } @@ -124,4 +124,4 @@ namespace rsx vblank_thread& operator=(thread_state); vblank_thread& operator=(const vblank_thread&) = delete; }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Core/RSXDrawCommands.cpp b/rpcs3/rpcs3/Emu/RSX/Core/RSXDrawCommands.cpp index 9d218edb8..05514f6a3 100644 --- a/rpcs3/rpcs3/Emu/RSX/Core/RSXDrawCommands.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Core/RSXDrawCommands.cpp @@ -36,7 +36,7 @@ namespace rsx { // Stride must be updated even if the stream is disabled info.attribute_stride += rsx::get_vertex_type_size_on_host(vinfo.type(), vinfo.size()); - info.locations.push_back({ index, false, 1 }); + info.locations.push_back({index, false, 1}); if (input_mask & (1u << index)) { @@ -64,7 +64,7 @@ namespace rsx result.interleaved_blocks.reserve(16); result.referenced_registers.reserve(16); - for (auto [ref_mask, index] = std::tuple{ input_mask, u8(0) }; ref_mask; ++index, ref_mask >>= 1) + for (auto [ref_mask, index] = std::tuple{input_mask, u8(0)}; ref_mask; ++index, ref_mask >>= 1) { ensure(index < rsx::limits::vertex_count); @@ -159,7 +159,7 @@ namespace rsx } alloc_new_block = false; - block->locations.push_back({ index, modulo, info.frequency() }); + block->locations.push_back({index, modulo, info.frequency()}); block->interleaved = true; break; } @@ -171,7 +171,7 @@ namespace rsx block.attribute_stride = info.stride(); block.memory_location = info.offset() >> 31; block.locations.reserve(16); - block.locations.push_back({ index, modulo, info.frequency() }); + block.locations.push_back({index, modulo, info.frequency()}); if (block.attribute_stride == 0) { @@ -193,10 +193,10 @@ namespace rsx std::span draw_command_processor::get_raw_index_array(const draw_clause& draw_indexed_clause) const { - if (!m_element_push_buffer.empty()) [[ unlikely ]] + if (!m_element_push_buffer.empty()) [[unlikely]] { // Indices provided via immediate mode - return { reinterpret_cast(m_element_push_buffer.data()), ::narrow(m_element_push_buffer.size() * sizeof(u32)) }; + return {reinterpret_cast(m_element_push_buffer.data()), ::narrow(m_element_push_buffer.size() * sizeof(u32))}; } const rsx::index_array_type type = REGS(m_ctx)->index_type(); @@ -209,18 +209,16 @@ namespace rsx const u32 count = draw_indexed_clause.get_elements_count(); const auto ptr = vm::_ptr(address); - return { ptr + first * type_size, count * type_size }; + return {ptr + first * type_size, count * type_size}; } std::variant - draw_command_processor::get_draw_command(const rsx::rsx_state& state) const + draw_command_processor::get_draw_command(const rsx::rsx_state& state) const { - if (REGS(m_ctx)->current_draw_clause.command == rsx::draw_command::indexed) [[ likely ]] + if (REGS(m_ctx)->current_draw_clause.command == rsx::draw_command::indexed) [[likely]] { - return draw_indexed_array_command - { - get_raw_index_array(state.current_draw_clause) - }; + return draw_indexed_array_command{ + get_raw_index_array(state.current_draw_clause)}; } if (REGS(m_ctx)->current_draw_clause.command == rsx::draw_command::array) @@ -276,8 +274,8 @@ namespace rsx { for (auto& push_buf : m_vertex_push_buffers) { - //Disabled, see https://github.com/RPCS3/rpcs3/issues/1932 - //REGS(m_ctx)->register_vertex_info[index].size = 0; + // Disabled, see https://github.com/RPCS3/rpcs3/issues/1932 + // REGS(m_ctx)->register_vertex_info[index].size = 0; push_buf.clear(); } @@ -573,8 +571,10 @@ namespace rsx float scale_y = REGS(m_ctx)->viewport_scale_y() / (clip_h / 2.f); float offset_y = (REGS(m_ctx)->viewport_offset_y() - (clip_h / 2.f)); offset_y /= clip_h / 2.f; - if (flip_y) scale_y *= -1; - if (flip_y) offset_y *= -1; + if (flip_y) + scale_y *= -1; + if (flip_y) + offset_y *= -1; const float scale_z = REGS(m_ctx)->viewport_scale_z(); const float offset_z = REGS(m_ctx)->viewport_offset_z(); @@ -589,14 +589,14 @@ namespace rsx void draw_command_processor::fill_user_clip_data(void* buffer) const { const rsx::user_clip_plane_op clip_plane_control[6] = - { - REGS(m_ctx)->clip_plane_0_enabled(), - REGS(m_ctx)->clip_plane_1_enabled(), - REGS(m_ctx)->clip_plane_2_enabled(), - REGS(m_ctx)->clip_plane_3_enabled(), - REGS(m_ctx)->clip_plane_4_enabled(), - REGS(m_ctx)->clip_plane_5_enabled(), - }; + { + REGS(m_ctx)->clip_plane_0_enabled(), + REGS(m_ctx)->clip_plane_1_enabled(), + REGS(m_ctx)->clip_plane_2_enabled(), + REGS(m_ctx)->clip_plane_3_enabled(), + REGS(m_ctx)->clip_plane_4_enabled(), + REGS(m_ctx)->clip_plane_5_enabled(), + }; u8 data_block[64]; s32* clip_enabled_flags = reinterpret_cast(data_block); @@ -631,12 +631,12 @@ namespace rsx } /** - * Fill buffer with vertex program constants. - * Buffer must be at least 512 float4 wide. - */ + * Fill buffer with vertex program constants. + * Buffer must be at least 512 float4 wide. + */ void draw_command_processor::fill_vertex_program_constants_data(void* buffer, const std::span& reloc_table) const { - if (!reloc_table.empty()) [[ likely ]] + if (!reloc_table.empty()) [[likely]] { char* dst = reinterpret_cast(buffer); for (const auto& index : reloc_table) @@ -804,9 +804,7 @@ namespace rsx continue; } - const int translated_offset = full_reupload - ? instance_config.patch_load_offset - : prog->translate_constants_range(instance_config.patch_load_offset, instance_config.patch_load_count); + const int translated_offset = full_reupload ? instance_config.patch_load_offset : prog->translate_constants_range(instance_config.patch_load_offset, instance_config.patch_load_count); if (translated_offset >= 0) { @@ -817,8 +815,8 @@ namespace rsx // Update indirection table for (auto i = translated_offset, count = 0; - static_cast(count) < instance_config.patch_load_count; - ++i, ++count) + static_cast(count) < instance_config.patch_load_count; + ++i, ++count) { instancing_indirection_table[i] = redirection_loc + count; } @@ -857,4 +855,4 @@ namespace rsx constants_data_array_buffer.reserve(constants_data.size_bytes()); std::memcpy(constants_data_array_buffer.data(), constants_data.data(), constants_data.size_bytes()); } -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Core/RSXDrawCommands.h b/rpcs3/rpcs3/Emu/RSX/Core/RSXDrawCommands.h index 5bc5991a1..59cc17c95 100644 --- a/rpcs3/rpcs3/Emu/RSX/Core/RSXDrawCommands.h +++ b/rpcs3/rpcs3/Emu/RSX/Core/RSXDrawCommands.h @@ -44,7 +44,7 @@ namespace rsx // Get compiled draw command for backend rendering std::variant - get_draw_command(const rsx::rsx_state& state) const; + get_draw_command(const rsx::rsx_state& state) const; // Push-buffers for immediate rendering (begin-end scopes) void append_to_push_buffer(u32 attribute, u32 size, u32 subreg_index, vertex_base_type type, u32 value); @@ -92,9 +92,9 @@ namespace rsx void fill_user_clip_data(void* buffer) const; /** - * Fill buffer with vertex program constants. - * Relocation table allows to do a partial fill with only selected registers. - */ + * Fill buffer with vertex program constants. + * Relocation table allows to do a partial fill with only selected registers. + */ void fill_vertex_program_constants_data(void* buffer, const std::span& reloc_table) const; /** @@ -107,4 +107,4 @@ namespace rsx // Returns offsets to the index redirection lookup table and constants field array void fill_constants_instancing_buffer(rsx::io_buffer& indirection_table_buf, rsx::io_buffer& constants_data_array_buffer, const VertexProgramBase* prog) const; }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Core/RSXDriverState.h b/rpcs3/rpcs3/Emu/RSX/Core/RSXDriverState.h index 16dd08c78..3b394eaac 100644 --- a/rpcs3/rpcs3/Emu/RSX/Core/RSXDriverState.h +++ b/rpcs3/rpcs3/Emu/RSX/Core/RSXDriverState.h @@ -6,39 +6,39 @@ namespace rsx { enum pipeline_state : u32 { - fragment_program_ucode_dirty = (1 << 0), // Fragment program ucode changed - vertex_program_ucode_dirty = (1 << 1), // Vertex program ucode changed - fragment_program_state_dirty = (1 << 2), // Fragment program state changed - vertex_program_state_dirty = (1 << 3), // Vertex program state changed - fragment_state_dirty = (1 << 4), // Fragment state changed (alpha test, etc) - vertex_state_dirty = (1 << 5), // Vertex state changed (scale_offset, clip planes, etc) - transform_constants_dirty = (1 << 6), // Transform constants changed - fragment_constants_dirty = (1 << 7), // Fragment constants changed - framebuffer_reads_dirty = (1 << 8), // Framebuffer contents changed - fragment_texture_state_dirty = (1 << 9), // Fragment texture parameters changed - vertex_texture_state_dirty = (1 << 10), // Fragment texture parameters changed - scissor_config_state_dirty = (1 << 11), // Scissor region changed - zclip_config_state_dirty = (1 << 12), // Viewport Z clip changed + fragment_program_ucode_dirty = (1 << 0), // Fragment program ucode changed + vertex_program_ucode_dirty = (1 << 1), // Vertex program ucode changed + fragment_program_state_dirty = (1 << 2), // Fragment program state changed + vertex_program_state_dirty = (1 << 3), // Vertex program state changed + fragment_state_dirty = (1 << 4), // Fragment state changed (alpha test, etc) + vertex_state_dirty = (1 << 5), // Vertex state changed (scale_offset, clip planes, etc) + transform_constants_dirty = (1 << 6), // Transform constants changed + fragment_constants_dirty = (1 << 7), // Fragment constants changed + framebuffer_reads_dirty = (1 << 8), // Framebuffer contents changed + fragment_texture_state_dirty = (1 << 9), // Fragment texture parameters changed + vertex_texture_state_dirty = (1 << 10), // Fragment texture parameters changed + scissor_config_state_dirty = (1 << 11), // Scissor region changed + zclip_config_state_dirty = (1 << 12), // Viewport Z clip changed - scissor_setup_invalid = (1 << 13), // Scissor configuration is broken - scissor_setup_clipped = (1 << 14), // Scissor region is cropped by viewport constraint + scissor_setup_invalid = (1 << 13), // Scissor configuration is broken + scissor_setup_clipped = (1 << 14), // Scissor region is cropped by viewport constraint - polygon_stipple_pattern_dirty = (1 << 15), // Rasterizer stippling pattern changed - line_stipple_pattern_dirty = (1 << 16), // Line stippling pattern changed + polygon_stipple_pattern_dirty = (1 << 15), // Rasterizer stippling pattern changed + line_stipple_pattern_dirty = (1 << 16), // Line stippling pattern changed - push_buffer_arrays_dirty = (1 << 17), // Push buffers have data written to them (immediate mode vertex buffers) + push_buffer_arrays_dirty = (1 << 17), // Push buffers have data written to them (immediate mode vertex buffers) - polygon_offset_state_dirty = (1 << 18), // Polygon offset config was changed - depth_bounds_state_dirty = (1 << 19), // Depth bounds configuration changed + polygon_offset_state_dirty = (1 << 18), // Polygon offset config was changed + depth_bounds_state_dirty = (1 << 19), // Depth bounds configuration changed - pipeline_config_dirty = (1 << 20), // Generic pipeline configuration changes. Shader peek hint. + pipeline_config_dirty = (1 << 20), // Generic pipeline configuration changes. Shader peek hint. - rtt_config_dirty = (1 << 21), // Render target configuration changed - rtt_config_contested = (1 << 22), // Render target configuration is indeterminate - rtt_config_valid = (1 << 23), // Render target configuration is valid - rtt_cache_state_dirty = (1 << 24), // Texture cache state is indeterminate + rtt_config_dirty = (1 << 21), // Render target configuration changed + rtt_config_contested = (1 << 22), // Render target configuration is indeterminate + rtt_config_valid = (1 << 23), // Render target configuration is valid + rtt_cache_state_dirty = (1 << 24), // Texture cache state is indeterminate - xform_instancing_state_dirty = (1 << 25), // Transform instancing state has changed + xform_instancing_state_dirty = (1 << 25), // Transform instancing state has changed // TODO - Should signal that we simply need to do a FP compare before the next draw call and invalidate the ucode if the content has changed. // Marking as dirty to invalidate hot cache also works, it's not like there's tons of barriers per frame anyway. diff --git a/rpcs3/rpcs3/Emu/RSX/Core/RSXEngLock.hpp b/rpcs3/rpcs3/Emu/RSX/Core/RSXEngLock.hpp index 8c50e38f1..c4491a12c 100644 --- a/rpcs3/rpcs3/Emu/RSX/Core/RSXEngLock.hpp +++ b/rpcs3/rpcs3/Emu/RSX/Core/RSXEngLock.hpp @@ -11,7 +11,7 @@ namespace rsx public: eng_lock(rsx::thread* target) - :pthr(target) + : pthr(target) { if (pthr->is_current_thread()) { @@ -25,7 +25,8 @@ namespace rsx ~eng_lock() { - if (pthr) pthr->unpause(); + if (pthr) + pthr->unpause(); } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Core/RSXFrameBuffer.h b/rpcs3/rpcs3/Emu/RSX/Core/RSXFrameBuffer.h index fc623fd36..4be5bb3bf 100644 --- a/rpcs3/rpcs3/Emu/RSX/Core/RSXFrameBuffer.h +++ b/rpcs3/rpcs3/Emu/RSX/Core/RSXFrameBuffer.h @@ -39,4 +39,4 @@ namespace rsx u32 aa_factors[2]; bool ignore_change; }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Core/RSXIOMap.hpp b/rpcs3/rpcs3/Emu/RSX/Core/RSXIOMap.hpp index 46d749c13..cacc39e13 100644 --- a/rpcs3/rpcs3/Emu/RSX/Core/RSXIOMap.hpp +++ b/rpcs3/rpcs3/Emu/RSX/Core/RSXIOMap.hpp @@ -15,7 +15,8 @@ namespace rsx io_lock(shared_mutex& obj) : ref(obj) - {} + { + } bool try_lock() { @@ -38,7 +39,7 @@ namespace rsx ref.lock(); } }; - } + } // namespace iomap_helper struct rsx_iomap_table { @@ -60,7 +61,8 @@ namespace rsx template bool lock(u32 addr, u32 len, cpu_thread* self = nullptr) noexcept { - if (len <= 1) return false; + if (len <= 1) + return false; const u32 end = addr + len - 1; bool added_wait = false; @@ -69,7 +71,7 @@ namespace rsx { auto mutex_ = iomap_helper::io_lock(rs[block]); - if (!mutex_.try_lock()) [[ unlikely ]] + if (!mutex_.try_lock()) [[unlikely]] { if (self) { @@ -116,4 +118,4 @@ namespace rsx } } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Core/RSXReservationLock.hpp b/rpcs3/rpcs3/Emu/RSX/Core/RSXReservationLock.hpp index 06ae47796..52cfb93dd 100644 --- a/rpcs3/rpcs3/Emu/RSX/Core/RSXReservationLock.hpp +++ b/rpcs3/rpcs3/Emu/RSX/Core/RSXReservationLock.hpp @@ -5,7 +5,7 @@ namespace rsx { - template + template class reservation_lock { u32 addr = 0; @@ -81,8 +81,8 @@ namespace rsx // This check is not perfect but it covers the important cases fast (this check is only an optimization - forcing true disables it) const bool should_update = - (this->addr / rsx_iomap_table::c_lock_stride) != (addr / rsx_iomap_table::c_lock_stride) || // Lock-addr and test-addr have different locks, update - (addr % rsx_iomap_table::c_lock_stride + _length) > rsx_iomap_table::c_lock_stride; // Test range spills beyond our base section + (this->addr / rsx_iomap_table::c_lock_stride) != (addr / rsx_iomap_table::c_lock_stride) || // Lock-addr and test-addr have different locks, update + (addr % rsx_iomap_table::c_lock_stride + _length) > rsx_iomap_table::c_lock_stride; // Test range spills beyond our base section if (!should_update) { @@ -119,4 +119,4 @@ namespace rsx unlock(true); } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Core/RSXVertexTypes.h b/rpcs3/rpcs3/Emu/RSX/Core/RSXVertexTypes.h index 51cad0a4b..69f820e40 100644 --- a/rpcs3/rpcs3/Emu/RSX/Core/RSXVertexTypes.h +++ b/rpcs3/rpcs3/Emu/RSX/Core/RSXVertexTypes.h @@ -58,10 +58,10 @@ namespace rsx { bool interleaved = false; bool single_vertex = false; - u32 base_offset = 0; - u32 real_offset_address = 0; - u8 memory_location = 0; - u8 attribute_stride = 0; + u32 base_offset = 0; + u32 real_offset_address = 0; + u8 memory_location = 0; + u8 attribute_stride = 0; std::pair vertex_range{}; rsx::simple_array locations; @@ -83,10 +83,10 @@ namespace rsx std::array m_blocks_data{}; public: - rsx::simple_array interleaved_blocks{}; // Interleaved blocks to be uploaded as-is - std::vector> volatile_blocks{}; // Volatile data blocks (immediate draw vertex data for example) - rsx::simple_array referenced_registers{}; // Volatile register data - u16 attribute_mask = 0; // ATTRn mask + rsx::simple_array interleaved_blocks{}; // Interleaved blocks to be uploaded as-is + std::vector> volatile_blocks{}; // Volatile data blocks (immediate draw vertex data for example) + rsx::simple_array referenced_registers{}; // Volatile register data + u16 attribute_mask = 0; // ATTRn mask std::array attribute_placement = fill_array(attribute_buffer_placement::none); @@ -174,4 +174,4 @@ namespace rsx return mem; } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/GCM.h b/rpcs3/rpcs3/Emu/RSX/GCM.h index c61e9907a..dfe55f155 100644 --- a/rpcs3/rpcs3/Emu/RSX/GCM.h +++ b/rpcs3/rpcs3/Emu/RSX/GCM.h @@ -21,7 +21,7 @@ struct CellGcmConfig struct CellGcmContextData; -using CellGcmContextCallback = s32 (vm::ptr, u32); +using CellGcmContextCallback = s32(vm::ptr, u32); struct CellGcmContextData { @@ -112,15 +112,13 @@ struct GcmZcullInfo CellGcmZcullInfo pack() const { - CellGcmZcullInfo ret - { - .region = (1<<0) | (zFormat<<4) | (aaFormat<<8), - .size = ((width>>6)<<22) | ((height>>6)<<6), - .start = cullStart&(~0xFFF), + CellGcmZcullInfo ret{ + .region = (1 << 0) | (zFormat << 4) | (aaFormat << 8), + .size = ((width >> 6) << 22) | ((height >> 6) << 6), + .start = cullStart & (~0xFFF), .offset = offset, - .status0 = (zcullDir<<1) | (zcullFormat<<2) | ((sFunc&0xF)<<12) | (sRef<<16) | (sMask<<24), - .status1 = (0x2000<<0) | (0x20<<16) - }; + .status0 = (zcullDir << 1) | (zcullFormat << 2) | ((sFunc & 0xF) << 12) | (sRef << 16) | (sMask << 24), + .status1 = (0x2000 << 0) | (0x20 << 16)}; return ret; } @@ -141,13 +139,11 @@ struct GcmTileInfo CellGcmTileInfo pack() const { - CellGcmTileInfo ret - { + CellGcmTileInfo ret{ .tile = (location + 1) | (bank << 4) | ((offset / 0x10000) << 16) | (location << 31), .limit = ((offset + size - 1) / 0x10000) << 16 | (location << 31), .pitch = (pitch / 0x100) << 8, - .format = base | ((base + ((size - 1) / 0x10000)) << 13) | (comp << 26) | (1 << 30) - }; + .format = base | ((base + ((size - 1) / 0x10000)) << 13) | (comp << 26) | (1 << 30)}; return ret; } diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLCommonDecompiler.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLCommonDecompiler.cpp index c296b988a..4c7845dbf 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLCommonDecompiler.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLCommonDecompiler.cpp @@ -4,24 +4,22 @@ namespace gl { static constexpr std::array, 17> varying_registers = - {{ - {"diff_color", 1}, - {"spec_color", 2}, - {"diff_color1", 3}, - {"spec_color1", 4}, - {"fogc", 5}, - {"fog_c", 5}, - {"tc0", 6}, - {"tc1", 7}, - {"tc2", 8}, - {"tc3", 9}, - {"tc4", 10}, - {"tc5", 11}, - {"tc6", 12}, - {"tc7", 13}, - {"tc8", 14}, - {"tc9", 15} - }}; + {{{"diff_color", 1}, + {"spec_color", 2}, + {"diff_color1", 3}, + {"spec_color1", 4}, + {"fogc", 5}, + {"fog_c", 5}, + {"tc0", 6}, + {"tc1", 7}, + {"tc2", 8}, + {"tc3", 9}, + {"tc4", 10}, + {"tc5", 11}, + {"tc6", 12}, + {"tc7", 13}, + {"tc8", 14}, + {"tc9", 15}}}; int get_varying_register_location(std::string_view varying_register_name) { @@ -35,4 +33,4 @@ namespace gl fmt::throw_exception("Unknown register name: %s", varying_register_name); } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLCompute.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLCompute.cpp index 5607c149e..407898022 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLCompute.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLCompute.cpp @@ -106,7 +106,8 @@ namespace gl invocations_x = optimal_length; invocations_y = invocations_x; - if (num_invocations % invocations_x) invocations_y++; + if (num_invocations % invocations_x) + invocations_y++; } run(cmd, invocations_x, invocations_y); @@ -130,23 +131,23 @@ namespace gl // Initialize to allow detecting optimal settings initialize(); - kernel_size = _kernel_size? _kernel_size : optimal_kernel_size; + kernel_size = _kernel_size ? _kernel_size : optimal_kernel_size; m_src = - #include "../Program/GLSLSnippets/ShuffleBytes.glsl" - ; +#include "../Program/GLSLSnippets/ShuffleBytes.glsl" + ; const std::pair syntax_replace[] = - { - { "%set, ", ""}, - { "%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0)) }, - { "%ws", std::to_string(optimal_group_size) }, - { "%ks", std::to_string(kernel_size) }, - { "%vars", variables }, - { "%f", function_name }, - { "%ub", uniforms }, - { "%md", method_declarations }, - }; + { + {"%set, ", ""}, + {"%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0))}, + {"%ws", std::to_string(optimal_group_size)}, + {"%ks", std::to_string(kernel_size)}, + {"%vars", variables}, + {"%f", function_name}, + {"%ub", uniforms}, + {"%md", method_declarations}, + }; m_src = fmt::replace_all(m_src, syntax_replace); work_kernel = fmt::replace_all(work_kernel, syntax_replace); @@ -159,11 +160,9 @@ namespace gl { work_kernel += loop_advance + "\n"; - m_src += std::string - ( + m_src += std::string( " //Unrolled loop\n" - " {\n" - ); + " {\n"); // Assemble body with manual loop unroll to try loweing GPR usage for (u32 n = 0; n < kernel_size; ++n) @@ -204,7 +203,8 @@ namespace gl { // Technically robust buffer access should keep the driver from crashing in OOB situations rsx_log.error("Inadequate buffer length submitted for a compute operation." - "Required=%d bytes, Available=%d bytes", num_bytes_to_process, data->size()); + "Required=%d bytes, Available=%d bytes", + num_bytes_to_process, data->size()); } compute_task::run(cmd, num_invocations); @@ -324,16 +324,15 @@ namespace gl initialize(); const auto raw_data = - #include "../Program/GLSLSnippets/CopyD24x8ToBuffer.glsl" - ; +#include "../Program/GLSLSnippets/CopyD24x8ToBuffer.glsl" + ; const std::pair repl_list[] = - { - { "%set, ", "" }, - { "%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0)) }, - { "%ws", std::to_string(optimal_group_size) }, - { "%wks", std::to_string(optimal_kernel_size) } - }; + { + {"%set, ", ""}, + {"%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0))}, + {"%ws", std::to_string(optimal_group_size)}, + {"%wks", std::to_string(optimal_kernel_size)}}; m_src = fmt::replace_all(raw_data, repl_list); } @@ -374,16 +373,15 @@ namespace gl initialize(); const auto raw_data = - #include "../Program/GLSLSnippets/CopyRGBA8ToBuffer.glsl" - ; +#include "../Program/GLSLSnippets/CopyRGBA8ToBuffer.glsl" + ; const std::pair repl_list[] = - { - { "%set, ", "" }, - { "%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0)) }, - { "%ws", std::to_string(optimal_group_size) }, - { "%wks", std::to_string(optimal_kernel_size) } - }; + { + {"%set, ", ""}, + {"%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0))}, + {"%ws", std::to_string(optimal_group_size)}, + {"%wks", std::to_string(optimal_kernel_size)}}; m_src = fmt::replace_all(raw_data, repl_list); } @@ -422,17 +420,16 @@ namespace gl initialize(); const auto raw_data = - #include "../Program/GLSLSnippets/CopyBufferToColorImage.glsl" - ; +#include "../Program/GLSLSnippets/CopyBufferToColorImage.glsl" + ; const std::pair repl_list[] = - { - { "%set, ", "" }, - { "%image_slot", std::to_string(GL_COMPUTE_IMAGE_SLOT(0)) }, - { "%ssbo_slot", std::to_string(GL_COMPUTE_BUFFER_SLOT(0)) }, - { "%ws", std::to_string(optimal_group_size) }, - { "%wks", std::to_string(optimal_kernel_size) } - }; + { + {"%set, ", ""}, + {"%image_slot", std::to_string(GL_COMPUTE_IMAGE_SLOT(0))}, + {"%ssbo_slot", std::to_string(GL_COMPUTE_BUFFER_SLOT(0))}, + {"%ws", std::to_string(optimal_group_size)}, + {"%wks", std::to_string(optimal_kernel_size)}}; m_src = fmt::replace_all(raw_data, repl_list); } @@ -460,4 +457,4 @@ namespace gl gl::nil_texture_view view(dst); run(cmd, src, &view, src_offset, dst_region, layout); } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLCompute.h b/rpcs3/rpcs3/Emu/RSX/GL/GLCompute.h index 54458c1f1..1bb59a311 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLCompute.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLCompute.h @@ -250,8 +250,7 @@ namespace gl u32 logd; u32 mipmaps; }; - } - params; + } params; gl::buffer param_buffer; @@ -268,8 +267,8 @@ namespace gl initialize(); m_src = - #include "../Program/GLSLSnippets/GPUDeswizzle.glsl" - ; +#include "../Program/GLSLSnippets/GPUDeswizzle.glsl" + ; std::string transform; if constexpr (_SwapBytes) @@ -289,14 +288,13 @@ namespace gl } const std::pair syntax_replace[] = - { - { "%set, ", ""}, - { "%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0))}, - { "%push_block", fmt::format("binding=%d, std140", GL_COMPUTE_BUFFER_SLOT(2)) }, - { "%ws", std::to_string(optimal_group_size) }, - { "%_wordcount", std::to_string(sizeof(_BlockType) / 4) }, - { "%f", transform } - }; + { + {"%set, ", ""}, + {"%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0))}, + {"%push_block", fmt::format("binding=%d, std140", GL_COMPUTE_BUFFER_SLOT(2))}, + {"%ws", std::to_string(optimal_group_size)}, + {"%_wordcount", std::to_string(sizeof(_BlockType) / 4)}, + {"%f", transform}}; m_src = fmt::replace_all(m_src, syntax_replace); @@ -352,7 +350,11 @@ namespace gl gl::sampler_state m_sampler; public: - void destroy() override { m_sampler.remove(); compute_task::destroy(); } + void destroy() override + { + m_sampler.remove(); + compute_task::destroy(); + } virtual void run(gl::command_context& cmd, gl::viewable_image* src, const gl::buffer* dst, u32 out_offset, const coordu& region, const gl::pixel_buffer_layout& layout) = 0; }; @@ -378,11 +380,11 @@ namespace gl // TODO: Replace with a proper manager extern std::unordered_map> g_compute_tasks; - template + template T* get_compute_task() { u32 index = stx::typeindex(); - auto &e = g_compute_tasks[index]; + auto& e = g_compute_tasks[index]; if (!e) { @@ -394,4 +396,4 @@ namespace gl } void destroy_compute_tasks(); -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLDMA.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLDMA.cpp index 758205214..e826e719f 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLDMA.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLDMA.cpp @@ -92,7 +92,7 @@ namespace gl } const auto range = utils::address_range::start_length(start, length); - if (block->can_map(range)) [[ likely ]] + if (block->can_map(range)) [[likely]] { return *block; } @@ -108,8 +108,8 @@ namespace gl // 2. Acquire all the extras for (u32 id = owner->base_addr() + s_dma_block_size; - id < search_end; - id += s_dma_block_size) + id < search_end; + id += s_dma_block_size) { ensure((id % s_dma_block_size) == 0); g_dma_pool[id]->set_parent(new_owner.get()); @@ -122,6 +122,6 @@ namespace gl dma_mapping_handle map_dma(u32 guest_address, u32 length) { auto& block = get_block(guest_address, length); - return { guest_address - block.base_addr(), block.get() }; + return {guest_address - block.base_addr(), block.get()}; } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLDMA.h b/rpcs3/rpcs3/Emu/RSX/GL/GLDMA.h index 1e4b31bae..dfb24f751 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLDMA.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLDMA.h @@ -24,18 +24,36 @@ namespace gl void* map(const utils::address_range& range) const; void set_parent(const dma_block* other); - const dma_block* head() const { return m_parent ? m_parent : this; } + const dma_block* head() const + { + return m_parent ? m_parent : this; + } bool can_map(const utils::address_range& range) const; - u32 base_addr() const { return m_base_address; } - u32 length() const { return m_data ? static_cast(m_data->size()) : 0; } - bool empty() const { return length() == 0; } - buffer* get() const { return m_data.get(); } - utils::address_range range() const { return utils::address_range::start_length(m_base_address, length()); } + u32 base_addr() const + { + return m_base_address; + } + u32 length() const + { + return m_data ? static_cast(m_data->size()) : 0; + } + bool empty() const + { + return length() == 0; + } + buffer* get() const + { + return m_data.get(); + } + utils::address_range range() const + { + return utils::address_range::start_length(m_base_address, length()); + } protected: u32 m_base_address = 0; const dma_block* m_parent = nullptr; std::unique_ptr m_data; }; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLDraw.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLDraw.cpp index c02f12c8c..0602a4fc2 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLDraw.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLDraw.cpp @@ -111,10 +111,10 @@ namespace gl GLenum front_face(rsx::front_face op) { - //NOTE: RSX face winding is always based off of upper-left corner like vulkan, but GL is bottom left - //shader_window_origin register does not affect this - //verified with Outrun Online Arcade (window_origin::top) and DS2 (window_origin::bottom) - //correctness of face winding checked using stencil test (GOW collection shadows) + // NOTE: RSX face winding is always based off of upper-left corner like vulkan, but GL is bottom left + // shader_window_origin register does not affect this + // verified with Outrun Online Arcade (window_origin::top) and DS2 (window_origin::bottom) + // correctness of face winding checked using stencil test (GOW collection shadows) switch (op) { case rsx::front_face::cw: return GL_CCW; @@ -133,7 +133,7 @@ namespace gl } fmt::throw_exception("Unsupported cull face 0x%X", static_cast(op)); } -} +} // namespace gl void GLGSRender::update_draw_state() { @@ -232,12 +232,11 @@ void GLGSRender::update_draw_state() else { bool mrt_blend_enabled[] = - { - rsx::method_registers.blend_enabled(), - rsx::method_registers.blend_enabled_surface_1(), - rsx::method_registers.blend_enabled_surface_2(), - rsx::method_registers.blend_enabled_surface_3() - }; + { + rsx::method_registers.blend_enabled(), + rsx::method_registers.blend_enabled_surface_1(), + rsx::method_registers.blend_enabled_surface_2(), + rsx::method_registers.blend_enabled_surface_3()}; if (mrt_blend_enabled[0] || mrt_blend_enabled[1] || mrt_blend_enabled[2] || mrt_blend_enabled[3]) { @@ -262,7 +261,7 @@ void GLGSRender::update_draw_state() // Antialias control if (backend_config.supports_hw_msaa) { - gl_state.enable(/*REGS(m_ctx)->msaa_enabled()*/GL_MULTISAMPLE); + gl_state.enable(/*REGS(m_ctx)->msaa_enabled()*/ GL_MULTISAMPLE); gl_state.enable(GL_SAMPLE_MASK); gl_state.sample_mask(REGS(m_ctx)->msaa_sample_mask()); @@ -335,17 +334,17 @@ void GLGSRender::update_draw_state() // Clip planes gl_state.clip_planes((current_vertex_program.output_mask >> CELL_GCM_ATTRIB_OUTPUT_UC0) & 0x3F); - //TODO - //NV4097_SET_ANISO_SPREAD - //NV4097_SET_SPECULAR_ENABLE - //NV4097_SET_TWO_SIDE_LIGHT_EN - //NV4097_SET_FLAT_SHADE_OP - //NV4097_SET_EDGE_FLAG - //NV4097_SET_COLOR_KEY_COLOR - //NV4097_SET_SHADER_CONTROL - //NV4097_SET_ZMIN_MAX_CONTROL - //NV4097_SET_ANTI_ALIASING_CONTROL - //NV4097_SET_CLIP_ID_TEST_ENABLE + // TODO + // NV4097_SET_ANISO_SPREAD + // NV4097_SET_SPECULAR_ENABLE + // NV4097_SET_TWO_SIDE_LIGHT_EN + // NV4097_SET_FLAT_SHADE_OP + // NV4097_SET_EDGE_FLAG + // NV4097_SET_COLOR_KEY_COLOR + // NV4097_SET_SHADER_CONTROL + // NV4097_SET_ZMIN_MAX_CONTROL + // NV4097_SET_ANTI_ALIASING_CONTROL + // NV4097_SET_CLIP_ID_TEST_ENABLE // For OGL Z range is updated every draw as it is separate from viewport config m_graphics_state.clear(rsx::pipeline_state::zclip_config_state_dirty); @@ -356,7 +355,7 @@ void GLGSRender::update_draw_state() void GLGSRender::load_texture_env() { // Load textures - gl::command_context cmd{ gl_state }; + gl::command_context cmd{gl_state}; std::lock_guard lock(m_sampler_mutex); for (u32 textures_ref = current_fp_metadata.referenced_textures_mask, i = 0; textures_ref; textures_ref >>= 1, ++i) @@ -443,7 +442,7 @@ void GLGSRender::load_texture_env() void GLGSRender::bind_texture_env() { // Bind textures and resolve external copy operations - gl::command_context cmd{ gl_state }; + gl::command_context cmd{gl_state}; for (u32 textures_ref = current_fp_metadata.referenced_textures_mask, i = 0; textures_ref; textures_ref >>= 1, ++i) { @@ -522,8 +521,8 @@ void GLGSRender::emit_geometry(u32 sub_index) } else { - //DMA push; not needed with MAP_COHERENT - //glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT); + // DMA push; not needed with MAP_COHERENT + // glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT); } }; @@ -571,11 +570,11 @@ void GLGSRender::emit_geometry(u32 sub_index) if (manually_flush_ring_buffers) { - //Use approximations to reserve space. This path is mostly for debug purposes anyway + // Use approximations to reserve space. This path is mostly for debug purposes anyway u32 approx_vertex_count = draw_call.get_elements_count(); u32 approx_working_buffer_size = approx_vertex_count * 256; - //Allocate 256K heap if we have no approximation at this time (inlined array) + // Allocate 256K heap if we have no approximation at this time (inlined array) m_attrib_ring_buffer->reserve_storage_on_heap(std::max(approx_working_buffer_size, 256 * 1024U)); m_index_ring_buffer->reserve_storage_on_heap(16 * 1024); } @@ -621,7 +620,7 @@ void GLGSRender::emit_geometry(u32 sub_index) u32 first = 0; u32 dst_index = 0; - for (const auto &range : subranges) + for (const auto& range : subranges) { firsts[dst_index] = first; counts[dst_index] = range.count; @@ -673,7 +672,7 @@ void GLGSRender::emit_geometry(u32 sub_index) if (draw_call.is_trivial_instanced_draw) { - glDrawElementsInstanced(draw_mode, upload_info.vertex_draw_count, index_type, reinterpret_cast(u64{ index_offset }), draw_call.pass_count()); + glDrawElementsInstanced(draw_mode, upload_info.vertex_draw_count, index_type, reinterpret_cast(u64{index_offset}), draw_call.pass_count()); } else if (draw_call.is_single_draw()) { @@ -687,11 +686,11 @@ void GLGSRender::emit_geometry(u32 sub_index) uptr index_ptr = index_offset; m_scratch_buffer.resize(draw_count * 16); - GLsizei *counts = reinterpret_cast(m_scratch_buffer.data()); + GLsizei* counts = reinterpret_cast(m_scratch_buffer.data()); const GLvoid** offsets = utils::bless(counts + draw_count); int dst_index = 0; - for (const auto &range : subranges) + for (const auto& range : subranges) { const auto index_size = get_index_count(draw_call.primitive, range.count); counts[dst_index] = index_size; @@ -768,10 +767,11 @@ void GLGSRender::end() m_gl_texture_cache.release_uncached_temporary_subresources(); m_frame_stats.textures_upload_time += m_profiler.duration(); - gl::command_context cmd{ gl_state }; - if (auto ds = std::get<1>(m_rtts.m_bound_depth_stencil)) ds->write_barrier(cmd); + gl::command_context cmd{gl_state}; + if (auto ds = std::get<1>(m_rtts.m_bound_depth_stencil)) + ds->write_barrier(cmd); - for (auto &rtt : m_rtts.m_bound_render_targets) + for (auto& rtt : m_rtts.m_bound_render_targets) { if (auto surface = std::get<1>(rtt)) { @@ -798,8 +798,7 @@ void GLGSRender::end() // We already completed. End the draw. draw_call.end(); } - } - while (draw_call.next()); + } while (draw_call.next()); m_rtts.on_write(m_framebuffer_layout.color_write_enabled, m_framebuffer_layout.zeta_write_enabled); diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp index 3f65be3ba..cce37ee50 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp @@ -21,12 +21,12 @@ std::string GLFragmentDecompilerThread::getFunction(FUNCTION f) return glsl::getFunctionImpl(f); } -std::string GLFragmentDecompilerThread::compareFunction(COMPARE f, const std::string &Op0, const std::string &Op1) +std::string GLFragmentDecompilerThread::compareFunction(COMPARE f, const std::string& Op0, const std::string& Op1) { return glsl::compareFunctionImpl(f, Op0, Op1); } -void GLFragmentDecompilerThread::insertHeader(std::stringstream & OS) +void GLFragmentDecompilerThread::insertHeader(std::stringstream& OS) { int gl_version = 430; std::vector required_extensions; @@ -74,30 +74,27 @@ void GLFragmentDecompilerThread::insertHeader(std::stringstream & OS) glsl::insert_subheader_block(OS); } -void GLFragmentDecompilerThread::insertInputs(std::stringstream & OS) +void GLFragmentDecompilerThread::insertInputs(std::stringstream& OS) { glsl::insert_fragment_shader_inputs_block( OS, glsl::extension_flavour::NV, m_prog, m_parr.params[PF_PARAM_IN], - { - .two_sided_color = !!(properties.in_register_mask & in_diff_color), - .two_sided_specular = !!(properties.in_register_mask & in_spec_color) - }, - gl::get_varying_register_location - ); + {.two_sided_color = !!(properties.in_register_mask & in_diff_color), + .two_sided_specular = !!(properties.in_register_mask & in_spec_color)}, + gl::get_varying_register_location); } -void GLFragmentDecompilerThread::insertOutputs(std::stringstream & OS) +void GLFragmentDecompilerThread::insertOutputs(std::stringstream& OS) { const std::pair table[] = - { - { "ocol0", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r0" : "h0" }, - { "ocol1", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r2" : "h4" }, - { "ocol2", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r3" : "h6" }, - { "ocol3", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r4" : "h8" }, - }; + { + {"ocol0", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r0" : "h0"}, + {"ocol1", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r2" : "h4"}, + {"ocol2", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r3" : "h6"}, + {"ocol3", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r4" : "h8"}, + }; const bool float_type = (m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS) || !device_props.has_native_half_support; const auto reg_type = float_type ? "vec4" : getHalfTypeName(4); @@ -108,7 +105,7 @@ void GLFragmentDecompilerThread::insertOutputs(std::stringstream & OS) } } -void GLFragmentDecompilerThread::insertConstants(std::stringstream & OS) +void GLFragmentDecompilerThread::insertConstants(std::stringstream& OS) { for (const ParamType& PT : m_parr.params[PF_PARAM_UNIFORM]) { @@ -204,7 +201,7 @@ void GLFragmentDecompilerThread::insertConstants(std::stringstream & OS) OS << "};\n\n"; } -void GLFragmentDecompilerThread::insertGlobalFunctions(std::stringstream &OS) +void GLFragmentDecompilerThread::insertGlobalFunctions(std::stringstream& OS) { m_shader_props.domain = glsl::glsl_fragment_program; m_shader_props.require_lit_emulation = properties.has_lit_op; @@ -232,16 +229,16 @@ void GLFragmentDecompilerThread::insertGlobalFunctions(std::stringstream &OS) glsl::insert_glsl_legacy_function(OS, m_shader_props); } -void GLFragmentDecompilerThread::insertMainStart(std::stringstream & OS) +void GLFragmentDecompilerThread::insertMainStart(std::stringstream& OS) { std::set output_registers; if (m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS) { - output_registers = { "r0", "r2", "r3", "r4" }; + output_registers = {"r0", "r2", "r3", "r4"}; } else { - output_registers = { "h0", "h4", "h6", "h8" }; + output_registers = {"h0", "h4", "h6", "h8"}; } if (m_ctrl & CELL_GCM_SHADER_CONTROL_DEPTH_EXPORT) @@ -252,9 +249,9 @@ void GLFragmentDecompilerThread::insertMainStart(std::stringstream & OS) std::string registers; std::string reg_type; const auto half4 = getHalfTypeName(4); - for (auto ®_name : output_registers) + for (auto& reg_name : output_registers) { - const auto type = (reg_name[0] == 'r' || !device_props.has_native_half_support)? "vec4" : half4; + const auto type = (reg_name[0] == 'r' || !device_props.has_native_half_support) ? "vec4" : half4; if (reg_type == type) [[likely]] { registers += ", " + reg_name + " = " + type + "(0.)"; @@ -315,7 +312,7 @@ void GLFragmentDecompilerThread::insertMainStart(std::stringstream & OS) } } -void GLFragmentDecompilerThread::insertMainEnd(std::stringstream & OS) +void GLFragmentDecompilerThread::insertMainEnd(std::stringstream& OS) { OS << "}\n\n"; @@ -324,7 +321,8 @@ void GLFragmentDecompilerThread::insertMainEnd(std::stringstream & OS) ::glsl::insert_rop_init(OS); - OS << "\n" << " fs_main();\n\n"; + OS << "\n" + << " fs_main();\n\n"; glsl::insert_rop(OS, m_shader_props); @@ -332,13 +330,13 @@ void GLFragmentDecompilerThread::insertMainEnd(std::stringstream & OS) { if (m_parr.HasParam(PF_PARAM_NONE, "vec4", "r1")) { - //Depth writes are always from a fp32 register. See issues section on nvidia's NV_fragment_program spec - //https://www.khronos.org/registry/OpenGL/extensions/NV/NV_fragment_program.txt + // Depth writes are always from a fp32 register. See issues section on nvidia's NV_fragment_program spec + // https://www.khronos.org/registry/OpenGL/extensions/NV/NV_fragment_program.txt OS << " gl_FragDepth = r1.z;\n"; } else { - //Input not declared. Leave commented to assist in debugging the shader + // Input not declared. Leave commented to assist in debugging the shader OS << " //gl_FragDepth = r1.z;\n"; } } diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLFragmentProgram.h b/rpcs3/rpcs3/Emu/RSX/GL/GLFragmentProgram.h index c6b524438..534515cd8 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLFragmentProgram.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLFragmentProgram.h @@ -22,10 +22,8 @@ struct GLFragmentDecompilerThread : public FragmentProgramDecompiler glsl::shader_properties m_shader_props{}; public: - GLFragmentDecompilerThread(std::string& shader, ParamArray& parr, const RSXFragmentProgram &prog, u32& size) - : FragmentProgramDecompiler(prog, size) - , m_shader(shader) - , m_parrDummy(parr) + GLFragmentDecompilerThread(std::string& shader, ParamArray& parr, const RSXFragmentProgram& prog, u32& size) + : FragmentProgramDecompiler(prog, size), m_shader(shader), m_parrDummy(parr) { } @@ -37,13 +35,13 @@ protected: std::string getFunction(FUNCTION) override; std::string compareFunction(COMPARE, const std::string&, const std::string&) override; - void insertHeader(std::stringstream &OS) override; - void insertInputs(std::stringstream &OS) override; - void insertOutputs(std::stringstream &OS) override; - void insertConstants(std::stringstream &OS) override; - void insertGlobalFunctions(std::stringstream &OS) override; - void insertMainStart(std::stringstream &OS) override; - void insertMainEnd(std::stringstream &OS) override; + void insertHeader(std::stringstream& OS) override; + void insertInputs(std::stringstream& OS) override; + void insertOutputs(std::stringstream& OS) override; + void insertConstants(std::stringstream& OS) override; + void insertGlobalFunctions(std::stringstream& OS) override; + void insertMainStart(std::stringstream& OS) override; + void insertMainEnd(std::stringstream& OS) override; }; /** Storage for an Fragment Program in the process of of recompilation. diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLGSRender.cpp index 6101bd70c..1b7a0752a 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -27,11 +27,11 @@ namespace reasons_list); Emu.BlockingCallFromMainThread([message]() - { - report_fatal_error(message, false, false); - }); + { + report_fatal_error(message, false, false); + }); } -} +} // namespace u64 GLGSRender::get_cycles() { @@ -248,7 +248,7 @@ void GLGSRender::on_init_thread() // Fallback null texture instead of relying on texture0 { - std::array pixeldata = { 0, 0, 0, 0, 0, 0, 0, 0 }; + std::array pixeldata = {0, 0, 0, 0, 0, 0, 0, 0}; // 1D auto tex1D = std::make_unique(GL_TEXTURE_1D, 1, 1, 1, 1, 1, GL_RGBA8, RSX_FORMAT_CLASS_COLOR); @@ -345,7 +345,7 @@ void GLGSRender::on_init_thread() } m_identity_index_buffer = std::make_unique(); - m_identity_index_buffer->create(gl::buffer::target::element_array,dst.size() * sizeof(u32), dst.data(), gl::buffer::memory_type::local); + m_identity_index_buffer->create(gl::buffer::target::element_array, dst.size() * sizeof(u32), dst.data(), gl::buffer::memory_type::local); } else if (gl_caps.vendor_NVIDIA) { @@ -362,13 +362,13 @@ void GLGSRender::on_init_thread() m_vao.element_array_buffer = *m_index_ring_buffer; int image_unit = 0; - for (auto &sampler : m_fs_sampler_states) + for (auto& sampler : m_fs_sampler_states) { sampler.create(); sampler.bind(image_unit++); } - for (auto &sampler : m_vs_sampler_states) + for (auto& sampler : m_vs_sampler_states) { sampler.create(); sampler.bind(image_unit++); @@ -381,11 +381,11 @@ void GLGSRender::on_init_thread() sampler.bind(image_unit++); } - //Occlusion query + // Occlusion query for (u32 i = 0; i < rsx::reports::occlusion_query_count; ++i) { GLuint handle = 0; - auto &query = m_occlusion_query_data[i]; + auto& query = m_occlusion_query_data[i]; glGenQueries(1, &handle); query.driver_handle = handle; @@ -399,14 +399,12 @@ void GLGSRender::on_init_thread() m_gl_texture_cache.initialize(); - m_prog_buffer.initialize - ( + m_prog_buffer.initialize( [this](void* const& props, const RSXVertexProgram& vp, const RSXFragmentProgram& fp) { // Program was linked or queued for linking m_shaders_cache->store(props, vp, fp); - } - ); + }); if (!m_overlay_manager) { @@ -422,7 +420,6 @@ void GLGSRender::on_init_thread() } } - void GLGSRender::on_exit() { // Destroy internal RSX state, may call upon this->do_local_task @@ -448,7 +445,7 @@ void GLGSRender::on_exit() m_host_gpu_context_data.reset(); m_enqueued_host_write_buffer.reset(); - for (auto &fbo : m_framebuffer_cache) + for (auto& fbo : m_framebuffer_cache) { fbo.remove(); } @@ -470,17 +467,17 @@ void GLGSRender::on_exit() m_gl_persistent_stream_buffer.reset(); m_gl_volatile_stream_buffer.reset(); - for (auto &sampler : m_fs_sampler_states) + for (auto& sampler : m_fs_sampler_states) { sampler.remove(); } - for (auto &sampler : m_fs_sampler_mirror_states) + for (auto& sampler : m_fs_sampler_mirror_states) { sampler.remove(); } - for (auto &sampler : m_vs_sampler_states) + for (auto& sampler : m_vs_sampler_states) { sampler.remove(); } @@ -564,7 +561,7 @@ void GLGSRender::on_exit() for (u32 i = 0; i < rsx::reports::occlusion_query_count; ++i) { - auto &query = m_occlusion_query_data[i]; + auto& query = m_occlusion_query_data[i]; query.active = false; query.pending = false; @@ -580,25 +577,31 @@ void GLGSRender::on_exit() void GLGSRender::clear_surface(u32 arg) { - if (skip_current_frame) return; + if (skip_current_frame) + return; // If stencil write mask is disabled, remove clear_stencil bit - if (!rsx::method_registers.stencil_mask()) arg &= ~RSX_GCM_CLEAR_STENCIL_BIT; + if (!rsx::method_registers.stencil_mask()) + arg &= ~RSX_GCM_CLEAR_STENCIL_BIT; // Ignore invalid clear flags - if ((arg & RSX_GCM_CLEAR_ANY_MASK) == 0) return; + if ((arg & RSX_GCM_CLEAR_ANY_MASK) == 0) + return; u8 ctx = rsx::framebuffer_creation_context::context_draw; - if (arg & RSX_GCM_CLEAR_COLOR_RGBA_MASK) ctx |= rsx::framebuffer_creation_context::context_clear_color; - if (arg & RSX_GCM_CLEAR_DEPTH_STENCIL_MASK) ctx |= rsx::framebuffer_creation_context::context_clear_depth; + if (arg & RSX_GCM_CLEAR_COLOR_RGBA_MASK) + ctx |= rsx::framebuffer_creation_context::context_clear_color; + if (arg & RSX_GCM_CLEAR_DEPTH_STENCIL_MASK) + ctx |= rsx::framebuffer_creation_context::context_clear_depth; init_buffers(static_cast(ctx), true); - if (!m_graphics_state.test(rsx::rtt_config_valid)) return; + if (!m_graphics_state.test(rsx::rtt_config_valid)) + return; gl::clear_cmd_info clear_cmd{}; - gl::command_context cmd{ gl_state }; + gl::command_context cmd{gl_state}; const bool full_frame = rsx::method_registers.scissor_origin_x() == 0 && rsx::method_registers.scissor_origin_y() == 0 && @@ -747,7 +750,7 @@ void GLGSRender::clear_surface(u32 arg) if (update_color || update_z) { - m_rtts.on_write({ update_color, update_color, update_color, update_color }, update_z); + m_rtts.on_write({update_color, update_color, update_color, update_color}, update_z); } if (!full_frame) @@ -885,13 +888,20 @@ void GLGSRender::load_program_env() if (manually_flush_ring_buffers) { - if (update_fragment_env) m_fragment_env_buffer->reserve_storage_on_heap(128); - if (update_vertex_env) m_vertex_env_buffer->reserve_storage_on_heap(256); - if (update_fragment_texture_env) m_texture_parameters_buffer->reserve_storage_on_heap(256); - if (update_fragment_constants) m_fragment_constants_buffer->reserve_storage_on_heap(utils::align(fragment_constants_size, 256)); - if (update_transform_constants) m_transform_constants_buffer->reserve_storage_on_heap(8192); - if (update_raster_env) m_raster_env_ring_buffer->reserve_storage_on_heap(128); - if (update_instancing_data) m_instancing_ring_buffer->reserve_storage_on_heap(8192 * REGS(m_ctx)->current_draw_clause.pass_count()); + if (update_fragment_env) + m_fragment_env_buffer->reserve_storage_on_heap(128); + if (update_vertex_env) + m_vertex_env_buffer->reserve_storage_on_heap(256); + if (update_fragment_texture_env) + m_texture_parameters_buffer->reserve_storage_on_heap(256); + if (update_fragment_constants) + m_fragment_constants_buffer->reserve_storage_on_heap(utils::align(fragment_constants_size, 256)); + if (update_transform_constants) + m_transform_constants_buffer->reserve_storage_on_heap(8192); + if (update_raster_env) + m_raster_env_ring_buffer->reserve_storage_on_heap(128); + if (update_instancing_data) + m_instancing_ring_buffer->reserve_storage_on_heap(8192 * REGS(m_ctx)->current_draw_clause.pass_count()); if (update_instruction_buffers) { @@ -923,18 +933,18 @@ void GLGSRender::load_program_env() u32 constants_data_table_offset = 0; rsx::io_buffer indirection_table_buf([&](usz size) -> std::pair - { - const auto mapping = m_instancing_ring_buffer->alloc_from_heap(static_cast(size), alignment); - indirection_table_offset = mapping.second; - return mapping; - }); + { + const auto mapping = m_instancing_ring_buffer->alloc_from_heap(static_cast(size), alignment); + indirection_table_offset = mapping.second; + return mapping; + }); rsx::io_buffer constants_array_buf([&](usz size) -> std::pair - { - const auto mapping = m_instancing_ring_buffer->alloc_from_heap(static_cast(size), alignment); - constants_data_table_offset = mapping.second; - return mapping; - }); + { + const auto mapping = m_instancing_ring_buffer->alloc_from_heap(static_cast(size), alignment); + constants_data_table_offset = mapping.second; + return mapping; + }); m_draw_processor.fill_constants_instancing_buffer(indirection_table_buf, constants_array_buf, m_vertex_prog); @@ -950,7 +960,7 @@ void GLGSRender::load_program_env() { const auto mapping = m_transform_constants_buffer->alloc_from_heap(static_cast(size), m_uniform_buffer_offset_align); mem_offset = mapping.second; - return { mapping.first, size }; + return {mapping.first, size}; }; rsx::io_buffer io_buf(mem_alloc); @@ -968,7 +978,7 @@ void GLGSRender::load_program_env() auto mapping = m_fragment_constants_buffer->alloc_from_heap(fragment_constants_size, m_uniform_buffer_offset_align); auto buf = static_cast(mapping.first); - m_prog_buffer.fill_fragment_constants_buffer({ reinterpret_cast(buf), fragment_constants_size }, + m_prog_buffer.fill_fragment_constants_buffer({reinterpret_cast(buf), fragment_constants_size}, *ensure(m_fragment_prog), current_fragment_program, true); m_fragment_constants_buffer->bind_range(GL_FRAGMENT_CONSTANT_BUFFERS_BIND_SLOT, mapping.second, fragment_constants_size); @@ -1048,13 +1058,20 @@ void GLGSRender::load_program_env() if (manually_flush_ring_buffers) { - if (update_fragment_env) m_fragment_env_buffer->unmap(); - if (update_vertex_env) m_vertex_env_buffer->unmap(); - if (update_fragment_texture_env) m_texture_parameters_buffer->unmap(); - if (update_fragment_constants) m_fragment_constants_buffer->unmap(); - if (update_transform_constants) m_transform_constants_buffer->unmap(); - if (update_raster_env) m_raster_env_ring_buffer->unmap(); - if (update_instancing_data) m_instancing_ring_buffer->unmap(); + if (update_fragment_env) + m_fragment_env_buffer->unmap(); + if (update_vertex_env) + m_vertex_env_buffer->unmap(); + if (update_fragment_texture_env) + m_texture_parameters_buffer->unmap(); + if (update_fragment_constants) + m_fragment_constants_buffer->unmap(); + if (update_transform_constants) + m_transform_constants_buffer->unmap(); + if (update_raster_env) + m_raster_env_ring_buffer->unmap(); + if (update_instancing_data) + m_instancing_ring_buffer->unmap(); if (update_instruction_buffers) { @@ -1094,9 +1111,7 @@ void GLGSRender::upload_transform_constants(const rsx::io_buffer& buffer) if (transform_constants_size) { - const auto constant_ids = (transform_constants_size == 8192) - ? std::span{} - : std::span(m_vertex_prog->constant_ids); + const auto constant_ids = (transform_constants_size == 8192) ? std::span{} : std::span(m_vertex_prog->constant_ids); buffer.reserve(transform_constants_size); m_draw_processor.fill_vertex_program_constants_data(buffer.data(), constant_ids); @@ -1150,7 +1165,7 @@ void GLGSRender::patch_transform_constants(rsx::context* ctx, u32 index, u32 cou return; } - std::pair data_range {}; + std::pair data_range{}; void* data_source = nullptr; const auto bound_range = m_transform_constants_buffer->bound_range(); @@ -1160,7 +1175,7 @@ void GLGSRender::patch_transform_constants(rsx::context* ctx, u32 index, u32 cou const auto byte_count = count * 16; const auto byte_offset = index * 16; - data_range = { bound_range.first + byte_offset, byte_count}; + data_range = {bound_range.first + byte_offset, byte_count}; data_source = ®S(ctx)->transform_constants[index]; } else if (auto xform_id = m_vertex_prog->translate_constants_range(index, count); xform_id >= 0) @@ -1168,7 +1183,7 @@ void GLGSRender::patch_transform_constants(rsx::context* ctx, u32 index, u32 cou const auto write_offset = xform_id * 16; const auto byte_count = count * 16; - data_range = { bound_range.first + write_offset, byte_count }; + data_range = {bound_range.first + write_offset, byte_count}; data_source = ®S(ctx)->transform_constants[index]; } else @@ -1176,13 +1191,13 @@ void GLGSRender::patch_transform_constants(rsx::context* ctx, u32 index, u32 cou auto allocate_mem = [&](usz size) -> std::pair { m_scratch_buffer.resize(size); - return { m_scratch_buffer.data(), size }; + return {m_scratch_buffer.data(), size}; }; rsx::io_buffer iobuf(allocate_mem); upload_transform_constants(iobuf); - data_range = { bound_range.first, ::size32(iobuf) }; + data_range = {bound_range.first, ::size32(iobuf)}; data_source = iobuf.data(); } @@ -1210,11 +1225,9 @@ bool GLGSRender::on_access_violation(u32 address, bool is_writing) rsx::mm_flush(address); const bool can_flush = is_current_thread(); - const rsx::invalidation_cause cause = is_writing - ? (can_flush ? rsx::invalidation_cause::write : rsx::invalidation_cause::deferred_write) - : (can_flush ? rsx::invalidation_cause::read : rsx::invalidation_cause::deferred_read); + const rsx::invalidation_cause cause = is_writing ? (can_flush ? rsx::invalidation_cause::write : rsx::invalidation_cause::deferred_write) : (can_flush ? rsx::invalidation_cause::read : rsx::invalidation_cause::deferred_read); - auto cmd = can_flush ? gl::command_context{ gl_state } : gl::command_context{}; + auto cmd = can_flush ? gl::command_context{gl_state} : gl::command_context{}; auto result = m_gl_texture_cache.invalidate_address(cmd, address, cause); if (result.invalidate_samplers) @@ -1230,7 +1243,7 @@ bool GLGSRender::on_access_violation(u32 address, bool is_writing) if (result.num_flushable > 0) { - auto &task = post_flush_request(address, result); + auto& task = post_flush_request(address, result); m_eng_interrupt_mask |= rsx::backend_interrupt; vm::temporary_unlock(); @@ -1240,9 +1253,9 @@ bool GLGSRender::on_access_violation(u32 address, bool is_writing) return true; } -void GLGSRender::on_invalidate_memory_range(const utils::address_range &range, rsx::invalidation_cause cause) +void GLGSRender::on_invalidate_memory_range(const utils::address_range& range, rsx::invalidation_cause cause) { - gl::command_context cmd{ gl_state }; + gl::command_context cmd{gl_state}; auto data = m_gl_texture_cache.invalidate_range(cmd, range, cause); AUDIT(data.empty()); @@ -1271,13 +1284,17 @@ void GLGSRender::do_local_task(rsx::FIFO::state state) { std::lock_guard lock(queue_guard); - work_queue.remove_if([](auto &q) { return q.received; }); + work_queue.remove_if([](auto& q) + { + return q.received; + }); for (auto& q : work_queue) { - if (q.processed) continue; + if (q.processed) + continue; - gl::command_context cmd{ gl_state }; + gl::command_context cmd{gl_state}; q.result = m_gl_texture_cache.flush_all(cmd, q.section_data); q.processed = true; } @@ -1286,8 +1303,8 @@ void GLGSRender::do_local_task(rsx::FIFO::state state) { if (m_graphics_state & rsx::pipeline_state::framebuffer_reads_dirty) { - //This will re-engage locks and break the texture cache if another thread is waiting in access violation handler! - //Only call when there are no waiters + // This will re-engage locks and break the texture cache if another thread is waiting in access violation handler! + // Only call when there are no waiters m_gl_texture_cache.do_update(); m_graphics_state.clear(rsx::pipeline_state::framebuffer_reads_dirty); } @@ -1317,7 +1334,7 @@ gl::work_item& GLGSRender::post_flush_request(u32 address, gl::texture_cache::th { std::lock_guard lock(queue_guard); - auto &result = work_queue.emplace_back(); + auto& result = work_queue.emplace_back(); result.address_to_flush = address; result.section_data = std::move(flush_data); return result; @@ -1325,7 +1342,7 @@ gl::work_item& GLGSRender::post_flush_request(u32 address, gl::texture_cache::th bool GLGSRender::scaled_image_from_memory(const rsx::blit_src_info& src, const rsx::blit_dst_info& dst, bool interpolate) { - gl::command_context cmd{ gl_state }; + gl::command_context cmd{gl_state}; if (m_gl_texture_cache.blit(cmd, src, dst, interpolate, m_rtts)) { m_samplers_dirty.store(true); @@ -1376,7 +1393,7 @@ bool GLGSRender::release_GCM_label(u32 address, u32 args) const auto release_event_id = host_ctx->on_label_acquire(); // We don't have async texture loads yet, so just release both the label and the commands complete - u64 write_buf[2] = { write_data, release_event_id }; + u64 write_buf[2] = {write_data, release_event_id}; const auto host_read_offset = m_enqueued_host_write_buffer->alloc(16, 16); m_enqueued_host_write_buffer->get().sub_data(host_read_offset, 16, write_buf); @@ -1449,7 +1466,7 @@ void GLGSRender::discard_occlusion_query(rsx::reports::occlusion_query_info* que { if (query->active) { - //Discard is being called on an active query, close it + // Discard is being called on an active query, close it glEndQuery(m_occlusion_type); } } diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLGSRender.h b/rpcs3/rpcs3/Emu/RSX/GL/GLGSRender.h index 59a7e075b..8ffb060f2 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLGSRender.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLGSRender.h @@ -37,12 +37,12 @@ namespace gl u32 vertex_index_offset; u32 persistent_mapping_offset; u32 volatile_mapping_offset; - std::optional > index_info; + std::optional> index_info; }; struct work_item { - u32 address_to_flush = 0; + u32 address_to_flush = 0; gl::texture_cache::thrashed_set section_data; volatile bool processed = false; @@ -67,20 +67,20 @@ namespace gl u32 width; u32 height; u32 pitch; - u8 eye; + u8 eye; }; -} +} // namespace gl class GLGSRender : public GSRender, public ::rsx::reports::ZCULL_control { - gl::sampler_state m_fs_sampler_states[rsx::limits::fragment_textures_count]; // Fragment textures - gl::sampler_state m_fs_sampler_mirror_states[rsx::limits::fragment_textures_count]; // Alternate views of fragment textures with different format (e.g Depth vs Stencil for D24S8) - gl::sampler_state m_vs_sampler_states[rsx::limits::vertex_textures_count]; // Vertex textures + gl::sampler_state m_fs_sampler_states[rsx::limits::fragment_textures_count]; // Fragment textures + gl::sampler_state m_fs_sampler_mirror_states[rsx::limits::fragment_textures_count]; // Alternate views of fragment textures with different format (e.g Depth vs Stencil for D24S8) + gl::sampler_state m_vs_sampler_states[rsx::limits::vertex_textures_count]; // Vertex textures - gl::glsl::program *m_program = nullptr; + gl::glsl::program* m_program = nullptr; gl::glsl::program* m_prev_program = nullptr; - const GLFragmentProgram *m_fragment_prog = nullptr; - const GLVertexProgram *m_vertex_prog = nullptr; + const GLFragmentProgram* m_fragment_prog = nullptr; + const GLVertexProgram* m_vertex_prog = nullptr; rsx::flags32_t m_interpreter_state = 0; gl::shader_interpreter m_shader_interpreter; @@ -163,7 +163,6 @@ public: virtual ~GLGSRender(); private: - gl::driver_state gl_state; // Return element to draw and in case of indexed draw index type and offset in index buffer @@ -223,7 +222,7 @@ protected: void do_local_task(rsx::FIFO::state state) override; bool on_access_violation(u32 address, bool is_writing) override; - void on_invalidate_memory_range(const utils::address_range &range, rsx::invalidation_cause cause) override; + void on_invalidate_memory_range(const utils::address_range& range, rsx::invalidation_cause cause) override; void notify_tile_unbound(u32 tile) override; void on_semaphore_acquire_wait() override; }; diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLHelpers.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLHelpers.cpp index da95960f4..7b2d2ff05 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLHelpers.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLHelpers.cpp @@ -45,8 +45,8 @@ namespace gl // https://www.khronos.org/opengl/wiki/Debug_Output void APIENTRY log_debug(GLenum source, GLenum type, GLuint id, - GLenum severity, GLsizei /*length*/, const GLchar* message, - const void* /*user_param*/) + GLenum severity, GLsizei /*length*/, const GLchar* message, + const void* /*user_param*/) { // Message source std::string str_source; @@ -128,8 +128,8 @@ namespace gl rsx_log.error("log_debug(type=%d): Unknown message type", type); } - switch (severity) - { + switch (severity) + { // All OpenGL Errors, shader compilation/linking errors, or highly-dangerous undefined behavior case GL_DEBUG_SEVERITY_HIGH: // Major performance warnings, shader compilation/linking warnings, or the use of deprecated functionality @@ -149,13 +149,13 @@ namespace gl rsx_log.error("log_debug(severity=%d): Unknown severity level", severity); rsx_log.error("[DEBUG_OUTPUT] [%s] [%s] [%d]: %s", str_source, str_type, id, message); return; - } + } } void enable_debugging() { - glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); - glDebugMessageCallback(log_debug, nullptr); + glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + glDebugMessageCallback(log_debug, nullptr); } const capabilities& get_driver_caps() @@ -186,4 +186,4 @@ namespace gl fmt::throw_exception("unknown primitive type"); } } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLHelpers.h b/rpcs3/rpcs3/Emu/RSX/GL/GLHelpers.h index 368cd9e12..db9bbaef2 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLHelpers.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLHelpers.h @@ -30,10 +30,9 @@ #define APIENTRY #endif - namespace gl { void enable_debugging(); bool is_primitive_native(rsx::primitive_type in); GLenum draw_mode(rsx::primitive_type in); -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLOverlays.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLOverlays.cpp index 983bed6f8..33e1e0507 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLOverlays.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLOverlays.cpp @@ -200,18 +200,16 @@ namespace gl ui_overlay_renderer::ui_overlay_renderer() { vs_src = - #include "../Program/GLSLSnippets/OverlayRenderVS.glsl" - ; +#include "../Program/GLSLSnippets/OverlayRenderVS.glsl" + ; fs_src = - #include "../Program/GLSLSnippets/OverlayRenderFS.glsl" - ; +#include "../Program/GLSLSnippets/OverlayRenderFS.glsl" + ; vs_src = fmt::replace_all(vs_src, - { - { "#version 450", "#version 420" }, - { "%preprocessor", "// %preprocessor" } - }); + {{"#version 450", "#version 420"}, + {"%preprocessor", "// %preprocessor"}}); fs_src = fmt::replace_all(fs_src, "%preprocessor", "// %preprocessor"); // Smooth filtering required for inputs @@ -223,7 +221,7 @@ namespace gl auto tex = std::make_unique(GL_TEXTURE_2D, desc->w, desc->h, 1, 1, 1, GL_RGBA8, RSX_FORMAT_CLASS_COLOR); tex->copy_from(desc->get_data(), gl::texture::format::rgba, gl::texture::type::uint_8_8_8_8, {}); - const GLenum remap[] = { GL_RED, GL_ALPHA, GL_BLUE, GL_GREEN }; + const GLenum remap[] = {GL_RED, GL_ALPHA, GL_BLUE, GL_GREEN}; auto view = std::make_unique(tex.get(), remap); auto result = view.get(); @@ -308,7 +306,7 @@ namespace gl auto tex = std::make_unique(GL_TEXTURE_2D_ARRAY, font_size.width, font_size.height, font_size.depth, 1, 1, GL_R8, RSX_FORMAT_CLASS_COLOR); tex->copy_from(glyph_data.data(), gl::texture::format::r, gl::texture::type::ubyte, {}); - GLenum remap[] = { GL_RED, GL_RED, GL_RED, GL_RED }; + GLenum remap[] = {GL_RED, GL_RED, GL_RED, GL_RED}; auto view = std::make_unique(tex.get(), remap); auto result = view.get(); @@ -345,21 +343,21 @@ namespace gl switch (type) { - case rsx::overlays::primitive_type::quad_list: - case rsx::overlays::primitive_type::triangle_strip: - primitives = GL_TRIANGLE_STRIP; - break; - case rsx::overlays::primitive_type::line_list: - primitives = GL_LINES; - break; - case rsx::overlays::primitive_type::line_strip: - primitives = GL_LINE_STRIP; - break; - case rsx::overlays::primitive_type::triangle_fan: - primitives = GL_TRIANGLE_FAN; - break; - default: - fmt::throw_exception("Unexpected primitive type %d", static_cast(type)); + case rsx::overlays::primitive_type::quad_list: + case rsx::overlays::primitive_type::triangle_strip: + primitives = GL_TRIANGLE_STRIP; + break; + case rsx::overlays::primitive_type::line_list: + primitives = GL_LINES; + break; + case rsx::overlays::primitive_type::line_strip: + primitives = GL_LINE_STRIP; + break; + case rsx::overlays::primitive_type::triangle_fan: + primitives = GL_TRIANGLE_FAN; + break; + default: + fmt::throw_exception("Unexpected primitive type %d", static_cast(type)); } } @@ -447,15 +445,15 @@ namespace gl rsx::overlays::vertex_options vert_opts; program_handle.uniforms["vertex_config"] = vert_opts - .disable_vertex_snap(cmd.config.disable_vertex_snap) - .get(); + .disable_vertex_snap(cmd.config.disable_vertex_snap) + .get(); rsx::overlays::fragment_options draw_opts; program_handle.uniforms["fragment_config"] = draw_opts - .texture_mode(texture_mode) - .clip_fragments(cmd.config.clip_region) - .pulse_glow(cmd.config.pulse_glow) - .get(); + .texture_mode(texture_mode) + .clip_fragments(cmd.config.clip_region) + .pulse_glow(cmd.config.pulse_glow) + .get(); program_handle.uniforms["timestamp"] = cmd.config.get_sinus_value(); program_handle.uniforms["albedo"] = cmd.config.color; @@ -470,18 +468,18 @@ namespace gl video_out_calibration_pass::video_out_calibration_pass() { vs_src = - #include "../Program/GLSLSnippets/GenericVSPassthrough.glsl" - ; +#include "../Program/GLSLSnippets/GenericVSPassthrough.glsl" + ; fs_src = - #include "../Program/GLSLSnippets/VideoOutCalibrationPass.glsl" - ; +#include "../Program/GLSLSnippets/VideoOutCalibrationPass.glsl" + ; std::pair repl_list[] = - { - { "%sampler_binding", fmt::format("(%d - x)", GL_TEMP_IMAGE_SLOT(0)) }, - { "%set_decorator, ", "" }, - }; + { + {"%sampler_binding", fmt::format("(%d - x)", GL_TEMP_IMAGE_SLOT(0))}, + {"%set_decorator, ", ""}, + }; fs_src = fmt::replace_all(fs_src, repl_list); m_input_filter = gl::filter::linear; @@ -499,7 +497,7 @@ namespace gl program_handle.uniforms["gamma"] = gamma; program_handle.uniforms["limit_range"] = limited_rgb + 0; program_handle.uniforms["stereo_display_mode"] = static_cast(stereo_mode); - program_handle.uniforms["stereo_image_count"] = (source[1] == GL_NONE? 1 : 2); + program_handle.uniforms["stereo_image_count"] = (source[1] == GL_NONE ? 1 : 2); saved_sampler_state saved(GL_TEMP_IMAGE_SLOT(0), m_sampler); cmd->bind_texture(GL_TEMP_IMAGE_SLOT(0), GL_TEXTURE_2D, source[0]); @@ -513,25 +511,24 @@ namespace gl rp_ssbo_to_generic_texture::rp_ssbo_to_generic_texture() { vs_src = - #include "../Program/GLSLSnippets/GenericVSPassthrough.glsl" - ; +#include "../Program/GLSLSnippets/GenericVSPassthrough.glsl" + ; fs_src = - #include "../Program/GLSLSnippets/CopyBufferToGenericImage.glsl" - ; +#include "../Program/GLSLSnippets/CopyBufferToGenericImage.glsl" + ; const auto& caps = gl::get_driver_caps(); const bool stencil_export_supported = caps.ARB_shader_stencil_export_supported; const bool legacy_format_support = caps.subvendor_ATI; std::pair repl_list[] = - { - { "%set, ", "" }, - { "%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0)) }, - { "%push_block", fmt::format("binding=%d, std140", GL_COMPUTE_BUFFER_SLOT(1)) }, - { "%stencil_export_supported", stencil_export_supported ? "1" : "0" }, - { "%legacy_format_support", legacy_format_support ? "1" : "0" } - }; + { + {"%set, ", ""}, + {"%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0))}, + {"%push_block", fmt::format("binding=%d, std140", GL_COMPUTE_BUFFER_SLOT(1))}, + {"%stencil_export_supported", stencil_export_supported ? "1" : "0"}, + {"%legacy_format_support", legacy_format_support ? "1" : "0"}}; fs_src = fmt::replace_all(fs_src, repl_list); @@ -567,4 +564,4 @@ namespace gl gl::nil_texture_view view(dst); run(cmd, src, &view, src_offset, dst_region, layout); } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLOverlays.h b/rpcs3/rpcs3/Emu/RSX/GL/GLOverlays.h index bd2be2d0e..2499f7925 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLOverlays.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLOverlays.h @@ -110,11 +110,11 @@ namespace gl // TODO: Replace with a proper manager extern std::unordered_map> g_overlay_passes; - template + template T* get_overlay_pass() { u32 index = stx::typeindex(); - auto &e = g_overlay_passes[index]; + auto& e = g_overlay_passes[index]; if (!e) { @@ -126,4 +126,4 @@ namespace gl } void destroy_overlay_passes(); -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLPipelineCompiler.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLPipelineCompiler.cpp index bdf03c6ff..6a9fe12a9 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLPipelineCompiler.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLPipelineCompiler.cpp @@ -140,4 +140,4 @@ namespace gl return g_pipe_compilers.get()->begin() + (thread_index % g_num_pipe_compilers); } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLPipelineCompiler.h b/rpcs3/rpcs3/Emu/RSX/GL/GLPipelineCompiler.h index 4d4dbc020..f70994d8b 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLPipelineCompiler.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLPipelineCompiler.h @@ -36,7 +36,6 @@ namespace gl void operator()(); private: - struct pipe_compiler_job { build_callback_t post_create_func; @@ -45,7 +44,8 @@ namespace gl pipe_compiler_job(build_callback_t post_create, build_callback_t post_link, storage_callback_t completion) : post_create_func(post_create), post_link_func(post_link), completion_callback(completion) - {} + { + } }; lf_queue m_work_queue; @@ -68,4 +68,4 @@ namespace gl void destroy_pipe_compiler(); pipe_compiler* get_pipe_compiler(); -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLPresent.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLPresent.cpp index c73415edb..1379c56d4 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLPresent.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLPresent.cpp @@ -29,7 +29,7 @@ namespace gl g_vis_texture.reset(new texture(target, visual->width(), visual->height(), 1, 1, 1, ifmt, visual->format_class())); glCopyImageSubData(visual->id(), target, 0, 0, 0, 0, g_vis_texture->id(), target, 0, 0, 0, 0, visual->width(), visual->height(), 1); } - } + } // namespace debug GLenum RSX_display_format_to_gl_format(u8 format) { @@ -46,7 +46,7 @@ namespace gl return GL_RGBA16F; } } -} +} // namespace gl gl::texture* GLGSRender::get_present_source(gl::present_surface_info* info, const rsx::avconf& avconfig) { @@ -56,7 +56,7 @@ gl::texture* GLGSRender::get_present_source(gl::present_surface_info* info, cons // See notes on the vulkan implementation on what needs to happen before that is viable. // Check the surface store first - gl::command_context cmd = { gl_state }; + gl::command_context cmd = {gl_state}; const auto format_bpp = rsx::get_format_block_size_in_bytes(info->format); const auto overlap_info = m_rtts.get_merged_texture_memory_region(cmd, info->address, info->width, info->height, info->pitch, format_bpp, rsx::surface_access::transfer_read); @@ -101,11 +101,12 @@ gl::texture* GLGSRender::get_present_source(gl::present_surface_info* info, cons } } else if (auto surface = m_gl_texture_cache.find_texture_from_dimensions(info->address, info->format); - surface && surface->get_width() >= info->width && surface->get_height() >= info->height) + surface && surface->get_width() >= info->width && surface->get_height() >= info->height) { // Hack - this should be the first location to check for output // The render might have been done offscreen or in software and a blit used to display - if (const auto tex = surface->get_raw_texture(); tex) image = tex; + if (const auto tex = surface->get_raw_texture(); tex) + image = tex; } const GLenum expected_format = gl::RSX_display_format_to_gl_format(avconfig.format); @@ -113,7 +114,7 @@ gl::texture* GLGSRender::get_present_source(gl::present_surface_info* info, cons auto initialize_scratch_image = [&]() { - if (!flip_image || flip_image->size2D() != sizeu{ info->width, info->height }) + if (!flip_image || flip_image->size2D() != sizeu{info->width, info->height}) { flip_image = std::make_unique(GL_TEXTURE_2D, info->width, info->height, 1, 1, 1, expected_format, RSX_FORMAT_CLASS_COLOR); } @@ -128,7 +129,7 @@ gl::texture* GLGSRender::get_present_source(gl::present_surface_info* info, cons initialize_scratch_image(); - gl::command_context cmd{ gl_state }; + gl::command_context cmd{gl_state}; const auto range = utils::address_range::start_length(info->address, info->pitch * info->height); m_gl_texture_cache.invalidate_range(cmd, range, rsx::invalidation_cause::read); @@ -143,11 +144,11 @@ gl::texture* GLGSRender::get_present_source(gl::present_surface_info* info, cons if (gl::formats_are_bitcast_compatible(flip_image.get(), image)) { const position3u offset{}; - gl::g_hw_blitter->copy_image(cmd, image, flip_image.get(), 0, 0, offset, offset, { info->width, info->height, 1 }); + gl::g_hw_blitter->copy_image(cmd, image, flip_image.get(), 0, 0, offset, offset, {info->width, info->height, 1}); } else { - const coord3u region = { {/* offsets */}, { info->width, info->height, 1 } }; + const coord3u region = {{/* offsets */}, {info->width, info->height, 1}}; gl::copy_typeless(cmd, flip_image.get(), image, region, region); } @@ -166,7 +167,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) return; } - gl::command_context cmd{ gl_state }; + gl::command_context cmd{gl_state}; u32 buffer_width = display_buffers[info.buffer].width; u32 buffer_height = display_buffers[info.buffer].height; @@ -209,15 +210,13 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) if (info.buffer < display_buffers_count && buffer_width && buffer_height) { // Find the source image - gl::present_surface_info present_info - { + gl::present_surface_info present_info{ .address = rsx::get_address(display_buffers[info.buffer].offset, CELL_GCM_LOCATION_LOCAL), .format = av_format, .width = buffer_width, .height = buffer_height, .pitch = buffer_pitch, - .eye = 0 - }; + .eye = 0}; image_to_flip = get_present_source(&present_info, avconfig); @@ -261,12 +260,12 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) if (!g_cfg.video.stretch_to_display_area) { const sizeu csize(width, height); - const auto converted = avconfig.aspect_convert_region(size2u{ buffer_width, buffer_height }, csize); + const auto converted = avconfig.aspect_convert_region(size2u{buffer_width, buffer_height}, csize); aspect_ratio = static_cast(converted); } else { - aspect_ratio = { 0, 0, width, height }; + aspect_ratio = {0, 0, width, height}; } if (!image_to_flip || aspect_ratio.x1 || aspect_ratio.y1) @@ -300,7 +299,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) } } - const areai screen_area = coordi({}, { static_cast(buffer_width), static_cast(buffer_height) }); + const areai screen_area = coordi({}, {static_cast(buffer_width), static_cast(buffer_height)}); const bool use_full_rgb_range_output = g_cfg.video.full_rgb_range_output.get(); const bool backbuffer_has_alpha = m_frame->has_alpha(); @@ -333,7 +332,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) const f32 gamma = avconfig.gamma; const bool limited_range = !use_full_rgb_range_output; const auto filter = m_output_scaling == output_scaling_mode::nearest ? gl::filter::nearest : gl::filter::linear; - rsx::simple_array images{ image_to_flip, image_to_flip2 }; + rsx::simple_array images{image_to_flip, image_to_flip2}; if (m_output_scaling == output_scaling_mode::fsr && avconfig.stereo_mode == stereo_render_mode_options::disabled) // 3D will be implemented later { @@ -397,14 +396,10 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) const auto texture_upload_miss_ratio = m_gl_texture_cache.get_texture_upload_miss_percentage(); const auto texture_copies_ellided = m_gl_texture_cache.get_texture_copies_ellided_this_frame(); const auto vertex_cache_hit_count = (info.stats.vertex_cache_request_count - info.stats.vertex_cache_miss_count); - const auto vertex_cache_hit_ratio = info.stats.vertex_cache_request_count - ? (vertex_cache_hit_count * 100) / info.stats.vertex_cache_request_count - : 0; + const auto vertex_cache_hit_ratio = info.stats.vertex_cache_request_count ? (vertex_cache_hit_count * 100) / info.stats.vertex_cache_request_count : 0; const auto program_cache_lookups = info.stats.program_cache_lookups_total; const auto program_cache_ellided = info.stats.program_cache_lookups_ellided; - const auto program_cache_ellision_rate = program_cache_lookups - ? (program_cache_ellided * 100) / program_cache_lookups - : 0; + const auto program_cache_ellision_rate = program_cache_lookups ? (program_cache_ellided * 100) / program_cache_lookups : 0; rsx::overlays::set_debug_overlay_text(fmt::format( "Internal Resolution: %s\n" @@ -426,8 +421,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) num_flushes, num_misses, cache_miss_ratio, num_unavoidable, num_mispredict, num_speculate, num_texture_upload, num_texture_upload_miss, texture_upload_miss_ratio, texture_copies_ellided, vertex_cache_hit_count, info.stats.vertex_cache_request_count, vertex_cache_hit_ratio, - program_cache_ellided, program_cache_lookups, program_cache_ellision_rate) - ); + program_cache_ellided, program_cache_lookups, program_cache_ellision_rate)); } if (gl::debug::g_vis_texture) @@ -449,7 +443,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) display_view.y1 = vis_height; // Blit - const auto src_region = areau{ 0u, 0u, gl::debug::g_vis_texture->width(), gl::debug::g_vis_texture->height() }; + const auto src_region = areau{0u, 0u, gl::debug::g_vis_texture->width(), gl::debug::g_vis_texture->height()}; m_vis_buffer.blit(gl::screen, static_cast(src_region), display_view, gl::buffers::color, gl::filter::linear); m_vis_buffer.remove(); } @@ -463,12 +457,14 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info) auto removed_textures = m_rtts.trim(cmd); m_framebuffer_cache.remove_if([&](auto& fbo) - { - if (fbo.unused_check_count() >= 2) return true; // Remove if stale - if (fbo.references_any(removed_textures)) return true; // Remove if any of the attachments is invalid + { + if (fbo.unused_check_count() >= 2) + return true; // Remove if stale + if (fbo.references_any(removed_textures)) + return true; // Remove if any of the attachments is invalid - return false; - }); + return false; + }); if (m_draw_fbo && !m_graphics_state.test(rsx::rtt_config_dirty)) { diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLProgramBuffer.h b/rpcs3/rpcs3/Emu/RSX/GL/GLProgramBuffer.h index 8dd34caac..5f57174d8 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLProgramBuffer.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLProgramBuffer.h @@ -13,27 +13,23 @@ struct GLTraits using pipeline_storage_type = std::unique_ptr; using pipeline_properties = void*; - static - void recompile_fragment_program(const RSXFragmentProgram &RSXFP, fragment_program_type& fragmentProgramData, usz /*ID*/) + static void recompile_fragment_program(const RSXFragmentProgram& RSXFP, fragment_program_type& fragmentProgramData, usz /*ID*/) { fragmentProgramData.Decompile(RSXFP); } - static - void recompile_vertex_program(const RSXVertexProgram &RSXVP, vertex_program_type& vertexProgramData, usz /*ID*/) + static void recompile_vertex_program(const RSXVertexProgram& RSXVP, vertex_program_type& vertexProgramData, usz /*ID*/) { vertexProgramData.Decompile(RSXVP); } - static - void validate_pipeline_properties(const vertex_program_type&, const fragment_program_type&, pipeline_properties&) + static void validate_pipeline_properties(const vertex_program_type&, const fragment_program_type&, pipeline_properties&) { } - static - pipeline_type* build_pipeline( - const vertex_program_type &vertexProgramData, - const fragment_program_type &fragmentProgramData, + static pipeline_type* build_pipeline( + const vertex_program_type& vertexProgramData, + const fragment_program_type& fragmentProgramData, const pipeline_properties&, bool compile_async, std::function callback) @@ -41,8 +37,7 @@ struct GLTraits auto compiler = gl::get_pipe_compiler(); auto flags = (compile_async) ? gl::pipe_compiler::COMPILE_DEFERRED : gl::pipe_compiler::COMPILE_INLINE; - auto post_create_func = [vp = &vertexProgramData.shader, fp = &fragmentProgramData.shader] - (gl::glsl::program* program) + auto post_create_func = [vp = &vertexProgramData.shader, fp = &fragmentProgramData.shader](gl::glsl::program* program) { if (!vp->compiled()) { @@ -122,18 +117,18 @@ struct GLProgramBuffer : public program_state_cache return 0; } - u64 get_hash(const RSXVertexProgram &prog) + u64 get_hash(const RSXVertexProgram& prog) { return program_hash_util::vertex_program_utils::get_vertex_program_ucode_hash(prog); } - u64 get_hash(const RSXFragmentProgram &prog) + u64 get_hash(const RSXFragmentProgram& prog) { return program_hash_util::fragment_program_utils::get_fragment_program_ucode_hash(prog); } template - void add_pipeline_entry(const RSXVertexProgram& vp, const RSXFragmentProgram& fp, void* &props, Args&& ...args) + void add_pipeline_entry(const RSXVertexProgram& vp, const RSXFragmentProgram& fp, void*& props, Args&&... args) { get_graphics_pipeline(nullptr, vp, fp, props, false, false, std::forward(args)...); } diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp index 87e5ee564..cbb623938 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp @@ -7,62 +7,62 @@ color_format rsx::internals::surface_color_format_to_gl(rsx::surface_color_format color_format) { - //color format + // color format switch (color_format) { case rsx::surface_color_format::r5g6b5: - return{ ::gl::texture::type::ushort_5_6_5, ::gl::texture::format::rgb, ::gl::texture::internal_format::rgb565, true }; + return {::gl::texture::type::ushort_5_6_5, ::gl::texture::format::rgb, ::gl::texture::internal_format::rgb565, true}; case rsx::surface_color_format::a8r8g8b8: - return{ ::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::bgra, ::gl::texture::internal_format::bgra8, true }; + return {::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::bgra, ::gl::texture::internal_format::bgra8, true}; - //These formats discard their alpha component, forced to 0 or 1 - //All XBGR formats will have remapping before they can be read back in shaders as DRGB8 - //Prefix o = 1, z = 0 + // These formats discard their alpha component, forced to 0 or 1 + // All XBGR formats will have remapping before they can be read back in shaders as DRGB8 + // Prefix o = 1, z = 0 case rsx::surface_color_format::x1r5g5b5_o1r5g5b5: - return{ ::gl::texture::type::ushort_5_5_5_1, ::gl::texture::format::rgb, ::gl::texture::internal_format::bgr5a1, true, - { ::gl::texture::channel::one, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b } }; + return {::gl::texture::type::ushort_5_5_5_1, ::gl::texture::format::rgb, ::gl::texture::internal_format::bgr5a1, true, + {::gl::texture::channel::one, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b}}; case rsx::surface_color_format::x1r5g5b5_z1r5g5b5: - return{ ::gl::texture::type::ushort_5_5_5_1, ::gl::texture::format::rgb, ::gl::texture::internal_format::bgr5a1, true, - { ::gl::texture::channel::zero, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b } }; + return {::gl::texture::type::ushort_5_5_5_1, ::gl::texture::format::rgb, ::gl::texture::internal_format::bgr5a1, true, + {::gl::texture::channel::zero, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b}}; case rsx::surface_color_format::x8r8g8b8_z8r8g8b8: - return{ ::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::bgra, ::gl::texture::internal_format::bgra8, true, - { ::gl::texture::channel::zero, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b } }; + return {::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::bgra, ::gl::texture::internal_format::bgra8, true, + {::gl::texture::channel::zero, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b}}; case rsx::surface_color_format::x8b8g8r8_o8b8g8r8: - return{ ::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::rgba, ::gl::texture::internal_format::rgba8, true, - { ::gl::texture::channel::one, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b } }; + return {::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::rgba, ::gl::texture::internal_format::rgba8, true, + {::gl::texture::channel::one, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b}}; case rsx::surface_color_format::x8b8g8r8_z8b8g8r8: - return{ ::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::rgba, ::gl::texture::internal_format::rgba8, true, - { ::gl::texture::channel::zero, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b } }; + return {::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::rgba, ::gl::texture::internal_format::rgba8, true, + {::gl::texture::channel::zero, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b}}; case rsx::surface_color_format::x8r8g8b8_o8r8g8b8: - return{ ::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::bgra, ::gl::texture::internal_format::bgra8, true, - { ::gl::texture::channel::one, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b } }; + return {::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::bgra, ::gl::texture::internal_format::bgra8, true, + {::gl::texture::channel::one, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b}}; case rsx::surface_color_format::w16z16y16x16: - return{ ::gl::texture::type::f16, ::gl::texture::format::rgba, ::gl::texture::internal_format::rgba16f, true}; + return {::gl::texture::type::f16, ::gl::texture::format::rgba, ::gl::texture::internal_format::rgba16f, true}; case rsx::surface_color_format::w32z32y32x32: - return{ ::gl::texture::type::f32, ::gl::texture::format::rgba, ::gl::texture::internal_format::rgba32f, true}; + return {::gl::texture::type::f32, ::gl::texture::format::rgba, ::gl::texture::internal_format::rgba32f, true}; case rsx::surface_color_format::b8: - return{ ::gl::texture::type::ubyte, ::gl::texture::format::r, ::gl::texture::internal_format::r8, false, - { ::gl::texture::channel::one, ::gl::texture::channel::r, ::gl::texture::channel::r, ::gl::texture::channel::r } }; + return {::gl::texture::type::ubyte, ::gl::texture::format::r, ::gl::texture::internal_format::r8, false, + {::gl::texture::channel::one, ::gl::texture::channel::r, ::gl::texture::channel::r, ::gl::texture::channel::r}}; case rsx::surface_color_format::g8b8: - return{ ::gl::texture::type::ubyte, ::gl::texture::format::rg, ::gl::texture::internal_format::rg8, false, - { ::gl::texture::channel::g, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::r } }; + return {::gl::texture::type::ubyte, ::gl::texture::format::rg, ::gl::texture::internal_format::rg8, false, + {::gl::texture::channel::g, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::r}}; case rsx::surface_color_format::x32: - return{ ::gl::texture::type::f32, ::gl::texture::format::r, ::gl::texture::internal_format::r32f, true, - { ::gl::texture::channel::r, ::gl::texture::channel::r, ::gl::texture::channel::r, ::gl::texture::channel::r } }; + return {::gl::texture::type::f32, ::gl::texture::format::r, ::gl::texture::internal_format::r32f, true, + {::gl::texture::channel::r, ::gl::texture::channel::r, ::gl::texture::channel::r, ::gl::texture::channel::r}}; case rsx::surface_color_format::a8b8g8r8: - return{ ::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::rgba, ::gl::texture::internal_format::rgba8, true }; + return {::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::rgba, ::gl::texture::internal_format::rgba8, true}; default: fmt::throw_exception("Unsupported surface color format 0x%x", static_cast(color_format)); @@ -74,17 +74,17 @@ depth_format rsx::internals::surface_depth_format_to_gl(rsx::surface_depth_forma switch (depth_format) { case rsx::surface_depth_format2::z16_uint: - return{ ::gl::texture::type::ushort, ::gl::texture::format::depth, ::gl::texture::internal_format::depth16 }; + return {::gl::texture::type::ushort, ::gl::texture::format::depth, ::gl::texture::internal_format::depth16}; case rsx::surface_depth_format2::z16_float: - return{ ::gl::texture::type::f32, ::gl::texture::format::depth, ::gl::texture::internal_format::depth32f }; + return {::gl::texture::type::f32, ::gl::texture::format::depth, ::gl::texture::internal_format::depth32f}; case rsx::surface_depth_format2::z24s8_uint: if (g_cfg.video.force_high_precision_z_buffer && ::gl::get_driver_caps().ARB_depth_buffer_float_supported) - return{ ::gl::texture::type::uint_24_8, ::gl::texture::format::depth_stencil, ::gl::texture::internal_format::depth32f_stencil8 }; + return {::gl::texture::type::uint_24_8, ::gl::texture::format::depth_stencil, ::gl::texture::internal_format::depth32f_stencil8}; else - return{ ::gl::texture::type::uint_24_8, ::gl::texture::format::depth_stencil, ::gl::texture::internal_format::depth24_stencil8 }; + return {::gl::texture::type::uint_24_8, ::gl::texture::format::depth_stencil, ::gl::texture::internal_format::depth24_stencil8}; case rsx::surface_depth_format2::z24s8_float: - return{ ::gl::texture::type::float32_uint8, ::gl::texture::format::depth_stencil, ::gl::texture::internal_format::depth32f_stencil8 }; + return {::gl::texture::type::float32_uint8, ::gl::texture::format::depth_stencil, ::gl::texture::internal_format::depth32f_stencil8}; default: fmt::throw_exception("Unsupported depth format 0x%x", static_cast(depth_format)); @@ -135,7 +135,7 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /* return; } - gl::command_context cmd{ gl_state }; + gl::command_context cmd{gl_state}; m_rtts.prepare_render_target(cmd, m_framebuffer_layout.color_format, m_framebuffer_layout.depth_format, m_framebuffer_layout.width, m_framebuffer_layout.height, @@ -218,7 +218,7 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /* static_cast(m_draw_fbo)->release(); } - for (auto &fbo : m_framebuffer_cache) + for (auto& fbo : m_framebuffer_cache) { if (fbo.matches(color_targets, depth_stencil_target)) { @@ -226,7 +226,7 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /* m_draw_fbo = &fbo; m_draw_fbo->bind(); - m_draw_fbo->set_extents({ m_framebuffer_layout.width, m_framebuffer_layout.height }); + m_draw_fbo->set_extents({m_framebuffer_layout.width, m_framebuffer_layout.height}); m_graphics_state.set(rsx::rtt_config_valid); break; @@ -241,7 +241,7 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /* m_draw_fbo = &m_framebuffer_cache.back(); m_draw_fbo->create(); m_draw_fbo->bind(); - m_draw_fbo->set_extents({ m_framebuffer_layout.width, m_framebuffer_layout.height }); + m_draw_fbo->set_extents({m_framebuffer_layout.width, m_framebuffer_layout.height}); for (int i = 0; i < 4; ++i) { @@ -279,17 +279,17 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /* break; case rsx::surface_target::surfaces_a_b: - m_draw_fbo->draw_buffers({ m_draw_fbo->color[0], m_draw_fbo->color[1] }); + m_draw_fbo->draw_buffers({m_draw_fbo->color[0], m_draw_fbo->color[1]}); m_draw_fbo->read_buffer(m_draw_fbo->color[0]); break; case rsx::surface_target::surfaces_a_b_c: - m_draw_fbo->draw_buffers({ m_draw_fbo->color[0], m_draw_fbo->color[1], m_draw_fbo->color[2] }); + m_draw_fbo->draw_buffers({m_draw_fbo->color[0], m_draw_fbo->color[1], m_draw_fbo->color[2]}); m_draw_fbo->read_buffer(m_draw_fbo->color[0]); break; case rsx::surface_target::surfaces_a_b_c_d: - m_draw_fbo->draw_buffers({ m_draw_fbo->color[0], m_draw_fbo->color[1], m_draw_fbo->color[2], m_draw_fbo->color[3] }); + m_draw_fbo->draw_buffers({m_draw_fbo->color[0], m_draw_fbo->color[1], m_draw_fbo->color[2], m_draw_fbo->color[3]}); m_draw_fbo->read_buffer(m_draw_fbo->color[0]); break; } @@ -327,7 +327,7 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /* for (auto& [base_addr, surface] : m_rtts.orphaned_surfaces) { bool lock = surface->is_depth_surface() ? !!g_cfg.video.write_depth_buffer : - !!g_cfg.video.write_color_buffers; + !!g_cfg.video.write_color_buffers; if (lock && #ifdef TEXTURE_CACHE_DEBUG @@ -338,7 +338,7 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /* #else !surface->is_locked() #endif - ) + ) { lock = false; } @@ -376,7 +376,8 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /* const auto color_format = rsx::internals::surface_color_format_to_gl(m_framebuffer_layout.color_format); for (u8 i = 0; i < rsx::limits::color_buffers_count; ++i) { - if (!m_surface_info[i].address || !m_surface_info[i].pitch) continue; + if (!m_surface_info[i].address || !m_surface_info[i].pitch) + continue; const auto surface_range = m_surface_info[i].get_memory_range(); if (g_cfg.video.write_color_buffers) @@ -442,22 +443,22 @@ void gl::render_target::load_memory(gl::command_context& cmd) subres.height_in_block = subres.height_in_texel = surface_height * samples_y; subres.pitch_in_block = rsx_pitch / get_bpp(); subres.depth = 1; - subres.data = { vm::get_super_ptr(base_addr), static_cast::size_type>(rsx_pitch * surface_height * samples_y) }; + subres.data = {vm::get_super_ptr(base_addr), static_cast::size_type>(rsx_pitch * surface_height * samples_y)}; // TODO: MSAA support if (g_cfg.video.resolution_scale_percent == 100 && spp == 1) [[likely]] { - gl::upload_texture(cmd, this, get_gcm_format(), is_swizzled, { subres }); + gl::upload_texture(cmd, this, get_gcm_format(), is_swizzled, {subres}); } else { auto tmp = std::make_unique(GL_TEXTURE_2D, subres.width_in_block, subres.height_in_block, 1, 1, 1, static_cast(get_internal_format()), format_class()); auto dst = samples() > 1 ? get_resolve_target_safe(cmd) : this; - gl::upload_texture(cmd, tmp.get(), get_gcm_format(), is_swizzled, { subres }); + gl::upload_texture(cmd, tmp.get(), get_gcm_format(), is_swizzled, {subres}); gl::g_hw_blitter->scale_image(cmd, tmp.get(), dst, - { 0, 0, subres.width_in_block, subres.height_in_block }, - { 0, 0, static_cast(width()), static_cast(height()) }, + {0, 0, subres.width_in_block, subres.height_in_block}, + {0, 0, static_cast(width()), static_cast(height())}, !is_depth_surface(), {}); @@ -473,8 +474,8 @@ void gl::render_target::load_memory(gl::command_context& cmd) void gl::render_target::initialize_memory(gl::command_context& cmd, rsx::surface_access access) { const bool memory_load = is_depth_surface() ? - !!g_cfg.video.read_depth_buffer : - !!g_cfg.video.read_color_buffers; + !!g_cfg.video.read_depth_buffer : + !!g_cfg.video.read_color_buffers; if (!memory_load) { @@ -573,7 +574,7 @@ void gl::render_target::memory_barrier(gl::command_context& cmd, rsx::surface_ac for (auto i = first; i < old_contents.size(); ++i) { - auto §ion = old_contents[i]; + auto& section = old_contents[i]; auto src_texture = gl::as_rtt(section.source); const auto src_bpp = src_texture->get_bpp(); rsx::typeless_xfer typeless_info{}; @@ -684,8 +685,7 @@ gl::viewable_image* gl::render_target::get_resolve_target_safe(gl::command_conte resolve_w, resolve_h, 1, 1, 1, static_cast(get_internal_format()), - format_class() - )); + format_class())); } return static_cast(resolve_surface.get()); diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLRenderTargets.h b/rpcs3/rpcs3/Emu/RSX/GL/GLRenderTargets.h index 9b01746a8..840e6fbd1 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLRenderTargets.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLRenderTargets.h @@ -41,8 +41,8 @@ namespace rsx color_format surface_color_format_to_gl(rsx::surface_color_format color_format); depth_format surface_depth_format_to_gl(rsx::surface_depth_format2 depth_format); u8 get_pixel_size(rsx::surface_depth_format format); - } -} + } // namespace internals +} // namespace rsx namespace gl { @@ -63,7 +63,8 @@ namespace gl public: render_target(GLuint width, GLuint height, GLubyte samples, GLenum sized_format, rsx::format_class format_class) : viewable_image(GL_TEXTURE_2D, width, height, 1, 1, samples, sized_format, format_class) - {} + { + } // Internal pitch is the actual row length in bytes of the openGL texture void set_native_pitch(u32 pitch) @@ -97,14 +98,20 @@ namespace gl bool matches_dimensions(u16 _width, u16 _height) const { - //Use forward scaling to account for rounding and clamping errors + // Use forward scaling to account for rounding and clamping errors const auto [scaled_w, scaled_h] = rsx::apply_resolution_scale(_width, _height); return (scaled_w == width()) && (scaled_h == height()); } void memory_barrier(gl::command_context& cmd, rsx::surface_access access); - void read_barrier(gl::command_context& cmd) { memory_barrier(cmd, rsx::surface_access::shader_read); } - void write_barrier(gl::command_context& cmd) { memory_barrier(cmd, rsx::surface_access::shader_write); } + void read_barrier(gl::command_context& cmd) + { + memory_barrier(cmd, rsx::surface_access::shader_read); + } + void write_barrier(gl::command_context& cmd) + { + memory_barrier(cmd, rsx::surface_access::shader_write); + } }; struct framebuffer_holder : public gl::fbo, public rsx::ref_counted @@ -121,7 +128,7 @@ namespace gl { return ensure(dynamic_cast(t)); } -} +} // namespace gl struct gl_render_target_traits { @@ -133,13 +140,11 @@ struct gl_render_target_traits using download_buffer_object = std::vector; using barrier_descriptor_t = rsx::deferred_clipped_region; - static - std::unique_ptr create_new_surface( + static std::unique_ptr create_new_surface( u32 address, rsx::surface_color_format surface_color_format, usz width, usz height, usz pitch, - rsx::surface_antialiasing antialias - ) + rsx::surface_antialiasing antialias) { auto format = rsx::internals::surface_color_format_to_gl(surface_color_format); const auto [width_, height_] = rsx::apply_resolution_scale(static_cast(width), static_cast(height)); @@ -165,7 +170,7 @@ struct gl_render_target_traits result->set_surface_dimensions(static_cast(width), static_cast(height), static_cast(pitch)); result->set_format(surface_color_format); - std::array native_layout = { static_cast(format.swizzle.a), static_cast(format.swizzle.r), static_cast(format.swizzle.g), static_cast(format.swizzle.b) }; + std::array native_layout = {static_cast(format.swizzle.a), static_cast(format.swizzle.r), static_cast(format.swizzle.g), static_cast(format.swizzle.b)}; result->set_native_component_layout(native_layout); result->memory_usage_flags = rsx::surface_usage_flags::attachment; @@ -176,13 +181,11 @@ struct gl_render_target_traits return result; } - static - std::unique_ptr create_new_surface( - u32 address, - rsx::surface_depth_format2 surface_depth_format, - usz width, usz height, usz pitch, - rsx::surface_antialiasing antialias - ) + static std::unique_ptr create_new_surface( + u32 address, + rsx::surface_depth_format2 surface_depth_format, + usz width, usz height, usz pitch, + rsx::surface_antialiasing antialias) { auto format = rsx::internals::surface_depth_format_to_gl(surface_depth_format); const auto [width_, height_] = rsx::apply_resolution_scale(static_cast(width), static_cast(height)); @@ -208,7 +211,7 @@ struct gl_render_target_traits result->set_format(surface_depth_format); result->set_native_pitch(static_cast(width) * get_format_block_size_in_bytes(surface_depth_format) * result->samples_x); - std::array native_layout = { GL_RED, GL_RED, GL_RED, GL_RED }; + std::array native_layout = {GL_RED, GL_RED, GL_RED, GL_RED}; result->set_native_component_layout(native_layout); result->memory_usage_flags = rsx::surface_usage_flags::attachment; @@ -219,8 +222,7 @@ struct gl_render_target_traits return result; } - static - void clone_surface( + static void clone_surface( gl::command_context& cmd, std::unique_ptr& sink, gl::render_target* ref, u32 address, barrier_descriptor_t& prev) @@ -265,8 +267,7 @@ struct gl_render_target_traits sink->set_old_contents_region(prev, false); } - static - std::unique_ptr convert_pitch( + static std::unique_ptr convert_pitch( gl::command_context& /*cmd*/, std::unique_ptr& src, usz /*out_pitch*/) @@ -276,8 +277,7 @@ struct gl_render_target_traits return {}; } - static - bool is_compatible_surface(const gl::render_target* surface, const gl::render_target* ref, u16 width, u16 height, u8 sample_count) + static bool is_compatible_surface(const gl::render_target* surface, const gl::render_target* ref, u16 width, u16 height, u8 sample_count) { return (surface->get_internal_format() == ref->get_internal_format() && surface->get_spp() == sample_count && @@ -285,25 +285,22 @@ struct gl_render_target_traits surface->get_surface_height() == height); } - static - void prepare_surface_for_drawing(gl::command_context& cmd, gl::render_target* surface) + static void prepare_surface_for_drawing(gl::command_context& cmd, gl::render_target* surface) { surface->memory_barrier(cmd, rsx::surface_access::gpu_reference); surface->memory_usage_flags |= rsx::surface_usage_flags::attachment; } - static - void prepare_surface_for_sampling(gl::command_context&, gl::render_target*) - {} + static void prepare_surface_for_sampling(gl::command_context&, gl::render_target*) + { + } - static - bool surface_is_pitch_compatible(const std::unique_ptr &surface, usz pitch) + static bool surface_is_pitch_compatible(const std::unique_ptr& surface, usz pitch) { return surface->get_rsx_pitch() == pitch; } - static - void int_invalidate_surface_contents(gl::command_context&, gl::render_target *surface, u32 address, usz pitch) + static void int_invalidate_surface_contents(gl::command_context&, gl::render_target* surface, u32 address, usz pitch) { surface->set_rsx_pitch(static_cast(pitch)); surface->queue_tag(address); @@ -313,8 +310,7 @@ struct gl_render_target_traits surface->raster_type = rsx::surface_raster_type::linear; } - static - void invalidate_surface_contents( + static void invalidate_surface_contents( gl::command_context& cmd, gl::render_target* surface, rsx::surface_color_format format, @@ -322,15 +318,14 @@ struct gl_render_target_traits usz pitch) { auto fmt = rsx::internals::surface_color_format_to_gl(format); - std::array native_layout = { static_cast(fmt.swizzle.a), static_cast(fmt.swizzle.r), static_cast(fmt.swizzle.g), static_cast(fmt.swizzle.b) }; + std::array native_layout = {static_cast(fmt.swizzle.a), static_cast(fmt.swizzle.r), static_cast(fmt.swizzle.g), static_cast(fmt.swizzle.b)}; surface->set_native_component_layout(native_layout); surface->set_format(format); int_invalidate_surface_contents(cmd, surface, address, pitch); } - static - void invalidate_surface_contents( + static void invalidate_surface_contents( gl::command_context& cmd, gl::render_target* surface, rsx::surface_depth_format2 format, @@ -341,8 +336,7 @@ struct gl_render_target_traits int_invalidate_surface_contents(cmd, surface, address, pitch); } - static - void notify_surface_invalidated(const std::unique_ptr& surface) + static void notify_surface_invalidated(const std::unique_ptr& surface) { if (!surface->old_contents.empty()) { @@ -353,20 +347,18 @@ struct gl_render_target_traits surface->release(); } - static - void notify_surface_persist(const std::unique_ptr& /*surface*/) - {} + static void notify_surface_persist(const std::unique_ptr& /*surface*/) + { + } - static - void notify_surface_reused(const std::unique_ptr& surface) + static void notify_surface_reused(const std::unique_ptr& surface) { surface->state_flags |= rsx::surface_state_flags::erase_bkgnd; surface->add_ref(); } - static - bool int_surface_matches_properties( - const std::unique_ptr &surface, + static bool int_surface_matches_properties( + const std::unique_ptr& surface, gl::texture::internal_format format, usz width, usz height, rsx::surface_antialiasing antialias, @@ -376,25 +368,23 @@ struct gl_render_target_traits return false; return surface->get_internal_format() == format && - surface->get_spp() == get_format_sample_count(antialias) && - surface->matches_dimensions(static_cast(width), static_cast(height)); + surface->get_spp() == get_format_sample_count(antialias) && + surface->matches_dimensions(static_cast(width), static_cast(height)); } - static - bool surface_matches_properties( - const std::unique_ptr &surface, + static bool surface_matches_properties( + const std::unique_ptr& surface, rsx::surface_color_format format, usz width, usz height, rsx::surface_antialiasing antialias, - bool check_refs=false) + bool check_refs = false) { const auto internal_fmt = rsx::internals::surface_color_format_to_gl(format).internal_format; return int_surface_matches_properties(surface, internal_fmt, width, height, antialias, check_refs); } - static - bool surface_matches_properties( - const std::unique_ptr &surface, + static bool surface_matches_properties( + const std::unique_ptr& surface, rsx::surface_depth_format2 format, usz width, usz height, rsx::surface_antialiasing antialias, @@ -404,20 +394,17 @@ struct gl_render_target_traits return int_surface_matches_properties(surface, internal_fmt, width, height, antialias, check_refs); } - static - void spill_buffer(std::unique_ptr& /*bo*/) + static void spill_buffer(std::unique_ptr& /*bo*/) { // TODO } - static - void unspill_buffer(std::unique_ptr& /*bo*/) + static void unspill_buffer(std::unique_ptr& /*bo*/) { // TODO } - static - void write_render_target_to_memory( + static void write_render_target_to_memory( gl::command_context&, gl::buffer*, gl::render_target*, @@ -427,16 +414,14 @@ struct gl_render_target_traits } template - static - gl::buffer* merge_bo_list(gl::command_context&, const std::vector& /*list*/) + static gl::buffer* merge_bo_list(gl::command_context&, const std::vector& /*list*/) { // TODO return nullptr; } template - static - T* get(const std::unique_ptr &in) + static T* get(const std::unique_ptr& in) { return in.get(); } @@ -455,16 +440,16 @@ struct gl_render_targets : public rsx::surface_store run_cleanup_internal(cmd, rsx::problem_severity::moderate, 256, [](gl::command_context&) {}); std::vector removed; - invalidated_resources.remove_if([&](auto &rtt) - { - if (rtt->unused_check_count() >= 2) + invalidated_resources.remove_if([&](auto& rtt) { - removed.push_back(rtt->id()); - return true; - } + if (rtt->unused_check_count() >= 2) + { + removed.push_back(rtt->id()); + return true; + } - return false; - }); + return false; + }); return removed; } diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLResolveHelper.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLResolveHelper.cpp index 52cdc39c7..2601d5597 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLResolveHelper.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLResolveHelper.cpp @@ -50,7 +50,7 @@ namespace gl { ensure(src->samples() > 1 && dst->samples() == 1); - if (src->aspect() == gl::image_aspect::color) [[ likely ]] + if (src->aspect() == gl::image_aspect::color) [[likely]] { auto& job = g_resolve_helpers[src->get_internal_format()]; if (!job) @@ -110,7 +110,7 @@ namespace gl { ensure(dst->samples() > 1 && src->samples() == 1); - if (src->aspect() == gl::image_aspect::color) [[ likely ]] + if (src->aspect() == gl::image_aspect::color) [[likely]] { auto& job = g_unresolve_helpers[src->get_internal_format()]; if (!job) @@ -186,20 +186,19 @@ namespace gl } static const char* resolve_kernel = - #include "Emu/RSX/Program/MSAA/ColorResolvePass.glsl" +#include "Emu/RSX/Program/MSAA/ColorResolvePass.glsl" ; static const char* unresolve_kernel = - #include "Emu/RSX/Program/MSAA/ColorUnresolvePass.glsl" +#include "Emu/RSX/Program/MSAA/ColorUnresolvePass.glsl" ; const std::pair syntax_replace[] = - { - { "%WORKGROUP_SIZE_X", std::to_string(cs_wave_x) }, - { "%WORKGROUP_SIZE_Y", std::to_string(cs_wave_y) }, - { "%IMAGE_FORMAT", format_prefix }, - { "%BGRA_SWAP", "0" } - }; + { + {"%WORKGROUP_SIZE_X", std::to_string(cs_wave_x)}, + {"%WORKGROUP_SIZE_Y", std::to_string(cs_wave_y)}, + {"%IMAGE_FORMAT", format_prefix}, + {"%BGRA_SWAP", "0"}}; m_src = unresolve ? unresolve_kernel : resolve_kernel; m_src = fmt::replace_all(m_src, syntax_replace); @@ -285,7 +284,6 @@ namespace gl enable_depth_writes = m_config.resolve_depth; enable_stencil_writes = m_config.resolve_stencil; - create(); rsx_log.notice("Resolve shader:\n%s", fs_src); @@ -362,14 +360,11 @@ namespace gl m_vao.bind(); // Clear the target - gl::clear_cmd_info clear_info - { + gl::clear_cmd_info clear_info{ .aspect_mask = gl::image_aspect::stencil, .clear_stencil = { .mask = 0xFF, - .value = 0 - } - }; + .value = 0}}; gl::clear_attachments(cmd, clear_info); // Override stencil settings. Always pass, reference is all one, compare mask doesn't matter. @@ -388,4 +383,4 @@ namespace gl glBindVertexArray(old_vao); } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLResolveHelper.h b/rpcs3/rpcs3/Emu/RSX/GL/GLResolveHelper.h index 8799efbf2..f03a28f1d 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLResolveHelper.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLResolveHelper.h @@ -19,10 +19,12 @@ namespace gl u32 cs_wave_y = 1; cs_resolve_base() - {} + { + } virtual ~cs_resolve_base() - {} + { + } void build(const std::string& format_prefix, bool unresolve); @@ -126,4 +128,4 @@ namespace gl build(true, true, true); } }; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLShaderInterpreter.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLShaderInterpreter.cpp index 406ece755..e350fc077 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLShaderInterpreter.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLShaderInterpreter.cpp @@ -22,9 +22,11 @@ namespace gl rsx_log.fatal("Unexpected program domain %d", static_cast(domain)); [[fallthrough]]; case ::glsl::program_domain::glsl_vertex_program: - pname = GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS; break; + pname = GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS; + break; case ::glsl::program_domain::glsl_fragment_program: - pname = GL_MAX_TEXTURE_IMAGE_UNITS; break; + pname = GL_MAX_TEXTURE_IMAGE_UNITS; + break; } glGetIntegerv(pname, &max_image_units); @@ -42,7 +44,7 @@ namespace gl pool.pool_size = size; pools.push_back(pool); } - } + } // namespace interpreter void shader_interpreter::create() { @@ -93,14 +95,22 @@ namespace gl } } - if (fp_ctrl & CELL_GCM_SHADER_CONTROL_DEPTH_EXPORT) opt |= program_common::interpreter::COMPILER_OPT_ENABLE_DEPTH_EXPORT; - if (fp_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS) opt |= program_common::interpreter::COMPILER_OPT_ENABLE_F32_EXPORT; - if (fp_ctrl & RSX_SHADER_CONTROL_USES_KIL) opt |= program_common::interpreter::COMPILER_OPT_ENABLE_KIL; - if (metadata.referenced_textures_mask) opt |= program_common::interpreter::COMPILER_OPT_ENABLE_TEXTURES; - if (metadata.has_branch_instructions) opt |= program_common::interpreter::COMPILER_OPT_ENABLE_FLOW_CTRL; - if (metadata.has_pack_instructions) opt |= program_common::interpreter::COMPILER_OPT_ENABLE_PACKING; - if (rsx::method_registers.polygon_stipple_enabled()) opt |= program_common::interpreter::COMPILER_OPT_ENABLE_STIPPLING; - if (vp_ctrl & RSX_SHADER_CONTROL_INSTANCED_CONSTANTS) opt |= program_common::interpreter::COMPILER_OPT_ENABLE_INSTANCING; + if (fp_ctrl & CELL_GCM_SHADER_CONTROL_DEPTH_EXPORT) + opt |= program_common::interpreter::COMPILER_OPT_ENABLE_DEPTH_EXPORT; + if (fp_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS) + opt |= program_common::interpreter::COMPILER_OPT_ENABLE_F32_EXPORT; + if (fp_ctrl & RSX_SHADER_CONTROL_USES_KIL) + opt |= program_common::interpreter::COMPILER_OPT_ENABLE_KIL; + if (metadata.referenced_textures_mask) + opt |= program_common::interpreter::COMPILER_OPT_ENABLE_TEXTURES; + if (metadata.has_branch_instructions) + opt |= program_common::interpreter::COMPILER_OPT_ENABLE_FLOW_CTRL; + if (metadata.has_pack_instructions) + opt |= program_common::interpreter::COMPILER_OPT_ENABLE_PACKING; + if (rsx::method_registers.polygon_stipple_enabled()) + opt |= program_common::interpreter::COMPILER_OPT_ENABLE_STIPPLING; + if (vp_ctrl & RSX_SHADER_CONTROL_INSTANCED_CONSTANTS) + opt |= program_common::interpreter::COMPILER_OPT_ENABLE_INSTANCING; if (auto it = m_program_cache.find(opt); it != m_program_cache.end()) [[likely]] { @@ -126,15 +136,13 @@ namespace gl std::string shader_str; ParamArray arr; - null_prog.ctrl = (compiler_options & program_common::interpreter::COMPILER_OPT_ENABLE_INSTANCING) - ? RSX_SHADER_CONTROL_INSTANCED_CONSTANTS - : 0; + null_prog.ctrl = (compiler_options & program_common::interpreter::COMPILER_OPT_ENABLE_INSTANCING) ? RSX_SHADER_CONTROL_INSTANCED_CONSTANTS : 0; GLVertexDecompilerThread comp(null_prog, shader_str, arr); // Initialize compiler properties comp.properties.has_indexed_constants = true; - ParamType uniforms = { PF_PARAM_UNIFORM, "vec4" }; + ParamType uniforms = {PF_PARAM_UNIFORM, "vec4"}; uniforms.items.emplace_back("vc[468]", -1); std::stringstream builder; @@ -142,19 +150,20 @@ namespace gl builder << "#define Z_NEGATIVE_ONE_TO_ONE\n\n"; - comp.insertConstants(builder, { uniforms }); + comp.insertConstants(builder, {uniforms}); comp.insertInputs(builder, {}); // Insert vp stream input builder << "\n" - "layout(std140, binding = " << GL_INTERPRETER_VERTEX_BLOCK << ") readonly restrict buffer VertexInstructionBlock\n" - "{\n" - " uint base_address;\n" - " uint entry;\n" - " uint output_mask;\n" - " uint control;\n" - " uvec4 vp_instructions[];\n" - "};\n\n"; + "layout(std140, binding = " + << GL_INTERPRETER_VERTEX_BLOCK << ") readonly restrict buffer VertexInstructionBlock\n" + "{\n" + " uint base_address;\n" + " uint entry;\n" + " uint output_mask;\n" + " uint control;\n" + " uvec4 vp_instructions[];\n" + "};\n\n"; if (compiler_options & program_common::interpreter::COMPILER_OPT_ENABLE_INSTANCING) { @@ -186,26 +195,26 @@ namespace gl if (allocator.max_image_units >= 32) { // 16 + 4 + 4 + 4 - allocator.allocate(4); // 1D - allocator.allocate(16); // 2D - allocator.allocate(4); // CUBE - allocator.allocate(4); // 3D + allocator.allocate(4); // 1D + allocator.allocate(16); // 2D + allocator.allocate(4); // CUBE + allocator.allocate(4); // 3D } else if (allocator.max_image_units >= 24) { // 16 + 4 + 2 + 2 - allocator.allocate(2); // 1D - allocator.allocate(16); // 2D - allocator.allocate(2); // CUBE - allocator.allocate(4); // 3D + allocator.allocate(2); // 1D + allocator.allocate(16); // 2D + allocator.allocate(2); // CUBE + allocator.allocate(4); // 3D } else if (allocator.max_image_units >= 16) { // 10 + 2 + 2 + 2 - allocator.allocate(2); // 1D - allocator.allocate(10); // 2D - allocator.allocate(2); // CUBE - allocator.allocate(2); // 3D + allocator.allocate(2); // 1D + allocator.allocate(10); // 2D + allocator.allocate(2); // CUBE + allocator.allocate(2); // 3D } else { @@ -221,9 +230,8 @@ namespace gl GLFragmentDecompilerThread comp(shader_str, arr, frag, len); std::stringstream builder; - builder << - "#version 450\n" - "#extension GL_ARB_bindless_texture : require\n\n"; + builder << "#version 450\n" + "#extension GL_ARB_bindless_texture : require\n\n"; ::glsl::insert_subheader_block(builder); comp.insertConstants(builder); @@ -292,34 +300,33 @@ namespace gl { builder << "#define WITH_TEXTURES\n\n"; - const char* type_names[] = { "sampler1D", "sampler2D", "samplerCube", "sampler3D" }; + const char* type_names[] = {"sampler1D", "sampler2D", "samplerCube", "sampler3D"}; for (int i = 0; i < 4; ++i) { builder << "uniform " << type_names[i] << " " << type_names[i] << "_array[" << allocator.pools[i].pool_size << "];\n"; } builder << "\n" - "#define IS_TEXTURE_RESIDENT(index) (texture_handles[index] < 0xFF)\n" - "#define SAMPLER1D(index) sampler1D_array[texture_handles[index]]\n" - "#define SAMPLER2D(index) sampler2D_array[texture_handles[index]]\n" - "#define SAMPLER3D(index) sampler3D_array[texture_handles[index]]\n" - "#define SAMPLERCUBE(index) samplerCube_array[texture_handles[index]]\n\n"; + "#define IS_TEXTURE_RESIDENT(index) (texture_handles[index] < 0xFF)\n" + "#define SAMPLER1D(index) sampler1D_array[texture_handles[index]]\n" + "#define SAMPLER2D(index) sampler2D_array[texture_handles[index]]\n" + "#define SAMPLER3D(index) sampler3D_array[texture_handles[index]]\n" + "#define SAMPLERCUBE(index) samplerCube_array[texture_handles[index]]\n\n"; } else if (compiler_options) { builder << "\n"; } - builder << - "layout(std430, binding =" << GL_INTERPRETER_FRAGMENT_BLOCK << ") readonly restrict buffer FragmentInstructionBlock\n" - "{\n" - " uint shader_control;\n" - " uint texture_control;\n" - " uint reserved1;\n" - " uint reserved2;\n" - " uint texture_handles[16];\n" - " uvec4 fp_instructions[];\n" - "};\n\n"; + builder << "layout(std430, binding =" << GL_INTERPRETER_FRAGMENT_BLOCK << ") readonly restrict buffer FragmentInstructionBlock\n" + "{\n" + " uint shader_control;\n" + " uint texture_control;\n" + " uint reserved1;\n" + " uint reserved2;\n" + " uint texture_handles[16];\n" + " uvec4 fp_instructions[];\n" + "};\n\n"; builder << program_common::interpreter::get_fragment_interpreter(); const std::string s = builder.str(); @@ -334,10 +341,7 @@ namespace gl build_fs(compiler_options, *data); build_vs(compiler_options, *data); - data->prog.create(). - attach(data->vertex_shader). - attach(data->fragment_shader). - link(); + data->prog.create().attach(data->vertex_shader).attach(data->fragment_shader).link(); data->prog.uniforms[0] = GL_STREAM_BUFFER_START + 0; data->prog.uniforms[1] = GL_STREAM_BUFFER_START + 1; @@ -347,7 +351,7 @@ namespace gl // Initialize texture bindings int assigned = 0; auto& allocator = data->allocator; - const char* type_names[] = { "sampler1D_array", "sampler2D_array", "samplerCube_array", "sampler3D_array" }; + const char* type_names[] = {"sampler1D_array", "sampler2D_array", "samplerCube_array", "sampler3D_array"}; for (int i = 0; i < 4; ++i) { @@ -422,7 +426,7 @@ namespace gl if (!found) { - replacement_map.push_back({ old, i }); + replacement_map.push_back({old, i}); } } } @@ -459,9 +463,13 @@ namespace gl } } - if (allocator.pools[0].flags) m_current_interpreter->prog.uniforms["sampler1D_array"] = allocator.pools[0].allocated; - if (allocator.pools[1].flags) m_current_interpreter->prog.uniforms["sampler2D_array"] = allocator.pools[1].allocated; - if (allocator.pools[2].flags) m_current_interpreter->prog.uniforms["samplerCube_array"] = allocator.pools[2].allocated; - if (allocator.pools[3].flags) m_current_interpreter->prog.uniforms["sampler3D_array"] = allocator.pools[3].allocated; + if (allocator.pools[0].flags) + m_current_interpreter->prog.uniforms["sampler1D_array"] = allocator.pools[0].allocated; + if (allocator.pools[1].flags) + m_current_interpreter->prog.uniforms["sampler2D_array"] = allocator.pools[1].allocated; + if (allocator.pools[2].flags) + m_current_interpreter->prog.uniforms["samplerCube_array"] = allocator.pools[2].allocated; + if (allocator.pools[3].flags) + m_current_interpreter->prog.uniforms["sampler3D_array"] = allocator.pools[3].allocated; } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLShaderInterpreter.h b/rpcs3/rpcs3/Emu/RSX/GL/GLShaderInterpreter.h index 62075dbb4..0503e90c3 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLShaderInterpreter.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLShaderInterpreter.h @@ -64,7 +64,7 @@ namespace gl glsl::program prog; texture_pool_allocator allocator; }; - } + } // namespace interpreter class shader_interpreter { @@ -86,4 +86,4 @@ namespace gl glsl::program* get(const interpreter::program_metadata& fp_metadata, u32 vp_ctrl, u32 fp_ctrl); bool is_interpreter(const glsl::program* program) const; }; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLTexture.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLTexture.cpp index a0711d52d..2193b6531 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLTexture.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLTexture.cpp @@ -147,42 +147,42 @@ namespace gl case texture::internal_format::compressed_rgba_s3tc_dxt1: case texture::internal_format::compressed_rgba_s3tc_dxt3: case texture::internal_format::compressed_rgba_s3tc_dxt5: - return { GL_RGBA, GL_UNSIGNED_BYTE, 1, false }; + return {GL_RGBA, GL_UNSIGNED_BYTE, 1, false}; case texture::internal_format::r8: - return { GL_RED, GL_UNSIGNED_BYTE, 1, false }; + return {GL_RED, GL_UNSIGNED_BYTE, 1, false}; case texture::internal_format::r16: - return { GL_RED, GL_UNSIGNED_SHORT, 2, true }; + return {GL_RED, GL_UNSIGNED_SHORT, 2, true}; case texture::internal_format::r32f: - return { GL_RED, GL_FLOAT, 4, true }; + return {GL_RED, GL_FLOAT, 4, true}; case texture::internal_format::rg8: - return { GL_RG, GL_UNSIGNED_SHORT, 2, true }; + return {GL_RG, GL_UNSIGNED_SHORT, 2, true}; case texture::internal_format::rg16: - return { GL_RG, GL_UNSIGNED_SHORT, 2, true }; + return {GL_RG, GL_UNSIGNED_SHORT, 2, true}; case texture::internal_format::rg16f: - return { GL_RG, GL_HALF_FLOAT, 2, true }; + return {GL_RG, GL_HALF_FLOAT, 2, true}; case texture::internal_format::rgb565: - return { GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 2, true }; + return {GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 2, true}; case texture::internal_format::rgb5a1: - return { GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 2, true }; + return {GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 2, true}; case texture::internal_format::bgr5a1: - return { GL_RGB, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, true }; + return {GL_RGB, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, true}; case texture::internal_format::rgba4: - return { GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4, 2, false }; + return {GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4, 2, false}; case texture::internal_format::rgba8: - return { GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, true }; + return {GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, true}; case texture::internal_format::bgra8: - return { GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, true }; + return {GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, true}; case texture::internal_format::rgba16f: - return { GL_RGBA, GL_HALF_FLOAT, 2, true }; + return {GL_RGBA, GL_HALF_FLOAT, 2, true}; case texture::internal_format::rgba32f: - return { GL_RGBA, GL_FLOAT, 4, true }; + return {GL_RGBA, GL_FLOAT, 4, true}; case texture::internal_format::depth16: - return { GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 2, true }; + return {GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 2, true}; case texture::internal_format::depth32f: - return { GL_DEPTH_COMPONENT, GL_FLOAT, 2, true }; + return {GL_DEPTH_COMPONENT, GL_FLOAT, 2, true}; case texture::internal_format::depth24_stencil8: case texture::internal_format::depth32f_stencil8: - return { GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 4, true }; + return {GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 4, true}; default: fmt::throw_exception("Unexpected internal format 0x%X", static_cast(format)); } @@ -215,43 +215,43 @@ namespace gl case CELL_GCM_TEXTURE_COMPRESSED_DXT45: case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8: case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8: - return{ GL_ALPHA, GL_RED, GL_GREEN, GL_BLUE }; + return {GL_ALPHA, GL_RED, GL_GREEN, GL_BLUE}; case CELL_GCM_TEXTURE_DEPTH24_D8: case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT: case CELL_GCM_TEXTURE_DEPTH16: case CELL_GCM_TEXTURE_DEPTH16_FLOAT: - return{ GL_RED, GL_RED, GL_RED, GL_RED }; + return {GL_RED, GL_RED, GL_RED, GL_RED}; case CELL_GCM_TEXTURE_B8: - return{ GL_ONE, GL_RED, GL_RED, GL_RED }; + return {GL_ONE, GL_RED, GL_RED, GL_RED}; case CELL_GCM_TEXTURE_X16: - return{ GL_RED, GL_ONE, GL_RED, GL_ONE }; + return {GL_RED, GL_ONE, GL_RED, GL_ONE}; case CELL_GCM_TEXTURE_X32_FLOAT: - return{ GL_RED, GL_RED, GL_RED, GL_RED }; + return {GL_RED, GL_RED, GL_RED, GL_RED}; case CELL_GCM_TEXTURE_G8B8: - return{ GL_GREEN, GL_RED, GL_GREEN, GL_RED }; + return {GL_GREEN, GL_RED, GL_GREEN, GL_RED}; case CELL_GCM_TEXTURE_Y16_X16: - return{ GL_GREEN, GL_RED, GL_GREEN, GL_RED }; + return {GL_GREEN, GL_RED, GL_GREEN, GL_RED}; case CELL_GCM_TEXTURE_Y16_X16_FLOAT: - return{ GL_RED, GL_GREEN, GL_RED, GL_GREEN }; + return {GL_RED, GL_GREEN, GL_RED, GL_GREEN}; case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT: case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT: - return{ GL_ALPHA, GL_RED, GL_GREEN, GL_BLUE }; + return {GL_ALPHA, GL_RED, GL_GREEN, GL_BLUE}; case CELL_GCM_TEXTURE_D1R5G5B5: case CELL_GCM_TEXTURE_D8R8G8B8: - return{ GL_ONE, GL_RED, GL_GREEN, GL_BLUE }; + return {GL_ONE, GL_RED, GL_GREEN, GL_BLUE}; case CELL_GCM_TEXTURE_COMPRESSED_HILO8: case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8: - return{ GL_RED, GL_GREEN, GL_RED, GL_GREEN }; + return {GL_RED, GL_GREEN, GL_RED, GL_GREEN}; } fmt::throw_exception("Unknown format 0x%x", texture_format); } @@ -277,14 +277,15 @@ namespace gl } void* copy_image_to_buffer(gl::command_context& cmd, const pixel_buffer_layout& pack_info, const gl::texture* src, gl::buffer* dst, - u32 dst_offset, const int src_level, const coord3u& src_region, image_memory_requirements* mem_info) + u32 dst_offset, const int src_level, const coord3u& src_region, image_memory_requirements* mem_info) { auto initialize_scratch_mem = [&]() -> bool // skip_transform { const u64 max_mem = (mem_info->memory_required) ? mem_info->memory_required : mem_info->image_size_in_bytes; if (!(*dst) || max_mem > static_cast(dst->size())) { - if (*dst) dst->remove(); + if (*dst) + dst->remove(); dst->create(buffer::target::ssbo, max_mem, nullptr, buffer::memory_type::local, 0); } @@ -298,14 +299,14 @@ namespace gl case gl::texture::internal_format::depth24_stencil8: gl::get_compute_task()->run(cmd, const_cast(as_vi), dst, dst_offset, - { {src_region.x, src_region.y}, {src_region.width, src_region.height} }, + {{src_region.x, src_region.y}, {src_region.width, src_region.height}}, pack_info); return true; case gl::texture::internal_format::rgba8: case gl::texture::internal_format::bgra8: gl::get_compute_task()->run(cmd, const_cast(as_vi), dst, dst_offset, - { {src_region.x, src_region.y}, {src_region.width, src_region.height} }, + {{src_region.x, src_region.y}, {src_region.width, src_region.height}}, pack_info); return true; default: @@ -337,7 +338,7 @@ namespace gl mem_info->memory_required = (mem_info->image_size_in_texels * 6); ensure(!initialize_scratch_mem()); - if (pack_info.swap_bytes) [[ likely ]] + if (pack_info.swap_bytes) [[likely]] { get_compute_task>()->run(cmd, dst, dst_offset, static_cast(mem_info->image_size_in_bytes), static_cast(mem_info->image_size_in_bytes)); @@ -418,7 +419,7 @@ namespace gl std::unique_ptr scratch; std::unique_ptr scratch_view; - coordu image_region = { {dst_region.x, dst_region.y}, {dst_region.width, dst_region.height} }; + coordu image_region = {{dst_region.x, dst_region.y}, {dst_region.width, dst_region.height}}; switch (dst->get_target()) { @@ -436,7 +437,7 @@ namespace gl } case texture::target::textureCUBE: { - const subresource_range range = { image_aspect::depth | image_aspect::color, static_cast(dst_level), 1, dst_region.z , 1 }; + const subresource_range range = {image_aspect::depth | image_aspect::color, static_cast(dst_level), 1, dst_region.z, 1}; scratch_view = std::make_unique(dst, GL_TEXTURE_2D, range); break; } @@ -454,9 +455,9 @@ namespace gl { ensure(dst->layers() == 1); - if (dst->levels() > 1) [[ likely ]] + if (dst->levels() > 1) [[likely]] { - const subresource_range range = { image_aspect::depth | image_aspect::color, static_cast(dst_level), 1, 0 , 1 }; + const subresource_range range = {image_aspect::depth | image_aspect::color, static_cast(dst_level), 1, 0, 1}; scratch_view = std::make_unique(dst, GL_TEXTURE_2D, range); } else @@ -469,9 +470,8 @@ namespace gl } // If possible, decode using a compute transform to potentially have asynchronous scheduling - bool use_compute_transform = ( - dst->aspect() == gl::image_aspect::color && // Cannot use image_load_store with depth images - caps.subvendor_ATI == false); // The old AMD/ATI driver does not support image writeonly without format specifier + bool use_compute_transform = (dst->aspect() == gl::image_aspect::color && // Cannot use image_load_store with depth images + caps.subvendor_ATI == false); // The old AMD/ATI driver does not support image writeonly without format specifier if (use_compute_transform) { @@ -504,8 +504,8 @@ namespace gl { case texture::target::texture1D: { - const position3u transfer_offset = { dst_region.position.x, 0, 0 }; - g_hw_blitter->copy_image(cmd, scratch.get(), dst, 0, dst_level, transfer_offset, transfer_offset, { dst_region.width, 1, 1 }); + const position3u transfer_offset = {dst_region.position.x, 0, 0}; + g_hw_blitter->copy_image(cmd, scratch.get(), dst, 0, dst_level, transfer_offset, transfer_offset, {dst_region.width, 1, 1}); break; } case texture::target::texture3D: @@ -513,9 +513,9 @@ namespace gl // Memcpy for (u32 layer = dst_region.z, i = 0; i < dst_region.depth; ++i, ++layer) { - const position3u src_offset = { dst_region.position.x, dst_region.position.y + (i * dst_region.height), 0 }; - const position3u dst_offset = { dst_region.position.x, dst_region.position.y, layer }; - g_hw_blitter->copy_image(cmd, scratch.get(), dst, 0, dst_level, src_offset, dst_offset, { dst_region.width, dst_region.height, 1 }); + const position3u src_offset = {dst_region.position.x, dst_region.position.y + (i * dst_region.height), 0}; + const position3u dst_offset = {dst_region.position.x, dst_region.position.y, layer}; + g_hw_blitter->copy_image(cmd, scratch.get(), dst, 0, dst_level, src_offset, dst_offset, {dst_region.width, dst_region.height, 1}); } break; } @@ -569,7 +569,7 @@ namespace gl } gl::viewable_image* create_texture(u32 gcm_format, u16 width, u16 height, u16 depth, u16 mipmaps, - rsx::texture_dimension_extended type) + rsx::texture_dimension_extended type) { const GLenum target = get_target(type); const GLenum internal_format = get_sized_internal_format(gcm_format); @@ -579,19 +579,17 @@ namespace gl } void fill_texture(gl::command_context& cmd, texture* dst, int format, - const std::vector &input_layouts, - bool is_swizzled, GLenum gl_format, GLenum gl_type, rsx::simple_array& staging_buffer) + const std::vector& input_layouts, + bool is_swizzled, GLenum gl_format, GLenum gl_type, rsx::simple_array& staging_buffer) { const auto driver_caps = gl::get_driver_caps(); - rsx::texture_uploader_capabilities caps - { + rsx::texture_uploader_capabilities caps{ .supports_byteswap = true, .supports_vtc_decoding = false, .supports_hw_deswizzle = driver_caps.ARB_compute_shader_supported, .supports_zero_copy = false, .supports_dxt = driver_caps.EXT_texture_compression_s3tc_supported, - .alignment = 4 - }; + .alignment = 4}; pixel_unpack_settings unpack_settings; unpack_settings.row_length(0).alignment(4); @@ -698,12 +696,12 @@ namespace gl // FIXME: Double-check this logic; it seems like we should always use texels both here and for row_pitch. image_linear_size = row_pitch * layout.height_in_texel * layout.depth; - compute_scratch_mem = { nullptr, g_compute_decode_buffer.alloc(static_cast(image_linear_size), 256) }; + compute_scratch_mem = {nullptr, g_compute_decode_buffer.alloc(static_cast(image_linear_size), 256)}; compute_scratch_mem.first = reinterpret_cast(static_cast(compute_scratch_mem.second)); g_upload_transfer_buffer.reserve_storage_on_heap(static_cast(image_linear_size)); upload_scratch_mem = g_upload_transfer_buffer.alloc_from_heap(static_cast(image_linear_size), 256); - dst_buffer = { reinterpret_cast(upload_scratch_mem.first), image_linear_size }; + dst_buffer = {reinterpret_cast(upload_scratch_mem.first), image_linear_size}; } rsx::io_buffer io_buf = dst_buffer; @@ -755,7 +753,7 @@ namespace gl { mem_layout.swap_bytes = false; - if (op.element_size == 4) [[ likely ]] + if (op.element_size == 4) [[likely]] { do_deswizzle_transformation(cmd, block_size, &g_compute_decode_buffer.get(), compute_scratch_mem.second, &g_deswizzle_scratch_buffer.get(), deswizzle_data_offset, @@ -770,7 +768,7 @@ namespace gl } else { - if (op.element_size == 4) [[ likely ]] + if (op.element_size == 4) [[likely]] { do_deswizzle_transformation(cmd, block_size, &g_compute_decode_buffer.get(), compute_scratch_mem.second, &g_deswizzle_scratch_buffer.get(), deswizzle_data_offset, @@ -818,7 +816,7 @@ namespace gl // Calculate staging buffer size rsx::simple_array data_upload_buf; - rsx::texture_uploader_capabilities caps { .supports_dxt = gl::get_driver_caps().EXT_texture_compression_s3tc_supported }; + rsx::texture_uploader_capabilities caps{.supports_dxt = gl::get_driver_caps().EXT_texture_compression_s3tc_supported}; if (rsx::is_compressed_host_format(caps, gcm_format)) { const auto& desc = subresources_layout[0]; @@ -883,33 +881,33 @@ namespace gl { // 8-bit case GL_R8: - return { false, 1 }; + return {false, 1}; case GL_RGBA8: case GL_BGRA8: - return { true, 4 }; + return {true, 4}; // 16-bit case GL_RG8: case GL_RG16: case GL_RG16F: case GL_R16: case GL_RGB565: - return { true, 2 }; + return {true, 2}; // 32-bit case GL_R32F: case GL_RGBA32F: - return { true, 4 }; + return {true, 4}; // DXT case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return { false, 1 }; + return {false, 1}; // Depth case GL_DEPTH_COMPONENT16: case GL_DEPTH_COMPONENT32F: - return { true, 2 }; + return {true, 2}; case GL_DEPTH24_STENCIL8: case GL_DEPTH32F_STENCIL8: - return { true, 4 }; + return {true, 4}; default: break; } @@ -962,12 +960,12 @@ namespace gl return formats_are_bitcast_compatible(static_cast(texture1->get_internal_format()), static_cast(texture2->get_internal_format())); } - void copy_typeless(gl::command_context& cmd, texture * dst, const texture * src, const coord3u& dst_region, const coord3u& src_region) + void copy_typeless(gl::command_context& cmd, texture* dst, const texture* src, const coord3u& dst_region, const coord3u& src_region) { const auto src_bpp = src->pitch() / src->width(); const auto dst_bpp = dst->pitch() / dst->width(); - image_memory_requirements src_mem = { src_region.width * src_region.height, src_region.width * src_bpp * src_region.height, 0ull }; - image_memory_requirements dst_mem = { dst_region.width * dst_region.height, dst_region.width * dst_bpp * dst_region.height, 0ull }; + image_memory_requirements src_mem = {src_region.width * src_region.height, src_region.width * src_bpp * src_region.height, 0ull}; + image_memory_requirements dst_mem = {dst_region.width * dst_region.height, dst_region.width * dst_bpp * dst_region.height, 0ull}; const auto& caps = gl::get_driver_caps(); auto pack_info = get_format_type(src); @@ -990,9 +988,9 @@ namespace gl if ((src->aspect() | dst->aspect()) == gl::image_aspect::color) { skip_transform = (pack_info.format == unpack_info.format && - pack_info.type == unpack_info.type && - pack_info.swap_bytes == unpack_info.swap_bytes && - pack_info.size == unpack_info.size); + pack_info.type == unpack_info.type && + pack_info.swap_bytes == unpack_info.swap_bytes && + pack_info.size == unpack_info.size); } if (skip_transform) [[likely]] @@ -1006,7 +1004,7 @@ namespace gl const u64 min_storage_requirement = src_mem.image_size_in_bytes + dst_mem.image_size_in_bytes; const u64 min_required_buffer_size = utils::align(min_storage_requirement, 256); - if (g_typeless_transfer_buffer.size() >= min_required_buffer_size) [[ likely ]] + if (g_typeless_transfer_buffer.size() >= min_required_buffer_size) [[likely]] { scratch_offset = g_typeless_transfer_buffer.alloc(static_cast(min_storage_requirement), 256); } @@ -1109,8 +1107,8 @@ namespace gl void copy_typeless(gl::command_context& cmd, texture* dst, const texture* src) { - const coord3u src_area = { {}, src->size3D() }; - const coord3u dst_area = { {}, dst->size3D() }; + const coord3u src_area = {{}, src->size3D()}; + const coord3u dst_area = {{}, dst->size3D()}; copy_typeless(cmd, dst, src, dst_area, src_area); } @@ -1143,4 +1141,4 @@ namespace gl glClear(clear_mask); } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLTexture.h b/rpcs3/rpcs3/Emu/RSX/GL/GLTexture.h index dc6d90098..f27171292 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLTexture.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLTexture.h @@ -8,7 +8,7 @@ namespace rsx { class vertex_texture; class fragment_texture; -} +} // namespace rsx namespace gl { @@ -16,9 +16,9 @@ namespace gl { GLenum format; GLenum type; - u8 size; - bool swap_bytes; - u8 alignment; + u8 size; + bool swap_bytes; + u8 alignment; }; struct image_memory_requirements @@ -35,15 +35,13 @@ namespace gl struct { f32 value; - } - clear_depth{}; + } clear_depth{}; struct { u8 mask; u8 value; - } - clear_stencil{}; + } clear_stencil{}; struct { @@ -53,8 +51,7 @@ namespace gl u8 g; u8 b; u8 a; - } - clear_color{}; + } clear_color{}; }; GLenum get_target(rsx::texture_dimension_extended type); @@ -85,4 +82,4 @@ namespace gl } void destroy_global_texture_resources(); -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLTextureCache.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLTextureCache.cpp index f3103dac5..b6697cf14 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLTextureCache.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLTextureCache.cpp @@ -23,13 +23,17 @@ namespace gl switch (target) { case GL_TEXTURE_1D: - target_encoding = 0; break; + target_encoding = 0; + break; case GL_TEXTURE_2D: - target_encoding = 1; break; + target_encoding = 1; + break; case GL_TEXTURE_3D: - target_encoding = 2; break; + target_encoding = 2; + break; case GL_TEXTURE_CUBE_MAP: - target_encoding = 3; break; + target_encoding = 3; + break; default: fmt::throw_exception("Unsupported destination target 0x%x", target); } @@ -53,7 +57,7 @@ namespace gl const auto valid_range = get_confirmed_range_delta(); const u32 valid_offset = valid_range.first; const u32 valid_length = valid_range.second; - void *dst = get_ptr(get_section_base() + valid_offset); + void* dst = get_ptr(get_section_base() + valid_offset); if (!gl::get_driver_caps().ARB_compute_shader_supported) { @@ -159,16 +163,14 @@ namespace gl if (copy) { std::vector region = - {{ - .src = src, - .xform = rsx::surface_transform::coordinate_transform, - .src_x = x, - .src_y = y, - .src_w = width, - .src_h = height, - .dst_w = width, - .dst_h = height - }}; + {{.src = src, + .xform = rsx::surface_transform::coordinate_transform, + .src_x = x, + .src_y = y, + .src_w = width, + .src_h = height, + .dst_w = width, + .dst_h = height}}; copy_transfer_regions_impl(cmd, dst, region); } @@ -188,7 +190,7 @@ namespace gl const auto dst_bpp = dst_image->pitch() / dst_image->width(); const auto dst_aspect = dst_image->aspect(); - for (const auto &slice : sources) + for (const auto& slice : sources) { if (!slice.src) { @@ -239,15 +241,15 @@ namespace gl { // Optimization, avoid typeless copy to tmp followed by data copy to dst // Combine the two transfers into one - const coord3u src_region = { { src_x, src_y, 0 }, { src_w, src_h, 1 } }; - const coord3u dst_region = { { slice.dst_x, slice.dst_y, slice.dst_z }, { slice.dst_w, slice.dst_h, 1 } }; + const coord3u src_region = {{src_x, src_y, 0}, {src_w, src_h, 1}}; + const coord3u dst_region = {{slice.dst_x, slice.dst_y, slice.dst_z}, {slice.dst_w, slice.dst_h, 1}}; gl::copy_typeless(cmd, dst_image, slice.src, dst_region, src_region); continue; } - const coord3u src_region = { { src_x, src_y, 0 }, { src_w, src_h, 1 } }; - const coord3u dst_region = { { src_x2, src_y, 0 }, { src_w2, src_h, 1 } }; + const coord3u src_region = {{src_x, src_y, 0}, {src_w, src_h, 1}}; + const coord3u dst_region = {{src_x2, src_y, 0}, {src_w2, src_h, 1}}; gl::copy_typeless(cmd, src_image, slice.src, dst_region, src_region); src_x = src_x2; @@ -257,20 +259,20 @@ namespace gl if (src_w == slice.dst_w && src_h == slice.dst_h) { gl::g_hw_blitter->copy_image(cmd, src_image, dst_image, 0, slice.level, - position3i{ src_x, src_y, 0 }, - position3i{ slice.dst_x, slice.dst_y, slice.dst_z }, - size3i{ src_w, src_h, 1 }); + position3i{src_x, src_y, 0}, + position3i{slice.dst_x, slice.dst_y, slice.dst_z}, + size3i{src_w, src_h, 1}); } else { auto _blitter = gl::g_hw_blitter; - const areai src_rect = { src_x, src_y, src_x + src_w, src_y + src_h }; - const areai dst_rect = { slice.dst_x, slice.dst_y, slice.dst_x + slice.dst_w, slice.dst_y + slice.dst_h }; + const areai src_rect = {src_x, src_y, src_x + src_w, src_y + src_h}; + const areai dst_rect = {slice.dst_x, slice.dst_y, slice.dst_x + slice.dst_w, slice.dst_y + slice.dst_h}; gl::texture* _dst = dst_image; if (src_image->get_internal_format() != dst_image->get_internal_format() || slice.level != 0 || - slice.dst_z != 0) [[ unlikely ]] + slice.dst_z != 0) [[unlikely]] { tmp = std::make_unique( GL_TEXTURE_2D, @@ -295,4 +297,4 @@ namespace gl } } } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLTextureCache.h b/rpcs3/rpcs3/Emu/RSX/GL/GLTextureCache.h index 7348fd593..f6596da51 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLTextureCache.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLTextureCache.h @@ -19,15 +19,15 @@ namespace gl struct texture_cache_traits { - using commandbuffer_type = gl::command_context; - using section_storage_type = gl::cached_texture_section; - using texture_cache_type = gl::texture_cache; + using commandbuffer_type = gl::command_context; + using section_storage_type = gl::cached_texture_section; + using texture_cache_type = gl::texture_cache; using texture_cache_base_type = rsx::texture_cache; - using image_resource_type = gl::texture*; - using image_view_type = gl::texture_view*; - using image_storage_type = gl::texture; - using texture_format = gl::texture::format; - using viewable_image_type = gl::viewable_image*; + using image_resource_type = gl::texture*; + using image_view_type = gl::texture_view*; + using image_storage_type = gl::texture; + using texture_format = gl::texture::format; + using viewable_image_type = gl::viewable_image*; }; class cached_texture_section : public rsx::cached_texture_section @@ -67,7 +67,7 @@ namespace gl using baseclass::cached_texture_section; void create(u16 w, u16 h, u16 depth, u16 mipmaps, gl::texture* image, u32 rsx_pitch, bool managed, - gl::texture::format gl_format = gl::texture::format::rgba, gl::texture::type gl_type = gl::texture::type::ubyte, bool swap_bytes = false) + gl::texture::format gl_format = gl::texture::format::rgba, gl::texture::type gl_type = gl::texture::type::ubyte, bool swap_bytes = false) { if (vram_texture && !managed_texture && get_protection() == utils::protection::no) { @@ -192,7 +192,7 @@ namespace gl mem_info.image_size_in_bytes *= 2; } - void* out_offset = copy_image_to_buffer(cmd, pack_info, src, &scratch_mem, 0, 0, { {}, src->size3D() }, &mem_info); + void* out_offset = copy_image_to_buffer(cmd, pack_info, src, &scratch_mem, 0, 0, {{}, src->size3D()}, &mem_info); glBindBuffer(GL_SHADER_STORAGE_BUFFER, GL_NONE); glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT); @@ -278,8 +278,8 @@ namespace gl if ((rsx::get_resolution_scale_percent() != 100 && context == rsx::texture_upload_context::framebuffer_storage) || (vram_texture->pitch() != rsx_pitch)) { - areai src_area = { 0, 0, 0, 0 }; - const areai dst_area = { 0, 0, static_cast(transfer_width), static_cast(transfer_height) }; + areai src_area = {0, 0, 0, 0}; + const areai dst_area = {0, 0, static_cast(transfer_width), static_cast(transfer_height)}; auto ifmt = vram_texture->get_internal_format(); src_area.x2 = vram_texture->width(); @@ -334,7 +334,7 @@ namespace gl void destroy() { if (!is_locked() && !pbo && vram_texture == nullptr && m_fence.is_empty() && !managed_texture) - //Already destroyed + // Already destroyed return; if (pbo) @@ -408,7 +408,7 @@ namespace gl bool has_compatible_format(gl::texture* tex) const { - //TODO + // TODO return (tex->get_internal_format() == vram_texture->get_internal_format()); } }; @@ -444,7 +444,7 @@ namespace gl } gl::texture_view* create_temporary_subresource_impl(gl::command_context& cmd, gl::texture* src, GLenum sized_internal_fmt, GLenum dst_type, u32 gcm_format, - u16 x, u16 y, u16 width, u16 height, u16 depth, u8 mipmaps, const rsx::texture_channel_remap_t& remap, bool copy); + u16 x, u16 y, u16 width, u16 height, u16 depth, u8 mipmaps, const rsx::texture_channel_remap_t& remap, bool copy); std::array get_component_mapping(u32 gcm_format, rsx::component_order flags) const { @@ -454,8 +454,8 @@ namespace gl case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT: case CELL_GCM_TEXTURE_DEPTH16: case CELL_GCM_TEXTURE_DEPTH16_FLOAT: - //Dont bother letting this propagate - return{ GL_RED, GL_RED, GL_RED, GL_RED }; + // Dont bother letting this propagate + return {GL_RED, GL_RED, GL_RED, GL_RED}; default: break; } @@ -468,11 +468,11 @@ namespace gl } case rsx::component_order::native: { - return{ GL_ALPHA, GL_RED, GL_GREEN, GL_BLUE }; + return {GL_ALPHA, GL_RED, GL_GREEN, GL_BLUE}; } case rsx::component_order::swapped_native: { - return{ GL_BLUE, GL_ALPHA, GL_RED, GL_GREEN }; + return {GL_BLUE, GL_ALPHA, GL_RED, GL_GREEN}; } default: fmt::throw_exception("Unknown texture create flags"); @@ -489,7 +489,7 @@ namespace gl } gl::texture* result = nullptr; - for (const auto §ion : sections_to_transfer) + for (const auto& section : sections_to_transfer) { if (!section.src) continue; @@ -519,18 +519,17 @@ namespace gl } protected: - gl::texture_view* create_temporary_subresource_view(gl::command_context& cmd, gl::texture** src, u32 gcm_format, u16 x, u16 y, u16 w, u16 h, - const rsx::texture_channel_remap_t& remap_vector) override + const rsx::texture_channel_remap_t& remap_vector) override { return create_temporary_subresource_impl(cmd, *src, GL_NONE, GL_TEXTURE_2D, gcm_format, x, y, w, h, 1, 1, remap_vector, true); } gl::texture_view* create_temporary_subresource_view(gl::command_context& cmd, gl::texture* src, u32 gcm_format, u16 x, u16 y, u16 w, u16 h, - const rsx::texture_channel_remap_t& remap_vector) override + const rsx::texture_channel_remap_t& remap_vector) override { return create_temporary_subresource_impl(cmd, src, static_cast(src->get_internal_format()), - GL_TEXTURE_2D, gcm_format, x, y, w, h, 1, 1, remap_vector, true); + GL_TEXTURE_2D, gcm_format, x, y, w, h, 1, 1, remap_vector, true); } gl::texture_view* generate_cubemap_from_images(gl::command_context& cmd, u32 gcm_format, u16 size, const std::vector& sources, const rsx::texture_channel_remap_t& remap_vector) override @@ -552,7 +551,7 @@ namespace gl } gl::texture_view* generate_atlas_from_images(gl::command_context& cmd, u32 gcm_format, u16 width, u16 height, const std::vector& sections_to_copy, - const rsx::texture_channel_remap_t& remap_vector) override + const rsx::texture_channel_remap_t& remap_vector) override { auto _template = get_template_from_collection_impl(sections_to_copy); auto result = create_temporary_subresource_impl(cmd, _template, GL_NONE, GL_TEXTURE_2D, gcm_format, 0, 0, width, height, 1, 1, remap_vector, false); @@ -587,22 +586,20 @@ namespace gl void update_image_contents(gl::command_context& cmd, gl::texture_view* dst, gl::texture* src, u16 width, u16 height) override { std::vector region = - {{ - .src = src, - .xform = rsx::surface_transform::identity, - .src_w = width, - .src_h = height, - .dst_w = width, - .dst_h = height - }}; + {{.src = src, + .xform = rsx::surface_transform::identity, + .src_w = width, + .src_h = height, + .dst_w = width, + .dst_h = height}}; copy_transfer_regions_impl(cmd, dst->image(), region); } - cached_texture_section* create_new_texture(gl::command_context& cmd, const utils::address_range &rsx_range, u16 width, u16 height, u16 depth, u16 mipmaps, u32 pitch, + cached_texture_section* create_new_texture(gl::command_context& cmd, const utils::address_range& rsx_range, u16 width, u16 height, u16 depth, u16 mipmaps, u32 pitch, u32 gcm_format, rsx::texture_upload_context context, rsx::texture_dimension_extended type, bool swizzled, rsx::component_order swizzle_flags, rsx::flags32_t /*flags*/) override { - const rsx::image_section_attributes_t search_desc = { .gcm_format = gcm_format, .width = width, .height = height, .depth = depth, .mipmaps = mipmaps }; + const rsx::image_section_attributes_t search_desc = {.gcm_format = gcm_format, .width = width, .height = height, .depth = depth, .mipmaps = mipmaps}; const bool allow_dirty = (context != rsx::texture_upload_context::framebuffer_storage); auto& cached = *find_cached_texture(rsx_range, search_desc, true, true, allow_dirty); ensure(!cached.is_locked()); @@ -668,8 +665,8 @@ namespace gl } else { - //TODO: More tests on byte order - //ARGB8+native+unswizzled is confirmed with Dark Souls II character preview + // TODO: More tests on byte order + // ARGB8+native+unswizzled is confirmed with Dark Souls II character preview switch (gcm_format) { case CELL_GCM_TEXTURE_A8R8G8B8: @@ -696,7 +693,7 @@ namespace gl fmt::throw_exception("Unexpected gcm format 0x%X", gcm_format); } - //NOTE: Protection is handled by the caller + // NOTE: Protection is handled by the caller cached.set_dimensions(width, height, depth, (rsx_range.length() / height)); no_access_range = cached.get_min_max(no_access_range, rsx::section_bounds::locked_range); } @@ -712,7 +709,7 @@ namespace gl const rsx::GCM_tile_reference& /*tile*/, bool /*memory_load*/) override { - auto& cached = *find_cached_texture(rsx_range, { .gcm_format = RSX_GCM_FORMAT_IGNORED }, true, false, false); + auto& cached = *find_cached_texture(rsx_range, {.gcm_format = RSX_GCM_FORMAT_IGNORED}, true, false, false); ensure(!cached.is_locked()); // Prepare section @@ -753,7 +750,7 @@ namespace gl void insert_texture_barrier(gl::command_context&, gl::texture*, bool) override { - auto &caps = gl::get_driver_caps(); + auto& caps = gl::get_driver_caps(); if (caps.ARB_texture_barrier_supported) glTextureBarrier(); @@ -800,13 +797,14 @@ namespace gl } void prepare_for_dma_transfers(gl::command_context&) override - {} + { + } void cleanup_after_dma_transfers(gl::command_context&) override - {} + { + } public: - using baseclass::texture_cache; void initialize() @@ -826,7 +824,7 @@ namespace gl { reader_lock lock(m_cache_mutex); - auto &block = m_storage.block_for(rsx_address); + auto& block = m_storage.block_for(rsx_address); if (block.get_locked_count() == 0) return false; @@ -880,4 +878,4 @@ namespace gl return false; } }; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp index 6d39b7c6b..f6788f038 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp @@ -7,20 +7,19 @@ namespace { [[maybe_unused]] constexpr std::array s_reg_table = - { - "in_pos_buffer", "in_weight_buffer", "in_normal_buffer", - "in_diff_color_buffer", "in_spec_color_buffer", - "in_fog_buffer", - "in_point_size_buffer", "in_7_buffer", - "in_tc0_buffer", "in_tc1_buffer", "in_tc2_buffer", "in_tc3_buffer", - "in_tc4_buffer", "in_tc5_buffer", "in_tc6_buffer", "in_tc7_buffer" - }; + { + "in_pos_buffer", "in_weight_buffer", "in_normal_buffer", + "in_diff_color_buffer", "in_spec_color_buffer", + "in_fog_buffer", + "in_point_size_buffer", "in_7_buffer", + "in_tc0_buffer", "in_tc1_buffer", "in_tc2_buffer", "in_tc3_buffer", + "in_tc4_buffer", "in_tc5_buffer", "in_tc6_buffer", "in_tc7_buffer"}; } namespace { // return vertex count if primitive type is not native (empty array otherwise) - std::tuple get_index_array_for_emulated_non_indexed_draw(rsx::primitive_type primitive_mode, gl::ring_buffer &dst, u32 vertex_count) + std::tuple get_index_array_for_emulated_non_indexed_draw(rsx::primitive_type primitive_mode, gl::ring_buffer& dst, u32 vertex_count) { // This is an emulated buffer, so our indices only range from 0->original_vertex_array_length const auto element_count = get_index_count(primitive_mode, vertex_count); @@ -32,7 +31,7 @@ namespace write_index_array_for_non_indexed_non_native_primitive_to_buffer(mapped_buffer, primitive_mode, vertex_count); return std::make_tuple(element_count, mapping.second); } -} +} // namespace namespace { @@ -59,15 +58,15 @@ namespace struct draw_command_visitor { draw_command_visitor(gl::ring_buffer& index_ring_buffer, rsx::vertex_input_layout& vertex_layout) - : m_index_ring_buffer(index_ring_buffer) - , m_vertex_layout(vertex_layout) - {} + : m_index_ring_buffer(index_ring_buffer), m_vertex_layout(vertex_layout) + { + } vertex_input_state operator()(const rsx::draw_array_command& /*command*/) { const u32 vertex_count = rsx::method_registers.current_draw_clause.get_elements_count(); - const u32 min_index = rsx::method_registers.current_draw_clause.min_index(); - const u32 max_index = (min_index + vertex_count) - 1; + const u32 min_index = rsx::method_registers.current_draw_clause.min_index(); + const u32 max_index = (min_index + vertex_count) - 1; if (!gl::is_primitive_native(rsx::method_registers.current_draw_clause.primitive)) { @@ -77,21 +76,21 @@ namespace rsx::method_registers.current_draw_clause.primitive, m_index_ring_buffer, rsx::method_registers.current_draw_clause.get_elements_count()); - return{ false, min_index, max_index, index_count, 0, std::make_tuple(static_cast(GL_UNSIGNED_SHORT), offset_in_index_buffer) }; + return {false, min_index, max_index, index_count, 0, std::make_tuple(static_cast(GL_UNSIGNED_SHORT), offset_in_index_buffer)}; } - return{ false, min_index, max_index, vertex_count, 0, std::optional>() }; + return {false, min_index, max_index, vertex_count, 0, std::optional>()}; } vertex_input_state operator()(const rsx::draw_indexed_array_command& command) { u32 min_index = 0, max_index = 0; - rsx::index_array_type type = rsx::method_registers.current_draw_clause.is_immediate_draw? - rsx::index_array_type::u32: - rsx::method_registers.index_type(); + rsx::index_array_type type = rsx::method_registers.current_draw_clause.is_immediate_draw ? + rsx::index_array_type::u32 : + rsx::method_registers.index_type(); - u32 type_size = get_index_type_size(type); + u32 type_size = get_index_type_size(type); const u32 vertex_count = rsx::method_registers.current_draw_clause.get_elements_count(); u32 index_count = vertex_count; @@ -99,29 +98,32 @@ namespace if (!gl::is_primitive_native(rsx::method_registers.current_draw_clause.primitive)) index_count = static_cast(get_index_count(rsx::method_registers.current_draw_clause.primitive, vertex_count)); - u32 max_size = index_count * type_size; - auto mapping = m_index_ring_buffer.alloc_from_heap(max_size, 256); - void* ptr = mapping.first; + u32 max_size = index_count * type_size; + auto mapping = m_index_ring_buffer.alloc_from_heap(max_size, 256); + void* ptr = mapping.first; u32 offset_in_index_buffer = mapping.second; std::tie(min_index, max_index, index_count) = write_index_array_data_to_buffer( - { reinterpret_cast(ptr), max_size }, + {reinterpret_cast(ptr), max_size}, command.raw_index_buffer, type, rsx::method_registers.current_draw_clause.primitive, rsx::method_registers.restart_index_enabled(), rsx::method_registers.restart_index(), - [](auto prim) { return !gl::is_primitive_native(prim); }); + [](auto prim) + { + return !gl::is_primitive_native(prim); + }); if (min_index >= max_index) { - //empty set, do not draw - return{ false, 0, 0, 0, 0, std::make_tuple(get_index_type(type), offset_in_index_buffer) }; + // empty set, do not draw + return {false, 0, 0, 0, 0, std::make_tuple(get_index_type(type), offset_in_index_buffer)}; } // Prefer only reading the vertices that are referenced in the index buffer itself // Offset data source by min_index verts, but also notify the shader to offset the vertexID (important for modulo op) const auto index_offset = rsx::method_registers.vertex_data_base_index(); - return{ true, min_index, max_index, index_count, index_offset, std::make_tuple(get_index_type(type), offset_in_index_buffer) }; + return {true, min_index, max_index, index_count, index_offset, std::make_tuple(get_index_type(type), offset_in_index_buffer)}; } vertex_input_state operator()(const rsx::draw_inlined_array& /*command*/) @@ -136,23 +138,23 @@ namespace std::tie(index_count, offset_in_index_buffer) = get_index_array_for_emulated_non_indexed_draw( rsx::method_registers.current_draw_clause.primitive, m_index_ring_buffer, vertex_count); - return{ false, 0, vertex_count, index_count, 0, std::make_tuple(static_cast(GL_UNSIGNED_SHORT), offset_in_index_buffer) }; + return {false, 0, vertex_count, index_count, 0, std::make_tuple(static_cast(GL_UNSIGNED_SHORT), offset_in_index_buffer)}; } - return{ false, 0, vertex_count, vertex_count, 0, std::optional>() }; + return {false, 0, vertex_count, vertex_count, 0, std::optional>()}; } private: gl::ring_buffer& m_index_ring_buffer; rsx::vertex_input_layout& m_vertex_layout; }; -} +} // namespace gl::vertex_upload_info GLGSRender::set_vertex_buffer() { m_profiler.start(); - //Write index buffers and count verts + // Write index buffers and count verts auto result = std::visit(draw_command_visitor(*m_index_ring_buffer, m_vertex_layout), m_draw_processor.get_draw_command(rsx::method_registers)); const u32 vertex_count = (result.max_index - result.min_index) + 1; @@ -165,29 +167,29 @@ gl::vertex_upload_info GLGSRender::set_vertex_buffer() index_base = result.min_index; } - //Do actual vertex upload + // Do actual vertex upload auto required = calculate_memory_requirements(m_vertex_layout, vertex_base, vertex_count); std::pair persistent_mapping = {}, volatile_mapping = {}; gl::vertex_upload_info upload_info = - { - result.vertex_draw_count, // Vertex count - vertex_count, // Allocated vertex count - vertex_base, // First vertex in block - index_base, // Index of attribute at data location 0 - result.vertex_index_offset, // Hw index offset - 0u, 0u, // Mapping - result.index_info // Index buffer info - }; + { + result.vertex_draw_count, // Vertex count + vertex_count, // Allocated vertex count + vertex_base, // First vertex in block + index_base, // Index of attribute at data location 0 + result.vertex_index_offset, // Hw index offset + 0u, 0u, // Mapping + result.index_info // Index buffer info + }; if (required.first > 0) { - //Check if cacheable - //Only data in the 'persistent' block may be cached - //TODO: make vertex cache keep local data beyond frame boundaries and hook notify command + // Check if cacheable + // Only data in the 'persistent' block may be cached + // TODO: make vertex cache keep local data beyond frame boundaries and hook notify command bool in_cache = false; bool to_store = false; - u32 storage_address = -1; + u32 storage_address = -1; if (m_vertex_layout.interleaved_blocks.size() == 1 && rsx::method_registers.current_draw_clause.command != rsx::draw_command::inlined_array) @@ -215,7 +217,7 @@ gl::vertex_upload_info GLGSRender::set_vertex_buffer() if (to_store) { - //store ref in vertex cache + // store ref in vertex cache m_vertex_cache->store_range(storage_address, required.first, persistent_mapping.second); } } @@ -224,7 +226,8 @@ gl::vertex_upload_info GLGSRender::set_vertex_buffer() { ensure(m_max_texbuffer_size < m_attrib_ring_buffer->size()); const usz view_size = ((upload_info.persistent_mapping_offset + m_max_texbuffer_size) > m_attrib_ring_buffer->size()) ? - (m_attrib_ring_buffer->size() - upload_info.persistent_mapping_offset) : m_max_texbuffer_size; + (m_attrib_ring_buffer->size() - upload_info.persistent_mapping_offset) : + m_max_texbuffer_size; m_persistent_stream_view.update(m_attrib_ring_buffer.get(), upload_info.persistent_mapping_offset, static_cast(view_size)); m_gl_persistent_stream_buffer->copy_from(m_persistent_stream_view); @@ -241,7 +244,8 @@ gl::vertex_upload_info GLGSRender::set_vertex_buffer() { ensure(m_max_texbuffer_size < m_attrib_ring_buffer->size()); const usz view_size = ((upload_info.volatile_mapping_offset + m_max_texbuffer_size) > m_attrib_ring_buffer->size()) ? - (m_attrib_ring_buffer->size() - upload_info.volatile_mapping_offset) : m_max_texbuffer_size; + (m_attrib_ring_buffer->size() - upload_info.volatile_mapping_offset) : + m_max_texbuffer_size; m_volatile_stream_view.update(m_attrib_ring_buffer.get(), upload_info.volatile_mapping_offset, static_cast(view_size)); m_gl_volatile_stream_buffer->copy_from(m_volatile_stream_view); @@ -249,7 +253,7 @@ gl::vertex_upload_info GLGSRender::set_vertex_buffer() } } - //Write all the data + // Write all the data m_draw_processor.write_vertex_data_to_memory(m_vertex_layout, vertex_base, vertex_count, persistent_mapping.first, volatile_mapping.first); m_frame_stats.vertex_upload_time += m_profiler.duration(); diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLVertexProgram.cpp b/rpcs3/rpcs3/Emu/RSX/GL/GLVertexProgram.cpp index dfa18d37e..fcb1f40ef 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLVertexProgram.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLVertexProgram.cpp @@ -21,70 +21,72 @@ std::string GLVertexDecompilerThread::getFunction(FUNCTION f) return glsl::getFunctionImpl(f); } -std::string GLVertexDecompilerThread::compareFunction(COMPARE f, const std::string &Op0, const std::string &Op1, bool scalar) +std::string GLVertexDecompilerThread::compareFunction(COMPARE f, const std::string& Op0, const std::string& Op1, bool scalar) { return glsl::compareFunctionImpl(f, Op0, Op1, scalar); } -void GLVertexDecompilerThread::insertHeader(std::stringstream &OS) +void GLVertexDecompilerThread::insertHeader(std::stringstream& OS) { - OS << - "#version 430\n" - "layout(std140, binding = " << GL_VERTEX_PARAMS_BIND_SLOT << ") uniform VertexContextBuffer\n" - "{\n" - " mat4 scale_offset_mat;\n" - " ivec4 user_clip_enabled[2];\n" - " vec4 user_clip_factor[2];\n" - " uint transform_branch_bits;\n" - " float point_size;\n" - " float z_near;\n" - " float z_far;\n" - "};\n\n" + OS << "#version 430\n" + "layout(std140, binding = " + << GL_VERTEX_PARAMS_BIND_SLOT << ") uniform VertexContextBuffer\n" + "{\n" + " mat4 scale_offset_mat;\n" + " ivec4 user_clip_enabled[2];\n" + " vec4 user_clip_factor[2];\n" + " uint transform_branch_bits;\n" + " float point_size;\n" + " float z_near;\n" + " float z_far;\n" + "};\n\n" - "layout(std140, binding = " << GL_VERTEX_LAYOUT_BIND_SLOT << ") uniform VertexLayoutBuffer\n" - "{\n" - " uint vertex_base_index;\n" - " uint vertex_index_offset;\n" - " uvec4 input_attributes_blob[16 / 2];\n" - "};\n\n"; + "layout(std140, binding = " + << GL_VERTEX_LAYOUT_BIND_SLOT << ") uniform VertexLayoutBuffer\n" + "{\n" + " uint vertex_base_index;\n" + " uint vertex_index_offset;\n" + " uvec4 input_attributes_blob[16 / 2];\n" + "};\n\n"; } void GLVertexDecompilerThread::insertInputs(std::stringstream& OS, const std::vector& /*inputs*/) { - OS << "layout(location=0) uniform usamplerBuffer persistent_input_stream;\n"; // Data stream with persistent vertex data (cacheable) - OS << "layout(location=1) uniform usamplerBuffer volatile_input_stream;\n"; // Data stream with per-draw data (registers and immediate draw data) + OS << "layout(location=0) uniform usamplerBuffer persistent_input_stream;\n"; // Data stream with persistent vertex data (cacheable) + OS << "layout(location=1) uniform usamplerBuffer volatile_input_stream;\n"; // Data stream with per-draw data (registers and immediate draw data) } void GLVertexDecompilerThread::insertConstants(std::stringstream& OS, const std::vector& constants) { - for (const ParamType &PT: constants) + for (const ParamType& PT : constants) { - for (const ParamItem &PI : PT.items) + for (const ParamItem& PI : PT.items) { if (PI.name.starts_with("vc[")) { if (!(m_prog.ctrl & RSX_SHADER_CONTROL_INSTANCED_CONSTANTS)) { - OS << - "layout(std140, binding = " << GL_VERTEX_CONSTANT_BUFFERS_BIND_SLOT << ") uniform VertexConstantsBuffer\n" - "{\n" - " vec4 " << PI.name << ";\n" - "};\n\n"; + OS << "layout(std140, binding = " << GL_VERTEX_CONSTANT_BUFFERS_BIND_SLOT << ") uniform VertexConstantsBuffer\n" + "{\n" + " vec4 " + << PI.name << ";\n" + "};\n\n"; } else { - OS << - "layout(std430, binding = " << GL_INSTANCING_LUT_BIND_SLOT << ") readonly buffer InstancingIndirectionLUT\n" - "{\n" - " int constants_addressing_lookup[];\n" - "};\n\n" + OS << "layout(std430, binding = " << GL_INSTANCING_LUT_BIND_SLOT << ") readonly buffer InstancingIndirectionLUT\n" + "{\n" + " int constants_addressing_lookup[];\n" + "};\n\n" - "layout(std430, binding = " << GL_INSTANCING_XFORM_CONSTANTS_SLOT << ") readonly buffer InstancingVertexConstantsBlock\n" - "{\n" - " vec4 instanced_constants_array[];\n" - "};\n\n" + "layout(std430, binding = " + << GL_INSTANCING_XFORM_CONSTANTS_SLOT << ") readonly buffer InstancingVertexConstantsBlock\n" + "{\n" + " vec4 instanced_constants_array[];\n" + "};\n\n" - "#define CONSTANTS_ARRAY_LENGTH " << (properties.has_indexed_constants ? 468 : ::size32(m_constant_ids)) << "\n\n"; + "#define CONSTANTS_ARRAY_LENGTH " + << (properties.has_indexed_constants ? 468 : ::size32(m_constant_ids)) << "\n\n"; } continue; @@ -97,7 +99,7 @@ void GLVertexDecompilerThread::insertConstants(std::stringstream& OS, const std: PT.type == "sampler1D" || PT.type == "sampler3D") { - if (m_prog.texture_state.multisampled_textures) [[ unlikely ]] + if (m_prog.texture_state.multisampled_textures) [[unlikely]] { ensure(PI.name.length() > 3); int index = atoi(&PI.name[3]); @@ -120,38 +122,38 @@ void GLVertexDecompilerThread::insertConstants(std::stringstream& OS, const std: } static const vertex_reg_info reg_table[] = -{ - { "gl_Position", false, "dst_reg0", "", false }, - { "diff_color", true, "dst_reg1", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTDIFFUSE | CELL_GCM_ATTRIB_OUTPUT_MASK_BACKDIFFUSE }, - { "spec_color", true, "dst_reg2", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTSPECULAR | CELL_GCM_ATTRIB_OUTPUT_MASK_BACKSPECULAR }, - // These are only present when back variants are specified, otherwise the default diff/spec color vars are for both front and back - { "diff_color1", true, "dst_reg3", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTDIFFUSE | CELL_GCM_ATTRIB_OUTPUT_MASK_BACKDIFFUSE }, - { "spec_color1", true, "dst_reg4", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTSPECULAR | CELL_GCM_ATTRIB_OUTPUT_MASK_BACKSPECULAR }, - // Fog output shares a data source register with clip planes 0-2 so only declare when specified - { "fog_c", true, "dst_reg5", ".xxxx", true, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_FOG }, - // Warning: Always define all 3 clip plane groups together to avoid flickering with openGL - { "gl_ClipDistance[0]", false, "dst_reg5", ".y * user_clip_factor[0].x", false, "user_clip_enabled[0].x > 0", "0.5", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_UC0 }, - { "gl_ClipDistance[1]", false, "dst_reg5", ".z * user_clip_factor[0].y", false, "user_clip_enabled[0].y > 0", "0.5", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_UC1 }, - { "gl_ClipDistance[2]", false, "dst_reg5", ".w * user_clip_factor[0].z", false, "user_clip_enabled[0].z > 0", "0.5", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_UC2 }, - { "gl_PointSize", false, "dst_reg6", ".x", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_POINTSIZE }, - { "gl_ClipDistance[3]", false, "dst_reg6", ".y * user_clip_factor[0].w", false, "user_clip_enabled[0].w > 0", "0.5", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_UC3 }, - { "gl_ClipDistance[4]", false, "dst_reg6", ".z * user_clip_factor[1].x", false, "user_clip_enabled[1].x > 0", "0.5", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_UC4 }, - { "gl_ClipDistance[5]", false, "dst_reg6", ".w * user_clip_factor[1].y", false, "user_clip_enabled[1].y > 0", "0.5", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_UC5 }, - { "tc0", true, "dst_reg7", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX0 }, - { "tc1", true, "dst_reg8", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX1 }, - { "tc2", true, "dst_reg9", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX2 }, - { "tc3", true, "dst_reg10", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX3 }, - { "tc4", true, "dst_reg11", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX4 }, - { "tc5", true, "dst_reg12", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX5 }, - { "tc6", true, "dst_reg13", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX6 }, - { "tc7", true, "dst_reg14", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX7 }, - { "tc8", true, "dst_reg15", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX8 }, - { "tc9", true, "dst_reg6", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX9 } // In this line, dst_reg6 is correct since dst_reg goes from 0 to 15. + { + {"gl_Position", false, "dst_reg0", "", false}, + {"diff_color", true, "dst_reg1", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTDIFFUSE | CELL_GCM_ATTRIB_OUTPUT_MASK_BACKDIFFUSE}, + {"spec_color", true, "dst_reg2", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTSPECULAR | CELL_GCM_ATTRIB_OUTPUT_MASK_BACKSPECULAR}, + // These are only present when back variants are specified, otherwise the default diff/spec color vars are for both front and back + {"diff_color1", true, "dst_reg3", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTDIFFUSE | CELL_GCM_ATTRIB_OUTPUT_MASK_BACKDIFFUSE}, + {"spec_color1", true, "dst_reg4", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTSPECULAR | CELL_GCM_ATTRIB_OUTPUT_MASK_BACKSPECULAR}, + // Fog output shares a data source register with clip planes 0-2 so only declare when specified + {"fog_c", true, "dst_reg5", ".xxxx", true, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_FOG}, + // Warning: Always define all 3 clip plane groups together to avoid flickering with openGL + {"gl_ClipDistance[0]", false, "dst_reg5", ".y * user_clip_factor[0].x", false, "user_clip_enabled[0].x > 0", "0.5", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_UC0}, + {"gl_ClipDistance[1]", false, "dst_reg5", ".z * user_clip_factor[0].y", false, "user_clip_enabled[0].y > 0", "0.5", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_UC1}, + {"gl_ClipDistance[2]", false, "dst_reg5", ".w * user_clip_factor[0].z", false, "user_clip_enabled[0].z > 0", "0.5", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_UC2}, + {"gl_PointSize", false, "dst_reg6", ".x", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_POINTSIZE}, + {"gl_ClipDistance[3]", false, "dst_reg6", ".y * user_clip_factor[0].w", false, "user_clip_enabled[0].w > 0", "0.5", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_UC3}, + {"gl_ClipDistance[4]", false, "dst_reg6", ".z * user_clip_factor[1].x", false, "user_clip_enabled[1].x > 0", "0.5", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_UC4}, + {"gl_ClipDistance[5]", false, "dst_reg6", ".w * user_clip_factor[1].y", false, "user_clip_enabled[1].y > 0", "0.5", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_UC5}, + {"tc0", true, "dst_reg7", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX0}, + {"tc1", true, "dst_reg8", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX1}, + {"tc2", true, "dst_reg9", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX2}, + {"tc3", true, "dst_reg10", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX3}, + {"tc4", true, "dst_reg11", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX4}, + {"tc5", true, "dst_reg12", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX5}, + {"tc6", true, "dst_reg13", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX6}, + {"tc7", true, "dst_reg14", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX7}, + {"tc8", true, "dst_reg15", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX8}, + {"tc9", true, "dst_reg6", "", false, "", "", "", true, CELL_GCM_ATTRIB_OUTPUT_MASK_TEX9} // In this line, dst_reg6 is correct since dst_reg goes from 0 to 15. }; void GLVertexDecompilerThread::insertOutputs(std::stringstream& OS, const std::vector& /*outputs*/) { - for (auto &i : reg_table) + for (auto& i : reg_table) { if (i.need_declare) { @@ -161,7 +163,7 @@ void GLVertexDecompilerThread::insertOutputs(std::stringstream& OS, const std::v } } -void GLVertexDecompilerThread::insertMainStart(std::stringstream & OS) +void GLVertexDecompilerThread::insertMainStart(std::stringstream& OS) { const auto& dev_caps = gl::get_driver_caps(); @@ -179,9 +181,9 @@ void GLVertexDecompilerThread::insertMainStart(std::stringstream & OS) // Declare global registers with optional initialization std::string registers; - if (ParamType *vec4Types = m_parr.SearchParam(PF_PARAM_OUT, "vec4")) + if (ParamType* vec4Types = m_parr.SearchParam(PF_PARAM_OUT, "vec4")) { - for (auto &PI : vec4Types->items) + for (auto& PI : vec4Types->items) { if (registers.length()) registers += ", "; @@ -210,9 +212,9 @@ void GLVertexDecompilerThread::insertMainStart(std::stringstream & OS) OS << "{\n"; // Declare temporary registers, ignoring those mapped to outputs - for (const ParamType &PT : m_parr.params[PF_PARAM_NONE]) + for (const ParamType& PT : m_parr.params[PF_PARAM_NONE]) { - for (const ParamItem &PI : PT.items) + for (const ParamItem& PI : PT.items) { if (PI.name.starts_with("dst_reg")) continue; @@ -225,25 +227,26 @@ void GLVertexDecompilerThread::insertMainStart(std::stringstream & OS) } } - for (const ParamType &PT : m_parr.params[PF_PARAM_IN]) + for (const ParamType& PT : m_parr.params[PF_PARAM_IN]) { - for (const ParamItem &PI : PT.items) + for (const ParamItem& PI : PT.items) { OS << " vec4 " << PI.name << "= read_location(" << std::to_string(PI.location) << ");\n"; } } } -void GLVertexDecompilerThread::insertMainEnd(std::stringstream & OS) +void GLVertexDecompilerThread::insertMainEnd(std::stringstream& OS) { OS << "}\n\n"; OS << "void main ()\n"; OS << "{\n"; - OS << "\n" << " vs_main();\n\n"; + OS << "\n" + << " vs_main();\n\n"; - for (auto &i : reg_table) + for (auto& i : reg_table) { if (!i.check_mask || i.test(rsx_vertex_program.output_mask)) { @@ -253,7 +256,8 @@ void GLVertexDecompilerThread::insertMainEnd(std::stringstream & OS) if (condition.empty() || i.default_val.empty()) { - if (!condition.empty()) condition = "if " + condition; + if (!condition.empty()) + condition = "if " + condition; OS << " " << condition << i.name << " = " << i.src_reg << i.src_reg_mask << ";\n"; } else @@ -287,11 +291,11 @@ void GLVertexDecompilerThread::insertMainEnd(std::stringstream & OS) // RSX matrices passed already map to the [0, 1] range but mapping to classic OGL requires that we undo this step // This can be made unnecessary using the call glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE). // However, ClipControl only made it to opengl core in ver 4.5 though, so this is a workaround. - + // NOTE: It is completely valid for games to use very large w values, causing the post-multiplied z to be in the hundreds // It is therefore critical that this step is done post-transform and the result re-scaled by w // SEE Naruto: UNS - + // NOTE: On GPUs, poor fp32 precision means dividing z by w, then multiplying by w again gives slightly incorrect results // This equation is simplified algebraically to an addition and subtraction which gives more accurate results (Fixes flickering skybox in Dark Souls 2) // OS << " float ndc_z = gl_Position.z / gl_Position.w;\n"; diff --git a/rpcs3/rpcs3/Emu/RSX/GL/GLVertexProgram.h b/rpcs3/rpcs3/Emu/RSX/GL/GLVertexProgram.h index 631b6ac24..b815e9fc6 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/GLVertexProgram.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/GLVertexProgram.h @@ -6,11 +6,11 @@ enum { - GL_VP_FORCE_ATTRIB_SCALING = 1, //Scale vertex read result - GL_VP_ATTRIB_S16_INT = (1 << 1), //Attrib is a signed 16-bit integer - GL_VP_ATTRIB_S32_INT = (1 << 2), //Attrib is a signed 32-bit integer + GL_VP_FORCE_ATTRIB_SCALING = 1, // Scale vertex read result + GL_VP_ATTRIB_S16_INT = (1 << 1), // Attrib is a signed 16-bit integer + GL_VP_ATTRIB_S32_INT = (1 << 2), // Attrib is a signed 32-bit integer - GL_VP_SINT_MASK = (GL_VP_ATTRIB_S16_INT|GL_VP_ATTRIB_S32_INT) + GL_VP_SINT_MASK = (GL_VP_ATTRIB_S16_INT | GL_VP_ATTRIB_S32_INT) }; namespace gl @@ -22,27 +22,27 @@ struct GLVertexDecompilerThread : public VertexProgramDecompiler { friend class gl::shader_interpreter; - std::string &m_shader; + std::string& m_shader; + protected: std::string getFloatTypeName(usz elementCount) override; std::string getIntTypeName(usz elementCount) override; std::string getFunction(FUNCTION) override; std::string compareFunction(COMPARE, const std::string&, const std::string&, bool scalar) override; - void insertHeader(std::stringstream &OS) override; - void insertInputs(std::stringstream &OS, const std::vector &inputs) override; - void insertConstants(std::stringstream &OS, const std::vector &constants) override; - void insertOutputs(std::stringstream &OS, const std::vector &outputs) override; - void insertMainStart(std::stringstream &OS) override; - void insertMainEnd(std::stringstream &OS) override; + void insertHeader(std::stringstream& OS) override; + void insertInputs(std::stringstream& OS, const std::vector& inputs) override; + void insertConstants(std::stringstream& OS, const std::vector& constants) override; + void insertOutputs(std::stringstream& OS, const std::vector& outputs) override; + void insertMainStart(std::stringstream& OS) override; + void insertMainEnd(std::stringstream& OS) override; - const RSXVertexProgram &rsx_vertex_program; + const RSXVertexProgram& rsx_vertex_program; std::unordered_map input_locations; + public: - GLVertexDecompilerThread(const RSXVertexProgram &prog, std::string& shader, ParamArray&) - : VertexProgramDecompiler(prog) - , m_shader(shader) - , rsx_vertex_program(prog) + GLVertexDecompilerThread(const RSXVertexProgram& prog, std::string& shader, ParamArray&) + : VertexProgramDecompiler(prog), m_shader(shader), rsx_vertex_program(prog) { } diff --git a/rpcs3/rpcs3/Emu/RSX/GL/OpenGL.cpp b/rpcs3/rpcs3/Emu/RSX/GL/OpenGL.cpp index 78241f557..4e4bb71e9 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/OpenGL.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/OpenGL.cpp @@ -18,7 +18,7 @@ extern "C" #define OPENGL_PROC(p, n) p gl##n = nullptr #define WGL_PROC(p, n) p wgl##n = nullptr #define OPENGL_PROC2(p, n, tn) OPENGL_PROC(p, n) - #include "GLProcTable.h" +#include "GLProcTable.h" #undef OPENGL_PROC #undef OPENGL_PROC2 #undef WGL_PROC @@ -29,7 +29,9 @@ void gl::init() #ifdef _WIN32 #define OPENGL_PROC(p, n) OPENGL_PROC2(p, gl##n, gl##n) #define WGL_PROC(p, n) OPENGL_PROC2(p, wgl##n, wgl##n) -#define OPENGL_PROC2(p, n, tn) /*if(!gl##n)*/ if(!(n = reinterpret_cast

(wglGetProcAddress(#tn)))) rsx_log.error("OpenGL: initialization of " #tn " failed.") +#define OPENGL_PROC2(p, n, tn) /*if(!gl##n)*/ \ + if (!(n = reinterpret_cast

(wglGetProcAddress(#tn)))) \ + rsx_log.error("OpenGL: initialization of " #tn " failed.") #include "GLProcTable.h" #undef OPENGL_PROC #undef WGL_PROC @@ -66,7 +68,7 @@ void gl::set_swapinterval(int interval) } #endif - //No existing drawable or missing swap extension, EGL? + // No existing drawable or missing swap extension, EGL? rsx_log.error("Failed to set swap interval"); #else rsx_log.error("Swap control not implemented for this platform. Vsync options not available. (interval=%d)", interval); diff --git a/rpcs3/rpcs3/Emu/RSX/GL/OpenGL.h b/rpcs3/rpcs3/Emu/RSX/GL/OpenGL.h index 2ecf773d7..65a3e255b 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/OpenGL.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/OpenGL.h @@ -4,15 +4,15 @@ #endif #ifdef _WIN32 -#include +#include #include "GL/gl.h" #include -typedef BOOL (WINAPI* PFNWGLSWAPINTERVALEXTPROC) (int interval); +typedef BOOL(WINAPI* PFNWGLSWAPINTERVALEXTPROC)(int interval); #define OPENGL_PROC(p, n) extern p gl##n #define WGL_PROC(p, n) extern p wgl##n #define OPENGL_PROC2(p, n, tn) OPENGL_PROC(p, n) - #include "GLProcTable.h" +#include "GLProcTable.h" #undef OPENGL_PROC #undef WGL_PROC #undef OPENGL_PROC2 @@ -31,8 +31,8 @@ typedef BOOL (WINAPI* PFNWGLSWAPINTERVALEXTPROC) (int interval); #endif #ifndef GL_TEXTURE_BUFFER_BINDING -//During spec release, this enum was removed during upgrade from ARB equivalent -//See https://www.khronos.org/bugzilla/show_bug.cgi?id=844 +// During spec release, this enum was removed during upgrade from ARB equivalent +// See https://www.khronos.org/bugzilla/show_bug.cgi?id=844 #define GL_TEXTURE_BUFFER_BINDING 0x8C2A #endif @@ -40,4 +40,4 @@ namespace gl { void init(); void set_swapinterval(int interval); -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/blitter.cpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/blitter.cpp index 57998b761..48c73cda4 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/blitter.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/blitter.cpp @@ -36,21 +36,23 @@ namespace gl auto src_w = src_rect.width(); auto dst_w = dst_rect.width(); - if (xfer_info.src_is_typeless) src_w = static_cast(src_w * xfer_info.src_scaling_hint); - if (xfer_info.dst_is_typeless) dst_w = static_cast(dst_w * xfer_info.dst_scaling_hint); + if (xfer_info.src_is_typeless) + src_w = static_cast(src_w * xfer_info.src_scaling_hint); + if (xfer_info.dst_is_typeless) + dst_w = static_cast(dst_w * xfer_info.dst_scaling_hint); if (src_w == dst_w) { // Final dimensions are a match if (xfer_info.src_is_typeless || xfer_info.dst_is_typeless) { - const coord3i src_region = { { src_rect.x1, src_rect.y1, 0 }, { src_rect.width(), src_rect.height(), 1 } }; - const coord3i dst_region = { { dst_rect.x1, dst_rect.y1, 0 }, { dst_rect.width(), dst_rect.height(), 1 } }; + const coord3i src_region = {{src_rect.x1, src_rect.y1, 0}, {src_rect.width(), src_rect.height(), 1}}; + const coord3i dst_region = {{dst_rect.x1, dst_rect.y1, 0}, {dst_rect.width(), dst_rect.height(), 1}}; gl::copy_typeless(cmd, dst, src, static_cast(dst_region), static_cast(src_region)); } else { - copy_image(cmd, src, dst, 0, 0, position3i{ src_rect.x1, src_rect.y1, 0u }, position3i{ dst_rect.x1, dst_rect.y1, 0 }, size3i{ src_rect.width(), src_rect.height(), 1 }); + copy_image(cmd, src, dst, 0, 0, position3i{src_rect.x1, src_rect.y1, 0u}, position3i{dst_rect.x1, dst_rect.y1, 0}, size3i{src_rect.width(), src_rect.height(), 1}); } return; @@ -60,8 +62,8 @@ namespace gl if (xfer_info.src_is_typeless) { const auto internal_fmt = xfer_info.src_native_format_override ? - GLenum(xfer_info.src_native_format_override) : - get_sized_internal_format(xfer_info.src_gcm_format); + GLenum(xfer_info.src_native_format_override) : + get_sized_internal_format(xfer_info.src_gcm_format); if (static_cast(internal_fmt) != src->get_internal_format()) { @@ -78,8 +80,8 @@ namespace gl if (xfer_info.dst_is_typeless) { const auto internal_fmt = xfer_info.dst_native_format_override ? - GLenum(xfer_info.dst_native_format_override) : - get_sized_internal_format(xfer_info.dst_gcm_format); + GLenum(xfer_info.dst_native_format_override) : + get_sized_internal_format(xfer_info.dst_gcm_format); if (static_cast(internal_fmt) != dst->get_internal_format()) { @@ -109,7 +111,7 @@ namespace gl src_rect.height() == dst_rect.height() && !src_rect.is_flipped() && !dst_rect.is_flipped()) { - copy_image(cmd, real_src, real_dst, 0, 0, position3i{ src_rect.x1, src_rect.y1, 0 }, position3i{ dst_rect.x1, dst_rect.y1, 0 }, size3i{ src_rect.width(), src_rect.height(), 1 }); + copy_image(cmd, real_src, real_dst, 0, 0, position3i{src_rect.x1, src_rect.y1, 0}, position3i{dst_rect.x1, dst_rect.y1, 0}, size3i{src_rect.width(), src_rect.height(), 1}); } else { @@ -141,10 +143,10 @@ namespace gl save_binding_state saved; - gl::fbo::attachment src_att{ blit_src, static_cast(attachment) }; + gl::fbo::attachment src_att{blit_src, static_cast(attachment)}; src_att = *real_src; - gl::fbo::attachment dst_att{ blit_dst, static_cast(attachment) }; + gl::fbo::attachment dst_att{blit_dst, static_cast(attachment)}; dst_att = *real_dst; blit_src.blit(blit_dst, src_rect, dst_rect, target, interp); @@ -198,7 +200,7 @@ namespace gl } save_binding_state saved; - fbo::attachment attach_point{ blit_dst, attachment }; + fbo::attachment attach_point{blit_dst, attachment}; blit_dst.bind(); attach_point = *dst; @@ -210,4 +212,4 @@ namespace gl glClear(clear_mask); attach_point = GL_NONE; } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/blitter.h b/rpcs3/rpcs3/Emu/RSX/GL/glutils/blitter.h index d7adc1dd1..d3ecf673d 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/blitter.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/blitter.h @@ -29,7 +29,6 @@ namespace gl fbo blit_dst; public: - void init() { blit_src.create(); @@ -57,4 +56,4 @@ namespace gl }; extern blitter* g_hw_blitter; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/buffer_object.cpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/buffer_object.cpp index 5c1f0d044..c5d796268 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/buffer_object.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/buffer_object.cpp @@ -136,7 +136,8 @@ namespace gl ensure(m_memory_type == memory_type::host_visible); GLenum access_bits = static_cast(access_); - if (access_bits == GL_MAP_WRITE_BIT) access_bits |= GL_MAP_UNSYNCHRONIZED_BIT; + if (access_bits == GL_MAP_WRITE_BIT) + access_bits |= GL_MAP_UNSYNCHRONIZED_BIT; auto raw_data = DSA_CALL2_RET(MapNamedBufferRange, id(), offset, length, access_bits); return reinterpret_cast(raw_data); @@ -150,13 +151,13 @@ namespace gl void buffer::bind_range(u32 index, u32 offset, u32 size) const { - m_bound_range = { offset, size }; + m_bound_range = {offset, size}; glBindBufferRange(static_cast(current_target()), index, id(), offset, size); } void buffer::bind_range(target target_, u32 index, u32 offset, u32 size) const { - m_bound_range = { offset, size }; + m_bound_range = {offset, size}; glBindBufferRange(static_cast(target_), index, id(), offset, size); } @@ -200,4 +201,4 @@ namespace gl return false; } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/buffer_object.h b/rpcs3/rpcs3/Emu/RSX/GL/glutils/buffer_object.h index dccb2a314..e8ea29f04 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/buffer_object.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/buffer_object.h @@ -36,8 +36,8 @@ namespace gl enum usage { - host_write = (1 << 0), - host_read = (1 << 1), + host_write = (1 << 0), + host_read = (1 << 1), persistent_map = (1 << 2), dynamic_update = (1 << 3), }; @@ -108,8 +108,14 @@ namespace gl void remove(); - void bind(target target_) const { glBindBuffer(static_cast(target_), m_id); } - void bind() const { bind(current_target()); } + void bind(target target_) const + { + glBindBuffer(static_cast(target_), m_id); + } + void bind() const + { + bind(current_target()); + } void data(GLsizeiptr size, const void* data_ = nullptr, GLenum usage = GL_STREAM_DRAW); void sub_data(GLsizeiptr offset, GLsizeiptr length, const GLvoid* data); @@ -122,14 +128,35 @@ namespace gl void copy_to(buffer* other, u64 src_offset, u64 dst_offset, u64 size); - target current_target() const { return m_target; } - GLsizeiptr size() const { return m_size; } - uint id() const { return m_id; } - void set_id(uint id) { m_id = id; } - bool created() const { return m_id != GL_NONE; } - std::pair bound_range() const { return m_bound_range; } + target current_target() const + { + return m_target; + } + GLsizeiptr size() const + { + return m_size; + } + uint id() const + { + return m_id; + } + void set_id(uint id) + { + m_id = id; + } + bool created() const + { + return m_id != GL_NONE; + } + std::pair bound_range() const + { + return m_bound_range; + } - explicit operator bool() const { return created(); } + explicit operator bool() const + { + return created(); + } }; class buffer_view @@ -142,20 +169,33 @@ namespace gl public: buffer_view(buffer* _buffer, u32 offset, u32 range, GLenum format = GL_R8UI) : m_buffer(_buffer), m_offset(offset), m_range(range), m_format(format) - {} + { + } buffer_view() = default; void update(buffer* _buffer, u32 offset, u32 range, GLenum format = GL_R8UI); - u32 offset() const { return m_offset; } + u32 offset() const + { + return m_offset; + } - u32 range() const { return m_range; } + u32 range() const + { + return m_range; + } - u32 format() const { return m_format; } + u32 format() const + { + return m_format; + } - buffer* value() const { return m_buffer; } + buffer* value() const + { + return m_buffer; + } bool in_range(u32 address, u32 size, u32& new_offset) const; }; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/capabilities.cpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/capabilities.cpp index d6a51beb0..022e5cca8 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/capabilities.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/capabilities.cpp @@ -9,7 +9,7 @@ namespace gl { version_info::version_info(const char* version_string, int major_scale) { - auto tokens = fmt::split(version_string, { "." }); + auto tokens = fmt::split(version_string, {"."}); if (tokens.size() < 2) { rsx_log.warning("Invalid version string: '%s'", version_string); @@ -43,13 +43,15 @@ namespace gl all_extensions.emplace(reinterpret_cast(glGetStringi(GL_EXTENSIONS, i))); } -#define CHECK_EXTENSION_SUPPORT(extension_short_name)\ - do {\ - if (all_extensions.contains("GL_"#extension_short_name)) {\ - extension_short_name##_supported = true;\ - rsx_log.success("[CAPS] Using GL_"#extension_short_name);\ - continue;\ - } \ +#define CHECK_EXTENSION_SUPPORT(extension_short_name) \ + do \ + { \ + if (all_extensions.contains("GL_" #extension_short_name)) \ + { \ + extension_short_name##_supported = true; \ + rsx_log.success("[CAPS] Using GL_" #extension_short_name); \ + continue; \ + } \ } while (0) CHECK_EXTENSION_SUPPORT(ARB_shader_draw_parameters); @@ -162,4 +164,4 @@ namespace gl initialized = true; } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/capabilities.h b/rpcs3/rpcs3/Emu/RSX/GL/glutils/capabilities.h index 756250430..99af8172c 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/capabilities.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/capabilities.h @@ -55,4 +55,4 @@ namespace gl }; const capabilities& get_driver_caps(); -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/common.cpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/common.cpp index 05320ee90..79a2908bb 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/common.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/common.cpp @@ -28,11 +28,11 @@ namespace gl gl::command_context get_command_context() { - return { *s_current_state }; + return {*s_current_state}; } attrib_t vao::operator[](u32 index) const noexcept { return attrib_t(index); } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/common.h b/rpcs3/rpcs3/Emu/RSX/GL/glutils/common.h index f99c3590a..6fd138cd9 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/common.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/common.h @@ -3,50 +3,50 @@ #include "capabilities.h" #define GL_FRAGMENT_TEXTURES_START 0 -#define GL_VERTEX_TEXTURES_START (GL_FRAGMENT_TEXTURES_START + 16) -#define GL_STENCIL_MIRRORS_START (GL_VERTEX_TEXTURES_START + 4) -#define GL_STREAM_BUFFER_START (GL_STENCIL_MIRRORS_START + 16) -#define GL_TEMP_IMAGE_SLOT(x) (31 - x) +#define GL_VERTEX_TEXTURES_START (GL_FRAGMENT_TEXTURES_START + 16) +#define GL_STENCIL_MIRRORS_START (GL_VERTEX_TEXTURES_START + 4) +#define GL_STREAM_BUFFER_START (GL_STENCIL_MIRRORS_START + 16) +#define GL_TEMP_IMAGE_SLOT(x) (31 - x) -#define UBO_SLOT(x) (x + 8) +#define UBO_SLOT(x) (x + 8) #define SSBO_SLOT(x) (x) -#define GL_VERTEX_PARAMS_BIND_SLOT UBO_SLOT(0) -#define GL_VERTEX_LAYOUT_BIND_SLOT UBO_SLOT(1) -#define GL_VERTEX_CONSTANT_BUFFERS_BIND_SLOT UBO_SLOT(2) +#define GL_VERTEX_PARAMS_BIND_SLOT UBO_SLOT(0) +#define GL_VERTEX_LAYOUT_BIND_SLOT UBO_SLOT(1) +#define GL_VERTEX_CONSTANT_BUFFERS_BIND_SLOT UBO_SLOT(2) #define GL_FRAGMENT_CONSTANT_BUFFERS_BIND_SLOT UBO_SLOT(3) -#define GL_FRAGMENT_STATE_BIND_SLOT UBO_SLOT(4) -#define GL_FRAGMENT_TEXTURE_PARAMS_BIND_SLOT UBO_SLOT(5) -#define GL_RASTERIZER_STATE_BIND_SLOT UBO_SLOT(6) -#define GL_INTERPRETER_VERTEX_BLOCK SSBO_SLOT(0) -#define GL_INTERPRETER_FRAGMENT_BLOCK SSBO_SLOT(1) -#define GL_INSTANCING_LUT_BIND_SLOT SSBO_SLOT(2) -#define GL_INSTANCING_XFORM_CONSTANTS_SLOT SSBO_SLOT(3) -#define GL_COMPUTE_BUFFER_SLOT(index) SSBO_SLOT(2 + index) -#define GL_COMPUTE_IMAGE_SLOT(index) SSBO_SLOT(index) +#define GL_FRAGMENT_STATE_BIND_SLOT UBO_SLOT(4) +#define GL_FRAGMENT_TEXTURE_PARAMS_BIND_SLOT UBO_SLOT(5) +#define GL_RASTERIZER_STATE_BIND_SLOT UBO_SLOT(6) +#define GL_INTERPRETER_VERTEX_BLOCK SSBO_SLOT(0) +#define GL_INTERPRETER_FRAGMENT_BLOCK SSBO_SLOT(1) +#define GL_INSTANCING_LUT_BIND_SLOT SSBO_SLOT(2) +#define GL_INSTANCING_XFORM_CONSTANTS_SLOT SSBO_SLOT(3) +#define GL_COMPUTE_BUFFER_SLOT(index) SSBO_SLOT(2 + index) +#define GL_COMPUTE_IMAGE_SLOT(index) SSBO_SLOT(index) -//Function call wrapped in ARB_DSA vs EXT_DSA compat check -#define DSA_CALL(func, object_name, target, ...)\ - if (::gl::get_driver_caps().ARB_direct_state_access_supported)\ - gl##func(object_name, __VA_ARGS__);\ - else\ +// Function call wrapped in ARB_DSA vs EXT_DSA compat check +#define DSA_CALL(func, object_name, target, ...) \ + if (::gl::get_driver_caps().ARB_direct_state_access_supported) \ + gl##func(object_name, __VA_ARGS__); \ + else \ gl##func##EXT(object_name, target, __VA_ARGS__); -#define DSA_CALL2(func, ...)\ - if (::gl::get_driver_caps().ARB_direct_state_access_supported)\ - gl##func(__VA_ARGS__);\ - else\ +#define DSA_CALL2(func, ...) \ + if (::gl::get_driver_caps().ARB_direct_state_access_supported) \ + gl##func(__VA_ARGS__); \ + else \ gl##func##EXT(__VA_ARGS__); -#define DSA_CALL2_RET(func, ...)\ - (::gl::get_driver_caps().ARB_direct_state_access_supported) ?\ - gl##func(__VA_ARGS__) :\ +#define DSA_CALL2_RET(func, ...) \ + (::gl::get_driver_caps().ARB_direct_state_access_supported) ? \ + gl##func(__VA_ARGS__) : \ gl##func##EXT(__VA_ARGS__) -#define DSA_CALL3(funcARB, funcDSA, ...)\ - if (::gl::get_driver_caps().ARB_direct_state_access_supported)\ - gl##funcARB(__VA_ARGS__);\ - else\ +#define DSA_CALL3(funcARB, funcDSA, ...) \ + if (::gl::get_driver_caps().ARB_direct_state_access_supported) \ + gl##funcARB(__VA_ARGS__); \ + else \ gl##funcDSA##EXT(__VA_ARGS__); namespace gl @@ -54,7 +54,7 @@ namespace gl using flags32_t = u32; using handle32_t = u32; - template + template class save_binding_state_base { GLint m_last_binding; @@ -89,4 +89,4 @@ namespace gl // This spec workaround allows it to be abused by ISVs to indicate a broken GL context. ensure(glGetError() != GL_OUT_OF_MEMORY); } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/fbo.cpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/fbo.cpp index b1f6300c0..536547bb4 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/fbo.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/fbo.cpp @@ -216,7 +216,7 @@ namespace gl GLint value; glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &value); - return{ static_cast(value) }; + return {static_cast(value)}; } fbo fbo::get_bound_read_buffer() @@ -224,7 +224,7 @@ namespace gl GLint value; glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &value); - return{ static_cast(value) }; + return {static_cast(value)}; } fbo fbo::get_bound_buffer() @@ -232,7 +232,7 @@ namespace gl GLint value; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); - return{ static_cast(value) }; + return {static_cast(value)}; } GLuint fbo::id() const @@ -276,4 +276,4 @@ namespace gl return std::find(resources.cbegin(), resources.cend(), e.second) != resources.cend(); }); } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/fbo.h b/rpcs3/rpcs3/Emu/RSX/GL/glutils/fbo.h index ef71bfa46..7b84a25e5 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/fbo.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/fbo.h @@ -93,12 +93,12 @@ namespace gl attachment(fbo& parent) : m_parent(parent) - {} + { + } public: attachment(fbo& parent, type type) - : m_id(static_cast(type)) - , m_parent(parent) + : m_id(static_cast(type)), m_parent(parent) { } @@ -123,16 +123,16 @@ namespace gl return 0; } - void operator = (const texture& rhs) + void operator=(const texture& rhs) { ensure(rhs.get_target() == texture::target::texture2D || - rhs.get_target() == texture::target::texture2DMS); + rhs.get_target() == texture::target::texture2DMS); m_parent.m_resource_bindings[m_id] = rhs.id(); DSA_CALL2(NamedFramebufferTexture, m_parent.id(), m_id, rhs.id(), 0); } - void operator = (const GLuint rhs) + void operator=(const GLuint rhs) { m_parent.m_resource_bindings[m_id] = rhs; DSA_CALL2(NamedFramebufferTexture, m_parent.id(), m_id, rhs, 0); @@ -148,7 +148,7 @@ namespace gl attachment operator[](int index) const { - return{ m_parent, type(id() + index) }; + return {m_parent, type(id() + index)}; } std::vector range(int from, int count) const @@ -161,21 +161,22 @@ namespace gl return result; } - using attachment::operator =; + using attachment::operator=; }; struct null_attachment : public attachment { null_attachment(fbo& parent) : attachment(parent) - {} + { + } }; - indexed_attachment color{ *this, attachment::type::color }; - attachment depth{ *this, attachment::type::depth }; - attachment stencil{ *this, attachment::type::stencil }; - attachment depth_stencil{ *this, attachment::type::depth_stencil }; - null_attachment no_color{ *this }; + indexed_attachment color{*this, attachment::type::color}; + attachment depth{*this, attachment::type::depth}; + attachment stencil{*this, attachment::type::stencil}; + attachment depth_stencil{*this, attachment::type::depth_stencil}; + null_attachment no_color{*this}; enum class target { @@ -248,4 +249,4 @@ namespace gl }; extern const fbo screen; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/image.cpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/image.cpp index bb6439cc0..e828ebdcd 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/image.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/image.cpp @@ -164,7 +164,7 @@ namespace gl m_target = static_cast(target); m_internal_format = static_cast(sized_format); - m_component_layout = { GL_ALPHA, GL_RED, GL_GREEN, GL_BLUE }; + m_component_layout = {GL_ALPHA, GL_RED, GL_GREEN, GL_BLUE}; m_format_class = format_class; } @@ -213,7 +213,7 @@ namespace gl for (unsigned face = region.z; face < end; ++face) { glTextureSubImage2DEXT(m_id, GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, region.x, region.y, region.width, region.height, static_cast(format), static_cast(type), ptr); - ptr += (region.width * region.height * 4); //TODO + ptr += (region.width * region.height * 4); // TODO } } break; @@ -247,24 +247,24 @@ namespace gl region.width == m_width && region.height == m_height && region.depth == m_depth) { if (caps.ARB_direct_state_access_supported) - glGetTextureImage(m_id, level, static_cast(format), static_cast(type), s32{ smax }, dst); + glGetTextureImage(m_id, level, static_cast(format), static_cast(type), s32{smax}, dst); else glGetTextureImageEXT(m_id, static_cast(m_target), level, static_cast(format), static_cast(type), dst); } else if (caps.ARB_direct_state_access_supported) { glGetTextureSubImage(m_id, level, region.x, region.y, region.z, region.width, region.height, region.depth, - static_cast(format), static_cast(type), s32{ smax }, dst); + static_cast(format), static_cast(type), s32{smax}, dst); } else { // Worst case scenario. For some reason, EXT_dsa does not have glGetTextureSubImage const auto target_ = static_cast(m_target); - texture tmp{ target_, region.width, region.height, region.depth, 1, 1, static_cast(m_internal_format), m_format_class }; + texture tmp{target_, region.width, region.height, region.depth, 1, 1, static_cast(m_internal_format), m_format_class}; glCopyImageSubData(m_id, target_, level, region.x, region.y, region.z, tmp.id(), target_, 0, 0, 0, 0, region.width, region.height, region.depth); - const coord3u region2 = { {0, 0, 0}, region.size }; + const coord3u region2 = {{0, 0, 0}, region.size}; tmp.copy_to(dst, format, type, 0, region2, pixel_settings); } } @@ -383,4 +383,4 @@ namespace gl views.clear(); } } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/image.h b/rpcs3/rpcs3/Emu/RSX/GL/glutils/image.h index 896c3ee08..1d4b5930c 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/image.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/image.h @@ -5,13 +5,13 @@ #include "Utilities/geometry.h" #include "Emu/RSX/Common/TextureUtils.h" -//using enum rsx::format_class; +// using enum rsx::format_class; using namespace ::rsx::format_class_; namespace gl { -#define GL_BGRA8 0x80E1 // Enumerant of GL_BGRA8_EXT from the GL_EXT_texture_format_BGRA8888 -#define GL_BGR5_A1 0x99F0 // Unused enum 0x96xx is the last official GL enumerant +#define GL_BGRA8 0x80E1 // Enumerant of GL_BGRA8_EXT from the GL_EXT_texture_format_BGRA8888 +#define GL_BGR5_A1 0x99F0 // Unused enum 0x96xx is the last official GL enumerant class buffer; class buffer_view; @@ -132,7 +132,7 @@ namespace gl compressed_rgba_s3tc_dxt3 = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, compressed_rgba_s3tc_dxt5 = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, - //Sized internal formats, see opengl spec document on glTexImage2D, table 3 + // Sized internal formats, see opengl spec document on glTexImage2D, table 3 rgba8 = GL_RGBA8, bgra8 = GL_BGRA8, rgb565 = GL_RGB565, @@ -158,7 +158,7 @@ namespace gl clamp_to_edge = GL_CLAMP_TO_EDGE, clamp_to_border = GL_CLAMP_TO_BORDER, mirror_clamp = GL_MIRROR_CLAMP_EXT, - //mirror_clamp_to_edge = GL_MIRROR_CLAMP_TO_EDGE, + // mirror_clamp_to_edge = GL_MIRROR_CLAMP_TO_EDGE, mirror_clamp_to_border = GL_MIRROR_CLAMP_TO_BORDER_EXT }; @@ -301,13 +301,13 @@ namespace gl sizeu size2D() const { - return{ m_width, m_height }; + return {m_width, m_height}; } size3u size3D() const { const auto depth = (m_target == target::textureCUBE) ? 6 : m_depth; - return{ m_width, m_height, depth }; + return {m_width, m_height, depth}; } texture::internal_format get_internal_format() const @@ -332,13 +332,13 @@ namespace gl // Convenience wrappers void copy_from(const void* src, texture::format format, texture::type type, const pixel_unpack_settings& pixel_settings) { - const coord3u region = { {}, size3D() }; + const coord3u region = {{}, size3D()}; copy_from(src, format, type, 0, region, pixel_settings); } void copy_to(void* dst, texture::format format, texture::type type, const pixel_pack_settings& pixel_settings) const { - const coord3u region = { {}, size3D() }; + const coord3u region = {{}, size3D()}; copy_to(dst, format, type, 0, region, pixel_settings); } }; @@ -367,7 +367,7 @@ namespace gl const GLenum* argb_swizzle = nullptr, GLenum aspect_flags = image_aspect::color | image_aspect::depth) { - create(data, target, sized_format, { aspect_flags, 0, data->levels(), 0, data->layers() }, argb_swizzle); + create(data, target, sized_format, {aspect_flags, 0, data->levels(), 0, data->layers()}, argb_swizzle); } texture_view(texture* data, const GLenum* argb_swizzle = nullptr, @@ -375,7 +375,7 @@ namespace gl { GLenum target = static_cast(data->get_target()); GLenum sized_format = static_cast(data->get_internal_format()); - create(data, target, sized_format, { aspect_flags, 0, data->levels(), 0, data->layers() }, argb_swizzle); + create(data, target, sized_format, {aspect_flags, 0, data->levels(), 0, data->layers()}, argb_swizzle); } texture_view(texture* data, const subresource_range& range, @@ -423,9 +423,9 @@ namespace gl bool compare_swizzle(const GLenum* argb_swizzle) const { return (argb_swizzle[0] == component_swizzle[3] && - argb_swizzle[1] == component_swizzle[0] && - argb_swizzle[2] == component_swizzle[1] && - argb_swizzle[3] == component_swizzle[2]); + argb_swizzle[1] == component_swizzle[0] && + argb_swizzle[2] == component_swizzle[1] && + argb_swizzle[3] == component_swizzle[2]); } texture* image() const @@ -435,7 +435,7 @@ namespace gl std::array component_mapping() const { - return{ component_swizzle[3], component_swizzle[0], component_swizzle[1], component_swizzle[2] }; + return {component_swizzle[3], component_swizzle[0], component_swizzle[1], component_swizzle[2]}; } u32 encoded_component_map() const @@ -468,4 +468,4 @@ namespace gl // Texture helpers std::array apply_swizzle_remap(const std::array& swizzle_remap, const rsx::texture_channel_remap_t& decoded_remap); -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/pixel_settings.hpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/pixel_settings.hpp index 475b5f3b8..43f4f9e41 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/pixel_settings.hpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/pixel_settings.hpp @@ -154,4 +154,4 @@ namespace gl return m_row_length; } }; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/program.cpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/program.cpp index eaeb6f254..00f715d7d 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/program.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/program.cpp @@ -20,15 +20,18 @@ namespace gl if (string_begin == std::string::npos) { - if (c == '\n') break; - if (is_space) continue; + if (c == '\n') + break; + if (is_space) + continue; string_begin = i; } if (is_space) { - if (!count) break; + if (!count) + break; } else if (c == '(') { @@ -46,11 +49,10 @@ namespace gl auto is_exempt = [&source](const std::string_view& token) -> bool { const char* handled_keywords[] = - { - "SSBO_LOCATION(x)", - "UBO_LOCATION(x)", - "IMAGE_LOCATION(x)" - }; + { + "SSBO_LOCATION(x)", + "UBO_LOCATION(x)", + "IMAGE_LOCATION(x)"}; for (const auto& keyword : handled_keywords) { @@ -139,7 +141,7 @@ namespace gl flush_command_queue(m_init_fence); } - void shader::create(::glsl::program_domain type_, const std::string & src) + void shader::create(::glsl::program_domain type_, const std::string& src) { type = type_; source = src; @@ -205,7 +207,7 @@ namespace gl return *this; } - bool program::uniforms_t::has_location(const std::string & name, int* location) + bool program::uniforms_t::has_location(const std::string& name, int* location) { auto found = locations.find(name); if (found != locations.end()) @@ -314,5 +316,5 @@ namespace gl rsx_log.error("Validation failed: %s", error_msg.c_str()); } } - } -} + } // namespace glsl +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/program.h b/rpcs3/rpcs3/Emu/RSX/GL/glutils/program.h index 72daef252..067d8bef5 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/program.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/program.h @@ -51,17 +51,35 @@ namespace gl shader& compile(); - uint id() const { return m_id; } + uint id() const + { + return m_id; + } - const std::string& get_source() const { return source; } + const std::string& get_source() const + { + return source; + } - fence get_compile_fence_sync() const { return m_compiled_fence; } + fence get_compile_fence_sync() const + { + return m_compiled_fence; + } - bool created() const { return m_id != GL_NONE; } + bool created() const + { + return m_id != GL_NONE; + } - bool compiled() const { return m_is_compiled; } + bool compiled() const + { + return m_is_compiled; + } - explicit operator bool() const { return created(); } + explicit operator bool() const + { + return created(); + } }; class program @@ -77,8 +95,7 @@ namespace gl public: uniform_t(program& program, GLint location) - : m_program(program) - , m_location(location) + : m_program(program), m_location(location) { } @@ -87,21 +104,66 @@ namespace gl return m_location; } - void operator = (int rhs) const { glProgramUniform1i(m_program.id(), location(), rhs); } - void operator = (unsigned rhs) const { glProgramUniform1ui(m_program.id(), location(), rhs); } - void operator = (float rhs) const { glProgramUniform1f(m_program.id(), location(), rhs); } - void operator = (bool rhs) const { glProgramUniform1ui(m_program.id(), location(), rhs ? 1 : 0); } - void operator = (const color1i& rhs) const { glProgramUniform1i(m_program.id(), location(), rhs.r); } - void operator = (const color1f& rhs) const { glProgramUniform1f(m_program.id(), location(), rhs.r); } - void operator = (const color2i& rhs) const { glProgramUniform2i(m_program.id(), location(), rhs.r, rhs.g); } - void operator = (const color2f& rhs) const { glProgramUniform2f(m_program.id(), location(), rhs.r, rhs.g); } - void operator = (const color3i& rhs) const { glProgramUniform3i(m_program.id(), location(), rhs.r, rhs.g, rhs.b); } - void operator = (const color3f& rhs) const { glProgramUniform3f(m_program.id(), location(), rhs.r, rhs.g, rhs.b); } - void operator = (const color4i& rhs) const { glProgramUniform4i(m_program.id(), location(), rhs.r, rhs.g, rhs.b, rhs.a); } - void operator = (const color4f& rhs) const { glProgramUniform4f(m_program.id(), location(), rhs.r, rhs.g, rhs.b, rhs.a); } - void operator = (const areaf& rhs) const { glProgramUniform4f(m_program.id(), location(), rhs.x1, rhs.y1, rhs.x2, rhs.y2); } - void operator = (const areai& rhs) const { glProgramUniform4i(m_program.id(), location(), rhs.x1, rhs.y1, rhs.x2, rhs.y2); } - void operator = (const std::vector& rhs) const { glProgramUniform1iv(m_program.id(), location(), ::size32(rhs), rhs.data()); } + void operator=(int rhs) const + { + glProgramUniform1i(m_program.id(), location(), rhs); + } + void operator=(unsigned rhs) const + { + glProgramUniform1ui(m_program.id(), location(), rhs); + } + void operator=(float rhs) const + { + glProgramUniform1f(m_program.id(), location(), rhs); + } + void operator=(bool rhs) const + { + glProgramUniform1ui(m_program.id(), location(), rhs ? 1 : 0); + } + void operator=(const color1i& rhs) const + { + glProgramUniform1i(m_program.id(), location(), rhs.r); + } + void operator=(const color1f& rhs) const + { + glProgramUniform1f(m_program.id(), location(), rhs.r); + } + void operator=(const color2i& rhs) const + { + glProgramUniform2i(m_program.id(), location(), rhs.r, rhs.g); + } + void operator=(const color2f& rhs) const + { + glProgramUniform2f(m_program.id(), location(), rhs.r, rhs.g); + } + void operator=(const color3i& rhs) const + { + glProgramUniform3i(m_program.id(), location(), rhs.r, rhs.g, rhs.b); + } + void operator=(const color3f& rhs) const + { + glProgramUniform3f(m_program.id(), location(), rhs.r, rhs.g, rhs.b); + } + void operator=(const color4i& rhs) const + { + glProgramUniform4i(m_program.id(), location(), rhs.r, rhs.g, rhs.b, rhs.a); + } + void operator=(const color4f& rhs) const + { + glProgramUniform4f(m_program.id(), location(), rhs.r, rhs.g, rhs.b, rhs.a); + } + void operator=(const areaf& rhs) const + { + glProgramUniform4f(m_program.id(), location(), rhs.x1, rhs.y1, rhs.x2, rhs.y2); + } + void operator=(const areai& rhs) const + { + glProgramUniform4i(m_program.id(), location(), rhs.x1, rhs.y1, rhs.x2, rhs.y2); + } + void operator=(const std::vector& rhs) const + { + glProgramUniform1iv(m_program.id(), location(), ::size32(rhs), rhs.data()); + } }; class uniforms_t @@ -112,19 +174,29 @@ namespace gl public: uniforms_t(program* program) : m_program(*program) - {} + { + } - void clear() { locations.clear(); } + void clear() + { + locations.clear(); + } bool has_location(const std::string& name, int* location = nullptr); GLint location(const std::string& name); - uniform_t operator[](GLint location) { return{ m_program, location }; } + uniform_t operator[](GLint location) + { + return {m_program, location}; + } - uniform_t operator[](const std::string& name) { return{ m_program, location(name) }; } + uniform_t operator[](const std::string& name) + { + return {m_program, location(name)}; + } - } uniforms{ this }; + } uniforms{this}; public: program() = default; @@ -187,11 +259,20 @@ namespace gl return *this; } - GLuint id() const { return m_id; } + GLuint id() const + { + return m_id; + } - bool created() const { return m_id != GL_NONE; } + bool created() const + { + return m_id != GL_NONE; + } - explicit operator bool() const { return created(); } + explicit operator bool() const + { + return created(); + } }; - } -} + } // namespace glsl +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/ring_buffer.cpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/ring_buffer.cpp index da77b50cb..703e58197 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/ring_buffer.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/ring_buffer.cpp @@ -15,7 +15,8 @@ namespace gl save_binding_state save(current_target(), *this); GLbitfield buffer_storage_flags = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT; - if (gl::get_driver_caps().vendor_MESA) buffer_storage_flags |= GL_CLIENT_STORAGE_BIT; + if (gl::get_driver_caps().vendor_MESA) + buffer_storage_flags |= GL_CLIENT_STORAGE_BIT; DSA_CALL2(NamedBufferStorage, m_id, size, data, buffer_storage_flags); m_memory_mapping = DSA_CALL2_RET(MapNamedBufferRange, m_id, 0, size, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT); @@ -35,7 +36,8 @@ namespace gl std::pair ring_buffer::alloc_from_heap(u32 alloc_size, u16 alignment) { u32 offset = m_data_loc; - if (m_data_loc) offset = utils::align(offset, alignment); + if (m_data_loc) + offset = utils::align(offset, alignment); if ((offset + alloc_size) > m_size) { @@ -53,7 +55,7 @@ namespace gl offset = 0; } - //Align data loc to 256; allows some "guard" region so we dont trample our own data inadvertently + // Align data loc to 256; allows some "guard" region so we dont trample our own data inadvertently m_data_loc = utils::align(offset + alloc_size, 256); return std::make_pair(static_cast(m_memory_mapping) + offset, offset); } @@ -74,7 +76,7 @@ namespace gl void ring_buffer::notify() { - //Insert fence about 25% into the buffer + // Insert fence about 25% into the buffer if (m_fence.is_empty() && (m_data_loc > (m_size >> 2))) m_fence.reset(); } @@ -105,9 +107,10 @@ namespace gl ensure(m_memory_mapping == nullptr); u32 offset = m_data_loc; - if (m_data_loc) offset = utils::align(offset, 256); + if (m_data_loc) + offset = utils::align(offset, 256); - const u32 block_size = utils::align(alloc_size + 16, 256); //Overallocate just in case we need to realign base + const u32 block_size = utils::align(alloc_size + 16, 256); // Overallocate just in case we need to realign base if ((offset + block_size) > m_size) { @@ -120,12 +123,12 @@ namespace gl m_mapping_offset = m_data_loc; m_alignment_offset = 0; - //When using debugging tools, the mapped base might not be aligned as expected + // When using debugging tools, the mapped base might not be aligned as expected const u64 mapped_address_base = reinterpret_cast(m_memory_mapping); if (mapped_address_base & 0xF) { - //Unaligned result was returned. We have to modify the base address a bit - //We lose some memory here, but the 16 byte overallocation above makes up for it + // Unaligned result was returned. We have to modify the base address a bit + // We lose some memory here, but the 16 byte overallocation above makes up for it const u64 new_base = (mapped_address_base & ~0xF) + 16; const u64 diff_bytes = new_base - mapped_address_base; @@ -140,20 +143,22 @@ namespace gl std::pair legacy_ring_buffer::alloc_from_heap(u32 alloc_size, u16 alignment) { u32 offset = m_data_loc; - if (m_data_loc) offset = utils::align(offset, alignment); + if (m_data_loc) + offset = utils::align(offset, alignment); u32 padding = (offset - m_data_loc); - u32 real_size = utils::align(padding + alloc_size, alignment); //Ensures we leave the loc pointer aligned after we exit + u32 real_size = utils::align(padding + alloc_size, alignment); // Ensures we leave the loc pointer aligned after we exit if (real_size > m_mapped_bytes) { - //Missed allocation. We take a performance hit on doing this. - //Overallocate slightly for the next allocation if requested size is too small + // Missed allocation. We take a performance hit on doing this. + // Overallocate slightly for the next allocation if requested size is too small unmap(); reserve_storage_on_heap(std::max(real_size, 4096U)); offset = m_data_loc; - if (m_data_loc) offset = utils::align(offset, alignment); + if (m_data_loc) + offset = utils::align(offset, alignment); padding = (offset - m_data_loc); real_size = utils::align(padding + alloc_size, alignment); @@ -217,7 +222,7 @@ namespace gl { ensure(m_memory_mapping == nullptr); const auto allocation = ring_buffer::alloc_from_heap(alloc_size, alignment); - return { map_internal(allocation.second, alloc_size), allocation.second }; + return {map_internal(allocation.second, alloc_size), allocation.second}; } void transient_ring_buffer::flush() @@ -282,16 +287,17 @@ namespace gl { const auto range = utils::address_range::start_length(start, length); m_barriers.erase(std::remove_if(m_barriers.begin(), m_barriers.end(), [&range](auto& barrier_) - { - if (barrier_.range.overlaps(range)) - { - barrier_.signal.server_wait_sync(); - barrier_.signal.destroy(); - return true; - } + { + if (barrier_.range.overlaps(range)) + { + barrier_.signal.server_wait_sync(); + barrier_.signal.destroy(); + return true; + } - return false; - }), m_barriers.end()); + return false; + }), + m_barriers.end()); } void scratch_ring_buffer::push_barrier(u32 start, u32 length) @@ -306,4 +312,4 @@ namespace gl barrier_.signal.create(); m_barriers.emplace_back(barrier_); } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/ring_buffer.h b/rpcs3/rpcs3/Emu/RSX/GL/glutils/ring_buffer.h index 97f802ddf..88f08fd32 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/ring_buffer.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/ring_buffer.h @@ -9,7 +9,6 @@ namespace gl class ring_buffer : public buffer { protected: - u32 m_data_loc = 0; void* m_memory_mapping = nullptr; @@ -18,7 +17,10 @@ namespace gl public: virtual ~ring_buffer() = default; - virtual void bind() { buffer::bind(); } + virtual void bind() + { + buffer::bind(); + } virtual void recreate(GLsizeiptr size, const void* data = nullptr); @@ -44,7 +46,6 @@ namespace gl u32 m_alignment_offset = 0; public: - void recreate(GLsizeiptr size, const void* data = nullptr) override; void create(target target_, GLsizeiptr size, const void* data_ = nullptr); @@ -70,7 +71,6 @@ namespace gl void* map_internal(u32 offset, u32 length); public: - void bind() override; void recreate(GLsizeiptr size, const void* data = nullptr) override; @@ -98,7 +98,6 @@ namespace gl void pop_barrier(u32 start, u32 length); public: - scratch_ring_buffer() = default; scratch_ring_buffer(const scratch_ring_buffer&) = delete; ~scratch_ring_buffer(); @@ -109,7 +108,13 @@ namespace gl u32 alloc(u32 size, u32 alignment); void push_barrier(u32 start, u32 length); - buffer& get() { return m_storage; } - u64 size() const { return m_storage.size(); } + buffer& get() + { + return m_storage; + } + u64 size() const + { + return m_storage.size(); + } }; -} \ No newline at end of file +} // namespace gl \ No newline at end of file diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/sampler.cpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/sampler.cpp index 580caf0dc..25913d050 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/sampler.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/sampler.cpp @@ -4,8 +4,8 @@ #include "Emu/RSX/gcm_enums.h" #include "Emu/RSX/Common/TextureUtils.h" -//GLenum wrap_mode(rsx::texture_wrap_mode wrap); -//float max_aniso(rsx::texture_max_anisotropy aniso); +// GLenum wrap_mode(rsx::texture_wrap_mode wrap); +// float max_aniso(rsx::texture_max_anisotropy aniso); namespace gl { @@ -102,10 +102,12 @@ namespace gl { case GL_NEAREST_MIPMAP_NEAREST: case GL_NEAREST_MIPMAP_LINEAR: - min_filter = GL_NEAREST; break; + min_filter = GL_NEAREST; + break; case GL_LINEAR_MIPMAP_NEAREST: case GL_LINEAR_MIPMAP_LINEAR: - min_filter = GL_LINEAR; break; + min_filter = GL_LINEAR; + break; default: rsx_log.error("No mipmap fallback defined for rsx_min_filter = 0x%X", static_cast(tex.min_filter())); min_filter = GL_NEAREST; @@ -133,7 +135,7 @@ namespace gl if (texture_format == CELL_GCM_TEXTURE_DEPTH16 || texture_format == CELL_GCM_TEXTURE_DEPTH24_D8 || texture_format == CELL_GCM_TEXTURE_DEPTH16_FLOAT || texture_format == CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT) { - //NOTE: The stored texture function is reversed wrt the textureProj compare function + // NOTE: The stored texture function is reversed wrt the textureProj compare function GLenum compare_mode = static_cast(tex.zfunc()) | GL_NEVER; switch (compare_mode) @@ -189,4 +191,4 @@ namespace gl set_parameteri(GL_TEXTURE_MAX_LOD, 0); set_parameteri(GL_TEXTURE_COMPARE_MODE, GL_NONE); } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/sampler.h b/rpcs3/rpcs3/Emu/RSX/GL/glutils/sampler.h index 89200915f..f63751a51 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/sampler.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/sampler.h @@ -7,7 +7,7 @@ namespace rsx class fragment_texture; class vertex_texture; class sampled_image_descriptor_base; -} +} // namespace rsx namespace gl { @@ -18,7 +18,6 @@ namespace gl std::unordered_map m_propertiesf; public: - void create() { glGenSamplers(1, &sampler_handle); @@ -80,7 +79,10 @@ namespace gl void apply_defaults(GLenum default_filter = GL_NEAREST); - operator bool() const { return sampler_handle != GL_NONE; } + operator bool() const + { + return sampler_handle != GL_NONE; + } }; struct saved_sampler_state @@ -104,4 +106,4 @@ namespace gl glBindSampler(unit, saved); } }; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/state_tracker.hpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/state_tracker.hpp index ffc4fe38f..66d6e513a 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/state_tracker.hpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/state_tracker.hpp @@ -9,20 +9,20 @@ namespace gl { class driver_state { - const u32 DEPTH_BOUNDS = 0xFFFF0001; - const u32 CLIP_PLANES = 0xFFFF0002; - const u32 DEPTH_RANGE = 0xFFFF0004; + const u32 DEPTH_BOUNDS = 0xFFFF0001; + const u32 CLIP_PLANES = 0xFFFF0002; + const u32 DEPTH_RANGE = 0xFFFF0004; const u32 STENCIL_FRONT_FUNC = 0xFFFF0005; - const u32 STENCIL_BACK_FUNC = 0xFFFF0006; - const u32 STENCIL_FRONT_OP = 0xFFFF0007; - const u32 STENCIL_BACK_OP = 0xFFFF0008; - const u32 STENCIL_BACK_MASK = 0xFFFF0009; + const u32 STENCIL_BACK_FUNC = 0xFFFF0006; + const u32 STENCIL_FRONT_OP = 0xFFFF0007; + const u32 STENCIL_BACK_OP = 0xFFFF0008; + const u32 STENCIL_BACK_MASK = 0xFFFF0009; std::unordered_map properties = {}; std::unordered_map> indexed_properties = {}; GLuint current_program = GL_NONE; - std::array, 48> bound_textures{ {} }; + std::array, 48> bound_textures{{}}; bool test_and_set_property(GLenum property, u64 test) { @@ -53,7 +53,6 @@ namespace gl } public: - bool enable(u32 test, GLenum cap) { auto found = properties.find(cap); @@ -213,17 +212,21 @@ namespace gl void color_maski(GLint index, bool r, bool g, bool b, bool a) { u32 mask = 0; - if (r) mask |= 0x10; - if (g) mask |= 0x20; - if (b) mask |= 0x40; - if (a) mask |= 0x80; + if (r) + mask |= 0x10; + if (g) + mask |= 0x20; + if (b) + mask |= 0x40; + if (a) + mask |= 0x80; color_maski(index, mask); } void clear_color(u8 r, u8 g, u8 b, u8 a) { - const u32 value = u32{ r } | u32{ g } << 8 | u32{ b } << 16 | u32{ a } << 24; + const u32 value = u32{r} | u32{g} << 8 | u32{b} << 16 | u32{a} << 24; if (!test_and_set_property(GL_COLOR_CLEAR_VALUE, value)) { glClearColor(r / 255.f, g / 255.f, b / 255.f, a / 255.f); @@ -414,13 +417,16 @@ namespace gl public: command_context() : drv(nullptr) - {} + { + } command_context(driver_state& drv_) : drv(&drv_) - {} + { + } - driver_state* operator -> () { + driver_state* operator->() + { return drv; } }; @@ -434,4 +440,4 @@ namespace gl class fence; void flush_command_queue(fence& fence_obj); -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/sync.hpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/sync.hpp index 4a39bb617..96782a22d 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/sync.hpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/sync.hpp @@ -11,7 +11,6 @@ namespace gl mutable bool signaled = false; public: - fence() = default; ~fence() = default; @@ -126,4 +125,4 @@ namespace gl glWaitSync(m_value, 0, GL_TIMEOUT_IGNORED); } }; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/glutils/vao.hpp b/rpcs3/rpcs3/Emu/RSX/GL/glutils/vao.hpp index 410d874df..6488b47b4 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/glutils/vao.hpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/glutils/vao.hpp @@ -39,9 +39,7 @@ namespace gl public: buffer_pointer(vao* vao, u32 offset = 0, u32 stride = 0) - : m_vao(vao) - , m_offset(offset) - , m_stride(stride) + : m_vao(vao), m_offset(offset), m_stride(stride) { } @@ -110,7 +108,7 @@ namespace gl return m_normalize; } - buffer_pointer& operator >> (u32 value) + buffer_pointer& operator>>(u32 value) { return stride(value); } @@ -125,7 +123,7 @@ namespace gl class vao { - template + template class entry { vao& m_parent; @@ -137,7 +135,7 @@ namespace gl { } - entry& operator = (const buffer& buf) noexcept + entry& operator=(const buffer& buf) noexcept { m_parent.bind(); buf.bind(BindId); @@ -149,10 +147,10 @@ namespace gl GLuint m_id = GL_NONE; public: - entry pixel_pack_buffer{ this }; - entry pixel_unpack_buffer{ this }; - entry array_buffer{ this }; - entry element_array_buffer{ this }; + entry pixel_pack_buffer{this}; + entry pixel_unpack_buffer{this}; + entry array_buffer{this}; + entry element_array_buffer{this}; vao() = default; vao(const vao&) = delete; @@ -179,8 +177,8 @@ namespace gl vao_.set_id(my_old_id); } - vao& operator = (const vao& rhs) = delete; - vao& operator = (vao&& rhs) noexcept + vao& operator=(const vao& rhs) = delete; + vao& operator=(vao&& rhs) noexcept { swap(rhs); return *this; @@ -243,30 +241,30 @@ namespace gl void enable_for_attribute(GLuint index) noexcept { - enable_for_attributes({ index }); + enable_for_attributes({index}); } void disable_for_attribute(GLuint index) noexcept { - disable_for_attributes({ index }); + disable_for_attributes({index}); } - buffer_pointer operator + (u32 offset) noexcept + buffer_pointer operator+(u32 offset) noexcept { - return{ this, offset }; + return {this, offset}; } - buffer_pointer operator >> (u32 stride) noexcept + buffer_pointer operator>>(u32 stride) noexcept { - return{ this, {}, stride }; + return {this, {}, stride}; } operator buffer_pointer() noexcept { - return{ this }; + return {this}; } - attrib_t operator [] (u32 index) const noexcept; + attrib_t operator[](u32 index) const noexcept; }; class attrib_t @@ -284,23 +282,63 @@ namespace gl return m_location; } - void operator = (float rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib1f(location(), rhs); } - void operator = (double rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib1d(location(), rhs); } + void operator=(float rhs) const + { + glDisableVertexAttribArray(location()); + glVertexAttrib1f(location(), rhs); + } + void operator=(double rhs) const + { + glDisableVertexAttribArray(location()); + glVertexAttrib1d(location(), rhs); + } - void operator = (const color1f& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib1f(location(), rhs.r); } - void operator = (const color1d& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib1d(location(), rhs.r); } - void operator = (const color2f& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib2f(location(), rhs.r, rhs.g); } - void operator = (const color2d& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib2d(location(), rhs.r, rhs.g); } - void operator = (const color3f& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib3f(location(), rhs.r, rhs.g, rhs.b); } - void operator = (const color3d& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib3d(location(), rhs.r, rhs.g, rhs.b); } - void operator = (const color4f& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib4f(location(), rhs.r, rhs.g, rhs.b, rhs.a); } - void operator = (const color4d& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib4d(location(), rhs.r, rhs.g, rhs.b, rhs.a); } + void operator=(const color1f& rhs) const + { + glDisableVertexAttribArray(location()); + glVertexAttrib1f(location(), rhs.r); + } + void operator=(const color1d& rhs) const + { + glDisableVertexAttribArray(location()); + glVertexAttrib1d(location(), rhs.r); + } + void operator=(const color2f& rhs) const + { + glDisableVertexAttribArray(location()); + glVertexAttrib2f(location(), rhs.r, rhs.g); + } + void operator=(const color2d& rhs) const + { + glDisableVertexAttribArray(location()); + glVertexAttrib2d(location(), rhs.r, rhs.g); + } + void operator=(const color3f& rhs) const + { + glDisableVertexAttribArray(location()); + glVertexAttrib3f(location(), rhs.r, rhs.g, rhs.b); + } + void operator=(const color3d& rhs) const + { + glDisableVertexAttribArray(location()); + glVertexAttrib3d(location(), rhs.r, rhs.g, rhs.b); + } + void operator=(const color4f& rhs) const + { + glDisableVertexAttribArray(location()); + glVertexAttrib4f(location(), rhs.r, rhs.g, rhs.b, rhs.a); + } + void operator=(const color4d& rhs) const + { + glDisableVertexAttribArray(location()); + glVertexAttrib4d(location(), rhs.r, rhs.g, rhs.b, rhs.a); + } - void operator = (buffer_pointer& pointer) const + void operator=(buffer_pointer& pointer) const { pointer.get_vao().enable_for_attribute(m_location); glVertexAttribPointer(location(), pointer.size(), static_cast(pointer.get_type()), pointer.normalize(), - pointer.stride(), reinterpret_cast(u64{ pointer.offset() })); + pointer.stride(), reinterpret_cast(u64{pointer.offset()})); } }; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/upscalers/fsr1/fsr_pass.cpp b/rpcs3/rpcs3/Emu/RSX/GL/upscalers/fsr1/fsr_pass.cpp index cfd7b1cc0..3f23b082a 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/upscalers/fsr1/fsr_pass.cpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/upscalers/fsr1/fsr_pass.cpp @@ -34,26 +34,25 @@ namespace gl { // Just use AMD-provided source with minimal modification const char* shader_core = - #include "Emu/RSX/Program/Upscalers/FSR1/fsr_ubershader.glsl" +#include "Emu/RSX/Program/Upscalers/FSR1/fsr_ubershader.glsl" ; // Replacements const char* ffx_a_contents = - #include "Emu/RSX/Program/Upscalers/FSR1/fsr_ffx_a_flattened.inc" +#include "Emu/RSX/Program/Upscalers/FSR1/fsr_ffx_a_flattened.inc" ; const char* ffx_fsr_contents = - #include "Emu/RSX/Program/Upscalers/FSR1/fsr_ffx_fsr1_flattened.inc" +#include "Emu/RSX/Program/Upscalers/FSR1/fsr_ffx_fsr1_flattened.inc" ; const std::pair replacement_table[] = - { - { "%FFX_DEFINITIONS%", config_definitions }, - { "%FFX_A_IMPORT%", ffx_a_contents }, - { "%FFX_FSR_IMPORT%", ffx_fsr_contents }, - { "layout(set=0,", "layout(" }, - { "%push_block%", fmt::format("binding=%d, std140", GL_COMPUTE_BUFFER_SLOT(0)) } - }; + { + {"%FFX_DEFINITIONS%", config_definitions}, + {"%FFX_A_IMPORT%", ffx_a_contents}, + {"%FFX_FSR_IMPORT%", ffx_fsr_contents}, + {"layout(set=0,", "layout("}, + {"%push_block%", fmt::format("binding=%d, std140", GL_COMPUTE_BUFFER_SLOT(0))}}; m_src = shader_core; m_src = fmt::replace_all(m_src, replacement_table); @@ -117,13 +116,14 @@ namespace gl easu_pass::easu_pass() : fsr_pass( - "#define SAMPLE_EASU 1\n" - "#define SAMPLE_RCAS 0\n" - "#define SAMPLE_BILINEAR 0\n" - "#define SAMPLE_SLOW_FALLBACK 1", - 80 // 5*VEC4 - ) - {} + "#define SAMPLE_EASU 1\n" + "#define SAMPLE_RCAS 0\n" + "#define SAMPLE_BILINEAR 0\n" + "#define SAMPLE_SLOW_FALLBACK 1", + 80 // 5*VEC4 + ) + { + } void easu_pass::configure() { @@ -134,20 +134,21 @@ namespace gl auto con3 = &m_constants_buf[12]; FsrEasuCon(con0, con1, con2, con3, - static_cast(m_input_size.width), static_cast(m_input_size.height), // Incoming viewport size to upscale (actual size) - static_cast(m_input_image->width()), static_cast(m_input_image->height()), // Size of the raw image to upscale (in case viewport does not cover it all) - static_cast(m_output_size.width), static_cast(m_output_size.height)); // Size of output viewport (target size) + static_cast(m_input_size.width), static_cast(m_input_size.height), // Incoming viewport size to upscale (actual size) + static_cast(m_input_image->width()), static_cast(m_input_image->height()), // Size of the raw image to upscale (in case viewport does not cover it all) + static_cast(m_output_size.width), static_cast(m_output_size.height)); // Size of output viewport (target size) } rcas_pass::rcas_pass() : fsr_pass( - "#define SAMPLE_RCAS 1\n" - "#define SAMPLE_EASU 0\n" - "#define SAMPLE_BILINEAR 0\n" - "#define SAMPLE_SLOW_FALLBACK 1", - 32 // 2*VEC4 - ) - {} + "#define SAMPLE_RCAS 1\n" + "#define SAMPLE_EASU 0\n" + "#define SAMPLE_BILINEAR 0\n" + "#define SAMPLE_SLOW_FALLBACK 1", + 32 // 2*VEC4 + ) + { + } void rcas_pass::configure() { @@ -155,7 +156,7 @@ namespace gl auto cas_attenuation = 2.f - (g_cfg.video.vk.rcas_sharpening_intensity / 50.f); FsrRcasCon(&m_constants_buf[0], cas_attenuation); } - } + } // namespace FidelityFX fsr_upscale_pass::~fsr_upscale_pass() { @@ -258,4 +259,4 @@ namespace gl return src_image; } -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/upscalers/fsr_pass.h b/rpcs3/rpcs3/Emu/RSX/GL/upscalers/fsr_pass.h index 1d1975923..84437682a 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/upscalers/fsr_pass.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/upscalers/fsr_pass.h @@ -47,7 +47,7 @@ namespace gl public: rcas_pass(); }; - } + } // namespace FidelityFX class fsr_upscale_pass : public upscaler { @@ -56,12 +56,12 @@ namespace gl ~fsr_upscale_pass(); gl::texture* scale_output( - gl::command_context& cmd, // State - gl::texture* src, // Source input - const areai& src_region, // Scaling request information - const areai& dst_region, // Ditto - gl::flags32_t mode // Mode - ) override; + gl::command_context& cmd, // State + gl::texture* src, // Source input + const areai& src_region, // Scaling request information + const areai& dst_region, // Ditto + gl::flags32_t mode // Mode + ) override; private: std::unique_ptr m_output_left; @@ -73,4 +73,4 @@ namespace gl void dispose_images(); void initialize_image(u32 output_w, u32 output_h, rsx::flags32_t mode); }; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/upscalers/static_pass.hpp b/rpcs3/rpcs3/Emu/RSX/GL/upscalers/static_pass.hpp index 336b145d8..dd954f101 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/upscalers/static_pass.hpp +++ b/rpcs3/rpcs3/Emu/RSX/GL/upscalers/static_pass.hpp @@ -6,7 +6,7 @@ namespace gl { - template + template class static_upscale_pass : public upscaler { public: @@ -20,12 +20,12 @@ namespace gl } gl::texture* scale_output( - gl::command_context& /*cmd*/, // State - gl::texture* src, // Source input - const areai& src_region, // Scaling request information - const areai& dst_region, // Ditto - gl::flags32_t mode // Mode - ) override + gl::command_context& /*cmd*/, // State + gl::texture* src, // Source input + const areai& src_region, // Scaling request information + const areai& dst_region, // Ditto + gl::flags32_t mode // Mode + ) override { if (mode & UPSCALE_AND_COMMIT) { @@ -45,4 +45,4 @@ namespace gl private: gl::fbo m_flip_fbo; }; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GL/upscalers/upscaling.h b/rpcs3/rpcs3/Emu/RSX/GL/upscalers/upscaling.h index 9c8eec643..f4845e7d5 100644 --- a/rpcs3/rpcs3/Emu/RSX/GL/upscalers/upscaling.h +++ b/rpcs3/rpcs3/Emu/RSX/GL/upscalers/upscaling.h @@ -23,11 +23,11 @@ namespace gl virtual ~upscaler() {} virtual gl::texture* scale_output( - gl::command_context& cmd, // State - gl::texture* src, // Source input - const areai& src_region, // Scaling request information - const areai& dst_region, // Ditto - gl::flags32_t mode // Mode - ) = 0; + gl::command_context& cmd, // State + gl::texture* src, // Source input + const areai& src_region, // Scaling request information + const areai& dst_region, // Ditto + gl::flags32_t mode // Mode + ) = 0; }; -} +} // namespace gl diff --git a/rpcs3/rpcs3/Emu/RSX/GSRender.h b/rpcs3/rpcs3/Emu/RSX/GSRender.h index d2a6fd9c5..b3da8e6b5 100644 --- a/rpcs3/rpcs3/Emu/RSX/GSRender.h +++ b/rpcs3/rpcs3/Emu/RSX/GSRender.h @@ -28,7 +28,10 @@ public: GSRender(utils::serial* ar) noexcept; - void set_continuous_mode(bool continuous_mode) { m_continuous_mode = continuous_mode; } + void set_continuous_mode(bool continuous_mode) + { + m_continuous_mode = continuous_mode; + } void on_init_thread() override; void on_exit() override; @@ -36,5 +39,8 @@ public: void flip(const rsx::display_flip_info_t& info) override; f64 get_display_refresh_rate() const override; - GSFrameBase* get_frame() const { return m_frame; } + GSFrameBase* get_frame() const + { + return m_frame; + } }; diff --git a/rpcs3/rpcs3/Emu/RSX/Host/MM.cpp b/rpcs3/rpcs3/Emu/RSX/Host/MM.cpp index cf21b6e04..0b6019d27 100644 --- a/rpcs3/rpcs3/Emu/RSX/Host/MM.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Host/MM.cpp @@ -28,7 +28,7 @@ namespace rsx { // We could stack and merge requests here, but that is more trouble than it is truly worth. // A fresh call to memory_protect only takes a few nanoseconds of setup overhead, it is not worth the risk of hanging because of conflicts. - g_deferred_mprotect_queue.push_back({ start, length, prot }); + g_deferred_mprotect_queue.push_back({start, length, prot}); } void mm_protect(void* ptr, u64 length, utils::protection prot) @@ -107,4 +107,4 @@ namespace rsx auto& rsxdma = g_fxo->get(); rsxdma.backend_ctrl(mm_backend_ctrl::cmd_mm_flush, nullptr); } -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Host/MM.h b/rpcs3/rpcs3/Emu/RSX/Host/MM.h index e9415a685..e39d5bce1 100644 --- a/rpcs3/rpcs3/Emu/RSX/Host/MM.h +++ b/rpcs3/rpcs3/Emu/RSX/Host/MM.h @@ -37,4 +37,4 @@ namespace rsx void mm_flush_lazy(); void mm_flush(u32 vm_address); void mm_flush(); -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Host/RSXDMAWriter.cpp b/rpcs3/rpcs3/Emu/RSX/Host/RSXDMAWriter.cpp index d86b03712..d5c4d2c58 100644 --- a/rpcs3/rpcs3/Emu/RSX/Host/RSXDMAWriter.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Host/RSXDMAWriter.cpp @@ -64,4 +64,4 @@ namespace rsx } } } -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/Host/RSXDMAWriter.h b/rpcs3/rpcs3/Emu/RSX/Host/RSXDMAWriter.h index aeae34080..8fdc5b9df 100644 --- a/rpcs3/rpcs3/Emu/RSX/Host/RSXDMAWriter.h +++ b/rpcs3/rpcs3/Emu/RSX/Host/RSXDMAWriter.h @@ -86,12 +86,14 @@ namespace rsx { public: RSXDMAWriter(void* mem) - : m_host_context_ptr(new (mem)host_gpu_context_t) - {} + : m_host_context_ptr(new(mem) host_gpu_context_t) + { + } RSXDMAWriter(host_gpu_context_t* pctx) : m_host_context_ptr(pctx) - {} + { + } void update(); @@ -112,4 +114,4 @@ namespace rsx std::deque m_job_queue; }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/FW/GRAPH_backend.h b/rpcs3/rpcs3/Emu/RSX/NV47/FW/GRAPH_backend.h index 21c78cdaa..dc272b529 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/FW/GRAPH_backend.h +++ b/rpcs3/rpcs3/Emu/RSX/NV47/FW/GRAPH_backend.h @@ -16,4 +16,4 @@ namespace rsx // Patch transform constants. Units are in 32x4 units virtual void patch_transform_constants(context* /*ctx*/, u32 /*index*/, u32 /*count*/) {}; }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/FW/draw_call.cpp b/rpcs3/rpcs3/Emu/RSX/NV47/FW/draw_call.cpp index 640db9c76..bda78ef18 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/FW/draw_call.cpp +++ b/rpcs3/rpcs3/Emu/RSX/NV47/FW/draw_call.cpp @@ -50,16 +50,14 @@ namespace rsx const auto& last = draw_command_ranges[current_range_index]; const auto address = last.first + last.count; - _do_barrier_insert({ - .draw_id = current_range_index, + _do_barrier_insert({.draw_id = current_range_index, .timestamp = 0, .address = address, .index = index, .arg0 = arg0, .arg1 = arg1, .flags = 0, - .type = type - }); + .type = type}); } else { @@ -74,16 +72,14 @@ namespace rsx current_range_index = draw_command_ranges.size() - 1; } - _do_barrier_insert({ - .draw_id = current_range_index, + _do_barrier_insert({.draw_id = current_range_index, .timestamp = rsx::get_shared_tag(), .address = ~0u, .index = index, .arg0 = arg0, .arg1 = arg1, .flags = 0, - .type = type - }); + .type = type}); last_execution_barrier_index = current_range_index; } @@ -222,5 +218,4 @@ namespace rsx return result; } -} - +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/FW/draw_call.hpp b/rpcs3/rpcs3/Emu/RSX/NV47/FW/draw_call.hpp index 4e350e985..a9fec9e7f 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/FW/draw_call.hpp +++ b/rpcs3/rpcs3/Emu/RSX/NV47/FW/draw_call.hpp @@ -65,11 +65,11 @@ namespace rsx primitive_type primitive{}; draw_command command{}; - bool is_immediate_draw{}; // Set if part of the draw is submitted via push registers - bool is_disjoint_primitive{}; // Set if primitive type does not rely on adjacency information - bool primitive_barrier_enable{}; // Set once to signal that a primitive restart barrier can be inserted - bool is_rendering{}; // Set while we're actually pushing the draw calls to host GPU - bool is_trivial_instanced_draw{}; // Set if the draw call can be executed on the host GPU as a single instanced draw. + bool is_immediate_draw{}; // Set if part of the draw is submitted via push registers + bool is_disjoint_primitive{}; // Set if primitive type does not rely on adjacency information + bool primitive_barrier_enable{}; // Set once to signal that a primitive restart barrier can be inserted + bool is_rendering{}; // Set while we're actually pushing the draw calls to host GPU + bool is_trivial_instanced_draw{}; // Set if the draw call can be executed on the host GPU as a single instanced draw. simple_array inline_vertex_array{}; @@ -133,13 +133,13 @@ namespace rsx if (draw_command_ranges[index].first > first) { - insert_draw_command(index, { 0, first, count }); + insert_draw_command(index, {0, first, count}); return; } } } - append_draw_command({ 0, first, count }); + append_draw_command({0, first, count}); } /** @@ -217,9 +217,7 @@ namespace rsx primitive_class classify_mode() const { - return primitive >= rsx::primitive_type::triangles - ? primitive_class::polygon - : primitive_class::non_polygon; + return primitive >= rsx::primitive_type::triangles ? primitive_class::polygon : primitive_class::non_polygon; } void reset(rsx::primitive_type type); @@ -314,16 +312,16 @@ namespace rsx break; const u32 count = barrier.address - previous_barrier; - ret.push_back({ 0, vertex_counter, count }); + ret.push_back({0, vertex_counter, count}); previous_barrier = barrier.address; vertex_counter += count; } ensure(!ret.empty()); ensure(previous_barrier < limit); - ret.push_back({ 0, vertex_counter, limit - previous_barrier }); + ret.push_back({0, vertex_counter, limit - previous_barrier}); return ret; } }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/FW/draw_call.inc.h b/rpcs3/rpcs3/Emu/RSX/NV47/FW/draw_call.inc.h index 9332a21c1..5de4d81cc 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/FW/draw_call.inc.h +++ b/rpcs3/rpcs3/Emu/RSX/NV47/FW/draw_call.inc.h @@ -48,7 +48,7 @@ namespace rsx u32 flags; command_barrier_type type; - bool operator < (const barrier_t& other) const + bool operator<(const barrier_t& other) const { if (address != ~0u) { @@ -69,4 +69,4 @@ namespace rsx ENABLE_BITWISE_SERIALIZATION; }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/FW/reg_context.h b/rpcs3/rpcs3/Emu/RSX/NV47/FW/reg_context.h index 8f0477022..a85623ffa 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/FW/reg_context.h +++ b/rpcs3/rpcs3/Emu/RSX/NV47/FW/reg_context.h @@ -9,4 +9,4 @@ namespace rsx { u32 registers[1]; }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/common.cpp b/rpcs3/rpcs3/Emu/RSX/NV47/HW/common.cpp index 45e7b001a..a04d300d0 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/common.cpp +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/common.cpp @@ -97,5 +97,5 @@ namespace rsx RSX(ctx)->m_graphics_state |= rsx::pipeline_state::vertex_program_state_dirty; } } - } -} + } // namespace util +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/common.h b/rpcs3/rpcs3/Emu/RSX/NV47/HW/common.h index 881985c08..b88ca23e2 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/common.h +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/common.h @@ -20,7 +20,7 @@ namespace rsx void set_fragment_texture_dirty_bit(rsx::context* ctx, u32 arg, u32 index); void set_vertex_texture_dirty_bit(rsx::context* ctx, u32 index); - } -} - + } // namespace util +} // namespace rsx + #include "context_accessors.undef.h" diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/context.h b/rpcs3/rpcs3/Emu/RSX/NV47/HW/context.h index 761ad2be5..67a565610 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/context.h +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/context.h @@ -28,4 +28,4 @@ namespace rsx // GRAPH_context* graph; rsx_state* register_state; }; -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/context_accessors.define.h b/rpcs3/rpcs3/Emu/RSX/NV47/HW/context_accessors.define.h index b423f11cd..3654c8865 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/context_accessors.define.h +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/context_accessors.define.h @@ -1,3 +1,7 @@ #define RSX(ctx) ctx->rsxthr #define REGS(ctx) ctx->register_state -#define RSX_CAPTURE_EVENT(name) if (RSX(ctx)->capture_current_frame) { RSX(ctx)->capture_frame(name); } +#define RSX_CAPTURE_EVENT(name) \ + if (RSX(ctx)->capture_current_frame) \ + { \ + RSX(ctx)->capture_frame(name); \ + } diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv0039.cpp b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv0039.cpp index fb20d93a6..a87964f61 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv0039.cpp +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv0039.cpp @@ -57,18 +57,18 @@ namespace rsx auto res = ::rsx::reservation_lock(write_address, write_length, read_address, read_length); - u8 *dst = vm::_ptr(write_address); - const u8 *src = vm::_ptr(read_address); + u8* dst = vm::_ptr(write_address); + const u8* src = vm::_ptr(read_address); const bool is_overlapping = dst_dma == src_dma && [&]() -> bool { const u32 src_max = src_offset + read_length; const u32 dst_max = dst_offset + (out_pitch * (line_count - 1) + line_length); return (src_offset >= dst_offset && src_offset < dst_max) || - (dst_offset >= src_offset && dst_offset < src_max); + (dst_offset >= src_offset && dst_offset < src_max); }(); - if (in_format > 1 || out_format > 1) [[ unlikely ]] + if (in_format > 1 || out_format > 1) [[unlikely]] { // The formats are just input channel strides. You can use this to do cool tricks like gathering channels // Very rare, only seen in use by Destiny @@ -89,7 +89,7 @@ namespace rsx src += in_pitch; } } - else if (is_overlapping) [[ unlikely ]] + else if (is_overlapping) [[unlikely]] { if (is_block_transfer) { @@ -134,7 +134,7 @@ namespace rsx } } - //res->release(0); + // res->release(0); } - } -} + } // namespace nv0039 +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv0039.h b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv0039.h index 9168f76ed..b04c755bf 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv0039.h +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv0039.h @@ -9,4 +9,4 @@ namespace rsx { void buffer_notify(context* ctx, u32 reg, u32 arg); } -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv3089.cpp b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv3089.cpp index 1082ae41b..bdcecb292 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv3089.cpp +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv3089.cpp @@ -41,7 +41,7 @@ namespace rsx if (clip_w == 0 || clip_h == 0) { rsx_log.warning("NV3089_IMAGE_IN: Operation NOPed out due to empty regions"); - return { false, src_info, dst_info }; + return {false, src_info, dst_info}; } if (in_w == 0 || in_h == 0) @@ -53,9 +53,11 @@ namespace rsx u16 clip_x = REGS(ctx)->blit_engine_clip_x(); u16 clip_y = REGS(ctx)->blit_engine_clip_y(); - //Fit onto dst - if (clip_x && (out_x + clip_x + clip_w) > out_w) clip_x = 0; - if (clip_y && (out_y + clip_y + clip_h) > out_h) clip_y = 0; + // Fit onto dst + if (clip_x && (out_x + clip_x + clip_w) > out_w) + clip_x = 0; + if (clip_y && (out_y + clip_y + clip_h) > out_h) + clip_y = 0; u16 in_pitch = REGS(ctx)->blit_engine_input_pitch(); @@ -72,14 +74,14 @@ namespace rsx { rsx_log.error("NV3089_IMAGE_IN_SIZE: unknown operation (0x%x)", REGS(ctx)->registers[NV3089_SET_OPERATION]); RSX(ctx)->recover_fifo(); - return { false, src_info, dst_info }; + return {false, src_info, dst_info}; } if (!src_color_format) { rsx_log.error("NV3089_IMAGE_IN_SIZE: unknown src color format (0x%x)", REGS(ctx)->registers[NV3089_SET_COLOR_FORMAT]); RSX(ctx)->recover_fifo(); - return { false, src_info, dst_info }; + return {false, src_info, dst_info}; } const u32 src_offset = REGS(ctx)->blit_engine_input_offset(); @@ -106,7 +108,7 @@ namespace rsx { rsx_log.error("NV3089_IMAGE_IN_SIZE: unknown NV3062 dst color format (0x%x)", REGS(ctx)->registers[NV3062_SET_COLOR_FORMAT]); RSX(ctx)->recover_fifo(); - return { false, src_info, dst_info }; + return {false, src_info, dst_info}; } else { @@ -124,7 +126,7 @@ namespace rsx { rsx_log.error("NV3089_IMAGE_IN_SIZE: unknown NV309E dst color format (0x%x)", REGS(ctx)->registers[NV309E_SET_FORMAT]); RSX(ctx)->recover_fifo(); - return { false, src_info, dst_info }; + return {false, src_info, dst_info}; } else { @@ -135,7 +137,7 @@ namespace rsx } default: rsx_log.error("NV3089_IMAGE_IN_SIZE: unknown m_context_surface (0x%x)", static_cast(REGS(ctx)->blit_engine_context_surface())); - return { false, src_info, dst_info }; + return {false, src_info, dst_info}; } const u32 in_bpp = (src_color_format == rsx::blit_engine::transfer_source_format::r5g6b5) ? 2 : 4; // bytes per pixel @@ -201,7 +203,7 @@ namespace rsx !src_address || !dst_address) { RSX(ctx)->recover_fifo(); - return { false, src_info, dst_info }; + return {false, src_info, dst_info}; } RSX(ctx)->invalidate_fragment_program(dst_dma, dst_offset, data_length); @@ -212,7 +214,7 @@ namespace rsx if (RSX(ctx)->copy_zcull_stats(src_address, data_length, dst_address) == data_length) { // All writes deferred - return { false, src_info, dst_info }; + return {false, src_info, dst_info}; } } } @@ -225,7 +227,7 @@ namespace rsx !src_address || !dst_address) { RSX(ctx)->recover_fifo(); - return { false, src_info, dst_info }; + return {false, src_info, dst_info}; } RSX(ctx)->invalidate_fragment_program(dst_dma, dst_offset, data_length); @@ -239,7 +241,7 @@ namespace rsx { // NULL operation rsx_log.warning("NV3089_IMAGE_IN: Operation writes memory onto itself with no modification (move-to-self). Will ignore."); - return { false, src_info, dst_info }; + return {false, src_info, dst_info}; } u8* pixels_src = vm::_ptr(src_address + in_offset); @@ -273,7 +275,7 @@ namespace rsx { rsx_log.error("NV3089_IMAGE_IN: Invalid dimensions or scaling factor. Request ignored (ds_dx=%f, dt_dy=%f)", REGS(ctx)->blit_engine_ds_dx(), REGS(ctx)->blit_engine_dt_dy()); - return { false, src_info, dst_info }; + return {false, src_info, dst_info}; } src_info.format = src_color_format; @@ -306,7 +308,7 @@ namespace rsx dst_info.pixels = pixels_dst; dst_info.swizzled = (REGS(ctx)->blit_engine_context_surface() == blit_engine::context_surface::swizzle2d); - return { true, src_info, dst_info }; + return {true, src_info, dst_info}; } void linear_copy( @@ -324,7 +326,7 @@ namespace rsx { std::vector temp2; - if (!need_convert) [[ likely ]] + if (!need_convert) [[likely]] { const bool is_overlapping = !src_is_modified && dst.dma == src.dma && [&]() -> bool { @@ -333,71 +335,71 @@ namespace rsx return src_range.overlaps(dst_range); }(); - if (is_overlapping) [[ unlikely ]] + if (is_overlapping) [[unlikely]] + { + if (need_clip) { - if (need_clip) - { - temp2.resize(dst.pitch * dst.clip_height); - clip_image_may_overlap(dst.pixels, src.pixels, dst.clip_x, dst.clip_y, dst.clip_width, dst.clip_height, dst.bpp, src.pitch, dst.pitch, temp2.data()); - return; - } - - if (dst.pitch != src.pitch || dst.pitch != dst.bpp * out_w) - { - const u32 buffer_pitch = dst.bpp * out_w; - temp2.resize(buffer_pitch * out_h); - std::add_pointer_t buf = temp2.data(), pixels = src.pixels; - - // Read the whole buffer from source - for (u32 y = 0; y < out_h; ++y) - { - std::memcpy(buf, pixels, buffer_pitch); - pixels += src.pitch; - buf += buffer_pitch; - } - - buf = temp2.data(), pixels = dst.pixels; - - // Write to destination - for (u32 y = 0; y < out_h; ++y) - { - std::memcpy(pixels, buf, buffer_pitch); - pixels += dst.pitch; - buf += buffer_pitch; - } - - return; - } - - std::memmove(dst.pixels, src.pixels, dst.pitch * out_h); + temp2.resize(dst.pitch * dst.clip_height); + clip_image_may_overlap(dst.pixels, src.pixels, dst.clip_x, dst.clip_y, dst.clip_width, dst.clip_height, dst.bpp, src.pitch, dst.pitch, temp2.data()); return; } - if (need_clip) [[ unlikely ]] + if (dst.pitch != src.pitch || dst.pitch != dst.bpp * out_w) { - clip_image(dst.pixels, src.pixels, dst.clip_x, dst.clip_y, dst.clip_width, dst.clip_height, dst.bpp, src.pitch, dst.pitch); - return; - } - - if (dst.pitch != src.pitch || dst.pitch != dst.bpp * out_w) [[ unlikely ]] - { - u8* dst_pixels = dst.pixels, * src_pixels = src.pixels; + const u32 buffer_pitch = dst.bpp * out_w; + temp2.resize(buffer_pitch * out_h); + std::add_pointer_t buf = temp2.data(), pixels = src.pixels; + // Read the whole buffer from source for (u32 y = 0; y < out_h; ++y) { - std::memcpy(dst_pixels, src_pixels, out_w * dst.bpp); - dst_pixels += dst.pitch; - src_pixels += src.pitch; + std::memcpy(buf, pixels, buffer_pitch); + pixels += src.pitch; + buf += buffer_pitch; + } + + buf = temp2.data(), pixels = dst.pixels; + + // Write to destination + for (u32 y = 0; y < out_h; ++y) + { + std::memcpy(pixels, buf, buffer_pitch); + pixels += dst.pitch; + buf += buffer_pitch; } return; } - std::memcpy(dst.pixels, src.pixels, dst.pitch * out_h); + std::memmove(dst.pixels, src.pixels, dst.pitch * out_h); return; + } + + if (need_clip) [[unlikely]] + { + clip_image(dst.pixels, src.pixels, dst.clip_x, dst.clip_y, dst.clip_width, dst.clip_height, dst.bpp, src.pitch, dst.pitch); + return; + } + + if (dst.pitch != src.pitch || dst.pitch != dst.bpp * out_w) [[unlikely]] + { + u8 *dst_pixels = dst.pixels, *src_pixels = src.pixels; + + for (u32 y = 0; y < out_h; ++y) + { + std::memcpy(dst_pixels, src_pixels, out_w * dst.bpp); + dst_pixels += dst.pitch; + src_pixels += src.pitch; + } + + return; + } + + std::memcpy(dst.pixels, src.pixels, dst.pitch * out_h); + return; } - if (need_clip) [[ unlikely ]] + if (need_clip) [[unlikely]] { temp2.resize(dst.pitch * std::max(dst.height, dst.clip_height)); @@ -544,7 +546,7 @@ namespace rsx if (flip_x) { - if (src.bpp == 4) [[ likely ]] + if (src.bpp == 4) [[likely]] { rsx::memcpy_r(dst_pixels, src_pixels, src.width); continue; @@ -646,9 +648,7 @@ namespace rsx if (tiled_region) { - const auto tile_func = dst.bpp == 4 - ? rsx::tile_texel_data32 - : rsx::tile_texel_data16; + const auto tile_func = dst.bpp == 4 ? rsx::tile_texel_data32 : rsx::tile_texel_data16; tile_func( real_dst, @@ -659,9 +659,8 @@ namespace rsx tiled_region.tile->bank, tiled_region.tile->pitch, dst.clip_width, - dst.clip_height - ); + dst.clip_height); } } - } -} + } // namespace nv3089 +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv3089.h b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv3089.h index 89b526b9d..fb68466bb 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv3089.h +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv3089.h @@ -9,4 +9,4 @@ namespace rsx { void image_in(context* ctx, u32 reg, u32 arg); } -} +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv308a.cpp b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv308a.cpp index 163ddb9a4..9b0b8acf4 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv308a.cpp +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv308a.cpp @@ -33,7 +33,7 @@ namespace rsx // Get limit imposed by FIFO PUT (if put is behind get it will result in a number ignored by min) const u32 fifo_read_limit = static_cast(((RSX(ctx)->ctrl->put & ~3ull) - (RSX(ctx)->fifo_ctrl->get_pos())) / 4); - u32 count = std::min({ fifo_args_cnt, fifo_read_limit, method_range }); + u32 count = std::min({fifo_args_cnt, fifo_read_limit, method_range}); if (!count) { @@ -89,11 +89,11 @@ namespace rsx rsx::reservation_lock rsx_lock(dst_address, data_length); if (RSX(ctx)->fifo_ctrl->last_cmd() & RSX_METHOD_NON_INCREMENT_CMD_MASK) [[unlikely]] - { - // Move last 32 bits - reinterpret_cast(dst)[0] = reinterpret_cast(src)[count - 1]; - RSX(ctx)->invalidate_fragment_program(dst_dma, dst_offset, 4); - } + { + // Move last 32 bits + reinterpret_cast(dst)[0] = reinterpret_cast(src)[count - 1]; + RSX(ctx)->invalidate_fragment_program(dst_dma, dst_offset, 4); + } else { if (dst_dma & CELL_GCM_LOCATION_MAIN) @@ -129,33 +129,33 @@ namespace rsx rsx::reservation_lock rsx_lock(dst_address, data_length); auto convert = [](u32 input) -> u16 - { - // Input is considered to be ARGB8 - u32 r = (input >> 16) & 0xFF; - u32 g = (input >> 8) & 0xFF; - u32 b = input & 0xFF; + { + // Input is considered to be ARGB8 + u32 r = (input >> 16) & 0xFF; + u32 g = (input >> 8) & 0xFF; + u32 b = input & 0xFF; - r = (r * 32) / 255; - g = (g * 64) / 255; - b = (b * 32) / 255; - return static_cast((r << 11) | (g << 5) | b); - }; + r = (r * 32) / 255; + g = (g * 64) / 255; + b = (b * 32) / 255; + return static_cast((r << 11) | (g << 5) | b); + }; if (RSX(ctx)->fifo_ctrl->last_cmd() & RSX_METHOD_NON_INCREMENT_CMD_MASK) [[unlikely]] - { - // Move last 16 bits - dst[0] = convert(src[count - 1]); - RSX(ctx)->invalidate_fragment_program(dst_dma, dst_offset, 2); - break; - } - - for (u32 i = 0; i < count; i++) - { - dst[i] = convert(src[i]); - } - - RSX(ctx)->invalidate_fragment_program(dst_dma, dst_offset, count * 2); + { + // Move last 16 bits + dst[0] = convert(src[count - 1]); + RSX(ctx)->invalidate_fragment_program(dst_dma, dst_offset, 2); break; + } + + for (u32 i = 0; i < count; i++) + { + dst[i] = convert(src[i]); + } + + RSX(ctx)->invalidate_fragment_program(dst_dma, dst_offset, count * 2); + break; } default: { @@ -163,5 +163,5 @@ namespace rsx } } } - } -} + } // namespace nv308a +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv308a.h b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv308a.h index 5b14e6d3a..810f8abbe 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv308a.h +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv308a.h @@ -11,5 +11,5 @@ namespace rsx { static void impl(context* ctx, u32 reg, u32 arg); }; - } -} + } // namespace nv308a +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv406e.cpp b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv406e.cpp index 92e3b1af5..276657093 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv406e.cpp +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv406e.cpp @@ -124,5 +124,5 @@ namespace rsx util::write_gcm_label(ctx, addr, arg); } - } -} + } // namespace nv406e +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv406e.h b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv406e.h index 4fd7200f3..2fc531b74 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv406e.h +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv406e.h @@ -12,5 +12,5 @@ namespace rsx void semaphore_acquire(context* ctx, u32 reg, u32 arg); void semaphore_release(context* ctx, u32 reg, u32 arg); - } -} + } // namespace nv406e +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv4097.cpp b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv4097.cpp index eeb52a224..2eb73b15d 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv4097.cpp +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv4097.cpp @@ -7,7 +7,11 @@ #define RSX(ctx) ctx->rsxthr #define REGS(ctx) (&rsx::method_registers) -#define RSX_CAPTURE_EVENT(name) if (RSX(ctx)->capture_current_frame) { RSX(ctx)->capture_frame(name); } +#define RSX_CAPTURE_EVENT(name) \ + if (RSX(ctx)->capture_current_frame) \ + { \ + RSX(ctx)->capture_frame(name); \ + } namespace rsx { @@ -66,7 +70,7 @@ namespace rsx // Get limit imposed by FIFO PUT (if put is behind get it will result in a number ignored by min) const u32 fifo_read_limit = static_cast(((RSX(ctx)->ctrl->put & ~3ull) - (RSX(ctx)->fifo_ctrl->get_pos())) / 4); - const u32 count = std::min({ fifo_args_cnt, fifo_read_limit, method_range }); + const u32 count = std::min({fifo_args_cnt, fifo_read_limit, method_range}); const u32 load = REGS(ctx)->transform_constant_load(); @@ -97,8 +101,7 @@ namespace rsx rsx::transform_constant_update_barrier, RSX(ctx)->fifo_ctrl->get_pos(), rcount, - reg - NV4097_SET_TRANSFORM_CONSTANT - ); + reg - NV4097_SET_TRANSFORM_CONSTANT); RSX(ctx)->fifo_ctrl->skip_methods(rcount - 1); return; @@ -143,7 +146,7 @@ namespace rsx // Get limit imposed by FIFO PUT (if put is behind get it will result in a number ignored by min) const u32 fifo_read_limit = static_cast(((RSX(ctx)->ctrl->put & ~3ull) - (RSX(ctx)->fifo_ctrl->get_pos())) / 4); - const u32 count = std::min({ fifo_args_cnt, fifo_read_limit, method_range }); + const u32 count = std::min({fifo_args_cnt, fifo_read_limit, method_range}); const u32 load_pos = REGS(ctx)->transform_program_load(); @@ -275,7 +278,7 @@ namespace rsx return; } - if (REGS(ctx)->decode(arg).is_invalid()) [[ unlikely ]] + if (REGS(ctx)->decode(arg).is_invalid()) [[unlikely]] { // Rollback REGS(ctx)->decode(reg, REGS(ctx)->latch); @@ -292,7 +295,7 @@ namespace rsx return; } - if (to_stencil_op(arg)) [[ likely ]] + if (to_stencil_op(arg)) [[likely]] { set_surface_options_dirty_bit(ctx, reg, arg); return; @@ -482,14 +485,17 @@ namespace rsx switch (reg) { case NV4097_SET_CULL_FACE: - valid = !!to_cull_face(arg); break; + valid = !!to_cull_face(arg); + break; case NV4097_SET_FRONT_FACE: - valid = !!to_front_face(arg); break; + valid = !!to_front_face(arg); + break; default: - valid = false; break; + valid = false; + break; } - if (valid) [[ likely ]] + if (valid) [[likely]] { RSX(ctx)->m_graphics_state |= rsx::pipeline_config_dirty; } @@ -507,7 +513,7 @@ namespace rsx } if (to_blend_equation(arg & 0xFFFF) && - to_blend_equation((arg >> 16) & 0xFFFF)) [[ likely ]] + to_blend_equation((arg >> 16) & 0xFFFF)) [[likely]] { RSX(ctx)->m_graphics_state |= rsx::pipeline_config_dirty; return; @@ -525,7 +531,7 @@ namespace rsx } if (to_blend_factor(arg & 0xFFFF) && - to_blend_factor((arg >> 16) & 0xFFFF)) [[ likely ]] + to_blend_factor((arg >> 16) & 0xFFFF)) [[likely]] { RSX(ctx)->m_graphics_state |= rsx::pipeline_config_dirty; return; @@ -567,10 +573,10 @@ namespace rsx rsx_log.error("NV4097_GET_REPORT: Bad type %d", type); vm::_ref>(address_ptr).atomic_op([&](CellGcmReportData& data) - { - data.timer = RSX(ctx)->timestamp(); - data.padding = 0; - }); + { + data.timer = RSX(ctx)->timestamp(); + data.padding = 0; + }); break; } } @@ -652,10 +658,8 @@ namespace rsx ensure(addr != umax); vm::_ref>(addr).store( - { - RSX(ctx)->timestamp(), - 0 - }); + {RSX(ctx)->timestamp(), + 0}); } void texture_read_semaphore_release(context* ctx, u32 /*reg*/, u32 arg) @@ -681,7 +685,7 @@ namespace rsx rsx_log.error("NV4097 semaphore unexpected address. Please report to the developers. (offset=0x%x, addr=0x%x)", offset, addr); } - if (g_cfg.video.strict_rendering_mode) [[ unlikely ]] + if (g_cfg.video.strict_rendering_mode) [[unlikely]] { util::write_gcm_label(ctx, addr, arg); } @@ -719,5 +723,5 @@ namespace rsx { RSX(ctx)->sync(); } - } -} + } // namespace nv4097 +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv4097.h b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv4097.h index db736396b..58bbbc65a 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv4097.h +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv4097.h @@ -14,12 +14,33 @@ namespace rsx namespace nv4097 { - template struct vertex_data_type_from_element_type; - template<> struct vertex_data_type_from_element_type { static const vertex_base_type type = vertex_base_type::f; }; - template<> struct vertex_data_type_from_element_type { static const vertex_base_type type = vertex_base_type::sf; }; - template<> struct vertex_data_type_from_element_type { static const vertex_base_type type = vertex_base_type::ub; }; - template<> struct vertex_data_type_from_element_type { static const vertex_base_type type = vertex_base_type::s32k; }; - template<> struct vertex_data_type_from_element_type { static const vertex_base_type type = vertex_base_type::s1; }; + template + struct vertex_data_type_from_element_type; + template <> + struct vertex_data_type_from_element_type + { + static const vertex_base_type type = vertex_base_type::f; + }; + template <> + struct vertex_data_type_from_element_type + { + static const vertex_base_type type = vertex_base_type::sf; + }; + template <> + struct vertex_data_type_from_element_type + { + static const vertex_base_type type = vertex_base_type::ub; + }; + template <> + struct vertex_data_type_from_element_type + { + static const vertex_base_type type = vertex_base_type::s32k; + }; + template <> + struct vertex_data_type_from_element_type + { + static const vertex_base_type type = vertex_base_type::s1; + }; void clear(context* ctx, u32 reg, u32 arg); @@ -91,12 +112,12 @@ namespace rsx #define REGS(ctx) (&rsx::method_registers) /** - * id = base method register - * index = register index in method - * count = element count per attribute - * register_count = number of registers consumed per attribute. E.g 3-element methods have padding - */ - template + * id = base method register + * index = register index in method + * count = element count per attribute + * register_count = number of registers consumed per attribute. E.g 3-element methods have padding + */ + template void set_vertex_data_impl(context* ctx, u32 arg) { static constexpr usz increment_per_array_index = (register_count * sizeof(type)) / sizeof(u32); @@ -125,7 +146,7 @@ namespace rsx util::push_vertex_data(ctx, attribute_index, vertex_subreg, count, vtype, arg); } - template + template struct set_vertex_data4ub_m { static void impl(context* ctx, u32 /*reg*/, u32 arg) @@ -134,7 +155,7 @@ namespace rsx } }; - template + template struct set_vertex_data1f_m { static void impl(context* ctx, u32 /*reg*/, u32 arg) @@ -143,7 +164,7 @@ namespace rsx } }; - template + template struct set_vertex_data2f_m { static void impl(context* ctx, u32 /*reg*/, u32 arg) @@ -152,17 +173,17 @@ namespace rsx } }; - template + template struct set_vertex_data3f_m { static void impl(context* ctx, u32 /*reg*/, u32 arg) { - //Register alignment is only 1, 2, or 4 (Rachet & Clank 2) + // Register alignment is only 1, 2, or 4 (Rachet & Clank 2) set_vertex_data_impl(ctx, arg); } }; - template + template struct set_vertex_data4f_m { static void impl(context* ctx, u32 /*reg*/, u32 arg) @@ -171,7 +192,7 @@ namespace rsx } }; - template + template struct set_vertex_data2s_m { static void impl(context* ctx, u32 /*reg*/, u32 arg) @@ -180,7 +201,7 @@ namespace rsx } }; - template + template struct set_vertex_data4s_m { static void impl(context* ctx, u32 /*reg*/, u32 arg) @@ -189,7 +210,7 @@ namespace rsx } }; - template + template struct set_vertex_data_scaled4s_m { static void impl(context* ctx, u32 /*reg*/, u32 arg) @@ -212,7 +233,7 @@ namespace rsx static void impl(context* ctx, u32 reg, u32 arg); }; - template + template struct set_vertex_array_offset { static void impl(context* ctx, u32 reg, u32 arg) @@ -230,7 +251,7 @@ namespace rsx } }; - template + template struct set_vertex_texture_dirty_bit { static void impl(context* ctx, u32 /*reg*/, u32 /*arg*/) @@ -241,5 +262,5 @@ namespace rsx #undef RSX #undef REGS - } -} + } // namespace nv4097 +} // namespace rsx diff --git a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv47_sync.hpp b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv47_sync.hpp index 1ab5371d9..4f8c7a765 100644 --- a/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv47_sync.hpp +++ b/rpcs3/rpcs3/Emu/RSX/NV47/HW/nv47_sync.hpp @@ -59,7 +59,7 @@ namespace rsx vm::_ref(address).val = data; } - } -} + } // namespace util +} // namespace rsx #include "context_accessors.undef.h" diff --git a/rpcs3/rpcs3/Emu/RSX/Overlays/FriendsList/overlay_friends_list_dialog.cpp b/rpcs3/rpcs3/Emu/RSX/Overlays/FriendsList/overlay_friends_list_dialog.cpp index 1d1379105..94baf4901 100644 --- a/rpcs3/rpcs3/Emu/RSX/Overlays/FriendsList/overlay_friends_list_dialog.cpp +++ b/rpcs3/rpcs3/Emu/RSX/Overlays/FriendsList/overlay_friends_list_dialog.cpp @@ -72,10 +72,10 @@ namespace rsx static_cast(image.get())->set_image_resource(resource_config::standard_image_resource::square); } - std::unique_ptr text_stack = std::make_unique(); - std::unique_ptr padding = std::make_unique(); + std::unique_ptr text_stack = std::make_unique(); + std::unique_ptr padding = std::make_unique(); std::unique_ptr header_text = std::make_unique