Proper check for double init (#4419)

This commit is contained in:
Stephen Miller 2026-05-14 20:18:16 -05:00 committed by GitHub
parent a5885435d6
commit 85b6f5f505
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View File

@ -5,12 +5,14 @@
#include "app_content.h"
#include "common/assert.h"
#include "common/elf_info.h"
#include "common/logging/log.h"
#include "common/singleton.h"
#include "core/emulator_settings.h"
#include "core/file_format/psf.h"
#include "core/file_sys/fs.h"
#include "core/libraries/app_content/app_content_error.h"
#include "core/libraries/kernel/process.h"
#include "core/libraries/libs.h"
#include "core/libraries/system/systemservice.h"
@ -29,8 +31,10 @@ static std::array<AddContInfo, ORBIS_APP_CONTENT_INFO_LIST_MAX_SIZE> addcont_inf
0x00}},
}};
static s32 sdk_ver = 0;
static s32 addcont_count = 0;
static std::string title_id;
static bool is_initialized = false;
int PS4_SYSV_ABI _Z5dummyv() {
LOG_ERROR(Lib_AppContent, "(STUBBED) called");
@ -279,7 +283,13 @@ int PS4_SYSV_ABI sceAppContentGetRegion() {
int PS4_SYSV_ABI sceAppContentInitialize(const OrbisAppContentInitParam* initParam,
OrbisAppContentBootParam* bootParam) {
LOG_ERROR(Lib_AppContent, "(DUMMY) called");
if (sdk_ver >= Common::ElfInfo::FW_15 && is_initialized) {
LOG_ERROR(Lib_AppContent, "Already initialized");
return ORBIS_APP_CONTENT_ERROR_BUSY;
}
LOG_WARNING(Lib_AppContent, "(DUMMY) called");
is_initialized = true;
auto* param_sfo = Common::Singleton<PSF>::Instance();
const auto addons_dir = EmulatorSettings.GetAddonInstallDir();
@ -449,6 +459,9 @@ int PS4_SYSV_ABI sceAppContentGetDownloadedStoreCountry() {
}
void RegisterLib(Core::Loader::SymbolsResolver* sym) {
ASSERT_MSG(Libraries::Kernel::sceKernelGetCompiledSdkVersion(&sdk_ver) == 0,
"Failed to get SDK version");
LIB_FUNCTION("AS45QoYHjc4", "libSceAppContent", 1, "libSceAppContentUtil", _Z5dummyv);
LIB_FUNCTION("ZiATpP9gEkA", "libSceAppContent", 1, "libSceAppContentUtil",
sceAppContentAddcontDelete);

View File

@ -7,5 +7,6 @@
// AppContent library
constexpr int ORBIS_APP_CONTENT_ERROR_PARAMETER = 0x80D90002;
constexpr int ORBIS_APP_CONTENT_ERROR_BUSY = 0x80D90003;
constexpr int ORBIS_APP_CONTENT_ERROR_DRM_NO_ENTITLEMENT = 0x80D90007;
constexpr int ORBIS_APP_CONTENT_ERROR_NOT_FOUND = 0x80D90005;