diff --git a/ZAPD/ZRom.cpp b/ZAPD/ZRom.cpp index f6016ae..027263c 100644 --- a/ZAPD/ZRom.cpp +++ b/ZAPD/ZRom.cpp @@ -113,9 +113,41 @@ bool ZRom::IsMQ() { } } +bool ZRom::IsDebug() const +{ + switch (BitConverter::ToInt32BE(romData, 0x10)) { // crc + case OOT_PAL_GC_DBG1: + case OOT_PAL_GC_DBG2: + case OOT_PAL_GC_MQ_DBG: + return true; + default: + return false; + } +} + +bool ZRom::IsN64() const +{ + switch (BitConverter::ToInt32BE(romData, 0x10)) { // crc + case OOT_NTSC_10: + case OOT_NTSC_11: + case OOT_NTSC_12: + case OOT_PAL_10: + case OOT_PAL_11: + case OOT_IQUE_TW: + case OOT_IQUE_CN: + return true; + default: + return false; + } +} + +const RomVersion& ZRom::GetVersion() const +{ + return version; +} + ZRom::ZRom(std::string romPath) { - RomVersion version; romData = DiskFile::ReadAllBytes(romPath); BitConverter::RomToBigEndian(romData.data(), romData.size()); diff --git a/ZAPD/ZRom.h b/ZAPD/ZRom.h index 6225a1a..1df423a 100644 --- a/ZAPD/ZRom.h +++ b/ZAPD/ZRom.h @@ -5,6 +5,15 @@ #include #include +struct RomVersion +{ + std::string version = "None"; + std::string error = "None"; + std::string listPath = "None"; + int offset; + uint32_t crc; +}; + class ZRom { public: @@ -12,17 +21,12 @@ class ZRom std::vector GetFile(std::string fileName); bool IsMQ(); + bool IsDebug() const; + bool IsN64() const; + [[nodiscard]] const RomVersion& GetVersion() const; protected: std::vector romData; std::map> files; -}; - -struct RomVersion -{ - std::string version = "None"; - std::string error = "None"; - std::string listPath = "None"; - int offset; - uint32_t crc; + RomVersion version; }; \ No newline at end of file