Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Open agb firm 3DS: Difference between revisions

From GameBrew
No edit summary
 
(13 intermediate revisions by 2 users not shown)
Line 3: Line 3:
|image=Openagbfirm2.png
|image=Openagbfirm2.png
|description=A bare metal app for running GBA homebrew/games using the 3DS builtin GBA hardware.
|description=A bare metal app for running GBA homebrew/games using the 3DS builtin GBA hardware.
|author=profi200
|author=derrek, profi200, d0k3
|lastupdated=2021/12/24
|lastupdated=2024/07/25
|type=Console
|type=Handheld
|version=alpha_2021-12-24
|version=beta_2024-07-25
|license=GPL-3.0
|license=GPL-3.0
|download=https://dlhb.gamebrew.org/3dshomebrews/openagbfirm.7z
|download=https://dlhb.gamebrew.org/3dshomebrews/openagbfirm.7z
Line 17: Line 17:


==Features==
==Features==
* A complete and better alternative to GBA VC injects (AGB_FIRM).
*Launching GBA files directly from the SD card.
* Launch GBA files directly from the SD card.
*Writing save files directly to the SD card.
* Write save files directly to the SD card.
*Automatic save type configuration using an included database.
* Automatic save type configuration using an included database.
*User configuration, such as gamma settings.
* User configuration, such as gamma settings.
*Button remapping.
* And more to come.
*Border support for 1:1 scaling mode.
*And more to come.


==Installation==
==Installation==
Download contains alpha version 2021-12-24 and a new build by [https://gbatemp.net/threads/open_agb_firm-discussion-thread.570844/post-9709423 stranno].
Copy the open_agb_firm.firm file to your 3DS's SD card at /luma/payloads/ if you're using Luma3DS or elsewhere if you're using fastboot3DS.
Copy the open_agb_firm.firm file to your 3DS's SD card at /luma/payloads/ if you're using Luma3DS or elsewhere if you're using fastboot3DS.


Line 44: Line 43:
** Old 3DS - Between 20 and 117.
** Old 3DS - Between 20 and 117.
** New 3DS - Between 16 and 142.
** New 3DS - Between 16 and 142.
* <code>bool directBoot</code> - Skip GBA BIOS intro at game startup (default: false).
* <code>u8 backlightSteps</code> - Adjustment amount for backlight brightness. (Default: 5)
* <code>bool useGbaDb</code> - Use gba_db.bin to get save types (default: true).
* <code>bool directBoot</code> - Skip GBA BIOS intro at game startup. (Default: false)
* <code>bool useGbaDb</code> - Use gba_db.bin to get save types. (Default: true)


'''Video-related:'''
'''Video-related:'''
* <code>u8 scaler</code> - Video scaler. 0 = none, 1 = bilinear, 2 = hardware (default: 2).
* <code>u8 scaler</code> - Video scaler. 0 = none, 1 = bilinear, 2 = hardware. (Default: 2)
* <code>float gbaGamma</code> - GBA input gamma (default: 2.2).
* <code>float gbaGamma</code> - GBA input gamma. (Default: 2.2)
* <code>float lcdGamma </code> - Output LCD gamma (default: 1.54).
* <code>float lcdGamma </code> - Output LCD gamma. (Default: 1.54)
* <code>float contrast </code> - Screen gain (default: 1.0).
* <code>float contrast </code> - Screen gain. (Default: 1.0)
* <code>float brightness </code> - Screen lift (default: 0.0).
* <code>float brightness</code> - Screen lift. (Default: 0.0)
* <code>string colorProfile</code> - Color correction profile: none/gba/nds/nds_white. (Default: none)
 
'''Audio related:'''
* <code>u8 audioOut</code> - Audio output. 0 = auto, 1 = speakers, 2 = headphones. (Default: 0)
* <code>s8 volume</code> - Audio volume. Range: -128 (muted) to -20 (100%). (Default: 127)
 
'''Input:'''
* Button mappings, allows one or multiple buttons separated by a , without space.
* Allowed buttons are A, B, SELECT, START, RIGHT, LEFT, UP, DOWN, R, L, X, Y, TOUCH, CP_RIGHT, CP_LEFT, CP_UP, CP_DOWN. (TOUCH reacts to all touchscreen presses. The CP in front is short for Circle-Pad.)
* Note that button mappings can cause input lag of up to 1 frame depending on when the game reads inputs, hence the default mapping of the Circle-Pad to D-Pad is no longer provided. Example config:
 
RIGHT=RIGHT,CP_RIGHT
LEFT=LEFT,CP_LEFT
UP=UP,CP_UP
DOWN=DOWN,CP_DOWN


'''Game-specific:'''  
'''Game-specific:'''  
* <code>u8 saveSlot</code> - Only intended to be used in the per-game settings (romName.ini in /3ds/open_agb_firm/saves). Savegame slot 0-9 (default: 0).
* <code>u8 saveSlot</code> - Only intended to be used in the per-game settings (romName.ini in /3ds/open_agb_firm/saves). Savegame slot 0-9. (Default: 0)
* <code>u8 saveType</code> - Override to use a specific save type. (Default: 255, disabled)


'''Advanced settings:'''
'''Advanced settings:'''
Line 68: Line 84:
** 14 - SRAM 256k (default value).
** 14 - SRAM 256k (default value).
** 15 - None.
** 15 - None.
===Patches===
open_agb_firm supports automatically applying IPS and UPS patches. To use a patch, rename the patch file to match the ROM file name (without the extension).
If you wanted to apply an IPS patch to example.gba, rename the patch file to example.ips.


===Hardware Limitations===
===Hardware Limitations===
Line 137: Line 158:
A/B/L/R/Start/Select - GBA buttons
A/B/L/R/Start/Select - GBA buttons


Select+Y - Dump screen output to /3ds/open_agb_firm/texture_dump.bmp (press Home if it freezes)
Select+Y - Dump screen output to /3ds/open_agb_firm/screenshots/YYYY_MM_DD_HH_MM_SS.bmp (press Home if it freezes)


Hold Power button - Turn off the 3DS
Hold Power button - Turn off the 3DS
Line 145: Line 166:


==Known issues==
==Known issues==
* Sleep mode is not fully implemented.
*Sleep mode is not fully implemented.
* Using Select+Y to dump screen output to a file can freeze the screen output sometimes.
*Using SELECT+Y to dump screen output to a file can freeze the screen output sometimes.
* Save type autodetection may still fail for certain games using EEPROM.
*Save type autodetection may still fail for certain games using EEPROM.
* Lack of settings (including brightness control during gameplay).
*Lack of settings.
* No cheats and other enhancements.
*No cheats and other enhancements.


==Changelog==
==Changelog==
'''beta build 2024-07-25'''
* Refactor IPS patching by [https://github.com/Nemris @Nemris] in [https://github.com/profi200/open_agb_firm/pull/163 #163]
* Video dithering has been fully disabled.
* [libn3ds] Fixed a GPIO handling bug that may or may not degrade New 3DS hardware.
* Screenshots now only contain the frame data itself and screenshots are in 5-bit RGB format which means they are 100% lossless. Beware of rounding errors when converting the .bmp files. GIMP is one program that converts them correctly. ImageMagick does '''not'''.
* Added experimental support for true color correction thanks to hunterk and Pokefan531 for their amazing [https://forums.libretro.com/t/real-gba-and-ds-phat-colors/1540/220 libretro shaders]. Please note that 2/3DS LCDs are generally poor quality and don't come correctly calibrated from factory so the actual look might not match the LCD on a GBA but it's a real improvement for games like Golden Sun which look awful otherwise (see below). Also note that enabling color correction will shorten battery runtime (Testers welcome. I didn't measure battery runtime with and without.). For more instructions refer to the colorProfile setting in the [https://github.com/profi200/open_agb_firm?tab=readme-ov-file#video README].<br />
More comparisons: https://i.ibb.co/6Z8tx29/all-sbs.png
* Other small changes under the hood which don't affect users.
'''alpha build 2023-10-06'''
* ROMs bigger than 32 MiB are now allowed but data beyond 32 MiB is cut off and a warning is displayed. This will make certain ROM hacks load at the cost of likely crashing later on. You have been warned.
* Taking screenshots no longer freeze occasionally and they are created with date and time in the name.
* Brightness Control by @spitzeqc
* Automatic ROM Patching by @spitzeqc
* Added a tool that can simulate hardware scaling for those who want to experiment with the hardware scaling on PC.
* Headphone detection should no longer fail if there is an integrated microphone/buttons (4 pole TRRS plugs).
* Button remapping has been added. See the README for details. Circle-Pad mappings are no longer enabled by default to reduce input lag.
* Added border support for 1:1 scaling mode. I didn't document this in the README yet, sorry. Refer to this post for instructions in the meantime.
* Added software volume control and audio output override. See the README for details.
* GBA database updates by @HTV04 in #128
* Fixed ROM mirroring for 8 mbit games. Thanks to @endrift.
* An audio filter that distorted GBA sound slightly has been disabled. In practice this change makes only a minor difference and does not fix the aliasing.
'''alpha build 2022-4-25'''
This is a build from the master branch for the impatient.
*Added configurable scaling so only 1 build is needed instead of one per scaling method. See the [https://github.com/profi200/open_agb_firm/blob/master/README.md#video README] on how to configure this.
*Fixed the missing newline in the default config.ini.
*firmtool support was added to the build system thanks to @Midnoclose.
*Fixed a bug that may cause the file browser not to display all 1000 files.
*Added day of week calculation for the GBA RTC.
*Other non-user facing improvements/fixes.
The save type database was not created by me and i can't vouch for its completeness or accuracy (i have not heard any complaints so far). Keep that in mind when using this build and backup your saves.
Also note that EEPROM savegames from some emulators or even flashcarts are incompatible because they are laid out wrong (every 8 bytes block of data is reversed). This tool can fix that.
The used scale matrix is the default "Sharp + edge enhance" one.
'''alpha build 2021-12-24'''
'''alpha build 2021-12-24'''
* Increased file browser entry limit to 1000 per folder (the real limit depends on the average file name length of all files).
* Increased file browser entry limit to 1000 per folder (the real limit depends on the average file name length of all files).
* Autoboot support has been added. Place autoboot.txt in /3ds/open_agb_firm containing the ROM path in a single line. Example path: sdmc:/rom.gba
* Autoboot support has been added. Place autoboot.txt in /3ds/open_agb_firm containing the ROM path in a single line. Example path: sdmc:/rom.gba.
* All savegames and per-game configs are now stored under /3ds/open_agb_firm/saves.
* All savegames and per-game configs are now stored under /3ds/open_agb_firm/saves.
* Per game config support has been added and with it multiple savegame slot support (up to 10). Currently this is the only officially supported config option for games. Place romName.ini (replace romName with the ROM file name) in /3ds/open_agb_firm/saves. See the README under the Game section.
* Per game config support has been added and with it multiple savegame slot support (up to 10). Currently this is the only officially supported config option for games. Place romName.ini (replace romName with the ROM file name) in /3ds/open_agb_firm/saves. See the README under the Game section.
Line 177: Line 237:
* Wolfvak, Sono and all the other people in #GodMode9 on freenode/Discord.
* Wolfvak, Sono and all the other people in #GodMode9 on freenode/Discord.
* endrift, Extrems and all the other people in #mgba on freenode.
* endrift, Extrems and all the other people in #mgba on freenode.
* Oleh Prypin (oprypin) for nightly.link
* [https://forums.libretro.com/t/real-gba-and-ds-phat-colors/1540/220 hunterk and Pokefan531 for their amazing libretro shaders]
* everyone who contributed to 3dbrew.org.
* everyone who contributed to 3dbrew.org.


Line 184: Line 246:
* GitHub - https://github.com/profi200/open_agb_firm
* GitHub - https://github.com/profi200/open_agb_firm
* GBAtemp - https://gbatemp.net/threads/open_agb_firm-discussion-thread.570844
* GBAtemp - https://gbatemp.net/threads/open_agb_firm-discussion-thread.570844
[[Category:3DS homebrew emulators]]
[[Category:Homebrew console emulators on 3DS]]

Latest revision as of 07:48, 28 July 2024

open_agb_firm
Openagbfirm2.png
General
Authorderrek, profi200, d0k3
TypeHandheld
Versionbeta_2024-07-25
LicenseGPL-3.0
Last Updated2024/07/25
Links
Download
Website
Source

open_agb_firm is a bare metal interface for natively running GBA games and homebrew using the 3DS's built-in GBA hardware.

Note: open_agb_firm is currently in alpha. While open_agb_firm is relatively stable and safe to use, some quirks that have not been fixed. Use at your own risk.

Features

  • Launching GBA files directly from the SD card.
  • Writing save files directly to the SD card.
  • Automatic save type configuration using an included database.
  • User configuration, such as gamma settings.
  • Button remapping.
  • Border support for 1:1 scaling mode.
  • And more to come.

Installation

Copy the open_agb_firm.firm file to your 3DS's SD card at /luma/payloads/ if you're using Luma3DS or elsewhere if you're using fastboot3DS.

Copy the 3ds folder to the root of your 3DS's SD card. Merge folders if asked.

Launch open_agb_firm using Luma3DS by holding Start while booting your 3DS or assign it to a slot if you're using fastboot3DS.

After open_agb_firm launches, use the file browser to navigate to a .gba ROM to run.

User guide

Configuration

Settings are stored in /3ds/open_agb_firm/config.ini.

General settings:

  • u8 backlight - Backlight brightness (default: 64, values ≤64 are recommended). Possible values are:
    • Old 3DS - Between 20 and 117.
    • New 3DS - Between 16 and 142.
  • u8 backlightSteps - Adjustment amount for backlight brightness. (Default: 5)
  • bool directBoot - Skip GBA BIOS intro at game startup. (Default: false)
  • bool useGbaDb - Use gba_db.bin to get save types. (Default: true)

Video-related:

  • u8 scaler - Video scaler. 0 = none, 1 = bilinear, 2 = hardware. (Default: 2)
  • float gbaGamma - GBA input gamma. (Default: 2.2)
  • float lcdGamma - Output LCD gamma. (Default: 1.54)
  • float contrast - Screen gain. (Default: 1.0)
  • float brightness - Screen lift. (Default: 0.0)
  • string colorProfile - Color correction profile: none/gba/nds/nds_white. (Default: none)

Audio related:

  • u8 audioOut - Audio output. 0 = auto, 1 = speakers, 2 = headphones. (Default: 0)
  • s8 volume - Audio volume. Range: -128 (muted) to -20 (100%). (Default: 127)

Input:

  • Button mappings, allows one or multiple buttons separated by a , without space.
  • Allowed buttons are A, B, SELECT, START, RIGHT, LEFT, UP, DOWN, R, L, X, Y, TOUCH, CP_RIGHT, CP_LEFT, CP_UP, CP_DOWN. (TOUCH reacts to all touchscreen presses. The CP in front is short for Circle-Pad.)
  • Note that button mappings can cause input lag of up to 1 frame depending on when the game reads inputs, hence the default mapping of the Circle-Pad to D-Pad is no longer provided. Example config:
RIGHT=RIGHT,CP_RIGHT
LEFT=LEFT,CP_LEFT
UP=UP,CP_UP
DOWN=DOWN,CP_DOWN

Game-specific:

  • u8 saveSlot - Only intended to be used in the per-game settings (romName.ini in /3ds/open_agb_firm/saves). Savegame slot 0-9. (Default: 0)
  • u8 saveType - Override to use a specific save type. (Default: 255, disabled)

Advanced settings:

  • bool saveOverride - Open save type override menu after selecting a game (default: false).
  • u16 defaultSave - Change save type default when save type is not in gba_db.bin and cannot be autodetected. Possible values:
    • 0, 1 - EEPROM 8k.
    • 2, 3 - EEPROM 64k.
    • 4, 6, 8 - Flash 512k RTC.
    • 5, 7, 9 - Flash 512k.
    • 10, 12 - Flash 1m RTC.
    • 11, 13 - Flash 1m.
    • 14 - SRAM 256k (default value).
    • 15 - None.

Patches

open_agb_firm supports automatically applying IPS and UPS patches. To use a patch, rename the patch file to match the ROM file name (without the extension).

If you wanted to apply an IPS patch to example.gba, rename the patch file to example.ips.

Hardware Limitations

open_agb_firm using the 3DS's built-in GBA hardware. Unfortunately, this comes with limitations compared to GBA emulators. This is a list of limitations cannot be solved in software/difficult to work around:

  • >32 MiB (>256 Mbit) games and homebrew.
  • Games with extra hardware built into the cartridge (except real-time clocks). Patches are required.
  • Proper save autodetection (can't find save type during gameplay).
  • GBA serial port (aka Link Cable).
  • >32 KiB (>256 Kbit) SRAM (homebrew games/emulators).
  • Reboots are required for switching between games.
  • No save states. Very difficult to implement because no direct hardware access.
  • Sound has lots of aliasing issues. No known workaround (hardware bug).

EEPROM Fixer

Most emulators output EEPROM saves differently than what open_agb_firm expects, making them incompatible.

Fortunately, they are very easy to fix, using this tool by exelotl.

The tool 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?

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.

Q. Is this safe to use?

Of course! While open_agb_firm does run with full hardware access, a lot of work has been put in by several people to ensure that nothing unexpected happens.

Some backend code from open_agb_firm is actually used in fastboot3ds.

Q. What games work with open_agb_firm?

In theory, all of them, except those that fall within the hardware limitations.

Q. How can I increase the brightness?

Increase the value of the backlight setting in config.ini.

See Configuration for more information.

Q. Why do the colors look off?

The default gamma settings are intended to make up for the washed out colors the 3DS LCD has.

If they look weird to you, setting the outGamma setting to 2.2 might help.

Q. Why do some of my ROM hacks/homebrew games have saving issues?

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?

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.

Q. My game doesn't save properly!

First, please ensure that the GBA ROM you are playing is not modified in any way, and matches its No-Intro 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 is up-to-date. If everything seems to be in order but the game still doesn't save properly, please open an issue so it can be fixed.

In the meantime, the useGbaDb and saveOverride settings may be useful (see Configuration for more information).

Controls

A/B/L/R/Start/Select - GBA buttons

Select+Y - Dump screen output to /3ds/open_agb_firm/screenshots/YYYY_MM_DD_HH_MM_SS.bmp (press Home if it freezes)

Hold Power button - Turn off the 3DS

Screenshots

openagbfirm3.gif

Known issues

  • Sleep mode is not fully implemented.
  • Using SELECT+Y to dump screen output to a file can freeze the screen output sometimes.
  • Save type autodetection may still fail for certain games using EEPROM.
  • Lack of settings.
  • No cheats and other enhancements.

Changelog

beta build 2024-07-25

  • Refactor IPS patching by @Nemris in #163
  • Video dithering has been fully disabled.
  • [libn3ds] Fixed a GPIO handling bug that may or may not degrade New 3DS hardware.
  • Screenshots now only contain the frame data itself and screenshots are in 5-bit RGB format which means they are 100% lossless. Beware of rounding errors when converting the .bmp files. GIMP is one program that converts them correctly. ImageMagick does not.
  • Added experimental support for true color correction thanks to hunterk and Pokefan531 for their amazing libretro shaders. Please note that 2/3DS LCDs are generally poor quality and don't come correctly calibrated from factory so the actual look might not match the LCD on a GBA but it's a real improvement for games like Golden Sun which look awful otherwise (see below). Also note that enabling color correction will shorten battery runtime (Testers welcome. I didn't measure battery runtime with and without.). For more instructions refer to the colorProfile setting in the README.

More comparisons: all-sbs.png

  • Other small changes under the hood which don't affect users.

alpha build 2023-10-06

  • ROMs bigger than 32 MiB are now allowed but data beyond 32 MiB is cut off and a warning is displayed. This will make certain ROM hacks load at the cost of likely crashing later on. You have been warned.
  • Taking screenshots no longer freeze occasionally and they are created with date and time in the name.
  • Brightness Control by @spitzeqc
  • Automatic ROM Patching by @spitzeqc
  • Added a tool that can simulate hardware scaling for those who want to experiment with the hardware scaling on PC.
  • Headphone detection should no longer fail if there is an integrated microphone/buttons (4 pole TRRS plugs).
  • Button remapping has been added. See the README for details. Circle-Pad mappings are no longer enabled by default to reduce input lag.
  • Added border support for 1:1 scaling mode. I didn't document this in the README yet, sorry. Refer to this post for instructions in the meantime.
  • Added software volume control and audio output override. See the README for details.
  • GBA database updates by @HTV04 in #128
  • Fixed ROM mirroring for 8 mbit games. Thanks to @endrift.
  • An audio filter that distorted GBA sound slightly has been disabled. In practice this change makes only a minor difference and does not fix the aliasing.

alpha build 2022-4-25

This is a build from the master branch for the impatient.

  • Added configurable scaling so only 1 build is needed instead of one per scaling method. See the README on how to configure this.
  • Fixed the missing newline in the default config.ini.
  • firmtool support was added to the build system thanks to @Midnoclose.
  • Fixed a bug that may cause the file browser not to display all 1000 files.
  • Added day of week calculation for the GBA RTC.
  • Other non-user facing improvements/fixes.

The save type database was not created by me and i can't vouch for its completeness or accuracy (i have not heard any complaints so far). Keep that in mind when using this build and backup your saves. Also note that EEPROM savegames from some emulators or even flashcarts are incompatible because they are laid out wrong (every 8 bytes block of data is reversed). This tool can fix that.

The used scale matrix is the default "Sharp + edge enhance" one.

alpha build 2021-12-24

  • Increased file browser entry limit to 1000 per folder (the real limit depends on the average file name length of all files).
  • Autoboot support has been added. Place autoboot.txt in /3ds/open_agb_firm containing the ROM path in a single line. Example path: sdmc:/rom.gba.
  • All savegames and per-game configs are now stored under /3ds/open_agb_firm/saves.
  • Per game config support has been added and with it multiple savegame slot support (up to 10). Currently this is the only officially supported config option for games. Place romName.ini (replace romName with the ROM file name) in /3ds/open_agb_firm/saves. See the README under the Game section.

Release notes.

Credits

Thanks to:

  • yellows8.
  • plutoo.
  • smea.
  • Normmatt.
  • WinterMute.
  • ctrulib devs.
  • LumaTeam.
  • devkitPro.
  • ChaN (fatfs).
  • benhoyt (inih).
  • fastboot3DS project.
  • MAME.
  • No-Intro.
  • Wolfvak, Sono and all the other people in #GodMode9 on freenode/Discord.
  • endrift, Extrems and all the other people in #mgba on freenode.
  • Oleh Prypin (oprypin) for nightly.link
  • hunterk and Pokefan531 for their amazing libretro shaders
  • everyone who contributed to 3dbrew.org.

Copyright (C) 2021 derrek, profi200, d0k3.

External links

Advertising: