mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-21 03:55:03 +00:00
Add error code for unimplemented NCCH archives
This commit is contained in:
parent
38cc6a868a
commit
5c7c8a4a5a
2 changed files with 6 additions and 6 deletions
|
@ -75,7 +75,6 @@ std::optional<u32> NCCHArchive::readFile(FileSession* file, u64 offset, u32 size
|
|||
const u32 highProgramID = *(u32*)&archivePath[4];
|
||||
|
||||
// High Title ID of the archive (from Citra). https://3dbrew.org/wiki/Title_list.
|
||||
constexpr u32 systemApplication = 0x00040010;
|
||||
constexpr u32 sharedDataArchive = 0x0004009B;
|
||||
constexpr u32 systemDataArchive = 0x000400DB;
|
||||
|
||||
|
@ -86,17 +85,17 @@ std::optional<u32> NCCHArchive::readFile(FileSession* file, u64 offset, u32 size
|
|||
constexpr u32 sharedFont = 0x00014002;
|
||||
std::vector<u8> fileData;
|
||||
|
||||
if (highProgramID == systemApplication) {
|
||||
Helpers::panic("[NCCH archive] Read from system application. ID: %08X", lowProgramID);
|
||||
} else if (highProgramID == sharedDataArchive) {
|
||||
if (highProgramID == sharedDataArchive) {
|
||||
if (lowProgramID == miiData) fileData = std::vector<u8>(std::begin(MII_DATA), std::end(MII_DATA));
|
||||
else if (lowProgramID == regionManifest) fileData = std::vector<u8>(std::begin(COUNTRY_LIST_DATA), std::end(COUNTRY_LIST_DATA));
|
||||
else Helpers::panic("[NCCH archive] Read unimplemented NAND file. ID: %08X", lowProgramID);
|
||||
} else if (highProgramID == systemDataArchive && lowProgramID == badWordList) {
|
||||
fileData = std::vector<u8>(std::begin(BAD_WORD_LIST_DATA), std::end(BAD_WORD_LIST_DATA));
|
||||
} else {
|
||||
Helpers::panic("[NCCH archive] Read from unimplemented NCCH archive file. High program ID: %08X, low ID: %08X",
|
||||
Helpers::warn("[NCCH archive] Read from unimplemented NCCH archive file. High program ID: %08X, low ID: %08X",
|
||||
highProgramID, lowProgramID);
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (offset >= fileData.size()) {
|
||||
|
|
|
@ -111,7 +111,8 @@ void Kernel::readFile(u32 messagePointer, Handle fileHandle) {
|
|||
auto archive = file->archive;
|
||||
std::optional<u32> bytesRead = archive->readFile(file, offset, size, dataPointer);
|
||||
if (!bytesRead.has_value()) {
|
||||
Helpers::panic("Kernel::ReadFile failed");
|
||||
Helpers::warn("Kernel::ReadFile failed");
|
||||
mem.write32(messagePointer + 4, 0xC8804478);
|
||||
} else {
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
mem.write32(messagePointer + 8, bytesRead.value());
|
||||
|
|
Loading…
Add table
Reference in a new issue