mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-17 19:21:30 +12:00
Starting work on (Shared)ExtSaveData archive
This commit is contained in:
parent
bbb62a83d0
commit
79c89f1f63
8 changed files with 48 additions and 7 deletions
|
@ -67,7 +67,9 @@ set(PICA_SOURCE_FILES src/core/PICA/gpu.cpp src/core/PICA/regs.cpp src/core/PICA
|
||||||
set(RENDERER_GL_SOURCE_FILES src/core/renderer_gl/renderer_gl.cpp)
|
set(RENDERER_GL_SOURCE_FILES src/core/renderer_gl/renderer_gl.cpp)
|
||||||
|
|
||||||
set(LOADER_SOURCE_FILES src/core/loader/elf.cpp src/core/loader/ncsd.cpp src/core/loader/ncch.cpp)
|
set(LOADER_SOURCE_FILES src/core/loader/elf.cpp src/core/loader/ncsd.cpp src/core/loader/ncch.cpp)
|
||||||
set(FS_SOURCE_FILES src/core/fs/archive_ncch.cpp src/core/fs/archive_save_data.cpp src/core/fs/archive_sdmc.cpp)
|
set(FS_SOURCE_FILES src/core/fs/archive_ncch.cpp src/core/fs/archive_save_data.cpp src/core/fs/archive_sdmc.cpp
|
||||||
|
src/core/fs/archive_ext_save_data.cpp
|
||||||
|
)
|
||||||
|
|
||||||
set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp include/termcolor.hpp
|
set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp include/termcolor.hpp
|
||||||
include/cpu.hpp include/cpu_dynarmic.hpp include/memory.hpp include/kernel/kernel.hpp
|
include/cpu.hpp include/cpu_dynarmic.hpp include/memory.hpp include/kernel/kernel.hpp
|
||||||
|
@ -84,6 +86,7 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp inc
|
||||||
include/services/mic.hpp include/services/cecd.hpp include/renderer_gl/renderer_gl.hpp
|
include/services/mic.hpp include/services/cecd.hpp include/renderer_gl/renderer_gl.hpp
|
||||||
include/renderer_gl/surfaces.hpp include/renderer_gl/surface_cache.hpp include/services/ac.hpp
|
include/renderer_gl/surfaces.hpp include/renderer_gl/surface_cache.hpp include/services/ac.hpp
|
||||||
include/services/am.hpp include/services/boss.hpp include/services/frd.hpp include/services/nim.hpp
|
include/services/am.hpp include/services/boss.hpp include/services/frd.hpp include/services/nim.hpp
|
||||||
|
include/fs/archive_ext_save_data.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp
|
set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp
|
||||||
|
|
16
include/fs/archive_ext_save_data.hpp
Normal file
16
include/fs/archive_ext_save_data.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#pragma once
|
||||||
|
#include "archive_base.hpp"
|
||||||
|
|
||||||
|
class ExtSaveDataArchive : public ArchiveBase {
|
||||||
|
public:
|
||||||
|
ExtSaveDataArchive(Memory& mem) : ArchiveBase(mem) {}
|
||||||
|
|
||||||
|
u64 getFreeBytes() override { Helpers::panic("ExtSaveData::GetFreeBytes unimplemented"); return 0; }
|
||||||
|
std::string name() override { return "ExtSaveData"; }
|
||||||
|
|
||||||
|
bool openFile(const FSPath& path) override;
|
||||||
|
ArchiveBase* openArchive(const FSPath& path) override;
|
||||||
|
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override;
|
||||||
|
|
||||||
|
bool isShared = false;
|
||||||
|
};
|
|
@ -2,7 +2,6 @@
|
||||||
#include "archive_base.hpp"
|
#include "archive_base.hpp"
|
||||||
|
|
||||||
class SelfNCCHArchive : public ArchiveBase {
|
class SelfNCCHArchive : public ArchiveBase {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SelfNCCHArchive(Memory& mem) : ArchiveBase(mem) {}
|
SelfNCCHArchive(Memory& mem) : ArchiveBase(mem) {}
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
#include "archive_base.hpp"
|
#include "archive_base.hpp"
|
||||||
|
|
||||||
class SaveDataArchive : public ArchiveBase {
|
class SaveDataArchive : public ArchiveBase {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SaveDataArchive(Memory& mem) : ArchiveBase(mem) {}
|
SaveDataArchive(Memory& mem) : ArchiveBase(mem) {}
|
||||||
|
|
||||||
u64 getFreeBytes() override { return 0; }
|
u64 getFreeBytes() override { Helpers::panic("SaveData::GetFreeBytes unimplemented"); return 0; }
|
||||||
std::string name() override { return "SaveData"; }
|
std::string name() override { return "SaveData"; }
|
||||||
|
|
||||||
bool openFile(const FSPath& path) override;
|
bool openFile(const FSPath& path) override;
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
#include "archive_base.hpp"
|
#include "archive_base.hpp"
|
||||||
|
|
||||||
class SDMCArchive : public ArchiveBase {
|
class SDMCArchive : public ArchiveBase {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SDMCArchive(Memory& mem) : ArchiveBase(mem) {}
|
SDMCArchive(Memory& mem) : ArchiveBase(mem) {}
|
||||||
|
|
||||||
u64 getFreeBytes() override { return 0; }
|
u64 getFreeBytes() override { Helpers::panic("SDMC::GetFreeBytes unimplemented"); return 0; }
|
||||||
std::string name() override { return "SDMC"; }
|
std::string name() override { return "SDMC"; }
|
||||||
|
|
||||||
bool openFile(const FSPath& path) override;
|
bool openFile(const FSPath& path) override;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include "fs/archive_ext_save_data.hpp"
|
||||||
#include "fs/archive_ncch.hpp"
|
#include "fs/archive_ncch.hpp"
|
||||||
#include "fs/archive_save_data.hpp"
|
#include "fs/archive_save_data.hpp"
|
||||||
#include "fs/archive_sdmc.hpp"
|
#include "fs/archive_sdmc.hpp"
|
||||||
|
@ -20,6 +21,7 @@ class FSService {
|
||||||
// The different filesystem archives (Save data, RomFS+ExeFS, etc)
|
// The different filesystem archives (Save data, RomFS+ExeFS, etc)
|
||||||
SelfNCCHArchive selfNcch;
|
SelfNCCHArchive selfNcch;
|
||||||
SaveDataArchive saveData;
|
SaveDataArchive saveData;
|
||||||
|
ExtSaveDataArchive sharedExtSaveData;
|
||||||
SDMCArchive sdmc;
|
SDMCArchive sdmc;
|
||||||
|
|
||||||
ArchiveBase* getArchiveFromID(u32 id);
|
ArchiveBase* getArchiveFromID(u32 id);
|
||||||
|
@ -41,7 +43,12 @@ class FSService {
|
||||||
u32 priority;
|
u32 priority;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FSService(Memory& mem, Kernel& kernel) : mem(mem), saveData(mem), sdmc(mem), selfNcch(mem), kernel(kernel) {}
|
FSService(Memory& mem, Kernel& kernel) : mem(mem), saveData(mem), sharedExtSaveData(mem), sdmc(mem), selfNcch(mem),
|
||||||
|
kernel(kernel)
|
||||||
|
{
|
||||||
|
sharedExtSaveData.isShared = true; // Need to do this here because templates and virtual classes do not mix well
|
||||||
|
}
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
};
|
};
|
17
src/core/fs/archive_ext_save_data.cpp
Normal file
17
src/core/fs/archive_ext_save_data.cpp
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#include "fs/archive_ext_save_data.hpp"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
bool ExtSaveDataArchive::openFile(const FSPath& path) {
|
||||||
|
Helpers::panic("ExtSaveDataArchive::OpenFile: Failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArchiveBase* ExtSaveDataArchive::openArchive(const FSPath& path) {
|
||||||
|
Helpers::panic("ExtSaveDataArchive::OpenArchive: Failed. Path type: %d", path.type);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<u32> ExtSaveDataArchive::readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) {
|
||||||
|
Helpers::panic("ExtSaveDataArchive::ReadFile: Failed");
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
|
@ -30,6 +30,7 @@ ArchiveBase* FSService::getArchiveFromID(u32 id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case ArchiveID::SelfNCCH: return &selfNcch;
|
case ArchiveID::SelfNCCH: return &selfNcch;
|
||||||
case ArchiveID::SaveData: return &saveData;
|
case ArchiveID::SaveData: return &saveData;
|
||||||
|
case ArchiveID::SharedExtSaveData: return &sharedExtSaveData;
|
||||||
case ArchiveID::SDMC: return &sdmc;
|
case ArchiveID::SDMC: return &sdmc;
|
||||||
default:
|
default:
|
||||||
Helpers::panic("Unknown archive. ID: %d\n", id);
|
Helpers::panic("Unknown archive. ID: %d\n", id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue