FS: Stub TWL_SOUND

This commit is contained in:
wheremyfoodat 2024-12-08 22:49:46 +02:00
parent b436fdca64
commit 055dbc7fb6
6 changed files with 79 additions and 3 deletions

View file

@ -42,7 +42,8 @@ namespace ArchiveID {
// 3DBrew: Similar to 0x567890B2 but can only access Accessible Save specified in exheader?
UserSaveData2 = 0x567890B4,
TwlPhoto = 0x567890AC
TwlPhoto = 0x567890AC,
TwlSound = 0x567890AD,
};
static std::string toString(u32 id) {
@ -56,6 +57,7 @@ namespace ArchiveID {
case SDMCWriteOnly: return "SDMC (Write-only)";
case SavedataAndNcch: return "Savedata & NCCH (archive 0x2345678A)";
case TwlPhoto: return "TWL_PHOTO";
case TwlSound: return "TWL_SOUND";
default: return "Unknown archive";
}
}

View file

@ -0,0 +1,30 @@
#pragma once
#include "archive_base.hpp"
#include "result/result.hpp"
using Result::HorizonResult;
class TWLSoundArchive : public ArchiveBase {
public:
TWLSoundArchive(Memory& mem) : ArchiveBase(mem) {}
std::string name() override { return "TWL_SOUND"; }
u64 getFreeBytes() override {
Helpers::warn("Unimplemented GetFreeBytes for TWLSound archive");
return 32_MB;
}
HorizonResult createDirectory(const FSPath& path) override;
HorizonResult createFile(const FSPath& path, u64 size) override;
HorizonResult deleteFile(const FSPath& path) override;
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;
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override {
Helpers::panic("Unimplemented ReadFile for TWL_SOUND archive");
return {};
};
};

View file

@ -7,6 +7,7 @@
#include "fs/archive_self_ncch.hpp"
#include "fs/archive_system_save_data.hpp"
#include "fs/archive_twl_photo.hpp"
#include "fs/archive_twl_sound.hpp"
#include "fs/archive_user_save_data.hpp"
#include "helpers.hpp"
#include "kernel_types.hpp"
@ -41,6 +42,7 @@ class FSService {
SystemSaveDataArchive systemSaveData;
TWLPhotoArchive twlPhoto;
TWLSoundArchive twlSound;
ArchiveBase* getArchiveFromID(u32 id, const FSPath& archivePath);
Rust::Result<Handle, HorizonResult> openArchiveHandle(u32 archiveID, const FSPath& path);
@ -90,7 +92,7 @@ class FSService {
FSService(Memory& mem, Kernel& kernel, const EmulatorConfig& config)
: mem(mem), saveData(mem), sharedExtSaveData_nand(mem, "../SharedFiles/NAND", true), extSaveData_sdmc(mem, "SDMC"), sdmc(mem),
sdmcWriteOnly(mem, true), selfNcch(mem), ncch(mem), userSaveData1(mem, ArchiveID::UserSaveData1),
userSaveData2(mem, ArchiveID::UserSaveData2), systemSaveData(mem), twlPhoto(mem), kernel(kernel), config(config) {}
userSaveData2(mem, ArchiveID::UserSaveData2), systemSaveData(mem), twlPhoto(mem), twlSound(mem), kernel(kernel), config(config) {}
void reset();
void handleSyncRequest(u32 messagePointer);