diff --git a/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp b/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp index 07c8333a3a..6157bcc29e 100644 --- a/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp @@ -152,7 +152,7 @@ s32 cellVideoOutSetCopyControl(u32 videoOut, u32 control) DECLARE(ppu_module_manager::cellAvconfExt)("cellSysutilAvconfExt", []() { - REG_VNID(cellSysutilAvconfExt, 0x00000000u, g_gamma).init = [] + REG_VAR(cellSysutilAvconfExt, g_gamma).flag(MFF_HIDDEN).init = [] { // Test *g_gamma = 1.0f; diff --git a/rpcs3/Emu/Cell/Modules/cellFs.cpp b/rpcs3/Emu/Cell/Modules/cellFs.cpp index 2a35b56c9a..b67f531d0b 100644 --- a/rpcs3/Emu/Cell/Modules/cellFs.cpp +++ b/rpcs3/Emu/Cell/Modules/cellFs.cpp @@ -1035,22 +1035,22 @@ DECLARE(ppu_module_manager::cellFs)("sys_fs", []() REG_FUNC(sys_fs, cellFsChangeFileSizeWithoutAllocation); REG_FUNC(sys_fs, cellFsChmod); REG_FUNC(sys_fs, cellFsChown); - REG_FUNC(sys_fs, cellFsClose).flags = MFF_PERFECT; - REG_FUNC(sys_fs, cellFsClosedir).flags = MFF_PERFECT; + 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).flags = MFF_PERFECT; + 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).flags = MFF_PERFECT; + 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).flags = MFF_PERFECT; + REG_FUNC(sys_fs, cellFsLseek).flag(MFF_PERFECT); REG_FUNC(sys_fs, cellFsLsnGetCDA); REG_FUNC(sys_fs, cellFsLsnGetCDASize); REG_FUNC(sys_fs, cellFsLsnLock); @@ -1063,8 +1063,8 @@ DECLARE(ppu_module_manager::cellFs)("sys_fs", []() REG_FUNC(sys_fs, cellFsOpen); REG_FUNC(sys_fs, cellFsOpen2); REG_FUNC(sys_fs, cellFsOpendir); - REG_FUNC(sys_fs, cellFsRead).flags = MFF_PERFECT; - REG_FUNC(sys_fs, cellFsReaddir).flags = MFF_PERFECT; + 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); @@ -1095,6 +1095,6 @@ DECLARE(ppu_module_manager::cellFs)("sys_fs", []() REG_FUNC(sys_fs, cellFsUnlink); REG_FUNC(sys_fs, cellFsUnregisterL10nCallbacks); REG_FUNC(sys_fs, cellFsUtime); - REG_FUNC(sys_fs, cellFsWrite).flags = MFF_PERFECT; + REG_FUNC(sys_fs, cellFsWrite).flag(MFF_PERFECT); REG_FUNC(sys_fs, cellFsWriteWithOffset); }); diff --git a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp index f28863be8c..1e7ed43680 100644 --- a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp @@ -1484,5 +1484,5 @@ DECLARE(ppu_module_manager::cellGcmSys)("cellGcmSys", []() REG_FUNC(cellGcmSys, cellGcmGpadCaptureSnapshot); // Special - REG_FUNC(cellGcmSys, cellGcmCallback).flags = MFF_HIDDEN; + REG_FUNC(cellGcmSys, cellGcmCallback).flag(MFF_HIDDEN); }); diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index 6aca8a1ad8..bfe29f164f 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -1083,7 +1083,7 @@ s32 cellSaveDataUserGetListItem(u32 userId, vm::cptr dirName, vm::ptr dst, vm::cptr src, u32 size) DECLARE(ppu_module_manager::sys_libc)("sys_libc", []() { - REG_FNID(sys_libc, "memcpy", sys_libc_memcpy).flags = MFF_FORCED_HLE; + REG_FNID(sys_libc, "memcpy", sys_libc_memcpy).flag(MFF_FORCED_HLE); }); diff --git a/rpcs3/Emu/Cell/Modules/sys_ppu_thread_.cpp b/rpcs3/Emu/Cell/Modules/sys_ppu_thread_.cpp index d0d37b041d..a27544bd08 100644 --- a/rpcs3/Emu/Cell/Modules/sys_ppu_thread_.cpp +++ b/rpcs3/Emu/Cell/Modules/sys_ppu_thread_.cpp @@ -266,12 +266,12 @@ error_code sys_interrupt_thread_disestablish(ppu_thread& ppu, u32 ih) void sysPrxForUser_sys_ppu_thread_init() { // Private - REG_VNID(sysPrxForUser, 0x00000000u, g_ppu_atexit_lwm); - REG_VNID(sysPrxForUser, 0x00000001u, g_ppu_once_mutex); - REG_VNID(sysPrxForUser, 0x00000002u, g_ppu_atexit); - REG_VNID(sysPrxForUser, 0x00000003u, g_ppu_prx_lwm); + REG_VAR(sysPrxForUser, g_ppu_atexit_lwm).flag(MFF_HIDDEN); + REG_VAR(sysPrxForUser, g_ppu_once_mutex).flag(MFF_HIDDEN); + REG_VAR(sysPrxForUser, g_ppu_atexit).flag(MFF_HIDDEN); + REG_VAR(sysPrxForUser, g_ppu_prx_lwm).flag(MFF_HIDDEN); - REG_FUNC(sysPrxForUser, sys_initialize_tls); + REG_FUNC(sysPrxForUser, sys_initialize_tls).args = {"main_thread_id", "tls_seg_addr", "tls_seg_size", "tls_mem_size"}; // Test REG_FUNC(sysPrxForUser, sys_ppu_thread_create); REG_FUNC(sysPrxForUser, sys_ppu_thread_get_id); REG_FUNC(sysPrxForUser, sys_ppu_thread_exit); diff --git a/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/Emu/Cell/PPUModule.cpp index d691eb2756..234cc2b635 100644 --- a/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/Emu/Cell/PPUModule.cpp @@ -327,7 +327,7 @@ static void ppu_initialize_modules(const std::shared_ptr& link // Allocate HLE variable if (variable.second.size >= 4096 || variable.second.align >= 4096) { - variable.second.var->set(vm::alloc(variable.second.size, vm::main, std::max(variable.second.align, 4096))); + variable.second.addr = vm::alloc(variable.second.size, vm::main, std::max(variable.second.align, 4096)); } else { @@ -343,10 +343,15 @@ static void ppu_initialize_modules(const std::shared_ptr& link alloc_addr = next; } - variable.second.var->set(alloc_addr); + variable.second.addr = alloc_addr; alloc_addr += variable.second.size; } + if (variable.second.var) + { + variable.second.var->set(variable.second.addr); + } + LOG_TRACE(LOADER, "Allocated HLE variable %s.%s at 0x%x", module->name, variable.second.name, variable.second.var->addr()); // Initialize HLE variable @@ -355,10 +360,13 @@ static void ppu_initialize_modules(const std::shared_ptr& link variable.second.init(); } - auto& vlink = linkage.variables[variable.first]; - - vlink.hle = true; - vlink.export_addr = variable.second.var->addr(); + if ((variable.second.flags & MFF_HIDDEN) == 0) + { + auto& vlink = linkage.variables[variable.first]; + + vlink.hle = true; + vlink.export_addr = variable.second.var->addr(); + } } } } diff --git a/rpcs3/Emu/Cell/PPUModule.h b/rpcs3/Emu/Cell/PPUModule.h index 75edddf441..720469ef6e 100644 --- a/rpcs3/Emu/Cell/PPUModule.h +++ b/rpcs3/Emu/Cell/PPUModule.h @@ -27,7 +27,7 @@ constexpr u32 ppu_generate_id(u32 id) } // Flags set with REG_FUNC -enum ppu_static_function_flags : u32 +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 @@ -40,6 +40,14 @@ struct ppu_static_function const char* name; u32 index; // Index for ppu_function_manager u32 flags; + const char* type; + std::vector args; // Arg names + + ppu_static_function& flag(ppu_static_module_flags value) + { + flags |= value; + return *this; + } }; // HLE variable information @@ -50,6 +58,15 @@ struct ppu_static_variable void(*init)(); // Variable initialization function u32 size; u32 align; + const char* type; + u32 flags; + u32 addr; + + ppu_static_variable& flag(ppu_static_module_flags value) + { + flags |= value; + return *this; + } }; // HLE module information @@ -103,6 +120,7 @@ public: info.name = name; info.index = ppu_function_manager::register_function(func); info.flags = 0; + info.type = typeid(T).name(); return info; } @@ -119,6 +137,9 @@ public: info.init = [] {}; info.size = SIZE_32(typename T::type); info.align = ALIGN_32(typename T::type); + info.type = typeid(T).name(); + info.flags = 0; + info.addr = 0; return info; }