Adds SAVE_TYPE_ERROR_SCREEN (#5188)
* Original commit * Moved config from save to general https://github.com/rh-hideout/pokeemerald-expansion/pull/5188\#discussion_r1720747901 Reindent function per https://github.com/rh-hideout/pokeemerald-expansion/pull/5188\#discussion_r1720747984 Split Compound String into seperate lines per https://github.com/rh-hideout/pokeemerald-expansion/pull/5188\#discussion_r1720748104 Changed Rom to ROM per https://github.com/rh-hideout/pokeemerald-expansion/pull/5188\#discussion_r1720748104 Removed extra new line per https://github.com/rh-hideout/pokeemerald-expansion/pull/5188\#discussion_r1720748172 * fixed spacing per https://github.com/rh-hideout/pokeemerald-expansion/pull/5188\#issuecomment-2295134679 * Updated spacing per https://github.com/rh-hideout/pokeemerald-expansion/pull/5188\#issuecomment-2306527812 * Removed comment and made line breaks consistent per https://github.com/rh-hideout/pokeemerald-expansion/pull/5188\#pullrequestreview-2320266015
This commit is contained in:
parent
b924461ae3
commit
ad0778722b
3 changed files with 55 additions and 1 deletions
|
@ -86,4 +86,5 @@
|
||||||
// Naming Screen
|
// Naming Screen
|
||||||
#define AUTO_LOWERCASE_KEYBOARD GEN_LATEST // Starting in GEN_6, after entering the first uppercase character, the keyboard switches to lowercase letters.
|
#define AUTO_LOWERCASE_KEYBOARD GEN_LATEST // Starting in GEN_6, after entering the first uppercase character, the keyboard switches to lowercase letters.
|
||||||
|
|
||||||
|
#define SAVE_TYPE_ERROR_SCREEN FALSE // When enabled, this shows an error message when the game is loaded on a cart without a flash chip or on an emulator with the wrong save type setting instead of crashing.
|
||||||
#endif // GUARD_CONFIG_GENERAL_H
|
#endif // GUARD_CONFIG_GENERAL_H
|
||||||
|
|
|
@ -34,6 +34,7 @@ static void IntrDummy(void);
|
||||||
|
|
||||||
// Defined in the linker script so that the test build can override it.
|
// Defined in the linker script so that the test build can override it.
|
||||||
extern void gInitialMainCB2(void);
|
extern void gInitialMainCB2(void);
|
||||||
|
extern void CB2_FlashNotDetectedScreen(void);
|
||||||
|
|
||||||
const u8 gGameVersion = GAME_VERSION;
|
const u8 gGameVersion = GAME_VERSION;
|
||||||
|
|
||||||
|
@ -114,7 +115,7 @@ void AgbMain()
|
||||||
gSoftResetDisabled = FALSE;
|
gSoftResetDisabled = FALSE;
|
||||||
|
|
||||||
if (gFlashMemoryPresent != TRUE)
|
if (gFlashMemoryPresent != TRUE)
|
||||||
SetMainCallback2(NULL);
|
SetMainCallback2((SAVE_TYPE_ERROR_SCREEN) ? CB2_FlashNotDetectedScreen : NULL);
|
||||||
|
|
||||||
gLinkTransferringData = FALSE;
|
gLinkTransferringData = FALSE;
|
||||||
|
|
||||||
|
|
|
@ -399,3 +399,55 @@ static bool8 WipeSectors(u32 sectorBits)
|
||||||
else
|
else
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CB2_FlashNotDetectedScreen(void)
|
||||||
|
{
|
||||||
|
static const struct WindowTemplate textWin[] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
.bg = 0,
|
||||||
|
.tilemapLeft = 3,
|
||||||
|
.tilemapTop = 2,
|
||||||
|
.width = 24,
|
||||||
|
.height = 16,
|
||||||
|
.paletteNum = 15,
|
||||||
|
.baseBlock = 1,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (gMain.state)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SetGpuReg(REG_OFFSET_DISPCNT, 0);
|
||||||
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||||
|
SetGpuReg(REG_OFFSET_BG0CNT, 0);
|
||||||
|
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
|
||||||
|
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
|
||||||
|
DmaFill16(3, 0, VRAM, VRAM_SIZE);
|
||||||
|
DmaFill32(3, 0, OAM, OAM_SIZE);
|
||||||
|
DmaFill16(3, 0, PLTT, PLTT_SIZE);
|
||||||
|
ResetBgsAndClearDma3BusyFlags(0);
|
||||||
|
InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
|
||||||
|
LoadBgTiles(0, gTextWindowFrame1_Gfx, 0x120, 0x214);
|
||||||
|
DeactivateAllTextPrinters();
|
||||||
|
ResetTasks();
|
||||||
|
ResetPaletteFade();
|
||||||
|
LoadPalette(gTextWindowFrame1_Pal, 0xE0, 0x20);
|
||||||
|
LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
|
||||||
|
InitWindows(textWin);
|
||||||
|
DrawStdFrameWithCustomTileAndPalette(0, TRUE, 0x214, 0xE);
|
||||||
|
static const u8 saveFailedMessage[] =_(
|
||||||
|
"{COLOR RED}ERROR! {COLOR DARK_GRAY}Flash memory not detected!\n"
|
||||||
|
"\n"
|
||||||
|
"If playing on an emulator, set your\n"
|
||||||
|
"save type setting to\n"
|
||||||
|
"Flash 1Mb/128K and reload the ROM.\n"
|
||||||
|
"\n"
|
||||||
|
"If playing on hardware, your cart\n"
|
||||||
|
"does not have a working flash chip.");
|
||||||
|
SaveFailedScreenTextPrint(saveFailedMessage, 1, 0);
|
||||||
|
TransferPlttBuffer();
|
||||||
|
*(u16*)PLTT = RGB(17, 18, 31);
|
||||||
|
ShowBg(0);
|
||||||
|
gMain.state++;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue