mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-23 03:50:10 +00:00
SaveData: Implemented the SystemSaveData archive.
It will be stored in the /syssavedata folder. This archive is user by various Services and possibly games via the FS:U service.
This commit is contained in:
parent
94a103a000
commit
bec527fa24
@ -42,6 +42,7 @@
|
||||
#define SDMC_DIR "sdmc"
|
||||
#define SAVEDATA_DIR "savedata"
|
||||
#define SYSDATA_DIR "sysdata"
|
||||
#define SYSSAVEDATA_DIR "syssavedata"
|
||||
#define SHADERCACHE_DIR "shader_cache"
|
||||
#define STATESAVES_DIR "state_saves"
|
||||
#define SCREENSHOTS_DIR "screenShots"
|
||||
|
@ -678,6 +678,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
|
||||
paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP;
|
||||
paths[D_SAVEDATA_IDX] = paths[D_USER_IDX] + SAVEDATA_DIR DIR_SEP;
|
||||
paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP;
|
||||
paths[D_SYSSAVEDATA_IDX] = paths[D_USER_IDX] + SYSSAVEDATA_DIR DIR_SEP;
|
||||
paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
|
||||
paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
|
||||
paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
|
||||
@ -720,6 +721,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
|
||||
paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
|
||||
paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP;
|
||||
paths[D_SAVEDATA_IDX] = paths[D_USER_IDX] + SAVEDATA_DIR DIR_SEP;
|
||||
paths[D_SYSSAVEDATA_IDX] = paths[D_USER_IDX] + SYSSAVEDATA_DIR DIR_SEP;
|
||||
paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
|
||||
paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
|
||||
paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
|
||||
|
@ -29,6 +29,7 @@ enum {
|
||||
D_SDMC_IDX,
|
||||
D_SAVEDATA_IDX,
|
||||
D_SYSDATA_IDX,
|
||||
D_SYSSAVEDATA_IDX,
|
||||
D_HIRESTEXTURES_IDX,
|
||||
D_DUMP_IDX,
|
||||
D_DUMPFRAMES_IDX,
|
||||
|
@ -20,6 +20,7 @@ set(SRCS
|
||||
file_sys/archive_romfs.cpp
|
||||
file_sys/archive_savedata.cpp
|
||||
file_sys/archive_sdmc.cpp
|
||||
file_sys/archive_systemsavedata.cpp
|
||||
file_sys/disk_archive.cpp
|
||||
file_sys/file_romfs.cpp
|
||||
file_sys/directory_romfs.cpp
|
||||
@ -101,6 +102,7 @@ set(HEADERS
|
||||
file_sys/archive_romfs.h
|
||||
file_sys/archive_savedata.h
|
||||
file_sys/archive_sdmc.h
|
||||
file_sys/archive_systemsavedata.h
|
||||
file_sys/disk_archive.h
|
||||
file_sys/file_backend.h
|
||||
file_sys/file_romfs.h
|
||||
|
@ -21,8 +21,7 @@ public:
|
||||
|
||||
/**
|
||||
* Initialize the archive.
|
||||
* @return CreateSaveDataResult AlreadyExists if the SaveData folder already exists,
|
||||
* Success if it was created properly and Failure if there was any error
|
||||
* @return true if it initialized successfully
|
||||
*/
|
||||
bool Initialize();
|
||||
|
||||
|
33
src/core/file_sys/archive_systemsavedata.cpp
Normal file
33
src/core/file_sys/archive_systemsavedata.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright 2014 Citra Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/file_util.h"
|
||||
|
||||
#include "core/file_sys/archive_systemsavedata.h"
|
||||
#include "core/file_sys/disk_archive.h"
|
||||
#include "core/settings.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FileSys namespace
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
Archive_SystemSaveData::Archive_SystemSaveData(const std::string& mount_point)
|
||||
: DiskArchive(mount_point) {
|
||||
LOG_INFO(Service_FS, "Directory %s set as SystemSaveData.", this->mount_point.c_str());
|
||||
}
|
||||
|
||||
bool Archive_SystemSaveData::Initialize() {
|
||||
if (!FileUtil::CreateFullPath(mount_point)) {
|
||||
LOG_ERROR(Service_FS, "Unable to create SystemSaveData path.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace FileSys
|
31
src/core/file_sys/archive_systemsavedata.h
Normal file
31
src/core/file_sys/archive_systemsavedata.h
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright 2014 Citra Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
#include "core/file_sys/disk_archive.h"
|
||||
#include "core/loader/loader.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FileSys namespace
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
/// File system interface to the SaveData archive
|
||||
class Archive_SystemSaveData final : public DiskArchive {
|
||||
public:
|
||||
Archive_SystemSaveData(const std::string& mount_point);
|
||||
|
||||
/**
|
||||
* Initialize the archive.
|
||||
* @return true if it initialized successfully
|
||||
*/
|
||||
bool Initialize();
|
||||
|
||||
std::string GetName() const override { return "SystemSaveData"; }
|
||||
};
|
||||
|
||||
} // namespace FileSys
|
@ -419,6 +419,15 @@ void ArchiveInit() {
|
||||
CreateArchive(std::move(sdmc_archive), ArchiveIdCode::SDMC);
|
||||
else
|
||||
LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str());
|
||||
|
||||
std::string systemsavedata_directory = FileUtil::GetUserPath(D_SYSSAVEDATA_IDX);
|
||||
auto systemsavedata_archive = std::make_unique<FileSys::Archive_SDMC>(systemsavedata_directory);
|
||||
if (systemsavedata_archive->Initialize()) {
|
||||
CreateArchive(std::move(sdmc_archive), ArchiveIdCode::SystemSaveData);
|
||||
} else {
|
||||
LOG_ERROR(Service_FS, "Can't instantiate SystemSaveData archive with path %s",
|
||||
systemsavedata_directory.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
/// Shutdown archives
|
||||
|
Loading…
Reference in New Issue
Block a user