mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-09 04:21:38 +12:00
[NCCH] Add support for reading Miis out of NAND
This commit is contained in:
parent
4e64f722e5
commit
a1cb50925f
8 changed files with 6307 additions and 15 deletions
|
@ -101,7 +101,7 @@ void CFGService::secureInfoGetRegion(u32 messagePointer) {
|
|||
}
|
||||
|
||||
void CFGService::genUniqueConsoleHash(u32 messagePointer) {
|
||||
log("CFG::GenUniqueConsoleHash (semi-stubbed)");
|
||||
log("CFG::GenUniqueConsoleHash (semi-stubbed)\n");
|
||||
const u32 salt = mem.read32(messagePointer + 4) & 0x000FFFFF;
|
||||
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
|
|
|
@ -56,13 +56,13 @@ ArchiveBase* FSService::getArchiveFromID(u32 id) {
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<Handle> FSService::openFileHandle(ArchiveBase* archive, const FSPath& path, const FilePerms& perms) {
|
||||
std::optional<Handle> FSService::openFileHandle(ArchiveBase* archive, const FSPath& path, const FSPath& archivePath,const FilePerms& perms) {
|
||||
FileDescriptor opened = archive->openFile(path, perms);
|
||||
if (opened.has_value()) { // If opened doesn't have a value, we failed to open the file
|
||||
auto handle = kernel.makeObject(KernelObjectType::File);
|
||||
|
||||
auto& file = kernel.getObjects()[handle];
|
||||
file.data = new FileSession(archive, path, opened.value());
|
||||
file.data = new FileSession(archive, path, archivePath, opened.value());
|
||||
|
||||
return handle;
|
||||
} else {
|
||||
|
@ -182,10 +182,12 @@ void FSService::openFile(u32 messagePointer) {
|
|||
}
|
||||
|
||||
ArchiveBase* archive = archiveObject->getData<ArchiveSession>()->archive;
|
||||
const FSPath& archivePath = archiveObject->getData<ArchiveSession>()->path;
|
||||
|
||||
auto filePath = readPath(filePathType, filePathPointer, filePathSize);
|
||||
const FilePerms perms(openFlags);
|
||||
|
||||
std::optional<Handle> handle = openFileHandle(archive, filePath, perms);
|
||||
std::optional<Handle> handle = openFileHandle(archive, filePath, archivePath, perms);
|
||||
if (!handle.has_value()) {
|
||||
printf("OpenFile failed\n");
|
||||
mem.write32(messagePointer + 4, Result::FileNotFound);
|
||||
|
@ -223,7 +225,7 @@ void FSService::openFileDirectly(u32 messagePointer) {
|
|||
Helpers::panic("OpenFileDirectly: Failed to open archive with given path");
|
||||
}
|
||||
|
||||
std::optional<Handle> handle = openFileHandle(archive, filePath, perms);
|
||||
std::optional<Handle> handle = openFileHandle(archive, filePath, archivePath, perms);
|
||||
if (!handle.has_value()) {
|
||||
Helpers::panic("OpenFileDirectly: Failed to open file with given path");
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue