mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
[Kernel] ExitThread [FS] Start implement archive 0x2345678A
This commit is contained in:
parent
7c2dd34eba
commit
4e64f722e5
11 changed files with 215 additions and 131 deletions
|
@ -26,7 +26,9 @@ namespace ArchiveID {
|
|||
SharedExtSaveData = 7,
|
||||
SystemSaveData = 8,
|
||||
SDMC = 9,
|
||||
SDMCWriteOnly = 0xA
|
||||
SDMCWriteOnly = 0xA,
|
||||
|
||||
SavedataAndNcch = 0x2345678A
|
||||
};
|
||||
|
||||
static std::string toString(u32 id) {
|
||||
|
@ -38,6 +40,7 @@ namespace ArchiveID {
|
|||
case SystemSaveData: return "SystemSaveData";
|
||||
case SDMC: return "SDMC";
|
||||
case SDMCWriteOnly: return "SDMC (Write-only)";
|
||||
case SavedataAndNcch: return "Savedata & NCCH (archive 0x2345678A)";
|
||||
default: return "Unknown archive";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +1,15 @@
|
|||
#pragma once
|
||||
#include "archive_base.hpp"
|
||||
|
||||
class SelfNCCHArchive : public ArchiveBase {
|
||||
class NCCHArchive : public ArchiveBase {
|
||||
public:
|
||||
SelfNCCHArchive(Memory& mem) : ArchiveBase(mem) {}
|
||||
NCCHArchive(Memory& mem) : ArchiveBase(mem) {}
|
||||
|
||||
u64 getFreeBytes() override { return 0; }
|
||||
std::string name() override { return "SelfNCCH"; }
|
||||
u64 getFreeBytes() override { Helpers::panic("NCCH::GetFreeBytes unimplemented"); return 0; }
|
||||
std::string name() override { return "NCCH"; }
|
||||
|
||||
ArchiveBase* openArchive(const FSPath& path) override;
|
||||
CreateFileResult createFile(const FSPath& path, u64 size) override;
|
||||
FileDescriptor openFile(const FSPath& path, const FilePerms& perms) override;
|
||||
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override;
|
||||
|
||||
// Returns whether the cart has a RomFS
|
||||
bool hasRomFS() {
|
||||
auto cxi = mem.getCXI();
|
||||
return (cxi != nullptr && cxi->hasRomFS());
|
||||
}
|
||||
|
||||
// Returns whether the cart has an ExeFS (All executable carts should have an ExeFS. This is just here to be safe)
|
||||
bool hasExeFS() {
|
||||
auto cxi = mem.getCXI();
|
||||
return (cxi != nullptr && cxi->hasExeFS());
|
||||
}
|
||||
};
|
27
include/fs/archive_self_ncch.hpp
Normal file
27
include/fs/archive_self_ncch.hpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
#include "archive_base.hpp"
|
||||
|
||||
class SelfNCCHArchive : public ArchiveBase {
|
||||
public:
|
||||
SelfNCCHArchive(Memory& mem) : ArchiveBase(mem) {}
|
||||
|
||||
u64 getFreeBytes() override { return 0; }
|
||||
std::string name() override { return "SelfNCCH"; }
|
||||
|
||||
ArchiveBase* openArchive(const FSPath& path) override;
|
||||
CreateFileResult createFile(const FSPath& path, u64 size) override;
|
||||
FileDescriptor openFile(const FSPath& path, const FilePerms& perms) override;
|
||||
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override;
|
||||
|
||||
// Returns whether the cart has a RomFS
|
||||
bool hasRomFS() {
|
||||
auto cxi = mem.getCXI();
|
||||
return (cxi != nullptr && cxi->hasRomFS());
|
||||
}
|
||||
|
||||
// Returns whether the cart has an ExeFS (All executable carts should have an ExeFS. This is just here to be safe)
|
||||
bool hasExeFS() {
|
||||
auto cxi = mem.getCXI();
|
||||
return (cxi != nullptr && cxi->hasExeFS());
|
||||
}
|
||||
};
|
|
@ -33,7 +33,8 @@ class Kernel {
|
|||
Handle errorPortHandle; // Handle for the err:f port used for displaying errors
|
||||
|
||||
u32 arbiterCount;
|
||||
u32 threadCount;
|
||||
u32 threadCount; // How many threads in our thread pool have been used as of now (Up to 32)
|
||||
u32 aliveThreadCount; // How many of these threads are actually alive?
|
||||
ServiceManager serviceManager;
|
||||
|
||||
// Top 8 bits are the major version, bottom 8 are the minor version
|
||||
|
@ -95,6 +96,7 @@ private:
|
|||
void createThread();
|
||||
void controlMemory();
|
||||
void duplicateHandle();
|
||||
void exitThread();
|
||||
void mapMemoryBlock();
|
||||
void queryMemory();
|
||||
void getProcessID();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "fs/archive_ncch.hpp"
|
||||
#include "fs/archive_save_data.hpp"
|
||||
#include "fs/archive_sdmc.hpp"
|
||||
#include "fs/archive_self_ncch.hpp"
|
||||
#include "helpers.hpp"
|
||||
#include "kernel_types.hpp"
|
||||
#include "logger.hpp"
|
||||
|
@ -18,11 +19,12 @@ class FSService {
|
|||
|
||||
MAKE_LOG_FUNCTION(log, fsLogger)
|
||||
|
||||
// The different filesystem archives (Save data, RomFS+ExeFS, etc)
|
||||
// The different filesystem archives (Save data, SelfNCCH, SDMC, NCCH, ExtData, etc)
|
||||
SelfNCCHArchive selfNcch;
|
||||
SaveDataArchive saveData;
|
||||
ExtSaveDataArchive sharedExtSaveData;
|
||||
SDMCArchive sdmc;
|
||||
NCCHArchive ncch;
|
||||
|
||||
ArchiveBase* getArchiveFromID(u32 id);
|
||||
std::optional<Handle> openArchiveHandle(u32 archiveID, const FSPath& path);
|
||||
|
@ -45,7 +47,7 @@ class FSService {
|
|||
u32 priority;
|
||||
|
||||
public:
|
||||
FSService(Memory& mem, Kernel& kernel) : mem(mem), saveData(mem), sharedExtSaveData(mem), sdmc(mem), selfNcch(mem),
|
||||
FSService(Memory& mem, Kernel& kernel) : mem(mem), saveData(mem), sharedExtSaveData(mem), sdmc(mem), selfNcch(mem), ncch(mem),
|
||||
kernel(kernel)
|
||||
{
|
||||
sharedExtSaveData.isShared = true; // Need to do this here because templates and virtual classes do not mix well
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue