diff --git a/src/core/libraries/np/np_common.cpp b/src/core/libraries/np/np_common.cpp index e95cf3322..59a258edd 100644 --- a/src/core/libraries/np/np_common.cpp +++ b/src/core/libraries/np/np_common.cpp @@ -390,6 +390,17 @@ s32 PS4_SYSV_ABI sceNpIntIsValidOnlineId(const OrbisNpOnlineId* id) { return 1; } +void PS4_SYSV_ABI sceNpGetSdkVersion(char* version_buf) { + LOG_DEBUG(Lib_NpCommon, "called"); + // Real library has no parameter checks, so I guess this is purely for internal use? + Libraries::Kernel::SwVersionStruct sw_version{}; + sw_version.struct_size = 0x28; + Libraries::Kernel::sceKernelGetSystemSwVersion(&sw_version); + u32 sw_hex = sw_version.hex_representation; + snprintf(version_buf, 8, "%d.%02d", ((sw_hex >> 0x18) & 0xf) + ((sw_hex >> 0x1c) * 10), + ((sw_hex >> 0x10) & 0xf) + (((sw_hex >> 0x14) & 0xf) * 10)); +} + s32 PS4_SYSV_ABI sceNpCalloutInitCtx(OrbisNpCalloutContext* callout_ctx, const char* name, u64 stack_size, s32 priority, u64 affinity_mask) { LOG_DEBUG(Lib_NpCommon, "ctx={:p} name={:p} stack={:#x} priority={} affinity={:#x}", @@ -600,6 +611,7 @@ void RegisterLib(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("ss2xO9IJxKQ", "libSceNpCommon", 1, "libSceNpCommon", sceNpCondTimedwait); LIB_FUNCTION("uEwag-0YZPc", "libSceNpCommon", 1, "libSceNpCommon", sceNpMutexInit); LIB_FUNCTION("uMJFOA62mVU", "libSceNpCommon", 1, "libSceNpCommon", sceNpCondSignal); + LIB_FUNCTION("Pglk7zFj0DI", "libSceNpCommon", 1, "libSceNpCommon", sceNpGetSdkVersion); }; } // namespace Libraries::Np::NpCommon diff --git a/src/core/libraries/np/np_common.h b/src/core/libraries/np/np_common.h index 7ff5a81c0..9f28d1649 100644 --- a/src/core/libraries/np/np_common.h +++ b/src/core/libraries/np/np_common.h @@ -62,6 +62,7 @@ u32 PS4_SYSV_ABI sceNpJoinThread(Libraries::Kernel::PthreadT thread, void** ret) s32 PS4_SYSV_ABI sceNpGetSystemClockUsec(s64* usec); s32 PS4_SYSV_ABI sceNpGetPlatformType(const OrbisNpId* np_id); s32 PS4_SYSV_ABI sceNpIntIsValidOnlineId(const OrbisNpOnlineId* id); +void PS4_SYSV_ABI sceNpGetSdkVersion(char* version_buf); s32 PS4_SYSV_ABI sceNpCalloutInitCtx(OrbisNpCalloutContext* ctx, const char* name, u64 stack_size, s32 priority, u64 affinity_mask); s32 PS4_SYSV_ABI sceNpCalloutStartOnCtx(OrbisNpCalloutContext* ctx, OrbisNpCalloutEntry* callout,