diff --git a/rpcs3/Emu/Cell/Modules/sys_prx_.cpp b/rpcs3/Emu/Cell/Modules/sys_prx_.cpp index bdeaa2bd3f..40acda9139 100644 --- a/rpcs3/Emu/Cell/Modules/sys_prx_.cpp +++ b/rpcs3/Emu/Cell/Modules/sys_prx_.cpp @@ -39,7 +39,7 @@ error_code sys_prx_load_module(ppu_thread& ppu, vm::cptr path, u64 flags, sys_lwmutex_locker lock(ppu, g_ppu_prx_lwm); - return _sys_prx_load_module(path, flags, pOpt); + return _sys_prx_load_module(ppu, path, flags, pOpt); } error_code sys_prx_load_module_by_fd(ppu_thread& ppu, s32 fd, u64 offset, u64 flags, vm::ptr pOpt) @@ -48,7 +48,7 @@ error_code sys_prx_load_module_by_fd(ppu_thread& ppu, s32 fd, u64 offset, u64 fl sys_lwmutex_locker lock(ppu, g_ppu_prx_lwm); - return _sys_prx_load_module_by_fd(fd, offset, flags, pOpt); + return _sys_prx_load_module_by_fd(ppu, fd, offset, flags, pOpt); } error_code sys_prx_load_module_on_memcontainer(ppu_thread& ppu, vm::cptr path, u32 mem_ct, u64 flags, vm::ptr pOpt) @@ -57,7 +57,7 @@ error_code sys_prx_load_module_on_memcontainer(ppu_thread& ppu, vm::cptr p sys_lwmutex_locker lock(ppu, g_ppu_prx_lwm); - return _sys_prx_load_module_on_memcontainer(path, mem_ct, flags, pOpt); + return _sys_prx_load_module_on_memcontainer(ppu, path, mem_ct, flags, pOpt); } error_code sys_prx_load_module_on_memcontainer_by_fd(ppu_thread& ppu, s32 fd, u64 offset, u32 mem_ct, u64 flags, vm::ptr pOpt) @@ -66,7 +66,7 @@ error_code sys_prx_load_module_on_memcontainer_by_fd(ppu_thread& ppu, s32 fd, u6 sys_lwmutex_locker lock(ppu, g_ppu_prx_lwm); - return _sys_prx_load_module_on_memcontainer_by_fd(fd, offset, mem_ct, flags, pOpt); + return _sys_prx_load_module_on_memcontainer_by_fd(ppu, fd, offset, mem_ct, flags, pOpt); } error_code sys_prx_load_module_list(ppu_thread& ppu, s32 count, vm::cpptr path_list, u64 flags, vm::ptr pOpt, vm::ptr id_list) @@ -75,7 +75,7 @@ error_code sys_prx_load_module_list(ppu_thread& ppu, s32 count, vm::cpptr sys_lwmutex_locker lock(ppu, g_ppu_prx_lwm); - return _sys_prx_load_module_list(count, convert_path_list(path_list, count), flags, pOpt, id_list); + return _sys_prx_load_module_list(ppu, count, convert_path_list(path_list, count), flags, pOpt, id_list); } error_code sys_prx_load_module_list_on_memcontainer(ppu_thread& ppu, s32 count, vm::cpptr path_list, u32 mem_ct, u64 flags, vm::ptr pOpt, vm::ptr id_list) @@ -84,7 +84,7 @@ error_code sys_prx_load_module_list_on_memcontainer(ppu_thread& ppu, s32 count, sys_lwmutex_locker lock(ppu, g_ppu_prx_lwm); - return _sys_prx_load_module_list_on_memcontainer(count, convert_path_list(path_list, count), mem_ct, flags, pOpt, id_list); + return _sys_prx_load_module_list_on_memcontainer(ppu, count, convert_path_list(path_list, count), mem_ct, flags, pOpt, id_list); } error_code sys_prx_start_module(ppu_thread& ppu, u32 id, u32 args, vm::ptr argp, vm::ptr result, u64 flags, vm::ptr pOpt) @@ -103,7 +103,7 @@ error_code sys_prx_start_module(ppu_thread& ppu, u32 id, u32 args, vm::ptr opt->cmd = 1; opt->entry2.set(-1); - const error_code res = _sys_prx_start_module(id, flags, opt); + const error_code res = _sys_prx_start_module(ppu, id, flags, opt); if (res < 0) { @@ -115,7 +115,7 @@ error_code sys_prx_start_module(ppu_thread& ppu, u32 id, u32 args, vm::ptr opt->cmd = 2; opt->res = *result; - _sys_prx_start_module(id, flags, opt); + _sys_prx_start_module(ppu, id, flags, opt); return CELL_OK; } @@ -136,7 +136,7 @@ error_code sys_prx_stop_module(ppu_thread& ppu, u32 id, u32 args, vm::ptr opt->cmd = 1; opt->entry2.set(-1); - const error_code res = _sys_prx_stop_module(id, flags, opt); + const error_code res = _sys_prx_stop_module(ppu, id, flags, opt); if (res < 0) { @@ -148,7 +148,7 @@ error_code sys_prx_stop_module(ppu_thread& ppu, u32 id, u32 args, vm::ptr opt->cmd = 2; opt->res = *result; - _sys_prx_stop_module(id, flags, opt); + _sys_prx_stop_module(ppu, id, flags, opt); return CELL_OK; } @@ -159,7 +159,7 @@ error_code sys_prx_unload_module(ppu_thread& ppu, u32 id, u64 flags, vm::ptr lib_entry) @@ -168,7 +168,7 @@ error_code sys_prx_register_library(ppu_thread& ppu, vm::ptr lib_entry) sys_lwmutex_locker lock(ppu, g_ppu_prx_lwm); - return _sys_prx_register_library(lib_entry); + return _sys_prx_register_library(ppu, lib_entry); } error_code sys_prx_unregister_library(ppu_thread& ppu, vm::ptr lib_entry) @@ -177,7 +177,7 @@ error_code sys_prx_unregister_library(ppu_thread& ppu, vm::ptr lib_entry) sys_lwmutex_locker lock(ppu, g_ppu_prx_lwm); - return _sys_prx_unregister_library(lib_entry); + return _sys_prx_unregister_library(ppu, lib_entry); } error_code sys_prx_get_module_list(ppu_thread& ppu, u64 flags, vm::ptr info) @@ -198,7 +198,7 @@ error_code sys_prx_get_module_list(ppu_thread& ppu, u64 flags, vm::ptrunk = 0; // Call the syscall - const s32 res = _sys_prx_get_module_list(2, opt); + const s32 res = _sys_prx_get_module_list(ppu, 2, opt); info->max = opt->max; info->count = opt->count; @@ -221,10 +221,10 @@ error_code sys_prx_get_module_info(ppu_thread& ppu, u32 id, u64 flags, vm::ptrinfo = info; // Call the syscall - return _sys_prx_get_module_info(id, 0, opt); + return _sys_prx_get_module_info(ppu, id, 0, opt); } -error_code sys_prx_get_module_id_by_name(vm::cptr name, u64 flags, vm::ptr pOpt) +error_code sys_prx_get_module_id_by_name(ppu_thread& ppu, vm::cptr name, u64 flags, vm::ptr pOpt) { sysPrxForUser.trace("sys_prx_get_module_id_by_name(name=%s, flags=0x%x, pOpt=*0x%x)", name, flags, pOpt); @@ -234,15 +234,15 @@ error_code sys_prx_get_module_id_by_name(vm::cptr name, u64 flags, vm::ptr } // Call the syscall - return _sys_prx_get_module_id_by_name(name, u64{0}, vm::null); + return _sys_prx_get_module_id_by_name(ppu, name, u64{0}, vm::null); } -error_code sys_prx_get_module_id_by_address(u32 addr) +error_code sys_prx_get_module_id_by_address(ppu_thread& ppu, u32 addr) { sysPrxForUser.trace("sys_prx_get_module_id_by_address()"); // Call the syscall - return _sys_prx_get_module_id_by_address(addr); + return _sys_prx_get_module_id_by_address(ppu, addr); } error_code sys_prx_exitspawn_with_level() @@ -256,7 +256,7 @@ error_code sys_prx_get_my_module_id(ppu_thread& ppu, ppu_thread& _do, ppu_thread sysPrxForUser.trace("sys_prx_get_my_module_id()"); // Call the syscall using the LR - return _sys_prx_get_module_id_by_address(static_cast(ppu.lr)); + return _sys_prx_get_module_id_by_address(ppu, static_cast(ppu.lr)); } void sysPrxForUser_sys_prx_init() diff --git a/rpcs3/Emu/Cell/lv2/sys_prx.cpp b/rpcs3/Emu/Cell/lv2/sys_prx.cpp index 3d0af518c9..7435472666 100644 --- a/rpcs3/Emu/Cell/lv2/sys_prx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_prx.cpp @@ -187,14 +187,18 @@ static error_code prx_load_module(const std::string& vpath, u64 flags, vm::ptr pOpt) +error_code _sys_prx_load_module_by_fd(ppu_thread& ppu, s32 fd, u64 offset, u64 flags, vm::ptr pOpt) { + ppu.state += cpu_flag::wait; + sys_prx.warning("_sys_prx_load_module_by_fd(fd=%d, offset=0x%x, flags=0x%x, pOpt=*0x%x)", fd, offset, flags, pOpt); const auto file = idm::get(fd); @@ -207,14 +211,16 @@ error_code _sys_prx_load_module_by_fd(s32 fd, u64 offset, u64 flags, vm::ptrname.data(), offset), flags, pOpt, lv2_file::make_view(file, offset)); } -error_code _sys_prx_load_module_on_memcontainer_by_fd(s32 fd, u64 offset, u32 mem_ct, u64 flags, vm::ptr pOpt) +error_code _sys_prx_load_module_on_memcontainer_by_fd(ppu_thread& ppu, s32 fd, u64 offset, u32 mem_ct, u64 flags, vm::ptr pOpt) { + ppu.state += cpu_flag::wait; + sys_prx.warning("_sys_prx_load_module_on_memcontainer_by_fd(fd=%d, offset=0x%x, mem_ct=0x%x, flags=0x%x, pOpt=*0x%x)", fd, offset, mem_ct, flags, pOpt); - return _sys_prx_load_module_by_fd(fd, offset, flags, pOpt); + return _sys_prx_load_module_by_fd(ppu, fd, offset, flags, pOpt); } -static error_code prx_load_module_list(s32 count, vm::cpptr path_list, u32 mem_ct, u64 flags, vm::ptr pOpt, vm::ptr id_list) +static error_code prx_load_module_list(ppu_thread& ppu, s32 count, vm::cpptr path_list, u32 mem_ct, u64 flags, vm::ptr pOpt, vm::ptr id_list) { if (flags != 0) { @@ -240,7 +246,7 @@ static error_code prx_load_module_list(s32 count, vm::cpptr path while (--i >= 0) { // Unload already loaded modules - _sys_prx_unload_module(id_list[i], 0, vm::null); + _sys_prx_unload_module(ppu, id_list[i], 0, vm::null); } // Fill with -1 @@ -254,35 +260,45 @@ static error_code prx_load_module_list(s32 count, vm::cpptr path return CELL_OK; } -error_code _sys_prx_load_module_list(s32 count, vm::cpptr path_list, u64 flags, vm::ptr pOpt, vm::ptr id_list) +error_code _sys_prx_load_module_list(ppu_thread& ppu, s32 count, vm::cpptr path_list, u64 flags, vm::ptr pOpt, vm::ptr id_list) { + ppu.state += cpu_flag::wait; + sys_prx.warning("_sys_prx_load_module_list(count=%d, path_list=**0x%x, flags=0x%x, pOpt=*0x%x, id_list=*0x%x)", count, path_list, flags, pOpt, id_list); - return prx_load_module_list(count, path_list, SYS_MEMORY_CONTAINER_ID_INVALID, flags, pOpt, id_list); + return prx_load_module_list(ppu, count, path_list, SYS_MEMORY_CONTAINER_ID_INVALID, flags, pOpt, id_list); } -error_code _sys_prx_load_module_list_on_memcontainer(s32 count, vm::cpptr path_list, u32 mem_ct, u64 flags, vm::ptr pOpt, vm::ptr id_list) +error_code _sys_prx_load_module_list_on_memcontainer(ppu_thread& ppu, s32 count, vm::cpptr path_list, u32 mem_ct, u64 flags, vm::ptr pOpt, vm::ptr id_list) { + ppu.state += cpu_flag::wait; + sys_prx.warning("_sys_prx_load_module_list_on_memcontainer(count=%d, path_list=**0x%x, mem_ct=0x%x, flags=0x%x, pOpt=*0x%x, id_list=*0x%x)", count, path_list, mem_ct, flags, pOpt, id_list); - return prx_load_module_list(count, path_list, mem_ct, flags, pOpt, id_list); + return prx_load_module_list(ppu, count, path_list, mem_ct, flags, pOpt, id_list); } -error_code _sys_prx_load_module_on_memcontainer(vm::cptr path, u32 mem_ct, u64 flags, vm::ptr pOpt) +error_code _sys_prx_load_module_on_memcontainer(ppu_thread& ppu, vm::cptr path, u32 mem_ct, u64 flags, vm::ptr pOpt) { + ppu.state += cpu_flag::wait; + sys_prx.warning("_sys_prx_load_module_on_memcontainer(path=%s, mem_ct=0x%x, flags=0x%x, pOpt=*0x%x)", path, mem_ct, flags, pOpt); return prx_load_module(path.get_ptr(), flags, pOpt); } -error_code _sys_prx_load_module(vm::cptr path, u64 flags, vm::ptr pOpt) +error_code _sys_prx_load_module(ppu_thread& ppu, vm::cptr path, u64 flags, vm::ptr pOpt) { + ppu.state += cpu_flag::wait; + sys_prx.warning("_sys_prx_load_module(path=%s, flags=0x%x, pOpt=*0x%x)", path, flags, pOpt); return prx_load_module(path.get_ptr(), flags, pOpt); } -error_code _sys_prx_start_module(u32 id, u64 flags, vm::ptr pOpt) +error_code _sys_prx_start_module(ppu_thread& ppu, u32 id, u64 flags, vm::ptr pOpt) { + ppu.state += cpu_flag::wait; + sys_prx.warning("_sys_prx_start_module(id=0x%x, flags=0x%x, pOpt=*0x%x)", id, flags, pOpt); if (id == 0 || !pOpt) @@ -330,7 +346,7 @@ error_code _sys_prx_start_module(u32 id, u64 flags, vm::ptrstate = PRX_STATE_STOPPED; - _sys_prx_unload_module(id, 0, vm::null); + _sys_prx_unload_module(ppu, id, 0, vm::null); // Return the exact value returned by the start function (as an error) return static_cast(res); @@ -352,8 +368,10 @@ error_code _sys_prx_start_module(u32 id, u64 flags, vm::ptr pOpt) +error_code _sys_prx_stop_module(ppu_thread& ppu, u32 id, u64 flags, vm::ptr pOpt) { + ppu.state += cpu_flag::wait; + sys_prx.warning("_sys_prx_stop_module(id=0x%x, flags=0x%x, pOpt=*0x%x)", id, flags, pOpt); const auto prx = idm::get(id); @@ -431,7 +449,7 @@ error_code _sys_prx_stop_module(u32 id, u64 flags, vm::ptrstop); //prx->stop = vm::null; } - + return CELL_OK; } default: @@ -441,8 +459,10 @@ error_code _sys_prx_stop_module(u32 id, u64 flags, vm::ptr pOpt) +error_code _sys_prx_unload_module(ppu_thread& ppu, u32 id, u64 flags, vm::ptr pOpt) { + ppu.state += cpu_flag::wait; + sys_prx.todo("_sys_prx_unload_module(id=0x%x, flags=0x%x, pOpt=*0x%x)", id, flags, pOpt); // Get the PRX, free the used memory and delete the object and its ID @@ -476,50 +496,66 @@ error_code _sys_prx_unload_module(u32 id, u64 flags, vm::ptr library) +error_code _sys_prx_register_library(ppu_thread& ppu, vm::ptr library) { + ppu.state += cpu_flag::wait; + sys_prx.todo("_sys_prx_register_library(library=*0x%x)", library); return CELL_OK; } -error_code _sys_prx_unregister_library(vm::ptr library) +error_code _sys_prx_unregister_library(ppu_thread& ppu, vm::ptr library) { + ppu.state += cpu_flag::wait; + sys_prx.todo("_sys_prx_unregister_library(library=*0x%x)", library); return CELL_OK; } -error_code _sys_prx_link_library() +error_code _sys_prx_link_library(ppu_thread& ppu) { + ppu.state += cpu_flag::wait; + sys_prx.todo("_sys_prx_link_library()"); return CELL_OK; } -error_code _sys_prx_unlink_library() +error_code _sys_prx_unlink_library(ppu_thread& ppu) { + ppu.state += cpu_flag::wait; + sys_prx.todo("_sys_prx_unlink_library()"); return CELL_OK; } -error_code _sys_prx_query_library() +error_code _sys_prx_query_library(ppu_thread& ppu) { + ppu.state += cpu_flag::wait; + sys_prx.todo("_sys_prx_query_library()"); return CELL_OK; } -error_code _sys_prx_get_module_list(u64 flags, vm::ptr pInfo) +error_code _sys_prx_get_module_list(ppu_thread& ppu, u64 flags, vm::ptr pInfo) { + ppu.state += cpu_flag::wait; + if (flags & 0x1) { sys_prx.todo("_sys_prx_get_module_list(flags=%d, pInfo=*0x%x)", flags, pInfo); @@ -572,12 +608,14 @@ error_code _sys_prx_get_module_list(u64 flags, vm::ptrsize); } - + return CELL_OK; } -error_code _sys_prx_get_module_info(u32 id, u64 flags, vm::ptr pOpt) +error_code _sys_prx_get_module_info(ppu_thread& ppu, u32 id, u64 flags, vm::ptr pOpt) { + ppu.state += cpu_flag::wait; + sys_prx.warning("_sys_prx_get_module_info(id=0x%x, flags=%d, pOpt=*0x%x)", id, flags, pOpt); const auto prx = idm::get(id); @@ -627,8 +665,10 @@ error_code _sys_prx_get_module_info(u32 id, u64 flags, vm::ptr name, u64 flags, vm::ptr pOpt) +error_code _sys_prx_get_module_id_by_name(ppu_thread& ppu, vm::cptr name, u64 flags, vm::ptr pOpt) { + ppu.state += cpu_flag::wait; + sys_prx.todo("_sys_prx_get_module_id_by_name(name=%s, flags=%d, pOpt=*0x%x)", name, flags, pOpt); //if (realName == "?") ... @@ -636,20 +676,26 @@ error_code _sys_prx_get_module_id_by_name(vm::cptr name, u64 flags, vm::pt return CELL_PRX_ERROR_UNKNOWN_MODULE; } -error_code _sys_prx_get_module_id_by_address(u32 addr) +error_code _sys_prx_get_module_id_by_address(ppu_thread& ppu, u32 addr) { + ppu.state += cpu_flag::wait; + sys_prx.todo("_sys_prx_get_module_id_by_address(addr=0x%x)", addr); return CELL_OK; } -error_code _sys_prx_start() +error_code _sys_prx_start(ppu_thread& ppu) { + ppu.state += cpu_flag::wait; + sys_prx.todo("sys_prx_start()"); return CELL_OK; } -error_code _sys_prx_stop() +error_code _sys_prx_stop(ppu_thread& ppu) { + ppu.state += cpu_flag::wait; + sys_prx.todo("sys_prx_stop()"); return CELL_OK; } diff --git a/rpcs3/Emu/Cell/lv2/sys_prx.h b/rpcs3/Emu/Cell/lv2/sys_prx.h index 7385c383a5..6e63ef68a8 100644 --- a/rpcs3/Emu/Cell/lv2/sys_prx.h +++ b/rpcs3/Emu/Cell/lv2/sys_prx.h @@ -161,26 +161,26 @@ enum : u64 // SysCalls -error_code sys_prx_get_ppu_guid(); -error_code _sys_prx_load_module_by_fd(s32 fd, u64 offset, u64 flags, vm::ptr pOpt); -error_code _sys_prx_load_module_on_memcontainer_by_fd(s32 fd, u64 offset, u32 mem_ct, u64 flags, vm::ptr pOpt); -error_code _sys_prx_load_module_list(s32 count, vm::cpptr path_list, u64 flags, vm::ptr pOpt, vm::ptr id_list); -error_code _sys_prx_load_module_list_on_memcontainer(s32 count, vm::cpptr path_list, u32 mem_ct, u64 flags, vm::ptr pOpt, vm::ptr id_list); -error_code _sys_prx_load_module_on_memcontainer(vm::cptr path, u32 mem_ct, u64 flags, vm::ptr pOpt); -error_code _sys_prx_load_module(vm::cptr path, u64 flags, vm::ptr pOpt); -error_code _sys_prx_start_module(u32 id, u64 flags, vm::ptr pOpt); -error_code _sys_prx_stop_module(u32 id, u64 flags, vm::ptr pOpt); -error_code _sys_prx_unload_module(u32 id, u64 flags, vm::ptr pOpt); -error_code _sys_prx_register_module(); -error_code _sys_prx_query_module(); -error_code _sys_prx_register_library(vm::ptr library); -error_code _sys_prx_unregister_library(vm::ptr library); -error_code _sys_prx_link_library(); -error_code _sys_prx_unlink_library(); -error_code _sys_prx_query_library(); -error_code _sys_prx_get_module_list(u64 flags, vm::ptr pInfo); -error_code _sys_prx_get_module_info(u32 id, u64 flags, vm::ptr pOpt); -error_code _sys_prx_get_module_id_by_name(vm::cptr name, u64 flags, vm::ptr pOpt); -error_code _sys_prx_get_module_id_by_address(u32 addr); -error_code _sys_prx_start(); -error_code _sys_prx_stop(); +error_code sys_prx_get_ppu_guid(ppu_thread& ppu); +error_code _sys_prx_load_module_by_fd(ppu_thread& ppu, s32 fd, u64 offset, u64 flags, vm::ptr pOpt); +error_code _sys_prx_load_module_on_memcontainer_by_fd(ppu_thread& ppu, s32 fd, u64 offset, u32 mem_ct, u64 flags, vm::ptr pOpt); +error_code _sys_prx_load_module_list(ppu_thread& ppu, s32 count, vm::cpptr path_list, u64 flags, vm::ptr pOpt, vm::ptr id_list); +error_code _sys_prx_load_module_list_on_memcontainer(ppu_thread& ppu, s32 count, vm::cpptr path_list, u32 mem_ct, u64 flags, vm::ptr pOpt, vm::ptr id_list); +error_code _sys_prx_load_module_on_memcontainer(ppu_thread& ppu, vm::cptr path, u32 mem_ct, u64 flags, vm::ptr pOpt); +error_code _sys_prx_load_module(ppu_thread& ppu, vm::cptr path, u64 flags, vm::ptr pOpt); +error_code _sys_prx_start_module(ppu_thread& ppu, u32 id, u64 flags, vm::ptr pOpt); +error_code _sys_prx_stop_module(ppu_thread& ppu, u32 id, u64 flags, vm::ptr pOpt); +error_code _sys_prx_unload_module(ppu_thread& ppu, u32 id, u64 flags, vm::ptr pOpt); +error_code _sys_prx_register_module(ppu_thread& ppu); +error_code _sys_prx_query_module(ppu_thread& ppu); +error_code _sys_prx_register_library(ppu_thread& ppu, vm::ptr library); +error_code _sys_prx_unregister_library(ppu_thread& ppu, vm::ptr library); +error_code _sys_prx_link_library(ppu_thread& ppu); +error_code _sys_prx_unlink_library(ppu_thread& ppu); +error_code _sys_prx_query_library(ppu_thread& ppu); +error_code _sys_prx_get_module_list(ppu_thread& ppu, u64 flags, vm::ptr pInfo); +error_code _sys_prx_get_module_info(ppu_thread& ppu, u32 id, u64 flags, vm::ptr pOpt); +error_code _sys_prx_get_module_id_by_name(ppu_thread& ppu, vm::cptr name, u64 flags, vm::ptr pOpt); +error_code _sys_prx_get_module_id_by_address(ppu_thread& ppu, u32 addr); +error_code _sys_prx_start(ppu_thread& ppu); +error_code _sys_prx_stop(ppu_thread& ppu);