Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion ZAPD/ZRom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
22 changes: 13 additions & 9 deletions ZAPD/ZRom.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,28 @@
#include <map>
#include <string>

struct RomVersion
{
std::string version = "None";
std::string error = "None";
std::string listPath = "None";
int offset;
uint32_t crc;
};

class ZRom
{
public:
ZRom(std::string romPath);

std::vector<uint8_t> GetFile(std::string fileName);
bool IsMQ();
bool IsDebug() const;
bool IsN64() const;
[[nodiscard]] const RomVersion& GetVersion() const;

protected:
std::vector<uint8_t> romData;
std::map<std::string, std::vector<uint8_t>> files;
};

struct RomVersion
{
std::string version = "None";
std::string error = "None";
std::string listPath = "None";
int offset;
uint32_t crc;
RomVersion version;
};