Merge pull request #281 from shadps4-emu/miscFixes6

Misc Fixes (forgot the number)
This commit is contained in:
georgemoralis 2024-07-19 16:35:19 +03:00 committed by GitHub
commit 60b1aa62a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 81 additions and 22 deletions

2
externals/fmt vendored

@ -1 +1 @@
Subproject commit a96259701e1d16e2f8c8299c668e863ec0ac0119
Subproject commit bc8d32e9643d2be5fc070abf2a50bc021544545d

2
externals/glslang vendored

@ -1 +1 @@
Subproject commit 5939e32b87487fa9c72ab336ebfcc5ae26d9ab6d
Subproject commit 52f68dc6b2a9d017b43161f31f13a6f44636ee7c

@ -1 +1 @@
Subproject commit ec1adc5763f684e0f32888b157bfc0b86021b8e9
Subproject commit 664ee62c12570948b0e025d15b42d641fba8d54a

2
externals/vma vendored

@ -1 +1 @@
Subproject commit 257138b8f5686ae84491a3df9f90a77d5660c3bd
Subproject commit 871913da6a4b132b567d7b65c509600363c0041e

@ -1 +1 @@
Subproject commit 190d2cb24e90e5bf2bec0a75604a9b3586485b6d
Subproject commit b379292b2ab6df5771ba9870d53cf8b2c9295daf

@ -1 +1 @@
Subproject commit d937b60055aaea313422672ebd5cc8bfa87a1682
Subproject commit f00c973a6ab2a23573708568b8ef4acc20a9d36b

2
externals/xxhash vendored

@ -1 +1 @@
Subproject commit 805c00b68fa754200ada0c207ffeaa7a4409377c
Subproject commit a57f6cce2698049863af8c25787084ae0489d849

2
externals/zydis vendored

@ -1 +1 @@
Subproject commit 5a68f639e4f01604cc7bfc8d313f583a8137e3d3
Subproject commit 16c6a369c193981e9cf314126589eaa8763f92c3

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -92,6 +92,7 @@ struct PthreadCondInternal {
struct PthreadCondAttrInternal {
u8 reserved[64];
pthread_condattr_t cond_attr;
clockid_t clock;
};
struct PthreadRwLockAttrInternal {

View File

@ -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{};

View File

@ -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;
}

View File

@ -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());
}
}
}

View File

@ -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;
}