summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/save_failed_screen.s28
-rwxr-xr-xgraphics/misc/clock_small.pal19
-rwxr-xr-xgraphics/misc/clock_small.pngbin0 -> 221 bytes
-rw-r--r--include/window.h2
-rw-r--r--ld_script.txt2
-rwxr-xr-xsrc/save_failed_screen.c127
-rw-r--r--src/window.c2
7 files changed, 131 insertions, 49 deletions
diff --git a/data/save_failed_screen.s b/data/save_failed_screen.s
deleted file mode 100644
index 1b9fb7ed1..000000000
--- a/data/save_failed_screen.s
+++ /dev/null
@@ -1,28 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .section .rodata
-
-gClockOamData:: @ 85EFD80
- .incbin "baserom.gba", 0x5efd80, 0x8
-
-gUnknown_085EFD88:: @ 85EFD88
- .incbin "baserom.gba", 0x5efd88, 0xc
-
-gUnknown_085EFD94:: @ 85EFD94
- .incbin "baserom.gba", 0x5efd94, 0x8
-
-gUnknown_085EFD9C:: @ 85EFD9C
- .incbin "baserom.gba", 0x5efd9c, 0x8
-
-gUnknown_085EFDA4:: @ 85EFDA4
- .incbin "baserom.gba", 0x5efda4, 0x8
-
-gClockFrames:: @ 85EFDAC
- .incbin "baserom.gba", 0x5efdac, 0x18
-
-gSaveFailedClockPal:: @ 85EFDC4
- .incbin "baserom.gba", 0x5efdc4, 0x20
-
-gSaveFailedClockGfx:: @ 85EFDE4
- .incbin "baserom.gba", 0x5efde4, 0x90
diff --git a/graphics/misc/clock_small.pal b/graphics/misc/clock_small.pal
new file mode 100755
index 000000000..3398fcbe3
--- /dev/null
+++ b/graphics/misc/clock_small.pal
@@ -0,0 +1,19 @@
+JASC-PAL
+0100
+16
+98 139 90
+0 0 0
+57 57 57
+123 123 123
+189 189 189
+255 255 255
+255 65 41
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/graphics/misc/clock_small.png b/graphics/misc/clock_small.png
new file mode 100755
index 000000000..6b9f6c1f7
--- /dev/null
+++ b/graphics/misc/clock_small.png
Binary files differ
diff --git a/include/window.h b/include/window.h
index 4e814ebc6..b630cd316 100644
--- a/include/window.h
+++ b/include/window.h
@@ -43,7 +43,7 @@ struct Window
bool16 InitWindows(const struct WindowTemplate *templates);
u16 AddWindow(const struct WindowTemplate *template);
-int AddWindowWithoutTileMap(struct WindowTemplate *template);
+int AddWindowWithoutTileMap(const struct WindowTemplate *template);
void RemoveWindow(u8 windowId);
void FreeAllWindowBuffers(void);
void CopyWindowToVram(u8 windowId, u8 mode);
diff --git a/ld_script.txt b/ld_script.txt
index f65e26e73..de6ba62f1 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -434,7 +434,7 @@ SECTIONS {
data/strings.o(.rodata);
data/berry_tag_screen.o(.rodata);
data/mystery_event_menu.o(.rodata);
- data/save_failed_screen.o(.rodata);
+ src/save_failed_screen.o(.rodata);
data/braille_puzzles.o(.rodata);
data/pokeblock_feed.o(.rodata);
data/clear_save_data_screen.o(.rodata);
diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c
index 3f9219574..7a7c30388 100755
--- a/src/save_failed_screen.c
+++ b/src/save_failed_screen.c
@@ -22,22 +22,11 @@ extern u32 gDamagedSaveSectors;
extern const u8 gBirchHelpGfx[];
extern const u8 gBirchBagTilemap[];
extern const u8 gBirchGrassTilemap[];
-extern const u8 gSaveFailedClockGfx[];
-
-extern const struct OamData gClockOamData; // sClockOamData
-extern const u8 gClockFrames[8][3]; // sClockFrames
-
-extern const struct BgTemplate gUnknown_085EFD88[];
-extern const struct WindowTemplate gUnknown_085EFD94[];
-extern struct WindowTemplate gUnknown_085EFD9C;
-extern struct WindowTemplate gUnknown_085EFDA4;
-extern struct SaveSection gSaveDataBuffer;
-extern const u32 gUnknown_0850E87C[];
-
extern const u16 gBirchBagGrassPal[];
-extern const u16 gSaveFailedClockPal[];
extern const u16 gUnknown_0850FEFC[];
extern const u16 gUnknown_0860F074[];
+extern const u32 gUnknown_0850E87C[];
+extern struct SaveSection gSaveDataBuffer;
extern u8 gText_SaveFailedCheckingBackup[];
extern u8 gText_BackupMemoryDamaged[];
@@ -68,6 +57,108 @@ EWRAM_DATA u8 gSaveFailedUnused1[12] = {0};
EWRAM_DATA u8 gSaveFailedWindowIds[2] = {0};
EWRAM_DATA u8 gSaveFailedUnused2[4] = {0};
+static const struct OamData sClockOamData =
+{
+ 160, // Y
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0,
+ 0
+};
+
+static const struct BgTemplate gUnknown_085EFD88[3] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 31,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0,
+ },
+ {
+ .bg = 2,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 14,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 2,
+ .baseTile = 0,
+ },
+ {
+ .bg = 3,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 15,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 3,
+ .baseTile = 0,
+ },
+};
+
+static const struct WindowTemplate gUnknown_085EFD94[] =
+{
+ {
+ .priority = 255,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 0,
+ .height = 0,
+ .paletteNum = 0,
+ .baseBlock = 0,
+ }
+};
+
+static const struct WindowTemplate gUnknown_085EFD9C[] =
+{
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 13,
+ .width = 28,
+ .height = 6,
+ .paletteNum = 15,
+ .baseBlock = 1,
+ }
+};
+
+static const struct WindowTemplate gUnknown_085EFDA4[] =
+{
+ {
+ .priority = 0,
+ .tilemapLeft = 14,
+ .tilemapTop = 9,
+ .width = 2,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 169,
+ }
+};
+
+static const u8 sClockFrames[8][3] =
+{
+ { 1, 0, 0 },
+ { 5, 0, 0 },
+ { 9, 0, 0 },
+ { 5, 0, 1 },
+ { 1, 0, 1 },
+ { 5, 1, 1 },
+ { 9, 1, 0 },
+ { 5, 1, 0 },
+};
+
+static const u8 gSaveFailedClockPal[] = INCBIN_U8("graphics/misc/clock_small.gbapal");
+static const u8 gSaveFailedClockGfx[] = INCBIN_U8("graphics/misc/clock_small.4bpp.lz");
+
static void CB2_SaveFailedScreen(void);
static void CB2_WipeSave(void);
static void CB2_GameplayCannotBeContinued(void);
@@ -140,9 +231,9 @@ static void CB2_SaveFailedScreen(void)
LoadBgTiles(0, gUnknown_0850E87C, 0x120, 0x214);
InitWindows(gUnknown_085EFD94);
// AddWindowWithoutTileMap returns a u16/integer, but the info is clobbered into a u8 here resulting in lost info. Bug?
- gSaveFailedWindowIds[TEXT_WIN_ID] = AddWindowWithoutTileMap(&gUnknown_085EFD9C);
+ gSaveFailedWindowIds[TEXT_WIN_ID] = AddWindowWithoutTileMap(gUnknown_085EFD9C);
SetWindowAttribute(gSaveFailedWindowIds[TEXT_WIN_ID], 7, (u32)&gDecompressionBuffer[0x2800]);
- gSaveFailedWindowIds[CLOCK_WIN_ID] = AddWindowWithoutTileMap(&gUnknown_085EFDA4);
+ gSaveFailedWindowIds[CLOCK_WIN_ID] = AddWindowWithoutTileMap(gUnknown_085EFDA4);
SetWindowAttribute(gSaveFailedWindowIds[CLOCK_WIN_ID], 7, (u32)&gDecompressionBuffer[0x3D00]);
DeactivateAllTextPrinters();
ResetSpriteData();
@@ -270,14 +361,14 @@ static void VBlankCB_UpdateClockGraphics(void)
{
unsigned int n = (gMain.vblankCounter2 >> 3) & 7;
- gMain.oamBuffer[0] = gClockOamData;
+ gMain.oamBuffer[0] = sClockOamData;
gMain.oamBuffer[0].x = 112;
gMain.oamBuffer[0].y = (CLOCK_WIN_TOP + 1) * 8;;
if (gSaveFailedClockInfo[CLOCK_RUNNING] != FALSE)
{
- gMain.oamBuffer[0].tileNum = gClockFrames[n][0];
- gMain.oamBuffer[0].matrixNum = (gClockFrames[n][2] << 4) | (gClockFrames[n][1] << 3);
+ gMain.oamBuffer[0].tileNum = sClockFrames[n][0];
+ gMain.oamBuffer[0].matrixNum = (sClockFrames[n][2] << 4) | (sClockFrames[n][1] << 3);
}
else
{
diff --git a/src/window.c b/src/window.c
index 704060b9d..f4cb48ec0 100644
--- a/src/window.c
+++ b/src/window.c
@@ -190,7 +190,7 @@ u16 AddWindow(const struct WindowTemplate *template)
return win;
}
-int AddWindowWithoutTileMap(struct WindowTemplate *template)
+int AddWindowWithoutTileMap(const struct WindowTemplate *template)
{
u16 win;
u8 bgLayer;