diff options
author | neonloop | 2021-03-31 16:46:23 +0000 |
---|---|---|
committer | neonloop | 2021-03-31 16:46:23 +0000 |
commit | ab945e9e1baba5fbb691444b79b36930afb2a179 (patch) | |
tree | 0f717a0ba98be22d74a8d48cf17a9cd23712bb69 | |
parent | 295b35c2f32887a1b73b1509668bf278c52929e1 (diff) | |
download | picogpsp-ab945e9e1baba5fbb691444b79b36930afb2a179.tar.gz picogpsp-ab945e9e1baba5fbb691444b79b36930afb2a179.tar.bz2 picogpsp-ab945e9e1baba5fbb691444b79b36930afb2a179.zip |
Adds built-in BIOS support
If an official BIOS exists in the right place, it will be
used. Otherwise, the built-in BIOS will be used.
-rw-r--r-- | Makefile.linux | 2 | ||||
-rw-r--r-- | Makefile.trimui | 2 | ||||
-rw-r--r-- | frontend/main.c | 32 |
3 files changed, 28 insertions, 8 deletions
diff --git a/Makefile.linux b/Makefile.linux index 779b51d..f39aa91 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -8,7 +8,7 @@ CC = $(CROSS_COMPILE)gcc SYSROOT = $(shell $(CC) --print-sysroot) -OBJS = main.o cpu.o gba_memory.o video.o input.o sound.o cheats.o cpu_threaded.o x86/x86_stub.o gba_cc_lut.o \ +OBJS = main.o cpu.o gba_memory.o video.o input.o sound.o cheats.o cpu_threaded.o bios_data.o x86/x86_stub.o gba_cc_lut.o \ frontend/libpicofe/input.o frontend/libpicofe/in_sdl.o frontend/libpicofe/linux/in_evdev.o frontend/libpicofe/linux/plat.o frontend/libpicofe/fonts.o frontend/libpicofe/readpng.o frontend/libpicofe/config_file.o \ frontend/config.o frontend/menu.o frontend/plat_linux.o frontend/main.o frontend/scale.o diff --git a/Makefile.trimui b/Makefile.trimui index d765d15..cdbaa43 100644 --- a/Makefile.trimui +++ b/Makefile.trimui @@ -9,7 +9,7 @@ CC = $(CROSS_COMPILE)gcc SYSROOT = $(shell $(CC) --print-sysroot) OBJS = main.o cpu.o gba_memory.o video.o input.o sound.o gba_cc_lut.o \ - cheats.o arm/arm_stub.o cpu_threaded.o arm/video_blend.o \ + bios_data.o cheats.o arm/arm_stub.o cpu_threaded.o arm/video_blend.o \ frontend/libpicofe/input.o frontend/libpicofe/in_sdl.o \ frontend/libpicofe/linux/in_evdev.o frontend/libpicofe/linux/plat.o \ frontend/libpicofe/fonts.o frontend/libpicofe/readpng.o frontend/libpicofe/config_file.o \ diff --git a/frontend/main.c b/frontend/main.c index 35cb710..fb05708 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -296,6 +296,7 @@ fail: int main(int argc, char *argv[]) { + bool bios_loaded = false; char bios_filename[MAXPATHLEN]; char filename[MAXPATHLEN]; char path[MAXPATHLEN]; @@ -316,11 +317,30 @@ int main(int argc, char *argv[]) filename[0] = 0; } - getcwd(bios_filename, MAXPATHLEN); - strncat(bios_filename, "/gba_bios.bin", MAXPATHLEN - strlen(bios_filename)); - if (load_bios(bios_filename)) { - fprintf(stderr, "Could not load BIOS image file %s.\n", bios_filename); - return -1; + if (selected_bios == auto_detect || selected_bios == official_bios) { + bios_loaded = true; + getcwd(bios_filename, MAXPATHLEN); + strncat(bios_filename, "/gba_bios.bin", MAXPATHLEN - strlen(bios_filename)); + + if (load_bios(bios_filename)) { + if (selected_bios == official_bios) + printf("Could not load BIOS image file\n"); + bios_loaded = false; + } + + if (bios_loaded && bios_rom[0] != 0x18) { + if (selected_bios == official_bios) + printf("BIOS image seems incorrect\n"); + bios_loaded = false; + } + } + + if (bios_loaded) { + printf("Using official BIOS\n"); + } else { + /* Load the built-in BIOS */ + memcpy(bios_rom, open_gba_bios_rom, sizeof(bios_rom)); + printf("Using built-in BIOS\n"); } plat_get_root_dir(save_path, 512); @@ -345,7 +365,7 @@ int main(int argc, char *argv[]) init_sound(1); menu_init(); - #if defined(HAVE_DYNAREC) +#if defined(HAVE_DYNAREC) if (dynarec_enable) { #ifdef HAVE_MMAP |