diff --git a/externals/fmt b/externals/fmt index a9625970..bc8d32e9 160000 --- a/externals/fmt +++ b/externals/fmt @@ -1 +1 @@ -Subproject commit a96259701e1d16e2f8c8299c668e863ec0ac0119 +Subproject commit bc8d32e9643d2be5fc070abf2a50bc021544545d diff --git a/externals/glslang b/externals/glslang index 5939e32b..52f68dc6 160000 --- a/externals/glslang +++ b/externals/glslang @@ -1 +1 @@ -Subproject commit 5939e32b87487fa9c72ab336ebfcc5ae26d9ab6d +Subproject commit 52f68dc6b2a9d017b43161f31f13a6f44636ee7c diff --git a/externals/magic_enum b/externals/magic_enum index ec1adc57..664ee62c 160000 --- a/externals/magic_enum +++ b/externals/magic_enum @@ -1 +1 @@ -Subproject commit ec1adc5763f684e0f32888b157bfc0b86021b8e9 +Subproject commit 664ee62c12570948b0e025d15b42d641fba8d54a diff --git a/externals/vma b/externals/vma index 257138b8..871913da 160000 --- a/externals/vma +++ b/externals/vma @@ -1 +1 @@ -Subproject commit 257138b8f5686ae84491a3df9f90a77d5660c3bd +Subproject commit 871913da6a4b132b567d7b65c509600363c0041e diff --git a/externals/vulkan-headers b/externals/vulkan-headers index 190d2cb2..b379292b 160000 --- a/externals/vulkan-headers +++ b/externals/vulkan-headers @@ -1 +1 @@ -Subproject commit 190d2cb24e90e5bf2bec0a75604a9b3586485b6d +Subproject commit b379292b2ab6df5771ba9870d53cf8b2c9295daf diff --git a/externals/winpthreads b/externals/winpthreads index d937b600..f00c973a 160000 --- a/externals/winpthreads +++ b/externals/winpthreads @@ -1 +1 @@ -Subproject commit d937b60055aaea313422672ebd5cc8bfa87a1682 +Subproject commit f00c973a6ab2a23573708568b8ef4acc20a9d36b diff --git a/externals/xxhash b/externals/xxhash index 805c00b6..a57f6cce 160000 --- a/externals/xxhash +++ b/externals/xxhash @@ -1 +1 @@ -Subproject commit 805c00b68fa754200ada0c207ffeaa7a4409377c +Subproject commit a57f6cce2698049863af8c25787084ae0489d849 diff --git a/externals/zydis b/externals/zydis index 5a68f639..16c6a369 160000 --- a/externals/zydis +++ b/externals/zydis @@ -1 +1 @@ -Subproject commit 5a68f639e4f01604cc7bfc8d313f583a8137e3d3 +Subproject commit 16c6a369c193981e9cf314126589eaa8763f92c3 diff --git a/src/core/libraries/dialogs/ime_dialog.cpp b/src/core/libraries/dialogs/ime_dialog.cpp index 3fa35c2c..e73c1881 100644 --- a/src/core/libraries/dialogs/ime_dialog.cpp +++ b/src/core/libraries/dialogs/ime_dialog.cpp @@ -56,7 +56,6 @@ int PS4_SYSV_ABI sceImeDialogGetStatus() { if (g_ime_dlg_status == OrbisImeDialogStatus::ORBIS_IME_DIALOG_STATUS_RUNNING) { return OrbisImeDialogStatus::ORBIS_IME_DIALOG_STATUS_FINISHED; } - return g_ime_dlg_status; } diff --git a/src/core/libraries/kernel/file_system.cpp b/src/core/libraries/kernel/file_system.cpp index 23b949a8..8734b964 100644 --- a/src/core/libraries/kernel/file_system.cpp +++ b/src/core/libraries/kernel/file_system.cpp @@ -463,6 +463,7 @@ void fileSystemSymbolsRegister(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, sceKernelOpen); LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, posix_open); LIB_FUNCTION("UK2Tl2DWUns", "libkernel", 1, "libkernel", 1, 1, sceKernelClose); + LIB_FUNCTION("bY-PO6JhzhQ", "libkernel", 1, "libkernel", 1, 1, posix_close); LIB_FUNCTION("bY-PO6JhzhQ", "libScePosix", 1, "libkernel", 1, 1, posix_close); LIB_FUNCTION("4wSze92BhLI", "libkernel", 1, "libkernel", 1, 1, sceKernelWrite); diff --git a/src/core/libraries/kernel/libkernel.cpp b/src/core/libraries/kernel/libkernel.cpp index c9073029..16274236 100644 --- a/src/core/libraries/kernel/libkernel.cpp +++ b/src/core/libraries/kernel/libkernel.cpp @@ -351,6 +351,10 @@ int PS4_SYSV_ABI _sigprocmask() { return ORBIS_OK; } +int PS4_SYSV_ABI posix_getpagesize() { + return 4096; +} + void LibKernel_Register(Core::Loader::SymbolsResolver* sym) { service_thread = std::jthread{KernelServiceThread}; @@ -414,6 +418,7 @@ void LibKernel_Register(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("-o5uEDpN+oY", "libkernel", 1, "libkernel", 1, 1, sceKernelConvertUtcToLocaltime); LIB_FUNCTION("WB66evu8bsU", "libkernel", 1, "libkernel", 1, 1, sceKernelGetCompiledSdkVersion); LIB_FUNCTION("DRuBt2pvICk", "libkernel", 1, "libkernel", 1, 1, ps4__read); + LIB_FUNCTION("k+AXqu2-eBc", "libScePosix", 1, "libkernel", 1, 1, posix_getpagesize); Libraries::Kernel::fileSystemSymbolsRegister(sym); Libraries::Kernel::timeSymbolsRegister(sym); diff --git a/src/core/libraries/kernel/thread_management.cpp b/src/core/libraries/kernel/thread_management.cpp index f58b365b..943098e8 100644 --- a/src/core/libraries/kernel/thread_management.cpp +++ b/src/core/libraries/kernel/thread_management.cpp @@ -1329,6 +1329,26 @@ int PS4_SYSV_ABI scePthreadSetprio(ScePthread thread, int prio) { return ORBIS_OK; } +int PS4_SYSV_ABI posix_pthread_condattr_init(ScePthreadCondattr* attr) { + int result = scePthreadCondattrInit(attr); + LOG_INFO(Kernel_Pthread, + "posix_pthread_condattr_init redirect to scePthreadCondattrInit, result = {}", result); + return result; +} + +int PS4_SYSV_ABI posix_pthread_condattr_destroy(ScePthreadCondattr* attr) { + int result = scePthreadCondattrDestroy(attr); + LOG_INFO(Kernel_Pthread, + "posix_pthread_condattr_destroy redirect to scePthreadCondattrDestroy, result = {}", + result); + return result; +} + +int PS4_SYSV_ABI posix_pthread_condattr_setclock(ScePthreadCondattr* attr, clockid_t clock) { + (*attr)->clock = clock; + return SCE_OK; +} + void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("lZzFeSxPl08", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_setcancelstate); LIB_FUNCTION("0TyVk4MSLt0", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_cond_init); @@ -1416,6 +1436,11 @@ void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) { posix_pthread_mutexattr_setprotocol); LIB_FUNCTION("HF7lK46xzjY", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_mutexattr_destroy); + LIB_FUNCTION("mKoTx03HRWA", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_condattr_init); + LIB_FUNCTION("dJcuQVn6-Iw", "libScePosix", 1, "libkernel", 1, 1, + posix_pthread_condattr_destroy); + LIB_FUNCTION("EjllaAqAPZo", "libScePosix", 1, "libkernel", 1, 1, + posix_pthread_condattr_setclock); LIB_FUNCTION("Z4QosVuAsA0", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_once); // openorbis weird functions diff --git a/src/core/libraries/kernel/thread_management.h b/src/core/libraries/kernel/thread_management.h index 9926b379..8303c9ef 100644 --- a/src/core/libraries/kernel/thread_management.h +++ b/src/core/libraries/kernel/thread_management.h @@ -92,6 +92,7 @@ struct PthreadCondInternal { struct PthreadCondAttrInternal { u8 reserved[64]; pthread_condattr_t cond_attr; + clockid_t clock; }; struct PthreadRwLockAttrInternal { diff --git a/src/core/libraries/kernel/time_management.cpp b/src/core/libraries/kernel/time_management.cpp index fbbcfdcf..d0c0a1e4 100644 --- a/src/core/libraries/kernel/time_management.cpp +++ b/src/core/libraries/kernel/time_management.cpp @@ -97,7 +97,8 @@ int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) { pclock_id = CLOCK_MONOTONIC; break; default: - UNREACHABLE(); + LOG_ERROR(Lib_Kernel, "unsupported = {} using CLOCK_REALTIME", clock_id); + break; } timespec t{}; diff --git a/src/core/libraries/save_data/savedata.cpp b/src/core/libraries/save_data/savedata.cpp index 71828b33..db6d0964 100644 --- a/src/core/libraries/save_data/savedata.cpp +++ b/src/core/libraries/save_data/savedata.cpp @@ -178,12 +178,39 @@ int PS4_SYSV_ABI sceSaveDataDeleteUser() { int PS4_SYSV_ABI sceSaveDataDirNameSearch(const OrbisSaveDataDirNameSearchCond* cond, OrbisSaveDataDirNameSearchResult* result) { - if (cond == nullptr || cond->dirName == nullptr) + if (cond == nullptr) return ORBIS_SAVE_DATA_ERROR_PARAMETER; - LOG_ERROR(Lib_SaveData, - "TODO sceSaveDataDirNameSearch: search_dir_name = {}, key = {}, result = {}", - cond->dirName->data, (int)cond->key, (result->infos == nullptr)); - + LOG_ERROR(Lib_SaveData, "TODO sceSaveDataDirNameSearch: Add params"); + const auto& mount_dir = Common::FS::GetUserPath(Common::FS::PathType::SaveDataDir) / + std::to_string(cond->userId) / game_serial; + if (!mount_dir.empty() && std::filesystem::exists(mount_dir)) { + if (cond->dirName == nullptr) { // look for all dirs if no dir is provided. + for (int i = 0; const auto& entry : std::filesystem::directory_iterator(mount_dir)) { + if (std::filesystem::is_directory(entry.path())) { + i++; + result->dirNamesNum = 0; // why is it 1024? is it max? + // copy dir name to be used by sceSaveDataMount in read mode. + strncpy(result->dirNames[i].data, entry.path().filename().string().c_str(), 32); + result->hitNum = i + 1; + result->dirNamesNum = i + 1; // to confirm + result->setNum = i + 1; // to confirm + } + } + } else { // Need a game to test. + strncpy(result->dirNames[0].data, cond->dirName->data, 32); + result->hitNum = 1; + result->dirNamesNum = 1; // to confirm + result->setNum = 1; // to confirm + } + } else { + result->hitNum = 0; + result->dirNamesNum = 0; + result->setNum = 0; + } + if (result->infos != nullptr) { + result->infos->blocks = ORBIS_SAVE_DATA_BLOCK_SIZE; + result->infos->freeBlocks = ORBIS_SAVE_DATA_BLOCK_SIZE; + } return ORBIS_OK; } diff --git a/src/emulator.cpp b/src/emulator.cpp index 91d92cd6..4e669e08 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -114,15 +114,11 @@ void Emulator::Run(const std::filesystem::path& file) { std::filesystem::path sce_module_folder = file.parent_path() / "sce_module"; if (std::filesystem::is_directory(sce_module_folder)) { for (const auto& entry : std::filesystem::directory_iterator(sce_module_folder)) { - if (entry.path().filename() == "libc.prx" || - entry.path().filename() == "libSceFios2.prx" || - entry.path().filename() == "libSceAudioLatencyEstimation.prx" || - entry.path().filename() == "libSceJobManager.prx" || - entry.path().filename() == "libSceS3DConversion.prx") { + if (entry.path().filename() == "libc.prx") { found = true; - LOG_INFO(Loader, "Loading {}", entry.path().string().c_str()); - linker->LoadModule(entry.path()); } + LOG_INFO(Loader, "Loading {}", entry.path().string().c_str()); + linker->LoadModule(entry.path()); } } } diff --git a/src/video_core/renderer_vulkan/liverpool_to_vk.cpp b/src/video_core/renderer_vulkan/liverpool_to_vk.cpp index f361fcad..954b6870 100644 --- a/src/video_core/renderer_vulkan/liverpool_to_vk.cpp +++ b/src/video_core/renderer_vulkan/liverpool_to_vk.cpp @@ -445,6 +445,10 @@ vk::Format SurfaceFormat(AmdGpu::DataFormat data_format, AmdGpu::NumberFormat nu num_format == AmdGpu::NumberFormat::Unorm) { return vk::Format::eR16G16B16A16Unorm; } + if (data_format == AmdGpu::DataFormat::Format16_16 && + num_format == AmdGpu::NumberFormat::Uint) { + return vk::Format::eR16G16Uint; + } if (data_format == AmdGpu::DataFormat::Format8 && num_format == AmdGpu::NumberFormat::Uint) { return vk::Format::eR8Uint; }