mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-28 18:46:06 +00:00
playgo: Fix loading PlayGo file. (#1639)
This commit is contained in:
parent
394a14626b
commit
b00a321b5e
|
@ -97,7 +97,6 @@ struct PlaygoChunk {
|
||||||
|
|
||||||
class PlaygoFile {
|
class PlaygoFile {
|
||||||
public:
|
public:
|
||||||
bool initialized = false;
|
|
||||||
OrbisPlayGoHandle handle = 0;
|
OrbisPlayGoHandle handle = 0;
|
||||||
OrbisPlayGoChunkId id = 0;
|
OrbisPlayGoChunkId id = 0;
|
||||||
OrbisPlayGoLocus locus = OrbisPlayGoLocus::NotDownloaded;
|
OrbisPlayGoLocus locus = OrbisPlayGoLocus::NotDownloaded;
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
#include "common/singleton.h"
|
||||||
#include "core/file_format/playgo_chunk.h"
|
#include "core/file_format/playgo_chunk.h"
|
||||||
|
#include "core/file_sys/fs.h"
|
||||||
#include "core/libraries/error_codes.h"
|
#include "core/libraries/error_codes.h"
|
||||||
#include "core/libraries/libs.h"
|
#include "core/libraries/libs.h"
|
||||||
#include "core/libraries/system/systemservice.h"
|
#include "core/libraries/system/systemservice.h"
|
||||||
|
@ -29,10 +31,9 @@ s32 PS4_SYSV_ABI scePlayGoClose(OrbisPlayGoHandle handle) {
|
||||||
if (handle != PlaygoHandle) {
|
if (handle != PlaygoHandle) {
|
||||||
return ORBIS_PLAYGO_ERROR_BAD_HANDLE;
|
return ORBIS_PLAYGO_ERROR_BAD_HANDLE;
|
||||||
}
|
}
|
||||||
if (!playgo->initialized) {
|
if (!playgo) {
|
||||||
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
playgo.reset();
|
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ s32 PS4_SYSV_ABI scePlayGoGetInstallSpeed(OrbisPlayGoHandle handle,
|
||||||
if (outSpeed == nullptr) {
|
if (outSpeed == nullptr) {
|
||||||
return ORBIS_PLAYGO_ERROR_BAD_POINTER;
|
return ORBIS_PLAYGO_ERROR_BAD_POINTER;
|
||||||
}
|
}
|
||||||
if (!playgo->initialized) {
|
if (!playgo) {
|
||||||
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +127,7 @@ s32 PS4_SYSV_ABI scePlayGoGetLanguageMask(OrbisPlayGoHandle handle,
|
||||||
if (outLanguageMask == nullptr) {
|
if (outLanguageMask == nullptr) {
|
||||||
return ORBIS_PLAYGO_ERROR_BAD_POINTER;
|
return ORBIS_PLAYGO_ERROR_BAD_POINTER;
|
||||||
}
|
}
|
||||||
if (!playgo->initialized) {
|
if (!playgo) {
|
||||||
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ s32 PS4_SYSV_ABI scePlayGoGetLocus(OrbisPlayGoHandle handle, const OrbisPlayGoCh
|
||||||
if (numberOfEntries == 0) {
|
if (numberOfEntries == 0) {
|
||||||
return ORBIS_PLAYGO_ERROR_BAD_SIZE;
|
return ORBIS_PLAYGO_ERROR_BAD_SIZE;
|
||||||
}
|
}
|
||||||
if (!playgo->initialized) {
|
if (!playgo) {
|
||||||
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
if (playgo->GetPlaygoHeader().file_size == 0) {
|
if (playgo->GetPlaygoHeader().file_size == 0) {
|
||||||
|
@ -180,7 +181,7 @@ s32 PS4_SYSV_ABI scePlayGoGetProgress(OrbisPlayGoHandle handle, const OrbisPlayG
|
||||||
if (numberOfEntries == 0) {
|
if (numberOfEntries == 0) {
|
||||||
return ORBIS_PLAYGO_ERROR_BAD_SIZE;
|
return ORBIS_PLAYGO_ERROR_BAD_SIZE;
|
||||||
}
|
}
|
||||||
if (!playgo->initialized) {
|
if (!playgo) {
|
||||||
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
if (playgo->GetPlaygoHeader().file_size == 0) {
|
if (playgo->GetPlaygoHeader().file_size == 0) {
|
||||||
|
@ -219,7 +220,7 @@ s32 PS4_SYSV_ABI scePlayGoGetToDoList(OrbisPlayGoHandle handle, OrbisPlayGoToDo*
|
||||||
if (numberOfEntries == 0) {
|
if (numberOfEntries == 0) {
|
||||||
return ORBIS_PLAYGO_ERROR_BAD_SIZE;
|
return ORBIS_PLAYGO_ERROR_BAD_SIZE;
|
||||||
}
|
}
|
||||||
if (!playgo->initialized) {
|
if (!playgo) {
|
||||||
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
*outEntries = 0; // nothing to do
|
*outEntries = 0; // nothing to do
|
||||||
|
@ -242,17 +243,24 @@ s32 PS4_SYSV_ABI scePlayGoInitialize(OrbisPlayGoInitParams* param) {
|
||||||
if (param->bufSize < 0x200000) {
|
if (param->bufSize < 0x200000) {
|
||||||
return ORBIS_PLAYGO_ERROR_BAD_SIZE;
|
return ORBIS_PLAYGO_ERROR_BAD_SIZE;
|
||||||
}
|
}
|
||||||
|
if (playgo) {
|
||||||
|
return ORBIS_PLAYGO_ERROR_ALREADY_INITIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace SystemService;
|
||||||
|
|
||||||
playgo = std::make_unique<PlaygoFile>();
|
playgo = std::make_unique<PlaygoFile>();
|
||||||
if (!playgo->initialized) {
|
|
||||||
using namespace SystemService;
|
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||||
|
const auto file_path = mnt->GetHostPath("/app0/sce_sys/playgo-chunk.dat");
|
||||||
|
if (!playgo->Open(file_path)) {
|
||||||
|
LOG_WARNING(Lib_PlayGo, "Could not open PlayGo file");
|
||||||
|
}
|
||||||
|
|
||||||
s32 system_lang = 0;
|
s32 system_lang = 0;
|
||||||
sceSystemServiceParamGetInt(OrbisSystemServiceParamId::Lang, &system_lang);
|
sceSystemServiceParamGetInt(OrbisSystemServiceParamId::Lang, &system_lang);
|
||||||
playgo->langMask = scePlayGoConvertLanguage(system_lang);
|
playgo->langMask = scePlayGoConvertLanguage(system_lang);
|
||||||
playgo->initialized = true;
|
|
||||||
} else {
|
|
||||||
return ORBIS_PLAYGO_ERROR_ALREADY_INITIALIZED;
|
|
||||||
}
|
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +273,7 @@ s32 PS4_SYSV_ABI scePlayGoOpen(OrbisPlayGoHandle* outHandle, const void* param)
|
||||||
if (param) {
|
if (param) {
|
||||||
return ORBIS_PLAYGO_ERROR_INVALID_ARGUMENT;
|
return ORBIS_PLAYGO_ERROR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
if (!playgo->initialized) {
|
if (!playgo) {
|
||||||
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
if (playgo->GetPlaygoHeader().file_size == 0) {
|
if (playgo->GetPlaygoHeader().file_size == 0) {
|
||||||
|
@ -289,7 +297,7 @@ s32 PS4_SYSV_ABI scePlayGoPrefetch(OrbisPlayGoHandle handle, const OrbisPlayGoCh
|
||||||
if (numberOfEntries == 0) {
|
if (numberOfEntries == 0) {
|
||||||
return ORBIS_PLAYGO_ERROR_BAD_SIZE;
|
return ORBIS_PLAYGO_ERROR_BAD_SIZE;
|
||||||
}
|
}
|
||||||
if (!playgo->initialized) {
|
if (!playgo) {
|
||||||
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +318,7 @@ s32 PS4_SYSV_ABI scePlayGoSetInstallSpeed(OrbisPlayGoHandle handle, OrbisPlayGoI
|
||||||
if (handle != PlaygoHandle) {
|
if (handle != PlaygoHandle) {
|
||||||
return ORBIS_PLAYGO_ERROR_BAD_HANDLE;
|
return ORBIS_PLAYGO_ERROR_BAD_HANDLE;
|
||||||
}
|
}
|
||||||
if (!playgo->initialized) {
|
if (!playgo) {
|
||||||
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +347,7 @@ s32 PS4_SYSV_ABI scePlayGoSetLanguageMask(OrbisPlayGoHandle handle,
|
||||||
if (handle != 1) {
|
if (handle != 1) {
|
||||||
return ORBIS_PLAYGO_ERROR_BAD_HANDLE;
|
return ORBIS_PLAYGO_ERROR_BAD_HANDLE;
|
||||||
}
|
}
|
||||||
if (!playgo->initialized) {
|
if (!playgo) {
|
||||||
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +368,7 @@ s32 PS4_SYSV_ABI scePlayGoSetToDoList(OrbisPlayGoHandle handle, const OrbisPlayG
|
||||||
if (numberOfEntries == 0) {
|
if (numberOfEntries == 0) {
|
||||||
return ORBIS_PLAYGO_ERROR_BAD_SIZE;
|
return ORBIS_PLAYGO_ERROR_BAD_SIZE;
|
||||||
}
|
}
|
||||||
if (!playgo->initialized) {
|
if (!playgo) {
|
||||||
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
|
@ -369,11 +377,10 @@ s32 PS4_SYSV_ABI scePlayGoSetToDoList(OrbisPlayGoHandle handle, const OrbisPlayG
|
||||||
s32 PS4_SYSV_ABI scePlayGoTerminate() {
|
s32 PS4_SYSV_ABI scePlayGoTerminate() {
|
||||||
LOG_INFO(Lib_PlayGo, "called");
|
LOG_INFO(Lib_PlayGo, "called");
|
||||||
|
|
||||||
if (playgo->initialized) {
|
if (!playgo) {
|
||||||
playgo->initialized = false;
|
|
||||||
} else {
|
|
||||||
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
return ORBIS_PLAYGO_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
playgo.reset();
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
#include "common/version.h"
|
#include "common/version.h"
|
||||||
#include "core/file_format/playgo_chunk.h"
|
|
||||||
#include "core/file_format/psf.h"
|
#include "core/file_format/psf.h"
|
||||||
#include "core/file_format/splash.h"
|
#include "core/file_format/splash.h"
|
||||||
#include "core/file_format/trp.h"
|
#include "core/file_format/trp.h"
|
||||||
|
@ -157,12 +156,6 @@ void Emulator::Run(const std::filesystem::path& file) {
|
||||||
fw_version = param_sfo->GetInteger("SYSTEM_VER").value_or(0x4700000);
|
fw_version = param_sfo->GetInteger("SYSTEM_VER").value_or(0x4700000);
|
||||||
app_version = param_sfo->GetString("APP_VER").value_or("Unknown version");
|
app_version = param_sfo->GetString("APP_VER").value_or("Unknown version");
|
||||||
LOG_INFO(Loader, "Fw: {:#x} App Version: {}", fw_version, app_version);
|
LOG_INFO(Loader, "Fw: {:#x} App Version: {}", fw_version, app_version);
|
||||||
} else if (entry.path().filename() == "playgo-chunk.dat") {
|
|
||||||
auto* playgo = Common::Singleton<PlaygoFile>::Instance();
|
|
||||||
auto filepath = sce_sys_folder / "playgo-chunk.dat";
|
|
||||||
if (!playgo->Open(filepath)) {
|
|
||||||
LOG_ERROR(Loader, "PlayGo: unable to open file");
|
|
||||||
}
|
|
||||||
} else if (entry.path().filename() == "pic1.png") {
|
} else if (entry.path().filename() == "pic1.png") {
|
||||||
auto* splash = Common::Singleton<Splash>::Instance();
|
auto* splash = Common::Singleton<Splash>::Instance();
|
||||||
if (splash->IsLoaded()) {
|
if (splash->IsLoaded()) {
|
||||||
|
|
Loading…
Reference in a new issue