mirror of https://github.com/mgba-emu/mgba.git
GBA: Automatically skip BIOS if ROM has invalid logo
This commit is contained in:
parent
8ba146c0c4
commit
4f94849728
1
CHANGES
1
CHANGES
|
@ -41,6 +41,7 @@ Other fixes:
|
||||||
Misc:
|
Misc:
|
||||||
- Core: Suspend runloop when a core crashes
|
- Core: Suspend runloop when a core crashes
|
||||||
- GB Video: Add default SGB border
|
- GB Video: Add default SGB border
|
||||||
|
- GBA: Automatically skip BIOS if ROM has invalid logo
|
||||||
- mGUI: Add margin to right-aligned menu text (fixes mgba.io/i/871)
|
- mGUI: Add margin to right-aligned menu text (fixes mgba.io/i/871)
|
||||||
- Qt: Rearrange menus some
|
- Qt: Rearrange menus some
|
||||||
- Qt: Clean up cheats dialog
|
- Qt: Clean up cheats dialog
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <mgba/internal/gba/renderers/video-software.h>
|
#include <mgba/internal/gba/renderers/video-software.h>
|
||||||
#include <mgba/internal/gba/savedata.h>
|
#include <mgba/internal/gba/savedata.h>
|
||||||
#include <mgba/internal/gba/serialize.h>
|
#include <mgba/internal/gba/serialize.h>
|
||||||
|
#include <mgba-util/crc32.h>
|
||||||
#ifdef USE_ELF
|
#ifdef USE_ELF
|
||||||
#include <mgba-util/elf-read.h>
|
#include <mgba-util/elf-read.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -129,6 +130,7 @@ static const struct mCoreMemoryBlock _GBAMemoryBlocksEEPROM[] = {
|
||||||
struct mVideoLogContext;
|
struct mVideoLogContext;
|
||||||
|
|
||||||
#define CPU_COMPONENT_AUDIO_MIXER CPU_COMPONENT_MISC_1
|
#define CPU_COMPONENT_AUDIO_MIXER CPU_COMPONENT_MISC_1
|
||||||
|
#define LOGO_CRC32 0xD0BEB55E
|
||||||
|
|
||||||
struct GBACore {
|
struct GBACore {
|
||||||
struct mCore d;
|
struct mCore d;
|
||||||
|
@ -658,7 +660,16 @@ static void _GBACoreReset(struct mCore* core) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ARMReset(core->cpu);
|
ARMReset(core->cpu);
|
||||||
if ((core->opts.skipBios && (gba->romVf || gba->memory.rom)) || (gba->romVf && GBAIsMB(gba->romVf))) {
|
bool forceSkip = gba->romVf && GBAIsMB(gba->romVf);
|
||||||
|
if (!(forceSkip || core->opts.skipBios) && (gba->romVf || gba->memory.rom) && gba->pristineRomSize >= 0xA0 && gba->biosVf) {
|
||||||
|
uint32_t crc = doCrc32(&gba->memory.rom[1], 0x9C);
|
||||||
|
if (crc != LOGO_CRC32) {
|
||||||
|
mLOG(STATUS, WARN, "Invalid logo, skipping BIOS");
|
||||||
|
forceSkip = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (forceSkip || (core->opts.skipBios && (gba->romVf || gba->memory.rom))) {
|
||||||
GBASkipBIOS(core->board);
|
GBASkipBIOS(core->board);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue