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.
This commit is contained in:
Rayyan Ansari 2022-09-02 11:47:12 +01:00
parent 9d56055afb
commit c3bd1d2e83
No known key found for this signature in database
GPG Key ID: 46A8D18E5BC49D84
1 changed files with 9 additions and 1 deletions

View File

@ -1602,7 +1602,15 @@ bool LoadROM(const u8* romdata, u32 romlen)
memcpy(CartROM, romdata, romlen);
memcpy(&Header, CartROM, sizeof(Header));
if (!Header.BannerOffset)
{
memset(&Banner, 0, sizeof(Banner));
}
else
{
memcpy(&Banner, CartROM + Header.BannerOffset, sizeof(Banner));
}
printf("Game code: %.4s\n", Header.GameCode);