From 78e301c3db87cf517a4bde5542e397ff803859ce Mon Sep 17 00:00:00 2001 From: TheThunderTurner <64212185+thethunderturner@users.noreply.github.com> Date: Sat, 29 Nov 2025 22:47:15 +0100 Subject: [PATCH 1/4] libSceNpCommerce (#3839) * libSceNpCommerce * copyright notice --- CMakeLists.txt | 2 + src/common/logging/filter.cpp | 1 + src/common/logging/types.h | 1 + src/core/libraries/libs.cpp | 2 + src/core/libraries/np/np_commerce.cpp | 88 +++++++++++++++++++++++++++ src/core/libraries/np/np_commerce.h | 16 +++++ 6 files changed, 110 insertions(+) create mode 100644 src/core/libraries/np/np_commerce.cpp create mode 100644 src/core/libraries/np/np_commerce.h diff --git a/CMakeLists.txt b/CMakeLists.txt index cf78e92bf..04534ec26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -573,6 +573,8 @@ set(VDEC_LIB src/core/libraries/videodec/videodec2_impl.cpp set(NP_LIBS src/core/libraries/np/np_error.h src/core/libraries/np/np_common.cpp src/core/libraries/np/np_common.h + src/core/libraries/np/np_commerce.cpp + src/core/libraries/np/np_commerce.h src/core/libraries/np/np_manager.cpp src/core/libraries/np/np_manager.h src/core/libraries/np/np_score.cpp diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp index bf6844c7d..fd8386aff 100644 --- a/src/common/logging/filter.cpp +++ b/src/common/logging/filter.cpp @@ -104,6 +104,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) { SUB(Lib, Move) \ SUB(Lib, NpAuth) \ SUB(Lib, NpCommon) \ + SUB(Lib, NpCommerce) \ SUB(Lib, NpManager) \ SUB(Lib, NpScore) \ SUB(Lib, NpTrophy) \ diff --git a/src/common/logging/types.h b/src/common/logging/types.h index 035a959db..82db477ed 100644 --- a/src/common/logging/types.h +++ b/src/common/logging/types.h @@ -70,6 +70,7 @@ enum class Class : u8 { Lib_Http2, ///< The LibSceHttp2 implementation. Lib_SysModule, ///< The LibSceSysModule implementation Lib_NpCommon, ///< The LibSceNpCommon implementation + Lib_NpCommerce, ///< The LibSceNpCommerce implementation Lib_NpAuth, ///< The LibSceNpAuth implementation Lib_NpManager, ///< The LibSceNpManager implementation Lib_NpScore, ///< The LibSceNpScore implementation diff --git a/src/core/libraries/libs.cpp b/src/core/libraries/libs.cpp index eec9ee7c8..1f7ecb75e 100644 --- a/src/core/libraries/libs.cpp +++ b/src/core/libraries/libs.cpp @@ -32,6 +32,7 @@ #include "core/libraries/network/ssl.h" #include "core/libraries/network/ssl2.h" #include "core/libraries/np/np_auth.h" +#include "core/libraries/np/np_commerce.h" #include "core/libraries/np/np_common.h" #include "core/libraries/np/np_manager.h" #include "core/libraries/np/np_party.h" @@ -93,6 +94,7 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) { Libraries::SysModule::RegisterLib(sym); Libraries::Posix::RegisterLib(sym); Libraries::AudioIn::RegisterLib(sym); + Libraries::Np::NpCommerce::RegisterLib(sym); Libraries::Np::NpCommon::RegisterLib(sym); Libraries::Np::NpManager::RegisterLib(sym); Libraries::Np::NpScore::RegisterLib(sym); diff --git a/src/core/libraries/np/np_commerce.cpp b/src/core/libraries/np/np_commerce.cpp new file mode 100644 index 000000000..1e8440ec0 --- /dev/null +++ b/src/core/libraries/np/np_commerce.cpp @@ -0,0 +1,88 @@ +// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" +#include "core/libraries/libs.h" + +namespace Libraries::Np::NpCommerce { +s32 PS4_SYSV_ABI sceNpCommerceDialogClose() { + LOG_ERROR(Lib_NpCommerce, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpCommerceDialogGetResult(s32* result) { + LOG_ERROR(Lib_NpCommerce, "(STUBBED) called"); + return ORBIS_OK; +} + +s8 PS4_SYSV_ABI sceNpCommerceDialogGetStatus() { + LOG_ERROR(Lib_NpCommerce, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpCommerceDialogInitialize() { + LOG_ERROR(Lib_NpCommerce, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpCommerceDialogInitializeInternal() { + LOG_ERROR(Lib_NpCommerce, "(STUBBED) called"); + return ORBIS_OK; +} + +s16 PS4_SYSV_ABI sceNpCommerceDialogOpen(s64 check) { + LOG_ERROR(Lib_NpCommerce, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpCommerceDialogTerminate() { + LOG_ERROR(Lib_NpCommerce, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpCommerceDialogUpdateStatus() { + LOG_ERROR(Lib_NpCommerce, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpCommerceHidePsStoreIcon() { + LOG_ERROR(Lib_NpCommerce, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpCommerceSetPsStoreIconLayout(s32 layout) { + LOG_ERROR(Lib_NpCommerce, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpCommerceShowPsStoreIcon(s16 icon) { + LOG_ERROR(Lib_NpCommerce, "(STUBBED) called"); + return ORBIS_OK; +} + +void RegisterLib(Core::Loader::SymbolsResolver* sym) { + LIB_FUNCTION("NU3ckGHMFXo", "libSceNpCommerce", 1, "libSceNpCommerce", + sceNpCommerceDialogClose); + LIB_FUNCTION("r42bWcQbtZY", "libSceNpCommerce", 1, "libSceNpCommerce", + sceNpCommerceDialogGetResult); + LIB_FUNCTION("CCbC+lqqvF0", "libSceNpCommerce", 1, "libSceNpCommerce", + sceNpCommerceDialogGetStatus); + LIB_FUNCTION("0aR2aWmQal4", "libSceNpCommerce", 1, "libSceNpCommerce", + sceNpCommerceDialogInitialize); + LIB_FUNCTION("9ZiLXAGG5rg", "libSceNpCommerce", 1, "libSceNpCommerce", + sceNpCommerceDialogInitializeInternal); + LIB_FUNCTION("DfSCDRA3EjY", "libSceNpCommerce", 1, "libSceNpCommerce", sceNpCommerceDialogOpen); + LIB_FUNCTION("m-I92Ab50W8", "libSceNpCommerce", 1, "libSceNpCommerce", + sceNpCommerceDialogTerminate); + LIB_FUNCTION("LR5cwFMMCVE", "libSceNpCommerce", 1, "libSceNpCommerce", + sceNpCommerceDialogUpdateStatus); + LIB_FUNCTION("dsqCVsNM0Zg", "libSceNpCommerce", 1, "libSceNpCommerce", + sceNpCommerceHidePsStoreIcon); + LIB_FUNCTION("uKTDW8hk-ts", "libSceNpCommerce", 1, "libSceNpCommerce", + sceNpCommerceSetPsStoreIconLayout); + LIB_FUNCTION("DHmwsa6S8Tc", "libSceNpCommerce", 1, "libSceNpCommerce", + sceNpCommerceShowPsStoreIcon); +}; + +} // namespace Libraries::Np::NpCommerce diff --git a/src/core/libraries/np/np_commerce.h b/src/core/libraries/np/np_commerce.h new file mode 100644 index 000000000..003e85a58 --- /dev/null +++ b/src/core/libraries/np/np_commerce.h @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/types.h" + +namespace Core::Loader { +class SymbolsResolver; +} + +namespace Libraries::Np::NpCommerce { + +void RegisterLib(Core::Loader::SymbolsResolver* sym); + +} // namespace Libraries::Np::NpCommerce \ No newline at end of file From 052f3260f391491c29caac6133c2eeb8c236437f Mon Sep 17 00:00:00 2001 From: Connor Garey Date: Sun, 30 Nov 2025 17:57:14 +0000 Subject: [PATCH 2/4] Sdl message box when no args provided (#3843) * Added a message box when no arguments are passed. * clang-fix * clang-fix episode 2 * Output message box error to stderr instead of stdout --- src/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 4d05dfe5a..f1e5ce932 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include #include "functional" #include "iostream" #include "string" @@ -182,6 +183,10 @@ int main(int argc, char* argv[]) { }}}; if (argc == 1) { + if (!SDL_ShowSimpleMessageBox( + SDL_MESSAGEBOX_INFORMATION, "shadPS4", + "This is a CLI application. Please use the QTLauncher for a GUI.", nullptr)) + std::cerr << "Could not display SDL message box! Error: " << SDL_GetError() << "\n"; int dummy = 0; // one does not simply pass 0 directly arg_map.at("-h")(dummy); return -1; From cf866ab294469874e805561a36a7ef2948c43081 Mon Sep 17 00:00:00 2001 From: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com> Date: Sun, 30 Nov 2025 21:40:58 +0100 Subject: [PATCH 3/4] Don't bother trying to restart the emulator if sceSystemServiceLoadExec is called with an invalid path (#3845) --- src/core/libraries/system/systemservice.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/libraries/system/systemservice.cpp b/src/core/libraries/system/systemservice.cpp index c02c4b3c3..ce5542fc8 100644 --- a/src/core/libraries/system/systemservice.cpp +++ b/src/core/libraries/system/systemservice.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include #include "common/config.h" #include "common/logging/log.h" #include "common/singleton.h" @@ -1874,6 +1875,10 @@ int PS4_SYSV_ABI sceSystemServiceLoadExec(const char* path, const char* argv[]) auto emu = Common::Singleton::Instance(); auto mnt = Common::Singleton::Instance(); auto hostPath = mnt->GetHostPath(std::string_view(path)); + if (hostPath.empty()) { + LOG_INFO(Lib_SystemService, "Restart called with invalid file '{}', exiting.", path); + std::quick_exit(0); + } std::vector args; if (argv != nullptr) { for (const char** ptr = argv; *ptr != nullptr; ptr++) { From a5f928084123c2b4862bcc9c9977ffb7898f3734 Mon Sep 17 00:00:00 2001 From: Stephen Miller <56742918+StevenMiller123@users.noreply.github.com> Date: Mon, 1 Dec 2025 02:21:19 -0600 Subject: [PATCH 4/4] Return CPU mode based on param.sfo attributes (#3846) Values are based on hardware observations. --- src/core/libraries/kernel/process.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/libraries/kernel/process.cpp b/src/core/libraries/kernel/process.cpp index 02da041c3..e88446e02 100644 --- a/src/core/libraries/kernel/process.cpp +++ b/src/core/libraries/kernel/process.cpp @@ -42,6 +42,16 @@ s32 PS4_SYSV_ABI sceKernelGetCompiledSdkVersion(s32* ver) { } s32 PS4_SYSV_ABI sceKernelGetCpumode() { + LOG_DEBUG(Lib_Kernel, "called"); + auto& attrs = Common::ElfInfo::Instance().GetPSFAttributes(); + u32 is_cpu6 = attrs.six_cpu_mode.Value(); + u32 is_cpu7 = attrs.seven_cpu_mode.Value(); + if (is_cpu6 == 1 && is_cpu7 == 1) { + return 2; + } + if (is_cpu7 == 1) { + return 5; + } return 0; }