Hacking Homebrew [Release] AGB_edit: Edit/dump GBA VC injects & auto sleep on lid close

Chupi

Member
OP
Newcomer
Joined
Jun 9, 2015
Messages
12
Trophies
0
XP
158
Country
United States
Get the latest version on Github

This is a small and simple tool I created that can print info about and edit your existing GBA VC cias. The main thing that makes it unique is that it can set a button combo that AGB_FIRM will automatically press when you close the lid. Combined with a GBATA or NSUI sleep patch using the same key combo, this can give you proper GBA sleep mode when you close the lid. I suppose it can also be used to press start to pause the game when you close the lid.

Now in version 0.2, there's a screen filter editor beyond just changing the darken filter amount. AGB_FIRM provides a video lookup table (LUT), which can do the sorts of things the "curves" tool in Photoshop or Gimp can do. But all that Nintendo or existing community tools I've seen do with it is make linear darken filters. The top use of this is to make gamma correction filters -- many games look like the screen brightness is lowered with the darken filter, and washed out without it, but gamma correction makes it a lot more like AGS-101 or DS Lite colors. It can also make things like blue light filters and weird trippy effects.

It supports both official Ambassador Program ones as well as NSUI-generated ones, and preserves the manual in official ones. I point this out as a feature since some other tools only work with one or the other -- Nintendo uses index 2 in the cia for the GBA ROM and adds a manual at index 3, while NSUI puts the ROM at index 0 and no manual.

Features:
- Add a button combo to be pressed automatically when the lid is closed
- Change the LCD ghosting value / remove ghosting
- Make screen filters beyond just darken
- Interpret and print all info in the ROM footer
- Dump GBA ROM file to a file next to the cia but with the gba extension
- Dump cia and exefs contents to a folder with the name of the cia but .dump
- Batch processing of all of the above

The UI is all terminal based. Drag one or more GBA VC cia files to agb_edit.exe and it will present a series of prompts depending what you want to do. It spits out a bunch of info after the questions, so you might want to maximize the cmd window it runs in.

Source code is on Github, and I've cleaned it up a bit since 0.1 where it was all in one file, though it still has more spaghetti than I'd like. I'm still planning to clean up the code more and add a GUI.


This started as just a tool to set sleep buttons so I could have proper lid-close sleep mode in AGB_FIRM, since I found out it has this feature but there don't seem to be any tools to use it. Then it grew because I wanted an easy way to fix my old ambassador VCs' video. And then I thought it would be handy to dump the GBA ROM or leave the temp folder it makes to poke around in what it extracted.

0.1.0: Initial release.
0.2.0: Added screen filter editing with gamma correction, color temperature/whitepoint, brightness, contrast, ceiling, floor, invert and solarize effects. Moved code to Github. Separated code into multiple files.
0.2.0a: Swapped the 3 exes in progfiles for old versions that work more reliably.
 
Last edited by Chupi,

ziedriche

New Member
Newbie
Joined
Apr 21, 2022
Messages
4
Trophies
0
Age
34
Location
Manila
XP
27
Country
Philippines
Hi, i tried using this on a cia of FFTA I made using NSUI but the installed VC crashes on boot:

An error occurred (ErrDisp)
Error type: generic
Process ID: 15
Process name: menu
Process title ID: 0x0004003000008f02
Address: 0x0022939c
Error code: 0xc8804464

EDIT: the same happened with Golden Sun and Golden Sun TLA
 
Last edited by ziedriche,

Chupi

Member
OP
Newcomer
Joined
Jun 9, 2015
Messages
12
Trophies
0
XP
158
Country
United States
Update 0.2.0a: So, up until I packed the 0.2.0 release I was using old versions of the 3 exes in progfiles, ctrtool, 3dstool and makerom. As I was preparing that release I thought I'd go grab the latest versions, and then I did fairly minimal testing to see that everything still worked. It worked on the Ambassador Program cia I threw at it so I packed it up. Now I see it seems to be making bad results when people give it NSUI cias, so I've put back the old exes.

