mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 23:25:40 +12:00
Start implementing SystemSaveData
This commit is contained in:
parent
eade124f00
commit
c48f8327c6
6 changed files with 64 additions and 2 deletions
|
@ -148,7 +148,7 @@ set(PICA_SOURCE_FILES src/core/PICA/gpu.cpp src/core/PICA/regs.cpp src/core/PICA
|
||||||
set(LOADER_SOURCE_FILES src/core/loader/elf.cpp src/core/loader/ncsd.cpp src/core/loader/ncch.cpp src/core/loader/3dsx.cpp src/core/loader/lz77.cpp)
|
set(LOADER_SOURCE_FILES src/core/loader/elf.cpp src/core/loader/ncsd.cpp src/core/loader/ncch.cpp src/core/loader/3dsx.cpp src/core/loader/lz77.cpp)
|
||||||
set(FS_SOURCE_FILES src/core/fs/archive_self_ncch.cpp src/core/fs/archive_save_data.cpp src/core/fs/archive_sdmc.cpp
|
set(FS_SOURCE_FILES src/core/fs/archive_self_ncch.cpp src/core/fs/archive_save_data.cpp src/core/fs/archive_sdmc.cpp
|
||||||
src/core/fs/archive_ext_save_data.cpp src/core/fs/archive_ncch.cpp src/core/fs/romfs.cpp
|
src/core/fs/archive_ext_save_data.cpp src/core/fs/archive_ncch.cpp src/core/fs/romfs.cpp
|
||||||
src/core/fs/ivfc.cpp src/core/fs/archive_user_save_data.cpp
|
src/core/fs/ivfc.cpp src/core/fs/archive_user_save_data.cpp src/core/fs/archive_system_save_data.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(APPLET_SOURCE_FILES src/core/applets/applet.cpp src/core/applets/mii_selector.cpp src/core/applets/software_keyboard.cpp src/core/applets/applet_manager.cpp)
|
set(APPLET_SOURCE_FILES src/core/applets/applet.cpp src/core/applets/mii_selector.cpp src/core/applets/software_keyboard.cpp src/core/applets/applet_manager.cpp)
|
||||||
|
@ -183,6 +183,7 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/termcolor.hpp
|
||||||
include/applets/applet.hpp include/applets/mii_selector.hpp include/math_util.hpp include/services/soc.hpp
|
include/applets/applet.hpp include/applets/mii_selector.hpp include/math_util.hpp include/services/soc.hpp
|
||||||
include/services/news_u.hpp include/applets/software_keyboard.hpp include/applets/applet_manager.hpp include/fs/archive_user_save_data.hpp
|
include/services/news_u.hpp include/applets/software_keyboard.hpp include/applets/applet_manager.hpp include/fs/archive_user_save_data.hpp
|
||||||
include/services/amiibo_device.hpp include/services/nfc_types.hpp include/swap.hpp include/services/csnd.hpp include/services/nwm_uds.hpp
|
include/services/amiibo_device.hpp include/services/nfc_types.hpp include/swap.hpp include/services/csnd.hpp include/services/nwm_uds.hpp
|
||||||
|
include/fs/archive_system_save_data.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
cmrc_add_resource_library(
|
cmrc_add_resource_library(
|
||||||
|
|
38
include/fs/archive_system_save_data.hpp
Normal file
38
include/fs/archive_system_save_data.hpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#pragma once
|
||||||
|
#include "archive_base.hpp"
|
||||||
|
|
||||||
|
class SystemSaveDataArchive : public ArchiveBase {
|
||||||
|
public:
|
||||||
|
SystemSaveDataArchive(Memory& mem) : ArchiveBase(mem) {}
|
||||||
|
|
||||||
|
u64 getFreeBytes() override {
|
||||||
|
Helpers::panic("Unimplemented GetFreeBytes for SystemSaveData archive");
|
||||||
|
return 32_MB;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string name() override { return "SystemSaveData"; }
|
||||||
|
|
||||||
|
//HorizonResult createDirectory(const FSPath& path) override;
|
||||||
|
HorizonResult createFile(const FSPath& path, u64 size) override {
|
||||||
|
Helpers::panic("Unimplemented CreateFile for SystemSaveData archive");
|
||||||
|
return Result::Success;
|
||||||
|
};
|
||||||
|
|
||||||
|
HorizonResult deleteFile(const FSPath& path) override {
|
||||||
|
Helpers::panic("Unimplemented DeleteFile for SystemSaveData archive");
|
||||||
|
return Result::Success;
|
||||||
|
};
|
||||||
|
|
||||||
|
Rust::Result<ArchiveBase*, HorizonResult> openArchive(const FSPath& path) override;
|
||||||
|
//Rust::Result<DirectorySession, HorizonResult> openDirectory(const FSPath& path) override;
|
||||||
|
|
||||||
|
FileDescriptor openFile(const FSPath& path, const FilePerms& perms) override {
|
||||||
|
Helpers::panic("Unimplemented OpenFile for SystemSaveData archive");
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override {
|
||||||
|
Helpers::panic("Unimplemented ReadFile for SystemSaveData archive");
|
||||||
|
return {};
|
||||||
|
};
|
||||||
|
};
|
|
@ -5,6 +5,7 @@
|
||||||
#include "fs/archive_save_data.hpp"
|
#include "fs/archive_save_data.hpp"
|
||||||
#include "fs/archive_sdmc.hpp"
|
#include "fs/archive_sdmc.hpp"
|
||||||
#include "fs/archive_self_ncch.hpp"
|
#include "fs/archive_self_ncch.hpp"
|
||||||
|
#include "fs/archive_system_save_data.hpp"
|
||||||
#include "fs/archive_user_save_data.hpp"
|
#include "fs/archive_user_save_data.hpp"
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
#include "kernel_types.hpp"
|
#include "kernel_types.hpp"
|
||||||
|
@ -33,6 +34,7 @@ class FSService {
|
||||||
|
|
||||||
ExtSaveDataArchive extSaveData_sdmc;
|
ExtSaveDataArchive extSaveData_sdmc;
|
||||||
ExtSaveDataArchive sharedExtSaveData_nand;
|
ExtSaveDataArchive sharedExtSaveData_nand;
|
||||||
|
SystemSaveDataArchive systemSaveData;
|
||||||
|
|
||||||
ArchiveBase* getArchiveFromID(u32 id, const FSPath& archivePath);
|
ArchiveBase* getArchiveFromID(u32 id, const FSPath& archivePath);
|
||||||
Rust::Result<Handle, HorizonResult> openArchiveHandle(u32 archiveID, const FSPath& path);
|
Rust::Result<Handle, HorizonResult> openArchiveHandle(u32 archiveID, const FSPath& path);
|
||||||
|
@ -77,7 +79,8 @@ class FSService {
|
||||||
public:
|
public:
|
||||||
FSService(Memory& mem, Kernel& kernel, const EmulatorConfig& config)
|
FSService(Memory& mem, Kernel& kernel, const EmulatorConfig& config)
|
||||||
: mem(mem), saveData(mem), sharedExtSaveData_nand(mem, "../SharedFiles/NAND", true), extSaveData_sdmc(mem, "SDMC"), sdmc(mem), selfNcch(mem),
|
: mem(mem), saveData(mem), sharedExtSaveData_nand(mem, "../SharedFiles/NAND", true), extSaveData_sdmc(mem, "SDMC"), sdmc(mem), selfNcch(mem),
|
||||||
ncch(mem), userSaveData1(mem, ArchiveID::UserSaveData1), userSaveData2(mem, ArchiveID::UserSaveData2), kernel(kernel), config(config) {}
|
ncch(mem), userSaveData1(mem, ArchiveID::UserSaveData1), userSaveData2(mem, ArchiveID::UserSaveData2), kernel(kernel), config(config),
|
||||||
|
systemSaveData(mem) {}
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
12
src/core/fs/archive_system_save_data.cpp
Normal file
12
src/core/fs/archive_system_save_data.cpp
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#include <algorithm>
|
||||||
|
#include "fs/archive_system_save_data.hpp"
|
||||||
|
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
Rust::Result<ArchiveBase*, HorizonResult> SystemSaveDataArchive::openArchive(const FSPath& path) {
|
||||||
|
if (path.type != PathType::Empty) {
|
||||||
|
Helpers::panic("Unimplemented path type for SystemSaveData::OpenArchive");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok((ArchiveBase*)this);
|
||||||
|
}
|
|
@ -228,6 +228,13 @@ void Kernel::getProcessInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
// Returns the amount of <related unused field> + total supervisor-mode stack size + page-rounded size of the external handle table
|
||||||
|
case 1:
|
||||||
|
Helpers::warn("GetProcessInfo: Unimplemented type 1");
|
||||||
|
regs[1] = 0;
|
||||||
|
regs[2] = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
// According to 3DBrew: Amount of private (code, data, heap) memory used by the process + total supervisor-mode
|
// According to 3DBrew: Amount of private (code, data, heap) memory used by the process + total supervisor-mode
|
||||||
// stack size + page-rounded size of the external handle table
|
// stack size + page-rounded size of the external handle table
|
||||||
case 2:
|
case 2:
|
||||||
|
|
|
@ -85,6 +85,7 @@ ArchiveBase* FSService::getArchiveFromID(u32 id, const FSPath& archivePath) {
|
||||||
case ArchiveID::SharedExtSaveData:
|
case ArchiveID::SharedExtSaveData:
|
||||||
return &sharedExtSaveData_nand;
|
return &sharedExtSaveData_nand;
|
||||||
|
|
||||||
|
case ArchiveID::SystemSaveData: return &systemSaveData;
|
||||||
case ArchiveID::SDMC: return &sdmc;
|
case ArchiveID::SDMC: return &sdmc;
|
||||||
case ArchiveID::SavedataAndNcch: return &ncch; // This can only access NCCH outside of FSPXI
|
case ArchiveID::SavedataAndNcch: return &ncch; // This can only access NCCH outside of FSPXI
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue