Homebrew Game Boy Advance idle loop patches (i.e. speedhacks)

Vague Rant

Deceptively cute
OP
Member
Joined
Aug 7, 2008
Messages
2,463
Trophies
2
Location
Melbourne
Website
vaguerant.tumblr.com
XP
3,302
Country
Game Boy Advance emulation on 3DS is generally slow. One of the factors in this is that It's difficult to emulate a GBA that's working hard, and many games are quite taxing on the GBA's CPU. Fortunately, it's easier to emulate a GBA that's not working hard. Simple, well-programmed games shouldn't tax the GBA hardware all that much and should therefore be easier to emulate at full speed.

The problem here is that we can't assume that all GBA games are well-programmed. There is a particular way which some games are programmed which causes the GBA to work hard for no gain. Picture a car sitting in neutral while the driver revs the engine. The car isn't going anywhere, but the engine doesn't know or care.

On the up side, it is possible for talented hackers to improve these games' performance by optimizing their idle loops (so they're not revving the engine all the time, only when they're actually trying to drive fast). So here's a few patches for GBA games which hopefully should work just as well as their unpatched equivalents.

These patches are also useful on a real GBA, as driving the CPU less hard means lower power usage, so your batteries will last longer. On the 3DS, though, we're shooting for faster emulation rather than less battery drain.
Note: it's important to temper your expectations for these patches. They're not going to take a game from running 10FPS to 60FPS. However, for me on a New 3DS, WarioWare and Pokémon run much better with these patches than they do without. Drill Dozer, on the other hand, does still dip frequently--the game does genuinely appear to be working the CPU hard sometimes, and you can't just patch that out (although it's possible there are further optimizations to be had). While they shouldn't break anything, of course it's always possible they might.

If anyone else has created any idle loop patches, I'm sure people would be grateful to see them posted. Please try not to turn this into a request thread; people can't just optimize any game that currently runs slow, it has to run slow and run inefficiently and in a way which someone can improve without breaking.
 

Attachments

  • Drill Dozer (USA) [Idle Fix].zip
    225 bytes · Views: 258
  • Pokemon - Fire Red & Leaf Green Version (USA) [Idle Fix].zip
    281 bytes · Views: 310

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Most of the time when I do emulator focused hacks it is usually to sort scaling issues, however I have toyed with a few things like this in the past (mainly analysing patches you have already linked). If it is purely for speedup then there might be other relatively simple hacks that you can do, though they might not be advisable on real hardware if power consumption is your thing ( http://problemkaputt.de/gbatek.htm#gbacartridgerom ). Also no$gba debug (which is free these days) has a nice CPU bar on it that you might be able to figure out things from.

Oh and by most accounts the problem with Golden Sun is the interesting, though with the results it gets that is not a bad thing, approach it takes to the music so probably best not to expect anything there.
 

marc_max

Well-Known Member
Member
Joined
Jun 19, 2008
Messages
1,041
Trophies
1
Age
37
Website
www.marcrobledo.com
XP
2,788
Country
Sorry for bumping this, but...

I've ported all patches (but Advance Wars, see below) to their european versions, so we are finally able to play these in european languages without draining our GBA batteries!
I've only tested Drill Dozer in real hardware, but I don't see any reason the rest wouldn't work. no$gba shows an stable and reasonable CPU usage bar for every game.

I couldn't port the first Advance Wars. The vblank code jumps to an empty offset in the USA version. However, the european version has some localization strings in that offset. So I've tried to relocate the additional code to the bottom of the ROM. Unfortunately, I'm not used to GBA hardware, and the opcode it uses for that jump cannot jump much further. Solution should be trivial, but I have no time to look at it at the moment.
 

Attachments

  • gba_eur_idle_loop_fixes.zip
    1.4 KB · Views: 201

marc_max

Well-Known Member
Member
Joined
Jun 19, 2008
Messages
1,041
Trophies
1
Age
37
Website
www.marcrobledo.com
XP
2,788
Country
Will these idle loop patches for pokemon work on rim hacks of those games?
Idle loop patches for Pokémon FR/LG just edit a bunch of bytes in the vblank interruption. Assuming rom hacks don't touch that code, they should work. But you must apply the correct regional patch, as the offset for those bytes change slightly depending on the ROM region.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    OctoAori20 @ OctoAori20: Nice nice-