If you had errdisp / system crashes when loading cias you processed with 0.2.0, please try remaking them with 0.2.0a. Remember to uninstall the bad one before installing a new one.

If you try to install a new cia over an old one and get some error about "invalid argument" and "already exists" from module AM, do this:
1. Note the 16-digit title ID of the cia you're installing. Break it into two 8-digit halves.
2. In FBI, browse to SD Card\Nintendo 3DS\numbers\numbers\title, then the first 8 digits, then the last 8 digits.
3. Double and triple check that you're in the correct title ID.
4. Press A on current directory and DELETE. To reiterate, this is the dir named with the last 8 digits of the title ID. The one with the first 8 digits likely contains other titles in addition to this one.
5. Reboot! If you skip this, you'll get a "not found" error from module FS.
6. Get back to FBI and install your cia.
Seems the issue is that it deletes the title entry, but leaves the ticket and data directory, and then errors out because it's trying to install a title but the data directory for it already exists. So you delete the data dir, but then have to reboot to clear some disk cache.
 

Maxwellp

Member
Newcomer
Joined
Aug 5, 2011
Messages
14
Trophies
0
Location
Pennsylvania
XP
124
Country
United States
Do you have an example of the color change effects or a default setting/values to help make the colors look more like the original GBA screen? If this is terminal-based then I'm guessing we can't see the changes made until installing and starting the game.
 
  • Like
Reactions: ital

MikaDubbz

Well-Known Member
Member
Joined
Dec 12, 2017
Messages
2,920
Trophies
1
Age
34
XP
5,170
Country
United States
This is very cool. Is there a way to rip installed GBA VC titles and injects as .cias to our sd card? I set up all my GBA titles specifically and I didn't keep the .cias, so unless I can just directly pull out the .cias I have installed from my 3DS, I'll be looking at a headache to recreate all of the games I have installed.

Edit: nevermind, I see that GodMode can dump any installed titles onto my SD card in .cia format.
 
Last edited by MikaDubbz,

Chupi

Member
OP
Newcomer
Joined
Jun 9, 2015
Messages
12
Trophies
0
XP
158
Country
United States
Do you have an example of the color change effects or a default setting/values to help make the colors look more like the original GBA screen? If this is terminal-based then I'm guessing we can't see the changes made until installing and starting the game.
There are some on the main project page. And the default 2.2 input gamma and 1.54 output gamma makes something very similar to an AGS-101, minus the somewhat oversaturated colors. I don't have one that approximates AGS-001 since the haze makes it hard to compare with the light on, and the lack of light makes it hard to compare with it off; similarly with original GBA.

I plan to add a live preview feature in a future version. Until then, the best you can do is remake the graph it shows in the "curves" tool in Gimp or Photoshop.
 

AkitoUF

Well-Known Member
Member
Joined
Jan 5, 2016
Messages
274
Trophies
0
Age
31
XP
679
Country
Chile
Oh man, now I'll have to reinstall each GBA game on my 3DS... and some of those CIAs were specially patched ones from that ISO site, I don't think anyone can access those files anymore.
 

ital

Well-Known Member
Member
Joined
Jun 16, 2006
Messages
1,597
Trophies
0
XP
3,502
A before and after pic speaks volumes though.

@Chupi what does this app of yours mean in terms of burn in on the screen? See:

A few of us over on GAF has been tinkering with this, because it's awesome, but I wanted a share a post from another member there as a little thing to keep an eye out for.

"WARNING​
BE VERY CAREFUL ON WHAT GBA GAMES YOU DISABLE BLUR FOR.​
Some games, such as F Zero utilise a pseudo transparency mode, obtained by rapidly switching a layer on and off every other frame. Guess what happens if you turn the motion blur off? It fucks up your screen, and the 3DS lcd retains it.​
See that map screen burn in? That's on my New XL. The same also happened on my sister's standard N3DS with a different GBA title that I installed earlier when I was round their place. I've just told her to uninstall it.​
I've left a demo mode on a game running for a bit and now the burn in has faded on my console, but its made me wary of playing any other gba titles on it. Maybe the motion blur was there for an actual reason rather than Nintendo just being fucking stupid as usual.​
I'm sure 99% of the library will be fine, but it looks like any title that uses the same effect F Zero does for its map screen will fuck your lcd up."​

