Added sceAppContentTemporaryDataMount2.

added /temp0 and /data mounts at emu start.
(Ghost Files: Memory of a Crime, Abyss: The Wraiths of Eden)
This commit is contained in:
raziel1000 2024-06-14 15:36:27 -06:00
parent 6d0dfdd82a
commit 99ef2d65a6
6 changed files with 40 additions and 5 deletions

View file

@ -34,6 +34,8 @@ static auto UserPaths = [] {
create_path(PathType::ShaderDir, user_dir / SHADER_DIR);
create_path(PathType::PM4Dir, user_dir / PM4_DIR);
create_path(PathType::SaveDataDir, user_dir / SAVEDATA_DIR);
create_path(PathType::GameDataDir, user_dir / GAMEDATA_DIR);
create_path(PathType::TempDataDir, user_dir / TEMPDATA_DIR);
create_path(PathType::SysModuleDir, user_dir / SYSMODULES_DIR);
return paths;

View file

@ -15,6 +15,8 @@ enum class PathType {
ShaderDir, // Where shaders are stored.
PM4Dir, // Where command lists are stored.
SaveDataDir, // Where guest save data is stored.
TempDataDir, // Where game temp data is stored.
GameDataDir, // Where game data is stored.
SysModuleDir, // Where system modules are stored.
};
@ -26,6 +28,8 @@ constexpr auto SCREENSHOTS_DIR = "screenshots";
constexpr auto SHADER_DIR = "shader";
constexpr auto PM4_DIR = "pm4";
constexpr auto SAVEDATA_DIR = "savedata";
constexpr auto GAMEDATA_DIR = "data";
constexpr auto TEMPDATA_DIR = "temp";
constexpr auto SYSMODULES_DIR = "sys_modules";
// Filenames

View file

@ -3,7 +3,12 @@
// Generated By moduleGenerator
#include <cmath>
#include <common/path_util.h>
#include <common/singleton.h>
#include <core/file_format/psf.h>
#include <core/file_sys/fs.h>
#include "app_content.h"
#include "common/io_file.h"
#include "common/logging/log.h"
#include "core/libraries/error_codes.h"
#include "core/libraries/libs.h"
@ -157,8 +162,15 @@ int PS4_SYSV_ABI sceAppContentTemporaryDataMount() {
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAppContentTemporaryDataMount2() {
LOG_ERROR(Lib_AppContent, "(STUBBED) called");
int PS4_SYSV_ABI sceAppContentTemporaryDataMount2(OrbisAppContentTemporaryDataOption option,
OrbisAppContentMountPoint* mountPoint) {
auto* param_sfo = Common::Singleton<PSF>::Instance();
std::string id(param_sfo->GetString("CONTENT_ID"), 7, 9);
const auto& mount_dir = Common::FS::GetUserPath(Common::FS::PathType::TempDataDir) / id;
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
mnt->Mount(mount_dir, mountPoint->data);
LOG_INFO(Lib_AppContent, "sceAppContentTemporaryDataMount2: option = {}, mountPoint = {}",
(option & 1), mountPoint->data);
return ORBIS_OK;
}

View file

@ -21,6 +21,13 @@ struct OrbisAppContentBootParam {
char reserved2[32];
};
typedef u32 OrbisAppContentTemporaryDataOption;
constexpr int ORBIS_APP_CONTENT_MOUNTPOINT_DATA_MAXSIZE = 16;
typedef struct OrbisAppContentMountPoint {
char data[ORBIS_APP_CONTENT_MOUNTPOINT_DATA_MAXSIZE];
} OrbisAppContentMountPoint;
int PS4_SYSV_ABI _Z5dummyv();
int PS4_SYSV_ABI sceAppContentAddcontDelete();
int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownload();
@ -51,7 +58,8 @@ int PS4_SYSV_ABI sceAppContentSmallSharedDataUnmount();
int PS4_SYSV_ABI sceAppContentTemporaryDataFormat();
int PS4_SYSV_ABI sceAppContentTemporaryDataGetAvailableSpaceKb();
int PS4_SYSV_ABI sceAppContentTemporaryDataMount();
int PS4_SYSV_ABI sceAppContentTemporaryDataMount2();
int PS4_SYSV_ABI sceAppContentTemporaryDataMount2(OrbisAppContentTemporaryDataOption option,
OrbisAppContentMountPoint* mountPoint);
int PS4_SYSV_ABI sceAppContentTemporaryDataUnmount();
int PS4_SYSV_ABI sceAppContentGetPftFlag();
int PS4_SYSV_ABI Func_C59A36FF8D7C59DA();

View file

@ -1147,7 +1147,7 @@ int PS4_SYSV_ABI posix_sched_get_priority_min() {
int PS4_SYSV_ABI posix_pthread_mutex_trylock(ScePthreadMutex* mutex) {
int result = scePthreadMutexTrylock(mutex);
if (result < 0) {
UNREACHABLE();
LOG_INFO(Kernel_Pthread, "posix_pthread_mutex_trylock: result = {}", result);
}
return result;
}

View file

@ -56,13 +56,14 @@ void Emulator::Run(const std::filesystem::path& file) {
mnt->Mount(file.parent_path(), "/app0");
// Loading param.sfo file if exists
std::string id;
std::filesystem::path sce_sys_folder = file.parent_path() / "sce_sys";
if (std::filesystem::is_directory(sce_sys_folder)) {
for (const auto& entry : std::filesystem::directory_iterator(sce_sys_folder)) {
if (entry.path().filename() == "param.sfo") {
auto* param_sfo = Common::Singleton<PSF>::Instance();
param_sfo->open(sce_sys_folder.string() + "/param.sfo", {});
std::string id(param_sfo->GetString("CONTENT_ID"), 7, 9);
id = std::string(param_sfo->GetString("CONTENT_ID"), 7, 9);
std::string title(param_sfo->GetString("TITLE"));
LOG_INFO(Loader, "Game id: {} Title: {}", id, title);
u32 fw_version = param_sfo->GetInteger("SYSTEM_VER");
@ -81,6 +82,14 @@ void Emulator::Run(const std::filesystem::path& file) {
}
}
const auto& mount_data_dir = Common::FS::GetUserPath(Common::FS::PathType::GameDataDir) / id;
if (!std::filesystem::exists(mount_data_dir)) {
std::filesystem::create_directory(mount_data_dir);
}
mnt->Mount(mount_data_dir, "/data"); // should just exist, manually create with game serial
const auto& mount_temp_dir = Common::FS::GetUserPath(Common::FS::PathType::TempDataDir) / id;
mnt->Mount(mount_temp_dir, "/temp0"); // called in app_content ==> stat/mkdir
// Load the module with the linker
linker->LoadModule(file);