/gba-ezflash-iv-emulators

Various emulators for Gameboy Advance, exit-patched for EZ-Flash IV flashcarts

Primary LanguagePython

EZ-Flash IV Exit-Patched Emulator Collection

This is a collection of emulators for the Gameboy Advance, SRAM-patched and exit-patched to function optimally with the EZ-Flash IV flashcart. Modern cross-platform compilation builder scripts are also included.

Emulator Target System Author(s) 1st Release
PocketNES 1-4-2020 Nintendo NES Loopy, later FluBBa, Dwedit Jan 2001?
ZXAdvance 1.0.1a Sinclair ZX Spectrum 48K TheHiVE May 2001
PCEAdvance 7.5 NEC PC Engine / Super CD-ROM² FluBBa Apr 2003
Goomba Paletted 2.40 Nintendo Gameboy FluBBa Oct 2003
PocketBeeb 1.01 Acorn BBC Micro Model B Quirky Sep 2004
HVCA 1.40 Nintendo NES / Famicom Disk System outside-agb? Sep 2004
Wasabi 0.23 Watara Supervision FluBBa Nov 2004
SNESAdvance 0.1F Nintendo SNES Loopy, FluBBa Feb 2005
SMSAdvance 2.5 SEGA Master System / Game Gear / SG-1000 FluBBa Jul 2005
Cologne 0.8 ColecoVision FluBBa Jan 2006
Goomba Color 2019_5_4 Nintendo Gameboy / Gameboy Color FluBBa, Dwedit Jan 2006
MSXAdvance 0.2 MSX-1 (version 0.2 is most compatible) FluBBa Mar 2006
Murdoc 0.3 Mr. Do! Arcade Flubba May 2006
Snezziboy 0.26 Nintendo SNES bubble2k May 2006
NGPGBA 0.5.5 SNK Neo Geo Pocket / NGP Color Flubba Jul 2008
GhostsnGoblinsGBA 0.1 Ghosts'n Goblins Arcade Flubba Apr 2009
YieArKungFuGBA 0.1 Yie Ar Kung-Fu Arcade Flubba Apr 2009
Jagoomba 0.5 An enhanced Goomba Color fork FluBBa, Dwedit, Jaga + various Nov 2021

Background

These emulators were originally designed to be used in a number of ways:

  1. assemble many game ROMs into a large .gba compilation and browse the games from a menu upon launch
    • slow to load into EZ-Flash PSRAM before execution, single 64KB SRAM save may constrain
  2. as plugins for the Pogoshell file manager
    • only supports much older flashcart devices e.g. Flash2Advance
  3. bundle each game ROM with its own copy of the emulator into a standalone .gba file
    • best for EZ-Flash IV - plenty of SD card storage, quick to load, can use save states since each game has its own 64KB of SRAM

Purpose

This collection serves use case 3 above. In each emulator folder the build script will iterate through the ROMs in the current folder, building a .gba executable for each title. The build scripts invoke my own Python 3 gba-emu-compilation-builders scripts, which may also serve use case 1 if required. Run the compile script with -h for more information.

Each emulator's Exit function in the L+R menu was typically intended for Pogoshell-era flashcarts. Where needed, this function has been manually patched so that Exit actually returns to the EZ-Flash IV menu.

Usage

  • Install Python 3 if not present
  • git clone https://github.com/patters-syno/gba-ezflash-iv-emulators
  • Add games to the chosen emulator folder
  • See notes on firmware versions below
  • Run build.bat from a Command Prompt (Windows), or build.sh from a Terminal session (macOS / Linux)
  • Copy the resulting .gba files to the EZ-Flash IV SD card

EZ-Flash IV Versions

Firmware 2.x

  • The build scripts will generate the required patch files to force 64KB SRAM saves for each executable, to be placed in the PATCH folder on the SD card.
  • It is recommended that you disable the firmware's integrated GSS patcher (Global Soft-reset and Sleep) for the emulators. Add exclusions for the following GAME_IDs to the bottom of KEYSET.CFG at the root of your SD card:
    #GAMELIST TO SKIP GSS AUTOMATICALLY
    #EMULATORS
    BEEB = 1   #PocketBeeb
    COLG = 1   #Cologne
    GGAC = 1   #GhostsnGoblinsGBA
    GMBC = 1   #Goomba Color/Jagoomba
    GMBA = 1   #Goomba
    HVCA = 1   #HVCA
    MSXA = 1   #MSXAdvance
    MRDO = 1   #Murdoc
    NGPE = 1   #NGPGBA
    PCEA = 1   #PCEAdvance
    PNES = 1   #PocketNES
    SMSA = 1   #SMSAdvance
    SNAV = 1   #SNESAdvance
    SNZI = 1   #Snezziboy
    WSBI = 1   #Wasabi
    YIAC = 1   #YieArKungFuGBA
    ZXAV = 1   #ZXAdvance
    

Firmware 1.x

  • The .gba files produced by this collection are ready to be copied directly onto the SD card. Do not use the EZ4 Client to patch them.
  • The emulators in this collection have all been header-patched to force 64KB SRAM saves, using cory1492's v2 patcher (EZ4-64-2). The 1.x firmware reads some metadata from the GBA ROM header to determine save size, and without this fix many homebrew binaries will default to 32KB.
  • gbata7 was used to fix the GBA ROM header after these patches (emulators crash on some firmwares without this fix).
  • You will need to edit build.bat (for Windows) and build.sh (for macOS and Linux) to change the compile script options from -pat to -sav so that the blank save files are generated for each executable, to be placed in the Saver folder on the SD card.

Exit-Patching Method

Each of the emulators uses some variation of the visoly.s source file which was designed to exit back to early flash card menus or Pogoshell. Since they are not identical, it is not trivial to make a binary patcher. The following sample files are included to facilitate patching additional binaries:

File Description
ez4/reset_ez4.s Code to reset into ez4 loader; copies itself into ewram before running
ez4/reset_ez4.bin Binary to reset into ez4 loader
ez4/reset_ez4-2.s Code to reset into ez4 loader; switches from arm to thumb and runs in-place
ez4/reset_ez4-2.bin Binary to reset into ez4 loader
ez4/visoly.s Code to reset, as used in many of FluBBa's emulators
ez4/visoly.bin Binary to reset, as used in many of FluBBa's emulators

My own method for patching additional emulators was to check that their visoly.s was indeed mostly consistent with the versions in other emulator source code. Then I used a hex editor to compare exit-patched emulator binaries with their unpatched originals so I could determine the initial state of the replaced section (usually visoly.bin).

I found that by progressively trimming both ends of this sequence, I was able to successfully locate the equivalent section in the new binary, even if there were sometimes minor differences. Then it was a case of selecting the most appropriately sized variant of the reset_ez4 binary code to overwrite (usually reset_ez4.bin).


Emulator Tips

Cologne

  • Find the BIOS rom with the no-delay patch to speed up the boot time: "ColecoVision BIOS (1982) (No Title Delay Hack)"
  • R+Start to bring up the virtual controller keypad

MSXAdvance

PCEAdvance

SMSAdvance

  • BIOS booting (effectively a blank 16KB ROM image) requires the system type to be hard set to Master System, assuming Master System BIOS games, because without a ROM the emulator cannot guess which system BIOS (SMS or GG) should be loaded
  • "Lock toprows" is an option for Full Screen display mode useful for certain Master System games, such as Outrun, which can keeps the score/speedometer on screen despite cropping the image to the GBA resolution

SNESAdvance

Snezziboy

  • L+R+Start for the emulator menu
  • L+R+Select+Up to cycle BG Priority Sets
  • L+R+Select+Down to cycle Forced BG Modes
  • Wiki page
  • Compatibility list

YieArKungFuGBA

  • The emulator menu is broken unless you build a compilation with both ROM variants

HVCA

  • Hold L+R in the menu to exit back to the flashcart menu
  • A .cfg filename must match the filename of the game it targets

ZXAdvance:

  • ZXA.INI has a [section] for each game filename (lower case without file extension), the 'filename=' key is in fact how the game title will be displayed in the ZXAdvance ROM list. 'Config' can be Custom, or can refer to one of the sections prefixed with 'Config_' at the top of the file - e.g. Config=Kempston

PocketBeeb:

  • The original builder command line tool can be compiled on macOS using
    clang -Dlinux pbappend.c -o pbappend