aboutsummaryrefslogtreecommitdiff
path: root/src/NDS_Header.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/NDS_Header.h')
-rw-r--r--src/NDS_Header.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/NDS_Header.h b/src/NDS_Header.h
index 2c94f4c..5af8062 100644
--- a/src/NDS_Header.h
+++ b/src/NDS_Header.h
@@ -179,6 +179,23 @@ struct NDSHeader
u8 Reserved10[384];
u8 HeaderSignature[128]; // RSA-SHA1 across 0x000..0xDFF
+
+ /// @return \c true if this header represents a DSi title
+ /// (either a physical cartridge or a DSiWare title).
+ [[nodiscard]] bool IsDSi() const { return (UnitCode & 0x02) != 0; }
+ [[nodiscard]] u32 GameCodeAsU32() const {
+ return (u32)GameCode[3] << 24 |
+ (u32)GameCode[2] << 16 |
+ (u32)GameCode[1] << 8 |
+ (u32)GameCode[0];
+ }
+ [[nodiscard]] bool IsHomebrew() const
+ {
+ return (ARM9ROMOffset < 0x4000) || (strncmp(GameCode, "####", 4) == 0);
+ }
+
+ /// @return \c true if this header represents a DSiWare title.
+ [[nodiscard]] bool IsDSiWare() const { return IsDSi() && DSiRegionStart == 0; }
};
static_assert(sizeof(NDSHeader) == 4096, "NDSHeader is not 4096 bytes!");