v18y0gp.png


Might be worth just keeping an eye out.

Have you tried it on F Zero?
 

BETA215

Unknown Member
Member
Joined
Dec 30, 2014
Messages
270
Trophies
0
Location
they/them | 0xDEAD brain
XP
960
Country
Argentina
A before and after pic speaks volumes though.

@Chupi what does this app of yours mean in terms of burn in on the screen? See:



Have you tried it on F Zero?
Well, Nintendo officially released that F-Zero game (and every game on the GBA VC) with different 'features' to make it more similar to the original console - one of them being ghosting. So, if you have the original VC release, or you turn on ghosting with this app or NSUI, you'll see it won't leave the borders of the map on the screen.
 

Chupi

Member
OP
Newcomer
Joined
Jun 9, 2015
Messages
12
Trophies
0
XP
158
Country
United States
Anyone got screenshots before and after so we can see how the new visuals look please?
I put some sample pictures on the Github page. Of course, since there are many parameters you can adjust, it's nowhere near a complete list of what you can make. It does include the default gamma correction next to an AGS-101 though. Sadly there isn't a live preview as you adjust it yet, but I'm planning to add it.

A before and after pic speaks volumes though.

@Chupi what does this app of yours mean in terms of burn in on the screen? See:



Have you tried it on F Zero?
I saw this thread too, so I intentionally left the ghosting enabled but slightly reduced for my F-Zero, but removed the dark filter and fixed the gamma. LCD "screenburn" isn't permanent and goes away after a while of normal use, but it isn't something I want either.
 
  • Like
Reactions: ital

ital

Well-Known Member
Member
Joined
Jun 16, 2006
Messages
1,597
Trophies
0
XP
3,502
I put some sample pictures on the Github page. Of course, since there are many parameters you can adjust, it's nowhere near a complete list of what you can make. It does include the default gamma correction next to an AGS-101 though. Sadly there isn't a live preview as you adjust it yet, but I'm planning to add it.


I saw this thread too, so I intentionally left the ghosting enabled but slightly reduced for my F-Zero, but removed the dark filter and fixed the gamma. LCD "screenburn" isn't permanent and goes away after a while of normal use, but it isn't something I want either.

That looks really good, thanks for the comparisons. Will check it out at TWL makes DS titles look absolutely amazing with its tweaks and it looks like this can do the same for GBA.

Thanks

*edit* Looking at this app I wonder if it would be possible to build a version that does the editing running on the 3DS instead of having to dump, edit, reupload, reinstall. Theoretically that should be possible as its just editing the config file I'd guess?
 
Last edited by ital,

Chupi

Member
OP
Newcomer
Joined
Jun 9, 2015
Messages
12
Trophies
0
XP
158
Country
United States
That looks really good, thanks for the comparisons. Will check it out at TWL makes DS titles look absolutely amazing with its tweaks and it looks like this can do the same for GBA.

Thanks
I don't tweak the scaling filter like TWPatch does for DS(i) mode. IMO the stock filter for GBA looks better than the DS one, probably because a 1.5x scale is easier to pull off than 1.25x. My tool just adjusts the parameters in AGB_FIRM VCs since there weren't any tools that do anything with it past dark filters and ghosting. What really prompted me to make it though was finding out that there's a feature where it can simulate button presses when you close the lid, which can give proper automatic sleep mode in most GBA games, but it was entirely unused with no tools to set it.
 
  • Like
Reactions: ital
General chit-chat
Help Users
    KenniesNewName @ KenniesNewName: https://youtu.be/1M4SCvbudCE