Support for Wii U VC NFS images

This commit is contained in:
Jack Andersen
2019-11-23 17:24:33 -10:00
parent 11a0351d1c
commit 75fc574f81
8 changed files with 333 additions and 42 deletions

View File

@@ -12,6 +12,7 @@ logvisor::Module LogModule("nod");
std::unique_ptr<IDiscIO> NewDiscIOISO(SystemStringView path);
std::unique_ptr<IDiscIO> NewDiscIOWBFS(SystemStringView path);
std::unique_ptr<IDiscIO> NewDiscIONFS(SystemStringView path);
std::unique_ptr<DiscBase> OpenDiscFromImage(SystemStringView path, bool& isWii) {
/* Temporary file handle to determine image type */
@@ -32,9 +33,17 @@ std::unique_ptr<DiscBase> OpenDiscFromImage(SystemStringView path, bool& isWii)
return {};
}
using SignedSize = std::make_signed<SystemString::size_type>::type;
const auto dotPos = SignedSize(path.rfind('.'));
const auto slashPos = SignedSize(path.rfind("/\\"));
if (magic == nod::SBig((uint32_t)'WBFS')) {
discIO = NewDiscIOWBFS(path);
isWii = true;
} else if (path.size() > 4 && dotPos != -1 && dotPos > slashPos &&
!path.compare(slashPos + 1, 4, "hif_") &&
!path.compare(dotPos, path.size() - dotPos, ".nfs")) {
discIO = NewDiscIONFS(path);
isWii = true;
} else {
rs->seek(0x18, SEEK_SET);
rs->read(&magic, 4);