From 3b42abd52c14401431877ba57536831f8631f665 Mon Sep 17 00:00:00 2001 From: Aetias Date: Sat, 21 Oct 2023 17:41:54 +0200 Subject: [PATCH] Match banner --- tools/rom/build.c | 6 +++++- tools/rom/rom.h | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/rom/build.c b/tools/rom/build.c index d6494ede..16ed2b6f 100644 --- a/tools/rom/build.c +++ b/tools/rom/build.c @@ -485,6 +485,7 @@ bool ReadTitle(const char *language, const char *file, wchar_t *title, size_t ti if (fread(buf, fileSize, 1, fp) != 1) FATAL("Failed to read %s banner title '%s'\n", language, file); fclose(fp); + memset(title, 0, titleSize); if (!Utf8ToWchar(buf, fileSize, title, titleSize)) return false; return true; } @@ -496,7 +497,6 @@ bool WriteBanner(FILE *fpRom, size_t *pAddress) { Banner banner; banner.version = 1; - banner.crc; memset(banner.reserved0, 0, sizeof(banner.reserved0)); fp = fopen(ICON_BITMAP_FILE, "rb"); @@ -520,6 +520,10 @@ bool WriteBanner(FILE *fpRom, size_t *pAddress) { if (!ReadTitle("Italian", TITLE_ITA_FILE, banner.italianTitle, sizeof(banner.italianTitle))) return false; if (!ReadTitle("Spanish", TITLE_SPA_FILE, banner.spanishTitle, sizeof(banner.spanishTitle))) return false; + uint8_t *crcStart = (uint8_t*) &banner + offsetof(Banner, iconBitmap); + uint8_t *crcEnd = (uint8_t*) &banner + sizeof(banner); + banner.crc = Crc(crcStart, crcEnd - crcStart); + if (fwrite(&banner, sizeof(banner), 1, fpRom) != 1) FATAL("Failed to write banner\n"); address += sizeof(banner); diff --git a/tools/rom/rom.h b/tools/rom/rom.h index fa30ad89..2a91e2bb 100644 --- a/tools/rom/rom.h +++ b/tools/rom/rom.h @@ -86,9 +86,9 @@ typedef struct { /* 0240 */ wchar_t japaneseTitle[0x80]; /* 0340 */ wchar_t englishTitle[0x80]; /* 0440 */ wchar_t frenchTitle[0x80]; - /* 0440 */ wchar_t germanTitle[0x80]; - /* 0440 */ wchar_t italianTitle[0x80]; - /* 0440 */ wchar_t spanishTitle[0x80]; + /* 0540 */ wchar_t germanTitle[0x80]; + /* 0640 */ wchar_t italianTitle[0x80]; + /* 0740 */ wchar_t spanishTitle[0x80]; /* 0540 */ } Banner;