mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 04:29:13 +12:00
Clean up smdh getting
This commit is contained in:
parent
74e8f7d4eb
commit
3aa977c6c5
9 changed files with 45 additions and 52 deletions
|
@ -6,10 +6,6 @@
|
|||
#include "loader/ncch.hpp"
|
||||
#include "memory.hpp"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "jni_driver.hpp"
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
bool NCCH::loadFromHeader(Crypto::AESEngine &aesEngine, IOFile& file, const FSInfo &info) {
|
||||
|
@ -30,6 +26,7 @@ bool NCCH::loadFromHeader(Crypto::AESEngine &aesEngine, IOFile& file, const FSIn
|
|||
|
||||
codeFile.clear();
|
||||
saveData.clear();
|
||||
smdh.clear();
|
||||
partitionInfo = info;
|
||||
|
||||
size = u64(*(u32*)&header[0x104]) * mediaUnit; // TODO: Maybe don't type pun because big endian will break
|
||||
|
@ -223,11 +220,10 @@ bool NCCH::loadFromHeader(Crypto::AESEngine &aesEngine, IOFile& file, const FSIn
|
|||
}
|
||||
} else if (std::strcmp(name, "icon") == 0) {
|
||||
// Parse icon file to extract region info and more in the future (logo, etc)
|
||||
std::vector<u8> tmp;
|
||||
tmp.resize(fileSize);
|
||||
readFromFile(file, exeFS, tmp.data(), fileOffset + exeFSHeaderSize, fileSize);
|
||||
smdh.resize(fileSize);
|
||||
readFromFile(file, exeFS, smdh.data(), fileOffset + exeFSHeaderSize, fileSize);
|
||||
|
||||
if (!parseSMDH(tmp)) {
|
||||
if (!parseSMDH(smdh)) {
|
||||
printf("Failed to parse SMDH!\n");
|
||||
}
|
||||
}
|
||||
|
@ -259,11 +255,6 @@ bool NCCH::parseSMDH(const std::vector<u8>& smdh) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// In the Android version, notify the application that we're loading an SMDH file, to extract data for the title list
|
||||
#ifdef __ANDROID__
|
||||
Pandroid::onSmdhLoaded(smdh);
|
||||
#endif
|
||||
|
||||
// Bitmask showing which regions are allowed.
|
||||
// https://www.3dbrew.org/wiki/SMDH#Region_Lockout
|
||||
const u32 regionMasks = *(u32*)&smdh[0x2018];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue