From 83fe7a99613b75a7951f6524655a6d340b2706fc Mon Sep 17 00:00:00 2001 From: Harrison <53527582+HTV04@users.noreply.github.com> Date: Sun, 7 Mar 2021 01:18:31 -0500 Subject: [PATCH] More finishing touches --- README.md | 42 ++++++++++--------- source/arm11/open_agb_firm.c | 4 +- .../{eeprom_fixer.py => eeprom-fixer.py} | 0 tools/gba-db-builder/gba-db-builder.py | 7 ++-- 4 files changed, 29 insertions(+), 24 deletions(-) rename tools/eeprom-fixer/{eeprom_fixer.py => eeprom-fixer.py} (100%) mode change 100755 => 100644 diff --git a/README.md b/README.md index 57b278e..5b22e21 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # open_agb_firm -open_agb_firm is a bare metal interface for *natively* running GBA games and homebrew using the 3DS's built-in GBA hardware. +open_agb_firm is a bare metal interface for *natively* running GBA games and homebrew using the 3DS's built-in GBA hardware. -open_gba_firm is a complete and better alternative to GBA VC injects (AGB_FIRM), allowing for: +open_agb_firm is also a complete and better alternative to GBA VC injects (AGB_FIRM), allowing for: * Launching GBA files directly from the SD card * Writing save files directly to the SD card * Automatic save type configuration using an included database @@ -14,7 +14,6 @@ open_agb_firm is currently in alpha. While open_agb_firm is relatively stable an Additionally, we are not responsible for any damage that may occur to your system as a direct or indirect result of you using open_agb_firm. ## Setup -The process to set up and launch open_agb_firm is similar to that of [GodMode9](https://github.com/d0k3/GodMode9). * Download the [latest release](https://github.com/profi200/open_agb_firm/releases/latest) and extract it. * Copy the `open_agb_firm.firm` file to your 3DS's SD card at `/luma/payloads` if you're using Luma3DS or `/gm9/payloads` if you're using fastboot3DS. * Copy the `3ds` folder to the root of your 3DS's SD card. Merge folders if asked. @@ -103,6 +102,24 @@ open_agb_firm runs GBA games natively, as in using the 3DS's built-in GBA hardwa * Reboots are required for switching between games. * No save states. Very difficult to implement because no direct hardware access. +## EEPROM Fixer +Most emulators output EEPROM saves differently than what open_agb_firm expects, making them incompatible. To address this, we made a Python script that fixes them. + +Windows: +* Make sure [Python 3](https://www.python.org/downloads/) is installed. +* Download [the script](tools/eeprom-fixer/eeprom-fixer.py). +* Drag and drop the `.SAV` file you want to fix onto `eeprom-fixer.py`. + +Linux: +* Make sure `python3` is installed (installed by default on most distros). +* Download [the script](tools/eeprom-fixer/eeprom-fixer.py). +* Open a terminal, and in the same directory as `eeprom-fixer.py`, run `chmod +x eeprom-fixer.py`. +* Type `./eeprom-fixer.py savefile.sav`, where `savefile.sav` is the path to your `.SAV` file. + +The steps for Linux may work on macOS with [Python 3](https://www.python.org/downloads/mac-osx/) installed, but have not been tested. + +Your save file should now be fixed and ready to use with open_agb_firm. The script also works vise versa, if you want to use a save generated by open_agb_firm with an emulator. + ## FAQ **Q: Why isn't open_agb_firm a normal 3DS app?**\ A: To access the 3DS's GBA hardware, open_agb_firm needs to run with full hardware access, which can only be provided by running as a FIRM. @@ -123,26 +140,13 @@ A: You're probably used to the way GBA games look on emulators. No worries, just A: open_agb_firm resorts to save autodetection when it can't find an entry for the game it's running in `gba_db.bin` (which only contains data for official games), and it's a bit wonky for games that use EEPROM or misleading SDK save strings. **Q: Why doesn't my save file from an emulator work?**\ -A: There's a good chance that the save you're having issues with is an EEPROM save, which most emulators output differently. To address this, we made a Python script that fixes them. - -Setup (Windows): -* Make sure [Python 3](https://www.python.org/downloads/) is installed. -* Download [the script](tools/eeprom-fixer/eeprom-fixer.py). -* Drag and drop the `.SAV` file you want to fix onto `eeprom-fixer.py`. - -Setup (Linux): -* Make sure `python3` is installed (installed by default on most distros). -* Download [the script](tools/eeprom-fixer/eeprom-fixer.py). -* Open a terminal, and in the same directory as `eeprom-fixer.py`, run `chmod +x eeprom-fixer.py`. -* Type `./eeprom-fixer.py savefile.sav`, where `savefile.sav` is the path to your `.SAV` file. - -Your save file should now be fixed and ready to use with open_agb_firm. The script also works vise versa, if you want to use a save generated by open_agb_firm with an emulator. +A: There's a good chance that the save you're having issues with is an EEPROM save, which most emulators output differently. See [EEPROM Fixer](#eeprom-fixer). **Q: My game doesn't save properly!**\ -A: First, please ensure that the `.GBA` ROM you are playing is not modified in any way, and matches its [No-Intro](https://datomatic.no-intro.org/) checksum. Second, make sure you aren't using an existing `.SAV` file, because some may have issues for various reasons. Third, make sure your [`gba_db.bin`](resources/gba_db.bin) is up-to-date. If everything seems to be in order but the game still doesn't save properly, please [open an issue](https://github.com/profi200/open_agb_firm/issues) so it can be fixed. In the meantime, the `useGbaDb` and `saveOverride` settings may be useful (see [Configuration](#configuration) for more information). +A: First, please ensure that the GBA ROM you are playing is not modified in any way, and matches its [No-Intro](https://datomatic.no-intro.org/) checksums. Second, make sure you aren't using an existing `.SAV` file, because some may have issues for various reasons. Third, make sure your [`gba_db.bin`](resources/gba_db.bin) is up-to-date. If everything seems to be in order but the game still doesn't save properly, please [open an issue](https://github.com/profi200/open_agb_firm/issues) so it can be fixed. In the meantime, the `useGbaDb` and `saveOverride` settings may be useful (see [Configuration](#configuration) for more information). ## Compiling -If you're using Windows 10, install and perform the following steps using [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/install-win10). +If you're using Windows 10, you can install and perform the following steps using [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/install-win10). To compile open_agb_firm, the following needs to be installed: * [devkitARM](https://devkitpro.org/wiki/devkitPro_pacman) diff --git a/source/arm11/open_agb_firm.c b/source/arm11/open_agb_firm.c index 6f41b79..51c0940 100644 --- a/source/arm11/open_agb_firm.c +++ b/source/arm11/open_agb_firm.c @@ -168,7 +168,7 @@ static Result loadGbaRom(const char *const path, u32 *const romSizeOut) return res; } -// Deprecated because of defaultSave. +// Deprecated due to gba_db.bin and defaultSave. /*static u16 checkSaveOverride(u32 serial) { static const struct @@ -200,7 +200,7 @@ static u16 detectSaveType(u32 romSize) { const u32 *romPtr = (u32*)ROM_LOC; u16 saveType; - // Deprecated because of defaultSave. + // Deprecated due to gba_db.bin and defaultSave. /*if((saveType = checkSaveOverride(romPtr[0xAC / 4])) != 0xFF) { debug_printf("Serial in override list.\n" diff --git a/tools/eeprom-fixer/eeprom_fixer.py b/tools/eeprom-fixer/eeprom-fixer.py old mode 100755 new mode 100644 similarity index 100% rename from tools/eeprom-fixer/eeprom_fixer.py rename to tools/eeprom-fixer/eeprom-fixer.py diff --git a/tools/gba-db-builder/gba-db-builder.py b/tools/gba-db-builder/gba-db-builder.py index c05abfe..5cdfac0 100755 --- a/tools/gba-db-builder/gba-db-builder.py +++ b/tools/gba-db-builder/gba-db-builder.py @@ -1,10 +1,10 @@ #!/usr/bin/env python3 -# open_agb_firm gba_db.bin Builder v2.7 +# open_agb_firm gba_db.bin Builder v2.8 # By HTV04 # # This script parses MAME's gba.xml (found here: https://github.com/mamedev/mame/blob/master/hash/gba.xml) and converts it to a gba_db.bin file for open_agb_firm. -# No-Intro's GBA DAT is also used for filtering and naming (found here: https://datomatic.no-intro.org/). The DAT should be renamed to "gba.dat". +# No-Intro's GBA DAT (with scene numbers) is also used for filtering and naming (found here: https://datomatic.no-intro.org/). The DAT should be renamed to "gba.dat". # # This script should work with any updates to MAME's gba.xml and the No-Intro DAT, unless something this script expects is changed. @@ -129,8 +129,9 @@ if __name__ == '__main__': print('Added entry "' + software.find('description').text + '"') count += 1 - # Add additional entries + # Add additional entries if "puremode" is false if not puremode: + # Title, serial, SHA-1, size, save type gbadbentries = ([['0246 - Kinniku Banzuke - Kimero! Kiseki no Kanzen Seiha (Japan)', 'AK5J', 'CF0A6C1C473BA6C85027B6071AA1CF6E21336974', 0x800000, 14]]) print()