Tell people that their emulator sucks or their GBA is broken instead of just blinding them.

This commit is contained in:
Skye Chappelle 2022-12-06 02:03:57 +00:00
parent 2211e349db
commit 211e3d5bac
2 changed files with 50 additions and 1 deletions

View File

@ -69,6 +69,8 @@ u8 gLinkVSyncDisabled;
u32 IntrMain_Buffer[0x200]; u32 IntrMain_Buffer[0x200];
s8 gPcmDmaCounter; s8 gPcmDmaCounter;
extern void CB2_FlashNotDetectedScreen(void); // for Crust's sake use mGBA, people!
static EWRAM_DATA u16 gTrainerId = 0; static EWRAM_DATA u16 gTrainerId = 0;
//EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL; //EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL;
@ -114,7 +116,7 @@ void AgbMain()
gSoftResetDisabled = FALSE; gSoftResetDisabled = FALSE;
if (gFlashMemoryPresent != TRUE) if (gFlashMemoryPresent != TRUE)
SetMainCallback2(NULL); SetMainCallback2(CB2_FlashNotDetectedScreen);
gLinkTransferringData = FALSE; gLinkTransferringData = FALSE;
sUnusedVar = 0xFC0; sUnusedVar = 0xFC0;

View File

@ -401,3 +401,50 @@ 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,
}
};
static const char errorMsg[] = _(
"{COLOR RED}Hey!\n"
"{COLOR DARK_GRAY}Flash memory not detected.\n\n"
"Please make sure you\nare playing the game\n"
"on the mGBA emu-\nlator"
);
if (!gMain.state){
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);
SaveFailedScreenTextPrint(errorMsg, 1, 0);
TransferPlttBuffer();
*(u16*)PLTT = RGB(17, 18, 31);
ShowBg(0);
gMain.state++;
}
}