app_content: Implement TemporaryData mount and unmount (#5426)

This commit is contained in:
Marcin Mitura authored and GitHub committed 2026-10-18 09:19:22 -07:00
1 parent ba1320f38b
commit 0ebea15c24
3 files changed
+33 -6

No files matched your search

+32 -4
View File
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include <cmath>
#include <cstring>
#include "app_content.h"
#include "common/assert.h"
@@ -475,19 +476,46 @@ int PS4_SYSV_ABI sceAppContentTemporaryDataMount(OrbisAppContentMountPoint* moun
int PS4_SYSV_ABI sceAppContentTemporaryDataMount2(OrbisAppContentTemporaryDataOption option,
OrbisAppContentMountPoint* mountPoint) {
if (!is_initialized) {
return ORBIS_APP_CONTENT_ERROR_NOT_INITIALIZED;
}
if (mountPoint == nullptr) {
return ORBIS_APP_CONTENT_ERROR_PARAMETER;
}
auto* param_sfo = Common::Singleton<PSF>::Instance();
const auto tid = !title_id.empty() ? title_id : param_sfo->GetString("TITLE_ID").value_or("");
const auto mount_temp_dir = Common::FS::GetUserPath(Common::FS::PathType::TempDataDir) / tid;
std::error_code ec;
if (option == ORBIS_APP_CONTENT_TEMPORARY_DATA_OPTION_FORMAT) {
std::filesystem::remove_all(mount_temp_dir, ec);
}
std::filesystem::create_directories(mount_temp_dir, ec);
static constexpr std::string_view TmpMount = "/temp0";
TmpMount.copy(mountPoint->data, TmpMount.size());
mountPoint->data[TmpMount.size()] = '\0';
LOG_INFO(Lib_AppContent, "sceAppContentTemporaryDataMount2: option = {}, mountPoint = {}",
option, mountPoint->data);
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
mnt->Mount(mount_temp_dir, std::string{TmpMount});
LOG_INFO(Lib_AppContent, "option = {}, mountPoint = {}", option, mountPoint->data);
return ORBIS_OK;
}
int PS4_SYSV_ABI sceAppContentTemporaryDataUnmount() {
LOG_ERROR(Lib_AppContent, "(STUBBED) called");
int PS4_SYSV_ABI sceAppContentTemporaryDataUnmount(const OrbisAppContentMountPoint* mountPoint) {
if (!is_initialized) {
return ORBIS_APP_CONTENT_ERROR_NOT_INITIALIZED;
}
if (mountPoint == nullptr) {
return ORBIS_APP_CONTENT_ERROR_PARAMETER;
}
const std::string_view mp{mountPoint->data,
strnlen(mountPoint->data, sizeof(mountPoint->data))};
LOG_INFO(Lib_AppContent, "mountPoint = {}", mp);
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
mnt->Unmount(std::string{mp});
return ORBIS_OK;
}
+1 -1
View File
@@ -111,7 +111,7 @@ int PS4_SYSV_ABI sceAppContentTemporaryDataGetAvailableSpaceKb(
int PS4_SYSV_ABI sceAppContentTemporaryDataMount(OrbisAppContentMountPoint* mountPoint);
int PS4_SYSV_ABI sceAppContentTemporaryDataMount2(OrbisAppContentTemporaryDataOption option,
OrbisAppContentMountPoint* mountPoint);
int PS4_SYSV_ABI sceAppContentTemporaryDataUnmount();
int PS4_SYSV_ABI sceAppContentTemporaryDataUnmount(const OrbisAppContentMountPoint* mountPoint);
int PS4_SYSV_ABI sceAppContentGetPftFlag();
int PS4_SYSV_ABI Func_C59A36FF8D7C59DA();
int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownloadByEntitlementId();
-1
View File
@@ -618,7 +618,6 @@ void Emulator::Run(std::filesystem::path file, std::vector<std::string> args,
std::filesystem::remove_all(mount_temp_dir);
}
std::filesystem::create_directory(mount_temp_dir);
mnt->Mount(mount_temp_dir, "/temp0");
mnt->Mount(mount_temp_dir, "/temp");
const auto& mount_download_dir =