mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 20:49:12 +12:00
Filesystem stuff
This commit is contained in:
parent
5992a58351
commit
272cdefca1
13 changed files with 222 additions and 32 deletions
61
include/fs/archive_base.hpp
Normal file
61
include/fs/archive_base.hpp
Normal file
|
@ -0,0 +1,61 @@
|
|||
#pragma once
|
||||
#include <optional>
|
||||
#include "helpers.hpp"
|
||||
#include "memory.hpp"
|
||||
|
||||
namespace PathType {
|
||||
enum : u32 {
|
||||
Invalid = 0,
|
||||
Empty = 1,
|
||||
Binary = 2,
|
||||
ASCII = 3,
|
||||
UTF8 = 4,
|
||||
};
|
||||
}
|
||||
|
||||
namespace ArchiveID {
|
||||
enum : u32 {
|
||||
SelfNCCH = 3,
|
||||
SaveData = 4,
|
||||
ExtSaveData = 6,
|
||||
SharedExtSaveData = 7,
|
||||
SystemSaveData = 8,
|
||||
SDMC = 9,
|
||||
SDMCWriteOnly = 0xA
|
||||
};
|
||||
|
||||
static const char* toString(u32 id) {
|
||||
switch (id) {
|
||||
case SelfNCCH: return "SelfNCCH";
|
||||
case SaveData: return "SaveData";
|
||||
case ExtSaveData: return "ExtSaveData";
|
||||
case SharedExtSaveData: return "SharedExtSaveData";
|
||||
case SystemSaveData: return "SystemSaveData";
|
||||
case SDMC: return "SDMC";
|
||||
case SDMCWriteOnly: return "SDMC (Write-only)";
|
||||
default: return "Unknown archive";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct FSPath {
|
||||
u32 type;
|
||||
u32 size;
|
||||
u32 pointer; // Pointer to the actual path data
|
||||
};
|
||||
|
||||
class ArchiveBase {
|
||||
protected:
|
||||
using Result = u32;
|
||||
using Handle = u32;
|
||||
Memory& mem;
|
||||
|
||||
public:
|
||||
virtual const char* name() = 0;
|
||||
virtual u64 getFreeBytes() = 0;
|
||||
virtual bool openFile(const FSPath& path) = 0;
|
||||
|
||||
virtual ArchiveBase* openArchive(FSPath& path) = 0;
|
||||
|
||||
ArchiveBase(Memory& mem) : mem(mem) {}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue