aboutsummaryrefslogtreecommitdiff
path: root/src/NDSCart.cpp
diff options
context:
space:
mode:
authorRayyan Ansari <rayyan@ansari.sh>2022-09-02 11:47:12 +0100
committerRayyan Ansari <rayyan@ansari.sh>2022-09-02 11:47:12 +0100
commitc3bd1d2e831e3e5cb0e1cc0bffc6eb9f29a94932 (patch)
tree2efca07f393baf0f8552d8ec71a54740b7283925 /src/NDSCart.cpp
parent9d56055afb123ab421723bd9f33895382077e9bc (diff)
Fix reading banner from homebrew ROMs
Some homebrew ROMs do not have a banner, and use a null value to indicate this. Do not attempt to read the banner when this is the case.
Diffstat (limited to 'src/NDSCart.cpp')
-rw-r--r--src/NDSCart.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/NDSCart.cpp b/src/NDSCart.cpp
index a6e16df..35418eb 100644
--- a/src/NDSCart.cpp
+++ b/src/NDSCart.cpp
@@ -1602,7 +1602,15 @@ bool LoadROM(const u8* romdata, u32 romlen)
memcpy(CartROM, romdata, romlen);
memcpy(&Header, CartROM, sizeof(Header));
- memcpy(&Banner, CartROM + Header.BannerOffset, sizeof(Banner));
+
+ if (!Header.BannerOffset)
+ {
+ memset(&Banner, 0, sizeof(Banner));
+ }
+ else
+ {
+ memcpy(&Banner, CartROM + Header.BannerOffset, sizeof(Banner));
+ }
printf("Game code: %.4s\n", Header.GameCode);